|
|
Go to the documentation of this file.
12 throwStorageError(
"FileDuplicateError",
"Calling File::sysduplicate()",
"dup()", errno);
24 openflags |= O_RDONLY;
26 openflags |= O_WRONLY;
32 openflags |= O_APPEND;
52 openflags |= O_NOCTTY;
54 if ((newfd = ::open(
name, openflags, perms)) == -1)
63 s = ::pread(
fd(), into,
n,
pos);
64 while (
s == -1 && errno == EINTR);
77 s = ::pwrite(
fd(), from,
n,
pos);
78 while (
s == -1 && errno == EINTR);
95 if (fstat(
fd, &
info) == -1)
104 assert(whence == CURRENT || whence ==
SET || whence == END);
107 int mywhence = (whence ==
SET ? SEEK_SET : whence == CURRENT ? SEEK_CUR : SEEK_END);
109 throwStorageError(
"FilePositionError",
"Calling File::position()",
"lseek()", errno);
118 if (ftruncate(
fd,
size) == -1)
119 throwStorageError(
"FileResizeError",
"Calling File::resize()",
"ftruncate()", errno);
126 #if _POSIX_SYNCHRONIZED_IO > 0
127 if (fdatasync(
fd) == -1)
128 throwStorageError(
"FileFlushError",
"Calling File::flush()",
"fdatasync()", errno);
129 #elif _POSIX_FSYNC > 0
136 int ret = ::close(
fd);
ret
prodAgent to be discontinued
void flush(void) override
void resize(IOOffset size) override
void throwStorageError(const char *category, const char *context, const char *call, int error)
static void sysopen(const char *name, int flags, int perms, IOFD &newfd, unsigned &newflags)
IOSize write(const void *from, IOSize n) override
IOOffset size(void) const override
virtual IOOffset position(void) const
static IOFD sysduplicate(IOFD fd)
static bool sysclose(IOFD fd, int *error=nullptr)