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 "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via 756575e5b6d157e81ce3a89cd866b4c17b71e309 (commit)
via 0c91741de0b307a7090125984b327a4374d27142 (commit)
from cddda5f9beb3d61f1122df95ccfcf855931775b7 (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 -----------------------------------------------------------------
commit 756575e5b6d157e81ce3a89cd866b4c17b71e309
Author: Yoshinori Sato <ysato(a)users.sourceforge.jp>
Date: Sat Jan 9 16:27:58 2016 +0900
h8300: O_DIRECT and O_DIRECTORY swapping.
Different define of latest kernel.
kernel define is
#define O_DIRECT 00040000 /* direct disk access hint */
#define O_DIRECTORY 00200000 /* must be a directory */
Yoshinori Sato <ysato(a)users.sourceforge.jp>
commit 0c91741de0b307a7090125984b327a4374d27142
Author: Eugene Rudoy <gene(a)freetz.org>
Date: Sat Jan 9 12:00:43 2016 +0100
ARCH_NATIVE_BIT should in the first place be passed when building utils for host
ARCH_NATIVE_BIT should in the first place be passed when building utils
for host (BUILD_CFLAGS-utils). It could also be passed when building utils
for target (CFLAGS-utils), but this is actually not necessary
as ARCH_NATIVE_BIT and __WORDSIZE are identical in this case.
Fixes 5ec4477584b69fe5f1410649b2eb3a63835fb649 (makes it actually work).
Signed-off-by: Eugene Rudoy <gene(a)freetz.org>
-----------------------------------------------------------------------
Summary of changes:
libc/sysdeps/linux/h8300/bits/fcntl.h | 4 ++--
utils/Makefile.in | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libc/sysdeps/linux/h8300/bits/fcntl.h b/libc/sysdeps/linux/h8300/bits/fcntl.h
index d180cbd..c167ee2 100644
--- a/libc/sysdeps/linux/h8300/bits/fcntl.h
+++ b/libc/sysdeps/linux/h8300/bits/fcntl.h
@@ -44,8 +44,8 @@
#define O_ASYNC 020000
#ifdef __USE_GNU
-# define O_DIRECTORY 040000 /* Must be a directory. */
-# define O_DIRECT 0200000 /* Direct disk access. */
+# define O_DIRECT 040000 /* Direct disk access. */
+# define O_DIRECTORY 0200000 /* Must be a directory. */
# define O_NOFOLLOW 0400000 /* Do not follow links. */
# define O_NOATIME 01000000 /* Do not set atime. */
# define O_CLOEXEC 02000000 /* Set close_on_exec. */
diff --git a/utils/Makefile.in b/utils/Makefile.in
index a601721..6349aa7 100644
--- a/utils/Makefile.in
+++ b/utils/Makefile.in
@@ -14,7 +14,6 @@ CFLAGS-utils := \
-I$(top_srcdir)ldso/include \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
-DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" \
- -DARCH_NATIVE_BIT=$(ARCH_NATIVE_BIT) \
-I$(top_srcdir)/$(KERNEL_HEADERS) \
-DNOT_IN_libc \
-B$(top_builddir)lib \
@@ -54,6 +53,7 @@ UTILS_CONFIG_FLAGS-$(LDSO_STANDALONE_SUPPORT) += -D__LDSO_STANDALONE_SUPPORT__
BUILD_CFLAGS-utils := \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
-DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" \
+ -DARCH_NATIVE_BIT=$(ARCH_NATIVE_BIT) \
$(UTILS_CONFIG_FLAGS-y)
BUILD_CFLAGS-ldconfig.host := \
-DBUILDING_LINKAGE \
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
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 "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via cddda5f9beb3d61f1122df95ccfcf855931775b7 (commit)
from 121ee94aa6af104ed33a83bc573739a6f2c02f54 (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 -----------------------------------------------------------------
commit cddda5f9beb3d61f1122df95ccfcf855931775b7
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Jan 10 09:08:14 2016 +0100
order of special checks matters
The order of special checks seems critical for some applications.
Xorg 1.18.0 fails to start with XNFreallocarray error.
Took me some time to run with MALLOC_DEBUG=2 to find out.
MALLOC_STANDARD is not affected.
-----------------------------------------------------------------------
Summary of changes:
libc/stdlib/malloc/realloc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c
index 8d55289..bdfb526 100644
--- a/libc/stdlib/malloc/realloc.c
+++ b/libc/stdlib/malloc/realloc.c
@@ -26,14 +26,16 @@ realloc (void *mem, size_t new_size)
size_t size;
char *base_mem;
+ if (! mem)
+ return malloc (new_size);
+
/* Check for special cases. */
if (! new_size)
{
free (mem);
return NULL;
}
- if (! mem)
- return malloc (new_size);
+
/* This matches the check in malloc() */
if (unlikely(((unsigned long)new_size > (unsigned long)(MALLOC_HEADER_SIZE*-2))))
return NULL;
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
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 "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via 55532a6ae663cc0f20bdf62d6c5d06db766b55f3 (commit)
from fad6c6021feb6c2dd4a3bd5de1113994d4a9b04e (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 -----------------------------------------------------------------
commit 55532a6ae663cc0f20bdf62d6c5d06db766b55f3
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sat Jan 9 09:09:51 2016 +0100
fix compile with DODEBUG=y
Since more projects using two-stage cross-compile process we
cannot add libgcc_eh.a unconditionally. We must check if
a real file is referenced by the cross-compiler.
Toolchains with --disabel-shared build have a single
libgcc.a containing all required symbols.
Tested with a debug build for x86.
-----------------------------------------------------------------------
Summary of changes:
Rules.mak | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Rules.mak b/Rules.mak
index 38b4cc2..ab88471 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -783,8 +783,11 @@ $(eval $(call cache-output-var,LIBGCC_A,$(CC) $(LIBGCC_CFLAGS) -print-libgcc-fil
$(eval $(call cache-output-var,LIBGCC_EH,$(CC) $(LIBGCC_CFLAGS) -print-file-name=libgcc_eh.a))
# with -O0 we (e.g. lockf) might end up with references to
# _Unwind_Resume, so pull in gcc_eh in this case..
+# with a --disable-shared toolchain, libgcc_eh.a and libgcc.a are combined
+# in libgcc.a, so check if the printed file exist, before adding to the commandline
+LIBGCC_EH_FILE := $(shell if [ -f $(LIBGCC_EH) ]; then echo $(LIBGCC_EH); fi)
LIBGCC_DIR := $(dir $(LIBGCC_A))
-LIBGCC := $(LIBGCC_A) $(if $(DODEBUG),$(LIBGCC_EH))
+LIBGCC := $(LIBGCC_A) $(if $(DODEBUG),$(LIBGCC_EH_FILE))
# moved from libpthread/linuxthreads
ifeq ($(UCLIBC_CTOR_DTOR),y)
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
Commit e3c3bf2b58 introduce use of pselect6, but has following disadvantages:
* Use of userspace types in args67 structure - it breaks, for example,
configs when 32-bit uClibc-ng compiled against 64-bit kernel. Syscall
will always return EINVAL. We must use __kernel_* types and
__SYSCALL_SIGSET_T_SIZE.
* It have excess checks for NSEC_PER_SEC. Original code from select()
implementation has struct timeval => struct timespec conversion,
kernel select() syscall implementation do the same.
But none of libc versions (glibc, eglibc, musl) I know, perform similar
checks for pselect() - there is no structure fields conversions,
just struct timespec through all the calls.
To have such checks in uClibc-ng we need one example, at least.
* It is possible to avoid extra userspace reads from kernel code if
sigmask == NULL. I suggest to do it, for a few bytes cost.
* Commit didn't add test case to testsuite.
Signed-off-by: Leonid Lisovskiy <lly.dev(a)gmail.com>
---
libc/sysdeps/linux/common/pselect.c | 67 ++++++++++++-------------------------
test/unistd/tst-pselect.c | 51 ++++++++++++++++++++++++++++
2 files changed, 73 insertions(+), 45 deletions(-)
create mode 100644 test/unistd/tst-pselect.c
diff --git a/libc/sysdeps/linux/common/pselect.c b/libc/sysdeps/linux/common/pselect.c
index 3f1dd28..fbe85b7 100644
--- a/libc/sysdeps/linux/common/pselect.c
+++ b/libc/sysdeps/linux/common/pselect.c
@@ -31,55 +31,32 @@ static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds,
const sigset_t *sigmask)
{
#ifdef __NR_pselect6
-#define NSEC_PER_SEC 1000000000L
- struct timespec _ts, *ts = 0;
- if (timeout) {
- /* The Linux kernel can in some situations update the timeout value.
- * We do not want that so use a local variable.
- */
+ /* The Linux kernel can in some situations update the timeout value.
+ * We do not want that so use a local variable.
+ */
+ struct timespec _ts;
+
+ if (timeout != NULL) {
_ts = *timeout;
+ timeout = &_ts;
+ }
+ /* Note: the system call expects 7 values but on most architectures
+ we can only pass in 6 directly. If there is an architecture with
+ support for more parameters a new version of this file needs to
+ be created. */
+ struct {
+ __kernel_ulong_t ss;
+ __kernel_size_t ss_len;
+ } data;
- /* GNU extension: allow for timespec values where the sub-sec
- * field is equal to or more than 1 second. The kernel will
- * reject this on us, so take care of the time shift ourself.
- * Some applications (like readline and linphone) do this.
- * See 'clarification on select() type calls and invalid timeouts'
- * on the POSIX general list for more information.
- */
- if (_ts.tv_nsec >= NSEC_PER_SEC) {
- _ts.tv_sec += _ts.tv_nsec / NSEC_PER_SEC;
- _ts.tv_nsec %= NSEC_PER_SEC;
- }
-
- ts = &_ts;
+ if (sigmask != NULL) {
+ data.ss = (__kernel_ulong_t) sigmask;
+ data.ss_len = __SYSCALL_SIGSET_T_SIZE;
+
+ sigmask = (void *)&data;
}
- /* The pselect6 syscall API is strange. It wants a 7th arg to be
- * the sizeof(*sigmask). However syscalls with > 6 arguments aren't
- * supported on linux. So arguments 6 and 7 are stuffed in a struct
- * and a pointer to that struct is passed as the 6th argument to
- * the syscall.
- * Glibc stuffs arguments 6 and 7 in a ulong[2]. Linux reads
- * them as if there were a struct { sigset_t*; size_t } in
- * userspace. There woudl be trouble if userspace and the kernel are
- * compiled differently enough that size_t isn't the same as ulong,
- * but not enough to trigger the compat layer in linux. I can't
- * think of such a case, so I'm using linux's struct.
- * Furthermore Glibc sets the sigsetsize to _NSIG/8. However linux
- * checks for sizeof(sigset_t), which internally is a ulong array.
- * This means that if _NSIG isn't a multiple of BITS_PER_LONG then
- * linux will refuse glibc's value. So I prefer sizeof(sigset_t) for
- * the value of sigsetsize.
- */
- struct {
- const sigset_t *sigmask;
- size_t sigsetsize;
- } args67 = {
- sigmask,
- sizeof(sigset_t),
- };
-
- return INLINE_SYSCALL(pselect6, 6, nfds, readfds, writefds, exceptfds, ts, &args67);
+ return INLINE_SYSCALL(pselect6, 6, nfds, readfds, writefds, exceptfds, timeout, sigmask);
#else
struct timeval tval;
int retval;
diff --git a/test/unistd/tst-pselect.c b/test/unistd/tst-pselect.c
new file mode 100644
index 0000000..cab9451
--- /dev/null
+++ b/test/unistd/tst-pselect.c
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/select.h>
+
+// our SIGALRM handler
+void handler(int signum) {
+ (void)signum;
+ puts("got signal\n");
+}
+
+static int
+do_test (void)
+{
+ int rc;
+ sigset_t wait_mask, mask_sigchld;
+ struct sigaction act;
+
+ // block SIGALRM. We want to handle it only when we're ready
+ sigemptyset(&mask_sigchld);
+ sigaddset(&mask_sigchld, SIGALRM);
+ sigprocmask(SIG_BLOCK, &mask_sigchld, &wait_mask);
+ sigdelset(&wait_mask, SIGALRM);
+
+ // register a signal handler so we can see when the signal arrives
+ memset(&act, 0, sizeof(act));
+ sigemptyset(&act.sa_mask); // just in case an empty set isn't all 0's (total paranoia)
+ act.sa_handler = handler;
+ sigaction(SIGALRM, &act, NULL);
+
+ // send ourselves a SIGARLM. It will pend until we unblock that signal in pselect()
+ printf("sending ourselves a signal\n");
+ kill(getpid(), SIGALRM);
+
+ printf("signal is pending; calling pselect()\n");
+ rc = pselect(0, NULL, NULL, NULL, NULL, &wait_mask);
+ if (rc != -1 || errno != EINTR) {
+ int e = errno;
+ printf("pselect() returned %d, errno %d (%s)\n", rc, e, strerror(e));
+ exit(1);
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include <test-skeleton.c>
--
1.8.5.6