[PATCH] D154419: [BOLT][Instrumentation][NFC] Define and use more syscall constants
Denis Revunov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 11:36:58 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG60bbddf3c12d: [BOLT][Instrumentation][NFC] Define and use more syscall constants (authored by treapster).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154419/new/
https://reviews.llvm.org/D154419
Files:
bolt/runtime/common.h
bolt/runtime/instr.cpp
Index: bolt/runtime/instr.cpp
===================================================================
--- bolt/runtime/instr.cpp
+++ bolt/runtime/instr.cpp
@@ -684,8 +684,7 @@
return TargetPath;
unsigned long CurAddr = (unsigned long)__get_pc();
- uint64_t FDdir = __open(DirPath,
- /*flags=*/0 /*O_RDONLY*/,
+ uint64_t FDdir = __open(DirPath, O_RDONLY,
/*mode=*/0666);
assert(static_cast<int64_t>(FDdir) >= 0,
"failed to open /proc/self/map_files");
@@ -720,15 +719,14 @@
char *BinPath = getBinaryPath();
assert(BinPath && BinPath[0] != '\0', "failed to find binary path");
- uint64_t FD = __open(BinPath,
- /*flags=*/0 /*O_RDONLY*/,
+ uint64_t FD = __open(BinPath, O_RDONLY,
/*mode=*/0666);
assert(static_cast<int64_t>(FD) >= 0, "failed to open binary path");
Result.FileDesc = FD;
// mmap our binary to memory
- uint64_t Size = __lseek(FD, 0, 2 /*SEEK_END*/);
+ uint64_t Size = __lseek(FD, 0, SEEK_END);
uint8_t *BinContents = reinterpret_cast<uint8_t *>(
__mmap(0, Size, PROT_READ, MAP_PRIVATE, FD, 0));
assert(BinContents != MAP_FAILED, "readDescriptions: Failed to mmap self!");
@@ -1470,8 +1468,7 @@
Ptr = strCopy(Ptr, ".fdata", BufSize - (Ptr - Buf + 1));
}
*Ptr++ = '\0';
- uint64_t FD = __open(Buf,
- /*flags=*/0x241 /*O_WRONLY|O_TRUNC|O_CREAT*/,
+ uint64_t FD = __open(Buf, O_WRONLY | O_TRUNC | O_CREAT,
/*mode=*/0666);
if (static_cast<int64_t>(FD) < 0) {
report("Error while trying to open profile file for writing: ");
Index: bolt/runtime/common.h
===================================================================
--- bolt/runtime/common.h
+++ bolt/runtime/common.h
@@ -106,6 +106,17 @@
#define MAP_FAILED ((void *)-1)
+#define SEEK_SET 0 /* Seek from beginning of file. */
+#define SEEK_CUR 1 /* Seek from current position. */
+#define SEEK_END 2 /* Seek from end of file. */
+
+#define O_RDONLY 0
+#define O_WRONLY 1
+#define O_RDWR 2
+#define O_CREAT 64
+#define O_TRUNC 512
+#define O_APPEND 1024
+
// Functions that are required by freestanding environment. Compiler may
// generate calls to these implicitly.
extern "C" {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154419.538752.patch
Type: text/x-patch
Size: 2278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230710/e155f9ae/attachment.bin>
More information about the llvm-commits
mailing list