FreeBSD kernel kern code
kern_descrip.c File Reference
#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>
Include dependency graph for kern_descrip.c:

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
 

Macro Definition Documentation

◆ FILEDESC_FOREACH_FDE

#define FILEDESC_FOREACH_FDE (   fdp,
  _iterator,
  _fde 
)
Value:
struct filedesc *_fdp = (fdp); \
int _lastfile = fdlastfile_single(_fdp); \
for (_iterator = 0; _iterator <= _lastfile; _iterator++) \
if ((_fde = &_fdp->fd_ofiles[_iterator])->fde_file != NULL)
int fdlastfile_single(struct filedesc *fdp)
Definition: kern_descrip.c:238

Definition at line 158 of file kern_descrip.c.

◆ FILEDESC_FOREACH_FP

#define FILEDESC_FOREACH_FP (   fdp,
  _iterator,
  _fp 
)
Value:
struct filedesc *_fdp = (fdp); \
int _lastfile = fdlastfile_single(_fdp); \
for (_iterator = 0; _iterator <= _lastfile; _iterator++) \
if ((_fp = _fdp->fd_ofiles[_iterator].fde_file) != NULL)

Definition at line 164 of file kern_descrip.c.

◆ FILEDESC_SBUF_SIZE

#define FILEDESC_SBUF_SIZE   (sizeof(struct kinfo_file) * 5)

Definition at line 4520 of file kern_descrip.c.

◆ NDBIT

#define NDBIT (   x)    ((NDSLOTTYPE)1 << ((x) % NDENTRIES))

Definition at line 155 of file kern_descrip.c.

◆ NDENTRIES

#define NDENTRIES   (NDSLOTSIZE * __CHAR_BIT)

Definition at line 153 of file kern_descrip.c.

◆ NDFILE

#define NDFILE   20

Definition at line 151 of file kern_descrip.c.

◆ NDSLOT

#define NDSLOT (   x)    ((x) / NDENTRIES)

Definition at line 154 of file kern_descrip.c.

◆ NDSLOTS

#define NDSLOTS (   x)    (((x) + NDENTRIES - 1) / NDENTRIES)

Definition at line 156 of file kern_descrip.c.

◆ NDSLOTSIZE

#define NDSLOTSIZE   sizeof(NDSLOTTYPE)

Definition at line 152 of file kern_descrip.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _falloc_noinstall()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _fdrop()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _fget()

