summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/dietlibc/alpha/signal.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/sigprocmask.S3
-rw-r--r--mdk-stage1/dietlibc/dietstdarg.h12
-rw-r--r--mdk-stage1/dietlibc/dirstream.h78
-rw-r--r--mdk-stage1/dietlibc/lib/__xmknod.c6
-rw-r--r--mdk-stage1/dietlibc/lib/alarm.c47
-rw-r--r--mdk-stage1/dietlibc/lib/errlist.c132
-rw-r--r--mdk-stage1/dietlibc/lib/getservent.c137
-rw-r--r--mdk-stage1/dietlibc/lib/memccmp.c17
-rw-r--r--mdk-stage1/dietlibc/lib/nop.c7
-rw-r--r--mdk-stage1/dietlibc/lib/puts.c12
-rw-r--r--mdk-stage1/dietlibc/lib/random.c9
-rw-r--r--mdk-stage1/dietlibc/lib/set_errno.c9
-rw-r--r--mdk-stage1/dietlibc/lib/speed.c67
-rw-r--r--mdk-stage1/dietlibc/lib/vfprintf.c19
-rw-r--r--mdk-stage1/dietlibc/lib/vprintf.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/entlib.c153
-rw-r--r--mdk-stage1/dietlibc/libcruft/entlib.h44
-rw-r--r--mdk-stage1/dietlibc/libcruft/grent.c54
-rw-r--r--mdk-stage1/dietlibc/libcruft/pwent.c43
-rw-r--r--mdk-stage1/dietlibc/libcruft/spent.c45
-rw-r--r--mdk-stage1/dietlibc/libdl/elf_hash.c12
-rw-r--r--mdk-stage1/dietlibc/libpthread/thread_internal.c344
-rw-r--r--mdk-stage1/dietlibc/libpthread/thread_key.c41
-rw-r--r--mdk-stage1/dietlibc/libstdio/fgetc.c40
-rw-r--r--mdk-stage1/dietlibc/libstdio/fputc.c19
-rw-r--r--mdk-stage1/dietlibc/libugly/daemon.c35
-rw-r--r--mdk-stage1/dietlibc/start.h14
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/exit.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/llseek.S6
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ptrace.s3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/pwrite.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigaction.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/signal.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigpending.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigprocmask.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigsuspend.S3
37 files changed, 0 insertions, 1446 deletions
diff --git a/mdk-stage1/dietlibc/alpha/signal.S b/mdk-stage1/dietlibc/alpha/signal.S
deleted file mode 100644
index ceca0f02d..000000000
--- a/mdk-stage1/dietlibc/alpha/signal.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(osf_signal,signal)
diff --git a/mdk-stage1/dietlibc/alpha/sigprocmask.S b/mdk-stage1/dietlibc/alpha/sigprocmask.S
deleted file mode 100644
index d9da836c2..000000000
--- a/mdk-stage1/dietlibc/alpha/sigprocmask.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(osf_sigprocmask,sigprocmask,__sigprocmask)
diff --git a/mdk-stage1/dietlibc/dietstdarg.h b/mdk-stage1/dietlibc/dietstdarg.h
deleted file mode 100644
index 827671b22..000000000
--- a/mdk-stage1/dietlibc/dietstdarg.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdarg.h>
-
-/* this assumes that va_copy() will be a macro, it is on gcc */
-#ifndef va_copy
-# ifdef __va_copy
-# define va_copy(x, y) __va_copy(x, y)
-# else
-/* assume copying it works... */
-# define va_copy(x, y) x = y
-# endif
-#endif
-
diff --git a/mdk-stage1/dietlibc/dirstream.h b/mdk-stage1/dietlibc/dirstream.h
deleted file mode 100644
index dc8fba79c..000000000
--- a/mdk-stage1/dietlibc/dirstream.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 1991, 1992 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, 1992 Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-/*
- * POSIX Standard: 5.1.2 Directory Operations <dirent.h>
- */
-
-#ifndef _DIRSTREAM_H
-
-#define _DIRSTREAM_H 1
-
-#include <sys/types.h>
-#include <dirent.h>
-#ifdef _POSIX_THREADS
-#include <pthread.h>
-#endif
-
-/* For now, syscall readdir () only supports one entry at a time. It
- * will be changed in the future.
-#define NUMENT 3
-*/
-#ifndef NUMENT
-#define NUMENT 1
-#endif
-
-#define SINGLE_READDIR 11
-#define MULTI_READDIR 12
-#define NEW_READDIR 13
-
-/* Directory stream type. */
-struct __dirstream {
- /* file descriptor */
- int dd_fd;
-
- /* offset of the next dir entry in buffer */
- off_t dd_nextloc;
-
- /* bytes of valid entries in buffer */
- size_t dd_size;
-
- /* -> directory buffer */
- struct dirent *dd_buf;
-
- /* we have to convert */
- struct dirent convbuf;
-
- /* offset of the next dir entry in directory. */
- off_t dd_nextoff;
-
- /* total size of buffer */
- size_t dd_max;
-
- enum {unknown, have_getdents, no_getdents} dd_getdents;
-
- /* lock */
-#ifdef _POSIX_THREADS
- pthread_mutex_t *dd_lock;
-#else
- void *dd_lock;
-#endif
-}; /* stream data from opendir() */
-
-#endif /* dirent.h */
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 <sys/stat.h>
-
-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 <unistd.h>
-#include <sys/time.h>
-
-/* 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 <unistd.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <ctype.h>
-
-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 && isalnum(*cur)) cur++;
- if (cur>=last) return 0;
- if (*cur=='\n') goto parseerror;
- *cur=0; cur++;
- /* second, the port */
- while (cur<last && isblank(*cur)) cur++;
- while (cur<last && isdigit(*cur)) {
- se.s_port=se.s_port*10+*cur-'0';
- cur++;
- }
- se.s_port=htons(se.s_port);
- if (cur>=last) return 0;
- /* third, "/tcp" or "/udp" */
- if (*cur!='/') goto parseerror;
- cur++;
- se.s_proto=cur;
- while (cur<last && isalpha(*cur)) ++cur;
- if (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)) ++cur;
- aliases[aliasidx]=cur;
- while (cur<last && isalpha(*cur)) ++cur;
- if (*cur=='\n') { *cur++=0; ++aliasidx; break; }
- if (cur>=last || !isblank(*cur)) break;
- *cur++=0;
- }
- aliases[aliasidx]=0;
- return &se;
-parseerror:
- while (cur<last && *cur!='\n') cur++;
- cur++;
- goto again;
-error:
- if (servicesmap!=(char*)-1) munmap(servicesmap,serviceslen);
- if (servicesfd!=-1) close(servicesfd);
- servicesmap=(char*)-1;
- servicesfd=-1;
- errno=ENOMEM;
- return 0;
-}
-
-void setservent(int stayopen) {
- cur=servicesmap;
-}
-
-struct servent *getservbyname(const char *name, const char *proto) {
- struct servent *s;
- setservent(0);
- for (s=getservent(); s; s=getservent()) {
- char **tmp;
-#if 0
- write(1,"found ",6);
- write(1,s->s_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 <sys/types.h>
-
-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 <unistd.h>
-#include <string.h>
-#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 <stdlib.h>
-
-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 <unistd.h>
-#include <termios.h>
-#include <sys/types.h>
-
-#include <asm/errno.h>
-
-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 <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#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 <stdarg.h>
-#include <linux/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-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;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/entlib.c b/mdk-stage1/dietlibc/libcruft/entlib.c
deleted file mode 100644
index f88b3f057..000000000
--- a/mdk-stage1/dietlibc/libcruft/entlib.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * dietlibc/lib/entlib.c - Generic delimited-line parsing library
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-
-/*
- * __ent_start
- *
- * Allocates and zeroes the module's state structure,
- * and open a handle to /etc/passwd.
- *
- * Returns -1 on failure and sets errno, or zero for success.
- */
-
-int __ent_start(const char *pathname, struct __ent_state **st_ref)
-{
- struct __ent_state *st;
-
- if (*st_ref)
- return 0;
-
- st = calloc(1, sizeof(*st));
- if (!st) {
- errno = ENOMEM;
- return -1;
- }
-
- st->fd = open(pathname, O_RDONLY);
- if (st->fd == -1) {
- /* errno should have been set by open(2) */
- free(st);
- st = NULL;
- return -1;
- }
-
- *st_ref = st;
- return 0;
-}
-
-
-/*
- * __ent_get_line
- *
- * Eliminates a previous line from the buffer, if any.
- * Then reads in a new line from /etc/passwd, if necessary.
- *
- * Returns -1 on failure, or zero for success.
- */
-
-int __ent_get_line(struct __ent_state *st)
-{
- int rc;
-
- /* overwrite previous line, by shifting the rest
- * of the rest to the front of the buffer
- */
- if (st->bufptr) {
- unsigned int slop = st->buflen - st->bufptr;
- memmove(st->ent_buf, &st->ent_buf[st->bufptr], slop);
- st->bufptr = 0;
- st->buflen = slop;
- st->ent_buf[st->buflen] = 0; /* null terminate */
- }
-
- if (st->buflen == __ENT_BUFSIZ || strchr(st->ent_buf, '\n'))
- return 0;
-
- rc = read(st->fd, &st->ent_buf[st->buflen], __ENT_BUFSIZ - st->buflen);
- if (rc < 0)
- return -1;
-
- st->buflen += rc;
- if (st->buflen == 0)
- return -1;
-
- return 0;
-}
-
-
-/*
- * __ent_split
- *
- * Splits a string into parts based on a delimiter.
- * Stops processing when \n is reached also.
- *
- * Returns -1 on failure, or zero on success.
- */
-
-int __ent_split(struct __ent_state *st, char **parts,
- int n_parts, int delimiter, int require_exact)
-{
- char *s = &st->ent_buf[st->bufptr];
- int idx = 0;
-
- /* empty list */
- if (!*s) {
- if (!require_exact)
- return 0;
- return -1;
- }
-
- /* scan through string, sticking string pointers
- * into parts[] as delimiters are found
- */
- parts[idx++] = s;
- while (*s) {
- st->bufptr++;
- if (*s == '\n') {
- *s = 0; /* null terminate */
- break;
- }
- if (*s == delimiter) {
- *s = 0; /* null terminate */
- /* boundary error: too many delimiters */
- if (idx == n_parts)
- return -1;
- s++;
- parts[idx++] = s;
- } else {
- s++;
- }
- }
-
- if (!require_exact)
- return 0;
- return (n_parts == idx) ? 0 : -1;
-}
-
-
-void __ent_set(struct __ent_state *st)
-{
- if (!st)
- return;
- st->buflen = st->bufptr = 0;
- lseek(st->fd, 0, SEEK_SET);
-}
-
-
-void __ent_end(struct __ent_state *st)
-{
- if (!st)
- return;
- close(st->fd);
- free(st);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/entlib.h b/mdk-stage1/dietlibc/libcruft/entlib.h
deleted file mode 100644
index 2659d542e..000000000
--- a/mdk-stage1/dietlibc/libcruft/entlib.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * dietlibc/lib/entlib.h - Generic delimited-line parsing library header
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-#ifndef __ENTLIB_H
-#define __ENTLIB_H
-
-#include <sys/types.h> /* for open(2), lseek(2) */
-#include <sys/stat.h> /* for open(2) */
-#include <fcntl.h> /* for open(2) */
-#include <unistd.h> /* for close(2), lseek(2) */
-#include <stdlib.h> /* for calloc(3), free(3) */
-#include <errno.h> /* for errno */
-#include <string.h> /* for memmove(3) */
-#include <stdlib.h> /* for atoi(3) */
-#include <paths.h> /* for the file locations */
-
-#include <pwd.h> /* for struct passwd */
-#include <grp.h> /* for struct group */
-#include <shadow.h> /* for struct spwd */
-
-/* should be a multiple of 64 to create decent alignment */
-#define __ENT_BUFSIZ (64 * 2)
-#define __ENT_RAW_BUFSIZ (__ENT_BUFSIZ + 2) /* some overlap required */
-
-struct __ent_state {
- char ent_buf[__ENT_RAW_BUFSIZ]; /* raw file data buffer */
- unsigned int buflen; /* amount of valid data in ent_buf */
- unsigned int bufptr; /* next valid position in ent_buf */
- int fd; /* /etc/passwd file descriptor */
-};
-
-extern int __ent_start(const char *pathname, struct __ent_state **st_ref);
-extern int __ent_get_line(struct __ent_state *st);
-extern int __ent_split(struct __ent_state *st, char **parts, int n_parts, int delimiter, int require_exact);
-extern void __ent_set(struct __ent_state *st);
-extern void __ent_end(struct __ent_state *st);
-
-#endif /* __ENTLIB_H */
diff --git a/mdk-stage1/dietlibc/libcruft/grent.c b/mdk-stage1/dietlibc/libcruft/grent.c
deleted file mode 100644
index 0357657de..000000000
--- a/mdk-stage1/dietlibc/libcruft/grent.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * dietlibc/lib/grent.c - getgrent(3)/setgrent(3)/endgrent(3) implementation
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-#define MAX_GROUP_MEMBERS 16 /* matches Linux kernel task struct */
-
-static struct __ent_state *st = NULL; /* state held across calls */
-static char *gr_mem[MAX_GROUP_MEMBERS+1];
-static struct group gr;
-
-struct group *getgrent(void)
-{
- char *parts[4], *grouplist;
- unsigned int bufptr;
-
- if (__ent_start(_PATH_GROUP, &st))
- return NULL;
- if (__ent_get_line(st))
- goto err_out;
- if (__ent_split(st, parts, 4, ':', 1) < 0)
- goto err_out;
-
- gr.gr_name = parts[0];
- gr.gr_passwd = parts[1];
- gr.gr_gid = (gid_t) atoi(parts[2]);
- grouplist = parts[3];
-
- memset(&gr_mem, 0, sizeof(gr_mem));
- gr.gr_mem = gr_mem;
-
- /* rewind bufptr to beginning of group list */
- bufptr = st->bufptr;
- st->bufptr = (int) (grouplist - st->ent_buf);
-
- __ent_split(st, gr_mem, MAX_GROUP_MEMBERS, ',', 0);
- st->bufptr = bufptr;
-
- return &gr;
-
-err_out:
- st->buflen = st->bufptr = 0; /* invalidate file data buffer */
- return NULL;
-}
-
-void setgrent(void) { __ent_set(st); }
-void endgrent(void) { __ent_end(st); st=NULL; }
diff --git a/mdk-stage1/dietlibc/libcruft/pwent.c b/mdk-stage1/dietlibc/libcruft/pwent.c
deleted file mode 100644
index 30a8a0957..000000000
--- a/mdk-stage1/dietlibc/libcruft/pwent.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * dietlibc/lib/pwent.c - getpwent(3)/setpwent(3)/endpwent(3) implementation
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-static struct __ent_state *st = NULL; /* state held across calls */
-static struct passwd pw;
-
-struct passwd *getpwent(void)
-{
- char *parts[7];
-
- if (__ent_start(_PATH_PASSWD, &st))
- return NULL;
- if (__ent_get_line(st))
- goto err_out;
- if (__ent_split(st, parts, 7, ':', 1) < 0)
- goto err_out;
-
- pw.pw_name = parts[0];
- pw.pw_passwd = parts[1];
- pw.pw_uid = (uid_t) atoi(parts[2]);
- pw.pw_gid = (gid_t) atoi(parts[3]);
- pw.pw_gecos = parts[4];
- pw.pw_dir = parts[5];
- pw.pw_shell = parts[6];
-
- return &pw;
-
-err_out:
- st->buflen = st->bufptr = 0; /* invalidate file data buffer */
- return NULL;
-}
-
-void setpwent(void) { __ent_set(st); }
-void endpwent(void) { __ent_end(st); st=NULL; }
diff --git a/mdk-stage1/dietlibc/libcruft/spent.c b/mdk-stage1/dietlibc/libcruft/spent.c
deleted file mode 100644
index e4beb81e4..000000000
--- a/mdk-stage1/dietlibc/libcruft/spent.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * dietlibc/lib/spent.c - getspent(3)/setspent(3)/endspent(3) implementation
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-static struct __ent_state *st = NULL; /* state held across calls */
-static struct spwd sp;
-
-struct spwd *getspent(void)
-{
- char *parts[9];
-
- if (__ent_start(_PATH_SHADOW, &st))
- return NULL;
- if (__ent_get_line(st))
- goto err_out;
- if (__ent_split(st, parts, 9, ':', 1) < 0)
- goto err_out;
-
- sp.sp_namp = parts[0];
- sp.sp_pwdp = parts[1];
- sp.sp_lstchg = atoi(parts[2]); /* XXX: atol */
- sp.sp_min = atoi(parts[3]);
- sp.sp_max = atoi(parts[4]);
- sp.sp_warn = atoi(parts[5]);
- sp.sp_inact = atoi(parts[6]);
- sp.sp_expire = atoi(parts[7]);
- sp.sp_flag = atoi(parts[8]);
-
- return &sp;
-
-err_out:
- st->buflen = st->bufptr = 0; /* invalidate file data buffer */
- return NULL;
-}
-
-void setspent(void) { __ent_set(st); }
-void endspent(void) { __ent_end(st); st=NULL; }
diff --git a/mdk-stage1/dietlibc/libdl/elf_hash.c b/mdk-stage1/dietlibc/libdl/elf_hash.c
deleted file mode 100644
index 463dba0dd..000000000
--- a/mdk-stage1/dietlibc/libdl/elf_hash.c
+++ /dev/null
@@ -1,12 +0,0 @@
-unsigned long elf_hash(const unsigned char *name)
-{
- unsigned long h=0, g;
-
- while (*name)
- {
- h = (h<<4) + *(name++);
- if (g = h&0xf0000000) h ^= g>>24;
- h &= ~g;
- }
- return h;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/thread_internal.c b/mdk-stage1/dietlibc/libpthread/thread_internal.c
deleted file mode 100644
index a93806203..000000000
--- a/mdk-stage1/dietlibc/libpthread/thread_internal.c
+++ /dev/null
@@ -1,344 +0,0 @@
-#include <signal.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <sched.h>
-#include <sys/resource.h>
-
-#include <stdio.h>
-#include "thread_internal.h"
-
-static struct _pthread_fastlock __thread_struct_lock = {0};
-static struct _pthread_descr_struct threads[PTHREAD_THREADS_MAX];
-static int _max_used_thread_id=1;
-pthread_once_t __thread_inited;
-
-static struct _pthread_fastlock __manager_thread_signal_lock = {0};
-static struct _pthread_fastlock __manager_thread_data_lock = {1};
-static struct _pthread_fastlock __manager_thread_data_go_lock = {1};
-
-//#define DEBUG
-
-/* find thread */
-int __find_thread_id(int pid)
-{
- register int i;
- for (i=0; i<_max_used_thread_id; i++)
- if (threads[i].pid==pid)
- return i;
- return -1;
-}
-
-/* get thread */
-_pthread_descr __get_thread_struct(int id)
-{
- return threads+id;
-}
-
-/* thread errno location */
-int *__errno_location(void)
-{
- int id=0;
- if (__thread_inited) id=__find_thread_id(getpid());
- if (id<0)
- return 0;
- else
- return &threads[id].errno;
-}
-
-/* thread self */
-_pthread_descr __thread_self()
-{
- register int i=__find_thread_id(getpid());
- if (i<0)
- return 0;
- else
- return threads+i;
-}
-
-/* allocate a thread slot */
-_pthread_descr __thread_get_free()
-{
- _pthread_descr ret=0;
- int i;
-
- __NO_ASYNC_CANCEL_BEGIN;
- __pthread_lock(&__thread_struct_lock);
-
- for (i=0; i<PTHREAD_THREADS_MAX; i++) {
- if (threads[i].pid==0) {
- threads[i].pid=1; /* mark as taken */
- ret = threads+i;
- if (i>=_max_used_thread_id) _max_used_thread_id=i+1;
- break;
- }
- }
-
- __pthread_unlock(&__thread_struct_lock);
- __NO_ASYNC_CANCEL_END;
- return ret;
-}
-
-/* sleep a little (reschedule for this time) */
-void __thread_wait_some_time()
-{
- struct timespec reg;
- reg.tv_sec=0;
- reg.tv_nsec=SPIN_SLEEP_DURATION;
- __libc_nanosleep(&reg,0);
-}
-
-/* cleanup a thread struct */
-void __thread_cleanup(_pthread_descr th)
-{
- /* lib provided stack should be freed */
- if (th->stack_begin) free(th->stack_begin);
-
- /* an other thread has joined this on */
- if (th->joined) {
- th->joined->retval=th->retval;
- th->joined->join=0;
- th->joined=0;
- }
- th->pid=0; /* mark struct as free */
-}
-
-/* SIGHUP handler (thread cnacel) PTHREAD_CANCEL_ASYNCHRONOUS */
-static void __thread_cancel_handler(int sig)
-{
- _pthread_descr this;
- this = __thread_self();
- this->canceled=1;
- if (this->canceltype==PTHREAD_CANCEL_ASYNCHRONOUS)
- pthread_exit(PTHREAD_CANCELED);
- signal( SIGHUP, __thread_cancel_handler );
-}
-
-/* kill ALL threads / other then prime task and manager thread */
-static void __kill_all_threads()
-{
- int i;
-
- for (i=2; i<_max_used_thread_id; i++) {
- if (threads[i].pid>1) {
-#ifdef DEBUG
- printf("CANCEL ! %d\n",threads[i].pid);
-#endif
- threads[i].canceled=1;
- kill(threads[i].pid, SIGHUP); /* cancel thread */
- }
- }
-
- __thread_wait_some_time();
-
- for (i=2; i<_max_used_thread_id; i++) {
- if (threads[i].pid>1) {
-#ifdef DEBUG
- printf("KILL ! %d\n",threads[i].pid);
-#endif
- kill(threads[i].pid, SIGTERM); /* KILL thread */
- }
- }
-}
-
-__attribute__((weak)) volatile void __thread_start__key(int id) { return; }
-__attribute__((weak,alias("__thread_start__key"))) volatile void __thread_exit__key(int id);
-
-/* support for manager */
-static void *__mthread_starter(void *arg)
-{
- _pthread_descr td = (_pthread_descr)arg;
- int i = td->stack_size-4096;
-
- /* just to be sure */
- td->pid=getpid();
-
- /* signal handling for a thread */
- signal(SIGTERM, _exit);
- signal(SIGCHLD, SIG_DFL);
- signal(SIGHUP, __thread_cancel_handler );
-
- /* limit stack so that we NEVER have to worry */
- setrlimit(RLIMIT_STACK, (struct rlimit *)(&i));
-
- /* set scheduler */
- if (td->policy!=SCHED_OTHER) {
- struct sched_param sp;
- sp.sched_priority=td->priority;
- sched_setscheduler(td->pid,td->policy, &sp);
- }
-
- /* thread_key glue */
- __thread_start__key(td-threads);
-
-#ifdef DEBUG
- printf("in starter %d, parameter %8p\n", td->pid, td->func);
-#endif
-
- if (!td->canceled) {
- if (!(setjmp(td->jmp_exit))) {
- td->retval=td->func(td->arg);
-#ifdef DEBUG
- } else {
- printf("pthread_exit called in %d\n", td->pid);
-#endif
- }
- }
- pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,0);
-
- /* thread_key glue */
- __thread_exit__key(td-threads);
-
-#ifdef DEBUG
- printf("end starter %d, retval %8p\n", td->pid, td->retval);
-#endif
-
- /* wake joined thread and put retval */
- if (td->joined) {
- td->joined->retval=td->retval;
- td->joined->join=0;
- td->joined=0;
- }
-
- /* execute all functions on the cleanup-stack */
- for (i=PTHREAD_MAX_CLEANUP;i;) {
- if (td->cleanup_stack[--i].func) {
- td->cleanup_stack[i].func(td->cleanup_stack[i].arg);
- }
- }
-
- return 0;
-}
-
-
-/* manager thread and signal handler */
-static char __manager_thread_stack[12*1024];
-static volatile _pthread_descr __manager_thread_data;
-static void __manager_SIGCHLD(int sig)
-{
- int pid, status, i;
-
- while(1) {
- pid = __libc_waitpid (-1, &status, WNOHANG);
- if (pid <= 0) break;
-
- for (i=0; i<_max_used_thread_id; i++) {
- if (threads[i].pid==pid) {
- __thread_cleanup(threads+i);
- break;
- }
- }
- }
-}
-
-static void __manager_SIGTERM(int sig)
-{
- __kill_all_threads();
- _exit(0);
-}
-
-static void* __manager_thread(void *arg)
-{
- struct sigaction sig_action_chld;
- sig_action_chld.sa_handler = __manager_SIGCHLD;
- sigemptyset(&sig_action_chld.sa_mask);
- sig_action_chld.sa_flags = SA_RESTART;
-
- sigaction(SIGCHLD, &sig_action_chld, 0);
- signal(SIGTERM, __manager_SIGTERM);
- signal(SIGHUP, SIG_IGN);
-
- __pthread_unlock(&__manager_thread_data_go_lock); /* release init */
- while(1) {
- do {
- __thread_wait_some_time();
- if (getppid()<0) __manager_SIGTERM(0);
- } while (__pthread_trylock(&__manager_thread_data_lock));
-
- __manager_thread_data->pid =
- __clone(__mthread_starter,
- __manager_thread_data->stack_addr,
- CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD,
- __manager_thread_data);
- __thread_wait_some_time();
-#ifdef DEBUG
- printf("manager new thread %d\n",__manager_thread_data->pid);
-#endif
- __pthread_unlock(&__manager_thread_data_go_lock); /* release sender */
- }
- return 0;
-}
-
-/* pthread_create bottom half */
-int signal_manager_thread(_pthread_descr td)
-{
- __NO_ASYNC_CANCEL_BEGIN;
-
- __pthread_lock(&__manager_thread_signal_lock); /* lock */
-
- __manager_thread_data = td;
- __thread_wait_some_time();
- __pthread_unlock(&__manager_thread_data_lock); /* signal manager to start */
- __thread_wait_some_time();
- __pthread_lock(&__manager_thread_data_go_lock); /* wait for manager */
-
- __pthread_unlock(&__manager_thread_signal_lock); /* unlock */
-
- __NO_ASYNC_CANCEL_END;
-
- return td->pid;
-}
-
-
-/* thread stop */
-static void __thread_main_exit()
-{
- if (getpid()!=threads[0].pid) {
-#ifdef DEBUG
- printf("A THREAD ? %d\n",getpid());
-#endif
- kill(threads[0].pid, SIGTERM);
- while(1) __thread_wait_some_time();
- }
-#ifdef DEBUG
- else
- printf("EXIT ! %d\n",getpid());
-#endif
-
- /* stop ALL threads */
- kill(threads[1].pid, SIGTERM);
- __thread_wait_some_time();
- __kill_all_threads();
-}
-
-/* thread intern init */
-void __thread_init()
-{
- if (atexit(__thread_main_exit)==-1)
- exit(42);
-
-#ifdef DEBUG
- printf("INIT ! %d\n",getpid());
- memset(threads,0,sizeof(threads));
-#endif
-
- threads[0].pid = getpid();
-
- ++_max_used_thread_id;
- threads[1].stack_size=sizeof(__manager_thread_stack);
- threads[1].stack_addr=&__manager_thread_stack[sizeof(__manager_thread_stack)];
- threads[1].stack_begin=0;
- threads[1].func=__manager_thread;
-
- threads[1].pid = __clone(__mthread_starter, threads[1].stack_addr,
- CLONE_VM | CLONE_FS | CLONE_FILES, threads+1);
-
-#ifdef DEBUG
- printf("manager thread @ : %d\n",threads[1].pid);
-#endif
- __pthread_lock(&__manager_thread_data_go_lock); /* wait for manager to be ready */
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/thread_key.c b/mdk-stage1/dietlibc/libpthread/thread_key.c
deleted file mode 100644
index b0f719fc9..000000000
--- a/mdk-stage1/dietlibc/libpthread/thread_key.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-struct _pthread_fastlock __thread_keys_lock;
-struct _thread_key __thread_keys[PTHREAD_KEYS_MAX];
-
-void __thread_start__key(int id)
-{
- int i;
-
- __NO_ASYNC_CANCEL_BEGIN;
- __pthread_lock(&__thread_keys_lock);
-
- for (i=0; i<PTHREAD_KEYS_MAX; i++) {
- __thread_keys[i].tkd[id]=0;
- }
-
- __pthread_unlock(&__thread_keys_lock);
- __NO_ASYNC_CANCEL_END;
-}
-
-void __thread_exit__key(int id)
-{
- int i,try;
-
- __NO_ASYNC_CANCEL_BEGIN;
- __pthread_lock(&__thread_keys_lock);
-
- for (i=0; i<PTHREAD_KEYS_MAX; i++) {
- if ((__thread_keys[i].used) && (__thread_keys[i].destructor)) {
- for (try=0;__thread_keys[i].tkd[id] && (try<PTHREAD_DESTRUCTOR_ITERATIONS);++try)
- __thread_keys[i].destructor(__thread_keys[i].tkd[id]);
- }
- }
-
- __pthread_unlock(&__thread_keys_lock);
- __NO_ASYNC_CANCEL_STOP;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fgetc.c b/mdk-stage1/dietlibc/libstdio/fgetc.c
deleted file mode 100644
index 90d83961a..000000000
--- a/mdk-stage1/dietlibc/libstdio/fgetc.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "dietstdio.h"
-#include <unistd.h>
-
-extern int feof(FILE *stream);
-
-int fgetc(FILE *stream) {
- unsigned char c;
-#ifdef WANT_UNGETC
- if (stream->ungotten) {
- stream->ungotten=0;
- return stream->ungetbuf;
- }
-#endif
- if (feof(stream))
- return EOF;
-#ifdef WANT_BUFFERED_STDIO
- if (__fflush4(stream,BUFINPUT)) return EOF;
- if (stream->bm>=stream->bs) {
- int len=read(stream->fd,stream->buf,BUFSIZE);
- if (len==0) {
- stream->flags|=EOFINDICATOR;
- return EOF;
- } else if (len<0) {
- stream->flags|=ERRORINDICATOR;
- return EOF;
- }
- stream->bm=0;
- stream->bs=len;
- }
- c=stream->buf[stream->bm];
- ++stream->bm;
- return c;
-#else
- if (read(stream->fd,&c,1)!=1) {
- stream->flags|=ERRORINDICATOR;
- return EOF;
- }
- return c;
-#endif
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fputc.c b/mdk-stage1/dietlibc/libstdio/fputc.c
deleted file mode 100644
index b816f7c4d..000000000
--- a/mdk-stage1/dietlibc/libstdio/fputc.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <dietstdio.h>
-#ifndef WANT_BUFFERED_STDIO
-#include <unistd.h>
-#endif
-
-int fputc(int c, FILE *stream) {
-#ifdef WANT_BUFFERED_STDIO
- if (__fflush4(stream,0)) return EOF;
- if (stream->bm>=BUFSIZE-1)
- if (fflush(stream)) return EOF;
- stream->buf[stream->bm]=c;
- ++stream->bm;
- if ((stream->flags&BUFLINEWISE) && c=='\n') /* puke */
- if (fflush(stream)) return EOF;
-#else
- write(stream->fd,&c,1);
-#endif
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libugly/daemon.c b/mdk-stage1/dietlibc/libugly/daemon.c
deleted file mode 100644
index 6748cc3c9..000000000
--- a/mdk-stage1/dietlibc/libugly/daemon.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <paths.h>
-
-#include "daemon.h"
-
-int daemon (int nochdir,int noclose)
-{
- int fd;
- switch (fork ())
- {
- case -1:
- return (-1);
- case 0:
- break;
- default:
- _exit (0);
- }
- if (setsid () == -1)
- return (-1);
- if (!nochdir) chdir ("/");
- if (!noclose)
- {
- fd = open (_PATH_DEVNULL,O_RDWR,0);
- if (fd == -1) return (-1);
- dup2 (fd,STDIN_FILENO);
- dup2 (fd,STDOUT_FILENO);
- dup2 (fd,STDERR_FILENO);
- close (fd);
- }
- return (0);
-}
-
diff --git a/mdk-stage1/dietlibc/start.h b/mdk-stage1/dietlibc/start.h
deleted file mode 100644
index 7f9e6be28..000000000
--- a/mdk-stage1/dietlibc/start.h
+++ /dev/null
@@ -1,14 +0,0 @@
-.section ".bss"
-.align 8
-
-.weak errno
-errno:
-.global __errno
-__errno:
- .long 0
-
-.weak environ
-environ:
-.global __environ
-__environ:
- .long 0
diff --git a/mdk-stage1/dietlibc/syscalls.s/exit.S b/mdk-stage1/dietlibc/syscalls.s/exit.S
deleted file mode 100644
index 11c989529..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/exit.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(exit,exit,_exit)
diff --git a/mdk-stage1/dietlibc/syscalls.s/llseek.S b/mdk-stage1/dietlibc/syscalls.s/llseek.S
deleted file mode 100644
index 0318b492e..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/llseek.S
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "dietfeatures.h"
-#include "syscalls.h"
-
-#ifdef __NR__llseek
-syscall(_llseek,llseek)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/ptrace.s b/mdk-stage1/dietlibc/syscalls.s/ptrace.s
deleted file mode 100644
index 392e6a4ed..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/ptrace.s
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(ptrace,ptrace)
diff --git a/mdk-stage1/dietlibc/syscalls.s/pwrite.S b/mdk-stage1/dietlibc/syscalls.s/pwrite.S
deleted file mode 100644
index f52ead7b2..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/pwrite.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(pwrite,__pwrite)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigaction.S b/mdk-stage1/dietlibc/syscalls.s/sigaction.S
deleted file mode 100644
index 32382870c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigaction.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sigaction,sigaction)
diff --git a/mdk-stage1/dietlibc/syscalls.s/signal.S b/mdk-stage1/dietlibc/syscalls.s/signal.S
deleted file mode 100644
index 86c4d5db0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/signal.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(signal,signal)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigpending.S b/mdk-stage1/dietlibc/syscalls.s/sigpending.S
deleted file mode 100644
index 08715bef5..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigpending.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sigpending,sigpending)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S b/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S
deleted file mode 100644
index 07f5b9d26..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(sigprocmask,sigprocmask,__sigprocmask)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S b/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S
deleted file mode 100644
index 062264ab6..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(sigsuspend,sigsuspend,__libc_sigsuspend)