os2_ioctl()
The os2_ioctl() socket call performs special operations on sockets; in particular,
operations related to returning status from kernel.
Syntax
#include <types.h>
#include <sys\socket.h>
#include <sys\ioctl.h>
#include <net\route.h>
#include <net\if.h>
#include <net\if_arp.h>
int os2_ioctl(s, cmd, data, lendata)
int s;
int cmd;
caddr_t data;
int lendata;
Parameters
s
cmd
data
Pointer to the data buffer associated with cmd
where returned data is placed.
lendata
Length
(in bytes) of the data to be returned in the buffer.
Description
The following os2_ioctl() commands are supported for the internet domain.
The data parameter is a pointer to data associated with the particular
command, and its format depends on the command that is requested.
Option
SIOSTATARP
GetstheARPtable
.Thedataparameterisapointertoanoarptabstructureasdefinedin< NETINET
\ IF _ ETHER . H > .
SIOSTATAT
Getsallinterfaceaddresses
.Thedataparameterisapointertothebufferforreceivingreturneddata .Atreturn
,thefirsttwobytesofthebuffercontainthenumberofreturnedaddresses ,followedbytheaddressinformationforeachinterfaceaddress
.Foreachaddress ,thebuffercontains :
- The IP address, of type unsigned long
An
interface index, of type unsigned short
A netmask, of type unsigned long
The broadcast address, of type unsigned long
SIOSTATIF
Gets
interface statistics. The data parameter is a pointer to an ifmib
structure as defined in <NET\IF.H>.
SIOSTATIF42
Gets interface statistics for all interfaces (maximum
of 42). The data parameter is a pointer to sequential instances of
an ifmib structure as defined in <NET\IF.H>.
SIOSTATRT
Gets routing entries from the routing table. The
data parameter is a pointer to an rtentries structure as defined
in <NET\ROUTE.H>.
SIOSTATSO
Gets
sockets' statistics. The data parameter is a pointer to sequential
instances of a sostats structure as defined in <SYS\SOCKET.H>.
Return Values
The value 0 indicates success; the value -1 indicates an error. You can
get the specific error code by calling sock_errno() or psock_errno().
sock_errno() Value
SOCENOTSOCK
Thesparameterisnotavalidsocketdescriptor
.
SOCEINVAL
Therequestisnotvalidornotsupported
.
SOCEOPNOTSUPP
Theoperationisnotsupportedonthesocket
.
SOCEFAULT
Usingdataandlendatawouldresultinanattempttoaccessmemoryoutsidethecalleraddressspace
.
Examples
The following is an example of the os2_ioctl() call.
int s;char buf [1024];
int rc;
int os2_ioctl(int s, int cmd, caddr_t data, int lendata); /* extracted from sys\socket.h */
...
rc = os2_ioctl(s, SIOSTATAT, (char *) buf, sizeof(buf));
...
Related Calls
[Back: listen()]
[Next: os2_select()]