]> git.pld-linux.org Git - packages/rpcbind.git/blob - rpcbind-warmstart.patch
- Allow the warms start code to be enabled at compile time
[packages/rpcbind.git] / rpcbind-warmstart.patch
1 diff --git a/configure.in b/configure.in
2 index 9a64b45..0e2f163 100644
3 --- a/configure.in
4 +++ b/configure.in
5 @@ -18,6 +21,23 @@ AC_ARG_ENABLE(debug,[  --enable-debug      Turns on rpcbind debugging],
6         esac],[debug=false])
7  AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
8  
9 +AC_ARG_ENABLE(warmstarts,[  --enable-warmstarts  Enables Warm Starts], 
10 +       [case "${enableval}" in
11 +               yes) warmstarts=true ;;
12 +               no)  warmstarts=no ;;
13 +               *) AC_MSG_ERROR(bad value ${enableval} for --enable-warmstarts) ;;
14 +       esac],[warmstarts=false])
15 +AM_CONDITIONAL(WARMSTART, test x$warmstarts = xtrue)
16 +
17 +if test "$warmstarts" = "true" ; then
18 +       AC_ARG_WITH(statedir,
19 +               [  --with-statedir=/foo use state dir /foo [/tmp]],
20 +       statedir=$withval,
21 +               statedir=/tmp)
22 +               AC_SUBST(statedir)
23 +       AC_DEFINE_UNQUOTED(RPCBIND_STATEDIR, "$statedir", [This defines the location where the state files will be kept for warm starts])
24 +fi
25 +
26  AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h \
27                    netinet/in.h stdlib.h string.h \
28                    sys/param.h sys/socket.h \
29 diff --git a/man/rpcbind.8 b/man/rpcbind.8
30 index 2d59ce8..7985f0f 100644
31 --- a/man/rpcbind.8
32 +++ b/man/rpcbind.8
33 @@ -131,6 +131,14 @@ to use non-privileged ports for outgoing connections, preventing non-privileged
34  clients from using
35  .Nm
36  to connect to services from a privileged port.
37 +.It Fl w
38 +Cause
39 +.Nm
40 +to do a "warm start" by read a state file when
41 +.Nm
42 +starts up. The state file is created when
43 +.Nm
44 +terminates.
45  .El
46  .Sh NOTES
47  All RPC servers must be restarted if
48 diff --git a/src/Makefile.am b/src/Makefile.am
49 index 52d3857..fd80847 100644
50 --- a/src/Makefile.am
51 +++ b/src/Makefile.am
52 @@ -1,5 +1,14 @@
53  INCLUDES = -I$(srcdir)/tirpc -DPORTMAP -DINET6 -DVERSION="\"$(VERSION)\"" \
54                                                  -D_GNU_SOURCE -Wall -pipe
55 +if DEBUG
56 +INCLUDES +=    -DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
57 +INCLUDES +=    -DND_DEBUG -DBIND_DEBUG
58 +endif
59 +
60 +if WARMSTART
61 +INCLUDES +=    -DWARMSTART
62 +endif
63 +
64  
65  bin_PROGRAMS = rpcbind rpcinfo
66  
67 @@ -18,10 +27,6 @@ rpcbind_LDFLAGS = -lpthread -ltirpc
68  rpcbind_LDADD = $(LIB_TIRPC)
69  AM_CPPFLAGS = -I/usr/include/tirpc -DCHECK_LOCAL -DPORTMAP \
70                         -DFACILITY=LOG_MAIL -DSEVERITY=LOG_INFO
71 -if DEBUG
72 -INCLUDES +=    -DRPCBIND_DEBUG -DSVC_RUN_DEBUG -DDEBUG_RMTCALL
73 -INCLUDES +=    -DND_DEBUG -DBIND_DEBUG
74 -endif
75  
76  $(rpcbind_OBJECTS) :    security.o util.o check_bound.o pmap_svc.o \
77                          rpcb_svc.o rpcb_svc_com.o rpcb_svc_4.o \
78 diff --git a/src/warmstart.c b/src/warmstart.c
79 index 4a40639..6a50c41 100644
80 --- a/src/warmstart.c
81 +++ b/src/warmstart.c
82 @@ -46,17 +46,21 @@
83  #include <syslog.h>
84  #include <unistd.h>
85  
86 +#include "config.h"
87  #include "rpcbind.h"
88  
89  /*
90   * XXX this code is unsafe and is not used. It should be made safe.
91   */
92  
93 +#ifndef RPCBIND_STATEDIR
94 +#define RPCBIND_STATEDIR "/tmp"
95 +#endif
96  
97  /* These files keep the pmap_list and rpcb_list in XDR format */
98 -#define        RPCBFILE        "/tmp/rpcbind.file"
99 +#define        RPCBFILE        RPCBIND_STATEDIR "/rpcbind.file"
100  #ifdef PORTMAP
101 -#define        PMAPFILE        "/tmp/portmap.file"
102 +#define        PMAPFILE        RPCBIND_STATEDIR "/portmap.file"
103  #endif
104  
105  static bool_t write_struct __P((char *, xdrproc_t, void *));
This page took 0.037995 seconds and 3 git commands to generate.