Deleted Added
full compact
sys_pipe.c (47748) sys_pipe.c (49413)
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 * $Id: sys_pipe.c,v 1.51 1999/04/04 21:41:15 dt Exp $
19 * $Id: sys_pipe.c,v 1.52 1999/06/05 03:53:57 alc Exp $
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 */

--- 143 unchanged lines hidden (view full) ---

171 wpipe->pipe_state |= PIPE_DIRECTOK;
172
173 error = falloc(p, &rf, &fd);
174 if (error)
175 goto free2;
176 p->p_retval[0] = fd;
177 rf->f_flag = FREAD | FWRITE;
178 rf->f_type = DTYPE_PIPE;
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 */

--- 143 unchanged lines hidden (view full) ---

171 wpipe->pipe_state |= PIPE_DIRECTOK;
172
173 error = falloc(p, &rf, &fd);
174 if (error)
175 goto free2;
176 p->p_retval[0] = fd;
177 rf->f_flag = FREAD | FWRITE;
178 rf->f_type = DTYPE_PIPE;
179 rf->f_ops = &pipeops;
180 rf->f_data = (caddr_t)rpipe;
179 rf->f_data = (caddr_t)rpipe;
180 rf->f_ops = &pipeops;
181 error = falloc(p, &wf, &fd);
182 if (error)
183 goto free3;
184 wf->f_flag = FREAD | FWRITE;
185 wf->f_type = DTYPE_PIPE;
181 error = falloc(p, &wf, &fd);
182 if (error)
183 goto free3;
184 wf->f_flag = FREAD | FWRITE;
185 wf->f_type = DTYPE_PIPE;
186 wf->f_ops = &pipeops;
187 wf->f_data = (caddr_t)wpipe;
186 wf->f_data = (caddr_t)wpipe;
187 wf->f_ops = &pipeops;
188 p->p_retval[1] = fd;
189
190 rpipe->pipe_peer = wpipe;
191 wpipe->pipe_peer = rpipe;
192
193 return (0);
194free3:
188 p->p_retval[1] = fd;
189
190 rpipe->pipe_peer = wpipe;
191 wpipe->pipe_peer = rpipe;
192
193 return (0);
194free3:
195 ffree(rf);
196 fdp->fd_ofiles[p->p_retval[0]] = 0;
195 fdp->fd_ofiles[p->p_retval[0]] = 0;
196 ffree(rf);
197free2:
198 (void)pipeclose(wpipe);
199 (void)pipeclose(rpipe);
200 return (error);
201}
202
203/*
204 * Allocate kva for pipe circular buffer, the space is pageable

--- 829 unchanged lines hidden (view full) ---

1034/* ARGSUSED */
1035static int
1036pipe_close(fp, p)
1037 struct file *fp;
1038 struct proc *p;
1039{
1040 struct pipe *cpipe = (struct pipe *)fp->f_data;
1041
197free2:
198 (void)pipeclose(wpipe);
199 (void)pipeclose(rpipe);
200 return (error);
201}
202
203/*
204 * Allocate kva for pipe circular buffer, the space is pageable

--- 829 unchanged lines hidden (view full) ---

1034/* ARGSUSED */
1035static int
1036pipe_close(fp, p)
1037 struct file *fp;
1038 struct proc *p;
1039{
1040 struct pipe *cpipe = (struct pipe *)fp->f_data;
1041
1042 fp->f_ops = &badfileops;
1043 fp->f_data = NULL;
1042 funsetown(cpipe->pipe_sigio);
1043 pipeclose(cpipe);
1044 funsetown(cpipe->pipe_sigio);
1045 pipeclose(cpipe);
1044 fp->f_data = NULL;
1045 return 0;
1046}
1047
1048/*
1049 * shutdown the pipe
1050 */
1051static void
1052pipeclose(cpipe)

--- 50 unchanged lines hidden ---
1046 return 0;
1047}
1048
1049/*
1050 * shutdown the pipe
1051 */
1052static void
1053pipeclose(cpipe)

--- 50 unchanged lines hidden ---