* [patch 179/322] flag parameters add-on: remove epoll_create size param
@ 2008-07-24 4:29 akpm
2008-08-10 12:13 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: akpm @ 2008-07-24 4:29 UTC (permalink / raw)
To: torvalds; +Cc: akpm, drepper, davidel, linux-arch, mtk.manpages
From: Ulrich Drepper <drepper@redhat.com>
Remove the size parameter from the new epoll_create syscall and renames the
syscall itself. The updated test program follows.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <fcntl.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <sys/syscall.h>
#ifndef __NR_epoll_create2
# ifdef __x86_64__
# define __NR_epoll_create2 291
# elif defined __i386__
# define __NR_epoll_create2 329
# else
# error "need __NR_epoll_create2"
# endif
#endif
#define EPOLL_CLOEXEC O_CLOEXEC
int
main (void)
{
int fd = syscall (__NR_epoll_create2, 0);
if (fd == -1)
{
puts ("epoll_create2(0) failed");
return 1;
}
int coe = fcntl (fd, F_GETFD);
if (coe == -1)
{
puts ("fcntl failed");
return 1;
}
if (coe & FD_CLOEXEC)
{
puts ("epoll_create2(0) set close-on-exec flag");
return 1;
}
close (fd);
fd = syscall (__NR_epoll_create2, EPOLL_CLOEXEC);
if (fd == -1)
{
puts ("epoll_create2(EPOLL_CLOEXEC) failed");
return 1;
}
coe = fcntl (fd, F_GETFD);
if (coe == -1)
{
puts ("fcntl failed");
return 1;
}
if ((coe & FD_CLOEXEC) == 0)
{
puts ("epoll_create2(EPOLL_CLOEXEC) set close-on-exec flag");
return 1;
}
close (fd);
puts ("OK");
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Acked-by: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/x86/ia32/ia32entry.S | 2 +-
arch/x86/kernel/syscall_table_32.S | 2 +-
fs/eventpoll.c | 18 ++++++++++--------
include/asm-x86/unistd_32.h | 2 +-
include/asm-x86/unistd_64.h | 4 ++--
include/linux/eventpoll.h | 2 +-
include/linux/syscalls.h | 2 +-
7 files changed, 17 insertions(+), 15 deletions(-)
diff -puN arch/x86/ia32/ia32entry.S~flag-parameters-add-on-remove-epoll_create-size-param arch/x86/ia32/ia32entry.S
--- a/arch/x86/ia32/ia32entry.S~flag-parameters-add-on-remove-epoll_create-size-param
+++ a/arch/x86/ia32/ia32entry.S
@@ -745,7 +745,7 @@ ia32_sys_call_table:
.quad compat_sys_timerfd_gettime
.quad compat_sys_signalfd4
.quad sys_eventfd2
- .quad sys_epoll_create2
+ .quad sys_epoll_create1
.quad sys_dup3 /* 330 */
.quad sys_pipe2
.quad sys_inotify_init1
diff -puN arch/x86/kernel/syscall_table_32.S~flag-parameters-add-on-remove-epoll_create-size-param arch/x86/kernel/syscall_table_32.S
--- a/arch/x86/kernel/syscall_table_32.S~flag-parameters-add-on-remove-epoll_create-size-param
+++ a/arch/x86/kernel/syscall_table_32.S
@@ -328,7 +328,7 @@ ENTRY(sys_call_table)
.long sys_timerfd_gettime
.long sys_signalfd4
.long sys_eventfd2
- .long sys_epoll_create2
+ .long sys_epoll_create1
.long sys_dup3 /* 330 */
.long sys_pipe2
.long sys_inotify_init1
diff -puN fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param fs/eventpoll.c
--- a/fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param
+++ a/fs/eventpoll.c
@@ -1046,7 +1046,7 @@ retry:
* RB tree. With the current implementation, the "size" parameter is ignored
* (besides sanity checks).
*/
-asmlinkage long sys_epoll_create2(int size, int flags)
+asmlinkage long sys_epoll_create1(int flags)
{
int error, fd = -1;
struct eventpoll *ep;
@@ -1058,14 +1058,13 @@ asmlinkage long sys_epoll_create2(int si
return -EINVAL;
DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n",
- current, size));
+ current, flags));
/*
- * Sanity check on the size parameter, and create the internal data
- * structure ( "struct eventpoll" ).
+ * Create the internal data structure ( "struct eventpoll" ).
*/
- error = -EINVAL;
- if (size <= 0 || (error = ep_alloc(&ep)) < 0) {
+ error = ep_alloc(&ep);
+ if (error < 0) {
fd = error;
goto error_return;
}
@@ -1081,14 +1080,17 @@ asmlinkage long sys_epoll_create2(int si
error_return:
DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
- current, size, fd));
+ current, flags, fd));
return fd;
}
asmlinkage long sys_epoll_create(int size)
{
- return sys_epoll_create2(size, 0);
+ if (size < 0)
+ return -EINVAL;
+
+ return sys_epoll_create1(0);
}
/*
diff -puN include/asm-x86/unistd_32.h~flag-parameters-add-on-remove-epoll_create-size-param include/asm-x86/unistd_32.h
--- a/include/asm-x86/unistd_32.h~flag-parameters-add-on-remove-epoll_create-size-param
+++ a/include/asm-x86/unistd_32.h
@@ -334,7 +334,7 @@
#define __NR_timerfd_gettime 326
#define __NR_signalfd4 327
#define __NR_eventfd2 328
-#define __NR_epoll_create2 329
+#define __NR_epoll_create1 329
#define __NR_dup3 330
#define __NR_pipe2 331
#define __NR_inotify_init1 332
diff -puN include/asm-x86/unistd_64.h~flag-parameters-add-on-remove-epoll_create-size-param include/asm-x86/unistd_64.h
--- a/include/asm-x86/unistd_64.h~flag-parameters-add-on-remove-epoll_create-size-param
+++ a/include/asm-x86/unistd_64.h
@@ -645,8 +645,8 @@ __SYSCALL(__NR_paccept, sys_paccept)
__SYSCALL(__NR_signalfd4, sys_signalfd4)
#define __NR_eventfd2 290
__SYSCALL(__NR_eventfd2, sys_eventfd2)
-#define __NR_epoll_create2 291
-__SYSCALL(__NR_epoll_create2, sys_epoll_create2)
+#define __NR_epoll_create1 291
+__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
#define __NR_dup3 292
__SYSCALL(__NR_dup3, sys_dup3)
#define __NR_pipe2 293
diff -puN include/linux/eventpoll.h~flag-parameters-add-on-remove-epoll_create-size-param include/linux/eventpoll.h
--- a/include/linux/eventpoll.h~flag-parameters-add-on-remove-epoll_create-size-param
+++ a/include/linux/eventpoll.h
@@ -18,7 +18,7 @@
#include <linux/fcntl.h>
#include <linux/types.h>
-/* Flags for epoll_create2. */
+/* Flags for epoll_create1. */
#define EPOLL_CLOEXEC O_CLOEXEC
/* Valid opcodes to issue to sys_epoll_ctl() */
diff -puN include/linux/syscalls.h~flag-parameters-add-on-remove-epoll_create-size-param include/linux/syscalls.h
--- a/include/linux/syscalls.h~flag-parameters-add-on-remove-epoll_create-size-param
+++ a/include/linux/syscalls.h
@@ -431,7 +431,7 @@ asmlinkage long sys_poll(struct pollfd _
asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
fd_set __user *exp, struct timeval __user *tvp);
asmlinkage long sys_epoll_create(int size);
-asmlinkage long sys_epoll_create2(int size, int flags);
+asmlinkage long sys_epoll_create1(int flags);
asmlinkage long sys_epoll_ctl(int epfd, int op, int fd,
struct epoll_event __user *event);
asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
_
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch 179/322] flag parameters add-on: remove epoll_create size param
2008-07-24 4:29 [patch 179/322] flag parameters add-on: remove epoll_create size param akpm
@ 2008-08-10 12:13 ` Geert Uytterhoeven
2008-08-12 0:00 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2008-08-10 12:13 UTC (permalink / raw)
To: Andrew Morton, Ulrich Drepper
Cc: Linus Torvalds, davidel, linux-arch, mtk.manpages
On Wed, 23 Jul 2008, akpm@linux-foundation.org wrote:
> Remove the size parameter from the new epoll_create syscall and renames the
> syscall itself. The updated test program follows.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> #include <fcntl.h>
> #include <stdio.h>
> #include <time.h>
> #include <unistd.h>
> #include <sys/syscall.h>
>
> #ifndef __NR_epoll_create2
^
The test program still uses __NR_epoll_create2 instead of
__NR_epoll_create1 everywhere.
> diff -puN fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param fs/eventpoll.c
> --- a/fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param
> +++ a/fs/eventpoll.c
> @@ -1046,7 +1046,7 @@ retry:
> * RB tree. With the current implementation, the "size" parameter is ignored
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> * (besides sanity checks).
^^^^^^^^^^^^^^^^^^^^^^^
> */
> -asmlinkage long sys_epoll_create2(int size, int flags)
> +asmlinkage long sys_epoll_create1(int flags)
The function comment was not updated for the removal of the `size'
parameter. Can you please fix that?
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch 179/322] flag parameters add-on: remove epoll_create size param
2008-08-10 12:13 ` Geert Uytterhoeven
@ 2008-08-12 0:00 ` Andrew Morton
2008-08-12 6:51 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2008-08-12 0:00 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: drepper, torvalds, davidel, linux-arch, mtk.manpages
On Sun, 10 Aug 2008 14:13:32 +0200 (CEST)
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Wed, 23 Jul 2008, akpm@linux-foundation.org wrote:
> > Remove the size parameter from the new epoll_create syscall and renames the
> > syscall itself. The updated test program follows.
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > #include <fcntl.h>
> > #include <stdio.h>
> > #include <time.h>
> > #include <unistd.h>
> > #include <sys/syscall.h>
> >
> > #ifndef __NR_epoll_create2
> ^
> The test program still uses __NR_epoll_create2 instead of
> __NR_epoll_create1 everywhere.
Which test program is that?
> > diff -puN fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param fs/eventpoll.c
> > --- a/fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param
> > +++ a/fs/eventpoll.c
> > @@ -1046,7 +1046,7 @@ retry:
> > * RB tree. With the current implementation, the "size" parameter is ignored
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > * (besides sanity checks).
> ^^^^^^^^^^^^^^^^^^^^^^^
> > */
> > -asmlinkage long sys_epoll_create2(int size, int flags)
> > +asmlinkage long sys_epoll_create1(int flags)
>
> The function comment was not updated for the removal of the `size'
> parameter. Can you please fix that?
I did this:
From: Andrew Morton <akpm@linux-foundation.org>
The `size' argument was removed.
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/eventpoll.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff -puN fs/eventpoll.c~fs-eventpollc-fix-sys_epoll_create1-comment fs/eventpoll.c
--- a/fs/eventpoll.c~fs-eventpollc-fix-sys_epoll_create1-comment
+++ a/fs/eventpoll.c
@@ -1041,10 +1041,7 @@ retry:
}
/*
- * It opens an eventpoll file descriptor. The "size" parameter is there
- * for historical reasons, when epoll was using an hash instead of an
- * RB tree. With the current implementation, the "size" parameter is ignored
- * (besides sanity checks).
+ * Open an eventpoll file descriptor.
*/
asmlinkage long sys_epoll_create1(int flags)
{
_
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch 179/322] flag parameters add-on: remove epoll_create size param
2008-08-12 0:00 ` Andrew Morton
@ 2008-08-12 6:51 ` Geert Uytterhoeven
0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2008-08-12 6:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: drepper, torvalds, davidel, linux-arch, mtk.manpages
On Mon, 11 Aug 2008, Andrew Morton wrote:
> On Sun, 10 Aug 2008 14:13:32 +0200 (CEST)
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Wed, 23 Jul 2008, akpm@linux-foundation.org wrote:
> > > Remove the size parameter from the new epoll_create syscall and renames the
> > > syscall itself. The updated test program follows.
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > #include <fcntl.h>
> > > #include <stdio.h>
> > > #include <time.h>
> > > #include <unistd.h>
> > > #include <sys/syscall.h>
> > >
> > > #ifndef __NR_epoll_create2
> > ^
> > The test program still uses __NR_epoll_create2 instead of
> > __NR_epoll_create1 everywhere.
>
> Which test program is that?
The corresponding test program for the sys_epoll_create1() system call, as
present in the commit comments:
commit 9fe5ad9c8cef9ad5873d8ee55d1cf00d9b607df0
Author: Ulrich Drepper <drepper@redhat.com>
Date: Wed Jul 23 21:29:43 2008 -0700
flag parameters add-on: remove epoll_create size param
Remove the size parameter from the new epoll_create syscall and renames the
syscall itself. The updated test program follows.
[ test program ]
> > > diff -puN fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param fs/eventpoll.c
> > > --- a/fs/eventpoll.c~flag-parameters-add-on-remove-epoll_create-size-param
> > > +++ a/fs/eventpoll.c
> > > @@ -1046,7 +1046,7 @@ retry:
> > > * RB tree. With the current implementation, the "size" parameter is ignored
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > * (besides sanity checks).
> > ^^^^^^^^^^^^^^^^^^^^^^^
> > > */
> > > -asmlinkage long sys_epoll_create2(int size, int flags)
> > > +asmlinkage long sys_epoll_create1(int flags)
> >
> > The function comment was not updated for the removal of the `size'
> > parameter. Can you please fix that?
>
> I did this:
>
> From: Andrew Morton <akpm@linux-foundation.org>
>
> The `size' argument was removed.
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Ulrich Drepper <drepper@redhat.com>
> Cc: Davide Libenzi <davidel@xmailserver.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> fs/eventpoll.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff -puN fs/eventpoll.c~fs-eventpollc-fix-sys_epoll_create1-comment fs/eventpoll.c
> --- a/fs/eventpoll.c~fs-eventpollc-fix-sys_epoll_create1-comment
> +++ a/fs/eventpoll.c
> @@ -1041,10 +1041,7 @@ retry:
> }
>
> /*
> - * It opens an eventpoll file descriptor. The "size" parameter is there
> - * for historical reasons, when epoll was using an hash instead of an
> - * RB tree. With the current implementation, the "size" parameter is ignored
> - * (besides sanity checks).
> + * Open an eventpoll file descriptor.
> */
> asmlinkage long sys_epoll_create1(int flags)
> {
> _
>
Looks fine. Thx!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-12 6:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-24 4:29 [patch 179/322] flag parameters add-on: remove epoll_create size param akpm
2008-08-10 12:13 ` Geert Uytterhoeven
2008-08-12 0:00 ` Andrew Morton
2008-08-12 6:51 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox