Pawel Jakub Dawidek <p...@freebsd.org> wrote
  in <201307032104.r63l4kee015...@svn.freebsd.org>:

pj> Author: pjd
pj> Date: Wed Jul  3 21:04:20 2013
pj> New Revision: 252603
pj> URL: http://svnweb.freebsd.org/changeset/base/252603
pj>
pj> Log:
pj>   The whole sending functionality was implemented within signal handler,
pj>   which is very bad idea. Split sending and receiving in two processes,
pj>   which fixes this problem and will help to sandbox rwhod.
pj>
pj>   Submitted by:     Mariusz Zaborski <osho...@freebsd.org>
pj>   Sponsored by:     Google Summer of Code 2013
pj>   Reviewed by:      pjd
pj>   MFC after:        1 month

(snip)

pj>     if (!quiet_mode) {
pj> -           signal(SIGALRM, onalrm);
pj> -           onalrm(0);
pj> +           pid_child_receiver = pdfork(&fdp, 0);
pj> +           if (pid_child_receiver == 0) {
pj> +                   receiver_process();
pj> +           } else if (pid_child_receiver > 0) {
pj> +                   sender_process();
pj> +           } else if (pid_child_receiver == -1) {
pj> +                   syslog(LOG_ERR, "pdfork: %m");
pj> +                   exit(1);
pj> +           }

 pdfork() is available only when options PROCDESC is defined and
 GENERIC does not have it.

-- Hiroki

Attachment: pgpMj2KlYE9ew.pgp
Description: PGP signature

Reply via email to