Re: [PATCH] io_setup.2: SYNOPSIS: return long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-11-02 08:37, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
>
> On 11/1/20 2:59 PM, Alejandro Colomar wrote:
>> The Linux kernel uses a long as the return type for this syscall.
>> As glibc provides no wrapper, use the same types the kernel uses.
>
> I think we need this patch for all of the io* pages, right?

Hi Michael,

For some reason, no.  AFAICS, only io_setup() really uses 'long'.

Then there's io_submit(), which also declares a 'long', but gets that
value from io_submit_one(), which returns an 'int';
we could use either 'long' or 'int'
in the manual page too for this one.

And then there are the others, which use plain 'int'.

See at the end of this email the sources for this answer.

Cheers,

Alex

>
> Thanks,
>
> Michael

fs/aio.c:1312:
SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
{
	struct kioctx *ioctx = NULL;
	unsigned long ctx;
	long ret;
...
	return ret;
}

fs/aio.c:1381:
SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
{
	struct kioctx *ioctx = lookup_ioctx(ctx);
	if (likely(NULL != ioctx)) {
		struct ctx_rq_wait wait;
		int ret;
...
		return ret;
	}
	pr_debug("EINVAL: invalid context id\n");
	return -EINVAL;
}

fs/aio.c:1855:
static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
			 bool compat)


fs/aio.c:1914:
SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
		struct iocb __user * __user *, iocbpp)
{
	struct kioctx *ctx;
	long ret = 0;
	int i = 0;
	struct blk_plug plug;
...
		ret = io_submit_one(ctx, user_iocb, false);
...
	return i ? i : ret;
}

fs/aio.c:2008:
SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
		struct io_event __user *, result)
{
	struct kioctx *ctx;
	struct aio_kiocb *kiocb;
	int ret = -EINVAL;
...

	return ret;
}

fs/aio.c:2084:
SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
		long, min_nr,
		long, nr,
		struct io_event __user *, events,
		struct __kernel_timespec __user *, timeout)
{
	struct timespec64	ts;
	int			ret;
...
	return ret;
}



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux