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" |
803 |
804 |
804 /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ |
805 /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ |
805 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { |
806 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { |
806 int fd = -1; |
807 int fd = -1; |
807 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { |
808 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { |
808 fd = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666); |
809 // the O_EXCL flag will cause the open to fail if the file exists |
|
810 fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666); |
809 } |
811 } |
810 return fd; |
812 return fd; |
811 } |
813 } |
812 |
814 |
813 /** |
815 /** |