cannot reach xfs_ioctl

Love Hörnquist-Åstrand lha at stacken.kth.se
Tue Jun 23 19:53:48 CEST 1998


Naomaru Itoi <itoi at eecs.umich.edu> writes:

> xfs_vnodeops.c : xfs_ioctl().  But the function does not seem to be
> called when I call ioctl() system call.  
> 
> rv = ioctl(fd, 1, buf_io);
> 
> fd is an opened file descriptor on arla file.  
> ioctl() returns with errno=25 (NOTTY).  

Hmmm, shouldn't you do something like:

#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>

int main(void)
{
    int fd, ret;
    
    fd = open("/afs/stacken.kth.se/home/lha/.bash_profile", O_RDONLY);
    if (fd < 0)
	err(1, "open");

    ret = ioctl(fd, FIOCLEX);
    if (ret)
	err(1, "ioctl");

    printf("ioctl(fd, FIOCLEX) --> %d\n", ret);
    close(fd);
    return 0;
}

datan:~>./foo
ioctl(fd, FIOCLEX) --> 0

Guess you have to use those IO macros. Like

   rv = ioctl(fd, _IO('f', 1), buf_io);

or am I missing something.


Love







More information about the Arla-drinkers mailing list