URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 24 |
Rev 33 |
/* Check that exiting from a parent thread does not kill the child.
|
/* Check that exiting from a parent thread does not kill the child.
|
#notarget: cris*-*-elf
|
#notarget: cris*-*-elf
|
*/
|
*/
|
|
|
#include <stddef.h>
|
#include <stddef.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <limits.h>
|
#include <limits.h>
|
#include <unistd.h>
|
#include <unistd.h>
|
#include <sched.h>
|
#include <sched.h>
|
#include <signal.h>
|
#include <signal.h>
|
#include <errno.h>
|
#include <errno.h>
|
#include <sys/types.h>
|
#include <sys/types.h>
|
#include <sys/wait.h>
|
#include <sys/wait.h>
|
|
|
int
|
int
|
process (void *arg)
|
process (void *arg)
|
{
|
{
|
int i;
|
int i;
|
|
|
for (i = 0; i < 50; i++)
|
for (i = 0; i < 50; i++)
|
if (sched_yield ())
|
if (sched_yield ())
|
abort ();
|
abort ();
|
|
|
printf ("pass\n");
|
printf ("pass\n");
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
int pid;
|
int pid;
|
long stack[16384];
|
long stack[16384];
|
|
|
pid = clone (process, (char *) stack + sizeof (stack) - 64,
|
pid = clone (process, (char *) stack + sizeof (stack) - 64,
|
(CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
|
(CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
|
| SIGCHLD, "ab");
|
| SIGCHLD, "ab");
|
if (pid <= 0)
|
if (pid <= 0)
|
{
|
{
|
fprintf (stderr, "Bad clone %d\n", pid);
|
fprintf (stderr, "Bad clone %d\n", pid);
|
abort ();
|
abort ();
|
}
|
}
|
|
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.