compile error of tcp/zoneserver.c in 1.3.07.08

Koh-ichi Ito kohi at iri.co.jp
Sun Jun 15 22:56:24 EDT 2008


Hello Boris,

Thanks for your response.

At Fri, 13 Jun 2008 12:18:49 +0200,
Boris Dores wrote:
> 
>   The proper solution seems to be to replace "setpgrp()" by
> "setpgid(0,0)" (or to #ifdef based on the platform which seems
> unnecessary here).
> 
>   I have checked that this new fix works on Linux. Could you please
> recompile with this change, and tell us if it works ok on BSD (the
> purpose of these lines is that if you kill the parent process, it must
> kill all children too) ?
> 
>   If it does, I think it will be safe for Sam to apply this correction.

Compilation with setpgid(0,0) is okey and it looks that to
set pgid to its own pid works fine.

type95# ps ajxwwp 9780
USER   PID  PPID  PGID   SID JOBC STAT  TT       TIME COMMAND
bind  9780  9779  9780  9051    1 I     p0    0:00.01 /proj/maradns/sbin/zoneserver


Though setpgid(2) on CentOS says:
If  pgid  is  zero,  the  process ID of the process specified by pid is
used.

The call setpgrp() is equivalent to setpgid(0,0).


On the other hand, setpgid(2) on FreeBSD says:
COMPATIBILITY
     The setpgrp() system call is identical to setpgid(), and is retained for
     calling convention compatibility with historical versions of BSD.

and nothing is mentioned on the case of pgid is 0.

You may browse FreeBSD man page at
http://www.freebsd.org/cgi/man.cgi.


As the answer of easy puzzle, I guess that
setpgid(0,getpid()) satisfies that...
- work on Linux fine.
- within the documented usage on FreeBSD.
so this must be better fix.


Conclusion:
- setpgid(0,0) which Boris kindly show me also works fine on
  FreeBSD.
- According to the man page on CentOS, setpgid(0,0) is right
  usage.
 - 0 as second argument means the pid itself, so it is
   equivalant to my trial.
- According to the man page on FreeBSD, setpgid(0,0) is
  undocumented usage.
- I guess setpgid(0,getpid()) is better.

Regards,

						Koh-ichi Ito




More information about the list mailing list