Deleted Added
full compact
kern_descrip.c (108519) kern_descrip.c (108520)
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 108519 2003-01-01 00:35:46Z alfred $
39 * $FreeBSD: head/sys/kern/kern_descrip.c 108520 2003-01-01 01:01:14Z 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>

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

1197 LIST_REMOVE(fp, f_list);
1198 nfiles--;
1199 sx_xunlock(&filelist_lock);
1200 crfree(fp->f_cred);
1201 uma_zfree(file_zone, fp);
1202}
1203
1204/*
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>

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

1197 LIST_REMOVE(fp, f_list);
1198 nfiles--;
1199 sx_xunlock(&filelist_lock);
1200 crfree(fp->f_cred);
1201 uma_zfree(file_zone, fp);
1202}
1203
1204/*
1205 * Build a new filedesc structure.
1205 * Build a new filedesc structure from another.
1206 * Copy the current, root, and jail root vnode references.
1206 */
1207struct filedesc *
1207 */
1208struct filedesc *
1208fdinit(td)
1209 struct thread *td;
1209fdinit(fdp)
1210 struct filedesc *fdp;
1210{
1211 register struct filedesc0 *newfdp;
1211{
1212 register struct filedesc0 *newfdp;
1212 register struct filedesc *fdp = td->td_proc->p_fd;
1213
1214 MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0),
1215 M_FILEDESC, M_WAITOK | M_ZERO);
1216 mtx_init(&newfdp->fd_fd.fd_mtx, FILEDESC_LOCK_DESC, NULL, MTX_DEF);
1217 newfdp->fd_fd.fd_cdir = fdp->fd_cdir;
1218 if (newfdp->fd_fd.fd_cdir)
1219 VREF(newfdp->fd_fd.fd_cdir);
1220 newfdp->fd_fd.fd_rdir = fdp->fd_rdir;

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

1233 newfdp->fd_fd.fd_knlistsize = -1;
1234 return (&newfdp->fd_fd);
1235}
1236
1237/*
1238 * Share a filedesc structure.
1239 */
1240struct filedesc *
1213
1214 MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0),
1215 M_FILEDESC, M_WAITOK | M_ZERO);
1216 mtx_init(&newfdp->fd_fd.fd_mtx, FILEDESC_LOCK_DESC, NULL, MTX_DEF);
1217 newfdp->fd_fd.fd_cdir = fdp->fd_cdir;
1218 if (newfdp->fd_fd.fd_cdir)
1219 VREF(newfdp->fd_fd.fd_cdir);
1220 newfdp->fd_fd.fd_rdir = fdp->fd_rdir;

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

1233 newfdp->fd_fd.fd_knlistsize = -1;
1234 return (&newfdp->fd_fd);
1235}
1236
1237/*
1238 * Share a filedesc structure.
1239 */
1240struct filedesc *
1241fdshare(p)
1242 struct proc *p;
1241fdshare(fdp)
1242 struct filedesc *fdp;
1243{
1243{
1244 FILEDESC_LOCK(p->p_fd);
1245 p->p_fd->fd_refcnt++;
1246 FILEDESC_UNLOCK(p->p_fd);
1247 return (p->p_fd);
1244 FILEDESC_LOCK(fdp);
1245 fdp->fd_refcnt++;
1246 FILEDESC_UNLOCK(fdp);
1247 return (fdp);
1248}
1249
1250/*
1251 * Copy a filedesc structure.
1252 */
1253struct filedesc *
1254fdcopy(td)
1255 struct thread *td;

--- 1006 unchanged lines hidden ---
1248}
1249
1250/*
1251 * Copy a filedesc structure.
1252 */
1253struct filedesc *
1254fdcopy(td)
1255 struct thread *td;

--- 1006 unchanged lines hidden ---