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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [cris/] [c/] [pipe1.c] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 jlechner
/* Check for proper pipe semantics at corner cases.
2
#notarget: cris*-*-elf
3
*/
4
 
5
#include <stddef.h>
6
#include <stdio.h>
7
#include <stdlib.h>
8
#include <unistd.h>
9
#include <sched.h>
10
#include <signal.h>
11
#include <sys/types.h>
12
#include <sys/wait.h>
13
#include <limits.h>
14
 
15
int main (void)
16
{
17
  int i;
18
  int filemax;
19
 
20
#ifdef OPEN_MAX
21
  filemax = OPEN_MAX;
22
#else
23
  filemax = sysconf (_SC_OPEN_MAX);
24
#endif
25
 
26
  if (filemax < 10)
27
    abort ();
28
 
29
  /* Check that pipes don't leak file descriptors.  */
30
  for (i = 0; i < filemax * 10; i++)
31
    {
32
      int pip[2];
33
      if (pipe (pip) != 0)
34
        {
35
          perror ("pipe");
36
          abort ();
37
        }
38
 
39
      if (close (pip[0]) != 0 || close (pip[1]) != 0)
40
        {
41
          perror ("close");
42
          abort ();
43
        }
44
    }
45
  printf ("pass\n");
46
  exit (0);
47
}

powered by: WebSVN 2.1.0

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