From patchwork Tue Nov 3 15:20:56 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: 539468 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 1045E1402D6 for ; Wed, 4 Nov 2015 02:21:23 +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=pzd3Vcni; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0EFF432AE2; Tue, 3 Nov 2015 15:21:22 +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 fhKiBrvDQ2oc; Tue, 3 Nov 2015 15:21:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id BFC0E32ABE; Tue, 3 Nov 2015 15:21:15 +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 AF9D71C1017 for ; Tue, 3 Nov 2015 15:21:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A970132AAF for ; Tue, 3 Nov 2015 15:21:12 +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 HiU75ORa4Zhk for ; Tue, 3 Nov 2015 15:21:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by silver.osuosl.org (Postfix) with ESMTPS id BAD3E24404 for ; Tue, 3 Nov 2015 15:21:10 +0000 (UTC) Received: by wmff134 with SMTP id f134so87047428wmf.1 for ; Tue, 03 Nov 2015 07:21:09 -0800 (PST) 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=pzd3VcnitMZEpktKyCCvff3e5IY4ARRRBMDBJF1EHOzoUgOhpRl3Po0H+j+ARLASY6 KPXwh1BQSuY1WZCMRoFsuGYDE8ctOc7jm8yqU+3lnD8Uu3TQWRzOFBbzHA/mNv76Qfj4 9hOycT8w8WQjhs0sa5NwYxVdO8wVTA9DV0+T9JE5P1iGFAbgxHwUmCkrxO2ugzgzBvSK yzdqeWR2IjVI9iyhcsgSZp+ZgkeScLOXuRS+aLQZoPLHTsWlgRRSadByUYQPeD9cAd+1 qJjC2KVQ5TH+HcM9G97Zat+zxpbWQoPTkNLzFyg7lGpuwvVlUiMMmRGdzCKKHPOVTOKU VU0w== X-Received: by 10.28.18.21 with SMTP id 21mr21229585wms.34.1446564069218; Tue, 03 Nov 2015 07:21:09 -0800 (PST) Received: from localhost.localdomain (cag06-6-78-235-100-105.fbx.proxad.net. [78.235.100.105]) by smtp.gmail.com with ESMTPSA id gl9sm28097485wjb.10.2015.11.03.07.21.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Nov 2015 07:21:08 -0800 (PST) From: Bartosz Golaszewski To: uClibc Subject: [PATCH v3 1/2] fanotify: add system call support Date: Tue, 3 Nov 2015 16:20:56 +0100 Message-Id: <1446564057-6339-2-git-send-email-bartekgola@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446564057-6339-1-git-send-email-bartekgola@gmail.com> References: <1446564057-6339-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 */