Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zlz6tZ9ba8DtfHK8@LQ3V64L9R2>
Date: Sun, 2 Jun 2024 16:05:25 -0700
From: Joe Damato <jdamato@...tly.com>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] sys/epoll.h: add epoll ioctls

On Wed, May 29, 2024 at 08:11:13AM -0700, Joe Damato wrote:
> On Wed, May 29, 2024 at 09:17:07AM -0400, Rich Felker wrote:
> > On Wed, May 29, 2024 at 06:49:59AM +0000, Joe Damato wrote:
> > > add two ioctls to get and set struct epoll_params to allow users to
> > > control epoll based busy polling of network sockets.
> > > 
> > > added to uapi in commit 18e2bf0edf4dd88d9656ec92395aa47392e85b61 (Linux
> > > kernel 6.9 and newer).
> > > ---
> > >  include/sys/epoll.h | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > > 
> > > diff --git a/include/sys/epoll.h b/include/sys/epoll.h
> > > index ac81a841..5f975c4a 100644
> > > --- a/include/sys/epoll.h
> > > +++ b/include/sys/epoll.h
> > > @@ -7,6 +7,7 @@ extern "C" {
> > >  
> > >  #include <stdint.h>
> > >  #include <sys/types.h>
> > > +#include <sys/ioctl.h>
> > >  #include <fcntl.h>
> > >  
> > >  #define __NEED_sigset_t
> > > @@ -54,6 +55,17 @@ __attribute__ ((__packed__))
> > >  #endif
> > >  ;
> > >  
> > > +struct epoll_params {
> > > +	uint32_t busy_poll_usecs;
> > > +	uint16_t busy_poll_budget;
> > > +	uint8_t prefer_busy_poll;
> > > +
> > > +	uint8_t __pad;
> > > +};
> > > +
> > > +#define EPOLL_IOC_TYPE 0x8A
> > > +#define EPIOCSPARAMS _IOW(EPOLL_IOC_TYPE, 0x01, struct epoll_params)
> > > +#define EPIOCGPARAMS _IOR(EPOLL_IOC_TYPE, 0x02, struct epoll_params)
> > >  
> > >  int epoll_create(int);
> > >  int epoll_create1(int);
> > > -- 
> > > 2.34.1
> > 
> > This is probably okay, but we should at least ask if sys/ioctl.h is
> > going to be a namespace mess. Is the intent to bring all of it in, or
> > just to get the EPIOC* macros which depend on _IOW and _IOR?
> 
> Yes, sys/ioctl.h is pulled in for the _IOW and _IOR macros.
> Similar to, for example, sys/mtio.h in musl, which also pulls in
> sys/ioctl.h.
> 
> > On glibc, does it pull in sys/ioctl.h?
> 
> Yes, the code I've submit for glibc does pull in sys/ioctl.h.
> 
> That code has been approved by a glibc committer, but not yet merged
> to the tree (I assume that will happen in a few days):
> 
> https://sourceware.org/pipermail/libc-alpha/2024-May/157166.html

Just wanted to follow up on the above.

Were you expecting me to make any changes or did you want to wait
until libc takes the code before accepting it?

FWIW:

uclibc has taken the patch here: 
  https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=8bb33a2e1f2baec2078581d77e181f1ead5f51aa

And musl has similar code in include/sys/mount.h:
  https://git.musl-libc.org/cgit/musl/tree/include/sys/mount.h#n8

Thanks,
Joe

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.