mirror of
https://github.com/drasko/codezero.git
synced 2026-01-14 03:43:15 +01:00
Added exit() call to libposix
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
/* Synchronise with pager via a `wait' tagged ipc with destination as pager */
|
||||
void wait_pager(l4id_t partner)
|
||||
{
|
||||
l4_send(partner, L4_IPC_TAG_WAIT);
|
||||
l4_send(partner, L4_IPC_TAG_SYNC);
|
||||
printf("%s: Pager synced with us.\n", __TASKNAME__);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void handle_fs_requests(void)
|
||||
/* FIXME: Fix all these syscalls to read any buffer data from the caller task's utcb.
|
||||
* Make sure to return -EINVAL if data is not valid. */
|
||||
switch(tag) {
|
||||
case L4_IPC_TAG_WAIT:
|
||||
case L4_IPC_TAG_SYNC:
|
||||
printf("%s: Synced with waiting thread.\n", __TASKNAME__);
|
||||
return; /* No reply for this tag */
|
||||
case L4_IPC_TAG_OPEN:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/*** IPC Tags used between server tasks ***/
|
||||
|
||||
/* For ping ponging */
|
||||
#define L4_IPC_TAG_WAIT 3
|
||||
#define L4_IPC_TAG_SYNC 3
|
||||
|
||||
/* To obtain utcb address */
|
||||
#define L4_IPC_TAG_UTCB 4
|
||||
@@ -45,8 +45,10 @@
|
||||
#define L4_IPC_TAG_FORK 22
|
||||
#define L4_IPC_TAG_STAT 23
|
||||
#define L4_IPC_TAG_FSTAT 24
|
||||
#define L4_IPC_TAG_FSYNC 25 /* Pager notifies vfs of file close */
|
||||
#define L4_IPC_TAG_CLONE 26 /* Pager notifies vfs of file close */
|
||||
#define L4_IPC_TAG_FSYNC 25
|
||||
#define L4_IPC_TAG_CLONE 26
|
||||
#define L4_IPC_TAG_EXIT 27
|
||||
#define L4_IPC_TAG_WAIT 28
|
||||
|
||||
|
||||
/* Tags for ipc between fs0 and mm0 */
|
||||
|
||||
24
tasks/libposix/exit.c
Normal file
24
tasks/libposix/exit.c
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#include <l4lib/arch/syscalls.h>
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/ipcdefs.h>
|
||||
#include <unistd.h>
|
||||
#include <l4/macros.h>
|
||||
|
||||
static inline void l4_exit(int status)
|
||||
{
|
||||
int err;
|
||||
|
||||
write_mr(L4SYS_ARG0, status);
|
||||
|
||||
/* Call pager with exit() request. */
|
||||
err = l4_send(PAGER_TID, L4_IPC_TAG_EXIT);
|
||||
printf("%s: L4 IPC Error: %d.\n", __FUNCTION__, err);
|
||||
/* This call should not fail or return */
|
||||
BUG();
|
||||
}
|
||||
|
||||
void exit(int status)
|
||||
{
|
||||
l4_exit(status);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ void handle_requests(void)
|
||||
mr[i] = read_mr(MR_UNUSED_START + i);
|
||||
|
||||
switch(tag) {
|
||||
case L4_IPC_TAG_WAIT:
|
||||
case L4_IPC_TAG_SYNC:
|
||||
// printf("%s: Synced with waiting thread.\n", __TASKNAME__);
|
||||
/* This has no receive phase */
|
||||
return;
|
||||
|
||||
@@ -18,7 +18,7 @@ void wait_pager(l4id_t partner)
|
||||
// printf("%s: Syncing with pager.\n", __TASKNAME__);
|
||||
for (int i = 0; i < 6; i++)
|
||||
write_mr(i, i);
|
||||
l4_send(partner, L4_IPC_TAG_WAIT);
|
||||
l4_send(partner, L4_IPC_TAG_SYNC);
|
||||
// printf("Pager synced with us.\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user