Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!awdprime!sandino.austin.ibm.com!jeffe From: jeffe@sandino.austin.ibm.com (Peter Jeffe 512.823.4091) Newsgroups: comp.unix.aix Subject: Re: popen/system problems? Message-ID: <3425@awdprime.UUCP> Date: 6 Sep 90 22:16:41 GMT References: Sender: news@awdprime.UUCP Organization: IBM AWD, Austin, TX Lines: 33 In article bglenden@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