Browse Source

Plan 9 from Bell Labs 2008-02-24

David du Colombier 13 years ago
parent
commit
e5c5368863

+ 17 - 17
dist/replica/_plan9.db

@@ -342,12 +342,12 @@
 386/bin/mug - 775 sys sys 1197732786 176443
 386/bin/mv - 775 sys sys 1168402336 66629
 386/bin/ndb - 20000000775 sys sys 985743147 0
-386/bin/ndb/cs - 775 sys sys 1202849452 149183
+386/bin/ndb/cs - 775 sys sys 1203800227 150330
 386/bin/ndb/csquery - 775 sys sys 1176488418 61652
-386/bin/ndb/dns - 775 sys sys 1202849458 297488
-386/bin/ndb/dnsdebug - 775 sys sys 1202849465 271160
+386/bin/ndb/dns - 775 sys sys 1203800233 297230
+386/bin/ndb/dnsdebug - 775 sys sys 1203800238 271135
 386/bin/ndb/dnsquery - 775 sys sys 1185334136 64350
-386/bin/ndb/dnstcp - 775 sys sys 1202849469 269041
+386/bin/ndb/dnstcp - 775 sys sys 1203800243 269016
 386/bin/ndb/ipquery - 775 sys sys 1178568296 95524
 386/bin/ndb/mkdb - 775 sys sys 1168402340 64211
 386/bin/ndb/mkhash - 775 sys sys 1178568296 83312
@@ -474,7 +474,7 @@
 386/bin/upas/runq - 775 sys sys 1178568314 112842
 386/bin/upas/scanmail - 775 sys sys 1200262789 128213
 386/bin/upas/send - 775 sys sys 1200262792 192180
-386/bin/upas/smtp - 775 sys sys 1188530218 275629
+386/bin/upas/smtp - 775 sys sys 1203800249 275743
 386/bin/upas/smtpd - 775 sys sys 1203713022 332905
 386/bin/upas/spam - 775 sys sys 1064598366 36
 386/bin/upas/testscan - 775 sys sys 1200262795 83864
@@ -7506,7 +7506,7 @@ sys/man/1/uniq - 664 sys sys 1196638933 995
 sys/man/1/units - 664 sys sys 1196638933 2046
 sys/man/1/uptime - 664 sys sys 1196638936 380
 sys/man/1/vac - 664 sys sys 1196638936 3244
-sys/man/1/venti - 664 sys sys 1196638936 2355
+sys/man/1/venti - 664 sys sys 1203807503 2321
 sys/man/1/vi - 664 sys sys 1196638936 2904
 sys/man/1/vnc - 664 sys sys 1196638933 4313
 sys/man/1/vt - 664 sys sys 1196638936 2424
@@ -9068,7 +9068,9 @@ sys/src/ape/lib/mkfile - 664 sys sys 1195965345 206
 sys/src/ape/lib/net - 20000000775 sys sys 1039727536 0
 sys/src/ape/lib/net/announce.c - 664 sys sys 1014921993 3549
 sys/src/ape/lib/net/dial.c - 664 sys sys 1014921993 2411
-sys/src/ape/lib/net/mkfile - 664 sys sys 1014921993 179
+sys/src/ape/lib/net/hangup.c - 664 sys sys 1203808760 278
+sys/src/ape/lib/net/mkfile - 664 sys sys 1203808760 208
+sys/src/ape/lib/net/netmkaddr.c - 664 sys sys 1203808759 957
 sys/src/ape/lib/regexp - 20000000775 sys sys 1039727536 0
 sys/src/ape/lib/regexp/mkfile - 664 sys sys 1014921993 223
 sys/src/ape/lib/regexp/regaux.c - 664 sys sys 1014921993 1053
@@ -9225,9 +9227,7 @@ sys/src/boot/pc/mkfile - 664 sys sys 1193359312 3224
 sys/src/boot/pc/noether.c - 664 sys sys 1193336537 416
 sys/src/boot/pc/part.c - 664 sys sys 1200690166 7158
 sys/src/boot/pc/pbs.s - 664 sys sys 1143465387 8291
-sys/src/boot/pc/pbsdisk - 775 sys sys 1017854325 509
 sys/src/boot/pc/pbsdisk.s - 664 sys sys 1017854325 6371
