pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/parpd Fix kqueue usage when forking in the background



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b49eca9aeb2a
branches:  trunk
changeset: 364493:b49eca9aeb2a
user:      manu <manu%pkgsrc.org@localhost>
date:      Mon Jun 26 09:59:15 2017 +0000

description:
Fix kqueue usage when forking in the background

This restores parpd functionnality on NetBSD 7.x
Submitted upstream as https://dev.marples.name/T127

diffstat:

 net/parpd/Makefile              |   3 +-
 net/parpd/distinfo              |   3 +-
 net/parpd/patches/patch-parpd.c |  46 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)

diffs (75 lines):

diff -r a26cfecf0f12 -r b49eca9aeb2a net/parpd/Makefile
--- a/net/parpd/Makefile        Mon Jun 26 09:48:34 2017 +0000
+++ b/net/parpd/Makefile        Mon Jun 26 09:59:15 2017 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.13 2017/03/24 16:49:10 roy Exp $
+# $NetBSD: Makefile,v 1.14 2017/06/26 09:59:15 manu Exp $
 #
 
 DISTNAME=              parpd-1.7
+PKGREVISION=           1
 CATEGORIES=            net
 MASTER_SITES=          ftp://roy.marples.name/pub/parpd/
 MASTER_SITES+=         http://roy.marples.name/downloads/parpd/
diff -r a26cfecf0f12 -r b49eca9aeb2a net/parpd/distinfo
--- a/net/parpd/distinfo        Mon Jun 26 09:48:34 2017 +0000
+++ b/net/parpd/distinfo        Mon Jun 26 09:59:15 2017 +0000
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.8 2017/03/24 16:49:10 roy Exp $
+$NetBSD: distinfo,v 1.9 2017/06/26 09:59:15 manu Exp $
 
 SHA1 (parpd-1.7.tar.xz) = 50fab1942ba2ab733a7664ee87d0791bac3e88cc
 RMD160 (parpd-1.7.tar.xz) = d223a80ff5018579e4decf28183e9d448d2fd747
 SHA512 (parpd-1.7.tar.xz) = d682d4ce012e87e0e9b051d96ead61f6dc273a0e193ea45f556e902924a7d02a25b7913af9ed779dced51ce658457f8308e71b34f7bba3adcf4be23973322b40
 Size (parpd-1.7.tar.xz) = 18624 bytes
+SHA1 (patch-parpd.c) = 16978a037b420ba5b1f38a64b5d0b42b8c2cc7f7
diff -r a26cfecf0f12 -r b49eca9aeb2a net/parpd/patches/patch-parpd.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/parpd/patches/patch-parpd.c   Mon Jun 26 09:59:15 2017 +0000
@@ -0,0 +1,46 @@
+$NetBSD: patch-parpd.c,v 1.1 2017/06/26 09:59:16 manu Exp $
+
+Submitted upstream as https://dev.marples.name/T127
+
+From 63d9d122d83dc358c6180d52187026f099ab6389 Mon Sep 17 00:00:00 2001
+From: Emmanuel Dreyfus <manu%netbsd.org@localhost>
+Date: Mon, 26 Jun 2017 11:38:39 +0200
+Subject: [PATCH] Fix kqueue usage when forking in the background
+
+NetBSD's kqueue(2) man page says "The queue is not inherited by a
+child created with fork(2)", which means the poll_fd needs to be
+reopen after forking in the background.
+
+This is done by calling eloop_requeue() after daemon().
+---
+ parpd.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git parpd.c parpd.c
+index a178696..dbf26c4 100644
+--- parpd.c
++++ parpd.c
+@@ -718,9 +718,17 @@ main(int argc, char **argv)
+               goto out;
+       }
+ 
+-      if (!fflag && daemon(0, 0) == -1) {
+-              syslog(LOG_ERR, "daemon: %m");
+-              goto out;
++      if (!fflag) {
++              if (daemon(0, 0) == -1) {
++                      syslog(LOG_ERR, "daemon: %m");
++                      goto out;
++              }
++
++              /* At least for kqueue, poll_fd gets invalidated by fork */
++                if (eloop_requeue(eloop) == -1) {
++                        syslog(LOG_ERR, "eloop_requeue after fork: %m");
++                        goto out;
++                }
+       }
+ 
+       opt = eloop_start(eloop, &sigset);
+-- 
+2.11.0
+



Home | Main Index | Thread Index | Old Index