File: sys_openat.patch

package info (click to toggle)
cctools 1%3A7.14.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 36,956 kB
  • sloc: ansic: 114,614; python: 29,532; cpp: 20,313; sh: 13,675; perl: 4,056; xml: 3,688; makefile: 1,436
file content (60 lines) | stat: -rw-r--r-- 1,894 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Description: ARM64, etc. no longer support SYS_open, only SYS_openat.
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2024-12-03
Forwarded: no

Index: cctools-7.13.1/resource_monitor/src/rmonitor_helper.c
===================================================================
--- cctools-7.13.1.orig/resource_monitor/src/rmonitor_helper.c
+++ cctools-7.13.1/resource_monitor/src/rmonitor_helper.c
@@ -98,7 +98,7 @@ declare_original_dlsym(exit);
 declare_original_dlsym(_exit);
 declare_original_dlsym(waitpid);
 
-#if defined(__linux__) && defined(__USE_LARGEFILE64)
+#if defined(__linux__) && defined(__USE_LARGEFILE64) && !defined(__arm__)
 declare_original_dlsym(open64);
 #endif
 
@@ -129,7 +129,7 @@ void rmonitor_helper_initialize()
 	define_original_dlsym(_exit);
 	define_original_dlsym(waitpid);
 
-#if defined(__linux__) && defined(__USE_LARGEFILE64)
+#if defined(__linux__) && defined(__USE_LARGEFILE64) && !defined(__arm__)
 	define_original_dlsym(open64);
 #endif
 
@@ -298,7 +298,11 @@ int open(const char *path, int flags, ..
 	va_end(ap);
 
 	if (!original_open) {
+#ifdef SYS_openat
+		return syscall(SYS_openat, AT_FDCWD,  path, flags, mode);
+#else
 		return syscall(SYS_open, path, flags, mode);
+#endif
 	}
 
 	debug(D_RMON, "open %s from %d.\n", path, getpid());
@@ -326,7 +330,7 @@ int open(const char *path, int flags, ..
 	return fd;
 }
 
-#if defined(__linux__) && defined(__USE_LARGEFILE64)
+#if defined(__linux__) && defined(__USE_LARGEFILE64) && !defined(__arm__)
 
 int open64(const char *path, int flags, ...)
 {
@@ -341,7 +345,11 @@ int open64(const char *path, int flags,
 	va_end(ap);
 
 	if (!original_open64) {
+#ifdef SYS_openat
+		return syscall(SYS_openat, AT_FDCWD,  path, flags | O_LARGEFILE, mode);
+#else
 		return syscall(SYS_open, path, flags | O_LARGEFILE, mode);
+#endif
 	}
 
 	debug(D_RMON, "open64 %s from %d.\n", path, getpid());