new libraries

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
Subject: new libraries
Date: Monday, February 24, 1992 - 3:11 am

Good stuff.

Do we have a timetable for the rest of the GNU C standard library?
After encouragement from Bruce Evans and John Kohl I found that Chris
Torek's new stdio implementation from the BSD Networking Release 2
compiles with relatively few changes.  This stdio is designed to be
ANSI and BSD compatible and is much better than the old BSD code.
If the GNU libc.a is going to be a long wait, we might want to use
this stdio.

In fact, enough of the BSD routines compile so that when combined with
what we already have in Linux to the best of my knowledge all that is
missing for a POSIX compatible libc.a is fpathconf, mkfifo, pathconf,
siglongjmp, sigsetjmp, strtod, tcdrain, tcflush and tcsendbreak.  In
particular, the BSD code contains all the POSIX time functions and
works with the TZ environment variable.

About the new library:  sysconf.c needs to be fixed to return the correct
answers for job control and saved ids.  This is utterly trivial, but we
don't want to overlook it, even though I haven't seen a single application
that uses it.  (The GNU utilities would use sysconf if any of the values
could change at runtime.  In Linux, all these values are constants and
can be snarfed from <limits.h> at compile time.)

Several folks have (quite reasonably) complained about the error messages
in sys_errlist.  Following is the error list I use.  (Add errlist.o to
the objects in gen/Makefile.)

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#       errlist.c
#       strerror.c
#
echo x - errlist.c
sed 's/^X//' >errlist.c << 'END-of-errlist.c'
Xchar * sys_errlist[] = {
X       "Unknown error",                /* 0 */
X       "Operation not permitted",      /* EPERM */
X       "No such file or directory",    /* ENOENT */
X       "No such process",              /* ESRCH */
X       "Interrupted system call",      /* EINTR */
X       "I/O error",                    /* EIO */
X       "No such device",               /* ENXIO */
X       "Argument list too long",       /* E2BIG */
X       "Exec format error",            /* ENOEXEC */
X       "Bad file descriptor",          /* EBADF */
X       "No child processes",           /* ECHILD */
X       "Try again",                    /* EAGAIN */
X       "Out of memory",                /* ENOMEM */
X       "Permission denied",            /* EACCES */
X       "Invalid address",              /* EFAULT */
X       "Block device required",        /* ENOTBLK */
X       "Device or resource busy",      /* EBUSY */
X       "File exists",                  /* EEXIST */
X       "Cross device link",            /* EXDEV */
X       "No such device",               /* ENODEV */
X       "Not a directory",              /* ENOTDIR */
X       "Is a directory",               /* EISDIR */
X       "Invalid argument",             /* EINVAL */
X       "File table overflow",          /* ENFILE */
X       "Too many open files",          /* EMFILE */
X       "Inappropriate ioctl",          /* ENOTTY */
X       "Text file busy",               /* ETXTBSY */
X       "File too large",               /* EFBIG */
X       "No space left on device",      /* ENOSPC */
X       "Invalid seek",                 /* ESPIPE */
X       "Read-only file system",        /* EROFS */
X       "Too many links",               /* EMLINK */
X       "Broken pipe",                  /* EPIPE */
X       "Math argument out of domain",  /* EDOM */
X       "Result too large",             /* ERANGE */
X       "Resource deadlock would occur",/* EDEADLK */
X       "Filename too long",            /* ENAMETOOLONG */
X       "No locks available",           /* ENOLCK */
X       "Function not implemented",     /* ENOSYS */
X       "Directory not empty"           /* ENOTEMPTY */
X       };
X
X#define NR_ERRORS ((sizeof (sys_errlist))/(sizeof(char *))-1)
X
Xint sys_nerr = NR_ERRORS;
X
END-of-errlist.c
echo x - strerror.c
sed 's/^X//' >strerror.c << 'END-of-strerror.c'
X#include <string.h>
X
Xextern int sys_nerr;
Xextern char *sys_errlist[];
X
Xchar * strerror(int n)
X{
X       if (n<0 || n>sys_nerr) n=0;
X       return sys_errlist[n];
X}
X
END-of-strerror.c
exit

--
Doug Quale
quale@khan.cs.wisc.edu
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
new libraries, Douglas E. Quale, (Mon Feb 24, 3:11 am)