1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2/* Substitute for and wrapper around <unistd.h>. 3 Copyright (C) 2004-2007 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3, or (at your option) 8 any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software Foundation, 17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18 19#ifndef _GL_UNISTD_H 20 21/* The include_next requires a split double-inclusion guard. */ 22#if 1 23# include_next <unistd.h> 24#endif 25 26#ifndef _GL_UNISTD_H 27#define _GL_UNISTD_H 28 29/* mingw doesn't define the SEEK_* macros in <unistd.h>. */ 30#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) 31# include <stdio.h> 32#endif 33 34/* mingw fails to declare _exit in <unistd.h>. */ 35#include <stdlib.h> 36 37/* The definition of GL_LINK_WARNING is copied here. */ 38 39 40/* Declare overridden functions. */ 41 42#ifdef __cplusplus 43extern "C" { 44#endif 45 46 47#if 1 48# if 1 49# ifndef REPLACE_CHOWN 50# define REPLACE_CHOWN 1 51# endif 52# if REPLACE_CHOWN 53/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 54 to GID (if GID is not -1). Follow symbolic links. 55 Return 0 if successful, otherwise -1 and errno set. 56 See the POSIX:2001 specification 57 <http://www.opengroup.org/susv3xsh/chown.html>. */ 58# define chown rpl_chown 59extern int chown (const char *file, uid_t uid, gid_t gid); 60# endif 61# endif 62#elif defined GNULIB_POSIXCHECK 63# undef chown 64# define chown(f,u,g) \ 65 (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \ 66 "doesn't treat a uid or gid of -1 on some systems - " \ 67 "use gnulib module chown for portability"), \ 68 chown (f, u, g)) 69#endif 70 71 72#if 1 73# if !1 74/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if 75 NEWFD = OLDFD, otherwise close NEWFD first if it is open. 76 Return 0 if successful, otherwise -1 and errno set. 77 See the POSIX:2001 specification 78 <http://www.opengroup.org/susv3xsh/dup2.html>. */ 79extern int dup2 (int oldfd, int newfd); 80# endif 81#elif defined GNULIB_POSIXCHECK 82# undef dup2 83# define dup2(o,n) \ 84 (GL_LINK_WARNING ("dup2 is unportable - " \ 85 "use gnulib module dup2 for portability"), \ 86 dup2 (o, n)) 87#endif 88 89 90#if 1 91# if 0 92 93/* Change the process' current working directory to the directory on which 94 the given file descriptor is open. 95 Return 0 if successful, otherwise -1 and errno set. 96 See the POSIX:2001 specification 97 <http://www.opengroup.org/susv3xsh/fchdir.html>. */ 98extern int fchdir (int /*fd*/); 99 100# define close rpl_close 101extern int close (int); 102# define dup rpl_dup 103extern int dup (int); 104# define dup2 rpl_dup2 105extern int dup2 (int, int); 106 107# endif 108#elif defined GNULIB_POSIXCHECK 109# undef fchdir 110# define fchdir(f) \ 111 (GL_LINK_WARNING ("fchdir is unportable - " \ 112 "use gnulib module fchdir for portability"), \ 113 fchdir (f)) 114#endif 115 116 117#if 0 118# if !1 119/* Change the size of the file to which FD is opened to become equal to LENGTH. 120 Return 0 if successful, otherwise -1 and errno set. 121 See the POSIX:2001 specification 122 <http://www.opengroup.org/susv3xsh/ftruncate.html>. */ 123extern int ftruncate (int fd, off_t length); 124# endif 125#elif defined GNULIB_POSIXCHECK 126# undef ftruncate 127# define ftruncate(f,l) \ 128 (GL_LINK_WARNING ("ftruncate is unportable - " \ 129 "use gnulib module ftruncate for portability"), \ 130 ftruncate (f, l)) 131#endif 132 133 134#if 1 135/* Include the headers that might declare getcwd so that they will not 136 cause confusion if included after this file. */ 137# include <stdlib.h> 138# if 1 139/* Get the name of the current working directory, and put it in SIZE bytes 140 of BUF. 141 Return BUF if successful, or NULL if the directory couldn't be determined 142 or SIZE was too small. 143 See the POSIX:2001 specification 144 <http://www.opengroup.org/susv3xsh/getcwd.html>. 145 Additionally, the gnulib module 'getcwd' guarantees the following GNU 146 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 147 is SIZE bytes long, unless SIZE == 0, in which case it is as big as 148 necessary. */ 149# define getcwd rpl_getcwd 150extern char * getcwd (char *buf, size_t size); 151# endif 152#elif defined GNULIB_POSIXCHECK 153# undef getcwd 154# define getcwd(b,s) \ 155 (GL_LINK_WARNING ("getcwd is unportable - " \ 156 "use gnulib module getcwd for portability"), \ 157 getcwd (b, s)) 158#endif 159 160 161#if 0 162/* Copies the user's login name to NAME. 163 The array pointed to by NAME has room for SIZE bytes. 164 165 Returns 0 if successful. Upon error, an error number is returned, or -1 in 166 the case that the login name cannot be found but no specific error is 167 provided (this case is hopefully rare but is left open by the POSIX spec). 168 169 See <http://www.opengroup.org/susv3xsh/getlogin.html>. 170 */ 171# if !1 172# include <stddef.h> 173extern int getlogin_r (char *name, size_t size); 174# endif 175#elif defined GNULIB_POSIXCHECK 176# undef getlogin_r 177# define getlogin_r(n,s) \ 178 (GL_LINK_WARNING ("getlogin_r is unportable - " \ 179 "use gnulib module getlogin_r for portability"), \ 180 getlogin_r (n, s)) 181#endif 182 183 184#if 0 185# if !1 186/* This is for POSIX systems. */ 187# if !defined getpagesize && defined _SC_PAGESIZE 188# if ! (defined __VMS && __VMS_VER < 70000000) 189# define getpagesize() sysconf (_SC_PAGESIZE) 190# endif 191# endif 192/* This is for older VMS. */ 193# if !defined getpagesize && defined __VMS 194# ifdef __ALPHA 195# define getpagesize() 8192 196# else 197# define getpagesize() 512 198# endif 199# endif 200/* This is for BeOS. */ 201# if !defined getpagesize && 0 202# include <OS.h> 203# if defined B_PAGE_SIZE 204# define getpagesize() B_PAGE_SIZE 205# endif 206# endif 207/* This is for AmigaOS4.0. */ 208# if !defined getpagesize && defined __amigaos4__ 209# define getpagesize() 2048 210# endif 211/* This is for older Unix systems. */ 212# if !defined getpagesize && 0 213# include <sys/param.h> 214# ifdef EXEC_PAGESIZE 215# define getpagesize() EXEC_PAGESIZE 216# else 217# ifdef NBPG 218# ifndef CLSIZE 219# define CLSIZE 1 220# endif 221# define getpagesize() (NBPG * CLSIZE) 222# else 223# ifdef NBPC 224# define getpagesize() NBPC 225# endif 226# endif 227# endif 228# endif 229# endif 230#elif defined GNULIB_POSIXCHECK 231# undef getpagesize 232# define getpagesize() \ 233 (GL_LINK_WARNING ("getpagesize is unportable - " \ 234 "use gnulib module getpagesize for portability"), \ 235 getpagesize ()) 236#endif 237 238 239#if 1 240# if 0 241/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 242 to GID (if GID is not -1). Do not follow symbolic links. 243 Return 0 if successful, otherwise -1 and errno set. 244 See the POSIX:2001 specification 245 <http://www.opengroup.org/susv3xsh/lchown.html>. */ 246# define lchown rpl_lchown 247extern int lchown (char const *file, uid_t owner, gid_t group); 248# endif 249#elif defined GNULIB_POSIXCHECK 250# undef lchown 251# define lchown(f,u,g) \ 252 (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \ 253 "systems - use gnulib module lchown for portability"), \ 254 lchown (f, u, g)) 255#endif 256 257 258#if 1 259# if 0 260/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. 261 Return the new offset if successful, otherwise -1 and errno set. 262 See the POSIX:2001 specification 263 <http://www.opengroup.org/susv3xsh/lseek.html>. */ 264# define lseek rpl_lseek 265 extern off_t lseek (int fd, off_t offset, int whence); 266# endif 267#elif defined GNULIB_POSIXCHECK 268# undef lseek 269# define lseek(f,o,w) \ 270 (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \ 271 "systems - use gnulib module lseek for portability"), \ 272 lseek (f, o, w)) 273#endif 274 275 276#if 1 277/* Read the contents of the symbolic link FILE and place the first BUFSIZE 278 bytes of it into BUF. Return the number of bytes placed into BUF if 279 successful, otherwise -1 and errno set. 280 See the POSIX:2001 specification 281 <http://www.opengroup.org/susv3xsh/readlink.html>. */ 282# if !1 283# include <stddef.h> 284extern int readlink (const char *file, char *buf, size_t bufsize); 285# endif 286#elif defined GNULIB_POSIXCHECK 287# undef readlink 288# define readlink(f,b,s) \ 289 (GL_LINK_WARNING ("readlink is unportable - " \ 290 "use gnulib module readlink for portability"), \ 291 readlink (f, b, s)) 292#endif 293 294 295#if 0 296/* Pause the execution of the current thread for N seconds. 297 Returns the number of seconds left to sleep. 298 See the POSIX:2001 specification 299 <http://www.opengroup.org/susv3xsh/sleep.html>. */ 300# if !1 301extern unsigned int sleep (unsigned int n); 302# endif 303#elif defined GNULIB_POSIXCHECK 304# undef sleep 305# define sleep(n) \ 306 (GL_LINK_WARNING ("sleep is unportable - " \ 307 "use gnulib module sleep for portability"), \ 308 sleep (n)) 309#endif 310 311 312#ifdef __cplusplus 313} 314#endif 315 316 317#endif /* _GL_UNISTD_H */ 318#endif /* _GL_UNISTD_H */ 319