Subject: Possible ioctl() bug.
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Greg Cronau <gregc@edi.com>
List: current-users
Date: 05/23/1994 08:03:21
I am currently using a version of -current built from the 4/6 tarfiles.
I am porting a project that was orriginally designed under SYSVr3. We
were using the SIGPOLL signal to catch when connection attempts were
comming in on a particular socket. I've changed that piece of code
to use BSD's SIGIO capibility. At first I did 2 fcntl() calls to set
F_SETOWN for the process and then to F_SETFL the FASYNC flag, but this
didn't seem to work. So I tried recoding it to use the ioctl() versions
instead. I am running into something funny and I'm not sure whether it's
my own fault or a kernel bug. The following line of code works fine:
	ioctl(fd, FIOASYNC, 0);
Where fd is a file descriptor returned from a call to socket(). However,
the following piece of code:
	ioctl(fd, FIOASYNC, 1);
returns -1 with errno set to EFAULT. EFAULT is not listed in the man
pages as a possible return value from ioctl(). I've looked through the
kernel source, but don't see anything obviously wrong with the ioctl()
handling code, but I'm no expert in this area.

Anybody got any ideas?
Gregc@edi.com


------------------------------------------------------------------------------