diff options
author | Kean Johnson <kean@armory.com> | 2005-11-08 06:33:30 +0000 |
---|---|---|
committer | Kean Johnson <kean@armory.com> | 2005-11-08 06:33:30 +0000 |
commit | 5390c7ab05d23f64e6d9afaa558be246a6d6e1b4 (patch) | |
tree | b559bbac1f1e8159758556807a14af8501416316 /os | |
parent | f5814bf3fff5352ed6edef4c58aadf2d4593f094 (diff) |
See ChangeLog entry 2005-11-07 for details.
Diffstat (limited to 'os')
-rw-r--r-- | os/access.c | 11 | ||||
-rw-r--r-- | os/osinit.c | 4 | ||||
-rw-r--r-- | os/utils.c | 50 |
3 files changed, 59 insertions, 6 deletions
diff --git a/os/access.c b/os/access.c index 329d1cfea..80430fb3d 100644 --- a/os/access.c +++ b/os/access.c @@ -84,9 +84,9 @@ SOFTWARE. #include <sys/ioctl.h> #include <ctype.h> -#if defined(TCPCONN) || defined(STREAMSCONN) || defined(ISC) || defined(SCO) +#if defined(TCPCONN) || defined(STREAMSCONN) || defined(ISC) || defined(__SCO__) #include <netinet/in.h> -#endif /* TCPCONN || STREAMSCONN || ISC || SCO */ +#endif /* TCPCONN || STREAMSCONN || ISC || __SCO__ */ #ifdef DNETCONN #include <netdnet/dn.h> #include <netdnet/dnetdb.h> @@ -138,9 +138,7 @@ SOFTWARE. #endif /* hpux */ #ifdef SVR4 -#ifndef SCO #include <sys/sockio.h> -#endif #include <sys/stropts.h> #endif @@ -193,6 +191,11 @@ SOFTWARE. #endif #endif +#ifdef __SCO__ +/* The system defined value is wrong. MAXPATHLEN is set in sco5.cf. */ +#undef PATH_MAX +#endif + #define X_INCLUDE_NETDB_H #include <X11/Xos_r.h> diff --git a/os/osinit.c b/os/osinit.c index f9e253f2d..ea99ace21 100644 --- a/os/osinit.c +++ b/os/osinit.c @@ -69,7 +69,7 @@ SOFTWARE. #endif #endif -#if defined(Lynx) || defined(SCO) || defined(SCO325) +#if defined(Lynx) || defined(__SCO__) #include <sys/wait.h> #endif @@ -114,7 +114,7 @@ OsInit(void) #ifdef XFree86LOADER xf86WrapperInit(); #endif -#if !defined(SCO) && !defined(__CYGWIN__) +#if !defined(__SCO__) && !defined(__CYGWIN__) && !defined(__UNIXWARE__) fclose(stdin); fclose(stdout); #endif diff --git a/os/utils.c b/os/utils.c index f23e1036c..4c794c2c9 100644 --- a/os/utils.c +++ b/os/utils.c @@ -2238,3 +2238,53 @@ CheckUserAuthorization(void) } #endif } + +#ifdef __SCO__ +#include <fcntl.h> + +static void +lockit (int fd, short what) +{ + struct flock lck; + + lck.l_whence = 0; + lck.l_start = 0; + lck.l_len = 1; + lck.l_type = what; + + (void)fcntl (fd, F_SETLKW, &lck); +} + +/* SCO OpenServer 5 lacks pread/pwrite. Emulate them. */ +ssize_t +pread (int fd, void *buf, size_t nbytes, off_t offset) +{ + off_t saved; + ssize_t ret; + + lockit (fd, F_RDLCK); + saved = lseek (fd, 0, SEEK_CUR); + lseek (fd, offset, SEEK_SET); + ret = read (fd, buf, nbytes); + lseek (fd, saved, SEEK_SET); + lockit (fd, F_UNLCK); + + return ret; +} + +ssize_t +pwrite (int fd, const void *buf, size_t nbytes, off_t offset) +{ + off_t saved; + ssize_t ret; + + lockit (fd, F_WRLCK); + saved = lseek (fd, 0, SEEK_CUR); + lseek (fd, offset, SEEK_SET); + ret = write (fd, buf, nbytes); + lseek (fd, saved, SEEK_SET); + lockit (fd, F_UNLCK); + + return ret; +} +#endif /* __SCO__ */ |