2005-05-03 17:35:52 +02:00
|
|
|
/* Function prototypes. */
|
|
|
|
|
|
|
|
struct mproc;
|
|
|
|
struct stat;
|
|
|
|
struct mem_map;
|
2005-06-17 11:10:30 +02:00
|
|
|
struct memory;
|
2005-05-03 17:35:52 +02:00
|
|
|
|
2005-07-14 17:16:12 +02:00
|
|
|
#include <timers.h>
|
|
|
|
|
2009-08-15 18:09:32 +02:00
|
|
|
/* alarm.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_alarm(void);
|
|
|
|
int do_itimer(void);
|
|
|
|
void set_alarm(struct mproc *rmp, clock_t ticks);
|
|
|
|
void check_vtimer(int proc_nr, int sig);
|
2009-08-15 18:09:32 +02:00
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
/* break.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_brk(void);
|
2005-05-03 17:35:52 +02:00
|
|
|
|
|
|
|
/* exec.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_exec(void);
|
2012-05-30 19:34:07 +02:00
|
|
|
int do_newexec(void);
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_execrestart(void);
|
2012-04-03 15:52:25 +02:00
|
|
|
void exec_restart(struct mproc *rmp, int result, vir_bytes pc, vir_bytes sp);
|
2005-05-03 17:35:52 +02:00
|
|
|
|
|
|
|
/* forkexit.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_fork(void);
|
|
|
|
int do_srv_fork(void);
|
|
|
|
int do_exit(void);
|
|
|
|
void exit_proc(struct mproc *rmp, int exit_status, int dump_core);
|
|
|
|
void exit_restart(struct mproc *rmp, int dump_core);
|
|
|
|
int do_waitpid(void);
|
|
|
|
int wait_test(struct mproc *rmp, struct mproc *child);
|
2005-05-03 17:35:52 +02:00
|
|
|
|
|
|
|
/* getset.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_get(void);
|
|
|
|
int do_set(void);
|
2008-06-24 15:53:03 +02:00
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
/* main.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int main(void);
|
|
|
|
void setreply(int proc_nr, int result);
|
2005-05-03 17:35:52 +02:00
|
|
|
|
2010-03-12 16:58:41 +01:00
|
|
|
/* mcontext.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_getmcontext(void);
|
|
|
|
int do_setmcontext(void);
|
2011-08-02 13:57:31 +02:00
|
|
|
#if ! USE_MCONTEXT
|
|
|
|
#define do_getmcontext no_sys
|
|
|
|
#define do_setmcontext no_sys
|
|
|
|
#endif
|
2010-03-12 16:58:41 +01:00
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
/* misc.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_reboot(void);
|
|
|
|
int do_sysuname(void);
|
|
|
|
int do_getsysinfo(void);
|
|
|
|
int do_getprocnr(void);
|
|
|
|
int do_getepinfo(void);
|
|
|
|
int do_getepinfo_o(void);
|
|
|
|
int do_svrctl(void);
|
|
|
|
int do_getsetpriority(void);
|
endpoint-aware conversion of servers.
'who', indicating caller number in pm and fs and some other servers, has
been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.).
In both PM and FS, isokendpt() convert endpoints to process slot
numbers, returning OK if it was a valid and consistent endpoint number.
okendpt() does the same but panic()s if it doesn't succeed. (In PM,
this is pm_isok..)
pm and fs keep their own records of process endpoints in their proc tables,
which are needed to make kernel calls about those processes.
message field names have changed.
fs drivers are endpoints.
fs now doesn't try to get out of driver deadlock, as the protocol isn't
supposed to let that happen any more. (A warning is printed if ELOCKED
is detected though.)
fproc[].fp_task (indicating which driver the process is suspended on)
became an int.
PM and FS now get endpoint numbers of initial boot processes from the
kernel. These happen to be the same as the old proc numbers, to let
user processes reach them with the old numbers, but FS and PM don't know
that. All new processes after INIT, even after the generation number
wraps around, get endpoint numbers with generation 1 and higher, so
the first instances of the boot processes are the only processes ever
to have endpoint numbers in the old proc number range.
More return code checks of sys_* functions have been added.
IS has become endpoint-aware. Ditched the 'text' and 'data' fields
in the kernel dump (which show locations, not sizes, so aren't terribly
useful) in favour of the endpoint number. Proc number is still visible.
Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got
the formatting changed.
PM reading segments using rw_seg() has changed - it uses other fields
in the message now instead of encoding the segment and process number and
fd in the fd field. For that it uses _read_pm() and _write_pm() which to
_taskcall()s directly in pm/misc.c.
PM now sys_exit()s itself on panic(), instead of sys_abort().
RS also talks in endpoints instead of process numbers.
2006-03-03 11:20:58 +01:00
|
|
|
|
Userspace scheduling
- cotributed by Bjorn Swift
- In this first phase, scheduling is moved from the kernel to the PM
server. The next steps are to a) moving scheduling to its own server
and b) include useful information in the "out of quantum" message,
so that the scheduler can make use of this information.
- The kernel process table now keeps record of who is responsible for
scheduling each process (p_scheduler). When this pointer is NULL,
the process will be scheduled by the kernel. If such a process runs
out of quantum, the kernel will simply renew its quantum an requeue
it.
- When PM loads, it will take over scheduling of all running
processes, except system processes, using sys_schedctl().
Essentially, this only results in taking over init. As children
inherit a scheduler from their parent, user space programs forked by
init will inherit PM (for now) as their scheduler.
- Once a process has been assigned a scheduler, and runs out of
quantum, its RTS_NO_QUANTUM flag will be set and the process
dequeued. The kernel will send a message to the scheduler, on the
process' behalf, informing the scheduler that it has run out of
quantum. The scheduler can take what ever action it pleases, based
on its policy, and then reschedule the process using the
sys_schedule() system call.
- Balance queues does not work as before. While the old in-kernel
function used to renew the quantum of processes in the highest
priority run queue, the user-space implementation only acts on
processes that have been bumped down to a lower priority queue.
This approach reacts slower to changes than the old one, but saves
us sending a sys_schedule message for each process every time we
balance the queues. Currently, when processes are moved up a
priority queue, their quantum is also renewed, but this can be
fiddled with.
- do_nice has been removed from kernel. PM answers to get- and
setpriority calls, updates it's own nice variable as well as the
max_run_queue. This will be refactored once scheduling is moved to a
separate server. We will probably have PM update it's local nice
value and then send a message to whoever is scheduling the process.
- changes to fix an issue in do_fork() where processes could run out
of quantum but bypassing the code path that handles it correctly.
The future plan is to remove the policy from do_fork() and implement
it in userspace too.
2010-03-29 13:07:20 +02:00
|
|
|
/* schedule.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
void sched_init(void);
|
|
|
|
int sched_start_user(endpoint_t ep, struct mproc *rmp);
|
|
|
|
int sched_nice(struct mproc *rmp, int nice);
|
Userspace scheduling
- cotributed by Bjorn Swift
- In this first phase, scheduling is moved from the kernel to the PM
server. The next steps are to a) moving scheduling to its own server
and b) include useful information in the "out of quantum" message,
so that the scheduler can make use of this information.
- The kernel process table now keeps record of who is responsible for
scheduling each process (p_scheduler). When this pointer is NULL,
the process will be scheduled by the kernel. If such a process runs
out of quantum, the kernel will simply renew its quantum an requeue
it.
- When PM loads, it will take over scheduling of all running
processes, except system processes, using sys_schedctl().
Essentially, this only results in taking over init. As children
inherit a scheduler from their parent, user space programs forked by
init will inherit PM (for now) as their scheduler.
- Once a process has been assigned a scheduler, and runs out of
quantum, its RTS_NO_QUANTUM flag will be set and the process
dequeued. The kernel will send a message to the scheduler, on the
process' behalf, informing the scheduler that it has run out of
quantum. The scheduler can take what ever action it pleases, based
on its policy, and then reschedule the process using the
sys_schedule() system call.
- Balance queues does not work as before. While the old in-kernel
function used to renew the quantum of processes in the highest
priority run queue, the user-space implementation only acts on
processes that have been bumped down to a lower priority queue.
This approach reacts slower to changes than the old one, but saves
us sending a sys_schedule message for each process every time we
balance the queues. Currently, when processes are moved up a
priority queue, their quantum is also renewed, but this can be
fiddled with.
- do_nice has been removed from kernel. PM answers to get- and
setpriority calls, updates it's own nice variable as well as the
max_run_queue. This will be refactored once scheduling is moved to a
separate server. We will probably have PM update it's local nice
value and then send a message to whoever is scheduling the process.
- changes to fix an issue in do_fork() where processes could run out
of quantum but bypassing the code path that handles it correctly.
The future plan is to remove the policy from do_fork() and implement
it in userspace too.
2010-03-29 13:07:20 +02:00
|
|
|
|
2006-10-30 16:53:38 +01:00
|
|
|
/* profile.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_sprofile(void);
|
|
|
|
int do_cprofile(void);
|
2006-10-30 16:53:38 +01:00
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
/* signal.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_kill(void);
|
|
|
|
int do_srv_kill(void);
|
|
|
|
int process_ksig(endpoint_t proc_nr_e, int signo);
|
|
|
|
int do_pause(void);
|
|
|
|
int check_sig(pid_t proc_id, int signo, int ksig);
|
|
|
|
void sig_proc(struct mproc *rmp, int signo, int trace, int ksig);
|
|
|
|
int do_sigaction(void);
|
|
|
|
int do_sigpending(void);
|
|
|
|
int do_sigprocmask(void);
|
|
|
|
int do_sigreturn(void);
|
|
|
|
int do_sigsuspend(void);
|
|
|
|
void check_pending(struct mproc *rmp);
|
|
|
|
void restart_sigs(struct mproc *rmp);
|
|
|
|
void vm_notify_sig_wrapper(endpoint_t ep);
|
2005-05-03 17:35:52 +02:00
|
|
|
|
2005-05-31 11:50:51 +02:00
|
|
|
/* time.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_stime(void);
|
|
|
|
int do_time(void);
|
|
|
|
int do_times(void);
|
2013-03-29 22:48:22 +01:00
|
|
|
int do_getres(void);
|
|
|
|
int do_gettime(void);
|
2013-03-30 17:59:21 +01:00
|
|
|
int do_settime(void);
|
2005-05-31 11:50:51 +02:00
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
/* trace.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int do_trace(void);
|
|
|
|
void stop_proc(struct mproc *rmp, int sig_nr);
|
2011-09-07 17:52:48 +02:00
|
|
|
#if ! USE_TRACE
|
|
|
|
#define do_trace no_sys
|
|
|
|
#define stop_proc no_sys
|
|
|
|
#endif
|
2005-05-03 17:35:52 +02:00
|
|
|
|
|
|
|
/* utility.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
pid_t get_free_pid(void);
|
|
|
|
int no_sys(void);
|
|
|
|
char *find_param(const char *key);
|
|
|
|
struct mproc *find_proc(pid_t lpid);
|
|
|
|
int nice_to_priority(int nice, unsigned *new_q);
|
|
|
|
int pm_isokendpt(int ep, int *proc);
|
|
|
|
void tell_vfs(struct mproc *rmp, message *m_ptr);
|