}
static void
-check_foreground(void)
+check_foreground()
{
if (io_fds[SFD_USERTTY] != -1) {
foreground = tcgetpgrp(io_fds[SFD_USERTTY]) == ppgrp;
* Returns SIGUSR1 if the child should be resume in foreground else SIGUSR2.
*/
static int
-suspend_parent(int signo, struct io_buffer *iobufs)
+suspend_parent(signo, iobufs)
+ int signo;
+ struct io_buffer *iobufs;
{
sigaction_t sa, osa;
int n, oldmode = ttymode, rval = 0;
* ala execvp(3) if we get ENOEXEC.
*/
static int
-my_execve(const char *path, char *argv[], char *envp[])
+my_execve(path, argv, envp)
+ const char *path;
+ char *argv[];
+ char *envp[];
{
execve(path, argv, envp);
if (errno == ENOEXEC) {
}
static void
-terminate_child(pid_t pid, int use_pgrp)
+terminate_child(pid, use_pgrp)
+ pid_t pid;
+ int use_pgrp;
{
/*
* Kill child with increasing urgency.
}
static struct io_buffer *
-io_buf_new(int rfd, int wfd, int (*action)(const char *, unsigned int),
- struct io_buffer *head)
+io_buf_new(rfd, wfd, action, head)
+ int rfd;
+ int wfd;
+ int (*action) __P((const char *, unsigned int));
+ struct io_buffer *head;
{
struct io_buffer *iob;
* Returns the number of errors.
*/
static int
-perform_io(struct io_buffer *iobufs, fd_set *fdsr, fd_set *fdsw)
+perform_io(iobufs, fdsr, fdsw)
+ struct io_buffer *iobufs;
+ fd_set *fdsr;
+ fd_set *fdsw;
{
struct io_buffer *iob;
int n, errors = 0;
* controlling tty, belongs to child's session but has its own pgrp.
*/
int
-sudo_execve(const char *path, char *argv[], char *envp[], uid_t uid,
- struct command_status *cstat)
+sudo_execve(path, argv, envp, uid, cstat)
+ const char *path;
+ char *argv[];
+ char *envp[];
+ uid_t uid;
+ struct command_status *cstat;
{
sigaction_t sa;
struct io_buffer *iob, *iobufs = NULL;
}
static void
-deliver_signal(pid_t pid, int signo)
+deliver_signal(pid, signo)
+ pid_t pid;
+ int signo;
{
int status;
* Return value is the same as send(2).
*/
static int
-send_status(int fd, struct command_status *cstat)
+send_status(fd, cstat)
+ int fd;
+ struct command_status *cstat;
{
int n = -1;
* Returns TRUE if child is still alive, else FALSE.
*/
static int
-handle_sigchld(int backchannel, struct command_status *cstat)
+handle_sigchld(backchannel, cstat)
+ int backchannel;
+ struct command_status *cstat;
{
int status, alive = TRUE;
pid_t pid;
* Returns an error if fork(2) fails, else calls _exit(2).
*/
int
-exec_monitor(const char *path, char *argv[], char *envp[],
- int backchannel, int rbac)
+exec_monitor(path, argv, envp, backchannel, rbac)
+ const char *path;
+ char *argv[];
+ char *envp[];
+ int backchannel;
+ int rbac;
{
struct command_status cstat;
struct timeval tv;
* Does not read from /dev/tty.
*/
static void
-flush_output(struct io_buffer *iobufs)
+flush_output(iobufs)
+ struct io_buffer *iobufs;
{
struct io_buffer *iob;
struct timeval tv;
* Returns only if execve() fails.
*/
static void
-exec_pty(const char *path, char *argv[], char *envp[],
- int rbac_enabled)
+exec_pty(path, argv, envp, rbac_enabled)
+ const char *path;
+ char *argv[];
+ char *envp[];
+ int rbac_enabled;
{
sigaction_t sa;
pid_t self = getpid();
* Propagates tty size change signals to pty being used by the command.
*/
static void
-sync_ttysize(int src, int dst)
+sync_ttysize(src, dst)
+ int src;
+ int dst;
{
#ifdef TIOCGSIZE
struct ttysize tsize;
* The recvsig[] array is checked in the main event loop.
*/
static void
-handler(int s)
+handler(s)
+ int s;
{
recvsig[s] = TRUE;
}
* Handler for SIGWINCH in parent.
*/
static void
-sigwinch(int s)
+sigwinch(s)
+ int s;
{
int serrno = errno;
* Return value is the same as send(2).
*/
static int
-safe_close(int fd)
+safe_close(fd)
+ int fd;
{
/* Avoid closing /dev/tty or std{in,out,err}. */
if (fd < 3 || fd == io_fds[SFD_USERTTY]) {
static union io_fd io_fds[IOFD_MAX];
void
-io_nextid(void)
+io_nextid()
{
struct stat sb;
char buf[32], *ep;
}
static int
-build_idpath(char *pathbuf, size_t pathsize)
+build_idpath(pathbuf, pathsize)
+ char *pathbuf;
+ size_t pathsize;
{
struct stat sb;
int i, len;
}
static void *
-open_io_fd(char *pathbuf, int len, const char *suffix, int docompress)
+open_io_fd(pathbuf, len, suffix, docompress)
+ char *pathbuf;
+ int len;
+ const char *suffix;
+ int docompress;
{
void *vfd = NULL;
int fd;
}
static int
-log_io(const char *buf, unsigned int len, int idx)
+log_io(buf, len, idx)
+ const char *buf;
+ unsigned int len;
+ int idx;
{
struct timeval now, tv;
sigset_t omask;
}
int
-log_ttyin(const char *buf, unsigned int len)
+log_ttyin(buf, len)
+ const char *buf;
+ unsigned int len;
{
return log_io(buf, len, IOFD_TTYIN);
}
int
-log_ttyout(const char *buf, unsigned int len)
+log_ttyout(buf, len)
+ const char *buf;
+ unsigned int len;
{
return log_io(buf, len, IOFD_TTYOUT);
}
int
-log_stdin(const char *buf, unsigned int len)
+log_stdin(buf, len)
+ const char *buf;
+ unsigned int len;
{
return log_io(buf, len, IOFD_STDIN);
}
int
-log_stdout(const char *buf, unsigned int len)
+log_stdout(buf, len)
+ const char *buf;
+ unsigned int len;
{
return log_io(buf, len, IOFD_STDOUT);
}
int
-log_stderr(const char *buf, unsigned int len)
+log_stderr(buf, len)
+ const char *buf;
+ unsigned int len;
{
return log_io(buf, len, IOFD_STDERR);
}
}
static char *
-resolve_editor(char *editor, int *argc_out, char ***argv_out)
+resolve_editor(editor, argc_out, argv_out)
+ char *editor;
+ int *argc_out;
+ char ***argv_out;
{
char *cp, **nargv, *editor_path = NULL;
int ac, nargc, wasblank;
* includes the editor with the specified files.
*/
static char *
-find_editor(int *argc_out, char ***argv_out)
+find_editor(argc_out, argv_out)
+ int *argc_out;
+ char ***argv_out;
{
char *cp, *editor, *editor_path = NULL, **ev, *ev0[4];
* Must have the ability to change the effective uid to use sudoedit.
*/
int
-sudo_edit(int argc, char *argv[], char *envp[])
+sudo_edit(argc, argv, envp)
+ int argc;
+ char *argv[];
+ char *envp[];
{
return 1;
}