io_uring_prep_listen(3)

πŸ’– io_uring_prep_listen β€” the liburing manual, but make it cute πŸ’–

okay bestie, gather round, because today we're learning how to prepare a listen request and honestly? it's giving main character energy. this page lives in the liburing manual and it's about io_uring_prep_listen(3). no cap. ✨


✨ NAME ✨

io_uring_prep_listen β€” prepare a listen request πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <sys/socket.h>
#include <liburing.h>

void io_uring_prep_listen(struct io_uring_sqe *sqe,
                          int sockfd,
                          intbacklog);

🌸 DESCRIPTION 🌸

so the io_uring_prep_listen(3) function prepares a listen request. that's it, that's the vibe. πŸ’…

what actually happens: the submission queue entry sqe gets set up so that the socket file descriptor pointed to by sockfd gets placed into a state where it can accept incoming connections. yes queen, it's opening the door and putting out the welcome mat. 🫢

the parameter backlog defines the maximum length of the queue of pending connections. that's how many besties can be waiting in line before things get messy. 😭

basically this function prepares an async listen(2) request. so if you want the deets, go read that man page, because it's the whole lore. πŸ“–βœ¨


πŸ‘‘ RETURN VALUE πŸ‘‘

None. literally nothing. it returns void, she said what she said. πŸ’€


πŸ’œ ERRORS πŸ’œ

the CQE res field is where the result of the operation shows up, so look there. the related man page has all the details on possible values, iykyk. πŸ”₯

now listen closely because this part is important, no skimming:

where synchronous system calls will return -1 on failure and set errno to the actual error value, io_uring never uses errno. instead it returns the negated errno directly in the CQE res field. periodt. 🎯

🌈 SEE ALSO 🌈


and that's the whole page, bestie, we ate and left no crumbs. πŸ“ this was liburing-2.7, dated Jun 3, 2024, and the title of the whole vibe is io_uring_prep_listen(3). mwah, bye, go prep some listens. πŸ’–πŸ§šβ­

πŸ“¦ where this page comes from