summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fcntlbits.h10
-rw-r--r--sysdeps/unix/sysv/linux/alpha/kernel_stat.h19
-rw-r--r--sysdeps/unix/sysv/linux/alpha/statbuf.h36
-rw-r--r--sysdeps/unix/sysv/linux/fcntlbits.h10
-rw-r--r--sysdeps/unix/sysv/linux/fxstat.c92
-rw-r--r--sysdeps/unix/sysv/linux/init-first.h21
-rw-r--r--sysdeps/unix/sysv/linux/kernel_stat.h31
-rw-r--r--sysdeps/unix/sysv/linux/lxstat.c92
-rw-r--r--sysdeps/unix/sysv/linux/net/if_ppp.h158
-rw-r--r--sysdeps/unix/sysv/linux/net/ppp_defs.h3
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip.h168
-rw-r--r--sysdeps/unix/sysv/linux/sparc/brk.c2
-rw-r--r--sysdeps/unix/sysv/linux/statbuf.h25
-rw-r--r--sysdeps/unix/sysv/linux/xstat.c92
16 files changed, 650 insertions, 111 deletions
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 documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by Carnegie Mellon University. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ */
+
+/*
+ * ==FILEVERSION 960926==
+ *
+ * NOTE TO MAINTAINERS:
+ * If you modify this file at all, please set the above date.
+ * if_ppp.h is shipped with a PPP distribution as well as with the kernel;
+ * if everyone increases the FILEVERSION number above, then scripts
+ * can do the right thing when deciding whether to install a new if_ppp.h
+ * file. Don't change the format of that line otherwise, so the
+ * installation script can recognize it.
+ */
+
+
+#ifndef __NET_IF_PPP_H
+#define __NET_IF_PPP_H 1
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <net/ppp_defs.h>
+
+__BEGIN_DECLS
+
+/*
+ * Packet sizes
+ */
+
+#define PPP_MTU 1500 /* Default MTU (size of Info field) */
+#define PPP_MAXMRU 65000 /* Largest MRU we allow */
+#define PPP_VERSION "2.3.0"
+#define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */
+#define PROTO_IPX 0x002b /* protocol numbers */
+#define PROTO_DNA_RT 0x0027 /* DNA Routing */
+
+
+/*
+ * Bit definitions for flags.
+ */
+
+#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
+#define SC_COMP_AC 0x00000002 /* header compression (output) */
+#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
+#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
+#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
+#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
+#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
+#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
+#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
+#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
+#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
+#define SC_DEBUG 0x00010000 /* enable debug messages */
+#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
+#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
+#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
+#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
+#define SC_MASK 0x0fE0ffff /* bits that user can change */
+
+/* state bits */
+#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
+#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
+#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */
+#define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */
+#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
+#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
+#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
+#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
+#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
+#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
+
+/*
+ * Ioctl definitions.
+ */
+
+struct npioctl {
+ int protocol; /* PPP protocol, e.g. PPP_IP */
+ enum NPmode mode;
+};
+
+/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
+struct ppp_option_data {
+ u_int8_t *ptr;
+ u_int32_t length;
+ int transmit;
+};
+
+struct ifpppstatsreq {
+ struct ifreq b;
+ struct ppp_stats stats; /* statistic information */
+};
+
+struct ifpppcstatsreq {
+ struct ifreq b;
+ struct ppp_comp_stats stats;
+};
+
+#define ifr__name b.ifr_ifrn.ifrn_name
+#define stats_ptr b.ifr_ifru.ifru_data
+
+/*
+ * Ioctl definitions.
+ */
+
+#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
+#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
+#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
+#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
+#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
+#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
+#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
+#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
+#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
+#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
+#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
+#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
+#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
+#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
+#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
+#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
+#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
+#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
+#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
+
+#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
+#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
+#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
+
+#if !defined(ifr_mtu)
+#define ifr_mtu ifr_ifru.ifru_metric
+#endif
+
+__END_DECLS
+
+#endif /* net/if_ppp.h */
diff --git a/sysdeps/unix/sysv/linux/net/ppp_defs.h b/sysdeps/unix/sysv/linux/net/ppp_defs.h
index dfd40e1825..5d613e0d0f 100644
--- a/sysdeps/unix/sysv/linux/net/ppp_defs.h
+++ b/sysdeps/unix/sysv/linux/net/ppp_defs.h
@@ -1,8 +1,7 @@
#ifndef _NET_PPP_DEFS_H
#define _NET_PPP_DEFS_H 1
-#include <sys/types.h>
-typedef u_int32_t __u32;
+#include <asm/types.h>
#include <linux/ppp_defs.h>
#endif /* net/ppp_defs.h */
diff --git a/sysdeps/unix/sysv/linux/netinet/ip.h b/sysdeps/unix/sysv/linux/netinet/ip.h
index c779db4e87..89c2b1d296 100644
--- a/sysdeps/unix/sysv/linux/netinet/ip.h
+++ b/sysdeps/unix/sysv/linux/netinet/ip.h
@@ -26,62 +26,65 @@
__BEGIN_DECLS
-struct timestamp {
- u_int8_t len;
- u_int8_t ptr;
+struct timestamp
+ {
+ u_int8_t len;
+ u_int8_t ptr;
#if __BYTE_ORDER == __LITTLE_ENDIAN
- u_int8_t flags:4,
- overflow:4;
+ u_int8_t flags:4;
+ u_int8_t overflow:4;
#elif __BYTE_ORDER == __BIG_ENDIAN
- u_int8_t overflow:4,
- flags:4;
+ u_int8_t overflow:4;
+ u_int8_t flags:4;
#else
#error "Please fix <bytesex.h>"
-#endif
- u_int32_t data[9];
-};
-
-struct ip_options {
- u_int32_t faddr; /* Saved first hop address */
- u_int8_t optlen;
- u_int8_t srr;
- u_int8_t rr;
- u_int8_t ts;
- u_int8_t is_setbyuser:1, /* Set by setsockopt? */
- is_data:1, /* Options in __data, rather than skb */
- is_strictroute:1, /* Strict source route */
- srr_is_hit:1, /* Packet destination addr was our one */
- is_changed:1, /* IP checksum more not valid */
- rr_needaddr:1, /* Need to record addr of outgoing dev */
- ts_needtime:1, /* Need to record timestamp */
- ts_needaddr:1; /* Need to record addr of outgoing dev */
- u_int8_t router_alert;
- u_int8_t __pad1;
- u_int8_t __pad2;
- u_int8_t __data[0];
-};
-
-struct iphdr {
+#endif
+ u_int32_t data[9];
+ };
+
+struct ip_options
+ {
+ u_int32_t faddr; /* Saved first hop address */
+ u_int8_t optlen;
+ u_int8_t srr;
+ u_int8_t rr;
+ u_int8_t ts;
+ u_int8_t is_setbyuser:1; /* Set by setsockopt? */
+ u_int8_t is_data:1; /* Options in __data, rather than skb */
+ u_int8_t is_strictroute:1; /* Strict source route */
+ u_int8_t srr_is_hit:1; /* Packet destination addr was our one */
+ u_int8_t is_changed:1; /* IP checksum more not valid */
+ u_int8_t rr_needaddr:1; /* Need to record addr of outgoing dev */
+ u_int8_t ts_needtime:1; /* Need to record timestamp */
+ u_int8_t ts_needaddr:1; /* Need to record addr of outgoing dev */
+ u_int8_t router_alert;
+ u_int8_t __pad1;
+ u_int8_t __pad2;
+ u_int8_t __data[0];
+ };
+
+struct iphdr
+ {
#if __BYTE_ORDER == __LITTLE_ENDIAN
- u_int8_t ihl:4,
- version:4;
+ u_int8_t ihl:4;
+ u_int8_t version:4;
#elif __BYTE_ORDER == __BIG_ENDIAN
- u_int8_t version:4,
- ihl:4;
+ u_int8_t version:4;
+ u_int8_t ihl:4;
#else
#error "Please fix <bytesex.h>"
#endif
- u_int8_t tos;
- u_int16_t tot_len;
- u_int16_t id;
- u_int16_t frag_off;
- u_int8_t ttl;
- u_int8_t protocol;
- u_int16_t check;
- u_int32_t saddr;
- u_int32_t daddr;
- /*The options start here. */
-};
+ u_int8_t tos;
+ u_int16_t tot_len;
+ u_int16_t id;
+ u_int16_t frag_off;
+ u_int8_t ttl;
+ u_int8_t protocol;
+ u_int16_t check;
+ u_int32_t saddr;
+ u_int32_t daddr;
+ /*The options start here. */
+ };
#ifdef __USE_BSD
/*
@@ -127,46 +130,48 @@ struct iphdr {
/*
* Structure of an internet header, naked of options.
*/
-struct ip {
+struct ip
+ {
#if __BYTE_ORDER == __LITTLE_ENDIAN
- u_int8_t ip_hl:4, /* header length */
- ip_v:4; /* version */
+ u_int8_t ip_hl:4; /* header length */
+ u_int8_t ip_v:4; /* version */
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
- u_int8_t ip_v:4, /* version */
- ip_hl:4; /* header length */
+ u_int8_t ip_v:4; /* version */
+ u_int8_t ip_hl:4; /* header length */
#endif
- u_int8_t ip_tos; /* type of service */
- u_short ip_len; /* total length */
- u_short ip_id; /* identification */
- u_short ip_off; /* fragment offset field */
+ u_int8_t ip_tos; /* type of service */
+ u_short ip_len; /* total length */
+ u_short ip_id; /* identification */
+ u_short ip_off; /* fragment offset field */
#define IP_RF 0x8000 /* reserved fragment flag */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- u_int8_t ip_ttl; /* time to live */
- u_int8_t ip_p; /* protocol */
- u_short ip_sum; /* checksum */
- struct in_addr ip_src, ip_dst; /* source and dest address */
-};
+ u_int8_t ip_ttl; /* time to live */
+ u_int8_t ip_p; /* protocol */
+ u_short ip_sum; /* checksum */
+ struct in_addr ip_src, ip_dst; /* source and dest address */
+ };
/*
* Time stamp option structure.
*/
-struct ip_timestamp {
- u_int8_t ipt_code; /* IPOPT_TS */
- u_int8_t ipt_len; /* size of structure (variable) */
- u_int8_t ipt_ptr; /* index of current entry */
+struct ip_timestamp
+ {
+ u_int8_t ipt_code; /* IPOPT_TS */
+ u_int8_t ipt_len; /* size of structure (variable) */
+ u_int8_t ipt_ptr; /* index of current entry */
#if __BYTE_ORDER == __LITTLE_ENDIAN
- u_int8_t ipt_flg:4, /* flags, see below */
- ipt_oflw:4; /* overflow counter */
+ u_int8_t ipt_flg:4, /* flags, see below */
+ u_int8_t ipt_oflw:4; /* overflow counter */
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
- u_int8_t ipt_oflw:4, /* overflow counter */
- ipt_flg:4; /* flags, see below */
+ u_int8_t ipt_oflw:4, /* overflow counter */
+ u_int8_t ipt_flg:4; /* flags, see below */
#endif
- u_int32_t data[9];
-};
+ u_int32_t data[9];
+ };
#endif /* __USE_BSD */
#define IPVERSION 4 /* IP version number */
@@ -175,6 +180,8 @@ struct ip_timestamp {
/*
* Definitions for IP type of service (ip_tos)
*/
+#define IPTOS_TOS_MASK 0x1E
+#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
@@ -184,6 +191,8 @@ struct ip_timestamp {
/*
* Definitions for IP precedence (also in ip_tos) (hopefully unused)
*/
+#define IPTOS_PREC_MASK 0xe0
+#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
#define IPTOS_PREC_NETCONTROL 0xe0
#define IPTOS_PREC_INTERNETCONTROL 0xc0
#define IPTOS_PREC_CRITIC_ECP 0xa0
@@ -196,24 +205,35 @@ struct ip_timestamp {
/*
* Definitions for options.
*/
-#define IPOPT_COPIED(o) ((o)&0x80)
-#define IPOPT_CLASS(o) ((o)&0x60)
-#define IPOPT_NUMBER(o) ((o)&0x1f)
+#define IPOPT_COPY 0x80
+#define IPOPT_CLASS_MASK 0x60
+#define IPOPT_NUMBER_MASK 0x1f
+
+#define IPOPT_COPIED(o) ((o) & IPOPT_COPY)
+#define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK)
+#define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK)
#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_DEBMEAS 0x40
+#define IPOPT_MEASUREMENT IPOPT_DEBMEAS
#define IPOPT_RESERVED2 0x60
#define IPOPT_EOL 0 /* end of option list */
+#define IPOPT_END IPOPT_EOL
#define IPOPT_NOP 1 /* no operation */
+#define IPOPT_NOOP IP_NOP
#define IPOPT_RR 7 /* record packet route */
#define IPOPT_TS 68 /* timestamp */
+#define IPOPT_TIMESTAMP IPOPT_TS
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
+#define IPOPT_SEC IPOPT_SECURITY
#define IPOPT_LSRR 131 /* loose source route */
#define IPOPT_SATID 136 /* satnet id */
+#define IPOPT_SID IPOPT_SATID
#define IPOPT_SSRR 137 /* strict source route */
+#define IPOPT_RA 148 /* router alert */
/*
* Offsets to fields in options other than EOL and NOP.
diff --git a/sysdeps/unix/sysv/linux/sparc/brk.c b/sysdeps/unix/sysv/linux/sparc/brk.c
index 13bcb0459b..8f079bf444 100644
--- a/sysdeps/unix/sysv/linux/sparc/brk.c
+++ b/sysdeps/unix/sysv/linux/sparc/brk.c
@@ -40,7 +40,7 @@ __brk (void *addr)
"t 0x10\n\t"
"mov %%o0, %0\n\t"
: "=r" (newbrk)
- : "0" (SYS_brk), "r" (addr)
+ : "0" (__NR_brk), "r" (addr)
: "g1", "o0");
__curbrk = newbrk;
diff --git a/sysdeps/unix/sysv/linux/statbuf.h b/sysdeps/unix/sysv/linux/statbuf.h
index 39bbdc9ece..15ffe637bc 100644
--- a/sysdeps/unix/sysv/linux/statbuf.h
+++ b/sysdeps/unix/sysv/linux/statbuf.h
@@ -20,8 +20,9 @@
#define _STATBUF_H 1
/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_LINUX 1
+#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
/* Versions of the `xmknod' interface. */
@@ -32,25 +33,25 @@
struct stat
{
- unsigned short int st_dev; /* Device. */
+ __dev_t st_dev; /* Device. */
unsigned short int __pad1;
- unsigned long int st_ino; /* File serial number. */
- unsigned short int st_mode; /* File mode. */
- unsigned short int st_nlink; /* Link count. */
- unsigned short int st_uid; /* User ID of the file's owner. */
- unsigned short int st_gid; /* Group ID of the file's group.*/
- unsigned short int st_rdev; /* Device number, if 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. */
unsigned short int __pad2;
- long int st_size; /* Size of file, in bytes. */
+ __off_t st_size; /* Size of file, in bytes. */
unsigned long int st_blksize; /* Optimal block size for I/O. */
#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
unsigned long int st_blocks; /* Number of 512-byte blocks allocated. */
- long int st_atime; /* Time of last access. */
+ __time_t st_atime; /* Time of last access. */
unsigned long int __unused1;
- long int st_mtime; /* Time of last modification. */
+ __time_t st_mtime; /* Time of last modification. */
unsigned long int __unused2;
- long int st_ctime; /* Time of last status change. */
+ __time_t st_ctime; /* Time of last status change. */
unsigned long int __unused3;
unsigned long int __unused4;
unsigned long int __unused5;
diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c
new file mode 100644
index 0000000000..be49b9d1de
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/xstat.c
@@ -0,0 +1,92 @@
+/* xstat 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_stat (const char *, struct kernel_stat *);
+
+/* Get information about the file NAME in BUF. */
+int
+__xstat (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_stat (name, (struct kernel_stat *) buf);
+ break;
+
+ case _STAT_VER_LINUX:
+ /* Do the system call. */
+ result = __syscall_stat (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 (__xstat, _xstat)