projects
/
chise
/
xemacs-chise.git-
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update.
[chise/xemacs-chise.git-]
/
src
/
sysfile.h
diff --git
a/src/sysfile.h
b/src/sysfile.h
index
1a61127
..
d9d3deb
100644
(file)
--- a/
src/sysfile.h
+++ b/
src/sysfile.h
@@
-20,9
+20,12
@@
Boston, MA 02111-1307, USA. */
/* Synched up with: Not really in FSF. */
/* Synched up with: Not really in FSF. */
+#ifndef INCLUDED_sysfile_h_
+#define INCLUDED_sysfile_h_
+
#include <errno.h>
#include <errno.h>
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
#include <sys/errno.h> /* <errno.h> does not always imply this */
#endif
#include <sys/errno.h> /* <errno.h> does not always imply this */
#endif
@@
-40,21
+43,41
@@
Boston, MA 02111-1307, USA. */
#ifndef makedev
#include <sys/types.h> /* some typedefs are used in sys/file.h */
#endif
#ifndef makedev
#include <sys/types.h> /* some typedefs are used in sys/file.h */
#endif
+
+#ifndef WIN32_NATIVE
#include <sys/file.h>
#include <sys/file.h>
+#endif
+
#include <sys/stat.h>
#include <sys/stat.h>
+
+#ifndef WIN32_NATIVE
+/* Some configuration files' definitions for the LOAD_AVE_CVT macro
+ (like sparc.h's) use macros like FSCALE, defined here. */
+#ifdef HAVE_GTK
+/* I hate GTK */
+#undef MIN
+#undef MAX
+#endif /* HAVE_GTK */
#include <sys/param.h>
#include <sys/param.h>
+#endif
-#if defined (NeXT) || defined(__CYGWIN32__)
+#if defined (NeXT) || defined(CYGWIN)
/* what is needed from here? Do others need it too?
O_BINARY is in here under cygwin. */
# include <sys/fcntl.h>
#endif /* NeXT */
/* what is needed from here? Do others need it too?
O_BINARY is in here under cygwin. */
# include <sys/fcntl.h>
#endif /* NeXT */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include <io.h>
#include <direct.h>
#endif
#include <io.h>
#include <direct.h>
#endif
+#ifndef STDERR_FILENO
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+#endif
+
#ifndef O_RDONLY
#define O_RDONLY 0
#endif
#ifndef O_RDONLY
#define O_RDONLY 0
#endif
@@
-85,7
+108,7
@@
Boston, MA 02111-1307, USA. */
#endif
#ifndef CREAT_MODE
#endif
#ifndef CREAT_MODE
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#define CREAT_MODE (S_IREAD | S_IWRITE)
#else
#define CREAT_MODE (0666)
#define CREAT_MODE (S_IREAD | S_IWRITE)
#else
#define CREAT_MODE (0666)
@@
-108,6
+131,30
@@
Boston, MA 02111-1307, USA. */
#endif
#endif
#endif
#endif
+#ifndef READ_PLUS_TEXT
+#ifdef O_TEXT
+#define READ_PLUS_TEXT "r+t"
+#else
+#define READ_PLUS_TEXT "r+"
+#endif
+#endif
+
+#ifndef READ_PLUS_BINARY
+#ifdef O_BINARY
+#define READ_PLUS_BINARY "r+b"
+#else
+#define READ_PLUS_BINARY "r+"
+#endif
+#endif
+
+#ifndef WRITE_TEXT
+#ifdef O_TEXT
+#define WRITE_TEXT "wt"
+#else
+#define WRITE_TEXT "w"
+#endif
+#endif
+
#ifndef WRITE_BINARY
#ifdef O_BINARY
#define WRITE_BINARY "wb"
#ifndef WRITE_BINARY
#ifdef O_BINARY
#define WRITE_BINARY "wb"
@@
-116,14
+163,22
@@
Boston, MA 02111-1307, USA. */
#endif
#endif
#endif
#endif
+#ifndef O_NONBLOCK
+#ifdef O_NDELAY
+#define O_NONBLOCK O_NDELAY
+#else
+#define O_NONBLOCK 04000
+#endif
+#endif
+
/* if system does not have symbolic links, it does not have lstat.
In that case, use ordinary stat instead. */
#ifndef S_IFLNK
/* if system does not have symbolic links, it does not have lstat.
In that case, use ordinary stat instead. */
#ifndef S_IFLNK
-#define lstat stat
+#define lstat xemacs_stat
#endif
#endif
-#if !S_IRUSR
+#ifndef S_IRUSR
# if S_IREAD
# define S_IRUSR S_IREAD
# else
# if S_IREAD
# define S_IRUSR S_IREAD
# else
@@
-131,7
+186,7
@@
Boston, MA 02111-1307, USA. */
# endif
#endif
# endif
#endif
-#if !S_IWUSR
+#ifndef S_IWUSR
# if S_IWRITE
# define S_IWUSR S_IWRITE
# else
# if S_IWRITE
# define S_IWUSR S_IWRITE
# else
@@
-139,7
+194,7
@@
Boston, MA 02111-1307, USA. */
# endif
#endif
# endif
#endif
-#if !S_IXUSR
+#ifndef S_IXUSR
# if S_IEXEC
# define S_IXUSR S_IEXEC
# else
# if S_IEXEC
# define S_IXUSR S_IEXEC
# else
@@
-189,17
+244,43
@@
Boston, MA 02111-1307, USA. */
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#endif
-#if !defined (USG) && !defined (WINDOWSNT)
-# define HAVE_FSYNC
+/* Client .c files should simply use `PATH_MAX'. */
+#ifndef PATH_MAX
+# if defined (_POSIX_PATH_MAX)
+# define PATH_MAX _POSIX_PATH_MAX
+# elif defined (MAXPATHLEN)
+# define PATH_MAX MAXPATHLEN
+# else
+# define PATH_MAX 1024
+# endif
#endif
#endif
+/* MAXPATHLEN is deprecated, but, as of this writing, still used. */
#ifndef MAXPATHLEN
#ifndef MAXPATHLEN
-/* in 4.1, param.h fails to define this. */
-#define MAXPATHLEN 1024
-#endif /* not MAXPATHLEN */
+# define MAXPATHLEN 1024
+#endif
+/* The following definitions are needed under Windows, at least */
+#ifndef R_OK
+# define R_OK 4
+#endif
+
+/* Under native Windows, there is no concept of execute permission,
+ so redefine execute permissions to be the same as read permission */
#ifndef X_OK
#ifndef X_OK
-# define X_OK 01
+# ifdef WIN32_NATIVE
+# define X_OK R_OK
+# else
+# define X_OK 1
+# endif
+#endif
+
+#ifndef W_OK
+# define W_OK 2
+#endif
+
+#ifndef F_OK
+# define F_OK 0
#endif
#ifndef FD_CLOEXEC
#endif
#ifndef FD_CLOEXEC
@@
-230,7
+311,7
@@
Boston, MA 02111-1307, USA. */
Other encapsulations are declared in the appropriate sys*.h file. */
#ifdef ENCAPSULATE_READ
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
#endif
#if defined (ENCAPSULATE_READ) && !defined (DONT_ENCAPSULATE)
# undef read
@@
-241,7
+322,7
@@
int sys_read (int, void *, size_t);
#endif
#ifdef ENCAPSULATE_WRITE
#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
#endif
#if defined (ENCAPSULATE_WRITE) && !defined (DONT_ENCAPSULATE)
# undef write
@@
-252,7
+333,7
@@
int sys_write (int, CONST void *, size_t);
#endif
#ifdef ENCAPSULATE_OPEN
#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
#endif
#if defined (ENCAPSULATE_OPEN) && !defined (DONT_ENCAPSULATE)
# undef open
@@
-287,7
+368,7
@@
size_t sys_fread (void *, size_t, size_t, FILE *);
#endif
#ifdef ENCAPSULATE_FWRITE
#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
#endif
#if defined (ENCAPSULATE_FWRITE) && !defined (DONT_ENCAPSULATE)
# undef fwrite
@@
-298,7
+379,7
@@
size_t sys_fwrite (CONST void *, size_t, size_t, FILE *);
#endif
#ifdef ENCAPSULATE_FOPEN
#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
#endif
#if defined (ENCAPSULATE_FOPEN) && !defined (DONT_ENCAPSULATE)
# undef fopen
@@
-323,7
+404,7
@@
int sys_fclose (FILE *);
/* encapsulations: file-information calls */
#ifdef ENCAPSULATE_ACCESS
/* 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
#endif
#if defined (ENCAPSULATE_ACCESS) && !defined (DONT_ENCAPSULATE)
# undef access
@@
-334,7
+415,7
@@
int sys_access (CONST char *path, int mode);
#endif
#ifdef ENCAPSULATE_EACCESS
#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
#endif
#if defined (ENCAPSULATE_EACCESS) && !defined (DONT_ENCAPSULATE)
# undef eaccess
@@
-345,7
+426,7
@@
int sys_eaccess (CONST char *path, int mode);
#endif
#ifdef ENCAPSULATE_LSTAT
#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
#endif
#if defined (ENCAPSULATE_LSTAT) && !defined (DONT_ENCAPSULATE)
# undef lstat
@@
-356,7
+437,7
@@
int sys_lstat (CONST char *path, struct stat *buf);
#endif
#ifdef ENCAPSULATE_READLINK
#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
#endif
#if defined (ENCAPSULATE_READLINK) && !defined (DONT_ENCAPSULATE)
# undef readlink
@@
-366,22
+447,23
@@
int sys_readlink (CONST char *path, char *buf, size_t bufsiz);
# define sys_readlink readlink
#endif
# define sys_readlink readlink
#endif
-#ifdef ENCAPSULATE_STAT
-int sys_stat (CONST char *path, struct stat *buf);
+#ifdef ENCAPSULATE_FSTAT
+int sys_fstat (int fd, struct stat *buf);
#endif
#endif
-#if defined (ENCAPSULATE_STAT) && !defined (DONT_ENCAPSULATE)
-# undef stat
-/* Need to use arguments to avoid messing with struct stat */
-# define stat(path, buf) sys_stat (path, buf)
+#if defined (ENCAPSULATE_FSTAT) && !defined (DONT_ENCAPSULATE)
+# undef fstat
+# define fstat sys_fstat
#endif
#endif
-#if !defined (ENCAPSULATE_STAT) && defined (DONT_ENCAPSULATE)
-# define sys_stat stat
+#if !defined (ENCAPSULATE_FSTAT) && defined (DONT_ENCAPSULATE)
+# define sys_fstat fstat
#endif
#endif
+int xemacs_stat (const char *path, struct stat *buf);
+
/* encapsulations: file-manipulation calls */
#ifdef ENCAPSULATE_CHMOD
/* 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
#endif
#if defined (ENCAPSULATE_CHMOD) && !defined (DONT_ENCAPSULATE)
# undef chmod
@@
-392,7
+474,7
@@
int sys_chmod (CONST char *path, mode_t mode);
#endif
#ifdef ENCAPSULATE_CREAT
#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
#endif
#if defined (ENCAPSULATE_CREAT) && !defined (DONT_ENCAPSULATE)
# undef creat
@@
-403,7
+485,7
@@
int sys_creat (CONST char *path, mode_t mode);
#endif
#ifdef ENCAPSULATE_LINK
#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
#endif
#if defined (ENCAPSULATE_LINK) && !defined (DONT_ENCAPSULATE)
# undef link
@@
-414,7
+496,7
@@
int sys_link (CONST char *existing, CONST char *new);
#endif
#ifdef ENCAPSULATE_RENAME
#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
#endif
#if defined (ENCAPSULATE_RENAME) && !defined (DONT_ENCAPSULATE)
# undef rename
@@
-425,7
+507,7
@@
int sys_rename (CONST char *old, CONST char *new);
#endif
#ifdef ENCAPSULATE_SYMLINK
#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
#endif
#if defined (ENCAPSULATE_SYMLINK) && !defined (DONT_ENCAPSULATE)
# undef symlink
@@
-436,7
+518,7
@@
int sys_symlink (CONST char *name1, CONST char *name2);
#endif
#ifdef ENCAPSULATE_UNLINK
#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
#endif
#if defined (ENCAPSULATE_UNLINK) && !defined (DONT_ENCAPSULATE)
# undef unlink
@@
-447,7
+529,7
@@
int sys_unlink (CONST char *path);
#endif
#ifdef ENCAPSULATE_EXECVP
#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
#endif
#if defined (ENCAPSULATE_EXECVP) && !defined (DONT_ENCAPSULATE)
# undef execvp
@@
-456,3
+538,5
@@
int sys_execvp (CONST char *, char * CONST *);
#if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE)
# define sys_execvp execvp
#endif
#if !defined (ENCAPSULATE_EXECVP) && defined (DONT_ENCAPSULATE)
# define sys_execvp execvp
#endif
+
+#endif /* INCLUDED_sysfile_h_ */