1io_uring_prep_socket(3)         liburing Manual        io_uring_prep_socket(3)
2
3
4

NAME

6       io_uring_prep_socket - prepare a socket creation request
7

SYNOPSIS

9       #include <sys/socket.h>
10       #include <liburing.h>
11
12       void io_uring_prep_socket(struct io_uring_sqe *sqe,
13                                 int domain,
14                                 int type,
15                                 int protocol,
16                                 unsigned int flags);
17
18       void io_uring_prep_socket_direct(struct io_uring_sqe *sqe,
19                                        int domain,
20                                        int type,
21                                        int protocol,
22                                        unsigned int file_index,
23                                        unsigned int flags);
24
25       void io_uring_prep_socket_direct_alloc(struct io_uring_sqe *sqe,
26                                        int domain,
27                                        int type,
28                                        int protocol,
29                                        unsigned int flags);
30

DESCRIPTION

32       The  io_uring_prep_socket(3)  function  prepares  a socket creation re‐
33       quest. The submission queue entry sqe is setup to use the communication
34       domain defined by domain and use the communication type defined by type
35       and the protocol set by protocol.  The flags argument are currently un‐
36       used.
37
38       The   io_uring_prep_socket_direct(3)  helper  works  just  like  io_ur‐
39       ing_prep_socket(3), except it maps the socket to  a  direct  descriptor
40       rather  than  return  a normal file descriptor. The file_index argument
41       should be set to the slot that should be used for this socket.
42
43       The io_uring_prep_socket_direct_alloc(3) helper works just like  io_ur‐
44       ing_prep_socket_alloc(3),  except  it allocates a new direct descriptor
45       rather than pass a free slot in.  It  is  equivalent  to  using  io_ur‐
46       ing_prep_socket_direct(3)  with IORING_FILE_INDEX_ALLOC as the file_in‐
47       dex .  Upon completion, the res field of the CQE will return the direct
48       slot that was allocated for the socket.
49
50       If the direct variants are used, the application must first have regis‐
51       tered a file table using io_uring_register_files(3) of the  appropriate
52       size.  Once  registered,  a  direct socket request may use any entry in
53       that table, as long as it is within the size of the  registered  table.
54       If  a  specified  entry already contains a file, the file will first be
55       removed from the table and closed. It's consistent with the behavior of
56       updating an existing file with io_uring_register_files_update(3).
57
58       For  a direct descriptor socket request, the file_index argument can be
59       set to IORING_FILE_INDEX_ALLOC, In this case a free entry  in  io_uring
60       file  table  will  be used automatically and the file index will be re‐
61       turned as CQE res.  -ENFILE is otherwise returned if there is  no  free
62       entries in the io_uring file table.
63
64       These  functions  prepare an async socket(2) request. See that man page
65       for details.
66
67

RETURN VALUE

69       None
70

ERRORS

72       The CQE res field will contain the result of the operation. See the re‐
73       lated man page for details on possible values. Note that where synchro‐
74       nous system calls will return -1 on failure and set errno to the actual
75       error value, io_uring never uses errno.  Instead it returns the negated
76       errno directly in the CQE res field.
77

SEE ALSO

79       io_uring_get_sqe(3), io_uring_submit(3), socket(2)
80
81
82
83liburing-2.2                     May 27, 2022          io_uring_prep_socket(3)
Impressum