summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>2004-01-24 16:27:32 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:48:49 +0200
commitbeba34dc223aa0dcf3e5f696966c5e8408b022c3 (patch)
treeea0523ac242bd3e877338e9a771b975d4cd3839a /libc
parentb5dac1e3bdd01a2ce105df747a9073ff0d6a94e2 (diff)
downloaddev86-beba34dc223aa0dcf3e5f696966c5e8408b022c3.tar.gz
Import Dev86src-0.16.15.tar.gzv0.16.15
Diffstat (limited to 'libc')
-rw-r--r--libc/Makefile12
-rw-r--r--libc/error/Makefile13
-rw-r--r--libc/error/README9
-rw-r--r--libc/error/error.c2
-rw-r--r--libc/error/error2.c21
-rw-r--r--libc/error/mktab.sh25
-rw-r--r--libc/error/sys_errlist.c2
-rw-r--r--libc/include/linux/stat.h1
-rw-r--r--libc/include/linux/types.h2
-rw-r--r--libc/malloc/malloc.c3
10 files changed, 75 insertions, 15 deletions
diff --git a/libc/Makefile b/libc/Makefile
index a9a5460..481c034 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -20,6 +20,8 @@ include VERSION
endif
CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
+USERID=$(shell id -gn)
+GROUPID=$(shell id -un)
############################################################################
@@ -74,11 +76,11 @@ clean:
############################################################################
install_incl: transfer
- install -d $(BCCHOME)/include
- rm -f $(BCCHOME)/include/linuxmt $(BCCHOME)/include/arch ||:
- cp -Lpr include/* $(BCCHOME)/include
- -chown -R root:root $(BCCHOME)/include
- -chmod -R u=rwX,og=rX $(BCCHOME)/include
+ install -d $(DISTINCL)/include
+ rm -f $(DISTINCL)/include/linuxmt $(DISTINCL)/include/arch ||:
+ cp -LpR include/* $(DISTINCL)/include
+ -chown -R $(USERID):$(GROUPID) $(DISTINCL)/include
+ -chmod -R ugo-x,u=rwX,og=rX $(DISTINCL)/include
############################################################################
diff --git a/libc/error/Makefile b/libc/error/Makefile
index f14e956..01a488f 100644
--- a/libc/error/Makefile
+++ b/libc/error/Makefile
@@ -4,14 +4,23 @@
CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
-ifeq ($(LIB_OS),ELKS)
+ifeq ($(PLATFORM),i86-FAST)
OBJ=error.o sys_errlist.o perror.o sys_siglist.o __assert.o
else
+ifeq ($(LIB_OS),ELKS)
+OBJ=error2.o perror.o sys_siglist.o __assert.o
+else
OBJ=__assert.o
endif
+endif
all: $(LIBC)($(OBJ))
@$(RM) $(OBJ)
clean:
- rm -f *.o libc.a
+ rm -f *.o libc.a error_list.h
+
+$(LIBC)(error2.o): error_list.h
+
+error_list.h: liberror.txt
+ sh mktab.sh
diff --git a/libc/error/README b/libc/error/README
index 02c123f..3165722 100644
--- a/libc/error/README
+++ b/libc/error/README
@@ -1,10 +1,11 @@
-Copyright (C) 1996 Robert de Bath <robert@debath.thenet.co.uk>
+Copyright (C) 1996,2004 Robert de Bath <robert@debath.thenet.co.uk>
This file is part of the Linux-8086 C library and is distributed
under the GNU Library General Public License.
-These routines assume the existance of a file /usr/lib/liberror.txt,
-this file contains the actual error messages. One useful feature,
-the language of the error messages can be easily changed.
+The file "liberror.txt" is the master list of errors for ELKS only.
+WARNING:
+ If you use the -Mf compile style this file must be in the filessystem
+ as "/lib/liberror.txt" unless you're using elksemu.
-Robert
diff --git a/libc/error/error.c b/libc/error/error.c
index 3695719..4be2a56 100644
--- a/libc/error/error.c
+++ b/libc/error/error.c
@@ -24,7 +24,7 @@ int err;
}
if( err <= 0 ) goto unknown; /* NB the <= allows comments in the file */
- fd = open("/usr/lib/liberror.txt", 0);
+ fd = open("/lib/liberror.txt", 0);
if( fd < 0 ) goto unknown;
while( (cc=read(fd, inbuf, sizeof(inbuf))) > 0 )
diff --git a/libc/error/error2.c b/libc/error/error2.c
new file mode 100644
index 0000000..4ad2892
--- /dev/null
+++ b/libc/error/error2.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 1996,2004 Robert de Bath <robert@debath.thenet.co.uk>
+ * This file is part of the Linux-8086 C library and is distributed
+ * under the GNU Library General Public License.
+ */
+#include <string.h>
+
+#include "error_list.h"
+
+char *
+strerror(err)
+int err;
+{
+ static char retbuf[20];
+
+ if( err > 0 && err <= sys_nerr )
+ return sys_errlist[err];
+
+ strcpy(retbuf, "Error ");
+ strcpy(retbuf+6, itoa(err));
+ return retbuf;
+}
diff --git a/libc/error/mktab.sh b/libc/error/mktab.sh
new file mode 100644
index 0000000..b5afcc4
--- /dev/null
+++ b/libc/error/mktab.sh
@@ -0,0 +1,25 @@
+#!/bin/sh -
+
+awk '{
+ e=$0;
+ sub("^[^ ]* ", "", e);
+ sub(" [^ ]*$", "", e);
+ n=0+$1;
+ if (!(n in errlist))
+ errlist[n] = e;
+ if(n > maxerr) maxerr=n;
+}
+END{
+ printf ("#define NR_ERRORS\t%d\n", maxerr+1);
+ printf ("int sys_nerr = NR_ERRORS;\n");
+ printf ("char *sys_errlist[NR_ERRORS] = {\n");
+
+ for(i=0; i<=maxerr; i++) {
+ if (errlist[i] == "")
+ printf(" \"Error %d\"", i);
+ else
+ printf(" \"%s\"", errlist[i]);
+ if (i != maxerr) printf(",\n"); else printf("\n");
+ }
+ printf ("};\n");
+}' < liberror.txt > error_list.h
diff --git a/libc/error/sys_errlist.c b/libc/error/sys_errlist.c
index 48aa6a3..8dfa3ec 100644
--- a/libc/error/sys_errlist.c
+++ b/libc/error/sys_errlist.c
@@ -42,7 +42,7 @@ static void init_vars()
int i, cc, fd, err, len, bufoff=0;
char * ptr;
- fd = open("/usr/lib/liberror.txt", 0);
+ fd = open("/lib/liberror.txt", 0);
if( fd < 0 ) return;
for(i=0; i<NR_ERRORS; i++) sys_errlist[i] = "Unknown error";
diff --git a/libc/include/linux/stat.h b/libc/include/linux/stat.h
index eccf1e4..df7ba75 100644
--- a/libc/include/linux/stat.h
+++ b/libc/include/linux/stat.h
@@ -9,7 +9,6 @@
struct stat {
dev_t st_dev;
- unsigned short __pad1;
ino_t st_ino;
umode_t st_mode;
nlink_t st_nlink;
diff --git a/libc/include/linux/types.h b/libc/include/linux/types.h
index c1a6d7e..b5418db 100644
--- a/libc/include/linux/types.h
+++ b/libc/include/linux/types.h
@@ -14,7 +14,7 @@ typedef __u16 mode_t;
typedef __u32 loff_t;
typedef __u32 speed_t;
-typedef __u16 dev_t;
+typedef __u32 dev_t;
typedef __u32 ino_t;
typedef __u32 tcflag_t;
typedef __u8 cc_t;
diff --git a/libc/malloc/malloc.c b/libc/malloc/malloc.c
index 86ffd42..61ff3d4 100644
--- a/libc/malloc/malloc.c
+++ b/libc/malloc/malloc.c
@@ -78,6 +78,9 @@ mem *x;
#endif
#ifdef L_alloca
+/* This alloca is based on the same concept as the EMACS fallback alloca.
+ * It should probably be considered Copyright the FSF under the GPL.
+ */
static mem *alloca_stack = 0;
void *