Added exit() call to libposix

This commit is contained in:
Bahadir Balban
2008-09-18 16:28:51 +03:00
parent 2741adb2c1
commit 6b11d3cf02
5 changed files with 33 additions and 7 deletions

View File

@@ -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:

View File

@@ -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
View 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);
}

View File

@@ -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;

View File

@@ -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");
}