shrek wu
2009-Jan-08 06:52 UTC
[Samba] If we use vfork, can the smbd and nmbd work rightly?
Hi All, I has been trying to port the Samba package to uClinux. But our uClinux toolchain doesn't support the fork() call. I must replace the fork with vfork.If we use vfork, the smbd and nmbd can not work rightly. both samba-3.0.32 and samba-3.0.2a have the question. In samba/source/smbd/server.c, the function open_sockets_smbd(), creates a child process and a parent process. Both these functions need to do different tasks in smbd at about the same time. The call to vfork() creates a child process and blocks the parent process, but vfork() differs from fork() in that the parent is suspended until the child makes a call to execve(2) or _exit(2). So we replaced the fork with vfork in samba, smbd and nmbd can not work rightly. Had somebody let the smbd and nmbd can work using vfork()? What I can do let the smbd and nmbd can work using vfork()? Thanks shrek
Volker Lendecke
2009-Jan-08 08:32 UTC
[Samba] If we use vfork, can the smbd and nmbd work rightly?
On Thu, Jan 08, 2009 at 02:51:55PM +0800, shrek wu wrote:> I has been trying to port the Samba package to uClinux. But our uClinux > toolchain doesn't support the fork() call. > I must replace the fork with vfork.If we use vfork, the smbd and nmbd can > not work rightly. > both samba-3.0.32 and samba-3.0.2a have the question. > > In samba/source/smbd/server.c, the function open_sockets_smbd(), creates a > child process and a parent process. > Both these functions need to do different tasks in smbd at about the same > time. > The call to vfork() creates a child process and blocks the parent process, > but vfork() differs from fork() in that the parent is suspended until the > child makes a call to execve(2) or _exit(2). > So we replaced the fork with vfork in samba, smbd and nmbd can not work > rightly. > > Had somebody let the smbd and nmbd can work using vfork()? > What I can do let the smbd and nmbd can work using vfork()?The easy way for smbd would be to let it run in inetd mode and have inetd do the vfork call. nmbd except for being a wins server with "dns proxy = yes" should not fork at all after having become a daemon. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20090108/2f0d7aa3/attachment.bin