Skip to content

Commit

Permalink
Fix up unistd.h for XPG7.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Jan 11, 2010
1 parent 64c1f3a commit 7cdb5a3
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
2010-01-11 Ulrich Drepper <[email protected]>

* posix/unistd.h: Include environments.h also for XPG6 and up.
Define intptr_t for XPG6 and up.
Fix up for XPG7.
* conform/data/unistd.h-data: Fix up for XPG6 and XPG7.

* conform/data/sys/types.h-data: Fix up for XPG7.

* sysdeps/unix/bsd/bits/stat.h: Fix double-inclusion problem.
* sysdeps/unix/sysv/linux/powerpc/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
Expand Down
2 changes: 1 addition & 1 deletion conform/data/sys/types.h-data
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type blksize_t
type clock_t
type clockid_t
type dev_t
# if !defined POSIX && !defined POSIX2008
# if !defined POSIX
type fsblkcnt_t
type fsfilcnt_t
# endif
Expand Down
16 changes: 15 additions & 1 deletion conform/data/unistd.h-data
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ type intptr_t

function int access (const char*, int)
function {unsigned int} alarm (unsigned int)
#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function int brk (void*)
#endif
function int chdir (const char*)
#if defined XPG3 || defined XPG4 || defined UNIX98
function int chroot (const char*)
Expand Down Expand Up @@ -386,7 +388,9 @@ function {long int} fpathconf (int, int)
function int fsync (int)
function int ftruncate (int, off_t)
function {char*} getcwd (char*, size_t)
#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function int getdtablesize (void)
#endif
function gid_t getegid (void)
function uid_t geteuid (void)
function gid_t getgid (void)
Expand All @@ -398,17 +402,21 @@ function int gethostname (char*, size_t)
function {char*} getlogin (void)
function int getlogin_r (char*, size_t)
function int getopt (int, char*const[], const char*)
function int getpagesize (void)
#if defined XPG3 || defined XPG4 || defined UNIX98
function int getpagesize (void)
function {char*} getpass (const char*)
#endif
#ifndef POSIX
function pid_t getpgid (pid_t)
#endif
function pid_t getpgrp (void)
function pid_t getpid (void)
function pid_t getppid (void)
function pid_t getsid (pid_t)
function uid_t getuid (void)
#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
function {char*} getwd (char*)
#endif
function int isatty (int)
function int lchown (const char*, uid_t, gid_t)
function int link (const char*, const char*)
Expand Down Expand Up @@ -436,7 +444,9 @@ function ssize_t readlink (const char*, char*, size_t)
function ssize_t readlinkat (int, const char*, char*, size_t)
# endif
function int rmdir (const char*)
#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
function {void*} sbrk (intptr_t)
#endif
function int setegid (gid_t)
function int seteuid (uid_t)
function int setgid (gid_t)
Expand Down Expand Up @@ -465,13 +475,17 @@ function int tcsetpgrp (int, pid_t)
function int truncate (const char*, off_t)
function {char*} ttyname (int)
function int ttyname_r (int, char*, size_t)
#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
function useconds_t ualarm (useconds_t, useconds_t)
#endif
function int unlink (const char*)
# if defined XOPEN2K8 || defined POSIX2008
function int unlinkat (int, const char*, int)
# endif
#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
function int usleep (useconds_t)
function pid_t vfork (void)
#endif
function ssize_t write (int, const void*, size_t)

variable {char*} optarg
Expand Down
39 changes: 23 additions & 16 deletions posix/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ __BEGIN_DECLS
#include <bits/posix_opt.h>

/* Get the environment definitions from Unix98. */
#ifdef __USE_UNIX98
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <bits/environments.h>
#endif

Expand Down Expand Up @@ -263,7 +263,7 @@ typedef __pid_t pid_t;
# endif
#endif /* X/Open */

#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __intptr_t_defined
typedef __intptr_t intptr_t;
# define __intptr_t_defined
Expand Down Expand Up @@ -362,7 +362,7 @@ extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur;
__THROW. */
extern ssize_t write (int __fd, __const void *__buf, size_t __n) __wur;

