From nobody Mon Jan 10 19:50:49 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E56A11954C03; Mon, 10 Jan 2022 19:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JXkvv5d2Lz3NqR; Mon, 10 Jan 2022 19:50:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 728313301; Mon, 10 Jan 2022 19:50:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20AJonVO009253; Mon, 10 Jan 2022 19:50:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20AJonc6009252; Mon, 10 Jan 2022 19:50:49 GMT (envelope-from git) Date: Mon, 10 Jan 2022 19:50:49 GMT Message-Id: <202201101950.20AJonc6009252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: f9c8b5880d2c - main - LinuxKPI: Add linux/capability.h header List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9c8b5880d2ceef22a02611efa01e96ac71da42b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641844252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VXH1ERoijqDFpkkWxRGTOON4WgLKAERcMxCFAX+1D/I=; b=F6TJV1wdnL7tRytmGX3s1Zp9mpfguYczzhcspS4tJj++lpAcJlNZAf3n/rgyC0irl9+bM8 bhNfZcC/IqWKyCtp0AESaPD+49HfE9+yRQLephlbsA5v79wRda1ZYJGo8U9RPiEoS2Ridp ubjYGT+MbW0TC+ciXwnWEN5MpikhKXAS0l05WIRwPcPK/tAGYUnJD6mP4qRzf7sqKcpN/E nkaLDpFmCdvFfOCqeiyNj1ehPg2AKBzhMSIl4WpK+8mVRJNw9sKvRYOphmvwy49Scs6NUL lq9ahlE9ofQtLmmKP63/Wr7lyHwkn+P9WSx/ETXpZ9aGHDITI/gkD//2/vYetQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641844252; a=rsa-sha256; cv=none; b=rg6HjbmBEnfLQYcRrFsC7BKC7KDa4iwQ/V6+3KlRbeY1c0X+NqDgyA5dWuVGHuFOnY6rL4 dm4lPo4P24J2lSb5owa2GmOT4t+LaS8hKVu76rhBTki+T8NBFhtJKBz82KmoVlSPnTUf4c H2DAO7F2+UURC4CdUDyb08cLrmSuKXiI0nJ2yrrCg86biG69hCSVkGOSb/Zb6Ghf74EwyM Dla95LhEMaXTFWF1yDdOxjMFxbE1nhKIMFJwJHDjwNOrZii1Xp81mdhZ195gelj1IeeFGB 04MY/qS5lZOW+LvuiQqq783xZeoDTtft9E7TcKf949mGmJiDNRwJ7xgRwQ8jRw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f9c8b5880d2ceef22a02611efa01e96ac71da42b commit f9c8b5880d2ceef22a02611efa01e96ac71da42b Author: Vladimir Kondratyev AuthorDate: 2021-12-08 21:04:31 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-01-10 19:49:38 +0000 LinuxKPI: Add linux/capability.h header Required by drm-kmod. Obtained from: DragonflyBSD MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33559 --- .../linuxkpi/common/include/linux/capability.h | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/capability.h b/sys/compat/linuxkpi/common/include/linux/capability.h new file mode 100644 index 000000000000..ce656255549b --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/capability.h @@ -0,0 +1,51 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015 Rimvydas Jasinskas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * linux/capability.h + * + * Simple capable() priv_check helper + */ + +#ifndef _LINUX_CAPABILITY_H +#define _LINUX_CAPABILITY_H + +#include +#include +#include + +#define CAP_SYS_ADMIN PRIV_DRIVER +#define CAP_SYS_NICE PRIV_SCHED_SETPRIORITY + +static inline bool +capable(const int tryme) +{ + return (priv_check(curthread, tryme) == 0); +} + +#endif /* _LINUX_CAPABILITY_H */