Openat() and fexecve() committed

Kostik Belousov kostikbel at
Mon Mar 31 08:30:26 PDT 2008

This is a notice for the list that the implementation of the openat(2)
and accompanied syscalls, among them fexecve(2), as specified in The
Open Group document titled "Extended API Set Part 2", is committed today
into the HEAD. Besides (now) FreeBSD, the functionality is implemented
on Linux, and I believe that it originated on Solaris.

The work was started as GSoC 2007 by Roman Divacky, with the help by
Robert Watson, and this is the first batch of the changes. Further, the
implementation of the fdopendir(), linux compatibility shims and man
pages updates are planned.

There is one known issue with the code. The following test

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>

 * create /tmp/foo/ and /tmp/foo/bar prior calling this,
 * set the access mode a+rx on /tmp/foo
int main() {
   int dfd = open("/tmp/foo", O_RDONLY);
   int res;
   chmod("/tmp/foo", 0666);
   if (dfd != -1) {
      res = openat(dfd, "bar", 0);
      printf("OPENAT returns: %d, errno: %s\n", res, strerror(errno));


gives the error EACCESS on both Linux and FreeBSD, and succeeds on Solaris.
The Solaris behaviour seems to be specified in the document cited above.
There are arguments in support of the both observed behaviour.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url :

More information about the freebsd-current mailing list