~kris/9p

9hist

add111cd3f842f79573dd50d3afb26d1ae34ea2b — David du Colombier 29 years ago 718b666
Plan 9 from Bell Labs 1997-04-14
2 files changed, 25 insertions(+), 21 deletions(-)

M port/pgrp.c
M port/qlock.c
M port/pgrp.c => port/pgrp.c +25 -20
@@ 72,22 72,23 @@ closepgrp(Pgrp *p)
{
	Mhead **h, **e, *f, *next;
	
	if(decref(p) == 0){
		qlock(&p->debug);
		p->pgrpid = -1;

		e = &p->mnthash[MNTHASH];
		for(h = p->mnthash; h < e; h++) {
			for(f = *h; f; f = next) {
				cclose(f->from);
				mountfree(f->mount);
				next = f->hash;
				free(f);
			}
	if(decref(p) != 0)
		return;

	qlock(&p->debug);
	p->pgrpid = -1;

	e = &p->mnthash[MNTHASH];
	for(h = p->mnthash; h < e; h++) {
		for(f = *h; f; f = next) {
			cclose(f->from);
			mountfree(f->mount);
			next = f->hash;
			free(f);
		}
		qunlock(&p->debug);
		free(p);
	}
	qunlock(&p->debug);
	free(p);
}

void


@@ 187,13 188,17 @@ closefgrp(Fgrp *f)
	int i;
	Chan *c;

	if(decref(f) == 0) {
		for(i = 0; i <= f->maxfd; i++)
			if(c = f->fd[i])
				cclose(c);
	if(f == 0)
		return;

		free(f);
	}
	if(decref(f) != 0)
		return;

	for(i = 0; i <= f->maxfd; i++)
		if(c = f->fd[i])
			cclose(c);

	free(f);
}

Mount*

M port/qlock.c => port/qlock.c +0 -1
@@ 4,7 4,6 @@
#include "dat.h"
#include "fns.h"


void
qlock(QLock *q)
{