LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   What means Pipe failed, too many files opened? (https://www.linuxquestions.org/questions/slackware-14/what-means-pipe-failed-too-many-files-opened-552270/)

geom06005 05-08-2007 09:24 AM

What means Pipe failed, too many files opened?
 
i am running a code and created a pipe. When i compile it and run it says that "pipe failed, too many files opened"

Does anyone know what does this mean?

osor 05-08-2007 11:13 AM

It means that you have too many open files for your user or program’s permissions…
pipe() probably failed with EMFILE. To correct this, you to change your resource limits (specifically RLIMIT_NOFILE).

geom06005 05-08-2007 12:46 PM

Dear osor


I have created a pipe and then forked the procedure, but it tells me that piped failed and has too many open files. I think that this response comes because
fd[0] element opens too many files for reading and the system memory is too low.
When i am using less files the procedure works fine

I wander how you change your resource limits, and what is RLIMIT_NOFILE() in order the pipe to read the files?

i give you a part of the pipe process
int i;
int status;
int pid[2];
int pipe_fd[2];

for(i = 0; i < n; i++)
{
strcpy(name,uncompressed[i]->d_name);
if (pipe(pipe_fd) < 0)
{
perror ("pipe failed");
exit (errno);I realy think that the process ends here

if ((pid[0]=fork()) < 0)
{
perror ("Fork failed");
exit(errno);

osor 05-08-2007 02:45 PM

Quote:

Originally Posted by geom06005
I wander how you change your resource limits

You can change resource limits with the ulimit command (which should be implemented by your shell). To see your current resource limits, type (in a terminal) “ulimit -a”. You can see how many open file descriptors a process is allowed to have.
Quote:

Originally Posted by geom06005
and what is RLIMIT_NOFILE

RLIMIT_NOFILE is a macro describing the number of open file descriptors a process is allowed to have. It is normally used by getrlimit() and setrlimit().

There are many reasons why your resource limits might be too low. The most common culprit is PAM. A quick google might get you started.

rworkman 05-08-2007 04:15 PM

http://slackwiki.org/Resource_Limits


All times are GMT -5. The time now is 11:01 PM.