Files
codezero/tasks/test0/main.c
Bahadir Balban 33200c92df Mutex implementation almost working.
- Fixed a wrong instruction in mutex.S user library
- Added support for blocking lock/unlock
- Divided waiting into wait_on_prepare and wait_on_prepared_wait
  so that mutex_control lock is released after getting in the waitqueue.
- Declaring waitqueue on the stack should be done outside wait_on_prepare

Issues:
- Tests can be simplified for atomic data access instead of producer/consumer.
- kmalloc variable sized memory caches are not freed properly. Currently only the
  last slot can be freed, occupied correctly. it should be done in any slot, i.e.
  1, 2, 3, 4 instead of just 5.
- Need to add a mutex to kmalloc.
2009-06-01 14:11:40 +03:00

64 lines
983 B
C

/*
* Some tests for posix syscalls.
*
* Copyright (C) 2007 Bahadir Balban
*/
#include <stdio.h>
#include <string.h>
#include <l4lib/arch/syslib.h>
#include <l4lib/kip.h>
#include <l4lib/utcb.h>
#include <l4lib/ipcdefs.h>
#include <tests.h>
#include <unistd.h>
#include <sys/types.h>
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_SYNC);
// printf("Pager synced with us.\n");
}
pid_t parent_of_all;
void main(void)
{
printf("\n%s: Started with thread id %d\n", __TASKNAME__, getpid());
parent_of_all = getpid();
wait_pager(0);
printf("\n%s: Running POSIX API tests.\n", __TASKNAME__);
dirtest();
mmaptest();
shmtest();
forktest();
fileio();
clonetest();
if (parent_of_all == getpid()) {
ipc_full_test();
ipc_extended_test();
}
if (parent_of_all == getpid()) {
user_mutex_test();
}
exectest();
while (1)
wait_pager(0);
}