Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!srcsip!nic.MR.NET!hal!ncoast!allbery From: allbery@ncoast.ORG (Brandon S. Allbery) Newsgroups: comp.unix.wizards Subject: Re: getcwd() and friends. Message-ID: <13563@ncoast.ORG> Date: 13 Apr 89 20:27:05 GMT References: <3675@ficc.uu.net> <14689@rpp386.Dallas.TX.US> <811@mtxinu.UUCP> <2001@unisoft.UUCP> <3746@ficc.uu.net> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 35 As quoted from <3746@ficc.uu.net> by peter@ficc.uu.net (Peter da Silva): +--------------- | In article <2001@unisoft.UUCP>, greywolf@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@ncoast.org uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu Send comp.sources.misc submissions to comp-sources-misc@ NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser