Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux CAP_SYS_NICE



details:   https://anonhg.NetBSD.org/src/rev/428e53d852ed
branches:  trunk
changeset: 1027961:428e53d852ed
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:22:01 2021 +0000

description:
CAP_SYS_NICE

diffstat:

 sys/external/bsd/drm2/include/linux/capability.h |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 4c87c93f009e -r 428e53d852ed sys/external/bsd/drm2/include/linux/capability.h
--- a/sys/external/bsd/drm2/include/linux/capability.h  Sun Dec 19 01:21:53 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/capability.h  Sun Dec 19 01:22:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: capability.h,v 1.2 2020/02/14 16:02:41 tnn Exp $       */
+/*     $NetBSD: capability.h,v 1.3 2021/12/19 01:22:01 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -33,16 +33,22 @@
 
 enum linux_capability {
        LINUX_CAP_SYS_ADMIN,
+       LINUX_CAP_SYS_NICE,
 #define        CAP_SYS_ADMIN   LINUX_CAP_SYS_ADMIN
+#define        CAP_SYS_NICE    LINUX_CAP_SYS_NICE
 };
 
 static inline bool
 capable(enum linux_capability cap)
 {
-
-       KASSERT(cap == CAP_SYS_ADMIN);
-       return kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
-           NULL) == 0;
+       switch (cap) {
+       case CAP_SYS_ADMIN:
+       case CAP_SYS_NICE:
+               return (kauth_authorize_generic(kauth_cred_get(),
+                       KAUTH_GENERIC_ISSUSER, NULL) == 0);
+       default:
+               panic("unknown cap %d", cap);
+       }
 }
 
 #endif  /* _LINUX_CAPABILITY_H_ */



Home | Main Index | Thread Index | Old Index