/*
- * $Id: defines.h,v 1.106 2002/07/15 09:14:29 hno Exp $
+ * $Id: defines.h,v 1.107 2002/08/08 20:12:45 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#define O_BINARY 0
#endif
+/*
+ * Macro to find file access mode
+ */
+#ifdef O_ACCMODE
+#define FILE_MODE(x) ((x)&O_ACCMODE)
+#else
+#define FILE_MODE(x) ((x)&(O_RDONLY|O_WRONLY|O_RDWR))
+#endif
+
#define HTTP_REQBUF_SZ 4096
#endif /* SQUID_DEFINES_H */
/*
- * $Id: disk.cc,v 1.158 2002/04/13 23:07:50 hno Exp $
+ * $Id: disk.cc,v 1.159 2002/08/08 20:12:45 hno Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
file_open(const char *path, int mode)
{
int fd;
- if (mode & O_WRONLY)
+ if (FILE_MODE(mode) == O_WRONLY)
mode |= O_APPEND;
mode |= SQUID_NONBLOCK;
errno = 0;
((squidaiostate_t *) (sio->fsstate))->flags.opening = 1;
sio->swap_filen = f;
sio->swap_dirn = SD->index;
- sio->mode = O_RDONLY;
+ sio->mode = O_RDONLY | O_BINARY;
sio->callback = callback;
sio->callback_data = cbdataReference(callback_data);
sio->e = e;
aiostate->fd = fd;
commSetCloseOnExec(fd);
fd_open(fd, FD_FILE, storeAufsDirFullPath(INDEXSD(sio->swap_dirn), sio->swap_filen, NULL));
- if (sio->mode & O_WRONLY)
+ if (FILE_MODE(sio->mode) == O_WRONLY)
storeAufsKickWriteQueue(sio);
- else if (sio->mode & O_RDONLY)
+ else if (FILE_MODE(sio->mode) == O_RDONLY)
storeAufsKickReadQueue(sio);
if (aiostate->flags.close_request)
storeAufsIOCallback(sio, errflag);
/*
- * $Id: store_io_coss.cc,v 1.17 2002/07/28 21:36:31 hno Exp $
+ * $Id: store_io_coss.cc,v 1.18 2002/08/08 20:12:45 hno Exp $
*
* DEBUG: section 79 Storage Manager COSS Interface
* AUTHOR: Eric Stern
cstate = memPoolAlloc(coss_state_pool);
sio->fsstate = cstate;
sio->offset = 0;
- sio->mode = O_WRONLY;
+ sio->mode = O_WRONLY | O_BINARY;
/*
* If we get handed an object with a size of -1,
sio->swap_filen = f;
sio->swap_dirn = SD->index;
sio->offset = 0;
- sio->mode = O_RDONLY;
+ sio->mode = O_RDONLY | O_BINARY;
sio->callback = callback;
sio->file_callback = file_callback;
sio->callback_data = cbdataReference(callback_data);
storeCossClose(SwapDir * SD, storeIOState * sio)
{
debug(79, 3) ("storeCossClose: offset %d\n", sio->swap_filen);
- if (sio->mode & O_WRONLY)
+ if (FILE_MODE(sio->mode) == O_WRONLY)
storeCossMemBufUnlock(SD, sio);
storeCossIOCallback(sio, 0);
}
/*
- * $Id: store_io_diskd.cc,v 1.26 2002/07/28 21:36:31 hno Exp $
+ * $Id: store_io_diskd.cc,v 1.27 2002/08/08 20:12:46 hno Exp $
*
* DEBUG: section 79 Squid-side DISKD I/O functions.
* AUTHOR: Duane Wessels
sio->swap_filen = f;
sio->swap_dirn = SD->index;
- sio->mode = O_RDONLY;
+ sio->mode = O_RDONLY | O_BINARY;
sio->callback = callback;
sio->callback_data = cbdataReference(callback_data);
sio->e = e;
debug(79, 3) ("storeDiskdOpenDone: dirno %d, fileno %08x status %d\n",
sio->swap_dirn, sio->swap_filen, M->status);
if (M->status < 0) {
- sio->mode & O_RDONLY ? diskd_stats.open.fail++ : diskd_stats.create.fail++;
+ FILE_MODE(sio->mode) == O_RDONLY ? diskd_stats.open.fail++ : diskd_stats.create.fail++;
storeDiskdIOCallback(sio, DISK_ERROR);
} else {
- sio->mode & O_RDONLY ? diskd_stats.open.success++ : diskd_stats.create.success++;
+ FILE_MODE(sio->mode) == O_RDONLY ? diskd_stats.open.success++ : diskd_stats.create.success++;
}
}
/*
- * $Id: store_io_ufs.cc,v 1.10 2002/04/13 23:07:57 hno Exp $
+ * $Id: store_io_ufs.cc,v 1.11 2002/08/08 20:12:46 hno Exp $
*
* DEBUG: section 79 Storage Manager UFS Interface
* AUTHOR: Duane Wessels
sio->swap_filen = f;
sio->swap_dirn = SD->index;
- sio->mode = O_RDONLY;
+ sio->mode = O_RDONLY | O_BINARY;
sio->callback = callback;
sio->callback_data = cbdataReference(callback_data);
sio->e = e;