Author: mmacy
Date: Sat May 19 05:14:05 2018
New Revision: 333863
URL: https://svnweb.freebsd.org/changeset/base/333863

Log:
  capsicum: propagate const correctness

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/sys_capability.c
  head/sys/sys/capsicum.h

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Sat May 19 05:12:57 2018        
(r333862)
+++ head/sys/kern/kern_descrip.c        Sat May 19 05:14:05 2018        
(r333863)
@@ -2625,9 +2625,9 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights
     struct file **fpp, seq_t *seqp)
 {
 #ifdef CAPABILITIES
-       struct filedescent *fde;
+       const struct filedescent *fde;
 #endif
-       struct fdescenttbl *fdt;
+       const struct fdescenttbl *fdt;
        struct file *fp;
        u_int count;
 #ifdef CAPABILITIES
@@ -2673,7 +2673,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights
                         * table before this fd was closed, so it possible that
                         * there is a stale fp pointer in cached version.
                         */
-                       fdt = *(struct fdescenttbl * volatile 
*)&(fdp->fd_files);
+                       fdt = *(const struct fdescenttbl * const volatile 
*)&(fdp->fd_files);
                        continue;
                }
                /*

Modified: head/sys/kern/sys_capability.c
==============================================================================
--- head/sys/kern/sys_capability.c      Sat May 19 05:12:57 2018        
(r333862)
+++ head/sys/kern/sys_capability.c      Sat May 19 05:14:05 2018        
(r333863)
@@ -183,7 +183,7 @@ cap_check(const cap_rights_t *havep, const cap_rights_
  * Convert capability rights into VM access flags.
  */
 u_char
-cap_rights_to_vmprot(cap_rights_t *havep)
+cap_rights_to_vmprot(const cap_rights_t *havep)
 {
        u_char maxprot;
 
@@ -204,14 +204,14 @@ cap_rights_to_vmprot(cap_rights_t *havep)
  * this one file.
  */
 
-cap_rights_t *
-cap_rights_fde(struct filedescent *fdep)
+const cap_rights_t *
+cap_rights_fde(const struct filedescent *fdep)
 {
 
        return (&fdep->fde_rights);
 }
 
-cap_rights_t *
+const cap_rights_t *
 cap_rights(struct filedesc *fdp, int fd)
 {
 

Modified: head/sys/sys/capsicum.h
==============================================================================
--- head/sys/sys/capsicum.h     Sat May 19 05:12:57 2018        (r333862)
+++ head/sys/sys/capsicum.h     Sat May 19 05:14:05 2018        (r333863)
@@ -444,14 +444,14 @@ int       cap_check(const cap_rights_t *havep, const 
cap_rig
 /*
  * Convert capability rights into VM access flags.
  */
-u_char cap_rights_to_vmprot(cap_rights_t *havep);
+u_char cap_rights_to_vmprot(const cap_rights_t *havep);
 
 /*
  * For the purposes of procstat(1) and similar tools, allow kern_descrip.c to
  * extract the rights from a capability.
  */
-cap_rights_t   *cap_rights_fde(struct filedescent *fde);
-cap_rights_t   *cap_rights(struct filedesc *fdp, int fd);
+const cap_rights_t     *cap_rights_fde(const struct filedescent *fde);
+const cap_rights_t     *cap_rights(struct filedesc *fdp, int fd);
 
 int    cap_ioctl_check(struct filedesc *fdp, int fd, u_long cmd);
 int    cap_fcntl_check_fde(struct filedescent *fde, int cmd);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to