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


__set_fd_properties

Syntax

#include <libc/fd_props.h>

int __set_fd_properties(int fd, const char *filename, int open_flags);

Description

This is an internal function that stores information about the file descriptor fd in a fd_properties struct. It is called by open and its helper functions.

struct fd_properties
{
  unsigned char ref_count;
  char *filename;
  unsigned long flags;
  fd_properties *prev;
  fd_properties *next;
};

flags can contain a combination of bits:

FILE_DESC_TEMPORARY
Delete filename when ref_count becomes zero.
FILE_DESC_ZERO_FILL_EOF_GAP
Tell write and _write to test for file offset greater than EOF. Set by lseek and llseek.
FILE_DESC_DONT_FILL_EOF_GAP
Don't test for the EOF gap. Set automatically for stdin, stdout, and NUL. Can also be set by an FSEXT.
FILE_DESC_PIPE
The file descriptor is used in emulating a pipe.
FILE_DESC_APPEND
The file pointer will be set to the end of file before each write.

For more information, see section __clear_fd_properties and section __dup_fd_properties.

Return Value

Returns 0 on success. Returns -1 when unable to store the information.

Portability

not ANSI, not POSIX


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