Tor 0.4.9.0-alpha-dev
Functions
fdio.c File Reference

Low-level compatibility wrappers for fd-based IO. More...

#include "orconfig.h"
#include "lib/fdio/fdio.h"
#include "lib/cc/torint.h"
#include "lib/err/torerr.h"
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

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

Detailed Description

Low-level compatibility wrappers for fd-based IO.

Definition in file fdio.c.

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 48 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 61 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 80 of file fdio.c.

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 92 of file fdio.c.

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 108 of file fdio.c.

Referenced by log_tor_version().