diff options
Diffstat (limited to 'sysdeps/unix/sysv')
46 files changed, 751 insertions, 121 deletions
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index fa95317..e22cec7 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -32,6 +32,7 @@ netinet/udp.h netipx/ipx.h nfs/nfs.h rt_sigaction.c +rt_sigpending.c rt_sigprocmask.c rt_sigqueueinfo.c rt_sigreturn.c @@ -61,3 +62,4 @@ sys/ultrasound.h sys/user.h sys/vt.h xstatconv.c +getdents64.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 27684ef..152c798 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -120,4 +120,8 @@ sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait \ rt_sigqueueinfo rt_sigaction rt_sigpending endif +ifeq ($(subdir),dirent) +sysdep_routines += getdents64 +endif + common-generated += bits/stdio_lim.h bits/stdio_lim.d diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h index 9acdf0c..9033fdb 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/types.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h @@ -77,6 +77,9 @@ typedef long int __swblk_t; /* Type of a swap block maybe? */ typedef long int __clock_t; typedef int __key_t; /* Type of a SYSV IPC key. */ +/* Used in `struct shmid_ds'. */ +typedef int __ipc_pid_t; + /* One element in the file descriptor mask array. */ typedef unsigned long int __fd_mask; diff --git a/sysdeps/unix/sysv/linux/alpha/fstatfs64.c b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c new file mode 100644 index 0000000..2be4e59 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c @@ -0,0 +1 @@ +/* fstatfs64 is the same as fstatfs. */ diff --git a/sysdeps/unix/sysv/linux/alpha/ftruncate64.c b/sysdeps/unix/sysv/linux/alpha/ftruncate64.c new file mode 100644 index 0000000..673a8b5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/ftruncate64.c @@ -0,0 +1 @@ +/* ftruncate64 is the same as ftruncate. */ diff --git a/sysdeps/unix/sysv/linux/alpha/getrlimit64.c b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c new file mode 100644 index 0000000..9feab0e --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c @@ -0,0 +1 @@ +/* getrlimit64 is the same as getrlimit. */ diff --git a/sysdeps/unix/sysv/linux/alpha/init-first.h b/sysdeps/unix/sysv/linux/alpha/init-first.h index ffbcaf1..a3f5d8f 100644 --- a/sysdeps/unix/sysv/linux/alpha/init-first.h +++ b/sysdeps/unix/sysv/linux/alpha/init-first.h @@ -2,28 +2,26 @@ This is done in one of two ways: either in the stack context of program start, or having dlopen pass them in. */ -#define SYSDEP_CALL_INIT(NAME, INIT) \ - asm(".weak _dl_starting_up\n\t" \ - ".globl " #NAME "\n\t" \ - ".ent " #NAME "\n" \ - #NAME ":\n\t" \ - "ldgp $29, 0($27)\n\t" \ - ".prologue 1\n\t" \ - ".set at\n\t" \ - /* Are we a dynamic libc being loaded into a static program? */ \ - "lda $0, _dl_starting_up\n\t" \ - "beq $0, 1f\n\t" \ - "ldl $0, 0($0)\n" \ - "cmpeq $31, $0, $0\n" \ - "1:\t" \ - "stl $0, __libc_multiple_libcs\n\t" \ - /* If so, argc et al are in a0-a2 already. Otherwise, load them. */ \ - "bne $0, 2f\n\t" \ - "ldl $16, 0($30)\n\t" \ - "lda $17, 8($30)\n\t" \ - "s8addq $16, $17, $18\n\t" \ - "addq $18, 8, $18\n" \ - "2:\t" \ - "br $31, " #INIT "..ng\n\t" \ - ".set noat\n\t" \ - ".end " #NAME); +#define SYSDEP_CALL_INIT(NAME, INIT) asm("\ + .weak _dl_starting_up + .globl " #NAME " + .ent " #NAME " +" #NAME ": + ldgp $29, 0($27) + .prologue 1 + .set at + /* Are we a dynamic libc being loaded into a static program? */ + lda $0, _dl_starting_up + beq $0, 1f + ldl $0, 0($0) + cmpeq $31, $0, $0 +1: stl $0, __libc_multiple_libcs + /* If so, argc et al are in a0-a2 already. Otherwise, load them. */ + bne $0, 2f + ldl $16, 0($30) + lda $17, 8($30) + s8addq $16, $17, $18 + addq $18, 8, $18 +2: br $31, " ASM_ALPHA_NG_SYMBOL_PREFIX #INIT "..ng + .set noat + .end " #NAME); diff --git a/sysdeps/unix/sysv/linux/alpha/readdir.c b/sysdeps/unix/sysv/linux/alpha/readdir.c new file mode 100644 index 0000000..96a6a76 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/readdir.c @@ -0,0 +1,4 @@ +#define readdir64 __no_readdir64_decl +#include <sysdeps/unix/readdir.c> +#undef readdir64 +weak_alias (__readdir, readdir64) diff --git a/sysdeps/unix/sysv/linux/alpha/readdir64.c b/sysdeps/unix/sysv/linux/alpha/readdir64.c new file mode 100644 index 0000000..9796431 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/readdir64.c @@ -0,0 +1 @@ +/* readdir64 is in readdir.c */ diff --git a/sysdeps/unix/sysv/linux/alpha/readdir64_r.c b/sysdeps/unix/sysv/linux/alpha/readdir64_r.c new file mode 100644 index 0000000..b8fe9a3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/readdir64_r.c @@ -0,0 +1 @@ +/* readdir64_r is in readdir_r.c */ diff --git a/sysdeps/unix/sysv/linux/alpha/readdir_r.c b/sysdeps/unix/sysv/linux/alpha/readdir_r.c new file mode 100644 index 0000000..adb92db --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/readdir_r.c @@ -0,0 +1,4 @@ +#define readdir64_r __no_readdir64_r_decl +#include <sysdeps/unix/readdir_r.c> +#undef readdir64_r +weak_alias (__readdir_r, readdir64_r) diff --git a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c new file mode 100644 index 0000000..8edcff0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c @@ -0,0 +1 @@ +/* setrlimit64 is the same as setrlimit. */ diff --git a/sysdeps/unix/sysv/linux/alpha/statfs64.c b/sysdeps/unix/sysv/linux/alpha/statfs64.c new file mode 100644 index 0000000..06bc688 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/statfs64.c @@ -0,0 +1 @@ +/* statfs64 is the same as statfs. */ diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index d3bc033..af96471 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -23,10 +23,14 @@ mmap - mmap 6 __mmap mmap llseek EXTRA lseek 3 __llseek llseek lseek64 pread EXTRA pread 4 __pread pread __pread64 pread64 pwrite EXTRA pwrite 4 __pwrite pwrite __pwrite64 pwrite64 +fstatfs - fstatfs 2 __fstatfs fstatfs fstatfs64 +statfs - statfs 2 __statfs statfs statfs64 +getrlimit - getrlimit 2 getrlimit getrlimit64 +setrlimit - setrlimit 2 setrlimit setrlimit64 +ftruncate - ftruncate 2 ftruncate ftruncate64 +truncate - truncate 2 truncate truncate64 # these are actually common with the x86: -fstatfs - fstatfs 2 __fstatfs fstatfs -statfs - statfs 2 __statfs statfs sys_ustat ustat ustat 2 __syscall_ustat sys_mknod xmknod mknod 3 __syscall_mknod diff --git a/sysdeps/unix/sysv/linux/alpha/truncate64.c b/sysdeps/unix/sysv/linux/alpha/truncate64.c new file mode 100644 index 0000000..8999768 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/truncate64.c @@ -0,0 +1 @@ +/* truncate64 is the same as truncate. */ diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h index 9d0b9a9..d7a8e5e 100644 --- a/sysdeps/unix/sysv/linux/bits/msq.h +++ b/sysdeps/unix/sysv/linux/bits/msq.h @@ -17,7 +17,7 @@ Boston, MA 02111-1307, USA. */ #ifndef _SYS_MSG_H -#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." +# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." #endif #include <sys/types.h> @@ -28,7 +28,7 @@ /* Structure of record for one message inside the kernel. - The type `struct __msg' is opaque. */ + The type `struct msg' is opaque. */ struct msqid_ds { struct ipc_perm msg_perm; /* structure describing operation permission */ @@ -42,17 +42,17 @@ struct msqid_ds unsigned short int __msg_cbytes;/* current number of bytes on queue */ unsigned short int msg_qnum; /* number of messages currently on queue */ unsigned short int msg_qbytes;/* max number of bytes allowed on queue */ - int msg_lspid; /* pid of last msgsnd() */ - int msg_lrpid; /* pid of last msgrcv() */ + __ipc_pid_t msg_lspid; /* pid of last msgsnd() */ + __ipc_pid_t msg_lrpid; /* pid of last msgrcv() */ }; #ifdef __USE_MISC -#define msg_cbytes __msg_cbytes +# define msg_cbytes __msg_cbytes /* ipcs ctl commands */ -#define MSG_STAT 11 -#define MSG_INFO 12 +# define MSG_STAT 11 +# define MSG_INFO 12 /* buffer for msgctl calls IPC_INFO, MSG_INFO */ struct msginfo @@ -64,7 +64,7 @@ struct msginfo int msgmni; int msgssz; int msgtql; - ushort msgseg; + unsigned short int msgseg; }; #endif /* __USE_MISC */ diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h index f825cba..c649217 100644 --- a/sysdeps/unix/sysv/linux/bits/resource.h +++ b/sysdeps/unix/sysv/linux/bits/resource.h @@ -102,12 +102,20 @@ enum __rlimit_resource RLIM_NLIMITS = RLIMIT_NLIMITS, #define RLIMIT_NLIMITS RLIMIT_NLIMITS #define RLIM_NLIMITS RLIM_NLIMITS - - /* Value to indicate that there is no limit. */ - RLIM_INFINITY = (long int)(~0UL >> 1) -#define RLIM_INFINITY RLIM_INFINITY }; +/* Value to indicate that there is no limit. */ +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((long int)(~0UL >> 1)) +#else +# define RLIM_INFINITY 0x7fffffffffffffffLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0x7fffffffffffffffLL +#endif + + /* Type for resource quantity measurement. */ #ifndef __USE_FILE_OFFSET64 typedef __rlim_t rlim_t; diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h index 6f5f840..c707059 100644 --- a/sysdeps/unix/sysv/linux/bits/shm.h +++ b/sysdeps/unix/sysv/linux/bits/shm.h @@ -44,8 +44,8 @@ struct shmid_ds __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ - int shm_cpid; /* pid of creator */ - int shm_lpid; /* pid of last shmop */ + __ipc_pid_t shm_cpid; /* pid of creator */ + __ipc_pid_t shm_lpid; /* pid of last shmop */ unsigned short int shm_nattch; /* number of current attaches */ unsigned short int __shm_npages; /* size of segment (pages) */ unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */ @@ -73,12 +73,12 @@ struct shminfo struct shm_info { - int used_ids; - ulong shm_tot; /* total allocated shm */ - ulong shm_rss; /* total resident shm */ - ulong shm_swp; /* total swapped shm */ - ulong swap_attempts; - ulong swap_successes; + int used_ids; + unsigned long int shm_tot; /* total allocated shm */ + unsigned long int shm_rss; /* total resident shm */ + unsigned long int shm_swp; /* total swapped shm */ + unsigned long int swap_attempts; + unsigned long int swap_successes; }; #endif /* __USE_MISC */ diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h index 926c3f3..0a58912 100644 --- a/sysdeps/unix/sysv/linux/bits/termios.h +++ b/sysdeps/unix/sysv/linux/bits/termios.h @@ -82,32 +82,40 @@ struct termios #define ONLRET 0000040 #define OFILL 0000100 #define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 +#if !defined __USE_POSIX || defined __USE_UNIX98 +# define NLDLY 0000400 +# define NL0 0000000 +# define NL1 0000400 +# define CRDLY 0003000 +# define CR0 0000000 +# define CR1 0001000 +# define CR2 0002000 +# define CR3 0003000 +# define TABDLY 0014000 +# define TAB0 0000000 +# define TAB1 0004000 +# define TAB2 0010000 +# define TAB3 0014000 +# define BSDLY 0020000 +# define BS0 0000000 +# define BS1 0020000 +# define FFDLY 0100000 +# define FF0 0000000 +# define FF1 0100000 +#endif + #define VTDLY 0040000 #define VT0 0000000 #define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 + +#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU +# define XTABS 0014000 +#endif /* c_cflag bit meaning */ -#define CBAUD 0010017 +#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU +# define CBAUD 0010017 +#endif #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 @@ -124,8 +132,10 @@ struct termios #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 +#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU +# define EXTA B19200 +# define EXTB B38400 +#endif #define CSIZE 0000060 #define CS5 0000000 #define CS6 0000020 @@ -137,29 +147,37 @@ struct termios #define PARODD 0001000 #define HUPCL 0002000 #define CLOCAL 0004000 -#define CBAUDEX 0010000 +#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU +# define CBAUDEX 0010000 +#endif #define B57600 0010001 #define B115200 0010002 #define B230400 0010003 #define B460800 0010004 -#define CIBAUD 002003600000 /* input baud rate (not used) */ -#define CRTSCTS 020000000000 /* flow control */ +#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU +# define CIBAUD 002003600000 /* input baud rate (not used) */ +# define CRTSCTS 020000000000 /* flow control */ +#endif /* c_lflag bits */ #define ISIG 0000001 #define ICANON 0000002 -#define XCASE 0000004 +#if !defined __USE_POSIX || defined __USE_UNIX98 +# define XCASE 0000004 +#endif #define ECHO 0000010 #define ECHOE 0000020 #define ECHOK 0000040 #define ECHONL 0000100 #define NOFLSH 0000200 #define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 +#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU +# define ECHOCTL 0001000 +# define ECHOPRT 0002000 +# define ECHOKE 0004000 +# define FLUSHO 0010000 +# define PENDIN 0040000 +#endif #define IEXTEN 0100000 /* tcflow() and TCXONC use these */ diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h index dec60e2..723e0ff 100644 --- a/sysdeps/unix/sysv/linux/bits/types.h +++ b/sysdeps/unix/sysv/linux/bits/types.h @@ -103,6 +103,9 @@ typedef struct typedef int __key_t; +/* Used in `struct shmid_ds'. */ +typedef short int __ipc_pid_t; + /* Types from the Large File Support interface. */ diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c new file mode 100644 index 0000000..f688499 --- /dev/null +++ b/sysdeps/unix/sysv/linux/fxstat64.c @@ -0,0 +1,41 @@ +/* fxstat64 using old-style Unix fstat system call. + 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. */ + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> +#include <kernel_stat.h> + +#include <xstatconv.c> + +extern int __syscall_fstat (int, struct kernel_stat *); + +/* Get information about the file FD in BUF. */ +int +__fxstat64 (int vers, int fd, struct stat64 *buf) +{ + struct kernel_stat kbuf; + int result; + + result = __syscall_fstat (fd, &kbuf); + if (result == 0) + result = xstat64_conv (vers, &kbuf, buf); + + return result; +} diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c index b4b12d4..b1b532a 100644 --- a/sysdeps/unix/sysv/linux/getdents.c +++ b/sysdeps/unix/sysv/linux/getdents.c @@ -46,6 +46,10 @@ struct kernel_dirent char d_name[256]; }; +#ifdef GETDENTS64 +#define __getdirentries __getdirentries64 +#define dirent dirent64 +#endif /* The problem here is that we cannot simply read the next NBYTES bytes. We need to take the additional field into account. We use @@ -111,4 +115,6 @@ __getdirentries (fd, buf, nbytes, basep) return (char *) dp - buf; } +#ifndef GETDENTS64 weak_alias (__getdirentries, getdirentries) +#endif diff --git a/sysdeps/unix/sysv/linux/getdents64.c b/sysdeps/unix/sysv/linux/getdents64.c new file mode 100644 index 0000000..f50b0be --- /dev/null +++ b/sysdeps/unix/sysv/linux/getdents64.c @@ -0,0 +1,2 @@ +#define GETDENTS64 +#include <getdents.c> diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c new file mode 100644 index 0000000..8813fad --- /dev/null +++ b/sysdeps/unix/sysv/linux/lxstat64.c @@ -0,0 +1,41 @@ +/* lxstat64 using old-style Unix lstat system call. + 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. */ + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> +#include <kernel_stat.h> + +#include <xstatconv.c> + +extern int __syscall_lstat (const char *, struct kernel_stat *); + +/* Get information about the file NAME in BUF. */ +int +__lxstat64 (int vers, const char *name, struct stat64 *buf) +{ + struct kernel_stat kbuf; + int result; + + result = __syscall_lstat (name, &kbuf); + if (result == 0) + result = xstat64_conv (vers, &kbuf, buf); + + return result; +} diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h new file mode 100644 index 0000000..56075d1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/bits/types.h @@ -0,0 +1,130 @@ +/* Copyright (C) 1991, 92, 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 + 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. */ + +/* + * Never include this file directly; use <sys/types.h> instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include <features.h> + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; +#ifdef __GNUC__ +typedef unsigned long long int __u_quad_t; +typedef long long int __quad_t; +#else +typedef struct + { + long int __val[2]; + } __quad_t; +typedef struct + { + __u_long __val[2]; + } __u_quad_t; +#endif +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#ifdef __GNUC__ +typedef signed long long int __int64_t; +typedef unsigned long long int __uint64_t; +#endif +typedef __quad_t *__qaddr_t; + +typedef __u_quad_t __dev_t; /* Type of device numbers. */ +typedef __u_int __uid_t; /* Type of user identifications. */ +typedef __u_int __gid_t; /* Type of group identifications. */ +typedef __u_long __ino_t; /* Type of file serial numbers. */ +typedef __u_int __mode_t; /* Type of file attribute bitmasks. */ +typedef __u_int __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef int __pid_t; /* Type of process identifications. */ +typedef int __ssize_t; /* Type of a byte count, or error. */ +typedef long int __rlim_t; /* Type of resource counts. */ +typedef __quad_t __rlim64_t; /* Type of resource counts (LFS). */ +typedef __u_int __id_t; /* General type for ID. */ + +typedef struct + { + int __val[2]; + } __fsid_t; /* Type of file system IDs. */ + +/* Everythin' else. */ +typedef int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ + +typedef long int __clock_t; + +/* One element in the file descriptor mask array. */ +typedef unsigned long int __fd_mask; + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NFDBITS (8 * sizeof (__fd_mask)) +#define __FDELT(d) ((d) / __NFDBITS) +#define __FDMASK(d) ((__fd_mask) 1 << ((d) % __NFDBITS)) + +/* fd_set for select and pselect. */ +typedef struct + { + /* XPG4.2 requires this member name. */ + __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; + } __fd_set; + + +typedef int __key_t; + +/* Used in `struct shmid_ds'. */ +typedef long int __ipc_pid_t; + + +/* Types from the Large File Support interface. */ + +/* Type to count number os disk blocks. */ +typedef __u_long __blkcnt_t; +typedef __u_quad_t __blkcnt64_t; + +/* Type to count file system blocks. */ +typedef long int __fsblkcnt_t; +typedef __quad_t __fsblkcnt64_t; + +/* Type to count file system inodes. */ +typedef __u_long __fsfilcnt_t; +typedef __u_quad_t __fsfilcnt64_t; + +/* Type of file serial numbers. */ +typedef __u_long __ino64_t; + +/* Type of file sizes and offsets. */ +typedef __loff_t __off64_t; + +#endif /* bits/types.h */ diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c new file mode 100644 index 0000000..3762365 --- /dev/null +++ b/sysdeps/unix/sysv/linux/readdir64.c @@ -0,0 +1,103 @@ +/* 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. */ + +#include <errno.h> +#include <limits.h> +#include <stddef.h> +#include <string.h> +#include <dirent.h> +#include <unistd.h> +#include <sys/types.h> +#include <assert.h> + +#include <dirstream.h> + +extern ssize_t __getdirentries64 (int, char *, size_t, off_t *); + + +/* Read a directory entry from DIRP. */ +struct dirent64 * +readdir64 (DIR *dirp) +{ + struct dirent64 *dp; + + __libc_lock_lock (dirp->lock); + + do + { + size_t reclen; + + if (dirp->offset >= dirp->size) + { + /* We've emptied out our buffer. Refill it. */ + + size_t maxread; + off_t base; + ssize_t bytes; + +#ifndef _DIRENT_HAVE_D_RECLEN + /* Fixed-size struct; must read one at a time (see below). */ + maxread = sizeof *dp; +#else + maxread = dirp->allocation; +#endif + + base = dirp->filepos; + bytes = __getdirentries64 (dirp->fd, dirp->data, maxread, &base); + if (bytes <= 0) + { + dp = NULL; + break; + } + dirp->size = (size_t) bytes; + + /* Reset the offset into the buffer. */ + dirp->offset = 0; + } + + dp = (struct dirent64 *) &dirp->data[dirp->offset]; + +#ifdef _DIRENT_HAVE_D_RECLEN + reclen = dp->d_reclen; +#else + /* The only version of `struct dirent64' that lacks `d_reclen' + is fixed-size. */ + assert (sizeof dp->d_name > 1); + reclen = sizeof *dp; + /* The name is not terminated if it is the largest possible size. + Clobber the following byte to ensure proper null termination. We + read jst one entry at a time above so we know that byte will not + be used later. */ + dp->d_name[sizeof dp->d_name] = '\0'; +#endif + + dirp->offset += reclen; + +#ifdef _DIRENT_HAVE_D_OFF + dirp->filepos = dp->d_off; +#else + dirp->filepos += reclen; +#endif + + /* Skip deleted files. */ + } while (dp->d_ino == 0); + + __libc_lock_unlock (dirp->lock); + + return dp; +} diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c new file mode 100644 index 0000000..57ae4c7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/readdir64_r.c @@ -0,0 +1,107 @@ +/* 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. */ + +#include <errno.h> +#include <limits.h> +#include <stddef.h> +#include <string.h> +#include <dirent.h> +#include <unistd.h> +#include <sys/types.h> +#include <assert.h> + +#include <dirstream.h> + +extern ssize_t __getdirentries64 (int, char *, size_t, off_t *); + + +/* Read a directory entry from DIRP, store result in ENTRY and return + pointer to result in *RESULT. */ +int +readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result) +{ + struct dirent64 *dp; + size_t reclen; + + __libc_lock_lock (dirp->lock); + + do + { + if (dirp->offset >= dirp->size) + { + /* We've emptied out our buffer. Refill it. */ + + size_t maxread; + off_t base; + ssize_t bytes; + +#ifndef _DIRENT_HAVE_D_RECLEN + /* Fixed-size struct; must read one at a time (see below). */ + maxread = sizeof *dp; +#else + maxread = dirp->allocation; +#endif + + base = dirp->filepos; + bytes = __getdirentries64 (dirp->fd, dirp->data, maxread, &base); + if (bytes <= 0) + { + dp = NULL; + reclen = 0; + break; + } + dirp->size = (size_t) bytes; + + /* Reset the offset into the buffer. */ + dirp->offset = 0; + } + + dp = (struct dirent64 *) &dirp->data[dirp->offset]; + +#ifdef _DIRENT_HAVE_D_RECLEN + reclen = dp->d_reclen; +#else + /* The only version of `struct dirent64' that lacks `d_reclen' + is fixed-size. */ + assert (sizeof dp->d_name > 1); + reclen = sizeof *dp; + /* The name is not terminated if it is the largest possible size. + Clobber the following byte to ensure proper null termination. We + read just one entry at a time above so we know that byte will not + be used later. */ + dp->d_name[sizeof dp->d_name] = '\0'; +#endif + + dirp->offset += reclen; + +#ifdef _DIRENT_HAVE_D_OFF + dirp->filepos = dp->d_off; +#else + dirp->filepos += reclen; +#endif + + /* Skip deleted files. */ + } while (dp->d_ino == 0); + + if (dp != NULL) + *result = memcpy (entry, dp, reclen); + + __libc_lock_unlock (dirp->lock); + + return dp != NULL ? 0 : errno; +} diff --git a/sysdeps/unix/sysv/linux/powerpc/sigreturn.S b/sysdeps/unix/sysv/linux/rt_sigpending.c index 9b9413e..b605315 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sigreturn.S +++ b/sysdeps/unix/sysv/linux/rt_sigpending.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* 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 @@ -16,8 +16,12 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <sysdep.h> +#include <errno.h> +#include <signal.h> -PSEUDO (__sigreturn, sigreturn, 1) - /* Shouldn't get here. */ -PSEUDO_END(__sigreturn) +int +__syscall_rt_sigpending (sigset_t *set, size_t setsize) +{ + __set_errno (ENOSYS); + return -1; +} diff --git a/sysdeps/unix/sysv/linux/siglist.c b/sysdeps/unix/sysv/linux/siglist.c index 9f42cc0..6bb8562 100644 --- a/sysdeps/unix/sysv/linux/siglist.c +++ b/sysdeps/unix/sysv/linux/siglist.c @@ -21,6 +21,6 @@ default_symbol_version (__new_sys_siglist, _sys_siglist, GLIBC_2.1); default_symbol_version (_new_sys_siglist, sys_siglist, GLIBC_2.1); default_symbol_version (__new_sys_sigabbrev, sys_sigabbrev, GLIBC_2.1); #else -weak_alias(_sys_siglist, sys_siglist) -weak_alias(_sys_sigabbrev, sys_sigabbrev) +weak_alias(__new_sys_siglist, sys_siglist) +weak_alias(__new_sys_sigabbrev, sys_sigabbrev) #endif diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h index 0c421fb..5ee6c0e 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h @@ -95,6 +95,9 @@ typedef struct typedef int __key_t; +/* Used in `struct shmid_ds'. */ +typedef int __ipc_pid_t; + /* Types from the Large File Support interface. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c new file mode 100644 index 0000000..2be4e59 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c @@ -0,0 +1 @@ +/* fstatfs64 is the same as fstatfs. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c new file mode 100644 index 0000000..673a8b5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c @@ -0,0 +1 @@ +/* ftruncate64 is the same as ftruncate. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c new file mode 100644 index 0000000..9feab0e --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c @@ -0,0 +1 @@ +/* getrlimit64 is the same as getrlimit. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c new file mode 100644 index 0000000..96a6a76 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c @@ -0,0 +1,4 @@ +#define readdir64 __no_readdir64_decl +#include <sysdeps/unix/readdir.c> +#undef readdir64 +weak_alias (__readdir, readdir64) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c new file mode 100644 index 0000000..9796431 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c @@ -0,0 +1 @@ +/* readdir64 is in readdir.c */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c new file mode 100644 index 0000000..b8fe9a3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c @@ -0,0 +1 @@ +/* readdir64_r is in readdir_r.c */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c new file mode 100644 index 0000000..adb92db --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c @@ -0,0 +1,4 @@ +#define readdir64_r __no_readdir64_r_decl +#include <sysdeps/unix/readdir_r.c> +#undef readdir64_r +weak_alias (__readdir_r, readdir64_r) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c new file mode 100644 index 0000000..8edcff0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c @@ -0,0 +1 @@ +/* setrlimit64 is the same as setrlimit. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c new file mode 100644 index 0000000..06bc688 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c @@ -0,0 +1 @@ +/* statfs64 is the same as statfs. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list index 6491a9c..7e64daf 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list @@ -4,6 +4,12 @@ llseek EXTRA lseek 3 __llseek llseek lseek64 pread EXTRA pread 4 __pread pread __pread64 pread64 pwrite EXTRA pwrite 4 __pwrite pwrite __pwrite64 pwrite64 +fstatfs - fstatfs 2 __fstatfs fstatfs fstatfs64 +statfs - statfs 2 __statfs statfs statfs64 +getrlimit - getrlimit 2 getrlimit getrlimit64 +setrlimit - setrlimit 2 setrlimit setrlimit64 +ftruncate - ftruncate 2 ftruncate ftruncate64 +truncate - truncate 2 truncate truncate64 # Override select.S in parent directory: select - select 5 __select select diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c new file mode 100644 index 0000000..8999768 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c @@ -0,0 +1 @@ +/* truncate64 is the same as truncate. */ diff --git a/sysdeps/unix/sysv/linux/stdio_lim.h.in b/sysdeps/unix/sysv/linux/stdio_lim.h.in index 7fa98f7..0728095 100644 --- a/sysdeps/unix/sysv/linux/stdio_lim.h.in +++ b/sysdeps/unix/sysv/linux/stdio_lim.h.in @@ -17,17 +17,24 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _STDIO_H +#if !defined _STDIO_H && !defined __need_FOPEN_MAX # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead." #endif -#define L_tmpnam 19 -#define TMP_MAX 238328 +#ifndef __need_FOPEN_MAX +# define L_tmpnam 19 +# define TMP_MAX 238328 -#ifdef __USE_POSIX -# define L_ctermid 9 -# define L_cuserid 9 +# ifdef __USE_POSIX +# define L_ctermid 9 +# define L_cuserid 9 +# endif + +# define FILENAME_MAX DEFAULT_FILENAME_MAX #endif -#define FOPEN_MAX DEFAULT_FOPEN_MAX -#define FILENAME_MAX DEFAULT_FILENAME_MAX +#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX +# define __defined_FOPEN_MAX +# define FOPEN_MAX DEFAULT_FOPEN_MAX +#endif +#undef __need_FOPEN_MAX diff --git a/sysdeps/unix/sysv/linux/testrtsig.h b/sysdeps/unix/sysv/linux/testrtsig.h index 7256d71..7c41877 100644 --- a/sysdeps/unix/sysv/linux/testrtsig.h +++ b/sysdeps/unix/sysv/linux/testrtsig.h @@ -21,10 +21,10 @@ #include <string.h> #include <sys/utsname.h> -int +static int kernel_has_rtsig (void) { struct utsname name; - return uname (&name) < 0 || __strverscmp (name.release, "2.1.70") >= 0; + return uname (&name) == 0 && __strverscmp (name.release, "2.1.70") >= 0; } diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c index ef224d2..58ff111 100644 --- a/sysdeps/unix/sysv/linux/ulimit.c +++ b/sysdeps/unix/sysv/linux/ulimit.c @@ -16,10 +16,11 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <errno.h> +#include <stdarg.h> #include <sysdep.h> -#include <sys/resource.h> #include <unistd.h> -#include <errno.h> +#include <sys/resource.h> /* Function depends on CMD: 1 = Return the limit on the size of a file, in units of 512 bytes. @@ -31,42 +32,46 @@ can open. Returns -1 on errors. */ long int -__ulimit (cmd, newlimit) - int cmd; - long int newlimit; +__ulimit (int cmd, ...) { - int status; + struct rlimit limit; + va_list va; + long int result = -1; + + va_start (va, cmd); switch (cmd) { - case 1: - { - /* Get limit on file size. */ - struct rlimit fsize; - - status = getrlimit (RLIMIT_FSIZE, &fsize); - if (status < 0) - return -1; - + case UL_GETFSIZE: + /* Get limit on file size. */ + if (getrlimit (RLIMIT_FSIZE, &limit) == 0) /* Convert from bytes to 512 byte units. */ - return fsize.rlim_cur / 512; - } - case 2: + result = limit.rlim_cur / 512; + break; + + case UL_SETFSIZE: /* Set limit on file size. */ { - struct rlimit fsize; - fsize.rlim_cur = newlimit * 512; - fsize.rlim_max = newlimit * 512; + long int newlimit = va_arg (va, long int); + + limit.rlim_cur = newlimit * 512; + limit.rlim_max = newlimit * 512; - return setrlimit (RLIMIT_FSIZE, &fsize); + result = setrlimit (RLIMIT_FSIZE, &limit); } - case 4: - return sysconf (_SC_OPEN_MAX); + break; + + case __UL_GETOPENMAX: + result = sysconf (_SC_OPEN_MAX); + break; default: __set_errno (EINVAL); - return -1; } + + va_end (va); + + return result; } weak_alias (__ulimit, ulimit); diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c new file mode 100644 index 0000000..02f70c5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/xstat64.c @@ -0,0 +1,41 @@ +/* xstat64 using old-style Unix stat 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> + +#include <xstatconv.c> + +extern int __syscall_stat (const char *, struct kernel_stat *); + +/* Get information about the file NAME in BUF. */ +int +__xstat64 (int vers, const char *name, struct stat64 *buf) +{ + struct kernel_stat kbuf; + int result; + + result = __syscall_stat (name, &kbuf); + if (result == 0) + result = xstat64_conv (vers, &kbuf, buf); + + return result; +} diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c index fcf2f3b..0a8e0c4 100644 --- a/sysdeps/unix/sysv/linux/xstatconv.c +++ b/sysdeps/unix/sysv/linux/xstatconv.c @@ -81,3 +81,65 @@ xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) return 0; } + +static inline int +xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf) +{ +#ifdef XSTAT_IS_XSTAT64 + return xstat_conv (vers, kbuf, ubuf); +#else + switch (vers) + { + case _STAT_VER_LINUX: + { + struct stat64 *buf = ubuf; + + /* Convert to current kernel version of `struct stat64'. */ + 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; + + /* If struct stat64 is different from struct stat then + _STAT_VER_KERNEL does not make sense. */ + case _STAT_VER_KERNEL: + default: + __set_errno (EINVAL); + return -1; + } + + return 0; +#endif +} |