FD_Alloc()
Synopsis
LONG FD_Alloc(
LONG startfd,
fd_owner_t owner,
APTR data,
LONG * outfd );
Function
Allocate a file descriptor slot for the specified owner.
Result
0 on success, or an errno-style error code.
FD_Free()
Synopsis
LONG FD_Free(
LONG fd,
fd_owner_t owner );
Function
Release one reference to a descriptor slot owned by a specific consumer.
The slot becomes available only when its last reference is released.
Result
0 on success, or an errno-style error code.
FD_GetOwnerHooks()
Synopsis
const struct fd_hooks * FD_GetOwnerHooks(
fd_owner_t owner );
Function
Return the operation hooks registered for an owner.
Result
Pointer to the owner's struct fd_hooks, or NULL if none is registered.
FD_Reserve()
Synopsis
LONG FD_Reserve(
LONG fd,
fd_owner_t owner,
APTR data );
Function
Reserve a specific file descriptor slot for the specified owner.
Result
0 on success, or an errno-style error code.
FD_Retain()
Synopsis
LONG FD_Retain(
LONG fd,
fd_owner_t owner );
Function
Retain an existing descriptor reservation for an independent table
inheriting the same descriptor number. FD_Free releases one reference;
the number remains reserved until the last reference is released.
The owner data pointer is shared by all references to the reservation;
retaining a number does not retain or copy the object it points to.
The owner must keep that object valid until the final FD_Free(), or
use NULL as the owner data. A non-final FD_Free() leaves the data
pointer unchanged. FD_SetData() replaces it for every reference, not
just the calling table. Owners must synchronize data replacement and
object destruction with their hook users under their own lock.
Result
Zero on success, EBADF if the reservation does not match, EINVAL for
FD_OWNER_NONE, or EOVERFLOW if no further reference can be retained.
FD_SetData()
Synopsis
LONG FD_SetData(
LONG fd,
fd_owner_t owner,
APTR data );
Function
Update the owner data for a descriptor slot.
Result
0 on success, or an errno-style error code.
FD_SetOwnerHooks()
Synopsis
LONG FD_SetOwnerHooks(
fd_owner_t owner,
const struct fd_hooks * hooks );
Function
Register (or clear) the operation hooks for an owner. The hooks
describe how read()/write()/close()/lseek()/ioctl()/fcntl()/fstat()
act on descriptors created by that owner.
Result
0 on success, or an errno-style error code.
Notes
The hooks table must remain valid for as long as descriptors owned by
this owner may be accessed; it is stored by reference, not copied.