Browse Source

Plan 9 from Bell Labs 2008-05-01

David du Colombier 12 years ago
parent
commit
35ff46d3a2

+ 0 - 0
386/bin/kprof


+ 4 - 4
dist/replica/_plan9.db

@@ -5547,7 +5547,7 @@ rc/bin/label - 775 sys sys 1173737765 189
 rc/bin/lc - 775 sys sys 945617207 24
 rc/bin/leak - 775 sys sys 1172760642 1921
 rc/bin/lookman - 775 sys sys 1186528516 687
-rc/bin/lp - 775 sys sys 1162105982 5201
+rc/bin/lp - 775 sys sys 1209583966 5273
 rc/bin/mail - 775 sys sys 1045504003 138
 rc/bin/man - 775 sys sys 1204738776 2654
 rc/bin/map - 775 sys sys 945617207 1576
@@ -6655,7 +6655,7 @@ sys/lib/lp/process - 20000000775 sys sys 1077670465 0
 sys/lib/lp/process/dpost - 775 sys sys 1015012079 2412
 sys/lib/lp/process/dvipost - 775 sys sys 954037459 3123
 sys/lib/lp/process/g3post - 775 sys sys 954037459 2348
-sys/lib/lp/process/generic - 775 sys sys 1204761143 4465
+sys/lib/lp/process/generic - 775 sys sys 1209583971 4395
 sys/lib/lp/process/gifpost - 775 sys sys 1015012079 2317
 sys/lib/lp/process/gspipe - 775 sys sys 1015012079 434
 sys/lib/lp/process/gspipeijs - 775 sys sys 1077670465 949
@@ -12737,7 +12737,7 @@ sys/src/cmd/look.c - 664 sys sys 944961619 5994
 sys/src/cmd/lp - 20000000775 sys sys 1039727564 0
 sys/src/cmd/lp/LOCK.c - 664 sys sys 1015090023 1066
 sys/src/cmd/lp/ipcopen.c - 664 sys sys 944961017 1607
-sys/src/cmd/lp/lp.rc - 775 sys sys 1162105978 5201
+sys/src/cmd/lp/lp.rc - 775 sys sys 1209583969 5273
 sys/src/cmd/lp/lpdaemon.c - 664 sys sys 1032060412 10000
 sys/src/cmd/lp/lpdsend.c - 664 sys sys 1116770113 9583
 sys/src/cmd/lp/lpsend.c - 664 sys sys 1015090024 6180
@@ -14827,7 +14827,7 @@ sys/src/libbio/bflush.c - 664 sys sys 964455730 479
 sys/src/libbio/bgetc.c - 664 sys sys 1064846001 948
 sys/src/libbio/bgetd.c - 664 sys sys 944961707 401
 sys/src/libbio/bgetrune.c - 664 sys sys 944961707 634
-sys/src/libbio/binit.c - 664 sys sys 1125317646 1857
+sys/src/libbio/binit.c - 664 sys sys 1209580916 1961
 sys/src/libbio/boffset.c - 664 sys sys 1036478806 360
 sys/src/libbio/bprint.c - 664 sys sys 1014927637 194
 sys/src/libbio/bputc.c - 664 sys sys 956275910 245

+ 4 - 4
dist/replica/plan9.db

@@ -5547,7 +5547,7 @@ rc/bin/label - 775 sys sys 1173737765 189
 rc/bin/lc - 775 sys sys 945617207 24
 rc/bin/leak - 775 sys sys 1172760642 1921
 rc/bin/lookman - 775 sys sys 1186528516 687
-rc/bin/lp - 775 sys sys 1162105982 5201
+rc/bin/lp - 775 sys sys 1209583966 5273
 rc/bin/mail - 775 sys sys 1045504003 138
 rc/bin/man - 775 sys sys 1204738776 2654
 rc/bin/map - 775 sys sys 945617207 1576
@@ -6655,7 +6655,7 @@ sys/lib/lp/process - 20000000775 sys sys 1077670465 0
 sys/lib/lp/process/dpost - 775 sys sys 1015012079 2412
 sys/lib/lp/process/dvipost - 775 sys sys 954037459 3123
 sys/lib/lp/process/g3post - 775 sys sys 954037459 2348
-sys/lib/lp/process/generic - 775 sys sys 1204761143 4465
+sys/lib/lp/process/generic - 775 sys sys 1209583971 4395
 sys/lib/lp/process/gifpost - 775 sys sys 1015012079 2317
 sys/lib/lp/process/gspipe - 775 sys sys 1015012079 434
 sys/lib/lp/process/gspipeijs - 775 sys sys 1077670465 949
@@ -12737,7 +12737,7 @@ sys/src/cmd/look.c - 664 sys sys 944961619 5994
 sys/src/cmd/lp - 20000000775 sys sys 1039727564 0
 sys/src/cmd/lp/LOCK.c - 664 sys sys 1015090023 1066
 sys/src/cmd/lp/ipcopen.c - 664 sys sys 944961017 1607
