Subject: Re: Possible ioctl() bug.
To: None <mycroft@gnu.ai.mit.edu>
From: Greg Cronau <gregc@edi.com>
List: current-users
Date: 05/23/1994 10:30:04
mycroft@gnu.ai.mit.edu
>
>
> 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.
>
>You're supposed to make the third argument a *pointer*. Something like:
>
>int one = 1;
>ioctl(fd, FIOASYNC, &one);
>
>I'm not sure why it would work at all with a null pointer. Perhaps
>you're misinterpreting.
Ack, ok that fixed it. The manual page lists that param as a "char *",
but the func decl lists it as "...". Also, the Steven's books list it
as "char *", but make the statement that "none of the arguments actually
are char *. They have tables listing the arguments and FIOASYNC lists as
"int". The inference is that the ioctl macros provide information on the
size of the argument. Kinda confusing.
Thanks
Gregc@edi.com
------------------------------------------------------------------------------