xref: /netbsd-src/external/gpl2/xcvs/dist/lib/openat.h (revision a7c918477dd5f12c1da816ba05caf44eab2d06d6)
1*a7c91847Schristos /* provide a replacement openat function
2*a7c91847Schristos    Copyright (C) 2004, 2005 Free Software Foundation, Inc.
3*a7c91847Schristos 
4*a7c91847Schristos    This program is free software; you can redistribute it and/or modify
5*a7c91847Schristos    it under the terms of the GNU General Public License as published by
6*a7c91847Schristos    the Free Software Foundation; either version 2, or (at your option)
7*a7c91847Schristos    any later version.
8*a7c91847Schristos 
9*a7c91847Schristos    This program is distributed in the hope that it will be useful,
10*a7c91847Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*a7c91847Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*a7c91847Schristos    GNU General Public License for more details.
13*a7c91847Schristos 
14*a7c91847Schristos    You should have received a copy of the GNU General Public License
15*a7c91847Schristos    along with this program; if not, write to the Free Software Foundation,
16*a7c91847Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17*a7c91847Schristos 
18*a7c91847Schristos /* written by Jim Meyering */
19*a7c91847Schristos 
20*a7c91847Schristos #include <fcntl.h>
21*a7c91847Schristos 
22*a7c91847Schristos #include <sys/types.h>
23*a7c91847Schristos #include <sys/stat.h>
24*a7c91847Schristos #include <dirent.h>
25*a7c91847Schristos #include <unistd.h>
26*a7c91847Schristos 
27*a7c91847Schristos #ifndef AT_FDCWD
28*a7c91847Schristos # define AT_FDCWD (-3041965) /* same value as Solaris 9 */
29*a7c91847Schristos # define AT_SYMLINK_NOFOLLOW 4096 /* same value as Solaris 9 */
30*a7c91847Schristos 
31*a7c91847Schristos # ifdef __OPENAT_PREFIX
32*a7c91847Schristos #  undef openat
33*a7c91847Schristos #  define __OPENAT_CONCAT(x, y) x ## y
34*a7c91847Schristos #  define __OPENAT_XCONCAT(x, y) __OPENAT_CONCAT (x, y)
35*a7c91847Schristos #  define __OPENAT_ID(y) __OPENAT_XCONCAT (__OPENAT_PREFIX, y)
36*a7c91847Schristos #  define openat __OPENAT_ID (openat)
37*a7c91847Schristos int openat (int fd, char const *file, int flags, /* mode_t mode */ ...);
38*a7c91847Schristos #  define fdopendir __OPENAT_ID (fdopendir)
39*a7c91847Schristos DIR *fdopendir (int fd);
40*a7c91847Schristos #  define fstatat __OPENAT_ID (fstatat)
41*a7c91847Schristos int fstatat (int fd, char const *file, struct stat *st, int flag);
42*a7c91847Schristos # endif
43*a7c91847Schristos 
44*a7c91847Schristos #endif
45