-sys/src/boot/pc/pbsdisklba - 775 sys sys 1015007954 509
 sys/src/boot/pc/pbsdisklba.s - 664 sys sys 1015007954 6022
 sys/src/boot/pc/pbslba.s - 664 sys sys 1186031549 8180
 sys/src/boot/pc/pci.c - 664 sys sys 1196312243 20667
@@ -12802,7 +12802,7 @@ sys/src/cmd/mk/parse.c - 664 sys sys 944961025 5310
 sys/src/cmd/mk/plan9.c - 664 sys sys 1182916397 6967
 sys/src/cmd/mk/rc.c - 664 sys sys 944961025 3206
 sys/src/cmd/mk/recipe.c - 664 sys sys 1182916343 2528
-sys/src/cmd/mk/rule.c - 664 sys sys 1131129128 1946
+sys/src/cmd/mk/rule.c - 664 sys sys 1203808956 1945
 sys/src/cmd/mk/run.c - 664 sys sys 1182916224 5066
 sys/src/cmd/mk/shprint.c - 664 sys sys 1182916066 1523
 sys/src/cmd/mk/symtab.c - 664 sys sys 1131129280 1581
@@ -12824,20 +12824,20 @@ sys/src/cmd/mv.c - 664 sys sys 1163029439 4682
 sys/src/cmd/ndb - 20000000775 sys sys 1080135004 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1194216289 7061
 sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1194216290 11959
-sys/src/cmd/ndb/cs.c - 664 sys sys 1202761086 32962
+sys/src/cmd/ndb/cs.c - 664 sys sys 1203747782 33495
 sys/src/cmd/ndb/csquery.c - 664 sys sys 1174626119 1073
 sys/src/cmd/ndb/dblookup.c - 664 sys sys 1201927753 25262
-sys/src/cmd/ndb/dn.c - 664 sys sys 1202761157 37770
+sys/src/cmd/ndb/dn.c - 664 sys sys 1203748557 37967
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1175664421 2519
-sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1202761157 3249
-sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1202761187 35667
-sys/src/cmd/ndb/dns.c - 664 sys sys 1202761244 17972
+sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1203748558 3052
+sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1203748559 35408
+sys/src/cmd/ndb/dns.c - 664 sys sys 1203745528 17970
 sys/src/cmd/ndb/dns.h - 664 sys sys 1202761152 11969
 sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1194216583 8790
 sys/src/cmd/ndb/dnserver.c - 664 sys sys 1198183920 4630
 sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1185315254 2507
 sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1202761262 7535
-sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1202761274 5828
+sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1203748560 5632
 sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711423 773
 sys/src/cmd/ndb/mkdb.c - 664 sys sys 957402054 2886
 sys/src/cmd/ndb/mkfile - 664 sys sys 1174623575 1984
@@ -14246,7 +14246,7 @@ sys/src/cmd/upas/send/tryit - 664 sys sys 944961322 584
 sys/src/cmd/upas/smtp - 20000000775 sys sys 1067741333 0
 sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1203645194 7725
 sys/src/cmd/upas/smtp/mkfile - 664 sys sys 1108910002 801
-sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1188509395 6813
+sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1203746163 7002
 sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1188509396 1075
 sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1188509396 20717

+ 17 - 17
dist/replica/plan9.db

@@ -342,12 +342,12 @@
 386/bin/mug - 775 sys sys 1197732786 176443
 386/bin/mv - 775 sys sys 1168402336 66629
 386/bin/ndb - 20000000775 sys sys 985743147 0
-386/bin/ndb/cs - 775 sys sys 1202849452 149183
+386/bin/ndb/cs - 775 sys sys 1203800227 150330
 386/bin/ndb/csquery - 775 sys sys 1176488418 61652
-386/bin/ndb/dns - 775 sys sys 1202849458 297488
-386/bin/ndb/dnsdebug - 775 sys sys 1202849465 271160
+386/bin/ndb/dns - 775 sys sys 1203800233 297230
+386/bin/ndb/dnsdebug - 775 sys sys 1203800238 271135
 386/bin/ndb/dnsquery - 775 sys sys 1185334136 64350
