From 56e5d28c812ad3851c02d20df93cd6f00ada64bb Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 10 Aug 2000 19:47:55 +0000 Subject: More stuff. Down to only 43 missing functions before BusyBox will link. Fixed socket stuff so it doesn't pull in kernel headers and stubbed out fork and clone. A few other header file cleanups. -Erik --- include/features.h | 1 + include/getopt.h | 3 ++- include/stdio.h | 4 +++ include/stdlib.h | 2 +- include/sys/stat.h | 46 ++++++++++++++++----------------- include/sys/uio.h | 61 +++++++++++++++++--------------------------- include/unistd.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 7 files changed, 126 insertions(+), 65 deletions(-) (limited to 'include') diff --git a/include/features.h b/include/features.h index e890edebe..b7dfd21c5 100644 --- a/include/features.h +++ b/include/features.h @@ -41,6 +41,7 @@ #define __USE_BSD #define __USE_MISC #define __USE_POSIX +#define __USE_POSIX2 #define _POSIX_THREAD_SAFE_FUNCTIONS #include diff --git a/include/getopt.h b/include/getopt.h index 0d71ff6bd..a4cb95496 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -9,8 +9,9 @@ #include extern char *optarg; -extern int opterr; extern int optind; +extern int opterr; +extern int optopt; extern int getopt __P((int argc, char *const *argv, const char *shortopts)); diff --git a/include/stdio.h b/include/stdio.h index e807262f0..5f944f1f7 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -201,6 +201,10 @@ extern int vfscanf __P ((FILE *__restrict __s, /* Print a message describing the meaning of the value of errno. */ extern void perror __P ((__const char *__s)); +/* Like `getdelim', but reads up to a newline. */ +extern int getline __P ((char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream)); #endif /* __STDIO_H */ diff --git a/include/stdlib.h b/include/stdlib.h index 51ce80ba2..fefaf447a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -58,6 +58,7 @@ extern int putenv __P ((__const char *__string)); extern int setenv __P ((__const char *__name, __const char *__value, int __replace)); +extern void unsetenv __P ((__const char *__name)); extern int system __P ((__const char *__command)); @@ -87,7 +88,6 @@ extern void qsort __P ((__ptr_t __base, size_t __nmemb, size_t __size, #define atof(x) strtod((x),(char**)0) #define atoi(x) (int)strtol((x),(char**)0,10) #define atol(x) strtol((x),(char**)0,10) -char* itoa(int i); /* Returned by `div'. */ typedef struct diff --git a/include/sys/stat.h b/include/sys/stat.h index 13c50411d..b4e1620df 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -276,37 +276,37 @@ extern int mkfifo __P ((__const char *__path, __mode_t __mode)); /* Wrappers for stat and mknod system calls. */ #ifndef __USE_FILE_OFFSET64 -extern int __fxstat __P ((int __ver, int __fildes, +extern int _fxstat __P ((int __ver, int __fildes, struct stat *__stat_buf)); -extern int __xstat __P ((int __ver, __const char *__filename, +extern int _xstat __P ((int __ver, __const char *__filename, struct stat *__stat_buf)); -extern int __lxstat __P ((int __ver, __const char *__filename, +extern int _lxstat __P ((int __ver, __const char *__filename, struct stat *__stat_buf)); #else # ifdef __REDIRECT -extern int __REDIRECT (__fxstat, __P ((int __ver, int __fildes, - struct stat *__stat_buf)), __fxstat64); -extern int __REDIRECT (__xstat, __P ((int __ver, __const char *__filename, - struct stat *__stat_buf)), __xstat64); -extern int __REDIRECT (__lxstat, __P ((int __ver, __const char *__filename, - struct stat *__stat_buf)), __lxstat64); +extern int __REDIRECT (_fxstat, __P ((int __ver, int __fildes, + struct stat *__stat_buf)), _fxstat64); +extern int __REDIRECT (_xstat, __P ((int __ver, __const char *__filename, + struct stat *__stat_buf)), _xstat64); +extern int __REDIRECT (_lxstat, __P ((int __ver, __const char *__filename, + struct stat *__stat_buf)), _lxstat64); # else -# define __fxstat __fxstat64 -# define __xstat __xstat64 -# define __lxstat __lxstat64 +# define _fxstat _fxstat64 +# define _xstat _xstat64 +# define _lxstat _lxstat64 # endif #endif #ifdef __USE_LARGEFILE64 -extern int __fxstat64 __P ((int __ver, int __fildes, +extern int _fxstat64 __P ((int __ver, int __fildes, struct stat64 *__stat_buf)); -extern int __xstat64 __P ((int __ver, __const char *__filename, +extern int _xstat64 __P ((int __ver, __const char *__filename, struct stat64 *__stat_buf)); -extern int __lxstat64 __P ((int __ver, __const char *__filename, +extern int _lxstat64 __P ((int __ver, __const char *__filename, struct stat64 *__stat_buf)); #endif -extern int __xmknod __P ((int __ver, __const char *__path, +extern int _xmknod __P ((int __ver, __const char *__path, __mode_t __mode, __dev_t *__dev)); #if defined __GNUC__ && __GNUC__ >= 2 @@ -315,27 +315,27 @@ extern int __xmknod __P ((int __ver, __const char *__path, extern __inline__ int stat (__const char *__path, struct stat *__statbuf) { - return __xstat (_STAT_VER, __path, __statbuf); + return _xstat (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED extern __inline__ int lstat (__const char *__path, struct stat *__statbuf) { - return __lxstat (_STAT_VER, __path, __statbuf); + return _lxstat (_STAT_VER, __path, __statbuf); } # endif extern __inline__ int fstat (int __fd, struct stat *__statbuf) { - return __fxstat (_STAT_VER, __fd, __statbuf); + return _fxstat (_STAT_VER, __fd, __statbuf); } # if defined __USE_MISC || defined __USE_BSD extern __inline__ int mknod (__const char *__path, __mode_t __mode, __dev_t __dev) { - return __xmknod (_MKNOD_VER, __path, __mode, &__dev); + return _xmknod (_MKNOD_VER, __path, __mode, &__dev); } # endif @@ -343,20 +343,20 @@ extern __inline__ int mknod (__const char *__path, __mode_t __mode, extern __inline__ int stat64 (__const char *__path, struct stat64 *__statbuf) { - return __xstat64 (_STAT_VER, __path, __statbuf); + return _xstat64 (_STAT_VER, __path, __statbuf); } # if defined __USE_BSD || defined __USE_XOPEN_EXTENDED extern __inline__ int lstat64 (__const char *__path, struct stat64 *__statbuf) { - return __lxstat64 (_STAT_VER, __path, __statbuf); + return _lxstat64 (_STAT_VER, __path, __statbuf); } # endif extern __inline__ int fstat64 (int __fd, struct stat64 *__statbuf) { - return __fxstat64 (_STAT_VER, __fd, __statbuf); + return _fxstat64 (_STAT_VER, __fd, __statbuf); } # endif diff --git a/include/sys/uio.h b/include/sys/uio.h index 87120e6ff..0be33e9b4 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -1,64 +1,49 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #ifndef _SYS_UIO_H - #define _SYS_UIO_H 1 -#include - -__BEGIN_DECLS -#define __need_size_t -#include - -/* That is a klude for Linux. */ -#ifdef __linux__ -#include -#endif +#include -#ifndef __LINUX_UIO_H +#include -/* Structure describing a section of memory. */ +__BEGIN_DECLS -struct iovec -{ - /* Starting address. */ - __ptr_t iov_base; - /* Length in bytes. */ - size_t iov_len; -}; +/* This file defines `struct iovec'. */ +#include -#endif /* Read data from file descriptor FD, and put the result in the buffers described by VECTOR, which is a vector of COUNT `struct iovec's. The buffers are filled in the order specified. Operates just like `read' (see ) except that data are put in VECTOR instead of a contiguous buffer. */ -int readv __P ((int __fd, __const struct iovec * __vector, size_t __count)); +extern ssize_t readv __P ((int __fd, __const struct iovec *__vector, + int __count)); /* Write data pointed by the buffers described by VECTOR, which is a vector of COUNT `struct iovec's, to file descriptor FD. The data is written in the order specified. Operates just like `write' (see ) except that the data are taken from VECTOR instead of a contiguous buffer. */ -int writev __P ((int __fd, __const struct iovec * __vector, size_t __count)); - +extern ssize_t writev __P ((int __fd, __const struct iovec *__vector, + int __count)); __END_DECLS diff --git a/include/unistd.h b/include/unistd.h index 57a203dfd..6c2d1cece 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -65,13 +65,71 @@ extern char * mktemp __P ((char * __template)); extern int _clone __P ((int (*fn)(void *arg), void *child_stack, int flags, void *arg)); +/* Return the current machine's Internet number. */ +extern long int gethostid __P ((void)); -/* Make PATH be the root directory (the starting point for absolute paths). +/* 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. */ +extern int gethostname __P ((char *__name, size_t __len)); + +/* Set the name of the current host to NAME, which is LEN bytes long. This call is restricted to the super-user. */ -extern int chroot __P ((__const char *__path)); +extern int sethostname __P ((__const char *__name, size_t __len)); + + +/* Set the user ID of the calling process to UID. + If the calling process is the super-user, set the real + and effective user IDs, and the saved set-user-ID to UID; + if not, the effective user ID is set to UID. */ +extern int setuid __P ((__uid_t __uid)); + +/* Create a new session with the calling process as its leader. + The process group IDs of the session and the calling process + are set to the process ID of the calling process, which is returned. */ +extern __pid_t setsid __P ((void)); + +/* Get the real user ID of the calling process. */ +extern __uid_t getuid __P ((void)); + +/* Get the effective user ID of the calling process. */ +extern __uid_t geteuid __P ((void)); + +/* Get the real group ID of the calling process. */ +extern __gid_t getgid __P ((void)); + +/* Get the effective group ID of the calling process. */ +extern __gid_t getegid __P ((void)); + +/* If SIZE is zero, return the number of supplementary groups + the calling process is in. Otherwise, fill in the group IDs + of its supplementary groups in LIST and return the number written. */ +extern int getgroups __P ((int __size, __gid_t __list[])); + +/* Return the foreground process group ID of FD. */ +extern __pid_t tcgetpgrp __P ((int __fd)); +/* Set the foreground process group ID of FD set PGRP_ID. */ +extern int tcsetpgrp __P ((int __fd, __pid_t __pgrp_id)); +/* Get the process group ID of the calling process. + This function is different on old BSD. */ +extern __pid_t getpgrp __P ((void)); +/* Set the process group ID of the process matching PID to PGID. + If PID is zero, the current process's process group ID is set. + If PGID is zero, the process ID of the process is used. */ +extern int setpgid __P ((__pid_t __pid, __pid_t __pgid)); + +/* Get the process ID of the calling process. */ +extern __pid_t getpid __P ((void)); + + + + +/* Make PATH be the root directory (the starting point for absolute paths). + This call is restricted to the super-user. */ +extern int chroot __P ((__const char *__path)); /* Execute PATH with all arguments after PATH until a NULL pointer and environment from `environ'. */ @@ -113,6 +171,18 @@ extern __pid_t fork __P ((void)); * and the process ID of the new process to the old process. */ extern __pid_t vfork __P ((void)); +/* 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 __P ((void)) __attribute__ ((__const__)); + +#ifdef __USE_POSIX2 +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. */ +# define __need_getopt +# include +#endif + #ifndef SEEK_SET #define SEEK_SET 0 -- cgit v1.2.3