From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755696AbcIIWZN (ORCPT ); Fri, 9 Sep 2016 18:25:13 -0400 Received: from resqmta-po-05v.sys.comcast.net ([96.114.154.164]:36818 "EHLO resqmta-po-05v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753756AbcIIWW5 (ORCPT ); Fri, 9 Sep 2016 18:22:57 -0400 From: Shuah Khan To: corbet@lwn.net, richardcochran@gmail.com Cc: Shuah Khan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH 1/9] selftests: move dnotify_test from Documentation/filesystems Date: Fri, 9 Sep 2016 16:22:42 -0600 Message-Id: <86ba11fc5f22dba9b322b38eec8e63d19f6634af.1473458697.git.shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-CMAE-Envelope: MS4wfMRF4W7/iXYUWYgOm9qCQXHHTsvQSzYQu07gUAU7g1h/7a5KZ33sq5XtX2P0V+m1wDE7wJtODqLjAFu3932O3N/Nf996MHqpH/TlhuF49pFYrihtYXGT /jsVRTde8Q9tUB816R+h0509p6zJopR1JPI0C2j0epou1y5Jsdz/8OCOK/O5biB4jJO1pX6sSZzLn2/2LmbmUSIVafr3pam3Avpt2MXfNw/sC309AKzXIBaW XlA9IKh+jnaX/qAzRaD2a3nnmxAbhYTjPpv2cP3RCh05yFdiBaE1kQFVKDMGqIykTmoAI0mw0TJriXbNufn+t3OGOMx6M/ktmmL3y3TNgfjcDQLvbJdtObuy 5fozQw+oNBvBg5GyAPhW2vbyu+xjkosvxIMo7+0vZbmUHzg8r6y0faZbxVDE+hdGwgNPMFHN Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move dnotify_test from Documentation/filesystems to selftests/filesystems Signed-off-by: Shuah Khan --- Documentation/filesystems/Makefile | 5 ---- Documentation/filesystems/dnotify_test.c | 34 ---------------------- tools/testing/selftests/filesystems/Makefile | 5 ++++ tools/testing/selftests/filesystems/dnotify_test.c | 34 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 Documentation/filesystems/Makefile delete mode 100644 Documentation/filesystems/dnotify_test.c create mode 100644 tools/testing/selftests/filesystems/Makefile create mode 100644 tools/testing/selftests/filesystems/dnotify_test.c diff --git a/Documentation/filesystems/Makefile b/Documentation/filesystems/Makefile deleted file mode 100644 index 883010c..0000000 --- a/Documentation/filesystems/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# List of programs to build -hostprogs-y := dnotify_test - -# Tell kbuild to always build the programs -always := $(hostprogs-y) diff --git a/Documentation/filesystems/dnotify_test.c b/Documentation/filesystems/dnotify_test.c deleted file mode 100644 index 8b37b4a..0000000 --- a/Documentation/filesystems/dnotify_test.c +++ /dev/null @@ -1,34 +0,0 @@ -#define _GNU_SOURCE /* needed to get the defines */ -#include /* in glibc 2.2 this has the needed - values defined */ -#include -#include -#include - -static volatile int event_fd; - -static void handler(int sig, siginfo_t *si, void *data) -{ - event_fd = si->si_fd; -} - -int main(void) -{ - struct sigaction act; - int fd; - - act.sa_sigaction = handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_SIGINFO; - sigaction(SIGRTMIN + 1, &act, NULL); - - fd = open(".", O_RDONLY); - fcntl(fd, F_SETSIG, SIGRTMIN + 1); - fcntl(fd, F_NOTIFY, DN_MODIFY|DN_CREATE|DN_MULTISHOT); - /* we will now be notified if any of the files - in "." is modified or new files are created */ - while (1) { - pause(); - printf("Got event on fd=%d\n", event_fd); - } -} diff --git a/tools/testing/selftests/filesystems/Makefile b/tools/testing/selftests/filesystems/Makefile new file mode 100644 index 0000000..883010c --- /dev/null +++ b/tools/testing/selftests/filesystems/Makefile @@ -0,0 +1,5 @@ +# List of programs to build +hostprogs-y := dnotify_test + +# Tell kbuild to always build the programs +always := $(hostprogs-y) diff --git a/tools/testing/selftests/filesystems/dnotify_test.c b/tools/testing/selftests/filesystems/dnotify_test.c new file mode 100644 index 0000000..8b37b4a --- /dev/null +++ b/tools/testing/selftests/filesystems/dnotify_test.c @@ -0,0 +1,34 @@ +#define _GNU_SOURCE /* needed to get the defines */ +#include /* in glibc 2.2 this has the needed + values defined */ +#include +#include +#include + +static volatile int event_fd; + +static void handler(int sig, siginfo_t *si, void *data) +{ + event_fd = si->si_fd; +} + +int main(void) +{ + struct sigaction act; + int fd; + + act.sa_sigaction = handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_SIGINFO; + sigaction(SIGRTMIN + 1, &act, NULL); + + fd = open(".", O_RDONLY); + fcntl(fd, F_SETSIG, SIGRTMIN + 1); + fcntl(fd, F_NOTIFY, DN_MODIFY|DN_CREATE|DN_MULTISHOT); + /* we will now be notified if any of the files + in "." is modified or new files are created */ + while (1) { + pause(); + printf("Got event on fd=%d\n", event_fd); + } +} -- 2.7.4