Re: [PATCH v3] io_uring: Add io_uring command support for sockets

From: Breno Leitao
Date: Fri Jun 23 2023 - 11:55:58 EST


On Fri, Jun 23, 2023 at 08:39:02AM +0200, Greg KH wrote:
> On Thu, Jun 22, 2023 at 02:59:14PM -0700, Breno Leitao wrote:
> > --- a/io_uring/uring_cmd.c
> > +++ b/io_uring/uring_cmd.c
> > @@ -7,6 +7,7 @@
> > #include <linux/nospec.h>
> >
> > #include <uapi/linux/io_uring.h>
> > +#include <uapi/asm-generic/ioctls.h>
>
> Is this still needed?

Yes, this is what is providing the definitions for SIOCINQ and SIOCOUTQ.
If we don't include these headers, we get the following compilation
failure:

In file included from ./include/linux/socket.h:7,
from ./include/net/af_unix.h:5,
from io_uring/rsrc.h:5,
from io_uring/uring_cmd.c:12:
io_uring/uring_cmd.c: In function ‘io_uring_cmd_sock’:
./include/uapi/linux/sockios.h:26:18: error: ‘FIONREAD’ undeclared (first use in this function); did you mean ‘READ’?
#define SIOCINQ FIONREAD
^~~~~~~~
io_uring/uring_cmd.c:171:32: note: in expansion of macro ‘SIOCINQ’
ret = sk->sk_prot->ioctl(sk, SIOCINQ, &arg);
^~~~~~~
./include/uapi/linux/sockios.h:26:18: note: each undeclared identifier is reported only once for each function it appears in
#define SIOCINQ FIONREAD
^~~~~~~~
io_uring/uring_cmd.c:171:32: note: in expansion of macro ‘SIOCINQ’
ret = sk->sk_prot->ioctl(sk, SIOCINQ, &arg);
^~~~~~~
./include/uapi/linux/sockios.h:27:18: error: ‘TIOCOUTQ’ undeclared (first use in this function); did you mean ‘SIOCOUTQ’?
#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */
^~~~~~~~
io_uring/uring_cmd.c:176:32: note: in expansion of macro ‘SIOCOUTQ’
ret = sk->sk_prot->ioctl(sk, SIOCOUTQ, &arg);
^~~~~~~~
make[2]: *** [scripts/Makefile.build:252: io_uring/uring_cmd.o] Error 1