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_Fstat (int fd, struct stat *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.
Copyright (C) Sierra Wireless Inc.
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] fd File 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] oldfd File 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] fd File descriptor [in] cmd Command
◆ le_fd_Fstat()
int le_fd_Fstat | ( | int | fd, |
struct stat * | bufPtr | ||
) |
Return information about a file, specified by the file descriptor fd.
- Returns
- Zero on success, or -1 if an error occurred.
- Parameters
-
[in] fd File descriptor [out] bufPtr Stat structure
◆ 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] fd File descriptor [in] request Device dependent request code [in,out] bufPtr Pointer 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] pathname pathname of the fifo [in] mode permissions 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] pathname pathname of the fifo [in] mode permissions 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] pathName Pathname to the resource. [in] flags Resource 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] fd File descriptor [out] bufPtr Buffer to store read data into [in] count Number 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] fd File descriptor [in] bufPtr Buffer containing data to be written [in] count Number of bytes to write