diff src/sysfile.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 8626e4521993
children 2f8bb876ab1d
line wrap: on
line diff
--- a/src/sysfile.h	Mon Aug 13 11:12:06 2007 +0200
+++ b/src/sysfile.h	Mon Aug 13 11:13:30 2007 +0200
@@ -20,6 +20,9 @@
 
 /* Synched up with: Not really in FSF. */
 
+#ifndef INCLUDED_sysfile_h_
+#define INCLUDED_sysfile_h_
+
 #include <errno.h>
 
 #ifndef WINDOWSNT
@@ -203,10 +206,6 @@
 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
 #endif
 
-#if !defined (USG)  && !defined (WINDOWSNT)
-# define HAVE_FSYNC
-#endif
-
 #ifndef MAXPATHLEN
 /* in 4.1, param.h fails to define this. */
 #define MAXPATHLEN 1024
@@ -244,7 +243,7 @@
    Other encapsulations are declared in the appropriate sys*.h file. */
 
 #ifdef ENCAPSULATE_READ
-int sys_read (int, void *, size_t);
+ssize_t sys_read (int, void *, size_t);
 #endif
 #if defined (ENCAPSULATE_READ) && !defined (DONT_ENCAPSULATE)
 # undef read
@@ -255,7 +254,7 @@
 #endif
 
 #ifdef ENCAPSULATE_WRITE
-int sys_write (int, CONST void *, size_t);
+ssize_t sys_write (int, const void *, size_t);
 #endif
 #if defined (ENCAPSULATE_WRITE) && !defined (DONT_ENCAPSULATE)
 # undef write
@@ -266,7 +265,7 @@
 #endif
 
 #ifdef ENCAPSULATE_OPEN
-int sys_open (CONST char *, int, ...);
+int sys_open (const char *, int, ...);
 #endif
 #if defined (ENCAPSULATE_OPEN) && !defined (DONT_ENCAPSULATE)
 # undef open
@@ -301,7 +300,7 @@
 #endif
 
 #ifdef ENCAPSULATE_FWRITE
-size_t sys_fwrite (CONST void *, size_t, size_t, FILE *);
+size_t sys_fwrite (const void *, size_t, size_t, FILE *);
 #endif
 #if defined (ENCAPSULATE_FWRITE) && !defined (DONT_ENCAPSULATE)
 # undef fwrite
@@ -312,7 +311,7 @@
 #endif
 
 #ifdef ENCAPSULATE_FOPEN
-FILE *sys_fopen (CONST char *, CONST char *);
+FILE *sys_fopen (const char *, const char *);
 #endif
 #if defined (ENCAPSULATE_FOPEN) && !defined (DONT_ENCAPSULATE)
 # undef fopen
@@ -337,7 +336,7 @@
 /* encapsulations: file-information calls */
 
 #ifdef ENCAPSULATE_ACCESS
-int sys_access (CONST char *path, int mode);
+int sys_access (const char *path, int mode);
 #endif
 #if defined (ENCAPSULATE_ACCESS) && !defined (DONT_ENCAPSULATE)
 # undef access
@@ -348,7 +347,7 @@
 #endif
 
 #ifdef ENCAPSULATE_EACCESS
-int sys_eaccess (CONST char *path, int mode);
+int sys_eaccess (const char *path, int mode);
 #endif
 #if defined (ENCAPSULATE_EACCESS) && !defined (DONT_ENCAPSULATE)
 # undef eaccess
@@ -359,7 +358,7 @@
 #endif
 
 #ifdef ENCAPSULATE_LSTAT
-int sys_lstat (CONST char *path, struct stat *buf);
+int sys_lstat (const char *path, struct stat *buf);
 #endif
 #if defined (ENCAPSULATE_LSTAT) && !defined (DONT_ENCAPSULATE)
 # undef lstat
@@ -370,7 +369,7 @@
 #endif
 
 #ifdef ENCAPSULATE_READLINK
