aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/bsd/bsd4.4/fcntlbits.h34
-rw-r--r--sysdeps/unix/bsd/fcntlbits.h34
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/fcntlbits.h30
-rw-r--r--sysdeps/unix/bsd/ultrix4/fcntlbits.h34
-rw-r--r--sysdeps/unix/common/fcntlbits.h36
-rw-r--r--sysdeps/unix/readdir_r.c8
-rw-r--r--sysdeps/unix/sysv/fcntlbits.h12
-rw-r--r--sysdeps/unix/sysv/irix4/fcntlbits.h40
-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
24 files changed, 775 insertions, 214 deletions
diff --git a/sysdeps/unix/bsd/bsd4.4/fcntlbits.h b/sysdeps/unix/bsd/bsd4.4/fcntlbits.h
index bb61392569..3ab2bf027d 100644
--- a/sysdeps/unix/bsd/bsd4.4/fcntlbits.h
+++ b/sysdeps/unix/bsd/bsd4.4/fcntlbits.h
@@ -1,21 +1,21 @@
/* O_*, F_*, FD_* bit values for 4.4 BSD.
-Copyright (C) 1991, 1992 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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ Copyright (C) 1991, 1992, 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. */
#ifndef _FCNTLBITS_H
diff --git a/sysdeps/unix/bsd/fcntlbits.h b/sysdeps/unix/bsd/fcntlbits.h
index dd8b2a9efa..1e87a379e4 100644
--- a/sysdeps/unix/bsd/fcntlbits.h
+++ b/sysdeps/unix/bsd/fcntlbits.h
@@ -1,21 +1,21 @@
/* O_*, F_*, FD_* bit values for 4.3 BSD.
-Copyright (C) 1991, 1992 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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ Copyright (C) 1991, 1992, 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. */
#ifndef _FCNTLBITS_H
diff --git a/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h b/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h
index 210072222c..a9f66c47a3 100644
--- a/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h
+++ b/sysdeps/unix/bsd/sun/sunos4/fcntlbits.h
@@ -1,21 +1,21 @@
/* O_*, F_*, FD_* bit values for SunOS 4.
-Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+ Copyright (C) 1991, 1992, 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
@@ -33,7 +33,7 @@ Cambridge, MA 02139, USA. */
#define O_EXCL 0x0800 /* Fail if file already exists. */
#define O_TRUNC 0x0400 /* Truncate file to zero length. */
#define O_NOCTTY 0x8000 /* Don't assign a controlling terminal. */
-#if defined (__USE_BSD) || defined (__USE_SVID)
+#if defined __USE_BSD || defined __USE_SVID
#define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */
#define O_FSYNC 0x2000 /* Synchronous writes. */
#define O_SYNC O_FSYNC
diff --git a/sysdeps/unix/bsd/ultrix4/fcntlbits.h b/sysdeps/unix/bsd/ultrix4/fcntlbits.h
index bf8e7b2a35..ba736e428e 100644
--- a/sysdeps/unix/bsd/ultrix4/fcntlbits.h
+++ b/sysdeps/unix/bsd/ultrix4/fcntlbits.h
@@ -1,21 +1,21 @@
/* O_*, F_*, FD_* bit values for Ultrix 4.
-Copyright (C) 1991, 1992 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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ Copyright (C) 1991, 1992, 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. */
#ifndef _FCNTLBITS_H
diff --git a/sysdeps/unix/common/fcntlbits.h b/sysdeps/unix/common/fcntlbits.h
index 0f8443313f..e416e0df13 100644
--- a/sysdeps/unix/common/fcntlbits.h
+++ b/sysdeps/unix/common/fcntlbits.h
@@ -1,21 +1,21 @@
-/* O_*, F_*, FD_* bit values for SVR4 and Irix 4.
-Copyright (C) 1991, 1992, 1995 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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+/* O_*, F_*, FD_* bit values for general Unix system.
+ Copyright (C) 1991, 1992, 1995, 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. */
#ifndef _FCNTLBITS_H
diff --git a/sysdeps/unix/readdir_r.c b/sysdeps/unix/readdir_r.c
index fca3eeeb5f..fa26db6381 100644
--- a/sysdeps/unix/readdir_r.c
+++ b/sysdeps/unix/readdir_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -33,13 +33,12 @@ int
__readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
{
struct dirent *dp;
+ size_t reclen;
__libc_lock_lock (dirp->lock);
do
{
- size_t reclen;
-
if (dirp->offset >= dirp->size)
{
/* We've emptied out our buffer. Refill it. */
@@ -60,6 +59,7 @@ __readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
if (bytes <= 0)
{
dp = NULL;
+ reclen = 0;
break;
}
dirp->size = (size_t) bytes;
@@ -97,7 +97,7 @@ __readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
if (dp != NULL)
{
- *entry = *dp;
+ memcpy (entry, dp, reclen);
*result = entry;
}
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<