1 /* |
1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
429 |
429 |
430 for (size_t remaining = sizeof(psinfo_t); remaining > 0;) { |
430 for (size_t remaining = sizeof(psinfo_t); remaining > 0;) { |
431 |
431 |
432 RESTARTABLE(::read(fd, addr, remaining), result); |
432 RESTARTABLE(::read(fd, addr, remaining), result); |
433 if (result == OS_ERR) { |
433 if (result == OS_ERR) { |
|
434 ::close(fd); |
434 THROW_MSG_0(vmSymbols::java_io_IOException(), "Read error"); |
435 THROW_MSG_0(vmSymbols::java_io_IOException(), "Read error"); |
|
436 } else { |
|
437 remaining-=result; |
|
438 addr+=result; |
435 } |
439 } |
436 remaining-=result; |
|
437 addr+=result; |
|
438 } |
440 } |
439 |
441 |
440 ::close(fd); |
442 ::close(fd); |
441 |
443 |
442 // get the user name for the effective user id of the process |
444 // get the user name for the effective user id of the process |
904 if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); |
906 if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); |
905 FREE_C_HEAP_ARRAY(char, dirname, mtInternal); |
907 FREE_C_HEAP_ARRAY(char, dirname, mtInternal); |
906 FREE_C_HEAP_ARRAY(char, filename, mtInternal); |
908 FREE_C_HEAP_ARRAY(char, filename, mtInternal); |
907 |
909 |
908 // open the shared memory file for the give vmid |
910 // open the shared memory file for the give vmid |
909 fd = open_sharedmem_file(rfilename, file_flags, CHECK); |
911 fd = open_sharedmem_file(rfilename, file_flags, THREAD); |
910 assert(fd != OS_ERR, "unexpected value"); |
912 |
|
913 if (fd == OS_ERR) { |
|
914 return; |
|
915 } |
|
916 |
|
917 if (HAS_PENDING_EXCEPTION) { |
|
918 ::close(fd); |
|
919 return; |
|
920 } |
911 |
921 |
912 if (*sizep == 0) { |
922 if (*sizep == 0) { |
913 size = sharedmem_filesize(fd, CHECK); |
923 size = sharedmem_filesize(fd, CHECK); |
914 } else { |
924 } else { |
915 size = *sizep; |
925 size = *sizep; |