On Mon, Jul 14, 2014 at 1:52 PM, Gustav Fransson Nyvell <[email protected]> wrote:
> On 07/14/14 09:42, Philip Guenther wrote: > > On Mon, Jul 14, 2014 at 4:25 AM, Gustav Fransson Nyvell <[email protected] > > wrote: > >> I'm looking at 5.5-current. I'm forking inside a lib and I want to change >> the forks cmd or argv[0]. I mean, what you see as "command" in ps or top. >> I've looked at setproctitle. > > > There are two different things that ps will display with a title > "command": the "args" format and the "ucomm" format. The former is used by > "ps -u" and "ps -l" and can be modified by setproctitle(). The latter is > the final path component of the argv[0] passed to execve and can only be > modified by exec. > > I see, too bad. Any plans on making it possible? kvm_setargv? > No. Since it has doesn't appear to be related to the problem you're experiencing, I don't know why you ask. > I've gotten a dozen questions why I'm doing this and the reason is X runs >> my lib or a program that runs my lib and thus gets fork, which it can't >> handle. I think this is because it has the same command name (probably not.) >> > > "Thus gets fork"? What does that mean? What is the actual error that > occurs? > > Well, it gets a forked child on it's hand, which it wasn't expecting. > Sorry, I read a lot of poetry. When I run startx from the login shell after > boot (no xdm etc) X starts up with a frozen cursor and sort of overlays the > background with itself, it looks weird. Or it flicks and then goes back to > console with dots . . . until it goes back to the prompt. I looked at what > happens when ksh (which uses my lib) runs .xinitrc and it gets 3 children > (my assertion.) All but the original will die. Does this confuse X11 to > think that .xinitrc yielded or ended and thus shut down the "session?" (As > it does if you don't exec <mywm> on the last line on .xinitrc.) > When the process that's executing your .xinitrc exits, startx/xinit will shutdown the X server and then itself exit, taking you back to the non-X shell prompt. Your .xinitrc should end with execution on some program which will not exit until you want to exit X; many people have it be their window manager. This is described in the startx(1) manpage: The .xinitrc is typically a shell script which starts many clients according to the user's preference. When this shell script exits, startx kills the server and performs any other session shutdown needed. Most of the clients started by .xinitrc should be run in the background. The last client should run in the foreground; when it exits, the session will exit. People often choose a session manager, window manager, or xterm as the ''magic'' client. Since I don't understand what problem you are trying to solve by double forking or using daemon(), I cannot comment on those. Philip Guenther
