|
From: <sv...@va...> - 2011-03-17 10:57:58
|
Author: bart Date: 2011-03-17 10:57:49 +0000 (Thu, 17 Mar 2011) New Revision: 11651 Log: Moved two Linux-specific syscalls to the linux subdirectory. Added: trunk/memcheck/tests/linux/syscalls-2007.c trunk/memcheck/tests/linux/syscalls-2007.stderr.exp trunk/memcheck/tests/linux/syscalls-2007.vgtest trunk/memcheck/tests/linux/syslog-syscall.c trunk/memcheck/tests/linux/syslog-syscall.stderr.exp trunk/memcheck/tests/linux/syslog-syscall.vgtest Removed: trunk/memcheck/tests/linux-syscalls-2007.c trunk/memcheck/tests/linux-syscalls-2007.stderr.exp trunk/memcheck/tests/linux-syscalls-2007.vgtest trunk/memcheck/tests/linux-syslog-syscall.c trunk/memcheck/tests/linux-syslog-syscall.stderr.exp trunk/memcheck/tests/linux-syslog-syscall.vgtest Modified: trunk/memcheck/tests/Makefile.am trunk/memcheck/tests/linux/Makefile.am Modified: trunk/memcheck/tests/Makefile.am =================================================================== --- trunk/memcheck/tests/Makefile.am 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/Makefile.am 2011-03-17 10:57:49 UTC (rev 11651) @@ -95,8 +95,6 @@ leak-pool-4.vgtest leak-pool-4.stderr.exp \ leak-pool-5.vgtest leak-pool-5.stderr.exp \ leak-tree.vgtest leak-tree.stderr.exp \ - linux-syslog-syscall linux-syslog-syscall.stderr.exp \ - linux-syscalls-2007 linux-syscalls-2007.stderr.exp \ long_namespace_xml.vgtest long_namespace_xml.stdout.exp \ long_namespace_xml.stderr.exp \ long-supps.vgtest long-supps.stderr.exp long-supps.supp \ @@ -223,8 +221,6 @@ leak-cycle \ leak-pool \ leak-tree \ - linux-syslog-syscall \ - linux-syscalls-2007 \ long_namespace_xml \ long-supps \ mallinfo \ Modified: trunk/memcheck/tests/linux/Makefile.am =================================================================== --- trunk/memcheck/tests/linux/Makefile.am 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/linux/Makefile.am 2011-03-17 10:57:49 UTC (rev 11651) @@ -12,6 +12,8 @@ stack_changes.stderr.exp stack_changes.stdout.exp \ stack_changes.stdout.exp2 stack_changes.vgtest \ stack_switch.stderr.exp stack_switch.vgtest \ + syscalls-2007 syscalls-2007.stderr.exp \ + syslog-syscall syslog-syscall.stderr.exp \ timerfd-syscall timerfd-syscall.stderr.exp \ with-space.stderr.exp with-space.stdout.exp with-space.vgtest @@ -23,6 +25,8 @@ sigqueue \ stack_changes \ stack_switch \ + syscalls-2007 \ + syslog-syscall \ timerfd-syscall Copied: trunk/memcheck/tests/linux/syscalls-2007.c (from rev 11649, trunk/memcheck/tests/linux-syscalls-2007.c) =================================================================== --- trunk/memcheck/tests/linux/syscalls-2007.c (rev 0) +++ trunk/memcheck/tests/linux/syscalls-2007.c 2011-03-17 10:57:49 UTC (rev 11651) @@ -0,0 +1,83 @@ +/** + * Test program for some Linux syscalls introduced during 2006 and 2007: + * - epoll_pwait() was introduced in the 2.6.19 kernel, released in November + * 2006. + * - utimensat(), eventfd(), timerfd() and signalfd() were introduced in the + * 2.6.22 kernel, released in July 2007. + * + * See also http://bugs.kde.org/show_bug.cgi?id=160907. + */ + +#define _GNU_SOURCE + +#include "../../config.h" +#include <fcntl.h> +#include <signal.h> +#include <stdint.h> +#if defined(HAVE_SYS_EPOLL_H) +#include <sys/epoll.h> +#endif +#if defined(HAVE_SYS_EVENTFD_H) +#include <sys/eventfd.h> +#endif +#if defined(HAVE_SYS_POLL_H) +#include <sys/poll.h> +#endif +#if defined(HAVE_SYS_SIGNALFD_H) +#include <sys/signalfd.h> +#endif +#include <sys/stat.h> +#include <unistd.h> + +int main (void) +{ +#if defined(HAVE_SIGNALFD) && defined(HAVE_EVENTFD) \ + && defined(HAVE_EVENTFD_READ) && defined(HAVE_PPOLL) + { + sigset_t mask; + int fd, fd2; + eventfd_t ev; + struct timespec ts = { .tv_sec = 1, .tv_nsec = 0 }; + struct pollfd pfd[2]; + + sigemptyset (&mask); + sigaddset (&mask, SIGUSR1); + fd = signalfd (-1, &mask, 0); + sigaddset (&mask, SIGUSR2); + fd = signalfd (fd, &mask, 0); + fd2 = eventfd (5, 0); + eventfd_read (fd2, &ev); + pfd[0].fd = fd; + pfd[0].events = POLLIN|POLLOUT; + pfd[1].fd = fd2; + pfd[1].events = POLLIN|POLLOUT; + ppoll (pfd, 2, &ts, &mask); + } +#endif + +#if defined(HAVE_UTIMENSAT) + unlink("/tmp/valgrind-utimensat-test"); + close (creat ("/tmp/valgrind-utimensat-test", S_IRUSR | S_IWUSR)); + { + struct timespec ts2[2] = { [0].tv_sec = 10000000, [1].tv_sec = 20000000 }; + utimensat (AT_FDCWD, "/tmp/valgrind-utimensat-test", ts2, 0); + } + unlink("/tmp/valgrind-utimensat-test"); +#endif + +#if defined(HAVE_EPOLL_CREATE) && defined(HAVE_EPOLL_PWAIT) + { + int fd3; + struct epoll_event evs[10]; + sigset_t mask; + + sigemptyset (&mask); + sigaddset (&mask, SIGUSR1); + sigaddset (&mask, SIGUSR2); + fd3 = epoll_create (10); + epoll_pwait (fd3, evs, 10, 0, &mask); + } +#endif + + return 0; +} Copied: trunk/memcheck/tests/linux/syscalls-2007.stderr.exp (from rev 11649, trunk/memcheck/tests/linux-syscalls-2007.stderr.exp) =================================================================== --- trunk/memcheck/tests/linux/syscalls-2007.stderr.exp (rev 0) +++ trunk/memcheck/tests/linux/syscalls-2007.stderr.exp 2011-03-17 10:57:49 UTC (rev 11651) @@ -0,0 +1,10 @@ + + +HEAP SUMMARY: + in use at exit: ... bytes in ... blocks + total heap usage: ... allocs, ... frees, ... bytes allocated + +For a detailed leak analysis, rerun with: --leak-check=full + +For counts of detected and suppressed errors, rerun with: -v +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Copied: trunk/memcheck/tests/linux/syscalls-2007.vgtest (from rev 11649, trunk/memcheck/tests/linux-syscalls-2007.vgtest) =================================================================== --- trunk/memcheck/tests/linux/syscalls-2007.vgtest (rev 0) +++ trunk/memcheck/tests/linux/syscalls-2007.vgtest 2011-03-17 10:57:49 UTC (rev 11651) @@ -0,0 +1,2 @@ +prog: syscalls-2007 +stderr_filter: ../filter_allocs Copied: trunk/memcheck/tests/linux/syslog-syscall.c (from rev 11649, trunk/memcheck/tests/linux-syslog-syscall.c) =================================================================== --- trunk/memcheck/tests/linux/syslog-syscall.c (rev 0) +++ trunk/memcheck/tests/linux/syslog-syscall.c 2011-03-17 10:57:49 UTC (rev 11651) @@ -0,0 +1,23 @@ +/** Test program for the syslog() system call. + * From the syslog(2) man page: + * If you need the libc function syslog() (which talks to syslogd(8)), + * then look at syslog(3). The system call of this name is about control‐ + * ling the kernel printk() buffer, and the glibc version is called + * klogctl(). + */ + +#include "../../config.h" +#include <stdio.h> +#if defined(HAVE_SYS_KLOG_H) +#include <sys/klog.h> +#endif + +int main(int argc, char** argv) +{ + int number_of_unread_characters; +#if defined HAVE_KLOGCTL + number_of_unread_characters = klogctl(9, 0, 0); +#endif + fprintf(stderr, "Done.\n"); + return 0 * number_of_unread_characters; +} Copied: trunk/memcheck/tests/linux/syslog-syscall.stderr.exp (from rev 11649, trunk/memcheck/tests/linux-syslog-syscall.stderr.exp) =================================================================== --- trunk/memcheck/tests/linux/syslog-syscall.stderr.exp (rev 0) +++ trunk/memcheck/tests/linux/syslog-syscall.stderr.exp 2011-03-17 10:57:49 UTC (rev 11651) @@ -0,0 +1,11 @@ + +Done. + +HEAP SUMMARY: + in use at exit: ... bytes in ... blocks + total heap usage: ... allocs, ... frees, ... bytes allocated + +For a detailed leak analysis, rerun with: --leak-check=full + +For counts of detected and suppressed errors, rerun with: -v +ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Copied: trunk/memcheck/tests/linux/syslog-syscall.vgtest (from rev 11649, trunk/memcheck/tests/linux-syslog-syscall.vgtest) =================================================================== --- trunk/memcheck/tests/linux/syslog-syscall.vgtest (rev 0) +++ trunk/memcheck/tests/linux/syslog-syscall.vgtest 2011-03-17 10:57:49 UTC (rev 11651) @@ -0,0 +1,2 @@ +prog: syslog-syscall +stderr_filter: ../filter_allocs Deleted: trunk/memcheck/tests/linux-syscalls-2007.c =================================================================== --- trunk/memcheck/tests/linux-syscalls-2007.c 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/linux-syscalls-2007.c 2011-03-17 10:57:49 UTC (rev 11651) @@ -1,83 +0,0 @@ -/** - * Test program for some Linux syscalls introduced during 2006 and 2007: - * - epoll_pwait() was introduced in the 2.6.19 kernel, released in November - * 2006. - * - utimensat(), eventfd(), timerfd() and signalfd() were introduced in the - * 2.6.22 kernel, released in July 2007. - * - * See also http://bugs.kde.org/show_bug.cgi?id=160907. - */ - -#define _GNU_SOURCE - -#include "../../config.h" -#include <fcntl.h> -#include <signal.h> -#include <stdint.h> -#if defined(HAVE_SYS_EPOLL_H) -#include <sys/epoll.h> -#endif -#if defined(HAVE_SYS_EVENTFD_H) -#include <sys/eventfd.h> -#endif -#if defined(HAVE_SYS_POLL_H) -#include <sys/poll.h> -#endif -#if defined(HAVE_SYS_SIGNALFD_H) -#include <sys/signalfd.h> -#endif -#include <sys/stat.h> -#include <unistd.h> - -int main (void) -{ -#if defined(HAVE_SIGNALFD) && defined(HAVE_EVENTFD) \ - && defined(HAVE_EVENTFD_READ) && defined(HAVE_PPOLL) - { - sigset_t mask; - int fd, fd2; - eventfd_t ev; - struct timespec ts = { .tv_sec = 1, .tv_nsec = 0 }; - struct pollfd pfd[2]; - - sigemptyset (&mask); - sigaddset (&mask, SIGUSR1); - fd = signalfd (-1, &mask, 0); - sigaddset (&mask, SIGUSR2); - fd = signalfd (fd, &mask, 0); - fd2 = eventfd (5, 0); - eventfd_read (fd2, &ev); - pfd[0].fd = fd; - pfd[0].events = POLLIN|POLLOUT; - pfd[1].fd = fd2; - pfd[1].events = POLLIN|POLLOUT; - ppoll (pfd, 2, &ts, &mask); - } -#endif - -#if defined(HAVE_UTIMENSAT) - unlink("/tmp/valgrind-utimensat-test"); - close (creat ("/tmp/valgrind-utimensat-test", S_IRUSR | S_IWUSR)); - { - struct timespec ts2[2] = { [0].tv_sec = 10000000, [1].tv_sec = 20000000 }; - utimensat (AT_FDCWD, "/tmp/valgrind-utimensat-test", ts2, 0); - } - unlink("/tmp/valgrind-utimensat-test"); -#endif - -#if defined(HAVE_EPOLL_CREATE) && defined(HAVE_EPOLL_PWAIT) - { - int fd3; - struct epoll_event evs[10]; - sigset_t mask; - - sigemptyset (&mask); - sigaddset (&mask, SIGUSR1); - sigaddset (&mask, SIGUSR2); - fd3 = epoll_create (10); - epoll_pwait (fd3, evs, 10, 0, &mask); - } -#endif - - return 0; -} Deleted: trunk/memcheck/tests/linux-syscalls-2007.stderr.exp =================================================================== --- trunk/memcheck/tests/linux-syscalls-2007.stderr.exp 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/linux-syscalls-2007.stderr.exp 2011-03-17 10:57:49 UTC (rev 11651) @@ -1,10 +0,0 @@ - - -HEAP SUMMARY: - in use at exit: ... bytes in ... blocks - total heap usage: ... allocs, ... frees, ... bytes allocated - -For a detailed leak analysis, rerun with: --leak-check=full - -For counts of detected and suppressed errors, rerun with: -v -ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Deleted: trunk/memcheck/tests/linux-syscalls-2007.vgtest =================================================================== --- trunk/memcheck/tests/linux-syscalls-2007.vgtest 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/linux-syscalls-2007.vgtest 2011-03-17 10:57:49 UTC (rev 11651) @@ -1,2 +0,0 @@ -prog: linux-syscalls-2007 -stderr_filter: filter_allocs Deleted: trunk/memcheck/tests/linux-syslog-syscall.c =================================================================== --- trunk/memcheck/tests/linux-syslog-syscall.c 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/linux-syslog-syscall.c 2011-03-17 10:57:49 UTC (rev 11651) @@ -1,23 +0,0 @@ -/** Test program for the syslog() system call. - * From the syslog(2) man page: - * If you need the libc function syslog() (which talks to syslogd(8)), - * then look at syslog(3). The system call of this name is about control‐ - * ling the kernel printk() buffer, and the glibc version is called - * klogctl(). - */ - -#include "../../config.h" -#include <stdio.h> -#if defined(HAVE_SYS_KLOG_H) -#include <sys/klog.h> -#endif - -int main(int argc, char** argv) -{ - int number_of_unread_characters; -#if defined HAVE_KLOGCTL - number_of_unread_characters = klogctl(9, 0, 0); -#endif - fprintf(stderr, "Done.\n"); - return 0 * number_of_unread_characters; -} Deleted: trunk/memcheck/tests/linux-syslog-syscall.stderr.exp =================================================================== --- trunk/memcheck/tests/linux-syslog-syscall.stderr.exp 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/linux-syslog-syscall.stderr.exp 2011-03-17 10:57:49 UTC (rev 11651) @@ -1,11 +0,0 @@ - -Done. - -HEAP SUMMARY: - in use at exit: ... bytes in ... blocks - total heap usage: ... allocs, ... frees, ... bytes allocated - -For a detailed leak analysis, rerun with: --leak-check=full - -For counts of detected and suppressed errors, rerun with: -v -ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Deleted: trunk/memcheck/tests/linux-syslog-syscall.vgtest =================================================================== --- trunk/memcheck/tests/linux-syslog-syscall.vgtest 2011-03-17 10:50:33 UTC (rev 11650) +++ trunk/memcheck/tests/linux-syslog-syscall.vgtest 2011-03-17 10:57:49 UTC (rev 11651) @@ -1,2 +0,0 @@ -prog: linux-syslog-syscall -stderr_filter: filter_allocs |