-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
``` | Package | Update | Change | |---|---|---| | git://git.kernel.org/pub/scm/git/git.git | patch | `2.47.0` -> `2.47.1` | | git://git.kernel.org/pub/scm/libs/libcap/libcap.git | minor | `2.71` -> `2.72` | | git://git.savannah.gnu.org/libtool.git | patch | `2.5.3` -> `2.5.4` | | [protocolbuffers/protobuf-go](https://redirect.github.com/protocolbuffers/protobuf-go) | patch | `v1.35.1` -> `v1.35.2` | | [systemd/systemd](https://redirect.github.com/systemd/systemd) | minor | `256.7` -> `256.8` | ``` Signed-off-by: Andrey Smirnov <[email protected]>
- Loading branch information
Showing
3 changed files
with
85 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
From 304089b078f2f339cd7ccb030a0ad0194aea0a0f Mon Sep 17 00:00:00 2001 | ||
From: Xi Ruoyao <[email protected]> | ||
Date: Tue, 12 Nov 2024 11:44:56 +0800 | ||
Subject: psx: use getdents64 instead of getdents | ||
|
||
On relatively new architectures (for example ARM64, RISC-V, and | ||
LoongArch), the kernel does not have a getdents syscall. Use getdents64 | ||
instead to fix the build on them. | ||
|
||
The getdents64 syscall was added in Linux 2.4 and I don't think we | ||
should still support older kernels today. | ||
|
||
Signed-off-by: Xi Ruoyao <[email protected]> | ||
Signed-off-by: Andrew G. Morgan <[email protected]> | ||
--- | ||
psx/psx.c | 15 ++++++++------- | ||
1 file changed, 8 insertions(+), 7 deletions(-) | ||
|
||
diff --git a/psx/psx.c b/psx/psx.c | ||
index d66a7bf..bf7d69f 100644 | ||
--- a/psx/psx.c | ||
+++ b/psx/psx.c | ||
@@ -410,10 +410,11 @@ static long int __psx_immediate_syscall(long int syscall_nr, | ||
|
||
#define BUF_SIZE 4096 | ||
|
||
-struct psx_linux_dirent { | ||
- unsigned long d_ino; | ||
- off_t d_off; | ||
+struct psx_linux_dirent64 { | ||
+ long long d_ino; | ||
+ long long d_off; | ||
unsigned short d_reclen; | ||
+ unsigned char d_type; | ||
char d_name[]; | ||
}; | ||
|
||
@@ -486,11 +487,11 @@ long int __psx_syscall(long int syscall_nr, ...) { | ||
|
||
for (;;) { | ||
char buf[BUF_SIZE]; | ||
- size_t nread = syscall(SYS_getdents, fd, buf, BUF_SIZE); | ||
+ size_t nread = syscall(SYS_getdents64, fd, buf, BUF_SIZE); | ||
if (nread == 0) { | ||
break; | ||
} else if (nread < 0) { | ||
- perror("getdents failed"); | ||
+ perror("getdents64 failed"); | ||
kill(psx_tracker.pid, SIGKILL); | ||
} | ||
|
||
@@ -499,10 +500,10 @@ long int __psx_syscall(long int syscall_nr, ...) { | ||
for (offset = 0; offset < nread; offset += reclen) { | ||
/* deal with potential unaligned reads */ | ||
memcpy(&reclen, buf + offset + | ||
- offsetof(struct psx_linux_dirent, d_reclen), | ||
+ offsetof(struct psx_linux_dirent64, d_reclen), | ||
sizeof(reclen)); | ||
char *dir = (buf + offset + | ||
- offsetof(struct psx_linux_dirent, d_name)); | ||
+ offsetof(struct psx_linux_dirent64, d_name)); | ||
long tid = atoi(dir); | ||
if (tid == 0 || tid == self) { | ||
continue; | ||
-- | ||
cgit 1.2.3-korg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters