ioctl()--Perform I/O Control Request


  Syntax
 #include <sys/types.h>
 #include <sys/ioctl.h>

 int ioctl(int descriptor,
           unsigned long request,
    ...);

  Service Program Name: QP0LLIB1

  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes

The ioctl() function performs control functions (requests) on a descriptor.


Parameters

descriptor
(Input) The descriptor on which the control request is to be performed.

request
(Input) The request that is to be performed on the descriptor.

...
(Input) A variable number of optional parameters that are dependent on the request.

The ioctl() requests that are supported are:


Authorities

The user profile for the thread must have *IOSYSCFG special authority to issue any of the following requests: SIOCADDRT, SIOCDELRT, SIOCADDRT6 and SIOCDELRT6.

Return Value

0
ioctl() was successful
-1
ioctl() was not successful. The errno global variable is set to indicate the error.

Error Conditions

If ioctl() is not successful, errno usually indicates one of the following errors. Under some conditions, errno could indicate an error other than those listed here.

If interaction with a file server is required to access the object, errno could also indicate one of the following errors:



Error Messages

The following messages may be sent from this function:



Usage Notes

  1. This function will fail with error code [ENOTSAFE] when all the following conditions are true:

    • Where multiple threads exist in the job.
    • The object on which this function is operating resides in a file system that is not threadsafe. Only the following file systems are threadsafe for this function:

      • "Root" (/)
      • QOpenSys
      • User-defined
      • QNTC
      • QSYS.LIB
      • Independent ASP QSYS.LIB
      • QOPT
      • Network File System
      • QFileSvr.400

  2. QDLS File System Differences

    QDLS does not support ioctl().

  3. QOPT File System Differences

    QOPT does not support ioctl().

  4. The interface (line description) name has been extended to allow a VLAN ID to be appended for SIOCGIFLIND, SIOCADDRT6, and SIOCDELRT6. To specify a particular interface with a VLAN ID, append a dot followed by the VLAN ID (1 to 4094 inclusive) to the end of the interface name ( "linename.vlanid").

    If any interface name contains a dot the following convention will be used:
    • The whole string, including the dot, will initially be treated as the interface name.
    • If no such interface exists, all characters following the last dot will be treated as a VLAN ID.

    For example vethline.1 will initially look for the interface 'vethline.1'. If this interface does not exist, it will look for the interface 'vethline' with a VLAN ID of 1.

Related Information


API introduced: V3R1