PM: Convert K&R C -> ANSI C
Aditionally this removes all trailing whitespaces in pm server code using: sed -i 's/[[:space:]]*$//' *.c Change-Id: Ie44162fd56cd7042f4f0cc7bd7314b17ea128761
This commit is contained in:
parent
1717959aeb
commit
637f688f0d
@ -77,8 +77,8 @@ clock_t ticks;
|
||||
/*===========================================================================*
|
||||
* 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 &&
|
||||
@ -88,7 +88,8 @@ struct timeval *tv;
|
||||
/*===========================================================================*
|
||||
* 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? */
|
||||
@ -154,11 +155,8 @@ int do_itimer()
|
||||
/*===========================================================================*
|
||||
* 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 */
|
||||
@ -219,9 +217,8 @@ struct itimerval *ovalue;
|
||||
/*===========================================================================*
|
||||
* 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;
|
||||
@ -245,9 +242,8 @@ int sig;
|
||||
/*===========================================================================*
|
||||
* 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 */
|
||||
@ -278,9 +274,8 @@ struct itimerval *value;
|
||||
/*===========================================================================*
|
||||
* 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. */
|
||||
|
@ -34,7 +34,8 @@
|
||||
/*===========================================================================*
|
||||
* do_exec *
|
||||
*===========================================================================*/
|
||||
int do_exec()
|
||||
int
|
||||
do_exec(void)
|
||||
{
|
||||
message m;
|
||||
|
||||
|
@ -41,7 +41,8 @@ static void cleanup(register struct mproc *rmp);
|
||||
/*===========================================================================*
|
||||
* 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 */
|
||||
@ -141,7 +142,8 @@ int do_fork()
|
||||
/*===========================================================================*
|
||||
* 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 */
|
||||
@ -240,7 +242,8 @@ int do_srv_fork()
|
||||
/*===========================================================================*
|
||||
* 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
|
||||
@ -261,10 +264,12 @@ int do_exit()
|
||||
/*===========================================================================*
|
||||
* 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
|
||||
@ -466,7 +471,8 @@ void exit_restart(struct mproc *rmp)
|
||||
/*===========================================================================*
|
||||
* do_wait4 *
|
||||
*===========================================================================*/
|
||||
int do_wait4()
|
||||
int
|
||||
do_wait4(void)
|
||||
{
|
||||
/* 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,
|
||||
@ -560,9 +566,11 @@ int do_wait4()
|
||||
/*===========================================================================*
|
||||
* 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.
|
||||
@ -582,8 +590,8 @@ struct mproc *child; /* process that may be waited for */
|
||||
/*===========================================================================*
|
||||
* 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
|
||||
@ -618,9 +626,11 @@ struct mproc *rmp;
|
||||
/*===========================================================================*
|
||||
* 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;
|
||||
@ -718,8 +728,10 @@ static int tell_parent(struct mproc *child, vir_bytes addr)
|
||||
/*===========================================================================*
|
||||
* 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;
|
||||
@ -744,8 +756,10 @@ struct mproc *child; /* tells which process is exiting */
|
||||
/*===========================================================================*
|
||||
* 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.
|
||||
@ -778,8 +792,10 @@ struct mproc *child; /* process being traced */
|
||||
/*===========================================================================*
|
||||
* 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;
|
||||
|
@ -15,7 +15,8 @@
|
||||
/*===========================================================================*
|
||||
* do_get *
|
||||
*===========================================================================*/
|
||||
int do_get()
|
||||
int
|
||||
do_get(void)
|
||||
{
|
||||
/* Handle PM_GETUID, PM_GETGID, PM_GETGROUPS, PM_GETPID, PM_GETPGRP, PM_GETSID,
|
||||
* PM_ISSETUGID.
|
||||
@ -90,7 +91,8 @@ int do_get()
|
||||
/*===========================================================================*
|
||||
* 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
|
||||
|
@ -47,7 +47,8 @@ static int sef_cb_init_fresh(int type, sef_init_info_t *info);
|
||||
/*===========================================================================*
|
||||
* main *
|
||||
*===========================================================================*/
|
||||
int main()
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
/* Main routine of the process manager. */
|
||||
unsigned int call_index;
|
||||
@ -112,7 +113,8 @@ int main()
|
||||
/*===========================================================================*
|
||||
* 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);
|
||||
@ -246,9 +248,11 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
|
||||
/*===========================================================================*
|
||||
* 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.
|
||||
@ -270,8 +274,10 @@ int result; /* result of call (usually OK or error #) */
|
||||
/*===========================================================================*
|
||||
* 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
|
||||
@ -287,7 +293,8 @@ int queue; /* store mem chunks here */
|
||||
/*===========================================================================*
|
||||
* handle_vfs_reply *
|
||||
*===========================================================================*/
|
||||
static void handle_vfs_reply()
|
||||
static void
|
||||
handle_vfs_reply(void)
|
||||
{
|
||||
struct mproc *rmp;
|
||||
endpoint_t proc_e;
|
||||
|
@ -9,7 +9,8 @@
|
||||
/*===========================================================================*
|
||||
* do_setmcontext *
|
||||
*===========================================================================*/
|
||||
int do_setmcontext()
|
||||
int
|
||||
do_setmcontext(void)
|
||||
{
|
||||
return sys_setmcontext(who_e, m_in.m_lc_pm_mcontext.ctx);
|
||||
}
|
||||
@ -18,7 +19,8 @@ int do_setmcontext()
|
||||
/*===========================================================================*
|
||||
* do_getmcontext *
|
||||
*===========================================================================*/
|
||||
int do_getmcontext()
|
||||
int
|
||||
do_getmcontext(void)
|
||||
{
|
||||
return sys_getmcontext(who_e, m_in.m_lc_pm_mcontext.ctx);
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ unsigned long calls_stats[NR_PM_CALLS];
|
||||
/*===========================================================================*
|
||||
* do_sysuname *
|
||||
*===========================================================================*/
|
||||
int do_sysuname()
|
||||
int
|
||||
do_sysuname(void)
|
||||
{
|
||||
/* Set or get uname strings. */
|
||||
int r;
|
||||
@ -103,7 +104,8 @@ int do_sysuname()
|
||||
/*===========================================================================*
|
||||
* do_getsysinfo *
|
||||
*===========================================================================*/
|
||||
int do_getsysinfo()
|
||||
int
|
||||
do_getsysinfo(void)
|
||||
{
|
||||
vir_bytes src_addr, dst_addr;
|
||||
size_t len;
|
||||
@ -183,7 +185,8 @@ int do_getepinfo(void)
|
||||
/*===========================================================================*
|
||||
* do_reboot *
|
||||
*===========================================================================*/
|
||||
int do_reboot()
|
||||
int
|
||||
do_reboot(void)
|
||||
{
|
||||
message m;
|
||||
|
||||
@ -222,7 +225,8 @@ int do_reboot()
|
||||
/*===========================================================================*
|
||||
* do_getsetpriority *
|
||||
*===========================================================================*/
|
||||
int do_getsetpriority()
|
||||
int
|
||||
do_getsetpriority(void)
|
||||
{
|
||||
int r, arg_which, arg_who, arg_pri;
|
||||
struct mproc *rmp;
|
||||
|
@ -380,11 +380,13 @@ int process_ksig(endpoint_t proc_nr_e, int signo)
|
||||
/*===========================================================================*
|
||||
* 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.
|
||||
@ -540,9 +542,11 @@ int ksig; /* non-zero means signal comes from kernel */
|
||||
/*===========================================================================*
|
||||
* 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)) {
|
||||
@ -644,8 +648,8 @@ int ksig; /* non-zero means signal comes from kernel */
|
||||
/*===========================================================================*
|
||||
* 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.
|
||||
@ -680,8 +684,8 @@ register struct mproc *rmp;
|
||||
/*===========================================================================*
|
||||
* 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.
|
||||
*/
|
||||
@ -712,8 +716,10 @@ struct mproc *rmp;
|
||||
/*===========================================================================*
|
||||
* 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
|
||||
@ -766,9 +772,11 @@ struct mproc *rmp; /* which process */
|
||||
/*===========================================================================*
|
||||
* 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.
|
||||
|
@ -18,7 +18,8 @@
|
||||
/*===========================================================================*
|
||||
* do_gettime *
|
||||
*===========================================================================*/
|
||||
int do_gettime()
|
||||
int
|
||||
do_gettime(void)
|
||||
{
|
||||
clock_t ticks, realtime, clock;
|
||||
time_t boottime;
|
||||
@ -48,7 +49,8 @@ int do_gettime()
|
||||
/*===========================================================================*
|
||||
* do_getres *
|
||||
*===========================================================================*/
|
||||
int do_getres()
|
||||
int
|
||||
do_getres(void)
|
||||
{
|
||||
switch (m_in.m_lc_pm_time.clk_id) {
|
||||
case CLOCK_REALTIME:
|
||||
@ -65,7 +67,8 @@ int do_getres()
|
||||
/*===========================================================================*
|
||||
* do_settime *
|
||||
*===========================================================================*/
|
||||
int do_settime()
|
||||
int
|
||||
do_settime(void)
|
||||
{
|
||||
int s;
|
||||
|
||||
@ -87,7 +90,8 @@ int do_settime()
|
||||
/*===========================================================================*
|
||||
* do_time *
|
||||
*===========================================================================*/
|
||||
int do_time()
|
||||
int
|
||||
do_time(void)
|
||||
{
|
||||
/* Perform the time(tp) system call. */
|
||||
struct timespec tv;
|
||||
@ -102,7 +106,8 @@ int do_time()
|
||||
/*===========================================================================*
|
||||
* do_stime *
|
||||
*===========================================================================*/
|
||||
int do_stime()
|
||||
int
|
||||
do_stime(void)
|
||||
{
|
||||
/* 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.
|
||||
|
@ -38,7 +38,8 @@
|
||||
/*===========================================================================*
|
||||
* do_trace *
|
||||
*===========================================================================*/
|
||||
int do_trace()
|
||||
int
|
||||
do_trace(void)
|
||||
{
|
||||
register struct mproc *child;
|
||||
struct ptrace_range pr;
|
||||
@ -251,9 +252,8 @@ int do_trace()
|
||||
/*===========================================================================*
|
||||
* 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. */
|
||||
|
||||
|
@ -53,8 +53,8 @@ pid_t get_free_pid()
|
||||
/*===========================================================================*
|
||||
* find_param *
|
||||
*===========================================================================*/
|
||||
char *find_param(name)
|
||||
const char *name;
|
||||
char *
|
||||
find_param(const char *name)
|
||||
{
|
||||
register const char *namep;
|
||||
register char *envp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user