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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [sim/] [testsuite/] [sim/] [cris/] [c/] [pipe1.c] - Rev 227

Compare with Previous | Blame | View Log

/* Check for proper pipe semantics at corner cases.
#notarget: cris*-*-elf
*/
 
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <limits.h>
 
int main (void)
{
  int i;
  int filemax;
 
#ifdef OPEN_MAX
  filemax = OPEN_MAX;
#else
  filemax = sysconf (_SC_OPEN_MAX);
#endif
 
  if (filemax < 10)
    abort ();
 
  /* Check that pipes don't leak file descriptors.  */
  for (i = 0; i < filemax * 10; i++)
    {
      int pip[2];
      if (pipe (pip) != 0)
	{
	  perror ("pipe");
	  abort ();
	}
 
      if (close (pip[0]) != 0 || close (pip[1]) != 0)
	{
	  perror ("close");
	  abort ();
	}
    }
  printf ("pass\n");
  exit (0);
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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