tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: openat/fstatat functions implementation

On Sep,Thursday 17 2009, at 7:43 PM, Peter Seebach wrote:

In message <200909171730.NAA02427%Sparkle.Rodents-Montreal.ORG@localhost>, der Mouse writ
As Thor said, the names suck; fstatat sounds like an -at version of
fstat, which it isn't.  (Thor's implicit suggestion of following the
paradigm implicit in fchroot won't work, though; that would lead to
fopen and fstat, each of which already exists with other semantics.)

Just to be picky:

There is already an fstatat in the wild:

fstatat - get file status relative to a directory file descriptor

      #include <sys/stat.h>

int fstatat(int dirfd, const char *path, struct stat *buf, int flags);

The fstatat() system call operates in exactly the same way as stat(2),
      except for the differences described in this manual page.

If the pathname given in path is relative, then it is interpreted rela- tive to the directory referred to by the file descriptor dirfd (rather than relative to the current working directory of the calling process,
      as is done by stat(2) for a relative pathname).

If the pathname given in path is relative and dirfd is the special value AT_FDCWD, then path is interpreted relative to the current work-
      ing directory of the calling process (like stat(2)).

They are the same. fstatat implemented by my patch does exactly same as written above.



Home | Main Index | Thread Index | Old Index