aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-05-19 19:10:13 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-05-19 19:10:13 +0000
commitdc2a97c6eda5fd6ed87b15f7eda3c923260cdee1 (patch)
treebe273bec7507f703922ddafa9c9071d1f0ffdd0e
parent21ed706977cedab44cc7edd99bc7a6da53a5a4f0 (diff)
downloadglibc-dc2a97c6eda5fd6ed87b15f7eda3c923260cdee1.tar.xz
glibc-dc2a97c6eda5fd6ed87b15f7eda3c923260cdee1.zip
Clean up MIPS ftruncate64/truncate64.
-rw-r--r--ChangeLog.mips25
-rw-r--r--sysdeps/unix/sysv/linux/mips/ftruncate64.c75
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/ftruncate64.c36
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/truncate64.c36
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/ftruncate64.c (renamed from sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c)0
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/truncate64.c (renamed from sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c)0
-rw-r--r--sysdeps/unix/sysv/linux/mips/truncate64.c75
9 files changed, 100 insertions, 152 deletions
diff --git a/ChangeLog.mips b/ChangeLog.mips
index db16b4bc41..b5fdbda7e4 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,3 +1,28 @@
+2012-05-19 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/mips/ftruncate64.c: Move to ...
+ * sysdeps/unix/sysv/linux/mips/mips32/ftruncate64.c: ... here.
+ (kernel-features.h): Don't include.
+ [__NR_ftruncate64]: Make code unconditional.
+ [!__NR_ftruncate64]: Remove conditional code.
+ [!__ASSUME_TRUNCATE64_SYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/mips/truncate64.c: Move to ...
+ * sysdeps/unix/sysv/linux/mips/mips32/truncate64.c: ... here.
+ (kernel-features.h): Don't include.
+ [__NR_truncate64]: Make code unconditional.
+ [!__NR_truncate64]: Remove conditional code.
+ [!__ASSUME_TRUNCATE64_SYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (ftruncate):
+ Add syscall.
+ (truncate): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+ (ftruncate): Remove syscall.
+ (truncate): Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c: Move to ...
+ * sysdeps/unix/sysv/linux/mips/mips64/ftruncate64.c: ... here.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c: Move to ...
+ * sysdeps/unix/sysv/linux/mips/mips64/truncate64.c: ... here.
+
2012-05-16 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/bits/stat.h (struct stat)
diff --git a/sysdeps/unix/sysv/linux/mips/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/ftruncate64.c
deleted file mode 100644
index 982650c87f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ftruncate64.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005,2006
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_ftruncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls. */
-extern int __have_no_truncate64;
-#endif
-
-/* Truncate the file FD refers to to LENGTH bytes. */
-int
-__ftruncate64 (int fd, off64_t length)
-{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! __have_no_truncate64)
-#endif
- {
- unsigned int low = length & 0xffffffff;
- unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- int saved_errno = errno;
-#endif
- int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
- __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (result != -1 || errno != ENOSYS)
-#endif
- return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- __set_errno (saved_errno);
- __have_no_truncate64 = 1;
-#endif
- }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if ((off_t) length != length)
- {
- __set_errno (EINVAL);
- return -1;
- }
- return __ftruncate (fd, (off_t) length);
-#endif
-}
-weak_alias (__ftruncate64, ftruncate64)
-
-#else
-/* Use the generic implementation. */
-# include <misc/ftruncate64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/mips32/ftruncate64.c
new file mode 100644
index 0000000000..9838182c39
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips32/ftruncate64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997-2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <endian.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Truncate the file FD refers to to LENGTH bytes. */
+int
+__ftruncate64 (int fd, off64_t length)
+{
+ unsigned int low = length & 0xffffffff;
+ unsigned int high = length >> 32;
+ int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
+ __LONG_LONG_PAIR (high, low));
+ return result;
+}
+weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c b/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c
new file mode 100644
index 0000000000..3fad93f50e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips32/truncate64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997-2012 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <endian.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+/* Truncate the file FD refers to to LENGTH bytes. */
+int
+truncate64 (const char *path, off64_t length)
+{
+ unsigned int low = length & 0xffffffff;
+ unsigned int high = length >> 32;
+ int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
+ __LONG_LONG_PAIR (high, low));
+ return result;
+}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/mips64/ftruncate64.c
index 6e25b021ab..6e25b021ab 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/ftruncate64.c
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
index 0d37a9b48d..7ad55231f6 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
@@ -2,8 +2,6 @@
readahead - readahead i:iii __readahead readahead
sync_file_range - sync_file_range Ci:iiii sync_file_range
-ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64
-truncate - truncate i:si truncate truncate64
prlimit64 EXTRA prlimit64 i:iipp prlimit64
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
index cac273cc90..867323a96b 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
@@ -2,6 +2,9 @@
lseek - lseek Ci:iii __libc_lseek __lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64
+ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64
+truncate - truncate i:si truncate truncate64
+
# Semaphore and shm system calls. msgctl, shmctl, and semctl have C
# wrappers (to set __IPC_64).
msgget - msgget i:ii __msgget msgget
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c b/sysdeps/unix/sysv/linux/mips/mips64/truncate64.c
index 6e25b021ab..6e25b021ab 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/truncate64.c
diff --git a/sysdeps/unix/sysv/linux/mips/truncate64.c b/sysdeps/unix/sysv/linux/mips/truncate64.c
deleted file mode 100644
index 7c11b63f59..0000000000
--- a/sysdeps/unix/sysv/linux/mips/truncate64.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003,2005,2006
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/types.h>
-#include <endian.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_truncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls. */
-int __have_no_truncate64;
-#endif
-
-/* Truncate the file FD refers to to LENGTH bytes. */
-int
-truncate64 (const char *path, off64_t length)
-{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (! __have_no_truncate64)
-#endif
- {
- unsigned int low = length & 0xffffffff;
- unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- int saved_errno = errno;
-#endif
- int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
- __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if (result != -1 || errno != ENOSYS)
-#endif
- return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- __set_errno (saved_errno);
- __have_no_truncate64 = 1;
-#endif
- }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if ((off_t) length != length)
- {
- __set_errno (EINVAL);
- return -1;
- }
- return truncate (path, (off_t) length);
-#endif
-}
-
-#else
-/* Use the generic implementation. */
-# include <misc/truncate64.c>
-#endif