Chapter Contents |
Previous |
Next |
ioctl |
Portability: | UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
PORTABILITY | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <sys/types.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <if.h> int ioctl(int s, unsigned long cmd, void *data);
DESCRIPTION |
ioctl
controls or queries the operating characteristics of socket descriptor
s
.
data
points to the data that are associated with command
cmd
.
The following commands are valid:
FIONBIO
s
, and
data
points to an integer. If
*data
is
0
,
ioctl
clears
non-blocking I/O. If
*data
is not
0
,
s
is set for non-blocking I/O. Calls that cannot
complete immediately return a
-1
with
errno
set
to
EWOULDBLOCK
.
FIONREAD
s
;
data
points to an integer, which is set to the number of readable characters
for
s
.
SIOCATMARK
s
is pointing to out-of-band data.
data
points to an integer, which is set to
1
if
s
points to
out-of-band data. Otherwise,
*data
is set to
0
.
Use this option for TCP sockets where out-of-band data are delivered inline.
Refer to "Out-of-Band Data" in Chapter 6, "Berkeley Sockets," in UNIX
Network Programming.
SIOCGIFADDR
data
points to an
ifreq
structure that is defined in
<if.h>
. The address is returned in the
if_addr
field.
SIOCGIFBRDADDR
data
points to an
ifreq
structure that is defined in
<if.h>
. The address is returned in the
if_broadaddr
field.
SIOCGIFCONF
data
points to an
ifconf
structure that is defined
in
<if.h>
. On input,
the structure specifies a buffer into which the list is placed. The
ifc_buf
field should point to
the buffer. The
ifc_len
field should contain its length in bytes.
SIOCGIFDSTADDR
data
points to
an
ifreq
structure that
is defined in
<if.h>
.
For point-to-point connections, this option stores the address of the remote
interface or destination. The address is stored in the
if_dstadaddr
field.
SIOCGIFFLAGS
data
points to an
ifreq
structure that is defined in
<if.h>
. The flags provide information about
the interface and its current state, such as whether the interface is point-to-point
and whether it is currently up. The flags are stored in the
ifr_flags
field of the
ifreq
structure. The names of the flags begin
with IFF; they are listed in the
<if.h>
header
file.
SIOCGIFNETMASK
data
points to an
ifreq
structure that is defined
in
<if.h>
. The address
is returned in the
if_addr
field.
Note:
If integrated sockets are in use, the
ioctl
function simply calls the
w_ioctl
USS system call.
RETURN VALUE |
If
ioctl
succeeds, it returns a
0
. Otherwise, it returns a
-1
, and sets
errno
to indicate the type of error.
PORTABILITY |
ioctl
is portable to other environments, including most UNIX systems,
that implement BSD sockets. Unlike the BSD UNIX
ioctl
call, the SAS/C version of
ioctl
controls only sockets.
RELATED FUNCTIONS |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.