12-28 snapshot on netbsd1.3H - much better luck this time

assar@stacken.kth.se assar at stacken.kth.se
Tue Dec 29 19:18:32 CET 1998


Ken Raeburn <raeburn at raeburn.org> writes:
> Perhaps.  Or accesses to /afs could be made to cause interruptible
> delays until it's initialized.  That's probably harder, but would
> permit other system startup tasks that don't depend on AFS to run
> concurrently with the arla initialization.

Yes, that was actually the idea but it doesn't work quite that way.

> The source has multiple "#ifdef FOO / try syscall FOO / #endif"
> blocks, but from my disassembly, it appears that none are used in my
> installed copy.  So the code is merely fiddling with signal handlers
> and returning a failure indication.  My guess is that the macros it
> tests are intended to be hard-coded numbers, but I don't think they
> need to be.  I'll look into it further.

Assuming it's not divulging any important secrets, could you tell me
the $Id$ from the file afssydefs.h.  In my copy of the file the
following lines have been there since 1.5 (from 1995/12/02):

#if defined(__NetBSD__)
#define AFS_SYSCALL 210
#endif

> If the number 210 is magic for Transarc AFS on NetBSD, that would
> explain why the Transarc binaries I got from MIT seemed to work.

Right.

> But "fs sysname" reported "_nbsd13", which doesn't seem right.  Is
> this all as expected?

No, that's wrong and that's caused by arlad sending just the string
and fs expecting a length (4 bytes) followed by the string.  (The
documentation doesn't say anything about a length field...)

Patches for that follow.

/assar


Index: arlad/messages.c
===================================================================
RCS file: /usr/local/cvsroot/arla/arlad/messages.c,v
retrieving revision 1.110
diff -u -w -u -w -r1.110 messages.c
--- messages.c	1998/12/24 03:41:14	1.110
+++ messages.c	1998/12/29 18:15:51
@@ -2633,8 +2665,21 @@
 	arlasysname[h->insize] = '\0';
 	return xfs_send_message_wakeup(fd, h->header.sequence_num, 0);
     } else {
-	return xfs_send_message_wakeup_data (fd, h->header.sequence_num, 0,
-					     arlasysname, strlen(arlasysname) + 1);
+	char *buf;
+	size_t sysname_len = strlen (arlasysname);
+	int ret;
+
+	buf = malloc (sysname_len + 4 + 1);
+	if (buf == NULL)
+	    return xfs_send_message_wakeup (fd, h->header.sequence_num, ENOMEM);
+	*((u_int32 *)buf) = sysname_len;
+	memcpy (buf + 4, arlasysname, sysname_len);
+	buf[sysname_len + 4] = '\0';
+
+	ret = xfs_send_message_wakeup_data (fd, h->header.sequence_num, 0,
+					    buf, sysname_len + 5);
+	free (buf);
+	return ret;
     }
 }
 
Index: appl/fs_lib.c
===================================================================
RCS file: /usr/local/cvsroot/arla/appl/fs_lib.c,v
retrieving revision 1.18
diff -u -w -u -w -r1.18 fs_lib.c
--- fs_lib.c	1998/12/23 03:49:50	1.18
+++ fs_lib.c	1998/12/29 18:17:13
@@ -525,16 +525,24 @@
 {
     struct ViceIoctl a_params;
     int32_t set = 0;
+    char *buf;
 
+    buf = malloc (sys_sz + 4);
+    if (buf == NULL)
+	return ENOMEM;
+
     a_params.in       = (caddr_t)&set;
     a_params.in_size  = sizeof(set);
-    a_params.out      = sys;
-    a_params.out_size = sys_sz;
+    a_params.out      = buf;
+    a_params.out_size = sys_sz + 4;
 
     if(k_pioctl (NULL, VIOC_AFS_SYSNAME, &a_params, 1) < 0)
 	return errno;
-    else
+    else {
+	strncpy (sys, buf + 4, sys_sz - 1);
+	sys[sys_sz - 1] = '\0';
 	return 0;
+    }
 }
 
 /*





More information about the Arla-drinkers mailing list