From patchwork Wed Oct 21 08:35:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Bartosz_Go=C5=82aszewski?= X-Patchwork-Id: 533660 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id DD1AD14076E for ; Wed, 21 Oct 2015 19:35:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Ij6BrJN1; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E02E73322B; Wed, 21 Oct 2015 08:35:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CfdgVal7rA-m; Wed, 21 Oct 2015 08:35:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id ADBD4331D5; Wed, 21 Oct 2015 08:35:24 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 494521C44BF for ; Wed, 21 Oct 2015 08:35:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 40012331AC for ; Wed, 21 Oct 2015 08:35:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 62XAXlTaXMiJ for ; Wed, 21 Oct 2015 08:35:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by silver.osuosl.org (Postfix) with ESMTPS id D7BFB33182 for ; Wed, 21 Oct 2015 08:35:18 +0000 (UTC) Received: by wicll6 with SMTP id ll6so79858200wic.0 for ; Wed, 21 Oct 2015 01:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iYT2CDAGnty/4oEXsnxFgM+NPFHkSL9UUpqtNz9vyes=; b=Ij6BrJN1hu/jXm0+SLKQFpAgBUytzo+q8tY/IEQIUIa4HQgVlsfuFan2ddoOPFAqTb giplRNGi4ngVvZuCWDIjfoGQQudag+zVH4UhqitoxIz9JCFmMbNLAGHgC62njXH//kii 805DcfhIHRcK4IDUeKy1hdL2801A8drGRFod1i+fSDO67e8uTfwhL2vFWQCadGxq85Yr fQviNEJlEDvb97vmSY21Bz4mfbVGiUUOJY8A3YZ7jpBM2TskkMl/LQ5FCegk/3Rtf1V+ Z6yTiJGcmP4rf5O1RoPUXhX2rZHyDSQHmsGQGg4TthjQcWTU3hBH+7Fnitpp8tBiMTmj HYcg== X-Received: by 10.180.21.180 with SMTP id w20mr9822265wie.24.1445416517541; Wed, 21 Oct 2015 01:35:17 -0700 (PDT) Received: from localhost.localdomain (cag06-6-78-235-100-105.fbx.proxad.net. [78.235.100.105]) by smtp.gmail.com with ESMTPSA id lf10sm8873888wjb.23.2015.10.21.01.35.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Oct 2015 01:35:16 -0700 (PDT) From: Bartosz Golaszewski To: uClibc Subject: [PATCH v2 1/2] fanotify: add system call support Date: Wed, 21 Oct 2015 10:35:07 +0200 Message-Id: <1445416508-31622-2-git-send-email-bartekgola@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445416508-31622-1-git-send-email-bartekgola@gmail.com> References: <1445416508-31622-1-git-send-email-bartekgola@gmail.com> X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" Add support for fanotify_init() and fanotify_mark() syscalls. The header file is taken from glibc. Signed-off-by: Bartosz Golaszewski --- libc/sysdeps/linux/common/Makefile.in | 1 + libc/sysdeps/linux/common/fanotify.c | 32 +++++++++++++++++++++++++++ libc/sysdeps/linux/common/sys/fanotify.h | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 libc/sysdeps/linux/common/fanotify.c create mode 100644 libc/sysdeps/linux/common/sys/fanotify.h diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 8252598..b75b712 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -27,6 +27,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \ eventfd.c \ eventfd_read.c \ eventfd_write.c \ + fanotify.c \ getrandom.c \ inotify.c \ ioperm.c \ diff --git a/libc/sysdeps/linux/common/fanotify.c b/libc/sysdeps/linux/common/fanotify.c new file mode 100644 index 0000000..a778516 --- /dev/null +++ b/libc/sysdeps/linux/common/fanotify.c @@ -0,0 +1,32 @@ +/* vi: set sw=4 ts=4: */ +/* + * fanotify interface for uClibc + * + * Copyright (C) 2015 by Bartosz Golaszewski + * + * Licensed under the LGPL v2.1+, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +#ifdef __NR_fanotify_init +_syscall2(int, fanotify_init, unsigned int, flags, unsigned int, event_f_flags) +#endif + +#ifdef __NR_fanotify_mark +# include +# include + +# if __WORDSIZE == 64 +_syscall5(int, fanotify_mark, int, fanotify_fd, unsigned int, flags, + uint64_t, mask, int, dirfd, const char *, pathname) +# else +int fanotify_mark(int fanotify_fd, unsigned int flags, + uint64_t mask, int dirfd, const char *pathname) +{ + return INLINE_SYSCALL(fanotify_mark, 6, fanotify_fd, flags, + OFF64_HI_LO(mask), dirfd, pathname); +} +# endif +#endif diff --git a/libc/sysdeps/linux/common/sys/fanotify.h b/libc/sysdeps/linux/common/sys/fanotify.h new file mode 100644 index 0000000..5eec3e5 --- /dev/null +++ b/libc/sysdeps/linux/common/sys/fanotify.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2010-2015 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 + . */ + +#ifndef _SYS_FANOTIFY_H +#define _SYS_FANOTIFY_H 1 + +#include +#include + + +__BEGIN_DECLS + +/* Create and initialize fanotify group. */ +extern int fanotify_init (unsigned int __flags, unsigned int __event_f_flags) + __THROW; + +/* Add, remove, or modify an fanotify mark on a filesystem object. */ +extern int fanotify_mark (int __fanotify_fd, unsigned int __flags, + uint64_t __mask, int __dfd, const char *__pathname) + __THROW; + +__END_DECLS + +#endif /* sys/fanotify.h */