From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH 1/2] Clean up inotify(7) wrappers
Date: Thu, 05 Apr 2012 09:36:48 +0800 [thread overview]
Message-ID: <4F7CF730.30909@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.BSF.2.00.1204041735200.25027@toaster.local>
On 04/05/2012 08:38 AM, Garrett Cooper wrote:
> Clean up inotify(7) wrappers
>
> As a side-effect this also fixes the return code passed back
> by the wrappers as the value should be an integer, not longs
> [this fixes compile errors on platforms where
> sizeof(int) != sizeof(long)].
Looks OK to me.
Thanks,
Wanlong Gao
>
> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
> ---
> testcases/kernel/syscalls/inotify/inotify.h | 45 +++++++++++++++++++++++++
> testcases/kernel/syscalls/inotify/inotify01.c | 16 +--------
> testcases/kernel/syscalls/inotify/inotify02.c | 16 +--------
> testcases/kernel/syscalls/inotify/inotify03.c | 16 +--------
> 4 files changed, 48 insertions(+), 45 deletions(-)
> create mode 100644 testcases/kernel/syscalls/inotify/inotify.h
>
>
> --------------1.7.2.5
> Content-Type: text/x-patch; name="0001-Clean-up-inotify-7-wrappers.patch"
> Content-Transfer-Encoding: 8bit
> Content-Disposition: attachment; filename="0001-Clean-up-inotify-7-wrappers.patch"
>
> diff --git a/testcases/kernel/syscalls/inotify/inotify.h b/testcases/kernel/syscalls/inotify/inotify.h
> new file mode 100644
> index 0000000..ab7f812
> --- /dev/null
> +++ b/testcases/kernel/syscalls/inotify/inotify.h
> @@ -0,0 +1,45 @@
> +/*
> + * inotify testcase common definitions.
> + *
> + * Copyright (c) 2012 Linux Test Project. All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of version 2 of the GNU General Public License as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it would be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> + *
> + * Further, this software is distributed without any warranty that it is
> + * free of the rightful claim of any third person regarding infringement
> + * or the like. Any license provided herein, whether implied or
> + * otherwise, applies only to this software file. Patent licenses, if
> + * any, provided herein do not apply to combinations of this program with
> + * other software, or any other product whatsoever.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write the Free Software Foundation, Inc., 59
> + * Temple Place - Suite 330, Boston MA 02111-1307, USA.
> + *
> + * Garrett Cooper, April 2012
> + */
> +
> +#ifndef _INOTIFY_H
> +#define _INOTIFY_H
> +
> +/* inotify(7) wrappers */
> +
> +/*
> + * ``junk`` is needed to make the macro function like a void argument
> + * function.
> + */
> +#define myinotify_init(junk) syscall(__NR_inotify_init)
> +
> +#define myinotify_add_watch(fd, pathname, mask) \
> + syscall(__NR_inotify_add_watch, fd, pathname, mask)
> +
> +#define myinotify_rm_watch(fd, wd) \
> + syscall(__NR_inotify_rm_watch, fd, wd)
> +
> +#endif /* _INOTIFY_H */
> diff --git a/testcases/kernel/syscalls/inotify/inotify01.c b/testcases/kernel/syscalls/inotify/inotify01.c
> index 4168c0e..8205f82 100644
> --- a/testcases/kernel/syscalls/inotify/inotify01.c
> +++ b/testcases/kernel/syscalls/inotify/inotify01.c
> @@ -50,6 +50,7 @@
> #include "test.h"
> #include "usctest.h"
> #include "linux_syscall_numbers.h"
> +#include "inotify.h"
>
> #if defined(HAVE_SYS_INOTIFY_H)
> #include <sys/inotify.h>
> @@ -76,21 +77,6 @@ int event_set[EVENT_MAX];
>
> char event_buf[EVENT_BUF_LEN];
>
> -static long myinotify_init()
> -{
> - return syscall(__NR_inotify_init);
> -}
> -
> -static long myinotify_add_watch(int fd, const char *pathname, int mask)
> -{
> - return syscall(__NR_inotify_add_watch, fd, pathname, mask);
> -}
> -
> -static long myinotify_rm_watch(int fd, int wd)
> -{
> - return syscall(__NR_inotify_rm_watch, fd, wd);
> -}
> -
> int main(int ac, char **av)
> {
> int lc; /* loop counter */
> diff --git a/testcases/kernel/syscalls/inotify/inotify02.c b/testcases/kernel/syscalls/inotify/inotify02.c
> index 4ffc00c..59f83ba 100644
> --- a/testcases/kernel/syscalls/inotify/inotify02.c
> +++ b/testcases/kernel/syscalls/inotify/inotify02.c
> @@ -54,6 +54,7 @@
> #include "test.h"
> #include "usctest.h"
> #include "linux_syscall_numbers.h"
> +#include "inotify.h"
>
> #if defined(HAVE_SYS_INOTIFY_H)
> #include <sys/inotify.h>
> @@ -92,21 +93,6 @@ struct event_t event_set[EVENT_MAX];
>
> char event_buf[EVENT_BUF_LEN];
>
> -static long myinotify_init()
> -{
> - return syscall(__NR_inotify_init);
> -}
> -
> -static long myinotify_add_watch(int fd, const char *pathname, int mask)
> -{
> - return syscall(__NR_inotify_add_watch, fd, pathname, mask);
> -}
> -
> -static long myinotify_rm_watch(int fd, int wd)
> -{
> - return syscall(__NR_inotify_rm_watch, fd, wd);
> -}
> -
> int main(int ac, char **av)
> {
> int lc; /* loop counter */
> diff --git a/testcases/kernel/syscalls/inotify/inotify03.c b/testcases/kernel/syscalls/inotify/inotify03.c
> index d3c3e7b..d8caa83 100644
> --- a/testcases/kernel/syscalls/inotify/inotify03.c
> +++ b/testcases/kernel/syscalls/inotify/inotify03.c
> @@ -49,6 +49,7 @@
> #include "test.h"
> #include "usctest.h"
> #include "linux_syscall_numbers.h"
> +#include "inotify.h"
>
> #if defined(HAVE_SYS_INOTIFY_H)
> #include <sys/inotify.h>
> @@ -76,21 +77,6 @@ int event_set[EVENT_MAX];
>
> char event_buf[EVENT_BUF_LEN];
>
> -static long myinotify_init()
> -{
> - return syscall(__NR_inotify_init);
> -}
> -
> -static long myinotify_add_watch(int fd, const char *pathname, int mask)
> -{
> - return syscall(__NR_inotify_add_watch, fd, pathname, mask);
> -}
> -
> -static long myinotify_rm_watch(int fd, int wd)
> -{
> - return syscall(__NR_inotify_rm_watch, fd, wd);
> -}
> -
> #define DEFAULT_FSTYPE "ext2"
> #define DIR_MODE S_IRWXU | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP
>
>
> ------------------------------------------------------------------------------
> Better than sec? Nothing is better than sec when it comes to
> monitoring Big Data applications. Try Boundary one-second
> resolution app monitoring today. Free.
> http://p.sf.net/sfu/Boundary-dev2dev
>
>
>
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2012-04-05 1:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-05 0:38 [LTP] [PATCH 1/2] Clean up inotify(7) wrappers Garrett Cooper
2012-04-05 1:36 ` Wanlong Gao [this message]
2012-04-05 1:52 ` Mike Frysinger
2012-04-11 2:52 ` Wanlong Gao
2012-04-11 9:21 ` Garrett Cooper
2012-04-11 9:25 ` Wanlong Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F7CF730.30909@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=yanegomi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox