summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2000-01-11 01:49:01 +0000
committerwtc%netscape.com <devnull@localhost>2000-01-11 01:49:01 +0000
commitdae93756ff1761ed8ee7c1dfdb64449078018a36 (patch)
treee646aa7fdbe891bc848ca656cb2c681e9fcda4ad
parentb9e53827ef3eae5556228daaef7ad871bfc4c73b (diff)
downloadnspr-hg-dae93756ff1761ed8ee7c1dfdb64449078018a36.tar.gz
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
-rw-r--r--pr/include/md/_win95.h1
-rw-r--r--pr/include/md/_winnt.h1
-rw-r--r--pr/src/io/prfile.c37
-rw-r--r--pr/src/md/windows/ntio.c10
-rw-r--r--pr/src/md/windows/w95io.c9
-rw-r--r--pr/src/pthreads/ptio.c4
6 files changed, 53 insertions, 9 deletions
diff --git a/pr/include/md/_win95.h b/pr/include/md/_win95.h
index e82ddfe3..6878b152 100644
--- a/pr/include/md/_win95.h
+++ b/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/pr/include/md/_winnt.h b/pr/include/md/_winnt.h
index 77db2ddb..85ddd505 100644
--- a/pr/include/md/_winnt.h
+++ b/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/pr/src/io/prfile.c b/pr/src/io/prfile.c
index 70baeebf..e58e8fff 100644
--- a/pr/src/io/prfile.c
+++ b/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/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c
index 201bee2f..1b60a380 100644
--- a/pr/src/md/windows/ntio.c
+++ b/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/pr/src/md/windows/w95io.c b/pr/src/md/windows/w95io.c
index c2553fc7..6e969a98 100644
--- a/pr/src/md/windows/w95io.c
+++ b/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/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index accca747..f65dbdcc 100644
--- a/pr/src/pthreads/ptio.c
+++ b/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()
{