svn commit: r252603 - head/usr.sbin/rwhod

Hiroki Sato hrs at FreeBSD.org
Sat Aug 3 16:25:22 UTC 2013


Pawel Jakub Dawidek <pjd at FreeBSD.org> wrote
  in <201307032104.r63L4KEE015937 at 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 <oshogbo at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20130804/b93e8bfc/attachment.sig>


More information about the svn-src-head mailing list