diff options
Diffstat (limited to 'sysdeps/unix/sysv')
| -rw-r--r-- | sysdeps/unix/sysv/fcntlbits.h | 12 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/irix4/fcntlbits.h | 40 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/Dist | 1 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/Dist | 1 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/fcntlbits.h | 10 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/kernel_stat.h | 19 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/alpha/statbuf.h | 36 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/fcntlbits.h | 10 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/fxstat.c | 92 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/init-first.h | 21 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/kernel_stat.h | 31 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/lxstat.c | 92 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/net/if_ppp.h | 158 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/net/ppp_defs.h | 3 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/netinet/ip.h | 168 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/sparc/brk.c | 2 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/statbuf.h | 25 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/xstat.c | 92 |
18 files changed, 687 insertions, 126 deletions
diff --git a/sysdeps/unix/sysv/fcntlbits.h b/sysdeps/unix/sysv/fcntlbits.h index d04901406a..7f38422707 100644 --- a/sysdeps/unix/sysv/fcntlbits.h +++ b/sysdeps/unix/sysv/fcntlbits.h @@ -32,8 +32,9 @@ #define O_CREAT 00400 /* Create file if it doesn't exist. */ #define O_EXCL 02000 /* Fail if file already exists. */ #define O_TRUNC 01000 /* Truncate file to zero length. */ -#if defined (__USE_BSD) || defined (__USE_SVID) +#if defined __USE_BSD || defined __USE_SVID #define O_SYNC 00020 /* Synchronous writes. */ +#define O_FSYNC O_SYNC #endif /* File status flags for `open' and `fcntl'. */ @@ -83,4 +84,13 @@ struct flock #define F_UNLCK 3 /* Remove lock. */ +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +#define FAPPEND O_APPEND +#define FFSYNC O_FSYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY +#endif /* Use BSD. */ + #endif /* fcntlbits.h */ diff --git a/sysdeps/unix/sysv/irix4/fcntlbits.h b/sysdeps/unix/sysv/irix4/fcntlbits.h index a8bb776cf4..318e483279 100644 --- a/sysdeps/unix/sysv/irix4/fcntlbits.h +++ b/sysdeps/unix/sysv/irix4/fcntlbits.h @@ -1,21 +1,21 @@ /* O_*, F_*, FD_* bit values for SGI Irix 4. -Copyright (C) 1994 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1994, 1997 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 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 _FCNTLBITS_H @@ -34,6 +34,7 @@ Cambridge, MA 02139, USA. */ #define O_TRUNC 01000 /* Truncate file to zero length. */ #ifdef __USE_MISC #define O_SYNC 00020 /* Synchronous writes. */ +#define O_FSYNC O_SYNC #define O_ASYNC 00100 /* Send SIGIO to owner when data is ready. */ #endif @@ -95,4 +96,15 @@ struct flock #define F_UNLCK 3 /* Remove lock. */ +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +#define FAPPEND O_APPEND +#define FFSYNC O_FSYNC +#define FASYNC O_ASYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY +#endif /* Use BSD. */ + + #endif /* fcntlbits.h */ diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index 9c41e50b4c..7b94300c6a 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -1,6 +1,7 @@ cmsg_nxthdr.c init-first.h kernel_sigaction.h +kernel_stat.h llseek.c siglist.h sysctl.c diff --git a/sysdeps/unix/sysv/linux/alpha/Dist b/sysdeps/unix/sysv/linux/alpha/Dist index 344ffa55fb..80fca49a9b 100644 --- a/sysdeps/unix/sysv/linux/alpha/Dist +++ b/sysdeps/unix/sysv/linux/alpha/Dist @@ -4,6 +4,7 @@ ioperm.c init-first.h clone.S kernel_sigaction.h +kernel_stat.h sys/io.h sys/acct.h sys/kernel_termios.h diff --git a/sysdeps/unix/sysv/linux/alpha/fcntlbits.h b/sysdeps/unix/sysv/linux/alpha/fcntlbits.h index e8697d9898..faf198393f 100644 --- a/sysdeps/unix/sysv/linux/alpha/fcntlbits.h +++ b/sysdeps/unix/sysv/linux/alpha/fcntlbits.h @@ -23,6 +23,12 @@ #include <sys/types.h> +/* In GNU, read and write are bits (unlike BSD). */ +#ifdef __USE_GNU +#define O_READ O_RDONLY /* Open for reading. */ +#define O_WRITE O_WRONLY /* Open for writing. */ +#define O_NORW 0 /* Open without R/W access. */ +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ #define O_ACCMODE 0003 @@ -38,7 +44,8 @@ #define O_APPEND 00010 #define O_NDELAY O_NONBLOCK #define O_SYNC 040000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 /* fcntl, for BSD compatibility */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ @@ -86,6 +93,7 @@ struct flock #ifdef __USE_BSD #define FAPPEND O_APPEND #define FFSYNC O_FSYNC +#define FASYNC O_ASYNC #define FNONBLOCK O_NONBLOCK #define FNDELAY O_NDELAY #endif /* Use BSD. */ diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h new file mode 100644 index 0000000000..7109677269 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/kernel_stat.h @@ -0,0 +1,19 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + long int st_size; + unsigned long int st_atime; + unsigned long int st_mtime; + unsigned long int st_ctime; + unsigned int st_blksize; + int st_blocks; + unsigned int st_flags; + unsigned int st_gen; + }; diff --git a/sysdeps/unix/sysv/linux/alpha/statbuf.h b/sysdeps/unix/sysv/linux/alpha/statbuf.h index 92c9df7404..207fa0ca1c 100644 --- a/sysdeps/unix/sysv/linux/alpha/statbuf.h +++ b/sysdeps/unix/sysv/linux/alpha/statbuf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997 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 @@ -19,30 +19,30 @@ #ifndef _STATBUF_H #define _STATBUF_H 1 -/* The Alpha has no additional syscall versions. */ - /* Versions of the `struct stat' data structure. */ -#define _STAT_VER 0 +#define _STAT_VER_LINUX_OLD 0 +#define _STAT_VER_LINUX 1 +#define _STAT_VER _STAT_VER_LINUX /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 0 struct stat { - unsigned int st_dev; /* Device. */ - unsigned int st_ino; /* File serial number. */ - unsigned int st_mode; /* File mode. */ - unsigned int st_nlink; /* Link count. */ - unsigned int st_uid; /* User ID of the file's owner. */ - unsigned int st_gid; /* Group ID of the file's group.*/ - unsigned int st_rdev; /* Device number, if device. */ - long int st_size; /* Size of file, in bytes. */ - unsigned long int st_atime; /* Time of last access. */ - unsigned long int st_mtime; /* Time of last modification. */ - unsigned long int st_ctime; /* Time of last status change. */ - unsigned int st_blksize; /* Optimal block size for I/O. */ -#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ - int st_blocks; /* Nr. of 512-byte blocks allocated. */ + __dev_t st_dev; /* Device. */ + __ino_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ + __time_t st_atime; /* Time of last access. */ + __time_t st_mtime; /* Time of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned int st_blksize; /* Optimal block size for I/O. */ +#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ + int st_blocks; /* Nr. of 512-byte blocks allocated. */ unsigned int st_flags; unsigned int st_gen; }; diff --git a/sysdeps/unix/sysv/linux/fcntlbits.h b/sysdeps/unix/sysv/linux/fcntlbits.h index d7e889fc5e..fdc67ce4eb 100644 --- a/sysdeps/unix/sysv/linux/fcntlbits.h +++ b/sysdeps/unix/sysv/linux/fcntlbits.h @@ -23,6 +23,12 @@ #include <sys/types.h> +/* In GNU, read and write are bits (unlike BSD). */ +#ifdef __USE_GNU +#define O_READ O_RDONLY /* Open for reading. */ +#define O_WRITE O_WRONLY /* Open for writing. */ +#define O_NORW 0 /* Open without R/W access. */ +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ #define O_ACCMODE 0003 @@ -37,7 +43,8 @@ #define O_NONBLOCK 04000 #define O_NDELAY O_NONBLOCK #define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ @@ -85,6 +92,7 @@ struct flock #ifdef __USE_BSD #define FAPPEND O_APPEND #define FFSYNC O_FSYNC +#define FASYNC O_ASYNC #define FNONBLOCK O_NONBLOCK #define FNDELAY O_NDELAY #endif /* Use BSD. */ diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c new file mode 100644 index 0000000000..103218711b --- /dev/null +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -0,0 +1,92 @@ +/* fxstat using old-style Unix fstat system call. + Copyright (C) 1991, 1995, 1996, 1997 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 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 Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> + +#include "kernel_stat.h" + +extern int __syscall_fstat (int, struct kernel_stat *); + +/* Get information about the file descriptor FD in BUF. */ +int +__fxstat (int vers, int fd, struct stat *buf) +{ + struct kernel_stat kbuf; + int result; + + switch (vers) + { + case _STAT_VER_LINUX_OLD: + /* Nothing to do. The struct is in the form the kernel expects + it to be. */ + result = __syscall_fstat (fd, (struct kernel_stat *) buf); + break; + + case _STAT_VER_LINUX: + /* Do the system call. */ + result = __syscall_fstat (fd, &kbuf); + + /* Convert to current kernel version of `struct stat'. */ + buf->st_dev = kbuf.st_dev; +#ifdef _HAVE___PAD1 + buf->__pad1 = 0; +#endif + buf->st_ino = kbuf.st_ino; + buf->st_mode = kbuf.st_mode; + buf->st_nlink = kbuf.st_nlink; + buf->st_uid = kbuf.st_uid; + buf->st_gid = kbuf.st_gid; + buf->st_rdev = kbuf.st_rdev; +#ifdef _HAVE___PAD2 + buf->__pad2 = 0; +#endif + buf->st_size = kbuf.st_size; + buf->st_blksize = kbuf.st_blksize; + buf->st_blocks = kbuf.st_blocks; + buf->st_atime = kbuf.st_atime; +#ifdef _HAVE___UNUSED1 + buf->__unused1 = 0; +#endif + buf->st_mtime = kbuf.st_mtime; +#ifdef _HAVE___UNUSED2 + buf->__unused2 = 0; +#endif + buf->st_ctime = kbuf.st_ctime; +#ifdef _HAVE___UNUSED3 + buf->__unused3 = 0; +#endif +#ifdef _HAVE___UNUSED4 + buf->__unused4 = 0; +#endif +#ifdef _HAVE___UNUSED5 + buf->__unused5 = 0; +#endif + break; + + default: + __set_errno (EINVAL); + result = -1; + break; + } + + return result; +} +weak_alias (__fxstat, _fxstat) diff --git a/sysdeps/unix/sysv/linux/init-first.h b/sysdeps/unix/sysv/linux/init-first.h index dd4f85af9d..a9df8da52d 100644 --- a/sysdeps/unix/sysv/linux/init-first.h +++ b/sysdeps/unix/sysv/linux/init-first.h @@ -1,3 +1,22 @@ +/* Prepare arguments for library initialization function. + Copyright (C) 1997 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 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 Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + /* The job of this fragment it to find argc and friends for INIT. This is done in one of two ways: either in the stack context of program start, or having dlopen pass them in. */ @@ -7,7 +26,7 @@ void NAME (void *arg) \ { \ int argc; \ char **argv, **envp; \ - /* The next variable is only here to work around a bug in gcc <= 2.7.2.1. \ + /* The next variable is only here to work around a bug in gcc <= 2.7.2.2. \ If the address would be taken inside the expression the optimizer \ would try to be too smart and throws it away. Grrr. */ \ int *dummy_addr = &_dl_starting_up; \ diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h new file mode 100644 index 0000000000..bd7ddcc9bc --- /dev/null +++ b/sysdeps/unix/sysv/linux/kernel_stat.h @@ -0,0 +1,31 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + unsigned long int st_atime; + unsigned long int __unused1; +#define _HAVE___UNUSED1 + unsigned long int st_mtime; + unsigned long int __unused2; +#define _HAVE___UNUSED2 + unsigned long int st_ctime; + unsigned long int __unused3; +#define _HAVE___UNUSED3 + unsigned long int __unused4; +#define _HAVE___UNUSED4 + unsigned long int __unused5; +#define _HAVE___UNUSED5 + }; diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c new file mode 100644 index 0000000000..713490cf66 --- /dev/null +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -0,0 +1,92 @@ +/* lxstat using old-style Unix fstat system call. + Copyright (C) 1991, 1995, 1996, 1997 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 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 Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> + +#include "kernel_stat.h" + +extern int __syscall_lstat (const char *, struct kernel_stat *); + +/* Get information about the file NAME in BUF. */ +int +__lxstat (int vers, const char *name, struct stat *buf) +{ + struct kernel_stat kbuf; + int result; + + switch (vers) + { + case _STAT_VER_LINUX_OLD: + /* Nothing to do. The struct is in the form the kernel expects + it to be. */ + result = __syscall_lstat (name, (struct kernel_stat *) buf); + break; + + case _STAT_VER_LINUX: + /* Do the system call. */ + result = __syscall_lstat (name, &kbuf); + + /* Convert to current kernel version of `struct stat'. */ + buf->st_dev = kbuf.st_dev; +#ifdef _HAVE___PAD1 + buf->__pad1 = 0; +#endif + buf->st_ino = kbuf.st_ino; + buf->st_mode = kbuf.st_mode; + buf->st_nlink = kbuf.st_nlink; + buf->st_uid = kbuf.st_uid; + buf->st_gid = kbuf.st_gid; + buf->st_rdev = kbuf.st_rdev; +#ifdef _HAVE___PAD2 + buf->__pad2 = 0; +#endif + buf->st_size = kbuf.st_size; + buf->st_blksize = kbuf.st_blksize; + buf->st_blocks = kbuf.st_blocks; + buf->st_atime = kbuf.st_atime; +#ifdef _HAVE___UNUSED1 + buf->__unused1 = 0; +#endif + buf->st_mtime = kbuf.st_mtime; +#ifdef _HAVE___UNUSED2 + buf->__unused2 = 0; +#endif + buf->st_ctime = kbuf.st_ctime; +#ifdef _HAVE___UNUSED3 + buf->__unused3 = 0; +#endif +#ifdef _HAVE___UNUSED4 + buf->__unused4 = 0; +#endif +#ifdef _HAVE___UNUSED5 + buf->__unused5 = 0; +#endif + break; + + default: + __set_errno (EINVAL); + result = -1; + break; + } + + return result; +} +weak_alias (__lxstat, _lxstat) diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/unix/sysv/linux/net/if_ppp.h index 27652546ae..567dccebe3 100644 --- a/sysdeps/unix/sysv/linux/net/if_ppp.h +++ b/sysdeps/unix/sysv/linux/net/if_ppp.h @@ -1 +1,157 @@ -#include <linux/if_ppp.h> +/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */ + +/* + * if_ppp.h - Point-to-Point Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any document |
