On Thu, Dec 05 at 01:10, snoweyes wrote: > when you use busybox command , eg udhcpc > you can not get the right pid number in the udhcpc_main function. > when you use getpid() to get a value 495 , but the real num is 499 maybe.
I'm not sure I see the problem. After startup udhcpc_main() calls write_pidfile() directly and it writes the current PID. Then if it needs to run daemonised it calls the routine client_background() which calls bb_daemonize() to create a new process, and then calls write_pidfile() again to update the PID file with the new child process ID. If you run getpid() before the daemonise call you'll get the original "parent" ID, run it after the daemonise call you get the "child" ID. Both IDs are correct for different purposes. -- Bob Dunlop _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox