kern_descrip.c (cbd92ce62e92bd17871c9668c2c2bebac3e2ac2e) | kern_descrip.c (acbde29858530248556cea9a363660c48db383f0) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 2611 unchanged lines hidden (view full) --- 2620 return (error); 2621} 2622 2623int 2624fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, 2625 struct file **fpp, seq_t *seqp) 2626{ 2627#ifdef CAPABILITIES | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 2611 unchanged lines hidden (view full) --- 2620 return (error); 2621} 2622 2623int 2624fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, 2625 struct file **fpp, seq_t *seqp) 2626{ 2627#ifdef CAPABILITIES |
2628 struct filedescent *fde; | 2628 const struct filedescent *fde; |
2629#endif | 2629#endif |
2630 struct fdescenttbl *fdt; | 2630 const struct fdescenttbl *fdt; |
2631 struct file *fp; 2632 u_int count; 2633#ifdef CAPABILITIES 2634 seq_t seq; 2635 cap_rights_t haverights; 2636 int error; 2637#endif 2638 --- 29 unchanged lines hidden (view full) --- 2668 count = fp->f_count; 2669 retry: 2670 if (count == 0) { 2671 /* 2672 * Force a reload. Other thread could reallocate the 2673 * table before this fd was closed, so it possible that 2674 * there is a stale fp pointer in cached version. 2675 */ | 2631 struct file *fp; 2632 u_int count; 2633#ifdef CAPABILITIES 2634 seq_t seq; 2635 cap_rights_t haverights; 2636 int error; 2637#endif 2638 --- 29 unchanged lines hidden (view full) --- 2668 count = fp->f_count; 2669 retry: 2670 if (count == 0) { 2671 /* 2672 * Force a reload. Other thread could reallocate the 2673 * table before this fd was closed, so it possible that 2674 * there is a stale fp pointer in cached version. 2675 */ |
2676 fdt = *(struct fdescenttbl * volatile *)&(fdp->fd_files); | 2676 fdt = *(const struct fdescenttbl * const volatile *)&(fdp->fd_files); |
2677 continue; 2678 } 2679 /* 2680 * Use an acquire barrier to force re-reading of fdt so it is 2681 * refreshed for verification. 2682 */ 2683 if (atomic_fcmpset_acq_int(&fp->f_count, &count, count + 1) == 0) 2684 goto retry; --- 1565 unchanged lines hidden --- | 2677 continue; 2678 } 2679 /* 2680 * Use an acquire barrier to force re-reading of fdt so it is 2681 * refreshed for verification. 2682 */ 2683 if (atomic_fcmpset_acq_int(&fp->f_count, &count, count + 1) == 0) 2684 goto retry; --- 1565 unchanged lines hidden --- |