> > Hi! > > ---- > > Does Unix/Solaris have a function to change the > process's name returned > by $ ps -ef # ?
Process name can come from various places: from /proc/*/psinfo: * pr_psargs (first 80 characters of args as of exec time) * pr_fname (exec name) * pr_argv (offsets into process address space?) Directly from kmem (in an instance of struct proc): * p_user.u_psargs (same as pr_psargs) * p_user.u_argv (similar to pr_argv) * p_user.u_comm (haven't checked if that corresponds to pr_fname) ISTR that sendmail has a function called setproctitle() or somesuch; that will re-create the commands args, which /usr/ucb/ps auxw will see _if_ one is the same euid as the process (or root), so that one has permission to read the address space; otherwise one only sees the saved 80 characters as of the latest exec in that process, which is also what /usr/bin/ps -f shows. There is no facility for resetting u_psargs or pr_psargs, as far as I know. Notwithstanding that it might be pretty and/or informative to do so, it might also be used for evil purposes, i.e. some nasty program trying to pretend it is something innocent. Therefore, IMO it's better that the more common (and unprivileged) view of a process's "name" can't readily be altered by that process. -- This message posted from opensolaris.org _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
