20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
|
25 #include <fcntl.h> |
25 #include "precompiled.hpp" |
26 #include "precompiled.hpp" |
26 #include "compiler/compileBroker.hpp" |
27 #include "compiler/compileBroker.hpp" |
27 #include "gc_interface/collectedHeap.hpp" |
28 #include "gc_interface/collectedHeap.hpp" |
28 #include "prims/whitebox.hpp" |
29 #include "prims/whitebox.hpp" |
29 #include "runtime/arguments.hpp" |
30 #include "runtime/arguments.hpp" |
834 |
835 |
835 /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ |
836 /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ |
836 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { |
837 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { |
837 int fd = -1; |
838 int fd = -1; |
838 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { |
839 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { |
839 fd = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666); |
840 // the O_EXCL flag will cause the open to fail if the file exists |
|
841 fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666); |
840 } |
842 } |
841 return fd; |
843 return fd; |
842 } |
844 } |
843 |
845 |
844 /** |
846 /** |