Openat() and fexecve() committed

From: Kostik Belousov <kostikbel_at_gmail.com>
Date: Mon, 31 Mar 2008 18:30:06 +0300
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

#define _ATFILE_SOURCE
#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.

Received on Mon Mar 31 2008 - 13:30:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:29 UTC