summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-12-07 20:35:16 +0100
committerMattias Andrée <maandree@kth.se>2023-12-07 20:35:16 +0100
commit225f1408e03f2e66198f3da20c42a746e2729ab0 (patch)
treeebd6bd4b576c85159e852103ce21d4515484d853 /linux
parentThird commit (diff)
downloadlibsyscalls-225f1408e03f2e66198f3da20c42a746e2729ab0.tar.gz
libsyscalls-225f1408e03f2e66198f3da20c42a746e2729ab0.tar.bz2
libsyscalls-225f1408e03f2e66198f3da20c42a746e2729ab0.tar.xz
Fourth commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'linux')
-rw-r--r--linux/integers.c21
-rw-r--r--linux/integers.mk4
-rw-r--r--linux/linux-support.mk2
-rw-r--r--linux/syscalls.h14
-rw-r--r--linux/tests/os-dependent-integers4
-rwxr-xr-xlinux/what-architecture-am-i-using7
6 files changed, 45 insertions, 7 deletions
diff --git a/linux/integers.c b/linux/integers.c
new file mode 100644
index 0000000..469ede0
--- /dev/null
+++ b/linux/integers.c
@@ -0,0 +1,21 @@
+/* See LICENSE file for copyright and license details. */
+
+/* This file is included from ../libsyscalls_get_integer_alignment.c */
+
+
+#if 0
+static enum libsyscalls_error
+get_linux_integer_alignment(enum libsyscalls_arch arch, unsigned width_in_bits, unsigned *alignmentp)
+{
+ /* ../libsyscalls_get_integer_alignment.c has already set `*alignmentp`
+ * according the the architectures specifications. Linux does not proscribe
+ * excess alignment and there is thus nothing for this function to do. */
+
+ (void) arch;
+ (void) width_in_bits;
+ (void) alignmentp;
+ return LIBSYSCALLS_E_OK;
+}
+#else
+# define get_linux_integer_alignment(arch, width_in_bits, alignmentp) (LIBSYSCALLS_E_OK)
+#endif
diff --git a/linux/integers.mk b/linux/integers.mk
new file mode 100644
index 0000000..93dacfd
--- /dev/null
+++ b/linux/integers.mk
@@ -0,0 +1,4 @@
+# See LICENSE file for copyright and license details.
+
+libsyscalls_get_integer_alignment.o: linux/integers.c
+libsyscalls_get_integer_alignment.lo: linux/integers.c
diff --git a/linux/linux-support.mk b/linux/linux-support.mk
index d596922..c4a3f94 100644
--- a/linux/linux-support.mk
+++ b/linux/linux-support.mk
@@ -33,6 +33,7 @@ SUPPORTED_LINUX_ARCHES =\
OPERATING_SYSTEMS += linux
NPARAMS += 8
+NFIELDS += 60
SUPPORTED_LINUX_ARCHES != printf '%s\n' $(SUPPORTED_LINUX_ARCHES) $(SUPPORTED_ARCHES) | sort | uniq -d
@@ -42,6 +43,7 @@ TEST_ENV += SUPPORTED_LINUX_ARCHES="$(SUPPORTED_LINUX_ARCHES)"
include linux/download.mk
include linux/errors.mk
+include linux/integers.mk
include linux/signals.mk
include linux/syscalls.mk
include linux/syscall-table.mk
diff --git a/linux/syscalls.h b/linux/syscalls.h
index ed278cd..e11120f 100644
--- a/linux/syscalls.h
+++ b/linux/syscalls.h
@@ -258,8 +258,8 @@ SYS(sys_stat, FILESYSTEM, STAT, 2, ZERO(INT), PARAMS(_,STRING, OUT,STRUCT_OLD_ST
SYS(sys_newfstat, FILE_DESCRIPTORS, STAT, 2, ZERO(INT), PARAMS(_,INT_FD, OUT,STRUCT_STAT));
SYS(sys_fstat64, FILE_DESCRIPTORS, STAT, 2, ZERO(INT), PARAMS(_,LONG_FD, OUT,STRUCT_STAT64));
SYS(sys_fstat, FILE_DESCRIPTORS, STAT, 2, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_OLD_STAT));
-SYS(sys_pipe, FILE_DESCRIPTORS, CREATE, 1, ZERO(INT), PARAMS(OUT,2_INTS_FD));
-SYS(sys_alpha_pipe, FILE_DESCRIPTORS, CREATE, 0, 2_INTS_FD, PARAMS());
+SYS(sys_pipe, IPC, CREATE, 1, ZERO(INT), PARAMS(OUT,2_INTS_FD));
+SYS(sys_alpha_pipe, IPC, CREATE, 0, 2_INTS_FD, PARAMS());
SYS(sys_readlink, FILESYSTEM, READLINK, 3, INT, PARAMS(_,STRING, OUT,BUFFER, _,INT));
SYS(sys_munlockall, MEMORY, UNLOCK, 0, ZERO(INT), PARAMS());
SYS(sys_munlock, MEMORY, UNLOCK, 2, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE));
@@ -284,7 +284,7 @@ SYS(sys_mq_timedreceive_time32, IPC, COMMUNICATE_WITH_ABSOLUTE_TIMEOUT, 5, SSIZE
SYS(sys_vhangup, PROCESSES, SESSION, 0, ZERO(INT), PARAMS());
SYS(sys_setsid, PROCESSES, SESSION, 0, INT, PARAMS());
SYS(sys_setpgid, PROCESSES, SESSION, 2, INT, PARAMS(_,INT, _,INT));
-SYS(sys_sched_yield, SCHEDULING, YEILD, 0, ZERO(INT), PARAMS());
+SYS(sys_sched_yield, SCHEDULING, YIELD, 0, ZERO(INT), PARAMS());
SYS(sys_sched_setparam, SCHEDULING, SET, 2, ZERO(INT), PARAMS(_,INT, IN,STRUCT_SCHED_PARAM));
SYS(sys_sched_getparam, SCHEDULING, GET, 2, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_SCHED_PARAM));
SYS(sys_sched_rr_get_interval, SCHEDULING, GET, 2, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_TIMESPEC));
@@ -339,7 +339,7 @@ SYS(sys_umount, FILESYSTEM, MOUNTPOINT, 2, ZERO(INT), PARAMS(_,STRING, SYM,UINT)
SYS(sys_msync, FILESYSTEM, SYNC, 3, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE, SYM,UINT), SYMBOLS(MSYNC));
SYS(sys_madvise, MEMORY, WRITE_OR_ADVISE, 3, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE, SYM,INT), SYMBOLS(MADVISE));
SYS(sys_epoll_create1, FILE_DESCRIPTORS, CREATE_POLL, 1, INT_FD, PARAMS(SYM,UINT), SYMBOLS(EPOLL));
-SYS(sys_epoll_ctl, FILE_DESCRIPTORS, CREATE_POLL, 4, ZERO(INT), PARAMS(_,INT_FD, SYM,INT, _,INT, IN,STRUCT_EPOLL_EVENT), SYMBOLS(EPOLL_CTL));
+SYS(sys_epoll_ctl, FILE_DESCRIPTORS, CONFIGURE_POLL, 4, ZERO(INT), PARAMS(_,INT_FD, SYM,INT, _,INT, IN,STRUCT_EPOLL_EVENT), SYMBOLS(EPOLL_CTL));
SYS(sys_accept4, NETWORK_ENABLED_IPC, ACCEPT, 4, INT_FD, PARAMS(_,INT_FD, OUT,STRUCT_SOCKADDR, OUT,INT, _,UINT), SYMBOLS(SOCK_FD));
SYS(sys_clock_nanosleep, TIME, SLEEP, 4, ZERO(INT), PARAMS(SYM,INT, SYM,UINT, IN,STRUCT_TIMESPEC, OUT,STRUCT_TIMESPEC), SYMBOLS(CLOCKID, TIMER));
SYS(sys_clock_nanosleep_time32, TIME, SLEEP, 4, ZERO(INT), PARAMS(SYM,INT, SYM,UINT, IN,STRUCT_OLD_TIMESPEC32, OUT,STRUCT_OLD_TIMESPEC32), SYMBOLS(CLOCKID, TIMER));
@@ -376,7 +376,7 @@ SYS(sys_shmat, IPC, ATTACH, 3, MEMORY_ADDRESS, PARAMS(_,INT, _,MEMORY_ADDRESS, S
SYS(sys_faccessat2, FILESYSTEM, STAT, 4, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING,SYM,UINT, SYM,UINT), SYMBOLS(FACCESSAT, FACCESSAT2));
SYS(sys_fsopen, FILESYSTEM, MOUNTPOINT, 2, INT_FD, PARAMS(_,STRING, SYM,UINT), SYMBOLS(FSOPEN));
SYS(sys_statx, FILESYSTEM, STAT, 5, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,UINT, SYM,UINT, OUT,STRUCT_STATX), SYMBOLS(3STATX));
-SYS(sys_pipe2, FILE_DESCRIPTORS, CREATE, 2, ZERO(INT), PARAMS(OUT,2_INTS_FD, SYM,UINT), SYMBOLS(PIPE));
+SYS(sys_pipe2, IPC, CREATE, 2, ZERO(INT), PARAMS(OUT,2_INTS_FD, SYM,UINT), SYMBOLS(PIPE));
SYS(sys_getrandom, SYSTEM, RANDOM, 3, SSIZE, PARAMS(OUT,BUFFER, _,SIZE, SYM,UINT), SYMBOLS(GRND));
SYS(sys_inotify_init1, FILESYSTEM, MONITOR, 1, INT_FD, PARAMS(SYM,UINT), SYMBOLS(INOTIFY_FD));
SYS(sys_inotify_add_watch, FILESYSTEM, MONITOR, 3, INT32, PARAMS(_,INT_FD, _,STRING, SYM,UINT32), SYMBOLS(INOTIFY_MASK));
@@ -388,8 +388,8 @@ SYS(sys_msgsnd, IPC, COMMUNICATE, 4, ZERO(SSIZE), PARAMS(_,INT, OUT,STRUCT_MSGBU
SYS(sys_fanotify_mark, FILESYSTEM, MONITOR, 5, ZERO(INT), PARAMS(_,INT_FD, SYM,UINT, SYM,UINT64, SYM,INT_ATFD, _,STRING), SYMBOLS(FANOTIFY_MARK, ATFD));
SYS(sys_mq_open, IPC, CONTROL, 4, INT_FD, PARAMS(_,STRING, SYM,UINT, SYM,USHORT, IN,STRUCT_MQ_ATTR), SYMBOLS(MQ_OPEN, MODE));
SYS(sys_fanotify_init, FILESYSTEM, MONITOR, 2, INT_FD, PARAMS(SYM,UINT, SYM,UINT), SYMBOLS(FAN_CLASS, FAN_EVENT_F));
-SYS(sys_socket, FILE_DESCRIPTORS, CREATE, 3, INT_FD, PARAMS(SYM,INT, SYM,UINT, SYM,UINT), SYMBOLS(SOCKET));
-SYS(sys_socketpair, FILE_DESCRIPTORS, CREATE, 4, ZERO(INT), PARAMS(SYM,INT, SYM,UINT, SYM,UINT, OUT,2_INTS_FD), SYMBOLS(SOCKET));
+SYS(sys_socket, NETWORK_ENABLED_IPC, CREATE, 3, INT_FD, PARAMS(SYM,INT, SYM,UINT, SYM,UINT), SYMBOLS(SOCKET));
+SYS(sys_socketpair, IPC, CREATE, 4, ZERO(INT), PARAMS(SYM,INT, SYM,UINT, SYM,UINT, OUT,2_INTS_FD), SYMBOLS(SOCKET));
SYS(sys_epoll_wait, FILE_DESCRIPTORS, POLL, 4, INT, PARAMS(_,INT_FD, OUT,STRUCT_EPOLL_EVENT_ARRAY, _,INT, _,INT));
SYS(sys_epoll_pwait, FILE_DESCRIPTORS, POLL, 6, INT, PARAMS(_,INT_FD, OUT,STRUCT_EPOLL_EVENT_ARRAY, _,INT, _,INT, IN,ULONG_ARRAY, _,SIZE));
SYS(sys_epoll_pwait2, FILE_DESCRIPTORS, POLL, 6, INT, PARAMS(_,INT_FD, OUT,STRUCT_EPOLL_EVENT_ARRAY, _,INT, IN,STRUCT_TIMESPEC, IN,ULONG_ARRAY, _,SIZE));
diff --git a/linux/tests/os-dependent-integers b/linux/tests/os-dependent-integers
new file mode 100644
index 0000000..73de229
--- /dev/null
+++ b/linux/tests/os-dependent-integers
@@ -0,0 +1,4 @@
+# -*- sh -*-
+# See LICENSE file for copyright and license details.
+
+. tests/default-integers
diff --git a/linux/what-architecture-am-i-using b/linux/what-architecture-am-i-using
index 1c7a9ba..646c9e7 100755
--- a/linux/what-architecture-am-i-using
+++ b/linux/what-architecture-am-i-using
@@ -9,6 +9,13 @@ if uname -s | grep -i linux > /dev/null; then
if test "$arch" = x86_64; then
printf '%s\n' AMD64
if test $# = 0 || "$@"; then
+ if test ! -f /proc/config.gz; then
+ printf '%s\n' '/proc/config.gz is missing' >&2
+ exit 1
+ elif test ! -r /proc/config.gz; then
+ printf '%s\n' '/proc/config.gz is not readable' >&2
+ exit 1
+ fi
if test $# = 0 || gunzip < /proc/config.gz | grep '^CONFIG_X86_X32_ABI=y$' > /dev/null; then
printf '%s\n' AMD64_X32
fi