1 From b3afea5757af1a7356ba30d2e0a7d5909ca18121 Mon Sep 17 00:00:00 2001
2 From: Mike Frysinger <vapier@gentoo.org>
3 Date: Fri, 19 Nov 2010 23:48:20 -0500
4 Subject: [PATCH 3/4] NO_FORK: control usage of fork() for nommu systems
6 nommu systems lack a fork() function, so add a NO_FORK flag to control
7 its usage. We don't lose a ton of functionality in doing so, and on an
8 embedded system, this is OK.
10 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 pmap_check.c | 6 ++++--
16 4 files changed, 16 insertions(+), 2 deletions(-)
18 diff --git a/Makefile b/Makefile
19 index cfcfdbb..9df5574 100644
22 @@ -27,6 +27,11 @@ MAN_SED += -e 's/USE_DNS/yes/'
26 +# For no-mmu systems, we have to disable the fork() functions.
28 +CPPFLAGS += -DNO_FORK
31 # Comment out if your RPC library does not allocate privileged ports for
32 # requests from processes with root privilege, or the new portmap will
33 # always reject requests to register/unregister services on privileged
34 diff --git a/README b/README
35 index e0b561a..bda1707 100644
38 @@ -18,6 +18,7 @@ There is no "./configure", just use "make".
40 Some make variable can be used to control compilation.
42 + NO_FORK= if non-empty, don't use fork (good for nommu systems)
43 NO_PIE= if non-empty, don't build portmap as a PIE
44 NO_TCP_WRAPPER= if non-empty, don't use tcp_wrappers
45 USE_DNS= if set, tcp_wrappers can check peers based on hostname
46 diff --git a/pmap_check.c b/pmap_check.c
47 index 6b3e490..983414e 100644
50 @@ -302,8 +302,10 @@ static void logit(int severity, struct sockaddr_in *addr,
51 * getrpcbynumber() or syslog() does its thing.
60 /* Try to map program number to name. */
63 diff --git a/portmap.c b/portmap.c
64 index 2a98881..94abc64 100644
67 @@ -753,6 +755,7 @@ static void callit(struct svc_req *rqstp, SVCXPRT *xprt)
68 if ((pml = find_service(a.rmt_prog, a.rmt_vers,
69 (u_long)IPPROTO_UDP)) == NULL)
73 * fork a child to do the work. Parent immediately returns.
74 * Child exits upon completion.
75 @@ -763,6 +766,7 @@ static void callit(struct svc_req *rqstp, SVCXPRT *xprt)
80 port = pml->pml_map.pm_port;
82 me.sin_port = htons(port);
83 @@ -783,7 +787,9 @@ static void callit(struct svc_req *rqstp, SVCXPRT *xprt)
92 #ifndef IGNORE_SIGCHLD /* Lionel Cons <cons@dxcern.cern.ch> */