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

Side by Side Diff: nspr/pr/src/md/unix/unix.c

Issue 170823003: Update to NSS 3.15.5 and NSPR 4.10.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 6 years, 10 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 | « nspr/pr/src/io/prmmap.c ('k') | nspr/pr/src/md/windows/ntmisc.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public 2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 5
6 #include "primpl.h" 6 #include "primpl.h"
7 7
8 #include <string.h> 8 #include <string.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after
3607 _PR_MD_MAP_MMAP_ERROR(_MD_ERRNO()); 3607 _PR_MD_MAP_MMAP_ERROR(_MD_ERRNO());
3608 addr = NULL; 3608 addr = NULL;
3609 } 3609 }
3610 return addr; 3610 return addr;
3611 } 3611 }
3612 3612
3613 PRStatus _MD_MemUnmap(void *addr, PRUint32 len) 3613 PRStatus _MD_MemUnmap(void *addr, PRUint32 len)
3614 { 3614 {
3615 if (munmap(addr, len) == 0) { 3615 if (munmap(addr, len) == 0) {
3616 return PR_SUCCESS; 3616 return PR_SUCCESS;
3617 } else {
3618 if (errno == EINVAL) {
3619 PR_SetError(PR_INVALID_ARGUMENT_ERROR, errno);
3620 } else {
3621 PR_SetError(PR_UNKNOWN_ERROR, errno);
3622 } 3617 }
3623 return PR_FAILURE; 3618 _PR_MD_MAP_DEFAULT_ERROR(errno);
3624 } 3619 return PR_FAILURE;
3625 } 3620 }
3626 3621
3627 PRStatus _MD_CloseFileMap(PRFileMap *fmap) 3622 PRStatus _MD_CloseFileMap(PRFileMap *fmap)
3628 { 3623 {
3629 if ( PR_TRUE == fmap->md.isAnonFM ) { 3624 if ( PR_TRUE == fmap->md.isAnonFM ) {
3630 PRStatus rc = PR_Close( fmap->fd ); 3625 PRStatus rc = PR_Close( fmap->fd );
3631 if ( PR_FAILURE == rc ) { 3626 if ( PR_FAILURE == rc ) {
3632 PR_LOG( _pr_io_lm, PR_LOG_DEBUG, 3627 PR_LOG( _pr_io_lm, PR_LOG_DEBUG,
3633 ("_MD_CloseFileMap(): error closing anonymnous file map osfd")); 3628 ("_MD_CloseFileMap(): error closing anonymnous file map osfd"));
3634 return PR_FAILURE; 3629 return PR_FAILURE;
3635 } 3630 }
3636 } 3631 }
3637 PR_DELETE(fmap); 3632 PR_DELETE(fmap);
3638 return PR_SUCCESS; 3633 return PR_SUCCESS;
3639 } 3634 }
3640 3635
3636 PRStatus _MD_SyncMemMap(
3637 PRFileDesc *fd,
3638 void *addr,
3639 PRUint32 len)
3640 {
3641 /* msync(..., MS_SYNC) alone is sufficient to flush modified data to disk
3642 * synchronously. It is not necessary to call fsync. */
3643 if (msync(addr, len, MS_SYNC) == 0) {
3644 return PR_SUCCESS;
3645 }
3646 _PR_MD_MAP_DEFAULT_ERROR(errno);
3647 return PR_FAILURE;
3648 }
3649
3641 #if defined(_PR_NEED_FAKE_POLL) 3650 #if defined(_PR_NEED_FAKE_POLL)
3642 3651
3643 /* 3652 /*
3644 * Some platforms don't have poll(). For easier porting of code 3653 * Some platforms don't have poll(). For easier porting of code
3645 * that calls poll(), we emulate poll() using select(). 3654 * that calls poll(), we emulate poll() using select().
3646 */ 3655 */
3647 3656
3648 int poll(struct pollfd *filedes, unsigned long nfds, int timeout) 3657 int poll(struct pollfd *filedes, unsigned long nfds, int timeout)
3649 { 3658 {
3650 int i; 3659 int i;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 rv++; 3774 rv++;
3766 } 3775 }
3767 } 3776 }
3768 PR_ASSERT(rv > 0); 3777 PR_ASSERT(rv > 0);
3769 } 3778 }
3770 PR_ASSERT(-1 != timeout || rv != 0); 3779 PR_ASSERT(-1 != timeout || rv != 0);
3771 3780
3772 return rv; 3781 return rv;
3773 } 3782 }
3774 #endif /* _PR_NEED_FAKE_POLL */ 3783 #endif /* _PR_NEED_FAKE_POLL */
OLDNEW
« no previous file with comments | « nspr/pr/src/io/prmmap.c ('k') | nspr/pr/src/md/windows/ntmisc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698