-386/bin/ndb/dnstcp - 775 sys sys 1202849469 269041
+386/bin/ndb/dnstcp - 775 sys sys 1203800243 269016
 386/bin/ndb/ipquery - 775 sys sys 1178568296 95524
 386/bin/ndb/mkdb - 775 sys sys 1168402340 64211
 386/bin/ndb/mkhash - 775 sys sys 1178568296 83312
@@ -474,7 +474,7 @@
 386/bin/upas/runq - 775 sys sys 1178568314 112842
 386/bin/upas/scanmail - 775 sys sys 1200262789 128213
 386/bin/upas/send - 775 sys sys 1200262792 192180
-386/bin/upas/smtp - 775 sys sys 1188530218 275629
+386/bin/upas/smtp - 775 sys sys 1203800249 275743
 386/bin/upas/smtpd - 775 sys sys 1203713022 332905
 386/bin/upas/spam - 775 sys sys 1064598366 36
 386/bin/upas/testscan - 775 sys sys 1200262795 83864
@@ -7506,7 +7506,7 @@ sys/man/1/uniq - 664 sys sys 1196638933 995
 sys/man/1/units - 664 sys sys 1196638933 2046
 sys/man/1/uptime - 664 sys sys 1196638936 380
 sys/man/1/vac - 664 sys sys 1196638936 3244
-sys/man/1/venti - 664 sys sys 1196638936 2355
+sys/man/1/venti - 664 sys sys 1203807503 2321
 sys/man/1/vi - 664 sys sys 1196638936 2904
 sys/man/1/vnc - 664 sys sys 1196638933 4313
 sys/man/1/vt - 664 sys sys 1196638936 2424
@@ -9068,7 +9068,9 @@ sys/src/ape/lib/mkfile - 664 sys sys 1195965345 206
 sys/src/ape/lib/net - 20000000775 sys sys 1039727536 0
 sys/src/ape/lib/net/announce.c - 664 sys sys 1014921993 3549
 sys/src/ape/lib/net/dial.c - 664 sys sys 1014921993 2411
-sys/src/ape/lib/net/mkfile - 664 sys sys 1014921993 179
+sys/src/ape/lib/net/hangup.c - 664 sys sys 1203808760 278
+sys/src/ape/lib/net/mkfile - 664 sys sys 1203808760 208
+sys/src/ape/lib/net/netmkaddr.c - 664 sys sys 1203808759 957
 sys/src/ape/lib/regexp - 20000000775 sys sys 1039727536 0
 sys/src/ape/lib/regexp/mkfile - 664 sys sys 1014921993 223
 sys/src/ape/lib/regexp/regaux.c - 664 sys sys 1014921993 1053
@@ -9225,9 +9227,7 @@ sys/src/boot/pc/mkfile - 664 sys sys 1193359312 3224
 sys/src/boot/pc/noether.c - 664 sys sys 1193336537 416
 sys/src/boot/pc/part.c - 664 sys sys 1200690166 7158
 sys/src/boot/pc/pbs.s - 664 sys sys 1143465387 8291
-sys/src/boot/pc/pbsdisk - 775 sys sys 1017854325 509
 sys/src/boot/pc/pbsdisk.s - 664 sys sys 1017854325 6371
-sys/src/boot/pc/pbsdisklba - 775 sys sys 1015007954 509
 sys/src/boot/pc/pbsdisklba.s - 664 sys sys 1015007954 6022
 sys/src/boot/pc/pbslba.s - 664 sys sys 1186031549 8180
 sys/src/boot/pc/pci.c - 664 sys sys 1196312243 20667
@@ -12802,7 +12802,7 @@ sys/src/cmd/mk/parse.c - 664 sys sys 944961025 5310
 sys/src/cmd/mk/plan9.c - 664 sys sys 1182916397 6967
 sys/src/cmd/mk/rc.c - 664 sys sys 944961025 3206
 sys/src/cmd/mk/recipe.c - 664 sys sys 1182916343 2528
-sys/src/cmd/mk/rule.c - 664 sys sys 1131129128 1946
+sys/src/cmd/mk/rule.c - 664 sys sys 1203808956 1945
 sys/src/cmd/mk/run.c - 664 sys sys 1182916224 5066
 sys/src/cmd/mk/shprint.c - 664 sys sys 1182916066 1523
 sys/src/cmd/mk/symtab.c - 664 sys sys 1131129280 1581
