Subject: kern/1817: minor changes to src/sys/lib/libsa
To: None <gnats-bugs@gnats.netbsd.org>
From: Waldi Ravens <waldi@moacs.indiv.nl.net>
List: netbsd-bugs
Date: 12/06/1995 22:29:06
>Number:         1817
>Category:       kern
>Synopsis:       libsa too large for NetBSD/Atari bootstrap
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Dec  6 17:05:01 1995
>Last-Modified:
>Originator:     Waldi Ravens
>Organization:
private
>Release:        2 Dec 1995
>Environment:

System: NetBSD moacs11.moacs.indiv.nl.net 1.1 NetBSD 1.1 (MOACS11) #3: Sat Dec 2 17:29:53 MET 1995 root@moacs11:/usr/src/sys/arch/atari/compile/MOACS11 atari

>Description:
	The available space for the NetBSD/Atari bootstrap is limited to 6656 bytes,
	including text, data and bss segments. To make it fit, I had to split some of
	the source files in lib/libsa, which contain two or more functions (where we
	only need one of them). The list of changes:

	- ufs.c: minor bugfix (read_inode would always return zero).
	- strerror.c: removed two `gratuitous' prototypes.

	- bcopy.c: split into bcopy.c and mempy.c
	- close.c: split into close.c and closeall.c
	- disklabel.c: split into disklabel.c and dkcksum.c
	- open.c: split into files.c and nullfs.c
	  (also, don't use static mem for the `files' array)
	- stat.c: split into stat.c and fstat.c

	- stand.h and Makefile: reflect above changes

>How-To-Repeat:
>Fix:

diff -Pru /usr/src/sys/lib/libsa/Makefile sys/lib/libsa/Makefile
--- /usr/src/sys/lib/libsa/Makefile	Sat Oct 14 03:45:51 1995
+++ sys/lib/libsa/Makefile	Wed Dec  6 00:44:52 1995
@@ -12,11 +12,11 @@
 
 # stand routines
 SRCS+=	alloc.c bcopy.c exit.c exec.c getfile.c gets.c globals.c \
-	printf.c strerror.c
+	memcpy.c printf.c strerror.c
 
 # io routines
-SRCS+=	close.c dev.c disklabel.c ioctl.c lseek.c open.c read.c \
-	stat.c write.c
+SRCS+=	close.c closeall.c dev.c disklabel.c dkcksum.c ioctl.c \
+	lseek.c open.c nullfs.c read.c stat.c fstat.c write.c
 
 .if !defined(NO_NET)
 # network routines
diff -Pru /usr/src/sys/lib/libsa/bcopy.c sys/lib/libsa/bcopy.c
--- /usr/src/sys/lib/libsa/bcopy.c	Sat Oct 14 03:45:57 1995
+++ sys/lib/libsa/bcopy.c	Wed Dec  6 00:10:00 1995
@@ -36,6 +36,7 @@
  */
 
 #include <sys/types.h>
+#include "stand.h"
 
 /*
  * This is designed to be small, not fast.
@@ -57,14 +58,4 @@
 	} else
 		while (n-- > 0)
 			*t++ = *f++;
-}
-
-void *
-memcpy(s1, s2, n)
-	void *s1;
-	const void *s2;
-	size_t n;
-{
-	bcopy(s2, s1, n);
-	return s1;
 }
diff -Pru /usr/src/sys/lib/libsa/close.c sys/lib/libsa/close.c
--- /usr/src/sys/lib/libsa/close.c	Sat Oct 14 03:46:06 1995
+++ sys/lib/libsa/close.c	Wed Dec  6 00:15:11 1995
@@ -92,14 +92,3 @@
 	}
 	return (0);
 }
-
-
-void
-closeall()
-{
-	int i;
-
-        for (i = 0; i < SOPEN_MAX; i++)
-            if (files[i].f_flags != 0)
-                (void)close(i);
-}
diff -Pru /usr/src/sys/lib/libsa/closeall.c sys/lib/libsa/closeall.c
--- /usr/src/sys/lib/libsa/closeall.c	Thu Jan  1 01:00:00 1970
+++ sys/lib/libsa/closeall.c	Wed Dec  6 00:15:55 1995
@@ -0,0 +1,77 @@
+/*	$NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $	*/
+
+/*-
+ * Copyright (c) 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)close.c	8.1 (Berkeley) 6/11/93
+ *  
+ *
+ * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Author: Alessandro Forin
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include "stand.h"
+
+void
+closeall()
+{
+	int i;
+
+        for (i = 0; i < SOPEN_MAX; i++)
+            if (files[i].f_flags != 0)
+                (void)close(i);
+}
diff -Pru /usr/src/sys/lib/libsa/disklabel.c sys/lib/libsa/disklabel.c
--- /usr/src/sys/lib/libsa/disklabel.c	Sat Oct 14 03:46:06 1995
+++ sys/lib/libsa/disklabel.c	Wed Dec  6 00:17:16 1995
@@ -37,9 +37,8 @@
 
 #include <sys/param.h>
 #include <sys/disklabel.h>
+#include "stand.h"
 
-int dkcksum __P((struct disklabel *));
-    
 char *
 getdisklabel(buf, lp)
 	const char *buf;
@@ -64,21 +63,4 @@
 		}
 	}
 	return (msg);
-}
-
-/*
- * Compute checksum for disk label.
- */
-int
-dkcksum(lp)
-	register struct disklabel *lp;
-{
-	register u_short *start, *end;
-	register u_short sum = 0;
-
-	start = (u_short *)lp;
-	end = (u_short *)&lp->d_partitions[lp->d_npartitions];
-	while (start < end)
-		sum ^= *start++;
-	return (sum);
 }
