PRIV_POPEN

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
FILES
BUGS
AUTHOR
SEE ALSO

NAME

priv_popen, priv_pclose - process IO

SYNOPSIS

#include <privman.h>
FILE *priv_popen(const char *command, const char * type, const char *user,); int priv_pclose(FILE *stream);

DESCRIPTION

The priv_popen() function opens a process by creating a pipe, forking, and invoking the shell. The type argument may specify only reading or writing, not both. The resulting stream is correspondingly read-only or write-only.
The command argument is a pointer to a null-terminated string containing a shell command line. The command is bassed to /bin/sh using the -c flag; interpretation, if any, is performed by the shell. The mode argument is a pointer to a null-terminated string which must be either `r' for reading or `w' for writing.
See the man page for popen(3) for more details, as this method parallels popen(3).
The priv_pclose function waits for the associated process to terminate, and returns the exit status of the command as returned by wait4.

RETURN VALUE

On success, a pointer to a valid stream is returned. On error, NULL is returned and errno is set appropriately.
The priv_pclose function returns -1 if wait4 returns an error, or some other error is detected.

ERRORS

See popen(3) and pclose(3) for more detail. In addition to the errors listed there, priv_popen may set errno to EPERM if the user is not listed in an ``run_as'' configuration directive, or if the ``allow_as'' configuration primitive is not set to true. See privman_conf(5) for more details.

FILES

${prefix}/etc/privman.d/appname
The application's configuration file. See privman_conf(5)

BUGS

The file must

AUTHOR

Network Associates. Send email to <privman@nailabs.com>

SEE ALSO

priv_daemon(3) priv_execve(3) priv_fopen(3) priv_fork(3) priv_wait4(3) priv_init(3) privman_conf(5) priv_open(3) priv_pam(3) priv_rerunas(3) priv_respawn_as(3) privman(7)