diff options
Diffstat (limited to 'pr/src/md/windows')
-rw-r--r-- | pr/src/md/windows/ntgc.c | 16 | ||||
-rw-r--r-- | pr/src/md/windows/ntinrval.c | 4 | ||||
-rw-r--r-- | pr/src/md/windows/ntio.c | 220 | ||||
-rw-r--r-- | pr/src/md/windows/ntmisc.c | 78 | ||||
-rw-r--r-- | pr/src/md/windows/ntsem.c | 10 | ||||
-rw-r--r-- | pr/src/md/windows/ntthread.c | 30 | ||||
-rw-r--r-- | pr/src/md/windows/w32ipcsem.c | 6 | ||||
-rw-r--r-- | pr/src/md/windows/w32poll.c | 4 | ||||
-rw-r--r-- | pr/src/md/windows/w32shm.c | 52 | ||||
-rw-r--r-- | pr/src/md/windows/w95cv.c | 10 | ||||
-rw-r--r-- | pr/src/md/windows/w95io.c | 52 | ||||
-rw-r--r-- | pr/src/md/windows/w95sock.c | 76 | ||||
-rw-r--r-- | pr/src/md/windows/w95thred.c | 22 | ||||
-rw-r--r-- | pr/src/md/windows/win32_errors.c | 6 |
14 files changed, 293 insertions, 293 deletions
diff --git a/pr/src/md/windows/ntgc.c b/pr/src/md/windows/ntgc.c index 55ac92fb..20ad8a81 100644 --- a/pr/src/md/windows/ntgc.c +++ b/pr/src/md/windows/ntgc.c @@ -10,7 +10,7 @@ #include <windows.h> #include "primpl.h" -PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) +PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { #if defined(_X86_) CONTEXT context; @@ -34,8 +34,8 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) } else { /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING * - * This code is extremely machine dependant and completely - * undocumented by MS. Its only known to work experimentally. + * This code is extremely machine dependant and completely + * undocumented by MS. Its only known to work experimentally. * Ready for a walk on the wild * side? * * WARNING WARNING WARNING WARNING WARNING WARNING WARNING */ @@ -47,7 +47,7 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) * Are your palms sweating yet? */ - /* + /* ** EAX is on the stack (ESP+0) ** EDX is on the stack (ESP+4) ** ECX is on the stack (ESP+8) @@ -71,7 +71,7 @@ PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) } /* This function is not used right now, but is left as a reference. - * If you ever need to get the fiberID from the currently running fiber, + * If you ever need to get the fiberID from the currently running fiber, * this is it. */ void * @@ -81,15 +81,15 @@ GetMyFiberID() void *fiberData; /* A pointer to our tib entry is found at FS:[18] - * At offset 10h is the fiberData pointer. The context of the - * fiber is stored in there. + * At offset 10h is the fiberData pointer. The context of the + * fiber is stored in there. */ __asm { mov EDX, FS:[18h] mov EAX, DWORD PTR [EDX+10h] mov [fiberData], EAX } - + return fiberData; #else PR_NOT_REACHED("not implemented"); diff --git a/pr/src/md/windows/ntinrval.c b/pr/src/md/windows/ntinrval.c index 10aca11b..1e99c4c8 100644 --- a/pr/src/md/windows/ntinrval.c +++ b/pr/src/md/windows/ntinrval.c @@ -33,7 +33,7 @@ _PR_MD_INTERVAL_INIT() #endif } -PRIntervalTime +PRIntervalTime _PR_MD_GET_INTERVAL() { /* milliseconds since system start */ @@ -44,7 +44,7 @@ _PR_MD_GET_INTERVAL() #endif } -PRIntervalTime +PRIntervalTime _PR_MD_INTERVAL_PER_SEC() { return 1000; diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c index aba53dc8..105fdecb 100644 --- a/pr/src/md/windows/ntio.c +++ b/pr/src/md/windows/ntio.c @@ -9,7 +9,7 @@ * For LOCAL_SCOPE threads, we're using NT fibers. For GLOBAL_SCOPE threads * we're using NT-native threads. * - * When doing IO, we want to use completion ports for optimal performance + * When doing IO, we want to use completion ports for optimal performance * with fibers. But if we use completion ports for all IO, it is difficult * to project a blocking model with GLOBAL_SCOPE threads. To handle this * we create an extra thread for completing IO for GLOBAL_SCOPE threads. @@ -32,9 +32,9 @@ static PRThread *_pr_io_completion_thread; #define RECYCLE_SIZE 512 static struct _MDLock _pr_recycle_lock; static PRInt32 _pr_recycle_INET_array[RECYCLE_SIZE]; -static PRInt32 _pr_recycle_INET_tail = 0; +static PRInt32 _pr_recycle_INET_tail = 0; static PRInt32 _pr_recycle_INET6_array[RECYCLE_SIZE]; -static PRInt32 _pr_recycle_INET6_tail = 0; +static PRInt32 _pr_recycle_INET6_tail = 0; __declspec(thread) PRThread *_pr_io_restarted_io = NULL; DWORD _pr_io_restartedIOIndex; /* The thread local storage slot for each @@ -97,14 +97,14 @@ static PRInt32 _nt_nonblock_recvfrom(PRFileDesc *, char *, int, struct sockaddr * An inheritable fd cannot be associated with an I/O completion port * because the completion notification of async I/O initiated by the * child process is still posted to the I/O completion port in the - * parent process. + * parent process. */ #define _NT_USE_NB_IO(fd) \ ((fd)->secret->nonblocking || (fd)->secret->inheritable == _PR_TRI_TRUE) /* * UDP support - * + * * UDP is supported on NT by the continuation thread mechanism. * The code is borrowed from ptio.c in pthreads nspr, hence the * PT and pt prefixes. This mechanism is in fact general and @@ -139,7 +139,7 @@ struct pt_Continuation union { PRIntn amount; } arg3; /* #3 - size of 'buffer' */ union { PRIntn flags; } arg4; /* #4 - read/write flags */ union { PRNetAddr *addr; } arg5; /* #5 - send/recv address */ - + PRIntervalTime timeout; /* representation of the timeout */ PRIntn event; /* flags for select()'s events */ @@ -218,7 +218,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) if ( !_PR_IS_NATIVE_THREAD(deadThread) ){ /* Spinlock while user thread is still running. * There is no way to use a condition variable here. The thread - * is dead, and we have to wait until we switch off the dead + * is dead, and we have to wait until we switch off the dead * thread before we can kill the fiber completely. */ while ( deadThread->no_sched) @@ -248,7 +248,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) */ timeout = 5000; #endif - else + else timeout = PR_IntervalToMilliseconds(ticks); /* @@ -261,7 +261,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) &bytes, &key, &olp, - timeout); + timeout); if (rv == 0 && olp == NULL) { /* Error in GetQueuedCompetionStatus */ if (GetLastError() != WAIT_TIMEOUT) { @@ -273,7 +273,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) } } - if (olp == NULL) + if (olp == NULL) return 0; mdOlp = (_MDOverlapped *)olp; @@ -354,7 +354,7 @@ _PR_MD_PAUSE_CPU(PRIntervalTime ticks) /* The KEY_CVAR notification only occurs when a native thread * is notifying a user thread. For user-user notifications - * the wakeup occurs by having the notifier place the thread + * the wakeup occurs by having the notifier place the thread * on the runq directly; for native-native notifications the * wakeup occurs by calling ReleaseSemaphore. */ @@ -648,7 +648,7 @@ _native_thread_io_wait(PRThread *thread, PRIntervalTime ticks) break; case WAIT_OBJECT_0 + _NATIVE_WAKEUP_EVENT_INDEX: /* - * I/O interrupted; + * I/O interrupted; */ #ifdef DEBUG _PR_THREAD_LOCK(thread); @@ -696,7 +696,7 @@ _NT_IO_WAIT(PRThread *thread, PRIntervalTime timeout) _PR_THREAD_LOCK(thread); - /* The IO may have already completed; if so, don't add to sleepQ, + /* The IO may have already completed; if so, don't add to sleepQ, * since we are already on the runQ! */ if (thread->io_pending == PR_TRUE) { @@ -724,7 +724,7 @@ void _PR_Unblock_IO_Wait(PRThread *thr) { PRStatus rv; _PRCPU *cpu = thr->cpu; - + PR_ASSERT(thr->state == _PR_IO_WAIT); /* * A thread for which an I/O timed out or was interrupted cannot be @@ -776,10 +776,10 @@ _NT_ResumeIO(PRThread *thread, PRIntervalTime ticks) if (!thread->io_pending) fWait = PR_FALSE; thread->io_suspended = PR_FALSE; - + _PR_THREAD_UNLOCK(thread); } - /* We don't put ourselves back on the sleepQ yet; until we + /* We don't put ourselves back on the sleepQ yet; until we * set the suspended bit to false, we can't do that. Just save * the sleep time here, and then continue. The restarted_io handler * will add us to the sleepQ if needed. @@ -800,10 +800,10 @@ _PR_MD_WAKEUP_WAITER(PRThread *thread) { if (thread == NULL) { /* If thread is NULL, we aren't waking a thread, we're just poking - * idle thread + * idle thread */ - if ( PostQueuedCompletionStatus(_pr_completion_port, 0, - KEY_CVAR, NULL) == FALSE) + if ( PostQueuedCompletionStatus(_pr_completion_port, 0, + KEY_CVAR, NULL) == FALSE) return PR_FAILURE; return PR_SUCCESS; } @@ -818,17 +818,17 @@ _PR_MD_WAKEUP_WAITER(PRThread *thread) /* When a Native thread has to awaken a user thread, it has to poke * the completion port because all user threads might be idle, and - * thus the CPUs are just waiting for a completion. + * thus the CPUs are just waiting for a completion. * - * XXXMB - can we know when we are truely idle (and not checking + * XXXMB - can we know when we are truely idle (and not checking * the runq)? */ if ((_PR_IS_NATIVE_THREAD(me) || (thread->cpu != me->cpu)) && (!thread->md.thr_bound_cpu)) { /* The thread should not be in any queue */ PR_ASSERT(thread->queueCount == 0); - if ( PostQueuedCompletionStatus(_pr_completion_port, 0, - KEY_CVAR, &(thread->md.overlapped.overlapped)) == FALSE) + if ( PostQueuedCompletionStatus(_pr_completion_port, 0, + KEY_CVAR, &(thread->md.overlapped.overlapped)) == FALSE) return PR_FAILURE; } return PR_SUCCESS; @@ -845,12 +845,12 @@ _PR_MD_INIT_IO() err = WSAStartup( WSAVersion, &WSAData ); PR_ASSERT(0 == err); - - _pr_completion_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, - NULL, - 0, + + _pr_completion_port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, + NULL, + 0, 0); - + _MD_NEW_LOCK(&_pr_recycle_lock); _MD_NEW_LOCK(&_pr_ioq_lock); @@ -860,7 +860,7 @@ _PR_MD_INIT_IO() if (OSversion.dwMajorVersion >= 4) { _nt_version_gets_lockfile_completion = PR_TRUE; } - } else + } else PR_ASSERT(0); #ifdef _NEED_351_FILE_LOCKING_HACK @@ -972,7 +972,7 @@ _md_put_recycled_socket(SOCKET newsock, int af) _MD_UNLOCK(&_pr_recycle_lock); closesocket(newsock); } - + return; } @@ -986,8 +986,8 @@ _md_Associate(HANDLE file) HANDLE port; if (!_native_threads_only) { - port = CreateIoCompletionPort((HANDLE)file, - _pr_completion_port, + port = CreateIoCompletionPort((HANDLE)file, + _pr_completion_port, KEY_IO, 0); @@ -1026,7 +1026,7 @@ _NT_IO_ABORT(PROsfd sock) int loop_count; /* This is a clumsy way to abort the IO, but it is all we can do. - * It looks a bit racy, but we handle all the cases. + * It looks a bit racy, but we handle all the cases. * case 1: IO completes before calling closesocket * case 1a: fWait is set to PR_FALSE * This should e the most likely case. We'll properly @@ -1147,7 +1147,7 @@ _PR_MD_connect_thread(void *cdata) PRInt32 -_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, +_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; @@ -1207,7 +1207,7 @@ _PR_MD_BIND(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen) #if 0 /* Disable nagle- so far unknown if this is good or not... */ - rv = setsockopt(fd->secret->md.osfd, + rv = setsockopt(fd->secret->md.osfd, SOL_SOCKET, TCP_NODELAY, (const char *)&one, @@ -1221,19 +1221,19 @@ _PR_MD_BIND(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen) void _PR_MD_UPDATE_ACCEPT_CONTEXT(PROsfd accept_sock, PROsfd listen_sock) { /* Sockets accept()'d with AcceptEx need to call this setsockopt before - * calling anything other than ReadFile(), WriteFile(), send(), recv(), - * Transmitfile(), and closesocket(). In order to call any other + * calling anything other than ReadFile(), WriteFile(), send(), recv(), + * Transmitfile(), and closesocket(). In order to call any other * winsock functions, we have to make this setsockopt call. * * XXXMB - For the server, we *NEVER* need this in * the "normal" code path. But now we have to call it. This is a waste - * of a system call. We'd like to only call it before calling the + * of a system call. We'd like to only call it before calling the * obscure socket calls, but since we don't know at that point what the * original socket was (or even if it is still alive) we can't do it - * at that point... + * at that point... */ - setsockopt((SOCKET)accept_sock, - SOL_SOCKET, + setsockopt((SOCKET)accept_sock, + SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char *)&listen_sock, sizeof(listen_sock)); @@ -1243,7 +1243,7 @@ void _PR_MD_UPDATE_ACCEPT_CONTEXT(PROsfd accept_sock, PROsfd listen_sock) #define INET_ADDR_PADDED (sizeof(PRNetAddr) + 16) PROsfd _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, - PRIntervalTime timeout, PRBool fast, + PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg) { PROsfd osfd = fd->secret->md.osfd; @@ -1393,9 +1393,9 @@ _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, } PRInt32 -_PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock, PRNetAddr **raddr, - void *buf, PRInt32 amount, PRIntervalTime timeout, - PRBool fast, _PR_AcceptTimeoutCallback callback, +_PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock, PRNetAddr **raddr, + void *buf, PRInt32 amount, PRIntervalTime timeout, + PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg) { PROsfd sock = sd->secret->md.osfd; @@ -1481,7 +1481,7 @@ retry: PR_ASSERT(timeout != PR_INTERVAL_NO_TIMEOUT); - err = getsockopt(*newSock, + err = getsockopt(*newSock, SOL_SOCKET, SO_CONNECT_TIME, (char *)&seconds, @@ -1489,9 +1489,9 @@ retry: if ( err == NO_ERROR ) { PRIntervalTime elapsed = PR_SecondsToInterval(seconds); - if (seconds == 0xffffffff) + if (seconds == 0xffffffff) isConnected = PR_FALSE; - else + else isConnected = PR_TRUE; if (!isConnected) { @@ -1527,9 +1527,9 @@ retry: PR_ASSERT(me->io_pending == PR_FALSE); PR_ASSERT(me->io_suspended == PR_FALSE); PR_ASSERT(me->md.thr_bound_cpu == NULL); - /* If the IO is still suspended, it means we didn't get any + /* If the IO is still suspended, it means we didn't get any * completion from NT_IO_WAIT. This is not disasterous, I hope, - * but it may mean we still have an IO outstanding... Try to + * but it may mean we still have an IO outstanding... Try to * recover by just allowing ourselves to continue. */ me->io_suspended = PR_FALSE; @@ -1554,7 +1554,7 @@ retry: return -1; } - if (!fast) + if (!fast) _PR_MD_UPDATE_ACCEPT_CONTEXT((SOCKET)*newSock, (SOCKET)sock); /* IO is done */ @@ -1677,7 +1677,7 @@ _PR_MD_SENDFILE(PRFileDesc *sock, PRSendFileData *sfd, } PRInt32 -_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, +_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; @@ -1722,7 +1722,7 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, me->io_fd = osfd; rv = ReadFile((HANDLE)osfd, - buf, + buf, amount, &bytes, &(me->md.overlapped.overlapped)); @@ -1821,7 +1821,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, me->io_fd = osfd; rv = WriteFile((HANDLE)osfd, - buf, + buf, amount, &bytes, &(me->md.overlapped.overlapped)); @@ -1927,7 +1927,7 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTi for (index=0; index<iov_size; index++) { rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout); - if (rv > 0) + if (rv > 0) sent += rv; if ( rv != iov[index].iov_len ) { if (sent <= 0) @@ -1996,7 +1996,7 @@ _PR_MD_GETPEERNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len) * Determine if the socket is connected. */ - rv = getsockopt(fd->secret->md.osfd, + rv = getsockopt(fd->secret->md.osfd, SOL_SOCKET, SO_CONNECT_TIME, (char *) &seconds, @@ -2013,7 +2013,7 @@ _PR_MD_GETPEERNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len) _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return PR_FAILURE; } - } else { + } else { rv = getpeername((SOCKET)fd->secret->md.osfd, (struct sockaddr *) addr, len); if (rv == 0) { @@ -2062,9 +2062,9 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode) PRInt32 access = 0; PRInt32 flags = 0; PRInt32 flag6 = 0; - + if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; @@ -2078,11 +2078,11 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, PRIntn mode) flag6 |= FILE_FLAG_OVERLAPPED; - file = CreateFile(name, - access, + file = CreateFile(name, + access, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, - flags, + flags, flag6, NULL); if (file == INVALID_HANDLE_VALUE) { @@ -2114,7 +2114,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, PRIntn mode) PACL pACL = NULL; if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; @@ -2137,11 +2137,11 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, PRIntn mode) lpSA = &sa; } } - file = CreateFile(name, - access, + file = CreateFile(name, + access, FILE_SHARE_READ|FILE_SHARE_WRITE, lpSA, - flags, + flags, flag6, NULL); if (lpSA != NULL) { @@ -2163,7 +2163,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, PRIntn mode) return (PROsfd)file; } -PRInt32 +PRInt32 _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) { PROsfd f = fd->secret->md.osfd; @@ -2186,10 +2186,10 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) PR_ASSERT((me->md.overlapped.overlapped.Offset != 0xffffffff) || (GetLastError() == NO_ERROR)); if (fd->secret->inheritable == _PR_TRI_TRUE) { - rv = ReadFile((HANDLE)f, - (LPVOID)buf, - len, - &bytes, + rv = ReadFile((HANDLE)f, + (LPVOID)buf, + len, + &bytes, &me->md.overlapped.overlapped); if (rv != 0) { loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); @@ -2235,10 +2235,10 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) _PR_THREAD_UNLOCK(me); me->io_fd = f; - rv = ReadFile((HANDLE)f, - (LPVOID)buf, - len, - &bytes, + rv = ReadFile((HANDLE)f, + (LPVOID)buf, + len, + &bytes, &me->md.overlapped.overlapped); if ( (rv == 0) && ((err = GetLastError()) != ERROR_IO_PENDING) ) { _PR_THREAD_LOCK(me); @@ -2287,7 +2287,7 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) } SetFilePointer((HANDLE)f, me->md.blocked_io_bytes, 0, FILE_CURRENT); - + PR_ASSERT(me->io_pending == PR_FALSE); return me->md.blocked_io_bytes; @@ -2304,7 +2304,7 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) /* ERROR_HANDLE_EOF can only be returned by async io */ PR_ASSERT(err != ERROR_HANDLE_EOF); if (err == ERROR_BROKEN_PIPE) { - /* The write end of the pipe has been closed. */ + /* The write end of the pipe has been closed. */ return 0; } _PR_MD_MAP_READ_ERROR(err); @@ -2338,10 +2338,10 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) PR_ASSERT((me->md.overlapped.overlapped.Offset != 0xffffffff) || (GetLastError() == NO_ERROR)); if (fd->secret->inheritable == _PR_TRI_TRUE) { - rv = WriteFile((HANDLE)f, - (LPVOID)buf, - len, - &bytes, + rv = WriteFile((HANDLE)f, + (LPVOID)buf, + len, + &bytes, &me->md.overlapped.overlapped); if (rv != 0) { loOffset = SetFilePointer((HANDLE)f, bytes, &hiOffset, FILE_CURRENT); @@ -2382,10 +2382,10 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) _PR_THREAD_UNLOCK(me); me->io_fd = f; - rv = WriteFile((HANDLE)f, - buf, - len, - &bytes, + rv = WriteFile((HANDLE)f, + buf, + len, + &bytes, &(me->md.overlapped.overlapped)); if ( (rv == 0) && ((err = GetLastError()) != ERROR_IO_PENDING) ) { _PR_THREAD_LOCK(me); @@ -2439,7 +2439,7 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) offset.QuadPart += me->md.blocked_io_bytes; SetFilePointer((HANDLE)f, offset.LowPart, &offset.HighPart, FILE_BEGIN); - + PR_ASSERT(me->io_pending == PR_FALSE); return me->md.blocked_io_bytes; @@ -2608,7 +2608,7 @@ _PR_MD_CLOSE(PROsfd osfd, PRBool socket) _PR_THREAD_LOCK(me); me->state = _PR_IO_WAIT; /* The IO could have completed on another thread just after - * calling closesocket while the io_suspended flag was true. + * calling closesocket while the io_suspended flag was true. * So we now grab the lock to do a safe check on io_pending to * see if we need to wait or not. */ @@ -2655,7 +2655,7 @@ _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable) return PR_FAILURE; } return PR_SUCCESS; -} +} void _PR_MD_INIT_FD_INHERITABLE(PRFileDesc *fd, PRBool imported) @@ -3000,7 +3000,7 @@ PRInt32 _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) { WIN32_FILE_ATTRIBUTE_DATA findFileData; - + if (NULL == fn || '\0' == *fn) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return -1; @@ -3213,7 +3213,7 @@ _PR_MD_LOCKFILE(PROsfd f) me->state = _PR_IO_WAIT; _PR_THREAD_UNLOCK(me); - rv = LockFileEx((HANDLE)f, + rv = LockFileEx((HANDLE)f, LOCKFILE_EXCLUSIVE_LOCK, 0, 0x7fffffff, @@ -3249,7 +3249,7 @@ _PR_MD_LOCKFILE(PROsfd f) * * If we pretend we won't get a completion, NSPR gets confused later * when the unexpected completion arrives. If we assume we do get - * a completion, we hang on 3.51. Worse, Microsoft informs me that the + * a completion, we hang on 3.51. Worse, Microsoft informs me that the * behavior varies on 3.51 depending on if you are using a network * file system or a local disk! * @@ -3257,7 +3257,7 @@ _PR_MD_LOCKFILE(PROsfd f) * depending on whether or not this system is EITHER * - running NT 4.0 * - running NT 3.51 with a service pack greater than 5. - * + * * In the meantime, this code may not work on network file systems. * */ @@ -3279,14 +3279,14 @@ _PR_MD_LOCKFILE(PROsfd f) } #ifdef _NEED_351_FILE_LOCKING_HACK else if (rv) { - /* If this is NT 3.51 and the file is local, then we won't get a + /* If this is NT 3.51 and the file is local, then we won't get a * completion back from LockFile when it succeeded. */ if (_nt_version_gets_lockfile_completion == PR_FALSE) { if ( IsFileLocal((HANDLE)f) == _PR_LOCAL_FILE) { me->io_pending = PR_FALSE; me->state = _PR_RUNNING; - return PR_SUCCESS; + return PR_SUCCESS; } } } @@ -3332,7 +3332,7 @@ _PR_MD_TLOCKFILE(PROsfd f) me->state = _PR_IO_WAIT; _PR_THREAD_UNLOCK(me); - rv = LockFileEx((HANDLE)f, + rv = LockFileEx((HANDLE)f, LOCKFILE_FAIL_IMMEDIATELY|LOCKFILE_EXCLUSIVE_LOCK, 0, 0x7fffffff, @@ -3375,7 +3375,7 @@ _PR_MD_TLOCKFILE(PROsfd f) } #ifdef _NEED_351_FILE_LOCKING_HACK else if (rv) { - /* If this is NT 3.51 and the file is local, then we won't get a + /* If this is NT 3.51 and the file is local, then we won't get a * completion back from LockFile when it succeeded. */ if (_nt_version_gets_lockfile_completion == PR_FALSE) { @@ -3391,7 +3391,7 @@ _PR_MD_TLOCKFILE(PROsfd f) } _PR_THREAD_UNLOCK(me); - return PR_SUCCESS; + return PR_SUCCESS; } } } @@ -3465,17 +3465,17 @@ _PR_MD_MAKE_NONBLOCK(PRFileDesc *f) #ifdef _NEED_351_FILE_LOCKING_HACK /*************** -** +** ** Lockfile hacks ** ** The following code is a hack to work around a microsoft bug with lockfile. ** The problem is that on NT 3.51, if LockFileEx() succeeds, you never ** get a completion back for files that are on local disks. So, we need to -** know if a file is local or remote so we can tell if we should expect +** know if a file is local or remote so we can tell if we should expect ** a completion. ** ** The only way to check if a file is local or remote based on the handle is -** to get the serial number for the volume it is mounted on and then to +** to get the serial number for the volume it is mounted on and then to ** compare that with mounted drives. This code caches the volume numbers of ** fixed disks and does a relatively quick check. ** @@ -3550,12 +3550,12 @@ PRBool IsFileLocalInit() case DRIVE_REMOVABLE: // CDROM is a removable media - case DRIVE_CDROM: + case DRIVE_CDROM: // no idea if ramdisks can change serial numbers or not // but it doesn't hurt to treat them as removable. - - case DRIVE_RAMDISK: + + case DRIVE_RAMDISK: // Here is where we keep track of removable drives. @@ -3565,7 +3565,7 @@ PRBool IsFileLocalInit() case DRIVE_FIXED: - // cache volume serial numbers. + // cache volume serial numbers. if (GetVolumeInformation( &lpBuffer[dwIndex], NULL, 0, @@ -3577,7 +3577,7 @@ PRBool IsFileLocalInit() dwLastCachedDrive = dwDriveIndex; dwCachedVolumeSerialNumbers[dwDriveIndex] = dwVolumeSerialNumber; } - + break; } } @@ -3616,7 +3616,7 @@ PRInt32 IsFileLocal(HANDLE hFile) _MD_UNLOCK(&cachedVolumeLock); // volume serial number not found in the cache. Check removable files. - // removable drives are noted as a bitmask. If the bit associated with + // removable drives are noted as a bitmask. If the bit associated with // a specific drive is set, then we should query its volume serial number // as its possible it has changed. dwMask = dwRemoveableDrivesToCheck; @@ -3819,7 +3819,7 @@ static PRInt32 _nt_nonblock_connect(PRFileDesc *fd, struct sockaddr *addr, int a } _PR_MD_MAP_CONNECT_ERROR(err); return -1; - } + } PR_ASSERT(FD_ISSET((SOCKET)osfd, &wr)); rv = 0; } else { @@ -3946,7 +3946,7 @@ static PRInt32 _nt_nonblock_writev(PRFileDesc *fd, const PRIOVec *iov, int size, for (index=0; index<size; index++) { rv = _nt_nonblock_send(fd, iov[index].iov_base, iov[index].iov_len, timeout); - if (rv > 0) + if (rv > 0) sent += rv; if ( rv != iov[index].iov_len ) { if (rv < 0) { @@ -4110,7 +4110,7 @@ static void pt_InsertTimedInternal(pt_Continuation *op) * Subsequently earlier timeouts are computed based on the latter * knowledge by subracting the timeout deltas that are stored in * the operation list. There are operation[n]->timeout ticks - * between the expiration of operation[n-1] and operation[n].e e + * between the expiration of operation[n-1] and operation[n].e e * * Therefore, the operation[n-1] will expire operation[n]->timeout * ticks prior to operation[n]. @@ -4375,7 +4375,7 @@ static void ContinuationThread(void *arg) { if (0 == pt_tq.head->timeout) { - /* + /* * The leading element of the timed queue has timed * out. Get rid of it. In any case go around the * loop again, computing the polling list, checking diff --git a/pr/src/md/windows/ntmisc.c b/pr/src/md/windows/ntmisc.c index 12f8c1df..2413e27b 100644 --- a/pr/src/md/windows/ntmisc.c +++ b/pr/src/md/windows/ntmisc.c @@ -99,7 +99,7 @@ NowCalibrate(void) PRInt64 calibrationDelta = 0; /* * By wrapping a timeBegin/EndPeriod pair of calls around this loop, - * the loop seems to take much less time (1 ms vs 15ms) on Vista. + * the loop seems to take much less time (1 ms vs 15ms) on Vista. */ timeBeginPeriod(1); LowResTime(&ftStart); @@ -108,7 +108,7 @@ NowCalibrate(void) } while (memcmp(&ftStart,&ft, sizeof(ft)) == 0); timeEndPeriod(1); - calibration.granularity = + calibration.granularity = (FILETIME_TO_INT64(ft) - FILETIME_TO_INT64(ftStart))/10; QueryPerformanceCounter(&now); @@ -116,9 +116,9 @@ NowCalibrate(void) calibration.offset = (long double) FILETIME_TO_INT64(ft); calibration.timer_offset = (long double) now.QuadPart; /* - * The windows epoch is around 1600. The unix epoch is around 1970. + * The windows epoch is around 1600. The unix epoch is around 1970. * _pr_filetime_offset is the difference (in windows time units which - * are 10 times more highres than the JS time unit) + * are 10 times more highres than the JS time unit) */ calibration.offset -= _pr_filetime_offset; calibration.offset *= 0.1; @@ -211,7 +211,7 @@ PR_Now(void) if (calibration.offset == cachedOffset) { /* * Since calibration can take a while, make any other - * threads immediately wait + * threads immediately wait */ MUTEX_SETSPINCOUNT(&calibration.data_lock, 0); @@ -248,8 +248,8 @@ PR_Now(void) (highresTimerValue-calibration.timer_offset)/calibration.freq; cachedOffset = calibration.offset; - /* - * On some dual processor/core systems, we might get an earlier + /* + * On some dual processor/core systems, we might get an earlier * time so we cache the last time that we returned. */ calibration.last = PR_MAX(calibration.last,(PRInt64)highresTime); @@ -261,12 +261,12 @@ PR_Now(void) /* Check for clock skew */ diff = lowresTime - highresTime; - /* + /* * For some reason that I have not determined, the skew can be * up to twice a kernel tick. This does not seem to happen by * itself, but I have only seen it triggered by another program * doing some kind of file I/O. The symptoms are a negative diff - * followed by an equally large positive diff. + * followed by an equally large positive diff. */ if (fabs(diff) > 2*skewThreshold) { if (calibrated) { @@ -279,13 +279,13 @@ PR_Now(void) * resolution results for anything, so let's resort to old * behavior for this call. It's possible that in the * future, the user will want the high resolution timer, so - * we don't disable it entirely. + * we don't disable it entirely. */ returnedTime = (PRInt64)lowresTime; needsCalibration = PR_FALSE; } else { /* - * It is possible that when we recalibrate, we will return + * It is possible that when we recalibrate, we will return * a value less than what we have returned before; this is * unavoidable. We cannot tell the different between a * faulty QueryPerformanceCounter implementation and user @@ -293,7 +293,7 @@ PR_Now(void) * respect user changes to the operating system time, we * cannot maintain the invariant that Date.now() never * decreases; the old implementation has this behavior as - * well. + * well. */ needsCalibration = PR_TRUE; } @@ -323,7 +323,7 @@ PR_Now(void) GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); _PR_FileTimeToPRTime(&ft, &prt); - return prt; + return prt; } #endif @@ -376,7 +376,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) for (arg = argv; *arg; arg++) { /* Add a space to separates the arguments */ if (arg != argv) { - *p++ = ' '; + *p++ = ' '; } q = *arg; numBackslashes = 0; @@ -442,7 +442,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) if (argNeedQuotes) { *p++ = '"'; } - } + } *p = '\0'; return 0; @@ -827,18 +827,18 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) if (PR_SI_SYSNAME == cmd) (void)PR_snprintf(name, namelen, "Windows_NT"); else if (PR_SI_RELEASE == cmd) - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); break; case VER_PLATFORM_WIN32_WINDOWS: if (PR_SI_SYSNAME == cmd) { - if ((osvi.dwMajorVersion > 4) || + if ((osvi.dwMajorVersion > 4) || ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0))) (void)PR_snprintf(name, namelen, "Windows_98"); else (void)PR_snprintf(name, namelen, "Windows_95"); } else if (PR_SI_RELEASE == cmd) { - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); } break; @@ -847,7 +847,7 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) if (PR_SI_SYSNAME == cmd) (void)PR_snprintf(name, namelen, "Windows_CE"); else if (PR_SI_RELEASE == cmd) - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); break; #endif @@ -876,7 +876,7 @@ PRStatus _MD_WindowsGetReleaseName(char *name, PRUint32 namelen) switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: case VER_PLATFORM_WIN32_WINDOWS: - (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, + (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); break; default: @@ -960,16 +960,16 @@ void * _MD_MemMap( if ((addr = MapViewOfFile(fmap->md.hFileMap, fmap->md.dwAccess, dwHi, dwLo, len)) == NULL) { { - LPVOID lpMsgBuf; - - FormatMessage( + LPVOID lpMsgBuf; + + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("md_memmap(): %s", lpMsgBuf )); } @@ -1035,10 +1035,10 @@ PRStatus _MD_SyncMemMap( #pragma warning(disable: 4035) PRInt32 _PR_MD_ATOMIC_INCREMENT(PRInt32 *val) -{ +{ #if defined(__GNUC__) PRInt32 result; - asm volatile ("lock ; xadd %0, %1" + asm volatile ("lock ; xadd %0, %1" : "=r"(result), "=m"(*val) : "0"(1), "m"(*val)); return result + 1; @@ -1059,7 +1059,7 @@ PRInt32 _PR_MD_ATOMIC_DECREMENT(PRInt32 *val) { #if defined(__GNUC__) PRInt32 result; - asm volatile ("lock ; xadd %0, %1" + asm volatile ("lock ; xadd %0, %1" : "=r"(result), "=m"(*val) : "0"(-1), "m"(*val)); //asm volatile("lock ; xadd %0, %1" : "=m" (val), "=a" (result) : "-1" (1)); @@ -1082,7 +1082,7 @@ PRInt32 _PR_MD_ATOMIC_ADD(PRInt32 *intp, PRInt32 val) #if defined(__GNUC__) PRInt32 result; //asm volatile("lock ; xadd %1, %0" : "=m" (intp), "=a" (result) : "1" (val)); - asm volatile ("lock ; xadd %0, %1" + asm volatile ("lock ; xadd %0, %1" : "=r"(result), "=m"(*intp) : "0"(val), "m"(*intp)); return result + val; @@ -1102,24 +1102,24 @@ PRInt32 _PR_MD_ATOMIC_ADD(PRInt32 *intp, PRInt32 val) #ifdef _PR_HAVE_ATOMIC_CAS #pragma warning(disable: 4035) -void +void PR_StackPush(PRStack *stack, PRStackElem *stack_elem) { #if defined(__GNUC__) void **tos = (void **) stack; void *tmp; - + retry: if (*tos == (void *) -1) goto retry; - + __asm__("xchg %0,%1" : "=r" (tmp), "=m"(*tos) : "0" (-1), "m"(*tos)); - + if (tmp == (void *) -1) goto retry; - + *(void **)stack_elem = tmp; __asm__("" : : : "memory"); *tos = stack_elem; @@ -1143,24 +1143,24 @@ retry: mov eax,[ebx] #pragma warning(default: 4035) #pragma warning(disable: 4035) -PRStackElem * +PRStackElem * PR_StackPop(PRStack *stack) { #if defined(__GNUC__) void **tos = (void **) stack; void *tmp; - + retry: if (*tos == (void *) -1) goto retry; - + __asm__("xchg %0,%1" : "=r" (tmp), "=m"(*tos) : "0" (-1), "m"(*tos)); if (tmp == (void *) -1) goto retry; - + if (tmp != (void *) 0) { void *next = *(void **)tmp; @@ -1169,7 +1169,7 @@ PR_StackPop(PRStack *stack) } else *tos = tmp; - + return tmp; #else __asm @@ -1190,7 +1190,7 @@ retry: mov eax,[ebx] jmp done empty: mov [ebx],eax -done: +done: } #endif /* __GNUC__ */ } diff --git a/pr/src/md/windows/ntsem.c b/pr/src/md/windows/ntsem.c index f36a145a..716e6ef3 100644 --- a/pr/src/md/windows/ntsem.c +++ b/pr/src/md/windows/ntsem.c @@ -12,19 +12,19 @@ #include "primpl.h" -void +void _PR_MD_NEW_SEM(_MDSemaphore *md, PRUintn value) { md->sem = CreateSemaphore(NULL, value, 0x7fffffff, NULL); } -void +void _PR_MD_DESTROY_SEM(_MDSemaphore *md) { CloseHandle(md->sem); } -PRStatus +PRStatus _PR_MD_TIMED_WAIT_SEM(_MDSemaphore *md, PRIntervalTime ticks) { int rv; @@ -37,13 +37,13 @@ _PR_MD_TIMED_WAIT_SEM(_MDSemaphore *md, PRIntervalTime ticks) return PR_FAILURE; } -PRStatus +PRStatus _PR_MD_WAIT_SEM(_MDSemaphore *md) { return _PR_MD_TIMED_WAIT_SEM(md, PR_INTERVAL_NO_TIMEOUT); } -void +void _PR_MD_POST_SEM(_MDSemaphore *md) { ReleaseSemaphore(md->sem, 1, NULL); diff --git a/pr/src/md/windows/ntthread.c b/pr/src/md/windows/ntthread.c index 1fdf0e93..6dd01fb9 100644 --- a/pr/src/md/windows/ntthread.c +++ b/pr/src/md/windows/ntthread.c @@ -181,12 +181,12 @@ pr_root(void *arg) return 0; } -PRStatus -_PR_MD_CREATE_THREAD(PRThread *thread, - void (*start)(void *), - PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, +PRStatus +_PR_MD_CREATE_THREAD(PRThread *thread, + void (*start)(void *), + PRThreadPriority priority, + PRThreadScope scope, + PRThreadState state, PRUint32 stackSize) { @@ -250,14 +250,14 @@ _PR_MD_END_THREAD(void) _endthreadex(0); } -void +void _PR_MD_YIELD(void) { /* Can NT really yield at all? */ Sleep(0); } -void +void _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri) { int nativePri; @@ -428,7 +428,7 @@ _PR_MD_EXIT(PRIntn status) #ifdef HAVE_FIBERS void -_pr_fiber_mainline(void *unused) +_pr_fiber_mainline(void *unused) { PRThread *fiber = _PR_MD_CURRENT_THREAD(); @@ -445,7 +445,7 @@ PRThread *_PR_MD_CREATE_USER_THREAD( if ( (thread = PR_NEW(PRThread)) == NULL ) { return NULL; } - + memset(thread, 0, sizeof(PRThread)); thread->md.fiber_fn = start; thread->md.fiber_arg = arg; @@ -468,7 +468,7 @@ void _PR_MD_INIT_CONTEXT(PRThread *thread, char *top, void (*start) (void), PRBool *status) { thread->md.fiber_fn = (void (*)(void *))start; - thread->md.fiber_id = CreateFiber(thread->md.fiber_stacksize, + thread->md.fiber_id = CreateFiber(thread->md.fiber_stacksize, (LPFIBER_START_ROUTINE)_pr_fiber_mainline, NULL); if (thread->md.fiber_id != 0) *status = PR_TRUE; @@ -502,7 +502,7 @@ _PR_MD_RESTORE_CONTEXT(PRThread *thread) PR_ASSERT( !_PR_IS_NATIVE_THREAD(thread) ); /* The user-level code for yielding will happily add ourselves to the runq - * and then switch to ourselves; the NT fibers can't handle switching to + * and then switch to ourselves; the NT fibers can't handle switching to * ourselves. */ if (thread != me) { @@ -532,12 +532,12 @@ PRInt32 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask) PRInt32 rv, system_mask; rv = GetProcessAffinityMask(GetCurrentProcess(), mask, &system_mask); - + return rv?0:-1; } -void -_PR_MD_SUSPEND_CPU(_PRCPU *cpu) +void +_PR_MD_SUSPEND_CPU(_PRCPU *cpu) { _PR_MD_SUSPEND_THREAD(cpu->thread); } diff --git a/pr/src/md/windows/w32ipcsem.c b/pr/src/md/windows/w32ipcsem.c index 95459100..5719ce3f 100644 --- a/pr/src/md/windows/w32ipcsem.c +++ b/pr/src/md/windows/w32ipcsem.c @@ -18,13 +18,13 @@ static HANDLE OpenSemaphore(DWORD inDesiredAccess, HANDLE retval = NULL; HANDLE semaphore = NULL; PRUnichar wideName[MAX_PATH]; /* name size is limited to MAX_PATH */ - + MultiByteToWideChar(CP_ACP, 0, inName, -1, wideName, MAX_PATH); /* 0x7fffffff is the max count for our semaphore */ semaphore = CreateSemaphoreW(NULL, 0, 0x7fffffff, wideName); if (NULL != semaphore) { DWORD lastErr = GetLastError(); - + if (ERROR_ALREADY_EXISTS != lastErr) CloseHandle(semaphore); else @@ -142,7 +142,7 @@ PRSem *_PR_MD_OPEN_SEMAPHORE( #ifdef WINCE { /* The size of a sem's name is limited to MAX_PATH. */ - PRUnichar wosname[MAX_PATH]; + PRUnichar wosname[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, osname, -1, wosname, MAX_PATH); sem->sem = CreateSemaphoreW(lpSA, value, 0x7fffffff, wosname); } diff --git a/pr/src/md/windows/w32poll.c b/pr/src/md/windows/w32poll.c index daf14dfe..8a4b5157 100644 --- a/pr/src/md/windows/w32poll.c +++ b/pr/src/md/windows/w32poll.c @@ -275,14 +275,14 @@ PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_READ) out_flags |= PR_POLL_WRITE; - } + } if (FD_ISSET(osfd, &wt)) { if (pd->out_flags & _PR_POLL_READ_SYS_WRITE) out_flags |= PR_POLL_READ; if (pd->out_flags & _PR_POLL_WRITE_SYS_WRITE) out_flags |= PR_POLL_WRITE; - } + } if (FD_ISSET(osfd, &ex)) out_flags |= PR_POLL_EXCEPT; } pd->out_flags = out_flags; diff --git a/pr/src/md/windows/w32shm.c b/pr/src/md/windows/w32shm.c index 8e8b1d68..748a9860 100644 --- a/pr/src/md/windows/w32shm.c +++ b/pr/src/md/windows/w32shm.c @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <private/primpl.h> +#include <private/primpl.h> #include <string.h> #include <prshm.h> #include <prerr.h> @@ -23,11 +23,11 @@ extern PRLogModuleInfo *_pr_shm_lm; */ static DWORD filemapAccessTable[] = { FILE_MAP_ALL_ACCESS & ~FILE_MAP_WRITE, /* read */ - FILE_MAP_ALL_ACCESS & ~FILE_MAP_READ, /* write */ + FILE_MAP_ALL_ACCESS & ~FILE_MAP_READ, /* write */ 0 /* execute */ }; -extern PRSharedMemory * _MD_OpenSharedMemory( +extern PRSharedMemory * _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, @@ -48,15 +48,15 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( PR_FAILURE == rc ) { PR_SetError(PR_UNKNOWN_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: name is invalid")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: name is invalid")); return(NULL); } shm = PR_NEWZAP( PRSharedMemory ); - if ( NULL == shm ) + if ( NULL == shm ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New PRSharedMemory out of memory")); return(NULL); } @@ -64,14 +64,14 @@ extern PRSharedMemory * _MD_OpenSharedMemory( if ( NULL == shm->ipcname ) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0 ); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: New shm->ipcname out of memory")); PR_DELETE(shm); return(NULL); } /* copy args to struct */ strcpy( shm->ipcname, ipcname ); - shm->size = size; + shm->size = size; shm->mode = mode; shm->flags = flags; shm->ident = _PR_SHM_IDENT; @@ -118,25 +118,25 @@ extern PRSharedMemory * _MD_OpenSharedMemory( } if ( NULL == shm->handle ) { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: CreateFileMapping() failed: %s", - shm->ipcname )); + shm->ipcname )); _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); PR_FREEIF( shm->ipcname ) PR_DELETE( shm ); return(NULL); } else { if (( flags & PR_SHM_EXCL) && ( GetLastError() == ERROR_ALREADY_EXISTS )) { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: Request exclusive & already exists", - shm->ipcname )); + shm->ipcname )); PR_SetError( PR_FILE_EXISTS_ERROR, ERROR_ALREADY_EXISTS ); CloseHandle( shm->handle ); PR_FREEIF( shm->ipcname ) PR_DELETE( shm ); return(NULL); } else { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: CreateFileMapping() success: %s, handle: %d", shm->ipcname, shm->handle )); return(shm); @@ -151,16 +151,16 @@ extern PRSharedMemory * _MD_OpenSharedMemory( #endif if ( NULL == shm->handle ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: OpenFileMapping() failed: %s, error: %d", - shm->ipcname, PR_GetOSError())); + shm->ipcname, PR_GetOSError())); PR_FREEIF( shm->ipcname ); PR_DELETE( shm ); return(NULL); } else { - PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, + PR_LOG(_pr_shm_lm, PR_LOG_DEBUG, ( "PR_OpenSharedMemory: OpenFileMapping() success: %s, handle: %d", - shm->ipcname, shm->handle )); + shm->ipcname, shm->handle )); return(shm); } } @@ -184,7 +184,7 @@ extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags ) if ( NULL == addr ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG( _pr_shm_lm, PR_LOG_ERROR, + PR_LOG( _pr_shm_lm, PR_LOG_ERROR, ("_MD_AttachSharedMemory: MapViewOfFile() failed. OSerror: %d", PR_GetOSError())); } @@ -200,10 +200,10 @@ extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr ) PR_ASSERT( shm->ident == _PR_SHM_IDENT ); wrc = UnmapViewOfFile( addr ); - if ( FALSE == wrc ) + if ( FALSE == wrc ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG( _pr_shm_lm, PR_LOG_ERROR, + PR_LOG( _pr_shm_lm, PR_LOG_ERROR, ("_MD_DetachSharedMemory: UnmapViewOfFile() failed. OSerror: %d", PR_GetOSError())); rc = PR_FAILURE; } @@ -223,7 +223,7 @@ extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) if ( FALSE == wrc ) { _PR_MD_MAP_DEFAULT_ERROR( GetLastError()); - PR_LOG( _pr_shm_lm, PR_LOG_ERROR, + PR_LOG( _pr_shm_lm, PR_LOG_ERROR, ("_MD_CloseSharedMemory: CloseHandle() failed. OSerror: %d", PR_GetOSError())); rc = PR_FAILURE; } @@ -236,7 +236,7 @@ extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm ) extern PRStatus _MD_DeleteSharedMemory( const char *name ) { return( PR_SUCCESS ); -} +} /* @@ -244,7 +244,7 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name ) */ extern PRLogModuleInfo *_pr_shma_lm; -extern PRFileMap* _md_OpenAnonFileMap( +extern PRFileMap* _md_OpenAnonFileMap( const char *dirName, PRSize size, PRFileMapProtect prot @@ -280,7 +280,7 @@ extern PRFileMap* _md_OpenAnonFileMap( CloseHandle(fm->md.hFileMap); fm->md.hFileMap = hFileMap; -Finished: +Finished: return(fm); } /* end md_OpenAnonFileMap() */ @@ -302,7 +302,7 @@ extern PRStatus _md_ExportFileMapAsString( PR_LOG( _pr_shma_lm, PR_LOG_DEBUG, ("_md_ExportFileMapAsString(): prot: %x, hFileMap: %x, dwAccess: %x", fm->prot, fm->md.hFileMap, fm->md.dwAccess )); - + return((written == -1)? PR_FAILURE : PR_SUCCESS); } /* end _md_ExportFileMapAsString() */ @@ -342,6 +342,6 @@ extern PRFileMap * _md_ImportFileMapFromString( } /* end _md_ImportFileMapFromString() */ #else -Error! Why is PR_HAVE_WIN32_NAMED_SHARED_MEMORY not defined? +Error! Why is PR_HAVE_WIN32_NAMED_SHARED_MEMORY not defined? #endif /* PR_HAVE_WIN32_NAMED_SHARED_MEMORY */ /* --- end w32shm.c --- */ diff --git a/pr/src/md/windows/w95cv.c b/pr/src/md/windows/w95cv.c index 27b34e69..42a43ae5 100644 --- a/pr/src/md/windows/w95cv.c +++ b/pr/src/md/windows/w95cv.c @@ -16,7 +16,7 @@ * until right after we unlock the lock. This way the awakened threads * have a better chance to reaquire the lock. */ - + #include "primpl.h" /* @@ -78,7 +78,7 @@ md_UnlockAndPostNotifies( lock->notified.link = NULL; #endif - /* + /* * Figure out how many threads we need to wake up. */ notified = &post; /* this is where we start */ @@ -87,7 +87,7 @@ md_UnlockAndPostNotifies( _MDCVar *cv = notified->cv[index].cv; PRThread *thred; int i; - + /* Fast special case: no waiting threads */ if (cv->waitHead == NULL) { notified->cv[index].notifyHead = NULL; @@ -207,7 +207,7 @@ static void md_PostNotifyToCvar(_MDCVar *cvar, _MDLock *lock, * 0 when it succeeds. * */ -PRInt32 +PRInt32 _PR_MD_NEW_CV(_MDCVar *cv) { cv->magic = _MD_MAGIC_CV; @@ -216,7 +216,7 @@ _PR_MD_NEW_CV(_MDCVar *cv) * when the PRCondVar structure is created. */ return 0; -} +} void _PR_MD_FREE_CV(_MDCVar *cv) { diff --git a/pr/src/md/windows/w95io.c b/pr/src/md/windows/w95io.c index 9bae6f8d..07a19458 100644 --- a/pr/src/md/windows/w95io.c +++ b/pr/src/md/windows/w95io.c @@ -86,7 +86,7 @@ _PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks) PRUint32 msecs = (ticks == PR_INTERVAL_NO_TIMEOUT) ? INFINITE : PR_IntervalToMilliseconds(ticks); rv = WaitForSingleObject(thread->md.blocked_sema, msecs); - switch(rv) + switch(rv) { case WAIT_OBJECT_0: return PR_SUCCESS; @@ -116,7 +116,7 @@ _PR_MD_WAIT(PRThread *thread, PRIntervalTime ticks) PRStatus _PR_MD_WAKEUP_WAITER(PRThread *thread) { - if ( _PR_IS_NATIVE_THREAD(thread) ) + if ( _PR_IS_NATIVE_THREAD(thread) ) { if (ReleaseSemaphore(thread->md.blocked_sema, 1, NULL) == FALSE) return PR_FAILURE; @@ -135,7 +135,7 @@ _PR_MD_WAKEUP_WAITER(PRThread *thread) * The NSPR open flags (osflags) are translated into flags for Win95 * * Mode seems to be passed in as a unix style file permissions argument - * as in 0666, in the case of opening the logFile. + * as in 0666, in the case of opening the logFile. * */ PROsfd @@ -145,9 +145,9 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) PRInt32 access = 0; PRInt32 flags = 0; PRInt32 flag6 = 0; - + if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) @@ -176,7 +176,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) NULL); if (file == INVALID_HANDLE_VALUE) { _PR_MD_MAP_OPEN_ERROR(GetLastError()); - return -1; + return -1; } return (PROsfd)file; @@ -203,9 +203,9 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, int mode) lpSA = &sa; } } - + if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) @@ -237,7 +237,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, int mode) } if (file == INVALID_HANDLE_VALUE) { _PR_MD_MAP_OPEN_ERROR(GetLastError()); - return -1; + return -1; } return (PROsfd)file; @@ -254,8 +254,8 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) len, &bytes, NULL); - - if (rv == 0) + + if (rv == 0) { err = GetLastError(); /* ERROR_HANDLE_EOF can only be returned by async io */ @@ -276,14 +276,14 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) PROsfd f = fd->secret->md.osfd; PRInt32 bytes; int rv; - + rv = WriteFile((HANDLE)f, buf, len, &bytes, NULL ); - - if (rv == 0) + + if (rv == 0) { _PR_MD_MAP_WRITE_ERROR(GetLastError()); return -1; @@ -399,7 +399,7 @@ PRInt32 _MD_CloseFile(PROsfd osfd) { PRInt32 rv; - + rv = (CloseHandle((HANDLE)osfd))?0:-1; if (rv == -1) _PR_MD_MAP_CLOSE_ERROR(GetLastError()); @@ -723,7 +723,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) { WIN32_FILE_ATTRIBUTE_DATA findFileData; BOOL rv; - + if (NULL == fn || '\0' == *fn) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return -1; @@ -832,7 +832,7 @@ _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable) return PR_FAILURE; } return PR_SUCCESS; -} +} void _PR_MD_INIT_FD_INHERITABLE(PRFileDesc *fd, PRBool imported) @@ -953,7 +953,7 @@ _PR_MD_LOCKFILE(PROsfd f) rv = LockFile( (HANDLE)f, 0l, 0l, - 0x0l, 0xffffffffl ); + 0x0l, 0xffffffffl ); if ( rv == 0 ) { DWORD err = GetLastError(); _PR_MD_MAP_DEFAULT_ERROR(err); @@ -977,11 +977,11 @@ PRStatus _PR_MD_UNLOCKFILE(PROsfd f) { PRInt32 rv; - + rv = UnlockFile( (HANDLE) f, 0l, 0l, - 0x0l, 0xffffffffl ); - + 0x0l, 0xffffffffl ); + if ( rv ) { return PR_SUCCESS; @@ -1059,7 +1059,7 @@ _PR_MD_OPEN_FILE_UTF16(const PRUnichar *name, PRIntn osflags, int mode) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; - + if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL ) flags = CREATE_NEW; else if (osflags & PR_CREATE_FILE) { @@ -1088,10 +1088,10 @@ _PR_MD_OPEN_FILE_UTF16(const PRUnichar *name, PRIntn osflags, int mode) _PR_MD_MAP_OPEN_ERROR(GetLastError()); return -1; } - + return (PROsfd)file; } - + PRStatus _PR_MD_OPEN_DIR_UTF16(_MDDirUTF16 *d, const PRUnichar *name) { @@ -1164,7 +1164,7 @@ _PR_MD_READ_DIR_UTF16(_MDDirUTF16 *d, PRIntn flags) PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return NULL; } - + PRInt32 _PR_MD_CLOSE_DIR_UTF16(_MDDirUTF16 *d) { @@ -1312,7 +1312,7 @@ _PR_MD_GETFILEINFO64_UTF16(const PRUnichar *fn, PRFileInfo64 *info) if (NULL == wcspbrk(fn, L".\\/")) { _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); return -1; - } + } len = getFullPathNameW(fn, sizeof(pathbuf)/sizeof(pathbuf[0]), pathbuf, &filePart); if (0 == len) { diff --git a/pr/src/md/windows/w95sock.c b/pr/src/md/windows/w95sock.c index c6a3ec11..10423e98 100644 --- a/pr/src/md/windows/w95sock.c +++ b/pr/src/md/windows/w95sock.c @@ -14,7 +14,7 @@ #define CONNECT_FD 3 static PRInt32 socket_io_wait( - PROsfd osfd, + PROsfd osfd, PRInt32 fd_type, PRIntervalTime timeout); @@ -51,7 +51,7 @@ _PR_MD_SOCKET(int af, int type, int flags) sock = socket(af, type, flags); - if (sock == INVALID_SOCKET ) + if (sock == INVALID_SOCKET ) { _PR_MD_MAP_SOCKET_ERROR(WSAGetLastError()); return (PROsfd)sock; @@ -120,8 +120,8 @@ _MD_SocketAvailable(PRFileDesc *fd) } PROsfd _MD_Accept( - PRFileDesc *fd, - PRNetAddr *raddr, + PRFileDesc *fd, + PRNetAddr *raddr, PRUint32 *rlen, PRIntervalTime timeout ) { @@ -129,7 +129,7 @@ PROsfd _MD_Accept( SOCKET sock; PRInt32 rv, err; - while ((sock = accept(osfd, (struct sockaddr *) raddr, rlen)) == -1) + while ((sock = accept(osfd, (struct sockaddr *) raddr, rlen)) == -1) { err = WSAGetLastError(); if ((err == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) @@ -149,14 +149,14 @@ PROsfd _MD_Accept( } /* end _MD_accept() */ PRInt32 -_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, +_PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; PRInt32 rv; int err; - if ((rv = connect(osfd, (struct sockaddr *) addr, addrlen)) == -1) + if ((rv = connect(osfd, (struct sockaddr *) addr, addrlen)) == -1) { err = WSAGetLastError(); if ((!fd->secret->nonblocking) && (err == WSAEWOULDBLOCK)) @@ -171,7 +171,7 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PR_ASSERT(rv > 0); /* it's connected */ return(0); - } + } } _PR_MD_MAP_CONNECT_ERROR(err); } @@ -209,7 +209,7 @@ _PR_MD_LISTEN(PRFileDesc *fd, PRIntn backlog) } PRInt32 -_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, +_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout) { PROsfd osfd = fd->secret->md.osfd; @@ -222,18 +222,18 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PR_ASSERT(PR_MSG_PEEK == flags); osflags = MSG_PEEK; } - while ((rv = recv( osfd, buf, amount, osflags)) == -1) + while ((rv = recv( osfd, buf, amount, osflags)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, READ_FD, timeout); if ( rv < 0 ) { return -1; - } - } - else + } + } + else { _PR_MD_MAP_RECV_ERROR(err); break; @@ -250,11 +250,11 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRInt32 rv, err; PRInt32 bytesSent = 0; - while(bytesSent < amount ) + while(bytesSent < amount ) { - while ((rv = send( osfd, buf, amount, 0 )) == -1) + while ((rv = send( osfd, buf, amount, 0 )) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, WRITE_FD, timeout); @@ -262,8 +262,8 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { return -1; } - } - else + } + else { _PR_MD_MAP_SEND_ERROR(err); return -1; @@ -274,7 +274,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { break; } - if (bytesSent < amount) + if (bytesSent < amount) { rv = socket_io_wait(osfd, WRITE_FD, timeout); if ( rv < 0 ) @@ -296,9 +296,9 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, do { while ((rv = sendto( osfd, buf, amount, 0, (struct sockaddr *) addr, - addrlen)) == -1) + addrlen)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, WRITE_FD, timeout); @@ -306,8 +306,8 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { return -1; } - } - else + } + else { _PR_MD_MAP_SENDTO_ERROR(err); return -1; @@ -318,10 +318,10 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, { break; } - if (bytesSent < amount) + if (bytesSent < amount) { rv = socket_io_wait(osfd, WRITE_FD, timeout); - if (rv < 0) + if (rv < 0) { return -1; } @@ -510,18 +510,18 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRInt32 rv, err; while ((rv = recvfrom( osfd, buf, amount, 0, (struct sockaddr *) addr, - addrlen)) == -1) + addrlen)) == -1) { - if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) + if (((err = WSAGetLastError()) == WSAEWOULDBLOCK) && (!fd->secret->nonblocking)) { rv = socket_io_wait(osfd, READ_FD, timeout); if ( rv < 0) { return -1; - } - } - else + } + } + else { _PR_MD_MAP_RECVFROM_ERROR(err); break; @@ -537,12 +537,12 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTi int sent = 0; int rv; - for (index=0; index < iov_size; index++) + for (index=0; index < iov_size; index++) { rv = _PR_MD_SEND(fd, iov[index].iov_base, iov[index].iov_len, 0, timeout); - if (rv > 0) + if (rv > 0) sent += rv; - if ( rv != iov[index].iov_len ) + if ( rv != iov[index].iov_len ) { if (rv < 0) { @@ -651,7 +651,7 @@ _MD_MakeNonblock(PRFileDesc *f) #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5 static PRInt32 socket_io_wait( - PROsfd osfd, + PROsfd osfd, PRInt32 fd_type, PRIntervalTime timeout) { @@ -710,7 +710,7 @@ static PRInt32 socket_io_wait( len = sizeof(err); if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == SOCKET_ERROR) - { + { _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return -1; } @@ -790,7 +790,7 @@ static PRInt32 socket_io_wait( len = sizeof(err); if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == SOCKET_ERROR) - { + { _PR_MD_MAP_GETSOCKOPT_ERROR(WSAGetLastError()); return -1; } @@ -822,7 +822,7 @@ static PRInt32 socket_io_wait( if (wait_for_remaining) { elapsed = remaining; } else { - elapsed = PR_SecondsToInterval(tv.tv_sec) + elapsed = PR_SecondsToInterval(tv.tv_sec) + PR_MicrosecondsToInterval(tv.tv_usec); } if (elapsed >= remaining) { diff --git a/pr/src/md/windows/w95thred.c b/pr/src/md/windows/w95thred.c index a365411f..5b5a5a89 100644 --- a/pr/src/md/windows/w95thred.c +++ b/pr/src/md/windows/w95thred.c @@ -25,7 +25,7 @@ DWORD _pr_currentThreadIndex; DWORD _pr_lastThreadIndex; DWORD _pr_currentCPUIndex; #endif -int _pr_intsOff = 0; +int _pr_intsOff = 0; _PRInterruptTable _pr_interruptTable[] = { { 0 } }; typedef HRESULT (WINAPI *SETTHREADDESCRIPTION)(HANDLE, PCWSTR); @@ -138,12 +138,12 @@ pr_root(void *arg) return 0; } -PRStatus -_PR_MD_CREATE_THREAD(PRThread *thread, - void (*start)(void *), - PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, +PRStatus +_PR_MD_CREATE_THREAD(PRThread *thread, + void (*start)(void *), + PRThreadPriority priority, + PRThreadScope scope, + PRThreadState state, PRUint32 stackSize) { @@ -175,14 +175,14 @@ _PR_MD_CREATE_THREAD(PRThread *thread, return PR_FAILURE; } -void +void _PR_MD_YIELD(void) { /* Can NT really yield at all? */ Sleep(0); } -void +void _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri) { int nativePri; @@ -325,8 +325,8 @@ PRInt32 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask) #endif } -void -_PR_MD_SUSPEND_CPU(_PRCPU *cpu) +void +_PR_MD_SUSPEND_CPU(_PRCPU *cpu) { _PR_MD_SUSPEND_THREAD(cpu->thread); } diff --git a/pr/src/md/windows/win32_errors.c b/pr/src/md/windows/win32_errors.c index 27579218..b0118146 100644 --- a/pr/src/md/windows/win32_errors.c +++ b/pr/src/md/windows/win32_errors.c @@ -13,7 +13,7 @@ * - GetLastError(): for Win32 functions * - WSAGetLastError(): for Winsock functions * - errno: for standard C library functions - * + * * GetLastError() and WSAGetLastError() return error codes in * non-overlapping ranges, so their error codes (ERROR_* and * WSAE*) can be mapped by the same function. On the other hand, @@ -61,7 +61,7 @@ void _MD_win32_map_default_error(PRInt32 err) prError = PR_NOT_IMPLEMENTED_ERROR; break; case ERROR_DISK_CORRUPT: - prError = PR_IO_ERROR; + prError = PR_IO_ERROR; break; case ERROR_DISK_FULL: prError = PR_NO_DEVICE_SPACE_ERROR; @@ -518,7 +518,7 @@ void _MD_win32_map_gethostname_error(PRInt32 err) } /* Win32 select() only works on sockets. So in this -** context, WSAENOTSOCK is equivalent to EBADF on Unix. +** context, WSAENOTSOCK is equivalent to EBADF on Unix. */ void _MD_win32_map_select_error(PRInt32 err) { |