#!/usr/bin/perl # Copyright (c) 2004 Mandrakesoft # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use lib qw(/usr/lib/libDrakX); use common; use standalone; use Digest::MD5 qw(md5_hex); use network::tools; use network::netconnect; # md5_hex call came from move::machine_ident() : my $id = "MDK" . md5_hex(join("", (map { (split)[1] } cat_("/proc/bus/pci/devices")))); my $netcnx = {}; # first boot wizard: !glob_("/etc/netprofile/profiles/MDK*") and system('/usr/sbin/mdkmove'); # create hardware profile if needed: if (! -d "/etc/netprofile/profiles/$id") { network::tools::reread_net_conf($netcnx, {}, {}); network::netconnect::add_profile($netcnx, $id); } # restore hardware profile: $netcnx->{PROFILE} = $id; eval { network::netconnect::set_profile($netcnx) }; # redo ldconfig cache for libGL (since we've both ATI and NVIDIA GLX packages): system("/sbin/ldconfig"); lue='distro/mga2'>distro/mga2 Mageia Installer and base platform for many utilitiesThierry Vignaud [tv]
summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2002-07-23 11:21:56 +0000
committerMystery Man <unknown@mandriva.org>2002-07-23 11:21:56 +0000
commitc20b84a8b572951b48049234f632f4f1dd7c978f (patch)
tree492e9ef624cee574ecd82c836aeb4b0b05915e6b /mdk-stage1
parent127a73d935d78af53d3dadd05d4636f6b717976d (diff)
downloaddrakx-backup-do-not-use-1_1_8_12mdk.tar
drakx-backup-do-not-use-1_1_8_12mdk.tar.gz
drakx-backup-do-not-use-1_1_8_12mdk.tar.bz2
drakx-backup-do-not-use-1_1_8_12mdk.tar.xz
drakx-backup-do-not-use-1_1_8_12mdk.zip
This commit was manufactured by cvs2svn to create tag 'V1_1_8_12mdk'.V1_1_8_12mdk
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/.cvsignore12
-rw-r--r--mdk-stage1/Makefile260
-rw-r--r--mdk-stage1/Makefile.common57
-rw-r--r--mdk-stage1/Makefile.mkinitrd_helper30
-rw-r--r--mdk-stage1/adsl.c172
-rw-r--r--mdk-stage1/adsl.h34
-rw-r--r--mdk-stage1/automatic.c161
-rw-r--r--mdk-stage1/automatic.h32
-rw-r--r--mdk-stage1/bzlib/Makefile55
-rw-r--r--mdk-stage1/bzlib/blocksort.c1138
-rw-r--r--mdk-stage1/bzlib/bzlib.c1567
-rw-r--r--mdk-stage1/bzlib/bzlib.h319
-rw-r--r--mdk-stage1/bzlib/bzlib_private.h530
-rw-r--r--mdk-stage1/bzlib/compress.c720
-rw-r--r--mdk-stage1/bzlib/crctable.c148
-rw-r--r--mdk-stage1/bzlib/decompress.c664
-rw-r--r--mdk-stage1/bzlib/huffman.c232
-rw-r--r--mdk-stage1/bzlib/randtable.c128
-rw-r--r--mdk-stage1/cdrom.c181
-rw-r--r--mdk-stage1/cdrom.h29
-rw-r--r--mdk-stage1/config-stage1.h48
-rw-r--r--mdk-stage1/dhcp.c679
-rw-r--r--mdk-stage1/dhcp.h36
-rw-r--r--mdk-stage1/dietlibc/.cvsignore12
-rw-r--r--mdk-stage1/dietlibc/AUTHOR1
-rw-r--r--mdk-stage1/dietlibc/Makefile146
-rw-r--r--mdk-stage1/dietlibc/README43
-rw-r--r--mdk-stage1/dietlibc/alpha/Makefile.add5
-rw-r--r--mdk-stage1/dietlibc/alpha/__longjmp.S38
-rw-r--r--mdk-stage1/dietlibc/alpha/__time.c11
-rw-r--r--mdk-stage1/dietlibc/alpha/accept.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/bind.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/clone.S42
-rw-r--r--mdk-stage1/dietlibc/alpha/connect.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/divl.S101
-rw-r--r--mdk-stage1/dietlibc/alpha/divq.S102
-rw-r--r--mdk-stage1/dietlibc/alpha/getegid.S11
-rw-r--r--mdk-stage1/dietlibc/alpha/geteuid.S11
-rw-r--r--mdk-stage1/dietlibc/alpha/getgid.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/getpeername.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/getpid.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/getppid.S11
-rw-r--r--mdk-stage1/dietlibc/alpha/getsockname.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/getsockopt.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/getuid.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/listen.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/mmap.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/msgctl.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/msgget.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/msgrcv.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/msgsnd.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/pipe.S17
-rw-r--r--mdk-stage1/dietlibc/alpha/recv.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/recvfrom.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/recvmsg.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/reml.S101
-rw-r--r--mdk-stage1/dietlibc/alpha/remq.S97
-rw-r--r--mdk-stage1/dietlibc/alpha/semctl.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/semget.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/semop.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/send.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/sendmsg.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/sendto.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/seteuid.c7
-rw-r--r--mdk-stage1/dietlibc/alpha/setjmp.S46
-rw-r--r--mdk-stage1/dietlibc/alpha/setsockopt.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shmat.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shmctl.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shmdt.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shmget.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shutdown.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/signal.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/sigprocmask.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/socket.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/socketcall.S5
-rw-r--r--mdk-stage1/dietlibc/alpha/start.S35
-rw-r--r--mdk-stage1/dietlibc/alpha/strlen.c32
-rw-r--r--mdk-stage1/dietlibc/alpha/time.S0
-rw-r--r--mdk-stage1/dietlibc/alpha/unified.S29
-rw-r--r--mdk-stage1/dietlibc/alpha/utime.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/waitpid.S10
-rw-r--r--mdk-stage1/dietlibc/diet.c112
-rw-r--r--mdk-stage1/dietlibc/dietdirent.h6
-rw-r--r--mdk-stage1/dietlibc/dietfeatures.h42
-rw-r--r--mdk-stage1/dietlibc/dietstdarg.h12
-rw-r--r--mdk-stage1/dietlibc/dietstdio.h81
-rw-r--r--mdk-stage1/dietlibc/dietwarning.h23
-rw-r--r--mdk-stage1/dietlibc/dirstream.h78
-rw-r--r--mdk-stage1/dietlibc/i386/Makefile.add3
-rw-r--r--mdk-stage1/dietlibc/i386/__longjmp.S18
-rw-r--r--mdk-stage1/dietlibc/i386/__testandset.S8
-rw-r--r--mdk-stage1/dietlibc/i386/clone.S51
-rw-r--r--mdk-stage1/dietlibc/i386/mmap.c16
-rw-r--r--mdk-stage1/dietlibc/i386/select.S3
-rw-r--r--mdk-stage1/dietlibc/i386/setjmp.S62
-rw-r--r--mdk-stage1/dietlibc/i386/start.S42
-rw-r--r--mdk-stage1/dietlibc/i386/unified.S34
-rw-r--r--mdk-stage1/dietlibc/include/alloca.h0
-rw-r--r--mdk-stage1/dietlibc/include/arpa/inet.h19
-rw-r--r--mdk-stage1/dietlibc/include/arpa/nameser.h217
-rw-r--r--mdk-stage1/dietlibc/include/assert.h27
-rw-r--r--mdk-stage1/dietlibc/include/ctype.h28
-rw-r--r--mdk-stage1/dietlibc/include/daemon.h6
-rw-r--r--mdk-stage1/dietlibc/include/dirent.h26
-rw-r--r--mdk-stage1/dietlibc/include/dlfcn.h15
-rw-r--r--mdk-stage1/dietlibc/include/elf.h1
-rw-r--r--mdk-stage1/dietlibc/include/endian.h43
-rw-r--r--mdk-stage1/dietlibc/include/errno.h11
-rw-r--r--mdk-stage1/dietlibc/include/fcntl.h24
-rw-r--r--mdk-stage1/dietlibc/include/features.h3
-rw-r--r--mdk-stage1/dietlibc/include/fnmatch.h15
-rw-r--r--mdk-stage1/dietlibc/include/ftw.h51
-rw-r--r--mdk-stage1/dietlibc/include/getopt.h32
-rw-r--r--mdk-stage1/dietlibc/include/glob.h55
-rw-r--r--mdk-stage1/dietlibc/include/grp.h25
-rw-r--r--mdk-stage1/dietlibc/include/inttypes.h0
-rw-r--r--mdk-stage1/dietlibc/include/limits.h48
-rw-r--r--mdk-stage1/dietlibc/include/locale.h6
-rw-r--r--mdk-stage1/dietlibc/include/malloc.h1
-rw-r--r--mdk-stage1/dietlibc/include/math.h61
-rw-r--r--mdk-stage1/dietlibc/include/memory.h6
-rw-r--r--mdk-stage1/dietlibc/include/mntent.h72
-rw-r--r--mdk-stage1/dietlibc/include/net/if.h11
-rw-r--r--mdk-stage1/dietlibc/include/net/if_arp.h6
-rw-r--r--mdk-stage1/dietlibc/include/net/route.h6
-rw-r--r--mdk-stage1/dietlibc/include/netdb.h90
-rw-r--r--mdk-stage1/dietlibc/include/netinet/in.h9
-rw-r--r--mdk-stage1/dietlibc/include/netinet/in_systm.h0
-rw-r--r--mdk-stage1/dietlibc/include/netinet/ip.h6
-rw-r--r--mdk-stage1/dietlibc/include/paths.h16
-rw-r--r--mdk-stage1/dietlibc/include/pthread.h227
-rw-r--r--mdk-stage1/dietlibc/include/pwd.h24
-rw-r--r--mdk-stage1/dietlibc/include/regex.h67
-rw-r--r--mdk-stage1/dietlibc/include/resolv.h1
-rw-r--r--mdk-stage1/dietlibc/include/rpc/auth.h213
-rw-r--r--mdk-stage1/dietlibc/include/rpc/auth_des.h112
-rw-r--r--mdk-stage1/dietlibc/include/rpc/auth_unix.h90
-rw-r--r--mdk-stage1/dietlibc/include/rpc/clnt.h421
-rw-r--r--mdk-stage1/dietlibc/include/rpc/des_crypt.h97
-rw-r--r--mdk-stage1/dietlibc/include/rpc/key_prot.h346
-rw-r--r--mdk-stage1/dietlibc/include/rpc/netdb.h74
-rw-r--r--mdk-stage1/dietlibc/include/rpc/pmap_clnt.h98
-rw-r--r--mdk-stage1/dietlibc/include/rpc/pmap_prot.h108
-rw-r--r--mdk-stage1/dietlibc/include/rpc/pmap_rmt.h68
-rw-r--r--mdk-stage1/dietlibc/include/rpc/rpc.h72
-rw-r--r--mdk-stage1/dietlibc/include/rpc/rpc_des.h72
-rw-r--r--mdk-stage1/dietlibc/include/rpc/rpc_msg.h202
-rw-r--r--mdk-stage1/dietlibc/include/rpc/svc.h316
-rw-r--r--mdk-stage1/dietlibc/include/rpc/svc_auth.h54
-rw-r--r--mdk-stage1/dietlibc/include/rpc/types.h78
-rw-r--r--mdk-stage1/dietlibc/include/rpc/xdr.h379
-rw-r--r--mdk-stage1/dietlibc/include/sched.h74
-rw-r--r--mdk-stage1/dietlibc/include/scsi/scsi.h224
-rw-r--r--mdk-stage1/dietlibc/include/scsi/scsi_ioctl.h34
-rw-r--r--mdk-stage1/dietlibc/include/scsi/sg.h274
-rw-r--r--mdk-stage1/dietlibc/include/setjmp.h123
-rw-r--r--mdk-stage1/dietlibc/include/shadow.h24
-rw-r--r--mdk-stage1/dietlibc/include/signal.h35
-rw-r--r--mdk-stage1/dietlibc/include/stdint.h6
-rw-r--r--mdk-stage1/dietlibc/include/stdio.h97
-rw-r--r--mdk-stage1/dietlibc/include/stdlib.h67
-rw-r--r--mdk-stage1/dietlibc/include/string.h57
-rw-r--r--mdk-stage1/dietlibc/include/strings.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/cdefs.h36
-rw-r--r--mdk-stage1/dietlibc/include/sys/file.h19
-rw-r--r--mdk-stage1/dietlibc/include/sys/io.h41
-rw-r--r--mdk-stage1/dietlibc/include/sys/ioctl.h10
-rw-r--r--mdk-stage1/dietlibc/include/sys/ipc.h8
-rw-r--r--mdk-stage1/dietlibc/include/sys/kd.h6
-rw-r--r--mdk-stage1/dietlibc/include/sys/mman.h33
-rw-r--r--mdk-stage1/dietlibc/include/sys/mount.h19
-rw-r--r--mdk-stage1/dietlibc/include/sys/msg.h13
-rw-r--r--mdk-stage1/dietlibc/include/sys/mtio.h6
-rw-r--r--mdk-stage1/dietlibc/include/sys/param.h8
-rw-r--r--mdk-stage1/dietlibc/include/sys/poll.h11
-rw-r--r--mdk-stage1/dietlibc/include/sys/ptrace.h10
-rw-r--r--mdk-stage1/dietlibc/include/sys/reboot.h9
-rw-r--r--mdk-stage1/dietlibc/include/sys/resource.h16
-rw-r--r--mdk-stage1/dietlibc/include/sys/select.h0
-rw-r--r--mdk-stage1/dietlibc/include/sys/sem.h11
-rw-r--r--mdk-stage1/dietlibc/include/sys/sendfile.h9
-rw-r--r--mdk-stage1/dietlibc/include/sys/shm.h17
-rw-r--r--mdk-stage1/dietlibc/include/sys/signal.h1
-rw-r--r--mdk-stage1/dietlibc/include/sys/socket.h46
-rw-r--r--mdk-stage1/dietlibc/include/sys/stat.h52
-rw-r--r--mdk-stage1/dietlibc/include/sys/syscall.h6
-rw-r--r--mdk-stage1/dietlibc/include/sys/sysinfo.h9
-rw-r--r--mdk-stage1/dietlibc/include/sys/syslog.h102
-rw-r--r--mdk-stage1/dietlibc/include/sys/time.h46
-rw-r--r--mdk-stage1/dietlibc/include/sys/times.h8
-rw-r--r--mdk-stage1/dietlibc/include/sys/types.h33
-rw-r--r--mdk-stage1/dietlibc/include/sys/uio.h9
-rw-r--r--mdk-stage1/dietlibc/include/sys/un.h8
-rw-r--r--mdk-stage1/dietlibc/include/sys/utsname.h35
-rw-r--r--mdk-stage1/dietlibc/include/sys/vfs.h11
-rw-r--r--mdk-stage1/dietlibc/include/sys/wait.h37
-rw-r--r--mdk-stage1/dietlibc/include/syslog.h1
-rw-r--r--mdk-stage1/dietlibc/include/termios.h22
-rw-r--r--mdk-stage1/dietlibc/include/time.h24
-rw-r--r--mdk-stage1/dietlibc/include/unistd.h168
-rw-r--r--mdk-stage1/dietlibc/include/utime.h16
-rw-r--r--mdk-stage1/dietlibc/include/utmp.h73
-rw-r--r--mdk-stage1/dietlibc/lib/__dtostr.c104
-rw-r--r--mdk-stage1/dietlibc/lib/__fstat64.c25
-rw-r--r--mdk-stage1/dietlibc/lib/__getcwd.c10
-rw-r--r--mdk-stage1/dietlibc/lib/__isnan.c14
-rw-r--r--mdk-stage1/dietlibc/lib/__lltostr.c31
-rw-r--r--mdk-stage1/dietlibc/lib/__lstat64.c25
-rw-r--r--mdk-stage1/dietlibc/lib/__ltostr.c31
-rw-r--r--mdk-stage1/dietlibc/lib/__stat64.c25
-rw-r--r--mdk-stage1/dietlibc/lib/__stat64_cvt.c18
-rw-r--r--mdk-stage1/dietlibc/lib/__xmknod.c6
-rw-r--r--mdk-stage1/dietlibc/lib/_brk.c14
-rw-r--r--mdk-stage1/dietlibc/lib/abort.c13
-rw-r--r--mdk-stage1/dietlibc/lib/abs.c6
-rw-r--r--mdk-stage1/dietlibc/lib/accept.c14
-rw-r--r--mdk-stage1/dietlibc/lib/alarm.c47
-rw-r--r--mdk-stage1/dietlibc/lib/alloc.c243
-rw-r--r--mdk-stage1/dietlibc/lib/assert_fail.c30
-rw-r--r--mdk-stage1/dietlibc/lib/atexit.c23
-rw-r--r--mdk-stage1/dietlibc/lib/atof.c10
-rw-r--r--mdk-stage1/dietlibc/lib/atoi.c8
-rw-r--r--mdk-stage1/dietlibc/lib/atol.c8
-rw-r--r--mdk-stage1/dietlibc/lib/bind.c12
-rw-r--r--mdk-stage1/dietlibc/lib/bsearch.c20
-rw-r--r--mdk-stage1/dietlibc/lib/cfmakeraw.c14
-rw-r--r--mdk-stage1/dietlibc/lib/closedir.c10
-rw-r--r--mdk-stage1/dietlibc/lib/connect.c14
-rw-r--r--mdk-stage1/dietlibc/lib/creat.c5
-rw-r--r--mdk-stage1/dietlibc/lib/creat64.c9
-rw-r--r--mdk-stage1/dietlibc/lib/errlist.c132
-rw-r--r--mdk-stage1/dietlibc/lib/errno_location.c5
-rw-r--r--mdk-stage1/dietlibc/lib/exec_lib.c20
-rw-r--r--mdk-stage1/dietlibc/lib/exec_lib.h9
-rw-r--r--mdk-stage1/dietlibc/lib/execl.c24
-rw-r--r--mdk-stage1/dietlibc/lib/execlp.c26
-rw-r--r--mdk-stage1/dietlibc/lib/execv.c13
-rw-r--r--mdk-stage1/dietlibc/lib/execvp.c38
-rw-r--r--mdk-stage1/dietlibc/lib/ftw.c52
-rw-r--r--mdk-stage1/dietlibc/lib/getdomainname.c17
-rw-r--r--mdk-stage1/dietlibc/lib/getenv.c17
-rw-r--r--mdk-stage1/dietlibc/lib/gethostname.c18
-rw-r--r--mdk-stage1/dietlibc/lib/getopt.c118
-rw-r--r--mdk-stage1/dietlibc/lib/getpeername.c13
-rw-r--r--mdk-stage1/dietlibc/lib/getpgrp.c6
-rw-r--r--mdk-stage1/dietlibc/lib/getservent.c137
-rw-r--r--mdk-stage1/dietlibc/lib/getsockname.c13
-rw-r--r--mdk-stage1/dietlibc/lib/getsockopt.c13
-rw-r--r--mdk-stage1/dietlibc/lib/htonl.c12
-rw-r--r--mdk-stage1/dietlibc/lib/htons.c11
-rw-r--r--mdk-stage1/dietlibc/lib/if_indextoname.c29
-rw-r--r--mdk-stage1/dietlibc/lib/if_nametoindex.c27
-rw-r--r--mdk-stage1/dietlibc/lib/isalnum.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isalpha.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isascii.c6
-rw-r--r--mdk-stage1/dietlibc/lib/isatty.c20
-rw-r--r--mdk-stage1/dietlibc/lib/isblank.c6
-rw-r--r--mdk-stage1/dietlibc/lib/iscntrl.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isdigit.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isgraph.c5
-rw-r--r--mdk-stage1/dietlibc/lib/islower.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isprint.c6
-rw-r--r--mdk-stage1/dietlibc/lib/ispunct.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isspace.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isupper.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isxdigit.c5
-rw-r--r--mdk-stage1/dietlibc/lib/listen.c13
-rw-r--r--mdk-stage1/dietlibc/lib/lockf.c37
-rw-r--r--mdk-stage1/dietlibc/lib/longjmp.c51
-rw-r--r--mdk-stage1/dietlibc/lib/lseek64.c22
-rw-r--r--mdk-stage1/dietlibc/lib/memccmp.c17
-rw-r--r--mdk-stage1/dietlibc/lib/memccpy.c19
-rw-r--r--mdk-stage1/dietlibc/lib/memchr.c9
-rw-r--r--mdk-stage1/dietlibc/lib/memcmp.c16
-rw-r--r--mdk-stage1/dietlibc/lib/memcpy.c12
-rw-r--r--mdk-stage1/dietlibc/lib/memmove.c23
-rw-r--r--mdk-stage1/dietlibc/lib/memset.c9
-rw-r--r--mdk-stage1/dietlibc/lib/mkfifo.c6
-rw-r--r--mdk-stage1/dietlibc/lib/msgctl.c10
-rw-r--r--mdk-stage1/dietlibc/lib/msgget.c10
-rw-r--r--mdk-stage1/dietlibc/lib/msgrcv.c13
-rw-r--r--mdk-stage1/dietlibc/lib/msgsnd.c10
-rw-r--r--mdk-stage1/dietlibc/lib/nop.c7
-rw-r--r--mdk-stage1/dietlibc/lib/open64.c14
-rw-r--r--mdk-stage1/dietlibc/lib/opendir.c18
-rw-r--r--mdk-stage1/dietlibc/lib/perror.c22
-rw-r--r--mdk-stage1/dietlibc/lib/pread.c10
-rw-r--r--mdk-stage1/dietlibc/lib/pread64.c13
-rw-r--r--mdk-stage1/dietlibc/lib/putenv.c37
-rw-r--r--mdk-stage1/dietlibc/lib/puts.c12
-rw-r--r--mdk-stage1/dietlibc/lib/qsort.c125
-rw-r--r--mdk-stage1/dietlibc/lib/raise.c8
-rw-r--r--mdk-stage1/dietlibc/lib/rand.c9
-rw-r--r--mdk-stage1/dietlibc/lib/random.c9
-rw-r--r--mdk-stage1/dietlibc/lib/readdir.c13
-rw-r--r--mdk-stage1/dietlibc/lib/reboot.c8
-rw-r--r--mdk-stage1/dietlibc/lib/recv.c15
-rw-r--r--mdk-stage1/dietlibc/lib/recvfrom.c15
-rw-r--r--mdk-stage1/dietlibc/lib/recvmsg.c15
-rw-r--r--mdk-stage1/dietlibc/lib/remove.c11
-rw-r--r--mdk-stage1/dietlibc/lib/rewind.c6
-rw-r--r--mdk-stage1/dietlibc/lib/rewinddir.c8
-rw-r--r--mdk-stage1/dietlibc/lib/sbrk.c20
-rw-r--r--mdk-stage1/dietlibc/lib/seekdir.c8
-rw-r--r--mdk-stage1/dietlibc/lib/semctl.c10
-rw-r--r--mdk-stage1/dietlibc/lib/semget.c10
-rw-r--r--mdk-stage1/dietlibc/lib/semop.c10
-rw-r--r--mdk-stage1/dietlibc/lib/send.c15
-rw-r--r--mdk-stage1/dietlibc/lib/sendmsg.c15
-rw-r--r--mdk-stage1/dietlibc/lib/sendto.c15
-rw-r--r--mdk-stage1/dietlibc/lib/set_errno.c9
-rw-r--r--mdk-stage1/dietlibc/lib/setpgrp.c6
-rw-r--r--mdk-stage1/dietlibc/lib/setsockopt.c13
-rw-r--r--mdk-stage1/dietlibc/lib/shmat.c15
-rw-r--r--mdk-stage1/dietlibc/lib/shmctl.c10
-rw-r--r--mdk-stage1/dietlibc/lib/shmdt.c10
-rw-r--r--mdk-stage1/dietlibc/lib/shmget.c10
-rw-r--r--mdk-stage1/dietlibc/lib/shutdown.c14
-rw-r--r--mdk-stage1/dietlibc/lib/sigaddset.c15
-rw-r--r--mdk-stage1/dietlibc/lib/sigdelset.c15
-rw-r--r--mdk-stage1/dietlibc/lib/sigemptyset.c14
-rw-r--r--mdk-stage1/dietlibc/lib/sigfillset.c11
-rw-r--r--mdk-stage1/dietlibc/lib/sigismember.c21
-rw-r--r--mdk-stage1/dietlibc/lib/sigjmp.c35
-rw-r--r--mdk-stage1/dietlibc/lib/sleep.c11
-rw-r--r--mdk-stage1/dietlibc/lib/snprintf.c14
-rw-r--r--mdk-stage1/dietlibc/lib/socket.c12
-rw-r--r--mdk-stage1/dietlibc/lib/speed.c67
-rw-r--r--mdk-stage1/dietlibc/lib/sprintf.c18
-rw-r--r--mdk-stage1/dietlibc/lib/sscanf.c13
-rw-r--r--mdk-stage1/dietlibc/lib/strcasecmp.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strcat.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strchr.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strcmp.c16
-rw-r--r--mdk-stage1/dietlibc/lib/strcpy.c15
-rw-r--r--mdk-stage1/dietlibc/lib/strcspn.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strdup.c9
-rw-r--r--mdk-stage1/dietlibc/lib/strerror.c10
-rw-r--r--mdk-stage1/dietlibc/lib/strlcat.c72
-rw-r--r--mdk-stage1/dietlibc/lib/strlcpy.3169
-rw-r--r--mdk-stage1/dietlibc/lib/strlcpy.c68
-rw-r--r--mdk-stage1/dietlibc/lib/strlen.c47
-rw-r--r--mdk-stage1/dietlibc/lib/strncasecmp.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strncat.c31
-rw-r--r--mdk-stage1/dietlibc/lib/strncmp.c6
-rw-r--r--mdk-stage1/dietlibc/lib/strncpy.c10
-rw-r--r--mdk-stage1/dietlibc/lib/strpbrk.c11
-rw-r--r--mdk-stage1/dietlibc/lib/strrchr.c20
-rw-r--r--mdk-stage1/dietlibc/lib/strsep.c16
-rw-r--r--mdk-stage1/dietlibc/lib/strspn.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strstr.c15
-rw-r--r--mdk-stage1/dietlibc/lib/strtod.c52
-rw-r--r--mdk-stage1/dietlibc/lib/strtok.c8
-rw-r--r--mdk-stage1/dietlibc/lib/strtok_r.c21
-rw-r--r--mdk-stage1/dietlibc/lib/strtol.c15
-rw-r--r--mdk-stage1/dietlibc/lib/strtoll.c15
-rw-r--r--mdk-stage1/dietlibc/lib/strtoul.c32
-rw-r--r--mdk-stage1/dietlibc/lib/strtoull.c30
-rw-r--r--mdk-stage1/dietlibc/lib/sys_siglist.c37
-rw-r--r--mdk-stage1/dietlibc/lib/tcdrain.c8
-rw-r--r--mdk-stage1/dietlibc/lib/tcflush.c23
-rw-r--r--mdk-stage1/dietlibc/lib/tcgetattr.c7
-rw-r--r--mdk-stage1/dietlibc/lib/tcgetpgrp.c7
-rw-r--r--mdk-stage1/dietlibc/lib/tcsetattr.c27
-rw-r--r--mdk-stage1/dietlibc/lib/tcsetpgrp.c7
-rw-r--r--mdk-stage1/dietlibc/lib/telldir.c7
-rw-r--r--mdk-stage1/dietlibc/lib/tolower.c6
-rw-r--r--mdk-stage1/dietlibc/lib/toupper.c6
-rw-r--r--mdk-stage1/dietlibc/lib/ttyname.c59
-rw-r--r--mdk-stage1/dietlibc/lib/usleep.c12
-rw-r--r--mdk-stage1/dietlibc/lib/vfork.c6
-rw-r--r--mdk-stage1/dietlibc/lib/vfprintf.c19
-rw-r--r--mdk-stage1/dietlibc/lib/vprintf.c14
-rw-r--r--mdk-stage1/dietlibc/lib/vsnprintf.c238
-rw-r--r--mdk-stage1/dietlibc/lib/vsprintf.c10
-rw-r--r--mdk-stage1/dietlibc/lib/vsscanf.c304
-rw-r--r--mdk-stage1/dietlibc/lib/wait.c6
-rw-r--r--mdk-stage1/dietlibc/lib/wait3.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/___div.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft.c115
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft2.c185
-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/getdtablesize.c6
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrgid.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrnam.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyaddr.c38
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c51
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname.c39
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname2.c40
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c36
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname_r.c30
-rw-r--r--mdk-stage1/dietlibc/libcruft/getlogin.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpagesize.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpass.c40
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwnam.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwuid.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getspnam.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/grent.c54
-rw-r--r--mdk-stage1/dietlibc/libcruft/h_errno.c1
-rw-r--r--mdk-stage1/dietlibc/libcruft/herrno_location.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_addr.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_aton.c43
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntoa.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c22
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntop.c75
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_pton.c97
-rw-r--r--mdk-stage1/dietlibc/libcruft/initgroups.c23
-rw-r--r--mdk-stage1/dietlibc/libcruft/mkstemp.c23
-rw-r--r--mdk-stage1/dietlibc/libcruft/pwent.c43
-rw-r--r--mdk-stage1/dietlibc/libcruft/res_init.c7
-rw-r--r--mdk-stage1/dietlibc/libcruft/spent.c45
-rw-r--r--mdk-stage1/dietlibc/libcrypt/crypt.c309
-rw-r--r--mdk-stage1/dietlibc/libdl/Makefile24
-rw-r--r--mdk-stage1/dietlibc/libdl/README6
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_int.h31
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_jump.S8
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_open.c207
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_search.c84
-rw-r--r--mdk-stage1/dietlibc/libdl/dlclose.c14
-rw-r--r--mdk-stage1/dietlibc/libdl/dlerror.c4
-rw-r--r--mdk-stage1/dietlibc/libdl/dlopen.c21
-rw-r--r--mdk-stage1/dietlibc/libdl/dlsym.c7
-rw-r--r--mdk-stage1/dietlibc/libdl/elf_hash.c12
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c5
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c4
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-islower.c5
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-isprint.c4
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-isupper.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/CHANGES45
-rw-r--r--mdk-stage1/dietlibc/libpthread/Makefile139
-rw-r--r--mdk-stage1/dietlibc/libpthread/README42
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_atfork.c77
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_getdetachstate.c14
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_getinheritsched.c13
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_getschedparam.c13
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_getschedpolicy.c13
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_getscope.c13
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_getstackaddr.c13
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_getstacksize.c14
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_init.c17
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c18
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c18
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c23
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c25
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c18
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setstackaddr.c13
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c17
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cancel.c35
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cleanup_pop.c27
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cleanup_push.c23
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c23
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c19
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_init.c14
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c24
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c43
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c37
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_condattr.c15
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_create.c76
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_detach.c36
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_exit.c17
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_getspecific.c20
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_join.c50
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_key_create.c35
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_key_delete.c21
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c16
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c18
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c33
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c36
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c34
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutexattr_getkind_np.c13
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutexattr_init.c15
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c18
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_once.c9
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_self.c4
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c25
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c25
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_setspecific.c21
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_spinlock.c38
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c26
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_close.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_create.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_fsync.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c31
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_nanosleep.c11
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_open.c12
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_pause.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_read.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_sigsuspend.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_write.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_testcancel.c16
-rw-r--r--mdk-stage1/dietlibc/libpthread/test.c72
-rw-r--r--mdk-stage1/dietlibc/libpthread/thread_internal.c344
-rw-r--r--mdk-stage1/dietlibc/libpthread/thread_internal.h131
-rw-r--r--mdk-stage1/dietlibc/libpthread/thread_key.c41
-rw-r--r--mdk-stage1/dietlibc/libregex/rx.c434
-rw-r--r--mdk-stage1/dietlibc/librpc/auth_none.c128
-rw-r--r--mdk-stage1/dietlibc/librpc/auth_unix.c313
-rw-r--r--mdk-stage1/dietlibc/librpc/authunix_prot.c69
-rw-r--r--mdk-stage1/dietlibc/librpc/bindresvport.c79
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_generic.c112
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_perror.c302
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_raw.c230
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_simple.c116
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_tcp.c463
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_udp.c437
-rw-r--r--mdk-stage1/dietlibc/librpc/get_myaddress.c69
-rw-r--r--mdk-stage1/dietlibc/librpc/getrpcent.c274
-rw-r--r--mdk-stage1/dietlibc/librpc/getrpcport.c57
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_clnt.c118
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_getmaps.c85
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_getport.c90
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_prot.c58
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_prot2.c116
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_rmt.c403
-rw-r--r--mdk-stage1/dietlibc/librpc/rpc_callmsg.c189
-rw-r--r--mdk-stage1/dietlibc/librpc/rpc_commondata.c42
-rw-r--r--mdk-stage1/dietlibc/librpc/rpc_dtablesize.c50
-rw-r--r--mdk-stage1/dietlibc/librpc/rpc_prot.c281
-rw-r--r--mdk-stage1/dietlibc/librpc/svc.c479
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_auth.c115
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_auth_unix.c136
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_raw.c159
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_run.c71
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_simple.c144
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_tcp.c406
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_udp.c467
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr.c536
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_array.c152
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_float.c284
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_mem.c180
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_rec.c573
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_reference.c130
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_stdio.c187
-rw-r--r--mdk-stage1/dietlibc/libshell/fnmatch.c74
-rw-r--r--mdk-stage1/dietlibc/libshell/glob.c350
-rw-r--r--mdk-stage1/dietlibc/libshell/realpath.c31
-rw-r--r--mdk-stage1/dietlibc/libstdio/clearerr.c5
-rw-r--r--mdk-stage1/dietlibc/libstdio/fclose.c26
-rw-r--r--mdk-stage1/dietlibc/libstdio/fdglue.c52
-rw-r--r--mdk-stage1/dietlibc/libstdio/fdopen.c21
-rw-r--r--mdk-stage1/dietlibc/libstdio/feof.c9
-rw-r--r--mdk-stage1/dietlibc/libstdio/ferror.c5
-rw-r--r--mdk-stage1/dietlibc/libstdio/fflush.c62
-rw-r--r--mdk-stage1/dietlibc/libstdio/fgetc.c40
-rw-r--r--mdk-stage1/dietlibc/libstdio/fgets.c20
-rw-r--r--mdk-stage1/dietlibc/libstdio/fileno.c5
-rw-r--r--mdk-stage1/dietlibc/libstdio/fopen.c21
-rw-r--r--mdk-stage1/dietlibc/libstdio/fprintf.c23
-rw-r--r--mdk-stage1/dietlibc/libstdio/fputc.c19
-rw-r--r--mdk-stage1/dietlibc/libstdio/fputs.c6
-rw-r--r--mdk-stage1/dietlibc/libstdio/fread.c51
-rw-r--r--mdk-stage1/dietlibc/libstdio/freopen.c9
-rw-r--r--mdk-stage1/dietlibc/libstdio/fseek.c11
-rw-r--r--mdk-stage1/dietlibc/libstdio/ftell.c7
-rw-r--r--mdk-stage1/dietlibc/libstdio/fwrite.c30
-rw-r--r--mdk-stage1/dietlibc/libstdio/printf.c29
-rw-r--r--mdk-stage1/dietlibc/libstdio/putchar.c6
-rw-r--r--mdk-stage1/dietlibc/libstdio/setvbuf.c18
-rw-r--r--mdk-stage1/dietlibc/libstdio/stderr.c13
-rw-r--r--mdk-stage1/dietlibc/libstdio/stdin.c13
-rw-r--r--mdk-stage1/dietlibc/libstdio/stdout.c14
-rw-r--r--mdk-stage1/dietlibc/libstdio/ungetc.c11
-rw-r--r--mdk-stage1/dietlibc/libugly/asctime.c7
-rw-r--r--mdk-stage1/dietlibc/libugly/asctime_r.c29
-rw-r--r--mdk-stage1/dietlibc/libugly/asprintf.c22
-rw-r--r--mdk-stage1/dietlibc/libugly/ctime.c5
-rw-r--r--mdk-stage1/dietlibc/libugly/daemon.c35
-rw-r--r--mdk-stage1/dietlibc/libugly/endmntent.c7
-rw-r--r--mdk-stage1/dietlibc/libugly/facilitynames.c32
-rw-r--r--mdk-stage1/dietlibc/libugly/getmntent.c30
-rw-r--r--mdk-stage1/dietlibc/libugly/getprotoent.c130
-rw-r--r--mdk-stage1/dietlibc/libugly/gmtime.c6
-rw-r--r--mdk-stage1/dietlibc/libugly/gmtime_r.c35
-rw-r--r--mdk-stage1/dietlibc/libugly/isleap.c6
-rw-r--r--mdk-stage1/dietlibc/libugly/localtime.c6
-rw-r--r--mdk-stage1/dietlibc/libugly/localtime_r.c21
-rw-r--r--mdk-stage1/dietlibc/libugly/logging.c211
-rw-r--r--mdk-stage1/dietlibc/libugly/mktime.c21
-rw-r--r--mdk-stage1/dietlibc/libugly/pclose.c11
-rw-r--r--mdk-stage1/dietlibc/libugly/popen.c32
-rw-r--r--mdk-stage1/dietlibc/libugly/prioritynames.c22
-rw-r--r--mdk-stage1/dietlibc/libugly/setenv.c17
-rw-r--r--mdk-stage1/dietlibc/libugly/setmntent.c7
-rw-r--r--mdk-stage1/dietlibc/libugly/strftime.c182
-rw-r--r--mdk-stage1/dietlibc/libugly/strsignal.c92
-rw-r--r--mdk-stage1/dietlibc/libugly/system.c69
-rw-r--r--mdk-stage1/dietlibc/libugly/time_table_spd.c17
-rw-r--r--mdk-stage1/dietlibc/libugly/tzfile.c86
-rw-r--r--mdk-stage1/dietlibc/libugly/unsetenv.c6
-rw-r--r--mdk-stage1/dietlibc/ppc/Makefile.add3
-rw-r--r--mdk-stage1/dietlibc/ppc/__longjmp.S59
-rw-r--r--mdk-stage1/dietlibc/ppc/__testandset.S11
-rw-r--r--mdk-stage1/dietlibc/ppc/mmap.c37
-rw-r--r--mdk-stage1/dietlibc/ppc/setjmp.S56
-rw-r--r--mdk-stage1/dietlibc/ppc/start.S44
-rw-r--r--mdk-stage1/dietlibc/ppc/unified.S21
-rw-r--r--mdk-stage1/dietlibc/sparc/Makefile.add3
-rw-r--r--mdk-stage1/dietlibc/sparc/__longjmp.S67
-rw-r--r--mdk-stage1/dietlibc/sparc/__testandset.S6
-rw-r--r--mdk-stage1/dietlibc/sparc/clone.S45
-rw-r--r--mdk-stage1/dietlibc/sparc/fork.S25
-rw-r--r--mdk-stage1/dietlibc/sparc/mmap.c43
-rw-r--r--mdk-stage1/dietlibc/sparc/pipe.S26
-rw-r--r--mdk-stage1/dietlibc/sparc/setjmp.S37
-rw-r--r--mdk-stage1/dietlibc/sparc/shmat.c19
-rw-r--r--mdk-stage1/dietlibc/sparc/start.S46
-rw-r--r--mdk-stage1/dietlibc/sparc/udiv.S363
-rw-r--r--mdk-stage1/dietlibc/sparc/umul.S170
-rw-r--r--mdk-stage1/dietlibc/sparc/unified.S28
-rw-r--r--mdk-stage1/dietlibc/sparc/urem.S362
-rw-r--r--mdk-stage1/dietlibc/start.h14
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/_llseek.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/_newselect.c6
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/access.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/chdir.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/chmod.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/chown.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/chroot.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/clone.c1
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/close.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/dup.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/dup2.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/execve.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/exit.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/fchdir.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/fchmod.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/fchown.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/fcntl.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/flock.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/fork.c6
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/fsync.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/ftruncate.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getcwd.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getdents.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getegid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/geteuid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getgid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getgroups.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getpgid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getpid.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getppid.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getpriority.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getresgid.c8
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getresuid.c8
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getrlimit.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getrusage.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getsid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/gettimeofday.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/getuid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/ioctl.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/kill.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/lchown.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/link.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/lseek.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/mkdir.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/mknod.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/mount.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/mprotect.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/mremap.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/munmap.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/nanosleep.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/open.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/pipe.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/poll.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/read.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/readlink.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/reboot.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/rename.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/rmdir.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setdomainname.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setgid.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setgroups.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/sethostname.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setitimer.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setpgid.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setpriority.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setregid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setresgid.c8
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setresuid.c8
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setreuid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setrlimit.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setsid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/setuid.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/sigaction.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/signal.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/sigpending.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/sigprocmask.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/sigsuspend.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/socketcall.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/swapoff.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/swapon.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/symlink.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/sync.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/syslog.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/time.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/truncate.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/umask.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/umount.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/uname.c5
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/unlink.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/utime.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/vhangup.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/wait4.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/waitpid.c4
-rw-r--r--mdk-stage1/dietlibc/syscalls.c/write.c3
-rw-r--r--mdk-stage1/dietlibc/syscalls.h142
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/__getpagesize.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/__pread.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/__reboot.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/_llseek.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/access.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/brk.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/chdir.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/chmod.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/chown.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/chroot.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/close.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/dup.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/dup2.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/execve.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/exit.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fchdir.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fchmod.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fchown.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fcntl.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/flock.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fork.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fstat.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fstat64.S8
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fstatfs.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fsync.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ftruncate.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getcwd.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getdents.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getdents64.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getegid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/geteuid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getgid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getgroups.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getitimer.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getpgid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getpid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getppid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getpriority.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getresgid.S7
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getresuid.S7
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getrlimit.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getrusage.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getsid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/gettimeofday.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getuid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ioctl.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ioperm.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/iopl.S6
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ipc.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/kill.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/lchown.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/link.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/llseek.S6
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/lseek.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/lstat.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/lstat64.S8
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mkdir.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mknod.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mlockall.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mount.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mprotect.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mremap.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/munlockall.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/munmap.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/nanosleep.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/nice.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/open.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/pause.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/personality.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/pipe.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/poll.S3
-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/query_module.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/read.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/readlink.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/readv.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rename.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rmdir.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_get_priority_max.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_get_priority_min.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_getparam.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_getscheduler.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_rr_get_interval.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_setparam.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_setscheduler.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sched_yield.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/select.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sendfile.S6
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setdomainname.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setgid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setgroups.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sethostname.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setitimer.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setpgid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setpriority.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setregid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setresgid.S7
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setresuid.S7
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setreuid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setrlimit.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setsid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setuid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigaction.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigaltstack.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
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/socketcall.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/stat.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/stat64.S8
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/statfs.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/stime.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/swapoff.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/swapon.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/symlink.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sync.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sysctl.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sysinfo.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/syslog.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/time.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/times.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/truncate.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/umask.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/umount.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/umount2.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/uname.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/unlink.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/utime.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/vhangup.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/wait4.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/waitpid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/write.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/writev.S3
-rw-r--r--mdk-stage1/disk.c342
-rw-r--r--mdk-stage1/disk.h27
-rw-r--r--mdk-stage1/dns.c213
-rw-r--r--mdk-stage1/dns.h30
-rw-r--r--mdk-stage1/doc/HACKING31
-rw-r--r--mdk-stage1/doc/README185
-rw-r--r--mdk-stage1/doc/TECH-INFOS91
-rw-r--r--mdk-stage1/doc/UPDATEMODULES74
-rw-r--r--mdk-stage1/doc/WHY-DIETLIBC50
-rw-r--r--mdk-stage1/doc/documented..frontend.h69
-rw-r--r--mdk-stage1/frontend-common.c43
-rw-r--r--mdk-stage1/frontend.h52
-rw-r--r--mdk-stage1/init-data/emptyboot.img.bz2bin6342 -> 0 bytes
-rw-r--r--mdk-stage1/init-data/msgboot-blank.img.bz2bin14592 -> 0 bytes
-rw-r--r--mdk-stage1/init-data/msgboot-graphicallogo-2880.img.bz2bin30301 -> 0 bytes
-rw-r--r--mdk-stage1/init-data/msgboot-graphicallogo.img.bz2bin26960 -> 0 bytes
-rw-r--r--mdk-stage1/init-data/msgboot.img.bz2bin30881 -> 0 bytes
-rw-r--r--mdk-stage1/init-libc-headers.h44
-rw-r--r--mdk-stage1/init.c468
-rw-r--r--mdk-stage1/insmod-busybox/.cvsignore2
-rw-r--r--mdk-stage1/insmod-busybox/Config.h132
-rw-r--r--mdk-stage1/insmod-busybox/Makefile65
-rw-r--r--mdk-stage1/insmod-busybox/README8
-rw-r--r--mdk-stage1/insmod-busybox/busybox.h467
-rw-r--r--mdk-stage1/insmod-busybox/insmod-frontend.c24
-rw-r--r--mdk-stage1/insmod-busybox/insmod.c2951
-rw-r--r--mdk-stage1/insmod-busybox/loop.h5
-rw-r--r--mdk-stage1/insmod-busybox/messages.c90
-rw-r--r--mdk-stage1/insmod-busybox/utility.c1759
-rw-r--r--mdk-stage1/insmod-modutils/Makefile63
-rw-r--r--mdk-stage1/insmod-modutils/include/config.h105
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_alpha.h10
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_arm.h10
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_hppa.h9
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_hppa64.h9
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_i386.h10
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_ia64.h9
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_m68k.h10
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_mips.h24
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_ppc.h10
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_s390.h10
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_sparc.h10
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_sparc64.h27
-rw-r--r--mdk-stage1/insmod-modutils/include/kallsyms.h131
-rw-r--r--mdk-stage1/insmod-modutils/include/kerneld.h46
-rw-r--r--mdk-stage1/insmod-modutils/include/modstat.h55
-rw-r--r--mdk-stage1/insmod-modutils/include/module.h210
-rw-r--r--mdk-stage1/insmod-modutils/include/obj.h275
-rw-r--r--mdk-stage1/insmod-modutils/include/util.h101
-rw-r--r--mdk-stage1/insmod-modutils/include/version.h1
-rw-r--r--mdk-stage1/insmod-modutils/insmod-frontend.c24
-rw-r--r--mdk-stage1/insmod-modutils/insmod.c1964
-rw-r--r--mdk-stage1/insmod-modutils/obj/Makefile33
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_alpha.c305
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_arm.c318
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_common.c399
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_hppa.c668
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_hppa64.c686
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_i386.c245
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_ia64.c1065
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_kallsyms.c292
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_load.c354
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_m68k.c147
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_mips.c238
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_ppc.c255
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_reloc.c435
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_s390.c245
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_sparc.c226
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_sparc64.c352
-rw-r--r--mdk-stage1/insmod-modutils/util/Makefile42
-rw-r--r--mdk-stage1/insmod-modutils/util/alias.h244
-rw-r--r--mdk-stage1/insmod-modutils/util/arch64.c35
-rw-r--r--mdk-stage1/insmod-modutils/util/config.c1591
-rw-r--r--mdk-stage1/insmod-modutils/util/gzfiles.c74
-rw-r--r--mdk-stage1/insmod-modutils/util/logger.c163
-rw-r--r--mdk-stage1/insmod-modutils/util/meta_expand.c339
-rw-r--r--mdk-stage1/insmod-modutils/util/modstat.c419
-rw-r--r--mdk-stage1/insmod-modutils/util/snap_shot.c154
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_cm.c88
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_dm.c37
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_gks.c37
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_nim.c53
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_oim.c40
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_qm.c56
-rw-r--r--mdk-stage1/insmod-modutils/util/xftw.c422
-rw-r--r--mdk-stage1/insmod-modutils/util/xmalloc.c39
-rw-r--r--mdk-stage1/insmod-modutils/util/xrealloc.c39
-rw-r--r--mdk-stage1/insmod-modutils/util/xstrcat.c40
-rw-r--r--mdk-stage1/insmod-modutils/util/xstrdup.c41
-rw-r--r--mdk-stage1/insmod-modutils/util/xsystem.c51
-rw-r--r--mdk-stage1/insmod.h20
-rw-r--r--mdk-stage1/linux-2.2/nfs.h226
-rw-r--r--mdk-stage1/linux-2.2/nfs_mount.h53
-rw-r--r--mdk-stage1/log.c89
-rw-r--r--mdk-stage1/log.h34
-rw-r--r--mdk-stage1/lomount.c171
-rw-r--r--mdk-stage1/lomount.h21
-rw-r--r--mdk-stage1/mar/.cvsignore1
-rw-r--r--mdk-stage1/mar/Makefile61
-rw-r--r--mdk-stage1/mar/mar-extract-only.c208
-rw-r--r--mdk-stage1/mar/mar-extract-only.h32
-rw-r--r--mdk-stage1/mar/mar-frontend.c199
-rw-r--r--mdk-stage1/mar/mar.h70
-rw-r--r--mdk-stage1/minilibc.c251
-rw-r--r--mdk-stage1/minilibc.h144
-rw-r--r--mdk-stage1/mkinitrd_helper/Makefile46
-rw-r--r--mdk-stage1/mkinitrd_helper/mkinitrd_helper.c308
-rw-r--r--mdk-stage1/modules.c437
-rw-r--r--mdk-stage1/modules.h35
-rw-r--r--mdk-stage1/modules_descr.h66
-rw-r--r--mdk-stage1/mount.c189
-rw-r--r--mdk-stage1/mount.h35
-rw-r--r--mdk-stage1/mount_rpcgen.h208
-rw-r--r--mdk-stage1/network.c833
-rw-r--r--mdk-stage1/network.h61
-rw-r--r--mdk-stage1/newt-frontend.c396
-rw-r--r--mdk-stage1/newt/Makefile56
-rw-r--r--mdk-stage1/newt/button.c190
-rw-r--r--mdk-stage1/newt/buttonbar.c46
-rw-r--r--mdk-stage1/newt/checkbox.c290
-rw-r--r--mdk-stage1/newt/checkboxtree.c714
-rw-r--r--mdk-stage1/newt/entry.c376
-rw-r--r--mdk-stage1/newt/form.c712
-rw-r--r--mdk-stage1/newt/grid.c389
-rw-r--r--mdk-stage1/newt/label.c81
-rw-r--r--mdk-stage1/newt/listbox.c752
-rw-r--r--mdk-stage1/newt/newt.c672
-rw-r--r--mdk-stage1/newt/newt.h362
-rw-r--r--mdk-stage1/newt/newt_pr.h82
-rw-r--r--mdk-stage1/newt/scale.c72
-rw-r--r--mdk-stage1/newt/scrollbar.c124
-rw-r--r--mdk-stage1/newt/textbox.c409
-rw-r--r--mdk-stage1/newt/windows.c275
-rw-r--r--mdk-stage1/nfsmount.c294
-rw-r--r--mdk-stage1/nfsmount.h328
-rw-r--r--mdk-stage1/pci-resource/.cvsignore1
-rw-r--r--mdk-stage1/pci-resource/Makefile25
-rwxr-xr-xmdk-stage1/pci-resource/update-pci-ids.pl46
-rw-r--r--mdk-stage1/pcmcia_/Makefile48
-rw-r--r--mdk-stage1/pcmcia_/bulkmem.h195
-rw-r--r--mdk-stage1/pcmcia_/cardmgr.c1652
-rw-r--r--mdk-stage1/pcmcia_/cardmgr.h112
-rw-r--r--mdk-stage1/pcmcia_/cirrus.h182
-rw-r--r--mdk-stage1/pcmcia_/cistpl.h604
-rw-r--r--mdk-stage1/pcmcia_/cs.h465
-rw-r--r--mdk-stage1/pcmcia_/cs_types.h65
-rw-r--r--mdk-stage1/pcmcia_/driver_ops.h82
-rw-r--r--mdk-stage1/pcmcia_/ds.h163
-rw-r--r--mdk-stage1/pcmcia_/i82365.h154
-rw-r--r--mdk-stage1/pcmcia_/lex_config.c2053
-rwxr-xr-xmdk-stage1/pcmcia_/merge_from_pcitable51
-rw-r--r--mdk-stage1/pcmcia_/pcmcia.h21
-rw-r--r--mdk-stage1/pcmcia_/probe.c513
-rw-r--r--mdk-stage1/pcmcia_/tcic.h266
-rw-r--r--mdk-stage1/pcmcia_/version.h4
-rw-r--r--mdk-stage1/pcmcia_/vg468.h112
-rw-r--r--mdk-stage1/pcmcia_/yacc_config.c1015
-rw-r--r--mdk-stage1/pcmcia_/yacc_config.h37
-rw-r--r--mdk-stage1/ppp/.cvsignore1
-rw-r--r--mdk-stage1/ppp/Changes-2.3441
-rw-r--r--mdk-stage1/ppp/FAQ634
-rw-r--r--mdk-stage1/ppp/PLUGINS131
-rw-r--r--mdk-stage1/ppp/README168
-rw-r--r--mdk-stage1/ppp/README.MSCHAP80284
-rw-r--r--mdk-stage1/ppp/README.cbcp97
-rw-r--r--mdk-stage1/ppp/README.linux297
-rw-r--r--mdk-stage1/ppp/README.sol2220
-rw-r--r--mdk-stage1/ppp/README.sunos462
-rw-r--r--mdk-stage1/ppp/SETUP111
-rw-r--r--mdk-stage1/ppp/chat/Makefile.linux27
-rw-r--r--mdk-stage1/ppp/chat/Makefile.linux.makeopt27
-rw-r--r--mdk-stage1/ppp/chat/Makefile.sol219
-rw-r--r--mdk-stage1/ppp/chat/Makefile.sunos419
-rw-r--r--mdk-stage1/ppp/chat/chat.8515
-rw-r--r--mdk-stage1/ppp/chat/chat.c1756
-rw-r--r--mdk-stage1/ppp/common/zlib.c5376
-rw-r--r--mdk-stage1/ppp/common/zlib.h1010
-rwxr-xr-xmdk-stage1/ppp/configure141
-rw-r--r--mdk-stage1/ppp/contrib/pppgetpass/Makefile.linux16
-rw-r--r--mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.818
-rw-r--r--mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c92
-rw-r--r--mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.sh7
-rw-r--r--mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.vt.c218
-rw-r--r--mdk-stage1/ppp/etc.ppp/chap-secrets2
-rw-r--r--mdk-stage1/ppp/etc.ppp/options5
-rw-r--r--mdk-stage1/ppp/etc.ppp/options.options1
-rw-r--r--mdk-stage1/ppp/etc.ppp/pap-secrets2
-rw-r--r--mdk-stage1/ppp/include/linux/if_ppp.h155
-rw-r--r--mdk-stage1/ppp/include/linux/if_pppvar.h138
-rw-r--r--mdk-stage1/ppp/include/linux/ppp-comp.h203
-rw-r--r--mdk-stage1/ppp/include/linux/ppp_defs.h185
-rw-r--r--mdk-stage1/ppp/include/net/if_ppp.h133
-rw-r--r--mdk-stage1/ppp/include/net/ppp-comp.h165
-rw-r--r--mdk-stage1/ppp/include/net/ppp_defs.h184
-rw-r--r--mdk-stage1/ppp/include/net/pppio.h99
-rw-r--r--mdk-stage1/ppp/include/net/slcompress.h148
-rw-r--r--mdk-stage1/ppp/include/net/vjcompress.h144
-rw-r--r--mdk-stage1/ppp/include/pcap-int.h117
-rw-r--r--mdk-stage1/ppp/linux/Makefile.top55
-rw-r--r--mdk-stage1/ppp/modules/bsd-comp.c1116
-rw-r--r--mdk-stage1/ppp/modules/deflate.c760
-rw-r--r--mdk-stage1/ppp/modules/if_ppp.c865
-rw-r--r--mdk-stage1/ppp/modules/ppp.c2486
-rw-r--r--mdk-stage1/ppp/modules/ppp_ahdlc.c878
-rw-r--r--mdk-stage1/ppp/modules/ppp_comp.c1126
-rw-r--r--mdk-stage1/ppp/modules/ppp_mod.h190
-rw-r--r--mdk-stage1/ppp/modules/vjcompress.c587
-rw-r--r--mdk-stage1/ppp/pppd/.cvsignore2
-rw-r--r--mdk-stage1/ppp/pppd/Makefile59
-rw-r--r--mdk-stage1/ppp/pppd/Makefile.linux129
-rw-r--r--mdk-stage1/ppp/pppd/Makefile.linux.make131
-rw-r--r--mdk-stage1/ppp/pppd/Makefile.linux.makeopt129
-rw-r--r--mdk-stage1/ppp/pppd/Makefile.sol248
-rw-r--r--mdk-stage1/ppp/pppd/Makefile.sunos426
-rw-r--r--mdk-stage1/ppp/pppd/auth.c1939
-rw-r--r--mdk-stage1/ppp/pppd/cbcp.c456
-rw-r--r--mdk-stage1/ppp/pppd/cbcp.h26
-rw-r--r--mdk-stage1/ppp/pppd/ccp.c1257
-rw-r--r--mdk-stage1/ppp/pppd/ccp.h48
-rw-r--r--mdk-stage1/ppp/pppd/chap.c860
-rw-r--r--mdk-stage1/ppp/pppd/chap.h124
-rw-r--r--mdk-stage1/ppp/pppd/chap_ms.c338
-rw-r--r--mdk-stage1/ppp/pppd/chap_ms.h33
-rw-r--r--mdk-stage1/ppp/pppd/demand.c351
-rw-r--r--mdk-stage1/ppp/pppd/eui64.c40
-rw-r--r--mdk-stage1/ppp/pppd/eui64.h97
-rw-r--r--mdk-stage1/ppp/pppd/fsm.c762
-rw-r--r--mdk-stage1/ppp/pppd/fsm.h144
-rw-r--r--mdk-stage1/ppp/pppd/ipcp.c2054
-rw-r--r--mdk-stage1/ppp/pppd/ipcp.h73
-rw-r--r--mdk-stage1/ppp/pppd/ipv6cp.c1512
-rw-r--r--mdk-stage1/ppp/pppd/ipv6cp.h126
-rw-r--r--mdk-stage1/ppp/pppd/ipxcp.c1570
-rw-r--r--mdk-stage1/ppp/pppd/ipxcp.h71
-rw-r--r--mdk-stage1/ppp/pppd/lcp.c2224
-rw-r--r--mdk-stage1/ppp/pppd/lcp.h95
-rw-r--r--mdk-stage1/ppp/pppd/magic.c88
-rw-r--r--mdk-stage1/ppp/pppd/magic.h23
-rw-r--r--mdk-stage1/ppp/pppd/main.c1846
-rw-r--r--mdk-stage1/ppp/pppd/md4.c298
-rw-r--r--mdk-stage1/ppp/pppd/md4.h64
-rw-r--r--mdk-stage1/ppp/pppd/md5.c309
-rw-r--r--mdk-stage1/ppp/pppd/md5.h58
-rw-r--r--mdk-stage1/ppp/pppd/multilink.c397
-rw-r--r--mdk-stage1/ppp/pppd/options.c1513
-rw-r--r--mdk-stage1/ppp/pppd/patchlevel.h4
-rw-r--r--mdk-stage1/ppp/pppd/pathnames.h25
-rw-r--r--mdk-stage1/ppp/pppd/plugins/Makefile.linux19
-rw-r--r--mdk-stage1/ppp/pppd/plugins/Makefile.sol227
-rw-r--r--mdk-stage1/ppp/pppd/plugins/minconn.c46
-rw-r--r--mdk-stage1/ppp/pppd/plugins/passprompt.c108
-rw-r--r--mdk-stage1/ppp/pppd/ppp.pam6
-rw-r--r--mdk-stage1/ppp/pppd/pppd.81591
-rw-r--r--mdk-stage1/ppp/pppd/pppd.h787
-rw-r--r--mdk-stage1/ppp/pppd/pppd.h.wtmp789
-rw-r--r--mdk-stage1/ppp/pppd/sys-linux.c2672
-rw-r--r--mdk-stage1/ppp/pppd/sys-linux.c.wtmp2750
-rw-r--r--mdk-stage1/ppp/pppd/sys-solaris.c2737
-rw-r--r--mdk-stage1/ppp/pppd/sys-sunos4.c1559
-rw-r--r--mdk-stage1/ppp/pppd/tdb.c1282
-rw-r--r--mdk-stage1/ppp/pppd/tdb.h77
-rw-r--r--mdk-stage1/ppp/pppd/tty.c1164
-rw-r--r--mdk-stage1/ppp/pppd/upap.c640
-rw-r--r--mdk-stage1/ppp/pppd/upap.h87
-rw-r--r--mdk-stage1/ppp/pppd/utils.c949
-rw-r--r--mdk-stage1/ppp/pppdump/Makefile.linux17
-rw-r--r--mdk-stage1/ppp/pppdump/Makefile.linux.makeopt17
-rw-r--r--mdk-stage1/ppp/pppdump/Makefile.linux.pppdump-Makefile17
-rw-r--r--mdk-stage1/ppp/pppdump/Makefile.sol221
-rw-r--r--mdk-stage1/ppp/pppdump/Makefile.sunos421
-rw-r--r--mdk-stage1/ppp/pppdump/bsd-comp.c750
-rw-r--r--mdk-stage1/ppp/pppdump/deflate.c344
-rw-r--r--mdk-stage1/ppp/pppdump/ppp-comp.h150
-rw-r--r--mdk-stage1/ppp/pppdump/pppdump.862
-rw-r--r--mdk-stage1/ppp/pppdump/pppdump.c502
-rw-r--r--mdk-stage1/ppp/pppdump/zlib.c4614
-rw-r--r--mdk-stage1/ppp/pppdump/zlib.h631
-rw-r--r--mdk-stage1/ppp/pppstats/Makefile.linux32
-rw-r--r--mdk-stage1/ppp/pppstats/Makefile.sol220
-rw-r--r--mdk-stage1/ppp/pppstats/Makefile.sunos430
-rw-r--r--mdk-stage1/ppp/pppstats/pppstats.8217
-rw-r--r--mdk-stage1/ppp/pppstats/pppstats.c557
-rw-r--r--mdk-stage1/ppp/sample/auth-down17
-rw-r--r--mdk-stage1/ppp/sample/auth-up17
-rw-r--r--mdk-stage1/ppp/sample/ip-down22
-rw-r--r--mdk-stage1/ppp/sample/ip-up23
-rw-r--r--mdk-stage1/ppp/sample/options153
-rw-r--r--mdk-stage1/ppp/sample/options.ttyXX14
-rw-r--r--mdk-stage1/ppp/sample/pap-secrets28
-rw-r--r--mdk-stage1/ppp/scripts/README143
-rwxr-xr-xmdk-stage1/ppp/scripts/callback77
-rw-r--r--mdk-stage1/ppp/scripts/chat-callback98
-rw-r--r--mdk-stage1/ppp/scripts/chatchat/README134
-rw-r--r--mdk-stage1/ppp/scripts/chatchat/chatchat.c409
-rw-r--r--mdk-stage1/ppp/scripts/ip-down.local.add20
-rw-r--r--mdk-stage1/ppp/scripts/ip-up.local.add24
-rw-r--r--mdk-stage1/ppp/scripts/options-rsh-loc1
-rw-r--r--mdk-stage1/ppp/scripts/options-rsh-rem1
-rw-r--r--mdk-stage1/ppp/scripts/options-ssh-loc1
-rw-r--r--mdk-stage1/ppp/scripts/options-ssh-rem1
-rwxr-xr-xmdk-stage1/ppp/scripts/ppp-off34
-rwxr-xr-xmdk-stage1/ppp/scripts/ppp-on36
-rwxr-xr-xmdk-stage1/ppp/scripts/ppp-on-dialer17
-rwxr-xr-xmdk-stage1/ppp/scripts/ppp-on-rsh72
-rwxr-xr-xmdk-stage1/ppp/scripts/ppp-on-ssh76
-rwxr-xr-xmdk-stage1/ppp/scripts/redialer96
-rw-r--r--mdk-stage1/ppp/scripts/secure-card111
-rw-r--r--mdk-stage1/ppp/solaris/Makedefs16
-rw-r--r--mdk-stage1/ppp/solaris/Makedefs.sol259
-rw-r--r--mdk-stage1/ppp/solaris/Makefile.sol266
-rw-r--r--mdk-stage1/ppp/solaris/Makefile.sol2-6485
-rw-r--r--mdk-stage1/ppp/solaris/Makefile.top50
-rw-r--r--mdk-stage1/ppp/solaris/ppp.c2486
-rw-r--r--mdk-stage1/ppp/solaris/ppp.conf1
-rw-r--r--mdk-stage1/ppp/solaris/ppp_ahdlc.c878
-rw-r--r--mdk-stage1/ppp/solaris/ppp_ahdlc_mod.c49
-rw-r--r--mdk-stage1/ppp/solaris/ppp_comp.c1126
-rw-r--r--mdk-stage1/ppp/solaris/ppp_comp_mod.c81
-rw-r--r--mdk-stage1/ppp/solaris/ppp_mod.c174
-rw-r--r--mdk-stage1/ppp/solaris/ppp_mod.h190
-rw-r--r--mdk-stage1/ppp/sunos4/Makedefs13
-rw-r--r--mdk-stage1/ppp/sunos4/Makefile57
-rw-r--r--mdk-stage1/ppp/sunos4/Makefile.top46
-rw-r--r--mdk-stage1/ppp/sunos4/if_ppp_vdcmd.c57
-rwxr-xr-xmdk-stage1/ppp/sunos4/ppp.INSTALL104
-rw-r--r--mdk-stage1/ppp/sunos4/ppp_ahdlc_vdcmd.c57
-rw-r--r--mdk-stage1/ppp/sunos4/ppp_comp_vdcmd.c57
-rw-r--r--mdk-stage1/ppp/sunos4/ppp_vdcmd.c81
-rw-r--r--mdk-stage1/ppp/svr4/Makedefs16
-rw-r--r--mdk-stage1/ppp/svr4/Makedefs.sol259
-rw-r--r--mdk-stage1/ppp/svr4/Makefile.sol266
-rw-r--r--mdk-stage1/ppp/svr4/Makefile.sol2-6485
-rw-r--r--mdk-stage1/ppp/svr4/Makefile.svr460
-rw-r--r--mdk-stage1/ppp/svr4/Makefile.top50
-rw-r--r--mdk-stage1/ppp/svr4/ppp.Master1
-rw-r--r--mdk-stage1/ppp/svr4/ppp.Node1
-rw-r--r--mdk-stage1/ppp/svr4/ppp.System1
-rw-r--r--mdk-stage1/ppp/svr4/ppp.conf1
-rw-r--r--mdk-stage1/ppp/svr4/ppp_ahdl.Master1
-rw-r--r--mdk-stage1/ppp/svr4/ppp_ahdl.System1
-rw-r--r--mdk-stage1/ppp/svr4/ppp_ahdlc_mod.c49
-rw-r--r--mdk-stage1/ppp/svr4/ppp_comp.Master1
-rw-r--r--mdk-stage1/ppp/svr4/ppp_comp.System1
-rw-r--r--mdk-stage1/ppp/svr4/ppp_comp_mod.c81
-rw-r--r--mdk-stage1/ppp/svr4/ppp_mod.c174
-rw-r--r--mdk-stage1/probing.c656
-rw-r--r--mdk-stage1/probing.h36
-rw-r--r--mdk-stage1/rescue-gui.c222
-rw-r--r--mdk-stage1/rp-pppoe/.cvsignore1
-rw-r--r--mdk-stage1/rp-pppoe/README87
-rw-r--r--mdk-stage1/rp-pppoe/configs/firewall-masq35
-rw-r--r--mdk-stage1/rp-pppoe/configs/firewall-standalone32
-rw-r--r--mdk-stage1/rp-pppoe/configs/pap-secrets9
-rw-r--r--mdk-stage1/rp-pppoe/configs/pppoe-server-options5
-rw-r--r--mdk-stage1/rp-pppoe/configs/pppoe.conf126
-rw-r--r--mdk-stage1/rp-pppoe/doc/CHANGES177
-rw-r--r--mdk-stage1/rp-pppoe/doc/HOW-TO-CONNECT295
-rw-r--r--mdk-stage1/rp-pppoe/doc/KERNEL-MODE-PPPOE39
-rw-r--r--mdk-stage1/rp-pppoe/doc/LICENSE339
-rw-r--r--mdk-stage1/rp-pppoe/doc/PROBLEMS3
-rwxr-xr-xmdk-stage1/rp-pppoe/go43
-rwxr-xr-xmdk-stage1/rp-pppoe/go-gui92
-rw-r--r--mdk-stage1/rp-pppoe/gui/Makefile.in64
-rw-r--r--mdk-stage1/rp-pppoe/gui/html/tkpppoe.html181
-rw-r--r--mdk-stage1/rp-pppoe/gui/pppoe-wrapper.145
-rw-r--r--mdk-stage1/rp-pppoe/gui/tkpppoe.136
-rwxr-xr-xmdk-stage1/rp-pppoe/gui/tkpppoe.in2891
-rw-r--r--mdk-stage1/rp-pppoe/gui/wrapper.c234
-rw-r--r--mdk-stage1/rp-pppoe/man/adsl-connect.866
-rw-r--r--mdk-stage1/rp-pppoe/man/adsl-setup.823
-rw-r--r--mdk-stage1/rp-pppoe/man/adsl-start.827
-rw-r--r--mdk-stage1/rp-pppoe/man/adsl-status.825
-rw-r--r--mdk-stage1/rp-pppoe/man/adsl-stop.821
-rw-r--r--mdk-stage1/rp-pppoe/man/pppoe-relay.8124
-rw-r--r--mdk-stage1/rp-pppoe/man/pppoe-server.8123
-rw-r--r--mdk-stage1/rp-pppoe/man/pppoe-sniff.877
-rw-r--r--mdk-stage1/rp-pppoe/man/pppoe.8236
-rw-r--r--mdk-stage1/rp-pppoe/man/pppoe.conf.5168
-rw-r--r--mdk-stage1/rp-pppoe/rp-pppoe-gui.spec98
-rw-r--r--mdk-stage1/rp-pppoe/rp-pppoe.spec71
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-connect.in278
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-init-suse.in62
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-init-turbolinux.in62
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-init.in64
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-setup.in346
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-start.in186
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-status82
-rwxr-xr-xmdk-stage1/rp-pppoe/scripts/adsl-stop.in84
-rw-r--r--mdk-stage1/rp-pppoe/src/.cvsignore2
-rw-r--r--mdk-stage1/rp-pppoe/src/Makefile58
-rw-r--r--mdk-stage1/rp-pppoe/src/Makefile.in257
-rw-r--r--mdk-stage1/rp-pppoe/src/common.c485
-rw-r--r--mdk-stage1/rp-pppoe/src/config.h135
-rw-r--r--mdk-stage1/rp-pppoe/src/config.h.in134
-rwxr-xr-xmdk-stage1/rp-pppoe/src/configure2356
-rw-r--r--mdk-stage1/rp-pppoe/src/configure.in231
-rw-r--r--mdk-stage1/rp-pppoe/src/debug.c143
-rw-r--r--mdk-stage1/rp-pppoe/src/discovery.c629
-rw-r--r--mdk-stage1/rp-pppoe/src/if.c1092
-rwxr-xr-xmdk-stage1/rp-pppoe/src/install-sh238
-rw-r--r--mdk-stage1/rp-pppoe/src/md5.c246
-rw-r--r--mdk-stage1/rp-pppoe/src/md5.h27
-rw-r--r--mdk-stage1/rp-pppoe/src/plugin.c397
-rw-r--r--mdk-stage1/rp-pppoe/src/ppp.c258
-rw-r--r--mdk-stage1/rp-pppoe/src/pppoe-server.c1247
-rw-r--r--mdk-stage1/rp-pppoe/src/pppoe-sniff.c258
-rw-r--r--mdk-stage1/rp-pppoe/src/pppoe.c834
-rw-r--r--mdk-stage1/rp-pppoe/src/pppoe.h331
-rw-r--r--mdk-stage1/rp-pppoe/src/relay.c1541
-rw-r--r--mdk-stage1/rp-pppoe/src/relay.h97
-rw-r--r--mdk-stage1/slang/Makefile56
-rw-r--r--mdk-stage1/slang/_slang.h743
-rw-r--r--mdk-stage1/slang/config.h163
-rw-r--r--mdk-stage1/slang/jdmacros.h53
-rw-r--r--mdk-stage1/slang/keywhash.c190
-rw-r--r--mdk-stage1/slang/sl-feat.h60
-rw-r--r--mdk-stage1/slang/slang.c5547
-rw-r--r--mdk-stage1/slang/slang.h1930
-rw-r--r--mdk-stage1/slang/slarith.c1656
-rw-r--r--mdk-stage1/slang/slarith.inc783
-rw-r--r--mdk-stage1/slang/slarray.c3139
-rw-r--r--mdk-stage1/slang/slarrfun.c464
-rw-r--r--mdk-stage1/slang/slarrfun.inc257
-rw-r--r--mdk-stage1/slang/slarrmis.c38
-rw-r--r--mdk-stage1/slang/slassoc.c713
-rw-r--r--mdk-stage1/slang/slbstr.c615
-rw-r--r--mdk-stage1/slang/slclass.c1391
-rw-r--r--mdk-stage1/slang/slcmd.c351
-rw-r--r--mdk-stage1/slang/slcmplex.c1142
-rw-r--r--mdk-stage1/slang/slcompat.c34
-rw-r--r--mdk-stage1/slang/slcurses.c972
-rw-r--r--mdk-stage1/slang/slcurses.h353
-rw-r--r--mdk-stage1/slang/sldisply.c2596
-rw-r--r--mdk-stage1/slang/slerr.c181
-rw-r--r--mdk-stage1/slang/slerrno.c219
-rw-r--r--mdk-stage1/slang/slgetkey.c306
-rw-r--r--mdk-stage1/slang/slimport.c281
-rw-r--r--mdk-stage1/slang/slinclud.h26
-rw-r--r--mdk-stage1/slang/slintall.c27
-rw-r--r--mdk-stage1/slang/slistruc.c218
-rw-r--r--mdk-stage1/slang/slkeymap.c596
-rw-r--r--mdk-stage1/slang/slkeypad.c163
-rw-r--r--mdk-stage1/slang/sllimits.h64
-rw-r--r--mdk-stage1/slang/slmalloc.c165
-rw-r--r--mdk-stage1/slang/slmath.c565
-rw-r--r--mdk-stage1/slang/slmemchr.c47
-rw-r--r--mdk-stage1/slang/slmemcmp.c76
-rw-r--r--mdk-stage1/slang/slmemcpy.c49
-rw-r--r--mdk-stage1/slang/slmemset.c39
-rw-r--r--mdk-stage1/slang/slmisc.c330
-rw-r--r--mdk-stage1/slang/slnspace.c242
-rw-r--r--mdk-stage1/slang/slospath.c73
-rw-r--r--mdk-stage1/slang/slpack.c785
-rw-r--r--mdk-stage1/slang/slparse.c1970
-rw-r--r--mdk-stage1/slang/slpath.c344
-rw-r--r--mdk-stage1/slang/slposdir.c1057
-rw-r--r--mdk-stage1/slang/slposio.c568
-rw-r--r--mdk-stage1/slang/slprepr.c427
-rw-r--r--mdk-stage1/slang/slproc.c155
-rw-r--r--mdk-stage1/slang/slregexp.c935
-rw-r--r--mdk-stage1/slang/slrline.c836
-rw-r--r--mdk-stage1/slang/slscanf.c718
-rw-r--r--mdk-stage1/slang/slscroll.c450
-rw-r--r--mdk-stage1/slang/slsearch.c239
-rw-r--r--mdk-stage1/slang/slsignal.c336
-rw-r--r--mdk-stage1/slang/slsmg.c1584
-rw-r--r--mdk-stage1/slang/slstd.c724
-rw-r--r--mdk-stage1/slang/slstdio.c1050
-rw-r--r--mdk-stage1/slang/slstring.c546
-rw-r--r--mdk-stage1/slang/slstrops.c1686
-rw-r--r--mdk-stage1/slang/slstruct.c932
-rw-r--r--mdk-stage1/slang/sltermin.c1155
-rw-r--r--mdk-stage1/slang/sltime.c310
-rw-r--r--mdk-stage1/slang/sltoken.c1702
-rw-r--r--mdk-stage1/slang/sltypes.c966
-rw-r--r--mdk-stage1/slang/slutty.c596
-rw-r--r--mdk-stage1/slang/slxstrng.c43
-rw-r--r--mdk-stage1/stage1-data/stage1-with-busybox.tar.bz2bin92142 -> 0 bytes
-rw-r--r--mdk-stage1/stage1-data/stage1-with-sash.tar.bz2bin345030 -> 0 bytes
-rw-r--r--mdk-stage1/stage1-data/stage1.tar.bz2bin1957 -> 0 bytes
-rw-r--r--mdk-stage1/stage1.c468
-rw-r--r--mdk-stage1/stage1.h59
-rw-r--r--mdk-stage1/stdio-frontend.c366
-rw-r--r--mdk-stage1/tools.c434
-rw-r--r--mdk-stage1/tools.h53
-rw-r--r--mdk-stage1/url.c501
-rw-r--r--mdk-stage1/url.h44
-rw-r--r--mdk-stage1/usb-resource/.cvsignore1
-rw-r--r--mdk-stage1/usb-resource/Makefile25
-rwxr-xr-xmdk-stage1/usb-resource/update-usb-ids.pl52
1335 files changed, 0 insertions, 217460 deletions
diff --git a/mdk-stage1/.cvsignore b/mdk-stage1/.cvsignore
deleted file mode 100644
index a96a43de4..000000000
--- a/mdk-stage1/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-init
-stage1-full
-stage1-cdrom
-stage1-disk
-stage1-network
-debug.log
-.depend
-*.rdz*
-mkinitrd_helper.tar.bz2
-hack_*
-stage1-usb
-rescue-gui
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile
deleted file mode 100644
index 68505ff7c..000000000
--- a/mdk-stage1/Makefile
+++ /dev/null
@@ -1,260 +0,0 @@
- #******************************************************************************
- #
- # mdk-stage1 - the program that will load second-stage install
- #
- # $Id$
- #
- # Guillaume Cottenceau (gc@mandrakesoft.com)
- #
- # Copyright 2000 MandrakeSoft
- #
- # This software may be freely redistributed under the terms of the GNU
- # public license.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- #
- # Portions from Erik Troan (ewt@redhat.com) Copyright 1996 Red Hat Software
- #
- #*****************************************************************************
- #
- # Currently:
- #
- # ix86
- # init with minilibc
- # stage1 with dietlibc
- #
- # ppc
- # init with dietlibc
- # stage1 with glibc
- #
- # ia64
- # init with glibc
- # stage1 with glibc
- #
- #*****************************************************************************
-
-
-VERSION = cooker
-
-top_dir = .
-
-include $(top_dir)/Makefile.common
-
-
-DEFS = -DVERSION=\"$(VERSION)\" -DSPAWN_SHELL
-
-COMPILE = $(CC) $(DEFS) $(CFLAGS)
-
-
- #- stage1 "loader"
-ifeq (i386, $(ARCH))
-INITSRC = minilibc.c init.c
-INIT_DEFS = -DINIT_HEADERS=\"minilibc.h\" -fno-builtin
-else
-INITSRC = init.c
-ifeq (ia64, $(ARCH))
-INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(GLIBC_INCLUDES)
-else
-INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(DIETLIBC_INCLUDES)
-endif
-endif
-
-INITOBJS = $(subst .c,.o,$(INITSRC))
-
-
- #- frontends
-NEWT_FRONTEND_SRC = newt-frontend.c
-GLIBC_NEWT_FRONTEND_LIBS = newt/libnewt.a slang/libslang.a
-DIETLIBC_NEWT_FRONTEND_LIBS = $(subst .a,-DIET.a,$(GLIBC_NEWT_FRONTEND_LIBS))
-
-STDIO_FRONTEND_SRC = stdio-frontend.c
-GLIBC_STDIO_FRONTEND_LIBS =
-DIETLIBC_STDIO_FRONTEND_LIBS =
-
-
-FRONTEND_OBJS = $(subst .c,.o,$($(F)_FRONTEND_SRC))
-
-FRONTEND_LINK = $(FRONTEND_OBJS) $($(L)_$(F)_FRONTEND_LIBS)
-
-ifeq (i386, $(ARCH))
-INSMOD = insmod-busybox
-else
-INSMOD = insmod-modutils
-endif
-
-GLIBC_STAGE1_OWN_LIBS = $(INSMOD)/libinsmod.a mar/libmar.a bzlib/libbzlib.a
-DIETLIBC_STAGE1_OWN_LIBS = $(subst .a,-DIET.a,$(GLIBC_STAGE1_OWN_LIBS))
-STAGE1_OWN_LIBS = $($(L)_STAGE1_OWN_LIBS)
-
-
-ifeq (DIETLIBC, $(L))
-STAGE1_NETWORK_LIBS = $(top_dir)/dietlibc/bin-$(ARCH)/librpc.a
-endif
-
-ifeq (GLIBC, $(L))
-STAGE1_NETWORK_LIBS = /usr/lib/libresolv.a
-endif
-
- #- stage1 itself
-STAGE1SRC = stage1.c log.c tools.c modules.c probing.c mount.c automatic.c frontend-common.c
-CDROMSRC = cdrom.c
-DISKSRC = disk.c lomount.c
-NETWORKSRC = network.c nfsmount.c dhcp.c url.c dns.c adsl.c
-
-ALLSRC = $(INITSRC) $(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC)
-
-
-
-STAGE1OBJS-CDROM = $(subst .c,-CDROM.o,$(STAGE1SRC) $(CDROMSRC))
-
-CDROM_DEFS = -DDISABLE_DISK -DDISABLE_NETWORK
-
-
-STAGE1OBJS-DISK = $(subst .c,-DISK.o,$(STAGE1SRC) $(DISKSRC))
-
-DISK_DEFS = -DDISABLE_CDROM -DDISABLE_NETWORK
-
-
-STAGE1OBJS-NETWORK = $(subst .c,-NETWORK.o,$(STAGE1SRC) $(NETWORKSRC))
-
-NETWORK_DEFS = -DDISABLE_CDROM -DDISABLE_DISK
-
-
-STAGE1OBJS-USB = $(subst .c,-USB.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC))
-
-STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC))
-
-
-ifeq (i386, $(ARCH))
-LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o
-else
-ifeq (ia64, $(ARCH))
-LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1)
-INIT_LIBC = $(GLIBC_LIBC)
-else
-LDFLAGS_INIT = $(DIETLIBC_LDFLAGS_STAGE1)
-INIT_LIBC = $(DIETLIBC_LIBC)
-endif
-endif
-
-
-BINS = init stage1-full
-
-ifeq (i386, $(ARCH))
-BINS += stage1-cdrom stage1-disk stage1-network stage1-usb
-endif
-
-ifneq (ia64, $(ARCH))
-DIRS = dietlibc
-endif
-DIRS += mar pci-resource usb-resource bzlib $(INSMOD) slang newt ppp/pppd rp-pppoe/src
-ifeq (i386,$(ARCH))
-DIRS += pcmcia_
-endif
-
-
-ifeq (i386,$(ARCH))
-GLIBC_PCMCIA_LIB = pcmcia_/libpcmcia.a
-DIETLIBC_PCMCIA_LIB = $(subst .a,-DIET.a,$(GLIBC_PCMCIA_LIB))
-PCMCIA_LIB = $($(L)_PCMCIA_LIB)
-PCMCIA_DEFS = -DENABLE_PCMCIA
-endif
-
-
-USB_DEFS_GEN = -DENABLE_USB
-USB_DEFS = -DENABLE_USB -DDISABLE_PCIADAPTERS
-
-all: dirs $(BINS)
-
-dirs:
- @for n in . $(DIRS); do \
- [ "$$n" = "." ] || make -C $$n || exit 1 ;\
- done
-
-init: $(INITOBJS) $(INIT_LIBC)
- $(CC) $(LDFLAGS_INIT) -o $@ $^
- $(STRIPCMD) $@
-
-stage1-cdrom: $(STAGE1OBJS-CDROM) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
- $(STRIPCMD) $@
-
-stage1-disk: $(STAGE1OBJS-DISK) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
- $(STRIPCMD) $@
-
-stage1-network: $(STAGE1OBJS-NETWORK) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(PCMCIA_LIB) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
- $(STRIPCMD) $@
-
-stage1-usb: $(STAGE1OBJS-USB) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
- $(STRIPCMD) $@
-
-stage1-full: $(STAGE1OBJS-FULL) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(PCMCIA_LIB) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
- $(STRIPCMD) $@
-
-
-$(INITOBJS): %.o: %.c
- $(COMPILE) $(INIT_DEFS) -c $<
-
-$(STAGE1OBJS-CDROM): %-CDROM.o: %.c
- $(COMPILE) $(INCLUDES) $(CDROM_DEFS) -c $< -o $@
-
-$(STAGE1OBJS-DISK): %-DISK.o: %.c
- $(COMPILE) $(INCLUDES) $(DISK_DEFS) -c $< -o $@
-
-$(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c
- $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(PCMCIA_DEFS) -c $< -o $@
-
-$(STAGE1OBJS-USB): %-USB.o: %.c
- $(COMPILE) $(INCLUDES) $(USB_DEFS) -c $< -o $@
-
-$(STAGE1OBJS-FULL): %-FULL.o: %.c
- $(COMPILE) $(INCLUDES) $(USB_DEFS_GEN) $(PCMCIA_DEFS) -c $< -o $@
-
-.c.o:
- $(COMPILE) $(INCLUDES) -c $<
-
-
-clean:
- @for n in $(DIRS); do \
- (cd $$n; make clean) \
- done
- rm -f *.o .depend *.rdz *.img rescue-gui $(BINS)
-
-
-tar-mkinitrd_helper: clean
- rm -rf mkinitrd_helper-subdir
- mkdir mkinitrd_helper-subdir
- cd mkinitrd_helper-subdir ; cp -a ../dietlibc ../insmod-busybox ../Makefile.common ../insmod.h ../log.h . ; \
- cp ../Makefile.mkinitrd_helper Makefile
- tar cfj mkinitrd_helper.tar.bz2 mkinitrd_helper-subdir --exclude CVS
- rm -rf mkinitrd_helper-subdir
-
-rescue-gui: rescue-gui.o frontend-common.o $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
- $(STRIPCMD) $@
-
-
-.depend:
- $(CPP) $(CFLAGS) -M $(ALLSRC) > .depend
-
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
-
-
-*-CDROM.o: %-CDROM.o: %.o
-
-*-DISK.o: %-DISK.o: %.o
-
-*-NETWORK.o: %-NETWORK.o: %.o
-
-*-USB.o: %-USB.o: %.o
-
-*-FULL.o: %-FULL.o: %.o
-
diff --git a/mdk-stage1/Makefile.common b/mdk-stage1/Makefile.common
deleted file mode 100644
index 7506c1381..000000000
--- a/mdk-stage1/Makefile.common
+++ /dev/null
@@ -1,57 +0,0 @@
- # -*- makefile -*-
- #******************************************************************************
- #
- # Guillaume Cottenceau (gc@mandrakesoft.com)
- #
- # Copyright 2000 MandrakeSoft
- #
- # This software may be freely redistributed under the terms of the GNU
- # public license.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- #
- #*****************************************************************************
-
-ARCH := $(patsubst i%86,i386,$(shell uname -m))
-ARCH := $(patsubst sparc%,sparc,$(ARCH))
-
- #- default lib is dietlibc (honoured by main Makefile whenever possible)
-L = DIETLIBC
-#L = GLIBC
-
- #- default frontend is newt (honoured by main Makefile whenever possible)
-F = NEWT
-# F = STDIO
-
- #- override in some situations
-ifeq (ia64, $(ARCH))
-L = GLIBC
-endif
-ifeq (ppc, $(ARCH))
-L = GLIBC
-endif
-
-
- #- flags used by all stuff
-ifeq (ppc, $(ARCH))
-CFLAGS = -Os -pipe -Wall -fomit-frame-pointer
-else
-CFLAGS = -Os -pipe -Wall -Werror -W -fomit-frame-pointer
-endif
-
-DIETLIBC_INCLUDES = -I$(top_dir)/dietlibc/include -I. -I$(top_dir)/bzlib
-GLIBC_INCLUDES = -I. -I$(top_dir)/bzlib
-INCLUDES = $($(L)_INCLUDES)
-
-GLIBC_LDFLAGS_STAGE1 = -static
-DIETLIBC_LDFLAGS_STAGE1 = -nostdlib $(top_dir)/dietlibc/bin-$(ARCH)/start.o
-LDFLAGS_STAGE1 = $($(L)_LDFLAGS_STAGE1)
-
-GLIBC_LIBC =
-DIETLIBC_LIBC = $(top_dir)/dietlibc/bin-$(ARCH)/dietlibc.a
-STAGE1_LIBC = $($(L)_LIBC)
-
-STRIPCMD = strip -R .note -R .comment
-
diff --git a/mdk-stage1/Makefile.mkinitrd_helper b/mdk-stage1/Makefile.mkinitrd_helper
deleted file mode 100644
index 72bef595f..000000000
--- a/mdk-stage1/Makefile.mkinitrd_helper
+++ /dev/null
@@ -1,30 +0,0 @@
- #******************************************************************************
- #
- # Guillaume Cottenceau (gc@mandrakesoft.com)
- #
- # Copyright 2000 MandrakeSoft
- #
- # This software may be freely redistributed under the terms of the GNU
- # public license.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- #
- #*****************************************************************************
-
-
-DIRS = dietlibc insmod-busybox
-
-
-all: dirs
-
-dirs:
- @for n in . $(DIRS); do \
- [ "$$n" = "." ] || make -C $$n ;\
- done
-
-clean:
- @for n in $(DIRS); do \
- (cd $$n; make clean) \
- done
diff --git a/mdk-stage1/adsl.c b/mdk-stage1/adsl.c
deleted file mode 100644
index d542f2f35..000000000
--- a/mdk-stage1/adsl.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <resolv.h>
-#include <signal.h>
-
-#include "stage1.h"
-#include "log.h"
-#include "network.h"
-#include "modules.h"
-#include "tools.h"
-#include "frontend.h"
-#include "automatic.h"
-
-#include "adsl.h"
-
-
-static enum return_type adsl_connect(char * net_device, char * username, char * password)
-{
- char pppoe_call[500];
- char * pppd_launch[] = { "/sbin/pppd", "pty", pppoe_call, "noipdefault", "noauth", "default-asyncmap", "defaultroute",
- "hide-password", "nodetach", "usepeerdns", "local", "mtu", "1492", "mru", "1492", "noaccomp",
- "noccp", "nobsdcomp", "nodeflate", "nopcomp", "novj", "novjccomp", "user", username,
- "password", password, "lcp-echo-interval", "20", "lcp-echo-failure", "3", "lock", "persist", NULL };
- int fd;
- int retries = 10;
- char * tty_adsl = "/dev/tty6";
- enum return_type status = RETURN_ERROR;
- pid_t ppp_pid;
-
- snprintf(pppoe_call, sizeof(pppoe_call), "/sbin/pppoe -p /var/run/pppoe.conf-adsl.pid.pppoe -I %s -T 80 -U -m 1412", net_device);
-
-
- fd = open(tty_adsl, O_RDWR);
- if (fd == -1) {
- log_message("cannot open tty -- no pppd");
- return RETURN_ERROR;
- }
- else if (access(pppd_launch[0], X_OK)) {
- log_message("cannot open pppd - %s doesn't exist", pppd_launch[0]);
- return RETURN_ERROR;
- }
-
- if (!(ppp_pid = fork())) {
- dup2(fd, 0);
- dup2(fd, 1);
- dup2(fd, 2);
-
- close(fd);
- setsid();
- if (ioctl(0, TIOCSCTTY, NULL))
- log_perror("could not set new controlling tty");
-
- printf("\t(exec of pppd)\n");
- execve(pppd_launch[0], pppd_launch, grab_env());
- log_message("execve of %s failed: %s", pppd_launch[0], strerror(errno));
- exit(-1);
- }
- close(fd);
- while (retries > 0 && kill(ppp_pid, 0) == 0) {
- FILE * f;
- if ((f = fopen("/var/run/pppd.tdb", "rb"))) {
- while (1) {
- char buf[500];
- if (!fgets(buf, sizeof(buf), f))
- break;
- if (strstr(buf, "IPLOCAL="))
- status = RETURN_OK;
- }
- fclose(f);
- if (status == RETURN_OK) {
- log_message("PPP: connected!");
- break;
- }
- }
- retries--;
- log_message("PPP: <sleep>");
- sleep(2);
- }
-
- if (status != RETURN_OK) {
- log_message("PPP: could not connect");
- kill(ppp_pid, SIGTERM);
- sleep(1);
- kill(ppp_pid, SIGKILL);
- sleep(1);
- }
- return status;
-}
-
-
-enum return_type perform_adsl(struct interface_info * intf)
-{
- struct in_addr addr;
- char * questions[] = { "Username", "Password", NULL };
- char * questions_auto[] = { "adsluser", "adslpass", NULL };
- static char ** answers = NULL;
- enum return_type results;
-
- inet_aton("10.0.0.10", &addr);
- memcpy(&intf->ip, &addr, sizeof(addr));
-
- inet_aton("255.255.255.0", &addr);
- memcpy(&intf->netmask, &addr, sizeof(addr));
-
- *((uint32_t *) &intf->broadcast) = (*((uint32_t *) &intf->ip) &
- *((uint32_t *) &intf->netmask)) | ~(*((uint32_t *) &intf->netmask));
-
- intf->is_ptp = 0;
-
- if (configure_net_device(intf)) {
- stg1_error_message("Could not configure..");
- return RETURN_ERROR;
- }
-
- results = ask_from_entries_auto("Please enter the username and password for your ADSL account.\n"
- "(Warning! only PPPoE protocol is supported)",
- questions, &answers, 40, questions_auto, NULL);
- if (results != RETURN_OK)
- return results;
-
- intf->boot_proto = BOOTPROTO_ADSL_PPPOE;
-
- wait_message("Waiting for ADSL connection to show up...");
- my_insmod("ppp_generic", ANY_DRIVER_TYPE, NULL);
- my_insmod("ppp_async", ANY_DRIVER_TYPE, NULL);
- my_insmod("ppp", ANY_DRIVER_TYPE, NULL);
- results = adsl_connect(intf->device, answers[0], answers[1]);
- remove_wait_message();
-
- if (results != RETURN_OK) {
- wait_message("Retrying the ADSL connection...");
- results = adsl_connect(intf->device, answers[0], answers[1]);
- remove_wait_message();
- } else {
- intf->user = strdup(answers[0]);
- intf->pass = strdup(answers[1]);
- }
-
- if (results != RETURN_OK) {
- stg1_error_message("I could not connect to the ADSL network.");
- return perform_adsl(intf);
- }
-
- sleep(1);
- res_init(); /* reinit the resolver, pppd modified /etc/resolv.conf */
-
- return RETURN_OK;
-}
diff --git a/mdk-stage1/adsl.h b/mdk-stage1/adsl.h
deleted file mode 100644
index 9d32cc631..000000000
--- a/mdk-stage1/adsl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * View the homepage: http://us.mandrakesoft.com/~gc/html/stage1.html
- *
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from GRUB -- GRand Unified Bootloader
- * Copyright (C) 2000 Free Software Foundation, Inc.
- *
- * Itself based on etherboot-4.6.4 by Martin Renters.
- *
- */
-
-#ifndef _ADSL_H_
-#define _ADSL_H_
-
-#include "stage1.h"
-#include "network.h"
-
-enum return_type perform_adsl(struct interface_info * intf);
-
-#endif
diff --git a/mdk-stage1/automatic.c b/mdk-stage1/automatic.c
deleted file mode 100644
index 1c6e021a0..000000000
--- a/mdk-stage1/automatic.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * This is supposed to replace the redhat "kickstart", by name but
- * also by design (less code pollution).
- *
- */
-
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include "tools.h"
-#include "stage1.h"
-#include "frontend.h"
-#include "log.h"
-
-#include "automatic.h"
-
-
-static struct param_elem * automatic_params;
-static char * value_not_bound = "";
-
-void grab_automatic_params(char * line)
-{
- int i, p;
- struct param_elem tmp_params[50];
-
- i = 0; p = 0;
- while (line[i] != '\0') {
- char *name, *value;
- int k;
- int j = i;
- while (line[i] != ':' && line[i] != '\0')
- i++;
- name = memdup(&line[j], i-j + 1);
- name[i-j] = 0;
-
- k = i+1;
- i++;
- while (line[i] != ',' && line[i] != '\0')
- i++;
- value = memdup(&line[k], i-k + 1);
- value[i-k] = 0;
-
- tmp_params[p].name = name;
- tmp_params[p].value = value;
- p++;
- if (line[i] == '\0')
- break;
- i++;
- }
-
- tmp_params[p++].name = NULL;
- automatic_params = memdup(tmp_params, sizeof(struct param_elem) * p);
-
- log_message("AUTOMATIC MODE: got %d params", p-1);
-}
-
-
-char * get_auto_value(char * auto_param)
-{
- struct param_elem * ptr = automatic_params;
-
- struct param_elem short_aliases[] =
- { { "method", "met" }, { "network", "netw" }, { "interface", "int" }, { "gateway", "gat" },
- { "netmask", "netm" }, { "adsluser", "adslu" }, { "adslpass", "adslp" }, { "hostname", "hos" },
- { "domain", "dom" }, { "server", "ser" }, { "directory", "dir" }, { "user", "use" },
- { "pass", "pas" }, { "disk", "dis" }, { "partition", "par" }, { NULL, NULL } };
- struct param_elem * ptr_alias = short_aliases;
- while (ptr_alias->name) {
- if (streq(auto_param, ptr_alias->name))
- break;
- ptr_alias++;
- }
-
- while (ptr->name) {
- if (streq(ptr->name, auto_param)
- || (ptr_alias->name && streq(ptr_alias->value, ptr->name)))
- return ptr->value;
- ptr++;
- }
-
- return value_not_bound;
-}
-
-
-enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, char * auto_param, char ** elems_auto)
-{
- if (!IS_AUTOMATIC)
- return ask_from_list(msg, elems, choice);
- else {
- char ** sav_elems = elems;
- char * tmp = get_auto_value(auto_param);
- while (elems && *elems) {
- if (!strcmp(tmp, *elems_auto)) {
- *choice = *elems;
- log_message("AUTOMATIC: parameter %s for %s means returning %s", tmp, auto_param, *elems);
- return RETURN_OK;
- }
- elems++;
- elems_auto++;
- }
- unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
- return ask_from_list(msg, sav_elems, choice);
- }
-}
-
-enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** elems_comments, char ** choice, char * auto_param, char ** elems_auto)
-{
- if (!IS_AUTOMATIC)
- return ask_from_list_comments(msg, elems, elems_comments, choice);
- else {
- char ** sav_elems = elems;
- char * tmp = get_auto_value(auto_param);
- while (elems && *elems) {
- if (!strcmp(tmp, *elems_auto)) {
- *choice = *elems;
- log_message("AUTOMATIC: parameter %s for %s means returning %s", tmp, auto_param, *elems);
- return RETURN_OK;
- }
- elems++;
- elems_auto++;
- }
- unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
- return ask_from_list_comments(msg, sav_elems, elems_comments, choice);
- }
-}
-
-
-enum return_type ask_from_entries_auto(char *msg, char ** questions, char *** answers, int entry_size, char ** questions_auto, void (*callback_func)(char ** strings))
-{
- if (!IS_AUTOMATIC)
- return ask_from_entries(msg, questions, answers, entry_size, callback_func);
- else {
- char * tmp_answers[50];
- int i = 0;
- while (questions && *questions) {
- tmp_answers[i] = get_auto_value(*questions_auto);
- log_message("AUTOMATIC: question %s answers %s because of param %s", *questions, tmp_answers[i], *questions_auto);
- i++;
- questions++;
- questions_auto++;
-
- }
- *answers = memdup(tmp_answers, sizeof(char *) * i);
- return RETURN_OK;
- }
-}
diff --git a/mdk-stage1/automatic.h b/mdk-stage1/automatic.h
deleted file mode 100644
index c2ac0a73d..000000000
--- a/mdk-stage1/automatic.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * This is supposed to replace the redhat "kickstart", by name but
- * also by design (no code pollution).
- *
- */
-
-#ifndef _AUTOMATIC_H_
-#define _AUTOMATIC_H_
-
-#include "stage1.h"
-
-void grab_automatic_params(char * line);
-
-enum return_type ask_from_list_auto(char *msg, char ** elems, char ** choice, char * auto_param, char ** elems_auto);
-enum return_type ask_from_list_comments_auto(char *msg, char ** elems, char ** elems_comments, char ** choice, char * auto_param, char ** elems_auto);
-enum return_type ask_from_entries_auto(char *msg, char ** questions, char *** answers, int entry_size, char ** questions_auto, void (*callback_func)(char ** strings));
-
-#endif
diff --git a/mdk-stage1/bzlib/Makefile b/mdk-stage1/bzlib/Makefile
deleted file mode 100644
index 03a2c254b..000000000
--- a/mdk-stage1/bzlib/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
- #******************************************************************************
- #
- # Guillaume Cottenceau (gc@mandrakesoft.com)
- #
- # Copyright 2000 MandrakeSoft
- #
- # This software may be freely redistributed under the terms of the GNU
- # public license.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- #
- #*****************************************************************************
-
-top_dir = ..
-
-include $(top_dir)/Makefile.common
-
-
-LIBNAME = libbzlib
-
-OBJS = blocksort.o bzlib.o compress.o crctable.o decompress.o huffman.o randtable.o
-
-DEFS =
-
-INCS =
-
-
-TARGETS = $(LIBNAME).a
-
-ifeq (DIETLIBC, $(L))
-TARGETS += $(LIBNAME)-DIET.a
-endif
-
-all: $(TARGETS)
-
-clean:
- rm -f *.o *.a
-
-OBJS-DIET = $(subst .o,-DIET.o,$(OBJS))
-
-$(LIBNAME).a: $(OBJS)
- ar -cru $@ $^
- ranlib $@
-
-$(LIBNAME)-DIET.a: $(OBJS-DIET)
- ar -cru $@ $^
- ranlib $@
-
-$(OBJS): %.o: %.c
- $(CC) $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $< -o $@
-
-$(OBJS-DIET): %-DIET.o: %.c
- $(CC) $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/bzlib/blocksort.c b/mdk-stage1/bzlib/blocksort.c
deleted file mode 100644
index c1b78c483..000000000
--- a/mdk-stage1/bzlib/blocksort.c
+++ /dev/null
@@ -1,1138 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Block sorting machinery ---*/
-/*--- blocksort.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
-
- To get some idea how the block sorting algorithms in this file
- work, read my paper
- On the Performance of BWT Sorting Algorithms
- in Proceedings of the IEEE Data Compression Conference 2000,
- Snowbird, Utah, USA, 27-30 March 2000. The main sort in this
- file implements the algorithm called cache in the paper.
---*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "bzlib_private.h"
-
-/*---------------------------------------------*/
-/*--- Fallback O(N log(N)^2) sorting ---*/
-/*--- algorithm, for repetitive blocks ---*/
-/*---------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-__inline__
-void fallbackSimpleSort ( UInt32* fmap,
- UInt32* eclass,
- Int32 lo,
- Int32 hi )
-{
- Int32 i, j, tmp;
- UInt32 ec_tmp;
-
- if (lo == hi) return;
-
- if (hi - lo > 3) {
- for ( i = hi-4; i >= lo; i-- ) {
- tmp = fmap[i];
- ec_tmp = eclass[tmp];
- for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 )
- fmap[j-4] = fmap[j];
- fmap[j-4] = tmp;
- }
- }
-
- for ( i = hi-1; i >= lo; i-- ) {
- tmp = fmap[i];
- ec_tmp = eclass[tmp];
- for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ )
- fmap[j-1] = fmap[j];
- fmap[j-1] = tmp;
- }
-}
-
-
-/*---------------------------------------------*/
-#define fswap(zz1, zz2) \
- { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
-
-#define fvswap(zzp1, zzp2, zzn) \
-{ \
- Int32 yyp1 = (zzp1); \
- Int32 yyp2 = (zzp2); \
- Int32 yyn = (zzn); \
- while (yyn > 0) { \
- fswap(fmap[yyp1], fmap[yyp2]); \
- yyp1++; yyp2++; yyn--; \
- } \
-}
-
-
-#define fmin(a,b) ((a) < (b)) ? (a) : (b)
-
-#define fpush(lz,hz) { stackLo[sp] = lz; \
- stackHi[sp] = hz; \
- sp++; }
-
-#define fpop(lz,hz) { sp--; \
- lz = stackLo[sp]; \
- hz = stackHi[sp]; }
-
-#define FALLBACK_QSORT_SMALL_THRESH 10
-#define FALLBACK_QSORT_STACK_SIZE 100
-
-
-static
-void fallbackQSort3 ( UInt32* fmap,
- UInt32* eclass,
- Int32 loSt,
- Int32 hiSt )
-{
- Int32 unLo, unHi, ltLo, gtHi, n, m;
- Int32 sp, lo, hi;
- UInt32 med, r, r3;
- Int32 stackLo[FALLBACK_QSORT_STACK_SIZE];
- Int32 stackHi[FALLBACK_QSORT_STACK_SIZE];
-
- r = 0;
-
- sp = 0;
- fpush ( loSt, hiSt );
-
- while (sp > 0) {
-
- AssertH ( sp < FALLBACK_QSORT_STACK_SIZE, 1004 );
-
- fpop ( lo, hi );
- if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
- fallbackSimpleSort ( fmap, eclass, lo, hi );
- continue;
- }
-
- /* Random partitioning. Median of 3 sometimes fails to
- avoid bad cases. Median of 9 seems to help but
- looks rather expensive. This too seems to work but
- is cheaper. Guidance for the magic constants
- 7621 and 32768 is taken from Sedgewick's algorithms
- book, chapter 35.
- */
- r = ((r * 7621) + 1) % 32768;
- r3 = r % 3;
- if (r3 == 0) med = eclass[fmap[lo]]; else
- if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else
- med = eclass[fmap[hi]];
-
- unLo = ltLo = lo;
- unHi = gtHi = hi;
-
- while (1) {
- while (1) {
- if (unLo > unHi) break;
- n = (Int32)eclass[fmap[unLo]] - (Int32)med;
- if (n == 0) {
- fswap(fmap[unLo], fmap[ltLo]);
- ltLo++; unLo++;
- continue;
- };
- if (n > 0) break;
- unLo++;
- }
- while (1) {
- if (unLo > unHi) break;
- n = (Int32)eclass[fmap[unHi]] - (Int32)med;
- if (n == 0) {
- fswap(fmap[unHi], fmap[gtHi]);
- gtHi--; unHi--;
- continue;
- };
- if (n < 0) break;
- unHi--;
- }
- if (unLo > unHi) break;
- fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--;
- }
-
- AssertD ( unHi == unLo-1, "fallbackQSort3(2)" );
-
- if (gtHi < ltLo) continue;
-
- n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n);
- m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m);
-
- n = lo + unLo - ltLo - 1;
- m = hi - (gtHi - unHi) + 1;
-
- if (n - lo > hi - m) {
- fpush ( lo, n );
- fpush ( m, hi );
- } else {
- fpush ( m, hi );
- fpush ( lo, n );
- }
- }
-}
-
-#undef fmin
-#undef fpush
-#undef fpop
-#undef fswap
-#undef fvswap
-#undef FALLBACK_QSORT_SMALL_THRESH
-#undef FALLBACK_QSORT_STACK_SIZE
-
-
-/*---------------------------------------------*/
-/* Pre:
- nblock > 0
- eclass exists for [0 .. nblock-1]
- ((UChar*)eclass) [0 .. nblock-1] holds block
- ptr exists for [0 .. nblock-1]
-
- Post:
- ((UChar*)eclass) [0 .. nblock-1] holds block
- All other areas of eclass destroyed
- fmap [0 .. nblock-1] holds sorted order
- bhtab [ 0 .. 2+(nblock/32) ] destroyed
-*/
-
-#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31))
-#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31))
-#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31)))
-#define WORD_BH(zz) bhtab[(zz) >> 5]
-#define UNALIGNED_BH(zz) ((zz) & 0x01f)
-
-static
-void fallbackSort ( UInt32* fmap,
- UInt32* eclass,
- UInt32* bhtab,
- Int32 nblock,
- Int32 verb )
-{
- Int32 ftab[257];
- Int32 ftabCopy[256];
- Int32 H, i, j, k, l, r, cc, cc1;
- Int32 nNotDone;
- Int32 nBhtab;
- UChar* eclass8 = (UChar*)eclass;
-
- /*--
- Initial 1-char radix sort to generate
- initial fmap and initial BH bits.
- --*/
- if (verb >= 4)
- VPrintf0 ( " bucket sorting ...\n" );
- for (i = 0; i < 257; i++) ftab[i] = 0;
- for (i = 0; i < nblock; i++) ftab[eclass8[i]]++;
- for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i];
- for (i = 1; i < 257; i++) ftab[i] += ftab[i-1];
-
- for (i = 0; i < nblock; i++) {
- j = eclass8[i];
- k = ftab[j] - 1;
- ftab[j] = k;
- fmap[k] = i;
- }
-
- nBhtab = 2 + (nblock / 32);
- for (i = 0; i < nBhtab; i++) bhtab[i] = 0;
- for (i = 0; i < 256; i++) SET_BH(ftab[i]);
-
- /*--
- Inductively refine the buckets. Kind-of an
- "exponential radix sort" (!), inspired by the
- Manber-Myers suffix array construction algorithm.
- --*/
-
- /*-- set sentinel bits for block-end detection --*/
- for (i = 0; i < 32; i++) {
- SET_BH(nblock + 2*i);
- CLEAR_BH(nblock + 2*i + 1);
- }
-
- /*-- the log(N) loop --*/
- H = 1;
- while (1) {
-
- if (verb >= 4)
- VPrintf1 ( " depth %6d has ", H );
-
- j = 0;
- for (i = 0; i < nblock; i++) {
- if (ISSET_BH(i)) j = i;
- k = fmap[i] - H; if (k < 0) k += nblock;
- eclass[k] = j;
- }
-
- nNotDone = 0;
- r = -1;
- while (1) {
-
- /*-- find the next non-singleton bucket --*/
- k = r + 1;
- while (ISSET_BH(k) && UNALIGNED_BH(k)) k++;
- if (ISSET_BH(k)) {
- while (WORD_BH(k) == 0xffffffff) k += 32;
- while (ISSET_BH(k)) k++;
- }
- l = k - 1;
- if (l >= nblock) break;
- while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++;
- if (!ISSET_BH(k)) {
- while (WORD_BH(k) == 0x00000000) k += 32;
- while (!ISSET_BH(k)) k++;
- }
- r = k - 1;
- if (r >= nblock) break;
-
- /*-- now [l, r] bracket current bucket --*/
- if (r > l) {
- nNotDone += (r - l + 1);
- fallbackQSort3 ( fmap, eclass, l, r );
-
- /*-- scan bucket and generate header bits-- */
- cc = -1;
- for (i = l; i <= r; i++) {
- cc1 = eclass[fmap[i]];
- if (cc != cc1) { SET_BH(i); cc = cc1; };
- }
- }
- }
-
- if (verb >= 4)
- VPrintf1 ( "%6d unresolved strings\n", nNotDone );
-
- H *= 2;
- if (H > nblock || nNotDone == 0) break;
- }
-
- /*--
- Reconstruct the original block in
- eclass8 [0 .. nblock-1], since the
- previous phase destroyed it.
- --*/
- if (verb >= 4)
- VPrintf0 ( " reconstructing block ...\n" );
- j = 0;
- for (i = 0; i < nblock; i++) {
- while (ftabCopy[j] == 0) j++;
- ftabCopy[j]--;
- eclass8[fmap[i]] = (UChar)j;
- }
- AssertH ( j < 256, 1005 );
-}
-
-#undef SET_BH
-#undef CLEAR_BH
-#undef ISSET_BH
-#undef WORD_BH
-#undef UNALIGNED_BH
-
-
-/*---------------------------------------------*/
-/*--- The main, O(N^2 log(N)) sorting ---*/
-/*--- algorithm. Faster for "normal" ---*/
-/*--- non-repetitive blocks. ---*/
-/*---------------------------------------------*/
-
-/*---------------------------------------------*/
-static
-__inline__
-Bool mainGtU ( UInt32 i1,
- UInt32 i2,
- UChar* block,
- UInt16* quadrant,
- UInt32 nblock,
- Int32* budget )
-{
- Int32 k;
- UChar c1, c2;
- UInt16 s1, s2;
-
- AssertD ( i1 != i2, "mainGtU" );
- /* 1 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 2 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 3 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 4 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 5 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 6 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 7 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 8 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 9 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 10 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 11 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
- /* 12 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- i1++; i2++;
-
- k = nblock + 8;
-
- do {
- /* 1 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 2 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 3 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 4 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 5 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 6 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 7 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
- /* 8 */
- c1 = block[i1]; c2 = block[i2];
- if (c1 != c2) return (c1 > c2);
- s1 = quadrant[i1]; s2 = quadrant[i2];
- if (s1 != s2) return (s1 > s2);
- i1++; i2++;
-
- if (i1 >= nblock) i1 -= nblock;
- if (i2 >= nblock) i2 -= nblock;
-
- k -= 8;
- (*budget)--;
- }
- while (k >= 0);
-
- return False;
-}
-
-
-/*---------------------------------------------*/
-/*--
- Knuth's increments seem to work better
- than Incerpi-Sedgewick here. Possibly
- because the number of elems to sort is
- usually small, typically <= 20.
---*/
-static
-Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280,
- 9841, 29524, 88573, 265720,
- 797161, 2391484 };
-
-static
-void mainSimpleSort ( UInt32* ptr,
- UChar* block,
- UInt16* quadrant,
- Int32 nblock,
- Int32 lo,
- Int32 hi,
- Int32 d,
- Int32* budget )
-{
- Int32 i, j, h, bigN, hp;
- UInt32 v;
-
- bigN = hi - lo + 1;
- if (bigN < 2) return;
-
- hp = 0;
- while (incs[hp] < bigN) hp++;
- hp--;
-
- for (; hp >= 0; hp--) {
- h = incs[hp];
-
- i = lo + h;
- while (True) {
-
- /*-- copy 1 --*/
- if (i > hi) break;
- v = ptr[i];
- j = i;
- while ( mainGtU (
- ptr[j-h]+d, v+d, block, quadrant, nblock, budget
- ) ) {
- ptr[j] = ptr[j-h];
- j = j - h;
- if (j <= (lo + h - 1)) break;
- }
- ptr[j] = v;
- i++;
-
- /*-- copy 2 --*/
- if (i > hi) break;
- v = ptr[i];
- j = i;
- while ( mainGtU (
- ptr[j-h]+d, v+d, block, quadrant, nblock, budget
- ) ) {
- ptr[j] = ptr[j-h];
- j = j - h;
- if (j <= (lo + h - 1)) break;
- }
- ptr[j] = v;
- i++;
-
- /*-- copy 3 --*/
- if (i > hi) break;
- v = ptr[i];
- j = i;
- while ( mainGtU (
- ptr[j-h]+d, v+d, block, quadrant, nblock, budget
- ) ) {
- ptr[j] = ptr[j-h];
- j = j - h;
- if (j <= (lo + h - 1)) break;
- }
- ptr[j] = v;
- i++;
-
- if (*budget < 0) return;
- }
- }
-}
-
-
-/*---------------------------------------------*/
-/*--
- The following is an implementation of
- an elegant 3-way quicksort for strings,
- described in a paper "Fast Algorithms for
- Sorting and Searching Strings", by Robert
- Sedgewick and Jon L. Bentley.
---*/
-
-#define mswap(zz1, zz2) \
- { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
-
-#define mvswap(zzp1, zzp2, zzn) \
-{ \
- Int32 yyp1 = (zzp1); \
- Int32 yyp2 = (zzp2); \
- Int32 yyn = (zzn); \
- while (yyn > 0) { \
- mswap(ptr[yyp1], ptr[yyp2]); \
- yyp1++; yyp2++; yyn--; \
- } \
-}
-
-static
-__inline__
-UChar mmed3 ( UChar a, UChar b, UChar c )
-{
- UChar t;
- if (a > b) { t = a; a = b; b = t; };
- if (b > c) {
- b = c;
- if (a > b) b = a;
- }
- return b;
-}
-
-#define mmin(a,b) ((a) < (b)) ? (a) : (b)
-
-#define mpush(lz,hz,dz) { stackLo[sp] = lz; \
- stackHi[sp] = hz; \
- stackD [sp] = dz; \
- sp++; }
-
-#define mpop(lz,hz,dz) { sp--; \
- lz = stackLo[sp]; \
- hz = stackHi[sp]; \
- dz = stackD [sp]; }
-
-
-#define mnextsize(az) (nextHi[az]-nextLo[az])
-
-#define mnextswap(az,bz) \
- { Int32 tz; \
- tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \
- tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \
- tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; }
-
-
-#define MAIN_QSORT_SMALL_THRESH 20
-#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT)
-#define MAIN_QSORT_STACK_SIZE 100
-
-static
-void mainQSort3 ( UInt32* ptr,
- UChar* block,
- UInt16* quadrant,
- Int32 nblock,
- Int32 loSt,
- Int32 hiSt,
- Int32 dSt,
- Int32* budget )
-{
- Int32 unLo, unHi, ltLo, gtHi, n, m, med;
- Int32 sp, lo, hi, d;
-
- Int32 stackLo[MAIN_QSORT_STACK_SIZE];
- Int32 stackHi[MAIN_QSORT_STACK_SIZE];
- Int32 stackD [MAIN_QSORT_STACK_SIZE];
-
- Int32 nextLo[3];
- Int32 nextHi[3];
- Int32 nextD [3];
-
- sp = 0;
- mpush ( loSt, hiSt, dSt );
-
- while (sp > 0) {
-
- AssertH ( sp < MAIN_QSORT_STACK_SIZE, 1001 );
-
- mpop ( lo, hi, d );
- if (hi - lo < MAIN_QSORT_SMALL_THRESH ||
- d > MAIN_QSORT_DEPTH_THRESH) {
- mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget );
- if (*budget < 0) return;
- continue;
- }
-
- med = (Int32)
- mmed3 ( block[ptr[ lo ]+d],
- block[ptr[ hi ]+d],
- block[ptr[ (lo+hi)>>1 ]+d] );
-
- unLo = ltLo = lo;
- unHi = gtHi = hi;
-
- while (True) {
- while (True) {
- if (unLo > unHi) break;
- n = ((Int32)block[ptr[unLo]+d]) - med;
- if (n == 0) {
- mswap(ptr[unLo], ptr[ltLo]);
- ltLo++; unLo++; continue;
- };
- if (n > 0) break;
- unLo++;
- }
- while (True) {
- if (unLo > unHi) break;
- n = ((Int32)block[ptr[unHi]+d]) - med;
- if (n == 0) {
- mswap(ptr[unHi], ptr[gtHi]);
- gtHi--; unHi--; continue;
- };
- if (n < 0) break;
- unHi--;
- }
- if (unLo > unHi) break;
- mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--;
- }
-
- AssertD ( unHi == unLo-1, "mainQSort3(2)" );
-
- if (gtHi < ltLo) {
- mpush(lo, hi, d+1 );
- continue;
- }
-
- n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n);
- m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m);
-
- n = lo + unLo - ltLo - 1;
- m = hi - (gtHi - unHi) + 1;
-
- nextLo[0] = lo; nextHi[0] = n; nextD[0] = d;
- nextLo[1] = m; nextHi[1] = hi; nextD[1] = d;
- nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1;
-
- if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
- if (mnextsize(1) < mnextsize(2)) mnextswap(1,2);
- if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
-
- AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" );
- AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" );
-
- mpush (nextLo[0], nextHi[0], nextD[0]);
- mpush (nextLo[1], nextHi[1], nextD[1]);
- mpush (nextLo[2], nextHi[2], nextD[2]);
- }
-}
-
-#undef mswap
-#undef mvswap
-#undef mpush
-#undef mpop
-#undef mmin
-#undef mnextsize
-#undef mnextswap
-#undef MAIN_QSORT_SMALL_THRESH
-#undef MAIN_QSORT_DEPTH_THRESH
-#undef MAIN_QSORT_STACK_SIZE
-
-
-/*---------------------------------------------*/
-/* Pre:
- nblock > N_OVERSHOOT
- block32 exists for [0 .. nblock-1 +N_OVERSHOOT]
- ((UChar*)block32) [0 .. nblock-1] holds block
- ptr exists for [0 .. nblock-1]
-
- Post:
- ((UChar*)block32) [0 .. nblock-1] holds block
- All other areas of block32 destroyed
- ftab [0 .. 65536 ] destroyed
- ptr [0 .. nblock-1] holds sorted order
- if (*budget < 0), sorting was abandoned
-*/
-
-#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8])
-#define SETMASK (1 << 21)
-#define CLEARMASK (~(SETMASK))
-
-static
-void mainSort ( UInt32* ptr,
- UChar* block,
- UInt16* quadrant,
- UInt32* ftab,
- Int32 nblock,
- Int32 verb,
- Int32* budget )
-{
- Int32 i, j, k, ss, sb;
- Int32 runningOrder[256];
- Bool bigDone[256];
- Int32 copyStart[256];
- Int32 copyEnd [256];
- UChar c1;
- Int32 numQSorted;
- UInt16 s;
- if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" );
-
- /*-- set up the 2-byte frequency table --*/
- for (i = 65536; i >= 0; i--) ftab[i] = 0;
-
- j = block[0] << 8;
- i = nblock-1;
- for (; i >= 3; i -= 4) {
- quadrant[i] = 0;
- j = (j >> 8) | ( ((UInt16)block[i]) << 8);
- ftab[j]++;
- quadrant[i-1] = 0;
- j = (j >> 8) | ( ((UInt16)block[i-1]) << 8);
- ftab[j]++;
- quadrant[i-2] = 0;
- j = (j >> 8) | ( ((UInt16)block[i-2]) << 8);
- ftab[j]++;
- quadrant[i-3] = 0;
- j = (j >> 8) | ( ((UInt16)block[i-3]) << 8);
- ftab[j]++;
- }
- for (; i >= 0; i--) {
- quadrant[i] = 0;
- j = (j >> 8) | ( ((UInt16)block[i]) << 8);
- ftab[j]++;
- }
-
- /*-- (emphasises close relationship of block & quadrant) --*/
- for (i = 0; i < BZ_N_OVERSHOOT; i++) {
- block [nblock+i] = block[i];
- quadrant[nblock+i] = 0;
- }
-
- if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" );
-
- /*-- Complete the initial radix sort --*/
- for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1];
-
- s = block[0] << 8;
- i = nblock-1;
- for (; i >= 3; i -= 4) {
- s = (s >> 8) | (block[i] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i;
- s = (s >> 8) | (block[i-1] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i-1;
- s = (s >> 8) | (block[i-2] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i-2;
- s = (s >> 8) | (block[i-3] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i-3;
- }
- for (; i >= 0; i--) {
- s = (s >> 8) | (block[i] << 8);
- j = ftab[s] -1;
- ftab[s] = j;
- ptr[j] = i;
- }
-
- /*--
- Now ftab contains the first loc of every small bucket.
- Calculate the running order, from smallest to largest
- big bucket.
- --*/
- for (i = 0; i <= 255; i++) {
- bigDone [i] = False;
- runningOrder[i] = i;
- }
-
- {
- Int32 vv;
- Int32 h = 1;
- do h = 3 * h + 1; while (h <= 256);
- do {
- h = h / 3;
- for (i = h; i <= 255; i++) {
- vv = runningOrder[i];
- j = i;
- while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) {
- runningOrder[j] = runningOrder[j-h];
- j = j - h;
- if (j <= (h - 1)) goto zero;
- }
- zero:
- runningOrder[j] = vv;
- }
- } while (h != 1);
- }
-
- /*--
- The main sorting loop.
- --*/
-
- numQSorted = 0;
-
- for (i = 0; i <= 255; i++) {
-
- /*--
- Process big buckets, starting with the least full.
- Basically this is a 3-step process in which we call
- mainQSort3 to sort the small buckets [ss, j], but
- also make a big effort to avoid the calls if we can.
- --*/
- ss = runningOrder[i];
-
- /*--
- Step 1:
- Complete the big bucket [ss] by quicksorting
- any unsorted small buckets [ss, j], for j != ss.
- Hopefully previous pointer-scanning phases have already
- completed many of the small buckets [ss, j], so
- we don't have to sort them at all.
- --*/
- for (j = 0; j <= 255; j++) {
- if (j != ss) {
- sb = (ss << 8) + j;
- if ( ! (ftab[sb] & SETMASK) ) {
- Int32 lo = ftab[sb] & CLEARMASK;
- Int32 hi = (ftab[sb+1] & CLEARMASK) - 1;
- if (hi > lo) {
- if (verb >= 4)
- VPrintf4 ( " qsort [0x%x, 0x%x] "
- "done %d this %d\n",
- ss, j, numQSorted, hi - lo + 1 );
- mainQSort3 (
- ptr, block, quadrant, nblock,
- lo, hi, BZ_N_RADIX, budget
- );
- numQSorted += (hi - lo + 1);
- if (*budget < 0) return;
- }
- }
- ftab[sb] |= SETMASK;
- }
- }
-
- AssertH ( !bigDone[ss], 1006 );
-
- /*--
- Step 2:
- Now scan this big bucket [ss] so as to synthesise the
- sorted order for small buckets [t, ss] for all t,
- including, magically, the bucket [ss,ss] too.
- This will avoid doing Real Work in subsequent Step 1's.
- --*/
- {
- for (j = 0; j <= 255; j++) {
- copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK;
- copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1;
- }
- for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) {
- k = ptr[j]-1; if (k < 0) k += nblock;
- c1 = block[k];
- if (!bigDone[c1])
- ptr[ copyStart[c1]++ ] = k;
- }
- for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) {
- k = ptr[j]-1; if (k < 0) k += nblock;
- c1 = block[k];
- if (!bigDone[c1])
- ptr[ copyEnd[c1]-- ] = k;
- }
- }
-
- AssertH ( copyStart[ss]-1 == copyEnd[ss], 1007 );
-
- for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK;
-
- /*--
- Step 3:
- The [ss] big bucket is now done. Record this fact,
- and update the quadrant descriptors. Remember to
- update quadrants in the overshoot area too, if
- necessary. The "if (i < 255)" test merely skips
- this updating for the last bucket processed, since
- updating for the last bucket is pointless.
-
- The quadrant array provides a way to incrementally
- cache sort orderings, as they appear, so as to
- make subsequent comparisons in fullGtU() complete
- faster. For repetitive blocks this makes a big
- difference (but not big enough to be able to avoid
- the fallback sorting mechanism, exponential radix sort).
-
- The precise meaning is: at all times:
-
- for 0 <= i < nblock and 0 <= j <= nblock
-
- if block[i] != block[j],
-
- then the relative values of quadrant[i] and
- quadrant[j] are meaningless.
-
- else {
- if quadrant[i] < quadrant[j]
- then the string starting at i lexicographically
- precedes the string starting at j
-
- else if quadrant[i] > quadrant[j]
- then the string starting at j lexicographically
- precedes the string starting at i
-
- else
- the relative ordering of the strings starting
- at i and j has not yet been determined.
- }
- --*/
- bigDone[ss] = True;
-
- if (i < 255) {
- Int32 bbStart = ftab[ss << 8] & CLEARMASK;
- Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart;
- Int32 shifts = 0;
-
- while ((bbSize >> shifts) > 65534) shifts++;
-
- for (j = bbSize-1; j >= 0; j--) {
- Int32 a2update = ptr[bbStart + j];
- UInt16 qVal = (UInt16)(j >> shifts);
- quadrant[a2update] = qVal;
- if (a2update < BZ_N_OVERSHOOT)
- quadrant[a2update + nblock] = qVal;
- }
- AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 );
- }
-
- }
-
- if (verb >= 4)
- VPrintf3 ( " %d pointers, %d sorted, %d scanned\n",
- nblock, numQSorted, nblock - numQSorted );
-}
-
-#undef BIGFREQ
-#undef SETMASK
-#undef CLEARMASK
-
-
-/*---------------------------------------------*/
-/* Pre:
- nblock > 0
- arr2 exists for [0 .. nblock-1 +N_OVERSHOOT]
- ((UChar*)arr2) [0 .. nblock-1] holds block
- arr1 exists for [0 .. nblock-1]
-
- Post:
- ((UChar*)arr2) [0 .. nblock-1] holds block
- All other areas of block destroyed
- ftab [ 0 .. 65536 ] destroyed
- arr1 [0 .. nblock-1] holds sorted order
-*/
-void BZ2_blockSort ( EState* s )
-{
- UInt32* ptr = s->ptr;
- UChar* block = s->block;
- UInt32* ftab = s->ftab;
- Int32 nblock = s->nblock;
- Int32 verb = s->verbosity;
- Int32 wfact = s->workFactor;
- UInt16* quadrant;
- Int32 budget;
- Int32 budgetInit;
- Int32 i;
-
- if (nblock < 10000) {
- fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
- } else {
- /* Calculate the location for quadrant, remembering to get
- the alignment right. Assumes that &(block[0]) is at least
- 2-byte aligned -- this should be ok since block is really
- the first section of arr2.
- */
- i = nblock+BZ_N_OVERSHOOT;
- if (i & 1) i++;
- quadrant = (UInt16*)(&(block[i]));
-
- /* (wfact-1) / 3 puts the default-factor-30
- transition point at very roughly the same place as
- with v0.1 and v0.9.0.
- Not that it particularly matters any more, since the
- resulting compressed stream is now the same regardless
- of whether or not we use the main sort or fallback sort.
- */
- if (wfact < 1 ) wfact = 1;
- if (wfact > 100) wfact = 100;
- budgetInit = nblock * ((wfact-1) / 3);
- budget = budgetInit;
-
- mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget );
- if (verb >= 3)
- VPrintf3 ( " %d work, %d block, ratio %5.2f\n",
- budgetInit - budget,
- nblock,
- (float)(budgetInit - budget) /
- (float)(nblock==0 ? 1 : nblock) );
- if (budget < 0) {
- if (verb >= 2)
- VPrintf0 ( " too repetitive; using fallback"
- " sorting algorithm\n" );
- fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
- }
- }
-
- s->origPtr = -1;
- for (i = 0; i < s->nblock; i++)
- if (ptr[i] == 0)
- { s->origPtr = i; break; };
-
- AssertH( s->origPtr != -1, 1003 );
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end blocksort.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/bzlib.c b/mdk-stage1/bzlib/bzlib.c
deleted file mode 100644
index b1fc85236..000000000
--- a/mdk-stage1/bzlib/bzlib.c
+++ /dev/null
@@ -1,1567 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Library top-level functions. ---*/
-/*--- bzlib.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-/*--
- CHANGES
- ~~~~~~~
- 0.9.0 -- original version.
-
- 0.9.0a/b -- no changes in this file.
-
- 0.9.0c
- * made zero-length BZ_FLUSH work correctly in bzCompress().
- * fixed bzWrite/bzRead to ignore zero-length requests.
- * fixed bzread to correctly handle read requests after EOF.
- * wrong parameter order in call to bzDecompressInit in
- bzBuffToBuffDecompress. Fixed.
---*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-/*--- Compression stuff ---*/
-/*---------------------------------------------------*/
-
-
-/*---------------------------------------------------*/
-#ifndef BZ_NO_STDIO
-void BZ2_bz__AssertH__fail ( int errcode )
-{
- fprintf(stderr,
- "\n\nbzip2/libbzip2: internal error number %d.\n"
- "This is a bug in bzip2/libbzip2, %s.\n"
- "Please report it to me at: jseward@acm.org. If this happened\n"
- "when you were using some program which uses libbzip2 as a\n"
- "component, you should also report this bug to the author(s)\n"
- "of that program. Please make an effort to report this bug;\n"
- "timely and accurate bug reports eventually lead to higher\n"
- "quality software. Thanks. Julian Seward, 21 March 2000.\n\n",
- errcode,
- BZ2_bzlibVersion()
- );
- exit(3);
-}
-#endif
-
-
-/*---------------------------------------------------*/
-static
-int bz_config_ok ( void )
-{
- if (sizeof(int) != 4) return 0;
- if (sizeof(short) != 2) return 0;
- if (sizeof(char) != 1) return 0;
- return 1;
-}
-
-
-/*---------------------------------------------------*/
-static
-void* default_bzalloc ( void* opaque __attribute__ ((unused)), Int32 items, Int32 size )
-{
- void* v = malloc ( items * size );
- return v;
-}
-
-static
-void default_bzfree ( void* opaque __attribute__ ((unused)), void* addr )
-{
- if (addr != NULL) free ( addr );
-}
-
-
-/*---------------------------------------------------*/
-static
-void prepare_new_block ( EState* s )
-{
- Int32 i;
- s->nblock = 0;
- s->numZ = 0;
- s->state_out_pos = 0;
- BZ_INITIALISE_CRC ( s->blockCRC );
- for (i = 0; i < 256; i++) s->inUse[i] = False;
- s->blockNo++;
-}
-
-
-/*---------------------------------------------------*/
-static
-void init_RL ( EState* s )
-{
- s->state_in_ch = 256;
- s->state_in_len = 0;
-}
-
-
-static
-Bool isempty_RL ( EState* s )
-{
- if (s->state_in_ch < 256 && s->state_in_len > 0)
- return False; else
- return True;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompressInit)
- ( bz_stream* strm,
- int blockSize100k,
- int verbosity,
- int workFactor )
-{
- Int32 n;
- EState* s;
-
- if (!bz_config_ok()) return BZ_CONFIG_ERROR;
-
- if (strm == NULL ||
- blockSize100k < 1 || blockSize100k > 9 ||
- workFactor < 0 || workFactor > 250)
- return BZ_PARAM_ERROR;
-
- if (workFactor == 0) workFactor = 30;
- if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
- if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
-
- s = BZALLOC( sizeof(EState) );
- if (s == NULL) return BZ_MEM_ERROR;
- s->strm = strm;
-
- s->arr1 = NULL;
- s->arr2 = NULL;
- s->ftab = NULL;
-
- n = 100000 * blockSize100k;
- s->arr1 = BZALLOC( n * sizeof(UInt32) );
- s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
- s->ftab = BZALLOC( 65537 * sizeof(UInt32) );
-
- if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
- if (s->arr1 != NULL) BZFREE(s->arr1);
- if (s->arr2 != NULL) BZFREE(s->arr2);
- if (s->ftab != NULL) BZFREE(s->ftab);
- if (s != NULL) BZFREE(s);
- return BZ_MEM_ERROR;
- }
-
- s->blockNo = 0;
- s->state = BZ_S_INPUT;
- s->mode = BZ_M_RUNNING;
- s->combinedCRC = 0;
- s->blockSize100k = blockSize100k;
- s->nblockMAX = 100000 * blockSize100k - 19;
- s->verbosity = verbosity;
- s->workFactor = workFactor;
-
- s->block = (UChar*)s->arr2;
- s->mtfv = (UInt16*)s->arr1;
- s->zbits = NULL;
- s->ptr = (UInt32*)s->arr1;
-
- strm->state = s;
- strm->total_in_lo32 = 0;
- strm->total_in_hi32 = 0;
- strm->total_out_lo32 = 0;
- strm->total_out_hi32 = 0;
- init_RL ( s );
- prepare_new_block ( s );
- return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-static
-void add_pair_to_block ( EState* s )
-{
- Int32 i;
- UChar ch = (UChar)(s->state_in_ch);
- for (i = 0; i < s->state_in_len; i++) {
- BZ_UPDATE_CRC( s->blockCRC, ch );
- }
- s->inUse[s->state_in_ch] = True;
- switch (s->state_in_len) {
- case 1:
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- break;
- case 2:
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- break;
- case 3:
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- break;
- default:
- s->inUse[s->state_in_len-4] = True;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = (UChar)ch; s->nblock++;
- s->block[s->nblock] = ((UChar)(s->state_in_len-4));
- s->nblock++;
- break;
- }
-}
-
-
-/*---------------------------------------------------*/
-static
-void flush_RL ( EState* s )
-{
- if (s->state_in_ch < 256) add_pair_to_block ( s );
- init_RL ( s );
-}
-
-
-/*---------------------------------------------------*/
-#define ADD_CHAR_TO_BLOCK(zs,zchh0) \
-{ \
- UInt32 zchh = (UInt32)(zchh0); \
- /*-- fast track the common case --*/ \
- if (zchh != zs->state_in_ch && \
- zs->state_in_len == 1) { \
- UChar ch = (UChar)(zs->state_in_ch); \
- BZ_UPDATE_CRC( zs->blockCRC, ch ); \
- zs->inUse[zs->state_in_ch] = True; \
- zs->block[zs->nblock] = (UChar)ch; \
- zs->nblock++; \
- zs->state_in_ch = zchh; \
- } \
- else \
- /*-- general, uncommon cases --*/ \
- if (zchh != zs->state_in_ch || \
- zs->state_in_len == 255) { \
- if (zs->state_in_ch < 256) \
- add_pair_to_block ( zs ); \
- zs->state_in_ch = zchh; \
- zs->state_in_len = 1; \
- } else { \
- zs->state_in_len++; \
- } \
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool copy_input_until_stop ( EState* s )
-{
- Bool progress_in = False;
-
- if (s->mode == BZ_M_RUNNING) {
-
- /*-- fast track the common case --*/
- while (True) {
- /*-- block full? --*/
- if (s->nblock >= s->nblockMAX) break;
- /*-- no input? --*/
- if (s->strm->avail_in == 0) break;
- progress_in = True;
- ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
- s->strm->next_in++;
- s->strm->avail_in--;
- s->strm->total_in_lo32++;
- if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
- }
-
- } else {
-
- /*-- general, uncommon case --*/
- while (True) {
- /*-- block full? --*/
- if (s->nblock >= s->nblockMAX) break;
- /*-- no input? --*/
- if (s->strm->avail_in == 0) break;
- /*-- flush/finish end? --*/
- if (s->avail_in_expect == 0) break;
- progress_in = True;
- ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
- s->strm->next_in++;
- s->strm->avail_in--;
- s->strm->total_in_lo32++;
- if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
- s->avail_in_expect--;
- }
- }
- return progress_in;
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool copy_output_until_stop ( EState* s )
-{
- Bool progress_out = False;
-
- while (True) {
-
- /*-- no output space? --*/
- if (s->strm->avail_out == 0) break;
-
- /*-- block done? --*/
- if (s->state_out_pos >= s->numZ) break;
-
- progress_out = True;
- *(s->strm->next_out) = s->zbits[s->state_out_pos];
- s->state_out_pos++;
- s->strm->avail_out--;
- s->strm->next_out++;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- return progress_out;
-}
-
-
-/*---------------------------------------------------*/
-static
-Bool handle_compress ( bz_stream* strm )
-{
- Bool progress_in = False;
- Bool progress_out = False;
- EState* s = strm->state;
-
- while (True) {
-
- if (s->state == BZ_S_OUTPUT) {
- progress_out |= copy_output_until_stop ( s );
- if (s->state_out_pos < s->numZ) break;
- if (s->mode == BZ_M_FINISHING &&
- s->avail_in_expect == 0 &&
- isempty_RL(s)) break;
- prepare_new_block ( s );
- s->state = BZ_S_INPUT;
- if (s->mode == BZ_M_FLUSHING &&
- s->avail_in_expect == 0 &&
- isempty_RL(s)) break;
- }
-
- if (s->state == BZ_S_INPUT) {
- progress_in |= copy_input_until_stop ( s );
- if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) {
- flush_RL ( s );
- BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) );
- s->state = BZ_S_OUTPUT;
- }
- else
- if (s->nblock >= s->nblockMAX) {
- BZ2_compressBlock ( s, False );
- s->state = BZ_S_OUTPUT;
- }
- else
- if (s->strm->avail_in == 0) {
- break;
- }
- }
-
- }
-
- return progress_in || progress_out;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
-{
- Bool progress;
- EState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- preswitch:
- switch (s->mode) {
-
- case BZ_M_IDLE:
- return BZ_SEQUENCE_ERROR;
-
- case BZ_M_RUNNING:
- if (action == BZ_RUN) {
- progress = handle_compress ( strm );
- return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
- }
- else
- if (action == BZ_FLUSH) {
- s->avail_in_expect = strm->avail_in;
- s->mode = BZ_M_FLUSHING;
- goto preswitch;
- }
- else
- if (action == BZ_FINISH) {
- s->avail_in_expect = strm->avail_in;
- s->mode = BZ_M_FINISHING;
- goto preswitch;
- }
- else
- return BZ_PARAM_ERROR;
-
- case BZ_M_FLUSHING:
- if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR;
- if (s->avail_in_expect != s->strm->avail_in)
- return BZ_SEQUENCE_ERROR;
- progress = handle_compress ( strm );
- if (s->avail_in_expect > 0 || !isempty_RL(s) ||
- s->state_out_pos < s->numZ) return BZ_FLUSH_OK;
- s->mode = BZ_M_RUNNING;
- return BZ_RUN_OK;
-
- case BZ_M_FINISHING:
- if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR;
- if (s->avail_in_expect != s->strm->avail_in)
- return BZ_SEQUENCE_ERROR;
- progress = handle_compress ( strm );
- if (!progress) return BZ_SEQUENCE_ERROR;
- if (s->avail_in_expect > 0 || !isempty_RL(s) ||
- s->state_out_pos < s->numZ) return BZ_FINISH_OK;
- s->mode = BZ_M_IDLE;
- return BZ_STREAM_END;
- }
- return BZ_OK; /*--not reached--*/
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm )
-{
- EState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- if (s->arr1 != NULL) BZFREE(s->arr1);
- if (s->arr2 != NULL) BZFREE(s->arr2);
- if (s->ftab != NULL) BZFREE(s->ftab);
- BZFREE(strm->state);
-
- strm->state = NULL;
-
- return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-/*--- Decompression stuff ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressInit)
- ( bz_stream* strm,
- int verbosity,
- int small )
-{
- DState* s;
-
- if (!bz_config_ok()) return BZ_CONFIG_ERROR;
-
- if (strm == NULL) return BZ_PARAM_ERROR;
- if (small != 0 && small != 1) return BZ_PARAM_ERROR;
- if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR;
-
- if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
- if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
-
- s = BZALLOC( sizeof(DState) );
- if (s == NULL) return BZ_MEM_ERROR;
- s->strm = strm;
- strm->state = s;
- s->state = BZ_X_MAGIC_1;
- s->bsLive = 0;
- s->bsBuff = 0;
- s->calculatedCombinedCRC = 0;
- strm->total_in_lo32 = 0;
- strm->total_in_hi32 = 0;
- strm->total_out_lo32 = 0;
- strm->total_out_hi32 = 0;
- s->smallDecompress = (Bool)small;
- s->ll4 = NULL;
- s->ll16 = NULL;
- s->tt = NULL;
- s->currBlockNo = 0;
- s->verbosity = verbosity;
-
- return BZ_OK;
-}
-
-
-/*---------------------------------------------------*/
-static
-void unRLE_obuf_to_output_FAST ( DState* s )
-{
- UChar k1;
-
- if (s->blockRandomised) {
-
- while (True) {
- /* try to finish existing run */
- while (True) {
- if (s->strm->avail_out == 0) return;
- if (s->state_out_len == 0) break;
- *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
- BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
- s->state_out_len--;
- s->strm->next_out++;
- s->strm->avail_out--;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- /* can a new run be started? */
- if (s->nblock_used == s->save_nblock+1) return;
-
-
- s->state_out_len = 1;
- s->state_out_ch = s->k0;
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 2;
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 3;
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- s->state_out_len = ((Int32)k1) + 4;
- BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
- s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
- }
-
- } else {
-
- /* restore */
- UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC;
- UChar c_state_out_ch = s->state_out_ch;
- Int32 c_state_out_len = s->state_out_len;
- Int32 c_nblock_used = s->nblock_used;
- Int32 c_k0 = s->k0;
- UInt32* c_tt = s->tt;
- UInt32 c_tPos = s->tPos;
- char* cs_next_out = s->strm->next_out;
- unsigned int cs_avail_out = s->strm->avail_out;
- /* end restore */
-
- UInt32 avail_out_INIT = cs_avail_out;
- Int32 s_save_nblockPP = s->save_nblock+1;
- unsigned int total_out_lo32_old;
-
- while (True) {
-
- /* try to finish existing run */
- if (c_state_out_len > 0) {
- while (True) {
- if (cs_avail_out == 0) goto return_notr;
- if (c_state_out_len == 1) break;
- *( (UChar*)(cs_next_out) ) = c_state_out_ch;
- BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
- c_state_out_len--;
- cs_next_out++;
- cs_avail_out--;
- }
- s_state_out_len_eq_one:
- {
- if (cs_avail_out == 0) {
- c_state_out_len = 1; goto return_notr;
- };
- *( (UChar*)(cs_next_out) ) = c_state_out_ch;
- BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
- cs_next_out++;
- cs_avail_out--;
- }
- }
- /* can a new run be started? */
- if (c_nblock_used == s_save_nblockPP) {
- c_state_out_len = 0; goto return_notr;
- };
- c_state_out_ch = c_k0;
- BZ_GET_FAST_C(k1); c_nblock_used++;
- if (k1 != c_k0) {
- c_k0 = k1; goto s_state_out_len_eq_one;
- };
- if (c_nblock_used == s_save_nblockPP)
- goto s_state_out_len_eq_one;
-
- c_state_out_len = 2;
- BZ_GET_FAST_C(k1); c_nblock_used++;
- if (c_nblock_used == s_save_nblockPP) continue;
- if (k1 != c_k0) { c_k0 = k1; continue; };
-
- c_state_out_len = 3;
- BZ_GET_FAST_C(k1); c_nblock_used++;
- if (c_nblock_used == s_save_nblockPP) continue;
- if (k1 != c_k0) { c_k0 = k1; continue; };
-
- BZ_GET_FAST_C(k1); c_nblock_used++;
- c_state_out_len = ((Int32)k1) + 4;
- BZ_GET_FAST_C(c_k0); c_nblock_used++;
- }
-
- return_notr:
- total_out_lo32_old = s->strm->total_out_lo32;
- s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out);
- if (s->strm->total_out_lo32 < total_out_lo32_old)
- s->strm->total_out_hi32++;
-
- /* save */
- s->calculatedBlockCRC = c_calculatedBlockCRC;
- s->state_out_ch = c_state_out_ch;
- s->state_out_len = c_state_out_len;
- s->nblock_used = c_nblock_used;
- s->k0 = c_k0;
- s->tt = c_tt;
- s->tPos = c_tPos;
- s->strm->next_out = cs_next_out;
- s->strm->avail_out = cs_avail_out;
- /* end save */
- }
-}
-
-
-
-/*---------------------------------------------------*/
-__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
-{
- Int32 nb, na, mid;
- nb = 0;
- na = 256;
- do {
- mid = (nb + na) >> 1;
- if (indx >= cftab[mid]) nb = mid; else na = mid;
- }
- while (na - nb != 1);
- return nb;
-}
-
-
-/*---------------------------------------------------*/
-static
-void unRLE_obuf_to_output_SMALL ( DState* s )
-{
- UChar k1;
-
- if (s->blockRandomised) {
-
- while (True) {
- /* try to finish existing run */
- while (True) {
- if (s->strm->avail_out == 0) return;
- if (s->state_out_len == 0) break;
- *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
- BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
- s->state_out_len--;
- s->strm->next_out++;
- s->strm->avail_out--;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- /* can a new run be started? */
- if (s->nblock_used == s->save_nblock+1) return;
-
-
- s->state_out_len = 1;
- s->state_out_ch = s->k0;
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 2;
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 3;
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
- k1 ^= BZ_RAND_MASK; s->nblock_used++;
- s->state_out_len = ((Int32)k1) + 4;
- BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
- s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
- }
-
- } else {
-
- while (True) {
- /* try to finish existing run */
- while (True) {
- if (s->strm->avail_out == 0) return;
- if (s->state_out_len == 0) break;
- *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
- BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
- s->state_out_len--;
- s->strm->next_out++;
- s->strm->avail_out--;
- s->strm->total_out_lo32++;
- if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
- }
-
- /* can a new run be started? */
- if (s->nblock_used == s->save_nblock+1) return;
-
- s->state_out_len = 1;
- s->state_out_ch = s->k0;
- BZ_GET_SMALL(k1); s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 2;
- BZ_GET_SMALL(k1); s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- s->state_out_len = 3;
- BZ_GET_SMALL(k1); s->nblock_used++;
- if (s->nblock_used == s->save_nblock+1) continue;
- if (k1 != s->k0) { s->k0 = k1; continue; };
-
- BZ_GET_SMALL(k1); s->nblock_used++;
- s->state_out_len = ((Int32)k1) + 4;
- BZ_GET_SMALL(s->k0); s->nblock_used++;
- }
-
- }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
-{
- DState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- while (True) {
- if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
- if (s->state == BZ_X_OUTPUT) {
- if (s->smallDecompress)
- unRLE_obuf_to_output_SMALL ( s ); else
- unRLE_obuf_to_output_FAST ( s );
- if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
- BZ_FINALISE_CRC ( s->calculatedBlockCRC );
- if (s->verbosity >= 3)
- VPrintf2 ( " {0x%x, 0x%x}", s->storedBlockCRC,
- s->calculatedBlockCRC );
- if (s->verbosity >= 2) VPrintf0 ( "]" );
- if (s->calculatedBlockCRC != s->storedBlockCRC)
- return BZ_DATA_ERROR;
- s->calculatedCombinedCRC
- = (s->calculatedCombinedCRC << 1) |
- (s->calculatedCombinedCRC >> 31);
- s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
- s->state = BZ_X_BLKHDR_1;
- } else {
- return BZ_OK;
- }
- }
- if (s->state >= BZ_X_MAGIC_1) {
- Int32 r = BZ2_decompress ( s );
- if (r == BZ_STREAM_END) {
- if (s->verbosity >= 3)
- VPrintf2 ( "\n combined CRCs: stored = 0x%x, computed = 0x%x",
- s->storedCombinedCRC, s->calculatedCombinedCRC );
- if (s->calculatedCombinedCRC != s->storedCombinedCRC)
- return BZ_DATA_ERROR;
- return r;
- }
- if (s->state != BZ_X_OUTPUT) return r;
- }
- }
-
- AssertH ( 0, 6001 );
-
- return 0; /*NOTREACHED*/
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm )
-{
- DState* s;
- if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
- if (s == NULL) return BZ_PARAM_ERROR;
- if (s->strm != strm) return BZ_PARAM_ERROR;
-
- if (s->tt != NULL) BZFREE(s->tt);
- if (s->ll16 != NULL) BZFREE(s->ll16);
- if (s->ll4 != NULL) BZFREE(s->ll4);
-
- BZFREE(strm->state);
- strm->state = NULL;
-
- return BZ_OK;
-}
-
-
-#ifndef BZ_NO_STDIO
-/*---------------------------------------------------*/
-/*--- File I/O stuff ---*/
-/*---------------------------------------------------*/
-
-#define BZ_SETERR(eee) \
-{ \
- if (bzerror != NULL) *bzerror = eee; \
- if (bzf != NULL) bzf->lastErr = eee; \
-}
-
-typedef
- struct {
- FILE* handle;
- Char buf[BZ_MAX_UNUSED];
- Int32 bufN;
- Bool writing;
- bz_stream strm;
- Int32 lastErr;
- Bool initialisedOk;
- }
- bzFile;
-
-
-/*---------------------------------------------*/
-static Bool myfeof ( FILE* f )
-{
- return feof(f) ? True : False;
-}
-
-
-/*---------------------------------------------------*/
-BZFILE* BZ_API(BZ2_bzWriteOpen)
- ( int* bzerror,
- FILE* f,
- int blockSize100k,
- int verbosity,
- int workFactor )
-{
- Int32 ret;
- bzFile* bzf = NULL;
-
- BZ_SETERR(BZ_OK);
-
- if (f == NULL ||
- (blockSize100k < 1 || blockSize100k > 9) ||
- (workFactor < 0 || workFactor > 250) ||
- (verbosity < 0 || verbosity > 4))
- { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
-
- if (ferror(f))
- { BZ_SETERR(BZ_IO_ERROR); return NULL; };
-
- bzf = malloc ( sizeof(bzFile) );
- if (bzf == NULL)
- { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
-
- BZ_SETERR(BZ_OK);
- bzf->initialisedOk = False;
- bzf->bufN = 0;
- bzf->handle = f;
- bzf->writing = True;
- bzf->strm.bzalloc = NULL;
- bzf->strm.bzfree = NULL;
- bzf->strm.opaque = NULL;
-
- if (workFactor == 0) workFactor = 30;
- ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
- verbosity, workFactor );
- if (ret != BZ_OK)
- { BZ_SETERR(ret); free(bzf); return NULL; };
-
- bzf->strm.avail_in = 0;
- bzf->initialisedOk = True;
- return bzf;
-}
-
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzWrite)
- ( int* bzerror,
- BZFILE* b,
- void* buf,
- int len )
-{
- Int32 n, n2, ret;
- bzFile* bzf = (bzFile*)b;
-
- BZ_SETERR(BZ_OK);
- if (bzf == NULL || buf == NULL || len < 0)
- { BZ_SETERR(BZ_PARAM_ERROR); return; };
- if (!(bzf->writing))
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
-
- if (len == 0)
- { BZ_SETERR(BZ_OK); return; };
-
- bzf->strm.avail_in = len;
- bzf->strm.next_in = buf;
-
- while (True) {
- bzf->strm.avail_out = BZ_MAX_UNUSED;
- bzf->strm.next_out = bzf->buf;
- ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN );
- if (ret != BZ_RUN_OK)
- { BZ_SETERR(ret); return; };
-
- if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
- n = BZ_MAX_UNUSED - bzf->strm.avail_out;
- n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
- n, bzf->handle );
- if (n != n2 || ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
- }
-
- if (bzf->strm.avail_in == 0)
- { BZ_SETERR(BZ_OK); return; };
- }
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzWriteClose)
- ( int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in,
- unsigned int* nbytes_out )
-{
- BZ2_bzWriteClose64 ( bzerror, b, abandon,
- nbytes_in, NULL, nbytes_out, NULL );
-}
-
-
-void BZ_API(BZ2_bzWriteClose64)
- ( int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in_lo32,
- unsigned int* nbytes_in_hi32,
- unsigned int* nbytes_out_lo32,
- unsigned int* nbytes_out_hi32 )
-{
- Int32 n, n2, ret;
- bzFile* bzf = (bzFile*)b;
-
- if (bzf == NULL)
- { BZ_SETERR(BZ_OK); return; };
- if (!(bzf->writing))
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
-
- if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0;
- if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0;
- if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0;
- if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0;
-
- if ((!abandon) && bzf->lastErr == BZ_OK) {
- while (True) {
- bzf->strm.avail_out = BZ_MAX_UNUSED;
- bzf->strm.next_out = bzf->buf;
- ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH );
- if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END)
- { BZ_SETERR(ret); return; };
-
- if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
- n = BZ_MAX_UNUSED - bzf->strm.avail_out;
- n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
- n, bzf->handle );
- if (n != n2 || ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
- }
-
- if (ret == BZ_STREAM_END) break;
- }
- }
-
- if ( !abandon && !ferror ( bzf->handle ) ) {
- fflush ( bzf->handle );
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return; };
- }
-
- if (nbytes_in_lo32 != NULL)
- *nbytes_in_lo32 = bzf->strm.total_in_lo32;
- if (nbytes_in_hi32 != NULL)
- *nbytes_in_hi32 = bzf->strm.total_in_hi32;
- if (nbytes_out_lo32 != NULL)
- *nbytes_out_lo32 = bzf->strm.total_out_lo32;
- if (nbytes_out_hi32 != NULL)
- *nbytes_out_hi32 = bzf->strm.total_out_hi32;
-
- BZ_SETERR(BZ_OK);
- BZ2_bzCompressEnd ( &(bzf->strm) );
- free ( bzf );
-}
-
-
-/*---------------------------------------------------*/
-BZFILE* BZ_API(BZ2_bzReadOpen)
- ( int* bzerror,
- FILE* f,
- int verbosity,
- int small,
- void* unused,
- int nUnused )
-{
- bzFile* bzf = NULL;
- int ret;
-
- BZ_SETERR(BZ_OK);
-
- if (f == NULL ||
- (small != 0 && small != 1) ||
- (verbosity < 0 || verbosity > 4) ||
- (unused == NULL && nUnused != 0) ||
- (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED)))
- { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
-
- if (ferror(f))
- { BZ_SETERR(BZ_IO_ERROR); return NULL; };
-
- bzf = malloc ( sizeof(bzFile) );
- if (bzf == NULL)
- { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
-
- BZ_SETERR(BZ_OK);
-
- bzf->initialisedOk = False;
- bzf->handle = f;
- bzf->bufN = 0;
- bzf->writing = False;
- bzf->strm.bzalloc = NULL;
- bzf->strm.bzfree = NULL;
- bzf->strm.opaque = NULL;
-
- while (nUnused > 0) {
- bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
- unused = ((void*)( 1 + ((UChar*)(unused)) ));
- nUnused--;
- }
-
- ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
- if (ret != BZ_OK)
- { BZ_SETERR(ret); free(bzf); return NULL; };
-
- bzf->strm.avail_in = bzf->bufN;
- bzf->strm.next_in = bzf->buf;
-
- bzf->initialisedOk = True;
- return bzf;
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
-{
- bzFile* bzf = (bzFile*)b;
-
- BZ_SETERR(BZ_OK);
- if (bzf == NULL)
- { BZ_SETERR(BZ_OK); return; };
-
- if (bzf->writing)
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
-
- if (bzf->initialisedOk)
- (void)BZ2_bzDecompressEnd ( &(bzf->strm) );
- free ( bzf );
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzRead)
- ( int* bzerror,
- BZFILE* b,
- void* buf,
- int len )
-{
- Int32 n, ret;
- bzFile* bzf = (bzFile*)b;
-
- BZ_SETERR(BZ_OK);
-
- if (bzf == NULL || buf == NULL || len < 0)
- { BZ_SETERR(BZ_PARAM_ERROR); return 0; };
-
- if (bzf->writing)
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; };
-
- if (len == 0)
- { BZ_SETERR(BZ_OK); return 0; };
-
- bzf->strm.avail_out = len;
- bzf->strm.next_out = buf;
-
- while (True) {
-
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return 0; };
-
- if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
- n = fread ( bzf->buf, sizeof(UChar),
- BZ_MAX_UNUSED, bzf->handle );
- if (ferror(bzf->handle))
- { BZ_SETERR(BZ_IO_ERROR); return 0; };
- bzf->bufN = n;
- bzf->strm.avail_in = bzf->bufN;
- bzf->strm.next_in = bzf->buf;
- }
-
- ret = BZ2_bzDecompress ( &(bzf->strm) );
-
- if (ret != BZ_OK && ret != BZ_STREAM_END)
- { BZ_SETERR(ret); return 0; };
-
- if (ret == BZ_OK && myfeof(bzf->handle) &&
- bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
- { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; };
-
- if (ret == BZ_STREAM_END)
- { BZ_SETERR(BZ_STREAM_END);
- return len - bzf->strm.avail_out; };
- if (bzf->strm.avail_out == 0)
- { BZ_SETERR(BZ_OK); return len; };
-
- }
-
- return 0; /*not reached*/
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadGetUnused)
- ( int* bzerror,
- BZFILE* b,
- void** unused,
- int* nUnused )
-{
- bzFile* bzf = (bzFile*)b;
- if (bzf == NULL)
- { BZ_SETERR(BZ_PARAM_ERROR); return; };
- if (bzf->lastErr != BZ_STREAM_END)
- { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
- if (unused == NULL || nUnused == NULL)
- { BZ_SETERR(BZ_PARAM_ERROR); return; };
-
- BZ_SETERR(BZ_OK);
- *nUnused = bzf->strm.avail_in;
- *unused = bzf->strm.next_in;
-}
-#endif
-
-
-/*---------------------------------------------------*/
-/*--- Misc convenience stuff ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzBuffToBuffCompress)
- ( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int blockSize100k,
- int verbosity,
- int workFactor )
-{
- bz_stream strm;
- int ret;
-
- if (dest == NULL || destLen == NULL ||
- source == NULL ||
- blockSize100k < 1 || blockSize100k > 9 ||
- verbosity < 0 || verbosity > 4 ||
- workFactor < 0 || workFactor > 250)
- return BZ_PARAM_ERROR;
-
- if (workFactor == 0) workFactor = 30;
- strm.bzalloc = NULL;
- strm.bzfree = NULL;
- strm.opaque = NULL;
- ret = BZ2_bzCompressInit ( &strm, blockSize100k,
- verbosity, workFactor );
- if (ret != BZ_OK) return ret;
-
- strm.next_in = source;
- strm.next_out = dest;
- strm.avail_in = sourceLen;
- strm.avail_out = *destLen;
-
- ret = BZ2_bzCompress ( &strm, BZ_FINISH );
- if (ret == BZ_FINISH_OK) goto output_overflow;
- if (ret != BZ_STREAM_END) goto errhandler;
-
- /* normal termination */
- *destLen -= strm.avail_out;
- BZ2_bzCompressEnd ( &strm );
- return BZ_OK;
-
- output_overflow:
- BZ2_bzCompressEnd ( &strm );
- return BZ_OUTBUFF_FULL;
-
- errhandler:
- BZ2_bzCompressEnd ( &strm );
- return ret;
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzBuffToBuffDecompress)
- ( char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int small,
- int verbosity )
-{
- bz_stream strm;
- int ret;
-
- if (dest == NULL || destLen == NULL ||
- source == NULL ||
- (small != 0 && small != 1) ||
- verbosity < 0 || verbosity > 4)
- return BZ_PARAM_ERROR;
-
- strm.bzalloc = NULL;
- strm.bzfree = NULL;
- strm.opaque = NULL;
- ret = BZ2_bzDecompressInit ( &strm, verbosity, small );
- if (ret != BZ_OK) return ret;
-
- strm.next_in = source;
- strm.next_out = dest;
- strm.avail_in = sourceLen;
- strm.avail_out = *destLen;
-
- ret = BZ2_bzDecompress ( &strm );
- if (ret == BZ_OK) goto output_overflow_or_eof;
- if (ret != BZ_STREAM_END) goto errhandler;
-
- /* normal termination */
- *destLen -= strm.avail_out;
- BZ2_bzDecompressEnd ( &strm );
- return BZ_OK;
-
- output_overflow_or_eof:
- if (strm.avail_out > 0) {
- BZ2_bzDecompressEnd ( &strm );
- return BZ_UNEXPECTED_EOF;
- } else {
- BZ2_bzDecompressEnd ( &strm );
- return BZ_OUTBUFF_FULL;
- };
-
- errhandler:
- BZ2_bzDecompressEnd ( &strm );
- return ret;
-}
-
-
-/*---------------------------------------------------*/
-/*--
- Code contributed by Yoshioka Tsuneo
- (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
- to support better zlib compatibility.
- This code is not _officially_ part of libbzip2 (yet);
- I haven't tested it, documented it, or considered the
- threading-safeness of it.
- If this code breaks, please contact both Yoshioka and me.
---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-/*--
- return version like "0.9.0c".
---*/
-const char * BZ_API(BZ2_bzlibVersion)(void)
-{
- return BZ_VERSION;
-}
-
-
-#ifndef BZ_NO_STDIO
-/*---------------------------------------------------*/
-
-#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
-# include <fcntl.h>
-# include <io.h>
-# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)
-#else
-# define SET_BINARY_MODE(file)
-#endif
-static
-BZFILE * bzopen_or_bzdopen
- ( const char *path, /* no use when bzdopen */
- int fd, /* no use when bzdopen */
- const char *mode,
- int open_mode) /* bzopen: 0, bzdopen:1 */
-{
- int bzerr;
- char unused[BZ_MAX_UNUSED];
- int blockSize100k = 9;
- int writing = 0;
- char mode2[10] = "";
- FILE *fp = NULL;
- BZFILE *bzfp = NULL;
- int verbosity = 0;
- int workFactor = 30;
- int smallMode = 0;
- int nUnused = 0;
-
- if (mode == NULL) return NULL;
- while (*mode) {
- switch (*mode) {
- case 'r':
- writing = 0; break;
- case 'w':
- writing = 1; break;
- case 's':
- smallMode = 1; break;
- default:
- if (isdigit((int)(*mode))) {
- blockSize100k = *mode-'0';
- }
- }
- mode++;
- }
- strcat(mode2, writing ? "w" : "r" );
- strcat(mode2,"b"); /* binary mode */
-
- if (open_mode==0) {
- if (path==NULL || strcmp(path,"")==0) {
- fp = (writing ? stdout : stdin);
- SET_BINARY_MODE(fp);
- } else {
- fp = fopen(path,mode2);
- }
- } else {
-#ifdef BZ_STRICT_ANSI
- fp = NULL;
-#else
- fp = fdopen(fd,mode2);
-#endif
- }
- if (fp == NULL) return NULL;
-
- if (writing) {
- /* Guard against total chaos and anarchy -- JRS */
- if (blockSize100k < 1) blockSize100k = 1;
- if (blockSize100k > 9) blockSize100k = 9;
- bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
- verbosity,workFactor);
- } else {
- bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
- unused,nUnused);
- }
- if (bzfp == NULL) {
- if (fp != stdin && fp != stdout) fclose(fp);
- return NULL;
- }
- return bzfp;
-}
-
-
-/*---------------------------------------------------*/
-/*--
- open file for read or write.
- ex) bzopen("file","w9")
- case path="" or NULL => use stdin or stdout.
---*/
-BZFILE * BZ_API(BZ2_bzopen)
- ( const char *path,
- const char *mode )
-{
- return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0);
-}
-
-
-/*---------------------------------------------------*/
-BZFILE * BZ_API(BZ2_bzdopen)
- ( int fd,
- const char *mode )
-{
- return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1);
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
-{
- int bzerr, nread;
- if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0;
- nread = BZ2_bzRead(&bzerr,b,buf,len);
- if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) {
- return nread;
- } else {
- return -1;
- }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
-{
- int bzerr;
-
- BZ2_bzWrite(&bzerr,b,buf,len);
- if(bzerr == BZ_OK){
- return len;
- }else{
- return -1;
- }
-}
-
-
-/*---------------------------------------------------*/
-int BZ_API(BZ2_bzflush) (BZFILE *b __attribute__ ((unused)))
-{
- /* do nothing now... */
- return 0;
-}
-
-
-/*---------------------------------------------------*/
-void BZ_API(BZ2_bzclose) (BZFILE* b)
-{
- int bzerr;
- FILE *fp = ((bzFile *)b)->handle;
-
- if (b==NULL) {return;}
- if(((bzFile*)b)->writing){
- BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
- if(bzerr != BZ_OK){
- BZ2_bzWriteClose(NULL,b,1,NULL,NULL);
- }
- }else{
- BZ2_bzReadClose(&bzerr,b);
- }
- if(fp!=stdin && fp!=stdout){
- fclose(fp);
- }
-}
-
-
-/*---------------------------------------------------*/
-/*--
- return last error code
---*/
-static char *bzerrorstrings[] = {
- "OK"
- ,"SEQUENCE_ERROR"
- ,"PARAM_ERROR"
- ,"MEM_ERROR"
- ,"DATA_ERROR"
- ,"DATA_ERROR_MAGIC"
- ,"IO_ERROR"
- ,"UNEXPECTED_EOF"
- ,"OUTBUFF_FULL"
- ,"CONFIG_ERROR"
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
- ,"???" /* for future */
-};
-
-
-const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
-{
- int err = ((bzFile *)b)->lastErr;
-
- if(err>0) err = 0;
- *errnum = err;
- return bzerrorstrings[err*-1];
-}
-#endif
-
-
-/*-------------------------------------------------------------*/
-/*--- end bzlib.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/bzlib.h b/mdk-stage1/bzlib/bzlib.h
deleted file mode 100644
index c9447a295..000000000
--- a/mdk-stage1/bzlib/bzlib.h
+++ /dev/null
@@ -1,319 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Public header file for the library. ---*/
-/*--- bzlib.h ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#ifndef _BZLIB_H
-#define _BZLIB_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BZ_RUN 0
-#define BZ_FLUSH 1
-#define BZ_FINISH 2
-
-#define BZ_OK 0
-#define BZ_RUN_OK 1
-#define BZ_FLUSH_OK 2
-#define BZ_FINISH_OK 3
-#define BZ_STREAM_END 4
-#define BZ_SEQUENCE_ERROR (-1)
-#define BZ_PARAM_ERROR (-2)
-#define BZ_MEM_ERROR (-3)
-#define BZ_DATA_ERROR (-4)
-#define BZ_DATA_ERROR_MAGIC (-5)
-#define BZ_IO_ERROR (-6)
-#define BZ_UNEXPECTED_EOF (-7)
-#define BZ_OUTBUFF_FULL (-8)
-#define BZ_CONFIG_ERROR (-9)
-
-typedef
- struct {
- char *next_in;
- unsigned int avail_in;
- unsigned int total_in_lo32;
- unsigned int total_in_hi32;
-
- char *next_out;
- unsigned int avail_out;
- unsigned int total_out_lo32;
- unsigned int total_out_hi32;
-
- void *state;
-
- void *(*bzalloc)(void *,int,int);
- void (*bzfree)(void *,void *);
- void *opaque;
- }
- bz_stream;
-
-
-#ifndef BZ_IMPORT
-#define BZ_EXPORT
-#endif
-
-#ifdef _WIN32
-# include <stdio.h>
-# include <windows.h>
-# ifdef small
- /* windows.h define small to char */
-# undef small
-# endif
-# ifdef BZ_EXPORT
-# define BZ_API(func) WINAPI func
-# define BZ_EXTERN extern
-# else
- /* import windows dll dynamically */
-# define BZ_API(func) (WINAPI * func)
-# define BZ_EXTERN
-# endif
-#else
-# define BZ_API(func) func
-# define BZ_EXTERN extern
-#endif
-
-
-/*-- Core (low-level) library functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
- bz_stream* strm,
- int blockSize100k,
- int verbosity,
- int workFactor
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompress) (
- bz_stream* strm,
- int action
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
- bz_stream* strm
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
- bz_stream *strm,
- int verbosity,
- int small
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
- bz_stream* strm
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
- bz_stream *strm
- );
-
-
-
-/*-- High(er) level library functions --*/
-
-#ifndef BZ_NO_STDIO
-#define BZ_MAX_UNUSED 5000
-
-typedef void BZFILE;
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
- int* bzerror,
- FILE* f,
- int verbosity,
- int small,
- void* unused,
- int nUnused
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
- int* bzerror,
- BZFILE* b
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
- int* bzerror,
- BZFILE* b,
- void** unused,
- int* nUnused
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzRead) (
- int* bzerror,
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
- int* bzerror,
- FILE* f,
- int blockSize100k,
- int verbosity,
- int workFactor
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzWrite) (
- int* bzerror,
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
- int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in,
- unsigned int* nbytes_out
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
- int* bzerror,
- BZFILE* b,
- int abandon,
- unsigned int* nbytes_in_lo32,
- unsigned int* nbytes_in_hi32,
- unsigned int* nbytes_out_lo32,
- unsigned int* nbytes_out_hi32
- );
-#endif
-
-
-/*-- Utility functions --*/
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
- char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int blockSize100k,
- int verbosity,
- int workFactor
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
- char* dest,
- unsigned int* destLen,
- char* source,
- unsigned int sourceLen,
- int small,
- int verbosity
- );
-
-
-/*--
- Code contributed by Yoshioka Tsuneo
- (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
- to support better zlib compatibility.
- This code is not _officially_ part of libbzip2 (yet);
- I haven't tested it, documented it, or considered the
- threading-safeness of it.
- If this code breaks, please contact both Yoshioka and me.
---*/
-
-BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
- void
- );
-
-#ifndef BZ_NO_STDIO
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
- const char *path,
- const char *mode
- );
-
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
- int fd,
- const char *mode
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzread) (
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzwrite) (
- BZFILE* b,
- void* buf,
- int len
- );
-
-BZ_EXTERN int BZ_API(BZ2_bzflush) (
- BZFILE* b
- );
-
-BZ_EXTERN void BZ_API(BZ2_bzclose) (
- BZFILE* b
- );
-
-BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
- BZFILE *b,
- int *errnum
- );
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/*-------------------------------------------------------------*/
-/*--- end bzlib.h ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/bzlib_private.h b/mdk-stage1/bzlib/bzlib_private.h
deleted file mode 100644
index fb51c7a1d..000000000
--- a/mdk-stage1/bzlib/bzlib_private.h
+++ /dev/null
@@ -1,530 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Private header file for the library. ---*/
-/*--- bzlib_private.h ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-
-#ifndef _BZLIB_PRIVATE_H
-#define _BZLIB_PRIVATE_H
-
-#include <stdlib.h>
-
-#ifndef BZ_NO_STDIO
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#endif
-
-#include "bzlib.h"
-
-
-
-/*-- General stuff. --*/
-
-#define BZ_VERSION "1.0.1, 23-June-2000"
-
-typedef char Char;
-typedef unsigned char Bool;
-typedef unsigned char UChar;
-typedef int Int32;
-typedef unsigned int UInt32;
-typedef short Int16;
-typedef unsigned short UInt16;
-
-#define True ((Bool)1)
-#define False ((Bool)0)
-
-#ifndef __GNUC__
-#define __inline__ /* */
-#endif
-
-#ifndef BZ_NO_STDIO
-extern void BZ2_bz__AssertH__fail ( int errcode );
-#define AssertH(cond,errcode) \
- { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
-#if BZ_DEBUG
-#define AssertD(cond,msg) \
- { if (!(cond)) { \
- fprintf ( stderr, \
- "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
- exit(1); \
- }}
-#else
-#define AssertD(cond,msg) /* */
-#endif
-#define VPrintf0(zf) \
- fprintf(stderr,zf)
-#define VPrintf1(zf,za1) \
- fprintf(stderr,zf,za1)
-#define VPrintf2(zf,za1,za2) \
- fprintf(stderr,zf,za1,za2)
-#define VPrintf3(zf,za1,za2,za3) \
- fprintf(stderr,zf,za1,za2,za3)
-#define VPrintf4(zf,za1,za2,za3,za4) \
- fprintf(stderr,zf,za1,za2,za3,za4)
-#define VPrintf5(zf,za1,za2,za3,za4,za5) \
- fprintf(stderr,zf,za1,za2,za3,za4,za5)
-#else
-extern void bz_internal_error ( int errcode );
-#define AssertH(cond,errcode) \
- { if (!(cond)) bz_internal_error ( errcode ); }
-#define AssertD(cond,msg) /* */
-#define VPrintf0(zf) /* */
-#define VPrintf1(zf,za1) /* */
-#define VPrintf2(zf,za1,za2) /* */
-#define VPrintf3(zf,za1,za2,za3) /* */
-#define VPrintf4(zf,za1,za2,za3,za4) /* */
-#define VPrintf5(zf,za1,za2,za3,za4,za5) /* */
-#endif
-
-
-#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1)
-#define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp))
-
-
-/*-- Constants for the back end. --*/
-
-#define BZ_MAX_ALPHA_SIZE 258
-#define BZ_MAX_CODE_LEN 23
-
-#define BZ_RUNA 0
-#define BZ_RUNB 1
-
-#define BZ_N_GROUPS 6
-#define BZ_G_SIZE 50
-#define BZ_N_ITERS 4
-
-#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE))
-
-
-
-/*-- Stuff for randomising repetitive blocks. --*/
-
-extern Int32 BZ2_rNums[512];
-
-#define BZ_RAND_DECLS \
- Int32 rNToGo; \
- Int32 rTPos \
-
-#define BZ_RAND_INIT_MASK \
- s->rNToGo = 0; \
- s->rTPos = 0 \
-
-#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0)
-
-#define BZ_RAND_UPD_MASK \
- if (s->rNToGo == 0) { \
- s->rNToGo = BZ2_rNums[s->rTPos]; \
- s->rTPos++; \
- if (s->rTPos == 512) s->rTPos = 0; \
- } \
- s->rNToGo--;
-
-
-
-/*-- Stuff for doing CRCs. --*/
-
-extern UInt32 BZ2_crc32Table[256];
-
-#define BZ_INITIALISE_CRC(crcVar) \
-{ \
- crcVar = 0xffffffffL; \
-}
-
-#define BZ_FINALISE_CRC(crcVar) \
-{ \
- crcVar = ~(crcVar); \
-}
-
-#define BZ_UPDATE_CRC(crcVar,cha) \
-{ \
- crcVar = (crcVar << 8) ^ \
- BZ2_crc32Table[(crcVar >> 24) ^ \
- ((UChar)cha)]; \
-}
-
-
-
-/*-- States and modes for compression. --*/
-
-#define BZ_M_IDLE 1
-#define BZ_M_RUNNING 2
-#define BZ_M_FLUSHING 3
-#define BZ_M_FINISHING 4
-
-#define BZ_S_OUTPUT 1
-#define BZ_S_INPUT 2
-
-#define BZ_N_RADIX 2
-#define BZ_N_QSORT 12
-#define BZ_N_SHELL 18
-#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2)
-
-
-
-
-/*-- Structure holding all the compression-side stuff. --*/
-
-typedef
- struct {
- /* pointer back to the struct bz_stream */
- bz_stream* strm;
-
- /* mode this stream is in, and whether inputting */
- /* or outputting data */
- Int32 mode;
- Int32 state;
-
- /* remembers avail_in when flush/finish requested */
- UInt32 avail_in_expect;
-
- /* for doing the block sorting */
- UInt32* arr1;
- UInt32* arr2;
- UInt32* ftab;
- Int32 origPtr;
-
- /* aliases for arr1 and arr2 */
- UInt32* ptr;
- UChar* block;
- UInt16* mtfv;
- UChar* zbits;
-
- /* for deciding when to use the fallback sorting algorithm */
- Int32 workFactor;
-
- /* run-length-encoding of the input */
- UInt32 state_in_ch;
- Int32 state_in_len;
- BZ_RAND_DECLS;
-
- /* input and output limits and current posns */
- Int32 nblock;
- Int32 nblockMAX;
- Int32 numZ;
- Int32 state_out_pos;
-
- /* map of bytes used in block */
- Int32 nInUse;
- Bool inUse[256];
- UChar unseqToSeq[256];
-
- /* the buffer for bit stream creation */
- UInt32 bsBuff;
- Int32 bsLive;
-
- /* block and combined CRCs */
- UInt32 blockCRC;
- UInt32 combinedCRC;
-
- /* misc administratium */
- Int32 verbosity;
- Int32 blockNo;
- Int32 blockSize100k;
-
- /* stuff for coding the MTF values */
- Int32 nMTF;
- Int32 mtfFreq [BZ_MAX_ALPHA_SIZE];
- UChar selector [BZ_MAX_SELECTORS];
- UChar selectorMtf[BZ_MAX_SELECTORS];
-
- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- /* second dimension: only 3 needed; 4 makes index calculations faster */
- UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4];
-
- }
- EState;
-
-
-
-/*-- externs for compression. --*/
-
-extern void
-BZ2_blockSort ( EState* );
-
-extern void
-BZ2_compressBlock ( EState*, Bool );
-
-extern void
-BZ2_bsInitWrite ( EState* );
-
-extern void
-BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
-
-extern void
-BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
-
-
-
-/*-- states for decompression. --*/
-
-#define BZ_X_IDLE 1
-#define BZ_X_OUTPUT 2
-
-#define BZ_X_MAGIC_1 10
-#define BZ_X_MAGIC_2 11
-#define BZ_X_MAGIC_3 12
-#define BZ_X_MAGIC_4 13
-#define BZ_X_BLKHDR_1 14
-#define BZ_X_BLKHDR_2 15
-#define BZ_X_BLKHDR_3 16
-#define BZ_X_BLKHDR_4 17
-#define BZ_X_BLKHDR_5 18
-#define BZ_X_BLKHDR_6 19
-#define BZ_X_BCRC_1 20
-#define BZ_X_BCRC_2 21
-#define BZ_X_BCRC_3 22
-#define BZ_X_BCRC_4 23
-#define BZ_X_RANDBIT 24
-#define BZ_X_ORIGPTR_1 25
-#define BZ_X_ORIGPTR_2 26
-#define BZ_X_ORIGPTR_3 27
-#define BZ_X_MAPPING_1 28
-#define BZ_X_MAPPING_2 29
-#define BZ_X_SELECTOR_1 30
-#define BZ_X_SELECTOR_2 31
-#define BZ_X_SELECTOR_3 32
-#define BZ_X_CODING_1 33
-#define BZ_X_CODING_2 34
-#define BZ_X_CODING_3 35
-#define BZ_X_MTF_1 36
-#define BZ_X_MTF_2 37
-#define BZ_X_MTF_3 38
-#define BZ_X_MTF_4 39
-#define BZ_X_MTF_5 40
-#define BZ_X_MTF_6 41
-#define BZ_X_ENDHDR_2 42
-#define BZ_X_ENDHDR_3 43
-#define BZ_X_ENDHDR_4 44
-#define BZ_X_ENDHDR_5 45
-#define BZ_X_ENDHDR_6 46
-#define BZ_X_CCRC_1 47
-#define BZ_X_CCRC_2 48
-#define BZ_X_CCRC_3 49
-#define BZ_X_CCRC_4 50
-
-
-
-/*-- Constants for the fast MTF decoder. --*/
-
-#define MTFA_SIZE 4096
-#define MTFL_SIZE 16
-
-
-
-/*-- Structure holding all the decompression-side stuff. --*/
-
-typedef
- struct {
- /* pointer back to the struct bz_stream */
- bz_stream* strm;
-
- /* state indicator for this stream */
- Int32 state;
-
- /* for doing the final run-length decoding */
- UChar state_out_ch;
- Int32 state_out_len;
- Bool blockRandomised;
- BZ_RAND_DECLS;
-
- /* the buffer for bit stream reading */
- UInt32 bsBuff;
- Int32 bsLive;
-
- /* misc administratium */
- Int32 blockSize100k;
- Bool smallDecompress;
- Int32 currBlockNo;
- Int32 verbosity;
-
- /* for undoing the Burrows-Wheeler transform */
- Int32 origPtr;
- UInt32 tPos;
- Int32 k0;
- Int32 unzftab[256];
- Int32 nblock_used;
- Int32 cftab[257];
- Int32 cftabCopy[257];
-
- /* for undoing the Burrows-Wheeler transform (FAST) */
- UInt32 *tt;
-
- /* for undoing the Burrows-Wheeler transform (SMALL) */
- UInt16 *ll16;
- UChar *ll4;
-
- /* stored and calculated CRCs */
- UInt32 storedBlockCRC;
- UInt32 storedCombinedCRC;
- UInt32 calculatedBlockCRC;
- UInt32 calculatedCombinedCRC;
-
- /* map of bytes used in block */
- Int32 nInUse;
- Bool inUse[256];
- Bool inUse16[16];
- UChar seqToUnseq[256];
-
- /* for decoding the MTF values */
- UChar mtfa [MTFA_SIZE];
- Int32 mtfbase[256 / MTFL_SIZE];
- UChar selector [BZ_MAX_SELECTORS];
- UChar selectorMtf[BZ_MAX_SELECTORS];
- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
-
- Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 minLens[BZ_N_GROUPS];
-
- /* save area for scalars in the main decompress code */
- Int32 save_i;
- Int32 save_j;
- Int32 save_t;
- Int32 save_alphaSize;
- Int32 save_nGroups;
- Int32 save_nSelectors;
- Int32 save_EOB;
- Int32 save_groupNo;
- Int32 save_groupPos;
- Int32 save_nextSym;
- Int32 save_nblockMAX;
- Int32 save_nblock;
- Int32 save_es;
- Int32 save_N;
- Int32 save_curr;
- Int32 save_zt;
- Int32 save_zn;
- Int32 save_zvec;
- Int32 save_zj;
- Int32 save_gSel;
- Int32 save_gMinlen;
- Int32* save_gLimit;
- Int32* save_gBase;
- Int32* save_gPerm;
-
- }
- DState;
-
-
-
-/*-- Macros for decompression. --*/
-
-#define BZ_GET_FAST(cccc) \
- s->tPos = s->tt[s->tPos]; \
- cccc = (UChar)(s->tPos & 0xff); \
- s->tPos >>= 8;
-
-#define BZ_GET_FAST_C(cccc) \
- c_tPos = c_tt[c_tPos]; \
- cccc = (UChar)(c_tPos & 0xff); \
- c_tPos >>= 8;
-
-#define SET_LL4(i,n) \
- { if (((i) & 0x1) == 0) \
- s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \
- s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \
- }
-
-#define GET_LL4(i) \
- ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF)
-
-#define SET_LL(i,n) \
- { s->ll16[i] = (UInt16)(n & 0x0000ffff); \
- SET_LL4(i, n >> 16); \
- }
-
-#define GET_LL(i) \
- (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16))
-
-#define BZ_GET_SMALL(cccc) \
- cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \
- s->tPos = GET_LL(s->tPos);
-
-
-/*-- externs for decompression. --*/
-
-extern Int32
-BZ2_indexIntoF ( Int32, Int32* );
-
-extern Int32
-BZ2_decompress ( DState* );
-
-extern void
-BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
- Int32, Int32, Int32 );
-
-
-#endif
-
-
-/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
-
-#ifdef BZ_NO_STDIO
-#ifndef NULL
-#define NULL 0
-#endif
-#endif
-
-
-/*-------------------------------------------------------------*/
-/*--- end bzlib_private.h ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/compress.c b/mdk-stage1/bzlib/compress.c
deleted file mode 100644
index 58d5abe7c..000000000
--- a/mdk-stage1/bzlib/compress.c
+++ /dev/null
@@ -1,720 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Compression machinery (not incl block sorting) ---*/
-/*--- compress.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-/*--
- CHANGES
- ~~~~~~~
- 0.9.0 -- original version.
-
- 0.9.0a/b -- no changes in this file.
-
- 0.9.0c
- * changed setting of nGroups in sendMTFValues() so as to
- do a bit better on small files
---*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-/*--- Bit stream I/O ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-void BZ2_bsInitWrite ( EState* s )
-{
- s->bsLive = 0;
- s->bsBuff = 0;
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsFinishWrite ( EState* s )
-{
- while (s->bsLive > 0) {
- s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24);
- s->numZ++;
- s->bsBuff <<= 8;
- s->bsLive -= 8;
- }
-}
-
-
-/*---------------------------------------------------*/
-#define bsNEEDW(nz) \
-{ \
- while (s->bsLive >= 8) { \
- s->zbits[s->numZ] \
- = (UChar)(s->bsBuff >> 24); \
- s->numZ++; \
- s->bsBuff <<= 8; \
- s->bsLive -= 8; \
- } \
-}
-
-
-/*---------------------------------------------------*/
-static
-__inline__
-void bsW ( EState* s, Int32 n, UInt32 v )
-{
- bsNEEDW ( n );
- s->bsBuff |= (v << (32 - s->bsLive - n));
- s->bsLive += n;
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsPutUInt32 ( EState* s, UInt32 u )
-{
- bsW ( s, 8, (u >> 24) & 0xffL );
- bsW ( s, 8, (u >> 16) & 0xffL );
- bsW ( s, 8, (u >> 8) & 0xffL );
- bsW ( s, 8, u & 0xffL );
-}
-
-
-/*---------------------------------------------------*/
-static
-void bsPutUChar ( EState* s, UChar c )
-{
- bsW( s, 8, (UInt32)c );
-}
-
-
-/*---------------------------------------------------*/
-/*--- The back end proper ---*/
-/*---------------------------------------------------*/
-
-/*---------------------------------------------------*/
-static
-void makeMaps_e ( EState* s )
-{
- Int32 i;
- s->nInUse = 0;
- for (i = 0; i < 256; i++)
- if (s->inUse[i]) {
- s->unseqToSeq[i] = s->nInUse;
- s->nInUse++;
- }
-}
-
-
-/*---------------------------------------------------*/
-static
-void generateMTFValues ( EState* s )
-{
- UChar yy[256];
- Int32 i, j;
- Int32 zPend;
- Int32 wr;
- Int32 EOB;
-
- /*
- After sorting (eg, here),
- s->arr1 [ 0 .. s->nblock-1 ] holds sorted order,
- and
- ((UChar*)s->arr2) [ 0 .. s->nblock-1 ]
- holds the original block data.
-
- The first thing to do is generate the MTF values,
- and put them in
- ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ].
- Because there are strictly fewer or equal MTF values
- than block values, ptr values in this area are overwritten
- with MTF values only when they are no longer needed.
-
- The final compressed bitstream is generated into the
- area starting at
- (UChar*) (&((UChar*)s->arr2)[s->nblock])
-
- These storage aliases are set up in bzCompressInit(),
- except for the last one, which is arranged in
- compressBlock().
- */
- UInt32* ptr = s->ptr;
- UChar* block = s->block;
- UInt16* mtfv = s->mtfv;
-
- makeMaps_e ( s );
- EOB = s->nInUse+1;
-
- for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0;
-
- wr = 0;
- zPend = 0;
- for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i;
-
- for (i = 0; i < s->nblock; i++) {
- UChar ll_i;
- AssertD ( wr <= i, "generateMTFValues(1)" );
- j = ptr[i]-1; if (j < 0) j += s->nblock;
- ll_i = s->unseqToSeq[block[j]];
- AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
-
- if (yy[0] == ll_i) {
- zPend++;
- } else {
-
- if (zPend > 0) {
- zPend--;
- while (True) {
- if (zPend & 1) {
- mtfv[wr] = BZ_RUNB; wr++;
- s->mtfFreq[BZ_RUNB]++;
- } else {
- mtfv[wr] = BZ_RUNA; wr++;
- s->mtfFreq[BZ_RUNA]++;
- }
- if (zPend < 2) break;
- zPend = (zPend - 2) / 2;
- };
- zPend = 0;
- }
- {
- register UChar rtmp;
- register UChar* ryy_j;
- register UChar rll_i;
- rtmp = yy[1];
- yy[1] = yy[0];
- ryy_j = &(yy[1]);
- rll_i = ll_i;
- while ( rll_i != rtmp ) {
- register UChar rtmp2;
- ryy_j++;
- rtmp2 = rtmp;
- rtmp = *ryy_j;
- *ryy_j = rtmp2;
- };
- yy[0] = rtmp;
- j = ryy_j - &(yy[0]);
- mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++;
- }
-
- }
- }
-
- if (zPend > 0) {
- zPend--;
- while (True) {
- if (zPend & 1) {
- mtfv[wr] = BZ_RUNB; wr++;
- s->mtfFreq[BZ_RUNB]++;
- } else {
- mtfv[wr] = BZ_RUNA; wr++;
- s->mtfFreq[BZ_RUNA]++;
- }
- if (zPend < 2) break;
- zPend = (zPend - 2) / 2;
- };
- zPend = 0;
- }
-
- mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++;
-
- s->nMTF = wr;
-}
-
-
-/*---------------------------------------------------*/
-#define BZ_LESSER_ICOST 0
-#define BZ_GREATER_ICOST 15
-
-static
-void sendMTFValues ( EState* s )
-{
- Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
- Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
- Int32 nGroups, nBytes;
-
- /*--
- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- is a global since the decoder also needs it.
-
- Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
- are also globals only used in this proc.
- Made global to keep stack frame size small.
- --*/
-
-
- UInt16 cost[BZ_N_GROUPS];
- Int32 fave[BZ_N_GROUPS];
-
- UInt16* mtfv = s->mtfv;
-
- if (s->verbosity >= 3)
- VPrintf3( " %d in block, %d after MTF & 1-2 coding, "
- "%d+2 syms in use\n",
- s->nblock, s->nMTF, s->nInUse );
-
- alphaSize = s->nInUse+2;
- for (t = 0; t < BZ_N_GROUPS; t++)
- for (v = 0; v < alphaSize; v++)
- s->len[t][v] = BZ_GREATER_ICOST;
-
- /*--- Decide how many coding tables to use ---*/
- AssertH ( s->nMTF > 0, 3001 );
- if (s->nMTF < 200) nGroups = 2; else
- if (s->nMTF < 600) nGroups = 3; else
- if (s->nMTF < 1200) nGroups = 4; else
- if (s->nMTF < 2400) nGroups = 5; else
- nGroups = 6;
-
- /*--- Generate an initial set of coding tables ---*/
- {
- Int32 nPart, remF, tFreq, aFreq;
-
- nPart = nGroups;
- remF = s->nMTF;
- gs = 0;
- while (nPart > 0) {
- tFreq = remF / nPart;
- ge = gs-1;
- aFreq = 0;
- while (aFreq < tFreq && ge < alphaSize-1) {
- ge++;
- aFreq += s->mtfFreq[ge];
- }
-
- if (ge > gs
- && nPart != nGroups && nPart != 1
- && ((nGroups-nPart) % 2 == 1)) {
- aFreq -= s->mtfFreq[ge];
- ge--;
- }
-
- if (s->verbosity >= 3)
- VPrintf5( " initial group %d, [%d .. %d], "
- "has %d syms (%4.1f%%)\n",
- nPart, gs, ge, aFreq,
- (100.0 * (float)aFreq) / (float)(s->nMTF) );
-
- for (v = 0; v < alphaSize; v++)
- if (v >= gs && v <= ge)
- s->len[nPart-1][v] = BZ_LESSER_ICOST; else
- s->len[nPart-1][v] = BZ_GREATER_ICOST;
-
- nPart--;
- gs = ge+1;
- remF -= aFreq;
- }
- }
-
- /*---
- Iterate up to BZ_N_ITERS times to improve the tables.
- ---*/
- for (iter = 0; iter < BZ_N_ITERS; iter++) {
-
- for (t = 0; t < nGroups; t++) fave[t] = 0;
-
- for (t = 0; t < nGroups; t++)
- for (v = 0; v < alphaSize; v++)
- s->rfreq[t][v] = 0;
-
- /*---
- Set up an auxiliary length table which is used to fast-track
- the common case (nGroups == 6).
- ---*/
- if (nGroups == 6) {
- for (v = 0; v < alphaSize; v++) {
- s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
- s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
- s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
- }
- }
-
- nSelectors = 0;
- totc = 0;
- gs = 0;
- while (True) {
-
- /*--- Set group start & end marks. --*/
- if (gs >= s->nMTF) break;
- ge = gs + BZ_G_SIZE - 1;
- if (ge >= s->nMTF) ge = s->nMTF-1;
-
- /*--
- Calculate the cost of this group as coded
- by each of the coding tables.
- --*/
- for (t = 0; t < nGroups; t++) cost[t] = 0;
-
- if (nGroups == 6 && 50 == ge-gs+1) {
- /*--- fast track the common case ---*/
- register UInt32 cost01, cost23, cost45;
- register UInt16 icv;
- cost01 = cost23 = cost45 = 0;
-
-# define BZ_ITER(nn) \
- icv = mtfv[gs+(nn)]; \
- cost01 += s->len_pack[icv][0]; \
- cost23 += s->len_pack[icv][1]; \
- cost45 += s->len_pack[icv][2]; \
-
- BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4);
- BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9);
- BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14);
- BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19);
- BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24);
- BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29);
- BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34);
- BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39);
- BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44);
- BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49);
-
-# undef BZ_ITER
-
- cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16;
- cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16;
- cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
-
- } else {
- /*--- slow version which correctly handles all situations ---*/
- for (i = gs; i <= ge; i++) {
- UInt16 icv = mtfv[i];
- for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
- }
- }
-
- /*--
- Find the coding table which is best for this group,
- and record its identity in the selector table.
- --*/
- bc = 999999999; bt = -1;
- for (t = 0; t < nGroups; t++)
- if (cost[t] < bc) { bc = cost[t]; bt = t; };
- totc += bc;
- fave[bt]++;
- s->selector[nSelectors] = bt;
- nSelectors++;
-
- /*--
- Increment the symbol frequencies for the selected table.
- --*/
- if (nGroups == 6 && 50 == ge-gs+1) {
- /*--- fast track the common case ---*/
-
-# define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++
-
- BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4);
- BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9);
- BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14);
- BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19);
- BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24);
- BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29);
- BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34);
- BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39);
- BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44);
- BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49);
-
-# undef BZ_ITUR
-
- } else {
- /*--- slow version which correctly handles all situations ---*/
- for (i = gs; i <= ge; i++)
- s->rfreq[bt][ mtfv[i] ]++;
- }
-
- gs = ge+1;
- }
- if (s->verbosity >= 3) {
- VPrintf2 ( " pass %d: size is %d, grp uses are ",
- iter+1, totc/8 );
- for (t = 0; t < nGroups; t++)
- VPrintf1 ( "%d ", fave[t] );
- VPrintf0 ( "\n" );
- }
-
- /*--
- Recompute the tables based on the accumulated frequencies.
- --*/
- for (t = 0; t < nGroups; t++)
- BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]),
- alphaSize, 20 );
- }
-
-
- AssertH( nGroups < 8, 3002 );
- AssertH( nSelectors < 32768 &&
- nSelectors <= (2 + (900000 / BZ_G_SIZE)),
- 3003 );
-
-
- /*--- Compute MTF values for the selectors. ---*/
- {
- UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp;
- for (i = 0; i < nGroups; i++) pos[i] = i;
- for (i = 0; i < nSelectors; i++) {
- ll_i = s->selector[i];
- j = 0;
- tmp = pos[j];
- while ( ll_i != tmp ) {
- j++;
- tmp2 = tmp;
- tmp = pos[j];
- pos[j] = tmp2;
- };
- pos[0] = tmp;
- s->selectorMtf[i] = j;
- }
- };
-
- /*--- Assign actual codes for the tables. --*/
- for (t = 0; t < nGroups; t++) {
- minLen = 32;
- maxLen = 0;
- for (i = 0; i < alphaSize; i++) {
- if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
- if (s->len[t][i] < minLen) minLen = s->len[t][i];
- }
- AssertH ( !(maxLen > 20), 3004 );
- AssertH ( !(minLen < 1), 3005 );
- BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]),
- minLen, maxLen, alphaSize );
- }
-
- /*--- Transmit the mapping table. ---*/
- {
- Bool inUse16[16];
- for (i = 0; i < 16; i++) {
- inUse16[i] = False;
- for (j = 0; j < 16; j++)
- if (s->inUse[i * 16 + j]) inUse16[i] = True;
- }
-
- nBytes = s->numZ;
- for (i = 0; i < 16; i++)
- if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0);
-
- for (i = 0; i < 16; i++)
- if (inUse16[i])
- for (j = 0; j < 16; j++) {
- if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0);
- }
-
- if (s->verbosity >= 3)
- VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes );
- }
-
- /*--- Now the selectors. ---*/
- nBytes = s->numZ;
- bsW ( s, 3, nGroups );
- bsW ( s, 15, nSelectors );
- for (i = 0; i < nSelectors; i++) {
- for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1);
- bsW(s,1,0);
- }
- if (s->verbosity >= 3)
- VPrintf1( "selectors %d, ", s->numZ-nBytes );
-
- /*--- Now the coding tables. ---*/
- nBytes = s->numZ;
-
- for (t = 0; t < nGroups; t++) {
- Int32 curr = s->len[t][0];
- bsW ( s, 5, curr );
- for (i = 0; i < alphaSize; i++) {
- while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ };
- while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ };
- bsW ( s, 1, 0 );
- }
- }
-
- if (s->verbosity >= 3)
- VPrintf1 ( "code lengths %d, ", s->numZ-nBytes );
-
- /*--- And finally, the block data proper ---*/
- nBytes = s->numZ;
- selCtr = 0;
- gs = 0;
- while (True) {
- if (gs >= s->nMTF) break;
- ge = gs + BZ_G_SIZE - 1;
- if (ge >= s->nMTF) ge = s->nMTF-1;
- AssertH ( s->selector[selCtr] < nGroups, 3006 );
-
- if (nGroups == 6 && 50 == ge-gs+1) {
- /*--- fast track the common case ---*/
- UInt16 mtfv_i;
- UChar* s_len_sel_selCtr
- = &(s->len[s->selector[selCtr]][0]);
- Int32* s_code_sel_selCtr
- = &(s->code[s->selector[selCtr]][0]);
-
-# define BZ_ITAH(nn) \
- mtfv_i = mtfv[gs+(nn)]; \
- bsW ( s, \
- s_len_sel_selCtr[mtfv_i], \
- s_code_sel_selCtr[mtfv_i] )
-
- BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4);
- BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9);
- BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14);
- BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19);
- BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24);
- BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29);
- BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34);
- BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39);
- BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44);
- BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49);
-
-# undef BZ_ITAH
-
- } else {
- /*--- slow version which correctly handles all situations ---*/
- for (i = gs; i <= ge; i++) {
- bsW ( s,
- s->len [s->selector[selCtr]] [mtfv[i]],
- s->code [s->selector[selCtr]] [mtfv[i]] );
- }
- }
-
-
- gs = ge+1;
- selCtr++;
- }
- AssertH( selCtr == nSelectors, 3007 );
-
- if (s->verbosity >= 3)
- VPrintf1( "codes %d\n", s->numZ-nBytes );
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_compressBlock ( EState* s, Bool is_last_block )
-{
- if (s->nblock > 0) {
-
- BZ_FINALISE_CRC ( s->blockCRC );
- s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31);
- s->combinedCRC ^= s->blockCRC;
- if (s->blockNo > 1) s->numZ = 0;
-
- if (s->verbosity >= 2)
- VPrintf4( " block %d: crc = 0x%8x, "
- "combined CRC = 0x%8x, size = %d\n",
- s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );
-
- BZ2_blockSort ( s );
- }
-
- s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]);
-
- /*-- If this is the first block, create the stream header. --*/
- if (s->blockNo == 1) {
- BZ2_bsInitWrite ( s );
- bsPutUChar ( s, 'B' );
- bsPutUChar ( s, 'Z' );
- bsPutUChar ( s, 'h' );
- bsPutUChar ( s, (UChar)('0' + s->blockSize100k) );
- }
-
- if (s->nblock > 0) {
-
- bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 );
- bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 );
- bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 );
-
- /*-- Now the block's CRC, so it is in a known place. --*/
- bsPutUInt32 ( s, s->blockCRC );
-
- /*--
- Now a single bit indicating (non-)randomisation.
- As of version 0.9.5, we use a better sorting algorithm
- which makes randomisation unnecessary. So always set
- the randomised bit to 'no'. Of course, the decoder
- still needs to be able to handle randomised blocks
- so as to maintain backwards compatibility with
- older versions of bzip2.
- --*/
- bsW(s,1,0);
-
- bsW ( s, 24, s->origPtr );
- generateMTFValues ( s );
- sendMTFValues ( s );
- }
-
-
- /*-- If this is the last block, add the stream trailer. --*/
- if (is_last_block) {
-
- bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 );
- bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 );
- bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
- bsPutUInt32 ( s, s->combinedCRC );
- if (s->verbosity >= 2)
- VPrintf1( " final combined CRC = 0x%x\n ", s->combinedCRC );
- bsFinishWrite ( s );
- }
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end compress.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/crctable.c b/mdk-stage1/bzlib/crctable.c
deleted file mode 100644
index c0ea3f769..000000000
--- a/mdk-stage1/bzlib/crctable.c
+++ /dev/null
@@ -1,148 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Table for doing CRCs ---*/
-/*--- crctable.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "bzlib_private.h"
-
-/*--
- I think this is an implementation of the AUTODIN-II,
- Ethernet & FDDI 32-bit CRC standard. Vaguely derived
- from code by Rob Warnock, in Section 51 of the
- comp.compression FAQ.
---*/
-
-UInt32 BZ2_crc32Table[256] = {
-
- /*-- Ugly, innit? --*/
-
- 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L,
- 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L,
- 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L,
- 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL,
- 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L,
- 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L,
- 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L,
- 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL,
- 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L,
- 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L,
- 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L,
- 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL,
- 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L,
- 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L,
- 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L,
- 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL,
- 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL,
- 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L,
- 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L,
- 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL,
- 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL,
- 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L,
- 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L,
- 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL,
- 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL,
- 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L,
- 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L,
- 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL,
- 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL,
- 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L,
- 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L,
- 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL,
- 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L,
- 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL,
- 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL,
- 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L,
- 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L,
- 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL,
- 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL,
- 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L,
- 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L,
- 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL,
- 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL,
- 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L,
- 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L,
- 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL,
- 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL,
- 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L,
- 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L,
- 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL,
- 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L,
- 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L,
- 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L,
- 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL,
- 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L,
- 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L,
- 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L,
- 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL,
- 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L,
- 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L,
- 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L,
- 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL,
- 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L,
- 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L
-};
-
-
-/*-------------------------------------------------------------*/
-/*--- end crctable.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/decompress.c b/mdk-stage1/bzlib/decompress.c
deleted file mode 100644
index 65cf75d8f..000000000
--- a/mdk-stage1/bzlib/decompress.c
+++ /dev/null
@@ -1,664 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Decompression machinery ---*/
-/*--- decompress.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------------*/
-static
-void makeMaps_d ( DState* s )
-{
- Int32 i;
- s->nInUse = 0;
- for (i = 0; i < 256; i++)
- if (s->inUse[i]) {
- s->seqToUnseq[s->nInUse] = i;
- s->nInUse++;
- }
-}
-
-
-/*---------------------------------------------------*/
-#define RETURN(rrr) \
- { retVal = rrr; goto save_state_and_return; };
-
-#define GET_BITS(lll,vvv,nnn) \
- case lll: s->state = lll; \
- while (True) { \
- if (s->bsLive >= nnn) { \
- UInt32 v; \
- v = (s->bsBuff >> \
- (s->bsLive-nnn)) & ((1 << nnn)-1); \
- s->bsLive -= nnn; \
- vvv = v; \
- break; \
- } \
- if (s->strm->avail_in == 0) RETURN(BZ_OK); \
- s->bsBuff \
- = (s->bsBuff << 8) | \
- ((UInt32) \
- (*((UChar*)(s->strm->next_in)))); \
- s->bsLive += 8; \
- s->strm->next_in++; \
- s->strm->avail_in--; \
- s->strm->total_in_lo32++; \
- if (s->strm->total_in_lo32 == 0) \
- s->strm->total_in_hi32++; \
- }
-
-#define GET_UCHAR(lll,uuu) \
- GET_BITS(lll,uuu,8)
-
-#define GET_BIT(lll,uuu) \
- GET_BITS(lll,uuu,1)
-
-/*---------------------------------------------------*/
-#define GET_MTF_VAL(label1,label2,lval) \
-{ \
- if (groupPos == 0) { \
- groupNo++; \
- if (groupNo >= nSelectors) \
- RETURN(BZ_DATA_ERROR); \
- groupPos = BZ_G_SIZE; \
- gSel = s->selector[groupNo]; \
- gMinlen = s->minLens[gSel]; \
- gLimit = &(s->limit[gSel][0]); \
- gPerm = &(s->perm[gSel][0]); \
- gBase = &(s->base[gSel][0]); \
- } \
- groupPos--; \
- zn = gMinlen; \
- GET_BITS(label1, zvec, zn); \
- while (1) { \
- if (zn > 20 /* the longest code */) \
- RETURN(BZ_DATA_ERROR); \
- if (zvec <= gLimit[zn]) break; \
- zn++; \
- GET_BIT(label2, zj); \
- zvec = (zvec << 1) | zj; \
- }; \
- if (zvec - gBase[zn] < 0 \
- || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \
- RETURN(BZ_DATA_ERROR); \
- lval = gPerm[zvec - gBase[zn]]; \
-}
-
-
-/*---------------------------------------------------*/
-Int32 BZ2_decompress ( DState* s )
-{
- UChar uc;
- Int32 retVal;
- Int32 minLen, maxLen;
- bz_stream* strm = s->strm;
-
- /* stuff that needs to be saved/restored */
- Int32 i;
- Int32 j;
- Int32 t;
- Int32 alphaSize;
- Int32 nGroups;
- Int32 nSelectors;
- Int32 EOB;
- Int32 groupNo;
- Int32 groupPos;
- Int32 nextSym;
- Int32 nblockMAX;
- Int32 nblock;
- Int32 es;
- Int32 N;
- Int32 curr;
- Int32 zt;
- Int32 zn;
- Int32 zvec;
- Int32 zj;
- Int32 gSel;
- Int32 gMinlen;
- Int32* gLimit;
- Int32* gBase;
- Int32* gPerm;
-
- if (s->state == BZ_X_MAGIC_1) {
- /*initialise the save area*/
- s->save_i = 0;
- s->save_j = 0;
- s->save_t = 0;
- s->save_alphaSize = 0;
- s->save_nGroups = 0;
- s->save_nSelectors = 0;
- s->save_EOB = 0;
- s->save_groupNo = 0;
- s->save_groupPos = 0;
- s->save_nextSym = 0;
- s->save_nblockMAX = 0;
- s->save_nblock = 0;
- s->save_es = 0;
- s->save_N = 0;
- s->save_curr = 0;
- s->save_zt = 0;
- s->save_zn = 0;
- s->save_zvec = 0;
- s->save_zj = 0;
- s->save_gSel = 0;
- s->save_gMinlen = 0;
- s->save_gLimit = NULL;
- s->save_gBase = NULL;
- s->save_gPerm = NULL;
- }
-
- /*restore from the save area*/
- i = s->save_i;
- j = s->save_j;
- t = s->save_t;
- alphaSize = s->save_alphaSize;
- nGroups = s->save_nGroups;
- nSelectors = s->save_nSelectors;
- EOB = s->save_EOB;
- groupNo = s->save_groupNo;
- groupPos = s->save_groupPos;
- nextSym = s->save_nextSym;
- nblockMAX = s->save_nblockMAX;
- nblock = s->save_nblock;
- es = s->save_es;
- N = s->save_N;
- curr = s->save_curr;
- zt = s->save_zt;
- zn = s->save_zn;
- zvec = s->save_zvec;
- zj = s->save_zj;
- gSel = s->save_gSel;
- gMinlen = s->save_gMinlen;
- gLimit = s->save_gLimit;
- gBase = s->save_gBase;
- gPerm = s->save_gPerm;
-
- retVal = BZ_OK;
-
- switch (s->state) {
-
- GET_UCHAR(BZ_X_MAGIC_1, uc);
- if (uc != 'B') RETURN(BZ_DATA_ERROR_MAGIC);
-
- GET_UCHAR(BZ_X_MAGIC_2, uc);
- if (uc != 'Z') RETURN(BZ_DATA_ERROR_MAGIC);
-
- GET_UCHAR(BZ_X_MAGIC_3, uc)
- if (uc != 'h') RETURN(BZ_DATA_ERROR_MAGIC);
-
- GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8)
- if (s->blockSize100k < '1' ||
- s->blockSize100k > '9') RETURN(BZ_DATA_ERROR_MAGIC);
- s->blockSize100k -= '0';
-
- if (s->smallDecompress) {
- s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
- s->ll4 = BZALLOC(
- ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)
- );
- if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);
- } else {
- s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) );
- if (s->tt == NULL) RETURN(BZ_MEM_ERROR);
- }
-
- GET_UCHAR(BZ_X_BLKHDR_1, uc);
-
- if (uc == 0x17) goto endhdr_2;
- if (uc != 0x31) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_2, uc);
- if (uc != 0x41) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_3, uc);
- if (uc != 0x59) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_4, uc);
- if (uc != 0x26) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_5, uc);
- if (uc != 0x53) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_BLKHDR_6, uc);
- if (uc != 0x59) RETURN(BZ_DATA_ERROR);
-
- s->currBlockNo++;
- if (s->verbosity >= 2)
- VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo );
-
- s->storedBlockCRC = 0;
- GET_UCHAR(BZ_X_BCRC_1, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_BCRC_2, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_BCRC_3, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_BCRC_4, uc);
- s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
-
- GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1);
-
- s->origPtr = 0;
- GET_UCHAR(BZ_X_ORIGPTR_1, uc);
- s->origPtr = (s->origPtr << 8) | ((Int32)uc);
- GET_UCHAR(BZ_X_ORIGPTR_2, uc);
- s->origPtr = (s->origPtr << 8) | ((Int32)uc);
- GET_UCHAR(BZ_X_ORIGPTR_3, uc);
- s->origPtr = (s->origPtr << 8) | ((Int32)uc);
-
- if (s->origPtr < 0)
- RETURN(BZ_DATA_ERROR);
- if (s->origPtr > 10 + 100000*s->blockSize100k)
- RETURN(BZ_DATA_ERROR);
-
- /*--- Receive the mapping table ---*/
- for (i = 0; i < 16; i++) {
- GET_BIT(BZ_X_MAPPING_1, uc);
- if (uc == 1)
- s->inUse16[i] = True; else
- s->inUse16[i] = False;
- }
-
- for (i = 0; i < 256; i++) s->inUse[i] = False;
-
- for (i = 0; i < 16; i++)
- if (s->inUse16[i])
- for (j = 0; j < 16; j++) {
- GET_BIT(BZ_X_MAPPING_2, uc);
- if (uc == 1) s->inUse[i * 16 + j] = True;
- }
- makeMaps_d ( s );
- if (s->nInUse == 0) RETURN(BZ_DATA_ERROR);
- alphaSize = s->nInUse+2;
-
- /*--- Now the selectors ---*/
- GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
- if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
- GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
- if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
- for (i = 0; i < nSelectors; i++) {
- j = 0;
- while (True) {
- GET_BIT(BZ_X_SELECTOR_3, uc);
- if (uc == 0) break;
- j++;
- if (j >= nGroups) RETURN(BZ_DATA_ERROR);
- }
- s->selectorMtf[i] = j;
- }
-
- /*--- Undo the MTF values for the selectors. ---*/
- {
- UChar pos[BZ_N_GROUPS], tmp, v;
- for (v = 0; v < nGroups; v++) pos[v] = v;
-
- for (i = 0; i < nSelectors; i++) {
- v = s->selectorMtf[i];
- tmp = pos[v];
- while (v > 0) { pos[v] = pos[v-1]; v--; }
- pos[0] = tmp;
- s->selector[i] = tmp;
- }
- }
-
- /*--- Now the coding tables ---*/
- for (t = 0; t < nGroups; t++) {
- GET_BITS(BZ_X_CODING_1, curr, 5);
- for (i = 0; i < alphaSize; i++) {
- while (True) {
- if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR);
- GET_BIT(BZ_X_CODING_2, uc);
- if (uc == 0) break;
- GET_BIT(BZ_X_CODING_3, uc);
- if (uc == 0) curr++; else curr--;
- }
- s->len[t][i] = curr;
- }
- }
-
- /*--- Create the Huffman decoding tables ---*/
- for (t = 0; t < nGroups; t++) {
- minLen = 32;
- maxLen = 0;
- for (i = 0; i < alphaSize; i++) {
- if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
- if (s->len[t][i] < minLen) minLen = s->len[t][i];
- }
- BZ2_hbCreateDecodeTables (
- &(s->limit[t][0]),
- &(s->base[t][0]),
- &(s->perm[t][0]),
- &(s->len[t][0]),
- minLen, maxLen, alphaSize
- );
- s->minLens[t] = minLen;
- }
-
- /*--- Now the MTF values ---*/
-
- EOB = s->nInUse+1;
- nblockMAX = 100000 * s->blockSize100k;
- groupNo = -1;
- groupPos = 0;
-
- for (i = 0; i <= 255; i++) s->unzftab[i] = 0;
-
- /*-- MTF init --*/
- {
- Int32 ii, jj, kk;
- kk = MTFA_SIZE-1;
- for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) {
- for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
- s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj);
- kk--;
- }
- s->mtfbase[ii] = kk + 1;
- }
- }
- /*-- end MTF init --*/
-
- nblock = 0;
- GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym);
-
- while (True) {
-
- if (nextSym == EOB) break;
-
- if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
-
- es = -1;
- N = 1;
- do {
- if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
- if (nextSym == BZ_RUNB) es = es + (1+1) * N;
- N = N * 2;
- GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym);
- }
- while (nextSym == BZ_RUNA || nextSym == BZ_RUNB);
-
- es++;
- uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ];
- s->unzftab[uc] += es;
-
- if (s->smallDecompress)
- while (es > 0) {
- if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
- s->ll16[nblock] = (UInt16)uc;
- nblock++;
- es--;
- }
- else
- while (es > 0) {
- if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
- s->tt[nblock] = (UInt32)uc;
- nblock++;
- es--;
- };
-
- continue;
-
- } else {
-
- if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
-
- /*-- uc = MTF ( nextSym-1 ) --*/
- {
- Int32 ii, jj, kk, pp, lno, off;
- UInt32 nn;
- nn = (UInt32)(nextSym - 1);
-
- if (nn < MTFL_SIZE) {
- /* avoid general-case expense */
- pp = s->mtfbase[0];
- uc = s->mtfa[pp+nn];
- while (nn > 3) {
- Int32 z = pp+nn;
- s->mtfa[(z) ] = s->mtfa[(z)-1];
- s->mtfa[(z)-1] = s->mtfa[(z)-2];
- s->mtfa[(z)-2] = s->mtfa[(z)-3];
- s->mtfa[(z)-3] = s->mtfa[(z)-4];
- nn -= 4;
- }
- while (nn > 0) {
- s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
- };
- s->mtfa[pp] = uc;
- } else {
- /* general case */
- lno = nn / MTFL_SIZE;
- off = nn % MTFL_SIZE;
- pp = s->mtfbase[lno] + off;
- uc = s->mtfa[pp];
- while (pp > s->mtfbase[lno]) {
- s->mtfa[pp] = s->mtfa[pp-1]; pp--;
- };
- s->mtfbase[lno]++;
- while (lno > 0) {
- s->mtfbase[lno]--;
- s->mtfa[s->mtfbase[lno]]
- = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1];
- lno--;
- }
- s->mtfbase[0]--;
- s->mtfa[s->mtfbase[0]] = uc;
- if (s->mtfbase[0] == 0) {
- kk = MTFA_SIZE-1;
- for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
- for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
- s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
- kk--;
- }
- s->mtfbase[ii] = kk + 1;
- }
- }
- }
- }
- /*-- end uc = MTF ( nextSym-1 ) --*/
-
- s->unzftab[s->seqToUnseq[uc]]++;
- if (s->smallDecompress)
- s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else
- s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]);
- nblock++;
-
- GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym);
- continue;
- }
- }
-
- /* Now we know what nblock is, we can do a better sanity
- check on s->origPtr.
- */
- if (s->origPtr < 0 || s->origPtr >= nblock)
- RETURN(BZ_DATA_ERROR);
-
- s->state_out_len = 0;
- s->state_out_ch = 0;
- BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
- s->state = BZ_X_OUTPUT;
- if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
-
- /*-- Set up cftab to facilitate generation of T^(-1) --*/
- s->cftab[0] = 0;
- for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
- for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
-
- if (s->smallDecompress) {
-
- /*-- Make a copy of cftab, used in generation of T --*/
- for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i];
-
- /*-- compute the T vector --*/
- for (i = 0; i < nblock; i++) {
- uc = (UChar)(s->ll16[i]);
- SET_LL(i, s->cftabCopy[uc]);
- s->cftabCopy[uc]++;
- }
-
- /*-- Compute T^(-1) by pointer reversal on T --*/
- i = s->origPtr;
- j = GET_LL(i);
- do {
- Int32 tmp = GET_LL(j);
- SET_LL(j, i);
- i = j;
- j = tmp;
- }
- while (i != s->origPtr);
-
- s->tPos = s->origPtr;
- s->nblock_used = 0;
- if (s->blockRandomised) {
- BZ_RAND_INIT_MASK;
- BZ_GET_SMALL(s->k0); s->nblock_used++;
- BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
- } else {
- BZ_GET_SMALL(s->k0); s->nblock_used++;
- }
-
- } else {
-
- /*-- compute the T^(-1) vector --*/
- for (i = 0; i < nblock; i++) {
- uc = (UChar)(s->tt[i] & 0xff);
- s->tt[s->cftab[uc]] |= (i << 8);
- s->cftab[uc]++;
- }
-
- s->tPos = s->tt[s->origPtr] >> 8;
- s->nblock_used = 0;
- if (s->blockRandomised) {
- BZ_RAND_INIT_MASK;
- BZ_GET_FAST(s->k0); s->nblock_used++;
- BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
- } else {
- BZ_GET_FAST(s->k0); s->nblock_used++;
- }
-
- }
-
- RETURN(BZ_OK);
-
-
-
- endhdr_2:
-
- GET_UCHAR(BZ_X_ENDHDR_2, uc);
- if (uc != 0x72) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_3, uc);
- if (uc != 0x45) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_4, uc);
- if (uc != 0x38) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_5, uc);
- if (uc != 0x50) RETURN(BZ_DATA_ERROR);
- GET_UCHAR(BZ_X_ENDHDR_6, uc);
- if (uc != 0x90) RETURN(BZ_DATA_ERROR);
-
- s->storedCombinedCRC = 0;
- GET_UCHAR(BZ_X_CCRC_1, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_CCRC_2, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_CCRC_3, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
- GET_UCHAR(BZ_X_CCRC_4, uc);
- s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
-
- s->state = BZ_X_IDLE;
- RETURN(BZ_STREAM_END);
-
- default: AssertH ( False, 4001 );
- }
-
- AssertH ( False, 4002 );
-
- save_state_and_return:
-
- s->save_i = i;
- s->save_j = j;
- s->save_t = t;
- s->save_alphaSize = alphaSize;
- s->save_nGroups = nGroups;
- s->save_nSelectors = nSelectors;
- s->save_EOB = EOB;
- s->save_groupNo = groupNo;
- s->save_groupPos = groupPos;
- s->save_nextSym = nextSym;
- s->save_nblockMAX = nblockMAX;
- s->save_nblock = nblock;
- s->save_es = es;
- s->save_N = N;
- s->save_curr = curr;
- s->save_zt = zt;
- s->save_zn = zn;
- s->save_zvec = zvec;
- s->save_zj = zj;
- s->save_gSel = gSel;
- s->save_gMinlen = gMinlen;
- s->save_gLimit = gLimit;
- s->save_gBase = gBase;
- s->save_gPerm = gPerm;
-
- return retVal;
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end decompress.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/huffman.c b/mdk-stage1/bzlib/huffman.c
deleted file mode 100644
index 8994f0bb9..000000000
--- a/mdk-stage1/bzlib/huffman.c
+++ /dev/null
@@ -1,232 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Huffman coding low-level stuff ---*/
-/*--- huffman.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "bzlib_private.h"
-
-/*---------------------------------------------------*/
-#define WEIGHTOF(zz0) ((zz0) & 0xffffff00)
-#define DEPTHOF(zz1) ((zz1) & 0x000000ff)
-#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3))
-
-#define ADDWEIGHTS(zw1,zw2) \
- (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \
- (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))
-
-#define UPHEAP(z) \
-{ \
- Int32 zz, tmp; \
- zz = z; tmp = heap[zz]; \
- while (weight[tmp] < weight[heap[zz >> 1]]) { \
- heap[zz] = heap[zz >> 1]; \
- zz >>= 1; \
- } \
- heap[zz] = tmp; \
-}
-
-#define DOWNHEAP(z) \
-{ \
- Int32 zz, yy, tmp; \
- zz = z; tmp = heap[zz]; \
- while (True) { \
- yy = zz << 1; \
- if (yy > nHeap) break; \
- if (yy < nHeap && \
- weight[heap[yy+1]] < weight[heap[yy]]) \
- yy++; \
- if (weight[tmp] < weight[heap[yy]]) break; \
- heap[zz] = heap[yy]; \
- zz = yy; \
- } \
- heap[zz] = tmp; \
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbMakeCodeLengths ( UChar *len,
- Int32 *freq,
- Int32 alphaSize,
- Int32 maxLen )
-{
- /*--
- Nodes and heap entries run from 1. Entry 0
- for both the heap and nodes is a sentinel.
- --*/
- Int32 nNodes, nHeap, n1, n2, i, j, k;
- Bool tooLong;
-
- Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ];
- Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ];
- Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ];
-
- for (i = 0; i < alphaSize; i++)
- weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
-
- while (True) {
-
- nNodes = alphaSize;
- nHeap = 0;
-
- heap[0] = 0;
- weight[0] = 0;
- parent[0] = -2;
-
- for (i = 1; i <= alphaSize; i++) {
- parent[i] = -1;
- nHeap++;
- heap[nHeap] = i;
- UPHEAP(nHeap);
- }
-
- AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 );
-
- while (nHeap > 1) {
- n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
- n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
- nNodes++;
- parent[n1] = parent[n2] = nNodes;
- weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]);
- parent[nNodes] = -1;
- nHeap++;
- heap[nHeap] = nNodes;
- UPHEAP(nHeap);
- }
-
- AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 );
-
- tooLong = False;
- for (i = 1; i <= alphaSize; i++) {
- j = 0;
- k = i;
- while (parent[k] >= 0) { k = parent[k]; j++; }
- len[i-1] = j;
- if (j > maxLen) tooLong = True;
- }
-
- if (! tooLong) break;
-
- for (i = 1; i < alphaSize; i++) {
- j = weight[i] >> 8;
- j = 1 + (j / 2);
- weight[i] = j << 8;
- }
- }
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbAssignCodes ( Int32 *code,
- UChar *length,
- Int32 minLen,
- Int32 maxLen,
- Int32 alphaSize )
-{
- Int32 n, vec, i;
-
- vec = 0;
- for (n = minLen; n <= maxLen; n++) {
- for (i = 0; i < alphaSize; i++)
- if (length[i] == n) { code[i] = vec; vec++; };
- vec <<= 1;
- }
-}
-
-
-/*---------------------------------------------------*/
-void BZ2_hbCreateDecodeTables ( Int32 *limit,
- Int32 *base,
- Int32 *perm,
- UChar *length,
- Int32 minLen,
- Int32 maxLen,
- Int32 alphaSize )
-{
- Int32 pp, i, j, vec;
-
- pp = 0;
- for (i = minLen; i <= maxLen; i++)
- for (j = 0; j < alphaSize; j++)
- if (length[j] == i) { perm[pp] = j; pp++; };
-
- for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0;
- for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
-
- for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1];
-
- for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0;
- vec = 0;
-
- for (i = minLen; i <= maxLen; i++) {
- vec += (base[i+1] - base[i]);
- limit[i] = vec-1;
- vec <<= 1;
- }
- for (i = minLen + 1; i <= maxLen; i++)
- base[i] = ((limit[i-1] + 1) << 1) - base[i];
-}
-
-
-/*-------------------------------------------------------------*/
-/*--- end huffman.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/bzlib/randtable.c b/mdk-stage1/bzlib/randtable.c
deleted file mode 100644
index a1fc82cfb..000000000
--- a/mdk-stage1/bzlib/randtable.c
+++ /dev/null
@@ -1,128 +0,0 @@
-
-/*-------------------------------------------------------------*/
-/*--- Table for randomising repetitive blocks ---*/
-/*--- randtable.c ---*/
-/*-------------------------------------------------------------*/
-
-/*--
- This file is a part of bzip2 and/or libbzip2, a program and
- library for lossless, block-sorting data compression.
-
- Copyright (C) 1996-2000 Julian R Seward. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. The origin of this software must not be misrepresented; you must
- not claim that you wrote the original software. If you use this
- software in a product, an acknowledgment in the product
- documentation would be appreciated but is not required.
-
- 3. Altered source versions must be plainly marked as such, and must
- not be misrepresented as being the original software.
-
- 4. The name of the author may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Julian Seward, Cambridge, UK.
- jseward@acm.org
- bzip2/libbzip2 version 1.0 of 21 March 2000
-
- This program is based on (at least) the work of:
- Mike Burrows
- David Wheeler
- Peter Fenwick
- Alistair Moffat
- Radford Neal
- Ian H. Witten
- Robert Sedgewick
- Jon L. Bentley
-
- For more information on these sources, see the manual.
---*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "bzlib_private.h"
-
-
-/*---------------------------------------------*/
-Int32 BZ2_rNums[512] = {
- 619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
- 985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
- 733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
- 419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
- 878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
- 862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
- 150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
- 170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
- 73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
- 909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
- 641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
- 161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
- 382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
- 98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
- 227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
- 469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
- 184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
- 715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
- 951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
- 652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
- 645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
- 609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
- 653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
- 411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
- 170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
- 857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
- 669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
- 944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
- 344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
- 897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
- 433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
- 686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
- 946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
- 978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
- 680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
- 707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
- 297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
- 134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
- 343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
- 140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
- 170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
- 369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
- 804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
- 896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
- 661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
- 768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
- 61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
- 372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
- 780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
- 920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
- 645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
- 936, 638
-};
-
-
-/*-------------------------------------------------------------*/
-/*--- end randtable.c ---*/
-/*-------------------------------------------------------------*/
diff --git a/mdk-stage1/cdrom.c b/mdk-stage1/cdrom.c
deleted file mode 100644
index c3ff2e802..000000000
--- a/mdk-stage1/cdrom.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/mount.h>
-#include "stage1.h"
-#include "frontend.h"
-#include "modules.h"
-#include "probing.h"
-#include "log.h"
-#include "mount.h"
-
-#include "cdrom.h"
-
-
-static int mount_that_cd_device(char * dev_name)
-{
- char device_fullname[50];
-
- strcpy(device_fullname, "/dev/");
- strcat(device_fullname, dev_name);
-
- return my_mount(device_fullname, IMAGE_LOCATION, "iso9660", 0);
-}
-
-
-static int test_that_cd()
-{
- return access(IMAGE_LOCATION LIVE_LOCATION, R_OK);
-}
-
-
-static enum return_type try_with_device(char * dev_name, char * dev_model);
-
-static enum return_type do_with_device(char * dev_name, char * dev_model)
-{
- if (test_that_cd()) {
- enum return_type results;
- umount(IMAGE_LOCATION);
- results = ask_yes_no("That CDROM disc does not seem to be a " DISTRIB_NAME " Installation CDROM.\nRetry with another disc?");
- if (results == RETURN_OK)
- return try_with_device(dev_name, dev_model);
- return results;
- }
-
- log_message("found a " DISTRIB_NAME " CDROM, good news!");
-
- if (IS_SPECIAL_STAGE2 || ramdisk_possible())
- load_ramdisk(); /* we don't care about return code, we'll do it live if we failed */
-
- if (IS_RESCUE)
- umount(IMAGE_LOCATION);
-
- method_name = strdup("cdrom");
- return RETURN_OK;
-}
-
-static enum return_type try_with_device(char * dev_name, char * dev_model)
-{
- wait_message("Trying to access a CDROM disc (drive %s)", dev_model);
-
- if (mount_that_cd_device(dev_name) == -1) {
- enum return_type results;
- char msg[500];
- unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
- remove_wait_message();
-
- snprintf(msg, sizeof(msg), "I can't access a " DISTRIB_NAME " Installation disc in your CDROM drive (%s).\nRetry?", dev_model);
- results = ask_yes_no(msg);
- if (results == RETURN_OK)
- return try_with_device(dev_name, dev_model);
- return results;
- }
- remove_wait_message();
-
- return do_with_device(dev_name, dev_model);
-}
-
-enum return_type cdrom_prepare(void)
-{
- char ** medias, ** ptr, ** medias_models;
- char * choice;
- int i, count = 0;
- enum return_type results;
-
- my_insmod("ide-cd", ANY_DRIVER_TYPE, NULL);
- my_insmod("sr_mod", ANY_DRIVER_TYPE, NULL);
-
- get_medias(CDROM, &medias, &medias_models);
-
- ptr = medias;
- while (ptr && *ptr) {
- count++;
- ptr++;
- }
-
- if (count == 0) {
- stg1_error_message("No CDROM device found.");
- i = ask_insmod(SCSI_ADAPTERS);
- if (i == RETURN_BACK)
- return RETURN_BACK;
- return cdrom_prepare();
- }
-
- if (count == 1) {
- results = try_with_device(*medias, *medias_models);
- if (results == RETURN_OK)
- return RETURN_OK;
- i = ask_insmod(SCSI_ADAPTERS);
- if (i == RETURN_BACK)
- return RETURN_BACK;
- return cdrom_prepare();
- }
-
- if (IS_AUTOMATIC) {
- char ** model = medias_models;
- ptr = medias;
- while (ptr && *ptr) {
- wait_message("Trying to access " DISTRIB_NAME " CDROM disc (drive %s)", *model);
- if (mount_that_cd_device(*ptr) != -1) {
- if (!test_that_cd()) {
- remove_wait_message();
- return do_with_device(*ptr, *model);
- }
- else
- umount(IMAGE_LOCATION);
- }
- remove_wait_message();
- ptr++;
- model++;
- }
- unset_param(MODE_AUTOMATIC);
- return cdrom_prepare();
- }
- else {
- results = ask_from_list_comments("Please choose the CDROM drive to use for the installation.", medias, medias_models, &choice);
- if (results == RETURN_OK) {
- char ** model = medias_models;
- ptr = medias;
- while (ptr && *ptr && model && *model) {
- if (!strcmp(*ptr, choice))
- break;
- ptr++;
- model++;
- }
- results = try_with_device(choice, *model);
- } else
- return results;
- }
-
- if (results == RETURN_OK)
- return RETURN_OK;
- if (results == RETURN_BACK)
- return cdrom_prepare();
-
- i = ask_insmod(SCSI_ADAPTERS);
- if (i == RETURN_BACK)
- return RETURN_BACK;
- return cdrom_prepare();
-}
diff --git a/mdk-stage1/cdrom.h b/mdk-stage1/cdrom.h
deleted file mode 100644
index 639487eed..000000000
--- a/mdk-stage1/cdrom.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#ifndef _CDROM_H_
-#define _CDROM_H_
-
-#include "stage1.h"
-
-enum return_type cdrom_prepare(void);
-
-#endif
diff --git a/mdk-stage1/config-stage1.h b/mdk-stage1/config-stage1.h
deleted file mode 100644
index 3af38a446..000000000
--- a/mdk-stage1/config-stage1.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef _CONFIG_STAGE1_H_
-#define _CONFIG_STAGE1_H_
-
-#define _GNU_SOURCE 1
-
-
-/* If we have more than that amount of memory (in Mbytes), we assume we can load the second stage as a ramdisk */
-#define MEM_LIMIT_RAMDISK 52
-
-/* If we have more than that amount of memory (in Mbytes), we assume we can load the rescue as a ramdisk */
-#define MEM_LIMIT_RESCUE 40
-
-#define DISTRIB_NAME "Mandrake Linux"
-
-#define RAMDISK_COMPRESSION_RATIO 1.95
-
-#define LIVE_LOCATION "/Mandrake/mdkinst/"
-#define RAMDISK_LOCATION "/Mandrake/base/"
-#define IMAGE_LOCATION "/tmp/image"
-#define STAGE2_LOCATION "/tmp/stage2"
-
-/* user-definable (in Makefile): DISABLE_NETWORK, DISABLE_DISK, DISABLE_CDROM, DISABLE_PCMCIA */
-
-
-/* some factorizing for disabling more features */
-
-#ifdef DISABLE_DISK
-#ifdef DISABLE_CDROM
-#define DISABLE_MEDIAS
-#endif
-#endif
-
-
-#endif
diff --git a/mdk-stage1/dhcp.c b/mdk-stage1/dhcp.c
deleted file mode 100644
index 32c7a932b..000000000
--- a/mdk-stage1/dhcp.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-/*
- * Portions from GRUB -- GRand Unified Bootloader
- * Copyright (C) 2000 Free Software Foundation, Inc.
- */
-
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <arpa/inet.h>
-#include <net/route.h>
-#include <errno.h>
-#include <net/ethernet.h>
-#include <netinet/ip.h>
-#include <netinet/udp.h>
-#include <sys/time.h>
-#include <time.h>
-#include <fcntl.h>
-#include <sys/poll.h>
-
-#include "stage1.h"
-#include "log.h"
-#include "network.h"
-#include "frontend.h"
-#include "automatic.h"
-
-#include "dhcp.h"
-
-
-typedef int bp_int32;
-typedef short bp_int16;
-
-#define BOOTP_OPTION_NETMASK 1
-#define BOOTP_OPTION_GATEWAY 3
-#define BOOTP_OPTION_DNS 6
-#define BOOTP_OPTION_HOSTNAME 12
-#define BOOTP_OPTION_DOMAIN 15
-#define BOOTP_OPTION_BROADCAST 28
-
-#define DHCP_OPTION_REQADDR 50
-#define DHCP_OPTION_LEASE 51
-#define DHCP_OPTION_TYPE 53
-#define DHCP_OPTION_SERVER 54
-#define DHCP_OPTION_OPTIONREQ 55
-#define DHCP_OPTION_MAXSIZE 57
-
-#define DHCP_OPTION_CLIENT_IDENTIFIER 61
-
-#define BOOTP_CLIENT_PORT 68
-#define BOOTP_SERVER_PORT 67
-
-#define BOOTP_OPCODE_REQUEST 1
-#define BOOTP_OPCODE_REPLY 2
-
-#define DHCP_TYPE_DISCOVER 1
-#define DHCP_TYPE_OFFER 2
-#define DHCP_TYPE_REQUEST 3
-#define DHCP_TYPE_ACK 5
-#define DHCP_TYPE_RELEASE 7
-
-#define BOOTP_VENDOR_LENGTH 64
-#define DHCP_VENDOR_LENGTH 340
-
-struct bootp_request {
- char opcode;
- char hw;
- char hwlength;
- char hopcount;
- bp_int32 id;
- bp_int16 secs;
- bp_int16 flags;
- bp_int32 ciaddr, yiaddr, server_ip, bootp_gw_ip;
- char hwaddr[16];
- char servername[64];
- char bootfile[128];
- char vendor[DHCP_VENDOR_LENGTH];
-} ;
-
-static const char vendor_cookie[] = { 99, 130, 83, 99, 255 };
-
-
-static unsigned int verify_checksum(void * buf2, int length2)
-{
- unsigned int csum = 0;
- unsigned short * sp;
-
- for (sp = (unsigned short *) buf2; length2 > 0; (length2 -= 2), sp++)
- csum += *sp;
-
- while (csum >> 16)
- csum = (csum & 0xffff) + (csum >> 16);
-
- return (csum == 0xffff);
-}
-
-
-static int initial_setup_interface(char * device, int s) {
- struct sockaddr_in * addrp;
- struct ifreq req;
- struct rtentry route;
- int true = 1;
-
- addrp = (struct sockaddr_in *) &req.ifr_addr;
-
- strcpy(req.ifr_name, device);
- addrp->sin_family = AF_INET;
- addrp->sin_port = 0;
- memset(&addrp->sin_addr, 0, sizeof(addrp->sin_addr));
-
- req.ifr_flags = 0; /* take it down */
- if (ioctl(s, SIOCSIFFLAGS, &req)) {
- log_perror("SIOCSIFFLAGS (downing)");
- return -1;
- }
-
- addrp->sin_family = AF_INET;
- addrp->sin_addr.s_addr = htonl(0);
- if (ioctl(s, SIOCSIFADDR, &req)) {
- log_perror("SIOCSIFADDR");
- return -1;
- }
-
- req.ifr_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING;
- if (ioctl(s, SIOCSIFFLAGS, &req)) {
- log_perror("SIOCSIFFLAGS (upping)");
- return -1;
- }
-
- memset(&route, 0, sizeof(route));
- memcpy(&route.rt_gateway, addrp, sizeof(*addrp));
-
- addrp->sin_family = AF_INET;
- addrp->sin_port = 0;
- addrp->sin_addr.s_addr = INADDR_ANY;
- memcpy(&route.rt_dst, addrp, sizeof(*addrp));
- memcpy(&route.rt_genmask, addrp, sizeof(*addrp));
-
- route.rt_dev = device;
- route.rt_flags = RTF_UP;
- route.rt_metric = 0;
-
- if (ioctl(s, SIOCADDRT, &route)) {
- if (errno != EEXIST) {
- close(s);
- log_perror("SIOCADDRT");
- return -1;
- }
- }
-
- if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &true, sizeof(true))) {
- close(s);
- log_perror("setsockopt");
- return -1;
- }
-
- /* I need to sleep a bit in order for kernel to finish init of the
- network device; this would allow to not send further multiple
- dhcp requests when only one is needed. */
- wait_message("Bringing up networking...");
- sleep(2);
- remove_wait_message();
-
- return 0;
-}
-
-
-void set_missing_ip_info(struct interface_info * intf)
-{
- bp_int32 ipNum = *((bp_int32 *) &intf->ip);
- bp_int32 nmNum;
-
- if (intf->netmask.s_addr == 0)
- inet_aton(guess_netmask(inet_ntoa(intf->ip)), &intf->netmask);
-
- nmNum = *((bp_int32 *) &intf->netmask);
-
- if (intf->broadcast.s_addr == 0)
- *((bp_int32 *) &intf->broadcast) = (ipNum & nmNum) | ~(nmNum);
-
- if (intf->network.s_addr == 0)
- *((bp_int32 *) &intf->network) = ipNum & nmNum;
-}
-
-static void parse_reply(struct bootp_request * breq, struct interface_info * intf)
-{
- unsigned char * chptr;
- unsigned char option, length;
-
- if (breq->bootfile && strlen(breq->bootfile) > 0)
- stage2_kickstart = strdup(breq->bootfile);
-
- memcpy(&intf->ip, &breq->yiaddr, 4);
-
- chptr = breq->vendor;
- chptr += 4;
- while (*chptr != 0xFF && (void *) chptr < (void *) breq->vendor + DHCP_VENDOR_LENGTH) {
- char tmp_str[500];
- option = *chptr++;
- if (!option)
- continue;
- length = *chptr++;
-
- switch (option) {
- case BOOTP_OPTION_DNS:
- memcpy(&dns_server, chptr, sizeof(dns_server));
- log_message("got dns %s", inet_ntoa(dns_server));
- if (length >= sizeof(dns_server)*2) {
- memcpy(&dns_server2, chptr+sizeof(dns_server), sizeof(dns_server2));
- log_message("got dns2 %s", inet_ntoa(dns_server2));
- }
- break;
-
- case BOOTP_OPTION_NETMASK:
- memcpy(&intf->netmask, chptr, sizeof(intf->netmask));
- log_message("got netmask %s", inet_ntoa(intf->netmask));
- break;
-
- case BOOTP_OPTION_DOMAIN:
- memcpy(tmp_str, chptr, length);
- tmp_str[length] = '\0';
- domain = strdup(tmp_str);
- log_message("got domain %s", domain);
- break;
-
- case BOOTP_OPTION_BROADCAST:
- memcpy(&intf->broadcast, chptr, sizeof(intf->broadcast));
- log_message("got broadcast %s", inet_ntoa(intf->broadcast));
- break;
-
- case BOOTP_OPTION_GATEWAY:
- memcpy(&gateway, chptr, sizeof(gateway));
- log_message("got gateway %s", inet_ntoa(gateway));
- break;
-
- case BOOTP_OPTION_HOSTNAME:
- memcpy(tmp_str, chptr, length);
- tmp_str[length] = '\0';
- hostname = strdup(tmp_str);
- log_message("got hostname %s", hostname);
- break;
-
- }
-
- chptr += length;
- }
-
- set_missing_ip_info(intf);
-}
-
-
-static void init_vendor_codes(struct bootp_request * breq) {
- memcpy(breq->vendor, vendor_cookie, sizeof(vendor_cookie));
-}
-
-static char gen_hwaddr[16];
-
-static int prepare_request(struct bootp_request * breq, int sock, char * device)
-{
- struct ifreq req;
-
- memset(breq, 0, sizeof(*breq));
-
- breq->opcode = BOOTP_OPCODE_REQUEST;
-
- strcpy(req.ifr_name, device);
- if (ioctl(sock, SIOCGIFHWADDR, &req)) {
- log_perror("SIOCSIFHWADDR");
- return -1;
- }
-
- breq->hw = 1; /* ethernet */
- breq->hwlength = IFHWADDRLEN;
- memcpy(breq->hwaddr, req.ifr_hwaddr.sa_data, IFHWADDRLEN);
- memcpy(gen_hwaddr, req.ifr_hwaddr.sa_data, IFHWADDRLEN);
-
- breq->hopcount = 0;
-
- init_vendor_codes(breq);
-
- return 0;
-}
-
-static int get_vendor_code(struct bootp_request * bresp, unsigned char option, void * data)
-{
- unsigned char * chptr;
- unsigned int length, theOption;
-
- chptr = bresp->vendor + 4;
- while (*chptr != 0xFF && *chptr != option) {
- theOption = *chptr++;
- if (!theOption)
- continue;
- length = *chptr++;
- chptr += length;
- }
-
- if (*chptr++ == 0xff)
- return 1;
-
- length = *chptr++;
- memcpy(data, chptr, length);
-
- return 0;
-}
-
-
-static unsigned long currticks(void)
-{
- struct timeval tv;
- unsigned long csecs;
- unsigned long ticks_per_csec, ticks_per_usec;
-
- /* Note: 18.2 ticks/sec. */
-
- gettimeofday (&tv, 0);
- csecs = tv.tv_sec / 10;
- ticks_per_csec = csecs * 182;
- ticks_per_usec = (((tv.tv_sec - csecs * 10) * 1000000 + tv.tv_usec) * 182 / 10000000);
- return ticks_per_csec + ticks_per_usec;
-}
-
-
-#define BACKOFF_LIMIT 7
-#define TICKS_PER_SEC 18
-#define MAX_ARP_RETRIES 4
-
-static void rfc951_sleep(int exp)
-{
- static long seed = 0;
- long q;
- unsigned long tmo;
-
- if (exp > BACKOFF_LIMIT)
- exp = BACKOFF_LIMIT;
-
- if (!seed)
- /* Initialize linear congruential generator. */
- seed = (currticks () + *(long *) &gen_hwaddr + ((short *) gen_hwaddr)[2]);
-
- /* Simplified version of the LCG given in Bruce Scheier's
- "Applied Cryptography". */
- q = seed / 53668;
- if ((seed = 40014 * (seed - 53668 * q) - 12211 * q) < 0)
- seed += 2147483563l;
-
- /* Compute mask. */
- for (tmo = 63; tmo <= 60 * TICKS_PER_SEC && --exp > 0; tmo = 2 * tmo + 1)
- ;
-
- /* Sleep. */
- log_message("<sleep>");
-
- for (tmo = (tmo & seed) + currticks (); currticks () < tmo;);
-}
-
-
-static int handle_transaction(int s, struct bootp_request * breq, struct bootp_request * bresp,
- struct sockaddr_in * server_addr, int dhcp_type)
-{
- struct pollfd polls;
- int i, j;
- int retry = 1;
- int sin;
- char eth_packet[ETH_FRAME_LEN];
- struct iphdr * ip_hdr;
- struct udphdr * udp_hdr;
- unsigned char type;
- unsigned long starttime;
- int timeout = 1;
-
- breq->id = starttime = currticks();
- breq->secs = 0;
-
- sin = socket(AF_PACKET, SOCK_DGRAM, ntohs(ETH_P_IP));
- if (sin < 0) {
- log_perror("af_packet socket");
- return -1;
- }
-
- while (retry <= MAX_ARP_RETRIES) {
- i = sizeof(*breq);
-
- if (sendto(s, breq, i, 0, (struct sockaddr *) server_addr, sizeof(*server_addr)) != i) {
- close(s);
- log_perror("sendto");
- return -1;
- }
-
- polls.fd = sin;
- polls.events = POLLIN;
-
- while (poll(&polls, 1, timeout*1000) == 1) {
-
- if ((j = recv(sin, eth_packet, sizeof(eth_packet), 0)) == -1) {
- log_perror("recv");
- continue;
- }
-
- /* We need to do some basic sanity checking of the header */
- if (j < (signed)(sizeof(*ip_hdr) + sizeof(*udp_hdr)))
- continue;
-
- ip_hdr = (void *) eth_packet;
- if (!verify_checksum(ip_hdr, sizeof(*ip_hdr)))
- continue;
-
- if (ntohs(ip_hdr->tot_len) > j)
- continue;
-
- j = ntohs(ip_hdr->tot_len);
-
- if (ip_hdr->protocol != IPPROTO_UDP)
- continue;
-
- udp_hdr = (void *) (eth_packet + sizeof(*ip_hdr));
-
- if (ntohs(udp_hdr->source) != BOOTP_SERVER_PORT)
- continue;
-
- if (ntohs(udp_hdr->dest) != BOOTP_CLIENT_PORT)
- continue;
- /* Go on with this packet; it looks sane */
-
- /* Originally copied sizeof (*bresp) - this is a security
- problem due to a potential underflow of the source
- buffer. Also, it trusted that the packet was properly
- 0xFF terminated, which is not true in the case of the
- DHCP server on Cisco 800 series ISDN router. */
-
- memset (bresp, 0xFF, sizeof (*bresp));
- memcpy (bresp, (char *) udp_hdr + sizeof (*udp_hdr), j - sizeof (*ip_hdr) - sizeof (*udp_hdr));
-
- /* sanity checks */
- if (bresp->id != breq->id)
- continue;
- if (bresp->opcode != BOOTP_OPCODE_REPLY)
- continue;
- if (bresp->hwlength != breq->hwlength)
- continue;
- if (memcmp(bresp->hwaddr, breq->hwaddr, bresp->hwlength))
- continue;
- if (get_vendor_code(bresp, DHCP_OPTION_TYPE, &type) || type != dhcp_type)
- continue;
- if (memcmp(bresp->vendor, vendor_cookie, 4))
- continue;
- return 0;
- }
- rfc951_sleep(retry);
- breq->secs = htons ((currticks () - starttime) / 20);
- retry++;
- timeout *= 2;
- if (timeout > 5)
- timeout = 5;
- }
-
- return -1;
-}
-
-static void add_vendor_code(struct bootp_request * breq, unsigned char option, unsigned char length, void * data)
-{
- unsigned char * chptr;
- int theOption, theLength;
-
- chptr = breq->vendor;
- chptr += 4;
- while (*chptr != 0xFF && *chptr != option) {
- theOption = *chptr++;
- if (!theOption) continue;
- theLength = *chptr++;
- chptr += theLength;
- }
-
- *chptr++ = option;
- *chptr++ = length;
- memcpy(chptr, data, length);
- chptr[length] = 0xff;
-}
-
-
-char * dhcp_hostname = NULL;
-char * dhcp_domain = NULL;
-
-enum return_type perform_dhcp(struct interface_info * intf)
-{
- int s, i;
- struct sockaddr_in server_addr;
- struct sockaddr_in client_addr;
- struct sockaddr_in broadcast_addr;
- struct bootp_request breq, bresp;
- unsigned char messageType;
- unsigned int lease;
- short aShort;
- int num_options;
- char requested_options[50];
- char * client_id_str, * client_id_hwaddr;
-
- if (strncmp(intf->device, "eth", 3)) {
- stg1_error_message("DHCP available only for Ethernet networking.");
- return RETURN_ERROR;
- }
-
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s < 0) {
- log_perror("socket");
- return RETURN_ERROR;
- }
-
- {
- enum return_type results;
- char * questions[] = { "Host name", "Domain name", NULL };
- char * questions_auto[] = { "hostname", "domain" };
- static char ** answers = NULL;
- char * boulet;
-
- client_id_str = client_id_hwaddr = NULL;
-
- results = ask_from_entries_auto("If the DHCP server needs to know you by name; please fill in this information. "
- "Valid answers are for example: `mybox' for hostname and `mynetwork.com' for "
- "domain name, for a machine called `mybox.mynetwork.com' on the Internet.",
- questions, &answers, 32, questions_auto, NULL);
- if (results == RETURN_OK)
- {
- dhcp_hostname = answers[0];
- if ((boulet = strchr(dhcp_hostname, '.')) != NULL)
- boulet[0] = '\0';
- dhcp_domain = answers[1];
-
- if (*dhcp_hostname && *dhcp_domain) {
- /* if we have both, then create client id from them */
- client_id_str = malloc(1 + strlen(dhcp_hostname) + 1 + strlen(dhcp_domain) + 1);
- client_id_str[0] = '\0';
- sprintf(client_id_str+1, "%s.%s", dhcp_hostname, dhcp_domain);
- }
- }
- }
-
- if (initial_setup_interface(intf->device, s) != 0) {
- close(s);
- return RETURN_ERROR;
- }
-
- if (prepare_request(&breq, s, intf->device) != 0) {
- close(s);
- return RETURN_ERROR;
- }
-
- messageType = DHCP_TYPE_DISCOVER;
- add_vendor_code(&breq, DHCP_OPTION_TYPE, 1, &messageType);
-
- /* add pieces needed to have DDNS/DHCP IP selection based on requested name */
- if (dhcp_hostname && *dhcp_hostname) { /* pick client id form based on absence or presence of domain name */
- if (*dhcp_domain) /* alternate style <hostname>.<domainname> */
- add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, strlen(client_id_str+1)+1, client_id_str);
- else { /* usual style (aka windows / dhcpcd) */
- /* but put MAC in form required for client identifier first */
- client_id_hwaddr = malloc(IFHWADDRLEN+2);
- client_id_hwaddr[0] = 1; /* set flag for ethernet */
- memcpy(client_id_hwaddr+1, gen_hwaddr, IFHWADDRLEN);
- add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, IFHWADDRLEN+1, client_id_hwaddr);
- }
- /* this is the one that the dhcp server really wants for DDNS updates */
- add_vendor_code(&breq, BOOTP_OPTION_HOSTNAME, strlen(dhcp_hostname), dhcp_hostname);
- log_message("DHCP: telling server to use name = %s", dhcp_hostname);
- }
-
- memset(&client_addr.sin_addr, 0, sizeof(&client_addr.sin_addr));
- client_addr.sin_family = AF_INET;
- client_addr.sin_port = htons(BOOTP_CLIENT_PORT); /* bootp client */
-
- if (bind(s, (struct sockaddr *) &client_addr, sizeof(client_addr))) {
- log_perror("bind");
- return RETURN_ERROR;
- }
-
- broadcast_addr.sin_family = AF_INET;
- broadcast_addr.sin_port = htons(BOOTP_SERVER_PORT); /* bootp server */
- memset(&broadcast_addr.sin_addr, 0xff, sizeof(broadcast_addr.sin_addr)); /* broadcast */
-
- log_message("DHCP: sending DISCOVER");
-
- wait_message("Sending DHCP request...");
- i = handle_transaction(s, &breq, &bresp, &broadcast_addr, DHCP_TYPE_OFFER);
- remove_wait_message();
-
- if (i != 0) {
- stg1_error_message("No DHCP reply received.");
- close(s);
- return RETURN_ERROR;
- }
-
- server_addr.sin_family = AF_INET;
- server_addr.sin_port = htons(BOOTP_SERVER_PORT); /* bootp server */
- if (get_vendor_code(&bresp, DHCP_OPTION_SERVER, &server_addr.sin_addr)) {
- close(s);
- log_message("DHCPOFFER didn't include server address");
- return RETURN_ERROR;
- }
-
- init_vendor_codes(&breq);
- messageType = DHCP_TYPE_REQUEST;
- add_vendor_code(&breq, DHCP_OPTION_TYPE, 1, &messageType);
- add_vendor_code(&breq, DHCP_OPTION_SERVER, 4, &server_addr.sin_addr);
- add_vendor_code(&breq, DHCP_OPTION_REQADDR, 4, &bresp.yiaddr);
-
- /* if used the first time, then have to use it again */
- if (dhcp_hostname && *dhcp_hostname) { /* add pieces needed to have DDNS/DHCP IP selection based on requested name */
- if (dhcp_domain && *dhcp_domain) /* alternate style */
- add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, strlen(client_id_str+1)+1, client_id_str);
- else /* usual style (aka windows / dhcpcd) */
- add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, IFHWADDRLEN+1, client_id_hwaddr);
- /* this is the one that the dhcp server really wants for DDNS updates */
- add_vendor_code(&breq, BOOTP_OPTION_HOSTNAME, strlen(dhcp_hostname), dhcp_hostname);
- }
-
- aShort = ntohs(sizeof(struct bootp_request));
- add_vendor_code(&breq, DHCP_OPTION_MAXSIZE, 2, &aShort);
-
- num_options = 0;
- requested_options[num_options++] = BOOTP_OPTION_NETMASK;
- requested_options[num_options++] = BOOTP_OPTION_GATEWAY;
- requested_options[num_options++] = BOOTP_OPTION_DNS;
- requested_options[num_options++] = BOOTP_OPTION_DOMAIN;
- requested_options[num_options++] = BOOTP_OPTION_BROADCAST;
- add_vendor_code(&breq, DHCP_OPTION_OPTIONREQ, num_options, requested_options);
-
- /* request a lease of 1 hour */
- i = htonl(60 * 60);
- add_vendor_code(&breq, DHCP_OPTION_LEASE, 4, &i);
-
- log_message("DHCP: sending REQUEST");
-
- i = handle_transaction(s, &breq, &bresp, &broadcast_addr, DHCP_TYPE_ACK);
-
- if (i != 0) {
- close(s);
- return RETURN_ERROR;
- }
-
- if (get_vendor_code(&bresp, DHCP_OPTION_LEASE, &lease)) {
- log_message("failed to get lease time\n");
- return RETURN_ERROR;
- }
- lease = ntohl(lease);
-
- close(s);
-
- intf->netmask.s_addr = 0;
- intf->broadcast.s_addr = 0;
- intf->network.s_addr = 0;
-
- parse_reply(&bresp, intf);
-
- return RETURN_OK;
-}
diff --git a/mdk-stage1/dhcp.h b/mdk-stage1/dhcp.h
deleted file mode 100644
index 71d062e9c..000000000
--- a/mdk-stage1/dhcp.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * View the homepage: http://us.mandrakesoft.com/~gc/html/stage1.html
- *
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from GRUB -- GRand Unified Bootloader
- * Copyright (C) 2000 Free Software Foundation, Inc.
- *
- * Itself based on etherboot-4.6.4 by Martin Renters.
- *
- */
-
-#ifndef _DHCP_H_
-#define _DHCP_H_
-
-#include "stage1.h"
-#include "network.h"
-
-enum return_type perform_dhcp(struct interface_info * intf);
-
-extern char * dhcp_hostname;
-
-#endif
diff --git a/mdk-stage1/dietlibc/.cvsignore b/mdk-stage1/dietlibc/.cvsignore
deleted file mode 100644
index 7c88cb004..000000000
--- a/mdk-stage1/dietlibc/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-t
-elftrunc
-mapfile
-t1
-load
-compile
-bin-alpha
-bin-arm
-bin-i386
-bin-mips
-bin-ppc
-bin-sparc
diff --git a/mdk-stage1/dietlibc/AUTHOR b/mdk-stage1/dietlibc/AUTHOR
deleted file mode 100644
index 6d8ab1a05..000000000
--- a/mdk-stage1/dietlibc/AUTHOR
+++ /dev/null
@@ -1 +0,0 @@
-Felix von Leitner <felix-dietlibc@fefe.de>
diff --git a/mdk-stage1/dietlibc/Makefile b/mdk-stage1/dietlibc/Makefile
deleted file mode 100644
index b6e7b2783..000000000
--- a/mdk-stage1/dietlibc/Makefile
+++ /dev/null
@@ -1,146 +0,0 @@
-ARCH=$(shell uname -m | sed 's/i[4-9]86/i386/')
-
-OBJDIR=bin-$(ARCH)
-
-all: $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/librpc.a $(OBJDIR)/diet
-
-CFLAGS=-pipe
-CROSS=
-
-VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:librpc:libregex:syscalls.c
-
-SYSCALLOBJ=$(patsubst syscalls.s/%.S,$(OBJDIR)/%.o,$(wildcard syscalls.s/*.S))
-
-LIBOBJ=$(patsubst lib/%.c,$(OBJDIR)/%.o,$(wildcard lib/*.c))
-LIBUGLYOBJ=$(patsubst libugly/%.c,$(OBJDIR)/%.o,$(wildcard libugly/*.c))
-LIBSTDIOOBJ=$(patsubst libstdio/%.c,$(OBJDIR)/%.o,$(wildcard libstdio/*.c))
-LIBCRUFTOBJ=$(patsubst libcruft/%.c,$(OBJDIR)/%.o,$(wildcard libcruft/*.c))
-LIBCRYPTOBJ=$(patsubst libcrypt/%.c,$(OBJDIR)/%.o,$(wildcard libcrypt/*.c))
-LIBSHELLOBJ=$(patsubst libshell/%.c,$(OBJDIR)/%.o,$(wildcard libshell/*.c))
-
-LIBRPCOBJ=$(patsubst librpc/%.c,$(OBJDIR)/%.o,$(wildcard librpc/*.c))
-LIBREGEXOBJ=$(patsubst libregex/%.c,$(OBJDIR)/%.o,$(wildcard libregex/*.c))
-
-include $(ARCH)/Makefile.add
-
-ifeq ($(CFLAGS),-pipe)
-CFLAGS+=-O -fomit-frame-pointer
-endif
-
-ifneq ($(DEBUG),)
-CFLAGS = -g
-COMMENT = :
-endif
-CFLAGS += -Wall -Wno-switch
-
-PWD=$(shell pwd)
-
-.SUFFIXES:
-.SUFFIXES: .S .c
-
-$(OBJDIR):
- mkdir $@
-
-% :: %,v
-
-$(OBJDIR)/%.o: %.S
- $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
-
-$(OBJDIR)/%.o: %.c
- $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
-
-DIETLIBC_OBJ = $(SYSCALLOBJ) $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
-$(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) \
-$(OBJDIR)/__longjmp.o $(OBJDIR)/setjmp.o $(OBJDIR)/unified.o \
-$(OBJDIR)/mmap.o $(OBJDIR)/clone.o
-
-$(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o
- $(CROSS)ar cru $@ $(DIETLIBC_OBJ)
-
-$(OBJDIR)/librpc.a: $(LIBRPCOBJ)
- $(CROSS)ar cru $@ $(LIBRPCOBJ)
-
-LIBLATIN1_OBJS=$(patsubst liblatin1/%.c,$(OBJDIR)/%.o,$(wildcard liblatin1/*.c))
-$(OBJDIR)/liblatin1.a: $(LIBLATIN1_OBJS)
- $(CROSS)ar cru $@ $^
-
-$(OBJDIR)/libdietc.so: $(OBJDIR)/dietlibc.a
- $(CROSS)ld -whole-archive -shared -o $@ $^
-
-$(SYSCALLOBJ): syscalls.h
-
-$(OBJDIR)/diet: diet.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a
- $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(PWD)\"
- $(CROSS)strip -R .comment -R .note $@
-
-$(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load
-
-$(OBJDIR)/compile:
- echo 'exec gcc $(CFLAGS) -I$(PWD)/$(OBJDIR)/include -c $${1+"$$@"}' > $@
- chmod 755 $@
-
-$(OBJDIR)/load:
- echo 'main="$$1"; shift; exec gcc -nostdlib -o "$$main" $(PWD)/$(OBJDIR)/start.o "$$main".o $${1+"$$@"} $(PWD)/$(OBJDIR)/dietlibc.a -lgcc' > $@
- chmod 755 $@
-
-clean:
- rm -f *.o *.a t t1 compile load exports mapfile libdietc.so
- rm -rf bin-*
-
-tar: clean
- rm -f armv4l
- ln -sf arm armv4l
- cd ..; tar cvvf dietlibc.tar.bz2 dietlibc --use=bzip2 --exclude CVS
-
-$(OBJDIR)/exports: $(OBJDIR)/dietlibc.a
- nm -g $(OBJDIR)/dietlibc.a | grep -w T | awk '{ print $$3 }' | sort -u > $(OBJDIR)/exports
-
-.PHONY: t t1
-t:
- $(CROSS)$(CC) -g $(CFLAGS) -fno-builtin -nostdlib -Iinclude -o t t.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a -lgcc -Wl,-Map,mapfile
-
-t1:
- $(CROSS)$(CC) -g -o t1 t.c
-
-install: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/diet
- cp $(OBJDIR)/start.o $(INSTALLPREFIX)$(prefix)/lib/dietstart.o
- cp $(OBJDIR)/dietlibc.a $(INSTALLPREFIX)$(prefix)/lib/libdietc.a
- cp $(OBJDIR)/liblatin1.a $(INSTALLPREFIX)$(prefix)/lib/libdietlatin1.a
- cp $(OBJDIR)/diet $(INSTALLPREFIX)$(prefix)/bin/diet
-
-.PHONY: sparc ppc mips arm alpha i386
-
-arm sparc ppc alpha i386:
- $(MAKE) ARCH=$@ CROSS=$@-linux- all t bin-$@/libdietc.so
-
-mips:
- $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all t bin-$@/libdietc.so
-
-cross:
- $(MAKE) arm sparc ppc alpha i386 mips
-
-
-# these depend on dietfeatures.h for large file backward compatibility
-$(OBJDIR)/__fstat64.o $(OBJDIR)/__lstat64.o $(OBJDIR)/__stat64.o: dietfeatures.h
-
-# these depend on dietfeatures.h for thread support
-$(OBJDIR)/alloc.o $(OBJDIR)/perror.o $(OBJDIR)/logging.o $(OBJDIR)/unified.o: dietfeatures.h
-
-# these depend on dietfeatures.h for linker warnings
-$(OBJDIR)/assert_fail.o $(OBJDIR)/sprintf.o $(OBJDIR)/vsnprintf.o $(OBJDIR)/___div.o $(OBJDIR)/fflush.o $(OBJDIR)/setvbuf.o $(OBJDIR)/system.o $(OBJDIR)/sendfile.o $(OBJDIR)/setenv.o: dietfeatures.h
-
-# these depend on dietfeatures.h for buffered stdio
-fclose.o $(OBJDIR)/fdglue.o $(OBJDIR)/fflush.o $(OBJDIR)/fgetc.o $(OBJDIR)/fputc.o $(OBJDIR)/fread.o $(OBJDIR)/fseek.o $(OBJDIR)/printf.o $(OBJDIR)/setvbuf.o $(OBJDIR)/stderr.o $(OBJDIR)/stdin.o $(OBJDIR)/stdout.o $(OBJDIR)/fwrite.o $(OBJDIR)/puts.o: dietfeatures.h
-
-# these depend on dietfeatures.h for fast string routines
-strcasecmp.o $(OBJDIR)/strcat.o $(OBJDIR)/strchr.o $(OBJDIR)/strcmp.o $(OBJDIR)/strcpy.o $(OBJDIR)/strlen.o $(OBJDIR)/strncasecmp.o $(OBJDIR)/strncat.o $(OBJDIR)/strrchr.o: dietfeatures.h
-
-# these depend on dietfeatures.h for /proc
-$(OBJDIR)/tty.o: dietfeatures.h
-
-# these depend on dietfeatures.h for ungetc support ;-)
-$(OBJDIR)/ungetc.o: dietfeatures.h
-
-# these depend on dietfeatures.h for WANT_TZFILE_PARSER
-$(OBJDIR)/localtime_r.o: dietfeatures.h
diff --git a/mdk-stage1/dietlibc/README b/mdk-stage1/dietlibc/README
deleted file mode 100644
index ce9838832..000000000
--- a/mdk-stage1/dietlibc/README
+++ /dev/null
@@ -1,43 +0,0 @@
-diet libc to statically link programs that don't need all the bloat
-from glibc.
-
-malloc, printf and scanf contributed from Olaf Dreesen.
-
-To compile:
-
- $ make
-
-make should compile the diet libc itself without warnings. In addition
-to the diet libc, the default make target includes t, which is a test
-program and probably contains code which produces warnings. You can
-safely ignore them.
-
-When make is done, it will have created dietlibc.a in bin-i386 (or
-bin-ppc, bin-alpha, bin-sparc, bin-ppc or bin-arm, depending on your
-architecture). In that directory you will also find a program called
-"diet", which you need to copy in a directory in your $PATH:
-
- # install bin-i386/diet /usr/local/bin
-
-Then you can compile programs by prepending diet to the command line,
-i.e.
-
- $ diet gcc -s -Os -pipe -o t t.c
-
-diet is cross-compiler friendly and can also be used like this:
-
- $ diet sparc-linux-gcc -o t t.c
-
-diet will then link against dietlibc.a from bin-sparc, of course.
-diet comes with a man page (diet.1), which you can copy to an
-appropriate location, too:
-
- # cp diet.1 /usr/local/man/man1
-
-After you compiled the diet libc successfully, I invite you to check out
-the embedded utils (http://www.fefe.de/embutils/) and the diet libc
-binary repository (ftp://foobar.math.fu-berlin.de/pub/dietlibc/), too.
-The embedded utils are small replacements for common utilities like mv,
-chown, ls, and even a small tar that can extract tar files. The binary
-repository contains a few utilities I linked against the diet libc, for
-example gzip, bzip2 and fdisk.
diff --git a/mdk-stage1/dietlibc/alpha/Makefile.add b/mdk-stage1/dietlibc/alpha/Makefile.add
deleted file mode 100644
index 10ff0faef..000000000
--- a/mdk-stage1/dietlibc/alpha/Makefile.add
+++ /dev/null
@@ -1,5 +0,0 @@
-
-CFLAGS+=-Os -Iinclude -fomit-frame-pointer -fstrict-aliasing
-VPATH:=alpha:syscalls.s:$(VPATH)
-
-LIBOBJ+=$(patsubst %,$(OBJDIR)/%,divq.o divl.o remq.o reml.o seteuid.o __time.o)
diff --git a/mdk-stage1/dietlibc/alpha/__longjmp.S b/mdk-stage1/dietlibc/alpha/__longjmp.S
deleted file mode 100644
index d86d76717..000000000
--- a/mdk-stage1/dietlibc/alpha/__longjmp.S
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifdef __alpha__
-
-#include <setjmp.h>
-
-.text
-.align 2
-
-.global __longjmp
-__longjmp:
- mov $17, $0 /* a1 -> v0 */
-
- ldq $9, (JB_S0*8) ($16) /* s0 */
- ldq $10, (JB_S1*8) ($16) /* s1 */
- ldq $11, (JB_S2*8) ($16) /* s2 */
- ldq $12, (JB_S3*8) ($16) /* s3 */
- ldq $13, (JB_S4*8) ($16) /* s4 */
- ldq $14, (JB_S5*8) ($16) /* s5 */
-
- ldq $26, (JB_PC*8) ($16) /* ra */
- ldq $fp, (JB_FP*8) ($16) /* fp */
- ldq $1, (JB_SP*8) ($16) /* sp */
-
- ldt $f2, (JB_F2*8) ($16) /* f2 */
- ldt $f3, (JB_F3*8) ($16) /* f3 */
- ldt $f4, (JB_F4*8) ($16) /* f4 */
- ldt $f5, (JB_F5*8) ($16) /* f5 */
- ldt $f6, (JB_F6*8) ($16) /* f6 */
- ldt $f7, (JB_F7*8) ($16) /* f7 */
- ldt $f8, (JB_F8*8) ($16) /* f8 */
- ldt $f9, (JB_F9*8) ($16) /* f9 */
-
- cmoveq $0, 0x1, $0
- mov $1, $sp
-
- ret $31, ($26), 1
-
-
-#endif
diff --git a/mdk-stage1/dietlibc/alpha/__time.c b/mdk-stage1/dietlibc/alpha/__time.c
deleted file mode 100644
index 07275e0e3..000000000
--- a/mdk-stage1/dietlibc/alpha/__time.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <time.h>
-#include <sys/time.h>
-
-time_t time(time_t *foo) {
- struct timeval tv;
- time_t tmp=(time_t)-1;
- if (gettimeofday(&tv,0)==0)
- tmp=(time_t)tv.tv_sec;
- if (foo) *foo=tmp;
- return tmp;
-}
diff --git a/mdk-stage1/dietlibc/alpha/accept.S b/mdk-stage1/dietlibc/alpha/accept.S
deleted file mode 100644
index 459c45d7a..000000000
--- a/mdk-stage1/dietlibc/alpha/accept.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(accept,accept,__libc_accept)
diff --git a/mdk-stage1/dietlibc/alpha/bind.S b/mdk-stage1/dietlibc/alpha/bind.S
deleted file mode 100644
index 86a04cb70..000000000
--- a/mdk-stage1/dietlibc/alpha/bind.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(bind,bind)
diff --git a/mdk-stage1/dietlibc/alpha/clone.S b/mdk-stage1/dietlibc/alpha/clone.S
deleted file mode 100644
index b7e32d707..000000000
--- a/mdk-stage1/dietlibc/alpha/clone.S
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "syscalls.h"
-#include <asm/errno.h>
-
-.text
-.align 2
-.weak clone
-clone:
-.global __clone
-.type __clone,@function
-__clone:
- ldiq $0, EINVAL
- beq $16, .Lerror
- beq $17, .Lerror
-
- subq $17, 16, $17
- stq $16, 0($17)
- stq $19, 8($17)
- mov $18, $16
-
- lda $0, __NR_clone($31)
- callsys
- bne $19, .Lerror
-
- beq $0, .Lstart_thread
-
- ret $31, ($26), 0x01
-
-.Lerror:
- jmp error_unified_syscall
-
-.Lstart_thread:
- clr $fp
-
- ldq $27, 0($sp)
- ldq $16, 8($sp)
-
- jsr $26, ($27), 0x04
-
- ldgp $gp, 0($26)
- mov $0, $16
- jsr $26, exit
-
diff --git a/mdk-stage1/dietlibc/alpha/connect.S b/mdk-stage1/dietlibc/alpha/connect.S
deleted file mode 100644
index c191ca808..000000000
--- a/mdk-stage1/dietlibc/alpha/connect.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(connect,connect,__libc_connect)
diff --git a/mdk-stage1/dietlibc/alpha/divl.S b/mdk-stage1/dietlibc/alpha/divl.S
deleted file mode 100644
index 3af22a5e8..000000000
--- a/mdk-stage1/dietlibc/alpha/divl.S
+++ /dev/null
@@ -1,101 +0,0 @@
-/* taken from glibc 2.2 */
-
- .set noreorder
- .set noat
-
- .ent __divlu
- .globl __divlu
-
- .align 3
-__divlu :
- lda $30 , - 48 ($30 )
- .frame $30 , 48 , $23 , 0
- .prologue 0
-.Ludiv:
- stq $1 , 0($30 )
- zapnot $25 ,15, $1
- stq $2 , 8($30 )
- zapnot $24 ,15, $2
- stq $0 , 16($30 )
- clr $27
- stq $3 , 24($30 )
- ldiq $0 , 1
- stq $4 ,32($30 )
- beq $1 , .Ldivbyzero
-
- .align 3
-
-
-1: cmpult $1 , $2 , $at
- s8addq $1 , $31 , $1
- s8addq $0 , $31 , $0
- bne $at , 1b
-
-
-
-3: addq $27 ,$0 , $4
- srl $0 , 1, $0
- cmpule $1 , $2 , $at
- subq $2 , $1 , $3
- cmovne $at ,$4 , $27
- srl $1 , 1, $1
- cmovne $at , $3 , $2
- bne $0 , 3b
-
-.Ldone: ldq $1 , 0($30 )
- ldq $2 , 8($30 )
- ldq $0 , 16($30 )
- ldq $3 , 24($30 )
- ldq $4 ,32($30 )
- lda $30 , 48 ($30 )
- ret $31 , ($23 ), 1
-
-.Ldivbyzero:
- mov $16 , $3
- ldiq $16 , -2
- call_pal 170
- mov $3 , $16
- clr $27
- br .Ldone
-
- .end __divlu
-
- .ent __divl
- .globl __divl
-
- .align 3
-__divl :
- lda $30 , - 48 ($30 )
- .frame $30 , 48 , $23 , 0
- .prologue 0
- or $24 , $25 , $at
- sextl $at , $at
- bge $at , .Ludiv
-
-
- stq $24 , 0($30 )
- negl $24 , $at
- stq $25 , 8($30 )
- cmovge $at , $at , $24
- stq $23 , 16($30 )
- negl $25 , $at
- stq $3 , 24($30 )
- cmovge $at , $at , $25
-
-
- bsr $23 , __divlu
-
-
- ldq $24 , 0($30 )
- ldq $25 , 8($30 )
- xor $24 , $25 , $at
- negl $27 , $3
- sextl $at , $at
- ldq $23 , 16($30 )
- cmovlt $at , $3 , $27
- ldq $3 , 24($30 )
-
- lda $30 , 48 ($30 )
- ret $31 , ($23 ), 1
-
- .end __divl
diff --git a/mdk-stage1/dietlibc/alpha/divq.S b/mdk-stage1/dietlibc/alpha/divq.S
deleted file mode 100644
index cf70862c4..000000000
--- a/mdk-stage1/dietlibc/alpha/divq.S
+++ /dev/null
@@ -1,102 +0,0 @@
-/* taken from glibc 2.2 */
-
- .set noreorder
- .set noat
-
- .ent __divqu
- .globl __divqu
-
- .align 3
-__divqu :
- lda $30 , - 48 ($30 )
- .frame $30 , 48 , $23 , 0
- .prologue 0
-$udiv:
- stq $1 , 0($30 )
- mov $25 , $1
- stq $2 , 8($30 )
- mov $24 , $2
- stq $0 , 16($30 )
- clr $27
- stq $3 , 24($30 )
- ldiq $0 , 1
- stq $4 ,32($30 )
- beq $1 , $divbyzero
-
- .align 3
-
-
-1: cmpult $1 , $2 , $at
- blt $1 , 2f
- addq $1 , $1 , $1
- addq $0 , $0 , $0
- bne $at , 1b
- unop
-2:
-3: addq $27 ,$0 , $4
- srl $0 , 1, $0
- cmpule $1 , $2 , $at
- subq $2 , $1 , $3
- cmovne $at ,$4 , $27
- srl $1 , 1, $1
- cmovne $at , $3 , $2
- bne $0 , 3b
-
-$done: ldq $1 , 0($30 )
- ldq $2 , 8($30 )
- ldq $0 , 16($30 )
- ldq $3 , 24($30 )
- ldq $4 ,32($30 )
- lda $30 , 48 ($30 )
- ret $31 , ($23 ), 1
-
-$divbyzero:
- mov $16 , $3
- ldiq $16 , -2
- call_pal 170
- mov $3 , $16
- clr $27
- br $done
-
- .end __divqu
-
- .ent __divq
- .globl __divq
-
- .align 3
-__divq :
- lda $30 , - 48 ($30 )
- .frame $30 , 48 , $23 , 0
- .prologue 0
- or $24 , $25 , $at
-
- bge $at , $udiv
-
-
- stq $24 , 0($30 )
- negq $24 , $at
- stq $25 , 8($30 )
- cmovge $at , $at , $24
- stq $23 , 16($30 )
- negq $25 , $at
- stq $3 , 24($30 )
- cmovge $at , $at , $25
-
-
- bsr $23 , __divqu
-
-
- ldq $24 , 0($30 )
- ldq $25 , 8($30 )
- xor $24 , $25 , $at
- negq $27 , $3
-
- ldq $23 , 16($30 )
- cmovlt $at , $3 , $27
- ldq $3 , 24($30 )
-
- lda $30 , 48 ($30 )
- ret $31 , ($23 ), 1
-
- .end __divq
-
diff --git a/mdk-stage1/dietlibc/alpha/getegid.S b/mdk-stage1/dietlibc/alpha/getegid.S
deleted file mode 100644
index 89c35d45e..000000000
--- a/mdk-stage1/dietlibc/alpha/getegid.S
+++ /dev/null
@@ -1,11 +0,0 @@
-.text
-.align 2
-.global getegid
-getegid:
- lda $sp,-8($sp)
- stq $26, 0($sp)
- jsr getgid
- ldq $26, 0($sp)
- lda $sp, 8($sp)
- cmovge $0, $20, $0
- ret
diff --git a/mdk-stage1/dietlibc/alpha/geteuid.S b/mdk-stage1/dietlibc/alpha/geteuid.S
deleted file mode 100644
index 087ca7348..000000000
--- a/mdk-stage1/dietlibc/alpha/geteuid.S
+++ /dev/null
@@ -1,11 +0,0 @@
-.text
-.align 2
-.global geteuid
-geteuid:
- lda $sp,-8($sp)
- stq $26, 0($sp)
- jsr getuid
- ldq $26, 0($sp)
- lda $sp, 8($sp)
- cmovge $0, $20, $0
- ret
diff --git a/mdk-stage1/dietlibc/alpha/getgid.S b/mdk-stage1/dietlibc/alpha/getgid.S
deleted file mode 100644
index 7350082f3..000000000
--- a/mdk-stage1/dietlibc/alpha/getgid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getxgid,getgid)
diff --git a/mdk-stage1/dietlibc/alpha/getpeername.S b/mdk-stage1/dietlibc/alpha/getpeername.S
deleted file mode 100644
index 3b3f48b1a..000000000
--- a/mdk-stage1/dietlibc/alpha/getpeername.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getpeername,getpeername)
diff --git a/mdk-stage1/dietlibc/alpha/getpid.S b/mdk-stage1/dietlibc/alpha/getpid.S
deleted file mode 100644
index d8b3523b2..000000000
--- a/mdk-stage1/dietlibc/alpha/getpid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getxpid,getpid)
diff --git a/mdk-stage1/dietlibc/alpha/getppid.S b/mdk-stage1/dietlibc/alpha/getppid.S
deleted file mode 100644
index e181268c3..000000000
--- a/mdk-stage1/dietlibc/alpha/getppid.S
+++ /dev/null
@@ -1,11 +0,0 @@
-.text
-.align 2
-.global getppid
-getppid:
- lda $sp,-8($sp)
- stq $26, 0($sp)
- jsr getpid
- ldq $26, 0($sp)
- lda $sp, 8($sp)
- cmovge $0, $20, $0
- ret
diff --git a/mdk-stage1/dietlibc/alpha/getsockname.S b/mdk-stage1/dietlibc/alpha/getsockname.S
deleted file mode 100644
index 2727d88da..000000000
--- a/mdk-stage1/dietlibc/alpha/getsockname.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getsockname,getsockname)
diff --git a/mdk-stage1/dietlibc/alpha/getsockopt.S b/mdk-stage1/dietlibc/alpha/getsockopt.S
deleted file mode 100644
index 44b4a910a..000000000
--- a/mdk-stage1/dietlibc/alpha/getsockopt.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getsockopt,getsockopt)
diff --git a/mdk-stage1/dietlibc/alpha/getuid.S b/mdk-stage1/dietlibc/alpha/getuid.S
deleted file mode 100644
index fcb5570c2..000000000
--- a/mdk-stage1/dietlibc/alpha/getuid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getxuid,getuid)
diff --git a/mdk-stage1/dietlibc/alpha/listen.S b/mdk-stage1/dietlibc/alpha/listen.S
deleted file mode 100644
index 1102831d4..000000000
--- a/mdk-stage1/dietlibc/alpha/listen.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(listen,listen)
diff --git a/mdk-stage1/dietlibc/alpha/mmap.S b/mdk-stage1/dietlibc/alpha/mmap.S
deleted file mode 100644
index 2e57fbb74..000000000
--- a/mdk-stage1/dietlibc/alpha/mmap.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(mmap,mmap)
diff --git a/mdk-stage1/dietlibc/alpha/msgctl.S b/mdk-stage1/dietlibc/alpha/msgctl.S
deleted file mode 100644
index d7caed2cc..000000000
--- a/mdk-stage1/dietlibc/alpha/msgctl.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(msgctl,msgctl)
diff --git a/mdk-stage1/dietlibc/alpha/msgget.S b/mdk-stage1/dietlibc/alpha/msgget.S
deleted file mode 100644
index 518d67ac4..000000000
--- a/mdk-stage1/dietlibc/alpha/msgget.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(msgget,msgget)
diff --git a/mdk-stage1/dietlibc/alpha/msgrcv.S b/mdk-stage1/dietlibc/alpha/msgrcv.S
deleted file mode 100644
index ab62e6c30..000000000
--- a/mdk-stage1/dietlibc/alpha/msgrcv.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(msgrcv,msgrcv)
diff --git a/mdk-stage1/dietlibc/alpha/msgsnd.S b/mdk-stage1/dietlibc/alpha/msgsnd.S
deleted file mode 100644
index 890a996a2..000000000
--- a/mdk-stage1/dietlibc/alpha/msgsnd.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(msgsnd,msgsnd)
diff --git a/mdk-stage1/dietlibc/alpha/pipe.S b/mdk-stage1/dietlibc/alpha/pipe.S
deleted file mode 100644
index 3dfef10bf..000000000
--- a/mdk-stage1/dietlibc/alpha/pipe.S
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "syscalls.h"
-
-.text
-.align 2
-.global pipe
-.type pipe,@function
-pipe:
- lda $0, __NR_pipe($31)
- callsys
- bne $19, .Lerror
- stl $0, 0($16)
- stl $20, 4($16)
- clr $0
- ret $31, ($26), 0x01
-.Lerror:
- br error_unified_syscall
-
diff --git a/mdk-stage1/dietlibc/alpha/recv.S b/mdk-stage1/dietlibc/alpha/recv.S
deleted file mode 100644
index 17664f2e2..000000000
--- a/mdk-stage1/dietlibc/alpha/recv.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(recv,recv,__libc_recv)
diff --git a/mdk-stage1/dietlibc/alpha/recvfrom.S b/mdk-stage1/dietlibc/alpha/recvfrom.S
deleted file mode 100644
index d8e3922af..000000000
--- a/mdk-stage1/dietlibc/alpha/recvfrom.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(recvfrom,recvfrom,__libc_recvfrom)
diff --git a/mdk-stage1/dietlibc/alpha/recvmsg.S b/mdk-stage1/dietlibc/alpha/recvmsg.S
deleted file mode 100644
index 6ce87eebb..000000000
--- a/mdk-stage1/dietlibc/alpha/recvmsg.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(recvmsg,recvmsg)
diff --git a/mdk-stage1/dietlibc/alpha/reml.S b/mdk-stage1/dietlibc/alpha/reml.S
deleted file mode 100644
index 2d89e3280..000000000
--- a/mdk-stage1/dietlibc/alpha/reml.S
+++ /dev/null
@@ -1,101 +0,0 @@
-/* taken from glibc 2.2 */
-
- .set noreorder
- .set noat
-
- .ent __remlu
- .globl __remlu
-
- .align 3
-__remlu :
- lda $30 , -32($30)
- .frame $30 , 32 , $23 , 0
- .prologue 0
-.Ludiv:
- stq $1 , 0($30)
- zapnot $25 , 15 , $1
- stq $2 , 8($30)
- zapnot $24 , 15 , $27
- stq $0 , 16($30)
- clr $2
- stq $3 , 24($30)
- ldiq $0 , 1
-
- beq $1 , .Ldivbyzero
-
- .align 3
-
-
-1: cmpult $1 , $27 , $at
- s8addq $1 , $31 , $1
- s8addq $0 , $31 , $0
- bne $at , 1b
-
-
-
-3:
- srl $0 , 1 , $0
- cmpule $1 , $27 , $at
- subq $27 , $1 , $3
-
- srl $1 , 1 , $1
- cmovne $at , $3 , $27
- bne $0 , 3b
-
-.Ldone: ldq $1 , 0($30)
- ldq $2 , 8($30)
- ldq $0 , 16($30)
- ldq $3 , 24($30)
-
- lda $30 , 32($30)
- ret $31 , ($23), 1
-
-.Ldivbyzero:
- mov $16 , $3
- ldiq $16 , -2
- call_pal 170
- mov $3 , $16
- clr $27
- br .Ldone
-
- .end __remlu
-
- .ent __reml
- .globl __reml
-
- .align 3
-__reml :
- lda $30 , - 32 ($30 )
- .frame $30 , 32 , $23 , 0
- .prologue 0
- or $24 , $25 , $at
- sextl $at , $at
- bge $at , .Ludiv
-
-
- stq $24 , 0($30 )
- negl $24 , $at
- stq $25 , 8($30 )
- cmovge $at , $at , $24
- stq $23 , 16($30 )
- negl $25 , $at
- stq $3 , 24($30 )
- cmovge $at , $at , $25
-
-
- bsr $23 , __remlu
-
-
- ldq $24 , 0($30 )
- ldq $25 , 8($30 )
- mov $24 , $at
- negl $27 , $3
- sextl $at , $at
- ldq $23 , 16($30 )
- cmovlt $at , $3 , $27
- ldq $3 , 24($30 )
-
- lda $30 , 32 ($30 )
- ret $31 , ($23 ), 1
-
- .end __reml
diff --git a/mdk-stage1/dietlibc/alpha/remq.S b/mdk-stage1/dietlibc/alpha/remq.S
deleted file mode 100644
index 713484da3..000000000
--- a/mdk-stage1/dietlibc/alpha/remq.S
+++ /dev/null
@@ -1,97 +0,0 @@
-/* taken from glibc 2.2 */
-
- .set noreorder
- .set noat
-
- .ent __remqu
- .globl __remqu
-
- .align 3
-__remqu :
- lda $30 , - 32 ($30 )
- .frame $30 , 32 , $23 , 0
- .prologue 0
-.Ludiv:
- stq $1 , 0($30 )
- mov $25 , $1
- stq $2 , 8($30 )
- mov $24 , $27
- stq $0 , 16($30 )
- clr $2
- stq $3 , 24($30 )
- ldiq $0 , 1
-
- beq $1 , .Ldivbyzero
-
- .align 3
-
-1: cmpult $1 , $27 , $at
- blt $1 , 2f
- addq $1 , $1 , $1
- addq $0 , $0 , $0
- bne $at , 1b
- unop
-2:
-3:
- srl $0 , 1, $0
- cmpule $1 , $27 , $at
- subq $27 , $1 , $3
-
- srl $1 , 1, $1
- cmovne $at , $3 , $27
- bne $0 , 3b
-
-.Ldone: ldq $1 , 0($30 )
- ldq $2 , 8($30 )
- ldq $0 , 16($30 )
- ldq $3 , 24($30 )
-
- lda $30 , 32 ($30 )
- ret $31 , ($23 ), 1
-
-.Ldivbyzero:
- mov $16 , $3
- ldiq $16 , -2
- call_pal 170
- mov $3 , $16
- clr $27
- br .Ldone
-
- .end __remqu
-
- .ent __remq
- .globl __remq
-
- .align 3
-__remq :
- lda $30 , - 32 ($30 )
- .frame $30 , 32 , $23 , 0
- .prologue 0
- or $24 , $25 , $at
-
- bge $at , .Ludiv
-
- stq $24 , 0($30 )
- negq $24 , $at
- stq $25 , 8($30 )
- cmovge $at , $at , $24
- stq $23 , 16($30 )
- negq $25 , $at
- stq $3 , 24($30 )
- cmovge $at , $at , $25
-
- bsr $23 , __remqu
-
- ldq $24 , 0($30 )
- ldq $25 , 8($30 )
- mov $24 , $at
- negq $27 , $3
-
- ldq $23 , 16($30 )
- cmovlt $at , $3 , $27
- ldq $3 , 24($30 )
-
- lda $30 , 32 ($30 )
- ret $31 , ($23 ), 1
-
- .end __remq
diff --git a/mdk-stage1/dietlibc/alpha/semctl.S b/mdk-stage1/dietlibc/alpha/semctl.S
deleted file mode 100644
index e215ed955..000000000
--- a/mdk-stage1/dietlibc/alpha/semctl.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(semctl,semctl)
diff --git a/mdk-stage1/dietlibc/alpha/semget.S b/mdk-stage1/dietlibc/alpha/semget.S
deleted file mode 100644
index 67f488546..000000000
--- a/mdk-stage1/dietlibc/alpha/semget.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(semget,semget)
diff --git a/mdk-stage1/dietlibc/alpha/semop.S b/mdk-stage1/dietlibc/alpha/semop.S
deleted file mode 100644
index 81b6fc606..000000000
--- a/mdk-stage1/dietlibc/alpha/semop.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(semop,semop)
diff --git a/mdk-stage1/dietlibc/alpha/send.S b/mdk-stage1/dietlibc/alpha/send.S
deleted file mode 100644
index cfd11be2a..000000000
--- a/mdk-stage1/dietlibc/alpha/send.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(send,send,__libc_send)
diff --git a/mdk-stage1/dietlibc/alpha/sendmsg.S b/mdk-stage1/dietlibc/alpha/sendmsg.S
deleted file mode 100644
index 14646ad68..000000000
--- a/mdk-stage1/dietlibc/alpha/sendmsg.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sendmsg,sendmsg)
diff --git a/mdk-stage1/dietlibc/alpha/sendto.S b/mdk-stage1/dietlibc/alpha/sendto.S
deleted file mode 100644
index 17a033011..000000000
--- a/mdk-stage1/dietlibc/alpha/sendto.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(sendto,sendto,__libc_sendto)
diff --git a/mdk-stage1/dietlibc/alpha/seteuid.c b/mdk-stage1/dietlibc/alpha/seteuid.c
deleted file mode 100644
index a7cf47893..000000000
--- a/mdk-stage1/dietlibc/alpha/seteuid.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/types.h>
-#include <unistd.h>
-
-#undef seteuid
-int seteuid(uid_t euid) {
- return setreuid(-1,euid);
-}
diff --git a/mdk-stage1/dietlibc/alpha/setjmp.S b/mdk-stage1/dietlibc/alpha/setjmp.S
deleted file mode 100644
index 3768056be..000000000
--- a/mdk-stage1/dietlibc/alpha/setjmp.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <setjmp.h>
-
-.text
-.global __sigsetjmp
-__sigsetjmp:
- ldgp $gp, 0($gp)
-
- mov $sp, $1
- lda $sp, -16($sp)
-
- stq $26, 0($sp) /* save ra */
-
- stq $9, (JB_S0*8) ($16) /* s0 */
- stq $10, (JB_S1*8) ($16) /* s1 */
- stq $11, (JB_S2*8) ($16) /* s2 */
- stq $12, (JB_S3*8) ($16) /* s3 */
- stq $13, (JB_S4*8) ($16) /* s4 */
- stq $14, (JB_S5*8) ($16) /* s5 */
-
- stq $26, (JB_PC*8) ($16) /* ra */
- stq $fp, (JB_FP*8) ($16) /* fp */
- stq $1, (JB_SP*8) ($16) /* sp */
-
- stt $f2, (JB_F2*8) ($16) /* f2 */
- stt $f3, (JB_F3*8) ($16) /* f3 */
- stt $f4, (JB_F4*8) ($16) /* f4 */
- stt $f5, (JB_F5*8) ($16) /* f5 */
- stt $f6, (JB_F6*8) ($16) /* f6 */
- stt $f7, (JB_F7*8) ($16) /* f7 */
- stt $f8, (JB_F8*8) ($16) /* f8 */
- stt $f9, (JB_F9*8) ($16) /* f9 */
-
- br $26, __sigjmp_save /* call __sigjmp_save */
-
- ldq $26, 0($sp) /* restore ra */
-
- lda $sp, 16($sp)
- ret $31, ($26), 1 /* back to caller */
-
-.weak setjmp
-setjmp:
-.weak __setjmp
-__setjmp:
- ldgp $gp, 0($gp)
- mov 0, $17
- br __sigsetjmp
diff --git a/mdk-stage1/dietlibc/alpha/setsockopt.S b/mdk-stage1/dietlibc/alpha/setsockopt.S
deleted file mode 100644
index e3fe1d321..000000000
--- a/mdk-stage1/dietlibc/alpha/setsockopt.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setsockopt,setsockopt)
diff --git a/mdk-stage1/dietlibc/alpha/shmat.S b/mdk-stage1/dietlibc/alpha/shmat.S
deleted file mode 100644
index 51248173d..000000000
--- a/mdk-stage1/dietlibc/alpha/shmat.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(shmat,shmat)
diff --git a/mdk-stage1/dietlibc/alpha/shmctl.S b/mdk-stage1/dietlibc/alpha/shmctl.S
deleted file mode 100644
index d56caace4..000000000
--- a/mdk-stage1/dietlibc/alpha/shmctl.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(shmctl,shmctl)
diff --git a/mdk-stage1/dietlibc/alpha/shmdt.S b/mdk-stage1/dietlibc/alpha/shmdt.S
deleted file mode 100644
index d9812a799..000000000
--- a/mdk-stage1/dietlibc/alpha/shmdt.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(shmdt,shmdt)
diff --git a/mdk-stage1/dietlibc/alpha/shmget.S b/mdk-stage1/dietlibc/alpha/shmget.S
deleted file mode 100644
index 82914223f..000000000
--- a/mdk-stage1/dietlibc/alpha/shmget.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(shmget,shmget)
diff --git a/mdk-stage1/dietlibc/alpha/shutdown.S b/mdk-stage1/dietlibc/alpha/shutdown.S
deleted file mode 100644
index 9b5139325..000000000
--- a/mdk-stage1/dietlibc/alpha/shutdown.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(shutdown,shutdown)
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/alpha/socket.S b/mdk-stage1/dietlibc/alpha/socket.S
deleted file mode 100644
index 85401f56e..000000000
--- a/mdk-stage1/dietlibc/alpha/socket.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(socket,socket)
diff --git a/mdk-stage1/dietlibc/alpha/socketcall.S b/mdk-stage1/dietlibc/alpha/socketcall.S
deleted file mode 100644
index b150bd5d5..000000000
--- a/mdk-stage1/dietlibc/alpha/socketcall.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-
-/*
- * Doesn't exist on alpha ( accept, bind, ... are SYSCALLS !?! )
- */
diff --git a/mdk-stage1/dietlibc/alpha/start.S b/mdk-stage1/dietlibc/alpha/start.S
deleted file mode 100644
index 00b8e950d..000000000
--- a/mdk-stage1/dietlibc/alpha/start.S
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "start.h"
-
-#ifdef __alpha__
-
-.text
-.align 2
- .set noreorder
-
-.global __start
-__start:
-.global _start
-_start:
- clr $fp /* clear frame pointer */
-
- br $gp,.Lstart /* set global pointer */
-.Lstart:
- ldgp $gp, 0($gp)
-
-/* prepare to call main */
- ldl $16, 0($sp) /* argc */
-
- lda $17, 8($sp) /* argv */
-
- addq $16, 1, $18 /* argp */
- s8addq $18, $17, $18 /* (8*(argc+1))+argv -> argp */
-
- stq $18, environ
-
- mov $0, $21 /* mov v0(dynload) to a5 */
-
- jsr $26, main
- mov $0, $16
- jsr $26, exit /* YES, CALL! for threads and atexit ! (+4 byte) */
-
-#endif
diff --git a/mdk-stage1/dietlibc/alpha/strlen.c b/mdk-stage1/dietlibc/alpha/strlen.c
deleted file mode 100644
index ac532254a..000000000
--- a/mdk-stage1/dietlibc/alpha/strlen.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <string.h>
-
-static const unsigned long long magic = 0x0101010101010101LL;
-
-size_t strlen(const char *s)
-{
- const char *t = s;
- unsigned long long word;
-
- if (!s) return 0;
-
- /* Byte compare up until 64 bit word boundary */
- for (; ((unsigned long long) t & 7); t++)
- if (!*t) return t - s;
-
- /* Word compare */
- do {
- word = *((unsigned long long *) t); t += 8;
- word = (word - magic) &~ word;
- word &= (magic << 7);
- } while (word == 0);
-
- /* word & 0x8080808080808080 == word */
- word = (word - 1) & (magic << 8);
- word += (word << 32);
- word += (word << 16);
- word += (word << 8);
- t += word >> 56;
- return ((const char *) t) - 8 - s;
-}
-
-
diff --git a/mdk-stage1/dietlibc/alpha/time.S b/mdk-stage1/dietlibc/alpha/time.S
deleted file mode 100644
index e69de29bb..000000000
--- a/mdk-stage1/dietlibc/alpha/time.S
+++ /dev/null
diff --git a/mdk-stage1/dietlibc/alpha/unified.S b/mdk-stage1/dietlibc/alpha/unified.S
deleted file mode 100644
index 02a1c9bcd..000000000
--- a/mdk-stage1/dietlibc/alpha/unified.S
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <dietfeatures.h>
-
-.global __unified_syscall
-__unified_syscall:
- callsys
- bne $19, .Lerror
- ret $31, ($26), 0x01
-
-.Lerror:
-.global error_unified_syscall
-error_unified_syscall:
-#ifdef WANT_THREAD_SAVE
- lda $sp, -16($sp) /* alloc 2 qwords on stack */
- stq $26, 0($sp) /* save ra to stack */
- stq $0, 8($sp) /* save v0 to stack */
-
- jsr $26, __errno_location /* call __errno_location */
-
- ldq $1, 8($sp) /* write old v0 to errno */
- stl $1, 0($0)
-
- lda $0, -1($31) /* new return value is -1 */
- ldq $26, 0($sp) /* restore return address */
- lda $sp, 16($sp) /* free 2 qwords on stack */
-#else
- lda $1, errno
- stl $0, 0($1)
-#endif
- ret $31, ($26), 0x01 /* return */
diff --git a/mdk-stage1/dietlibc/alpha/utime.S b/mdk-stage1/dietlibc/alpha/utime.S
deleted file mode 100644
index a9a8aada6..000000000
--- a/mdk-stage1/dietlibc/alpha/utime.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(utimes,utime)
diff --git a/mdk-stage1/dietlibc/alpha/waitpid.S b/mdk-stage1/dietlibc/alpha/waitpid.S
deleted file mode 100644
index 6dc1c99db..000000000
--- a/mdk-stage1/dietlibc/alpha/waitpid.S
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <syscalls.h>
-
-.text
-.align 2
-.weak waitpid
-waitpid:
-.global __libc_waitpid
-__libc_waitpid:
- clr $19
- br wait4
diff --git a/mdk-stage1/dietlibc/diet.c b/mdk-stage1/dietlibc/diet.c
deleted file mode 100644
index 1de6befc8..000000000
--- a/mdk-stage1/dietlibc/diet.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/* goal:
- * when invoked as
- * "diet gcc -c t.c"
- * exec
- * "gcc -I/path/to/dietlibc/include -c t.c"
- *
- * when invoked as
- * "diet sparc-linux-gcc -o t t.o"
- * exec
- * "sparc-linux-gcc -nostdlib -static -o t t.o /path/to/dietlibc/bin-sparc/start.o /path/to/dietlibc/bin-sparc/dietlibc.a"
-*/
-
-void error(const char *message) {
- write(2,message,strlen(message));
- exit(1);
-}
-
-int main(int argc,char *argv[]) {
- int link=0;
- int compile=0;
- char diethome[]=DIETHOME;
- char platform[1000]=DIETHOME "/bin-";
- char *nostdlib="-nostdlib";
- char *libgcc="-lgcc";
- char dashL[1000]="-L";
- int i;
-
- if (argc<2) {
- error("usage: diet [gcc command line]\n"
- "e.g. diet gcc -c t.c\n"
- "or diet sparc-linux-gcc -o foo foo.c bar.o\n");
- }
- {
- char *tmp=strchr(argv[1],0)-2;
- char *tmp2;
- char *cc=argv[1];
- if (tmp<cc) goto donttouch;
- if ((tmp2=strchr(cc,'-'))) { /* cross compiling? */
- int len=strlen(platform);
- if (tmp2-cc>90) error("platform name too long!\n");
- memmove(platform+len,argv[1],tmp2-cc);
- platform[tmp2-cc+len]=0;
-/* printf("found platform %s\n",platform); */
- } else {
-#ifdef __sparc__
- strcat(platform,"sparc");
-#endif
-#ifdef __ppc__
- strcat(platform,"ppc");
-#endif
-#ifdef __i386__
- strcat(platform,"i386");
-#endif
-#ifdef __alpha__
- strcat(platform,"alpha");
-#endif
-#ifdef __arm__
- strcat(platform,"arm");
-#endif
-#ifdef __mips__
- strcat(platform,"mips");
-#endif
- }
- strcat(dashL,platform);
- if (!strcmp(tmp,"cc")) {
- char **newargv;
- char **dest;
- char *a,*b,*c;
-/* we need to add -I... if the command line contains -c, -S or -E */
- for (i=2; i<argc; ++i)
- if (!strcmp(argv[i],"-c") || !strcmp(argv[i],"-S") || !strcmp(argv[i],"-E"))
- compile=1;
-/* we need to add -nostdlib if we are not compiling*/
- link=!compile;
-#if 0
- for (i=2; i<argc; ++i)
- if (!strcmp(argv[i],"-o"))
- if (!compile) link=1;
-#endif
- newargv=alloca(sizeof(char*)*(argc+6));
- a=alloca(strlen(diethome)+20);
- b=alloca(strlen(platform)+20);
- c=alloca(strlen(platform)+20);
-
- strcpy(a,"-I"); strcat(a,diethome); strcat(a,"/include");
- strcpy(b,platform); strcat(b,"/start.o");
- strcpy(c,platform); strcat(c,"/dietlibc.a");
-
- dest=newargv;
- *dest++=argv[1];
- if (link) { *dest++=nostdlib; *dest++=dashL; }
- if (compile || link) *dest++=a;
- for (i=2; i<argc; ++i)
- *dest++=argv[i];
- if (link) { *dest++=b; *dest++=c; *dest++=libgcc; }
- *dest=0;
- execvp(newargv[0],newargv);
- goto error;
- } else if (!strcmp(tmp,"ld")) {
- }
- }
-donttouch:
- execvp(argv[1],argv+1);
-error:
- error("execvp failed!\n");
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/dietdirent.h b/mdk-stage1/dietlibc/dietdirent.h
deleted file mode 100644
index d732cf7dc..000000000
--- a/mdk-stage1/dietlibc/dietdirent.h
+++ /dev/null
@@ -1,6 +0,0 @@
-struct __dirstream {
- int fd;
- char buf[1024];
- unsigned int num;
- unsigned int cur;
-}; /* stream data from opendir() */
diff --git a/mdk-stage1/dietlibc/dietfeatures.h b/mdk-stage1/dietlibc/dietfeatures.h
deleted file mode 100644
index e1de38577..000000000
--- a/mdk-stage1/dietlibc/dietfeatures.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _DIETFEATURES_H
-#define _DIETFEATURES_H
-
-/* feel free to comment some of these out to reduce code size */
-
-//#define WANT_FLOATING_POINT_IN_PRINTF
-//#define WANT_FLOATING_POINT_IN_SCANF
-#define WANT_CHARACTER_CLASSES_IN_SCANF
-#define WANT_NULL_PRINTF
-
-#define SLASH_PROC_OK
-
-// #define WANT_BUFFERED_STDIO
-
-/* use errno_location instead of errno */
-// #define WANT_THREAD_SAFE
-
-/* make the startcode, etc. dynamic aware */
-/* #undef WANT_DYNAMIC */
-
-/* do you want smaller or faster string routines? */
-/* #define WANT_FASTER_STRING_ROUTINES */
-
-/* do you want ungetc? makes fgetc more complex */
-#define WANT_UNGETC
-
-// #define WANT_LINKER_WARNINGS
-
-/* you need to define this if you want to run your programs with large
- * file support on kernel 2.2 or 2.4 */
-// #define WANT_LARGEFILE_BACKCOMPAT
-
-/* do you want localtime(3) to read /etc/localtime?
- * Needed for daylight saving time etc. */
-// #define WANT_TZFILE_PARSER
-
-/* stop uncommenting here ;-) */
-#ifndef WANT_FASTER_STRING_ROUTINES
-#define WANT_SMALL_STRING_ROUTINES
-#endif
-
-#endif
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/dietstdio.h b/mdk-stage1/dietlibc/dietstdio.h
deleted file mode 100644
index a1cbeba83..000000000
--- a/mdk-stage1/dietlibc/dietstdio.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* diet stdio -- no buffering ;-} */
-
-#include "dietfeatures.h"
-#include <sys/types.h>
-#ifdef WANT_THREAD_SAVE
-#include <pthread.h>
-#endif
-
-#define BUFSIZE 128
-
-typedef struct __file {
- int fd;
- int flags;
-#ifdef WANT_BUFFERED_STDIO
- unsigned int bs; /* read: bytes in buffer */
- unsigned int bm; /* position in buffer */
- char buf[BUFSIZE];
- struct __file *next; /* for fflush */
-#endif
- pid_t popen_kludge;
-#ifdef WANT_UNGETC
- char ungetbuf;
- char ungotten;
-#endif
-#ifdef WANT_THREAD_SAVE
- pthread_mutex_t m;
-#endif
-} FILE;
-
-extern FILE *__stdio_root;
-
-#define ERRORINDICATOR 1
-#define EOFINDICATOR 2
-#define BUFINPUT 4
-#define BUFLINEWISE 8
-#define NOBUF 16
-#define UNSEEKABLE 32
-
-#define _IONBF 0
-#define _IOLBF 1
-#define _IOFBF 2
-
-/* internal function to flush buffer.
- * However, if next is BUFINPUT and the buffer is an input buffer, it
- * will not be flushed. Vice versa for output */
-extern int __fflush4(FILE *stream,int next);
-
-FILE *fopen (const char *path, const char *mode);
-FILE *fdopen (int fildes, const char *mode);
-FILE *freopen (const char *path, const char *mode, FILE *stream);
-
-int fgetc(FILE *stream);
-char *fgets(char *s, int size, FILE *stream);
-int getc(FILE *stream);
-int getchar(void);
-char *gets(char *s);
-int ungetc(int c, FILE *stream);
-
-int fputc(int c, FILE *stream);
-int fputs(const char *s, FILE *stream);
-int putc(int c, FILE *stream);
-int putchar(int c);
-int puts(const char *s);
-
-long fseek( FILE *stream, long offset, int whence);
-long ftell( FILE *stream);
-void rewind( FILE *stream);
-int fgetpos( FILE *stream, fpos_t *pos);
-int fsetpos( FILE *stream, fpos_t *pos);
-
-size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream);
-
-size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream);
-
-int fflush(FILE *stream);
-
-int fclose(FILE *stream);
-
-extern FILE *stdout, *stderr, *stdin;
-
-#define EOF (int)(-1)
diff --git a/mdk-stage1/dietlibc/dietwarning.h b/mdk-stage1/dietlibc/dietwarning.h
deleted file mode 100644
index f7c67a175..000000000
--- a/mdk-stage1/dietlibc/dietwarning.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "dietfeatures.h"
-
-#ifdef WANT_LINKER_WARNINGS
-
-#ifndef __ASSEMBLER__
-
-#define link_warning(symbol,msg) \
- asm (".section .gnu.warning." symbol "\n\t.string \"" msg "\"\n\t.previous");
-
-#else
-
-#define link_warning(symbol,msg) \
- .section .gnu.warning.##symbol ;\
- .string msg ;\
- .previous
-
-#endif
-
-#else
-
-#define link_warning(foo,bar)
-
-#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/i386/Makefile.add b/mdk-stage1/dietlibc/i386/Makefile.add
deleted file mode 100644
index b685cc360..000000000
--- a/mdk-stage1/dietlibc/i386/Makefile.add
+++ /dev/null
@@ -1,3 +0,0 @@
-
-CFLAGS+=-march=i386 -mcpu=i386 -Os -fomit-frame-pointer
-VPATH:=i386:syscalls.s:$(VPATH)
diff --git a/mdk-stage1/dietlibc/i386/__longjmp.S b/mdk-stage1/dietlibc/i386/__longjmp.S
deleted file mode 100644
index 098275037..000000000
--- a/mdk-stage1/dietlibc/i386/__longjmp.S
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <setjmp.h>
-
-.text
-.global __longjmp
-__longjmp:
- movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */
- movl 8(%esp), %eax /* Second argument is return value. */
- /* Save the return address now. */
- movl (JB_PC*4)(%ecx), %edx
- /* Restore registers. */
- movl (JB_BX*4)(%ecx), %ebx
- movl (JB_SI*4)(%ecx), %esi
- movl (JB_DI*4)(%ecx), %edi
- movl (JB_BP*4)(%ecx), %ebp
- movl (JB_SP*4)(%ecx), %esp
- /* Jump to saved PC. */
- jmp *%edx
-.size __longjmp,.-__longjmp;
diff --git a/mdk-stage1/dietlibc/i386/__testandset.S b/mdk-stage1/dietlibc/i386/__testandset.S
deleted file mode 100644
index af7b4d5a0..000000000
--- a/mdk-stage1/dietlibc/i386/__testandset.S
+++ /dev/null
@@ -1,8 +0,0 @@
-.text
-.global __testandset
-__testandset:
- xorl %eax, %eax
- movl 0x4(%esp),%edx
- incl %eax
- xchgl %eax,(%edx)
- ret
diff --git a/mdk-stage1/dietlibc/i386/clone.S b/mdk-stage1/dietlibc/i386/clone.S
deleted file mode 100644
index ac02eb468..000000000
--- a/mdk-stage1/dietlibc/i386/clone.S
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <asm/unistd.h>
-
-.text
-.weak clone
-clone:
-.global __clone
-__clone:
- movl 4(%esp), %ecx /* have non null thread_funcion */
- testl %ecx, %ecx
- je .Lclone_error
-
- movl 8(%esp), %ecx /* have non null child_stack pointer */
- testl %ecx, %ecx
- je .Lclone_error
-
- /* put the parameter on thread stack */
- subl $8, %ecx
-
- movl 16(%esp), %eax /* arg */
- movl %eax, 4(%ecx)
-
- movl 4(%esp), %eax /* thread_func */
- movl %eax, 0(%ecx)
-
- /* the syscall */
- pushl %ebx
- movl 16(%esp), %ebx /* flags */
- movl $__NR_clone, %eax
- int $0x80
- popl %ebx
-
- testl %eax, %eax
- jl .Lclone_error
- je .Lstart_thread
- ret
-
-.Lstart_thread:
- xorl %ebp,%ebp
- call *%ebx
- pushl %eax
- call _exit
-
-.Lclone_error:
- negl %eax
- pushl %eax
- call __errno_location
- popl %ecx
- movl %ecx, (%eax)
- xorl %eax, %eax
- decl %eax
- ret
diff --git a/mdk-stage1/dietlibc/i386/mmap.c b/mdk-stage1/dietlibc/i386/mmap.c
deleted file mode 100644
index 26ecb55c0..000000000
--- a/mdk-stage1/dietlibc/i386/mmap.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <linux/types.h>
-#include <linux/unistd.h>
-
-#define __NR__mmap __NR_mmap
-_syscall1(int,_mmap,unsigned long *,buffer)
-
-char *mmap(char *addr, size_t len, int prot, int flags, int fd, unsigned long off) {
- unsigned long buffer[6];
- buffer[0] = (unsigned long)addr;
- buffer[1] = (unsigned long)len;
- buffer[2] = (unsigned long)prot;
- buffer[3] = (unsigned long)flags;
- buffer[4] = (unsigned long)fd;
- buffer[5] = (unsigned long)off;
- return (char*) _mmap(buffer);
-}
diff --git a/mdk-stage1/dietlibc/i386/select.S b/mdk-stage1/dietlibc/i386/select.S
deleted file mode 100644
index 9e7066eae..000000000
--- a/mdk-stage1/dietlibc/i386/select.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(_newselect,select,__libc_select)
diff --git a/mdk-stage1/dietlibc/i386/setjmp.S b/mdk-stage1/dietlibc/i386/setjmp.S
deleted file mode 100644
index 9bfecf565..000000000
--- a/mdk-stage1/dietlibc/i386/setjmp.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <setjmp.h>
-
-/* setjmp for i386.
- Copyright (C) 1995, 1996, 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. */
-
-.section .rodata
-.text
-.weak setjmp
-setjmp:
-.globl __setjmp
-__setjmp:
- popl %eax /* Pop return address. */
- popl %ecx /* Pop jmp_buf. */
- pushl $0 /* Push zero argument. */
- pushl %ecx /* Push jmp_buf. */
- pushl %eax /* Push back return address. */
-
-.globl __sigsetjmp
-__sigsetjmp:
- movl 4(%esp), %eax /* User's jmp_buf in %eax. */
- /* Save registers. */
- movl %ebx, (JB_BX*4)(%eax)
- movl %esi, (JB_SI*4)(%eax)
- movl %edi, (JB_DI*4)(%eax)
- movl %ebp, (JB_BP*4)(%eax)
- leal 4(%esp), %ecx /* Save SP as it will be after we return. */
- movl %ecx, (JB_SP*4)(%eax)
- movl 0(%esp), %ecx /* Save PC we are returning to now. */
- movl %ecx, (JB_PC*4)(%eax)
-
- /* Make a tail call to __sigjmp_save; it takes the same args. */
-#ifdef PIC
- /* We cannot use the PLT, because it requires that %ebx be set, but
- we can't save and restore our caller's value. Instead, we do an
- indirect jump through the GOT, using for the temporary register
- %ecx, which is call-clobbered. */
- call L(here)
-L(here):
- popl %ecx
- addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ecx
- movl C_SYMBOL_NAME(__sigjmp_save@GOT)(%ecx), %ecx
- jmp *%ecx
-#else
- jmp __sigjmp_save
-#endif
-.size __sigsetjmp,.-__sigsetjmp;
diff --git a/mdk-stage1/dietlibc/i386/start.S b/mdk-stage1/dietlibc/i386/start.S
deleted file mode 100644
index 167bb779c..000000000
--- a/mdk-stage1/dietlibc/i386/start.S
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "start.h"
-
-#ifdef __i386__
-.text
-.globl _start
-_start:
-#if 0
- popl %ecx
- movl %esp, %esi
- leal 4(%esp,%ecx,4),%eax
-#else
- movl (%esp),%ecx /* %ecx = argc */
- leal 4(%esp),%esi /* %esi = argv */
-
- leal 4(%esi,%ecx,4),%eax /* eax = 4*ecx+4 = envp */
-#endif
- pushl %eax
- pushl %esi
- pushl %ecx
- movl %eax,environ
-
-#ifdef WANT_DYNAMIC
-/* in %edx we have the dynamic _fini ( register this if non null ) */
- test %edx, %edx
- je .Linit
- push %edx
- call atexit
- pop %edx
-.Linit:
- call _init
- push $_fini
- call atexit
- pop %edx
-#endif
-
- call main
- pushl %eax
- call exit
-.Lfefe:
- .size _start,.Lfefe-_start
-#endif
-
diff --git a/mdk-stage1/dietlibc/i386/unified.S b/mdk-stage1/dietlibc/i386/unified.S
deleted file mode 100644
index f182bdb4b..000000000
--- a/mdk-stage1/dietlibc/i386/unified.S
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <dietfeatures.h>
-
-.text
-.global __unified_syscall
-__unified_syscall:
- movzbl %al, %eax
- push %edi
- push %esi
- push %ebx
- movl %esp,%edi
- movl 0x10(%edi),%ebx
- movl 0x14(%edi),%ecx
- movl 0x18(%edi),%edx
- movl 0x1c(%edi),%esi
- movl 0x20(%edi),%edi
- int $0x80
- cmp $-124,%eax
- jbe .Lnoerror
-#ifdef WANT_THREAD_SAVE
- movl %eax,%ebx
- call __errno_location
- neg %ebx
- movl %ebx,(%eax)
-#else
- neg %eax
- mov %eax,errno
-#endif
- xor %eax,%eax
- dec %eax
-.Lnoerror:
- pop %ebx
- pop %esi
- pop %edi
- ret
diff --git a/mdk-stage1/dietlibc/include/alloca.h b/mdk-stage1/dietlibc/include/alloca.h
deleted file mode 100644
index e69de29bb..000000000
--- a/mdk-stage1/dietlibc/include/alloca.h
+++ /dev/null
diff --git a/mdk-stage1/dietlibc/include/arpa/inet.h b/mdk-stage1/dietlibc/include/arpa/inet.h
deleted file mode 100644
index 6d5a6dc35..000000000
--- a/mdk-stage1/dietlibc/include/arpa/inet.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _ARPA_INET_H
-#define _ARPA_INET_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-
-int inet_aton(const char *cp, struct in_addr *inp) __THROW;
-unsigned long int inet_addr(const char *cp) __THROW;
-unsigned long int inet_network(const char *cp) __THROW;
-char *inet_ntoa(struct in_addr in) __THROW;
-struct in_addr inet_makeaddr(int net, int host) __THROW;
-unsigned long int inet_lnaof(struct in_addr in) __THROW;
-unsigned long int inet_netof(struct in_addr in) __THROW;
-
-int inet_pton (int AF, const char* CP, void* BUF) __THROW;
-const char* inet_ntop (int AF, const void* CP, char* BUF, size_t LEN) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/arpa/nameser.h b/mdk-stage1/dietlibc/include/arpa/nameser.h
deleted file mode 100644
index 1ee048d66..000000000
--- a/mdk-stage1/dietlibc/include/arpa/nameser.h
+++ /dev/null
@@ -1,217 +0,0 @@
-#ifndef _ARPA_NAMESER_H
-#define _ARPA_NAMESER_H
-
-#include <endian.h>
-
-#define NS_PACKETSZ 512 /* maximum packet size */
-#define NS_MAXDNAME 1025 /* maximum domain name */
-#define NS_MAXCDNAME 255 /* maximum compressed domain name */
-#define NS_MAXLABEL 63 /* maximum length of domain label */
-#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
-#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
-#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
-#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */
-#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */
-#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */
-#define NS_INADDRSZ 4 /* IPv4 T_A */
-#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */
-#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
-#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
-
-/*
- * Currently defined type values for resources and queries.
- */
-typedef enum __ns_type {
- ns_t_invalid = 0, /* Cookie. */
- ns_t_a = 1, /* Host address. */
- ns_t_ns = 2, /* Authoritative server. */
- ns_t_md = 3, /* Mail destination. */
- ns_t_mf = 4, /* Mail forwarder. */
- ns_t_cname = 5, /* Canonical name. */
- ns_t_soa = 6, /* Start of authority zone. */
- ns_t_mb = 7, /* Mailbox domain name. */
- ns_t_mg = 8, /* Mail group member. */
- ns_t_mr = 9, /* Mail rename name. */
- ns_t_null = 10, /* Null resource record. */
- ns_t_wks = 11, /* Well known service. */
- ns_t_ptr = 12, /* Domain name pointer. */
- ns_t_hinfo = 13, /* Host information. */
- ns_t_minfo = 14, /* Mailbox information. */
- ns_t_mx = 15, /* Mail routing information. */
- ns_t_txt = 16, /* Text strings. */
- ns_t_rp = 17, /* Responsible person. */
- ns_t_afsdb = 18, /* AFS cell database. */
- ns_t_x25 = 19, /* X_25 calling address. */
- ns_t_isdn = 20, /* ISDN calling address. */
- ns_t_rt = 21, /* Router. */
- ns_t_nsap = 22, /* NSAP address. */
- ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
- ns_t_sig = 24, /* Security signature. */
- ns_t_key = 25, /* Security key. */
- ns_t_px = 26, /* X.400 mail mapping. */
- ns_t_gpos = 27, /* Geographical position (withdrawn). */
- ns_t_aaaa = 28, /* Ip6 Address. */
- ns_t_loc = 29, /* Location Information. */
- ns_t_nxt = 30, /* Next domain (security). */
- ns_t_eid = 31, /* Endpoint identifier. */
- ns_t_nimloc = 32, /* Nimrod Locator. */
- ns_t_srv = 33, /* Server Selection. */
- ns_t_atma = 34, /* ATM Address */
- ns_t_naptr = 35, /* Naming Authority PoinTeR */
- ns_t_kx = 36, /* Key Exchange */
- ns_t_cert = 37, /* Certification record */
- ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
- ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
- ns_t_sink = 40, /* Kitchen sink (experimentatl) */
- ns_t_opt = 41, /* EDNS0 option (meta-RR) */
- ns_t_tsig = 250, /* Transaction signature. */
- ns_t_ixfr = 251, /* Incremental zone transfer. */
- ns_t_axfr = 252, /* Transfer zone of authority. */
- ns_t_mailb = 253, /* Transfer mailbox records. */
- ns_t_maila = 254, /* Transfer mail agent records. */
- ns_t_any = 255, /* Wildcard match. */
- ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
- ns_t_max = 65536
-} ns_type;
-
-/*
- * Values for class field
- */
-typedef enum __ns_class {
- ns_c_invalid = 0, /* Cookie. */
- ns_c_in = 1, /* Internet. */
- ns_c_2 = 2, /* unallocated/unsupported. */
- ns_c_chaos = 3, /* MIT Chaos-net. */
- ns_c_hs = 4, /* MIT Hesiod. */
- /* Query class values which do not appear in resource records */
- ns_c_none = 254, /* for prereq. sections in update requests */
- ns_c_any = 255, /* Wildcard match. */
- ns_c_max = 65536
-} ns_class;
-
-typedef struct {
- unsigned id :16; /* query identification number */
-#if BYTE_ORDER == BIG_ENDIAN
- /* fields in third byte */
- unsigned qr: 1; /* response flag */
- unsigned opcode: 4; /* purpose of message */
- unsigned aa: 1; /* authoritive answer */
- unsigned tc: 1; /* truncated message */
- unsigned rd: 1; /* recursion desired */
- /* fields in fourth byte */
- unsigned ra: 1; /* recursion available */
- unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned ad: 1; /* authentic data from named */
- unsigned cd: 1; /* checking disabled by resolver */
- unsigned rcode :4; /* response code */
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
- /* fields in third byte */
- unsigned rd :1; /* recursion desired */
- unsigned tc :1; /* truncated message */
- unsigned aa :1; /* authoritive answer */
- unsigned opcode :4; /* purpose of message */
- unsigned qr :1; /* response flag */
- /* fields in fourth byte */
- unsigned rcode :4; /* response code */
- unsigned cd: 1; /* checking disabled by resolver */
- unsigned ad: 1; /* authentic data from named */
- unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
- unsigned ra :1; /* recursion available */
-#endif
- /* remaining bytes */
- unsigned qdcount :16; /* number of question entries */
- unsigned ancount :16; /* number of answer entries */
- unsigned nscount :16; /* number of authority entries */
- unsigned arcount :16; /* number of resource entries */
-} HEADER;
-
-#define PACKETSZ NS_PACKETSZ
-#define MAXDNAME NS_MAXDNAME
-#define MAXCDNAME NS_MAXCDNAME
-#define MAXLABEL NS_MAXLABEL
-#define HFIXEDSZ NS_HFIXEDSZ
-#define QFIXEDSZ NS_QFIXEDSZ
-#define RRFIXEDSZ NS_RRFIXEDSZ
-#define INT32SZ NS_INT32SZ
-#define INT16SZ NS_INT16SZ
-#define INADDRSZ NS_INADDRSZ
-#define IN6ADDRSZ NS_IN6ADDRSZ
-#define INDIR_MASK NS_CMPRSFLGS
-#define NAMESERVER_PORT NS_DEFAULTPORT
-
-#define S_ZONE ns_s_zn
-#define S_PREREQ ns_s_pr
-#define S_UPDATE ns_s_ud
-#define S_ADDT ns_s_ar
-
-#define QUERY ns_o_query
-#define IQUERY ns_o_iquery
-#define STATUS ns_o_status
-#define NS_NOTIFY_OP ns_o_notify
-#define NS_UPDATE_OP ns_o_update
-
-#define NOERROR ns_r_noerror
-#define FORMERR ns_r_formerr
-#define SERVFAIL ns_r_servfail
-#define NXDOMAIN ns_r_nxdomain
-#define NOTIMP ns_r_notimpl
-#define REFUSED ns_r_refused
-#define YXDOMAIN ns_r_yxdomain
-#define YXRRSET ns_r_yxrrset
-#define NXRRSET ns_r_nxrrset
-#define NOTAUTH ns_r_notauth
-#define NOTZONE ns_r_notzone
-
-#define DELETE ns_uop_delete
-#define ADD ns_uop_add
-
-#define T_A ns_t_a
-#define T_NS ns_t_ns
-#define T_MD ns_t_md
-#define T_MF ns_t_mf
-#define T_CNAME ns_t_cname
-#define T_SOA ns_t_soa
-#define T_MB ns_t_mb
-#define T_MG ns_t_mg
-#define T_MR ns_t_mr
-#define T_NULL ns_t_null
-#define T_WKS ns_t_wks
-#define T_PTR ns_t_ptr
-#define T_HINFO ns_t_hinfo
-#define T_MINFO ns_t_minfo
-#define T_MX ns_t_mx
-#define T_TXT ns_t_txt
-#define T_RP ns_t_rp
-#define T_AFSDB ns_t_afsdb
-#define T_X25 ns_t_x25
-#define T_ISDN ns_t_isdn
-#define T_RT ns_t_rt
-#define T_NSAP ns_t_nsap
-#define T_NSAP_PTR ns_t_nsap_ptr
-#define T_SIG ns_t_sig
-#define T_KEY ns_t_key
-#define T_PX ns_t_px
-#define T_GPOS ns_t_gpos
-#define T_AAAA ns_t_aaaa
-#define T_LOC ns_t_loc
-#define T_NXT ns_t_nxt
-#define T_EID ns_t_eid
-#define T_NIMLOC ns_t_nimloc
-#define T_SRV ns_t_srv
-#define T_ATMA ns_t_atma
-#define T_NAPTR ns_t_naptr
-#define T_TSIG ns_t_tsig
-#define T_IXFR ns_t_ixfr
-#define T_AXFR ns_t_axfr
-#define T_MAILB ns_t_mailb
-#define T_MAILA ns_t_maila
-#define T_ANY ns_t_any
-
-#define C_IN ns_c_in
-#define C_CHAOS ns_c_chaos
-#define C_HS ns_c_hs
-#define C_NONE ns_c_none
-#define C_ANY ns_c_any
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/assert.h b/mdk-stage1/dietlibc/include/assert.h
deleted file mode 100644
index bb573d0f2..000000000
--- a/mdk-stage1/dietlibc/include/assert.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ASSERT_H
-#define _ASSERT_H
-
-#include <sys/cdefs.h>
-
-/* This prints an "Assertion failed" message and aborts. */
-extern void __assert_fail (__const char *__assertion, __const char *__file,
- unsigned int __line, __const char *__function)
- __THROW __attribute__ ((__noreturn__));
-
-#ifdef __PRETTY_FUNCTION__
-#define __ASSERT_FUNCTION __PRETTY_FUNCTION__
-#else
-#define __ASSERT_FUNCTION __func__
-#endif
-
-#undef assert
-#ifdef NDEBUG
-#define assert(expr)
-#else
-# define assert(expr) \
- ((void) ((expr) ? 0 : \
- (__assert_fail (#expr, \
- __FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
-#endif
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/ctype.h b/mdk-stage1/dietlibc/include/ctype.h
deleted file mode 100644
index 9322e8c7b..000000000
--- a/mdk-stage1/dietlibc/include/ctype.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _CTYPE_H
-#define _CTYPE_H
-
-#include <sys/cdefs.h>
-
-extern int isascii (int c) __THROW __attribute__ ((__const__));
-extern int isblank (int c) __THROW __attribute__ ((__const__));
-extern int isalnum (int c) __THROW __attribute__ ((__const__));
-extern int isalpha (int c) __THROW __attribute__ ((__const__));
-extern int isdigit (int c) __THROW __attribute__ ((__const__));
-extern int isspace (int c) __THROW __attribute__ ((__const__));
-
-extern int isupper (int c) __THROW __attribute__ ((__const__));
-extern int islower (int c) __THROW __attribute__ ((__const__));
-
-extern int tolower(int c) __THROW __attribute__ ((__const__));
-extern int toupper(int c) __THROW __attribute__ ((__const__));
-
-extern int isprint(int c) __THROW __attribute__ ((__const__));
-extern int ispunct(int c) __THROW __attribute__ ((__const__));
-extern int iscntrl(int c) __THROW __attribute__ ((__const__));
-
-/* fscking GNU extensions! */
-extern int isxdigit(int c) __THROW __attribute__ ((__const__));
-
-extern int isgraph(int c) __THROW __attribute__ ((__const__));
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/daemon.h b/mdk-stage1/dietlibc/include/daemon.h
deleted file mode 100644
index 9049f367d..000000000
--- a/mdk-stage1/dietlibc/include/daemon.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _DAEMON_H
-#define _DAEMON_H
-
-extern int daemon (int nochdir,int noclose);
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/dirent.h b/mdk-stage1/dietlibc/include/dirent.h
deleted file mode 100644
index b0ad4f5ec..000000000
--- a/mdk-stage1/dietlibc/include/dirent.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _DIRENT_H
-#define _DIRENT_H 1
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <linux/dirent.h>
-
-#define d_fileno d_ino /* Backwards compatibility. */
-
-#undef _DIRENT_HAVE_D_NAMLEN
-#define _DIRENT_HAVE_D_RECLEN
-#define _DIRENT_HAVE_D_OFF
-#define _DIRENT_HAVE_D_TYPE
-
-typedef struct __dirstream DIR;
-
-DIR *opendir (const char *__name) __THROW;
-int closedir (DIR *__dirp) __THROW;
-struct dirent *readdir (DIR *__dirp) __THROW;
-struct dirent64 *readdir64 (DIR *__dirp) __THROW;
-void rewinddir (DIR *__dirp) __THROW;
-void seekdir (DIR *__dirp, long int __pos) __THROW;
-long int telldir (DIR *__dirp) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/dlfcn.h b/mdk-stage1/dietlibc/include/dlfcn.h
deleted file mode 100644
index b96f8f615..000000000
--- a/mdk-stage1/dietlibc/include/dlfcn.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _DLFCN_H
-#define _DLFCN_H 1
-
-#define RTLD_LAZY 0x00000
-#define RTLD_NOW 0x00001
-
-#define RTLD_LOCAL 0x00000
-#define RTLD_GLOBAL 0x10000
-
-void *dlopen (const char *filename, int flag);
-const char *dlerror(void);
-void *dlsym(void *handle, char *symbol);
-int dlclose (void *handle);
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/elf.h b/mdk-stage1/dietlibc/include/elf.h
deleted file mode 100644
index be09dbee4..000000000
--- a/mdk-stage1/dietlibc/include/elf.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <linux/elf.h>
diff --git a/mdk-stage1/dietlibc/include/endian.h b/mdk-stage1/dietlibc/include/endian.h
deleted file mode 100644
index 463c24fff..000000000
--- a/mdk-stage1/dietlibc/include/endian.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef _ENDIAN_H
-#define _ENDIAN_H
-
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-
-#ifdef __i386__
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
-#endif
-
-#ifdef __sparc__
-#define __BYTE_ORDER __BIG_ENDIAN
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
-#endif
-
-#ifdef __mips__
-#ifdef __MIPSEB__
-#define __BIG_ENDIAN__
-#endif
-#endif
-
-#ifndef __BYTE_ORDER
-#ifdef __BIG_ENDIAN__
-#define __BYTE_ORDER __BIG_ENDIAN
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
-#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
-#endif
-#endif
-
-#define LITTLE_ENDIAN __LITTLE_ENDIAN
-#define BIG_ENDIAN __BIG_ENDIAN
-#define BYTE_ORDER __BYTE_ORDER
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define __LONG_LONG_PAIR(HI, LO) LO, HI
-#elif __BYTE_ORDER == __BIG_ENDIAN
-# define __LONG_LONG_PAIR(HI, LO) HI, LO
-#endif
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/errno.h b/mdk-stage1/dietlibc/include/errno.h
deleted file mode 100644
index d1c68f39c..000000000
--- a/mdk-stage1/dietlibc/include/errno.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _ERRNO_H
-#define _ERRNO_H
-
-extern int errno;
-
-#include <linux/errno.h>
-
-extern int *__errno_location(void);
-extern void __set_errno(int error);
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/fcntl.h b/mdk-stage1/dietlibc/include/fcntl.h
deleted file mode 100644
index b792502c1..000000000
--- a/mdk-stage1/dietlibc/include/fcntl.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _FCNTL_H
-#define _FCNTL_H
-
-#include <sys/cdefs.h>
-
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <asm/fcntl.h>
-
-extern int fcntl (int __fd, int __cmd, ...) __THROW;
-extern int open (const char *__file, int __oflag, ...) __THROW;
-extern int open64 (const char *__file, int __oflag, ...) __THROW;
-extern int creat (const char *__file, mode_t __mode) __THROW;
-extern int creat64 (const char *__file, mode_t __mode) __THROW;
-extern int lockf (int __fd, int __cmd, off_t __len) __THROW;
-extern int lockf64 (int __fd, int __cmd, off64_t __len) __THROW;
-
-#define F_ULOCK 0 /* Unlock a previously locked region. */
-#define F_LOCK 1 /* Lock a region for exclusive use. */
-#define F_TLOCK 2 /* Test and lock a region for exclusive use. */
-#define F_TEST 3 /* Test a region for other processes locks. */
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/features.h b/mdk-stage1/dietlibc/include/features.h
deleted file mode 100644
index 5b0283f20..000000000
--- a/mdk-stage1/dietlibc/include/features.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#warning "someone included features.h, apparently someone is including glibc headers!"
-
-#define __dietlibc__
diff --git a/mdk-stage1/dietlibc/include/fnmatch.h b/mdk-stage1/dietlibc/include/fnmatch.h
deleted file mode 100644
index 762b43ff7..000000000
--- a/mdk-stage1/dietlibc/include/fnmatch.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _FNMATCH_H
-#define _FNMATCH_H
-
-#include <sys/cdefs.h>
-
-int fnmatch(const char *pattern, const char *string, int flags) __THROW;
-
-#define FNM_NOESCAPE 1
-#define FNM_PATHNAME 2
-#define FNM_FILE_NAME 2
-#define FNM_PERIOD 4
-#define FNM_LEADING_DIR 8
-#define FNM_CASEFOLD 16
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/ftw.h b/mdk-stage1/dietlibc/include/ftw.h
deleted file mode 100644
index c888f0021..000000000
--- a/mdk-stage1/dietlibc/include/ftw.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _FTW_H
-#define _FTW_H
-
-#include <sys/cdefs.h>
-#include <sys/stat.h>
-
-struct FTW
- {
- int base;
- int level;
- };
-
-int ftw (const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag), int depth) __THROW;
-int nftw (const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag, struct FTW *s), int depth, int flags) __THROW;
-
-enum
-{
- FTW_F, /* Regular file. */
-#define FTW_F FTW_F
- FTW_D, /* Directory. */
-#define FTW_D FTW_D
- FTW_DNR, /* Unreadable directory. */
-#define FTW_DNR FTW_DNR
- FTW_NS, /* Unstatable file. */
-#define FTW_NS FTW_NS
- FTW_SL, /* Symbolic link. */
-# define FTW_SL FTW_SL
-/* These flags are only passed from the `nftw' function. */
- FTW_DP, /* Directory, all subdirs have been visited. */
-# define FTW_DP FTW_DP
- FTW_SLN /* Symbolic link naming non-existing file. */
-# define FTW_SLN FTW_SLN
-};
-
-typedef int (*__ftw_func_t) (__const char *__filename,
- __const struct stat *__status, int __flag) __THROW;
-
-typedef int (*__nftw_func_t) (__const char *__filename,
- __const struct stat *__status, int __flag,
- struct FTW *__info) __THROW;
-
-#ifndef __NO_STAT64
-typedef int (*__ftw64_func_t) (__const char *__filename,
- __const struct stat64 *__status, int __flag) __THROW;
-
-typedef int (*__nftw64_func_t) (__const char *__filename,
- __const struct stat64 *__status,
- int __flag, struct FTW *__info) __THROW;
-#endif
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/getopt.h b/mdk-stage1/dietlibc/include/getopt.h
deleted file mode 100644
index ebfc5522d..000000000
--- a/mdk-stage1/dietlibc/include/getopt.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __GETOPT_H__
-#define __GETOPT_H__
-
-extern int optind,opterr;
-extern char *optarg;
-int getopt(int argc, char *argv[], char *options);
-
-/* the following was taken from GNU getopt, it's not actually supported
- * by the diet libc! */
-extern int optopt;
-
-struct option {
- const char* name;
- int has_arg;
- int* flag;
- int val;
-};
-
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
-
-extern int getopt_long(int argc, char *const *argv,
- const char *shortopts, const struct option *longopts,
- int *longind);
-
-extern int getopt_long_only(int argc, char *const *argv,
- const char *shortopts, const struct option *longopts,
- int *longind);
-
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/glob.h b/mdk-stage1/dietlibc/include/glob.h
deleted file mode 100644
index 80febbccf..000000000
--- a/mdk-stage1/dietlibc/include/glob.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _GLOB_H
-#define _GLOB_H
-
-
-typedef struct {
- size_t gl_pathc; /* Count of paths matched so far */
- char **gl_pathv; /* List of matched pathnames. */
- size_t gl_offs; /* Slots to reserve in `gl_pathv'. */
- int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
-} glob_t;
-
-
-int glob(const char *pattern, int flags,
- int errfunc(const char * epath, int eerrno),
- glob_t *pglob) __THROW;
-
-void globfree(glob_t *pglob) __THROW;
-
-
-
-/* Bits set in the FLAGS argument to `glob'. */
-#define GLOB_ERR (1 << 0)/* Return on read errors. */
-#define GLOB_MARK (1 << 1)/* Append a slash to each name. */
-#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */
-#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */
-#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */
-#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */
-#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */
-#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
-
-#define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
-#define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
-#define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
-#define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */
-#define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */
-#define GLOB_ONLYDIR (1 << 13)/* Match only directories. */
-#define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error
- if the user name is not available. */
-#define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
- GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
- GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \
- GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK)
-
-
-/* Error returns from `glob'. */
-#define GLOB_NOSPACE 1 /* Ran out of memory. */
-#define GLOB_ABORTED 2 /* Read error. */
-#define GLOB_NOMATCH 3 /* No matches found. */
-#define GLOB_NOSYS 4 /* Not implemented. */
-/* Previous versions of this file defined GLOB_ABEND instead of
- GLOB_ABORTED. Provide a compatibility definition here. */
-#define GLOB_ABEND GLOB_ABORTED
-
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/grp.h b/mdk-stage1/dietlibc/include/grp.h
deleted file mode 100644
index 32bf49afc..000000000
--- a/mdk-stage1/dietlibc/include/grp.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _GRP_H
-#define _GRP_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-struct group
- {
- char *gr_name; /* Group name. */
- char *gr_passwd; /* Password. */
- gid_t gr_gid; /* Group ID. */
- char **gr_mem; /* Member list. */
- };
-
-extern struct group *getgrgid (gid_t uid) __THROW;
-extern struct group *getgrnam (const char *name) __THROW;
-
-extern struct group *getgrent(void) __THROW;
-extern void setgrent(void) __THROW;
-extern void endgrent(void) __THROW;
-
-extern int setgroups(size_t n, const gid_t *groups) __THROW;
-extern int initgroups(const char *user, gid_t group) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/inttypes.h b/mdk-stage1/dietlibc/include/inttypes.h
deleted file mode 100644
index e69de29bb..000000000
--- a/mdk-stage1/dietlibc/include/inttypes.h
+++ /dev/null
diff --git a/mdk-stage1/dietlibc/include/limits.h b/mdk-stage1/dietlibc/include/limits.h
deleted file mode 100644
index a333debfd..000000000
--- a/mdk-stage1/dietlibc/include/limits.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef _LIMITS_H
-#define _LIMITS_H
-
-#include <linux/limits.h>
-
-#define __WORDSIZE 32
-
-#ifdef __alpha__
-#undef __WORDSIZE
-#define __WORDSIZE 64
-#endif
-
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-#define CHAR_BIT 8
-
-#define SCHAR_MIN (-128)
-#define SCHAR_MAX 0x7f
-#define UCHAR_MAX 0xff
-
-#define SHRT_MIN (-SHRT_MAX-1)
-#define SHRT_MAX 0x7fff
-#define USHRT_MAX 0xffff
-
-#define INT_MIN (-INT_MAX-1)
-#define INT_MAX 0x7fffffff
-#define UINT_MAX 0xffffffff
-
-#if __WORDSIZE == 64
-#define LONG_MAX 9223372036854775807L
-#define ULONG_MAX 18446744073709551615UL
-#else
-#define LONG_MAX 2147483647L
-#define ULONG_MAX 4294967295UL
-#endif
-#define LONG_MIN (-LONG_MAX - 1L)
-
-#define LLONG_MAX 9223372036854775807LL
-#define LLONG_MIN (-LLONG_MAX - 1LL)
-
-/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */
-#define ULLONG_MAX 18446744073709551615ULL
-
-#define PASS_MAX 256
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/locale.h b/mdk-stage1/dietlibc/include/locale.h
deleted file mode 100644
index acbeec8c1..000000000
--- a/mdk-stage1/dietlibc/include/locale.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#warning "there is no locale support for diet libc yet"
-
-#define setlocale(a,b) 0
-#define bindtextdomain
-#define textdomain
-
diff --git a/mdk-stage1/dietlibc/include/malloc.h b/mdk-stage1/dietlibc/include/malloc.h
deleted file mode 100644
index c8b49f26d..000000000
--- a/mdk-stage1/dietlibc/include/malloc.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <stdlib.h>
diff --git a/mdk-stage1/dietlibc/include/math.h b/mdk-stage1/dietlibc/include/math.h
deleted file mode 100644
index 2f4f2e33f..000000000
--- a/mdk-stage1/dietlibc/include/math.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef _MATH_H
-#define _MATH_H
-
-#include <sys/cdefs.h>
-
-#define M_E 2.7182818284590452354 /* e */
-#define M_LOG2E 1.4426950408889634074 /* log_2 e */
-#define M_LOG10E 0.43429448190325182765 /* log_10 e */
-#define M_LN2 0.69314718055994530942 /* log_e 2 */
-#define M_LN10 2.30258509299404568402 /* log_e 10 */
-#define M_PI 3.14159265358979323846 /* pi */
-#define M_PI_2 1.57079632679489661923 /* pi/2 */
-#define M_PI_4 0.78539816339744830962 /* pi/4 */
-#define M_1_PI 0.31830988618379067154 /* 1/pi */
-#define M_2_PI 0.63661977236758134308 /* 2/pi */
-#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
-#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
-#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
-
-#define M_El 2.7182818284590452353602874713526625L /* e */
-#define M_LOG2El 1.4426950408889634073599246810018922L /* log_2 e */
-#define M_LOG10El 0.4342944819032518276511289189166051L /* log_10 e */
-#define M_LN2l 0.6931471805599453094172321214581766L /* log_e 2 */
-#define M_LN10l 2.3025850929940456840179914546843642L /* log_e 10 */
-#define M_PIl 3.1415926535897932384626433832795029L /* pi */
-#define M_PI_2l 1.5707963267948966192313216916397514L /* pi/2 */
-#define M_PI_4l 0.7853981633974483096156608458198757L /* pi/4 */
-#define M_1_PIl 0.3183098861837906715377675267450287L /* 1/pi */
-#define M_2_PIl 0.6366197723675813430755350534900574L /* 2/pi */
-#define M_2_SQRTPIl 1.1283791670955125738961589031215452L /* 2/sqrt(pi) */
-#define M_SQRT2l 1.4142135623730950488016887242096981L /* sqrt(2) */
-#define M_SQRT1_2l 0.7071067811865475244008443621048490L /* 1/sqrt(2) */
-
-double sin(double d) __THROW __attribute__((__const__));
-double cos(double d) __THROW __attribute__((__const__));
-double tan(double d) __THROW __attribute__((__const__));
-
-double sinh(double d) __THROW __attribute__((__const__));
-double cosh(double d) __THROW __attribute__((__const__));
-double tanh(double d) __THROW __attribute__((__const__));
-
-double asin(double d) __THROW __attribute__((__const__));
-double acos(double d) __THROW __attribute__((__const__));
-double atan(double d) __THROW __attribute__((__const__));
-
-double asinh(double d) __THROW __attribute__((__const__));
-double acosh(double d) __THROW __attribute__((__const__));
-double atanh(double d) __THROW __attribute__((__const__));
-
-double exp(double d) __THROW __attribute__((__const__));
-double log(double d) __THROW __attribute__((__const__));
-double log10(double d) __THROW __attribute__((__const__));
-
-double pow(double x, double y) __THROW __attribute__((__const__));
-
-double sqrt(double x) __THROW __attribute__((__const__));
-double fabs(double x) __THROW __attribute__((__const__));
-double fmod(double x, double y) __THROW __attribute__((__const__));
-
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/memory.h b/mdk-stage1/dietlibc/include/memory.h
deleted file mode 100644
index 39adee705..000000000
--- a/mdk-stage1/dietlibc/include/memory.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _MEMORY_H
-#define _MEMORY_H
-
-#include <string.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/mntent.h b/mdk-stage1/dietlibc/include/mntent.h
deleted file mode 100644
index 301403224..000000000
--- a/mdk-stage1/dietlibc/include/mntent.h
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef _MNTENT_H
-#define _MNTENT_H
-
-#include <sys/cdefs.h>
-#include <stdio.h>
-#include <paths.h>
-
-#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
-#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
-
-/* General filesystem types. */
-#define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */
-#define MNTTYPE_NFS "nfs" /* Network file system. */
-#define MNTTYPE_SWAP "swap" /* Swap device. */
-
-
-/* Generic mount options. */
-#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
-#define MNTOPT_RO "ro" /* Read only. */
-#define MNTOPT_RW "rw" /* Read/write. */
-#define MNTOPT_SUID "suid" /* Set uid allowed. */
-#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
-#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
-
-__BEGIN_DECLS
-
-/* Structure describing a mount table entry. */
-struct mntent
- {
- char *mnt_fsname; /* Device or server for filesystem. */
- char *mnt_dir; /* Directory mounted on. */
- char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */
- char *mnt_opts; /* Comma-separated options for fs. */
- int mnt_freq; /* Dump frequency (in days). */
- int mnt_passno; /* Pass number for `fsck'. */
- };
-
-
-/* Prepare to begin reading and/or writing mount table entries from the
- beginning of FILE. MODE is as for `fopen'. */
-extern FILE *setmntent (const char *file, const char *mode) __THROW;
-
-/* Read one mount table entry from STREAM. Returns a pointer to storage
- reused on the next call, or null for EOF or error (use feof/ferror to
- check). */
-extern struct mntent *getmntent (FILE* stream) __THROW;
-
-#ifdef __USE_MISC
-/* Reentrant version of the above function. */
-extern struct mntent *getmntent_r (FILE* stream,
- struct mntent* result,
- char* buffer,
- int bufsize) __THROW;
-#endif
-
-/* Write the mount table entry described by MNT to STREAM.
- Return zero on success, nonzero on failure. */
-extern int addmntent (FILE* stream,
- const struct mntent* mnt) __THROW;
-
-/* Close a stream opened with `setmntent'. */
-extern int endmntent (FILE *stream) __THROW;
-
-/* Search MNT->mnt_opts for an option matching OPT.
- Returns the address of the substring, or null if none found. */
-extern char *hasmntopt (const struct mntent *__mnt,
- const char *opt) __THROW;
-
-
-__END_DECLS
-
-#endif /* mntent.h */
diff --git a/mdk-stage1/dietlibc/include/net/if.h b/mdk-stage1/dietlibc/include/net/if.h
deleted file mode 100644
index 88f386f46..000000000
--- a/mdk-stage1/dietlibc/include/net/if.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _NET_IF_H
-#define _NET_IF_H
-
-#include <sys/cdefs.h>
-
-#include <linux/if.h>
-
-unsigned int if_nametoindex (const char *ifname) __THROW;
-char *if_indextoname (unsigned int ifindex, char *ifname) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/net/if_arp.h b/mdk-stage1/dietlibc/include/net/if_arp.h
deleted file mode 100644
index fe37a22dc..000000000
--- a/mdk-stage1/dietlibc/include/net/if_arp.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _NET_IF_ARP_H
-#define _NET_IF_ARP_H
-
-#include <linux/if_arp.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/net/route.h b/mdk-stage1/dietlibc/include/net/route.h
deleted file mode 100644
index 5e5db7b1a..000000000
--- a/mdk-stage1/dietlibc/include/net/route.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _NET_IF_ROUTE_H
-#define _NET_IF_ROUTE_H
-
-#include <linux/route.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/netdb.h b/mdk-stage1/dietlibc/include/netdb.h
deleted file mode 100644
index e90ea81ac..000000000
--- a/mdk-stage1/dietlibc/include/netdb.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef _NETDB_H
-#define _NETDB_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-/* Absolute file name for network data base files. */
-#define _PATH_HEQUIV "/etc/hosts.equiv"
-#define _PATH_HOSTS "/etc/hosts"
-#define _PATH_NETWORKS "/etc/networks"
-#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
-#define _PATH_PROTOCOLS "/etc/protocols"
-#define _PATH_SERVICES "/etc/services"
-
-/* Description of data base entry for a single service. */
-struct servent
-{
- char *s_name; /* Official service name. */
- char **s_aliases; /* Alias list. */
- int s_port; /* Port number. */
- char *s_proto; /* Protocol to use. */
-};
-
-extern void endservent (void) __THROW;
-extern struct servent *getservent (void) __THROW;
-extern struct servent *getservbyname (const char *__name,
- const char *__proto) __THROW;
-extern struct servent *getservbyport (int __port, const char *__proto)
- __THROW;
-
-struct hostent
-{
- char *h_name; /* Official name of host. */
- char **h_aliases; /* Alias list. */
- int h_addrtype; /* Host address type. */
- socklen_t h_length; /* Length of address. */
- char **h_addr_list; /* List of addresses from name server. */
-#define h_addr h_addr_list[0] /* Address, for backward compatibility. */
-};
-
-extern void endhostent (void) __THROW;
-extern struct hostent *gethostent (void) __THROW;
-extern struct hostent *gethostbyaddr (const void *__addr, socklen_t __len,
- int __type) __THROW;
-extern struct hostent *gethostbyname (const char *__name) __THROW;
-extern struct hostent *gethostbyname2 (const char *__name, int __af) __THROW;
-
-/* this glibc "invention" is so ugly, I'm going to throw up any minute
- * now */
-extern int gethostbyname_r(const char* NAME, struct hostent* RESULT_BUF,char* BUF,
- size_t BUFLEN, struct hostent** RESULT,
- int* H_ERRNOP) __THROW;
-
-#define HOST_NOT_FOUND 1
-#define TRY_AGAIN 2
-#define NO_RECOVERY 3
-#define NO_ADDRESS 4
-
-extern int gethostbyaddr_r(const char* addr, size_t length, int format,
- struct hostent* result, char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop) __THROW;
-
-struct protoent {
- char *p_name; /* official protocol name */
- char **p_aliases; /* alias list */
- int p_proto; /* protocol number */
-};
-
-struct protoent *getprotoent(void) __THROW;
-struct protoent *getprotobyname(const char *name) __THROW;
-struct protoent *getprotobynumber(int proto) __THROW;
-void setprotoent(int stayopen) __THROW;
-void endprotoent(void) __THROW;
-
-
-/* Description of data base entry for a single network. NOTE: here a
- poor assumption is made. The network number is expected to fit
- into an unsigned long int variable. */
-struct netent
-{
- char *n_name; /* Official name of network. */
- char **n_aliases; /* Alias list. */
- int n_addrtype; /* Net address type. */
- uint32_t n_net; /* Network number. */
-};
-
-extern struct netent *getnetbyname (__const char *__name) __THROW;
-
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/netinet/in.h b/mdk-stage1/dietlibc/include/netinet/in.h
deleted file mode 100644
index 0569c8289..000000000
--- a/mdk-stage1/dietlibc/include/netinet/in.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _NETINET_IN_H
-#define _NETINET_IN_H
-
-#include <linux/in.h>
-#include <linux/in6.h>
-
-#define IPPORT_RESERVED 1024
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/netinet/in_systm.h b/mdk-stage1/dietlibc/include/netinet/in_systm.h
deleted file mode 100644
index e69de29bb..000000000
--- a/mdk-stage1/dietlibc/include/netinet/in_systm.h
+++ /dev/null
diff --git a/mdk-stage1/dietlibc/include/netinet/ip.h b/mdk-stage1/dietlibc/include/netinet/ip.h
deleted file mode 100644
index 35bf9cc42..000000000
--- a/mdk-stage1/dietlibc/include/netinet/ip.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _NETINET_IP_H
-#define _NETINET_IP_H
-
-#include <linux/ip.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/paths.h b/mdk-stage1/dietlibc/include/paths.h
deleted file mode 100644
index 0e36bb10e..000000000
--- a/mdk-stage1/dietlibc/include/paths.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _PATHS_H
-#define _PATHS_H
-
-#define _PATH_BSHELL "/bin/sh"
-#define _PATH_DEFPATH "/bin:/usr/bin:"
-
-#define _PATH_DEVNULL "/dev/null"
-
-#define _PATH_CONSOLE "/dev/console"
-#define _PATH_MOUNTED "/etc/mtab"
-
-#define _PATH_PASSWD "/etc/passwd"
-#define _PATH_GROUP "/etc/group"
-#define _PATH_SHADOW "/etc/shadow"
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/pthread.h b/mdk-stage1/dietlibc/include/pthread.h
deleted file mode 100644
index e922ab28b..000000000
--- a/mdk-stage1/dietlibc/include/pthread.h
+++ /dev/null
@@ -1,227 +0,0 @@
-#ifndef _PTHREAD_H
-#define _PTHREAD_H 1
-
-#include <sched.h>
-#include <signal.h>
-#include <setjmp.h>
-
-/* arg... kernel haeder... */
-#define ENOTSUP 524 /* Operation is not supported */
-
-#define PTHREAD_STACK_SIZE 16384
-
-#define PTHREAD_THREADS_MAX 128
-
-#define MAX_SPIN_COUNT 50
-#define SPIN_SLEEP_DURATION 2000001
-
-#define PTHREAD_KEYS_MAX 7
-#define PTHREAD_DESTRUCTOR_ITERATIONS 10
-
-typedef struct _pthread_descr_struct *_pthread_descr;
-typedef unsigned long int pthread_t;
-
-/* Fast locks */
-struct _pthread_fastlock {
- int __spinlock;
-};
-
-/* Mutexes */
-typedef struct {
- struct _pthread_fastlock lock;
- _pthread_descr owner;
- int kind;
- unsigned int count;
-} pthread_mutex_t;
-
-enum {
- PTHREAD_MUTEX_FAST_NP,
- PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ERRORCHECK_NP,
-};
-
-enum
-{
- PTHREAD_PROCESS_PRIVATE,
-#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
- PTHREAD_PROCESS_SHARED
-#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
-};
-
-#define PTHREAD_MUTEX_INITIALIZER \
-{{0}, 0, PTHREAD_MUTEX_FAST_NP, 0}
-
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
-{{0}, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0}
-
-#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
-{{0}, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0}
-
-typedef struct {
- int __mutexkind;
-} pthread_mutexattr_t;
-
-int pthread_mutex_init(pthread_mutex_t *mutex,
- const pthread_mutexattr_t *mutexattr);
-int pthread_mutex_lock(pthread_mutex_t *mutex);
-int pthread_mutex_unlock(pthread_mutex_t *mutex);
-int pthread_mutex_trylock(pthread_mutex_t *mutex);
-int pthread_mutex_destroy(pthread_mutex_t *mutex);
-
-/* Conditions */
-typedef void* pthread_condattr_t;
-
-typedef struct {
- struct _pthread_fastlock lock;
- _pthread_descr wait_chain;
-} pthread_cond_t;
-
-#define PTHREAD_COND_INITIALIZER \
-{{0},0}
-
-int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *cond_attr);
-int pthread_cond_destroy(pthread_cond_t *cond);
-int pthread_cond_signal(pthread_cond_t *cond);
-int pthread_cond_broadcast(pthread_cond_t *cond);
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- const struct timespec *abstime);
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
-
-/* only for completeness (always return NULL) */
-int pthread_condattr_init(pthread_condattr_t *attr);
-int pthread_condattr_destroy(pthread_condattr_t *attr);
-int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared);
-int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared);
-
-/* thread specific variables */
-typedef unsigned int pthread_key_t;
-
-int pthread_key_create(pthread_key_t *key, void (*destructor)(const void*));
-int pthread_key_delete(pthread_key_t key);
-int pthread_setspecific(pthread_key_t key, const void *value);
-const void *pthread_getspecific(pthread_key_t key);
-
-
-/* Attributes for threads. */
-typedef struct
-{
- int __detachstate;
- int __schedpolicy;
- struct sched_param __schedparam;
- int __inheritsched;
- int __scope;
- void * __stackaddr;
- unsigned long __stacksize;
-} pthread_attr_t;
-
-enum
-{
- PTHREAD_CREATE_JOINABLE,
-#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
- PTHREAD_CREATE_DETACHED
-#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
-};
-
-enum
-{
- PTHREAD_EXPLICIT_SCHED,
-#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED
- PTHREAD_INHERIT_SCHED
-#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED
-};
-
-enum /* for completeness */
-{
- PTHREAD_SCOPE_SYSTEM,
-#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
- PTHREAD_SCOPE_PROCESS
-#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
-};
-
-int pthread_attr_init(pthread_attr_t *attr);
-int pthread_attr_destroy(pthread_attr_t *attr);
-
-int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate);
-int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate);
-
-int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
-int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy);
-
-int pthread_attr_setschedparam(pthread_attr_t *attr,
- const struct sched_param *param);
-int pthread_attr_getschedparam(const pthread_attr_t *attr,
- struct sched_param *param);
-
-int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit);
-int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit);
-
-int pthread_attr_setscope(pthread_attr_t *attr, int scope);
-int pthread_attr_getscope(const pthread_attr_t *attr, int *scope);
-
-int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack);
-int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stack);
-
-int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
-int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize);
-
-/* ONCE */
-typedef int pthread_once_t;
-#define PTHREAD_ONCE_INIT 0
-
-int __pthread_once(pthread_once_t* once_control, void (*init_routine)(void));
-int pthread_once(pthread_once_t* once_control, void (*init_routine)(void));
-
-/* CANCEL */
-
-enum {
- PTHREAD_CANCEL_ENABLE,
-#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
- PTHREAD_CANCEL_DISABLE,
-#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
-};
-
-enum {
- PTHREAD_CANCEL_ASYNCHRONOUS,
-#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
- PTHREAD_CANCEL_DEFERRED,
-#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
-};
-
-#define PTHREAD_CANCELED ((void *) -1)
-
-int pthread_cancel(pthread_t thread);
-int pthread_setcancelstate(int state, int *oldstate);
-
-int pthread_setcanceltype(int type, int *oldtype);
-
-void pthread_testcancel(void);
-
-/* CLEANUP */
-
-void pthread_cleanup_push(void (*routine)(void*), void *arg);
-void pthread_cleanup_pop (int execute);
-
-void pthread_cleanup_push_defer_np(void (*routine)(void *), void *arg);
-void pthread_cleanup_pop_restore_np(int execute);
-
-/* FORK */
-
-pid_t pthread_atfork(void (*prepare)(void), void (*parent)(void),
- void (*child)(void));
-
-/* THREADS */
-int pthread_create (pthread_t *__thread,
- const pthread_attr_t *__attr,
- void *(*__start_routine) (void *),
- void *__arg);
-
-void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
-
-int pthread_join (pthread_t __th, void **__thread_return);
-
-int pthread_detach (pthread_t __th);
-
-pthread_t pthread_self (void);
-int pthread_equal (pthread_t __thread1, pthread_t __thread2);
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/pwd.h b/mdk-stage1/dietlibc/include/pwd.h
deleted file mode 100644
index e6fb5d0be..000000000
--- a/mdk-stage1/dietlibc/include/pwd.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _PWD_H
-#define _PWD_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-struct passwd {
- char *pw_name; /* Username. */
- char *pw_passwd; /* Password. */
- uid_t pw_uid; /* User ID. */
- gid_t pw_gid; /* Group ID. */
- char *pw_gecos; /* Real name. */
- char *pw_dir; /* Home directory. */
- char *pw_shell; /* Shell program. */
-};
-
-extern struct passwd *getpwuid (uid_t __uid) __THROW;
-extern struct passwd *getpwnam (const char *__name) __THROW;
-
-extern struct passwd *getpwent(void) __THROW;
-extern void setpwent(void) __THROW;
-extern void endpwent(void) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/regex.h b/mdk-stage1/dietlibc/include/regex.h
deleted file mode 100644
index be609d9db..000000000
--- a/mdk-stage1/dietlibc/include/regex.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef _REGEX_H
-#define _REGEX_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-typedef ptrdiff_t regoff_t;
-
-typedef struct {
- regoff_t rm_so;
- regoff_t rm_eo;
-} regmatch_t;
-
-#define REG_EXTENDED 1
-#define REG_ICASE 2
-#define REG_NOSUB 4
-#define REG_NEWLINE 8
-
-#define REG_NOTBOL 1
-#define REG_NOTEOL 2
-
-#define REG_NOMATCH -1
-
-#define RE_DUP_MAX 255
-
-struct __regex_t;
-
-typedef int (*matcher)(void*,const char*,int ofs,struct __regex_t *t,int plus,int eflags);
-
-typedef struct __regex_t {
- struct regex {
- matcher m;
- void* next;
- int pieces;
- int num;
- struct branch *b;
- } r;
- int brackets,cflags;
- regmatch_t *l;
-} regex_t;
-
-int regcomp(regex_t *preg, const char *regex, int cflags) __THROW;
-int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) __THROW;
-size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) __THROW;
-void regfree(regex_t *preg) __THROW;
-
-enum __regex_errors {
- REG_NOERROR,
- REG_BADRPT, /* Invalid use of repetition operators such as using `*' as the first character. */
- REG_BADBR, /* Invalid use of back reference operator. */
- REG_EBRACE, /* Un-matched brace interval operators. */
- REG_EBRACK, /* Un-matched bracket list operators. */
- REG_ERANGE, /* Invalid use of the range operator, eg. the ending point of the
- range occurs prior to the starting point. */
- REG_ECTYPE, /* Unknown character class name. */
- REG_ECOLLATE, /* Invalid collating element. */
- REG_EPAREN, /* Un-matched parenthesis group operators. */
- REG_ESUBREG, /* Invalid back reference to a subexpression. */
- REG_EEND, /* Non specific error. This is not defined by POSIX.2. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_BADPAT, /* Invalid use of pattern operators such as group or list. */
- REG_ESIZE, /* Compiled regular expression requires a pattern buffer
- larger than 64Kb. This is not defined by POSIX.2. */
- REG_ESPACE, /* regcomp ran out of space */
-};
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/resolv.h b/mdk-stage1/dietlibc/include/resolv.h
deleted file mode 100644
index 4e90799c2..000000000
--- a/mdk-stage1/dietlibc/include/resolv.h
+++ /dev/null
@@ -1 +0,0 @@
-void res_init(void);
diff --git a/mdk-stage1/dietlibc/include/rpc/auth.h b/mdk-stage1/dietlibc/include/rpc/auth.h
deleted file mode 100644
index 4aa7d21ce..000000000
--- a/mdk-stage1/dietlibc/include/rpc/auth.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * auth.h, Authentication interface.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * The data structures are completely opaque to the client. The client
- * is required to pass a AUTH * to routines that create rpc
- * "sessions".
- */
-
-#ifndef _RPC_AUTH_H
-
-#define _RPC_AUTH_H 1
-#include <sys/cdefs.h>
-#include <rpc/xdr.h>
-
-__BEGIN_DECLS
-
-#define MAX_AUTH_BYTES 400
-#define MAXNETNAMELEN 255 /* maximum length of network user's name */
-
-/*
- * Status returned from authentication check
- */
-enum auth_stat {
- AUTH_OK=0,
- /*
- * failed at remote end
- */
- AUTH_BADCRED=1, /* bogus credentials (seal broken) */
- AUTH_REJECTEDCRED=2, /* client should begin new session */
- AUTH_BADVERF=3, /* bogus verifier (seal broken) */
- AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
- AUTH_TOOWEAK=5, /* rejected due to security reasons */
- /*
- * failed locally
- */
- AUTH_INVALIDRESP=6, /* bogus response verifier */
- AUTH_FAILED=7 /* some unknown reason */
-};
-
-union des_block {
- struct {
- u_int32_t high;
- u_int32_t low;
- } key;
- char c[8];
-};
-typedef union des_block des_block;
-extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW;
-
-/*
- * Authentication info. Opaque to client.
- */
-struct opaque_auth {
- enum_t oa_flavor; /* flavor of auth */
- caddr_t oa_base; /* address of more auth stuff */
- u_int oa_length; /* not to exceed MAX_AUTH_BYTES */
-};
-
-/*
- * Auth handle, interface to client side authenticators.
- */
-typedef struct AUTH AUTH;
-struct AUTH {
- struct opaque_auth ah_cred;
- struct opaque_auth ah_verf;
- union des_block ah_key;
- struct auth_ops {
- void (*ah_nextverf) (AUTH *);
- int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */
- int (*ah_validate) (AUTH *, struct opaque_auth *);
- /* validate verifier */
- int (*ah_refresh) (AUTH *); /* refresh credentials */
- void (*ah_destroy) (AUTH *); /* destroy this structure */
- } *ah_ops;
- caddr_t ah_private;
-};
-
-
-/*
- * Authentication ops.
- * The ops and the auth handle provide the interface to the authenticators.
- *
- * AUTH *auth;
- * XDR *xdrs;
- * struct opaque_auth verf;
- */
-#define AUTH_NEXTVERF(auth) \
- ((*((auth)->ah_ops->ah_nextverf))(auth))
-#define auth_nextverf(auth) \
- ((*((auth)->ah_ops->ah_nextverf))(auth))
-
-#define AUTH_MARSHALL(auth, xdrs) \
- ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
-#define auth_marshall(auth, xdrs) \
- ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
-
-#define AUTH_VALIDATE(auth, verfp) \
- ((*((auth)->ah_ops->ah_validate))((auth), verfp))
-#define auth_validate(auth, verfp) \
- ((*((auth)->ah_ops->ah_validate))((auth), verfp))
-
-#define AUTH_REFRESH(auth) \
- ((*((auth)->ah_ops->ah_refresh))(auth))
-#define auth_refresh(auth) \
- ((*((auth)->ah_ops->ah_refresh))(auth))
-
-#define AUTH_DESTROY(auth) \
- ((*((auth)->ah_ops->ah_destroy))(auth))
-#define auth_destroy(auth) \
- ((*((auth)->ah_ops->ah_destroy))(auth))
-
-
-extern struct opaque_auth _null_auth;
-
-
-/*
- * These are the various implementations of client side authenticators.
- */
-
-/*
- * Unix style authentication
- * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
- * char *machname;
- * int uid;
- * int gid;
- * int len;
- * int *aup_gids;
- */
-extern AUTH *authunix_create (char *__machname,uid_t __uid, gid_t __gid,
- int __len, gid_t *__aup_gids) __THROW;
-extern AUTH *authunix_create_default (void) __THROW;
-extern AUTH *authnone_create (void) __THROW;
-extern AUTH *authdes_create (const char *__servername, u_int __window,
- struct sockaddr *__syncaddr, des_block *__ckey)
- __THROW;
-extern AUTH *authdes_pk_create (const char *, netobj *, u_int,
- struct sockaddr *, des_block *) __THROW;
-
-
-#define AUTH_NONE 0 /* no authentication */
-#define AUTH_NULL 0 /* backward compatibility */
-#define AUTH_SYS 1 /* unix style (uid, gids) */
-#define AUTH_UNIX AUTH_SYS
-#define AUTH_SHORT 2 /* short hand unix style */
-#define AUTH_DES 3 /* des style (encrypted timestamps) */
-#define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */
-#define AUTH_KERB 4 /* kerberos style */
-
-/*
- * Netname manipulating functions
- *
- */
-extern int getnetname (char *) __THROW;
-extern int host2netname (char *, __const char *, __const char *) __THROW;
-extern int user2netname (char *, __const uid_t, __const char *) __THROW;
-extern int netname2user (__const char *, uid_t *, gid_t *, int *, gid_t *)
- __THROW;
-extern int netname2host (__const char *, char *, __const int) __THROW;
-
-/*
- *
- * These routines interface to the keyserv daemon
- *
- */
-extern int key_decryptsession (char *, des_block *) __THROW;
-extern int key_decryptsession_pk (char *, netobj *, des_block *) __THROW;
-extern int key_encryptsession (char *, des_block *) __THROW;
-extern int key_encryptsession_pk (char *, netobj *, des_block *) __THROW;
-extern int key_gendes (des_block *) __THROW;
-extern int key_setsecret (char *) __THROW;
-extern int key_secretkey_is_set (void) __THROW;
-extern int key_get_conv (char *, des_block *) __THROW;
-
-/*
- * XDR an opaque authentication struct.
- */
-extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *) __THROW;
-
-__END_DECLS
-
-#endif /* rpc/auth.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/auth_des.h b/mdk-stage1/dietlibc/include/rpc/auth_des.h
deleted file mode 100644
index 198b299e7..000000000
--- a/mdk-stage1/dietlibc/include/rpc/auth_des.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 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. */
-
-#ifndef _RPC_AUTH_DES_H
-#define _RPC_AUTH_DES_H 1
-
-#include <sys/cdefs.h>
-#include <rpc/auth.h>
-
-__BEGIN_DECLS
-
-/* There are two kinds of "names": fullnames and nicknames */
-enum authdes_namekind
- {
- ADN_FULLNAME,
- ADN_NICKNAME
- };
-
-/* A fullname contains the network name of the client,
- a conversation key and the window */
-struct authdes_fullname
- {
- char *name; /* network name of client, up to MAXNETNAMELEN */
- des_block key; /* conversation key */
- uint32_t window; /* associated window */
- };
-
-/* A credential */
-struct authdes_cred
- {
- enum authdes_namekind adc_namekind;
- struct authdes_fullname adc_fullname;
- uint32_t adc_nickname;
- };
-
-/* A timeval replacement for !32bit platforms */
-struct rpc_timeval
- {
- uint32_t tv_sec; /* Seconds. */
- uint32_t tv_usec; /* Microseconds. */
- };
-
-/* A des authentication verifier */
-struct authdes_verf
- {
- union
- {
- struct rpc_timeval adv_ctime; /* clear time */
- des_block adv_xtime; /* crypt time */
- }
- adv_time_u;
- uint32_t adv_int_u;
- };
-
-/* des authentication verifier: client variety
-
- adv_timestamp is the current time.
- adv_winverf is the credential window + 1.
- Both are encrypted using the conversation key. */
-#define adv_timestamp adv_time_u.adv_ctime
-#define adv_xtimestamp adv_time_u.adv_xtime
-#define adv_winverf adv_int_u
-
-/* des authentication verifier: server variety
-
- adv_timeverf is the client's timestamp + client's window
- adv_nickname is the server's nickname for the client.
- adv_timeverf is encrypted using the conversation key. */
-#define adv_timeverf adv_time_u.adv_ctime
-#define adv_xtimeverf adv_time_u.adv_xtime
-#define adv_nickname adv_int_u
-
-/* Map a des credential into a unix cred. */
-extern int authdes_getucred (__const struct authdes_cred * __adc,
- uid_t * __uid, gid_t * __gid,
- short *__grouplen, gid_t * __groups) __THROW;
-
-/* Get the public key for NAME and place it in KEY. NAME can only be
- up to MAXNETNAMELEN bytes long and the destination buffer KEY should
- have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
-extern int getpublickey (__const char *__name, char *__key) __THROW;
-
-/* Get the secret key for NAME and place it in KEY. PASSWD is used to
- decrypt the encrypted key stored in the database. NAME can only be
- up to MAXNETNAMELEN bytes long and the destination buffer KEY
- should have HEXKEYBYTES + 1 bytes long to fit all characters from
- the key. */
-extern int getsecretkey (__const char *__name, char *__key,
- __const char *__passwd) __THROW;
-
-extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
- struct rpc_timeval *__timeout) __THROW;
-
-__END_DECLS
-
-
-#endif /* rpc/auth_des.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/auth_unix.h b/mdk-stage1/dietlibc/include/rpc/auth_unix.h
deleted file mode 100644
index 7a1bfa9f0..000000000
--- a/mdk-stage1/dietlibc/include/rpc/auth_unix.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)auth_unix.h 1.5 86/07/16 SMI */
-
-/*
- * auth_unix.h, Protocol for UNIX style authentication parameters for RPC
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-/*
- * The system is very weak. The client uses no encryption for it
- * credentials and only sends null verifiers. The server sends backs
- * null verifiers or optionally a verifier that suggests a new short hand
- * for the credentials.
- */
-
-#ifndef _RPC_AUTH_UNIX_H
-#define _RPC_AUTH_UNIX_H 1
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <rpc/types.h>
-#include <rpc/auth.h>
-#include <rpc/xdr.h>
-
-__BEGIN_DECLS
-
-/* The machine name is part of a credential; it may not exceed 255 bytes */
-#define MAX_MACHINE_NAME 255
-
-/* gids compose part of a credential; there may not be more than 16 of them */
-#define NGRPS 16
-
-/*
- * Unix style credentials.
- */
-struct authunix_parms
- {
- u_long aup_time;
- char *aup_machname;
- uid_t aup_uid;
- gid_t aup_gid;
- u_int aup_len;
- gid_t *aup_gids;
- };
-
-extern bool_t xdr_authunix_parms (XDR *__xdrs, struct authunix_parms *__p)
- __THROW;
-
-/*
- * If a response verifier has flavor AUTH_SHORT,
- * then the body of the response verifier encapsulates the following structure;
- * again it is serialized in the obvious fashion.
- */
-struct short_hand_verf
- {
- struct opaque_auth new_cred;
- };
-
-__END_DECLS
-
-#endif /* rpc/auth_unix.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/clnt.h b/mdk-stage1/dietlibc/include/rpc/clnt.h
deleted file mode 100644
index 60b0fafdf..000000000
--- a/mdk-stage1/dietlibc/include/rpc/clnt.h
+++ /dev/null
@@ -1,421 +0,0 @@
-/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * clnt.h - Client side remote procedure call interface.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_CLNT_H
-#define _RPC_CLNT_H 1
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <rpc/types.h>
-#include <rpc/auth.h>
-#include <sys/un.h>
-
-__BEGIN_DECLS
-
-/*
- * Rpc calls return an enum clnt_stat. This should be looked at more,
- * since each implementation is required to live with this (implementation
- * independent) list of errors.
- */
-enum clnt_stat {
- RPC_SUCCESS=0, /* call succeeded */
- /*
- * local errors
- */
- RPC_CANTENCODEARGS=1, /* can't encode arguments */
- RPC_CANTDECODERES=2, /* can't decode results */
- RPC_CANTSEND=3, /* failure in sending call */
- RPC_CANTRECV=4, /* failure in receiving result */
- RPC_TIMEDOUT=5, /* call timed out */
- /*
- * remote errors
- */
- RPC_VERSMISMATCH=6, /* rpc versions not compatible */
- RPC_AUTHERROR=7, /* authentication error */
- RPC_PROGUNAVAIL=8, /* program not available */
- RPC_PROGVERSMISMATCH=9, /* program version mismatched */
- RPC_PROCUNAVAIL=10, /* procedure unavailable */
- RPC_CANTDECODEARGS=11, /* decode arguments error */
- RPC_SYSTEMERROR=12, /* generic "other problem" */
- RPC_NOBROADCAST = 21, /* Broadcasting not supported */
- /*
- * callrpc & clnt_create errors
- */
- RPC_UNKNOWNHOST=13, /* unknown host name */
- RPC_UNKNOWNPROTO=17, /* unknown protocol */
- RPC_UNKNOWNADDR = 19, /* Remote address unknown */
-
- /*
- * rpcbind errors
- */
- RPC_RPCBFAILURE=14, /* portmapper failed in its call */
-#define RPC_PMAPFAILURE RPC_RPCBFAILURE
- RPC_PROGNOTREGISTERED=15, /* remote program is not registered */
- RPC_N2AXLATEFAILURE = 22, /* Name to addr translation failed */
- /*
- * unspecified error
- */
- RPC_FAILED=16,
- RPC_INTR=18,
- RPC_TLIERROR=20,
- RPC_UDERROR=23,
- /*
- * asynchronous errors
- */
- RPC_INPROGRESS = 24,
- RPC_STALERACHANDLE = 25
-};
-
-
-/*
- * Error info.
- */
-struct rpc_err {
- enum clnt_stat re_status;
- union {
- int RE_errno; /* related system error */
- enum auth_stat RE_why; /* why the auth error occurred */
- struct {
- u_long low; /* lowest verion supported */
- u_long high; /* highest verion supported */
- } RE_vers;
- struct { /* maybe meaningful if RPC_FAILED */
- long s1;
- long s2;
- } RE_lb; /* life boot & debugging only */
- } ru;
-#define re_errno ru.RE_errno
-#define re_why ru.RE_why
-#define re_vers ru.RE_vers
-#define re_lb ru.RE_lb
-};
-
-
-/*
- * Client rpc handle.
- * Created by individual implementations, see e.g. rpc_udp.c.
- * Client is responsible for initializing auth, see e.g. auth_none.c.
- */
-typedef struct CLIENT CLIENT;
-struct CLIENT {
- AUTH *cl_auth; /* authenticator */
- struct clnt_ops {
- enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t,
- caddr_t, struct timeval);
- /* call remote procedure */
- void (*cl_abort) (void); /* abort a call */
- void (*cl_geterr) (CLIENT *, struct rpc_err *);
- /* get specific error code */
- bool_t (*cl_freeres) (CLIENT *, xdrproc_t, caddr_t);
- /* frees results */
- void (*cl_destroy) (CLIENT *); /* destroy this structure */
- bool_t (*cl_control) (CLIENT *, int, char *);
- /* the ioctl() of rpc */
- } *cl_ops;
- caddr_t cl_private; /* private stuff */
-};
-
-
-/*
- * client side rpc interface ops
- *
- * Parameter types are:
- *
- */
-
-/*
- * enum clnt_stat
- * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
- * CLIENT *rh;
- * u_long proc;
- * xdrproc_t xargs;
- * caddr_t argsp;
- * xdrproc_t xres;
- * caddr_t resp;
- * struct timeval timeout;
- */
-#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
- ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
-#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
- ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
-
-/*
- * void
- * CLNT_ABORT(rh);
- * CLIENT *rh;
- */
-#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh))
-#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh))
-
-/*
- * struct rpc_err
- * CLNT_GETERR(rh);
- * CLIENT *rh;
- */
-#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
-#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
-
-
-/*
- * bool_t
- * CLNT_FREERES(rh, xres, resp);
- * CLIENT *rh;
- * xdrproc_t xres;
- * caddr_t resp;
- */
-#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
-#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
-
-/*
- * bool_t
- * CLNT_CONTROL(cl, request, info)
- * CLIENT *cl;
- * u_int request;
- * char *info;
- */
-#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
-#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
-
-/*
- * control operations that apply to all transports
- *
- * Note: options marked XXX are no-ops in this implementation of RPC.
- * The are present in TI-RPC but can't be implemented here since they
- * depend on the presence of STREAMS/TLI, which we don't have.
- */
-#define CLSET_TIMEOUT 1 /* set timeout (timeval) */
-#define CLGET_TIMEOUT 2 /* get timeout (timeval) */
-#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */
-#define CLGET_FD 6 /* get connections file descriptor */
-#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) XXX */
-#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */
-#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy*/
-#define CLGET_XID 10 /* Get xid */
-#define CLSET_XID 11 /* Set xid */
-#define CLGET_VERS 12 /* Get version number */
-#define CLSET_VERS 13 /* Set version number */
-#define CLGET_PROG 14 /* Get program number */
-#define CLSET_PROG 15 /* Set program number */
-#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */
-#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */
-#define CLSET_POP_TIMOD 18 /* pop timod XXX */
-/*
- * Connectionless only control operations
- */
-#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */
-#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */
-
-/*
- * void
- * CLNT_DESTROY(rh);
- * CLIENT *rh;
- */
-#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
-#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
-
-
-/*
- * RPCTEST is a test program which is accessible on every rpc
- * transport/port. It is used for testing, performance evaluation,
- * and network administration.
- */
-
-#define RPCTEST_PROGRAM ((u_long)1)
-#define RPCTEST_VERSION ((u_long)1)
-#define RPCTEST_NULL_PROC ((u_long)2)
-#define RPCTEST_NULL_BATCH_PROC ((u_long)3)
-
-/*
- * By convention, procedure 0 takes null arguments and returns them
- */
-
-#define NULLPROC ((u_long)0)
-
-/*
- * Below are the client handle creation routines for the various
- * implementations of client side rpc. They can return NULL if a
- * creation failure occurs.
- */
-
-/*
- * Memory based rpc (for speed check and testing)
- * CLIENT *
- * clntraw_create(prog, vers)
- * u_long prog;
- * u_long vers;
- */
-extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers)
- __THROW;
-
-
-/*
- * Generic client creation routine. Supported protocols are "udp", "tcp" and
- * "unix"
- * CLIENT *
- * clnt_create(host, prog, vers, prot)
- * char *host; -- hostname
- * u_long prog; -- program number
- * u_ong vers; -- version number
- * char *prot; -- protocol
- */
-extern CLIENT *clnt_create (__const char *__host, __const u_long __prog,
- __const u_long __vers, __const char *__prot)
- __THROW;
-
-
-/*
- * TCP based rpc
- * CLIENT *
- * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
- * struct sockaddr_in *raddr;
- * u_long prog;
- * u_long version;
- * register int *sockp;
- * u_int sendsz;
- * u_int recvsz;
- */
-extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog,
- u_long __version, int *__sockp, u_int __sendsz,
- u_int __recvsz) __THROW;
-
-/*
- * UDP based rpc.
- * CLIENT *
- * clntudp_create(raddr, program, version, wait, sockp)
- * struct sockaddr_in *raddr;
- * u_long program;
- * u_long version;
- * struct timeval wait_resend;
- * int *sockp;
- *
- * Same as above, but you specify max packet sizes.
- * CLIENT *
- * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
- * struct sockaddr_in *raddr;
- * u_long program;
- * u_long version;
- * struct timeval wait_resend;
- * int *sockp;
- * u_int sendsz;
- * u_int recvsz;
- */
-extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program,
- u_long __version, struct timeval __wait_resend,
- int *__sockp) __THROW;
-extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr,
- u_long __program, u_long __version,
- struct timeval __wait_resend, int *__sockp,
- u_int __sendsz, u_int __recvsz) __THROW;
-
-
-
-
-/*
- * AF_UNIX based rpc
- * CLIENT *
- * clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
- * struct sockaddr_un *raddr;
- * u_long prog;
- * u_long version;
- * register int *sockp;
- * u_int sendsz;
- * u_int recvsz;
- */
-extern CLIENT *clntunix_create (struct sockaddr_un *__raddr, u_long __program,
- u_long __version, int *__sockp,
- u_int __sendsz, u_int __recvsz) __THROW;
-
-
-extern int callrpc (__const char *__host, __const u_long __prognum,
- __const u_long __versnum, __const u_long __procnum,
- __const xdrproc_t __inproc, __const char *__in,
- __const xdrproc_t __outproc, char *__out) __THROW;
-extern int _rpc_dtablesize (void) __THROW;
-
-/*
- * Print why creation failed
- */
-extern void clnt_pcreateerror (__const char *__msg) __THROW; /* stderr */
-extern char *clnt_spcreateerror(__const char *__msg) __THROW; /* string */
-
-/*
- * Like clnt_perror(), but is more verbose in its output
- */
-extern void clnt_perrno (enum clnt_stat __num) __THROW; /* stderr */
-
-/*
- * Print an English error message, given the client error code
- */
-extern void clnt_perror (CLIENT *__clnt, __const char *__msg) __THROW;
- /* stderr */
-extern char *clnt_sperror (CLIENT *__clnt, __const char *__msg) __THROW;
- /* string */
-
-/*
- * If a creation fails, the following allows the user to figure out why.
- */
-struct rpc_createerr {
- enum clnt_stat cf_stat;
- struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
-};
-
-extern struct rpc_createerr rpc_createerr;
-
-
-
-/*
- * Copy error message to buffer.
- */
-extern char *clnt_sperrno (enum clnt_stat __num) __THROW; /* string */
-
-/*
- * get the port number on the host for the rpc program,version and proto
- */
-extern int getrpcport (__const char * __host, u_long __prognum,
- u_long __versnum, u_int proto) __THROW;
-
-/*
- * get the local host's IP address without consulting
- * name service library functions
- */
-extern void get_myaddress (struct sockaddr_in *) __THROW;
-
-#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */
-#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */
-
-__END_DECLS
-
-#endif /* rpc/clnt.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/des_crypt.h b/mdk-stage1/dietlibc/include/rpc/des_crypt.h
deleted file mode 100644
index 6a65887d3..000000000
--- a/mdk-stage1/dietlibc/include/rpc/des_crypt.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI
- *
- * des_crypt.h, des library routine interface
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-#ifndef __DES_CRYPT_H__
-#define __DES_CRYPT_H__ 1
-
-#include <features.h>
-
-__BEGIN_DECLS
-
-#define DES_MAXDATA 8192 /* max bytes encrypted in one call */
-#define DES_DIRMASK (1 << 0)
-#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */
-#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */
-
-
-#define DES_DEVMASK (1 << 1)
-#define DES_HW (0*DES_DEVMASK) /* Use hardware device */
-#define DES_SW (1*DES_DEVMASK) /* Use software device */
-
-
-#define DESERR_NONE 0 /* succeeded */
-#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */
-#define DESERR_HWERROR 2 /* failed, hardware/driver error */
-#define DESERR_BADPARAM 3 /* failed, bad parameter to call */
-
-#define DES_FAILED(err) \
- ((err) > DESERR_NOHWDEVICE)
-
-/*
- * cbc_crypt()
- * ecb_crypt()
- *
- * Encrypt (or decrypt) len bytes of a buffer buf.
- * The length must be a multiple of eight.
- * The key should have odd parity in the low bit of each byte.
- * ivec is the input vector, and is updated to the new one (cbc only).
- * The mode is created by oring together the appropriate parameters.
- * DESERR_NOHWDEVICE is returned if DES_HW was specified but
- * there was no hardware to do it on (the data will still be
- * encrypted though, in software).
- */
-
-
-/*
- * Cipher Block Chaining mode
- */
-extern int cbc_crypt (char *__key, char *__buf, unsigned __len,
- unsigned __mode, char *__ivec) __THROW;
-
-/*
- * Electronic Code Book mode
- */
-extern int ecb_crypt (char *__key, char *__buf, unsigned __len,
- unsigned __mode) __THROW;
-
-/*
- * Set des parity for a key.
- * DES parity is odd and in the low bit of each byte
- */
-extern void des_setparity (char *__key) __THROW;
-
-__END_DECLS
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/rpc/key_prot.h b/mdk-stage1/dietlibc/include/rpc/key_prot.h
deleted file mode 100644
index 3e2eb7208..000000000
--- a/mdk-stage1/dietlibc/include/rpc/key_prot.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Please do not edit this file.
- * It was generated using rpcgen.
- */
-
-#ifndef _KEY_PROT_H_RPCGEN
-#define _KEY_PROT_H_RPCGEN
-
-#include <rpc/rpc.h>
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if 0
-#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI"
-#endif
-/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
-
-/*
- * Compiled from key_prot.x using rpcgen.
- * DO NOT EDIT THIS FILE!
- * This is NOT source code!
- */
-#define PROOT 3
-#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b"
-#define HEXKEYBYTES 48
-#define KEYSIZE 192
-#define KEYBYTES 24
-#define KEYCHECKSUMSIZE 16
-
-enum keystatus {
- KEY_SUCCESS = 0,
- KEY_NOSECRET = 1,
- KEY_UNKNOWN = 2,
- KEY_SYSTEMERR = 3,
-};
-typedef enum keystatus keystatus;
-#ifdef __cplusplus
-extern "C" bool_t xdr_keystatus(XDR *, keystatus*);
-#elif __STDC__
-extern bool_t xdr_keystatus(XDR *, keystatus*);
-#else /* Old Style C */
-bool_t xdr_keystatus();
-#endif /* Old Style C */
-
-
-typedef char keybuf[HEXKEYBYTES];
-#ifdef __cplusplus
-extern "C" bool_t xdr_keybuf(XDR *, keybuf);
-#elif __STDC__
-extern bool_t xdr_keybuf(XDR *, keybuf);
-#else /* Old Style C */
-bool_t xdr_keybuf();
-#endif /* Old Style C */
-
-
-typedef char *netnamestr;
-#ifdef __cplusplus
-extern "C" bool_t xdr_netnamestr(XDR *, netnamestr*);
-#elif __STDC__
-extern bool_t xdr_netnamestr(XDR *, netnamestr*);
-#else /* Old Style C */
-bool_t xdr_netnamestr();
-#endif /* Old Style C */
-
-
-struct cryptkeyarg {
- netnamestr remotename;
- des_block deskey;
-};
-typedef struct cryptkeyarg cryptkeyarg;
-#ifdef __cplusplus
-extern "C" bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);
-#elif __STDC__
-extern bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);
-#else /* Old Style C */
-bool_t xdr_cryptkeyarg();
-#endif /* Old Style C */
-
-
-struct cryptkeyarg2 {
- netnamestr remotename;
- netobj remotekey;
- des_block deskey;
-};
-typedef struct cryptkeyarg2 cryptkeyarg2;
-#ifdef __cplusplus
-extern "C" bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);
-#elif __STDC__
-extern bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);
-#else /* Old Style C */
-bool_t xdr_cryptkeyarg2();
-#endif /* Old Style C */
-
-
-struct cryptkeyres {
- keystatus status;
- union {
- des_block deskey;
- } cryptkeyres_u;
-};
-typedef struct cryptkeyres cryptkeyres;
-#ifdef __cplusplus
-extern "C" bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);
-#elif __STDC__
-extern bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);
-#else /* Old Style C */
-bool_t xdr_cryptkeyres();
-#endif /* Old Style C */
-
-#define MAXGIDS 16
-
-struct unixcred {
- u_int uid;
- u_int gid;
- struct {
- u_int gids_len;
- u_int *gids_val;
- } gids;
-};
-typedef struct unixcred unixcred;
-#ifdef __cplusplus
-extern "C" bool_t xdr_unixcred(XDR *, unixcred*);
-#elif __STDC__
-extern bool_t xdr_unixcred(XDR *, unixcred*);
-#else /* Old Style C */
-bool_t xdr_unixcred();
-#endif /* Old Style C */
-
-
-struct getcredres {
- keystatus status;
- union {
- unixcred cred;
- } getcredres_u;
-};
-typedef struct getcredres getcredres;
-#ifdef __cplusplus
-extern "C" bool_t xdr_getcredres(XDR *, getcredres*);
-#elif __STDC__
-extern bool_t xdr_getcredres(XDR *, getcredres*);
-#else /* Old Style C */
-bool_t xdr_getcredres();
-#endif /* Old Style C */
-
-
-struct key_netstarg {
- keybuf st_priv_key;
- keybuf st_pub_key;
- netnamestr st_netname;
-};
-typedef struct key_netstarg key_netstarg;
-#ifdef __cplusplus
-extern "C" bool_t xdr_key_netstarg(XDR *, key_netstarg*);
-#elif __STDC__
-extern bool_t xdr_key_netstarg(XDR *, key_netstarg*);
-#else /* Old Style C */
-bool_t xdr_key_netstarg();
-#endif /* Old Style C */
-
-
-struct key_netstres {
- keystatus status;
- union {
- key_netstarg knet;
- } key_netstres_u;
-};
-typedef struct key_netstres key_netstres;
-#ifdef __cplusplus
-extern "C" bool_t xdr_key_netstres(XDR *, key_netstres*);
-#elif __STDC__
-extern bool_t xdr_key_netstres(XDR *, key_netstres*);
-#else /* Old Style C */
-bool_t xdr_key_netstres();
-#endif /* Old Style C */
-
-
-#ifndef opaque
-#define opaque char
-#endif
-
-
-#define KEY_PROG ((u_long)100029)
-#define KEY_VERS ((u_long)1)
-
-#ifdef __cplusplus
-#define KEY_SET ((u_long)1)
-extern "C" keystatus * key_set_1(opaque *, CLIENT *);
-extern "C" keystatus * key_set_1_svc(opaque *, struct svc_req *);
-#define KEY_ENCRYPT ((u_long)2)
-extern "C" cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);
-extern "C" cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);
-#define KEY_DECRYPT ((u_long)3)
-extern "C" cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);
-extern "C" cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);
-#define KEY_GEN ((u_long)4)
-extern "C" des_block * key_gen_1(void *, CLIENT *);
-extern "C" des_block * key_gen_1_svc(void *, struct svc_req *);
-#define KEY_GETCRED ((u_long)5)
-extern "C" getcredres * key_getcred_1(netnamestr *, CLIENT *);
-extern "C" getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);
-
-#elif __STDC__
-#define KEY_SET ((u_long)1)
-extern keystatus * key_set_1(opaque *, CLIENT *);
-extern keystatus * key_set_1_svc(opaque *, struct svc_req *);
-#define KEY_ENCRYPT ((u_long)2)
-extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);
-extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);
-#define KEY_DECRYPT ((u_long)3)
-extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);
-extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);
-#define KEY_GEN ((u_long)4)
-extern des_block * key_gen_1(void *, CLIENT *);
-extern des_block * key_gen_1_svc(void *, struct svc_req *);
-#define KEY_GETCRED ((u_long)5)
-extern getcredres * key_getcred_1(netnamestr *, CLIENT *);
-extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);
-
-#else /* Old Style C */
-#define KEY_SET ((u_long)1)
-extern keystatus * key_set_1();
-extern keystatus * key_set_1_svc();
-#define KEY_ENCRYPT ((u_long)2)
-extern cryptkeyres * key_encrypt_1();
-extern cryptkeyres * key_encrypt_1_svc();
-#define KEY_DECRYPT ((u_long)3)
-extern cryptkeyres * key_decrypt_1();
-extern cryptkeyres * key_decrypt_1_svc();
-#define KEY_GEN ((u_long)4)
-extern des_block * key_gen_1();
-extern des_block * key_gen_1_svc();
-#define KEY_GETCRED ((u_long)5)
-extern getcredres * key_getcred_1();
-extern getcredres * key_getcred_1_svc();
-#endif /* Old Style C */
-#define KEY_VERS2 ((u_long)2)
-
-#ifdef __cplusplus
-extern "C" keystatus * key_set_2(opaque *, CLIENT *);
-extern "C" keystatus * key_set_2_svc(opaque *, struct svc_req *);
-extern "C" cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);
-extern "C" cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);
-extern "C" cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);
-extern "C" cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);
-extern "C" des_block * key_gen_2(void *, CLIENT *);
-extern "C" des_block * key_gen_2_svc(void *, struct svc_req *);
-extern "C" getcredres * key_getcred_2(netnamestr *, CLIENT *);
-extern "C" getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);
-#define KEY_ENCRYPT_PK ((u_long)6)
-extern "C" cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);
-extern "C" cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
-#define KEY_DECRYPT_PK ((u_long)7)
-extern "C" cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);
-extern "C" cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
-#define KEY_NET_PUT ((u_long)8)
-extern "C" keystatus * key_net_put_2(key_netstarg *, CLIENT *);
-extern "C" keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);
-#define KEY_NET_GET ((u_long)9)
-extern "C" key_netstres * key_net_get_2(void *, CLIENT *);
-extern "C" key_netstres * key_net_get_2_svc(void *, struct svc_req *);
-#define KEY_GET_CONV ((u_long)10)
-extern "C" cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
-extern "C" cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
-
-#elif __STDC__
-extern keystatus * key_set_2(opaque *, CLIENT *);
-extern keystatus * key_set_2_svc(opaque *, struct svc_req *);
-extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);
-extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);
-extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);
-extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);
-extern des_block * key_gen_2(void *, CLIENT *);
-extern des_block * key_gen_2_svc(void *, struct svc_req *);
-extern getcredres * key_getcred_2(netnamestr *, CLIENT *);
-extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);
-#define KEY_ENCRYPT_PK ((u_long)6)
-extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);
-extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
-#define KEY_DECRYPT_PK ((u_long)7)
-extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);
-extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);
-#define KEY_NET_PUT ((u_long)8)
-extern keystatus * key_net_put_2(key_netstarg *, CLIENT *);
-extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);
-#define KEY_NET_GET ((u_long)9)
-extern key_netstres * key_net_get_2(void *, CLIENT *);
-extern key_netstres * key_net_get_2_svc(void *, struct svc_req *);
-#define KEY_GET_CONV ((u_long)10)
-extern cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
-extern cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
-
-#else /* Old Style C */
-extern keystatus * key_set_2();
-extern keystatus * key_set_2_svc();
-extern cryptkeyres * key_encrypt_2();
-extern cryptkeyres * key_encrypt_2_svc();
-extern cryptkeyres * key_decrypt_2();
-extern cryptkeyres * key_decrypt_2_svc();
-extern des_block * key_gen_2();
-extern des_block * key_gen_2_svc();
-extern getcredres * key_getcred_2();
-extern getcredres * key_getcred_2_svc();
-#define KEY_ENCRYPT_PK ((u_long)6)
-extern cryptkeyres * key_encrypt_pk_2();
-extern cryptkeyres * key_encrypt_pk_2_svc();
-#define KEY_DECRYPT_PK ((u_long)7)
-extern cryptkeyres * key_decrypt_pk_2();
-extern cryptkeyres * key_decrypt_pk_2_svc();
-#define KEY_NET_PUT ((u_long)8)
-extern keystatus * key_net_put_2();
-extern keystatus * key_net_put_2_svc();
-#define KEY_NET_GET ((u_long)9)
-extern key_netstres * key_net_get_2();
-extern key_netstres * key_net_get_2_svc();
-#define KEY_GET_CONV ((u_long)10)
-extern cryptkeyres * key_get_conv_2();
-extern cryptkeyres * key_get_conv_2_svc();
-#endif /* Old Style C */
-
-#endif /* !_KEY_PROT_H_RPCGEN */
diff --git a/mdk-stage1/dietlibc/include/rpc/netdb.h b/mdk-stage1/dietlibc/include/rpc/netdb.h
deleted file mode 100644
index da4bddfc4..000000000
--- a/mdk-stage1/dietlibc/include/rpc/netdb.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)rpc.h 1.8 87/07/24 SMI */
-
-/* Cleaned up for GNU C library roland@gnu.ai.mit.edu:
- added multiple inclusion protection and use of <sys/cdefs.h>.
- In GNU this file is #include'd by <netdb.h>. */
-
-#ifndef _RPC_NETDB_H
-#define _RPC_NETDB_H 1
-
-#include <sys/cdefs.h>
-
-#define __need_size_t
-#include <stddef.h>
-
-__BEGIN_DECLS
-
-struct rpcent
-{
- char *r_name; /* Name of server for this rpc program. */
- char **r_aliases; /* Alias list. */
- int r_number; /* RPC program number. */
-};
-
-extern void setrpcent (int __stayopen) __THROW;
-extern void endrpcent (void) __THROW;
-extern struct rpcent *getrpcbyname (__const char *__name) __THROW;
-extern struct rpcent *getrpcbynumber (int __number) __THROW;
-extern struct rpcent *getrpcent (void) __THROW;
-
-#ifdef __USE_MISC
-extern int getrpcbyname_r (__const char *__name, struct rpcent *__result_buf,
- char *__buffer, size_t __buflen,
- struct rpcent **__result) __THROW;
-
-extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf,
- char *__buffer, size_t __buflen,
- struct rpcent **__result) __THROW;
-
-extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer,
- size_t __buflen, struct rpcent **__result) __THROW;
-#endif
-
-__END_DECLS
-
-#endif /* rpc/netdb.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h b/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h
deleted file mode 100644
index 68bc8d8ec..000000000
--- a/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * pmap_clnt.h
- * Supplies C routines to get to portmap services.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_PMAP_CLNT_H
-#define _RPC_PMAP_CLNT_H 1
-
-#include <sys/cdefs.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/clnt.h>
-
-__BEGIN_DECLS
-
-typedef bool_t (*resultproc_t) (caddr_t resp, struct sockaddr_in *raddr);
-
-/*
- * Usage:
- * success = pmap_set(program, version, protocol, port);
- * success = pmap_unset(program, version);
- * port = pmap_getport(address, program, version, protocol);
- * head = pmap_getmaps(address);
- * clnt_stat = pmap_rmtcall(address, program, version, procedure,
- * xdrargs, argsp, xdrres, resp, tout, port_ptr)
- * (works for udp only.)
- * clnt_stat = clnt_broadcast(program, version, procedure,
- * xdrargs, argsp, xdrres, resp, eachresult)
- * (like pmap_rmtcall, except the call is broadcasted to all
- * locally connected nets. For each valid response received,
- * the procedure eachresult is called. Its form is:
- * done = eachresult(resp, raddr)
- * bool_t done;
- * caddr_t resp;
- * struct sockaddr_in raddr;
- * where resp points to the results of the call and raddr is the
- * address if the responder to the broadcast.
- */
-
-extern bool_t pmap_set (__const u_long __program, __const u_long __vers,
- int __protocol, u_short __port) __THROW;
-extern bool_t pmap_unset (__const u_long __program, __const u_long __vers)
- __THROW;
-extern struct pmaplist *pmap_getmaps (struct sockaddr_in *__address) __THROW;
-extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr,
- __const u_long __prog,
- __const u_long __vers,
- __const u_long __proc,
- xdrproc_t __xdrargs,
- caddr_t __argsp, xdrproc_t __xdrres,
- caddr_t __resp, struct timeval __tout,
- u_long *__port_ptr) __THROW;
-extern enum clnt_stat clnt_broadcast (__const u_long __prog,
- __const u_long __vers,
- __const u_long __proc, xdrproc_t __xargs,
- caddr_t __argsp, xdrproc_t __xresults,
- caddr_t __resultsp,
- resultproc_t __eachresult) __THROW;
-extern u_short pmap_getport (struct sockaddr_in *__address,
- __const u_long __program,
- __const u_long __version, u_int __protocol)
- __THROW;
-
-__END_DECLS
-
-#endif /* rpc/pmap_clnt.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_prot.h b/mdk-stage1/dietlibc/include/rpc/pmap_prot.h
deleted file mode 100644
index fd7fb8e7e..000000000
--- a/mdk-stage1/dietlibc/include/rpc/pmap_prot.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * pmap_prot.h
- * Protocol for the local binder service, or pmap.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_PMAP_PROT_H
-#define _RPC_PMAP_PROT_H 1
-
-#include <sys/cdefs.h>
-
-#include <rpc/xdr.h>
-
-__BEGIN_DECLS
-
-/* The following procedures are supported by the protocol:
- *
- * PMAPPROC_NULL() returns ()
- * takes nothing, returns nothing
- *
- * PMAPPROC_SET(struct pmap) returns (bool_t)
- * TRUE is success, FALSE is failure. Registers the tuple
- * [prog, vers, prot, port].
- *
- * PMAPPROC_UNSET(struct pmap) returns (bool_t)
- * TRUE is success, FALSE is failure. Un-registers pair
- * [prog, vers]. prot and port are ignored.
- *
- * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
- * 0 is failure. Otherwise returns the port number where the pair
- * [prog, vers] is registered. It may lie!
- *
- * PMAPPROC_DUMP() RETURNS (struct pmaplist *)
- *
- * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
- * RETURNS (port, string<>);
- * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
- * Calls the procedure on the local machine. If it is not registered,
- * this procedure is quite; ie it does not return error information!!!
- * This procedure only is supported on rpc/udp and calls via
- * rpc/udp. This routine only passes null authentication parameters.
- * This file has no interface to xdr routines for PMAPPROC_CALLIT.
- *
- * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
- */
-
-#define PMAPPORT ((u_short)111)
-#define PMAPPROG ((u_long)100000)
-#define PMAPVERS ((u_long)2)
-#define PMAPVERS_PROTO ((u_long)2)
-#define PMAPVERS_ORIG ((u_long)1)
-#define PMAPPROC_NULL ((u_long)0)
-#define PMAPPROC_SET ((u_long)1)
-#define PMAPPROC_UNSET ((u_long)2)
-#define PMAPPROC_GETPORT ((u_long)3)
-#define PMAPPROC_DUMP ((u_long)4)
-#define PMAPPROC_CALLIT ((u_long)5)
-
-struct pmap {
- long unsigned pm_prog;
- long unsigned pm_vers;
- long unsigned pm_prot;
- long unsigned pm_port;
-};
-
-extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs) __THROW;
-
-struct pmaplist {
- struct pmap pml_map;
- struct pmaplist *pml_next;
-};
-
-extern bool_t xdr_pmaplist (XDR *__xdrs, struct pmaplist **__rp) __THROW;
-
-__END_DECLS
-
-#endif /* rpc/pmap_prot.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h b/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h
deleted file mode 100644
index 160f998ca..000000000
--- a/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Structures and XDR routines for parameters to and replies from
- * the portmapper remote-call-service.
- *
- * Copyright (C) 1986, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_PMAP_RMT_H
-#define _RPC_PMAP_RMT_H 1
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-
-__BEGIN_DECLS
-
-struct rmtcallargs {
- u_long prog, vers, proc, arglen;
- caddr_t args_ptr;
- xdrproc_t xdr_args;
-};
-
-extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp)
- __THROW;
-
-struct rmtcallres {
- u_long *port_ptr;
- u_long resultslen;
- caddr_t results_ptr;
- xdrproc_t xdr_results;
-};
-
-extern bool_t xdr_rmtcallres (XDR *__xdrs, struct rmtcallres *__crp) __THROW;
-
-__END_DECLS
-
-#endif /* rpc/pmap_rmt.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/rpc.h b/mdk-stage1/dietlibc/include/rpc/rpc.h
deleted file mode 100644
index 20b341d74..000000000
--- a/mdk-stage1/dietlibc/include/rpc/rpc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * rpc.h, Just includes the billions of rpc header files necessary to
- * do remote procedure calling.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_RPC_H
-#define _RPC_RPC_H 1
-
-#include <rpc/types.h> /* some typedefs */
-#include <netinet/in.h>
-
-/* external data representation interfaces */
-#include <rpc/xdr.h> /* generic (de)serializer */
-
-/* Client side only authentication */
-#include <rpc/auth.h> /* generic authenticator (client side) */
-
-/* Client side (mostly) remote procedure call */
-#include <rpc/clnt.h> /* generic rpc stuff */
-
-/* semi-private protocol headers */
-#include <rpc/rpc_msg.h> /* protocol for rpc messages */
-#include <rpc/auth_unix.h> /* protocol for unix style cred */
-#include <rpc/auth_des.h> /* protocol for des style cred */
-
-/* Server side only remote procedure callee */
-#include <rpc/svc.h> /* service manager and multiplexer */
-#include <rpc/svc_auth.h> /* service side authenticator */
-
-/*
- * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION
- * OF UNIX BASED ON NFSSRC. These systems will already have the structures
- * defined by <rpc/netdb.h> included in <netdb.h>.
- */
-/* routines for parsing /etc/rpc */
-#include <rpc/netdb.h> /* structures and routines to parse /etc/rpc */
-
-int bindresvport(int sd, struct sockaddr_in* sin) __THROW;
-
-#endif /* rpc/rpc.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/rpc_des.h b/mdk-stage1/dietlibc/include/rpc/rpc_des.h
deleted file mode 100644
index 0f36d1697..000000000
--- a/mdk-stage1/dietlibc/include/rpc/rpc_des.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/*
- * Generic DES driver interface
- * Keep this file hardware independent!
- * Copyright (c) 1986 by Sun Microsystems, Inc.
- */
-
-#ifndef _DES_H
-#define _DES_H
-
-#include <sys/types.h>
-
-#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
-#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
-
-enum desdir
- {
- ENCRYPT, DECRYPT
- };
-enum desmode
- {
- CBC, ECB
- };
-
-/*
- * parameters to ioctl call
- */
-struct desparams
- {
- u_char des_key[8]; /* key (with low bit parity) */
- enum desdir des_dir; /* direction */
- enum desmode des_mode; /* mode */
- u_char des_ivec[8]; /* input vector */
- unsigned des_len; /* number of bytes to crypt */
- union
- {
- u_char UDES_data[DES_QUICKLEN];
- u_char *UDES_buf;
- }
- UDES;
-#define des_data UDES.UDES_data /* direct data here if quick */
-#define des_buf UDES.UDES_buf /* otherwise, pointer to data */
- };
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/rpc/rpc_msg.h b/mdk-stage1/dietlibc/include/rpc/rpc_msg.h
deleted file mode 100644
index 636d60ea9..000000000
--- a/mdk-stage1/dietlibc/include/rpc/rpc_msg.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)rpc_msg.h 1.7 86/07/16 SMI */
-
-#ifndef _RPC_MSG_H
-#define _RPC_MSG_H 1
-
-#include <sys/cdefs.h>
-
-#include <rpc/xdr.h>
-#include <rpc/clnt.h>
-
-/*
- * rpc_msg.h
- * rpc message definition
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#define RPC_MSG_VERSION ((u_long) 2)
-#define RPC_SERVICE_PORT ((u_short) 2048)
-
-__BEGIN_DECLS
-
-/*
- * Bottom up definition of an rpc message.
- * NOTE: call and reply use the same overall struct but
- * different parts of unions within it.
- */
-
-enum msg_type {
- CALL=0,
- REPLY=1
-};
-
-enum reply_stat {
- MSG_ACCEPTED=0,
- MSG_DENIED=1
-};
-
-enum accept_stat {
- SUCCESS=0,
- PROG_UNAVAIL=1,
- PROG_MISMATCH=2,
- PROC_UNAVAIL=3,
- GARBAGE_ARGS=4,
- SYSTEM_ERR=5
-};
-
-enum reject_stat {
- RPC_MISMATCH=0,
- AUTH_ERROR=1
-};
-
-/*
- * Reply part of an rpc exchange
- */
-
-/*
- * Reply to an rpc request that was accepted by the server.
- * Note: there could be an error even though the request was
- * accepted.
- */
-struct accepted_reply {
- struct opaque_auth ar_verf;
- enum accept_stat ar_stat;
- union {
- struct {
- u_long low;
- u_long high;
- } AR_versions;
- struct {
- caddr_t where;
- xdrproc_t proc;
- } AR_results;
- /* and many other null cases */
- } ru;
-#define ar_results ru.AR_results
-#define ar_vers ru.AR_versions
-};
-
-/*
- * Reply to an rpc request that was rejected by the server.
- */
-struct rejected_reply {
- enum reject_stat rj_stat;
- union {
- struct {
- u_long low;
- u_long high;
- } RJ_versions;
- enum auth_stat RJ_why; /* why authentication did not work */
- } ru;
-#define rj_vers ru.RJ_versions
-#define rj_why ru.RJ_why
-};
-
-/*
- * Body of a reply to an rpc request.
- */
-struct reply_body {
- enum reply_stat rp_stat;
- union {
- struct accepted_reply RP_ar;
- struct rejected_reply RP_dr;
- } ru;
-#define rp_acpt ru.RP_ar
-#define rp_rjct ru.RP_dr
-};
-
-/*
- * Body of an rpc request call.
- */
-struct call_body {
- u_long cb_rpcvers; /* must be equal to two */
- u_long cb_prog;
- u_long cb_vers;
- u_long cb_proc;
- struct opaque_auth cb_cred;
- struct opaque_auth cb_verf; /* protocol specific - provided by client */
-};
-
-/*
- * The rpc message
- */
-struct rpc_msg {
- u_long rm_xid;
- enum msg_type rm_direction;
- union {
- struct call_body RM_cmb;
- struct reply_body RM_rmb;
- } ru;
-#define rm_call ru.RM_cmb
-#define rm_reply ru.RM_rmb
-};
-#define acpted_rply ru.RM_rmb.ru.RP_ar
-#define rjcted_rply ru.RM_rmb.ru.RP_dr
-
-
-/*
- * XDR routine to handle a rpc message.
- * xdr_callmsg(xdrs, cmsg)
- * XDR *xdrs;
- * struct rpc_msg *cmsg;
- */
-extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
-
-/*
- * XDR routine to pre-serialize the static part of a rpc message.
- * xdr_callhdr(xdrs, cmsg)
- * XDR *xdrs;
- * struct rpc_msg *cmsg;
- */
-extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
-
-/*
- * XDR routine to handle a rpc reply.
- * xdr_replymsg(xdrs, rmsg)
- * XDR *xdrs;
- * struct rpc_msg *rmsg;
- */
-extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW;
-
-/*
- * Fills in the error part of a reply message.
- * _seterr_reply(msg, error)
- * struct rpc_msg *msg;
- * struct rpc_err *error;
- */
-extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error)
- __THROW;
-
-__END_DECLS
-
-#endif /* rpc/rpc_msg.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/svc.h b/mdk-stage1/dietlibc/include/rpc/svc.h
deleted file mode 100644
index 27c997dde..000000000
--- a/mdk-stage1/dietlibc/include/rpc/svc.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * svc.h, Server-side remote procedure call interface.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_SVC_H
-#define _RPC_SVC_H 1
-
-#include <sys/cdefs.h>
-#include <rpc/rpc_msg.h>
-
-__BEGIN_DECLS
-
-/*
- * This interface must manage two items concerning remote procedure calling:
- *
- * 1) An arbitrary number of transport connections upon which rpc requests
- * are received. The two most notable transports are TCP and UDP; they are
- * created and registered by routines in svc_tcp.c and svc_udp.c, respectively;
- * they in turn call xprt_register and xprt_unregister.
- *
- * 2) An arbitrary number of locally registered services. Services are
- * described by the following four data: program number, version number,
- * "service dispatch" function, a transport handle, and a boolean that
- * indicates whether or not the exported program should be registered with a
- * local binder service; if true the program's number and version and the
- * port number from the transport handle are registered with the binder.
- * These data are registered with the rpc svc system via svc_register.
- *
- * A service's dispatch function is called whenever an rpc request comes in
- * on a transport. The request's program and version numbers must match
- * those of the registered service. The dispatch function is passed two
- * parameters, struct svc_req * and SVCXPRT *, defined below.
- */
-
-enum xprt_stat {
- XPRT_DIED,
- XPRT_MOREREQS,
- XPRT_IDLE
-};
-
-/*
- * Server side transport handle
- */
-typedef struct SVCXPRT SVCXPRT;
-struct SVCXPRT {
- int xp_sock;
- u_short xp_port; /* associated port number */
- const struct xp_ops {
- bool_t (*xp_recv) (SVCXPRT *__xprt, struct rpc_msg *__msg);
- /* receive incoming requests */
- enum xprt_stat (*xp_stat) (SVCXPRT *__xprt);
- /* get transport status */
- bool_t (*xp_getargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args,
- caddr_t args_ptr); /* get arguments */
- bool_t (*xp_reply) (SVCXPRT *__xprt, struct rpc_msg *__msg);
- /* send reply */
- bool_t (*xp_freeargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args,
- caddr_t args_ptr);
- /* free mem allocated for args */
- void (*xp_destroy) (SVCXPRT *__xprt);
- /* destroy this struct */
- } *xp_ops;
- int xp_addrlen; /* length of remote address */
- struct sockaddr_in xp_raddr; /* remote address */
- struct opaque_auth xp_verf; /* raw response verifier */
- caddr_t xp_p1; /* private */
- caddr_t xp_p2; /* private */
- char xp_pad [256]; /* padding, internal use */
-};
-
-/*
- * Approved way of getting address of caller
- */
-#define svc_getcaller(x) (&(x)->xp_raddr)
-
-/*
- * Operations defined on an SVCXPRT handle
- *
- * SVCXPRT *xprt;
- * struct rpc_msg *msg;
- * xdrproc_t xargs;
- * caddr_t argsp;
- */
-#define SVC_RECV(xprt, msg) \
- (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
-#define svc_recv(xprt, msg) \
- (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
-
-#define SVC_STAT(xprt) \
- (*(xprt)->xp_ops->xp_stat)(xprt)
-#define svc_stat(xprt) \
- (*(xprt)->xp_ops->xp_stat)(xprt)
-
-#define SVC_GETARGS(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
-#define svc_getargs(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
-
-#define SVC_REPLY(xprt, msg) \
- (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
-#define svc_reply(xprt, msg) \
- (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
-
-#define SVC_FREEARGS(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
-#define svc_freeargs(xprt, xargs, argsp) \
- (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
-
-#define SVC_DESTROY(xprt) \
- (*(xprt)->xp_ops->xp_destroy)(xprt)
-#define svc_destroy(xprt) \
- (*(xprt)->xp_ops->xp_destroy)(xprt)
-
-
-/*
- * Service request
- */
-struct svc_req {
- rpcprog_t rq_prog; /* service program number */
- rpcvers_t rq_vers; /* service protocol version */
- rpcproc_t rq_proc; /* the desired procedure */
- struct opaque_auth rq_cred; /* raw creds from the wire */
- caddr_t rq_clntcred; /* read only cooked cred */
- SVCXPRT *rq_xprt; /* associated transport */
-};
-
-#ifndef __DISPATCH_FN_T
-#define __DISPATCH_FN_T
-typedef void (*__dispatch_fn_t) (struct svc_req*, SVCXPRT*);
-#endif
-
-/*
- * Service registration
- *
- * svc_register(xprt, prog, vers, dispatch, protocol)
- * SVCXPRT *xprt;
- * rpcprog_t prog;
- * rpcvers_t vers;
- * void (*dispatch)(struct svc_req*, SVCXPRT*);
- * rpcprot_t protocol; like TCP or UDP, zero means do not register
- */
-extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
- rpcvers_t __vers, __dispatch_fn_t __dispatch,
- rpcprot_t __protocol) __THROW;
-
-/*
- * Service un-registration
- *
- * svc_unregister(prog, vers)
- * rpcprog_t prog;
- * rpcvers_t vers;
- */
-extern void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW;
-
-/*
- * Transport registration.
- *
- * xprt_register(xprt)
- * SVCXPRT *xprt;
- */
-extern void xprt_register (SVCXPRT *__xprt) __THROW;
-
-/*
- * Transport un-register
- *
- * xprt_unregister(xprt)
- * SVCXPRT *xprt;
- */
-extern void xprt_unregister (SVCXPRT *__xprt) __THROW;
-
-
-/*
- * When the service routine is called, it must first check to see if it
- * knows about the procedure; if not, it should call svcerr_noproc
- * and return. If so, it should deserialize its arguments via
- * SVC_GETARGS (defined above). If the deserialization does not work,
- * svcerr_decode should be called followed by a return. Successful
- * decoding of the arguments should be followed the execution of the
- * procedure's code and a call to svc_sendreply.
- *
- * Also, if the service refuses to execute the procedure due to too-
- * weak authentication parameters, svcerr_weakauth should be called.
- * Note: do not confuse access-control failure with weak authentication!
- *
- * NB: In pure implementations of rpc, the caller always waits for a reply
- * msg. This message is sent when svc_sendreply is called.
- * Therefore pure service implementations should always call
- * svc_sendreply even if the function logically returns void; use
- * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
- * for the abuse of pure rpc via batched calling or pipelining. In the
- * case of a batched call, svc_sendreply should NOT be called since
- * this would send a return message, which is what batching tries to avoid.
- * It is the service/protocol writer's responsibility to know which calls are
- * batched and which are not. Warning: responding to batch calls may
- * deadlock the caller and server processes!
- */
-
-extern bool_t svc_sendreply (SVCXPRT *xprt, xdrproc_t __xdr_results,
- caddr_t __xdr_location) __THROW;
-
-extern void svcerr_decode (SVCXPRT *__xprt) __THROW;
-
-extern void svcerr_weakauth (SVCXPRT *__xprt) __THROW;
-
-extern void svcerr_noproc (SVCXPRT *__xprt) __THROW;
-
-extern void svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers,
- rpcvers_t __high_vers) __THROW;
-
-extern void svcerr_auth (SVCXPRT *__xprt, enum auth_stat __why) __THROW;
-
-extern void svcerr_noprog (SVCXPRT *__xprt) __THROW;
-
-extern void svcerr_systemerr (SVCXPRT *__xprt) __THROW;
-
-/*
- * Lowest level dispatching -OR- who owns this process anyway.
- * Somebody has to wait for incoming requests and then call the correct
- * service routine. The routine svc_run does infinite waiting; i.e.,
- * svc_run never returns.
- * Since another (coexistent) package may wish to selectively wait for
- * incoming calls or other events outside of the rpc architecture, the
- * routine svc_getreq is provided. It must be passed readfds, the
- * "in-place" results of a select system call (see select, section 2).
- */
-
-/*
- * Global keeper of rpc service descriptors in use
- * dynamic; must be inspected before each call to select
- */
-
-extern struct pollfd *svc_pollfd;
-extern int svc_max_pollfd;
-extern fd_set svc_fdset;
-#define svc_fds svc_fdset.fds_bits[0] /* compatibility */
-
-/*
- * a small program implemented by the svc_rpc implementation itself;
- * also see clnt.h for protocol numbers.
- */
-extern void svc_getreq (int __rdfds) __THROW;
-extern void svc_getreq_common (const int __fd) __THROW;
-extern void svc_getreqset (fd_set *__readfds) __THROW;
-extern void svc_getreq_poll (struct pollfd *, const int) __THROW;
-extern void svc_exit (void) __THROW;
-extern void svc_run (void) __THROW;
-
-/*
- * Socket to use on svcxxx_create call to get default socket
- */
-#define RPC_ANYSOCK -1
-
-/*
- * These are the existing service side transport implementations
- */
-
-/*
- * Memory based rpc for testing and timing.
- */
-extern SVCXPRT *svcraw_create (void) __THROW;
-
-/*
- * Udp based rpc.
- */
-extern SVCXPRT *svcudp_create (int __sock) __THROW;
-extern SVCXPRT *svcudp_bufcreate (int __sock, u_int __sendsz, u_int __recvsz)
- __THROW;
-
-/*
- * Tcp based rpc.
- */
-extern SVCXPRT *svctcp_create (int __sock, u_int __sendsize, u_int __recvsize)
- __THROW;
-
-
-/*
- * Unix based rpc.
- */
-extern SVCXPRT *svcunix_create (int __sock, u_int __sendsize, u_int __recvsize,
- char *__path) __THROW;
-
-
-__END_DECLS
-
-#endif /* rpc/svc.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/svc_auth.h b/mdk-stage1/dietlibc/include/rpc/svc_auth.h
deleted file mode 100644
index cd4b8da29..000000000
--- a/mdk-stage1/dietlibc/include/rpc/svc_auth.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* @(#)svc_auth.h 1.6 86/07/16 SMI */
-
-/*
- * svc_auth.h, Service side of rpc authentication.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_SVC_AUTH_H
-#define _RPC_SVC_AUTH_H 1
-
-#include <sys/cdefs.h>
-#include <rpc/svc.h>
-
-__BEGIN_DECLS
-
-/*
- * Server side authenticator
- */
-extern enum auth_stat _authenticate (struct svc_req *__rqst,
- struct rpc_msg *__msg) __THROW;
-
-__END_DECLS
-
-#endif /* rpc/svc_auth.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/types.h b/mdk-stage1/dietlibc/include/rpc/types.h
deleted file mode 100644
index e2e8402be..000000000
--- a/mdk-stage1/dietlibc/include/rpc/types.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-/* fixincludes should not add extern "C" to this file */
-/*
- * Rpc additions to <sys/types.h>
- */
-#ifndef _RPC_TYPES_H
-#define _RPC_TYPES_H 1
-
-typedef int bool_t;
-typedef int enum_t;
-/* This needs to be changed to uint32_t in the future */
-typedef unsigned long rpcprog_t;
-typedef unsigned long rpcvers_t;
-typedef unsigned long rpcproc_t;
-typedef unsigned long rpcprot_t;
-typedef unsigned long rpcport_t;
-
-#define __dontcare__ -1
-
-#ifndef FALSE
-# define FALSE (0)
-#endif
-
-#ifndef TRUE
-# define TRUE (1)
-#endif
-
-#ifndef NULL
-# define NULL 0
-#endif
-
-#include <stdlib.h> /* For malloc decl. */
-#define mem_alloc(bsize) malloc(bsize)
-#define mem_free(ptr, bsize) free(ptr)
-
-#ifndef makedev /* ie, we haven't already included it */
-#include <sys/types.h>
-#endif
-#include <sys/time.h>
-#include <sys/param.h>
-
-#include <netinet/in.h>
-
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK (u_long)0x7F000001
-#endif
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-#endif /* rpc/types.h */
diff --git a/mdk-stage1/dietlibc/include/rpc/xdr.h b/mdk-stage1/dietlibc/include/rpc/xdr.h
deleted file mode 100644
index ce092f085..000000000
--- a/mdk-stage1/dietlibc/include/rpc/xdr.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * xdr.h, External Data Representation Serialization Routines.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#ifndef _RPC_XDR_H
-#define _RPC_XDR_H 1
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <rpc/types.h>
-
-/* We need FILE. */
-#include <stdio.h>
-
-__BEGIN_DECLS
-
-/*
- * XDR provides a conventional way for converting between C data
- * types and an external bit-string representation. Library supplied
- * routines provide for the conversion on built-in C data types. These
- * routines and utility routines defined here are used to help implement
- * a type encode/decode routine for each user-defined type.
- *
- * Each data type provides a single procedure which takes two arguments:
- *
- * bool_t
- * xdrproc(xdrs, argresp)
- * XDR *xdrs;
- * <type> *argresp;
- *
- * xdrs is an instance of a XDR handle, to which or from which the data
- * type is to be converted. argresp is a pointer to the structure to be
- * converted. The XDR handle contains an operation field which indicates
- * which of the operations (ENCODE, DECODE * or FREE) is to be performed.
- *
- * XDR_DECODE may allocate space if the pointer argresp is null. This
- * data can be freed with the XDR_FREE operation.
- *
- * We write only one procedure per data type to make it easy
- * to keep the encode and decode procedures for a data type consistent.
- * In many cases the same code performs all operations on a user defined type,
- * because all the hard work is done in the component type routines.
- * decode as a series of calls on the nested data types.
- */
-
-/*
- * Xdr operations. XDR_ENCODE causes the type to be encoded into the
- * stream. XDR_DECODE causes the type to be extracted from the stream.
- * XDR_FREE can be used to release the space allocated by an XDR_DECODE
- * request.
- */
-enum xdr_op {
- XDR_ENCODE = 0,
- XDR_DECODE = 1,
- XDR_FREE = 2
-};
-
-/*
- * This is the number of bytes per unit of external data.
- */
-#define BYTES_PER_XDR_UNIT (4)
-/*
- * This only works if the above is a power of 2. But it's defined to be
- * 4 by the appropriate RFCs. So it will work. And it's normally quicker
- * than the old routine.
- */
-#if 1
-#define RNDUP(x) (((x) + BYTES_PER_XDR_UNIT - 1) & ~(BYTES_PER_XDR_UNIT - 1))
-#else /* this is the old routine */
-#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
- * BYTES_PER_XDR_UNIT)
-#endif
-
-/*
- * The XDR handle.
- * Contains operation which is being applied to the stream,
- * an operations vector for the particular implementation (e.g. see xdr_mem.c),
- * and two private fields for the use of the particular implementation.
- */
-typedef struct XDR XDR;
-struct XDR
- {
- enum xdr_op x_op; /* operation; fast additional param */
- struct xdr_ops
- {
- bool_t (*x_getlong) (XDR *__xdrs, long *__lp);
- /* get a long from underlying stream */
- bool_t (*x_putlong) (XDR *__xdrs, const long *__lp);
- /* put a long to " */
- bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len);
- /* get some bytes from " */
- bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, u_int __len);
- /* put some bytes to " */
- u_int (*x_getpostn) (const XDR *__xdrs);
- /* returns bytes off from beginning */
- bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos);
- /* lets you reposition the stream */
- int32_t *(*x_inline) (XDR *__xdrs, int __len);
- /* buf quick ptr to buffered data */
- void (*x_destroy) (XDR *__xdrs);
- /* free privates of this xdr_stream */
- bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip);
- /* get a int from underlying stream */
- bool_t (*x_putint32) (XDR *__xdrs, const int32_t *__ip);
- /* put a int to " */
- }
- *x_ops;
- caddr_t x_public; /* users' data */
- caddr_t x_private; /* pointer to private data */
- caddr_t x_base; /* private used for position info */
- int x_handy; /* extra private word */
- };
-
-/*
- * A xdrproc_t exists for each data type which is to be encoded or decoded.
- *
- * The second argument to the xdrproc_t is a pointer to an opaque pointer.
- * The opaque pointer generally points to a structure of the data type
- * to be decoded. If this pointer is 0, then the type routines should
- * allocate dynamic storage of the appropriate size and return it.
- * bool_t (*xdrproc_t)(XDR *, caddr_t *);
- */
-typedef bool_t (*xdrproc_t) (XDR *, void *,...);
-
-
-/*
- * Operations defined on a XDR handle
- *
- * XDR *xdrs;
- * int32_t *int32p;
- * long *longp;
- * caddr_t addr;
- * u_int len;
- * u_int pos;
- */
-#define XDR_GETINT32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
-#define xdr_getint32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
-
-#define XDR_PUTINT32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
-#define xdr_putint32(xdrs, int32p) \
- (*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
-
-#define XDR_GETLONG(xdrs, longp) \
- (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
-#define xdr_getlong(xdrs, longp) \
- (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
-
-#define XDR_PUTLONG(xdrs, longp) \
- (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
-#define xdr_putlong(xdrs, longp) \
- (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
-
-#define XDR_GETBYTES(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
-#define xdr_getbytes(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
-
-#define XDR_PUTBYTES(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
-#define xdr_putbytes(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
-
-#define XDR_GETPOS(xdrs) \
- (*(xdrs)->x_ops->x_getpostn)(xdrs)
-#define xdr_getpos(xdrs) \
- (*(xdrs)->x_ops->x_getpostn)(xdrs)
-
-#define XDR_SETPOS(xdrs, pos) \
- (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
-#define xdr_setpos(xdrs, pos) \
- (*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
-
-#define XDR_INLINE(xdrs, len) \
- (*(xdrs)->x_ops->x_inline)(xdrs, len)
-#define xdr_inline(xdrs, len) \
- (*(xdrs)->x_ops->x_inline)(xdrs, len)
-
-#define XDR_DESTROY(xdrs) \
- do { \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs); \
- } while (0)
-#define xdr_destroy(xdrs) \
- do { \
- if ((xdrs)->x_ops->x_destroy) \
- (*(xdrs)->x_ops->x_destroy)(xdrs); \
- } while (0)
-
-/*
- * Support struct for discriminated unions.
- * You create an array of xdrdiscrim structures, terminated with
- * a entry with a null procedure pointer. The xdr_union routine gets
- * the discriminant value and then searches the array of structures
- * for a matching value. If a match is found the associated xdr routine
- * is called to handle that part of the union. If there is
- * no match, then a default routine may be called.
- * If there is no match and no default routine it is an error.
- */
-#define NULL_xdrproc_t ((xdrproc_t)0)
-struct xdr_discrim
-{
- int value;
- xdrproc_t proc;
-};
-
-/*
- * Inline routines for fast encode/decode of primitive data types.
- * Caveat emptor: these use single memory cycles to get the
- * data from the underlying buffer, and will fail to operate
- * properly if the data is not aligned. The standard way to use these
- * is to say:
- * if ((buf = XDR_INLINE(xdrs, count)) == NULL)
- * return (FALSE);
- * <<< macro calls >>>
- * where ``count'' is the number of bytes of data occupied
- * by the primitive data types.
- *
- * N.B. and frozen for all time: each data type here uses 4 bytes
- * of external representation.
- */
-
-#define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++))
-#define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)(v)))
-#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf))
-#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32(buf, (int32_t)(v))
-
-/* WARNING: The IXDR_*_LONG defines are removed by Sun for new platforms
- * and shouldn't be used any longer. Code which use this defines or longs
- * in the RPC code will not work on 64bit Solaris platforms !
- */
-#define IXDR_GET_LONG(buf) \
- ((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))
-#define IXDR_PUT_LONG(buf, v) \
- (*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))
-#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf))
-#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v))
-
-
-#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
-#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
-#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf))
-#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf))
-
-#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG(buf, (long)(v))
-#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG(buf, (long)(v))
-#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v))
-#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v))
-
-/*
- * These are the "generic" xdr routines.
- * None of these can have const applied because it's not possible to
- * know whether the call is a read or a write to the passed parameter
- * also, the XDR structure is always updated by some of these calls.
- */
-extern bool_t xdr_void (void) __THROW;
-extern bool_t xdr_short (XDR *__xdrs, short *__sp) __THROW;
-extern bool_t xdr_u_short (XDR *__xdrs, u_short *__usp) __THROW;
-extern bool_t xdr_int (XDR *__xdrs, int *__ip) __THROW;
-extern bool_t xdr_u_int (XDR *__xdrs, u_int *__up) __THROW;
-extern bool_t xdr_long (XDR *__xdrs, long *__lp) __THROW;
-extern bool_t xdr_u_long (XDR *__xdrs, u_long *__ulp) __THROW;
-extern bool_t xdr_hyper (XDR *__xdrs, __quad_t *__llp) __THROW;
-extern bool_t xdr_u_hyper (XDR *__xdrs, __u_quad_t *__ullp) __THROW;
-extern bool_t xdr_longlong_t (XDR *__xdrs, __quad_t *__llp) __THROW;
-extern bool_t xdr_u_longlong_t (XDR *__xdrs, __u_quad_t *__ullp) __THROW;
-extern bool_t xdr_int8_t (XDR *__xdrs, int8_t *__ip) __THROW;
-extern bool_t xdr_uint8_t (XDR *__xdrs, uint8_t *__up) __THROW;
-extern bool_t xdr_int16_t (XDR *__xdrs, int16_t *__ip) __THROW;
-extern bool_t xdr_uint16_t (XDR *__xdrs, uint16_t *__up) __THROW;
-extern bool_t xdr_int32_t (XDR *__xdrs, int32_t *__ip) __THROW;
-extern bool_t xdr_uint32_t (XDR *__xdrs, uint32_t *__up) __THROW;
-extern bool_t xdr_int64_t (XDR *__xdrs, int64_t *__ip) __THROW;
-extern bool_t xdr_uint64_t (XDR *__xdrs, uint64_t *__up) __THROW;
-extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW;
-extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW;
-extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep,
- u_int __maxsize, u_int __elsize, xdrproc_t __elproc)
- __THROW;
-extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep,
- u_int __maxsize) __THROW;
-extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW;
-extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW;
-extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,
- const struct xdr_discrim *__choices,
- xdrproc_t dfault) __THROW;
-extern bool_t xdr_char (XDR *__xdrs, char *__cp) __THROW;
-extern bool_t xdr_u_char (XDR *__xdrs, u_char *__cp) __THROW;
-extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem,
- u_int __elemsize, xdrproc_t __xdr_elem) __THROW;
-extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW;
-extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW;
-extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size,
- xdrproc_t __proc) __THROW;
-extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp,
- u_int __obj_size, xdrproc_t __xdr_obj) __THROW;
-extern bool_t xdr_wrapstring (XDR *__xdrs, char **__cpp) __THROW;
-extern u_long xdr_sizeof (xdrproc_t, void *) __THROW;
-
-/*
- * Common opaque bytes objects used by many rpc protocols;
- * declared here due to commonality.
- */
-#define MAX_NETOBJ_SZ 1024
-struct netobj
-{
- u_int n_len;
- char *n_bytes;
-};
-typedef struct netobj netobj;
-extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW;
-
-/*
- * These are the public routines for the various implementations of
- * xdr streams.
- */
-
-/* XDR using memory buffers */
-extern void xdrmem_create (XDR *__xdrs, const caddr_t __addr,
- u_int __size, enum xdr_op __xop) __THROW;
-
-/* XDR using stdio library */
-extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop)
- __THROW;
-
-/* XDR pseudo records for tcp */
-extern void xdrrec_create (XDR *__xdrs, u_int __sendsize,
- u_int __recvsize, caddr_t __tcp_handle,
- int (*__readit) (char *, char *, int),
- int (*__writeit) (char *, char *, int)) __THROW;
-
-/* make end of xdr record */
-extern bool_t xdrrec_endofrecord (XDR *__xdrs, bool_t __sendnow) __THROW;
-
-/* move to beginning of next record */
-extern bool_t xdrrec_skiprecord (XDR *__xdrs) __THROW;
-
-/* true if no more input */
-extern bool_t xdrrec_eof (XDR *__xdrs) __THROW;
-
-/* free memory buffers for xdr */
-extern void xdr_free (xdrproc_t __proc, char *__objp) __THROW;
-
-__END_DECLS
-
-#endif /* rpc/xdr.h */
diff --git a/mdk-stage1/dietlibc/include/sched.h b/mdk-stage1/dietlibc/include/sched.h
deleted file mode 100644
index 5e4430d29..000000000
--- a/mdk-stage1/dietlibc/include/sched.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef _SCHED_H
-#define _SCHED_H 1
-
-#include <time.h>
-
-#include <sys/types.h>
-#ifndef u16
-#define u16 __u16
-#endif
-
-/* till those F**KIN' kernel headers are sane: A COPY !
- * #include <linux/sched.h>
- * A COPY OF THE STUFF WE NEED.... *GRUMBLE* */
-
-/*
- * cloning flags:
- */
-#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
-#define CLONE_VM 0x00000100 /* set if VM shared between processes */
-#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
-#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
-#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
-#define CLONE_PID 0x00001000 /* set if pid shared */
-#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
-#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
-#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
-#define CLONE_THREAD 0x00010000 /* Same thread group? */
-
-#define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREA)
-
-/*
- * Scheduling policies
- */
-#define SCHED_OTHER 0
-#define SCHED_FIFO 1
-#define SCHED_RR 2
-
-/*
- * This is an additional bit set when we want to
- * yield the CPU for one re-schedule..
- */
-#define SCHED_YIELD 0x10
-
-struct sched_param {
- int sched_priority;
-};
-
-/* END OF COPY form kernel-header */
-
-int __sched_setparam(pid_t pid, const struct sched_param *p);
-int sched_setparam(pid_t pid, const struct sched_param *p);
-
-int __sched_getparam(pid_t pid, struct sched_param *p);
-int sched_getparam(pid_t pid, struct sched_param *p);
-
-int __sched_getscheduler(pid_t pid);
-int sched_getscheduler(pid_t pid);
-
-int __sched_setscheduler(pid_t pid, int policy, const struct sched_param *p);
-int sched_setscheduler(pid_t pid, int policy, const struct sched_param *p);
-
-int __sched_yield(void);
-int sched_yield(void);
-
-int __sched_get_priority_max(int policy);
-int sched_get_priority_max(int policy);
-
-int __sched_get_priority_min(int policy);
-int sched_get_priority_min(int policy);
-
-int __sched_rr_get_interval(pid_t pid, struct timespec *tp);
-int sched_rr_get_interval(pid_t pid, struct timespec *tp);
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/scsi/scsi.h b/mdk-stage1/dietlibc/include/scsi/scsi.h
deleted file mode 100644
index 652e44ee9..000000000
--- a/mdk-stage1/dietlibc/include/scsi/scsi.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/* Copyright (C) 1998, 1999 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. */
-
-/*
- * This header file contains public constants and structures used by
- * the scsi code for linux.
- */
-
-#ifndef _SCSI_SCSI_H
-#define _SCSI_SCSI_H 1
-
-/*
- * SCSI opcodes
- */
-
-#define TEST_UNIT_READY 0x00
-#define REZERO_UNIT 0x01
-#define REQUEST_SENSE 0x03
-#define FORMAT_UNIT 0x04
-#define READ_BLOCK_LIMITS 0x05
-#define REASSIGN_BLOCKS 0x07
-#define READ_6 0x08
-#define WRITE_6 0x0a
-#define SEEK_6 0x0b
-#define READ_REVERSE 0x0f
-#define WRITE_FILEMARKS 0x10
-#define SPACE 0x11
-#define INQUIRY 0x12
-#define RECOVER_BUFFERED_DATA 0x14
-#define MODE_SELECT 0x15
-#define RESERVE 0x16
-#define RELEASE 0x17
-#define COPY 0x18
-#define ERASE 0x19
-#define MODE_SENSE 0x1a
-#define START_STOP 0x1b
-#define RECEIVE_DIAGNOSTIC 0x1c
-#define SEND_DIAGNOSTIC 0x1d
-#define ALLOW_MEDIUM_REMOVAL 0x1e
-
-#define SET_WINDOW 0x24
-#define READ_CAPACITY 0x25
-#define READ_10 0x28
-#define WRITE_10 0x2a
-#define SEEK_10 0x2b
-#define WRITE_VERIFY 0x2e
-#define VERIFY 0x2f
-#define SEARCH_HIGH 0x30
-#define SEARCH_EQUAL 0x31
-#define SEARCH_LOW 0x32
-#define SET_LIMITS 0x33
-#define PRE_FETCH 0x34
-#define READ_POSITION 0x34
-#define SYNCHRONIZE_CACHE 0x35
-#define LOCK_UNLOCK_CACHE 0x36
-#define READ_DEFECT_DATA 0x37
-#define MEDIUM_SCAN 0x38
-#define COMPARE 0x39
-#define COPY_VERIFY 0x3a
-#define WRITE_BUFFER 0x3b
-#define READ_BUFFER 0x3c
-#define UPDATE_BLOCK 0x3d
-#define READ_LONG 0x3e
-#define WRITE_LONG 0x3f
-#define CHANGE_DEFINITION 0x40
-#define WRITE_SAME 0x41
-#define READ_TOC 0x43
-#define LOG_SELECT 0x4c
-#define LOG_SENSE 0x4d
-#define MODE_SELECT_10 0x55
-#define RESERVE_10 0x56
-#define RELEASE_10 0x57
-#define MODE_SENSE_10 0x5a
-#define PERSISTENT_RESERVE_IN 0x5e
-#define PERSISTENT_RESERVE_OUT 0x5f
-#define MOVE_MEDIUM 0xa5
-#define READ_12 0xa8
-#define WRITE_12 0xaa
-#define WRITE_VERIFY_12 0xae
-#define SEARCH_HIGH_12 0xb0
-#define SEARCH_EQUAL_12 0xb1
-#define SEARCH_LOW_12 0xb2
-#define READ_ELEMENT_STATUS 0xb8
-#define SEND_VOLUME_TAG 0xb6
-#define WRITE_LONG_2 0xea
-
-/*
- * Status codes
- */
-
-#define GOOD 0x00
-#define CHECK_CONDITION 0x01
-#define CONDITION_GOOD 0x02
-#define BUSY 0x04
-#define INTERMEDIATE_GOOD 0x08
-#define INTERMEDIATE_C_GOOD 0x0a
-#define RESERVATION_CONFLICT 0x0c
-#define COMMAND_TERMINATED 0x11
-#define QUEUE_FULL 0x14
-
-#define STATUS_MASK 0x3e
-
-/*
- * SENSE KEYS
- */
-
-#define NO_SENSE 0x00
-#define RECOVERED_ERROR 0x01
-#define NOT_READY 0x02
-#define MEDIUM_ERROR 0x03
-#define HARDWARE_ERROR 0x04
-#define ILLEGAL_REQUEST 0x05
-#define UNIT_ATTENTION 0x06
-#define DATA_PROTECT 0x07
-#define BLANK_CHECK 0x08
-#define COPY_ABORTED 0x0a
-#define ABORTED_COMMAND 0x0b
-#define VOLUME_OVERFLOW 0x0d
-#define MISCOMPARE 0x0e
-
-
-/*
- * DEVICE TYPES
- */
-
-#define TYPE_DISK 0x00
-#define TYPE_TAPE 0x01
-#define TYPE_PROCESSOR 0x03 /* HP scanners use this */
-#define TYPE_WORM 0x04 /* Treated as ROM by our system */
-#define TYPE_ROM 0x05
-#define TYPE_SCANNER 0x06
-#define TYPE_MOD 0x07 /* Magneto-optical disk -
- * - treated as TYPE_DISK */
-#define TYPE_MEDIUM_CHANGER 0x08
-#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
-#define TYPE_NO_LUN 0x7f
-
-/*
- * standard mode-select header prepended to all mode-select commands
- *
- * moved here from cdrom.h -- kraxel
- */
-
-struct ccs_modesel_head
- {
- unsigned char _r1; /* reserved. */
- unsigned char medium; /* device-specific medium type. */
- unsigned char _r2; /* reserved. */
- unsigned char block_desc_length; /* block descriptor length. */
- unsigned char density; /* device-specific density code. */
- unsigned char number_blocks_hi; /* number of blocks in this block
- desc. */
- unsigned char number_blocks_med;
- unsigned char number_blocks_lo;
- unsigned char _r3;
- unsigned char block_length_hi; /* block length for blocks in this
- desc. */
- unsigned char block_length_med;
- unsigned char block_length_lo;
- };
-
-/*
- * MESSAGE CODES
- */
-
-#define COMMAND_COMPLETE 0x00
-#define EXTENDED_MESSAGE 0x01
-#define EXTENDED_MODIFY_DATA_POINTER 0x00
-#define EXTENDED_SDTR 0x01
-#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */
-#define EXTENDED_WDTR 0x03
-#define SAVE_POINTERS 0x02
-#define RESTORE_POINTERS 0x03
-#define DISCONNECT 0x04
-#define INITIATOR_ERROR 0x05
-#define ABORT 0x06
-#define MESSAGE_REJECT 0x07
-#define NOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define LINKED_CMD_COMPLETE 0x0a
-#define LINKED_FLG_CMD_COMPLETE 0x0b
-#define BUS_DEVICE_RESET 0x0c
-
-#define INITIATE_RECOVERY 0x0f /* SCSI-II only */
-#define RELEASE_RECOVERY 0x10 /* SCSI-II only */
-
-#define SIMPLE_QUEUE_TAG 0x20
-#define HEAD_OF_QUEUE_TAG 0x21
-#define ORDERED_QUEUE_TAG 0x22
-
-/*
- * Here are some scsi specific ioctl commands which are sometimes useful.
- */
-/* These are a few other constants only used by scsi devices. */
-
-#define SCSI_IOCTL_GET_IDLUN 0x5382
-
-/* Used to turn on and off tagged queuing for scsi devices. */
-
-#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
-#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
-
-/* Used to obtain the host number of a device. */
-#define SCSI_IOCTL_PROBE_HOST 0x5385
-
-/* Used to get the bus number for a device. */
-#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
-
-#endif /* scsi/scsi.h */
diff --git a/mdk-stage1/dietlibc/include/scsi/scsi_ioctl.h b/mdk-stage1/dietlibc/include/scsi/scsi_ioctl.h
deleted file mode 100644
index bc9931838..000000000
--- a/mdk-stage1/dietlibc/include/scsi/scsi_ioctl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1999 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. */
-
-#ifndef _SCSI_IOCTL_H
-#define _SCSI_IOCTL_H
-
-/* IOCTLs for SCSI. */
-#define SCSI_IOCTL_SEND_COMMAND 1 /* Send a command to the SCSI host. */
-#define SCSI_IOCTL_TEST_UNIT_READY 2 /* Test if unit is ready. */
-#define SCSI_IOCTL_BENCHMARK_COMMAND 3
-#define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters. */
-#define SCSI_IOCTL_START_UNIT 5
-#define SCSI_IOCTL_STOP_UNIT 6
-#define SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */
-#define SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */
-
-#endif
-
-
diff --git a/mdk-stage1/dietlibc/include/scsi/sg.h b/mdk-stage1/dietlibc/include/scsi/sg.h
deleted file mode 100644
index 00334654e..000000000
--- a/mdk-stage1/dietlibc/include/scsi/sg.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 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. */
-
-/*
- History:
- Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user
- process control of SCSI devices.
- Development Sponsored by Killy Corp. NY NY
-*/
-
-#ifndef _SCSI_SG_H
-#define _SCSI_SG_H 1
-
-#include <sys/types.h>
-
-/* New interface introduced in the 3.x SG drivers follows */
-
-/* Same structure as used by readv() Linux system call. It defines one
- scatter-gather element. */
-typedef struct sg_iovec
-{
- void * iov_base; /* Starting address */
- size_t iov_len; /* Length in bytes */
-} sg_iovec_t;
-
-
-typedef struct sg_io_hdr
-{
- int interface_id; /* [i] 'S' for SCSI generic (required) */
- int dxfer_direction; /* [i] data transfer direction */
- unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */
- unsigned char mx_sb_len; /* [i] max length to write to sbp */
- unsigned short int iovec_count; /* [i] 0 implies no scatter gather */
- unsigned int dxfer_len; /* [i] byte count of data transfer */
- void * dxferp; /* [i], [*io] points to data transfer memory
- or scatter gather list */
- unsigned char * cmdp; /* [i], [*i] points to command to perform */
- unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */
- unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */
- unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */
- int pack_id; /* [i->o] unused internally (normally) */
- void * usr_ptr; /* [i->o] unused internally */
- unsigned char status; /* [o] scsi status */
- unsigned char masked_status;/* [o] shifted, masked scsi status */
- unsigned char msg_status; /* [o] messaging level data (optional) */
- unsigned char sb_len_wr; /* [o] byte count actually written to sbp */
- unsigned short int host_status; /* [o] errors from host adapter */
- unsigned short int driver_status;/* [o] errors from software driver */
- int resid; /* [o] dxfer_len - actual_transferred */
- unsigned int duration; /* [o] time taken by cmd (unit: millisec) */
- unsigned int info; /* [o] auxiliary information */
-} sg_io_hdr_t;
-
-
-/* Use negative values to flag difference from original sg_header structure. */
-#define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */
-#define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */
-#define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */
-#define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the
- additional property than during indirect
- IO the user buffer is copied into the
- kernel buffers before the transfer */
-
-
-/* following flag values can be "or"-ed together */
-#define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */
-#define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */
- /* the 2nd byte of SCSI command */
-#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */
- /* user space (debug indirect IO) */
-
-/* The following 'info' values are "or"-ed together. */
-#define SG_INFO_OK_MASK 0x1
-#define SG_INFO_OK 0x0 /* no sense, host nor driver "noise" */
-#define SG_INFO_CHECK 0x1 /* something abnormal happened */
-
-#define SG_INFO_DIRECT_IO_MASK 0x6
-#define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */
-#define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */
-#define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */
-
-
-/* Request information about a specific SG device, used by
- SG_GET_SCSI_ID ioctl (). */
-struct sg_scsi_id {
- /* Host number as in "scsi<n>" where 'n' is one of 0, 1, 2 etc. */
- int host_no;
- int channel;
- /* SCSI id of target device. */
- int scsi_id;
- int lun;
- /* TYPE_... defined in <scsi/scsi.h>. */
- int scsi_type;
- /* Host (adapter) maximum commands per lun. */
- short int h_cmd_per_lun;
- /* Device (or adapter) maximum queue length. */
- short int d_queue_depth;
- /* Unused, set to 0 for now. */
- int unused[2];
-};
-
-/* Used by SG_GET_REQUEST_TABLE ioctl(). */
-typedef struct sg_req_info {
- char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */
- char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */
- char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */
- char problem; /* 0 -> no problem detected, 1 -> error to report */
- int pack_id; /* pack_id associated with request */
- void * usr_ptr; /* user provided pointer (in new interface) */
- unsigned int duration; /* millisecs elapsed since written (req_state==1)
- or request duration (req_state==2) */
- int unused;
-} sg_req_info_t;
-
-
-/* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow.
- [Those that only apply to the SG 2.x drivers are at the end of the file.]
- (_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */
-
-#define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */
-
-/* Used to configure SCSI command transformation layer for ATAPI devices */
-/* Only supported by the ide-scsi driver */
-#define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */
- /* 3rd arg = 0 to disable transform, 1 to enable it */
-#define SG_GET_TRANSFORM 0x2205
-
-#define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */
-#define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */
-
-/* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */
-#define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */
-/* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */
-
-/* Override host setting and always DMA using low memory ( <16MB on i386) */
-#define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */
-#define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */
-
-/* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which
- tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN.
- If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0
- then pack_id ignored by read() and oldest readable fetched. */
-#define SG_SET_FORCE_PACK_ID 0x227b
-#define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */
-
-#define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */
-
-/* Yields max scatter gather tablesize allowed by current host adapter */
-#define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */
-
-#define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */
-
-/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */
-#define SG_SCSI_RESET 0x2284
-/* Associated values that can be given to SG_SCSI_RESET follow */
-#define SG_SCSI_RESET_NOTHING 0
-#define SG_SCSI_RESET_DEVICE 1
-#define SG_SCSI_RESET_BUS 2
-#define SG_SCSI_RESET_HOST 3
-
-/* synchronous SCSI command ioctl, (only in version 3 interface) */
-#define SG_IO 0x2285 /* similar effect as write() followed by read() */
-
-#define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */
-
-/* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */
-#define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */
-#define SG_GET_KEEP_ORPHAN 0x2288
-
-
-#define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */
-/* Largest size (in bytes) a single scatter-gather list element can have.
- The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on
- i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported
- by adapter then this value is the largest data block that can be
- read/written by a single scsi command. The user can find the value of
- PAGE_SIZE by calling getpagesize() defined in unistd.h . */
-
-#define SG_DEFAULT_RETRIES 1
-
-/* Defaults, commented if they differ from original sg driver */
-#define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */
-#define SG_DEF_FORCE_PACK_ID 0
-#define SG_DEF_KEEP_ORPHAN 0
-#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */
-
-/* maximum outstanding requests, write() yields EDOM if exceeded */
-#define SG_MAX_QUEUE 16
-
-#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */
-
-/* Alternate style type names, "..._t" variants preferred */
-typedef struct sg_io_hdr Sg_io_hdr;
-typedef struct sg_io_vec Sg_io_vec;
-typedef struct sg_scsi_id Sg_scsi_id;
-typedef struct sg_req_info Sg_req_info;
-
-
-/* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
-/* The older SG interface based on the 'sg_header' structure follows. */
-/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
-
-#define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */
-
-struct sg_header
- {
- /* Length of incoming packet (including header). */
- int pack_len;
- /* Maximal length of expected reply. */
- int reply_len;
- /* Id number of packet. */
- int pack_id;
- /* 0==ok, otherwise error number. */
- int result;
- /* Force 12 byte command length for group 6 & 7 commands. */
- unsigned int twelve_byte:1;
- /* SCSI status from target. */
- unsigned int target_status:5;
- /* Host status (see "DID" codes). */
- unsigned int host_status:8;
- /* Driver status+suggestion. */
- unsigned int driver_status:8;
- /* Unused. */
- unsigned int other_flags:10;
- /* Output in 3 cases:
- when target_status is CHECK_CONDITION or
- when target_status is COMMAND_TERMINATED or
- when (driver_status & DRIVER_SENSE) is true. */
- unsigned char sense_buffer[SG_MAX_SENSE];
- };
-
-
-/* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t
- interface is used. They are kept for backward compatibility with
- the original and version 2 drivers. */
-
-#define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)arg==timeout. */
-#define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */
-
-/* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */
-#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */
-#define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */
-
-/* Turn on error sense trace (1..8), dump this device to log/console (9)
- or dump all sg device states ( >9 ) to log/console. */
-#define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */
-
-#define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given
- number on the next write() on this file
- descriptor. */
-
-/* Defaults, commented if they differ from original sg driver */
-#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */
-#define SG_DEF_COMMAND_Q 0 /* command queuing is always on when
- the new interface is used */
-#define SG_DEF_UNDERRUN_FLAG 0
-
-
-#endif /* scsi/sg.h */
diff --git a/mdk-stage1/dietlibc/include/setjmp.h b/mdk-stage1/dietlibc/include/setjmp.h
deleted file mode 100644
index 66fc288f4..000000000
--- a/mdk-stage1/dietlibc/include/setjmp.h
+++ /dev/null
@@ -1,123 +0,0 @@
-#ifndef _SETJMP_H
-#define _SETJMP_H
-
-#include <sys/cdefs.h>
-
-#ifdef __i386__
-#ifndef __ASSEMBLER__
-typedef int __jmp_buf[6];
-#endif
-# define JB_BX 0
-# define JB_SI 1
-# define JB_DI 2
-# define JB_BP 3
-# define JB_SP 4
-# define JB_PC 5
-# define JB_SIZE 24
-#endif
-
-#ifdef __alpha__
-#define JB_S0 0
-#define JB_S1 1
-#define JB_S2 2
-#define JB_S3 3
-#define JB_S4 4
-#define JB_S5 5
-#define JB_PC 6
-#define JB_FP 7
-#define JB_SP 8
-#define JB_F2 9
-#define JB_F3 10
-#define JB_F4 11
-#define JB_F5 12
-#define JB_F6 13
-#define JB_F7 14
-#define JB_F8 15
-#define JB_F9 16
-#ifndef __ASSEMBLER__
-typedef long int __jmp_buf[17];
-#endif
-#endif
-
-#ifdef __mips__
-#ifndef __ASSEMBLER__
-typedef struct
- {
- void * __pc; /* Program counter. */
- void * __sp; /* Stack pointer. */
- int __regs[8]; /* Callee-saved registers s0 through s7. */
- void * __fp; /* The frame pointer. */
- void * __gp; /* The global pointer. */
- int __fpc_csr; /* Floating point status register. */
- double __fpregs[6]; /* Callee-saved floating point registers. */
- } __jmp_buf[1];
-#endif
-#endif
-
-#ifdef __sparc__
-#define JB_SP 0
-#define JB_FP 1
-#define JB_PC 2
-#ifndef __ASSEMBLER__
-typedef int __jmp_buf[3];
-#endif
-#endif
-
-#ifdef __arm__
-#define __JMP_BUF_SP 8
-#ifndef __ASSEMBLER__
-typedef int __jmp_buf[10];
-#endif
-#endif
-
-#ifdef __powerpc__
-# define JB_GPR1 0 /* Also known as the stack pointer */
-# define JB_GPR2 1
-# define JB_LR 2 /* The address we will return to */
-# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */
-# define JB_CR 21 /* Condition code registers. */
-# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */
-# define JB_SIZE (58*4)
-#ifndef __ASSEMBLER__
-typedef long int __jmp_buf[58];
-#endif
-#endif
-
-#ifndef __ASSEMBLER__
-
-typedef int sig_atomic_t;
-#define __sig_atomic_t sig_atomic_t
-
-# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
-typedef struct
- {
- unsigned long int __val[_SIGSET_NWORDS];
- } __sigset_t;
-
-/* Calling environment, plus possibly a saved signal mask. */
-typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */
- {
- /* NOTE: The machine-dependent definitions of `__sigsetjmp'
- assume that a `jmp_buf' begins with a `__jmp_buf'.
- Do not move this member or add others before it. */
- __jmp_buf __jmpbuf; /* Calling environment. */
- int __mask_was_saved; /* Saved the signal mask? */
- __sigset_t __saved_mask; /* Saved signal mask. */
- } jmp_buf[1];
-
-extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW;
-
-extern void longjmp (jmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
-
-typedef jmp_buf sigjmp_buf;
-
-extern void siglongjmp (sigjmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
-
-#define setjmp(env) __sigsetjmp(env,0)
-#define sigsetjmp(a,b) __sigsetjmp(a,b)
-
-#endif
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/shadow.h b/mdk-stage1/dietlibc/include/shadow.h
deleted file mode 100644
index 4d6341af1..000000000
--- a/mdk-stage1/dietlibc/include/shadow.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _SHADOW_H
-#define _SHADOW_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-struct spwd {
- char *sp_namp; /* user login name */
- char *sp_pwdp; /* encrypted password */
- long sp_lstchg; /* last password change */
- int sp_min; /* days until change allowed. */
- int sp_max; /* days before change required */
- int sp_warn; /* days warning for expiration */
- int sp_inact; /* days before account inactive */
- int sp_expire; /* date when account expires */
- int sp_flag; /* reserved for future use */
-};
-
-extern struct spwd *getspent(void) __THROW;
-extern void setspent(void) __THROW;
-extern void endspent(void) __THROW;
-extern struct spwd *getspnam (__const char *__name) __THROW;
-
-#endif /* _SHADOW_H */
diff --git a/mdk-stage1/dietlibc/include/signal.h b/mdk-stage1/dietlibc/include/signal.h
deleted file mode 100644
index 9ed93fe83..000000000
--- a/mdk-stage1/dietlibc/include/signal.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _SIGNAL_H
-#define _SIGNAL_H
-
-#include <sys/cdefs.h>
-
-#define __WANT_POSIX1B_SIGNALS__
-
-#include <linux/types.h>
-#include <linux/signal.h>
-
-typedef void (*sighandler_t)(int);
-
-int sigemptyset(sigset_t *set) __THROW;
-int sigfillset(sigset_t *set) __THROW;
-int sigaddset(sigset_t *set, int signum) __THROW;
-int sigdelset(sigset_t *set, int signum) __THROW;
-int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) __THROW;
-sighandler_t signal(int signum, sighandler_t action);
-int raise (int sig) __THROW;
-int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) __THROW;
-int sigaltstack(const struct sigaltstack *newstack, struct sigaltstack *oldstack) __THROW;
-
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
-#endif
-
-extern const char *const sys_siglist[];
-
-typedef __sighandler_t sig_t;
-
-#ifndef NSIG
-#define NSIG _NSIG
-#endif
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/stdint.h b/mdk-stage1/dietlibc/include/stdint.h
deleted file mode 100644
index d287e6794..000000000
--- a/mdk-stage1/dietlibc/include/stdint.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _STDINT_H
-#define _STDINT_H
-
-#include <sys/types.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/stdio.h b/mdk-stage1/dietlibc/include/stdio.h
deleted file mode 100644
index 92d9dc0cb..000000000
--- a/mdk-stage1/dietlibc/include/stdio.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef _STDIO_H
-#define _STDIO_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-typedef struct __stdio_file FILE;
-
-FILE *fopen (const char *path, const char *mode) __THROW;
-FILE *fdopen (int fildes, const char *mode) __THROW;
-FILE *freopen (const char *path, const char *mode, FILE *stream) __THROW;
-
-int printf(const char *format, ...) __THROW;
-int fprintf(FILE *stream, const char *format, ...) __THROW;
-int sprintf(char *str, const char *format, ...) __THROW;
-int snprintf(char *str, size_t size, const char *format, ...) __THROW;
-int asprintf(char **ptr, const char* format, ...) __THROW;
-
-int scanf( const char *format, ...) __THROW;
-int fscanf( FILE *stream, const char *format, ...) __THROW;
-int sscanf( const char *str, const char *format, ...) __THROW;
-
-#include <stdarg.h>
-
-int vprintf(const char *format, va_list ap) __THROW;
-int vfprintf(FILE *stream, const char *format, va_list ap) __THROW;
-int vsprintf(char *str, const char *format, va_list ap) __THROW;
-int vsnprintf(char *str, size_t size, const char *format, va_list ap) __THROW;
-
-int vscanf( const char *format, va_list ap) __THROW;
-int vsscanf( const char *str, const char *format, va_list ap) __THROW;
-int vfscanf( FILE *stream, const char *format, va_list ap) __THROW;
-
-int fgetc(FILE *stream) __THROW;
-char *fgets(char *s, int size, FILE *stream) __THROW;
-int getc(FILE *stream) __THROW;
-int getchar(void) __THROW;
-char *gets(char *s) __THROW;
-int ungetc(int c, FILE *stream) __THROW;
-
-int fputc(int c, FILE *stream) __THROW;
-int fputs(const char *s, FILE *stream) __THROW;
-
-#define putc(c,stream) fputc(c,stream)
-#define putchar(c) fputc(c,stdout)
-
-#define getchar() fgetc(stdin)
-#define getc(stream) fgetc(stream)
-
-int puts(const char *s) __THROW;
-
-long fseek( FILE *stream, long offset, int whence) __THROW;
-long ftell( FILE *stream) __THROW;
-void rewind( FILE *stream) __THROW;
-int fgetpos( FILE *stream, fpos_t *pos) __THROW;
-int fsetpos( FILE *stream, fpos_t *pos) __THROW;
-
-size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream) __THROW;
-
-size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream) __THROW;
-
-int fflush(FILE *stream) __THROW;
-
-int fclose(FILE *stream) __THROW;
-
-void clearerr(FILE *stream) __THROW;
-int feof (FILE *stream) __THROW;
-int ferror( FILE *stream) __THROW;
-int fileno( FILE *stream) __THROW;
-
-int remove(const char *pathname) __THROW;
-
-void perror(const char *s) __THROW;
-
-extern FILE *stdin, *stdout, *stderr;
-
-#define EOF (int)(-1)
-
-#define BUFSIZ 128
-
-#define _IONBF 0
-#define _IOLBF 1
-#define _IOFBF 2
-
-int setvbuf(FILE *stream, char *buf, int mode , size_t size) __THROW;
-
-#define setbuf(stream,buf) setvbuf(stream,buf,buf?_IOFBF:_IONBF,BUFSIZ)
-#define setbuffer(stream,buf,size) setvbuf(stream,buf,buf?_IOFBF:_IONBF,size)
-#define setlinebuf(stream) setvbuf(stream,0,_IOLBF,BUFSIZ)
-
-FILE *popen(const char *command, const char *type) __THROW;
-int pclose(FILE *stream) __THROW;
-
-#define getc_unlocked(stream) getc(stream)
-#define putc_unlocked(c,stream) putc(c,stream)
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/stdlib.h b/mdk-stage1/dietlibc/include/stdlib.h
deleted file mode 100644
index 6a13a48ff..000000000
--- a/mdk-stage1/dietlibc/include/stdlib.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef _STDLIB_H
-#define _STDLIB_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#define __LIBC_DIETLIBC__
-
-void *calloc(size_t nmemb, size_t size) __THROW;
-void *malloc(size_t size) __THROW;
-void free(void *ptr) __THROW;
-void *realloc(void *ptr, size_t size) __THROW;
-
-char *getenv(const char *name) __THROW __pure__;
-int putenv(const char *string) __THROW;
-int setenv(const char *name, const char *value, int overwrite) __THROW;
-void unsetenv(const char *name) __THROW;
-
-int atexit(void (*function)(void)) __THROW;
-
-double strtod(const char *nptr, char **endptr) __THROW;
-long int strtol(const char *nptr, char **endptr, int base) __THROW;
-unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW;
-
-int __ltostr(char *s, int size, unsigned long i, int base, char UpCase) __THROW;
-#ifdef __GNUC__
-long long int strtoll(const char *nptr, char **endptr, int base) __THROW;
-unsigned long long int strtoull(const char *nptr, char **endptr, int base) __THROW;
-int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase) __THROW;
-#endif
-
-int atoi(const char *nptr) __THROW;
-long int atol(const char *nptr) __THROW;
-double atof(const char *nptr) __THROW;
-
-void exit(int status) __THROW __attribute__((noreturn));
-void abort(void) __THROW;
-
-/* warning: the rand() implementation of the diet libc really sucks. */
-#define RAND_MAX 32767
-
-extern int rand(void) __THROW;
-extern void srand(unsigned int seed) __THROW;
-
-void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) __THROW;
-void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) __THROW;
-
-extern char **environ;
-
-#define EXIT_SUCCESS 0
-#define EXIT_FAILURE 1
-
-/* now this function is the greatest bullshit I have ever seen.
- * The ISO people must be out of their minds. */
-typedef struct { int quot,rem; } div_t;
-div_t div(int numer, int denom) __THROW __attribute__((const));
-
-void *alloca(size_t size) __THROW; /* gcc built-in */
-
-char *realpath(const char *path, char *resolved_path) __THROW;
-
-int abs(int j) __THROW;
-
-long int random(void) __THROW;
-void srandom(unsigned int seed) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/string.h b/mdk-stage1/dietlibc/include/string.h
deleted file mode 100644
index 1ef78ae54..000000000
--- a/mdk-stage1/dietlibc/include/string.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _STRING_H
-#define _STRING_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-char *strcpy(char *dest, const char *src) __THROW;
-char *strncpy(char *dest, const char *src, size_t n) __THROW;
-
-void *memccpy(void *dest, const void *src, int c, size_t n) __THROW;
-void *memcpy(void *dest, const void *src, size_t n) __THROW;
-void *memmove(void *dest, const void *src, size_t n) __THROW;
-
-int memccmp(const void *s1, const void *s2, int c, size_t n) __THROW __pure__;
-int memcmp(const void *s1, const void *s2, size_t n) __THROW __pure__;
-int strcmp(const char *s1, const char *s2) __THROW __pure__;
-int strncmp(const char *s1, const char *s2, size_t n) __THROW __pure__;
-
-int strcasecmp(const char *s1, const char *s2) __THROW __pure__;
-int strncasecmp(const char *s1, const char *s2, size_t n) __THROW __pure__;
-
-size_t strlen(const char *s) __THROW __pure__;
-
-char *strstr(const char *haystack, const char *needle) __THROW __pure__;
-
-char *strdup(const char *s) __THROW;
-
-char *strchr(const char *s, int c) __THROW __pure__;
-char *strrchr(const char *s, int c) __THROW __pure__;
-
-char *strcat(char *dest, const char *src) __THROW;
-char *strncat(char *dest, const char *src, size_t n) __THROW;
-
-size_t strspn(const char *s, const char *accept) __THROW;
-size_t strcspn(const char *s, const char *reject) __THROW;
-
-char *strpbrk(const char *s, const char *accept) __THROW;
-char *strsep(char **stringp, const char *delim) __THROW;
-
-void* memset(void *s, int c, size_t n) __THROW;
-
-#undef NULL
-#define NULL (void*)0
-
-#define bzero(s,n) memset(s,0,n)
-#define bcopy(src,dest,n) memmove(dest,src,n)
-#define bcmp(a,b,n) memcmp(a,b,n)
-
-char *strerror(int errnum) __THROW;
-char *strsignal(int signum) __THROW;
-
-char *strtok(char *s, const char *delim) __THROW;
-char *strtok_r(char *s, const char *delim, char **ptrptr) __THROW;
-
-int ffs(int i) __THROW __attribute__((__const__));
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/strings.h b/mdk-stage1/dietlibc/include/strings.h
deleted file mode 100644
index ec947a9b9..000000000
--- a/mdk-stage1/dietlibc/include/strings.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#warning "your code included obsolescent <strings.h>. Please change that to <string.h>!"
-#include <string.h>
diff --git a/mdk-stage1/dietlibc/include/sys/cdefs.h b/mdk-stage1/dietlibc/include/sys/cdefs.h
deleted file mode 100644
index 895bb74b8..000000000
--- a/mdk-stage1/dietlibc/include/sys/cdefs.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _SYS_CDEFS_H
-#define _SYS_CDEFS_H
-
-#define __dietlibc__
-
-#ifndef __cplusplus
-#define throw ()
-#define __THROW
-#define __BEGIN_DECLS
-#define __END_DECLS
-#else
-#define __THROW throw ()
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS }
-#endif
-
-#ifndef __GNUC__
-#define __attribute__(xyz)
-#endif
-
-#define __pure__
-#ifdef __GNUC__
-#if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96))
-#undef __pure__
-#define __pure__ __attribute__ ((__pure__))
-#endif
-
-#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
-#define __restrict__
-#endif
-
-#endif
-
-#define __P(x) x
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/file.h b/mdk-stage1/dietlibc/include/sys/file.h
deleted file mode 100644
index 93787fd42..000000000
--- a/mdk-stage1/dietlibc/include/sys/file.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _SYS_FILE_H
-#define _SYS_FILE_H
-
-#include <sys/cdefs.h>
-
-extern int fcntl(int fd, int cmd, ...) __THROW;
-extern int flock(int fd, int operation) __THROW;
-
-/* Operations for the `flock' call. */
-#define LOCK_SH 1 /* Shared lock. */
-#define LOCK_EX 2 /* Exclusive lock. */
-#define LOCK_UN 8 /* Unlock. */
-
-/* Can be OR'd in to one of the above. */
-#define LOCK_NB 4 /* Don't block when locking. */
-
-
-
-#endif /* _SYS_FILE_H */
diff --git a/mdk-stage1/dietlibc/include/sys/io.h b/mdk-stage1/dietlibc/include/sys/io.h
deleted file mode 100644
index cce841735..000000000
--- a/mdk-stage1/dietlibc/include/sys/io.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _IO_H
-#define _IO_H
-
-int ioperm(unsigned long from, unsigned long num, int turn_on) __THROW;
-
-#ifdef __i386__
-
-static __inline void
-outb (unsigned char value, unsigned short int port)
-{
- __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port));
-}
-
-static __inline unsigned char
-inb (unsigned short int port)
-{
- unsigned char _v;
-
- __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port));
- return _v;
-}
-
-static __inline unsigned short int
-inw (unsigned short int port)
-{
- unsigned short _v;
-
- __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (port));
- return _v;
-}
-
-static __inline void
-outw (unsigned short int value, unsigned short int port)
-{
- __asm__ __volatile__ ("outw %w0,%w1": :"a" (value), "Nd" (port));
-
-}
-
-#endif
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/ioctl.h b/mdk-stage1/dietlibc/include/sys/ioctl.h
deleted file mode 100644
index fca1aeeab..000000000
--- a/mdk-stage1/dietlibc/include/sys/ioctl.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _IOCTL_H
-#define _IOCTL_H
-
-#include <sys/cdefs.h>
-#include <linux/ioctl.h>
-#include <asm/ioctls.h>
-
-int ioctl(int d, int request, ...) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/ipc.h b/mdk-stage1/dietlibc/include/sys/ipc.h
deleted file mode 100644
index 9184a2a82..000000000
--- a/mdk-stage1/dietlibc/include/sys/ipc.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _SYS_IPC_H
-#define _SYS_IPC_H
-
-#include <sys/cdefs.h>
-#include <linux/ipc.h>
-#include <asm/page.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/kd.h b/mdk-stage1/dietlibc/include/sys/kd.h
deleted file mode 100644
index 9e9a5152b..000000000
--- a/mdk-stage1/dietlibc/include/sys/kd.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _SYS_KD_H
-#define _SYS_KD_H
-
-#include <linux/kd.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/mman.h b/mdk-stage1/dietlibc/include/sys/mman.h
deleted file mode 100644
index dc398ba90..000000000
--- a/mdk-stage1/dietlibc/include/sys/mman.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _SYS_MMAN_H
-#define _SYS_MMAN_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <linux/mman.h>
-#include <asm/page.h>
-
-#ifndef PAGE_SIZE
-#warning PAGE_SIZE undefined
-#endif
-
-#define MAP_FAILED ((void *) -1)
-
-extern void *mmap (void *__addr, size_t __len, int __prot,
- int __flags, int __fd, off_t __offset);
-
-extern int munmap (void *__addr, size_t __len) __THROW;
-extern int mprotect (void *__addr, size_t __len, int __prot) __THROW;
-extern int msync (void *__addr, size_t __len, int __flags) __THROW;
-extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
- int __may_move) __THROW;
-extern int mincore (void *__start, size_t __len, unsigned char *__vec);
-
-#ifdef __quad_t
-extern void *mmap64 (void *__addr, size_t __len, int __prot,
- int __flags, int __fd, off64_t __offset) __THROW;
-#endif
-
-int mlockall(int flags) __THROW;
-int munlockall(void) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/mount.h b/mdk-stage1/dietlibc/include/sys/mount.h
deleted file mode 100644
index 2e9e86774..000000000
--- a/mdk-stage1/dietlibc/include/sys/mount.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _SYS_MOUNT_H
-#define _SYS_MOUNT_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <linux/fs.h>
-
-int mount(const char* specialfile, const char* dir, const char* filesystemtype,
- unsigned long rwflag, const void * data) __THROW;
-
-int umount(const char *specialfile) __THROW;
-
-int umount(const char *dir) __THROW;
-
-int umount2(const char *specialfile, int mflag) __THROW;
-
-int umount2(const char *dir, int mflag) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/msg.h b/mdk-stage1/dietlibc/include/sys/msg.h
deleted file mode 100644
index ea1e470b6..000000000
--- a/mdk-stage1/dietlibc/include/sys/msg.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _SYS_MSG_H
-#define _SYS_MSG_H
-
-#include <linux/msg.h>
-#include <sys/ipc.h>
-#include <asm/page.h>
-
-extern int msgctl (int msqid, int cmd, struct msqid_ds *buf) __THROW;
-extern int msgget (key_t key, int msgflg) __THROW;
-extern int msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) __THROW;
-extern int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/mtio.h b/mdk-stage1/dietlibc/include/sys/mtio.h
deleted file mode 100644
index e70663407..000000000
--- a/mdk-stage1/dietlibc/include/sys/mtio.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _SYS_MTIO_H
-#define _SYS_MTIO_H
-
-#include <linux/mtio.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/param.h b/mdk-stage1/dietlibc/include/sys/param.h
deleted file mode 100644
index 05f4d40e2..000000000
--- a/mdk-stage1/dietlibc/include/sys/param.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _SYS_PARAM_H
-#define _SYS_PARAM_H
-
-#include <limits.h>
-
-#define MAXPATHLEN PATH_MAX
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/poll.h b/mdk-stage1/dietlibc/include/sys/poll.h
deleted file mode 100644
index adce26687..000000000
--- a/mdk-stage1/dietlibc/include/sys/poll.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _SYS_POLL_H
-#define _SYS_POLL_H
-
-#include <sys/cdefs.h>
-
-#include <linux/poll.h>
-
-extern int poll(struct pollfd *ufds, unsigned int nfds, int timeout) __THROW;
-
-
-#endif /* _SYS_POLL_H */
diff --git a/mdk-stage1/dietlibc/include/sys/ptrace.h b/mdk-stage1/dietlibc/include/sys/ptrace.h
deleted file mode 100644
index 9dd730bc6..000000000
--- a/mdk-stage1/dietlibc/include/sys/ptrace.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _SYS_PTRACE_H
-#define _SYS_PTRACE_H
-
-#include <sys/cdefs.h>
-
-#include <linux/ptrace.h>
-
-extern long int ptrace (int request, ...) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/reboot.h b/mdk-stage1/dietlibc/include/sys/reboot.h
deleted file mode 100644
index ba58d296a..000000000
--- a/mdk-stage1/dietlibc/include/sys/reboot.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _SYS_REBOOT_H
-#define _SYS_REBOOT_H
-
-#include <linux/reboot.h>
-
-/* Reboot or halt the system. */
-int reboot (int flag, void *arg);
-
-#endif /* _SYS_REBOOT_H */
diff --git a/mdk-stage1/dietlibc/include/sys/resource.h b/mdk-stage1/dietlibc/include/sys/resource.h
deleted file mode 100644
index 442434cd1..000000000
--- a/mdk-stage1/dietlibc/include/sys/resource.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _SYS_RESOURCE_H
-#define _SYS_RESOURCE_H
-
-#include <sys/cdefs.h>
-#include <linux/resource.h>
-
-int getpriority(int which, int who) __THROW;
-int setpriority(int which, int who, int prio) __THROW;
-
-int getrlimit (int resource, struct rlimit *rlim);
-int getrusage (int who, struct rusage *usage);
-int setrlimit (int resource, const struct rlimit *rlim);
-
-typedef unsigned long rlim_t;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/select.h b/mdk-stage1/dietlibc/include/sys/select.h
deleted file mode 100644
index e69de29bb..000000000
--- a/mdk-stage1/dietlibc/include/sys/select.h
+++ /dev/null
diff --git a/mdk-stage1/dietlibc/include/sys/sem.h b/mdk-stage1/dietlibc/include/sys/sem.h
deleted file mode 100644
index cc182649c..000000000
--- a/mdk-stage1/dietlibc/include/sys/sem.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _SYS_SEM_H
-#define _SYS_SEM_H
-
-#include <linux/sem.h>
-#include <sys/ipc.h>
-
-extern int semget( key_t key, int nsems, int semflg) __THROW;
-extern int semctl(int semid, int semnum, int cmd, union semun arg) __THROW;
-extern int semop(int semid, struct sembuf *sops, unsigned nsops) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/sendfile.h b/mdk-stage1/dietlibc/include/sys/sendfile.h
deleted file mode 100644
index 2e0c04add..000000000
--- a/mdk-stage1/dietlibc/include/sys/sendfile.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _SYS_SENDFILE_H
-#define _SYS_SENDFILE_H
-
-#include <sys/cdefs.h>
-
-extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *offset,
- size_t __count) __THROW;
-
-#endif /* sys/sendfile.h */
diff --git a/mdk-stage1/dietlibc/include/sys/shm.h b/mdk-stage1/dietlibc/include/sys/shm.h
deleted file mode 100644
index c27f5ddcf..000000000
--- a/mdk-stage1/dietlibc/include/sys/shm.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _SYS_SHM_H
-#define _SYS_SHM_H
-
-#include <linux/shm.h>
-#include <sys/ipc.h>
-#include <asm/page.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE getpagesize()
-#endif
-
-extern int shmget(key_t key, int size, int shmflg) __THROW;
-extern void *shmat(int shmid, const void *shmaddr, int shmflg) __THROW;
-extern int shmdt (const void *shmaddr) __THROW;
-extern int shmctl(int shmid, int cmd, struct shmid_ds *buf) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/signal.h b/mdk-stage1/dietlibc/include/sys/signal.h
deleted file mode 100644
index 2e602dad8..000000000
--- a/mdk-stage1/dietlibc/include/sys/signal.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <signal.h>
diff --git a/mdk-stage1/dietlibc/include/sys/socket.h b/mdk-stage1/dietlibc/include/sys/socket.h
deleted file mode 100644
index a1435501c..000000000
--- a/mdk-stage1/dietlibc/include/sys/socket.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef _SYS_SOCKET_H
-#define _SYS_SOCKET_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <linux/socket.h>
-
-#ifndef SOCK_DGRAM
-/* the Linux kernel headers suck really badly on non-x86 */
-#define SOCK_STREAM 1 /* stream (connection) socket */
-#define SOCK_DGRAM 2 /* datagram (conn.less) socket */
-#define SOCK_RAW 3 /* raw socket */
-#define SOCK_RDM 4 /* reliably-delivered message */
-#define SOCK_SEQPACKET 5 /* sequential packet socket */
-#define SOCK_PACKET 10 /* linux specific way of */
-#endif
-
-struct sockaddr_storage {
- char __tmp[sizeof(struct sockaddr)];
-};
-
-int socket(int domain, int type, int protocol) __THROW;
-int accept(int s, struct sockaddr *addr, socklen_t *addrlen) __THROW;
-int connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen) __THROW;
-int bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) __THROW;
-int recv(int s, void *buf, size_t len, int flags) __THROW;
-int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) __THROW;
-int recvmsg(int s, struct msghdr *msg, int flags) __THROW;
-int send(int s, const void *msg, size_t len, int flags) __THROW;
-int sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) __THROW;
-int sendmsg(int s, const struct msghdr *msg, int flags) __THROW;
-
-int getpeername(int s, struct sockaddr *name, socklen_t *namelen) __THROW;
-int getsockname(int s , struct sockaddr * name , socklen_t * namelen) __THROW;
-
-int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) __THROW;
-int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) __THROW;
-
-int listen(int s, int backlog) __THROW;
-
-#define SHUT_RD 0
-#define SHUT_WR 1
-#define SHUT_RDWR 2
-int shutdown(int s, int how) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/stat.h b/mdk-stage1/dietlibc/include/sys/stat.h
deleted file mode 100644
index 10fddfa42..000000000
--- a/mdk-stage1/dietlibc/include/sys/stat.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _SYS_STAT_H
-#define _SYS_STAT_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <linux/stat.h>
-#include <asm/stat.h>
-
-#ifndef STAT64_HAS_BROKEN_ST_INO
-#define __NO_STAT64
-#endif
-
-extern int stat(const char *__file, struct stat *__buf) __THROW;
-extern int fstat(int __fd, struct stat *__buf) __THROW;
-extern int lstat(const char *__file, struct stat *__buf) __THROW;
-
-#ifdef __NO_STAT64
-#undef _FILE_OFFSET_BITS
-#else
-extern int stat64(const char *__file, struct stat64 *__buf) __THROW;
-extern int fstat64(int __fd, struct stat64 *__buf) __THROW;
-extern int lstat64(const char *__file, struct stat64 *__buf) __THROW;
-#endif
-
-#if _FILE_OFFSET_BITS == 64
-#define lstat(file,buf) lstat64(file,buf)
-#define fstat(file,buf) fstat64(file,buf)
-#define stat stat64
-#endif
-
-#define major(dev) (((dev)>>8) & 0xff)
-#define minor(dev) ((dev) & 0xff)
-#define makedev(major, minor) ((((unsigned int) (major)) << 8) | ((unsigned int) (minor)))
-
-extern int chmod (const char *__file, mode_t __mode) __THROW;
-
-extern int fchmod (int __fd, mode_t __mode) __THROW;
-
-extern mode_t umask (mode_t __mask) __THROW;
-
-extern int mkdir (const char *__path, mode_t __mode) __THROW;
-
-extern int mknod (const char *__path, mode_t __mode, dev_t __dev) __THROW;
-
-extern int mkfifo (const char *__path, mode_t __mode) __THROW;
-
-#define S_IREAD S_IRUSR
-#define S_IWRITE S_IWUSR
-#define S_IEXEC S_IXUSR
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/syscall.h b/mdk-stage1/dietlibc/include/sys/syscall.h
deleted file mode 100644
index 5d6b5a4ad..000000000
--- a/mdk-stage1/dietlibc/include/sys/syscall.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _SYSCALL_H
-#define _SYSCALL_H
-
-#include <asm/unistd.h>
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/sysinfo.h b/mdk-stage1/dietlibc/include/sys/sysinfo.h
deleted file mode 100644
index 5f059d469..000000000
--- a/mdk-stage1/dietlibc/include/sys/sysinfo.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _SYS_SYSINFO_H
-#define _SYS_SYSINFO_H
-
-#include <sys/cdefs.h>
-#include <linux/kernel.h>
-
-int sysinfo(struct sysinfo *info) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/syslog.h b/mdk-stage1/dietlibc/include/sys/syslog.h
deleted file mode 100644
index 91bf0d1fa..000000000
--- a/mdk-stage1/dietlibc/include/sys/syslog.h
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef _SYS_SYSLOG_H
-#define _SYS_SYSLOG_H 1
-
-#include <sys/cdefs.h>
-#include <stdarg.h>
-
-#define _PATH_LOG "/dev/log"
-
-/*
- * priorities/facilities are encoded into a single 32-bit quantity, where the
- * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
- * (0-big number). Both the priorities and the facilities map roughly
- * one-to-one to strings in the syslogd(8) source code. This mapping is
- * included in this file.
- *
- * priorities (these are ordered)
- */
-#define LOG_EMERG 0 /* system is unusable */
-#define LOG_ALERT 1 /* action must be taken immediately */
-#define LOG_CRIT 2 /* critical conditions */
-#define LOG_ERR 3 /* error conditions */
-#define LOG_WARNING 4 /* warning conditions */
-#define LOG_NOTICE 5 /* normal but significant condition */
-#define LOG_INFO 6 /* informational */
-#define LOG_DEBUG 7 /* debug-level messages */
-
-#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
- /* extract priority */
-#define LOG_PRI(p) ((p) & LOG_PRIMASK)
-#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
-
-/* facility codes */
-#define LOG_KERN (0<<3) /* kernel messages */
-#define LOG_USER (1<<3) /* random user-level messages */
-#define LOG_MAIL (2<<3) /* mail system */
-#define LOG_DAEMON (3<<3) /* system daemons */
-#define LOG_AUTH (4<<3) /* security/authorization messages */
-#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
-#define LOG_LPR (6<<3) /* line printer subsystem */
-#define LOG_NEWS (7<<3) /* network news subsystem */
-#define LOG_UUCP (8<<3) /* UUCP subsystem */
-#define LOG_CRON (9<<3) /* clock daemon */
-#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
-#define LOG_FTP (11<<3) /* ftp daemon */
-
- /* other codes through 15 reserved for system use */
-#define LOG_LOCAL0 (16<<3) /* reserved for local use */
-#define LOG_LOCAL1 (17<<3) /* reserved for local use */
-#define LOG_LOCAL2 (18<<3) /* reserved for local use */
-#define LOG_LOCAL3 (19<<3) /* reserved for local use */
-#define LOG_LOCAL4 (20<<3) /* reserved for local use */
-#define LOG_LOCAL5 (21<<3) /* reserved for local use */
-#define LOG_LOCAL6 (22<<3) /* reserved for local use */
-#define LOG_LOCAL7 (23<<3) /* reserved for local use */
-
-#define LOG_NFACILITIES 24 /* current number of facilities */
-#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
- /* facility of pri */
-#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
-
-/*
- * arguments to setlogmask.
- */
-#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
-#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
-
-/*
- * Option flags for openlog.
- *
- * LOG_ODELAY no longer does anything.
- * LOG_NDELAY is the inverse of what it used to be.
- */
-#define LOG_PID 0x01 /* log the pid with each message */
-#define LOG_CONS 0x02 /* log on the console if errors in sending */
-#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
-#define LOG_NDELAY 0x08 /* don't delay open */
-#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
-#define LOG_PERROR 0x20 /* log to stderr as well */
-
-/* Open connection to system logger. */
-/* against the glibc-routine ident has not to be const ! */
-/* instead ident is limited to 80 characters ! */
-void openlog (const char *ident, int option, int facility);
-
-void closelog (void) __THROW;
-
-int setlogmask (int mask) __THROW;
-
-void syslog (int priority, const char *format, ...) __THROW;
-
-void vsyslog (int priority, const char *format, va_list arg_ptr) __THROW;
-
-/* yuck yuck yuck, only needed for syslogd. */
-typedef struct _code {
- char *c_name;
- int c_val;
-} CODE;
-
-extern CODE prioritynames[];
-extern CODE facilitynames[];
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/time.h b/mdk-stage1/dietlibc/include/sys/time.h
deleted file mode 100644
index 11144f57b..000000000
--- a/mdk-stage1/dietlibc/include/sys/time.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef _SYS_TIME_H
-#define _SYS_TIME_H 1
-
-#include <sys/cdefs.h>
-
-#include <sys/types.h>
-#include <linux/time.h>
-
-#if defined __USE_GNU || defined __USE_BSD
-typedef struct timezone *__timezone_ptr_t;
-#else
-typedef void *__timezone_ptr_t;
-#endif
-
-int getitimer(int which, struct itimerval *value) __THROW;
-int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) __THROW;
-
-int gettimeofday(struct timeval *tv, struct timezone *tz) __THROW;
-int settimeofday(const struct timeval *tv , const struct timezone *tz) __THROW;
-
-extern int adjtime (const struct timeval *__delta,
- struct timeval *__olddelta) __THROW;
-
-struct tm
-{
- int tm_sec; /* Seconds. [0-60] (1 leap second) */
- int tm_min; /* Minutes. [0-59] */
- int tm_hour; /* Hours. [0-23] */
- int tm_mday; /* Day. [1-31] */
- int tm_mon; /* Month. [0-11] */
- int tm_year; /* Year - 1900. */
- int tm_wday; /* Day of week. [0-6] */
- int tm_yday; /* Days in year.[0-365] */
- int tm_isdst; /* DST. [-1/0/1]*/
-
- long int tm_gmtoff; /* Seconds east of UTC. */
- const char *tm_zone; /* Timezone abbreviation. */
-};
-
-struct tm* gmtime(const time_t *t) __THROW;
-struct tm* gmtime_r(const time_t *t, struct tm *r) __THROW;
-
-struct tm* localtime(const time_t *t) __THROW;
-struct tm* localtime_r(const time_t *t, struct tm *r) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/times.h b/mdk-stage1/dietlibc/include/sys/times.h
deleted file mode 100644
index 72ec62fec..000000000
--- a/mdk-stage1/dietlibc/include/sys/times.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _SYS_TIMES_H
-#define _SYS_TIMES_H
-
-#include <linux/times.h>
-
-clock_t times(struct tms *buf);
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/types.h b/mdk-stage1/dietlibc/include/sys/types.h
deleted file mode 100644
index 34dbaa9f1..000000000
--- a/mdk-stage1/dietlibc/include/sys/types.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _SYS_TYPES_H
-#define _SYS_TYPES_H
-
-#include <linux/types.h>
-#include <linux/posix_types.h>
-#include <linux/socket.h>
-
-#ifdef __GNUC__
-#define __quad_t __quad_t
-typedef long long int __quad_t;
-typedef unsigned long long int __u_quad_t;
-#else
-#warning no long long support - no 64 bit file I/O support
-typedef long int __quad_t;
-typedef unsigned long int __u_quad_t;
-#endif
-
-
-#ifdef __quad_t
-typedef __quad_t off64_t;
-typedef __u_quad_t ino64_t;
-typedef __quad_t blkcnt64_t;
-#endif
-
-typedef long int fpos_t;
-
-#define socklen_t socklen_t
-typedef unsigned int socklen_t;
-
-typedef long int blksize_t;
-typedef long int blkcnt_t;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/uio.h b/mdk-stage1/dietlibc/include/sys/uio.h
deleted file mode 100644
index d64fd33c9..000000000
--- a/mdk-stage1/dietlibc/include/sys/uio.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _SYS_UIO
-#define _SYS_UIO 1
-
-#include <linux/uio.h>
-
-int readv(int filedes, const struct iovec *vector, size_t count);
-int writev(int filedes, const struct iovec *vector, size_t count);
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/un.h b/mdk-stage1/dietlibc/include/sys/un.h
deleted file mode 100644
index 213d9290e..000000000
--- a/mdk-stage1/dietlibc/include/sys/un.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _SYS_UN_H
-#define _SYS_UN_H
-
-#include <sys/cdefs.h>
-
-#include <linux/un.h>
-
-#endif /* sys/un.h */
diff --git a/mdk-stage1/dietlibc/include/sys/utsname.h b/mdk-stage1/dietlibc/include/sys/utsname.h
deleted file mode 100644
index 37bf6c811..000000000
--- a/mdk-stage1/dietlibc/include/sys/utsname.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _SYS_UTSNAME_H
-#define _SYS_UTSNAME_H 1
-
-#include <sys/cdefs.h>
-
-/* Length of the entries in `struct utsname' is 65. */
-#define _UTSNAME_LENGTH 65
-#define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
-
-/* Linux provides as additional information in the `struct utsname'
- the name of the current domain. Define _UTSNAME_DOMAIN_LENGTH
- to a value != 0 to activate this entry. */
-#define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH
-
-struct utsname {
- /* Name of the implementation of the operating system. */
- char sysname[_UTSNAME_LENGTH];
-
- /* Name of this node on the network. */
- char nodename[_UTSNAME_NODENAME_LENGTH];
-
- /* Current release level of this implementation. */
- char release[_UTSNAME_LENGTH];
- /* Current version level of this release. */
- char version[_UTSNAME_LENGTH];
-
- /* Name of the hardware type the system is running on. */
- char machine[_UTSNAME_LENGTH];
-
- /* Name of the domain of this node on the network. */
- char domainname[_UTSNAME_DOMAIN_LENGTH];
-};
-
-extern int uname (struct utsname *__name) __THROW;
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/vfs.h b/mdk-stage1/dietlibc/include/sys/vfs.h
deleted file mode 100644
index e4740a225..000000000
--- a/mdk-stage1/dietlibc/include/sys/vfs.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _SYS_VFS_H
-#define _SYS_VFS_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <linux/vfs.h>
-
-int statfs(const char *path, struct statfs *buf) __THROW;
-int fstatfs(int fd, struct statfs *buf) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/sys/wait.h b/mdk-stage1/dietlibc/include/sys/wait.h
deleted file mode 100644
index eb70112e2..000000000
--- a/mdk-stage1/dietlibc/include/sys/wait.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _SYS_WAIT_H
-#define _SYS_WAIT_H
-
-#include <sys/cdefs.h>
-#include <sys/resource.h>
-#include <linux/wait.h>
-
-/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
-#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
-#define WEXITSTATUS __WEXITSTATUS
-
-/* If WIFSIGNALED(STATUS), the terminating signal. */
-#define __WTERMSIG(status) ((status) & 0x7f)
-#define WTERMSIG __WTERMSIG
-
-/* If WIFSTOPPED(STATUS), the signal that stopped the child. */
-#define __WSTOPSIG(status) __WEXITSTATUS(status)
-#define WSTOPSIG __WSTOPSIG
-
-/* Nonzero if STATUS indicates normal termination. */
-#define WIFEXITED(status) (__WTERMSIG(status) == 0)
-
-/* Nonzero if STATUS indicates termination by a signal. */
-#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
-
-/* Nonzero if STATUS indicates the child is stopped. */
-#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
-
-
-pid_t wait(int *status) __THROW;
-pid_t waitpid(pid_t pid, int *status, int options) __THROW;
-
-pid_t wait3(int *status, int options, struct rusage *rusage) __THROW;
-
-pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/syslog.h b/mdk-stage1/dietlibc/include/syslog.h
deleted file mode 100644
index 830b4928a..000000000
--- a/mdk-stage1/dietlibc/include/syslog.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sys/syslog.h>
diff --git a/mdk-stage1/dietlibc/include/termios.h b/mdk-stage1/dietlibc/include/termios.h
deleted file mode 100644
index f10909c1b..000000000
--- a/mdk-stage1/dietlibc/include/termios.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _TERMIOS_H
-#define _TERMIOS_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-/* man, the Linux kernel headers suck */
-#define __USE_BSD
-#include <linux/termios.h>
-#undef __USE_BSD
-
-pid_t tcgetpgrp(int fd) __THROW;
-int tcsetpgrp(int fd, pid_t pgrpid) __THROW;
-int tcgetattr(int fd, struct termios *termios_p) __THROW;
-int tcsetattr(int fd, int optional_actions, struct termios *termios_p) __THROW;
-speed_t cfgetospeed(struct termios *termios_p) __THROW;
-int cfsetospeed(struct termios *termios_p, speed_t speed) __THROW;
-speed_t cfgetispeed(struct termios *termios_p) __THROW;
-int cfsetispeed(struct termios *termios_p, speed_t speed) __THROW;
-int tcflush(int fd, int queue_selector) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/time.h b/mdk-stage1/dietlibc/include/time.h
deleted file mode 100644
index 827c85b97..000000000
--- a/mdk-stage1/dietlibc/include/time.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _TIME_H
-#define _TIME_H
-
-#include <sys/cdefs.h>
-#include <sys/time.h>
-
-extern int __isleap(int year);
-
-int nanosleep(const struct timespec *req, struct timespec *rem) __THROW;
-unsigned int sleep(unsigned int secs) __THROW;
-
-time_t mktime(struct tm *timeptr) __THROW __pure__;
-
-char *asctime(const struct tm *timeptr) __THROW;
-char *asctime_r(const struct tm *timeptr, char *buf) __THROW;
-
-char *ctime(const time_t *timep) __THROW;
-
-size_t strftime(char *s, size_t max, const char *format, const struct tm *tm) __THROW;
-time_t time(time_t *t) __THROW;
-
-int stime(time_t *t) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/unistd.h b/mdk-stage1/dietlibc/include/unistd.h
deleted file mode 100644
index 1a528c0e4..000000000
--- a/mdk-stage1/dietlibc/include/unistd.h
+++ /dev/null
@@ -1,168 +0,0 @@
-#ifndef _UNISTD_H
-#define _UNISTD_H
-
-#include <sys/cdefs.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <getopt.h>
-#include <linux/sysctl.h>
-#include <sys/stat.h>
-
-/* Values for the second argument to access.
- These may be OR'd together. */
-#define R_OK 4 /* Test for read permission. */
-#define W_OK 2 /* Test for write permission. */
-#define X_OK 1 /* Test for execute permission. */
-#define F_OK 0 /* Test for existence. */
-
-/* Test for access to NAME using the real UID and real GID. */
-extern int access (__const char *__name, int __type) __THROW;
-
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
-#define STDIN_FILENO 0
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-
-off_t lseek(int fildes, off_t offset, int whence) __THROW;
-int llseek(int fildes, unsigned long hi, unsigned long lo, loff_t* result,int whence) __THROW;
-#ifndef __NO_STAT64
-loff_t lseek64(int fildes, loff_t offset, int whence) __THROW;
-#endif
-#if _FILE_OFFSET_BITS == 64
-#define lseek(fildes,offset,whence) lseek64(fildes,offset,whence)
-#endif
-
-int chdir(const char *path) __THROW;
-int fchdir(int fd) __THROW;
-int mkdir(const char *pathname, mode_t mode) __THROW;
-int rmdir(const char *pathname) __THROW;
-char *getcwd(char *buf, size_t size) __THROW;
-
-int open(const char* pathname,int flags, ...) __THROW;
-int open64(const char* pathname,int flags, ...) __THROW;
-int creat(const char* pathname,mode_t mode) __THROW;
-int creat64(const char* pathname,mode_t mode) __THROW;
-int write(int fd,const void* buf,size_t len) __THROW;
-int read(int fd,void* buf,size_t len) __THROW;
-int close(int fd) __THROW;
-
-int unlink(const char *pathname) __THROW;
-
-int pread(int fd, void *buf, size_t count, off_t offset);
-int pwrite(int fd, const void *buf, size_t count, off_t offset);
-
-int execve(const char *filename, char *const argv [], char *const envp[]) __THROW;
-int execlp(const char *file, const char *arg, ...) __THROW;
-int execv(const char *path, char *const argv[]) __THROW;
-int execvp(const char *file, char *const argv[]) __THROW;
-int execl(const char *path, ...) __THROW;
-
-pid_t getpid(void) __attribute__((__const__)) __THROW;
-pid_t getppid(void) __THROW;
-int kill(pid_t pid, int sig) __THROW;
-
-int setpgid (pid_t pid,pid_t pgid) __THROW;
-pid_t getpgid (pid_t pid) __THROW;
-int setpgrp (void) __THROW;
-pid_t getpgrp (void) __THROW;
-pid_t setsid (void) __THROW;
-int dup (int oldfd) __THROW;
-int dup2 (int oldfd,int newfd) __THROW;
-
-int mknod(const char *pathname, mode_t mode, dev_t dev) __THROW;
-
-int getdents(unsigned int fd, struct dirent *dirp, unsigned int count) __THROW;
-int getdents64(unsigned int fd, struct dirent64 *dirp, unsigned int count) __THROW;
-
-pid_t fork(void) __THROW;
-pid_t vfork(void) __THROW;
-
-int readlink(const char *path, char *buf, size_t bufsiz) __THROW;
-int symlink(const char *oldpath, const char *newpath) __THROW;
-int link(const char *oldpath, const char *newpath) __THROW;
-
-int chown(const char *path, uid_t owner, gid_t group) __THROW;
-int fchown(int fd, uid_t owner, gid_t group) __THROW;
-int lchown(const char *path, uid_t owner, gid_t group) __THROW;
-
-int fsync(int fd) __THROW;
-
-int pipe(int filedes[2]) __THROW;
-
-char *ttyname (int desc) __THROW;
-
-int brk(void *end_data_segment) __THROW;
-void *sbrk(ptrdiff_t increment) __THROW;
-
-int gethostname(char *name, size_t len) __THROW;
-int sethostname(const char *name, size_t len) __THROW;
-
-void usleep(unsigned long usec) __THROW;
-unsigned int sleep(unsigned int seconds) __THROW;
-
-unsigned int alarm(unsigned int seconds) __THROW;
-int sync(void) __THROW;
-
-int isatty(int desc) __THROW;
-
-void _exit(int status) __THROW __attribute__((noreturn));
-
-extern int daemon (int nochdir,int noclose) __THROW;
-
-#if _FILE_OFFSET_BITS == 64
-#define open open64
-#define creat creat64
-#endif
-
-extern char* getlogin(void) __THROW;
-/* warning: the diet libc getlogin() simply returns getenv("LOGNAME") */
-
-int chroot(const char *path) __THROW;
-
-uid_t getuid(void) __THROW;
-uid_t geteuid(void) __THROW;
-gid_t getgid(void) __THROW;
-gid_t getegid(void) __THROW;
-int setuid(uid_t uid) __THROW;
-/* int seteuid(uid_t uid) __THROW; */
-int setgid(gid_t gid) __THROW;
-/* int setegid(gid_t gid) __THROW; */
-int setregid(gid_t rgid, gid_t egid) __THROW;
-int setreuid(uid_t ruid, uid_t euid) __THROW;
-#define seteuid(euid) setreuid(-1,euid)
-#define setegid(egid) setregid(-1,egid)
-
-int rename(const char *oldpath, const char *newpath) __THROW;
-int ftruncate(int fd, off_t length) __THROW;
-
-int mkstemp(char *Template) __THROW;
-
-int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) __THROW;
-
-int nice(int inc) __THROW;
-
-extern char *__environ[];
-
-char *crypt(const char *key, const char *salt) __THROW;
-void encrypt(char block[64], int edflag) __THROW;
-void setkey(const char *key) __THROW;
-
-size_t getpagesize(void) __attribute__((__const__)) __THROW;
-
-int getdomainname(char *name, size_t len) __THROW;
-int setdomainname(const char *name, size_t len) __THROW;
-
-int getgroups(int size, gid_t list[]) __THROW;
-
-/* warning: linux specific: */
-int _sysctl(struct __sysctl_args *args) __THROW;
-int sendfile(int out_fd, int in_fd, off_t *offset, size_t count) __THROW;
-
-int getdtablesize(void) __THROW;
-char *getpass(const char * prompt) __THROW;
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/utime.h b/mdk-stage1/dietlibc/include/utime.h
deleted file mode 100644
index 41674f379..000000000
--- a/mdk-stage1/dietlibc/include/utime.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _UTIME_H
-#define _UTIME_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <time.h>
-
-struct utimbuf {
- time_t actime; /* access time */
- time_t modtime; /* modification time */
-};
-
-int utime(const char *filename, struct utimbuf *buf) __THROW;
-
-
-#endif
diff --git a/mdk-stage1/dietlibc/include/utmp.h b/mdk-stage1/dietlibc/include/utmp.h
deleted file mode 100644
index 2946be921..000000000
--- a/mdk-stage1/dietlibc/include/utmp.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef _UTMP_H
-#define _UTMP_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <time.h>
-
-#define UT_LINESIZE 32
-#define UT_NAMESIZE 32
-#define UT_HOSTSIZE 256
-
-#define _PATH_UTMP "/var/run/utmp"
-#define _PATH_WTMP "/var/log/wtmp"
-
-/* The structure describing an entry in the database of
- previous logins. */
-struct lastlog
- {
- time_t ll_time;
- char ll_line[UT_LINESIZE];
- char ll_host[UT_HOSTSIZE];
- };
-
-/* The structure describing the status of a terminated process. This
- type is used in `struct utmp' below. */
-struct exit_status
- {
- short int e_termination; /* Process termination status. */
- short int e_exit; /* Process exit status. */
- };
-
-/* The structure describing an entry in the user accounting database. */
-struct utmp
-{
- short int ut_type; /* Type of login. */
- pid_t ut_pid; /* Process ID of login process. */
- char ut_line[UT_LINESIZE]; /* Devicename. */
- char ut_id[4]; /* Inittab ID. */
- char ut_user[UT_NAMESIZE]; /* Username. */
- char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
-#define ut_name ut_host
- struct exit_status ut_exit; /* Exit status of a process marked
- as DEAD_PROCESS. */
- long int ut_session; /* Session ID, used for windowing. */
- struct timeval ut_tv; /* Time entry was made. */
- int32_t ut_addr_v6[4]; /* Internet address of remote host. */
- char __unused[20]; /* Reserved for future use. */
-};
-
-/* Values for the `ut_type' field of a `struct utmp'. */
-#define EMPTY 0 /* No valid user accounting information. */
-
-#define RUN_LVL 1 /* The system's runlevel. */
-#define BOOT_TIME 2 /* Time of system boot. */
-#define NEW_TIME 3 /* Time after system clock changed. */
-#define OLD_TIME 4 /* Time when system clock changed. */
-
-#define INIT_PROCESS 5 /* Process spawned by the init process. */
-#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
-#define USER_PROCESS 7 /* Normal process. */
-#define DEAD_PROCESS 8 /* Terminated process. */
-
-#define ACCOUNTING 9
-
-/* Tell the user that we have a modern system with UT_HOST, UT_PID,
- UT_TYPE, UT_ID and UT_TV fields. */
-#define _HAVE_UT_TYPE 1
-#define _HAVE_UT_PID 1
-#define _HAVE_UT_ID 1
-#define _HAVE_UT_TV 1
-#define _HAVE_UT_HOST 1
-
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__dtostr.c b/mdk-stage1/dietlibc/lib/__dtostr.c
deleted file mode 100644
index e9a8a83d3..000000000
--- a/mdk-stage1/dietlibc/lib/__dtostr.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include <stdio.h>
-/* convert double to string. Helper for sprintf. */
-
-int __dtostr(double d,char *buf,int maxlen,int prec) {
- unsigned long long *x=(unsigned long long *)&d;
- /* step 1: extract sign, mantissa and exponent */
- signed int s=*x>>63;
- signed long e=((*x>>52)&((1<<11)-1))-1023;
-/* unsigned long long m=*x & ((1ull<<52)-1); */
- /* step 2: exponent is base 2, compute exponent for base 10 */
- signed long e10=1+(long)(e*0.30102999566398119802); /* log10(2) */
- /* step 3: calculate 10^e10 */
- int i;
- double tmp=10.0;
- char *oldbuf=buf;
- int initial=1;
-
- if (d==0.0) {
- *buf='0'; ++buf;
- goto done;
- }
- if (s) { d=-d; *buf='-'; --maxlen; buf++; }
-/* printf("e=%d e10=%d prec=%d\n",e,e10,prec); */
- if (e10>=0) {
- i=e10;
- while (i>10) { tmp=tmp*1e10; i-=10; }
- while (i>1) { tmp=tmp*10; --i; }
- } else {
- i=(e10=-e10);
- while (i>10) { tmp=tmp*1e-10; i-=10; }
- while (i>1) { tmp=tmp/10; --i; }
- }
- while (d/tmp<1) {
- --e10;
- tmp/=10.0;
- }
- /* step 4: see if precision is sufficient to display all digits */
- if (e10>prec) {
- /* use scientific notation */
- int len=__dtostr(d/tmp,buf,maxlen,prec);
- if (len==0) return 0;
- maxlen-=len; buf+=len;
- if (--maxlen>=0) {
- *buf='e';
- ++buf;
- }
- for (len=1000; len>0; len/=10) {
- if (e10>=len || !initial) {
- if (--maxlen>=0) {
- *buf=(e10/len)+'0';
- ++buf;
- }
- initial=0;
- e10=e10%len;
- }
- }
- if (maxlen>=0) return buf-oldbuf;
- return 0;
- }
- /* step 5: loop through the digits, inserting the decimal point when
- * appropriate */
- if (d<1.0) {
- double x=1.0;
- int first=1;
- do {
- if (--maxlen<0) return buf-oldbuf;
- *buf='0'; ++buf;
- if (first) {
- first=0;
- *buf='.'; ++buf;
- if (--maxlen<0) return buf-oldbuf;
- }
- x/=10.0;
- } while (x>d);
- }
- for (; prec>0; ) {
- double tmp2=d/tmp;
- char c;
- d-=((int)tmp2*tmp);
- c=((int)tmp2);
- if ((!initial)||c) {
- if (--maxlen>=0) {
- initial=0;
- *buf=c+'0';
- ++buf;
- } else
- return 0;
- --prec;
- }
- if (tmp>0.5 && tmp<1.5) {
- tmp=1e-1;
- initial=0;
- if (--maxlen>=0) {
- *buf='.';
- ++buf;
- } else
- return 0;
- } else
- tmp/=10.0;
- }
-done:
- *buf=0;
- return buf-oldbuf;
-}
diff --git a/mdk-stage1/dietlibc/lib/__fstat64.c b/mdk-stage1/dietlibc/lib/__fstat64.c
deleted file mode 100644
index 6f9fcb2c5..000000000
--- a/mdk-stage1/dietlibc/lib/__fstat64.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "dietfeatures.h"
-
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-#include <errno.h>
-
-extern int __dietlibc_fstat64(int __fd, struct stat64 *__buf);
-extern void __stat64_cvt(const struct stat *src,struct stat64 *dest);
-
-int fstat64(int __fd, struct stat64 *__buf) {
- if (__dietlibc_fstat64(__fd,__buf)) {
- struct stat temp;
-#ifdef WANT_THREAD_SAFE
- if (*__errno_location()!=ENOSYS) return -1;
-#else
- if (errno!=ENOSYS) return -1;
-#endif
- if (fstat(__fd,&temp)) return -1;
- __stat64_cvt(&temp,__buf);
- }
- return 0;
-}
-#endif
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__getcwd.c b/mdk-stage1/dietlibc/lib/__getcwd.c
deleted file mode 100644
index e97fc4520..000000000
--- a/mdk-stage1/dietlibc/lib/__getcwd.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdlib.h>
-
-extern int __syscall_getcwd(char* buf, size_t size);
-
-char *getcwd(char *buf, size_t size) {
- int tmp;
- if ((tmp=__syscall_getcwd(buf,size))<0) return 0;
- buf[tmp]=0;
- return buf;
-}
diff --git a/mdk-stage1/dietlibc/lib/__isnan.c b/mdk-stage1/dietlibc/lib/__isnan.c
deleted file mode 100644
index 9d21e9824..000000000
--- a/mdk-stage1/dietlibc/lib/__isnan.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdio.h>
-
-int __isnan(double d) {
- unsigned long long *x=(unsigned long long *)&d;
- return (*x==0x7FF8002000000000ll || *x==0x7FF0002000000000);
-}
-
-#if 0
-TestFromIeeeExtended("7FFF0000000000000000"); /* +infinity */
-TestFromIeeeExtended("FFFF0000000000000000"); /* -infinity */
-TestFromIeeeExtended("7FFF8001000000000000"); /* Quiet NaN(1) */
-TestFromIeeeExtended("7FFF0001000000000000"); /* Signalling NaN(1) */
-TestFromIeeeExtended("3FFFFEDCBA9876543210"); /* accuracy test */
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__lltostr.c b/mdk-stage1/dietlibc/lib/__lltostr.c
deleted file mode 100644
index eb4a27cef..000000000
--- a/mdk-stage1/dietlibc/lib/__lltostr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <string.h>
-
-int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase)
-{
- char *tmp;
- int j=0;
-
- s[--size]=0;
-
- tmp=s+size;
-
- if ((base==0)||(base>36)) base=10;
-
- j=0;
- if (!i)
- {
- *(--tmp)='0';
- j=1;
- }
-
- while((tmp>s)&&(i))
- {
- tmp--;
- if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1;
- i=i/base;
- j++;
- }
- memmove(s,tmp,j+1);
-
- return j;
-}
diff --git a/mdk-stage1/dietlibc/lib/__lstat64.c b/mdk-stage1/dietlibc/lib/__lstat64.c
deleted file mode 100644
index a871f3917..000000000
--- a/mdk-stage1/dietlibc/lib/__lstat64.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "dietfeatures.h"
-
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-#include <errno.h>
-
-extern int __dietlibc_lstat64(const char *__file, struct stat64 *__buf);
-extern void __stat64_cvt(const struct stat *src,struct stat64 *dest);
-
-int lstat64(const char *__file, struct stat64 *__buf) {
- if (__dietlibc_lstat64(__file,__buf)) {
- struct stat temp;
-#ifdef WANT_THREAD_SAFE
- if (*__errno_location()!=ENOSYS) return -1;
-#else
- if (errno!=ENOSYS) return -1;
-#endif
- if (lstat(__file,&temp)) return -1;
- __stat64_cvt(&temp,__buf);
- }
- return 0;
-}
-#endif
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__ltostr.c b/mdk-stage1/dietlibc/lib/__ltostr.c
deleted file mode 100644
index 57e0690d2..000000000
--- a/mdk-stage1/dietlibc/lib/__ltostr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <string.h>
-
-int __ltostr(char *s, int size, unsigned long i, int base, char UpCase)
-{
- char *tmp;
- int j=0;
-
- s[--size]=0;
-
- tmp=s+size;
-
- if ((base==0)||(base>36)) base=10;
-
- j=0;
- if (!i)
- {
- *(--tmp)='0';
- j=1;
- }
-
- while((tmp>s)&&(i))
- {
- tmp--;
- if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1;
- i=i/base;
- j++;
- }
- memmove(s,tmp,j+1);
-
- return j;
-}
diff --git a/mdk-stage1/dietlibc/lib/__stat64.c b/mdk-stage1/dietlibc/lib/__stat64.c
deleted file mode 100644
index dfb0d4315..000000000
--- a/mdk-stage1/dietlibc/lib/__stat64.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "dietfeatures.h"
-
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-#include <errno.h>
-
-extern int __dietlibc_stat64(const char *__file, struct stat64 *__buf);
-extern void __stat64_cvt(const struct stat *src,struct stat64 *dest);
-
-int stat64(const char *__file, struct stat64 *__buf) {
- if (__dietlibc_stat64(__file,__buf)) {
- struct stat temp;
-#ifdef WANT_THREAD_SAFE
- if (*__errno_location()!=ENOSYS) return -1;
-#else
- if (errno!=ENOSYS) return -1;
-#endif
- if (stat(__file,&temp)) return -1;
- __stat64_cvt(&temp,__buf);
- }
- return 0;
-}
-#endif
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__stat64_cvt.c b/mdk-stage1/dietlibc/lib/__stat64_cvt.c
deleted file mode 100644
index dced352a4..000000000
--- a/mdk-stage1/dietlibc/lib/__stat64_cvt.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-
-void __stat64_cvt(const struct stat *src,struct stat64 *dest) {
- dest->st_dev=src->st_dev;
- dest->st_ino=src->st_ino;
- dest->st_mode=src->st_mode;
- dest->st_nlink=src->st_nlink;
- dest->st_uid=src->st_gid;
- dest->st_rdev=src->st_rdev;
- dest->st_size=src->st_size;
- dest->st_blksize=src->st_blksize;
- dest->st_blocks=src->st_blocks;
- dest->st_atime=src->st_atime;
- dest->st_mtime=src->st_mtime;
- dest->st_ctime=src->st_ctime;
-}
-#endif
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/_brk.c b/mdk-stage1/dietlibc/lib/_brk.c
deleted file mode 100644
index 6d0b29c03..000000000
--- a/mdk-stage1/dietlibc/lib/_brk.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <unistd.h>
-
-extern int __diet_brk(void *end_data_segment);
-
-void* __curbrk=0;
-
-int __brk(void *end_data_segment) {
- int res;
- if ((res=__diet_brk(end_data_segment))==0)
- __curbrk=end_data_segment;
- return res;
-}
-
-int brk (void *end_data_segment) __attribute__((weak,alias("__brk")));
diff --git a/mdk-stage1/dietlibc/lib/abort.c b/mdk-stage1/dietlibc/lib/abort.c
deleted file mode 100644
index 55bfb8f0f..000000000
--- a/mdk-stage1/dietlibc/lib/abort.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <linux/types.h>
-#include <linux/signal.h>
-#include <signal.h>
-#include <stdlib.h>
-
-void abort() {
- sigset_t t;
- if (!sigemptyset(&t) && !sigaddset(&t, SIGABRT))
- sigprocmask(SIG_UNBLOCK, &t, 0);
- while (1)
- if (raise(SIGABRT))
- exit(127);
-}
diff --git a/mdk-stage1/dietlibc/lib/abs.c b/mdk-stage1/dietlibc/lib/abs.c
deleted file mode 100644
index 9d7055358..000000000
--- a/mdk-stage1/dietlibc/lib/abs.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdlib.h>
-
-int abs(int j)
-{
- return (j < 0) ? -j : j;
-}
diff --git a/mdk-stage1/dietlibc/lib/accept.c b/mdk-stage1/dietlibc/lib/accept.c
deleted file mode 100644
index c7e8254ca..000000000
--- a/mdk-stage1/dietlibc/lib/accept.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_accept(int a, void * addr, void * addr2) {
-#ifdef __i386__
- return socketcall(SYS_ACCEPT, (long*)&a);
-#else
- unsigned long args[] = { a, (long) addr, (long) addr2 };
- return socketcall(SYS_ACCEPT, args);
-#endif
-}
-
-int accept(int a, void * addr, void * addr2) __attribute__((weak,alias("__libc_accept")));
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/alloc.c b/mdk-stage1/dietlibc/lib/alloc.c
deleted file mode 100644
index 8cb87a69b..000000000
--- a/mdk-stage1/dietlibc/lib/alloc.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * malloc/free by O.Dreesen
- */
-
-#include <linux/unistd.h>
-#include <asm/mman.h>
-#include <linux/errno.h>
-#include "dietfeatures.h"
-
-#if 0
-#include <sys/mman.h>
-#define _LIBC
-#include <errno.h>
-#endif
-
-#include <linux/types.h>
-
-#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
-#define MAP_ANON MAP_ANONYMOUS
-#endif
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void*)-1)
-#endif
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-extern void * mmap(void *start, size_t length, int prot , int flags, int fd, off_t offset);
-extern void *memset(void *s, int c, size_t n);
-extern void *memcpy(void *dest, const void *src, size_t n);
-
-typedef struct t_alloc_head {
- unsigned int magic1;
- struct t_alloc_head *ptr;
- unsigned long size;
- unsigned int magic2;
-} alloc_head;
-
-/* guess what ? the virtual block size */
-#define MEM_BLOCK_SIZE 4096
-
-/* minimum allocated bytes */
-#define MEM_ALLOC_MIN 4
-
-/* Initial start position in memory */
-#define MEM_ALLOC_START ((char*)0x18000000)
-
-/* Make every block align */
-#define MEM_ALIGN(s) (((s)+MEM_ALLOC_MIN-1)&(~(MEM_ALLOC_MIN-1)))
-#define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(~(MEM_BLOCK_SIZE-1)))
-#define PAGE_ALIGNP(p) ((char*)PAGE_ALIGN((size_t)(p)))
-
-#define END_OF_BLOCK(p) ((alloc_head*)(((char*)(p))+((p)->size)))
-#define START_BLOCK(p) ((alloc_head*)(((char*)(p))-sizeof(alloc_head)))
-#define START_DATA(p) (((char*)(p))+sizeof(alloc_head))
-#define MIN_ALLOC(s) (((((s)+sizeof(alloc_head)-1)/MEM_ALLOC_MIN)+1)*MEM_ALLOC_MIN)
-
-#define ALLOC_MAGIC1 0xbad2f7ee
-#define ALLOC_MAGIC2 0xf7ee2bad
-
-/* freelist handler */
-static alloc_head base = {ALLOC_MAGIC1,&base,0,ALLOC_MAGIC2};
-static char *alloc_get_end = MEM_ALLOC_START;
-
-void __libc_free(void *ptr)
-{
- alloc_head *prev,*p,*block;
-
- if (ptr==NULL) return;
-
- block=START_BLOCK(ptr);
- if (block->magic1 != ALLOC_MAGIC1) return;
- if (block->magic2 != ALLOC_MAGIC2) return;
-
- prev=&base;
- for (p=prev->ptr ; ; prev=p, p=p->ptr)
- {
- if ((block>prev)&&(block<p)) break; /* found the gap block belongs */
- if ((prev>p)&&(block<p)) break; /* block pre freelist */
- if ((prev>p)&&(block>prev)) break; /* block after freelist */
-
- /* emergency escape: freelist has ONLY one entry the freelist base */
- if (p->ptr==p) break;
- }
- prev->ptr = block;
-
- if (END_OF_BLOCK(block)==p)
- { /* join right neighbor */
- block->ptr = p->ptr;
- block->size += p->size;
- }
- else
- block->ptr = p;
-
- if (END_OF_BLOCK(prev)==block)
- { /* join left neighbor */
- prev->size += block->size;
- prev->ptr = block->ptr;
- }
-}
-void free(void *ptr) __attribute__((weak,alias("__libc_free")));
-
-static void *alloc_get_mem(unsigned long size)
-{
- char *tmp;
- alloc_head *ah;
-
- size=PAGE_ALIGN(size);
-
- /* map free pages @ alloc_get_end */
- tmp=mmap(alloc_get_end, size, PROT_READ|PROT_WRITE,
- MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0);
- if (tmp==MAP_FAILED)
- {
- /* OK we can't map free pages @ alloc_get_end so try free position */
- tmp=mmap(0, size, PROT_READ|PROT_WRITE,
- MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
- if (tmp==MAP_FAILED)
- {
- errno = ENOMEM;
- return NULL; /* PANIC ! */
- }
- alloc_get_end=tmp;
- }
-
- alloc_get_end+=size;
-
- /* make a header */
- ah=(alloc_head*)tmp;
- ah->magic1=ALLOC_MAGIC1;
- ah->magic2=ALLOC_MAGIC2;
- ah->ptr=ah;
- ah->size=size;
-
- /* link new free maped pages in freelist */
- __libc_free(START_DATA(tmp));
-
- return &base;
-}
-
-void *__libc_malloc(size_t size)
-{
- alloc_head *p, *prev;
- size_t need;
-
- /* needed MEM_ALLOC_MIN */
- need=MIN_ALLOC(size);
-
- prev=&base;
- for (p=prev->ptr;;prev=p,p=p->ptr)
- {
- if (p->size>=need)
- {
- if (p->size==need)
- { /* fit PERFECT */
- prev->ptr=p->ptr; /* relink freelist */
- }
- else
- {
- alloc_head *tmp=(alloc_head*)(((char*)p)+need);
- if ((p->size-need)<sizeof(alloc_head))
- { /* work around: if there is not enough space for freelist head.
- * this waste some bytes ( < sizeof(alloc_head) ) */
- need=p->size;
- prev->ptr=p->ptr; /* relink freelist */
- }
- else
- {
- prev->ptr=tmp;
- tmp->magic1=ALLOC_MAGIC1;
- tmp->magic2=ALLOC_MAGIC2;
- tmp->ptr=p->ptr;
- tmp->size=p->size-need; /* remaining size */
- }
-
- p->size=need; /* set size */
- }
- p->ptr=p; /* self-link */
-
- return (void*)START_DATA(p);
- }
- else if (p==&base)
- {
- if ((p=alloc_get_mem(need))==NULL) goto err_out;
- }
- }
-err_out:
- return NULL;
-}
-void *malloc(size_t size) __attribute__((weak,alias("__libc_malloc")));
-
-void *calloc(size_t nmemb,size_t size)
-{
- size_t n=nmemb*size;
- void *tmp=malloc(n);
- if (tmp) memset(tmp,0,n);
- return tmp;
-}
-
-void *realloc(void *ptr,size_t size)
-{
- alloc_head *tmp=0,*tf=0;
- long need=0;
- long diff=0;
-
- if (ptr)
- {
- if (size)
- {
- tmp=START_BLOCK(ptr);
- need=MIN_ALLOC(size); /* only this size will survive */
- diff=tmp->size-need;
- if (diff<0)
- {
- if ((tf=malloc(size)))
- {
- memcpy(tf,ptr,tmp->size-sizeof(alloc_head));
- free(ptr);
- return tf;
- }
- return NULL;
- }
- if (diff>=sizeof(alloc_head))
- {
- tmp->size=need;
- tf=END_OF_BLOCK(tmp);
- tf->magic1=ALLOC_MAGIC1;
- tf->magic2=ALLOC_MAGIC2;
- tf->ptr=tf;
- tf->size=diff;
- free(START_DATA(tf));
- }
- return ptr;
- }
- else
- free(ptr);
- }
- else if (size>0)
- return malloc(size);
- return NULL;
-}
diff --git a/mdk-stage1/dietlibc/lib/assert_fail.c b/mdk-stage1/dietlibc/lib/assert_fail.c
deleted file mode 100644
index 3d6ba65c1..000000000
--- a/mdk-stage1/dietlibc/lib/assert_fail.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "dietwarning.h"
-
-extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase);
-
-void __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function)
-{
- int alen=strlen(assertion);
- int flen=strlen(file);
- int fulen=strlen(function);
- char *buf=(char*)alloca(alen+flen+fulen+50);
- if (buf) {
- char *tmp;
- *buf=0;
- if (file) strcat(strcat(buf,file),":");
- tmp=buf+strlen(buf);
- __ltostr(tmp,10,line,10,0);
- strcat(buf,": ");
- if (function) strcat(strcat(buf,function),": ");
- strcat(buf,"Assertion `");
- strcat(buf,assertion);
- strcat(buf,"' failed.\n");
- write(2,buf,strlen(buf));
- }
- abort();
-}
-
-link_warning("__assert_fail","warning: your code still has assertions enabled!")
diff --git a/mdk-stage1/dietlibc/lib/atexit.c b/mdk-stage1/dietlibc/lib/atexit.c
deleted file mode 100644
index 8204af06c..000000000
--- a/mdk-stage1/dietlibc/lib/atexit.c
+++ /dev/null
@@ -1,23 +0,0 @@
-typedef void (*function)(void);
-
-static function __atexitlist[4];
-
-int atexit(function t) {
- int i;
- for (i=0; i<4; i++)
- if (__atexitlist[i]==0) {
- __atexitlist[i]=t;
- return 0;
- }
- return -1;
-}
-
-extern void _exit(int code) __attribute__((noreturn));
-
-void exit(int code) {
- if (__atexitlist[3]) __atexitlist[3]();
- if (__atexitlist[2]) __atexitlist[2]();
- if (__atexitlist[1]) __atexitlist[1]();
- if (__atexitlist[0]) __atexitlist[0]();
- _exit(code);
-}
diff --git a/mdk-stage1/dietlibc/lib/atof.c b/mdk-stage1/dietlibc/lib/atof.c
deleted file mode 100644
index 54221390e..000000000
--- a/mdk-stage1/dietlibc/lib/atof.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdlib.h>
-
-double atof(const char *nptr) {
-#if 0
- return strtod(nptr,0);
-#else
- double tmp=strtod(nptr,0);
- return tmp;
-#endif
-}
diff --git a/mdk-stage1/dietlibc/lib/atoi.c b/mdk-stage1/dietlibc/lib/atoi.c
deleted file mode 100644
index fe952b8c4..000000000
--- a/mdk-stage1/dietlibc/lib/atoi.c
+++ /dev/null
@@ -1,8 +0,0 @@
-int atoi(const char* s) {
- int v=0;
- int sign=1;
- if (*s=='-') { sign=-1; ++s; } else if (*s=='+') ++s;
- while (*s && (*s>='0') && (*s<='9'))
- v=v*10+*s++-'0';
- return v*sign;
-}
diff --git a/mdk-stage1/dietlibc/lib/atol.c b/mdk-stage1/dietlibc/lib/atol.c
deleted file mode 100644
index 558a004b9..000000000
--- a/mdk-stage1/dietlibc/lib/atol.c
+++ /dev/null
@@ -1,8 +0,0 @@
-long int atol(const char* s) {
- long int v=0;
- int sign=1;
- if (*s=='-') { sign=-1; ++s; } else if (*s=='+') ++s;
- while (*s && (*s>='0') && (*s<='9'))
- v=v*10+*s++-'0';
- return v*sign;
-}
diff --git a/mdk-stage1/dietlibc/lib/bind.c b/mdk-stage1/dietlibc/lib/bind.c
deleted file mode 100644
index ec1c93e1b..000000000
--- a/mdk-stage1/dietlibc/lib/bind.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int bind(int a, void * b, int c) {
-#ifdef __i386__
- return socketcall(SYS_BIND, (long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c };
- return socketcall(SYS_BIND, args);
-#endif
-}
diff --git a/mdk-stage1/dietlibc/lib/bsearch.c b/mdk-stage1/dietlibc/lib/bsearch.c
deleted file mode 100644
index d2f5c74b2..000000000
--- a/mdk-stage1/dietlibc/lib/bsearch.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdlib.h>
-
-void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
- const char *v, *r;
- int res;
- r=base+(nmemb-1)*size;
- do {
- register int num=nmemb/2;
- v=base+num*size;
- if ((res=compar(key,v))<0) {
- r=v-size;
- nmemb=num;
- } else {
- if (res==0) return (void*)v;
- base=v+size;
- nmemb-=num;
- }
- } while ((char*)base<=r);
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/cfmakeraw.c b/mdk-stage1/dietlibc/lib/cfmakeraw.c
deleted file mode 100644
index 7f6df9913..000000000
--- a/mdk-stage1/dietlibc/lib/cfmakeraw.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-
-void cfmakeraw(struct termios *t)
-{
- t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
- t->c_oflag &= ~OPOST;
- t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
- t->c_cflag &= ~(CSIZE|PARENB);
- t->c_cflag |= CS8;
- t->c_cc[VMIN] = 1;
- t->c_cc[VTIME] = 0;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/closedir.c b/mdk-stage1/dietlibc/lib/closedir.c
deleted file mode 100644
index e73025eb1..000000000
--- a/mdk-stage1/dietlibc/lib/closedir.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-#include <stdlib.h>
-
-int closedir (DIR* d) {
- int res=close(d->fd);
- free(d);
- return res;
-}
diff --git a/mdk-stage1/dietlibc/lib/connect.c b/mdk-stage1/dietlibc/lib/connect.c
deleted file mode 100644
index 01fd61a6c..000000000
--- a/mdk-stage1/dietlibc/lib/connect.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_connect(int a, void * b, int c) {
-#ifdef __i386__
- return socketcall(SYS_CONNECT, (long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c };
- return socketcall(SYS_CONNECT, args);
-#endif
-}
-
-int connect(int a, void * b, int c) __attribute__((weak,alias("__libc_connect")));
diff --git a/mdk-stage1/dietlibc/lib/creat.c b/mdk-stage1/dietlibc/lib/creat.c
deleted file mode 100644
index 82145b515..000000000
--- a/mdk-stage1/dietlibc/lib/creat.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <fcntl.h>
-
-int creat(const char *file,mode_t mode) {
- return open(file,O_WRONLY|O_CREAT|O_TRUNC,mode);
-}
diff --git a/mdk-stage1/dietlibc/lib/creat64.c b/mdk-stage1/dietlibc/lib/creat64.c
deleted file mode 100644
index 8cf897b57..000000000
--- a/mdk-stage1/dietlibc/lib/creat64.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <fcntl.h>
-
-#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
-
-int creat64(const char *file,mode_t mode) {
- return open(file,O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE,mode);
-}
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/errno_location.c b/mdk-stage1/dietlibc/lib/errno_location.c
deleted file mode 100644
index 286f833c9..000000000
--- a/mdk-stage1/dietlibc/lib/errno_location.c
+++ /dev/null
@@ -1,5 +0,0 @@
-extern int errno;
-
-int *__errno_location() { return &errno; }
-
-int *errno_location() __attribute__((weak,alias("__errno_location")));
diff --git a/mdk-stage1/dietlibc/lib/exec_lib.c b/mdk-stage1/dietlibc/lib/exec_lib.c
deleted file mode 100644
index 3129224a0..000000000
--- a/mdk-stage1/dietlibc/lib/exec_lib.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <unistd.h>
-#include <paths.h>
-
-extern char **environ;
-
-int __exec_shell(const char *file, char *const argv[]) {
- int i;
-
- for (i = 0; argv[i]; i++);
-
- {
- char *shell_argv[i + 1];
- shell_argv[0] = _PATH_BSHELL;
- shell_argv[1] = (char *) file;
- for (; i > 1; i--)
- shell_argv[i] = argv[i - 1];
- return execve(_PATH_BSHELL, shell_argv, environ);
- }
-}
-
diff --git a/mdk-stage1/dietlibc/lib/exec_lib.h b/mdk-stage1/dietlibc/lib/exec_lib.h
deleted file mode 100644
index 0971bd1fb..000000000
--- a/mdk-stage1/dietlibc/lib/exec_lib.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __EXEC_LIB_H
-#define __EXEC_LIB_H
-
-#include <paths.h>
-
-extern int __exec_shell(const char *file, char *const argv[]);
-
-#endif /* __EXEC_LIB_H */
-
diff --git a/mdk-stage1/dietlibc/lib/execl.c b/mdk-stage1/dietlibc/lib/execl.c
deleted file mode 100644
index 71459e71f..000000000
--- a/mdk-stage1/dietlibc/lib/execl.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-
-int execl( const char *path,...) {
- va_list ap;
- int n,i;
- char **argv,*tmp;
- va_start(ap, path);
- n=1;
- while ((tmp=va_arg(ap,char *)))
- ++n;
- va_end (ap);
- if ((argv=(char **)alloca(n*sizeof(char*)))) {
- va_start(ap, path);
- for (i=0; i<n; ++i)
- argv[i]=va_arg(ap,char *);
- va_end (ap);
- return execve(path,argv,environ);
- }
- __set_errno(ENOMEM);
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/execlp.c b/mdk-stage1/dietlibc/lib/execlp.c
deleted file mode 100644
index 3aea1e960..000000000
--- a/mdk-stage1/dietlibc/lib/execlp.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "dietstdarg.h"
-
-int execlp(const char* file, const char *arg,...) {
- va_list ap,bak;
- int n,i;
- char **argv,*tmp;
- va_start(ap, arg);
- va_copy(bak,ap);
- n=2;
- while ((tmp=va_arg(ap,char *)))
- ++n;
- va_end (ap);
- if ((argv=(char **)alloca(n*sizeof(char*)))) {
- argv[0]=arg;
- for (i=0; i<n; ++i)
- argv[i+1]=va_arg(bak,char *);
- va_end (bak);
- return execvp(file,argv);
- }
- __set_errno(ENOMEM);
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/execv.c b/mdk-stage1/dietlibc/lib/execv.c
deleted file mode 100644
index efd760253..000000000
--- a/mdk-stage1/dietlibc/lib/execv.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include "exec_lib.h"
-
-int execv(const char *file, char *const argv[]) {
- if (execve(file,argv,environ)==-1) {
- if (errno==ENOEXEC) __exec_shell(file,argv);
- }
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/execvp.c b/mdk-stage1/dietlibc/lib/execvp.c
deleted file mode 100644
index 20521d69f..000000000
--- a/mdk-stage1/dietlibc/lib/execvp.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include "exec_lib.h"
-
-int execvp(const char *file, char *const argv[]) {
- char *path=getenv("PATH");
- char *cur,*next;
- char buf[PATH_MAX];
- if (strchr((char*)file,'/')) {
- if (execve(file,argv,environ)==-1) {
- if (errno==ENOEXEC) __exec_shell(file,argv);
- return -1;
- }
- }
- if (!path) path=_PATH_DEFPATH;
- for (cur=path; cur; cur=next) {
- next=strchr(cur,':');
- if (!next)
- next=cur+strlen(cur);
- if (next==cur) {
- buf[0]='.';
- cur--;
- } else
- memmove(buf,cur,next-cur);
- buf[next-cur]='/';
- memmove(&buf[next-cur+1],file,strlen(file)+1);
- if (execve(buf,argv,environ)==-1) {
- if (errno==ENOEXEC) return __exec_shell(buf,argv);
- if ((errno!=EACCES) && (errno!=ENOENT)) return -1;
- }
- if (*next==0) break;
- next++;
- }
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/ftw.c b/mdk-stage1/dietlibc/lib/ftw.c
deleted file mode 100644
index a3c04af9a..000000000
--- a/mdk-stage1/dietlibc/lib/ftw.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <linux/stat.h>
-#include <unistd.h>
-#include <limits.h>
-#include <ftw.h>
-#include <dirent.h>
-#include <string.h>
-#include <stdlib.h>
-
-int ftw(const char *dir,int (*fn)(const char *file, const struct stat *sb, int flag), int depth) {
- char *cwd;
- int cwdlen;
- DIR *d;
- struct dirent *de;
- struct stat sb;
- if (chdir(dir)) return -1;
- cwd=alloca(PATH_MAX+1);
- if (!getcwd(cwd,PATH_MAX)) return -1;
- cwd[PATH_MAX]=0;
- cwdlen=strlen(cwd);
-/* write(1,"ftw in ",7); puts(cwd); */
- if (!(d=opendir("."))) return -1;
- while ((de=readdir(d))) {
- int res;
- int flag;
- int nlen;
- char *filename;
- if (de->d_name[0]=='.' &&
- (de->d_name[1]==0 ||
- (de->d_name[1]=='.' && de->d_name[2]==0))) continue;
- nlen=strlen(de->d_name);
- filename=alloca(nlen+cwdlen+3);
- memmove(filename,cwd,cwdlen);
- filename[cwdlen]='/';
- memmove(filename+cwdlen+1,de->d_name,nlen+1);
- if (!lstat(de->d_name,&sb)) {
- if (S_ISLNK(sb.st_mode)) flag=FTW_SL; else
- if (S_ISDIR(sb.st_mode)) flag=FTW_D; else
- flag=FTW_F;
- } else
- flag=FTW_NS;
- res=fn(filename,&sb,flag);
- if (res) return res;
- if (flag==FTW_D && depth>0) {
- res=ftw(filename,fn,depth-1);
- chdir(dir);
- if (res) return res;
- }
-/* puts(de->d_name); */
- }
- closedir(d);
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/getdomainname.c b/mdk-stage1/dietlibc/lib/getdomainname.c
deleted file mode 100644
index 2554fe4c3..000000000
--- a/mdk-stage1/dietlibc/lib/getdomainname.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#define _GNU_SOURCE
-
-#include <sys/types.h>
-#include <sys/utsname.h>
-
-int getdomainname(char *name,size_t len) {
- struct utsname u;
- int res=uname(&u);
- if (res==0) {
- int i;
- if (len>=_UTSNAME_DOMAIN_LENGTH)
- len=_UTSNAME_DOMAIN_LENGTH;
- for (i=0; i<len; i++)
- name[i]=u.domainname[i];
- }
- return res;
-}
diff --git a/mdk-stage1/dietlibc/lib/getenv.c b/mdk-stage1/dietlibc/lib/getenv.c
deleted file mode 100644
index fc37e9927..000000000
--- a/mdk-stage1/dietlibc/lib/getenv.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <string.h>
-
-extern char **environ;
-
-extern char *getenv(const char *s)
-{
- int i;
- unsigned int len;
-
- if (!environ || !s) return 0;
- len = strlen(s);
- for (i = 0;environ[i];++i)
- if ((memcmp(environ[i],s,len)==0) && (environ[i][len] == '='))
- return environ[i] + len + 1;
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/gethostname.c b/mdk-stage1/dietlibc/lib/gethostname.c
deleted file mode 100644
index ccc0fbc8e..000000000
--- a/mdk-stage1/dietlibc/lib/gethostname.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#define _GNU_SOURCE
-
-#include <sys/types.h>
-#include <sys/utsname.h>
-
-int gethostname(char *name,size_t len) {
- struct utsname u;
- int res=uname(&u);
- if (res==0) {
- int i;
- if (len>=_UTSNAME_NODENAME_LENGTH)
- len=_UTSNAME_NODENAME_LENGTH;
- for (i=0; i<len; i++)
- name[i]=u.nodename[i];
- }
- return res;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/getopt.c b/mdk-stage1/dietlibc/lib/getopt.c
deleted file mode 100644
index 93097122f..000000000
--- a/mdk-stage1/dietlibc/lib/getopt.c
+++ /dev/null
@@ -1,118 +0,0 @@
-#include "getopt.h"
-#include <string.h>
-
-/*
- * by Olaf Dreesen
- */
-
-int opterr;
-
-int optind=1;
-char *optarg;
-
-static int opt_unknown=1,opt_unknown_len;
-
-static int getopt_check(int c,char*o,int ol)
-{
- int i;
- if (c==':') return 2;
- for (i=0;i<ol;i++)
- {
- if (o[i]==c)
- {
- if (o[i+1]==':') return 1;
- return 0;
- }
- }
- return 2;
-}
-
-static void getopt_sort(char*v[],int oi)
-{
- int i;
- char *tmp, *tmp2=0;
-
- if (opt_unknown_len)
- {
- tmp=v[optind-(1+oi)];
- if (oi) tmp2=v[optind-1];
-
- for (i=opt_unknown+opt_unknown_len;i>opt_unknown;i--) v[i+oi]=v[i-1];
-
- v[opt_unknown++]=tmp;
- if (oi) v[opt_unknown++]=tmp2;
- }
-}
-
-static char* nextchar;
-int getopt(int c,char*v[],char*o)
-{
- int ol=strlen(o);
- int ret=0;
- int oi=0;
-
- optarg=0;
-
- while (nextchar || (optind<c))
- {
- if (nextchar)
- {
- if ((ret=(*(++nextchar))))
- {
- switch (getopt_check(ret,o,ol))
- {
- case 1:
- if (*(++nextchar))
- optarg=nextchar;
- else
- {
- if (optind<c)
- {
- oi=1;
- optarg=v[optind++];
- }
- else
- ret='?';
- }
- nextchar=0;
- case 0:
- if (!nextchar)
- getopt_sort(v,oi);
- else
- if (!(*(nextchar+1)))
- getopt_sort(v,oi);
- return ret;
- break;
- default:
- return '?';
- break;
- }
- }
- else
- nextchar=0;
- }
- else
- {
- if ((v[optind][0]=='-')&&((v[optind][1]!=0)))
- {
- if ((v[optind][1]=='-')&&(v[optind][2]==0))
- {
- getopt_sort(v,oi);
- optind=opt_unknown;
- return -1;
- }
- else
- {
- nextchar=v[optind];
- }
- }
- else
- {
- ++opt_unknown_len;
- }
- ++optind;
- }
- }
- optind=opt_unknown;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/getpeername.c b/mdk-stage1/dietlibc/lib/getpeername.c
deleted file mode 100644
index 8adcddf55..000000000
--- a/mdk-stage1/dietlibc/lib/getpeername.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int getpeername(int a, void * b, int c) {
-#ifdef __i386__
- return socketcall(SYS_GETPEERNAME, (long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c };
- return socketcall(SYS_GETPEERNAME, args);
-#endif
-}
-
diff --git a/mdk-stage1/dietlibc/lib/getpgrp.c b/mdk-stage1/dietlibc/lib/getpgrp.c
deleted file mode 100644
index ee2ab0257..000000000
--- a/mdk-stage1/dietlibc/lib/getpgrp.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <unistd.h>
-
-int getpgrp()
-{
- return getpgid(0);
-}
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/getsockname.c b/mdk-stage1/dietlibc/lib/getsockname.c
deleted file mode 100644
index 61a3ea24a..000000000
--- a/mdk-stage1/dietlibc/lib/getsockname.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int getsockname(int a, void * b, int c) {
-#ifdef __i386__
- return socketcall(SYS_GETSOCKNAME, (long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c };
- return socketcall(SYS_GETSOCKNAME, args);
-#endif
-}
-
diff --git a/mdk-stage1/dietlibc/lib/getsockopt.c b/mdk-stage1/dietlibc/lib/getsockopt.c
deleted file mode 100644
index 8c0a57557..000000000
--- a/mdk-stage1/dietlibc/lib/getsockopt.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int getsockopt(int a, int b, int c, void *d, int e) {
-#ifdef __i386__
- return socketcall(SYS_GETSOCKOPT, (long*)&a);
-#else
- unsigned long args[] = { a, b, c, (long)d, e };
- return socketcall(SYS_GETSOCKOPT, args);
-#endif
-}
-
diff --git a/mdk-stage1/dietlibc/lib/htonl.c b/mdk-stage1/dietlibc/lib/htonl.c
deleted file mode 100644
index 490de42c4..000000000
--- a/mdk-stage1/dietlibc/lib/htonl.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <endian.h>
-
-unsigned long int htonl(unsigned long int hostlong) {
-#if __BYTE_ORDER==__LITTLE_ENDIAN
- return (hostlong>>24) | ((hostlong&0xff0000)>>8) |
- ((hostlong&0xff00)<<8) | (hostlong<<24);
-#else
- return hostlong;
-#endif
-}
-
-unsigned long int ntohl(unsigned long int hostlong) __attribute__((weak,alias("htonl")));
diff --git a/mdk-stage1/dietlibc/lib/htons.c b/mdk-stage1/dietlibc/lib/htons.c
deleted file mode 100644
index 765d3bbc5..000000000
--- a/mdk-stage1/dietlibc/lib/htons.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <endian.h>
-
-unsigned short int htons(unsigned short int hostshort) {
-#if __BYTE_ORDER==__LITTLE_ENDIAN
- return ((hostshort>>8)&0xff) | (hostshort<<8);
-#else
- return hostshort;
-#endif
-}
-
-unsigned short int ntohs(unsigned short int hostshort) __attribute__((weak,alias("htons")));
diff --git a/mdk-stage1/dietlibc/lib/if_indextoname.c b/mdk-stage1/dietlibc/lib/if_indextoname.c
deleted file mode 100644
index e683755f6..000000000
--- a/mdk-stage1/dietlibc/lib/if_indextoname.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <linux/if.h>
-#include <linux/net.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <sys/socket.h>
-
-#ifndef SOCK_DGRAM
-#define SOCK_DGRAM 2
-#endif
-
-char* if_indextoname(unsigned int interface,char* blub) {
- struct ifreq ifr;
- int fd;
-
- fd=socket(AF_INET6,SOCK_DGRAM,0);
- if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0);
- ifr.ifr_ifindex=interface;
- if (ioctl(fd,SIOCGIFNAME,&ifr)==0) {
- int i;
- close(fd);
- for (i=0; i<IFNAMSIZ-1; i++)
- if (!(blub[i]=ifr.ifr_name[i]))
- return blub;
- blub[i]=0;
- return blub;
- }
- close(fd);
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/if_nametoindex.c b/mdk-stage1/dietlibc/lib/if_nametoindex.c
deleted file mode 100644
index 5923963b1..000000000
--- a/mdk-stage1/dietlibc/lib/if_nametoindex.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <linux/if.h>
-#include <linux/net.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <sys/socket.h>
-
-#ifndef SOCK_DGRAM
-#define SOCK_DGRAM 2
-#endif
-
-int if_nametoindex(char* blub) {
- struct ifreq ifr;
- int fd;
- char *tmp;
- int len=sizeof(ifr.ifr_name);
- fd=socket(AF_INET6,SOCK_DGRAM,0);
- if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0);
- for (tmp=ifr.ifr_name; len>0; --len) {
- if ((*tmp++=*blub++)==0) break;
- }
- if (ioctl(fd,SIOCGIFINDEX,&ifr)==0) {
- close(fd);
- return ifr.ifr_ifindex;
- }
- close(fd);
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/isalnum.c b/mdk-stage1/dietlibc/lib/isalnum.c
deleted file mode 100644
index 4d363fab9..000000000
--- a/mdk-stage1/dietlibc/lib/isalnum.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <ctype.h>
-
-int __isalnum_ascii(int c) {
- return isalpha(c) || isdigit(c);
-}
-
-int isalnum(int c) __attribute__((weak,alias("__isalnum_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isalpha.c b/mdk-stage1/dietlibc/lib/isalpha.c
deleted file mode 100644
index 07ea69696..000000000
--- a/mdk-stage1/dietlibc/lib/isalpha.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <ctype.h>
-
-int __isalpha_ascii(int c) {
- return (c>='a' && c<='z') || (c>='A' && c<='Z');
-}
-
-int isalpha(int c) __attribute__((weak,alias("__isalpha_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isascii.c b/mdk-stage1/dietlibc/lib/isascii.c
deleted file mode 100644
index e06994783..000000000
--- a/mdk-stage1/dietlibc/lib/isascii.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <ctype.h>
-
-int isascii(int c) {
- return (c & 0x80) == 0;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/isatty.c b/mdk-stage1/dietlibc/lib/isatty.c
deleted file mode 100644
index b31609720..000000000
--- a/mdk-stage1/dietlibc/lib/isatty.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#define ioctl libc_ioctl
-#include <termios.h>
-#undef ioctl
-#include <sys/ioctl.h>
-
-extern int errno;
-
-int isatty(int fd)
-{
- int save;
- int is_tty;
- struct termios term;
-
- save = errno;
- is_tty = ioctl(fd, TCGETS, &term) == 0;
- errno = save;
-
- return is_tty;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/isblank.c b/mdk-stage1/dietlibc/lib/isblank.c
deleted file mode 100644
index 034e543b1..000000000
--- a/mdk-stage1/dietlibc/lib/isblank.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <ctype.h>
-
-int isblank(int ch)
-{
- return ((ch==' ')||(ch=='\t'));
-}
diff --git a/mdk-stage1/dietlibc/lib/iscntrl.c b/mdk-stage1/dietlibc/lib/iscntrl.c
deleted file mode 100644
index a183a54f1..000000000
--- a/mdk-stage1/dietlibc/lib/iscntrl.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <ctype.h>
-
-int __iscntrl_ascii(int c) {
- return (c<32) || (c==127);
-}
-
-int iscntrl(int c) __attribute__((weak,alias("__iscntrl_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isdigit.c b/mdk-stage1/dietlibc/lib/isdigit.c
deleted file mode 100644
index 8a7c3e801..000000000
--- a/mdk-stage1/dietlibc/lib/isdigit.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <ctype.h>
-
-int __isdigit_ascii(int c) {
- return (c>='0' && c<='9');
-}
-
-int isdigit(int c) __attribute__((weak,alias("__isdigit_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isgraph.c b/mdk-stage1/dietlibc/lib/isgraph.c
deleted file mode 100644
index 807f90ff0..000000000
--- a/mdk-stage1/dietlibc/lib/isgraph.c
+++ /dev/null
@@ -1,5 +0,0 @@
-int __isgraph_ascii(int c) {
- return (c>=33 && c<=126);
-}
-
-int isgraph(int c) __attribute__((weak,alias("__isgraph_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/islower.c b/mdk-stage1/dietlibc/lib/islower.c
deleted file mode 100644
index 6a9afa519..000000000
--- a/mdk-stage1/dietlibc/lib/islower.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <ctype.h>
-
-int __islower_ascii(int c) {
- return (c>='a' && c<='z');
-}
-
-int islower(int c) __attribute__((weak,alias("__islower_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isprint.c b/mdk-stage1/dietlibc/lib/isprint.c
deleted file mode 100644
index e980658a5..000000000
--- a/mdk-stage1/dietlibc/lib/isprint.c
+++ /dev/null
@@ -1,6 +0,0 @@
-
-int __isprint_ascii(int c) {
- return (c>=32 && c<=126);
-}
-
-int isprint(int c) __attribute__((weak,alias("__isprint_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/ispunct.c b/mdk-stage1/dietlibc/lib/ispunct.c
deleted file mode 100644
index 2fd1183b1..000000000
--- a/mdk-stage1/dietlibc/lib/ispunct.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <ctype.h>
-
-int __ispunct_ascii(int c) {
- return isprint(c) && !( isalnum(c) || isspace(c) );
-}
-
-int ispunct(int c) __attribute__((weak,alias("__ispunct_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isspace.c b/mdk-stage1/dietlibc/lib/isspace.c
deleted file mode 100644
index 916f784ab..000000000
--- a/mdk-stage1/dietlibc/lib/isspace.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-int __isspace_ascii(int ch)
-{
- return ((ch==' ')||(ch=='\f')||(ch=='\t')||(ch=='\v')||(ch=='\r')||(ch=='\n'));
-}
-
-int isspace(int c) __attribute__((weak,alias("__isspace_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isupper.c b/mdk-stage1/dietlibc/lib/isupper.c
deleted file mode 100644
index 933dfc169..000000000
--- a/mdk-stage1/dietlibc/lib/isupper.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <ctype.h>
-
-int __isupper_ascii(int c) {
- return (c>='A' && c<='Z');
-}
-
-int isupper(int c) __attribute__((weak,alias("__isupper_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isxdigit.c b/mdk-stage1/dietlibc/lib/isxdigit.c
deleted file mode 100644
index 22a711f2d..000000000
--- a/mdk-stage1/dietlibc/lib/isxdigit.c
+++ /dev/null
@@ -1,5 +0,0 @@
-int __isxdigit_ascii(int c) {
- return ((c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f'));
-}
-
-int isxdigit(int c) __attribute__((weak,alias("__isxdigit_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/listen.c b/mdk-stage1/dietlibc/lib/listen.c
deleted file mode 100644
index 56a51be06..000000000
--- a/mdk-stage1/dietlibc/lib/listen.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int listen(int a, int b) {
-#ifdef __i386__
- return socketcall(SYS_LISTEN, (long*)&a);
-#else
- unsigned long args[] = { a, b, 0 };
- return socketcall(SYS_LISTEN, args);
-#endif
-}
-
diff --git a/mdk-stage1/dietlibc/lib/lockf.c b/mdk-stage1/dietlibc/lib/lockf.c
deleted file mode 100644
index 2b1d004ef..000000000
--- a/mdk-stage1/dietlibc/lib/lockf.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-int lockf(int fd, int cmd, off_t len) {
- struct flock fl;
- fl.l_whence=SEEK_CUR;
- fl.l_start=0;
- fl.l_len=len;
- fl.l_pid=0;
- switch (cmd) {
- case F_TEST:
- if (fcntl(fd,F_GETLK,&fl)<0)
- return -1;
- if (fl.l_type == F_UNLCK || fl.l_pid == getpid ())
- return 0;
- errno=EACCES;
- return -1;
- case F_ULOCK:
- fl.l_type=F_UNLCK;
- cmd=F_SETLK;
- break;
- case F_LOCK:
- fl.l_type = F_WRLCK;
- cmd = F_SETLKW;
- break;
- case F_TLOCK:
- fl.l_type = F_WRLCK;
- cmd = F_SETLK;
- break;
- default:
- errno=EINVAL;
- return -1;
- }
- return fcntl(fd,cmd,&fl);
-}
diff --git a/mdk-stage1/dietlibc/lib/longjmp.c b/mdk-stage1/dietlibc/lib/longjmp.c
deleted file mode 100644
index d0a5719c1..000000000
--- a/mdk-stage1/dietlibc/lib/longjmp.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1991, 92, 94, 95, 97, 98 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 <stddef.h> */
-#include <setjmp.h>
-#include <signal.h>
-
-extern int __sigprocmask(int how,void* set,void* oldset);
-extern void __longjmp(void* env, int val);
-
-/*
-extern void _longjmp_unwind (jmp_buf env, int val);
-*/
-/* Set the signal mask to the one specified in ENV, and jump
- to the position specified in ENV, causing the setjmp
- call there to return VAL, or 1 if VAL is 0. */
-void __siglongjmp (sigjmp_buf env, int val)
-{
- /* Perform any cleanups needed by the frames being unwound. */
- /*
- _longjmp_unwind (env, val);
- */
-
- if (env[0].__mask_was_saved)
- /* Restore the saved signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
- (sigset_t *) NULL);
-
- /* Call the machine-dependent function to restore machine state. */
- __longjmp (env[0].__jmpbuf, val ?: 1);
-}
-
-void siglongjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp")));
-void longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp")));
-void _longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp")));
-void __libc_longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp")));
diff --git a/mdk-stage1/dietlibc/lib/lseek64.c b/mdk-stage1/dietlibc/lib/lseek64.c
deleted file mode 100644
index f39e779f9..000000000
--- a/mdk-stage1/dietlibc/lib/lseek64.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "dietfeatures.h"
-
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-#include <errno.h>
-#include <unistd.h>
-
-loff_t lseek64(int fildes, loff_t offset, int whence) {
- loff_t tmp;
- if (llseek(fildes,offset>>32,offset&0xffffffff,&tmp,whence)) {
-#ifdef WANT_THREAD_SAFE
- if (*__errno_location()!=ENOSYS) return -1;
-#else
- if (errno!=ENOSYS) return -1;
-#endif
- return (loff_t)lseek(fildes,(off_t)offset,whence);
- }
- return tmp;
-}
-#endif
-#endif
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/memccpy.c b/mdk-stage1/dietlibc/lib/memccpy.c
deleted file mode 100644
index 6d6ac98ab..000000000
--- a/mdk-stage1/dietlibc/lib/memccpy.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#define _POSIX_SOURCE
-#define _XOPEN_SOURCE
-#include <sys/types.h>
-
-void *memccpy(void *dst, const void *src, int c, size_t count)
-{
- char *a = dst;
- const char *b = src;
- while (count--)
- {
- *a++ = *b;
- if (*b==c)
- {
- return (void *)a;
- }
- b++;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/memchr.c b/mdk-stage1/dietlibc/lib/memchr.c
deleted file mode 100644
index 93d81328a..000000000
--- a/mdk-stage1/dietlibc/lib/memchr.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-
-char *memchr(const char *s, int c, size_t n) {
- int i;
- for (i=n; i; --i)
- if (*s++==c)
- return (char*)s;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/memcmp.c b/mdk-stage1/dietlibc/lib/memcmp.c
deleted file mode 100644
index c05a46863..000000000
--- a/mdk-stage1/dietlibc/lib/memcmp.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <sys/types.h>
-
-int memcmp(const void *dst, const void *src, size_t count) {
- register int r;
- register const char *d=dst;
- register const char *s=src;
- while (count--) {
- if ((r=(*d - *s)))
- return r;
- ++d;
- ++s;
- }
- return 0;
-}
-
-int bcmp(const char *a,const char *b,size_t c) __attribute__((weak,alias("memcmp")));
diff --git a/mdk-stage1/dietlibc/lib/memcpy.c b/mdk-stage1/dietlibc/lib/memcpy.c
deleted file mode 100644
index 0c688b509..000000000
--- a/mdk-stage1/dietlibc/lib/memcpy.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sys/types.h>
-
-void* memcpy(void* dst, const void* src, size_t count) {
- register char *d=dst;
- register const char *s=src;
- ++count; /* this actually produces better code than using count-- */
- while (--count) {
- *d = *s;
- ++d; ++s;
- }
- return dst;
-}
diff --git a/mdk-stage1/dietlibc/lib/memmove.c b/mdk-stage1/dietlibc/lib/memmove.c
deleted file mode 100644
index 7adb2be91..000000000
--- a/mdk-stage1/dietlibc/lib/memmove.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#define _POSIX_SOURCE
-#define _XOPEN_SOURCE
-#include <sys/types.h>
-
-void *memmove(void *dst, const void *src, size_t count)
-{
- char *a = dst;
- const char *b = src;
- if (src!=dst)
- {
- if (src>dst)
- {
- while (count--) *a++ = *b++;
- }
- else
- {
- a+=count-1;
- b+=count-1;
- while (count--) *a-- = *b--;
- }
- }
- return dst;
-}
diff --git a/mdk-stage1/dietlibc/lib/memset.c b/mdk-stage1/dietlibc/lib/memset.c
deleted file mode 100644
index 5f9ae49ee..000000000
--- a/mdk-stage1/dietlibc/lib/memset.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-
-void * memset(void * dst, int s, size_t count) {
- register char * a = dst;
- count++; /* this actually creates smaller code than using count-- */
- while (--count)
- *a++ = s;
- return dst;
-}
diff --git a/mdk-stage1/dietlibc/lib/mkfifo.c b/mdk-stage1/dietlibc/lib/mkfifo.c
deleted file mode 100644
index 596efbe27..000000000
--- a/mdk-stage1/dietlibc/lib/mkfifo.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <linux/stat.h>
-#include <unistd.h>
-
-int mkfifo(const char *fn,mode_t mode) {
- return mknod(fn,S_IFIFO|mode,0);
-}
diff --git a/mdk-stage1/dietlibc/lib/msgctl.c b/mdk-stage1/dietlibc/lib/msgctl.c
deleted file mode 100644
index 19ea6d8cf..000000000
--- a/mdk-stage1/dietlibc/lib/msgctl.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int msgctl(int msqid, int cmd, struct msqid_ds *buf) {
- return __ipc(MSGCTL,msqid,cmd,0,buf);
-}
diff --git a/mdk-stage1/dietlibc/lib/msgget.c b/mdk-stage1/dietlibc/lib/msgget.c
deleted file mode 100644
index 9bca09ebe..000000000
--- a/mdk-stage1/dietlibc/lib/msgget.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int msgget(key_t key,int flag) {
- return __ipc(MSGGET,key,flag,0,0);
-}
diff --git a/mdk-stage1/dietlibc/lib/msgrcv.c b/mdk-stage1/dietlibc/lib/msgrcv.c
deleted file mode 100644
index b4ae9cc6c..000000000
--- a/mdk-stage1/dietlibc/lib/msgrcv.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int msgrcv(int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) {
- struct ipc_kludge tmp;
- tmp.msgp = msgp;
- tmp.msgtyp = msgtyp;
- return __ipc(MSGRCV,msqid, msgsz, msgflg, &tmp);
-}
diff --git a/mdk-stage1/dietlibc/lib/msgsnd.c b/mdk-stage1/dietlibc/lib/msgsnd.c
deleted file mode 100644
index 6203053f0..000000000
--- a/mdk-stage1/dietlibc/lib/msgsnd.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) {
- return __ipc(MSGSND,msqid, msgsz, msgflg, msgp);
-}
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/open64.c b/mdk-stage1/dietlibc/lib/open64.c
deleted file mode 100644
index f1499d017..000000000
--- a/mdk-stage1/dietlibc/lib/open64.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <linux/types.h>
-#include <linux/fcntl.h>
-
-#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
-
-extern int open(const char* file,int oflag,int mode);
-
-int __libc_open64(const char* file,int oflag,int mode) {
- return open(file,oflag|O_LARGEFILE,mode);
-}
-
-int open64(const char* file,int oflag,int mode) __attribute__((weak,alias("__libc_open64")));
diff --git a/mdk-stage1/dietlibc/lib/opendir.c b/mdk-stage1/dietlibc/lib/opendir.c
deleted file mode 100644
index 5c0c4a305..000000000
--- a/mdk-stage1/dietlibc/lib/opendir.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <fcntl.h>
-
-DIR *opendir (const char *name) {
- DIR *t=(DIR*)malloc(sizeof(DIR));
- if (t) {
- if ((t->fd=open(name,O_RDONLY|O_DIRECTORY))>=0) {
- t->num=t->cur=0;
- } else {
- free(t);
- t=0;
- }
- }
- return t;
-}
diff --git a/mdk-stage1/dietlibc/lib/perror.c b/mdk-stage1/dietlibc/lib/perror.c
deleted file mode 100644
index ecab7250b..000000000
--- a/mdk-stage1/dietlibc/lib/perror.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "dietfeatures.h"
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-extern char *sys_errlist[];
-extern int sys_nerr;
-extern int errno;
-
-void perror(const char *s) {
- register char *message="[unknown error]";
- write(2,s,strlen(s));
- write(2,": ",2);
- if (errno>=0 && errno<sys_nerr)
-#ifdef WANT_THREAD_SAFE
- message=sys_errlist[*__errno_location()];
-#else
- message=sys_errlist[errno];
-#endif
- write(2,message,strlen(message));
- write(2,"\n",1);
-}
diff --git a/mdk-stage1/dietlibc/lib/pread.c b/mdk-stage1/dietlibc/lib/pread.c
deleted file mode 100644
index b922aa93e..000000000
--- a/mdk-stage1/dietlibc/lib/pread.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <endian.h>
-#include <sys/types.h>
-
-extern size_t __pread(int fd, void *buf, size_t count, off_t a,off_t b);
-
-size_t __libc_pread(int fd, void *buf, size_t count, off_t offset) {
- return __pread(fd,buf,count,offset,0);
-}
-
-int pread(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pread")));
diff --git a/mdk-stage1/dietlibc/lib/pread64.c b/mdk-stage1/dietlibc/lib/pread64.c
deleted file mode 100644
index e6ba4d103..000000000
--- a/mdk-stage1/dietlibc/lib/pread64.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <endian.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef __NO_STAT64
-extern size_t __pread(int fd, void *buf, size_t count, off_t a,off_t b);
-
-size_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) {
- return __pread(fd,buf,count,__LONG_LONG_PAIR (offset&0xffffffff,offset>>32));
-}
-
-int pread64(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pread64")));
-#endif
diff --git a/mdk-stage1/dietlibc/lib/putenv.c b/mdk-stage1/dietlibc/lib/putenv.c
deleted file mode 100644
index 274b16b0e..000000000
--- a/mdk-stage1/dietlibc/lib/putenv.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-int putenv(const char *string) {
- int len;
- int envc;
- char *tmp;
- const char **ep;
- char **newenv;
- static char **origenv=0;
- if (!origenv) origenv=environ;
- if (!(tmp=strchr(string,'=')))
- len=strlen(string);
- else
- len=tmp-string+1;
- for (envc=0, ep=(const char**)environ; *ep; ++ep) {
- if (!memcmp(string,*ep,len)) { /* found */
- if (!tmp) {
- for (; ep[1]; ++ep) ep[0]=ep[1];
- ep[0]=0;
- return 0;
- }
- *ep=string;
- return 0;
- }
- ++envc;
- }
- if (tmp) {
- newenv=(char**)malloc((envc+2)*sizeof(char*));
- if (!newenv) return -1;
- newenv[0]=(char*)string;
- memcpy(newenv+1,environ,(envc+1)*sizeof(char*));
- if (environ!=origenv) free(environ);
- environ=newenv;
- }
- 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/qsort.c b/mdk-stage1/dietlibc/lib/qsort.c
deleted file mode 100644
index 2a8824bf3..000000000
--- a/mdk-stage1/dietlibc/lib/qsort.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <stdlib.h>
-#include <assert.h>
-
-/* comments:
- 1. insertion sort sofort, nicht nachträglich
- 2. threshold = 16
- */
-
-static inline void iswap(void *a,void *b,size_t size) {
- register char *x=a;
- register char *y=b;
- register char *z=x+size;
- while (x<z) {
- register char tmp=*x;
- *x=*y;
- *y=tmp;
- ++x; ++y;
- }
-}
-
-static inline void swap(void *base,size_t size,size_t a,size_t b) {
- iswap(base+a*size,base+b*size,size);
-}
-
-#if 0
-extern int array[];
-
-void dumparray() {
- printf("array now {%d,%d,%d,%d,%d}\n",array[0],array[1],array[2],array[3],array[4]);
-}
-#endif
-
-void isort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
- int i;
- while (nmemb>1) {
- char *min=base;
- char *tmp=min+size;
- for (i=1; i<nmemb; ++i) {
- if (compar(tmp,min)<0)
- min=tmp;
- tmp+=size;
- }
- iswap(min,base,size);
- base+=size;
- nmemb-=1;
- }
-}
-
-void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
-#ifdef DEBUG
- char *dbase=base;
- char *dmax=base+(nmemb-1)*size;
- char dmemb=nmemb;
-#endif
- static int level=0;
- char* v; /* pivot */
- char* mid, *max, *min;
- int lmemb;
-
-#if 0
- int left,right;
- left=(int*)base-array;
- right=left+nmemb-1;
- ++level;
- { int i; for (i=0; i<level; ++i) printf(" "); }
- printf("qsort: level %d; base=%p, %dx%d; array[%d..%d]\n",level,base,nmemb,size,left,right);
- assert(left>=0 && right<=1000);
-#endif
- if (nmemb<=8) {
- --level;
- return isort(base,nmemb,size,compar);
- }
- {
- mid=base+(nmemb/2)*size;
- max=base+(nmemb-1)*size;
-
- if (compar(base,max)<0) /* a[left] < a[right] */
- if (compar(base,mid)<0) /* a[left] < a[med] */
- if (compar(max,mid)<0) /* a[left] < a[right] < a[med] */
- v=max;
- else /* a[left] < a[med] < a[right] */
- v=mid;
- else /* a[med] < a[left] < a[right] */
- v=base;
- else /* a[right] < a[left] */
- if (compar(base,mid)<0) /* a[right] < a[left] < a[med] */
- v=base;
- else /* a[right] < a[left] && a[med] < a[left] */
- if (compar(max,mid)<0) /* a[right] < a[med] < a[left] */
- v=mid;
- else
- v=max;
-// printf("%d %d %d -> median %d\n",*(int*)base,*(int*)mid,*(int*)max,*(int*)v);
- }
- if (v != max)
- iswap(v,max,size);
- v=max;
- min=base; lmemb=0;
- for (;;) {
- while (compar(min,v)<0) { min+=size; ++lmemb; }
- while (compar(max-=size,v)>0) ;
- if (min>=max) break;
- iswap(min,max,size);
- }
- iswap(min,v,size);
-#ifdef DEBUG
-// { int i; for (i=0; i<level; ++i) printf(" "); }
-// printf("-=< base=%p, min=%p, nmemb=%d, lmemb=%d (%d)\n",base,min,nmemb,lmemb,(min-(char*)base)/size);
- assert(lmemb==((min-(char*)base)/size));
-#endif
- if (min>(char*)base+size) {
-#ifdef DEBUG
- assert(base==dbase);
-#endif
-// { int i; for (i=0; i<level; ++i) printf(" "); }
-// printf("+-left %d [%d..%d] of [%d..%d]\n",level+1,left,left+lmemb,left,right);
- qsort(base,lmemb,size,compar);
- }
- if (nmemb>lmemb+1) {
-// { int i; for (i=0; i<level; ++i) printf(" "); }
-// printf("+-right %d [%d..%d] of [%d..%d]\n",level+1,left+lmemb,right,left,right);
- qsort(min+size,nmemb-lmemb-1,size,compar);
- }
- --level;
-}
diff --git a/mdk-stage1/dietlibc/lib/raise.c b/mdk-stage1/dietlibc/lib/raise.c
deleted file mode 100644
index 606546034..000000000
--- a/mdk-stage1/dietlibc/lib/raise.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <linux/types.h>
-#include <unistd.h>
-#include <signal.h>
-#include "syscalls.h"
-
-int raise(int sig) {
- return kill(getpid(),sig);
-}
diff --git a/mdk-stage1/dietlibc/lib/rand.c b/mdk-stage1/dietlibc/lib/rand.c
deleted file mode 100644
index 10bfaf94d..000000000
--- a/mdk-stage1/dietlibc/lib/rand.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <stdlib.h>
-
-static unsigned int seed=1;
-
-int rand() {
- return ((seed = seed * 1103515245 + 12345) % ((unsigned int)RAND_MAX + 1));
-}
-
-void srand(unsigned int i) { seed=i; }
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/readdir.c b/mdk-stage1/dietlibc/lib/readdir.c
deleted file mode 100644
index 689f5d08b..000000000
--- a/mdk-stage1/dietlibc/lib/readdir.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-#include <stdlib.h>
-
-struct dirent* readdir(DIR *d) {
- if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) {
- int res=getdents(d->fd,(struct dirent*)d->buf,1023);
- if (res<=0) return 0;
- d->num=res; d->cur=0;
- }
- return (struct dirent*)(d->buf+d->cur);
-}
diff --git a/mdk-stage1/dietlibc/lib/reboot.c b/mdk-stage1/dietlibc/lib/reboot.c
deleted file mode 100644
index 7f47a95dd..000000000
--- a/mdk-stage1/dietlibc/lib/reboot.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <sys/reboot.h>
-
-int __reboot(int magic1, int magic2, int cmd, void * arg);
-
-int reboot(int cmd, void *arg)
-{
- return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, arg);
-}
diff --git a/mdk-stage1/dietlibc/lib/recv.c b/mdk-stage1/dietlibc/lib/recv.c
deleted file mode 100644
index bc6b1e5d7..000000000
--- a/mdk-stage1/dietlibc/lib/recv.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_recv(int a, const void * b, size_t c, int flags) {
-#ifdef __i386__
- return socketcall(SYS_RECV,(long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c, flags };
- return socketcall(SYS_RECV, args);
-#endif
-}
-
-int recv(int a, const void * b, size_t c, int flags)
- __attribute__ ((weak, alias("__libc_recv")));
diff --git a/mdk-stage1/dietlibc/lib/recvfrom.c b/mdk-stage1/dietlibc/lib/recvfrom.c
deleted file mode 100644
index 802ad665f..000000000
--- a/mdk-stage1/dietlibc/lib/recvfrom.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) {
-#ifdef __i386__
- return socketcall(SYS_RECVFROM, (long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c, flags, (long) to, (long) tolen };
- return socketcall(SYS_RECVFROM, args);
-#endif
-}
-
-int recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen)
- __attribute__ ((weak,alias("__libc_recvfrom"))) ;
diff --git a/mdk-stage1/dietlibc/lib/recvmsg.c b/mdk-stage1/dietlibc/lib/recvmsg.c
deleted file mode 100644
index c14c58c78..000000000
--- a/mdk-stage1/dietlibc/lib/recvmsg.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_recvmsg(int a, struct msghdr* msg, int flags) {
-#ifdef __i386__
- return socketcall(SYS_RECVMSG, (long*)&a);
-#else
- unsigned long args[] = { a, (long) msg, flags };
- return socketcall(SYS_RECVMSG, args);
-#endif
-}
-
-int recvmsg(int a, struct msghdr *msg, int flags)
- __attribute__ ((weak,alias("__libc_recvmsg"))) ;
diff --git a/mdk-stage1/dietlibc/lib/remove.c b/mdk-stage1/dietlibc/lib/remove.c
deleted file mode 100644
index d5125bfed..000000000
--- a/mdk-stage1/dietlibc/lib/remove.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-int remove(const char* filename) {
- if (unlink(filename)) {
- if (errno==EISDIR)
- return rmdir(filename);
- return -1;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/rewind.c b/mdk-stage1/dietlibc/lib/rewind.c
deleted file mode 100644
index 48434a316..000000000
--- a/mdk-stage1/dietlibc/lib/rewind.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <dietstdio.h>
-#include <unistd.h>
-
-void rewind( FILE *stream) {
- fseek(stream, 0L, SEEK_SET);
-}
diff --git a/mdk-stage1/dietlibc/lib/rewinddir.c b/mdk-stage1/dietlibc/lib/rewinddir.c
deleted file mode 100644
index addc7bde9..000000000
--- a/mdk-stage1/dietlibc/lib/rewinddir.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-
-void rewinddir(DIR *d) {
- if (lseek(d->fd,0,SEEK_SET) != (off_t)-1)
- d->num=d->cur=0;
-}
diff --git a/mdk-stage1/dietlibc/lib/sbrk.c b/mdk-stage1/dietlibc/lib/sbrk.c
deleted file mode 100644
index 945ad5a16..000000000
--- a/mdk-stage1/dietlibc/lib/sbrk.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <unistd.h>
-
-extern int __brk(void *end_data_segment);
-
-extern void* __curbrk;
-
-void* __sbrk(ptrdiff_t increment) {
- void* oldbrk;
- if (__curbrk==0)
- if (__brk(0) < 0)
- return (void*)-1;
- if (increment==0)
- return __curbrk;
- oldbrk=__curbrk;
- if (__brk(oldbrk+increment)<0)
- return (void*)-1;
- return oldbrk;
-}
-
-void* sbrk (ptrdiff_t increment) __attribute__((weak,alias("__sbrk")));
diff --git a/mdk-stage1/dietlibc/lib/seekdir.c b/mdk-stage1/dietlibc/lib/seekdir.c
deleted file mode 100644
index cf111fbc8..000000000
--- a/mdk-stage1/dietlibc/lib/seekdir.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-
-void seekdir(DIR *d,off_t offset) {
- if (lseek(d->fd,offset,SEEK_SET) != (off_t)-1)
- d->num=d->cur=0;
-}
diff --git a/mdk-stage1/dietlibc/lib/semctl.c b/mdk-stage1/dietlibc/lib/semctl.c
deleted file mode 100644
index ddc0aae95..000000000
--- a/mdk-stage1/dietlibc/lib/semctl.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int semctl(int semid, int semnum, int cmd, union semun arg) {
- return __ipc(SEMCTL,semid,semnum,cmd,&arg);
-}
diff --git a/mdk-stage1/dietlibc/lib/semget.c b/mdk-stage1/dietlibc/lib/semget.c
deleted file mode 100644
index 056aeae04..000000000
--- a/mdk-stage1/dietlibc/lib/semget.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int semget(key_t key, int nsems, int semflg) {
- return __ipc(SEMGET,key,nsems,semflg,0);
-}
diff --git a/mdk-stage1/dietlibc/lib/semop.c b/mdk-stage1/dietlibc/lib/semop.c
deleted file mode 100644
index abfde73a7..000000000
--- a/mdk-stage1/dietlibc/lib/semop.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int semop(int semid,struct sembuf *sops,unsigned nsops) {
- return __ipc(SEMOP,semid,nsops,0,sops);
-}
diff --git a/mdk-stage1/dietlibc/lib/send.c b/mdk-stage1/dietlibc/lib/send.c
deleted file mode 100644
index c1adf1b5d..000000000
--- a/mdk-stage1/dietlibc/lib/send.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_send(int a, const void * b, size_t c, int flags) {
-#ifdef __i386__
- return socketcall(SYS_SEND, (long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c, flags };
- return socketcall(SYS_SEND, args);
-#endif
-}
-
-int send(int a, const void * b, size_t c, int flags)
- __attribute__ ((weak, alias("__libc_send")));
diff --git a/mdk-stage1/dietlibc/lib/sendmsg.c b/mdk-stage1/dietlibc/lib/sendmsg.c
deleted file mode 100644
index 277265985..000000000
--- a/mdk-stage1/dietlibc/lib/sendmsg.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_sendmsg(int a, const struct msghdr* msg, int flags) {
-#ifdef __i386__
- return socketcall(SYS_SENDMSG, (long*)&a);
-#else
- unsigned long args[] = { a, (long) msg, flags };
- return socketcall(SYS_SENDMSG, args);
-#endif
-}
-
-int sendmsg(int a, const struct msghdr *msg, int flags)
- __attribute__ ((weak,alias("__libc_sendmsg"))) ;
diff --git a/mdk-stage1/dietlibc/lib/sendto.c b/mdk-stage1/dietlibc/lib/sendto.c
deleted file mode 100644
index 078c010ea..000000000
--- a/mdk-stage1/dietlibc/lib/sendto.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_sendto(int a, const void * b, size_t c, int flags, void *to, int tolen) {
-#ifdef __i386__
- return socketcall(SYS_SENDTO, (long*)&a);
-#else
- unsigned long args[] = { a, (long) b, c, flags, (long) to, tolen };
- return socketcall(SYS_SENDTO, args);
-#endif
-}
-
-int sendto(int a, const void * b, size_t c, int flags, void *to, int tolen)
- __attribute__ ((weak, alias("__libc_sendto")));
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/setpgrp.c b/mdk-stage1/dietlibc/lib/setpgrp.c
deleted file mode 100644
index 825ca3725..000000000
--- a/mdk-stage1/dietlibc/lib/setpgrp.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <unistd.h>
-
-int setpgrp()
-{
- return setpgid(0,0);
-}
diff --git a/mdk-stage1/dietlibc/lib/setsockopt.c b/mdk-stage1/dietlibc/lib/setsockopt.c
deleted file mode 100644
index 781e9c31c..000000000
--- a/mdk-stage1/dietlibc/lib/setsockopt.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int setsockopt(int a, int b, int c, void *d, void *e) {
-#ifdef __i386__
- return socketcall(SYS_SETSOCKOPT, (long*)&a);
-#else
- unsigned long args[] = { a, b, c, (long)d, (long) e };
- return socketcall(SYS_SETSOCKOPT, args);
-#endif
-}
-
diff --git a/mdk-stage1/dietlibc/lib/shmat.c b/mdk-stage1/dietlibc/lib/shmat.c
deleted file mode 100644
index 63284b1ea..000000000
--- a/mdk-stage1/dietlibc/lib/shmat.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <asm/ipc.h>
-
-extern void* __ipc();
-
-void* shmat(int shmid,const void* shmaddr,int shmflg) {
- void* raddr;
- register void* result;
- result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr);
- if ((unsigned long)result <= -(unsigned long)SHMLBA)
- result=raddr;
- return result;
-}
diff --git a/mdk-stage1/dietlibc/lib/shmctl.c b/mdk-stage1/dietlibc/lib/shmctl.c
deleted file mode 100644
index 8f942f2a4..000000000
--- a/mdk-stage1/dietlibc/lib/shmctl.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int shmctl(int shmid, int cmd, struct shmid_ds *buf) {
- return __ipc(SHMCTL,shmid,cmd,0,buf);
-}
diff --git a/mdk-stage1/dietlibc/lib/shmdt.c b/mdk-stage1/dietlibc/lib/shmdt.c
deleted file mode 100644
index 36db10f08..000000000
--- a/mdk-stage1/dietlibc/lib/shmdt.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int shmdt(const void* shmaddr) {
- return __ipc(SHMDT,0,0,0,shmaddr);
-}
diff --git a/mdk-stage1/dietlibc/lib/shmget.c b/mdk-stage1/dietlibc/lib/shmget.c
deleted file mode 100644
index 9b03f5deb..000000000
--- a/mdk-stage1/dietlibc/lib/shmget.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <asm/ipc.h>
-
-extern int __ipc();
-
-int shmget(key_t key, int size, int shmflg) {
- return __ipc(SHMGET,key,size,shmflg,0);
-}
diff --git a/mdk-stage1/dietlibc/lib/shutdown.c b/mdk-stage1/dietlibc/lib/shutdown.c
deleted file mode 100644
index 0a6be6c37..000000000
--- a/mdk-stage1/dietlibc/lib/shutdown.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_shutdown(int s, int how) {
-#ifdef __i386__
- return socketcall(SYS_SHUTDOWN, (long*)&s);
-#else
- unsigned long args[] = { s, (long) how, 0 };
- return socketcall(SYS_SHUTDOWN, args);
-#endif
-}
-
-int shutdown(int s, int how) __attribute__((weak,alias("__libc_shutdown")));
diff --git a/mdk-stage1/dietlibc/lib/sigaddset.c b/mdk-stage1/dietlibc/lib/sigaddset.c
deleted file mode 100644
index 8ce69ea77..000000000
--- a/mdk-stage1/dietlibc/lib/sigaddset.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#define __KERNEL__
-#define sigaddset foobar
-#include <asm/signal.h>
-#undef sigaddset
-
-int __sigaddset(sigset_t *set, int signo) {
- unsigned long sig = signo - 1;
- if (_NSIG_WORDS == 1)
- set->sig[0] |= 1UL << sig;
- else
- set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW);
- return 0;
-}
-
-int sigaddset (sigset_t *env, int signo) __attribute__((weak,alias("__sigaddset")));
diff --git a/mdk-stage1/dietlibc/lib/sigdelset.c b/mdk-stage1/dietlibc/lib/sigdelset.c
deleted file mode 100644
index 2c3385ea8..000000000
--- a/mdk-stage1/dietlibc/lib/sigdelset.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#define __KERNEL__
-#define sigdelset foobar
-#include <asm/signal.h>
-#undef sigdelset
-
-int __sigdelset(sigset_t *set, int signo) {
- unsigned long sig = signo - 1;
- if (_NSIG_WORDS == 1)
- set->sig[0] &= ~(1UL << sig);
- else
- set->sig[sig / _NSIG_BPW] &= ~(1UL << (sig % _NSIG_BPW));
- return 0;
-}
-
-int sigdelset (sigset_t *env, int signo) __attribute__((weak,alias("__sigdelset")));
diff --git a/mdk-stage1/dietlibc/lib/sigemptyset.c b/mdk-stage1/dietlibc/lib/sigemptyset.c
deleted file mode 100644
index f4532f96e..000000000
--- a/mdk-stage1/dietlibc/lib/sigemptyset.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#define __USE_EXTERN_INLINES 1
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-
-int sigemptyset(sigset_t *set) {
- if (set==NULL) {
- __set_errno(EINVAL);
- return -1;
- }
- memset(set,0,sizeof(*set));
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/sigfillset.c b/mdk-stage1/dietlibc/lib/sigfillset.c
deleted file mode 100644
index ddac6e391..000000000
--- a/mdk-stage1/dietlibc/lib/sigfillset.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#define __KERNEL__
-#include <asm/signal.h>
-
-int __sigfillset (sigset_t *set) {
- int i;
- for (i=0; i<_NSIG_WORDS; i++)
- set->sig[i]=~0;
- return 0;
-}
-
-int sigfillset(sigset_t *env) __attribute__((weak,alias("__sigfillset")));
diff --git a/mdk-stage1/dietlibc/lib/sigismember.c b/mdk-stage1/dietlibc/lib/sigismember.c
deleted file mode 100644
index 67a258884..000000000
--- a/mdk-stage1/dietlibc/lib/sigismember.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#define __USE_EXTERN_INLINES 1
-#include <signal.h>
-
-# define __sigmask(sig) \
- (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
-
-# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int)))
-
-# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
-typedef struct
- {
- unsigned long int __val[_SIGSET_NWORDS];
- } __sigset_t;
-
-int __sigismember(const __sigset_t *set, int signo) {
- unsigned long int __mask = __sigmask (signo);
- unsigned long int __word = __sigword (signo);
- return (set->__val[__word] & __mask);
-}
-
-int sigismember(const sigset_t *env, int signo) __attribute__((weak,alias("__sigismember")));
diff --git a/mdk-stage1/dietlibc/lib/sigjmp.c b/mdk-stage1/dietlibc/lib/sigjmp.c
deleted file mode 100644
index be97c62cc..000000000
--- a/mdk-stage1/dietlibc/lib/sigjmp.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 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 <setjmp.h>
-#include <signal.h>
-#include <string.h>
-
-/* This function is called by the `sigsetjmp' macro
- before doing a `__setjmp' on ENV[0].__jmpbuf.
- Always return zero. */
-
-int
-__sigjmp_save (sigjmp_buf env, int savemask)
-{
- env[0].__mask_was_saved = (savemask &&
- sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
- (sigset_t*)&env[0].__saved_mask) == 0);
-
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/sleep.c b/mdk-stage1/dietlibc/lib/sleep.c
deleted file mode 100644
index ec5b99533..000000000
--- a/mdk-stage1/dietlibc/lib/sleep.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <linux/time.h>
-#include <time.h>
-
-unsigned int sleep(unsigned int secs) {
- struct timespec t;
- t.tv_sec=secs;
- t.tv_nsec=0;
- nanosleep(&t,&t);
- return secs-t.tv_sec;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/snprintf.c b/mdk-stage1/dietlibc/lib/snprintf.c
deleted file mode 100644
index 096c06115..000000000
--- a/mdk-stage1/dietlibc/lib/snprintf.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <sys/types.h>
-
-int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
-
-int snprintf(char *str,size_t size,const char *format,...)
-{
- int n;
- va_list arg_ptr;
- va_start(arg_ptr, format);
- n=vsnprintf(str,size,format,arg_ptr);
- va_end (arg_ptr);
- return n;
-}
diff --git a/mdk-stage1/dietlibc/lib/socket.c b/mdk-stage1/dietlibc/lib/socket.c
deleted file mode 100644
index 1684a6a2b..000000000
--- a/mdk-stage1/dietlibc/lib/socket.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linux/net.h>
-
-extern int socketcall(int callno,long* args);
-
-int socket(int a, int b, int c) {
-#ifdef __i386__
- return socketcall(SYS_SOCKET, (long*)&a);
-#else
- unsigned long args[] = { a, b, c };
- return socketcall(SYS_SOCKET, args);
-#endif
-}
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/sprintf.c b/mdk-stage1/dietlibc/lib/sprintf.c
deleted file mode 100644
index b355d01f9..000000000
--- a/mdk-stage1/dietlibc/lib/sprintf.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdarg.h>
-#include <linux/types.h>
-#include <stdlib.h>
-#include "dietwarning.h"
-
-int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
-
-int sprintf(char *dest,const char *format,...)
-{
- int n;
- va_list arg_ptr;
- va_start(arg_ptr, format);
- n=vsnprintf(dest,1000000,format,arg_ptr);
- va_end (arg_ptr);
- return n;
-}
-
-link_warning("sprintf","warning: Avoid sprintf; use snprintf. It is more secure and faster.")
diff --git a/mdk-stage1/dietlibc/lib/sscanf.c b/mdk-stage1/dietlibc/lib/sscanf.c
deleted file mode 100644
index 341e74bba..000000000
--- a/mdk-stage1/dietlibc/lib/sscanf.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-
-int vsscanf(const char *str, const char *format, va_list arg_ptr);
-
-int sscanf(const char *str, const char *format, ...)
-{
- int n;
- va_list arg_ptr;
- va_start(arg_ptr, format);
- n=vsscanf(str,format,arg_ptr);
- va_end (arg_ptr);
- return n;
-}
diff --git a/mdk-stage1/dietlibc/lib/strcasecmp.c b/mdk-stage1/dietlibc/lib/strcasecmp.c
deleted file mode 100644
index d978488a4..000000000
--- a/mdk-stage1/dietlibc/lib/strcasecmp.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <ctype.h>
-#include "dietfeatures.h"
-
-int strcasecmp(register const char *s,register const char *t) {
- register char x;
-
- for (;;) {
- x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t;
- x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t;
- x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t;
-#endif
- }
- return ((int)(unsigned int)(unsigned char) x)
- - ((int)(unsigned int)(unsigned char) *t);
-}
diff --git a/mdk-stage1/dietlibc/lib/strcat.c b/mdk-stage1/dietlibc/lib/strcat.c
deleted file mode 100644
index 8a755afea..000000000
--- a/mdk-stage1/dietlibc/lib/strcat.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "dietfeatures.h"
-#include <string.h>
-
-char* strcat(register char* s,register const char* t)
-{
- char *dest=s;
- s+=strlen(s);
- for (;;) {
- if (!(*s = *t)) break; ++s; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- if (!(*s = *t)) break; ++s; ++t;
- if (!(*s = *t)) break; ++s; ++t;
- if (!(*s = *t)) break; ++s; ++t;
-#endif
- }
- return dest;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/strchr.c b/mdk-stage1/dietlibc/lib/strchr.c
deleted file mode 100644
index 0c2050da6..000000000
--- a/mdk-stage1/dietlibc/lib/strchr.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "dietfeatures.h"
-
-char *strchr(register const char *t, int c) {
- register char ch;
-
- ch = c;
- for (;;) {
- if (*t == ch) break; if (!*t) return 0; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- if (*t == ch) break; if (!*t) return 0; ++t;
- if (*t == ch) break; if (!*t) return 0; ++t;
- if (*t == ch) break; if (!*t) return 0; ++t;
-#endif
- }
- return (char*)t;
-}
-
-char *index(char *t,int c) __attribute__((weak,alias("strchr")));
diff --git a/mdk-stage1/dietlibc/lib/strcmp.c b/mdk-stage1/dietlibc/lib/strcmp.c
deleted file mode 100644
index 0db324e66..000000000
--- a/mdk-stage1/dietlibc/lib/strcmp.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "dietfeatures.h"
-
-int strcmp(register const char *s,register const char *t) {
- register char x;
-
- for (;;) {
- x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
- x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
- x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
-#endif
- }
- return ((int)(unsigned int)(unsigned char) x)
- - ((int)(unsigned int)(unsigned char) *t);
-}
diff --git a/mdk-stage1/dietlibc/lib/strcpy.c b/mdk-stage1/dietlibc/lib/strcpy.c
deleted file mode 100644
index 49693c30d..000000000
--- a/mdk-stage1/dietlibc/lib/strcpy.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "dietfeatures.h"
-
-char* strcpy(register char* s,register const char* t)
-{
- char *dest=s;
- for (;;) {
- if (!(*s = *t)) return dest; ++s; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- if (!(*s = *t)) return dest; ++s; ++t;
- if (!(*s = *t)) return dest; ++s; ++t;
- if (!(*s = *t)) return dest; ++s; ++t;
-#endif
- }
-}
-
diff --git a/mdk-stage1/dietlibc/lib/strcspn.c b/mdk-stage1/dietlibc/lib/strcspn.c
deleted file mode 100644
index 37053c72c..000000000
--- a/mdk-stage1/dietlibc/lib/strcspn.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-size_t strcspn(const char *s, const char *reject)
-{
- size_t l=0;
- int a=1,i,al=strlen(reject);
-
- while((a)&&(*s))
- {
- for(i=0;(a)&&(i<al);i++)
- if (*s==reject[i]) a=0;
- if (a) l++;
- s++;
- }
- return l;
-}
diff --git a/mdk-stage1/dietlibc/lib/strdup.c b/mdk-stage1/dietlibc/lib/strdup.c
deleted file mode 100644
index 6a2ea5f95..000000000
--- a/mdk-stage1/dietlibc/lib/strdup.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-
-char *strdup(const char *s) {
- char *tmp=(char *)malloc(strlen(s)+1);
- if (!tmp) return 0;
- strcpy(tmp,s);
- return tmp;
-}
diff --git a/mdk-stage1/dietlibc/lib/strerror.c b/mdk-stage1/dietlibc/lib/strerror.c
deleted file mode 100644
index f15b86aae..000000000
--- a/mdk-stage1/dietlibc/lib/strerror.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <string.h>
-
-extern char *sys_errlist[];
-extern int sys_nerr;
-
-char *strerror(int errnum) {
- if (errnum>=0 && errnum<sys_nerr)
- return sys_errlist[errnum];
- return "[unknown error]";
-}
diff --git a/mdk-stage1/dietlibc/lib/strlcat.c b/mdk-stage1/dietlibc/lib/strlcat.c
deleted file mode 100644
index fd35ec8af..000000000
--- a/mdk-stage1/dietlibc/lib/strlcat.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(initial dst) + strlen(src); if retval >= siz,
- * truncation occurred.
- */
-size_t strlcat(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (*d != '\0' && n-- != 0)
- d++;
- dlen = d - dst;
- n = siz - dlen;
-
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
diff --git a/mdk-stage1/dietlibc/lib/strlcpy.3 b/mdk-stage1/dietlibc/lib/strlcpy.3
deleted file mode 100644
index e00af8d6b..000000000
--- a/mdk-stage1/dietlibc/lib/strlcpy.3
+++ /dev/null
@@ -1,169 +0,0 @@
-.\" $OpenBSD: strlcpy.3,v 1.10 2000/11/06 01:03:25 aaron Exp $
-.\"
-.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd June 22, 1998
-.Dt STRLCPY 3
-.Os
-.Sh NAME
-.Nm strlcpy ,
-.Nm strlcat
-.Nd size-bounded string copying and concatenation
-.Sh SYNOPSIS
-.Fd #include <string.h>
-.Ft size_t
-.Fn strlcpy "char *dst" "const char *src" "size_t size"
-.Ft size_t
-.Fn strlcat "char *dst" "const char *src" "size_t size"
-.Sh DESCRIPTION
-The
-.Fn strlcpy
-and
-.Fn strlcat
-functions copy and concatenate strings respectively.
-They are designed
-to be safer, more consistent, and less error prone replacements for
-.Xr strncpy 3
-and
-.Xr strncat 3 .
-Unlike those functions,
-.Fn strlcpy
-and
-.Fn strlcat
-take the full size of the buffer (not just the length) and guarantee to
-NUL-terminate the result (as long as
-.Fa size
-is larger than 0 or, in the case of
-.Fn strlcat ,
-as long as there is at least one byte free in
-.Fa dst ) .
-Note that you should include a byte for the NUL in
-.Fa size .
-Also note that
-.Fn strlcpy
-and
-.Fn strlcat
-only operate on true
-.Dq C
-strings.
-This means that for
-.Fn strlcpy
-.Fa src
-must be NUL-terminated and for
-.Fn strlcat
-both
-.Fa src
-and
-.Fa dst
-must be NUL-terminated.
-.Pp
-The
-.Fn strlcpy
-function copies up to
-.Fa size
-- 1 characters from the NUL-terminated string
-.Fa src
-to
-.Fa dst ,
-NUL-terminating the result.
-.Pp
-The
-.Fn strlcat
-function appends the NUL-terminated string
-.Fa src
-to the end of
-.Fa dst .
-It will append at most
-.Fa size
-- strlen(dst) - 1 bytes, NUL-terminating the result.
-.Sh RETURN VALUES
-The
-.Fn strlcpy
-and
-.Fn strlcat
-functions return the total length of the string they tried to create.
-For
-.Fn strlcpy
-that means the length of
-.Fa src .
-For
-.Fn strlcat
-that means the initial length of
-.Fa dst
-plus
-the length of
-.Fa src .
-While this may seem somewhat confusing it was done to make
-truncation detection simple.
-.Sh EXAMPLES
-The following code fragment illustrates the simple case:
-.Bd -literal -offset indent
-char *s, *p, buf[BUFSIZ];
-
-\&...
-
-(void)strlcpy(buf, s, sizeof(buf));
-(void)strlcat(buf, p, sizeof(buf));
-.Ed
-.Pp
-To detect truncation, perhaps while building a pathname, something
-like the following might be used:
-.Bd -literal -offset indent
-char *dir, *file, pname[MAXPATHLEN];
-
-\&...
-
-if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname))
- goto toolong;
-if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname))
- goto toolong;
-.Ed
-.Pp
-Since we know how many characters we copied the first time, we can
-speed things up a bit by using a copy instead of an append:
-.Bd -literal -offset indent
-char *dir, *file, pname[MAXPATHLEN];
-size_t n;
-
-\&...
-
-n = strlcpy(pname, dir, sizeof(pname));
-if (n >= sizeof(pname))
- goto toolong;
-if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n)
- goto toolong;
-.Ed
-.Pp
-However, one may question the validity of such optimizations, as they
-defeat the whole purpose of
-.Fn strlcpy
-and
-.Fn strlcat .
-As a matter of fact, the first version of this manual page got it wrong.
-.Sh SEE ALSO
-.Xr snprintf 3 ,
-.Xr strncat 3 ,
-.Xr strncpy 3
diff --git a/mdk-stage1/dietlibc/lib/strlcpy.c b/mdk-stage1/dietlibc/lib/strlcpy.c
deleted file mode 100644
index b935b9527..000000000
--- a/mdk-stage1/dietlibc/lib/strlcpy.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: strlcpy.c,v 1.3 1999/04/24 01:17:37 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcpy.c,v 1.3 1999/04/24 01:17:37 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-size_t strlcpy(dst, src, siz)
- char *dst;
- const char *src;
- size_t siz;
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0 && --n != 0) {
- do {
- if ((*d++ = *s++) == 0)
- break;
- } while (--n != 0);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0) {
- if (siz != 0)
- *d = '\0'; /* NUL-terminate dst */
- while (*s++)
- ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
diff --git a/mdk-stage1/dietlibc/lib/strlen.c b/mdk-stage1/dietlibc/lib/strlen.c
deleted file mode 100644
index 56c085dac..000000000
--- a/mdk-stage1/dietlibc/lib/strlen.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <endian.h>
-#include "dietfeatures.h"
-#include <string.h>
-
-#ifdef WANT_SMALL_STRING_ROUTINES
-size_t strlen(const char *s) {
- register int i;
- if (!s) return 0;
- for (i=0; *s; ++s) ++i;
- return i;
-}
-#else
-static const unsigned long magic = 0x01010101;
-
-size_t strlen(const char *s)
-{
- const char *t = s;
- unsigned long word;
-
- if (!s) return 0;
-
- /* Byte compare up until word boundary */
- for (; ((unsigned long) t & 3); t++)
- if (!*t) return t - s;
-
- /* Word compare */
- do {
- word = *((unsigned long *) t); t += 4;
- word = (word - magic) &~ word;
- word &= (magic << 7);
- } while (word == 0);
-
-#if BYTE_ORDER == LITTLE_ENDIAN
- /* word & 0x80808080 == word */
- word = (word - 1) & (magic << 10);
- word += (word << 8) + (word << 16);
- t += word >> 26;
-#else
- if ((word & 0x80800000) == 0) {
- word <<= 16;
- t += 2;
- }
- if ((word & 0x80000000) == 0) t += 1;
-#endif
- return ((const char *) t) - 4 - s;
-}
-#endif
diff --git a/mdk-stage1/dietlibc/lib/strncasecmp.c b/mdk-stage1/dietlibc/lib/strncasecmp.c
deleted file mode 100644
index 8a5445e53..000000000
--- a/mdk-stage1/dietlibc/lib/strncasecmp.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <ctype.h>
-#include <sys/types.h>
-#include <string.h>
-
-int strncasecmp(const char *s, const char *t, size_t n) {
- register char x;
- register const char* u=s+n;
- for (;;) {
- x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t;
- x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t;
- x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t;
-#endif
- }
- return ((int)(unsigned int)(unsigned char) x)
- - ((int)(unsigned int)(unsigned char) *t);
-}
diff --git a/mdk-stage1/dietlibc/lib/strncat.c b/mdk-stage1/dietlibc/lib/strncat.c
deleted file mode 100644
index a08e97916..000000000
--- a/mdk-stage1/dietlibc/lib/strncat.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "dietfeatures.h"
-#include <string.h>
-
-#ifdef WANT_NON_COMPLIANT_STRNCAT
-/* this implementation is not standards compliant.
- * the standard says that strncat(dest,"foobar",3) should write 'f', 'o'
- * and 'o'. The programmer is then expected to overwrite the last byte
- * with '\0', which is often forgotten. This implementation makes sure
- * the last written bytes is always '\0'. */
-#endif
-
-char *strncat(char *s, const char *t, size_t n) {
- char *dest=s;
- register char *max;
- s+=strlen(s);
-#ifdef WANT_NON_COMPLIANT_STRNCAT
- max=s+n-1;
-#else
- max=s+n;
-#endif
- for (;;) {
- if (!(*s = *t)) break; if (++s==max) break; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- if (!(*s = *t)) break; if (++s==max) break; ++t;
- if (!(*s = *t)) break; if (++s==max) break; ++t;
- if (!(*s = *t)) break; if (++s==max) break; ++t;
-#endif
- }
- *s=0;
- return dest;
-}
diff --git a/mdk-stage1/dietlibc/lib/strncmp.c b/mdk-stage1/dietlibc/lib/strncmp.c
deleted file mode 100644
index 7c08c0fa7..000000000
--- a/mdk-stage1/dietlibc/lib/strncmp.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-int strncmp(const char *s1, const char *s2, size_t n) {
- return memccmp(s1,s2,0,n);
-}
diff --git a/mdk-stage1/dietlibc/lib/strncpy.c b/mdk-stage1/dietlibc/lib/strncpy.c
deleted file mode 100644
index 531387b7f..000000000
--- a/mdk-stage1/dietlibc/lib/strncpy.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#define _POSIX_SOURCE
-#define _XOPEN_SOURCE
-#include <sys/types.h>
-#include <string.h>
-
-char *strncpy(char *dest, const char *src, size_t n)
-{
- memccpy(dest,src,0,n);
- return dest;
-}
diff --git a/mdk-stage1/dietlibc/lib/strpbrk.c b/mdk-stage1/dietlibc/lib/strpbrk.c
deleted file mode 100644
index e18fd2a2d..000000000
--- a/mdk-stage1/dietlibc/lib/strpbrk.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-char *strpbrk(const char *s, const char *accept) {
- register int i,l=strlen(accept);
- for (; *s; s++)
- for (i=0; i<l; i++)
- if (*s == accept[i])
- return (char*)s;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/strrchr.c b/mdk-stage1/dietlibc/lib/strrchr.c
deleted file mode 100644
index 1abb655e2..000000000
--- a/mdk-stage1/dietlibc/lib/strrchr.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <string.h>
-#include "dietfeatures.h"
-
-char *strrchr(const char *t, int c) {
- register char ch;
- register const char *l=0;
-
- ch = c;
- for (;;) {
- if (*t == ch) l=t; if (!*t) return (char*)l; ++t;
-#ifndef WANT_SMALL_STRING_ROUTINES
- if (*t == ch) l=t; if (!*t) return (char*)l; ++t;
- if (*t == ch) l=t; if (!*t) return (char*)l; ++t;
- if (*t == ch) l=t; if (!*t) return (char*)l; ++t;
-#endif
- }
- return (char*)l;
-}
-
-char *rindex(const char *t,int c) __attribute__((weak,alias("strrchr")));
diff --git a/mdk-stage1/dietlibc/lib/strsep.c b/mdk-stage1/dietlibc/lib/strsep.c
deleted file mode 100644
index a1bf1872a..000000000
--- a/mdk-stage1/dietlibc/lib/strsep.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <string.h>
-
-char *strsep(char **stringp, const char *delim) {
- register char *tmp=*stringp;
- register char *tmp2=tmp;
- register const char *tmp3;
- for (tmp2=tmp; *tmp2; ++tmp2) {
- for (tmp3=delim; *tmp3; ++tmp3)
- if (*tmp2==*tmp3) { /* delimiter found */
- *tmp2=0;
- *stringp=tmp2+1;
- return tmp;
- }
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/strspn.c b/mdk-stage1/dietlibc/lib/strspn.c
deleted file mode 100644
index 2b3a4c116..000000000
--- a/mdk-stage1/dietlibc/lib/strspn.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-size_t strspn(const char *s, const char *accept)
-{
- size_t l=0;
- int a=1,i,al=strlen(accept);
-
- while((a)&&(*s))
- {
- for(a=i=0;(!a)&&(i<al);i++)
- if (*s==accept[i]) a=1;
- if (a) l++;
- s++;
- }
- return l;
-}
diff --git a/mdk-stage1/dietlibc/lib/strstr.c b/mdk-stage1/dietlibc/lib/strstr.c
deleted file mode 100644
index 641d9d7ac..000000000
--- a/mdk-stage1/dietlibc/lib/strstr.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-char *strstr(const char *haystack, const char *needle) {
- int nl=strlen(needle);
- int hl=strlen(haystack);
- int i;
- if (nl>hl) return 0;
- for (i=hl-nl+1; i; --i) {
- if (!memcmp(haystack,needle,nl))
- return (char*)haystack;
- ++haystack;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/strtod.c b/mdk-stage1/dietlibc/lib/strtod.c
deleted file mode 100644
index cbe983d84..000000000
--- a/mdk-stage1/dietlibc/lib/strtod.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <string.h>
-
-extern char isspace(char c);
-
-#ifdef __GNUC__
-static inline char isdigit(char c) { return (c>='0' && c<='9'); }
-#endif
-
-double strtod(const char *nptr, char **endptr) {
- double d=0;
- register const char *c=nptr;
- char neg=0;
- while (*c && isspace(*c)) ++c;
- switch (*c) {
- case '-': neg=1;
- case '+': c++; break;
- default: break;
- }
- while (isdigit(*c)) {
- d=d*10+(*c-'0');
- ++c;
- }
- if (*c=='.') {
- double factor=.1;
- while (isdigit(*++c)) {
- d=d+(factor*(*c-'0'));
- factor/=10;
- }
- }
- if ((*c|32)=='e') {
- int exp=0;
- double factor=10;
- if (c[1]<'0') {
- switch (c[1]) {
- case '-': factor=0.1;
- case '+': c++; break;
- default:
- d=0;
- c=nptr;
- goto done;
- }
- }
- while (isdigit(*++c))
- exp=exp*10+(*c-'0');
- while (exp) { /* XXX: this introduces rounding errors */
- d*=factor; --exp;
- }
- }
-done:
- if (endptr) *endptr=(char*)c;
- return d;
-}
diff --git a/mdk-stage1/dietlibc/lib/strtok.c b/mdk-stage1/dietlibc/lib/strtok.c
deleted file mode 100644
index 86337da7b..000000000
--- a/mdk-stage1/dietlibc/lib/strtok.c
+++ /dev/null
@@ -1,8 +0,0 @@
-char *strtok_r(char *s, const char *delim, char **ptrptr);
-
-static char *strtok_pos;
-
-char *strtok(char *s, const char *delim)
-{
- return strtok_r(s,delim,&strtok_pos);
-}
diff --git a/mdk-stage1/dietlibc/lib/strtok_r.c b/mdk-stage1/dietlibc/lib/strtok_r.c
deleted file mode 100644
index 93f9401de..000000000
--- a/mdk-stage1/dietlibc/lib/strtok_r.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <string.h>
-
-char *strtok_r(char *s, const char *delim, char **ptrptr)
-{
- int i;
- char *tmp=0;
-
- if (s) (*ptrptr)=s;
-
- if (**ptrptr)
- {
- while(!(i=strcspn(*ptrptr,delim))) (*ptrptr)++;
- if (**ptrptr)
- {
- tmp=(*ptrptr);
- (*ptrptr)+=i;
- if (**ptrptr) *(*ptrptr)++=0;
- }
- }
- return tmp;
-}
diff --git a/mdk-stage1/dietlibc/lib/strtol.c b/mdk-stage1/dietlibc/lib/strtol.c
deleted file mode 100644
index ead89f408..000000000
--- a/mdk-stage1/dietlibc/lib/strtol.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <ctype.h>
-
-extern unsigned long int strtoul(const char *nptr, char **endptr, int base);
-
-long int strtol(const char *nptr, char **endptr, int base)
-{
- int neg=0;
- unsigned long int v;
-
- while(isspace(*nptr)) nptr++;
-
- if (*nptr == '-' && isdigit(nptr[1])) { neg=-1; nptr++; }
- v=strtoul(nptr,endptr,base);
- return (neg?-v:v);
-}
diff --git a/mdk-stage1/dietlibc/lib/strtoll.c b/mdk-stage1/dietlibc/lib/strtoll.c
deleted file mode 100644
index 7b8e28a1d..000000000
--- a/mdk-stage1/dietlibc/lib/strtoll.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <ctype.h>
-
-extern unsigned long int strtoull(const char *nptr, char **endptr, int base);
-
-long int strtoll(const char *nptr, char **endptr, int base)
-{
- int neg=0;
- unsigned long long int v;
-
- while(isspace(*nptr)) nptr++;
-
- if (*nptr == '-' && isdigit(nptr[1])) { neg=-1; nptr++; }
- v=strtoull(nptr,endptr,base);
- return (neg?-v:v);
-}
diff --git a/mdk-stage1/dietlibc/lib/strtoul.c b/mdk-stage1/dietlibc/lib/strtoul.c
deleted file mode 100644
index 3f93962a9..000000000
--- a/mdk-stage1/dietlibc/lib/strtoul.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <ctype.h>
-
-/* static char *num="0123456789abcdefghijklmnopqrstuvwxyz"; */
-
-unsigned long int strtoul(const char *nptr, char **endptr, int base)
-{
- long int v=0;
-
- while(isspace(*nptr)) ++nptr;
-
- if (*nptr == '+') ++nptr;
- if (!base) {
- if (*nptr=='0') {
- base=8;
- if ((*(nptr+1)=='x')||(*(nptr+1)=='X')) {
- nptr+=2;
- base=16;
- }
- }
- else
- base=10;
- }
- while(*nptr) {
- register unsigned char c=*nptr;
- c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c-'0');
- if (c>=base) break;
- v=v*base+c;
- ++nptr;
- }
- if (endptr) *endptr=(char *)nptr;
- return v;
-}
diff --git a/mdk-stage1/dietlibc/lib/strtoull.c b/mdk-stage1/dietlibc/lib/strtoull.c
deleted file mode 100644
index 40818958d..000000000
--- a/mdk-stage1/dietlibc/lib/strtoull.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <ctype.h>
-
-unsigned long long int strtoull(const char *nptr, char **endptr, int base)
-{
- long long int v=0;
-
- while(isspace(*nptr)) ++nptr;
-
- if (*nptr == '+') ++nptr;
- if (!base) {
- if (*nptr=='0') {
- base=8;
- if ((*(nptr+1)=='x')||(*(nptr+1)=='X')) {
- nptr+=2;
- base=16;
- }
- }
- else
- base=10;
- }
- while(*nptr) {
- register unsigned char c=*nptr;
- c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c-'0');
- if (c>=base) break;
- v=v*base+c;
- ++nptr;
- }
- if (endptr) *endptr=(char *)nptr;
- return v;
-}
diff --git a/mdk-stage1/dietlibc/lib/sys_siglist.c b/mdk-stage1/dietlibc/lib/sys_siglist.c
deleted file mode 100644
index 80d7b3fb0..000000000
--- a/mdk-stage1/dietlibc/lib/sys_siglist.c
+++ /dev/null
@@ -1,37 +0,0 @@
-const char *const sys_siglist[] =
- {
- "Signal 0",
- "Hangup",
- "Interrupt",
- "Quit",
- "Illegal instruction",
- "Trace/breakpoint trap",
- "IOT trap",
- "EMT trap",
- "Floating point exception",
- "Killed",
- "Bus error",
- "Segmentation fault",
- "Bad system call",
- "Broken pipe",
- "Alarm clock",
- "Terminated",
- "Urgent I/O condition",
- "Stopped (signal)",
- "Stopped",
- "Continued",
- "Child exited",
- "Stopped (tty input)",
- "Stopped (tty output)",
- "I/O possible",
- "CPU time limit exceeded",
- "File size limit exceeded",
- "Virtual timer expired",
- "Profiling timer expired",
- "Window changed",
- "Resource lost",
- "User defined signal 1",
- "User defined signal 2",
- 0
- };
-
diff --git a/mdk-stage1/dietlibc/lib/tcdrain.c b/mdk-stage1/dietlibc/lib/tcdrain.c
deleted file mode 100644
index 7a760f643..000000000
--- a/mdk-stage1/dietlibc/lib/tcdrain.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <sys/ioctl.h>
-
-int __libc_tcdrain(int fd)
-{
- return ioctl(fd, TCSBRK, 1);
-}
-
-int tcdrain(int fd) __attribute__((weak,alias("__libc_tcdrain")));
diff --git a/mdk-stage1/dietlibc/lib/tcflush.c b/mdk-stage1/dietlibc/lib/tcflush.c
deleted file mode 100644
index a19fe11d1..000000000
--- a/mdk-stage1/dietlibc/lib/tcflush.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-#include <asm/errno.h>
-
-extern int errno;
-
-/* Flush pending data on FD. */
-int tcflush(int fd, int queue_selector)
-{
- switch (queue_selector) {
- case TCIFLUSH:
- return ioctl(fd, TCFLSH, 0);
- case TCOFLUSH:
- return ioctl(fd, TCFLSH, 1);
- case TCIOFLUSH:
- return ioctl(fd, TCFLSH, 2);
- default:
- errno = EINVAL;
- return -1;
- }
-}
diff --git a/mdk-stage1/dietlibc/lib/tcgetattr.c b/mdk-stage1/dietlibc/lib/tcgetattr.c
deleted file mode 100644
index f35d39442..000000000
--- a/mdk-stage1/dietlibc/lib/tcgetattr.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcgetattr(int fildes, struct termios *termios_p)
-{
- return ioctl(fildes, TCGETS, termios_p);
-}
diff --git a/mdk-stage1/dietlibc/lib/tcgetpgrp.c b/mdk-stage1/dietlibc/lib/tcgetpgrp.c
deleted file mode 100644
index f2a290651..000000000
--- a/mdk-stage1/dietlibc/lib/tcgetpgrp.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcgetpgrp(int fildes)
-{
- return ioctl(fildes, TIOCGPGRP);
-}
diff --git a/mdk-stage1/dietlibc/lib/tcsetattr.c b/mdk-stage1/dietlibc/lib/tcsetattr.c
deleted file mode 100644
index cf70354d2..000000000
--- a/mdk-stage1/dietlibc/lib/tcsetattr.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#define tcsetattr libc_tcsetattr
-#include <termios.h>
-#include <sys/ioctl.h>
-#undef tcsetattr
-
-#include <asm/errno.h>
-
-extern int errno;
-
-/* Hack around a kernel bug; value must correspond to the one used in speed.c */
-#define IBAUD0 020000000000
-
-int tcsetattr(int fildes, int optional_actions, struct termios *termios_p)
-{
- termios_p->c_iflag &= ~IBAUD0;
- switch (optional_actions) {
- case TCSANOW:
- return ioctl(fildes, TCSETS, termios_p);
- case TCSADRAIN:
- return ioctl(fildes, TCSETSW, termios_p);
- case TCSAFLUSH:
- return ioctl(fildes, TCSETSF, termios_p);
- default:
- errno = EINVAL;
- return -1;
- }
-}
diff --git a/mdk-stage1/dietlibc/lib/tcsetpgrp.c b/mdk-stage1/dietlibc/lib/tcsetpgrp.c
deleted file mode 100644
index 6c40b5c79..000000000
--- a/mdk-stage1/dietlibc/lib/tcsetpgrp.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcsetpgrp(int fildes, pid_t pgrpid)
-{
- return ioctl(fildes, TIOCSPGRP, &pgrpid);
-}
diff --git a/mdk-stage1/dietlibc/lib/telldir.c b/mdk-stage1/dietlibc/lib/telldir.c
deleted file mode 100644
index 58be5d034..000000000
--- a/mdk-stage1/dietlibc/lib/telldir.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-
-off_t telldir(DIR *d) {
- return lseek(d->fd,0,SEEK_CUR)-d->num+d->cur;
-}
diff --git a/mdk-stage1/dietlibc/lib/tolower.c b/mdk-stage1/dietlibc/lib/tolower.c
deleted file mode 100644
index 4b7c7cf2d..000000000
--- a/mdk-stage1/dietlibc/lib/tolower.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <ctype.h>
-
-inline int tolower(int c) {
- return (c>='A' && c<='Z')?c-'A'+'a':c;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/toupper.c b/mdk-stage1/dietlibc/lib/toupper.c
deleted file mode 100644
index c048e60bb..000000000
--- a/mdk-stage1/dietlibc/lib/toupper.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <ctype.h>
-
-inline int toupper(int c) {
- return (c>='a' && c<='z')?c-'a'+'A':c;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/ttyname.c b/mdk-stage1/dietlibc/lib/ttyname.c
deleted file mode 100644
index a6b479088..000000000
--- a/mdk-stage1/dietlibc/lib/ttyname.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "dietfeatures.h"
-#include <unistd.h>
-#include <sys/stat.h>
-
-#ifdef __linux__
-
-extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase);
-
-char *ttyname(int fd) {
-#ifdef SLASH_PROC_OK
- char ibuf[20];
- static char obuf[20];
- strcpy(ibuf,"/proc/self/fd/");
- ibuf[__ltostr(ibuf+14,6,fd,10,0)+14]=0;
- if (readlink(ibuf,obuf,sizeof(obuf)-1)<0) return 0;
- return obuf;
-#else
- static char buf[20]="/dev/tty";
- struct stat s;
- char *c=buf+8;
- int n;
- if (fstat(fd,&s)) return 0;
- if (S_ISCHR(s.st_mode)) {
- n=minor(s.st_rdev);
- switch (major(s.st_rdev)) {
- case 4:
- buf[5]='t'; buf[7]='y';
- if (n>63) {
- n-=64;
- *c='S';
- ++c;
- }
-num:
- c[__ltostr(c,6,n,10,0)]=0;
- break;
- case 2:
- buf[5]='p'; buf[7]='y';
- buf[8]='p'-(n>>4);
- buf[9]=n%4+'0';
- if (buf[9]>'9') *c+='a'-'0';
- buf[10]=0;
- case 136:
- case 137:
- case 138:
- case 139:
- buf[5]='p'; buf[7]='s';
- n+=(major(s.st_rdev)-136)<<8;
- *c='/'; ++c;
- goto num;
- default:
- return 0;
- }
- return buf;
- }
- return 0;
-#endif
-}
-
-#endif
diff --git a/mdk-stage1/dietlibc/lib/usleep.c b/mdk-stage1/dietlibc/lib/usleep.c
deleted file mode 100644
index 494f99233..000000000
--- a/mdk-stage1/dietlibc/lib/usleep.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linux/time.h>
-#include <time.h>
-
-/* nano * 1000 == usecs
- * usecs * 1000 == msecs
- * msecs * 1000 = secs */
-void usleep(unsigned int usecs) {
- struct timespec t;
- t.tv_sec=usecs/1000000;
- t.tv_nsec=(usecs%1000000)*1000;
- nanosleep(&t,&t);
-}
diff --git a/mdk-stage1/dietlibc/lib/vfork.c b/mdk-stage1/dietlibc/lib/vfork.c
deleted file mode 100644
index 795cddb05..000000000
--- a/mdk-stage1/dietlibc/lib/vfork.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <linux/types.h>
-#include <unistd.h>
-
-pid_t vfork(void) {
- return fork();
-}
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/lib/vsnprintf.c b/mdk-stage1/dietlibc/lib/vsnprintf.c
deleted file mode 100644
index f425066e3..000000000
--- a/mdk-stage1/dietlibc/lib/vsnprintf.c
+++ /dev/null
@@ -1,238 +0,0 @@
-#include "dietfeatures.h"
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include "dietwarning.h"
-
-extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase);
-extern int __dtostr(double d,char *buf,int maxlen,int prec);
-
-int vsnprintf (char *str, size_t size, const char *format, va_list arg_ptr)
-{
- size_t apos,i;
- char ch,buf[1024];
- char *pb;
- char flag_in_sign;
- char flag_hash,flag_zero,flag_left,flag_space,flag_sign,flag_dot,flag_long;
- long number,width,preci,buf_len,pad;
- char padwith;
-
- size--;
-
- apos=0;
- while (apos<size)
- {
- ch=*format++;
- switch (ch)
- {
- case '%':
- flag_hash=0;
- flag_zero=0;
- flag_left=0;
- flag_space=0;
- flag_sign=0;
- flag_dot=0;
- flag_in_sign=0;
- flag_long=0;
-
- width=0;
- padwith=' ';
-
-inn_vsnprintf:
- if (apos>=size) continue; /* ARGL !!! */
-
- ch=*format++;
- switch (ch)
- {
-/* Format end ?!? */
- case 0:
- return -1;
- break;
-
-/* Format flag chars */
- case '#':
- flag_hash=1;
- goto inn_vsnprintf;
-
- case 'l':
- ++flag_long;
- goto inn_vsnprintf;
-
- case '0':
- padwith='0';
- goto inn_vsnprintf;
-
- case '-':
- flag_left=1;
- goto inn_vsnprintf;
-
- case ' ':
- flag_space=1;
- goto inn_vsnprintf;
-
- case '+':
- flag_sign=1;
- goto inn_vsnprintf;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if(flag_dot) return -1;
- width=strtol(--format,&pb,10);
- format=pb;
- goto inn_vsnprintf;
-
- case '*':
- width=va_arg(arg_ptr,int);
- goto inn_vsnprintf;
-
- case '.':
- flag_dot=1;
- if (*format=='*') {
- preci=va_arg(arg_ptr,int);
- ++format;
- } else {
- preci=strtol(format,&pb,10);
- format=pb;
- }
- goto inn_vsnprintf;
-
-/* Format conversion chars */
- case 'c':
- ch=(char)va_arg(arg_ptr,int);
- case '%':
- if (str) str[apos]=ch; ++apos;
- break;
-
- case 's':
- pb=va_arg(arg_ptr,char *);
-#ifdef WANT_NULL_PRINTF
- if (!pb) pb="(null)";
-#endif
- buf_len=strlen(pb);
- if (flag_dot && buf_len>preci) buf_len=preci;
- if (buf_len>size-apos) buf_len=size-apos;
-
-print_out:
- if (str) {
- if (width && (!flag_left))
- {
- for (pad=width-buf_len; pad>0; --pad) str[apos++]=padwith;
- }
- for(i=0;i<buf_len;++i) { str[apos++]=pb[i]; } /* strncpy */
- if (width && (flag_left))
- {
- for (pad=width-buf_len; pad>0; --pad) str[apos++]=padwith;
- }
- } else {
- if (width) {
- apos+=width>buf_len?width:buf_len;
- } else {
- apos+=size>buf_len?buf_len:size;
- }
- }
-
- break;
-
- /* Numbers */
- case 'b':
- i=2;
- goto num_vsnprintf;
- case 'p':
- flag_hash=1;
- width=sizeof(void *)<<1;
- padwith='0';
- ch='x';
- case 'X':
- case 'x':
- i=16;
- if (flag_hash)
- {
- if (str) {
- str[apos++]='0';
- str[apos++]=ch;
- } else
- apos+=2;
- }
- goto num_vsnprintf;
- case 'd':
- case 'i':
- flag_in_sign=1;
- case 'u':
- i=10;
- goto num_vsnprintf;
- case 'o':
- i=8;
- if (flag_hash) { if (str) str[apos]='0'; ++apos; }
-
-num_vsnprintf:
- if (apos>=size) continue; /* ARGL !!! */
-
- if (flag_long)
- number=va_arg(arg_ptr,long);
- else
- number=va_arg(arg_ptr,int);
-
- if (flag_in_sign && (number<0))
- {
- number*=-1;
- flag_in_sign=2;
- }
-
- buf_len=__ltostr(buf+1,sizeof(buf)-1,(unsigned long) number,i,0);
- pb=buf+1;
-
- if (flag_in_sign==2)
- {
- *(--pb)='-';
- buf_len++;
- }
- else if ((flag_in_sign)&&(flag_sign || flag_space))
- {
- *(--pb)=(flag_sign)?'+':' ';
- buf_len++;
- }
- goto print_out;
-
-#ifdef WANT_FLOATING_POINT_IN_PRINTF
- case 'f':
- case 'g':
- {
- double d=va_arg(arg_ptr,double);
- buf_len=__dtostr(d,buf,sizeof(buf),width?width:6);
- if (flag_dot) {
- char *tmp;
- if ((tmp=strchr(buf,'.'))) {
- while (preci>-1 && *++tmp) --preci;
- *tmp=0;
- }
- }
- pb=buf;
- goto print_out;
- }
-#endif
- default:
- break;
- }
- break;
- case 0:
- if (str) str[apos]=0;
- return apos;
- default:
- if (str) str[apos]=ch; apos++;
- break;
- }
- }
- if (str) str[apos]=0;
- return apos;
-}
-
-link_warning("vsnprintf","warning: the printf functions add several kilobytes of bloat.")
-
diff --git a/mdk-stage1/dietlibc/lib/vsprintf.c b/mdk-stage1/dietlibc/lib/vsprintf.c
deleted file mode 100644
index 10ff04bd7..000000000
--- a/mdk-stage1/dietlibc/lib/vsprintf.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdarg.h>
-#include <linux/types.h>
-#include <stdlib.h>
-
-int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
-
-int vsprintf(char *dest,const char *format, va_list arg_ptr)
-{
- return vsnprintf(dest,1000000,format,arg_ptr);
-}
diff --git a/mdk-stage1/dietlibc/lib/vsscanf.c b/mdk-stage1/dietlibc/lib/vsscanf.c
deleted file mode 100644
index 1c4c9b787..000000000
--- a/mdk-stage1/dietlibc/lib/vsscanf.c
+++ /dev/null
@@ -1,304 +0,0 @@
-#include "dietfeatures.h"
-#include <stdarg.h>
-#include <sys/types.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-const char *skip_ws(const char *str)
-{
- while ((*str)&&(isspace(*str))) str++;
- return str;
-}
-
-extern double strtod(const char *s,char **f);
-
-int vsscanf(const char *str, const char *format, va_list arg_ptr)
-{
- int n=0,div;
- unsigned char ch;
-
- char flag_discard, flag_malloc, flag_half, flag_long, flag_longlong;
- char flag_width;
-
- unsigned long width;
-
- /* arg_ptr tmps */
-#ifdef WANT_FLOATING_POINT_IN_SCANF
- double d,*pd;
- float *pf;
-#endif
-
- long l=0,*pl;
- short *ph;
- int *pi;
- char *s;
-
- while ((*str)&&(*format))
- {
- const char *prevfmt=format;
- format=skip_ws(format);
- ch=*format++;
- if (!ch) continue;
-
- switch (ch)
- {
- case '%':
- div=0;
- flag_discard=0;
- flag_malloc=0;
- flag_half=0;
- flag_long=0;
- flag_longlong=0;
-
- flag_width=0;
- width=-1;
-
-inn_vsscanf:
- ch=*format++;
-
- switch (ch)
- {
- case 0:
- return 0;
-
- case '%':
- if (*(str++)!=ch) return n;
- break;
-
- /* flags */
- case '*':
- flag_discard=1;
- goto inn_vsscanf;
-
- case 'a':
- flag_malloc=1;
- goto inn_vsscanf;
-
- case 'h':
- flag_half=1;
- goto inn_vsscanf;
-
- case 'l':
- if (flag_long) flag_longlong=1;
- flag_long=1;
- goto inn_vsscanf;
-
- /* longlong ? NOT YET ! */
- case 'q':
- case 'L':
- flag_longlong=1;
- goto inn_vsscanf;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- width=strtol(format-1,&s,10);
- format=s;
- flag_width=1;
- goto inn_vsscanf;
-
- /* conversion */
-
- case 'n':
- while (width && *str)
- {
- *(s++)=*(str++);
- --width;
- l++;
- }
- if (!flag_discard)
- {
- pl=(long *)va_arg(arg_ptr,long*);
- *pl=l;
- ++n;
- }
- break;
-
- case 'p':
- case 'X':
- case 'x':
- div+=6;
- case 'd':
- div+=2;
- case 'o':
- div+=8;
- case 'u':
- case 'i':
- if (*(str=skip_ws(str)))
- {
- l=strtol(str,&s,div);
- if (str!=s)
- {
- if (!flag_discard)
- {
- if (flag_long)
- {
- pl=(long *)va_arg(arg_ptr,long*);
- *pl=l;
- }
- else if (flag_half)
- {
- ph=(short *)va_arg(arg_ptr,short*);
- *ph=l;
- }
- else
- {
- pi=(int *)va_arg(arg_ptr,int*);
- *pi=l;
- }
- ++n;
- }
- str=s;
- }
- else
- return n;
- }
- break;
-
-#ifdef WANT_FLOATING_POINT_IN_SCANF
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- if (*(str=skip_ws(str)))
- {
- d=strtod(str,&s);
- if (str!=s)
- {
- if (!flag_discard)
- {
- if (flag_long)
- {
- pd=(double *)va_arg(arg_ptr,double*);
- *pd=d;
- }
- else
- {
- pf=(float *)va_arg(arg_ptr,float*);
- *pf=d;
- }
- ++n;
- }
- str=s;
- }
- else
- return n;
- }
- break;
-#endif
-
- case 'c':
- if (!flag_discard)
- {
- s=(char *)va_arg(arg_ptr,char*);
- ++n;
- }
- if (!flag_width) width=1;
- while (width && *str)
- {
- if (!flag_discard) *(s++)=*(str);
- ++str;
- --width;
- }
- break;
-
- case 's':
- if (!flag_discard)
- {
- s=(char *)va_arg(arg_ptr,char*);
- ++n;
- }
- if (*(str=skip_ws(str)))
- {
- while (width && (!isspace(*str)))
- {
- if (!flag_discard) *(s++)=*(str);
- if (!*str) break;
- ++str;
- --width;
- }
- *s=0;
- }
- break;
-
-#ifdef WANT_CHARACTER_CLASSES_IN_SCANF
- case '[':
- {
- char cset[256];
- int flag_not=0;
- int flag_dash=0;
- memset(cset,0,sizeof(cset));
- ch=*format++;
-
- /* first char specials */
- if (ch=='^')
- {
- flag_not=1;
- ch=*format++;
- }
- if ((ch=='-')||(ch==']'))
- {
- cset[ch]=1;
- ch=*format++;
- }
-
- /* almost all non special chars */
- for (;(*format) && (*format!=']');++format) {
- if (flag_dash)
- {
- register unsigned char tmp=*format;
- for (;ch<=tmp;++ch) cset[ch]=1;
- flag_dash=0;
- ch=*(++format);
- }
- else if (*format=='-') flag_dash=1;
- else
- {
- cset[ch]=1;
- ch=*format;
- }
- }
-
- /* last char specials */
- if (flag_dash) cset['-']=1;
- else cset[ch]=1;
-
- /* like %c or %s */
- if (!flag_discard)
- {
- s=(char *)va_arg(arg_ptr,char*);
- ++n;
- }
- while (width && (cset[(unsigned char)(*str)]-flag_not))
- {
- if (!flag_discard) *(s++)=*(str);
- if (!*str) break;
- ++str;
- --width;
- }
- }
- break;
-#endif
- }
- break;
-
- default:
- if (prevfmt<format) {
- while (prevfmt<format) {
- if (*str!=*prevfmt) return n;
- ++str; ++prevfmt;
- }
- } else
- if (*(str++)!=ch) return n;
- break;
- }
- }
- return n;
-}
diff --git a/mdk-stage1/dietlibc/lib/wait.c b/mdk-stage1/dietlibc/lib/wait.c
deleted file mode 100644
index 8459af18c..000000000
--- a/mdk-stage1/dietlibc/lib/wait.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-
-pid_t wait(int *status) {
- return waitpid(-1,status,0);
-}
diff --git a/mdk-stage1/dietlibc/lib/wait3.c b/mdk-stage1/dietlibc/lib/wait3.c
deleted file mode 100644
index 19e90740c..000000000
--- a/mdk-stage1/dietlibc/lib/wait3.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <sys/wait.h>
-
-int wait3(int* status,int opts,struct rusage* rusage) {
- return wait4(-1,status,opts,rusage);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/___div.c b/mdk-stage1/dietlibc/libcruft/___div.c
deleted file mode 100644
index d359dc47b..000000000
--- a/mdk-stage1/dietlibc/libcruft/___div.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "dietwarning.h"
-#include <stdlib.h>
-
-div_t div(int numer, int denom) {
- div_t temp;
- temp.quot=numer/denom;
- temp.rem=numer%denom;
- return temp;
-}
-
-link_warning("div","warning: your code uses div(), which is completely superfluous!");
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft.c b/mdk-stage1/dietlibc/libcruft/dnscruft.c
deleted file mode 100644
index d7a0efa50..000000000
--- a/mdk-stage1/dietlibc/libcruft/dnscruft.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-int __dns_fd=-1;
-
-void __dns_make_fd() {
- int tmp;
- struct sockaddr_in si;
- if (__dns_fd>0) return;
- tmp=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP);
- if (tmp<0) {
- perror("__dns_make_fd!socket");
- return;
- }
- si.sin_family=AF_INET;
- si.sin_port=0;
- si.sin_addr.s_addr=INADDR_ANY;
- if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) {
- perror("__dns_make_fd!bind");
- return;
- }
- __dns_fd=tmp;
-}
-
-int __dns_servers=0;
-struct sockaddr __dns_server_ips[8];
-
-int __dns_search=0;
-char *__dns_domains[8];
-
-void __dns_readstartfiles() {
- int fd;
- char *buf=alloca(4096);
- int len;
- if (__dns_servers>0) return;
- {
- struct sockaddr_in to;
- char *cacheip=getenv("DNSCACHEIP");
- if (cacheip) {
- to.sin_port=htons(53);
- to.sin_family=AF_INET;
- if (inet_aton(cacheip,&to.sin_addr)) {
- memmove(__dns_server_ips,&to,sizeof(struct sockaddr));
- ++__dns_servers;
- }
- }
- }
- if ((fd=open("/etc/resolv.conf",O_RDONLY))<0) return;
- len=read(fd,buf,4096);
- close(fd);
- {
- char *last=buf+len;
- for (; buf<last;) {
- if (!strncmp(buf,"nameserver",10)) {
- buf+=10;
- while (buf<last && *buf!='\n') {
- while (buf<last && isblank(*buf)) ++buf;
- {
- char *tmp=buf;
- struct sockaddr_in i;
- while (buf<last && !isspace(*buf)) ++buf;
- if (buf>=last) break;
- *buf=0;
- if (inet_aton(tmp,&i.sin_addr)) {
- i.sin_family=AF_INET;
- i.sin_port=htons(53);
- memmove(&__dns_server_ips[__dns_servers],&i,sizeof(struct sockaddr));
- if (__dns_servers<8) ++__dns_servers;
- }
- }
- }
- }
- if (!strncmp(buf,"search",6) || !strncmp(buf,"domain",6)) {
- buf+=6;
- }
- while (buf<last && *buf!='\n') ++buf;
- while (buf<last && *buf=='\n') ++buf;
- }
- }
-}
-
-/* return length of decoded data or -1 */
-int __dns_decodename(unsigned char *packet,int offset,unsigned char *dest,int maxlen) {
- unsigned char *tmp;
- unsigned char *max=dest+maxlen;
- unsigned char *after=packet+offset;
- int ok=0;
- for (tmp=after; maxlen>0&&*tmp; ) {
- if ((*tmp>>6)==3) { /* goofy DNS decompression */
- unsigned int ofs=((unsigned int)(*tmp&0x3f)<<8)|*(tmp+1);
- if (ofs>=offset) return -1; /* RFC1035: "pointer to a _prior_ occurrance" */
- if (after<tmp+2) after=tmp+2;
- tmp=packet+ofs;
- ok=0;
- } else {
- unsigned int duh;
- if (dest+*tmp+1>max) return -1;
- for (duh=*tmp; duh>0; --duh)
- *dest++=*++tmp;
- *dest++='.'; ok=1;
- ++tmp;
- if (tmp>after) { after=tmp; if (!*tmp) ++after; }
- }
- }
- if (ok) --dest;
- *dest=0;
- return after-packet;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft2.c b/mdk-stage1/dietlibc/libcruft/dnscruft2.c
deleted file mode 100644
index b59207072..000000000
--- a/mdk-stage1/dietlibc/libcruft/dnscruft2.c
+++ /dev/null
@@ -1,185 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int h_errno;
-
-static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000";
-
-extern void __dns_make_fd();
-extern int __dns_fd;
-
-extern int __dns_servers;
-extern struct sockaddr __dns_server_ips[];
-
-extern void __dns_readstartfiles();
-
-extern int __dns_decodename(unsigned char *packet,int offset,unsigned char *dest,int maxlen);
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor) {
- int names,ips;
- unsigned char *cur;
- unsigned char *max;
- unsigned char packet[512];
- __dns_make_fd();
-
- if (lookfor==1) {
- result->h_aliases=(char**)(buf+8*4);
- result->h_addrtype=AF_INET;
- result->h_length=4;
- result->h_addr_list=(char**)buf;
- } else {
- result->h_aliases=(char**)(buf+8*16);
- result->h_addrtype=AF_INET6;
- result->h_length=16;
- result->h_addr_list=(char**)buf;
- }
- result->h_aliases[0]=0;
-
- cur=buf+16*sizeof(char*);
- max=buf+buflen;
- names=ips=0;
-
- memmove(packet,dnspacket,12);
- *(unsigned short*)packet=rand();
- {
- unsigned char* x;
- const char* y,* tmp;
- x=packet+12; y=name;
- while (*y) {
- while (*y=='.') ++y;
- for (tmp=y; *tmp && *tmp!='.'; ++tmp) ;
- *x=tmp-y;
- if (!(tmp-y)) break;
- ++x;
- if (x>=packet+510-(tmp-y)) { *h_errnop=ERANGE; return 1; }
- memmove(x,y,tmp-y);
- x+=tmp-y;
- if (!*tmp) {
- *x=0;
- break;
- }
- y=tmp;
- }
- *++x= 0; *++x= lookfor; /* A */
- *++x= 0; *++x= 1; /* IN */
- ++x;
- {
- int i; /* current server */
- int j; /* timeout count down */
- struct pollfd duh;
- i=0; j=30;
- __dns_readstartfiles();
- duh.fd=__dns_fd;
- duh.events=POLLIN;
- for (j=30; j>0; --j) {
- sendto(__dns_fd,packet,x-packet,0,(struct sockaddr*)&(__dns_server_ips[i]),sizeof(struct sockaddr));
- if (++i > __dns_servers) i=0;
- if (poll(&duh,1,1) == 1) {
- /* read and parse answer */
- unsigned char inpkg[1500];
- /*int len=*/ read(__dns_fd,inpkg,1500);
-#if 0
- {
- int tft=open("duh",0);
- read(tft,inpkg,1500);
- close(tft);
- }
-#endif
- /* header, question, answer, authority, additional */
- if (inpkg[0]!=packet[0] || inpkg[1]!=packet[1]) continue; /* wrong ID */
- if ((inpkg[2]&0xf9) != 0x81) continue; /* not answer */
- if ((inpkg[3]&0x0f) != 0) break; /* error */
- tmp=inpkg+12;
- {
- char name[257];
- unsigned short q=((unsigned short)inpkg[4]<<8)+inpkg[5];
- while (q>0) {
- while (*tmp) tmp+=*tmp+1;
- tmp+=5;
- --q;
- }
- q=((unsigned short)inpkg[6]<<8)+inpkg[7];
- if (q<1) break;
- while (q>0) {
- int decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256);
- if (decofs<0) break;
- tmp=inpkg+decofs;
- --q;
- if (tmp[0]!=0 || tmp[1]!=lookfor || /* TYPE != A */
- tmp[2]!=0 || tmp[3]!=1) { /* CLASS != IN */
- if (tmp[1]==5) { /* CNAME */
- tmp+=10;
- decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256);
- if (decofs<0) break;
- tmp=inpkg+decofs;
- } else
- break;
- continue;
- }
- tmp+=10; /* skip type, class, TTL and length */
- {
- int slen;
- if (lookfor==1 || lookfor==28) /* A or AAAA*/ {
- slen=strlen(name);
- if (cur+slen+8+(lookfor==28?12:0)>=max) { *h_errnop=NO_RECOVERY; return 1; }
- } else if (lookfor==12) /* PTR */ {
- decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256);
- if (decofs<0) break;
- tmp=inpkg+decofs;
- slen=strlen(name);
- } else
- slen=strlen(name);
- strcpy(cur,name);
- if (names==0)
- result->h_name=cur;
- else
- result->h_aliases[names-1]=cur;
- result->h_aliases[names]=0;
- ++names;
-/* cur+=slen+1; */
- cur+=(slen|3)+1;
- result->h_addr_list[ips++] = cur;
- if (lookfor==1) /* A */ {
- *(int*)cur=*(int*)tmp;
- cur+=4;
- result->h_addr_list[ips]=0;
- } else if (lookfor==28) /* AAAA */ {
- {
- int i;
- for (i=0; i<16; ++i) cur[i]=tmp[i];
- }
- cur+=16;
- result->h_addr_list[ips]=0;
- }
- }
-/* puts(name); */
- }
- }
-/* printf("%d answers\n",((unsigned short)inpkg[6]<<8)+inpkg[7]);
- printf("ok\n");*/
- *h_errnop=0;
- *RESULT=result;
- return 0;
- }
-/*kaputt:*/
- }
- }
- }
- return 1;
-}
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/getdtablesize.c b/mdk-stage1/dietlibc/libcruft/getdtablesize.c
deleted file mode 100644
index 227354714..000000000
--- a/mdk-stage1/dietlibc/libcruft/getdtablesize.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <unistd.h>
-#include <limits.h>
-
-int getdtablesize(void) {
- return OPEN_MAX;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrgid.c b/mdk-stage1/dietlibc/libcruft/getgrgid.c
deleted file mode 100644
index 0c223056c..000000000
--- a/mdk-stage1/dietlibc/libcruft/getgrgid.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <grp.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct group *getgrgid(gid_t gid) {
- struct group *tmp;
- setgrent();
- for (;;) {
- tmp=getgrent();
- if (!tmp) return 0;
- if (tmp->gr_gid == gid)
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrnam.c b/mdk-stage1/dietlibc/libcruft/getgrnam.c
deleted file mode 100644
index 1bdbb42a8..000000000
--- a/mdk-stage1/dietlibc/libcruft/getgrnam.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <grp.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct group *getgrnam(const char* name) {
- struct group *tmp;
- setgrent();
- for (;;) {
- tmp=getgrent();
- if (!tmp) return 0;
- if (!strcmp(tmp->gr_name,name))
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c
deleted file mode 100644
index a4207d44d..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-extern int h_errno;
-
-struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type) {
- static struct hostent hostbuf;
- struct hostent *hp;
- size_t hstbuflen;
- char *tmphstbuf;
- int res;
- int herr;
-
- hstbuflen = 1024;
- /* Allocate buffer, remember to free it to avoid a memory leakage. */
- tmphstbuf = malloc (hstbuflen);
-
- while ((res = gethostbyaddr_r (addr, len, type, &hostbuf, tmphstbuf, hstbuflen,
- &hp, &herr)) == ERANGE)
- {
- /* Enlarge the buffer. */
- hstbuflen *= 2;
- tmphstbuf = realloc (tmphstbuf, hstbuflen);
- }
- /* Check for errors. */
- if (res || hp == NULL)
- return NULL;
- return hp;
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c
deleted file mode 100644
index 37174ab13..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor);
-
-static int i2a(char* dest,unsigned int x) {
- register unsigned int tmp=x;
- register int len=0;
- if (x>=100) { *dest++=tmp/100+'0'; tmp=tmp%100; ++len; }
- if (x>=10) { *dest++=tmp/10+'0'; tmp=tmp%10; ++len; }
- *dest++=tmp+'0';
- return len+1;
-}
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int gethostbyaddr_r(const char* addr, size_t length, int format,
- struct hostent* result, char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop) {
- if (format==AF_INET) {
- char tmpbuf[50];
- char *tmp;
- int res;
- tmp=tmpbuf+i2a(tmpbuf,(unsigned char)addr[3]); *tmp++='.';
- tmp+=i2a(tmp,(unsigned char)addr[2]); *tmp++='.';
- tmp+=i2a(tmp,(unsigned char)addr[1]); *tmp++='.';
- tmp+=i2a(tmp,(unsigned char)addr[0]); strcpy(tmp,".in-addr.arpa");
- res= __dns_gethostbyx_r(tmpbuf,result,buf+4,buflen-4,RESULT,h_errnop,12); /* 12 == ns_t_ptr */
- if (res==0) {
- result->h_addr_list[0]=buf;
- result->h_addr_list[1]=buf;
- *(int*)buf=*(int*)addr;
- }
- return res;
- }
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname.c b/mdk-stage1/dietlibc/libcruft/gethostbyname.c
deleted file mode 100644
index 5db5bf3c5..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-extern int h_errno;
-
-struct hostent* gethostbyname (const char *host)
-{
- static struct hostent hostbuf;
- struct hostent *hp;
- size_t hstbuflen;
- char *tmphstbuf;
- int res;
- int herr;
-
- hstbuflen = 1024;
- /* Allocate buffer, remember to free it to avoid a memory leakage. */
- tmphstbuf = malloc (hstbuflen);
-
- while ((res = gethostbyname_r (host, &hostbuf, tmphstbuf, hstbuflen,
- &hp, &herr)) == ERANGE)
- {
- /* Enlarge the buffer. */
- hstbuflen *= 2;
- tmphstbuf = realloc (tmphstbuf, hstbuflen);
- }
- /* Check for errors. */
- if (res || hp == NULL)
- return NULL;
- return hp;
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2.c
deleted file mode 100644
index 3d8296616..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c
+++ /dev/null
@@ -1,40 +0,0 @@
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-extern int h_errno;
-
-struct hostent* gethostbyname2(const char *host,int AF)
-{
- static struct hostent hostbuf;
- struct hostent *hp;
- size_t hstbuflen;
- char *tmphstbuf;
- int res;
- int herr;
-
- hstbuflen = 1024;
- /* Allocate buffer, remember to free it to avoid a memory leakage. */
- tmphstbuf = malloc (hstbuflen);
-
- while ((res = gethostbyname2_r (host, AF,&hostbuf, tmphstbuf, hstbuflen,
- &hp, &herr)) == ERANGE)
- {
- /* Enlarge the buffer. */
- hstbuflen *= 2;
- tmphstbuf = realloc (tmphstbuf, hstbuflen);
- }
- /* Check for errors. */
- if (res || hp == NULL)
- return NULL;
- return hp;
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c
deleted file mode 100644
index b505ccfbc..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor);
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int gethostbyname2_r(const char* name, int AF, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop) {
- int L=strlen(name);
- int lookfor=0;
- switch (AF) {
- case AF_INET: lookfor=1; break;
- case AF_INET6: lookfor=28; break;
- default: *h_errnop=EINVAL; return 1;
- }
- result->h_name=buf;
- if (buflen<L) { *h_errnop=ERANGE; return 1; }
- strcpy(buf,name);
- return __dns_gethostbyx_r(name,result,buf+L,buflen-L,RESULT,h_errnop,lookfor);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c
deleted file mode 100644
index d5a531f0f..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor);
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int gethostbyname_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop) {
- int L=strlen(name);
- result->h_name=buf;
- if (buflen<L) { *h_errnop=ERANGE; return 1; }
- strcpy(buf,name);
- return __dns_gethostbyx_r(name,result,buf+L,buflen-L,RESULT,h_errnop,1);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getlogin.c b/mdk-stage1/dietlibc/libcruft/getlogin.c
deleted file mode 100644
index 359f44d9f..000000000
--- a/mdk-stage1/dietlibc/libcruft/getlogin.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdlib.h>
-
-char* getlogin() {
- return getenv("LOGNAME");
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getpagesize.c b/mdk-stage1/dietlibc/libcruft/getpagesize.c
deleted file mode 100644
index dea4a9693..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpagesize.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
-size_t __libc_getpagesize(void) {
- return PAGE_SIZE;
-}
-
-size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize")));
-
diff --git a/mdk-stage1/dietlibc/libcruft/getpass.c b/mdk-stage1/dietlibc/libcruft/getpass.c
deleted file mode 100644
index 3da7cd2b3..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpass.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <termios.h>
-#include <unistd.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <string.h>
-
-char *getpass(const char* prompt) {
- struct termios old,tmp;
- int out,in=open("/dev/tty",O_RDWR);
- int doclose=(in>=0);
- static char buf[PASS_MAX];
- if (doclose) { in=0; out=2; } else out=in;
- if (!tcgetattr(in,&old)) {
- tmp=old;
- tmp.c_lflag &= ~(ECHO|ISIG);
- tcsetattr(in,TCSAFLUSH,&tmp);
- }
- write(out,prompt,strlen(prompt));
- {
- int nread,ofs=0;
- for (;;) {
- nread=read(in,buf+ofs,PASS_MAX-ofs);
- if (nread<0) {
- buf[ofs]=0;
- break;
- } else if (ofs+nread>=PASS_MAX) {
- buf[PASS_MAX-1]=0;
- break;
- } else if (buf[ofs+nread-1]=='\n') {
- buf[ofs+nread-1]=0;
- break;
- }
- ofs+=nread;
- }
- write(out,"\n",1);
- }
- tcsetattr(in,TCSAFLUSH,&old);
- if (doclose) close(in);
- return buf;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwnam.c b/mdk-stage1/dietlibc/libcruft/getpwnam.c
deleted file mode 100644
index 53aae74d1..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpwnam.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <pwd.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct passwd *getpwnam(const char * name) {
- struct passwd *tmp;
- setpwent();
- for (;;) {
- tmp=getpwent();
- if (!tmp) return 0;
- if (!strcmp(tmp->pw_name,name))
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwuid.c b/mdk-stage1/dietlibc/libcruft/getpwuid.c
deleted file mode 100644
index eef14e6e8..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpwuid.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <pwd.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct passwd *getpwuid(uid_t uid) {
- struct passwd *tmp;
- setpwent();
- for (;;) {
- tmp=getpwent();
- if (!tmp) return 0;
- if (tmp->pw_uid==uid)
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getspnam.c b/mdk-stage1/dietlibc/libcruft/getspnam.c
deleted file mode 100644
index e6573345d..000000000
--- a/mdk-stage1/dietlibc/libcruft/getspnam.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <shadow.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct spwd *getspnam(const char * name) {
- struct spwd *tmp;
- setspent();
- for (;;) {
- tmp=getspent();
- if (!tmp) return 0;
- if (!strcmp(tmp->sp_namp,name))
- return tmp;
- }
-}
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/h_errno.c b/mdk-stage1/dietlibc/libcruft/h_errno.c
deleted file mode 100644
index 73ead0469..000000000
--- a/mdk-stage1/dietlibc/libcruft/h_errno.c
+++ /dev/null
@@ -1 +0,0 @@
-int h_errno;
diff --git a/mdk-stage1/dietlibc/libcruft/herrno_location.c b/mdk-stage1/dietlibc/libcruft/herrno_location.c
deleted file mode 100644
index 203f73d4b..000000000
--- a/mdk-stage1/dietlibc/libcruft/herrno_location.c
+++ /dev/null
@@ -1,5 +0,0 @@
-extern int h_errno;
-
-int *__h_errno_location() { return &h_errno; }
-
-int *h_errno_location() __attribute__((weak,alias("__h_errno_location")));
diff --git a/mdk-stage1/dietlibc/libcruft/inet_addr.c b/mdk-stage1/dietlibc/libcruft/inet_addr.c
deleted file mode 100644
index 0b8531ab1..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_addr.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-unsigned long int inet_addr(const char *cp) {
- struct in_addr foo;
- if (inet_aton(cp,&foo))
- return foo.s_addr;
- else
- return (unsigned long int)-1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_aton.c b/mdk-stage1/dietlibc/libcruft/inet_aton.c
deleted file mode 100644
index ac7d9d007..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_aton.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdlib.h>
-
-/* inet_aton() converts the Internet host address cp from the standard
- * numbers-and-dots notation into binary data and stores it in the
- * structure that inp points to. inet_aton returns nonzero if the
- * address is valid, zero if not. */
-
-/* problem is, inet_aton is historically quite, uh, lenient.
- * the following are all acceptable:
- * 0x7f000001 == 127.1 == 127.0.0.1.0 == 127.0.0.1
- * btw: 127.0.0.x.y == 127.0.0.(x|y)
- * and: 10.1.1 == 10.1.0.1 (huh?!)
- * and: 10 == 0.0.0.10 (?!?!?)
- * The Berkeley people must have been so stoned that they are still high.
- */
-
-/* I hereby disclaim that I wrote this code. */
-int inet_aton(const char *cp, struct in_addr *inp) {
- int i;
- unsigned int ip=0;
- char *tmp=(char*)cp;
- for (i=24; ;) {
- long j;
- j=strtol(tmp,&tmp,0);
- if (*tmp==0) {
- ip|=j;
- break;
- }
- if (*tmp=='.') {
- if (j>255) return 0;
- ip|=(j<<i);
- if (i>0) i-=8;
- ++tmp;
- continue;
- }
- return 0;
- }
- inp->s_addr=htonl(ip);
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c b/mdk-stage1/dietlibc/libcruft/inet_ntoa.c
deleted file mode 100644
index f8c975f7a..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-extern char *inet_ntoa_r(struct in_addr in,char* buf);
-
-char *inet_ntoa(struct in_addr in) {
- static char buf[20];
- return inet_ntoa_r(in,buf);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c b/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c
deleted file mode 100644
index dcf0eab7b..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-static unsigned int i2a(char* dest,unsigned int x) {
- register unsigned int tmp=x;
- register unsigned int len=0;
- if (x>=100) { *dest++=tmp/100+'0'; tmp=tmp%100; ++len; }
- if (x>=10) { *dest++=tmp/10+'0'; tmp=tmp%10; ++len; }
- *dest++=tmp+'0';
- return len+1;
-}
-
-char *inet_ntoa_r(struct in_addr in,char* buf) {
- unsigned int len;
- unsigned char *ip=(unsigned char*)&in;
- len=i2a(buf,ip[0]); buf[len]='.'; ++len;
- len+=i2a(buf+ len,ip[1]); buf[len]='.'; ++len;
- len+=i2a(buf+ len,ip[2]); buf[len]='.'; ++len;
- len+=i2a(buf+ len,ip[3]); buf[len]=0;
- return buf;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntop.c b/mdk-stage1/dietlibc/libcruft/inet_ntop.c
deleted file mode 100644
index 77c47f239..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_ntop.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <arpa/inet.h>
-
-extern char *inet_ntoa_r(struct in_addr in,char* buf);
-
-static const unsigned char V4mappedprefix[12]={0,0,0,0,0,0,0,0,0,0,0xff,0xff};
-
-static char tohex(char hexdigit) {
- return hexdigit>9?hexdigit+'a'-10:hexdigit+'0';
-}
-
-static int fmt_xlong(char* s,unsigned int i) {
- char* bak=s;
- *s=tohex((i>>12)&0xf); if (s!=bak || *s!='0') ++s;
- *s=tohex((i>>8)&0xf); if (s!=bak || *s!='0') ++s;
- *s=tohex((i>>4)&0xf); if (s!=bak || *s!='0') ++s;
- *s=tohex(i&0xf);
- return s-bak+1;
-}
-
-unsigned int fmt_ip6(char *s,const char ip[16])
-{
- unsigned int len;
- unsigned int i;
- unsigned int temp;
- unsigned int compressing;
- int j;
-
- len = 0; compressing = 0;
- for (j=0; j<16; j+=2) {
- if (j==12 && !memcmp(ip,V4mappedprefix,12)) {
- inet_ntoa_r(*(struct in_addr*)(ip+12),s);
- temp=strlen(s);
- return len+temp;
- }
- temp = ((unsigned long) (unsigned char) ip[j] << 8) +
- (unsigned long) (unsigned char) ip[j+1];
- if (temp == 0) {
- if (!compressing) {
- compressing=1;
- if (j==0) {
- *s++=':'; ++len;
- }
- }
- } else {
- if (compressing) {
- compressing=0;
- *s++=':'; ++len;
- }
- i = fmt_xlong(s,temp); len += i; s += i;
- if (j<14) {
- *s++ = ':';
- ++len;
- }
- }
- }
- *s=0;
- return len;
-}
-
-const char* inet_ntop(int AF, const void *CP, char *BUF, size_t LEN) {
- char buf[100];
- int len;
- if (AF==AF_INET) {
- inet_ntoa_r(*(struct in_addr*)CP,buf);
- len=strlen(buf);
- } else if (AF==AF_INET6) {
- len=fmt_ip6(buf,CP);
- } else
- return 0;
- if (len<LEN) {
- strcpy(BUF,buf);
- return BUF;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_pton.c b/mdk-stage1/dietlibc/libcruft/inet_pton.c
deleted file mode 100644
index d5c17509c..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_pton.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <errno.h>
-
-static unsigned int scan_ip6(const char *s,char ip[16])
-{
- unsigned int i;
- unsigned int len=0;
- unsigned long u;
-
- char suffix[16];
- int prefixlen=0;
- int suffixlen=0;
-
- for (i=0; i<16; i++) ip[i]=0;
-
- for (;;) {
- if (*s == ':') {
- len++;
- if (s[1] == ':') { /* Found "::", skip to part 2 */
- s+=2;
- len++;
- break;
- }
- s++;
- }
- {
- char *tmp;
- u=strtol(s,&tmp,16);
- i=tmp-s;
- }
-
- if (!i) return 0;
- if (prefixlen==12 && s[i]=='.') {
- /* the last 4 bytes may be written as IPv4 address */
- if (inet_aton(s,(struct in_addr*)(ip+12)))
- return i+len;
- else
- return 0;
- }
- ip[prefixlen++] = (u >> 8);
- ip[prefixlen++] = (u & 255);
- s += i; len += i;
- if (prefixlen==16)
- return len;
- }
-
-/* part 2, after "::" */
- for (;;) {
- if (*s == ':') {
- if (suffixlen==0)
- break;
- s++;
- len++;
- } else if (suffixlen!=0)
- break;
- {
- char *tmp;
- u=strtol(s,&tmp,16);
- i=tmp-s;
- }
- if (!i) {
- len--;
- break;
- }
- if (suffixlen+prefixlen<=12 && s[i]=='.') {
- if (inet_aton(s,(struct in_addr*)(suffix+suffixlen))) {
- suffixlen+=4;
- len+=strlen(s);
- break;
- } else
- prefixlen=12-suffixlen; /* make end-of-loop test true */
- }
- suffix[suffixlen++] = (u >> 8);
- suffix[suffixlen++] = (u & 255);
- s += i; len += i;
- if (prefixlen+suffixlen==16)
- break;
- }
- for (i=0; i<suffixlen; i++)
- ip[16-suffixlen+i] = suffix[i];
- return len;
-}
-
-int inet_pton(int AF, const char *CP, void *BUF) {
- if (AF==AF_INET) {
- if (!inet_aton(CP,(struct in_addr*)BUF))
- return 0;
- } else if (AF==AF_INET6) {
- if (CP[scan_ip6(CP,BUF)])
- return 0;
- } else {
- errno=EAFNOSUPPORT;
- return -1;
- }
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/initgroups.c b/mdk-stage1/dietlibc/libcruft/initgroups.c
deleted file mode 100644
index 7d24866e9..000000000
--- a/mdk-stage1/dietlibc/libcruft/initgroups.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <grp.h>
-#include <sys/types.h>
-#include <string.h>
-
-int initgroups(const char *user, gid_t group) {
- int n=0;
- gid_t grouplist[32];
- struct group *g;
- setgrent();
- while ((g=getgrent())) {
- char **duh=g->gr_mem;
- while (*duh) {
- if (!strcmp(*duh,user)) {
- grouplist[n]=g->gr_gid;
- if (++n>=32)
- break;
- }
- duh++;
- }
- }
- return setgroups(n,grouplist);
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/mkstemp.c b/mdk-stage1/dietlibc/libcruft/mkstemp.c
deleted file mode 100644
index 3b24ecb54..000000000
--- a/mdk-stage1/dietlibc/libcruft/mkstemp.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
-int mkstemp(char* template) {
- char *tmp=template+strlen(template)-6;
- int randfd;
- int i,res;
- unsigned int random;
- for (i=0; i<6; ++i) if (tmp[i]!='X') { __set_errno(EINVAL); return -1; }
- randfd=open("/dev/urandom",O_RDONLY);
- for (;;) {
- read(randfd,&random,sizeof(random));
- for (i=0; i<6; ++i) {
- int hexdigit=(random>>(i*5))&0x1f;
- tmp[i]=hexdigit>9?hexdigit+'a'-10:hexdigit+'0';
- }
- res=open(template,O_CREAT|O_RDWR|O_EXCL,0600);
- if (res>=0) return res;
- }
- close(randfd);
-}
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/res_init.c b/mdk-stage1/dietlibc/libcruft/res_init.c
deleted file mode 100644
index 9322af298..000000000
--- a/mdk-stage1/dietlibc/libcruft/res_init.c
+++ /dev/null
@@ -1,7 +0,0 @@
-extern int __dns_servers;
-extern void __dns_readstartfiles(void);
-
-int res_init(void) {
- __dns_servers=0;
- __dns_readstartfiles();
-}
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/libcrypt/crypt.c b/mdk-stage1/dietlibc/libcrypt/crypt.c
deleted file mode 100644
index 933397f5f..000000000
--- a/mdk-stage1/dietlibc/libcrypt/crypt.c
+++ /dev/null
@@ -1,309 +0,0 @@
-#include "dietfeatures.h"
-#include <unistd.h>
-
-/* Initial permutation, */
-static char IP[] = {
- 57,49,41,33,25,17, 9, 1,
- 59,51,43,35,27,19,11, 3,
- 61,53,45,37,29,21,13, 5,
- 63,55,47,39,31,23,15, 7,
- 56,48,40,32,24,16, 8, 0,
- 58,50,42,34,26,18,10, 2,
- 60,52,44,36,28,20,12, 4,
- 62,54,46,38,30,22,14, 6
-};
-
-/* Final permutation, FP = IP^(-1) */
-static char FP[] = {
- 39, 7,47,15,55,23,63,31,
- 38, 6,46,14,54,22,62,30,
- 37, 5,45,13,53,21,61,29,
- 36, 4,44,12,52,20,60,28,
- 35, 3,43,11,51,19,59,27,
- 34, 2,42,10,50,18,58,26,
- 33, 1,41, 9,49,17,57,25,
- 32, 0,40, 8,48,16,56,24
-};
-
-/* Permuted-choice 1 from the key bits to yield C and D.
- * Note that bits 8,16... are left out: They are intended for a parity check.
- */
-static char PC1_C[] = {
- 56,48,40,32,24,16, 8,
- 0,57,49,41,33,25,17,
- 9, 1,58,50,42,34,26,
- 18,10, 2,59,51,43,35
-};
-
-static char PC1_D[] = {
- 62,54,46,38,30,22,14,
- 6,61,53,45,37,29,21,
- 13, 5,60,52,44,36,28,
- 20,12, 4,27,19,11, 3
-};
-
-/* Sequence of shifts used for the key schedule. */
-static char shifts[] = { 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1 };
-
-/*
- * Permuted-choice 2, to pick out the bits from the CD array that generate
- * the key schedule.
- */
-static char PC2_C[] = {
- 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
- 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1
-};
-
-static char PC2_D[] = {
- 12, 23, 2, 8, 18, 26, 1, 11, 22, 16, 4, 19,
- 15, 20, 10, 27, 5, 24, 17, 13, 21, 7, 0, 3
-};
-
-/* The C and D arrays used to calculate the key schedule. */
-
-static char C[28];
-static char D[28];
-/* The key schedule. Generated from the key. */
-static char KS[16][48];
-
-/* The E bit-selection table. */
-static char E[48];
-static char e2[] = {
- 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9,
- 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17,
- 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25,
- 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1
-};
-
-/* Set up the key schedule from the key. */
-void setkey(const char *key)
-{
- register int i, j, k;
- int t;
- int s;
-
- /* First, generate C and D by permuting the key. The low order bit of each
- * 8-bit char is not used, so C and D are only 28 bits apiece.
- */
- for(i=0; i < 28; i++) {
- C[i] = key[(int)PC1_C[i]];
- D[i] = key[(int)PC1_D[i]];
- }
- /* To generate Ki, rotate C and D according to schedule and pick up a
- * permutation using PC2.
- */
- for(i=0; i < 16; i++) {
- /* rotate. */
- s = shifts[i];
- for(k=0; k < s; k++) {
- t = C[0];
- for(j=0; j < 27; j++)
- C[j] = C[j+1];
- C[27] = t;
- t = D[0];
- for(j=0; j < 27; j++)
- D[j] = D[j+1];
- D[27] = t;
- }
- /* get Ki. Note C and D are concatenated. */
- for(j=0; j < 24; j++) {
- KS[i][j] = C[(int)PC2_C[j]];
- KS[i][j+24] = D[(int)PC2_D[j]];
- }
- }
-
- for(i=0; i < 48; i++)
- E[i] = e2[i];
-}
-
-/* The 8 selection functions. For some reason, they give a 0-origin index,
- * unlike everything else.
- */
-static char S[8][64] = {
- {
- 14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7,
- 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8,
- 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0,
- 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13
- },
-
- {
- 15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10,
- 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5,
- 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15,
- 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9
- },
-
- {
- 10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8,
- 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1,
- 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7,
- 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12
- },
-
- {
- 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15,
- 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9,
- 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4,
- 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14
- },
-
- {
- 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9,
- 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6,
- 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14,
- 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3
- },
-
- {
- 12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11,
- 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8,
- 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6,
- 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13
- },
-
- {
- 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1,
- 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6,
- 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2,
- 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12
- },
-
- {
- 13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7,
- 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2,
- 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8,
- 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11
- }
-};
-
-/* P is a permutation on the selected combination of the current L and key. */
-static char P[] = {
- 15, 6,19,20, 28,11,27,16, 0,14,22,25, 4,17,30, 9,
- 1, 7,23,13, 31,26, 2, 8, 18,12,29, 5, 21,10, 3,24
-};
-
-/* The current block, divided into 2 halves. */
-static char L[32], R[32];
-static char tempL[32];
-static char f[32];
-
-/* The combination of the key and the input, before selection. */
-static char preS[48];
-
-/* The payoff: encrypt a block. */
-void encrypt(char block[64], int edflag)
-{
- int i, ii;
- register int t, j, k;
-
- /* First, permute the bits in the input */
- for(j=0; j < 64; j++)
- L[j] = block[(int)IP[j]];
- /* Perform an encryption operation 16 times. */
- for(ii=0; ii < 16; ii++) {
- i = ii;
- /* Save the R array, which will be the new L. */
- for(j=0; j < 32; j++)
- tempL[j] = R[j];
- /* Expand R to 48 bits using the E selector;
- * exclusive-or with the current key bits.
- */
- for(j=0; j < 48; j++)
- preS[j] = R[E[j]-1] ^ KS[i][j];
- /* The pre-select bits are now considered in 8 groups of 6 bits each.
- * The 8 selection functions map these 6-bit quantities into 4-bit
- * quantities and the results permuted to make an f(R, K).
- * The indexing into the selection functions is peculiar;
- * it could be simplified by rewriting the tables.
- */
- for(j=0; j < 8; j++) {
- t = ((j<<1)+j)<<1;
- k = S[j][(preS[t]<<5)+
- (preS[t+1]<<3)+
- (preS[t+2]<<2)+
- (preS[t+3]<<1)+
- (preS[t+4] )+
- (preS[t+5]<<4)];
- t = j << 2;
- f[t ] = (k>>3)&01;
- f[t+1] = (k>>2)&01;
- f[t+2] = (k>>1)&01;
- f[t+3] = (k )&01;
- }
- /* The new R is L ^ f(R, K). The f here has to be permuted first, though. */
- for(j=0; j < 32; j++)
- R[j] = L[j] ^ f[(int)P[j]];
- /* Finally, the new L (the original R) is copied back. */
- for(j=0; j < 32; j++)
- L[j] = tempL[j];
- }
- /* The output L and R are reversed. */
- for(j=0; j < 32; j++) {
- L[j] ^= R[j];
- R[j] ^= L[j];
- L[j] ^= R[j];
- }
- /* The final output gets the inverse permutation of the very original. */
- for(j=0; j < 64; j++)
- block[j] = L[(int)FP[j]];
-}
-
-char * crypt(const char *pw, const char *salt)
-{
- register int i, j, c;
- static char block[66], iobuf[16];
-
- for(i=0; i < 66; i++)
- block[i] = 0;
- for(i=0; (c= *pw) && i < 64; pw++) {
- for(j=0; j < 7; j++, i++)
- block[i] = (c>>(6-j)) & 01;
- i++;
- }
-
- setkey(block);
-
- for(i=0; i < 66; i++)
- block[i] = 0;
-
- for(i=0; i < 2; i++) {
- c = *salt++;
- iobuf[i] = c;
- if(c > 'Z')
- c -= 6;
- if(c > '9')
- c -= 7;
- c -= '.';
- for(j=0; j < 6; j++) {
- if((c>>j) & 01) {
- int ind1 = (((i<<1)+i)<< 1) + j;
- int ind2 = ind1 + 24;
- E[ind1] ^= E[ind2];
- E[ind2] ^= E[ind1];
- E[ind1] ^= E[ind2];
- }
- }
- }
-
- for(i=0; i < 25; i++)
- encrypt(block, 0);
-
- for(i=0; i < 11; i++) {
- c = 0;
- for(j=0; j < 6; j++) {
- c <<= 1;
- c |= block[(((i<<1)+i)<<1)+j];
- }
- c += '.';
- if(c > '9')
- c += 7;
- if(c > 'Z')
- c += 6;
- iobuf[i+2] = c;
- }
- iobuf[i+2] = 0;
- if(iobuf[1] == 0)
- iobuf[1] = iobuf[0];
- return(iobuf);
-}
diff --git a/mdk-stage1/dietlibc/libdl/Makefile b/mdk-stage1/dietlibc/libdl/Makefile
deleted file mode 100644
index c0463f887..000000000
--- a/mdk-stage1/dietlibc/libdl/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# local "test" make file
-
-SRC = $(wildcard *.c) test/test.c
-OBJ = _dl_jump.o $(SRC:.c=.o)
-
-#CFLAGS = -Wall -O2
-CFLAGS = -g
-
-%.o : %.S
- $(HOME)/bin/diet gcc $(CFLAGS) -c -o $@ $^
-
-%.o : %.c
- $(HOME)/bin/diet gcc $(CFLAGS) -c -o $@ $^
-
-all: test.out
-
-test.g: test.c
- gcc -o $@ $^ -ldl
-
-test.out: $(OBJ)
- $(HOME)/bin/diet gcc -o $@ $^
-
-clean:
- $(RM) *.o *.a *.out *~ # *.so
diff --git a/mdk-stage1/dietlibc/libdl/README b/mdk-stage1/dietlibc/libdl/README
deleted file mode 100644
index 5d77bde34..000000000
--- a/mdk-stage1/dietlibc/libdl/README
+++ /dev/null
@@ -1,6 +0,0 @@
-this is the experimental libdl test-pre-pre-alpha code
-
-written by Olaf Dreesen
-
-Shouldn't work yet had some problems with the elf specs...
-and more inconsistencies...
diff --git a/mdk-stage1/dietlibc/libdl/_dl_int.h b/mdk-stage1/dietlibc/libdl/_dl_int.h
deleted file mode 100644
index 659e6ee0f..000000000
--- a/mdk-stage1/dietlibc/libdl/_dl_int.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef ___DL_INT_H__
-#define ___DL_INT_H__
-
-#include <elf.h>
-
-struct _dl_handle {
- /* basic */
- void * mem_base; /* base address of maped *.so */
- unsigned long mem_size; /* len of mem block */
- unsigned int lnk_count; /* reference count */
-
- /* symbol resolve helper */
- unsigned long*hash_tab; /* hash table */
- Elf32_Sym * dyn_sym_tab; /* dynamic symbol table */
- char * dyn_str_tab; /* dyn_name table */
-
- Elf32_Rel * plt_rel; /* PLT relocation table */
-
- /* FINI */
- void (*fini)(void);
-};
-
-#define HASH_BUCKET_LEN(p) ((p))
-#define HASH_BUCKET(p) ((p)+2)
-
-#define HASH_CHAIN_LEN(p) ((p)+1)
-#define HASH_CHAIN(p) ((p)+2+HASH_BUCKET_LEN(p))
-
-unsigned long elf_hash(const unsigned char *name);
-
-#endif
diff --git a/mdk-stage1/dietlibc/libdl/_dl_jump.S b/mdk-stage1/dietlibc/libdl/_dl_jump.S
deleted file mode 100644
index 134f31ea5..000000000
--- a/mdk-stage1/dietlibc/libdl/_dl_jump.S
+++ /dev/null
@@ -1,8 +0,0 @@
-.text
-.global _dl_jump
-_dl_jump:
- call do_rel
- pop %edx
- pop %edx
- jmp *%eax
-
diff --git a/mdk-stage1/dietlibc/libdl/_dl_open.c b/mdk-stage1/dietlibc/libdl/_dl_open.c
deleted file mode 100644
index 1f907db21..000000000
--- a/mdk-stage1/dietlibc/libdl/_dl_open.c
+++ /dev/null
@@ -1,207 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <dlfcn.h>
-#include <linux/elf.h>
-
-#include "_dl_int.h"
-
-struct _dl_handle dl_test;
-
-#define _ELF_DWN_ROUND(ps,n) ((n)&(~((ps)-1)))
-#define _ELF_UP_ROUND(ps,n) ((((n)&((ps)-1))?(ps):0)+ _ELF_DWN_ROUND((ps),(n)))
-#define _ELF_RST_ROUND(ps,n) ((n)&((ps)-1))
-
-void _dl_jump();
-
-/*
- * this file is a Q. & D. hack ... don't think this is bug free or meaningfull
- */
-
-static void *do_map_in(void *base, unsigned long length, int flags, int fd, unsigned long offset)
-{
- int perm = 0;
- if (flags & PF_X) perm|=PROT_EXEC;
- if (flags & PF_R) perm|=PROT_READ;
- if (flags & PF_W) perm|=PROT_WRITE;
- return mmap(base, length, perm, MAP_PRIVATE|((base)?MAP_FIXED:0), fd, offset);
-}
-
-unsigned long do_rel(struct _dl_handle * tmp_dl, unsigned long off)
-{
-// struct _dl_handle * tmp_dl = ((void*)*((&off)-1));
- Elf32_Rel *tmp = ((void*)tmp_dl->plt_rel)+off;
- int sym=ELF32_R_SYM(tmp->r_info);
- register unsigned long sym_val;
-
- printf("do_rel %08x %08x\n",tmp_dl,off);
-
- printf ("do_rel %08x+%x\n",tmp_dl->plt_rel,off);
- printf("do_rel @ %08x with type %d -> %d\n",tmp->r_offset,ELF32_R_TYPE(tmp->r_info),sym);
-
- printf("do_rel sym %08x\n",tmp_dl->dyn_sym_tab[sym].st_value);
-
- /* modify GOT for REAL symbol */
- sym_val=((unsigned long)(tmp_dl->mem_base+tmp_dl->dyn_sym_tab[sym].st_value));
- *((unsigned long*)(tmp_dl->mem_base+tmp->r_offset))=sym_val;
-
- printf("do_rel sym %08x\n",sym_val);
- /* HOWTO JUMP ?!? */
- return sym_val;
-}
-
-void *_dl_open(const char*pathname, int fd, int flag)
-{
- int ps=getpagesize();
- int i;
- unsigned char buf[1024];
- char *m=0,*d;
- struct _dl_handle *ret=0;
-
- unsigned long l;
-
- Elf32_Ehdr *eh;
- Elf32_Phdr *ph;
-
- int ld_nr=0;
- Elf32_Phdr *ld[4]={0,0,0,0};
- Elf32_Phdr *dyn=0;
-
- if (fd==-1) return 0;
-
- printf("_dl_open: %s\n",pathname);
-
- read(fd, buf, 1024);
- eh=(Elf32_Ehdr*)buf;
- ph=(Elf32_Phdr*)&buf[eh->e_phoff];
-
- for (i=0; i<eh->e_phnum; i++) {
- if (ph[i].p_type==PT_LOAD) {
- ld[ld_nr++]=ph+i;
- }
- if (ph[i].p_type==PT_DYNAMIC) {
- dyn=ph+i;
- }
- }
-
- if (ld_nr==1) {
- unsigned long offset = _ELF_DWN_ROUND(ps,ld[0]->p_offset);
- unsigned long off = _ELF_RST_ROUND(ps,ld[0]->p_offset);
- unsigned long length = _ELF_UP_ROUND(ps,ld[0]->p_memsz+off);
- m = (char*)do_map_in(0, length, ld[0]->p_flags, fd, offset);
-
- /* zero pad bss */
- l = ld[0]->p_offset+ld[0]->p_filesz;
- memset(m+l,0,length-l);
-
- dl_test.mem_base=m;
- dl_test.mem_size=length;
- dl_test.lnk_count=0;
-
- ret = &dl_test;
- }
- else if (ld_nr==2) { /* aem... yes Quick & Really Dirty / for the avarage 99% */
- //unsigned long text_addr = _ELF_DWN_ROUND(ps,ld[0]->p_vaddr);
- unsigned long text_offset = _ELF_DWN_ROUND(ps,ld[0]->p_offset);
- unsigned long text_off = _ELF_RST_ROUND(ps,ld[0]->p_offset);
- unsigned long text_size = _ELF_UP_ROUND(ps,ld[0]->p_memsz+text_off);
-
- unsigned long data_addr = _ELF_DWN_ROUND(ps,ld[1]->p_vaddr);
- unsigned long data_offset = _ELF_DWN_ROUND(ps,ld[1]->p_offset);
- unsigned long data_off = _ELF_RST_ROUND(ps,ld[1]->p_offset);
- unsigned long data_size = _ELF_UP_ROUND(ps,ld[1]->p_memsz+data_off);
- unsigned long data_fsize = _ELF_UP_ROUND(ps,ld[1]->p_filesz+data_off);
-
- /* mmap all mem_blocks for *.so */
- l = text_size+data_size;
-
- dl_test.mem_size=l;
-
- m = (char*) do_map_in(0,l,ld[0]->p_flags,fd,text_offset);
-
- /* release data,bss part */
- mprotect(m+data_addr, data_size, PROT_NONE);
-
- /* mmap data,bss part */
- d = (char*) do_map_in(m+data_addr,data_fsize,ld[1]->p_flags,fd,data_offset);
-
- /* zero pad bss */
- l = data_off+ld[1]->p_filesz;
- memset(d+l,0,data_size-l);
-
- /* more bss ? */
- if (data_size>data_fsize) {
- l = data_size-data_fsize;
- mmap(d+data_fsize, l, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
- }
-
- dl_test.mem_base=m;
- dl_test.lnk_count=0;
- ret = &dl_test;
- }
-
- printf("_dl_open pre resolv\n");
- if (ret) {
- Elf32_Dyn* dyn_tab = (void*)m+dyn->p_vaddr;
- void (*init)();
- unsigned long* got=0;
- void* jmprel=0;
- int pltreltype=0;
- int pltrelsize=0;
-
- printf("_dl_open IN resolv\n");
- for(i=0;dyn_tab[i].d_tag;i++) {
- if (dyn_tab[i].d_tag==DT_HASH) {
- ret->hash_tab = (unsigned long*)(m+dyn_tab[i].d_un.d_ptr);
- }
- if (dyn_tab[i].d_tag==DT_SYMTAB) {
- ret->dyn_sym_tab = (Elf32_Sym*)(m+dyn_tab[i].d_un.d_ptr);
- }
- if (dyn_tab[i].d_tag==DT_STRTAB) {
- ret->dyn_str_tab = (char*)(m+dyn_tab[i].d_un.d_ptr);
- }
- if (dyn_tab[i].d_tag==DT_FINI) {
- ret->fini = (void(*)(void))(m+dyn_tab[i].d_un.d_val);
- }
- if (dyn_tab[i].d_tag==DT_INIT) {
- init = (void(*)(void))(m+dyn_tab[i].d_un.d_val);
- printf("init @ %08x\n",init);
- }
- if (dyn_tab[i].d_tag==DT_PLTGOT) {
- got=(unsigned long*)(m+dyn_tab[i].d_un.d_val);
- }
- if (dyn_tab[i].d_tag==DT_PLTREL) {
- pltreltype=dyn_tab[i].d_un.d_val;
- }
- if (dyn_tab[i].d_tag==DT_PLTRELSZ) {
- pltrelsize=dyn_tab[i].d_un.d_val;
- }
- if (dyn_tab[i].d_tag==DT_JMPREL) {
- jmprel=(m+dyn_tab[i].d_un.d_val);
- dl_test.plt_rel=jmprel;
- }
- }
- /* GOT */
- got[0]+=(unsigned long)m;
- got[1]=(unsigned long)&dl_test;
-// got[2]=(unsigned long)do_rel;
- got[2]=(unsigned long)(_dl_jump);
- /* */
-
- if (pltreltype == DT_REL) {
- Elf32_Rel *tmp = jmprel;
- for (;(char*)tmp<(((char*)jmprel)+pltrelsize);(char*)tmp=((char*)tmp)+sizeof(Elf32_Rel)) {
- *((unsigned long*)(m+tmp->r_offset))+=(unsigned long)m;
-// *((unsigned long*)(m+tmp->r_offset))+=(unsigned long)do_rel;
- printf("rel @ %08x with type %d -> %d\n",tmp->r_offset,ELF32_R_TYPE(tmp->r_info),ELF32_R_SYM(tmp->r_info));
- }
- }
-
- printf("_dl_open post resolv, pre init\n");
- init();
- }
- printf("_dl_open post resolv, init\n");
-
- close(fd);
- return ret;
-}
diff --git a/mdk-stage1/dietlibc/libdl/_dl_search.c b/mdk-stage1/dietlibc/libdl/_dl_search.c
deleted file mode 100644
index 5e3217d46..000000000
--- a/mdk-stage1/dietlibc/libdl/_dl_search.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-
-#include <fcntl.h>
-#include <stdio.h>
-
-#define WANT_LD_SO_CONF_SEARCH
-
-static const char *_dl_search_rpath=0;
-void _dl_set_rpath(const char *path) { _dl_search_rpath=path; }
-
-/* search a colon (semicolon) seperated path for the libraray "filename" */
-static int _dl_search_path(char *buf, int len, const char*path, const int pathlen, const char *filename)
-{
- int fd,l=len,i=1;
- const char *c,*pe=path+pathlen;
-
- if (path) {
- for (c=path; c<pe; c+=i) {
- if ((*c==':')||(*c==';')) ++c;
- i=strcspn(c,":;");
- if (i) {
- strncpy(buf, c, i); buf[i]=0;
- l-=i;
- strncat(buf, "/", l);
- }
- else
- buf[0]=0;
- strncat(buf, filename, --l);
-// printf("_dl_search: %s\n",buf);
- if ((fd=open(buf,O_RDONLY))!=-1) return fd;
- }
- }
- return -1;
-}
-
-/* parse the SMALL file "conf" for lib directories (aem... hang me if you can :) ) */
-static int _dl_search_conf(char *buf, int len, const char *conf, const char *filename)
-{
- char ld_so_conf[1024];
- int i,l,fd=open(conf,O_RDONLY);
- if (fd!=-1) {
- l=read(fd,ld_so_conf,sizeof(ld_so_conf)-1);
- ld_so_conf[sizeof(ld_so_conf)-1]=0;
- close(fd);
- if (ld_so_conf[l-1]=='\n') ld_so_conf[--l]=0;
- for (i=0;i<l;i++) if (ld_so_conf[i]=='\n') ld_so_conf[i]=':';
- if ((fd=_dl_search_path(buf,len,ld_so_conf,l,filename))!=-1) return fd;
- }
- return -1;
-}
-
-int _dl_search(char *buf, int len, const char *filename)
-{
- int fd;
-
- /* 1. search the LD_RUN_PATH (from the executable */
- if (_dl_search_rpath) {
- if ((fd=_dl_search_path(buf,len,_dl_search_rpath,strlen(_dl_search_rpath),filename))!=-1) return fd;
- }
-
- /* 2. IF we have a "secure" enviroment THEN search LD_LIBRARY_PATH */
- if (getuid()==geteuid()) {
- char *p=getenv("LD_LIBRARY_PATH");
- if (p)
- if ((fd=_dl_search_path(buf,len,p,strlen(p),filename))!=-1) return fd;
- }
-
- /* 3. search all pathes in the the /etc/diet.ld.conf, a dietlibc extension :) */
- if ((fd=_dl_search_conf(buf,len,"/etc/diet.ld.conf",filename))!=-1) return fd;
-
-#ifdef WANT_LD_SO_CONF_SEARCH
- /* 4. search all pathes in the the /etc/ld.so.conf / can't handle this ...=lib?? crap */
- if ((fd=_dl_search_conf(buf,len,"/etc/ld.so.conf",filename))!=-1) return fd;
-#endif
-
- /* default path search */
- {
- const char* def_path="/usr/lib:/lib";
- return _dl_search_path(buf,len,def_path,strlen(def_path),filename);
- }
-}
diff --git a/mdk-stage1/dietlibc/libdl/dlclose.c b/mdk-stage1/dietlibc/libdl/dlclose.c
deleted file mode 100644
index 384550c47..000000000
--- a/mdk-stage1/dietlibc/libdl/dlclose.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "_dl_int.h"
-
-int dlclose (void *handle)
-{
- if (handle) {
- struct _dl_handle *h = handle;
- if (h->lnk_count) {
- --h->lnk_count;
- return -1;
- }
- if (munmap(h->mem_base,h->mem_size)!=0) return -1;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libdl/dlerror.c b/mdk-stage1/dietlibc/libdl/dlerror.c
deleted file mode 100644
index 1e31bae54..000000000
--- a/mdk-stage1/dietlibc/libdl/dlerror.c
+++ /dev/null
@@ -1,4 +0,0 @@
-const char *dlerror(void)
-{
- return "HAE ?!?";
-}
diff --git a/mdk-stage1/dietlibc/libdl/dlopen.c b/mdk-stage1/dietlibc/libdl/dlopen.c
deleted file mode 100644
index 1693d889f..000000000
--- a/mdk-stage1/dietlibc/libdl/dlopen.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <fcntl.h>
-#include <dlfcn.h>
-#include <limits.h>
-
-int _dl_search(char*buf, int bufsize, const char*filename);
-void *_dl_open(const char*pathname, int fd, int flag);
-
-void *dlopen (const char *filename, int flag)
-{
- int fd;
- char buf[PATH_MAX];
- const char *p;
- if (*filename=='/')
- fd=open(p=filename,O_RDONLY);
- else {
- p=buf;
- fd=_dl_search(buf,sizeof(buf),filename);
- }
-
- return _dl_open(p,fd,flag);
-}
diff --git a/mdk-stage1/dietlibc/libdl/dlsym.c b/mdk-stage1/dietlibc/libdl/dlsym.c
deleted file mode 100644
index 2af940837..000000000
--- a/mdk-stage1/dietlibc/libdl/dlsym.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "_dl_int.h"
-
-void *dlsym(void *handle, char *symbol)
-{
- printf("dlsym(%08x,%s) -> %08x\n",handle,symbol,elf_hash(symbol)%17);
- return 0;
-}
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/liblatin1/latin1-iscntrl.c b/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c
deleted file mode 100644
index b0c3605b0..000000000
--- a/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <ctype.h>
-
-int iscntrl(int c) {
- return (c<32) || (c>=127 && c<=160);
-}
diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c b/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c
deleted file mode 100644
index c8d4a5df0..000000000
--- a/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int isgraph(int c) {
- return (c>=33 && c<=126) || (c>=161 && c<=255);
-}
-
diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-islower.c b/mdk-stage1/dietlibc/liblatin1/latin1-islower.c
deleted file mode 100644
index cab1a5171..000000000
--- a/mdk-stage1/dietlibc/liblatin1/latin1-islower.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <ctype.h>
-
-int islower(int c) {
- return (c>='a' && c<='z') || (c>=223 && c<=255 && c!=247);
-}
diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c b/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c
deleted file mode 100644
index f632483a0..000000000
--- a/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c
+++ /dev/null
@@ -1,4 +0,0 @@
-
-int isprint(int c) {
- return (c>=32 && c<=126) || (c>=160 && c<=255);
-}
diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c b/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c
deleted file mode 100644
index 1c1d59db8..000000000
--- a/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <ctype.h>
-
-int isupper(int c) {
- return (c>='A' && c<='Z') || (c>=192 && c<=222 && c!=215);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/CHANGES b/mdk-stage1/dietlibc/libpthread/CHANGES
deleted file mode 100644
index d39d990ba..000000000
--- a/mdk-stage1/dietlibc/libpthread/CHANGES
+++ /dev/null
@@ -1,45 +0,0 @@
-This is the pthread implementation of dietlibc.
-Written from scratch by Olaf Dreesen.
-
-Thu Apr 12 16:47:12 MEST 2001
-
- added conditional variables...
- except pthread_cond_timedwait all should work man-page like
- pthread_cond_timedwait dosen't handle cancel request according to man-page
-
- added thread specific key handling (all according to man-page)
-
-Fri Mar 30 18:47:37 MEST 2001
-
- uff found some logic errors and fixed them.
- pthread_create had a problem with user provided stacks.
-
-
-Fri Mar 23 14:09:54 MET 2001
-
- arg.. the kernel-header are so inconsistent...
- on x86 it works on arm and sparc not due to MISSING defines, miss-places
- includes and __KERNEL__ checks....
- the best in this category is that the kernel-header are changed that the
- buggy (g)libc haven't to change... (f..k glibc, the headers HAVE to be
- CONSISTENT)
- a public defined symbol on arch X have to be in Y to unless marked...
- that is mainly speaking SCHED.H ! arg....
-
-
-Wed Mar 14 04:28:45 MET 2001
-
- I have implemented the "Manager Thread" so that nested thread creation
- works. really ugly stuff... don't look at it unless you're sitting on solid
- ground.
-
-
-Mon Mar 12 16:16:00 CET 2001
-
- first of all:
- I strongly suggest NOT to use it yet, it's very, very, ... very
- experimental. I guess you got the point. there is still much debug code,
- incomplete functions and unusable states....
-
- I'm still working on the final alpha...
-
diff --git a/mdk-stage1/dietlibc/libpthread/Makefile b/mdk-stage1/dietlibc/libpthread/Makefile
deleted file mode 100644
index 06420f43a..000000000
--- a/mdk-stage1/dietlibc/libpthread/Makefile
+++ /dev/null
@@ -1,139 +0,0 @@
-all: libpthread.a
-
-ARCH=$(shell uname -m | sed 's/i[4-9]86/i386/')
-
-CFLAGS=-pipe
-CROSS=
-
-CC=gcc
-
-VPATH=../$(ARCH)/
-
-PTHREAD_OBJS = \
- __testandset.o \
- \
- thread_internal.o \
- thread_key.o \
- \
- pthread_once.o pthread_spinlock.o \
- \
- pthread_create.o pthread_detach.o \
- pthread_join.o pthread_self.o \
- pthread_exit.o \
- \
- pthread_cleanup_push.o \
- pthread_cleanup_pop.o \
- \
- pthread_attr_getdetachstate.o \
- pthread_attr_getinheritsched.o \
- pthread_attr_getschedparam.o \
- pthread_attr_getschedpolicy.o \
- pthread_attr_getscope.o \
- pthread_attr_getstackaddr.o \
- pthread_attr_getstacksize.o \
- pthread_attr_init.o \
- pthread_attr_setdetachstate.o \
- pthread_attr_setinheritsched.o \
- pthread_attr_setschedparam.o \
- pthread_attr_setschedpolicy.o \
- pthread_attr_setscope.o \
- pthread_attr_setstackaddr.o \
- pthread_attr_setstacksize.o \
- \
- pthread_cancel.o pthread_setcancelstate.o \
- pthread_setcanceltype.o pthread_testcancel.o \
- \
- pthread_mutex_init.o \
- pthread_mutex_destroy.o \
- pthread_mutex_lock.o \
- pthread_mutex_trylock.o \
- pthread_mutex_unlock.o \
- \
- pthread_mutexattr_getkind_np.o \
- pthread_mutexattr_init.o \
- pthread_mutexattr_setkind_np.o \
- \
- pthread_condattr.o \
- pthread_cond_broadcast.o \
- pthread_cond_destroy.o \
- pthread_cond_init.o \
- pthread_cond_signal.o \
- pthread_cond_timedwait.o \
- pthread_cond_wait.o \
- \
- pthread_key_create.o \
- pthread_key_delete.o \
- pthread_getspecific.o \
- pthread_setspecific.o \
- \
- pthread_atfork.o \
- pthread_sys_alloc.o \
- pthread_sys_close.o \
- pthread_sys_create.o \
- pthread_sys_fcntl.o \
- pthread_sys_fsync.o \
- pthread_sys_nanosleep.o \
- pthread_sys_logging.o \
- pthread_sys_open.o \
- pthread_sys_pause.o \
- pthread_sys_read.o \
- pthread_sys_sigsuspend.o \
- pthread_sys_tcdrain.o \
- pthread_sys_waitpid.o \
- pthread_sys_write.o
-
-%.o : %.c
- $(CC) $(CFLAGS) -c -o $@ $?
-
-include ../$(ARCH)/Makefile.add
-
-ifeq ($(CFLAGS),-pipe)
-CFLAGS+=-O -fomit-frame-pointer
-endif
-
-#CFLAGS = -g
-CFLAGS += -Wall
-
-CFLAGS += -I.. -I../include -Wall
-
-PWD=$(shell pwd)
-
-.SUFFIXES:
-.SUFFIXES: .S .c
-
-% :: %,v
-
-%.o: %.S
- $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $<
-
-%.o: %.c
- $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $<
-# $(CROSS)strip -x -R .comment -R .note $@
-
-libpthread.a: $(PTHREAD_OBJS)
- ar cr $@ $^
-
-libpthread.so: libpthread.a
- $(CROSS)ld -whole-archive -shared -o $@ $^
-
-
-clean:
- $(RM) *.o *.a *.so *.out *~
-
-exports: libpthread.a
- nm -g libpthread.a | grep -w T | awk '{ print $$3 }' | sort -u > exports
-
-.PHONY: test.out
-
-test.out: test.o libpthread.a $(LIBS)
- $(CROSS)$(CC) -g $(CFLAGS) -nostdlib ../bin-$(ARCH)/start.o -o $@ $^ ../bin-$(ARCH)/dietlibc.a -lgcc
-
-
-.PHONY: sparc ppc mips arm alpha i386
-
-sparc ppc alpha i386:
- $(MAKE) ARCH=$@ CROSS=$@-linux- all t libdietc.so
-
-mips arm:
- $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all t libdietc.so
-
diff --git a/mdk-stage1/dietlibc/libpthread/README b/mdk-stage1/dietlibc/libpthread/README
deleted file mode 100644
index 3139c731d..000000000
--- a/mdk-stage1/dietlibc/libpthread/README
+++ /dev/null
@@ -1,42 +0,0 @@
-LIBPTHREAD
-
- This is the pthread implementation of dietlibc.
- Written from scratch by Olaf Dreesen.
-
-1. STATUS: incomplete but should work (or not... I had a lot of heisen-bugs...)
- On non i386 archs the kernel header have major differences...
- NO workaround yet for this problems...
-
-It's like linuxthreads a clone base thread implementation.
-
-I have implemented a "Manager Thread" with all the pain it involves...
-Nested thread creation is now working fine...
-
-
-2. HOW-TO make this lib:
-
- 1. generate the dietlibc in the parent directory.
- and make sure you have WANT_THREAD_SAVE active in the file:
- dietfeatures.h
-
- 2. change back here and type make
-
- and then you should have a libpthread.a
-
-
-3. NOTES
-
-NON STANDARD SIGNAL HANDLING for the threads:
-
- SIGHUP the targeted thread is canceled
- depends on the cancel type of the thread.
-
- ASYNCHRONOUS: the signal handler will KILL the thread immediately.
-
- DEFERRED: the signal handler mark its thread as canceled.
- (only for the sig-handler to do some sane stuff...)
-
- SIGTERM the thread is KILLED
- if the thread signaled is the main thread, then ALL child-threads
- will get a SIGHUP and after some micros a SIGTERM....
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_atfork.c b/mdk-stage1/dietlibc/libpthread/pthread_atfork.c
deleted file mode 100644
index 2dc612dcc..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_atfork.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-#define PTHREAD_NUM_ATFORK 4
-
-static struct _pthread_fastlock __atfork_struct_lock;
-static struct {
- int used;
- void (*prepare)(void);
- void (*parent)(void);
- void (*child)(void);
-} pthread_atfork_buf[PTHREAD_NUM_ATFORK];
-
-int pthread_atfork(void (*prepare)(void),
- void (*parent)(void),
- void (*child)(void))
-{
- int i,ret=-1;
-
- __NO_ASYNC_CANCEL_BEGIN;
- __pthread_lock(&__atfork_struct_lock);
-
- for (i=0;i<PTHREAD_NUM_ATFORK; ++i) {
- if (!(pthread_atfork_buf[i].used)) {
- pthread_atfork_buf[i].prepare=prepare;
- pthread_atfork_buf[i].parent=parent;
- pthread_atfork_buf[i].child=child;
- ret=0;
- break;
- }
- }
-
- __pthread_unlock(&__atfork_struct_lock);
- __NO_ASYNC_CANCEL_END;
-
- if (ret) (*(__errno_location()))=ENOMEM;
- return ret;
-}
-
-pid_t fork(void)
-{
- pid_t pid;
- int i=PTHREAD_NUM_ATFORK;
-
- __NO_ASYNC_CANCEL_BEGIN;
-
- __TEST_CANCEL();
- __pthread_lock(&__atfork_struct_lock);
-
- while (i) {
- if (pthread_atfork_buf[--i].used)
- if (pthread_atfork_buf[i].prepare)
- pthread_atfork_buf[i].prepare();
- }
-
- pid=__libc_fork();
-
- if (pid>0) { /* parent */
- for (i=0;i<PTHREAD_NUM_ATFORK;++i)
- if (pthread_atfork_buf[i].used)
- if (pthread_atfork_buf[i].parent)
- pthread_atfork_buf[i].parent();
- } else if (pid==0) { /* child */
- for (i=0;i<PTHREAD_NUM_ATFORK;++i)
- if (pthread_atfork_buf[i].used)
- if (pthread_atfork_buf[i].child)
- pthread_atfork_buf[i].child();
- }
-
- __pthread_unlock(&__atfork_struct_lock);
- __NO_ASYNC_CANCEL_END;
-
- return pid;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getdetachstate.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getdetachstate.c
deleted file mode 100644
index ccdfc0e47..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getdetachstate.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
-{
- __THREAD_INIT();
-
- *detachstate=attr->__detachstate;
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getinheritsched.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getinheritsched.c
deleted file mode 100644
index 314fd8ade..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getinheritsched.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit)
-{
- __THREAD_INIT();
-
- *inherit = attr->__inheritsched;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedparam.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedparam.c
deleted file mode 100644
index f0a9a07d1..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedparam.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param)
-{
- __THREAD_INIT();
-
- param->sched_priority=attr->__schedparam.sched_priority;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedpolicy.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedpolicy.c
deleted file mode 100644
index 53f1bed8c..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedpolicy.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
-{
- __THREAD_INIT();
-
- *policy = attr->__schedpolicy;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getscope.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getscope.c
deleted file mode 100644
index 99a33110d..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getscope.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
-{
- __THREAD_INIT();
-
- *scope=PTHREAD_SCOPE_SYSTEM;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstackaddr.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getstackaddr.c
deleted file mode 100644
index d71421901..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstackaddr.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stack)
-{
- __THREAD_INIT();
-
- *stack=attr->__stackaddr;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstacksize.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getstacksize.c
deleted file mode 100644
index 4785979a0..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstacksize.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize)
-{
- __THREAD_INIT();
-
- *stacksize=attr->__stacksize;
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c
deleted file mode 100644
index 726e88fe5..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_init(pthread_attr_t *attr)
-{
- __THREAD_INIT();
-
- memset(attr,0,sizeof(pthread_attr_t));
- attr->__stacksize=PTHREAD_STACK_SIZE;
- return 0;
-}
-
-int pthread_attr_destroy(pthread_attr_t *attr) __attribute__((alias("pthread_attr_init")));
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c
deleted file mode 100644
index 690ad5f8e..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
-{
- __THREAD_INIT();
-
- if ((detachstate == PTHREAD_CREATE_JOINABLE) ||
- (detachstate == PTHREAD_CREATE_DETACHED)) {
- attr->__detachstate=detachstate;
- return 0;
- }
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c
deleted file mode 100644
index f38e6e35e..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
-{
- __THREAD_INIT();
-
- if ((inherit==PTHREAD_INHERIT_SCHED) ||
- (inherit==PTHREAD_EXPLICIT_SCHED)) {
- attr->__inheritsched=inherit;
- return 0;
- }
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c
deleted file mode 100644
index 833c0111b..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param)
-{
- __THREAD_INIT();
-
- if ((attr->__schedpolicy == SCHED_OTHER) && (param->sched_priority == 0)) {
- attr->__schedparam.sched_priority=0;
- return 0;
- }
- if (((attr->__schedpolicy == SCHED_RR) || (attr->__schedpolicy == SCHED_RR))
- && ((param->sched_priority > 0) && (param->sched_priority < 100))) {
- attr->__schedparam.sched_priority=param->sched_priority;
- return 0;
- }
- (*(__errno_location()))=EINVAL;
- return -1;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c
deleted file mode 100644
index e845bca32..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
-{
- __THREAD_INIT();
-
- if (policy==SCHED_OTHER) {
- attr->__schedpolicy=policy;
- return 0;
- }
- if ((policy==SCHED_FIFO) || (policy==SCHED_RR)) {
- if (geteuid()==0) {
- attr->__schedpolicy=policy;
- return 0;
- }
- (*(__errno_location()))=ENOTSUP;
- }
- else
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c
deleted file mode 100644
index 39088c9b2..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_setscope(pthread_attr_t *attr, int scope)
-{
- __THREAD_INIT();
-
- if (scope==PTHREAD_SCOPE_SYSTEM) return 0;
-
- if (scope==PTHREAD_SCOPE_PROCESS)
- (*(__errno_location()))=ENOTSUP;
- else
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstackaddr.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setstackaddr.c
deleted file mode 100644
index 4b320cd9d..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstackaddr.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack)
-{
- __THREAD_INIT();
-
- attr->__stackaddr=stack;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c
deleted file mode 100644
index cfbab7747..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
-{
- __THREAD_INIT();
-
- if (stacksize>=PTHREAD_STACK_SIZE) {
- attr->__stacksize=stacksize;
- return 0;
- }
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cancel.c b/mdk-stage1/dietlibc/libpthread/pthread_cancel.c
deleted file mode 100644
index 4c87a3ed1..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cancel.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_cancel(pthread_t th)
-{
- pthread_t j;
- _pthread_descr thread;
-
- __THREAD_INIT();
-
- j=__find_thread_id(th);
-
- if (j==-1) {
- (*(__errno_location()))=ESRCH;
- return -1;
- }
- thread = __get_thread_struct(j);
-
- if (thread==0) {
- (*(__errno_location()))=ESRCH;
- return -1;
- }
-
- if (thread->cancelstate!=PTHREAD_CANCEL_DISABLE) {
- thread->canceled=1;
- if (thread->canceltype!=PTHREAD_CANCEL_DEFERRED) {
- kill(thread->pid,SIGHUP);
- }
- }
-
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_pop.c b/mdk-stage1/dietlibc/libpthread/pthread_cleanup_pop.c
deleted file mode 100644
index 641bb6083..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_pop.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-void pthread_cleanup_pop(int execute)
-{
- _pthread_descr this;
- struct thread_cleanup_t tmp;
- int i=PTHREAD_MAX_CLEANUP;
-
- __THREAD_INIT();
-
- this = __thread_self();
-
- while(i>0) {
- if (this->cleanup_stack[--i].func) {
- tmp.func=this->cleanup_stack[i].func;
- tmp.arg=this->cleanup_stack[i].arg;
- this->cleanup_stack[i].func=0;
- break;
- }
- }
-
- if (execute) tmp.func(tmp.arg);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_push.c b/mdk-stage1/dietlibc/libpthread/pthread_cleanup_push.c
deleted file mode 100644
index cd2aabf71..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_push.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-void pthread_cleanup_push(void (*func)(void*), void *arg)
-{
- _pthread_descr this;
- int i;
-
- __THREAD_INIT();
-
- this = __thread_self();
-
- for (i=0; i<PTHREAD_MAX_CLEANUP; ++i) {
- if (this->cleanup_stack[i].func==0) {
- this->cleanup_stack[i].func=func;
- this->cleanup_stack[i].arg=arg;
- break;
- }
- }
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c
deleted file mode 100644
index d3c2274f3..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_cond_broadcast(pthread_cond_t *cond)
-{
- _pthread_descr tmp;
-
- __THREAD_INIT();
-
- __pthread_lock(&(cond->lock));
- while ((tmp=cond->wait_chain)) {
- cond->wait_chain=tmp->waitnext;
- tmp->waitnext=0;
- tmp->waiting=0;
- }
- __pthread_unlock(&(cond->lock));
-
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c
deleted file mode 100644
index 9a6cc4f0b..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_cond_destroy(pthread_cond_t *cond)
-{
- __THREAD_INIT();
-
- if (cond->wait_chain) {
- (*__errno_location())=EBUSY;
- return 1;
- }
-
- memset(cond,0,sizeof(pthread_cond_t));
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c
deleted file mode 100644
index 20b38bef2..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *cond_attr)
-{
- __THREAD_INIT();
-
- memset(cond,0,sizeof(pthread_cond_t));
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c
deleted file mode 100644
index 60bf2119c..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_cond_signal(pthread_cond_t *cond)
-{
- _pthread_descr tmp=0;
-
- __THREAD_INIT();
-
- __pthread_lock(&(cond->lock));
- if ((tmp=cond->wait_chain)) cond->wait_chain=tmp->waitnext;
- __pthread_unlock(&(cond->lock));
-
- if (tmp) {
- tmp->waitnext=0;
- tmp->waiting=0;
- }
-
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c
deleted file mode 100644
index 6613f2ca9..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- const struct timespec *abstime)
-{
- _pthread_descr tmp;
- _pthread_descr this;
- int ret;
-
- __THREAD_INIT();
-
- this=__thread_self();
-
- /* put in wait-chain */
- __pthread_lock(&(cond->lock));
- this->waiting=1;
- if (cond->wait_chain) {
- for(tmp=cond->wait_chain;tmp->waitnext;tmp=tmp->waitnext);
- tmp->waitnext=this;
- } else cond->wait_chain=this;
- __pthread_unlock(&(cond->lock));
-
- /* Aeh yeah / wait till signal */
- pthread_mutex_unlock(mutex);
- ret=nanosleep(abstime,0);
- pthread_mutex_lock(mutex);
-
- __TEST_CANCEL();
-
- if (ret) {
- if ((*__errno_location())!=EINTR) return -1;
- return 0;
- }
-
- (*__errno_location())=ETIMEDOUT;
- return -1;
-}
-
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c
deleted file mode 100644
index 0c6c0ae13..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
-{
- _pthread_descr tmp;
- _pthread_descr this;
-
- __THREAD_INIT();
-
- this=__thread_self();
-
- /* put in wait-chain */
- __pthread_lock(&(cond->lock));
- this->waiting=1;
- if (cond->wait_chain) {
- for(tmp=cond->wait_chain;tmp->waitnext;tmp=tmp->waitnext);
- tmp->waitnext=this;
- } else cond->wait_chain=this;
- __pthread_unlock(&(cond->lock));
-
- /* Aeh yeah / wait till signal */
- pthread_mutex_unlock(mutex);
- while (this->waiting) {
- __thread_wait_some_time();
- if (this->canceled) this->waiting=0; /* we got a cancel signal */
- }
- pthread_mutex_lock(mutex);
-
- __TEST_CANCEL();
- return 0;
-}
-
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_condattr.c b/mdk-stage1/dietlibc/libpthread/pthread_condattr.c
deleted file mode 100644
index c537890ba..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_condattr.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <pthread.h>
-
-int pthread_condattr_init(pthread_condattr_t *attr)
-{
- return 0;
-}
-
-int pthread_condattr_destroy(pthread_condattr_t *attr)
-__attribute__((alias("pthread_condattr_init")));
-
-int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared)
-__attribute__((alias("pthread_condattr_init")));
-
-int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
-__attribute__((alias("pthread_condattr_init")));
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_create.c b/mdk-stage1/dietlibc/libpthread/pthread_create.c
deleted file mode 100644
index b4a499081..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_create.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_create (pthread_t *thread, const pthread_attr_t *attr,
- void *(*start_routine) (void *), void *arg)
-{
- int ret=0;
- _pthread_descr td;
- pthread_attr_t default_attr;
-
- __THREAD_INIT();
-
- if (start_routine==0) {
- (*(__errno_location()))=EINVAL;
- return -1;
- }
-
- td = __thread_get_free();
-
- if (td) {
- if (!(attr)) {
- pthread_attr_init(&default_attr);
- attr=&default_attr;
- }
-
- if ((td->policy!=SCHED_OTHER)&&(td->priority==0)) {
- (*(__errno_location()))=EINVAL;
- return -1;
- }
-
- if (attr->__inheritsched==PTHREAD_INHERIT_SCHED) {
- _pthread_descr this = __thread_self();
- td->policy = this->policy;
- td->priority = this->priority;
- } else {
- td->policy = attr->__schedpolicy;
- td->priority = attr->__schedparam.sched_priority;
- }
-
- td->func = start_routine;
- td->arg = arg;
-
- td->detached = attr->__detachstate;
-
- td->stack_size = attr->__stacksize;
-
- if (!(td->stack_addr)) {
- char *stack=(char*)malloc(td->stack_size);
- if (!(stack)) {
- (*(__errno_location()))=EINVAL;
- return -1;
- }
- td->stack_begin = stack;
- td->stack_addr = stack+td->stack_size;
- } else {
- td->stack_begin = 0;
- td->stack_addr = attr->__stackaddr;
- }
-
- ret = signal_manager_thread(td);
-
- if (ret>1)
- *thread=ret;
- else
- __thread_cleanup(td);
- }
- else
- (*(__errno_location()))=EAGAIN;
-
- if (ret<2) return -1;
- return ret;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_detach.c b/mdk-stage1/dietlibc/libpthread/pthread_detach.c
deleted file mode 100644
index c07280389..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_detach.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_detach(pthread_t th)
-{
- pthread_t j;
- _pthread_descr thread;
-
- __THREAD_INIT();
-
- j=__find_thread_id(th);
-
- if (j==-1) {
- (*(__errno_location()))=ESRCH;
- return -1;
- }
- thread = __get_thread_struct(j);
-
- if (thread==0) {
- (*(__errno_location()))=ESRCH;
- return -1;
- }
-
- if (thread->detached) {
- (*(__errno_location()))=EINVAL;
- return -1;
- }
-
- if (!thread->joined) {
- thread->detached=1;
- }
-
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_exit.c b/mdk-stage1/dietlibc/libpthread/pthread_exit.c
deleted file mode 100644
index 41eac0a33..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_exit.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-void pthread_exit(void *retval)
-{
- _pthread_descr this;
-
- __THREAD_INIT();
-
- this = __thread_self();
- this->retval = retval;
-
- longjmp(this->jmp_exit,1);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_getspecific.c b/mdk-stage1/dietlibc/libpthread/pthread_getspecific.c
deleted file mode 100644
index c2f84c814..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_getspecific.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX];
-const void *pthread_getspecific(pthread_key_t key)
-{
- int id;
- __THREAD_INIT();
-
- id=__find_thread_id(getpid());
-
- if ((key<PTHREAD_KEYS_MAX) && (__thread_keys[key].used)) {
- return __thread_keys[key].tkd[id];
- }
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_join.c b/mdk-stage1/dietlibc/libpthread/pthread_join.c
deleted file mode 100644
index 5b295bad1..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_join.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "thread_internal.h"
-#include <pthread.h>
-
-int pthread_join(pthread_t th, void **thread_return)
-{
- pthread_t j;
- _pthread_descr this, thread;
-
- __THREAD_INIT();
-
- this = __thread_self();
- j=__find_thread_id(th);
-
- if (j==-1) {
- (*(__errno_location()))=ESRCH;
- return -1;
- }
-
- thread = __get_thread_struct(j);
-
- /* error handling */
- if (thread==0) {
- (*(__errno_location()))=ESRCH;
- return -1;
- }
-
- if (this==thread) {
- (*(__errno_location()))=EDEADLK;
- return -1;
- }
-
- if (thread->detached || thread->joined) {
- (*(__errno_location()))=EINVAL;
- return -1;
- }
-
- thread->joined=this;
- this->join=1;
-
- while(this->join) __thread_wait_some_time();
-
- if (thread_return) *thread_return=this->retval;
-
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_key_create.c b/mdk-stage1/dietlibc/libpthread/pthread_key_create.c
deleted file mode 100644
index 44fccea6a..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_key_create.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-extern struct _pthread_fastlock __thread_keys_lock;
-extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX];
-int pthread_key_create(pthread_key_t *key, void (*destructor)(const void*))
-{
- int ret=-1,i;
-
- __THREAD_INIT();
-
- __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].used=1;
- __thread_keys[i].destructor=destructor;
- memset(__thread_keys[i].tkd,0,PTHREAD_THREADS_MAX*sizeof(struct _thread_key));
- *key=i;
- ret=0;
- break;
- }
- }
-
- __pthread_unlock(&__thread_keys_lock);
- __NO_ASYNC_CANCEL_END;
-
- if (ret) (*__errno_location())=EAGAIN;
- return ret;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c b/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c
deleted file mode 100644
index b1bc366e2..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX];
-int pthread_key_delete(pthread_key_t key)
-{
- __THREAD_INIT();
-
- if (key>=PTHREAD_KEYS_MAX) {
- (*__errno_location())=EINVAL;
- return -1;
- }
-
- __thread_keys[key].used=0;
-
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c
deleted file mode 100644
index 33a16abd4..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_mutex_destroy(pthread_mutex_t *mutex)
-{
- __THREAD_INIT();
-
- if ((mutex->owner)||(mutex->lock.__spinlock)) {
- (*(__errno_location()))=EBUSY;
- return -1;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c
deleted file mode 100644
index b1797fb20..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_mutex_init(pthread_mutex_t *mutex,
- const pthread_mutexattr_t *mutexattr)
-{
- __THREAD_INIT();
-
- memset(mutex,0,sizeof(pthread_mutex_t));
- if (mutexattr) {
- mutex->kind=mutexattr->__mutexkind;
- }
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c
deleted file mode 100644
index 0c3ade9e8..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <unistd.h>
-#include <sched.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-/* will never return EINVAL ! */
-
-int pthread_mutex_lock(pthread_mutex_t *mutex)
-{
- _pthread_descr this;
-
- __THREAD_INIT();
-
- this = __thread_self();
-
- if (this!=mutex->owner) {
- /* wait for mutex to free */
- __pthread_lock(&(mutex->lock));
-
- mutex->owner=this;
- }
- else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP)
- {
- (*(__errno_location()))=EDEADLK;
- return -1;
- }
-
- if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) ++(mutex->count);
-
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c
deleted file mode 100644
index fcf63f75e..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <unistd.h>
-#include <sched.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-/* will never return EINVAL ! */
-
-int pthread_mutex_trylock(pthread_mutex_t *mutex)
-{
- _pthread_descr this;
-
- __THREAD_INIT();
-
- this = __thread_self();
-
- if (this!=mutex->owner) {
- /* wait for mutex to free */
- if (__pthread_trylock(&(mutex->lock))) {
- (*(__errno_location()))=EBUSY;
- return -1;
- }
-
- mutex->owner=this;
- }
- else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP)
- {
- (*(__errno_location()))=EDEADLK;
- return -1;
- }
-
- if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) ++(mutex->count);
-
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c
deleted file mode 100644
index 0b5a1d0f7..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <unistd.h>
-#include <sched.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-/* will never return EINVAL ! */
-
-int pthread_mutex_unlock(pthread_mutex_t *mutex)
-{
- _pthread_descr this;
-
- __THREAD_INIT();
-
- this = __thread_self();
-
- if (this==mutex->owner) {
- if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) {
- if (--(mutex->count))
- return 0;
- }
-
- mutex->owner=0;
- __pthread_unlock(&(mutex->lock));
- }
- else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP)
- {
- (*(__errno_location()))=EPERM;
- return -1;
- }
-
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_getkind_np.c b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_getkind_np.c
deleted file mode 100644
index 63cd9133c..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_getkind_np.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind)
-{
- __THREAD_INIT();
-
- *kind=attr->__mutexkind;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_init.c b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_init.c
deleted file mode 100644
index ff60e4c74..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_init.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_mutexattr_init(pthread_mutexattr_t *attr)
-{
- __THREAD_INIT();
-
- attr->__mutexkind = 0;
- return 0;
-}
-
-int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) __attribute__((alias ("pthread_mutexattr_init")));
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c
deleted file mode 100644
index ac600f8ed..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
-{
- __THREAD_INIT();
-
- if ((kind==PTHREAD_MUTEX_FAST_NP) || (kind==PTHREAD_MUTEX_RECURSIVE_NP) ||
- (kind==PTHREAD_MUTEX_ERRORCHECK_NP)) {
- attr->__mutexkind=kind;
- return 0;
- }
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_once.c b/mdk-stage1/dietlibc/libpthread/pthread_once.c
deleted file mode 100644
index 16d9cb392..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_once.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <pthread.h>
-#include "thread_internal.h"
-
-int __pthread_once (pthread_once_t* once_control, void (*init_routine)(void))
-{
- if (!(__testandset(once_control))) init_routine();
- return 0;
-}
-int pthread_once (pthread_once_t* once_control, void (*init_routine)(void)) __attribute__((alias("__pthread_once")));
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_self.c b/mdk-stage1/dietlibc/libpthread/pthread_self.c
deleted file mode 100644
index 394686dd4..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_self.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <unistd.h>
-#include <pthread.h>
-
-pthread_t pthread_self() { return getpid(); }
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c b/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c
deleted file mode 100644
index b906492fb..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_setcancelstate(int state, int *oldstate)
-{
- _pthread_descr thread;
-
- __THREAD_INIT();
-
- if ((state==PTHREAD_CANCEL_ENABLE) || (state==PTHREAD_CANCEL_DISABLE))
- {
- thread = __thread_self();
-
- if (oldstate) *oldstate = thread->cancelstate;
- thread->cancelstate = state;
-
- return 0;
- }
-
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c b/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c
deleted file mode 100644
index 03d1f53de..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pthread_setcanceltype(int type, int *oldtype)
-{
- _pthread_descr thread;
-
- __THREAD_INIT();
-
- if ((type==PTHREAD_CANCEL_DEFERRED) || (type==PTHREAD_CANCEL_ASYNCHRONOUS))
- {
- thread = __thread_self();
-
- if (oldtype) *oldtype = thread->canceltype;
- thread->canceltype = type;
-
- return 0;
- }
-
- (*(__errno_location()))=EINVAL;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c b/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c
deleted file mode 100644
index 78339c20b..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX];
-int pthread_setspecific(pthread_key_t key, const void *value)
-{
- int id;
- __THREAD_INIT();
-
- id=__find_thread_id(getpid());
- if ((key<PTHREAD_KEYS_MAX) && (__thread_keys[key].used)) {
- __thread_keys[key].tkd[id]=value;
- return 0;
- }
- (*__errno_location())=EINVAL;
- return -1;
-}
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c b/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c
deleted file mode 100644
index 449782adf..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <time.h>
-#include <pthread.h>
-#include "thread_internal.h"
-
-static void __pthread_acquire(int * spinlock)
-{
- int cnt = 0;
- struct timespec tm;
-
- while (__testandset(spinlock)) {
- if (cnt < MAX_SPIN_COUNT) {
- sched_yield();
- cnt++;
- } else {
- tm.tv_sec = 0;
- tm.tv_nsec = SPIN_SLEEP_DURATION;
- __libc_nanosleep(&tm, 0);
- cnt = 0;
- }
- }
-}
-
-void __pthread_lock(struct _pthread_fastlock * lock)
-{
- __pthread_acquire(&lock->__spinlock);
-}
-
-int __pthread_trylock(struct _pthread_fastlock * lock)
-{
- return __testandset(&lock->__spinlock);
-}
-
-int __pthread_unlock(struct _pthread_fastlock * lock)
-{
- return (lock->__spinlock = 0);
-}
-
-
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c
deleted file mode 100644
index 9f7d23d79..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-static pthread_mutex_t mutex_alloc = PTHREAD_MUTEX_INITIALIZER;
-
-void free(void *ptr)
-{
- __NO_ASYNC_CANCEL_BEGIN;
- pthread_mutex_lock(&mutex_alloc);
- __libc_free(ptr);
- pthread_mutex_unlock(&mutex_alloc);
- __NO_ASYNC_CANCEL_END;
-}
-
-void *malloc(size_t size)
-{
- register void *ret;
- __NO_ASYNC_CANCEL_BEGIN;
- pthread_mutex_lock(&mutex_alloc);
- ret=__libc_malloc(size);
- pthread_mutex_unlock(&mutex_alloc);
- __NO_ASYNC_CANCEL_END;
- return ret;
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_close.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_close.c
deleted file mode 100644
index 84d5d5f36..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_close.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int close(int fd)
-{
- __TEST_CANCEL();
- return __libc_close(fd);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_create.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_create.c
deleted file mode 100644
index 9d47844f5..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_create.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int creat(const char *pathname, mode_t mode)
-{
- __TEST_CANCEL();
- return __libc_creat(pathname,mode);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c
deleted file mode 100644
index 99210a488..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int fcntl(int fd, int cmd, void *arg)
-{
- __TEST_CANCEL();
- return __libc_fcntl(fd,cmd,arg);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_fsync.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_fsync.c
deleted file mode 100644
index a2c995069..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_fsync.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int fsync(int fd)
-{
- __TEST_CANCEL();
- return __libc_fsync(fd);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c
deleted file mode 100644
index 6070ad219..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <unistd.h>
-#include <stdarg.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-static pthread_mutex_t mutex_syslog = PTHREAD_MUTEX_INITIALIZER;
-
-void closelog(void)
-{
- pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock,&mutex_syslog);
- pthread_mutex_lock(&mutex_syslog);
- __libc_closelog();
- pthread_cleanup_pop(1);
-}
-
-void openlog(const char *ident, int option, int facility)
-{
- pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock,&mutex_syslog);
- pthread_mutex_lock(&mutex_syslog);
- __libc_openlog(ident, option, facility);
- pthread_cleanup_pop(1);
-}
-
-void vsyslog(int priority, const char *format, va_list arg_ptr)
-{
- pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock,&mutex_syslog);
- pthread_mutex_lock(&mutex_syslog);
- __libc_vsyslog(priority, format, arg_ptr);
- pthread_cleanup_pop(1);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_nanosleep.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_nanosleep.c
deleted file mode 100644
index 699de4654..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_nanosleep.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <time.h>
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int nanosleep(const struct timespec *req, struct timespec *rem)
-{
- __TEST_CANCEL();
- return __libc_nanosleep(req,rem);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c
deleted file mode 100644
index 513f6a323..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int __pthread_open(const char *pathname, int flags, mode_t mode)
-{
- __TEST_CANCEL();
- return __libc_open(pathname,flags,mode);
-}
-
-int open(const char *pathname, int flags, ...) __attribute__((alias("__pthread_open")));
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_pause.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_pause.c
deleted file mode 100644
index ab15ead11..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_pause.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int pause()
-{
- __TEST_CANCEL();
- return __libc_pause();
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_read.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_read.c
deleted file mode 100644
index 60f886003..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_read.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int read(int fd, void *buf, size_t count)
-{
- __TEST_CANCEL();
- return __libc_read(fd,buf,count);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_sigsuspend.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_sigsuspend.c
deleted file mode 100644
index 72cd783ae..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_sigsuspend.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int sigsuspend(const sigset_t *mask)
-{
- __TEST_CANCEL();
- return __libc_sigsuspend(mask);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c
deleted file mode 100644
index 1ac33adfc..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int tcdrain(int fd)
-{
- __TEST_CANCEL();
- return __libc_tcdrain(fd);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c
deleted file mode 100644
index 76d5ddca7..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-pid_t waitpid(pid_t pid, int *status, int options)
-{
- __TEST_CANCEL();
- return __libc_waitpid(pid,status,options);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_write.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_write.c
deleted file mode 100644
index 37541ae42..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_write.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <unistd.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-int write(int fd, const void *buf, size_t count)
-{
- __TEST_CANCEL();
- return __libc_write(fd,buf,count);
-}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c b/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c
deleted file mode 100644
index 68f91e743..000000000
--- a/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <errno.h>
-
-#include <pthread.h>
-#include "thread_internal.h"
-
-void pthread_testcancel()
-{
- _pthread_descr thread;
- __THREAD_INIT();
-
- thread=__thread_self();
-
- if (thread->canceled) {
- pthread_exit(PTHREAD_CANCELED);
- }
-}
diff --git a/mdk-stage1/dietlibc/libpthread/test.c b/mdk-stage1/dietlibc/libpthread/test.c
deleted file mode 100644
index 3272c1753..000000000
--- a/mdk-stage1/dietlibc/libpthread/test.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <stdio.h>
-#include <pthread.h>
-
-#include <unistd.h>
-#include <signal.h>
-
-#include <errno.h>
-
-int ra;
-
-void test(int sig)
-{
- printf("SIGNAL %d in %d\n",sig,getpid());
- fflush(stdout);
- signal(SIGHUP, test);
-}
-
-void* thread(void* arg)
-{
- int i;
- for (i=0;i<10; i++)
- {
- printf("child %ld %8p\n", pthread_self(),arg);
- sleep(1);
- }
- return arg;
-}
-
-void* thread2(void *arg)
-{
- pthread_t t;
- int i;
-
- printf("child %ld %8p\n", pthread_self(),arg);
- for (i=0; i<3; ++i) {
- printf("child starting next in %d secs %ld %8p\n", 3-i, pthread_self(),arg);
- sleep(1);
- }
- pthread_create(&t,0, thread, (void*)2);
- printf("new child @ %ld\n",t);
- return (void*)t;
-}
-
-int main(int argc, char*argv[])
-{
- pthread_t t;
-
- signal(SIGHUP, test);
-
- pthread_create(&t,0, thread2, 0);
- pthread_create(&t,0, thread, (void *)3);
- pthread_create(&t,0, thread, (void *)1);
-
- puts("main");
-
-#if 0
- {
- int i;
- for(i=0;i<4;i++) sleep(1);
- }
-#else
- {
- int *tt;
- int i = pthread_join(t,(void*)&tt);
- printf("join %d %p %d\n",i,tt,(*(__errno_location())));
- }
-#endif
-
- puts("main exit");
-
- return 0;
-}
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_internal.h b/mdk-stage1/dietlibc/libpthread/thread_internal.h
deleted file mode 100644
index 5eb3bbd08..000000000
--- a/mdk-stage1/dietlibc/libpthread/thread_internal.h
+++ /dev/null
@@ -1,131 +0,0 @@
-#ifndef __THREAD_INTERNAL_H__
-#define __THREAD_INTERNAL_H__
-
-#include <pthread.h>
-#include <stdarg.h>
-#include <setjmp.h>
-#include "dietfeatures.h"
-#ifndef WANT_THREAD_SAFE
-#error "the diet libc is not compiled with thread safeness enabled!"
-#endif
-
-/* cleanup */
-#define PTHREAD_MAX_CLEANUP 8
-struct thread_cleanup_t {
- void (*func)(void*);
- void *arg;
-};
-
-/* the thread descriptor / internal */
-struct _pthread_descr_struct {
- /* runtime handling */
- struct _pthread_descr_struct *joined; /* a joined thread or NULL */
-
- /* conditional variables */
- struct _pthread_descr_struct *waitnext; /* an other waiting thread or NULL */
- int waiting; /* internal waiting "lock" */
-
- /* thread/process data */
- int pid; /* Process id */
-
- int policy; /* thread scheduling policy */
- int priority; /* thread priority */
-
- /* errno handling */
- int errno;
- int h_errno;
-
- /* stack handling */
- unsigned int stack_size; /* stack size for setrlimit */
- void *stack_addr; /* stack address for clone */
- void *stack_begin; /* begin of lib-stack / lowest address (free) */
-
- /* thread exit handling */
- void *retval; /* thread return value */
- int join; /* thread waits for other to return */
- jmp_buf jmp_exit; /* pthread_exit jump */
-
- /* thread flags */
- int detached; /* thread is detached */
- int canceled; /* thread canceled */
-
- /* cancel handling */
- int cancelstate; /* cancel state */
- int canceltype; /* type of cancellation */
-
- /* thread basics */
- void* (*func) (void* arg); /* thread function */
- void* arg; /* thread argument */
-
- /* create thread / manager thread lock */
- struct _pthread_fastlock *manager_lock;
-
- /* cleanup stack */
- struct thread_cleanup_t cleanup_stack[PTHREAD_MAX_CLEANUP];
-
-} __attribute__ ((aligned(32)));
-
-/* thread keys */
-struct _thread_key {
- int used;
- void (*destructor)(const void*);
- const void *tkd[PTHREAD_THREADS_MAX];
-};
-
-/* internal stuff */
-int __testandset(int *spinlock);
-
-void __pthread_lock(struct _pthread_fastlock * lock);
-int __pthread_trylock(struct _pthread_fastlock * lock);
-int __pthread_unlock(struct _pthread_fastlock * lock);
-
-int __clone(void* (*fn)(void*), void* stack, int flags, void *arg);
-
-int __find_thread_id(int pid);
-_pthread_descr __get_thread_struct(int id);
-
-_pthread_descr __thread_get_free();
-_pthread_descr __thread_self();
-
-void __thread_cleanup(_pthread_descr th);
-
-void __thread_wait_some_time();
-
-#define __NO_ASYNC_CANCEL_BEGIN { int oldtype; pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);
-#define __NO_ASYNC_CANCEL_END pthread_setcanceltype(oldtype,0); pthread_testcancel(); }
-#define __NO_ASYNC_CANCEL_STOP pthread_setcanceltype(oldtype,0); }
-
-/* manager thread stuff */
-int signal_manager_thread(_pthread_descr td);
-
-/* init stuff */
-extern pthread_once_t __thread_inited;
-void __thread_init();
-#define __THREAD_INIT() __pthread_once(&__thread_inited, __thread_init)
-#define __TEST_CANCEL() pthread_testcancel()
-
-/* diet libc syscalls */
-
-void __libc_free(void *ptr);
-void *__libc_malloc(size_t size);
-
-void __libc_closelog(void);
-void __libc_openlog(const char *ident, int option, int facility);
-void __libc_vsyslog(int priority, const char *format, va_list arg_ptr);
-
-pid_t __libc_fork(void);
-
-int __libc_close(int fd);
-int __libc_creat(const char *pathname, mode_t mode);
-int __libc_fcntl(int fd, int cmd, void *arg);
-int __libc_fsync(int fd);
-int __libc_nanosleep(const struct timespec *req, struct timespec *rem);
-int __libc_open(const char *pathname, int flags, mode_t mode);
-int __libc_pause(void);
-int __libc_read(int fd, void *buf, size_t count);
-int __libc_sigsuspend(const sigset_t *mask);
-int __libc_tcdrain(int fd);
-pid_t __libc_waitpid(pid_t pid, int *status, int options);
-int __libc_write(int fd, const void *buf, size_t count);
-
-#endif
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/libregex/rx.c b/mdk-stage1/dietlibc/libregex/rx.c
deleted file mode 100644
index b28358c2e..000000000
--- a/mdk-stage1/dietlibc/libregex/rx.c
+++ /dev/null
@@ -1,434 +0,0 @@
-#include <regex.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <string.h>
-
-/* this is ugly.
- * the idea is to build a parse tree, then do some poor man's OOP with a
- * generic matcher function call that is always that the start of each
- * record, and a next pointer. When the parse tree is done, we need to
- * recursively set the next pointers to point to the part of the parse
- * tree that needs to match next.
- * This is the prototype of the generic match function call pointer.
- * The first argument is the "this" pointer, the second is the text to
- * be matched against, ofs is the offset from the start of the matched
- * text (so we can match "^") and matches is an array where match
- * positions are stored. */
-/* now declared in regex.h: */
-/* typedef int (*matcher)(void*,const char*,int ofs,regmatch_t* matches,int plus,int eflags); */
-
-/* one would think that this is approach is an order of magnitude slower
- * than the standard NFA approach, but it isn't. The busybox grep took
- * 0.26 seconds for a fixed string compared to 0.19 seconds for the
- * glibc regex. */
-
-/* first part: parse a regex into a parse tree */
-struct bracketed {
- unsigned int cc[32];
-};
-
-/* now declared in regex.h:
-struct regex {
- matcher m;
- void* next;
- int pieces;
- int num;
- struct branch *b;
-}; */
-
-struct atom {
- matcher m;
- void* next;
- enum { EMPTY, REGEX, BRACKET, ANY, LINESTART, LINEEND, WORDSTART, WORDEND, CHAR, } type;
- int bnum;
- union {
- struct regex r;
- struct bracketed b;
- char c;
- } u;
-};
-
-struct piece {
- matcher m;
- void* next;
- struct atom a;
- unsigned char min,max;
-};
-
-struct branch {
- matcher m;
- void* next;
- int num;
- struct piece *p;
-};
-
-static void clearcc(unsigned int* x) {
- memset(x,0,sizeof(*x));
-}
-
-static void setcc(unsigned int* x,unsigned int bit) {
- x[bit/32]|=(1<<((bit%32)-1));
-}
-
-static int issetcc(unsigned int* x,unsigned int bit) {
- return x[bit/32] & (1<<((bit%32)-1));
-}
-
-static const char* parsebracketed(struct bracketed*__restrict__ b,const char*__restrict__ s,regex_t*__restrict__ rx) {
- const char* t;
- int i,negflag=0;
- if (*s!='[') return s;
- t=s+1;
- clearcc(b->cc);
- if (*t=='^') { negflag=1; ++t; }
- do {
- if (*t==0) return s;
- setcc(b->cc,rx->cflags&REG_ICASE?*t:tolower(*t));
- if (t[1]=='-' && t[2]!=']') {
- for (i=*t+1; i<=t[2]; ++i) setcc(b->cc,rx->cflags&REG_ICASE?i:tolower(i));
- t+=2;
- }
- ++t;
- } while (*t!=']');
- if (negflag) for (i=0; i<32; ++i) b->cc[i]=~b->cc[i];
- return t+1;
-}
-
-static const char* parseregex(struct regex* r,const char* s,regex_t* rx);
-
-static int matchatom(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) {
- register struct atom* a=(struct atom*)x;
- int matchlen=0;
- switch (a->type) {
- case EMPTY:
-// printf("matching EMPTY against \"%s\"\n",s);
- preg->l[a->bnum].rm_so=preg->l[a->bnum].rm_eo=ofs;
- goto match;
- case REGEX:
-// printf("matching REGEX against \"%s\"\n",s);
- if ((matchlen=a->u.r.m(a,s,ofs,preg,0,eflags))>=0) {
- preg->l[a->bnum].rm_so=ofs;
- preg->l[a->bnum].rm_eo=ofs+matchlen;
- goto match;
- }
- break;
- case BRACKET:
-// printf("matching BRACKET against \"%s\"\n",s);
- matchlen=1;
- if (*s=='\n' && (preg->cflags&REG_NEWLINE)) break;
- if (*s && issetcc(a->u.b.cc,(preg->cflags&REG_ICASE?tolower(*s):*s)))
- goto match;
- break;
- case ANY:
-// printf("matching ANY against \"%s\"\n",s);
- if (*s=='\n' && (preg->cflags&REG_NEWLINE)) break;
- matchlen=1;
- if (*s) goto match;
- break;
- case LINESTART:
-// printf("matching LINESTART against \"%s\"\n",s);
- if (ofs==0 && (eflags&REG_NOTBOL)==0) {
- goto match;
- }
- break;
- case LINEEND:
-// printf("matching LINEEND against \"%s\"\n",s);
- if ((*s && *s!='\n') || (eflags&REG_NOTEOL)==0) break;
- goto match;
- case WORDSTART:
- if ((ofs==0 || isspace(s[-1])) && !isspace(*s))
- goto match;
- break;
- case WORDEND:
- if (ofs>0 && !isspace(s[-1]) && isspace(*s))
- goto match;
- break;
- case CHAR:
-// printf("matching CHAR %c against \"%s\"\n",a->u.c,s);
- matchlen=1;
- if (((preg->cflags&REG_ICASE)?tolower(*s):*s)==a->u.c) goto match;
- break;
- }
- return -1;
-match:
- if (a->next)
- return ((struct atom*)(a->next))->m(a->next,s+matchlen,ofs+matchlen,preg,plus+matchlen,eflags);
- else
- return plus+matchlen;
-}
-
-static const char* parseatom(struct atom*__restrict__ a,const char*__restrict__ s,regex_t*__restrict__ rx) {
- const char *tmp;
- a->m=matchatom;
- a->bnum=-1;
- switch (*s) {
- case '(':
- a->bnum=++rx->brackets;
- if (s[1]==')') {
- a->type=EMPTY;
- return s+2;
- }
- a->type=REGEX;
- if ((tmp=parseregex(&a->u.r,s+1,rx))!=s) {
- if (*tmp==')')
- return tmp+1;
- }
- case 0:
- case '|':
- case ')':
- return s;
- case '[':
- a->type=BRACKET;
- if ((tmp=parsebracketed(&a->u.b,s,rx))!=s)
- return tmp;
- return s;
- case '.':
- a->type=ANY;
- break;
- case '^':
- a->type=LINESTART;
- break;
- case '$':
- a->type=LINEEND;
- break;
- case '\\':
- if (!*++s) return s;
- if (*s=='<') {
- a->type=WORDSTART;
- break;
- } else if (*s=='>') {
- a->type=WORDEND;
- break;
- }
- default:
- a->type=CHAR;
- a->u.c=rx->cflags&REG_ICASE?*s:tolower(*s);
- break;
- }
- return s+1;
-}
-
-/* needs to do "greedy" matching, i.e. match as often as possible */
-static int matchpiece(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) {
- register struct piece* a=(struct piece*)x;
- int matchlen=0;
- int tmp,num=0;
- unsigned int *offsets=alloca(sizeof(int)*a->max);
- offsets[0]=0;
-// printf("matchpiece \"%s\"...\n",s);
- /* first, try to match the atom as often as possible, up to a->max times */
- if (a->max == 1 && a->min == 1)
- return a->a.m(&a->a,s+matchlen,ofs+matchlen,preg,0,eflags);
- while (num<a->max) {
- void* save=a->a.next;
- a->a.next=0;
- if ((tmp=a->a.m(&a->a,s+matchlen,ofs+matchlen,preg,0,eflags))>=0) {
- a->a.next=save;
- ++num;
- matchlen+=tmp;
- offsets[num]=tmp;
- } else {
- a->a.next=save;
- break;
- }
- }
- if (num<a->min) return -1; /* already at minimum matches; signal mismatch */
- /* then, while the rest does not match, back off */
- for (;;) {
- if (a->next)
- tmp=((struct atom*)(a->next))->m(a->next,s+matchlen,ofs+matchlen,preg,plus+matchlen,eflags);
- else
- tmp=plus+matchlen;
- if (tmp>=0) break; /* it did match; don't back off any further */
- matchlen-=offsets[num];
- --num;
- }
- return tmp;
-}
-
-static const char* parsepiece(struct piece*__restrict__ p,const char*__restrict__ s,regex_t*__restrict__ rx) {
- const char* tmp=parseatom(&p->a,s,rx);
- if (tmp==s) return s;
- p->m=matchpiece;
- p->min=p->max=1;
- switch (*tmp) {
- case '*': p->min=0; p->max=RE_DUP_MAX; break;
- case '+': p->min=1; p->max=RE_DUP_MAX; break;
- case '?': p->min=0; p->max=1; break;
- case '{':
- if (isdigit(*++tmp)) {
- p->min=*tmp-'0'; p->max=RE_DUP_MAX;
- while (isdigit(*++tmp)) p->min=p->min*10+*tmp-'0';
- if (*tmp==',') {
- if (isdigit(*++tmp)) {
- p->max=*tmp-'0';
- while (isdigit(*++tmp)) p->max=p->max*10+*tmp-'0';
- }
- }
- if (*tmp!='}') return s;
- ++tmp;
- }
- default:
- return tmp;
- }
- return tmp+1;
-}
-
-/* trivial, just pass through */
-static int matchbranch(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) {
- register struct branch* a=(struct branch*)x;
- int tmp;
- tmp=a->p->m(a->p,s,ofs,preg,plus,eflags);
- if (tmp>=0) {
- if (a->next)
- return ((struct atom*)(a->next))->m(a->next,s+tmp,ofs+tmp,preg,plus+tmp,eflags);
- else
- return plus+tmp;
- }
- return -1;
-}
-
-static const char* parsebranch(struct branch*__restrict__ b,const char*__restrict__ s,regex_t*__restrict__ rx,int*__restrict__ pieces) {
- struct piece p;
- const char *tmp;
- b->m=matchbranch;
- b->num=0; b->p=0;
- for (;;) {
- if (*s=='|') {
- if (b->num==0) {
- tmp=s+1;
- p.a.type=EMPTY;
- p.min=p.max=1;
- }
- } else {
- tmp=parsepiece(&p,s,rx);
- if (tmp==s) return s;
- }
- if (!(b->p=realloc(b->p,++b->num*sizeof(p)))) return s;
- b->p[b->num-1]=p;
- if (*s=='|') { ++tmp; break; }
- s=tmp;
- }
- *pieces+=b->num;
- return tmp;
-}
-
-/* try the branches one by one */
-static int matchregex(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) {
- register struct regex* a=(struct regex*)x;
- int i,tmp;
- for (i=0; i<a->num; ++i) {
- tmp=a->b[i].m(&a->b[i],s,ofs,preg,plus,eflags);
- if (tmp>=0) {
- if (a->next)
- return ((struct atom*)(a->next))->m(a->next,s+tmp,ofs+tmp,preg,plus+tmp,eflags);
- else
- return plus+tmp;
- }
- }
- return -1;
-}
-
-static const char* parseregex(struct regex*__restrict__ r,const char*__restrict__ s,regex_t*__restrict__ p) {
- struct branch b;
- const char *tmp;
- r->m=matchregex;
- r->num=0; r->b=0; r->pieces=0;
- for (;;) {
- tmp=parsebranch(&b,s,p,&r->pieces);
- if (tmp==s) return s;
- if (!(r->b=realloc(r->b,++r->num*sizeof(b)))) return s;
- r->b[r->num-1]=b;
- s=tmp;
- }
- return tmp;
-}
-
-
-/* The matcher relies on the presence of next pointers, of which the
- * parser does not know the correct destination. So we need an
- * additional pass through the data structure that sets the next
- * pointers correctly. */
-static void regex_putnext(struct regex* r,void* next);
-
-static void atom_putnext(struct atom*__restrict__ a,void*__restrict__ next) {
- a->next=next;
- if (a->type==REGEX)
- regex_putnext(&a->u.r,next);
-}
-
-static void piece_putnext(struct piece*__restrict__ p,void*__restrict__ next) {
- p->next=next;
- atom_putnext(&p->a,next);
-}
-
-static void branch_putnext(struct branch*__restrict__ b,void*__restrict__ next) {
- int i;
- for (i=0; i<b->num-1; ++i)
- piece_putnext(&b->p[i],&b->p[i+1]);
- piece_putnext(&b->p[i],0);
- b->next=next;
-}
-
-static void regex_putnext(struct regex*__restrict__ r,void*__restrict__ next) {
- int i;
- for (i=0; i<r->num; ++i)
- branch_putnext(&r->b[i],next);
- r->next=next;
-}
-
-
-
-int regcomp(regex_t*__restrict__ preg, const char*__restrict__ regex, int cflags) {
- const char* t=parseregex(&preg->r,regex,preg);
- if (t==regex) return -1;
- regex_putnext(&preg->r,0);
- preg->cflags=cflags;
- return 0;
-}
-
-int regexec(const regex_t*__restrict__ preg, const char*__restrict__ string, size_t nmatch, regmatch_t pmatch[], int eflags) {
- int matched;
- const char *orig=string;
- ((regex_t*)preg)->l=alloca(sizeof(regmatch_t)*(preg->brackets+1));
- while (*string) {
- matched=preg->r.m((void*)&preg->r,string,string-orig,(regex_t*)preg,0,eflags);
- if (matched>=0) {
- if ((preg->cflags&REG_NOSUB)==0) memmove(pmatch,preg->l,nmatch*sizeof(regmatch_t));
- return 0;
- }
- ++string; eflags|=REG_NOTBOL;
- }
- return REG_NOMATCH;
-}
-
-
-
-void regfree(regex_t* preg) {
- int i;
- for (i=0; i<preg->r.num; ++i) {
- free(preg->r.b[i].p);
- free(preg->r.b);
- }
-}
-
-size_t regerror(int errcode, const regex_t*__restrict__ preg, char*__restrict__ errbuf, size_t errbuf_size) {
- strncpy(errbuf,"invalid regular expression (sorry)",errbuf_size);
- return strlen(errbuf);
-}
-
-
-
-
-#if 0
-int main() {
- struct regex r;
- int bnum=-1;
- const char* t=parseregex(&r,"^a*ab$",&bnum);
- regex_putnext(&r,0);
- printf("%d pieces, %s\n",r.pieces,t);
- printf("%d\n",r.m(&r,"aaab",0,0,0));
- return 0;
-}
-#endif
diff --git a/mdk-stage1/dietlibc/librpc/auth_none.c b/mdk-stage1/dietlibc/librpc/auth_none.c
deleted file mode 100644
index 7a4dffe87..000000000
--- a/mdk-stage1/dietlibc/librpc/auth_none.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * auth_none.c
- * Creates a client authentication handle for passing "null"
- * credentials and verifiers to remote systems.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#define MAX_MARSHEL_SIZE 20
-
-/*
- * Authenticator operations routines
- */
-static void authnone_verf();
-static void authnone_destroy();
-static bool_t authnone_marshal();
-static bool_t authnone_validate();
-static bool_t authnone_refresh();
-
-static struct auth_ops ops = {
- authnone_verf,
- authnone_marshal,
- authnone_validate,
- authnone_refresh,
- authnone_destroy
-};
-
-static struct authnone_private {
- AUTH no_client;
- char marshalled_client[MAX_MARSHEL_SIZE];
- u_int mcnt;
-} *authnone_private;
-
-AUTH *authnone_create()
-{
- register struct authnone_private *ap = authnone_private;
- XDR xdr_stream;
- register XDR *xdrs;
-
- if (ap == 0) {
- ap = (struct authnone_private *) calloc(1, sizeof(*ap));
- if (ap == 0)
- return (0);
- authnone_private = ap;
- }
- if (!ap->mcnt) {
- ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
- ap->no_client.ah_ops = &ops;
- xdrs = &xdr_stream;
- xdrmem_create(xdrs, ap->marshalled_client,
- (u_int) MAX_MARSHEL_SIZE, XDR_ENCODE);
- (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
- (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
- ap->mcnt = XDR_GETPOS(xdrs);
- XDR_DESTROY(xdrs);
- }
- return (&ap->no_client);
-}
-
- /*ARGSUSED*/ static bool_t authnone_marshal(client, xdrs)
-AUTH *client;
-XDR *xdrs;
-{
- register struct authnone_private *ap = authnone_private;
-
- if (ap == 0)
- return (0);
- return ((*xdrs->x_ops->x_putbytes) (xdrs,
- ap->marshalled_client, ap->mcnt));
-}
-
-static void authnone_verf()
-{
-}
-
-static bool_t authnone_validate()
-{
-
- return (TRUE);
-}
-
-static bool_t authnone_refresh()
-{
-
- return (FALSE);
-}
-
-static void authnone_destroy()
-{
-}
diff --git a/mdk-stage1/dietlibc/librpc/auth_unix.c b/mdk-stage1/dietlibc/librpc/auth_unix.c
deleted file mode 100644
index 5daeb5f4a..000000000
--- a/mdk-stage1/dietlibc/librpc/auth_unix.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* @(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * auth_unix.c, Implements UNIX style authentication parameters.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * The system is very weak. The client uses no encryption for it's
- * credentials and only sends null verifiers. The server sends backs
- * null verifiers or optionally a verifier that suggests a new short hand
- * for the credentials.
- *
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <string.h>
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#include <rpc/auth_unix.h>
-
-/*
- * Unix authenticator operations vector
- */
-static void authunix_nextverf();
-static bool_t authunix_marshal();
-static bool_t authunix_validate();
-static bool_t authunix_refresh();
-static void authunix_destroy();
-
-static struct auth_ops auth_unix_ops = {
- authunix_nextverf,
- authunix_marshal,
- authunix_validate,
- authunix_refresh,
- authunix_destroy
-};
-
-/*
- * This struct is pointed to by the ah_private field of an auth_handle.
- */
-struct audata {
- struct opaque_auth au_origcred; /* original credentials */
- struct opaque_auth au_shcred; /* short hand cred */
- u_long au_shfaults; /* short hand cache faults */
- char au_marshed[MAX_AUTH_BYTES];
- u_int au_mpos; /* xdr pos at end of marshed */
-};
-
-#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private)
-
-static void marshal_new_auth();
-
-
-/*
- * Create a unix style authenticator.
- * Returns an auth handle with the given stuff in it.
- */
-AUTH *authunix_create __P ((char *machname, uid_t uid,
- gid_t gid, int len,
- gid_t *aup_gids))
-{
- struct authunix_parms aup;
- char mymem[MAX_AUTH_BYTES];
- struct timeval now;
- XDR xdrs;
- register AUTH *auth;
- register struct audata *au;
-
- /*
- * Allocate and set up auth handle
- */
- auth = (AUTH *) mem_alloc(sizeof(*auth));
-#ifndef KERNEL
- if (auth == NULL) {
- (void) fprintf(stderr, "authunix_create: out of memory\n");
- return (NULL);
- }
-#endif
- au = (struct audata *) mem_alloc(sizeof(*au));
-#ifndef KERNEL
- if (au == NULL) {
- (void) fprintf(stderr, "authunix_create: out of memory\n");
- return (NULL);
- }
-#endif
- auth->ah_ops = &auth_unix_ops;
- auth->ah_private = (caddr_t) au;
- auth->ah_verf = au->au_shcred = _null_auth;
- au->au_shfaults = 0;
-
- /*
- * fill in param struct from the given params
- */
- (void) gettimeofday(&now, (struct timezone *) 0);
- aup.aup_time = now.tv_sec;
- aup.aup_machname = machname;
- aup.aup_uid = uid;
- aup.aup_gid = gid;
- aup.aup_len = (u_int) len;
- aup.aup_gids = aup_gids;
-
- /*
- * Serialize the parameters into origcred
- */
- xdrmem_create(&xdrs, mymem, MAX_AUTH_BYTES, XDR_ENCODE);
- if (!xdr_authunix_parms(&xdrs, &aup))
- abort();
- au->au_origcred.oa_length = len = XDR_GETPOS(&xdrs);
- au->au_origcred.oa_flavor = AUTH_UNIX;
-#ifdef KERNEL
- au->au_origcred.oa_base = mem_alloc((u_int) len);
-#else
- if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) {
- (void) fprintf(stderr, "authunix_create: out of memory\n");
- return (NULL);
- }
-#endif
- bcopy(mymem, au->au_origcred.oa_base, (u_int) len);
-
- /*
- * set auth handle to reflect new cred.
- */
- auth->ah_cred = au->au_origcred;
- marshal_new_auth(auth);
- return (auth);
-}
-
-/*
- * Returns an auth handle with parameters determined by doing lots of
- * syscalls.
- */
-AUTH *authunix_create_default()
-{
- register int len;
- char machname[MAX_MACHINE_NAME + 1];
- register int uid;
- register int gid;
- gid_t gids[NGRPS];
-
- if (gethostname(machname, MAX_MACHINE_NAME) == -1)
- abort();
- machname[MAX_MACHINE_NAME] = 0;
- uid = geteuid();
- gid = getegid();
- if ((len = getgroups(NGRPS, gids)) < 0)
- abort();
- return (authunix_create(machname, uid, gid, len, gids));
-}
-
-/*
- * authunix operations
- */
-
-static void authunix_nextverf(auth)
-AUTH *auth;
-{
- /* no action necessary */
-}
-
-static bool_t authunix_marshal(auth, xdrs)
-AUTH *auth;
-XDR *xdrs;
-{
- register struct audata *au = AUTH_PRIVATE(auth);
-
- return (XDR_PUTBYTES(xdrs, au->au_marshed, au->au_mpos));
-}
-
-static bool_t authunix_validate(auth, verf)
-register AUTH *auth;
-struct opaque_auth verf;
-{
- register struct audata *au;
- XDR xdrs;
-
- if (verf.oa_flavor == AUTH_SHORT) {
- au = AUTH_PRIVATE(auth);
- xdrmem_create(&xdrs, verf.oa_base, verf.oa_length, XDR_DECODE);
-
- if (au->au_shcred.oa_base != NULL) {
- mem_free(au->au_shcred.oa_base, au->au_shcred.oa_length);
- au->au_shcred.oa_base = NULL;
- }
- if (xdr_opaque_auth(&xdrs, &au->au_shcred)) {
- auth->ah_cred = au->au_shcred;
- } else {
- xdrs.x_op = XDR_FREE;
- (void) xdr_opaque_auth(&xdrs, &au->au_shcred);
- au->au_shcred.oa_base = NULL;
- auth->ah_cred = au->au_origcred;
- }
- marshal_new_auth(auth);
- }
- return (TRUE);
-}
-
-static bool_t authunix_refresh(auth)
-register AUTH *auth;
-{
- register struct audata *au = AUTH_PRIVATE(auth);
- struct authunix_parms aup;
- struct timeval now;
- XDR xdrs;
- register int stat;
-
- if (auth->ah_cred.oa_base == au->au_origcred.oa_base) {
- /* there is no hope. Punt */
- return (FALSE);
- }
- au->au_shfaults++;
-
- /* first deserialize the creds back into a struct authunix_parms */
- aup.aup_machname = NULL;
- aup.aup_gids = (gid_t *) NULL;
- xdrmem_create(&xdrs, au->au_origcred.oa_base,
- au->au_origcred.oa_length, XDR_DECODE);
- stat = xdr_authunix_parms(&xdrs, &aup);
- if (!stat)
- goto done;
-
- /* update the time and serialize in place */
- (void) gettimeofday(&now, (struct timezone *) 0);
- aup.aup_time = now.tv_sec;
- xdrs.x_op = XDR_ENCODE;
- XDR_SETPOS(&xdrs, 0);
- stat = xdr_authunix_parms(&xdrs, &aup);
- if (!stat)
- goto done;
- auth->ah_cred = au->au_origcred;
- marshal_new_auth(auth);
- done:
- /* free the struct authunix_parms created by deserializing */
- xdrs.x_op = XDR_FREE;
- (void) xdr_authunix_parms(&xdrs, &aup);
- XDR_DESTROY(&xdrs);
- return (stat);
-}
-
-static void authunix_destroy(auth)
-register AUTH *auth;
-{
- register struct audata *au = AUTH_PRIVATE(auth);
-
- mem_free(au->au_origcred.oa_base, au->au_origcred.oa_length);
-
- if (au->au_shcred.oa_base != NULL)
- mem_free(au->au_shcred.oa_base, au->au_shcred.oa_length);
-
- mem_free(auth->ah_private, sizeof(struct audata));
-
- if (auth->ah_verf.oa_base != NULL)
- mem_free(auth->ah_verf.oa_base, auth->ah_verf.oa_length);
-
- mem_free((caddr_t) auth, sizeof(*auth));
-}
-
-/*
- * Marshals (pre-serializes) an auth struct.
- * sets private data, au_marshed and au_mpos
- */
-static void marshal_new_auth(auth)
-register AUTH *auth;
-{
- XDR xdr_stream;
- register XDR *xdrs = &xdr_stream;
- register struct audata *au = AUTH_PRIVATE(auth);
-
- xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
- if ((!xdr_opaque_auth(xdrs, &(auth->ah_cred))) ||
- (!xdr_opaque_auth(xdrs, &(auth->ah_verf)))) {
- perror("auth_none.c - Fatal marshalling problem");
- } else {
- au->au_mpos = XDR_GETPOS(xdrs);
- }
- XDR_DESTROY(xdrs);
-}
diff --git a/mdk-stage1/dietlibc/librpc/authunix_prot.c b/mdk-stage1/dietlibc/librpc/authunix_prot.c
deleted file mode 100644
index ddcadb808..000000000
--- a/mdk-stage1/dietlibc/librpc/authunix_prot.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* @(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * authunix_prot.c
- * XDR for UNIX style authentication parameters for RPC
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/auth.h>
-#include <rpc/auth_unix.h>
-
-/*
- * XDR for unix authentication parameters.
- */
-bool_t xdr_authunix_parms(xdrs, p)
-register XDR *xdrs;
-register struct authunix_parms *p;
-{
- int a,b;
-
- if (xdr_u_long(xdrs, &(p->aup_time))
- && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
- && xdr_int(xdrs, &a)
- && xdr_int(xdrs, &b)
- && xdr_array(xdrs, (caddr_t *) & (p->aup_gids),
- &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int)) {
- p->aup_uid=(uid_t)a;
- p->aup_gid=(gid_t)b;
- return (TRUE);
- }
- return (FALSE);
-}
diff --git a/mdk-stage1/dietlibc/librpc/bindresvport.c b/mdk-stage1/dietlibc/librpc/bindresvport.c
deleted file mode 100644
index 8b65261dd..000000000
--- a/mdk-stage1/dietlibc/librpc/bindresvport.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1987 by Sun Microsystems, Inc.
- */
-
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-/*
- * Bind a socket to a privileged IP port
- */
-int bindresvport(sd, sin)
-int sd;
-struct sockaddr_in *sin;
-{
- int res;
- static short port;
- struct sockaddr_in myaddr;
- extern int errno;
- int i;
-
-#define STARTPORT 600
-#define ENDPORT (IPPORT_RESERVED - 1)
-#define NPORTS (ENDPORT - STARTPORT + 1)
-
- if (sin == (struct sockaddr_in *) 0) {
- sin = &myaddr;
- bzero(sin, sizeof(*sin));
- sin->sin_family = AF_INET;
- } else if (sin->sin_family != AF_INET) {
- errno = EPFNOSUPPORT;
- return (-1);
- }
- if (port == 0) {
- port = (getpid() % NPORTS) + STARTPORT;
- }
- res = -1;
- errno = EADDRINUSE;
- for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) {
- sin->sin_port = htons(port++);
- if (port > ENDPORT) {
- port = STARTPORT;
- }
- res = bind(sd, (struct sockaddr*)sin, sizeof(struct sockaddr_in));
- }
- return (res);
-}
diff --git a/mdk-stage1/dietlibc/librpc/clnt_generic.c b/mdk-stage1/dietlibc/librpc/clnt_generic.c
deleted file mode 100644
index 9bb81cc80..000000000
--- a/mdk-stage1/dietlibc/librpc/clnt_generic.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* @(#)clnt_generic.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
-#endif
-/*
- * Copyright (C) 1987, Sun Microsystems, Inc.
- */
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <netdb.h>
-#include <string.h>
-
-/*
- * Generic client creation: takes (hostname, program-number, protocol) and
- * returns client handle. Default options are set, which the user can
- * change using the rpc equivalent of ioctl()'s.
- */
-CLIENT *clnt_create __P ((const char *hostname, const u_long prog,
- const u_long vers, const char *proto))
-{
- struct hostent *h;
- struct protoent *p;
- struct sockaddr_in sin;
- int sock;
- struct timeval tv;
- CLIENT *client;
-
- h = gethostbyname(hostname);
- if (h == NULL) {
- rpc_createerr.cf_stat = RPC_UNKNOWNHOST;
- return (NULL);
- }
- if (h->h_addrtype != AF_INET) {
- /*
- * Only support INET for now
- */
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = EAFNOSUPPORT;
- return (NULL);
- }
-#ifdef __linux__
- bzero((char *) &sin, sizeof(sin));
-#endif
- sin.sin_family = h->h_addrtype;
- sin.sin_port = 0;
-#ifndef __linux__
- bzero(sin.sin_zero, sizeof(sin.sin_zero));
-#endif
- bcopy(h->h_addr, (char *) &sin.sin_addr, h->h_length);
- p = getprotobyname(proto);
- if (p == NULL) {
- rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
- rpc_createerr.cf_error.re_errno = EPFNOSUPPORT;
- return (NULL);
- }
- sock = RPC_ANYSOCK;
- switch (p->p_proto) {
- case IPPROTO_UDP:
- tv.tv_sec = 5;
- tv.tv_usec = 0;
- client = clntudp_create(&sin, prog, vers, tv, &sock);
- if (client == NULL) {
- return (NULL);
- }
- tv.tv_sec = 25;
- clnt_control(client, CLSET_TIMEOUT, (char*)&tv);
- break;
- case IPPROTO_TCP:
- client = clnttcp_create(&sin, prog, vers, &sock, 0, 0);
- if (client == NULL) {
- return (NULL);
- }
- tv.tv_sec = 25;
- tv.tv_usec = 0;
- clnt_control(client, CLSET_TIMEOUT, (char*)&tv);
- break;
- default:
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = EPFNOSUPPORT;
- return (NULL);
- }
- return (client);
-}
diff --git a/mdk-stage1/dietlibc/librpc/clnt_perror.c b/mdk-stage1/dietlibc/librpc/clnt_perror.c
deleted file mode 100644
index 4ede1a43e..000000000
--- a/mdk-stage1/dietlibc/librpc/clnt_perror.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_perror.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- */
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/auth.h>
-#include <rpc/clnt.h>
-
-//extern char *sys_errlist[];
-//static char *auth_errmsg();
-
-extern char *strcpy();
-
-#if 0
-static char *buf;
-
-static char *_buf()
-{
-
- if (buf == 0)
- buf = (char *) malloc(256);
- return (buf);
-}
-#endif
-
-/*
- * Print reply error info
- */
-char *clnt_sperror __P ((CLIENT *rpch, const char *s))
-{
-#if 0
- struct rpc_err e;
- void clnt_perrno();
- char *err;
- char *str = _buf();
- char *strstart = str;
-
- if (str == 0)
- return (0);
- CLNT_GETERR(rpch, &e);
-
- (void) sprintf(str, "%s: ", s);
- str += strlen(str);
-
- (void) strcpy(str, clnt_sperrno(e.re_status));
- str += strlen(str);
-
- switch (e.re_status) {
- case RPC_SUCCESS:
- case RPC_CANTENCODEARGS:
- case RPC_CANTDECODERES:
- case RPC_TIMEDOUT:
- case RPC_PROGUNAVAIL:
- case RPC_PROCUNAVAIL:
- case RPC_CANTDECODEARGS:
- case RPC_SYSTEMERROR:
- case RPC_UNKNOWNHOST:
- case RPC_UNKNOWNPROTO:
- case RPC_PMAPFAILURE:
- case RPC_PROGNOTREGISTERED:
- case RPC_FAILED:
- break;
-
- case RPC_CANTSEND:
- case RPC_CANTRECV:
- (void) sprintf(str, "; errno = %s", sys_errlist[e.re_errno]);
- str += strlen(str);
- break;
-
- case RPC_VERSMISMATCH:
- (void) sprintf(str,
- "; low version = %lu, high version = %lu",
- e.re_vers.low, e.re_vers.high);
- str += strlen(str);
- break;
-
- case RPC_AUTHERROR:
- err = auth_errmsg(e.re_why);
- (void) sprintf(str, "; why = ");
- str += strlen(str);
- if (err != NULL) {
- (void) sprintf(str, "%s", err);
- } else {
- (void) sprintf(str,
- "(unknown authentication error - %d)",
- (int) e.re_why);
- }
- str += strlen(str);
- break;
-
- case RPC_PROGVERSMISMATCH:
- (void) sprintf(str,
- "; low version = %lu, high version = %lu",
- e.re_vers.low, e.re_vers.high);
- str += strlen(str);
- break;
-
- default: /* unknown */
- (void) sprintf(str,
- "; s1 = %lu, s2 = %lu", e.re_lb.s1, e.re_lb.s2);
- str += strlen(str);
- break;
- }
- (void) sprintf(str, "\n");
- return (strstart);
-#endif
- return (0);
-}
-
-void clnt_perror __P ((CLIENT *rpch, const char *s))
-{
- (void) fprintf(stderr, "%s", clnt_sperror(rpch, s));
-}
-
-
-struct rpc_errtab {
- enum clnt_stat status;
- char *message;
-};
-
-#if 0
-static struct rpc_errtab rpc_errlist[] = {
- {RPC_SUCCESS,
- "RPC: Success"},
- {RPC_CANTENCODEARGS,
- "RPC: Can't encode arguments"},
- {RPC_CANTDECODERES,
- "RPC: Can't decode result"},
- {RPC_CANTSEND,
- "RPC: Unable to send"},
- {RPC_CANTRECV,
- "RPC: Unable to receive"},
- {RPC_TIMEDOUT,
- "RPC: Timed out"},
- {RPC_VERSMISMATCH,
- "RPC: Incompatible versions of RPC"},
- {RPC_AUTHERROR,
- "RPC: Authentication error"},
- {RPC_PROGUNAVAIL,
- "RPC: Program unavailable"},
- {RPC_PROGVERSMISMATCH,
- "RPC: Program/version mismatch"},
- {RPC_PROCUNAVAIL,
- "RPC: Procedure unavailable"},
- {RPC_CANTDECODEARGS,
- "RPC: Server can't decode arguments"},
- {RPC_SYSTEMERROR,
- "RPC: Remote system error"},
- {RPC_UNKNOWNHOST,
- "RPC: Unknown host"},
- {RPC_UNKNOWNPROTO,
- "RPC: Unknown protocol"},
- {RPC_PMAPFAILURE,
- "RPC: Port mapper failure"},
- {RPC_PROGNOTREGISTERED,
- "RPC: Program not registered"},
- {RPC_FAILED,
- "RPC: Failed (unspecified error)"}
-};
-#endif
-
-/*
- * This interface for use by clntrpc
- */
-char *clnt_sperrno(stat)
-enum clnt_stat stat;
-{
-#if 0
- int i;
-
- for (i = 0; i < sizeof(rpc_errlist) / sizeof(struct rpc_errtab); i++) {
- if (rpc_errlist[i].status == stat) {
- return (rpc_errlist[i].message);
- }
- }
-#endif
- return ("RPC: (unknown error code)");
-}
-
-void clnt_perrno(num)
-enum clnt_stat num;
-{
- (void) fprintf(stderr, "%s", clnt_sperrno(num));
-}
-
-
-char *clnt_spcreateerror __P ((__const char *s))
-{
-#if 0
- extern int sys_nerr;
- extern char *sys_errlist[];
- char *str = _buf();
-
- if (str == 0)
- return (0);
- (void) sprintf(str, "%s: ", s);
- (void) strcat(str, clnt_sperrno(rpc_createerr.cf_stat));
- switch (rpc_createerr.cf_stat) {
- case RPC_PMAPFAILURE:
- (void) strcat(str, " - ");
- (void) strcat(str, clnt_sperrno(rpc_createerr.cf_error.re_status));
- break;
-
- case RPC_SYSTEMERROR:
- (void) strcat(str, " - ");
- if (rpc_createerr.cf_error.re_errno > 0
- && rpc_createerr.cf_error.re_errno < sys_nerr)
- (void) strcat(str,
- sys_errlist[rpc_createerr.cf_error.re_errno]);
- else
- (void) sprintf(&str[strlen(str)], "Error %d",
- rpc_createerr.cf_error.re_errno);
- break;
- }
- (void) strcat(str, "\n");
- return (str);
-#endif
- return(0);
-}
-
-extern void clnt_pcreateerror __P ((__const char *s))
-{
- (void) fprintf(stderr, "%s", clnt_spcreateerror(s));
-}
-
-struct auth_errtab {
- enum auth_stat status;
- char *message;
-};
-
-#if 0
-static struct auth_errtab auth_errlist[] = {
- {AUTH_OK,
- "Authentication OK"},
- {AUTH_BADCRED,
- "Invalid client credential"},
- {AUTH_REJECTEDCRED,
- "Server rejected credential"},
- {AUTH_BADVERF,
- "Invalid client verifier"},
- {AUTH_REJECTEDVERF,
- "Server rejected verifier"},
- {AUTH_TOOWEAK,
- "Client credential too weak"},
- {AUTH_INVALIDRESP,
- "Invalid server verifier"},
- {AUTH_FAILED,
- "Failed (unspecified error)"},
-};
-
-static char *auth_errmsg(stat)
-enum auth_stat stat;
-{
- int i;
-
- for (i = 0; i < sizeof(auth_errlist) / sizeof(struct auth_errtab); i++) {
- if (auth_errlist[i].status == stat) {
- return (auth_errlist[i].message);
- }
- }
- return (NULL);
-}
-#endif
diff --git a/mdk-stage1/dietlibc/librpc/clnt_raw.c b/mdk-stage1/dietlibc/librpc/clnt_raw.c
deleted file mode 100644
index 7479b55d6..000000000
--- a/mdk-stage1/dietlibc/librpc/clnt_raw.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* @(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_raw.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * Memory based rpc for simple testing and timing.
- * Interface to create an rpc client and server in the same process.
- * This lets us similate rpc and get round trip overhead, without
- * any interference from the kernal.
- */
-
-#include <rpc/rpc.h>
-
-#define MCALL_MSG_SIZE 24
-
-/*
- * This is the "network" we will be moving stuff over.
- */
-static struct clntraw_private {
- CLIENT client_object;
- XDR xdr_stream;
- char _raw_buf[UDPMSGSIZE];
- char mashl_callmsg[MCALL_MSG_SIZE];
- u_int mcnt;
-} *clntraw_private;
-
-static enum clnt_stat clntraw_call();
-static void clntraw_abort();
-static void clntraw_geterr();
-static bool_t clntraw_freeres();
-static bool_t clntraw_control();
-static void clntraw_destroy();
-
-static struct clnt_ops client_ops = {
- clntraw_call,
- clntraw_abort,
- clntraw_geterr,
- clntraw_freeres,
- clntraw_destroy,
- clntraw_control
-};
-
-void svc_getreq();
-
-/*
- * Create a client handle for memory based rpc.
- */
-CLIENT *clntraw_create(prog, vers)
-u_long prog;
-u_long vers;
-{
- register struct clntraw_private *clp = clntraw_private;
- struct rpc_msg call_msg;
- XDR *xdrs = &clp->xdr_stream;
- CLIENT *client = &clp->client_object;
-
- if (clp == 0) {
- clp = (struct clntraw_private *) calloc(1, sizeof(*clp));
- if (clp == 0)
- return (0);
- clntraw_private = clp;
- }
- /*
- * pre-serialize the staic part of the call msg and stash it away
- */
- call_msg.rm_direction = CALL;
- call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- call_msg.rm_call.cb_prog = prog;
- call_msg.rm_call.cb_vers = vers;
- xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
- if (!xdr_callhdr(xdrs, &call_msg)) {
- perror("clnt_raw.c - Fatal header serialization error.");
- }
- clp->mcnt = XDR_GETPOS(xdrs);
- XDR_DESTROY(xdrs);
-
- /*
- * Set xdrmem for client/server shared buffer
- */
- xdrmem_create(xdrs, clp->_raw_buf, UDPMSGSIZE, XDR_FREE);
-
- /*
- * create client handle
- */
- client->cl_ops = &client_ops;
- client->cl_auth = authnone_create();
- return (client);
-}
-
-static enum clnt_stat
-clntraw_call(h, proc, xargs, argsp, xresults, resultsp, timeout)
-CLIENT *h;
-u_long proc;
-xdrproc_t xargs;
-caddr_t argsp;
-xdrproc_t xresults;
-caddr_t resultsp;
-struct timeval timeout;
-{
- register struct clntraw_private *clp = clntraw_private;
- register XDR *xdrs = &clp->xdr_stream;
- struct rpc_msg msg;
- enum clnt_stat status;
- struct rpc_err error;
-
- if (clp == 0)
- return (RPC_FAILED);
- call_again:
- /*
- * send request
- */
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, 0);
- ((struct rpc_msg *) clp->mashl_callmsg)->rm_xid++;
- if ((!XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) ||
- (!XDR_PUTLONG(xdrs, (long *) &proc)) ||
- (!AUTH_MARSHALL(h->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) {
- return (RPC_CANTENCODEARGS);
- }
- (void) XDR_GETPOS(xdrs); /* called just to cause overhead */
-
- /*
- * We have to call server input routine here because this is
- * all going on in one process. Yuk.
- */
- svc_getreq(1);
-
- /*
- * get results
- */
- xdrs->x_op = XDR_DECODE;
- XDR_SETPOS(xdrs, 0);
- msg.acpted_rply.ar_verf = _null_auth;
- msg.acpted_rply.ar_results.where = resultsp;
- msg.acpted_rply.ar_results.proc = xresults;
- if (!xdr_replymsg(xdrs, &msg))
- return (RPC_CANTDECODERES);
- _seterr_reply(&msg, &error);
- status = error.re_status;
-
- if (status == RPC_SUCCESS) {
- if (!AUTH_VALIDATE(h->cl_auth, &msg.acpted_rply.ar_verf)) {
- status = RPC_AUTHERROR;
- }
- } /* end successful completion */
- else {
- if (AUTH_REFRESH(h->cl_auth))
- goto call_again;
- } /* end of unsuccessful completion */
-
- if (status == RPC_SUCCESS) {
- if (!AUTH_VALIDATE(h->cl_auth, &msg.acpted_rply.ar_verf)) {
- status = RPC_AUTHERROR;
- }
- if (msg.acpted_rply.ar_verf.oa_base != NULL) {
- xdrs->x_op = XDR_FREE;
- (void) xdr_opaque_auth(xdrs, &(msg.acpted_rply.ar_verf));
- }
- }
-
- return (status);
-}
-
-static void clntraw_geterr()
-{
-}
-
-
-static bool_t clntraw_freeres(cl, xdr_res, res_ptr)
-CLIENT *cl;
-xdrproc_t xdr_res;
-caddr_t res_ptr;
-{
- register struct clntraw_private *clp = clntraw_private;
- register XDR *xdrs = &clp->xdr_stream;
- bool_t rval;
-
- if (clp == 0) {
- rval = (bool_t) RPC_FAILED;
- return (rval);
- }
- xdrs->x_op = XDR_FREE;
- return ((*xdr_res) (xdrs, res_ptr));
-}
-
-static void clntraw_abort()
-{
-}
-
-static bool_t clntraw_control()
-{
- return (FALSE);
-}
-
-static void clntraw_destroy()
-{
-}
diff --git a/mdk-stage1/dietlibc/librpc/clnt_simple.c b/mdk-stage1/dietlibc/librpc/clnt_simple.c
deleted file mode 100644
index f309f86ff..000000000
--- a/mdk-stage1/dietlibc/librpc/clnt_simple.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* @(#)clnt_simple.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_simple.c
- * Simplified front end to rpc.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <string.h>
-
-static struct callrpc_private {
- CLIENT *client;
- int socket;
- int oldprognum, oldversnum, valid;
- char *oldhost;
-} *callrpc_private;
-
-int callrpc (const char *host, const u_long prognum,
- const u_long versnum, const u_long procnum,
- const xdrproc_t inproc, const char *in,
- const xdrproc_t outproc, char *out)
-{
- register struct callrpc_private *crp = callrpc_private;
- struct sockaddr_in server_addr;
- enum clnt_stat clnt_stat;
- struct hostent *hp;
- struct timeval timeout, tottimeout;
-
- if (crp == 0) {
- crp = (struct callrpc_private *) calloc(1, sizeof(*crp));
- if (crp == 0)
- return (0);
- callrpc_private = crp;
- }
- if (crp->oldhost == NULL) {
- crp->oldhost = malloc(256);
- crp->oldhost[0] = 0;
- crp->socket = RPC_ANYSOCK;
- }
- if (crp->valid && crp->oldprognum == prognum
- && crp->oldversnum == versnum && strcmp(crp->oldhost, host) == 0) {
- /* reuse old client */
- } else {
- crp->valid = 0;
- (void) close(crp->socket);
- crp->socket = RPC_ANYSOCK;
- if (crp->client) {
- clnt_destroy(crp->client);
- crp->client = NULL;
- }
- if ((hp = gethostbyname(host)) == NULL)
- return ((int) RPC_UNKNOWNHOST);
- timeout.tv_usec = 0;
- timeout.tv_sec = 5;
- bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length);
- server_addr.sin_family = AF_INET;
- server_addr.sin_port = 0;
- if ((crp->client = clntudp_create(&server_addr, (u_long) prognum,
- (u_long) versnum, timeout,
- &crp->socket)) == NULL)
- return ((int) rpc_createerr.cf_stat);
- crp->valid = 1;
- crp->oldprognum = prognum;
- crp->oldversnum = versnum;
- (void) strcpy(crp->oldhost, host);
- }
- tottimeout.tv_sec = 25;
- tottimeout.tv_usec = 0;
- clnt_stat = clnt_call(crp->client, procnum, inproc, (char*)in,
- outproc, out, tottimeout);
- /*
- * if call failed, empty cache
- */
- if (clnt_stat != RPC_SUCCESS)
- crp->valid = 0;
- return ((int) clnt_stat);
-}
diff --git a/mdk-stage1/dietlibc/librpc/clnt_tcp.c b/mdk-stage1/dietlibc/librpc/clnt_tcp.c
deleted file mode 100644
index 8c39e8933..000000000
--- a/mdk-stage1/dietlibc/librpc/clnt_tcp.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/* @(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_tcp.c, Implements a TCP/IP based, client side RPC.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * TCP based RPC supports 'batched calls'.
- * A sequence of calls may be batched-up in a send buffer. The rpc call
- * return immediately to the client even though the call was not necessarily
- * sent. The batching occurs if the results' xdr routine is NULL (0) AND
- * the rpc timeout value is zero (see clnt.h, rpc).
- *
- * Clients should NOT casually batch calls that in fact return results; that is,
- * the server side should be aware that a call is batched and not produce any
- * return message. Batched calls that produce many result messages can
- * deadlock (netlock) the client and the server....
- *
- * Now go hang yourself.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <errno.h>
-#include <rpc/pmap_clnt.h>
-#include <unistd.h>
-
-#define MCALL_MSG_SIZE 24
-
-extern int errno;
-
-static int readtcp();
-static int writetcp();
-
-static enum clnt_stat clnttcp_call();
-static void clnttcp_abort();
-static void clnttcp_geterr();
-static bool_t clnttcp_freeres();
-static bool_t clnttcp_control();
-static void clnttcp_destroy();
-
-static struct clnt_ops tcp_ops = {
- clnttcp_call,
- clnttcp_abort,
- clnttcp_geterr,
- clnttcp_freeres,
- clnttcp_destroy,
- clnttcp_control
-};
-
-struct ct_data {
- int ct_sock;
- bool_t ct_closeit;
- struct timeval ct_wait;
- bool_t ct_waitset; /* wait set by clnt_control? */
- struct sockaddr_in ct_addr;
- struct rpc_err ct_error;
- char ct_mcall[MCALL_MSG_SIZE]; /* marshalled callmsg */
- u_int ct_mpos; /* pos after marshal */
- XDR ct_xdrs;
-};
-
-/*
- * Create a client handle for a tcp/ip connection.
- * If *sockp<0, *sockp is set to a newly created TCP socket and it is
- * connected to raddr. If *sockp non-negative then
- * raddr is ignored. The rpc/tcp package does buffering
- * similar to stdio, so the client must pick send and receive buffer sizes,];
- * 0 => use the default.
- * If raddr->sin_port is 0, then a binder on the remote machine is
- * consulted for the right port number.
- * NB: *sockp is copied into a private area.
- * NB: It is the clients responsibility to close *sockp.
- * NB: The rpch->cl_auth is set null authentication. Caller may wish to set this
- * something more useful.
- */
-CLIENT *clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
-struct sockaddr_in *raddr;
-u_long prog;
-u_long vers;
-register int *sockp;
-u_int sendsz;
-u_int recvsz;
-{
- CLIENT *h;
- register struct ct_data *ct;
- struct timeval now;
- struct rpc_msg call_msg;
-
- h = (CLIENT *) mem_alloc(sizeof(*h));
- if (h == NULL) {
- (void) fprintf(stderr, "clnttcp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- ct = (struct ct_data *) mem_alloc(sizeof(*ct));
- if (ct == NULL) {
- (void) fprintf(stderr, "clnttcp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
-
- /*
- * If no port number given ask the pmap for one
- */
- if (raddr->sin_port == 0) {
- u_short port;
-
- if ((port = pmap_getport(raddr, prog, vers, IPPROTO_TCP)) == 0) {
- mem_free((caddr_t) ct, sizeof(struct ct_data));
-
- mem_free((caddr_t) h, sizeof(CLIENT));
- return ((CLIENT *) NULL);
- }
- raddr->sin_port = htons(port);
- }
-
- /*
- * If no socket given, open one
- */
- if (*sockp < 0) {
- *sockp = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- (void) bindresvport(*sockp, (struct sockaddr_in *) 0);
- if ((*sockp < 0)
- || (connect(*sockp, (struct sockaddr *) raddr,
- sizeof(*raddr)) < 0)) {
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- (void) close(*sockp);
- goto fooy;
- }
- ct->ct_closeit = TRUE;
- } else {
- ct->ct_closeit = FALSE;
- }
-
- /*
- * Set up private data struct
- */
- ct->ct_sock = *sockp;
- ct->ct_wait.tv_usec = 0;
- ct->ct_waitset = FALSE;
- ct->ct_addr = *raddr;
-
- /*
- * Initialize call message
- */
- (void) gettimeofday(&now, (struct timezone *) 0);
- call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
- call_msg.rm_direction = CALL;
- call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- call_msg.rm_call.cb_prog = prog;
- call_msg.rm_call.cb_vers = vers;
-
- /*
- * pre-serialize the staic part of the call msg and stash it away
- */
- xdrmem_create(&(ct->ct_xdrs), ct->ct_mcall, MCALL_MSG_SIZE,
- XDR_ENCODE);
- if (!xdr_callhdr(&(ct->ct_xdrs), &call_msg)) {
- if (ct->ct_closeit) {
- (void) close(*sockp);
- }
- goto fooy;
- }
- ct->ct_mpos = XDR_GETPOS(&(ct->ct_xdrs));
- XDR_DESTROY(&(ct->ct_xdrs));
-
- /*
- * Create a client handle which uses xdrrec for serialization
- * and authnone for authentication.
- */
- xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz,
- (caddr_t) ct, readtcp, writetcp);
- h->cl_ops = &tcp_ops;
- h->cl_private = (caddr_t) ct;
- h->cl_auth = authnone_create();
- return (h);
-
- fooy:
- /*
- * Something goofed, free stuff and barf
- */
- mem_free((caddr_t) ct, sizeof(struct ct_data));
-
- mem_free((caddr_t) h, sizeof(CLIENT));
- return ((CLIENT *) NULL);
-}
-
-static enum clnt_stat
-clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr,
- timeout)
-register CLIENT *h;
-u_long proc;
-xdrproc_t xdr_args;
-caddr_t args_ptr;
-xdrproc_t xdr_results;
-caddr_t results_ptr;
-struct timeval timeout;
-{
- register struct ct_data *ct = (struct ct_data *) h->cl_private;
- register XDR *xdrs = &(ct->ct_xdrs);
- struct rpc_msg reply_msg;
- u_long x_id;
- u_long *msg_x_id = (u_long *) (ct->ct_mcall); /* yuk */
- register bool_t shipnow;
- int refreshes = 2;
-
- if (!ct->ct_waitset) {
- ct->ct_wait = timeout;
- }
-
- shipnow =
- (xdr_results == (xdrproc_t) 0 && timeout.tv_sec == 0
- && timeout.tv_usec == 0) ? FALSE : TRUE;
-
- call_again:
- xdrs->x_op = XDR_ENCODE;
- ct->ct_error.re_status = RPC_SUCCESS;
- x_id = ntohl(--(*msg_x_id));
- if ((!XDR_PUTBYTES(xdrs, ct->ct_mcall, ct->ct_mpos)) ||
- (!XDR_PUTLONG(xdrs, (long *) &proc)) ||
- (!AUTH_MARSHALL(h->cl_auth, xdrs)) ||
- (!(*xdr_args) (xdrs, args_ptr))) {
- if (ct->ct_error.re_status == RPC_SUCCESS)
- ct->ct_error.re_status = RPC_CANTENCODEARGS;
- (void) xdrrec_endofrecord(xdrs, TRUE);
- return (ct->ct_error.re_status);
- }
- if (!xdrrec_endofrecord(xdrs, shipnow))
- return (ct->ct_error.re_status = RPC_CANTSEND);
- if (!shipnow)
- return (RPC_SUCCESS);
- /*
- * Hack to provide rpc-based message passing
- */
- if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
- return (ct->ct_error.re_status = RPC_TIMEDOUT);
- }
-
-
- /*
- * Keep receiving until we get a valid transaction id
- */
- xdrs->x_op = XDR_DECODE;
- while (TRUE) {
- reply_msg.acpted_rply.ar_verf = _null_auth;
- reply_msg.acpted_rply.ar_results.where = NULL;
- reply_msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
- if (!xdrrec_skiprecord(xdrs))
- return (ct->ct_error.re_status);
- /* now decode and validate the response header */
- if (!xdr_replymsg(xdrs, &reply_msg)) {
- if (ct->ct_error.re_status == RPC_SUCCESS)
- continue;
- return (ct->ct_error.re_status);
- }
- if (reply_msg.rm_xid == x_id)
- break;
- }
-
- /*
- * process header
- */
- _seterr_reply(&reply_msg, &(ct->ct_error));
- if (ct->ct_error.re_status == RPC_SUCCESS) {
- if (!AUTH_VALIDATE(h->cl_auth, &reply_msg.acpted_rply.ar_verf)) {
- ct->ct_error.re_status = RPC_AUTHERROR;
- ct->ct_error.re_why = AUTH_INVALIDRESP;
- } else if (!(*xdr_results) (xdrs, results_ptr)) {
- if (ct->ct_error.re_status == RPC_SUCCESS)
- ct->ct_error.re_status = RPC_CANTDECODERES;
- }
- /* free verifier ... */
- if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
- xdrs->x_op = XDR_FREE;
- (void) xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf));
- }
- } /* end successful completion */
- else {
- /* maybe our credentials need to be refreshed ... */
- if (refreshes-- && AUTH_REFRESH(h->cl_auth))
- goto call_again;
- } /* end of unsuccessful completion */
- return (ct->ct_error.re_status);
-}
-
-static void clnttcp_geterr(h, errp)
-CLIENT *h;
-struct rpc_err *errp;
-{
- register struct ct_data *ct = (struct ct_data *) h->cl_private;
-
- *errp = ct->ct_error;
-}
-
-static bool_t clnttcp_freeres(cl, xdr_res, res_ptr)
-CLIENT *cl;
-xdrproc_t xdr_res;
-caddr_t res_ptr;
-{
- register struct ct_data *ct = (struct ct_data *) cl->cl_private;
- register XDR *xdrs = &(ct->ct_xdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_res) (xdrs, res_ptr));
-}
-
-static void clnttcp_abort()
-{
-}
-
-static bool_t clnttcp_control(cl, request, info)
-CLIENT *cl;
-int request;
-char *info;
-{
- register struct ct_data *ct = (struct ct_data *) cl->cl_private;
-
- switch (request) {
- case CLSET_TIMEOUT:
- ct->ct_wait = *(struct timeval *) info;
- ct->ct_waitset = TRUE;
- break;
- case CLGET_TIMEOUT:
- *(struct timeval *) info = ct->ct_wait;
- break;
- case CLGET_SERVER_ADDR:
- *(struct sockaddr_in *) info = ct->ct_addr;
- break;
- default:
- return (FALSE);
- }
- return (TRUE);
-}
-
-
-static void clnttcp_destroy(h)
-CLIENT *h;
-{
- register struct ct_data *ct = (struct ct_data *) h->cl_private;
-
- if (ct->ct_closeit) {
- (void) close(ct->ct_sock);
- }
- XDR_DESTROY(&(ct->ct_xdrs));
- mem_free((caddr_t) ct, sizeof(struct ct_data));
-
- mem_free((caddr_t) h, sizeof(CLIENT));
-}
-
-/*
- * Interface between xdr serializer and tcp connection.
- * Behaves like the system calls, read & write, but keeps some error state
- * around for the rpc level.
- */
-static int readtcp(ct, buf, len)
-register struct ct_data *ct;
-caddr_t buf;
-register int len;
-{
-#ifdef FD_SETSIZE
- fd_set mask;
- fd_set readfds;
-
- if (len == 0)
- return (0);
- FD_ZERO(&mask);
- FD_SET(ct->ct_sock, &mask);
-#else
- register int mask = 1 << (ct->ct_sock);
- int readfds;
-
- if (len == 0)
- return (0);
-
-#endif /* def FD_SETSIZE */
- while (TRUE) {
- readfds = mask;
- switch (select
- (_rpc_dtablesize(), &readfds, 0, 0,
- &(ct->ct_wait))) {
- case 0:
- ct->ct_error.re_status = RPC_TIMEDOUT;
- return (-1);
-
- case -1:
- if (errno == EINTR)
- continue;
- ct->ct_error.re_status = RPC_CANTRECV;
- ct->ct_error.re_errno = errno;
- return (-1);
- }
- break;
- }
- switch (len = read(ct->ct_sock, buf, len)) {
-
- case 0:
- /* premature eof */
- ct->ct_error.re_errno = ECONNRESET;
- ct->ct_error.re_status = RPC_CANTRECV;
- len = -1; /* it's really an error */
- break;
-
- case -1:
- ct->ct_error.re_errno = errno;
- ct->ct_error.re_status = RPC_CANTRECV;
- break;
- }
- return (len);
-}
-
-static int writetcp(ct, buf, len)
-struct ct_data *ct;
-caddr_t buf;
-int len;
-{
- register int i, cnt;
-
- for (cnt = len; cnt > 0; cnt -= i, buf += i) {
- if ((i = write(ct->ct_sock, buf, cnt)) == -1) {
- ct->ct_error.re_errno = errno;
- ct->ct_error.re_status = RPC_CANTSEND;
- return (-1);
- }
- }
- return (len);
-}
diff --git a/mdk-stage1/dietlibc/librpc/clnt_udp.c b/mdk-stage1/dietlibc/librpc/clnt_udp.c
deleted file mode 100644
index 7305d3ff1..000000000
--- a/mdk-stage1/dietlibc/librpc/clnt_udp.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/* @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * clnt_udp.c, Implements a UDP/IP based, client side RPC.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <netdb.h>
-#include <errno.h>
-#include <rpc/pmap_clnt.h>
-#include <unistd.h>
-
-extern int errno;
-
-/*
- * UDP bases client side rpc operations
- */
-static enum clnt_stat clntudp_call();
-static void clntudp_abort();
-static void clntudp_geterr();
-static bool_t clntudp_freeres();
-static bool_t clntudp_control();
-static void clntudp_destroy();
-
-static struct clnt_ops udp_ops = {
- clntudp_call,
- clntudp_abort,
- clntudp_geterr,
- clntudp_freeres,
- clntudp_destroy,
- clntudp_control
-};
-
-/*
- * Private data kept per client handle
- */
-struct cu_data {
- int cu_sock;
- bool_t cu_closeit;
- struct sockaddr_in cu_raddr;
- int cu_rlen;
- struct timeval cu_wait;
- struct timeval cu_total;
- struct rpc_err cu_error;
- XDR cu_outxdrs;
- u_int cu_xdrpos;
- u_int cu_sendsz;
- char *cu_outbuf;
- u_int cu_recvsz;
- char cu_inbuf[1];
-};
-
-/*
- * Create a UDP based client handle.
- * If *sockp<0, *sockp is set to a newly created UPD socket.
- * If raddr->sin_port is 0 a binder on the remote machine
- * is consulted for the correct port number.
- * NB: It is the clients responsibility to close *sockp.
- * NB: The rpch->cl_auth is initialized to null authentication.
- * Caller may wish to set this something more useful.
- *
- * wait is the amount of time used between retransmitting a call if
- * no response has been heard; retransmition occurs until the actual
- * rpc call times out.
- *
- * sendsz and recvsz are the maximum allowable packet sizes that can be
- * sent and received.
- */
-CLIENT *clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz,
- recvsz)
-struct sockaddr_in *raddr;
-u_long program;
-u_long version;
-struct timeval wait;
-register int *sockp;
-u_int sendsz;
-u_int recvsz;
-{
- CLIENT *cl;
- register struct cu_data *cu;
- struct timeval now;
- struct rpc_msg call_msg;
-
- cl = (CLIENT *) mem_alloc(sizeof(CLIENT));
- if (cl == NULL) {
- (void) fprintf(stderr, "clntudp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- sendsz = ((sendsz + 3) / 4) * 4;
- recvsz = ((recvsz + 3) / 4) * 4;
- cu = (struct cu_data *) mem_alloc(sizeof(*cu) + sendsz + recvsz);
- if (cu == NULL) {
- (void) fprintf(stderr, "clntudp_create: out of memory\n");
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- cu->cu_outbuf = &cu->cu_inbuf[recvsz];
-
- (void) gettimeofday(&now, (struct timezone *) 0);
- if (raddr->sin_port == 0) {
- u_short port;
-
- if ((port =
- pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) {
- goto fooy;
- }
- raddr->sin_port = htons(port);
- }
- cl->cl_ops = &udp_ops;
- cl->cl_private = (caddr_t) cu;
- cu->cu_raddr = *raddr;
- cu->cu_rlen = sizeof(cu->cu_raddr);
- cu->cu_wait = wait;
- cu->cu_total.tv_sec = -1;
- cu->cu_total.tv_usec = -1;
- cu->cu_sendsz = sendsz;
- cu->cu_recvsz = recvsz;
- call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec;
- call_msg.rm_direction = CALL;
- call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- call_msg.rm_call.cb_prog = program;
- call_msg.rm_call.cb_vers = version;
- xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE);
- if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) {
- goto fooy;
- }
- cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
- if (*sockp < 0) {
- int dontblock = 1;
-
- *sockp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if (*sockp < 0) {
- rpc_createerr.cf_stat = RPC_SYSTEMERROR;
- rpc_createerr.cf_error.re_errno = errno;
- goto fooy;
- }
- /* attempt to bind to prov port */
- (void) bindresvport(*sockp, (struct sockaddr_in *) 0);
- /* the sockets rpc controls are non-blocking */
- (void) ioctl(*sockp, FIONBIO, (char *) &dontblock);
- cu->cu_closeit = TRUE;
- } else {
- cu->cu_closeit = FALSE;
- }
- cu->cu_sock = *sockp;
- cl->cl_auth = authnone_create();
- return (cl);
- fooy:
- if (cu)
- mem_free((caddr_t) cu, sizeof(*cu) + sendsz + recvsz);
- if (cl)
- mem_free((caddr_t) cl, sizeof(CLIENT));
- return ((CLIENT *) NULL);
-}
-
-CLIENT *clntudp_create(raddr, program, version, wait, sockp)
-struct sockaddr_in *raddr;
-u_long program;
-u_long version;
-struct timeval wait;
-register int *sockp;
-{
-
- return (clntudp_bufcreate(raddr, program, version, wait, sockp,
- UDPMSGSIZE, UDPMSGSIZE));
-}
-
-static enum clnt_stat
-clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
-register CLIENT *cl; /* client handle */
-u_long proc; /* procedure number */
-xdrproc_t xargs; /* xdr routine for args */
-caddr_t argsp; /* pointer to args */
-xdrproc_t xresults; /* xdr routine for results */
-caddr_t resultsp; /* pointer to results */
-struct timeval utimeout; /* seconds to wait before giving up */
-{
- register struct cu_data *cu = (struct cu_data *) cl->cl_private;
- register XDR *xdrs;
- register int outlen;
- register int inlen;
- int fromlen;
-
-#ifdef FD_SETSIZE
- fd_set readfds;
- fd_set mask;
-#else
- int readfds;
- register int mask;
-#endif /* def FD_SETSIZE */
- struct sockaddr_in from;
- struct rpc_msg reply_msg;
- XDR reply_xdrs;
- struct timeval time_waited;
- bool_t ok;
- int nrefreshes = 2; /* number of times to refresh cred */
- struct timeval timeout;
-
- if (cu->cu_total.tv_usec == -1) {
- timeout = utimeout; /* use supplied timeout */
- } else {
- timeout = cu->cu_total; /* use default timeout */
- }
-
- time_waited.tv_sec = 0;
- time_waited.tv_usec = 0;
- call_again:
- xdrs = &(cu->cu_outxdrs);
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, cu->cu_xdrpos);
- /*
- * the transaction is the first thing in the out buffer
- */
- (*(u_short *) (cu->cu_outbuf))++;
- if ((!XDR_PUTLONG(xdrs, (long *) &proc)) ||
- (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp)))
- return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
- outlen = (int) XDR_GETPOS(xdrs);
-
- send_again:
- if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0,
- (struct sockaddr *) &(cu->cu_raddr), cu->cu_rlen)
- != outlen) {
- cu->cu_error.re_errno = errno;
- return (cu->cu_error.re_status = RPC_CANTSEND);
- }
-
- /*
- * Hack to provide rpc-based message passing
- */
- if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
- return (cu->cu_error.re_status = RPC_TIMEDOUT);
- }
- /*
- * sub-optimal code appears here because we have
- * some clock time to spare while the packets are in flight.
- * (We assume that this is actually only executed once.)
- */
- reply_msg.acpted_rply.ar_verf = _null_auth;
- reply_msg.acpted_rply.ar_results.where = resultsp;
- reply_msg.acpted_rply.ar_results.proc = xresults;
-#ifdef FD_SETSIZE
- FD_ZERO(&mask);
- FD_SET(cu->cu_sock, &mask);
-#else
- mask = 1 << cu->cu_sock;
-#endif /* def FD_SETSIZE */
- for (;;) {
- readfds = mask;
- switch (select(_rpc_dtablesize(), &readfds, 0, 0, &(cu->cu_wait))) {
-
- case 0:
- time_waited.tv_sec += cu->cu_wait.tv_sec;
- time_waited.tv_usec += cu->cu_wait.tv_usec;
- while (time_waited.tv_usec >= 1000000) {
- time_waited.tv_sec++;
- time_waited.tv_usec -= 1000000;
- }
- if ((time_waited.tv_sec < timeout.tv_sec) ||
- ((time_waited.tv_sec == timeout.tv_sec) &&
- (time_waited.tv_usec < timeout.tv_usec)))
- goto send_again;
- return (cu->cu_error.re_status = RPC_TIMEDOUT);
-
- /*
- * buggy in other cases because time_waited is not being
- * updated.
- */
- case -1:
- if (errno == EINTR)
- continue;
- cu->cu_error.re_errno = errno;
- return (cu->cu_error.re_status = RPC_CANTRECV);
- }
- do {
- fromlen = sizeof(struct sockaddr);
-
- inlen = recvfrom(cu->cu_sock, cu->cu_inbuf,
- (int) cu->cu_recvsz, 0,
- (struct sockaddr *) &from, &fromlen);
- } while (inlen < 0 && errno == EINTR);
- if (inlen < 0) {
- if (errno == EWOULDBLOCK)
- continue;
- cu->cu_error.re_errno = errno;
- return (cu->cu_error.re_status = RPC_CANTRECV);
- }
- if (inlen < sizeof(u_long))
- continue;
- /* see if reply transaction id matches sent id */
- if (*((u_long *) (cu->cu_inbuf)) != *((u_long *) (cu->cu_outbuf)))
- continue;
- /* we now assume we have the proper reply */
- break;
- }
-
- /*
- * now decode and validate the response
- */
- xdrmem_create(&reply_xdrs, cu->cu_inbuf, (u_int) inlen, XDR_DECODE);
- ok = xdr_replymsg(&reply_xdrs, &reply_msg);
- /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */
- if (ok) {
- _seterr_reply(&reply_msg, &(cu->cu_error));
- if (cu->cu_error.re_status == RPC_SUCCESS) {
- if (!AUTH_VALIDATE(cl->cl_auth,
- &reply_msg.acpted_rply.ar_verf)) {
- cu->cu_error.re_status = RPC_AUTHERROR;
- cu->cu_error.re_why = AUTH_INVALIDRESP;
- }
- if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
- xdrs->x_op = XDR_FREE;
- (void) xdr_opaque_auth(xdrs,
- &(reply_msg.acpted_rply.ar_verf));
- }
- } /* end successful completion */
- else {
- /* maybe our credentials need to be refreshed ... */
- if (nrefreshes > 0 && AUTH_REFRESH(cl->cl_auth)) {
- nrefreshes--;
- goto call_again;
- }
- } /* end of unsuccessful completion */
- } /* end of valid reply message */
- else {
- cu->cu_error.re_status = RPC_CANTDECODERES;
- }
- return (cu->cu_error.re_status);
-}
-
-static void clntudp_geterr(cl, errp)
-CLIENT *cl;
-struct rpc_err *errp;
-{
- register struct cu_data *cu = (struct cu_data *) cl->cl_private;
-
- *errp = cu->cu_error;
-}
-
-
-static bool_t clntudp_freeres(cl, xdr_res, res_ptr)
-CLIENT *cl;
-xdrproc_t xdr_res;
-caddr_t res_ptr;
-{
- register struct cu_data *cu = (struct cu_data *) cl->cl_private;
- register XDR *xdrs = &(cu->cu_outxdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_res) (xdrs, res_ptr));
-}
-
-static void clntudp_abort( /*h */ )
- /*CLIENT *h; */
-{
-}
-
-static bool_t clntudp_control(cl, request, info)
-CLIENT *cl;
-int request;
-char *info;
-{
- register struct cu_data *cu = (struct cu_data *) cl->cl_private;
-
- switch (request) {
- case CLSET_TIMEOUT:
- cu->cu_total = *(struct timeval *) info;
- break;
- case CLGET_TIMEOUT:
- *(struct timeval *) info = cu->cu_total;
- break;
- case CLSET_RETRY_TIMEOUT:
- cu->cu_wait = *(struct timeval *) info;
- break;
- case CLGET_RETRY_TIMEOUT:
- *(struct timeval *) info = cu->cu_wait;
- break;
- case CLGET_SERVER_ADDR:
- *(struct sockaddr_in *) info = cu->cu_raddr;
- break;
- default:
- return (FALSE);
- }
- return (TRUE);
-}
-
-static void clntudp_destroy(cl)
-CLIENT *cl;
-{
- register struct cu_data *cu = (struct cu_data *) cl->cl_private;
-
- if (cu->cu_closeit) {
- (void) close(cu->cu_sock);
- }
- XDR_DESTROY(&(cu->cu_outxdrs));
- mem_free((caddr_t) cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz));
- mem_free((caddr_t) cl, sizeof(CLIENT));
-}
diff --git a/mdk-stage1/dietlibc/librpc/get_myaddress.c b/mdk-stage1/dietlibc/librpc/get_myaddress.c
deleted file mode 100644
index cd63383d0..000000000
--- a/mdk-stage1/dietlibc/librpc/get_myaddress.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* @(#)get_myaddress.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * get_myaddress.c
- *
- * Get client's IP address via ioctl. This avoids using the yellowpages.
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/pmap_prot.h>
-#include <sys/socket.h>
-#include <stdio.h>
-//#include <net/if.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-
-/* DO use gethostbyname because it's portable */
-#include <unistd.h>
-#include <netdb.h>
-#include <string.h>
-void get_myaddress(struct sockaddr_in* addr)
-{
- char localhost[256 + 1];
- struct hostent *hp;
-
- gethostname(localhost, 256);
- if ((hp = gethostbyname(localhost)) == NULL) {
- perror("get_myaddress: gethostbyname");
- exit(1);
- }
- addr->sin_family = AF_INET;
- bcopy((char *) hp->h_addr, (char *) &addr->sin_addr, hp->h_length);
- addr->sin_port = htons(PMAPPORT);
-}
diff --git a/mdk-stage1/dietlibc/librpc/getrpcent.c b/mdk-stage1/dietlibc/librpc/getrpcent.c
deleted file mode 100644
index 5e7f694d2..000000000
--- a/mdk-stage1/dietlibc/librpc/getrpcent.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* @(#)getrpcent.c 2.2 88/07/29 4.0 RPCSRC */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)getrpcent.c 1.9 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1985 by Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <rpc/rpc.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <string.h>
-
-/*
- * Internet version.
- */
-struct rpcdata {
- FILE *rpcf;
- char *current;
- int currentlen;
- int stayopen;
-#define MAXALIASES 35
- char *rpc_aliases[MAXALIASES];
- struct rpcent rpc;
- char line[BUFSIZ + 1];
- char *domain;
-} *rpcdata;
-
-static struct rpcent *interpret();
-struct hostent *gethostent();
-char *inet_ntoa();
-
-#ifndef __linux__
-static char *index();
-#else
-char *index();
-#endif
-
-static char RPCDB[] = "/etc/rpc";
-
-static struct rpcdata *_rpcdata()
-{
- register struct rpcdata *d = rpcdata;
-
- if (d == 0) {
- d = (struct rpcdata *) calloc(1, sizeof(struct rpcdata));
-
- rpcdata = d;
- }
- return (d);
-}
-
-struct rpcent *getrpcbynumber(number)
-register int number;
-{
- register struct rpcdata *d = _rpcdata();
- register struct rpcent *p;
-
- if (d == 0)
- return (0);
- setrpcent(0);
- while ((p = getrpcent())) {
- if (p->r_number == number)
- break;
- }
- endrpcent();
- return (p);
-}
-
-struct rpcent *
-#ifdef __linux__
-getrpcbyname(const char *name)
-#else
-getrpcbyname(name)
-char *name;
-#endif
-{
- struct rpcent *rpc;
- char **rp;
-
- setrpcent(0);
- while ((rpc = getrpcent())) {
- if (strcmp(rpc->r_name, name) == 0)
- return (rpc);
- for (rp = rpc->r_aliases; *rp != NULL; rp++) {
- if (strcmp(*rp, name) == 0)
- return (rpc);
- }
- }
- endrpcent();
- return (NULL);
-}
-
-#ifdef __linux__
-void
-#endif
-setrpcent(f)
-int f;
-{
- register struct rpcdata *d = _rpcdata();
-
- if (d == 0)
- return;
- if (d->rpcf == NULL)
- d->rpcf = fopen(RPCDB, "r");
- else
- rewind(d->rpcf);
- if (d->current)
- free(d->current);
- d->current = NULL;
- d->stayopen |= f;
-}
-
-#ifdef __linux__
-void
-#endif
-endrpcent()
-{
- register struct rpcdata *d = _rpcdata();
-
- if (d == 0)
- return;
- if (d->current && !d->stayopen) {
- free(d->current);
- d->current = NULL;
- }
- if (d->rpcf && !d->stayopen) {
- fclose(d->rpcf);
- d->rpcf = NULL;
- }
-}
-
-struct rpcent *getrpcent()
-{
- register struct rpcdata *d = _rpcdata();
-
- if (d == 0)
- return (NULL);
- if (d->rpcf == NULL && (d->rpcf = fopen(RPCDB, "r")) == NULL)
- return (NULL);
- if (fgets(d->line, BUFSIZ, d->rpcf) == NULL)
- return (NULL);
- return interpret(d->line, strlen(d->line));
-}
-
-#ifdef __linux__
-static char *firstwhite(s)
-char *s;
-{
- char *s1, *s2;
-
- s1 = index(s, ' ');
- s2 = index(s, '\t');
- if (s1) {
- if (s2)
- return (s1 < s2) ? s1 : s2;
- else
- return s1;
- } else
- return s2;
-}
-#endif
-
-static struct rpcent *interpret(const char* val, int len)
-{
- register struct rpcdata *d = _rpcdata();
- char *p;
- register char *cp, **q;
-
- if (d == 0)
- return 0;
- strncpy(d->line, val, len);
- p = d->line;
- d->line[len] = '\n';
- if (*p == '#')
- return (getrpcent());
- cp = index(p, '#');
- if (cp == NULL) {
- cp = index(p, '\n');
- if (cp == NULL)
- return (getrpcent());
- }
- *cp = '\0';
-#ifdef __linux__
- if ((cp = firstwhite(p)))
- *cp++ = 0;
- else
- return (getrpcent());
-#else
- cp = index(p, ' ');
- if (cp == NULL) {
- cp = index(p, '\t');
- if (cp == NULL)
- return (getrpcent());
- }
- *cp++ = '\0';
-#endif
- /* THIS STUFF IS INTERNET SPECIFIC */
- d->rpc.r_name = d->line;
- while (*cp == ' ' || *cp == '\t')
- cp++;
- d->rpc.r_number = atoi(cp);
- q = d->rpc.r_aliases = d->rpc_aliases;
-#ifdef __linux__
- if ((cp = firstwhite(cp)))
- *cp++ = '\0';
-#else
- cp = index(p, ' ');
- if (cp != NULL)
- *cp++ = '\0';
- else {
- cp = index(p, '\t');
- if (cp != NULL)
- *cp++ = '\0';
- }
-#endif
- while (cp && *cp) {
- if (*cp == ' ' || *cp == '\t') {
- cp++;
- continue;
- }
- if (q < &(d->rpc_aliases[MAXALIASES - 1]))
- *q++ = cp;
-#ifdef __linux__
- if ((cp = firstwhite(cp)))
- *cp++ = '\0';
-#else
- cp = index(p, ' ');
- if (cp != NULL)
- *cp++ = '\0';
- else {
- cp = index(p, '\t');
- if (cp != NULL)
- *cp++ = '\0';
- }
-#endif
- }
- *q = NULL;
- return (&d->rpc);
-}
diff --git a/mdk-stage1/dietlibc/librpc/getrpcport.c b/mdk-stage1/dietlibc/librpc/getrpcport.c
deleted file mode 100644
index a7085cbe7..000000000
--- a/mdk-stage1/dietlibc/librpc/getrpcport.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* @(#)getrpcport.c 2.1 88/07/29 4.0 RPCSRC */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * Copyright (c) 1985 by Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <rpc/pmap_clnt.h>
-
-extern int getrpcport (const char * host, u_long prognum,
- u_long versnum, u_int proto)
-{
- struct sockaddr_in addr;
- struct hostent *hp;
-
- if ((hp = gethostbyname(host)) == NULL)
- return (0);
- bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length);
- addr.sin_family = AF_INET;
- addr.sin_port = 0;
- return (pmap_getport(&addr, prognum, versnum, proto));
-}
diff --git a/mdk-stage1/dietlibc/librpc/pmap_clnt.c b/mdk-stage1/dietlibc/librpc/pmap_clnt.c
deleted file mode 100644
index 428675656..000000000
--- a/mdk-stage1/dietlibc/librpc/pmap_clnt.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* @(#)pmap_clnt.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)pmap_clnt.c 1.37 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_clnt.c
- * Client interface to pmap rpc service.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <unistd.h>
-
-static struct timeval timeout = { 5, 0 };
-static struct timeval tottimeout = { 60, 0 };
-
-void clnt_perror();
-
-
-/*
- * Set a mapping between program,version and port.
- * Calls the pmap service remotely to do the mapping.
- */
-bool_t pmap_set(program, version, protocol, port)
-u_long program;
-u_long version;
-int protocol;
-u_short port;
-{
- struct sockaddr_in myaddress;
- int socket = -1;
- register CLIENT *client;
- struct pmap parms;
- bool_t rslt;
-
- get_myaddress(&myaddress);
- client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS,
- timeout, &socket, RPCSMALLMSGSIZE,
- RPCSMALLMSGSIZE);
- if (client == (CLIENT *) NULL)
- return (FALSE);
- parms.pm_prog = program;
- parms.pm_vers = version;
- parms.pm_prot = protocol;
- parms.pm_port = port;
- if (CLNT_CALL(client, PMAPPROC_SET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt,
- tottimeout) != RPC_SUCCESS) {
- clnt_perror(client, "Cannot register service");
- return (FALSE);
- }
- CLNT_DESTROY(client);
- (void) close(socket);
- return (rslt);
-}
-
-/*
- * Remove the mapping between program,version and port.
- * Calls the pmap service remotely to do the un-mapping.
- */
-bool_t pmap_unset(program, version)
-u_long program;
-u_long version;
-{
- struct sockaddr_in myaddress;
- int socket = -1;
- register CLIENT *client;
- struct pmap parms;
- bool_t rslt;
-
- get_myaddress(&myaddress);
- client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS,
- timeout, &socket, RPCSMALLMSGSIZE,
- RPCSMALLMSGSIZE);
- if (client == (CLIENT *) NULL)
- return (FALSE);
- parms.pm_prog = program;
- parms.pm_vers = version;
- parms.pm_port = parms.pm_prot = 0;
- CLNT_CALL(client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt,
- tottimeout);
- CLNT_DESTROY(client);
- (void) close(socket);
- return (rslt);
-}
diff --git a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c b/mdk-stage1/dietlibc/librpc/pmap_getmaps.c
deleted file mode 100644
index 6940783fb..000000000
--- a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* @(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_getmap.c
- * Client interface to pmap rpc service.
- * contains pmap_getmaps, which is only tcp service involved
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <errno.h>
-//#include <net/if.h>
-#include <sys/ioctl.h>
-#define NAMELEN 255
-#define MAX_BROADCAST_SIZE 1400
-#include <unistd.h>
-
-extern int errno;
-
-/*
- * Get a copy of the current port maps.
- * Calls the pmap service remotely to do get the maps.
- */
-struct pmaplist *pmap_getmaps(address)
-struct sockaddr_in *address;
-{
- struct pmaplist *head = (struct pmaplist *) NULL;
- int socket = -1;
- struct timeval minutetimeout;
- register CLIENT *client;
-
- minutetimeout.tv_sec = 60;
- minutetimeout.tv_usec = 0;
- address->sin_port = htons(PMAPPORT);
- client = clnttcp_create(address, PMAPPROG, PMAPVERS, &socket, 50, 500);
- if (client != (CLIENT *) NULL) {
- if (CLNT_CALL(client, PMAPPROC_DUMP, (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_pmaplist,
- (caddr_t)&head, minutetimeout) != RPC_SUCCESS) {
- clnt_perror(client, "pmap_getmaps rpc problem");
- }
- CLNT_DESTROY(client);
- }
- (void) close(socket);
- address->sin_port = 0;
- return (head);
-}
diff --git a/mdk-stage1/dietlibc/librpc/pmap_getport.c b/mdk-stage1/dietlibc/librpc/pmap_getport.c
deleted file mode 100644
index 174dca41a..000000000
--- a/mdk-stage1/dietlibc/librpc/pmap_getport.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* @(#)pmap_getport.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_getport.c
- * Client interface to pmap rpc service.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <sys/socket.h>
-//#include <net/if.h>
-#include <unistd.h>
-
-static struct timeval timeout = { 5, 0 };
-static struct timeval tottimeout = { 60, 0 };
-
-/*
- * Find the mapped port for program,version.
- * Calls the pmap service remotely to do the lookup.
- * Returns 0 if no map exists.
- */
-u_short pmap_getport(address, program, version, protocol)
-struct sockaddr_in *address;
-u_long program;
-u_long version;
-u_int protocol;
-{
- u_short port = 0;
- int socket = -1;
- register CLIENT *client;
- struct pmap parms;
-
- address->sin_port = htons(PMAPPORT);
- client = clntudp_bufcreate(address, PMAPPROG,
- PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE,
- RPCSMALLMSGSIZE);
- if (client != (CLIENT *) NULL) {
- parms.pm_prog = program;
- parms.pm_vers = version;
- parms.pm_prot = protocol;
- parms.pm_port = 0; /* not needed or used */
- if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (caddr_t)&parms,
- (xdrproc_t)xdr_u_short, (caddr_t)&port, tottimeout) != RPC_SUCCESS) {
- rpc_createerr.cf_stat = RPC_PMAPFAILURE;
- clnt_geterr(client, &rpc_createerr.cf_error);
- } else if (port == 0) {
- rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
- }
- CLNT_DESTROY(client);
- }
- (void) close(socket);
- address->sin_port = 0;
- return (port);
-}
diff --git a/mdk-stage1/dietlibc/librpc/pmap_prot.c b/mdk-stage1/dietlibc/librpc/pmap_prot.c
deleted file mode 100644
index ec8b5af79..000000000
--- a/mdk-stage1/dietlibc/librpc/pmap_prot.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* @(#)pmap_prot.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_prot.c
- * Protocol for the local binder service, or pmap.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/pmap_prot.h>
-
-
-bool_t xdr_pmap(xdrs, regs)
-XDR *xdrs;
-struct pmap *regs;
-{
-
- if (xdr_u_long(xdrs, &regs->pm_prog) &&
- xdr_u_long(xdrs, &regs->pm_vers) &&
- xdr_u_long(xdrs, &regs->pm_prot))
- return (xdr_u_long(xdrs, &regs->pm_port));
- return (FALSE);
-}
diff --git a/mdk-stage1/dietlibc/librpc/pmap_prot2.c b/mdk-stage1/dietlibc/librpc/pmap_prot2.c
deleted file mode 100644
index 870c844ed..000000000
--- a/mdk-stage1/dietlibc/librpc/pmap_prot2.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* @(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_prot2.c
- * Protocol for the local binder service, or pmap.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <rpc/pmap_prot.h>
-
-
-/*
- * What is going on with linked lists? (!)
- * First recall the link list declaration from pmap_prot.h:
- *
- * struct pmaplist {
- * struct pmap pml_map;
- * struct pmaplist *pml_map;
- * };
- *
- * Compare that declaration with a corresponding xdr declaration that
- * is (a) pointer-less, and (b) recursive:
- *
- * typedef union switch (bool_t) {
- *
- * case TRUE: struct {
- * struct pmap;
- * pmaplist_t foo;
- * };
- *
- * case FALSE: struct {};
- * } pmaplist_t;
- *
- * Notice that the xdr declaration has no nxt pointer while
- * the C declaration has no bool_t variable. The bool_t can be
- * interpreted as ``more data follows me''; if FALSE then nothing
- * follows this bool_t; if TRUE then the bool_t is followed by
- * an actual struct pmap, and then (recursively) by the
- * xdr union, pamplist_t.
- *
- * This could be implemented via the xdr_union primitive, though this
- * would cause a one recursive call per element in the list. Rather than do
- * that we can ``unwind'' the recursion
- * into a while loop and do the union arms in-place.
- *
- * The head of the list is what the C programmer wishes to past around
- * the net, yet is the data that the pointer points to which is interesting;
- * this sounds like a job for xdr_reference!
- */
-bool_t xdr_pmaplist(XDR* xdrs, struct pmaplist** rp)
-{
- /*
- * more_elements is pre-computed in case the direction is
- * XDR_ENCODE or XDR_FREE. more_elements is overwritten by
- * xdr_bool when the direction is XDR_DECODE.
- */
- bool_t more_elements;
- register int freeing = (xdrs->x_op == XDR_FREE);
- register struct pmaplist **next=0;
-
- while (TRUE) {
- more_elements = (bool_t) (*rp != NULL);
- if (!xdr_bool(xdrs, &more_elements))
- return (FALSE);
- if (!more_elements)
- return (TRUE); /* we are done */
- /*
- * the unfortunate side effect of non-recursion is that in
- * the case of freeing we must remember the next object
- * before we free the current object ...
- */
- if (freeing)
- next = &((*rp)->pml_next);
- if (!xdr_reference(xdrs, (caddr_t *) rp,
- (u_int) sizeof(struct pmaplist), (xdrproc_t)xdr_pmap))
- return (FALSE);
-
- rp = (freeing) ? next : &((*rp)->pml_next);
- }
-}
diff --git a/mdk-stage1/dietlibc/librpc/pmap_rmt.c b/mdk-stage1/dietlibc/librpc/pmap_rmt.c
deleted file mode 100644
index 02efcf91c..000000000
--- a/mdk-stage1/dietlibc/librpc/pmap_rmt.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/* @(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * pmap_rmt.c
- * Client interface to pmap rpc service.
- * remote call and broadcast service
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-#include <rpc/pmap_prot.h>
-#include <rpc/pmap_clnt.h>
-#include <rpc/pmap_rmt.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <errno.h>
-//#include <net/if.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#define MAX_BROADCAST_SIZE 1400
-#include <unistd.h>
-#include <string.h>
-
-extern int errno;
-static struct timeval timeout = { 3, 0 };
-
-
-/*
- * pmapper remote-call-service interface.
- * This routine is used to call the pmapper remote call service
- * which will look up a service program in the port maps, and then
- * remotely call that routine with the given parameters. This allows
- * programs to do a lookup and call in one step.
-*/
-enum clnt_stat
-pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout,
- port_ptr)
-struct sockaddr_in *addr;
-u_long prog, vers, proc;
-xdrproc_t xdrargs, xdrres;
-caddr_t argsp, resp;
-struct timeval tout;
-u_long *port_ptr;
-{
- int socket = -1;
- register CLIENT *client;
- struct rmtcallargs a;
- struct rmtcallres r;
- enum clnt_stat stat;
-
- addr->sin_port = htons(PMAPPORT);
- client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &socket);
- if (client != (CLIENT *) NULL) {
- a.prog = prog;
- a.vers = vers;
- a.proc = proc;
- a.args_ptr = argsp;
- a.xdr_args = xdrargs;
- r.port_ptr = port_ptr;
- r.results_ptr = resp;
- r.xdr_results = xdrres;
- stat = CLNT_CALL(client, PMAPPROC_CALLIT, (xdrproc_t)xdr_rmtcall_args, (caddr_t)&a,
- (xdrproc_t)xdr_rmtcallres, (caddr_t)&r, tout);
- CLNT_DESTROY(client);
- } else {
- stat = RPC_FAILED;
- }
- (void) close(socket);
- addr->sin_port = 0;
- return (stat);
-}
-
-
-/*
- * XDR remote call arguments
- * written for XDR_ENCODE direction only
- */
-bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap)
-{
- u_int lenposition, argposition, position;
-
- if (xdr_u_long(xdrs, &(cap->prog)) &&
- xdr_u_long(xdrs, &(cap->vers)) && xdr_u_long(xdrs, &(cap->proc))) {
- lenposition = XDR_GETPOS(xdrs);
- if (!xdr_u_long(xdrs, &(cap->arglen)))
- return (FALSE);
- argposition = XDR_GETPOS(xdrs);
- if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr))
- return (FALSE);
- position = XDR_GETPOS(xdrs);
- cap->arglen = (u_long) position - (u_long) argposition;
- XDR_SETPOS(xdrs, lenposition);
- if (!xdr_u_long(xdrs, &(cap->arglen)))
- return (FALSE);
- XDR_SETPOS(xdrs, position);
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * XDR remote call results
- * written for XDR_DECODE direction only
- */
-bool_t xdr_rmtcallres(XDR* xdrs, struct rmtcallres* crp)
-{
- caddr_t port_ptr;
-
- port_ptr = (caddr_t) crp->port_ptr;
- if (xdr_reference(xdrs, &port_ptr, sizeof(u_long),
- (xdrproc_t)xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) {
- crp->port_ptr = (u_long *) port_ptr;
- return ((*(crp->xdr_results)) (xdrs, crp->results_ptr));
- }
- return (FALSE);
-}
-
-
-/*
- * The following is kludged-up support for simple rpc broadcasts.
- * Someday a large, complicated system will replace these trivial
- * routines which only support udp/ip .
- */
-
-static int getbroadcastnets(addrs, sock, buf)
-struct in_addr *addrs;
-int sock; /* any valid socket will do */
-char *buf; /* why allocxate more when we can use existing... */
-{
-#ifdef __linux__
- struct sockaddr_in addr;
-
- get_myaddress(&addr);
-#if 1
- printf("%s(%d): no inet_makeaddr()\n", __FILE__, __LINE__);
-#else
- addrs[0] = inet_makeaddr(inet_netof(addr.sin_addr), INADDR_ANY);
-#endif
- return 1;
-#else
- struct ifconf ifc;
- struct ifreq ifreq, *ifr;
- struct sockaddr_in *sin;
- int n, i;
-
- ifc.ifc_len = UDPMSGSIZE;
- ifc.ifc_buf = buf;
- if (ioctl(sock, SIOCGIFCONF, (char *) &ifc) < 0) {
- perror("broadcast: ioctl (get interface configuration)");
- return (0);
- }
- ifr = ifc.ifc_req;
- for (i = 0, n = ifc.ifc_len / sizeof(struct ifreq); n > 0; n--, ifr++) {
- ifreq = *ifr;
- if (ioctl(sock, SIOCGIFFLAGS, (char *) &ifreq) < 0) {
- perror("broadcast: ioctl (get interface flags)");
- continue;
- }
- if ((ifreq.ifr_flags & IFF_BROADCAST) &&
- (ifreq.ifr_flags & IFF_UP) &&
- ifr->ifr_addr.sa_family == AF_INET) {
- sin = (struct sockaddr_in *) &ifr->ifr_addr;
-#ifdef SIOCGIFBRDADDR /* 4.3BSD */
- if (ioctl(sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0) {
-#if 1
- printf("%s(%d): no inet_makeaddr()\n", __FILE__, __LINE__);
-#else
- addrs[i++] = inet_makeaddr(inet_netof
- (sin->sin_addr.s_addr),
- INADDR_ANY);
-#endif
- } else {
- addrs[i++] = ((struct sockaddr_in *)
- &ifreq.ifr_addr)->sin_addr;
- }
-#else /* 4.2 BSD */
-#if 1
- printf("%s(%d): no inet_makeaddr()\n", __FILE__, __LINE__);
-#else
- addrs[i++] = inet_makeaddr(inet_netof
- (sin->sin_addr.s_addr), INADDR_ANY);
-#endif
-#endif
- }
- }
- return (i);
-#endif
-}
-
-enum clnt_stat
-clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
- eachresult)
-u_long prog; /* program number */
-u_long vers; /* version number */
-u_long proc; /* procedure number */
-xdrproc_t xargs; /* xdr routine for args */
-caddr_t argsp; /* pointer to args */
-xdrproc_t xresults; /* xdr routine for results */
-caddr_t resultsp; /* pointer to results */
-resultproc_t eachresult; /* call with each result obtained */
-{
- enum clnt_stat stat;
- AUTH *unix_auth = authunix_create_default();
- XDR xdr_stream;
- register XDR *xdrs = &xdr_stream;
- int outlen, inlen, fromlen, nets;
- register int sock;
- int on = 1;
-
-#ifdef FD_SETSIZE
- fd_set mask;
- fd_set readfds;
-#else
- int readfds;
- register int mask;
-#endif /* def FD_SETSIZE */
- register int i;
- bool_t done = FALSE;
- register u_long xid;
- u_long port;
- struct in_addr addrs[20];
- struct sockaddr_in baddr, raddr; /* broadcast and response addresses */
- struct rmtcallargs a;
- struct rmtcallres r;
- struct rpc_msg msg;
- struct timeval t;
- char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE];
-
- /*
- * initialization: create a socket, a broadcast address, and
- * preserialize the arguments into a send buffer.
- */
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- perror("Cannot create socket for broadcast rpc");
- stat = RPC_CANTSEND;
- goto done_broad;
- }
-#ifdef SO_BROADCAST
- if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) < 0) {
- perror("Cannot set socket option SO_BROADCAST");
- stat = RPC_CANTSEND;
- goto done_broad;
- }
-#endif /* def SO_BROADCAST */
-#ifdef FD_SETSIZE
- FD_ZERO(&mask);
- FD_SET(sock, &mask);
-#else
- mask = (1 << sock);
-#endif /* def FD_SETSIZE */
- nets = getbroadcastnets(addrs, sock, inbuf);
- bzero((char *) &baddr, sizeof(baddr));
- baddr.sin_family = AF_INET;
- baddr.sin_port = htons(PMAPPORT);
- baddr.sin_addr.s_addr = htonl(INADDR_ANY);
-/* baddr.sin_addr.S_un.S_addr = htonl(INADDR_ANY); */
- (void) gettimeofday(&t, (struct timezone *) 0);
- msg.rm_xid = xid = getpid() ^ t.tv_sec ^ t.tv_usec;
- t.tv_usec = 0;
- msg.rm_direction = CALL;
- msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
- msg.rm_call.cb_prog = PMAPPROG;
- msg.rm_call.cb_vers = PMAPVERS;
- msg.rm_call.cb_proc = PMAPPROC_CALLIT;
- msg.rm_call.cb_cred = unix_auth->ah_cred;
- msg.rm_call.cb_verf = unix_auth->ah_verf;
- a.prog = prog;
- a.vers = vers;
- a.proc = proc;
- a.xdr_args = xargs;
- a.args_ptr = argsp;
- r.port_ptr = &port;
- r.xdr_results = xresults;
- r.results_ptr = resultsp;
- xdrmem_create(xdrs, outbuf, MAX_BROADCAST_SIZE, XDR_ENCODE);
- if ((!xdr_callmsg(xdrs, &msg)) || (!xdr_rmtcall_args(xdrs, &a))) {
- stat = RPC_CANTENCODEARGS;
- goto done_broad;
- }
- outlen = (int) xdr_getpos(xdrs);
- xdr_destroy(xdrs);
- /*
- * Basic loop: broadcast a packet and wait a while for response(s).
- * The response timeout grows larger per iteration.
- */
- for (t.tv_sec = 4; t.tv_sec <= 14; t.tv_sec += 2) {
- for (i = 0; i < nets; i++) {
- baddr.sin_addr = addrs[i];
- if (sendto(sock, outbuf, outlen, 0,
- (struct sockaddr *) &baddr,
- sizeof(struct sockaddr)) != outlen) {
- perror("Cannot send broadcast packet");
- stat = RPC_CANTSEND;
- goto done_broad;
- }
- }
- if (eachresult == NULL) {
- stat = RPC_SUCCESS;
- goto done_broad;
- }
- recv_again:
- msg.acpted_rply.ar_verf = _null_auth;
- msg.acpted_rply.ar_results.where = (caddr_t) & r;
- msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_rmtcallres;
- readfds = mask;
- switch (select(_rpc_dtablesize(), &readfds, 0, 0, &t)) {
-
- case 0: /* timed out */
- stat = RPC_TIMEDOUT;
- continue;
-
- case -1: /* some kind of error */
- if (errno == EINTR)
- goto recv_again;
- perror("Broadcast select problem");
- stat = RPC_CANTRECV;
- goto done_broad;
-
- } /* end of select results switch */
- try_again:
- fromlen = sizeof(struct sockaddr);
-
- inlen = recvfrom(sock, inbuf, UDPMSGSIZE, 0,
- (struct sockaddr *) &raddr, &fromlen);
- if (inlen < 0) {
- if (errno == EINTR)
- goto try_again;
- perror("Cannot receive reply to broadcast");
- stat = RPC_CANTRECV;
- goto done_broad;
- }
- if (inlen < sizeof(u_long))
- goto recv_again;
- /*
- * see if reply transaction id matches sent id.
- * If so, decode the results.
- */
- xdrmem_create(xdrs, inbuf, (u_int) inlen, XDR_DECODE);
- if (xdr_replymsg(xdrs, &msg)) {
- if ((msg.rm_xid == xid) &&
- (msg.rm_reply.rp_stat == MSG_ACCEPTED) &&
- (msg.acpted_rply.ar_stat == SUCCESS)) {
- raddr.sin_port = htons((u_short) port);
- done = (*eachresult) (resultsp, &raddr);
- }
- /* otherwise, we just ignore the errors ... */
- } else {
-#ifdef notdef
- /* some kind of deserialization problem ... */
- if (msg.rm_xid == xid)
- fprintf(stderr, "Broadcast deserialization problem");
- /* otherwise, just random garbage */
-#endif
- }
- xdrs->x_op = XDR_FREE;
- msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
- (void) xdr_replymsg(xdrs, &msg);
- (void) (*xresults) (xdrs, resultsp);
- xdr_destroy(xdrs);
- if (done) {
- stat = RPC_SUCCESS;
- goto done_broad;
- } else {
- goto recv_again;
- }
- }
- done_broad:
- (void) close(sock);
- AUTH_DESTROY(unix_auth);
- return (stat);
-}
diff --git a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c b/mdk-stage1/dietlibc/librpc/rpc_callmsg.c
deleted file mode 100644
index 4b3a9880e..000000000
--- a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * rpc_callmsg.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- */
-
-#include <sys/param.h>
-
-#include <rpc/rpc.h>
-#include <string.h>
-
-/*
- * XDR a call message
- */
-bool_t xdr_callmsg(xdrs, cmsg)
-register XDR *xdrs;
-register struct rpc_msg *cmsg;
-{
- register int32_t *buf;
- register struct opaque_auth *oa;
-
- if (xdrs->x_op == XDR_ENCODE) {
- if (cmsg->rm_call.cb_cred.oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT
- + RNDUP(cmsg->rm_call.cb_cred.oa_length)
- + 2 * BYTES_PER_XDR_UNIT
- + RNDUP(cmsg->rm_call.cb_verf.oa_length));
- if (buf != NULL) {
- IXDR_PUT_LONG(buf, cmsg->rm_xid);
- IXDR_PUT_ENUM(buf, cmsg->rm_direction);
- if (cmsg->rm_direction != CALL) {
- return (FALSE);
- }
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_rpcvers);
- if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
- return (FALSE);
- }
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_prog);
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_vers);
- IXDR_PUT_LONG(buf, cmsg->rm_call.cb_proc);
- oa = &cmsg->rm_call.cb_cred;
- IXDR_PUT_ENUM(buf, oa->oa_flavor);
- IXDR_PUT_LONG(buf, oa->oa_length);
- if (oa->oa_length) {
- bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length);
- buf += RNDUP(oa->oa_length) / sizeof(long);
- }
- oa = &cmsg->rm_call.cb_verf;
- IXDR_PUT_ENUM(buf, oa->oa_flavor);
- IXDR_PUT_LONG(buf, oa->oa_length);
- if (oa->oa_length) {
- bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length);
- /* no real need....
- buf += RNDUP(oa->oa_length) / sizeof (long);
- */
- }
- return (TRUE);
- }
- }
- if (xdrs->x_op == XDR_DECODE) {
- buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT);
- if (buf != NULL) {
- cmsg->rm_xid = IXDR_GET_LONG(buf);
- cmsg->rm_direction = IXDR_GET_ENUM(buf, enum msg_type);
-
- if (cmsg->rm_direction != CALL) {
- return (FALSE);
- }
- cmsg->rm_call.cb_rpcvers = IXDR_GET_LONG(buf);
- if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) {
- return (FALSE);
- }
- cmsg->rm_call.cb_prog = IXDR_GET_LONG(buf);
- cmsg->rm_call.cb_vers = IXDR_GET_LONG(buf);
- cmsg->rm_call.cb_proc = IXDR_GET_LONG(buf);
- oa = &cmsg->rm_call.cb_cred;
- oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
- oa->oa_length = IXDR_GET_LONG(buf);
- if (oa->oa_length) {
- if (oa->oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- if (oa->oa_base == NULL) {
- oa->oa_base = (caddr_t)
- mem_alloc(oa->oa_length);
- }
- buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
- if (buf == NULL) {
- if (xdr_opaque(xdrs, oa->oa_base,
- oa->oa_length) == FALSE) {
- return (FALSE);
- }
- } else {
- bcopy((caddr_t) buf, oa->oa_base, oa->oa_length);
- /* no real need....
- buf += RNDUP(oa->oa_length) /
- sizeof (long);
- */
- }
- }
- oa = &cmsg->rm_call.cb_verf;
- buf = XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT);
- if (buf == NULL) {
- if (xdr_enum(xdrs, &oa->oa_flavor) == FALSE ||
- xdr_u_int(xdrs, &oa->oa_length) == FALSE) {
- return (FALSE);
- }
- } else {
- oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t);
- oa->oa_length = IXDR_GET_LONG(buf);
- }
- if (oa->oa_length) {
- if (oa->oa_length > MAX_AUTH_BYTES) {
- return (FALSE);
- }
- if (oa->oa_base == NULL) {
- oa->oa_base = (caddr_t)
- mem_alloc(oa->oa_length);
- }
- buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
- if (buf == NULL) {
- if (xdr_opaque(xdrs, oa->oa_base,
- oa->oa_length) == FALSE) {
- return (FALSE);
- }
- } else {
- bcopy((caddr_t) buf, oa->oa_base, oa->oa_length);
- /* no real need...
- buf += RNDUP(oa->oa_length) /
- sizeof (long);
- */
- }
- }
- return (TRUE);
- }
- }
- if (xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
- xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) &&
- (cmsg->rm_direction == CALL) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
- (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) &&
- xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)))
- return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
- return (FALSE);
-}
diff --git a/mdk-stage1/dietlibc/librpc/rpc_commondata.c b/mdk-stage1/dietlibc/librpc/rpc_commondata.c
deleted file mode 100644
index 39648d284..000000000
--- a/mdk-stage1/dietlibc/librpc/rpc_commondata.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* @(#)rpc_commondata.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#include <rpc/rpc.h>
-/*
- * This file should only contain common data (global data) that is exported
- * by public interfaces
- */
-struct opaque_auth _null_auth;
-
-#ifdef FD_SETSIZE
-fd_set svc_fdset;
-#else
-int svc_fds;
-#endif /* def FD_SETSIZE */
-struct rpc_createerr rpc_createerr;
diff --git a/mdk-stage1/dietlibc/librpc/rpc_dtablesize.c b/mdk-stage1/dietlibc/librpc/rpc_dtablesize.c
deleted file mode 100644
index b08ebaccd..000000000
--- a/mdk-stage1/dietlibc/librpc/rpc_dtablesize.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* @(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro";
-#endif
-
-#include <unistd.h>
-
-/*
- * Cache the result of getdtablesize(), so we don't have to do an
- * expensive system call every time.
- */
-int _rpc_dtablesize()
-{
- static int size;
-
- if (size == 0) {
- size = getdtablesize();
- }
- return (size);
-}
diff --git a/mdk-stage1/dietlibc/librpc/rpc_prot.c b/mdk-stage1/dietlibc/librpc/rpc_prot.c
deleted file mode 100644
index 19a4db27f..000000000
--- a/mdk-stage1/dietlibc/librpc/rpc_prot.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * rpc_prot.c
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * This set of routines implements the rpc message definition,
- * its serializer and some common rpc utility routines.
- * The routines are meant for various implementations of rpc -
- * they are NOT for the rpc client or rpc service implementations!
- * Because authentication stuff is easy and is part of rpc, the opaque
- * routines are also in this program.
- */
-
-#include <sys/param.h>
-
-#include <rpc/rpc.h>
-
-/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
-
-struct opaque_auth _null_auth;
-
-/*
- * XDR an opaque authentication struct
- * (see auth.h)
- */
-bool_t xdr_opaque_auth(xdrs, ap)
-register XDR *xdrs;
-register struct opaque_auth *ap;
-{
-
- if (xdr_enum(xdrs, &(ap->oa_flavor)))
- return (xdr_bytes(xdrs, &ap->oa_base,
- &ap->oa_length, MAX_AUTH_BYTES));
- return (FALSE);
-}
-
-/*
- * XDR a DES block
- */
-bool_t xdr_des_block(xdrs, blkp)
-register XDR *xdrs;
-register des_block *blkp;
-{
- return (xdr_opaque(xdrs, (caddr_t) blkp, sizeof(des_block)));
-}
-
-/* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */
-
-/*
- * XDR the MSG_ACCEPTED part of a reply message union
- */
-bool_t xdr_accepted_reply(xdrs, ar)
-register XDR *xdrs;
-register struct accepted_reply *ar;
-{
-
- /* personalized union, rather than calling xdr_union */
- if (!xdr_opaque_auth(xdrs, &(ar->ar_verf)))
- return (FALSE);
- if (!xdr_enum(xdrs, (enum_t *) & (ar->ar_stat)))
- return (FALSE);
- switch (ar->ar_stat) {
-
- case SUCCESS:
- return ((*(ar->ar_results.proc)) (xdrs, ar->ar_results.where));
-
- case PROG_MISMATCH:
- if (!xdr_u_long(xdrs, &(ar->ar_vers.low)))
- return (FALSE);
- return (xdr_u_long(xdrs, &(ar->ar_vers.high)));
- }
- return (TRUE); /* TRUE => open ended set of problems */
-}
-
-/*
- * XDR the MSG_DENIED part of a reply message union
- */
-bool_t xdr_rejected_reply(xdrs, rr)
-register XDR *xdrs;
-register struct rejected_reply *rr;
-{
-
- /* personalized union, rather than calling xdr_union */
- if (!xdr_enum(xdrs, (enum_t *) & (rr->rj_stat)))
- return (FALSE);
- switch (rr->rj_stat) {
-
- case RPC_MISMATCH:
- if (!xdr_u_long(xdrs, &(rr->rj_vers.low)))
- return (FALSE);
- return (xdr_u_long(xdrs, &(rr->rj_vers.high)));
-
- case AUTH_ERROR:
- return (xdr_enum(xdrs, (enum_t *) & (rr->rj_why)));
- }
- return (FALSE);
-}
-
-static struct xdr_discrim reply_dscrm[3] = {
- {(int) MSG_ACCEPTED, (xdrproc_t)xdr_accepted_reply},
- {(int) MSG_DENIED, (xdrproc_t)xdr_rejected_reply},
- {__dontcare__, NULL_xdrproc_t}
-};
-
-/*
- * XDR a reply message
- */
-bool_t xdr_replymsg(xdrs, rmsg)
-register XDR *xdrs;
-register struct rpc_msg *rmsg;
-{
- if (xdr_u_long(xdrs, &(rmsg->rm_xid)) &&
- xdr_enum(xdrs, (enum_t *) & (rmsg->rm_direction)) &&
- (rmsg->rm_direction == REPLY))
- return (xdr_union(xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat),
- (caddr_t) & (rmsg->rm_reply.ru), reply_dscrm,
- NULL_xdrproc_t));
- return (FALSE);
-}
-
-
-/*
- * Serializes the "static part" of a call message header.
- * The fields include: rm_xid, rm_direction, rpcvers, prog, and vers.
- * The rm_xid is not really static, but the user can easily munge on the fly.
- */
-bool_t xdr_callhdr(xdrs, cmsg)
-register XDR *xdrs;
-register struct rpc_msg *cmsg;
-{
-
- cmsg->rm_direction = CALL;
- cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION;
- if (
- (xdrs->x_op == XDR_ENCODE) &&
- xdr_u_long(xdrs, &(cmsg->rm_xid)) &&
- xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
- xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)))
- return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)));
- return (FALSE);
-}
-
-/* ************************** Client utility routine ************* */
-
-static void accepted(acpt_stat, error)
-register enum accept_stat acpt_stat;
-register struct rpc_err *error;
-{
-
- switch (acpt_stat) {
-
- case PROG_UNAVAIL:
- error->re_status = RPC_PROGUNAVAIL;
- return;
-
- case PROG_MISMATCH:
- error->re_status = RPC_PROGVERSMISMATCH;
- return;
-
- case PROC_UNAVAIL:
- error->re_status = RPC_PROCUNAVAIL;
- return;
-
- case GARBAGE_ARGS:
- error->re_status = RPC_CANTDECODEARGS;
- return;
-
- case SYSTEM_ERR:
- error->re_status = RPC_SYSTEMERROR;
- return;
-
- case SUCCESS:
- error->re_status = RPC_SUCCESS;
- return;
- }
- /* something's wrong, but we don't know what ... */
- error->re_status = RPC_FAILED;
- error->re_lb.s1 = (long) MSG_ACCEPTED;
- error->re_lb.s2 = (long) acpt_stat;
-}
-
-static void rejected(rjct_stat, error)
-register enum reject_stat rjct_stat;
-register struct rpc_err *error;
-{
-
- switch (rjct_stat) {
-
- case RPC_VERSMISMATCH:
- error->re_status = RPC_VERSMISMATCH;
- return;
-
- case AUTH_ERROR:
- error->re_status = RPC_AUTHERROR;
- return;
- }
- /* something's wrong, but we don't know what ... */
- error->re_status = RPC_FAILED;
- error->re_lb.s1 = (long) MSG_DENIED;
- error->re_lb.s2 = (long) rjct_stat;
-}
-
-/*
- * given a reply message, fills in the error
- */
-void _seterr_reply(msg, error)
-register struct rpc_msg *msg;
-register struct rpc_err *error;
-{
-
- /* optimized for normal, SUCCESSful case */
- switch (msg->rm_reply.rp_stat) {
-
- case MSG_ACCEPTED:
- if (msg->acpted_rply.ar_stat == SUCCESS) {
- error->re_status = RPC_SUCCESS;
- return;
- };
- accepted(msg->acpted_rply.ar_stat, error);
- break;
-
- case MSG_DENIED:
- rejected(msg->rjcted_rply.rj_stat, error);
- break;
-
- default:
- error->re_status = RPC_FAILED;
- error->re_lb.s1 = (long) (msg->rm_reply.rp_stat);
- break;
- }
- switch (error->re_status) {
-
- case RPC_VERSMISMATCH:
- error->re_vers.low = msg->rjcted_rply.rj_vers.low;
- error->re_vers.high = msg->rjcted_rply.rj_vers.high;
- break;
-
- case RPC_AUTHERROR:
- error->re_why = msg->rjcted_rply.rj_why;
- break;
-
- case RPC_PROGVERSMISMATCH:
- error->re_vers.low = msg->acpted_rply.ar_vers.low;
- error->re_vers.high = msg->acpted_rply.ar_vers.high;
- break;
- }
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc.c b/mdk-stage1/dietlibc/librpc/svc.c
deleted file mode 100644
index 4fcdb5216..000000000
--- a/mdk-stage1/dietlibc/librpc/svc.c
+++ /dev/null
@@ -1,479 +0,0 @@
-/* @(#)svc.c 2.4 88/08/11 4.0 RPCSRC; from 1.44 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc.c, Server-side remote procedure call interface.
- *
- * There are two sets of procedures here. The xprt routines are
- * for handling transport handles. The svc routines handle the
- * list of service routines.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <errno.h>
-#include <rpc/rpc.h>
-#include <rpc/pmap_clnt.h>
-#ifdef __linux__
-#include <sys/types.h>
-#endif
-
-extern int errno;
-
-#ifdef FD_SETSIZE
-static SVCXPRT **xports;
-#else
-#define NOFILE 32
-
-static SVCXPRT *xports[NOFILE];
-#endif /* def FD_SETSIZE */
-
-#define NULL_SVC ((struct svc_callout *)0)
-#define RQCRED_SIZE 400 /* this size is excessive */
-
-/*
- * The services list
- * Each entry represents a set of procedures (an rpc program).
- * The dispatch routine takes request structs and runs the
- * apropriate procedure.
- */
-static struct svc_callout {
- struct svc_callout *sc_next;
- u_long sc_prog;
- u_long sc_vers;
- void (*sc_dispatch) ();
-} *svc_head;
-
-static struct svc_callout *svc_find();
-
-/* *************** SVCXPRT related stuff **************** */
-
-/*
- * Activate a transport handle.
- */
-void xprt_register(xprt)
-SVCXPRT *xprt;
-{
- register int sock = xprt->xp_sock;
-
-#ifdef FD_SETSIZE
- if (xports == NULL) {
- xports = (SVCXPRT **)
- mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
- }
- if (sock < _rpc_dtablesize()) {
- xports[sock] = xprt;
- FD_SET(sock, &svc_fdset);
- }
-#else
- if (sock < NOFILE) {
- xports[sock] = xprt;
- svc_fds |= (1 << sock);
- }
-#endif /* def FD_SETSIZE */
-
-}
-
-/*
- * De-activate a transport handle.
- */
-void xprt_unregister(xprt)
-SVCXPRT *xprt;
-{
- register int sock = xprt->xp_sock;
-
-#ifdef FD_SETSIZE
- if ((sock < _rpc_dtablesize()) && (xports[sock] == xprt)) {
- xports[sock] = (SVCXPRT *) 0;
- FD_CLR(sock, &svc_fdset);
- }
-#else
- if ((sock < NOFILE) && (xports[sock] == xprt)) {
- xports[sock] = (SVCXPRT *) 0;
- svc_fds &= ~(1 << sock);
- }
-#endif /* def FD_SETSIZE */
-}
-
-
-/* ********************** CALLOUT list related stuff ************* */
-
-/*
- * Add a service program to the callout list.
- * The dispatch routine will be called when a rpc request for this
- * program number comes in.
- */
-bool_t svc_register(xprt, prog, vers, dispatch, protocol)
-SVCXPRT *xprt;
-u_long prog;
-u_long vers;
-void (*dispatch) ();
-rpcprot_t protocol;
-{
- struct svc_callout *prev;
- register struct svc_callout *s;
-
- if ((s = svc_find(prog, vers, &prev)) != NULL_SVC) {
- if (s->sc_dispatch == dispatch)
- goto pmap_it; /* he is registering another xptr */
- return (FALSE);
- }
- s = (struct svc_callout *) mem_alloc(sizeof(struct svc_callout));
-
- if (s == (struct svc_callout *) 0) {
- return (FALSE);
- }
- s->sc_prog = prog;
- s->sc_vers = vers;
- s->sc_dispatch = dispatch;
- s->sc_next = svc_head;
- svc_head = s;
- pmap_it:
- /* now register the information with the local binder service */
- if (protocol) {
- return (pmap_set(prog, vers, protocol, xprt->xp_port));
- }
- return (TRUE);
-}
-
-/*
- * Remove a service program from the callout list.
- */
-void svc_unregister(prog, vers)
-u_long prog;
-u_long vers;
-{
- struct svc_callout *prev;
- register struct svc_callout *s;
-
- if ((s = svc_find(prog, vers, &prev)) == NULL_SVC)
- return;
- if (prev == NULL_SVC) {
- svc_head = s->sc_next;
- } else {
- prev->sc_next = s->sc_next;
- }
- s->sc_next = NULL_SVC;
- mem_free((char *) s, (u_int) sizeof(struct svc_callout));
-
- /* now unregister the information with the local binder service */
- (void) pmap_unset(prog, vers);
-}
-
-/*
- * Search the callout list for a program number, return the callout
- * struct.
- */
-static struct svc_callout *svc_find(prog, vers, prev)
-u_long prog;
-u_long vers;
-struct svc_callout **prev;
-{
- register struct svc_callout *s, *p;
-
- p = NULL_SVC;
- for (s = svc_head; s != NULL_SVC; s = s->sc_next) {
- if ((s->sc_prog == prog) && (s->sc_vers == vers))
- goto done;
- p = s;
- }
- done:
- *prev = p;
- return (s);
-}
-
-/* ******************* REPLY GENERATION ROUTINES ************ */
-
-/*
- * Send a reply to an rpc request
- */
-bool_t svc_sendreply(xprt, xdr_results, xdr_location)
-register SVCXPRT *xprt;
-xdrproc_t xdr_results;
-caddr_t xdr_location;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = SUCCESS;
- rply.acpted_rply.ar_results.where = xdr_location;
- rply.acpted_rply.ar_results.proc = xdr_results;
- return (SVC_REPLY(xprt, &rply));
-}
-
-/*
- * No procedure error reply
- */
-void svcerr_noproc(xprt)
-register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = PROC_UNAVAIL;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Can't decode args error reply
- */
-void svcerr_decode(xprt)
-register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = GARBAGE_ARGS;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Some system error
- */
-void svcerr_systemerr(xprt)
-register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = SYSTEM_ERR;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Authentication error reply
- */
-void svcerr_auth(xprt, why)
-SVCXPRT *xprt;
-enum auth_stat why;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_DENIED;
- rply.rjcted_rply.rj_stat = AUTH_ERROR;
- rply.rjcted_rply.rj_why = why;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Auth too weak error reply
- */
-void svcerr_weakauth(xprt)
-SVCXPRT *xprt;
-{
-
- svcerr_auth(xprt, AUTH_TOOWEAK);
-}
-
-/*
- * Program unavailable error reply
- */
-void svcerr_noprog(xprt)
-register SVCXPRT *xprt;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = PROG_UNAVAIL;
- SVC_REPLY(xprt, &rply);
-}
-
-/*
- * Program version mismatch error reply
- */
-void svcerr_progvers(xprt, low_vers, high_vers)
-register SVCXPRT *xprt;
-u_long low_vers;
-u_long high_vers;
-{
- struct rpc_msg rply;
-
- rply.rm_direction = REPLY;
- rply.rm_reply.rp_stat = MSG_ACCEPTED;
- rply.acpted_rply.ar_verf = xprt->xp_verf;
- rply.acpted_rply.ar_stat = PROG_MISMATCH;
- rply.acpted_rply.ar_vers.low = low_vers;
- rply.acpted_rply.ar_vers.high = high_vers;
- SVC_REPLY(xprt, &rply);
-}
-
-/* ******************* SERVER INPUT STUFF ******************* */
-
-/*
- * Get server side input from some transport.
- *
- * Statement of authentication parameters management:
- * This function owns and manages all authentication parameters, specifically
- * the "raw" parameters (msg.rm_call.cb_cred and msg.rm_call.cb_verf) and
- * the "cooked" credentials (rqst->rq_clntcred).
- * However, this function does not know the structure of the cooked
- * credentials, so it make the following assumptions:
- * a) the structure is contiguous (no pointers), and
- * b) the cred structure size does not exceed RQCRED_SIZE bytes.
- * In all events, all three parameters are freed upon exit from this routine.
- * The storage is trivially management on the call stack in user land, but
- * is mallocated in kernel land.
- */
-
-void svc_getreq(rdfds)
-int rdfds;
-{
-#ifdef FD_SETSIZE
- fd_set readfds;
-
- FD_ZERO(&readfds);
-/*#ifdef __linux__*/
-#if 0
- readfds = rdfds;
-#else
- readfds.fds_bits[0] = rdfds;
-#endif
- svc_getreqset(&readfds);
-#else
- int readfds = rdfds & svc_fds;
-
- svc_getreqset(&readfds);
-#endif /* def FD_SETSIZE */
-}
-
-void svc_getreqset(readfds)
-#ifdef FD_SETSIZE
-fd_set *readfds;
-{
-#else
-int *readfds;
-{
- int readfds_local = *readfds;
-#endif /* def FD_SETSIZE */
- enum xprt_stat stat;
- struct rpc_msg msg;
- int prog_found;
- u_long low_vers;
- u_long high_vers;
- struct svc_req r;
- register SVCXPRT *xprt;
- register u_long mask;
- register int bit;
- register u_long *maskp;
- register int setsize;
- register int sock;
- char cred_area[2 * MAX_AUTH_BYTES + RQCRED_SIZE];
-
- msg.rm_call.cb_cred.oa_base = cred_area;
- msg.rm_call.cb_verf.oa_base = &(cred_area[MAX_AUTH_BYTES]);
- r.rq_clntcred = &(cred_area[2 * MAX_AUTH_BYTES]);
-
-
-#ifdef FD_SETSIZE
- setsize = _rpc_dtablesize();
-#ifdef __linux__
-/*#define NFDBITS 32*/
- maskp = (u_long *) readfds;
-#else
- maskp = (u_long *) readfds->fds_bits;
-#endif
- for (sock = 0; sock < setsize; sock += NFDBITS) {
- for (mask = *maskp++; (bit = ffs(mask)); mask ^= (1 << (bit - 1))) {
- /* sock has input waiting */
- xprt = xports[sock + bit - 1];
-#else
- for (sock = 0; readfds_local != 0; sock++, readfds_local >>= 1) {
- if ((readfds_local & 1) != 0) {
- /* sock has input waiting */
- xprt = xports[sock];
-#endif /* def FD_SETSIZE */
- /* now receive msgs from xprtprt (support batch calls) */
- do {
- if (SVC_RECV(xprt, &msg)) {
-
- /* now find the exported program and call it */
- register struct svc_callout *s;
- enum auth_stat why;
-
- r.rq_xprt = xprt;
- r.rq_prog = msg.rm_call.cb_prog;
- r.rq_vers = msg.rm_call.cb_vers;
- r.rq_proc = msg.rm_call.cb_proc;
- r.rq_cred = msg.rm_call.cb_cred;
- /* first authenticate the message */
- if ((why = _authenticate(&r, &msg)) != AUTH_OK) {
- svcerr_auth(xprt, why);
- goto call_done;
- }
- /* now match message with a registered service */
- prog_found = FALSE;
- low_vers = 0 - 1;
- high_vers = 0;
- for (s = svc_head; s != NULL_SVC; s = s->sc_next) {
- if (s->sc_prog == r.rq_prog) {
- if (s->sc_vers == r.rq_vers) {
- (*s->sc_dispatch) (&r, xprt);
- goto call_done;
- } /* found correct version */
- prog_found = TRUE;
- if (s->sc_vers < low_vers)
- low_vers = s->sc_vers;
- if (s->sc_vers > high_vers)
- high_vers = s->sc_vers;
- } /* found correct program */
- }
- /*
- * if we got here, the program or version
- * is not served ...
- */
- if (prog_found)
- svcerr_progvers(xprt, low_vers, high_vers);
- else
- svcerr_noprog(xprt);
- /* Fall through to ... */
- }
- call_done:
- if ((stat = SVC_STAT(xprt)) == XPRT_DIED) {
- SVC_DESTROY(xprt);
- break;
- }
- } while (stat == XPRT_MOREREQS);
- }
- }
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc_auth.c b/mdk-stage1/dietlibc/librpc/svc_auth.c
deleted file mode 100644
index 336586d95..000000000
--- a/mdk-stage1/dietlibc/librpc/svc_auth.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)svc_auth.c 2.1 88/08/07 4.0 RPCSRC; from 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * svc_auth_nodes.c, Server-side rpc authenticator interface,
- * *WITHOUT* DES authentication.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-
-/*
- * svcauthsw is the bdevsw of server side authentication.
- *
- * Server side authenticators are called from authenticate by
- * using the client auth struct flavor field to index into svcauthsw.
- * The server auth flavors must implement a routine that looks
- * like:
- *
- * enum auth_stat
- * flavorx_auth(rqst, msg)
- * register struct svc_req *rqst;
- * register struct rpc_msg *msg;
- *
- */
-
-enum auth_stat _svcauth_null(); /* no authentication */
-enum auth_stat _svcauth_unix(); /* unix style (uid, gids) */
-enum auth_stat _svcauth_short(); /* short hand unix style */
-
-static struct {
- enum auth_stat (*authenticator) ();
-} svcauthsw[] = {
- { _svcauth_null }, /* AUTH_NULL */
- { _svcauth_unix }, /* AUTH_UNIX */
- { _svcauth_short }, /* AUTH_SHORT */
-};
-
-#define AUTH_MAX 2 /* HIGHEST AUTH NUMBER */
-
-
-/*
- * The call rpc message, msg has been obtained from the wire. The msg contains
- * the raw form of credentials and verifiers. authenticate returns AUTH_OK
- * if the msg is successfully authenticated. If AUTH_OK then the routine also
- * does the following things:
- * set rqst->rq_xprt->verf to the appropriate response verifier;
- * sets rqst->rq_client_cred to the "cooked" form of the credentials.
- *
- * NB: rqst->rq_cxprt->verf must be pre-alloctaed;
- * its length is set appropriately.
- *
- * The caller still owns and is responsible for msg->u.cmb.cred and
- * msg->u.cmb.verf. The authentication system retains ownership of
- * rqst->rq_client_cred, the cooked credentials.
- *
- * There is an assumption that any flavour less than AUTH_NULL is
- * invalid.
- */
-enum auth_stat _authenticate(rqst, msg)
-register struct svc_req *rqst;
-struct rpc_msg *msg;
-{
- register int cred_flavor;
-
- rqst->rq_cred = msg->rm_call.cb_cred;
- rqst->rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor;
- rqst->rq_xprt->xp_verf.oa_length = 0;
- cred_flavor = rqst->rq_cred.oa_flavor;
- if ((cred_flavor <= AUTH_MAX) && (cred_flavor >= AUTH_NULL)) {
- return ((*(svcauthsw[cred_flavor].authenticator)) (rqst, msg));
- }
-
- return (AUTH_REJECTEDCRED);
-}
-
-enum auth_stat _svcauth_null( /*rqst, msg */ )
- /*struct svc_req *rqst;
- struct rpc_msg *msg; */
-{
-
- return (AUTH_OK);
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c b/mdk-stage1/dietlibc/librpc/svc_auth_unix.c
deleted file mode 100644
index 7e0305f0a..000000000
--- a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* @(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC; from 1.28 88/02/08 SMI */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_auth_unix.c
- * Handles UNIX flavor authentication parameters on the service side of rpc.
- * There are two svc auth implementations here: AUTH_UNIX and AUTH_SHORT.
- * _svcauth_unix does full blown unix style uid,gid+gids auth,
- * _svcauth_short uses a shorthand auth to index into a cache of longhand auths.
- * Note: the shorthand has been gutted for efficiency.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <string.h>
-
-/*
- * Unix longhand authenticator
- */
-enum auth_stat _svcauth_unix(rqst, msg)
-register struct svc_req *rqst;
-register struct rpc_msg *msg;
-{
- register enum auth_stat stat;
- XDR xdrs;
- register struct authunix_parms *aup;
- register int32_t *buf;
- struct area {
- struct authunix_parms area_aup;
- char area_machname[MAX_MACHINE_NAME + 1];
- gid_t area_gids[NGRPS];
- } *area;
- u_int auth_len;
- int str_len, gid_len;
- register int i;
-
- area = (struct area *) rqst->rq_clntcred;
- aup = &area->area_aup;
- aup->aup_machname = area->area_machname;
- aup->aup_gids = area->area_gids;
- auth_len = (u_int) msg->rm_call.cb_cred.oa_length;
- xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len,
- XDR_DECODE);
- buf = XDR_INLINE(&xdrs, auth_len);
- if (buf != NULL) {
- aup->aup_time = IXDR_GET_LONG(buf);
- str_len = IXDR_GET_U_LONG(buf);
- if (str_len > MAX_MACHINE_NAME) {
- stat = AUTH_BADCRED;
- goto done;
- }
- bcopy((caddr_t) buf, aup->aup_machname, (u_int) str_len);
- aup->aup_machname[str_len] = 0;
- str_len = RNDUP(str_len);
- buf += str_len / sizeof(long);
-
- aup->aup_uid = IXDR_GET_LONG(buf);
- aup->aup_gid = IXDR_GET_LONG(buf);
- gid_len = IXDR_GET_U_LONG(buf);
- if (gid_len > NGRPS) {
- stat = AUTH_BADCRED;
- goto done;
- }
- aup->aup_len = gid_len;
- for (i = 0; i < gid_len; i++) {
- aup->aup_gids[i] = IXDR_GET_LONG(buf);
- }
- /*
- * five is the smallest unix credentials structure -
- * timestamp, hostname len (0), uid, gid, and gids len (0).
- */
- if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) {
- (void) printf("bad auth_len gid %d str %d auth %d\n",
- gid_len, str_len, auth_len);
- stat = AUTH_BADCRED;
- goto done;
- }
- } else if (!xdr_authunix_parms(&xdrs, aup)) {
- xdrs.x_op = XDR_FREE;
- (void) xdr_authunix_parms(&xdrs, aup);
- stat = AUTH_BADCRED;
- goto done;
- }
- rqst->rq_xprt->xp_verf.oa_flavor = AUTH_NULL;
- rqst->rq_xprt->xp_verf.oa_length = 0;
- stat = AUTH_OK;
- done:
- XDR_DESTROY(&xdrs);
- return (stat);
-}
-
-
-/*
- * Shorthand unix authenticator
- * Looks up longhand in a cache.
- */
- /*ARGSUSED*/ enum auth_stat _svcauth_short(rqst, msg)
-struct svc_req *rqst;
-struct rpc_msg *msg;
-{
- return (AUTH_REJECTEDCRED);
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc_raw.c b/mdk-stage1/dietlibc/librpc/svc_raw.c
deleted file mode 100644
index c13ea5e06..000000000
--- a/mdk-stage1/dietlibc/librpc/svc_raw.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* @(#)svc_raw.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_raw.c, This a toy for simple testing and timing.
- * Interface to create an rpc client and server in the same UNIX process.
- * This lets us similate rpc and get rpc (round trip) overhead, without
- * any interference from the kernal.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <rpc/rpc.h>
-
-
-/*
- * This is the "network" that we will be moving data over
- */
-static struct svcraw_private {
- char _raw_buf[UDPMSGSIZE];
- SVCXPRT server;
- XDR xdr_stream;
- char verf_body[MAX_AUTH_BYTES];
-} *svcraw_private;
-
-static bool_t svcraw_recv();
-static enum xprt_stat svcraw_stat();
-static bool_t svcraw_getargs();
-static bool_t svcraw_reply();
-static bool_t svcraw_freeargs();
-static void svcraw_destroy();
-
-static struct xp_ops server_ops = {
- svcraw_recv,
- svcraw_stat,
- svcraw_getargs,
- svcraw_reply,
- svcraw_freeargs,
- svcraw_destroy
-};
-
-SVCXPRT *svcraw_create()
-{
- register struct svcraw_private *srp = svcraw_private;
-
- if (srp == 0) {
- srp = (struct svcraw_private *) calloc(1, sizeof(*srp));
- if (srp == 0)
- return (0);
- }
- srp->server.xp_sock = 0;
- srp->server.xp_port = 0;
- srp->server.xp_ops = &server_ops;
- srp->server.xp_verf.oa_base = srp->verf_body;
- xdrmem_create(&srp->xdr_stream, srp->_raw_buf, UDPMSGSIZE, XDR_FREE);
- return (&srp->server);
-}
-
-static enum xprt_stat svcraw_stat()
-{
-
- return (XPRT_IDLE);
-}
-
-static bool_t svcraw_recv(xprt, msg)
-SVCXPRT *xprt;
-struct rpc_msg *msg;
-{
- register struct svcraw_private *srp = svcraw_private;
- register XDR *xdrs;
-
- if (srp == 0)
- return (0);
- xdrs = &srp->xdr_stream;
- xdrs->x_op = XDR_DECODE;
- XDR_SETPOS(xdrs, 0);
- if (!xdr_callmsg(xdrs, msg))
- return (FALSE);
- return (TRUE);
-}
-
-static bool_t svcraw_reply(xprt, msg)
-SVCXPRT *xprt;
-struct rpc_msg *msg;
-{
- register struct svcraw_private *srp = svcraw_private;
- register XDR *xdrs;
-
- if (srp == 0)
- return (FALSE);
- xdrs = &srp->xdr_stream;
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, 0);
- if (!xdr_replymsg(xdrs, msg))
- return (FALSE);
- (void) XDR_GETPOS(xdrs); /* called just for overhead */
- return (TRUE);
-}
-
-static bool_t svcraw_getargs(xprt, xdr_args, args_ptr)
-SVCXPRT *xprt;
-xdrproc_t xdr_args;
-caddr_t args_ptr;
-{
- register struct svcraw_private *srp = svcraw_private;
-
- if (srp == 0)
- return (FALSE);
- return ((*xdr_args) (&srp->xdr_stream, args_ptr));
-}
-
-static bool_t svcraw_freeargs(xprt, xdr_args, args_ptr)
-SVCXPRT *xprt;
-xdrproc_t xdr_args;
-caddr_t args_ptr;
-{
- register struct svcraw_private *srp = svcraw_private;
- register XDR *xdrs;
-
- if (srp == 0)
- return (FALSE);
- xdrs = &srp->xdr_stream;
- xdrs->x_op = XDR_FREE;
- return ((*xdr_args) (xdrs, args_ptr));
-}
-
-static void svcraw_destroy()
-{
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc_run.c b/mdk-stage1/dietlibc/librpc/svc_run.c
deleted file mode 100644
index c7150e357..000000000
--- a/mdk-stage1/dietlibc/librpc/svc_run.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * This is the rpc server side idle loop
- * Wait for input, call server program.
- */
-#include <rpc/rpc.h>
-#include <errno.h>
-#include <unistd.h>
-
-void svc_run()
-{
-#ifdef FD_SETSIZE
- fd_set readfds;
-#else
- int readfds;
-#endif /* def FD_SETSIZE */
- extern int errno;
-
- for (;;) {
-#ifdef FD_SETSIZE
- readfds = svc_fdset;
-#else
- readfds = svc_fds;
-#endif /* def FD_SETSIZE */
- switch (select(_rpc_dtablesize(), &readfds, 0, 0, 0)) {
- case -1:
- if (errno == EINTR) {
- continue;
- }
- perror("svc_run: - select failed");
- return;
- case 0:
- continue;
- default:
- svc_getreqset(&readfds);
- }
- }
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc_simple.c b/mdk-stage1/dietlibc/librpc/svc_simple.c
deleted file mode 100644
index 0bb9a19eb..000000000
--- a/mdk-stage1/dietlibc/librpc/svc_simple.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* @(#)svc_simple.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_simple.c
- * Simplified front end to rpc.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <rpc/pmap_clnt.h>
-#include <string.h>
-
-static struct proglst {
- char *(*p_progname) ();
- int p_prognum;
- int p_procnum;
- xdrproc_t p_inproc, p_outproc;
- struct proglst *p_nxt;
-} *proglst;
-static void universal();
-static SVCXPRT *transp;
-struct proglst *pl;
-
-int registerrpc(int prognum, int versnum, int procnum, char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc)
-{
-
- if (procnum == NULLPROC) {
- (void) fprintf(stderr,
- "can't reassign procedure number %d\n", NULLPROC);
- return (-1);
- }
- if (transp == 0) {
- transp = svcudp_create(RPC_ANYSOCK);
- if (transp == NULL) {
- (void) fprintf(stderr, "couldn't create an rpc server\n");
- return (-1);
- }
- }
- (void) pmap_unset((u_long) prognum, (u_long) versnum);
- if (!svc_register(transp, (u_long) prognum, (u_long) versnum,
- universal, IPPROTO_UDP)) {
- (void) fprintf(stderr, "couldn't register prog %d vers %d\n",
- prognum, versnum);
- return (-1);
- }
- pl = (struct proglst *) malloc(sizeof(struct proglst));
-
- if (pl == NULL) {
- (void) fprintf(stderr, "registerrpc: out of memory\n");
- return (-1);
- }
- pl->p_progname = progname;
- pl->p_prognum = prognum;
- pl->p_procnum = procnum;
- pl->p_inproc = inproc;
- pl->p_outproc = outproc;
- pl->p_nxt = proglst;
- proglst = pl;
- return (0);
-}
-
-static void universal(rqstp, transp)
-struct svc_req *rqstp;
-SVCXPRT *transp;
-{
- int prog, proc;
- char *outdata;
- char xdrbuf[UDPMSGSIZE];
- struct proglst *pl;
-
- /*
- * enforce "procnum 0 is echo" convention
- */
- if (rqstp->rq_proc == NULLPROC) {
- if (svc_sendreply(transp, (xdrproc_t)xdr_void, (char *) NULL) == FALSE) {
- (void) fprintf(stderr, "xxx\n");
- exit(1);
- }
- return;
- }
- prog = rqstp->rq_prog;
- proc = rqstp->rq_proc;
- for (pl = proglst; pl != NULL; pl = pl->p_nxt)
- if (pl->p_prognum == prog && pl->p_procnum == proc) {
- /* decode arguments into a CLEAN buffer */
- bzero(xdrbuf, sizeof(xdrbuf)); /* required ! */
- if (!svc_getargs(transp, pl->p_inproc, xdrbuf)) {
- svcerr_decode(transp);
- return;
- }
- outdata = (*(pl->p_progname)) (xdrbuf);
- if (outdata == NULL && pl->p_outproc != (xdrproc_t)xdr_void)
- /* there was an error */
- return;
- if (!svc_sendreply(transp, pl->p_outproc, outdata)) {
- (void) fprintf(stderr,
- "trouble replying to prog %d\n",
- pl->p_prognum);
- exit(1);
- }
- /* free the decoded arguments */
- (void) svc_freeargs(transp, pl->p_inproc, xdrbuf);
- return;
- }
- (void) fprintf(stderr, "never registered prog %d\n", prog);
- exit(1);
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc_tcp.c b/mdk-stage1/dietlibc/librpc/svc_tcp.c
deleted file mode 100644
index 6edafa1b1..000000000
--- a/mdk-stage1/dietlibc/librpc/svc_tcp.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/* @(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_tcp.c, Server side for TCP/IP based RPC.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * Actually implements two flavors of transporter -
- * a tcp rendezvouser (a listner and connection establisher)
- * and a record/tcp stream.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-/*
- * Ops vector for TCP/IP based rpc service handle
- */
-static bool_t svctcp_recv();
-static enum xprt_stat svctcp_stat();
-static bool_t svctcp_getargs();
-static bool_t svctcp_reply();
-static bool_t svctcp_freeargs();
-static void svctcp_destroy();
-
-static struct xp_ops svctcp_op = {
- svctcp_recv,
- svctcp_stat,
- svctcp_getargs,
- svctcp_reply,
- svctcp_freeargs,
- svctcp_destroy
-};
-
-/*
- * Ops vector for TCP/IP rendezvous handler
- */
-static bool_t rendezvous_request();
-static enum xprt_stat rendezvous_stat();
-
-static struct xp_ops svctcp_rendezvous_op = {
- rendezvous_request,
- rendezvous_stat,
- (void*)abort,
- (void*)abort,
- (void*)abort,
- svctcp_destroy
-};
-
-static int readtcp(), writetcp();
-static SVCXPRT *makefd_xprt();
-
-struct tcp_rendezvous { /* kept in xprt->xp_p1 */
- u_int sendsize;
- u_int recvsize;
-};
-
-struct tcp_conn { /* kept in xprt->xp_p1 */
- enum xprt_stat strm_stat;
- u_long x_id;
- XDR xdrs;
- char verf_body[MAX_AUTH_BYTES];
-};
-
-/*
- * Usage:
- * xprt = svctcp_create(sock, send_buf_size, recv_buf_size);
- *
- * Creates, registers, and returns a (rpc) tcp based transporter.
- * Once *xprt is initialized, it is registered as a transporter
- * see (svc.h, xprt_register). This routine returns
- * a NULL if a problem occurred.
- *
- * If sock<0 then a socket is created, else sock is used.
- * If the socket, sock is not bound to a port then svctcp_create
- * binds it to an arbitrary port. The routine then starts a tcp
- * listener on the socket's associated port. In any (successful) case,
- * xprt->xp_sock is the registered socket number and xprt->xp_port is the
- * associated port number.
- *
- * Since tcp streams do buffered io similar to stdio, the caller can specify
- * how big the send and receive buffers are via the second and third parms;
- * 0 => use the system default.
- */
-SVCXPRT *svctcp_create(sock, sendsize, recvsize)
-register int sock;
-u_int sendsize;
-u_int recvsize;
-{
- bool_t madesock = FALSE;
- register SVCXPRT *xprt;
- register struct tcp_rendezvous *r;
- struct sockaddr_in addr;
- int len = sizeof(struct sockaddr_in);
-
- if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
- perror("svc_tcp.c - tcp socket creation problem");
- return ((SVCXPRT *) NULL);
- }
- madesock = TRUE;
- }
- bzero((char *) &addr, sizeof(addr));
- addr.sin_family = AF_INET;
- if (bindresvport(sock, &addr)) {
- addr.sin_port = 0;
- (void) bind(sock, (struct sockaddr *) &addr, len);
- }
- if ((getsockname(sock, (struct sockaddr *) &addr, &len) != 0) ||
- (listen(sock, 2) != 0)) {
- perror("svctcp_.c - cannot getsockname or listen");
- if (madesock)
- (void) close(sock);
- return ((SVCXPRT *) NULL);
- }
- r = (struct tcp_rendezvous *) mem_alloc(sizeof(*r));
- if (r == NULL) {
- (void) fprintf(stderr, "svctcp_create: out of memory\n");
- return (NULL);
- }
- r->sendsize = sendsize;
- r->recvsize = recvsize;
- xprt = (SVCXPRT *) mem_alloc(sizeof(SVCXPRT));
- if (xprt == NULL) {
- (void) fprintf(stderr, "svctcp_create: out of memory\n");
- return (NULL);
- }
- xprt->xp_p2 = NULL;
- xprt->xp_p1 = (caddr_t) r;
- xprt->xp_verf = _null_auth;
- xprt->xp_ops = &svctcp_rendezvous_op;
- xprt->xp_port = ntohs(addr.sin_port);
- xprt->xp_sock = sock;
- xprt_register(xprt);
- return (xprt);
-}
-
-/*
- * Like svtcp_create(), except the routine takes any *open* UNIX file
- * descriptor as its first input.
- */
-SVCXPRT *svcfd_create(fd, sendsize, recvsize)
-int fd;
-u_int sendsize;
-u_int recvsize;
-{
-
- return (makefd_xprt(fd, sendsize, recvsize));
-}
-
-static SVCXPRT *makefd_xprt(fd, sendsize, recvsize)
-int fd;
-u_int sendsize;
-u_int recvsize;
-{
- register SVCXPRT *xprt;
- register struct tcp_conn *cd;
-
- xprt = (SVCXPRT *) mem_alloc(sizeof(SVCXPRT));
- if (xprt == (SVCXPRT *) NULL) {
- (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n");
- goto done;
- }
- cd = (struct tcp_conn *) mem_alloc(sizeof(struct tcp_conn));
-
- if (cd == (struct tcp_conn *) NULL) {
- (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n");
- mem_free((char *) xprt, sizeof(SVCXPRT));
- xprt = (SVCXPRT *) NULL;
- goto done;
- }
- cd->strm_stat = XPRT_IDLE;
- xdrrec_create(&(cd->xdrs), sendsize, recvsize,
- (caddr_t) xprt, readtcp, writetcp);
- xprt->xp_p2 = NULL;
- xprt->xp_p1 = (caddr_t) cd;
- xprt->xp_verf.oa_base = cd->verf_body;
- xprt->xp_addrlen = 0;
- xprt->xp_ops = &svctcp_op; /* truely deals with calls */
- xprt->xp_port = 0; /* this is a connection, not a rendezvouser */
- xprt->xp_sock = fd;
- xprt_register(xprt);
- done:
- return (xprt);
-}
-
-static bool_t rendezvous_request(xprt)
-register SVCXPRT *xprt;
-{
- int sock;
- struct tcp_rendezvous *r;
- struct sockaddr_in addr;
- int len;
-
- r = (struct tcp_rendezvous *) xprt->xp_p1;
- again:
- len = sizeof(struct sockaddr_in);
-
- if ((sock = accept(xprt->xp_sock, (struct sockaddr *) &addr,
- &len)) < 0) {
- if (errno == EINTR)
- goto again;
- return (FALSE);
- }
- /*
- * make a new transporter (re-uses xprt)
- */
- xprt = makefd_xprt(sock, r->sendsize, r->recvsize);
- xprt->xp_raddr = addr;
- xprt->xp_addrlen = len;
- return (FALSE); /* there is never an rpc msg to be processed */
-}
-
-static enum xprt_stat rendezvous_stat()
-{
-
- return (XPRT_IDLE);
-}
-
-static void svctcp_destroy(xprt)
-register SVCXPRT *xprt;
-{
- register struct tcp_conn *cd = (struct tcp_conn *) xprt->xp_p1;
-
- xprt_unregister(xprt);
- (void) close(xprt->xp_sock);
- if (xprt->xp_port != 0) {
- /* a rendezvouser socket */
- xprt->xp_port = 0;
- } else {
- /* an actual connection socket */
- XDR_DESTROY(&(cd->xdrs));
- }
- mem_free((caddr_t) cd, sizeof(struct tcp_conn));
-
- mem_free((caddr_t) xprt, sizeof(SVCXPRT));
-}
-
-/*
- * All read operations timeout after 35 seconds.
- * A timeout is fatal for the connection.
- */
-static struct timeval wait_per_try = { 35, 0 };
-
-/*
- * reads data from the tcp conection.
- * any error is fatal and the connection is closed.
- * (And a read of zero bytes is a half closed stream => error.)
- */
-static int readtcp(xprt, buf, len)
-register SVCXPRT *xprt;
-caddr_t buf;
-register int len;
-{
- register int sock = xprt->xp_sock;
-
-#ifdef FD_SETSIZE
- fd_set mask;
- fd_set readfds;
-
- FD_ZERO(&mask);
- FD_SET(sock, &mask);
-#else
- register int mask = 1 << sock;
- int readfds;
-#endif /* def FD_SETSIZE */
- do {
- readfds = mask;
- if (select(_rpc_dtablesize(), &readfds, 0, 0, &wait_per_try) <= 0) {
- if (errno == EINTR) {
- continue;
- }
- goto fatal_err;
- }
-#ifdef FD_SETSIZE
- } while (!FD_ISSET(sock, &readfds));
-#else
- } while (readfds != mask);
-#endif /* def FD_SETSIZE */
- if ((len = read(sock, buf, len)) > 0) {
- return (len);
- }
- fatal_err:
- ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED;
- return (-1);
-}
-
-/*
- * writes data to the tcp connection.
- * Any error is fatal and the connection is closed.
- */
-static int writetcp(xprt, buf, len)
-register SVCXPRT *xprt;
-caddr_t buf;
-int len;
-{
- register int i, cnt;
-
- for (cnt = len; cnt > 0; cnt -= i, buf += i) {
- if ((i = write(xprt->xp_sock, buf, cnt)) < 0) {
- ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED;
- return (-1);
- }
- }
- return (len);
-}
-
-static enum xprt_stat svctcp_stat(xprt)
-SVCXPRT *xprt;
-{
- register struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1);
-
- if (cd->strm_stat == XPRT_DIED)
- return (XPRT_DIED);
- if (!xdrrec_eof(&(cd->xdrs)))
- return (XPRT_MOREREQS);
- return (XPRT_IDLE);
-}
-
-static bool_t svctcp_recv(xprt, msg)
-SVCXPRT *xprt;
-register struct rpc_msg *msg;
-{
- register struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1);
- register XDR *xdrs = &(cd->xdrs);
-
- xdrs->x_op = XDR_DECODE;
- (void) xdrrec_skiprecord(xdrs);
- if (xdr_callmsg(xdrs, msg)) {
- cd->x_id = msg->rm_xid;
- return (TRUE);
- }
- return (FALSE);
-}
-
-static bool_t svctcp_getargs(xprt, xdr_args, args_ptr)
-SVCXPRT *xprt;
-xdrproc_t xdr_args;
-caddr_t args_ptr;
-{
-
- return ((*xdr_args)
- (&(((struct tcp_conn *) (xprt->xp_p1))->xdrs), args_ptr));
-}
-
-static bool_t svctcp_freeargs(xprt, xdr_args, args_ptr)
-SVCXPRT *xprt;
-xdrproc_t xdr_args;
-caddr_t args_ptr;
-{
- register XDR *xdrs = &(((struct tcp_conn *) (xprt->xp_p1))->xdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_args) (xdrs, args_ptr));
-}
-
-static bool_t svctcp_reply(xprt, msg)
-SVCXPRT *xprt;
-register struct rpc_msg *msg;
-{
- register struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1);
- register XDR *xdrs = &(cd->xdrs);
- register bool_t stat;
-
- xdrs->x_op = XDR_ENCODE;
- msg->rm_xid = cd->x_id;
- stat = xdr_replymsg(xdrs, msg);
- (void) xdrrec_endofrecord(xdrs, TRUE);
- return (stat);
-}
diff --git a/mdk-stage1/dietlibc/librpc/svc_udp.c b/mdk-stage1/dietlibc/librpc/svc_udp.c
deleted file mode 100644
index 1cdb5ce91..000000000
--- a/mdk-stage1/dietlibc/librpc/svc_udp.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/* @(#)svc_udp.c 2.2 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * svc_udp.c,
- * Server side for UDP/IP based RPC. (Does some caching in the hopes of
- * achieving execute-at-most-once semantics.)
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
-#include <stdio.h>
-#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-
-#define rpc_buffer(xprt) ((xprt)->xp_p1)
-#define MAX(a, b) ((a > b) ? a : b)
-
-static bool_t svcudp_recv();
-static bool_t svcudp_reply();
-static enum xprt_stat svcudp_stat();
-static bool_t svcudp_getargs();
-static bool_t svcudp_freeargs();
-static void svcudp_destroy();
-
-static struct xp_ops svcudp_op = {
- svcudp_recv,
- svcudp_stat,
- svcudp_getargs,
- svcudp_reply,
- svcudp_freeargs,
- svcudp_destroy
-};
-
-extern int errno;
-
-/*
- * kept in xprt->xp_p2
- */
-struct svcudp_data {
- u_int su_iosz; /* byte size of send.recv buffer */
- u_long su_xid; /* transaction id */
- XDR su_xdrs; /* XDR handle */
- char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */
- char *su_cache; /* cached data, NULL if no cache */
-};
-
-#define su_data(xprt) ((struct svcudp_data *)(xprt->xp_p2))
-
-static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long* replylenp);
-static void cache_set(SVCXPRT* xprt, u_long replylen);
-
-/*
- * Usage:
- * xprt = svcudp_create(sock);
- *
- * If sock<0 then a socket is created, else sock is used.
- * If the socket, sock is not bound to a port then svcudp_create
- * binds it to an arbitrary port. In any (successful) case,
- * xprt->xp_sock is the registered socket number and xprt->xp_port is the
- * associated port number.
- * Once *xprt is initialized, it is registered as a transporter;
- * see (svc.h, xprt_register).
- * The routines returns NULL if a problem occurred.
- */
-SVCXPRT *svcudp_bufcreate(sock, sendsz, recvsz)
-register int sock;
-u_int sendsz, recvsz;
-{
- bool_t madesock = FALSE;
- register SVCXPRT *xprt;
- register struct svcudp_data *su;
- struct sockaddr_in addr;
- int len = sizeof(struct sockaddr_in);
-
- if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- perror("svcudp_create: socket creation problem");
- return ((SVCXPRT *) NULL);
- }
- madesock = TRUE;
- }
- bzero((char *) &addr, sizeof(addr));
- addr.sin_family = AF_INET;
- if (bindresvport(sock, &addr)) {
- addr.sin_port = 0;
- (void) bind(sock, (struct sockaddr *) &addr, len);
- }
- if (getsockname(sock, (struct sockaddr *) &addr, &len) != 0) {
- perror("svcudp_create - cannot getsockname");
- if (madesock)
- (void) close(sock);
- return ((SVCXPRT *) NULL);
- }
- xprt = (SVCXPRT *) mem_alloc(sizeof(SVCXPRT));
- if (xprt == NULL) {
- (void) fprintf(stderr, "svcudp_create: out of memory\n");
- return (NULL);
- }
- su = (struct svcudp_data *) mem_alloc(sizeof(*su));
- if (su == NULL) {
- (void) fprintf(stderr, "svcudp_create: out of memory\n");
- return (NULL);
- }
- su->su_iosz = ((MAX(sendsz, recvsz) + 3) / 4) * 4;
- if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL) {
- (void) fprintf(stderr, "svcudp_create: out of memory\n");
- return (NULL);
- }
- xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
- XDR_DECODE);
- su->su_cache = NULL;
- xprt->xp_p2 = (caddr_t) su;
- xprt->xp_verf.oa_base = su->su_verfbody;
- xprt->xp_ops = &svcudp_op;
- xprt->xp_port = ntohs(addr.sin_port);
- xprt->xp_sock = sock;
- xprt_register(xprt);
- return (xprt);
-}
-
-SVCXPRT *svcudp_create(sock)
-int sock;
-{
-
- return (svcudp_bufcreate(sock, UDPMSGSIZE, UDPMSGSIZE));
-}
-
-static enum xprt_stat svcudp_stat(xprt)
-SVCXPRT *xprt;
-{
-
- return (XPRT_IDLE);
-}
-
-static bool_t svcudp_recv(xprt, msg)
-register SVCXPRT *xprt;
-struct rpc_msg *msg;
-{
- register struct svcudp_data *su = su_data(xprt);
- register XDR *xdrs = &(su->su_xdrs);
- register int rlen;
- char *reply;
- u_long replylen;
-
- again:
- xprt->xp_addrlen = sizeof(struct sockaddr_in);
-
- rlen = recvfrom(xprt->xp_sock, rpc_buffer(xprt), (int) su->su_iosz,
- 0, (struct sockaddr *) &(xprt->xp_raddr),
- &(xprt->xp_addrlen));
- if (rlen == -1 && errno == EINTR)
- goto again;
- if (rlen < 4 * sizeof(u_long))
- return (FALSE);
- xdrs->x_op = XDR_DECODE;
- XDR_SETPOS(xdrs, 0);
- if (!xdr_callmsg(xdrs, msg))
- return (FALSE);
- su->su_xid = msg->rm_xid;
- if (su->su_cache != NULL) {
- if (cache_get(xprt, msg, &reply, &replylen)) {
- (void) sendto(xprt->xp_sock, reply, (int) replylen, 0,
- (struct sockaddr *) &xprt->xp_raddr,
- xprt->xp_addrlen);
- return (TRUE);
- }
- }
- return (TRUE);
-}
-
-static bool_t svcudp_reply(xprt, msg)
-register SVCXPRT *xprt;
-struct rpc_msg *msg;
-{
- register struct svcudp_data *su = su_data(xprt);
- register XDR *xdrs = &(su->su_xdrs);
- register int slen;
- register bool_t stat = FALSE;
-
- xdrs->x_op = XDR_ENCODE;
- XDR_SETPOS(xdrs, 0);
- msg->rm_xid = su->su_xid;
- if (xdr_replymsg(xdrs, msg)) {
- slen = (int) XDR_GETPOS(xdrs);
- if (sendto(xprt->xp_sock, rpc_buffer(xprt), slen, 0,
- (struct sockaddr *) &(xprt->xp_raddr), xprt->xp_addrlen)
- == slen) {
- stat = TRUE;
- if (su->su_cache && slen >= 0) {
- cache_set(xprt, (u_long) slen);
- }
- }
- }
- return (stat);
-}
-
-static bool_t svcudp_getargs(xprt, xdr_args, args_ptr)
-SVCXPRT *xprt;
-xdrproc_t xdr_args;
-caddr_t args_ptr;
-{
-
- return ((*xdr_args) (&(su_data(xprt)->su_xdrs), args_ptr));
-}
-
-static bool_t svcudp_freeargs(xprt, xdr_args, args_ptr)
-SVCXPRT *xprt;
-xdrproc_t xdr_args;
-caddr_t args_ptr;
-{
- register XDR *xdrs = &(su_data(xprt)->su_xdrs);
-
- xdrs->x_op = XDR_FREE;
- return ((*xdr_args) (xdrs, args_ptr));
-}
-
-static void svcudp_destroy(xprt)
-register SVCXPRT *xprt;
-{
- register struct svcudp_data *su = su_data(xprt);
-
- xprt_unregister(xprt);
- (void) close(xprt->xp_sock);
- XDR_DESTROY(&(su->su_xdrs));
- mem_free(rpc_buffer(xprt), su->su_iosz);
- mem_free((caddr_t) su, sizeof(struct svcudp_data));
-
- mem_free((caddr_t) xprt, sizeof(SVCXPRT));
-}
-
-
-/***********this could be a separate file*********************/
-
-/*
- * Fifo cache for udp server
- * Copies pointers to reply buffers into fifo cache
- * Buffers are sent again if retransmissions are detected.
- */
-
-#define SPARSENESS 4 /* 75% sparse */
-
-#define CACHE_PERROR(msg) \
- (void) fprintf(stderr,"%s\n", msg)
-
-#define ALLOC(type, size) \
- (type *) mem_alloc((unsigned) (sizeof(type) * (size)))
-
-#define BZERO(addr, type, size) \
- bzero((char *) addr, sizeof(type) * (int) (size))
-
-/*
- * An entry in the cache
- */
-typedef struct cache_node *cache_ptr;
-struct cache_node {
- /*
- * Index into cache is xid, proc, vers, prog and address
- */
- u_long cache_xid;
- u_long cache_proc;
- u_long cache_vers;
- u_long cache_prog;
- struct sockaddr_in cache_addr;
- /*
- * The cached reply and length
- */
- char *cache_reply;
- u_long cache_replylen;
- /*
- * Next node on the list, if there is a collision
- */
- cache_ptr cache_next;
-};
-
-
-
-/*
- * The entire cache
- */
-struct udp_cache {
- u_long uc_size; /* size of cache */
- cache_ptr *uc_entries; /* hash table of entries in cache */
- cache_ptr *uc_fifo; /* fifo list of entries in cache */
- u_long uc_nextvictim; /* points to next victim in fifo list */
- u_long uc_prog; /* saved program number */
- u_long uc_vers; /* saved version number */
- u_long uc_proc; /* saved procedure number */
- struct sockaddr_in uc_addr; /* saved caller's address */
-};
-
-
-/*
- * the hashing function
- */
-#define CACHE_LOC(transp, xid) \
- (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size))
-
-
-/*
- * Enable use of the cache.
- * Note: there is no disable.
- */
-int svcudp_enablecache(SVCXPRT* transp, u_long size)
-{
- struct svcudp_data *su = su_data(transp);
- struct udp_cache *uc;
-
- if (su->su_cache != NULL) {
- CACHE_PERROR("enablecache: cache already enabled");
- return (0);
- }
- uc = ALLOC(struct udp_cache, 1);
- if (uc == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache");
- return (0);
- }
- uc->uc_size = size;
- uc->uc_nextvictim = 0;
- uc->uc_entries = ALLOC(cache_ptr, size * SPARSENESS);
- if (uc->uc_entries == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache data");
- return (0);
- }
- BZERO(uc->uc_entries, cache_ptr, size * SPARSENESS);
- uc->uc_fifo = ALLOC(cache_ptr, size);
- if (uc->uc_fifo == NULL) {
- CACHE_PERROR("enablecache: could not allocate cache fifo");
- return (0);
- }
- BZERO(uc->uc_fifo, cache_ptr, size);
- su->su_cache = (char *) uc;
- return (1);
-}
-
-
-/*
- * Set an entry in the cache
- */
-static void cache_set(SVCXPRT* xprt, u_long replylen)
-{
- register cache_ptr victim;
- register cache_ptr *vicp;
- register struct svcudp_data *su = su_data(xprt);
- struct udp_cache *uc = (struct udp_cache *) su->su_cache;
- u_int loc;
- char *newbuf;
-
- /*
- * Find space for the new entry, either by
- * reusing an old entry, or by mallocing a new one
- */
- victim = uc->uc_fifo[uc->uc_nextvictim];
- if (victim != NULL) {
- loc = CACHE_LOC(xprt, victim->cache_xid);
- for (vicp = &uc->uc_entries[loc];
- *vicp != NULL && *vicp != victim;
- vicp = &(*vicp)->cache_next);
- if (*vicp == NULL) {
- CACHE_PERROR("cache_set: victim not found");
- return;
- }
- *vicp = victim->cache_next; /* remote from cache */
- newbuf = victim->cache_reply;
- } else {
- victim = ALLOC(struct cache_node, 1);
-
- if (victim == NULL) {
- CACHE_PERROR("cache_set: victim alloc failed");
- return;
- }
- newbuf = mem_alloc(su->su_iosz);
- if (newbuf == NULL) {
- CACHE_PERROR("cache_set: could not allocate new rpc_buffer");
- return;
- }
- }
-
- /*
- * Store it away
- */
- victim->cache_replylen = replylen;
- victim->cache_reply = rpc_buffer(xprt);
- rpc_buffer(xprt) = newbuf;
- xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
- XDR_ENCODE);
- victim->cache_xid = su->su_xid;
- victim->cache_proc = uc->uc_proc;
- victim->cache_vers = uc->uc_vers;
- victim->cache_prog = uc->uc_prog;
- victim->cache_addr = uc->uc_addr;
- loc = CACHE_LOC(xprt, victim->cache_xid);
- victim->cache_next = uc->uc_entries[loc];
- uc->uc_entries[loc] = victim;
- uc->uc_fifo[uc->uc_nextvictim++] = victim;
- uc->uc_nextvictim %= uc->uc_size;
-}
-
-/*
- * Try to get an entry from the cache
- * return 1 if found, 0 if not found
- */
-static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long* replylenp)
-{
- u_int loc;
- register cache_ptr ent;
- register struct svcudp_data *su = su_data(xprt);
- register struct udp_cache *uc = (struct udp_cache *) su->su_cache;
-
-# define EQADDR(a1, a2) (bcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
-
- loc = CACHE_LOC(xprt, su->su_xid);
- for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next) {
- if (ent->cache_xid == su->su_xid &&
- ent->cache_proc == uc->uc_proc &&
- ent->cache_vers == uc->uc_vers &&
- ent->cache_prog == uc->uc_prog &&
- EQADDR(ent->cache_addr, uc->uc_addr)) {
- *replyp = ent->cache_reply;
- *replylenp = ent->cache_replylen;
- return (1);
- }
- }
- /*
- * Failed to find entry
- * Remember a few things so we can do a set later
- */
- uc->uc_proc = msg->rm_call.cb_proc;
- uc->uc_vers = msg->rm_call.cb_vers;
- uc->uc_prog = msg->rm_call.cb_prog;
- uc->uc_addr = xprt->xp_raddr;
- return (0);
-}
diff --git a/mdk-stage1/dietlibc/librpc/xdr.c b/mdk-stage1/dietlibc/librpc/xdr.c
deleted file mode 100644
index 864b47dea..000000000
--- a/mdk-stage1/dietlibc/librpc/xdr.c
+++ /dev/null
@@ -1,536 +0,0 @@
-/* @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
-#endif
-
-/*
- * xdr.c, Generic XDR routines implementation.
- *
- * Copyright (C) 1986, Sun Microsystems, Inc.
- *
- * These are the "generic" xdr routines used to serialize and de-serialize
- * most common data items. See xdr.h for more info on the interface to
- * xdr.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <string.h>
-
-/*
- * constants specific to the xdr "protocol"
- */
-#define XDR_FALSE ((long) 0)
-#define XDR_TRUE ((long) 1)
-#define LASTUNSIGNED ((u_int) 0-1)
-
-/*
- * for unit alignment
- */
-static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
-
-/*
- * Free a data structure using XDR
- * Not a filter, but a convenient utility nonetheless
- */
-void xdr_free(xdrproc_t proc, char* objp)
-{
- XDR x;
-
- x.x_op = XDR_FREE;
- (*proc) (&x, objp);
-}
-
-/*
- * XDR nothing
- */
-bool_t xdr_void( /* xdrs, addr */ )
- /* XDR *xdrs; */
- /* caddr_t addr; */
-{
-
- return (TRUE);
-}
-
-/*
- * XDR integers
- */
-bool_t xdr_int(XDR* xdrs, int* ip)
-{
-
-#ifdef lint
- (void) (xdr_short(xdrs, (short *) ip));
- return (xdr_long(xdrs, (long *) ip));
-#else
- if (sizeof(int) == sizeof(long)) {
- return (xdr_long(xdrs, (long *) ip));
- } else {
- return (xdr_short(xdrs, (short *) ip));
- }
-#endif
-}
-
-/*
- * XDR unsigned integers
- */
-bool_t xdr_u_int(XDR* xdrs, unsigned int* up)
-{
-
-#ifdef lint
- (void) (xdr_short(xdrs, (short *) up));
- return (xdr_u_long(xdrs, (u_long *) up));
-#else
- if (sizeof(u_int) == sizeof(u_long)) {
- return (xdr_u_long(xdrs, (u_long *) up));
- } else {
- return (xdr_short(xdrs, (short *) up));
- }
-#endif
-}
-
-/*
- * XDR long integers
- * same as xdr_u_long - open coded to save a proc call!
- */
-bool_t xdr_long(XDR* xdrs, long* lp)
-{
-
- if (xdrs->x_op == XDR_ENCODE)
- return (XDR_PUTLONG(xdrs, lp));
-
- if (xdrs->x_op == XDR_DECODE)
- return (XDR_GETLONG(xdrs, lp));
-
- if (xdrs->x_op == XDR_FREE)
- return (TRUE);
-
- return (FALSE);
-}
-
-/*
- * XDR unsigned long integers
- * same as xdr_long - open coded to save a proc call!
- */
-bool_t xdr_u_long(XDR* xdrs, unsigned long* ulp)
-{
-
- if (xdrs->x_op == XDR_DECODE)
- return (XDR_GETLONG(xdrs, (long *) ulp));
- if (xdrs->x_op == XDR_ENCODE)
- return (XDR_PUTLONG(xdrs, (long *) ulp));
- if (xdrs->x_op == XDR_FREE)
- return (TRUE);
- return (FALSE);
-}
-
-/*
- * XDR short integers
- */
-bool_t xdr_short(XDR* xdrs, short* sp)
-{
- long l;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- l = (long) *sp;
- return (XDR_PUTLONG(xdrs, &l));
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &l)) {
- return (FALSE);
- }
- *sp = (short) l;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * XDR unsigned short integers
- */
-bool_t xdr_u_short(XDR* xdrs, unsigned short* usp)
-{
- u_long l;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- l = (u_long) * usp;
- return (XDR_PUTLONG(xdrs, &l));
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &l)) {
- return (FALSE);
- }
- *usp = (u_short) l;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-
-/*
- * XDR a char
- */
-bool_t xdr_char(XDR* xdrs, char* cp)
-{
- int i;
-
- i = (*cp);
- if (!xdr_int(xdrs, &i)) {
- return (FALSE);
- }
- *cp = i;
- return (TRUE);
-}
-
-/*
- * XDR an unsigned char
- */
-bool_t xdr_u_char(XDR* xdrs, unsigned char* cp)
-{
- u_int u;
-
- u = (*cp);
- if (!xdr_u_int(xdrs, &u)) {
- return (FALSE);
- }
- *cp = u;
- return (TRUE);
-}
-
-/*
- * XDR booleans
- */
-bool_t xdr_bool(xdrs, bp)
-register XDR *xdrs;
-bool_t *bp;
-{
- long lb;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- lb = *bp ? XDR_TRUE : XDR_FALSE;
- return (XDR_PUTLONG(xdrs, &lb));
-
- case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, &lb)) {
- return (FALSE);
- }
- *bp = (lb == XDR_FALSE) ? FALSE : TRUE;
- return (TRUE);
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * XDR enumerations
- */
-bool_t xdr_enum(xdrs, ep)
-XDR *xdrs;
-enum_t *ep;
-{
-#ifndef lint
- enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
-
- /*
- * enums are treated as ints
- */
- if (sizeof(enum sizecheck) == sizeof(long)) {
- return (xdr_long(xdrs, (long *) ep));
- } else if (sizeof(enum sizecheck) == sizeof(short)) {
- return (xdr_short(xdrs, (short *) ep));
- } else {
- return (FALSE);
- }
-#else
- (void) (xdr_short(xdrs, (short *) ep));
- return (xdr_long(xdrs, (long *) ep));
-#endif
-}
-
-/*
- * XDR opaque data
- * Allows the specification of a fixed size sequence of opaque bytes.
- * cp points to the opaque object and cnt gives the byte length.
- */
-bool_t xdr_opaque(xdrs, cp, cnt)
-register XDR *xdrs;
-caddr_t cp;
-register u_int cnt;
-{
- register u_int rndup;
- static char crud[BYTES_PER_XDR_UNIT];
-
- /*
- * if no data we are done
- */
- if (cnt == 0)
- return (TRUE);
-
- /*
- * round byte count to full xdr units
- */
- rndup = cnt % BYTES_PER_XDR_UNIT;
- if (rndup > 0)
- rndup = BYTES_PER_XDR_UNIT - rndup;
-
- if (xdrs->x_op == XDR_DECODE) {
- if (!XDR_GETBYTES(xdrs, cp, cnt)) {
- return (FALSE);
- }
- if (rndup == 0)
- return (TRUE);
- return (XDR_GETBYTES(xdrs, crud, rndup));
- }
-
- if (xdrs->x_op == XDR_ENCODE) {
- if (!XDR_PUTBYTES(xdrs, cp, cnt)) {
- return (FALSE);
- }
- if (rndup == 0)
- return (TRUE);
- return (XDR_PUTBYTES(xdrs, xdr_zero, rndup));
- }
-
- if (xdrs->x_op == XDR_FREE) {
- return (TRUE);
- }
-
- return (FALSE);
-}
-
-/*
- * XDR counted bytes
- * *cpp is a pointer to the bytes, *sizep is the count.
- * If *cpp is NULL maxsize bytes are allocated
- */
-bool_t xdr_bytes(xdrs, cpp, sizep, maxsize)
-register XDR *xdrs;
-char **cpp;
-register u_int *sizep;
-u_int maxsize;
-{
- register char *sp = *cpp; /* sp is the actual string pointer */
- register u_int nodesize;
-
- /*
- * first deal with the length since xdr bytes are counted
- */
- if (!xdr_u_int(xdrs, sizep)) {
- return (FALSE);
- }
- nodesize = *sizep;
- if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
- return (FALSE);
- }
-
- /*
- * now deal with the actual bytes
- */
- switch (xdrs->x_op) {
-
- case XDR_DECODE:
- if (nodesize == 0) {
- return (TRUE);
- }
- if (sp == NULL) {
- *cpp = sp = (char *) mem_alloc(nodesize);
- }
- if (sp == NULL) {
- (void) fprintf(stderr, "xdr_bytes: out of memory\n");
- return (FALSE);
- }
- /* fall into ... */
-
- case XDR_ENCODE:
- return (xdr_opaque(xdrs, sp, nodesize));
-
- case XDR_FREE:
- if (sp != NULL) {
- mem_free(sp, nodesize);
- *cpp = NULL;
- }
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * Implemented here due to commonality of the object.
- */
-bool_t xdr_netobj(xdrs, np)
-XDR *xdrs;
-struct netobj *np;
-{
-
- return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ));
-}
-
-/*
- * XDR a descriminated union
- * Support routine for discriminated unions.
- * You create an array of xdrdiscrim structures, terminated with
- * an entry with a null procedure pointer. The routine gets
- * the discriminant value and then searches the array of xdrdiscrims
- * looking for that value. It calls the procedure given in the xdrdiscrim
- * to handle the discriminant. If there is no specific routine a default
- * routine may be called.
- * If there is no specific or default routine an error is returned.
- */
-bool_t xdr_union(XDR* xdrs, enum_t* dscmp, char* unp, const struct xdr_discrim* choices, xdrproc_t dfault)
-{
- register enum_t dscm;
-
- /*
- * we deal with the discriminator; it's an enum
- */
- if (!xdr_enum(xdrs, dscmp)) {
- return (FALSE);
- }
- dscm = *dscmp;
-
- /*
- * search choices for a value that matches the discriminator.
- * if we find one, execute the xdr routine for that value.
- */
- for (; choices->proc != NULL_xdrproc_t; choices++) {
- if (choices->value == dscm)
- return ((*(choices->proc)) (xdrs, unp, LASTUNSIGNED));
- }
-
- /*
- * no match - execute the default xdr routine if there is one
- */
- return ((dfault == NULL_xdrproc_t) ? FALSE :
- (*dfault) (xdrs, unp, LASTUNSIGNED));
-}
-
-
-/*
- * Non-portable xdr primitives.
- * Care should be taken when moving these routines to new architectures.
- */
-
-
-/*
- * XDR null terminated ASCII strings
- * xdr_string deals with "C strings" - arrays of bytes that are
- * terminated by a NULL character. The parameter cpp references a
- * pointer to storage; If the pointer is null, then the necessary
- * storage is allocated. The last parameter is the max allowed length
- * of the string as specified by a protocol.
- */
-bool_t xdr_string(xdrs, cpp, maxsize)
-register XDR *xdrs;
-char **cpp;
-u_int maxsize;
-{
- register char *sp = *cpp; /* sp is the actual string pointer */
- u_int size;
- u_int nodesize;
-
- /*
- * first deal with the length since xdr strings are counted-strings
- */
- switch (xdrs->x_op) {
- case XDR_FREE:
- if (sp == NULL) {
- return (TRUE); /* already free */
- }
- /* fall through... */
- case XDR_ENCODE:
- size = strlen(sp);
- break;
- }
- if (!xdr_u_int(xdrs, &size)) {
- return (FALSE);
- }
- if (size > maxsize) {
- return (FALSE);
- }
- nodesize = size + 1;
-
- /*
- * now deal with the actual bytes
- */
- switch (xdrs->x_op) {
-
- case XDR_DECODE:
- if (nodesize == 0) {
- return (TRUE);
- }
- if (sp == NULL)
- *cpp = sp = (char *) mem_alloc(nodesize);
- if (sp == NULL) {
- (void) fprintf(stderr, "xdr_string: out of memory\n");
- return (FALSE);
- }
- sp[size] = 0;
- /* fall into ... */
-
- case XDR_ENCODE:
- return (xdr_opaque(xdrs, sp, size));
-
- case XDR_FREE:
- mem_free(sp, nodesize);
- *cpp = NULL;
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * Wrapper for xdr_string that can be called directly from
- * routines like clnt_call
- */
-bool_t xdr_wrapstring(xdrs, cpp)
-XDR *xdrs;
-char **cpp;
-{
- if (xdr_string(xdrs, cpp, LASTUNSIGNED)) {
- return (TRUE);
- }
- return (FALSE);
-}
diff --git a/mdk-stage1/dietlibc/librpc/xdr_array.c b/mdk-stage1/dietlibc/librpc/xdr_array.c
deleted file mode 100644
index f8ae12b19..000000000
--- a/mdk-stage1/dietlibc/librpc/xdr_array.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* @(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_array.c, Generic XDR routines impelmentation.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * These are the "non-trivial" xdr primitives used to serialize and de-serialize
- * arrays. See xdr.h for more info on the interface to xdr.
- */
-
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <string.h>
-
-#define LASTUNSIGNED ((u_int)0-1)
-
-
-/*
- * XDR an array of arbitrary elements
- * *addrp is a pointer to the array, *sizep is the number of elements.
- * If addrp is NULL (*sizep * elsize) bytes are allocated.
- * elsize is the size (in bytes) of each element, and elproc is the
- * xdr procedure to call to handle each element of the array.
- */
-bool_t xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
-register XDR *xdrs;
-caddr_t *addrp; /* array pointer */
-u_int *sizep; /* number of elements */
-u_int maxsize; /* max numberof elements */
-u_int elsize; /* size in bytes of each element */
-xdrproc_t elproc; /* xdr routine to handle each element */
-{
- register u_int i;
- register caddr_t target = *addrp;
- register u_int c; /* the actual element count */
- register bool_t stat = TRUE;
- register u_int nodesize;
-
- /* like strings, arrays are really counted arrays */
- if (!xdr_u_int(xdrs, sizep)) {
- return (FALSE);
- }
- c = *sizep;
- if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
- return (FALSE);
- }
- nodesize = c * elsize;
-
- /*
- * if we are deserializing, we may need to allocate an array.
- * We also save time by checking for a null array if we are freeing.
- */
- if (target == NULL)
- switch (xdrs->x_op) {
- case XDR_DECODE:
- if (c == 0)
- return (TRUE);
- *addrp = target = mem_alloc(nodesize);
- if (target == NULL) {
- (void) fprintf(stderr, "xdr_array: out of memory\n");
- return (FALSE);
- }
- bzero(target, nodesize);
- break;
-
- case XDR_FREE:
- return (TRUE);
- }
-
- /*
- * now we xdr each element of array
- */
- for (i = 0; (i < c) && stat; i++) {
- stat = (*elproc) (xdrs, target, LASTUNSIGNED);
- target += elsize;
- }
-
- /*
- * the array may need freeing
- */
- if (xdrs->x_op == XDR_FREE) {
- mem_free(*addrp, nodesize);
- *addrp = NULL;
- }
- return (stat);
-}
-
-/*
- * xdr_vector():
- *
- * XDR a fixed length array. Unlike variable-length arrays,
- * the storage of fixed length arrays is static and unfreeable.
- * > basep: base of the array
- * > size: size of the array
- * > elemsize: size of each element
- * > xdr_elem: routine to XDR each element
- */
-bool_t xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
-register XDR *xdrs;
-register char *basep;
-register u_int nelem;
-register u_int elemsize;
-register xdrproc_t xdr_elem;
-{
- register u_int i;
- register char *elptr;
-
- elptr = basep;
- for (i = 0; i < nelem; i++) {
- if (!(*xdr_elem) (xdrs, elptr, LASTUNSIGNED)) {
- return (FALSE);
- }
- elptr += elemsize;
- }
- return (TRUE);
-}
diff --git a/mdk-stage1/dietlibc/librpc/xdr_float.c b/mdk-stage1/dietlibc/librpc/xdr_float.c
deleted file mode 100644
index f8eb5e99c..000000000
--- a/mdk-stage1/dietlibc/librpc/xdr_float.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/* @(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_float.c, Generic XDR routines impelmentation.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * These are the "floating point" xdr routines used to (de)serialize
- * most common data items. See xdr.h for more info on the interface to
- * xdr.
- */
-
-#include <stdio.h>
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-
-/*
- * NB: Not portable.
- * This routine works on Suns (Sky / 68000's) and Vaxen.
- */
-
-#ifdef __linux__
-/* cheat big time */
-#define sparc
-#endif
-
-#ifdef vax
-
-/* What IEEE single precision floating point looks like on a Vax */
-struct ieee_single {
- unsigned int mantissa:23;
- unsigned int exp:8;
- unsigned int sign:1;
-};
-
-/* Vax single precision floating point */
-struct vax_single {
- unsigned int mantissa1:7;
- unsigned int exp:8;
- unsigned int sign:1;
- unsigned int mantissa2:16;
-};
-
-#define VAX_SNG_BIAS 0x81
-#define IEEE_SNG_BIAS 0x7f
-
-static struct sgl_limits {
- struct vax_single s;
- struct ieee_single ieee;
-} sgl_limits[2] = {
- { {
- 0x7f, 0xff, 0x0, 0xffff}, /* Max Vax */
- {
- 0x0, 0xff, 0x0}}, /* Max IEEE */
- { {
- 0x0, 0x0, 0x0, 0x0}, /* Min Vax */
- {
- 0x0, 0x0, 0x0}} /* Min IEEE */
-};
-#endif /* vax */
-
-bool_t xdr_float(xdrs, fp)
-register XDR *xdrs;
-register float *fp;
-{
-#if !defined(mc68000) && !defined(sparc)
- struct ieee_single is;
- struct vax_single vs, *vsp;
- struct sgl_limits *lim;
- int i;
-#endif
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc)
- return (XDR_PUTLONG(xdrs, (long *) fp));
-#else
- vs = *((struct vax_single *) fp);
- for (i = 0, lim = sgl_limits;
-
- i < sizeof(sgl_limits) / sizeof(struct sgl_limits);
- i++, lim++) {
- if ((vs.mantissa2 == lim->s.mantissa2) &&
- (vs.exp == lim->s.exp) &&
- (vs.mantissa1 == lim->s.mantissa1)) {
- is = lim->ieee;
- goto shipit;
- }
- }
- is.exp = vs.exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
- is.mantissa = (vs.mantissa1 << 16) | vs.mantissa2;
- shipit:
- is.sign = vs.sign;
- return (XDR_PUTLONG(xdrs, (long *) &is));
-#endif
-
- case XDR_DECODE:
-#if defined(mc68000) || defined(sparc)
- return (XDR_GETLONG(xdrs, (long *) fp));
-#else
- vsp = (struct vax_single *) fp;
- if (!XDR_GETLONG(xdrs, (long *) &is))
- return (FALSE);
- for (i = 0, lim = sgl_limits;
-
- i < sizeof(sgl_limits) / sizeof(struct sgl_limits);
- i++, lim++) {
- if ((is.exp == lim->ieee.exp) &&
- (is.mantissa == lim->ieee.mantissa)) {
- *vsp = lim->s;
- goto doneit;
- }
- }
- vsp->exp = is.exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
- vsp->mantissa2 = is.mantissa;
- vsp->mantissa1 = (is.mantissa >> 16);
- doneit:
- vsp->sign = is.sign;
- return (TRUE);
-#endif
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
-
-/*
- * This routine works on Suns (Sky / 68000's) and Vaxen.
- */
-
-#ifdef vax
-/* What IEEE double precision floating point looks like on a Vax */
-struct ieee_double {
- unsigned int mantissa1:20;
- unsigned int exp:11;
- unsigned int sign:1;
- unsigned int mantissa2:32;
-};
-
-/* Vax double precision floating point */
-struct vax_double {
- unsigned int mantissa1:7;
- unsigned int exp:8;
- unsigned int sign:1;
- unsigned int mantissa2:16;
- unsigned int mantissa3:16;
- unsigned int mantissa4:16;
-};
-
-#define VAX_DBL_BIAS 0x81
-#define IEEE_DBL_BIAS 0x3ff
-#define MASK(nbits) ((1 << nbits) - 1)
-
-static struct dbl_limits {
- struct vax_double d;
- struct ieee_double ieee;
-} dbl_limits[2] = {
- { {
- 0x7f, 0xff, 0x0, 0xffff, 0xffff, 0xffff}, /* Max Vax */
- {
- 0x0, 0x7ff, 0x0, 0x0}}, /* Max IEEE */
- { {
- 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* Min Vax */
- {
- 0x0, 0x0, 0x0, 0x0}} /* Min IEEE */
-};
-
-#endif /* vax */
-
-
-bool_t xdr_double(xdrs, dp)
-register XDR *xdrs;
-double *dp;
-{
- register long *lp;
-
-#if !defined(mc68000) && !defined(sparc)
- struct ieee_double id;
- struct vax_double vd;
- register struct dbl_limits *lim;
- int i;
-#endif
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc)
- lp = (long *) dp;
-#else
- vd = *((struct vax_double *) dp);
- for (i = 0, lim = dbl_limits;
-
- i < sizeof(dbl_limits) / sizeof(struct dbl_limits);
- i++, lim++) {
- if ((vd.mantissa4 == lim->d.mantissa4) &&
- (vd.mantissa3 == lim->d.mantissa3) &&
- (vd.mantissa2 == lim->d.mantissa2) &&
- (vd.mantissa1 == lim->d.mantissa1) &&
- (vd.exp == lim->d.exp)) {
- id = lim->ieee;
- goto shipit;
- }
- }
- id.exp = vd.exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
- id.mantissa1 = (vd.mantissa1 << 13) | (vd.mantissa2 >> 3);
- id.mantissa2 = ((vd.mantissa2 & MASK(3)) << 29) |
- (vd.mantissa3 << 13) | ((vd.mantissa4 >> 3) & MASK(13));
- shipit:
- id.sign = vd.sign;
- lp = (long *) &id;
-#endif
- return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp));
-
- case XDR_DECODE:
-#if defined(mc68000) || defined(sparc)
- lp = (long *) dp;
- return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp));
-#else
- lp = (long *) &id;
- if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))
- return (FALSE);
- for (i = 0, lim = dbl_limits;
-
- i < sizeof(dbl_limits) / sizeof(struct dbl_limits);
- i++, lim++) {
- if ((id.mantissa2 == lim->ieee.mantissa2) &&
- (id.mantissa1 == lim->ieee.mantissa1) &&
- (id.exp == lim->ieee.exp)) {
- vd = lim->d;
- goto doneit;
- }
- }
- vd.exp = id.exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
- vd.mantissa1 = (id.mantissa1 >> 13);
- vd.mantissa2 = ((id.mantissa1 & MASK(13)) << 3) |
- (id.mantissa2 >> 29);
- vd.mantissa3 = (id.mantissa2 >> 13);
- vd.mantissa4 = (id.mantissa2 << 3);
- doneit:
- vd.sign = id.sign;
- *dp = *((double *) &vd);
- return (TRUE);
-#endif
-
- case XDR_FREE:
- return (TRUE);
- }
- return (FALSE);
-}
diff --git a/mdk-stage1/dietlibc/librpc/xdr_mem.c b/mdk-stage1/dietlibc/librpc/xdr_mem.c
deleted file mode 100644
index 755f6abf1..000000000
--- a/mdk-stage1/dietlibc/librpc/xdr_mem.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_mem.h, XDR implementation using memory buffers.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * If you have some data to be interpreted as external data representation
- * or to be converted to external data representation in a memory buffer,
- * then this is the package for you.
- *
- */
-
-
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <netinet/in.h>
-#include <string.h>
-
-static bool_t xdrmem_getlong();
-static bool_t xdrmem_putlong();
-static bool_t xdrmem_getbytes();
-static bool_t xdrmem_putbytes();
-static u_int xdrmem_getpos();
-static bool_t xdrmem_setpos();
-static int32_t *xdrmem_inline();
-static void xdrmem_destroy();
-
-static struct xdr_ops xdrmem_ops = {
- xdrmem_getlong,
- xdrmem_putlong,
- xdrmem_getbytes,
- xdrmem_putbytes,
- xdrmem_getpos,
- xdrmem_setpos,
- xdrmem_inline,
- xdrmem_destroy
-};
-
-/*
- * The procedure xdrmem_create initializes a stream descriptor for a
- * memory buffer.
- */
-void xdrmem_create(xdrs, addr, size, op)
-register XDR *xdrs;
-caddr_t addr;
-u_int size;
-enum xdr_op op;
-{
-
- xdrs->x_op = op;
- xdrs->x_ops = &xdrmem_ops;
- xdrs->x_private = xdrs->x_base = addr;
- xdrs->x_handy = size;
-}
-
-static void xdrmem_destroy( /*xdrs */ )
- /*XDR *xdrs; */
-{
-}
-
-static bool_t xdrmem_getlong(xdrs, lp)
-register XDR *xdrs;
-long *lp;
-{
-
- if ((xdrs->x_handy -= sizeof(long)) < 0)
- return (FALSE);
-
- *lp = (long) ntohl((u_long) (*((long *) (xdrs->x_private))));
- xdrs->x_private += sizeof(long);
-
- return (TRUE);
-}
-
-static bool_t xdrmem_putlong(xdrs, lp)
-register XDR *xdrs;
-long *lp;
-{
-
- if ((xdrs->x_handy -= sizeof(long)) < 0)
- return (FALSE);
-
- *(long *) xdrs->x_private = (long) htonl((u_long) (*lp));
- xdrs->x_private += sizeof(long);
-
- return (TRUE);
-}
-
-static bool_t xdrmem_getbytes(xdrs, addr, len)
-register XDR *xdrs;
-caddr_t addr;
-register u_int len;
-{
-
- if ((xdrs->x_handy -= len) < 0)
- return (FALSE);
- bcopy(xdrs->x_private, addr, len);
- xdrs->x_private += len;
- return (TRUE);
-}
-
-static bool_t xdrmem_putbytes(xdrs, addr, len)
-register XDR *xdrs;
-caddr_t addr;
-register u_int len;
-{
-
- if ((xdrs->x_handy -= len) < 0)
- return (FALSE);
- bcopy(addr, xdrs->x_private, len);
- xdrs->x_private += len;
- return (TRUE);
-}
-
-static u_int xdrmem_getpos(xdrs)
-register XDR *xdrs;
-{
-
- return ((u_int) xdrs->x_private - (u_int) xdrs->x_base);
-}
-
-static bool_t xdrmem_setpos(xdrs, pos)
-register XDR *xdrs;
-u_int pos;
-{
- register caddr_t newaddr = xdrs->x_base + pos;
- register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
-
- if ((long) newaddr > (long) lastaddr)
- return (FALSE);
- xdrs->x_private = newaddr;
- xdrs->x_handy = (int) lastaddr - (int) newaddr;
- return (TRUE);
-}
-
-static int32_t *xdrmem_inline(xdrs, len)
-register XDR *xdrs;
-int len;
-{
- int32_t *buf = 0;
-
- if (xdrs->x_handy >= len) {
- xdrs->x_handy -= len;
- buf = (int32_t *) xdrs->x_private;
- xdrs->x_private += len;
- }
- return (buf);
-}
diff --git a/mdk-stage1/dietlibc/librpc/xdr_rec.c b/mdk-stage1/dietlibc/librpc/xdr_rec.c
deleted file mode 100644
index 83e800f5e..000000000
--- a/mdk-stage1/dietlibc/librpc/xdr_rec.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/* @(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
- * layer above tcp (for rpc's use).
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * These routines interface XDRSTREAMS to a tcp/ip connection.
- * There is a record marking layer between the xdr stream
- * and the tcp transport level. A record is composed on one or more
- * record fragments. A record fragment is a thirty-two bit header followed
- * by n bytes of data, where n is contained in the header. The header
- * is represented as a htonl(u_long). Thegh order bit encodes
- * whether or not the fragment is the last fragment of the record
- * (1 => fragment is last, 0 => more fragments to follow.
- * The other 31 bits encode the byte length of the fragment.
- */
-
-#include <stdio.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <netinet/in.h>
-#include <string.h>
-
-extern long lseek();
-
-static u_int fix_buf_size();
-
-static bool_t xdrrec_getlong();
-static bool_t xdrrec_putlong();
-static bool_t xdrrec_getbytes();
-static bool_t xdrrec_putbytes();
-static u_int xdrrec_getpos();
-static bool_t xdrrec_setpos();
-static int32_t *xdrrec_inline();
-static void xdrrec_destroy();
-
-static struct xdr_ops xdrrec_ops = {
- xdrrec_getlong,
- xdrrec_putlong,
- xdrrec_getbytes,
- xdrrec_putbytes,
- xdrrec_getpos,
- xdrrec_setpos,
- xdrrec_inline,
- xdrrec_destroy
-};
-
-/*
- * A record is composed of one or more record fragments.
- * A record fragment is a two-byte header followed by zero to
- * 2**32-1 bytes. The header is treated as a long unsigned and is
- * encode/decoded to the network via htonl/ntohl. The low order 31 bits
- * are a byte count of the fragment. The highest order bit is a boolean:
- * 1 => this fragment is the last fragment of the record,
- * 0 => this fragment is followed by more fragment(s).
- *
- * The fragment/record machinery is not general; it is constructed to
- * meet the needs of xdr and rpc based on tcp.
- */
-
-#define LAST_FRAG ((u_long)(1 << 31))
-
-typedef struct rec_strm {
- caddr_t tcp_handle;
- caddr_t the_buffer;
- /*
- * out-goung bits
- */
- int (*writeit) ();
- caddr_t out_base; /* output buffer (points to frag header) */
- caddr_t out_finger; /* next output position */
- caddr_t out_boundry; /* data cannot up to this address */
- u_long *frag_header; /* beginning of curren fragment */
- bool_t frag_sent; /* true if buffer sent in middle of record */
- /*
- * in-coming bits
- */
- int (*readit) ();
- u_long in_size; /* fixed size of the input buffer */
- caddr_t in_base;
- caddr_t in_finger; /* location of next byte to be had */
- caddr_t in_boundry; /* can read up to this location */
- long fbtbc; /* fragment bytes to be consumed */
- bool_t last_frag;
- u_int sendsize;
- u_int recvsize;
-} RECSTREAM;
-
-
-/*
- * Create an xdr handle for xdrrec
- * xdrrec_create fills in xdrs. Sendsize and recvsize are
- * send and recv buffer sizes (0 => use default).
- * tcp_handle is an opaque handle that is passed as the first parameter to
- * the procedures readit and writeit. Readit and writeit are read and
- * write respectively. They are like the system
- * calls expect that they take an opaque handle rather than an fd.
- */
-void xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
-register XDR *xdrs;
-register u_int sendsize;
-register u_int recvsize;
-caddr_t tcp_handle;
-int (*readit) (); /* like read, but pass it a tcp_handle, not sock */
-int (*writeit) (); /* like write, but pass it a tcp_handle, not sock */
-{
- register RECSTREAM *rstrm = (RECSTREAM *) mem_alloc(sizeof(RECSTREAM));
-
- if (rstrm == NULL) {
- (void) fprintf(stderr, "xdrrec_create: out of memory\n");
- /*
- * This is bad. Should rework xdrrec_create to
- * return a handle, and in this case return NULL
- */
- return;
- }
- /*
- * adjust sizes and allocate buffer quad byte aligned
- */
- rstrm->sendsize = sendsize = fix_buf_size(sendsize);
- rstrm->recvsize = recvsize = fix_buf_size(recvsize);
- rstrm->the_buffer =
- mem_alloc(sendsize + recvsize + BYTES_PER_XDR_UNIT);
- if (rstrm->the_buffer == NULL) {
- (void) fprintf(stderr, "xdrrec_create: out of memory\n");
- return;
- }
- for (rstrm->out_base = rstrm->the_buffer;
- (u_int) rstrm->out_base % BYTES_PER_XDR_UNIT != 0;
- rstrm->out_base++);
- rstrm->in_base = rstrm->out_base + sendsize;
- /*
- * now the rest ...
- */
- xdrs->x_ops = &xdrrec_ops;
- xdrs->x_private = (caddr_t) rstrm;
- rstrm->tcp_handle = tcp_handle;
- rstrm->readit = readit;
- rstrm->writeit = writeit;
- rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
- rstrm->frag_header = (u_long *) rstrm->out_base;
- rstrm->out_finger += sizeof(u_long);
- rstrm->out_boundry += sendsize;
- rstrm->frag_sent = FALSE;
- rstrm->in_size = recvsize;
- rstrm->in_boundry = rstrm->in_base;
- rstrm->in_finger = (rstrm->in_boundry += recvsize);
- rstrm->fbtbc = 0;
- rstrm->last_frag = TRUE;
-}
-
-
-/*
- * The reoutines defined below are the xdr ops which will go into the
- * xdr handle filled in by xdrrec_create.
- */
-
-static bool_t xdrrec_getlong(xdrs, lp)
-XDR *xdrs;
-long *lp;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
- register long *buflp = (long *) (rstrm->in_finger);
- long mylong;
-
- /* first try the inline, fast case */
- if ((rstrm->fbtbc >= sizeof(long)) &&
- (((int) rstrm->in_boundry - (int) buflp) >= sizeof(long))) {
- *lp = (long) ntohl((u_long) (*buflp));
- rstrm->fbtbc -= sizeof(long);
- rstrm->in_finger += sizeof(long);
- } else {
- if (!xdrrec_getbytes(xdrs, (caddr_t) & mylong, sizeof(long)))
- return (FALSE);
-
- *lp = (long) ntohl((u_long) mylong);
- }
- return (TRUE);
-}
-
-/*
- * Internal useful routines
- */
-static bool_t flush_out(RECSTREAM* rstrm, bool_t eor)
-{
- register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
- register u_long len = (u_long) (rstrm->out_finger) -
- (u_long) (rstrm->frag_header) - sizeof(u_long);
-
- *(rstrm->frag_header) = htonl(len | eormask);
- len = (u_long) (rstrm->out_finger) - (u_long) (rstrm->out_base);
- if ((*(rstrm->writeit)) (rstrm->tcp_handle, rstrm->out_base, (int) len)
- != (int) len)
- return (FALSE);
- rstrm->frag_header = (u_long *) rstrm->out_base;
- rstrm->out_finger = (caddr_t) rstrm->out_base + sizeof(u_long);
- return (TRUE);
-}
-
-static bool_t
-/* knows nothing about records! Only about input buffers */
-fill_input_buf(rstrm)
-register RECSTREAM *rstrm;
-{
- register caddr_t where;
- u_int i;
- register int len;
-
- where = rstrm->in_base;
- i = (u_int) rstrm->in_boundry % BYTES_PER_XDR_UNIT;
- where += i;
- len = rstrm->in_size - i;
- if ((len = (*(rstrm->readit)) (rstrm->tcp_handle, where, len)) == -1)
- return (FALSE);
- rstrm->in_finger = where;
- where += len;
- rstrm->in_boundry = where;
- return (TRUE);
-}
-
-static bool_t
-/* knows nothing about records! Only about input buffers */
-get_input_bytes(rstrm, addr, len)
-register RECSTREAM *rstrm;
-register caddr_t addr;
-register int len;
-{
- register int current;
-
- while (len > 0) {
- current = (int) rstrm->in_boundry - (int) rstrm->in_finger;
- if (current == 0) {
- if (!fill_input_buf(rstrm))
- return (FALSE);
- continue;
- }
- current = (len < current) ? len : current;
- bcopy(rstrm->in_finger, addr, current);
- rstrm->in_finger += current;
- addr += current;
- len -= current;
- }
- return (TRUE);
-}
-
-static bool_t
-/* next two bytes of the input stream are treated as a header */
-set_input_fragment(rstrm)
-register RECSTREAM *rstrm;
-{
- u_long header;
-
- if (!get_input_bytes(rstrm, (caddr_t) & header, sizeof(header)))
- return (FALSE);
- header = (long) ntohl(header);
- rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE;
- rstrm->fbtbc = header & (~LAST_FRAG);
- return (TRUE);
-}
-
-static bool_t
-/* consumes input bytes; knows nothing about records! */
-skip_input_bytes(rstrm, cnt)
-register RECSTREAM *rstrm;
-long cnt;
-{
- register int current;
-
- while (cnt > 0) {
- current = (int) rstrm->in_boundry - (int) rstrm->in_finger;
- if (current == 0) {
- if (!fill_input_buf(rstrm))
- return (FALSE);
- continue;
- }
- current = (cnt < current) ? cnt : current;
- rstrm->in_finger += current;
- cnt -= current;
- }
- return (TRUE);
-}
-
-static u_int fix_buf_size(s)
-register u_int s;
-{
-
- if (s < 100)
- s = 4000;
- return (RNDUP(s));
-}
-static bool_t xdrrec_putlong(xdrs, lp)
-XDR *xdrs;
-long *lp;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
- register long *dest_lp = ((long *) (rstrm->out_finger));
-
- if ((rstrm->out_finger += sizeof(long)) > rstrm->out_boundry) {
- /*
- * this case should almost never happen so the code is
- * inefficient
- */
- rstrm->out_finger -= sizeof(long);
-
- rstrm->frag_sent = TRUE;
- if (!flush_out(rstrm, FALSE))
- return (FALSE);
- dest_lp = ((long *) (rstrm->out_finger));
- rstrm->out_finger += sizeof(long);
- }
- *dest_lp = (long) htonl((u_long) (*lp));
- return (TRUE);
-}
-
-static bool_t
-/* must manage buffers, fragments, and records */
-xdrrec_getbytes(xdrs, addr, len)
-XDR *xdrs;
-register caddr_t addr;
-register u_int len;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
- register int current;
-
- while (len > 0) {
- current = rstrm->fbtbc;
- if (current == 0) {
- if (rstrm->last_frag)
- return (FALSE);
- if (!set_input_fragment(rstrm))
- return (FALSE);
- continue;
- }
- current = (len < current) ? len : current;
- if (!get_input_bytes(rstrm, addr, current))
- return (FALSE);
- addr += current;
- rstrm->fbtbc -= current;
- len -= current;
- }
- return (TRUE);
-}
-
-static bool_t xdrrec_putbytes(xdrs, addr, len)
-XDR *xdrs;
-register caddr_t addr;
-register u_int len;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
- register int current;
-
- while (len > 0) {
- current = (u_int) rstrm->out_boundry - (u_int) rstrm->out_finger;
- current = (len < current) ? len : current;
- bcopy(addr, rstrm->out_finger, current);
- rstrm->out_finger += current;
- addr += current;
- len -= current;
- if (rstrm->out_finger == rstrm->out_boundry) {
- rstrm->frag_sent = TRUE;
- if (!flush_out(rstrm, FALSE))
- return (FALSE);
- }
- }
- return (TRUE);
-}
-
-static u_int xdrrec_getpos(xdrs)
-register XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
- register long pos;
-
- pos = lseek((int) rstrm->tcp_handle, (long) 0, 1);
- if (pos != -1)
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- pos += rstrm->out_finger - rstrm->out_base;
- break;
-
- case XDR_DECODE:
- pos -= rstrm->in_boundry - rstrm->in_finger;
- break;
-
- default:
- pos = (u_int) - 1;
- break;
- }
- return ((u_int) pos);
-}
-
-static bool_t xdrrec_setpos(xdrs, pos)
-register XDR *xdrs;
-u_int pos;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
- u_int currpos = xdrrec_getpos(xdrs);
- int delta = currpos - pos;
- caddr_t newpos;
-
- if ((int) currpos != -1)
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- newpos = rstrm->out_finger - delta;
- if ((newpos > (caddr_t) (rstrm->frag_header)) &&
- (newpos < rstrm->out_boundry)) {
- rstrm->out_finger = newpos;
- return (TRUE);
- }
- break;
-
- case XDR_DECODE:
- newpos = rstrm->in_finger - delta;
- if ((delta < (int) (rstrm->fbtbc)) &&
- (newpos <= rstrm->in_boundry) &&
- (newpos >= rstrm->in_base)) {
- rstrm->in_finger = newpos;
- rstrm->fbtbc -= delta;
- return (TRUE);
- }
- break;
- }
- return (FALSE);
-}
-
-static int32_t *xdrrec_inline(xdrs, len)
-register XDR *xdrs;
-int len;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
- int32_t *buf = NULL;
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- if ((rstrm->out_finger + len) <= rstrm->out_boundry) {
- buf = (int32_t *) rstrm->out_finger;
- rstrm->out_finger += len;
- }
- break;
-
- case XDR_DECODE:
- if ((len <= rstrm->fbtbc) &&
- ((rstrm->in_finger + len) <= rstrm->in_boundry)) {
- buf = (int32_t *) rstrm->in_finger;
- rstrm->fbtbc -= len;
- rstrm->in_finger += len;
- }
- break;
- }
- return (buf);
-}
-
-static void xdrrec_destroy(xdrs)
-register XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
-
- mem_free(rstrm->the_buffer,
- rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT);
- mem_free((caddr_t) rstrm, sizeof(RECSTREAM));
-}
-
-
-/*
- * Exported routines to manage xdr records
- */
-
-/*
- * Before reading (deserializing from the stream, one should always call
- * this procedure to guarantee proper record alignment.
- */
-bool_t xdrrec_skiprecord(xdrs)
-XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
-
- while (rstrm->fbtbc > 0 || (!rstrm->last_frag)) {
- if (!skip_input_bytes(rstrm, rstrm->fbtbc))
- return (FALSE);
- rstrm->fbtbc = 0;
- if ((!rstrm->last_frag) && (!set_input_fragment(rstrm)))
- return (FALSE);
- }
- rstrm->last_frag = FALSE;
- return (TRUE);
-}
-
-/*
- * Look ahead fuction.
- * Returns TRUE iff there is no more input in the buffer
- * after consuming the rest of the current record.
- */
-bool_t xdrrec_eof(xdrs)
-XDR *xdrs;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
-
- while (rstrm->fbtbc > 0 || (!rstrm->last_frag)) {
- if (!skip_input_bytes(rstrm, rstrm->fbtbc))
- return (TRUE);
- rstrm->fbtbc = 0;
- if ((!rstrm->last_frag) && (!set_input_fragment(rstrm)))
- return (TRUE);
- }
- if (rstrm->in_finger == rstrm->in_boundry)
- return (TRUE);
- return (FALSE);
-}
-
-/*
- * The client must tell the package when an end-of-record has occurred.
- * The second paraemters tells whether the record should be flushed to the
- * (output) tcp stream. (This let's the package support batched or
- * pipelined procedure calls.) TRUE => immmediate flush to tcp connection.
- */
-bool_t xdrrec_endofrecord(xdrs, sendnow)
-XDR *xdrs;
-bool_t sendnow;
-{
- register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
- register u_long len; /* fragment length */
-
- if (sendnow || rstrm->frag_sent ||
- ((u_long) rstrm->out_finger + sizeof(u_long) >=
- (u_long) rstrm->out_boundry)) {
- rstrm->frag_sent = FALSE;
- return (flush_out(rstrm, TRUE));
- }
- len = (u_long) (rstrm->out_finger) - (u_long) (rstrm->frag_header) -
- sizeof(u_long);
- *(rstrm->frag_header) = htonl((u_long) len | LAST_FRAG);
- rstrm->frag_header = (u_long *) rstrm->out_finger;
- rstrm->out_finger += sizeof(u_long);
- return (TRUE);
-}
-
-
diff --git a/mdk-stage1/dietlibc/librpc/xdr_reference.c b/mdk-stage1/dietlibc/librpc/xdr_reference.c
deleted file mode 100644
index 7715d821c..000000000
--- a/mdk-stage1/dietlibc/librpc/xdr_reference.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* @(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
-#endif
-
-/*
- * xdr_reference.c, Generic XDR routines impelmentation.
- *
- * Copyright (C) 1987, Sun Microsystems, Inc.
- *
- * These are the "non-trivial" xdr primitives used to serialize and de-serialize
- * "pointers". See xdr.h for more info on the interface to xdr.
- */
-
-#include <stdio.h>
-#include <rpc/types.h>
-#include <rpc/xdr.h>
-#include <string.h>
-
-#define LASTUNSIGNED ((u_int)0-1)
-
-/*
- * XDR an indirect pointer
- * xdr_reference is for recursively translating a structure that is
- * referenced by a pointer inside the structure that is currently being
- * translated. pp references a pointer to storage. If *pp is null
- * the necessary storage is allocated.
- * size is the sizeof the referneced structure.
- * proc is the routine to handle the referenced structure.
- */
-bool_t xdr_reference(xdrs, pp, size, proc)
-register XDR *xdrs;
-caddr_t *pp; /* the pointer to work on */
-u_int size; /* size of the object pointed to */
-xdrproc_t proc; /* xdr routine to handle the object */
-{
- register caddr_t loc = *pp;
- register bool_t stat;
-
- if (loc == NULL)
- switch (xdrs->x_op) {
- case XDR_FREE:
- return (TRUE);
-
- case XDR_DECODE:
- *pp = loc = (caddr_t) mem_alloc(size);
- if (loc == NULL) {
- (void) fprintf(stderr, "xdr_reference: out of memory\n");
- return (FALSE);
- }
- bzero(loc, (int) size);
- break;
- }
-
- stat = (*proc) (xdrs, loc, LASTUNSIGNED);
-
- if (xdrs->x_op == XDR_FREE) {
- mem_free(loc, size);
- *pp = NULL;
- }
- return (stat);
-}
-
-
-/*
- * xdr_pointer():
- *
- * XDR a pointer to a possibly recursive data structure. This
- * differs with xdr_reference in that it can serialize/deserialiaze
- * trees correctly.
- *
- * What's sent is actually a union:
- *
- * union object_pointer switch (boolean b) {
- * case TRUE: object_data data;
- * case FALSE: void nothing;
- * }
- *
- * > objpp: Pointer to the pointer to the object.
- * > obj_size: size of the object.
- * > xdr_obj: routine to XDR an object.
- *
- */
-bool_t xdr_pointer(xdrs, objpp, obj_size, xdr_obj)
-register XDR *xdrs;
-char **objpp;
-u_int obj_size;
-xdrproc_t xdr_obj;
-{
-
- bool_t more_data;
-
- more_data = (*objpp != NULL);
- if (!xdr_bool(xdrs, &more_data)) {
- return (FALSE);
- }
- if (!more_data) {
- *objpp = NULL;
- return (TRUE);
- }
- return (xdr_reference(xdrs, objpp, obj_size, xdr_obj));
-}
diff --git a/mdk-stage1/dietlibc/librpc/xdr_stdio.c b/mdk-stage1/dietlibc/librpc/xdr_stdio.c
deleted file mode 100644
index e3190e0a9..000000000
--- a/mdk-stage1/dietlibc/librpc/xdr_stdio.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* @(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC */
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-#if !defined(lint) && defined(SCCSIDS)
-static char sccsid[] =
-
- "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
-#endif
-
-/*
- * xdr_stdio.c, XDR implementation on standard i/o file.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- *
- * This set of routines implements a XDR on a stdio stream.
- * XDR_ENCODE serializes onto the stream, XDR_DECODE de-serializes
- * from the stream.
- */
-
-#include <rpc/types.h>
-#include <stdio.h>
-#include <rpc/xdr.h>
-
-static bool_t xdrstdio_getlong();
-static bool_t xdrstdio_putlong();
-static bool_t xdrstdio_getbytes();
-static bool_t xdrstdio_putbytes();
-static u_int xdrstdio_getpos();
-static bool_t xdrstdio_setpos();
-static int32_t *xdrstdio_inline();
-static void xdrstdio_destroy();
-
-/*
- * Ops vector for stdio type XDR
- */
-static struct xdr_ops xdrstdio_ops = {
- xdrstdio_getlong, /* deseraialize a long int */
- xdrstdio_putlong, /* seraialize a long int */
- xdrstdio_getbytes, /* deserialize counted bytes */
- xdrstdio_putbytes, /* serialize counted bytes */
- xdrstdio_getpos, /* get offset in the stream */
- xdrstdio_setpos, /* set offset in the stream */
- xdrstdio_inline, /* prime stream for inline macros */
- xdrstdio_destroy /* destroy stream */
-};
-
-/*
- * Initialize a stdio xdr stream.
- * Sets the xdr stream handle xdrs for use on the stream file.
- * Operation flag is set to op.
- */
-void xdrstdio_create(xdrs, file, op)
-register XDR *xdrs;
-FILE *file;
-enum xdr_op op;
-{
-
- xdrs->x_op = op;
- xdrs->x_ops = &xdrstdio_ops;
- xdrs->x_private = (caddr_t) file;
- xdrs->x_handy = 0;
- xdrs->x_base = 0;
-}
-
-/*
- * Destroy a stdio xdr stream.
- * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
- */
-static void xdrstdio_destroy(xdrs)
-register XDR *xdrs;
-{
- (void) fflush((FILE *) xdrs->x_private);
- /* xx should we close the file ?? */
-};
-
-static bool_t xdrstdio_getlong(xdrs, lp)
-XDR *xdrs;
-register long *lp;
-{
-
- if (fread((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
- 1) return (FALSE);
-
-#ifndef mc68000
- *lp = ntohl(*lp);
-#endif
- return (TRUE);
-}
-
-static bool_t xdrstdio_putlong(xdrs, lp)
-XDR *xdrs;
-long *lp;
-{
-
-#ifndef mc68000
- long mycopy = htonl(*lp);
-
- lp = &mycopy;
-#endif
- if (fwrite((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
- 1) return (FALSE);
-
- return (TRUE);
-}
-
-static bool_t xdrstdio_getbytes(xdrs, addr, len)
-XDR *xdrs;
-caddr_t addr;
-u_int len;
-{
-
- if ((len != 0)
- && (fread(addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
- return (FALSE);
- return (TRUE);
-}
-
-static bool_t xdrstdio_putbytes(xdrs, addr, len)
-XDR *xdrs;
-caddr_t addr;
-u_int len;
-{
-
- if ((len != 0)
- && (fwrite(addr, (int) len, 1, (FILE *) xdrs->x_private) != 1))
- return (FALSE);
- return (TRUE);
-}
-
-static u_int xdrstdio_getpos(xdrs)
-XDR *xdrs;
-{
-
- return ((u_int) ftell((FILE *) xdrs->x_private));
-}
-
-static bool_t xdrstdio_setpos(xdrs, pos)
-XDR *xdrs;
-u_int pos;
-{
-
- return ((fseek((FILE *) xdrs->x_private, (long) pos, 0) < 0) ?
- FALSE : TRUE);
-}
-
-static int32_t *xdrstdio_inline(xdrs, len)
-XDR *xdrs;
-u_int len;
-{
-
- /*
- * Must do some work to implement this: must insure
- * enough data in the underlying stdio buffer,
- * that the buffer is aligned so that we can indirect through a
- * long *, and stuff this pointer in xdrs->x_buf. Doing
- * a fread or fwrite to a scratch buffer would defeat
- * most of the gains to be had here and require storage
- * management on this buffer, so we don't do this.
- */
- return (NULL);
-}
diff --git a/mdk-stage1/dietlibc/libshell/fnmatch.c b/mdk-stage1/dietlibc/libshell/fnmatch.c
deleted file mode 100644
index 4e7664510..000000000
--- a/mdk-stage1/dietlibc/libshell/fnmatch.c
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <ctype.h>
-#include <fnmatch.h>
-
-#define NOTFIRST 128
-
-static int match(char c,char d,int flags) {
- if (flags&FNM_CASEFOLD)
- return (tolower(c)==tolower(d));
- else
- return (c==d);
-}
-
-int fnmatch(const char *pattern, const char *string, int flags) {
- if (*string==0) {
- while (*pattern=='*') ++pattern;
- return (!!*pattern);
- }
- if (*string=='.' && *pattern!='.' && (flags&FNM_PERIOD)) {
- /* don't match if FNM_PERIOD and this is the first char */
- if ((flags&FNM_PERIOD) && (!(flags&NOTFIRST)))
- return 1;
- /* don't match if FNM_PERIOD and FNM_FILE_NAME and previous was '/' */
- if ((flags&(FNM_FILE_NAME|FNM_PERIOD)) && string[-1]=='/')
- return 1;
- }
- flags|=NOTFIRST;
- switch (*pattern) {
- case '[':
- ++pattern;
- while (*pattern && *pattern!=']') {
- if (flags&FNM_PATHNAME || *string!='/') {
- int res=0;
- if (pattern[1]=='-') {
- if (*string>=*pattern && *string<=pattern[2]) res=1;
- if (flags&FNM_CASEFOLD) {
- if (tolower(*string)>=tolower(*pattern) && tolower(*string)<=tolower(pattern[2])) res=1;
- }
- } else
- res=match(*pattern,*string,flags);
- if (res) {
- while (*pattern && *pattern!=']') ++pattern;
- return fnmatch(pattern+1,string+1,flags);
- }
- }
- ++pattern;
- }
- break;
- case '\\':
- if (flags&FNM_NOESCAPE) {
- if (*string=='\\')
- return fnmatch(pattern+1,string+1,flags);
- } else {
- if (*string==pattern[1])
- return fnmatch(pattern+2,string+1,flags);
- }
- break;
- case '*':
- if (!pattern[1] || fnmatch(pattern+1,string,flags)==0)
- return 0;
- else
- if (*string!='/')
- return fnmatch(pattern,string+1,flags);
- break;
- case 0:
- if (*string==0 || (*string=='/' && (flags&FNM_LEADING_DIR)))
- return 0;
- break;
- default:
- if (match(*pattern,*string,flags))
- return fnmatch(pattern+1,string+1,flags);
- break;
- }
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libshell/glob.c b/mdk-stage1/dietlibc/libshell/glob.c
deleted file mode 100644
index 34d09d87a..000000000
--- a/mdk-stage1/dietlibc/libshell/glob.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * dietlibc/libshell/glob.c
- *
- * Copyright 2001 Guillaume Cottenceau <gc@mandrakesoft.com>
- *
- * This is free software, licensed under the Gnu General Public License.
- *
- */
-
-/*
- * unsupported: GLOB_BRACE GLOB_ALTDIRFUNC GLOB_MAGCHAR
- */
-
-#define DEBUG(x)
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <fnmatch.h>
-#include <dirent.h>
-#include <pwd.h>
-
-#include <glob.h>
-
-
-
-/* If i18n, should be using strcoll */
-static int cmp_func(const void * a, const void * b)
-{
- const char *const s1 = *(const char *const * const) a;
- const char *const s2 = *(const char *const * const) b;
- if (s1 == NULL)
- return 1;
- if (s2 == NULL)
- return -1;
- return strcmp(s1, s2);
-}
-
-
-/* Like `glob', but PATTERN is a final pathname component,
- and matches are searched for in DIRECTORY.
- The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
- The GLOB_APPEND flag is assumed to be set (always appends).
- Prepends DIRECTORY in constructed PGLOB. */
-static int glob_in_dir(const char *pattern, const char *directory, int flags,
- int errfunc(const char * epath, int eerrno),
- glob_t *pglob)
-{
- DIR *dp = opendir(directory);
- int nfound = 0;
-
- int i;
- char * ptr;
-
- void close_dir_keep_errno(void) {
- int save = errno;
- if (dp)
- closedir (dp);
- __set_errno(save);
- }
- int add_entry(const char * name) {
- pglob->gl_pathv = (char **) realloc(pglob->gl_pathv,
- (pglob->gl_pathc + pglob->gl_offs + 2)
- * sizeof (char *));
- if (pglob->gl_pathv == NULL)
- return 1;
- pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc] = strdup(name);
- pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc + 1] = NULL;
- pglob->gl_pathc++;
- nfound++;
- return 0;
- }
- void build_fullname(char * fullname, int fullnamesize, const char * directory, const char * filename) {
- if (!strcmp(directory, "/"))
- snprintf(fullname, fullnamesize, "/%s", filename);
- else if (!strcmp(directory, "."))
- snprintf(fullname, fullnamesize, "%s", filename);
- else
- snprintf(fullname, fullnamesize, "%s/%s", directory, filename);
- }
-
- if (!dp) {
- if (errno != ENOTDIR
- && ((errfunc != NULL && (*errfunc) (directory, errno))
- || (flags & GLOB_ERR)))
- return GLOB_ABORTED;
- } else {
- int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
- | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0));
- struct dirent *ep;
- while ((ep = readdir(dp))) {
- i = strlen(directory) + strlen(ep->d_name) + 2;
- ptr = (char *) alloca(i);
- build_fullname(ptr, i, directory, ep->d_name);
- if (flags & GLOB_ONLYDIR) {
- struct stat statr;
- if (stat(ptr, &statr) || !S_ISDIR(statr.st_mode))
- continue;
- }
- if (fnmatch(pattern, ep->d_name, fnm_flags) == 0)
- if (add_entry(ptr))
- goto memory_error;
- }
- }
-
- close_dir_keep_errno();
-
- if (nfound != 0)
- pglob->gl_flags = flags;
- else if (flags & GLOB_NOCHECK) {
- /* nfound == 0 */
- i = strlen(directory) + strlen(pattern) + 2;
- ptr = (char *) alloca(i);
- build_fullname(ptr, i, directory, pattern);
- if (add_entry(ptr))
- goto memory_error;
- }
-
- return (nfound == 0) ? GLOB_NOMATCH : 0;
-
- memory_error:
- /* We're in trouble since we can't free the already allocated memory. [allocated from strdup(filame)]
- * Well, after all, when malloc returns NULL we're already in a bad mood, and no doubt the
- * program will manage to segfault by itself very soon :-). */
- close_dir_keep_errno();
- return GLOB_NOSPACE;
-}
-
-
-
-int glob(const char *pattern, int flags, int errfunc(const char * epath, int eerrno), glob_t *pglob)
-{
- char * pattern_;
- char * filename;
- char * dirname;
- size_t oldcount;
- struct stat statr;
-
- size_t i; /* tmp variables are declared here to save a bit of object space */
- int j, k; /* */
- char * ptr, * ptr2;
-
- if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) {
- __set_errno (EINVAL);
- return -1;
- }
-
- if (!(flags & GLOB_DOOFFS))
- pglob->gl_offs = 0;
-
-
- /* Duplicate pattern so I can make modif to it later (to handle
- TILDE stuff replacing old contents, and to null-terminate the
- directory) */
- pattern_ = alloca(strlen(pattern) + 1);
- strcpy(pattern_, pattern);
-
- /* Check for TILDE stuff */
- if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern_[0] == '~') {
- char * home_dir = NULL;
- if (pattern_[1] == '\0' || pattern_[1] == '/') {
- /* She's asking for ~, her homedir */
- home_dir = getenv("HOME");
- } else {
- /* She's asking for another one's homedir */
- struct passwd * p;
- ptr2 = alloca(strlen(pattern_) + 1);
- strcpy(ptr2, pattern_ + 1);
- ptr = strchr(ptr2, '/');
- if (ptr != NULL)
- *ptr = '\0';
- if (((p = getpwnam(ptr2)) != NULL))
- home_dir = p->pw_dir;
- }
- if (home_dir != NULL) {
- i = strlen(home_dir) + strlen(pattern_); /* pessimistic (the ~ case) */
- ptr = alloca(i);
- strncpy(ptr, home_dir, i);
- ptr2 = pattern_ + 1;
- while (*ptr2 != '/' && *ptr2 != '\0')
- ptr2++;
- strncat(ptr, ptr2, i);
- pattern_ = ptr;
- } else if (flags & GLOB_TILDE_CHECK)
- return GLOB_NOMATCH;
- }
-
- /* Find the filename */
- filename = strrchr(pattern_, '/');
-
- if (filename == NULL) {
- /* We have no '/' in the pattern */
- filename = pattern_;
- dirname = ".";
- } else if (filename == pattern_) {
- /* "/pattern". */
- dirname = "/";
- filename++;
- } else {
- dirname = pattern_;
- filename++;
- /* allow dirname to be null terminated */
- *(filename-1) = '\0';
-
- if (filename[0] == '\0' && strcmp(pattern_, "/")) {
- /* "pattern/". Expand "pattern", appending slashes. */
- j = glob(dirname, flags | GLOB_MARK, errfunc, pglob);
- if (j == 0)
- pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
- | (flags & GLOB_MARK));
- return j;
- }
- }
-
-
- /* Reserve memory for pglob */
- if (!(flags & GLOB_APPEND)) {
- pglob->gl_pathc = 0;
- if (!(flags & GLOB_DOOFFS))
- pglob->gl_pathv = NULL;
- else {
- pglob->gl_pathv = (char **) malloc((pglob->gl_offs + 1) * sizeof (char *));
- if (pglob->gl_pathv == NULL)
- return GLOB_NOSPACE;
- for (i = 0; i <= pglob->gl_offs; i++)
- pglob->gl_pathv[i] = NULL;
- }
- }
-
-
- oldcount = pglob->gl_pathc + pglob->gl_offs;
-
-
- /* Begin real work */
- if (!strcmp(dirname, "/") || !strcmp(dirname, ".")
- || (!strchr(dirname, '*') && !strchr(dirname, '?') && !strchr(dirname, '['))) {
- /* Approx of a terminal state, glob directly in dir. */
- j = glob_in_dir(filename, dirname, flags, errfunc, pglob);
- if (j != 0)
- return j;
- } else {
- /* We are not in a terminal state, so we have to glob for
- the directory, and then glob for the pattern in each
- directory found. */
- glob_t dirs;
-
- j = glob(dirname, ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ALTDIRFUNC))
- | GLOB_NOSORT | GLOB_ONLYDIR),
- errfunc, &dirs);
- if (j != 0)
- return j;
-
- /* We have successfully globbed the directory name.
- For each name we found, call glob_in_dir on it and FILENAME,
- appending the results to PGLOB. */
- for (i = 0; i < dirs.gl_pathc; i++) {
- j = glob_in_dir(filename, dirs.gl_pathv[i], ((flags | GLOB_APPEND) & ~GLOB_NOCHECK),
- errfunc, pglob);
- if (j == GLOB_NOMATCH)
- /* No matches in this directory. Try the next. */
- continue;
- if (j != 0) {
- globfree(&dirs);
- globfree(pglob);
- return j;
- }
- }
-
- /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls.
- But if we have not found any matching entry and the GLOB_NOCHECK
- flag was set we must return the list consisting of the disrectory
- names followed by the filename. */
- if (pglob->gl_pathc + pglob->gl_offs == oldcount)
- {
- /* No matches. */
- if (flags & GLOB_NOCHECK)
- {
- for (i = 0; i < dirs.gl_pathc; i++) {
- if (stat(dirs.gl_pathv[i], &statr) || !S_ISDIR(statr.st_mode))
- continue;
-
- /* stat is okay, we will add the entry, but before let's resize the pathv */
- j = pglob->gl_pathc + pglob->gl_offs;
- pglob->gl_pathv = (char **) realloc(pglob->gl_pathv, (j + 2) * sizeof (char *));
- if (pglob->gl_pathv == NULL) {
- globfree (&dirs);
- return GLOB_NOSPACE;
- }
-
- /* okay now we add the new entry */
- k = strlen(dirs.gl_pathv[i]) + 1 + strlen(filename) + 1;
- if ((pglob->gl_pathv[j] = malloc(k)) == NULL) {
- globfree(&dirs);
- globfree(pglob);
- return GLOB_NOSPACE;
- }
- snprintf(pglob->gl_pathv[j], k, "%s/%s", dirs.gl_pathv[i], filename);
- pglob->gl_pathc++;
- pglob->gl_pathv[j+1] = NULL;
- }
- } else {
- globfree(&dirs);
- return GLOB_NOMATCH;
- }
- }
-
- globfree (&dirs);
- }
-
-
- if (flags & GLOB_MARK) {
- for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; i++)
- if (!stat(pglob->gl_pathv[i], &statr) && S_ISDIR(statr.st_mode)) {
- size_t len = strlen(pglob->gl_pathv[i]) + 2;
- ptr = realloc(pglob->gl_pathv[i], len);
- if (ptr == NULL) {
- globfree(pglob);
- return GLOB_NOSPACE;
- }
- strcpy(&ptr[len - 2], "/");
- pglob->gl_pathv[i] = ptr;
- }
- }
-
- if (!(flags & GLOB_NOSORT)) {
- qsort(&pglob->gl_pathv[oldcount],
- pglob->gl_pathc + pglob->gl_offs - oldcount,
- sizeof(char *), cmp_func);
- }
-
- return 0;
-}
-
-
-/* Free storage allocated in PGLOB by a previous `glob' call. */
-void globfree (glob_t * pglob)
-{
- if (pglob->gl_pathv != NULL) {
- size_t i;
- for (i = 0; i < pglob->gl_pathc; i++)
- if (pglob->gl_pathv[pglob->gl_offs + i] != NULL)
- free((void *) pglob->gl_pathv[pglob->gl_offs + i]);
- free((void *) pglob->gl_pathv);
- }
-}
diff --git a/mdk-stage1/dietlibc/libshell/realpath.c b/mdk-stage1/dietlibc/libshell/realpath.c
deleted file mode 100644
index 1377018e5..000000000
--- a/mdk-stage1/dietlibc/libshell/realpath.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <limits.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include "dietfeatures.h"
-
-char *realpath(const char *path, char *resolved_path) {
- int fd=open(".",O_RDONLY);
- char *tmp="";
- if (chdir(path)) {
-#ifdef WANT_THREAD_SAFE
- if (*__errno_location()==ENOTDIR)
-#else
- if (errno==ENOTDIR)
-#endif
- {
- if ((tmp=strrchr(path,'/'))) {
- memmove(resolved_path,path,tmp-path);
- resolved_path[tmp-path]=0;
- if (chdir(resolved_path)) { resolved_path=0; goto abort; }
- }
- }
- }
- if (!getcwd(resolved_path,PATH_MAX)) { resolved_path=0; goto abort; }
- strcat(resolved_path,tmp);
-abort:
- fchdir(fd);
- close(fd);
- return resolved_path;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/clearerr.c b/mdk-stage1/dietlibc/libstdio/clearerr.c
deleted file mode 100644
index 8bde8c702..000000000
--- a/mdk-stage1/dietlibc/libstdio/clearerr.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "dietstdio.h"
-
-void clearerr( FILE *stream) {
- stream->flags&=~(ERRORINDICATOR|EOFINDICATOR);
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fclose.c b/mdk-stage1/dietlibc/libstdio/fclose.c
deleted file mode 100644
index a955c6086..000000000
--- a/mdk-stage1/dietlibc/libstdio/fclose.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "dietstdio.h"
-#include <stdlib.h>
-#include <unistd.h>
-
-int fclose(FILE *stream) {
- int res;
-#ifdef WANT_BUFFERED_STDIO
- FILE *f,*fl;
-#endif
- if (!stream)
- return EOF;
- fflush(stream);
- res=close(stream->fd);
-#ifdef WANT_BUFFERED_STDIO
- for (fl=0,f=__stdio_root; f; fl=f,f=f->next)
- if (f==stream) {
- if (fl)
- fl->next=f->next;
- else
- __stdio_root=f->next;
- break;
- }
-#endif
- free(stream);
- return res;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fdglue.c b/mdk-stage1/dietlibc/libstdio/fdglue.c
deleted file mode 100644
index 1c3918f1f..000000000
--- a/mdk-stage1/dietlibc/libstdio/fdglue.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "dietstdio.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#ifdef WANT_BUFFERED_STDIO
-extern int __stdio_atexit;
-extern void __stdio_flushall();
-#endif
-
-int __stdio_parse_mode(const char *mode) {
- int f=0;
- for (;;) {
- switch (*mode) {
- case 0: return f;
- case 'b': break;
- case 'r': f=O_RDONLY; break;
- case 'w': f=O_WRONLY|O_CREAT|O_TRUNC; break;
- case 'a': f=O_WRONLY|O_CREAT|O_APPEND; break;
- case '+': f=(f&(~O_WRONLY))|O_RDWR; break;
- }
- ++mode;
- }
-}
-
-FILE* __stdio_init_file(int fd) {
- FILE *tmp=(FILE*)malloc(sizeof(FILE));
- if (!tmp) {
- close(fd);
- errno=ENOMEM;
- return 0;
- }
- tmp->fd=fd;
-#ifdef WANT_BUFFERED_STDIO
- tmp->bm=0;
- tmp->bs=0;
-#endif
-#ifdef WANT_UNGETC
- tmp->ungotten = 0;
-#endif
- tmp->flags=0;
-#ifdef WANT_BUFFERED_STDIO
- if (__stdio_atexit==0) {
- __stdio_atexit=1;
- atexit(__stdio_flushall);
- }
- tmp->next=__stdio_root;
- __stdio_root=tmp;
-#endif
- return tmp;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fdopen.c b/mdk-stage1/dietlibc/libstdio/fdopen.c
deleted file mode 100644
index aee14fb0c..000000000
--- a/mdk-stage1/dietlibc/libstdio/fdopen.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <sys/types.h>
-#include <dietstdio.h>
-#include <unistd.h>
-
-#define SEEK_END 2
-
-int __stdio_parse_mode(const char *mode);
-FILE* __stdio_init_file(int fd);
-
-FILE *fdopen (int filedes, const char *mode) {
- int f=0; /* O_RDONLY, O_WRONLY or O_RDWR */
- int fd;
-
- f=__stdio_parse_mode(mode);
- if ((fd=filedes)<0) return 0;
- {
- FILE * ret = __stdio_init_file(fd);
- ret->flags |= UNSEEKABLE;
- return ret;
- }
-}
diff --git a/mdk-stage1/dietlibc/libstdio/feof.c b/mdk-stage1/dietlibc/libstdio/feof.c
deleted file mode 100644
index b7e86fe3b..000000000
--- a/mdk-stage1/dietlibc/libstdio/feof.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <dietstdio.h>
-
-int feof(FILE *stream) {
-#ifdef WANT_UNGETC
- /* yuck!!! */
- if (stream->ungotten) return 0;
-#endif
- return (stream->flags&EOFINDICATOR);
-}
diff --git a/mdk-stage1/dietlibc/libstdio/ferror.c b/mdk-stage1/dietlibc/libstdio/ferror.c
deleted file mode 100644
index e86873be0..000000000
--- a/mdk-stage1/dietlibc/libstdio/ferror.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <dietstdio.h>
-
-int ferror(FILE *stream) {
- return (stream->flags&ERRORINDICATOR);
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fflush.c b/mdk-stage1/dietlibc/libstdio/fflush.c
deleted file mode 100644
index 7078e04f4..000000000
--- a/mdk-stage1/dietlibc/libstdio/fflush.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "dietstdio.h"
-#include <unistd.h>
-#include <stdlib.h>
-#include "dietwarning.h"
-
-FILE *__stdio_root;
-
-#ifdef WANT_BUFFERED_STDIO
-int __stdio_atexit=0;
-
-void __stdio_flushall() {
- fflush(0);
-}
-
-extern int __fflush_stdin();
-extern int __fflush_stdout();
-extern int __fflush_stderr();
-
-int fflush(FILE *stream) {
- if (stream==0) {
- int res;
- FILE *f;
- __fflush_stdin();
- __fflush_stdout();
- __fflush_stderr();
- for (res=0, f=__stdio_root; f; f=f->next)
- if (fflush(f))
- res=-1;
- return res;
- }
- if (stream->flags&BUFINPUT) {
- register int tmp;
- if ((tmp=stream->bm-stream->bs)) lseek(stream->fd,tmp,SEEK_CUR);
- } else
- if (stream->bm && write(stream->fd,stream->buf,stream->bm)!=stream->bm) {
- stream->flags|=ERRORINDICATOR;
- return -1;
- }
- stream->bm=0;
- return 0;
-}
-
-int __fflush4(FILE *stream,int next) {
- if (!__stdio_atexit) {
- __stdio_atexit=1;
- atexit(__stdio_flushall);
- }
- if ((stream->flags&BUFINPUT)!=next) {
- int res=fflush(stream);
- stream->flags=(stream->flags&~BUFINPUT)|next;
- return res;
- }
- return 0;
-}
-
-#else
-int fflush(FILE *stream) {
- return 0;
-}
-#endif
-
-link_warning("fflush","warning: your code uses stdio (several kilobytes of bloat).")
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/fgets.c b/mdk-stage1/dietlibc/libstdio/fgets.c
deleted file mode 100644
index c613d452d..000000000
--- a/mdk-stage1/dietlibc/libstdio/fgets.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "dietstdio.h"
-
-extern int ferror(FILE *stream);
-
-char *fgets(char *s, int size, FILE *stream) {
- char *orig=s;
- int l;
- for (l=size; l>0;) {
- int c=fgetc(stream);
- if (c==EOF) break;
- *s=c;
- ++s;
- --l;
- if (c=='\n') break;
- }
- if (l==size || ferror(stream))
- return 0;
- *s=0;
- return orig;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fileno.c b/mdk-stage1/dietlibc/libstdio/fileno.c
deleted file mode 100644
index f021d3881..000000000
--- a/mdk-stage1/dietlibc/libstdio/fileno.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <dietstdio.h>
-
-int fileno(FILE *stream) {
- return stream->fd;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fopen.c b/mdk-stage1/dietlibc/libstdio/fopen.c
deleted file mode 100644
index aac17be42..000000000
--- a/mdk-stage1/dietlibc/libstdio/fopen.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <sys/types.h>
-#include <dietstdio.h>
-#include <unistd.h>
-
-#define SEEK_END 2
-
-extern int __stdio_atexit;
-extern void __stdio_flushall();
-
-extern int __stdio_parse_mode(const char *mode);
-extern FILE* __stdio_init_file(int fd);
-
-FILE *fopen (const char *path, const char *mode) {
- int f=0; /* O_RDONLY, O_WRONLY or O_RDWR */
- int fd;
-
- f=__stdio_parse_mode(mode);
- if ((fd=open(path,f,0666))<0)
- return 0;
- return __stdio_init_file(fd);
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fprintf.c b/mdk-stage1/dietlibc/libstdio/fprintf.c
deleted file mode 100644
index 237fd1e51..000000000
--- a/mdk-stage1/dietlibc/libstdio/fprintf.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdarg.h>
-#include <linux/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-extern int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
-
-int fprintf(FILE *f,const char *format,...) {
- int n;
- char *printf_buf;
-/* char printf_buf[1024]; */
- va_list arg_ptr;
- va_start(arg_ptr, format);
- n=vsnprintf(0,1000000,format,arg_ptr);
-/* write(1,printf_buf,strlen(printf_buf)); */
- va_end (arg_ptr);
- va_start (arg_ptr, format);
- printf_buf=alloca(n+2);
- n=vsnprintf(printf_buf,n+1,format,arg_ptr);
- va_end (arg_ptr);
- fwrite(printf_buf,n,1,f);
- return n;
-}
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/libstdio/fputs.c b/mdk-stage1/dietlibc/libstdio/fputs.c
deleted file mode 100644
index 51ee9a96e..000000000
--- a/mdk-stage1/dietlibc/libstdio/fputs.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "dietstdio.h"
-#include <string.h>
-
-int fputs(const char *s, FILE *stream) {
- return fwrite(s,strlen(s),1,stream);
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fread.c b/mdk-stage1/dietlibc/libstdio/fread.c
deleted file mode 100644
index 29afa1489..000000000
--- a/mdk-stage1/dietlibc/libstdio/fread.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <sys/types.h>
-#include "dietstdio.h"
-#include <unistd.h>
-
-size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream) {
- int res;
-#ifdef WANT_BUFFERED_STDIO
- unsigned long i,j;
- j=size*nmemb;
-#ifdef WANT_UNGETC
- if (stream->ungotten) {
- *(char*)ptr=stream->ungetbuf;
- ptr=((char*)ptr)+1;
- --j;
- }
- if (!j) return 1;
-#endif
- for (i=0; i<j; ++i) {
- res=fgetc(stream);
- if (res==EOF)
- return i/size;
- else
- ((unsigned char*)ptr)[i]=(unsigned char)res;
- }
- return nmemb;
-#else
-#ifdef WANT_UNGETC
- unsigned long j=size*nmemb;
-#endif
- fflush(stream);
-#ifdef WANT_UNGETC
- if (stream->ungotten) {
- *(char*)ptr=stream->ungetbuf;
- ptr=((char*)ptr)+1;
- --j;
- }
- if (!j) return 1;
- res=read(stream->fd,ptr,j);
-#else
- res=read(stream->fd,ptr,size*nmemb);
-#endif
- if (res<0) {
- stream->flags|=ERRORINDICATOR;
- return 0;
- } else if (res<size*nmemb)
- if (!(stream->flags & UNSEEKABLE)
- || ((stream->flags & UNSEEKABLE) && res == 0))
- stream->flags|=EOFINDICATOR;
- return res/size;
-#endif
-}
diff --git a/mdk-stage1/dietlibc/libstdio/freopen.c b/mdk-stage1/dietlibc/libstdio/freopen.c
deleted file mode 100644
index 8d4644a10..000000000
--- a/mdk-stage1/dietlibc/libstdio/freopen.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <dietstdio.h>
-#include <unistd.h>
-
-FILE *freopen (const char *path, const char *mode, FILE *stream) {
- fclose(stream);
- stream=fopen(path,mode);
- return stream;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fseek.c b/mdk-stage1/dietlibc/libstdio/fseek.c
deleted file mode 100644
index 5bb96bc6e..000000000
--- a/mdk-stage1/dietlibc/libstdio/fseek.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <dietstdio.h>
-#include <unistd.h>
-
-long fseek(FILE *stream, long offset, int whence) {
- fflush(stream);
-#ifdef WANT_BUFFERED_STDIO
- stream->bm=0; stream->bs=0;
-#endif
- stream->flags&=~(ERRORINDICATOR|EOFINDICATOR);
- return (lseek(stream->fd,offset,whence));
-}
diff --git a/mdk-stage1/dietlibc/libstdio/ftell.c b/mdk-stage1/dietlibc/libstdio/ftell.c
deleted file mode 100644
index 42d2c9f26..000000000
--- a/mdk-stage1/dietlibc/libstdio/ftell.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <dietstdio.h>
-#include <unistd.h>
-
-long ftell(FILE *stream) {
- fflush(stream);
- return (lseek(stream->fd,0,SEEK_CUR));
-}
diff --git a/mdk-stage1/dietlibc/libstdio/fwrite.c b/mdk-stage1/dietlibc/libstdio/fwrite.c
deleted file mode 100644
index 5691661a5..000000000
--- a/mdk-stage1/dietlibc/libstdio/fwrite.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <sys/types.h>
-#include "dietstdio.h"
-#include <unistd.h>
-
-size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream) {
- int res;
-#ifdef WANT_BUFFERED_STDIO
- long len=size*nmemb;
- long i;
- if (len>BUFSIZE || (stream->flags&NOBUF)) {
- if (!(stream->flags&NOBUF)) fflush(stream);
- res=write(stream->fd,ptr,size*nmemb);
- } else {
- register const unsigned char *c=ptr;
- for (i=size*nmemb; i>0; --i,++c)
- if (fputc(*c,stream)) {
- res=-1;
- break;
- }
- res=size*nmemb;
- }
-#else
- res=write(stream->fd,ptr,size*nmemb);
-#endif
- if (res<0) {
- stream->flags|=ERRORINDICATOR;
- return 0;
- }
- return size?res/size:0;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/printf.c b/mdk-stage1/dietlibc/libstdio/printf.c
deleted file mode 100644
index 571420dc3..000000000
--- a/mdk-stage1/dietlibc/libstdio/printf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdarg.h>
-#include <linux/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "dietstdio.h"
-
-int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
-
-int printf(const char *format,...)
-{
- int n;
- char *printf_buf;
-/* char printf_buf[1024]; */
- va_list arg_ptr;
- va_start(arg_ptr, format);
- n=vsnprintf(0,1000000,format,arg_ptr);
-/* write(1,printf_buf,strlen(printf_buf)); */
- va_end (arg_ptr);
- va_start (arg_ptr, format);
- printf_buf=alloca(n+2);
- n=vsnprintf(printf_buf,n+1,format,arg_ptr);
-#ifdef WANT_BUFFERED_STDIO
- fwrite(printf_buf,n,1,stdout);
-#else
- write(1,printf_buf,n);
-#endif
- va_end (arg_ptr);
- return n;
-}
diff --git a/mdk-stage1/dietlibc/libstdio/putchar.c b/mdk-stage1/dietlibc/libstdio/putchar.c
deleted file mode 100644
index 7e5285a48..000000000
--- a/mdk-stage1/dietlibc/libstdio/putchar.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdio.h>
-
-#undef putchar
-int putchar(int c) {
- return fputc(c,stdout);
-}
diff --git a/mdk-stage1/dietlibc/libstdio/setvbuf.c b/mdk-stage1/dietlibc/libstdio/setvbuf.c
deleted file mode 100644
index d0b1b7640..000000000
--- a/mdk-stage1/dietlibc/libstdio/setvbuf.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <sys/types.h>
-#include "dietstdio.h"
-#include <unistd.h>
-#include "dietwarning.h"
-
-int setvbuf(FILE *stream, char *buf, int flags , size_t size) {
-#ifdef WANT_BUFFERED_STDIO
- switch (flags) {
- case _IONBF: stream->flags = (stream->flags & ~(BUFLINEWISE)) | NOBUF; break;
- case _IOLBF: stream->flags = (stream->flags & ~(BUFLINEWISE|NOBUF)) | BUFLINEWISE; break;
- case _IOFBF: stream->flags = stream->flags & ~(NOBUF | BUFLINEWISE); break;
- default: return -1;
- }
-#endif
- return 0;
-}
-
-link_warning("setvbuf","setvbuf does not implement changing the buffer in diet libc.")
diff --git a/mdk-stage1/dietlibc/libstdio/stderr.c b/mdk-stage1/dietlibc/libstdio/stderr.c
deleted file mode 100644
index a82b1b727..000000000
--- a/mdk-stage1/dietlibc/libstdio/stderr.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <dietstdio.h>
-
-#ifdef WANT_BUFFERED_STDIO
-static FILE __stderr = { 2, NOBUF, 0, 0 };
-
-int __fflush_stderr() {
- return fflush(stderr);
-}
-#else
-static FILE __stderr = { 2, 0 };
-#endif
-
-FILE *stderr=&__stderr;
diff --git a/mdk-stage1/dietlibc/libstdio/stdin.c b/mdk-stage1/dietlibc/libstdio/stdin.c
deleted file mode 100644
index 2db82f9ab..000000000
--- a/mdk-stage1/dietlibc/libstdio/stdin.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <dietstdio.h>
-
-#ifdef WANT_BUFFERED_STDIO
-static FILE __stdin = { 0, BUFINPUT, 0, 0 };
-
-int __fflush_stdin() {
- return fflush(stdin);
-}
-#else
-static FILE __stdin = { 0, 0 };
-#endif
-
-FILE *stdin=&__stdin;
diff --git a/mdk-stage1/dietlibc/libstdio/stdout.c b/mdk-stage1/dietlibc/libstdio/stdout.c
deleted file mode 100644
index 481fb1014..000000000
--- a/mdk-stage1/dietlibc/libstdio/stdout.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <dietstdio.h>
-
-#ifdef WANT_BUFFERED_STDIO
-static FILE __stdout = { 1, BUFLINEWISE, 0, 0 };
-
-int __fflush_stdout() {
- return fflush(stdout);
-}
-#else
-static FILE __stdout = { 1, 0 };
-#endif
-
-FILE *stdout=&__stdout;
-
diff --git a/mdk-stage1/dietlibc/libstdio/ungetc.c b/mdk-stage1/dietlibc/libstdio/ungetc.c
deleted file mode 100644
index ae03e9381..000000000
--- a/mdk-stage1/dietlibc/libstdio/ungetc.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "dietstdio.h"
-
-#ifdef WANT_UNGETC
-int ungetc(int c, FILE *stream) {
- if (stream->ungotten)
- return EOF;
- stream->ungotten=1;
- stream->ungetbuf=(char)(unsigned char)c;
- return c;
-}
-#endif
diff --git a/mdk-stage1/dietlibc/libugly/asctime.c b/mdk-stage1/dietlibc/libugly/asctime.c
deleted file mode 100644
index e1fcc8706..000000000
--- a/mdk-stage1/dietlibc/libugly/asctime.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <time.h>
-
-static char buf[25];
-
-char *asctime(const struct tm *timeptr) {
- return asctime_r(timeptr,buf);
-}
diff --git a/mdk-stage1/dietlibc/libugly/asctime_r.c b/mdk-stage1/dietlibc/libugly/asctime_r.c
deleted file mode 100644
index 46325927c..000000000
--- a/mdk-stage1/dietlibc/libugly/asctime_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <time.h>
-
-static const char days[] = "Sun Mon Tue Wed Thu Fri Sat ";
-static const char months[] = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ";
-
-static void num2str(char *c,int i) {
- c[0]=i/10+'0';
- c[1]=i%10+'0';
-}
-
-char *asctime_r(const struct tm *t, char *buf) {
- /* "Wed Jun 30 21:49:08 1993\n" */
- *(int*)buf=*(int*)(days+(t->tm_wday<<2));
- *(int*)(buf+4)=*(int*)(months+(t->tm_mon<<2));
- num2str(buf+8,t->tm_mday);
- if (buf[8]=='0') buf[8]=' ';
- buf[10]=' ';
- num2str(buf+11,t->tm_hour);
- if (buf[11]=='0') buf[11]=' ';
- buf[13]=':';
- num2str(buf+14,t->tm_min);
- buf[16]=':';
- num2str(buf+17,t->tm_sec);
- buf[19]=' ';
- num2str(buf+20,(t->tm_year+1900)/100);
- num2str(buf+22,(t->tm_year+1900)%100);
- buf[24]='\n';
- return buf;
-}
diff --git a/mdk-stage1/dietlibc/libugly/asprintf.c b/mdk-stage1/dietlibc/libugly/asprintf.c
deleted file mode 100644
index d10c20b4a..000000000
--- a/mdk-stage1/dietlibc/libugly/asprintf.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdarg.h>
-#include <linux/types.h>
-#include <stdlib.h>
-#include "dietwarning.h"
-
-extern int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
-
-int asprintf(char **s, const char *format,...)
-{
- int n;
- va_list arg_ptr;
- va_start(arg_ptr, format);
- n=vsnprintf(0,1000000,format,arg_ptr);
- va_end (arg_ptr);
- va_start (arg_ptr, format);
- if ((*s=malloc(n+2))) {
- n=vsnprintf(*s,n+1,format,arg_ptr);
- va_end(arg_ptr);
- return n;
- }
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libugly/ctime.c b/mdk-stage1/dietlibc/libugly/ctime.c
deleted file mode 100644
index a0e12d673..000000000
--- a/mdk-stage1/dietlibc/libugly/ctime.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <time.h>
-
-char *ctime(const time_t *timep) {
- return asctime(localtime(timep));
-}
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/libugly/endmntent.c b/mdk-stage1/dietlibc/libugly/endmntent.c
deleted file mode 100644
index 00ade38e5..000000000
--- a/mdk-stage1/dietlibc/libugly/endmntent.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdio.h>
-#include <mntent.h>
-
-int endmntent(FILE *filep) {
- return fclose(filep);
-}
-
diff --git a/mdk-stage1/dietlibc/libugly/facilitynames.c b/mdk-stage1/dietlibc/libugly/facilitynames.c
deleted file mode 100644
index 8b0e1f21f..000000000
--- a/mdk-stage1/dietlibc/libugly/facilitynames.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <sys/syslog.h>
-
-#ifndef INTERNAL_MARK
-#define INTERNAL_MARK 0x300
-#endif
-
-CODE facilitynames[] =
- {
- { "auth", LOG_AUTH },
- { "authpriv", LOG_AUTHPRIV },
- { "cron", LOG_CRON },
- { "daemon", LOG_DAEMON },
- { "ftp", LOG_FTP },
- { "kern", LOG_KERN },
- { "lpr", LOG_LPR },
- { "mail", LOG_MAIL },
- { "mark", INTERNAL_MARK }, /* INTERNAL */
- { "news", LOG_NEWS },
- { "security", LOG_AUTH }, /* DEPRECATED */
- { "syslog", LOG_SYSLOG },
- { "user", LOG_USER },
- { "uucp", LOG_UUCP },
- { "local0", LOG_LOCAL0 },
- { "local1", LOG_LOCAL1 },
- { "local2", LOG_LOCAL2 },
- { "local3", LOG_LOCAL3 },
- { "local4", LOG_LOCAL4 },
- { "local5", LOG_LOCAL5 },
- { "local6", LOG_LOCAL6 },
- { "local7", LOG_LOCAL7 },
- { 0, -1 }
- };
diff --git a/mdk-stage1/dietlibc/libugly/getmntent.c b/mdk-stage1/dietlibc/libugly/getmntent.c
deleted file mode 100644
index 250a77b7f..000000000
--- a/mdk-stage1/dietlibc/libugly/getmntent.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <mntent.h>
-#include <string.h>
-
-struct mntent *getmntent(FILE *filep) {
- static struct mntent m;
- char buf[1024];
- do {
- char *tmp=buf;
- int num;
- fgets(buf,1024,filep);
-/* "/dev/ide/host0/bus0/target0/lun0/part2 / reiserfs defaults 1 1" */
- for (num=0; num<6; ++num) {
- switch (num) {
- case 0: m.mnt_fsname=tmp; break;
- case 1: m.mnt_dir=tmp; break;
- case 2: m.mnt_type=tmp; break;
- case 3: m.mnt_opts=tmp; break;
- case 4: m.mnt_freq=strtol(tmp,&tmp,0); if (*tmp!=' ') continue; break;
- case 5: m.mnt_passno=strtol(tmp,&tmp,0); if (*tmp=='\n') return &m; break;
- }
- if ((tmp=strchr(tmp,' '))) {
- if (num<4) *tmp++=0;
- while (*tmp==' ') ++tmp;
- } else
- continue;
- }
- } while (1);
-}
diff --git a/mdk-stage1/dietlibc/libugly/getprotoent.c b/mdk-stage1/dietlibc/libugly/getprotoent.c
deleted file mode 100644
index a648e2307..000000000
--- a/mdk-stage1/dietlibc/libugly/getprotoent.c
+++ /dev/null
@@ -1,130 +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 protofd=-1;
-static char* protomap;
-static unsigned int protolen;
-
-static char* aliases[10];
-
-static char *cur;
-
-/* ip 0 IP # internet protocol, pseudo protocol number */
-struct protoent *getprotoent(void) {
- static struct protoent pe;
- char *last;
- int aliasidx;
- if (protofd<0) {
- protofd=open(_PATH_SERVICES,O_RDONLY);
- if (protofd<0) return 0;
- protolen=lseek(protofd,0,SEEK_END);
- protomap=mmap(0,protolen,PROT_READ|PROT_WRITE,MAP_PRIVATE,protofd,0);
- if ((long)protomap==(-1)) goto error;
- cur=protomap;
- }
- last=protomap+protolen;
-again:
- pe.p_name=0;
- pe.p_aliases=aliases; aliases[0]=0;
- pe.p_proto=0;
- if (cur>=last) return 0;
- if (*cur=='#' || *cur=='\n') goto parseerror;
- /* first, the primary name */
- if (!isalpha(*cur)) goto parseerror;
- pe.p_name=cur;
- pe.p_aliases=aliases;
- while (cur<last && isalnum(*cur)) cur++;
- if (cur>=last) return 0;
- if (*cur=='\n') goto parseerror;
- *cur=0; cur++;
- /* second, the protocol number */
- while (cur<last && isblank(*cur)) cur++;
- while (cur<last && isdigit(*cur)) {
- pe.p_proto=pe.p_proto*10+*cur-'0';
- cur++;
- }
-/* pe.p_proto=htons(pe.s_proto); */
- if (cur>=last) return 0;
- if (*cur=='\n') { *cur++=0; return &pe; }
- *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 &pe;
-parseerror:
- while (cur<last && *cur!='\n') cur++;
- cur++;
- goto again;
-error:
- if (protomap!=(char*)-1) munmap(protomap,protolen);
- if (protofd!=-1) close(protofd);
- protomap=(char*)-1;
- protofd=-1;
- errno=ENOMEM;
- return 0;
-}
-
-void setprotoent(int stayopen) {
- cur=protomap;
-}
-
-struct protoent *getprotobyname(const char *name) {
- struct protoent *s;
- setprotoent(0);
- for (s=getprotoent(); s; s=getprotoent()) {
- char **tmp;
-#if 0
- write(1,"found ",6);
- write(1,s->p_name,strlen(s->p_name));
- write(1,"/",1);
- write(1,s->p_proto,strlen(s->p_proto));
- write(1,"\n",1);
- if (!strcmp(name,"auth")) {
- tmp=s->p_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->p_name))
- return s;
- tmp=s->p_aliases;
- while (*tmp)
- if (!strcmp(name,*tmp++)) return s;
- }
- return 0;
-}
-
-struct protoent *getprotobynumber(int proto) {
- struct protoent *s;
- for (s=getprotoent(); s; s=getprotoent()) {
- if (proto==s->p_proto)
- return s;
- }
- return 0;
-}
-
-void endprotoent(void) {
- if (protomap!=(char*)-1) munmap(protomap,protolen);
- if (protofd!=-1) close(protofd);
- protomap=(char*)-1;
- protofd=-1;
-}
-
diff --git a/mdk-stage1/dietlibc/libugly/gmtime.c b/mdk-stage1/dietlibc/libugly/gmtime.c
deleted file mode 100644
index d33af7972..000000000
--- a/mdk-stage1/dietlibc/libugly/gmtime.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <time.h>
-
-struct tm* gmtime(const time_t *t) {
- static struct tm tmp;
- return gmtime_r(t,&tmp);
-}
diff --git a/mdk-stage1/dietlibc/libugly/gmtime_r.c b/mdk-stage1/dietlibc/libugly/gmtime_r.c
deleted file mode 100644
index c102d10fa..000000000
--- a/mdk-stage1/dietlibc/libugly/gmtime_r.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <time.h>
-
-/* seconds per day */
-#define SPD 24*60*60
-
-extern unsigned int __spm[];
-
-struct tm *gmtime_r(const time_t *timep, struct tm *r) {
- time_t i;
- register time_t work=*timep%(SPD);
- r->tm_sec=work%60; work/=60;
- r->tm_min=work%60; r->tm_hour=work/60;
- work=*timep/(SPD);
- r->tm_wday=(4+work)%7;
- for (i=1970; ; ++i) {
- register time_t k=__isleap(i)?366:365;
- if (work>k)
- work-=k;
- else
- break;
- }
- r->tm_year=i-1900;
- r->tm_yday=work;
-
- r->tm_mday=1;
- if (__isleap(i) && (work>58)) {
- if (work==59) r->tm_mday=2; /* 29.2. */
- work-=1;
- }
-
- for (i=11; i && __spm[i]>work; --i) ;
- r->tm_mon=i;
- r->tm_mday+=work-__spm[i];
- return r;
-}
diff --git a/mdk-stage1/dietlibc/libugly/isleap.c b/mdk-stage1/dietlibc/libugly/isleap.c
deleted file mode 100644
index dcfa1ced6..000000000
--- a/mdk-stage1/dietlibc/libugly/isleap.c
+++ /dev/null
@@ -1,6 +0,0 @@
-int __isleap(int year) {
- /* every fourth year is a leap year except for century years that are
- * not divisible by 400. */
-/* return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); */
- return (!(year%4) && ((year%100) || !(year%400)));
-}
diff --git a/mdk-stage1/dietlibc/libugly/localtime.c b/mdk-stage1/dietlibc/libugly/localtime.c
deleted file mode 100644
index 6fa6acf8a..000000000
--- a/mdk-stage1/dietlibc/libugly/localtime.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <time.h>
-
-struct tm* localtime(const time_t* t) {
- static struct tm tmp;
- return localtime_r(t,&tmp);
-}
diff --git a/mdk-stage1/dietlibc/libugly/localtime_r.c b/mdk-stage1/dietlibc/libugly/localtime_r.c
deleted file mode 100644
index d4bc073ce..000000000
--- a/mdk-stage1/dietlibc/libugly/localtime_r.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "dietfeatures.h"
-#include <time.h>
-#include <sys/time.h>
-
-#ifdef WANT_TZFILE_PARSER
-extern void __maplocaltime();
-extern time_t __tzfile_map(time_t t, int *isdst);
-#endif
-
-struct tm* localtime_r(const time_t* t, struct tm* r) {
- time_t tmp;
-#ifdef WANT_TZFILE_PARSER
- __maplocaltime();
- tmp=__tzfile_map(*t,&r->tm_isdst);
-#else
- struct timezone tz;
- gettimeofday(0, &tz);
- tmp=*t-tz.tz_minuteswest*60L;
-#endif
- return gmtime_r(&tmp,r);
-}
diff --git a/mdk-stage1/dietlibc/libugly/logging.c b/mdk-stage1/dietlibc/libugly/logging.c
deleted file mode 100644
index 69c2c2337..000000000
--- a/mdk-stage1/dietlibc/libugly/logging.c
+++ /dev/null
@@ -1,211 +0,0 @@
-#include "dietfeatures.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <unistd.h>
-#include <asm/socket.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <string.h>
-#include <time.h>
-#include <sys/socket.h>
-#include <signal.h>
-
-#define _PATH_CONSOLE "/dev/console"
-#define BUF_SIZE 512 /* messagebuffer size (>= 200) */
-
-#define MAX_LOGTAG 80
-
-/* those have to be global *sigh* */
-static volatile int connected = 0; /* have done connect */
-static volatile int LogMask = 0xff; /* mask of priorities to be logged */
-static char LogTag[MAX_LOGTAG]; /* string to tag the entry with */
-static int LogFile = -1; /* fd for log */
-static int LogType = SOCK_DGRAM; /* type of socket connection */
-static int LogFacility = LOG_USER; /* default facility code */
-static int LogStat; /* status bits, set by openlog() */
-extern char *__progname; /* Program name, from crt0. */
-static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */
-
-static void closelog_intern(void)
-{
- if (!connected) return;
- close(LogFile);
- LogFile = -1;
- connected = 0;
-}
-
-void closelog(void)
-{
- closelog_intern();
-
- LogTag[0]=0;
- LogType = SOCK_DGRAM;
-}
-
-static void openlog_intern(int option, int facility)
-{
- LogStat = option;
- if (facility && ((facility & ~LOG_FACMASK) == 0))
- LogFacility = facility;
-
- /* yep, there is a continue inside ;) */
- while(1) {
- if (LogFile == -1) {
- SyslogAddr.sa_family = AF_UNIX;
- strncpy(SyslogAddr.sa_data, _PATH_LOG, sizeof(SyslogAddr.sa_data));
- if (LogStat & LOG_NDELAY)
- {
- if ((LogFile = socket(AF_UNIX, LogType, 0)) == -1) return;
- fcntl(LogFile, F_SETFD, 1);
- }
- }
- if ((LogFile != -1) && !connected) {
-#ifdef WANT_THREAD_SAFE
- int old_errno = (*(__errno_location()));
-#else
- int old_errno=errno;
-#endif
- if(connect(LogFile, &SyslogAddr, sizeof(SyslogAddr)) == -1) {
-#ifdef WANT_THREAD_SAFE
- int saved_errno = (*(__errno_location()));
-#else
- int saved_errno=errno;
-#endif
- close(LogFile);
- LogFile = -1;
- if((LogType == SOCK_DGRAM) && (saved_errno == EPROTOTYPE)) {
- /* retry with SOCK_STREAM instead of SOCK_DGRAM */
- LogType = SOCK_STREAM;
-#ifdef WANT_THREAD_SAFE
- (*(__errno_location()))=old_errno;
-#else
- errno=old_errno;
-#endif
- continue;
- }
- }
- else connected = 1;
- }
- break;
- }
-}
-
-/* has to be secured against multiple, simultanious call's in threaded environment */
-void openlog(const char *ident, int option, int facility)
-{
- if (ident) {
- strncpy(LogTag,ident,MAX_LOGTAG);
- LogTag[MAX_LOGTAG-1]=0;
- }
- openlog_intern(option, facility);
-}
-
-int setlogmask(int mask)
-{
- int old = LogMask;
- if (mask) LogMask = mask;
- return old;
-}
-
-void vsyslog(int priority, const char *format, va_list arg_ptr)
-{
- char buffer[BUF_SIZE];
- char time_buf[20];
- int buflen, headerlen;
- time_t now;
- struct tm now_tm;
- pid_t pid;
- int fd;
- int sigpipe;
- struct sigaction action, oldaction;
- struct sigaction *oldaction_ptr = NULL;
-#ifdef WANT_THREAD_SAFE
- int saved_errno = (*(__errno_location()));
-#else
- int saved_errno = errno;
-#endif
-
- /* check for invalid priority/facility bits */
- if (priority & ~(LOG_PRIMASK|LOG_FACMASK)) {
- syslog(LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID, "syslog: unknown facility/priorityority: %x", priority);
- priority &= LOG_PRIMASK|LOG_FACMASK;
- }
-
- /* check priority against setlogmask */
- if ((LOG_MASK(LOG_PRI(priority)) && LogMask) == 0) return;
-
- /* Set default facility if none specified. */
- if ((priority & LOG_FACMASK) == 0) priority |= LogFacility;
-
- pid = getpid();
- time(&now);
- strftime(time_buf, 20, "%h %e %T", localtime_r (&now, &now_tm));
-
- if (LogStat & LOG_PID)
- headerlen = snprintf(buffer, 130, "<%d>%s %s[%d]: ", priority, time_buf, LogTag, pid);
- else
- headerlen = snprintf(buffer, 130, "<%d>%s %s: ", priority, time_buf, LogTag);
-
- if (!LogTag[0]) {
- if ((LogStat & LOG_PID) != LOG_PID)
- headerlen = snprintf(buffer, 130, "<%d>%s (unknown)[%d]: ", priority, time_buf, pid);
- strcat(buffer+headerlen, "syslog without openlog w/ ident, please check code!");
- buflen = 41;
- }
- else {
-#ifdef WANT_THREAD_SAFE
- (*(__errno_location()))=saved_errno;
-#else
- errno=saved_errno;
-#endif
- buflen = vsnprintf(buffer+headerlen, BUF_SIZE - headerlen, format, arg_ptr);
- }
- if (LogStat & LOG_PERROR) {
- write(1, buffer+headerlen, buflen);
- if (buffer[headerlen+buflen] != '\n') write(1,"\n", 1);
- }
-
- /* prepare for broken connection */
- memset(&action, 0, sizeof(action));
- action.sa_handler = SIG_IGN;
- sigemptyset(&action.sa_mask);
-
- if ((sigpipe = sigaction (SIGPIPE, &action, &oldaction))==0)
- oldaction_ptr = &oldaction;
-
- if (!connected) openlog_intern(LogStat | LOG_NDELAY, 0);
-
- /* If we have a SOCK_STREAM connection, also send ASCII NUL as a
- * record terminator. */
- if (LogType == SOCK_STREAM) buflen++;
-
- if (!connected || (send(LogFile, buffer, buflen+headerlen, 0) != buflen+headerlen)) {
- if (LogType == SOCK_STREAM) buflen--;
- closelog_intern();
- /*
- * Output the message to the console; don't worry about blocking,
- * if console blocks everything will. Make sure the error reported
- * is the one from the syslogd failure.
- */
- if ((LogStat & LOG_CONS) &&
- ((fd = open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0))
- {
- write(fd, buffer, buflen+headerlen);
- write(fd, "\r\n", 2);
- }
- }
-
- if (sigpipe == 0)
- sigaction(SIGPIPE, &oldaction, (struct sigaction *) NULL);
-}
-
-void syslog(int priority, const char *format, ...)
-{
- va_list arg_ptr;
- va_start(arg_ptr, format);
- vsyslog(priority, format, arg_ptr);
- va_end(arg_ptr);
-}
diff --git a/mdk-stage1/dietlibc/libugly/mktime.c b/mdk-stage1/dietlibc/libugly/mktime.c
deleted file mode 100644
index ee4dab6c1..000000000
--- a/mdk-stage1/dietlibc/libugly/mktime.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <time.h>
-
-/* seconds per day */
-#define SPD 24*60*60
-
-extern unsigned int __spm[];
-
-time_t mktime(struct tm *t) {
- time_t x=0;
- unsigned int i;
- if (t->tm_year<70) return (time_t)(-1);
- for (i=70; i<t->tm_year; ++i) {
- x+=__isleap(i+1900)?366:365;
- }
- t->tm_yday=__spm[t->tm_mon] + t->tm_mday-1 + ((t->tm_mon>2) && __isleap(t->tm_year)?1:0);
- x+=t->tm_yday;
- /* x is now the number of days since Jan 1 1970 */
- t->tm_wday=(4+x)%7;
- x = x*SPD + t->tm_hour*60*60 + t->tm_min*60 + t->tm_sec;
- return x;
-}
diff --git a/mdk-stage1/dietlibc/libugly/pclose.c b/mdk-stage1/dietlibc/libugly/pclose.c
deleted file mode 100644
index e33076c19..000000000
--- a/mdk-stage1/dietlibc/libugly/pclose.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "dietstdio.h"
-
-int pclose(FILE *f) {
- int status;
- fclose(f);
- if (waitpid(f->popen_kludge,&status,0)>=0)
- return status;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/libugly/popen.c b/mdk-stage1/dietlibc/libugly/popen.c
deleted file mode 100644
index e0e441495..000000000
--- a/mdk-stage1/dietlibc/libugly/popen.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "dietstdio.h"
-#include <unistd.h>
-
-extern char **environ;
-
-FILE *popen(const char *command, const char *type) {
- int pfd[2];
- int fd0;
- pid_t pid;
- if (pipe(pfd)<0) return 0;
- fd0=(*type=='r');
- if ((pid=vfork())<0) {
- close(pfd[0]);
- close(pfd[1]);
- return 0;
- }
- if (!pid) { /* child */
- char *argv[]={"sh","-c",0,0};
- close(pfd[!fd0]); close(fd0);
- dup2(pfd[fd0],fd0); close(pfd[fd0]);
- argv[2]=(char*)command;
- execve("/bin/sh",argv,environ);
- _exit(255);
- }
- close(pfd[fd0]);
- {
- register FILE* f;
- if ((f=fdopen(pfd[!fd0],type)))
- f->popen_kludge=pid;
- return f;
- }
-}
diff --git a/mdk-stage1/dietlibc/libugly/prioritynames.c b/mdk-stage1/dietlibc/libugly/prioritynames.c
deleted file mode 100644
index 87a99b76d..000000000
--- a/mdk-stage1/dietlibc/libugly/prioritynames.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <sys/syslog.h>
-
-#ifndef INTERNAL_NOPRI
-#define INTERNAL_NOPRI 0x10
-#endif
-
-CODE prioritynames[] =
- {
- { "alert", LOG_ALERT },
- { "crit", LOG_CRIT },
- { "debug", LOG_DEBUG },
- { "emerg", LOG_EMERG },
- { "err", LOG_ERR },
- { "error", LOG_ERR }, /* DEPRECATED */
- { "info", LOG_INFO },
- { "none", INTERNAL_NOPRI }, /* INTERNAL */
- { "notice", LOG_NOTICE },
- { "panic", LOG_EMERG }, /* DEPRECATED */
- { "warn", LOG_WARNING }, /* DEPRECATED */
- { "warning", LOG_WARNING },
- { 0, -1 }
- };
diff --git a/mdk-stage1/dietlibc/libugly/setenv.c b/mdk-stage1/dietlibc/libugly/setenv.c
deleted file mode 100644
index bf47cdb79..000000000
--- a/mdk-stage1/dietlibc/libugly/setenv.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-
-#include <dietwarning.h>
-link_warning("setenv","setenv calls malloc. Avoid it in small programs.");
-
-int setenv(const char *name, const char *value, int overwrite) {
- char *c=malloc(strlen(name)+strlen(value)+3);
- if (getenv(name)) {
- if (!overwrite) return 0;
- unsetenv(name);
- }
- strcpy(c,name);
- strcat(c,"=");
- strcat(c,value);
- return putenv(c);
-}
diff --git a/mdk-stage1/dietlibc/libugly/setmntent.c b/mdk-stage1/dietlibc/libugly/setmntent.c
deleted file mode 100644
index a91d3902b..000000000
--- a/mdk-stage1/dietlibc/libugly/setmntent.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdio.h>
-#include <mntent.h>
-
-FILE *setmntent(const char *filename, const char *type) {
- return fopen(filename,type);
-}
-
diff --git a/mdk-stage1/dietlibc/libugly/strftime.c b/mdk-stage1/dietlibc/libugly/strftime.c
deleted file mode 100644
index b7e750ab1..000000000
--- a/mdk-stage1/dietlibc/libugly/strftime.c
+++ /dev/null
@@ -1,182 +0,0 @@
-#include <sys/types.h>
-#include <time.h>
-
-static char *sweekdays[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
-static char *weekdays[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
-static char *smonths[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
-static char *months[]={"January","February","March","April","May","June","July","August","September","October","November","December"};
-static char *ampm[]={"am","pm","AM","PM"};
-
-static int i2a(char* dest,unsigned int x) {
- register unsigned int tmp=x;
- register int len=0;
- *dest++=tmp/10+'0'; tmp=tmp%10; ++len;
- *dest++=tmp+'0';
- return 2;
-}
-
-static int i2as(char* dest,unsigned int x) {
- int len=i2a(dest,x);
- if (*dest=='0') *dest=' ';
- return len;
-}
-
-size_t strftime(char *s, size_t max, const char *format, const struct tm *tm) {
- char *t=s;
- const char *src;
- char buf[5];
- while (*format) {
- switch (*format) {
- case 0: break;
- case '%':
- switch (*++format) {
- case '%': *t='%'; ++t; break;
- case 'a': src=sweekdays[tm->tm_wday]; goto append;
- case 'A': src=weekdays[tm->tm_wday]; goto append;
- case 'h':
- case 'b': src=smonths[tm->tm_mon]; goto append;
- case 'B': src=months[tm->tm_mon]; goto append;
- case 'c': t+=strftime(t,max-(t-s),"%b %a %d %k:%M:%S %Z %Y",tm); break;
- case 'C': buf[i2a(buf,(tm->tm_year+1900)/100)]=0; src=buf; goto append;
- case 'd': buf[i2a(buf,tm->tm_mday)]=0; src=buf; goto append;
- case 'e': buf[i2as(buf,tm->tm_mday)]=0; src=buf; goto append;
- case 'H': buf[i2a(buf,tm->tm_hour)]=0; src=buf; goto append;
- case 'I': buf[i2a(buf,tm->tm_hour%12)]=0; src=buf; goto append;
- case 'j': buf[i2a(buf,tm->tm_yday)]=0; src=buf; goto append;
- case 'k': buf[i2as(buf,tm->tm_hour)]=0; src=buf; goto append;
- case 'l': buf[i2as(buf,tm->tm_hour%12)]=0; src=buf; goto append;
- case 'm': buf[i2a(buf,tm->tm_mon+1)]=0; src=buf; goto append;
- case 'M': buf[i2a(buf,tm->tm_min)]=0; src=buf; goto append;
- case 'n': *t='\n'; break;
- case 'p': src=ampm[tm->tm_hour>11?3:2]; goto append;
- case 'P': src=ampm[tm->tm_hour>11?1:0]; goto append;
- case 'r': t+=strftime(t,max-(t-s),"%I:%M:%S %p",tm); break;
- case 'R': t+=strftime(t,max-(t-s),"%H:%M",tm); break;
- case 'S': buf[i2a(buf,tm->tm_sec)]=0; src=buf; goto append;
- case 't': *t='\t'; break;
- case 'T': t+=strftime(t,max-(t-s),"%H:%M:%S",tm); break;
- case 'u': buf[i2a(buf,tm->tm_wday?tm->tm_wday:7)]=0; src=buf; goto append;
- case 'w': buf[i2a(buf,tm->tm_wday)]=0; src=buf; goto append;
- case 'x': t+=strftime(t,max-(t-s),"%b %a %d",tm); break;
- case 'X': t+=strftime(t,max-(t-s),"%k:%M:%S",tm); break;
- case 'y': buf[i2a(buf,tm->tm_year%100)]=0; src=buf; goto append;
- case 'Y': i2a(buf,(tm->tm_year+1900)/100); buf[i2a(buf+2,(tm->tm_year%100))+2]=0; src=buf; goto append;
- case 'Z': src="GMT"; goto append; /* hehe */
-append:
- while (*src && t<s+max) { *t=*src; ++t; ++src; }
- };
- break;
- default:
- *t=*format; ++t;
- }
- ++format;
- if (t>=s+max) break;
- continue;
- }
- *t=0; return t-s;
-}
-
-
-
-/*
- %u The day of the week as a decimal, range 1 to 7,
- Monday being 1. See also %w. (SU)
-
- %U The week number of the current year as a decimal
- number, range 00 to 53, starting with the first
- Sunday as the first day of week 01. See also %V and
- %W.
-
- %V The ISO 8601:1988 week number of the current year
- as a decimal number, range 01 to 53, where week 1
- is the first week that has at least 4 days in the
- current year, and with Monday as the first day of
- the week. See also %U and %W. (SU)
-
- %w The day of the week as a decimal, range 0 to 6,
- Sunday being 0. See also %u.
-
- %W The week number of the current year as a decimal
- number, range 00 to 53, starting with the first
- Monday as the first day of week 01.
-
- %x The preferred date representation for the current
- locale without the time.
-
- %X The preferred time representation for the current
- locale without the date.
-
- %y The year as a decimal number without a century
- (range 00 to 99).
-
- %Y The year as a decimal number including the century.
-
- %z The time-zone as hour offset from GMT. Required to
- emit RFC822-conformant dates (using "%a, %d %b %Y
- %H:%M:%S %z"). (GNU)
-
- %Z The time zone or name or abbreviation.
-
- %+ The date and time in date(1) format. (TZ)
-
- %% A literal `%' character.
-
- Some conversion specifiers can be modified by preceding
- them by the E or O modifier to indicate that an alterna­
- tive format should be used. If the alternative format or
- specification does not exist for the current locale, the
- behaviour will be as if the unmodified conversion specifi­
- cation were used. (SU) The Single Unix Specification men­
- tions %Ec, %EC, %Ex, %EX, %Ry, %EY, %Od, %Oe, %OH, %OI,
- %Om, %OM, %OS, %Ou, %OU, %OV, %Ow, %OW, %Oy, where the
- effect of the O modifier is to use alternative numeric
- symbols (say, roman numerals), and that of the E modifier
-
-
-
-GNU 29 March 1999 3
-
-
-
-
-
-STRFTIME(3) Linux Programmer's Manual STRFTIME(3)
-
-
- is to use a locale-dependent alternative representation.
-
- The broken-down time structure tm is defined in <time.h>.
- See also ctime(3).
-
-
-RETURN VALUE
- The strftime() function returns the number of characters
- placed in the array s, not including the terminating NUL
- character, provided the string, including the terminating
- NUL, fits. Otherwise, it returns 0, and the contents of
- the array is undefined. (Thus at least since libc 4.4.4;
- very old versions of libc, such as libc 4.4.1, would
- return max if the array was too small.)
-
- Note that the return value 0 does not necessarily indicate
- an error; for example, in many locales %p yields an empty
- string.
-
-ENVIRONMENT
- The environment variables TZ and LC_TIME are used.
-
-CONFORMING TO
- ANSI C, SVID 3, ISO 9899. There are strict inclusions
- between the set of conversions given in ANSI C (unmarked),
- those given in the Single Unix Specification (marked SU),
- those given in Olson's timezone package (marked TZ), and
- those given in glibc (marked GNU), except that %+ is not
- supported in glibc2. On the other hand glibc2 has several
- more extensions. POSIX.1 only refers to ANSI C; POSIX.2
- describes under date(1) several extensions that could
- apply to strftime as well.
-
-SEE ALSO
- date(1), time(2), ctime(3), setlocale(3), sprintf(3)
-
-*/
diff --git a/mdk-stage1/dietlibc/libugly/strsignal.c b/mdk-stage1/dietlibc/libugly/strsignal.c
deleted file mode 100644
index 54314d2c7..000000000
--- a/mdk-stage1/dietlibc/libugly/strsignal.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <signal.h>
-/* F....ng Kernel haeder is damn broken... */
-#ifndef _NSIG
-#define _NSIG 64
-#endif
-#include <asm/signal.h>
-
-char * strsignal(int sig) {
- if (sig==SIGHUP)
- return "Hangup";
- else if (sig==SIGINT)
- return "Interrupt";
- else if (sig==SIGQUIT)
- return "Quit";
- else if (sig==SIGILL)
- return "Illegal instruction";
- else if (sig==SIGTRAP)
- return "Trace/breakpoint trap";
- else if (sig==SIGABRT)
- return "Aborted";
- else if (sig==SIGFPE)
- return "Floating point exception";
- else if (sig==SIGKILL)
- return "Killed";
- else if (sig==SIGBUS)
- return "Bus error";
- else if (sig==SIGSEGV)
- return "Segmentation fault";
- else if (sig==SIGPIPE)
- return "Broken pipe";
- else if (sig==SIGALRM)
- return "Alarm clock";
- else if (sig==SIGTERM)
- return "Terminated";
- else if (sig==SIGURG)
- return "Urgent I/O condition";
- else if (sig==SIGSTOP)
- return "Stopped (signal)";
- else if (sig==SIGTSTP)
- return "Stopped";
- else if (sig==SIGCONT)
- return "Continue";
- else if (sig==SIGCHLD)
- return "Child exited";
- else if (sig==SIGTTIN)
- return "Stopped (tty input)";
- else if (sig==SIGTTOU)
- return "Stopped (tty output)";
- else if (sig==SIGIO)
- return "I/O possible";
- else if (sig==SIGXCPU)
- return "CPU time limit exceeded";
- else if (sig==SIGXFSZ)
- return "File size limit exceeded";
- else if (sig==SIGVTALRM)
- return "Virtual timer expired";
- else if (sig==SIGPROF)
- return "Profiling timer expired";
- else if (sig==SIGWINCH)
- return "Window changed";
- else if (sig==SIGUSR1)
- return "User defined signal 1";
- else if (sig==SIGUSR2)
- return "User defined signal 1";
-#ifdef SIGEMT
- else if (sig==SIGEMT)
- return "EMT trap";
-#endif
-#ifdef SIGSYS
- else if (sig==SIGSYS)
- return "Bad system call";
-#endif
-#ifdef SIGSTKFLT
- else if (sig==SIGSTKFLT)
- return "Stack fault";
-#endif
-#ifdef SIGINFO
- else if (sig==SIGINFO)
- return "Information request";
-#elif defined(SIGPWR) && (!defined(SIGLOST) || (SIGPWR!=SIGLOST))
- else if (sig==SIGPWR)
- return "Power falure";
-#endif
-#ifdef SIGLOST
- else if (sig==SIGLOST)
- return "Resource lost";
-#endif
- else if ((sig>=SIGRTMIN)&&(sig<=SIGRTMAX))
- return "Real time signal";
- else
- return "(unknown signal)";
-}
diff --git a/mdk-stage1/dietlibc/libugly/system.c b/mdk-stage1/dietlibc/libugly/system.c
deleted file mode 100644
index b9eea20eb..000000000
--- a/mdk-stage1/dietlibc/libugly/system.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <signal.h>
-#include <asm/errno.h>
-#include <errno.h>
-#include <unistd.h>
-#include "dietwarning.h"
-
-#define SHELL_PATH "/bin/sh" /* Path of the shell. */
-#define SHELL_NAME "sh" /* Name to give it. */
-
-extern char **environ;
-
-int __libc_fork();
-int __libc_waitpid(int pid, int *status, int options);
-int execve(const char*filename, char *const argv[], char *const envp[]);
-void __set_errno(int errno);
-int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
-
-int __libc_system (const char *line)
-{
- struct sigaction sa, intr, quit;
- int save,pid,ret=-1;
-
- if (line == 0) return __libc_system("exit 0") == 0;
-
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset (&sa.sa_mask);
-
- if (sigaction(SIGINT, &sa, &intr)<0) return -1;
- if (sigaction(SIGQUIT, &sa, &quit)<0) {
- save = errno;
- sigaction (SIGINT, &intr, (struct sigaction*)0);
- __set_errno (save);
- return -1;
- }
-
- pid=__libc_fork();
- if (pid>0)
- { /* parent */
- int n;
- do
- n=__libc_waitpid(pid, &ret, 0);
- while ((n==-1) && (errno==EINTR));
- if (n!=pid) ret=-1;
- }
- else if (!pid)
- { /* child */
- const char *nargs[4];
- nargs[0] = SHELL_NAME;
- nargs[1] = "-c";
- nargs[2] = line;
- nargs[3] = 0;
-
- sigaction(SIGINT, &intr, (struct sigaction*)0);
- sigaction(SIGQUIT, &quit, (struct sigaction*)0);
-
- execve(SHELL_PATH,(char *const *)nargs, environ);
- _exit(127);
- }
- save = errno;
- sigaction (SIGINT, &intr, (struct sigaction *)0);
- sigaction (SIGQUIT, &quit, (struct sigaction *)0);
- __set_errno(save);
- return ret;
-}
-
-int system (const char *line) __attribute__((weak,alias("__libc_system")));
-
-link_warning("system","warning: system() is a security risk. Use fork and execvp instead!")
diff --git a/mdk-stage1/dietlibc/libugly/time_table_spd.c b/mdk-stage1/dietlibc/libugly/time_table_spd.c
deleted file mode 100644
index bfe1cf86d..000000000
--- a/mdk-stage1/dietlibc/libugly/time_table_spd.c
+++ /dev/null
@@ -1,17 +0,0 @@
-
-/* seconds per month -- nonleap! */
-const unsigned int __spm[12] =
- { 0,
- (31),
- (31+28),
- (31+28+31),
- (31+28+31+30),
- (31+28+31+30+31),
- (31+28+31+30+31+30),
- (31+28+31+30+31+30+31),
- (31+28+31+30+31+30+31+31),
- (31+28+31+30+31+30+31+31+30),
- (31+28+31+30+31+30+31+31+30+31),
- (31+28+31+30+31+30+31+31+30+31+30),
- };
-
diff --git a/mdk-stage1/dietlibc/libugly/tzfile.c b/mdk-stage1/dietlibc/libugly/tzfile.c
deleted file mode 100644
index 5702d4bea..000000000
--- a/mdk-stage1/dietlibc/libugly/tzfile.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "dietfeatures.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <netinet/in.h>
-
-#include <stdio.h>
-
-#ifdef WANT_TZFILE_PARSER
-static char *tzfile=0;
-static int tzlen=-1;
-
-void __maplocaltime() {
- int fd;
- unsigned int len;
- if (tzlen>=0) return;
- tzlen=0;
- if ((fd=open("/etc/localtime",O_RDONLY))<0) return;
- len=lseek(fd,0,SEEK_END);
- if ((tzfile=mmap(0,len,PROT_READ,MAP_SHARED,fd,0))==MAP_FAILED) return;
- close(fd);
- if (ntohl(*(int*)tzfile) != 0x545a6966) return;
- tzlen=len;
-}
-
-char *tzset(void) __attribute__((weak,alias("__maplocaltime")));
-
-static unsigned long __myntohl(const unsigned char* c) {
- return (((unsigned long)c[0])<<24) +
- (((unsigned long)c[1])<<16) +
- (((unsigned long)c[2])<<8) +
- ((unsigned long)c[3]);
-}
-
-time_t __tzfile_map(time_t t, int *isdst) {
- /* "TZif" plus 16 reserved bytes. */
- char *tmp;
- int i;
- int tzh_ttisgmtcnt, tzh_ttisstdcnt, tzh_leapcnt, tzh_timecnt, tzh_typecnt, tzh_charcnt;
- *isdst=0;
- if (!tzfile) return t;
- tzh_ttisgmtcnt=ntohl(*(int*)(tzfile+20));
- tzh_ttisstdcnt=ntohl(*(int*)(tzfile+24));
- tzh_leapcnt=ntohl(*(int*)(tzfile+28));
- tzh_timecnt=ntohl(*(int*)(tzfile+32));
- tzh_typecnt=ntohl(*(int*)(tzfile+36));
- tzh_charcnt=ntohl(*(int*)(tzfile+40));
-
-#if 0
- tmp=tzfile+20+6*4;
- printf("ttisgmtcnt %d ttisstdcnt %d leapcnt %d timecnt %d typecnt %d charcnt %d\n",tzh_ttisgmtcnt,tzh_ttisstdcnt, tzh_leapcnt, tzh_timecnt, tzh_typecnt, tzh_charcnt);
- printf("transition times: ");
- for (i=0; i<tzh_timecnt; ++i) {
- printf("%s%lu",i?", ":"",ntohl(*(int*)tmp)); tmp+=4;
- }
- printf("\n");
- printf("indices: ");
- for (i=0; i<tzh_timecnt; ++i) {
- printf("%s%d",i?", ":"",*tmp); ++tmp;
- }
- printf("\n");
- printf("transition times: ");
- for (i=0; i<tzh_typecnt; ++i) {
- printf("%s(%lu,%d,%d)",i?", ":"",ntohl(*(int*)tmp),tmp[4],tmp[5]); tmp+=6;
- }
- printf("\n");
-#endif
-
- tmp=tzfile+20+6*4;
- for (i=0; i<tzh_timecnt; ++i)
- if ((time_t)__myntohl(tmp+i*4) >= t) {
-/* printf("match at %d\n",i); */
- tmp+=tzh_timecnt*4;
- i=tmp[i-1];
-/* printf("using index %d\n",i); */
- tmp+=tzh_timecnt;
- tmp+=i*6;
-/* printf("(%lu,%d,%d)\n",ntohl(*(int*)tmp),tmp[4],tmp[5]); */
- *isdst=tmp[4];
- return t+__myntohl(tmp);
- }
- return t;
-}
-#else
-void tzset(void) __attribute__((weak,alias("return0")));
-#endif
diff --git a/mdk-stage1/dietlibc/libugly/unsetenv.c b/mdk-stage1/dietlibc/libugly/unsetenv.c
deleted file mode 100644
index 46e880271..000000000
--- a/mdk-stage1/dietlibc/libugly/unsetenv.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdlib.h>
-
-void unsetenv(const char *name) {
- putenv(name);
-}
-
diff --git a/mdk-stage1/dietlibc/ppc/Makefile.add b/mdk-stage1/dietlibc/ppc/Makefile.add
deleted file mode 100644
index 641cf1ade..000000000
--- a/mdk-stage1/dietlibc/ppc/Makefile.add
+++ /dev/null
@@ -1,3 +0,0 @@
-
-CFLAGS+=-mpowerpc-gpopt -mpowerpc-gfxopt -Os
-VPATH:=ppc:syscalls.s:$(VPATH)
diff --git a/mdk-stage1/dietlibc/ppc/__longjmp.S b/mdk-stage1/dietlibc/ppc/__longjmp.S
deleted file mode 100644
index 8113eeeea..000000000
--- a/mdk-stage1/dietlibc/ppc/__longjmp.S
+++ /dev/null
@@ -1,59 +0,0 @@
-#include <setjmp.h>
-
-
-#ifdef PIC
-#define JUMPTARGET(name) name##@plt
-#else
-#define JUMPTARGET(name) name
-#endif
-
-.global __longjmp
-.type __longjmp,@function
-.align 2
-__longjmp:
- lwz 1,(JB_GPR1*4)(3)
- lwz 2,(JB_GPR2*4)(3)
- lwz 0,(JB_LR*4)(3)
- lwz 14,((JB_GPRS+0)*4)(3)
- lfd 14,((JB_FPRS+0*2)*4)(3)
- lwz 15,((JB_GPRS+1)*4)(3)
- lfd 15,((JB_FPRS+1*2)*4)(3)
- lwz 16,((JB_GPRS+2)*4)(3)
- lfd 16,((JB_FPRS+2*2)*4)(3)
- lwz 17,((JB_GPRS+3)*4)(3)
- lfd 17,((JB_FPRS+3*2)*4)(3)
- lwz 18,((JB_GPRS+4)*4)(3)
- lfd 18,((JB_FPRS+4*2)*4)(3)
- lwz 19,((JB_GPRS+5)*4)(3)
- lfd 19,((JB_FPRS+5*2)*4)(3)
- lwz 20,((JB_GPRS+6)*4)(3)
- lfd 20,((JB_FPRS+6*2)*4)(3)
- mtlr 0
- lwz 21,((JB_GPRS+7)*4)(3)
- lfd 21,((JB_FPRS+7*2)*4)(3)
- lwz 22,((JB_GPRS+8)*4)(3)
- lfd 22,((JB_FPRS+8*2)*4)(3)
- lwz 0,(JB_CR*4)(3)
- lwz 23,((JB_GPRS+9)*4)(3)
- lfd 23,((JB_FPRS+9*2)*4)(3)
- lwz 24,((JB_GPRS+10)*4)(3)
- lfd 24,((JB_FPRS+10*2)*4)(3)
- lwz 25,((JB_GPRS+11)*4)(3)
- lfd 25,((JB_FPRS+11*2)*4)(3)
- mtcrf 0xFF,0
- lwz 26,((JB_GPRS+12)*4)(3)
- lfd 26,((JB_FPRS+12*2)*4)(3)
- lwz 27,((JB_GPRS+13)*4)(3)
- lfd 27,((JB_FPRS+13*2)*4)(3)
- lwz 28,((JB_GPRS+14)*4)(3)
- lfd 28,((JB_FPRS+14*2)*4)(3)
- lwz 29,((JB_GPRS+15)*4)(3)
- lfd 29,((JB_FPRS+15*2)*4)(3)
- lwz 30,((JB_GPRS+16)*4)(3)
- lfd 30,((JB_FPRS+16*2)*4)(3)
- lwz 31,((JB_GPRS+17)*4)(3)
- lfd 31,((JB_FPRS+17*2)*4)(3)
- mr 3,4
- blr
-.size __longjmp,.-__longjmp
-
diff --git a/mdk-stage1/dietlibc/ppc/__testandset.S b/mdk-stage1/dietlibc/ppc/__testandset.S
deleted file mode 100644
index a6063fbb2..000000000
--- a/mdk-stage1/dietlibc/ppc/__testandset.S
+++ /dev/null
@@ -1,11 +0,0 @@
-.global __testandset
-.type __testandset,@function
-.align 2
-__testandset:
- lwarx 5,0,3
- add 0,4,5
- stwcx 0,0,3
- bne __testandset
- blr
-.size __testandset,.-__testandset
-
diff --git a/mdk-stage1/dietlibc/ppc/mmap.c b/mdk-stage1/dietlibc/ppc/mmap.c
deleted file mode 100644
index 25d2926b2..000000000
--- a/mdk-stage1/dietlibc/ppc/mmap.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <linux/types.h>
-#include <linux/unistd.h>
-
-int mmap(void*start,size_t length,int prot,int flags,int fd,off_t offset) {
- unsigned long __sc_ret, __sc_err;
- {
- register unsigned long __sc_0 __asm__ ("r0");
- register unsigned long __sc_3 __asm__ ("r3");
- register unsigned long __sc_4 __asm__ ("r4");
- register unsigned long __sc_5 __asm__ ("r5");
- register unsigned long __sc_6 __asm__ ("r6");
- register unsigned long __sc_7 __asm__ ("r7");
- register unsigned long __sc_8 __asm__ ("r8");
-
- __sc_3 = (unsigned long) (start);
- __sc_4 = (unsigned long) (length);
- __sc_5 = (unsigned long) (prot);
- __sc_6 = (unsigned long) (flags);
- __sc_7 = (unsigned long) (fd);
- __sc_8 = (unsigned long) (offset);
- __sc_0 = __NR_mmap;
- __asm__ __volatile__
- ("sc \n\t"
- "mfcr %1 "
- : "=&r" (__sc_3), "=&r" (__sc_0)
- : "0" (__sc_3), "1" (__sc_0),
- "r" (__sc_4),
- "r" (__sc_5),
- "r" (__sc_6),
- "r" (__sc_7),
- "r" (__sc_8)
- : __syscall_clobbers);
- __sc_ret = __sc_3;
- __sc_err = __sc_0;
- }
- __syscall_return (int);
-}
diff --git a/mdk-stage1/dietlibc/ppc/setjmp.S b/mdk-stage1/dietlibc/ppc/setjmp.S
deleted file mode 100644
index 50fa2bdd4..000000000
--- a/mdk-stage1/dietlibc/ppc/setjmp.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <setjmp.h>
-
-#ifdef PIC
-#define JUMPTARGET(name) name##@plt
-#else
-#define JUMPTARGET(name) name
-#endif
-
-.global __sigsetjmp
-.type __sigsetjmp,@function
-.align 2
-__sigsetjmp:
- stw 1,(JB_GPR1*4)(3)
- mflr 0
- stw 2,(JB_GPR2*4)(3)
- stw 14,((JB_GPRS+0)*4)(3)
- stfd 14,((JB_FPRS+0*2)*4)(3)
- stw 0,(JB_LR*4)(3)
- stw 15,((JB_GPRS+1)*4)(3)
- stfd 15,((JB_FPRS+1*2)*4)(3)
- mfcr 0
- stw 16,((JB_GPRS+2)*4)(3)
- stfd 16,((JB_FPRS+2*2)*4)(3)
- stw 0,(JB_CR*4)(3)
- stw 17,((JB_GPRS+3)*4)(3)
- stfd 17,((JB_FPRS+3*2)*4)(3)
- stw 18,((JB_GPRS+4)*4)(3)
- stfd 18,((JB_FPRS+4*2)*4)(3)
- stw 19,((JB_GPRS+5)*4)(3)
- stfd 19,((JB_FPRS+5*2)*4)(3)
- stw 20,((JB_GPRS+6)*4)(3)
- stfd 20,((JB_FPRS+6*2)*4)(3)
- stw 21,((JB_GPRS+7)*4)(3)
- stfd 21,((JB_FPRS+7*2)*4)(3)
- stw 22,((JB_GPRS+8)*4)(3)
- stfd 22,((JB_FPRS+8*2)*4)(3)
- stw 23,((JB_GPRS+9)*4)(3)
- stfd 23,((JB_FPRS+9*2)*4)(3)
- stw 24,((JB_GPRS+10)*4)(3)
- stfd 24,((JB_FPRS+10*2)*4)(3)
- stw 25,((JB_GPRS+11)*4)(3)
- stfd 25,((JB_FPRS+11*2)*4)(3)
- stw 26,((JB_GPRS+12)*4)(3)
- stfd 26,((JB_FPRS+12*2)*4)(3)
- stw 27,((JB_GPRS+13)*4)(3)
- stfd 27,((JB_FPRS+13*2)*4)(3)
- stw 28,((JB_GPRS+14)*4)(3)
- stfd 28,((JB_FPRS+14*2)*4)(3)
- stw 29,((JB_GPRS+15)*4)(3)
- stfd 29,((JB_FPRS+15*2)*4)(3)
- stw 30,((JB_GPRS+16)*4)(3)
- stfd 30,((JB_FPRS+16*2)*4)(3)
- stw 31,((JB_GPRS+17)*4)(3)
- stfd 31,((JB_FPRS+17*2)*4)(3)
- b JUMPTARGET (__sigjmp_save)
-.size __sigsetjmp,.-__sigsetjmp
diff --git a/mdk-stage1/dietlibc/ppc/start.S b/mdk-stage1/dietlibc/ppc/start.S
deleted file mode 100644
index c7afeecd2..000000000
--- a/mdk-stage1/dietlibc/ppc/start.S
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "start.h"
-
-#ifdef __powerpc__
-
-.text
-.global _start
-.type _start,@function
-_start:
- /* Save the stack pointer, in case we're statically linked under Linux. */
- mr 9,1
- /* Set up an initial stack frame, and clear the LR. */
- clrrwi 1,1,4
- li 0,0
- stwu 1,-16(1)
- mtlr 0
- stw 0,0(1)
-
- /* r9 enthält den initialen Stackpointer.
- argc = (r9)
- argv = (r9+4)
- envp = argv+(argc+1)*4 */
-
- lwzu 3,0(9) /* argc */
- addi 4,9,4 /* argv */
- add 5,0,3 /* argc... */
- addi 5,5,1 /* argc+1...*/
- slwi 5,5,2 /* (argc+1)*4 */
- add 5,5,4 /* argv+(argc+1)*4 */
-
- lis 6,environ@ha
- stw 5,environ@l(6)
-
- bl main
- b exit
-.size _start,.-_start
-
-
-/* Define a symbol for the first piece of initialized data. */
- .section ".data"
-__data_start:
-
-
-#endif
-
diff --git a/mdk-stage1/dietlibc/ppc/unified.S b/mdk-stage1/dietlibc/ppc/unified.S
deleted file mode 100644
index d2b419f0b..000000000
--- a/mdk-stage1/dietlibc/ppc/unified.S
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <dietfeatures.h>
-
-.text
-.global __unified_syscall
-__unified_syscall:
- sc
- mfcr 0
- andis. 9,0,4096
- mr 0,3
- beq .L1
-#ifdef WANT_THREAD_SAVE
- bl __set_errno
-#else
- lis 9,errno@ha
- stw 3,errno@l(9)
-#endif
- li 0,-1
-.L1:
- mr 3,0
- blr
-
diff --git a/mdk-stage1/dietlibc/sparc/Makefile.add b/mdk-stage1/dietlibc/sparc/Makefile.add
deleted file mode 100644
index 0de05b1db..000000000
--- a/mdk-stage1/dietlibc/sparc/Makefile.add
+++ /dev/null
@@ -1,3 +0,0 @@
-
-CFLAGS+=-mcpu=supersparc -Os
-VPATH:=sparc:syscalls.s:$(VPATH)
diff --git a/mdk-stage1/dietlibc/sparc/__longjmp.S b/mdk-stage1/dietlibc/sparc/__longjmp.S
deleted file mode 100644
index 72e001a2f..000000000
--- a/mdk-stage1/dietlibc/sparc/__longjmp.S
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <setjmp.h>
-
-#define JB_SP 0
-#define JB_FP 1
-#define JB_PC 2
-
-#define ENV(base,reg) [%base + (reg * 4)]
-#define ST_FLUSH_WINDOWS 3
-#define RW_FP [%fp + 0x48]
-
-.text
-.global __longjmp
-__longjmp:
- /* Store our arguments in global registers so we can still
- use them while unwinding frames and their register windows. */
-
- ld ENV(o0,JB_FP), %g3 /* Cache target FP in register %g3. */
- mov %o0, %g1 /* ENV in %g1 */
- orcc %o1, %g0, %g2 /* VAL in %g2 */
- be,a 0f /* Branch if zero; else skip delay slot. */
- mov 1, %g2 /* Delay slot only hit if zero: VAL = 1. */
-0:
- xor %fp, %g3, %o0
- add %fp, 512, %o1
- andncc %o0, 4095, %o0
- bne .Lthread
- cmp %o1, %g3
- bl .Lthread
-
- /* Now we will loop, unwinding the register windows up the stack
- until the restored %fp value matches the target value in %g3. */
-
-.Lloop:
- cmp %fp, %g3 /* Have we reached the target frame? */
- bl,a .Lloop /* Loop while current fp is below target. */
- restore /* Unwind register window in delay slot. */
- be,a .Lfound /* Better have hit it exactly. */
- ld ENV(g1,JB_SP), %o0 /* Delay slot: extract target SP. */
-
-.Lthread:
- /*
- * Do a "flush register windows trap". The trap handler in the
- * kernel writes all the register windows to their stack slots, and
- * marks them all as invalid (needing to be sucked up from the
- * stack when used). This ensures that all information needed to
- * unwind to these callers is in memory, not in the register
- * windows.
- */
- ta ST_FLUSH_WINDOWS
- ld ENV(g1,JB_PC), %o7 /* Set return PC. */
- ld ENV(g1,JB_SP), %fp /* Set saved SP on restore below. */
- sub %fp, 64, %sp /* Allocate a register frame. */
- st %g3, RW_FP /* Set saved FP on restore below. */
- retl
- restore %g2, 0, %o0 /* Restore values from above register frame. */
-
-.Lfound:
- /* We have unwound register windows so %fp matches the target. */
- mov %o0, %sp /* OK, install new SP. */
-
-.Lsp_ok:
- ld ENV(g1,JB_PC), %o0 /* Extract target return PC. */
- jmp %o0 + 8 /* Return there. */
- mov %g2, %o0 /* Delay slot: set return value. */
-
-.size __longjmp, . - __longjmp
-
diff --git a/mdk-stage1/dietlibc/sparc/__testandset.S b/mdk-stage1/dietlibc/sparc/__testandset.S
deleted file mode 100644
index 84f6cf597..000000000
--- a/mdk-stage1/dietlibc/sparc/__testandset.S
+++ /dev/null
@@ -1,6 +0,0 @@
-.text
-.align 4
-.global __testandset
-__testandset:
- retl
- ldstub [%o0], %o0
diff --git a/mdk-stage1/dietlibc/sparc/clone.S b/mdk-stage1/dietlibc/sparc/clone.S
deleted file mode 100644
index 58b438249..000000000
--- a/mdk-stage1/dietlibc/sparc/clone.S
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <asm/errno.h>
-#include <asm/unistd.h>
-
-.text
-.align 4
-.weak clone
-clone:
-.global __clone
-__clone:
- save %sp, -96, %sp
-
- tst %i0 /* check for function pointer */
- be .Lerror
- tst %i1 /* check for stack pointer */
- be .Lerror
- nop
-
- mov %i1, %o1 /* child-stack */
- mov %i2, %o0 /* clone-flags */
- mov __NR_clone, %g1
- ta 0x10 /* syscall: clone */
- bcs .Lerror
-
- tst %o1
- bne .Lstart /* we are the child :) */
- nop
- mov %o0, %i0 /* return child pid */
- ret
- restore
-
-.Lerror:
- call __errno_location
- nop
- mov EINVAL, %l0
- st %l0, [%o0]
- ret
- restore %g0, -1, %o0
-
-.Lstart:
- call %i0 /* call child-function */
- mov %i3, %o0 /* put arg in the right place for the child */
-
- call _exit /* child returned */
- nop
-
diff --git a/mdk-stage1/dietlibc/sparc/fork.S b/mdk-stage1/dietlibc/sparc/fork.S
deleted file mode 100644
index 869c9b30c..000000000
--- a/mdk-stage1/dietlibc/sparc/fork.S
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "syscalls.h"
-
-.text
-.weak fork
-fork:
-.global __libc_fork
-__libc_fork:
- mov 2, %g1
- ta 0x10
- bcc,a 1f
- nop
- save %sp, -96, %sp
-#ifdef WANT_THREAD_SAVE
- call __errno_location
- nop
-#else
- sethi %hi(errno), %o0
- or %o0, %lo(errno), %o0
-#endif
- st %i0, [ %o0 ]
- retl
- restore %g0, -1, %o0
-1: dec %o1
- retl
- and %o0, %o1, %o0
diff --git a/mdk-stage1/dietlibc/sparc/mmap.c b/mdk-stage1/dietlibc/sparc/mmap.c
deleted file mode 100644
index 25ebdc24e..000000000
--- a/mdk-stage1/dietlibc/sparc/mmap.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <linux/types.h>
-#include <linux/unistd.h>
-
-#define __SYSCALL_STRING \
- "ta 0x10;" \
- "bcs 2f;" \
- " nop;" \
- "1:" \
- ".subsection 2;" \
- "2:" \
- "save %%sp, -192, %%sp;" \
- "call __errno_location;" \
- " nop;" \
- "st %%i0,[%%o0];" \
- "ba 1b;" \
- " restore %%g0, -1, %%o0;" \
- ".previous;"
-
-#define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g7", \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
- "cc", "memory"
-
-#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
-({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- register long __o1 __asm__ ("o1") = (long)(arg2); \
- register long __o2 __asm__ ("o2") = (long)(arg3); \
- register long __o3 __asm__ ("o3") = (long)(arg4); \
- register long __o4 __asm__ ("o4") = (long)(arg5); \
- register long __o5 __asm__ ("o5") = (long)(arg6); \
- register long __g1 __asm__ ("g1") = __NR_##name; \
- __asm__ (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \
- "0" (__g1), "1" (__o0), "r" (__o1), "r" (__o2), \
- "r" (__o3), "r" (__o4), "r" (__o5) : \
- __SYSCALL_CLOBBERS); \
- __o0; \
-})
-int mmap(void*start,size_t length,int prot,int flags,int fd,off_t offset) {
- return inline_syscall6(mmap,start,length,prot,flags,fd,offset);
-}
diff --git a/mdk-stage1/dietlibc/sparc/pipe.S b/mdk-stage1/dietlibc/sparc/pipe.S
deleted file mode 100644
index 820da2570..000000000
--- a/mdk-stage1/dietlibc/sparc/pipe.S
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "syscalls.h"
-
-.text
-.global pipe
-pipe:
- mov %o0, %o2
- mov __NR_pipe, %g1
- ta 0x10
- bcc,a 1f
- nop
- save %sp, -96, %sp
-#ifdef WANT_THREAD_SAVE
- call __errno_location
- nop
-#else
- sethi %hi(errno), %o0
- or %o0, %lo(errno), %o0
-#endif
- st %i0, [ %o0 ]
- ret
- restore %g0, -1, %o0
-
-1: st %o0, [ %o2 ]
- st %o1, [ %o2 + 4 ]
- retl
- mov %g0, %o0
diff --git a/mdk-stage1/dietlibc/sparc/setjmp.S b/mdk-stage1/dietlibc/sparc/setjmp.S
deleted file mode 100644
index efc5a7013..000000000
--- a/mdk-stage1/dietlibc/sparc/setjmp.S
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <setjmp.h>
-
-#define JB_SP 0
-#define JB_FP 1
-#define JB_PC 2
-
-#define ST_FLUSH_WINDOWS 0x03
-
-.section .rodata
-.text
-.globl __setjmp
-__setjmp:
- b 1f
- set 0, %o1
-.size __setjmp,.-__setjmp
-
-.globl setjmp
-setjmp:
- set 1, %o1
-.size setjmp,.-setjmp
-
-.globl __sigsetjmp
-__sigsetjmp:
-1:
- /* Save our PC, SP and FP. Save the signal mask if requested with
- a tail-call for simplicity; it always returns zero. */
- ta ST_FLUSH_WINDOWS
-
- st %o7, [%o0 + (JB_PC * 4)]
- st %sp, [%o0 + (JB_SP * 4)]
- st %fp, [%o0 + (JB_FP * 4)]
-
- mov %o7, %g1
- call __sigjmp_save
- mov %g1, %o7
-.size __sigsetjmp,.-__sigsetjmp
-
diff --git a/mdk-stage1/dietlibc/sparc/shmat.c b/mdk-stage1/dietlibc/sparc/shmat.c
deleted file mode 100644
index 73b2d89a9..000000000
--- a/mdk-stage1/dietlibc/sparc/shmat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <asm/ipc.h>
-
-extern void* __ipc();
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
-void* shmat(int shmid,const void* shmaddr,int shmflg) {
- void* raddr;
- register void* result;
- result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr);
- if ((unsigned long)result <= -(unsigned long)PAGE_SIZE)
- result=raddr;
- return result;
-}
diff --git a/mdk-stage1/dietlibc/sparc/start.S b/mdk-stage1/dietlibc/sparc/start.S
deleted file mode 100644
index e948aaddc..000000000
--- a/mdk-stage1/dietlibc/sparc/start.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "start.h"
-
-#ifdef __sparc__
- .section ".text"
- .align 4
- .global _start
- .type _start,@function
-_start:
-
- /* Terminate the stack frame, and reserve space for functions to
- drop their arguments. */
- mov %g0, %fp
- sub %sp, 6*4, %sp
-
- /* Extract the arguments and environment as encoded on the stack. The
- argument info starts after one register window (16 words) past the SP. */
- ld [%sp+22*4], %o0
- add %sp, 23*4, %o1
- add %o1, %o0, %o2
- add %o2, %o0, %o2
- add %o2, %o0, %o2
- add %o2, %o0, %o2
- add %o2, 4, %o2
-
- sethi %hi(environ), %o3
- or %o3, %lo(environ), %o3
- st %o2, [%o3]
-
- /* When starting a binary via the dynamic linker, %g1 contains the
- address of the shared library termination function, which will be
- registered with atexit(). If we are statically linked, this will
- be NULL. */
-
- /* Let libc do the rest of the initialization, and call main. */
- call main
- mov %g1, %o5
-
- b exit
- mov %o0, %i0
-
- /* Die very horribly if exit returns. */
- unimp
-
- .size _start, .-_start
-#endif
-
diff --git a/mdk-stage1/dietlibc/sparc/udiv.S b/mdk-stage1/dietlibc/sparc/udiv.S
deleted file mode 100644
index 87479e7bd..000000000
--- a/mdk-stage1/dietlibc/sparc/udiv.S
+++ /dev/null
@@ -1,363 +0,0 @@
-#ifdef __sparc__
- /* This file is generated from divrem.m4; DO NOT EDIT! */
-/*
- * Division and remainder, from Appendix E of the Sparc Version 8
- * Architecture Manual, with fixes from Gordon Irlam.
- */
-
-/*
- * Input: dividend and divisor in %o0 and %o1 respectively.
- *
- * m4 parameters:
- * .udiv name of function to generate
- * div div=div => %o0 / %o1; div=rem => %o0 % %o1
- * false false=true => signed; false=false => unsigned
- *
- * Algorithm parameters:
- * N how many bits per iteration we try to get (4)
- * WORDSIZE total number of bits (32)
- *
- * Derived constants:
- * TOPBITS number of bits in the top decade of a number
- *
- * Important variables:
- * Q the partial quotient under development (initially 0)
- * R the remainder so far, initially the dividend
- * ITER number of main division loop iterations required;
- * equal to ceil(log2(quotient) / N). Note that this
- * is the log base (2^N) of the quotient.
- * V the current comparand, initially divisor*2^(ITER*N-1)
- *
- * Cost:
- * Current estimate for non-large dividend is
- * ceil(log2(quotient) / N) * (10 + 7N/2) + C
- * A large dividend is one greater than 2^(31-TOPBITS) and takes a
- * different path, as the upper bits of the quotient must be developed
- * one bit at a time.
- */
-
-
-
-#define C_LABEL(name) name:
-
-#define C_SYMBOL_NAME(name) name
-
-#define ENTRY(name) \
- .global C_SYMBOL_NAME(name); \
- .align 4;\
- C_LABEL(name);\
- .type name,@function;
-
-#define LOC(name) . ## L ## name
-
-#define END(name) \
- .size name, . - name
-
-#define ST_DIV0 0x02
-
-ENTRY(.udiv)
-
- ! Ready to divide. Compute size of quotient; scale comparand.
- orcc %o1, %g0, %o5
- bne 1f
- mov %o0, %o3
-
- ! Divide by zero trap. If it returns, return 0 (about as
- ! wrong as possible, but that is what SunOS does...).
- ta ST_DIV0
- retl
- clr %o0
-
-1:
- cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu LOC(got_result) ! (and algorithm fails otherwise)
- clr %o2
- sethi %hi(1 << (32 - 4 - 1)), %g1
- cmp %o3, %g1
- blu LOC(not_really_big)
- clr %o4
-
- ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
- ! as our usual N-at-a-shot divide step will cause overflow and havoc.
- ! The number of bits in the result here is N*ITER+SC, where SC <= N.
- ! Compute ITER in an unorthodox manner: know we need to shift V into
- ! the top decade: so do not even bother to compare to R.
- 1:
- cmp %o5, %g1
- bgeu 3f
- mov 1, %g2
- sll %o5, 4, %o5
- b 1b
- add %o4, 1, %o4
-
- ! Now compute %g2.
- 2: addcc %o5, %o5, %o5
- bcc LOC(not_too_big)
- add %g2, 1, %g2
-
- ! We get here if the %o1 overflowed while shifting.
- ! This means that %o3 has the high-order bit set.
- ! Restore %o5 and subtract from %o3.
- sll %g1, 4, %g1 ! high order bit
- srl %o5, 1, %o5 ! rest of %o5
- add %o5, %g1, %o5
- b LOC(do_single_div)
- sub %g2, 1, %g2
-
- LOC(not_too_big):
- 3: cmp %o5, %o3
- blu 2b
- nop
- be LOC(do_single_div)
- nop
- /* NB: these are commented out in the V8-Sparc manual as well */
- /* (I do not understand this) */
- ! %o5 > %o3: went too far: back up 1 step
- ! srl %o5, 1, %o5
- ! dec %g2
- ! do single-bit divide steps
- !
- ! We have to be careful here. We know that %o3 >= %o5, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
- ! order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
- LOC(do_single_div):
- subcc %g2, 1, %g2
- bl LOC(end_regular_divide)
- nop
- sub %o3, %o5, %o3
- mov 1, %o2
- b LOC(end_single_divloop)
- nop
- LOC(single_divloop):
- sll %o2, 1, %o2
- bl 1f
- srl %o5, 1, %o5
- ! %o3 >= 0
- sub %o3, %o5, %o3
- b 2f
- add %o2, 1, %o2
- 1: ! %o3 < 0
- add %o3, %o5, %o3
- sub %o2, 1, %o2
- 2:
- LOC(end_single_divloop):
- subcc %g2, 1, %g2
- bge LOC(single_divloop)
- tst %o3
- b,a LOC(end_regular_divide)
-
-LOC(not_really_big):
-1:
- sll %o5, 4, %o5
- cmp %o5, %o3
- bleu 1b
- addcc %o4, 1, %o4
- be LOC(got_result)
- sub %o4, 1, %o4
-
- tst %o3 ! set up for initial iteration
-LOC(divloop):
- sll %o2, 4, %o2
- ! depth 1, accumulated bits 0
- bl LOC(1.16)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 2, accumulated bits 1
- bl LOC(2.17)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits 3
- bl LOC(3.19)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 7
- bl LOC(4.23)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2+1), %o2
-
-LOC(4.23):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2-1), %o2
-
-
-LOC(3.19):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 5
- bl LOC(4.21)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2+1), %o2
-
-LOC(4.21):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2-1), %o2
-
-
-
-LOC(2.17):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits 1
- bl LOC(3.17)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 3
- bl LOC(4.19)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2+1), %o2
-
-LOC(4.19):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2-1), %o2
-
-
-LOC(3.17):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 1
- bl LOC(4.17)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2+1), %o2
-
-LOC(4.17):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2-1), %o2
-
-
-
-
-LOC(1.16):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 2, accumulated bits -1
- bl LOC(2.15)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits -1
- bl LOC(3.15)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -1
- bl LOC(4.15)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2+1), %o2
-
-LOC(4.15):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2-1), %o2
-
-
-LOC(3.15):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -3
- bl LOC(4.13)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2+1), %o2
-
-LOC(4.13):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2-1), %o2
-
-
-
-LOC(2.15):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits -3
- bl LOC(3.13)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -5
- bl LOC(4.11)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2+1), %o2
-
-LOC(4.11):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2-1), %o2
-
-
-LOC(3.13):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -7
- bl LOC(4.9)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2+1), %o2
-
-LOC(4.9):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2-1), %o2
-
-
-
-
- 9:
-LOC(end_regular_divide):
- subcc %o4, 1, %o4
- bge LOC(divloop)
- tst %o3
- bl,a LOC(got_result)
- ! non-restoring fixup here (one instruction only!)
- sub %o2, 1, %o2
-
-
-LOC(got_result):
-
- retl
- mov %o2, %o0
-
-END(.udiv)
-
-#endif
diff --git a/mdk-stage1/dietlibc/sparc/umul.S b/mdk-stage1/dietlibc/sparc/umul.S
deleted file mode 100644
index 15038ab2a..000000000
--- a/mdk-stage1/dietlibc/sparc/umul.S
+++ /dev/null
@@ -1,170 +0,0 @@
-#ifdef __sparc__
-/*
- * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the
- * upper 32 bits of the 64-bit product).
- *
- * This code optimizes short (less than 13-bit) multiplies. Short
- * multiplies require 25 instruction cycles, and long ones require
- * 45 instruction cycles.
- *
- * On return, overflow has occurred (%o1 is not zero) if and only if
- * the Z condition code is clear, allowing, e.g., the following:
- *
- * call .umul
- * nop
- * bnz overflow (or tnz)
- */
-
-#define C_LABEL(name) name:
-
-#define C_SYMBOL_NAME(name) name
-
-#define ENTRY(name) \
- .global C_SYMBOL_NAME(name); \
- .align 4;\
- C_LABEL(name);\
- .type name,@function;
-
-#define LOC(name) . ## L ## name
-
-#define END(name) \
- .size name, . - name
-
-ENTRY(.umul)
- or %o0, %o1, %o4
- mov %o0, %y ! multiplier -> Y
- andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args
- be LOC(mul_shortway) ! if zero, can do it the short way
- andcc %g0, %g0, %o4 ! zero the partial product; clear N & V
-
- /*
- * Long multiply. 32 steps, followed by a final shift step.
- */
- mulscc %o4, %o1, %o4 ! 1
- mulscc %o4, %o1, %o4 ! 2
- mulscc %o4, %o1, %o4 ! 3
- mulscc %o4, %o1, %o4 ! 4
- mulscc %o4, %o1, %o4 ! 5
- mulscc %o4, %o1, %o4 ! 6
- mulscc %o4, %o1, %o4 ! 7
- mulscc %o4, %o1, %o4 ! 8
- mulscc %o4, %o1, %o4 ! 9
- mulscc %o4, %o1, %o4 ! 10
- mulscc %o4, %o1, %o4 ! 11
- mulscc %o4, %o1, %o4 ! 12
- mulscc %o4, %o1, %o4 ! 13
- mulscc %o4, %o1, %o4 ! 14
- mulscc %o4, %o1, %o4 ! 15
- mulscc %o4, %o1, %o4 ! 16
- mulscc %o4, %o1, %o4 ! 17
- mulscc %o4, %o1, %o4 ! 18
- mulscc %o4, %o1, %o4 ! 19
- mulscc %o4, %o1, %o4 ! 20
- mulscc %o4, %o1, %o4 ! 21
- mulscc %o4, %o1, %o4 ! 22
- mulscc %o4, %o1, %o4 ! 23
- mulscc %o4, %o1, %o4 ! 24
- mulscc %o4, %o1, %o4 ! 25
- mulscc %o4, %o1, %o4 ! 26
- mulscc %o4, %o1, %o4 ! 27
- mulscc %o4, %o1, %o4 ! 28
- mulscc %o4, %o1, %o4 ! 29
- mulscc %o4, %o1, %o4 ! 30
- mulscc %o4, %o1, %o4 ! 31
- mulscc %o4, %o1, %o4 ! 32
- mulscc %o4, %g0, %o4 ! final shift
-
- /*
- * Normally, with the shift-and-add approach, if both numbers are
- * positive you get the correct result. With 32-bit two's-complement
- * numbers, -x is represented as
- *
- * x 32
- * ( 2 - ------ ) mod 2 * 2
- * 32
- * 2
- *
- * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s,
- * we can treat this as if the radix point were just to the left
- * of the sign bit (multiply by 2^32), and get
- *
- * -x = (2 - x) mod 2
- *
- * Then, ignoring the `mod 2's for convenience:
- *
- * x * y = xy
- * -x * y = 2y - xy
- * x * -y = 2x - xy
- * -x * -y = 4 - 2x - 2y + xy
- *
- * For signed multiplies, we subtract (x << 32) from the partial
- * product to fix this problem for negative multipliers (see mul.s).
- * Because of the way the shift into the partial product is calculated
- * (N xor V), this term is automatically removed for the multiplicand,
- * so we don't have to adjust.
- *
- * But for unsigned multiplies, the high order bit wasn't a sign bit,
- * and the correction is wrong. So for unsigned multiplies where the
- * high order bit is one, we end up with xy - (y << 32). To fix it
- * we add y << 32.
- */
-#if 0
- tst %o1
- bl,a 1f ! if %o1 < 0 (high order bit = 1),
- add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half)
-1: rd %y, %o0 ! get lower half of product
- retl
- addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0
-#else
- /* Faster code from tege@sics.se. */
- sra %o1, 31, %o2 ! make mask from sign bit
- and %o0, %o2, %o2 ! %o2 = 0 or %o0, depending on sign of %o1
- rd %y, %o0 ! get lower half of product
- retl
- addcc %o4, %o2, %o1 ! add compensation and put upper half in place
-#endif
-
-LOC(mul_shortway):
- /*
- * Short multiply. 12 steps, followed by a final shift step.
- * The resulting bits are off by 12 and (32-12) = 20 bit positions,
- * but there is no problem with %o0 being negative (unlike above),
- * and overflow is impossible (the answer is at most 24 bits long).
- */
- mulscc %o4, %o1, %o4 ! 1
- mulscc %o4, %o1, %o4 ! 2
- mulscc %o4, %o1, %o4 ! 3
- mulscc %o4, %o1, %o4 ! 4
- mulscc %o4, %o1, %o4 ! 5
- mulscc %o4, %o1, %o4 ! 6
- mulscc %o4, %o1, %o4 ! 7
- mulscc %o4, %o1, %o4 ! 8
- mulscc %o4, %o1, %o4 ! 9
- mulscc %o4, %o1, %o4 ! 10
- mulscc %o4, %o1, %o4 ! 11
- mulscc %o4, %o1, %o4 ! 12
- mulscc %o4, %g0, %o4 ! final shift
-
- /*
- * %o4 has 20 of the bits that should be in the result; %y has
- * the bottom 12 (as %y's top 12). That is:
- *
- * %o4 %y
- * +----------------+----------------+
- * | -12- | -20- | -12- | -20- |
- * +------(---------+------)---------+
- * -----result-----
- *
- * The 12 bits of %o4 left of the `result' area are all zero;
- * in fact, all top 20 bits of %o4 are zero.
- */
-
- rd %y, %o5
- sll %o4, 12, %o0 ! shift middle bits left 12
- srl %o5, 20, %o5 ! shift low bits right 20
- or %o5, %o0, %o0
- retl
- addcc %g0, %g0, %o1 ! %o1 = zero, and set Z
-
-END(.umul)
-#endif
diff --git a/mdk-stage1/dietlibc/sparc/unified.S b/mdk-stage1/dietlibc/sparc/unified.S
deleted file mode 100644
index 3cd609da5..000000000
--- a/mdk-stage1/dietlibc/sparc/unified.S
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <dietfeatures.h>
-
-.text
-.global __unified_syscall
-__unified_syscall:
- ta 0x10
-
- bcc 1f
- save %sp, -104, %sp
-
- neg %i0, %i0
-1:
- add %i0, 0xff, %l2
- cmp %l2, 0xfe
- bgu 2f
- neg %i0, %l3
-#ifdef WANT_THREAD_SAVE
- call __errno_location
- nop
-#else
- sethi %hi(errno), %o0
- or %o0, %lo(errno), %o0
-#endif
- st %l3, [ %o0 ]
- mov -1, %i0
-2:
- ret
- restore
diff --git a/mdk-stage1/dietlibc/sparc/urem.S b/mdk-stage1/dietlibc/sparc/urem.S
deleted file mode 100644
index 943cb7873..000000000
--- a/mdk-stage1/dietlibc/sparc/urem.S
+++ /dev/null
@@ -1,362 +0,0 @@
-#ifdef __sparc__
- /* This file is generated from divrem.m4; DO NOT EDIT! */
-/*
- * Division and remainder, from Appendix E of the Sparc Version 8
- * Architecture Manual, with fixes from Gordon Irlam.
- */
-
-/*
- * Input: dividend and divisor in %o0 and %o1 respectively.
- *
- * m4 parameters:
- * .urem name of function to generate
- * rem rem=div => %o0 / %o1; rem=rem => %o0 % %o1
- * false false=true => signed; false=false => unsigned
- *
- * Algorithm parameters:
- * N how many bits per iteration we try to get (4)
- * WORDSIZE total number of bits (32)
- *
- * Derived constants:
- * TOPBITS number of bits in the top decade of a number
- *
- * Important variables:
- * Q the partial quotient under development (initially 0)
- * R the remainder so far, initially the dividend
- * ITER number of main division loop iterations required;
- * equal to ceil(log2(quotient) / N). Note that this
- * is the log base (2^N) of the quotient.
- * V the current comparand, initially divisor*2^(ITER*N-1)
- *
- * Cost:
- * Current estimate for non-large dividend is
- * ceil(log2(quotient) / N) * (10 + 7N/2) + C
- * A large dividend is one greater than 2^(31-TOPBITS) and takes a
- * different path, as the upper bits of the quotient must be developed
- * one bit at a time.
- */
-
-
-
-#define C_LABEL(name) name:
-
-#define C_SYMBOL_NAME(name) name
-
-#define ENTRY(name) \
- .global C_SYMBOL_NAME(name); \
- .align 4;\
- C_LABEL(name);\
- .type name,@function;
-
-#define LOC(name) . ## L ## name
-
-#define END(name) \
- .size name, . - name
-
-#define ST_DIV0 0x02
-
-ENTRY(.urem)
-
- ! Ready to divide. Compute size of quotient; scale comparand.
- orcc %o1, %g0, %o5
- bne 1f
- mov %o0, %o3
-
- ! Divide by zero trap. If it returns, return 0 (about as
- ! wrong as possible, but that is what SunOS does...).
- ta ST_DIV0
- retl
- clr %o0
-
-1:
- cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu LOC(got_result) ! (and algorithm fails otherwise)
- clr %o2
- sethi %hi(1 << (32 - 4 - 1)), %g1
- cmp %o3, %g1
- blu LOC(not_really_big)
- clr %o4
-
- ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
- ! as our usual N-at-a-shot divide step will cause overflow and havoc.
- ! The number of bits in the result here is N*ITER+SC, where SC <= N.
- ! Compute ITER in an unorthodox manner: know we need to shift V into
- ! the top decade: so do not even bother to compare to R.
- 1:
- cmp %o5, %g1
- bgeu 3f
- mov 1, %g2
- sll %o5, 4, %o5
- b 1b
- add %o4, 1, %o4
-
- ! Now compute %g2.
- 2: addcc %o5, %o5, %o5
- bcc LOC(not_too_big)
- add %g2, 1, %g2
-
- ! We get here if the %o1 overflowed while shifting.
- ! This means that %o3 has the high-order bit set.
- ! Restore %o5 and subtract from %o3.
- sll %g1, 4, %g1 ! high order bit
- srl %o5, 1, %o5 ! rest of %o5
- add %o5, %g1, %o5
- b LOC(do_single_div)
- sub %g2, 1, %g2
-
- LOC(not_too_big):
- 3: cmp %o5, %o3
- blu 2b
- nop
- be LOC(do_single_div)
- nop
- /* NB: these are commented out in the V8-Sparc manual as well */
- /* (I do not understand this) */
- ! %o5 > %o3: went too far: back up 1 step
- ! srl %o5, 1, %o5
- ! dec %g2
- ! do single-bit divide steps
- !
- ! We have to be careful here. We know that %o3 >= %o5, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
- ! order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
- LOC(do_single_div):
- subcc %g2, 1, %g2
- bl LOC(end_regular_divide)
- nop
- sub %o3, %o5, %o3
- mov 1, %o2
- b LOC(end_single_divloop)
- nop
- LOC(single_divloop):
- sll %o2, 1, %o2
- bl 1f
- srl %o5, 1, %o5
- ! %o3 >= 0
- sub %o3, %o5, %o3
- b 2f
- add %o2, 1, %o2
- 1: ! %o3 < 0
- add %o3, %o5, %o3
- sub %o2, 1, %o2
- 2:
- LOC(end_single_divloop):
- subcc %g2, 1, %g2
- bge LOC(single_divloop)
- tst %o3
- b,a LOC(end_regular_divide)
-
-LOC(not_really_big):
-1:
- sll %o5, 4, %o5
- cmp %o5, %o3
- bleu 1b
- addcc %o4, 1, %o4
- be LOC(got_result)
- sub %o4, 1, %o4
-
- tst %o3 ! set up for initial iteration
-LOC(divloop):
- sll %o2, 4, %o2
- ! depth 1, accumulated bits 0
- bl LOC(1.16)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 2, accumulated bits 1
- bl LOC(2.17)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits 3
- bl LOC(3.19)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 7
- bl LOC(4.23)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2+1), %o2
-
-LOC(4.23):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2-1), %o2
-
-
-LOC(3.19):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 5
- bl LOC(4.21)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2+1), %o2
-
-LOC(4.21):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2-1), %o2
-
-
-
-LOC(2.17):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits 1
- bl LOC(3.17)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits 3
- bl LOC(4.19)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2+1), %o2
-
-LOC(4.19):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2-1), %o2
-
-
-LOC(3.17):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits 1
- bl LOC(4.17)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2+1), %o2
-
-LOC(4.17):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2-1), %o2
-
-
-
-
-LOC(1.16):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 2, accumulated bits -1
- bl LOC(2.15)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 3, accumulated bits -1
- bl LOC(3.15)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -1
- bl LOC(4.15)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2+1), %o2
-
-LOC(4.15):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2-1), %o2
-
-
-LOC(3.15):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -3
- bl LOC(4.13)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2+1), %o2
-
-LOC(4.13):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2-1), %o2
-
-
-
-LOC(2.15):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 3, accumulated bits -3
- bl LOC(3.13)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- ! depth 4, accumulated bits -5
- bl LOC(4.11)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2+1), %o2
-
-LOC(4.11):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2-1), %o2
-
-
-LOC(3.13):
- ! remainder is negative
- addcc %o3,%o5,%o3
- ! depth 4, accumulated bits -7
- bl LOC(4.9)
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2+1), %o2
-
-LOC(4.9):
- ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2-1), %o2
-
-
-
-
- 9:
-LOC(end_regular_divide):
- subcc %o4, 1, %o4
- bge LOC(divloop)
- tst %o3
- bl,a LOC(got_result)
- ! non-restoring fixup here (one instruction only!)
- add %o3, %o1, %o3
-
-
-LOC(got_result):
-
- retl
- mov %o3, %o0
-
-END(.urem)
-#endif
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.c/_llseek.c b/mdk-stage1/dietlibc/syscalls.c/_llseek.c
deleted file mode 100644
index fdf49eba5..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/_llseek.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <unistd.h>
-#include <sys/types.h>
-#include "syscalls.h"
-
-_syscall5(int,_llseek,uint,fd,ulong,hi,ulong,lo,loff_t*,res,uint,wh);
diff --git a/mdk-stage1/dietlibc/syscalls.c/_newselect.c b/mdk-stage1/dietlibc/syscalls.c/_newselect.c
deleted file mode 100644
index cb42193bd..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/_newselect.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <linux/types.h>
-#include <linux/time.h>
-#include "syscalls.h"
-
-_syscall5(int,_newselect,int,n,fd_set *,rd,fd_set *,wr,fd_set *,ex,struct timeval *,timeval);
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/access.c b/mdk-stage1/dietlibc/syscalls.c/access.c
deleted file mode 100644
index 80944733a..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/access.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,access,const char*,pathname,int,mode)
diff --git a/mdk-stage1/dietlibc/syscalls.c/chdir.c b/mdk-stage1/dietlibc/syscalls.c/chdir.c
deleted file mode 100644
index a679f528d..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/chdir.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,chdir,void*,path)
diff --git a/mdk-stage1/dietlibc/syscalls.c/chmod.c b/mdk-stage1/dietlibc/syscalls.c/chmod.c
deleted file mode 100644
index 80ad33b40..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/chmod.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,chmod,const char * ,path,mode_t,mode)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/chown.c b/mdk-stage1/dietlibc/syscalls.c/chown.c
deleted file mode 100644
index 5a9352684..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/chown.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,chown,char*,path,uid_t,owner,gid_t,group)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/chroot.c b/mdk-stage1/dietlibc/syscalls.c/chroot.c
deleted file mode 100644
index ab39f7ebe..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/chroot.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,chroot,void*,path)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/clone.c b/mdk-stage1/dietlibc/syscalls.c/clone.c
deleted file mode 100644
index 985eee4c8..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/clone.c
+++ /dev/null
@@ -1 +0,0 @@
-#warning "No CLONE support yet"
diff --git a/mdk-stage1/dietlibc/syscalls.c/close.c b/mdk-stage1/dietlibc/syscalls.c/close.c
deleted file mode 100644
index a7d7f0076..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/close.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,close,int,fd)
diff --git a/mdk-stage1/dietlibc/syscalls.c/dup.c b/mdk-stage1/dietlibc/syscalls.c/dup.c
deleted file mode 100644
index 9c28f0bd6..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/dup.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,dup,int,fd)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/dup2.c b/mdk-stage1/dietlibc/syscalls.c/dup2.c
deleted file mode 100644
index 399314aa8..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/dup2.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,dup2,int,one,int,two)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/execve.c b/mdk-stage1/dietlibc/syscalls.c/execve.c
deleted file mode 100644
index c2bac0117..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/execve.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,execve,const char *,fn,void *,argv,void *,envp)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/exit.c b/mdk-stage1/dietlibc/syscalls.c/exit.c
deleted file mode 100644
index 87087c939..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/exit.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,exit,int,exitcode)
diff --git a/mdk-stage1/dietlibc/syscalls.c/fchdir.c b/mdk-stage1/dietlibc/syscalls.c/fchdir.c
deleted file mode 100644
index b3a41dc7a..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/fchdir.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,fchdir,int,fd)
diff --git a/mdk-stage1/dietlibc/syscalls.c/fchmod.c b/mdk-stage1/dietlibc/syscalls.c/fchmod.c
deleted file mode 100644
index 09e52b6c7..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/fchmod.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,fchmod,int,filedes,mode_t,mode)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/fchown.c b/mdk-stage1/dietlibc/syscalls.c/fchown.c
deleted file mode 100644
index 58923a137..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/fchown.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,fchown,int,fd,uid_t,owner,gid_t,group)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/fcntl.c b/mdk-stage1/dietlibc/syscalls.c/fcntl.c
deleted file mode 100644
index b21be9531..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/fcntl.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,fcntl,int,fd,int,cmd,long,arg)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/flock.c b/mdk-stage1/dietlibc/syscalls.c/flock.c
deleted file mode 100644
index 6fcb336ef..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/flock.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,flock,int,fd,int,op)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/fork.c b/mdk-stage1/dietlibc/syscalls.c/fork.c
deleted file mode 100644
index 1d4b892b6..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/fork.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "syscalls.h"
-
-#ifndef __sparc__
-
-_syscall0(int,fork)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.c/fsync.c b/mdk-stage1/dietlibc/syscalls.c/fsync.c
deleted file mode 100644
index db6198b8a..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/fsync.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,fsync,int,fd)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/ftruncate.c b/mdk-stage1/dietlibc/syscalls.c/ftruncate.c
deleted file mode 100644
index 5f002a899..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/ftruncate.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <sys/types.h>
-#include "syscalls.h"
-
-_syscall2(int,ftruncate,int,fd,off_t,length)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getcwd.c b/mdk-stage1/dietlibc/syscalls.c/getcwd.c
deleted file mode 100644
index 9e5e4a3e2..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getcwd.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-
-/* this syscall exists since Linux 2.1.92 */
-
-_syscall2(int,getcwd,char*,buf,unsigned long,size)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getdents.c b/mdk-stage1/dietlibc/syscalls.c/getdents.c
deleted file mode 100644
index be941b21e..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getdents.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int, getdents, unsigned int, fd, void *, dirp, unsigned int, count);
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/getegid.c b/mdk-stage1/dietlibc/syscalls.c/getegid.c
deleted file mode 100644
index 3213d640c..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getegid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall0(gid_t,getegid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/geteuid.c b/mdk-stage1/dietlibc/syscalls.c/geteuid.c
deleted file mode 100644
index 5b31a3cca..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/geteuid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall0(uid_t,geteuid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getgid.c b/mdk-stage1/dietlibc/syscalls.c/getgid.c
deleted file mode 100644
index 2f7d96286..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getgid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall0(gid_t,getgid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getgroups.c b/mdk-stage1/dietlibc/syscalls.c/getgroups.c
deleted file mode 100644
index 3e4d6797a..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getgroups.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,getgroups,int,size,int*,list)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getpgid.c b/mdk-stage1/dietlibc/syscalls.c/getpgid.c
deleted file mode 100644
index 0b4ff528b..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getpgid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall1(pid_t,getpgid,pid_t,pid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getpid.c b/mdk-stage1/dietlibc/syscalls.c/getpid.c
deleted file mode 100644
index d60a8db9a..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getpid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall0(int,getpid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getppid.c b/mdk-stage1/dietlibc/syscalls.c/getppid.c
deleted file mode 100644
index ee87a8eae..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getppid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall0(int,getppid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getpriority.c b/mdk-stage1/dietlibc/syscalls.c/getpriority.c
deleted file mode 100644
index 6f94bcf42..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getpriority.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,getpriority,int,which,int,who)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/getresgid.c b/mdk-stage1/dietlibc/syscalls.c/getresgid.c
deleted file mode 100644
index 264ec7dce..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getresgid.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-#ifdef __NR_getresgid
-
-_syscall3(int,getresgid,gid_t*,rgid,gid_t*,egid,gid_t*,sgid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.c/getresuid.c b/mdk-stage1/dietlibc/syscalls.c/getresuid.c
deleted file mode 100644
index 74e2daec2..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getresuid.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-#ifdef __getresuid
-
-_syscall3(int,getresuid,uid_t*,ruid,uid_t*,euid,uid_t*,suid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.c/getrlimit.c b/mdk-stage1/dietlibc/syscalls.c/getrlimit.c
deleted file mode 100644
index 635b2baf4..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getrlimit.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,getrlimit,int,resource,void*,rlim)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getrusage.c b/mdk-stage1/dietlibc/syscalls.c/getrusage.c
deleted file mode 100644
index 815d3e617..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getrusage.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,getrusage,int,who,void*,rusage)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getsid.c b/mdk-stage1/dietlibc/syscalls.c/getsid.c
deleted file mode 100644
index 69974c36c..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getsid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall1(pid_t,getsid,pid_t,pid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/gettimeofday.c b/mdk-stage1/dietlibc/syscalls.c/gettimeofday.c
deleted file mode 100644
index 5f4931a0c..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/gettimeofday.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include <linux/time.h>
-#include "syscalls.h"
-
-_syscall2(int,gettimeofday,struct timeval *,tv,void *,tz)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getuid.c b/mdk-stage1/dietlibc/syscalls.c/getuid.c
deleted file mode 100644
index bf38447a6..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/getuid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall0(uid_t,getuid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/ioctl.c b/mdk-stage1/dietlibc/syscalls.c/ioctl.c
deleted file mode 100644
index 1612109d3..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/ioctl.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,ioctl,int,fd,int,request,void *,argp)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/kill.c b/mdk-stage1/dietlibc/syscalls.c/kill.c
deleted file mode 100644
index e56b0ac1b..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/kill.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,kill,pid_t,pid,int,sig)
diff --git a/mdk-stage1/dietlibc/syscalls.c/lchown.c b/mdk-stage1/dietlibc/syscalls.c/lchown.c
deleted file mode 100644
index 976d2ee1f..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/lchown.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,lchown,char*,path,uid_t,owner,gid_t,group)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/link.c b/mdk-stage1/dietlibc/syscalls.c/link.c
deleted file mode 100644
index ab9b427d9..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/link.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,link,const char *,a,const char *,b)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/lseek.c b/mdk-stage1/dietlibc/syscalls.c/lseek.c
deleted file mode 100644
index 9925a2185..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/lseek.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(unsigned long,lseek,int,fd,unsigned long,offset,int,whence)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/mkdir.c b/mdk-stage1/dietlibc/syscalls.c/mkdir.c
deleted file mode 100644
index aac682c99..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/mkdir.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,mkdir,void*,path,mode_t,mode)
diff --git a/mdk-stage1/dietlibc/syscalls.c/mknod.c b/mdk-stage1/dietlibc/syscalls.c/mknod.c
deleted file mode 100644
index 00e836b73..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/mknod.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,mknod,const char*,pathname,mode_t,mode,dev_t,dev)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/mount.c b/mdk-stage1/dietlibc/syscalls.c/mount.c
deleted file mode 100644
index 2d71ee812..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/mount.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall5(int,mount,const char *,spec,const char *,dir,const char *,type,unsigned long,rwflag,const void *,data);
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/mprotect.c b/mdk-stage1/dietlibc/syscalls.c/mprotect.c
deleted file mode 100644
index 634a12089..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/mprotect.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,mprotect,const void *,addr, size_t, len, int, prot)
diff --git a/mdk-stage1/dietlibc/syscalls.c/mremap.c b/mdk-stage1/dietlibc/syscalls.c/mremap.c
deleted file mode 100644
index 37d066bac..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/mremap.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall4(int,mremap,void*,old_address,size_t,old_size,size_t,new_size,unsigned long,flags)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/munmap.c b/mdk-stage1/dietlibc/syscalls.c/munmap.c
deleted file mode 100644
index 40bc98270..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/munmap.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,munmap,void*,start,size_t,len)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/nanosleep.c b/mdk-stage1/dietlibc/syscalls.c/nanosleep.c
deleted file mode 100644
index 71aca1f09..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/nanosleep.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include <linux/time.h>
-#include "syscalls.h"
-
-_syscall2(int,nanosleep,struct timeval *,in,struct timeval *,out)
diff --git a/mdk-stage1/dietlibc/syscalls.c/open.c b/mdk-stage1/dietlibc/syscalls.c/open.c
deleted file mode 100644
index 8b3ccfcc3..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/open.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,open,const char *,fn,int,flags,mode_t,mode)
diff --git a/mdk-stage1/dietlibc/syscalls.c/pipe.c b/mdk-stage1/dietlibc/syscalls.c/pipe.c
deleted file mode 100644
index 42197c881..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/pipe.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall1(int,pipe,int *,filedes)
diff --git a/mdk-stage1/dietlibc/syscalls.c/poll.c b/mdk-stage1/dietlibc/syscalls.c/poll.c
deleted file mode 100644
index 10d0d1f78..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/poll.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,poll,void *,ufds,int,nfds,int,timeout)
diff --git a/mdk-stage1/dietlibc/syscalls.c/read.c b/mdk-stage1/dietlibc/syscalls.c/read.c
deleted file mode 100644
index f5532054e..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/read.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,read,int,fd,const char *,buf,unsigned long,count)
diff --git a/mdk-stage1/dietlibc/syscalls.c/readlink.c b/mdk-stage1/dietlibc/syscalls.c/readlink.c
deleted file mode 100644
index 482f8fe27..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/readlink.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-#include <linux/types.h>
-
-_syscall3(int,readlink,char*,path,char*,buf,size_t,bufsiz)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/reboot.c b/mdk-stage1/dietlibc/syscalls.c/reboot.c
deleted file mode 100644
index 0ad474894..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/reboot.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,reboot,int,magic,int,magic_too,int,flag)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/rename.c b/mdk-stage1/dietlibc/syscalls.c/rename.c
deleted file mode 100644
index f86d50728..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/rename.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,rename,char*,oldpath,char*,newpath)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/rmdir.c b/mdk-stage1/dietlibc/syscalls.c/rmdir.c
deleted file mode 100644
index 303885264..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/rmdir.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,rmdir,void*,path)
diff --git a/mdk-stage1/dietlibc/syscalls.c/setdomainname.c b/mdk-stage1/dietlibc/syscalls.c/setdomainname.c
deleted file mode 100644
index 83d3aa8b8..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setdomainname.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,setdomainname,const char *,name,int,len)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/setgid.c b/mdk-stage1/dietlibc/syscalls.c/setgid.c
deleted file mode 100644
index 1f7263aeb..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setgid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,setgid,int,gid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/setgroups.c b/mdk-stage1/dietlibc/syscalls.c/setgroups.c
deleted file mode 100644
index fed3b85c1..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setgroups.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,setgroups,int,size,const int*,list)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/sethostname.c b/mdk-stage1/dietlibc/syscalls.c/sethostname.c
deleted file mode 100644
index e4b736f87..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/sethostname.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,sethostname,const char *,name,int,len)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/setitimer.c b/mdk-stage1/dietlibc/syscalls.c/setitimer.c
deleted file mode 100644
index 28935cab7..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setitimer.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,setitimer,int,which,void *,value,void *,ovalue)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/setpgid.c b/mdk-stage1/dietlibc/syscalls.c/setpgid.c
deleted file mode 100644
index 66fbf82dd..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setpgid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,setpgid,int,name,int,len)
diff --git a/mdk-stage1/dietlibc/syscalls.c/setpriority.c b/mdk-stage1/dietlibc/syscalls.c/setpriority.c
deleted file mode 100644
index bc04227d2..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setpriority.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,setpriority,int,which,int,who,int,prio)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/setregid.c b/mdk-stage1/dietlibc/syscalls.c/setregid.c
deleted file mode 100644
index c6911aca8..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setregid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,setregid,gid_t,rgid,gid_t,egid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/setresgid.c b/mdk-stage1/dietlibc/syscalls.c/setresgid.c
deleted file mode 100644
index 817fd2942..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setresgid.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-#ifdef __NR_setresgid
-
-_syscall3(int,setresgid,gid_t*,rgid,gid_t*,egid,gid_t*,sgid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.c/setresuid.c b/mdk-stage1/dietlibc/syscalls.c/setresuid.c
deleted file mode 100644
index 7073d8ac2..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setresuid.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-#ifdef __NR_setresuid
-
-_syscall3(int,setresuid,uid_t*,ruid,uid_t*,euid,uid_t*,suid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.c/setreuid.c b/mdk-stage1/dietlibc/syscalls.c/setreuid.c
deleted file mode 100644
index c0c23a12d..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setreuid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,setreuid,uid_t,ruid,uid_t,euid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/setrlimit.c b/mdk-stage1/dietlibc/syscalls.c/setrlimit.c
deleted file mode 100644
index 213234282..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setrlimit.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,setrlimit,int,resource,void*,rlim)
diff --git a/mdk-stage1/dietlibc/syscalls.c/setsid.c b/mdk-stage1/dietlibc/syscalls.c/setsid.c
deleted file mode 100644
index 4b35a1316..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setsid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall0(pid_t,setsid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/setuid.c b/mdk-stage1/dietlibc/syscalls.c/setuid.c
deleted file mode 100644
index 620876c9f..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/setuid.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,setuid,int,uid)
diff --git a/mdk-stage1/dietlibc/syscalls.c/sigaction.c b/mdk-stage1/dietlibc/syscalls.c/sigaction.c
deleted file mode 100644
index cfa5c683f..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/sigaction.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,sigaction,int,signum,void*,act,void*,oldact)
diff --git a/mdk-stage1/dietlibc/syscalls.c/signal.c b/mdk-stage1/dietlibc/syscalls.c/signal.c
deleted file mode 100644
index 1a913be45..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/signal.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,signal,int,num,void *,len)
diff --git a/mdk-stage1/dietlibc/syscalls.c/sigpending.c b/mdk-stage1/dietlibc/syscalls.c/sigpending.c
deleted file mode 100644
index 08fb23991..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/sigpending.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,sigpending,void*,set)
diff --git a/mdk-stage1/dietlibc/syscalls.c/sigprocmask.c b/mdk-stage1/dietlibc/syscalls.c/sigprocmask.c
deleted file mode 100644
index e9dcc2d67..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/sigprocmask.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,sigprocmask,int,how,void*,set,void*,oldset)
diff --git a/mdk-stage1/dietlibc/syscalls.c/sigsuspend.c b/mdk-stage1/dietlibc/syscalls.c/sigsuspend.c
deleted file mode 100644
index 0fe90e623..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/sigsuspend.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,sigsuspend,void*,mask)
diff --git a/mdk-stage1/dietlibc/syscalls.c/socketcall.c b/mdk-stage1/dietlibc/syscalls.c/socketcall.c
deleted file mode 100644
index eee1ae86d..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/socketcall.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,socketcall,int,code,unsigned long *, args)
diff --git a/mdk-stage1/dietlibc/syscalls.c/swapoff.c b/mdk-stage1/dietlibc/syscalls.c/swapoff.c
deleted file mode 100644
index e1daa89a9..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/swapoff.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,swapoff,const char *,fn)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/swapon.c b/mdk-stage1/dietlibc/syscalls.c/swapon.c
deleted file mode 100644
index 543e41e79..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/swapon.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,swapon,const char*,path,int,swapflags)
diff --git a/mdk-stage1/dietlibc/syscalls.c/symlink.c b/mdk-stage1/dietlibc/syscalls.c/symlink.c
deleted file mode 100644
index b3f4d0b1c..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/symlink.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,symlink,const char *,a,const char *,b)
diff --git a/mdk-stage1/dietlibc/syscalls.c/sync.c b/mdk-stage1/dietlibc/syscalls.c/sync.c
deleted file mode 100644
index cca17461f..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/sync.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall0(int,sync)
diff --git a/mdk-stage1/dietlibc/syscalls.c/syslog.c b/mdk-stage1/dietlibc/syscalls.c/syslog.c
deleted file mode 100644
index aace870ea..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/syslog.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,syslog,int, type, char *, buf, int, len);
diff --git a/mdk-stage1/dietlibc/syscalls.c/time.c b/mdk-stage1/dietlibc/syscalls.c/time.c
deleted file mode 100644
index dc15b28f9..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/time.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall1(time_t,time,time_t*,path)
diff --git a/mdk-stage1/dietlibc/syscalls.c/truncate.c b/mdk-stage1/dietlibc/syscalls.c/truncate.c
deleted file mode 100644
index 721bd7134..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/truncate.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall2(int,truncate,const char*,path,off_t,length)
diff --git a/mdk-stage1/dietlibc/syscalls.c/umask.c b/mdk-stage1/dietlibc/syscalls.c/umask.c
deleted file mode 100644
index 506038243..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/umask.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall1(int,umask,mode_t,mask)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/umount.c b/mdk-stage1/dietlibc/syscalls.c/umount.c
deleted file mode 100644
index 4d3ef7637..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/umount.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,umount,const char *,dir)
diff --git a/mdk-stage1/dietlibc/syscalls.c/uname.c b/mdk-stage1/dietlibc/syscalls.c/uname.c
deleted file mode 100644
index 68f135007..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/uname.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall1(int,uname,void *,utsname)
-
diff --git a/mdk-stage1/dietlibc/syscalls.c/unlink.c b/mdk-stage1/dietlibc/syscalls.c/unlink.c
deleted file mode 100644
index 860ccebbf..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/unlink.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall1(int,unlink,const char *,fn)
diff --git a/mdk-stage1/dietlibc/syscalls.c/utime.c b/mdk-stage1/dietlibc/syscalls.c/utime.c
deleted file mode 100644
index 185bdf9e8..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/utime.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall2(int,utime,void*,filename,void*,buf)
diff --git a/mdk-stage1/dietlibc/syscalls.c/vhangup.c b/mdk-stage1/dietlibc/syscalls.c/vhangup.c
deleted file mode 100644
index bb0669765..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/vhangup.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall0(int,vhangup)
diff --git a/mdk-stage1/dietlibc/syscalls.c/wait4.c b/mdk-stage1/dietlibc/syscalls.c/wait4.c
deleted file mode 100644
index 4ae7eabcd..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/wait4.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall4(int,wait4,pid_t,pid,int *,status,int,opts,void *,rusage)
diff --git a/mdk-stage1/dietlibc/syscalls.c/waitpid.c b/mdk-stage1/dietlibc/syscalls.c/waitpid.c
deleted file mode 100644
index b7167f9ce..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/waitpid.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <linux/types.h>
-#include "syscalls.h"
-
-_syscall3(int,waitpid,int,pid,int *,status,int,options)
diff --git a/mdk-stage1/dietlibc/syscalls.c/write.c b/mdk-stage1/dietlibc/syscalls.c/write.c
deleted file mode 100644
index d1f7347d5..000000000
--- a/mdk-stage1/dietlibc/syscalls.c/write.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-_syscall3(int,write,int,fd,const char *,buf,unsigned long,count)
diff --git a/mdk-stage1/dietlibc/syscalls.h b/mdk-stage1/dietlibc/syscalls.h
deleted file mode 100644
index eba7a3c00..000000000
--- a/mdk-stage1/dietlibc/syscalls.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifdef __ASSEMBLER__
-
-#include <asm/unistd.h>
-
-#else
-
-#include <linux/unistd.h>
-
-#endif
-
-#ifdef __i386__
-
-#define syscall_weak(name,wsym,sym) \
-.text; \
-.weak wsym; \
-wsym: ; \
-.global sym; \
-sym: \
- movb $__NR_##name,%al; \
- jmp __unified_syscall
-
-#define syscall(name,sym) \
-.text; \
-.global sym; \
-sym: \
- movb $__NR_##name,%al; \
- jmp __unified_syscall
-
-#endif
-
-#ifdef __sparc__
-
-#define syscall_weak(name,wsym,sym) \
-.text; \
-.weak wsym; \
-wsym: ; \
-.global sym; \
-sym: \
- b __unified_syscall; \
- mov __NR_##name, %g1
-
-#define syscall(name,sym) \
-.text; \
-.global sym; \
-sym: \
- b __unified_syscall; \
- mov __NR_##name, %g1
-
-#endif
-
-#ifdef __powerpc__
-
-#define syscall_weak(name,wsym,sym) \
-.text; \
-.weak wsym; \
-wsym: ; \
-.global sym; \
-sym: \
- li 0,__NR_##name; \
- b __unified_syscall
-
-#define syscall(name,sym) \
-.text; \
-.global sym; \
-sym: \
- li 0,__NR_##name; \
- b __unified_syscall
-
-#endif
-
-
-#ifdef __mips__
-
-#define syscall_weak(name,wsym,sym) \
-.text; \
-.weak wsym; \
-wsym: ; \
-.global sym; \
-.ent sym; \
-sym: \
- li $2,__NR_##name; \
- la $25,__unified_syscall; \
- jr $25; \
-.end sym
-
-#define syscall(name,sym) \
-.text; \
-.global sym; \
-.ent sym; \
-sym: \
- li $2,__NR_##name; \
- la $25,__unified_syscall; \
- jr $25; \
-.end sym
-
-#endif
-
-#ifdef __arm__
-
-#define syscall_weak(name,wsym,sym) \
-.text; \
-.weak wsym; \
-wsym: ; \
-.global sym; \
-sym: \
- swi __NR_##name; \
- b __unified_syscall
-
-#define syscall(name,sym) \
-.text; \
-.global sym; \
-sym: \
- swi __NR_##name; \
- b __unified_syscall
-
-#endif
-
-
-#ifdef __alpha__
-
-#define syscall_weak(name,wsym,sym) \
-.text ; \
-.align 2 ; \
-.weak wsym; \
-.type wsym,@function ; \
-wsym: ; \
-.global sym ; \
-.type sym,@function ; \
-sym: ; \
- lda $0, __NR_##name($31) ; \
- br __unified_syscall
-
-#define syscall(name,sym) \
-.text ; \
-.align 2 ; \
-.global sym ; \
-.type sym,@function ; \
-sym: ; \
- lda $0, __NR_##name($31) ; \
- br __unified_syscall
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/__getpagesize.S b/mdk-stage1/dietlibc/syscalls.s/__getpagesize.S
deleted file mode 100644
index c9fd97898..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/__getpagesize.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __NR_getpagesize
-syscall(getpagesize,getpagesize)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/__pread.S b/mdk-stage1/dietlibc/syscalls.s/__pread.S
deleted file mode 100644
index ad47c7873..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/__pread.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(pread,__pread,__libc__pread)
diff --git a/mdk-stage1/dietlibc/syscalls.s/__reboot.S b/mdk-stage1/dietlibc/syscalls.s/__reboot.S
deleted file mode 100644
index 0de4f25b2..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/__reboot.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(reboot,__reboot)
diff --git a/mdk-stage1/dietlibc/syscalls.s/_llseek.S b/mdk-stage1/dietlibc/syscalls.s/_llseek.S
deleted file mode 100644
index 3e240d822..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/_llseek.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(_llseek,_llseek)
diff --git a/mdk-stage1/dietlibc/syscalls.s/access.S b/mdk-stage1/dietlibc/syscalls.s/access.S
deleted file mode 100644
index d1edafd8c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/access.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(access,access)
diff --git a/mdk-stage1/dietlibc/syscalls.s/brk.S b/mdk-stage1/dietlibc/syscalls.s/brk.S
deleted file mode 100644
index 6e21810bd..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/brk.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(brk,__diet_brk)
diff --git a/mdk-stage1/dietlibc/syscalls.s/chdir.S b/mdk-stage1/dietlibc/syscalls.s/chdir.S
deleted file mode 100644
index 204f3dd6c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/chdir.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(chdir,chdir)
diff --git a/mdk-stage1/dietlibc/syscalls.s/chmod.S b/mdk-stage1/dietlibc/syscalls.s/chmod.S
deleted file mode 100644
index c1b85f5a4..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/chmod.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(chmod,chmod)
diff --git a/mdk-stage1/dietlibc/syscalls.s/chown.S b/mdk-stage1/dietlibc/syscalls.s/chown.S
deleted file mode 100644
index daac3bf13..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/chown.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(chown,chown)
diff --git a/mdk-stage1/dietlibc/syscalls.s/chroot.S b/mdk-stage1/dietlibc/syscalls.s/chroot.S
deleted file mode 100644
index 65de1e473..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/chroot.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(chroot,chroot)
diff --git a/mdk-stage1/dietlibc/syscalls.s/close.S b/mdk-stage1/dietlibc/syscalls.s/close.S
deleted file mode 100644
index 361ca5272..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/close.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(close,close,__libc_close)
diff --git a/mdk-stage1/dietlibc/syscalls.s/dup.S b/mdk-stage1/dietlibc/syscalls.s/dup.S
deleted file mode 100644
index b2977fd43..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/dup.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(dup,dup)
diff --git a/mdk-stage1/dietlibc/syscalls.s/dup2.S b/mdk-stage1/dietlibc/syscalls.s/dup2.S
deleted file mode 100644
index 774bfbfe7..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/dup2.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(dup2,dup2)
diff --git a/mdk-stage1/dietlibc/syscalls.s/execve.S b/mdk-stage1/dietlibc/syscalls.s/execve.S
deleted file mode 100644
index ff952ae7d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/execve.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(execve,execve)
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/fchdir.S b/mdk-stage1/dietlibc/syscalls.s/fchdir.S
deleted file mode 100644
index 0aeaf610b..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fchdir.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(fchdir,fchdir)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fchmod.S b/mdk-stage1/dietlibc/syscalls.s/fchmod.S
deleted file mode 100644
index 30bc2e210..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fchmod.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(fchmod,fchmod)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fchown.S b/mdk-stage1/dietlibc/syscalls.s/fchown.S
deleted file mode 100644
index bc2a296ea..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fchown.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(fchown,fchown)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fcntl.S b/mdk-stage1/dietlibc/syscalls.s/fcntl.S
deleted file mode 100644
index 2285929a0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fcntl.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(fcntl,fcntl,__libc_fcntl)
diff --git a/mdk-stage1/dietlibc/syscalls.s/flock.S b/mdk-stage1/dietlibc/syscalls.s/flock.S
deleted file mode 100644
index 7b4daeff7..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/flock.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(flock,flock)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fork.S b/mdk-stage1/dietlibc/syscalls.s/fork.S
deleted file mode 100644
index b40c3f708..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fork.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(fork,fork,__libc_fork)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fstat.S b/mdk-stage1/dietlibc/syscalls.s/fstat.S
deleted file mode 100644
index 9dd465cda..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fstat.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(fstat,fstat)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fstat64.S b/mdk-stage1/dietlibc/syscalls.s/fstat64.S
deleted file mode 100644
index 0c7a41609..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fstat64.S
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "dietfeatures.h"
-#include "syscalls.h"
-
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-syscall(fstat64,__dietlibc_fstat64)
-#else
-syscall(fstat64,fstat64)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/fstatfs.S b/mdk-stage1/dietlibc/syscalls.s/fstatfs.S
deleted file mode 100644
index a23c8770c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fstatfs.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(fstatfs,fstatfs)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fsync.S b/mdk-stage1/dietlibc/syscalls.s/fsync.S
deleted file mode 100644
index 66af59ef9..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/fsync.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(fsync,fsync,__libc_fsync)
diff --git a/mdk-stage1/dietlibc/syscalls.s/ftruncate.S b/mdk-stage1/dietlibc/syscalls.s/ftruncate.S
deleted file mode 100644
index dde57a615..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/ftruncate.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(ftruncate,ftruncate)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getcwd.S b/mdk-stage1/dietlibc/syscalls.s/getcwd.S
deleted file mode 100644
index e13262f20..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getcwd.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getcwd,__syscall_getcwd)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getdents.S b/mdk-stage1/dietlibc/syscalls.s/getdents.S
deleted file mode 100644
index f476e939d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getdents.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getdents,getdents)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getdents64.S b/mdk-stage1/dietlibc/syscalls.s/getdents64.S
deleted file mode 100644
index 16859addf..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getdents64.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __NR_getdents64
-syscall(getdents64,getdents64)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getegid.S b/mdk-stage1/dietlibc/syscalls.s/getegid.S
deleted file mode 100644
index 64843ee35..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getegid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getegid,getegid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/geteuid.S b/mdk-stage1/dietlibc/syscalls.s/geteuid.S
deleted file mode 100644
index 55dc00981..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/geteuid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(geteuid,geteuid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getgid.S b/mdk-stage1/dietlibc/syscalls.s/getgid.S
deleted file mode 100644
index 39f092685..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getgid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getgid,getgid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getgroups.S b/mdk-stage1/dietlibc/syscalls.s/getgroups.S
deleted file mode 100644
index b4c57689c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getgroups.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getgroups,getgroups)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getitimer.S b/mdk-stage1/dietlibc/syscalls.s/getitimer.S
deleted file mode 100644
index 9a2084080..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getitimer.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getitimer,getitimer)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getpgid.S b/mdk-stage1/dietlibc/syscalls.s/getpgid.S
deleted file mode 100644
index e568f060f..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getpgid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getpgid,getpgid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getpid.S b/mdk-stage1/dietlibc/syscalls.s/getpid.S
deleted file mode 100644
index 093884785..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getpid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getpid,getpid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getppid.S b/mdk-stage1/dietlibc/syscalls.s/getppid.S
deleted file mode 100644
index b05e64ae3..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getppid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getppid,getppid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getpriority.S b/mdk-stage1/dietlibc/syscalls.s/getpriority.S
deleted file mode 100644
index 848b27ed7..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getpriority.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getpriority,getpriority)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getresgid.S b/mdk-stage1/dietlibc/syscalls.s/getresgid.S
deleted file mode 100644
index a1d873c15..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getresgid.S
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __NR_getresgid
-
-syscall(getresgid,getresgid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getresuid.S b/mdk-stage1/dietlibc/syscalls.s/getresuid.S
deleted file mode 100644
index 62f6d764f..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getresuid.S
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __getresuid
-
-syscall(getresuid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getrlimit.S b/mdk-stage1/dietlibc/syscalls.s/getrlimit.S
deleted file mode 100644
index 1c63c0196..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getrlimit.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getrlimit,getrlimit)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getrusage.S b/mdk-stage1/dietlibc/syscalls.s/getrusage.S
deleted file mode 100644
index 2972c4938..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getrusage.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getrusage,getrusage)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getsid.S b/mdk-stage1/dietlibc/syscalls.s/getsid.S
deleted file mode 100644
index cf5cce9d5..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getsid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getsid,getsid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/gettimeofday.S b/mdk-stage1/dietlibc/syscalls.s/gettimeofday.S
deleted file mode 100644
index f364b787a..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/gettimeofday.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(gettimeofday,gettimeofday)
diff --git a/mdk-stage1/dietlibc/syscalls.s/getuid.S b/mdk-stage1/dietlibc/syscalls.s/getuid.S
deleted file mode 100644
index c53c25a7a..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/getuid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(getuid,getuid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/ioctl.S b/mdk-stage1/dietlibc/syscalls.s/ioctl.S
deleted file mode 100644
index 463d319dc..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/ioctl.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(ioctl,ioctl)
diff --git a/mdk-stage1/dietlibc/syscalls.s/ioperm.S b/mdk-stage1/dietlibc/syscalls.s/ioperm.S
deleted file mode 100644
index 0acfde07a..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/ioperm.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(ioperm,ioperm)
diff --git a/mdk-stage1/dietlibc/syscalls.s/iopl.S b/mdk-stage1/dietlibc/syscalls.s/iopl.S
deleted file mode 100644
index 06a6c53fb..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/iopl.S
+++ /dev/null
@@ -1,6 +0,0 @@
-
-#include "syscalls.h"
-
-#ifdef __NR_iopl
-syscall(iopl,iopl)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/ipc.S b/mdk-stage1/dietlibc/syscalls.s/ipc.S
deleted file mode 100644
index 40479400d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/ipc.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(ipc,__ipc)
diff --git a/mdk-stage1/dietlibc/syscalls.s/kill.S b/mdk-stage1/dietlibc/syscalls.s/kill.S
deleted file mode 100644
index eb466dd33..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/kill.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(kill,kill)
diff --git a/mdk-stage1/dietlibc/syscalls.s/lchown.S b/mdk-stage1/dietlibc/syscalls.s/lchown.S
deleted file mode 100644
index 19dfefaef..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/lchown.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(lchown,lchown)
diff --git a/mdk-stage1/dietlibc/syscalls.s/link.S b/mdk-stage1/dietlibc/syscalls.s/link.S
deleted file mode 100644
index 8015d11c8..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/link.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(link,link)
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/lseek.S b/mdk-stage1/dietlibc/syscalls.s/lseek.S
deleted file mode 100644
index 93707a22a..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/lseek.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(lseek,lseek,__libc_lseek)
diff --git a/mdk-stage1/dietlibc/syscalls.s/lstat.S b/mdk-stage1/dietlibc/syscalls.s/lstat.S
deleted file mode 100644
index 5720161c0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/lstat.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(lstat,lstat)
diff --git a/mdk-stage1/dietlibc/syscalls.s/lstat64.S b/mdk-stage1/dietlibc/syscalls.s/lstat64.S
deleted file mode 100644
index 33fd5ab94..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/lstat64.S
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "dietfeatures.h"
-#include "syscalls.h"
-
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-syscall(lstat64,__dietlibc_lstat64)
-#else
-syscall(lstat64,lstat64)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/mkdir.S b/mdk-stage1/dietlibc/syscalls.s/mkdir.S
deleted file mode 100644
index d6214ee46..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/mkdir.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(mkdir,mkdir)
diff --git a/mdk-stage1/dietlibc/syscalls.s/mknod.S b/mdk-stage1/dietlibc/syscalls.s/mknod.S
deleted file mode 100644
index c1b2af12d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/mknod.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(mknod,mknod)
diff --git a/mdk-stage1/dietlibc/syscalls.s/mlockall.S b/mdk-stage1/dietlibc/syscalls.s/mlockall.S
deleted file mode 100644
index 6ad0eef9d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/mlockall.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(mlockall,mlockall)
diff --git a/mdk-stage1/dietlibc/syscalls.s/mount.S b/mdk-stage1/dietlibc/syscalls.s/mount.S
deleted file mode 100644
index 2fd845561..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/mount.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(mount,mount)
diff --git a/mdk-stage1/dietlibc/syscalls.s/mprotect.S b/mdk-stage1/dietlibc/syscalls.s/mprotect.S
deleted file mode 100644
index 73e9a8e17..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/mprotect.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(mprotect,mprotect)
diff --git a/mdk-stage1/dietlibc/syscalls.s/mremap.S b/mdk-stage1/dietlibc/syscalls.s/mremap.S
deleted file mode 100644
index 259ccec99..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/mremap.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(mremap,mremap)
diff --git a/mdk-stage1/dietlibc/syscalls.s/munlockall.S b/mdk-stage1/dietlibc/syscalls.s/munlockall.S
deleted file mode 100644
index 776811dea..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/munlockall.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(munlockall,munlockall)
diff --git a/mdk-stage1/dietlibc/syscalls.s/munmap.S b/mdk-stage1/dietlibc/syscalls.s/munmap.S
deleted file mode 100644
index b43a7b22d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/munmap.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(munmap,munmap)
diff --git a/mdk-stage1/dietlibc/syscalls.s/nanosleep.S b/mdk-stage1/dietlibc/syscalls.s/nanosleep.S
deleted file mode 100644
index 279a52604..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/nanosleep.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(nanosleep,nanosleep,__libc_nanosleep)
diff --git a/mdk-stage1/dietlibc/syscalls.s/nice.S b/mdk-stage1/dietlibc/syscalls.s/nice.S
deleted file mode 100644
index 7d3f740b2..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/nice.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(nice,nice)
diff --git a/mdk-stage1/dietlibc/syscalls.s/open.S b/mdk-stage1/dietlibc/syscalls.s/open.S
deleted file mode 100644
index 280efd0d9..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/open.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(open,open,__libc_open)
diff --git a/mdk-stage1/dietlibc/syscalls.s/pause.S b/mdk-stage1/dietlibc/syscalls.s/pause.S
deleted file mode 100644
index cdf42cabd..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/pause.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(pause,pause,__libc_pause)
diff --git a/mdk-stage1/dietlibc/syscalls.s/personality.S b/mdk-stage1/dietlibc/syscalls.s/personality.S
deleted file mode 100644
index 34b467084..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/personality.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __NR_personality
-syscall(personality,personality)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/pipe.S b/mdk-stage1/dietlibc/syscalls.s/pipe.S
deleted file mode 100644
index 03994d055..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/pipe.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(pipe,pipe)
diff --git a/mdk-stage1/dietlibc/syscalls.s/poll.S b/mdk-stage1/dietlibc/syscalls.s/poll.S
deleted file mode 100644
index 359f55ddd..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/poll.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(poll,poll)
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/query_module.S b/mdk-stage1/dietlibc/syscalls.s/query_module.S
deleted file mode 100644
index cb2f1d852..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/query_module.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __NR_query_module
-syscall(query_module,query_module)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/read.S b/mdk-stage1/dietlibc/syscalls.s/read.S
deleted file mode 100644
index 33fdb7531..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/read.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(read,read,__libc_read)
diff --git a/mdk-stage1/dietlibc/syscalls.s/readlink.S b/mdk-stage1/dietlibc/syscalls.s/readlink.S
deleted file mode 100644
index 850e77c4e..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/readlink.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(readlink,readlink)
diff --git a/mdk-stage1/dietlibc/syscalls.s/readv.S b/mdk-stage1/dietlibc/syscalls.s/readv.S
deleted file mode 100644
index 757c26bfb..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/readv.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(readv,readv)
diff --git a/mdk-stage1/dietlibc/syscalls.s/rename.S b/mdk-stage1/dietlibc/syscalls.s/rename.S
deleted file mode 100644
index f92f1dc5d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/rename.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(rename,rename)
diff --git a/mdk-stage1/dietlibc/syscalls.s/rmdir.S b/mdk-stage1/dietlibc/syscalls.s/rmdir.S
deleted file mode 100644
index 341216e8c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/rmdir.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(rmdir,rmdir)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_max.S b/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_max.S
deleted file mode 100644
index caf403672..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_max.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_get_priority_max,sched_get_priority_max)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_min.S b/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_min.S
deleted file mode 100644
index a0c3337dc..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_min.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_get_priority_min,sched_get_priority_min)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_getparam.S b/mdk-stage1/dietlibc/syscalls.s/sched_getparam.S
deleted file mode 100644
index 7190a40ae..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_getparam.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_getparam,sched_getparam)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_getscheduler.S b/mdk-stage1/dietlibc/syscalls.s/sched_getscheduler.S
deleted file mode 100644
index 08709b65e..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_getscheduler.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_getscheduler,sched_getscheduler)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_rr_get_interval.S b/mdk-stage1/dietlibc/syscalls.s/sched_rr_get_interval.S
deleted file mode 100644
index 150b9a98d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_rr_get_interval.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_rr_get_interval,sched_rr_get_interval)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_setparam.S b/mdk-stage1/dietlibc/syscalls.s/sched_setparam.S
deleted file mode 100644
index 3a6dd1dcc..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_setparam.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_setparam,sched_setparam)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_setscheduler.S b/mdk-stage1/dietlibc/syscalls.s/sched_setscheduler.S
deleted file mode 100644
index 27869d6ce..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_setscheduler.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_setscheduler,sched_setscheduler)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_yield.S b/mdk-stage1/dietlibc/syscalls.s/sched_yield.S
deleted file mode 100644
index ccb9ac1d0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sched_yield.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sched_yield,sched_yield)
diff --git a/mdk-stage1/dietlibc/syscalls.s/select.S b/mdk-stage1/dietlibc/syscalls.s/select.S
deleted file mode 100644
index f585d0449..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/select.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(select,select)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sendfile.S b/mdk-stage1/dietlibc/syscalls.s/sendfile.S
deleted file mode 100644
index 12d6195dd..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sendfile.S
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "syscalls.h"
-#include "dietwarning.h"
-
-syscall_weak(sendfile,sendfile,__libc_sendfile)
-
-link_warning(sendfile,"sendfile is not portable and does not support large files")
diff --git a/mdk-stage1/dietlibc/syscalls.s/setdomainname.S b/mdk-stage1/dietlibc/syscalls.s/setdomainname.S
deleted file mode 100644
index eaade25da..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setdomainname.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setdomainname,setdomainname)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setgid.S b/mdk-stage1/dietlibc/syscalls.s/setgid.S
deleted file mode 100644
index 69b18a9c9..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setgid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setgid,setgid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setgroups.S b/mdk-stage1/dietlibc/syscalls.s/setgroups.S
deleted file mode 100644
index ce8e800a6..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setgroups.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setgroups,setgroups)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sethostname.S b/mdk-stage1/dietlibc/syscalls.s/sethostname.S
deleted file mode 100644
index 7616d4848..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sethostname.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sethostname,sethostname)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setitimer.S b/mdk-stage1/dietlibc/syscalls.s/setitimer.S
deleted file mode 100644
index bcb0623ba..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setitimer.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setitimer,setitimer)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setpgid.S b/mdk-stage1/dietlibc/syscalls.s/setpgid.S
deleted file mode 100644
index e93db31dc..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setpgid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setpgid,setpgid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setpriority.S b/mdk-stage1/dietlibc/syscalls.s/setpriority.S
deleted file mode 100644
index 57d7bc388..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setpriority.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setpriority,setpriority)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setregid.S b/mdk-stage1/dietlibc/syscalls.s/setregid.S
deleted file mode 100644
index 3a7abbc28..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setregid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setregid,setregid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setresgid.S b/mdk-stage1/dietlibc/syscalls.s/setresgid.S
deleted file mode 100644
index 64cbac94e..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setresgid.S
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __setresgid
-
-syscall(setresgid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setresuid.S b/mdk-stage1/dietlibc/syscalls.s/setresuid.S
deleted file mode 100644
index 20b6abee9..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setresuid.S
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __setresuid
-
-syscall(setresuid)
-
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setreuid.S b/mdk-stage1/dietlibc/syscalls.s/setreuid.S
deleted file mode 100644
index 33ca8deed..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setreuid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setreuid,setreuid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setrlimit.S b/mdk-stage1/dietlibc/syscalls.s/setrlimit.S
deleted file mode 100644
index 605105658..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setrlimit.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setrlimit,setrlimit)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setsid.S b/mdk-stage1/dietlibc/syscalls.s/setsid.S
deleted file mode 100644
index d1ef1c58e..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setsid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setsid,setsid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setuid.S b/mdk-stage1/dietlibc/syscalls.s/setuid.S
deleted file mode 100644
index d20571cbf..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/setuid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(setuid,setuid)
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/sigaltstack.S b/mdk-stage1/dietlibc/syscalls.s/sigaltstack.S
deleted file mode 100644
index b07d90f40..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigaltstack.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(sigaltstack,sigaltstack,__sigaltstack)
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)
diff --git a/mdk-stage1/dietlibc/syscalls.s/socketcall.S b/mdk-stage1/dietlibc/syscalls.s/socketcall.S
deleted file mode 100644
index 5837c049a..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/socketcall.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(socketcall,socketcall)
diff --git a/mdk-stage1/dietlibc/syscalls.s/stat.S b/mdk-stage1/dietlibc/syscalls.s/stat.S
deleted file mode 100644
index 2aa3bc088..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/stat.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(stat,stat)
diff --git a/mdk-stage1/dietlibc/syscalls.s/stat64.S b/mdk-stage1/dietlibc/syscalls.s/stat64.S
deleted file mode 100644
index 734fcab20..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/stat64.S
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "dietfeatures.h"
-#include "syscalls.h"
-
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-syscall(stat64,__dietlibc_stat64)
-#else
-syscall(stat64,stat64)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/statfs.S b/mdk-stage1/dietlibc/syscalls.s/statfs.S
deleted file mode 100644
index 7560f569d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/statfs.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(statfs,statfs)
diff --git a/mdk-stage1/dietlibc/syscalls.s/stime.S b/mdk-stage1/dietlibc/syscalls.s/stime.S
deleted file mode 100644
index 9d9f5bf0a..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/stime.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(stime,stime)
diff --git a/mdk-stage1/dietlibc/syscalls.s/swapoff.S b/mdk-stage1/dietlibc/syscalls.s/swapoff.S
deleted file mode 100644
index f75ec94e0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/swapoff.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(swapoff,swapoff)
diff --git a/mdk-stage1/dietlibc/syscalls.s/swapon.S b/mdk-stage1/dietlibc/syscalls.s/swapon.S
deleted file mode 100644
index d10594168..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/swapon.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(swapon,swapon)
diff --git a/mdk-stage1/dietlibc/syscalls.s/symlink.S b/mdk-stage1/dietlibc/syscalls.s/symlink.S
deleted file mode 100644
index 07a6a7fdc..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/symlink.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(symlink,symlink)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sync.S b/mdk-stage1/dietlibc/syscalls.s/sync.S
deleted file mode 100644
index 1ee021693..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sync.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sync,sync)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sysctl.S b/mdk-stage1/dietlibc/syscalls.s/sysctl.S
deleted file mode 100644
index 536e62b3d..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sysctl.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "syscalls.h"
-
-#ifdef __NR_sysctl
-syscall(sysctl,_sysctl)
-#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/sysinfo.S b/mdk-stage1/dietlibc/syscalls.s/sysinfo.S
deleted file mode 100644
index eaec7941e..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sysinfo.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sysinfo,sysinfo)
diff --git a/mdk-stage1/dietlibc/syscalls.s/syslog.S b/mdk-stage1/dietlibc/syscalls.s/syslog.S
deleted file mode 100644
index 6af3c4eac..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/syslog.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(syslog,__syscall_syslog)
diff --git a/mdk-stage1/dietlibc/syscalls.s/time.S b/mdk-stage1/dietlibc/syscalls.s/time.S
deleted file mode 100644
index 26c79091c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/time.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(time,time)
diff --git a/mdk-stage1/dietlibc/syscalls.s/times.S b/mdk-stage1/dietlibc/syscalls.s/times.S
deleted file mode 100644
index dcc8a6dd0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/times.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(times,times)
diff --git a/mdk-stage1/dietlibc/syscalls.s/truncate.S b/mdk-stage1/dietlibc/syscalls.s/truncate.S
deleted file mode 100644
index 7052bdcee..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/truncate.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(truncate,truncate)
diff --git a/mdk-stage1/dietlibc/syscalls.s/umask.S b/mdk-stage1/dietlibc/syscalls.s/umask.S
deleted file mode 100644
index 9f8ffeda6..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/umask.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(umask,umask)
diff --git a/mdk-stage1/dietlibc/syscalls.s/umount.S b/mdk-stage1/dietlibc/syscalls.s/umount.S
deleted file mode 100644
index 4a423d964..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/umount.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(umount,umount)
diff --git a/mdk-stage1/dietlibc/syscalls.s/umount2.S b/mdk-stage1/dietlibc/syscalls.s/umount2.S
deleted file mode 100644
index 4cdd6a200..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/umount2.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(umount2,umount2)
diff --git a/mdk-stage1/dietlibc/syscalls.s/uname.S b/mdk-stage1/dietlibc/syscalls.s/uname.S
deleted file mode 100644
index a460d2aa6..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/uname.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(uname,uname)
diff --git a/mdk-stage1/dietlibc/syscalls.s/unlink.S b/mdk-stage1/dietlibc/syscalls.s/unlink.S
deleted file mode 100644
index bd6713061..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/unlink.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(unlink,unlink)
diff --git a/mdk-stage1/dietlibc/syscalls.s/utime.S b/mdk-stage1/dietlibc/syscalls.s/utime.S
deleted file mode 100644
index 08cd22158..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/utime.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(utime,utime)
diff --git a/mdk-stage1/dietlibc/syscalls.s/vhangup.S b/mdk-stage1/dietlibc/syscalls.s/vhangup.S
deleted file mode 100644
index 6e2d1d343..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/vhangup.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(vhangup,vhangup)
diff --git a/mdk-stage1/dietlibc/syscalls.s/wait4.S b/mdk-stage1/dietlibc/syscalls.s/wait4.S
deleted file mode 100644
index ca6773569..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/wait4.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(wait4,wait4)
diff --git a/mdk-stage1/dietlibc/syscalls.s/waitpid.S b/mdk-stage1/dietlibc/syscalls.s/waitpid.S
deleted file mode 100644
index 5cdc18afb..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/waitpid.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(waitpid,waitpid,__libc_waitpid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/write.S b/mdk-stage1/dietlibc/syscalls.s/write.S
deleted file mode 100644
index ba20395df..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/write.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(write,write,__libc_write)
diff --git a/mdk-stage1/dietlibc/syscalls.s/writev.S b/mdk-stage1/dietlibc/syscalls.s/writev.S
deleted file mode 100644
index 8ec7aa6b0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/writev.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(writev,writev)
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
deleted file mode 100644
index 8488a767e..000000000
--- a/mdk-stage1/disk.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include "stage1.h"
-#include "frontend.h"
-#include "modules.h"
-#include "probing.h"
-#include "log.h"
-#include "mount.h"
-#include "lomount.h"
-#include "automatic.h"
-
-#include "disk.h"
-
-struct partition_detection_anchor {
- off_t offset;
- const char * anchor;
-};
-
-static int seek_and_compare(int fd, struct partition_detection_anchor anch)
-{
- char buf[500];
- size_t count;
- if (lseek(fd, anch.offset, SEEK_SET) == (off_t)-1) {
- log_perror("seek failed");
- return -1;
- }
- count = read(fd, buf, strlen(anch.anchor));
- if (count != strlen(anch.anchor)) {
- log_perror("read failed");
- return -1;
- }
- buf[count] = '\0';
- if (strcmp(anch.anchor, buf))
- return 1;
- return 0;
-}
-
-static const char * detect_partition_type(char * dev)
-{
- struct partition_detection_info {
- const char * name;
- struct partition_detection_anchor anchor0;
- struct partition_detection_anchor anchor1;
- struct partition_detection_anchor anchor2;
- };
- struct partition_detection_info partitions_signatures[] = {
- { "Linux Swap", { 4086, "SWAP-SPACE" }, { 0, NULL }, { 0, NULL } },
- { "Linux Swap", { 4086, "SWAPSPACE2" }, { 0, NULL }, { 0, NULL } },
- { "Ext2", { 0x438, "\x53\xEF" }, { 0, NULL }, { 0, NULL } },
- { "ReiserFS", { 0x10034, "ReIsErFs" }, { 0, NULL }, { 0, NULL } },
- { "ReiserFS", { 0x10034, "ReIsEr2Fs" }, { 0, NULL }, { 0, NULL } },
- { "XFS", { 0, "XFSB" }, { 0x200, "XAGF" }, { 0x400, "XAGI" } },
- { "JFS", { 0x8000, "JFS1" }, { 0, NULL }, { 0, NULL } },
- { "NTFS", { 0x1FE, "\x55\xAA" }, { 0x3, "NTFS" }, { 0, NULL } },
- { "FAT32", { 0x1FE, "\x55\xAA" }, { 0x52, "FAT32" }, { 0, NULL } },
- { "FAT", { 0x1FE, "\x55\xAA" }, { 0x36, "FAT" }, { 0, NULL } },
- { "Linux LVM", { 0, "HM\1\0" }, { 0, NULL }, { 0, NULL } }
- };
- int partitions_signatures_nb = sizeof(partitions_signatures) / sizeof(struct partition_detection_info);
- int i;
- int fd;
-
- char device_fullname[50];
- strcpy(device_fullname, "/dev/");
- strcat(device_fullname, dev);
-
- if (ensure_dev_exists(device_fullname))
- return NULL;
- log_message("guessing type of %s", device_fullname);
-
- if ((fd = open(device_fullname, O_RDONLY, 0)) < 0) {
- log_perror("open");
- return NULL;
- }
-
- for (i=0; i<partitions_signatures_nb; i++) {
- int results = seek_and_compare(fd, partitions_signatures[i].anchor0);
- if (results == -1)
- goto detect_partition_type_end;
- if (results == 1)
- continue;
- if (!partitions_signatures[i].anchor1.anchor)
- goto detect_partition_found_it;
-
- results = seek_and_compare(fd, partitions_signatures[i].anchor1);
- if (results == -1)
- goto detect_partition_type_end;
- if (results == 1)
- continue;
- if (!partitions_signatures[i].anchor2.anchor)
- goto detect_partition_found_it;
-
- results = seek_and_compare(fd, partitions_signatures[i].anchor2);
- if (results == -1)
- goto detect_partition_type_end;
- if (results == 1)
- continue;
-
- detect_partition_found_it:
- return partitions_signatures[i].name;
- }
-
- detect_partition_type_end:
- close(fd);
- return NULL;
-}
-
-static char * disk_extract_list_directory(char * direct)
-{
- char ** full = list_directory(direct);
- char tmp[2000] = "";
- int i;
- for (i=0; i<5 ; i++) {
- if (!full || !*full)
- break;
- strcat(tmp, *full);
- strcat(tmp, "\n");
- full++;
- }
- return strdup(tmp);
-}
-
-static enum return_type try_with_device(char *dev_name)
-{
- char * questions_location[] = { "Directory or ISO image", NULL };
- char * questions_location_auto[] = { "directory", NULL };
- static char ** answers_location = NULL;
- char device_fullname[50];
- char location_full[500];
-
- char * disk_own_mount = "/tmp/hdimage";
-
- int major, minor, blocks;
- char name[100];
-
- char buf[512];
- FILE * f;
- char * parts[50];
- char * parts_comments[50];
- struct stat statbuf;
- int i = 0;
- enum return_type results;
- char * choice;
-
- if (!(f = fopen("/proc/partitions", "rb")) || !fgets(buf, sizeof(buf), f) || !fgets(buf, sizeof(buf), f)) {
- log_perror(dev_name);
- stg1_error_message("Could not read partitions information.");
- return RETURN_ERROR;
- }
-
- while (fgets(buf, sizeof(buf), f)) {
- bzero(name, sizeof(name));
- sscanf(buf, " %d %d %d %s", &major, &minor, &blocks, name);
- if ((strstr(name, dev_name) == name) && (blocks > 1) && (name[strlen(dev_name)] != '\0')) {
- const char * partition_type = detect_partition_type(name);
- parts[i] = strdup(name);
- parts_comments[i] = (char *) malloc(sizeof(char) * 100);
- sprintf(parts_comments[i], "size: %d Mbytes", blocks >> 10);
- if (partition_type) {
- strcat(parts_comments[i], ", type: ");
- strcat(parts_comments[i], partition_type);
- }
- i++;
- }
- }
- parts[i] = NULL;
- fclose(f);
-
- if (parts[0] == NULL) {
- stg1_error_message("No partitions found.");
- return RETURN_ERROR;
- }
-
- results = ask_from_list_comments_auto("Please choose the partition where " DISTRIB_NAME " is copied.",
- parts, parts_comments, &choice, "partition", parts);
- if (results != RETURN_OK)
- return results;
-
- strcpy(device_fullname, "/dev/");
- strcat(device_fullname, choice);
-
- if (my_mount(device_fullname, disk_own_mount, "ext2", 0) == -1 &&
- my_mount(device_fullname, disk_own_mount, "vfat", 0) == -1 &&
- my_mount(device_fullname, disk_own_mount, "reiserfs", 0) == -1) {
- stg1_error_message("I can't find a valid filesystem (tried: ext2, vfat, reiserfs).");
- return try_with_device(dev_name);
- }
-
- if (ask_from_entries_auto("Please enter the directory (or ISO image file) containing the " DISTRIB_NAME " Distribution.",
- questions_location, &answers_location, 24, questions_location_auto, NULL) != RETURN_OK) {
- umount(disk_own_mount);
- return try_with_device(dev_name);
- }
-
- strcpy(location_full, disk_own_mount);
- strcat(location_full, "/");
- strcat(location_full, answers_location[0]);
-
- if (access(location_full, R_OK)) {
- stg1_error_message("Directory or ISO image file could not be found on partition.\n"
- "Here's a short extract of the files in the root of the partition:\n"
- "%s", disk_extract_list_directory(disk_own_mount));
- umount(disk_own_mount);
- return try_with_device(dev_name);
- }
-
- unlink(IMAGE_LOCATION);
-
- if (!stat(location_full, &statbuf) && !S_ISDIR(statbuf.st_mode)) {
- log_message("%s exists and is not a directory, assuming this is an ISO image", location_full);
- if (lomount(location_full, IMAGE_LOCATION)) {
- stg1_error_message("Could not mount file %s as an ISO image of the " DISTRIB_NAME " Distribution.", answers_location[0]);
- umount(disk_own_mount);
- return try_with_device(dev_name);
- }
- } else
- symlink(location_full, IMAGE_LOCATION);
-
- if (IS_SPECIAL_STAGE2 || ramdisk_possible()) {
- /* RAMDISK install */
- if (access(IMAGE_LOCATION RAMDISK_LOCATION, R_OK)) {
- stg1_error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
- "(I need the subdirectory " RAMDISK_LOCATION ")\n"
- "Here's a short extract of the files in the directory:\n"
- "%s", disk_extract_list_directory(IMAGE_LOCATION));
- loumount();
- umount(disk_own_mount);
- return try_with_device(dev_name);
- }
- if (load_ramdisk() != RETURN_OK) {
- stg1_error_message("Could not load program into memory.");
- loumount();
- umount(disk_own_mount);
- return try_with_device(dev_name);
- }
- } else {
- /* LIVE install */
- char p;
- if (access(IMAGE_LOCATION LIVE_LOCATION, R_OK)) {
- stg1_error_message("I can't find the " DISTRIB_NAME " Distribution in the specified directory. "
- "(I need the subdirectory " LIVE_LOCATION ")\n"
- "Here's a short extract of the files in the directory:\n"
- "%s", disk_extract_list_directory(IMAGE_LOCATION));
- loumount();
- umount(disk_own_mount);
- return try_with_device(dev_name);
- }
- if (readlink(IMAGE_LOCATION LIVE_LOCATION "/usr/bin/runinstall2", &p, 1) != 1) {
- stg1_error_message("The " DISTRIB_NAME " Distribution seems to be copied on a Windows partition. "
- "You need more memory to perform an installation from a Windows partition. "
- "Another solution if to copy the " DISTRIB_NAME " Distribution on a Linux partition.");
- loumount();
- umount(disk_own_mount);
- return try_with_device(dev_name);
- }
- log_message("found the " DISTRIB_NAME " Installation, good news!");
- }
-
- if (IS_RESCUE) {
- loumount();
- umount(disk_own_mount);
- }
-
- method_name = strdup("disk");
- return RETURN_OK;
-}
-
-enum return_type disk_prepare(void)
-{
- char ** medias, ** ptr, ** medias_models;
- char * choice;
- int i, count = 0;
- enum return_type results;
-
- my_insmod("sd_mod", ANY_DRIVER_TYPE, NULL);
-
- get_medias(DISK, &medias, &medias_models);
-
- ptr = medias;
- while (ptr && *ptr) {
- count++;
- ptr++;
- }
-
- if (count == 0) {
- stg1_error_message("No DISK drive found.");
- i = ask_insmod(SCSI_ADAPTERS);
- if (i == RETURN_BACK)
- return RETURN_BACK;
- return disk_prepare();
- }
-
- if (count == 1) {
- results = try_with_device(*medias);
- if (results == RETURN_OK)
- return RETURN_OK;
- i = ask_insmod(SCSI_ADAPTERS);
- if (i == RETURN_BACK)
- return RETURN_BACK;
- return disk_prepare();
- }
-
- results = ask_from_list_comments_auto("Please choose the DISK drive on which you copied the " DISTRIB_NAME " Distribution.",
- medias, medias_models, &choice, "disk", medias);
-
- if (results != RETURN_OK)
- return results;
-
- results = try_with_device(choice);
- if (results == RETURN_OK)
- return RETURN_OK;
- i = ask_insmod(SCSI_ADAPTERS);
- if (i == RETURN_BACK)
- return RETURN_BACK;
- return disk_prepare();
-}
diff --git a/mdk-stage1/disk.h b/mdk-stage1/disk.h
deleted file mode 100644
index 54213cf68..000000000
--- a/mdk-stage1/disk.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#ifndef _DISK_H_
-#define _DISK_H_
-
-enum return_type disk_prepare(void);
-
-#endif
diff --git a/mdk-stage1/dns.c b/mdk-stage1/dns.c
deleted file mode 100644
index d1e67c78d..000000000
--- a/mdk-stage1/dns.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#include <stdlib.h>
-
-// dietlibc can do hostname lookup, whereas glibc can't when linked statically :-(
-
-#ifdef __LIBC_DIETLIBC__
-
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <sys/socket.h>
-
-#include "network.h"
-#include "log.h"
-
-#include "dns.h"
-
-int mygethostbyname(char * name, struct in_addr * addr)
-{
- struct hostent * h = gethostbyname(name);
- if (!h) {
- if (domain) {
- // gethostbyname from dietlibc doesn't support domain handling
- char fully_qualified[500];
- sprintf(fully_qualified, "%s.%s", name, domain);
- h = gethostbyname(fully_qualified);
- if (!h) {
- log_message("unknown host %s", name);
- return -1;
- }
- } else
- return -1;
- }
-
- if (h->h_addr_list && (h->h_addr_list)[0]) {
- memcpy(addr, (h->h_addr_list)[0], sizeof(*addr));
- log_message("is-at: %s", inet_ntoa(*addr));
- return 0;
- }
- return -1;
-}
-
-char * mygethostbyaddr(char * ipnum)
-{
- struct in_addr in;
- struct hostent * host;
- if (!inet_aton(ipnum, &in))
- return NULL;
- host = gethostbyaddr(&in, strlen((void *) &in), AF_INET);
- if (host && host->h_name)
- return host->h_name;
- return NULL;
-}
-
-
-#else // __LIBC_DIETLIBC__
-
-#include <alloca.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <resolv.h>
-#include <arpa/nameser.h>
-#include <arpa/inet.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "log.h"
-
-#include "dns.h"
-
-/* This is dumb, but glibc doesn't like to do hostname lookups w/o libc.so */
-
-union dns_response {
- HEADER hdr;
- u_char buf[PACKETSZ];
-} ;
-
-static int do_query(char * query, int queryType, char ** domainName, struct in_addr * ipNum)
-{
- int len, ancount, type;
- u_char * data, * end;
- char name[MAXDNAME];
- union dns_response response;
-
-#ifdef __sparc__
- /* from jj: */
- /* We have to wait till ethernet negotiation is done */
- _res.retry = 3;
-#else
- _res.retry = 2;
-#endif
-
-
- len = res_search(query, C_IN, queryType, (void *) &response, sizeof(response));
- if (len <= 0)
- return -1;
-
- if (ntohs(response.hdr.rcode) != NOERROR)
- return -1;
-
- ancount = ntohs(response.hdr.ancount);
- if (ancount < 1)
- return -1;
-
- data = response.buf + sizeof(HEADER);
- end = response.buf + len;
-
- /* skip the question */
- data += dn_skipname(data, end) + QFIXEDSZ;
-
- /* parse the answer(s) */
- while (--ancount >= 0 && data < end) {
-
- /* skip the domain name portion of the RR record */
- data += dn_skipname(data, end);
-
- /* get RR information */
- GETSHORT(type, data);
- data += INT16SZ; /* skipp class */
- data += INT32SZ; /* skipp TTL */
- GETSHORT(len, data);
-
- if (type == T_PTR) {
- /* we got a pointer */
- len = dn_expand(response.buf, end, data, name, sizeof(name));
- if (len <= 0) return -1;
- if (queryType == T_PTR && domainName) {
- /* we wanted a pointer */
- *domainName = malloc(strlen(name) + 1);
- strcpy(*domainName, name);
- return 0;
- }
- } else if (type == T_A) {
- /* we got an address */
- if (queryType == T_A && ipNum) {
- /* we wanted an address */
- memcpy(ipNum, data, sizeof(*ipNum));
- return 0;
- }
- }
-
- /* move ahead to next RR */
- data += len;
- }
-
- return -1;
-}
-
-char * mygethostbyaddr(char * ipnum) {
- int rc;
- char * result;
- char * strbuf;
- char * chptr;
- char * splits[4];
- int i;
-
- _res.retry = 1;
-
- strbuf = alloca(strlen(ipnum) + 1);
- strcpy(strbuf, ipnum);
-
- ipnum = alloca(strlen(strbuf) + 20);
-
- for (i = 0; i < 4; i++) {
- chptr = strbuf;
- while (*chptr && *chptr != '.')
- chptr++;
- *chptr = '\0';
-
- if (chptr - strbuf > 3) return NULL;
- splits[i] = strbuf;
- strbuf = chptr + 1;
- }
-
- sprintf(ipnum, "%s.%s.%s.%s.in-addr.arpa", splits[3], splits[2], splits[1], splits[0]);
-
- rc = do_query(ipnum, T_PTR, &result, NULL);
-
- if (rc)
- return NULL;
- else
- return result;
-}
-
-int mygethostbyname(char * name, struct in_addr * addr) {
- int rc = do_query(name, T_A, NULL, addr);
- if (!rc)
- log_message("is-at %s", inet_ntoa(*addr));
- return rc;
-}
-
-#endif
diff --git a/mdk-stage1/dns.h b/mdk-stage1/dns.h
deleted file mode 100644
index 97af9c08a..000000000
--- a/mdk-stage1/dns.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#ifndef H_DNS
-#define H_DNS
-
-#include <netinet/in.h>
-
-int mygethostbyname(char * name, struct in_addr * addr);
-char * mygethostbyaddr(char * ipnum);
-
-#endif
diff --git a/mdk-stage1/doc/HACKING b/mdk-stage1/doc/HACKING
deleted file mode 100644
index d196c8010..000000000
--- a/mdk-stage1/doc/HACKING
+++ /dev/null
@@ -1,31 +0,0 @@
-If you have to boot pretty often, you'll appreciate to speed the things up
-a little.
-
-Here's what we use: the GRUB feature to boot from the network using the
-DHCP protocol and the TFTP protocol.
-
-Here's the "menu.lst" to do that:
-
--=-=--
-
-timeout 0
-
-title linux
-dhcp
-tftpserver 192.168.1.17
-kernel (nd)/tftpboot/gc/vmlinuz ramdisk=32000 vga=788
-initrd (nd)/tftpboot/gc/network.rdz
-
--=-=--
-
-
-The option "tftpserver" is used to override the tftpserver address given
-as an answer by the DHCP server. That way, you'll not need to bother your
-system administrator to modify his dhcp server configuration.
-
-The directory /tftpboot seems to be the only one defaultly accepted by the
-server, and its subdirs.
-
-
-Of course, your GRUB needs to be compiled with the specific code for your
-network card; use ./configure --help in the GRUB build dir for more infos.
diff --git a/mdk-stage1/doc/README b/mdk-stage1/doc/README
deleted file mode 100644
index 09edce6c2..000000000
--- a/mdk-stage1/doc/README
+++ /dev/null
@@ -1,185 +0,0 @@
--------------------------------------------------------
-* Stage1 of the Mandrake Linux installation program *
--------------------------------------------------------
-
-
-[ Author ]
-
- Guillaume Cottenceau (gc@mandrakesoft.com)
-
-
-[ Copyright ]
-
- Copyright 2000 MandrakeSoft
-
- Partially inspired by Redhat stuff (install from 5.x and 7.x) copyright
- Red Hat Software, and Debian stuff (boot-floppies) copyright by their
- respective holders.
-
-
-[ Licence ]
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
- *** WARNING! ***
-
- This General Public License does not permit incorporating any part
- of this program as a library into proprietary programs.
-
-
-[ Online ]
-
- http://us.mandrakesoft.com/~gc/html/stage1.html
-
-
-[ Purpose ]
-
- This code will take the control of the computer after that Linux
- kernel booted properly, and will try to run the main installer
- (also known as "stage 2") from a series of different media
- including harddrive, cdrom, and network.
-
- Use the source, Luke.
-
-
-
-
- -=-=-- Okay, now, more details --=-=-
-
-
- [ Installing Mandrake Linux ]
-
-Per default, just insert your Mandrake Linux Installation CD into your
-CDROM tray, be sure your system BIOS is configured to boot on your CDROM,
-and that's all.
-
-If you have multiple CDROM drives and the installer can't autodetect in
-which CDROM drive is the disc, it may ask you to choose the correct drive,
-between your CDROM drives.
-
-Also, if you want to install from an SCSI CDROM, the installer should
-detect your SCSI adapter; if it fails you may have to select the right
-driver and/or supply additional parameters.
-
-
- [ Position of the problem ]
-
-The need for alternate installation methods come with more specific
-hardware configuration and/or need for frequent updates of the Installer
-software.
-
-All of these methods will require to use a special boot disk. The method
-is to download it and then to copy it "physically" to a floppy with the
-command:
-
-# dd if=<boot-disk> of=/dev/fd0
-
-Our boot disks are called "cdrom.img", "network.img", etc.
-
-
- [ Installation from CDROM ]
-
-The first situation you may encounter is an old BIOS which does not permit
-you to boot from your CDROM drive.
-
-In that case, you'll need to use the "cdrom.img" image file. The steps are
-the same as with CDROM boot, and everything should be automatic.
-
-
- [ Installation from DISK ]
-
-If you like trying occasionnally our development version, the Cooker, one
-of the easiest way is to grab a local copy of the Distribution on one of
-your local hard drives, and to install from that location.
-
-At present time, you can install from IDE or SCSI drives, from Linux
-(ext2), Windows (vfat) or Reiserfs partition.
-
-In that case, you'll need to use the "hd.img" image file. The dialogs will
-ask you to choose the DISK drive to use to install from, then the
-partition on which you copied the Distribution, then the location
-(directory) in which you copied the Distribution.
-
-
- [ Installation from NETWORK ]
-
-For convenience, you can also install from a NFS volume, from a FTP
-server, or from a HTTP server. NFS installs are maybe the fastest
-and most convenient possible, so if you need to do frequent and/or
-multiple installs, you may like this option.
-
-In that case, you'll need to use the "network.img" image file. If you have
-PCI network card(s), you'll probably have to only setup your network
-options. If not, you'll have to choose the appropriate driver(s) and/or
-optional parameters. Supported network configurations include static IP
-allocation and DHCP automatic configuration.
-
-
- [ Installation from PCMCIA ]
-
-If you want to perform an installation on your laptop that is not based on
-local IDE CDROM or DISK, nor on built-in network card, but on PCMCIA
-extension (probably a network adapter or CDROM drive), you'll need the
-"pcmcia.img" image file.
-
-PCMCIA services should automatically start and be transparent to you.
-Then, you'll follow the instructions according to your preferred
-installation method.
-
-
- [ Monitoring a stage1 session ]
-
-Linux supports virtual consoles. You can switch between them by issueing
-Ctrl+Alt+Fx key, in which 'x' is the number of the console. Here's console
-occupancy during stage1.
-
-(#1) The user-interface of the stage1 is on the first console. In case of
-newt interaction, it's provided with a neat blue and black color scheme,
-and nice widgets. In case of stdio interaction (cdrom and disk installs),
-it's more basic but still usable :-).
-
-(#2) A shell is provided on second console in some cases (you need to
-compile it with -DSPAWN_SHELL and you need to provide a valid shell in the
-initrd) and of course it's not in, in image files of Mandrake Linux
-releases because it's too much diskspace.
-
-(#3) The log is printed out on the third console. This is the location
-where you can find most valuable information, prefixed by a '*'. See
-"log.h" for calls that print things out to the log.
-
-(#4) The kernel messages are printed on the fourth console. There is a
-process forked very early in the init (the program before the stage1)
-which monitors /proc/kmsg for new kernel messages. Also, syslog stuff (the
-logs commited by the programs) should appear on the /dev/log Unix socket,
-this is also printed on this console.
-
-(#5) Former place for the stderr of insmod calls. It's not used anymore.
-
-(#6) Place where a trivial interactive communication with the stage1 is
-set up if the parameter -DSPAWN_INTERACTIVE is compiled in. Basically, you
-can set switches such as "expert" and "rescue" on the fly with this
-feature. It's implemented with a fork and a Unix pipe.
-
-
- [ Rescueing a system ]
-
-Since Mandrake Linux 7.1, we provide a rescue system through each of the
-previously described methods. You don't need a special "rescue.img" file.
-Just hit "F1" at boot time, type in "rescue", and follow the first steps
-of the installation according to the method you chose (choose
-disks/partitions for disk method, network parameters for network method,
-etc). Then, you'll end up with a workable system, very useful to rescue a
-damaged system, or do other basic actions.
diff --git a/mdk-stage1/doc/TECH-INFOS b/mdk-stage1/doc/TECH-INFOS
deleted file mode 100644
index 074b35d31..000000000
--- a/mdk-stage1/doc/TECH-INFOS
+++ /dev/null
@@ -1,91 +0,0 @@
-
-| (*) Automatic install
-\----------------------
-
-This feature is used to replace redhat kickstart. It uses the kernel
-parameter "automatic" with keywords separated with commas and colons, on
-the following genres:
-
- automatic=method:nfs,network:static,ip:192.168.1.24,server:192.168.1.7,directory:/stable/i586
-
- automatic=method:ftp,network:dhcp,server:ftp.ciril.fr,directory:/pub/linux/mandrake-devel/cooker
-
- automatic=method:ftp,network:dhcp,server:companyserver,directory:/mdkinst,user:XXX,pass:XXX
-
- automatic=method:ftp,interface:eth1,network:dhcp,...
-
- automatic=method:ftp,network:adsl,adsluser:XXX,adslpass:XXX,...
-
- automatic=method:cdrom
-
- automatic=method:disk,disk:hdb,partition:hdb7
-
-
-The keywords correspond to each "virtual" question answered automatically,
-either from a list or from a free field.
-
-
-Keywords are:
-
-
-`method' <- (nfs,ftp,http,cdrom,disk)
-
-if nfs/ftp/http:
-
- `network' <- (static,dhcp,adsl)
-
- if multiple interfaces detected:
-
- `interface' <- (list-of-detected-interfaces)
-
- fi
-
- if static:
-
- `ip', `dns', `gateway', `netmask' (free fields)
-
- elsif adsl:
-
- `adsluser', `adslpass' (free field)
-
- fi
-
- if resolving fails:
-
- `hostname', `domain' (free fields)
-
- fi
-
- `server', `directory' (free fields)
-
- if ftp:
-
- `user', `pass' (free fields)
-
- fi
-
-fi
-
-if disk:
-
- `disk' <- (list-of-detected-disks)
-
- `partition' <- (list-of-detected-partitions)
-
- `directory' (free fields)
-
-fi
-
-
-
-You may use shorter versions of keywords (it helps reducing size of
-commandline), please find each keyword short-alias counterpart in file
-../automatic.c under the identifier named "short_aliases".
-
-This gives for example for:
-
- automatic=method:nfs,network:static,ip:192.168.1.24,server:192.168.1.7,directory:/stable/i586
-==>
- automatic=met:nfs,net:static,ip:192.168.1.24,ser:192.168.1.7,dir:/stable/i586
-
-
diff --git a/mdk-stage1/doc/UPDATEMODULES b/mdk-stage1/doc/UPDATEMODULES
deleted file mode 100644
index 89d86d365..000000000
--- a/mdk-stage1/doc/UPDATEMODULES
+++ /dev/null
@@ -1,74 +0,0 @@
-This is the documentation for the "Update Modules" (Update Drivers)
-feature.
-
-This feature aims to propose new modules or replacement modules for the
-install. This is useful when there is a firmware update for a given
-driver, an additional driver needed for something, etc.
-
-
-You must use a floppy disk with e2fs filesystem (NOT vfat/windows
-formatted). Use "mke2fs /dev/fd0" on your own box to format a floppy with
-e2fs filesystem.
-
-This disk may contain a number of kernel modules on the root (e.g. not in
-a subdirectory); some of them may replace existing modules, some of them
-may be added. This disk must contain a special file, named "to_load", on
-the root (not in a subdirectory). This file will contain a series of
-module names, with optional module options; the program will try to load
-all these modules one after another, using file on the floppy if present,
-else using file within standard module repository ("marfile" on the boot
-floppy). It can contain comments, these are strictly defined by the
-presence of a hash (#) character on column 0 of any line.
-
-
-Here's a typical scenario:
-
-
-1. Boot the floppy (or cdrom) with the option "updatemodules"
-
- (you may do that by pressing F1 then entering "linux updatemodules")
-
-
-2. At the very beginning of the User Interface, you are asked to insert
- the Update Modules disk. Insert the Update Modules disk and press
- Enter.
-
---=----=----=----=----=----=----=----=----=--
-Our example disk contains:
-
-[root@obiwan mnt]# ll floppy/
-total 77
-drwxr-xr-x 2 root root 12288 Jul 26 12:02 lost+found/
--rw-r--r-- 1 root root 9051 Jul 26 12:43 msdos.o
--rw-r--r-- 1 root root 13660 Jul 26 12:04 ppa.o
--rw-r--r-- 1 root root 54 Jul 26 12:46 to_load
--rw-r--r-- 1 root root 32108 Jul 26 12:04 uhci.o
--rw-r--r-- 1 root root 6572 Jul 26 12:04 wacom.o
-[root@obiwan mnt]# cat floppy/to_load
-# Update Drivers description file
-3c59x
-# fat is a dep for msdos
-fat
-# updated msdos (handling of 9+4 filenames)
-msdos
-ppa
-# ISA network card needing options
-ne io=0x300 irq=7
-[root@obiwan mnt]#
---=----=----=----=----=----=----=----=----=--
-
-
-3. The program reads the special file "to_load" and processes the files.
-
- a- 3c59x loaded from the marfile on the boot floppy
- b- fat loaded from the marfile on the boot floppy
- c- msdos loaded from the update modules floppy
- d- ppa loaded from the update modules floppy
- e- ne loaded from the marfile on the boot floppy
-
-
-
-!!! Beware !!!, the dependencies are not handled automatically in
-the case of load from the update modules floppy, that's why on
-our example we need to load "fat" from the standard modules
-before "msdos" from the update floppy.
diff --git a/mdk-stage1/doc/WHY-DIETLIBC b/mdk-stage1/doc/WHY-DIETLIBC
deleted file mode 100644
index e7c526b49..000000000
--- a/mdk-stage1/doc/WHY-DIETLIBC
+++ /dev/null
@@ -1,50 +0,0 @@
-(the dietlibc is a replacement for the glibc, which aim is to produce
-smaller statically linked binaries)
-
-
-The use for dietlibc in the stage1 was clear because currently used
-install process on x86 is from a 1.44 Mbytes floppy. On this floppy we
-need to fit the kernel, modules (scsi and network access), and the code to
-do the basic things to load the stage2. The only part on which we could
-progress was the code.
-
-As always, figures demonstrate evidences. Here are the size of the
-binaries used for the cdrom, disk, network and full floppy installs, using
-newt as the UI library:
-
- - with glibc
-
--rwxr-xr-x 1 gc gc 569448 May 15 15:29 stage1-cdrom
--rwxr-xr-x 1 gc gc 572264 May 15 15:29 stage1-disk
--rwxr-xr-x 1 gc gc 624712 May 15 15:30 stage1-network
--rwxr-xr-x 1 gc gc 720360 May 15 15:29 stage1-full
-
- - with dietlibc
-
--rwxr-xr-x 1 gc gc 169332 May 15 14:26 stage1-cdrom
--rwxr-xr-x 1 gc gc 172180 May 15 14:26 stage1-disk
--rwxr-xr-x 1 gc gc 198612 May 15 14:26 stage1-network
--rwxr-xr-x 1 gc gc 251764 May 15 14:26 stage1-full
-
-
-The `stage1-full' binary has code for many things, most notably: data
-decrunching (bzlib), archive extraction (in-house format), module loading
-(insmod from busybox), PCI detection, ide and scsi handling,
-cdrom/disk/loopback mounting, DHCP client negociation (redhat+grub), NFS
-mounting (util-linux), FTP and HTTP transmission (redhat), pcmcia
-initializing (pcmcia-cs), UI interaction (slang/newt); with use of the
-dietlibc, the binary is only 250 kbytes!
-
-
-Due to the modular coding, it is also possible to choose to not use
-slang/newt as the UI, but a stdio-only UI. In that case, the binaries get
-even smaller:
-
--rwxr-xr-x 1 gc gc 104500 May 15 15:46 stage1-cdrom*
--rwxr-xr-x 1 gc gc 107348 May 15 15:46 stage1-disk*
--rwxr-xr-x 1 gc gc 133972 May 15 15:47 stage1-network*
--rwxr-xr-x 1 gc gc 187348 May 15 15:46 stage1-full*
-
-
-
-gc [Tue May 15 15:58:34 2001] \ No newline at end of file
diff --git a/mdk-stage1/doc/documented..frontend.h b/mdk-stage1/doc/documented..frontend.h
deleted file mode 100644
index 10417ef3b..000000000
--- a/mdk-stage1/doc/documented..frontend.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Using high-level UI.
- *
- * These functions are frontend-independant: your program won't know each
- * `frontend' (e.g. each way to grab user input) will be used.
- *
- * Then you may link your binary against any `frontend' that implement all
- * these functions (and possibly necessary libraries).
- */
-
-
-#ifndef _FRONTEND_H_
-#define _FRONTEND_H_
-
-/* this must be called before anything else */
-void init_frontend(void);
-
-/* this must be called before exit of program */
-void finish_frontend(void);
-
-
-void info_message(char *msg, ...) __attribute__ ((format (printf, 1, 2))); /* (blocks program) */
-
-void error_message(char *msg, ...) __attribute__ ((format (printf, 1, 2))); /* (blocks program) */
-
-/* (doesn't block program)
- * (this is not necessarily stackable, e.g. only one wait_message at a time) */
-void wait_message(char *msg, ...) __attribute__ ((format (printf, 1, 2)));
-
-/* call this to finish the wait on wait_message */
-void remove_wait_message(void);
-
-/* monitor progression of something (downloading a file, etc)
- * if size of progression is unknown, use `0' */
-void init_progression(char *msg, int size);
-void update_progression(int current_size);
-void end_progression(void);
-
-enum frontend_return { RETURN_OK, RETURN_BACK, RETURN_ERROR };
-
-/* Yes == RETURN_OK No == RETURN_ERROR Back == RETURN_BACK */
-enum frontend_return ask_yes_no(char *msg);
-
-/* [elems] NULL terminated array of char*
- * [choice] address of a (unitialized) char* */
-enum frontend_return ask_from_list(char *msg, char ** elems, char ** choice);
-
-enum frontend_return ask_from_list_comments(char *msg, char ** elems, char ** elems_comments, char ** choice);
-
-/* [questions] NULL terminated array of char*
- * [answers] address of a (unitialized) char**, will contain a non-NULL terminated array of char*
- * [callback_func] function called at most when the answers change; it can examine the array of char* and assign some new char* */
-enum frontend_return ask_from_entries(char *msg, char ** questions, char *** answers, int entry_size, void (*callback_func)(char ** strings));
-
-#endif
diff --git a/mdk-stage1/frontend-common.c b/mdk-stage1/frontend-common.c
deleted file mode 100644
index caddeb7d4..000000000
--- a/mdk-stage1/frontend-common.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "frontend.h"
-
-
-void info_message(char *msg, ...)
-{
- va_list args;
- va_start(args, msg);
- vinfo_message(msg, args);
- va_end(args);
-}
-
-void wait_message(char *msg, ...)
-{
- va_list args;
- va_start(args, msg);
- vwait_message(msg, args);
- va_end(args);
-}
-
-void error_message(char *msg, ...)
-{
- va_list args;
- va_start(args, msg);
- verror_message(msg, args);
- va_end(args);
-}
diff --git a/mdk-stage1/frontend.h b/mdk-stage1/frontend.h
deleted file mode 100644
index 9c2609281..000000000
--- a/mdk-stage1/frontend.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * For doc please read doc/documented..frontend.h
- */
-
-#ifndef _FRONTEND_H_
-#define _FRONTEND_H_
-
-#include <stdarg.h>
-
-
-enum return_type { RETURN_OK, RETURN_BACK, RETURN_ERROR };
-
-void init_frontend(char * welcome_msg);
-void finish_frontend(void);
-
-void error_message(char *msg, ...) __attribute__ ((format (printf, 1, 2))); /* blocking */
-void info_message(char *msg, ...) __attribute__ ((format (printf, 1, 2))); /* blocking */
-void wait_message(char *msg, ...) __attribute__ ((format (printf, 1, 2))); /* non-blocking */
-void remove_wait_message(void);
-
-void init_progression(char *msg, int size);
-void update_progression(int current_size);
-void end_progression(void);
-
-enum return_type ask_yes_no(char *msg);
-enum return_type ask_from_list(char *msg, char ** elems, char ** choice);
-enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_comments, char ** choice);
-enum return_type ask_from_entries(char *msg, char ** questions, char *** answers, int entry_size, void (*callback_func)(char ** strings));
-
-void suspend_to_console(void);
-void resume_from_suspend(void);
-
-void verror_message(char *msg, va_list ap);
-void vinfo_message(char *msg, va_list ap);
-void vwait_message(char *msg, va_list ap);
-
-
-#endif
diff --git a/mdk-stage1/init-data/emptyboot.img.bz2 b/mdk-stage1/init-data/emptyboot.img.bz2
deleted file mode 100644
index 6ae939c1b..000000000
--- a/mdk-stage1/init-data/emptyboot.img.bz2
+++ /dev/null
Binary files differ
diff --git a/mdk-stage1/init-data/msgboot-blank.img.bz2 b/mdk-stage1/init-data/msgboot-blank.img.bz2
deleted file mode 100644
index a572093d9..000000000
--- a/mdk-stage1/init-data/msgboot-blank.img.bz2
+++ /dev/null
Binary files differ
diff --git a/mdk-stage1/init-data/msgboot-graphicallogo-2880.img.bz2 b/mdk-stage1/init-data/msgboot-graphicallogo-2880.img.bz2
deleted file mode 100644
index 9d5d276fb..000000000
--- a/mdk-stage1/init-data/msgboot-graphicallogo-2880.img.bz2
+++ /dev/null
Binary files differ
diff --git a/mdk-stage1/init-data/msgboot-graphicallogo.img.bz2 b/mdk-stage1/init-data/msgboot-graphicallogo.img.bz2
deleted file mode 100644
index cbbdb8cc7..000000000
--- a/mdk-stage1/init-data/msgboot-graphicallogo.img.bz2
+++ /dev/null
Binary files differ
diff --git a/mdk-stage1/init-data/msgboot.img.bz2 b/mdk-stage1/init-data/msgboot.img.bz2
deleted file mode 100644
index e06018f11..000000000
--- a/mdk-stage1/init-data/msgboot.img.bz2
+++ /dev/null
Binary files differ
diff --git a/mdk-stage1/init-libc-headers.h b/mdk-stage1/init-libc-headers.h
deleted file mode 100644
index 01761e869..000000000
--- a/mdk-stage1/init-libc-headers.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mount.h>
-#include <linux/un.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <linux/unistd.h>
-#include <sys/select.h>
-
-#ifndef SOCK_STREAM
-#define SOCK_STREAM 1
-#endif
-
-static inline _syscall3(int, syslog, int, type, char *, bufp, int, len);
-static inline _syscall3(int, reboot, int, magic, int, magic2, int, flag);
diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c
deleted file mode 100644
index dc4239ac3..000000000
--- a/mdk-stage1/init.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
- *
- * Copyright 2000 MandrakeSoft
- *
- * This software may be freely redistributed under the terms of the GNU
- * public license.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
- * Portions from Erik Troan (ewt@redhat.com)
- *
- * Copyright 1996 Red Hat Software
- *
- */
-
-#ifndef INIT_HEADERS
-#include "init-libc-headers.h"
-#else
-#include INIT_HEADERS
-#endif
-
-#include "config-stage1.h"
-
-#if defined(__powerpc__)
-#define TIOCSCTTY 0x540
-#endif
-
-char * env[] = {
- "PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sbin:/mnt/usr/sbin:/mnt/bin:/mnt/usr/bin",
- "LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/usr/X11R6/lib:/mnt/usr/X11R6/lib",
- "HOME=/",
- "TERM=linux",
- "TERMINFO=/etc/terminfo",
- NULL
-};
-
-
-/*
- * this needs to handle the following cases:
- *
- * 1) run from a CD root filesystem
- * 2) run from a read only nfs rooted filesystem
- * 3) run from a floppy
- * 4) run from a floppy that's been loaded into a ramdisk
- *
- */
-
-int testing;
-int klog_pid;
-
-
-void fatal_error(char *msg)
-{
- printf("FATAL ERROR IN INIT: %s\n\nI can't recover from this, please reboot manually and send bugreport.\n", msg);
- while (1);
-}
-
-void print_error(char *msg)
-{
- printf("E: %s\n", msg);
-}
-
-void print_warning(char *msg)
-{
- printf("W: %s\n", msg);
-}
-
-void print_int_init(int fd, int i)
-{
- char buf[10];
- char * chptr = buf + 9;
- int j = 0;
-
- if (i < 0)
- {
- write(1, "-", 1);
- i = -1 * i;
- }
-
- while (i)
- {
- *chptr-- = '0' + (i % 10);
- j++;
- i = i / 10;
- }
-
- write(fd, chptr + 1, j);
-}
-
-void print_str_init(int fd, char * string)
-{
- write(fd, string, strlen(string));
-}
-
-
-/* fork to:
- * (1) watch /proc/kmsg and copy the stuff to /dev/tty4
- * (2) listens to /dev/log and copy also this stuff (log from programs)
- */
-void doklog()
-{
- fd_set readset, unixs;
- int in, out, i;
- int log;
- int s;
- int sock = -1;
- struct sockaddr_un sockaddr;
- char buf[1024];
- int readfd;
-
- /* open kernel message logger */
- in = open("/proc/kmsg", O_RDONLY,0);
- if (in < 0) {
- print_error("could not open /proc/kmsg");
- return;
- }
-
- if ((log = open("/tmp/syslog", O_WRONLY | O_CREAT, 0644)) < 0) {
- print_error("error opening /tmp/syslog");
- sleep(5);
- return;
- }
-
- if ((klog_pid = fork())) {
- close(in);
- close(log);
- return;
- } else {
- close(0);
- close(1);
- close(2);
- }
-
- out = open("/dev/tty4", O_WRONLY, 0);
- if (out < 0)
- print_warning("couldn't open tty for syslog -- still using /tmp/syslog\n");
-
- /* now open the syslog socket */
-// ############# LINUX 2.4 /dev/log IS BUGGED! --> apparently the syslogs can't reach me, and it's full up after a while
-// sockaddr.sun_family = AF_UNIX;
-// strncpy(sockaddr.sun_path, "/dev/log", UNIX_PATH_MAX);
-// sock = socket(AF_UNIX, SOCK_STREAM, 0);
-// if (sock < 0) {
-// printf("error creating socket: %d\n", errno);
-// sleep(5);
-// }
-//
-// print_str_init(log, "] got socket\n");
-// if (bind(sock, (struct sockaddr *) &sockaddr, sizeof(sockaddr.sun_family) + strlen(sockaddr.sun_path))) {
-// print_str_init(log, "] bind error: ");
-// print_int_init(log, errno);
-// print_str_init(log, "\n");
-// sleep(// }
-//
-// print_str_init(log, "] bound socket\n");
-// chmod("/dev/log", 0666);
-// if (listen(sock, 5)) {
-// print_str_init(log, "] listen error: ");
-// print_int_init(log, errno);
-// print_str_init(log, "\n");
-// sleep(5);
-// }
-
- /* disable on-console syslog output */
- syslog(8, NULL, 1);
-
- print_str_init(log, "] kernel/system logger ok\n");
- FD_ZERO(&unixs);
- while (1) {
- memcpy(&readset, &unixs, sizeof(unixs));
-
- if (sock >= 0)
- FD_SET(sock, &readset);
- FD_SET(in, &readset);
-
- i = select(20, &readset, NULL, NULL, NULL);
- if (i <= 0)
- continue;
-
- /* has /proc/kmsg things to tell us? */
- if (FD_ISSET(in, &readset)) {
- i = read(in, buf, sizeof(buf));
- if (i > 0) {
- if (out >= 0)
- write(out, buf, i);
- write(log, buf, i);
- }
- }
-
- /* examine some fd's in the hope to find some syslog outputs from programs */
- for (readfd = 0; readfd < 20; ++readfd) {
- if (FD_ISSET(readfd, &readset) && FD_ISSET(readfd, &unixs)) {
- i = read(readfd, buf, sizeof(buf));
- if (i > 0) {
- /* grep out the output of RPM telling that it installed/removed some packages */
- if (!strstr(buf, "mdk installed") && !strstr(buf, "mdk removed")) {
- if (out >= 0)
- write(out, buf, i);
- write(log, buf, i);
- }
- } else if (i == 0) {
- /* socket closed */
- close(readfd);
- FD_CLR(readfd, &unixs);
- }
- }
- }
-
- /* the socket has moved, new stuff to do */
- if (sock >= 0 && FD_ISSET(sock, &readset)) {
- s = sizeof(sockaddr);
- readfd = accept(sock, (struct sockaddr *) &sockaddr, &s);
- if (readfd < 0) {
- char * msg_error = "] error in accept\n";
- if (out >= 0)
- write(out, msg_error, strlen(msg_error));
- write(log, msg_error, strlen(msg_error));
- close(sock);
- sock = -1;
- }
- else
- FD_SET(readfd, &unixs);
- }
- }
-}
-
-
-#define LOOP_CLR_FD 0x4C01
-
-void del_loop(char *device)
-{
- int fd;
- if ((fd = open(device, O_RDONLY, 0)) < 0) {
- printf("del_loop open failed\n");
- return;
- }
-
- if (ioctl(fd, LOOP_CLR_FD, 0) < 0) {
- printf("del_loop ioctl failed");
- return;
- }
-
- close(fd);
-}
-
-struct filesystem
-{
- char * dev;
- char * name;
- char * fs;
- int mounted;
-};
-
-/* attempt to unmount all filesystems in /proc/mounts */
-void unmount_filesystems(void)
-{
- int fd, size;
- char buf[65535]; /* this should be big enough */
- char *p;
- struct filesystem fs[500];
- int numfs = 0;
- int i, nb;
-
- printf("unmounting filesystems...\n");
-
- fd = open("/proc/mounts", O_RDONLY, 0);
- if (fd < 1) {
- print_error("failed to open /proc/mounts");
- sleep(2);
- return;
- }
-
- size = read(fd, buf, sizeof(buf) - 1);
- buf[size] = '\0';
-
- close(fd);
-
- p = buf;
- while (*p) {
- fs[numfs].mounted = 1;
- fs[numfs].dev = p;
- while (*p != ' ') p++;
- *p++ = '\0';
- fs[numfs].name = p;
- while (*p != ' ') p++;
- *p++ = '\0';
- fs[numfs].fs = p;
- while (*p != ' ') p++;
- *p++ = '\0';
- while (*p != '\n') p++;
- p++;
- if (strcmp(fs[numfs].name, "/") != 0) numfs++; /* skip if root, no need to take initrd root in account */
- }
-
- /* Pixel's ultra-optimized sorting algorithm:
- multiple passes trying to umount everything until nothing moves
- anymore (a.k.a holy shotgun method) */
- do {
- nb = 0;
- for (i = 0; i < numfs; i++) {
- /*printf("trying with %s\n", fs[i].name);*/
- if (fs[i].mounted && umount(fs[i].name) == 0) {
- if (strncmp(fs[i].dev + sizeof("/dev/") - 1, "loop",
- sizeof("loop") - 1) == 0)
- del_loop(fs[i].dev);
-
- printf("\t%s\n", fs[i].name);
- fs[i].mounted = 0;
- nb++;
- }
- }
- } while (nb);
-
- for (i = nb = 0; i < numfs; i++)
- if (fs[i].mounted) {
- printf("\t%s umount failed\n", fs[i].name);
- if (strcmp(fs[i].fs, "ext2") == 0) nb++; /* don't count not-ext2 umount failed */
- }
-
- if (nb) {
- printf("failed to umount some filesystems\n");
- while (1);
- }
-}
-
-int exit_value_rescue = 66;
-
-int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
-{
- pid_t installpid, childpid;
- int wait_status;
- int fd;
- int abnormal_termination = 0;
- int end_stage2 = 0;
-
- /* getpid() != 1 should work, by linuxrc tends to get a larger pid */
- testing = (getpid() > 50);
-
- if (!testing) {
- /* turn off screen blanking */
- printf("\033[9;0]");
- printf("\033[8]");
- }
- else
- printf("*** TESTING MODE ***\n");
-
-
- printf("\n\t\t\t\033[1;40mWelcome to \033[1;36mMandrake\033[0;39m Linux\n\n");
-
- if (!testing) {
- if (mount("/proc", "/proc", "proc", 0, NULL))
- fatal_error("Unable to mount proc filesystem");
- }
-
-
- /* ignore Control-C and keyboard stop signals */
- signal(SIGINT, SIG_IGN);
- signal(SIGTSTP, SIG_IGN);
-
-
- if (!testing) {
- fd = open("/dev/tty1", O_RDWR, 0);
- if (fd < 0)
- /* try with devfs */
- fd = open("/dev/vc/1", O_RDWR, 0);
-
- if (fd < 0)
- fatal_error("failed to open /dev/tty1 and /dev/vc/1");
-
- dup2(fd, 0);
- dup2(fd, 1);
- dup2(fd, 2);
- close(fd);
- }
-
-
- /* I set me up as session leader (probably not necessary?) */
- setsid();
- if (ioctl(0, TIOCSCTTY, NULL))
- print_error("could not set new controlling tty");
-
- if (!testing) {
- char my_hostname[] = "localhost.localdomain";
- sethostname(my_hostname, sizeof(my_hostname));
- /* the default domainname (as of 2.0.35) is "(none)", which confuses
- glibc */
- setdomainname("", 0);
- }
-
- if (!testing)
- doklog();
-
- /* Go into normal init mode - keep going, and then do a orderly shutdown
- when:
-
- 1) install exits
- 2) we receive a SIGHUP
- */
-
- printf("If more people were to meet doing raklets, this planet\n");
- printf("would be a safer place.\n");
- printf("\n");
- printf("Running install...\n");
-
- if (!(installpid = fork())) {
- /* child */
- char * child_argv[2];
- child_argv[0] = "/sbin/stage1";
- child_argv[1] = NULL;
-
- execve(child_argv[0], child_argv, env);
- printf("error in exec of stage1 :-(\n");
- return 0;
- }
-
- while (!end_stage2) {
- childpid = wait4(-1, &wait_status, 0, NULL);
- if (childpid == installpid)
- end_stage2 = 1;
- }
-
- if (!WIFEXITED(wait_status) || (WEXITSTATUS(wait_status) != 0 && WEXITSTATUS(wait_status) != exit_value_rescue)) {
- printf("install exited abnormally :-( ");
- if (WIFSIGNALED(wait_status))
- printf("-- received signal %d", WTERMSIG(wait_status));
- printf("\n");
- abnormal_termination = 1;
- } else if (WIFEXITED(wait_status) && WEXITSTATUS(wait_status) == exit_value_rescue) {
- kill(klog_pid, 9);
- printf("exiting init -- giving hand to rescue\n");
- return 0;
- } else
- printf("install succeeded\n");
-
- if (testing)
- return 0;
-
- sync(); sync();
-
- printf("sending termination signals...");
- kill(-1, 15);
- sleep(2);
- printf("done\n");
-
- printf("sending kill signals...");
- kill(-1, 9);
- sleep(2);
- printf("done\n");
-
- unmount_filesystems();
-
- if (!abnormal_termination) {
- printf("rebooting system\n");
- sleep(2);
- reboot(0xfee1dead, 672274793, 0x01234567);
- } else {
- printf("you may safely reboot your system\n");
- while (1);
- }
-
- return 0;
-}
diff --git a/mdk-stage1/insmod-busybox/.cvsignore b/mdk-stage1/insmod-busybox/.cvsignore
deleted file mode 100644
index 26a2c08c9..000000000
--- a/mdk-stage1/insmod-busybox/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-insmod
-insmod-DIET
diff --git a/mdk-stage1/insmod-busybox/Config.h b/mdk-stage1/insmod-busybox/Config.h
deleted file mode 100644
index 8388416b7..000000000
--- a/mdk-stage1/insmod-busybox/Config.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* vi: set sw=4 ts=4: */
-// This file defines the feature set to be compiled into busybox.
-// When you turn things off here, they won't be compiled in at all.
-//
-//// This file is parsed by sed. You MUST use single line comments.
-// i.e. //#define BB_BLAH
-//
-//
-// BusyBox Applications
-#define BB_INSMOD
-// End of Applications List
-//
-//
-//
-// ---------------------------------------------------------
-// This is where feature definitions go. Generally speaking,
-// turning this stuff off makes things a bit smaller (and less
-// pretty/useful).
-//
-//
-//
-// Turn this on to use Erik's very cool devps, and devmtab kernel drivers,
-// thereby eliminating the need for the /proc filesystem and thereby saving
-// lots and lots memory for more important things. You can not use this and
-// USE_PROCFS at the same time... NOTE: If you enable this feature, you
-// _must_ have patched the kernel to include the devps patch that is included
-// in the busybox/kernel-patches directory. You will also need to create some
-// device special files in /dev on your embedded system:
-// mknod /dev/mtab c 10 22
-// mknod /dev/ps c 10 21
-// I emailed Linus and this patch will not be going into the stock kernel.
-//#define BB_FEATURE_USE_DEVPS_PATCH
-//
-// enable features that use the /proc filesystem (apps that
-// break without this will tell you on compile)...
-// You can't use this and BB_FEATURE_USE_DEVPS_PATCH
-// at the same time...
-#define BB_FEATURE_USE_PROCFS
-
-//
-// Enable tab completion in the shell (not yet
-// working very well -- so don't turn this on)
-//#define BB_FEATURE_SH_TAB_COMPLETION
-//
-//Turn on extra fbset options
-//#define BB_FEATURE_FBSET_FANCY
-//
-//Turn on fbset readmode support
-//#define BB_FEATURE_FBSET_READMODE
-//
-// You must enable one or both of these features
-// Support installing modules from pre 2.1 kernels
-//#define BB_FEATURE_INSMOD_OLD_KERNEL
-// Support installing modules from kernel versions after 2.1.18
-#define BB_FEATURE_INSMOD_NEW_KERNEL
-//
-// Support module version checking
-//#define BB_FEATURE_INSMOD_VERSION_CHECKING
-//
-// Support for Minix filesystem, version 2
-//#define BB_FEATURE_MINIX2
-//
-//
-// Enable busybox --install [-s]
-// to create links (or symlinks) for all the commands that are
-// compiled into the binary. (needs /proc filesystem)
-// #define BB_FEATURE_INSTALLER
-//
-// Clean up all memory before exiting -- usually not needed
-// as the OS can clean up... Don't enable this unless you
-// have a really good reason for cleaning things up manually.
-//#define BB_FEATURE_CLEAN_UP
-//
-// End of Features List
-//
-//
-//
-//
-//
-//
-//---------------------------------------------------
-// Nothing beyond this point should ever be touched by
-// mere mortals so leave this stuff alone.
-//
-#ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
-#define BB_MTAB
-#endif
-//
-#if defined BB_FEATURE_SH_COMMAND_EDITING && defined BB_SH
-#define BB_CMDEDIT
-#endif
-//
-#ifdef BB_KILLALL
-#ifndef BB_KILL