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> |
|
26 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
27 #include "compiler/compileBroker.hpp" |
26 #include "compiler/compileBroker.hpp" |
28 #include "gc_interface/collectedHeap.hpp" |
27 #include "gc_interface/collectedHeap.hpp" |
29 #include "prims/whitebox.hpp" |
28 #include "prims/whitebox.hpp" |
30 #include "runtime/arguments.hpp" |
29 #include "runtime/arguments.hpp" |
840 |
839 |
841 /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ |
840 /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ |
842 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { |
841 static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { |
843 int fd = -1; |
842 int fd = -1; |
844 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { |
843 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { |
845 // the O_EXCL flag will cause the open to fail if the file exists |
844 fd = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0666); |
846 fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666); |
|
847 } |
845 } |
848 return fd; |
846 return fd; |
849 } |
847 } |
850 |
848 |
851 /** |
849 /** |