public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: [PATCH 19/28] linux: Add fanotify_mark C implementation
Date: Wed, 18 Nov 2020 16:55:43 -0300	[thread overview]
Message-ID: <20201118195552.2687336-20-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20201118195552.2687336-1-adhemerval.zanella@linaro.org>

Passing 64-bit arguments on syscalls.list is tricky: it requires
to reimplement the expected kernel abi in each architecture.  This
is way to better to represent in C code where we already have
macros for this (SYSCALL_LL64).

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 --
 sysdeps/unix/sysv/linux/fanotify_mark.c       | 36 +++++++++++++++++++
 .../linux/generic/wordsize-32/syscalls.list   |  1 -
 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c  |  2 ++
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  1 -
 sysdeps/unix/sysv/linux/i386/syscalls.list    |  2 --
 sysdeps/unix/sysv/linux/m68k/syscalls.list    |  1 -
 .../unix/sysv/linux/microblaze/syscalls.list  |  1 -
 .../unix/sysv/linux/mips/mips32/syscalls.list |  2 --
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  2 --
 .../sysv/linux/mips/mips64/n64/syscalls.list  |  2 --
 .../linux/powerpc/powerpc32/syscalls.list     |  1 -
 .../sysv/linux/s390/s390-32/syscalls.list     |  1 -
 sysdeps/unix/sysv/linux/sh/fanotify_mark.c    |  2 ++
 sysdeps/unix/sysv/linux/sh/syscalls.list      |  2 --
 .../sysv/linux/sparc/sparc32/syscalls.list    |  1 -
 .../unix/sysv/linux/wordsize-64/syscalls.list |  2 --
 18 files changed, 41 insertions(+), 22 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/fanotify_mark.c
 create mode 100644 sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
 create mode 100644 sysdeps/unix/sysv/linux/sh/fanotify_mark.c

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 09604e128b..71bb4cbddd 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -61,7 +61,7 @@ sysdep_routines += adjtimex clone umount umount2 readahead sysctl \
 		   open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get \
 		   timerfd_gettime timerfd_settime prctl \
 		   process_vm_readv process_vm_writev clock_adjtime \
-		   time64-support pselect32
+		   time64-support pselect32 fanotify_mark
 
 CFLAGS-gethostid.c = -fexceptions
 CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 742ed64ec9..ef35963e82 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -16,5 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/fanotify_mark.c b/sysdeps/unix/sysv/linux/fanotify_mark.c
