getcwd() and friends.
Brandon S. Allbery
allbery at ncoast.ORG
Fri Apr 14 06:27:05 AEST 1989
As quoted from <3746 at ficc.uu.net> by peter at ficc.uu.net (Peter da Silva):
+---------------
| In article <2001 at unisoft.UUCP>, greywolf at unisoft.UUCP (The Grey Wolf) writes:
| > if they were "instead of", and chmod() were eliminated so that only
| > fchmod remained, how would you change the mode of a file that was mode
| > 000? You wouldn't be able to O_RDWR or O_EXEC the file/directory and
| > therefore couldn't gain a valid file descriptor to pass to fchmod().
|
| How about O_TOKEN which returns a fd you can't do anything to until you
| do another open on it. Soirt of like an RMX file token or an AmigaDOS
| file lock. Have to call the fd version of open something other than
| fopen or fdopen, though.
|
| This would make 'dup' into fd_open(fd, O_CLONE), where O_CLONE means
| 'same flags as the first fd'...
|
| Do this cleverly enough and almost all the regular calls can actually use
| the new calls... you just need to keep 'open' around so you can get the
| fd in the first place:
+---------------
At the risk of being flamed for Political Incorrectness, I'll note that this
sounds vaguely familiar.
open(path, O_TOKEN) <------> shmget(key)
fd_open(token, ...) <------> shmat(shmid, ...)
I find myself wondering if AT&T knew what it was doing after all....
++Brandon
--
Brandon S. Allbery, moderator of comp.sources.misc allbery at ncoast.org
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery at hal.cwru.edu
Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser
More information about the Comp.unix.wizards
mailing list