#ifdef __USE_UNIX98
#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
# ifndef __USE_FILE_OFFSET64
/* Read NBYTES into BUF from FD at the given position OFFSET without
changing the file pointer. Return the number read, -1 for errors
Expand Down Expand Up @@ -440,7 +440,8 @@ extern unsigned int alarm (unsigned int __seconds) __THROW;
__THROW. */
extern unsigned int sleep (unsigned int __seconds);

#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#if (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) \
&& !defined __USE_XOPEN2K8
/* Set an alarm to go off (generating a SIGALRM signal) in VALUE
microseconds. If INTERVAL is nonzero, when the alarm goes off, the
timer is reset to go off every INTERVAL microseconds thereafter.
Expand Down Expand Up @@ -469,7 +470,7 @@ extern int pause (void);
extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;

#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the owner and group of the file that FD is open on. */
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;

Expand All @@ -492,7 +493,7 @@ extern int fchownat (int __fd, __const char *__file, __uid_t __owner,
/* Change the process's working directory to PATH. */
extern int chdir (__const char *__path) __THROW __nonnull ((1)) __wur;

#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the process's working directory to the one FD is open on. */
extern int fchdir (int __fd) __THROW __wur;
#endif
Expand All @@ -513,7 +514,8 @@ extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
extern char *get_current_dir_name (void) __THROW;
#endif

#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#if (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) \
&& !defined __USE_XOPEN2K8
/* Put the absolute pathname of the current working directory in BUF.
If successful, return BUF. If not, put an error message in
BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
Expand Down Expand Up @@ -639,7 +641,7 @@ extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid);

/* Get the process group ID of process PID. */
extern __pid_t __getpgid (__pid_t __pid) __THROW;
#ifdef __USE_XOPEN_EXTENDED
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
extern __pid_t getpgid (__pid_t __pid) __THROW;
#endif

Expand Down Expand Up @@ -683,7 +685,7 @@ extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid);
are set to the process ID of the calling process, which is returned. */
extern __pid_t setsid (void) __THROW;

#ifdef __USE_XOPEN_EXTENDED
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Return the session ID of the given process. */
extern __pid_t getsid (__pid_t __pid) __THROW;
#endif
Expand Down Expand Up @@ -772,7 +774,8 @@ extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
and the process ID of the new process to the old process. */
extern __pid_t fork (void) __THROW;

#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
#if (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) \
&& !defined __USE_XOPEN2K8
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
Expand Down Expand Up @@ -888,7 +891,7 @@ extern int setlogin (__const char *__name) __THROW __nonnull ((1));
#endif


#if defined __USE_BSD || defined __USE_UNIX98
#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Put the name of the current host in no more than LEN bytes of NAME.
The result is null-terminated if LEN is large enough for the full
name and the terminator. */
Expand Down Expand Up @@ -983,15 +986,21 @@ extern long int gethostid (void);
extern void sync (void) __THROW;


# ifndef __USE_XOPEN2K
/* Return the number of bytes in a page. This is the system's page size,
which is not necessarily the same as the hardware page size. */
extern int getpagesize (void) __THROW __attribute__ ((__const__));
# endif


/* Return the maximum number of file descriptors
the current process could possibly have. */
extern int getdtablesize (void) __THROW;

#endif /* Use BSD || X/Open Unix. */


#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8

/* Truncate FILE to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
Expand All @@ -1011,9 +1020,6 @@ extern int truncate64 (__const char *__file, __off64_t __length)
__THROW __nonnull ((1)) __wur;
# endif

#endif /* Use BSD || X/Open Unix. */

#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K

/* Truncate the file FD is open on to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
Expand All @@ -1033,7 +1039,8 @@ extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur;
#endif /* Use BSD || X/Open Unix || POSIX 2003. */


#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) \
&& !defined __USE_XOPEN2K

/* Set the end of accessible data space (aka "the break") to ADDR.
Returns zero on success and -1 for errors (with errno set). */
Expand Down Expand Up @@ -1139,7 +1146,7 @@ extern void swab (__const void *__restrict __from, void *__restrict __to,

/* The Single Unix specification demands this prototype to be here.
It is also found in <stdio.h>. */
#ifdef __USE_XOPEN
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
/* Return the name of the controlling terminal. */
extern char *ctermid (char *__s) __THROW;
#endif
Expand Down

0 comments on commit 7cdb5a3

Please sign in to comment.