Deleted Added
full compact
kern_descrip.c (138832) kern_descrip.c (138835)
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.

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

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
35 */
36
37#include <sys/cdefs.h>
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.

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

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 138832 2004-12-14 07:20:03Z phk $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_descrip.c 138835 2004-12-14 08:23:18Z phk $");
39
40#include "opt_compat.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44
45#include <sys/conf.h>
46#include <sys/fcntl.h>

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

2251
2252 default:
2253 FILEDESC_UNLOCK(fdp);
2254 return (error);
2255 }
2256 /* NOTREACHED */
2257}
2258
39
40#include "opt_compat.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44
45#include <sys/conf.h>
46#include <sys/fcntl.h>

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

2251
2252 default:
2253 FILEDESC_UNLOCK(fdp);
2254 return (error);
2255 }
2256 /* NOTREACHED */
2257}
2258
2259/*
2260 * Scan all active processes to see if any of them have a current
2261 * or root directory of `olddp'. If so, replace them with the new
2262 * mount point.
2263 */
2264void
2265mountcheckdirs(olddp, newdp)
2266 struct vnode *olddp, *newdp;
2267{
2268 struct filedesc *fdp;
2269 struct proc *p;
2270 int nrele;
2271
2272 if (vrefcnt(olddp) == 1)
2273 return;
2274 sx_slock(&allproc_lock);
2275 LIST_FOREACH(p, &allproc, p_list) {
2276 mtx_lock(&fdesc_mtx);
2277 fdp = p->p_fd;
2278 if (fdp == NULL) {
2279 mtx_unlock(&fdesc_mtx);
2280 continue;
2281 }
2282 nrele = 0;
2283 FILEDESC_LOCK_FAST(fdp);
2284 if (fdp->fd_cdir == olddp) {
2285 vref(newdp);
2286 fdp->fd_cdir = newdp;
2287 nrele++;
2288 }
2289 if (fdp->fd_rdir == olddp) {
2290 vref(newdp);
2291 fdp->fd_rdir = newdp;
2292 nrele++;
2293 }
2294 FILEDESC_UNLOCK_FAST(fdp);
2295 mtx_unlock(&fdesc_mtx);
2296 while (nrele--)
2297 vrele(olddp);
2298 }
2299 sx_sunlock(&allproc_lock);
2300 if (rootvnode == olddp) {
2301 vrele(rootvnode);
2302 vref(newdp);
2303 rootvnode = newdp;
2304 }
2305}
2306
2259struct filedesc_to_leader *
2260filedesc_to_leader_alloc(struct filedesc_to_leader *old, struct filedesc *fdp, struct proc *leader)
2261{
2262 struct filedesc_to_leader *fdtol;
2263
2264 MALLOC(fdtol, struct filedesc_to_leader *,
2265 sizeof(struct filedesc_to_leader),
2266 M_FILEDESC_TO_LEADER,

--- 233 unchanged lines hidden ---
2307struct filedesc_to_leader *
2308filedesc_to_leader_alloc(struct filedesc_to_leader *old, struct filedesc *fdp, struct proc *leader)
2309{
2310 struct filedesc_to_leader *fdtol;
2311
2312 MALLOC(fdtol, struct filedesc_to_leader *,
2313 sizeof(struct filedesc_to_leader),
2314 M_FILEDESC_TO_LEADER,

--- 233 unchanged lines hidden ---