#include <jau/debug.hpp>
#include <jau/file_util.hpp>
#include <jau/base_codec.hpp>
#include <jau/os/os_support.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>
Go to the source code of this file.
|  | 
| #define | __posix_fstatat64   ::fstatat64 | 
|  | 
| #define | __posix_openat64   ::openat64 | 
|  | 
| #define | APPEND_BITSTR(U,  V,  M)   append_bitstr(out, M, U::V, #V, comma); | 
|  | 
| #define | COPYOPTIONS_BIT_ENUM(X,  M) | 
|  | 
| #define | FILESTATS_FIELD_ENUM(X,  M) | 
|  | 
| #define | FMODEBITS_ENUM(X,  M) | 
|  | 
| #define | O_BINARY   0 | 
|  | 
| #define | O_NONBLOCK   0 | 
|  | 
| #define | TRAVERSEEVENT_ENUM(X,  M) | 
|  | 
| #define | TRAVERSEOPTIONS_ENUM(X,  M) | 
|  | 
|  | 
| 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 void | append_bitstr (std::string &out, fmode_t mask, fmode_t bit, const std::string &bitstr) | 
|  | 
| template<typename T > | 
| static void | append_bitstr (std::string &out, T mask, T bit, const std::string &bitstr, bool &comma) | 
|  | 
| 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) | 
|  | 
◆ O_BINARY
◆ O_NONBLOCK
◆ __posix_fstatat64
      
        
          | #define __posix_fstatat64   ::fstatat64 | 
      
 
 
◆ __posix_openat64
      
        
          | #define __posix_openat64   ::openat64 | 
      
 
 
◆ APPEND_BITSTR
      
        
          | #define APPEND_BITSTR | ( |  | U, | 
        
          |  |  |  | V, | 
        
          |  |  |  | M | 
        
          |  | ) |  | append_bitstr(out, M, U::V, #V, comma); | 
      
 
 
◆ FMODEBITS_ENUM
      
        
          | #define FMODEBITS_ENUM | ( |  | X, | 
        
          |  |  |  | M | 
        
          |  | ) |  |  | 
      
 
Value:
fmode_t
Generic file type and POSIX protection mode bits as used in file_stats, touch(), mkdir() etc.
 
Definition at line 349 of file file_util.cpp.
 
 
◆ FILESTATS_FIELD_ENUM
      
        
          | #define FILESTATS_FIELD_ENUM | ( |  | X, | 
        
          |  |  |  | M | 
        
          |  | ) |  |  | 
      
 
Value:
field_t
Field identifier which bit-mask indicates field_t fields.
 
Definition at line 422 of file file_util.cpp.
 
 
◆ TRAVERSEEVENT_ENUM
      
        
          | #define TRAVERSEEVENT_ENUM | ( |  | X, | 
        
          |  |  |  | M | 
        
          |  | ) |  |  | 
      
 
Value:
traverse_event
Filesystem traverse event used to call path_visitor for path elements from visit().
 
Definition at line 1006 of file file_util.cpp.
 
 
◆ TRAVERSEOPTIONS_ENUM
      
        
          | #define TRAVERSEOPTIONS_ENUM | ( |  | X, | 
        
          |  |  |  | M | 
        
          |  | ) |  |  | 
      
 
Value:
traverse_options
Filesystem traverse options used to visit() path elements.
 
Definition at line 1023 of file file_util.cpp.
 
 
◆ COPYOPTIONS_BIT_ENUM
      
        
          | #define COPYOPTIONS_BIT_ENUM | ( |  | X, | 
        
          |  |  |  | M | 
        
          |  | ) |  |  | 
      
 
Value:
copy_options
Filesystem copy options used to copy() path elements.
void sync() noexcept
Synchronizes filesystems, i.e.
 
Definition at line 1366 of file file_util.cpp.
 
 
◆ struct_stat64
◆ c_slash()
  
  | 
        
          | static const char c_slash | ( | '/' |  | ) |  |  | static | 
 
 
◆ c_backslash()
  
  | 
        
          | static const char c_backslash | ( | '\\' |  | ) |  |  | static | 
 
 
◆ s_slash()
  
  | 
        
          | static const std::string s_slash | ( | "/" |  | ) |  |  | static | 
 
 
◆ 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 | 
 
 
◆ 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 | 
 
 
◆ append_bitstr() [1/2]
template<typename T > 
  
  | 
        
          | static void append_bitstr | ( | std::string & | out, |  
          |  |  | T | mask, |  
          |  |  | T | bit, |  
          |  |  | const std::string & | bitstr, |  
          |  |  | bool & | comma |  
          |  | ) |  |  |  | static | 
 
 
◆ append_bitstr() [2/2]
  
  | 
        
          | static void append_bitstr | ( | std::string & | out, |  
          |  |  | fmode_t | mask, |  
          |  |  | fmode_t | bit, |  
          |  |  | const std::string & | bitstr |  
          |  | ) |  |  |  | static | 
 
 
◆ _dir_item_basename_compare()
  
  | 
        
          | static bool _dir_item_basename_compare | ( | const dir_item & | a, |  
          |  |  | const dir_item & | b |  
          |  | ) |  |  |  | static | 
 
 
◆ _visit()
◆ 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 | 
 
 
◆ copy_push_mkdir()
◆ 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 | 
 
 
◆ set_effective_uid()
  
  | 
        
          | static bool set_effective_uid | ( | ::uid_t | user_id | ) |  |  | static | 
 
 
◆ _open_dir_flags
  
  | 
        
          | constexpr const int _open_dir_flags = O_RDONLY|O_BINARY|O_NOCTTY|O_DIRECTORY |  | inlineconstexpr |