jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
file_util.cpp File Reference
#include <jau/debug.hpp>
#include <jau/enum_util.hpp>
#include <jau/file_util.hpp>
#include <jau/base_codec.hpp>
#include <jau/os/os_support.hpp>
#include <jau/secmem.hpp>
#include <cstdint>
#include <cstdlib>
#include <cinttypes>
#include <limits>
#include <cstring>
#include <cstdio>
#include <random>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/mount.h>
Include dependency graph for file_util.cpp:

Go to the source code of this file.

Classes

struct  copy_context_t
 

Macros

#define __posix_fstatat64   ::fstatat64
 
#define __posix_openat64   ::openat64
 
#define O_BINARY   0
 
#define O_NONBLOCK   0
 

Typedefs

typedef struct ::stat64 struct_stat64
 

Functions

static void _append_bitstr (std::string &out, fmode_t mask, fmode_t bit, const std::string &bitstr)
 
static bool _dir_item_basename_compare (const dir_item &a, const dir_item &b)
 
static bool _visit (const file_stats &item_stats, const traverse_options topts, const path_visitor &visitor, std::vector< int > &dirfds) noexcept
 
static const char c_backslash ('\\')
 
static const char c_slash ('/')
 
static bool copy_dir_preserve (const file_stats &src_stats, const int dst_dirfd, const std::string &dst_basename, const copy_options copts) noexcept
 
static bool copy_file (const int src_dirfd, const file_stats &src_stats, const int dst_dirfd, const std::string &dst_basename, const copy_options copts) noexcept
 
static bool copy_push_mkdir (const file_stats &dst_stats, copy_context_t &ctx) noexcept
 
static const std::string s_dot (".")
 
static const std::string s_dot_slash ("./")
 
static const std::string s_dotdot ("..")
 
static const std::string s_slash ("/")
 
static const std::string s_slash_dot ("/.")
 
static const std::string s_slash_dot_slash ("/./")
 
static const std::string s_slash_dotdot ("/..")
 
static const std::string s_slash_dotdot_slash ("/../")
 
static bool set_effective_uid (::uid_t user_id)
 

Variables

constexpr const int _open_dir_flags = O_RDONLY|O_BINARY|O_NOCTTY|O_DIRECTORY
 

Macro Definition Documentation

◆ O_BINARY

#define O_BINARY   0

Definition at line 55 of file file_util.cpp.

◆ O_NONBLOCK

#define O_NONBLOCK   0

Definition at line 58 of file file_util.cpp.

◆ __posix_fstatat64

#define __posix_fstatat64   ::fstatat64

Definition at line 80 of file file_util.cpp.

◆ __posix_openat64

#define __posix_openat64   ::openat64

Definition at line 81 of file file_util.cpp.

Typedef Documentation

◆ struct_stat64

typedef struct ::stat64 struct_stat64

Definition at line 79 of file file_util.cpp.

Function Documentation

◆ c_slash()

static const char c_slash ( '/' )
static
Here is the caller graph for this function:

◆ c_backslash()

static const char c_backslash ( '\\' )
static
Here is the caller graph for this function:

◆ s_slash()

static const std::string s_slash ( "/" )
static
Here is the caller graph for this function:

◆ s_slash_dot_slash()

static const std::string s_slash_dot_slash ( "/./" )
static

◆ s_slash_dot()

static const std::string s_slash_dot ( "/." )
static

◆ s_dot_slash()

static const std::string s_dot_slash ( "./" )
static

◆ s_dot()

static const std::string s_dot ( "." )
static
Here is the caller graph for this function:

◆ s_slash_dotdot_slash()

static const std::string s_slash_dotdot_slash ( "/../" )
static

◆ s_slash_dotdot()

static const std::string s_slash_dotdot ( "/.." )
static

◆ s_dotdot()

static const std::string s_dotdot ( ".." )
static
Here is the caller graph for this function:

◆ _append_bitstr()

static void _append_bitstr ( std::string & out,
fmode_t mask,
fmode_t bit,
const std::string & bitstr )
static

Definition at line 377 of file file_util.cpp.

Here is the caller graph for this function:

◆ _dir_item_basename_compare()

static bool _dir_item_basename_compare ( const dir_item & a,
const dir_item & b )
static

Definition at line 999 of file file_util.cpp.

Here is the caller graph for this function:

◆ _visit()

static bool _visit ( const file_stats & item_stats,
const traverse_options topts,
const path_visitor & visitor,
std::vector< int > & dirfds )
staticnoexcept

Definition at line 1003 of file file_util.cpp.

Here is the caller graph for this function:

◆ copy_file()

static bool copy_file ( const int src_dirfd,
const file_stats & src_stats,
const int dst_dirfd,
const std::string & dst_basename,
const copy_options copts )
staticnoexcept

Definition at line 1333 of file file_util.cpp.

Here is the caller graph for this function:

◆ copy_push_mkdir()

static bool copy_push_mkdir ( const file_stats & dst_stats,
copy_context_t & ctx )
staticnoexcept

Definition at line 1539 of file file_util.cpp.

Here is the caller graph for this function:

◆ copy_dir_preserve()

static bool copy_dir_preserve ( const file_stats & src_stats,
const int dst_dirfd,
const std::string & dst_basename,
const copy_options copts )
staticnoexcept

Definition at line 1621 of file file_util.cpp.

Here is the caller graph for this function:

◆ set_effective_uid()

static bool set_effective_uid ( ::uid_t user_id)
static

Definition at line 1879 of file file_util.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ _open_dir_flags

const int _open_dir_flags = O_RDONLY|O_BINARY|O_NOCTTY|O_DIRECTORY
inlineconstexpr

Definition at line 61 of file file_util.cpp.