diff -Pru /usr/src/sys/lib/libsa/dkcksum.c sys/lib/libsa/dkcksum.c
--- /usr/src/sys/lib/libsa/dkcksum.c	Thu Jan  1 01:00:00 1970
+++ sys/lib/libsa/dkcksum.c	Wed Dec  6 00:17:49 1995
@@ -0,0 +1,57 @@
+/*	$NetBSD: disklabel.c,v 1.3 1994/10/26 05:44:42 cgd Exp $	*/
+
+/*-
+ * Copyright (c) 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)disklabel.c	8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/param.h>
+#include <sys/disklabel.h>
+#include "stand.h"
+
+/*
+ * Compute checksum for disk label.
+ */
+int
+dkcksum(lp)
+	register struct disklabel *lp;
+{
+	register u_short *start, *end;
+	register u_short sum = 0;
+
+	start = (u_short *)lp;
+	end = (u_short *)&lp->d_partitions[lp->d_npartitions];
+	while (start < end)
+		sum ^= *start++;
+	return (sum);
+}
diff -Pru /usr/src/sys/lib/libsa/fstat.c sys/lib/libsa/fstat.c
--- /usr/src/sys/lib/libsa/fstat.c	Thu Jan  1 01:00:00 1970
+++ sys/lib/libsa/fstat.c	Wed Dec  6 00:23:27 1995
@@ -0,0 +1,60 @@
+/*	$NetBSD: stat.c,v 1.3 1994/10/26 05:45:07 cgd Exp $	*/
+
+/*-
+ * Copyright (c) 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)stat.c	8.1 (Berkeley) 6/11/93
+ */
+
+#include "stand.h"
+
+int
+fstat(fd, sb)
+	int fd;
+	struct stat *sb;
+{
+	register struct open_file *f = &files[fd];
+
+	if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
+		errno = EBADF;
+		return (-1);
+	}
+
+	/* operation not defined on raw devices */
+	if (f->f_flags & F_RAW) {
+		errno = EOPNOTSUPP;
+		return (-1);
+	}
+
+	errno = (f->f_ops->stat)(f, sb);
+	return (0);
+}
diff -Pru /usr/src/sys/lib/libsa/memcpy.c sys/lib/libsa/memcpy.c
--- /usr/src/sys/lib/libsa/memcpy.c	Thu Jan  1 01:00:00 1970
+++ sys/lib/libsa/memcpy.c	Wed Dec  6 00:11:10 1995
@@ -0,0 +1,49 @@
+/*	$NetBSD: bcopy.c,v 1.5 1995/04/22 13:46:50 cgd Exp $	*/
+
+/*-
+ * Copyright (c) 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)bcopy.c	8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/types.h>
+#include "stand.h"
+
+void *
+memcpy(s1, s2, n)
+	void *s1;
+	const void *s2;
+	size_t n;
+{
+	bcopy(s2, s1, n);
+	return s1;
+}
diff -Pru /usr/src/sys/lib/libsa/nullfs.c sys/lib/libsa/nullfs.c
--- /usr/src/sys/lib/libsa/nullfs.c	Thu Jan  1 01:00:00 1970
+++ sys/lib/libsa/nullfs.c	Wed Dec  6 00:20:22 1995
@@ -0,0 +1,105 @@
+/*	$NetBSD: open.c,v 1.9 1995/09/19 09:16:52 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * The Mach Operating System project at Carnegie-Mellon University.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)open.c	8.1 (Berkeley) 6/11/93
+ *  
+ *
+ * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Author: Alessandro Forin
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include "stand.h"
+
+/*
+ * Null filesystem
+ */
+int	null_open (char *path, struct open_file *f)
+{
+	errno  = EIO;
+	return -1;
+}
+
+int	null_close(struct open_file *f)
+{
+	return 0;
+}
+
+ssize_t	null_read (struct open_file *f, void *buf, size_t size, size_t *resid)
+{
+	errno = EIO;
+	return -1;
+}
+
+ssize_t	null_write (struct open_file *f, void *buf, size_t size, size_t *resid)
+{
+	errno = EIO;
+	return -1;
+}
+
+off_t	null_seek (struct open_file *f, off_t offset, int where)
+{
+	errno = EIO;
+	return -1;
+}
+
+int	null_stat (struct open_file *f, struct stat *sb)
+{
+	errno = EIO;
+	return -1;
+}
diff -Pru /usr/src/sys/lib/libsa/open.c sys/lib/libsa/open.c
--- /usr/src/sys/lib/libsa/open.c	Sat Oct 14 03:46:31 1995
+++ sys/lib/libsa/open.c	Wed Dec  6 00:19:42 1995
@@ -65,7 +65,10 @@
  */
 
 #include "stand.h"