static __inline int _fget ( struct thread *  td,
int  fd,
struct file **  fpp,
int  flags,
cap_rights_t *  needrightsp 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _fgetvp()

static __inline int _fgetvp ( struct thread *  td,
int  fd,
int  flags,
cap_rights_t *  needrightsp,
struct vnode **  vpp 
)
static

Definition at line 3448 of file kern_descrip.c.

References _fget(), fd, flags, and vref().

Referenced by fgetvp(), fgetvp_exec(), and fgetvp_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _finstall()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ badfo_chmod()

static int badfo_chmod ( struct file *  fp,
mode_t  mode,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 5005 of file kern_descrip.c.

◆ badfo_chown()

static int badfo_chown ( struct file *  fp,
uid_t  uid,
gid_t  gid,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 5013 of file kern_descrip.c.

◆ badfo_close()

static int badfo_close ( struct file *  fp,
struct thread *  td 
)
static

Definition at line 4998 of file kern_descrip.c.

◆ badfo_fill_kinfo()

static int badfo_fill_kinfo ( struct file *  fp,
struct kinfo_file *  kif,
struct filedesc *  fdp 
)
static

Definition at line 5030 of file kern_descrip.c.

◆ badfo_ioctl()

static int badfo_ioctl ( struct file *  fp,
u_long  com,
void *  data,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 4968 of file kern_descrip.c.

◆ badfo_kqfilter()

static int badfo_kqfilter ( struct file *  fp,
struct knote kn 
)
static

Definition at line 4984 of file kern_descrip.c.

◆ badfo_poll()

static int badfo_poll ( struct file *  fp,
int  events,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 4976 of file kern_descrip.c.

◆ badfo_readwrite()

static int badfo_readwrite ( struct file *  fp,
struct uio *  uio,
struct ucred *  active_cred,
int  flags,
struct thread *  td 
)
static

Definition at line 4952 of file kern_descrip.c.

◆ badfo_sendfile()

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

Definition at line 5021 of file kern_descrip.c.

◆ badfo_stat()

static int badfo_stat ( struct file *  fp,
struct stat *  sb,
struct ucred *  active_cred 
)
static

Definition at line 4991 of file kern_descrip.c.

◆ badfo_truncate()

static int badfo_truncate ( struct file *  fp,
off_t  length,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 4960 of file kern_descrip.c.

◆ chroot_refuse_vdir_fds()

static int chroot_refuse_vdir_fds ( struct filedesc *  fdp)
static

Definition at line 3728 of file kern_descrip.c.

References FILEDESC_FOREACH_FP.

Referenced by pwd_chroot(), and pwd_chroot_chdir().

Here is the caller graph for this function:

◆ close_range_cloexec()

static int close_range_cloexec ( struct thread *  td,
u_int  lowfd,
u_int  highfd 
)
static

Definition at line 1409 of file kern_descrip.c.

References fd.

Referenced by kern_close_range().

Here is the caller graph for this function:

◆ close_range_impl()

static int close_range_impl ( struct thread *  td,
u_int  lowfd,
u_int  highfd 
)
static

Definition at line 1435 of file kern_descrip.c.

References closefp(), fd, and fdfree().

Referenced by kern_close_range().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ closef()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ closef_nothread()

void closef_nothread ( struct file *  fp)

Definition at line 2830 of file kern_descrip.c.

Referenced by unp_discard(), and unp_process_defers().

Here is the caller graph for this function:

◆ closefp()

static int closefp ( struct filedesc *  fdp,
int  fd,
struct file *  fp,
struct thread *  td,
bool  holdleaders,
bool  audit 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ closefp_hl()

static int closefp_hl ( struct filedesc *  fdp,
int  fd,
struct file *  fp,
struct thread *  td,
bool  holdleaders,
bool  audit 
)
static

Definition at line 1326 of file kern_descrip.c.

References closefp_impl(), fd, and wakeup().

Referenced by closefp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ closefp_impl()

static int closefp_impl ( struct filedesc *  fdp,
int  fd,
struct file *  fp,
struct thread *  td,
bool  audit 
)
static

Definition at line 1285 of file kern_descrip.c.

References closef(), fd, knote_fdclose(), and mq_fdclose.

Referenced by closefp(), and closefp_hl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dupfdopen()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ export_file_to_kinfo()

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

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ export_file_to_sb()

static int export_file_to_sb ( struct file *  fp,
int  fd,
cap_rights_t *  rightsp,
struct export_fd_buf efbuf 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ export_kinfo_to_sb()

static int export_kinfo_to_sb ( struct export_fd_buf efbuf)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ export_vnode_to_kinfo()

static void export_vnode_to_kinfo ( struct vnode *  vp,
int  fd,
int  fflags,
struct kinfo_file *  kif,
int  flags 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ export_vnode_to_sb()

static int export_vnode_to_sb ( struct vnode *  vp,
int  fd,
int  fflags,
struct export_fd_buf efbuf 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ falloc_abort()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ falloc_caps()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fd_first_free()

static int fd_first_free ( struct filedesc *  fdp,
int  low,
int  size 
)
static

Definition at line 209 of file kern_descrip.c.

References mask, NDENTRIES, NDSLOT, and NDSLOTS.

Referenced by fdalloc().

Here is the caller graph for this function:

◆ fdalloc()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdallocn()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdcheckstd()

int fdcheckstd ( struct thread *  td)

Definition at line 2718 of file kern_descrip.c.

References kern_dup(), and kern_openat().

Referenced by do_execve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdclearlocks()

static void fdclearlocks ( struct thread *  td)
static

Definition at line 2445 of file kern_descrip.c.

References FILEDESC_FOREACH_FP, and free().

Referenced by fdescfree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdclose()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdcloseexec()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdcopy()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fddrop()

static void fddrop ( struct filedesc *  fdp)
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().

Here is the caller graph for this function:

◆ fdefree_last()

static void fdefree_last ( struct filedescent *  fde)
inlinestatic

Definition at line 315 of file kern_descrip.c.

References filecaps_free().

Referenced by fdescfree_fds(), and fdfree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdescfree()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdescfree_fds()

static void fdescfree_fds ( struct thread *  td,
struct filedesc *  fdp 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdfree()

static void fdfree ( struct filedesc *  fdp,
int  fd 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdgrowtable()

static void fdgrowtable ( struct filedesc *  fdp,
int  nfd 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdgrowtable_exp()

static void fdgrowtable_exp ( struct filedesc *  fdp,
int  nfd 
)
static

Definition at line 1856 of file kern_descrip.c.

References fdgrowtable().

Referenced by fdalloc(), and kern_dup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdhold()

static struct filedesc * fdhold ( struct proc *  p)
static

Definition at line 2267 of file kern_descrip.c.

Referenced by kern_proc_filedesc_out(), and sysctl_kern_file().

Here is the caller graph for this function:

◆ fdinit()

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().

Here is the caller graph for this function:

◆ fdisused()

static int fdisused ( struct filedesc *  fdp,
int  fd 
)
static

Definition at line 259 of file kern_descrip.c.

References fd, NDBIT, and NDSLOT.

Referenced by fdalloc(), fdunused(), fdused_init(), and kern_dup().

Here is the caller graph for this function:

◆ fdlastfile()

int fdlastfile ( struct filedesc *  fdp)

Definition at line 251 of file kern_descrip.c.

References fdlastfile_single().

Referenced by fdcopy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdlastfile_single()

int fdlastfile_single ( struct filedesc *  fdp)

Definition at line 238 of file kern_descrip.c.

References NDENTRIES, and NDSLOT.

Referenced by fdlastfile().

Here is the caller graph for this function:

◆ fdopen()

static int fdopen ( struct cdev *  dev,
int  mode,
int  type,
struct thread *  td 
)
static

Definition at line 5162 of file kern_descrip.c.

◆ fdsetugidsafety()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdshare()

struct filedesc * fdshare ( struct filedesc *  fdp)

Definition at line 2329 of file kern_descrip.c.

Referenced by do_fork().

Here is the caller graph for this function:

◆ fdunshare()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdunused()

static void fdunused ( struct filedesc *  fdp,
int  fd 
)
static

Definition at line 295 of file kern_descrip.c.

References fd, fdisused(), and NDSLOT.

Referenced by dupfdopen(), fdallocn(), and fdfree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdused()

static void fdused ( struct filedesc *  fdp,
int  fd 
)
static

Definition at line 281 of file kern_descrip.c.

References fd, and fdused_init().

Referenced by fdalloc(), and kern_dup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fdused_init()

static void fdused_init ( struct filedesc *  fdp,
int  fd 
)
static

Definition at line 272 of file kern_descrip.c.

References fd, fdisused(), NDBIT, and NDSLOT.

Referenced by fdcopy(), and fdused().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fget()

int fget ( struct thread *  td,
int  fd,
cap_rights_t *  rightsp,
struct file **  fpp 
)

◆ fget_cap()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fget_cap_noref()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fget_fcntl()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fget_mmap()

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().

Here is the call graph for this function:

◆ fget_only_user()

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().

Here is the caller graph for this function:

◆ fget_read()

int fget_read ( struct thread *  td,
int  fd,
cap_rights_t *  rightsp,
struct file **  fpp 
)

Definition at line 3395 of file kern_descrip.c.

References _fget(), and fd.

Referenced by aio_aqueue(), getmq_read(), kern_copy_file_range(), kern_preadv(), kern_readv(), and sendfile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fget_unlocked()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fget_unlocked_seq() [1/2]

static int fget_unlocked_seq ( struct thread *  td,
int  fd,
cap_rights_t *  needrightsp,
struct file **  fpp,
seqc_t *seqp  __unused 
)
static

Definition at line 3120 of file kern_descrip.c.

References fd.

◆ fget_unlocked_seq() [2/2]

static int fget_unlocked_seq ( struct thread *  td,
int  fd,
cap_rights_t *  needrightsp,
struct file **  fpp,
seqc_t *  seqp 
)
static

Referenced by fget_fcntl(), fget_mmap(), and fget_unlocked().

Here is the caller graph for this function:

◆ fget_write()

int fget_write ( struct thread *  td,
int  fd,
cap_rights_t *  rightsp,
struct file **  fpp 
)

Definition at line 3402 of file kern_descrip.c.

References _fget(), and fd.

Referenced by aio_aqueue(), getmq_write(), kern_copy_file_range(), kern_fspacectl(), kern_ptrace(), kern_pwritev(), and kern_writev().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fgetown()

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().

Here is the caller graph for this function:

◆ fgetvp()

int fgetvp ( struct thread *  td,
int  fd,
cap_rights_t *  rightsp,
struct vnode **  vpp 
)

Definition at line 3470 of file kern_descrip.c.

References _fgetvp(), and fd.

Here is the call graph for this function:

◆ fgetvp_exec()

int fgetvp_exec ( struct thread *  td,
int  fd,
cap_rights_t *  rightsp,
struct vnode **  vpp 
)

Definition at line 3516 of file kern_descrip.c.

References _fgetvp(), and fd.

Referenced by do_execve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fgetvp_lookup_smr()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fgetvp_read()

int fgetvp_read ( struct thread *  td,
int  fd,
cap_rights_t *  rightsp,
struct vnode **  vpp 
)

Definition at line 3509 of file kern_descrip.c.

References _fgetvp(), and fd.

Here is the call graph for this function:

◆ fgetvp_rights()

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().

Here is the call graph for this function:

◆ fildesc_drvinit()

static void fildesc_drvinit ( void *  unused)
static

Definition at line 5184 of file kern_descrip.c.

References fildesc_cdevsw, make_dev_alias(), and make_dev_credf().

Here is the call graph for this function:

◆ filecaps_copy()

bool filecaps_copy ( const struct filecaps *  src,
struct filecaps *  dst,
bool  locked 
)

Definition at line 1728 of file kern_descrip.c.

References malloc(), and src.

Referenced by fdcopy(), fget_cap_noref(), and unp_internalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filecaps_copy_finish()

static void filecaps_copy_finish ( const struct filecaps *  src,
struct filecaps *  dst,
u_long *  ioctls 
)
static

Definition at line 1765 of file kern_descrip.c.

References src.

Referenced by dupfdopen(), and kern_dup().

Here is the caller graph for this function:

◆ filecaps_copy_prep()

static u_long * filecaps_copy_prep ( const struct filecaps *  src)
static

Definition at line 1748 of file kern_descrip.c.

References malloc(), and src.

Referenced by dupfdopen(), and kern_dup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filecaps_fill()

static void filecaps_fill ( struct filecaps *  fcaps)
static

Definition at line 1796 of file kern_descrip.c.

Referenced by _finstall(), fget_cap(), and fgetvp_lookup_smr().

Here is the caller graph for this function:

◆ filecaps_free()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filecaps_free_finish()

static void filecaps_free_finish ( u_long *  ioctls)
static

Definition at line 1827 of file kern_descrip.c.

References free().

Referenced by kern_dup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filecaps_free_prep()

static u_long * filecaps_free_prep ( struct filecaps *  fcaps)
static

Definition at line 1817 of file kern_descrip.c.

Referenced by kern_dup().

Here is the caller graph for this function:

◆ filecaps_move()

void filecaps_move ( struct filecaps *  src,
struct filecaps *  dst 
)

Definition at line 1785 of file kern_descrip.c.

References src.

Referenced by _finstall().

Here is the caller graph for this function:

◆ filecaps_validate()

static void filecaps_validate ( const struct filecaps *  fcaps,
const char *  func 
)
static

Definition at line 1837 of file kern_descrip.c.

References cap_rights_is_valid().

Referenced by _finstall().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filedesc_to_leader_alloc()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filelistinit()

static void filelistinit ( void *  dummy)
static

Definition at line 4931 of file kern_descrip.c.

References file_zone, filedesc0_zone, pwd_zone, and sigio_lock.

◆ finit()

void finit ( struct file *  fp,
u_int  flag,
short  type,
void *  data,
struct fileops *  ops 
)

◆ finit_vnode()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finstall()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finstall_refed()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsetown()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ funsetown()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ funsetown_locked()

static struct sigio * funsetown_locked ( struct sigio *  sigio)
static

Definition at line 1071 of file kern_descrip.c.

Referenced by fsetown(), and funsetown().

Here is the caller graph for this function:

◆ funsetownlst()

void funsetownlst ( struct sigiolst *  sigiolst)

Definition at line 1123 of file kern_descrip.c.

References proctree_lock, and sigiofree().

Referenced by exit1(), and pgdelete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getmaxfd()

static int getmaxfd ( struct thread *  td)
static

Definition at line 916 of file kern_descrip.c.

References lim_cur(), and maxfilesperproc.

Referenced by fdalloc(), kern_dup(), and sys_getdtablesize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invfo_chmod()

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().

Here is the caller graph for this function:

◆ invfo_chown()

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().

Here is the caller graph for this function:

◆ invfo_ioctl()

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.

◆ invfo_kqfilter()

int invfo_kqfilter ( struct file *  fp,
struct knote kn 
)

Definition at line 5116 of file kern_descrip.c.

◆ invfo_poll()

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().

Here is the call graph for this function:

◆ invfo_rdwr()

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.

◆ invfo_sendfile()

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.

◆ invfo_truncate()

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().

Here is the caller graph for this function:

◆ is_unsafe()

static bool is_unsafe ( struct file *  fp)
static

Definition at line 2622 of file kern_descrip.c.

Referenced by fdsetugidsafety().

Here is the caller graph for this function:

◆ kern_close()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_close_range()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_dup()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_fcntl()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_fpathconf()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_fstat()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_proc_cwd_out()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_proc_filedesc_out()

int kern_proc_filedesc_out ( struct proc *  p,
struct sbuf *  sb,
ssize_t  maxlen,
int  flags 
)

◆ MALLOC_DECLARE()

MALLOC_DECLARE ( M_FADVISE  )

◆ MALLOC_DEFINE() [1/6]

MALLOC_DEFINE ( M_FILECAPS  ,
"filecaps"  ,
"descriptor capabilities"   
)

◆ MALLOC_DEFINE() [2/6]

static MALLOC_DEFINE ( M_FILEDESC  ,
"filedesc"  ,
"Open file descriptor table"   
)
static

◆ MALLOC_DEFINE() [3/6]

static MALLOC_DEFINE ( M_FILEDESC_TO_LEADER  ,
"filedesc_to_leader"  ,
"file desc to leader structures"   
)
static

◆ MALLOC_DEFINE() [4/6]

static MALLOC_DEFINE ( M_PWD  ,
"pwd"  ,
"Descriptor table vnodes"   
)
static

◆ MALLOC_DEFINE() [5/6]

static MALLOC_DEFINE ( M_PWDDESC  ,
"pwddesc"  ,
"Pwd descriptors"   
)
static

◆ MALLOC_DEFINE() [6/6]

static MALLOC_DEFINE ( M_SIGIO  ,
"sigio"  ,
"sigio structures"   
)
static

◆ mountcheckdirs()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pack_kinfo()

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().

Here is the caller graph for this function:

◆ path_close()

static int path_close ( struct file *  fp,
struct thread *  td 
)
static

Definition at line 5059 of file kern_descrip.c.

References badfileops, and vdrop().

Here is the call graph for this function:

◆ path_poll()

static int path_poll ( struct file *  fp,
int  events,
struct ucred *  active_cred,
struct thread *  td 
)
static

Definition at line 5052 of file kern_descrip.c.

◆ pdcopy()

struct pwddesc * pdcopy ( struct pwddesc *  pdp)

Definition at line 2428 of file kern_descrip.c.

References pdinit().

Referenced by do_fork(), and pdunshare().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pddrop()

static void pddrop ( struct pwddesc *  pdp)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pdescfree()

void pdescfree ( struct thread *  td)

Definition at line 2593 of file kern_descrip.c.

References pddrop().

Referenced by exit1(), fork_norfproc(), and pdunshare().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pdhold()

static struct pwddesc * pdhold ( struct proc *  p)
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().

Here is the caller graph for this function:

◆ pdinit()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pdshare()

struct pwddesc * pdshare ( struct pwddesc *  pdp)

Definition at line 2340 of file kern_descrip.c.

Referenced by do_fork().

Here is the caller graph for this function:

◆ pdunshare()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pwd_alloc()

static struct pwd * pwd_alloc ( void  )
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().

Here is the caller graph for this function:

◆ pwd_chdir()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pwd_chroot()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pwd_chroot_chdir()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pwd_drop()

void pwd_drop ( struct pwd *  pwd)

◆ pwd_ensure_dirs()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pwd_fill()

static void pwd_fill ( struct pwd *  oldpwd,
struct pwd *  newpwd 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pwd_hold()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pwd_hold_proc()

struct pwd * pwd_hold_proc ( struct proc *  p)

Definition at line 3812 of file kern_descrip.c.

References pddrop(), pdhold(), and pwd_hold_pwddesc().

Here is the call graph for this function:

◆ 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().

Here is the caller graph for this function:

◆ pwd_hold_smr()

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().

Here is the caller graph for this function:

◆ pwd_set_rootvnode()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigiofree()

static void sigiofree ( struct sigio *  sigio)
static

Definition at line 1064 of file kern_descrip.c.

References crfree(), and free().

Referenced by fsetown(), funsetown(), and funsetownlst().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sys_close()

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().

Here is the call graph for this function:

◆ sys_close_range()

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.

Here is the call graph for this function:

◆ sys_dup()

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().

Here is the call graph for this function:

◆ sys_dup2()

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.

Here is the call graph for this function:

◆ sys_fcntl()

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().

Here is the call graph for this function:

◆ sys_flock()

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.

Here is the call graph for this function:

◆ sys_fpathconf()

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.

Here is the call graph for this function:

◆ sys_fstat()

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.

Here is the call graph for this function:

◆ sys_getdtablesize()

int sys_getdtablesize ( struct thread *  td,
struct getdtablesize_args uap 
)

Definition at line 349 of file kern_descrip.c.

References getmaxfd().

Here is the call graph for this function:

◆ SYSCTL_INT() [1/4]

SYSCTL_INT ( _kern  ,
KERN_MAXFILES  ,
maxfiles  ,
CTLFLAG_RW  ,
maxfiles,
,
"Maximum number of files"   
)

◆ SYSCTL_INT() [2/4]

SYSCTL_INT ( _kern  ,
KERN_MAXFILESPERPROC  ,
maxfilesperproc  ,
CTLFLAG_RW  ,
maxfilesperproc,
,
"Maximum files allowed open per process"   
)

◆ SYSCTL_INT() [3/4]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
chroot_allow_open_directories  ,
CTLFLAG_RW  ,
chroot_allow_open_directories,
,
"Allow a process to chroot(2) if it has a directory open"   
)

◆ SYSCTL_INT() [4/4]

SYSCTL_INT ( _kern  ,
OID_AUTO  ,
openfiles  ,
CTLFLAG_RD  ,
openfiles,
,
"System-wide number of open files"   
)

◆ sysctl_kern_file()

static int sysctl_kern_file ( SYSCTL_HANDLER_ARGS  )
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().

Here is the call graph for this function:

◆ sysctl_kern_proc_cwd()

static int sysctl_kern_proc_cwd ( SYSCTL_HANDLER_ARGS  )
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().

Here is the call graph for this function:

◆ sysctl_kern_proc_filedesc()

static int sysctl_kern_proc_filedesc ( SYSCTL_HANDLER_ARGS  )
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().

Here is the call graph for this function:

◆ sysctl_kern_proc_nfds()

static int sysctl_kern_proc_nfds ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 4123 of file kern_descrip.c.

References count, and NDSLOT.

◆ SYSCTL_NODE() [1/3]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_CWD  ,
cwd  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_cwd  ,
"Process current working directory"   
)
static

◆ SYSCTL_NODE() [2/3]

static SYSCTL_NODE ( _kern_proc  ,
KERN_PROC_FILEDESC  ,
filedesc  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
sysctl_kern_proc_filedesc  ,
"Process filedesc entries"   
)
static

◆ SYSCTL_NODE() [3/3]

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

◆ SYSCTL_PROC()

SYSCTL_PROC ( _kern  ,
KERN_FILE  ,
file  ,
CTLTYPE_OPAQUE|CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
,
sysctl_kern_file  ,
S,
xfile"  ,
"Entire file table"   
)

◆ SYSINIT() [1/2]

SYSINIT ( fildescdev  ,
SI_SUB_DRIVERS  ,
SI_ORDER_MIDDLE  ,
fildesc_drvinit  ,
NULL   
)

◆ SYSINIT() [2/2]

SYSINIT ( select  ,
SI_SUB_LOCK  ,
SI_ORDER_FIRST  ,
filelistinit  ,
NULL   
)

◆ vntype_to_kinfo()

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().

Here is the caller graph for this function:

◆ xlate_fflags()

static int xlate_fflags ( int  fflags)
static

Definition at line 4249 of file kern_descrip.c.

Referenced by export_file_to_kinfo(), and export_vnode_to_kinfo().

Here is the caller graph for this function:

Variable Documentation

◆ badfileops

struct fileops badfileops
Initial value:
= {
.fo_read = badfo_readwrite,
.fo_write = badfo_readwrite,
.fo_truncate = badfo_truncate,
.fo_ioctl = badfo_ioctl,
.fo_poll = badfo_poll,
.fo_kqfilter = badfo_kqfilter,
.fo_stat = badfo_stat,
.fo_close = badfo_close,
.fo_chmod = badfo_chmod,
.fo_chown = badfo_chown,
.fo_sendfile = badfo_sendfile,
.fo_fill_kinfo = badfo_fill_kinfo,
}
static int badfo_poll(struct file *fp, int events, 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_kqfilter(struct file *fp, struct knote *kn)
static int badfo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
static int badfo_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, struct thread *td)
static int badfo_readwrite(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td)
static int badfo_stat(struct file *fp, struct stat *sb, struct ucred *active_cred)
static int badfo_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td)
static int badfo_close(struct file *fp, 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_truncate(struct file *fp, off_t length, struct ucred *active_cred, struct thread *td)

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().

◆ chroot_allow_open_directories

int chroot_allow_open_directories = 1
static

Definition at line 3717 of file kern_descrip.c.

Referenced by pwd_chroot().

◆ fildesc_cdevsw

struct cdevsw fildesc_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_open = fdopen,
.d_name = "FD",
}
static int fdopen(struct cdev *dev, int mode, int type, struct thread *td)

Definition at line 5177 of file kern_descrip.c.

Referenced by fildesc_drvinit().

◆ file_zone

__read_mostly uma_zone_t file_zone
static

Definition at line 103 of file kern_descrip.c.

Referenced by _falloc_noinstall(), _fdrop(), and filelistinit().

◆ filedesc0_zone

__read_mostly uma_zone_t filedesc0_zone
static

Definition at line 104 of file kern_descrip.c.

Referenced by fddrop(), fdinit(), and filelistinit().

◆ mq_fdclose

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().

◆ openfiles

int __exclusive_cache_line openfiles
static

Definition at line 199 of file kern_descrip.c.

Referenced by _falloc_noinstall(), and _fdrop().

◆ path_fileops

struct fileops path_fileops
Initial value:
= {
.fo_read = badfo_readwrite,
.fo_write = badfo_readwrite,
.fo_truncate = badfo_truncate,
.fo_ioctl = badfo_ioctl,
.fo_poll = path_poll,
.fo_kqfilter = vn_kqfilter_opath,
.fo_stat = vn_statfile,
.fo_close = path_close,
.fo_chmod = badfo_chmod,
.fo_chown = badfo_chown,
.fo_sendfile = badfo_sendfile,
.fo_fill_kinfo = vn_fill_kinfo,
.fo_flags = DFLAG_PASSABLE,
}
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 vn_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
Definition: vfs_vnops.c:2631
int vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred)
Definition: vfs_vnops.c:1673
int vn_kqfilter_opath(struct file *fp, struct knote *kn)
Definition: vfs_vnops.c:2186

Definition at line 5067 of file kern_descrip.c.

Referenced by _fget(), aio_aqueue(), getvnode(), kern_fcntl(), kern_openat(), and sys_flock().

◆ pwd_zone

__read_mostly uma_zone_t pwd_zone

Definition at line 105 of file kern_descrip.c.

Referenced by filelistinit(), pwd_alloc(), and pwd_drop().

◆ sigio_lock

struct mtx sigio_lock

Definition at line 200 of file kern_descrip.c.

Referenced by filelistinit().

◆ VFS_SMR_DECLARE

VFS_SMR_DECLARE

Definition at line 106 of file kern_descrip.c.