It works everywhere else, but not on AIX

Chuck Karish karish at mindcraft.com
Thu Apr 18 21:38:32 AEST 1991


In article <1991Apr15.182214.10391 at ux1.cso.uiuc.edu> phil at ux1.cso.uiuc.edu
(Phil Howard KA9WGN) writes:
>First of all, the "df" command does not always know how to find the file
>system a particular path name it is given is on [ ... ]
>
>So apparently I need some other way to find out the file system I am on
>that is also portable over other UNIX platforms.  Until AIX, that was "df"
>itself.

This method has never been portable.  AIX 2.2.1 is based on SVR2,
which, I believe, did not support the desired behavior.  SCO UNIX
doesn't support it.  A/UX 1.2 lets the administrator decide which
filesystems are reported by df, so it won't work reliably there,
either.

How to do this portably?  Write a program that calls stat() and uses
the major and minor device numbers to figure out which of the
filesystems returned by mount(8) is the right one.  If you want to do
it all in a shell script, use cpio (portability warning! it's not
everywhere) to save the directory, and read out the major and minor
numbers with dd.

Schemes based on comparing the prefix from `pwd` to mount(8) output
can be fooled by symbolic links.

>Second thing.  I have a few programs that were written with direct system
>calls rather that C library calls, for I/O.  These programs work on all my
>other UNIX platforms but do not work on AIX.

Get back to us on this one when you have a question.  read() and
write() work fine for me on AIX.  I've compiled a number of imported
programs on AIX with little porting work needed, and no special
consideration for read() and write() on regular files.

	Chuck Karish		karish at mindcraft.com
	Mindcraft, Inc.		(415) 323-9000



More information about the Comp.unix.aix mailing list