File: io_getcookie.3

package info (click to toggle)
libowfat 0.34-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,288 kB
  • sloc: ansic: 20,181; makefile: 16
file content (23 lines) | stat: -rw-r--r-- 783 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.TH io_getcookie 3
.SH NAME
io_getcookie \- retrieve cookie
.SH SYNTAX
.B #include <libowfat/io.h>

void* \fBio_getcookie\fP(int64 fd);
.SH DESCRIPTION
io_getcookie retrieves a cookie (pointer to some anonymous data
structure you associated with this descriptor).

Use io_setcookie(3) to associate a cookie with a descriptor.

If you did not associate a cookie with this descriptor, io_getcookie
returns NULL.

The idea is that you put the state associated with a TCP connection you
serve in a common struct.  Then you do not need to have your own data
structure to retrieve the state for a connection, you can just use the
data structure io_wait already maintains.  The lookup works in constant
time and should not cause any cache misses.
.SH "SEE ALSO"
io_wait(3), io_setcookie(3)