sys_pipe.c (109153) | sys_pipe.c (109623) |
---|---|
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 109153 2003-01-13 00:33:17Z dillon $ | 19 * $FreeBSD: head/sys/kern/sys_pipe.c 109623 2003-01-21 08:56:16Z alfred $ |
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 */ --- 173 unchanged lines hidden (view full) --- 201 struct filedesc *fdp = td->td_proc->p_fd; 202 struct file *rf, *wf; 203 struct pipe *rpipe, *wpipe; 204 struct mtx *pmtx; 205 int fd, error; 206 207 KASSERT(pipe_zone != NULL, ("pipe_zone not initialized")); 208 | 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 */ --- 173 unchanged lines hidden (view full) --- 201 struct filedesc *fdp = td->td_proc->p_fd; 202 struct file *rf, *wf; 203 struct pipe *rpipe, *wpipe; 204 struct mtx *pmtx; 205 int fd, error; 206 207 KASSERT(pipe_zone != NULL, ("pipe_zone not initialized")); 208 |
209 pmtx = malloc(sizeof(*pmtx), M_TEMP, M_WAITOK | M_ZERO); | 209 pmtx = malloc(sizeof(*pmtx), M_TEMP, M_ZERO); |
210 211 rpipe = wpipe = NULL; 212 if (pipe_create(&rpipe) || pipe_create(&wpipe)) { 213 pipeclose(rpipe); 214 pipeclose(wpipe); 215 free(pmtx, M_TEMP); 216 return (ENFILE); 217 } --- 123 unchanged lines hidden (view full) --- 341 */ 342static int 343pipe_create(cpipep) 344 struct pipe **cpipep; 345{ 346 struct pipe *cpipe; 347 int error; 348 | 210 211 rpipe = wpipe = NULL; 212 if (pipe_create(&rpipe) || pipe_create(&wpipe)) { 213 pipeclose(rpipe); 214 pipeclose(wpipe); 215 free(pmtx, M_TEMP); 216 return (ENFILE); 217 } --- 123 unchanged lines hidden (view full) --- 341 */ 342static int 343pipe_create(cpipep) 344 struct pipe **cpipep; 345{ 346 struct pipe *cpipe; 347 int error; 348 |
349 *cpipep = uma_zalloc(pipe_zone, M_WAITOK); | 349 *cpipep = uma_zalloc(pipe_zone, 0); |
350 if (*cpipep == NULL) 351 return (ENOMEM); 352 353 cpipe = *cpipep; 354 355 /* so pipespace()->pipe_free_kmem() doesn't follow junk pointer */ 356 cpipe->pipe_buffer.object = NULL; 357#ifndef PIPE_NODIRECT --- 1149 unchanged lines hidden --- | 350 if (*cpipep == NULL) 351 return (ENOMEM); 352 353 cpipe = *cpipep; 354 355 /* so pipespace()->pipe_free_kmem() doesn't follow junk pointer */ 356 cpipe->pipe_buffer.object = NULL; 357#ifndef PIPE_NODIRECT --- 1149 unchanged lines hidden --- |