Print this page
uts: add a concept of a 'default' set of privileges, separate from 'basic'
uts: give privilege macros more sensible names

@@ -105,11 +105,11 @@
         if (NF == 3) {
                 key = toupper($1)
                 priv = toupper($3)
                 if (set[key] != "")
                         set[key] = set[key] ";"
-                set[key] = set[key] "\\\n\t\tPRIV_ASSERT((set), " priv ")"
+                set[key] = set[key] "\\\n\t\tPRIV_ADDSET((set), " priv ")"
         } else {
                 priv = toupper($2);
         }
         privs[npriv] = tolower(substr(priv, 6));
         inset = 0

@@ -247,10 +247,12 @@
                     "   priv_info_t             privtype;\n" \
                     "   int                     nprivs;\n" \
                     "   char                    privs[" maxprivbytes "];\n" \
                     "   priv_info_t             sysset;\n" \
                     "   priv_set_t              basicset;\n" \
+                    "   priv_info_t             defset;\n" \
+                    "   priv_set_t              defaultset;\n" \
                     "} info = {\n" \
                     "   { sizeof (priv_impl_info_t), 0, PRIV_NSET, " \
                         "PRIV_SETSIZE, " npriv ",\n" \
                         "\t\tsizeof (priv_info_uint_t),\n" \
                         "\t\tsizeof (info) - sizeof (info.impl_info)},\n" \

@@ -287,12 +289,15 @@
                         len += length(privs[i]) + length(sep);
                         sep = "\\0"
                 }
                 print "\\0\"," > cfile
 
-                print "\t{ PRIV_INFO_BASICPRIVS, sizeof (info) - " \
+                print "\t{ PRIV_INFO_BASICPRIVS, offsetof (struct _info, defset) - " \
                         "offsetof(struct _info, sysset)},"  > cfile
+                print "\t{ 0 },\n" > cfile
+                print "\t{ PRIV_INFO_DEFAULTPRIVS, sizeof (info) - " \
+                    "offsetof(struct _info, defset)}" > cfile
 
                 print "};\n" > cfile
 
                 print "\nconst char *priv_names[" maxnpriv "] =\n{" > cfile
                 for (i = 0; i < npriv; i++)

@@ -310,10 +315,11 @@
                 print "int privbytes = " privbytes ";" > cfile
                 print "int maxprivbytes = " maxprivbytes ";" > cfile
                 print "size_t privinfosize = sizeof (info);" > cfile
                 print "char *priv_str = info.privs;" > cfile
                 print "priv_set_t *priv_basic = &info.basicset;" > cfile
+                print "priv_set_t *priv_default = &info.defaultset;" > cfile
                 print "priv_impl_info_t *priv_info = &info.impl_info;" > cfile
                 print "priv_info_names_t *priv_ninfo = " \
                         "(priv_info_names_t *)&info.privtype;" > cfile
                 close(cfile)
         }

@@ -338,10 +344,11 @@
                 print "extern int privbytes;" > privhfile
                 print "extern int maxprivbytes;" > privhfile
                 print "extern size_t privinfosize;" > privhfile
                 print "extern char *priv_str;" > privhfile
                 print "extern struct priv_set *priv_basic;" > privhfile
+                print "extern struct priv_set *priv_default;" > privhfile
                 print "extern struct priv_impl_info *priv_info;" > privhfile
                 print "extern struct priv_info_names *priv_ninfo;" > privhfile
 
                 print "\n/* Privileges */" > privhfile
                  

@@ -355,11 +362,11 @@
                 print "\n#define\tMAX_PRIVILEGE\t\t\t "  setsize * 32 \
                         > privhfile
 
                 # Special privilege categories.
                 for (s in set)
-                        print "\n#define\tPRIV_" s "_ASSERT(set)" set[s] \
+                        print "\n#define\tPRIV_" s "_ADDSET(set)" set[s] \
                                 > privhfile
 
                 print "\n#endif /* _KERNEL */" > privhfile
                 print "\n#ifdef __cplusplus\n}\n#endif" > privhfile
                 print "\n#endif /* _SYS_PRIV_CONST_H */" > privhfile