Info

#define _NFDBITS (8 * sizeof(unsigned long))

#define _FD_SETSIZE 1024

#define _FDSET_LONGS (_FD_SETSIZE/_NFDBITS)

typedef struct {

unsigned long fds_bits [_FDSET_LONGS];

typedef _kernel_fd_set fd_set;

Note that struct embedded_fd_set can be typecast into struct fd_set. In this sense, embedded_fd_set is a shrunken version of fd_set that can be used in the same way but requires less space.

If one of the initial limits for the bitmaps or the fd array is too low, the kernel can expand the relevant elements by making the pointers point to correspondingly larger structures. The arrays are expanded in different steps — this explains why there are different maximum values for the descriptor numbers and file elements in the structure.

One component used for the definition of files_struct still needs to be discussed: struct file. The structure holds characteristic information on a file as seen by the kernel. Slightly simplified, it is defined as follows:

Continue reading here: Info

Was this article helpful?

0 0