Tweak the fds test program so that it actually compiles. Also use 0 instead

of -1 for the bogus ioctl command so that dmesg doesn't get spammed with
sign extension warnings when the test program runs.

MFC after:	1 week
This commit is contained in:
markj 2015-02-14 00:03:43 +00:00
parent a9731f30c8
commit 81644b962a
2 changed files with 8 additions and 7 deletions

View File

@ -26,6 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/ioctl.h>
#include <assert.h>
#include <setjmp.h>
#include <signal.h>
@ -69,7 +71,7 @@ main(int argc, char *argv[])
*/
if (sigsetjmp(env, 1) == 0) {
for (;;)
(void) ioctl(-1, -1, NULL);
(void) ioctl(-1, 0, NULL);
}
/*
@ -80,20 +82,19 @@ main(int argc, char *argv[])
fds[n++] = open(file, O_WRONLY);
fds[n++] = open(file, O_RDWR);
fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC |
O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC |
O_SYNC | O_TRUNC | O_XATTR, 0666);
fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT |
O_NOCTTY | O_NONBLOCK | O_NDELAY | O_SYNC | O_TRUNC | 0666);
fds[n++] = open(file, O_RDWR);
(void) lseek(fds[n - 1], 123, SEEK_SET);
/*
* Once we have all the file descriptors in the state we want to test,
* issue a bogus ioctl() on each fd with cmd -1 and arg NULL to whack
* issue a bogus ioctl() on each fd with cmd 0 and arg NULL to whack
* our DTrace script into recording the content of the fds[] array.
*/
for (i = 0; i < n; i++)
(void) ioctl(fds[i], -1, NULL);
(void) ioctl(fds[i], 0, NULL);
assert(n <= sizeof (fds) / sizeof (fds[0]));
exit(0);

View File

@ -36,7 +36,7 @@ syscall::ioctl:entry
}
syscall::ioctl:entry
/pid == $1 && arg0 != -1u && arg1 == -1u && arg2 == NULL/
/pid == $1 && arg0 != -1u && arg1 == 0 && arg2 == NULL/
{
printf("fds[%d] fi_name = %s\n", arg0, fds[arg0].fi_name);
printf("fds[%d] fi_dirname = %s\n", arg0, fds[arg0].fi_dirname);