[PATCH v2] ioctl: implement NBD_* ioctl decoding

Dmitry V. Levin ldv at altlinux.org
Sat Sep 22 10:43:14 UTC 2018


On Sat, Sep 22, 2018 at 11:50:32AM +0200, Elvira Khabirova wrote:
> * Makefile.am (strace_SOURCES): Add nbd_ioctl.c.
> * configure.ac (AC_CHECK_HEADERS): Add linux/nbd.h.
> * defs.h (DECL_IOCTL): Add nbd.
> * ioctl.c (ioctl_decode): Add 0xab (nbd) case.
> * nbd_ioctl.c: New file.
> * xlat/nbd_ioctl_cmds.in: Likewise.
> * xlat/nbd_ioctl_flags.in: Likewise.
> * tests/ioctl_nbd.c: Likewise.
> * tests/.gitignore: Add ioctl_nbd.
> * tests/gen_tests.in: Likewise.
> * tests/pure_executables.list: Likewise.

First of all, thanks for contributing new parser with a test,
I wish others would follow your example.

[...]
> +	sock = socket(AF_UNIX, SOCK_STREAM, 0);
> +	if (sock != -1) {
> +		ioctl(-1, NBD_SET_SOCK, sock);
> +		printf("ioctl(-1, NBD_SET_SOCK, %d<UNIX:[%lu]>)" RVAL_EBADF,
> +		       sock, inode_of_sockfd(sock));
> +	}

As the test relies on strace -yy and therefore requires /proc, please add
something like skip_if_unavailable("/proc/self/fd/") like in other -yy tests.


-- 
ldv


More information about the Strace-devel mailing list