6 using namespace IOFlags;
20 IOFD &newfd,
unsigned int& )
27 else if (flags & OpenRead)
28 openflags |= O_RDONLY;
29 else if (flags & OpenWrite)
30 openflags |= O_WRONLY;
36 openflags |= O_APPEND;
42 if (flags & OpenUnbuffered)
56 openflags |= O_NOCTTY;
58 if ((newfd = ::open (name, openflags, perms)) == -1)
69 s = ::pread (fd (), into, n, pos);
70 while (s == -1 && errno == EINTR);
85 s = ::pwrite (fd (), from, n, pos);
86 while (s == -1 && errno == EINTR);
101 IOFD fd = this->fd ();
105 if (fstat (fd, &info) == -1)
114 IOFD fd = this->fd ();
116 assert (whence == CURRENT || whence == SET || whence == END);
119 int mywhence = (whence == SET ? SEEK_SET
120 : whence == CURRENT ? SEEK_CUR
122 if ((result = ::lseek (fd, offset, mywhence)) == -1)
131 IOFD fd = this->fd ();
134 if (ftruncate (fd, size) == -1)
141 IOFD fd = this->fd ();
144 #if _POSIX_SYNCHRONIZED_IO > 0
145 if (fdatasync (fd) == -1)
147 #elif _POSIX_FSYNC > 0
148 if (fsync (fd) == -1)
156 int ret = ::close (fd);
157 if (error) *error = errno;
static bool sysclose(IOFD fd, int *error=0)
static void sysopen(const char *name, int flags, int perms, IOFD &newfd, unsigned &newflags)
void throwStorageError(const char *context, const char *call, int error)
std::vector< Variable::Flags > flags
virtual IOOffset size(void) const
virtual IOOffset position(void) const
static IOFD sysduplicate(IOFD fd)
unsigned int offset(bool)
static std::string from(" from ")
virtual IOSize write(const void *from, IOSize n)
virtual void resize(IOOffset size)
tuple size
Write out results.