Purpose of O_EXEC?

Kostik Belousov kostikbel at gmail.com
Mon Mar 31 09:05:47 PDT 2008


On Mon, Mar 31, 2008 at 06:01:48PM +0200, Ivan Voras wrote:
> Hi,
> What is the purpose of O_EXEC ("open file for execution") flag to
> open(2)? Just a hint to the VM system on how to cache the file pages or
> is there something else that makes it different from O_RDONLY?

No,
this is the only way to open file that has, for instance, mode 0111.
You can get the filedescriptor pointing to this file, that is useful
for the fexecve(2). Note that fexecve(2) ignores the open mode of the
filedescriptor and checks the vnode access right for the exec.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20080331/7c1ed36c/attachment.pgp


More information about the freebsd-hackers mailing list