Go to the first, previous, next, last section, table of contents.


__FSEXT_alloc_fd

Syntax

#include <sys/fsext.h>

int __FSEXT_alloc_fd(__FSEXT_Function *_function);

Description

This function is part of the section File System Extensions. It is used by extensions that fully emulate the I/O functions, and thus don't have a corresponding DOS file handle. Upon the first call, this function opens DOS's `NUL' device, so as to allocate a handle that DOS won't then reuse. Upon subsequent calls, that handle is duplicated by calling the DOS dup function; this makes all of the handles use a single entry in the System File Table, and thus be independent of what the `FILES=' parameter of `CONFIG.SYS' says. __FSEXT_alloc_fd also assigns the handler function for the handle it returns.

The module is responsible for calling _close on the descriptor after setting the handler function to zero in the extended close handler.

Portability

not ANSI, not POSIX

Example

int socket()
{
  int fd = __FSEXT_alloc_fd(socket_handler);
  init_socket(fd);
  return fd;
}


Go to the first, previous, next, last section, table of contents.