diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libstand/open.c | 2 | ||||
-rw-r--r-- | lib/libstand/stand.h | 28 | ||||
-rw-r--r-- | lib/libstand/ufs.c | 4 | ||||
-rw-r--r-- | lib/libstand/zalloc.c | 4 | ||||
-rw-r--r-- | lib/libstand/zalloc_defs.h | 8 | ||||
-rw-r--r-- | lib/libstand/zalloc_malloc.c | 7 |
6 files changed, 46 insertions, 7 deletions
diff --git a/lib/libstand/open.c b/lib/libstand/open.c index a3df60a..3a9127c 100644 --- a/lib/libstand/open.c +++ b/lib/libstand/open.c @@ -85,7 +85,7 @@ open(const char *fname, int mode) { struct open_file *f; int fd, i, error, besterror; - char *file; + const char *file; if ((fd = o_gethandle()) == -1) { errno = EMFILE; diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h index fb9ce4a..f4940f0 100644 --- a/lib/libstand/stand.h +++ b/lib/libstand/stand.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: stand.h,v 1.4 1998/09/18 23:00:57 msmith Exp $ + * $Id: stand.h,v 1.5 1998/09/26 01:42:39 msmith Exp $ * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ */ @@ -215,6 +215,7 @@ extern u_long random(void); /* imports from stdlib, locally modified */ extern long strtol(const char *, char **, int); +extern char * strerror(int err); extern char *optarg; /* getopt(3) external variables */ extern int optind, opterr, optopt; extern int getopt(int, char * const [], const char *); @@ -303,9 +304,32 @@ extern int null_stat(struct open_file *f, struct stat *sb); extern int getchar(void); extern int ischar(void); extern void putchar(int); -extern int devopen(struct open_file *, const char *, char **); +extern int devopen(struct open_file *, const char *, const char **); extern int devclose(struct open_file *f); extern void panic(const char *, ...) __dead2; extern struct fs_ops *file_system[]; extern struct devsw *devsw[]; +#if 0 + +static inline void * +malloc_debug(size_t size, const char *file, int line) +{ + void *p; + printf("%s:%d malloc(%ld)", file, line, size); + p = malloc(size); + printf("=%p\n", p); + return p; +} + +static inline void +free_debug(void *p, const char *file, int line) +{ + printf("%s:%d free(%p)\n", file, line, p); + free(p); +} + +#define malloc(x) malloc_debug(x, __FILE__, __LINE__) +#define free(x) free_debug(x, __FILE__, __LINE__) + +#endif diff --git a/lib/libstand/ufs.c b/lib/libstand/ufs.c index bd7f8c7..8511422 100644 --- a/lib/libstand/ufs.c +++ b/lib/libstand/ufs.c @@ -74,6 +74,10 @@ #include "stand.h" #include "string.h" +#ifdef __alpha__ +#define COMPAT_UFS /* DUX has old format file systems */ +#endif + static int ufs_open(const char *path, struct open_file *f); static int ufs_close(struct open_file *f); static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid); diff --git a/lib/libstand/zalloc.c b/lib/libstand/zalloc.c index 053409b..9b4da9e 100644 --- a/lib/libstand/zalloc.c +++ b/lib/libstand/zalloc.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: zalloc.c,v 1.1 1998/09/26 01:42:39 msmith Exp $ + * $Id: zalloc.c,v 1.2 1998/09/26 03:24:14 dillon Exp $ */ /* @@ -564,7 +564,7 @@ zallocstats(MemPool *mp) int fcount = 0; MemNode *mn; - printf("Pool %s, %d bytes reserved", mp->mp_Ident, mp->mp_Size); + printf("Pool %s, %d bytes reserved", mp->mp_Ident, (int) mp->mp_Size); mn = mp->mp_First; diff --git a/lib/libstand/zalloc_defs.h b/lib/libstand/zalloc_defs.h index d80d3a0..6a6e54d 100644 --- a/lib/libstand/zalloc_defs.h +++ b/lib/libstand/zalloc_defs.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: zalloc_defs.h,v 1.1 1998/09/26 01:42:39 msmith Exp $ */ /* @@ -43,8 +43,14 @@ #include <string.h> #include "stand.h" +#ifdef __i386__ typedef unsigned int iaddr_t; /* unsigned int same size as pointer */ typedef int saddr_t; /* signed int same size as pointer */ +#endif +#ifdef __alpha__ +typedef unsigned long iaddr_t; /* unsigned int same size as pointer */ +typedef long saddr_t; /* signed int same size as pointer */ +#endif #include "zalloc_mem.h" diff --git a/lib/libstand/zalloc_malloc.c b/lib/libstand/zalloc_malloc.c index 79e6c80..85d2a85 100644 --- a/lib/libstand/zalloc_malloc.c +++ b/lib/libstand/zalloc_malloc.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: zalloc_malloc.c,v 1.1 1998/09/26 01:42:39 msmith Exp $ */ /* @@ -44,6 +44,11 @@ static int MallocCount; void mallocstats(void); #endif +#ifdef malloc +#undef malloc +#undef free +#endif + void * malloc(size_t bytes) { |