tor  0.4.2.0-alpha-dev
Functions
fdio.h File Reference
#include <stddef.h>

Go to the source code of this file.

Functions

off_t tor_fd_getpos (int fd)
 
int tor_fd_setpos (int fd, off_t pos)
 
int tor_fd_seekend (int fd)
 
int tor_ftruncate (int fd)
 
int write_all_to_fd_minimal (int fd, const char *buf, size_t count)
 

Detailed Description

Header for fdio.c.

Definition in file fdio.h.

Function Documentation

◆ tor_fd_getpos()

off_t tor_fd_getpos ( int  fd)

Return the position of fd with respect to the start of the file.

Definition at line 47 of file fdio.c.

Referenced by log_tor_version().

◆ tor_fd_seekend()

int tor_fd_seekend ( int  fd)

Move fd to the end of the file. Return -1 on error, 0 on success. If the file is a pipe, do nothing and succeed.

Definition at line 60 of file fdio.c.

Referenced by add_file_log().

◆ tor_fd_setpos()

int tor_fd_setpos ( int  fd,
off_t  pos 
)

Move fd to position pos in the file. Return -1 on error, 0 on success.

Definition at line 79 of file fdio.c.

References SEEK_SET.

Referenced by tor_ftruncate().

◆ tor_ftruncate()

int tor_ftruncate ( int  fd)

Replacement for ftruncate(fd, 0): move to the front of the file and remove all the rest of the file. Return -1 on error, 0 on success.

Definition at line 91 of file fdio.c.

References tor_fd_setpos().

Referenced by truncate_logs().

◆ write_all_to_fd_minimal()

int write_all_to_fd_minimal ( int  fd,
const char *  buf,
size_t  count 
)

Minimal version of write_all, for use by logging.

Definition at line 107 of file fdio.c.

Referenced by log_tor_version().