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/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 | MINPIPESIZE (PIPE_SIZE/3) |
#define | MAXPIPESIZE (2*PIPE_SIZE/3) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
int | do_pipe (struct thread *td, int fildes[2], int flags) |
static void | filt_pipedetach (struct knote *kn) |
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,&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, int backing) |
static __inline int | pipelock (struct pipe *cpipe, int catch) |
static __inline void | pipeunlock (struct pipe *cpipe) |
static __inline void | pipeselwakeup (struct pipe *cpipe) |
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) | |
int | kern_pipe (struct thread *td, int fildes[2]) |
int | sys_pipe (struct thread *td, struct pipe_args *uap) |
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, struct thread *td) |
static int | pipe_close (struct file *fp, struct thread *td) |
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 struct fileops | pipeops |
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 uma_zone_t | pipe_zone |
static struct unrhdr * | pipeino_unr |
static dev_t | pipedev_ino |
#define MAXPIPESIZE (2*PIPE_SIZE/3) |
Definition at line 189 of file sys_pipe.c.
#define MINPIPESIZE (PIPE_SIZE/3) |
Definition at line 188 of file sys_pipe.c.
Referenced by pipe_read().
__FBSDID | ( | "$BSDSUniX$" | ) |
int do_pipe | ( | struct thread * | td, |
int | fildes[2], | ||
int | flags | ||
) |
Definition at line 335 of file sys_pipe.c.
References falloc(), fd, fdclose(), finit(), knlist_init_mtx(), pipe_create(), pipe_zone, pipeclose(), and pipeops.
Referenced by kern_pipe().
|
static |
Definition at line 1629 of file sys_pipe.c.
References knlist_remove().
|
static |
Definition at line 1642 of file sys_pipe.c.
|
static |
Definition at line 1667 of file sys_pipe.c.
int kern_pipe | ( | struct thread * | td, |
int | fildes[2] | ||
) |
Definition at line 328 of file sys_pipe.c.
References do_pipe().
Referenced by sys_pipe().
|
static |
Definition at line 770 of file sys_pipe.c.
Referenced by pipe_direct_write().
|
static |
Definition at line 831 of file sys_pipe.c.
References pipe_destroy_write_buffer().
Referenced by pipe_direct_write().
|
static |
Definition at line 1470 of file sys_pipe.c.
References badfileops, funsetown(), and pipeclose().
|
static |
Definition at line 571 of file sys_pipe.c.
References amountpipekva, maxpipekva, and pipespace_new().
Referenced by do_pipe().
|
static |
Definition at line 816 of file sys_pipe.c.
Referenced by pipe_clone_write_buffer(), and pipe_direct_write().
|
static |
Definition at line 871 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().
|
static |
Definition at line 1484 of file sys_pipe.c.
References amountpipekva.
Referenced by pipeclose(), and pipespace_new().
|
static |
Definition at line 1268 of file sys_pipe.c.
References fgetown(), and fsetown().
|
static |
Definition at line 1599 of file sys_pipe.c.
References knlist_add(), pipe_rfiltops, and pipe_wfiltops.
|
static |
Definition at line 1339 of file sys_pipe.c.
References selrecord().
|
static |
Definition at line 592 of file sys_pipe.c.
References amountpipekva, maxpipekva, MINPIPESIZE, pipelock(), piperesizeallowed, pipeselwakeup(), pipespace(), pipeunlock(), uiomove(), vfs_timestamp(), and wakeup().
|
static |
Definition at line 1407 of file sys_pipe.c.
References alloc_unr(), new_unr(), and pipedev_ino.
|
static |
Definition at line 1254 of file sys_pipe.c.
|
static |
Definition at line 970 of file sys_pipe.c.
References amountpipekva, maxpipekva, pipe_direct_write(), pipelock(), piperesizeallowed, pipeselwakeup(), pipespace(), pipeunlock(), uiomove(), vfs_timestamp(), and wakeup().
|
static |
Definition at line 251 of file sys_pipe.c.
References vfs_timestamp().
Referenced by pipeinit().
|
static |
Definition at line 312 of file sys_pipe.c.
References mtx_destroy().
Referenced by pipeinit().
|
static |
Definition at line 299 of file sys_pipe.c.
References mtx_init().
Referenced by pipeinit().
|
static |
Definition at line 1511 of file sys_pipe.c.
References free_unr(), knlist_destroy(), pipe_free_kmem(), pipe_zone, pipelock(), pipeselwakeup(), pipeunlock(), seldrain(), and wakeup().
Referenced by do_pipe(), and pipe_close().
|
static |
Definition at line 237 of file sys_pipe.c.
References new_unrhdr(), pipe_zone, pipe_zone_ctor(), pipe_zone_fini(), pipe_zone_init(), and pipedev_ino.
|
static |
Definition at line 513 of file sys_pipe.c.
Referenced by pipe_direct_write(), pipe_read(), pipe_write(), and pipeclose().
|
static |
Definition at line 551 of file sys_pipe.c.
References pgsigio(), and selwakeuppri().
Referenced by pipe_direct_write(), pipe_read(), pipe_write(), and pipeclose().
|
static |
Definition at line 499 of file sys_pipe.c.
References pipespace_new().
Referenced by pipe_read(), and pipe_write().
|
static |
Definition at line 431 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 536 of file sys_pipe.c.
References wakeup().
Referenced by pipe_direct_write(), pipe_read(), pipe_write(), and pipeclose().
int sys_pipe | ( | struct thread * | td, |
struct pipe_args * | uap | ||
) |
Definition at line 409 of file sys_pipe.c.
References kern_pipe().
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" | |||
) |
SYSCTL_LONG | ( | _kern_ipc | , |
OID_AUTO | , | ||
maxpipekva | , | ||
CTLFLAG_RDTUN | , | ||
& | maxpipekva, | ||
0 | , | ||
"Pipe KVA limit" | |||
) |
SYSCTL_LONG | ( | _kern_ipc | , |
OID_AUTO | , | ||
pipekva | , | ||
CTLFLAG_RD | , | ||
& | amountpipekva, | ||
0 | , | ||
"Pipe KVA usage" | |||
) |
SYSINIT | ( | vfs | , |
SI_SUB_VFS | , | ||
SI_ORDER_ANY | , | ||
pipeinit | , | ||
NULL | |||
) |
|
static |
Definition at line 191 of file sys_pipe.c.
Referenced by pipe_create(), pipe_free_kmem(), pipe_read(), pipe_write(), and pipespace_new().
|
static |
Definition at line 151 of file sys_pipe.c.
|
static |
Definition at line 147 of file sys_pipe.c.
|
static |
Definition at line 149 of file sys_pipe.c.
|
static |
Definition at line 148 of file sys_pipe.c.
|
static |
Definition at line 144 of file sys_pipe.c.
|
static |
Definition at line 171 of file sys_pipe.c.
Referenced by pipe_kqfilter().
|
static |
Definition at line 150 of file sys_pipe.c.
|
static |
Definition at line 146 of file sys_pipe.c.
|
static |
Definition at line 176 of file sys_pipe.c.
Referenced by pipe_kqfilter().
|
static |
Definition at line 145 of file sys_pipe.c.
|
static |
Definition at line 230 of file sys_pipe.c.
Referenced by do_pipe(), pipeclose(), and pipeinit().
|
static |
Definition at line 193 of file sys_pipe.c.
Referenced by pipespace_new().
|
static |
Definition at line 232 of file sys_pipe.c.
Referenced by pipe_stat(), and pipeinit().
|
static |
Definition at line 192 of file sys_pipe.c.
Referenced by pipespace_new().
|
static |
Definition at line 231 of file sys_pipe.c.
|
static |
Definition at line 153 of file sys_pipe.c.
Referenced by do_pipe().
|
static |
Definition at line 195 of file sys_pipe.c.
Referenced by pipe_read(), and pipe_write().
|
static |
Definition at line 194 of file sys_pipe.c.
Referenced by pipespace_new().