popen/system problems?

Peter Jeffe 512.823.4091 jeffe at sandino.austin.ibm.com
Fri Sep 7 08:16:41 AEST 1990


In article <BGLENDEN.90Sep6110538 at mandrill.cv.nrao.edu> bglenden at mandrill.cv.nrao.edu (Brian Glendenning) writes:
>We have a large system of mixed fortran/C. To inquire about free disk
>space we essentially have a scheme like:
>
>	pp = popen("df | grep some_fs", "r");
>	...
>	fgets(line, 80, pp);
>	...
>	parse line for info
>
>This behaves oddly under the fortran/C system (e.g. the fgets hangs),
>but simple C only programs seem to show the right behaviour. Is there
>some known problem I should be aware of (RS6000/530, AIX3.1)?
>Alternate suggestions?  (e.g.  how do I query the fs's directly)?

I don't know why this would be a problem, but I sure have an alternative:
check out the statfs() or ustat() calls (the former takes a pathname, the
latter a device); they return a struct statfs (see sys/statfs.h) that tells
you all you may want to know about the filesystem, including anything
displayed by df.

>Incidentally, despite what the info pages say, df /some/file/name
>doesn't do what it does under bsd os's.

What do you mean?  When I do "df /pathname" it gives me stats on the
filesystem containing that file (or mounted over that directory), the
same as on a Sun or other BSD system.  Have you seen it do something
else?

-------------------------------------------------------------------------------
Peter Jeffe   ...uunet!cs.utexas.edu!ibmaus!auschs!sandino.austin.ibm.com!jeffe
        first they want a disclaimer, then they make you pee in a jar,
                   then they come for you in the night



More information about the Comp.unix.aix mailing list