Subject: O_NOACCESS opens?
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 05/31/2003 01:51:28
I'd like to be able to open(2) for neither reading nor writing.

Why I want to: I want to save and restore my current directory by
opening "." before changing and then fchdir(2)ing back afterwards.
But, even though my current directory can be a directory I have only
execute permission on, I can't do this with such a directory because I
can't open it!

Maybe O_EXONLY, or, since there's no fexecve() and thus "execute-only
access" makes little sense on a file descriptor[%], maybe O_NOACCESS
and leave the execute-access check up to fchdir(2) as now?  It seems to
make some sense to me to perform this check at open() time, though,
since after all the execute-access check is done at chdir/fchdir time,
and removing the execute bit doesn't boot the process out of the

[%] But maybe that would permit mmap(PROT_EXEC) without permitting
    either mmap(PROT_READ) or mmap(PROT_WRITE)?  (Though I think some
    architectures don't support such memory....)


/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B