equal
deleted
inserted
replaced
120 } |
120 } |
121 remaining -= (size_t)result; |
121 remaining -= (size_t)result; |
122 addr += result; |
122 addr += result; |
123 } |
123 } |
124 |
124 |
125 RESTARTABLE(::close(fd), result); |
125 result = ::close(fd); |
126 if (PrintMiscellaneous && Verbose) { |
126 if (PrintMiscellaneous && Verbose) { |
127 if (result == OS_ERR) { |
127 if (result == OS_ERR) { |
128 warning("Could not close %s: %s\n", destfile, strerror(errno)); |
128 warning("Could not close %s: %s\n", destfile, strerror(errno)); |
129 } |
129 } |
130 } |
130 } |
435 } |
435 } |
436 remaining-=result; |
436 remaining-=result; |
437 addr+=result; |
437 addr+=result; |
438 } |
438 } |
439 |
439 |
440 RESTARTABLE(::close(fd), result); |
440 ::close(fd); |
441 |
441 |
442 // get the user name for the effective user id of the process |
442 // get the user name for the effective user id of the process |
443 char* user_name = get_user_name(psinfo.pr_euid); |
443 char* user_name = get_user_name(psinfo.pr_euid); |
444 |
444 |
445 return user_name; |
445 return user_name; |
667 RESTARTABLE(::ftruncate(fd, (off_t)size), result); |
667 RESTARTABLE(::ftruncate(fd, (off_t)size), result); |
668 if (result == OS_ERR) { |
668 if (result == OS_ERR) { |
669 if (PrintMiscellaneous && Verbose) { |
669 if (PrintMiscellaneous && Verbose) { |
670 warning("could not set shared memory file size: %s\n", strerror(errno)); |
670 warning("could not set shared memory file size: %s\n", strerror(errno)); |
671 } |
671 } |
672 RESTARTABLE(::close(fd), result); |
672 ::close(fd); |
673 return -1; |
673 return -1; |
674 } |
674 } |
675 |
675 |
676 return fd; |
676 return fd; |
677 } |
677 } |
747 return NULL; |
747 return NULL; |
748 } |
748 } |
749 |
749 |
750 mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); |
750 mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); |
751 |
751 |
752 // attempt to close the file - restart it if it was interrupted, |
752 result = ::close(fd); |
753 // but ignore other failures |
|
754 RESTARTABLE(::close(fd), result); |
|
755 assert(result != OS_ERR, "could not close file"); |
753 assert(result != OS_ERR, "could not close file"); |
756 |
754 |
757 if (mapAddress == MAP_FAILED) { |
755 if (mapAddress == MAP_FAILED) { |
758 if (PrintMiscellaneous && Verbose) { |
756 if (PrintMiscellaneous && Verbose) { |
759 warning("mmap failed - %s\n", strerror(errno)); |
757 warning("mmap failed - %s\n", strerror(errno)); |
920 |
918 |
921 assert(size > 0, "unexpected size <= 0"); |
919 assert(size > 0, "unexpected size <= 0"); |
922 |
920 |
923 mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); |
921 mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); |
924 |
922 |
925 // attempt to close the file - restart if it gets interrupted, |
923 result = ::close(fd); |
926 // but ignore other failures |
|
927 RESTARTABLE(::close(fd), result); |
|
928 assert(result != OS_ERR, "could not close file"); |
924 assert(result != OS_ERR, "could not close file"); |
929 |
925 |
930 if (mapAddress == MAP_FAILED) { |
926 if (mapAddress == MAP_FAILED) { |
931 if (PrintMiscellaneous && Verbose) { |
927 if (PrintMiscellaneous && Verbose) { |
932 warning("mmap failed: %s\n", strerror(errno)); |
928 warning("mmap failed: %s\n", strerror(errno)); |