[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::fortran

Title:Digital Fortran
Notice:Read notes 1.* for important information
Moderator:QUARK::LIONEL
Created:Thu Jun 01 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1333
Total number of notes:6734

416.0. "system(3f) manpage" by RHETT::LOH () Tue Nov 07 1995 11:31

T.RTitleUserPersonal
Name
DateLines
416.1TLE::EKLUNDAlways smiling on the inside!Tue Nov 07 1995 13:2413
416.2TLE::EKLUNDAlways smiling on the inside!Wed Nov 08 1995 11:1321
416.3I assume you meant SYSTEM not SIGNAL, right Dave?SUBPAC::FARICELLIWed Nov 08 1995 12:500
416.4TLE::EKLUNDAlways smiling on the inside!Wed Nov 08 1995 13:254
416.5RHETT::LOHThu Nov 09 1995 16:164
416.6are system(3f) returns as per errno.h?MSBCS::SCHNEIDERSay it with ASCIIWed May 14 1997 19:3619
    I'll tuck this here where it's at least SOMEWHAT related, but I don't
    think it's Fortran-related at all.  Mostly want to make sure I'm not
    missing anything about how FORRTL handles system(3f) return values.
    
    I've got a couple of programs, including a trivial one, that call
    system(3f) and get a return of 11.  Can anybody tell me what 11 is
    likely to mean?  It's EDEADLK, according to errno.h, but that's not
    listed as a possible return from system(3) or fork(2), and I can't
    think what to make of it.
    
    The contexts where this gives trouble are kind of amusing.  The trouble
    occurs on only one of the systems in my shop (not on other quite
    similar systems), and it only occurs if the program is linked
    -non_shared.  If neither of those conditions is true, the system(3f)
    call behaves as expected: launches a shell w/command, and returns 0.
    
    Thanks for any insight!
    
    Chuck
416.7Did you declare system() as returning an integer?SUBPAC::FARICELLIThu May 15 1997 09:455
   Just checking: did you declare system() as returning an integer?
   (the default Fortran rules would have it return a real)

   -- John Faricelli
416.8integer it isMSBCS::SCHNEIDERSay it with ASCIIThu May 15 1997 12:2616
    Yep.  Here's the trivial program.  In the "good" circumstances, the
    output is the output from date, and the system(3f) return of 0.  In the
    "bad" circumstances, the output is only the system(3f) return of 11.
    
            program system3f
            integer system
            external system
            type *, system( 'date' )
            end
    
    Ooh, cool!  I just (re)discovered that if I unlimit coredumpsize (which
    I normally keep at 0), the "bad" system(3f) return changes to 139, and
    a core file gets dumped by sh.  139 doesn't appear in errno.h, so that
    again makes me wonder how these returns are to be interpreted.
    
    Chuck
416.9Looks like shell had a segmentation violationSUBPAC::FARICELLIFri May 16 1997 14:4525
  Well, system(3) says that you should interpret the return status
  as in wait(2). The wait(2) man page says to use the macros in sys/wait.h
  to interpret the return status.

  A small C code I wrote seems to indicate that the process terminated
  due to a signal not caught, and the signal was 11 (segv).

#include <stdio.h>
#include <sys/wait.h>
main()
{
  int status = 139;
  printf("Process called exit? = %d\n", WIFEXITED(status));
  printf("exit status = %d\n", WEXITSTATUS(status));
  printf("Process signalled? = %d\n", WIFSIGNALED(status));
  printf("signal was = %d\n", WTERMSIG(status));
}

uogsrv-77> a.out
Process called exit? = 0
exit status = -1
Process signalled? = 1
signal was = 11