The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Filesys::POSIX::FdTable - File descriptor table

DESCRIPTION

This internal module used by Filesys::POSIX handles the allocation and tracking of numeric file descriptors associated with inodes opened for I/O. It does not intend to expose any public interfaces.

METHODS

Filesys::POSIX::FdTable->new

Create a new file descriptor table object. Returns a blessed hash.

$fd_table->open($inode, $flags)

Asks the $inode object to open and return a Filesys::POSIX::IO::Handle object. Accepts flags as defined in Filesys::POSIX::Bits. A reference to the inode, file handle, flags passed will be stored.

Returns a unused file descriptor number greater than 2, unique to the current file descriptor table, upon success. Possible exceptions may be thrown:

  • ENODEV (No such device or address)

    Could not open a file handle for the inode passed.

$fd_table->lookup($fd)

Given a file descriptor number, return the file descriptor table entry stored; such an object contains an inode reference, a file handle reference, and the flags with which the file was opened. Possible exceptions include:

  • EBADF (Bad file descriptor)

    No handle found for the given file descriptor.

$fd_table->close($fd)

Close the file handle corresponding to the given file descriptor, and remove the file descriptor from the table, freeing it for future reallocation.

$fd_table->list

Return a list of all file descriptor numbers currently allocated.

AUTHOR

Written by Xan Tronix <xan@cpan.org>

CONTRIBUTORS

Rikus Goodell <rikus.goodell@cpanel.net>
Brian Carlson <brian.carlson@cpanel.net>

COPYRIGHT

Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.