Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: net/third_party/nss/ssl/sslmutex.c

Issue 3177012: Update to NSS 3.12.7. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/third_party/nss/ssl/sslgathr.c ('k') | net/third_party/nss/ssl/sslproto.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* ***** BEGIN LICENSE BLOCK ***** 1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 * 3 *
4 * The contents of this file are subject to the Mozilla Public License Version 4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with 5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at 6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/ 7 * http://www.mozilla.org/MPL/
8 * 8 *
9 * Software distributed under the License is distributed on an "AS IS" basis, 9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
(...skipping 15 matching lines...) Expand all
26 * in which case the provisions of the GPL or the LGPL are applicable instead 26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only 27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to 28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your 29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice 30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete 31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under 32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL. 33 * the terms of any one of the MPL, the GPL or the LGPL.
34 * 34 *
35 * ***** END LICENSE BLOCK ***** */ 35 * ***** END LICENSE BLOCK ***** */
36 /* $Id: sslmutex.c,v 1.24 2009/06/05 02:34:14 nelson%bolyard.com Exp $ */ 36 /* $Id: sslmutex.c,v 1.25 2010/04/03 18:27:33 nelson%bolyard.com Exp $ */
37 37
38 #include "seccomon.h" 38 #include "seccomon.h"
39 /* This ifdef should match the one in sslsnce.c */ 39 /* This ifdef should match the one in sslsnce.c */
40 #if defined(XP_UNIX) || defined(XP_WIN32) || defined (XP_OS2) || defined(XP_BEOS ) 40 #if defined(XP_UNIX) || defined(XP_WIN32) || defined (XP_OS2) || defined(XP_BEOS )
41 41
42 #include "sslmutex.h" 42 #include "sslmutex.h"
43 #include "prerr.h" 43 #include "prerr.h"
44 44
45 static SECStatus single_process_sslMutex_Init(sslMutex* pMutex) 45 static SECStatus single_process_sslMutex_Init(sslMutex* pMutex)
46 { 46 {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 PRInt32 newValue; 204 PRInt32 newValue;
205 if (PR_FALSE == pMutex->isMultiProcess) { 205 if (PR_FALSE == pMutex->isMultiProcess) {
206 return single_process_sslMutex_Unlock(pMutex); 206 return single_process_sslMutex_Unlock(pMutex);
207 } 207 }
208 208
209 if (pMutex->u.pipeStr.mPipes[2] != SSL_MUTEX_MAGIC) { 209 if (pMutex->u.pipeStr.mPipes[2] != SSL_MUTEX_MAGIC) {
210 PORT_SetError(PR_INVALID_ARGUMENT_ERROR); 210 PORT_SetError(PR_INVALID_ARGUMENT_ERROR);
211 return SECFailure; 211 return SECFailure;
212 } 212 }
213 /* Do Memory Barrier here. */ 213 /* Do Memory Barrier here. */
214 newValue = PR_AtomicDecrement(&pMutex->u.pipeStr.nWaiters); 214 newValue = PR_ATOMIC_DECREMENT(&pMutex->u.pipeStr.nWaiters);
215 if (newValue > 0) { 215 if (newValue > 0) {
216 int cc; 216 int cc;
217 char c = 1; 217 char c = 1;
218 do { 218 do {
219 cc = write(pMutex->u.pipeStr.mPipes[1], &c, 1); 219 cc = write(pMutex->u.pipeStr.mPipes[1], &c, 1);
220 } while (cc < 0 && (errno == EINTR || errno == EAGAIN)); 220 } while (cc < 0 && (errno == EINTR || errno == EAGAIN));
221 if (cc != 1) { 221 if (cc != 1) {
222 if (cc < 0) 222 if (cc < 0)
223 nss_MD_unix_map_default_error(errno); 223 nss_MD_unix_map_default_error(errno);
224 else 224 else
225 PORT_SetError(PR_UNKNOWN_ERROR); 225 PORT_SetError(PR_UNKNOWN_ERROR);
226 return SECFailure; 226 return SECFailure;
227 } 227 }
228 } 228 }
229 return SECSuccess; 229 return SECSuccess;
230 } 230 }
231 231
232 SECStatus 232 SECStatus
233 sslMutex_Lock(sslMutex *pMutex) 233 sslMutex_Lock(sslMutex *pMutex)
234 { 234 {
235 PRInt32 newValue; 235 PRInt32 newValue;
236 if (PR_FALSE == pMutex->isMultiProcess) { 236 if (PR_FALSE == pMutex->isMultiProcess) {
237 return single_process_sslMutex_Lock(pMutex); 237 return single_process_sslMutex_Lock(pMutex);
238 } 238 }
239 239
240 if (pMutex->u.pipeStr.mPipes[2] != SSL_MUTEX_MAGIC) { 240 if (pMutex->u.pipeStr.mPipes[2] != SSL_MUTEX_MAGIC) {
241 PORT_SetError(PR_INVALID_ARGUMENT_ERROR); 241 PORT_SetError(PR_INVALID_ARGUMENT_ERROR);
242 return SECFailure; 242 return SECFailure;
243 } 243 }
244 newValue = PR_AtomicIncrement(&pMutex->u.pipeStr.nWaiters); 244 newValue = PR_ATOMIC_INCREMENT(&pMutex->u.pipeStr.nWaiters);
245 /* Do Memory Barrier here. */ 245 /* Do Memory Barrier here. */
246 if (newValue > 1) { 246 if (newValue > 1) {
247 int cc; 247 int cc;
248 char c; 248 char c;
249 do { 249 do {
250 cc = read(pMutex->u.pipeStr.mPipes[0], &c, 1); 250 cc = read(pMutex->u.pipeStr.mPipes[0], &c, 1);
251 } while (cc < 0 && errno == EINTR); 251 } while (cc < 0 && errno == EINTR);
252 if (cc != 1) { 252 if (cc != 1) {
253 if (cc < 0) 253 if (cc < 0)
254 nss_MD_unix_map_default_error(errno); 254 nss_MD_unix_map_default_error(errno);
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 return single_process_sslMutex_Lock(pMutex); 654 return single_process_sslMutex_Lock(pMutex);
655 } 655 }
656 PORT_Assert(!("sslMutex_Lock not implemented for multi-process applications !")); 656 PORT_Assert(!("sslMutex_Lock not implemented for multi-process applications !"));
657 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); 657 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
658 return SECFailure; 658 return SECFailure;
659 } 659 }
660 660
661 #endif 661 #endif
662 662
663 #endif 663 #endif
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/sslgathr.c ('k') | net/third_party/nss/ssl/sslproto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698