From c46806bf74c2618daa398cb7c3e4b1c47509a105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 4 Jun 2003 18:47:09 +0000 Subject: even more removals --- mdk-stage1/dietlibc/lib/__xmknod.c | 6 -- mdk-stage1/dietlibc/lib/alarm.c | 47 ------------ mdk-stage1/dietlibc/lib/errlist.c | 132 --------------------------------- mdk-stage1/dietlibc/lib/getservent.c | 137 ----------------------------------- mdk-stage1/dietlibc/lib/memccmp.c | 17 ----- mdk-stage1/dietlibc/lib/nop.c | 7 -- mdk-stage1/dietlibc/lib/puts.c | 12 --- mdk-stage1/dietlibc/lib/random.c | 9 --- mdk-stage1/dietlibc/lib/set_errno.c | 9 --- mdk-stage1/dietlibc/lib/speed.c | 67 ----------------- mdk-stage1/dietlibc/lib/vfprintf.c | 19 ----- mdk-stage1/dietlibc/lib/vprintf.c | 14 ---- 12 files changed, 476 deletions(-) delete mode 100644 mdk-stage1/dietlibc/lib/__xmknod.c delete mode 100644 mdk-stage1/dietlibc/lib/alarm.c delete mode 100644 mdk-stage1/dietlibc/lib/errlist.c delete mode 100644 mdk-stage1/dietlibc/lib/getservent.c delete mode 100644 mdk-stage1/dietlibc/lib/memccmp.c delete mode 100644 mdk-stage1/dietlibc/lib/nop.c delete mode 100644 mdk-stage1/dietlibc/lib/puts.c delete mode 100644 mdk-stage1/dietlibc/lib/random.c delete mode 100644 mdk-stage1/dietlibc/lib/set_errno.c delete mode 100644 mdk-stage1/dietlibc/lib/speed.c delete mode 100644 mdk-stage1/dietlibc/lib/vfprintf.c delete mode 100644 mdk-stage1/dietlibc/lib/vprintf.c (limited to 'mdk-stage1/dietlibc/lib') diff --git a/mdk-stage1/dietlibc/lib/__xmknod.c b/mdk-stage1/dietlibc/lib/__xmknod.c deleted file mode 100644 index 4739a1f5f..000000000 --- a/mdk-stage1/dietlibc/lib/__xmknod.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int __xmknod(int ver,char* filename,mode_t mode,dev_t *dev) { - return mknod(filename,mode,*dev); -} - diff --git a/mdk-stage1/dietlibc/lib/alarm.c b/mdk-stage1/dietlibc/lib/alarm.c deleted file mode 100644 index fd35372f2..000000000 --- a/mdk-stage1/dietlibc/lib/alarm.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1991, 1992, 1994, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. - If SECONDS is zero, any currently scheduled alarm will be cancelled. - The function returns the number of seconds remaining until the last - alarm scheduled would have signaled, or zero if there wasn't one. - There is no return value to indicate an error, but you can set `errno' - to 0 and check its value after calling `alarm', and this might tell you. - The signal may come late due to processor scheduling. */ -unsigned int -alarm (seconds) - unsigned int seconds; -{ - struct itimerval old, new; - unsigned int retval; - - new.it_interval.tv_usec = 0; - new.it_interval.tv_sec = 0; - new.it_value.tv_usec = 0; - new.it_value.tv_sec = (long int) seconds; - if (setitimer (ITIMER_REAL, &new, &old) < 0) - return 0; - - retval = old.it_value.tv_sec; - if (old.it_value.tv_usec) - ++retval; - return retval; -} diff --git a/mdk-stage1/dietlibc/lib/errlist.c b/mdk-stage1/dietlibc/lib/errlist.c deleted file mode 100644 index d0e712190..000000000 --- a/mdk-stage1/dietlibc/lib/errlist.c +++ /dev/null @@ -1,132 +0,0 @@ - -const char *const sys_errlist[] = { - "Success", /* 0 */ - "Operation not permitted", /* EPERM */ - "No such file or directory", /* ENOENT */ - "No such process", /* ESRCH */ - "Interrupted system call", /* EINTR */ - "I/O error", /* EIO */ - "No such device or address", /* ENXIO */ - "Arg list too long", /* E2BIG */ - "Exec format error", /* ENOEXEC */ - "Bad file number", /* EBADF */ - "No child processes", /* ECHILD */ - "Try again", /* EAGAIN */ - "Out of memory", /* ENOMEM */ - "Permission denied", /* EACCES */ - "Bad address", /* EFAULT */ - "Block device required", /* ENOTBLK */ - "Device or resource busy", /* EBUSY */ - "File exists", /* EEXIST */ - "Cross-device link", /* EXDEV */ - "No such device", /* ENODEV */ - "Not a directory", /* ENOTDIR */ - "Is a directory", /* EISDIR */ - "Invalid argument", /* EINVAL */ - "File table overflow", /* ENFILE */ - "Too many open files", /* EMFILE */ - "Not a typewriter", /* ENOTTY */ - "Text file busy", /* ETXTBSY */ - "File too large", /* EFBIG */ - "No space left on device", /* ENOSPC */ - "Illegal seek", /* ESPIPE */ - "Read-only file system", /* EROFS */ - "Too many links", /* EMLINK */ - "Broken pipe", /* EPIPE */ - "Math argument out of domain of func", /* EDOM */ - "Math result not representable", /* ERANGE */ - "Resource deadlock would occur", /* EDEADLK */ - "File name too long", /* ENAMETOOLONG */ - "No record locks available", /* ENOLCK */ - "Function not implemented", /* ENOSYS */ - "Directory not empty", /* ENOTEMPTY */ - "Too many symbolic links encountered", /* ELOOP */ - "Operation would block", /* EWOULDBLOCK */ - "No message of desired type", /* ENOMSG */ - "Identifier removed", /* EIDRM */ - "Channel number out of range", /* ECHRNG */ - "Level 2 not synchronized", /* EL2NSYNC */ - "Level 3 halted", /* EL3HLT */ - "Level 3 reset", /* EL3RST */ - "Link number out of range", /* ELNRNG */ - "Protocol driver not attached", /* EUNATCH */ - "No CSI structure available", /* ENOCSI */ - "Level 2 halted", /* EL2HLT */ - "Invalid exchange", /* EBADE */ - "Invalid request descriptor", /* EBADR */ - "Exchange full", /* EXFULL */ - "No anode", /* ENOANO */ - "Invalid request code", /* EBADRQC */ - "Invalid slot", /* EBADSLT */ - "File locking deadlock error", /* EDEADLOCK */ - "Bad font file format", /* EBFONT */ - "Device not a stream", /* ENOSTR */ - "No data available", /* ENODATA */ - "Timer expired", /* ETIME */ - "Out of streams resources", /* ENOSR */ - "Machine is not on the network", /* ENONET */ - "Package not installed", /* ENOPKG */ - "Object is remote", /* EREMOTE */ - "Link has been severed", /* ENOLINK */ - "Advertise error", /* EADV */ - "Srmount error", /* ESRMNT */ - "Communication error on send", /* ECOMM */ - "Protocol error", /* EPROTO */ - "Multihop attempted", /* EMULTIHOP */ - "RFS specific error", /* EDOTDOT */ - "Not a data message", /* EBADMSG */ - "Value too large for defined data type", /* EOVERFLOW */ - "Name not unique on network", /* ENOTUNIQ */ - "File descriptor in bad state", /* EBADFD */ - "Remote address changed", /* EREMCHG */ - "Can not access a needed shared library", /* ELIBACC */ - "Accessing a corrupted shared library", /* ELIBBAD */ - ".lib section in a.out corrupted", /* ELIBSCN */ - "Attempting to link in too many shared libraries", /* ELIBMAX */ - "Cannot exec a shared library directly", /* ELIBEXEC */ - "Illegal byte sequence", /* EILSEQ */ - "Interrupted system call should be restarted", /* ERESTART */ - "Streams pipe error", /* ESTRPIPE */ - "Too many users", /* EUSERS */ - "Socket operation on non-socket", /* ENOTSOCK */ - "Destination address required", /* EDESTADDRREQ */ - "Message too long", /* EMSGSIZE */ - "Protocol wrong type for socket", /* EPROTOTYPE */ - "Protocol not available", /* ENOPROTOOPT */ - "Protocol not supported", /* EPROTONOSUPPORT */ - "Socket type not supported", /* ESOCKTNOSUPPORT */ - "Operation not supported on transport endpoint", /* EOPNOTSUPP */ - "Protocol family not supported", /* EPFNOSUPPORT */ - "Address family not supported by protocol", /* EAFNOSUPPORT */ - "Address already in use", /* EADDRINUSE */ - "Cannot assign requested address", /* EADDRNOTAVAIL */ - "Network is down", /* ENETDOWN */ - "Network is unreachable", /* ENETUNREACH */ - "Network dropped connection because of reset", /* ENETRESET */ - "Software caused connection abort", /* ECONNABORTED */ - "Connection reset by peer", /* ECONNRESET */ - "No buffer space available", /* ENOBUFS */ - "Transport endpoint is already connected", /* EISCONN */ - "Transport endpoint is not connected", /* ENOTCONN */ - "Cannot send after transport endpoint shutdown", /* ESHUTDOWN */ - "Too many references: cannot splice", /* ETOOMANYREFS */ - "Connection timed out", /* ETIMEDOUT */ - "Connection refused", /* ECONNREFUSED */ - "Host is down", /* EHOSTDOWN */ - "No route to host", /* EHOSTUNREACH */ - "Operation already in progress", /* EALREADY */ - "Operation now in progress", /* EINPROGRESS */ - "Stale NFS file handle", /* ESTALE */ - "Structure needs cleaning", /* EUCLEAN */ - "Not a XENIX named type file", /* ENOTNAM */ - "No XENIX semaphores available", /* ENAVAIL */ - "Is a named type file", /* EISNAM */ - "Remote I/O error", /* EREMOTEIO */ - "Quota exceeded", /* EDQUOT */ - "No medium found", /* ENOMEDIUM */ - "Wrong medium type", /* EMEDIUMTYPE */ - 0 -}; - - -const int sys_nerr = ((sizeof (sys_errlist))/(sizeof(char *))-1); diff --git a/mdk-stage1/dietlibc/lib/getservent.c b/mdk-stage1/dietlibc/lib/getservent.c deleted file mode 100644 index bf25d046b..000000000 --- a/mdk-stage1/dietlibc/lib/getservent.c +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -static int servicesfd=-1; -static char* servicesmap; -static unsigned int serviceslen; - -static char* aliases[10]; - -static char *cur; - -/* nameserver 42/tcp name # IEN 116 */ -struct servent *getservent(void) { - static struct servent se; - char *last; - int aliasidx; - if (servicesfd<0) { - servicesfd=open(_PATH_SERVICES,O_RDONLY); - if (servicesfd<0) return 0; - serviceslen=lseek(servicesfd,0,SEEK_END); - servicesmap=mmap(0,serviceslen,PROT_READ|PROT_WRITE,MAP_PRIVATE,servicesfd,0); - if ((long)servicesmap==(-1)) goto error; - cur=servicesmap; - } - last=servicesmap+serviceslen; -again: - se.s_name=0; - se.s_aliases=aliases; aliases[0]=0; - se.s_port=0; - se.s_proto=0; - if (cur>=last) return 0; - if (*cur=='#' || *cur=='\n') goto parseerror; - /* first, the primary name */ - if (!isalpha(*cur)) goto parseerror; - se.s_name=cur; - se.s_aliases=aliases; - while (cur=last) return 0; - if (*cur=='\n') goto parseerror; - *cur=0; cur++; - /* second, the port */ - while (cur=last) return 0; - /* third, "/tcp" or "/udp" */ - if (*cur!='/') goto parseerror; - cur++; - se.s_proto=cur; - while (cur=last) return 0; - if (*cur=='\n') { *cur++=0; return &se; } - *cur=0; cur++; - /* now the aliases */ - for (aliasidx=0;aliasidx<10;++aliasidx) { - while (cur=last || !isblank(*cur)) break; - *cur++=0; - } - aliases[aliasidx]=0; - return &se; -parseerror: - while (curs_name,strlen(s->s_name)); - write(1,"/",1); - write(1,s->s_proto,strlen(s->s_proto)); - write(1,"\n",1); - if (!strcmp(name,"auth")) { - tmp=s->s_aliases; - write(1," aka ",5); - while (*tmp) { - write(1,*tmp,strlen(*tmp)); - write(1,", ",2); - ++tmp; - } - write(1,"\n",1); - } -#endif - if (!strcmp(name,s->s_name) && !strcmp(proto,s->s_proto)) - return s; - tmp=s->s_aliases; - while (*tmp) - if (!strcmp(name,*tmp++)) return s; - } - return 0; -} - -struct servent *getservbyport(int port, const char *proto) { - struct servent *s; - for (s=getservent(); s; s=getservent()) { - if (port==s->s_port && !strcmp(proto,s->s_proto)) - return s; - } - return 0; -} - -void endservent(void) { - if (servicesmap!=(char*)-1) munmap(servicesmap,serviceslen); - if (servicesfd!=-1) close(servicesfd); - servicesmap=(char*)-1; - servicesfd=-1; -} - diff --git a/mdk-stage1/dietlibc/lib/memccmp.c b/mdk-stage1/dietlibc/lib/memccmp.c deleted file mode 100644 index 3a8c14f60..000000000 --- a/mdk-stage1/dietlibc/lib/memccmp.c +++ /dev/null @@ -1,17 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include - -int memccmp(const void *dst, const void *src, int c, size_t count) -{ - register const char *a = dst; - register const char *b = src; - while (count--) - { - register int res=(*a - *b); - if (res) return res; - if (*a==c) return 0; - ++a; ++b; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/nop.c b/mdk-stage1/dietlibc/lib/nop.c deleted file mode 100644 index c05bea813..000000000 --- a/mdk-stage1/dietlibc/lib/nop.c +++ /dev/null @@ -1,7 +0,0 @@ - -int __fflush_stdin() __attribute__((weak,alias("__return0"))); -int __fflush_stdout() __attribute__((weak,alias("__return0"))); -int __fflush_stderr() __attribute__((weak,alias("__return0"))); - -/* used for weak aliases */ -int __return0() { return 0; } diff --git a/mdk-stage1/dietlibc/lib/puts.c b/mdk-stage1/dietlibc/lib/puts.c deleted file mode 100644 index 54415151d..000000000 --- a/mdk-stage1/dietlibc/lib/puts.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include "dietstdio.h" -#include "dietfeatures.h" - -int puts(const char *s) { -#ifdef WANT_BUFFERED_STDIO - return fwrite(s,1,strlen(s),stdout) && fputc('\n',stdout); -#else - return write(1,s,strlen(s)) && write(1,"\n",1); -#endif -} diff --git a/mdk-stage1/dietlibc/lib/random.c b/mdk-stage1/dietlibc/lib/random.c deleted file mode 100644 index e7785c455..000000000 --- a/mdk-stage1/dietlibc/lib/random.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -static unsigned int seed=1; - -long int random() { - return ((seed = seed * 1103515245 + 12345) % ((unsigned int)RAND_MAX + 1)); -} - -void srandom(unsigned int i) { seed=i; } diff --git a/mdk-stage1/dietlibc/lib/set_errno.c b/mdk-stage1/dietlibc/lib/set_errno.c deleted file mode 100644 index 6553bc496..000000000 --- a/mdk-stage1/dietlibc/lib/set_errno.c +++ /dev/null @@ -1,9 +0,0 @@ -extern int errno; - -void __set_errno(int error) __attribute__ ((weak)); - -void __set_errno(int error) -{ - errno=error; -} - diff --git a/mdk-stage1/dietlibc/lib/speed.c b/mdk-stage1/dietlibc/lib/speed.c deleted file mode 100644 index a7fcca7c9..000000000 --- a/mdk-stage1/dietlibc/lib/speed.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include - -#include - -extern int errno; - -/* Hack around a kernel bug; value must correspond to the one used in tcsetattr.c */ -#define IBAUD0 020000000000 - - -/* Return the output baud rate stored in *TERMIOS_P. */ -speed_t cfgetospeed (struct termios *termios_p) -{ - return termios_p->c_cflag & (CBAUD | CBAUDEX); -} - - -/* Return the input baud rate stored in *TERMIOS_P. - Although for Linux there is no difference between input and output - speed, the numerical 0 is a special case for the input baud rate. It - should set the input baud rate to the output baud rate. */ -speed_t cfgetispeed (struct termios *termios_p) -{ - return ((termios_p->c_iflag & IBAUD0) - ? 0 : termios_p->c_cflag & (CBAUD | CBAUDEX)); -} - - -/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -int cfsetospeed (struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) { - errno = EINVAL; - return -1; - } - - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - - return 0; -} - - -/* Set the input baud rate stored in *TERMIOS_P to SPEED. - Although for Linux there is no difference between input and output - speed, the numerical 0 is a special case for the input baud rate. It - should set the input baud rate to the output baud rate. */ -int cfsetispeed (struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) { - errno = EINVAL; - return -1; - } - - if (speed == 0) - termios_p->c_iflag |= IBAUD0; - else - { - termios_p->c_iflag &= ~IBAUD0; - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - } - - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/vfprintf.c b/mdk-stage1/dietlibc/lib/vfprintf.c deleted file mode 100644 index c33a2404b..000000000 --- a/mdk-stage1/dietlibc/lib/vfprintf.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include "dietstdarg.h" - -int vfprintf(FILE *fstream, const char *format, va_list ap) -{ - char *tmp; - va_list cp_ap; - size_t n = 0; - - va_copy(cp_ap, ap); - n=vsnprintf(0, 1000000, format, cp_ap); - tmp=alloca(n+2); - vsnprintf(tmp, n+1, format, ap); - fwrite(tmp, n,1, fstream); - return n; -} - diff --git a/mdk-stage1/dietlibc/lib/vprintf.c b/mdk-stage1/dietlibc/lib/vprintf.c deleted file mode 100644 index 46ecc47a4..000000000 --- a/mdk-stage1/dietlibc/lib/vprintf.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include -#include - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int vprintf(const char *format, va_list ap) -{ - char tmp[1000000]; - size_t n = vsnprintf(tmp, sizeof(tmp), format, ap); - write(1, tmp, n); - return n; -} -- cgit v1.2.1