4 #ifndef RUDIMENTS_FILE_H 5 #define RUDIMENTS_FILE_H 7 #include <rudiments/private/fileincludes.h> 60 virtual bool open(
const char *name, int32_t flags);
91 virtual bool open(
const char *name,
103 virtual bool create(
const char *name, mode_t perms);
118 virtual char *getContents();
130 virtual ssize_t getContents(
unsigned char *buffer,
137 virtual bool truncate()
const;
142 virtual bool truncate(off64_t length)
const;
148 virtual off64_t getCurrentPosition()
const;
153 virtual off64_t setPositionRelativeToBeginning(
154 off64_t offset)
const;
159 virtual off64_t setPositionRelativeToCurrent(
160 off64_t offset)
const;
169 virtual off64_t setPositionRelativeToEnd(off64_t offset)
const;
174 virtual bool tryLockFile(int16_t type)
const;
180 virtual bool lockFile(int16_t type)
const;
196 virtual bool checkLockFile(int16_t type,
200 off64_t *conflen)
const;
204 virtual bool unlockFile()
const;
211 virtual bool tryLockRegion(int16_t type,
220 virtual bool lockRegion(int16_t type,
239 virtual bool checkLockRegion(int16_t type,
245 off64_t *conflen)
const;
251 virtual bool unlockRegion(off64_t start,
258 virtual bool tryLockFromCurrent(int16_t type,
266 virtual bool tryLockFromCurrent(int16_t type,
275 virtual bool lockFromCurrent(int16_t type,
283 virtual bool lockFromCurrent(int16_t type,
301 virtual bool checkLockFromCurrent(int16_t type,
306 off64_t *conflen)
const;
323 virtual bool checkLockFromCurrent(int16_t type,
329 off64_t *conflen)
const;
334 virtual bool unlockFromCurrent(off64_t len)
const;
340 virtual bool unlockFromCurrent(off64_t start,
347 virtual bool tryLockFromEnd(int16_t type,
355 virtual bool tryLockFromEnd(int16_t type,
364 virtual bool lockFromEnd(int16_t type, off64_t len)
const;
371 virtual bool lockFromEnd(int16_t type,
389 virtual bool checkLockFromEnd(int16_t type,
394 off64_t *conflen)
const;
411 virtual bool checkLockFromEnd(int16_t type,
417 off64_t *conflen)
const;
422 virtual bool unlockFromEnd(off64_t len)
const;
428 virtual bool unlockFromEnd(off64_t start,
436 virtual bool tryLockRemainder(int16_t type,
437 off64_t start)
const;
444 virtual bool lockRemainder(int16_t type,
445 off64_t start)
const;
462 virtual bool checkLockRemainder(int16_t type,
467 off64_t *conflen)
const;
473 virtual bool unlockRemainder(off64_t start)
const;
479 virtual bool tryLockRemainderFromCurrent(int16_t type)
const;
485 virtual bool tryLockRemainderFromCurrent(int16_t type,
486 off64_t start)
const;
492 virtual bool lockRemainderFromCurrent(int16_t type)
const;
499 virtual bool lockRemainderFromCurrent(int16_t type,
500 off64_t start)
const;
516 virtual bool checkLockRemainderFromCurrent(
521 off64_t *conflen)
const;
538 virtual bool checkLockRemainderFromCurrent(
544 off64_t *conflen)
const;
549 virtual bool unlockRemainderFromCurrent()
const;
555 virtual bool unlockRemainderFromCurrent(off64_t start)
const;
561 virtual bool tryLockRemainderFromEnd(int16_t type)
const;
567 virtual bool tryLockRemainderFromEnd(int16_t type,
568 off64_t start)
const;
574 virtual bool lockRemainderFromEnd(int16_t type)
const;
580 virtual bool lockRemainderFromEnd(int16_t type,
581 off64_t start)
const;
597 virtual bool checkLockRemainderFromEnd(
602 off64_t *conflen)
const;
618 virtual bool checkLockRemainderFromEnd(
624 off64_t *conflen)
const;
629 virtual bool unlockRemainderFromEnd()
const;
634 virtual bool unlockRemainderFromEnd(off64_t start)
const;
646 virtual bool sequentialAccess(off64_t start,
658 virtual bool randomAccess(off64_t start,
size_t len)
const;
669 virtual bool onlyOnce(off64_t start,
size_t len)
const;
680 virtual bool willNeed(off64_t start,
size_t len)
const;
691 virtual bool wontNeed(off64_t start,
size_t len)
const;
702 virtual bool normalAccess(off64_t start,
size_t len)
const;
712 virtual bool reserve(off64_t start,
size_t len)
const;
727 virtual bool sync()
const;
744 virtual bool dataSync()
const;
751 virtual void dontGetCurrentPropertiesOnOpen();
762 virtual void getCurrentPropertiesOnOpen();
768 virtual bool getCurrentProperties();
771 virtual mode_t getPermissions()
const;
774 virtual uid_t getOwnerUserId()
const;
777 virtual gid_t getOwnerGroupId()
const;
780 virtual off64_t getSize()
const;
785 virtual blksize_t getBlockSize()
const;
789 virtual blkcnt_t getBlockCount()
const;
793 virtual int32_t isSocket()
const;
797 virtual int32_t isSymbolicLink()
const;
801 virtual int32_t isRegularFile()
const;
805 virtual int32_t isBlockDevice()
const;
809 virtual int32_t isDirectory()
const;
813 virtual int32_t isCharacterDevice()
const;
817 virtual int32_t isFifo()
const;
820 virtual time_t getLastAccessTime()
const;
826 virtual time_t getLastModificationTime()
const;
832 virtual time_t getLastChangeTime()
const;
835 virtual dev_t getDevice()
const;
838 virtual dev_t getDeviceType()
const;
841 virtual uint64_t getInode()
const;
844 virtual nlink_t getNumberOfHardLinks()
const;
849 virtual bool setPermissions(mode_t perms)
const;
854 virtual bool changeOwner(
const char *newuser,
855 const char *newgroup)
const;
859 virtual bool changeOwner(uid_t uid, gid_t gid)
const;
864 virtual bool canChangeOwner()
const;
868 virtual int64_t maxLinks()
const;
873 virtual void *getInternalFileStatisticsStructure();
879 static bool createFile(
const char *name, mode_t perms);
883 static bool createFifo(
const char *filename, mode_t perms);
893 static int32_t createTemporaryFile(
char *templatefilename);
907 static int32_t createTemporaryFile(
char *templatefilename,
912 static bool createHardLink(
const char *oldpath,
913 const char *newpath);
918 static bool createSymbolicLink(
const char *oldpath,
919 const char *newpath);
927 static char *resolveSymbolicLink(
const char *filename);
932 static bool rename(
const char *oldpath,
933 const char *newpath);
937 static bool remove(
const char *filename);
942 static bool truncate(
const char *filename);
946 static bool truncate(
const char *filename, off64_t length);
961 static char *getContents(
const char *name);
973 static ssize_t getContents(
const char *name,
974 unsigned char *buffer,
979 static bool exists(
const char *filename);
983 static bool readable(
const char *filename);
987 static bool writeable(
const char *filename);
991 static bool executable(
const char *filename);
1001 static bool accessible(
const char *filename, int32_t mode);
1008 static bool getLastChangeTime(
const char *filename,
1013 static bool setPermissions(
const char *filename,
1018 static bool changeOwner(
const char *filename,
1019 const char *newuser,
1020 const char *newgroup);
1024 static bool changeOwner(
const char *filename,
1025 uid_t uid, gid_t gid);
1029 static bool canChangeOwner(
const char *filename);
1035 static bool setLastAccessTime(
const char *filename,
1036 time_t lastaccesstime);
1041 static bool setLastModificationTime(
const char *filename,
1042 time_t lastmodtime);
1048 static bool setLastAccessAndModificationTimes(
1049 const char *filename,
1050 time_t lastaccesstime,
1051 time_t lastmodtime);
1056 static bool setLastAccessAndModificationTimes(
1057 const char *filename);
1064 static char *dirname(
const char *filename);
1069 static char *basename(
const char *filename);
1076 static char *basename(
const char *filename,
1077 const char *suffix);
1084 static char *eightDotThree(
const char *filename);
1092 static key_t generateKey(
const char *filename, int32_t
id);
1096 static int64_t maxLinks(
const char *filename);
1098 #include <rudiments/private/file.h>
filedescriptor & operator=(const filedescriptor &f)
Definition: filedescriptor.h:14