sys_pipe.c (101987) | sys_pipe.c (102003) |
---|---|
1/* 2 * Copyright (c) 1996 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Absolutely no warranty of function or purpose is made by the author 15 * John S. Dyson. 16 * 4. Modifications may be freely made to this file if the above conditions 17 * are met. 18 * | 1/* 2 * Copyright (c) 1996 John S. Dyson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice immediately at the beginning of the file, without modification, 10 * this list of conditions, and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Absolutely no warranty of function or purpose is made by the author 15 * John S. Dyson. 16 * 4. Modifications may be freely made to this file if the above conditions 17 * are met. 18 * |
19 * $FreeBSD: head/sys/kern/sys_pipe.c 101987 2002-08-16 14:12:40Z rwatson $ | 19 * $FreeBSD: head/sys/kern/sys_pipe.c 102003 2002-08-17 02:36:16Z rwatson $ |
20 */ 21 22/* 23 * This file contains a high-performance replacement for the socket-based 24 * pipes scheme originally used in FreeBSD/4.4Lite. It does not support 25 * all features of sockets, but does do everything that pipes normally 26 * do. 27 */ --- 72 unchanged lines hidden (view full) --- 100 struct ucred *active_cred, int flags, struct thread *td); 101static int pipe_close(struct file *fp, struct thread *td); 102static int pipe_poll(struct file *fp, int events, struct ucred *active_cred, 103 struct thread *td); 104static int pipe_kqfilter(struct file *fp, struct knote *kn); 105static int pipe_stat(struct file *fp, struct stat *sb, 106 struct ucred *active_cred, struct thread *td); 107static int pipe_ioctl(struct file *fp, u_long cmd, void *data, | 20 */ 21 22/* 23 * This file contains a high-performance replacement for the socket-based 24 * pipes scheme originally used in FreeBSD/4.4Lite. It does not support 25 * all features of sockets, but does do everything that pipes normally 26 * do. 27 */ --- 72 unchanged lines hidden (view full) --- 100 struct ucred *active_cred, int flags, struct thread *td); 101static int pipe_close(struct file *fp, struct thread *td); 102static int pipe_poll(struct file *fp, int events, struct ucred *active_cred, 103 struct thread *td); 104static int pipe_kqfilter(struct file *fp, struct knote *kn); 105static int pipe_stat(struct file *fp, struct stat *sb, 106 struct ucred *active_cred, struct thread *td); 107static int pipe_ioctl(struct file *fp, u_long cmd, void *data, |
108 struct thread *td); | 108 struct ucred *active_cred, struct thread *td); |
109 110static struct fileops pipeops = { 111 pipe_read, pipe_write, pipe_ioctl, pipe_poll, pipe_kqfilter, 112 pipe_stat, pipe_close 113}; 114 115static void filt_pipedetach(struct knote *kn); 116static int filt_piperead(struct knote *kn, long hint); --- 1033 unchanged lines hidden (view full) --- 1150 PIPE_UNLOCK(rpipe); 1151 return (error); 1152} 1153 1154/* 1155 * we implement a very minimal set of ioctls for compatibility with sockets. 1156 */ 1157int | 109 110static struct fileops pipeops = { 111 pipe_read, pipe_write, pipe_ioctl, pipe_poll, pipe_kqfilter, 112 pipe_stat, pipe_close 113}; 114 115static void filt_pipedetach(struct knote *kn); 116static int filt_piperead(struct knote *kn, long hint); --- 1033 unchanged lines hidden (view full) --- 1150 PIPE_UNLOCK(rpipe); 1151 return (error); 1152} 1153 1154/* 1155 * we implement a very minimal set of ioctls for compatibility with sockets. 1156 */ 1157int |
1158pipe_ioctl(fp, cmd, data, td) | 1158pipe_ioctl(fp, cmd, data, active_cred, td) |
1159 struct file *fp; 1160 u_long cmd; 1161 void *data; | 1159 struct file *fp; 1160 u_long cmd; 1161 void *data; |
1162 struct ucred *active_cred; |
|
1162 struct thread *td; 1163{ 1164 struct pipe *mpipe = (struct pipe *)fp->f_data; 1165#ifdef MAC 1166 int error; 1167 1168 /* XXXMAC: Pipe should be locked for this check. */ | 1163 struct thread *td; 1164{ 1165 struct pipe *mpipe = (struct pipe *)fp->f_data; 1166#ifdef MAC 1167 int error; 1168 1169 /* XXXMAC: Pipe should be locked for this check. */ |
1169 error = mac_check_pipe_ioctl(td->td_ucred, mpipe, cmd, data); | 1170 error = mac_check_pipe_ioctl(active_cred, mpipe, cmd, data); |
1170 if (error) 1171 return (error); 1172#endif 1173 1174 switch (cmd) { 1175 1176 case FIONBIO: 1177 return (0); --- 327 unchanged lines hidden --- | 1171 if (error) 1172 return (error); 1173#endif 1174 1175 switch (cmd) { 1176 1177 case FIONBIO: 1178 return (0); --- 327 unchanged lines hidden --- |