Consultor Eletrônico



Kbase 16492: c program for determining open file limit
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
c program for determining open file limit

Several Progress messages are symptoms of not being able to
open more files on the system. Such messages include:

** Unable to open file: <file-name>. Errno=24. (98)
SYSTEM ERROR: Too many files open. Cannot make a pipe. (359)
Unable to create socket. errno=24 (788)

The following short c program can help to determine how
many files can be opened by a process. It should be
compiled on the customer's system, and run in the same
environment that the Progress process generating the error
runs in.

--------------------------CUT HERE------------------------

/* test to check how many files a process can open */
#include <fcntl.h>
#include <errno.h>

main(argc, argv)
int argc;
char *argv[];
{
int fd;
int num=3; /* need to account for stdin, stdout, and stderr */
while(1)
{
fd = open(argv[0],O_RDWR);
if (fd < 0)
{
printf("Opened %d files until error %d\n",num,errno);
exit(0);
}
num++;
}
}

Progress Software Technical Support Note # 16492