161
161
return FILEIO_WRITE_ERROR_NOSPC;
163
163
return FILEIO_WRITE_ERROR_FBIG;
164
#if defined(VMX86_SERVER)
166
return FILEIO_LOCK_FAILED;
166
170
return FILEIO_WRITE_ERROR_DQUOT;
735
739
if ((access & (FILEIO_OPEN_EXCLUSIVE_LOCK |
736
FILEIO_OPEN_MULTIWRITER_LOCK)) != 0 ||
740
FILEIO_OPEN_MULTIWRITER_LOCK)) != 0 ||
737
741
(access & (FILEIO_OPEN_ACCESS_READ | FILEIO_OPEN_ACCESS_WRITE |
738
FILEIO_OPEN_LOCKED)) ==
742
FILEIO_OPEN_LOCKED)) ==
739
743
(FILEIO_OPEN_ACCESS_READ | FILEIO_OPEN_LOCKED)) {
740
744
if (File_OnVMFS(pathName)) {
741
745
access &= ~FILEIO_OPEN_LOCKED;
742
if ((access & FILEIO_OPEN_MULTIWRITER_LOCK) != 0) {
743
flags |= O_MULTIWRITER_LOCK;
745
flags |= O_EXCLUSIVE_LOCK;
746
if ((access & FILEIO_OPEN_MULTIWRITER_LOCK) != 0) {
747
flags |= O_MULTIWRITER_LOCK;
749
flags |= O_EXCLUSIVE_LOCK;
751
755
FileIO_Init(file, pathName);
752
756
ret = FileIO_Lock(file, access);
753
if (ret != FILEIO_SUCCESS) {
757
if (!FileIO_IsSuccess(ret)) {
1245
1249
return fsync(file->posix);
1249
* readv & writev are not available in the FreeBSD or Solaris Tools builds
1251
#if !defined(VMX86_TOOLS) || (!defined(__FreeBSD__) && !defined(sun))
1255
1254
*-----------------------------------------------------------------------------
1781
#endif /* defined(GLIBC_VERSION_21) || defined(__APPLE__) */
1782
#endif /* !defined(VMX86_TOOLS) || !(defined(FreeBSD) || defined(sun)) */
1780
#endif /* defined(GLIBC_VERSION_21) || defined(__APPLE__) || defined(__FreeBSD__) */
1783
1781
#endif /* !defined(N_PLAT_NLM) */
1859
FileIO_Access(ConstUnicode pathName, // IN: path name to be tested
1860
int accessMode) // IN: access modes to be asserted
1857
FileIO_Access(ConstUnicode pathName, // IN: Path name to be tested. May be NULL.
1858
int accessMode) // IN: Access modes to be asserted
1862
if (pathName == NULL) {
1864
return FILEIO_ERROR;
1865
1867
if (accessMode & FILEIO_ACCESS_READ) {
2030
*-----------------------------------------------------------------------------
2032
* FileIO_DescriptorToStream
2034
* Return a FILE * stream equivalent to the given FileIODescriptor.
2035
* This is the logical equivalent of Posix dup() then fdopen().
2037
* Since the passed descriptor and returned FILE * represent the same
2038
* underlying file, and their cursor is shared, you should avoid
2039
* interleaving uses to both.
2042
* A FILE * representing the same underlying file as the passed descriptor
2043
* NULL if there was an error.
2044
* Caller should fclose the returned descriptor when finished.
2049
*-----------------------------------------------------------------------------
2053
FileIO_DescriptorToStream(FileIODescriptor *fdesc) // IN
2060
/* The file you pass us should be valid and opened for *something* */
2061
ASSERT(FileIO_IsValid(fdesc));
2062
ASSERT((fdesc->flags & (FILEIO_OPEN_ACCESS_READ | FILEIO_OPEN_ACCESS_WRITE)) != 0);
2063
tmpFlags = fdesc->flags & (FILEIO_OPEN_ACCESS_READ | FILEIO_OPEN_ACCESS_WRITE);
2065
dupFd = dup(fdesc->posix);
2072
if (tmpFlags == (FILEIO_OPEN_ACCESS_READ | FILEIO_OPEN_ACCESS_WRITE)) {
2074
} else if (tmpFlags == FILEIO_OPEN_ACCESS_WRITE) {
2076
} else { /* therefore (tmpFlags == FILEIO_OPEN_ACCESS_READ) */
2080
stream = fdopen(dupFd, mode);
2082
if (stream == NULL) {
2026
2090
#if defined(__APPLE__)