-sys/src/cmd/lp/lp.rc - 775 sys sys 1162105978 5201
+sys/src/cmd/lp/lp.rc - 775 sys sys 1209583969 5273
 sys/src/cmd/lp/lpdaemon.c - 664 sys sys 1032060412 10000
 sys/src/cmd/lp/lpdsend.c - 664 sys sys 1116770113 9583
 sys/src/cmd/lp/lpsend.c - 664 sys sys 1015090024 6180
@@ -14827,7 +14827,7 @@ sys/src/libbio/bflush.c - 664 sys sys 964455730 479
 sys/src/libbio/bgetc.c - 664 sys sys 1064846001 948
 sys/src/libbio/bgetd.c - 664 sys sys 944961707 401
 sys/src/libbio/bgetrune.c - 664 sys sys 944961707 634
-sys/src/libbio/binit.c - 664 sys sys 1125317646 1857
+sys/src/libbio/binit.c - 664 sys sys 1209580916 1961
 sys/src/libbio/boffset.c - 664 sys sys 1036478806 360
 sys/src/libbio/bprint.c - 664 sys sys 1014927637 194
 sys/src/libbio/bputc.c - 664 sys sys 956275910 245

+ 4 - 0
dist/replica/plan9.log

@@ -19080,3 +19080,7 @@
 1209425404 0 c sys/include/ndb.h - 664 sys sys 1209424114 4385
 1209441604 0 c 386/lib/libauthsrv.a - 664 sys sys 1209439929 36740
 1209441604 1 c 386/lib/libndb.a - 664 sys sys 1209439931 65780
+1209582009 0 c sys/src/libbio/binit.c - 664 sys sys 1209580916 1961
+1209583804 0 c sys/lib/lp/process/generic - 775 sys sys 1209583971 4395
+1209583804 1 c sys/src/cmd/lp/lp.rc - 775 sys sys 1209583969 5273
+1209585604 0 c rc/bin/lp - 775 sys sys 1209583966 5273

+ 6 - 0
rc/bin/lp

@@ -157,6 +157,12 @@ STAT=$LPDLINE(9)
 KILL=$LPDLINE(10)
 DAEMON=$LPDLINE(11)
 SCHED=$LPDLINE(12)
+
+if (~ $LPCLASS *nohead*)
+	NOHEAD=1
+if (~ $LPCLASS *duplex*)
+	DUPLEX=1
+
 if (~ $#SCHED 0) SCHED=FIFO	# everyone uses FIFO
 if (~ $KILLFLAG 1)
 	switch ($KILL) {

+ 0 - 4
sys/lib/lp/process/generic

@@ -9,10 +9,6 @@ proc=$LPLIB/process
 
 if (! ~ $DEBUG '')
 	flag x +
-if (~ $LPCLASS *nohead*)
-	NOHEAD=1
-if (~ $LPCLASS *duplex*)
-	DUPLEX=1
 cat >$temp
 
 type=`{file $temp}

+ 6 - 0
sys/src/cmd/lp/lp.rc

@@ -157,6 +157,12 @@ STAT=$LPDLINE(9)
 KILL=$LPDLINE(10)
 DAEMON=$LPDLINE(11)
 SCHED=$LPDLINE(12)
+
+if (~ $LPCLASS *nohead*)
+	NOHEAD=1
+if (~ $LPCLASS *duplex*)
+	DUPLEX=1
+
 if (~ $#SCHED 0) SCHED=FIFO	# everyone uses FIFO
 if (~ $KILLFLAG 1)
 	switch ($KILL) {

+ 9 - 9
sys/src/libbio/binit.c

@@ -103,34 +103,34 @@ Bopen(char *name, int mode)
 	default:
 		fprint(2, "Bopen: unknown mode %#x\n", mode);
 		return 0;
-
 	case OREAD:
 		f = open(name, mode);
-		if(f < 0)
-			return 0;
 		break;
-
 	case OWRITE:
 		f = create(name, mode, 0666);
-		if(f < 0)
-			return 0;
+		break;
 	}
+	if(f < 0)
+		return 0;
 	bp = malloc(sizeof(Biobuf));
 	Binits(bp, f, mode, bp->b, sizeof(bp->b));
-	bp->flag = Bmagic;
+	bp->flag = Bmagic;			/* mark bp open & malloced */
 	return bp;
 }
 
 int
 Bterm(Biobufhdr *bp)
 {
+	int r;
 
 	deinstall(bp);
-	Bflush(bp);
+	r = Bflush(bp);
 	if(bp->flag == Bmagic) {
 		bp->flag = 0;
 		close(bp->fid);
+		bp->fid = -1;			/* prevent accidents */
 		free(bp);
 	}
-	return 0;
+	/* otherwise opened with Binit(s) */
+	return r;
 }