ok@quintus (12/16/88)
I am trying to put together a wrapper for open() which will be less unhelpfully vague about errors. For example, instead of just mumbling "no such file or directory" it will tell you *which* directory doesn't exist, and so on. Opening files for input was tricky, but now I am trying to hack O_WRONLY and O_RDWR. There are four ways you can run out of space: ENOSPC (not enough blocks left or not enough inodes left on device, but quota not exhausted) and EDQUOT (quota of blocks or of inodes exhausted, but room left on device). I have figured out how to disambiguate ENOSPC. I'm now trying to disambiguate EDQUOT. I have three questions: (a) given the path-name of a directory which does exist, how can I find out the path-name of the block special device on which is mounted the file system containing that directory? (That's what quotactl() is said to want for its second argument.) (b) the manual page I'm working from doesn't list ESRCH as a possible error return from quotactl(), but I sometimes get that result. (c) When the directory is accessed via NFS, the block special device /dev/whatever is on some other machine, and I _can't_ get at it. Given a directory accessed via NFS and a uid, how do you get the appropriate struct dqblk? Better still, tell me I'm wasting my time and that no-one needs to know whether they ran out of inodes or blocks...