[PATCH 1/8] test: Ignore various test objects
Signed-off-by: Kevin Cernekee cerne...@gmail.com --- test/.gitignore |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index c892816..a39fbec 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -29,11 +29,15 @@ dlopen/dltest2 dlopen/dlundef dlopen/libafk.so dlopen/libafk-temp.so +dlopen/libA.so +dlopen/libB.so +dlopen/libC.so dlopen/libstatic.so dlopen/libtest[123].so dlopen/libtest.so dlopen/libundef.so dlopen/test[1-3] +dlopen/testscope inet/bug-if1 inet/gethost_r-align inet/if_nameindex @@ -250,6 +254,7 @@ silly/tiny stat/memcmp-stat stat/stat stat/stat64 +stat/stat-loop256 stdio/64bit stdio/fclose-loop stdlib/ptytest -- 1.7.8.3 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH 3/8] test/signal: Fix compile warning in tst-sigset
Move up the variable declaration, to fix this: tst-sigset.c: In function 'do_test': tst-sigset.c:28:3: warning: ISO C90 forbids mixed declarations and code Signed-off-by: Kevin Cernekee cerne...@gmail.com --- test/signal/tst-sigset.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/signal/tst-sigset.c b/test/signal/tst-sigset.c index bc1b057..bfbab77 100644 --- a/test/signal/tst-sigset.c +++ b/test/signal/tst-sigset.c @@ -21,15 +21,15 @@ do_test (void) else - sigset_t set; - TRY (sigemptyset (set) != 0); - #ifdef SIGRTMAX int max_sig = SIGRTMAX; #else int max_sig = NSIG - 1; #endif + sigset_t set; + TRY (sigemptyset (set) != 0); + for (sig = 1; sig = max_sig; ++sig) { TRY (sigismember (set, sig) != 0); -- 1.7.8.3 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH 4/8] test/signal: Add tst-signalfd
Signed-off-by: Kevin Cernekee cerne...@gmail.com --- test/.gitignore|1 + test/signal/tst-signalfd.c | 63 2 files changed, 64 insertions(+), 0 deletions(-) create mode 100644 test/signal/tst-signalfd.c diff --git a/test/.gitignore b/test/.gitignore index a39fbec..a86135d 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -247,6 +247,7 @@ signal/sigchld signal/signal signal/tst-raise signal/tst-signal +signal/tst-signalfd signal/tst-sigset signal/tst-sigsimple silly/hello diff --git a/test/signal/tst-signalfd.c b/test/signal/tst-signalfd.c new file mode 100644 index 000..1fbb748 --- /dev/null +++ b/test/signal/tst-signalfd.c @@ -0,0 +1,63 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * signalfd test for uClibc + * Copyright (C) 2012 by Kevin Cernekee cerne...@gmail.com + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include stdio.h +#include stdlib.h +#include string.h +#include unistd.h +#include errno.h +#include error.h +#include signal.h +#include sys/signalfd.h +#include sys/fcntl.h + +static int +do_test(void) +{ + int fd, ret, result = 0; + struct signalfd_siginfo ssi; + sigset_t mask; + + sigemptyset(mask); + sigaddset(mask, SIGUSR1); + sigprocmask(SIG_BLOCK, mask, NULL); + + fd = signalfd(-1, mask, SFD_NONBLOCK); + if (fd 0) { + printf(signalfd() failed: %s\n, strerror(errno)); + result = 1; + } + + /* this should return immediately with EAGAIN due to SFD_NONBLOCK */ + memset(ssi, 0, sizeof(ssi)); + ret = read(fd, ssi, sizeof(ssi)); + if (ret != -1 || errno != EAGAIN) { + error(0, 0, first read() returned %d, ret); + result = 1; + } + + kill(getpid(), SIGUSR1); + + /* this should return a struct ssi indicating receipt of SIGUSR1 */ + ret = read(fd, ssi, sizeof(ssi)); + if (ret != sizeof(ssi)) { + error(0, 0, second read() returned %d, ret); + result = 1; + } + + if (ssi.ssi_signo != SIGUSR1) { + error(0, 0, ssi contains bogus signo); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include ../test-skeleton.c -- 1.7.8.3 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH 5/8] test/time: Add tst-timerfd
Signed-off-by: Kevin Cernekee cerne...@gmail.com --- test/.gitignore |1 + test/time/tst-timerfd.c | 71 +++ 2 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 test/time/tst-timerfd.c diff --git a/test/.gitignore b/test/.gitignore index a86135d..4abedb1 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -288,6 +288,7 @@ time/tst-futimens1 time/tst-mktime time/tst-mktime3 time/tst-strptime2 +time/tst-timerfd time/tst_wcsftime tls/tst-tls[1-9] tls/tst-tls1[0-8] diff --git a/test/time/tst-timerfd.c b/test/time/tst-timerfd.c new file mode 100644 index 000..5562ed7 --- /dev/null +++ b/test/time/tst-timerfd.c @@ -0,0 +1,71 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * timerfd test for uClibc + * Copyright (C) 2012 by Kevin Cernekee cerne...@gmail.com + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include stdio.h +#include stdlib.h +#include string.h +#include unistd.h +#include errno.h +#include error.h +#include signal.h +#include stdint.h +#include inttypes.h +#include time.h +#include sys/timerfd.h +#include sys/fcntl.h + +static int +do_test(void) +{ + int fd, ret, result = 0; + struct itimerspec s; + uint64_t val; + time_t start, now; + + fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); + if (fd 0) { + perror(timerfd() failed); + result = 1; + } + s.it_value.tv_sec = 1; + s.it_value.tv_nsec = 0; + s.it_interval.tv_sec = 0; + s.it_interval.tv_nsec = 0; + timerfd_settime(fd, 0, s, NULL); + start = time(NULL); + + /* this should return immediately with EAGAIN due to TFD_NONBLOCK */ + ret = read(fd, val, sizeof(val)); + if (ret != -1 || errno != EAGAIN) { + error(0, 0, first read() returned %d, ret); + result = 1; + } + + /* let the timer expire, then check it again */ + do { + now = time(NULL); + } while (now - start 2); + + ret = read(fd, val, sizeof(val)); + if (ret != sizeof(val)) { + error(0, 0, second read() returned %d, ret); + result = 1; + } + + /* we are expecting a single expiration, since it_interval is 0 */ + if (val != 1) { + error(0, 0, wrong number of expirations: % PRIx64, val); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include ../test-skeleton.c -- 1.7.8.3 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH 6/8] test/inet: Add tst-sock-nonblock
Signed-off-by: Kevin Cernekee cerne...@gmail.com --- test/.gitignore |1 + test/inet/tst-sock-nonblock.c | 53 + 2 files changed, 54 insertions(+), 0 deletions(-) create mode 100644 test/inet/tst-sock-nonblock.c diff --git a/test/.gitignore b/test/.gitignore index 4abedb1..2b03543 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -47,6 +47,7 @@ inet/tst-ethers inet/tst-ethers-line inet/tst-network inet/tst-ntoa +inet/tst-sock-nonblock inet/gethostid inet/getnetent librt/shmtest diff --git a/test/inet/tst-sock-nonblock.c b/test/inet/tst-sock-nonblock.c new file mode 100644 index 000..54a7ee2 --- /dev/null +++ b/test/inet/tst-sock-nonblock.c @@ -0,0 +1,53 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * Nonblocking socket test for uClibc + * Copyright (C) 2012 by Kevin Cernekee cerne...@gmail.com + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include stdio.h +#include stdlib.h +#include string.h +#include unistd.h +#include errno.h +#include error.h +#include sys/types.h +#include sys/socket.h +#include sys/un.h +#include sys/fcntl.h + +static int +do_test(void) +{ + int fd, ret, result = 0; + struct sockaddr_un sa; + char buf; + + fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0); + if (fd 0) { + perror(socket()); + result = 1; + } + + memset(sa, 0, sizeof(sa)); + sa.sun_family = AF_UNIX; + strcpy(sa.sun_path, socktest); + unlink(socktest); + if (bind(fd, (const struct sockaddr *)sa, sizeof(sa)) 0) { + perror(bind()); + result = 1; + } + + ret = read(fd, buf, sizeof(buf)); + if (ret != -1 || errno != EAGAIN) { + error(0, 0, Nonblocking read returned %d, ret); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include ../test-skeleton.c -- 1.7.8.3 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH 7/8] test/misc: Add tst-inotify
Signed-off-by: Kevin Cernekee cerne...@gmail.com --- test/.gitignore |1 + test/misc/tst-inotify.c | 66 +++ 2 files changed, 67 insertions(+), 0 deletions(-) create mode 100644 test/misc/tst-inotify.c diff --git a/test/.gitignore b/test/.gitignore index 2b03543..65490c2 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -151,6 +151,7 @@ misc/popen misc/seek misc/sem misc/stdarg +misc/tst-inotify misc/tst-scandir misc/tst-seekdir misc/tst-utmp diff --git a/test/misc/tst-inotify.c b/test/misc/tst-inotify.c new file mode 100644 index 000..9d940f7 --- /dev/null +++ b/test/misc/tst-inotify.c @@ -0,0 +1,66 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * inotify test for uClibc + * Copyright (C) 2012 by Kevin Cernekee cerne...@gmail.com + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include stdio.h +#include stdlib.h +#include string.h +#include unistd.h +#include errno.h +#include error.h +#include inttypes.h +#include sys/inotify.h +#include sys/fcntl.h + +static int +do_test(void) +{ + int ifd, fd, ret, result = 0; + struct inotify_event e; + char tfile[] = /tmp/inotify.XX; + + fd = mkstemp(tfile); + close(fd); + + ifd = inotify_init1(IN_NONBLOCK); + if (ifd 0) { + perror(inotify_init1()); + result = 1; + } + if (inotify_add_watch(ifd, tfile, IN_DELETE_SELF) 0) { + perror(inotify_add_watch()); + result = 1; + } + + /* nonblocking inotify should return immediately with no events */ + ret = read(ifd, e, sizeof(e)); + if (ret != -1 || errno != EAGAIN) { + error(0, 0, first read() returned %d, ret); + result = 1; + } + + /* generate an event */ + unlink(tfile); + + /* now check whether our event was seen */ + ret = read(ifd, e, sizeof(e)); + if (ret != sizeof(e)) { + error(0, 0, second read() returned %d, ret); + result = 1; + } + + if (!(e.mask IN_DELETE_SELF)) { + error(0, 0, incorrect event mask: % PRIx32, e.mask); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include ../test-skeleton.c -- 1.7.8.3 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
[PATCH V2 8/8] MIPS: Fix more *_NONBLOCK definitions
MIPS defines O_NONBLOCK differently from most other architectures. The common definitions use 04000 / 0x800, but MIPS uses 0200 / 0x80 instead. After seeing a problem report involving one of the O_NONBLOCK derivatives, I looked through the tree to see what else might be affected. Here is what I found: O_NONBLOCK: correct SOCK_NONBLOCK: correct (tst-sock-nonblock passes) EPOLL_NONBLOCK: correct SFD_NONBLOCK: correct (fixed in commit f87898ca; tst-signalfd passes) TFD_NONBLOCK: incorrect (tst-timerfd fails) IN_NONBLOCK: incorrect (tst-inotify fails) The proposed change is to add #ifdef clauses for __mips__, similar to what was done for SFD_NONBLOCK in include/sys/signalfd.h . This fixes the two failing test cases. Signed-off-by: Kevin Cernekee cerne...@gmail.com --- libc/sysdeps/linux/common/sys/inotify.h | 11 +++ libc/sysdeps/linux/common/sys/timerfd.h | 11 +++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/sys/inotify.h b/libc/sysdeps/linux/common/sys/inotify.h index dc4e19d..4a10d6b 100644 --- a/libc/sysdeps/linux/common/sys/inotify.h +++ b/libc/sysdeps/linux/common/sys/inotify.h @@ -23,6 +23,16 @@ /* Flags for the parameter of inotify_init1. */ +#if defined __mips__ +enum + { +IN_CLOEXEC = 0200, +#define IN_CLOEXEC IN_CLOEXEC +IN_NONBLOCK = 0200 +#define IN_NONBLOCK IN_NONBLOCK + }; + +#else enum { IN_CLOEXEC = 0200, @@ -30,6 +40,7 @@ enum IN_NONBLOCK = 04000 #define IN_NONBLOCK IN_NONBLOCK }; +#endif /* Structure describing an inotify event. */ diff --git a/libc/sysdeps/linux/common/sys/timerfd.h b/libc/sysdeps/linux/common/sys/timerfd.h index c1bb06f..141338e 100644 --- a/libc/sysdeps/linux/common/sys/timerfd.h +++ b/libc/sysdeps/linux/common/sys/timerfd.h @@ -23,6 +23,16 @@ /* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +#if defined __mips__ +enum + { +TFD_CLOEXEC = 0200, +#define TFD_CLOEXEC TFD_CLOEXEC +TFD_NONBLOCK = 0200 +#define TFD_NONBLOCK TFD_NONBLOCK + }; + +#else enum { TFD_CLOEXEC = 0200, @@ -30,6 +40,7 @@ enum TFD_NONBLOCK = 04000 #define TFD_NONBLOCK TFD_NONBLOCK }; +#endif /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ -- 1.7.8.3 ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH V2 8/8] MIPS: Fix more *_NONBLOCK definitions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/07/2012 01:31 PM, Kevin Cernekee wrote: MIPS defines O_NONBLOCK differently from most other architectures. The common definitions use 04000 / 0x800, but MIPS uses 0200 / 0x80 instead. After seeing a problem report involving one of the O_NONBLOCK derivatives, I looked through the tree to see what else might be affected. Here is what I found: We already have this kind of patch in future branch IIRC O_NONBLOCK: correct SOCK_NONBLOCK: correct (tst-sock-nonblock passes) EPOLL_NONBLOCK: correct SFD_NONBLOCK: correct (fixed in commit f87898ca; tst-signalfd passes) TFD_NONBLOCK: incorrect (tst-timerfd fails) IN_NONBLOCK: incorrect (tst-inotify fails) The proposed change is to add #ifdef clauses for __mips__, similar to what was done for SFD_NONBLOCK in include/sys/signalfd.h . This fixes the two failing test cases. Signed-off-by: Kevin Cernekee cerne...@gmail.com --- libc/sysdeps/linux/common/sys/inotify.h | 11 +++ libc/sysdeps/linux/common/sys/timerfd.h | 11 +++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/libc/sysdeps/linux/common/sys/inotify.h b/libc/sysdeps/linux/common/sys/inotify.h index dc4e19d..4a10d6b 100644 --- a/libc/sysdeps/linux/common/sys/inotify.h +++ b/libc/sysdeps/linux/common/sys/inotify.h @@ -23,6 +23,16 @@ /* Flags for the parameter of inotify_init1. */ +#if defined __mips__ +enum + { +IN_CLOEXEC = 0200, +#define IN_CLOEXEC IN_CLOEXEC +IN_NONBLOCK = 0200 +#define IN_NONBLOCK IN_NONBLOCK + }; + +#else enum { IN_CLOEXEC = 0200, @@ -30,6 +40,7 @@ enum IN_NONBLOCK = 04000 #define IN_NONBLOCK IN_NONBLOCK }; +#endif /* Structure describing an inotify event. */ diff --git a/libc/sysdeps/linux/common/sys/timerfd.h b/libc/sysdeps/linux/common/sys/timerfd.h index c1bb06f..141338e 100644 --- a/libc/sysdeps/linux/common/sys/timerfd.h +++ b/libc/sysdeps/linux/common/sys/timerfd.h @@ -23,6 +23,16 @@ /* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +#if defined __mips__ +enum + { +TFD_CLOEXEC = 0200, +#define TFD_CLOEXEC TFD_CLOEXEC +TFD_NONBLOCK = 0200 +#define TFD_NONBLOCK TFD_NONBLOCK + }; + +#else enum { TFD_CLOEXEC = 0200, @@ -30,6 +40,7 @@ enum TFD_NONBLOCK = 04000 #define TFD_NONBLOCK TFD_NONBLOCK }; +#endif /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+ArSAACgkQuwUzVZGdMxQe4QCfayl21bSKN+i/tmV215Y9sBNU iGwAn3Jst/+F2YEiowvsgPU9lq/ushGY =9yaC -END PGP SIGNATURE- ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH V2 8/8] MIPS: Fix more *_NONBLOCK definitions
On Sat, Apr 7, 2012 at 2:09 PM, Khem Raj raj.k...@gmail.com wrote: After seeing a problem report involving one of the O_NONBLOCK derivatives, I looked through the tree to see what else might be affected. Here is what I found: We already have this kind of patch in future branch IIRC I think TFD_NONBLOCK and IN_NONBLOCK are still missing on both master and future? ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH V2 8/8] MIPS: Fix more *_NONBLOCK definitions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/07/2012 02:22 PM, Kevin Cernekee wrote: On Sat, Apr 7, 2012 at 2:09 PM, Khem Raj raj.k...@gmail.com wrote: After seeing a problem report involving one of the O_NONBLOCK derivatives, I looked through the tree to see what else might be affected. Here is what I found: We already have this kind of patch in future branch IIRC I think TFD_NONBLOCK and IN_NONBLOCK are still missing on both master and future? that could be I dont have handy access to check ATM -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+AvbcACgkQuwUzVZGdMxRXGACff0wMt7Udo27dWLi/UKbz2VGV BvcAn107xVSeC1lTHRJfkGbjPdwZnjVk =MLeR -END PGP SIGNATURE- ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH V5] ldso: fix fdpic support broken from prelink patch
On Friday 06 April 2012 05:18:35 Filippo ARCIDIACONO wrote: The fdpic support has been broken since the prelink support was added, because it didn't take into account DL_LOADADDR_TYPE could be a different type of ElfW(Addr). i fixed a typo in the mmu code and pushed it. thanks! -mike signature.asc Description: This is a digitally signed message part. ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH 1/8] test: Ignore various test objects
thanks, merged -mike signature.asc Description: This is a digitally signed message part. ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH 3/8] test/signal: Fix compile warning in tst-sigset
On Saturday 07 April 2012 16:31:27 Kevin Cernekee wrote: Move up the variable declaration, to fix this: tst-sigset.c: In function 'do_test': tst-sigset.c:28:3: warning: ISO C90 forbids mixed declarations and code the tests that we import from glibc i'd rather not modify we build the rest of the tree with -std=gnu99, so sounds like the test subdir needs that update too -mike signature.asc Description: This is a digitally signed message part. ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc
Re: [PATCH V2 8/8] MIPS: Fix more *_NONBLOCK definitions
On Sat, Apr 7, 2012 at 10:32 PM, Mike Frysinger vap...@gentoo.org wrote: On Saturday 07 April 2012 16:31:32 Kevin Cernekee wrote: The proposed change is to add #ifdef clauses for __mips__, similar to what was done for SFD_NONBLOCK in include/sys/signalfd.h . This fixes the two failing test cases. we don't want arch ifdefs in these common files, nor do we want to diverge from glibc. upstream glibc has finally gotten sane and converted to bits/inotify.h for handling arch-specific stuff. let's import those updates instead. Thanks for the quick review. The original non-ifdef submission is here: http://lists.uclibc.org/pipermail/uclibc/2012-February/046409.html Some discussion which led to V2: http://lists.uclibc.org/pipermail/uclibc/2012-February/046418.html http://lists.uclibc.org/pipermail/uclibc/2012-February/046419.html Re: documentation - is it worth explicitly mentioning these oddball headers/definitions in docs/PORTING or is the current verbiage sufficient? ___ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc