Skip to content

Commit

Permalink
gpkg/glibc: experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Jan 1, 2024
1 parent 24496e0 commit 50e7cf9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
7 changes: 0 additions & 7 deletions gpkg/glibc/ignore-syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,4 @@ static struct IdSyscalls ListIgnoreSyscall[] = {

#define count_ignore_syscall (sizeof(ListIgnoreSyscall) / sizeof(ListIgnoreSyscall[0]))

static int is_ignore_syscall(int id) {
for (int i=0; i<count_ignore_syscall; ++i)
if (ListIgnoreSyscall[i].id == id)
return 1;
return 0;
}

#endif //_IGNORE_SYSCALL
28 changes: 20 additions & 8 deletions gpkg/glibc/syscall.c.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- src/sysdeps/unix/sysv/linux/syscall.c 2023-07-31 20:54:16.000000000 +0300
+++ src/sysdeps/unix/sysv/linux/syscall.c.patch 2023-12-25 23:09:19.195827394 +0300
@@ -18,10 +18,14 @@
--- glibc-2.38/sysdeps/unix/sysv/linux/syscall.c 2023-07-31 20:54:16.000000000 +0300
+++ glibc-2.38/sysdeps/unix/sysv/linux/syscall.c.patch 2024-01-01 13:12:45.120508427 +0300
@@ -18,26 +18,26 @@

#include <stdarg.h>
#include <sysdep.h>
Expand All @@ -9,14 +9,26 @@
long int
syscall (long int number, ...)
{
+ if (is_ignore_syscall(number))
+ return 0;
+ for (int i=0; i<count_ignore_syscall; ++i)
+ if (ListIgnoreSyscall[i].id == number)
+ return 0;
+
va_list args;

va_start (args, number);
@@ -33,11 +37,5 @@
long int a5 = va_arg (args, long int);
- long int a0 = va_arg (args, long int);
- long int a1 = va_arg (args, long int);
- long int a2 = va_arg (args, long int);
- long int a3 = va_arg (args, long int);
- long int a4 = va_arg (args, long int);
- long int a5 = va_arg (args, long int);
+ long int res = syscallS (number,
+ va_arg (args, long int),
+ va_arg (args, long int),
+ va_arg (args, long int),
+ va_arg (args, long int),
+ va_arg (args, long int),
+ va_arg (args, long int));
va_end (args);

- long int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5);
Expand All @@ -26,5 +38,5 @@
- return -1;
- }
- return r;
+ return syscallS (number, a0, a1, a2, a3, a4, a5);
+ return res;
}
10 changes: 0 additions & 10 deletions gpkg/glibc/unistd.h.patch

This file was deleted.

0 comments on commit 50e7cf9

Please sign in to comment.