Skip to content

Commit 8de1683

Browse files
committed
Fix ARM64 symbol file opens
1 parent 5126b14 commit 8de1683

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

‎src/sym/bcc_elf.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <errno.h>
2020
#include <fcntl.h>
2121
#include <unistd.h>
22-
#include <sys/syscall.h>
2322
#include <string.h>
2423
#include <libgen.h>
2524
#include <stdio.h>
@@ -142,7 +141,7 @@ static int bcc_elf_file_open(const char *path, struct bcc_elf_file *out) {
142141
struct bcc_zip_entry entry;
143142
int fd = -1;
144143

145-
fd = syscall(SYS_open, path, O_RDONLY, 0);
144+
fd = open(path, O_RDONLY);
146145
if (fd >= 0) {
147146
if (bcc_elf_file_open_fd(fd, out)) {
148147
close(fd);
@@ -601,7 +600,7 @@ static int verify_checksum(const char *file, unsigned int crc) {
601600
unsigned int actual;
602601

603602

604-
fd = syscall(SYS_open, file, O_RDONLY, 0);
603+
fd = open(file, O_RDONLY);
605604
if (fd < 0)
606605
return 0;
607606

‎src/sym/bcc_syms.cc‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <sys/sysmacros.h>
2727
#include <sys/types.h>
2828
#include <unistd.h>
29-
#include <sys/syscall.h>
3029

3130
#include <cstdio>
3231
#include <cstring>
@@ -56,7 +55,7 @@ ProcSyms::ModulePath::ModulePath(const std::string &ns_path, int root_fd,
5655
;
5756
trimmed_path = ns_path.substr(non_slash_pos);
5857

59-
int fd_ = syscall(SYS_openat, root_fd, trimmed_path.c_str(), O_RDONLY);
58+
fd_ = openat(root_fd, trimmed_path.c_str(), O_RDONLY);
6059
if (fd_ > 0)
6160
path_ = tfm::format("/proc/self/fd/%d", fd_);
6261
else
@@ -93,7 +92,7 @@ bool ProcStat::refresh_root() {
9392
// re-open root note: when /proc/.../root changes, the open file descriptor
9493
// still refers to the old one
9594
int original_root_fd = root_fd_;
96-
int root_fd_ = syscall(SYS_open, root_symlink_.c_str(), O_PATH);
95+
root_fd_ = open(root_symlink_.c_str(), O_PATH);
9796
if (root_fd_ == -1)
9897
std::cerr << "Opening " << root_symlink_ << " failed: " << strerror(errno)
9998
<< std::endl;

‎src/sym/bcc_zip.cpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <string.h>
2424
#include <sys/mman.h>
2525
#include <unistd.h>
26-
#include <sys/syscall.h>
2726

2827
// Specification of ZIP file format can be found here:
2928
// https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
@@ -214,7 +213,7 @@ static int find_central_directory(struct bcc_zip_archive* archive) {
214213
}
215214

216215
struct bcc_zip_archive* bcc_zip_archive_open(const char* path) {
217-
int fd = syscall(SYS_open, path, O_RDONLY, 0);
216+
int fd = open(path, O_RDONLY);
218217
if (fd < 0) {
219218
return NULL;
220219
}

0 commit comments

Comments
 (0)