new file mode 100644
index 0000000000..6f8fd2e9cf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fanotify_mark.c
@@ -0,0 +1,36 @@
+/* Add, remove, or modify an fanotify mark on a filesystem object.
+   Linux specific syscall.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <sys/fanotify.h>
+#include <sysdep.h>
+
+int
+__fanotify_mark (int fd, unsigned int flags, uint64_t mask, int dirfd,
+	         const char *pathname)
+{
+  return INLINE_SYSCALL_CALL (fanotify_mark, fd, flags, SYSCALL_LL64 (mask),
+			      dirfd, pathname);
+}
+#ifdef VERSION_fanotify_mark
+# include <shlib-compat.h>
+versioned_symbol (libc, __fanotify_mark, fanotify_mark,
+		  VERSION_fanotify_mark);
+#else
+weak_alias (__fanotify_mark, fanotify_mark)
+#endif
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list b/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
index b775008a37..736edbe654 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/syscalls.list
@@ -2,4 +2,3 @@
 
 # rlimit APIs
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/hppa/fanotify_mark.c b/sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
new file mode 100644
index 0000000000..ce347a4261
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/fanotify_mark.c
@@ -0,0 +1,2 @@
+#define VERSION_fanotify_mark GLIBC_2_19
+#include <sysdeps/unix/sysv/linux/fanotify_mark.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 11fada447c..a20bdc7726 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,4 +1,3 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 prlimit64	EXTRA	prlimit64	i:iipp	__prlimit64	prlimit64@@GLIBC_2.17
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.19
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 191081b949..a20d6ebf24 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -20,5 +20,3 @@ vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
 vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
index aba75b59e0..e28ccc2c45 100644
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -17,4 +17,3 @@ setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 4ff1c9da7e..f479ef0826 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -3,4 +3,3 @@
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
index f357b5c918..dbeb184d73 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips32/syscalls.list
@@ -1,5 +1,3 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
index e6c511fecb..6135436182 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
@@ -5,5 +5,3 @@
 lseek64		-	lseek		i:iii	__lseek64	__libc_lseek64 lseek64@@GLIBC_2.2 llseek@GLIBC_2.0:GLIBC_2.28
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
index 8e7d516a2a..ecf9d80ed4 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
@@ -2,8 +2,6 @@
 
 prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
 
-fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-
 fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64 __statfs64
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
index 966856e64a..d31303250d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
@@ -4,4 +4,3 @@ chown		-	chown		i:sii	__chown		chown@@GLIBC_2.1
 lchown		-	lchown		i:sii	__lchown	lchown@@GLIBC_2.0 chown@GLIBC_2.0
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
index 5c267744db..1c565e9ba5 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -16,4 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/sh/fanotify_mark.c b/sysdeps/unix/sysv/linux/sh/fanotify_mark.c
new file mode 100644
index 0000000000..3662f21b60
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fanotify_mark.c
@@ -0,0 +1,2 @@
+#define VERSION_fanotify_mark GLIBC_2_16
+#include <sysdeps/unix/sysv/linux/fanotify_mark.c>
diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list
index 6c2d2c6535..ef35963e82 100644
--- a/sysdeps/unix/sysv/linux/sh/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sh/syscalls.list
@@ -16,5 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.16
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
index 0b6095ffab..4fcae65451 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list
@@ -16,4 +16,3 @@ setfsgid	-	setfsgid32	Ei:i	setfsgid
 setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
-fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 9316778dae..0404a1c0d7 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -4,5 +4,3 @@ fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64
 sendfile	-	sendfile	i:iipi	sendfile	sendfile64
 prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
-
-fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-- 
2.25.1


  parent reply	other threads:[~2020-11-18 19:56 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 19:55 [PATCH 00/28] More Linux syscall refactor Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 01/28] Remove generic pthread linuxism on POSIX timer_routine Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 02/28] Removed ununsed pthread implementations Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 03/28] Remove local-setxid.h Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 04/28] Remove HAVE_INLINED_SYSCALLS usage on generic implementations Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 05/28] linux: Consolidate and cleanup personality syscall Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 06/28] x32: Remove syscalls.list Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 07/28] linux: Assume bind support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 08/28] linux: Assume getpeername support Adhemerval Zanella
2020-11-19 12:55   ` Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 09/28] linux: Assume getsockname support Adhemerval Zanella
2020-11-19 12:56   ` Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 10/28] linux: Assume getsockopt support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 11/28] linux: Assume listen support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 12/28] linux: Assume setsockopt support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 13/28] linux: Assume shutdown support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 14/28] linux: Assume socket support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 15/28] linux: Assume socketpair support Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 16/28] linux: Remove superflous __ASSUME_CONNECT_SYSCALL definitions Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 17/28] x86_64: Remove ununsed syscalls.list entry Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 18/28] nptl: Add futex_trylock_pi Adhemerval Zanella
2020-11-18 19:55 ` Adhemerval Zanella [this message]
2020-11-18 19:55 ` [PATCH 20/28] linux: Add prlimit64 C implementation Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 21/28] linux: Implement mremap in C Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 22/28] Linux: implement ioctl " Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 23/28] mips: Implement n32 lseek64 " Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 24/28] x32: Implement " Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 25/28] linux: Implement pipe in terms of __NR_pipe2 Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 26/28] linux: Consolidate brk implementation Adhemerval Zanella
2020-11-19 17:31   ` Tulio Magno Quites Machado Filho
2020-11-19 17:53     ` Adhemerval Zanella
2020-11-19 20:08   ` Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 27/28] linux: Add generic C syscall implementation Adhemerval Zanella
2020-11-18 19:55 ` [PATCH 28/28] alpha: Move implementations to C Adhemerval Zanella
2020-11-18 21:06 ` [PATCH 00/28] More Linux syscall refactor Joseph Myers
2020-11-19 12:21   ` Adhemerval Zanella
2020-11-19 16:38     ` Joseph Myers
2020-11-19 17:43       ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201118195552.2687336-20-adhemerval.zanella@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).