-int sys_readlink (CONST char *path, char *buf, size_t bufsiz);
+int sys_readlink (const char *path, char *buf, size_t bufsiz);
 #endif
 #if defined (ENCAPSULATE_READLINK) && !defined (DONT_ENCAPSULATE)
 # undef readlink
@@ -380,8 +379,20 @@
 # define sys_readlink readlink
 #endif
 
+#ifdef ENCAPSULATE_FSTAT
+int sys_fstat (int fd, struct stat *buf);
+#endif
+#if defined (ENCAPSULATE_FSTAT) && !defined (DONT_ENCAPSULATE)
+# undef fstat
+/* Need to use arguments to avoid messing with struct stat */
+# define fstat(fd, buf) sys_fstat (fd, buf)
+#endif
+#if !defined (ENCAPSULATE_FSTAT) && defined (DONT_ENCAPSULATE)
+# define sys_fstat fstat
+#endif
+
 #ifdef ENCAPSULATE_STAT
-int sys_stat (CONST char *path, struct stat *buf);
+int sys_stat (const char *path, struct stat *buf);
 #endif
 #if defined (ENCAPSULATE_STAT) && !defined (DONT_ENCAPSULATE)
 # undef stat
@@ -395,7 +406,7 @@
 /* encapsulations: file-manipulation calls */
 
 #ifdef ENCAPSULATE_CHMOD
-int sys_chmod (CONST char *path, mode_t mode);
+int sys_chmod (const char *path, mode_t mode);
 #endif
 #if defined (ENCAPSULATE_CHMOD) && !defined (DONT_ENCAPSULATE)
 # undef chmod
@@ -406,7 +417,7 @@
 #endif
 
 #ifdef ENCAPSULATE_CREAT
-int sys_creat (CONST char *path, mode_t mode);
+int sys_creat (const char *path, mode_t mode);
 #endif
 #if defined (ENCAPSULATE_CREAT) && !defined (DONT_ENCAPSULATE)
 # undef creat
@@ -417,7 +428,7 @@
 #endif
 
 #ifdef ENCAPSULATE_LINK
-int sys_link (CONST char *existing, CONST char *new);
+int sys_link (const char *existing, const char *new);
 #endif
 #if defined (ENCAPSULATE_LINK) && !defined (DONT_ENCAPSULATE)
 # undef link
@@ -428,7 +439,7 @@
 #endif
 
 #ifdef ENCAPSULATE_RENAME
-int sys_rename (CONST char *old, CONST char *new);
+int sys_rename (const char *old, const char *new);
 #endif
 #if defined (ENCAPSULATE_RENAME) && !defined (DONT_ENCAPSULATE)
 # undef rename
@@ -439,7 +450,7 @@
 #endif
 
 #ifdef ENCAPSULATE_SYMLINK
-int sys_symlink (CONST char *name1, CONST char *name2);
+int sys_symlink (const char *name1, const char *name2);
 #endif
 #if defined (ENCAPSULATE_SYMLINK) && !defined (DONT_ENCAPSULATE)
 # undef symlink
@@ -450,7 +461,7 @@
 #endif
 
 #ifdef ENCAPSULATE_UNLINK
-int sys_unlink (CONST char *path);
+int sys_unlink (const char *path);
 #endif
 #if defined (ENCAPSULATE_UNLINK) && !defined (DONT_ENCAPSULATE)
 # undef unlink
@@ -461,7 +472,7 @@
 #endif
 
 #ifdef ENCAPSULATE_EXECVP
-int sys_execvp (CONST char *, char * CONST *);
+int sys_execvp (const char *, char * const *);
 #endif
 #if defined (ENCAPSULATE_EXECVP) && !defined (DONT_ENCAPSULATE)
 # undef execvp
@@ -470,3 +481,5 @@
 #if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE)
 # define sys_execvp execvp
 #endif
+
+#endif /* INCLUDED_sysfile_h_ */