lxc  4.0.10
About: LXC are userspace tools for the Linux kernel containers that let users easily create and manage system or application containers.
  Fossies Dox: lxc-4.0.10.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

file_utils.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <linux/magic.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include "config.h"
#include "file_utils.h"
#include "macro.h"
#include "memory_utils.h"
#include "string_utils.h"
#include "syscall_wrappers.h"
#include "utils.h"
Include dependency graph for file_utils.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE   1
 
#define BATCH_SIZE   50
 

Functions

int lxc_open_dirfd (const char *dir)
  More...
 
int lxc_readat (int dirfd, const char *filename, void *buf, size_t count)
  More...
 
int lxc_writeat (int dirfd, const char *filename, const void *buf, size_t count)
  More...
 
int lxc_write_openat (const char *dir, const char *filename, const void *buf, size_t count)
  More...
 
int lxc_write_to_file (const char *filename, const void *buf, size_t count, bool add_newline, mode_t mode)
  More...
 
int lxc_read_from_file (const char *filename, void *buf, size_t count)
  More...
 
ssize_t lxc_read_try_buf_at (int dfd, const char *path, void *buf, size_t count)
  More...
 
ssize_t lxc_write_nointr (int fd, const void *buf, size_t count)
  More...
 
ssize_t lxc_pwrite_nointr (int fd, const void *buf, size_t count, off_t offset)
  More...
 
ssize_t lxc_send_nointr (int sockfd, void *buf, size_t len, int flags)
  More...
 
ssize_t lxc_read_nointr (int fd, void *buf, size_t count)
  More...
 
ssize_t lxc_recv_nointr (int sockfd, void *buf, size_t len, int flags)
  More...
 
ssize_t lxc_recvmsg_nointr_iov (int sockfd, struct iovec *iov, size_t iovlen, int flags)
  More...
 
ssize_t lxc_read_nointr_expect (int fd, void *buf, size_t count, const void *expected_buf)
  More...
 
ssize_t lxc_read_file_expect (const char *path, void *buf, size_t count, const void *expected_buf)
  More...
 
bool file_exists (const char *f)
  More...
 
int print_to_file (const char *file, const char *content)
  More...
 
int is_dir (const char *path)
  More...
 
int lxc_count_file_lines (const char *fn)
  More...
 
int lxc_make_tmpfile (char *template, bool rm)
  More...
 
bool is_fs_type (const struct statfs *fs, fs_type_magic magic_val)
  More...
 
bool has_fs_type (const char *path, fs_type_magic magic_val)
  More...
 
bool fhas_fs_type (int fd, fs_type_magic magic_val)
  More...
 
FILE * fopen_cloexec (const char *path, const char *mode)
  More...
 
ssize_t lxc_sendfile_nointr (int out_fd, int in_fd, off_t *offset, size_t count)
  More...
 
ssize_t __fd_to_fd (int from, int to)
  More...
 
int fd_to_buf (int fd, char **buf, size_t *length)
  More...
 
char * file_to_buf (const char *path, size_t *length)
  More...
 
FILE * fopen_cached (const char *path, const char *mode, void **caller_freed_buffer)
  More...
 
FILE * fdopen_cached (int fd, const char *mode, void **caller_freed_buffer)
  More...
 
int fd_cloexec (int fd, bool cloexec)
  More...
 
FILE * fdopen_at (int dfd, const char *path, const char *mode, unsigned int o_flags, unsigned int resolve_flags)
  More...
 
int timens_offset_write (clockid_t clk_id, int64_t s_offset, int64_t ns_offset)
  More...
 
bool exists_dir_at (int dir_fd, const char *path)
  More...
 
bool exists_file_at (int dir_fd, const char *path)
  More...
 
int open_at (int dfd, const char *path, unsigned int o_flags, unsigned int resolve_flags, mode_t mode)
  More...
 
int fd_make_nonblocking (int fd)
  More...
 
static void batch_realloc (char **mem, size_t oldlen, size_t newlen)
  More...
 
static void append_line (char **dest, size_t oldlen, char *new, size_t newlen)
  More...
 
char * read_file_at (int dfd, const char *fnam, unsigned int o_flags, unsigned resolve_flags)
  More...
 
bool same_file_lax (int fda, int fdb)
  More...