delorie.com/djgpp/doc/libc/libc_690.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

__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.

The file name stored in fd_properties is the result of the _truename function (see section _truename) on filename. The open_flags are scanned and the temporary and append flags are stored in the flags field in fd_properties.

 
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.

FILE_DESC_DIRECTORY
The file descriptor is for a directory.

The flags can be manipulated using __set_fd_flags (see section __set_fd_flags), __clear_fd_flags (see section __clear_fd_flags) and __get_fd_flags (see section __get_fd_flags).

The file name can be retrieved using __get_fd_name (see section __get_fd_name).

For more information, see __clear_fd_properties (see section __clear_fd_properties) and __dup_fd_properties (see section __dup_fd_properties).

Return Value

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

Portability

ANSI/ISO C No
POSIX No


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004