diff options
author | monty@hundin.mysql.fi <> | 2001-10-31 03:22:31 +0200 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-10-31 03:22:31 +0200 |
commit | 5a9ce774dc413ac7b6342a9097f4e2456d0df63f (patch) | |
tree | a7cd1bf6f7f295d11ffce88081f69bc1963bfd06 /mysys/my_os2file64.c | |
parent | 7f38949c6be7dba794a786b4fe53132f7f5751e5 (diff) | |
download | mariadb-git-5a9ce774dc413ac7b6342a9097f4e2456d0df63f.tar.gz |
Update for OS2 (patch from Yuri Dario).
Use LONG_TIMEOUT (one year) instead of ~0 for long timeouts
Fixed error messages.
Fixed problem with const propagation when comparing columns of different types
Diffstat (limited to 'mysys/my_os2file64.c')
-rw-r--r-- | mysys/my_os2file64.c | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/mysys/my_os2file64.c b/mysys/my_os2file64.c index 8964e562ea1..b7ee40d292e 100644 --- a/mysys/my_os2file64.c +++ b/mysys/my_os2file64.c @@ -22,7 +22,6 @@ void _OS2errno( APIRET rc); longlong _lseek64( int fd, longlong offset, int seektype); int _lock64( int fd, int locktype, my_off_t start, my_off_t length, myf MyFlags); -int _sopen64( const char *name, int oflag, int shflag, int mask); // // this class is used to define a global c++ variable, that @@ -255,7 +254,7 @@ int _lock64( int fd, int locktype, my_off_t start, return(-1); } -int _sopen64( const char *name, int oflag, int shflag, int mask) +int _sopen( const char *name, int oflag, int shflag, int mask) { int fail_errno; APIRET rc = 0; @@ -325,17 +324,60 @@ int _sopen64( const char *name, int oflag, int shflag, int mask) return hf; } -inline int open( const char *name, int oflag) +int read( int fd, void *buffer, unsigned int count) { - return _sopen64( name, oflag, OPEN_SHARE_DENYNONE, S_IREAD | S_IWRITE); + APIRET rc; + ULONG actual; + + rc = DosRead( fd, (PVOID) buffer, count, &actual); + + if (!rc) + return( actual);/* NO_ERROR */ + + // set errno + _OS2errno( rc); + // write failed + return(-1); } -inline int open( const char *name, int oflag, int mask) +int write( int fd, const void *buffer, unsigned int count) { - return _sopen64( name, oflag, OPEN_SHARE_DENYNONE, mask); + APIRET rc; + ULONG actual; + + rc = DosWrite( fd, (PVOID) buffer, count, &actual); + + if (!rc) + return( actual);/* NO_ERROR */ + + // set errno + _OS2errno( rc); + // write failed + return(-1); +} + +int close( int fd) +{ + APIRET rc; + ULONG actual; + + rc = DosClose( fd); + + if (!rc) + return( 0);/* NO_ERROR */ + + // set errno + _OS2errno( rc); + // write failed + return(-1); } -inline int sopen( const char *name, int oflag, int shflag, int mask) +inline int open( const char *name, int oflag) +{ + return sopen( name, oflag, OPEN_SHARE_DENYNONE, S_IREAD | S_IWRITE); +} + +inline int open( const char *name, int oflag, int mask) { - return _sopen64( name, oflag, shflag, mask); + return sopen( name, oflag, OPEN_SHARE_DENYNONE, mask); } |