1 Overview of the filedescriptor subsystem
2 Adrian Chadd <adrian@creative.net.au>
4 $Id: fd-management.txt 6 2005-09-10 01:02:21Z nenolod $
10 The filedescriptor list is managed through the routines in fdlist.c .
13 fd_open() - tag an FD as "open" and active
14 fd_close() - tag an FD as "closed" and close() the filedescriptor
15 fd_note() - update the filedescriptor tag
17 You can get the current list of open filedescriptors through /stats F as
25 The FD list support is very alpha. There are a few lists defined:
27 typedef enum fdlist_t {
36 FDLIST_NONE Not on any list (ie close()d)
37 FDLIST_SERVICE A service - listen() sockets, resolver, etc
38 FDLIST_SERVER Server connections
39 FDLIST_IDLECLIENT An idle client
40 FDLIST_BUSYCLIENT A busy client
41 FDLIST_MAX Used for bounds checking
43 The idea is that the SERVICE sockets need polling frequently, the SERVER
44 sockets also need polling frequently, BUSYCLIENT is for busy clients
45 which need frequent polling (eg we're trying to write to them), and
46 IDLECLIENT is for clients which we don't need to poll frequently.
47 THIS hasn't been decided upon yet.
54 The file operations are also wrapped through file_open() and file_close()
55 which handle calling fd_open() / fd_close() and tracking the filedescriptors
56 correctly. fbopen() / fbclose() use file_open() / file_close() too.
58 fileio.c defines the functions:
61 file_open(const char *filename, int mode, int fmode)
63 A wrapper around open(filename, flags, mode). Read the open manpage for
64 information. file_open() enforces filedescriptor limits and tags the FD
70 A wrapper around close() for files. close() handles fd_close()ing the fd.
74 fbopen(const char *filename, const char *mode)
79 These are the 'buffered disk IO' routines. You can read the code yourself.
80 Note that these routines use file_open() and file_close().