From 743f1874ad67aa2f1b734be1ee752f5935da5eb2 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sat, 5 Apr 2003 19:57:35 +0000 Subject: * sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c: New. * sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c: New. * sysdeps/unix/sysv/linux/kernel-features.h: fcntl64 is available on mips n32. * sysdeps/unix/sysv/linux/mips/kernel_stat.h: Explain why XSTAT_IS_XSTAT64 must not be used for mips n64. Use 64-bit data structure on n32 as well. * sysdeps/unix/sysv/linux/mips/bits/stat.h: Use POSIX-compliant data types on n32 and n64. 2003-04-05 Alexandre Oliva * sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c: New. * sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c: New. * sysdeps/unix/sysv/linux/kernel-features.h: fcntl64 is available on mips n32. * sysdeps/unix/sysv/linux/mips/kernel_stat.h: Explain why XSTAT_IS_XSTAT64 must not be used for mips n64. Use 64-bit data structure on n32 as well. * sysdeps/unix/sysv/linux/mips/bits/stat.h: Use POSIX-compliant data types on n32 and n64. --- sysdeps/unix/sysv/linux/kernel-features.h | 4 ++ sysdeps/unix/sysv/linux/mips/bits/stat.h | 69 +++++++++++++++++++++- sysdeps/unix/sysv/linux/mips/kernel_stat.h | 13 ++-- .../unix/sysv/linux/mips/mips64/n32/ftruncate64.c | 28 +++++++++ .../unix/sysv/linux/mips/mips64/n32/truncate64.c | 30 ++++++++++ 5 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index b016b6c077..168715e665 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -248,6 +248,10 @@ # define __ASSUME_GETDENTS64_SYSCALL 1 #endif +#if defined __mips__ && defined _ABIN32 && _MIPS_SIM == _ABIN32 +# define __ASSUME_FCNTL64 1 +#endif + /* The late 2.5 kernels saw a lot of new CLONE_* flags. Summarize their availability with one define. The changes were made first for i386 and the have to be done separately for the other archs. diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h index c0e6984d11..c3819d3981 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/stat.h +++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003 + 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,6 +34,7 @@ #define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ +#if _MIPS_SIM == _MIPS_SIM_ABI32 /* Structure describing file characteristics. */ struct stat { @@ -106,6 +108,71 @@ struct stat64 long int st_pad4[14]; }; #endif +#else +struct stat + { + __dev_t st_dev; + int st_pad1[3]; /* Reserved for st_dev expansion */ +#ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; +#else + __ino64_t st_ino; +#endif + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; +#if !defined __USE_FILE_OFFSET64 + unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */ + __off_t st_size; + int st_pad3; +#else + unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ + __off64_t st_size; +#endif + __time_t st_atime; + int __reserved0; + __time_t st_mtime; + int __reserved1; + __time_t st_ctime; + int __reserved2; + __blksize_t st_blksize; + unsigned int st_pad4; +#ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; +#else + __blkcnt64_t st_blocks; +#endif + int st_pad5[14]; + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; + unsigned int st_pad1[3]; /* Reserved for st_dev expansion */ + __ino64_t st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ + __off64_t st_size; + __time_t st_atime; + int __reserved0; + __time_t st_mtime; + int __reserved1; + __time_t st_ctime; + int __reserved2; + __blksize_t st_blksize; + unsigned int st_pad3; + __blkcnt64_t st_blocks; + int st_pad4[14]; +}; +#endif +#endif /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h index b5fcd008b0..3f1bce57c5 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h @@ -1,17 +1,20 @@ -/* Definition of `struct stat' used in the kernel.. */ -#if defined _ABI64 && _MIPS_SIM == _ABI64 +/* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the + userland data structures are not identical, because of different + padding. */ +/* Definition of `struct stat' used in the kernel. */ +#if _MIPS_SIM != _MIPS_SIM_ABI32 struct kernel_stat { unsigned int st_dev; unsigned int __pad1[3]; - unsigned long st_ino; + unsigned long long st_ino; unsigned int st_mode; unsigned int st_nlink; int st_uid; int st_gid; unsigned int st_rdev; unsigned int __pad2[3]; - long st_size; + long long st_size; unsigned int st_atime; unsigned int __unused1; unsigned int st_mtime; @@ -20,7 +23,7 @@ struct kernel_stat unsigned int __unused3; unsigned int st_blksize; unsigned int __pad3; - unsigned long st_blocks; + unsigned long long st_blocks; }; #else struct kernel_stat diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c new file mode 100644 index 0000000000..42efcba315 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2003 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include + +extern int ftruncate (int fd, off64_t length); + +int __ftruncate64 (int fd, off64_t length) { + return ftruncate (fd, length); +} +weak_alias (__ftruncate64, ftruncate64) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c new file mode 100644 index 0000000000..339023f14f --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c @@ -0,0 +1,30 @@ +/* Copyright (C) 2003 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include +#include + +extern int truncate (const char *__unbounded path, int dummy, + off64_t length); + +int truncate64 (const char *__unbounded path, int dummy, + off64_t length) { + return truncate (path, dummy, length); +} -- cgit 1.4.1