From 3fec316902712c8a7546405852fa50a0aa39d4f6 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 19 Aug 2002 18:04:25 +0000 Subject: Eliminate wrapping of struct stat and use the kernel version directly. Eliminate all the attendant baggage. Fix internal types to match kernel types more closely. -Erik --- libc/misc/sysvipc/ftok.c | 2 +- libc/stdlib/ptsname.c | 2 +- libc/stdlib/unix_grantpt.c | 2 +- libc/sysdeps/linux/alpha/bits/stat.h | 63 ++----------- libc/sysdeps/linux/alpha/bits/types.h | 15 ++-- libc/sysdeps/linux/common/Makefile | 6 +- libc/sysdeps/linux/common/bits/stat.h | 81 ++++------------- libc/sysdeps/linux/common/bits/types.h | 15 ++-- libc/sysdeps/linux/common/mknod.c | 62 ------------- libc/sysdeps/linux/common/statfix.c | 47 ---------- libc/sysdeps/linux/common/statfix.h | 28 ------ libc/sysdeps/linux/common/statfix64.c | 52 ----------- libc/sysdeps/linux/common/statfix64.h | 82 ----------------- libc/sysdeps/linux/common/syscalls.c | 153 +++++--------------------------- libc/sysdeps/linux/i386/bits/select.h | 4 + libc/sysdeps/linux/m68k/bits/stat.h | 74 ++------------- libc/sysdeps/linux/mips/bits/stat.h | 80 ++--------------- libc/sysdeps/linux/mips/bits/types.h | 14 +-- libc/sysdeps/linux/powerpc/bits/stat.h | 68 ++------------ libc/sysdeps/linux/powerpc/bits/types.h | 17 ++-- libc/sysdeps/linux/sparc/bits/stat.h | 72 ++------------- libc/sysdeps/linux/sparc/bits/types.h | 19 ++-- 22 files changed, 132 insertions(+), 826 deletions(-) delete mode 100644 libc/sysdeps/linux/common/mknod.c delete mode 100644 libc/sysdeps/linux/common/statfix.c delete mode 100644 libc/sysdeps/linux/common/statfix.h delete mode 100644 libc/sysdeps/linux/common/statfix64.c delete mode 100644 libc/sysdeps/linux/common/statfix64.h (limited to 'libc') diff --git a/libc/misc/sysvipc/ftok.c b/libc/misc/sysvipc/ftok.c index b0199acda..ce0bd3f40 100644 --- a/libc/misc/sysvipc/ftok.c +++ b/libc/misc/sysvipc/ftok.c @@ -28,7 +28,7 @@ ftok (pathname, proj_id) struct stat st; key_t key; - if (__xstat (_STAT_VER, pathname, &st) < 0) + if (stat(pathname, &st) < 0) return (key_t) -1; key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16) diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 636e9c121..74f3e87d9 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -160,7 +160,7 @@ int ptsname_r (int fd, char *buf, size_t buflen) p[2] = '\0'; } - if (__xstat (_STAT_VER, buf, &st) < 0) + if (stat(buf, &st) < 0) return errno; /* Check if the name we're about to return really corresponds to a diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 49e65d16d..4d1b56adf 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -112,7 +112,7 @@ grantpt (int fd) if (pts_name (fd, &buf, sizeof (_buf))) return -1; - if (__xstat (_STAT_VER, buf, &st) < 0) + if (stat(buf, &st) < 0) goto cleanup; /* Make sure that we own the device. */ diff --git a/libc/sysdeps/linux/alpha/bits/stat.h b/libc/sysdeps/linux/alpha/bits/stat.h index 921283a51..575623139 100644 --- a/libc/sysdeps/linux/alpha/bits/stat.h +++ b/libc/sysdeps/linux/alpha/bits/stat.h @@ -26,64 +26,19 @@ #define _STAT_VER_GLIBC2_1 2 #define _STAT_VER _STAT_VER_GLIBC2_1 -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - -struct stat - { - __dev_t st_dev; /* Device. */ -#ifdef __USE_FILE_OFFSET64 - __ino64_t st_ino; /* File serial number. */ -#else - __ino_t st_ino; /* File serial number. */ - int __pad1; -#endif - __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. */ -#ifdef __USE_FILE_OFFSET64 - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ -#else - __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ - int __pad2; -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - unsigned int st_flags; - unsigned int st_gen; - int __pad3; - long __unused[4]; - }; +/* Pull in whatever this particular arch's kernel thinks that struct stat + * should look like. It turns out that each arch has a different opinion + * on the subject, and different kernel revs use different names... */ +#define new_stat stat +#include #ifdef __USE_LARGEFILE64 -/* Note stat64 is the same shape as stat. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_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. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - unsigned int st_flags; - unsigned int st_gen; - int __pad3; - long __unused[4]; - }; +# ifdef __USE_FILE_OFFSET64 +# define stat stat64 +# endif #endif + /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV diff --git a/libc/sysdeps/linux/alpha/bits/types.h b/libc/sysdeps/linux/alpha/bits/types.h index 569e5a81a..69ea02800 100644 --- a/libc/sysdeps/linux/alpha/bits/types.h +++ b/libc/sysdeps/linux/alpha/bits/types.h @@ -54,18 +54,19 @@ typedef signed long int __int64_t; typedef unsigned long int __uint64_t; typedef __quad_t *__qaddr_t; +/* changed to be more compatible with kernel */ typedef __kernel_dev_t __dev_t; /* Type of device numbers. */ typedef __kernel_uid_t __uid_t; /* Type of user identifications. */ typedef __kernel_gid_t __gid_t; /* Type of group identifications. */ -typedef __uint32_t __ino_t; /* Type of file serial numbers. */ +typedef __kernel_ino_t __ino_t; /* Type of file serial numbers. */ +typedef __kernel_mode_t __mode_t; /* Type of file attribute bitmasks. */ +typedef __kernel_nlink_t __nlink_t; /* Type of file link counts. */ +typedef __kernel_off_t __off_t; /* Type of file sizes and offsets. */ +typedef __kernel_loff_t __loff_t; /* Type of file sizes and offsets. */ +typedef __kernel_pid_t __pid_t; /* Type of process identifications. */ +typedef __kernel_ssize_t __ssize_t; /* Type of a byte count, or error. */ typedef __uint64_t __ino64_t; /* "" (LFS) */ -typedef __uint32_t __mode_t; /* Type of file attribute bitmasks. */ -typedef __uint32_t __nlink_t; /* Type of file link counts. */ -typedef __int64_t __off_t; /* Type of file sizes and offsets. */ typedef __int64_t __off64_t; /* "" (LFS) */ -typedef __int64_t __loff_t; /* Type of file sizes and offsets. */ -typedef __int32_t __pid_t; /* Type of process identifications. */ -typedef __int64_t __ssize_t; /* Type of a byte count, or error. */ typedef __uint64_t __rlim_t; /* Type of resource counts. */ typedef __uint64_t __rlim64_t; /* "" (LFS) */ typedef __uint32_t __blksize_t; /* Type to represnet block size. */ diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index 84de78aca..383956f19 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/libc/sysdeps/linux/common/Makefile @@ -29,12 +29,12 @@ ifeq ($(strip $(DOPIC)),true) SAFECFLAGS+=-fPIC endif -CSRC= waitpid.c statfix.c getdnnm.c gethstnm.c getcwd.c \ +CSRC= waitpid.c getdnnm.c gethstnm.c getcwd.c \ mkfifo.c setegid.c wait.c getpagesize.c seteuid.c \ wait3.c setpgrp.c getdtablesize.c create_module.c ptrace.c \ - cmsg_nxthdr.c statfix64.c longjmp.c open64.c ftruncate64.c \ + cmsg_nxthdr.c longjmp.c open64.c ftruncate64.c \ truncate64.c getrlimit64.c setrlimit64.c creat64.c mmap64.c \ - llseek.c pread_write.c _exit.c mknod.c setuid.c sync.c + llseek.c pread_write.c _exit.c setuid.c sync.c ifneq ($(strip $(EXCLUDE_BRK)),true) CSRC+=sbrk.c endif diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h index f446a91db..82cb04094 100644 --- a/libc/sysdeps/linux/common/bits/stat.h +++ b/libc/sysdeps/linux/common/bits/stat.h @@ -20,6 +20,9 @@ # error "Never include directly; use instead." #endif +#ifndef _BITS_STAT_H +#define _BITS_STAT_H + /* Versions of the `struct stat' data structure. */ #define _STAT_VER_LINUX_OLD 1 #define _STAT_VER_KERNEL 1 @@ -32,75 +35,18 @@ #define _MKNOD_VER_SVR4 2 #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __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; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; -#ifndef __USE_FILE_OFFSET64 - unsigned long int __unused4; - unsigned long int __unused5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - +/* Pull in whatever this particular arch's kernel thinks that struct stat + * should look like. It turns out that each arch has a different opinion + * on the subject, and different kernel revs use different names... */ +#define new_stat stat +#include #ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; - - __ino_t __st_ino; /* 32bit 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 int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - __ino64_t st_ino; /* File serial number. */ - }; +# ifdef __USE_FILE_OFFSET64 +# define stat stat64 +# endif #endif + /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV @@ -132,3 +78,6 @@ struct stat64 #define __S_IREAD 0400 /* Read by owner. */ #define __S_IWRITE 0200 /* Write by owner. */ #define __S_IEXEC 0100 /* Execute by owner. */ + +#endif /* _BITS_STAT_H */ + diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h index 88126cca3..6aef44901 100644 --- a/libc/sysdeps/linux/common/bits/types.h +++ b/libc/sysdeps/linux/common/bits/types.h @@ -67,16 +67,17 @@ __extension__ typedef unsigned long long int __uint64_t; #endif typedef __quad_t *__qaddr_t; +/* changed to be more compatible with kernel */ typedef __kernel_dev_t __dev_t; /* Type of device numbers. */ typedef __kernel_uid_t __uid_t; /* Type of user identifications. */ typedef __kernel_gid_t __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 __kernel_ino_t __ino_t; /* Type of file serial numbers. */ +typedef __kernel_mode_t __mode_t; /* Type of file attribute bitmasks. */ +typedef __kernel_nlink_t __nlink_t; /* Type of file link counts. */ +typedef __kernel_off_t __off_t; /* Type of file sizes and offsets. */ +typedef __kernel_loff_t __loff_t; /* Type of file sizes and offsets. */ +typedef __kernel_pid_t __pid_t; /* Type of process identifications. */ +typedef __kernel_ssize_t __ssize_t; /* Type of a byte count, or error. */ typedef __u_long __rlim_t; /* Type of resource counts. */ typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ typedef __u_int __id_t; /* General type for ID. */ diff --git a/libc/sysdeps/linux/common/mknod.c b/libc/sysdeps/linux/common/mknod.c deleted file mode 100644 index 8629c2070..000000000 --- a/libc/sysdeps/linux/common/mknod.c +++ /dev/null @@ -1,62 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * mknod syscall for uClibc - * - * Copyright (C) 2002 by Erik Andersen - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#define _GNU_SOURCE -#define __FORCE_GLIBC -#include -#include -#include -#include -#include - -#ifndef _MKNOD_VER -# define _MKNOD_VER 0 -#endif - -#ifndef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) __syscall_mknod (args) -#define __NR___syscall_mknod __NR_mknod -static inline _syscall3(int, __syscall_mknod, const char *, path, - unsigned short int, mode, unsigned short int, dev); -#endif - -int __xmknod (int version, const char * path, __mode_t mode, __dev_t *dev) -{ - unsigned short int k_dev; - /* We must convert the value to dev_t type used by the kernel. */ - k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff); - - switch(version) - { - case 1: - return INLINE_SYSCALL (mknod, 3, path, mode, k_dev); - default: - __set_errno(EINVAL); - return -1; - } -} - -int mknod(const char *path, __mode_t mode, __dev_t dev) -{ - return __xmknod(_MKNOD_VER, path, mode, &dev); -} - diff --git a/libc/sysdeps/linux/common/statfix.c b/libc/sysdeps/linux/common/statfix.c deleted file mode 100644 index 507018dc3..000000000 --- a/libc/sysdeps/linux/common/statfix.c +++ /dev/null @@ -1,47 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* Convert from the kernel's version of struct stat to libc's version - * - * Copyright (C) 2000 by Lineo, inc. and Erik Andersen - * Copyright (C) 2000,2001 by Erik Andersen - * Written by Erik Andersen - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* Pull in whatever this particular arch's kernel thinks the kernel version of - * struct stat should look like. It turns out that each arch has a different - * opinion on the subject. Then pull in libc's version of struct stat... */ -#include "statfix.h" -#include - -/* Convert from the kernel's version of struct stat to libc's version */ -void __statfix(struct libc_stat *libcstat, struct kernel_stat *kstat) -{ - memset(libcstat, 0, sizeof(struct libc_stat)); - libcstat->st_dev = kstat->st_dev; - libcstat->st_ino = kstat->st_ino; - libcstat->st_mode = kstat->st_mode; - libcstat->st_nlink = kstat->st_nlink; - libcstat->st_uid = kstat->st_uid; - libcstat->st_gid = kstat->st_gid; - libcstat->st_rdev = kstat->st_rdev; - libcstat->st_size = kstat->st_size; - libcstat->st_blksize = kstat->st_blksize; - libcstat->st_blocks = kstat->st_blocks; - libcstat->st_atime = kstat->st_atime; - libcstat->st_mtime = kstat->st_mtime; - libcstat->st_ctime = kstat->st_ctime; -} - diff --git a/libc/sysdeps/linux/common/statfix.h b/libc/sysdeps/linux/common/statfix.h deleted file mode 100644 index af4e67dad..000000000 --- a/libc/sysdeps/linux/common/statfix.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef STATFIX_H -#define STATFIX_H - -#include -#undef __OPTIMIZE__ -#include - -/* Pull in whatever this particular arch's kernel thinks the kernel version of - * * struct stat should look like. It turns out that each arch has a different - * * opinion on the subject, and different kernel revs use different names... */ -#define stat kernel_stat -#define new_stat kernel_stat -#include -#undef new_stat -#undef stat - -/* Now pull in libc's version of stat */ -#define stat libc_stat -#define stat64 libc_stat64 -#define _SYS_STAT_H -#include -#undef stat64 -#undef stat - -extern void __statfix(struct libc_stat *libcstat, struct kernel_stat *kstat); -extern int __fxstat(int version, int fd, struct libc_stat * statbuf); - -#endif diff --git a/libc/sysdeps/linux/common/statfix64.c b/libc/sysdeps/linux/common/statfix64.c deleted file mode 100644 index 1fd017487..000000000 --- a/libc/sysdeps/linux/common/statfix64.c +++ /dev/null @@ -1,52 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* Convert from the kernel's version of struct stat to libc's version - * - * Copyright (C) 2000 by Lineo, inc. and Erik Andersen - * Copyright (C) 2000,2001 by Erik Andersen - * Written by Erik Andersen - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -/* Pull in whatever this particular arch's kernel thinks the kernel version of - * struct stat should look like. It turns out that each arch has a different - * opinion on the subject. Then pull in libc's version of struct stat... */ -#include "statfix64.h" - -#ifdef __UCLIBC_HAVE_LFS__ -#include - -/* Convert from the kernel's version of struct stat to libc's version */ -void __statfix64(struct libc_stat64 *libcstat, struct kernel_stat64 *kstat) -{ - memset(libcstat, 0, sizeof(struct libc_stat64)); - libcstat->st_dev = kstat->st_dev; - libcstat->st_ino = kstat->st_ino; - libcstat->st_mode = kstat->st_mode; - libcstat->st_nlink = kstat->st_nlink; - libcstat->st_uid = kstat->st_uid; - libcstat->st_gid = kstat->st_gid; - libcstat->st_rdev = kstat->st_rdev; - libcstat->st_size = kstat->st_size; - libcstat->st_blksize = kstat->st_blksize; - libcstat->st_blocks = kstat->st_blocks; - libcstat->st_atime = kstat->st_atime; - libcstat->st_mtime = kstat->st_mtime; - libcstat->st_ctime = kstat->st_ctime; -} - -#endif /* __UCLIBC_HAVE_LFS__ */ - diff --git a/libc/sysdeps/linux/common/statfix64.h b/libc/sysdeps/linux/common/statfix64.h deleted file mode 100644 index 415829f67..000000000 --- a/libc/sysdeps/linux/common/statfix64.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef STATFIX_H -#define STATFIX_H - -#include -#undef __OPTIMIZE__ -#include -#include - -#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 -#undef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 64 -#endif -#ifndef __USE_LARGEFILE64 -# define __USE_LARGEFILE64 1 -#endif -/* We absolutely do _NOT_ want interfaces silently - * * * renamed under us or very bad things will happen... */ -#ifdef __USE_FILE_OFFSET64 -# undef __USE_FILE_OFFSET64 -#endif - -#if defined __UCLIBC_HAVE_LFS__ -#if defined __WORDSIZE && (__WORDSIZE >= 64) - -/* 64 bit arch stuff... */ - -/* Pull in whatever this particular arch's kernel thinks the kernel version of - * * struct stat should look like. It turns out that each arch has a different - * * opinion on the subject, and different kernel revs use different names... */ -#define stat kernel_stat64 -#define new_stat kernel_stat64 -#define stat64 kernel_stat64 -#define kernel_stat kernel_stat64 -#include -#undef stat64 -#undef new_stat -#undef stat - - -/* Now pull in libc's version of stat */ -#define stat libc_stat -#define stat64 libc_stat64 -#define _SYS_STAT_H -#include -#undef stat64 -#undef stat - -extern void __statfix64(struct libc_stat64 *libcstat, struct kernel_stat64 *kstat); -extern int __fxstat64(int version, int fd, struct libc_stat64 * statbuf); - -#else - -/* 32 bit arch stuff */ - - -/* Pull in whatever this particular arch's kernel thinks the kernel version of - * * struct stat should look like. It turns out that each arch has a different - * * opinion on the subject, and different kernel revs use different names... */ -#define stat kernel_stat -#define new_stat kernel_stat -#define stat64 kernel_stat64 -#include -#undef stat64 -#undef new_stat -#undef stat - -/* Now pull in libc's version of stat */ -#define stat libc_stat -#define stat64 libc_stat64 -#define _SYS_STAT_H -#include -#undef stat64 -#undef stat - -extern void __statfix64(struct libc_stat64 *libcstat, struct kernel_stat64 *kstat); -extern int __fxstat64(int version, int fd, struct libc_stat64 * statbuf); - - -#endif /* __WORDSIZE */ -#endif /* __UCLIBC_HAVE_LFS__ */ - -#endif diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c index ff7c38478..99684d069 100644 --- a/libc/sysdeps/linux/common/syscalls.c +++ b/libc/sysdeps/linux/common/syscalls.c @@ -156,7 +156,11 @@ time_t time (time_t *t) #endif //#define __NR_mknod 14 -//See mknod.c +#ifdef L_mknod +#include +_syscall3(int, mknod, const char *, path, + unsigned short int, mode, unsigned short int, dev); +#endif //#define __NR_chmod 15 #ifdef L_chmod @@ -942,89 +946,32 @@ _syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value); #endif //#define __NR_stat 106 -#ifdef L___stat +#ifdef L_stat #include -#include "statfix.h" -#define __NR___stat __NR_stat -extern int __stat(const char *file_name, struct kernel_stat *buf); -_syscall2(int, __stat, const char *, file_name, struct kernel_stat *, buf); - -int __xstat(int version, const char * file_name, struct libc_stat * cstat) -{ - struct kernel_stat kstat; - int result = __stat(file_name, &kstat); - - if (result == 0) { - __statfix(cstat, &kstat); - } - return result; -} - -int stat(const char *file_name, struct libc_stat *buf) -{ - return(__xstat(0, file_name, buf)); -} +#include +_syscall2(int, stat, const char *, file_name, struct stat *, buf); #if ! defined __NR_stat64 && defined __UCLIBC_HAVE_LFS__ weak_alias(stat, stat64); -weak_alias(__xstat, __xstat64); #endif #endif //#define __NR_lstat 107 -#ifdef L___lstat +#ifdef L_lstat #include -#include "statfix.h" -#define __NR___lstat __NR_lstat -extern int __lstat(const char *file_name, struct kernel_stat *buf); -_syscall2(int, __lstat, const char *, file_name, struct kernel_stat *, buf); - -int __lxstat(int version, const char * file_name, struct libc_stat * cstat) -{ - struct kernel_stat kstat; - int result = __lstat(file_name, &kstat); - - if (result == 0) { - __statfix(cstat, &kstat); - } - return result; -} - -int lstat(const char *file_name, struct libc_stat *buf) -{ - return(__lxstat(0, file_name, buf)); -} +#include +_syscall2(int, lstat, const char *, file_name, struct stat *, buf); #if ! defined __NR_lstat64 && defined __UCLIBC_HAVE_LFS__ weak_alias(lstat, lstat64); -weak_alias(__lxstat, __lxstat64); #endif #endif //#define __NR_fstat 108 -#ifdef L___fstat +#ifdef L_fstat #include -#include "statfix.h" -#define __NR___fstat __NR_fstat -extern int __fstat(int filedes, struct kernel_stat *buf); -_syscall2(int, __fstat, int, filedes, struct kernel_stat *, buf); - -int __fxstat(int version, int fd, struct libc_stat * cstat) -{ - struct kernel_stat kstat; - int result = __fstat(fd, &kstat); - - if (result == 0) { - __statfix(cstat, &kstat); - } - return result; -} - -int fstat(int filedes, struct libc_stat *buf) -{ - return(__fxstat(0, filedes, buf)); -} +#include +_syscall2(int, fstat, int, filedes, struct stat *, buf); #if ! defined __NR_fstat64 && defined __UCLIBC_HAVE_LFS__ weak_alias(fstat, fstat64); -weak_alias(__fxstat, __fxstat64); #endif #endif @@ -1611,83 +1558,29 @@ int getrlimit (__rlimit_resource_t resource, struct rlimit *rlimits) //#define __NR_stat64 195 -#ifdef L___stat64 +#ifdef L_stat64 #if defined __NR_stat64 && defined __UCLIBC_HAVE_LFS__ #include -#include "statfix64.h" -#define __NR___stat64 __NR_stat64 -extern int __stat64(const char *file_name, struct kernel_stat64 *buf); -_syscall2(int, __stat64, const char *, file_name, struct kernel_stat64 *, buf); - -int __xstat64(int version, const char * file_name, struct libc_stat64 * cstat) -{ - struct kernel_stat64 kstat; - int result = __stat64(file_name, &kstat); - - if (result == 0) { - __statfix64(cstat, &kstat); - } - return result; -} - -int stat64(const char *file_name, struct libc_stat64 *buf) -{ - return(__xstat64(0, file_name, buf)); -} +#include +_syscall2(int, stat64, const char *, file_name, struct stat64 *, buf); #endif /* __UCLIBC_HAVE_LFS__ */ #endif //#define __NR_lstat64 196 -#ifdef L___lstat64 +#ifdef L_lstat64 #if defined __NR_lstat64 && defined __UCLIBC_HAVE_LFS__ #include -#include "statfix64.h" -#define __NR___lstat64 __NR_lstat64 -extern int __lstat64(const char *file_name, struct kernel_stat64 *buf); -_syscall2(int, __lstat64, const char *, file_name, struct kernel_stat64 *, buf); - -int __lxstat64(int version, const char * file_name, struct libc_stat64 * cstat) -{ - struct kernel_stat64 kstat; - int result = __lstat64(file_name, &kstat); - - if (result == 0) { - __statfix64(cstat, &kstat); - } - return result; -} - -int lstat64(const char *file_name, struct libc_stat64 *buf) -{ - return(__lxstat64(0, file_name, buf)); -} +#include +_syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf); #endif /* __UCLIBC_HAVE_LFS__ */ #endif //#define __NR_fstat64 197 -#ifdef L___fstat64 +#ifdef L_fstat64 #if defined __NR_fstat64 && defined __UCLIBC_HAVE_LFS__ #include -#include "statfix64.h" -#define __NR___fstat64 __NR_fstat64 -extern int __fstat64(int filedes, struct kernel_stat64 *buf); -_syscall2(int, __fstat64, int, filedes, struct kernel_stat64 *, buf); - -int __fxstat64(int version, int fd, struct libc_stat64 * cstat) -{ - struct kernel_stat64 kstat; - int result = __fstat64(fd, &kstat); - - if (result == 0) { - __statfix64(cstat, &kstat); - } - return result; -} - -int fstat64(int filedes, struct libc_stat64 *buf) -{ - return(__fxstat64(0, filedes, buf)); -} +#include +_syscall2(int, fstat64, int, filedes, struct stat64 *, buf); #endif /* __UCLIBC_HAVE_LFS__ */ #endif diff --git a/libc/sysdeps/linux/i386/bits/select.h b/libc/sysdeps/linux/i386/bits/select.h index 972bfb685..2892ab556 100644 --- a/libc/sysdeps/linux/i386/bits/select.h +++ b/libc/sysdeps/linux/i386/bits/select.h @@ -20,6 +20,10 @@ # error "Never use directly; include instead." #endif +#undef __FD_ZERO +#undef __FD_SET +#undef __FD_CLR +#undef __FD_ISSET #if defined __GNUC__ && __GNUC__ >= 2 diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h index 213dbe267..d1f729129 100644 --- a/libc/sysdeps/linux/m68k/bits/stat.h +++ b/libc/sysdeps/linux/m68k/bits/stat.h @@ -33,74 +33,18 @@ #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __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; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; -#ifndef __USE_FILE_OFFSET64 - unsigned long int __unused4; - unsigned long int __unused5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - +/* Pull in whatever this particular arch's kernel thinks that struct stat + * should look like. It turns out that each arch has a different opinion + * on the subject, and different kernel revs use different names... */ +#define new_stat stat +#include #ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; - - __ino_t __st_ino; /* 32bit 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; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - __ino64_t st_ino; /* File serial number. */ - }; +# ifdef __USE_FILE_OFFSET64 +# define stat stat64 +# endif #endif + /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV diff --git a/libc/sysdeps/linux/mips/bits/stat.h b/libc/sysdeps/linux/mips/bits/stat.h index c0e6984d1..2fdeabb8e 100644 --- a/libc/sysdeps/linux/mips/bits/stat.h +++ b/libc/sysdeps/linux/mips/bits/stat.h @@ -33,80 +33,18 @@ #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -/* Structure describing file characteristics. */ -struct stat - { - unsigned long int st_dev; - long int st_pad1[3]; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino64_t st_ino; /* File serial number. */ -#endif - __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.*/ - unsigned long int st_rdev; /* Device number, if device. */ -#ifndef __USE_FILE_OFFSET64 - long int st_pad2[2]; - __off_t st_size; /* Size of file, in bytes. */ - /* SVR4 added this extra long to allow for expansion of off_t. */ - long int st_pad3; -#else - long int st_pad2[3]; - __off64_t st_size; /* Size of file, in bytes. */ -#endif - /* - * Actually this should be timestruc_t st_atime, st_mtime and - * st_ctime but we don't have it under Linux. - */ - __time_t st_atime; /* Time of last access. */ - long int __reserved0; - __time_t st_mtime; /* Time of last modification. */ - long int __reserved1; - __time_t st_ctime; /* Time of last status change. */ - long int __reserved2; - __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ -#else - long int st_pad4; - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ -#endif - long int st_pad5[14]; - }; - +/* Pull in whatever this particular arch's kernel thinks that struct stat + * should look like. It turns out that each arch has a different opinion + * on the subject, and different kernel revs use different names... */ +#define new_stat stat +#include #ifdef __USE_LARGEFILE64 -struct stat64 - { - unsigned long int st_dev; - long int st_pad1[3]; - __ino64_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.*/ - unsigned long int st_rdev; /* Device number, if device. */ - long int st_pad2[3]; - __off64_t st_size; /* Size of file, in bytes. */ - /* - * Actually this should be timestruc_t st_atime, st_mtime and - * st_ctime but we don't have it under Linux. - */ - __time_t st_atime; /* Time of last access. */ - long int __reserved0; - __time_t st_mtime; /* Time of last modification. */ - long int __reserved1; - __time_t st_ctime; /* Time of last status change. */ - long int __reserved2; - __blksize_t st_blksize; /* Optimal block size for I/O. */ - long int st_pad3; - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ - long int st_pad4[14]; - }; +# ifdef __USE_FILE_OFFSET64 +# define stat stat64 +# endif #endif + /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV diff --git a/libc/sysdeps/linux/mips/bits/types.h b/libc/sysdeps/linux/mips/bits/types.h index 8a05d1857..f60fb82d8 100644 --- a/libc/sysdeps/linux/mips/bits/types.h +++ b/libc/sysdeps/linux/mips/bits/types.h @@ -71,13 +71,13 @@ typedef __quad_t *__qaddr_t; typedef __kernel_dev_t __dev_t; /* Type of device numbers. */ typedef __kernel_uid_t __uid_t; /* Type of user identifications. */ typedef __kernel_gid_t __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 __kernel_ino_t __ino_t; /* Type of file serial numbers. */ +typedef __kernel_mode_t __mode_t; /* Type of file attribute bitmasks. */ +typedef __kernel_nlink_t __nlink_t; /* Type of file link counts. */ +typedef __kernel_off_t __off_t; /* Type of file sizes and offsets. */ +typedef __kernel_loff_t __loff_t; /* Type of file sizes and offsets. */ +typedef __kernel_pid_t __pid_t; /* Type of process identifications. */ +typedef __kernel_ssize_t __ssize_t; /* Type of a byte count, or error. */ typedef __u_long __rlim_t; /* Type of resource counts. */ typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ typedef __u_int __id_t; /* General type for ID. */ diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h index fa3df6e27..16b15f4bf 100644 --- a/libc/sysdeps/linux/powerpc/bits/stat.h +++ b/libc/sysdeps/linux/powerpc/bits/stat.h @@ -33,68 +33,18 @@ #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -struct stat - { - __dev_t st_dev; /* Device. */ -#ifndef __USE_FILE_OFFSET64 - unsigned short int __pad1; - __ino_t st_ino; /* File serial number. */ -#else - __ino64_t st_ino; /* File serial number. */ -#endif - __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; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ +/* Pull in whatever this particular arch's kernel thinks that struct stat + * should look like. It turns out that each arch has a different opinion + * on the subject, and different kernel revs use different names... */ +#define new_stat stat +#include +#ifdef __USE_LARGEFILE64 +# ifdef __USE_FILE_OFFSET64 +# define stat stat64 +# endif #endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - unsigned long int __unused4; - unsigned long int __unused5; - }; -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_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; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - unsigned long int __unused4; - unsigned long int __unused5; - }; -#endif /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE diff --git a/libc/sysdeps/linux/powerpc/bits/types.h b/libc/sysdeps/linux/powerpc/bits/types.h index 144ffb32a..6aef44901 100644 --- a/libc/sysdeps/linux/powerpc/bits/types.h +++ b/libc/sysdeps/linux/powerpc/bits/types.h @@ -67,18 +67,17 @@ __extension__ typedef unsigned long long int __uint64_t; #endif typedef __quad_t *__qaddr_t; -/* These types are modified from glibc to be - * more compatible with the Linux kernel. */ +/* changed to be more compatible with kernel */ typedef __kernel_dev_t __dev_t; /* Type of device numbers. */ typedef __kernel_uid_t __uid_t; /* Type of user identifications. */ typedef __kernel_gid_t __gid_t; /* Type of group identifications. */ -typedef __u_int __ino_t; /* Type of file serial numbers. */ -typedef __u_int __mode_t; /* Type of file attribute bitmasks. */ -typedef __u_short __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 __kernel_ino_t __ino_t; /* Type of file serial numbers. */ +typedef __kernel_mode_t __mode_t; /* Type of file attribute bitmasks. */ +typedef __kernel_nlink_t __nlink_t; /* Type of file link counts. */ +typedef __kernel_off_t __off_t; /* Type of file sizes and offsets. */ +typedef __kernel_loff_t __loff_t; /* Type of file sizes and offsets. */ +typedef __kernel_pid_t __pid_t; /* Type of process identifications. */ +typedef __kernel_ssize_t __ssize_t; /* Type of a byte count, or error. */ typedef __u_long __rlim_t; /* Type of resource counts. */ typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ typedef __u_int __id_t; /* General type for ID. */ diff --git a/libc/sysdeps/linux/sparc/bits/stat.h b/libc/sysdeps/linux/sparc/bits/stat.h index aefcf9ee1..d1f729129 100644 --- a/libc/sysdeps/linux/sparc/bits/stat.h +++ b/libc/sysdeps/linux/sparc/bits/stat.h @@ -33,72 +33,18 @@ #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -struct stat - { - __dev_t st_dev; /* Device. */ -#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 - unsigned short int __pad1; - __ino_t st_ino; /* File serial number. */ -#else - __ino64_t st_ino; /* File serial number. */ -#endif - __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; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - unsigned long int __unused4; - unsigned long int __unused5; - }; - +/* Pull in whatever this particular arch's kernel thinks that struct stat + * should look like. It turns out that each arch has a different opinion + * on the subject, and different kernel revs use different names... */ +#define new_stat stat +#include #ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ -#if __WORDSIZE == 64 - unsigned short int __pad1; -#endif - __ino64_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; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ - __time_t st_atime; /* Time of last access. */ - unsigned long int __unused1; - __time_t st_mtime; /* Time of last modification. */ - unsigned long int __unused2; - __time_t st_ctime; /* Time of last status change. */ - unsigned long int __unused3; - unsigned long int __unused4; - unsigned long int __unused5; - }; +# ifdef __USE_FILE_OFFSET64 +# define stat stat64 +# endif #endif + /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV diff --git a/libc/sysdeps/linux/sparc/bits/types.h b/libc/sysdeps/linux/sparc/bits/types.h index 1530931b6..5dccfc4cb 100644 --- a/libc/sysdeps/linux/sparc/bits/types.h +++ b/libc/sysdeps/linux/sparc/bits/types.h @@ -78,22 +78,19 @@ __extension__ typedef unsigned long long int __uint64_t; #endif typedef __quad_t *__qaddr_t; +/* changed to be more compatible with kernel */ typedef __kernel_dev_t __dev_t; /* Type of device numbers. */ typedef __kernel_uid_t __uid_t; /* Type of user identifications. */ typedef __kernel_gid_t __gid_t; /* Type of group identifications. */ -typedef __u_long __ino_t; /* Type of file serial numbers. */ +typedef __kernel_ino_t __ino_t; /* Type of file serial numbers. */ +typedef __kernel_mode_t __mode_t; /* Type of file attribute bitmasks. */ +typedef __kernel_nlink_t __nlink_t; /* Type of file link counts. */ +typedef __kernel_off_t __off_t; /* Type of file sizes and offsets. */ +typedef __kernel_loff_t __loff_t; /* Type of file sizes and offsets. */ +typedef __kernel_pid_t __pid_t; /* Type of process identifications. */ +typedef __kernel_ssize_t __ssize_t; /* Type of a byte count, or error. */ typedef __u_quad_t __ino64_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 __off64_t; /* "" (LFS) */ -typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ -typedef int __pid_t; /* Type of process identifications. */ -#if __WORDSIZE == 64 -typedef long int __ssize_t; /* Type of a byte count, or error. */ -#else -typedef int __ssize_t; /* Type of a byte count, or error. */ -#endif typedef __u_long __rlim_t; /* Type of resource counts. */ typedef __u_quad_t __rlim64_t; /* Type of resource counts (LFS). */ typedef __u_int __id_t; /* General type for IDs. */ -- cgit v1.2.3