libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Typedefs | Functions
fd.h File Reference

File operations. More...

#include <libtransistor/types.h>
#include <sys/types.h>
#include <stdint.h>
Include dependency graph for fd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  trn_file_ops_t
 
struct  trn_file_t
 

Typedefs

typedef struct trn_file_t trn_file_t
 

Functions

int fd_create_file (trn_file_ops_t *fops, void *data)
 Create a file from fops and data. More...
 
trn_file_tfd_file_get (int fd)
 Get the file structure from a given fd, and increment its rc. More...
 
void fd_file_put (trn_file_t *file)
 Decrease the fd_file refcount, and release it if this is the last one.
 
int fd_close (int fd)
 Close the file descriptor.
 
int fd_dup2 (int oldfd, int newfd)
 Duplicates oldfd, and all its associated locks, into newfd. More...
 

Detailed Description

File operations.

File operations

Function Documentation

int fd_create_file ( trn_file_ops_t fops,
void *  data 
)

Create a file from fops and data.

Data will be sent to the various functions in fops. Data will usually contain the underlying handle (like the fd for bsd)

int fd_dup2 ( int  oldfd,
int  newfd 
)

Duplicates oldfd, and all its associated locks, into newfd.

Newfd is closed if necessary.

trn_file_t* fd_file_get ( int  fd)

Get the file structure from a given fd, and increment its rc.

Any call to this function needs an equivalent call to fd_file_put.