@@ -12824,20 +12824,20 @@ sys/src/cmd/mv.c - 664 sys sys 1163029439 4682
 sys/src/cmd/ndb - 20000000775 sys sys 1080135004 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1194216289 7061
 sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1194216290 11959
-sys/src/cmd/ndb/cs.c - 664 sys sys 1202761086 32962
+sys/src/cmd/ndb/cs.c - 664 sys sys 1203747782 33495
 sys/src/cmd/ndb/csquery.c - 664 sys sys 1174626119 1073
 sys/src/cmd/ndb/dblookup.c - 664 sys sys 1201927753 25262
-sys/src/cmd/ndb/dn.c - 664 sys sys 1202761157 37770
+sys/src/cmd/ndb/dn.c - 664 sys sys 1203748557 37967
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1175664421 2519
-sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1202761157 3249
-sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1202761187 35667
-sys/src/cmd/ndb/dns.c - 664 sys sys 1202761244 17972
+sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1203748558 3052
+sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1203748559 35408
+sys/src/cmd/ndb/dns.c - 664 sys sys 1203745528 17970
 sys/src/cmd/ndb/dns.h - 664 sys sys 1202761152 11969
 sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1194216583 8790
 sys/src/cmd/ndb/dnserver.c - 664 sys sys 1198183920 4630
 sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1185315254 2507
 sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1202761262 7535
-sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1202761274 5828
+sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1203748560 5632
 sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711423 773
 sys/src/cmd/ndb/mkdb.c - 664 sys sys 957402054 2886
 sys/src/cmd/ndb/mkfile - 664 sys sys 1174623575 1984
@@ -14246,7 +14246,7 @@ sys/src/cmd/upas/send/tryit - 664 sys sys 944961322 584
 sys/src/cmd/upas/smtp - 20000000775 sys sys 1067741333 0
 sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1203645194 7725
 sys/src/cmd/upas/smtp/mkfile - 664 sys sys 1108910002 801
-sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1188509395 6813
+sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1203746163 7002
 sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
 sys/src/cmd/upas/smtp/rmtdns.c - 664 sys sys 1188509396 1075
 sys/src/cmd/upas/smtp/smtp.c - 664 sys sys 1188509396 20717

+ 20 - 0
dist/replica/plan9.log

@@ -18546,3 +18546,23 @@
 1203714004 8 c 386/bin/disk/kfs - 775 sys sys 1203713017 248737
 1203714004 9 c 386/bin/upas/smtpd - 775 sys sys 1203713022 332905
 1203714004 10 c 386/lib/libauthsrv.a - 664 sys sys 1203713023 36452
+1203746405 0 c sys/src/cmd/ndb/cs.c - 664 sys sys 1203745527 32954
+1203746405 1 c sys/src/cmd/ndb/dns.c - 664 sys sys 1203745528 17970
+1203746405 2 c sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1203746163 7002
+1203791405 0 c sys/src/cmd/ndb/cs.c - 664 sys sys 1203747782 33495
+1203791405 1 c sys/src/cmd/ndb/dn.c - 664 sys sys 1203748557 37967
+1203791405 2 c sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1203748558 3052
+1203791405 3 c sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1203748559 35408
+1203791405 4 c sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1203748560 5632
+1203800404 0 c 386/bin/ndb/cs - 775 sys sys 1203800227 150330
+1203800404 1 c 386/bin/ndb/dns - 775 sys sys 1203800233 297230
+1203800404 2 c 386/bin/ndb/dnsdebug - 775 sys sys 1203800238 271135
+1203800404 3 c 386/bin/ndb/dnstcp - 775 sys sys 1203800243 269016
+1203800404 4 c 386/bin/upas/smtp - 775 sys sys 1203800249 275743
+1203807604 0 c sys/man/1/venti - 664 sys sys 1203807503 2321
+1203807604 1 d sys/src/boot/pc/pbsdisklba - 775 sys sys 1015007954 0
+1203807604 2 d sys/src/boot/pc/pbsdisk - 775 sys sys 1017854325 0
+1203809404 0 a sys/src/ape/lib/net/hangup.c - 664 sys sys 1203808760 278
+1203809404 1 c sys/src/ape/lib/net/mkfile - 664 sys sys 1203808760 208
+1203809404 2 a sys/src/ape/lib/net/netmkaddr.c - 664 sys sys 1203808759 957
+1203809404 3 c sys/src/cmd/mk/rule.c - 664 sys sys 1203808956 1945

