4 #ifndef RUDIMENTS_FILE_H 5 #define RUDIMENTS_FILE_H 7 #include <rudiments/private/fileincludes.h> 63 bool open(
const char *name, int32_t flags);
93 bool open(
const char *name, int32_t flags, mode_t perms);
101 bool create(
const char *name, mode_t perms);
122 ssize_t getContents(
unsigned char *buffer,
size_t buffersize);
128 bool truncate()
const;
133 bool truncate(off64_t length)
const;
139 off64_t getCurrentPosition()
const;
144 off64_t setPositionRelativeToBeginning(off64_t offset)
const;
149 off64_t setPositionRelativeToCurrent(off64_t offset)
const;
158 off64_t setPositionRelativeToEnd(off64_t offset)
const;
163 bool tryLockFile(int16_t type)
const;
169 bool lockFile(int16_t type)
const;
185 bool checkLockFile(int16_t type,
189 off64_t *conflen)
const;
193 bool unlockFile()
const;
200 bool tryLockRegion(int16_t type, off64_t start,
208 bool lockRegion(int16_t type, off64_t start,
226 bool checkLockRegion(int16_t type,
232 off64_t *conflen)
const;
238 bool unlockRegion(off64_t start, off64_t len)
const;
244 bool tryLockFromCurrent(int16_t type, off64_t len)
const;
251 bool tryLockFromCurrent(int16_t type, off64_t start,
259 bool lockFromCurrent(int16_t type, off64_t len)
const;
266 bool lockFromCurrent(int16_t type, off64_t start,
283 bool checkLockFromCurrent(int16_t type, off64_t len,
287 off64_t *conflen)
const;
304 bool checkLockFromCurrent(int16_t type, off64_t start,
309 off64_t *conflen)
const;
314 bool unlockFromCurrent(off64_t len)
const;
320 bool unlockFromCurrent(off64_t start, off64_t len)
const;
326 bool tryLockFromEnd(int16_t type, off64_t len)
const;
333 bool tryLockFromEnd(int16_t type, off64_t start,
341 bool lockFromEnd(int16_t type, off64_t len)
const;
348 bool lockFromEnd(int16_t type, off64_t start,
365 bool checkLockFromEnd(int16_t type, off64_t len,
369 off64_t *conflen)
const;
386 bool checkLockFromEnd(int16_t type, off64_t start,
391 off64_t *conflen)
const;
396 bool unlockFromEnd(off64_t len)
const;
402 bool unlockFromEnd(off64_t start, off64_t len)
const;
409 bool tryLockRemainder(int16_t type, off64_t start)
const;
416 bool lockRemainder(int16_t type, off64_t start)
const;
433 bool checkLockRemainder(int16_t type, off64_t start,
437 off64_t *conflen)
const;
443 bool unlockRemainder(off64_t start)
const;
449 bool tryLockRemainderFromCurrent(int16_t type)
const;
455 bool tryLockRemainderFromCurrent(int16_t type,
456 off64_t start)
const;
462 bool lockRemainderFromCurrent(int16_t type)
const;
469 bool lockRemainderFromCurrent(int16_t type,
470 off64_t start)
const;
486 bool checkLockRemainderFromCurrent(int16_t type,
490 off64_t *conflen)
const;
507 bool checkLockRemainderFromCurrent(int16_t type,
512 off64_t *conflen)
const;
517 bool unlockRemainderFromCurrent()
const;
523 bool unlockRemainderFromCurrent(off64_t start)
const;
529 bool tryLockRemainderFromEnd(int16_t type)
const;
535 bool tryLockRemainderFromEnd(int16_t type,
536 off64_t start)
const;
542 bool lockRemainderFromEnd(int16_t type)
const;
548 bool lockRemainderFromEnd(int16_t type, off64_t start)
const;
564 bool checkLockRemainderFromEnd(int16_t type,
568 off64_t *conflen)
const;
584 bool checkLockRemainderFromEnd(int16_t type,
589 off64_t *conflen)
const;
594 bool unlockRemainderFromEnd()
const;
599 bool unlockRemainderFromEnd(off64_t start)
const;
611 bool sequentialAccess(off64_t start,
size_t len)
const;
622 bool randomAccess(off64_t start,
size_t len)
const;
633 bool onlyOnce(off64_t start,
size_t len)
const;
644 bool willNeed(off64_t start,
size_t len)
const;
655 bool wontNeed(off64_t start,
size_t len)
const;
666 bool normalAccess(off64_t start,
size_t len)
const;
676 bool reserve(off64_t start,
size_t len)
const;
708 bool dataSync()
const;
715 void dontGetCurrentPropertiesOnOpen();
726 void getCurrentPropertiesOnOpen();
732 bool getCurrentProperties();
735 mode_t getPermissions()
const;
738 uid_t getOwnerUserId()
const;
741 gid_t getOwnerGroupId()
const;
744 off64_t getSize()
const;
749 blksize_t getBlockSize()
const;
753 blkcnt_t getBlockCount()
const;
757 int32_t isSocket()
const;
761 int32_t isSymbolicLink()
const;
765 int32_t isRegularFile()
const;
769 int32_t isBlockDevice()
const;
773 int32_t isDirectory()
const;
776 int32_t isCharacterDevice()
const;
780 int32_t isFifo()
const;
783 time_t getLastAccessTime()
const;
789 time_t getLastModificationTime()
const;
795 time_t getLastChangeTime()
const;
798 dev_t getDevice()
const;
801 dev_t getDeviceType()
const;
804 uint64_t getInode()
const;
807 nlink_t getNumberOfHardLinks()
const;
812 bool setPermissions(mode_t perms)
const;
817 bool changeOwner(
const char *newuser,
818 const char *newgroup)
const;
822 bool changeOwner(uid_t uid, gid_t gid)
const;
827 bool canChangeOwner()
const;
831 int64_t maxLinks()
const;
836 void *getInternalFileStatisticsStructure();
842 static bool createFile(
const char *name, mode_t perms);
846 static bool createFifo(
const char *filename, mode_t perms);
861 static int32_t createTemporaryFile(
char *templatefilename);
865 static bool createHardLink(
const char *oldpath,
866 const char *newpath);
871 static bool createSymbolicLink(
const char *oldpath,
872 const char *newpath);
880 static char *resolveSymbolicLink(
const char *filename);
885 static bool rename(
const char *oldpath,
886 const char *newpath);
890 static bool remove(
const char *filename);
895 static bool truncate(
const char *filename);
899 static bool truncate(
const char *filename, off64_t length);
911 static char *getContents(
const char *name);
920 static ssize_t getContents(
const char *name,
921 unsigned char *buffer,
926 static bool exists(
const char *filename);
930 static bool readable(
const char *filename);
934 static bool writeable(
const char *filename);
938 static bool executable(
const char *filename);
948 static bool accessible(
const char *filename, int32_t mode);
955 static bool getLastChangeTime(
const char *filename,
960 static bool setPermissions(
const char *filename,
965 static bool changeOwner(
const char *filename,
967 const char *newgroup);
971 static bool changeOwner(
const char *filename,
972 uid_t uid, gid_t gid);
976 static bool canChangeOwner(
const char *filename);
982 static bool setLastAccessTime(
const char *filename,
983 time_t lastaccesstime);
988 static bool setLastModificationTime(
const char *filename,
995 static bool setLastAccessAndModificationTimes(
996 const char *filename,
997 time_t lastaccesstime,
1003 static bool setLastAccessAndModificationTimes(
1004 const char *filename);
1011 static char *dirname(
const char *filename);
1016 static char *basename(
const char *filename);
1023 static char *basename(
const char *filename,
1024 const char *suffix);
1031 static char *eightDotThree(
const char *filename);
1039 static key_t generateKey(
const char *filename, int32_t
id);
1043 static int64_t maxLinks(
const char *filename);
1045 #include <rudiments/private/file.h>
filedescriptor & operator=(const filedescriptor &f)
Definition: filedescriptor.h:14