4 #ifndef RUDIMENTS_FILE_H 5 #define RUDIMENTS_FILE_H 7 #include <rudiments/private/fileincludes.h> 58 virtual bool open(
const char *name, int32_t flags);
89 virtual bool open(
const char *name,
101 virtual bool create(
const char *name, mode_t perms);
116 virtual char *getContents();
128 virtual ssize_t getContents(
unsigned char *buffer,
135 virtual bool truncate()
const;
140 virtual bool truncate(off64_t length)
const;
146 virtual off64_t getCurrentPosition()
const;
151 virtual off64_t setPositionRelativeToBeginning(
152 off64_t offset)
const;
157 virtual off64_t setPositionRelativeToCurrent(
158 off64_t offset)
const;
167 virtual off64_t setPositionRelativeToEnd(off64_t offset)
const;
172 virtual bool tryLockFile(int16_t type)
const;
178 virtual bool lockFile(int16_t type)
const;
194 virtual bool checkLockFile(int16_t type,
198 off64_t *conflen)
const;
202 virtual bool unlockFile()
const;
209 virtual bool tryLockRegion(int16_t type,
218 virtual bool lockRegion(int16_t type,
237 virtual bool checkLockRegion(int16_t type,
243 off64_t *conflen)
const;
249 virtual bool unlockRegion(off64_t start,
256 virtual bool tryLockFromCurrent(int16_t type,
264 virtual bool tryLockFromCurrent(int16_t type,
273 virtual bool lockFromCurrent(int16_t type,
281 virtual bool lockFromCurrent(int16_t type,
299 virtual bool checkLockFromCurrent(int16_t type,
304 off64_t *conflen)
const;
321 virtual bool checkLockFromCurrent(int16_t type,
327 off64_t *conflen)
const;
332 virtual bool unlockFromCurrent(off64_t len)
const;
338 virtual bool unlockFromCurrent(off64_t start,
345 virtual bool tryLockFromEnd(int16_t type,
353 virtual bool tryLockFromEnd(int16_t type,
362 virtual bool lockFromEnd(int16_t type, off64_t len)
const;
369 virtual bool lockFromEnd(int16_t type,
387 virtual bool checkLockFromEnd(int16_t type,
392 off64_t *conflen)
const;
409 virtual bool checkLockFromEnd(int16_t type,
415 off64_t *conflen)
const;
420 virtual bool unlockFromEnd(off64_t len)
const;
426 virtual bool unlockFromEnd(off64_t start,
434 virtual bool tryLockRemainder(int16_t type,
435 off64_t start)
const;
442 virtual bool lockRemainder(int16_t type,
443 off64_t start)
const;
460 virtual bool checkLockRemainder(int16_t type,
465 off64_t *conflen)
const;
471 virtual bool unlockRemainder(off64_t start)
const;
477 virtual bool tryLockRemainderFromCurrent(int16_t type)
const;
483 virtual bool tryLockRemainderFromCurrent(int16_t type,
484 off64_t start)
const;
490 virtual bool lockRemainderFromCurrent(int16_t type)
const;
497 virtual bool lockRemainderFromCurrent(int16_t type,
498 off64_t start)
const;
514 virtual bool checkLockRemainderFromCurrent(
519 off64_t *conflen)
const;
536 virtual bool checkLockRemainderFromCurrent(
542 off64_t *conflen)
const;
547 virtual bool unlockRemainderFromCurrent()
const;
553 virtual bool unlockRemainderFromCurrent(off64_t start)
const;
559 virtual bool tryLockRemainderFromEnd(int16_t type)
const;
565 virtual bool tryLockRemainderFromEnd(int16_t type,
566 off64_t start)
const;
572 virtual bool lockRemainderFromEnd(int16_t type)
const;
578 virtual bool lockRemainderFromEnd(int16_t type,
579 off64_t start)
const;
595 virtual bool checkLockRemainderFromEnd(
600 off64_t *conflen)
const;
616 virtual bool checkLockRemainderFromEnd(
622 off64_t *conflen)
const;
627 virtual bool unlockRemainderFromEnd()
const;
632 virtual bool unlockRemainderFromEnd(off64_t start)
const;
644 virtual bool sequentialAccess(off64_t start,
656 virtual bool randomAccess(off64_t start,
size_t len)
const;
667 virtual bool onlyOnce(off64_t start,
size_t len)
const;
678 virtual bool willNeed(off64_t start,
size_t len)
const;
689 virtual bool wontNeed(off64_t start,
size_t len)
const;
700 virtual bool normalAccess(off64_t start,
size_t len)
const;
710 virtual bool reserve(off64_t start,
size_t len)
const;
725 virtual bool sync()
const;
742 virtual bool dataSync()
const;
749 virtual void dontGetCurrentPropertiesOnOpen();
760 virtual void getCurrentPropertiesOnOpen();
766 virtual bool getCurrentProperties();
769 virtual mode_t getPermissions()
const;
772 virtual uid_t getOwnerUserId()
const;
775 virtual gid_t getOwnerGroupId()
const;
778 virtual off64_t getSize()
const;
783 virtual blksize_t getBlockSize()
const;
787 virtual blkcnt_t getBlockCount()
const;
791 virtual int32_t isSocket()
const;
795 virtual int32_t isSymbolicLink()
const;
799 virtual int32_t isRegularFile()
const;
803 virtual int32_t isBlockDevice()
const;
807 virtual int32_t isDirectory()
const;
811 virtual int32_t isCharacterDevice()
const;
815 virtual int32_t isFifo()
const;
818 virtual time_t getLastAccessTime()
const;
824 virtual time_t getLastModificationTime()
const;
830 virtual time_t getLastChangeTime()
const;
833 virtual dev_t getDevice()
const;
836 virtual dev_t getDeviceType()
const;
839 virtual uint64_t getInode()
const;
842 virtual nlink_t getNumberOfHardLinks()
const;
847 virtual bool setPermissions(mode_t perms)
const;
852 virtual bool changeOwner(
const char *newuser,
853 const char *newgroup)
const;
857 virtual bool changeOwner(uid_t uid, gid_t gid)
const;
862 virtual bool canChangeOwner()
const;
866 virtual int64_t maxLinks()
const;
871 virtual void *getInternalFileStatisticsStructure();
877 static bool createFile(
const char *name, mode_t perms);
881 static bool createFifo(
const char *filename, mode_t perms);
891 static int32_t createTemporaryFile(
char *templatefilename);
905 static int32_t createTemporaryFile(
char *templatefilename,
910 static bool createHardLink(
const char *oldpath,
911 const char *newpath);
916 static bool createSymbolicLink(
const char *oldpath,
917 const char *newpath);
925 static char *resolveSymbolicLink(
const char *filename);
930 static bool rename(
const char *oldpath,
931 const char *newpath);
935 static bool remove(
const char *filename);
940 static bool truncate(
const char *filename);
944 static bool truncate(
const char *filename, off64_t length);
959 static char *getContents(
const char *name);
971 static ssize_t getContents(
const char *name,
972 unsigned char *buffer,
977 static bool exists(
const char *filename);
981 static bool readable(
const char *filename);
985 static bool writeable(
const char *filename);
989 static bool executable(
const char *filename);
999 static bool accessible(
const char *filename, int32_t mode);
1006 static bool getLastChangeTime(
const char *filename,
1011 static bool setPermissions(
const char *filename,
1016 static bool changeOwner(
const char *filename,
1017 const char *newuser,
1018 const char *newgroup);
1022 static bool changeOwner(
const char *filename,
1023 uid_t uid, gid_t gid);
1027 static bool canChangeOwner(
const char *filename);
1033 static bool setLastAccessTime(
const char *filename,
1034 time_t lastaccesstime);
1039 static bool setLastModificationTime(
const char *filename,
1040 time_t lastmodtime);
1046 static bool setLastAccessAndModificationTimes(
1047 const char *filename,
1048 time_t lastaccesstime,
1049 time_t lastmodtime);
1054 static bool setLastAccessAndModificationTimes(
1055 const char *filename);
1062 static char *dirname(
const char *filename);
1067 static char *basename(
const char *filename);
1074 static char *basename(
const char *filename,
1075 const char *suffix);
1082 static char *eightDotThree(
const char *filename);
1090 static key_t generateKey(
const char *filename, int32_t
id);
1094 static int64_t maxLinks(
const char *filename);
1096 #include <rudiments/private/file.h>
filedescriptor & operator=(const filedescriptor &f)
Definition: filedescriptor.h:13