From 36e12d5bd8179a75a19a3c9867f54f9b67c93921 Mon Sep 17 00:00:00 2001 From: Kees van Reeuwijk Date: Wed, 2 Jun 2010 21:51:32 +0000 Subject: [PATCH] Use endpoint_t for the destination of mini_send and _syscall, and the source of mini_receive. Also some small cleanup. --- include/lib.h | 2 +- kernel/proc.c | 26 ++++++++++++++------------ lib/libc/ansi/ext_comp.c | 2 +- lib/libc/ansi/strtok.c | 2 +- lib/libc/asyn/asyn_synch.c | 1 - lib/libc/other/syscall.c | 5 +---- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/include/lib.h b/include/lib.h index b20aadf41..3bf79bced 100644 --- a/include/lib.h +++ b/include/lib.h @@ -28,7 +28,7 @@ _PROTOTYPE( int __execve, (const char *_path, char *const _argv[], char *const _envp[], int _nargs, int _nenvps) ); -_PROTOTYPE( int _syscall, (int _who, int _syscallnr, message *_msgptr) ); +_PROTOTYPE( int _syscall, (endpoint_t _who, int _syscallnr, message *_msgptr) ); _PROTOTYPE( void _loadname, (const char *_name, message *_msgptr) ); _PROTOTYPE( int _len, (const char *_s) ); _PROTOTYPE( void _begsig, (int _dummy) ); diff --git a/kernel/proc.c b/kernel/proc.c index 4980356e3..737b93bad 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -46,10 +46,10 @@ FORWARD _PROTOTYPE( void idle, (void)); /** * Made public for use in clock.c (for user-space scheduling) -FORWARD _PROTOTYPE( int mini_send, (struct proc *caller_ptr, int dst_e, +FORWARD _PROTOTYPE( int mini_send, (struct proc *caller_ptr, endpoint_t dst_e, message *m_ptr, int flags)); */ -FORWARD _PROTOTYPE( int mini_receive, (struct proc *caller_ptr, int src, +FORWARD _PROTOTYPE( int mini_receive, (struct proc *caller_ptr, endpoint_t src, message *m_ptr, int flags)); FORWARD _PROTOTYPE( int mini_senda, (struct proc *caller_ptr, asynmsg_t *table, size_t size)); @@ -516,11 +516,12 @@ proc_nr_t src_dst; /* src or dst process */ /*===========================================================================* * mini_send * *===========================================================================*/ -PUBLIC int mini_send(caller_ptr, dst_e, m_ptr, flags) -register struct proc *caller_ptr; /* who is trying to send a message? */ -int dst_e; /* to whom is message being sent? */ -message *m_ptr; /* pointer to message buffer */ -const int flags; +PUBLIC int mini_send( + register struct proc *caller_ptr, /* who is trying to send a message? */ + endpoint_t dst_e, /* to whom is message being sent? */ + message *m_ptr, /* pointer to message buffer */ + const int flags +) { /* Send a message from 'caller_ptr' to 'dst'. If 'dst' is blocked waiting * for this message, copy the message to it and unblock 'dst'. If 'dst' is @@ -599,11 +600,12 @@ const int flags; /*===========================================================================* * mini_receive * *===========================================================================*/ -PRIVATE int mini_receive(caller_ptr, src_e, m_ptr, flags) -register struct proc *caller_ptr; /* process trying to get message */ -int src_e; /* which message source is wanted */ -message *m_ptr; /* pointer to message buffer */ -const int flags; +PRIVATE int mini_receive( + register struct proc *caller_ptr, /* process trying to get message */ + endpoint_t src_e, /* which message source is wanted */ + message *m_ptr, /* pointer to message buffer */ + const int flags +) { /* A process or task wants to get a message. If a message is already queued, * acquire it and deblock the sender. If no message from the desired source diff --git a/lib/libc/ansi/ext_comp.c b/lib/libc/ansi/ext_comp.c index e4f51fb8a..76d73c2d1 100644 --- a/lib/libc/ansi/ext_comp.c +++ b/lib/libc/ansi/ext_comp.c @@ -18,7 +18,7 @@ static int b64_add(struct mantissa *e1, struct mantissa *e2); static void b64_sft(struct mantissa *e1, int n); static void -mul_ext(struct EXTEND *e1, struct EXTEND *e2, struct EXTEND *e3) +mul_ext(const struct EXTEND *e1, const struct EXTEND *e2, struct EXTEND *e3) { /* Multiply the extended numbers e1 and e2, and put the result in e3. diff --git a/lib/libc/ansi/strtok.c b/lib/libc/ansi/strtok.c index f0788499c..b07c8a528 100644 --- a/lib/libc/ansi/strtok.c +++ b/lib/libc/ansi/strtok.c @@ -10,7 +10,7 @@ char * strtok(register char *string, const char *separators) { register char *s1, *s2; - static char *savestring; + static char *savestring = NULL; if (string == NULL) { string = savestring; diff --git a/lib/libc/asyn/asyn_synch.c b/lib/libc/asyn/asyn_synch.c index d54be789c..2330d6e6d 100644 --- a/lib/libc/asyn/asyn_synch.c +++ b/lib/libc/asyn/asyn_synch.c @@ -7,7 +7,6 @@ int asyn_synch(asynchio_t *asyn, int fd) /* No more asynchronous operations on this file descriptor. */ { asynfd_t *afd; - int flags; int op; if ((unsigned) fd >= FD_SETSIZE) { errno= EBADF; return -1; } diff --git a/lib/libc/other/syscall.c b/lib/libc/other/syscall.c index e397ae32a..d647cfbde 100644 --- a/lib/libc/other/syscall.c +++ b/lib/libc/other/syscall.c @@ -1,9 +1,6 @@ #include -PUBLIC int _syscall(who, syscallnr, msgptr) -int who; -int syscallnr; -register message *msgptr; +PUBLIC int _syscall(endpoint_t who, int syscallnr, message *msgptr) { int status;