+ 0 - 2
sys/man/1/venti

@@ -140,8 +140,6 @@ pointers to the zero block.
 It writes the new root score to standard output.
 .SH SOURCE
 .B /sys/src/cmd/venti
-.br
-.B /sys/src/cmd/oventi/copy.c
 .SH SEE ALSO
 .IR vac (1),
 .IR venti (2),

+ 16 - 0
sys/src/ape/lib/net/hangup.c

@@ -0,0 +1,16 @@
+#include <stdlib.h>
+#include <sys/types.h>
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <libnet.h>
+
+/*
+ *  force a connection to hangup
+ */
+int
+hangup(int ctl)
+{
+	return write(ctl, "hangup", sizeof("hangup")-1) != sizeof("hangup")-1;
+}

+ 3 - 0
sys/src/ape/lib/net/mkfile

@@ -4,6 +4,9 @@ APE=/sys/src/ape
 LIB=/$objtype/lib/ape/libnet.a
 OFILES=dial.$O\
 	announce.$O\
+	netmkaddr.$O\
+	hangup.$O\
+	
 
 </sys/src/cmd/mksyslib
 

+ 56 - 0
sys/src/ape/lib/net/netmkaddr.c

@@ -0,0 +1,56 @@
+#include <stdlib.h>
+#include <sys/types.h>
+#include <string.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <libnet.h>
+
+/*
+ *  make an address, add the defaults
+ */
+char *
+netmkaddr(char *linear, char *defnet, char *defsrv)
+{
+	static char addr[256];
+	char *cp;
+
+	/*
+	 *  dump network name
+	 */
+	cp = strchr(linear, '!');
+	if(cp == 0){
+		if(defnet==0){
+			if(defsrv)
+				snprintf(addr, sizeof(addr), "net!%s!%s",
+					linear, defsrv);
+			else
+				snprintf(addr, sizeof(addr), "net!%s", linear);
+		}
+		else {
+			if(defsrv)
+				snprintf(addr, sizeof(addr), "%s!%s!%s", defnet,
+					linear, defsrv);
+			else
+				snprintf(addr, sizeof(addr), "%s!%s", defnet,
+					linear);
+		}
+		return addr;
+	}
+
+	/*
+	 *  if there is already a service, use it
+	 */
+	cp = strchr(cp+1, '!');
+	if(cp)
+		return linear;
+
+	/*
+	 *  add default service
+	 */
+	if(defsrv == 0)
+		return linear;
+	snprintf(addr, sizeof(addr), "%s!%s", linear, defsrv);
+
+	return addr;
+}

BIN
sys/src/boot/pc/pbsdisk


BIN
sys/src/boot/pc/pbsdisklba


+ 1 - 1
sys/src/cmd/mk/rule.c

