kern_descrip.c (108521) | kern_descrip.c (108522) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 |
39 * $FreeBSD: head/sys/kern/kern_descrip.c 108521 2003-01-01 01:05:54Z alfred $ | 39 * $FreeBSD: head/sys/kern/kern_descrip.c 108522 2003-01-01 01:19:31Z alfred $ |
40 */ 41 42#include "opt_compat.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/syscallsubr.h> 47#include <sys/sysproto.h> --- 1196 unchanged lines hidden (view full) --- 1244 FILEDESC_LOCK(fdp); 1245 fdp->fd_refcnt++; 1246 FILEDESC_UNLOCK(fdp); 1247 return (fdp); 1248} 1249 1250/* 1251 * Copy a filedesc structure. | 40 */ 41 42#include "opt_compat.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/syscallsubr.h> 47#include <sys/sysproto.h> --- 1196 unchanged lines hidden (view full) --- 1244 FILEDESC_LOCK(fdp); 1245 fdp->fd_refcnt++; 1246 FILEDESC_UNLOCK(fdp); 1247 return (fdp); 1248} 1249 1250/* 1251 * Copy a filedesc structure. |
1252 * A NULL pointer in returns a NULL reference, this is to ease callers, 1253 * not catch errors. |
|
1252 */ 1253struct filedesc * | 1254 */ 1255struct filedesc * |
1254fdcopy(td) 1255 struct thread *td; | 1256fdcopy(fdp) 1257 struct filedesc *fdp; |
1256{ | 1258{ |
1257 struct filedesc *newfdp, *fdp; | 1259 struct filedesc *newfdp; |
1258 struct file **fpp; 1259 int i, j; 1260 1261 /* Certain daemons might not have file descriptors. */ | 1260 struct file **fpp; 1261 int i, j; 1262 1263 /* Certain daemons might not have file descriptors. */ |
1262 fdp = td->td_proc->p_fd; | |
1263 if (fdp == NULL) 1264 return (NULL); 1265 1266 FILEDESC_LOCK_ASSERT(fdp, MA_OWNED); 1267 1268 FILEDESC_UNLOCK(fdp); 1269 MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), 1270 M_FILEDESC, M_WAITOK); --- 991 unchanged lines hidden --- | 1264 if (fdp == NULL) 1265 return (NULL); 1266 1267 FILEDESC_LOCK_ASSERT(fdp, MA_OWNED); 1268 1269 FILEDESC_UNLOCK(fdp); 1270 MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), 1271 M_FILEDESC, M_WAITOK); --- 991 unchanged lines hidden --- |