Created ECHO system call for testing purposes.

Furthermore, a quick way to get one's own process number.
This commit is contained in:
Jorrit Herder
2005-05-27 13:57:00 +00:00
parent 07d582872f
commit 8d9c0886cd
7 changed files with 60 additions and 42 deletions

View File

@@ -1,23 +1,7 @@
/*===========================================================================*
* System calls and magic process numbers *
* Magic process numbers *
*===========================================================================*/
/* Masks and flags for system calls. */
#define SYSCALL_FUNC 0x0F /* mask for system call function */
#define SYSCALL_FLAGS 0xF0 /* mask for system call flags */
#define NON_BLOCKING 0x10 /* prevent blocking, return error */
#define FRESH_ANSWER 0x20 /* ignore pending notifications as answer */
/* default behaviour for SENDREC calls */
/* System calls (numbers passed when trapping to the kernel) */
#define SEND 1 /* function code for sending messages */
#define RECEIVE 2 /* function code for receiving messages */
#define SENDREC 3 /* function code for SEND + RECEIVE */
#define NOTIFY 4 /* function code for notifications */
#define NB_SEND (SEND | NON_BLOCKING) /* non-blocking SEND */
#define NB_RECEIVE (RECEIVE | NON_BLOCKING) /* non-blocking RECEIVE */
/* Magic, invalid process numbers. */
#define ANY 0x7ace /* used to indicate 'any process' */
#define NONE 0x6ace /* used to indicate 'no process at all' */
#define SELF 0x8ace /* used to indicate 'own process' */

View File

@@ -91,6 +91,7 @@ typedef struct {
*==========================================================================*/
/* Hide names to avoid name space pollution. */
#define echo _echo
#define sendrec _sendrec
#define receive _receive
#define send _send
@@ -98,6 +99,7 @@ typedef struct {
#define nb_receive _nb_receive
#define nb_send _nb_send
_PROTOTYPE( int echo, (message *m_ptr) );
_PROTOTYPE( int sendrec, (int src_dest, message *m_ptr) );
_PROTOTYPE( int receive, (int src, message *m_ptr) );
_PROTOTYPE( int send, (int dest, message *m_ptr) );