X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Funistd_.h;h=24090053103d4200f50e1fff0d0ce6d09e24a5cf;hb=20b5ea915e5041b7d27d6d4fea6fc34a1d89dc45;hp=9beffce1fcf55ce96c3ccea0dabd624428a0d53f;hpb=6a43884b2d4737bd78949becf8de806f102ff6d8;p=pspp diff --git a/lib/unistd_.h b/lib/unistd_.h index 9beffce1fc..2409005310 100644 --- a/lib/unistd_.h +++ b/lib/unistd_.h @@ -16,12 +16,19 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GL_UNISTD_H -#define _GL_UNISTD_H +/* The include_next requires a split double-inclusion guard. */ #if @HAVE_UNISTD_H@ -# include @ABSOLUTE_UNISTD_H@ +# if @HAVE_INCLUDE_NEXT@ +# include_next +# else +# include @ABSOLUTE_UNISTD_H@ +# endif #endif +#ifndef _GL_UNISTD_H +#define _GL_UNISTD_H + /* mingw doesn't define the SEEK_* macros in . */ #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) # include @@ -42,13 +49,18 @@ extern "C" { #if @GNULIB_CHOWN@ # if @REPLACE_CHOWN@ +# ifndef REPLACE_CHOWN +# define REPLACE_CHOWN 1 +# endif +# if REPLACE_CHOWN /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE - to GID (if GID is not -1). + to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ -# define chown rpl_chown +# define chown rpl_chown extern int chown (const char *file, uid_t uid, gid_t gid); +# endif # endif #elif defined GNULIB_POSIXCHECK # undef chown @@ -172,6 +184,43 @@ extern int getlogin_r (char *name, size_t size); #endif +#if @GNULIB_LCHOWN@ +# if @REPLACE_LCHOWN@ +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Do not follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# define lchown rpl_lchown +extern int lchown (char const *file, uid_t owner, gid_t group); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lchown +# define lchown(f,u,g) \ + (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \ + "systems - use gnulib module lchown for portability"), \ + lchown (f, u, g)) +#endif + + +#if @GNULIB_LSEEK@ +# if @REPLACE_LSEEK@ +/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. + Return the new offset if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# define lseek rpl_lseek + extern off_t lseek (int fd, off_t offset, int whence); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lseek +# define lseek(f,o,w) \ + (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \ + "systems - use gnulib module lseek for portability"), \ + lseek (f, o, w)) +#endif + + #if @GNULIB_READLINK@ /* Read the contents of the symbolic link FILE and place the first BUFSIZE bytes of it into BUF. Return the number of bytes placed into BUF if @@ -214,3 +263,4 @@ extern unsigned int sleep (unsigned int n); #endif /* _GL_UNISTD_H */ +#endif /* _GL_UNISTD_H */