diff options
authorSergey Poznyakoff <gray@gnu.org.ua>2015-01-21 19:58:28 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2015-01-21 19:58:28 +0200
commit891bb67de28c778827d4841b04d440caac8be18a (patch)
parentcb8b9461907373485acabb90bc1cad5263abc8b8 (diff)
New component flag: nullinput
* NEWS: Update. * doc/pies.texi: Document nullinput flag. * src/pies.c (str_to_cf): New flag: nullinput * src/pies.h (CF_NULLINPUT): New flag. * src/progman.c (prog_start): If CF_NULLINPUT flag is set, redirect /dev/null to the stdin
5 files changed, 43 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 319e36c..8cdb1a8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
-GNU Pies NEWS -- history of user-visible changes. 2014-12-26
-Copyright (C) 2009-2013 Sergey Poznyakoff
+GNU Pies NEWS -- history of user-visible changes. 2015-01-21
+Copyright (C) 2009-2015 Sergey Poznyakoff
See the end of file for copying conditions.
Please send Pies bug reports to <bug-pies@gnu.org> or
@@ -8,11 +8,19 @@ Please send Pies bug reports to <bug-pies@gnu.org> or
Version 1.2.91 (Git)
-* New flag siggroup.
+* New flags
+- siggroup
This flag instructs pies to send termination signal to the process
group of the process being stopped.
+- nullinput
+Do not close standard input. Redirect it from /dev/null
+instead. Use this option with commands that require their standard
+input to be open (e.g. pppd nodetach).
Version 1.2, 2009-12-11
@@ -80,7 +88,7 @@ part of Mailfromd (http://mailfromd.software.gnu.org.ua).
Copyright information:
-Copyright (C) 2009-2013 Sergey Poznyakoff
+Copyright (C) 2009-2015 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
diff --git a/doc/pies.texi b/doc/pies.texi
index 37ade1b..3bcb349 100644
--- a/doc/pies.texi
+++ b/doc/pies.texi
@@ -731,38 +731,55 @@ Define flags for this component. The @var{flag-list} is a
comma-separated list of flags. Valid flags are:
@table @asis
+@kwindex disable
@item disable
This component is disabled, i.e.@: @command{pies} will parse and
remember its settings, but will not start it.
+@kwindex nullinput
+@cindex stdin
+@cindex standard input
+@item nullinput
+Do not close standard input. Redirect it from @file{/dev/null}
+instead. Use this option with commands that require
+their standard input to be open (e.g.@: @command{pppd nodetach}).
+@kwindex precious
@item precious
Mark this component as @dfn{precious}. Precious components are never
disabled by @command{pies}, even if they respawn too fast.
+@kwindex wait
@item wait
This flag is valid only for @samp{inetd} components. It has the same
meaning as @samp{wait} in @file{inetd.conf} file, i.e. it tells
@command{pies} to wait for the server program to
return. @xref{inetd.conf, wait}.
+@kwindex tcpmux
@item tcpmux
This is a @acronym{TCPMUX} component. @xref{TCPMUX}.
+@kwindex tcpmuxplus
@item tcpmuxplus
This is a @acronym{TCPMUX+} component. @xref{TCPMUX}.
+@kwindex internal
@item internal
This is an internal inetd component. @xref{builtin}.
+@kwindex sockenv
@item sockenv
This inetd component wants socket description variables in its
environment. @xref{sockenv}.
+@kwindex resolve
@item resolve
When used with @samp{sockenv}, the @env{LOCALHOST} and
@env{REMOTEHOST} environment variables will contain resolved host
names, instead of IP addresses.
+@kwindex siggroup
@item siggroup
This flag affects the befavior of @command{pies} when a stopped
process fails to terminate within a predefined timeout
diff --git a/src/pies.c b/src/pies.c
index e1a7356..b92b7a3 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -904,6 +904,7 @@ str_to_cf (const char *string, int *flags)
{ "sockenv", CF_SOCKENV },
{ "resolve", CF_RESOLVE },
{ "siggroup", CF_SIGGROUP },
+ { "nullinput", CF_NULLINPUT },
{ NULL }
diff --git a/src/pies.h b/src/pies.h
index 73f6d18..b627b47 100644
--- a/src/pies.h
+++ b/src/pies.h
@@ -202,6 +202,8 @@ enum pies_comp_mode
#define CF_RESOLVE 0x080 /* Resolve IP addresses */
#define CF_SIGGROUP 0x100 /* Send signals to the process group */
+#define CF_NULLINPUT 0x200 /* Provide null input stream */
struct component
diff --git a/src/progman.c b/src/progman.c
index e666535..1455f67 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -1207,6 +1207,17 @@ prog_start (struct prog *prog)
+ if (prog->v.p.comp->flags & CF_NULLINPUT)
+ {
+ close(0);
+ if (open("/dev/null", O_RDONLY) != 0)
+ {
+ logmsg (LOG_CRIT, "can't open /dev/null: %s",
+ strerror(errno));
+ _exit(127);
+ }
+ }
if (redir[RETR_OUT] == -1)
close (1);

Return to:

Send suggestions and report system problems to the System administrator.