FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/filio.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/ttycom.h>
#include <sys/stat.h>
#include <sys/malloc.h>
#include <sys/poll.h>
#include <sys/selinfo.h>
#include <sys/signalvar.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/pipe.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/uio.h>
#include <sys/user.h>
#include <sys/event.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_object.h>
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/uma.h>
Go to the source code of this file.
Macros | |
#define | PIPE_PEER(pipe) (((pipe)->pipe_type & PIPE_TYPE_NAMED) ? (pipe) : ((pipe)->pipe_peer)) |
#define | MINPIPESIZE (PIPE_SIZE/3) |
#define | MAXPIPESIZE (2*PIPE_SIZE/3) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | filt_pipedetach (struct knote *kn) |
static void | filt_pipedetach_notsup (struct knote *kn) |
static int | filt_pipenotsup (struct knote *kn, long hint) |
static int | filt_piperead (struct knote *kn, long hint) |
static int | filt_pipewrite (struct knote *kn, long hint) |
SYSCTL_LONG (_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN|CTLFLAG_NOFETCH, &maxpipekva, 0, "Pipe KVA limit") | |
SYSCTL_LONG (_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD, &amountpipekva, 0, "Pipe KVA usage") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, pipefragretry, CTLFLAG_RD, &pipefragretry, 0, "Pipe allocation retries due to fragmentation") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, pipeallocfail, CTLFLAG_RD, &pipeallocfail, 0, "Pipe allocation failures") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, piperesizefail, CTLFLAG_RD, &piperesizefail, 0, "Pipe resize failures") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, piperesizeallowed, CTLFLAG_RW, &piperesizeallowed, 0, "Pipe resizing allowed") | |
static void | pipeinit (void *dummy __unused) |
static void | pipeclose (struct pipe *cpipe) |
static void | pipe_free_kmem (struct pipe *cpipe) |
static int | pipe_create (struct pipe *pipe, bool backing) |
static int | pipe_paircreate (struct thread *td, struct pipepair **p_pp) |
static __inline int | pipelock (struct pipe *cpipe, int catch) |
static __inline void | pipeunlock (struct pipe *cpipe) |
static void | pipe_timestamp (struct timespec *tsp) |
static int | pipe_build_write_buffer (struct pipe *wpipe, struct uio *uio) |
static void | pipe_destroy_write_buffer (struct pipe *wpipe) |
static int | pipe_direct_write (struct pipe *wpipe, struct uio *uio) |
static void | pipe_clone_write_buffer (struct pipe *wpipe) |
static int | pipespace (struct pipe *cpipe, int size) |
static int | pipespace_new (struct pipe *cpipe, int size) |
static int | pipe_zone_ctor (void *mem, int size, void *arg, int flags) |
static int | pipe_zone_init (void *mem, int size, int flags) |
static void | pipe_zone_fini (void *mem, int size) |
SYSINIT (vfs, SI_SUB_VFS, SI_ORDER_ANY, pipeinit, NULL) | |
static int | sysctl_handle_pipe_mindirect (SYSCTL_HANDLER_ARGS) |
SYSCTL_OID (_kern_ipc, OID_AUTO, pipe_mindirect, CTLTYPE_LONG|CTLFLAG_RW, &pipe_mindirect, 0, sysctl_handle_pipe_mindirect, "L", "Minimum write size triggering VM optimization") | |
int | pipe_named_ctor (struct pipe **ppipe, struct thread *td) |
void | pipe_dtor (struct pipe *dpipe) |
int | kern_pipe (struct thread *td, int fildes[2], int flags, struct filecaps *fcaps1, struct filecaps *fcaps2) |
int | sys_pipe2 (struct thread *td, struct pipe2_args *uap) |
void | pipeselwakeup (struct pipe *cpipe) |
static int | pipe_read (struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) |
static int | pipe_write (struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) |
static int | pipe_truncate (struct file *fp, off_t length, struct ucred *active_cred, struct thread *td) |
static int | pipe_ioctl (struct file *fp, u_long cmd, void *data, struct ucred *active_cred, struct thread *td) |
static int | pipe_poll (struct file *fp, int events, struct ucred *active_cred, struct thread *td) |
static int | pipe_stat (struct file *fp, struct stat *ub, struct ucred *active_cred) |
static int | pipe_close (struct file *fp, struct thread *td) |
static int | pipe_chmod (struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td) |
static int | pipe_chown (struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, struct thread *td) |
static int | pipe_fill_kinfo (struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) |
static int | pipe_kqfilter (struct file *fp, struct knote *kn) |
Variables | |
static fo_rdwr_t | pipe_read |
static fo_rdwr_t | pipe_write |
static fo_truncate_t | pipe_truncate |
static fo_ioctl_t | pipe_ioctl |
static fo_poll_t | pipe_poll |
static fo_kqfilter_t | pipe_kqfilter |
static fo_stat_t | pipe_stat |
static fo_close_t | pipe_close |
static fo_chmod_t | pipe_chmod |
static fo_chown_t | pipe_chown |
static fo_fill_kinfo_t | pipe_fill_kinfo |
struct fileops | pipeops |
static struct filterops | pipe_nfiltops |
static struct filterops | pipe_rfiltops |
static struct filterops | pipe_wfiltops |
static long | amountpipekva |
static int | pipefragretry |
static int | pipeallocfail |
static int | piperesizefail |
static int | piperesizeallowed = 1 |
static long | pipe_mindirect = PIPE_MINDIRECT |
static uma_zone_t | pipe_zone |
static struct unrhdr64 | pipeino_unr |
static dev_t | pipedev_ino |
#define MAXPIPESIZE (2*PIPE_SIZE/3) |
Definition at line 205 of file sys_pipe.c.
#define MINPIPESIZE (PIPE_SIZE/3) |
Definition at line 204 of file sys_pipe.c.
#define PIPE_PEER | ( | pipe | ) | (((pipe)->pipe_type & PIPE_TYPE_NAMED) ? (pipe) : ((pipe)->pipe_peer)) |
Definition at line 142 of file sys_pipe.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 1769 of file sys_pipe.c.
References knlist_remove().
|
static |
Definition at line 1834 of file sys_pipe.c.
|
static |
Definition at line 1840 of file sys_pipe.c.
|
static |
Definition at line 1780 of file sys_pipe.c.
|
static |
Definition at line 1802 of file sys_pipe.c.
int kern_pipe | ( | struct thread * | td, |
int | fildes[2], | ||
int | flags, | ||
struct filecaps * | fcaps1, | ||
struct filecaps * | fcaps2 | ||
) |
Definition at line 469 of file sys_pipe.c.
References falloc_caps(), fd, fdclose(), finit(), flags, pipe_paircreate(), pipeclose(), and pipeops.
Referenced by sys_pipe2().
|
static |
Definition at line 896 of file sys_pipe.c.
Referenced by pipe_direct_write().
|
static |
Definition at line 1577 of file sys_pipe.c.
References invfo_chmod(), mode, and vn_chmod().
|
static |
Definition at line 1591 of file sys_pipe.c.
References invfo_chown(), and vn_chown().
|
static |
Definition at line 961 of file sys_pipe.c.
References pipe_destroy_write_buffer().
Referenced by pipe_direct_write().
|
static |
Definition at line 1565 of file sys_pipe.c.
References badfileops, pipe_dtor(), and vnops.
|
static |
Definition at line 703 of file sys_pipe.c.
References amountpipekva, maxpipekva, pipeino_unr, and pipespace_new().
Referenced by pipe_paircreate().
|
static |
Definition at line 941 of file sys_pipe.c.
Referenced by pipe_clone_write_buffer(), and pipe_direct_write().
|
static |
Definition at line 1003 of file sys_pipe.c.
References pipe_build_write_buffer(), pipe_clone_write_buffer(), pipe_destroy_write_buffer(), pipelock(), pipeselwakeup(), pipeunlock(), and wakeup().
Referenced by pipe_write().
void pipe_dtor | ( | struct pipe * | dpipe | ) |
Definition at line 437 of file sys_pipe.c.
References funsetown(), and pipeclose().
Referenced by pipe_close().
|
static |
Definition at line 1606 of file sys_pipe.c.
References vn_fill_kinfo().
|
static |
Definition at line 1621 of file sys_pipe.c.
References amountpipekva.
Referenced by pipe_paircreate(), pipeclose(), and pipespace_new().
|
static |
Definition at line 1369 of file sys_pipe.c.
References data, fgetown(), and fsetown().
|
static |
Definition at line 1721 of file sys_pipe.c.
References knlist_add(), pipe_nfiltops, PIPE_PEER, pipe_rfiltops, pipe_wfiltops, and vnops.
int pipe_named_ctor | ( | struct pipe ** | ppipe, |
struct thread * | td | ||
) |
Definition at line 423 of file sys_pipe.c.
References pipe_paircreate().
|
static |
Definition at line 364 of file sys_pipe.c.
References knlist_destroy(), knlist_init_mtx(), pipe_create(), pipe_free_kmem(), and pipe_zone.
Referenced by kern_pipe(), and pipe_named_ctor().
|
static |
Definition at line 1440 of file sys_pipe.c.
References PIPE_PEER, and selrecord().
|
static |
Definition at line 716 of file sys_pipe.c.
References amountpipekva, maxpipekva, MINPIPESIZE, pipe_timestamp(), pipelock(), piperesizeallowed, pipeselwakeup(), pipespace(), pipeunlock(), uiomove(), and wakeup().
|
static |
Definition at line 1518 of file sys_pipe.c.
References pipedev_ino, and vnops.
|
static |
Definition at line 458 of file sys_pipe.c.
References getnanotime().
Referenced by pipe_read(), pipe_write(), and pipe_zone_ctor().
|
static |
Definition at line 1351 of file sys_pipe.c.
References invfo_truncate(), and vnops.
|
static |
Definition at line 1086 of file sys_pipe.c.
References amountpipekva, maxpipekva, pipe_direct_write(), pipe_mindirect, PIPE_PEER, pipe_timestamp(), pipelock(), piperesizeallowed, pipeselwakeup(), pipespace(), pipeunlock(), uiomove(), and wakeup().
|
static |
Definition at line 291 of file sys_pipe.c.
References pipe_timestamp().
Referenced by pipeinit().
|
static |
Definition at line 352 of file sys_pipe.c.
Referenced by pipeinit().
|
static |
Definition at line 339 of file sys_pipe.c.
Referenced by pipeinit().
|
static |
Definition at line 1647 of file sys_pipe.c.
References knlist_destroy(), pipe_free_kmem(), pipe_zone, pipelock(), pipeselwakeup(), pipeunlock(), seldrain(), and wakeup().
Referenced by kern_pipe(), and pipe_dtor().
|
static |
Definition at line 255 of file sys_pipe.c.
References pipe_zone, pipe_zone_ctor(), pipe_zone_fini(), pipe_zone_init(), pipedev_ino, and pipeino_unr.
|
static |
Definition at line 640 of file sys_pipe.c.
Referenced by pipe_direct_write(), pipe_read(), pipe_write(), and pipeclose().
void pipeselwakeup | ( | struct pipe * | cpipe | ) |
Definition at line 684 of file sys_pipe.c.
References pgsigio(), and selwakeuppri().
Referenced by pipe_direct_write(), pipe_read(), pipe_write(), and pipeclose().
|
static |
Definition at line 628 of file sys_pipe.c.
References pipespace_new().
Referenced by pipe_read(), and pipe_write().
|
static |
Definition at line 563 of file sys_pipe.c.
References amountpipekva, pipe_free_kmem(), pipeallocfail, pipefragretry, piperesizefail, ppsratecheck(), and printf().
Referenced by pipe_create(), and pipespace().
|
static |
Definition at line 668 of file sys_pipe.c.
References wakeup_one().
Referenced by pipe_direct_write(), pipe_read(), pipe_write(), and pipeclose().
int sys_pipe2 | ( | struct thread * | td, |
struct pipe2_args * | uap | ||
) |
Definition at line 539 of file sys_pipe.c.
References kern_close(), and kern_pipe().
|
static |
Definition at line 268 of file sys_pipe.c.
References pipe_mindirect, and sysctl_handle_long().
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
pipeallocfail | , | ||
CTLFLAG_RD | , | ||
& | pipeallocfail, | ||
0 | , | ||
"Pipe allocation failures" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
pipefragretry | , | ||
CTLFLAG_RD | , | ||
& | pipefragretry, | ||
0 | , | ||
"Pipe allocation retries due to fragmentation" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
piperesizeallowed | , | ||
CTLFLAG_RW | , | ||
& | piperesizeallowed, | ||
0 | , | ||
"Pipe resizing allowed" | |||
) |
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
piperesizefail | , | ||
CTLFLAG_RD | , | ||
& | piperesizefail, | ||
0 | , | ||
"Pipe resize failures" | |||
) |
SYSCTL_LONG | ( | _kern_ipc | , |
OID_AUTO | , | ||
maxpipekva | , | ||
CTLFLAG_RDTUN| | CTLFLAG_NOFETCH, | ||
& | maxpipekva, | ||
0 | , | ||
"Pipe KVA limit" | |||
) |
SYSCTL_LONG | ( | _kern_ipc | , |
OID_AUTO | , | ||
pipekva | , | ||
CTLFLAG_RD | , | ||
& | amountpipekva, | ||
0 | , | ||
"Pipe KVA usage" | |||
) |
SYSCTL_OID | ( | _kern_ipc | , |
OID_AUTO | , | ||
pipe_mindirect | , | ||
CTLTYPE_LONG| | CTLFLAG_RW, | ||
& | pipe_mindirect, | ||
0 | , | ||
sysctl_handle_pipe_mindirect | , | ||
"L" | , | ||
"Minimum write size triggering VM optimization" | |||
) |
SYSINIT | ( | vfs | , |
SI_SUB_VFS | , | ||
SI_ORDER_ANY | , | ||
pipeinit | , | ||
NULL | |||
) |
|
static |
Definition at line 207 of file sys_pipe.c.
Referenced by pipe_create(), pipe_free_kmem(), pipe_read(), pipe_write(), and pipespace_new().
|
static |
Definition at line 156 of file sys_pipe.c.
|
static |
Definition at line 157 of file sys_pipe.c.
|
static |
Definition at line 155 of file sys_pipe.c.
|
static |
Definition at line 158 of file sys_pipe.c.
|
static |
Definition at line 151 of file sys_pipe.c.
|
static |
Definition at line 153 of file sys_pipe.c.
|
static |
Definition at line 212 of file sys_pipe.c.
Referenced by pipe_write(), and sysctl_handle_pipe_mindirect().
|
static |
Definition at line 182 of file sys_pipe.c.
Referenced by pipe_kqfilter().
|
static |
Definition at line 152 of file sys_pipe.c.
|
static |
Definition at line 148 of file sys_pipe.c.
|
static |
Definition at line 187 of file sys_pipe.c.
Referenced by pipe_kqfilter().
|
static |
Definition at line 154 of file sys_pipe.c.
|
static |
Definition at line 150 of file sys_pipe.c.
|
static |
Definition at line 192 of file sys_pipe.c.
Referenced by pipe_kqfilter().
|
static |
Definition at line 149 of file sys_pipe.c.
|
static |
Definition at line 248 of file sys_pipe.c.
Referenced by pipe_paircreate(), pipeclose(), and pipeinit().
|
static |
Definition at line 209 of file sys_pipe.c.
Referenced by pipespace_new().
|
static |
Definition at line 250 of file sys_pipe.c.
Referenced by pipe_stat(), and pipeinit().
|
static |
Definition at line 208 of file sys_pipe.c.
Referenced by pipespace_new().
|
static |
Definition at line 249 of file sys_pipe.c.
Referenced by pipe_create(), and pipeinit().
struct fileops pipeops |
Definition at line 160 of file sys_pipe.c.
Referenced by kern_pipe().
|
static |
Definition at line 211 of file sys_pipe.c.
Referenced by pipe_read(), and pipe_write().
|
static |
Definition at line 210 of file sys_pipe.c.
Referenced by pipespace_new().