From nobody Sat Jan 22 19:36:36 2022 X-Original-To: dev-commits-src-branches@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 A7F16196BB6A; Sat, 22 Jan 2022 19:36:40 +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 4Jh61z5zZFz3h1j; Sat, 22 Jan 2022 19:36:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880199; 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=APt511fPKigYHFhp/mMA/zbIDL5l2SAgmsiYHOsGezs=; b=I/ewyKbxySgGUlXi9Zyb0tPMH9XGU9razi1CXlx/bMF3vNa7WTtgJOIhzKlDpSB0fJhV1b NxhitvgPxcgv2BdvNKyx5o/ncVwqPY6HRkIBpPhOzTSORUMnumqdPIayovY7hSoe7c1keN SCidfobkH67YHmuiHmqEskQshl09OvdLwMtuhcW5X7wL5Fnm6J0Qk6ErBitlI/BjUkwukJ UG/1aozIAFE19C3O/GapSw6a99nWs1nyAz8zG/hshXhUXdl5oRaUPQeOU2oeSNniFkf2gz 2JWUF9uGHM/yFH1Q7Ah9tGi01DBro43drutaKdKAGWIoA2NcxNxdIACYsieuHw== 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 6F0CA1518C; Sat, 22 Jan 2022 19:36:36 +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 20MJaaV1000345; Sat, 22 Jan 2022 19:36:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20MJaaNg000344; Sat, 22 Jan 2022 19:36:36 GMT (envelope-from git) Date: Sat, 22 Jan 2022 19:36:36 GMT Message-Id: <202201221936.20MJaaNg000344@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 64a0cd9aaea2 - stable/13 - LinuxKPI: Add linux/capability.h header List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 64a0cd9aaea2a0074cfb7759cb898f8e93bf515c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880199; 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=APt511fPKigYHFhp/mMA/zbIDL5l2SAgmsiYHOsGezs=; b=ykdSru5DeI93/Jk78xRhqtyy2BwFkLmCnfb/yvqdJqvF5890i1t6CTQMTroWLTppVSMQwo QaAN3mSz4eMxKvCHHLPKlYYf2LuC9Pdp0aFlaxricVmQP0MW+6YQizG34bzJ/t4dSMFeug INSFBFOIsM5aOKT6sNH3jrcw0pj/kla6MHqS+ighA7qH4JUpeyZaz/m435LiFMyv95oQG4 3Kh8ivWBp0ooRo0qsfbj2OHepWD7aaDaYJJU2lNG/YtJsjuCyEg2ZHJZZflKf5wN0XmK5r q8k58Xx3fw1inYyPI6k5lDJlVYQijhZM/R+o/rp9m3BbBTRVkuvkDCuye+gVeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642880199; a=rsa-sha256; cv=none; b=Xtys9n+TiV6C5gIPV0esWSU1EgG+bPb/yXTOOq1AdttE93diJvP5aYubiT07JojYgGeyEL BV+l1DGY/dOqO5SMHXsJ0nmx8PlEP3DHkpmfn/ZhzG2cB6YWe50cDGxJ2kNIS2g5WcVp3g RUYtkQVnhW/bdkXBx0cmjsMpukUXWz6oUlpZgp4/Qecl664/EqF6oZqV2hb1ESOZcxYO/I 1a8Sq/kiXKoce7s6qJyByaEtq/f2iuvG6M+/K/MqIK/sfTIYYIbgLaNFiW0iEvJNY4kCwe ahm9okEPMJICL6GNjGFTuWDDF6xz0QvpwVTXkRPGYp3+mY9xHCCty18RpPfSdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=64a0cd9aaea2a0074cfb7759cb898f8e93bf515c commit 64a0cd9aaea2a0074cfb7759cb898f8e93bf515c Author: Vladimir Kondratyev AuthorDate: 2021-12-08 21:04:31 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-01-22 19:34:37 +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 (cherry picked from commit f9c8b5880d2ceef22a02611efa01e96ac71da42b) --- .../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 */