static void cause_sigalrm(minix_timer_t *tp);
/*===========================================================================*
- * ticks_from_timeval *
+ * ticks_from_timeval *
*===========================================================================*/
static clock_t ticks_from_timeval(tv)
struct timeval *tv;
* this be declared properly without combinatorial explosion of message
* types?
*/
-
+
/* In any case, the following conversion must always round up. */
ticks = system_hz * (unsigned long) tv->tv_sec;
}
/*===========================================================================*
- * timeval_from_ticks *
+ * timeval_from_ticks *
*===========================================================================*/
static void timeval_from_ticks(tv, ticks)
struct timeval *tv;
}
/*===========================================================================*
- * is_sane_timeval *
+ * is_sane_timeval *
*===========================================================================*/
-static int is_sane_timeval(tv)
-struct timeval *tv;
+static int
+is_sane_timeval(struct timeval *tv)
{
/* This imposes a reasonable time value range for setitimer. */
return (tv->tv_sec >= 0 && tv->tv_sec <= MAX_SECS &&
tv->tv_usec >= 0 && tv->tv_usec < US);
}
-
+
/*===========================================================================*
* do_itimer *
*===========================================================================*/
-int do_itimer()
+int
+do_itimer(void)
{
struct itimerval ovalue, value; /* old and new interval timers */
int setval, getval; /* set and/or retrieve the values? */
}
/*===========================================================================*
- * getset_vtimer *
+ * getset_vtimer *
*===========================================================================*/
-static void getset_vtimer(rmp, which, value, ovalue)
-struct mproc *rmp;
-int which;
-struct itimerval *value;
-struct itimerval *ovalue;
+static void
+getset_vtimer(struct mproc *rmp, int which, struct itimerval *value, struct itimerval *ovalue)
{
clock_t newticks, *nptr; /* the new timer value, in ticks */
clock_t oldticks, *optr; /* the old ticks value, in ticks */
/* If no timer is set, the interval must be zero. */
if (newticks <= 0)
rmp->mp_interval[which] = 0;
- else
+ else
rmp->mp_interval[which] =
ticks_from_timeval(&value->it_interval);
}
}
/*===========================================================================*
- * check_vtimer *
+ * check_vtimer *
*===========================================================================*/
-void check_vtimer(proc_nr, sig)
-int proc_nr;
-int sig;
+void
+check_vtimer(int proc_nr, int sig)
{
register struct mproc *rmp;
int which, num;
}
/*===========================================================================*
- * get_realtimer *
+ * get_realtimer *
*===========================================================================*/
-static void get_realtimer(rmp, value)
-struct mproc *rmp;
-struct itimerval *value;
+static void
+get_realtimer(struct mproc *rmp, struct itimerval *value)
{
clock_t exptime; /* time at which alarm will expire */
clock_t uptime; /* current system time */
}
/*===========================================================================*
- * set_realtimer *
+ * set_realtimer *
*===========================================================================*/
-static void set_realtimer(rmp, value)
-struct mproc *rmp;
-struct itimerval *value;
+static void
+set_realtimer(struct mproc *rmp, struct itimerval *value)
{
clock_t ticks; /* New amount of ticks to the next alarm. */
clock_t interval; /* New amount of ticks for the alarm's interval. */
}
/*===========================================================================*
- * set_alarm *
+ * set_alarm *
*===========================================================================*/
void set_alarm(rmp, ticks)
struct mproc *rmp; /* process that wants the alarm */
}
/*===========================================================================*
- * cause_sigalrm *
+ * cause_sigalrm *
*===========================================================================*/
static void cause_sigalrm(tp)
minix_timer_t *tp;
/*
* Publish a process event to interested subscribers. The event is determined
- * from the process flags. In addition, if the event is a process exit, also
+ * from the process flags. In addition, if the event is a process exit, also
* check if it is a subscribing service that died.
*/
void
/*===========================================================================*
* do_exec *
*===========================================================================*/
-int do_exec()
+int
+do_exec(void)
{
message m;
/*===========================================================================*
* do_fork *
*===========================================================================*/
-int do_fork()
+int
+do_fork(void)
{
/* The process pointed to by 'mp' has forked. Create a child process. */
register struct mproc *rmp; /* pointer to parent */
* way through is such a nuisance.
*/
rmp = mp;
- if ((procs_in_use == NR_PROCS) ||
+ if ((procs_in_use == NR_PROCS) ||
(procs_in_use >= NR_PROCS-LAST_FEW && rmp->mp_effuid != 0))
{
printf("PM: warning, process table is full!\n");
/*===========================================================================*
* do_srv_fork *
*===========================================================================*/
-int do_srv_fork()
+int
+do_srv_fork(void)
{
/* The process pointed to by 'mp' has forked. Create a child process. */
register struct mproc *rmp; /* pointer to parent */
* way through is such a nuisance.
*/
rmp = mp;
- if ((procs_in_use == NR_PROCS) ||
+ if ((procs_in_use == NR_PROCS) ||
(procs_in_use >= NR_PROCS-LAST_FEW && rmp->mp_effuid != 0))
{
printf("PM: warning, process table is full!\n");
/*===========================================================================*
* do_exit *
*===========================================================================*/
-int do_exit()
+int
+do_exit(void)
{
/* Perform the exit(status) system call. The real work is done by exit_proc(),
* which is also called when a process is killed by a signal. System processes
/*===========================================================================*
* exit_proc *
*===========================================================================*/
-void exit_proc(rmp, exit_status, dump_core)
-register struct mproc *rmp; /* pointer to the process to be terminated */
-int exit_status; /* the process' exit status (for parent) */
-int dump_core; /* flag indicating whether to dump core */
+void
+exit_proc(
+ register struct mproc *rmp, /* pointer to the process to be terminated */
+ int exit_status, /* the process' exit status (for parent) */
+ int dump_core /* flag indicating whether to dump core */
+)
{
/* A process is done. Release most of the process' possessions. If its
* parent is waiting, release the rest, else keep the process slot and
rmp->mp_child_utime += user_time; /* add user time */
rmp->mp_child_stime += sys_time; /* add system time */
- /* Tell the kernel the process is no longer runnable to prevent it from
- * being scheduled in between the following steps. Then tell VFS that it
+ /* Tell the kernel the process is no longer runnable to prevent it from
+ * being scheduled in between the following steps. Then tell VFS that it
* the process has exited and finally, clean up the process at the kernel.
* This order is important so that VFS can tell drivers to cancel requests
* such as copying to/ from the exiting process, before it is gone.
rmp->mp_flags |= EXITING;
/* Keep the process around until VFS is finished with it. */
-
+
rmp->mp_exitstatus = (char) exit_status;
/* For normal exits, try to notify the parent as soon as possible.
*/
printf("PM: The scheduler did not want to give up "
"scheduling %s, ret=%d.\n", rmp->mp_name, r);
- }
+ }
/* sched_stop is either called when the process is exiting or it is
* being moved between schedulers. If it is being moved between
/*===========================================================================*
* do_wait4 *
*===========================================================================*/
-int do_wait4()
+int
+do_wait4(void)
{
-/* A process wants to wait for a child to terminate. If a child is already
+/* A process wants to wait for a child to terminate. If a child is already
* waiting, go clean it up and let this WAIT4 call terminate. Otherwise,
- * really wait.
+ * really wait.
* A process calling WAIT4 never gets a reply in the usual way at the end
* of the main loop (unless WNOHANG is set or no qualifying child exists).
* If a child has already exited, the routine tell_parent() sends the reply
/*===========================================================================*
* wait_test *
*===========================================================================*/
-int wait_test(rmp, child)
-struct mproc *rmp; /* process that may be waiting */
-struct mproc *child; /* process that may be waited for */
+int
+wait_test(
+ struct mproc *rmp, /* process that may be waiting */
+ struct mproc *child /* process that may be waited for */
+)
{
/* See if a parent or tracer process is waiting for a child process.
* A tracer is considered to be a pseudo-parent.
/*===========================================================================*
* zombify *
*===========================================================================*/
-static void zombify(rmp)
-struct mproc *rmp;
+static void
+zombify(struct mproc *rmp)
{
/* Zombify a process. First check if the exiting process is traced by a process
* other than its parent; if so, the tracer must be notified about the exit
/*===========================================================================*
* check_parent *
*===========================================================================*/
-static void check_parent(child, try_cleanup)
-struct mproc *child; /* tells which process is exiting */
-int try_cleanup; /* clean up the child when done? */
+static void
+check_parent(
+ struct mproc *child, /* tells which process is exiting */
+ int try_cleanup /* clean up the child when done? */
+)
{
/* We would like to inform the parent of an exiting child about the child's
* death. If the parent is waiting for the child, tell it immediately;
/*===========================================================================*
* tell_tracer *
*===========================================================================*/
-static void tell_tracer(child)
-struct mproc *child; /* tells which process is exiting */
+static void
+tell_tracer(
+ struct mproc *child /* tells which process is exiting */
+)
{
int mp_tracer;
struct mproc *tracer;
/*===========================================================================*
* tracer_died *
*===========================================================================*/
-static void tracer_died(child)
-struct mproc *child; /* process being traced */
+static void
+tracer_died(
+ struct mproc *child /* process being traced */
+)
{
/* The process that was tracing the given child, has died for some reason.
* This is really the tracer's fault, but we can't let INIT deal with this.
/*===========================================================================*
* cleanup *
*===========================================================================*/
-static void cleanup(rmp)
-register struct mproc *rmp; /* tells which process is exiting */
+static void
+cleanup(
+ register struct mproc *rmp /* tells which process is exiting */
+)
{
/* Release the process table entry and reinitialize some field. */
rmp->mp_pid = 0;
/*===========================================================================*
* do_get *
*===========================================================================*/
-int do_get()
+int
+do_get(void)
{
/* Handle PM_GETUID, PM_GETGID, PM_GETGROUPS, PM_GETPID, PM_GETPGRP, PM_GETSID,
* PM_ISSETUGID.
default:
r = EINVAL;
- break;
+ break;
}
return(r);
}
/*===========================================================================*
* do_set *
*===========================================================================*/
-int do_set()
+int
+do_set(void)
{
/* Handle PM_SETUID, PM_SETEUID, PM_SETGID, PM_SETGROUPS, PM_SETEGID, and
* SETSID. These calls have in common that, if successful, they will be
ngroups = m_in.m_lc_pm_groups.num;
- if (ngroups > NGROUPS_MAX || ngroups < 0)
+ if (ngroups > NGROUPS_MAX || ngroups < 0)
return(EINVAL);
if (ngroups > 0 && m_in.m_lc_pm_groups.ptr == 0)
r = sys_datacopy(who_e, m_in.m_lc_pm_groups.ptr, SELF,
(vir_bytes) rmp->mp_sgroups,
ngroups * sizeof(gid_t));
- if (r != OK)
+ if (r != OK)
return(r);
for (i = 0; i < ngroups; i++) {
/*===========================================================================*
* main *
*===========================================================================*/
-int main()
+int
+main(void)
{
/* Main routine of the process manager. */
unsigned int call_index;
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
-static void sef_local_startup()
+static void
+sef_local_startup(void)
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
static char core_sigs[] = { SIGQUIT, SIGILL, SIGTRAP, SIGABRT,
SIGEMT, SIGFPE, SIGBUS, SIGSEGV };
static char ign_sigs[] = { SIGCHLD, SIGWINCH, SIGCONT, SIGINFO };
- static char noign_sigs[] = { SIGILL, SIGTRAP, SIGEMT, SIGFPE,
+ static char noign_sigs[] = { SIGILL, SIGTRAP, SIGEMT, SIGFPE,
SIGBUS, SIGSEGV };
register struct mproc *rmp;
register char *sig_ptr;
if ((s=sys_getmonparams(monitor_params, sizeof(monitor_params))) != OK)
panic("get monitor params failed: %d", s);
- /* Initialize PM's process table. Request a copy of the system image table
+ /* Initialize PM's process table. Request a copy of the system image table
* that is defined at the kernel level to see which slots to fill in.
*/
- if (OK != (s=sys_getimage(image)))
+ if (OK != (s=sys_getimage(image)))
panic("couldn't get image table: %d", s);
procs_in_use = 0; /* start populating table */
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
procs_in_use += 1; /* found user process */
/* Set process details found in the image table. */
- rmp = &mproc[ip->proc_nr];
- strlcpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN);
- (void) sigemptyset(&rmp->mp_ignore);
+ rmp = &mproc[ip->proc_nr];
+ strlcpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN);
+ (void) sigemptyset(&rmp->mp_ignore);
(void) sigemptyset(&rmp->mp_sigmask);
(void) sigemptyset(&rmp->mp_catch);
if (ip->proc_nr == INIT_PROC_NR) { /* user process */
/* INIT is root, we make it father of itself. This is
* not really OK, INIT should have no father, i.e.
- * a father with pid NO_PID. But PM currently assumes
+ * a father with pid NO_PID. But PM currently assumes
* that mp_parent always points to a valid slot number.
*/
rmp->mp_parent = INIT_PROC_NR;
rmp->mp_procgrp = rmp->mp_pid = INIT_PID;
- rmp->mp_flags |= IN_USE;
+ rmp->mp_flags |= IN_USE;
/* Set scheduling info */
rmp->mp_scheduler = KERNEL;
/*===========================================================================*
* reply *
*===========================================================================*/
-void reply(proc_nr, result)
-int proc_nr; /* process to reply to */
-int result; /* result of call (usually OK or error #) */
+void
+reply(
+ int proc_nr, /* process to reply to */
+ int result /* result of call (usually OK or error #) */
+)
{
/* Send a reply to a user process. System calls may occasionally fill in other
* fields, this is only for the main return value and for sending the reply.
/*===========================================================================*
* get_nice_value *
*===========================================================================*/
-static int get_nice_value(queue)
-int queue; /* store mem chunks here */
+static int
+get_nice_value(
+ int queue /* store mem chunks here */
+)
{
/* Processes in the boot image have a priority assigned. The PM doesn't know
- * about priorities, but uses 'nice' values instead. The priority is between
+ * about priorities, but uses 'nice' values instead. The priority is between
* MIN_USER_Q and MAX_USER_Q. We have to scale between PRIO_MIN and PRIO_MAX.
- */
- int nice_val = (queue - USER_Q) * (PRIO_MAX-PRIO_MIN+1) /
+ */
+ int nice_val = (queue - USER_Q) * (PRIO_MAX-PRIO_MIN+1) /
(MIN_USER_Q-MAX_USER_Q+1);
if (nice_val > PRIO_MAX) nice_val = PRIO_MAX; /* shouldn't happen */
if (nice_val < PRIO_MIN) nice_val = PRIO_MIN; /* shouldn't happen */
/*===========================================================================*
* handle_vfs_reply *
*===========================================================================*/
-static void handle_vfs_reply()
+static void
+handle_vfs_reply(void)
{
struct mproc *rmp;
endpoint_t proc_e;
/*===========================================================================*
* do_setmcontext *
*===========================================================================*/
-int do_setmcontext()
+int
+do_setmcontext(void)
{
return sys_setmcontext(who_e, m_in.m_lc_pm_mcontext.ctx);
}
/*===========================================================================*
* do_getmcontext *
*===========================================================================*/
-int do_getmcontext()
+int
+do_getmcontext(void)
{
return sys_getmcontext(who_e, m_in.m_lc_pm_mcontext.ctx);
}
/*===========================================================================*
* do_sysuname *
*===========================================================================*/
-int do_sysuname()
+int
+do_sysuname(void)
{
/* Set or get uname strings. */
int r;
/*===========================================================================*
* do_getsysinfo *
*===========================================================================*/
-int do_getsysinfo()
+int
+do_getsysinfo(void)
{
vir_bytes src_addr, dst_addr;
size_t len;
case SI_CALL_STATS:
src_addr = (vir_bytes) calls_stats;
len = sizeof(calls_stats);
- break;
+ break;
#endif
default:
return(EINVAL);
/*===========================================================================*
* do_reboot *
*===========================================================================*/
-int do_reboot()
+int
+do_reboot(void)
{
message m;
/* Order matters here. When VFS is told to reboot, it exits all its
* processes, and then would be confused if they're exited again by
- * SIGKILL. So first kill, then reboot.
+ * SIGKILL. So first kill, then reboot.
*/
check_sig(-1, SIGKILL, FALSE /* ksig*/); /* kill all users except init */
/*===========================================================================*
* do_getsetpriority *
*===========================================================================*/
-int do_getsetpriority()
+int
+do_getsetpriority(void)
{
int r, arg_which, arg_who, arg_pri;
struct mproc *rmp;
/* Only root is allowed to reduce the nice level. */
if (rmp->mp_nice > arg_pri && mp->mp_effuid != SUPER_USER)
return(EACCES);
-
+
/* We're SET, and it's allowed.
*
* The value passed in is currently between PRIO_MIN and PRIO_MAX.
size_t copy_len;
/* Copy sysgetenv structure to PM. */
- if (sys_datacopy(who_e, ptr, SELF, (vir_bytes) &sysgetenv,
- sizeof(sysgetenv)) != OK) return(EFAULT);
+ if (sys_datacopy(who_e, ptr, SELF, (vir_bytes) &sysgetenv,
+ sizeof(sysgetenv)) != OK) return(EFAULT);
/* Set a param override? */
if (req == PMSETPARAM || req == OPMSETPARAM) {
|| sysgetenv.vallen >=
sizeof(local_param_overrides[local_params].value))
return EINVAL;
-
+
if ((s = sys_datacopy(who_e, (vir_bytes) sysgetenv.key,
SELF, (vir_bytes) local_param_overrides[local_params].name,
sysgetenv.keylen)) != OK)
if (sysgetenv.keylen == 0) { /* copy all parameters */
val_start = monitor_params;
val_len = sizeof(monitor_params);
- }
+ }
else { /* lookup value for key */
int p;
/* Try to get a copy of the requested key. */
return E2BIG;
/* Value found, make the actual copy (as far as possible). */
- copy_len = MIN(val_len, sysgetenv.vallen);
- if ((s=sys_datacopy(SELF, (vir_bytes) val_start,
+ copy_len = MIN(val_len, sysgetenv.vallen);
+ if ((s=sys_datacopy(SELF, (vir_bytes) val_start,
who_e, (vir_bytes) sysgetenv.val, copy_len)) != OK)
return(s);
struct mproc *trmp;
endpoint_t parent_e;
int proc_nr, s;
-
+
for (proc_nr=0, trmp=mproc; proc_nr < NR_PROCS; proc_nr++, trmp++) {
/* Don't take over system processes. When the system starts,
- * init is blocked on RTS_NO_QUANTUM until PM assigns a
+ * init is blocked on RTS_NO_QUANTUM until PM assigns a
* scheduler, from which other. Given that all other user
- * processes are forked from init and system processes are
- * managed by RS, there should be no other process that needs
+ * processes are forked from init and system processes are
+ * managed by RS, there should be no other process that needs
* to be assigned a scheduler here */
if (trmp->mp_flags & IN_USE && !(trmp->mp_flags & PRIV_PROC)) {
assert(_ENDPOINT_P(trmp->mp_endpoint) == INIT_PROC_NR);
if ((rv = nice_to_priority(rmp->mp_nice, &maxprio)) != OK) {
return rv;
}
-
+
/* scheduler must know the parent, which is not the case for a child
- * of a system process created by a regular fork; in this case the
- * scheduler should inherit settings from init rather than the real
+ * of a system process created by a regular fork; in this case the
+ * scheduler should inherit settings from init rather than the real
* parent
*/
if (mproc[rmp->mp_parent].mp_flags & PRIV_PROC) {
} else {
inherit_from = mproc[rmp->mp_parent].mp_endpoint;
}
-
+
/* inherit quantum */
return sched_inherit(ep, /* scheduler_e */
rmp->mp_endpoint, /* schedulee_e */
assert(!(rmp->mp_flags & DELAY_CALL));
}
-
+
/* See if the process is still alive */
if ((mproc[proc_nr].mp_flags & (IN_USE | EXITING)) == IN_USE) {
return OK; /* signal has been delivered */
/*===========================================================================*
* sig_proc *
*===========================================================================*/
-void sig_proc(rmp, signo, trace, ksig)
-register struct mproc *rmp; /* pointer to the process to be signaled */
-int signo; /* signal to send to process (1 to _NSIG-1) */
-int trace; /* pass signal to tracer first? */
-int ksig; /* non-zero means signal comes from kernel */
+void
+sig_proc(
+ register struct mproc *rmp, /* pointer to the process to be signaled */
+ int signo, /* signal to send to process (1 to _NSIG-1) */
+ int trace, /* pass signal to tracer first? */
+ int ksig /* non-zero means signal comes from kernel */
+)
{
/* Send a signal to a process. Check to see if the signal is to be caught,
- * ignored, tranformed into a message (for system processes) or blocked.
+ * ignored, tranformed into a message (for system processes) or blocked.
* - If the signal is to be transformed into a message, request the KERNEL to
- * send the target process a system notification with the pending signal as an
- * argument.
- * - If the signal is to be caught, request the KERNEL to push a sigcontext
- * structure and a sigframe structure onto the catcher's stack. Also, KERNEL
- * will reset the program counter and stack pointer, so that when the process
- * next runs, it will be executing the signal handler. When the signal handler
- * returns, sigreturn(2) will be called. Then KERNEL will restore the signal
+ * send the target process a system notification with the pending signal as an
+ * argument.
+ * - If the signal is to be caught, request the KERNEL to push a sigcontext
+ * structure and a sigframe structure onto the catcher's stack. Also, KERNEL
+ * will reset the program counter and stack pointer, so that when the process
+ * next runs, it will be executing the signal handler. When the signal handler
+ * returns, sigreturn(2) will be called. Then KERNEL will restore the signal
* context from the sigcontext structure.
* If there is insufficient stack space, kill the process.
*/
sigismember(&rmp->mp_ignore, signo) ||
sigismember(&rmp->mp_sigmask, signo));
- if (!badignore && sigismember(&rmp->mp_ignore, signo)) {
+ if (!badignore && sigismember(&rmp->mp_ignore, signo)) {
/* Signal should be ignored. */
return;
}
/*===========================================================================*
* sig_proc_exit *
*===========================================================================*/
-static void sig_proc_exit(rmp, signo)
-struct mproc *rmp; /* process that must exit */
-int signo; /* signal that caused termination */
+static void
+sig_proc_exit(
+ struct mproc *rmp, /* process that must exit */
+ int signo /* signal that caused termination */
+)
{
rmp->mp_sigstatus = (char) signo;
if (sigismember(&core_sset, signo)) {
/*===========================================================================*
* check_pending *
*===========================================================================*/
-void check_pending(rmp)
-register struct mproc *rmp;
+void
+check_pending(register struct mproc *rmp)
{
/* Check to see if any pending signals have been unblocked. Deliver as many
* of them as we can, until we have to wait for a reply from VFS first.
/*===========================================================================*
* restart_sigs *
*===========================================================================*/
-void restart_sigs(rmp)
-struct mproc *rmp;
+void
+restart_sigs(struct mproc *rmp)
{
/* VFS has replied to a request from us; do signal-related work.
*/
/*===========================================================================*
* unpause *
*===========================================================================*/
-static int unpause(rmp)
-struct mproc *rmp; /* which process */
+static int
+unpause(
+ struct mproc *rmp /* which process */
+)
{
/* A signal is to be sent to a process. If that process is hanging on a
* system call, the system call must be terminated with EINTR. First check if
/*===========================================================================*
* sig_send *
*===========================================================================*/
-static int sig_send(rmp, signo)
-struct mproc *rmp; /* what process to spawn a signal handler in */
-int signo; /* signal to send to process (1 to _NSIG-1) */
+static int
+sig_send(
+ struct mproc *rmp, /* what process to spawn a signal handler in */
+ int signo /* signal to send to process (1 to _NSIG-1) */
+)
{
/* The process is supposed to catch this signal. Spawn a signal handler.
* Return TRUE if this succeeded, FALSE otherwise.
/*===========================================================================*
* do_gettime *
*===========================================================================*/
-int do_gettime()
+int
+do_gettime(void)
{
clock_t ticks, realtime, clock;
time_t boottime;
/*===========================================================================*
* do_getres *
*===========================================================================*/
-int do_getres()
+int
+do_getres(void)
{
switch (m_in.m_lc_pm_time.clk_id) {
case CLOCK_REALTIME:
/*===========================================================================*
* do_settime *
*===========================================================================*/
-int do_settime()
+int
+do_settime(void)
{
int s;
- if (mp->mp_effuid != SUPER_USER) {
+ if (mp->mp_effuid != SUPER_USER) {
return(EPERM);
}
/*===========================================================================*
* do_time *
*===========================================================================*/
-int do_time()
+int
+do_time(void)
{
/* Perform the time(tp) system call. */
struct timespec tv;
/*===========================================================================*
* do_stime *
*===========================================================================*/
-int do_stime()
+int
+do_stime(void)
{
-/* Perform the stime(tp) system call. Retrieve the system's uptime (ticks
+/* Perform the stime(tp) system call. Retrieve the system's uptime (ticks
* since boot) and pass the new time in seconds at system boot to the kernel.
*/
clock_t uptime, realtime;
time_t boottime;
int s;
- if (mp->mp_effuid != SUPER_USER) {
+ if (mp->mp_effuid != SUPER_USER) {
return(EPERM);
}
- if ( (s=getuptime(&uptime, &realtime, &boottime)) != OK)
+ if ( (s=getuptime(&uptime, &realtime, &boottime)) != OK)
panic("do_stime couldn't get uptime: %d", s);
boottime = m_in.m_lc_pm_time.sec - (realtime/system_hz);
-/* This file handles the process manager's part of debugging, using the
+/* This file handles the process manager's part of debugging, using the
* ptrace system call. Most of the commands are passed on to the system
* task for completion.
*
* The debugging commands available are:
- * T_STOP stop the process
+ * T_STOP stop the process
* T_OK enable tracing by parent for this process
- * T_GETINS return value from instruction space
- * T_GETDATA return value from data space
+ * T_GETINS return value from instruction space
+ * T_GETDATA return value from data space
* T_GETUSER return value from user process table
* T_SETINS set value in instruction space
* T_SETDATA set value in data space
- * T_SETUSER set value in user process table
- * T_RESUME resume execution
+ * T_SETUSER set value in user process table
+ * T_RESUME resume execution
* T_EXIT exit
- * T_STEP set trace bit
+ * T_STEP set trace bit
* T_SYSCALL trace system call
* T_ATTACH attach to an existing process
* T_DETACH detach from a traced process
* T_SETOPT set trace options
* T_GETRANGE get range of values
* T_SETRANGE set range of values
- *
+ *
* The T_OK, T_ATTACH, T_EXIT, and T_SETOPT commands are handled here, and the
* T_RESUME, T_STEP, T_SYSCALL, and T_DETACH commands are partially handled
* here and completed by the system task. The rest are handled entirely by the
- * system task.
+ * system task.
*/
#include "pm.h"
/*===========================================================================*
* do_trace *
*===========================================================================*/
-int do_trace()
+int
+do_trace(void)
{
register struct mproc *child;
struct ptrace_range pr;
FALSE /* ksig */);
}
- /* Resume the child as if nothing ever happened. */
+ /* Resume the child as if nothing ever happened. */
child->mp_flags &= ~TRACE_STOPPED;
child->mp_trace_flags = 0;
break;
- case T_RESUME:
+ case T_RESUME:
case T_STEP:
case T_SYSCALL: /* resume execution */
if (m_in.m_lc_pm_ptrace.data < 0 || m_in.m_lc_pm_ptrace.data >= _NSIG)
/*===========================================================================*
* trace_stop *
*===========================================================================*/
-void trace_stop(rmp, signo)
-register struct mproc *rmp;
-int signo;
+void
+trace_stop(register struct mproc *rmp, int signo)
{
/* A traced process got a signal so stop it. */
r = sys_trace(T_STOP, rmp->mp_endpoint, 0L, (long *) 0);
if (r != OK) panic("sys_trace failed: %d", r);
-
+
rmp->mp_flags |= TRACE_STOPPED;
if (wait_test(rpmp, rmp)) {
/* TODO: rusage support */
/* Find a free pid for the child and put it in the table. */
do {
- t = 0;
+ t = 0;
next_pid = (next_pid < NR_PIDS ? next_pid + 1 : INIT_PID + 1);
for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++)
if (rmp->mp_pid == next_pid || rmp->mp_procgrp == next_pid) {
/*===========================================================================*
* find_param *
*===========================================================================*/
-char *find_param(name)
-const char *name;
+char *
+find_param(const char *name)
{
register const char *namep;
register char *envp;
for (envp = (char *) monitor_params; *envp != 0;) {
for (namep = name; *namep != 0 && *namep == *envp; namep++, envp++)
;
- if (*namep == '\0' && *envp == '=')
+ if (*namep == '\0' && *envp == '=')
return(envp + 1);
while (*envp++ != 0)
;