FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_capsicum.h"
#include "opt_ddb.h"
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/capsicum.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/filio.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/selinfo.h>
#include <sys/poll.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/sbuf.h>
#include <sys/signalvar.h>
#include <sys/kdb.h>
#include <sys/smr.h>
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/unistd.h>
#include <sys/user.h>
#include <sys/vnode.h>
#include <sys/ktrace.h>
#include <net/vnet.h>
#include <security/audit/audit.h>
#include <vm/uma.h>
#include <vm/vm.h>
#include <ddb/ddb.h>
Go to the source code of this file.
Data Structures | |
struct | freetable |
struct | fdescenttbl0 |
struct | filedesc0 |
struct | getdtablesize_args |
struct | dup2_args |
struct | dup_args |
struct | fcntl_args |
struct | close_args |
struct | close_range_args |
struct | fstat_args |
struct | fpathconf_args |
struct | flock_args |
struct | export_fd_buf |
Macros | |
#define | NDFILE 20 |
#define | NDSLOTSIZE sizeof(NDSLOTTYPE) |
#define | NDENTRIES (NDSLOTSIZE * __CHAR_BIT) |
#define | NDSLOT(x) ((x) / NDENTRIES) |
#define | NDBIT(x) ((NDSLOTTYPE)1 << ((x) % NDENTRIES)) |
#define | NDSLOTS(x) (((x) + NDENTRIES - 1) / NDENTRIES) |
#define | FILEDESC_FOREACH_FDE(fdp, _iterator, _fde) |
#define | FILEDESC_FOREACH_FP(fdp, _iterator, _fp) |
#define | FILEDESC_SBUF_SIZE (sizeof(struct kinfo_file) * 5) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static | MALLOC_DEFINE (M_FILEDESC, "filedesc", "Open file descriptor table") |
static | MALLOC_DEFINE (M_PWD, "pwd", "Descriptor table vnodes") |
static | MALLOC_DEFINE (M_PWDDESC, "pwddesc", "Pwd descriptors") |
static | MALLOC_DEFINE (M_FILEDESC_TO_LEADER, "filedesc_to_leader", "file desc to leader structures") |
static | MALLOC_DEFINE (M_SIGIO, "sigio", "sigio structures") |
MALLOC_DEFINE (M_FILECAPS, "filecaps", "descriptor capabilities") | |
MALLOC_DECLARE (M_FADVISE) | |
static int | closefp (struct filedesc *fdp, int fd, struct file *fp, struct thread *td, bool holdleaders, bool audit) |
static void | export_file_to_kinfo (struct file *fp, int fd, cap_rights_t *rightsp, struct kinfo_file *kif, struct filedesc *fdp, int flags) |
static int | fd_first_free (struct filedesc *fdp, int low, int size) |
static void | fdgrowtable (struct filedesc *fdp, int nfd) |
static void | fdgrowtable_exp (struct filedesc *fdp, int nfd) |
static void | fdunused (struct filedesc *fdp, int fd) |
static void | fdused (struct filedesc *fdp, int fd) |
static int | fget_unlocked_seq (struct thread *td, int fd, cap_rights_t *needrightsp, struct file **fpp, seqc_t *seqp) |
static int | getmaxfd (struct thread *td) |
static u_long * | filecaps_copy_prep (const struct filecaps *src) |
static void | filecaps_copy_finish (const struct filecaps *src, struct filecaps *dst, u_long *ioctls) |
static u_long * | filecaps_free_prep (struct filecaps *fcaps) |
static void | filecaps_free_finish (u_long *ioctls) |
static struct pwd * | pwd_alloc (void) |
int | fdlastfile_single (struct filedesc *fdp) |
int | fdlastfile (struct filedesc *fdp) |
static int | fdisused (struct filedesc *fdp, int fd) |
static void | fdused_init (struct filedesc *fdp, int fd) |
static void | fdefree_last (struct filedescent *fde) |
static void | fdfree (struct filedesc *fdp, int fd) |
int | sys_getdtablesize (struct thread *td, struct getdtablesize_args *uap) |
int | sys_dup2 (struct thread *td, struct dup2_args *uap) |
int | sys_dup (struct thread *td, struct dup_args *uap) |
int | sys_fcntl (struct thread *td, struct fcntl_args *uap) |
int | kern_fcntl_freebsd (struct thread *td, int fd, int cmd, long arg) |
int | kern_fcntl (struct thread *td, int fd, int cmd, intptr_t arg) |
int | kern_dup (struct thread *td, u_int mode, int flags, int old, int new) |
static void | sigiofree (struct sigio *sigio) |
static struct sigio * | funsetown_locked (struct sigio *sigio) |
void | funsetown (struct sigio **sigiop) |
void | funsetownlst (struct sigiolst *sigiolst) |
int | fsetown (pid_t pgid, struct sigio **sigiop) |
pid_t | fgetown (struct sigio **sigiop) |
static int | closefp_impl (struct filedesc *fdp, int fd, struct file *fp, struct thread *td, bool audit) |
static int | closefp_hl (struct filedesc *fdp, int fd, struct file *fp, struct thread *td, bool holdleaders, bool audit) |
int | sys_close (struct thread *td, struct close_args *uap) |
int | kern_close (struct thread *td, int fd) |
static int | close_range_cloexec (struct thread *td, u_int lowfd, u_int highfd) |
static int | close_range_impl (struct thread *td, u_int lowfd, u_int highfd) |
int | kern_close_range (struct thread *td, int flags, u_int lowfd, u_int highfd) |
int | sys_close_range (struct thread *td, struct close_range_args *uap) |
int | sys_fstat (struct thread *td, struct fstat_args *uap) |
int | kern_fstat (struct thread *td, int fd, struct stat *sbp) |
int | sys_fpathconf (struct thread *td, struct fpathconf_args *uap) |
int | kern_fpathconf (struct thread *td, int fd, int name, long *valuep) |
bool | filecaps_copy (const struct filecaps *src, struct filecaps *dst, bool locked) |
void | filecaps_move (struct filecaps *src, struct filecaps *dst) |
static void | filecaps_fill (struct filecaps *fcaps) |
void | filecaps_free (struct filecaps *fcaps) |
static void | filecaps_validate (const struct filecaps *fcaps, const char *func) |
int | fdalloc (struct thread *td, int minfd, int *result) |
int | fdallocn (struct thread *td, int minfd, int *fds, int n) |
int | falloc_caps (struct thread *td, struct file **resultfp, int *resultfd, int flags, struct filecaps *fcaps) |
int | _falloc_noinstall (struct thread *td, struct file **resultfp, u_int n) |
void | falloc_abort (struct thread *td, struct file *fp) |
void | _finstall (struct filedesc *fdp, struct file *fp, int fd, int flags, struct filecaps *fcaps) |
int | finstall_refed (struct thread *td, struct file *fp, int *fd, int flags, struct filecaps *fcaps) |
int | finstall (struct thread *td, struct file *fp, int *fd, int flags, struct filecaps *fcaps) |
struct filedesc * | fdinit (void) |
struct pwddesc * | pdinit (struct pwddesc *pdp, bool keeplock) |
static struct filedesc * | fdhold (struct proc *p) |
static struct pwddesc * | pdhold (struct proc *p) |
static void | fddrop (struct filedesc *fdp) |
static void | pddrop (struct pwddesc *pdp) |
struct filedesc * | fdshare (struct filedesc *fdp) |
struct pwddesc * | pdshare (struct pwddesc *pdp) |
void | fdunshare (struct thread *td) |
void | pdunshare (struct thread *td) |
struct filedesc * | fdcopy (struct filedesc *fdp) |
struct pwddesc * | pdcopy (struct pwddesc *pdp) |
static void | fdclearlocks (struct thread *td) |
static void | fdescfree_fds (struct thread *td, struct filedesc *fdp) |
void | fdescfree (struct thread *td) |
void | pdescfree (struct thread *td) |
static bool | is_unsafe (struct file *fp) |
void | fdsetugidsafety (struct thread *td) |
void | fdclose (struct thread *td, struct file *fp, int idx) |
void | fdcloseexec (struct thread *td) |
int | fdcheckstd (struct thread *td) |
int | closef (struct file *fp, struct thread *td) |
void | closef_nothread (struct file *fp) |
void | finit (struct file *fp, u_int flag, short type, void *data, struct fileops *ops) |
void | finit_vnode (struct file *fp, u_int flag, void *data, struct fileops *ops) |
int | fget_cap_noref (struct filedesc *fdp, int fd, cap_rights_t *needrightsp, struct file **fpp, struct filecaps *havecapsp) |
int | fget_cap (struct thread *td, int fd, cap_rights_t *needrightsp, struct file **fpp, struct filecaps *havecapsp) |
int | fgetvp_lookup_smr (int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsearch) |
static int | fget_unlocked_seq (struct thread *td, int fd, cap_rights_t *needrightsp, struct file **fpp, seqc_t *seqp __unused) |
int | fget_unlocked (struct thread *td, int fd, cap_rights_t *needrightsp, struct file **fpp) |
int | fget_only_user (struct filedesc *fdp, int fd, cap_rights_t *needrightsp, struct file **fpp) |
static __inline int | _fget (struct thread *td, int fd, struct file **fpp, int flags, cap_rights_t *needrightsp) |
int | fget (struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp) |
int | fget_mmap (struct thread *td, int fd, cap_rights_t *rightsp, vm_prot_t *maxprotp, struct file **fpp) |
int | fget_read (struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp) |
int | fget_write (struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp) |
int | fget_fcntl (struct thread *td, int fd, cap_rights_t *rightsp, int needfcntl, struct file **fpp) |
static __inline int | _fgetvp (struct thread *td, int fd, int flags, cap_rights_t *needrightsp, struct vnode **vpp) |
int | fgetvp (struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp) |
int | fgetvp_rights (struct thread *td, int fd, cap_rights_t *needrightsp, struct filecaps *havecaps, struct vnode **vpp) |
int | fgetvp_read (struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp) |
int | fgetvp_exec (struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp) |
int __noinline | _fdrop (struct file *fp, struct thread *td) |
int | sys_flock (struct thread *td, struct flock_args *uap) |
int | dupfdopen (struct thread *td, struct filedesc *fdp, int dfd, int mode, int openerror, int *indxp) |
SYSCTL_INT (_kern, OID_AUTO, chroot_allow_open_directories, CTLFLAG_RW, &chroot_allow_open_directories, 0, "Allow a process to chroot(2) if it has a directory open") | |
static int | chroot_refuse_vdir_fds (struct filedesc *fdp) |
static void | pwd_fill (struct pwd *oldpwd, struct pwd *newpwd) |
struct pwd * | pwd_hold_pwddesc (struct pwddesc *pdp) |
bool | pwd_hold_smr (struct pwd *pwd) |
struct pwd * | pwd_hold (struct thread *td) |
struct pwd * | pwd_hold_proc (struct proc *p) |
void | pwd_drop (struct pwd *pwd) |
int | pwd_chroot (struct thread *td, struct vnode *vp) |
void | pwd_chdir (struct thread *td, struct vnode *vp) |
int | pwd_chroot_chdir (struct thread *td, struct vnode *vp) |
void | pwd_ensure_dirs (void) |
void | pwd_set_rootvnode (void) |
void | mountcheckdirs (struct vnode *olddp, struct vnode *newdp) |
struct filedesc_to_leader * | filedesc_to_leader_alloc (struct filedesc_to_leader *old, struct filedesc *fdp, struct proc *leader) |
static int | sysctl_kern_proc_nfds (SYSCTL_HANDLER_ARGS) |
static | SYSCTL_NODE (_kern_proc, KERN_PROC_NFDS, nfds, CTLFLAG_RD|CTLFLAG_CAPRD|CTLFLAG_MPSAFE, sysctl_kern_proc_nfds, "Number of open file descriptors") |
static int | sysctl_kern_file (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_kern, KERN_FILE, file, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_file, "S,xfile", "Entire file table") | |
static int | xlate_fflags (int fflags) |
void | pack_kinfo (struct kinfo_file *kif) |
static void | export_vnode_to_kinfo (struct vnode *vp, int fd, int fflags, struct kinfo_file *kif, int flags) |
static int | export_kinfo_to_sb (struct export_fd_buf *efbuf) |
static int | export_file_to_sb (struct file *fp, int fd, cap_rights_t *rightsp, struct export_fd_buf *efbuf) |
static int | export_vnode_to_sb (struct vnode *vp, int fd, int fflags, struct export_fd_buf *efbuf) |
int | kern_proc_filedesc_out (struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags) |
static int | sysctl_kern_proc_filedesc (SYSCTL_HANDLER_ARGS) |
int | vntype_to_kinfo (int vtype) |
static | SYSCTL_NODE (_kern_proc, KERN_PROC_FILEDESC, filedesc, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_filedesc, "Process filedesc entries") |
int | kern_proc_cwd_out (struct proc *p, struct sbuf *sb, ssize_t maxlen) |
static int | sysctl_kern_proc_cwd (SYSCTL_HANDLER_ARGS) |
static | SYSCTL_NODE (_kern_proc, KERN_PROC_CWD, cwd, CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_cwd, "Process current working directory") |
SYSCTL_INT (_kern, KERN_MAXFILESPERPROC, maxfilesperproc, CTLFLAG_RW, &maxfilesperproc, 0, "Maximum files allowed open per process") | |
SYSCTL_INT (_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW, &maxfiles, 0, "Maximum number of files") | |
SYSCTL_INT (_kern, OID_AUTO, openfiles, CTLFLAG_RD, &openfiles, 0, "System-wide number of open files") | |
static void | filelistinit (void *dummy) |
SYSINIT (select, SI_SUB_LOCK, SI_ORDER_FIRST, filelistinit, NULL) | |
static int | badfo_readwrite (struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) |
static int | badfo_truncate (struct file *fp, off_t length, struct ucred *active_cred, struct thread *td) |
static int | badfo_ioctl (struct file *fp, u_long com, void *data, struct ucred *active_cred, struct thread *td) |
static int | badfo_poll (struct file *fp, int events, struct ucred *active_cred, struct thread *td) |
static int | badfo_kqfilter (struct file *fp, struct knote *kn) |
static int | badfo_stat (struct file *fp, struct stat *sb, struct ucred *active_cred) |
static int | badfo_close (struct file *fp, struct thread *td) |
static int | badfo_chmod (struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td) |
static int | badfo_chown (struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, struct thread *td) |
static int | badfo_sendfile (struct file *fp, int sockfd, struct uio *hdr_uio, struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags, struct thread *td) |
static int | badfo_fill_kinfo (struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) |
static int | path_poll (struct file *fp, int events, struct ucred *active_cred, struct thread *td) |
static int | path_close (struct file *fp, struct thread *td) |
int | invfo_rdwr (struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) |
int | invfo_truncate (struct file *fp, off_t length, struct ucred *active_cred, struct thread *td) |
int | invfo_ioctl (struct file *fp, u_long com, void *data, struct ucred *active_cred, struct thread *td) |
int | invfo_poll (struct file *fp, int events, struct ucred *active_cred, struct thread *td) |
int | invfo_kqfilter (struct file *fp, struct knote *kn) |
int | invfo_chmod (struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td) |
int | invfo_chown (struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, struct thread *td) |
int | invfo_sendfile (struct file *fp, int sockfd, struct uio *hdr_uio, struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags, struct thread *td) |
static int | fdopen (struct cdev *dev, int mode, int type, struct thread *td) |
static void | fildesc_drvinit (void *unused) |
SYSINIT (fildescdev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, fildesc_drvinit, NULL) | |
Variables | |
static __read_mostly uma_zone_t | file_zone |
static __read_mostly uma_zone_t | filedesc0_zone |
__read_mostly uma_zone_t | pwd_zone |
VFS_SMR_DECLARE | |
static int __exclusive_cache_line | openfiles |
struct mtx | sigio_lock |
void __read_mostly(* | mq_fdclose )(struct thread *td, int fd, struct file *fp) |
static int | chroot_allow_open_directories = 1 |
struct fileops | badfileops |
struct fileops | path_fileops |
static struct cdevsw | fildesc_cdevsw |
#define FILEDESC_FOREACH_FDE | ( | fdp, | |
_iterator, | |||
_fde | |||
) |
Definition at line 158 of file kern_descrip.c.
#define FILEDESC_FOREACH_FP | ( | fdp, | |
_iterator, | |||
_fp | |||
) |
Definition at line 164 of file kern_descrip.c.
#define FILEDESC_SBUF_SIZE (sizeof(struct kinfo_file) * 5) |
Definition at line 4520 of file kern_descrip.c.
#define NDBIT | ( | x | ) | ((NDSLOTTYPE)1 << ((x) % NDENTRIES)) |
Definition at line 155 of file kern_descrip.c.
#define NDENTRIES (NDSLOTSIZE * __CHAR_BIT) |
Definition at line 153 of file kern_descrip.c.
#define NDFILE 20 |
Definition at line 151 of file kern_descrip.c.
#define NDSLOT | ( | x | ) | ((x) / NDENTRIES) |
Definition at line 154 of file kern_descrip.c.
Definition at line 156 of file kern_descrip.c.
#define NDSLOTSIZE sizeof(NDSLOTTYPE) |
Definition at line 152 of file kern_descrip.c.
__FBSDID | ( | "$FreeBSD$" | ) |
int _falloc_noinstall | ( | struct thread * | td, |
struct file ** | resultfp, | ||
u_int | n | ||
) |
Definition at line 2088 of file kern_descrip.c.
References badfileops, crhold(), file_zone, maxfiles, openfiles, ppsratecheck(), printf(), and priv_check().
Referenced by falloc_caps().
int __noinline _fdrop | ( | struct file * | fp, |
struct thread * | td | ||
) |
Definition at line 3539 of file kern_descrip.c.
References count, crfree(), file_zone, free(), openfiles, and panic().
Referenced by falloc_abort().
|
static |
Definition at line 3297 of file kern_descrip.c.
References badfileops, fd, fget_unlocked(), flags, and path_fileops.
Referenced by _fgetvp(), fget(), fget_mmap(), fget_read(), and fget_write().
|
static |
Definition at line 3448 of file kern_descrip.c.
References _fget(), fd, flags, and vref().
Referenced by fgetvp(), fgetvp_exec(), and fgetvp_read().
void _finstall | ( | struct filedesc * | fdp, |
struct file * | fp, | ||
int | fd, | ||
int | flags, | ||
struct filecaps * | fcaps | ||
) |
Definition at line 2134 of file kern_descrip.c.
References fd, filecaps_fill(), filecaps_move(), filecaps_validate(), and flags.
Referenced by finstall_refed(), and unp_externalize().
|
static |
Definition at line 5005 of file kern_descrip.c.
|
static |
Definition at line 5013 of file kern_descrip.c.
|
static |
Definition at line 4998 of file kern_descrip.c.
|
static |
Definition at line 5030 of file kern_descrip.c.
|
static |
Definition at line 4968 of file kern_descrip.c.
|
static |
Definition at line 4984 of file kern_descrip.c.
|
static |
Definition at line 4976 of file kern_descrip.c.
|
static |
Definition at line 4952 of file kern_descrip.c.
|
static |
Definition at line 5021 of file kern_descrip.c.
|
static |
Definition at line 4991 of file kern_descrip.c.
|
static |
Definition at line 4960 of file kern_descrip.c.
|
static |
Definition at line 3728 of file kern_descrip.c.
References FILEDESC_FOREACH_FP.
Referenced by pwd_chroot(), and pwd_chroot_chdir().
|
static |
Definition at line 1409 of file kern_descrip.c.
References fd.
Referenced by kern_close_range().
|
static |
Definition at line 1435 of file kern_descrip.c.
References closefp(), fd, and fdfree().
Referenced by kern_close_range().
int closef | ( | struct file * | fp, |
struct thread * | td | ||
) |
Definition at line 2757 of file kern_descrip.c.
References wakeup().
Referenced by closefp_impl(), fdescfree_fds(), and fdsetugidsafety().
void closef_nothread | ( | struct file * | fp | ) |
Definition at line 2830 of file kern_descrip.c.
Referenced by unp_discard(), and unp_process_defers().
|
static |
Definition at line 1360 of file kern_descrip.c.
References closefp_hl(), closefp_impl(), and fd.
Referenced by close_range_impl(), fdcloseexec(), kern_close(), and kern_dup().
|
static |
Definition at line 1326 of file kern_descrip.c.
References closefp_impl(), fd, and wakeup().
Referenced by closefp().
|
static |
Definition at line 1285 of file kern_descrip.c.
References closef(), fd, knote_fdclose(), and mq_fdclose.
Referenced by closefp(), and closefp_hl().
int dupfdopen | ( | struct thread * | td, |
struct filedesc * | fdp, | ||
int | dfd, | ||
int | mode, | ||
int | openerror, | ||
int * | indxp | ||
) |
Definition at line 3620 of file kern_descrip.c.
References fdalloc(), fdunused(), filecaps_copy_finish(), filecaps_copy_prep(), and mode.
Referenced by kern_openat().
|
static |
Definition at line 4292 of file kern_descrip.c.
References fd, flags, pack_kinfo(), and xlate_fflags().
Referenced by export_file_to_sb(), and kern_fcntl().
|
static |
Definition at line 4373 of file kern_descrip.c.
References export_file_to_kinfo(), export_kinfo_to_sb(), fd, export_fd_buf::fdp, export_fd_buf::flags, export_fd_buf::kif, and export_fd_buf::remainder.
Referenced by kern_proc_filedesc_out().
|
static |
Definition at line 4357 of file kern_descrip.c.
References export_fd_buf::kif, export_fd_buf::remainder, export_fd_buf::sb, sbuf_bcat(), and sbuf_error().
Referenced by export_file_to_sb(), and export_vnode_to_sb().
|
static |
Definition at line 4324 of file kern_descrip.c.
References fd, flags, pack_kinfo(), vn_fill_kinfo_vnode(), vrele(), and xlate_fflags().
Referenced by export_vnode_to_sb().
|
static |
Definition at line 4389 of file kern_descrip.c.
References export_kinfo_to_sb(), export_vnode_to_kinfo(), fd, export_fd_buf::flags, export_fd_buf::kif, export_fd_buf::pdp, and export_fd_buf::remainder.
Referenced by kern_proc_cwd_out(), and kern_proc_filedesc_out().
void falloc_abort | ( | struct thread * | td, |
struct file * | fp | ||
) |
Definition at line 2120 of file kern_descrip.c.
References _fdrop().
Referenced by falloc_caps(), and kern_openat().
int falloc_caps | ( | struct thread * | td, |
struct file ** | resultfp, | ||
int * | resultfd, | ||
int | flags, | ||
struct filecaps * | fcaps | ||
) |
Definition at line 2058 of file kern_descrip.c.
References _falloc_noinstall(), falloc_abort(), fd, finstall_refed(), and flags.
Referenced by kern_accept4(), kern_kqueue(), kern_pipe(), kern_shm_open2(), procdesc_falloc(), and umtx_shm().
|
static |
int fdalloc | ( | struct thread * | td, |
int | minfd, | ||
int * | result | ||
) |
Definition at line 1971 of file kern_descrip.c.
References fd, fd_first_free(), fdgrowtable_exp(), fdisused(), fdused(), getmaxfd(), and result.
Referenced by dupfdopen(), fdallocn(), finstall_refed(), and kern_dup().
int fdallocn | ( | struct thread * | td, |
int | minfd, | ||
int * | fds, | ||
int | n | ||
) |
Definition at line 2029 of file kern_descrip.c.
References fdalloc(), and fdunused().
Referenced by unp_externalize().
int fdcheckstd | ( | struct thread * | td | ) |
Definition at line 2718 of file kern_descrip.c.
References kern_dup(), and kern_openat().
Referenced by do_execve().
|
static |
Definition at line 2445 of file kern_descrip.c.
References FILEDESC_FOREACH_FP, and free().
Referenced by fdescfree().
void fdclose | ( | struct thread * | td, |
struct file * | fp, | ||
int | idx | ||
) |
Definition at line 2671 of file kern_descrip.c.
References fdfree().
Referenced by accept1(), fork1(), kern_accept4(), kern_kmq_open(), kern_pipe(), kern_shm_open2(), kern_socket(), kern_socketpair(), ksem_create(), m_dispose_extcontrolm(), and sys_posix_openpt().
void fdcloseexec | ( | struct thread * | td | ) |
Definition at line 2688 of file kern_descrip.c.
References closefp(), fdfree(), and FILEDESC_FOREACH_FDE.
Referenced by do_execve().
struct filedesc * fdcopy | ( | struct filedesc * | fdp | ) |
Definition at line 2387 of file kern_descrip.c.
References fdgrowtable(), fdinit(), fdlastfile(), fdused_init(), filecaps_copy(), and FILEDESC_FOREACH_FDE.
Referenced by do_fork(), and fdunshare().
|
static |
Definition at line 2291 of file kern_descrip.c.
References filedesc0_zone.
Referenced by fdescfree_fds(), kern_proc_filedesc_out(), and sysctl_kern_file().
|
inlinestatic |
Definition at line 315 of file kern_descrip.c.
References filecaps_free().
Referenced by fdescfree_fds(), and fdfree().
void fdescfree | ( | struct thread * | td | ) |
Definition at line 2562 of file kern_descrip.c.
References fdclearlocks(), and fdescfree_fds().
Referenced by exit1(), fdunshare(), and fork_norfproc().
|
static |
Definition at line 2524 of file kern_descrip.c.
References closef(), fddrop(), fdefree_last(), FILEDESC_FOREACH_FDE, free(), freetable::ft_table, NDFILE, and NDSLOTS.
Referenced by fdescfree().
|
inlinestatic |
Definition at line 322 of file kern_descrip.c.
References fd, fdefree_last(), and fdunused().
Referenced by close_range_impl(), fdclose(), fdcloseexec(), fdsetugidsafety(), and kern_close().
|
static |
Definition at line 1872 of file kern_descrip.c.
References free(), freetable::ft_table, malloc(), NDENTRIES, NDFILE, NDSLOTS, and NDSLOTSIZE.
Referenced by fdcopy(), and fdgrowtable_exp().
|
static |
Definition at line 1856 of file kern_descrip.c.
References fdgrowtable().
Referenced by fdalloc(), and kern_dup().
|
static |
Definition at line 2267 of file kern_descrip.c.
Referenced by kern_proc_filedesc_out(), and sysctl_kern_file().
struct filedesc * fdinit | ( | void | ) |
Definition at line 2200 of file kern_descrip.c.
References filedesc0::fd_fd, filedesc0_zone, and NDFILE.
Referenced by do_fork(), fdcopy(), fork_norfproc(), and proc0_init().
|
static |
Definition at line 259 of file kern_descrip.c.
References fd, NDBIT, and NDSLOT.
Referenced by fdalloc(), fdunused(), fdused_init(), and kern_dup().
int fdlastfile | ( | struct filedesc * | fdp | ) |
Definition at line 251 of file kern_descrip.c.
References fdlastfile_single().
Referenced by fdcopy().
int fdlastfile_single | ( | struct filedesc * | fdp | ) |
Definition at line 238 of file kern_descrip.c.
References NDENTRIES, and NDSLOT.
Referenced by fdlastfile().
|
static |
Definition at line 5162 of file kern_descrip.c.
void fdsetugidsafety | ( | struct thread * | td | ) |
Definition at line 2637 of file kern_descrip.c.
References closef(), fdfree(), is_unsafe(), and knote_fdclose().
Referenced by do_execve().
struct filedesc * fdshare | ( | struct filedesc * | fdp | ) |
Definition at line 2329 of file kern_descrip.c.
Referenced by do_fork().
void fdunshare | ( | struct thread * | td | ) |
Definition at line 2350 of file kern_descrip.c.
References fdcopy(), and fdescfree().
Referenced by do_execve(), and fork_norfproc().
|
static |
Definition at line 295 of file kern_descrip.c.
References fd, fdisused(), and NDSLOT.
Referenced by dupfdopen(), fdallocn(), and fdfree().
|
static |
Definition at line 281 of file kern_descrip.c.
References fd, and fdused_init().
Referenced by fdalloc(), and kern_dup().
|
static |
Definition at line 272 of file kern_descrip.c.
References fd, fdisused(), NDBIT, and NDSLOT.
Referenced by fdcopy(), and fdused().
int fget | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
struct file ** | fpp | ||
) |
Definition at line 3344 of file kern_descrip.c.
Referenced by aio_aqueue(), getmq(), kern_fpathconf(), kern_fstat(), kern_ftruncate(), kern_ioctl(), kern_kevent(), kern_lseek(), kern_pdgetpid(), kern_posix_fadvise(), kern_posix_fallocate(), kqfd_register(), kqueue_register(), ksem_get(), m_dispose_extcontrolm(), procdesc_find(), sys_aio_cancel(), sys_fchmod(), sys_fchown(), and sys_flock().
int fget_cap | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | needrightsp, | ||
struct file ** | fpp, | ||
struct filecaps * | havecapsp | ||
) |
Definition at line 2935 of file kern_descrip.c.
References fd, fget_unlocked(), and filecaps_fill().
Referenced by fgetvp_rights(), getsock_cap(), and namei_setup().
int fget_cap_noref | ( | struct filedesc * | fdp, |
int | fd, | ||
cap_rights_t * | needrightsp, | ||
struct file ** | fpp, | ||
struct filecaps * | havecapsp | ||
) |
Definition at line 2862 of file kern_descrip.c.
References fd, and filecaps_copy().
Referenced by kern_fcntl(), and ttyhook_register().
int fget_fcntl | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
int | needfcntl, | ||
struct file ** | fpp | ||
) |
Definition at line 3409 of file kern_descrip.c.
References fd, fget_unlocked(), and fget_unlocked_seq().
Referenced by kern_fcntl().
int fget_mmap | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
vm_prot_t * | maxprotp, | ||
struct file ** | fpp | ||
) |
Definition at line 3351 of file kern_descrip.c.
References _fget(), badfileops, fd, and fget_unlocked_seq().
int fget_only_user | ( | struct filedesc * | fdp, |
int | fd, | ||
cap_rights_t * | needrightsp, | ||
struct file ** | fpp | ||
) |
Definition at line 3262 of file kern_descrip.c.
References fd.
Referenced by pollrescan(), pollscan(), selrescan(), and selscan().
int fget_read | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
struct file ** | fpp | ||
) |
Definition at line 3395 of file kern_descrip.c.
Referenced by aio_aqueue(), getmq_read(), kern_copy_file_range(), kern_preadv(), kern_readv(), and sendfile().
int fget_unlocked | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | needrightsp, | ||
struct file ** | fpp | ||
) |
Definition at line 3163 of file kern_descrip.c.
References fd, and fget_unlocked_seq().
Referenced by _fget(), fget_cap(), fget_fcntl(), getvnode_path(), kern_fcntl(), pollrescan(), pollscan(), selrescan(), and selscan().
|
static |
Definition at line 3120 of file kern_descrip.c.
References fd.
|
static |
Referenced by fget_fcntl(), fget_mmap(), and fget_unlocked().
int fget_write | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
struct file ** | fpp | ||
) |
Definition at line 3402 of file kern_descrip.c.
Referenced by aio_aqueue(), getmq_write(), kern_copy_file_range(), kern_fspacectl(), kern_ptrace(), kern_pwritev(), and kern_writev().
pid_t fgetown | ( | struct sigio ** | sigiop | ) |
Definition at line 1274 of file kern_descrip.c.
Referenced by devioctl(), kern_accept4(), kqueue_ioctl(), logioctl(), pipe_ioctl(), soo_ioctl(), and tty_generic_ioctl().
int fgetvp | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
struct vnode ** | vpp | ||
) |
int fgetvp_exec | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
struct vnode ** | vpp | ||
) |
Definition at line 3516 of file kern_descrip.c.
Referenced by do_execve().
int fgetvp_lookup_smr | ( | int | fd, |
struct nameidata * | ndp, | ||
struct vnode ** | vpp, | ||
bool * | fsearch | ||
) |
Definition at line 3015 of file kern_descrip.c.
References fd, and filecaps_fill().
Referenced by cache_fplookup_dirfd().
int fgetvp_read | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | rightsp, | ||
struct vnode ** | vpp | ||
) |
int fgetvp_rights | ( | struct thread * | td, |
int | fd, | ||
cap_rights_t * | needrightsp, | ||
struct filecaps * | havecaps, | ||
struct vnode ** | vpp | ||
) |
Definition at line 3477 of file kern_descrip.c.
References badfileops, fd, fget_cap(), filecaps_free(), and vref().
|
static |
Definition at line 5184 of file kern_descrip.c.
References fildesc_cdevsw, make_dev_alias(), and make_dev_credf().
bool filecaps_copy | ( | const struct filecaps * | src, |
struct filecaps * | dst, | ||
bool | locked | ||
) |
Definition at line 1728 of file kern_descrip.c.
Referenced by fdcopy(), fget_cap_noref(), and unp_internalize().
|
static |
Definition at line 1765 of file kern_descrip.c.
References src.
Referenced by dupfdopen(), and kern_dup().
|
static |
Definition at line 1748 of file kern_descrip.c.
Referenced by dupfdopen(), and kern_dup().
|
static |
Definition at line 1796 of file kern_descrip.c.
Referenced by _finstall(), fget_cap(), and fgetvp_lookup_smr().
void filecaps_free | ( | struct filecaps * | fcaps | ) |
Definition at line 1809 of file kern_descrip.c.
References free().
Referenced by fdefree_last(), fgetvp_rights(), getsock_cap(), kern_accept4(), kern_openat(), and unp_freerights().
|
static |
Definition at line 1827 of file kern_descrip.c.
References free().
Referenced by kern_dup().
|
static |
Definition at line 1817 of file kern_descrip.c.
Referenced by kern_dup().
void filecaps_move | ( | struct filecaps * | src, |
struct filecaps * | dst | ||
) |
Definition at line 1785 of file kern_descrip.c.
References src.
Referenced by _finstall().
|
static |
Definition at line 1837 of file kern_descrip.c.
References cap_rights_is_valid().
Referenced by _finstall().
struct filedesc_to_leader * filedesc_to_leader_alloc | ( | struct filedesc_to_leader * | old, |
struct filedesc * | fdp, | ||
struct proc * | leader | ||
) |
Definition at line 4098 of file kern_descrip.c.
References malloc().
Referenced by do_fork().
|
static |
Definition at line 4931 of file kern_descrip.c.
References file_zone, filedesc0_zone, pwd_zone, and sigio_lock.
void finit | ( | struct file * | fp, |
u_int | flag, | ||
short | type, | ||
void * | data, | ||
struct fileops * | ops | ||
) |
Definition at line 2844 of file kern_descrip.c.
References data, flag, and type.
Referenced by eventfd_create_file(), finit_vnode(), kern_accept4(), kern_kmq_open(), kern_kqueue(), kern_openat(), kern_pipe(), kern_shm_open2(), kern_socket(), kern_socketpair(), ksem_create(), procdesc_finit(), pts_alloc(), pts_alloc_external(), and umtx_shm().
void finit_vnode | ( | struct file * | fp, |
u_int | flag, | ||
void * | data, | ||
struct fileops * | ops | ||
) |
Definition at line 2853 of file kern_descrip.c.
References data, finit(), and flag.
Referenced by kern_fhopen(), and kern_openat().
int finstall | ( | struct thread * | td, |
struct file * | fp, | ||
int * | fd, | ||
int | flags, | ||
struct filecaps * | fcaps | ||
) |
Definition at line 2178 of file kern_descrip.c.
References fd, finstall_refed(), and flags.
Referenced by kern_fhopen(), and kern_specialfd().
int finstall_refed | ( | struct thread * | td, |
struct file * | fp, | ||
int * | fd, | ||
int | flags, | ||
struct filecaps * | fcaps | ||
) |
Definition at line 2160 of file kern_descrip.c.
References _finstall(), fd, fdalloc(), and flags.
Referenced by falloc_caps(), finstall(), and kern_openat().
int fsetown | ( | pid_t | pgid, |
struct sigio ** | sigiop | ||
) |
Definition at line 1190 of file kern_descrip.c.
References crhold(), funsetown(), funsetown_locked(), malloc(), pget(), pgfind(), proctree_lock, and sigiofree().
Referenced by devioctl(), kern_accept4(), kqueue_ioctl(), logioctl(), logopen(), pipe_ioctl(), soo_ioctl(), and tty_generic_ioctl().
void funsetown | ( | struct sigio ** | sigiop | ) |
Definition at line 1101 of file kern_descrip.c.
References funsetown_locked(), and sigiofree().
Referenced by devclose(), fsetown(), kqueue_destroy(), logclose(), pipe_dtor(), soclose(), and tty_rel_free().
|
static |
Definition at line 1071 of file kern_descrip.c.
Referenced by fsetown(), and funsetown().
void funsetownlst | ( | struct sigiolst * | sigiolst | ) |
Definition at line 1123 of file kern_descrip.c.
References proctree_lock, and sigiofree().
Referenced by exit1(), and pgdelete().
|
static |
Definition at line 916 of file kern_descrip.c.
References lim_cur(), and maxfilesperproc.
Referenced by fdalloc(), kern_dup(), and sys_getdtablesize().
int invfo_chmod | ( | struct file * | fp, |
mode_t | mode, | ||
struct ucred * | active_cred, | ||
struct thread * | td | ||
) |
Definition at line 5123 of file kern_descrip.c.
Referenced by pipe_chmod().
int invfo_chown | ( | struct file * | fp, |
uid_t | uid, | ||
gid_t | gid, | ||
struct ucred * | active_cred, | ||
struct thread * | td | ||
) |
Definition at line 5131 of file kern_descrip.c.
Referenced by pipe_chown().
int invfo_ioctl | ( | struct file * | fp, |
u_long | com, | ||
void * | data, | ||
struct ucred * | active_cred, | ||
struct thread * | td | ||
) |
Definition at line 5100 of file kern_descrip.c.
int invfo_kqfilter | ( | struct file * | fp, |
struct knote * | kn | ||
) |
Definition at line 5116 of file kern_descrip.c.
int invfo_poll | ( | struct file * | fp, |
int | events, | ||
struct ucred * | active_cred, | ||
struct thread * | td | ||
) |
Definition at line 5108 of file kern_descrip.c.
References poll_no_poll().
int invfo_rdwr | ( | struct file * | fp, |
struct uio * | uio, | ||
struct ucred * | active_cred, | ||
int | flags, | ||
struct thread * | td | ||
) |
Definition at line 5084 of file kern_descrip.c.
int invfo_sendfile | ( | struct file * | fp, |
int | sockfd, | ||
struct uio * | hdr_uio, | ||
struct uio * | trl_uio, | ||
off_t | offset, | ||
size_t | nbytes, | ||
off_t * | sent, | ||
int | flags, | ||
struct thread * | td | ||
) |
Definition at line 5139 of file kern_descrip.c.
int invfo_truncate | ( | struct file * | fp, |
off_t | length, | ||
struct ucred * | active_cred, | ||
struct thread * | td | ||
) |
Definition at line 5092 of file kern_descrip.c.
Referenced by pipe_truncate().
|
static |
Definition at line 2622 of file kern_descrip.c.
Referenced by fdsetugidsafety().
int kern_close | ( | struct thread * | td, |
int | fd | ||
) |
Definition at line 1390 of file kern_descrip.c.
References closefp(), fd, and fdfree().
Referenced by parse_dir_md(), sys_close(), sys_ksem_close(), sys_ksem_destroy(), sys_pipe2(), and sys_socketpair().
int kern_close_range | ( | struct thread * | td, |
int | flags, | ||
u_int | lowfd, | ||
u_int | highfd | ||
) |
Definition at line 1472 of file kern_descrip.c.
References close_range_cloexec(), close_range_impl(), and flags.
Referenced by sys_close_range().
int kern_dup | ( | struct thread * | td, |
u_int | mode, | ||
int | flags, | ||
int | old, | ||
int | new | ||
) |
Definition at line 926 of file kern_descrip.c.
References closefp(), fdalloc(), fdgrowtable_exp(), fdisused(), fdused(), filecaps_copy_finish(), filecaps_copy_prep(), filecaps_free_finish(), filecaps_free_prep(), flags, getmaxfd(), and mode.
Referenced by fdcheckstd(), kern_fcntl(), sys_dup(), and sys_dup2().
int kern_fcntl | ( | struct thread * | td, |
int | fd, | ||
int | cmd, | ||
intptr_t | arg | ||
) |
Definition at line 488 of file kern_descrip.c.
References cap_fcntl_rights, cap_flock_rights, cap_no_rights, export_file_to_kinfo(), fd, fget_cap_noref(), fget_fcntl(), fget_unlocked(), free(), kern_dup(), malloc(), path_fileops, and priv_check().
Referenced by kern_fcntl_freebsd().
int kern_fcntl_freebsd | ( | struct thread * | td, |
int | fd, | ||
int | cmd, | ||
long | arg | ||
) |
Definition at line 421 of file kern_descrip.c.
References fd, and kern_fcntl().
Referenced by sys_fcntl().
int kern_fpathconf | ( | struct thread * | td, |
int | fd, | ||
int | name, | ||
long * | valuep | ||
) |
Definition at line 1684 of file kern_descrip.c.
References cap_fpathconf_rights, fd, fget(), and name.
Referenced by sys_fpathconf().
int kern_fstat | ( | struct thread * | td, |
int | fd, | ||
struct stat * | sbp | ||
) |
Definition at line 1605 of file kern_descrip.c.
References cap_fstat_rights, fd, and fget().
Referenced by kern_statat(), and sys_fstat().
int kern_proc_cwd_out | ( | struct proc * | p, |
struct sbuf * | sb, | ||
ssize_t | maxlen | ||
) |
Definition at line 4721 of file kern_descrip.c.
References export_vnode_to_sb(), export_fd_buf::fdp, export_fd_buf::flags, free(), malloc(), pddrop(), pdhold(), export_fd_buf::pdp, export_fd_buf::remainder, export_fd_buf::sb, and vrefact().
Referenced by sysctl_kern_proc_cwd().
int kern_proc_filedesc_out | ( | struct proc * | p, |
struct sbuf * | sb, | ||
ssize_t | maxlen, | ||
int | flags | ||
) |
Definition at line 4411 of file kern_descrip.c.
References cap_no_rights, export_file_to_sb(), export_vnode_to_sb(), fddrop(), fdhold(), export_fd_buf::fdp, FILEDESC_FOREACH_FP, export_fd_buf::flags, flags, free(), malloc(), pddrop(), pdhold(), export_fd_buf::pdp, pwd_drop(), pwd_hold_pwddesc(), export_fd_buf::remainder, export_fd_buf::sb, and vrefact().
Referenced by note_procstat_files(), and sysctl_kern_proc_filedesc().
MALLOC_DECLARE | ( | M_FADVISE | ) |
MALLOC_DEFINE | ( | M_FILECAPS | , |
"filecaps" | , | ||
"descriptor capabilities" | |||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
void mountcheckdirs | ( | struct vnode * | olddp, |
struct vnode * | newdp | ||
) |
Definition at line 4020 of file kern_descrip.c.
References allprison, allprison_lock, allproc_lock, pddrop(), pdhold(), pr, prison0, pwd_alloc(), pwd_drop(), pwd_fill(), rootvnode, vrefact(), and vrele().
Referenced by kern_reroot(), and vfs_domount_first().
void pack_kinfo | ( | struct kinfo_file * | kif | ) |
Definition at line 4283 of file kern_descrip.c.
Referenced by export_file_to_kinfo(), export_vnode_to_kinfo(), and sysctl_posix_shm_list().
|
static |
Definition at line 5059 of file kern_descrip.c.
References badfileops, and vdrop().
|
static |
Definition at line 5052 of file kern_descrip.c.
struct pwddesc * pdcopy | ( | struct pwddesc * | pdp | ) |
Definition at line 2428 of file kern_descrip.c.
References pdinit().
Referenced by do_fork(), and pdunshare().
|
static |
Definition at line 2304 of file kern_descrip.c.
References free(), and pwd_drop().
Referenced by kern_proc_cwd_out(), kern_proc_filedesc_out(), mountcheckdirs(), pdescfree(), and pwd_hold_proc().
void pdescfree | ( | struct thread * | td | ) |
Definition at line 2593 of file kern_descrip.c.
References pddrop().
Referenced by exit1(), fork_norfproc(), and pdunshare().
|
static |
Definition at line 2279 of file kern_descrip.c.
Referenced by kern_proc_cwd_out(), kern_proc_filedesc_out(), mountcheckdirs(), and pwd_hold_proc().
struct pwddesc * pdinit | ( | struct pwddesc * | pdp, |
bool | keeplock | ||
) |
Definition at line 2226 of file kern_descrip.c.
References malloc(), pwd_alloc(), and pwd_hold_pwddesc().
Referenced by do_fork(), fork_norfproc(), pdcopy(), and proc0_init().
struct pwddesc * pdshare | ( | struct pwddesc * | pdp | ) |
Definition at line 2340 of file kern_descrip.c.
Referenced by do_fork().
void pdunshare | ( | struct thread * | td | ) |
Definition at line 2367 of file kern_descrip.c.
References pdcopy(), and pdescfree().
Referenced by do_execve(), and fork_norfproc().
|
static |
Definition at line 3832 of file kern_descrip.c.
References pwd_zone.
Referenced by mountcheckdirs(), pdinit(), pwd_chdir(), pwd_chroot(), pwd_chroot_chdir(), pwd_ensure_dirs(), and pwd_set_rootvnode().
void pwd_chdir | ( | struct thread * | td, |
struct vnode * | vp | ||
) |
Definition at line 3904 of file kern_descrip.c.
References pwd_alloc(), pwd_drop(), and pwd_fill().
Referenced by kern_chdir(), and sys_fchdir().
int pwd_chroot | ( | struct thread * | td, |
struct vnode * | vp | ||
) |
Definition at line 3863 of file kern_descrip.c.
References chroot_allow_open_directories, chroot_refuse_vdir_fds(), pwd_alloc(), pwd_drop(), pwd_fill(), rootvnode, and vrefact().
Referenced by sys_chroot().
int pwd_chroot_chdir | ( | struct thread * | td, |
struct vnode * | vp | ||
) |
Definition at line 3926 of file kern_descrip.c.
References chroot_refuse_vdir_fds(), pwd_alloc(), pwd_drop(), pwd_fill(), and vrefact().
Referenced by do_jail_attach().
void pwd_drop | ( | struct pwd * | pwd | ) |
Definition at line 3843 of file kern_descrip.c.
References pwd_zone, and vrele().
Referenced by cache_fplookup_partial_setup(), kern_proc_filedesc_out(), linker_root_mounted(), mountcheckdirs(), namei(), namei_emptypath(), namei_setup(), pddrop(), pwd_chdir(), pwd_chroot(), pwd_chroot_chdir(), pwd_ensure_dirs(), pwd_set_rootvnode(), vn_fullpath(), vn_fullpath_hardlink(), and vn_getcwd().
void pwd_ensure_dirs | ( | void | ) |
Definition at line 3963 of file kern_descrip.c.
References pwd_alloc(), pwd_drop(), pwd_fill(), rootvnode, and vrefact().
Referenced by set_rootvnode().
|
static |
Definition at line 3747 of file kern_descrip.c.
References vrefact().
Referenced by mountcheckdirs(), pwd_chdir(), pwd_chroot(), pwd_chroot_chdir(), pwd_ensure_dirs(), and pwd_set_rootvnode().
struct pwd * pwd_hold | ( | struct thread * | td | ) |
Definition at line 3790 of file kern_descrip.c.
References pwd_hold_pwddesc(), and pwd_hold_smr().
Referenced by linker_root_mounted(), namei_setup(), vn_fullpath(), vn_fullpath_hardlink(), and vn_getcwd().
struct pwd * pwd_hold_proc | ( | struct proc * | p | ) |
Definition at line 3812 of file kern_descrip.c.
References pddrop(), pdhold(), and pwd_hold_pwddesc().
struct pwd * pwd_hold_pwddesc | ( | struct pwddesc * | pdp | ) |
Definition at line 3767 of file kern_descrip.c.
Referenced by kern_proc_filedesc_out(), pdinit(), pwd_hold(), and pwd_hold_proc().
bool pwd_hold_smr | ( | struct pwd * | pwd | ) |
Definition at line 3779 of file kern_descrip.c.
Referenced by cache_fplookup_partial_setup(), and pwd_hold().
void pwd_set_rootvnode | ( | void | ) |
Definition at line 3995 of file kern_descrip.c.
References pwd_alloc(), pwd_drop(), pwd_fill(), rootvnode, and vrefact().
Referenced by set_rootvnode().
|
static |
Definition at line 1064 of file kern_descrip.c.
References crfree(), and free().
Referenced by fsetown(), funsetown(), and funsetownlst().
int sys_close | ( | struct thread * | td, |
struct close_args * | uap | ||
) |
Definition at line 1383 of file kern_descrip.c.
References close_args::fd, and kern_close().
int sys_close_range | ( | struct thread * | td, |
struct close_range_args * | uap | ||
) |
Definition at line 1499 of file kern_descrip.c.
References close_range_args::flags, close_range_args::highfd, kern_close_range(), and close_range_args::lowfd.
int sys_dup | ( | struct thread * | td, |
struct dup_args * | uap | ||
) |
Definition at line 396 of file kern_descrip.c.
References dup_args::fd, and kern_dup().
int sys_dup2 | ( | struct thread * | td, |
struct dup2_args * | uap | ||
) |
Definition at line 380 of file kern_descrip.c.
References dup2_args::from, kern_dup(), and dup2_args::to.
int sys_fcntl | ( | struct thread * | td, |
struct fcntl_args * | uap | ||
) |
Definition at line 414 of file kern_descrip.c.
References fcntl_args::arg, fcntl_args::cmd, fcntl_args::fd, and kern_fcntl_freebsd().
int sys_flock | ( | struct thread * | td, |
struct flock_args * | uap | ||
) |
Definition at line 3572 of file kern_descrip.c.
References cap_flock_rights, flock_args::fd, fget(), flock_args::how, and path_fileops.
int sys_fpathconf | ( | struct thread * | td, |
struct fpathconf_args * | uap | ||
) |
Definition at line 1672 of file kern_descrip.c.
References fpathconf_args::fd, kern_fpathconf(), fpathconf_args::name, and value.
int sys_fstat | ( | struct thread * | td, |
struct fstat_args * | uap | ||
) |
Definition at line 1593 of file kern_descrip.c.
References fstat_args::fd, kern_fstat(), and fstat_args::sb.
int sys_getdtablesize | ( | struct thread * | td, |
struct getdtablesize_args * | uap | ||
) |
Definition at line 349 of file kern_descrip.c.
References getmaxfd().
SYSCTL_INT | ( | _kern | , |
KERN_MAXFILES | , | ||
maxfiles | , | ||
CTLFLAG_RW | , | ||
& | maxfiles, | ||
0 | , | ||
"Maximum number of files" | |||
) |
SYSCTL_INT | ( | _kern | , |
KERN_MAXFILESPERPROC | , | ||
maxfilesperproc | , | ||
CTLFLAG_RW | , | ||
& | maxfilesperproc, | ||
0 | , | ||
"Maximum files allowed open per process" | |||
) |
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
chroot_allow_open_directories | , | ||
CTLFLAG_RW | , | ||
& | chroot_allow_open_directories, | ||
0 | , | ||
"Allow a process to chroot(2) if it has a directory open" | |||
) |
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
openfiles | , | ||
CTLFLAG_RD | , | ||
& | openfiles, | ||
0 | , | ||
"System-wide number of open files" | |||
) |
|
static |
Definition at line 4157 of file kern_descrip.c.
References allproc_lock, fddrop(), fdhold(), FILEDESC_FOREACH_FP, p_cansee(), and sysctl_wire_old_buffer().
|
static |
Definition at line 4762 of file kern_descrip.c.
References kern_proc_cwd_out(), name, pget(), sbuf_clear_flags(), sbuf_delete(), sbuf_finish(), and sbuf_new_for_sysctl().
|
static |
Definition at line 4526 of file kern_descrip.c.
References FILEDESC_SBUF_SIZE, kern_proc_filedesc_out(), name, pget(), sbuf_clear_flags(), sbuf_delete(), sbuf_finish(), and sbuf_new_for_sysctl().
|
static |
Definition at line 4123 of file kern_descrip.c.
|
static |
|
static |
|
static |
SYSCTL_PROC | ( | _kern | , |
KERN_FILE | , | ||
file | , | ||
CTLTYPE_OPAQUE|CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
0 | , | ||
0 | , | ||
sysctl_kern_file | , | ||
" | S, | ||
xfile" | , | ||
"Entire file table" | |||
) |
SYSINIT | ( | fildescdev | , |
SI_SUB_DRIVERS | , | ||
SI_ORDER_MIDDLE | , | ||
fildesc_drvinit | , | ||
NULL | |||
) |
SYSINIT | ( | select | , |
SI_SUB_LOCK | , | ||
SI_ORDER_FIRST | , | ||
filelistinit | , | ||
NULL | |||
) |
int vntype_to_kinfo | ( | int | vtype | ) |
Definition at line 4683 of file kern_descrip.c.
Referenced by kern_proc_vmmap_out(), and vn_fill_kinfo_vnode().
|
static |
Definition at line 4249 of file kern_descrip.c.
Referenced by export_file_to_kinfo(), and export_vnode_to_kinfo().
struct fileops badfileops |
Definition at line 5036 of file kern_descrip.c.
Referenced by _falloc_noinstall(), _fget(), fget_mmap(), fgetvp_rights(), getvnode_path(), kern_copy_file_range(), kern_fhopen(), kern_openat(), mqf_close(), namei_setup(), path_close(), pipe_close(), procdesc_close(), soo_close(), ttyhook_register(), vn_closefile(), and vn_open_vnode().
|
static |
Definition at line 3717 of file kern_descrip.c.
Referenced by pwd_chroot().
|
static |
Definition at line 5177 of file kern_descrip.c.
Referenced by fildesc_drvinit().
|
static |
Definition at line 103 of file kern_descrip.c.
Referenced by _falloc_noinstall(), _fdrop(), and filelistinit().
|
static |
Definition at line 104 of file kern_descrip.c.
Referenced by fddrop(), fdinit(), and filelistinit().
void __read_mostly(* mq_fdclose) (struct thread *td, int fd, struct file *fp) | ( | struct thread * | td, |
int | fd, | ||
struct file * | fp | ||
) |
Definition at line 201 of file kern_descrip.c.
Referenced by closefp_impl(), and mqfs_init().
|
static |
Definition at line 199 of file kern_descrip.c.
Referenced by _falloc_noinstall(), and _fdrop().
struct fileops path_fileops |
Definition at line 5067 of file kern_descrip.c.
Referenced by _fget(), aio_aqueue(), getvnode(), kern_fcntl(), kern_openat(), and sys_flock().
__read_mostly uma_zone_t pwd_zone |
Definition at line 105 of file kern_descrip.c.
Referenced by filelistinit(), pwd_alloc(), and pwd_drop().
struct mtx sigio_lock |
Definition at line 200 of file kern_descrip.c.
Referenced by filelistinit().
VFS_SMR_DECLARE |
Definition at line 106 of file kern_descrip.c.