fd
| FD_Alloc() | FD_Check() | FD_Free() | FD_GetData() |
| FD_GetOwner() | FD_GetOwnerHooks() | FD_Reserve() | FD_SetData() |
| FD_SetOwnerHooks() |
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.
Inputs
startfd - Starting descriptor number to search from. owner - Descriptor owner identifier. data - Optional owner data. outfd - Pointer that receives the allocated descriptor.
Result
0 on success, or an errno-style error code.
See also
FD_Check()
Synopsis
LONG FD_Check(
LONG fd );
Function
Check whether a descriptor slot is available.
Inputs
fd - Descriptor number to check.
Result
0 if the slot is free, or an errno-style error code.
See also
FD_Free()
Synopsis
LONG FD_Free(
LONG fd,
fd_owner_t owner );
Function
Release a descriptor slot owned by a specific consumer.
Inputs
fd - Descriptor number to release. owner - Descriptor owner identifier.
Result
0 on success, or an errno-style error code.
See also
FD_GetData()
Synopsis
APTR FD_GetData(
LONG fd );
Function
Query the owner data for a descriptor slot.
Inputs
fd - Descriptor number to query.
Result
Owner data pointer or NULL.
See also
FD_GetOwner()
Synopsis
fd_owner_t FD_GetOwner(
LONG fd );
Function
Query the owner of a descriptor slot.
Inputs
fd - Descriptor number to query.
Result
Owner identifier or FD_OWNER_NONE.
See also
FD_GetOwnerHooks()
Synopsis
const struct fd_hooks * FD_GetOwnerHooks(
fd_owner_t owner );
Function
Return the operation hooks registered for an owner.
Inputs
owner - Descriptor owner identifier.
Result
Pointer to the owner's struct fd_hooks, or NULL if none is registered.
See also
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.
Inputs
fd - Descriptor number to reserve. owner - Descriptor owner identifier. data - Optional owner data.
Result
0 on success, or an errno-style error code.
See also
FD_SetData()
Synopsis
LONG FD_SetData(
LONG fd,
fd_owner_t owner,
APTR data );
Function
Update the owner data for a descriptor slot.
Inputs
fd - Descriptor number to update. owner - Descriptor owner identifier. data - Owner data pointer.
Result
0 on success, or an errno-style error code.
See also
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.
Inputs
owner - Descriptor owner identifier (FD_OWNER_POSIXC, ...). hooks - Pointer to a persistent struct fd_hooks, or NULL to clear.
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.


