1 /* Tests for the VND driver API. Part of testvnd.sh. */
11 * For now, just test the most dreaded case: the driver being told to use the
12 * file descriptor used to configure the device. Without appropriate checks,
13 * this would cause a deadlock in VFS, since the corresponding filp object is
14 * locked to perform the ioctl(2) call when VFS gets the copyfd(2) back-call.
17 main(int argc
, char **argv
)
23 fprintf(stderr
, "usage: %s /dev/vnd0\n", argv
[0]);
27 if ((fd
= open(argv
[1], O_RDONLY
)) < 0) {
32 memset(&vnd
, 0, sizeof(vnd
));
34 if (ioctl(fd
, VNDIOCCLR
, &vnd
) < 0) {
35 perror("ioctl(VNDIOCCLR)");
41 if (ioctl(fd
, VNDIOCSET
, &vnd
) >= 0) {
42 fprintf(stderr
, "ioctl(VNDIOCSET): unexpected success\n");
47 perror("ioctl(VNDIOCSET)");