libzypp  14.48.5
PathInfo.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_PATHINFO_H
13 #define ZYPP_PATHINFO_H
14 
15 extern "C"
16 {
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <fcntl.h>
20 #include <unistd.h>
21 #include <dirent.h>
22 }
23 
24 #include <cerrno>
25 #include <iosfwd>
26 #include <list>
27 #include <set>
28 #include <map>
29 
30 #include "zypp/APIConfig.h"
31 #include "zypp/Pathname.h"
32 #include "zypp/CheckSum.h"
33 #include "zypp/ByteCount.h"
34 
36 namespace zypp
37 {
38 
39  class StrMatcher;
40 
42 
49  namespace filesystem
50  {
51 
53 
56  enum FileType
57  {
58  FT_NOT_AVAIL = 0x00, // no typeinfo available
59  FT_NOT_EXIST = 0x01, // file does not exist
60  FT_FILE = 0x02,
61  FT_DIR = 0x04,
62  FT_CHARDEV = 0x08,
63  FT_BLOCKDEV = 0x10,
64  FT_FIFO = 0x20,
65  FT_LINK = 0x40,
66  FT_SOCKET = 0x80
67  };
69 
71  extern std::ostream & operator<<( std::ostream & str, FileType obj );
72 
74 
76  //
77  // CLASS NAME : StatMode
81  class StatMode
82  {
83  friend std::ostream & operator<<( std::ostream & str, const StatMode & obj );
84 
85  public:
87  StatMode( const mode_t & mode_r = 0 )
88  : _mode( mode_r )
89  {}
90 
91  public:
92 
95  FileType fileType() const;
96 
97  bool isFile() const { return S_ISREG( _mode ); }
98  bool isDir () const { return S_ISDIR( _mode ); }
99  bool isLink() const { return S_ISLNK( _mode ); }
100  bool isChr() const { return S_ISCHR( _mode ); }
101  bool isBlk() const { return S_ISBLK( _mode ); }
102  bool isFifo() const { return S_ISFIFO( _mode ); }
103  bool isSock() const { return S_ISSOCK( _mode ); }
105 
108  bool isRUsr() const { return (_mode & S_IRUSR); }
109  bool isWUsr() const { return (_mode & S_IWUSR); }
110  bool isXUsr() const { return (_mode & S_IXUSR); }
111 
113  bool isR() const { return isRUsr(); }
115  bool isW() const { return isWUsr(); }
117  bool isX() const { return isXUsr(); }
119 
122  bool isRGrp() const { return (_mode & S_IRGRP); }
123  bool isWGrp() const { return (_mode & S_IWGRP); }
124  bool isXGrp() const { return (_mode & S_IXGRP); }
126 
129  bool isROth() const { return (_mode & S_IROTH); }
130  bool isWOth() const { return (_mode & S_IWOTH); }
131  bool isXOth() const { return (_mode & S_IXOTH); }
133 
137  bool isUid() const { return (_mode & S_ISUID); }
139  bool isGid() const { return (_mode & S_ISGID); }
141  bool isVtx() const { return (_mode & S_ISVTX); }
143 
147  bool isPerm ( mode_t m ) const { return (m == perm()); }
149  bool hasPerm( mode_t m ) const { return (m == (m & perm())); }
151 
154  mode_t uperm() const { return (_mode & S_IRWXU); }
155  mode_t gperm() const { return (_mode & S_IRWXG); }
156  mode_t operm() const { return (_mode & S_IRWXO); }
157  mode_t perm() const { return (_mode & (S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID|S_ISVTX)); }
159 
161  mode_t st_mode() const { return _mode; }
162 
163  private:
164  mode_t _mode;
165  };
167 
169  extern std::ostream & operator<<( std::ostream & str, const StatMode & obj );
170 
172 
174  //
175  // CLASS NAME : DevInoCache
189  {
190  public:
193 
195  void clear() { _devino.clear(); }
196 
202  bool insert( const dev_t & dev_r, const ino_t & ino_r ) {
203  return _devino[dev_r].insert( ino_r ).second;
204  }
205 
206  private:
207  std::map<dev_t,std::set<ino_t> > _devino;
208  };
210 
212  //
213  // CLASS NAME : PathInfo
221  class PathInfo
222  {
223  friend std::ostream & operator<<( std::ostream & str, const PathInfo & obj );
224 
225  public:
227  enum Mode { STAT, LSTAT };
228 
229  public:
234  PathInfo();
235  explicit
236  PathInfo( const Pathname & path, Mode initial = STAT );
237  explicit
238  PathInfo( const std::string & path, Mode initial = STAT );
239  explicit
240  PathInfo( const char * path, Mode initial = STAT );
242 
244  ~PathInfo();
245 
247  const Pathname & path() const { return path_t; }
249  const std::string & asString() const { return path_t.asString(); }
251  const char * c_str() const { return path_t.asString().c_str(); }
253  Mode mode() const { return mode_e; }
255  int error() const { return error_i; }
256 
258  void setPath( const Pathname & path ) { if ( path != path_t ) error_i = -1; path_t = path; }
260  void setMode( Mode mode ) { if ( mode != mode_e ) error_i = -1; mode_e = mode; }
261 
263  bool stat ( const Pathname & path ) { setPath( path ); setMode( STAT ); return operator()(); }
265  bool lstat ( const Pathname & path ) { setPath( path ); setMode( LSTAT ); return operator()(); }
267  bool operator()( const Pathname & path ) { setPath( path ); return operator()(); }
268 
270  bool stat() { setMode( STAT ); return operator()(); }
272  bool lstat() { setMode( LSTAT ); return operator()(); }
274  bool operator()();
275 
276  public:
277 
282  bool isExist() const { return !error_i; }
283 
288  FileType fileType() const;
289 
290  bool isFile() const { return isExist() && S_ISREG( statbuf_C.st_mode ); }
291  bool isDir () const { return isExist() && S_ISDIR( statbuf_C.st_mode ); }
292  bool isLink() const { return isExist() && S_ISLNK( statbuf_C.st_mode ); }
293  bool isChr() const { return isExist() && S_ISCHR( statbuf_C.st_mode ); }
294  bool isBlk() const { return isExist() && S_ISBLK( statbuf_C.st_mode ); }
295  bool isFifo() const { return isExist() && S_ISFIFO( statbuf_C.st_mode ); }
296  bool isSock() const { return isExist() && S_ISSOCK( statbuf_C.st_mode ); }
297 
298  // permission
299  bool isRUsr() const { return isExist() && (statbuf_C.st_mode & S_IRUSR); }
300  bool isWUsr() const { return isExist() && (statbuf_C.st_mode & S_IWUSR); }
301  bool isXUsr() const { return isExist() && (statbuf_C.st_mode & S_IXUSR); }
302 
303  bool isR() const { return isRUsr(); }
304  bool isW() const { return isWUsr(); }
305  bool isX() const { return isXUsr(); }
306 
307  bool isRGrp() const { return isExist() && (statbuf_C.st_mode & S_IRGRP); }
308  bool isWGrp() const { return isExist() && (statbuf_C.st_mode & S_IWGRP); }
309  bool isXGrp() const { return isExist() && (statbuf_C.st_mode & S_IXGRP); }
310 
311  bool isROth() const { return isExist() && (statbuf_C.st_mode & S_IROTH); }
312  bool isWOth() const { return isExist() && (statbuf_C.st_mode & S_IWOTH); }
313  bool isXOth() const { return isExist() && (statbuf_C.st_mode & S_IXOTH); }
314 
315  bool isUid() const { return isExist() && (statbuf_C.st_mode & S_ISUID); }
316  bool isGid() const { return isExist() && (statbuf_C.st_mode & S_ISGID); }
317  bool isVtx() const { return isExist() && (statbuf_C.st_mode & S_ISVTX); }
318 
319  bool isPerm ( mode_t m ) const { return isExist() && (m == perm()); }
320  bool hasPerm( mode_t m ) const { return isExist() && (m == (m & perm())); }
321 
322  mode_t uperm() const { return isExist() ? (statbuf_C.st_mode & S_IRWXU) : 0; }
323  mode_t gperm() const { return isExist() ? (statbuf_C.st_mode & S_IRWXG) : 0; }
324  mode_t operm() const { return isExist() ? (statbuf_C.st_mode & S_IRWXO) : 0; }
325  mode_t perm() const { return isExist() ? (statbuf_C.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID|S_ISVTX)) : 0; }
326 
327  mode_t st_mode() const { return isExist() ? statbuf_C.st_mode : 0; }
329 
331  StatMode asStatMode() const { return st_mode(); }
332 
333  nlink_t nlink() const { return isExist() ? statbuf_C.st_nlink : 0; }
334 
337  uid_t owner() const { return isExist() ? statbuf_C.st_uid : 0; }
338  gid_t group() const { return isExist() ? statbuf_C.st_gid : 0; }
340 
344  mode_t userMay() const;
345 
346  bool userMayR() const { return( userMay() & 04 ); }
347  bool userMayW() const { return( userMay() & 02 ); }
348  bool userMayX() const { return( userMay() & 01 ); }
349 
350  bool userMayRW() const { return( (userMay() & 06) == 06 ); }
351  bool userMayRX() const { return( (userMay() & 05) == 05 ); }
352  bool userMayWX() const { return( (userMay() & 03) == 03 ); }
353 
354  bool userMayRWX() const { return( userMay() == 07 ); }
356 
359  ino_t ino() const { return isExist() ? statbuf_C.st_ino : 0; }
360  dev_t dev() const { return isExist() ? statbuf_C.st_dev : 0; }
361  dev_t rdev() const { return isExist() ? statbuf_C.st_rdev : 0; }
362 
363  unsigned int devMajor() const;
364  unsigned int devMinor() const;
365 
367  unsigned int major() const ZYPP_DEPRECATED;
369  unsigned int minor() const ZYPP_DEPRECATED;
371 
374  off_t size() const { return isExist() ? statbuf_C.st_size : 0; }
375  unsigned long blksize() const { return isExist() ? statbuf_C.st_blksize : 0; }
376  unsigned long blocks() const { return isExist() ? statbuf_C.st_blocks : 0; }
378 
381  time_t atime() const { return isExist() ? statbuf_C.st_atime : 0; } /* time of last access */
382  time_t mtime() const { return isExist() ? statbuf_C.st_mtime : 0; } /* time of last modification */
383  time_t ctime() const { return isExist() ? statbuf_C.st_ctime : 0; }
385 
386  private:
388  struct stat statbuf_C;
390  int error_i;
391  };
393 
395  extern std::ostream & operator<<( std::ostream & str, const PathInfo & obj );
396 
398 
400 
409  int mkdir( const Pathname & path, unsigned mode = 0755 );
410 
418  int assert_dir( const Pathname & path, unsigned mode = 0755 );
419 
425  int rmdir( const Pathname & path );
426 
433  int recursive_rmdir( const Pathname & path );
434 
441  int clean_dir( const Pathname & path );
442 
450  int copy_dir( const Pathname & srcpath, const Pathname & destpath );
451 
460  int copy_dir_content( const Pathname & srcpath, const Pathname & destpath);
461 
466  const StrMatcher & matchNoDots();
467 
480  int dirForEach( const Pathname & dir_r, function<bool(const Pathname &, const char *const)> fnc_r );
481 
505  int dirForEach( const Pathname & dir_r, const StrMatcher & matcher_r, function<bool(const Pathname &, const char *const)> fnc_r );
506 
519  int readdir( std::list<std::string> & retlist,
520  const Pathname & path, bool dots = true );
521 
534  int readdir( std::list<Pathname> & retlist,
535  const Pathname & path, bool dots = true );
536 
538  struct DirEntry {
539  std::string name;
541  DirEntry( const std::string & name_r = std::string(), FileType type_r = FT_NOT_AVAIL )
542  : name( name_r )
543  , type( type_r )
544  {}
545 
546  bool operator==( const DirEntry &rhs ) const;
547  };
548 
549  inline std::ostream & operator<<( std::ostream & str, const DirEntry & obj )
550  { return str << '[' << obj.type << "] " << obj.name; }
551 
553  typedef std::list<DirEntry> DirContent;
554 
555  std::ostream & operator<<( std::ostream & str, const DirContent & obj );
556 
567  int readdir( DirContent & retlist, const Pathname & path,
568  bool dots = true, PathInfo::Mode statmode = PathInfo::STAT );
569 
575  int is_empty_dir(const Pathname & path);
576 
578 
580 
589  int assert_file( const Pathname & path, unsigned mode = 0644 );
593  int assert_file_mode( const Pathname & path, unsigned mode = 0644 );
594 
601  int touch (const Pathname & path);
602 
608  int unlink( const Pathname & path );
609 
615  int rename( const Pathname & oldpath, const Pathname & newpath );
616 
643  int exchange( const Pathname & lpath, const Pathname & rpath );
644 
651  int copy( const Pathname & file, const Pathname & dest );
652 
659  int symlink( const Pathname & oldpath, const Pathname & newpath );
660 
667  int hardlink( const Pathname & oldpath, const Pathname & newpath );
668 
674  int hardlinkCopy( const Pathname & oldpath, const Pathname & newpath );
675 
682  int readlink( const Pathname & symlink_r, Pathname & target_r );
684  inline Pathname readlink( const Pathname & symlink_r )
685  {
686  Pathname target;
687  readlink( symlink_r, target );
688  return target;
689  }
690 
703  Pathname expandlink( const Pathname & path_r );
704 
711  int copy_file2dir( const Pathname & file, const Pathname & dest );
713 
715 
724  std::string md5sum( const Pathname & file );
725 
731  std::string sha1sum( const Pathname & file );
733 
739  std::string checksum( const Pathname & file, const std::string &algorithm );
740 
746  bool is_checksum( const Pathname & file, const CheckSum &checksum );
747 
749 
756  int chmod( const Pathname & path, mode_t mode );
757 
763  int addmod( const Pathname & path, mode_t mode );
764 
770  int delmod( const Pathname & path, mode_t mode );
772 
774 
782 
783  ZIP_TYPE zipType( const Pathname & file );
784 
792  int erase( const Pathname & path );
793 
801  ByteCount df( const Pathname & path );
802 
808  mode_t getUmask();
809 
816  inline mode_t applyUmaskTo( mode_t mode_r )
817  { return mode_r & ~getUmask(); }
819 
821  } // namespace filesystem
823 
825  using filesystem::PathInfo;
826 
828 } // namespace zypp
830 #endif // ZYPP_PATHINFO_H
FileType fileType() const
Definition: PathInfo.cc:213
bool isW() const
Short for isWUsr().
Definition: PathInfo.h:115
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
Definition: PathInfo.cc:329
const Pathname & path() const
Return current Pathname.
Definition: PathInfo.h:247
bool isWOth() const
Definition: PathInfo.h:312
bool isROth() const
Definition: PathInfo.h:311
bool isSock() const
Definition: PathInfo.h:103
int exchange(const Pathname &lpath, const Pathname &rpath)
Exchanges two files or directories.
Definition: PathInfo.cc:696
ZIP_TYPE
Test whether a file is compressed (gzip/bzip2).
Definition: PathInfo.h:781
Listentry returned by readdir.
Definition: PathInfo.h:538
int assert_file(const Pathname &path, unsigned mode)
Create an empty file if it does not yet exist.
Definition: PathInfo.cc:1118
std::string sha1sum(const Pathname &file)
Compute a files sha1sum.
Definition: PathInfo.cc:979
unsigned int devMinor() const
Definition: PathInfo.cc:252
std::string md5sum(const Pathname &file)
Compute a files md5sum.
Definition: PathInfo.cc:962
int error() const
Return error returned from last stat/lstat call.
Definition: PathInfo.h:255
bool isFile() const
Definition: PathInfo.h:97
int readlink(const Pathname &symlink_r, Pathname &target_r)
Like 'readlink'.
Definition: PathInfo.cc:862
time_t atime() const
Definition: PathInfo.h:381
bool lstat()
LSTAT current path.
Definition: PathInfo.h:272
bool isXUsr() const
Definition: PathInfo.h:110
bool isUid() const
Set UID bit.
Definition: PathInfo.h:137
bool isExist() const
Return whether valid stat info exists.
Definition: PathInfo.h:282
StatMode asStatMode() const
Return st_mode() as filesystem::StatMode.
Definition: PathInfo.h:331
String matching (STRING|SUBSTRING|GLOB|REGEX).
Definition: StrMatcher.h:297
Store and operate with byte count.
Definition: ByteCount.h:30
int mkdir(const Pathname &path, unsigned mode)
Like 'mkdir'.
Definition: PathInfo.cc:315
void clear()
Clear cache.
Definition: PathInfo.h:195
bool isWUsr() const
Definition: PathInfo.h:300
mode_t operm() const
Definition: PathInfo.h:156
off_t size() const
Definition: PathInfo.h:374
const std::string & asString() const
String representation.
Definition: Pathname.h:90
int hardlink(const Pathname &oldpath, const Pathname &newpath)
Like '::link'.
Definition: PathInfo.cc:809
mode_t operm() const
Definition: PathInfo.h:324
friend std::ostream & operator<<(std::ostream &str, const StatMode &obj)
Definition: PathInfo.cc:96
bool userMayRW() const
Definition: PathInfo.h:350
int chmod(const Pathname &path, mode_t mode)
Like 'chmod'.
Definition: PathInfo.cc:1030
mode_t uperm() const
Definition: PathInfo.h:322
int clean_dir(const Pathname &path)
Like 'rm -r DIR/ *'.
Definition: PathInfo.cc:443
unsigned int minor() const ZYPP_DEPRECATED
Definition: PathInfo.cc:259
bool isRGrp() const
Definition: PathInfo.h:307
bool isR() const
Short for isRUsr().
Definition: PathInfo.h:113
mode_t uperm() const
Definition: PathInfo.h:154
ino_t ino() const
Definition: PathInfo.h:359
dev_t rdev() const
Definition: PathInfo.h:361
bool userMayW() const
Definition: PathInfo.h:347
bool isXOth() const
Definition: PathInfo.h:313
uid_t owner() const
Definition: PathInfo.h:337
bool stat()
STAT current path.
Definition: PathInfo.h:270
bool isROth() const
Definition: PathInfo.h:129
const char * c_str() const
Return current Pathname as C-string.
Definition: PathInfo.h:251
int copy_file2dir(const Pathname &file, const Pathname &dest)
Like 'cp file dest'.
Definition: PathInfo.cc:928
DirEntry(const std::string &name_r=std::string(), FileType type_r=FT_NOT_AVAIL)
Definition: PathInfo.h:541
mode_t st_mode() const
Return the mode_t value.
Definition: PathInfo.h:161
bool isVtx() const
Sticky bit.
Definition: PathInfo.h:141
bool isXGrp() const
Definition: PathInfo.h:309
FileType fileType() const
Definition: PathInfo.cc:71
mode_t perm() const
Definition: PathInfo.h:325
Mode
stat() or lstat()
Definition: PathInfo.h:227
int is_empty_dir(const Pathname &path_r)
Check if the specified directory is empty.
Definition: PathInfo.cc:656
ZIP_TYPE zipType(const Pathname &file)
Definition: PathInfo.cc:1062
unsigned int major() const ZYPP_DEPRECATED
Definition: PathInfo.cc:257
int addmod(const Pathname &path, mode_t mode)
Add the mode bits to the file given by path.
Definition: PathInfo.cc:1039
int assert_file_mode(const Pathname &path, unsigned mode)
Like assert_file but enforce mode even if the file already exists.
Definition: PathInfo.cc:1137
bool userMayRX() const
Definition: PathInfo.h:351
const StrMatcher & matchNoDots()
Convenience returning StrMatcher( "[^.]*", Match::GLOB )
Definition: PathInfo.cc:551
bool isXUsr() const
Definition: PathInfo.h:301
bool operator()()
Restat current path using current mode.
Definition: PathInfo.cc:189
bool isLink() const
Definition: PathInfo.h:99
time_t mtime() const
Definition: PathInfo.h:382
const std::string & asString() const
Return current Pathname as String.
Definition: PathInfo.h:249
int unlink(const Pathname &path)
Like 'unlink'.
Definition: PathInfo.cc:668
void setMode(Mode mode)
Set a new Mode .
Definition: PathInfo.h:260
int rename(const Pathname &oldpath, const Pathname &newpath)
Like 'rename'.
Definition: PathInfo.cc:682
Simple cache remembering device/inode to detect hardlinks.
Definition: PathInfo.h:188
Provides API related macros.
int recursive_rmdir(const Pathname &path)
Like 'rm -r DIR'.
Definition: PathInfo.cc:422
bool operator()(const Pathname &path)
Restat path using current mode.
Definition: PathInfo.h:267
bool operator==(const DirEntry &rhs) const
Definition: PathInfo.cc:629
bool isRUsr() const
Definition: PathInfo.h:108
std::list< DirEntry > DirContent
Returned by readdir.
Definition: PathInfo.h:553
bool isSock() const
Definition: PathInfo.h:296
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
Definition: PathInfo.cc:823
bool insert(const dev_t &dev_r, const ino_t &ino_r)
Remember dev/ino.
Definition: PathInfo.h:202
nlink_t nlink() const
Definition: PathInfo.h:333
bool isDir() const
Definition: PathInfo.h:98
bool isLink() const
Definition: PathInfo.h:292
StatMode(const mode_t &mode_r=0)
Ctor taking mode_t value from ::stat.
Definition: PathInfo.h:87
time_t ctime() const
Definition: PathInfo.h:383
bool isFile() const
Definition: PathInfo.h:290
int symlink(const Pathname &oldpath, const Pathname &newpath)
Like 'symlink'.
Definition: PathInfo.cc:795
bool isX() const
Short for isXUsr().
Definition: PathInfo.h:117
mode_t gperm() const
Definition: PathInfo.h:323
bool isXGrp() const
Definition: PathInfo.h:124
std::map< dev_t, std::set< ino_t > > _devino
Definition: PathInfo.h:207
int touch(const Pathname &path)
Change file's modification and access times.
Definition: PathInfo.cc:1169
bool isRUsr() const
Definition: PathInfo.h:299
bool isFifo() const
Definition: PathInfo.h:295
int copy(const Pathname &file, const Pathname &dest)
Like 'cp file dest'.
Definition: PathInfo.cc:760
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
Definition: PathInfo.cc:604
bool userMayRWX() const
Definition: PathInfo.h:354
int rmdir(const Pathname &path)
Like 'rmdir'.
Definition: PathInfo.cc:376
mode_t getUmask()
Get the current umask (file mode creation mask)
Definition: PathInfo.cc:1106
bool isWOth() const
Definition: PathInfo.h:130
int copy_dir(const Pathname &srcpath, const Pathname &destpath)
Like 'cp -a srcpath destpath'.
Definition: PathInfo.cc:470
Wrapper class for mode_t values as derived from ::stat.
Definition: PathInfo.h:81
unsigned int devMajor() const
Definition: PathInfo.cc:242
mode_t perm() const
Definition: PathInfo.h:157
FileType
File type information.
Definition: PathInfo.h:56
bool userMayR() const
Definition: PathInfo.h:346
mode_t gperm() const
Definition: PathInfo.h:155
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
Definition: PathInfo.cc:989
int erase(const Pathname &path)
Erase whatever happens to be located at path (file or directory).
Definition: PathInfo.cc:1011
dev_t dev() const
Definition: PathInfo.h:360
bool isPerm(mode_t m) const
Definition: PathInfo.h:319
unsigned long blksize() const
Definition: PathInfo.h:375
int copy_dir_content(const Pathname &srcpath, const Pathname &destpath)
Like 'cp -a srcpath/.
Definition: PathInfo.cc:511
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:221
int dirForEach(const Pathname &dir_r, function< bool(const Pathname &, const char *const)> fnc_r)
Invoke callback function fnc_r for each entry in directory dir_r.
Definition: PathInfo.cc:557
bool isRGrp() const
Definition: PathInfo.h:122
bool isGid() const
Set GID bit.
Definition: PathInfo.h:139
bool userMayX() const
Definition: PathInfo.h:348
Pathname expandlink(const Pathname &path_r)
Recursively follows the symlink pointed to by path_r and returns the Pathname to the real file or dir...
Definition: PathInfo.cc:883
bool isFifo() const
Definition: PathInfo.h:102
mode_t applyUmaskTo(mode_t mode_r)
Modify mode_r according to the current umask ( mode_r & ~getUmask() ).
Definition: PathInfo.h:816
mode_t userMay() const
Returns current users permission ([0-7])
Definition: PathInfo.cc:225
int delmod(const Pathname &path, mode_t mode)
Remove the mode bits from the file given by path.
Definition: PathInfo.cc:1048
bool userMayWX() const
Definition: PathInfo.h:352
unsigned long blocks() const
Definition: PathInfo.h:376
std::ostream & operator<<(std::ostream &str, const Glob &obj)
Definition: Glob.cc:53
bool isPerm(mode_t m) const
Test for equal permission bits.
Definition: PathInfo.h:147
bool isWUsr() const
Definition: PathInfo.h:109
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3...
Definition: APIConfig.h:86
bool lstat(const Pathname &path)
LSTAT path.
Definition: PathInfo.h:265
bool hasPerm(mode_t m) const
Definition: PathInfo.h:320
friend std::ostream & operator<<(std::ostream &str, const PathInfo &obj)
Definition: PathInfo.cc:267
bool isWGrp() const
Definition: PathInfo.h:308
bool hasPerm(mode_t m) const
Test for set permission bits.
Definition: PathInfo.h:149
Mode mode() const
Return current stat Mode.
Definition: PathInfo.h:253
bool isXOth() const
Definition: PathInfo.h:131
bool stat(const Pathname &path)
STAT path.
Definition: PathInfo.h:263
gid_t group() const
Definition: PathInfo.h:338
bool is_checksum(const Pathname &file, const CheckSum &checksum)
check files checksum
Definition: PathInfo.cc:1001
mode_t st_mode() const
Definition: PathInfo.h:327
void setPath(const Pathname &path)
Set a new Pathname.
Definition: PathInfo.h:258
ByteCount df(const Pathname &path_r)
Report free disk space on a mounted file system.
Definition: PathInfo.cc:1090
bool isWGrp() const
Definition: PathInfo.h:123