Re: SOS v2.0 - fork()

From: Martin Blume (mblume_at_socha.net)
Date: 08/30/03

  • Next message: Martin Blume: "Re: SOS v2.0 - fork()"
    Date: Sat, 30 Aug 2003 18:51:34 +0200
    
    

    "Aaron" <coldhouse@163.com> schrieb
    > it failed, showing "segementation fault".
    > for ( i = 0; i < loop_cnt; i++ ) {
    > ...
    > ftimeout = fopen("ftimeout.dat", "w");
    > ftimeout_test = fopen("ftimeout_test.dat", "w");
    > ...
    > }

    In every round of the loop you are opening your log files again.
    Take this out and see if it improves stability. My guess is that
    sooner or later your process runs out of file descriptors so that
    fopen returns -1. As you don't check the return value of fopen,
    you'll write to an invalid file descriptor.

    HTH
    Martin


  • Next message: Martin Blume: "Re: SOS v2.0 - fork()"

    Relevant Pages

    • Re: Java and CCSID problems
      ... STDERR. ... program must set these file descriptors to valid values by opening them ... initiated with the spawn API, ...
      (comp.sys.ibm.as400.misc)
    • Re: Java and CCSID problems
      ... System.out is put in the opened file. ... program must set these file descriptors to valid values by opening them ... initiated with the spawn API, ...
      (comp.sys.ibm.as400.misc)
    • Re: [PATCH] vfs: new O_NODE open flag
      ... the filesystem node instead of the object referenced by the node. ... It lets userspace file descriptors reference a inode without actually ... opening a special file without side effects ...
      (Linux-Kernel)
    • Re: [PATCH] vfs: new O_NODE open flag
      ... On Fri, 25 Sep 2009, Dr. David Alan Gilbert wrote: ... the filesystem node instead of the object referenced by the node. ... It lets userspace file descriptors reference a inode without actually ... opening a special file without side effects ...
      (Linux-Kernel)