return OS_WRITE(fd, buf, count);
}
#endif /* !HAVE_PIO */
+
+#ifndef AFS_NT40_ENV
+int
+ih_isunlinked(int fd)
+{
+ struct afs_stat_st status;
+ if (afs_fstat(fd, &status) < 0) {
+ return -1;
+ }
+ if (status.st_nlink < 1) {
+ return 1;
+ }
+ return 0;
+}
+#endif /* !AFS_NT40_ENV */
* status information:
* FDH_SIZE - returns the size of the file.
* FDH_NLINK - returns the link count of the file.
+ * FDH_ISUNLINKED - returns if the file has been unlinked out from under us
*
* Miscellaneous:
* FDH_FDOPEN - create a descriptor for buffered I/O
# define OS_UNLOCKFILE(FD, O) (!UnlockFile(FD, (DWORD)((O) & 0xFFFFFFFF), (DWORD)((O) >> 32), 2, 0))
# define OS_ERROR(X) nterr_nt2unix(GetLastError(), X)
# define OS_UNLINK(X) nt_unlink(X)
+/* we can't have a file unlinked out from under us on NT */
+# define OS_ISUNLINKED(X) (0)
# define OS_DIRSEP "\\"
# define OS_DIRSEPC '\\'
#else
# define OS_UNLOCKFILE(FD, O) flock(FD, LOCK_UN)
# define OS_ERROR(X) X
# define OS_UNLINK(X) unlink(X)
+# define OS_ISUNLINKED(X) ih_isunlinked(X)
+extern int ih_isunlinked(FD_t fd);
# define OS_DIRSEP "/"
# define OS_DIRSEPC '/'
#endif
#define FDH_SIZE(H) OS_SIZE((H)->fd_fd)
#define FDH_LOCKFILE(H, O) OS_LOCKFILE((H)->fd_fd, O)
#define FDH_UNLOCKFILE(H, O) OS_UNLOCKFILE((H)->fd_fd, O)
+#define FDH_ISUNLINKED(H) OS_ISUNLINKED((H)->fd_fd)
#ifdef AFS_NT40_ENV
# define afs_stat_st __stat64