@@ -75,7 +75,7 @@ dumpr(char *s, Rule *r)
 {
 	Bprint(&bout, "%s: start=%p\n", s, r);
 	for(; r; r = r->next){
-		Bprint(&bout, "\tRule %p: %s[%d] attr=%x next=%p chain=%p alltarget='%s'",
+		Bprint(&bout, "\tRule %p: %s:%d attr=%x next=%p chain=%p alltarget='%s'",
 			r, r->file, r->line, r->attr, r->next, r->chain, wtos(r->alltargets, ' '));
 		if(r->prog)
 			Bprint(&bout, " prog='%s'", r->prog);

+ 31 - 4
sys/src/cmd/ndb/cs.c

@@ -191,6 +191,31 @@ usage(void)
 	exits("usage");
 }
 
+/*
+ * based on libthread's threadsetname, but drags in less library code.
+ * actually just sets the arguments displayed.
+ */
+void
+procsetname(char *fmt, ...)
+{
+	int fd;
+	char *cmdname;
+	char buf[128];
+	va_list arg;
+
+	va_start(arg, fmt);
+	cmdname = vsmprint(fmt, arg);
+	va_end(arg);
+	if (cmdname == nil)
+		return;
+	snprint(buf, sizeof buf, "#p/%d/args", getpid());
+	if((fd = open(buf, OWRITE)) >= 0){
+		write(fd, cmdname, strlen(cmdname)+1);
+		close(fd);
+	}
+	free(cmdname);
+}
+
 void
 main(int argc, char *argv[])
 {
@@ -284,6 +309,7 @@ mountinit(char *service, char *mntpt)
 	switch(rfork(RFFDG|RFPROC|RFNAMEG)){
 	case 0:
 		close(p[1]);
+		procsetname("%s", mntpt);
 		break;
 	case -1:
 		error("fork failed\n");
@@ -627,7 +653,7 @@ rread(Job *job, Mfile *mf)
 	int i, n, cnt;
 	long off, toff, clock;
 	Dir dir;
-	uchar buf[IOHDRSZ+Maxfdata];
+	uchar buf[Maxfdata];
 	char *err;
 
 	n = 0;
@@ -1023,7 +1049,7 @@ ipid(void)
 
 /*
  *  Set up a list of default networks by looking for
- *  /net/ * /clone.
+ *  /net/^*^/clone.
  */
 void
 netinit(int background)
@@ -1527,7 +1553,7 @@ reorder(Ndbtuple *t, Ndbtuple *x)
  *  another.  parent returns to job loop.
  */
 void
-slave(void)
+slave(char *host)
 {
 	if(*isslave)
 		return;		/* we're already a slave process */
@@ -1538,6 +1564,7 @@ slave(void)
 	case 0:
 		if(debug)
 			syslog(0, logfile, "slave %d", getpid());
+		procsetname("%s", host);
 		*isslave = 1;
 		break;
 	default:
@@ -1560,7 +1587,7 @@ dnsiplookup(char *host, Ndbs *s)
 	/* save the name before starting a slave */
 	snprint(buf, sizeof(buf), "%s", host);
 
-	slave();
+	slave(host);
 
 	if(strcmp(ipattr(buf), "ip") == 0)
 		t = dnsquery(mntpt, buf, "ptr");

+ 12 - 0
sys/src/cmd/ndb/dn.c

@@ -143,6 +143,16 @@ static ulong agefreq = Defagefreq;
 static int rrequiv(RR *r1, RR *r2);
 static int sencodefmt(Fmt*);
 
+static void
+ding(void*, char *msg)
+{
+	if(strstr(msg, "alarm") != nil) {
+		stats.alarms++;
+		noted(NCONT);		/* resume with system call error */
+	} else
+		noted(NDFLT);		/* die */
+}
+
 void
 dninit(void)
 {
@@ -156,6 +166,8 @@ dninit(void)
 	dnvars.oldest = maxage;
 	dnvars.names = 0;
 	dnvars.id = truerand();	/* don't start with same id every time */
+
+	notify(ding);
 }
 
 /*

+ 0 - 12
sys/src/cmd/ndb/dnnotify.c

@@ -44,16 +44,6 @@ dnnotify(DNSmsg *reqp, DNSmsg *repp, Request *)
 		a->needrefresh = 1;
 }
 
-static void
-ding(void*, char *msg)
-{
-	if(strstr(msg, "alarm") != nil) {
-		stats.alarms++;
-		noted(NCONT);		/* resume with system call error */
-	} else
-		noted(NDFLT);		/* die */
-}
-
 /* notify a slave that an area has changed. */
 static void
 send_notify(char *slave, RR *soa, Request *req)
@@ -84,8 +74,6 @@ send_notify(char *slave, RR *soa, Request *req)
 	if(fd < 0)
 		return;
 
-	notify(ding);
-
 	/* send 3 times or until we get anything back */
 	n += Udphdrsize;
 	for(i = 0; i < 3; i++, freeanswers(&repmsg)){

+ 0 - 16
sys/src/cmd/ndb/dnresolve.c

@@ -549,16 +549,6 @@ mkreq(DN *dp, int type, uchar *buf, int flags, ushort reqno)
 	return len;
 }
 
-/* for alarms in readreply */
-static void
-ding(void*, char *msg)
-{
-	if(strstr(msg, "alarm") != nil)
-		noted(NCONT);		/* resume with system call error */
-	else
-		noted(NDFLT);		/* die */
-}
-
 void
 freeanswers(DNSmsg *mp)
 {
@@ -647,12 +637,6 @@ readreply(Query *qp, int medium, ushort req, uchar *ibuf, DNSmsg *mp,
 	uchar *reply;
 	uchar srcip[IPaddrlen];
 	RR *rp;
-	static int first = 1;
-
-	if (first) {
-		first = 0;
-		notify(ding);
-	}
 
 	queryck(qp);
 	rv = 0;

+ 2 - 2
sys/src/cmd/ndb/dns.c

@@ -437,7 +437,7 @@ io(void)
 			dnslog("%F", &job->request);
 
 		getactivity(&req, 0);
-		req.aborttime = now + Maxreqtm;
+		req.aborttime = time(nil) + Maxreqtm;
 		req.from = "9p";
 
 		switch(job->request.type){
@@ -639,7 +639,7 @@ rread(Job *job, Mfile *mf)
 	ulong cnt;
 	vlong off;
 	char *err;
-	uchar buf[IOHDRSZ+Maxfdata];
+	uchar buf[Maxfdata];
 	Dir dir;
 
 	n = 0;

+ 0 - 11
sys/src/cmd/ndb/dnudpserver.c

@@ -10,16 +10,6 @@ enum {
 static int	udpannounce(char*);
 static void	reply(int, uchar*, DNSmsg*, Request*);
 
-static void
-ding(void*, char *msg)
-{
-	if(strstr(msg, "alarm") != nil) {
-		stats.alarms++;
-		noted(NCONT);		/* resume with system call error */
-	} else
-		noted(NDFLT);		/* die */
-}
-
 typedef struct Inprogress Inprogress;
 struct Inprogress
 {
@@ -97,7 +87,6 @@ dnudpserver(char *mntpt)
 	}
 
 	fd = -1;
-	notify(ding);
 restart:
 	procsetname("udp server announcing");
 	if(fd >= 0)

+ 18 - 7
sys/src/cmd/upas/smtp/mxdial.c

@@ -67,6 +67,19 @@ timeout(void*, char *msg)
 	return 0;
 }
 
+long
+timedwrite(int fd, void *buf, long len, long ms)
+{
+	long n, oalarm;
+
+	atnotify(timeout, 1);
+	oalarm = alarm(ms);
+	n = write(fd, buf, len);
+	alarm(oalarm);
+	atnotify(timeout, 0);
+	return n;
+}
+
 /*
  *  take an address and return all the mx entries for it,
  *  most preferred first
@@ -157,7 +170,6 @@ static int
 mxlookup1(DS *ds, char *domain)
 {
 	int i, n, fd, nmx;
-	long oalarm;
 	char buf[1024], dnsname[Maxstring];
 	char *fields[4];
 
@@ -174,11 +186,7 @@ mxlookup1(DS *ds, char *domain)
 	/*
 	 * don't hang indefinitely in the write to /net/dns.
 	 */
-	atnotify(timeout, 1);
-	oalarm = alarm(60*1000);
-	n = write(fd, buf, strlen(buf));
-	alarm(oalarm);
-	atnotify(timeout, 0);
+	n = timedwrite(fd, buf, strlen(buf), 60*1000);
 	if(n < 0){
 		rerrstr(buf, sizeof buf);
 		if(debug)
@@ -233,7 +241,10 @@ mxlookup1(DS *ds, char *domain)
 		seek(fd, 0, 0);
 		snprint(buf, sizeof buf, "%s ip", mx[i].host);
 		mx[i].ip[0] = 0;
-		if(write(fd, buf, strlen(buf)) < 0)
+		/*
+		 * don't hang indefinitely in the write to /net/dns.
+		 */
+		if(timedwrite(fd, buf, strlen(buf), 60*1000) < 0)
 			goto no;
 		seek(fd, 0, 0);
 		if((n = read(fd, buf, sizeof buf-1)) < 0)