+
+#ifndef atari
 struct open_file files[SOPEN_MAX];
+#endif
 
 /*
  *	File primitives proper
@@ -123,42 +126,3 @@
 	errno = error;
 	return (-1);
 }
-
-/*
- * Null filesystem
- */
-int	null_open (char *path, struct open_file *f)
-{
-	errno  = EIO;
-	return -1;
-}
-
-int	null_close(struct open_file *f)
-{
-	return 0;
-}
-
-ssize_t	null_read (struct open_file *f, void *buf, size_t size, size_t *resid)
-{
-	errno = EIO;
-	return -1;
-}
-
-ssize_t	null_write (struct open_file *f, void *buf, size_t size, size_t *resid)
-{
-	errno = EIO;
-	return -1;
-}
-
-off_t	null_seek (struct open_file *f, off_t offset, int where)
-{
-	errno = EIO;
-	return -1;
-}
-
-int	null_stat (struct open_file *f, struct stat *sb)
-{
-	errno = EIO;
-	return -1;
-}
-
diff -Pru /usr/src/sys/lib/libsa/stand.h sys/lib/libsa/stand.h
--- /usr/src/sys/lib/libsa/stand.h	Sat Oct 14 03:46:39 1995
+++ sys/lib/libsa/stand.h	Wed Dec  6 01:07:56 1995
@@ -63,6 +63,7 @@
 };
 
 extern struct fs_ops file_system[];
+extern int nfsys;
 
 /* where values for lseek(2) */
 #define	SEEK_SET	0	/* set file offset to offset */
@@ -93,7 +94,6 @@
 
 #define	SOPEN_MAX	4
 extern struct open_file files[];
-extern int nfsys;
 
 /* f_flags values */
 #define	F_READ		0x0001	/* file opened for reading */
@@ -111,18 +111,20 @@
 void	free __P((void *, unsigned int));
 struct	disklabel;
 char	*getdisklabel __P((const char *, struct disklabel *));
+int	dkcksum __P((struct disklabel *));
 
 void	printf __P((const char *, ...));
 void	sprintf __P((char *, const char *, ...));
 void	twiddle __P((void));
 void	gets __P((char *));
 __dead void	panic __P((const char *, ...)) __attribute__((noreturn));
-__dead void _rtt __P((void)) __attribute__((noreturn));
+__dead void	_rtt __P((void)) __attribute__((noreturn));
 void	bcopy __P((const void *, void *, size_t));
-int	getchar __P((void));
+void	*memcpy __P((void *, const void *, size_t));
 void	exec __P((char *, char *, int));
 int	open __P((const char *, int));
 int	close __P((int));
+void	closeall __P((void));
 ssize_t	read __P((int, void *, size_t));
 ssize_t	write __P((int, void *, size_t));
     
diff -Pru /usr/src/sys/lib/libsa/stat.c sys/lib/libsa/stat.c
--- /usr/src/sys/lib/libsa/stat.c	Sat Oct 14 03:46:40 1995
+++ sys/lib/libsa/stat.c	Wed Dec  6 00:22:15 1995
@@ -38,28 +38,6 @@
 #include "stand.h"
 
 int
-fstat(fd, sb)
-	int fd;
-	struct stat *sb;
-{
-	register struct open_file *f = &files[fd];
-
-	if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) {
-		errno = EBADF;
-		return (-1);
-	}
-
-	/* operation not defined on raw devices */
-	if (f->f_flags & F_RAW) {
-		errno = EOPNOTSUPP;
-		return (-1);
-	}
-
-	errno = (f->f_ops->stat)(f, sb);
-	return (0);
-}
-
-int
 stat(str, sb)
 	const char *str;
 	struct stat *sb;
diff -Pru /usr/src/sys/lib/libsa/strerror.c sys/lib/libsa/strerror.c
--- /usr/src/sys/lib/libsa/strerror.c	Sat Oct 14 03:46:41 1995
+++ sys/lib/libsa/strerror.c	Wed Dec  6 00:12:29 1995
@@ -37,9 +37,6 @@
 #include "saerrno.h"
 #include "stand.h"
 
-size_t	strlen __P((const char *));				/* XXX */
-char	*strcpy __P((char *, const char *));			/* XXX */
-
 char *
 strerror(err)
 	int err;
diff -Pru /usr/src/sys/lib/libsa/ufs.c sys/lib/libsa/ufs.c
--- /usr/src/sys/lib/libsa/ufs.c	Sat Oct 14 03:46:43 1995
+++ sys/lib/libsa/ufs.c	Tue Dec  5 02:34:53 1995
@@ -147,7 +147,7 @@
 	}
 out:
 	free(buf, fs->fs_bsize);
-	return (0);	 
+	return (rc);	 
 }
 
 /*
>Audit-Trail:
>Unformatted: