Re: Too Many Open Files --- error 24




David Schwartz wrote:
On Jun 26, 4:38 am, raxitsheth2...@xxxxxxxxx wrote:
Any Idea. ? why even it is not reaching to 65535, and giving "too many
open files" ?
anything with libc or so ? (I know 64-bit will help me, but currently
this is not the option for me.)

You have told us what error you get, but not what function it is a
response to!

I made a simple program... It is also behaving same way...!
I think something is missing or some misconception i am having for
behaviour.

/* === START========*/

#include<stdio.h>
#include<stdlib.h>
#include<errno.h>

int main()
{
FILE *fp=NULL;
int i;
int pid;
printf("\n Enter Pid of this Process : ");
scanf("%d",&pid);
char buf[100];


for(i=0;i<1000;i++)
{
memset(buf,0,100);

/* IF A IS NOT COMMENTED IT MAY WRITE log1.txt, log2.txt...upto
log1000.txt
if you don't want this then plz commen

// sprintf(buf,"lsof -p %d >> log[%d].txt",pid,i); //<--A
// sprintf(buf,"lsof -p %d > log.txt",pid,i); <--B

//sprintf(buf,"ls > log1.txt");
printf("\n BUF = %s",buf);fflush(stdout);
printf("\n I = %d",i);fflush(stdout);
fp=fopen("./mytest","r");
if (fp==NULL) {
printf("\n Error %d",errno);
printf("Error = %s",strerror(errno));
fflush(stdout);return -1;
}
system(buf);
}
return 0;
}

/*Approx. at 250 open fd program is showing the error Too many open
files*/


/*====STOP==========*/





DS

.



Relevant Pages

  • Re: SHOW DEVICE/FILES with FORTRAN?
    ... >> I don't think that locks are involved. ... to to find a list of open files. ... typedef struct {unsigned int len; void *address;} desc; ... printf ("The search_devnam argument accepts the standard wildcard ...
    (comp.os.vms)
  • Re: printf()
    ... >> Out of curiosity, why do programmers ... No, they are not, even leaving aside the lack of a newline in the ... int main ... all open files are closed (hence all output ...
    (comp.lang.c)
  • Re: File Descriptors
    ... int rv = 0; ... fileopen: Too many open files ... Specify what platform you ran it on as well and precisely how you ...
    (comp.unix.programmer)
  • Re: opteron, VS2005 beta, win64: std::streamsize is 4 bytes?
    ... >i need to open files> 2GB. ... > a win32 console application that looks like: ... > int main ...
    (microsoft.public.vc.language)
  • Re: Too Many Open Files --- error 24
    ... anything with libc or so? ... Minds, like parachutes, function best when open ...
    (comp.unix.programmer)