| If by "file-id" you mean file descriptors, you can use the
getdtablesize(2) system call to get the size of file descriptor
table. It is guaranteed to be a minimum of 64 entries and
will typically be 4096. I believe there is a parameter that
can be used to change the size.
For each open file, socket, pipe, etc, there is a file
descriptor. This descriptor refers to an entry in the
process' file table (struct file). Depending on the
implementation, the system will keep the whole system
wide file table as a list or array.� Quoting the comments
in /usr/include/sys/file.h:
"One file structure is allocated for each open/creat/pipe
call. Main use is to hold the read/write pointer associated
with each open file."
Among the fields of the data structure are function pointers
for handling the read, write, ioctl, select and close functions
specific to the type of type, an address that points to the
data structure for handling the rest of the file information;
a vnode, socket data structure, or whatever else is appropriate,
credentials, etc.
Since the introduction of the Network File System, most UNIX
systems have supported at least two different kinds of file
systems; a local one for disks and NFS. Over the years many
others have been added. Digital UNIX supports UFS and AdvFS for
local read/write use, NFS for network use, CDFS for ISO-9660
CDROM, and other specialized ones (procfs for example).
The vnode interface generalizes the interface between the
the high level file interface and the multiple lower level
file system specific interfaces. Like the (struct file),
the vnode data structure contains function pointers for all
the different of file system operations. The vnode layer
calls the appropriate function for the operation desired.
I don't know if the size of the vnode table is fixed or
dyamic. Older UNIX systems made it fixed, but OSF/1 went
to a lot of work to make such tables dynamic.
The inode is an on-disk data structure used for files on UFS,
which is an implementation of the Berkeley Fast File System.
The number of inodes available on a file system is specific
to an instance of that file system. The space of the file
system is divided into groups of cylinder, with each group
having an area of inodes. The size of the area is fixed when
the file system is created, though the size can vary some.
Typically each cylinder group may have 2048 inodes, but this
is an adjustable parameter when the file system is created.
The limit on inodes then is the product of the number of inodes
per group and the number of cylinder groups.
AdvFS has a comparible data structure that isn't called inode,
which is a bit more dynamic. The number of these data structure
is limited as people using for News have found out, but with
careful planning up front and regular maintenance, it can handle
the growth of many file creation loads.
|