URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 24 |
Rev 33 |
/* Check for proper pipe semantics at corner cases.
|
/* Check for proper pipe semantics at corner cases.
|
#notarget: cris*-*-elf
|
#notarget: cris*-*-elf
|
*/
|
*/
|
|
|
#include <stddef.h>
|
#include <stddef.h>
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <unistd.h>
|
#include <unistd.h>
|
#include <sched.h>
|
#include <sched.h>
|
#include <signal.h>
|
#include <signal.h>
|
#include <sys/types.h>
|
#include <sys/types.h>
|
#include <sys/wait.h>
|
#include <sys/wait.h>
|
#include <limits.h>
|
#include <limits.h>
|
|
|
int main (void)
|
int main (void)
|
{
|
{
|
int i;
|
int i;
|
int filemax;
|
int filemax;
|
|
|
#ifdef OPEN_MAX
|
#ifdef OPEN_MAX
|
filemax = OPEN_MAX;
|
filemax = OPEN_MAX;
|
#else
|
#else
|
filemax = sysconf (_SC_OPEN_MAX);
|
filemax = sysconf (_SC_OPEN_MAX);
|
#endif
|
#endif
|
|
|
if (filemax < 10)
|
if (filemax < 10)
|
abort ();
|
abort ();
|
|
|
/* Check that pipes don't leak file descriptors. */
|
/* Check that pipes don't leak file descriptors. */
|
for (i = 0; i < filemax * 10; i++)
|
for (i = 0; i < filemax * 10; i++)
|
{
|
{
|
int pip[2];
|
int pip[2];
|
if (pipe (pip) != 0)
|
if (pipe (pip) != 0)
|
{
|
{
|
perror ("pipe");
|
perror ("pipe");
|
abort ();
|
abort ();
|
}
|
}
|
|
|
if (close (pip[0]) != 0 || close (pip[1]) != 0)
|
if (close (pip[0]) != 0 || close (pip[1]) != 0)
|
{
|
{
|
perror ("close");
|
perror ("close");
|
abort ();
|
abort ();
|
}
|
}
|
}
|
}
|
printf ("pass\n");
|
printf ("pass\n");
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.