Andy's formatting changes.
This commit is contained in:
@@ -389,7 +389,7 @@ phys_bytes tot_bytes; /* total memory to allocate, including gap */
|
||||
* patch_ptr *
|
||||
*===========================================================================*/
|
||||
PRIVATE void patch_ptr(stack, base)
|
||||
char stack[ARG_MAX]; /* pointer to stack image within PM */
|
||||
char stack[ARG_MAX]; /* pointer to stack image within PM */
|
||||
vir_bytes base; /* virtual address of stack base inside user */
|
||||
{
|
||||
/* When doing an exec(name, argv, envp) call, the user builds up a stack
|
||||
@@ -441,7 +441,7 @@ int replace;
|
||||
a0 = (int) ((char **) stack)[1]; /* argv[0] */
|
||||
if (a0 < 4 * PTRSIZE || a0 >= old_bytes) return(FALSE);
|
||||
|
||||
a1 = a0; /* a1 will point to the strings to be moved */
|
||||
a1 = a0; /* a1 will point to the strings to be moved */
|
||||
if (replace) {
|
||||
/* Move a1 to the end of argv[0][] (argv[1] if nargs > 1). */
|
||||
do {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
FORWARD _PROTOTYPE( void get_work, (void) );
|
||||
FORWARD _PROTOTYPE( void pm_init, (void) );
|
||||
FORWARD _PROTOTYPE( int get_nice_value, (int queue) );
|
||||
FORWARD _PROTOTYPE( int get_nice_value, (int queue) );
|
||||
FORWARD _PROTOTYPE( void get_mem_chunks, (struct memory *mem_chunks) );
|
||||
FORWARD _PROTOTYPE( void patch_mem_chunks, (struct memory *mem_chunks,
|
||||
struct mem_map *map_ptr) );
|
||||
@@ -268,9 +268,9 @@ PRIVATE void pm_init()
|
||||
printf(" free %u KB.\n", click_to_round_k(free_clicks));
|
||||
}
|
||||
|
||||
/*=========================================================================*
|
||||
* get_nice_value *
|
||||
*=========================================================================*/
|
||||
/*===========================================================================*
|
||||
* get_nice_value *
|
||||
*===========================================================================*/
|
||||
PRIVATE int get_nice_value(queue)
|
||||
int queue; /* store mem chunks here */
|
||||
{
|
||||
@@ -295,9 +295,9 @@ int queue; /* store mem chunks here */
|
||||
#define MAX_16BIT (0xFFF0L << CLICK_SHIFT)
|
||||
#endif
|
||||
|
||||
/*=========================================================================*
|
||||
* get_mem_chunks *
|
||||
*=========================================================================*/
|
||||
/*===========================================================================*
|
||||
* get_mem_chunks *
|
||||
*===========================================================================*/
|
||||
PRIVATE void get_mem_chunks(mem_chunks)
|
||||
struct memory *mem_chunks; /* store mem chunks here */
|
||||
{
|
||||
@@ -358,9 +358,9 @@ struct memory *mem_chunks; /* store mem chunks here */
|
||||
}
|
||||
}
|
||||
|
||||
/*=========================================================================*
|
||||
* patch_mem_chunks *
|
||||
*=========================================================================*/
|
||||
/*===========================================================================*
|
||||
* patch_mem_chunks *
|
||||
*===========================================================================*/
|
||||
PRIVATE void patch_mem_chunks(mem_chunks, map_ptr)
|
||||
struct memory *mem_chunks; /* store mem chunks here */
|
||||
struct mem_map *map_ptr; /* memory to remove */
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "param.h"
|
||||
|
||||
/*===========================================================================*
|
||||
* do_allocmem *
|
||||
* do_allocmem *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_allocmem()
|
||||
{
|
||||
@@ -36,7 +36,7 @@ PUBLIC int do_allocmem()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_freemem *
|
||||
* do_freemem *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_freemem()
|
||||
{
|
||||
@@ -50,7 +50,7 @@ PUBLIC int do_freemem()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_getsysinfo *
|
||||
* do_getsysinfo *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_getsysinfo()
|
||||
{
|
||||
@@ -86,7 +86,7 @@ PUBLIC int do_getsysinfo()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_getprocnr *
|
||||
* do_getprocnr *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_getprocnr()
|
||||
{
|
||||
@@ -123,9 +123,9 @@ PUBLIC int do_getprocnr()
|
||||
return(OK);
|
||||
}
|
||||
|
||||
/*=====================================================================*
|
||||
* do_reboot *
|
||||
*=====================================================================*/
|
||||
/*===========================================================================*
|
||||
* do_reboot *
|
||||
*===========================================================================*/
|
||||
#define REBOOT_CODE "delay; boot"
|
||||
PUBLIC int do_reboot()
|
||||
{
|
||||
@@ -169,9 +169,9 @@ PUBLIC int do_reboot()
|
||||
return(SUSPEND); /* don't reply to killed process */
|
||||
}
|
||||
|
||||
/*=====================================================================*
|
||||
* do_getsetpriority *
|
||||
*=====================================================================*/
|
||||
/*===========================================================================*
|
||||
* do_getsetpriority *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_getsetpriority()
|
||||
{
|
||||
int arg_which, arg_who, arg_pri;
|
||||
@@ -185,28 +185,28 @@ PUBLIC int do_getsetpriority()
|
||||
/* Code common to GETPRIORITY and SETPRIORITY. */
|
||||
|
||||
/* Only support PRIO_PROCESS for now. */
|
||||
if(arg_which != PRIO_PROCESS)
|
||||
if (arg_which != PRIO_PROCESS)
|
||||
return(EINVAL);
|
||||
|
||||
if(arg_who == 0)
|
||||
if (arg_who == 0)
|
||||
rmp_nr = who;
|
||||
else
|
||||
if((rmp_nr = proc_from_pid(arg_who)) < 0)
|
||||
if ((rmp_nr = proc_from_pid(arg_who)) < 0)
|
||||
return(ESRCH);
|
||||
|
||||
rmp = &mproc[rmp_nr];
|
||||
|
||||
if(mp->mp_effuid != SUPER_USER &&
|
||||
if (mp->mp_effuid != SUPER_USER &&
|
||||
mp->mp_effuid != rmp->mp_effuid && mp->mp_effuid != rmp->mp_realuid)
|
||||
return EPERM;
|
||||
|
||||
/* If GET, that's it. */
|
||||
if(call_nr == GETPRIORITY) {
|
||||
if (call_nr == GETPRIORITY) {
|
||||
return(rmp->mp_nice - PRIO_MIN);
|
||||
}
|
||||
|
||||
/* Only root is allowed to reduce the nice level. */
|
||||
if(rmp->mp_nice > arg_pri && mp->mp_effuid != SUPER_USER)
|
||||
if (rmp->mp_nice > arg_pri && mp->mp_effuid != SUPER_USER)
|
||||
return(EACCES);
|
||||
|
||||
/* We're SET, and it's allowed. Do it and tell kernel. */
|
||||
@@ -214,9 +214,9 @@ PUBLIC int do_getsetpriority()
|
||||
return sys_nice(rmp_nr, arg_pri);
|
||||
}
|
||||
|
||||
/*=====================================================================*
|
||||
* do_svrctl *
|
||||
*=====================================================================*/
|
||||
/*===========================================================================*
|
||||
* do_svrctl *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_svrctl()
|
||||
{
|
||||
int s, req;
|
||||
@@ -249,9 +249,9 @@ PUBLIC int do_svrctl()
|
||||
sizeof(sysgetenv)) != OK) return(EFAULT);
|
||||
|
||||
/* Set a param override? */
|
||||
if(req == MMSETPARAM) {
|
||||
if(local_params >= MAX_LOCAL_PARAMS) return ENOSPC;
|
||||
if(sysgetenv.keylen <= 0
|
||||
if (req == MMSETPARAM) {
|
||||
if (local_params >= MAX_LOCAL_PARAMS) return ENOSPC;
|
||||
if (sysgetenv.keylen <= 0
|
||||
|| sysgetenv.keylen >=
|
||||
sizeof(local_param_overrides[local_params].name)
|
||||
|| sysgetenv.vallen <= 0
|
||||
@@ -292,12 +292,12 @@ PUBLIC int do_svrctl()
|
||||
*/
|
||||
search_key[sysgetenv.keylen-1]= '\0';
|
||||
for(p = 0; p < local_params; p++) {
|
||||
if(!strcmp(search_key, local_param_overrides[p].name)) {
|
||||
if (!strcmp(search_key, local_param_overrides[p].name)) {
|
||||
val_start = local_param_overrides[p].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(p >= local_params && (val_start = find_param(search_key)) == NULL)
|
||||
if (p >= local_params && (val_start = find_param(search_key)) == NULL)
|
||||
return(ESRCH);
|
||||
val_len = strlen(val_start) + 1;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ FORWARD _PROTOTYPE( void handle_sig, (int proc_nr, sigset_t sig_map) );
|
||||
FORWARD _PROTOTYPE( void cause_sigalrm, (struct timer *tp) );
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigaction *
|
||||
* do_sigaction *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigaction()
|
||||
{
|
||||
@@ -93,7 +93,7 @@ PUBLIC int do_sigaction()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigpending *
|
||||
* do_sigpending *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigpending()
|
||||
{
|
||||
@@ -102,7 +102,7 @@ PUBLIC int do_sigpending()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigprocmask *
|
||||
* do_sigprocmask *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigprocmask()
|
||||
{
|
||||
@@ -153,7 +153,7 @@ PUBLIC int do_sigprocmask()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigsuspend *
|
||||
* do_sigsuspend *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigsuspend()
|
||||
{
|
||||
@@ -166,7 +166,7 @@ PUBLIC int do_sigsuspend()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigreturn *
|
||||
* do_sigreturn *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigreturn()
|
||||
{
|
||||
@@ -554,7 +554,7 @@ int signo; /* signal to send to process (0 to _NSIG) */
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* check_pending *
|
||||
* check_pending *
|
||||
*===========================================================================*/
|
||||
PUBLIC void check_pending(rmp)
|
||||
register struct mproc *rmp;
|
||||
|
||||
@@ -62,7 +62,7 @@ PUBLIC int do_stime()
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_times *
|
||||
* do_times *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_times()
|
||||
{
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
PRIVATE timer_t *pm_timers = NULL;
|
||||
|
||||
/*===========================================================================*
|
||||
* pm_set_timer *
|
||||
* pm_set_timer *
|
||||
*===========================================================================*/
|
||||
PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
||||
{
|
||||
int r;
|
||||
clock_t now, prev_time = 0, next_time;
|
||||
|
||||
if((r = getuptime(&now)) != OK)
|
||||
if ((r = getuptime(&now)) != OK)
|
||||
panic(__FILE__, "PM couldn't get uptime", NO_NUM);
|
||||
|
||||
/* Set timer argument and add timer to the list. */
|
||||
@@ -37,8 +37,8 @@ PUBLIC void pm_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
||||
prev_time = tmrs_settimer(&pm_timers,tp,now+ticks,watchdog,&next_time);
|
||||
|
||||
/* Reschedule our synchronous alarm if necessary. */
|
||||
if(! prev_time || prev_time > next_time) {
|
||||
if(sys_setalarm(next_time, 1) != OK)
|
||||
if (! prev_time || prev_time > next_time) {
|
||||
if (sys_setalarm(next_time, 1) != OK)
|
||||
panic(__FILE__, "PM set timer couldn't set alarm.", NO_NUM);
|
||||
}
|
||||
|
||||
@@ -54,14 +54,14 @@ PUBLIC void pm_expire_timers(clock_t now)
|
||||
|
||||
/* Check for expired timers and possibly reschedule an alarm. */
|
||||
tmrs_exptimers(&pm_timers, now, &next_time);
|
||||
if(next_time > 0) {
|
||||
if(sys_setalarm(next_time, 1) != OK)
|
||||
if (next_time > 0) {
|
||||
if (sys_setalarm(next_time, 1) != OK)
|
||||
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* pm_cancel_timer *
|
||||
* pm_cancel_timer *
|
||||
*===========================================================================*/
|
||||
PUBLIC void pm_cancel_timer(timer_t *tp)
|
||||
{
|
||||
@@ -72,8 +72,8 @@ PUBLIC void pm_cancel_timer(timer_t *tp)
|
||||
* the next timer, or cancel the alarm altogether if the last timer has
|
||||
* been cancelled (next_time will be 0 then).
|
||||
*/
|
||||
if(prev_time < next_time || ! next_time) {
|
||||
if(sys_setalarm(next_time, 1) != OK)
|
||||
if (prev_time < next_time || ! next_time) {
|
||||
if (sys_setalarm(next_time, 1) != OK)
|
||||
panic(__FILE__, "PM expire timer couldn't set alarm.", NO_NUM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,9 +144,9 @@ int what, p1, p2, p3;
|
||||
_taskcall(FS_PROC_NR, what, &m);
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* find_param *
|
||||
*==========================================================================*/
|
||||
/*===========================================================================*
|
||||
* find_param *
|
||||
*===========================================================================*/
|
||||
PUBLIC char *find_param(name)
|
||||
const char *name;
|
||||
{
|
||||
@@ -165,7 +165,7 @@ const char *name;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* get_mem_map *
|
||||
* get_mem_map *
|
||||
*===========================================================================*/
|
||||
PUBLIC int get_mem_map(proc_nr, mem_map)
|
||||
int proc_nr; /* process to get map of */
|
||||
@@ -181,7 +181,7 @@ struct mem_map *mem_map; /* put memory map here */
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* get_stack_ptr *
|
||||
* get_stack_ptr *
|
||||
*===========================================================================*/
|
||||
PUBLIC int get_stack_ptr(proc_nr, sp)
|
||||
int proc_nr; /* process to get sp of */
|
||||
|
||||
Reference in New Issue
Block a user