Test to verify that the runtime loader semaphore is not initialized
after fork(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21885 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d65a066a81
commit
6981ec9f0a
@ -4,19 +4,23 @@ UsePrivateHeaders syslog_daemon ;
|
|||||||
|
|
||||||
SimpleTest SyslogTest
|
SimpleTest SyslogTest
|
||||||
: SyslogTest.cpp syslog.cpp
|
: SyslogTest.cpp syslog.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
SimpleTest flock_test
|
SimpleTest flock_test
|
||||||
: flock_test.cpp
|
: flock_test.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
SimpleTest setjmp_test
|
SimpleTest setjmp_test
|
||||||
: setjmp_test.c
|
: setjmp_test.c
|
||||||
;
|
;
|
||||||
|
|
||||||
SimpleTest sigsetjmp_test
|
SimpleTest sigsetjmp_test
|
||||||
: sigsetjmp_test.c
|
: sigsetjmp_test.c
|
||||||
;
|
;
|
||||||
|
|
||||||
|
SimpleTest init_rld_after_fork_test
|
||||||
|
: init_rld_after_fork_test.cpp
|
||||||
|
;
|
||||||
|
|
||||||
# Tell Jam where to find these sources
|
# Tell Jam where to find these sources
|
||||||
SEARCH on [ FGristFiles
|
SEARCH on [ FGristFiles
|
||||||
|
40
src/tests/system/libroot/posix/init_rld_after_fork_test.cpp
Normal file
40
src/tests/system/libroot/posix/init_rld_after_fork_test.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
list_semaphores(const char* process)
|
||||||
|
{
|
||||||
|
printf("%s (%ld) semaphores:\n", process, find_thread(NULL));
|
||||||
|
|
||||||
|
sem_info semInfo;
|
||||||
|
int32 cookie = 0;
|
||||||
|
while (get_next_sem_info(B_CURRENT_TEAM, &cookie, &semInfo) == B_OK)
|
||||||
|
printf(" %9ld %s\n", semInfo.sem, semInfo.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
pid_t child = fork();
|
||||||
|
if (child < 0) {
|
||||||
|
fprintf(stderr, "Error: fork() failed: %s\n", strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child > 0) {
|
||||||
|
// the parent process -- wait for the child to finish
|
||||||
|
status_t result;
|
||||||
|
wait_for_thread(child, &result);
|
||||||
|
}
|
||||||
|
|
||||||
|
list_semaphores(child == 0 ? "child" : "parent");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user