All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] sys_epoll ...
@ 2002-10-21  0:16 Davide Libenzi
  2002-10-21  0:50 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Davide Libenzi @ 2002-10-21  0:16 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Hanna Linder


Per Linus request I implemented a syscall interface to the old /dev/epoll
to avoid the creation of magic inodes inside /dev. Since the new
implementation shares 95% of the code with the old one, the old interface
is maintained for compatibility with existing users. The new syscall
interface adds three system calls ( Linus doesn't like multiplexing ) :


#define EP_CTL_ADD 1
#define EP_CTL_DEL 2
#define EP_CTL_MOD 3

asmlinkage int sys_epoll_create(int maxfds);
asmlinkage int sys_epoll_ctl(int epfd, int op, int fd, unsigned int events);
asmlinkage int sys_epoll_wait(int epfd, struct pollfd **events, int timeout);


The function sys_epoll_create() creates a sys_epoll "object" by allocation
space for "maxfds" descriptors. The sys_epoll "object" is basically a
file descriptor, and this enable the new interface to :

1) Mantain compatibility with the existing interface
2) Avoid the creation of a sys_epoll_close() syscall
3) Reuse 95% of the existing code
4) Inherit the file* automatic cleanup code w/out having to code a
	dedicated one

The function sys_epoll_ctl() is the controller interface and what it does
is pretty obvious. The "op" parameter is either EP_CTL_ADD, EP_CTL_DEL or
EP_CTL_MOD and the parameter "fd" is the target of the operation. The last
parameter "events" is used in both EP_CTL_ADD and EP_CTL_MOD and rapresent
the event interest mask. The function sys_epoll_wait() waits for events by
allowing a maximum timeout "timeout" in milliseconds and returns the
number of events ( struct pollfd ) that the caller will find available at
"*events". The port of the old /dev/epoll to 2.5.44 and the new sys_epoll
are available at :

http://www.xmailserver.org/linux-patches/nio-improve.html#patches




- Davide





^ permalink raw reply	[flat|nested] 9+ messages in thread
* re: [patch] sys_epoll ...
@ 2002-10-21  7:05 Dan Kegel
  2002-10-21 17:10 ` Davide Libenzi
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Kegel @ 2002-10-21  7:05 UTC (permalink / raw)
  To: linux-kernel, Davide Libenzi

Davide wrote:
 >asmlinkage int sys_epoll_create(int maxfds);
 >asmlinkage int sys_epoll_ctl(int epfd, int op, int fd, unsigned int events);
 >asmlinkage int sys_epoll_wait(int epfd, struct pollfd **events, int timeout);

Hey Davide,
I've always been a bit bothered by the need to specify maxfds in
advance.  What's the preferred way to handle the situation
where you guess wrong on the value of maxfds?  Create a new
epoll and register all the old fds with it?  (Sounds like
a good job for a userspace wrapper library.)

Regardless, thanks for pushing /dev/epoll along towards inclusion
in 2.5.  I'm looking forward to seeing it it integrated.
Even if the interface doesn't please everyone, the performance
should...
- Dan


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-10-21 16:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-21  0:16 [patch] sys_epoll Davide Libenzi
2002-10-21  0:50 ` Andrew Morton
2002-10-21  1:28   ` Davide Libenzi
2002-10-21  1:54   ` Davide Libenzi
2002-10-21  2:01     ` Andrew Morton
2002-10-21  2:18       ` Davide Libenzi
2002-10-21  3:34   ` Davide Libenzi
  -- strict thread matches above, loose matches on Subject: below --
2002-10-21  7:05 Dan Kegel
2002-10-21 17:10 ` Davide Libenzi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.