• Jens Axboe's avatar
    io_uring: add ->show_fdinfo() for the io_uring file descriptor · 87ce955b
    Jens Axboe authored
    It can be hard to know exactly what is registered with the ring.
    Especially for credentials, it'd be handy to be able to see which
    ones are registered, what personalities they have, and what the ID
    of each of them is.
    
    This adds support for showing information registered in the ring from
    the fdinfo of the io_uring fd. Here's an example from a test case that
    registers 4 files (two of them sparse), 4 buffers, and 2 personalities:
    
    pos:	0
    flags:	02000002
    mnt_id:	14
    UserFiles:	4
        0: file-no-1
        1: file-no-2
        2: <none>
        3: <none>
    UserBufs:	4
        0: 0x563817c46000/128
        1: 0x563817c47000/256
        2: 0x563817c48000/512
        3: 0x563817c49000/1024
    Personalities:
        1
    	Uid:	0		0		0		0
    	Gid:	0		0		0		0
    	Groups:	0
    	CapEff:	0000003fffffffff
        2
    	Uid:	0		0		0		0
    	Gid:	0		0		0		0
    	Groups:	0
    	CapEff:	0000003fffffffff
    Suggested-by: default avatarJann Horn <jannh@google.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    87ce955b
io_uring.c 164 KB