Created ECHO system call for testing purposes.
Furthermore, a quick way to get one's own process number.
This commit is contained in:
@@ -103,6 +103,7 @@ proc.o: $a
|
||||
proc.o: $h/callnr.h
|
||||
proc.o: $h/com.h
|
||||
proc.o: proc.h
|
||||
proc.o: ipc.h
|
||||
proc.o: sendmask.h
|
||||
|
||||
protect.o: $a
|
||||
|
||||
14
kernel/ipc.h
Normal file
14
kernel/ipc.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/* 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 ECHO 0 /* function code for echoing messages */
|
||||
#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 */
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <minix/callnr.h>
|
||||
#include <minix/com.h>
|
||||
#include "proc.h"
|
||||
#include "ipc.h"
|
||||
#include "sendmask.h"
|
||||
|
||||
|
||||
@@ -99,7 +100,7 @@ message *m_ptr; /* pointer to message in the caller's space */
|
||||
return(ECALLDENIED); /* SENDREC was required */
|
||||
|
||||
/* Verify that requested source and/ or destination is a valid process. */
|
||||
if (! isoksrc_dst(src_dst))
|
||||
if (! isoksrc_dst(src_dst) && function != ECHO)
|
||||
return(EBADSRCDST);
|
||||
|
||||
/* Check validity of message pointer. */
|
||||
@@ -153,6 +154,11 @@ message *m_ptr; /* pointer to message in the caller's space */
|
||||
case NOTIFY:
|
||||
result = mini_notify(caller_ptr, src_dst, m_ptr);
|
||||
break;
|
||||
case ECHO:
|
||||
kprintf("Echo message from process %s\n", proc_nr(caller_ptr));
|
||||
CopyMess(caller_ptr->p_nr, caller_ptr, m_ptr, caller_ptr, m_ptr);
|
||||
result = OK;
|
||||
break;
|
||||
default:
|
||||
result = EBADCALL; /* illegal system call */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user