OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [sim/] [testsuite/] [sim/] [cris/] [c/] [clone3.c] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Check that exiting from a parent thread does not kill the child.
2
#notarget: cris*-*-elf
3
*/
4
 
5
#include <stddef.h>
6
#include <stdlib.h>
7
#include <stdio.h>
8
#include <limits.h>
9
#include <unistd.h>
10
#include <sched.h>
11
#include <signal.h>
12
#include <errno.h>
13
#include <sys/types.h>
14
#include <sys/wait.h>
15
 
16
int
17
process (void *arg)
18
{
19
  int i;
20
 
21
  for (i = 0; i < 50; i++)
22
    if (sched_yield ())
23
      abort ();
24
 
25
  printf ("pass\n");
26
  return 0;
27
}
28
 
29
int
30
main (void)
31
{
32
  int pid;
33
  long stack[16384];
34
 
35
  pid = clone (process, (char *) stack + sizeof (stack) - 64,
36
               (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
37
               | SIGCHLD, "ab");
38
  if (pid <= 0)
39
    {
40
      fprintf (stderr, "Bad clone %d\n", pid);
41
      abort ();
42
    }
43
 
44
  exit (0);
45
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.