1 /*-------------------------------------------------------------------------
4 * Virtual file descriptor definitions.
7 * Copyright (c) 1994, Regents of the University of California
9 * $Id: fd.h,v 1.6 1997/02/14 04:18:42 momjian Exp $
11 *-------------------------------------------------------------------------
16 * File {Close, Read, Write, Seek, Tell, Sync}
17 * {File Name Open, Allocate, Free} File
19 * These are NOT JUST RENAMINGS OF THE UNIX ROUTINES.
20 * use them for all file activity...
22 * fd = FilePathOpenFile("foo", O_RDONLY);
25 * use AllocateFile if you need a file descriptor in some other context.
26 * it will make sure that there is a file descriptor free
28 * use FreeFile to let the virtual file descriptor package know that
29 * there is now a free fd (when you are done with it)
38 * FileOpen uses the standard UNIX open(2) flags.
44 * FileSeek uses the standard UNIX lseek(2) flags.
47 typedef char *FileName;
51 /* originally in libpq-fs.h */
52 struct pgstat { /* just the fields we need from stat structure */
56 unsigned int st_sizehigh; /* high order bits */
57 /* 2^64 == 1.8 x 10^20 bytes */
59 int st_atime_s; /* just the seconds */
60 int st_mtime_s; /* since SysV and the new BSD both have */
61 int st_ctime_s; /* usec fields.. */
65 * prototypes for functions in fd.c
67 extern void FileInvalidate(File file);
68 extern File FileNameOpenFile(FileName fileName, int fileFlags, int fileMode);
69 extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode);
70 extern void FileClose(File file);
71 extern void FileUnlink(File file);
72 extern int FileRead(File file, char *buffer, int amount);
73 extern int FileWrite(File file, char *buffer, int amount);
74 extern long FileSeek(File file, long offset, int whence);
75 extern long FileTell(File file);
76 extern int FileTruncate(File file, int offset);
77 extern int FileSync(File file);
78 extern int FileNameUnlink(char *filename);
79 extern void AllocateFile(void);
80 extern void FreeFile(void);
81 extern void closeAllVfds(void);
82 extern void closeOneVfd(void);
83 extern int pg_fsync(int fd);