/*
- * $Id: disk.cc,v 1.139 1999/01/13 23:24:11 wessels Exp $
+ * $Id: disk.cc,v 1.140 1999/01/21 21:13:00 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
* leaking write state data by closing the descriptor
*/
assert(F->write_handler == NULL);
+ F->flags.closing = 1;
#if USE_ASYNC_IO
aioClose(fd);
#else
#endif
debug(6, F->flags.close_request ? 2 : 5)
("file_close: FD %d, really closing\n", fd);
+#if !USE_ASYNC_IO
fd_close(fd);
+#endif
Counter.syscalls.disk.closes++;
}
/*
- * $Id: fd.cc,v 1.34 1999/01/21 21:10:32 wessels Exp $
+ * $Id: fd.cc,v 1.35 1999/01/21 21:13:01 wessels Exp $
*
* DEBUG: section 51 Filedescriptor Functions
* AUTHOR: Duane Wessels
F->timeout = 0;
}
+#if USE_ASYNC_IO
+void
+fd_was_closed(int fd)
+{
+ fde *F = &fd_table[fd];
+ if (F->flags.closing)
+ fd_close(fd);
+}
+#endif
+
void
fd_open(int fd, unsigned int type, const char *desc)
{
fde *F = &fd_table[fd];
assert(fd >= 0);
+#if USE_ASYNC_IO
+ if (F->flags.closing) {
+ /* Reuse of a closed FD before we have noticed it is closed */
+ fd_close(fd);
+ }
+#endif
if (F->flags.open) {
debug(51, 1) ("WARNING: Closing open FD %4d\n", fd);
fd_close(fd);
/*
- * $Id: main.cc,v 1.286 1999/01/19 02:24:28 wessels Exp $
+ * $Id: main.cc,v 1.287 1999/01/21 21:13:02 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
releaseServerSockets();
commCloseAllSockets();
unlinkdClose();
+#if USE_ASYNC_IO
+ aioSync(); /* flush pending object writes / unlinks */
+#endif
storeDirWriteCleanLogs(0);
PrintRusage();
dumpMallocStats();
+#if USE_ASYNC_IO
+ aioSync(); /* flush log writes */
+#endif
storeLogClose();
accessLogClose();
+#if USE_ASYNC_IO
+ aioSync(); /* flush log close */
+#endif
#if PURIFY || XMALLOC_TRACE
configFreeMemory();
storeFreeMemory();
mimeFreeMemory();
errorClean();
#endif
- memClean();
#if !XMALLOC_TRACE
if (opt_no_daemon) {
file_close(0);
#endif
fdDumpOpen();
fdFreeMemory();
+ memClean();
#if XMALLOC_TRACE
xmalloc_find_leaks();
debug(1, 0) ("Memory used after shutdown: %d\n", xmalloc_total);
/*
- * $Id: protos.h,v 1.308 1999/01/19 23:18:00 wessels Exp $
+ * $Id: protos.h,v 1.309 1999/01/21 21:13:04 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern int aio_unlink(const char *, aio_result_t *);
extern int aio_opendir(const char *, aio_result_t *);
extern aio_result_t *aio_poll_done(void);
+extern int aio_operations_pending(void);
extern void aioCancel(int, void *);
extern void aioOpen(const char *, int, mode_t, AIOCB *, void *, void *);
extern void aioStat(char *, struct stat *, AIOCB *, void *, void *);
extern void aioUnlink(const char *, AIOCB *, void *);
extern void aioCheckCallbacks(void);
+extern void aioSync(void);
#endif
extern int parseConfigFile(const char *file_name);
extern int eventFind(EVH *, void *);
extern void fd_close(int fd);
+#if USE_ASYNC_IO
+extern void fd_was_closed(int fd);
+#endif
extern void fd_open(int fd, unsigned int type, const char *);
extern void fd_note(int fd, const char *);
extern void fd_bytes(int fd, int len, unsigned int type);