diff options
author | Dragana Damjanovic <dd.mozilla@gmail.com> | 2017-08-25 17:08:41 +0200 |
---|---|---|
committer | Dragana Damjanovic <dd.mozilla@gmail.com> | 2017-08-25 17:08:41 +0200 |
commit | e6976f1b94705e04269abbffc01bfb017774ae8d (patch) | |
tree | 21aa5c271cf8d0bef5de074ebc18a3b0ed47eec3 | |
parent | 0c42dd072f41d31d1a03ea19bb5e6610f36b742b (diff) | |
download | nspr-hg-e6976f1b94705e04269abbffc01bfb017774ae8d.tar.gz |
Bug 1384633 - Expose the overlapped structure. r=mcmanus, temporarily accepted for 4.17, any application requiring it will break when NSPR 4.18 is released and used, r=kaie
-rw-r--r-- | pr/include/private/pprio.h | 14 | ||||
-rw-r--r-- | pr/src/io/prsocket.c | 27 | ||||
-rw-r--r-- | pr/src/nspr.def | 4 | ||||
-rw-r--r-- | pr/src/pthreads/ptio.c | 8 |
4 files changed, 53 insertions, 0 deletions
diff --git a/pr/include/private/pprio.h b/pr/include/private/pprio.h index 26bcd0d0..83d3715b 100644 --- a/pr/include/private/pprio.h +++ b/pr/include/private/pprio.h @@ -237,6 +237,20 @@ NSPR_API(PRStatus) PR_NT_CancelIo(PRFileDesc *fd); #endif /* WIN32 */ +/* FUNCTION: PR_EXPERIMENTAL_ONLY_IN_4_17_GetOverlappedIOHandle +** DESCRIPTION: +** This function will be available only in nspr version 4.17 +** This functionality is only available on windows. Some windows operation use +** asynchronous (call overlapped) io. One of them is ConnectEx. NSPR uses +** ConnectEx for enabling TCP Fast Open. +** This function returns an OVERLAPPED structure associated with ConnectEx call. +** If ConnectEx has not been called or the io has already finished, the +** function will return PR_INVALID_ARGUMENT_ERROR. +** PRFileDesc continues to be owner of the structure and the structure must not +** be destroyed. +*/ +NSPR_API(PRStatus) PR_EXPERIMENTAL_ONLY_IN_4_17_GetOverlappedIOHandle(PRFileDesc *fd, void **ol); + PR_END_EXTERN_C #endif /* pprio_h___ */ diff --git a/pr/src/io/prsocket.c b/pr/src/io/prsocket.c index d043f35a..8441e936 100644 --- a/pr/src/io/prsocket.c +++ b/pr/src/io/prsocket.c @@ -1680,6 +1680,33 @@ PR_ChangeFileDescNativeHandle(PRFileDesc *fd, PROsfd handle) fd->secret->md.osfd = handle; } +/* Expose OVERLAPPED if present. OVERLAPPED is implemented only on WIN95. */ +PR_IMPLEMENT(PRStatus) +PR_EXPERIMENTAL_ONLY_IN_4_17_GetOverlappedIOHandle(PRFileDesc *fd, void **ol) +{ +#if defined(_WIN64) && defined(WIN95) + *ol = NULL; + if (fd) { + fd = PR_GetIdentitiesLayer(fd, PR_NSPR_IO_LAYER); + } + if (!fd) { + PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); + return PR_FAILURE; + } + + if (!fd->secret->overlappedActive) { + PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); + return PR_FAILURE; + } + + *ol = &fd->secret->ol; + return PR_SUCCESS; +#else + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; +#endif +} + /* ** Select compatibility ** diff --git a/pr/src/nspr.def b/pr/src/nspr.def index 726979ba..92776900 100644 --- a/pr/src/nspr.def +++ b/pr/src/nspr.def @@ -462,3 +462,7 @@ EXPORTS ;- PR_DuplicateEnvironment; PR_GetEnvSecure; ;+} NSPR_4.10.3; +;+NSPR_4.17 { +;+ global: + PR_EXPERIMENTAL_ONLY_IN_4_17_GetOverlappedIOHandle; +;+} NSPR_4.16; diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c index 9dde0319..ebe6d8d8 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -4744,6 +4744,14 @@ PR_IMPLEMENT(PRInt32) PR_FileDesc2NativeHandle(PRFileDesc *bottom) return osfd; } /* PR_FileDesc2NativeHandle */ +/* Expose OVERLAPPED if present. OVERLAPPED is implemented only on WIN95. */ +PR_IMPLEMENT(PRStatus) +PR_EXPERIMENTAL_ONLY_IN_4_17_GetOverlappedIOHandle(PRFileDesc *fd, void **ol) +{ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; +} + PR_IMPLEMENT(void) PR_ChangeFileDescNativeHandle(PRFileDesc *fd, PRInt32 handle) { |