# io_uring_prep_cmd

## NAME



           io_uring_prep_cmd_sock - prepare a command request for a socket
    


## SYNOPSIS



           **#include <liburing.h>**
    
           **void io_uring_prep_cmd_sock(struct io_uring_sqe ***_sqe_**,**
                                       **int** _cmd_op_**,**
                                       **int** _fd_**,**
                                       **int** _level_**,**
                                       **int** _optname_**,**
                                       **void** _*optval_**,**
                                       **int** _optlen_**);**
    


## DESCRIPTION



           The io_uring_prep_cmd_sock(3) function prepares an cmd request for
           a socket. The submission queue entry _sqe_ is setup to use the
           socket file descriptor pointed to by _fd_ to start an command
           operation defined by _cmd_op._
    
           This is a generic function, and each command has their own
           individual _level, optname, optval_ values.  The optlen defines the
           size pointed by _optval._
    


## Available commands



           **SOCKET_URING_OP_SIOCINQ**
                  Returns the amount of queued unread data in the receive
                  buffer.  The socket must not be in LISTEN state, otherwise
                  an error **-EINVAL** is returned in the CQE _res_ field.  The
                  following arguments are not used for this command _level,_
                  _optname, optval_ and _optlen._
    
                  Negative return value means an error.
    
                  For more information about this command, please check
                  unix(7).
    
                  Available since 6.7.
    
           **SOCKET_URING_OP_SIOCOUTQ**
                  Returns the amount of unsent data in the socket send queue.
                  The socket must not be in LISTEN state, otherwise an error
                  **-EINVAL** is returned in the CQE _res._  field.  The following
                  arguments are not used for this command _level, optname,_
                  _optval_ and _optlen._
    
                  Negative return value means an error.
    
                  For more information about this command, please check
                  unix(7).
    
           **SOCKET_URING_OP_GETSOCKOPT**
                  Command to get options for the socket referred to by the
                  socket file descriptor _fd._  The arguments are similar to
                  the getsockopt(2) system call.
    
                  The **SOCKET_URING_OP_GETSOCKOPT** command is limited to
                  **SOL_SOCKET** _level._
    
                  Differently from the getsockopt(2) system call, the updated
                  _optlen_ value is returned in the CQE _res_ field, on success.
                  On failure, the CQE _res_ contains a negative error number.
    
           **SOCKET_URING_OP_SETSOCKOPT**
                  Command to set options for the socket referred to by the
                  socket file descriptor _fd._  The arguments are similar to
                  the setsockopt(2) system call.
    
                  Available since 6.7.
    


## NOTES



           The memory block pointed by _optval_ needs to be valid/live until
           the CQE returns.
    


## RETURN VALUE



           Dependent on the command.
    


## ERRORS



           The CQE _res_ field will contain the result of the operation.
    


* * *