le_fd.h File Reference

Go to the source code of this file.

Functions

int le_fd_Open (const char *pathName, int flags,...)
 
int le_fd_Close (int fd)
 
ssize_t le_fd_Read (int fd, void *bufPtr, size_t count)
 
ssize_t le_fd_Write (int fd, const void *bufPtr, size_t count)
 
int le_fd_Ioctl (int fd, int request, void *bufPtr)
 
int le_fd_MkFifo (const char *pathname, mode_t mode)
 
int le_fd_MkPipe (const char *pathname, mode_t mode)
 
int le_fd_Dup (int oldfd)
 
int le_fd_Fcntl (int fd, int cmd,...)
 

Detailed Description

Legato File Descriptor API include file.

Function Documentation

◆ le_fd_Close()

int le_fd_Close ( int  fd)

Close a resource referred to by the file descriptor.

Returns
Zero on success, or -1 if an error occurred.
Parameters
[in]fdFile descriptor

◆ le_fd_Dup()

int le_fd_Dup ( int  oldfd)

Create a copy of the file descriptor.

Returns
On success return the new descriptor, or -1 if an error occurred and errno is set.
Parameters
[in]oldfdFile descriptor

◆ le_fd_Fcntl()

int le_fd_Fcntl ( int  fd,
int  cmd,
  ... 
)

Manipulate a file descriptor.

Implements a subset of the commands supported by fcntl(2).

The following subcommands are guaranteed to be implemented on all platforms:

  • F_GETFL
  • F_SETFL
Parameters
[in]fdFile descriptor
[in]cmdCommand

◆ le_fd_Ioctl()

int le_fd_Ioctl ( int  fd,
int  request,
void *  bufPtr 
)

Send a request to the resource referred to by the file descriptor.

Returns
Zero on success, or -1 if an error occurred.
Parameters
[in]fdFile descriptor
[in]requestDevice dependent request code
[in,out]bufPtrPointer to request dependent data buffer

◆ le_fd_MkFifo()

int le_fd_MkFifo ( const char *  pathname,
mode_t  mode 
)

Make a FIFO.

Returns
Zero on success, or -1 if an error occurred and errno is set.
Parameters
[in]pathnamepathname of the fifo
[in]modepermissions of the file

◆ le_fd_MkPipe()

int le_fd_MkPipe ( const char *  pathname,
mode_t  mode 
)

Make a Pipe for bi-direction communication.

Returns
The new file descriptor, or -1 if an error occurred.
Parameters
[in]pathnamepathname of the fifo
[in]modepermissions of the file

◆ le_fd_Open()

int le_fd_Open ( const char *  pathName,
int  flags,
  ... 
)

Create or open an existing resource.

Returns
The new file descriptor, or -1 if an error occurred.
Parameters
[in]pathNamePathname to the resource.
[in]flagsResource access flags.

◆ le_fd_Read()

ssize_t le_fd_Read ( int  fd,
void *  bufPtr,
size_t  count 
)

Attempts to read up to count bytes from the resource referred to by the file descriptor.

The data is read at the current offset.

Returns
On success, the number of bytes read is returned, otherwise -1 is returned.
Parameters
[in]fdFile descriptor
[out]bufPtrBuffer to store read data into
[in]countNumber of bytes to read

◆ le_fd_Write()

ssize_t le_fd_Write ( int  fd,
const void *  bufPtr,
size_t  count 
)

Write up to count bytes to the resource referred to by the file descriptor.

The data is written at the current offset.

Returns
On success, the number of bytes written is returned, otherwise -1 is returned.
Parameters
[in]fdFile descriptor
[in]bufPtrBuffer containing data to be written
[in]countNumber of bytes to write