From f8ccf3e8aad2cb460458ca0464f8be0f38cd7577 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Tue, 11 Jan 2000 01:49:01 +0000 Subject: [PATCH] Merged minor fixes related to PR_Available and PR_Sync for pipes in NSPR 3.5.1 onto the main trunk. Modified files: _win95.h, _winnt.h, prfile.c, ntio.c, w95io.c, ptio.c git-svn-id: svn://10.0.0.236/trunk@57332 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/nsprpub/pr/include/md/_win95.h | 1 + mozilla/nsprpub/pr/include/md/_winnt.h | 1 + mozilla/nsprpub/pr/src/io/prfile.c | 37 ++++++++++++++++++----- mozilla/nsprpub/pr/src/md/windows/ntio.c | 10 ++++++ mozilla/nsprpub/pr/src/md/windows/w95io.c | 9 ++++++ mozilla/nsprpub/pr/src/pthreads/ptio.c | 4 +-- 6 files changed, 53 insertions(+), 9 deletions(-) diff --git a/mozilla/nsprpub/pr/include/md/_win95.h b/mozilla/nsprpub/pr/include/md/_win95.h index e82ddfe3d25..6878b152021 100644 --- a/mozilla/nsprpub/pr/include/md/_win95.h +++ b/mozilla/nsprpub/pr/include/md/_win95.h @@ -245,6 +245,7 @@ extern PRInt32 _MD_CloseSocket(PRInt32 osfd); #define _MD_SOCKET _PR_MD_SOCKET extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd); #define _MD_SOCKETAVAILABLE _MD_SocketAvailable +#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE #define _MD_CONNECT _PR_MD_CONNECT extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, PRIntervalTime timeout); diff --git a/mozilla/nsprpub/pr/include/md/_winnt.h b/mozilla/nsprpub/pr/include/md/_winnt.h index 77db2ddb168..85ddd5054fe 100644 --- a/mozilla/nsprpub/pr/include/md/_winnt.h +++ b/mozilla/nsprpub/pr/include/md/_winnt.h @@ -247,6 +247,7 @@ extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *, const struct timeval *); #define _MD_FSYNC _PR_MD_FSYNC #define _MD_SOCKETAVAILABLE _PR_MD_SOCKETAVAILABLE +#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE #define _MD_SET_FD_INHERITABLE _PR_MD_SET_FD_INHERITABLE #define _MD_INIT_ATOMIC() diff --git a/mozilla/nsprpub/pr/src/io/prfile.c b/mozilla/nsprpub/pr/src/io/prfile.c index 70baeebf211..e58e8fffcfa 100644 --- a/mozilla/nsprpub/pr/src/io/prfile.c +++ b/mozilla/nsprpub/pr/src/io/prfile.c @@ -155,7 +155,7 @@ static PRInt64 PR_CALLBACK FileAvailable64(PRFileDesc *fd) return result; } -#ifndef WIN32 +#if defined(XP_UNIX) || defined(WIN32) static PRInt32 PR_CALLBACK PipeAvailable(PRFileDesc *fd) { PRInt32 rv; @@ -169,8 +169,31 @@ static PRInt64 PR_CALLBACK PipeAvailable64(PRFileDesc *fd) LL_I2L(rv, _PR_MD_PIPEAVAILABLE(fd)); return rv; } +#else +static PRInt32 PR_CALLBACK PipeAvailable(PRFileDesc *fd) +{ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return -1; +} + +static PRInt64 PR_CALLBACK PipeAvailable64(PRFileDesc *fd) +{ + PRInt64 rv; + LL_I2L(rv, -1); + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return rv; +} #endif +static PRStatus PR_CALLBACK PipeSync(PRFileDesc *fd) +{ +#if defined(XP_MAC) +#pragma unused (fd) +#endif + + return PR_SUCCESS; +} + static PRStatus PR_CALLBACK FileInfo(PRFileDesc *fd, PRFileInfo *info) { PRInt32 rv; @@ -283,14 +306,9 @@ static PRIOMethods _pr_pipeMethods = { FileClose, FileRead, FileWrite, -#ifdef WIN32 - FileAvailable, - FileAvailable64, -#else PipeAvailable, PipeAvailable64, -#endif - FileSync, + PipeSync, (PRSeekFN)_PR_InvalidInt, (PRSeek64FN)_PR_InvalidInt64, (PRFileInfoFN)_PR_InvalidStatus, @@ -322,6 +340,11 @@ static PRIOMethods _pr_pipeMethods = { (PRReservedFN)_PR_InvalidInt }; +PR_IMPLEMENT(const PRIOMethods*) PR_GetPipeMethods(void) +{ + return &_pr_pipeMethods; +} + PR_IMPLEMENT(PRFileDesc*) PR_Open(const char *name, PRIntn flags, PRIntn mode) { PRInt32 osfd; diff --git a/mozilla/nsprpub/pr/src/md/windows/ntio.c b/mozilla/nsprpub/pr/src/md/windows/ntio.c index 201bee2fc66..1b60a380b8e 100644 --- a/mozilla/nsprpub/pr/src/md/windows/ntio.c +++ b/mozilla/nsprpub/pr/src/md/windows/ntio.c @@ -2475,6 +2475,16 @@ _PR_MD_SOCKETAVAILABLE(PRFileDesc *fd) return result; } +PRInt32 +_PR_MD_PIPEAVAILABLE(PRFileDesc *fd) +{ + if (NULL == fd) + PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0); + else + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return -1; +} + PROffset32 _PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, int whence) { diff --git a/mozilla/nsprpub/pr/src/md/windows/w95io.c b/mozilla/nsprpub/pr/src/md/windows/w95io.c index c2553fc7bfa..6e969a987b5 100644 --- a/mozilla/nsprpub/pr/src/md/windows/w95io.c +++ b/mozilla/nsprpub/pr/src/md/windows/w95io.c @@ -923,3 +923,12 @@ _PR_MD_UNLOCKFILE(PRInt32 f) } } /* end _PR_MD_UNLOCKFILE() */ +PRInt32 +_PR_MD_PIPEAVAILABLE(PRFileDesc *fd) +{ + if (NULL == fd) + PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0); + else + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return -1; +} diff --git a/mozilla/nsprpub/pr/src/pthreads/ptio.c b/mozilla/nsprpub/pr/src/pthreads/ptio.c index accca747a34..f65dbdccce0 100644 --- a/mozilla/nsprpub/pr/src/pthreads/ptio.c +++ b/mozilla/nsprpub/pr/src/pthreads/ptio.c @@ -2915,7 +2915,7 @@ static PRIOMethods _pr_pipe_methods = { pt_Write, pt_Available_s, pt_Available64_s, - pt_Fsync, + pt_Synch, (PRSeekFN)_PR_InvalidInt, (PRSeek64FN)_PR_InvalidInt64, (PRFileInfoFN)_PR_InvalidStatus, @@ -3133,7 +3133,7 @@ PR_IMPLEMENT(const PRIOMethods*) PR_GetFileMethods() PR_IMPLEMENT(const PRIOMethods*) PR_GetPipeMethods() { return &_pr_pipe_methods; -} /* PR_GetFileMethods */ +} /* PR_GetPipeMethods */ PR_IMPLEMENT(const PRIOMethods*) PR_GetTCPMethods() {