I using the command: ulimit -n and i take the number 1024, which is the max number of open files per process in my system. But with the following programm i take the number 510...? What is wrong
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
int main( void )
{
int pipe_ext = 0, pfd[ 2 ], counter = 0;
while ( 1 )
{
pipe_ext = pipe( pfd );
//errno = 0;
if ( pipe_ext == 0 )
{
write( pfd[ 1 ], "R", 1 );
counter = counter + 1;
printf("Counter = %d\n", counter );
}
else
{
perror( "pipe()" );
printf("errno = %d\n", errno );
exit( 1 );
}
}
return( 0 );
}