This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.25-314-g31073a5
- From: azanella at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 11 May 2017 20:29:50 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.25-314-g31073a5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 31073a53d8ff1e8bac53e34cb626dae5aa6ce69c (commit)
via 488e08b600416ef96d8148fe5239a6387555b1eb (commit)
via 679e979bf337ae0c493ee0f77ff43ee06fdc301b (commit)
via dfaaee33ba68372e374c14ec05fc8a76bdccdceb (commit)
via f6a191a6ee0313d61dffa70d86b033c5a598f907 (commit)
via cab6e5af9d51d4398522af782e20c743daf37461 (commit)
via b41152d716ee9c5ba34495a54e64ea2b732139b5 (commit)
via 0f01acb340a0544cb0bc5953e81455c68859946e (commit)
from e4252e5c5325490742c7ee504345e50a8cd07f35 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=31073a53d8ff1e8bac53e34cb626dae5aa6ce69c
commit 31073a53d8ff1e8bac53e34cb626dae5aa6ce69c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon May 8 11:22:20 2017 -0300
powerpc: Fix signal handling in backtrace
Now with read consolidation which uses SYSCALL_CANCEL macro, a frame
pointer is created in the syscall code and this makes the powerpc
backtrace obtain a bogus entry for the signal handling patch.
It is because it does not setup the correct frame pointer register
(r1) based on the saved value from the kernel sigreturn. It was not
failing because the syscall frame pointer register was the same one
for the next frame (the function that actually called the syscall).
This patch fixes it by setup the next stack frame using the saved
one by the kernel sigreturn. It fixes tst-backtrace{5,6} from
the read consolidation patch.
Checked on powerpc-linux-gnu and powerpc64le-linux-gnu.
* sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address): Use
void* for argument type and use VDSO_SYMBOL macro.
(is_sigtramp_address_rt): Likewise.
(__backtrace): Setup expected frame pointer address for signal
handling.
* sysdeps/powerpc/powerpc64/backtrace.c (is_sigtramp_address): Use
void* for argumetn type and use VSDO_SYMBOL macro.
(__backtrace): Setup expected frame pointer address for signal
handling.
diff --git a/ChangeLog b/ChangeLog
index ca31057..8d2cfed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address): Use
+ void* for argument type and use VDSO_SYMBOL macro.
+ (is_sigtramp_address_rt): Likewise.
+ (__backtrace): Setup expected frame pointer address for signal
+ handling.
+ * sysdeps/powerpc/powerpc64/backtrace.c (is_sigtramp_address): Use
+ void* for argumetn type and use VSDO_SYMBOL macro.
+ (__backtrace): Setup expected frame pointer address for signal
+ handling.
+
* sysdeps/unix/sysv/linux/writev.c: New file.
* sysdeps/unix/sysv/linux/readv.c: New file.
diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c
index b60ac32..3940621 100644
--- a/sysdeps/powerpc/powerpc32/backtrace.c
+++ b/sysdeps/powerpc/powerpc32/backtrace.c
@@ -52,10 +52,10 @@ struct signal_frame_32 {
};
static inline int
-is_sigtramp_address (unsigned int nip)
+is_sigtramp_address (void *nip)
{
#ifdef SHARED
- if (nip == (unsigned int)__vdso_sigtramp32)
+ if (nip == VDSO_SYMBOL (sigtramp32))
return 1;
#endif
return 0;
@@ -69,10 +69,10 @@ struct rt_signal_frame_32 {
};
static inline int
-is_sigtramp_address_rt (unsigned int nip)
+is_sigtramp_address_rt (void * nip)
{
#ifdef SHARED
- if (nip == (unsigned int)__vdso_sigtramp_rt32)
+ if (nip == VDSO_SYMBOL (sigtramp_rt32))
return 1;
#endif
return 0;
@@ -100,20 +100,23 @@ __backtrace (void **array, int size)
/* Check if the symbol is the signal trampoline and get the interrupted
* symbol address from the trampoline saved area. */
- if (is_sigtramp_address ((unsigned int)current->return_address))
+ if (is_sigtramp_address (current->return_address))
{
struct signal_frame_32 *sigframe =
(struct signal_frame_32*) current;
gregset = &sigframe->mctx.gregs;
}
- else if (is_sigtramp_address_rt ((unsigned int)current->return_address))
+ else if (is_sigtramp_address_rt (current->return_address))
{
struct rt_signal_frame_32 *sigframe =
(struct rt_signal_frame_32*) current;
gregset = &sigframe->uc.uc_mcontext.uc_regs->gregs;
}
if (gregset)
- array[++count] = (void*)((*gregset)[PT_NIP]);
+ {
+ array[++count] = (void*)((*gregset)[PT_NIP]);
+ current = (void*)((*gregset)[PT_R1]);
+ }
}
/* It's possible the second-last stack frame can't return
diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c
index 83b963e..723948d 100644
--- a/sysdeps/powerpc/powerpc64/backtrace.c
+++ b/sysdeps/powerpc/powerpc64/backtrace.c
@@ -16,10 +16,12 @@
License along with the GNU C Library; see the file COPYING.LIB. If
not, see <http://www.gnu.org/licenses/>. */
-#include <execinfo.h>
#include <stddef.h>
#include <string.h>
#include <signal.h>
+#include <stdint.h>
+
+#include <execinfo.h>
#include <libc-vdso.h>
/* This is the stack layout we see with every stack frame.
@@ -37,7 +39,7 @@
struct layout
{
struct layout *next;
- long condition_register;
+ long int condition_register;
void *return_address;
};
@@ -47,16 +49,16 @@ struct layout
dummy frame to make it look like it has a caller. */
struct signal_frame_64 {
#define SIGNAL_FRAMESIZE 128
- char dummy[SIGNAL_FRAMESIZE];
+ char dummy[SIGNAL_FRAMESIZE];
struct ucontext uc;
/* We don't care about the rest, since the IP value is at 'uc' field. */
};
static inline int
-is_sigtramp_address (unsigned long nip)
+is_sigtramp_address (void *nip)
{
#ifdef SHARED
- if (nip == (unsigned long)__vdso_sigtramp_rt64)
+ if (nip == VDSO_SYMBOL (sigtramp_rt64))
return 1;
#endif
return 0;
@@ -82,10 +84,11 @@ __backtrace (void **array, int size)
/* Check if the symbol is the signal trampoline and get the interrupted
* symbol address from the trampoline saved area. */
- if (is_sigtramp_address ((unsigned long)current->return_address))
+ if (is_sigtramp_address (current->return_address))
{
struct signal_frame_64 *sigframe = (struct signal_frame_64*) current;
- array[++count] = (void*)sigframe->uc.uc_mcontext.gp_regs[PT_NIP];
+ array[++count] = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_NIP];
+ current = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_R1];
}
}
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=488e08b600416ef96d8148fe5239a6387555b1eb
commit 488e08b600416ef96d8148fe5239a6387555b1eb
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Nov 3 10:33:52 2015 -0200
Consolidate Linux writev implementation
This patch consolidates the writev Linux syscall implementation on
sysdeps/unix/sysv/linux/writev.c.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
* sysdeps/unix/sysv/linux/writev.c: New file.
diff --git a/ChangeLog b/ChangeLog
index 3bf0aa1..ca31057 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/writev.c: New file.
+
* sysdeps/unix/sysv/linux/readv.c: New file.
* include/unistd.h (write): Add hidden proto.
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
new file mode 100644
index 0000000..1b56cbb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -0,0 +1,27 @@
+/* Linux writev syscall implementation.
+ Copyright (C) 2017 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 <unistd.h>
+#include <sysdep-cancel.h>
+
+ssize_t
+__writev (int fd, const struct iovec *iov, int iovcnt)
+{
+ return SYSCALL_CANCEL (writev, fd, iov, iovcnt);
+}
+weak_alias (__writev, writev)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=679e979bf337ae0c493ee0f77ff43ee06fdc301b
commit 679e979bf337ae0c493ee0f77ff43ee06fdc301b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Nov 3 10:26:18 2015 -0200
Consolidate Linux readv implementation
This patch consolidates the readv Linux syscall implementation on
sysdeps/unix/sysv/linux/readv.c.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
* sysdeps/unix/sysv/linux/readv.c: New file.
diff --git a/ChangeLog b/ChangeLog
index 1919346..3bf0aa1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/readv.c: New file.
+
* include/unistd.h (write): Add hidden proto.
* io/Makefile (CFLAGS-write.c): New define.
* nptl/Makefile (CFLAGS-write.c): Likewise.
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
new file mode 100644
index 0000000..142a0a9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -0,0 +1,27 @@
+/* Linux implementation for readv syscall.
+ Copyright (C) 2017 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 <unistd.h>
+#include <sysdep-cancel.h>
+
+ssize_t
+__readv (int fd, const struct iovec *iov, int iovcnt)
+{
+ return SYSCALL_CANCEL (readv, fd, iov, iovcnt);
+}
+weak_alias (__readv, readv)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=dfaaee33ba68372e374c14ec05fc8a76bdccdceb
commit dfaaee33ba68372e374c14ec05fc8a76bdccdceb
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Nov 3 10:04:25 2015 -0200
Consolidate Linux write syscall
This patch consolidates the write Linux syscall implementation on
sysdeps/unix/sysv/linux/write.c.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
* include/unistd.h (write): Add hidden proto.
* io/Makefile (CFLAGS-write.c): New rule.
* nptl/Makefile (CFLAGS-write.c): Likewise.
* sysdeps/unix/sysv/linux/write.c: New file.
diff --git a/ChangeLog b/ChangeLog
index 1101834..1919346 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * include/unistd.h (write): Add hidden proto.
+ * io/Makefile (CFLAGS-write.c): New define.
+ * nptl/Makefile (CFLAGS-write.c): Likewise.
+ * sysdeps/unix/sysv/linux/write.c: New file.
+
[BZ #21428]
* include/unistd.h (read): Add hidden proto.
* io/Makefile (CFLAGS-read.c): New define.
diff --git a/include/unistd.h b/include/unistd.h
index 01556d3..0cdf06e 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -56,6 +56,7 @@ libc_hidden_proto (__libc_read)
libc_hidden_proto (read)
extern ssize_t __libc_write (int __fd, const void *__buf, size_t __n);
libc_hidden_proto (__libc_write)
+libc_hidden_proto (write)
extern int __pipe (int __pipedes[2]);
libc_hidden_proto (__pipe)
extern int __pipe2 (int __pipedes[2], int __flags);
diff --git a/io/Makefile b/io/Makefile
index db14c0d..16365e5 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -101,6 +101,7 @@ CFLAGS-fallocate.c = -fexceptions
CFLAGS-fallocate64.c = -fexceptions
CFLAGS-sync_file_range.c = -fexceptions
CFLAGS-read.c = -fexceptions
+CFLAGS-write.c = -fexceptions
CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE
diff --git a/nptl/Makefile b/nptl/Makefile
index faabd45..5b34b5c 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -215,6 +215,7 @@ CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pt-system.c = -fexceptions
diff --git a/sysdeps/unix/sysv/linux/write.c b/sysdeps/unix/sysv/linux/write.c
new file mode 100644
index 0000000..d495145
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/write.c
@@ -0,0 +1,33 @@
+/* Linux write syscall implementation.
+ Copyright (C) 2017 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 <unistd.h>
+#include <sysdep-cancel.h>
+
+/* Write NBYTES of BUF to FD. Return the number written, or -1. */
+ssize_t
+__libc_write (int fd, const void *buf, size_t nbytes)
+{
+ return SYSCALL_CANCEL (write, fd, buf, nbytes);
+}
+libc_hidden_def (__libc_write)
+
+weak_alias (__libc_write, __write)
+libc_hidden_weak (__write)
+weak_alias (__libc_write, write)
+libc_hidden_weak (write)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f6a191a6ee0313d61dffa70d86b033c5a598f907
commit f6a191a6ee0313d61dffa70d86b033c5a598f907
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Nov 3 10:13:18 2015 -0200
Consolidate Linux read syscall
This patch consolidates the read Linux syscall implementation on
sysdeps/unix/sysv/linux/read.c. This leads to a different frame
pointer creation on some architectures:
* It fixes BZ#21428 on aarch64, since now the returned address
for the read syscall can be correctly found out by
backtrace_symbols.
* It makes tst-backtrace{5,6} fails on powerpc due an issue on
its custom backtrace implementation. It is fixed on subsequent
patch from this set.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
[BZ #21428]
* include/unistd.h (read): Add hidden proto.
* io/Makefile (CFLAGS-read.c): New rule.
* nptl/Makefile (CFLAGS-read.c): New rule.
* sysdeps/unix/sysv/linux/read.c: New file.
diff --git a/ChangeLog b/ChangeLog
index a924f87..1101834 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ [BZ #21428]
+ * include/unistd.h (read): Add hidden proto.
+ * io/Makefile (CFLAGS-read.c): New define.
+ * nptl/Makefile (CFLAGS-read.c): Likewise.
+ * sysdeps/unix/sysv/linux/read.c: New file.
+
* io/Makefile (CFLAGS-creat.c): New rule.
(CFLAGS-creat64.c): Likewise.
* sysdeps/unix/sysv/linux/alpha/creat.c: Remove file.
diff --git a/include/unistd.h b/include/unistd.h
index f36759b..01556d3 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -53,6 +53,7 @@ extern ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __n,
__off64_t __offset) attribute_hidden;
extern ssize_t __libc_read (int __fd, void *__buf, size_t __n);
libc_hidden_proto (__libc_read)
+libc_hidden_proto (read)
extern ssize_t __libc_write (int __fd, const void *__buf, size_t __n);
libc_hidden_proto (__libc_write)
extern int __pipe (int __pipedes[2]);
diff --git a/io/Makefile b/io/Makefile
index 8b1c250..db14c0d 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -100,6 +100,7 @@ CFLAGS-posix_fallocate64.c = -fexceptions
CFLAGS-fallocate.c = -fexceptions
CFLAGS-fallocate64.c = -fexceptions
CFLAGS-sync_file_range.c = -fexceptions
+CFLAGS-read.c = -fexceptions
CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE
diff --git a/nptl/Makefile b/nptl/Makefile
index 8251ac4..faabd45 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -214,6 +214,7 @@ CFLAGS-recvfrom.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pt-system.c = -fexceptions
diff --git a/sysdeps/unix/sysv/linux/read.c b/sysdeps/unix/sysv/linux/read.c
new file mode 100644
index 0000000..2a02c1b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/read.c
@@ -0,0 +1,33 @@
+/* Linux read syscall implementation.
+ Copyright (C) 2017 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 <unistd.h>
+#include <sysdep-cancel.h>
+
+/* Read NBYTES into BUF from FD. Return the number read or -1. */
+ssize_t
+__libc_read (int fd, void *buf, size_t nbytes)
+{
+ return SYSCALL_CANCEL (read, fd, buf, nbytes);
+}
+libc_hidden_def (__libc_read)
+
+libc_hidden_def (__read)
+weak_alias (__libc_read, __read)
+libc_hidden_def (read)
+weak_alias (__libc_read, read)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=cab6e5af9d51d4398522af782e20c743daf37461
commit cab6e5af9d51d4398522af782e20c743daf37461
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Fri Nov 11 14:50:03 2016 -0200
Consolidate Linux creat implementation
This patch consolidates the creat Linux syscall implementation on
sysdeps/unix/sysv/linux/creat{64}.c. The changes are:
1. Remove creat{64} from auto-generation syscalls.list.
2. Add a new creat{64}.c implementation. For architectures that
define __OFF_T_MATCHES_OFF64_T the default creat64 will create
alias to required creat symbols.
3. Use __NR_creat where possible, otherwise use internal open{64}
call with expected flags.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
* io/Makefile (CFLAGS-creat.c): New rule.
(CFLAGS-creat64.c): Likewise.
* sysdeps/unix/sysv/linux/alpha/creat.c: Remove file.
* sysdeps/unix/sysv/linux/generic/creat.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/creat64.c: Likewise.
* sysdeps/unix/sysv/linux/creat.c: New file.
* sysdeps/unix/sysv/linux/creat64.c: Likewise.
* sysdeps/unix/sysv/linux/syscalls.list: Remove create from
auto-generated list.
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
diff --git a/ChangeLog b/ChangeLog
index 0431df8..a924f87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * io/Makefile (CFLAGS-creat.c): New rule.
+ (CFLAGS-creat64.c): Likewise.
+ * sysdeps/unix/sysv/linux/alpha/creat.c: Remove file.
+ * sysdeps/unix/sysv/linux/generic/creat.c: Likewise.
+ * sysdeps/unix/sysv/linux/wordsize-64/creat64.c: Likewise.
+ * sysdeps/unix/sysv/linux/creat.c: New file.
+ * sysdeps/unix/sysv/linux/creat64.c: Likewise.
+ * sysdeps/unix/sysv/linux/syscalls.list: Remove create from
+ auto-generated list.
+ * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
+
* sysdeps/unix/sysv/linux/generic/open.c: Remove file.
* sysdeps/unix/sysv/linux/generic/open64.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/open64.c: Likewise.
diff --git a/io/Makefile b/io/Makefile
index 95e04b2..8b1c250 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -80,6 +80,8 @@ include ../Rules
CFLAGS-open.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-open64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-creat.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-creat64.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-poll.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-ppoll.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/sysdeps/unix/sysv/linux/alpha/creat.c b/sysdeps/unix/sysv/linux/alpha/creat.c
deleted file mode 100644
index 7a5afed..0000000
--- a/sysdeps/unix/sysv/linux/alpha/creat.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list defines creat and
- creat64 for most linux targets, but on alpha creat is not a syscall.
- If we do nothing, we'll wind up with creat64 being undefined, because
- the syscalls.list assumes the creat->creat64 alias was created. We
- could have overridden that with a create64.c, but we might as well do
- the right thing and set up creat64 as an alias. */
-#include <io/creat.c>
-weak_alias(creat, creat64)
diff --git a/sysdeps/unix/sysv/linux/generic/creat.c b/sysdeps/unix/sysv/linux/creat.c
similarity index 77%
copy from sysdeps/unix/sysv/linux/generic/creat.c
copy to sysdeps/unix/sysv/linux/creat.c
index 34cb210..31e0248 100644
--- a/sysdeps/unix/sysv/linux/generic/creat.c
+++ b/sysdeps/unix/sysv/linux/creat.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
+/* Linux default implementation for creat.
+ Copyright (C) 2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,20 +18,23 @@
#include <fcntl.h>
#include <sys/types.h>
+
#include <sysdep-cancel.h>
-#undef creat
+#ifndef __OFF_T_MATCHES_OFF64_T
/* Create FILE with protections MODE. */
int
-creat (const char *file, mode_t mode)
+__creat (const char *file, mode_t mode)
{
+# ifdef __NR_creat
+ return SYSCALL_CANCEL (creat, file, mode);
+# else
return __open (file, O_WRONLY | O_CREAT | O_TRUNC, mode);
+# endif
}
+weak_alias (__creat, creat)
-/* __open handles cancellation. */
LIBC_CANCEL_HANDLED ();
-#if __WORDSIZE == 64
-weak_alias (creat, creat64)
#endif
diff --git a/sysdeps/unix/sysv/linux/generic/creat.c b/sysdeps/unix/sysv/linux/creat64.c
similarity index 64%
rename from sysdeps/unix/sysv/linux/generic/creat.c
rename to sysdeps/unix/sysv/linux/creat64.c
index 34cb210..709c660 100644
--- a/sysdeps/unix/sysv/linux/generic/creat.c
+++ b/sysdeps/unix/sysv/linux/creat64.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
+/* Linux default implementation for LFS creat.
+ Copyright (C) 2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,18 +20,22 @@
#include <sys/types.h>
#include <sysdep-cancel.h>
-#undef creat
-
/* Create FILE with protections MODE. */
int
-creat (const char *file, mode_t mode)
+__creat64 (const char *file, mode_t mode)
{
- return __open (file, O_WRONLY | O_CREAT | O_TRUNC, mode);
+#if defined __OFF_T_MATCHES_OFF64_T && defined __NR_creat
+ return SYSCALL_CANCEL (creat, file, mode);
+#else
+ /* We need to pass O_LARGEFILE. */
+ return __open64 (file, O_WRONLY | O_CREAT | O_TRUNC, mode);
+#endif
}
+weak_alias (__creat64, creat64)
-/* __open handles cancellation. */
-LIBC_CANCEL_HANDLED ();
-
-#if __WORDSIZE == 64
-weak_alias (creat, creat64)
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (__creat64, __creat)
+weak_alias (__creat64, creat)
#endif
+
+LIBC_CANCEL_HANDLED ();
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 1a10903..f4abf3e 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -6,7 +6,6 @@ bdflush EXTRA bdflush i:ii __compat_bdflush bdflush@GLIBC_2.0:GLIBC_2.23
capget EXTRA capget i:pp capget
capset EXTRA capset i:pp capset
clock_adjtime EXTRA clock_adjtime i:ip clock_adjtime
-creat - creat Ci:si creat
create_module EXTRA create_module 3 __compat_create_module create_module@GLIBC_2.0:GLIBC_2.23
delete_module EXTRA delete_module 3 delete_module
epoll_create EXTRA epoll_create i:i epoll_create
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/creat64.c b/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
deleted file mode 100644
index c106e2b..0000000
--- a/sysdeps/unix/sysv/linux/wordsize-64/creat64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Defined as alias for the syscall. */
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 6549ed8..5c78677 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -5,7 +5,6 @@ statfs - statfs i:sp __statfs statfs statfs64
readahead - readahead i:iii __readahead readahead
sendfile - sendfile i:iipi sendfile sendfile64
sync_file_range - sync_file_range Ci:iiii sync_file_range
-creat - creat Ci:si creat creat64
prlimit EXTRA prlimit64 i:iipp prlimit prlimit64
fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b41152d716ee9c5ba34495a54e64ea2b732139b5
commit b41152d716ee9c5ba34495a54e64ea2b732139b5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Fri Nov 11 15:00:03 2016 -0200
Consolidate Linux open implementation
This patch consolidates the open Linux syscall implementation on
sysdeps/unix/sysv/linux/open{64}.c. The changes are:
1. Remove open{64} from auto-generation syscalls.list.
2. Add a new open{64}.c implementation. For architectures that
define __OFF_T_MATCHES_OFF64_T the default open64 will create
alias to required open symbols.
3. Use __NR_openat as default syscall for open{64}.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
* sysdeps/unix/sysv/linux/generic/open.c: Remove file.
* sysdeps/unix/sysv/linux/generic/open64.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/open64.c: Likewise.
* sysdeps/unix/sysv/linux/open.c: New file.
* sysdeps/unix/sysv/linux/open64.c (__libc_open64): Use O_LARGEFILE
only for __OFF_T_MATCHES_OFF64_T and add alias to open if the case.
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove open
from auto-generated list.
diff --git a/ChangeLog b/ChangeLog
index cc843be..0431df8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/generic/open.c: Remove file.
+ * sysdeps/unix/sysv/linux/generic/open64.c: Likewise.
+ * sysdeps/unix/sysv/linux/wordsize-64/open64.c: Likewise.
+ * sysdeps/unix/sysv/linux/open.c: New file.
+ * sysdeps/unix/sysv/linux/open64.c (__libc_open64): Define symbol
+ iff __WORDSIZE != 64 and use __NR_openat when available.
+ * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove open
+ from auto-generated list.
+
* nptl/Makefile (CFLAGS-close.c): New flag.
* sysdeps/unix/sysv/linux/close.c: New file.
diff --git a/sysdeps/unix/sysv/linux/generic/open64.c b/sysdeps/unix/sysv/linux/generic/open64.c
deleted file mode 100644
index 88312a1..0000000
--- a/sysdeps/unix/sysv/linux/generic/open64.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-
- 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 <errno.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <sysdep-cancel.h>
-
-/* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG,
- a third argument is the file protection. */
-int
-__libc_open64 (const char *file, int oflag, ...)
-{
- int mode = 0;
-
- if (__OPEN_NEEDS_MODE (oflag))
- {
- va_list arg;
- va_start (arg, oflag);
- mode = va_arg (arg, int);
- va_end (arg);
- }
-
- return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | O_LARGEFILE, mode);
-}
-weak_alias (__libc_open64, __open64)
-libc_hidden_weak (__open64)
-weak_alias (__libc_open64, open64)
diff --git a/sysdeps/unix/sysv/linux/generic/open.c b/sysdeps/unix/sysv/linux/open.c
similarity index 78%
rename from sysdeps/unix/sysv/linux/generic/open.c
rename to sysdeps/unix/sysv/linux/open.c
index 10cdbe0..b3912d5 100644
--- a/sysdeps/unix/sysv/linux/generic/open.c
+++ b/sysdeps/unix/sysv/linux/open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
+/* Copyright (C) 2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
@@ -16,12 +16,15 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
-#include <stdio.h>
+
#include <sysdep-cancel.h>
+#ifndef __OFF_T_MATCHES_OFF64_T
+
/* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG,
a third argument is the file protection. */
int
@@ -45,18 +48,4 @@ weak_alias (__libc_open, __open)
libc_hidden_weak (__open)
weak_alias (__libc_open, open)
-int
-__open_nocancel (const char *file, int oflag, ...)
-{
- int mode = 0;
-
- if (__OPEN_NEEDS_MODE (oflag))
- {
- va_list arg;
- va_start (arg, oflag);
- mode = va_arg (arg, int);
- va_end (arg);
- }
-
- return INLINE_SYSCALL (openat, 4, AT_FDCWD, file, oflag, mode);
-}
+#endif
diff --git a/sysdeps/unix/sysv/linux/open64.c b/sysdeps/unix/sysv/linux/open64.c
index 5e209ee..fcac984 100644
--- a/sysdeps/unix/sysv/linux/open64.c
+++ b/sysdeps/unix/sysv/linux/open64.c
@@ -15,10 +15,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
-#include <stdio.h>
+
#include <sysdep-cancel.h>
/* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG,
@@ -36,8 +37,23 @@ __libc_open64 (const char *file, int oflag, ...)
va_end (arg);
}
- return SYSCALL_CANCEL (open, file, oflag | O_LARGEFILE, mode);
+#ifdef __OFF_T_MATCHES_OFF64_T
+# define EXTRA_OPEN_FLAGS 0
+#else
+# define EXTRA_OPEN_FLAGS O_LARGEFILE
+#endif
+
+ return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | EXTRA_OPEN_FLAGS,
+ mode);
}
-weak_alias (__libc_open64, __open64)
+
+strong_alias (__libc_open64, __open64)
libc_hidden_weak (__open64)
weak_alias (__libc_open64, open64)
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (__libc_open64, __libc_open)
+strong_alias (__libc_open64, __open)
+libc_hidden_weak (__open)
+weak_alias (__libc_open64, open)
+#endif
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/open64.c b/sysdeps/unix/sysv/linux/wordsize-64/open64.c
deleted file mode 100644
index 0abe30e..0000000
--- a/sysdeps/unix/sysv/linux/wordsize-64/open64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Defined in open syscall. */
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 0c60647..6549ed8 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -6,7 +6,6 @@ readahead - readahead i:iii __readahead readahead
sendfile - sendfile i:iipi sendfile sendfile64
sync_file_range - sync_file_range Ci:iiii sync_file_range
creat - creat Ci:si creat creat64
-open - open Ci:siv __libc_open __open open __open64 open64
prlimit EXTRA prlimit64 i:iipp prlimit prlimit64
fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0f01acb340a0544cb0bc5953e81455c68859946e
commit 0f01acb340a0544cb0bc5953e81455c68859946e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Oct 29 19:26:05 2015 -0200
Consolidate Linux close syscall generation
This patch consolidates the close Linux syscall generation on
sysdeps/unix/sysv/linux/close.c.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
* nptl/Makefile (CFLAGS-close.c): New flag.
* sysdeps/unix/sysv/linux/close.c: New file.
diff --git a/ChangeLog b/ChangeLog
index 3afbbb5..cc843be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-10 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ * nptl/Makefile (CFLAGS-close.c): New flag.
+ * sysdeps/unix/sysv/linux/close.c: New file.
+
2017-05-11 DJ Delorie <dj@redhat.com>
* MAINTAINERS: New. Points to wiki.
diff --git a/nptl/Makefile b/nptl/Makefile
index 6d48c0c..8251ac4 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -213,6 +213,7 @@ CFLAGS-connect.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-recvfrom.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pt-system.c = -fexceptions
diff --git a/sysdeps/unix/sysv/linux/close.c b/sysdeps/unix/sysv/linux/close.c
new file mode 100644
index 0000000..1ac71ce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/close.c
@@ -0,0 +1,30 @@
+/* Linux close syscall implementation.
+ Copyright (C) 2017 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 <unistd.h>
+#include <sysdep-cancel.h>
+
+/* Close the file descriptor FD. */
+int
+__close (int fd)
+{
+ return SYSCALL_CANCEL (close, fd);
+}
+libc_hidden_def (__close)
+strong_alias (__close, __libc_close)
+weak_alias (__close, close)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 50 +++++++++++++++++
include/unistd.h | 2 +
io/Makefile | 4 +
nptl/Makefile | 3 +
sysdeps/powerpc/powerpc32/backtrace.c | 17 +++--
sysdeps/powerpc/powerpc64/backtrace.c | 17 +++--
sysdeps/unix/sysv/linux/alpha/creat.c | 8 ---
sysdeps/unix/sysv/linux/close.c | 30 ++++++++++
sysdeps/unix/sysv/linux/creat.c | 40 +++++++++++++
sysdeps/unix/sysv/linux/creat64.c | 41 ++++++++++++++
sysdeps/unix/sysv/linux/generic/creat.c | 37 ------------
sysdeps/unix/sysv/linux/generic/open.c | 62 ---------------------
sysdeps/unix/sysv/linux/generic/open64.c | 44 ---------------
sysdeps/unix/sysv/linux/open.c | 51 +++++++++++++++++
sysdeps/unix/sysv/linux/open64.c | 24 +++++++-
sysdeps/unix/sysv/linux/read.c | 33 +++++++++++
sysdeps/unix/sysv/linux/readv.c | 27 +++++++++
sysdeps/unix/sysv/linux/syscalls.list | 1 -
sysdeps/unix/sysv/linux/wordsize-64/creat64.c | 1 -
sysdeps/unix/sysv/linux/wordsize-64/open64.c | 1 -
sysdeps/unix/sysv/linux/wordsize-64/syscalls.list | 2 -
sysdeps/unix/sysv/linux/write.c | 33 +++++++++++
sysdeps/unix/sysv/linux/writev.c | 27 +++++++++
23 files changed, 381 insertions(+), 174 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/alpha/creat.c
create mode 100644 sysdeps/unix/sysv/linux/close.c
create mode 100644 sysdeps/unix/sysv/linux/creat.c
create mode 100644 sysdeps/unix/sysv/linux/creat64.c
delete mode 100644 sysdeps/unix/sysv/linux/generic/creat.c
delete mode 100644 sysdeps/unix/sysv/linux/generic/open.c
delete mode 100644 sysdeps/unix/sysv/linux/generic/open64.c
create mode 100644 sysdeps/unix/sysv/linux/open.c
create mode 100644 sysdeps/unix/sysv/linux/read.c
create mode 100644 sysdeps/unix/sysv/linux/readv.c
delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/creat64.c
delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/open64.c
create mode 100644 sysdeps/unix/sysv/linux/write.c
create mode 100644 sysdeps/unix/sysv/linux/writev.c
hooks/post-receive
--
GNU C Library master sources