summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2003-05-06 13:11:49 +0000
committerMystery Man <unknown@mandriva.org>2003-05-06 13:11:49 +0000
commit3f5d21d90abbd16f16ab69aec1e1a1853a93fd18 (patch)
tree3d9f5a32303a8d97b4b457949e64bb42b4850ea9
parent327bd24f8e4291bd1882de1990dd7339f781a9cb (diff)
downloaddrakx-backup-do-not-use-3f5d21d90abbd16f16ab69aec1e1a1853a93fd18.tar
drakx-backup-do-not-use-3f5d21d90abbd16f16ab69aec1e1a1853a93fd18.tar.gz
drakx-backup-do-not-use-3f5d21d90abbd16f16ab69aec1e1a1853a93fd18.tar.bz2
drakx-backup-do-not-use-3f5d21d90abbd16f16ab69aec1e1a1853a93fd18.tar.xz
drakx-backup-do-not-use-3f5d21d90abbd16f16ab69aec1e1a1853a93fd18.zip
This commit was manufactured by cvs2svn to create tag 'R9_0-AMD64'.R9_0-AMD64
-rw-r--r--Makefile13
-rw-r--r--docs/README37
-rw-r--r--kernel/Makefile2
-rwxr-xr-xkernel/check_mar.pl12
-rw-r--r--kernel/list_modules.pm10
-rw-r--r--kernel/modules.pl4
-rwxr-xr-xkernel/update_kernel38
-rwxr-xr-xmake_boot_img98
-rw-r--r--mdk-stage1/.cvsignore12
-rw-r--r--mdk-stage1/Makefile86
-rw-r--r--mdk-stage1/Makefile.common11
-rw-r--r--mdk-stage1/bzlib/Makefile15
-rw-r--r--mdk-stage1/dhcp.c2
-rw-r--r--mdk-stage1/dietlibc/.cvsignore16
-rw-r--r--mdk-stage1/dietlibc/AUTHOR2
-rw-r--r--mdk-stage1/dietlibc/BUGS8
-rw-r--r--mdk-stage1/dietlibc/CAVEAT5
-rw-r--r--mdk-stage1/dietlibc/CHANGES911
-rw-r--r--mdk-stage1/dietlibc/COPYING340
-rw-r--r--mdk-stage1/dietlibc/FAQ224
-rw-r--r--mdk-stage1/dietlibc/Makefile351
-rw-r--r--mdk-stage1/dietlibc/PORTING28
-rw-r--r--mdk-stage1/dietlibc/README14
-rw-r--r--mdk-stage1/dietlibc/SECURITY13
-rw-r--r--mdk-stage1/dietlibc/THANKS31
-rw-r--r--mdk-stage1/dietlibc/TODO26
-rw-r--r--mdk-stage1/dietlibc/alpha/Makefile.add2
-rw-r--r--mdk-stage1/dietlibc/alpha/__alarm.c13
-rw-r--r--mdk-stage1/dietlibc/alpha/__longjmp.S9
-rw-r--r--mdk-stage1/dietlibc/alpha/__testandset.S11
-rw-r--r--mdk-stage1/dietlibc/alpha/clone.S2
-rw-r--r--mdk-stage1/dietlibc/alpha/errlist.S288
-rw-r--r--mdk-stage1/dietlibc/alpha/lseek64.S5
-rw-r--r--mdk-stage1/dietlibc/alpha/n_sigprocmask.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/setjmp.S31
-rw-r--r--mdk-stage1/dietlibc/alpha/sigaction.c7
-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/socketpair.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/start.S20
-rw-r--r--mdk-stage1/dietlibc/alpha/syscalls.h371
-rw-r--r--mdk-stage1/dietlibc/alpha/unified.S12
-rw-r--r--mdk-stage1/dietlibc/binshstr.h6
-rw-r--r--mdk-stage1/dietlibc/diet.131
-rw-r--r--mdk-stage1/dietlibc/diet.c317
-rw-r--r--mdk-stage1/dietlibc/dietdirent.h4
-rw-r--r--mdk-stage1/dietlibc/dietdns.h4
-rw-r--r--mdk-stage1/dietlibc/dietfeatures.h92
-rw-r--r--mdk-stage1/dietlibc/dieticonv.h12
-rw-r--r--mdk-stage1/dietlibc/dietlibm.h5
-rw-r--r--mdk-stage1/dietlibc/dietstdarg.h12
-rw-r--r--mdk-stage1/dietlibc/dietstdio.h84
-rw-r--r--mdk-stage1/dietlibc/dietuglyweaks.h24
-rw-r--r--mdk-stage1/dietlibc/dirstream.h78
-rw-r--r--mdk-stage1/dietlibc/dyn_start.c40
-rw-r--r--mdk-stage1/dietlibc/dyn_stop.c23
-rwxr-xr-xmdk-stage1/dietlibc/findcflags.sh8
-rw-r--r--mdk-stage1/dietlibc/i386/Makefile.add7
-rw-r--r--mdk-stage1/dietlibc/i386/PIC.h82
-rw-r--r--mdk-stage1/dietlibc/i386/__half.S10
-rw-r--r--mdk-stage1/dietlibc/i386/__longjmp.S1
-rw-r--r--mdk-stage1/dietlibc/i386/__ten.S9
-rw-r--r--mdk-stage1/dietlibc/i386/__testandset.S1
-rw-r--r--mdk-stage1/dietlibc/i386/accept.S4
-rw-r--r--mdk-stage1/dietlibc/i386/acos.S30
-rw-r--r--mdk-stage1/dietlibc/i386/acosh.S18
-rw-r--r--mdk-stage1/dietlibc/i386/asin.S29
-rw-r--r--mdk-stage1/dietlibc/i386/asinh.S18
-rw-r--r--mdk-stage1/dietlibc/i386/atan.S27
-rw-r--r--mdk-stage1/dietlibc/i386/atan2.S12
-rw-r--r--mdk-stage1/dietlibc/i386/atanh.S19
-rw-r--r--mdk-stage1/dietlibc/i386/atol.S55
-rw-r--r--mdk-stage1/dietlibc/i386/atoll.S64
-rw-r--r--mdk-stage1/dietlibc/i386/bind.S4
-rw-r--r--mdk-stage1/dietlibc/i386/cbrt.S46
-rw-r--r--mdk-stage1/dietlibc/i386/ceil.S44
-rw-r--r--mdk-stage1/dietlibc/i386/clone.S29
-rw-r--r--mdk-stage1/dietlibc/i386/connect.S4
-rw-r--r--mdk-stage1/dietlibc/i386/copysign.S18
-rw-r--r--mdk-stage1/dietlibc/i386/cos.S35
-rw-r--r--mdk-stage1/dietlibc/i386/cosh.S29
-rw-r--r--mdk-stage1/dietlibc/i386/dyn_syscalls.S282
-rw-r--r--mdk-stage1/dietlibc/i386/exp.S35
-rw-r--r--mdk-stage1/dietlibc/i386/exp10.S27
-rw-r--r--mdk-stage1/dietlibc/i386/exp2.S18
-rw-r--r--mdk-stage1/dietlibc/i386/expm1.S23
-rw-r--r--mdk-stage1/dietlibc/i386/fabs.S11
-rw-r--r--mdk-stage1/dietlibc/i386/floor.S26
-rw-r--r--mdk-stage1/dietlibc/i386/fmod.S37
-rw-r--r--mdk-stage1/dietlibc/i386/getenv.S48
-rw-r--r--mdk-stage1/dietlibc/i386/getpeername.S4
-rw-r--r--mdk-stage1/dietlibc/i386/getsockname.S4
-rw-r--r--mdk-stage1/dietlibc/i386/getsockopt.S4
-rw-r--r--mdk-stage1/dietlibc/i386/htonl.S13
-rw-r--r--mdk-stage1/dietlibc/i386/htons.S11
-rw-r--r--mdk-stage1/dietlibc/i386/hypot.S15
-rw-r--r--mdk-stage1/dietlibc/i386/ilogb.S23
-rw-r--r--mdk-stage1/dietlibc/i386/ipow.S27
-rw-r--r--mdk-stage1/dietlibc/i386/isleap.S28
-rw-r--r--mdk-stage1/dietlibc/i386/ldexp.S28
-rw-r--r--mdk-stage1/dietlibc/i386/libm2.S643
-rw-r--r--mdk-stage1/dietlibc/i386/listen.S4
-rw-r--r--mdk-stage1/dietlibc/i386/log.S26
-rw-r--r--mdk-stage1/dietlibc/i386/log10.S11
-rw-r--r--mdk-stage1/dietlibc/i386/log1p.S12
-rw-r--r--mdk-stage1/dietlibc/i386/log2.S11
-rw-r--r--mdk-stage1/dietlibc/i386/ltostr.S62
-rw-r--r--mdk-stage1/dietlibc/i386/mcount.S44
-rw-r--r--mdk-stage1/dietlibc/i386/md5asm.S300
-rw-r--r--mdk-stage1/dietlibc/i386/memccpy.S39
-rw-r--r--mdk-stage1/dietlibc/i386/memchr.S24
-rw-r--r--mdk-stage1/dietlibc/i386/memcmp.S26
-rw-r--r--mdk-stage1/dietlibc/i386/memcpy.S16
-rw-r--r--mdk-stage1/dietlibc/i386/memset.S15
-rw-r--r--mdk-stage1/dietlibc/i386/mmap.S14
-rw-r--r--mdk-stage1/dietlibc/i386/mmap.c16
-rw-r--r--mdk-stage1/dietlibc/i386/mmap64.S63
-rw-r--r--mdk-stage1/dietlibc/i386/poly.S24
-rw-r--r--mdk-stage1/dietlibc/i386/pow.S67
-rw-r--r--mdk-stage1/dietlibc/i386/recv.S4
-rw-r--r--mdk-stage1/dietlibc/i386/recvfrom.S4
-rw-r--r--mdk-stage1/dietlibc/i386/recvmsg.S4
-rw-r--r--mdk-stage1/dietlibc/i386/rint.S23
-rw-r--r--mdk-stage1/dietlibc/i386/send.S4
-rw-r--r--mdk-stage1/dietlibc/i386/sendmsg.S4
-rw-r--r--mdk-stage1/dietlibc/i386/sendto.S4
-rw-r--r--mdk-stage1/dietlibc/i386/setjmp.S55
-rw-r--r--mdk-stage1/dietlibc/i386/setsockopt.S4
-rw-r--r--mdk-stage1/dietlibc/i386/shutdown.S4
-rw-r--r--mdk-stage1/dietlibc/i386/sin.S34
-rw-r--r--mdk-stage1/dietlibc/i386/sincos.S18
-rw-r--r--mdk-stage1/dietlibc/i386/sinh.S29
-rw-r--r--mdk-stage1/dietlibc/i386/sleep.S25
-rw-r--r--mdk-stage1/dietlibc/i386/socket.S4
-rw-r--r--mdk-stage1/dietlibc/i386/socketcall.S17
-rw-r--r--mdk-stage1/dietlibc/i386/socketpair.S4
-rw-r--r--mdk-stage1/dietlibc/i386/sqrt.S23
-rw-r--r--mdk-stage1/dietlibc/i386/sqrtl.S11
-rw-r--r--mdk-stage1/dietlibc/i386/start.S69
-rw-r--r--mdk-stage1/dietlibc/i386/stpcpy.S22
-rw-r--r--mdk-stage1/dietlibc/i386/strcasecmp.S31
-rw-r--r--mdk-stage1/dietlibc/i386/strcat.S29
-rw-r--r--mdk-stage1/dietlibc/i386/strchr.S22
-rw-r--r--mdk-stage1/dietlibc/i386/strcmp.S31
-rw-r--r--mdk-stage1/dietlibc/i386/strcpy.S24
-rw-r--r--mdk-stage1/dietlibc/i386/strlen.S18
-rw-r--r--mdk-stage1/dietlibc/i386/strncmp.S28
-rw-r--r--mdk-stage1/dietlibc/i386/strncpy.S42
-rw-r--r--mdk-stage1/dietlibc/i386/strrchr.S19
-rw-r--r--mdk-stage1/dietlibc/i386/syscalls.h303
-rw-r--r--mdk-stage1/dietlibc/i386/tan.S12
-rw-r--r--mdk-stage1/dietlibc/i386/tanh.S32
-rw-r--r--mdk-stage1/dietlibc/i386/unified.S35
-rw-r--r--mdk-stage1/dietlibc/i386/usleep.S31
-rw-r--r--mdk-stage1/dietlibc/i386/vfork.S9
-rw-r--r--mdk-stage1/dietlibc/i386/write12.S37
-rw-r--r--mdk-stage1/dietlibc/ia64/Makefile.add2
-rw-r--r--mdk-stage1/dietlibc/ia64/README4
-rw-r--r--mdk-stage1/dietlibc/ia64/__alarm.c1
-rw-r--r--mdk-stage1/dietlibc/ia64/__longjmp.S1
-rw-r--r--mdk-stage1/dietlibc/ia64/__nice.c6
-rw-r--r--mdk-stage1/dietlibc/ia64/__testandset.S11
-rw-r--r--mdk-stage1/dietlibc/ia64/__time.c14
-rw-r--r--mdk-stage1/dietlibc/ia64/__waitpid.c5
-rw-r--r--mdk-stage1/dietlibc/ia64/accept.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/bind.S (renamed from mdk-stage1/dietlibc/syscalls.c/sync.c)2
-rw-r--r--mdk-stage1/dietlibc/ia64/clone.S41
-rw-r--r--mdk-stage1/dietlibc/ia64/connect.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/fork.S8
-rw-r--r--mdk-stage1/dietlibc/ia64/getpeername.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/getsockname.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/getsockopt.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/listen.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/mmap.S (renamed from mdk-stage1/dietlibc/syscalls.c/getpid.c)2
-rw-r--r--mdk-stage1/dietlibc/ia64/msgctl.S (renamed from mdk-stage1/dietlibc/syscalls.c/getppid.c)2
-rw-r--r--mdk-stage1/dietlibc/ia64/msgget.S (renamed from mdk-stage1/dietlibc/syscalls.c/vhangup.c)2
-rw-r--r--mdk-stage1/dietlibc/ia64/msgrcv.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/msgsnd.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/pipe.S20
-rw-r--r--mdk-stage1/dietlibc/ia64/recv.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/recvfrom.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/recvmsg.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/semctl.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/semget.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/semop.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/send.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/sendmsg.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/sendto.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/setjmp.S1
-rw-r--r--mdk-stage1/dietlibc/ia64/setsockopt.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmat.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmctl.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmdt.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shmget.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/shutdown.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/socket.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/socketpair.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/start.S45
-rw-r--r--mdk-stage1/dietlibc/ia64/syscalls.h242
-rw-r--r--mdk-stage1/dietlibc/ia64/unified.S46
-rw-r--r--mdk-stage1/dietlibc/ia64/utime.S3
-rw-r--r--mdk-stage1/dietlibc/ia64/vfork.S8
-rw-r--r--mdk-stage1/dietlibc/include/alloca.h13
-rw-r--r--mdk-stage1/dietlibc/include/arpa/inet.h1
-rw-r--r--mdk-stage1/dietlibc/include/arpa/nameser.h36
-rw-r--r--mdk-stage1/dietlibc/include/asm/alpha-sigcontext.h29
-rw-r--r--mdk-stage1/dietlibc/include/asm/arm-sigcontext.h32
-rw-r--r--mdk-stage1/dietlibc/include/asm/i386-sigcontext.h66
-rw-r--r--mdk-stage1/dietlibc/include/asm/ia64-sigcontext.h25
-rw-r--r--mdk-stage1/dietlibc/include/asm/mips-sigcontext.h23
-rw-r--r--mdk-stage1/dietlibc/include/asm/parisc-sigcontext.h16
-rw-r--r--mdk-stage1/dietlibc/include/asm/ppc-sigcontext.h76
-rw-r--r--mdk-stage1/dietlibc/include/asm/sigcontext.h36
-rw-r--r--mdk-stage1/dietlibc/include/asm/sparc-sigcontext.h50
-rw-r--r--mdk-stage1/dietlibc/include/asm/statfs.h1
-rw-r--r--mdk-stage1/dietlibc/include/asm/types.h32
-rw-r--r--mdk-stage1/dietlibc/include/assert.h17
-rw-r--r--mdk-stage1/dietlibc/include/cpio.h27
-rw-r--r--mdk-stage1/dietlibc/include/daemon.h2
-rw-r--r--mdk-stage1/dietlibc/include/dietref.h22
-rw-r--r--mdk-stage1/dietlibc/include/dirent.h42
-rw-r--r--mdk-stage1/dietlibc/include/dlfcn.h3
-rw-r--r--mdk-stage1/dietlibc/include/elf.h781
-rw-r--r--mdk-stage1/dietlibc/include/endian.h45
-rw-r--r--mdk-stage1/dietlibc/include/errno.h543
-rw-r--r--mdk-stage1/dietlibc/include/fcntl.h550
-rw-r--r--mdk-stage1/dietlibc/include/features.h9
-rw-r--r--mdk-stage1/dietlibc/include/float.h96
-rw-r--r--mdk-stage1/dietlibc/include/fnmatch.h2
-rw-r--r--mdk-stage1/dietlibc/include/ftw.h16
-rw-r--r--mdk-stage1/dietlibc/include/getopt.h6
-rw-r--r--mdk-stage1/dietlibc/include/glob.h2
-rw-r--r--mdk-stage1/dietlibc/include/grp.h10
-rw-r--r--mdk-stage1/dietlibc/include/iconv.h25
-rw-r--r--mdk-stage1/dietlibc/include/inttypes.h247
-rw-r--r--mdk-stage1/dietlibc/include/libgen.h9
-rw-r--r--mdk-stage1/dietlibc/include/libintl.h23
-rw-r--r--mdk-stage1/dietlibc/include/limits.h51
-rw-r--r--mdk-stage1/dietlibc/include/linux/eventpoll.h17
-rw-r--r--mdk-stage1/dietlibc/include/linux/if_ether.h101
-rw-r--r--mdk-stage1/dietlibc/include/linux/loop.h47
-rw-r--r--mdk-stage1/dietlibc/include/linux/nfs.h88
-rw-r--r--mdk-stage1/dietlibc/include/linux/types.h6
-rw-r--r--mdk-stage1/dietlibc/include/locale.h86
-rw-r--r--mdk-stage1/dietlibc/include/math.h35
-rw-r--r--mdk-stage1/dietlibc/include/md5.h48
-rw-r--r--mdk-stage1/dietlibc/include/net/ethernet.h76
-rw-r--r--mdk-stage1/dietlibc/include/net/if.h93
-rw-r--r--mdk-stage1/dietlibc/include/net/if_arp.h109
-rw-r--r--mdk-stage1/dietlibc/include/net/if_ether.h74
-rw-r--r--mdk-stage1/dietlibc/include/net/route.h52
-rw-r--r--mdk-stage1/dietlibc/include/netdb.h64
-rw-r--r--mdk-stage1/dietlibc/include/netinet/in.h399
-rw-r--r--mdk-stage1/dietlibc/include/netinet/ip.h117
-rw-r--r--mdk-stage1/dietlibc/include/netinet/ip_icmp.h145
-rw-r--r--mdk-stage1/dietlibc/include/netinet/tcp.h164
-rw-r--r--mdk-stage1/dietlibc/include/netinet/udp.h16
-rw-r--r--mdk-stage1/dietlibc/include/netpacket/packet.h41
-rw-r--r--mdk-stage1/dietlibc/include/paths.h7
-rw-r--r--mdk-stage1/dietlibc/include/pthread.h37
-rw-r--r--mdk-stage1/dietlibc/include/pty.h13
-rw-r--r--mdk-stage1/dietlibc/include/pwd.h15
-rw-r--r--mdk-stage1/dietlibc/include/regex.h6
-rw-r--r--mdk-stage1/dietlibc/include/resolv.h125
-rw-r--r--mdk-stage1/dietlibc/include/rpc/auth.h23
-rw-r--r--mdk-stage1/dietlibc/include/rpc/auth_des.h8
-rw-r--r--mdk-stage1/dietlibc/include/rpc/auth_unix.h4
-rw-r--r--mdk-stage1/dietlibc/include/rpc/clnt.h112
-rw-r--r--mdk-stage1/dietlibc/include/rpc/key_prot.h74
-rw-r--r--mdk-stage1/dietlibc/include/rpc/netdb.h4
-rw-r--r--mdk-stage1/dietlibc/include/rpc/pmap_clnt.h38
-rw-r--r--mdk-stage1/dietlibc/include/rpc/pmap_prot.h22
-rw-r--r--mdk-stage1/dietlibc/include/rpc/pmap_rmt.h10
-rw-r--r--mdk-stage1/dietlibc/include/rpc/rpc.h2
-rw-r--r--mdk-stage1/dietlibc/include/rpc/rpc_msg.h24
-rw-r--r--mdk-stage1/dietlibc/include/rpc/svc.h22
-rw-r--r--mdk-stage1/dietlibc/include/rpc/types.h16
-rw-r--r--mdk-stage1/dietlibc/include/rpc/xdr.h78
-rw-r--r--mdk-stage1/dietlibc/include/sched.h13
-rw-r--r--mdk-stage1/dietlibc/include/setjmp.h152
-rw-r--r--mdk-stage1/dietlibc/include/shadow.h8
-rw-r--r--mdk-stage1/dietlibc/include/signal.h487
-rw-r--r--mdk-stage1/dietlibc/include/stdarg-cruft.h299
-rw-r--r--mdk-stage1/dietlibc/include/stdarg.h24
-rw-r--r--mdk-stage1/dietlibc/include/stddef.h23
-rw-r--r--mdk-stage1/dietlibc/include/stdint.h26
-rw-r--r--mdk-stage1/dietlibc/include/stdio.h106
-rw-r--r--mdk-stage1/dietlibc/include/stdlib.h75
-rw-r--r--mdk-stage1/dietlibc/include/string.h63
-rw-r--r--mdk-stage1/dietlibc/include/strings.h25
-rw-r--r--mdk-stage1/dietlibc/include/sys/alpha-ioctl.h168
-rw-r--r--mdk-stage1/dietlibc/include/sys/arm-ioctl.h149
-rw-r--r--mdk-stage1/dietlibc/include/sys/cdefs.h31
-rw-r--r--mdk-stage1/dietlibc/include/sys/epoll.h60
-rw-r--r--mdk-stage1/dietlibc/include/sys/file.h11
-rw-r--r--mdk-stage1/dietlibc/include/sys/fsuid.h12
-rw-r--r--mdk-stage1/dietlibc/include/sys/gmon.h99
-rw-r--r--mdk-stage1/dietlibc/include/sys/gmon_out.h1
-rw-r--r--mdk-stage1/dietlibc/include/sys/hppa-ioctl.h133
-rw-r--r--mdk-stage1/dietlibc/include/sys/i386-ioctl.h141
-rw-r--r--mdk-stage1/dietlibc/include/sys/io.h47
-rw-r--r--mdk-stage1/dietlibc/include/sys/ioctl.h26
-rw-r--r--mdk-stage1/dietlibc/include/sys/ipc.h45
-rw-r--r--mdk-stage1/dietlibc/include/sys/kd.h179
-rw-r--r--mdk-stage1/dietlibc/include/sys/klog.h8
-rw-r--r--mdk-stage1/dietlibc/include/sys/mips-ioctl.h177
-rw-r--r--mdk-stage1/dietlibc/include/sys/mman.h165
-rw-r--r--mdk-stage1/dietlibc/include/sys/mount.h73
-rw-r--r--mdk-stage1/dietlibc/include/sys/msg.h48
-rw-r--r--mdk-stage1/dietlibc/include/sys/mtio.h336
-rw-r--r--mdk-stage1/dietlibc/include/sys/param.h22
-rw-r--r--mdk-stage1/dietlibc/include/sys/poll.h40
-rw-r--r--mdk-stage1/dietlibc/include/sys/ppc-ioctl.h164
-rw-r--r--mdk-stage1/dietlibc/include/sys/prctl.h8
-rw-r--r--mdk-stage1/dietlibc/include/sys/ptrace.h840
-rw-r--r--mdk-stage1/dietlibc/include/sys/reboot.h21
-rw-r--r--mdk-stage1/dietlibc/include/sys/resource.h53
-rw-r--r--mdk-stage1/dietlibc/include/sys/s390-ioctl.h141
-rw-r--r--mdk-stage1/dietlibc/include/sys/select.h22
-rw-r--r--mdk-stage1/dietlibc/include/sys/sem.h74
-rw-r--r--mdk-stage1/dietlibc/include/sys/sendfile.h8
-rw-r--r--mdk-stage1/dietlibc/include/sys/shm.h66
-rw-r--r--mdk-stage1/dietlibc/include/sys/socket.h492
-rw-r--r--mdk-stage1/dietlibc/include/sys/soundcard.h1300
-rw-r--r--mdk-stage1/dietlibc/include/sys/sparc-ioctl.h172
-rw-r--r--mdk-stage1/dietlibc/include/sys/stat.h494
-rw-r--r--mdk-stage1/dietlibc/include/sys/sysinfo.h20
-rw-r--r--mdk-stage1/dietlibc/include/sys/syslog.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/sysmacros.h6
-rw-r--r--mdk-stage1/dietlibc/include/sys/time.h50
-rw-r--r--mdk-stage1/dietlibc/include/sys/timeb.h13
-rw-r--r--mdk-stage1/dietlibc/include/sys/times.h12
-rw-r--r--mdk-stage1/dietlibc/include/sys/timex.h50
-rw-r--r--mdk-stage1/dietlibc/include/sys/types.h136
-rw-r--r--mdk-stage1/dietlibc/include/sys/ucontext.h110
-rw-r--r--mdk-stage1/dietlibc/include/sys/uio.h2
-rw-r--r--mdk-stage1/dietlibc/include/sys/un.h7
-rw-r--r--mdk-stage1/dietlibc/include/sys/vfs.h26
-rw-r--r--mdk-stage1/dietlibc/include/sys/wait.h10
-rw-r--r--mdk-stage1/dietlibc/include/sysexits.h26
-rw-r--r--mdk-stage1/dietlibc/include/tar.h36
-rw-r--r--mdk-stage1/dietlibc/include/termio.h4
-rw-r--r--mdk-stage1/dietlibc/include/termios.h373
-rw-r--r--mdk-stage1/dietlibc/include/time.h20
-rw-r--r--mdk-stage1/dietlibc/include/unistd.h113
-rw-r--r--mdk-stage1/dietlibc/include/utmp.h23
-rw-r--r--mdk-stage1/dietlibc/include/write12.h4
-rw-r--r--mdk-stage1/dietlibc/lib/__dtostr.c190
-rw-r--r--mdk-stage1/dietlibc/lib/__fstat64.c7
-rw-r--r--mdk-stage1/dietlibc/lib/__ftruncate64.c23
-rw-r--r--mdk-stage1/dietlibc/lib/__getcwd.c1
-rw-r--r--mdk-stage1/dietlibc/lib/__isinf.c15
-rw-r--r--mdk-stage1/dietlibc/lib/__isnan.c7
-rw-r--r--mdk-stage1/dietlibc/lib/__lltostr.c4
-rw-r--r--mdk-stage1/dietlibc/lib/__lstat64.c7
-rw-r--r--mdk-stage1/dietlibc/lib/__ltostr.c5
-rw-r--r--mdk-stage1/dietlibc/lib/__ptrace.c27
-rw-r--r--mdk-stage1/dietlibc/lib/__stat64.c7
-rw-r--r--mdk-stage1/dietlibc/lib/__stat64_cvt.c2
-rw-r--r--mdk-stage1/dietlibc/lib/__stime.c14
-rw-r--r--mdk-stage1/dietlibc/lib/__truncate64.c23
-rw-r--r--mdk-stage1/dietlibc/lib/__v_printf.c300
-rw-r--r--mdk-stage1/dietlibc/lib/__v_scanf.c391
-rw-r--r--mdk-stage1/dietlibc/lib/__xmknod.c6
-rw-r--r--mdk-stage1/dietlibc/lib/_brk.c13
-rw-r--r--mdk-stage1/dietlibc/lib/abort.c10
-rw-r--r--mdk-stage1/dietlibc/lib/abs.c10
-rw-r--r--mdk-stage1/dietlibc/lib/accept.c8
-rw-r--r--mdk-stage1/dietlibc/lib/adjtime.c18
-rw-r--r--mdk-stage1/dietlibc/lib/alarm.c47
-rw-r--r--mdk-stage1/dietlibc/lib/alloc.c372
-rw-r--r--mdk-stage1/dietlibc/lib/assert_fail.c11
-rw-r--r--mdk-stage1/dietlibc/lib/atexit.c32
-rw-r--r--mdk-stage1/dietlibc/lib/atoi.c21
-rw-r--r--mdk-stage1/dietlibc/lib/atol.c25
-rw-r--r--mdk-stage1/dietlibc/lib/atoll.c19
-rw-r--r--mdk-stage1/dietlibc/lib/bcd.c185
-rw-r--r--mdk-stage1/dietlibc/lib/bind.c11
-rw-r--r--mdk-stage1/dietlibc/lib/binshstr.c5
-rw-r--r--mdk-stage1/dietlibc/lib/bsearch.c30
-rw-r--r--mdk-stage1/dietlibc/lib/cfgetospeed.c8
-rw-r--r--mdk-stage1/dietlibc/lib/cfmakeraw.c3
-rw-r--r--mdk-stage1/dietlibc/lib/cfsetispeed.c22
-rw-r--r--mdk-stage1/dietlibc/lib/cfsetospeed.c14
-rw-r--r--mdk-stage1/dietlibc/lib/closedir.c3
-rw-r--r--mdk-stage1/dietlibc/lib/connect.c7
-rw-r--r--mdk-stage1/dietlibc/lib/creat.c4
-rw-r--r--mdk-stage1/dietlibc/lib/errlist.c132
-rw-r--r--mdk-stage1/dietlibc/lib/errlistu.c6
-rw-r--r--mdk-stage1/dietlibc/lib/errno_location.c2
-rw-r--r--mdk-stage1/dietlibc/lib/exec_lib.c7
-rw-r--r--mdk-stage1/dietlibc/lib/execl.c3
-rw-r--r--mdk-stage1/dietlibc/lib/execle.c26
-rw-r--r--mdk-stage1/dietlibc/lib/execlp.c6
-rw-r--r--mdk-stage1/dietlibc/lib/execv.c4
-rw-r--r--mdk-stage1/dietlibc/lib/execvp.c23
-rw-r--r--mdk-stage1/dietlibc/lib/ftw.c77
-rw-r--r--mdk-stage1/dietlibc/lib/getdomainname.c3
-rw-r--r--mdk-stage1/dietlibc/lib/getenv.c3
-rw-r--r--mdk-stage1/dietlibc/lib/gethostname.c3
-rw-r--r--mdk-stage1/dietlibc/lib/getopt.c155
-rw-r--r--mdk-stage1/dietlibc/lib/getpeername.c13
-rw-r--r--mdk-stage1/dietlibc/lib/getservent.c137
-rw-r--r--mdk-stage1/dietlibc/lib/getsockname.c11
-rw-r--r--mdk-stage1/dietlibc/lib/getsockopt.c11
-rw-r--r--mdk-stage1/dietlibc/lib/htonl.c1
-rw-r--r--mdk-stage1/dietlibc/lib/htons.c1
-rw-r--r--mdk-stage1/dietlibc/lib/if_indextoname.c3
-rw-r--r--mdk-stage1/dietlibc/lib/if_nameindex.c40
-rw-r--r--mdk-stage1/dietlibc/lib/if_nametoindex.c5
-rw-r--r--mdk-stage1/dietlibc/lib/ipv6constants.c4
-rw-r--r--mdk-stage1/dietlibc/lib/isalnum.c8
-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.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isblank.c4
-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.c7
-rw-r--r--mdk-stage1/dietlibc/lib/islower.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isprint.c7
-rw-r--r--mdk-stage1/dietlibc/lib/ispunct.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isspace.c7
-rw-r--r--mdk-stage1/dietlibc/lib/isupper.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isxdigit.c9
-rw-r--r--mdk-stage1/dietlibc/lib/labs.c6
-rw-r--r--mdk-stage1/dietlibc/lib/listen.c11
-rw-r--r--mdk-stage1/dietlibc/lib/llabs.c6
-rw-r--r--mdk-stage1/dietlibc/lib/lockf.c1
-rw-r--r--mdk-stage1/dietlibc/lib/longjmp.c57
-rw-r--r--mdk-stage1/dietlibc/lib/lseek64.c10
-rw-r--r--mdk-stage1/dietlibc/lib/memccmp.c17
-rw-r--r--mdk-stage1/dietlibc/lib/memccpy.c1
-rw-r--r--mdk-stage1/dietlibc/lib/memchr.c12
-rw-r--r--mdk-stage1/dietlibc/lib/memcmp.c2
-rw-r--r--mdk-stage1/dietlibc/lib/memcpy.c2
-rw-r--r--mdk-stage1/dietlibc/lib/memmem.c14
-rw-r--r--mdk-stage1/dietlibc/lib/memmove.c1
-rw-r--r--mdk-stage1/dietlibc/lib/memrchr.c15
-rw-r--r--mdk-stage1/dietlibc/lib/memset.c4
-rw-r--r--mdk-stage1/dietlibc/lib/mkfifo.c4
-rw-r--r--mdk-stage1/dietlibc/lib/msgctl.c3
-rw-r--r--mdk-stage1/dietlibc/lib/msgget.c3
-rw-r--r--mdk-stage1/dietlibc/lib/msgrcv.c8
-rw-r--r--mdk-stage1/dietlibc/lib/msgsnd.c3
-rw-r--r--mdk-stage1/dietlibc/lib/nop.c7
-rw-r--r--mdk-stage1/dietlibc/lib/open64.c9
-rw-r--r--mdk-stage1/dietlibc/lib/opendir.c26
-rw-r--r--mdk-stage1/dietlibc/lib/perror.c32
-rw-r--r--mdk-stage1/dietlibc/lib/pread.c1
-rw-r--r--mdk-stage1/dietlibc/lib/pread64.c3
-rw-r--r--mdk-stage1/dietlibc/lib/putenv.c19
-rw-r--r--mdk-stage1/dietlibc/lib/puts.c12
-rw-r--r--mdk-stage1/dietlibc/lib/pwrite.c11
-rw-r--r--mdk-stage1/dietlibc/lib/pwrite64.c14
-rw-r--r--mdk-stage1/dietlibc/lib/qsort.c22
-rw-r--r--mdk-stage1/dietlibc/lib/raise.c3
-rw-r--r--mdk-stage1/dietlibc/lib/rand.c7
-rw-r--r--mdk-stage1/dietlibc/lib/rand48.c89
-rw-r--r--mdk-stage1/dietlibc/lib/rand_r.c30
-rw-r--r--mdk-stage1/dietlibc/lib/random.c9
-rw-r--r--mdk-stage1/dietlibc/lib/readdir.c2
-rw-r--r--mdk-stage1/dietlibc/lib/readdir64.c62
-rw-r--r--mdk-stage1/dietlibc/lib/reboot.c6
-rw-r--r--mdk-stage1/dietlibc/lib/recv.c8
-rw-r--r--mdk-stage1/dietlibc/lib/recvfrom.c8
-rw-r--r--mdk-stage1/dietlibc/lib/recvmsg.c8
-rw-r--r--mdk-stage1/dietlibc/lib/remove.c2
-rw-r--r--mdk-stage1/dietlibc/lib/sbrk.c11
-rw-r--r--mdk-stage1/dietlibc/lib/semctl.c13
-rw-r--r--mdk-stage1/dietlibc/lib/semget.c3
-rw-r--r--mdk-stage1/dietlibc/lib/semop.c3
-rw-r--r--mdk-stage1/dietlibc/lib/send.c8
-rw-r--r--mdk-stage1/dietlibc/lib/sendmsg.c8
-rw-r--r--mdk-stage1/dietlibc/lib/sendto.c10
-rw-r--r--mdk-stage1/dietlibc/lib/set_errno.c9
-rw-r--r--mdk-stage1/dietlibc/lib/setlinebuf.c12
-rw-r--r--mdk-stage1/dietlibc/lib/setsockopt.c11
-rw-r--r--mdk-stage1/dietlibc/lib/shmat.c5
-rw-r--r--mdk-stage1/dietlibc/lib/shmctl.c3
-rw-r--r--mdk-stage1/dietlibc/lib/shmdt.c3
-rw-r--r--mdk-stage1/dietlibc/lib/shmget.c3
-rw-r--r--mdk-stage1/dietlibc/lib/shutdown.c8
-rw-r--r--mdk-stage1/dietlibc/lib/sigaction.c11
-rw-r--r--mdk-stage1/dietlibc/lib/sigaddset.c28
-rw-r--r--mdk-stage1/dietlibc/lib/sigdelset.c28
-rw-r--r--mdk-stage1/dietlibc/lib/sigemptyset.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sigfillset.c16
-rw-r--r--mdk-stage1/dietlibc/lib/siginterrupt.c17
-rw-r--r--mdk-stage1/dietlibc/lib/sigismember.c29
-rw-r--r--mdk-stage1/dietlibc/lib/sigjmp.c35
-rw-r--r--mdk-stage1/dietlibc/lib/signal.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sigpending.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sigprocmask.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sigqueueinfo.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sigsuspend.c10
-rw-r--r--mdk-stage1/dietlibc/lib/sigtimedwait.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sleep.c2
-rw-r--r--mdk-stage1/dietlibc/lib/snprintf.c3
-rw-r--r--mdk-stage1/dietlibc/lib/socket.c11
-rw-r--r--mdk-stage1/dietlibc/lib/socketpair.c12
-rw-r--r--mdk-stage1/dietlibc/lib/speed.c67
-rw-r--r--mdk-stage1/dietlibc/lib/sprintf.c10
-rw-r--r--mdk-stage1/dietlibc/lib/sscanf.c3
-rw-r--r--mdk-stage1/dietlibc/lib/strcasecmp.c29
-rw-r--r--mdk-stage1/dietlibc/lib/strchr.c1
-rw-r--r--mdk-stage1/dietlibc/lib/strcmp.c2
-rw-r--r--mdk-stage1/dietlibc/lib/strcpy.c7
-rw-r--r--mdk-stage1/dietlibc/lib/strerror.c22
-rw-r--r--mdk-stage1/dietlibc/lib/strlen.c2
-rw-r--r--mdk-stage1/dietlibc/lib/strncasecmp.c34
-rw-r--r--mdk-stage1/dietlibc/lib/strncat.c7
-rw-r--r--mdk-stage1/dietlibc/lib/strncmp.c13
-rw-r--r--mdk-stage1/dietlibc/lib/strncpy.c9
-rw-r--r--mdk-stage1/dietlibc/lib/strsep.c4
-rw-r--r--mdk-stage1/dietlibc/lib/strstr.c8
-rw-r--r--mdk-stage1/dietlibc/lib/strtod.c104
-rw-r--r--mdk-stage1/dietlibc/lib/strtof.c66
-rw-r--r--mdk-stage1/dietlibc/lib/strtok.c2
-rw-r--r--mdk-stage1/dietlibc/lib/strtol.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strtold.c66
-rw-r--r--mdk-stage1/dietlibc/lib/strtoll.c5
-rw-r--r--mdk-stage1/dietlibc/lib/strtoul.c32
-rw-r--r--mdk-stage1/dietlibc/lib/strtoull.c1
-rw-r--r--mdk-stage1/dietlibc/lib/strxfrm.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sys_siglist.c209
-rw-r--r--mdk-stage1/dietlibc/lib/tcdrain.c1
-rw-r--r--mdk-stage1/dietlibc/lib/tcflow.c35
-rw-r--r--mdk-stage1/dietlibc/lib/tcflush.c24
-rw-r--r--mdk-stage1/dietlibc/lib/tcgetpgrp.c7
-rw-r--r--mdk-stage1/dietlibc/lib/tcsendbreak.c11
-rw-r--r--mdk-stage1/dietlibc/lib/tcsetattr.c46
-rw-r--r--mdk-stage1/dietlibc/lib/tcsetpgrp.c1
-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.c21
-rw-r--r--mdk-stage1/dietlibc/lib/usleep.c6
-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.c255
-rw-r--r--mdk-stage1/dietlibc/lib/vsprintf.c10
-rw-r--r--mdk-stage1/dietlibc/lib/vsscanf.c311
-rw-r--r--mdk-stage1/dietlibc/lib/write12.c11
-rw-r--r--mdk-stage1/dietlibc/libcompat/daemon.c29
-rw-r--r--mdk-stage1/dietlibc/libcompat/getdelim.c32
-rw-r--r--mdk-stage1/dietlibc/libcompat/getline.c9
-rw-r--r--mdk-stage1/dietlibc/libcompat/re_bsd.c34
-rw-r--r--mdk-stage1/dietlibc/libcompat/stpcpy.c6
-rw-r--r--mdk-stage1/dietlibc/libcompat/syscall.S70
-rw-r--r--mdk-stage1/dietlibc/libcruft/__end_parse.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/__parse.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/__parse_1.c9
-rw-r--r--mdk-stage1/dietlibc/libcruft/__parse_nws.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/__parse_ws.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/__prepare_parse.c19
-rw-r--r--mdk-stage1/dietlibc/libcruft/alphasort.c6
-rw-r--r--mdk-stage1/dietlibc/libcruft/alphasort64.c6
-rw-r--r--mdk-stage1/dietlibc/libcruft/bcopy.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/bzero.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/clock.c21
-rw-r--r--mdk-stage1/dietlibc/libcruft/dn_expand.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft.c132
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft2.c264
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft3.c3
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft4.c11
-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/getgrent.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrent_r.c78
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrgid.c13
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrgid_r.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrnam.c13
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrnam_r.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyaddr.c37
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c2
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c67
-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.c35
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname_r.c54
-rw-r--r--mdk-stage1/dietlibc/libcruft/getlogin.c3
-rw-r--r--mdk-stage1/dietlibc/libcruft/getopt_data.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/getopt_long.c103
-rw-r--r--mdk-stage1/dietlibc/libcruft/getopt_long_only.c108
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpagesize.c1
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpass.c24
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwent.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwent_r.c65
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwnam.c15
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwnam_r.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwuid.c12
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwuid_r.c13
-rw-r--r--mdk-stage1/dietlibc/libcruft/getspent.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/getspent_r.c68
-rw-r--r--mdk-stage1/dietlibc/libcruft/getspnam.c15
-rw-r--r--mdk-stage1/dietlibc/libcruft/getspnam_r.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getusershell.c33
-rw-r--r--mdk-stage1/dietlibc/libcruft/grbuf.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/grent.c54
-rw-r--r--mdk-stage1/dietlibc/libcruft/herrno_location.c9
-rw-r--r--mdk-stage1/dietlibc/libcruft/herror.c8
-rw-r--r--mdk-stage1/dietlibc/libcruft/hstrerror.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_aton.c2
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntoa.c2
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntop.c12
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_pton.c17
-rw-r--r--mdk-stage1/dietlibc/libcruft/initgroups.c3
-rw-r--r--mdk-stage1/dietlibc/libcruft/killpg.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/localeconv.c15
-rw-r--r--mdk-stage1/dietlibc/libcruft/mkdtemp.c28
-rw-r--r--mdk-stage1/dietlibc/libcruft/mkstemp.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/mktemp.c17
-rw-r--r--mdk-stage1/dietlibc/libcruft/pwbuf.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/pwent.c43
-rw-r--r--mdk-stage1/dietlibc/libcruft/res_init.c6
-rw-r--r--mdk-stage1/dietlibc/libcruft/res_mkquery.c75
-rw-r--r--mdk-stage1/dietlibc/libcruft/res_query.c95
-rw-r--r--mdk-stage1/dietlibc/libcruft/res_search.c35
-rw-r--r--mdk-stage1/dietlibc/libcruft/scan_ulong.c13
-rw-r--r--mdk-stage1/dietlibc/libcruft/scandir.c47
-rw-r--r--mdk-stage1/dietlibc/libcruft/scandir64.c47
-rw-r--r--mdk-stage1/dietlibc/libcruft/setegid.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/seteuid.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/setlocale.c7
-rw-r--r--mdk-stage1/dietlibc/libcruft/spbuf.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/spent.c45
-rw-r--r--mdk-stage1/dietlibc/libcruft/sysconf.c43
-rw-r--r--mdk-stage1/dietlibc/libcruft/sysconf_cpus.c64
-rw-r--r--mdk-stage1/dietlibc/libcruft/tempnam.c32
-rw-r--r--mdk-stage1/dietlibc/libcruft/tmpnam.c31
-rw-r--r--mdk-stage1/dietlibc/libcrypt/crypt.c31
-rw-r--r--mdk-stage1/dietlibc/libcrypt/md5.c243
-rw-r--r--mdk-stage1/dietlibc/libcrypt/md5crypt.c157
-rw-r--r--mdk-stage1/dietlibc/libdl/Makefile32
-rw-r--r--mdk-stage1/dietlibc/libdl/README82
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_alloc.c81
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_int.h138
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_jump.S53
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_load.c401
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_main.c1059
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_open.c228
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_queue.c39
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_rel.c42
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_rel.h25
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_relocate.c96
-rw-r--r--mdk-stage1/dietlibc/libdl/_dl_search.c81
-rw-r--r--mdk-stage1/dietlibc/libdl/dlclose.c40
-rw-r--r--mdk-stage1/dietlibc/libdl/dlerror.c57
-rw-r--r--mdk-stage1/dietlibc/libdl/dlopen.c31
-rw-r--r--mdk-stage1/dietlibc/libdl/dlsym.c93
-rw-r--r--mdk-stage1/dietlibc/libdl/elf_hash.c12
-rw-r--r--mdk-stage1/dietlibc/libdl/elf_hash.h10
-rw-r--r--mdk-stage1/dietlibc/libdl/test/test.c20
-rw-r--r--mdk-stage1/dietlibc/libdl/test/test_so.c11
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c3
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c5
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-islower.c3
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-isprint.c4
-rw-r--r--mdk-stage1/dietlibc/liblatin1/latin1-isupper.c3
-rw-r--r--mdk-stage1/dietlibc/libm/acosh.c6
-rw-r--r--mdk-stage1/dietlibc/libm/asinh.c6
-rw-r--r--mdk-stage1/dietlibc/libm/atanh.c8
-rw-r--r--mdk-stage1/dietlibc/libm/bessel.c171
-rw-r--r--mdk-stage1/dietlibc/libm/cosh.c9
-rw-r--r--mdk-stage1/dietlibc/libm/erf.c95
-rw-r--r--mdk-stage1/dietlibc/libm/gamma.c98
-rw-r--r--mdk-stage1/dietlibc/libm/ipow.c29
-rw-r--r--mdk-stage1/dietlibc/libm/poly.c41
-rw-r--r--mdk-stage1/dietlibc/libm/pow.c42
-rw-r--r--mdk-stage1/dietlibc/libm/rint.c5
-rw-r--r--mdk-stage1/dietlibc/libm/sinh.c9
-rw-r--r--mdk-stage1/dietlibc/libm/tanh.c7
-rw-r--r--mdk-stage1/dietlibc/libpthread/CHANGES6
-rw-r--r--mdk-stage1/dietlibc/libpthread/Makefile7
-rw-r--r--mdk-stage1/dietlibc/libpthread/README10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_atfork.c2
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_init.c1
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cancel.c6
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c9
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c4
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_init.c1
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c2
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c51
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c26
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_create.c27
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_detach.c11
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_equal.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_errno.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_fdglue2.c16
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_fgetc.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_flockfile.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_fputc.c9
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_funlockfile.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_getschedparam.c22
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_internal.c (renamed from mdk-stage1/dietlibc/libpthread/thread_internal.c)67
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_join.c21
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_key.c (renamed from mdk-stage1/dietlibc/libpthread/thread_key.c)11
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_key_create.c7
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_key_delete.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c5
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c2
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c21
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c9
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c9
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_setschedparam.c21
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_setspecific.c3
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sigmask.c8
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_spinlock.c12
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c18
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c1
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_fdatasync.c10
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c2
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_open.c1
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c2
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c2
-rw-r--r--mdk-stage1/dietlibc/libpthread/pthread_testcancel.c2
-rw-r--r--mdk-stage1/dietlibc/libpthread/thread_internal.h23
-rw-r--r--mdk-stage1/dietlibc/libregex/rx.c128
-rw-r--r--mdk-stage1/dietlibc/librpc/auth_none.c12
-rw-r--r--mdk-stage1/dietlibc/librpc/auth_unix.c17
-rw-r--r--mdk-stage1/dietlibc/librpc/authunix_prot.c2
-rw-r--r--mdk-stage1/dietlibc/librpc/bindresvport.c4
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_generic.c10
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_raw.c17
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_simple.c10
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_tcp.c48
-rw-r--r--mdk-stage1/dietlibc/librpc/clnt_udp.c51
-rw-r--r--mdk-stage1/dietlibc/librpc/get_myaddress.c2
-rw-r--r--mdk-stage1/dietlibc/librpc/getrpcent.c9
-rw-r--r--mdk-stage1/dietlibc/librpc/getrpcport.c6
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_clnt.c17
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_getmaps.c5
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_getport.c16
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_prot2.c4
-rw-r--r--mdk-stage1/dietlibc/librpc/pmap_rmt.c111
-rw-r--r--mdk-stage1/dietlibc/librpc/rpc_callmsg.c12
-rw-r--r--mdk-stage1/dietlibc/librpc/rpc_prot.c4
-rw-r--r--mdk-stage1/dietlibc/librpc/svc.c39
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_auth_unix.c6
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_raw.c6
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_run.c2
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_simple.c6
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_tcp.c58
-rw-r--r--mdk-stage1/dietlibc/librpc/svc_udp.c86
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr.c36
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_array.c38
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_mem.c36
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_rec.c138
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_reference.c14
-rw-r--r--mdk-stage1/dietlibc/librpc/xdr_stdio.c26
-rw-r--r--mdk-stage1/dietlibc/libshell/basename.c27
-rw-r--r--mdk-stage1/dietlibc/libshell/dirname.c25
-rw-r--r--mdk-stage1/dietlibc/libshell/fnmatch.c34
-rw-r--r--mdk-stage1/dietlibc/libshell/glob.c84
-rw-r--r--mdk-stage1/dietlibc/libshell/realpath.c18
-rw-r--r--mdk-stage1/dietlibc/libstdio/fclose.c8
-rw-r--r--mdk-stage1/dietlibc/libstdio/fdglue.c34
-rw-r--r--mdk-stage1/dietlibc/libstdio/fdglue2.c43
-rw-r--r--mdk-stage1/dietlibc/libstdio/fdopen.c18
-rw-r--r--mdk-stage1/dietlibc/libstdio/fdprintf.c13
-rw-r--r--mdk-stage1/dietlibc/libstdio/feof.c2
-rw-r--r--mdk-stage1/dietlibc/libstdio/fflush.c34
-rw-r--r--mdk-stage1/dietlibc/libstdio/fgetc_unlocked.c (renamed from mdk-stage1/dietlibc/libstdio/fgetc.c)18
-rw-r--r--mdk-stage1/dietlibc/libstdio/fgetpos.c8
-rw-r--r--mdk-stage1/dietlibc/libstdio/fgets.c4
-rw-r--r--mdk-stage1/dietlibc/libstdio/fopen.c8
-rw-r--r--mdk-stage1/dietlibc/libstdio/fprintf.c18
-rw-r--r--mdk-stage1/dietlibc/libstdio/fputc.c19
-rw-r--r--mdk-stage1/dietlibc/libstdio/fputc_unlocked.c20
-rw-r--r--mdk-stage1/dietlibc/libstdio/fread.c55
-rw-r--r--mdk-stage1/dietlibc/libstdio/fscanf.c14
-rw-r--r--mdk-stage1/dietlibc/libstdio/fseek.c7
-rw-r--r--mdk-stage1/dietlibc/libstdio/fseeko.c10
-rw-r--r--mdk-stage1/dietlibc/libstdio/fseeko64.c12
-rw-r--r--mdk-stage1/dietlibc/libstdio/fsetpos.c7
-rw-r--r--mdk-stage1/dietlibc/libstdio/ftell.c2
-rw-r--r--mdk-stage1/dietlibc/libstdio/ftello.c7
-rw-r--r--mdk-stage1/dietlibc/libstdio/ftello64.c9
-rw-r--r--mdk-stage1/dietlibc/libstdio/fwrite.c28
-rw-r--r--mdk-stage1/dietlibc/libstdio/printf.c20
-rw-r--r--mdk-stage1/dietlibc/libstdio/puts.c16
-rw-r--r--mdk-stage1/dietlibc/libstdio/scanf.c14
-rw-r--r--mdk-stage1/dietlibc/libstdio/setvbuf.c32
-rw-r--r--mdk-stage1/dietlibc/libstdio/stderr.c25
-rw-r--r--mdk-stage1/dietlibc/libstdio/stdin.c26
-rw-r--r--mdk-stage1/dietlibc/libstdio/stdout.c25
-rw-r--r--mdk-stage1/dietlibc/libstdio/tmpfile.c12
-rw-r--r--mdk-stage1/dietlibc/libstdio/ungetc.c7
-rw-r--r--mdk-stage1/dietlibc/libstdio/vfdprintf.c15
-rw-r--r--mdk-stage1/dietlibc/libstdio/vfprintf.c15
-rw-r--r--mdk-stage1/dietlibc/libstdio/vfscanf.c11
-rw-r--r--mdk-stage1/dietlibc/libstdio/vprintf.c15
-rw-r--r--mdk-stage1/dietlibc/libstdio/vscanf.c10
-rw-r--r--mdk-stage1/dietlibc/libugly/asctime_r.c2
-rw-r--r--mdk-stage1/dietlibc/libugly/asprintf.c9
-rw-r--r--mdk-stage1/dietlibc/libugly/daemon.c35
-rw-r--r--mdk-stage1/dietlibc/libugly/difftime.c8
-rw-r--r--mdk-stage1/dietlibc/libugly/dirfd.c8
-rw-r--r--mdk-stage1/dietlibc/libugly/freeaddrinfo.c11
-rw-r--r--mdk-stage1/dietlibc/libugly/ftime.c15
-rw-r--r--mdk-stage1/dietlibc/libugly/gai_strerror.c13
-rw-r--r--mdk-stage1/dietlibc/libugly/getaddrinfo.c140
-rw-r--r--mdk-stage1/dietlibc/libugly/gethostent.c116
-rw-r--r--mdk-stage1/dietlibc/libugly/getmntent.c11
-rw-r--r--mdk-stage1/dietlibc/libugly/getnameinfo.c46
-rw-r--r--mdk-stage1/dietlibc/libugly/getprotobyname.c12
-rw-r--r--mdk-stage1/dietlibc/libugly/getprotobyname_r.c17
-rw-r--r--mdk-stage1/dietlibc/libugly/getprotobynumber.c12
-rw-r--r--mdk-stage1/dietlibc/libugly/getprotobynumber_r.c13
-rw-r--r--mdk-stage1/dietlibc/libugly/getprotoent.c130
-rw-r--r--mdk-stage1/dietlibc/libugly/getprotoent_r.c78
-rw-r--r--mdk-stage1/dietlibc/libugly/getservbyname.c12
-rw-r--r--mdk-stage1/dietlibc/libugly/getservbyname_r.c18
-rw-r--r--mdk-stage1/dietlibc/libugly/getservbyport.c12
-rw-r--r--mdk-stage1/dietlibc/libugly/getservbyport_r.c13
-rw-r--r--mdk-stage1/dietlibc/libugly/getservent.c10
-rw-r--r--mdk-stage1/dietlibc/libugly/getservent_r.c91
-rw-r--r--mdk-stage1/dietlibc/libugly/gmtime_r.c6
-rw-r--r--mdk-stage1/dietlibc/libugly/grantpt.c13
-rw-r--r--mdk-stage1/dietlibc/libugly/hasmntopt.c18
-rw-r--r--mdk-stage1/dietlibc/libugly/iconv.c71
-rw-r--r--mdk-stage1/dietlibc/libugly/iconv_close.c7
-rw-r--r--mdk-stage1/dietlibc/libugly/iconv_open.c28
-rw-r--r--mdk-stage1/dietlibc/libugly/isleap.c2
-rw-r--r--mdk-stage1/dietlibc/libugly/localtime_r.c8
-rw-r--r--mdk-stage1/dietlibc/libugly/logging.c38
-rw-r--r--mdk-stage1/dietlibc/libugly/mktime.c68
-rw-r--r--mdk-stage1/dietlibc/libugly/netent.c130
-rw-r--r--mdk-stage1/dietlibc/libugly/openpty.c54
-rw-r--r--mdk-stage1/dietlibc/libugly/popen.c28
-rw-r--r--mdk-stage1/dietlibc/libugly/protoent_buf.c5
-rw-r--r--mdk-stage1/dietlibc/libugly/ptsname.c17
-rw-r--r--mdk-stage1/dietlibc/libugly/putpwent.c19
-rw-r--r--mdk-stage1/dietlibc/libugly/servent_buf.c5
-rw-r--r--mdk-stage1/dietlibc/libugly/setenv.c12
-rw-r--r--mdk-stage1/dietlibc/libugly/strftime.c284
-rw-r--r--mdk-stage1/dietlibc/libugly/strndup.c10
-rw-r--r--mdk-stage1/dietlibc/libugly/strsignal.c92
-rw-r--r--mdk-stage1/dietlibc/libugly/system.c36
-rw-r--r--mdk-stage1/dietlibc/libugly/time_table_spd.c5
-rw-r--r--mdk-stage1/dietlibc/libugly/timezone.c3
-rw-r--r--mdk-stage1/dietlibc/libugly/tzfile.c37
-rw-r--r--mdk-stage1/dietlibc/libugly/unlockpt.c10
-rw-r--r--mdk-stage1/dietlibc/libugly/utent.c103
-rw-r--r--mdk-stage1/dietlibc/libugly/wtent.c30
-rw-r--r--mdk-stage1/dietlibc/linuxnet.h19
-rw-r--r--mdk-stage1/dietlibc/parselib.h23
-rw-r--r--mdk-stage1/dietlibc/ppc/__testandset.S9
-rw-r--r--mdk-stage1/dietlibc/ppc/clone.S48
-rw-r--r--mdk-stage1/dietlibc/ppc/mmap.c11
-rw-r--r--mdk-stage1/dietlibc/ppc/start.S32
-rw-r--r--mdk-stage1/dietlibc/ppc/syscalls.h259
-rw-r--r--mdk-stage1/dietlibc/ppc/unified.S37
-rw-r--r--mdk-stage1/dietlibc/profiling/PORTING25
-rw-r--r--mdk-stage1/dietlibc/profiling/README37
-rw-r--r--mdk-stage1/dietlibc/profiling/__mcount.c24
-rw-r--r--mdk-stage1/dietlibc/profiling/monitor.c93
-rw-r--r--mdk-stage1/dietlibc/profiling/profil.c75
-rw-r--r--mdk-stage1/dietlibc/sparc/Makefile.add1
-rw-r--r--mdk-stage1/dietlibc/sparc/__longjmp.S1
-rw-r--r--mdk-stage1/dietlibc/sparc/clone.S5
-rw-r--r--mdk-stage1/dietlibc/sparc/errlist.S280
-rw-r--r--mdk-stage1/dietlibc/sparc/fork.S2
-rw-r--r--mdk-stage1/dietlibc/sparc/mmap.c4
-rw-r--r--mdk-stage1/dietlibc/sparc/pipe.S2
-rw-r--r--mdk-stage1/dietlibc/sparc/setjmp.S28
-rw-r--r--mdk-stage1/dietlibc/sparc/shmat.c2
-rw-r--r--mdk-stage1/dietlibc/sparc/sigaction.c7
-rw-r--r--mdk-stage1/dietlibc/sparc/start.S58
-rw-r--r--mdk-stage1/dietlibc/sparc/strlen.S11
-rw-r--r--mdk-stage1/dietlibc/sparc/syscalls.h276
-rw-r--r--mdk-stage1/dietlibc/sparc/udiv.S102
-rw-r--r--mdk-stage1/dietlibc/sparc/umul.S6
-rw-r--r--mdk-stage1/dietlibc/sparc/unified.S10
-rw-r--r--mdk-stage1/dietlibc/sparc/urem.S102
-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/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/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/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.h151
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/__pread.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/__pwrite.S (renamed from mdk-stage1/dietlibc/syscalls.s/pwrite.S)0
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/_llseek.S4
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/adjtimex.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/alarm.S4
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/bdflush.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/chown32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/create_module.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/delete_module.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/environ.S16
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/epoll_create.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/epoll_ctl.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/epoll_wait.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/errlist.S293
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/errno.S8
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/exit.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fchown32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fdatasync.S6
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/fstat64.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ftruncate64.S10
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getdents64.S1
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getegid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/geteuid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getgid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getgroups32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getresgid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getresuid.S4
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/getuid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/init_module.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ioperm.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ipc.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/lchown32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/llseek.S6
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/lstat64.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/madvise.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mlock.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/mmap2.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/msync.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/munlock.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigaction.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigpending.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/nice.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/pause.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/pivot_root.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/prctl.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ptrace.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/ptrace.s3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rt_sigaction.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rt_sigpending.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rt_sigprocmask.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rt_sigqueueinfo.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rt_sigsuspend.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/rt_sigtimedwait.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sendfile.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sendfile64.S8
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setfsgid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setfsgid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setfsuid.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setfsuid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setgid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setregid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setresgid.S4
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setresgid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setresuid.S4
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setreuid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/settimeofday.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/setuid32.S5
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigaction.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/signal.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigpending.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigprocmask.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/sigsuspend.S3
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/socketcall.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/stat64.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/stime.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/syslog.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/time.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/truncate64.S10
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/umount2.S2
-rw-r--r--mdk-stage1/dietlibc/syscalls.s/waitpid.S2
-rwxr-xr-xmdk-stage1/dietlibc/threadsafe.sh5
-rw-r--r--mdk-stage1/dietlibc/x86_64/Makefile.add2
-rw-r--r--mdk-stage1/dietlibc/x86_64/__longjmp.S26
-rw-r--r--mdk-stage1/dietlibc/x86_64/__testandset.S12
-rw-r--r--mdk-stage1/dietlibc/x86_64/accept.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/bind.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/clone.S64
-rw-r--r--mdk-stage1/dietlibc/x86_64/connect.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/getpeername.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/getsockname.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/getsockopt.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/listen.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/mmap.S8
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgctl.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgget.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgrcv.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/msgsnd.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/recv.c13
-rw-r--r--mdk-stage1/dietlibc/x86_64/recvfrom.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/recvmsg.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/semctl.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/semget.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/semop.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/send.c13
-rw-r--r--mdk-stage1/dietlibc/x86_64/sendmsg.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/sendto.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/setjmp.S37
-rw-r--r--mdk-stage1/dietlibc/x86_64/setsockopt.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmat.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmctl.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmdt.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shmget.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/shutdown.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/sigaction.c26
-rw-r--r--mdk-stage1/dietlibc/x86_64/socket.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/socketpair.S3
-rw-r--r--mdk-stage1/dietlibc/x86_64/start.S55
-rw-r--r--mdk-stage1/dietlibc/x86_64/syscalls.h282
-rw-r--r--mdk-stage1/dietlibc/x86_64/umount.S9
-rw-r--r--mdk-stage1/dietlibc/x86_64/unified.S32
-rw-r--r--mdk-stage1/dietlibc/x86_64/waitpid.S12
-rw-r--r--mdk-stage1/disk.c2
-rw-r--r--mdk-stage1/dns.c11
-rw-r--r--mdk-stage1/frontend.h8
-rw-r--r--mdk-stage1/init-libc-headers.h1
-rw-r--r--mdk-stage1/init.c6
-rw-r--r--mdk-stage1/insmod-busybox/Config.h13
-rw-r--r--mdk-stage1/insmod-busybox/Makefile38
-rw-r--r--mdk-stage1/insmod-busybox/busybox.h10
-rw-r--r--mdk-stage1/insmod-busybox/insmod.c1749
-rw-r--r--mdk-stage1/insmod-modutils/Makefile24
-rw-r--r--mdk-stage1/insmod-modutils/include/config.h3
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_alpha.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_arm.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_i386.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_m68k.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_mips.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_ppc.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_s390.h5
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_sparc.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_sparc64.h1
-rw-r--r--mdk-stage1/insmod-modutils/include/elf_x86_64.h9
-rw-r--r--mdk-stage1/insmod-modutils/include/kallsyms.h8
-rw-r--r--mdk-stage1/insmod-modutils/include/kerneld.h2
-rw-r--r--mdk-stage1/insmod-modutils/include/module.h17
-rw-r--r--mdk-stage1/insmod-modutils/include/obj.h39
-rw-r--r--mdk-stage1/insmod-modutils/include/util.h8
-rw-r--r--mdk-stage1/insmod-modutils/include/version.h2
-rw-r--r--mdk-stage1/insmod-modutils/insmod.c255
-rw-r--r--mdk-stage1/insmod-modutils/obj/Makefile11
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_alpha.c49
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_arm.c22
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_common.c41
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_gpl_license.c61
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_hppa.c74
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_hppa64.c60
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_i386.c14
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_ia64.c79
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_kallsyms.c6
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_load.c29
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_m68k.c2
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_mips.c22
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_ppc.c35
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_reloc.c46
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_s390.c181
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_sparc.c2
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_sparc64.c2
-rw-r--r--mdk-stage1/insmod-modutils/obj/obj_x86_64.c253
-rw-r--r--mdk-stage1/insmod-modutils/util/Makefile8
-rw-r--r--mdk-stage1/insmod-modutils/util/alias.h80
-rw-r--r--mdk-stage1/insmod-modutils/util/arch64.c16
-rw-r--r--mdk-stage1/insmod-modutils/util/config.c29
-rw-r--r--mdk-stage1/insmod-modutils/util/logger.c49
-rw-r--r--mdk-stage1/insmod-modutils/util/snap_shot.c4
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_cm.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_dm.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_gks.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_nim.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_oim.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/sys_qm.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/xmalloc.c4
-rw-r--r--mdk-stage1/insmod-modutils/util/xrealloc.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/xstrcat.c2
-rw-r--r--mdk-stage1/insmod-modutils/util/xstrdup.c4
-rw-r--r--mdk-stage1/insmod-modutils/util/xsystem.c2
-rw-r--r--mdk-stage1/log.c7
-rw-r--r--mdk-stage1/mar/Makefile16
-rw-r--r--mdk-stage1/minilibc.c67
-rw-r--r--mdk-stage1/minilibc.h24
-rw-r--r--mdk-stage1/newt/Makefile16
-rw-r--r--mdk-stage1/newt/form.c1
-rw-r--r--mdk-stage1/rescue-gui.c18
-rw-r--r--mdk-stage1/slang/Makefile16
-rw-r--r--mdk-stage1/stage1.h2
-rw-r--r--mdk-stage1/stdio-frontend.c2
-rw-r--r--mdk-stage1/tools.c1
-rw-r--r--perl-install/Makefile4
-rw-r--r--perl-install/Xconfig/card.pm2
-rw-r--r--perl-install/any.pm10
-rw-r--r--perl-install/bootloader.pm126
-rw-r--r--perl-install/detect_devices.pm10
-rw-r--r--perl-install/drakxtools.spec15
-rw-r--r--perl-install/fs.pm9
-rw-r--r--perl-install/fsedit.pm2
-rw-r--r--perl-install/harddrake/data.pm2
-rw-r--r--perl-install/install_any.pm23
-rw-r--r--perl-install/install_gtk.pm12
-rw-r--r--perl-install/install_steps_gtk.pm20
-rw-r--r--perl-install/list.sparc74
-rw-r--r--perl-install/partition_table.pm10
-rw-r--r--perl-install/printerdrake.pm13
-rw-r--r--perl-install/proxy.pm2
-rw-r--r--perl-install/share/compssList1665
-rw-r--r--perl-install/share/list4
-rw-r--r--perl-install/share/list.ia647
-rw-r--r--perl-install/share/list.x86_64242
-rw-r--r--perl-install/share/po/br.po12831
-rwxr-xr-xperl-install/standalone/drakboot9
-rw-r--r--perl-install/steps.pm2
-rw-r--r--rescue/list18
-rw-r--r--rescue/list.ia648
-rw-r--r--rescue/list.x86_642
-rw-r--r--tools/Makefile2
-rw-r--r--tools/aewm-drakx/client.c2
-rw-r--r--tools/aewm-drakx/misc.c1
1204 files changed, 37346 insertions, 22183 deletions
diff --git a/Makefile b/Makefile
index 7d252daa1..f36aef882 100644
--- a/Makefile
+++ b/Makefile
@@ -19,9 +19,15 @@ endif
ifeq (ia64,$(ARCH))
BOOT_IMG = all.img
endif
+ifeq (x86_64,$(ARCH))
+ BOOT_IMG = cdrom.img hd.img network.img usb.img blank.img other.img
+endif
FBOOT_IMG = $(BOOT_IMG:%=images/%)
-FBOOT_RDZ = $(FBOOT_IMG:%.img=%.rdz) images/all.rdz
+FBOOT_RDZ = $(FBOOT_IMG:%.img=%.rdz)
+ifneq (all.img,$(findstring all.img,$(BOOT_IMG)))
+FBOOT_RDZ += images/all.rdz
+endif
.PHONY: dirs install
@@ -65,6 +71,11 @@ install_only:
cp -f images/cdrom-changedisk.img $(ROOTDEST)/images
endif
+ ifeq (x86_64,$(ARCH))
+ rm -rf $(ROOTDEST)/isolinux
+ cp -af isolinux $(ROOTDEST)
+ endif
+
install live_update $(ROOTDEST)/live_update
make -C perl-install full_stage2
make -C perl-install/share/advertising install
diff --git a/docs/README b/docs/README
index d35508e66..f35b3c49f 100644
--- a/docs/README
+++ b/docs/README
@@ -267,6 +267,43 @@ then, on another computer:
% DISPLAY=test_machine:0 xwd -root | convert - screenshot.png
********************************************************************************
+* Auto install *****************************************************************
+********************************************************************************
+A powerful auto-install system is available. It allows performing
+an install without any human interaction.
+
+To feed automatic parameters to the stage1 part (the textmode
+part - might not be necessary for you if you plan to do
+cdrom-based auto-installs, but mostly highly needed when doing
+network installs), please refer to ../mdk-stage1/doc/TECH-INFOS.
+
+About the stage2 part (the actual installer, at the time you're
+(usually) running in graphical mode), please refer to the nice
+documentation written by David Eastcott. Either install the
+package "drakx-autoinstall-doc" from contrib, or browse:
+
+http://members.shaw.ca/mandrake/drakx/9.0/HTML/
+
+The previous document will explain you how to setup the contents
+of the auto_inst.cfg file. Note that you have 3 alternatives for
+providing this file:
+- from a floppy disk; use "kickstart=floppy" as kernel parameter,
+ as explained in the document
+- from the installation volume itself; put the file in the
+ "Mandrake/base" directory of the installation volume; use
+ "kickstart" only, or "kickstart=filename" to specify another
+ filename than auto_inst.cfg
+- specified by the network; setup your DHCP server to provide the
+ "bootfile" parameter, this file will be used as the
+ "auto_inst.cfg" file, in the case you also provide the
+ "netauto" boot parameter
+
+In any case, if the specified file ends with -IP or -IP.pl, IP
+will be substituted by the IP address of the machine, when doing
+a network install. Might be useful so that you can control all
+your auto installs from your server.
+
+********************************************************************************
* Miscellaneous ****************************************************************
********************************************************************************
> o Media access methods: nfs, ftp, http, hd, cdrom
diff --git a/kernel/Makefile b/kernel/Makefile
index 90fad04b6..a821d3939 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -4,7 +4,7 @@ all.modules: ../mdk-stage1/mar/mar update_kernel list_modules.pm
`../tools/specific_arch ./update_kernel`
../mdk-stage1/mar/mar:
- make -C `dirname $@`
+ make -C `dirname $@` mar
clean:
rm -rf *~ modules.description all.modules all.modules64
diff --git a/kernel/check_mar.pl b/kernel/check_mar.pl
index d29e65088..19225410a 100755
--- a/kernel/check_mar.pl
+++ b/kernel/check_mar.pl
@@ -7,14 +7,14 @@ my $mar = '../mdk-stage1/mar/mar';
my %sanity_check = (
hd => [
- if_(arch() !~ /x86_64/, 'aic7xxx'),
- qw(sym53c8xx initio),
- if_(arch() !~ /ppc/, 'advansys'),
+ qw(aic7xxx sym53c8xx),
+ if_(arch() !~ /x86_64/, 'initio'),
+ if_(arch() !~ /ppc|x86_64/, 'advansys'),
],
network => [
- qw(3c59x eepro100 tulip via-rhine ne2k-pci 8139too),
- if_(arch() !~ /ppc|x86_64/, 'e100'),
- if_(arch() !~ /ppc|ia64/, 'tlan'),
+ qw(3c59x eepro100 tulip via-rhine ne2k-pci 8139too),
+ if_(arch() !~ /ppc/, 'e100'),
+ if_(arch() !~ /ppc|x86_64|ia64/, 'tlan'),
],
);
diff --git a/kernel/list_modules.pm b/kernel/list_modules.pm
index b1ce99e3f..034f7436b 100644
--- a/kernel/list_modules.pm
+++ b/kernel/list_modules.pm
@@ -16,7 +16,7 @@ our %l = (
main => [
if_(arch() =~ /ppc/, qw(mace bmac gmac)),
if_(arch() =~ /^sparc/, qw(myri_sbus sunbmac sunhme sunqe)),
- if_(arch() !~ /alpha/ && arch() !~ /sparc/,
+ if_(arch() !~ /alpha|sparc/,
qw(3c501 3c503 3c505 3c507 3c509 3c515), # 3c90x
qw(82596 abyss ac3200 acenic aironet4500_card at1700 atp com20020-pci),
qw(cs89x0 de600 de620 r8169),
@@ -24,7 +24,8 @@ our %l = (
qw(depca dgrs dmfe e100 e1000 e2100 eepro eepro100 eexpress epic100 eth16i),
qw(ewrk3 hamachi hp hp-plus hp100 ibmtr),
qw(lance natsemi ne ne2k-pci ni5010 ni52 ni65 nvnet olympic pcnet32 plip rcpci), #old_tulip
- qw(sb1000 sis900 sk98lin smc-ultra smc9194 starfire tg3 tlan tmspci tulip via-rhine), #sktr
+ qw(sb1000 sis900 sk98lin smc-ultra smc9194 starfire tlan tmspci tulip via-rhine), #sktr
+ qw(tg3 bcm5700),
qw(wd winbond-840 yellowfin ns83820),
qw(iph5526), #- fibre channel
@@ -62,7 +63,7 @@ our %l = (
qw(eata eata_pio eata_dma),
),
'53c7,8xx',
- qw(aic7xxx pci2000 qlogicisp sym53c8xx), # ncr53c8xx
+ qw(aic7xxx pci2000 qlogicisp sym53c8xx mptscsih mptbase), # ncr53c8xx
],
hardware_raid => [
if_(arch() =~ /^sparc/, qw(pluto)),
@@ -99,7 +100,7 @@ our %l = (
cdrom => [ qw(isofs) ],
loopback => [ qw(isofs loop) ],
local => [
- if_(arch() =~ /^i.86/, qw(vfat fat)),
+ if_(arch() =~ /^i.86|x86_64/, qw(vfat fat)),
if_(arch() =~ /^ppc/, qw(hfs)),
qw(reiserfs),
],
@@ -143,6 +144,7 @@ our %l = (
qw(busmouse msbusmouse logibusmouse serial qpmouse atixlmouse),
],
char => [
+ if_(arch() =~ /ia64/, qw(efivars)),
qw(amd768_rng applicom n_r3964 nvram pc110pad ppdev),
qw(mxser moxa isicom wdt_pci epca synclink istallion sonypi i810-tco sx), #- what are these???
],
diff --git a/kernel/modules.pl b/kernel/modules.pl
index 6e8f04307..45d05ec6c 100644
--- a/kernel/modules.pl
+++ b/kernel/modules.pl
@@ -28,8 +28,9 @@ my @skip_modules_on_stage1 = (
qw(sktr tmspci ibmtr abyss), # alt token ring
qw(old_tulip rtl8139),
if_(arch() =~ /alpha|ppc/, qw(sb1000)),
+ if_(arch() !~ /x86_64|ia64/, qw(tg3 bcm5700)), #- important gigabit cards
qw(
- tg3 r8169
+ r8169
apa1480_cb
imm ppa plip
3w-xxxx pci2220i qla2x00 i2o_block
@@ -37,6 +38,7 @@ my @skip_modules_on_stage1 = (
qla2200 qla2300
iph5526
),
+ if_(arch() =~ /x86_64/, qw(53c7,8xx initio ataraid advansys atp870u)), #- old
'AM53C974', # deprecated by tmscsim
qw(ac3200 at1700 atp ni5010 ni52 ni65), #- unused from Jeff
"u14-34f", #- duplicate from ultrastor.o
diff --git a/kernel/update_kernel b/kernel/update_kernel
index 9cea09e7d..6e43ceeb3 100755
--- a/kernel/update_kernel
+++ b/kernel/update_kernel
@@ -1,11 +1,17 @@
#!/bin/bash
ALL_KERNELS="all.kernels"
+RPMS=/RPMS
# move stuff to this new "kernel" directory
if [ ! -d all.kernels ]; then
- mv ../all.kernels .
- rm -rf ../all.modules
+ if [ -d ../all.kernels ]; then
+ mv ../all.kernels .
+ rm -rf ../all.modules
+ else
+ # make sure "all.kernels" directory exists
+ mkdir all.kernels
+ fi
fi
function create_marfile() {
@@ -38,13 +44,23 @@ function create_modules() {
[ -e $ALL_KERNELS/.main ] && main=$(cat $ALL_KERNELS/.main)
-rpm=$(rpm -qp --qf '%{name}' /RPMS/kernel-BOOT-*.rpm | perl -pe 's/kernel-BOOT-(.*)\.(.*)/$1-${2}BOOT/')
+ARCH=`uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/'`
+
+if [ "$ARCH" == "ia64" ] || [ "$ARCH" == "ppc" ]; then
+ rpm=$(rpm -qp --qf '%{name}' $RPMS/kernel-[0-9]*.rpm | perl -pe 's/kernel-((\.?[0-9]+){3})\.(.*)/$1-${3}/')
+else
+ rpm=$(rpm -qp --qf '%{name}' $RPMS/kernel-BOOT-*.rpm | perl -pe 's/kernel-BOOT-((\.?[0-9]+){3})\.(.*)/$1-${3}BOOT/')
+fi
if [ -n "$rpm" -a ! -e $ALL_KERNELS/$rpm ]; then
[ -n "$main" ] && rm -rf $ALL_KERNELS/$main
cd $ALL_KERNELS
rm -rf $rpm ; mkdir $rpm
cd $rpm
- rpm2cpio /RPMS/kernel-BOOT-*.rpm | cpio -id
+ if [ "$ARCH" == "ia64" ] || [ "$ARCH" == "ppc" ]; then
+ rpm2cpio $RPMS/kernel-[0-9]*.rpm | cpio -id
+ else
+ rpm2cpio $RPMS/kernel-BOOT-*.rpm | cpio -id
+ fi
find -type f -name "*.o.gz" | xargs gunzip
cd ../..
@@ -61,7 +77,6 @@ fi
cd ..
}
-ARCH=`uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/'`
eval `perl modules.pl images`
@@ -70,12 +85,12 @@ if [ "$ARCH" == "i386" ]; then
#disable any existing resolution!!!
/usr/sbin/rdev -v $i 65535 #788 #785
done
-else
- if [ "$ARCH" == "ppc" ]; then
- cp -f "$KERNEL_BOOT_PATH"/boot/vmlinux .
- else
- cp -f "$KERNEL_BOOT_PATH"/boot/vmlinux.gz .
- fi
+elif [ "$ARCH" == "ppc" ]; then
+ cp -f "$KERNEL_BOOT_PATH"/boot/vmlinux .
+elif [ "$ARCH" == "ia64" ]; then
+ cp -f "$KERNEL_BOOT_PATH"/boot/efi/vmlinuz* .
+else
+ cp -f "$KERNEL_BOOT_PATH"/boot/vmlinuz* .
fi
@@ -91,6 +106,7 @@ for i in $ALL_KERNELS/*; do
create_modules ../../$i $kern
else
echo "$kern ($main)"
+ find ../../$i -type f -name "*.o.gz" | xargs gunzip
create_modules ../../$i $kern 2>/dev/null
fi
) || exit 1
diff --git a/make_boot_img b/make_boot_img
index 269be0e5a..6978b6382 100755
--- a/make_boot_img
+++ b/make_boot_img
@@ -14,7 +14,11 @@ my ($arch) = $Config{archname} =~ /(.*?)-/;
rename 'all.kernels', 'kernel/all.kernels';
rename 'all.modules', 'kernel/all.modules';
-$default_append = "ramdisk_size=32000 root=/dev/ram3";
+# default ramdisk size
+$ramdisk_size = ($arch =~ /ia64/ ? 120000 :
+ ($arch =~ /x86_64/ ? 48000 : 32000));
+
+$default_append = "ramdisk_size=$ramdisk_size root=/dev/ram3";
$default_vga = "vga=788";
$instdir = "mdk-stage1";
@@ -72,13 +76,17 @@ foreach (@kernels) {
rename("$img-$main", "$img");
}
}
+if ($arch =~ /x86_64/ && $img =~ /all/) {
+ # isolinux is supposed to work on all those new hardware
+ isolinux($main, @kernels);
+}
if ($arch =~ /i.86/ && $img =~ /all/) {
isolinux($main, @kernels);
my ($img, $img_sav) = ("images/cdrom.img-$main", 'images/cdrom.img-sav');
rename($img, $img_sav);
$type = 'cdrom';
- boot_img_i386($mnt, $img, "kernel/all.kernels/$main/boot/vmlinu*", sub { $_[0] =~ s/\bautomatic=\S+\b//; "$_[0] changedisk" });
+ $::{"boot_img_$arch"}->($mnt, $img, "kernel/all.kernels/$main/boot/vmlinu*", sub { $_[0] =~ s/\bautomatic=\S+\b//; "$_[0] changedisk" });
rename($img, 'images/cdrom-changedisk.img');
rename($img_sav, $img);
}
@@ -102,10 +110,11 @@ sub initrd {
_ "$sudo mount -t ext2 $tmp $mnt -o loop";
_ "$sudo tar xjC $mnt -f $tar";
+ symlinkf "/tmp/stage2/lib64", "$mnt/lib64" if ($arch =~ /x86_64/);
install_stripped("$instdir/init", "$mnt/sbin");
- install_stripped("$instdir/$install", "$mnt/sbin/stage1");
+ install_stripped("$instdir/$install", "$mnt/sbin/stage1");
- if ($type eq "network" || $type eq "usb" || $type eq "all" || $type eq "other" || $type eq "blank") {
+ if (member($type, qw(network usb all other blank)) && $arch !~ /x86_64/) {
install_stripped("$instdir/ppp/pppd-bin", "$mnt/sbin/pppd");
install_stripped("$instdir/rp-pppoe/pppoe-bin", "$mnt/sbin/pppoe");
_ "$sudo mknod $mnt/dev/ppp c 108 0";
@@ -113,7 +122,7 @@ sub initrd {
_ "$sudo mknod $mnt/dev/ttyp0 c 3 0";
}
- if (member($type, qw(pcmcia all network)) && $arch !~ /ppc/ && $arch !~ /ia64/) {
+ if (member($type, qw(pcmcia all network)) && $arch !~ /ppc|ia64|x86_64/) {
_ "$sudo cp -a /etc/pcmcia $mnt/etc";
_ "cp $mnt/etc/pcmcia/config /tmp/pcmcia_config_tmp";
_ "tools/patch_pcmcia_config.pl /tmp/pcmcia_config_tmp kernel/all.modules/$main/modules.dep";
@@ -210,6 +219,43 @@ F3 boot.msg
_ "df $mnt";
}
+sub boot_img_x86_64 {
+ my ($mnt, $img, $kernel) = @_;
+
+ __ "$sudo umount $mnt 2>/dev/null";
+
+ _ "dd if=/dev/zero of=$img bs=1k count=1440";
+ _ "/sbin/mkfs.vfat $img";
+ _ "$sudo syslinux -s $img";
+ _ "$sudo mount -t vfat -o umask=0 $img $mnt -o loop";
+
+ _ "cat $kernel > $mnt/vmlinuz";
+ my $rdz = $img; $rdz =~ s/\.img/.rdz/;
+ initrd "${mnt}2", $rdz if ! -e $rdz;
+ eval { _ "cp -f $rdz $mnt/$type.rdz" };
+ if ($@) {
+ unlink "$mnt/$type.rdz";
+ my $avail = (split ' ', `df $mnt`)[-3];
+ my $s = int((-s $rdz) / 1024);
+ die sprintf("not enough room for $rdz: need %d KB (available %d KB < needed %d KB)\n", $s - $avail, $avail, $s);
+ }
+
+ my $timeout = 72;
+ output "$mnt/syslinux.cfg",
+"default linux
+prompt 1
+timeout $timeout
+" . join('', map {
+"label $_->[0]
+ kernel vmlinuz
+ append initrd=$type.rdz $_->[1]
+"
+} entries_append($type));
+
+ _ "sync";
+ _ "df $mnt";
+}
+
sub boot_img_alpha {
my ($mnt, $img) = @_;
@@ -249,14 +295,14 @@ image=vmlinux
label=linux
root=/dev/ram3
initrd=$type.rdz
- append=\" ramdisk_size=120000\"
+ append=\" ramdisk_size=$ramdisk_size\"
read-only
image=vmlinux
label=rescue
root=/dev/ram3
initrd=$type.rdz
- append=\" rescue ramdisk_size=120000\"
+ append=\" rescue ramdisk_size=$ramdisk_size\"
");
_ "sync";
_ "df $mnt";
@@ -303,44 +349,44 @@ image[sun4c,sun4d,sun4m]=/$boot/vmlinux
label=linux
alias=install
initrd=/$boot/live.rdz
- append=\"ramdisk_size=32000 root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size root=/dev/ram3\"
image[sun4c,sun4d,sun4m]=/$boot/vmlinux
label=text
initrd=/$boot/live.rdz
- append=\"ramdisk_size=32000 text root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size text root=/dev/ram3\"
image[sun4c,sun4d,sun4m]=/$boot/vmlinux
label=expert
initrd=/$boot/live.rdz
- append=\"ramdisk_size=32000 expert root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size expert root=/dev/ram3\"
image[sun4c,sun4d,sun4m]=/$boot/vmlinux
label=ks
initrd=/$boot/live.rdz
- append=\"ramdisk_size=32000 ks root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size ks root=/dev/ram3\"
image[sun4c,sun4d,sun4m]=/$boot/vmlinux
label=rescue
initrd=/$boot/live.rdz
- append=\"ramdisk_size=32000 rescue rw root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size rescue rw root=/dev/ram3\"
image[sun4u]=/$boot/vmlinux64
label=linux
alias=install
initrd=/$boot/live64.rdz
- append=\"ramdisk_size=32000 root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size root=/dev/ram3\"
image[sun4u]=/$boot/vmlinux64
label=text
initrd=/$boot/live64.rdz
- append=\"ramdisk_size=32000 text root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size text root=/dev/ram3\"
image[sun4u]=/$boot/vmlinux64
label=expert
initrd=/$boot/live64.rdz
- append=\"ramdisk_size=32000 expert root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size expert root=/dev/ram3\"
image[sun4u]=/$boot/vmlinux64
label=ks
initrd=/$boot/live64.rdz
- append=\"ramdisk_size=32000 ks root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size ks root=/dev/ram3\"
image[sun4u]=/$boot/vmlinux64
label=rescue
initrd=/$boot/live64.rdz
- append=\"ramdisk_size=32000 rescue rw root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size rescue rw root=/dev/ram3\"
");
output("$dir/$boot/README", "
@@ -388,7 +434,7 @@ message=/boot.msg
image=/vmlinux$I.gz
label=linux
initrd=/$type.rdz
- append=\"ramdisk_size=32000 $ltype root=/dev/ram3\"
+ append=\"ramdisk_size=$ramdisk_size $ltype root=/dev/ram3\"
");
_ "genromfs -d $dir -f /dev/ram -A 2048,/.. -a 512 -V \'DrakX boot disk\'";
_ "$sudo mount -t romfs /dev/ram $mnt";
@@ -420,56 +466,56 @@ image = cd:,\\\\\\\\vmlinux
label = install-novideo
root = /dev/ram3
initrd = cd:,\\\\\\\\all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" video=ofonly\"
image = cd:,\\\\\\\\vmlinux
label = install-atyfb
root = /dev/ram3
initrd = cd:,\\\\\\\\all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" video=atyfb:vmode:17\"
image = cd:,\\\\\\\\vmlinux
label = install-aty128fb
root = /dev/ram3
initrd = cd:,\\\\\\\\all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" video=aty128fb:vmode:17\"
image = cd:,\\\\\\\\vmlinux
label = install-text
root = /dev/ram3
initrd = cd:,\\\\\\\\all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" text video=ofonly\"
image = enet:0,vmlinux
label = install-net
root = /dev/ram3
initrd = enet:0,all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" video=ofonly\"
image = enet:0,vmlinux
label = install-net-text
root = /dev/ram3
initrd = enet:0,all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" text video=ofonly\"
image = cd:,\\\\\\\\vmlinux
label = rescue
root = /dev/ram3
initrd = cd:,\\\\\\\\all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" rescue video=ofonly\"
image = enet:0,vmlinux
label = rescue-net
root = /dev/ram3
initrd = enet:0,all.gz
- initrd-size = 32000
+ initrd-size = $ramdisk_size
append = \" rescue video=ofonly\"
");
#- seem to need 2 yaboot.conf, one in the root, and one in boot
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
index 81378031d..36cc85702 100644
--- a/mdk-stage1/Makefile
+++ b/mdk-stage1/Makefile
@@ -1,4 +1,4 @@
- #******************************************************************************
+ #*****************************************************************************
#
# mdk-stage1 - the program that will load second-stage install
#
@@ -33,6 +33,10 @@
# init with glibc
# stage1 with glibc
#
+ # x86-64
+ # init with minilibc
+ # stage1 with dietlibc
+ #
#*****************************************************************************
@@ -53,6 +57,10 @@ ifeq (i386, $(ARCH))
INITSRC = minilibc.c init.c
INIT_DEFS = -DINIT_HEADERS=\"minilibc.h\" -fno-builtin
else
+ifeq (x86_64, $(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)
@@ -60,33 +68,33 @@ else
INIT_DEFS = -DINIT_HEADERS=\"init-libc-headers.h\" $(DIETLIBC_INCLUDES)
endif
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))
+NEWT_FRONTEND_LIBS = newt/libnewt.a slang/libslang.a
STDIO_FRONTEND_SRC = stdio-frontend.c
-GLIBC_STDIO_FRONTEND_LIBS =
-DIETLIBC_STDIO_FRONTEND_LIBS =
+STDIO_FRONTEND_LIBS =
+STDIO_FRONTEND_LIBS =
FRONTEND_OBJS = $(subst .c,.o,$($(F)_FRONTEND_SRC))
-FRONTEND_LINK = $(FRONTEND_OBJS) $($(L)_$(F)_FRONTEND_LIBS)
+FRONTEND_LINK = $(FRONTEND_OBJS) $($(F)_FRONTEND_LIBS)
+INSMOD = insmod-modutils
ifeq (i386, $(ARCH))
INSMOD = insmod-busybox
-else
-INSMOD = insmod-modutils
+endif
+ifeq (x86_64, $(ARCH))
+INSMOD = insmod-busybox
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)
+STAGE1_OWN_LIBS = $(INSMOD)/libinsmod.a mar/libmar.a bzlib/libbzlib.a
ifeq (DIETLIBC, $(L))
@@ -94,8 +102,12 @@ STAGE1_NETWORK_LIBS = $(top_dir)/dietlibc/bin-$(ARCH)/librpc.a
endif
ifeq (GLIBC, $(L))
+ifeq (x86_64, $(ARCH))
+STAGE1_NETWORK_LIBS = /usr/lib64/libresolv.a
+else
STAGE1_NETWORK_LIBS = /usr/lib/libresolv.a
endif
+endif
#- stage1 itself
STAGE1SRC = stage1.c log.c tools.c modules.c probing.c mount.c automatic.c frontend-common.c
@@ -130,6 +142,10 @@ STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWO
ifeq (i386, $(ARCH))
LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o
else
+ifeq (x86_64, $(ARCH))
+LDFLAGS_INIT = -static -nostdlib /usr/lib64/crt1.o
+INIT_LIBC = $(GLIBC_LIBC)
+else
ifeq (ia64, $(ARCH))
LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1)
INIT_LIBC = $(GLIBC_LIBC)
@@ -138,6 +154,7 @@ LDFLAGS_INIT = $(DIETLIBC_LDFLAGS_STAGE1)
INIT_LIBC = $(DIETLIBC_LIBC)
endif
endif
+endif
BINS = init stage1-full
@@ -145,24 +162,33 @@ BINS = init stage1-full
ifeq (i386, $(ARCH))
BINS += stage1-cdrom stage1-disk stage1-network stage1-usb
endif
+ifeq (x86_64, $(ARCH))
+BINS += stage1-cdrom stage1-disk stage1-network stage1-usb
+endif
-ifneq (ia64, $(ARCH))
+ifeq (i386, $(ARCH))
DIRS = dietlibc
endif
-DIRS += mar pci-resource usb-resource bzlib $(INSMOD) slang newt ppp/pppd rp-pppoe/src
-ifeq (i386,$(ARCH))
+ifeq (ppc, $(ARCH))
+DIRS = dietlibc
+endif
+ifeq (x86_64, $(ARCH))
+DIRS = dietlibc
+endif
+DIRS += mar pci-resource usb-resource bzlib $(INSMOD) slang newt
+ifneq (x86_64, $(ARCH))
+DIRS += ppp/pppd rp-pppoe/src
+endif
+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_LIB = pcmcia_/libpcmcia.a
PCMCIA_DEFS = -DENABLE_PCMCIA
endif
-
USB_DEFS_GEN = -DENABLE_USB
USB_DEFS = -DENABLE_USB -DDISABLE_PCIADAPTERS
@@ -178,23 +204,23 @@ init: $(INITOBJS) $(INIT_LIBC)
$(STRIPCMD) $@
stage1-cdrom: $(STAGE1OBJS-CDROM) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
+ $(DIET) $(CC) $(LDFLAGS_STAGE1) -o $@ $^
$(STRIPCMD) $@
stage1-disk: $(STAGE1OBJS-DISK) $(STAGE1_OWN_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
+ $(DIET) $(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 $@ $^
+ $(DIET) $(CC) $(LDFLAGS_STAGE1) -o $@ $^
$(STRIPCMD) $@
stage1-usb: $(STAGE1OBJS-USB) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
+ $(DIET) $(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 $@ $^
+ $(DIET) $(CC) $(LDFLAGS_STAGE1) -o $@ $^
$(STRIPCMD) $@
@@ -202,22 +228,22 @@ $(INITOBJS): %.o: %.c
$(COMPILE) $(INIT_DEFS) -c $<
$(STAGE1OBJS-CDROM): %-CDROM.o: %.c
- $(COMPILE) $(INCLUDES) $(CDROM_DEFS) -c $< -o $@
+ $(DIET) $(COMPILE) $(INCLUDES) $(CDROM_DEFS) -c $< -o $@
$(STAGE1OBJS-DISK): %-DISK.o: %.c
- $(COMPILE) $(INCLUDES) $(DISK_DEFS) -c $< -o $@
+ $(DIET) $(COMPILE) $(INCLUDES) $(DISK_DEFS) -c $< -o $@
$(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c
- $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(PCMCIA_DEFS) -c $< -o $@
+ $(DIET) $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(PCMCIA_DEFS) -c $< -o $@
$(STAGE1OBJS-USB): %-USB.o: %.c
- $(COMPILE) $(INCLUDES) $(USB_DEFS) -c $< -o $@
+ $(DIET) $(COMPILE) $(INCLUDES) $(USB_DEFS) -c $< -o $@
$(STAGE1OBJS-FULL): %-FULL.o: %.c
- $(COMPILE) $(INCLUDES) $(USB_DEFS_GEN) $(PCMCIA_DEFS) -c $< -o $@
+ $(DIET) $(COMPILE) $(INCLUDES) $(USB_DEFS_GEN) $(PCMCIA_DEFS) -c $< -o $@
.c.o:
- $(COMPILE) $(INCLUDES) -c $<
+ $(DIET) $(COMPILE) $(INCLUDES) -c $<
clean:
@@ -236,7 +262,7 @@ tar-mkinitrd_helper: clean
rm -rf mkinitrd_helper-subdir
rescue-gui: rescue-gui.o frontend-common.o $(FRONTEND_LINK) $(STAGE1_LIBC)
- $(CC) $(LDFLAGS_STAGE1) -o $@ $^
+ $(DIET) $(CC) $(LDFLAGS_STAGE1) -o $@ $^
$(STRIPCMD) $@
diff --git a/mdk-stage1/Makefile.common b/mdk-stage1/Makefile.common
index 7506c1381..cc9e602da 100644
--- a/mdk-stage1/Makefile.common
+++ b/mdk-stage1/Makefile.common
@@ -32,6 +32,13 @@ endif
ifeq (ppc, $(ARCH))
L = GLIBC
endif
+ifeq (x86_64, $(ARCH))
+#L = GLIBC
+endif
+
+ifeq (DIETLIBC, $(L))
+DIET = $(top_dir)/dietlibc/bin-$(ARCH)/diet
+endif
#- flags used by all stuff
@@ -46,11 +53,11 @@ 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
+DIETLIBC_LDFLAGS_STAGE1 = -nostdlib
LDFLAGS_STAGE1 = $($(L)_LDFLAGS_STAGE1)
GLIBC_LIBC =
-DIETLIBC_LIBC = $(top_dir)/dietlibc/bin-$(ARCH)/dietlibc.a
+DIETLIBC_LIBC =
STAGE1_LIBC = $($(L)_LIBC)
STRIPCMD = strip -R .note -R .comment
diff --git a/mdk-stage1/bzlib/Makefile b/mdk-stage1/bzlib/Makefile
index 03a2c254b..8e4bba791 100644
--- a/mdk-stage1/bzlib/Makefile
+++ b/mdk-stage1/bzlib/Makefile
@@ -29,27 +29,14 @@ 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 $@
+ $(DIET) $(CC) $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/dhcp.c b/mdk-stage1/dhcp.c
index 32c7a932b..a23dafda1 100644
--- a/mdk-stage1/dhcp.c
+++ b/mdk-stage1/dhcp.c
@@ -211,7 +211,7 @@ static void parse_reply(struct bootp_request * breq, struct interface_info * int
unsigned char * chptr;
unsigned char option, length;
- if (breq->bootfile && strlen(breq->bootfile) > 0)
+ if (breq->bootfile && strlen(breq->bootfile) > 0 && IS_NETAUTO)
stage2_kickstart = strdup(breq->bootfile);
memcpy(&intf->ip, &breq->yiaddr, 4);
diff --git a/mdk-stage1/dietlibc/.cvsignore b/mdk-stage1/dietlibc/.cvsignore
index 7c88cb004..f0be42e21 100644
--- a/mdk-stage1/dietlibc/.cvsignore
+++ b/mdk-stage1/dietlibc/.cvsignore
@@ -10,3 +10,19 @@ bin-i386
bin-mips
bin-ppc
bin-sparc
+bin-mipsel
+bin-parisc
+bin-s390
+bin-sparc64
+pic-alpha
+pic-arm
+pic-i386
+pic-mips
+pic-ppc
+pic-sparc
+pic-mipsel
+pic-parisc
+pic-s390
+pic-sparc64
+bin-ia64
+bin-x86_64
diff --git a/mdk-stage1/dietlibc/AUTHOR b/mdk-stage1/dietlibc/AUTHOR
index 6d8ab1a05..3f6a44e6d 100644
--- a/mdk-stage1/dietlibc/AUTHOR
+++ b/mdk-stage1/dietlibc/AUTHOR
@@ -1 +1,3 @@
Felix von Leitner <felix-dietlibc@fefe.de>
+
+Please see the file THANKS for additional authors and contributors.
diff --git a/mdk-stage1/dietlibc/BUGS b/mdk-stage1/dietlibc/BUGS
new file mode 100644
index 000000000..d030db5e6
--- /dev/null
+++ b/mdk-stage1/dietlibc/BUGS
@@ -0,0 +1,8 @@
+Please report bugs to
+
+ felix-dietlibc@fefe.de
+
+or to the mailing list at
+
+ dietlibc@fefe.de
+
diff --git a/mdk-stage1/dietlibc/CAVEAT b/mdk-stage1/dietlibc/CAVEAT
new file mode 100644
index 000000000..efd20d6f5
--- /dev/null
+++ b/mdk-stage1/dietlibc/CAVEAT
@@ -0,0 +1,5 @@
+
+Beware! Much of this code is untested!
+
+Someday, we will have a test suite and everything will be just fine.
+
diff --git a/mdk-stage1/dietlibc/CHANGES b/mdk-stage1/dietlibc/CHANGES
new file mode 100644
index 000000000..de4f88c3e
--- /dev/null
+++ b/mdk-stage1/dietlibc/CHANGES
@@ -0,0 +1,911 @@
+0.22:
+ fix i386 libm
+ fix netinet/ip_icmp.h (Rui Prior)
+ make strings.h susv3 compliant (Gunnar Ritter)
+ remove stdio dependence in abort
+ fix truncate64, ftruncate64 (Luc Van Oostenryck and Yuri Kozlov)
+ fix and improve erand48() (Luc Van Oostenryck)
+ fix realpath for non-existant directories (Gergely Nagy and Gerrit Pape)
+ fix DNS timeout and IPv6 socket reuse
+ strtoul now accepts "-1" as well (Thomas Ogrisegg)
+ add i386 strcasecmp and __ltostr (Thomas Ogrisegg)
+ add killpg prototype (Luc Van Oostenryck)
+ remove some compiler warnings (Luc Van Oostenryck)
+ better rand() from Knuth's TAOCP (Luc Van Oostenryck)
+ fix unified x86_64 unified syscall 64-bit return value issue (Gwenole)
+ the getdents64 emulation was broken and repairing it opened a can of
+ worms. So I ripped it out. I also changed the readdir64 emulation
+ to work if there is no getdents64.
+ fix ia64 start.S (Thanks to Volker Birk for an account on his ia64 box)
+ many ia64 fixes (waitpid, nice, fork, vfork, time, utime ...)
+ More fixes from Gwenole (printf %p only printed the last 32 bits, I
+ botched the getdents64 #ifdefs, we violated the x86_64 ABI)
+ change signal() to do as glibc does
+ remove a few more warnings
+ add new 2.5 syscall #defines
+ add epoll_create, epoll_ctl and epoll_wait
+ the new x86 syscall numbers exceed 255, breaking our %al optimization
+ I worked around it with conditional assembly in cpp macros. Ugh.
+ more MIPS fixes (the stoned MIPS ABI for restartable syscalls expects
+ the instruction before the syscall to be a load immediate)
+ fix fread() from a pipe (oops, tried to lseek)
+ #define _POSIX_VDISABLE in termios.h (Laurent Bercot)
+ two *printf fixes (Gernot Tenchio)
+ add nan and +-inf handling in __dtostr
+ add _SC_NGROUPS_MAX support to sysconf (Felix J. Ogris)
+ make assert() use expect(), slight optimization
+ add i386 vfork (Thomas Ogrisegg)
+ fix SA_NODEFER on sparc (Gerrit Pape, Thomas Bader)
+ fix sin, cos and __dtostr (Gernot Tenchio)
+ add /dev/epoll ioctl constants to sys/ioctl.h
+ add linux/eventpoll.h for /dev/epoll
+ fix lseek64 on 64-bit architectures
+ Olaf: fix x86_64 start-code (we have reg-args)
+ fixing some broken macros in sparc32-code (.udiv,.urem)
+ adding strndup (GNU Extension)
+ fix glob strncpy (R.L. Horn)
+ fix regfree (Uwe Ohse)
+ fix puts in full stdio mode (would omit \n)
+ fix wrong types on powerpc, broke *stat (Gerrit Pape)
+ allow more than 64k in i386 memchr (Karsten Scheibler)
+ make strftime work it WANT_TZFILE_PARSER is not set (Gwenole Beauchesne)
+ build parisc on parisc64, change libgcc link order on sparc (Gerrit Pape)
+
+0.21:
+ use gcc's size_t, ptrdiff_t and wchar_t types (Olaf)
+ use -G 8 on MIPS to reduce code size (Johannes Stezenbach)
+ add munlock (Jens Låås)
+ argh, atexit fell victim to bit rot (or maybe Olaf)
+ add WANT_INET_ADDR_DNS to make gethostbyname not look up IP numbers
+ but use them to fill in the struct hostent directly.
+ signal is now a correct signal (Olaf)
+ read optimizer cflags for diet -Os gcc from ~/.diet/gcc, overriding
+ the built-in defaults.
+ add file "SECURITY". I will document design tradeoffs that have
+ security implications there.
+ fixed regex LINEEND condition
+ add .size directive to i386 syscalls
+ shove a few more bytes off the i386 socket calls
+ setjmp, longjmp and clone for x86_64 are now implemented but not tested (Olaf)
+ fix sparc signals
+
+0.20:
+ calloc was botched
+ umount and stime for x86_64 (Gwenole Beauchesne)
+ some malloc fixes for very big numbers (Enrico Scholz, me)
+ x86_64 unified syscall did not preserve rbx violating ABI (Gwenole)
+ realpath fix if path did not contain a slash (Gwenole)
+ add ucontext
+ add asm/statfs.h to work around people using <linux/fs.h>
+
+0.19:
+ current gcc cvs makes __thread a keyword (Eric Troan)
+ be more strict regarding hostile DNS packets (me)
+ fix ia64 compile problems (Gerrit Pape)
+ make killpg a function and not a macro (broke bash 2.05b)
+ fix ia64 start code and unified syscall (me)
+ add sparc/strlen.S from Thomas Ogrisegg
+ add more space to ARM __jmp_buf in setjmp.h (Andre)
+ fix libcompat/syscall.S (did't compile on arm)
+ add integer overflow fix in xdr_array after bugtraq advisory (me)
+ fix x86_64 socket calls and mmap (and some more) (Gwenole Beauchesne)
+ add calloc integer overflow fix after RUS-CERT advisory (me)
+ add fread and fwrite integer overflow fix (me)
+
+0.18:
+ add stpcpy (from Thomas Ogrisegg)
+ check in mktime fix (from Luc Van Oostenryck)
+ add libm2.s from contrib to i386 (oops, how long has it been sitting
+ there?)
+ add truncate64 and ftruncate64 and prototype for truncate (only had ftruncate)
+ Michal Ludvig ported the diet libc to the x86_64 architecture (the
+ upcoming AMD Hammer chips!). You can't even buy the chips yet and
+ the diet libc already supports it! Amazing ;-)
+ Michal's patch also fixed several of the outstanding warnings. Thanks!
+ Andre sent a patch to add ARM profiling. He says it does not work
+ yet, but it's a start.
+ added getdents64 backwards compatibility and include it in large file
+ support #defines
+ perror now checks if the message is NULL like glibc (Thomas Ogrisegg)
+ ftell did not take ungetc into account (Kevin Ryde through Debian).
+ Thomas Ogrisegg sent a port to IA64!
+ sigaddset, sigdelset and setismember segfaulted for signal 0 (Gunnar Ritter)
+ Enrico Scholz reported several bugs in the header files.
+ change __malloc__ to __attribute_malloc__
+ add pa-risc socketcall (but see TODO) (Felix J. Ogris)
+ fix *rand48 initialization (Kevin Ryde)
+ fnmatch infinite loop fix (Piotr Esden-Tempski)
+ make signal() into a sigaction wrapper function
+ add memrchr (Emil)
+ remove __attribute__((const)) from getpid() (Yuri Kozlov)
+ make getserv* also work if proto is NULL (Jens Låås)
+ now clone on parisc works (Thomas Ogrisegg)
+ getopt* fix from Thomas Walpuski
+ add syscall() to libcompat (Thomas Ogrisegg)
+ fix strncpy and strrchr i386 assembly versions for dynamic linking
+ (John K. Hohm)
+ allow short option grouping in getopt* (Ralf Wildenhues)
+ make the DNS resolver IPv6 transport capable (WANT_IPV6_DNS)
+ mention -v in diet.1 (Bryan Henderson)
+ auto-detect gcc 3 on i386 and remove compiler option warnings
+ putenv tweak (Thomas Ogrisegg)
+ add missing socket syscalls for PA-RISC and IA64 (Thomas Ogrisegg)
+ add cpio.h and tar.h (Thomas Ogrisegg)
+ change opendir/readdir/closedir from malloc to mmap (Thomas Ogrisegg)
+ cleanups from Florian LaRoche
+
+0.17:
+ fix several bugs in getservent_r
+ Gunnar Ritter reported the following:
+ moved tcgetpgrp and tcsetpgrp to unistd.h
+ adjusted lstat->lstat64 #define to make it work with function pointers
+ move __dietlibc__ #define from features.h to diet
+ Thomas Ogrisegg sent x86 memccpy and strncpy routines and introduced
+ an dietfeatures.h #define WANT_FULL_POSIX_COMPAT
+ Thomas also sent me profiling support (so far only on x86, but
+ profiling/PORTING describes what needs to be done for other
+ architectures)!
+ add contrib/dprof.c, also from Thomas.
+ Andreas Krennmair sent a patch to add the BSD regex interface to
+ libcompat
+ Andre noticed that __dtostr never sets first to false. Oops!
+ Andre has provided a largely untested patch that seems to fix the problem.
+ Igor Gilitschenski sent a patch for the "%8.7lx" issue.
+ abort did not flush all stdio streams
+ fix some nasty regular expression bugs
+ write a stupid malloc checker (contrib/debug-realloc.c) to help me
+ debug my regular expressions. Please read contrib/debug-realloc.txt
+ our i386 memchr,memcmp were broken for the count=0 case
+ fix DNS domain search
+ i386 memccpy exchanged esi and edi :-( I should do more checks before
+ accepting external code...
+
+0.16:
+ "diet -v" or "diet -Os" segfaulted without further arguments.
+ Andre found two very embarassing bugs in my four lines of md5 glue.
+ I need to get more sleep.
+ Thanks Ogrisegg found that ptrace does not work as documented and
+ provided a wrapper that emulates the glibc behaviour.
+ Dirk Engling saved 8 bytes and 4 cycles in the ARM clone()
+ fix ptrace.h for S/390 and ARM
+ provide a PORTING document so we don't lose track of which file need
+ to be touched to port the diet libc to a new platform.
+ remove a few warnings
+ provide a prototype for usleep.
+ make __dtostr work on ARM by using long instead of long long.
+ Idea by Dirk Engling.
+ fix an argument counting bug in *scanf (Thomas Ogrisegg)
+ Forgot an #endif in asm/sigcontext.h (Mike Castle)
+ Kurt Garloff sent in patches to
+ fix struct termios on non-x86 architectures
+ printf("%+05d\n",500) was broken (Raimar Falke told me, Olaf fixed it)
+ create libcompat.a (and move daemon to it)
+ add getdelim and getline
+ *printf now recognize 'z' integer flag (and ignore it)
+ Dirk Engling provided a strcpy.S for ARM.
+ Olaf: fixed *scanf familie. It hadn't wored with "long long".
+ Hans Lermen fixed i386/getenv.S
+ diet -Os no longer discards -fpic and -fno-pic
+ fix i386 rand/random to use correct RAND_MAX (thanks, Jaroslav
+ Macodiseas)
+ sys/ipc.h now includes sys/types.h
+ Olaf: started to make the sparc64 port
+ scandir should not sort if compar() is NULL (reported by Andrea Marrosu)
+
+0.15:
+ vfork sucks. I reverted to the old behavior where vfork==fork.
+ fix bsearch (and remove i386 assembly bsearch, needs to be redone).
+ Thanks Ogrisegg sent a patch to make the PA-RISC unified syscall
+ thread-safe!
+ remove vfork and add alarm to dynamic syscalls.
+ fix diet-dyn to link in dyn_dstop.o and not dyn_stop.o.
+ The MD5 code generated unaligned accesses when passed an unaligned
+ pointer on little endian ARM and MIPS.
+ MIPS unified syscall didn't compile anymore.
+ Put up new mipsel target to cross compile for little endian mips.
+ The mips target will again explicitly set endianness to big endian.
+ Compiling natively on a MIPS box should not touch the endianness.
+ Duh, when we removed return0, we broke tzset when the time zone parser
+ was disabled. Uwe Ohse noticed this. Thanks!
+ Fix gethostbyname to match host names case insensitively in /etc/hosts.
+ Oops, this was reported 6 weeks ago but I overlooked the email.
+ Thanks, Denis Rachal!
+ vsnprintf's zero termination was broken.
+ Uwe Ohse found a few more bugs:
+ Remove WANT_BUGGY_GLIBC_STRSEP. The Linux man page is broken, glibc
+ does it correctly.
+ Make inet_aton use strtoul instead of strtol
+ fdopen would close the file descriptor if it could not malloc the
+ buffer.
+ strftime updates.
+ Make _FILE_OFFSET_BITS includes -Wundef clean
+ Andre found a typo in endian.h for big endian mips
+ Ryan told me that fmod was not included in libm. Oops.
+ strstr(whatever,"") returned NULL, not whatever. Found by a new test
+ suite entry for strstr that I wrote.
+ Thomas Ogrisegg suggested or sent patches for the following:
+ add <asm/sigcontext.h> for profiling support.
+ make strncpy a #define in string.h to save a few bytes.
+ an i386 assembler getenv implementation (roughly half the size)
+ add grantpt, ptsname, unlockpt
+ add a getenv test suite entry.
+ Andre contributed an ARM assembler md5 implementation and he fixed mmap
+ on ARM.
+ add glibc macro names in sys/reboot.h. Mentioned by Laurent G. Bercot
+ getservent_r did not parse lines without aliases. Thanks, Jaroslav
+ Macodiseas!
+ fix MIPS start code (argv[0] was always corrupt)
+ removed annoying -Wconversion gcc switch
+ add -v to diet.c and fix MIPS CFLAGS in diet. Thanks, Johannes Stezenbach
+ Kurt Garloff sent these diffs:
+ add fdatasync (and make it a pthread cancellation point)
+ numerous alpha issues, like using .quad instead of .long for
+ offsets, change strip to -strip in Makefile (so a failing strip does
+ not abort the make), try to be more friendly to the gcc 2.96 that
+ SuSE 7.1 AXP ships with.
+
+0.14:
+ fix brk again (missing __brk, trivial oversight)
+ a new i386/atol.S that is 4 bytes smaller (and faster, too!). Thanks,
+ Thomas Ogrisegg!
+ Thomas also contributed a PA-RISC port including testandset, so
+ libpthread will work once we implement clone! Great work, Thomas.
+ made the fake locale more believable.
+ If you need gettext, use http://www.ca.postgresql.org/~petere/gettext.html
+ moved _exit into the unified syscall on x86.
+ Uwe Ohse found many more bugs:
+ getpass EINTR handling, ttyname, sysconf_cpus with SLASH_PROC_OK,
+ liblatin1 was more or less completely broken if you gave it chars as
+ arguments, not ints (signedness). execvp had a buffer overflow in
+ case a PATH element exceeded PATH_MAX, but it's not a security
+ problem since setuid programs need to set their path to some known
+ value anyway.
+ hasmntopt did not work with foo=bar style options
+ Uwe also improved ftw's stack usage.
+ Put movl instead of popl rationale in comment in i386/unified.S since
+ three people have suggested saving a few bytes with popl now ;)
+ I discovered __attribute__((malloc)) and started using it. For gcc 3,
+ it improves the optimizer when functions return malloced pointers.
+ Steven Rostedt pointed out that my setvbuf was broken with regard to
+ size==0 and sent a patch to fix it.
+ Thomas Ogrisegg made setenv smaller.
+ Olaf: implemented the parisc clone and an atomic testandset, modified the
+ libpthread to respect the parisc UPgrowing stack. still non functional,
+ because the unified syscall uses errno :(
+ tcgetospeed read from the wrong termios field. Thanks, Gunnar Ritter!
+ Fixed asprintf (relied on vsnprintf(NULL,...) to return length but
+ don't write anything which was no longer the case. It also
+ allocated one byte unnecessarily, which Uwe Ohse found.
+ Fix ttyname (readlink does not \0-terminate, forgot to do that).
+
+0.13:
+ add readdir64 and automatic mapping if _FILE_OFFSET_BITS == 64
+ make diet not include the linker safeguard stuff when preprocessing
+ Olaf: port to S/390!
+ me: fix vfork (it was put into dietlibc.a twice)
+ res_query did not initialize last
+ diet (not diet-dyn, of course) now adds -static to the gcc command line
+ fixed fflush on input streams (tic from ncurses exposed this)
+ duh, there is an alarm system call, too, so we use it and not setitimer
+ fix comparison in gmtime_r that caused Jan 1 to be converted to Dec 32.
+ rewrote __dtostr (it also has one more argument now)
+ Thanks to Erik Troan for bringing these to my attention:
+ make putenv behave like glibc (putenv("HOME") == unsetenv("HOME"))
+ fix strncat for the case where n == 0 (security implications?)
+ fix bsearch (it didn't find the very last element in the array, same
+ bug in both the C and the i386 assembly version).
+ fixed FNM_PATHNAME in fnmatch
+ fix brk (the syscall was documented incorrectly in the Linux man page)
+ Thanks, Thomas Ogrisegg!
+ added negated character classes to fnmatch (not required by POSIX)
+ make the utmp routines open utmp read-only if read-write doesn't work.
+ remove syscalls.c directory, it is obsolete now with unified syscalls
+
+0.12:
+ more contributions from Frank Klemm.
+ iconv can now do UCS-2, too.
+ Imported several x86 assembly routines from Wouter van Kleunen.
+ Lots of bug fixes, and several more i386 specific versions of common
+ routines to make them smaller.
+ add memmem (a GNU extension that looks useful)
+ several changes from Michal Ludvig: inttypes.h gets C99 macros,
+ add pivot_root syscall, %n for *scanf.
+ add adjtimex (thanks, Laurent BERCOT)
+ add Frank Klemm's optimized md5
+ add -Os option to diet (see diet.1).
+ several IPv6 constants and HZ were missing, thanks Johannes Kloos.
+ add 32-bit uid/gid syscalls.
+ add rand48 (thanks, Johannes Kloos)
+ fixed a lot of bugs in getopt* (thanks, Johannes)
+ add strxfrm and tweak limits.h. glib-1.3.8 now compiles without changes.
+ add a few more module syscalls. modutils-2.4.9 now compiles without changes.
+ fix gethostent alias list termination. Major oops.
+ add execle and two DNS constants (from Johannes Kloos).
+ opendir did not close-on-exec (thanks, Laurent Bercot).
+ DNS will now properly signal errors and set h_errno.
+ A few more cleanups (thanks, Andreas Jabs and Matthias Andree).
+ Added an uber-cool linker safeguard feature! Idea by Matthias Andree.
+ If you enable WANT_SAFEGUARD in dietfeatures.h, diet will include an
+ external reference to a symbol that is only in the diet libc. So,
+ when you accidentally link a diet libc compiled object file against
+ glibc, the linker will barf. This will bloat your object files, but
+ you can remove all the references with "strip -R .note" from
+ the binaries in the end (which you should do anyway).
+ fix ARM unified syscall (select did not work).
+ add getpwent_r ala glibc and replace getpwent
+ do the same for getgrent and getspent
+ remove entlib (new code is smaller)
+ rewrite getserv* to use parselib (and provide ..._r, too)
+ add getpwnam_r and getpwuid_r
+ rewrite getproto* to use parselib (and protive ..._r, too)
+ Olaf muddled with the dynamic linker. It's a clean-room
+ implementation in the sense that it once worked for Olaf in a clean
+ room ;)
+ add if_nameindex and if_freenameindex.
+ fixed arm unified syscalls to work with current binutils (; is no
+ longer a line separator but starts a comment, switched to .macro)
+ changed all st_[cma]time types to signed long so comparisons against
+ LONG_MIN will work correctly. (GNU tar does this)
+ fixed two bugs regarding ungetc.
+ add getusershell, setusershell, endusershell (for vs_ftpd)
+ add prctl, dirfd (also for vs_ftpd)
+ fixed strftime (was completely hosed)
+ added real make install target
+
+0.11:
+ fix major oops in DNS routines (only with WANT_FULL_RESOLV_CONF enabled).
+ fix vsscanf bug (Thanks, David Chappell).
+ add floor, ceil and memchr prototypes.
+ add __builtin_expect and expect #defines for gcc versions below 3.0
+ cleaner errno vs __errno_location handling
+ add placeholder iconv (iconv_open will always return EINVAL)
+ try to remove kernel 2.4 header dependency in IPv6 sockaddr_in6
+ initialization of getaddrinfo.
+ fix vsnprintf %X (printed lower case)
+ I wrote a new getopt. It appears to actually work (it is POSIX
+ compliant, it does not sort argv like the GNU version) and is only
+ a little over 300 bytes on x86.
+ Guillaume Cottenceau just wrote me that strncat should be even more
+ broken than it already is: it should append n bytes AND THEN \0!
+ I wonder how many programmers have produces off-by-one errors here...
+ Fix regexec offset return. autoconf now believes that diet libc has
+ POSIX regular expressions.
+ Fix fnmatch (a/b/* matched a/b/c/d even if FNM_PATHNAME was set)
+ Fix regular expression match for x* when there is no x at all.
+ Fix memory leak in error case in gethostbyname(2|). Thanks, Dietz Pröpper.
+ Add %h to vsnprintf.
+ Add FAQ.
+ Make %h work for signed numbers and add %hh to vsnprintf.
+ initgroups ignored the group argument :-(
+ remove printf references and nested functions from glob.
+ added an errno in libpthread that will display a prominent linker
+ warning.
+ started getting rid of kernel headers. Big task! :-(
+ add res_mkquery. The diet libc can now compile and link mtr.
+ Olaf: added a lot of code in libdl (not yet complete), changed the
+ startup code to make it work with his libdl and ld.so (needs still work
+ too)
+ __dns_readstartfiles only took the first domain or search path.
+ Thanks, Anthony de Boer
+ Olaf: added clone and a new unified_syscall for PowerPC
+ also dynlinker is now available (i386 only at this time)
+ crufted together a stdarg.h implementation from the various gcc headers.
+ implement getopt_long (ugh, the GNU people need professional help)
+ fixed word delimiters in regex (they looked for space, i.e. "," did
+ not work as delimiter)
+ errno.h now declares sys_errlist and sys_nerr.
+ added mkdtemp.
+ Uwe Ohse reported all of the following bugs:
+ ttyname should return 0 if !isatty.
+ realpath returns NULL if "." cannot be opened
+ putenv erroneously accepted (and mishandled) entries without "=".
+ popen returned 255 instead of 127 if /bin/sh could not be run.
+ fgetc did not set the internal EOF indicator on EOF.
+ bsearch contained an assumption about integer arithmetic overflow
+ behavior.
+ system did not set SIGCHLD and thus contained a race.
+ popen did not set close-on-exec and could leak an fd on malloc error.
+ daemon did not check whether open returns an fd below 3
+ perror did not save errno.
+ Olaf: Peter Jones reported some problems with perror; strerror had the
+ same problem.
+ Peter also posted a patch to atexit/exit. With some modifications it is
+ now implemented.
+ Unbuffered stdio and ungetc can no longer be disabled. I will try to
+ implement part of it using ELF weak symbols.
+ Added minimal sysconf (tehe) from David Chappell.
+ Added overflow handling for strtoul and strtol.
+ Added WANT_ETC_HOSTS in dietfeatures.h and made gethostbyname/2 use
+ it before falling back to DNS if enabled.
+ Added a littie backwards compatibility cruft for gpm (man, do these
+ sources stink!)
+ Added openpty.
+ Squeeze a few bytes off the is* routines, courtesy of Peter Jones.
+ Fix fseek return value.
+ Add dirname and basename.
+ Add a few i386 math routines contributed by Frank Klemm.
+ Fixed getservent (did not allow _ and - in the aliases).
+ Thanks, Oden Eriksson
+ Added a float.h so configure believes we have ANSI header files.
+ Fix a lot more stdio bugs that Uwe Ohse pointed out.
+ Olaf: has added a new scanf and printf core that is suitable for all
+ scanf and printf function implementations
+ Imported a few more functions and optimizations from Frank Klemm (he
+ also rewrote dtostr to have more precision)
+ Olaf: checked in a new sig* function family (based on rt_sig*).
+ legacy <2.2 signal-handling doesn't work at the moment.
+ Made rudimentary iconv that can convert back and forth between
+ iso-8859-1, utf-8 and ucs-4 (for debugging).
+ Thanks to Markus Kuhn for the excellent utf-8(7)!
+
+0.10:
+ update getpagesize.
+ add personality.
+ add "%*s" and "%*.*s" support to vsnprintf.
+ add putchar (apparently arm-linux-gcc will substitute printf("\n")
+ with putchar('\n') behind your back...?!
+ import include/scsi/ from glibc.
+ add iopl.
+ add execl and sigdelset prototypes.
+ add getopt_long stuff to getopt.h (may compile but won't link).
+ add RPC headers (no code yet).
+ add mlockall, munlockall
+ make "diet gcc foo.c" work.
+ added Sun RPC code and removed as many warnings as possible in a
+ heroic act of self-mutilation.
+ added getproto* and getdtablesize for the RPC cruft :-(
+ added getpass. mount from util-linux actually compiles now!
+ fix the sig*set routines. mount actually works now *bg*
+ fix fwrite dividing by zero when trying to fwrite n records of size 0.
+ added an initial regex implementation (3500 bytes!!!).
+ add llseek and lseek64 with optional lseek fall-back.
+ add res_init.
+ add asprintf (ugh, what an ugly function).
+ expanded arpa/nameser.h to include backwards compatibility defines
+ add ut_name alias to ut_host in struct utmp.
+ add inet_ntop, inet_pton, gethostbyname2.
+ add sysinfo, recvmsg, sendmsg.
+ add endmntent, getmntent, setmntent.
+ fix fnmatch (thanks, Guillaume Cottenceau!)
+ add setenv.
+ remove __restrict from mntent.h, add __restrict__ removal alias for
+ older gcc versions in sys/cdefs.h.
+ add rlim_t, sig_atomic_t declarations.
+ add sigsetjmp #define for __sigsetjmp (oops).
+ (Thanks to Chris Siebenmann for these three bug reports)
+ add a gruesome hack to printf floating point to accept %f and kludge
+ together support for %.2f. Don't look at the code, please!
+ fixed tcsetpgrp (oops, this is embarassing! Thanks, Chris Siebenmann)
+ imported fix for entlib by Jeff Garzik.
+ add glob implementation from Guillaume Cottenceau (Thanks!!)
+ add libdl fragments from Olaf (Yeah! One step closer to dynamic linking!)
+ add REG_ICASE and word start/end handling to my regular expressions.
+ my regular expressions now actually match substrings (i.e. "foobar" to "bar").
+ wrap getcwd to comply to man page (the syscall returns the number of
+ bytes, not the buffer)
+ add realpath.
+ fix vfprintf.
+ fix *scanf %s zero termination.
+ add abs, labs, llabs.
+ add <sys/io.h>, ioperm syscall.
+ add flock to <sys/file.h>
+ fixes to bsearch and the regular expressions.
+ add fake herror.
+ add scandir and alphasort.
+ add killpg
+ implemented a gross hack to make libpthread compile when
+ dietfeatures.h does not define WANT_THREAD_SAFE (it's empty then).
+ add getaddrinfo and freeaddrinfo (man, what a fucked up interface!)
+ fix sigsuspend (syscall had completely fscked up arguments!)
+ RLIM_INFINITY from the kernel is broken. Thanks to Chris Siebenmann
+ for sending a patch.
+ add getserv*.
+ add WANT_FULL_RESOLV_CONF so that the DNS routines use "domain" and
+ "search" from resolv.conf.
+
+0.9:
+ fixed initgroups (oops)
+ Cleanup appending file open for stdio (thanks, James Antill)
+ imported vfprintf fix from James Antill.
+ add fnmatch
+ change index, rindex and bcmp as weak ELF symbols (were #defined before)
+ Olaf added character classes to *scanf.
+ Put object and library files into a separate directory (bin-$ARCH).
+ Add "cross" make target to make all architectures.
+ Add "diet" program and man page.
+ Add getgrnam, getgrgid
+ Add cfmakeraw (Thanks, Antonio Musumeci)
+ localtime won't call gettimeofday when the tzfile parser is used.
+
+0.8:
+ vsnprintf(0,...) estimated the length of strings with a padding width
+ incorrectly.
+ new reboot() from Olaf.
+ added prototypes for getsockopt and setsockopt.
+ added experimental sem* and shm*
+ define EXIT_SUCCESS and EXIT_FAILURE
+ added setvbuf (only changes mode, not buffer)
+ added dietwarning.h (woohoo, linker warnings!) and used it to warn of
+ insecurity (system, sprintf) or bloat (printf and stdio).
+ added qsort() and bsearch(). Benchmark on 1000 random ints:
+ glibc: 679414 cycles qsort and 3352 cycles bsearch
+ diet libc: 300010 cycles qsort, 553 cycles bsearch
+ I have no idea why glibc is so slow.
+ added __isnan (references by libm.a from glibc).
+ added popen() and pclose(). Now the diet libc can link slsh (from
+ S-Lang!)
+ corrected usleep. It was more of an msleep until now.
+ corrected __dtostr (it looped when trying to format "0.0").
+ several fixes to stdio (thanks to S-Lang's excellent test suite!)
+ added ungetc (does it work?)
+ added inet_aton (yuck!)
+ added gethostbyname, gethostbyaddr, gethostbyname_r and gethostbyaddr_r
+ added h_errno and __h_errno_location
+ added inet_ntoa
+ added setpgrp and getpgrp, strsignal and execv (thanks, Olaf)
+ add bcopy, index, rindex macros
+ add isgraph and isxdigit
+ add strftime (ugh!!!)
+ Olaf fixed strftime, gmtime_r leap year bug.
+ Jeff Garzik contributed a spec file. I put it in contrib and hope
+ everbody knows what to do with it...
+ Olaf checked in a ton of libpthread stuff.
+ added mkstemp using /dev/urandom (harder to guess than getpid()).
+ add large file backwards compatibility support (so gzip will run on
+ kernel 2.2 and 2.0)
+ added shutdown
+ added nice
+ added pseudo-locale support for is* (they are now weak aliases,
+ isupper -> __isupper_ascii etc). So, for example, liblatin1 can
+ overwrite the default is* functions.
+ added liblatin1.a
+ added tzfile implementation (does it work for anyone else?)
+ added syslog(3) (thanks to Rene Müller!)
+ Jeff Garzik contributed getgr*, getpw* and getsp* in one tiny package.
+ Thanks!
+ merged duplicate code in execv and execvp into exec_lib.o
+
+0.7.2:
+ added several prototypes to already implemented functions and
+ <sys/reboot.h>. Thanks for Abraham for pointing this out.
+ added prototypes for process group and dup syscalls. Thanks to
+ Abraham again. He also contributed an implementation for daemon(),
+ an ugly BSD hack. I decided to diversify the lib/ directory a
+ little and now created a libugly/ directory for stuff like system()
+ and daemon() ;-)
+ added libstdio and moved all that stdio crap from lib/ there. The
+ idea is to start separating now what we will separate for shared
+ libraries anyway.
+ optimized x86 unified-syscall by Olaf.
+ added limits.h, removed __ARCHBITS from endian.h (use __WORDSIZE from
+ limits.h instead)
+ added remove.c and enough cruft to limits.h to make it compile lzo,
+ lzop and bzip2.
+ added mktime, asctime_r, asctime and ctime (needed for gzip).
+ Someone will need to implement a reader for the glibc localtime file
+ format some day (man tzfile, ugh!) :-(
+ added unlink prototype to unistd.h.
+ added gmtime and gmtime_r.
+ fixed sparc unified syscall error handling (please upgrade!).
+ removed readdir glibc compatibility cruft.
+ removed stat glibc compatibility cruft.
+ oops, my fread was broken for pipes.
+ Olaf found a bug in pipe() for sparc, too.
+
+0.7.1:
+ optimized away the static arrays from __ltostr and __lltostr.
+ optimized away the static arrays (and more!) from strtoul and strtoull.
+ added system (by Olaf).
+ added tolower and toupper
+ added getopt from Olaf (~600 bytes on x86!)
+ added clone for mips (by Olaf).
+ fixed longjmp and setjmp on sparc not to require glibc include files.
+ added pause for all (by Olaf).
+ added __attribute__ ((__const__)) to ctype.h
+ added isupper and islower.
+ added putc and putchar as macros.
+ added strcasecmp and strncasecmp (thanks to Abraham vd Merwe for
+ insightful discussions and patches I partially used for the last three)
+ added getpriority and setpriority (also by Abraham)
+ oops, I broke strtoul in a recent optimization attempt.
+ oi, setjmp and longjmp were broken on other platforms, too!
+ Thanks to Sébastien Côté for reporting this.
+
+0.7:
+ clone support for i386,alpha,arm and sparc by Olaf.
+ Initial dynamic loading glue for i386, also by Olaf.
+ We don't have a dynamic loader yet, so this is not yet usable.
+ added readv, sigdelset, sigaltstack, sigfillset, sigismember, usleep,
+ vsprintf, writev, all by Olaf.
+ imported readdir fix from Guillaume. Mhh, can the kernel interface
+ really be this broken?
+ Found a kludgy way to detect whether the kernel includes define struct
+ stat64 (they also define STAT64_HAS_BROKEN_ST_INO). If this does
+ not work for you, please tell me!
+ Removed bogus __seek_types enum, it's a bunch of #defines now.
+ Fixed stdio line buffering. The code was already there but I forgot
+ to mark stdio and stdout as line buffered. This should really be
+ done dynamically using isatty, though.
+ Removed superfluous "if (1)" in execvp.c
+
+0.6.14:
+ *scanf did not append the 0 byte for %s.
+ added creat and changed creat to call open directly instead of open64.
+ did for fread what 0.6.10 did for fwrite.
+ repaired buffered stdio a little (line buffering is still not
+ supported).
+ [All of these bugs have been reported by Guillaume. Thanks!]
+ added __pure__ to strchr and strrchr in <string.h>
+
+0.6.13:
+ included COPYING to make clear that the diet libc is covered by the
+ GNU General Public License (and _not_ the LGPL). That means that
+ you need to obtain a license from me if you want to use the diet
+ libc in a proprietary program that you want to distribute.
+ The x86 unified syscall swapped arguments #4 and #5 and noone
+ noticed until now! Thanks to Guillaume Cottenceau for reporting
+ this!
+ The malloc had a subtle bug with small allocations that could cause
+ segfault. Guillaume reported it, Olaf fixed it.
+
+0.6.12:
+ added assert, statfs and fstatfs
+ added include/net/if.h so fget compiles again.
+
+0.6.11:
+ added putenv.
+
+0.6.10:
+ fixed fwrite. It returned the number of bytes written, not the number
+ of records. Thanks to Albert D. Cahalan for pointing this out.
+ fixed fgets. It returned EOF on empty lines. Thanks, Erik Frey.
+ added brk and sbrk. harold@nb.com.sg made me do it.
+
+0.6.9:
+ fixed execvp not to return on ENOENT
+ did for {open|read|close|seek|tell}dir what I did for stat before.
+ The glibc compatibility part is currently non-functional.
+ fixed white space handling in sscanf " (" would not match " (".
+ fixed printf to accept 'l' flag.
+ fixed getpwuid (ignored last line)
+
+0.6.8:
+ Olaf contributed initial thread-safe syscalls for i386, alpha, sparc,
+ mips and arm. I did the one for ppc. They can be enabled in dietfeatures.h.
+ added strlcpy and strlcat from OpenBSD.
+ added stat64, fstat64 and lstat64.
+ added endian.h and made ending of strlen.c endianness-aware
+ added string routines size tweak to dietfeatures.h. Most of the
+ string routines have been unrolled. This is up to three times as
+ fast but creates up to three times larger code. Now you can disable
+ the unrolling.
+ added sendfile.
+ I also added pread. It works on x86 and sparc but not on ppc and mips.
+ I have no idea what's going on. strace disagrees with the kernel.
+ Can anyone help? I asked the Linux kernel mailing list for help, too.
+ added a few aliases of the type __libc_open for open. nm on
+ libpthreads.so indicates that we will need them.
+
+0.6.7:
+ the sources now compile without warnings with -Wall.
+ printf now prints "(null)" when %s is passed NULL. This can be
+ removed with WANT_NULL_PRINTF in dietfeatures.h
+ added vfprintf, execl, ttyname.
+ stat, lstat and fstat are now #defined to __dietstat, __dietlstat and
+ __dietfstat so they can use the normal kernel struct stat.
+ stat, lstat and fstat are now C wrappers that convert to the glibc
+ struct stat. So we can avoid that overhead for programs that use
+ dietlibc headers.
+
+0.6.6:
+ changed the Makefiles so you can now set CFLAGS on the command line
+ added memccmp (analogous to memccpy) and strncmp.
+ Olaf fixed another bug in the sparc unified syscall.
+ Paul Clifford contributed a C version of his strlen.S that is much
+ more efficient than the previous strlen on all platforms! It also
+ looks like technology from Roswell. ;-}
+ added a "real" stdio. Well, almost. Please contribute!
+ added dietfeatures.h so you can remove features you don't need.
+ removed debug code from vsnprintf that changed \0 to ' ' (argh!).
+ stdio now works with simple programs and minigzip from libz.
+ stdio uses some major trickery to avoid linking the stdio, stderr and
+ stdout (and reserving space for them) when they are not used.
+
+0.6.5:
+ Red Plait <redplait@ixcelerator.com> found several bugs in diet libc,
+ most of them bugs in the new header files, but also missing sigset
+ functions.
+ Paul Clifford contributed an assembly strlen.S for ARM and fixed
+ several bugs.
+ Fixed ppc/setjmp and mips/pipe.
+ Olaf contributed a new sparc unified syscall.
+
+0.6.4:
+ declared is* static inline in getservent.
+ added assert_fail, strtoul, isalpha, isdigit, isalnum, isascii.
+ changed strlen to return 0 when passed NULL.
+ new, much smaller unified syscall for MIPS. Thanks to Olaf the Mad
+ Scientist who actually implemented this without access to a MIPS
+ box, just from reading the architecture manual. And it worked out
+ of the box.
+ started a set of system includes, mainly so that I can use lcc and
+ my alpha-linux cross compiler (which is unable to cross-compile
+ glibc). diet libc can now be compiled without any include files
+ from a normal libc. The includes do declare more than diet libc
+ currently delivers and they are still far from complete for real
+ applications.
+ I will only add assembly versions that are smaller _and_ faster than
+ the C version. Larger routines are only accepted if they are called
+ very often and are substantially faster.
+ added i386 assembly strchr, which is smaller and faster than the old
+ version. It is, however, larger than the version contributed by
+ proton (thanks, anyway).
+ added i386 strlen (31% faster, 14% smaller)
+ "make t" will now create a map file called "mapfile".
+
+0.6.3:
+ added sys_errlist, strerror and perror
+ added isblank
+ added atol
+
+0.6.2:
+ mmap for ARM didn't compile. Thanks, Paul!
+
+0.6.1:
+ split mmap into the architecture specific subdirectories.
+ getenv now copes with environ==NULL, thanks Paul Clifford.
+ Paul also contributed a smaller ARM startup code.
+
+0.6:
+ strcat returned the wrong result. Thanks, Dietz Pröpper.
+ strtod now understands a negative exponent (oops, thanks Bertram Barth)
+ Port to arm-linux-gnu, but on the Netwinder I use for testing the
+ __dtostr does not work (I have no idea why!)
+ The MIPS port now uses (much smaller) non-PIC code. That means that
+ the applications you link against diet libc also have to be compiled
+ non-PIC. I suggest copying the CFLAGS from the diet libc Makefile.
+ Thanks to Ralf Bächle for helping me with this!
+ I made subdirectories for the architectures and use VPATH to override
+ VPATH so that make finds the source file automatically. That should
+ simplify the sources greatly.
+ Olaf Dreesen contributed Alpha support including setjmp and longjmp!
+ ARM and MIPS now also have setjmp and longjmp
+ "compile" and "load" are now make targets. Use them for djb programs.
+ added contrib/elftrunc.c which will remove unnecessary ELF headers.
+ Again, contributed from Olaf. Great work!
+
+0.5.12:
+ printf also does signed numbers.
+ If you don't use atexit, dietlibc now does not link exit, only _exit.
+ *printf now correctly returns the number of bytes written.
+ Olaf contributed experimental sscanf and vsscanf implementations.
+ If passed NULL as buffer, snprintf will not write anything but still
+ return the number of bytes it would have written.
+ Initial MIPS port! (Oh, the agony!)
+ No setjmp and longjmp support yet! Please contribute!
+ I even implemented unified syscalls for MIPS. Still, MIPS code is
+ almost twice the size of SPARC code. If anyone knows why: please
+ tell me!
+
+0.5.11:
+ I implemented new unified syscalls for x86, sparc and ppc, this time based
+ on .s files and not .c files, and I moved the syscalls into
+ subdirectores to clean the dietlibc sources up a little.
+ A binary consisting of printf("%s is %d\n","olaf",23) is now
+ 2864 bytes on sparc
+ 2488 bytes on intel
+ I kludgily implemented fprintf(stdout,... and fprintf(stderr,...
+ to make a few more applications work.
+ Olaf Dreesen also implemented some unified syscall stuff for x86.
+ He discovered that with our unified syscall interface it actually
+ costs <10 bytes total to make all system calls thread safe!
+ I implemented atexit() (can register up to 4 callbacks).
+ I implemented strtod and __dtostr (the opposite). Now we can add
+ floating point support to vsnprintf and sscanf!
+
+0.5.10:
+ I actually saw that I can not only merge the errno handling code of
+ the system calls on x86, I can also merge the rest (including the
+ arguments) except for setting the system call number. All those
+ system calls are now just a jump to a unified system call handler.
+ I got rid of x86openclose again. The savings are substantial:
+ chown from embutils went from 7664 to 7184 bytes!
+ If I'd move the system call wrappers to assembly language, I could
+ even reduce the alignment (does not matter since it's just a jump
+ anyway) and get rid of the "ret" behind each jump (one byte per
+ system call!)
+
+0.5.9:
+ added memchr, strpbrk, strstr, strtol, isspace (hehe)
+ fixed strdup
+ fixed return values for strcpy and strcat (thanks to Norbert Berzen)
+ Olaf Dreesen contributed a strtol and initial {sn|vsn|}printf implementation
+ (no signed integers, only strings and unsigned integers (but
+ supporting octal, hex and decimal). Thanks, Olaf! (by the way:
+ that code must be wonderful, I don't understand it at all *bg*)
+ Olaf's printf does understand padding like in "%08d" and "%8d" and
+ automatically pads pointers with '0'.
+ Rewrote the x86 start code, old: 22 instructions, new: 12 instructions.
+ Thanks to proton for inspiration on this.
+ The new x86 start code also does not reference exit any more, thus saving
+ 64 bytes for executables that don't call exit explicitly.
+ [insert maniacal laughter] EVERY BYTE COUNTS!1!! ;-)
+ Moved errno and environ to start.S, saving no byte binary size but
+ speeding up compilation and slightly shortening dietlibc.a ;-)
+ For x86: joined open and close into one assembler file, sharing the
+ errno handling. This is a feasibility test and it actually saves a
+ few bytes. I think I will reimplement the _syscall[1-6] macros on
+ all platforms now to share the errno handling code for them.
+
+0.5.8:
+ fixed strchr to be able to look for 0.
+
+ added _llseek, ftruncate, getpgid, getresgid, getresuid, getsid,
+ memccpy, memmove, mprotect, setregid, setresgid, setresuid, setreuid,
+ strncpy, swapon, truncate, strtok, strtok_r, strspn, strcspn (all
+ contributed by Olaf Dreesen)
+
+ added execvp, getcwd
+
+ fixed __xmknod
+
+ Note: can it be that the ftw interface really is so broken that I
+ cannot implement it without having to implement some searching data
+ structure? I included an experimental ftw implementation that will
+ not follow symlinks.
+
+0.5.7:
+ oops, if_nametoindex was broken!
+
+0.5.6:
+ ported to ppc-linux.
+ fixed i386 sigsetjmp (I mistyped the function name)
+ included sigjmp.c
+
+0.5.5:
+ added wait, sys_siglist, longjmp/setjmp/sigsetjmp for i386 and sparc
+ actually, it wasn't fork that wasn't working for sparc, it was pipe.
+ I fixed it now.
+ dietlibc/SPARC assumes -msupersparc (does not provide div, mul, etc)
+ fixed readdir to use getdents and not the intel inline asm
+
+0.5.4:
+ ported to sparclinux (sparc32 only). Beware: does not work yet.
+ added raise, abort, readlink, strcat, geteuid, geteuid, wait3, access
+
+0.5.3:
+ added tcsetattr and getenv to compile e3
+
+0.5.2:
+ added vhangup, tcgetattr, isatty and memcmp for fgetty
+ (http://www.fefe.de/fgetty/)
+ added localtime from uC-libc.
+
+0.5.1:
+ stat and friends actually work now. Yuck! Another case of
+ translation between kernel and userland. Why can't the kernel
+ people and the libc people simply agree on a standard?
+ removed many unnecessary includes to speed up compilation.
+ added -fomit-frame-pointer and i386 compilation target to reduce code size.
+ inlined socketcall to reduce code size.
+ "load" and "compile" are examples for djb code.
+
+0.5:
+ Olaf Dreesen contributed a much smaller implementation of malloc and friends.
+ each object file is now treated with "strip -x -R .note -R .comment"
+ split each system call into a separate object file
+ added ntohs, htons, alarm, if_indextoname and if_nametoindex
+
+0.4.1:
+ oops, the strchr implementation was wrong. Thanks Jens Laas!
+
+0.4:
+ copied opendir and friends from uC-libc.
+ added getservent and getservby* in gerservent.c
+
+0.3:
+ remove readdir system call
+ added getdents system call
+ added getpwnam/getpwuid implementation in getpwnam.c
+ added a few string functions (in str*.c)
+
diff --git a/mdk-stage1/dietlibc/COPYING b/mdk-stage1/dietlibc/COPYING
new file mode 100644
index 000000000..5b6e7c66c
--- /dev/null
+++ b/mdk-stage1/dietlibc/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/mdk-stage1/dietlibc/FAQ b/mdk-stage1/dietlibc/FAQ
new file mode 100644
index 000000000..d6595dcc9
--- /dev/null
+++ b/mdk-stage1/dietlibc/FAQ
@@ -0,0 +1,224 @@
+diet libc FAQ.
+
+
+Q: How do I compile this? I don't see a configure?
+A: Just type make.
+
+
+Q: How do I install it? make install?
+A: Yep. It will then install itself to /opt/diet, with the wrapper in
+ /opt/diet/bin/diet. Or you don't install it at all.
+ The diet libc comes with a wrapper called "diet", which can be found
+ in bin-$(ARCH)/diet, i.e. bin-i386/diet for most of us. Copy this
+ wrapper somewhere in your path (for example ~/bin) and then just
+ compile stuff by prepending diet to the command line, e.g. "diet gcc
+ -pipe -g -o t t.c".
+
+
+Q: How do I compile programs using autoconf with the diet libc?
+A: Set CC in the environment properly. For Bourne Shells:
+
+ $ CC="diet gcc -nostdinc" ./configure --disable-nls
+
+ That should be enough, but you might also want to set
+ --disable-shared and --enable-static for packages using libtool.
+
+
+Q: My program complains about missing asm/* or linux/* header files!
+A: It is quite linux specific. You can try omitting the -nostdinc, but
+ except for some cases conflicts are likely. You should not be using
+ the kernel headers in your software.
+
+
+Q: Do you have cross compiling support?
+A: Yes. Just type something like "make ARCH=arm CROSS=arm-linux- all".
+ For arm, alpha, mips, ppc, sparc and i386, shortcuts exist. You can
+ also use "make arm", for example. You still use the same "diet"
+ program as for normal compilation, but you can then say
+
+ $ diet sparc-linux-gcc -pipe -g -o t t.c
+
+ Programs using autoconf can be configured like this:
+
+ $ CC="diet sparc-linux-gcc" ./configure --disable-nls
+
+
+Q: There are a few warnings about possibly uninitialized variables when
+ compiling the diet libc. Can't you remove them?
+A: This type of warning can only be removed by a) compiling without
+ warnings or b) initializing the variables in question. In all cases,
+ the variables won't actually be used uninitialized, but adding an
+ explicit initializer will add a few bytes of code. As you know, the
+ goal of the diet libc is to not waste a single byte of code, so we
+ don't add initializers ;-)
+
+
+Q: When linking binaries, I get warnings about stdio and printf all the
+ time. What gives?
+A: Since the diet libc was written to make writing small programs
+ possible, it also tries to assist in the process of seeing causes of
+ bloat. Premier causes for bloat are stdio and the printf family of
+ functions. The diet libc will also warn you if you still use
+ assert() (which is normally not enabled in production code) or if you
+ use functions that use static buffers (like gethostbyname and
+ friends).
+
+
+Q: My program stopped parsing command line arguments properly! Now what?
+A: The getopt in the diet libc adheres to the Single Unix Specification.
+ In particular, it initialized optind to 1 (not 0) and breaks if
+ someone sets optint to 0 (as some misguided legacy programs to).
+ Also, it does not reorder arguments, i.e. something like "rm -f foo -v"
+ will not see -v as option but rather as non-option argument. If you
+ need GNU getopt behaviour, please use GNU getopt instead of the diet
+ libc code.
+
+
+Q: I get linker errors about missing __ctype_b!
+A: This happens when you link in code that was compiled with the glibc
+ headers. The most common culprit is a library like -lncurses,
+ -lcrypto or -lresolv. All external libraries you use have to be
+ compiled with the diet libc headers (CC="diet gcc"), and there is no
+ libresolv with the diet libc, it's in the main libc!
+
+
+Q: My program links, but when I run it, I get no output at all and it
+ appears to terminate immediately.
+A: This normally happens if you link in glibc. The major reason for
+ this was that shared libraries were linked in. diet sets -static
+ since version 0.13, so if it still happens to you, you need to strace
+ and debug your software.
+
+
+Q: Why aren't you compatible to glibc? I thought the interface was a
+ standard?
+A: Yes, the interface is, but a lot of details are missing. For
+ example, the diet libc uses a different "struct stat" layout than
+ glibc. We use the one from the kernel, glibc uses an own one and
+ links in translation code. This is part of the reason why glibc is
+ so big and ugly. If we support all of this, we end up as bloated as
+ glibc.
+
+
+Q: Where is the test suite?
+A: The humble beginnings are in the "test" directory, but it can't be
+ run automatically yet.
+
+
+Q: GPL sucks! Now I can't compile my BSD programs with the diet libc!
+A: Wrong. You can compile them, and you can use them. You just can't
+ redistribute the binaries. If you are a distribution vendor and want
+ to use the diet libc to make BSD licensed binaries for the install
+ or rescue floppy which you sell commercially, please talk to me.
+
+
+Q: Where are the shared libaries? make install didn't install them!
+A: You have to explicitly build them with "make dyn". Since they are
+ experimental and only supported on a small subset of the platforms,
+ that is not default. Also, I recommend you only use shared libraries
+ if you really know what you are doing. For example, you can't just
+ use your system shared libraries, because they have a dependency on
+ glibc in them, so the program will crash. And you have to explicitly
+ compile the code with -fPIC or -fpic. You can then use them by
+ substituting "diet-dyn" for "diet" on the command line.
+
+
+Q: My target platform does not have a MMU. Should I be using uClibc?
+A: I am not aware of any issues with MMU-less systems. You should be
+ able to use the diet libc just fine. Having a MMU or not is mostly
+ an issue for the kernel, not libc.
+
+
+Q: How do I make myself a cross compiler?
+A: untar binutils and gcc (I used version 2.11.2 and 3.0.4 respectively)
+ Then use the --target=arm-linux (or whatever platform you want)
+ configure options. For gcc, add --enable-languages=c (otherwise gcc
+ will try to make C++, Objective C and Java, too, and those
+ compilations will fail because they require installed libc headers
+ which you don't have yet). I recommend using --enable-static
+ --disable-shared, too, because otherwise the binutils shared
+ libraries will overwrite each other if you install more than one
+ cross binutils for different targets.
+ binutils$ ./configure --enable-static --disable-shared --prefix=/opt/cross --target=arm-linux
+ gcc$ ./configure --enable-static --disable-shared --prefix=/opt/cross --target=arm-linux --enable-languages=c
+ For some platforms, gcc compilation will fail while trying to compile
+ some part of libgcc.a because it depends on some libc header file.
+ This is a gcc bug and you should complain using gccbug, because you
+ can't cross-compile libc unless you successfully installed the cross
+ compiler.
+
+
+Q: Where are the xdr_* symbols?
+Q: Where are the RPC symbols?
+Q: util-linux says that rpcgen output does not work?!
+A: Add -lrpc. The code is from Sun and frankly it is so ugly and so
+ rarely used that I don't want to include it in libc.
+
+
+Q: I am missing some BSD/GNU extension!
+A: I started adding a few of them to libcompat. You have to link it in
+ manually, though, as using them is bad for portability and I want
+ people to make a conscious effort to write non-portable applications
+ by not including them in the libc itself.
+
+
+Q: I'm just starting with the diet libc. Should I use the tarball or
+ the CVS version?
+A: Always use the CVS version. We generally don't add unstable test
+ stuff on the CVS tree, and our APIs are stable (they are
+ standardized, remember?). In fact, we don't add much stuff at all.
+ Most changes are bug fixes and optimizations, and in general you'll
+ want those.
+
+
+Q: Does the diet libc support profiling (with gprof)?
+A: There is experimental support for profiling, but so far it only works
+ on x86. To use it, do "make profiling" before make install. Then,
+ diet will link in the support code if it finds a -pg on the gcc
+ command line.
+
+
+Q: I get compiler errors in a line with caddr_t, u_long, n_short or
+ nlong or similar.
+A: Add -D_BSD_SOURCE to the compiler command line. The diet libc tries
+ to encourage portable and standards compliant programming, so it
+ hides these legacy BSD types from the standard name space. The
+ reason is that the Single Unix Specification contains a specification
+ of the socket API but does not mention those types.
+
+
+Q: I get compiler errors in a line with u_int8_t or similar.
+A: Add -D_GNU_SOURCE to the compiler command line. See previous
+ question. This is a very questionable GNU extension. The C Standard
+ defines uint8_t, uint16_t and uint32_t. Use those instead.
+
+
+Q: Can I compile or use the diet libc with a compiler that is not gcc?
+A: Compile: no. Use: yes.
+
+
+Q: Can you please port the diet libc to FreeBSD/Solaris/Windows?
+A: No.
+
+
+Q: Why do you support non-embedded platforms like IA64 and x86_64?
+A: The diet libc is also useful for servers because it can improve
+ performance by an order of magnitude for certain programming models.
+ Please see http://www.fefe.de/fnord/ (in particular .../fnord/SPEED)
+ for an example and/or read http://www.fefe.de/talk.pdf for some
+ benchmarks.
+
+
+Q: I just compiled hello world and the binary is larger than with glibc!
+A: You forgot to add the dynamic glibc to your size comparison. Please
+ use -static when linking with glibc to see the difference.
+
+
+Q: Should I compile my kernel with the diet libc?
+A: The kernel is not linked against any libc. In fact, the libc is the
+ user space interface to the kernel. So unless you are talking about
+ "user mode linux" (which is a special version of the kernel that
+ happens to be a user space program) you cannot link the kernel
+ against the diet libc. Linking user space Linux with the diet libc
+ should be possible in theory but I don't think anyone has actually
+ tried it.
diff --git a/mdk-stage1/dietlibc/Makefile b/mdk-stage1/dietlibc/Makefile
index b6e7b2783..0fe32e61b 100644
--- a/mdk-stage1/dietlibc/Makefile
+++ b/mdk-stage1/dietlibc/Makefile
@@ -1,13 +1,101 @@
-ARCH=$(shell uname -m | sed 's/i[4-9]86/i386/')
+INSTALL=install
+prefix?=/usr
+# Set the following to install to a different root
+#DESTDIR=/tmp/fefix
+# Use "make DEBUG=1" to compile a debug version.
+
+MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/' -e 's/ppc64/ppc/')
+
+# This extra-ugly cruft is here so make will not run uname and sed each
+# time it looks at $(OBJDIR). This alone sped up running make when
+# nothing has to be done from 1 sec to 0.12 sec on a 900 MHz Athlon.
+# We don't use ARCH:=$(MYARCH) so we can detect unknown architectures.
+ifeq ($(MYARCH),i386)
+ARCH=i386
+else
+ifeq ($(MYARCH),mips)
+ARCH=mips
+else
+ifeq ($(MYARCH),alpha)
+ARCH=alpha
+else
+ifeq ($(MYARCH),ppc)
+ARCH=ppc
+else
+ifeq ($(MYARCH),arm)
+ARCH=arm
+else
+ifeq ($(MYARCH),sparc)
+ARCH=sparc
+else
+ifeq ($(MYARCH),sparc64)
+ARCH=sparc64
+else
+ifeq ($(MYARCH),s390)
+ARCH=s390
+else
+ifeq ($(MYARCH),mipsel)
+ARCH=mipsel
+else
+ifeq ($(MYARCH),parisc)
+ARCH=parisc
+else
+ifeq ($(MYARCH),parisc64)
+ARCH=parisc
+MYARCH=parisc
+else
+ifeq ($(MYARCH),x86_64)
+ARCH=x86_64
+else
+ifeq ($(MYARCH),ia64)
+ARCH=ia64
+else
+$(error unknown architecture, please fix Makefile)
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+
+# ARCH=$(MYARCH)
+
+LIBDIR=${prefix}/lib
+ifeq ($(ARCH),x86_64)
+LIBDIR=${prefix}/lib64
+endif
+BINDIR=${prefix}/bin
+MAN1DIR=${prefix}/share/man/man1
+INSTALLHOME=$(LIBDIR)/dietlibc
OBJDIR=bin-$(ARCH)
+ILIBDIR=$(INSTALLHOME)/lib-$(ARCH)
-all: $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/librpc.a $(OBJDIR)/diet
+HOME=$(shell pwd)
-CFLAGS=-pipe
+WHAT= $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \
+ $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \
+ $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \
+ $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \
+ $(OBJDIR)/diet $(OBJDIR)/diet-i
+
+all: $(WHAT)
+
+profiling: $(OBJDIR)/libgmon.a $(OBJDIR)/pstart.o
+
+CFLAGS=-pipe -nostdinc
CROSS=
-VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:librpc:libregex:syscalls.c
+CC=gcc
+
+VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling
SYSCALLOBJ=$(patsubst syscalls.s/%.S,$(OBJDIR)/%.o,$(wildcard syscalls.s/*.S))
@@ -17,13 +105,23 @@ 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))
+LIBCOMPATOBJ=$(patsubst libcompat/%.c,$(OBJDIR)/%.o,$(wildcard libcompat/*.c)) $(OBJDIR)/syscall.o
+LIBMATH=$(patsubst libm/%.c,%.o,$(wildcard libm/*.c))
LIBRPCOBJ=$(patsubst librpc/%.c,$(OBJDIR)/%.o,$(wildcard librpc/*.c))
LIBREGEXOBJ=$(patsubst libregex/%.c,$(OBJDIR)/%.o,$(wildcard libregex/*.c))
+LIBDLOBJ=$(patsubst libdl/%.c,$(OBJDIR)/%.o,$(wildcard libdl/*.c)) $(OBJDIR)/_dl_jump.o
+
+LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh)) $(OBJDIR)/__testandset.o
+
+LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o
+
include $(ARCH)/Makefile.add
-ifeq ($(CFLAGS),-pipe)
+LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH))
+
+ifeq ($(CFLAGS),-pipe -nostdinc)
CFLAGS+=-O -fomit-frame-pointer
endif
@@ -31,28 +129,39 @@ ifneq ($(DEBUG),)
CFLAGS = -g
COMMENT = :
endif
-CFLAGS += -Wall -Wno-switch
+CFLAGS += -Wall -W -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations -Wno-switch -Wredundant-decls -Wno-unused
PWD=$(shell pwd)
.SUFFIXES:
.SUFFIXES: .S .c
-$(OBJDIR):
+# added real dynamic dietlibc.so
+PICODIR = pic-$(ARCH)
+
+$(OBJDIR) $(PICODIR):
mkdir $@
% :: %,v
-$(OBJDIR)/%.o: %.S
+$(OBJDIR)/pstart.o: start.S
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -DPROFILING -c $< -o $@
+
+$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h
$(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
+$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
+ $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
+
$(OBJDIR)/%.o: %.c
$(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+ $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
-DIETLIBC_OBJ = $(SYSCALLOBJ) $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
+DIETLIBC_OBJ = $(OBJDIR)/unified.o \
+$(SYSCALLOBJ) $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
$(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) \
-$(OBJDIR)/__longjmp.o $(OBJDIR)/setjmp.o $(OBJDIR)/unified.o \
+$(OBJDIR)/__longjmp.o $(OBJDIR)/setjmp.o \
$(OBJDIR)/mmap.o $(OBJDIR)/clone.o
$(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o
@@ -65,67 +174,179 @@ LIBLATIN1_OBJS=$(patsubst liblatin1/%.c,$(OBJDIR)/%.o,$(wildcard liblatin1/*.c))
$(OBJDIR)/liblatin1.a: $(LIBLATIN1_OBJS)
$(CROSS)ar cru $@ $^
+$(OBJDIR)/libgmon.a: $(LIBGMON_OBJS)
+ $(CROSS)ar cru $@ $^
+
+$(OBJDIR)/libpthread.a: $(LIBPTHREAD_OBJS) dietfeatures.h
+ $(CROSS)ar cru $@ $(LIBPTHREAD_OBJS)
+
+$(OBJDIR)/libcompat.a: $(LIBCOMPATOBJ)
+ $(CROSS)ar cru $@ $(LIBCOMPATOBJ)
+
+$(OBJDIR)/libm.a: $(LIBMATHOBJ)
+ $(CROSS)ar cru $@ $(LIBMATHOBJ)
+
$(OBJDIR)/libdietc.so: $(OBJDIR)/dietlibc.a
$(CROSS)ld -whole-archive -shared -o $@ $^
+dyn: dyn_lib
+
+# added dynamic linker
+$(OBJDIR)/libdl.a: $(LIBDLOBJ)
+ $(CROSS)ar cru $@ $(LIBDLOBJ)
+
+dyn_lib: $(PICODIR) $(PICODIR)/libc.so $(PICODIR)/dstart.o \
+ $(PICODIR)/dyn_so_start.o $(PICODIR)/dyn_start.o $(PICODIR)/dyn_stop.o \
+ $(PICODIR)/libpthread.so $(PICODIR)/libdl.so $(PICODIR)/libcompat.so \
+ $(PICODIR)/diet-dyn $(PICODIR)/diet-dyn-i
+
+$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+
+$(PICODIR)/pthread_%.o: libpthread/pthread_%.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+ $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+
+$(PICODIR)/%.o: %.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+ $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+
+$(PICODIR)/dstart.o: start.S
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+
+$(PICODIR)/dyn_so_start.o: dyn_start.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@
+ $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+
+DYN_LIBC_PIC = $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
+$(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ)
+
+DYN_LIBC_OBJ = $(PICODIR)/dyn_syscalls.o $(PICODIR)/errlist.o \
+ $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(DYN_LIBC_PIC))
+
+DYN_PTHREAD_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBPTHREAD_OBJS))
+
+DYN_LIBDL_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBDLOBJ))
+
+DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ))
+
+$(PICODIR)/libc.so: $(PICODIR) $(DYN_LIBC_OBJ)
+ $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -lgcc -Wl,-soname=libc.so
+
+$(PICODIR)/libpthread.so: $(DYN_PTHREAD_OBJS) dietfeatures.h
+ $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -lc -Wl,-soname=libpthread.so
+
+$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h
+ $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -o $@ $(CFLAGS) -I. -Iinclude libdl/_dl_main.c -Wl,-soname=libdl.so
+
+#$(PICODIR)/libdl.so: $(DYN_LIBDL_OBJS) dietfeatures.h
+# $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBDL_OBJS) -L$(PICODIR) -ldietc -Wl,-soname=libdl.so
+
+$(PICODIR)/libcompat.so: $(DYN_LIBCOMPAT_OBJS) dietfeatures.h
+ $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBCOMPAT_OBJS) -L$(PICODIR) -lc -Wl,-soname=libcompat.so
+
+
+
$(SYSCALLOBJ): syscalls.h
-$(OBJDIR)/diet: diet.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a
- $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(PWD)\"
+VERSION=dietlibc-$(shell head -1 CHANGES|sed 's/://')
+CURNAME=$(notdir $(shell pwd))
+
+$(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc
+ $(CROSS)strip -R .comment -R .note $@
+
+$(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(INSTALLHOME)\" -DVERSION=\"$(VERSION)\" -DINSTALLVERSION -lgcc
$(CROSS)strip -R .comment -R .note $@
+$(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so
+ $(CROSS)strip -R .command -R .note $@
+
+$(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/libdl.so -DINSTALLVERSION
+ $(CROSS)strip -R .command -R .note $@
+
$(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load
$(OBJDIR)/compile:
- echo 'exec gcc $(CFLAGS) -I$(PWD)/$(OBJDIR)/include -c $${1+"$$@"}' > $@
+ echo 'exec' $(CC) '$(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' > $@
+ echo 'main="$$1"; shift; exec' $(CC) '-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-*
+ rm -rf bin-* pic-*
+ $(MAKE) -C libdl clean
-tar: clean
- rm -f armv4l
- ln -sf arm armv4l
- cd ..; tar cvvf dietlibc.tar.bz2 dietlibc --use=bzip2 --exclude CVS
+tar: clean rename
+ cd ..; tar cvvf $(VERSION).tar.bz2 $(VERSION) --use=bzip2 --exclude CVS
+
+rename:
+ if test $(CURNAME) != $(VERSION); then cd .. && mv $(CURNAME) $(VERSION); fi
$(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
+ $(CROSS)$(CC) -g $(CFLAGS) -fno-builtin -nostdlib -Iinclude -o t t.c $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dietlibc.a -lgcc $(OBJDIR)/dyn_stop.o -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
+install: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/librpc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a $(OBJDIR)/diet-i
+ $(INSTALL) -d $(DESTDIR)$(ILIBDIR) $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(BINDIR)
+ $(INSTALL) $(OBJDIR)/start.o $(DESTDIR)$(ILIBDIR)/start.o
+ $(INSTALL) -m 644 $(OBJDIR)/libm.a $(OBJDIR)/libpthread.a $(OBJDIR)/librpc.a \
+$(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a $(DESTDIR)$(ILIBDIR)
+ $(INSTALL) -m 644 $(OBJDIR)/dietlibc.a $(DESTDIR)$(ILIBDIR)/libc.a
+ifeq ($(MYARCH),$(ARCH))
+ $(INSTALL) $(OBJDIR)/diet-i $(DESTDIR)$(BINDIR)/diet
+ -$(INSTALL) $(PICODIR)/diet-dyn-i $(DESTDIR)$(BINDIR)/diet-dyn
+endif
+ -$(INSTALL) $(OBJDIR)/pstart.o $(OBJDIR)/libgmon.a $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o $(DESTDIR)$(ILIBDIR)
+ -$(INSTALL) $(PICODIR)/libc.so $(DESTDIR)$(ILIBDIR)/libc.so
+ -$(INSTALL) $(PICODIR)/libpthread.so $(DESTDIR)$(ILIBDIR)/libpthread.so
+ -$(INSTALL) $(PICODIR)/libdl.so $(DESTDIR)$(ILIBDIR)/libdl.so
+ -$(INSTALL) $(PICODIR)/libcompat.so $(DESTDIR)$(ILIBDIR)/libcompat.so
+ -$(INSTALL) $(PICODIR)/dyn_start.o $(DESTDIR)$(ILIBDIR)/dyn_dstart.o
+ -$(INSTALL) $(PICODIR)/dyn_stop.o $(DESTDIR)$(ILIBDIR)/dyn_dstop.o
+ -$(INSTALL) $(PICODIR)/dstart.o $(PICODIR)/dyn_so_start.o $(DESTDIR)$(ILIBDIR)
+ $(INSTALL) -m 644 diet.1 $(DESTDIR)$(MAN1DIR)/diet.1
+ if test -f $(PICODIR)/libc.so -a ! -f $(DESTDIR)/etc/diet.ld.conf; then echo "$(ILIBDIR)" > $(DESTDIR)/etc/diet.ld.conf; fi
+ for i in `find include -name \*.h`; do install -m 644 -D $$i $(DESTDIR)$(INSTALLHOME)/$$i; done
+
+.PHONY: sparc ppc mips arm alpha i386 parisc mipsel powerpc s390 sparc64
+.PHONY: x86_64 ia64
+
+arm sparc ppc alpha i386 mips parisc s390 sparc64 x86_64 ia64:
+ $(MAKE) ARCH=$@ CROSS=$@-linux- all
+
+# Cross compile for little endian MIPS
+mipsel:
+ $(MAKE) ARCH=$@ CROSS=mips-linux- all
+
+mips-gnu:
+ $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all
+
+# Some people named their cross compiler toolchain powerpc-linux-gcc
+powerpc:
+ $(MAKE) ARCH=ppc CROSS=powerpc-linux- all
cross:
- $(MAKE) arm sparc ppc alpha i386 mips
+ $(MAKE) arm sparc ppc alpha i386 mips sparc64
# these depend on dietfeatures.h for large file backward compatibility
-$(OBJDIR)/__fstat64.o $(OBJDIR)/__lstat64.o $(OBJDIR)/__stat64.o: dietfeatures.h
+$(OBJDIR)/__fstat64.o $(OBJDIR)/__lstat64.o $(OBJDIR)/__stat64.o $(OBJDIR)/lseek64.o $(OBJDIR)/readdir64.o $(OBJDIR)/stat64.o $(OBJDIR)/lstat64.o $(OBJDIR)/fstat64.o $(OBJDIR)/truncate64.o $(OBJDIR)/__truncate64.o $(OBJDIR)/ftruncate64.o $(OBJDIR)/__ftruncate64.o $(PICODIR)/dyn_syscalls.o $(PICODIR)/__truncate64.o $(PICODIR)/__ftruncate64.o $(PICODIR)/__stat64.o $(PICODIR)/__lstat64.o $(PICODIR)/__fstat64.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
+$(OBJDIR)/alloc.o $(OBJDIR)/perror.o $(OBJDIR)/logging.o $(OBJDIR)/unified.o $(OBJDIR)/clone.o $(OBJDIR)/set_errno.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
@@ -137,10 +358,56 @@ fclose.o $(OBJDIR)/fdglue.o $(OBJDIR)/fflush.o $(OBJDIR)/fgetc.o $(OBJDIR)/fputc
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
+$(OBJDIR)/ttyname.o $(OBJDIR)/sysconf_cpus.o: dietfeatures.h
# these depend on dietfeatures.h for WANT_TZFILE_PARSER
-$(OBJDIR)/localtime_r.o: dietfeatures.h
+$(OBJDIR)/localtime_r.o $(OBJDIR)/strftime.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_SMALL_STDIO_BUFS
+$(LIBSTDIOOBJ): dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_FULL_RESOLV_CONF
+$(OBJDIR)/dnscruft.o $(OBJDIR)/dnscruft2.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_THREAD_SAFE and errno
+$(LIBRPCOBJ) $(OBJDIR)/logging.o $(OBJDIR)/alloc.o $(OBJDIR)/cfsetospeed.o $(OBJDIR)/cfsetispeed.o \
+$(OBJDIR)/execl.o $(OBJDIR)/execlp.o $(OBJDIR)/execv.o $(OBJDIR)/execvp.o $(OBJDIR)/isatty.o \
+$(OBJDIR)/lockf.o $(OBJDIR)/perror.o $(OBJDIR)/remove.o $(OBJDIR)/set_errno.o $(OBJDIR)/sigemptyset.o \
+$(OBJDIR)/tcsetattr.o $(OBJDIR)/dnscruft2.o $(OBJDIR)/dnscruft.o $(OBJDIR)/entlib.o \
+$(OBJDIR)/gethostbyaddr.o $(OBJDIR)/gethostbyaddr_r.o $(OBJDIR)/gethostbyname.o \
+$(OBJDIR)/gethostbyname_r.o $(OBJDIR)/gethostbyname2.o $(OBJDIR)/gethostbyname2_r.o \
+$(OBJDIR)/inet_pton.o $(OBJDIR)/mkstemp.o $(OBJDIR)/mktemp.o $(OBJDIR)/tempnam.o \
+$(OBJDIR)/glob.o $(OBJDIR)/realpath.o $(OBJDIR)/fdglue.o $(OBJDIR)/fdglue2.o \
+$(OBJDIR)/getaddrinfo.o $(OBJDIR)/getnameinfo.o $(OBJDIR)/getprotoent.o \
+$(OBJDIR)/getservent.o $(OBJDIR)/iconv.o $(OBJDIR)/iconv_open.o \
+$(OBJDIR)/netent.o $(OBJDIR)/system.o $(OBJDIR)/stdin.o $(OBJDIR)/stdout.o \
+$(OBJDIR)/stderr.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_CRYPT_MD5
+$(OBJDIR)/crypt.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_FREAD_OPTIMIZATION
+$(OBJDIR)/fread.o $(OBJDIR)/fwrite.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_DYNAMIC
+$(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o: dietfeatures.h
+
+$(OBJDIR)/unified.o: dietuglyweaks.h
+
+$(OBJDIR)/adjtimex.o: include/sys/timex.h
+
+$(OBJDIR)/fgetc_unlocked.o $(OBJDIR)/fread.o $(OBJDIR)/ungetc.o: dietstdio.h
+
+# these depend on dietfeatures.h for WANT_LINKER_WARNINGS
+$(OBJDIR)/setlinebuf.o $(OBJDIR)/bzero.o $(OBJDIR)/setegid.o \
+$(OBJDIR)/seteuid.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_FULL_POSIX_COMPAT
+$(OBJDIR)/strncpy.o: dietfeatures.h
+$(OBJDIR)/strxfrm.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_INET_ADDR_DNS
+$(OBJDIR)/gethostbyname_r.o: dietfeatures.h
+
+
+# CFLAGS+=-W -Wshadow -Wid-clash-31 -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wwrite-strings
diff --git a/mdk-stage1/dietlibc/PORTING b/mdk-stage1/dietlibc/PORTING
new file mode 100644
index 000000000..4e2a6358c
--- /dev/null
+++ b/mdk-stage1/dietlibc/PORTING
@@ -0,0 +1,28 @@
+To port the diet libc to a new architecture, you need to:
+
+ - edit Makefile to detect the architecture
+ - create a directory for the architecture, and put a Makefile.add in
+ it. Look at the other Makefile.adds for guidance.
+ - provide start.S (the start code, look at glibc)
+ - provide unified.S (the unified syscall)
+ - provide syscalls.h (the syscall numbers, from asm/unistd.h)
+ - provide setjmp and longjmp
+ - edit include/setjmp.h
+ - pipe, clone and mmap often need special care
+ - edit include/sys/ioctl.h
+ - edit include/sys/ptrace.h
+ - edit include/asm/sigcontext.h
+ - edit include/sys/ucontext.h
+ - edit include/endian.h
+ - edit include/fcntl.h
+ - edit include/sys/mman.h
+ - edit include/sys/shm.h
+ - edit include/sys/stat.h
+ - edit include/errno.h
+ - edit syscalls.h
+ - edit include/termios.h
+ - edit diet.c to make it recognize the architecture and add proper
+ CFLAGS
+ - edit libcompat/syscall.S
+
+(I may have missed a few)
diff --git a/mdk-stage1/dietlibc/README b/mdk-stage1/dietlibc/README
index ce9838832..2a1fa332c 100644
--- a/mdk-stage1/dietlibc/README
+++ b/mdk-stage1/dietlibc/README
@@ -1,3 +1,8 @@
+ The system library is a challenge to all those using the computer to
+ write their own faster and better routines or to bow to the superior
+ strength and skill of a true master.
+ --http://www.inner.net/users/cmetz/program-like-a-klingon
+
diet libc to statically link programs that don't need all the bloat
from glibc.
@@ -7,10 +12,7 @@ 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.
+make should compile the diet libc itself.
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
@@ -41,3 +43,7 @@ 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.
+
+
+The license for the diet libc is the GNU General Public License, version
+2 (as included in the file COPYING).
diff --git a/mdk-stage1/dietlibc/SECURITY b/mdk-stage1/dietlibc/SECURITY
new file mode 100644
index 000000000..67debc6e7
--- /dev/null
+++ b/mdk-stage1/dietlibc/SECURITY
@@ -0,0 +1,13 @@
+The diet libc was written with small code and embedded devices in mind,
+not with security for network servers.
+
+Of course we still try to avoid buffer overflows, but there are some
+parts of the code where tradeoffs have been made. This file is meant to
+document them.
+
+ 1. The DNS routines do not check whether the answer came from the IP
+ of the DNS server. The rationale is that people who can sniff the
+ network to find out the query, source port and DNS sequence number
+ can also spoof DNS packets to appear to come from the server we
+ asked, so it does not actually increase security to have that
+ check.
diff --git a/mdk-stage1/dietlibc/THANKS b/mdk-stage1/dietlibc/THANKS
new file mode 100644
index 000000000..cda9400b6
--- /dev/null
+++ b/mdk-stage1/dietlibc/THANKS
@@ -0,0 +1,31 @@
+The malloc code was done by Olaf Dreesen, who also helped with the SPARC
+start code and fork(). Olaf also did the printf and scanf routines and
+he implemented pthreads (wow!) and his now writing a dynamic linker, and
+he ported the diet libc to S/390.
+
+Thomas Ogrisegg ported the diet libc to PA-RISC and IA64 and fixed a few things.
+
+I initially took some syscalls from Redhat minilibc, but the code has
+been completely replaced now.
+
+I initially took localtime and the directory reading routines from
+uClibc, but the code has been completely replaced now.
+
+syslog and crypt were contributed by René Müller.
+
+Jeff Garzik contributed {get,set}{pw,gr,sp}ent.
+
+Uwe Ohse went through the code and fixed many bugs.
+
+Frank Klemm contributed the math library and a lot of correctness and
+smallness patches and rewrote many functions in ix86 assembly language.
+
+Erik Troan found several important bugs and sent in patches to fix them.
+
+I also grabbed code from glibc (mostly assembly routines), and looked at
+the OpenBSD libc for inspiration.
+
+Michal Ludvig did the porting to x86_64 and Gwenole Beauchesne helped
+finish the port.
+
+Johannes Stezenbach improved the MIPS port.
diff --git a/mdk-stage1/dietlibc/TODO b/mdk-stage1/dietlibc/TODO
new file mode 100644
index 000000000..3e323ad44
--- /dev/null
+++ b/mdk-stage1/dietlibc/TODO
@@ -0,0 +1,26 @@
+ - "locale"
+ - real regerror
+ - improve code size and quality with __restrict__.
+ - FPU exception handling (for mawk)
+ - res_mkquery should not assume op is QUERY
+ - syslog
+ - gethost/netent -> parselib?
+ - Look at qsort (the make test suite exhibits the worst case)
+ - Make __dtostr do scientific notation.
+ - fix %g in printf. They are more or less completely b0rken (in
+ particular rounding the last digit does not work).
+ - qmail-queue dumps core since we added vfork. Editing fork.h to #define
+ vfork to fork works. What happens here?
+ - use TCP if buf[2]&2 is non-zero in DNS answers.
+ - look at mktime: "Falls tm_isdst == -1 gesetzt, so sollte mktime
+ versuchen herauszufinden, ob Sommerzeit eingestellt ist (und laut linux
+ manpage auch tzname setzen), ansonsten die angegebene DST
+ berücksichtigen."
+ - better rand()?
+ - try to make zebra compile.
+ - printf %e
+ - move DNS stuff to libresolv.a?
+ - x86_64: readdir fails their test (Gwenole Beauchesne)
+ - regular expressions standards compliance; test suite from AT&T
+ - fgetpwent (needed for cvm)
+ - investigate putting some libgcc symbols in dietlibc.so for gcc<3
diff --git a/mdk-stage1/dietlibc/alpha/Makefile.add b/mdk-stage1/dietlibc/alpha/Makefile.add
index 10ff0faef..68b10b43c 100644
--- a/mdk-stage1/dietlibc/alpha/Makefile.add
+++ b/mdk-stage1/dietlibc/alpha/Makefile.add
@@ -2,4 +2,4 @@
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)
+LIBOBJ+=$(patsubst %,$(OBJDIR)/%,divq.o divl.o remq.o reml.o __time.o __alarm.o)
diff --git a/mdk-stage1/dietlibc/alpha/__alarm.c b/mdk-stage1/dietlibc/alpha/__alarm.c
new file mode 100644
index 000000000..7ca35cb78
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/__alarm.c
@@ -0,0 +1,13 @@
+#include <unistd.h>
+#include <sys/time.h>
+
+unsigned int alarm(unsigned int seconds) {
+ struct itimerval old, new;
+ unsigned int ret;
+ new.it_interval.tv_usec=0;
+ new.it_interval.tv_sec=0;
+ new.it_value.tv_usec =0;
+ new.it_value.tv_sec =(long)seconds;
+ if (setitimer(ITIMER_REAL,&new,&old)==-1) return 0;
+ return old.it_value.tv_sec+(old.it_value.tv_usec?1:0);
+}
diff --git a/mdk-stage1/dietlibc/alpha/__longjmp.S b/mdk-stage1/dietlibc/alpha/__longjmp.S
index d86d76717..31e374d0f 100644
--- a/mdk-stage1/dietlibc/alpha/__longjmp.S
+++ b/mdk-stage1/dietlibc/alpha/__longjmp.S
@@ -1,11 +1,10 @@
-#ifdef __alpha__
-
#include <setjmp.h>
.text
.align 2
.global __longjmp
+.type __longjmp,@function
__longjmp:
mov $17, $0 /* a1 -> v0 */
@@ -18,7 +17,7 @@ __longjmp:
ldq $26, (JB_PC*8) ($16) /* ra */
ldq $fp, (JB_FP*8) ($16) /* fp */
- ldq $1, (JB_SP*8) ($16) /* sp */
+ ldq $sp, (JB_SP*8) ($16) /* sp */
ldt $f2, (JB_F2*8) ($16) /* f2 */
ldt $f3, (JB_F3*8) ($16) /* f3 */
@@ -30,9 +29,5 @@ __longjmp:
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/__testandset.S b/mdk-stage1/dietlibc/alpha/__testandset.S
new file mode 100644
index 000000000..c5ef81241
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/__testandset.S
@@ -0,0 +1,11 @@
+.text
+.align 2
+.global __testandsets
+.type __testandsets,@function
+__testandset:
+ ldq_l $0, 0($16) /* load lock */
+ bne $0,1f /* ok there is a lock... */
+ lda $0, 1($31) /* load a 1 to register 0 */
+ stq_c $0, 0($16) /* write lock is locked :) */
+ beq $0,__testandset /* oops someone changed MY lock */
+1: ret $31, ($26), 0x01 /* return */
diff --git a/mdk-stage1/dietlibc/alpha/clone.S b/mdk-stage1/dietlibc/alpha/clone.S
index b7e32d707..28e61a8bc 100644
--- a/mdk-stage1/dietlibc/alpha/clone.S
+++ b/mdk-stage1/dietlibc/alpha/clone.S
@@ -1,5 +1,5 @@
#include "syscalls.h"
-#include <asm/errno.h>
+#include <errno.h>
.text
.align 2
diff --git a/mdk-stage1/dietlibc/alpha/errlist.S b/mdk-stage1/dietlibc/alpha/errlist.S
new file mode 100644
index 000000000..a5956ce05
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/errlist.S
@@ -0,0 +1,288 @@
+#ifdef __DYN_LIB
+.section .data
+#else
+.section .rodata
+#endif
+
+.align 8
+.global sys_errlist
+.type sys_errlist,@object
+
+sys_errlist:
+ .quad .LC000
+ .quad .LC001
+ .quad .LC002
+ .quad .LC003
+ .quad .LC004
+ .quad .LC005
+ .quad .LC006
+ .quad .LC007
+ .quad .LC008
+ .quad .LC009
+ .quad .LC010
+ .quad .LC011
+ .quad .LC012
+ .quad .LC013
+ .quad .LC014
+ .quad .LC015
+ .quad .LC016
+ .quad .LC017
+ .quad .LC018
+ .quad .LC019
+ .quad .LC020
+ .quad .LC021
+ .quad .LC022
+ .quad .LC023
+ .quad .LC024
+ .quad .LC025
+ .quad .LC026
+ .quad .LC027
+ .quad .LC028
+ .quad .LC029
+ .quad .LC030
+ .quad .LC031
+ .quad .LC032
+ .quad .LC033
+ .quad .LC034
+ .quad .LC035
+ .quad .LC036
+ .quad .LC037
+ .quad .LC038
+ .quad .LC039
+ .quad .LC040
+ .quad .LC041
+ .quad .LC042
+ .quad .LC043
+ .quad .LC044
+ .quad .LC045
+ .quad .LC046
+ .quad .LC047
+ .quad .LC048
+ .quad .LC049
+ .quad .LC050
+ .quad .LC051
+ .quad .LC052
+ .quad .LC053
+ .quad .LC054
+ .quad .LC055
+ .quad .LC056
+ .quad .LC057
+ .quad .LC058
+ .quad .LC059
+ .quad .LC060
+ .quad .LC061
+ .quad .LC062
+ .quad .LC063
+ .quad .LC064
+ .quad .LC065
+ .quad .LC066
+ .quad .LC067
+ .quad .LC068
+ .quad .LC069
+ .quad .LC070
+ .quad .LC071
+ .quad .LC072
+ .quad .LC073
+ .quad .LC074
+ .quad .LC075
+ .quad .LC076
+ .quad .LC077
+ .quad .LC078
+ .quad .LC079
+ .quad .LC080
+ .quad .LC081
+ .quad .LC082
+ .quad .LC083
+ .quad .LC084
+ .quad .LC085
+ .quad .LC086
+ .quad .LC087
+ .quad .LC088
+ .quad .LC089
+ .quad .LC090
+ .quad .LC091
+ .quad .LC092
+ .quad .LC093
+ .quad .LC094
+ .quad .LC095
+ .quad .LC096
+ .quad .LC097
+ .quad .LC098
+ .quad .LC099
+ .quad .LC100
+ .quad .LC101
+ .quad .LC102
+ .quad .LC103
+ .quad .LC104
+ .quad .LC105
+ .quad .LC106
+ .quad .LC107
+ .quad .LC108
+ .quad .LC109
+ .quad .LC110
+ .quad .LC111
+ .quad .LC112
+ .quad .LC113
+ .quad .LC114
+ .quad .LC115
+ .quad .LC116
+ .quad .LC117
+ .quad .LC118
+ .quad .LC119
+ .quad .LC120
+ .quad .LC121
+ .quad .LC122
+ .quad .LC123
+ .quad .LC124
+ .quad .LC125
+ .quad .LC126
+ .quad .LC127
+ .quad .LC128
+ .quad .LC129
+ .quad .LC130
+ .quad 0
+.size sys_errlist,.-sys_errlist
+
+.align 4
+.global sys_nerr
+.type sys_nerr,@object
+sys_nerr:
+ .long 130
+.size sys_nerr,4
+
+#ifdef __DYN_LIB
+.section .rodata
+#endif
+
+.LC000: .string "Success"
+.LC001: .string "Operation not permitted"
+.LC002: .string "No such file or directory"
+.LC003: .string "No such process"
+.LC004: .string "Interrupted system call"
+.LC005: .string "I/O error"
+.LC006: .string "No such device or address"
+.LC007: .string "Arg list too long"
+.LC008: .string "Exec format error"
+.LC009: .string "Bad file number"
+.LC010: .string "No child processes"
+.LC011: .string "Resource deadlock would occur"
+.LC012: .string "Out of memory"
+.LC013: .string "Permission denied"
+.LC014: .string "Bad address"
+.LC015: .string "Block device required"
+.LC016: .string "Device or resource busy"
+.LC017: .string "File exists"
+.LC018: .string "Cross-device link"
+.LC019: .string "No such device"
+.LC020: .string "Not a directory"
+.LC021: .string "Is a directory"
+.LC022: .string "Invalid argument"
+.LC023: .string "File table overflow"
+.LC024: .string "Too many open files"
+.LC025: .string "Not a typewriter"
+.LC026: .string "Text file busy"
+.LC027: .string "File too large"
+.LC028: .string "No space left on device"
+.LC029: .string "Illegal seek"
+.LC030: .string "Read-only file system"
+.LC031: .string "Too many links"
+.LC032: .string "Broken pipe"
+.LC033: .string "Math argument out of domain of func"
+.LC034: .string "Math result not representable"
+.LC035: .string "Try again"
+.LC036: .string "Operation now in progress"
+.LC037: .string "Operation already in progress"
+.LC038: .string "Socket operation on non-socket"
+.LC039: .string "Destination address required"
+.LC040: .string "Message too long"
+.LC041: .string "Protocol wrong type for socket"
+.LC042: .string "Protocol not available"
+.LC043: .string "Protocol not supported"
+.LC044: .string "Socket type not supported"
+.LC045: .string "Operation not supported on transport endpoint"
+.LC046: .string "Protocol family not supported"
+.LC047: .string "Address family not supported by protocol"
+.LC048: .string "Address already in use"
+.LC049: .string "Cannot assign requested address"
+.LC050: .string "Network is down"
+.LC051: .string "Network is unreachable"
+.LC052: .string "Network dropped connection because of reset"
+.LC053: .string "Software caused connection abort"
+.LC054: .string "Connection reset by peer"
+.LC055: .string "No buffer space available"
+.LC056: .string "Transport endpoint is already connected"
+.LC057: .string "Transport endpoint is not connected"
+.LC058: .string "Cannot send after transport endpoint shutdown"
+.LC059: .string "Too many references: cannot splice"
+.LC060: .string "Connection timed out"
+.LC061: .string "Connection refused"
+.LC062: .string "Too many symbolic links encountered"
+.LC063: .string "File name too long"
+.LC064: .string "Host is down"
+.LC065: .string "No route to host"
+.LC066: .string "Directory not empty"
+.LC067: .string "Error 67"
+.LC068: .string "Too many users"
+.LC069: .string "Quota exceeded"
+.LC070: .string "Stale NFS file handle"
+.LC071: .string "Object is remote"
+.LC072: .string "Error 72"
+.LC073: .string "Error 73"
+.LC074: .string "Error 74"
+.LC075: .string "Error 75"
+.LC076: .string "Error 76"
+.LC077: .string "No record locks available"
+.LC078: .string "Function not implemented"
+.LC079: .string "Error 79"
+.LC080: .string "No message of desired type"
+.LC081: .string "Identifier removed"
+.LC082: .string "Out of streams resources"
+.LC083: .string "Timer expired"
+.LC084: .string "Not a data message"
+.LC085: .string "Protocol error"
+.LC086: .string "No data available"
+.LC087: .string "Device not a stream"
+.LC088: .string "Channel number out of range"
+.LC089: .string "Level 2 not synchronized"
+.LC090: .string "Level 3 halted"
+.LC091: .string "Level 3 reset"
+.LC092: .string "Package not installed"
+.LC093: .string "Link number out of range"
+.LC094: .string "Protocol driver not attached"
+.LC095: .string "No CSI structure available"
+.LC096: .string "Level 2 halted"
+.LC097: .string "Invalid exchange"
+.LC098: .string "Invalid request descriptor"
+.LC099: .string "Exchange full"
+.LC100: .string "No anode"
+.LC101: .string "Invalid request code"
+.LC102: .string "Invalid slot"
+.LC103: .string "Error 103"
+.LC104: .string "Bad font file format"
+.LC105: .string "Machine is not on the network"
+.LC106: .string "Link has been severed"
+.LC107: .string "Advertise error"
+.LC108: .string "Srmount error"
+.LC109: .string "Communication error on send"
+.LC110: .string "Multihop attempted"
+.LC111: .string "RFS specific error"
+.LC112: .string "Value too large for defined data type"
+.LC113: .string "Name not unique on network"
+.LC114: .string "File descriptor in bad state"
+.LC115: .string "Remote address changed"
+.LC116: .string "Illegal byte sequence"
+.LC117: .string "Structure needs cleaning"
+.LC118: .string "Not a XENIX named type file"
+.LC119: .string "No XENIX semaphores available"
+.LC120: .string "Is a named type file"
+.LC121: .string "Remote I/O error"
+.LC122: .string "Can not access a needed shared library"
+.LC123: .string "Accessing a corrupted shared library"
+.LC124: .string ".lib section in a.out corrupted"
+.LC125: .string "Attempting to link in too many shared libraries"
+.LC126: .string "Cannot exec a shared library directly"
+.LC127: .string "Interrupted system call should be restarted"
+.LC128: .string "Streams pipe error"
+.LC129: .string "No medium found"
+.LC130: .string "Wrong medium type"
+
diff --git a/mdk-stage1/dietlibc/alpha/lseek64.S b/mdk-stage1/dietlibc/alpha/lseek64.S
new file mode 100644
index 000000000..f051e734d
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/lseek64.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+.global lseek64
+lseek64:
+ br lseek
diff --git a/mdk-stage1/dietlibc/alpha/n_sigprocmask.S b/mdk-stage1/dietlibc/alpha/n_sigprocmask.S
new file mode 100644
index 000000000..55f9fde28
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/n_sigprocmask.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall_weak(osf_sigprocmask,__old_sigprocmask,__n_sigprocmask)
diff --git a/mdk-stage1/dietlibc/alpha/setjmp.S b/mdk-stage1/dietlibc/alpha/setjmp.S
index 3768056be..04bfd3d94 100644
--- a/mdk-stage1/dietlibc/alpha/setjmp.S
+++ b/mdk-stage1/dietlibc/alpha/setjmp.S
@@ -1,15 +1,16 @@
#include <setjmp.h>
.text
+.weak setjmp
+.type setjmp,@function
+setjmp:
+.weak __setjmp
+.type __setjmp,@function
+__setjmp:
+ mov 0, $17
.global __sigsetjmp
+.type __sigsetjmp,@function
__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 */
@@ -19,7 +20,7 @@ __sigsetjmp:
stq $26, (JB_PC*8) ($16) /* ra */
stq $fp, (JB_FP*8) ($16) /* fp */
- stq $1, (JB_SP*8) ($16) /* sp */
+ stq $sp, (JB_SP*8) ($16) /* sp */
stt $f2, (JB_F2*8) ($16) /* f2 */
stt $f3, (JB_F3*8) ($16) /* f3 */
@@ -30,17 +31,5 @@ __sigsetjmp:
stt $f8, (JB_F8*8) ($16) /* f8 */
stt $f9, (JB_F9*8) ($16) /* f9 */
- br $26, __sigjmp_save /* call __sigjmp_save */
+ br $31, __sigjmp_save /* jmp __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/sigaction.c b/mdk-stage1/dietlibc/alpha/sigaction.c
new file mode 100644
index 000000000..f6c3ada7d
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/sigaction.c
@@ -0,0 +1,7 @@
+#include <signal.h>
+
+int __rt_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact, long nr, void* restorer);
+
+int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
+ return __rt_sigaction(signum, act, oldact, _NSIG/8, 0);
+}
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/socketpair.S b/mdk-stage1/dietlibc/alpha/socketpair.S
new file mode 100644
index 000000000..06956a7ce
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/socketpair.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(socketpair,socketpair)
diff --git a/mdk-stage1/dietlibc/alpha/start.S b/mdk-stage1/dietlibc/alpha/start.S
index 00b8e950d..850ce2420 100644
--- a/mdk-stage1/dietlibc/alpha/start.S
+++ b/mdk-stage1/dietlibc/alpha/start.S
@@ -1,7 +1,3 @@
-#include "start.h"
-
-#ifdef __alpha__
-
.text
.align 2
.set noreorder
@@ -17,19 +13,21 @@ _start:
ldgp $gp, 0($gp)
/* prepare to call main */
- ldl $16, 0($sp) /* argc */
+ ldl $16, 0($sp) /* argc / a0 */
- lda $17, 8($sp) /* argv */
+ lda $17, 8($sp) /* argv / a1 */
- addq $16, 1, $18 /* argp */
+ addq $16, 1, $18 /* argp / a2 */
s8addq $18, $17, $18 /* (8*(argc+1))+argv -> argp */
stq $18, environ
- mov $0, $21 /* mov v0(dynload) to a5 */
-
+#ifdef WANT_DYNAMIC
+/* in v0 ($0) is the ld.so _fini pointer */
+ mov $0, $19 /* mov v0(dynload) to a3 */
+ jsr $26, dyn_start
+#else
jsr $26, main
+#endif
mov $0, $16
jsr $26, exit /* YES, CALL! for threads and atexit ! (+4 byte) */
-
-#endif
diff --git a/mdk-stage1/dietlibc/alpha/syscalls.h b/mdk-stage1/dietlibc/alpha/syscalls.h
new file mode 100644
index 000000000..5c654b4bf
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/syscalls.h
@@ -0,0 +1,371 @@
+
+#define __NR_osf_syscall 0 /* not implemented */
+#define __NR_exit 1
+#define __NR_fork 2
+#define __NR_read 3
+#define __NR_write 4
+#define __NR_osf_old_open 5 /* not implemented */
+#define __NR_close 6
+#define __NR_osf_wait4 7
+#define __NR_osf_old_creat 8 /* not implemented */
+#define __NR_link 9
+#define __NR_unlink 10
+#define __NR_osf_execve 11 /* not implemented */
+#define __NR_chdir 12
+#define __NR_fchdir 13
+#define __NR_mknod 14
+#define __NR_chmod 15
+#define __NR_chown 16
+#define __NR_brk 17
+#define __NR_osf_getfsstat 18 /* not implemented */
+#define __NR_lseek 19
+#define __NR_getxpid 20
+#define __NR_osf_mount 21
+#define __NR_umount 22
+#define __NR_setuid 23
+#define __NR_getxuid 24
+#define __NR_exec_with_loader 25 /* not implemented */
+#define __NR_ptrace 26
+#define __NR_osf_nrecvmsg 27 /* not implemented */
+#define __NR_osf_nsendmsg 28 /* not implemented */
+#define __NR_osf_nrecvfrom 29 /* not implemented */
+#define __NR_osf_naccept 30 /* not implemented */
+#define __NR_osf_ngetpeername 31 /* not implemented */
+#define __NR_osf_ngetsockname 32 /* not implemented */
+#define __NR_access 33
+#define __NR_osf_chflags 34 /* not implemented */
+#define __NR_osf_fchflags 35 /* not implemented */
+#define __NR_sync 36
+#define __NR_kill 37
+#define __NR_osf_old_stat 38 /* not implemented */
+#define __NR_setpgid 39
+#define __NR_osf_old_lstat 40 /* not implemented */
+#define __NR_dup 41
+#define __NR_pipe 42
+#define __NR_osf_set_program_attributes 43
+#define __NR_osf_profil 44 /* not implemented */
+#define __NR_open 45
+#define __NR_osf_old_sigaction 46 /* not implemented */
+#define __NR_getxgid 47
+#define __NR_osf_sigprocmask 48
+#define __NR_osf_getlogin 49 /* not implemented */
+#define __NR_osf_setlogin 50 /* not implemented */
+#define __NR_acct 51
+#define __NR_sigpending 52
+
+#define __NR_ioctl 54
+#define __NR_osf_reboot 55 /* not implemented */
+#define __NR_osf_revoke 56 /* not implemented */
+#define __NR_symlink 57
+#define __NR_readlink 58
+#define __NR_execve 59
+#define __NR_umask 60
+#define __NR_chroot 61
+#define __NR_osf_old_fstat 62 /* not implemented */
+#define __NR_getpgrp 63
+#define __NR_getpagesize 64
+#define __NR_osf_mremap 65 /* not implemented */
+#define __NR_vfork 66
+#define __NR_stat 67
+#define __NR_lstat 68
+#define __NR_osf_sbrk 69 /* not implemented */
+#define __NR_osf_sstk 70 /* not implemented */
+#define __NR_mmap 71 /* OSF/1 mmap is superset of Linux */
+#define __NR_osf_old_vadvise 72 /* not implemented */
+#define __NR_munmap 73
+#define __NR_mprotect 74
+#define __NR_madvise 75
+#define __NR_vhangup 76
+#define __NR_osf_kmodcall 77 /* not implemented */
+#define __NR_osf_mincore 78 /* not implemented */
+#define __NR_getgroups 79
+#define __NR_setgroups 80
+#define __NR_osf_old_getpgrp 81 /* not implemented */
+#define __NR_setpgrp 82 /* BSD alias for setpgid */
+#define __NR_osf_setitimer 83
+#define __NR_osf_old_wait 84 /* not implemented */
+#define __NR_osf_table 85 /* not implemented */
+#define __NR_osf_getitimer 86
+#define __NR_gethostname 87
+#define __NR_sethostname 88
+#define __NR_getdtablesize 89
+#define __NR_dup2 90
+#define __NR_fstat 91
+#define __NR_fcntl 92
+#define __NR_osf_select 93
+#define __NR_poll 94
+#define __NR_fsync 95
+#define __NR_setpriority 96
+#define __NR_socket 97
+#define __NR_connect 98
+#define __NR_accept 99
+#define __NR_getpriority 100
+#define __NR_send 101
+#define __NR_recv 102
+#define __NR_sigreturn 103
+#define __NR_bind 104
+#define __NR_setsockopt 105
+#define __NR_listen 106
+#define __NR_osf_plock 107 /* not implemented */
+#define __NR_osf_old_sigvec 108 /* not implemented */
+#define __NR_osf_old_sigblock 109 /* not implemented */
+#define __NR_osf_old_sigsetmask 110 /* not implemented */
+#define __NR_sigsuspend 111
+#define __NR_osf_sigstack 112
+#define __NR_recvmsg 113
+#define __NR_sendmsg 114
+#define __NR_osf_old_vtrace 115 /* not implemented */
+#define __NR_osf_gettimeofday 116
+#define __NR_osf_getrusage 117
+#define __NR_getsockopt 118
+
+#define __NR_readv 120
+#define __NR_writev 121
+#define __NR_osf_settimeofday 122
+#define __NR_fchown 123
+#define __NR_fchmod 124
+#define __NR_recvfrom 125
+#define __NR_setreuid 126
+#define __NR_setregid 127
+#define __NR_rename 128
+#define __NR_truncate 129
+#define __NR_ftruncate 130
+#define __NR_flock 131
+#define __NR_setgid 132
+#define __NR_sendto 133
+#define __NR_shutdown 134
+#define __NR_socketpair 135
+#define __NR_mkdir 136
+#define __NR_rmdir 137
+#define __NR_osf_utimes 138
+#define __NR_osf_old_sigreturn 139 /* not implemented */
+#define __NR_osf_adjtime 140 /* not implemented */
+#define __NR_getpeername 141
+#define __NR_osf_gethostid 142 /* not implemented */
+#define __NR_osf_sethostid 143 /* not implemented */
+#define __NR_getrlimit 144
+#define __NR_setrlimit 145
+#define __NR_osf_old_killpg 146 /* not implemented */
+#define __NR_setsid 147
+#define __NR_quotactl 148
+#define __NR_osf_oldquota 149 /* not implemented */
+#define __NR_getsockname 150
+
+#define __NR_osf_pid_block 153 /* not implemented */
+#define __NR_osf_pid_unblock 154 /* not implemented */
+
+#define __NR_sigaction 156
+#define __NR_osf_sigwaitprim 157 /* not implemented */
+#define __NR_osf_nfssvc 158 /* not implemented */
+#define __NR_osf_getdirentries 159
+#define __NR_osf_statfs 160
+#define __NR_osf_fstatfs 161
+
+#define __NR_osf_asynch_daemon 163 /* not implemented */
+#define __NR_osf_getfh 164 /* not implemented */
+#define __NR_osf_getdomainname 165
+#define __NR_setdomainname 166
+
+#define __NR_osf_exportfs 169 /* not implemented */
+
+#define __NR_osf_alt_plock 181 /* not implemented */
+
+#define __NR_osf_getmnt 184 /* not implemented */
+
+#define __NR_osf_alt_sigpending 187 /* not implemented */
+#define __NR_osf_alt_setsid 188 /* not implemented */
+
+#define __NR_osf_swapon 199
+#define __NR_msgctl 200
+#define __NR_msgget 201
+#define __NR_msgrcv 202
+#define __NR_msgsnd 203
+#define __NR_semctl 204
+#define __NR_semget 205
+#define __NR_semop 206
+#define __NR_osf_utsname 207
+#define __NR_lchown 208
+#define __NR_osf_shmat 209
+#define __NR_shmctl 210
+#define __NR_shmdt 211
+#define __NR_shmget 212
+#define __NR_osf_mvalid 213 /* not implemented */
+#define __NR_osf_getaddressconf 214 /* not implemented */
+#define __NR_osf_msleep 215 /* not implemented */
+#define __NR_osf_mwakeup 216 /* not implemented */
+#define __NR_msync 217
+#define __NR_osf_signal 218 /* not implemented */
+#define __NR_osf_utc_gettime 219 /* not implemented */
+#define __NR_osf_utc_adjtime 220 /* not implemented */
+
+#define __NR_osf_security 222 /* not implemented */
+#define __NR_osf_kloadcall 223 /* not implemented */
+
+#define __NR_getpgid 233
+#define __NR_getsid 234
+#define __NR_sigaltstack 235
+#define __NR_osf_waitid 236 /* not implemented */
+#define __NR_osf_priocntlset 237 /* not implemented */
+#define __NR_osf_sigsendset 238 /* not implemented */
+#define __NR_osf_set_speculative 239 /* not implemented */
+#define __NR_osf_msfs_syscall 240 /* not implemented */
+#define __NR_osf_sysinfo 241
+#define __NR_osf_uadmin 242 /* not implemented */
+#define __NR_osf_fuser 243 /* not implemented */
+#define __NR_osf_proplist_syscall 244
+#define __NR_osf_ntp_adjtime 245 /* not implemented */
+#define __NR_osf_ntp_gettime 246 /* not implemented */
+#define __NR_osf_pathconf 247 /* not implemented */
+#define __NR_osf_fpathconf 248 /* not implemented */
+
+#define __NR_osf_uswitch 250 /* not implemented */
+#define __NR_osf_usleep_thread 251
+#define __NR_osf_audcntl 252 /* not implemented */
+#define __NR_osf_audgen 253 /* not implemented */
+#define __NR_sysfs 254
+#define __NR_osf_subsys_info 255 /* not implemented */
+#define __NR_osf_getsysinfo 256
+#define __NR_osf_setsysinfo 257
+#define __NR_osf_afs_syscall 258 /* not implemented */
+#define __NR_osf_swapctl 259 /* not implemented */
+#define __NR_osf_memcntl 260 /* not implemented */
+#define __NR_osf_fdatasync 261 /* not implemented */
+
+
+/*
+ * Linux-specific system calls begin at 300
+ */
+#define __NR_bdflush 300
+#define __NR_sethae 301
+#define __NR_mount 302
+#define __NR_old_adjtimex 303
+#define __NR_swapoff 304
+#define __NR_getdents 305
+#define __NR_create_module 306
+#define __NR_init_module 307
+#define __NR_delete_module 308
+#define __NR_get_kernel_syms 309
+#define __NR_syslog 310
+#define __NR_reboot 311
+#define __NR_clone 312
+#define __NR_uselib 313
+#define __NR_mlock 314
+#define __NR_munlock 315
+#define __NR_mlockall 316
+#define __NR_munlockall 317
+#define __NR_sysinfo 318
+#define __NR__sysctl 319
+/* 320 was sys_idle. */
+#define __NR_oldumount 321
+#define __NR_swapon 322
+#define __NR_times 323
+#define __NR_personality 324
+#define __NR_setfsuid 325
+#define __NR_setfsgid 326
+#define __NR_ustat 327
+#define __NR_statfs 328
+#define __NR_fstatfs 329
+#define __NR_sched_setparam 330
+#define __NR_sched_getparam 331
+#define __NR_sched_setscheduler 332
+#define __NR_sched_getscheduler 333
+#define __NR_sched_yield 334
+#define __NR_sched_get_priority_max 335
+#define __NR_sched_get_priority_min 336
+#define __NR_sched_rr_get_interval 337
+#define __NR_afs_syscall 338
+#define __NR_uname 339
+#define __NR_nanosleep 340
+#define __NR_mremap 341
+#define __NR_nfsservctl 342
+#define __NR_setresuid 343
+#define __NR_getresuid 344
+#define __NR_pciconfig_read 345
+#define __NR_pciconfig_write 346
+#define __NR_query_module 347
+#define __NR_prctl 348
+#define __NR_pread 349
+#define __NR_pwrite 350
+#define __NR_rt_sigreturn 351
+#define __NR_rt_sigaction 352
+#define __NR_rt_sigprocmask 353
+#define __NR_rt_sigpending 354
+#define __NR_rt_sigtimedwait 355
+#define __NR_rt_sigqueueinfo 356
+#define __NR_rt_sigsuspend 357
+#define __NR_select 358
+#define __NR_gettimeofday 359
+#define __NR_settimeofday 360
+#define __NR_getitimer 361
+#define __NR_setitimer 362
+#define __NR_utimes 363
+#define __NR_getrusage 364
+#define __NR_wait4 365
+#define __NR_adjtimex 366
+#define __NR_getcwd 367
+#define __NR_capget 368
+#define __NR_capset 369
+#define __NR_sendfile 370
+#define __NR_setresgid 371
+#define __NR_getresgid 372
+#define __NR_dipc 373
+#define __NR_pivot_root 374
+#define __NR_mincore 375
+#define __NR_pciconfig_iobase 376
+#define __NR_getdents64 377
+#define __NR_gettid 378
+#define __NR_readahead 379
+#define __NR_security 380 /* syscall for security modules */
+#define __NR_tkill 381
+#define __NR_setxattr 382
+#define __NR_lsetxattr 383
+#define __NR_fsetxattr 384
+#define __NR_getxattr 385
+#define __NR_lgetxattr 386
+#define __NR_fgetxattr 387
+#define __NR_listxattr 388
+#define __NR_llistxattr 389
+#define __NR_flistxattr 390
+#define __NR_removexattr 391
+#define __NR_lremovexattr 392
+#define __NR_fremovexattr 393
+#define __NR_futex 394
+#define __NR_sched_setaffinity 395
+#define __NR_sched_getaffinity 396
+#define __NR_tuxcall 397
+#define __NR_io_setup 398
+#define __NR_io_destroy 399
+#define __NR_io_getevents 400
+#define __NR_io_submit 401
+#define __NR_io_cancel 402
+#define __NR_alloc_hugepages 403
+#define __NR_free_hugepages 404
+#define __NR_exit_group 405
+#define __NR_lookup_dcookie 406
+#define __NR_sys_epoll_create 407
+#define __NR_sys_epoll_ctl 408
+#define __NR_sys_epoll_wait 409
+#define __NR_remap_file_pages 410
+#define __NR_set_tid_address 411
+
+#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
+
diff --git a/mdk-stage1/dietlibc/alpha/unified.S b/mdk-stage1/dietlibc/alpha/unified.S
index 02a1c9bcd..506bf7387 100644
--- a/mdk-stage1/dietlibc/alpha/unified.S
+++ b/mdk-stage1/dietlibc/alpha/unified.S
@@ -1,15 +1,25 @@
#include <dietfeatures.h>
+#include "syscalls.h"
+.weak exit
+exit:
+.global _exit
+_exit:
+ lda $0, __NR_exit
.global __unified_syscall
__unified_syscall:
callsys
bne $19, .Lerror
+
+/* here we go and "reuse" the return for weak-void functions */
+#include "dietuglyweaks.h"
+
ret $31, ($26), 0x01
.Lerror:
.global error_unified_syscall
error_unified_syscall:
-#ifdef WANT_THREAD_SAVE
+#ifdef WANT_THREAD_SAFE
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 */
diff --git a/mdk-stage1/dietlibc/binshstr.h b/mdk-stage1/dietlibc/binshstr.h
new file mode 100644
index 000000000..f1bf789fe
--- /dev/null
+++ b/mdk-stage1/dietlibc/binshstr.h
@@ -0,0 +1,6 @@
+
+extern const char __binsh [8];
+
+#define __sh (__binsh + 5 )
+
+/* end of binshstr.h */
diff --git a/mdk-stage1/dietlibc/diet.1 b/mdk-stage1/dietlibc/diet.1
new file mode 100644
index 000000000..c28aeba40
--- /dev/null
+++ b/mdk-stage1/dietlibc/diet.1
@@ -0,0 +1,31 @@
+.TH diet 1 "April 2001"
+.SH NAME
+.PP
+diet \- mangle gcc command line arguments
+.SH SYNOPSIS
+.PP
+.B diet [-v] [-Os]
+[\fInormal gcc command line\fP]
+.SH DESCRIPTION
+.PP
+diet is a small wrapper around gcc. It will try to look at the command
+line you specify and try to mangle it so that gcc will compile against
+the diet libc header files and link against the diet libc itself.
+
+diet tries to be smart for cross compiling. If the first argument is
+not gcc but sparc-linux-gcc, diet will guess that you want to cross
+compile for sparc and use bin-sparc/dietlibc.a instead of the dietlibc.a
+for your default architecture.
+
+The -v option will make diet print the modified gcc command line before
+executing it.
+
+When passed the -Os option before the gcc argument, diet will mangle the
+gcc options to include the best known for-size optimization settings for
+the platform.
+.SH FILES
+~/.diet/\fIcompiler\fR may contain compiler options as you would
+specify them on the command line, i.e. separated by spaces. Those will
+then be used instead of the built-in defaults for diet -Os.
+.SH AUTHOR
+Felix von Leitner <felix-dietlibc@fefe.de>
diff --git a/mdk-stage1/dietlibc/diet.c b/mdk-stage1/dietlibc/diet.c
index 1de6befc8..c3a053ac8 100644
--- a/mdk-stage1/dietlibc/diet.c
+++ b/mdk-stage1/dietlibc/diet.c
@@ -1,7 +1,11 @@
#include <string.h>
#include <unistd.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <write12.h>
+
+#include "dietfeatures.h"
/* goal:
* when invoked as
@@ -15,90 +19,341 @@
* "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));
+static void error(const char *message) {
+ __write2(message);
exit(1);
}
+static const char* Os[] = {
+ "i386","-Os","-mpreferred-stack-boundary=2",
+ "-malign-functions=0","-malign-jumps=0",
+ "-malign-loops=0","-fomit-frame-pointer",0,
+ "x86_64","-Os","-fno-omit-frame-pointer",0,
+ "sparc","-Os","-mcpu=supersparc",0,
+ "sparc64","-Os","-m64",0,
+ "alpha","-Os","-fomit-frame-pointer",0,
+ "arm","-Os","-fomit-frame-pointer",0,
+ "mips","-Os","-fomit-frame-pointer","-mno-abicalls","-G","8","-fno-pic",0,
+ "ppc","-Os","-fomit-frame-pointer","-mpowerpc-gpopt","-mpowerpc-gfxopt",0,
+ "s390","-Os","-fomit-frame-pointer",0,
+ "sh","-Os","-fomit-frame-pointer",0,
+ "ia64","-Os","-fno-omit-frame-pointer",0,
+ "x86_64","-Os","-fstrict-aliasing","-momit-leaf-frame-pointer","-mfance-math-387",0,
+ 0};
+
int main(int argc,char *argv[]) {
- int link=0;
+ int _link=0;
int compile=0;
+ int preprocess=0;
+ int verbose=0;
+ int profile=0;
char diethome[]=DIETHOME;
- char platform[1000]=DIETHOME "/bin-";
- char *nostdlib="-nostdlib";
- char *libgcc="-lgcc";
- char dashL[1000]="-L";
+ char platform[1000];
+#ifdef __DYN_LIB
+ int shared=0;
+#endif
+ char* shortplatform=0;
+#ifdef WANT_SAFEGUARD
+ char safeguard1[]="-include";
+ char safeguard2[]=DIETHOME "/include/dietref.h";
+#endif
+ const char *nostdlib="-nostdlib";
+ const char *libgcc="-lgcc";
+ char dashL[1000];
+ char dashstatic[]="-static";
int i;
+ int mangleopts=0;
+ char manglebuf[1024];
+
+#ifdef INSTALLVERSION
+ strcpy(platform,DIETHOME "/lib-");
+#else
+#ifndef __DYN_LIB
+ strcpy(platform,DIETHOME "/bin-");
+#else
+ strcpy(platform,DIETHOME "/pic-");
+#endif
+#endif
+ strcpy(dashL,"-L");
if (argc<2) {
- error("usage: diet [gcc command line]\n"
- "e.g. diet gcc -c t.c\n"
+usage:
+ if (verbose) {
+ __write2(
+#ifdef __DYN_LIB
+ "dyn-"
+#endif
+ "diet version " VERSION
+#ifndef INSTALLVERSION
+ " (non-install version in source tree)"
+#endif
+ "\n\n");
+ }
+ error("usage: diet [-v] [-Os] gcc command line\n"
+ "e.g. diet -Os gcc -c t.c\n"
"or diet sparc-linux-gcc -o foo foo.c bar.o\n");
}
+ if (!strcmp(argv[1],"-v")) {
+ ++argv; --argc;
+ verbose=1;
+ }
+ if (argv[1] && !strcmp(argv[1],"-Os")) {
+ ++argv; --argc;
+ mangleopts=1;
+ }
+ if (!argv[1]) goto usage;
{
char *tmp=strchr(argv[1],0)-2;
- char *tmp2;
+ char *tmp2,*tmp3;
char *cc=argv[1];
if (tmp<cc) goto donttouch;
- if ((tmp2=strchr(cc,'-'))) { /* cross compiling? */
+ if ((tmp2=strstr(cc,"linux-"))) { /* cross compiling? */
int len=strlen(platform);
+ --tmp2;
+ tmp3=strchr(cc,'-');
+ if (tmp3<tmp2) tmp2=tmp3;
if (tmp2-cc>90) error("platform name too long!\n");
- memmove(platform+len,argv[1],tmp2-cc);
+ shortplatform=platform+len;
+ memmove(shortplatform,argv[1],(size_t)(tmp2-cc));
platform[tmp2-cc+len]=0;
-/* printf("found platform %s\n",platform); */
+ if (shortplatform[0]=='i' && shortplatform[2]=='8' && shortplatform[3]=='6') shortplatform[1]='3';
} else {
#ifdef __sparc__
- strcat(platform,"sparc");
+#ifdef __arch64__
+ shortplatform="sparc64";
+#else
+ shortplatform="sparc";
#endif
-#ifdef __ppc__
- strcat(platform,"ppc");
+#endif
+#ifdef __powerpc__
+ shortplatform="ppc";
#endif
#ifdef __i386__
- strcat(platform,"i386");
+ shortplatform="i386";
#endif
#ifdef __alpha__
- strcat(platform,"alpha");
+ shortplatform="alpha";
#endif
#ifdef __arm__
- strcat(platform,"arm");
+ shortplatform="arm";
#endif
#ifdef __mips__
- strcat(platform,"mips");
+ shortplatform="mips";
+#endif
+#ifdef __s390__
+ shortplatform="s390";
+#endif
+#ifdef __sh__
+ shortplatform="sh";
+#endif
+#ifdef __hppa__
+ shortplatform="parisc";
+#endif
+#ifdef __x86_64__
+ shortplatform="x86_64";
+#endif
+#ifdef __ia64__
+ shortplatform="ia64";
#endif
+ {
+ char *tmp=platform+strlen(platform);
+ strcpy(tmp,shortplatform);
+ shortplatform=tmp;
+ }
+ }
+ /* MIPS needs special handling. If argv contains -EL, change
+ * platform name to mipsel */
+ if (!strcmp(shortplatform,"mips")) {
+ int i;
+ for (i=1; i<argc; ++i)
+ if (!strcmp(argv[i],"-EL"))
+ strcpy(shortplatform,"mipsel");
}
strcat(dashL,platform);
if (!strcmp(tmp,"cc")) {
char **newargv;
char **dest;
char *a,*b,*c;
+#ifdef WANT_DYNAMIC
+ char *d,*e,*f;
+#endif
/* 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"))
+ for (i=2; i<argc; ++i) {
+ if (argv[i][0]=='-' && argv[i][1]=='M')
+ goto pp;
+ if (!strcmp(argv[i],"-pg"))
+ profile=1;
+ if (!strcmp(argv[i],"-c") || !strcmp(argv[i],"-S"))
compile=1;
+ if (!strcmp(argv[i],"-E"))
+pp:
+ preprocess=compile=1;
+ }
/* we need to add -nostdlib if we are not compiling*/
- link=!compile;
+ _link=!compile;
+#ifdef __DYN_LIB
+ if (_link) {
+ for (i=2; i<argc; ++i)
+ if (!strcmp(argv[i],"-shared")) {
+ shared=1;
+ _link=0;
+ }
+ }
+#endif
#if 0
for (i=2; i<argc; ++i)
if (!strcmp(argv[i],"-o"))
- if (!compile) link=1;
+ if (!compile) _link=1;
#endif
- newargv=alloca(sizeof(char*)*(argc+6));
+ newargv=alloca(sizeof(char*)*(argc+100));
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");
+#ifndef __DYN_LIB
+ strcpy(b,platform);
+ if (profile) strcat(b,"/pstart.o"); else strcat(b,"/start.o");
+#ifdef INSTALLVERSION
+ strcpy(c,platform); strcat(c,"/libc.a");
+#else
strcpy(c,platform); strcat(c,"/dietlibc.a");
+#endif
+#else
+ strcpy(b,platform); strcat(b,"/dstart.o");
+ strcpy(c,"-lc");
+#endif
+
+#ifdef WANT_DYNAMIC
+ d=alloca(strlen(platform)+20);
+ e=alloca(strlen(platform)+20);
+#ifdef __DYN_LIB
+ strcpy(d,platform);
+ strcpy(e,platform);
+ if (shared)
+ strcat(d,"/dyn_so_start.o");
+#ifdef INSTALLVERSION
+ else
+ strcat(d,"/dyn_dstart.o");
+ strcat(e,"/dyn_dstop.o");
+#else
+ else
+ strcat(d,"/dyn_start.o");
+ strcat(e,"/dyn_stop.o");
+#endif
+#else
+ strcpy(d,platform); strcat(d,"/dyn_start.o");
+ strcpy(e,platform); strcat(e,"/dyn_stop.o");
+#endif
+#endif
dest=newargv;
*dest++=argv[1];
- if (link) { *dest++=nostdlib; *dest++=dashL; }
- if (compile || link) *dest++=a;
- for (i=2; i<argc; ++i)
+#ifndef __DYN_LIB
+ if (_link) { *dest++=(char*)nostdlib; *dest++=dashstatic; *dest++=dashL; }
+#else
+ /* avoid R_*_COPY relocations */
+ *dest++="-fPIC";
+ if (_link || shared) { *dest++=(char*)nostdlib; *dest++=dashL; }
+#endif
+#ifdef WANT_SAFEGUARD
+ if (compile && !preprocess) {
+ *dest++=safeguard1;
+ *dest++=safeguard2;
+ }
+#endif
+ if (_link) { *dest++=b; }
+#ifdef WANT_DYNAMIC
+ if (_link) { *dest++=d; }
+#endif
+ for (i=2; i<argc; ++i) {
+ if (mangleopts)
+ if (argv[i][0]=='-' && (argv[i][1]=='O' || argv[i][1]=='f' || argv[i][1]=='m')) {
+ if (strcmp(argv[i],"-fpic") && strcmp(argv[i],"-fno-pic"))
+ continue;
+ }
*dest++=argv[i];
- if (link) { *dest++=b; *dest++=c; *dest++=libgcc; }
+ }
+#ifndef __DYN_LIB
+ if (compile || _link) *dest++=a;
+#else
+ if (compile || _link || shared) *dest++=a;
+#endif
+ *dest++="-D__dietlibc__";
+ if (mangleopts) {
+ const char **o=Os;
+
+ {
+ int fd;
+ char* tmp=getenv("HOME");
+ if (tmp) {
+ if (strlen(tmp)+strlen(cc)<900) {
+ strcpy(manglebuf,tmp);
+ strcat(manglebuf,"/.diet/");
+ strcat(manglebuf,cc);
+ if ((fd=open(manglebuf,O_RDONLY))>=0) {
+ int len=read(fd,manglebuf,1023);
+ if (len>0) {
+ int i;
+ manglebuf[len]=0;
+ *dest++=manglebuf;
+ for (i=1; i<len; ++i) {
+ if (manglebuf[i]==' ' || manglebuf[i]=='\n') {
+ manglebuf[i]=0;
+ if (i+1<len)
+ *dest++=manglebuf+i+1;
+ }
+ }
+ goto incorporated;
+ }
+ }
+ }
+ }
+ }
+ for (o=Os;*o;++o) {
+ if (!strcmp(*o,shortplatform)) {
+ ++o;
+ while (*o) {
+ *dest++=(char*)*o;
+ ++o;
+ }
+ break;
+ } else
+ while (*o) ++o;
+ }
+ }
+incorporated:
+ if (_link) {
+ if (profile) *dest++="-lgmon";
+ if (!strcmp(shortplatform,"sparc") || !strcmp(shortplatform,"sparc64")) {
+ *dest++=(char*)libgcc; *dest++=c;
+ } else {
+ *dest++=c; *dest++=(char*)libgcc;
+ }
+ }
+#ifdef WANT_DYNAMIC
+ if (_link) { *dest++=e; }
+#endif
+#ifdef __DYN_LIB
+ if (shared){ *dest++=c; }
+ f=alloca(strlen(platform)+100);
+ if (_link) {
+ strcpy(f,"-Wl,-dynamic-linker=");
+ strcat(f,platform);
+// strcat(f,"/diet-linux.so");
+ strcat(f,"/libdl.so");
+ *dest++=f;
+ }
+#endif
*dest=0;
+ if (verbose) {
+ int i;
+ for (i=0; newargv[i]; i++) {
+ __write2(newargv[i]);
+ __write2(" ");
+ }
+ __write2("\n");
+ }
execvp(newargv[0],newargv);
goto error;
} else if (!strcmp(tmp,"ld")) {
@@ -107,6 +362,6 @@ int main(int argc,char *argv[]) {
donttouch:
execvp(argv[1],argv+1);
error:
- error("execvp failed!\n");
+ error("execvp() failed!\n");
return 1;
}
diff --git a/mdk-stage1/dietlibc/dietdirent.h b/mdk-stage1/dietlibc/dietdirent.h
index d732cf7dc..dbd7206a6 100644
--- a/mdk-stage1/dietlibc/dietdirent.h
+++ b/mdk-stage1/dietlibc/dietdirent.h
@@ -1,6 +1,8 @@
+#include <sys/shm.h>
+
struct __dirstream {
int fd;
- char buf[1024];
+ char buf[PAGE_SIZE-(sizeof (int)*3)];
unsigned int num;
unsigned int cur;
}; /* stream data from opendir() */
diff --git a/mdk-stage1/dietlibc/dietdns.h b/mdk-stage1/dietlibc/dietdns.h
new file mode 100644
index 000000000..c4c1c5f72
--- /dev/null
+++ b/mdk-stage1/dietlibc/dietdns.h
@@ -0,0 +1,4 @@
+
+int __dns_gethostbyx_r(const char* name, struct hostent* result,
+ char *buf, size_t buflen,
+ struct hostent **RESULT, int *h_errnop, int lookfor);
diff --git a/mdk-stage1/dietlibc/dietfeatures.h b/mdk-stage1/dietlibc/dietfeatures.h
index e1de38577..a7b84d5b9 100644
--- a/mdk-stage1/dietlibc/dietfeatures.h
+++ b/mdk-stage1/dietlibc/dietfeatures.h
@@ -3,40 +3,106 @@
/* 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_FLOATING_POINT_IN_PRINTF */
+/* #define WANT_FLOATING_POINT_IN_SCANF */
#define WANT_CHARACTER_CLASSES_IN_SCANF
#define WANT_NULL_PRINTF
+/* #define WANT_LONGLONG_PRINTF */
+/* #define WANT_LONGLONG_SCANF */
-#define SLASH_PROC_OK
+/* 128 or 2048 bytes buffer size? */
+/* #define WANT_SMALL_STDIO_BUFS */
+
+/* want fread to read() directly if size of data is larger than buffer?
+ * This costs a few bytes but is worth it if the application is already
+ * buffering. */
+#define WANT_FREAD_OPTIMIZATION
-// #define WANT_BUFFERED_STDIO
+/* this is only for meaningful for ttyname and sysconf_cpus so far */
+#define SLASH_PROC_OK
/* use errno_location instead of errno */
-// #define WANT_THREAD_SAFE
+/* #define WANT_THREAD_SAFE */
-/* make the startcode, etc. dynamic aware */
-/* #undef WANT_DYNAMIC */
+/* make the startcode, etc. dynamic aware ({con,de}structors) */
+/* #define 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 this to have strncpy zero-fill and not just zero-terminate the
+ * string */
+/* #define WANT_FULL_POSIX_COMPAT */
-// #define WANT_LINKER_WARNINGS
+/* read the comment in lib/strncat.c for an explanation */
+/* #define WANT_NON_COMPLIANT_STRNCAT */
+
+/* #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
+ * file support on kernel 2.2 or 2.0 */
+/* #define WANT_LARGEFILE_BACKCOMPAT */
/* do you want localtime(3) to read /etc/localtime?
* Needed for daylight saving time etc. */
-// #define WANT_TZFILE_PARSER
+/* #define WANT_TZFILE_PARSER */
+
+/* do you want the DNS routines to parse and use "domain" and "search"
+ * lines from /etc/resolv.conf? Normally not used on boot floppies and
+ * embedded environments. */
+#define WANT_FULL_RESOLV_CONF
+
+/* do you want IPv6 transport support in the DNS resolver? */
+/* #define WANT_IPV6_DNS */
+
+/* do you want gethostbyname and friends to consult /etc/hosts? */
+#define WANT_ETC_HOSTS
+
+/* do you want gethostbyname to understand dotted decimal IP numbers
+ * directly and not try to resolve them? */
+#define WANT_INET_ADDR_DNS
+
+/* do you want math functions high precision rather than fast/small? */
+/* #define WANT_HIGH_PRECISION_MATH */
+
+/* do you want support for matherr? */
+/* #define WANT_MATHERR */
+
+/* do you want crypt(3) to use MD5 if the salt starts with "$1$"? */
+/* #define WANT_CRYPT_MD5 */
+
+/* do you want diet to include a safeguard dependency to make linking
+ * against glibc fail? This may fail with older binutils. */
+#define WANT_SAFEGUARD
+
+/* dy you want that malloc(0) return a pointer to a "zero-length" object
+ * that is realloc-able; means realloc(..,size) gives a NEW object (like a
+ * call to malloc(size)).
+ * WARNING: this violates C99 */
+/* #define WANT_MALLOC_ZERO */
+
/* stop uncommenting here ;-) */
#ifndef WANT_FASTER_STRING_ROUTINES
#define WANT_SMALL_STRING_ROUTINES
#endif
+#ifdef WANT_THREAD_SAFE
+#ifndef __ASSEMBLER__
+#define errno (*__errno_location())
+#define _REENTRANT
+#endif
+#endif
+
+#ifdef __DYN_LIB
+/* with shared libraries you MUST have a dynamic aware startcode */
+#ifndef WANT_DYNAMIC
+#define WANT_DYNAMIC
+#endif
+/* saveguard crashes with shared objects ... */
+#ifdef WANT_SAFEGUARD
+#undef WANT_SAFEGUARD
+#endif
+#endif
+
#endif
diff --git a/mdk-stage1/dietlibc/dieticonv.h b/mdk-stage1/dietlibc/dieticonv.h
new file mode 100644
index 000000000..540ef2f6f
--- /dev/null
+++ b/mdk-stage1/dietlibc/dieticonv.h
@@ -0,0 +1,12 @@
+enum charset {
+ INVALID=0,
+ ISO_8859_1,
+ UTF_8,
+ UCS_2,
+ UCS_4
+};
+
+#define ic_from(x) (((x) )&0xffff)
+#define ic_to(x) (((x)>>16)&0xffff)
+
+#include <iconv.h>
diff --git a/mdk-stage1/dietlibc/dietlibm.h b/mdk-stage1/dietlibc/dietlibm.h
new file mode 100644
index 000000000..fe735e40d
--- /dev/null
+++ b/mdk-stage1/dietlibc/dietlibm.h
@@ -0,0 +1,5 @@
+#include <sys/types.h>
+
+double __poly(double x, size_t n, const double* c);
+double exp2(double x);
+double log2(double x);
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
index a1cbeba83..2e0e93601 100644
--- a/mdk-stage1/dietlibc/dietstdio.h
+++ b/mdk-stage1/dietlibc/dietstdio.h
@@ -1,81 +1,77 @@
-/* diet stdio -- no buffering ;-} */
+/* diet stdio */
-#include "dietfeatures.h"
+#include <sys/cdefs.h>
#include <sys/types.h>
-#ifdef WANT_THREAD_SAVE
+#include "dietfeatures.h"
+#ifdef WANT_THREAD_SAFE
#include <pthread.h>
#endif
+#include <stdarg.h>
+#ifdef WANT_SMALL_STDIO_BUFS
#define BUFSIZE 128
+#else
+#define BUFSIZE 2048
+#endif
-typedef struct __file {
+struct __stdio_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
+ unsigned int buflen; /* length of buf */
+ char *buf;
+ struct __stdio_file *next; /* for fflush */
pid_t popen_kludge;
-#ifdef WANT_UNGETC
- char ungetbuf;
+ unsigned char ungetbuf;
char ungotten;
-#endif
-#ifdef WANT_THREAD_SAVE
+#ifdef WANT_THREAD_SAFE
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 STATICBUF 32
+#define FDPIPE 64
#define _IONBF 0
#define _IOLBF 1
#define _IOFBF 2
+#include <stdio.h>
+
/* 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);
+extern int __buffered_outs(const char *s,size_t len);
-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);
+/* ..scanf */
+struct arg_scanf {
+ void *data;
+ int (*getch)(void*);
+ int (*putch)(int,void*);
+};
-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);
+int __v_scanf(struct arg_scanf* fn, const unsigned char *format, va_list arg_ptr);
-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);
+struct arg_printf {
+ void *data;
+ int (*put)(void*,size_t,void*);
+};
-size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream);
+int __v_printf(struct arg_printf* fn, const unsigned char *format, va_list arg_ptr);
-size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream);
-
-int fflush(FILE *stream);
-
-int fclose(FILE *stream);
+extern FILE *__stdio_root;
-extern FILE *stdout, *stderr, *stdin;
+int __fflush_stdin(void);
+int __fflush_stdout(void);
+int __fflush_stderr(void);
-#define EOF (int)(-1)
+FILE* __stdio_init_file(int fd,int closeonerror);
+int __stdio_parse_mode(const char *mode);
+void __stdio_flushall(void);
diff --git a/mdk-stage1/dietlibc/dietuglyweaks.h b/mdk-stage1/dietlibc/dietuglyweaks.h
new file mode 100644
index 000000000..4b2aa231a
--- /dev/null
+++ b/mdk-stage1/dietlibc/dietuglyweaks.h
@@ -0,0 +1,24 @@
+#ifndef __DIET_UGLY_WEAKS__
+#define __DIET_UGLY_WEAKS__
+
+/* if you change something here ... KNOW what you're doing !
+ * it'll effect ALL platforms ! */
+
+.weak __thread_doexit
+__thread_doexit:
+.weak __fflush_stdin
+__fflush_stdin:
+.weak __fflush_stdout
+__fflush_stdout:
+.weak __fflush_stderr
+__fflush_stderr:
+.weak flockfile
+flockfile:
+.weak funlockfile
+funlockfile:
+.weak __nop
+__nop:
+.global __you_tried_to_link_a_dietlibc_object_against_glibc
+__you_tried_to_link_a_dietlibc_object_against_glibc:
+
+#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/dyn_start.c b/mdk-stage1/dietlibc/dyn_start.c
new file mode 100644
index 000000000..391797e12
--- /dev/null
+++ b/mdk-stage1/dietlibc/dyn_start.c
@@ -0,0 +1,40 @@
+#include "dietfeatures.h"
+
+#ifdef WANT_DYNAMIC
+#include <stdlib.h>
+
+typedef void(*structor)(void);
+
+__attribute__((section(".ctors")))
+static structor __CTOR_LIST__[1]={((structor)-1)};
+
+__attribute__((section(".dtors")))
+static structor __DTOR_LIST__[1]={((structor)-1)};
+
+static void __do_global_dtors_aux(void)
+{
+ structor *df=__CTOR_LIST__; /* ugly trick to prevent warning */
+ for (df=((__DTOR_LIST__)+1);(*df) != (structor)0; df++) (*df)();
+}
+
+void _fini(void) __attribute__((section(".fini")));
+__attribute__((section(".fini"))) void _fini(void)
+{
+ __do_global_dtors_aux();
+}
+
+#ifndef __DYN_LIB_SHARED
+/* pre main, post _start */
+int _dyn_start(int argc, char **argv, char **envp, structor dl_init);
+int _dyn_start(int argc, char **argv, char **envp, structor dl_init)
+{
+ static __attribute__((section(".init"))) void _init(void);
+ int main(int argc, char **argv, char **envp);
+
+ if (dl_init) atexit(dl_init);
+ _init();
+ atexit(_fini);
+ return main(argc, argv, envp);
+}
+#endif
+#endif
diff --git a/mdk-stage1/dietlibc/dyn_stop.c b/mdk-stage1/dietlibc/dyn_stop.c
new file mode 100644
index 000000000..7213a8089
--- /dev/null
+++ b/mdk-stage1/dietlibc/dyn_stop.c
@@ -0,0 +1,23 @@
+#include "dietfeatures.h"
+
+#ifdef WANT_DYNAMIC
+typedef void(*structor)(void);
+
+__attribute__((section(".ctors")))
+static structor __CTOR_END__[1]={((structor)0)};
+
+__attribute__((section(".dtors")))
+static structor __DTOR_END__[1]={((structor)0)};
+
+static void __do_global_ctors_aux(void)
+{
+ structor *cf=__DTOR_END__; /* ugly trick to prevent warning */
+ for(cf=((__CTOR_END__)-1); (*cf) != (structor)-1; cf--) (*cf)();
+}
+
+void _init() __attribute__((section(".init")));
+__attribute__((section(".init"))) void _init()
+{
+ __do_global_ctors_aux();
+}
+#endif
diff --git a/mdk-stage1/dietlibc/findcflags.sh b/mdk-stage1/dietlibc/findcflags.sh
new file mode 100755
index 000000000..8b8b3d74a
--- /dev/null
+++ b/mdk-stage1/dietlibc/findcflags.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+version=`${1:-gcc} -v 2>&1 |sed -n '/gcc version/ {s/gcc version //;p;}'`
+case $version in
+ 2.9*) echo -march=i386 -Os -fomit-frame-pointer -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mpreferred-stack-boundary=2 ;;
+ 3.0*) echo -march=i386 -Os -fomit-frame-pointer -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mpreferred-stack-boundary=2 ;;
+ 3*) echo -Os -fomit-frame-pointer -falign-functions=0 -falign-jumps=0 -falign-loops=0 -mpreferred-stack-boundary=2;;
+ *) echo -O2 -pipe -fomit-frame-pointer ;;
+esac
diff --git a/mdk-stage1/dietlibc/i386/Makefile.add b/mdk-stage1/dietlibc/i386/Makefile.add
index b685cc360..83b18ae29 100644
--- a/mdk-stage1/dietlibc/i386/Makefile.add
+++ b/mdk-stage1/dietlibc/i386/Makefile.add
@@ -1,3 +1,8 @@
-CFLAGS+=-march=i386 -mcpu=i386 -Os -fomit-frame-pointer
+M:=$(shell ./findcflags.sh $(CC))
+LIBOBJ+=$(OBJDIR)/__ten.o $(OBJDIR)/md5asm.o $(OBJDIR)/mmap64.o
+LIBMATH+=acos.o asin.o atan.o atan2.o ceil.o cos.o exp.o exp10.o exp2.o expm1.o fabs.o floor.o hypot.o log.o log10.o log2.o sin.o sqrt.o tan.o copysign.o sincos.o __half.o ldexp.o pow.o ilogb.o cbrt.o log1p.o sqrtl.o fmod.o libm2.o
+#CFLAGS+=-march=i386 -Os -fomit-frame-pointer -malign-functions=0 -malign-jumps=0 -malign-loops=0 -mpreferred-stack-boundary=2
+CFLAGS+=$(M)
VPATH:=i386:syscalls.s:$(VPATH)
+LIBGMON_OBJS+=$(OBJDIR)/mcount.o
diff --git a/mdk-stage1/dietlibc/i386/PIC.h b/mdk-stage1/dietlibc/i386/PIC.h
new file mode 100644
index 000000000..45ddeb446
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/PIC.h
@@ -0,0 +1,82 @@
+#ifndef __I386_PIC_H__
+#define __I386_PIC_H__
+#ifdef __DYN_LIB
+
+#if 1
+/* don't trash the athlon return stack */
+.text
+.Lgetpic:
+ mov (%esp),%ebx
+ ret
+
+.macro PIC_INIT
+ call .Lgetpic
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+.endm
+#else
+/* standard code for PIC init */
+.macro PIC_INIT
+ call 0f
+0: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ebx
+.endm
+#endif
+
+#define PIC_SAVE pushl %ebx
+#define PIC_RESTORE popl %ebx
+
+
+/* get memory variable (var) in register (reg) */
+.macro GET_VAR var reg
+ movl \var@GOT(%ebx), \reg
+ movl (\reg), \reg
+.endm
+
+/* put register (reg) into memory variable (var) TRASH register (tmp) */
+.macro PUT_VAR reg var tmp
+ movl \var@GOT(%ebx), \tmp
+ movl \reg, (\tmp)
+.endm
+
+/* get memory variable (var) in register (reg)
+ * IF no more PIC-code is needed */
+.macro GET_1VAR var reg
+ PIC_SAVE
+ PIC_INIT
+ GET_VAR \var, \reg
+ PIC_RESTORE
+.endm
+
+/* put register (reg) into memory variable (var)
+ * IF no more PIC-code is needed */
+.macro PUT_1VAR reg var
+ PIC_SAVE
+ PIC_INIT
+ PUT_VAR \reg, \var, %ebx
+ PIC_RESTORE
+.endm
+
+#else
+
+#define PIC_SAVE
+#define PIC_RESTORE
+#define PIC_INIT
+
+.macro GET_VAR var reg
+ movl \var, \reg
+.endm
+
+.macro PUT_VAR reg var tmp
+ movl \reg, \var
+.endm
+
+.macro GET_1VAR var reg
+ GET_VAR \var, \reg
+.endm
+
+.macro PUT_1VAR reg var
+ PUT_VAR \reg, \var, none
+.endm
+
+#endif
+#endif
diff --git a/mdk-stage1/dietlibc/i386/__half.S b/mdk-stage1/dietlibc/i386/__half.S
new file mode 100644
index 000000000..6355c93e4
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/__half.S
@@ -0,0 +1,10 @@
+#
+# Definiert Konstante (float)0.5 unter dem Namen __half
+# Wird von etlichen Funktionen benutzt (sinh, cosh, atanh)
+#
+
+.global __half
+.data
+.type __half,@object
+.size __half,4
+__half: .long 0x3f000000
diff --git a/mdk-stage1/dietlibc/i386/__longjmp.S b/mdk-stage1/dietlibc/i386/__longjmp.S
index 098275037..a09191f0b 100644
--- a/mdk-stage1/dietlibc/i386/__longjmp.S
+++ b/mdk-stage1/dietlibc/i386/__longjmp.S
@@ -2,6 +2,7 @@
.text
.global __longjmp
+.type __longjmp,@function
__longjmp:
movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */
movl 8(%esp), %eax /* Second argument is return value. */
diff --git a/mdk-stage1/dietlibc/i386/__ten.S b/mdk-stage1/dietlibc/i386/__ten.S
new file mode 100644
index 000000000..47b9431f4
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/__ten.S
@@ -0,0 +1,9 @@
+#
+# Definiert Konstante (float)10. unter dem Namen __ten
+#
+
+.global __ten
+.data
+.type __ten,@object
+.size __ten,4
+__ten: .long 0x41200000
diff --git a/mdk-stage1/dietlibc/i386/__testandset.S b/mdk-stage1/dietlibc/i386/__testandset.S
index af7b4d5a0..29b02d57a 100644
--- a/mdk-stage1/dietlibc/i386/__testandset.S
+++ b/mdk-stage1/dietlibc/i386/__testandset.S
@@ -1,5 +1,6 @@
.text
.global __testandset
+.type __testandset,@function
__testandset:
xorl %eax, %eax
movl 0x4(%esp),%edx
diff --git a/mdk-stage1/dietlibc/i386/accept.S b/mdk-stage1/dietlibc/i386/accept.S
new file mode 100644
index 000000000..d8be36a54
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/accept.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(accept,ACCEPT)
diff --git a/mdk-stage1/dietlibc/i386/acos.S b/mdk-stage1/dietlibc/i386/acos.S
new file mode 100644
index 000000000..baabf9f04
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/acos.S
@@ -0,0 +1,30 @@
+
+.text
+
+.global acosf,acos,acosl # ,__acos
+ .type acosf,@function
+ .type acos,@function
+ .type acosl,@function
+# .type __acos,@function
+acosf:
+ flds 4(%esp)
+ jmp __acos
+acosl:
+ fldt 4(%esp)
+ jmp __acos
+acos:
+ fldl 4(%esp)
+__acos:
+ fld %st
+ fmul %st
+ fld1
+ fsubp
+ fsqrt
+ fxch %st(1)
+ fpatan
+ ret
+
+.ende:
+.size acos,.ende-acos
+.size acosf,.ende-acosf
+.size acosl,.ende-acosl
diff --git a/mdk-stage1/dietlibc/i386/acosh.S b/mdk-stage1/dietlibc/i386/acosh.S
new file mode 100644
index 000000000..0611c9d31
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/acosh.S
@@ -0,0 +1,18 @@
+.text
+.global acosh
+.type acosh,@function
+
+acosh:
+ fldln2
+ fldl 4(%esp)
+ fld %st(0)
+ fmul %st(0),%st(0)
+ fld1
+ fsubrp %st(0),%st(1)
+ fsqrt
+ faddp %st(0),%st(1)
+ fyl2x
+ ret
+
+.Lende:
+ .size acosh,.Lende-acosh
diff --git a/mdk-stage1/dietlibc/i386/asin.S b/mdk-stage1/dietlibc/i386/asin.S
new file mode 100644
index 000000000..7b0c31407
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/asin.S
@@ -0,0 +1,29 @@
+
+.text
+
+.global asinf,asin,asinl # ,__asin
+ .type asinf,@function
+ .type asin,@function
+ .type asinl,@function
+# .type __asin,@function
+asinf:
+ flds 4(%esp)
+ jmp __asin
+asinl:
+ fldt 4(%esp)
+ jmp __asin
+asin:
+ fldl 4(%esp)
+__asin:
+ fld %st
+ fmul %st
+ fld1
+ fsubp
+ fsqrt
+ fpatan
+ ret
+
+.ende:
+.size asin,.ende-asin
+.size asinf,.ende-asinf
+.size asinl,.ende-asinl
diff --git a/mdk-stage1/dietlibc/i386/asinh.S b/mdk-stage1/dietlibc/i386/asinh.S
new file mode 100644
index 000000000..8c3964392
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/asinh.S
@@ -0,0 +1,18 @@
+.text
+.global asinh
+.type asinh,@function
+
+asinh:
+ fldln2
+ fldl 4(%esp)
+ fld %st(0)
+ fmul %st(0),%st(0)
+ fld1
+ faddp %st(0),%st(1)
+ fsqrt
+ faddp %st(0),%st(1)
+ fyl2x
+ ret
+
+.Lende:
+ .size asinh,.Lende-asinh
diff --git a/mdk-stage1/dietlibc/i386/atan.S b/mdk-stage1/dietlibc/i386/atan.S
new file mode 100644
index 000000000..76513f928
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/atan.S
@@ -0,0 +1,27 @@
+
+.text
+
+.global atanf,atan,atanl
+ .type atanf,@function
+ .type atan,@function
+ .type atanl,@function
+atanf:
+ flds 4(%esp)
+ fld1
+ fpatan
+ ret
+atan:
+ fldl 4(%esp)
+ fld1
+ fpatan
+ ret
+atanl:
+ fldt 4(%esp)
+ fld1
+ fpatan
+ ret
+
+.ende:
+.size atan,.ende-atan
+.size atanf,.ende-atanf
+.size atanl,.ende-atanl
diff --git a/mdk-stage1/dietlibc/i386/atan2.S b/mdk-stage1/dietlibc/i386/atan2.S
new file mode 100644
index 000000000..acf6e03ae
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/atan2.S
@@ -0,0 +1,12 @@
+
+.text
+.type atan2,@function
+.global atan2
+atan2:
+ fldl 4(%esp)
+ fldl 12(%esp)
+ fpatan
+ ret
+
+.ende:
+.size atan2,.ende-atan2
diff --git a/mdk-stage1/dietlibc/i386/atanh.S b/mdk-stage1/dietlibc/i386/atanh.S
new file mode 100644
index 000000000..b75f0fa8e
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/atanh.S
@@ -0,0 +1,19 @@
+.text
+.global atanh
+.type atanh,@function
+
+atanh:
+ fldln2
+ fldl 4(%esp)
+ fld1
+ fld %st(1)
+ fadd %st(1),%st(0)
+ fxch %st(1)
+ fsubp %st(0),%st(2)
+ fdivp %st(0),%st(1)
+ fyl2x
+ fmuls __half
+ ret
+
+.Lende:
+ .size atanh,.Lende-atanh
diff --git a/mdk-stage1/dietlibc/i386/atol.S b/mdk-stage1/dietlibc/i386/atol.S
new file mode 100644
index 000000000..5bd7f2c24
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/atol.S
@@ -0,0 +1,55 @@
+/*
+ Copyright (C) 2001, 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and
+ modify it under the terms of the GNU General Public
+ Public License.
+
+ atol.S
+ i386 assembler implementation of atoi(3) & atol(3)
+*/
+
+.text
+.globl atoi
+.globl atol
+.type atoi,@function
+.type atol,@function
+
+atoi:
+atol:
+ pushl %esi
+ movl 0x8(%esp), %esi
+ xorl %eax, %eax
+ xorl %edx, %edx
+ xorb %cl, %cl
+.LSpace:
+ lodsb
+ cmpb $0x21, %al
+ jng .LSpace
+ cmpb $'+', %al
+ jz .Lfe5
+ cmpb $'-', %al
+ jnz .Lfe3
+ inc %cl
+ jmp .Lfe5
+.Lfe2:
+ imul $0xa, %edx
+ addl %eax, %edx
+.Lfe5:
+ lodsb
+.Lfe3:
+ cmpb $47, %al
+ jng .Lout
+ subb $('0'), %al
+ cmpb $9, %al
+ jng .Lfe2
+.Lout:
+ movl %edx, %eax
+ or %cl, %cl
+ jz .Lreturn
+ negl %eax
+.Lreturn:
+ popl %esi
+ ret
+.size atoi, . - atoi
+.size atol, . - atol
diff --git a/mdk-stage1/dietlibc/i386/atoll.S b/mdk-stage1/dietlibc/i386/atoll.S
new file mode 100644
index 000000000..093bf762a
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/atoll.S
@@ -0,0 +1,64 @@
+
+.text
+.type atoll,@function
+.global atoll
+
+atoll:
+ movl 4(%esp),%ecx
+ push %edi
+
+ xorl %edi,%edi # sign = 0
+
+ decl %ecx
+.Lspaces:
+ incl %ecx # while ( isspace(*p) ) p++;
+ movb (%ecx),%al
+ cmpb $' ',%al
+ je .Lspaces
+ subb $9,%al
+ cmpb $5,%al
+ jc .Lspaces # c = *p - 9;
+
+ cmpb $'+'-9,%al # if ( c == '+' - 9 ) p++;
+ je .Lpos
+ cmpb $'-'-9,%al # else if ( c == '-' - 9 ) sign = -sign, p++;
+ jne .Lnosign
+ decl %edi
+.Lpos: incl %ecx
+.Lnosign:
+
+ push %ebx
+ push %esi
+ push %ebp
+ movl $10,%ebp
+
+ xorl %esi,%esi # Hi(value) = 0;
+ xorl %eax,%eax # Lo(value) = 0;
+.Lcont: movzbl (%ecx),%ebx # while ( (unsigned) (*p - '0') < 10 )
+ inc %ecx
+ subl $'0',%ebx
+ cmpl %ebp,%ebx
+ jnc .Lfini
+ imull %ebp,%esi # value *= 10,
+ mull %ebp
+ addl %edx,%esi
+ addl %ebx,%eax # value += (*p - '0');
+ adcl $0,%esi
+ jmp .Lcont
+
+.Lfini: xchg %edx,%esi # return sign== 0 ? +value
+ xorl %edi,%eax # sign==-1 ? -value
+ xorl %edi,%edx
+ subl %edi,%eax
+ sbbl %edi,%edx
+
+ pop %ebp
+ pop %esi
+ pop %ebx
+ pop %edi
+ ret
+
+.Lende:
+
+.size atoll,.Lende-atoll
+
diff --git a/mdk-stage1/dietlibc/i386/bind.S b/mdk-stage1/dietlibc/i386/bind.S
new file mode 100644
index 000000000..caff9bb8b
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/bind.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(bind,BIND)
diff --git a/mdk-stage1/dietlibc/i386/cbrt.S b/mdk-stage1/dietlibc/i386/cbrt.S
new file mode 100644
index 000000000..9d8aebd1e
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/cbrt.S
@@ -0,0 +1,46 @@
+.text
+
+tab: .byte 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4
+ .byte 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9
+ .byte 10,10,11,11,12,12,12,13,13,14,14,14,15,15,15,16
+
+_3: .long 0x40400000
+
+
+.global cbrt
+cbrt:
+ fldl 4(%esp)
+ movw 10(%esp),%ax
+ movb %ah,%ch
+ andw $0x7FFF,%ax
+ jz zero /* cbrt(0) = 0 */
+ pushl %ebx
+ cwd
+ movl $16*3,%ebx /* AX 3FE0 3FF0 4000 4010 */
+ divw %bx /* AX 154 155 155 155 */
+ /* DX 20 0 10 20 */
+ shlw $5,%ax
+ addb %ch,%ch
+ rcrw %ax /* AX 1540 1550 1550 1550 */
+ addw $0x3FF0-0x1550,%ax /* AX 3FE0 3FF0 3FF0 3FF0 */
+ movw %dx,%bx
+ addb tab(%ebx),%al
+ adcb $0,%ah
+ popl %ebx
+ movw %ax,10(%esp)
+ fldl 4(%esp) /* y x */
+
+ movl $4,%ecx
+lop:
+ fld %st(0) /* y y x */
+ fmul %st(0),%st(0) /* y^2 y x */
+ fdivr %st(2),%st(0) /* x/y^2 y x */
+ fadd %st(1),%st(0) /* x/y^2+y y x */
+ faddp /* x/y^2+2y x */
+ fdivs _3 /* y' x */
+ loop lop
+
+ fstp %st(1) /* y' */
+zero:
+ ret
+
diff --git a/mdk-stage1/dietlibc/i386/ceil.S b/mdk-stage1/dietlibc/i386/ceil.S
new file mode 100644
index 000000000..e6a4e989c
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/ceil.S
@@ -0,0 +1,44 @@
+.text
+
+.global ceilf,ceil,ceill,__flcetr
+ .type ceilf,@function
+ .type ceil,@function
+ .type ceill,@function
+ .type __flcetr,@function
+
+ceilf:
+ flds 4(%esp)
+ movb $0x08,%ah
+ jmp __flcetr
+
+ceill:
+ fldt 4(%esp)
+ movb $0x08,%ah
+ jmp __flcetr
+
+ceil:
+ fldl 4(%esp)
+ movb $0x08,%ah
+
+# Wspolny kod dla funkcji floor, ceil i trunc
+# W ah maska bitow 11 i 10 rejestru sterowania koprocesora
+__flcetr:
+ xorl %ecx,%ecx # wyzerowanie rejestru
+ movb %ah,%ch # i utworzenie maski w cx
+ pushl %eax # krotsze niz subl $4,%esp
+ fstcw (%esp)
+ movw (%esp),%ax
+ andb $0x03,%ah # wyzerowanie bitow 11 i 10
+ orl %ecx,%eax # ustawienie bitow z maski
+ movw %ax,2(%esp)
+ fldcw 2(%esp)
+ frndint
+ fldcw (%esp) # odtworzenie rejestru sterowania
+ popl %eax # i polozenia stosu
+ ret
+
+.Lende:
+.size ceil,.Lende-ceil
+.size ceill,.Lende-ceill
+.size ceilf,.Lende-ceilf
+.size flcetr,.Lende-__flcetr
diff --git a/mdk-stage1/dietlibc/i386/clone.S b/mdk-stage1/dietlibc/i386/clone.S
index ac02eb468..ea43bc2e2 100644
--- a/mdk-stage1/dietlibc/i386/clone.S
+++ b/mdk-stage1/dietlibc/i386/clone.S
@@ -1,17 +1,21 @@
-#include <asm/unistd.h>
+#include "syscalls.h"
+#include <errno.h>
+#include "PIC.h"
.text
+.type clone,@function
.weak clone
clone:
+.type __clone,@function
.global __clone
__clone:
+ mov $-EINVAL, %eax
+
movl 4(%esp), %ecx /* have non null thread_funcion */
- testl %ecx, %ecx
- je .Lclone_error
+ jecxz .Lclone_error
movl 8(%esp), %ecx /* have non null child_stack pointer */
- testl %ecx, %ecx
- je .Lclone_error
+ jecxz .Lclone_error
/* put the parameter on thread stack */
subl $8, %ecx
@@ -31,9 +35,7 @@ __clone:
testl %eax, %eax
jl .Lclone_error
- je .Lstart_thread
- ret
-
+ jne .Lreturn
.Lstart_thread:
xorl %ebp,%ebp
call *%ebx
@@ -43,9 +45,16 @@ __clone:
.Lclone_error:
negl %eax
pushl %eax
+#ifdef PIC
+ pushl %ebx
+ PIC_INIT
+ call __errno_location@PLT
+ popl %ebx
+#else
call __errno_location
+#endif
popl %ecx
movl %ecx, (%eax)
- xorl %eax, %eax
- decl %eax
+ orl $-1, %eax
+.Lreturn:
ret
diff --git a/mdk-stage1/dietlibc/i386/connect.S b/mdk-stage1/dietlibc/i386/connect.S
new file mode 100644
index 000000000..a295a8814
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/connect.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(connect,CONNECT)
diff --git a/mdk-stage1/dietlibc/i386/copysign.S b/mdk-stage1/dietlibc/i386/copysign.S
new file mode 100644
index 000000000..3a495efee
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/copysign.S
@@ -0,0 +1,18 @@
+
+.text
+.type copysign,@function
+.global copysign
+
+# double copysign ( double value, double sign );
+
+copysign:
+ movb 12+7(%esp),%al
+ movb 4+7(%esp),%ah
+ andw $0x7F80,%ax
+ orb %ah,%al
+ movb 4+7(%esp),%al
+ fldl 4(%esp)
+ ret
+
+.ende:
+.size copysign,.ende-copysign
diff --git a/mdk-stage1/dietlibc/i386/cos.S b/mdk-stage1/dietlibc/i386/cos.S
new file mode 100644
index 000000000..f95c81ca7
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/cos.S
@@ -0,0 +1,35 @@
+.text
+
+.global cosf,cos,cosl
+.type cosf,@function
+.type cos,@function
+.type cosl,@function
+
+cosf:
+ flds 4(%esp)
+ jmp 1f
+cos:
+ fldl 4(%esp)
+1:
+ fcos
+ fnstsw %ax
+ testb $0x04, %ah
+ je 3f
+ fldpi
+ fadd %st
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ testb $0x04, %ah
+ jne 2b
+ fstp %st(1)
+ fcos
+3: ret
+cosl:
+ fldt 4(%esp)
+ jmp 1b
+
+.Lende:
+.size cos,.Lende-cos
+.size cosl,.Lende-cosl
+.size cosf,.Lende-cosf
diff --git a/mdk-stage1/dietlibc/i386/cosh.S b/mdk-stage1/dietlibc/i386/cosh.S
new file mode 100644
index 000000000..f6a33704d
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/cosh.S
@@ -0,0 +1,29 @@
+
+.text
+.type cosh,@function
+.global cosh
+
+cosh: # note: exp(x) = 2^(x*log2(e))
+ fldl2e
+ fmull 4(%esp) # x*log2(e)
+ fld %st(0) # x*log2(e) x*log2(e)
+ frndint # int(x*log2(e)) x*log2(e)
+ fxch # x*log2(e) int(x*log2(e))
+ fsub %st(1),%st(0) # frac(x*log2(e)) int(x*log2(e))
+ f2xm1 # 2^(fract(x*log2(e)))-1 int(x*log2(e))
+ fld1 # 1 2^(fract(x*log2(e)))-1 int(x*log2(e))
+ faddp %st(0),%st(1) # 2^(fract(x*log2(e))) int(x*log2(e))
+ fscale # 2^(x*log2(e)) int(x*log2(e))
+ fstp %st(1) # 2^(x*log2(e))
+
+# now we have y = exp(x), but cosh(x) = (y + 1/y) * 0.5
+
+ fld1
+ fdiv %st(1),%st(0)
+ faddp
+ fmuls __half
+ ret
+
+.Lende:
+
+.size cosh,.ende-cosh
diff --git a/mdk-stage1/dietlibc/i386/dyn_syscalls.S b/mdk-stage1/dietlibc/i386/dyn_syscalls.S
new file mode 100644
index 000000000..c4fd2fff5
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/dyn_syscalls.S
@@ -0,0 +1,282 @@
+/*
+ * dynamic unified-syscalls
+ * Olaf Dreesen
+ */
+
+#include "../syscalls.s/environ.S"
+#include "../syscalls.s/errno.S"
+
+#include <dietfeatures.h>
+#include "syscalls.h"
+#include "PIC.h"
+
+/* ok now include all syscalls.s (*.S) and sysdep *.S */
+
+#include "mmap.S"
+
+/* here on i386 I had split them some pre- some post-unified-syscall,
+ * because the jumps pre-u.s.c. have only a 1 byte displacement. the first
+ * post-u.s.c. have also 1 byte dsplacement the rest a 4 byte.
+ * this pre/post split saves about 250 byte of code ....
+ *
+ * Please put additional syscalls AFTER the post-u.s.c.
+ * or try to not break the savings :) */
+
+#include "select.S"
+
+#include "../syscalls.s/fork.S"
+#include "../syscalls.s/read.S"
+#include "../syscalls.s/write.S"
+#include "../syscalls.s/open.S"
+#include "../syscalls.s/close.S"
+#include "../syscalls.s/waitpid.S"
+
+#include "../syscalls.s/getgid.S"
+#include "../syscalls.s/getpgid.S"
+#include "../syscalls.s/getpid.S"
+#include "../syscalls.s/getppid.S"
+#include "../syscalls.s/getuid.S"
+#include "../syscalls.s/kill.S"
+#include "../syscalls.s/ioctl.S"
+#include "../syscalls.s/_llseek.S"
+#include "../syscalls.s/lseek.S"
+#include "../syscalls.s/lstat.S"
+#include "../syscalls.s/lstat64.S"
+#include "../syscalls.s/mkdir.S"
+#include "../syscalls.s/mprotect.S"
+#include "../syscalls.s/nanosleep.S"
+#include "../syscalls.s/pipe.S"
+#include "../syscalls.s/poll.S"
+#include "../syscalls.s/readv.S"
+#include "../syscalls.s/stat.S"
+#include "../syscalls.s/stat64.S"
+#include "../syscalls.s/truncate.S"
+#include "../syscalls.s/umask.S"
+#include "../syscalls.s/wait4.S"
+#include "../syscalls.s/writev.S"
+#include "../syscalls.s/__getpagesize.S"
+
+/* OK this is basicaly unified.S */
+.text
+.type __unified_syscall_256,@function
+__unified_syscall_256:
+ movzwl %ax, %eax
+ jmp .L23
+.L22:
+.size __unified_syscall_256,.L22-__unified_syscall_256
+.type exit,@function
+.weak exit
+exit:
+.type _exit,@function
+.global _exit
+_exit:
+__exit:
+ mov $__NR_exit, %al
+__unified_syscall:
+ movzbl %al, %eax
+.L23:
+ 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
+ neg %eax
+
+ /* PIC-code Ohhhhh My. */
+ push %eax
+ PIC_INIT
+ call __errno_location@PLT
+ popl %ebx
+ movl %ebx,(%eax)
+ orl $-1,%eax
+.Lnoerror:
+ pop %ebx
+ pop %esi
+ pop %edi
+#include "dietuglyweaks.h"
+ ret
+
+#include "../syscalls.s/__pread.S"
+#include "../syscalls.s/__pwrite.S"
+#include "../syscalls.s/__reboot.S"
+#include "../syscalls.s/access.S"
+#include "../syscalls.s/adjtimex.S"
+#include "../syscalls.s/brk.S"
+#include "../syscalls.s/chdir.S"
+#include "../syscalls.s/chmod.S"
+#include "../syscalls.s/chown.S"
+#include "../syscalls.s/chroot.S"
+#include "../syscalls.s/dup.S"
+#include "../syscalls.s/dup2.S"
+#include "../syscalls.s/execve.S"
+#include "../syscalls.s/fchdir.S"
+#include "../syscalls.s/fchmod.S"
+#include "../syscalls.s/fchown.S"
+#include "../syscalls.s/fcntl.S"
+#include "../syscalls.s/flock.S"
+#include "../syscalls.s/fstat.S"
+#include "../syscalls.s/fstat64.S"
+#include "../syscalls.s/fstatfs.S"
+#include "../syscalls.s/fsync.S"
+#include "../syscalls.s/fdatasync.S"
+#include "../syscalls.s/ftruncate.S"
+#include "../syscalls.s/getcwd.S"
+#include "../syscalls.s/getdents.S"
+#include "../syscalls.s/getdents64.S"
+#include "../syscalls.s/getegid.S"
+#include "../syscalls.s/geteuid.S"
+#include "../syscalls.s/getgroups.S"
+#include "../syscalls.s/getitimer.S"
+#include "../syscalls.s/getpriority.S"
+#include "../syscalls.s/getresgid.S"
+#include "../syscalls.s/getresuid.S"
+#include "../syscalls.s/getrlimit.S"
+#include "../syscalls.s/getrusage.S"
+#include "../syscalls.s/getsid.S"
+#include "../syscalls.s/gettimeofday.S"
+#include "../syscalls.s/ioperm.S"
+#include "../syscalls.s/iopl.S"
+#include "../syscalls.s/ipc.S"
+#include "../syscalls.s/lchown.S"
+#include "../syscalls.s/link.S"
+#include "../syscalls.s/mknod.S"
+#include "../syscalls.s/mlock.S"
+#include "../syscalls.s/mlockall.S"
+#include "../syscalls.s/mount.S"
+#include "../syscalls.s/mremap.S"
+#include "../syscalls.s/munlockall.S"
+#include "../syscalls.s/munmap.S"
+#include "../syscalls.s/n_sigaction.S"
+#include "../syscalls.s/n_sigpending.S"
+#include "../syscalls.s/n_sigprocmask.S"
+#include "../syscalls.s/n_sigsuspend.S"
+#include "../syscalls.s/nice.S"
+#include "../syscalls.s/pause.S"
+#include "../syscalls.s/personality.S"
+#include "../syscalls.s/query_module.S"
+#include "../syscalls.s/init_module.S"
+#include "../syscalls.s/delete_module.S"
+#include "../syscalls.s/create_module.S"
+#include "../syscalls.s/readlink.S"
+#include "../syscalls.s/rename.S"
+#include "../syscalls.s/rmdir.S"
+#include "../syscalls.s/rt_sigaction.S"
+#include "../syscalls.s/rt_sigpending.S"
+#include "../syscalls.s/rt_sigprocmask.S"
+#include "../syscalls.s/rt_sigqueueinfo.S"
+#include "../syscalls.s/rt_sigsuspend.S"
+#include "../syscalls.s/rt_sigtimedwait.S"
+#include "../syscalls.s/sched_get_priority_max.S"
+#include "../syscalls.s/sched_get_priority_min.S"
+#include "../syscalls.s/sched_getparam.S"
+#include "../syscalls.s/sched_getscheduler.S"
+#include "../syscalls.s/sched_rr_get_interval.S"
+#include "../syscalls.s/sched_setparam.S"
+#include "../syscalls.s/sched_setscheduler.S"
+#include "../syscalls.s/sched_yield.S"
+#include "../syscalls.s/sendfile.S"
+#include "../syscalls.s/setdomainname.S"
+#include "../syscalls.s/setfsgid.S"
+#include "../syscalls.s/setfsuid.S"
+#include "../syscalls.s/setgid.S"
+#include "../syscalls.s/setgroups.S"
+#include "../syscalls.s/sethostname.S"
+#include "../syscalls.s/setitimer.S"
+#include "../syscalls.s/setpgid.S"
+#include "../syscalls.s/setpriority.S"
+#include "../syscalls.s/setregid.S"
+#include "../syscalls.s/setresgid.S"
+#include "../syscalls.s/setresuid.S"
+#include "../syscalls.s/setreuid.S"
+#include "../syscalls.s/setrlimit.S"
+#include "../syscalls.s/setsid.S"
+#include "../syscalls.s/setuid.S"
+#include "../syscalls.s/sigaltstack.S"
+#include "../syscalls.s/statfs.S"
+#include "../syscalls.s/stime.S"
+#include "../syscalls.s/swapoff.S"
+#include "../syscalls.s/swapon.S"
+#include "../syscalls.s/symlink.S"
+#include "../syscalls.s/sync.S"
+#include "../syscalls.s/sysctl.S"
+#include "../syscalls.s/sysinfo.S"
+#include "../syscalls.s/syslog.S"
+#include "../syscalls.s/time.S"
+#include "../syscalls.s/times.S"
+#include "../syscalls.s/umount.S"
+#include "../syscalls.s/umount2.S"
+#include "../syscalls.s/uname.S"
+#include "../syscalls.s/unlink.S"
+#include "../syscalls.s/utime.S"
+#include "../syscalls.s/vhangup.S"
+
+#include "../syscalls.s/chown32.S"
+#include "../syscalls.s/fchown32.S"
+#include "../syscalls.s/getegid32.S"
+#include "../syscalls.s/geteuid32.S"
+#include "../syscalls.s/getgid32.S"
+#include "../syscalls.s/getgroups32.S"
+#include "../syscalls.s/getresgid32.S"
+#include "../syscalls.s/getuid32.S"
+#include "../syscalls.s/lchown32.S"
+#include "../syscalls.s/setfsgid32.S"
+#include "../syscalls.s/setfsuid32.S"
+#include "../syscalls.s/setgid32.S"
+#include "../syscalls.s/setregid32.S"
+#include "../syscalls.s/setresgid32.S"
+#include "../syscalls.s/setreuid32.S"
+#include "../syscalls.s/setuid32.S"
+#include "../syscalls.s/alarm.S"
+#include "../syscalls.s/ptrace.S"
+#include "../syscalls.s/truncate64.S"
+#include "../syscalls.s/ftruncate64.S"
+#include "../syscalls.s/epoll_create.S"
+#include "../syscalls.s/epoll_ctl.S"
+#include "../syscalls.s/epoll_wait.S"
+
+#undef __PIC__
+#undef __socketcall
+/* oh what a kludge! */
+#define socketcall .Lsocketcall
+#include "../i386/send.S"
+#include "../i386/recv.S"
+#include "../i386/socket.S"
+#include "../i386/accept.S"
+#include "../i386/shutdown.S"
+#include "../i386/socketpair.S"
+#include "../i386/setsockopt.S"
+#include "../i386/sendto.S"
+#include "../i386/sendmsg.S"
+#include "../i386/recvmsg.S"
+#include "../i386/recvfrom.S"
+#include "../i386/listen.S"
+#include "../i386/getsockopt.S"
+#include "../i386/getsockname.S"
+#include "../i386/getpeername.S"
+#include "../i386/connect.S"
+#include "../i386/bind.S"
+#undef socketcall
+.Lsocketcall:
+#include "../i386/socketcall.S"
+#define __PIC__
+#undef __socketcall
+
+
+/* so now this was the last u.s.c. */
+
+/* other asm-files ... */
+#define PIC
+
+#define _exit __exit
+#include "clone.S"
+#undef _exit
+
+#include "__longjmp.S"
+#include "setjmp.S"
diff --git a/mdk-stage1/dietlibc/i386/exp.S b/mdk-stage1/dietlibc/i386/exp.S
new file mode 100644
index 000000000..6c82128e4
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/exp.S
@@ -0,0 +1,35 @@
+.text
+
+.global expf,exp,expl,__finexp
+ .type expf,@function
+ .type exp,@function
+ .type expl,@function
+ .type __finexp,@function
+expf:
+ fldl2e
+ fmuls 4(%esp)
+ jmp __finexp
+expl:
+ fldl2e
+ fldt 4(%esp)
+ fmulp
+ jmp __finexp
+exp:
+ fldl2e
+ fmull 4(%esp)
+__finexp:
+ fst %st(1)
+ frndint
+ fst %st(2)
+ fsubrp
+ f2xm1
+ fld1
+ faddp
+ fscale
+ ret
+
+.Lende:
+.size exp,.Lende-exp
+.size expl,.Lende-expl
+.size expf,.Lende-expf
+.size __finexp,.Lende-__finexp
diff --git a/mdk-stage1/dietlibc/i386/exp10.S b/mdk-stage1/dietlibc/i386/exp10.S
new file mode 100644
index 000000000..6223e5f85
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/exp10.S
@@ -0,0 +1,27 @@
+
+.text
+.type exp10,@function
+.global exp10
+.type pow10,@function
+.global pow10
+
+
+pow10:
+exp10: # note: 10^(x) = 2^(x*log2(10))
+ fldl2t
+ fmull 4(%esp) # x*log2(10)
+ fld %st(0) # x*log2(10) x*log2(10)
+ frndint # int(x*log2(10)) x*log2(10)
+ fxch # x*log2(10) int(x*log2(10))
+ fsub %st(1),%st(0) # frac(x*log2(10)) int(x*log2(10))
+ f2xm1 # 2^(fract(x*log2(10)))-1 int(x*log2(10))
+ fld1 # 1 2^(fract(x*log2(10)))-1 int(x*log2(10))
+ faddp %st(0),%st(1) # 2^(fract(x*log2(10))) int(x*log2(10))
+ fscale # 2^(x*log2(10)) int(x*log2(10))
+ fstp %st(1) # 2^(x*log2(10))
+ ret
+
+.ende:
+
+.size exp10,.ende-exp10
+.size pow10,.ende-pow10
diff --git a/mdk-stage1/dietlibc/i386/exp2.S b/mdk-stage1/dietlibc/i386/exp2.S
new file mode 100644
index 000000000..d5389a22e
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/exp2.S
@@ -0,0 +1,18 @@
+.text
+.type exp2,@function
+.global exp2
+exp2: # note: exp2(x) = 2^x
+ fldl 4(%esp) # x
+ fld %st(0) # x x
+ frndint # int(x) x
+ fxch # x int(x)
+ fsub %st(1),%st(0) # frac(x) int(x)
+ f2xm1 # 2^(fract(x))-1 int(x)
+ fld1 # 1 2^(fract(x))-1 int(x)
+ faddp %st(0),%st(1) # 2^(fract(x)) int(x)
+ fscale # 2^x int(x)
+ fstp %st(1) # 2^x
+ ret
+
+.ende:
+.size exp2,.ende-exp2
diff --git a/mdk-stage1/dietlibc/i386/expm1.S b/mdk-stage1/dietlibc/i386/expm1.S
new file mode 100644
index 000000000..677f4723f
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/expm1.S
@@ -0,0 +1,23 @@
+.text
+.type expm1,@function
+.global expm1
+expm1: # note: exp(x) = 2^(x*log2(e))
+ fldl2e
+ fmull 4(%esp) # x*log2(e)
+ fld %st(0) # x*log2(e) x*log2(e)
+ frndint # int(x*log2(e)) x*log2(e)
+ fxch # x*log2(e) int(x*log2(e))
+ fsub %st(1),%st(0) # frac(x*log2(e)) int(x*log2(e))
+ f2xm1 # 2^(fract(x*log2(e)))-1 int(x*log2(e))
+ fscale # 2^(x*log2(e))-2^int(x*log2(e)) int(x*log2(e))
+ fxch # int(x*log2(e)) 2^(x*log2(e))-2^int(x*log2(e))
+ fld1 # 1 int(x*log2(e)) 2^(x*log2(e))-2^int(x*log2(e))
+ fscale # 2^int(x*log2(e)) int(x*log2(e)) 2^(x*log2(e))-2^int(x*log2(e))
+ fstp %st(1) # 2^int(x*log2(e)) 2^(x*log2(e))-2^int(x*log2(e))
+ fld1 # 1 2^int(x*log2(e)) 2^(x*log2(e))-2^int(x*log2(e))
+ fsubrp %st(1) # 2^int(x*log2(e))-1 2^(x*log2(e))-2^int(x*log2(e))
+ faddp %st(1)
+ ret
+
+.ende:
+.size expm1,.ende-expm1
diff --git a/mdk-stage1/dietlibc/i386/fabs.S b/mdk-stage1/dietlibc/i386/fabs.S
new file mode 100644
index 000000000..d9c1c2212
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/fabs.S
@@ -0,0 +1,11 @@
+
+.text
+.type fabs,@function
+.global fabs
+fabs:
+ fldl 4(%esp)
+ fabs
+ ret
+
+.ende:
+.size fabs,.ende-fabs
diff --git a/mdk-stage1/dietlibc/i386/floor.S b/mdk-stage1/dietlibc/i386/floor.S
new file mode 100644
index 000000000..af26d0c94
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/floor.S
@@ -0,0 +1,26 @@
+.text
+
+.global floorf,floor,floorl
+ .type floorf,@function
+ .type floor,@function
+ .type floorf,@function
+
+floorf:
+ flds 4(%esp)
+ movb $0x04,%ah
+ jmp __flcetr
+
+floor:
+ fldl 4(%esp)
+ movb $0x04,%ah
+ jmp __flcetr
+
+floorl:
+ fldt 4(%esp)
+ movb $0x04,%ah
+ jmp __flcetr
+
+.Lende:
+.size floor,.Lende-floor
+.size floorl,.Lende-floorl
+.size floorf,.Lende-floorf
diff --git a/mdk-stage1/dietlibc/i386/fmod.S b/mdk-stage1/dietlibc/i386/fmod.S
new file mode 100644
index 000000000..5bf4c06ab
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/fmod.S
@@ -0,0 +1,37 @@
+.text
+.type fmod,@function
+.type fmodf,@function
+.type fmodl,@function
+.type __fmod2pi,@function
+.global fmod, fmodl, fmodf, __fmod2pi
+
+__fmod2pi:
+ fldpi
+ fadd %st(0)
+ fxch
+ jmp .Lfmod
+
+fmodf:
+ flds 8(%esp) # y
+ flds 4(%esp) # x
+ jmp .Lfmod
+fmod:
+ fldl 12(%esp)
+ fldl 4(%esp)
+.Lfmod:
+ fprem
+ fstsw %ax
+ sahf
+ jp .Lfmod
+ ret
+
+fmodl:
+ fldt 16(%esp)
+ fldt 4(%esp)
+ jmp .Lfmod
+
+
+.ende:
+.size fmod,.ende-fmod
+.size fmodl,.ende-fmodl
+.size fmodf,.ende-fmodf
diff --git a/mdk-stage1/dietlibc/i386/getenv.S b/mdk-stage1/dietlibc/i386/getenv.S
new file mode 100644
index 000000000..dafbf37ee
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/getenv.S
@@ -0,0 +1,48 @@
+#include "PIC.h"
+
+.text
+.global getenv
+.type getenv,@function
+getenv:
+ pushl %esi
+ pushl %edi
+ movl 0xc(%esp), %edi
+ cld
+ movl %edi, %edx
+ xorl %eax, %eax
+ leal -1(%eax), %ecx
+ repnz scasb
+ not %ecx
+ dec %ecx
+ pushl %ecx
+ movl (%edx), %ecx
+
+ GET_1VAR environ, %esi # non-PIC: movl environ, %esi
+ jmp .Lloop
+
+.Lprepare:
+ movl (%edx), %ecx
+ movl %eax, %esi
+.Lloop:
+ lodsl
+ or %eax, %eax
+ jz .Lout
+ cmpb %cl, (%eax)
+ jnz .Lloop
+
+ movl %edx, %edi
+ xchg %esi, %eax
+ movl (%esp), %ecx
+ repz cmpsb
+ jne .Lprepare
+ or %ecx, %ecx
+ jnz .Lprepare
+ cmpb $'=', (%esi)
+ jne .Lprepare
+ leal 0x1(%esi), %eax
+.Lout:
+ popl %ecx
+ popl %edi
+ popl %esi
+ ret
+.size getenv, . - getenv
diff --git a/mdk-stage1/dietlibc/i386/getpeername.S b/mdk-stage1/dietlibc/i386/getpeername.S
new file mode 100644
index 000000000..833322941
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/getpeername.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(getpeername,GETPEERNAME)
diff --git a/mdk-stage1/dietlibc/i386/getsockname.S b/mdk-stage1/dietlibc/i386/getsockname.S
new file mode 100644
index 000000000..f0618481c
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/getsockname.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(getsockname,GETSOCKNAME)
diff --git a/mdk-stage1/dietlibc/i386/getsockopt.S b/mdk-stage1/dietlibc/i386/getsockopt.S
new file mode 100644
index 000000000..23d7c2470
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/getsockopt.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(getsockopt,GETSOCKOPT)
diff --git a/mdk-stage1/dietlibc/i386/htonl.S b/mdk-stage1/dietlibc/i386/htonl.S
new file mode 100644
index 000000000..f3732d16a
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/htonl.S
@@ -0,0 +1,13 @@
+.text
+.global htonl
+.type htonl,@function
+.global ntohl
+.type ntohl,@function
+
+htonl:
+ntohl:
+ movl 4(%esp),%eax
+ xchgb %al,%ah
+ rorl $16,%eax
+ xchgb %al,%ah
+ ret
diff --git a/mdk-stage1/dietlibc/i386/htons.S b/mdk-stage1/dietlibc/i386/htons.S
new file mode 100644
index 000000000..367d6d03c
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/htons.S
@@ -0,0 +1,11 @@
+.text
+.global htons
+.type htons,@function
+.global ntohs
+.type ntohs,@function
+
+htons:
+ntohs:
+ movzwl 4(%esp),%eax
+ xchgb %al,%ah
+ ret
diff --git a/mdk-stage1/dietlibc/i386/hypot.S b/mdk-stage1/dietlibc/i386/hypot.S
new file mode 100644
index 000000000..730b2c5c9
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/hypot.S
@@ -0,0 +1,15 @@
+
+.text
+.type hypot,@function
+.global hypot
+hypot:
+ fldl 4(%esp)
+ fmul %st(0),%st(0)
+ fldl 12(%esp)
+ fmul %st(0),%st(0)
+ faddp
+ fsqrt
+ ret
+
+.ende:
+.size hypot,.ende-hypot
diff --git a/mdk-stage1/dietlibc/i386/ilogb.S b/mdk-stage1/dietlibc/i386/ilogb.S
new file mode 100644
index 000000000..3bebd88ba
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/ilogb.S
@@ -0,0 +1,23 @@
+#
+# int ilogb ( double x );
+#
+# returns (int) log2 (fabs(x)) for x!=0
+# returns MIN_INT for x==0
+#
+
+.text
+.global ilogb
+.type ilogb,@function
+
+ilogb:
+ movl 8(%esp),%eax
+ addl %eax,%eax
+ jz .Lzero
+ shrl $21,%eax
+ subl $1023,%eax
+ ret
+
+.Lzero:
+ stc
+ rcrl %eax
+ ret
diff --git a/mdk-stage1/dietlibc/i386/ipow.S b/mdk-stage1/dietlibc/i386/ipow.S
new file mode 100644
index 000000000..cca6a0ce1
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/ipow.S
@@ -0,0 +1,27 @@
+#
+# This is not standard, but often you only need such this function
+# which is much shorter than the generic pow() function.
+#
+# double ipow ( double mant, int expo );
+#
+
+.text
+.global ipow
+.type ipow,@function
+
+ipow: fld1
+ movl 12(%esp),%ecx
+ fldl 4(%esp)
+ and %ecx,%ecx
+ jns .Lstart
+ negl %ecx
+ fdivr %st(1),%st(0)
+ jmp .Lstart
+
+.Lnext: fmul %st(0),%st(0)
+.Lstart:shrl %ecx
+ jnc .Lnomul
+ fmul %st(0),%st(1)
+.Lnomul:jnz .Lnext
+ fcomp
+ ret
diff --git a/mdk-stage1/dietlibc/i386/isleap.S b/mdk-stage1/dietlibc/i386/isleap.S
new file mode 100644
index 000000000..28d1ee0ce
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/isleap.S
@@ -0,0 +1,28 @@
+.text
+.globl __isleap
+.type __isleap,@function
+
+__isleap:
+ movl 4(%esp),%eax
+ testb $3,%al
+ jne .Lretzero
+#if 1
+ movb $100,%cl /* this works only for 0 a.D. ... 25599 a.C. */
+ divb %cl
+ andb %ah,%ah
+#else
+ cltd /* This works for 2147483648 b.C. ... 2147483647 a.C. */
+ movl $100,%ecx
+ divl %ecx
+ andl %edx,%edx
+#endif
+ jne .Lretone
+ testb $3,%al
+ jne .Lretzero
+.Lretone: xorl %eax,%eax
+ incl %eax
+ ret
+
+.Lretzero:xorl %eax,%eax
+ ret
+
diff --git a/mdk-stage1/dietlibc/i386/ldexp.S b/mdk-stage1/dietlibc/i386/ldexp.S
new file mode 100644
index 000000000..51d9bae89
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/ldexp.S
@@ -0,0 +1,28 @@
+.text
+.global ldexpf,ldexp,ldexpl
+ .type ldexpf,@function
+ .type ldexp,@function
+ .type ldexpl,@function
+
+ldexpf:
+ fildl 8(%esp)
+ flds 4(%esp)
+ fscale
+ ret
+
+ldexp:
+ fildl 12(%esp)
+ fldl 4(%esp)
+ fscale
+ ret
+
+ldexpl:
+ fildl 16(%esp)
+ fldt 4(%esp)
+ fscale
+ ret
+
+.ende:
+.size ldexpl,.ende-ldexpl
+.size ldexp,ldexpl-ldexp
+.size ldexpf,ldexp-ldexpf
diff --git a/mdk-stage1/dietlibc/i386/libm2.S b/mdk-stage1/dietlibc/i386/libm2.S
new file mode 100644
index 000000000..91c4437cd
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/libm2.S
@@ -0,0 +1,643 @@
+.text
+#d.half:
+# .long 0x3f000000 # 1/2
+#d.log1p:
+# .long 0x3ed413cc # < sqrt(2)-1-2^(-25)
+
+.global fabsf,fabs,fabsl
+ .type fabsf,@function
+ .type fabs,@function
+ .type fabsl,@function
+fabsf:
+ flds 4(%esp)
+ fabs
+ ret
+fabs:
+ fldl 4(%esp)
+ fabs
+ ret
+fabsl:
+ fldt 4(%esp)
+ fabs
+ ret
+
+.global sincosf,sincos,sincosl
+.type sincosf,@function
+.type sincos,@function
+.type sincosl,@function
+# void sincos ( double x, double* sinx, double* cosx );
+
+sincosf:
+ flds 4(%esp)
+ call __fmod2pi
+ movl 12(%esp),%eax
+ movl 8(%esp),%ecx
+ fsincos
+ fstps (%eax)
+ fstps (%ecx)
+ ret
+sincos:
+ fldl 4(%esp)
+ call __fmod2pi
+ movl 16(%esp),%eax
+ movl 12(%esp),%ecx
+ fsincos
+ fstpl (%eax)
+ fstpl (%ecx)
+ ret
+sincosl:
+ fldt 4(%esp)
+ call __fmod2pi
+ movl 20(%esp),%eax
+ movl 16(%esp),%ecx
+ fsincos
+ fstpt (%eax)
+ fstpt (%ecx)
+ ret
+
+.global tanf,tan,tanl
+.type tanf,@function
+.type tan,@function
+.type tanl,@function
+tanf:
+ flds 4(%esp)
+ jmp __tan
+tan:
+ fldl 4(%esp)
+__tan:
+ call __fmod2pi
+ fsincos
+ fdivrp
+ ret
+tanl:
+ fldt 4(%esp)
+ jmp __tan
+
+.global atan2f,atan2,atan2l
+ .type atan2f,@function
+ .type atan2,@function
+ .type atan2l,@function
+atan2f:
+ flds 4(%esp)
+ flds 8(%esp)
+ fpatan
+ ret
+atan2l:
+ fldt 4(%esp)
+ fldt 16(%esp)
+ fpatan
+ ret
+atan2:
+ fldl 4(%esp)
+ fldl 12(%esp)
+ fpatan
+ ret
+
+.global cbrtf,cbrt,cbrtl
+ .type cbrtf,@function
+ .type cbrt,@function
+ .type cbrtl,@function
+cbrtf:
+ flds 4(%esp)
+ jmp __cbrt
+cbrtl:
+ fldt 4(%esp)
+ jmp __cbrt
+cbrt:
+ fldl 4(%esp)
+# fldt 1/3
+__cbrt:
+ pushl $0x00003ffd # yes, this method of loading 1/3
+ pushl $0xaaaaaaaa # is shorter than keeping the data
+ pushl $0xaaaaaaab # separate
+ fldt (%esp)
+ addl $12,%esp
+ fxch # st(0)=x, st(1)=1/3
+ ftst
+ fstsw %ax
+ sahf
+ jz 1f
+ jnc finpow
+ fchs
+ call finpow
+ fchs
+1: ret
+
+# x^y; st(0)=x, st(1)=y (x > 0)
+finpow:
+ fyl2x
+ jmp __finexp
+
+.global exp2f,exp2,exp2l
+ .type exp2f,@function
+ .type exp2,@function
+ .type exp2l,@function
+exp2f:
+ flds 4(%esp)
+ jmp __finexp
+exp2:
+ fldl 4(%esp)
+ jmp __finexp
+exp2l:
+ fldt 4(%esp)
+ jmp __finexp
+
+.global exp10f,exp10,exp10l #,pow10f,pow10,pow10l
+ .type exp10f,@function
+ .type exp10,@function
+ .type exp10l,@function
+# .type pow10f,@function
+# .type pow10,@function
+# .type pow10l,@function
+exp10f:
+#pow10f:
+ fldl2t
+ fmuls 4(%esp)
+ jmp __finexp
+exp10:
+#pow10:
+ fldl2t
+ fmull 4(%esp)
+ jmp __finexp
+exp10l:
+#pow10l:
+ fldl2t
+ fldt 4(%esp)
+ fmulp
+ jmp __finexp
+
+# exp(x)-1
+.global expm1f,expm1,expm1l
+ .type expm1f,@function
+ .type expm1,@function
+ .type expm1l,@function
+expm1f:
+ fldl2e
+ fmuls 4(%esp)
+ jmp finem1
+expm1l:
+ fldl2e
+ fldt 4(%esp)
+ fmulp
+ jmp finem1
+expm1:
+ fldl2e
+ fmull 4(%esp)
+# -1 <= st <= 1 ?
+finem1:
+ fst %st(1) # st(1)=st(0)
+ fabs
+ fld1
+ fcompp
+ fstsw %ax
+ sahf
+# |x| >= 1
+ jc 1f
+ f2xm1
+ ret
+1: call __finexp
+ fld1
+ fsubrp
+ ret
+
+# sinh(x)=(exp(x)-exp(-x))/2
+# cosh(x)=(exp(x)+exp(-x))/2
+# tanh(x)=sinh(x)/cosh(x)
+.global sinhf,sinh,sinhl
+ .type sinhf,@function
+ .type sinh,@function
+ .type sinhl,@function
+sinhf:
+ fldl2e
+ fmuls 4(%esp)
+ jmp finsinh
+sinh:
+ fldl2e
+ fmull 4(%esp)
+finsinh:
+ call __finexp
+ fld1
+ fdiv %st(1),%st(0) # st(0)=1/exp(x), st(1)=exp(x)
+ fsubrp %st(0),%st(1)
+ pushl $0x3f000000 # 1/2
+ flds (%esp)
+ popl %eax
+ fmulp
+ ret
+
+sinhl:
+ fldl2e
+ fldt 4(%esp)
+ fmulp
+ jmp finsinh
+
+.global coshf,cosh,coshl
+ .type coshf,@function
+ .type cosh,@function
+ .type coshl,@function
+coshf:
+ fldl2e
+ fmuls 4(%esp)
+ jmp fincosh
+cosh:
+ fldl2e
+ fmull 4(%esp)
+fincosh:
+ call __finexp
+ fld1
+ fdiv %st(1),%st(0) # st(0)=1/exp(x), st(1)=exp(x)
+ faddp %st,%st(1)
+ pushl $0x3f000000 # 1/2
+ flds (%esp)
+ popl %eax
+ fmulp
+ ret
+
+coshl:
+ fldl2e
+ fldt 4(%esp)
+ fmulp
+ jmp fincosh
+
+.global tanhf,tanh,tanhl
+ .type tanhf,@function
+ .type tanh,@function
+ .type tanhl,@function
+tanhf:
+ fldl2e
+ fmuls 4(%esp)
+ call __finexp
+ jmp fintanh
+tanh:
+ fldl2e
+ fmull 4(%esp)
+ call __finexp
+fintanh:
+ fld1
+ fdiv %st(1),%st # st(0)=1/exp(x), st(1)=exp(x)
+ fst %st(2) # st(2)=1/exp(x)
+ fadd %st(1),%st(0)
+ fstp %st(3) # st(2)=exp(x)+exp(-x), st(1)=exp(-x), st(0)=exp(x)
+ fsubp # st(1)=exp(x)+exp(-x), st(0)=exp(x)-exp(-x)
+ fdivp
+ ret
+
+tanhl:
+ fldl2e
+ fldt 4(%esp)
+ fmulp
+ call __finexp
+ jmp fintanh
+
+.global hypotf,hypot,hypotl # ,__hypot
+ .type hypotf,@function
+ .type hypot,@function
+ .type hypotl,@function
+# .type __hypot,@function
+hypotf:
+ flds 8(%esp)
+ flds 4(%esp)
+ jmp __hypot
+hypotl:
+ fldt 16(%esp)
+ fldt 4(%esp)
+ jmp __hypot
+hypot:
+ fldl 12(%esp)
+ fldl 4(%esp)
+__hypot:
+ fmul %st(0),%st(0)
+ fxch
+ fmul %st(0),%st(0)
+ faddp
+ fsqrt
+ ret
+
+.global log1pf,log1p,log1pl
+ .type log1pf,@function
+ .type log1p,@function
+ .type log1pl,@function
+log1pf:
+ flds 4(%esp)
+ jmp __log1p
+log1pl:
+ fldt 4(%esp)
+ jmp __log1p
+log1p:
+ fldl 4(%esp)
+__log1p:
+# Sprawdzenie zakresu parametru
+ fst %st(1)
+ pushl $0x3ed413cc # sqrt(2)-1-2^(-25)
+ fabs
+ flds (%esp)
+ popl %eax
+ fcompp # porownanie
+ fstsw %ax
+ fldln2
+ fxch
+ sahf
+# |x| >= sqrt(2)-1
+ jc 1f
+ fyl2xp1
+ ret
+1: fld1 # x = x + 1
+ faddp
+ fyl2x
+ ret
+
+.global log10f,log10,log10l
+ .type log10f,@function
+ .type log10,@function
+ .type log10l,@function
+log10f:
+ fldlg2
+ flds 4(%esp)
+ fyl2x
+ ret
+log10l:
+ fldlg2
+ fldt 4(%esp)
+ fyl2x
+ ret
+log10:
+ fldlg2
+ fldl 4(%esp)
+ fyl2x
+ ret
+
+.global log2f,log2,log2l
+ .type log2f,@function
+ .type log2,@function
+ .type log2l,@function
+log2f:
+ fld1
+ flds 4(%esp)
+ fyl2x
+ ret
+log2l:
+ fld1
+ fldt 4(%esp)
+ fyl2x
+ ret
+log2:
+ fld1
+ fldl 4(%esp)
+ fyl2x
+ ret
+
+.global fmaf,fma,fmal
+ .type fmaf,@function
+ .type fma,@function
+ .type fmal,@function
+fmaf:
+ flds 4(%esp)
+ fmuls 8(%esp)
+ fadds 12(%esp)
+ ret
+fma:
+ fldl 4(%esp)
+ fmull 12(%esp)
+ faddl 20(%esp)
+ ret
+fmal:
+ fldt 4(%esp)
+ fldt 16(%esp)
+ fmulp %st,%st(1)
+ fldt 28(%esp)
+ faddp %st,%st(1)
+ ret
+
+.global asinhf,asinh,asinhl
+ .type asinhf,@function
+ .type asinh,@function
+ .type asinhl,@function
+asinhf:
+ flds 4(%esp)
+ jmp __asinh
+asinh:
+ fldl 4(%esp)
+__asinh:
+ fld %st(0)
+ fmul %st(0),%st(0)
+ fld1
+ faddp %st(0),%st(1)
+finasch:
+ fsqrt
+ faddp %st(0),%st(1)
+ fldln2
+ fxch
+ fyl2x
+ ret
+asinhl:
+ fldt 4(%esp)
+ jmp __asinh
+
+.global acoshf,acosh,acoshl
+ .type acoshf,@function
+ .type acosh,@function
+ .type acoshl,@function
+acoshf:
+ flds 4(%esp)
+ jmp __acosh
+acosh:
+ fldl 4(%esp)
+__acosh:
+ fld %st(0)
+ fmul %st(0),%st(0)
+ fld1
+ fsubrp %st(0),%st(1) # st1=st1-st0; pop
+ jmp finasch
+acoshl:
+ fldt 4(%esp)
+ jmp __acosh
+
+.global atanhf,atanh,atanhl
+ .type atanhf,@function
+ .type atanh,@function
+ .type atanhl,@function
+atanhf:
+ flds 4(%esp)
+ jmp __atanh
+atanh:
+ fldl 4(%esp)
+__atanh:
+ fst %st(1)
+ fld1 # st0=1, st1=x, st2=x
+ fadd %st(0),%st(2) # st0=1, st1=x, st2=x+1
+ fsubp %st(0),%st(1) # st0=1-x, st1=x+1
+ fdivrp %st(0),%st(1)
+ fsqrt
+ fldln2
+ fxch
+ fyl2x
+ ret
+atanhl:
+ fldt 4(%esp)
+ jmp __atanh
+
+.global dremf,drem,dreml
+ .type dremf,@function
+ .type drem,@function
+ .type dreml,@function
+dremf:
+ flds 8(%esp) # y
+ flds 4(%esp) # x
+ jmp __drem
+drem:
+ fldl 12(%esp)
+ fldl 4(%esp)
+__drem:
+ fprem1
+ fstsw %ax
+ sahf
+ jp __drem
+ ret
+
+dreml:
+ fldt 16(%esp)
+ fldt 4(%esp)
+ jmp __drem
+
+# |ret| = |x|, sign(ret) = sign(y)
+.global copysignf,copysign,copysignl
+ .type copysignf,@function
+ .type copysign,@function
+ .type copysignl,@function
+copysignf:
+ flds 4(%esp) # x
+ flds 8(%esp) # y
+ jmp __copysign
+copysign:
+ fldl 4(%esp)
+ fldl 12(%esp)
+__copysign:
+ fmul %st(1),%st # st = x*y
+ ftst
+ fstsw %ax
+ fincstp
+ sahf
+ jnc 1f
+ fchs
+1: ret
+
+copysignl:
+ fldt 4(%esp)
+ fldt 16(%esp)
+ jmp __copysign
+
+.global fdimf,fdim,fdiml
+ .type fdimf,@function
+ .type fdim,@function
+ .type fdiml,@function
+fdimf:
+ flds 4(%esp)
+ fsubl 12(%esp)
+ jmp __fdim
+fdim:
+ fldl 4(%esp)
+ fsubl 12(%esp)
+__fdim:
+ fstsw %ax
+ sahf
+ jnc 1f
+ fldz
+1: ret
+fdiml:
+ fldt 4(%esp)
+ fldt 16(%esp)
+ fsubp
+ jmp __fdim
+
+
+.global truncf,trunc,truncl
+ .type truncf,@function
+ .type trunc,@function
+ .type truncl,@function
+
+truncf:
+ flds 4(%esp)
+ movb $0x0c,%ah
+ jmp __flcetr
+
+trunc:
+ fldl 4(%esp)
+ movb $0x0c,%ah
+ jmp __flcetr
+
+truncl:
+ fldt 4(%esp)
+ movb $0x0c,%ah
+ jmp __flcetr
+
+.global frexpf,frexp,frexpl
+ .type frexpf,@function
+ .type frexp,@function
+ .type frexpl,@function
+
+frexpf:
+ flds 4(%esp)
+ movl 8(%esp),%eax
+ jmp __frexp
+
+frexp:
+ fldl 4(%esp)
+ movl 12(%esp),%eax
+__frexp:
+ fxtract
+ fxch
+ fistpl (%eax)
+ pushl $0x3f000000 # 1/2
+ fmuls (%esp)
+ incl (%eax)
+ popl %eax
+ ret
+
+frexpl:
+ fldt 4(%esp)
+ movl 16(%esp),%eax
+ jmp __frexp
+
+.global logbf,logb,logbl
+ .type logbf,@function
+ .type logb,@function
+ .type logbl,@function
+
+#logbf: flds 4(%esp)
+# fxtract
+# fxch
+# ret
+
+#logb: fldl 4(%esp)
+# fxtract
+# fxch
+# ret
+
+#logbl: fldt 4(%esp)
+# fxtract
+# fxch
+# ret
+
+.global ilogbf,ilogb,ilogbl
+ .type ilogbf,@function
+ .type ilogb,@function
+ .type ilogbl,@function
+
+logbf:
+ilogbf: flds 4(%esp)
+ jmp __ilogb
+
+logb:
+ilogb: fldl 4(%esp)
+__ilogb:
+ fxtract
+ pushl %eax
+ fxch
+ fistl (%esp)
+ popl %eax
+ ret
+
+logbl:
+ilogbl: fldt 4(%esp)
+ jmp __ilogb
+
diff --git a/mdk-stage1/dietlibc/i386/listen.S b/mdk-stage1/dietlibc/i386/listen.S
new file mode 100644
index 000000000..a0879be37
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/listen.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(listen,LISTEN)
diff --git a/mdk-stage1/dietlibc/i386/log.S b/mdk-stage1/dietlibc/i386/log.S
new file mode 100644
index 000000000..0d42c9297
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/log.S
@@ -0,0 +1,26 @@
+.text
+
+.global logf,log,logl
+ .type logf,@function
+ .type log,@function
+ .type logl,@function
+logf:
+ fldln2
+ flds 4(%esp)
+ fyl2x
+ ret
+logl:
+ fldln2
+ fldt 4(%esp)
+ fyl2x
+ ret
+log:
+ fldln2
+ fldl 4(%esp)
+ fyl2x
+ ret
+
+.Lende:
+.size log,.Lende-log
+.size logl,.Lende-logl
+.size logf,.Lende-logf
diff --git a/mdk-stage1/dietlibc/i386/log10.S b/mdk-stage1/dietlibc/i386/log10.S
new file mode 100644
index 000000000..dcd08cc3f
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/log10.S
@@ -0,0 +1,11 @@
+.text
+.type log10,@function
+.global log10
+log10:
+ fldlg2
+ fldl 4(%esp)
+ fyl2x
+ ret
+
+.ende:
+.size log10,.ende-log10
diff --git a/mdk-stage1/dietlibc/i386/log1p.S b/mdk-stage1/dietlibc/i386/log1p.S
new file mode 100644
index 000000000..4dd2d58b4
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/log1p.S
@@ -0,0 +1,12 @@
+.text
+.type log1p,@function
+.global log1p
+log1p:
+ fldln2
+ fldl 4(%esp)
+ fyl2xp1
+ ret
+
+.ende:
+.size log1p,.ende-log1p
+
diff --git a/mdk-stage1/dietlibc/i386/log2.S b/mdk-stage1/dietlibc/i386/log2.S
new file mode 100644
index 000000000..80e99a8c9
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/log2.S
@@ -0,0 +1,11 @@
+.text
+.type log2,@function
+.global log2
+log2:
+ fld1
+ fldl 4(%esp)
+ fyl2x
+ ret
+
+.ende:
+.size log2,.ende-log2
diff --git a/mdk-stage1/dietlibc/i386/ltostr.S b/mdk-stage1/dietlibc/i386/ltostr.S
new file mode 100644
index 000000000..ddf85a4f6
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/ltostr.S
@@ -0,0 +1,62 @@
+/*
+ Copyright (C) 2002 Thomas M. Ogrisegg
+
+ __ltostr.S -- convert an integer into a string
+
+ %eax = dividend
+ %ebx = divisor
+ %ecx = size of output-buffer
+ %edi = output-buffer
+ %ebp = if uppercase is set, then %ebp is 'A'-10 else %ebp is 'a'-10
+
+*/
+
+.text
+.globl __ltostr
+__ltostr:
+ pushl %esi
+ pushl %edi # destination
+ pushl %ebp
+ pushl %ebx
+ movl %esp, %eax
+ movl 0x14(%eax), %edi
+ movl 0x18(%eax), %ecx # size
+ movl 0x20(%eax), %ebx # divisor
+ movl 0x1c(%eax), %eax # dividend
+ decl %ecx
+ movl %ecx, %esi
+ movl $('A'-0xa), %ebp
+ xorl %edx, %edx # must be 0 -- used by idiv
+ cmpl $0x0, 36(%esp) # check for uppercase
+ jnz .Lnext
+ addl $0x20, %ebp # set lowercase
+.Lnext:
+ idiv %ebx, %eax
+ cmpb $0x9, %dl
+ jg .Lnext2
+ addb $'0', %dl
+ jmp .Lstos
+.Lnext2:
+ addl %ebp, %edx
+.Lstos:
+ movb %dl, (%edi, %ecx)
+ xorl %edx, %edx
+ decl %ecx
+ jz .Lout
+ orl %eax, %eax
+ jnz .Lnext
+.Lout:
+ cld
+ movl %esi, %ebx
+ leal 1(%edi, %ecx), %esi
+ subl %ebx, %ecx
+ negl %ecx
+ movl %ecx, %eax
+ repnz movsb
+ movb $0x0, (%edi)
+ popl %ebx
+ popl %ebp
+ popl %edi
+ popl %esi
+ ret
+.size __ltostr, . - __ltostr
diff --git a/mdk-stage1/dietlibc/i386/mcount.S b/mdk-stage1/dietlibc/i386/mcount.S
new file mode 100644
index 000000000..11feed5e0
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/mcount.S
@@ -0,0 +1,44 @@
+/*
+ Copyright (C) 2001, 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and
+ modify it under the terms of the GNU General Public
+ Public License.
+
+ mcount.S
+ i386 assembler implementation of mcount
+*/
+
+/* .section ".profile" */
+.text
+.globl mcount
+.type mcount,@function
+mcount:
+/*
+ save all generic registers which
+ might be used by __mcount, but aren't
+ automatically saved
+ */
+ pushl %eax
+ pushl %ecx
+ pushl %edx
+
+/* push the instruction pointer of the calling function */
+ pushl 0xc(%esp)
+
+/* push the instruction pointer of the
+ function that called the calling function */
+ pushl 0x4(%ebp)
+
+ call __mcount
+
+/* clean up stack */
+ addl $0x8, %esp
+
+/* restore the previously saved registers */
+ popl %edx
+ popl %ecx
+ popl %eax
+ ret
+
+.size mcount,.-mcount
diff --git a/mdk-stage1/dietlibc/i386/md5asm.S b/mdk-stage1/dietlibc/i386/md5asm.S
new file mode 100644
index 000000000..a99a92934
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/md5asm.S
@@ -0,0 +1,300 @@
+#define S11 7
+#define S12 12
+#define S13 17
+#define S14 22
+#define S21 5
+#define S22 9
+#define S23 14
+#define S24 20
+#define S31 4
+#define S32 11
+#define S33 16
+#define S34 23
+#define S41 6
+#define S42 10
+#define S43 15
+#define S44 21
+
+
+// #define F(x, y, z) (x & y) + (~x & z) = x&y + (z - z&x) = z + y&x - z&x
+//#define F(x, y, z) movl x,%ebx; movl x,%eax; notl %ebx; andl y,%eax; andl z,%ebx; addl %ebx,%eax
+#define F(x, y, z) movl y,%eax; movl z,%ebx; andl x,%eax; andl x,%ebx; addl z,%eax; subl %ebx,%eax
+
+// #define G(x, y, z) (x & z) + (y & ~z) = x&z + (y - y&z) = y + x&z - y&z
+#define G(x, y, z) movl z,%ebx; movl z,%eax; notl %ebx; andl x,%eax; andl y,%ebx; addl %ebx,%eax
+//#define G(x, y, z) movl x,%eax; movl y,%ebx; andl z,%eax; andl z,%ebx; addl y,%eax; subl %ebx,%eax
+//#define G(x, y, z) movl z,%eax; movl z,%ebx; andl x,%eax; andl y,%ebx; addl y,%eax; subl %ebx,%eax
+
+// #define H(x, y, z) x ^ y ^ z
+#define H(x, y, z) movl z,%eax; xorl y,%eax; xorl x,%eax
+
+// #define I(x, y, z) y ^ (x | ~z)
+#define I(x, y, z) movl z,%eax; notl %eax; orl x,%eax; xorl y,%eax
+
+
+// #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+#define ROTATE_LEFT(x, n) roll $n,x
+
+// #define FF(a, b, c, d, x, s, ac) { (a) += F (b, c, d) + (x) + (word)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+// #define GG(a, b, c, d, x, s, ac) { (a) += G (b, c, d) + (x) + (word)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+// #define HH(a, b, c, d, x, s, ac) { (a) += H (b, c, d) + (x) + (word)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+// #define II(a, b, c, d, x, s, ac) { (a) += I (b, c, d) + (x) + (word)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+
+#define FF(a, b, c, d, x, s, ac) addl x, a; addl $ac,a; F (b, c, d); addl %eax,a; roll $s,a; addl b,a
+#define GG(a, b, c, d, x, s, ac) addl x, a; addl $ac,a; G (b, c, d); addl %eax,a; roll $s,a; addl b,a
+#define HH(a, b, c, d, x, s, ac) addl x, a; addl $ac,a; H (b, c, d); addl %eax,a; roll $s,a; addl b,a
+#define II(a, b, c, d, x, s, ac) addl x, a; addl $ac,a; I (b, c, d); addl %eax,a; roll $s,a; addl b,a
+
+
+// // x is ecx
+// word a = state [0]; // a is edx
+// word b = state [1]; // b is esi
+// word c = state [2]; // c is edi
+// word d = state [3]; // d is ebp
+
+#define X(n) 4*(n)(%ecx)
+#define X0 (%ecx)
+#define a %edx
+#define b %esi
+#define c %edi
+#define d %ebp
+
+
+
+/* MD5 basic transformation: Transforms state based on data block */
+
+// void __MD5Transform ( word state[4], const word* x, size_t repeat )
+
+.text
+.type __MD5Transform, @function
+.align 32
+.global __MD5Transform
+
+ .align 32
+.Lrepeat:
+
+ /* Round 1 */
+ FF (a, b, c, d, X0 , S11, 0xd76aa478); /* 1 */
+ FF (d, a, b, c, X( 1), S12, 0xe8c7b756); /* 2 */
+ FF (c, d, a, b, X( 2), S13, 0x242070db); /* 3 */
+ FF (b, c, d, a, X( 3), S14, 0xc1bdceee); /* 4 */
+ FF (a, b, c, d, X( 4), S11, 0xf57c0faf); /* 5 */
+ FF (d, a, b, c, X( 5), S12, 0x4787c62a); /* 6 */
+ FF (c, d, a, b, X( 6), S13, 0xa8304613); /* 7 */
+ FF (b, c, d, a, X( 7), S14, 0xfd469501); /* 8 */
+ FF (a, b, c, d, X( 8), S11, 0x698098d8); /* 9 */
+ FF (d, a, b, c, X( 9), S12, 0x8b44f7af); /* 10 */
+ FF (c, d, a, b, X(10), S13, 0xffff5bb1); /* 11 */
+ FF (b, c, d, a, X(11), S14, 0x895cd7be); /* 12 */
+ FF (a, b, c, d, X(12), S11, 0x6b901122); /* 13 */
+ FF (d, a, b, c, X(13), S12, 0xfd987193); /* 14 */
+ FF (c, d, a, b, X(14), S13, 0xa679438e); /* 15 */
+ FF (b, c, d, a, X(15), S14, 0x49b40821); /* 16 */
+
+ /* Round 2 */
+ GG (a, b, c, d, X( 1), S21, 0xf61e2562); /* 17 */
+ GG (d, a, b, c, X( 6), S22, 0xc040b340); /* 18 */
+ GG (c, d, a, b, X(11), S23, 0x265e5a51); /* 19 */
+ GG (b, c, d, a, X0 , S24, 0xe9b6c7aa); /* 20 */
+ GG (a, b, c, d, X( 5), S21, 0xd62f105d); /* 21 */
+ GG (d, a, b, c, X(10), S22, 0x02441453); /* 22 */
+ GG (c, d, a, b, X(15), S23, 0xd8a1e681); /* 23 */
+ GG (b, c, d, a, X( 4), S24, 0xe7d3fbc8); /* 24 */
+ GG (a, b, c, d, X( 9), S21, 0x21e1cde6); /* 25 */
+ GG (d, a, b, c, X(14), S22, 0xc33707d6); /* 26 */
+ GG (c, d, a, b, X( 3), S23, 0xf4d50d87); /* 27 */
+ GG (b, c, d, a, X( 8), S24, 0x455a14ed); /* 28 */
+ GG (a, b, c, d, X(13), S21, 0xa9e3e905); /* 29 */
+ GG (d, a, b, c, X( 2), S22, 0xfcefa3f8); /* 30 */
+ GG (c, d, a, b, X( 7), S23, 0x676f02d9); /* 31 */
+ GG (b, c, d, a, X(12), S24, 0x8d2a4c8a); /* 32 */
+
+ /* Round 3 */
+ HH (a, b, c, d, X( 5), S31, 0xfffa3942); /* 33 */
+ HH (d, a, b, c, X( 8), S32, 0x8771f681); /* 34 */
+ HH (c, d, a, b, X(11), S33, 0x6d9d6122); /* 35 */
+ HH (b, c, d, a, X(14), S34, 0xfde5380c); /* 36 */
+ HH (a, b, c, d, X( 1), S31, 0xa4beea44); /* 37 */
+ HH (d, a, b, c, X( 4), S32, 0x4bdecfa9); /* 38 */
+ HH (c, d, a, b, X( 7), S33, 0xf6bb4b60); /* 39 */
+ HH (b, c, d, a, X(10), S34, 0xbebfbc70); /* 40 */
+ HH (a, b, c, d, X(13), S31, 0x289b7ec6); /* 41 */
+ HH (d, a, b, c, X0 , S32, 0xeaa127fa); /* 42 */
+ HH (c, d, a, b, X( 3), S33, 0xd4ef3085); /* 43 */
+ HH (b, c, d, a, X( 6), S34, 0x04881d05); /* 44 */
+ HH (a, b, c, d, X( 9), S31, 0xd9d4d039); /* 45 */
+ HH (d, a, b, c, X(12), S32, 0xe6db99e5); /* 46 */
+ HH (c, d, a, b, X(15), S33, 0x1fa27cf8); /* 47 */
+ HH (b, c, d, a, X( 2), S34, 0xc4ac5665); /* 48 */
+
+ /* Round 4 */
+ II (a, b, c, d, X0 , S41, 0xf4292244); /* 49 */
+ II (d, a, b, c, X( 7), S42, 0x432aff97); /* 50 */
+ II (c, d, a, b, X(14), S43, 0xab9423a7); /* 51 */
+ II (b, c, d, a, X( 5), S44, 0xfc93a039); /* 52 */
+ II (a, b, c, d, X(12), S41, 0x655b59c3); /* 53 */
+ II (d, a, b, c, X( 3), S42, 0x8f0ccc92); /* 54 */
+ II (c, d, a, b, X(10), S43, 0xffeff47d); /* 55 */
+ II (b, c, d, a, X( 1), S44, 0x85845dd1); /* 56 */
+ II (a, b, c, d, X( 8), S41, 0x6fa87e4f); /* 57 */
+ II (d, a, b, c, X(15), S42, 0xfe2ce6e0); /* 58 */
+ II (c, d, a, b, X( 6), S43, 0xa3014314); /* 59 */
+ II (b, c, d, a, X(13), S44, 0x4e0811a1); /* 60 */
+ II (a, b, c, d, X( 4), S41, 0xf7537e82); /* 61 */
+ II (d, a, b, c, X(11), S42, 0xbd3af235); /* 62 */
+ II (c, d, a, b, X( 2), S43, 0x2ad7d2bb); /* 63 */
+ II (b, c, d, a, X( 9), S44, 0xeb86d391); /* 64 */
+
+// state [0] += a;
+// state [1] += b;
+// state [2] += c;
+// state [3] += d;
+
+ addl $64,%ecx
+
+ movl 4+32(%esp),%eax // state
+ addl (%eax),a
+ addl 4(%eax),b
+ addl 8(%eax),c
+ addl 12(%eax),d
+ movl a, (%eax)
+ movl b, 4(%eax)
+ movl c, 8(%eax)
+ movl d,12(%eax)
+
+.Lstart:
+ decl 12+32(%esp)
+ jns .Lrepeat
+
+ popal
+ ret
+
+__MD5Transform:
+__MD5TransformLocal:
+ pushal
+ movl 8+32(%esp),%ecx // x
+ movl 4+32(%esp),%eax // state
+ movl (%eax),a
+ movl 4(%eax),b
+ movl 8(%eax),c
+ movl 12(%eax),d
+ jmp .Lstart
+
+.Lende:
+.size __MD5Transform, .Lende-__MD5Transform
+
+.type MD5Init,@function
+.global MD5Init
+
+MD5Init:
+ movl 4(%esp), %ecx
+ xorl %eax,%eax
+ movl $0x67452301, (%ecx)
+ movl $0xefcdab89, 4(%ecx)
+ movl $0x98badcfe, 8(%ecx)
+ movl $0x10325476, 12(%ecx)
+ movl %eax, 16(%ecx)
+ movl %eax, 20(%ecx)
+ ret
+
+
+.global MD5Update
+.type MD5Update,@function
+
+
+// void MD5Update ( MD5_CTX* context, const byte* input, size_t inputBytes )
+
+#define CONTEXT 4+32(%esp)
+#define INPUT 8+32(%esp)
+#define INPUTBYTES 12+32(%esp)
+
+#define COUNT 16(%ebx)
+#define BUFFER 24(%ebx)
+
+
+MD5Update:
+ pushal
+ cld
+ movl CONTEXT, %ebx
+
+// ByteIndex = (context->count[0] >> 3) & 0x3F;
+
+ movl COUNT, %ebp
+ shrl $3, %ebp
+ andl $63,%ebp // ebp = ByteIndex
+
+// if ( (context->count[0] += inputBytes << 3 ) < (inputBytes << 3) )
+// context->count[1]++;
+// context->count[1] += inputBytes >> (32-3);
+
+ movl $8, %eax
+ mull INPUTBYTES
+ addl %eax, 0+COUNT
+ adcl %edx, 4+COUNT
+
+// partLen = 64 - ByteIndex;
+
+ movl $64, %eax
+ subl %ebp, %eax // eax = partLen
+
+// i = 0;
+// if ( partLen <= inputBytes ) {
+
+ xorl %ecx,%ecx // ecx = i
+ cmpl INPUTBYTES, %eax
+ ja .Lende2
+
+// memcpy ( context->buffer + ByteIndex, input, partLen );
+
+ leal 24(%ebx,%ebp,1), %edi
+ movl INPUT, %esi
+ movl %eax, %ecx
+ rep movsb
+
+// MD5Transform ( context->state, context->buffer, 1 );
+
+ pushl $1
+ leal BUFFER, %ecx
+ pushl %ecx
+ push %ebx
+ call __MD5TransformLocal
+
+// len = (inputBytes - partLen) / 64;
+
+ movl 12+INPUTBYTES, %ecx
+ subl %eax, %ecx
+ shrl $6, %ecx
+
+// MD5Transform ( context->state, input+partLen, len );
+
+ pushl %ecx
+ pushl %esi
+ pushl %ebx
+ call __MD5TransformLocal
+ addl $24,%esp
+
+// i = partLen + 64 * len;
+// ByteIndex = 0;
+
+ shll $6, %ecx
+ addl %eax, %ecx
+ xorl %ebp, %ebp
+
+.Lende2:
+
+// }
+// memcpy ( context->buffer + ByteIndex, input + i, inputBytes - i );
+
+ movl INPUT, %esi
+ addl %ecx, %esi
+
+ negl %ecx
+ addl INPUTBYTES, %ecx
+
+ leal 24(%ebx,%ebp,1), %edi
+ rep movsb
+
+ popal
+ ret
+
+
diff --git a/mdk-stage1/dietlibc/i386/memccpy.S b/mdk-stage1/dietlibc/i386/memccpy.S
new file mode 100644
index 000000000..0b7dce49e
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/memccpy.S
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and
+ modify it under the terms of the GNU General Public
+ Public License.
+
+ memccpy.S
+ i386 assembler implementation of memccpy(3)
+*/
+
+.text
+.global memccpy
+.type memccpy,@function
+memccpy:
+ pushl %esi
+ pushl %edi
+
+ movl %esp, %ecx
+ movl 0x0c(%ecx), %edi
+ movl 0x10(%ecx), %esi
+ movb 0x14(%ecx), %dl
+ movl 0x18(%ecx), %ecx
+ cld
+.Lloop:
+ lodsb
+ stosb
+ cmp %al, %dl
+ jz .Lout
+ decl %ecx
+ jnz .Lloop
+ xorl %edi, %edi
+.Lout:
+ movl %edi, %eax
+ popl %edi
+ popl %esi
+ ret
+.Lende:
+.size memccpy,.Lende-memccpy
diff --git a/mdk-stage1/dietlibc/i386/memchr.S b/mdk-stage1/dietlibc/i386/memchr.S
new file mode 100644
index 000000000..7d04f990b
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/memchr.S
@@ -0,0 +1,24 @@
+.text
+.align 0
+.global memchr
+.type memchr,@function
+memchr:
+ pushl %edi
+ movl 8(%esp),%edi
+ movl 12(%esp),%eax
+ movl 16(%esp),%ecx
+ cld
+ jecxz .Lnotfound
+
+ repne scasb
+
+ je .Lfound
+.Lnotfound:
+ xorl %edi, %edi
+ incl %edi
+.Lfound:
+ movl %edi, %eax
+ decl %eax
+
+ popl %edi
+ ret
diff --git a/mdk-stage1/dietlibc/i386/memcmp.S b/mdk-stage1/dietlibc/i386/memcmp.S
new file mode 100644
index 000000000..aa6d55f23
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/memcmp.S
@@ -0,0 +1,26 @@
+.text
+.align 0
+.global memcmp
+.type memcmp,@function
+memcmp:
+ xorl %eax,%eax
+ orl 12(%esp),%eax
+ jz .Lempty
+ pushl %esi
+ pushl %edi
+ movl 12(%esp),%esi
+ movl 16(%esp),%edi
+ movl %eax,%ecx
+
+ rep cmpsb
+
+ decl %esi
+ decl %edi
+ lodsb
+ subb (%edi), %al
+ movsx %al, %eax
+
+ popl %edi
+ popl %esi
+.Lempty:
+ ret
diff --git a/mdk-stage1/dietlibc/i386/memcpy.S b/mdk-stage1/dietlibc/i386/memcpy.S
new file mode 100644
index 000000000..cbe74459f
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/memcpy.S
@@ -0,0 +1,16 @@
+.text
+.align 0
+.global memcpy
+.type memcpy,@function
+memcpy:
+ pushl %esi
+ pushl %edi
+ movl 12(%esp),%edi
+ movl 16(%esp),%esi
+ movl 20(%esp),%ecx
+ movl %edi, %eax
+ cld
+ rep movsb
+ popl %edi
+ popl %esi
+ ret
diff --git a/mdk-stage1/dietlibc/i386/memset.S b/mdk-stage1/dietlibc/i386/memset.S
new file mode 100644
index 000000000..472390b84
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/memset.S
@@ -0,0 +1,15 @@
+.text
+.align 0
+.global memset
+.type memset,@function
+memset:
+ pushl %edi
+ movl 8(%esp),%edi
+ movl 12(%esp),%eax
+ movl 16(%esp),%ecx
+ cld
+ pushl %edi
+ rep stosb
+ popl %eax
+ popl %edi
+ ret
diff --git a/mdk-stage1/dietlibc/i386/mmap.S b/mdk-stage1/dietlibc/i386/mmap.S
new file mode 100644
index 000000000..c824aa037
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/mmap.S
@@ -0,0 +1,14 @@
+#include "syscalls.h"
+
+.text
+.global mmap
+.type mmap,@function
+mmap:
+ mov $__NR_mmap,%al
+ lea 0x4(%esp,1),%edx
+ push %edx
+ call __unified_syscall
+ pop %ecx
+ ret
+.Lende3:
+.size mmap,.Lende3-mmap
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/mmap64.S b/mdk-stage1/dietlibc/i386/mmap64.S
new file mode 100644
index 000000000..421325260
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/mmap64.S
@@ -0,0 +1,63 @@
+#include <dietfeatures.h>
+#include <syscalls.h>
+#include <errno.h>
+
+#ifdef __DYN_LIB
+#ifndef WANT_THREAD_SAFE
+#define WANT_THREAD_SAFE
+#endif
+#endif
+
+.text
+.global mmap64
+.type mmap64,@function
+mmap64:
+/* man is this ugly! */
+ push %ebp
+ push %edi
+ push %esi
+ push %ebx
+ movl %esp, %edi
+ movl 0x28(%edi), %eax
+ movl 0x2c(%edi), %edx
+ testl $0xfff, %eax /* offset in pages */
+ jnz .Leinval
+ shrdl $12, %edx, %eax
+ shrl $12, %edx
+ jnz .Leinval
+ movl %eax, %ebp
+ movl 0x14(%edi),%ebx
+ movl 0x18(%edi),%ecx
+ movl 0x1c(%edi),%edx
+ movl 0x20(%edi),%esi
+ movl 0x24(%edi),%edi
+ movl $__NR_mmap2,%eax
+ int $0x80
+ cmp $-124,%eax
+ jbe .Lnoerror
+ neg %eax
+.Lerror:
+#ifdef WANT_THREAD_SAFE
+ movl %eax,%ebx
+#ifdef __DYN_LIB
+ call __errno_location@PLT
+#else
+ call __errno_location
+#endif
+ movl %ebx,(%eax)
+ orl $-1,%eax
+#else
+ mov %eax,errno
+ sbb %eax,%eax # eax = eax - eax - CY = -1
+#endif
+.Lnoerror:
+ pop %ebx
+ pop %esi
+ pop %edi
+ pop %ebp
+ ret
+.Leinval:
+ movl $EINVAL,%eax
+ jmp .Lerror
+.Lende2:
+.size mmap64,.Lende2-mmap64
diff --git a/mdk-stage1/dietlibc/i386/poly.S b/mdk-stage1/dietlibc/i386/poly.S
new file mode 100644
index 000000000..d8be7d7f5
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/poly.S
@@ -0,0 +1,24 @@
+
+.text
+.global __poly
+.type __poly,@function
+
+
+#
+# double __poly ( double x, int n, const double* c );
+#
+
+__poly:
+ movl 16(%esp),%eax
+ movl 12(%esp),%ecx
+ leal (%eax,%ecx,8),%eax
+ fldl 4(%esp)
+ fldz
+.Lloop:
+ fmul %st(1),%st(0)
+ faddl (%eax)
+ addl $-8,%eax
+ decl %ecx
+ jns .Lloop
+ fstp %st(1)
+ ret
diff --git a/mdk-stage1/dietlibc/i386/pow.S b/mdk-stage1/dietlibc/i386/pow.S
new file mode 100644
index 000000000..46562a299
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/pow.S
@@ -0,0 +1,67 @@
+.text
+.global pow
+.type pow,@function
+
+# pow(x,y)
+.global powf,pow,powl
+ .type powf,@function
+ .type pow,@function
+ .type powl,@function
+powf:
+ flds 4(%esp) # x
+ flds 8(%esp) # y
+ jmp .L__pow
+powl:
+ fldt 4(%esp)
+ fldt 16(%esp)
+ jmp .L__pow
+pow:
+ fldl 4(%esp)
+ fldl 12(%esp)
+# x^y; st(0)=y, st(1)=x
+.L__pow:
+ ftst # y = 0 ?
+ fstsw %ax
+ fld1 # st(0)=1, st(1)=y, st(2)=x
+ sahf
+ jz 1f # return 1
+ fcomp %st(1) # y = 1 ?
+ fstsw %ax
+ fxch # st(0)=x, st(1)=y
+ sahf
+ jz 1f # return x
+ ftst # x = 0 ?
+ fstsw %ax
+ sahf
+ jz 1f
+ jnc .Lfinpow # x > 0
+ fxch # st(0)=y, st(1)=x
+ fld %st(0) # st(0)=y, st(1)=y, st(2)=x
+ frndint # st(0)=int(y)
+ fcomp %st(1) # y = int(y)?
+ fstsw %ax
+ fxch
+ sahf
+ jnz .Lfinpow # fyl2x -> st(0) = NaN
+# y even or odd ?
+ fld1
+ fadd %st(0) # st(0) = 2
+ fdivr %st(2),%st(0) # st(0)=st(2)/2
+ frndint
+ fadd %st(0),%st(0)
+ fcomp %st(2) # st(0) = x, st(1) = y
+ fstsw %ax
+ fchs # st(0) = -x
+ sahf
+ jz .Lfinpow # y even
+ call .Lfinpow # y odd
+ fchs
+1: ret
+.Lfinpow:
+ fyl2x
+ jmp __finexp
+
+.Lende:
+.size pow,.Lende-pow
+.size powf,.Lende-powf
+.size powl,.Lende-powl
diff --git a/mdk-stage1/dietlibc/i386/recv.S b/mdk-stage1/dietlibc/i386/recv.S
new file mode 100644
index 000000000..215343ccc
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/recv.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(recv,RECV)
diff --git a/mdk-stage1/dietlibc/i386/recvfrom.S b/mdk-stage1/dietlibc/i386/recvfrom.S
new file mode 100644
index 000000000..a9dde840d
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/recvfrom.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(recvfrom,RECVFROM)
diff --git a/mdk-stage1/dietlibc/i386/recvmsg.S b/mdk-stage1/dietlibc/i386/recvmsg.S
new file mode 100644
index 000000000..cb26e2f08
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/recvmsg.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(recvmsg,RECVMSG)
diff --git a/mdk-stage1/dietlibc/i386/rint.S b/mdk-stage1/dietlibc/i386/rint.S
new file mode 100644
index 000000000..f56ab1f93
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/rint.S
@@ -0,0 +1,23 @@
+.text
+
+.global rintf,rint,rintl
+ .type rintf,@function
+ .type rint,@function
+ .type rintl,@function
+rintf:
+ flds 4(%esp)
+ frndint
+ ret
+rint:
+ fldl 4(%esp)
+ frndint
+ ret
+rintl:
+ fldt 4(%esp)
+ frndint
+ ret
+
+.Lende:
+.size rint,.Lende-rint
+.size rintl,.Lende-rintl
+.size rintf,.Lende-rintf
diff --git a/mdk-stage1/dietlibc/i386/send.S b/mdk-stage1/dietlibc/i386/send.S
new file mode 100644
index 000000000..f2dd7e3d5
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/send.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(send,SEND)
diff --git a/mdk-stage1/dietlibc/i386/sendmsg.S b/mdk-stage1/dietlibc/i386/sendmsg.S
new file mode 100644
index 000000000..484d62e50
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sendmsg.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(sendmsg,SENDMSG)
diff --git a/mdk-stage1/dietlibc/i386/sendto.S b/mdk-stage1/dietlibc/i386/sendto.S
new file mode 100644
index 000000000..04270f0f0
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sendto.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(sendto,SENDTO)
diff --git a/mdk-stage1/dietlibc/i386/setjmp.S b/mdk-stage1/dietlibc/i386/setjmp.S
index 9bfecf565..09b266c61 100644
--- a/mdk-stage1/dietlibc/i386/setjmp.S
+++ b/mdk-stage1/dietlibc/i386/setjmp.S
@@ -1,61 +1,40 @@
#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
+.type setjmp,@function
setjmp:
.globl __setjmp
+.type __setjmp,@function
__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. */
+ popl %eax
+ popl %ecx
+ pushl $0
+ pushl %ecx
+ pushl %eax
.globl __sigsetjmp
+.type __sigsetjmp,@function
__sigsetjmp:
- movl 4(%esp), %eax /* User's jmp_buf in %eax. */
+ movl 4(%esp), %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)
+ leal 4(%esp), %edx /* Save SP as it will be after we return. */
movl 0(%esp), %ecx /* Save PC we are returning to now. */
+ movl %edx, (JB_SP*4)(%eax)
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
+ call 1f
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx
+ jmp *__sigjmp_save@GOT(%ecx)
+1: movl (%esp), %ecx
+ ret
#else
jmp __sigjmp_save
#endif
diff --git a/mdk-stage1/dietlibc/i386/setsockopt.S b/mdk-stage1/dietlibc/i386/setsockopt.S
new file mode 100644
index 000000000..6a81aec82
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/setsockopt.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(setsockopt,SETSOCKOPT)
diff --git a/mdk-stage1/dietlibc/i386/shutdown.S b/mdk-stage1/dietlibc/i386/shutdown.S
new file mode 100644
index 000000000..f9dc707e8
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/shutdown.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(shutdown,SHUTDOWN)
diff --git a/mdk-stage1/dietlibc/i386/sin.S b/mdk-stage1/dietlibc/i386/sin.S
new file mode 100644
index 000000000..404bf5eed
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sin.S
@@ -0,0 +1,34 @@
+
+.text
+
+.global sinf,sin,sinl
+.type sinf,@function
+.type sin,@function
+.type sinl,@function
+sinf:
+ flds 4(%esp)
+ jmp 1f
+sin:
+ fldl 4(%esp)
+1: fsin
+ fnstsw %ax
+ testb $0x04, %ah
+ je 3f
+ fldpi
+ fadd %st
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ testb $0x04, %ah
+ jne 2b
+ fstp %st(1)
+ fsin
+3: ret
+sinl:
+ fldt 4(%esp)
+ jmp 1b
+
+.ende:
+.size sin,.ende-sin
+.size sinf,.ende-sinf
+.size sinl,.ende-sinl
diff --git a/mdk-stage1/dietlibc/i386/sincos.S b/mdk-stage1/dietlibc/i386/sincos.S
new file mode 100644
index 000000000..7395075f3
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sincos.S
@@ -0,0 +1,18 @@
+
+.text
+.type sincos,@function
+.global sincos
+
+# void sincos ( double x, double* sinx, double* cosx );
+
+sincos:
+ fldl 4(%esp)
+ fsincos
+ movl 16(%esp),%eax
+ movl 12(%esp),%ecx
+ fstpl (%eax)
+ fstpl (%ecx)
+ ret
+
+.ende:
+.size sincos,.ende-sincos
diff --git a/mdk-stage1/dietlibc/i386/sinh.S b/mdk-stage1/dietlibc/i386/sinh.S
new file mode 100644
index 000000000..98f7ee752
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sinh.S
@@ -0,0 +1,29 @@
+
+.text
+.type sinh,@function
+.global sinh
+
+sinh: # note: exp(x) = 2^(x*log2(e))
+ fldl2e
+ fmull 4(%esp) # x*log2(e)
+ fld %st(0) # x*log2(e) x*log2(e)
+ frndint # int(x*log2(e)) x*log2(e)
+ fxch # x*log2(e) int(x*log2(e))
+ fsub %st(1),%st(0) # frac(x*log2(e)) int(x*log2(e))
+ f2xm1 # 2^(fract(x*log2(e)))-1 int(x*log2(e))
+ fld1 # 1 2^(fract(x*log2(e)))-1 int(x*log2(e))
+ faddp %st(0),%st(1) # 2^(fract(x*log2(e))) int(x*log2(e))
+ fscale # 2^(x*log2(e)) int(x*log2(e))
+ fstp %st(1) # 2^(x*log2(e))
+
+# now we have y = exp(x), but sinh(x) = (y - 1/y) * 0.5
+
+ fld1
+ fdiv %st(1),%st(0)
+ fsubrp
+ fmuls __half
+ ret
+
+.Lende:
+
+.size sinh,.ende-sinh
diff --git a/mdk-stage1/dietlibc/i386/sleep.S b/mdk-stage1/dietlibc/i386/sleep.S
new file mode 100644
index 000000000..356552dc2
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sleep.S
@@ -0,0 +1,25 @@
+#include "PIC.h"
+
+.text
+.global sleep
+.type sleep,@function
+
+sleep:
+ movl 4(%esp),%eax # Argument holen
+ PIC_SAVE # non-PIC: empty line
+ PIC_INIT # non-PIC: empty line
+ pushl $0 # 0 ns
+ pushl %eax # 'x' µs warten
+ movl %esp,%eax
+ pushl %eax # zweimal ein Zeiger auf das Stackobjekt
+ pushl %eax # ptr ptr sec nsec return arg
+#ifdef __DYN_LIB
+ call nanosleep@PLT
+#else
+ call nanosleep
+#endif
+ movl 20(%esp),%eax # 'x' holen
+ subl 8(%esp),%eax # schon abgelaufende Zeit subtrahieren
+ addl $16,%esp
+ PIC_RESTORE # non-PIC: empty line
+ ret
diff --git a/mdk-stage1/dietlibc/i386/socket.S b/mdk-stage1/dietlibc/i386/socket.S
new file mode 100644
index 000000000..bc8cbe536
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/socket.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(socket,SOCKET)
diff --git a/mdk-stage1/dietlibc/i386/socketcall.S b/mdk-stage1/dietlibc/i386/socketcall.S
new file mode 100644
index 000000000..4e8019ec2
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/socketcall.S
@@ -0,0 +1,17 @@
+#include <syscalls.h>
+
+.text
+.global socketcall
+.type socketcall,@function
+socketcall:
+ leal 4(%esp), %ecx
+ pushl %ecx
+ movzbl %al,%eax
+ pushl %eax
+ movb $__NR_socketcall,%al
+ call __unified_syscall
+ popl %ecx
+ popl %ecx
+ retl
+.Lende:
+.size socketcall,.Lende-socketcall
diff --git a/mdk-stage1/dietlibc/i386/socketpair.S b/mdk-stage1/dietlibc/i386/socketpair.S
new file mode 100644
index 000000000..a5de65f25
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/socketpair.S
@@ -0,0 +1,4 @@
+#include <linuxnet.h>
+#include <syscalls.h>
+
+__socketcall(socketpair,SOCKETPAIR)
diff --git a/mdk-stage1/dietlibc/i386/sqrt.S b/mdk-stage1/dietlibc/i386/sqrt.S
new file mode 100644
index 000000000..5e4527612
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sqrt.S
@@ -0,0 +1,23 @@
+.text
+
+.global sqrtf,sqrt,sqrtl
+ .type sqrtf,@function
+ .type sqrt,@function
+ .type sqrtl,@function
+sqrtf:
+ flds 4(%esp)
+ fsqrt
+ ret
+sqrt:
+ fldl 4(%esp)
+ fsqrt
+ ret
+sqrtl:
+ fldt 4(%esp)
+ fsqrt
+ ret
+
+.ende:
+.size sqrt,.ende-sqrt
+.size sqrtf,.ende-sqrtf
+.size sqrtl,.ende-sqrtl
diff --git a/mdk-stage1/dietlibc/i386/sqrtl.S b/mdk-stage1/dietlibc/i386/sqrtl.S
new file mode 100644
index 000000000..c1a931fd8
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/sqrtl.S
@@ -0,0 +1,11 @@
+.text
+.type sqrtl,@function
+.global sqrtl
+sqrtl:
+ fldt 4(%esp)
+ fsqrt
+ ret
+
+.ende:
+.size sqrtl,.ende-sqrtl
+
diff --git a/mdk-stage1/dietlibc/i386/start.S b/mdk-stage1/dietlibc/i386/start.S
index 167bb779c..1a825fc2a 100644
--- a/mdk-stage1/dietlibc/i386/start.S
+++ b/mdk-stage1/dietlibc/i386/start.S
@@ -1,42 +1,51 @@
-#include "start.h"
+#include "dietfeatures.h"
+#include "PIC.h"
-#ifdef __i386__
.text
-.globl _start
+.global _start
_start:
-#if 0
- popl %ecx
- movl %esp, %esi
- leal 4(%esp,%ecx,4),%eax
+#if 1
+ popl %ecx /* %ecx = argc */
+ movl %esp,%esi /* %esi = argv */
+ pushl %ecx
#else
- movl (%esp),%ecx /* %ecx = argc */
- leal 4(%esp),%esi /* %esi = argv */
-
- leal 4(%esi,%ecx,4),%eax /* eax = 4*ecx+4 = envp */
+ movl (%esp),%ecx /* %ecx = argc */
+ leal 4(%esp),%esi /* %esi = argv */
#endif
- pushl %eax
- pushl %esi
- pushl %ecx
- movl %eax,environ
+ leal 4(%esi,%ecx,4),%eax /* %eax = envp = (4*ecx)+%esi+4 */
#ifdef WANT_DYNAMIC
-/* in %edx we have the dynamic _fini ( register this if non null ) */
- test %edx, %edx
- je .Linit
+/* in %edx we have the ld.so dynamic _fini ( register this if non null ) */
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
+ pushl %eax
+ pushl %esi
+ pushl %ecx
+ PIC_INIT /* non-PIC: this is an empty line */
+ PUT_VAR %eax, environ, %ecx /* non-PIC: movl %eax,environ */
+
+#ifdef PROFILING
+ pushl $_etext
+ pushl $.text
+ call monitor
+ addl $0x8, %esp
+#endif
+
+#ifdef WANT_DYNAMIC
+ call _dyn_start
+#else
+ call main
+#endif
+
+#ifdef PROFILING
+ pushl %eax
+ call _stop_monitor
+ popl %eax
#endif
+ pushl %eax
+ call exit
+ hlt /* die now ! will ya ... */
+.Lstart:
+ .size _start,.Lstart-_start
diff --git a/mdk-stage1/dietlibc/i386/stpcpy.S b/mdk-stage1/dietlibc/i386/stpcpy.S
new file mode 100644
index 000000000..1cb74b2ea
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/stpcpy.S
@@ -0,0 +1,22 @@
+.text
+.global stpcpy
+.type stpcpy,@function
+stpcpy:
+ pushl %edi
+ pushl %esi
+ movl 0xc(%esp), %edi
+ movl 0x10(%esp), %esi
+
+.Lcopy:
+ lodsb
+ stosb
+ testb %al, %al
+ jnz .Lcopy
+
+ movl %edi, %eax
+ decl %eax
+ popl %esi
+ popl %edi
+ ret
+.Lende:
+.size stpcpy,.Lende-stpcpy
diff --git a/mdk-stage1/dietlibc/i386/strcasecmp.S b/mdk-stage1/dietlibc/i386/strcasecmp.S
new file mode 100644
index 000000000..a836680db
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strcasecmp.S
@@ -0,0 +1,31 @@
+.text
+.globl strcasecmp
+
+strcasecmp:
+ pushl %esi
+ movl 0x8(%esp), %esi
+ movl 0xc(%esp), %edx
+ xorl %eax, %eax
+ xorl %ecx, %ecx
+ cld
+.Lloop:
+ lodsb
+ movb (%edx), %cl
+ incl %edx
+ or %al, %al
+ jz .Lfinifirst
+ cmp $'A', %al
+ jnge .Lcmp
+ cmp $'z', %al
+ jg .Lcmp
+ or $0x20, %al
+ or $0x20, %cl
+.Lcmp:
+ subl %ecx, %eax
+ jz .Lloop
+.Lret:
+ popl %esi
+ ret
+.Lfinifirst:
+ subl %ecx, %eax
+ jmp .Lret
diff --git a/mdk-stage1/dietlibc/i386/strcat.S b/mdk-stage1/dietlibc/i386/strcat.S
new file mode 100644
index 000000000..e7d74ef13
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strcat.S
@@ -0,0 +1,29 @@
+.text
+.align 0
+.global strcat
+.type strcat,@function
+strcat:
+ pushl %edi
+ pushl %esi
+
+ movl 12(%esp), %edi
+ movl 16(%esp), %esi
+
+ pushl %edi
+
+ xorl %eax, %eax
+ xorl %ecx, %ecx
+ decl %ecx
+ repne scasb
+ decl %edi
+
+.Lloop:
+ lodsb
+ stosb
+ testb %al, %al
+ jnz .Lloop
+
+ popl %eax
+ popl %esi
+ popl %edi
+ ret
diff --git a/mdk-stage1/dietlibc/i386/strchr.S b/mdk-stage1/dietlibc/i386/strchr.S
new file mode 100644
index 000000000..4515d9835
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strchr.S
@@ -0,0 +1,22 @@
+
+.text
+.type strchr,@function
+.global strchr
+.weak index
+.type index,@function
+
+index:
+strchr:
+ movl 4(%esp),%ecx
+ movb 8(%esp),%dl
+.Lloop:
+ movb (%ecx),%al
+ cmpb %al,%dl
+ jz .Lfound
+ incl %ecx
+ testb %al,%al
+ jnz .Lloop
+ xorl %ecx,%ecx
+.Lfound:
+ movl %ecx,%eax
+ ret
diff --git a/mdk-stage1/dietlibc/i386/strcmp.S b/mdk-stage1/dietlibc/i386/strcmp.S
new file mode 100644
index 000000000..e01064ffb
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strcmp.S
@@ -0,0 +1,31 @@
+.text
+.global strcmp
+.type strcmp,@function
+.weak strcoll
+.type strcoll,@function
+
+#ifdef HIGH_PERFORMANCE
+.align 16
+#endif
+
+.Ldiff:
+ movzbl (%edx), %ecx
+ subl %ecx, %eax # (unsigned char)*p - (unsigned char)*q, so wie die Original libc
+ ret # und ohne Überlaufprobleme:
+ # (int) ((signed char)c - (signed char)d) != (int)(signed char) ((unsigned char)c - (unsigned char)d)
+ # c = 'ä', d = 'e': left expression: -129, right expression: 127
+
+strcoll:
+strcmp:
+ movl 4(%esp), %ecx
+ movl 8(%esp), %edx
+ xorl %eax, %eax
+.Lloop: # Schleifenanfang liegt genau auf Modulanfang + 0x10, damit alignbar
+ movb (%ecx), %al
+ cmpb (%edx), %al
+ jnz .Ldiff
+ incl %edx
+ incl %ecx
+ testb %al, %al
+ jnz .Lloop
+ ret
diff --git a/mdk-stage1/dietlibc/i386/strcpy.S b/mdk-stage1/dietlibc/i386/strcpy.S
new file mode 100644
index 000000000..a597436bc
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strcpy.S
@@ -0,0 +1,24 @@
+
+.text
+.align 0
+.global strcpy
+.type strcpy,@function
+strcpy:
+ pushl %esi
+ pushl %edi
+
+ movl 12(%esp), %edx
+ movl 16(%esp), %esi
+ movl %edx, %edi
+ cld
+
+.Lloop:
+ lodsb
+ stosb
+ orb %al, %al
+ jnz .Lloop
+
+ popl %edi
+ popl %esi
+ movl %edx,%eax
+ ret
diff --git a/mdk-stage1/dietlibc/i386/strlen.S b/mdk-stage1/dietlibc/i386/strlen.S
new file mode 100644
index 000000000..66f8ee553
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strlen.S
@@ -0,0 +1,18 @@
+
+.text
+.type strlen,@function
+.global strlen
+
+strlen:
+ movl 4(%esp),%ecx
+ xorl %eax,%eax
+ jecxz .Lnull
+ decl %eax
+.Llbl: incl %eax
+ cmpb $0,(%ecx, %eax)
+ jne .Llbl
+.Lnull: ret
+
+.Lende:
+
+.size strlen,.Lende-strlen
diff --git a/mdk-stage1/dietlibc/i386/strncmp.S b/mdk-stage1/dietlibc/i386/strncmp.S
new file mode 100644
index 000000000..bf07b07d0
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strncmp.S
@@ -0,0 +1,28 @@
+.text
+.align 0
+.global strncmp
+.type strncmp,@function
+strncmp:
+ push %ebx
+ movl %esp,%ebx
+ movl 12(%ebx),%edx
+ movl 16(%ebx),%ecx
+ movl 8(%ebx),%ebx
+.Lloop:
+ jecxz .Ldone
+ decl %ecx
+ movb (%ebx),%al
+ incl %edx
+ incl %ebx
+ movb %al,%ah
+ subb -1(%edx),%al
+ jnz .Lnotequal
+ testb %ah,%ah
+ jnz .Lloop
+
+.Ldone:
+ xorl %eax,%eax
+.Lnotequal:
+ movsx %al, %eax
+ popl %ebx
+ ret
diff --git a/mdk-stage1/dietlibc/i386/strncpy.S b/mdk-stage1/dietlibc/i386/strncpy.S
new file mode 100644
index 000000000..837b43c41
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strncpy.S
@@ -0,0 +1,42 @@
+/*
+ Copyright (C) 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and
+ modify it under the terms of the GNU General Public
+ Public License.
+
+ strncpy.S
+ i386 assembler implementation of strncpy(3)
+*/
+
+#include "dietfeatures.h"
+
+.text
+.globl strncpy
+.type strncpy,@function
+
+strncpy:
+ pushl %esi
+ pushl %edi
+ movl %esp, %ecx
+ movl 0x0c(%ecx), %edi
+ movl 0x10(%ecx), %esi
+ movl 0x14(%ecx), %ecx
+
+ movl %edi, %edx
+
+.Lloop:
+ dec %ecx
+ js .Lout
+ lodsb
+ stosb
+ or %al, %al
+ jnz .Lloop
+#ifdef WANT_FULL_POSIX_COMPAT
+ repnz stosb
+#endif
+.Lout:
+ movl %edx, %eax
+ popl %edi
+ popl %esi
+ ret
diff --git a/mdk-stage1/dietlibc/i386/strrchr.S b/mdk-stage1/dietlibc/i386/strrchr.S
new file mode 100644
index 000000000..9fd6e8b32
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/strrchr.S
@@ -0,0 +1,19 @@
+.text
+.globl strrchr
+.type strrchr,@function
+
+strrchr:
+ movl 0x4(%esp), %edx
+ movb 0x8(%esp), %cl
+ xorl %eax, %eax
+ decl %edx
+.Lloop:
+ incl %edx
+ cmpb $0x0,(%edx)
+ jz .Lret
+ cmpb %cl, (%edx)
+ jnz .Lloop
+ movl %edx, %eax
+ jmp .Lloop
+.Lret:
+ ret
diff --git a/mdk-stage1/dietlibc/i386/syscalls.h b/mdk-stage1/dietlibc/i386/syscalls.h
new file mode 100644
index 000000000..3cbf7b605
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/syscalls.h
@@ -0,0 +1,303 @@
+
+#define __NR_exit 1
+#define __NR_fork 2
+#define __NR_read 3
+#define __NR_write 4
+#define __NR_open 5
+#define __NR_close 6
+#define __NR_waitpid 7
+#define __NR_creat 8
+#define __NR_link 9
+#define __NR_unlink 10
+#define __NR_execve 11
+#define __NR_chdir 12
+#define __NR_time 13
+#define __NR_mknod 14
+#define __NR_chmod 15
+#define __NR_lchown 16
+#define __NR_break 17
+#define __NR_oldstat 18
+#define __NR_lseek 19
+#define __NR_getpid 20
+#define __NR_mount 21
+#define __NR_umount 22
+#define __NR_setuid 23
+#define __NR_getuid 24
+#define __NR_stime 25
+#define __NR_ptrace 26
+#define __NR_alarm 27
+#define __NR_oldfstat 28
+#define __NR_pause 29
+#define __NR_utime 30
+#define __NR_stty 31
+#define __NR_gtty 32
+#define __NR_access 33
+#define __NR_nice 34
+#define __NR_ftime 35
+#define __NR_sync 36
+#define __NR_kill 37
+#define __NR_rename 38
+#define __NR_mkdir 39
+#define __NR_rmdir 40
+#define __NR_dup 41
+#define __NR_pipe 42
+#define __NR_times 43
+#define __NR_prof 44
+#define __NR_brk 45
+#define __NR_setgid 46
+#define __NR_getgid 47
+#define __NR_signal 48
+#define __NR_geteuid 49
+#define __NR_getegid 50
+#define __NR_acct 51
+#define __NR_umount2 52
+#define __NR_lock 53
+#define __NR_ioctl 54
+#define __NR_fcntl 55
+#define __NR_mpx 56
+#define __NR_setpgid 57
+#define __NR_ulimit 58
+#define __NR_oldolduname 59
+#define __NR_umask 60
+#define __NR_chroot 61
+#define __NR_ustat 62
+#define __NR_dup2 63
+#define __NR_getppid 64
+#define __NR_getpgrp 65
+#define __NR_setsid 66
+#define __NR_sigaction 67
+#define __NR_sgetmask 68
+#define __NR_ssetmask 69
+#define __NR_setreuid 70
+#define __NR_setregid 71
+#define __NR_sigsuspend 72
+#define __NR_sigpending 73
+#define __NR_sethostname 74
+#define __NR_setrlimit 75
+#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
+#define __NR_getrusage 77
+#define __NR_gettimeofday 78
+#define __NR_settimeofday 79
+#define __NR_getgroups 80
+#define __NR_setgroups 81
+#define __NR_select 82
+#define __NR_symlink 83
+#define __NR_oldlstat 84
+#define __NR_readlink 85
+#define __NR_uselib 86
+#define __NR_swapon 87
+#define __NR_reboot 88
+#define __NR_readdir 89
+#define __NR_mmap 90
+#define __NR_munmap 91
+#define __NR_truncate 92
+#define __NR_ftruncate 93
+#define __NR_fchmod 94
+#define __NR_fchown 95
+#define __NR_getpriority 96
+#define __NR_setpriority 97
+#define __NR_profil 98
+#define __NR_statfs 99
+#define __NR_fstatfs 100
+#define __NR_ioperm 101
+#define __NR_socketcall 102
+#define __NR_syslog 103
+#define __NR_setitimer 104
+#define __NR_getitimer 105
+#define __NR_stat 106
+#define __NR_lstat 107
+#define __NR_fstat 108
+#define __NR_olduname 109
+#define __NR_iopl 110
+#define __NR_vhangup 111
+#define __NR_idle 112
+#define __NR_vm86old 113
+#define __NR_wait4 114
+#define __NR_swapoff 115
+#define __NR_sysinfo 116
+#define __NR_ipc 117
+#define __NR_fsync 118
+#define __NR_sigreturn 119
+#define __NR_clone 120
+#define __NR_setdomainname 121
+#define __NR_uname 122
+#define __NR_modify_ldt 123
+#define __NR_adjtimex 124
+#define __NR_mprotect 125
+#define __NR_sigprocmask 126
+#define __NR_create_module 127
+#define __NR_init_module 128
+#define __NR_delete_module 129
+#define __NR_get_kernel_syms 130
+#define __NR_quotactl 131
+#define __NR_getpgid 132
+#define __NR_fchdir 133
+#define __NR_bdflush 134
+#define __NR_sysfs 135
+#define __NR_personality 136
+#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
+#define __NR_setfsuid 138
+#define __NR_setfsgid 139
+#define __NR__llseek 140
+#define __NR_getdents 141
+#define __NR__newselect 142
+#define __NR_flock 143
+#define __NR_msync 144
+#define __NR_readv 145
+#define __NR_writev 146
+#define __NR_getsid 147
+#define __NR_fdatasync 148
+#define __NR__sysctl 149
+#define __NR_mlock 150
+#define __NR_munlock 151
+#define __NR_mlockall 152
+#define __NR_munlockall 153
+#define __NR_sched_setparam 154
+#define __NR_sched_getparam 155
+#define __NR_sched_setscheduler 156
+#define __NR_sched_getscheduler 157
+#define __NR_sched_yield 158
+#define __NR_sched_get_priority_max 159
+#define __NR_sched_get_priority_min 160
+#define __NR_sched_rr_get_interval 161
+#define __NR_nanosleep 162
+#define __NR_mremap 163
+#define __NR_setresuid 164
+#define __NR_getresuid 165
+#define __NR_vm86 166
+#define __NR_query_module 167
+#define __NR_poll 168
+#define __NR_nfsservctl 169
+#define __NR_setresgid 170
+#define __NR_getresgid 171
+#define __NR_prctl 172
+#define __NR_rt_sigreturn 173
+#define __NR_rt_sigaction 174
+#define __NR_rt_sigprocmask 175
+#define __NR_rt_sigpending 176
+#define __NR_rt_sigtimedwait 177
+#define __NR_rt_sigqueueinfo 178
+#define __NR_rt_sigsuspend 179
+#define __NR_pread 180
+#define __NR_pwrite 181
+#define __NR_chown 182
+#define __NR_getcwd 183
+#define __NR_capget 184
+#define __NR_capset 185
+#define __NR_sigaltstack 186
+#define __NR_sendfile 187
+#define __NR_getpmsg 188 /* some people actually want streams */
+#define __NR_putpmsg 189 /* some people actually want streams */
+#define __NR_vfork 190
+#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
+#define __NR_mmap2 192
+#define __NR_truncate64 193
+#define __NR_ftruncate64 194
+#define __NR_stat64 195
+#define __NR_lstat64 196
+#define __NR_fstat64 197
+#define __NR_lchown32 198
+#define __NR_getuid32 199
+#define __NR_getgid32 200
+#define __NR_geteuid32 201
+#define __NR_getegid32 202
+#define __NR_setreuid32 203
+#define __NR_setregid32 204
+#define __NR_getgroups32 205
+#define __NR_setgroups32 206
+#define __NR_fchown32 207
+#define __NR_setresuid32 208
+#define __NR_getresuid32 209
+#define __NR_setresgid32 210
+#define __NR_getresgid32 211
+#define __NR_chown32 212
+#define __NR_setuid32 213
+#define __NR_setgid32 214
+#define __NR_setfsuid32 215
+#define __NR_setfsgid32 216
+#define __NR_pivot_root 217
+#define __NR_mincore 218
+#define __NR_madvise 219
+#define __NR_madvise1 219 /* delete when C lib stub is removed */
+#define __NR_getdents64 220
+#define __NR_fcntl64 221
+#define __NR_security 223 /* syscall for security modules */
+#define __NR_gettid 224
+#define __NR_readahead 225
+#define __NR_setxattr 226
+#define __NR_lsetxattr 227
+#define __NR_fsetxattr 228
+#define __NR_getxattr 229
+#define __NR_lgetxattr 230
+#define __NR_fgetxattr 231
+#define __NR_listxattr 232
+#define __NR_llistxattr 233
+#define __NR_flistxattr 234
+#define __NR_removexattr 235
+#define __NR_lremovexattr 236
+#define __NR_fremovexattr 237
+#define __NR_tkill 238
+#define __NR_sendfile64 239
+#define __NR_futex 240
+#define __NR_sched_setaffinity 241
+#define __NR_sched_getaffinity 242
+#define __NR_set_thread_area 243
+#define __NR_get_thread_area 244
+#define __NR_io_setup 245
+#define __NR_io_destroy 246
+#define __NR_io_getevents 247
+#define __NR_io_submit 248
+#define __NR_io_cancel 249
+#define __NR_alloc_hugepages 250
+#define __NR_free_hugepages 251
+#define __NR_exit_group 252
+#define __NR_lookup_dcookie 253
+#define __NR_sys_epoll_create 254
+#define __NR_sys_epoll_ctl 255
+#define __NR_sys_epoll_wait 256
+#define __NR_remap_file_pages 257
+#define __NR_set_tid_address 258
+
+#define syscall_weak(name,wsym,sym) \
+.text; \
+.type wsym,@function; \
+.weak wsym; \
+wsym: ; \
+.type sym,@function; \
+.global sym; \
+sym: \
+ movb $__NR_##name,%al; \
+ jmp __unified_syscall; \
+.Lend##sym: ; \
+.size sym,.Lend##sym-sym
+
+#define syscall(name,sym) \
+.text; \
+.type sym,@function; \
+.global sym; \
+sym: \
+.ifle __NR_##name-255; \
+ movb $__NR_##name,%al; \
+ jmp __unified_syscall; \
+.else; \
+ movw $__NR_##name,%ax; \
+ jmp __unified_syscall_256; \
+.endif; \
+.Lend##sym: ; \
+.size sym,.Lend##sym-sym
+
+#ifndef __PIC__
+#define __socketcall(name,NAME) \
+.text; \
+.type name,@function; \
+.weak name; \
+name: ; \
+.global __libc_##name; \
+__libc_##name: ; \
+ movb $SYS_##NAME,%al; \
+ jmp socketcall; \
+.Lend##name:; \
+.size name,.Lend##name-name
+#else
+#define __socketcall(name,NAME)
+#endif
diff --git a/mdk-stage1/dietlibc/i386/tan.S b/mdk-stage1/dietlibc/i386/tan.S
new file mode 100644
index 000000000..4904c2d59
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/tan.S
@@ -0,0 +1,12 @@
+
+.text
+.type tan,@function
+.global tan
+tan:
+ fldl 4(%esp)
+ fsincos
+ fdivrp
+ ret
+
+.Lende:
+.size tan,.Lende-tan
diff --git a/mdk-stage1/dietlibc/i386/tanh.S b/mdk-stage1/dietlibc/i386/tanh.S
new file mode 100644
index 000000000..61d3f3376
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/tanh.S
@@ -0,0 +1,32 @@
+
+.text
+.type tanh,@function
+.global tanh
+
+tanh: # note: exp(x) = 2^(x*log2(e))
+ fldl2e
+ fmull 4(%esp) # x*log2(e)
+ fld %st(0) # x*log2(e) x*log2(e)
+ frndint # int(x*log2(e)) x*log2(e)
+ fxch # x*log2(e) int(x*log2(e))
+ fsub %st(1),%st(0) # frac(x*log2(e)) int(x*log2(e))
+ f2xm1 # 2^(fract(x*log2(e)))-1 int(x*log2(e))
+ fld1 # 1 2^(fract(x*log2(e)))-1 int(x*log2(e))
+ faddp %st(0),%st(1) # 2^(fract(x*log2(e))) int(x*log2(e))
+ fscale # 2^(x*log2(e)) int(x*log2(e))
+ fstp %st(1) # 2^(x*log2(e))
+
+# now we have y = exp(x), but tanh(x) = (y - 1/y) / (y + 1/y)
+
+ fld1
+ fdiv %st(1),%st(0) # 1/y y
+ fld %st(0) # 1/y 1/y y
+ fadd %st(2) # y+1/y 1/y y
+ fxch %st(2) # y 1/y y+1/y
+ fsubp # y-1/y y+1/y
+ fdivp # (y-1/y)/(y+1/y)
+ ret
+
+.Lende:
+
+.size tanh,.ende-tanh
diff --git a/mdk-stage1/dietlibc/i386/unified.S b/mdk-stage1/dietlibc/i386/unified.S
index f182bdb4b..989bf37b5 100644
--- a/mdk-stage1/dietlibc/i386/unified.S
+++ b/mdk-stage1/dietlibc/i386/unified.S
@@ -1,13 +1,33 @@
+
#include <dietfeatures.h>
.text
+.global __unified_syscall_256
+.type __unified_syscall_256,@function
+__unified_syscall_256:
+ movzwl %ax,%eax
+ jmp .L1
+.L2:
+.size __unified_syscall_256,.L2-__unified_syscall_256
+.weak exit
+exit:
+.global _exit
+.type _exit,@function
+_exit:
+ movb $1,%al
.global __unified_syscall
+.type __unified_syscall,@function
__unified_syscall:
+.size _exit,__unified_syscall-_exit
movzbl %al, %eax
+.L1:
push %edi
push %esi
push %ebx
movl %esp,%edi
+ /* we use movl instead of pop because otherwise a signal would
+ destroy the stack frame and crash the program, although it
+ would save a few bytes. */
movl 0x10(%edi),%ebx
movl 0x14(%edi),%ecx
movl 0x18(%edi),%edx
@@ -16,19 +36,24 @@ __unified_syscall:
int $0x80
cmp $-124,%eax
jbe .Lnoerror
-#ifdef WANT_THREAD_SAVE
+ neg %eax
+#ifdef WANT_THREAD_SAFE
movl %eax,%ebx
call __errno_location
- neg %ebx
movl %ebx,(%eax)
+ orl $-1,%eax
#else
- neg %eax
mov %eax,errno
+ sbb %eax,%eax # eax = eax - eax - CY = -1
#endif
- xor %eax,%eax
- dec %eax
.Lnoerror:
pop %ebx
pop %esi
pop %edi
+
+/* here we go and "reuse" the return for weak-void functions */
+#include "dietuglyweaks.h"
+
ret
+.L3:
+.size __unified_syscall,.L3-__unified_syscall
diff --git a/mdk-stage1/dietlibc/i386/usleep.S b/mdk-stage1/dietlibc/i386/usleep.S
new file mode 100644
index 000000000..7c0cc6ce7
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/usleep.S
@@ -0,0 +1,31 @@
+#include "PIC.h"
+
+.text
+.global usleep
+.type usleep,@function
+
+usleep:
+ movl 4(%esp),%eax
+ PIC_SAVE # non-PIC: empty line
+ PIC_INIT # non-PIC: empty line
+ xorl %edx,%edx
+ movl $1000000,%ecx
+ divl %ecx
+ imull $1000,%edx
+ pushl %edx
+ pushl %eax
+ movl %esp,%eax
+ pushl %eax
+ pushl %eax
+#ifdef __DYN_LIB
+ call nanosleep@PLT
+#else
+ call nanosleep
+#endif
+ addl $16,%esp
+ PIC_RESTORE # non-PIC: empty line
+ ret
+
+.Lende:
+.size usleep,.Lende-usleep
+
diff --git a/mdk-stage1/dietlibc/i386/vfork.S b/mdk-stage1/dietlibc/i386/vfork.S
new file mode 100644
index 000000000..c07c5f6af
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/vfork.S
@@ -0,0 +1,9 @@
+.text
+.globl vfork
+vfork:
+ popl %edx
+ xorl %eax,%eax
+ movb $190, %al
+ int $0x80
+ jmpl *%edx
+.size vfork, . - vfork
diff --git a/mdk-stage1/dietlibc/i386/write12.S b/mdk-stage1/dietlibc/i386/write12.S
new file mode 100644
index 000000000..a40f63a86
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/write12.S
@@ -0,0 +1,37 @@
+#include "PIC.h"
+
+.text
+
+.global __write1
+.type __write1,@function
+
+.global __write2
+.type __write2,@function
+
+ # regparm=1, daher Stringadresse in %eax
+__write2:
+ clc # CY = 0
+ .byte 0xB2 # zusammen mit nächstem Byte: mov dl,0xF9
+__write1:
+ stc # CY = 1
+ sbbl %ecx,%ecx # __write2: ecx=0, __write1: ecx=-1
+ incl %ecx
+ incl %ecx # __write2: ecx=2, __write1: ecx=1
+ xorl %edx,%edx
+ decl %edx
+.Lnext: incl %edx
+ cmpb %ch,(%edx,%eax) # ch=0, da bei beiden Filedescriptoren Bits 15:8 0 sind
+ jnz .Lnext # Stringlänge in edx, ohne eax zerstört zu haben
+ PIC_SAVE # non-PIC: empty line
+ PIC_INIT # non-PIC: empty line
+ pushl %edx
+ pushl %eax
+ pushl %ecx
+#ifdef __DYN_LIB
+ call write@PLT
+#else
+ call write # alles ruf uf dn Stack und ab damit
+#endif
+ addl $12,%esp # und das leidvolle Putzen
+ PIC_RESTORE # non-PIC: empty line
+ ret
diff --git a/mdk-stage1/dietlibc/ia64/Makefile.add b/mdk-stage1/dietlibc/ia64/Makefile.add
new file mode 100644
index 000000000..f660930af
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/Makefile.add
@@ -0,0 +1,2 @@
+VPATH:=ia64:syscalls.s:$(VPATH)
+LIBOBJ+=$(OBJDIR)/__time.o $(OBJDIR)/__waitpid.o $(OBJDIR)/__nice.o $(OBJDIR)/__alarm.o
diff --git a/mdk-stage1/dietlibc/ia64/README b/mdk-stage1/dietlibc/ia64/README
new file mode 100644
index 000000000..684364d93
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/README
@@ -0,0 +1,4 @@
+A Port for IA64.
+
+Does not yet support: clone, FPU and profiling. And includes
+some subtle bugs which will hopefully be fixed later.
diff --git a/mdk-stage1/dietlibc/ia64/__alarm.c b/mdk-stage1/dietlibc/ia64/__alarm.c
new file mode 100644
index 000000000..e2c499f2c
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/__alarm.c
@@ -0,0 +1 @@
+#include "alpha/__alarm.c"
diff --git a/mdk-stage1/dietlibc/ia64/__longjmp.S b/mdk-stage1/dietlibc/ia64/__longjmp.S
new file mode 100644
index 000000000..698bda528
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/__longjmp.S
@@ -0,0 +1 @@
+/* No longjmp yet */
diff --git a/mdk-stage1/dietlibc/ia64/__nice.c b/mdk-stage1/dietlibc/ia64/__nice.c
new file mode 100644
index 000000000..012ea2628
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/__nice.c
@@ -0,0 +1,6 @@
+#include <sys/resource.h>
+
+int nice(int x) {
+ if (setpriority(PRIO_PROCESS,0,x)) return -1;
+ return getpriority(PRIO_PROCESS,0);
+}
diff --git a/mdk-stage1/dietlibc/ia64/__testandset.S b/mdk-stage1/dietlibc/ia64/__testandset.S
new file mode 100644
index 000000000..d462e3c58
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/__testandset.S
@@ -0,0 +1,11 @@
+.text
+.globl __testandset
+.proc __testandset
+__testandset:
+ mov ar.ccv = r0
+ mov r29 = 1
+ ld8 r3 = [r32]
+ cmpxchg8.acq r8 = [r32], r29, ar.ccv /* cmpxchg is atomic */
+ br.ret.sptk.clr b0
+.endp __testandset
+.size __testandset, . - __testandset
diff --git a/mdk-stage1/dietlibc/ia64/__time.c b/mdk-stage1/dietlibc/ia64/__time.c
new file mode 100644
index 000000000..7547acb1d
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/__time.c
@@ -0,0 +1,14 @@
+#include <time.h>
+#include <sys/time.h>
+
+time_t time(time_t*t) {
+ struct timeval tv;
+ time_t ret;
+ if (gettimeofday(&tv,0)) {
+ ret=(time_t)-1;
+ } else {
+ ret=(time_t)tv.tv_sec;
+ }
+ if (t) *t=ret;
+ return ret;
+}
diff --git a/mdk-stage1/dietlibc/ia64/__waitpid.c b/mdk-stage1/dietlibc/ia64/__waitpid.c
new file mode 100644
index 000000000..8c228f375
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/__waitpid.c
@@ -0,0 +1,5 @@
+#include <sys/types.h>
+
+pid_t waitpid(int pid, int * wait_stat, int flags) {
+ return wait4(pid, wait_stat, flags, 0);
+}
diff --git a/mdk-stage1/dietlibc/ia64/accept.S b/mdk-stage1/dietlibc/ia64/accept.S
new file mode 100644
index 000000000..7bdc38c7e
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/accept.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(accept, accept);
diff --git a/mdk-stage1/dietlibc/syscalls.c/sync.c b/mdk-stage1/dietlibc/ia64/bind.S
index cca17461f..05849d470 100644
--- a/mdk-stage1/dietlibc/syscalls.c/sync.c
+++ b/mdk-stage1/dietlibc/ia64/bind.S
@@ -1,3 +1,3 @@
#include "syscalls.h"
-_syscall0(int,sync)
+syscall(bind, bind);
diff --git a/mdk-stage1/dietlibc/ia64/clone.S b/mdk-stage1/dietlibc/ia64/clone.S
new file mode 100644
index 000000000..ba768141c
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/clone.S
@@ -0,0 +1,41 @@
+/* This is untested code which probably won´t work out of the box! */
+
+#include "syscalls.h"
+#include <errno.h>
+
+.text
+.globl __clone
+.proc __clone
+.weak __clone2
+__clone2:
+__clone:
+ mov r8 = EINVAL
+ cmp.eq p6,p0=0,r32
+(p6) br.cond.spnt.few __error_unified_syscall
+ cmp.eq p6,p0=0,r33
+(p6) br.cond.spnt.few __error_unified_syscall
+ flushrs
+
+ mov.m r17 = ar.rsc
+ mov r14 = r32
+ mov r18 = r33
+ mov r16 = r36;;
+ mov r15 = __NR_clone2
+ break 0x100000
+ cmp.eq p6,p0=-1,r10
+(p6) br.cond.spnt.few __error_unified_syscall
+ cmp.eq p6,p7=0,r8
+(p6) ld8 r34=[r14],8
+(p6) mov.m ar.bspstore=r18
+(p6) mov r32 = r16
+ mov.m ar.rsc = r17
+(p7) br.ret.sptk b0
+ ld8 r1 = [r14]
+ mov b6 = r34
+ br.call.dptk.few b0=b6
+ mov r32 = r8
+ br.call.dptk.few b0=__error_unified_syscall
+ br.ret.sptk.few b0
+.endp __clone
+.endp __clone2
+.size __clone, . - __clone
diff --git a/mdk-stage1/dietlibc/ia64/connect.S b/mdk-stage1/dietlibc/ia64/connect.S
new file mode 100644
index 000000000..5fbd151ae
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/connect.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(connect, connect);
diff --git a/mdk-stage1/dietlibc/ia64/fork.S b/mdk-stage1/dietlibc/ia64/fork.S
new file mode 100644
index 000000000..3b253a80b
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/fork.S
@@ -0,0 +1,8 @@
+#include "syscalls.h"
+
+.text
+.globl fork
+fork:
+ mov r15 = __NR_clone
+ mov r32 = 17
+ br __unified_syscall
diff --git a/mdk-stage1/dietlibc/ia64/getpeername.S b/mdk-stage1/dietlibc/ia64/getpeername.S
new file mode 100644
index 000000000..fdaa1038a
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/getpeername.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(getpeername, getpeername);
diff --git a/mdk-stage1/dietlibc/ia64/getsockname.S b/mdk-stage1/dietlibc/ia64/getsockname.S
new file mode 100644
index 000000000..1ea0bc000
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/getsockname.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(getsockname, getsockname);
diff --git a/mdk-stage1/dietlibc/ia64/getsockopt.S b/mdk-stage1/dietlibc/ia64/getsockopt.S
new file mode 100644
index 000000000..465c4e08e
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/getsockopt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(getsockopt, getsockopt);
diff --git a/mdk-stage1/dietlibc/ia64/listen.S b/mdk-stage1/dietlibc/ia64/listen.S
new file mode 100644
index 000000000..66a3fe376
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/listen.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(listen, listen);
diff --git a/mdk-stage1/dietlibc/syscalls.c/getpid.c b/mdk-stage1/dietlibc/ia64/mmap.S
index d60a8db9a..cca4bbdbb 100644
--- a/mdk-stage1/dietlibc/syscalls.c/getpid.c
+++ b/mdk-stage1/dietlibc/ia64/mmap.S
@@ -1,3 +1,3 @@
#include "syscalls.h"
-_syscall0(int,getpid)
+syscall (mmap, mmap)
diff --git a/mdk-stage1/dietlibc/syscalls.c/getppid.c b/mdk-stage1/dietlibc/ia64/msgctl.S
index ee87a8eae..d7caed2cc 100644
--- a/mdk-stage1/dietlibc/syscalls.c/getppid.c
+++ b/mdk-stage1/dietlibc/ia64/msgctl.S
@@ -1,3 +1,3 @@
#include "syscalls.h"
-_syscall0(int,getppid)
+syscall(msgctl,msgctl)
diff --git a/mdk-stage1/dietlibc/syscalls.c/vhangup.c b/mdk-stage1/dietlibc/ia64/msgget.S
index bb0669765..518d67ac4 100644
--- a/mdk-stage1/dietlibc/syscalls.c/vhangup.c
+++ b/mdk-stage1/dietlibc/ia64/msgget.S
@@ -1,3 +1,3 @@
#include "syscalls.h"
-_syscall0(int,vhangup)
+syscall(msgget,msgget)
diff --git a/mdk-stage1/dietlibc/ia64/msgrcv.S b/mdk-stage1/dietlibc/ia64/msgrcv.S
new file mode 100644
index 000000000..ab62e6c30
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/msgrcv.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgrcv,msgrcv)
diff --git a/mdk-stage1/dietlibc/ia64/msgsnd.S b/mdk-stage1/dietlibc/ia64/msgsnd.S
new file mode 100644
index 000000000..890a996a2
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/msgsnd.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgsnd,msgsnd)
diff --git a/mdk-stage1/dietlibc/ia64/pipe.S b/mdk-stage1/dietlibc/ia64/pipe.S
new file mode 100644
index 000000000..c3bf4570b
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/pipe.S
@@ -0,0 +1,20 @@
+#include "syscalls.h"
+
+.text
+.globl pipe
+.proc pipe
+
+pipe:
+ st8 [r12] = r32
+ mov r15 = __NR_pipe
+ break.i 0x100000
+ ld8 r2 = [r12]
+ cmp.eq p7,p6=-1,r10
+(p6) st4 [r2] = r8,4
+ mov r8 = r0
+(p7) br.cond.spnt.few __error_unified_syscall
+(p6) st4 [r2] = r9
+(p6) br.ret.sptk.few b0
+
+.endp pipe
+.size pipe, . - pipe
diff --git a/mdk-stage1/dietlibc/ia64/recv.S b/mdk-stage1/dietlibc/ia64/recv.S
new file mode 100644
index 000000000..1f1640390
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/recv.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(recv, recv);
diff --git a/mdk-stage1/dietlibc/ia64/recvfrom.S b/mdk-stage1/dietlibc/ia64/recvfrom.S
new file mode 100644
index 000000000..d3c2e602f
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/recvfrom.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(recvfrom, recvfrom);
diff --git a/mdk-stage1/dietlibc/ia64/recvmsg.S b/mdk-stage1/dietlibc/ia64/recvmsg.S
new file mode 100644
index 000000000..cfbbafdc1
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/recvmsg.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(recvmsg, recvmsg);
diff --git a/mdk-stage1/dietlibc/ia64/semctl.S b/mdk-stage1/dietlibc/ia64/semctl.S
new file mode 100644
index 000000000..e215ed955
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/semctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semctl,semctl)
diff --git a/mdk-stage1/dietlibc/ia64/semget.S b/mdk-stage1/dietlibc/ia64/semget.S
new file mode 100644
index 000000000..67f488546
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/semget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semget,semget)
diff --git a/mdk-stage1/dietlibc/ia64/semop.S b/mdk-stage1/dietlibc/ia64/semop.S
new file mode 100644
index 000000000..81b6fc606
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/semop.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semop,semop)
diff --git a/mdk-stage1/dietlibc/ia64/send.S b/mdk-stage1/dietlibc/ia64/send.S
new file mode 100644
index 000000000..38f47f398
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/send.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(send, send);
diff --git a/mdk-stage1/dietlibc/ia64/sendmsg.S b/mdk-stage1/dietlibc/ia64/sendmsg.S
new file mode 100644
index 000000000..c2bc80f72
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/sendmsg.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(sendmsg, sendmsg);
diff --git a/mdk-stage1/dietlibc/ia64/sendto.S b/mdk-stage1/dietlibc/ia64/sendto.S
new file mode 100644
index 000000000..1579a3b45
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/sendto.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(sendto, sendto);
diff --git a/mdk-stage1/dietlibc/ia64/setjmp.S b/mdk-stage1/dietlibc/ia64/setjmp.S
new file mode 100644
index 000000000..f0f5bc431
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/setjmp.S
@@ -0,0 +1 @@
+/* No, I am not going to save 128 registers */
diff --git a/mdk-stage1/dietlibc/ia64/setsockopt.S b/mdk-stage1/dietlibc/ia64/setsockopt.S
new file mode 100644
index 000000000..45fcfbb6c
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/setsockopt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(setsockopt, setsockopt);
diff --git a/mdk-stage1/dietlibc/ia64/shmat.S b/mdk-stage1/dietlibc/ia64/shmat.S
new file mode 100644
index 000000000..51248173d
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmat.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmat,shmat)
diff --git a/mdk-stage1/dietlibc/ia64/shmctl.S b/mdk-stage1/dietlibc/ia64/shmctl.S
new file mode 100644
index 000000000..d56caace4
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmctl,shmctl)
diff --git a/mdk-stage1/dietlibc/ia64/shmdt.S b/mdk-stage1/dietlibc/ia64/shmdt.S
new file mode 100644
index 000000000..d9812a799
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmdt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmdt,shmdt)
diff --git a/mdk-stage1/dietlibc/ia64/shmget.S b/mdk-stage1/dietlibc/ia64/shmget.S
new file mode 100644
index 000000000..82914223f
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shmget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmget,shmget)
diff --git a/mdk-stage1/dietlibc/ia64/shutdown.S b/mdk-stage1/dietlibc/ia64/shutdown.S
new file mode 100644
index 000000000..024e99e18
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/shutdown.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shutdown, shutdown);
diff --git a/mdk-stage1/dietlibc/ia64/socket.S b/mdk-stage1/dietlibc/ia64/socket.S
new file mode 100644
index 000000000..cc453881f
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/socket.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(socket, socket);
diff --git a/mdk-stage1/dietlibc/ia64/socketpair.S b/mdk-stage1/dietlibc/ia64/socketpair.S
new file mode 100644
index 000000000..d92eaa4d8
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/socketpair.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(socketpair, socketpair);
diff --git a/mdk-stage1/dietlibc/ia64/start.S b/mdk-stage1/dietlibc/ia64/start.S
new file mode 100644
index 000000000..dbacb25f6
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/start.S
@@ -0,0 +1,45 @@
+/*
+ Copyright (C) 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and
+ modify it under the terms of the GNU General Public
+ Public License.
+
+ This file is part of the IA64-Port of the dietlibc
+
+ start.S
+ Implemenation of the _start startup function
+*/
+
+.psr abi64
+.psr lsb
+.lsb
+
+.text
+.globl _start
+.proc _start
+
+_start:
+ alloc r2 = ar.pfs,0,0,7,0
+ adds out1 = 16, sp /* base arguments */
+ movl gp = @gprel(0f) /* base offset */
+ ;;
+0:
+ ld8 out0 = [out1], 8 /* load argc and set argv */
+ mov r9 = ip
+ ;;
+ shladd out2=out0,3,out1 /* envp = argv+8*argc */
+ sub gp = r9, gp /* subtract program counter */
+ ;;
+ addl r15 = @ltoff(environ#), gp /* offset to environ */
+ adds out2 = 8, out2 /* envp += 8 */
+ ;;
+ ld8 r14 = [r15]
+ ;;
+ st8 [r14] = out2 /* store envp in environ */
+ br.call.sptk.few rp = main /* call main */
+ ;;
+ mov r32 = r8 /* store return code */
+ br _exit /* branch to _exit */
+.endp _start
+.size _start, . - _start
diff --git a/mdk-stage1/dietlibc/ia64/syscalls.h b/mdk-stage1/dietlibc/ia64/syscalls.h
new file mode 100644
index 000000000..65eda0ed2
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/syscalls.h
@@ -0,0 +1,242 @@
+#ifndef __DLIBC_SYSCALL_H_
+#define __DLIBC_SYSCALL_H_
+
+#define __NR_ni_syscall 1024
+#define __NR_exit 1025
+#define __NR_read 1026
+#define __NR_write 1027
+#define __NR_open 1028
+#define __NR_close 1029
+#define __NR_creat 1030
+#define __NR_link 1031
+#define __NR_unlink 1032
+#define __NR_execve 1033
+#define __NR_chdir 1034
+#define __NR_fchdir 1035
+#define __NR_utimes 1036
+#define __NR_mknod 1037
+#define __NR_chmod 1038
+#define __NR_chown 1039
+#define __NR_lseek 1040
+#define __NR_getpid 1041
+#define __NR_getppid 1042
+#define __NR_mount 1043
+#define __NR_umount 1044
+#define __NR_setuid 1045
+#define __NR_getuid 1046
+#define __NR_geteuid 1047
+#define __NR_ptrace 1048
+#define __NR_access 1049
+#define __NR_sync 1050
+#define __NR_fsync 1051
+#define __NR_fdatasync 1052
+#define __NR_kill 1053
+#define __NR_rename 1054
+#define __NR_mkdir 1055
+#define __NR_rmdir 1056
+#define __NR_dup 1057
+#define __NR_pipe 1058
+#define __NR_times 1059
+#define __NR_brk 1060
+#define __NR_setgid 1061
+#define __NR_getgid 1062
+#define __NR_getegid 1063
+#define __NR_acct 1064
+#define __NR_ioctl 1065
+#define __NR_fcntl 1066
+#define __NR_umask 1067
+#define __NR_chroot 1068
+#define __NR_ustat 1069
+#define __NR_dup2 1070
+#define __NR_setreuid 1071
+#define __NR_setregid 1072
+#define __NR_getresuid 1073
+#define __NR_setresuid 1074
+#define __NR_getresgid 1075
+#define __NR_setresgid 1076
+#define __NR_getgroups 1077
+#define __NR_setgroups 1078
+#define __NR_getpgid 1079
+#define __NR_setpgid 1080
+#define __NR_setsid 1081
+#define __NR_getsid 1082
+#define __NR_sethostname 1083
+#define __NR_setrlimit 1084
+#define __NR_getrlimit 1085
+#define __NR_getrusage 1086
+#define __NR_gettimeofday 1087
+#define __NR_settimeofday 1088
+#define __NR_select 1089
+#define __NR_poll 1090
+#define __NR_symlink 1091
+#define __NR_readlink 1092
+#define __NR_uselib 1093
+#define __NR_swapon 1094
+#define __NR_swapoff 1095
+#define __NR_reboot 1096
+#define __NR_truncate 1097
+#define __NR_ftruncate 1098
+#define __NR_fchmod 1099
+#define __NR_fchown 1100
+#define __NR_getpriority 1101
+#define __NR_setpriority 1102
+#define __NR_statfs 1103
+#define __NR_fstatfs 1104
+#define __NR_gettid 1105
+#define __NR_semget 1106
+#define __NR_semop 1107
+#define __NR_semctl 1108
+#define __NR_msgget 1109
+#define __NR_msgsnd 1110
+#define __NR_msgrcv 1111
+#define __NR_msgctl 1112
+#define __NR_shmget 1113
+#define __NR_shmat 1114
+#define __NR_shmdt 1115
+#define __NR_shmctl 1116
+#define __NR_syslog 1117
+#define __NR_setitimer 1118
+#define __NR_getitimer 1119
+#define __NR_old_stat 1120
+#define __NR_old_lstat 1121
+#define __NR_old_fstat 1122
+#define __NR_vhangup 1123
+#define __NR_lchown 1124
+#define __NR_vm86 1125
+#define __NR_wait4 1126
+#define __NR_sysinfo 1127
+#define __NR_clone 1128
+#define __NR_setdomainname 1129
+#define __NR_uname 1130
+#define __NR_adjtimex 1131
+#define __NR_create_module 1132
+#define __NR_init_module 1133
+#define __NR_delete_module 1134
+#define __NR_get_kernel_syms 1135
+#define __NR_query_module 1136
+#define __NR_quotactl 1137
+#define __NR_bdflush 1138
+#define __NR_sysfs 1139
+#define __NR_personality 1140
+#define __NR_afs_syscall 1141
+#define __NR_setfsuid 1142
+#define __NR_setfsgid 1143
+#define __NR_getdents 1144
+#define __NR_flock 1145
+#define __NR_readv 1146
+#define __NR_writev 1147
+#define __NR_pread 1148
+#define __NR_pwrite 1149
+#define __NR__sysctl 1150
+#define __NR_mmap 1151
+#define __NR_munmap 1152
+#define __NR_mlock 1153
+#define __NR_mlockall 1154
+#define __NR_mprotect 1155
+#define __NR_mremap 1156
+#define __NR_msync 1157
+#define __NR_munlock 1158
+#define __NR_munlockall 1159
+#define __NR_sched_getparam 1160
+#define __NR_sched_setparam 1161
+#define __NR_sched_getscheduler 1162
+#define __NR_sched_setscheduler 1163
+#define __NR_sched_yield 1164
+#define __NR_sched_get_priority_max 1165
+#define __NR_sched_get_priority_min 1166
+#define __NR_sched_rr_get_interval 1167
+#define __NR_nanosleep 1168
+#define __NR_nfsservctl 1169
+#define __NR_prctl 1170
+#define __NR_mmap2 1172
+#define __NR_pciconfig_read 1173
+#define __NR_pciconfig_write 1174
+#define __NR_perfmonctl 1175
+#define __NR_sigaltstack 1176
+#define __NR_rt_sigaction 1177
+#define __NR_rt_sigpending 1178
+#define __NR_rt_sigprocmask 1179
+#define __NR_rt_sigqueueinfo 1180
+#define __NR_rt_sigreturn 1181
+#define __NR_rt_sigsuspend 1182
+#define __NR_rt_sigtimedwait 1183
+#define __NR_getcwd 1184
+#define __NR_capget 1185
+#define __NR_capset 1186
+#define __NR_sendfile 1187
+#define __NR_getpmsg 1188
+#define __NR_putpmsg 1189
+#define __NR_socket 1190
+#define __NR_bind 1191
+#define __NR_connect 1192
+#define __NR_listen 1193
+#define __NR_accept 1194
+#define __NR_getsockname 1195
+#define __NR_getpeername 1196
+#define __NR_socketpair 1197
+#define __NR_send 1198
+#define __NR_sendto 1199
+#define __NR_recv 1200
+#define __NR_recvfrom 1201
+#define __NR_shutdown 1202
+#define __NR_setsockopt 1203
+#define __NR_getsockopt 1204
+#define __NR_sendmsg 1205
+#define __NR_recvmsg 1206
+#define __NR_pivot_root 1207
+#define __NR_mincore 1208
+#define __NR_madvise 1209
+#define __NR_stat 1210
+#define __NR_lstat 1211
+#define __NR_fstat 1212
+#define __NR_clone2 1213
+#define __NR_getdents64 1214
+#define __NR_getunwind 1215
+#define __NR_readahead 1216
+#define __NR_setxattr 1217
+#define __NR_lsetxattr 1218
+#define __NR_fsetxattr 1219
+#define __NR_getxattr 1220
+#define __NR_lgetxattr 1221
+#define __NR_fgetxattr 1222
+#define __NR_listxattr 1223
+#define __NR_llistxattr 1224
+#define __NR_flistxattr 1225
+#define __NR_removexattr 1226
+#define __NR_lremovexattr 1227
+#define __NR_fremovexattr 1228
+#define __NR_tkill 1229
+#define __NR_futex 1230
+#define __NR_sched_setaffinity 1231
+#define __NR_sched_getaffinity 1232
+#define __NR_security 1233
+#define __NR_alloc_hugepages 1234
+#define __NR_free_hugepages 1235
+#define __NR_exit_group 1236
+#define __NR_lookup_dcookie 1237
+#define __NR_io_setup 1238
+#define __NR_io_destroy 1239
+#define __NR_io_getevents 1240
+#define __NR_io_submit 1241
+#define __NR_io_cancel 1242
+#define __NR_epoll_create 1243
+#define __NR_epoll_ctl 1244
+#define __NR_epoll_wait 1245
+
+#define syscall(name, sym) \
+.text; \
+.globl sym; \
+sym: \
+ mov r15 = __NR_##name; \
+ br __unified_syscall;
+
+#define syscall_weak(name, sym, wsym) \
+.text; \
+.weak wsym; \
+wsym: \
+.globl sym; \
+sym: \
+ mov r15 = __NR_##name; \
+ br __unified_syscall;
+
+#endif
diff --git a/mdk-stage1/dietlibc/ia64/unified.S b/mdk-stage1/dietlibc/ia64/unified.S
new file mode 100644
index 000000000..998fba75e
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/unified.S
@@ -0,0 +1,46 @@
+/*
+ Copyright (C) 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and
+ modify it under the terms of the GNU General Public
+ Public License.
+
+ This file is part of the ia64-Port of dietlibc
+
+ unified.S
+ General system-call interface
+*/
+
+.lsb
+
+.text
+
+.globl __unified_syscall
+.proc __unified_syscall
+.globl __error_unified_syscall
+.proc __error_unified_syscall
+.globl _exit
+.proc _exit
+
+_exit:
+ mov r15 = 1025
+.endp _exit
+.size _exit, . - _exit
+
+__unified_syscall:
+ break.i 0x100000
+ movl r2=errno
+ cmp.eq p6,p0=-1,r10
+ ;;
+__error_unified_syscall:
+(p6) st4 [r2]=r8
+(p6) mov r8=-1
+
+#include "dietuglyweaks.h"
+
+ br.ret.sptk.few rp
+
+.endp __unified_syscall
+.endp __error_unified_syscall
+.size __unified_syscall, __error_unified_syscall - __unified_syscall
+.size __error_unified_syscall, . - __error_unified_syscall
diff --git a/mdk-stage1/dietlibc/ia64/utime.S b/mdk-stage1/dietlibc/ia64/utime.S
new file mode 100644
index 000000000..a9a8aada6
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/utime.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(utimes,utime)
diff --git a/mdk-stage1/dietlibc/ia64/vfork.S b/mdk-stage1/dietlibc/ia64/vfork.S
new file mode 100644
index 000000000..e59f04364
--- /dev/null
+++ b/mdk-stage1/dietlibc/ia64/vfork.S
@@ -0,0 +1,8 @@
+#include "syscalls.h"
+
+.text
+.globl vfork
+vfork:
+ mov r15 = __NR_clone
+ mov r32 = 16657
+ br __unified_syscall
diff --git a/mdk-stage1/dietlibc/include/alloca.h b/mdk-stage1/dietlibc/include/alloca.h
index e69de29bb..41f92354f 100644
--- a/mdk-stage1/dietlibc/include/alloca.h
+++ b/mdk-stage1/dietlibc/include/alloca.h
@@ -0,0 +1,13 @@
+#ifndef _ALLOCA_H
+#define _ALLOCA_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#ifdef __GNUC__
+#define alloca(x) __builtin_alloca(x)
+#else
+void *alloca(size_t size) __THROW;
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/arpa/inet.h b/mdk-stage1/dietlibc/include/arpa/inet.h
index 6d5a6dc35..bb278d399 100644
--- a/mdk-stage1/dietlibc/include/arpa/inet.h
+++ b/mdk-stage1/dietlibc/include/arpa/inet.h
@@ -9,6 +9,7 @@ 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;
+char *inet_ntoa_r(struct in_addr in,char* buf) __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;
diff --git a/mdk-stage1/dietlibc/include/arpa/nameser.h b/mdk-stage1/dietlibc/include/arpa/nameser.h
index 1ee048d66..9327006b0 100644
--- a/mdk-stage1/dietlibc/include/arpa/nameser.h
+++ b/mdk-stage1/dietlibc/include/arpa/nameser.h
@@ -89,6 +89,42 @@ typedef enum __ns_class {
ns_c_max = 65536
} ns_class;
+/*
+ * Currently defined opcodes.
+ */
+typedef enum __ns_opcode {
+ ns_o_query = 0, /* Standard query. */
+ ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
+ ns_o_status = 2, /* Name server status query (unsupported). */
+ /* Opcode 3 is undefined/reserved. */
+ ns_o_notify = 4, /* Zone change notification. */
+ ns_o_update = 5, /* Zone update message. */
+ ns_o_max = 6
+} ns_opcode;
+
+/*
+ * Currently defined response codes.
+ */
+typedef enum __ns_rcode {
+ ns_r_noerror = 0, /* No error occurred. */
+ ns_r_formerr = 1, /* Format error. */
+ ns_r_servfail = 2, /* Server failure. */
+ ns_r_nxdomain = 3, /* Name error. */
+ ns_r_notimpl = 4, /* Unimplemented. */
+ ns_r_refused = 5, /* Operation refused. */
+ /* these are for BIND_UPDATE */
+ ns_r_yxdomain = 6, /* Name exists */
+ ns_r_yxrrset = 7, /* RRset exists */
+ ns_r_nxrrset = 8, /* RRset does not exist */
+ ns_r_notauth = 9, /* Not authoritative for zone */
+ ns_r_notzone = 10, /* Zone of record different from zone section */
+ ns_r_max = 11,
+ /* The following are TSIG extended errors */
+ ns_r_badsig = 16,
+ ns_r_badkey = 17,
+ ns_r_badtime = 18
+} ns_rcode;
+
typedef struct {
unsigned id :16; /* query identification number */
#if BYTE_ORDER == BIG_ENDIAN
diff --git a/mdk-stage1/dietlibc/include/asm/alpha-sigcontext.h b/mdk-stage1/dietlibc/include/asm/alpha-sigcontext.h
new file mode 100644
index 000000000..13faab0b5
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/alpha-sigcontext.h
@@ -0,0 +1,29 @@
+struct sigcontext {
+ /*
+ * What should we have here? I'd probably better use the same
+ * stack layout as OSF/1, just in case we ever want to try
+ * running their binaries..
+ *
+ * This is the basic layout, but I don't know if we'll ever
+ * actually fill in all the values..
+ */
+ long sc_onstack;
+ long sc_mask;
+ long sc_pc;
+ long sc_ps;
+ long sc_regs[32];
+ long sc_ownedfp;
+ long sc_fpregs[32];
+ unsigned long sc_fpcr;
+ unsigned long sc_fp_control;
+ unsigned long sc_reserved1, sc_reserved2;
+ unsigned long sc_ssize;
+ char * sc_sbase;
+ unsigned long sc_traparg_a0;
+ unsigned long sc_traparg_a1;
+ unsigned long sc_traparg_a2;
+ unsigned long sc_fp_trap_pc;
+ unsigned long sc_fp_trigger_sum;
+ unsigned long sc_fp_trigger_inst;
+};
+
diff --git a/mdk-stage1/dietlibc/include/asm/arm-sigcontext.h b/mdk-stage1/dietlibc/include/asm/arm-sigcontext.h
new file mode 100644
index 000000000..26fa04e64
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/arm-sigcontext.h
@@ -0,0 +1,32 @@
+
+#define PC(ctx) (ctx.arm_pc)
+
+/*
+ * Signal context structure - contains all info to do with the state
+ * before the signal handler was invoked. Note: only add new entries
+ * to the end of the structure.
+ */
+struct sigcontext {
+ unsigned long trap_no;
+ unsigned long error_code;
+ unsigned long oldmask;
+ unsigned long arm_r0;
+ unsigned long arm_r1;
+ unsigned long arm_r2;
+ unsigned long arm_r3;
+ unsigned long arm_r4;
+ unsigned long arm_r5;
+ unsigned long arm_r6;
+ unsigned long arm_r7;
+ unsigned long arm_r8;
+ unsigned long arm_r9;
+ unsigned long arm_r10;
+ unsigned long arm_fp;
+ unsigned long arm_ip;
+ unsigned long arm_sp;
+ unsigned long arm_lr;
+ unsigned long arm_pc;
+ unsigned long arm_cpsr;
+ unsigned long fault_address;
+};
+
diff --git a/mdk-stage1/dietlibc/include/asm/i386-sigcontext.h b/mdk-stage1/dietlibc/include/asm/i386-sigcontext.h
new file mode 100644
index 000000000..e830b9b97
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/i386-sigcontext.h
@@ -0,0 +1,66 @@
+
+struct _fpreg {
+ unsigned short significand[4];
+ unsigned short exponent;
+};
+
+struct _fpxreg {
+ unsigned short significand[4];
+ unsigned short exponent;
+ unsigned short padding[3];
+};
+
+struct _xmmreg {
+ unsigned long element[4];
+};
+
+struct _fpstate {
+ /* Regular FPU environment */
+ unsigned long cw;
+ unsigned long sw;
+ unsigned long tag;
+ unsigned long ipoff;
+ unsigned long cssel;
+ unsigned long dataoff;
+ unsigned long datasel;
+ struct _fpreg _st[8];
+ unsigned short status;
+ unsigned short magic; /* 0xffff = regular FPU data only */
+
+ /* FXSR FPU environment */
+ unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
+ unsigned long mxcsr;
+ unsigned long reserved;
+ struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
+ struct _xmmreg _xmm[8];
+ unsigned long padding[56];
+};
+
+#define X86_FXSR_MAGIC 0x0000
+#define PC(ctx) (ctx.eip)
+
+struct sigcontext {
+ unsigned short gs, __gsh;
+ unsigned short fs, __fsh;
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned long edi;
+ unsigned long esi;
+ unsigned long ebp;
+ unsigned long esp;
+ unsigned long ebx;
+ unsigned long edx;
+ unsigned long ecx;
+ unsigned long eax;
+ unsigned long trapno;
+ unsigned long err;
+ unsigned long eip;
+ unsigned short cs, __csh;
+ unsigned long eflags;
+ unsigned long esp_at_signal;
+ unsigned short ss, __ssh;
+ struct _fpstate * fpstate;
+ unsigned long oldmask;
+ unsigned long cr2;
+};
+
diff --git a/mdk-stage1/dietlibc/include/asm/ia64-sigcontext.h b/mdk-stage1/dietlibc/include/asm/ia64-sigcontext.h
new file mode 100644
index 000000000..ebab3c8f4
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/ia64-sigcontext.h
@@ -0,0 +1,25 @@
+#include <sys/ptrace.h>
+
+#define PC(ctx) (ctx.sc_ip)
+
+struct sigcontext {
+ unsigned long sc_flags;
+ unsigned long sc_nat;
+ stack_t sc_stack;
+ unsigned long sc_ip;
+ unsigned long sc_cfm;
+ unsigned long sc_um;
+ unsigned long sc_ar_rsc;
+ unsigned long sc_ar_bsp;
+ unsigned long sc_ar_rnat;
+ unsigned long sc_ar_ccv;
+ unsigned long sc_ar_unat;
+ unsigned long sc_ar_fpsr;
+ unsigned long sc_ar_pfs;
+ unsigned long sc_ar_lc;
+ unsigned long sc_pr;
+ unsigned long sc_br[8];
+ unsigned long sc_gr[32];
+ struct ia64_fpreg sc_fr[128];
+ sigset_t sc_mask;
+};
diff --git a/mdk-stage1/dietlibc/include/asm/mips-sigcontext.h b/mdk-stage1/dietlibc/include/asm/mips-sigcontext.h
new file mode 100644
index 000000000..1210abf31
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/mips-sigcontext.h
@@ -0,0 +1,23 @@
+
+/*
+ * Keep this struct definition in sync with the sigcontext fragment
+ * in arch/mips/tools/offset.c
+ */
+struct sigcontext {
+ unsigned int sc_regmask; /* Unused */
+ unsigned int sc_status;
+ unsigned long long sc_pc;
+ unsigned long long sc_regs[32];
+ unsigned long long sc_fpregs[32]; /* Unused */
+ unsigned int sc_ownedfp;
+ unsigned int sc_fpc_csr; /* Unused */
+ unsigned int sc_fpc_eir; /* Unused */
+ unsigned int sc_ssflags; /* Unused */
+ unsigned long long sc_mdhi;
+ unsigned long long sc_mdlo;
+
+ unsigned int sc_cause; /* Unused */
+ unsigned int sc_badvaddr; /* Unused */
+
+ unsigned long sc_sigset[4]; /* kernel's sigset_t */
+};
diff --git a/mdk-stage1/dietlibc/include/asm/parisc-sigcontext.h b/mdk-stage1/dietlibc/include/asm/parisc-sigcontext.h
new file mode 100644
index 000000000..9428dd3e5
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/parisc-sigcontext.h
@@ -0,0 +1,16 @@
+
+#define PARISC_SC_FLAG_ONSTACK 1<<0
+#define PARISC_SC_FLAG_IN_SYSCALL 1<<1
+
+/* We will add more stuff here as it becomes necessary, until we know
+ it works. */
+struct sigcontext {
+ unsigned long sc_flags;
+
+ unsigned long sc_gr[32]; /* PSW in sc_gr[0] */
+ unsigned long long sc_fr[32]; /* FIXME, do we need other state info? */
+ unsigned long sc_iasq[2];
+ unsigned long sc_iaoq[2];
+ unsigned long sc_sar; /* cr11 */
+};
+
diff --git a/mdk-stage1/dietlibc/include/asm/ppc-sigcontext.h b/mdk-stage1/dietlibc/include/asm/ppc-sigcontext.h
new file mode 100644
index 000000000..1d9704f3a
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/ppc-sigcontext.h
@@ -0,0 +1,76 @@
+
+struct pt_regs {
+ unsigned long gpr[32];
+ unsigned long nip;
+ unsigned long msr;
+ unsigned long orig_gpr3; /* Used for restarting system calls */
+ unsigned long ctr;
+ unsigned long link;
+ unsigned long xer;
+ unsigned long ccr;
+ unsigned long mq; /* 601 only (not used at present) */
+ /* Used on APUS to hold IPL value. */
+ unsigned long trap; /* Reason for being here */
+ unsigned long dar; /* Fault registers */
+ unsigned long dsisr;
+ unsigned long result; /* Result of a system call */
+};
+
+/*
+ * Offsets used by 'ptrace' system call interface.
+ * These can't be changed without breaking binary compatibility
+ * with MkLinux, etc.
+ */
+#define PT_R0 0
+#define PT_R1 1
+#define PT_R2 2
+#define PT_R3 3
+#define PT_R4 4
+#define PT_R5 5
+#define PT_R6 6
+#define PT_R7 7
+#define PT_R8 8
+#define PT_R9 9
+#define PT_R10 10
+#define PT_R11 11
+#define PT_R12 12
+#define PT_R13 13
+#define PT_R14 14
+#define PT_R15 15
+#define PT_R16 16
+#define PT_R17 17
+#define PT_R18 18
+#define PT_R19 19
+#define PT_R20 20
+#define PT_R21 21
+#define PT_R22 22
+#define PT_R23 23
+#define PT_R24 24
+#define PT_R25 25
+#define PT_R26 26
+#define PT_R27 27
+#define PT_R28 28
+#define PT_R29 29
+#define PT_R30 30
+#define PT_R31 31
+
+#define PT_NIP 32
+#define PT_MSR 33
+#define PT_CTR 35
+#define PT_LNK 36
+#define PT_XER 37
+#define PT_CCR 38
+#define PT_MQ 39
+
+#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
+#define PT_FPR31 (PT_FPR0 + 2*31)
+#define PT_FPSCR (PT_FPR0 + 2*32 + 1)
+
+#define sigcontext_struct sigcontext
+struct sigcontext {
+ unsigned long _unused[4];
+ int signal;
+ unsigned long handler;
+ unsigned long oldmask;
+ struct pt_regs *regs;
+};
diff --git a/mdk-stage1/dietlibc/include/asm/sigcontext.h b/mdk-stage1/dietlibc/include/asm/sigcontext.h
new file mode 100644
index 000000000..c4a720cc0
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/sigcontext.h
@@ -0,0 +1,36 @@
+#ifndef _ASM_SIGCONTEXT_H
+#define _ASM_SIGCONTEXT_H
+
+#if defined(__i386__) || defined(__x86_64__)
+#include <asm/i386-sigcontext.h>
+#endif
+
+#ifdef __sparc__
+#include <asm/sparc-sigcontext.h>
+#endif
+
+#ifdef __mips__
+#include <asm/mips-sigcontext.h>
+#endif
+
+#ifdef __powerpc__
+#include <asm/ppc-sigcontext.h>
+#endif
+
+#ifdef __alpha__
+#include <asm/alpha-sigcontext.h>
+#endif
+
+#ifdef __arm__
+#include <asm/arm-sigcontext.h>
+#endif
+
+#ifdef __hppa__
+#include <asm/parisc-sigcontext.h>
+#endif
+
+#ifdef __ia64__
+#include <asm/ia64-sigcontext.h>
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/asm/sparc-sigcontext.h b/mdk-stage1/dietlibc/include/asm/sparc-sigcontext.h
new file mode 100644
index 000000000..98e4e09ce
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/sparc-sigcontext.h
@@ -0,0 +1,50 @@
+
+#define __SUNOS_MAXWIN 31
+
+/* This is what SunOS does, so shall I. */
+struct sigcontext {
+ int sigc_onstack; /* state to restore */
+ int sigc_mask; /* sigmask to restore */
+ int sigc_sp; /* stack pointer */
+ int sigc_pc; /* program counter */
+ int sigc_npc; /* next program counter */
+ int sigc_psr; /* for condition codes etc */
+ int sigc_g1; /* User uses these two registers */
+ int sigc_o0; /* within the trampoline code. */
+
+ /* Now comes information regarding the users window set
+ * at the time of the signal.
+ */
+ int sigc_oswins; /* outstanding windows */
+
+ /* stack ptrs for each regwin buf */
+ char *sigc_spbuf[__SUNOS_MAXWIN];
+
+ /* Windows to restore after signal */
+ struct {
+ unsigned long locals[8];
+ unsigned long ins[8];
+ } sigc_wbuf[__SUNOS_MAXWIN];
+};
+
+typedef struct {
+ struct {
+ unsigned long psr;
+ unsigned long pc;
+ unsigned long npc;
+ unsigned long y;
+ unsigned long u_regs[16]; /* globals and ins */
+ } si_regs;
+ int si_mask;
+} __siginfo_t;
+
+typedef struct {
+ unsigned long si_float_regs [32];
+ unsigned long si_fsr;
+ unsigned long si_fpqdepth;
+ struct {
+ unsigned long *insn_addr;
+ unsigned long insn;
+ } si_fpqueue [16];
+} __siginfo_fpu_t;
+
diff --git a/mdk-stage1/dietlibc/include/asm/statfs.h b/mdk-stage1/dietlibc/include/asm/statfs.h
new file mode 100644
index 000000000..53b3b5e4d
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/statfs.h
@@ -0,0 +1 @@
+#include <sys/vfs.h>
diff --git a/mdk-stage1/dietlibc/include/asm/types.h b/mdk-stage1/dietlibc/include/asm/types.h
new file mode 100644
index 000000000..aafa80f16
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/asm/types.h
@@ -0,0 +1,32 @@
+#ifndef _ASM_TYPES_H
+#define _ASM_TYPES_H
+
+#include <sys/types.h>
+
+#ifdef __alpha__
+typedef unsigned int umode_t;
+#else
+typedef unsigned short umode_t;
+#endif
+
+typedef uint8_t __u8;
+typedef uint16_t __u16;
+typedef uint32_t __u32;
+#ifndef __STRICT_ANSI__
+typedef uint64_t __u64;
+#endif
+
+typedef int8_t __s8;
+typedef int16_t __s16;
+typedef int32_t __s32;
+#ifndef __STRICT_ANSI__
+typedef int64_t __s64;
+#endif
+
+#if defined(__alpha__)
+typedef unsigned long __kernel_size_t;
+#else
+typedef unsigned int __kernel_size_t;
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/assert.h b/mdk-stage1/dietlibc/include/assert.h
index bb573d0f2..a8ce3ce87 100644
--- a/mdk-stage1/dietlibc/include/assert.h
+++ b/mdk-stage1/dietlibc/include/assert.h
@@ -4,24 +4,35 @@
#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)
+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__
+# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+# define __ASSERT_FUNCTION __func__
+# else
+# define __ASSERT_FUNCTION ((const char *) 0)
+# endif
#endif
#undef assert
#ifdef NDEBUG
#define assert(expr)
#else
+#ifdef expect
+# define assert(expr) \
+ ((void) (expect((long)(expr),0) ? 0 : \
+ (__assert_fail (#expr, \
+ __FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
+#else
# define assert(expr) \
((void) ((expr) ? 0 : \
(__assert_fail (#expr, \
__FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
#endif
+#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/cpio.h b/mdk-stage1/dietlibc/include/cpio.h
new file mode 100644
index 000000000..a18c2fbb6
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/cpio.h
@@ -0,0 +1,27 @@
+#ifndef _CPIO_H_
+#define _CPIO_H_
+
+#define C_IRUSR 0000400
+#define C_IWUSR 0000200
+#define C_IXUSR 0000100
+#define C_IRGRP 0000040
+#define C_IWGRP 0000020
+#define C_IXGRP 0000010
+#define C_IROTH 0000004
+#define C_IWOTH 0000002
+#define C_IXOTH 0000001
+#define C_ISUID 0004000
+#define C_ISGID 0002000
+#define C_ISVTX 0001000
+#define C_ISDIR 0040000
+#define C_ISFIFO 0010000
+#define C_ISREG 0100000
+#define C_ISBLK 0060000
+#define C_ISCHR 0020000
+#define C_ISCTG 0110000
+#define C_ISLNK 0120000
+#define C_ISSOCK 0140000
+
+#define MAGIC "070707"
+
+#endif /* _CPIO_H_ */
diff --git a/mdk-stage1/dietlibc/include/daemon.h b/mdk-stage1/dietlibc/include/daemon.h
index 9049f367d..e2413d42b 100644
--- a/mdk-stage1/dietlibc/include/daemon.h
+++ b/mdk-stage1/dietlibc/include/daemon.h
@@ -1,6 +1,6 @@
#ifndef _DAEMON_H
#define _DAEMON_H
-extern int daemon (int nochdir,int noclose);
+#include <unistd.h>
#endif
diff --git a/mdk-stage1/dietlibc/include/dietref.h b/mdk-stage1/dietlibc/include/dietref.h
new file mode 100644
index 000000000..99d446300
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/dietref.h
@@ -0,0 +1,22 @@
+/* diet includes this file to create linker dependencies on the diet
+ * libc, so trying to link an object file compiled with diet against
+ * glibc will fail. */
+
+#ifndef NODIETREF
+#include <endian.h>
+#ifdef __ASSEMBLER__
+.section .note
+#if (__WORDSIZE == 64)
+.quad __you_tried_to_link_a_dietlibc_object_against_glibc
+#else
+.long __you_tried_to_link_a_dietlibc_object_against_glibc
+#endif
+.previous
+#else
+#if (__WORDSIZE == 64)
+__asm__ (".section .note\n\t.quad __you_tried_to_link_a_dietlibc_object_against_glibc\n\t.previous");
+#else
+__asm__ (".section .note\n\t.long __you_tried_to_link_a_dietlibc_object_against_glibc\n\t.previous");
+#endif
+#endif
+#endif
diff --git a/mdk-stage1/dietlibc/include/dirent.h b/mdk-stage1/dietlibc/include/dirent.h
index b0ad4f5ec..ad8b3a41a 100644
--- a/mdk-stage1/dietlibc/include/dirent.h
+++ b/mdk-stage1/dietlibc/include/dirent.h
@@ -3,15 +3,30 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <limits.h>
-#include <linux/dirent.h>
+struct dirent {
+ long d_ino;
+ off_t d_off;
+ unsigned short d_reclen;
+ char d_name[256]; /* We must not include limits.h! */
+};
+
+#ifndef __STRICT_ANSI__
+struct dirent64 {
+ uint64_t d_ino;
+ int64_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[256];
+};
+#endif
#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;
@@ -23,4 +38,27 @@ void rewinddir (DIR *__dirp) __THROW;
void seekdir (DIR *__dirp, long int __pos) __THROW;
long int telldir (DIR *__dirp) __THROW;
+int scandir(const char *dir, struct dirent ***namelist,
+ int (*selection)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **)) __THROW;
+int scandir64(const char *dir, struct dirent64 ***namelist,
+ int (*selection)(const struct dirent64 *),
+ int (*compar)(const struct dirent64 **, const struct dirent64 **)) __THROW;
+
+int alphasort(const struct dirent **a, const struct dirent **b) __THROW __attribute__((const));
+int alphasort64(const struct dirent64 **a, const struct dirent64 **b) __THROW __attribute__((const));
+
+#define MAXNAMLEN NAME_MAX
+
+#ifdef _BSD_SOURCE
+extern int dirfd(DIR *dirp) __THROW;
+#endif
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+#define dirent dirent64
+#define readdir readdir64
+#define scandir scandir64
+#define alphasort alphasort64
+#endif
+
#endif
diff --git a/mdk-stage1/dietlibc/include/dlfcn.h b/mdk-stage1/dietlibc/include/dlfcn.h
index b96f8f615..0ddcafdba 100644
--- a/mdk-stage1/dietlibc/include/dlfcn.h
+++ b/mdk-stage1/dietlibc/include/dlfcn.h
@@ -7,6 +7,9 @@
#define RTLD_LOCAL 0x00000
#define RTLD_GLOBAL 0x10000
+#define RTLD_DEFAULT ((void*)1)
+#define RTLD_NEXT ((void*)2)
+
void *dlopen (const char *filename, int flag);
const char *dlerror(void);
void *dlsym(void *handle, char *symbol);
diff --git a/mdk-stage1/dietlibc/include/elf.h b/mdk-stage1/dietlibc/include/elf.h
index be09dbee4..7b198bad3 100644
--- a/mdk-stage1/dietlibc/include/elf.h
+++ b/mdk-stage1/dietlibc/include/elf.h
@@ -1 +1,780 @@
-#include <linux/elf.h>
+#ifndef _ELF_H
+#define _ELF_H
+
+#include <inttypes.h>
+
+/* 32-bit ELF base types. */
+typedef uint32_t Elf32_Addr;
+typedef uint16_t Elf32_Half;
+typedef uint32_t Elf32_Off;
+typedef int32_t Elf32_Sword;
+typedef uint32_t Elf32_Word;
+
+/* 64-bit ELF base types. */
+typedef uint64_t Elf64_Addr;
+typedef uint16_t Elf64_Half;
+typedef int16_t Elf64_SHalf;
+typedef uint64_t Elf64_Off;
+typedef int32_t Elf64_Sword;
+typedef uint32_t Elf64_Word;
+typedef uint64_t Elf64_Xword;
+typedef int64_t Elf64_Sxword;
+
+/* These constants are for the segment types stored in the image headers */
+#define PT_NULL 0
+#define PT_LOAD 1
+#define PT_DYNAMIC 2
+#define PT_INTERP 3
+#define PT_NOTE 4
+#define PT_SHLIB 5
+#define PT_PHDR 6
+#define PT_LOPROC 0x70000000
+#define PT_HIPROC 0x7fffffff
+#define PT_MIPS_REGINFO 0x70000000
+
+/* Flags in the e_flags field of the header */
+#define EF_MIPS_NOREORDER 0x00000001
+#define EF_MIPS_PIC 0x00000002
+#define EF_MIPS_CPIC 0x00000004
+#define EF_MIPS_ARCH 0xf0000000
+
+/* These constants define the different elf file types */
+#define ET_NONE 0
+#define ET_REL 1
+#define ET_EXEC 2
+#define ET_DYN 3
+#define ET_CORE 4
+#define ET_LOPROC 0xff00
+#define ET_HIPROC 0xffff
+
+/* These constants define the various ELF target machines */
+#define EM_NONE 0
+#define EM_M32 1
+#define EM_SPARC 2
+#define EM_386 3
+#define EM_68K 4
+#define EM_88K 5
+#define EM_486 6 /* Perhaps disused */
+#define EM_860 7
+
+#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
+
+#define EM_PARISC 15 /* HPPA */
+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
+#define EM_PPC 20 /* PowerPC */
+#define EM_S390 22 /* IBM S/390 */
+
+#define EM_ARM 40 /* ARM */
+#define EM_SH 42 /* SuperH */
+#define EM_SPARCV9 43 /* SPARC v9 64-bit */
+#define EM_IA_64 50 /* HP/Intel IA-64 */
+#define EM_X86_64 62 /* AMD x86-64 */
+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
+
+/*
+ * This is an interim value that we will use until the committee comes
+ * up with a final number.
+ */
+#define EM_ALPHA 0x9026
+
+/*
+ * This is the old interim value for S/390 architecture
+ */
+#define EM_S390_OLD 0xA390
+
+/* This is the info that is needed to parse the dynamic section of the file */
+#define DT_NULL 0
+#define DT_NEEDED 1
+#define DT_PLTRELSZ 2
+#define DT_PLTGOT 3
+#define DT_HASH 4
+#define DT_STRTAB 5
+#define DT_SYMTAB 6
+#define DT_RELA 7
+#define DT_RELASZ 8
+#define DT_RELAENT 9
+#define DT_STRSZ 10
+#define DT_SYMENT 11
+#define DT_INIT 12
+#define DT_FINI 13
+#define DT_SONAME 14
+#define DT_RPATH 15
+#define DT_SYMBOLIC 16
+#define DT_REL 17
+#define DT_RELSZ 18
+#define DT_RELENT 19
+#define DT_PLTREL 20
+#define DT_DEBUG 21
+#define DT_TEXTREL 22
+#define DT_JMPREL 23
+#define DT_NUM 24
+#define DT_LOPROC 0x70000000
+#define DT_HIPROC 0x7fffffff
+#define DT_MIPS_RLD_VERSION 0x70000001
+#define DT_MIPS_TIME_STAMP 0x70000002
+#define DT_MIPS_ICHECKSUM 0x70000003
+#define DT_MIPS_IVERSION 0x70000004
+#define DT_MIPS_FLAGS 0x70000005
+ #define RHF_NONE 0
+ #define RHF_HARDWAY 1
+ #define RHF_NOTPOT 2
+#define DT_MIPS_BASE_ADDRESS 0x70000006
+#define DT_MIPS_CONFLICT 0x70000008
+#define DT_MIPS_LIBLIST 0x70000009
+#define DT_MIPS_LOCAL_GOTNO 0x7000000a
+#define DT_MIPS_CONFLICTNO 0x7000000b
+#define DT_MIPS_LIBLISTNO 0x70000010
+#define DT_MIPS_SYMTABNO 0x70000011
+#define DT_MIPS_UNREFEXTNO 0x70000012
+#define DT_MIPS_GOTSYM 0x70000013
+#define DT_MIPS_HIPAGENO 0x70000014
+#define DT_MIPS_RLD_MAP 0x70000016
+
+/* This info is needed when parsing the symbol table */
+#define STB_LOCAL 0
+#define STB_GLOBAL 1
+#define STB_WEAK 2
+
+#define STT_NOTYPE 0
+#define STT_OBJECT 1
+#define STT_FUNC 2
+#define STT_SECTION 3
+#define STT_FILE 4
+
+#define ELF32_ST_BIND(x) ((x) >> 4)
+#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
+
+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
+
+/* Symbolic values for the entries in the auxiliary table
+ put on the initial stack */
+#define AT_NULL 0 /* end of vector */
+#define AT_IGNORE 1 /* entry should be ignored */
+#define AT_EXECFD 2 /* file descriptor of program */
+#define AT_PHDR 3 /* program headers for program */
+#define AT_PHENT 4 /* size of program header entry */
+#define AT_PHNUM 5 /* number of program headers */
+#define AT_PAGESZ 6 /* system page size */
+#define AT_BASE 7 /* base address of interpreter */
+#define AT_FLAGS 8 /* flags */
+#define AT_ENTRY 9 /* entry point of program */
+#define AT_NOTELF 10 /* program is not ELF */
+#define AT_UID 11 /* real uid */
+#define AT_EUID 12 /* effective uid */
+#define AT_GID 13 /* real gid */
+#define AT_EGID 14 /* effective gid */
+#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
+#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
+#define AT_CLKTCK 17 /* frequency at which times() increments */
+
+typedef struct dynamic{
+ Elf32_Sword d_tag;
+ union{
+ Elf32_Sword d_val;
+ Elf32_Addr d_ptr;
+ } d_un;
+} Elf32_Dyn;
+
+typedef struct {
+ Elf64_Sxword d_tag; /* entry tag value */
+ union {
+ Elf64_Xword d_val;
+ Elf64_Addr d_ptr;
+ } d_un;
+} Elf64_Dyn;
+
+/* The following are used with relocations */
+#define ELF32_R_SYM(x) ((x) >> 8)
+#define ELF32_R_TYPE(x) ((x) & 0xff)
+
+#define ELF64_R_SYM(x) ((x) >> 32)
+#define ELF64_R_TYPE(x) ((x) & 0xffffffff)
+
+#define R_386_NONE 0
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GOT32 3
+#define R_386_PLT32 4
+#define R_386_COPY 5
+#define R_386_GLOB_DAT 6
+#define R_386_JMP_SLOT 7
+#define R_386_RELATIVE 8
+#define R_386_GOTOFF 9
+#define R_386_GOTPC 10
+#define R_386_NUM 11
+
+#define R_MIPS_NONE 0
+#define R_MIPS_16 1
+#define R_MIPS_32 2
+#define R_MIPS_REL32 3
+#define R_MIPS_26 4
+#define R_MIPS_HI16 5
+#define R_MIPS_LO16 6
+#define R_MIPS_GPREL16 7
+#define R_MIPS_LITERAL 8
+#define R_MIPS_GOT16 9
+#define R_MIPS_PC16 10
+#define R_MIPS_CALL16 11
+#define R_MIPS_GPREL32 12
+/* The remaining relocs are defined on Irix, although they are not
+ in the MIPS ELF ABI. */
+#define R_MIPS_UNUSED1 13
+#define R_MIPS_UNUSED2 14
+#define R_MIPS_UNUSED3 15
+#define R_MIPS_SHIFT5 16
+#define R_MIPS_SHIFT6 17
+#define R_MIPS_64 18
+#define R_MIPS_GOT_DISP 19
+#define R_MIPS_GOT_PAGE 20
+#define R_MIPS_GOT_OFST 21
+/*
+ * The following two relocation types are specified in the MIPS ABI
+ * conformance guide version 1.2 but not yet in the psABI.
+ */
+#define R_MIPS_GOTHI16 22
+#define R_MIPS_GOTLO16 23
+#define R_MIPS_SUB 24
+#define R_MIPS_INSERT_A 25
+#define R_MIPS_INSERT_B 26
+#define R_MIPS_DELETE 27
+#define R_MIPS_HIGHER 28
+#define R_MIPS_HIGHEST 29
+/*
+ * The following two relocation types are specified in the MIPS ABI
+ * conformance guide version 1.2 but not yet in the psABI.
+ */
+#define R_MIPS_CALLHI16 30
+#define R_MIPS_CALLLO16 31
+/*
+ * This range is reserved for vendor specific relocations.
+ */
+#define R_MIPS_LOVENDOR 100
+#define R_MIPS_HIVENDOR 127
+
+
+/*
+ * Sparc ELF relocation types
+ */
+#define R_SPARC_NONE 0
+#define R_SPARC_8 1
+#define R_SPARC_16 2
+#define R_SPARC_32 3
+#define R_SPARC_DISP8 4
+#define R_SPARC_DISP16 5
+#define R_SPARC_DISP32 6
+#define R_SPARC_WDISP30 7
+#define R_SPARC_WDISP22 8
+#define R_SPARC_HI22 9
+#define R_SPARC_22 10
+#define R_SPARC_13 11
+#define R_SPARC_LO10 12
+#define R_SPARC_GOT10 13
+#define R_SPARC_GOT13 14
+#define R_SPARC_GOT22 15
+#define R_SPARC_PC10 16
+#define R_SPARC_PC22 17
+#define R_SPARC_WPLT30 18
+#define R_SPARC_COPY 19
+#define R_SPARC_GLOB_DAT 20
+#define R_SPARC_JMP_SLOT 21
+#define R_SPARC_RELATIVE 22
+#define R_SPARC_UA32 23
+#define R_SPARC_PLT32 24
+#define R_SPARC_HIPLT22 25
+#define R_SPARC_LOPLT10 26
+#define R_SPARC_PCPLT32 27
+#define R_SPARC_PCPLT22 28
+#define R_SPARC_PCPLT10 29
+#define R_SPARC_10 30
+#define R_SPARC_11 31
+#define R_SPARC_WDISP16 40
+#define R_SPARC_WDISP19 41
+#define R_SPARC_7 43
+#define R_SPARC_5 44
+#define R_SPARC_6 45
+
+/* Bits present in AT_HWCAP, primarily for Sparc32. */
+
+#define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */
+#define HWCAP_SPARC_STBAR 2
+#define HWCAP_SPARC_SWAP 4
+#define HWCAP_SPARC_MULDIV 8
+#define HWCAP_SPARC_V9 16
+#define HWCAP_SPARC_ULTRA3 32
+
+/*
+ * 68k ELF relocation types
+ */
+#define R_68K_NONE 0
+#define R_68K_32 1
+#define R_68K_16 2
+#define R_68K_8 3
+#define R_68K_PC32 4
+#define R_68K_PC16 5
+#define R_68K_PC8 6
+#define R_68K_GOT32 7
+#define R_68K_GOT16 8
+#define R_68K_GOT8 9
+#define R_68K_GOT32O 10
+#define R_68K_GOT16O 11
+#define R_68K_GOT8O 12
+#define R_68K_PLT32 13
+#define R_68K_PLT16 14
+#define R_68K_PLT8 15
+#define R_68K_PLT32O 16
+#define R_68K_PLT16O 17
+#define R_68K_PLT8O 18
+#define R_68K_COPY 19
+#define R_68K_GLOB_DAT 20
+#define R_68K_JMP_SLOT 21
+#define R_68K_RELATIVE 22
+
+/*
+ * Alpha ELF relocation types
+ */
+#define R_ALPHA_NONE 0 /* No reloc */
+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
+#define R_ALPHA_OP_PUSH 12 /* OP stack push */
+#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */
+#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */
+#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */
+#define R_ALPHA_GPVALUE 16
+#define R_ALPHA_GPRELHIGH 17
+#define R_ALPHA_GPRELLOW 18
+#define R_ALPHA_IMMED_GP_16 19
+#define R_ALPHA_IMMED_GP_HI32 20
+#define R_ALPHA_IMMED_SCN_HI32 21
+#define R_ALPHA_IMMED_BR_HI32 22
+#define R_ALPHA_IMMED_LO32 23
+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
+
+/* Legal values for e_flags field of Elf64_Ehdr. */
+
+#define EF_ALPHA_32BIT 1 /* All addresses are below 2GB */
+
+/*
+ * PowerPC
+ */
+
+/* Values for Elf32/64_Ehdr.e_flags. */
+#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
+
+/* Cygnus local bits below */
+#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
+#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib flag */
+
+/* PowerPC relocations defined by the ABIs */
+#define R_PPC_NONE 0
+#define R_PPC_ADDR32 1 /* 32bit absolute address */
+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
+#define R_PPC_ADDR16 3 /* 16bit absolute address */
+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
+#define R_PPC_ADDR14_BRTAKEN 8
+#define R_PPC_ADDR14_BRNTAKEN 9
+#define R_PPC_REL24 10 /* PC relative 26 bit */
+#define R_PPC_REL14 11 /* PC relative 16 bit */
+#define R_PPC_REL14_BRTAKEN 12
+#define R_PPC_REL14_BRNTAKEN 13
+#define R_PPC_GOT16 14
+#define R_PPC_GOT16_LO 15
+#define R_PPC_GOT16_HI 16
+#define R_PPC_GOT16_HA 17
+#define R_PPC_PLTREL24 18
+#define R_PPC_COPY 19
+#define R_PPC_GLOB_DAT 20
+#define R_PPC_JMP_SLOT 21
+#define R_PPC_RELATIVE 22
+#define R_PPC_LOCAL24PC 23
+#define R_PPC_UADDR32 24
+#define R_PPC_UADDR16 25
+#define R_PPC_REL32 26
+#define R_PPC_PLT32 27
+#define R_PPC_PLTREL32 28
+#define R_PPC_PLT16_LO 29
+#define R_PPC_PLT16_HI 30
+#define R_PPC_PLT16_HA 31
+#define R_PPC_SDAREL16 32
+#define R_PPC_SECTOFF 33
+#define R_PPC_SECTOFF_LO 34
+#define R_PPC_SECTOFF_HI 35
+#define R_PPC_SECTOFF_HA 36
+/* Keep this the last entry. */
+#define R_PPC_NUM 37
+
+/* The remaining relocs are from the Embedded ELF ABI, and are not
+ in the SVR4 ELF ABI. */
+#define R_PPC_EMB_NADDR32 101
+#define R_PPC_EMB_NADDR16 102
+#define R_PPC_EMB_NADDR16_LO 103
+#define R_PPC_EMB_NADDR16_HI 104
+#define R_PPC_EMB_NADDR16_HA 105
+#define R_PPC_EMB_SDAI16 106
+#define R_PPC_EMB_SDA2I16 107
+#define R_PPC_EMB_SDA2REL 108
+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
+#define R_PPC_EMB_MRKREF 110
+#define R_PPC_EMB_RELSEC16 111
+#define R_PPC_EMB_RELST_LO 112
+#define R_PPC_EMB_RELST_HI 113
+#define R_PPC_EMB_RELST_HA 114
+#define R_PPC_EMB_BIT_FLD 115
+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
+
+/* Diab tool relocations. */
+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
+
+/* This is a phony reloc to handle any old fashioned TOC16 references
+ that may still be in object files. */
+#define R_PPC_TOC16 255
+
+/*
+ * ARM ELF relocation types
+ */
+#define R_ARM_NONE 0 /* No reloc */
+#define R_ARM_PC24 1 /* PC relative 26 bit branch */
+#define R_ARM_ABS32 2 /* Direct 32 bit */
+#define R_ARM_REL32 3 /* PC relative 32 bit */
+#define R_ARM_PC13 4
+#define R_ARM_ABS16 5 /* Direct 16 bit */
+#define R_ARM_ABS12 6 /* Direct 12 bit */
+#define R_ARM_THM_ABS5 7
+#define R_ARM_ABS8 8 /* Direct 8 bit */
+#define R_ARM_SBREL32 9
+#define R_ARM_THM_PC22 10
+#define R_ARM_THM_PC8 11
+#define R_ARM_AMP_VCALL9 12
+#define R_ARM_SWI24 13
+#define R_ARM_THM_SWI8 14
+#define R_ARM_XPC25 15
+#define R_ARM_THM_XPC22 16
+#define R_ARM_COPY 20 /* Copy symbol at runtime */
+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
+#define R_ARM_RELATIVE 23 /* Adjust by program base */
+#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
+#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
+#define R_ARM_GOT32 26 /* 32 bit GOT entry */
+#define R_ARM_PLT32 27 /* 32 bit PLT address */
+#define R_ARM_GNU_VTENTRY 100
+#define R_ARM_GNU_VTINHERIT 101
+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
+#define R_ARM_THM_PC9 103 /* thumb conditional branch */
+#define R_ARM_RXPC25 249
+#define R_ARM_RSBREL32 250
+#define R_ARM_THM_RPC22 251
+#define R_ARM_RREL32 252
+#define R_ARM_RABS22 253
+#define R_ARM_RPC24 254
+#define R_ARM_RBASE 255
+/* Keep this the last entry. */
+#define R_ARM_NUM 256
+
+/* Processor specific flags for the ELF header e_flags field. */
+#define EF_ARM_RELEXEC 0x01
+#define EF_ARM_HASENTRY 0x02
+#define EF_ARM_INTERWORK 0x04
+#define EF_ARM_APCS_26 0x08
+#define EF_ARM_APCS_FLOAT 0x10
+#define EF_ARM_PIC 0x20
+#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use */
+#define EF_NEW_ABI 0x80
+#define EF_OLD_ABI 0x100
+
+/* Additional symbol types for Thumb */
+#define STT_ARM_TFUNC 0xd
+
+/* AMD x86-64 relocations. */
+#define R_X86_64_NONE 0 /* No reloc */
+#define R_X86_64_64 1 /* Direct 64 bit */
+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
+#define R_X86_64_PLT32 4 /* 32 bit PLT address */
+#define R_X86_64_COPY 5 /* Copy symbol at runtime */
+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
+#define R_X86_64_RELATIVE 8 /* Adjust by program base */
+#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative
+ offset to GOT */
+#define R_X86_64_32 10 /* Direct 32 bit zero extended */
+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
+#define R_X86_64_16 12 /* Direct 16 bit zero extended */
+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
+#define R_X86_64_8 14 /* Direct 8 bit sign extended */
+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
+#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
+#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */
+#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */
+#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset
+ to two GOT entries for GD symbol */
+#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset
+ to two GOT entries for LD symbol */
+#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
+#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset
+ to GOT entry for IE symbol */
+#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */
+
+#define R_X86_64_NUM 24
+
+typedef struct elf32_rel {
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
+} Elf32_Rel;
+
+typedef struct elf64_rel {
+ Elf64_Addr r_offset; /* Location at which to apply the action */
+ Elf64_Xword r_info; /* index and type of relocation */
+} Elf64_Rel;
+
+typedef struct elf32_rela{
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
+ Elf32_Sword r_addend;
+} Elf32_Rela;
+
+typedef struct elf64_rela {
+ Elf64_Addr r_offset; /* Location at which to apply the action */
+ Elf64_Xword r_info; /* index and type of relocation */
+ Elf64_Sxword r_addend; /* Constant addend used to compute value */
+} Elf64_Rela;
+
+typedef struct elf32_sym{
+ Elf32_Word st_name;
+ Elf32_Addr st_value;
+ Elf32_Word st_size;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf32_Half st_shndx;
+} Elf32_Sym;
+
+typedef struct elf64_sym {
+ Elf64_Word st_name; /* Symbol name, index in string tbl */
+ unsigned char st_info; /* Type and binding attributes */
+ unsigned char st_other; /* No defined meaning, 0 */
+ Elf64_Half st_shndx; /* Associated section index */
+ Elf64_Addr st_value; /* Value of the symbol */
+ Elf64_Xword st_size; /* Associated symbol size */
+} Elf64_Sym;
+
+
+#define EI_NIDENT 16
+
+typedef struct elf32_hdr{
+ unsigned char e_ident[EI_NIDENT];
+ Elf32_Half e_type;
+ Elf32_Half e_machine;
+ Elf32_Word e_version;
+ Elf32_Addr e_entry; /* Entry point */
+ Elf32_Off e_phoff;
+ Elf32_Off e_shoff;
+ Elf32_Word e_flags;
+ Elf32_Half e_ehsize;
+ Elf32_Half e_phentsize;
+ Elf32_Half e_phnum;
+ Elf32_Half e_shentsize;
+ Elf32_Half e_shnum;
+ Elf32_Half e_shstrndx;
+} Elf32_Ehdr;
+
+typedef struct elf64_hdr {
+ unsigned char e_ident[16]; /* ELF "magic number" */
+ Elf64_Half e_type;
+ Elf64_Half e_machine;
+ Elf64_Word e_version;
+ Elf64_Addr e_entry; /* Entry point virtual address */
+ Elf64_Off e_phoff; /* Program header table file offset */
+ Elf64_Off e_shoff; /* Section header table file offset */
+ Elf64_Word e_flags;
+ Elf64_Half e_ehsize;
+ Elf64_Half e_phentsize;
+ Elf64_Half e_phnum;
+ Elf64_Half e_shentsize;
+ Elf64_Half e_shnum;
+ Elf64_Half e_shstrndx;
+} Elf64_Ehdr;
+
+/* These constants define the permissions on sections in the program
+ header, p_flags. */
+#define PF_R 0x4
+#define PF_W 0x2
+#define PF_X 0x1
+
+typedef struct elf32_phdr{
+ Elf32_Word p_type;
+ Elf32_Off p_offset;
+ Elf32_Addr p_vaddr;
+ Elf32_Addr p_paddr;
+ Elf32_Word p_filesz;
+ Elf32_Word p_memsz;
+ Elf32_Word p_flags;
+ Elf32_Word p_align;
+} Elf32_Phdr;
+
+typedef struct elf64_phdr {
+ Elf64_Word p_type;
+ Elf64_Word p_flags;
+ Elf64_Off p_offset; /* Segment file offset */
+ Elf64_Addr p_vaddr; /* Segment virtual address */
+ Elf64_Addr p_paddr; /* Segment physical address */
+ Elf64_Xword p_filesz; /* Segment size in file */
+ Elf64_Xword p_memsz; /* Segment size in memory */
+ Elf64_Xword p_align; /* Segment alignment, file & memory */
+} Elf64_Phdr;
+
+/* sh_type */
+#define SHT_NULL 0
+#define SHT_PROGBITS 1
+#define SHT_SYMTAB 2
+#define SHT_STRTAB 3
+#define SHT_RELA 4
+#define SHT_HASH 5
+#define SHT_DYNAMIC 6
+#define SHT_NOTE 7
+#define SHT_NOBITS 8
+#define SHT_REL 9
+#define SHT_SHLIB 10
+#define SHT_DYNSYM 11
+#define SHT_NUM 12
+#define SHT_LOPROC 0x70000000
+#define SHT_HIPROC 0x7fffffff
+#define SHT_LOUSER 0x80000000
+#define SHT_HIUSER 0xffffffff
+#define SHT_MIPS_LIST 0x70000000
+#define SHT_MIPS_CONFLICT 0x70000002
+#define SHT_MIPS_GPTAB 0x70000003
+#define SHT_MIPS_UCODE 0x70000004
+
+/* sh_flags */
+#define SHF_WRITE 0x1
+#define SHF_ALLOC 0x2
+#define SHF_EXECINSTR 0x4
+#define SHF_MASKPROC 0xf0000000
+#define SHF_MIPS_GPREL 0x10000000
+#define SHF_ALPHA_GPREL 0x10000000
+
+/* special section indexes */
+#define SHN_UNDEF 0
+#define SHN_LORESERVE 0xff00
+#define SHN_LOPROC 0xff00
+#define SHN_HIPROC 0xff1f
+#define SHN_ABS 0xfff1
+#define SHN_COMMON 0xfff2
+#define SHN_HIRESERVE 0xffff
+#define SHN_MIPS_ACCOMON 0xff00
+
+typedef struct {
+ Elf32_Word sh_name;
+ Elf32_Word sh_type;
+ Elf32_Word sh_flags;
+ Elf32_Addr sh_addr;
+ Elf32_Off sh_offset;
+ Elf32_Word sh_size;
+ Elf32_Word sh_link;
+ Elf32_Word sh_info;
+ Elf32_Word sh_addralign;
+ Elf32_Word sh_entsize;
+} Elf32_Shdr;
+
+typedef struct elf64_shdr {
+ Elf64_Word sh_name; /* Section name, index in string tbl */
+ Elf64_Word sh_type; /* Type of section */
+ Elf64_Xword sh_flags; /* Miscellaneous section attributes */
+ Elf64_Addr sh_addr; /* Section virtual addr at execution */
+ Elf64_Off sh_offset; /* Section file offset */
+ Elf64_Xword sh_size; /* Size of section in bytes */
+ Elf64_Word sh_link; /* Index of another section */
+ Elf64_Word sh_info; /* Additional section information */
+ Elf64_Xword sh_addralign; /* Section alignment */
+ Elf64_Xword sh_entsize; /* Entry size if section holds table */
+} Elf64_Shdr;
+
+#define EI_MAG0 0 /* e_ident[] indexes */
+#define EI_MAG1 1
+#define EI_MAG2 2
+#define EI_MAG3 3
+#define EI_CLASS 4
+#define EI_DATA 5
+#define EI_VERSION 6
+#define EI_PAD 7
+
+#define ELFMAG0 0x7f /* EI_MAG */
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+#define ELFMAG "\177ELF"
+#define SELFMAG 4
+
+#define ELFCLASSNONE 0 /* EI_CLASS */
+#define ELFCLASS32 1
+#define ELFCLASS64 2
+#define ELFCLASSNUM 3
+
+#define ELFDATANONE 0 /* e_ident[EI_DATA] */
+#define ELFDATA2LSB 1
+#define ELFDATA2MSB 2
+
+#define EV_NONE 0 /* e_version, EI_VERSION */
+#define EV_CURRENT 1
+#define EV_NUM 2
+
+/* Notes used in ET_CORE */
+#define NT_PRSTATUS 1
+#define NT_PRFPREG 2
+#define NT_PRPSINFO 3
+#define NT_TASKSTRUCT 4
+#define NT_PRFPXREG 20
+
+/* Note header in a PT_NOTE section */
+typedef struct elf32_note {
+ Elf32_Word n_namesz; /* Name size */
+ Elf32_Word n_descsz; /* Content size */
+ Elf32_Word n_type; /* Content type */
+} Elf32_Nhdr;
+
+/* Note header in a PT_NOTE section */
+typedef struct elf64_note {
+ Elf64_Word n_namesz; /* Name size */
+ Elf64_Word n_descsz; /* Content size */
+ Elf64_Word n_type; /* Content type */
+} Elf64_Nhdr;
+
+#if ELF_CLASS == ELFCLASS32
+
+extern Elf32_Dyn _DYNAMIC [];
+#define elfhdr elf32_hdr
+#define elf_phdr elf32_phdr
+#define elf_note elf32_note
+
+#else
+
+extern Elf64_Dyn _DYNAMIC [];
+#define elfhdr elf64_hdr
+#define elf_phdr elf64_phdr
+#define elf_note elf64_note
+
+#endif
+
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/endian.h b/mdk-stage1/dietlibc/include/endian.h
index 463c24fff..93b1f2948 100644
--- a/mdk-stage1/dietlibc/include/endian.h
+++ b/mdk-stage1/dietlibc/include/endian.h
@@ -4,35 +4,42 @@
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
-#ifdef __i386__
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
+#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
+#define __BYTE_ORDER __BIG_ENDIAN
+#define __FLOAT_WORD_ORDER __BYTE_ORDER
+#endif
+
+#ifdef __hppa__
+/* I hope this is correct...? */
+#define __BYTE_ORDER __BIG_ENDIAN
+#define __FLOAT_WORD_ORDER __BYTE_ORDER
#endif
#ifdef __mips__
#ifdef __MIPSEB__
-#define __BIG_ENDIAN__
+#define __BYTE_ORDER __BIG_ENDIAN
+#define __FLOAT_WORD_ORDER __BYTE_ORDER
#endif
#endif
#ifndef __BYTE_ORDER
#ifdef __BIG_ENDIAN__
-#define __BYTE_ORDER __BIG_ENDIAN
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
+#define __BYTE_ORDER __BIG_ENDIAN
+#define __FLOAT_WORD_ORDER __BYTE_ORDER
#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
+#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
+#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
@@ -40,4 +47,16 @@
# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
+#if defined(__alpha__) || defined(__mips64) || defined(__sparc_v9__) || defined(__x86_64__) || defined(__ia64__)
+#define __WORDSIZE 64
+#endif
+
+#if defined(__sparc__) && (__arch64__)
+#define __WORDSIZE 64
+#endif
+
+#ifndef __WORDSIZE
+#define __WORDSIZE 32
+#endif
+
#endif
diff --git a/mdk-stage1/dietlibc/include/errno.h b/mdk-stage1/dietlibc/include/errno.h
index d1c68f39c..12aa394da 100644
--- a/mdk-stage1/dietlibc/include/errno.h
+++ b/mdk-stage1/dietlibc/include/errno.h
@@ -1,11 +1,546 @@
#ifndef _ERRNO_H
-#define _ERRNO_H
+#define _ERRNO_H
-extern int errno;
+#if defined(__alpha__)
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EDEADLK 11 /* Resource deadlock would occur */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define EAGAIN 35 /* Try again */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define EINPROGRESS 36 /* Operation now in progress */
+#define EALREADY 37 /* Operation already in progress */
+#define ENOTSOCK 38 /* Socket operation on non-socket */
+#define EDESTADDRREQ 39 /* Destination address required */
+#define EMSGSIZE 40 /* Message too long */
+#define EPROTOTYPE 41 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 42 /* Protocol not available */
+#define EPROTONOSUPPORT 43 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
+#define EOPNOTSUPP 45 /* Operation not supported on transport endpoint */
+#define ENOTSUP EOPNOTSUPP/* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 46 /* Protocol family not supported */
+#define EAFNOSUPPORT 47 /* Address family not supported by protocol */
+#define EADDRINUSE 48 /* Address already in use */
+#define EADDRNOTAVAIL 49 /* Cannot assign requested address */
+#define ENETDOWN 50 /* Network is down */
+#define ENETUNREACH 51 /* Network is unreachable */
+#define ENETRESET 52 /* Network dropped connection because of reset */
+#define ECONNABORTED 53 /* Software caused connection abort */
+#define ECONNRESET 54 /* Connection reset by peer */
+#define ENOBUFS 55 /* No buffer space available */
+#define EISCONN 56 /* Transport endpoint is already connected */
+#define ENOTCONN 57 /* Transport endpoint is not connected */
+#define ESHUTDOWN 58 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 59 /* Too many references: cannot splice */
+#define ETIMEDOUT 60 /* Connection timed out */
+#define ECONNREFUSED 61 /* Connection refused */
+#define ELOOP 62 /* Too many symbolic links encountered */
+#define ENAMETOOLONG 63 /* File name too long */
+#define EHOSTDOWN 64 /* Host is down */
+#define EHOSTUNREACH 65 /* No route to host */
+#define ENOTEMPTY 66 /* Directory not empty */
+#define EUSERS 68 /* Too many users */
+#define EDQUOT 69 /* Quota exceeded */
+#define ESTALE 70 /* Stale NFS file handle */
+#define EREMOTE 71 /* Object is remote */
+#define ENOLCK 77 /* No record locks available */
+#define ENOSYS 78 /* Function not implemented */
+#define ENOMSG 80 /* No message of desired type */
+#define EIDRM 81 /* Identifier removed */
+#define ENOSR 82 /* Out of streams resources */
+#define ETIME 83 /* Timer expired */
+#define EBADMSG 84 /* Not a data message */
+#define EPROTO 85 /* Protocol error */
+#define ENODATA 86 /* No data available */
+#define ENOSTR 87 /* Device not a stream */
+#define ENOPKG 92 /* Package not installed */
+#define EILSEQ 116 /* Illegal byte sequence */
+/* The following are just random noise.. */
+#define ECHRNG 88 /* Channel number out of range */
+#define EL2NSYNC 89 /* Level 2 not synchronized */
+#define EL3HLT 90 /* Level 3 halted */
+#define EL3RST 91 /* Level 3 reset */
+#define ELNRNG 93 /* Link number out of range */
+#define EUNATCH 94 /* Protocol driver not attached */
+#define ENOCSI 95 /* No CSI structure available */
+#define EL2HLT 96 /* Level 2 halted */
+#define EBADE 97 /* Invalid exchange */
+#define EBADR 98 /* Invalid request descriptor */
+#define EXFULL 99 /* Exchange full */
+#define ENOANO 100 /* No anode */
+#define EBADRQC 101 /* Invalid request code */
+#define EBADSLT 102 /* Invalid slot */
+#define EDEADLOCK EDEADLK
+#define EBFONT 104 /* Bad font file format */
+#define ENONET 105 /* Machine is not on the network */
+#define ENOLINK 106 /* Link has been severed */
+#define EADV 107 /* Advertise error */
+#define ESRMNT 108 /* Srmount error */
+#define ECOMM 109 /* Communication error on send */
+#define EMULTIHOP 110 /* Multihop attempted */
+#define EDOTDOT 111 /* RFS specific error */
+#define EOVERFLOW 112 /* Value too large for defined data type */
+#define ENOTUNIQ 113 /* Name not unique on network */
+#define EBADFD 114 /* File descriptor in bad state */
+#define EREMCHG 115 /* Remote address changed */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define ELIBACC 122 /* Can not access a needed shared library */
+#define ELIBBAD 123 /* Accessing a corrupted shared library */
+#define ELIBSCN 124 /* .lib section in a.out corrupted */
+#define ELIBMAX 125 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 126 /* Cannot exec a shared library directly */
+#define ERESTART 127 /* Interrupted system call should be restarted */
+#define ESTRPIPE 128 /* Streams pipe error */
+#define ENOMEDIUM 129 /* No medium found */
+#define EMEDIUMTYPE 130 /* Wrong medium type */
+
+#elif defined(__mips__)
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define ENOMSG 35 /* No message of desired type */
+#define EIDRM 36 /* Identifier removed */
+#define ECHRNG 37 /* Channel number out of range */
+#define EL2NSYNC 38 /* Level 2 not synchronized */
+#define EL3HLT 39 /* Level 3 halted */
+#define EL3RST 40 /* Level 3 reset */
+#define ELNRNG 41 /* Link number out of range */
+#define EUNATCH 42 /* Protocol driver not attached */
+#define ENOCSI 43 /* No CSI structure available */
+#define EL2HLT 44 /* Level 2 halted */
+#define EDEADLK 45 /* Resource deadlock would occur */
+#define ENOLCK 46 /* No record locks available */
+#define EBADE 50 /* Invalid exchange */
+#define EBADR 51 /* Invalid request descriptor */
+#define EXFULL 52 /* Exchange full */
+#define ENOANO 53 /* No anode */
+#define EBADRQC 54 /* Invalid request code */
+#define EBADSLT 55 /* Invalid slot */
+#define EDEADLOCK 56 /* File locking deadlock error */
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EDOTDOT 73 /* RFS specific error */
+#define EMULTIHOP 74 /* Multihop attempted */
+#define EBADMSG 77 /* Not a data message */
+#define ENAMETOOLONG 78 /* File name too long */
+#define EOVERFLOW 79 /* Value too large for defined data type */
+#define ENOTUNIQ 80 /* Name not unique on network */
+#define EBADFD 81 /* File descriptor in bad state */
+#define EREMCHG 82 /* Remote address changed */
+#define ELIBACC 83 /* Can not access a needed shared library */
+#define ELIBBAD 84 /* Accessing a corrupted shared library */
+#define ELIBSCN 85 /* .lib section in a.out corrupted */
+#define ELIBMAX 86 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 87 /* Cannot exec a shared library directly */
+#define EILSEQ 88 /* Illegal byte sequence */
+#define ENOSYS 89 /* Function not implemented */
+#define ELOOP 90 /* Too many symbolic links encountered */
+#define ERESTART 91 /* Interrupted system call should be restarted */
+#define ESTRPIPE 92 /* Streams pipe error */
+#define ENOTEMPTY 93 /* Directory not empty */
+#define EUSERS 94 /* Too many users */
+#define ENOTSOCK 95 /* Socket operation on non-socket */
+#define EDESTADDRREQ 96 /* Destination address required */
+#define EMSGSIZE 97 /* Message too long */
+#define EPROTOTYPE 98 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 99 /* Protocol not available */
+#define EPROTONOSUPPORT 120 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
+#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
+#define ENOTSUP EOPNOTSUPP/* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 123 /* Protocol family not supported */
+#define EAFNOSUPPORT 124 /* Address family not supported by protocol */
+#define EADDRINUSE 125 /* Address already in use */
+#define EADDRNOTAVAIL 126 /* Cannot assign requested address */
+#define ENETDOWN 127 /* Network is down */
+#define ENETUNREACH 128 /* Network is unreachable */
+#define ENETRESET 129 /* Network dropped connection because of reset */
+#define ECONNABORTED 130 /* Software caused connection abort */
+#define ECONNRESET 131 /* Connection reset by peer */
+#define ENOBUFS 132 /* No buffer space available */
+#define EISCONN 133 /* Transport endpoint is already connected */
+#define ENOTCONN 134 /* Transport endpoint is not connected */
+#define EUCLEAN 135 /* Structure needs cleaning */
+#define ENOTNAM 137 /* Not a XENIX named type file */
+#define ENAVAIL 138 /* No XENIX semaphores available */
+#define EISNAM 139 /* Is a named type file */
+#define EREMOTEIO 140 /* Remote I/O error */
+#define EINIT 141 /* Reserved */
+#define EREMDEV 142 /* Error 142 */
+#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 144 /* Too many references: cannot splice */
+#define ETIMEDOUT 145 /* Connection timed out */
+#define ECONNREFUSED 146 /* Connection refused */
+#define EHOSTDOWN 147 /* Host is down */
+#define EHOSTUNREACH 148 /* No route to host */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define EALREADY 149 /* Operation already in progress */
+#define EINPROGRESS 150 /* Operation now in progress */
+#define ESTALE 151 /* Stale NFS file handle */
+#define ECANCELED 158 /* AIO operation canceled */
+#define ENOMEDIUM 159 /* No medium found */
+#define EMEDIUMTYPE 160 /* Wrong medium type */
+#define EDQUOT 1133 /* Quota exceeded */
+
+#elif defined(__sparc__)
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define EINPROGRESS 36 /* Operation now in progress */
+#define EALREADY 37 /* Operation already in progress */
+#define ENOTSOCK 38 /* Socket operation on non-socket */
+#define EDESTADDRREQ 39 /* Destination address required */
+#define EMSGSIZE 40 /* Message too long */
+#define EPROTOTYPE 41 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 42 /* Protocol not available */
+#define EPROTONOSUPPORT 43 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
+#define EOPNOTSUPP 45 /* Op not supported on transport endpoint */
+#define ENOTSUP EOPNOTSUPP/* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 46 /* Protocol family not supported */
+#define EAFNOSUPPORT 47 /* Address family not supported by protocol */
+#define EADDRINUSE 48 /* Address already in use */
+#define EADDRNOTAVAIL 49 /* Cannot assign requested address */
+#define ENETDOWN 50 /* Network is down */
+#define ENETUNREACH 51 /* Network is unreachable */
+#define ENETRESET 52 /* Net dropped connection because of reset */
+#define ECONNABORTED 53 /* Software caused connection abort */
+#define ECONNRESET 54 /* Connection reset by peer */
+#define ENOBUFS 55 /* No buffer space available */
+#define EISCONN 56 /* Transport endpoint is already connected */
+#define ENOTCONN 57 /* Transport endpoint is not connected */
+#define ESHUTDOWN 58 /* No send after transport endpoint shutdown */
+#define ETOOMANYREFS 59 /* Too many references: cannot splice */
+#define ETIMEDOUT 60 /* Connection timed out */
+#define ECONNREFUSED 61 /* Connection refused */
+#define ELOOP 62 /* Too many symbolic links encountered */
+#define ENAMETOOLONG 63 /* File name too long */
+#define EHOSTDOWN 64 /* Host is down */
+#define EHOSTUNREACH 65 /* No route to host */
+#define ENOTEMPTY 66 /* Directory not empty */
+#define EPROCLIM 67 /* SUNOS: Too many processes */
+#define EUSERS 68 /* Too many users */
+#define EDQUOT 69 /* Quota exceeded */
+#define ESTALE 70 /* Stale NFS file handle */
+#define EREMOTE 71 /* Object is remote */
+#define ENOSTR 72 /* Device not a stream */
+#define ETIME 73 /* Timer expired */
+#define ENOSR 74 /* Out of streams resources */
+#define ENOMSG 75 /* No message of desired type */
+#define EBADMSG 76 /* Not a data message */
+#define EIDRM 77 /* Identifier removed */
+#define EDEADLK 78 /* Resource deadlock would occur */
+#define ENOLCK 79 /* No record locks available */
+#define ENONET 80 /* Machine is not on the network */
+#define ERREMOTE 81 /* SunOS: Too many lvls of remote in path */
+#define ENOLINK 82 /* Link has been severed */
+#define EADV 83 /* Advertise error */
+#define ESRMNT 84 /* Srmount error */
+#define ECOMM 85 /* Communication error on send */
+#define EPROTO 86 /* Protocol error */
+#define EMULTIHOP 87 /* Multihop attempted */
+#define EDOTDOT 88 /* RFS specific error */
+#define EREMCHG 89 /* Remote address changed */
+#define ENOSYS 90 /* Function not implemented */
+#define ESTRPIPE 91 /* Streams pipe error */
+#define EOVERFLOW 92 /* Value too large for defined data type */
+#define EBADFD 93 /* File descriptor in bad state */
+#define ECHRNG 94 /* Channel number out of range */
+#define EL2NSYNC 95 /* Level 2 not synchronized */
+#define EL3HLT 96 /* Level 3 halted */
+#define EL3RST 97 /* Level 3 reset */
+#define ELNRNG 98 /* Link number out of range */
+#define EUNATCH 99 /* Protocol driver not attached */
+#define ENOCSI 100 /* No CSI structure available */
+#define EL2HLT 101 /* Level 2 halted */
+#define EBADE 102 /* Invalid exchange */
+#define EBADR 103 /* Invalid request descriptor */
+#define EXFULL 104 /* Exchange full */
+#define ENOANO 105 /* No anode */
+#define EBADRQC 106 /* Invalid request code */
+#define EBADSLT 107 /* Invalid slot */
+#define EDEADLOCK 108 /* File locking deadlock error */
+#define EBFONT 109 /* Bad font file format */
+#define ELIBEXEC 110 /* Cannot exec a shared library directly */
+#define ENODATA 111 /* No data available */
+#define ELIBBAD 112 /* Accessing a corrupted shared library */
+#define ENOPKG 113 /* Package not installed */
+#define ELIBACC 114 /* Can not access a needed shared library */
+#define ENOTUNIQ 115 /* Name not unique on network */
+#define ERESTART 116 /* Interrupted syscall should be restarted */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EILSEQ 122 /* Illegal byte sequence */
+#define ELIBMAX 123 /* Atmpt to link in too many shared libs */
+#define ELIBSCN 124 /* .lib section in a.out corrupted */
+#define ENOMEDIUM 125 /* No medium found */
+#define EMEDIUMTYPE 126 /* Wrong medium type */
+
+#else
+
+/* i386, arm, ppc, x86_64, ia64 */
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define EDEADLK 35 /* Resource deadlock would occur */
+#define ENAMETOOLONG 36 /* File name too long */
+#define ENOLCK 37 /* No record locks available */
+#define ENOSYS 38 /* Function not implemented */
+#define ENOTEMPTY 39 /* Directory not empty */
+#define ELOOP 40 /* Too many symbolic links encountered */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define ENOMSG 42 /* No message of desired type */
+#define EIDRM 43 /* Identifier removed */
+#define ECHRNG 44 /* Channel number out of range */
+#define EL2NSYNC 45 /* Level 2 not synchronized */
+#define EL3HLT 46 /* Level 3 halted */
+#define EL3RST 47 /* Level 3 reset */
+#define ELNRNG 48 /* Link number out of range */
+#define EUNATCH 49 /* Protocol driver not attached */
+#define ENOCSI 50 /* No CSI structure available */
+#define EL2HLT 51 /* Level 2 halted */
+#define EBADE 52 /* Invalid exchange */
+#define EBADR 53 /* Invalid request descriptor */
+#define EXFULL 54 /* Exchange full */
+#define ENOANO 55 /* No anode */
+#define EBADRQC 56 /* Invalid request code */
+#define EBADSLT 57 /* Invalid slot */
+#define EDEADLOCK EDEADLK
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 72 /* Multihop attempted */
+#define EDOTDOT 73 /* RFS specific error */
+#define EBADMSG 74 /* Not a data message */
+#define EOVERFLOW 75 /* Value too large for defined data type */
+#define ENOTUNIQ 76 /* Name not unique on network */
+#define EBADFD 77 /* File descriptor in bad state */
+#define EREMCHG 78 /* Remote address changed */
+#define ELIBACC 79 /* Can not access a needed shared library */
+#define ELIBBAD 80 /* Accessing a corrupted shared library */
+#define ELIBSCN 81 /* .lib section in a.out corrupted */
+#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 83 /* Cannot exec a shared library directly */
+#define EILSEQ 84 /* Illegal byte sequence */
+#define ERESTART 85 /* Interrupted system call should be restarted */
+#define ESTRPIPE 86 /* Streams pipe error */
+#define EUSERS 87 /* Too many users */
+#define ENOTSOCK 88 /* Socket operation on non-socket */
+#define EDESTADDRREQ 89 /* Destination address required */
+#define EMSGSIZE 90 /* Message too long */
+#define EPROTOTYPE 91 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 92 /* Protocol not available */
+#define EPROTONOSUPPORT 93 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
+#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define ENOTSUP EOPNOTSUPP/* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
+#define EADDRINUSE 98 /* Address already in use */
+#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
+#define ENETDOWN 100 /* Network is down */
+#define ENETUNREACH 101 /* Network is unreachable */
+#define ENETRESET 102 /* Network dropped connection because of reset */
+#define ECONNABORTED 103 /* Software caused connection abort */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+#define EISCONN 106 /* Transport endpoint is already connected */
+#define ENOTCONN 107 /* Transport endpoint is not connected */
+#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 109 /* Too many references: cannot splice */
+#define ETIMEDOUT 110 /* Connection timed out */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EHOSTDOWN 112 /* Host is down */
+#define EHOSTUNREACH 113 /* No route to host */
+#define EALREADY 114 /* Operation already in progress */
+#define EINPROGRESS 115 /* Operation now in progress */
+#define ESTALE 116 /* Stale NFS file handle */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EDQUOT 122 /* Quota exceeded */
+#define ENOMEDIUM 123 /* No medium found */
+#define EMEDIUMTYPE 124 /* Wrong medium type */
+#endif
-#include <linux/errno.h>
+#define __SYS_NERR ((EMEDIUMTYPE) + 1)
+
+#ifndef __ASSEMBLER__
+
+#ifndef _REENTRANT
+extern int errno;
+#else
+#define errno (*__errno_location())
+#endif
extern int *__errno_location(void);
-extern void __set_errno(int error);
+
+#define __set_errno(x) errno=(x)
+
+#ifdef _BSD_SOURCE
+extern const char *const sys_errlist[];
+extern int sys_nerr;
+#endif
+
+#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/fcntl.h b/mdk-stage1/dietlibc/include/fcntl.h
index b792502c1..33f58d82a 100644
--- a/mdk-stage1/dietlibc/include/fcntl.h
+++ b/mdk-stage1/dietlibc/include/fcntl.h
@@ -6,13 +6,549 @@
#include <sys/types.h>
#include <unistd.h>
-#include <asm/fcntl.h>
+#define F_LINUX_SPECIFIC_BASE 1024
+
+#if defined(__i386__) || defined(__s390__) || defined(__x86_64__) || defined(__ia64__)
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 0100 /* not fcntl */
+#define O_EXCL 0200 /* not fcntl */
+#define O_NOCTTY 0400 /* not fcntl */
+#define O_TRUNC 01000 /* not fcntl */
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 010000
+#define FASYNC 020000 /* fcntl, for BSD compatibility */
+#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
+#define O_LARGEFILE 0100000
+#define O_DIRECTORY 0200000 /* must be a directory */
+#define O_NOFOLLOW 0400000 /* don't follow links */
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get close_on_exec */
+#define F_SETFD 2 /* set/clear close_on_exec */
+#define F_GETFL 3 /* get file->f_flags */
+#define F_SETFL 4 /* set file->f_flags */
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+#define F_SETOWN 8 /* for sockets. */
+#define F_GETOWN 9 /* for sockets. */
+#define F_SETSIG 10 /* for sockets. */
+#define F_GETSIG 11 /* for sockets. */
+
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
+
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+/* for leases */
+#define F_INPROGRESS 16
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+#define LOCK_MAND 32 /* This is a mandatory flock */
+#define LOCK_READ 64 /* ... Which allows concurrent read operations */
+#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
+#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#elif defined(__alpha__)
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 01000 /* not fcntl */
+#define O_TRUNC 02000 /* not fcntl */
+#define O_EXCL 04000 /* not fcntl */
+#define O_NOCTTY 010000 /* not fcntl */
+
+#define O_NONBLOCK 00004
+#define O_APPEND 00010
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 040000
+#define FASYNC 020000 /* fcntl, for BSD compatibility */
+#define O_DIRECT 040000 /* direct disk access - should check with OSF/1 */
+#define O_DIRECTORY 0100000 /* must be a directory */
+#define O_NOFOLLOW 0200000 /* don't follow links */
+#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get close_on_exec */
+#define F_SETFD 2 /* set/clear close_on_exec */
+#define F_GETFL 3 /* get file->f_flags */
+#define F_SETFL 4 /* set file->f_flags */
+#define F_GETLK 7
+#define F_SETLK 8
+#define F_SETLKW 9
+
+#define F_SETOWN 5 /* for sockets. */
+#define F_GETOWN 6 /* for sockets. */
+#define F_SETSIG 10 /* for sockets. */
+#define F_GETSIG 11 /* for sockets. */
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 1
+#define F_WRLCK 2
+#define F_UNLCK 8
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 16 /* or 3 */
+#define F_SHLCK 32 /* or 4 */
+
+#define F_INPROGRESS 64
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+#define LOCK_MAND 32 /* This is a mandatory flock */
+#define LOCK_READ 64 /* ... Which allows concurrent read operations */
+#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
+#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+#elif defined(__mips__)
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0x0003
+#define O_RDONLY 0x0000
+#define O_WRONLY 0x0001
+#define O_RDWR 0x0002
+#define O_APPEND 0x0008
+#define O_SYNC 0x0010
+#define O_NONBLOCK 0x0080
+#define O_CREAT 0x0100 /* not fcntl */
+#define O_TRUNC 0x0200 /* not fcntl */
+#define O_EXCL 0x0400 /* not fcntl */
+#define O_NOCTTY 0x0800 /* not fcntl */
+#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
+#define O_LARGEFILE 0x2000 /* allow large file opens - currently ignored */
+#define O_DIRECT 0x8000 /* direct disk access hint - currently ignored */
+#define O_DIRECTORY 0x10000 /* must be a directory */
+#define O_NOFOLLOW 0x20000 /* don't follow links */
+
+#define O_NDELAY O_NONBLOCK
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get close_on_exec */
+#define F_SETFD 2 /* set/clear close_on_exec */
+#define F_GETFL 3 /* get file->f_flags */
+#define F_SETFL 4 /* set file->f_flags */
+#define F_GETLK 14
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN 24 /* for sockets. */
+#define F_GETOWN 23 /* for sockets. */
+#define F_SETSIG 10 /* for sockets. */
+#define F_GETSIG 11 /* for sockets. */
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+/* for leases */
+#define F_INPROGRESS 16
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent XXXXXXXXXXXXXXXXXX
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+#define LOCK_MAND 32 /* This is a mandatory flock */
+#define LOCK_READ 64 /* ... Which allows concurrent read operations */
+#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
+#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
+
+typedef struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ long l_sysid; /* XXXXXXXXXXXXXXXXXXXXXXXXX */
+ pid_t l_pid;
+ long pad[4]; /* ZZZZZZZZZZZZZZZZZZZZZZZZZZ */
+} flock_t;
+
+#elif defined(__sparc__)
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_RDONLY 0x0000
+#define O_WRONLY 0x0001
+#define O_RDWR 0x0002
+#define O_ACCMODE 0x0003
+#define O_APPEND 0x0008
+#define FASYNC 0x0040 /* fcntl, for BSD compatibility */
+#define O_CREAT 0x0200 /* not fcntl */
+#define O_TRUNC 0x0400 /* not fcntl */
+#define O_EXCL 0x0800 /* not fcntl */
+#define O_SYNC 0x2000
+#define O_NONBLOCK 0x4000
+#define O_NDELAY (0x0004 | O_NONBLOCK)
+#define O_NOCTTY 0x8000 /* not fcntl */
+#define O_DIRECTORY 0x10000 /* must be a directory */
+#define O_NOFOLLOW 0x20000 /* don't follow links */
+#define O_LARGEFILE 0x40000
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get close_on_exec */
+#define F_SETFD 2 /* set/clear close_on_exec */
+#define F_GETFL 3 /* get file->f_flags */
+#define F_SETFL 4 /* set file->f_flags */
+#define F_GETOWN 5 /* for sockets. */
+#define F_SETOWN 6 /* for sockets. */
+#define F_GETLK 7
+#define F_SETLK 8
+#define F_SETLKW 9
+#define F_SETSIG 10 /* for sockets. */
+#define F_GETSIG 11 /* for sockets. */
+
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 1
+#define F_WRLCK 2
+#define F_UNLCK 3
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+/* for leases */
+#define F_INPROGRESS 16
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+#define LOCK_MAND 32 /* This is a mandatory flock */
+#define LOCK_READ 64 /* ... Which allows concurrent read operations */
+#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
+#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+ short __unused;
+};
+
+#ifdef __arch64__
+#define flock64 flock
+#else
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+ short __unused;
+};
+#endif
+
+#elif defined(__powerpc__)
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 0100 /* not fcntl */
+#define O_EXCL 0200 /* not fcntl */
+#define O_NOCTTY 0400 /* not fcntl */
+#define O_TRUNC 01000 /* not fcntl */
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 010000
+#define FASYNC 020000 /* fcntl, for BSD compatibility */
+#define O_DIRECTORY 040000 /* must be a directory */
+#define O_NOFOLLOW 0100000 /* don't follow links */
+#define O_LARGEFILE 0200000
+#define O_DIRECT 0400000 /* direct disk access hint - currently ignored */
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get close_on_exec */
+#define F_SETFD 2 /* set/clear close_on_exec */
+#define F_GETFL 3 /* get file->f_flags */
+#define F_SETFL 4 /* set file->f_flags */
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN 8 /* for sockets. */
+#define F_GETOWN 9 /* for sockets. */
+#define F_SETSIG 10 /* for sockets. */
+#define F_GETSIG 11 /* for sockets. */
+
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+/* for leases */
+#define F_INPROGRESS 16
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+#define LOCK_MAND 32 /* This is a mandatory flock */
+#define LOCK_READ 64 /* ... Which allows concurrent read operations */
+#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
+#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#elif defined (__arm__)
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 0100 /* not fcntl */
+#define O_EXCL 0200 /* not fcntl */
+#define O_NOCTTY 0400 /* not fcntl */
+#define O_TRUNC 01000 /* not fcntl */
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 010000
+#define FASYNC 020000 /* fcntl, for BSD compatibility */
+#define O_DIRECTORY 040000 /* must be a directory */
+#define O_NOFOLLOW 0100000 /* don't follow links */
+#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
+#define O_LARGEFILE 0400000
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get close_on_exec */
+#define F_SETFD 2 /* set/clear close_on_exec */
+#define F_GETFL 3 /* get file->f_flags */
+#define F_SETFL 4 /* set file->f_flags */
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN 8 /* for sockets. */
+#define F_GETOWN 9 /* for sockets. */
+#define F_SETSIG 10 /* for sockets. */
+#define F_GETSIG 11 /* for sockets. */
+
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+/* for leases */
+#define F_INPROGRESS 16
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+#define LOCK_MAND 32 /* This is a mandatory flock */
+#define LOCK_READ 64 /* ... Which allows concurrent read operations */
+#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
+#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+struct flock64 {
+ short l_type;
+ short l_whence;
+ loff_t l_start;
+ loff_t l_len;
+ pid_t l_pid;
+};
+
+#elif defined(__hppa__)
+
+/* Copied from bits/fcntl.h */
+
+#define O_RDONLY 00000000
+#define O_WRONLY 00000001
+#define O_RDWR 00000002
+#define O_ACCMODE 00000003
+#define O_APPEND 00000010
+#define O_BLKSEEK 00000100 /* HPUX only */
+#define O_CREAT 00000400 /* not fcntl */
+#define O_TRUNC 00001000 /* not fcntl */
+#define O_EXCL 00002000 /* not fcntl */
+#define O_ASYNC 00020000
+#define O_SYNC 00100000
+#define O_NONBLOCK 00200004 /* HPUX has separate NDELAY & NONBLOCK */
+#define O_NDELAY O_NONBLOCK
+#define O_NOCTTY 00400000 /* not fcntl */
+#define O_DIRECTORY 00010000
+
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#define F_GETLK 5 /* Get record locking info. */
+#define F_SETLK 6 /* Set record locking info (non-blocking). */
+#define F_SETLKW 7 /* Set record locking info (blocking). */
+
+#define F_GETLK64 8 /* Get record locking info. */
+#define F_SETLK64 9 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 10 /* Set record locking info (blocking). */
+
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+#define F_RDLCK 1 /* Read lock. */
+#define F_WRLCK 2 /* Write lock. */
+#define F_UNLCK 3 /* Remove lock. */
+
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+struct flock
+{
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ off_t l_start; /* Offset where the lock begins. */
+ off_t l_len; /* Size of the locked area; zero means until EOF. */
+ pid_t l_pid; /* Process holding the lock. */
+};
+
+struct flock64
+{
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ off64_t l_start; /* Offset where the lock begins. */
+ off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ pid_t l_pid; /* Process holding the lock. */
+};
+
+#endif
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;
@@ -21,4 +557,8 @@ extern int lockf64 (int __fd, int __cmd, off64_t __len) __THROW;
#define F_TLOCK 2 /* Test and lock a region for exclusive use. */
#define F_TEST 3 /* Test a region for other processes locks. */
+#if !defined(O_ASYNC) && defined(FASYNC)
+#define O_ASYNC FASYNC
+#endif
+
#endif
diff --git a/mdk-stage1/dietlibc/include/features.h b/mdk-stage1/dietlibc/include/features.h
index 5b0283f20..d2b92d15c 100644
--- a/mdk-stage1/dietlibc/include/features.h
+++ b/mdk-stage1/dietlibc/include/features.h
@@ -1,3 +1,8 @@
-#warning "someone included features.h, apparently someone is including glibc headers!"
+#ifndef _FEATURES_H
+#define _FEATURES_H
-#define __dietlibc__
+#ifndef __dietlibc__
+#error "not using the diet wrapper?!"
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/float.h b/mdk-stage1/dietlibc/include/float.h
new file mode 100644
index 000000000..9c9c85a3a
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/float.h
@@ -0,0 +1,96 @@
+#ifndef _FLOAT_H
+#define _FLOAT_H
+
+/* blatantly copied from gcc headers for sparc */
+
+ /* Radix of exponent representation */
+#undef FLT_RADIX
+#define FLT_RADIX 2
+ /* Number of base-FLT_RADIX digits in the significand of a float */
+#undef FLT_MANT_DIG
+#define FLT_MANT_DIG 24
+ /* Number of decimal digits of precision in a float */
+#undef FLT_DIG
+#define FLT_DIG 6
+ /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
+#undef FLT_ROUNDS
+#define FLT_ROUNDS 1
+ /* Difference between 1.0 and the minimum float greater than 1.0 */
+#undef FLT_EPSILON
+#define FLT_EPSILON 1.19209290e-07F
+ /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
+#undef FLT_MIN_EXP
+#define FLT_MIN_EXP (-125)
+ /* Minimum normalised float */
+#undef FLT_MIN
+#define FLT_MIN 1.17549435e-38F
+ /* Minimum int x such that 10**x is a normalised float */
+#undef FLT_MIN_10_EXP
+#define FLT_MIN_10_EXP (-37)
+ /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
+#undef FLT_MAX_EXP
+#define FLT_MAX_EXP 128
+ /* Maximum float */
+#undef FLT_MAX
+#define FLT_MAX 3.40282347e+38F
+ /* Maximum int x such that 10**x is a representable float */
+#undef FLT_MAX_10_EXP
+#define FLT_MAX_10_EXP 38
+
+ /* Number of base-FLT_RADIX digits in the significand of a double */
+#undef DBL_MANT_DIG
+#define DBL_MANT_DIG 53
+ /* Number of decimal digits of precision in a double */
+#undef DBL_DIG
+#define DBL_DIG 15
+ /* Difference between 1.0 and the minimum double greater than 1.0 */
+#undef DBL_EPSILON
+#define DBL_EPSILON 2.2204460492503131e-16
+ /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
+#undef DBL_MIN_EXP
+#define DBL_MIN_EXP (-1021)
+ /* Minimum normalised double */
+#undef DBL_MIN
+#define DBL_MIN 2.2250738585072014e-308
+ /* Minimum int x such that 10**x is a normalised double */
+#undef DBL_MIN_10_EXP
+#define DBL_MIN_10_EXP (-307)
+ /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
+#undef DBL_MAX_EXP
+#define DBL_MAX_EXP 1024
+ /* Maximum double */
+#undef DBL_MAX
+#define DBL_MAX 1.7976931348623157e+308
+ /* Maximum int x such that 10**x is a representable double */
+#undef DBL_MAX_10_EXP
+#define DBL_MAX_10_EXP 308
+
+ /* Number of base-FLT_RADIX digits in the significand of a long double */
+#undef LDBL_MANT_DIG
+#define LDBL_MANT_DIG 53
+ /* Number of decimal digits of precision in a long double */
+#undef LDBL_DIG
+#define LDBL_DIG 15
+ /* Difference between 1.0 and the minimum long double greater than 1.0 */
+#undef LDBL_EPSILON
+#define LDBL_EPSILON 2.2204460492503131e-16L
+ /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
+#undef LDBL_MIN_EXP
+#define LDBL_MIN_EXP (-1021)
+ /* Minimum normalised long double */
+#undef LDBL_MIN
+#define LDBL_MIN 2.2250738585072014e-308L
+ /* Minimum int x such that 10**x is a normalised long double */
+#undef LDBL_MIN_10_EXP
+#define LDBL_MIN_10_EXP (-307)
+ /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
+#undef LDBL_MAX_EXP
+#define LDBL_MAX_EXP 1024
+ /* Maximum long double */
+#undef LDBL_MAX
+#define LDBL_MAX 1.7976931348623157e+308L
+ /* Maximum int x such that 10**x is a representable long double */
+#undef LDBL_MAX_10_EXP
+#define LDBL_MAX_10_EXP 308
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/fnmatch.h b/mdk-stage1/dietlibc/include/fnmatch.h
index 762b43ff7..146e700bd 100644
--- a/mdk-stage1/dietlibc/include/fnmatch.h
+++ b/mdk-stage1/dietlibc/include/fnmatch.h
@@ -12,4 +12,6 @@ int fnmatch(const char *pattern, const char *string, int flags) __THROW;
#define FNM_LEADING_DIR 8
#define FNM_CASEFOLD 16
+#define FNM_NOMATCH 1
+
#endif
diff --git a/mdk-stage1/dietlibc/include/ftw.h b/mdk-stage1/dietlibc/include/ftw.h
index c888f0021..e0450518e 100644
--- a/mdk-stage1/dietlibc/include/ftw.h
+++ b/mdk-stage1/dietlibc/include/ftw.h
@@ -32,19 +32,19 @@ enum
# define FTW_SLN FTW_SLN
};
-typedef int (*__ftw_func_t) (__const char *__filename,
- __const struct stat *__status, int __flag) __THROW;
+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,
+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 (*__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,
+typedef int (*__nftw64_func_t) (const char *__filename,
+ const struct stat64 *__status,
int __flag, struct FTW *__info) __THROW;
#endif
diff --git a/mdk-stage1/dietlibc/include/getopt.h b/mdk-stage1/dietlibc/include/getopt.h
index ebfc5522d..db1592c52 100644
--- a/mdk-stage1/dietlibc/include/getopt.h
+++ b/mdk-stage1/dietlibc/include/getopt.h
@@ -1,12 +1,8 @@
#ifndef __GETOPT_H__
#define __GETOPT_H__
-extern int optind,opterr;
-extern char *optarg;
-int getopt(int argc, char *argv[], char *options);
+#include <unistd.h>
-/* the following was taken from GNU getopt, it's not actually supported
- * by the diet libc! */
extern int optopt;
struct option {
diff --git a/mdk-stage1/dietlibc/include/glob.h b/mdk-stage1/dietlibc/include/glob.h
index 80febbccf..bc8f779c9 100644
--- a/mdk-stage1/dietlibc/include/glob.h
+++ b/mdk-stage1/dietlibc/include/glob.h
@@ -1,6 +1,8 @@
#ifndef _GLOB_H
#define _GLOB_H
+#include <sys/cdefs.h>
+#include <sys/types.h>
typedef struct {
size_t gl_pathc; /* Count of paths matched so far */
diff --git a/mdk-stage1/dietlibc/include/grp.h b/mdk-stage1/dietlibc/include/grp.h
index 32bf49afc..08b153137 100644
--- a/mdk-stage1/dietlibc/include/grp.h
+++ b/mdk-stage1/dietlibc/include/grp.h
@@ -19,7 +19,17 @@ extern struct group *getgrent(void) __THROW;
extern void setgrent(void) __THROW;
extern void endgrent(void) __THROW;
+int getgrent_r(struct group *res, char *buf, size_t buflen,
+ struct group **res_sig) __THROW;
+int getgrnam_r(const char* name,
+ struct group *res, char *buf, size_t buflen,
+ struct group **res_sig) __THROW;
+int getgrgid_r(uid_t uid,
+ struct group *res, char *buf, size_t buflen,
+ struct group **res_sig) __THROW;
+
extern int setgroups(size_t n, const gid_t *groups) __THROW;
+extern int setgroups32(size_t n, const gid32_t *groups) __THROW;
extern int initgroups(const char *user, gid_t group) __THROW;
#endif
diff --git a/mdk-stage1/dietlibc/include/iconv.h b/mdk-stage1/dietlibc/include/iconv.h
new file mode 100644
index 000000000..1205994ca
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/iconv.h
@@ -0,0 +1,25 @@
+#ifndef _ICONV_H
+#define _ICONV_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+/* Identifier for conversion method from one codeset to another. */
+typedef unsigned int iconv_t;
+
+/* Allocate descriptor for code conversion from codeset FROMCODE to
+ codeset TOCODE. */
+extern iconv_t iconv_open (const char *tocode, const char *fromcode) __THROW;
+
+/* Convert at most *INBYTESLEFT bytes from *INBUF according to the
+ code conversion algorithm specified by CD and place up to
+ *OUTBYTESLEFT bytes in buffer at *OUTBUF. */
+extern size_t iconv (iconv_t cd, const char** inbuf,
+ size_t* inbytesleft,
+ char** outbuf,
+ size_t* outbytesleft) __THROW;
+
+/* Free resources allocated for descriptor CD for code conversion. */
+extern int iconv_close (iconv_t cd) __THROW;
+
+#endif /* iconv.h */
diff --git a/mdk-stage1/dietlibc/include/inttypes.h b/mdk-stage1/dietlibc/include/inttypes.h
index e69de29bb..32637f5f7 100644
--- a/mdk-stage1/dietlibc/include/inttypes.h
+++ b/mdk-stage1/dietlibc/include/inttypes.h
@@ -0,0 +1,247 @@
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#include <sys/cdefs.h>
+#include <endian.h>
+
+# if __WORDSIZE == 64
+# define __PRI64_PREFIX "l"
+# define __PRIPTR_PREFIX "l"
+# else
+# define __PRI64_PREFIX "ll"
+# define __PRIPTR_PREFIX
+# endif
+
+/* Macros for printing format specifiers. */
+
+/* Decimal notation. */
+# define PRId8 "d"
+# define PRId16 "d"
+# define PRId32 "d"
+# define PRId64 __PRI64_PREFIX "d"
+
+# define PRIdLEAST8 "d"
+# define PRIdLEAST16 "d"
+# define PRIdLEAST32 "d"
+# define PRIdLEAST64 __PRI64_PREFIX "d"
+
+# define PRIdFAST8 "d"
+# define PRIdFAST16 "d"
+# define PRIdFAST32 "d"
+# define PRIdFAST64 __PRI64_PREFIX "d"
+
+
+# define PRIi8 "i"
+# define PRIi16 "i"
+# define PRIi32 "i"
+# define PRIi64 __PRI64_PREFIX "i"
+
+# define PRIiLEAST8 "i"
+# define PRIiLEAST16 "i"
+# define PRIiLEAST32 "i"
+# define PRIiLEAST64 __PRI64_PREFIX "i"
+
+# define PRIiFAST8 "i"
+# define PRIiFAST16 "i"
+# define PRIiFAST32 "i"
+# define PRIiFAST64 __PRI64_PREFIX "i"
+
+/* Octal notation. */
+# define PRIo8 "o"
+# define PRIo16 "o"
+# define PRIo32 "o"
+# define PRIo64 __PRI64_PREFIX "o"
+
+# define PRIoLEAST8 "o"
+# define PRIoLEAST16 "o"
+# define PRIoLEAST32 "o"
+# define PRIoLEAST64 __PRI64_PREFIX "o"
+
+# define PRIoFAST8 "o"
+# define PRIoFAST16 "o"
+# define PRIoFAST32 "o"
+# define PRIoFAST64 __PRI64_PREFIX "o"
+
+/* Unsigned integers. */
+# define PRIu8 "u"
+# define PRIu16 "u"
+# define PRIu32 "u"
+# define PRIu64 __PRI64_PREFIX "u"
+
+# define PRIuLEAST8 "u"
+# define PRIuLEAST16 "u"
+# define PRIuLEAST32 "u"
+# define PRIuLEAST64 __PRI64_PREFIX "u"
+
+# define PRIuFAST8 "u"
+# define PRIuFAST16 "u"
+# define PRIuFAST32 "u"
+# define PRIuFAST64 __PRI64_PREFIX "u"
+
+/* lowercase hexadecimal notation. */
+# define PRIx8 "x"
+# define PRIx16 "x"
+# define PRIx32 "x"
+# define PRIx64 __PRI64_PREFIX "x"
+
+# define PRIxLEAST8 "x"
+# define PRIxLEAST16 "x"
+# define PRIxLEAST32 "x"
+# define PRIxLEAST64 __PRI64_PREFIX "x"
+
+# define PRIxFAST8 "x"
+# define PRIxFAST16 "x"
+# define PRIxFAST32 "x"
+# define PRIxFAST64 __PRI64_PREFIX "x"
+
+/* UPPERCASE hexadecimal notation. */
+# define PRIX8 "X"
+# define PRIX16 "X"
+# define PRIX32 "X"
+# define PRIX64 __PRI64_PREFIX "X"
+
+# define PRIXLEAST8 "X"
+# define PRIXLEAST16 "X"
+# define PRIXLEAST32 "X"
+# define PRIXLEAST64 __PRI64_PREFIX "X"
+
+# define PRIXFAST8 "X"
+# define PRIXFAST16 "X"
+# define PRIXFAST32 "X"
+# define PRIXFAST64 __PRI64_PREFIX "X"
+
+
+/* Macros for printing `intmax_t' and `uintmax_t'. */
+# define PRIdMAX __PRI64_PREFIX "d"
+# define PRIiMAX __PRI64_PREFIX "i"
+# define PRIoMAX __PRI64_PREFIX "o"
+# define PRIuMAX __PRI64_PREFIX "u"
+# define PRIxMAX __PRI64_PREFIX "x"
+# define PRIXMAX __PRI64_PREFIX "X"
+
+
+/* Macros for printing `intptr_t' and `uintptr_t'. */
+# define PRIdPTR __PRIPTR_PREFIX "d"
+# define PRIiPTR __PRIPTR_PREFIX "i"
+# define PRIoPTR __PRIPTR_PREFIX "o"
+# define PRIuPTR __PRIPTR_PREFIX "u"
+# define PRIxPTR __PRIPTR_PREFIX "x"
+# define PRIXPTR __PRIPTR_PREFIX "X"
+
+
+/* Macros for scanning format specifiers. */
+
+/* Signed decimal notation. */
+# define SCNd8 "hhd"
+# define SCNd16 "hd"
+# define SCNd32 "d"
+# define SCNd64 __PRI64_PREFIX "d"
+
+# define SCNdLEAST8 "hhd"
+# define SCNdLEAST16 "hd"
+# define SCNdLEAST32 "d"
+# define SCNdLEAST64 __PRI64_PREFIX "d"
+
+# define SCNdFAST8 "hhd"
+# define SCNdFAST16 __PRIPTR_PREFIX "d"
+# define SCNdFAST32 __PRIPTR_PREFIX "d"
+# define SCNdFAST64 __PRI64_PREFIX "d"
+
+/* Signed decimal notation. */
+# define SCNi8 "hhi"
+# define SCNi16 "hi"
+# define SCNi32 "i"
+# define SCNi64 __PRI64_PREFIX "i"
+
+# define SCNiLEAST8 "hhi"
+# define SCNiLEAST16 "hi"
+# define SCNiLEAST32 "i"
+# define SCNiLEAST64 __PRI64_PREFIX "i"
+
+# define SCNiFAST8 "hhi"
+# define SCNiFAST16 __PRIPTR_PREFIX "i"
+# define SCNiFAST32 __PRIPTR_PREFIX "i"
+# define SCNiFAST64 __PRI64_PREFIX "i"
+
+/* Unsigned decimal notation. */
+# define SCNu8 "hhu"
+# define SCNu16 "hu"
+# define SCNu32 "u"
+# define SCNu64 __PRI64_PREFIX "u"
+
+# define SCNuLEAST8 "hhu"
+# define SCNuLEAST16 "hu"
+# define SCNuLEAST32 "u"
+# define SCNuLEAST64 __PRI64_PREFIX "u"
+
+# define SCNuFAST8 "hhu"
+# define SCNuFAST16 __PRIPTR_PREFIX "u"
+# define SCNuFAST32 __PRIPTR_PREFIX "u"
+# define SCNuFAST64 __PRI64_PREFIX "u"
+
+/* Octal notation. */
+# define SCNo8 "hho"
+# define SCNo16 "ho"
+# define SCNo32 "o"
+# define SCNo64 __PRI64_PREFIX "o"
+
+# define SCNoLEAST8 "hho"
+# define SCNoLEAST16 "ho"
+# define SCNoLEAST32 "o"
+# define SCNoLEAST64 __PRI64_PREFIX "o"
+
+# define SCNoFAST8 "hho"
+# define SCNoFAST16 __PRIPTR_PREFIX "o"
+# define SCNoFAST32 __PRIPTR_PREFIX "o"
+# define SCNoFAST64 __PRI64_PREFIX "o"
+
+/* Hexadecimal notation. */
+# define SCNx8 "hhx"
+# define SCNx16 "hx"
+# define SCNx32 "x"
+# define SCNx64 __PRI64_PREFIX "x"
+
+# define SCNxLEAST8 "hhx"
+# define SCNxLEAST16 "hx"
+# define SCNxLEAST32 "x"
+# define SCNxLEAST64 __PRI64_PREFIX "x"
+
+# define SCNxFAST8 "hhx"
+# define SCNxFAST16 __PRIPTR_PREFIX "x"
+# define SCNxFAST32 __PRIPTR_PREFIX "x"
+# define SCNxFAST64 __PRI64_PREFIX "x"
+
+
+/* Macros for scanning `intmax_t' and `uintmax_t'. */
+# define SCNdMAX __PRI64_PREFIX "d"
+# define SCNiMAX __PRI64_PREFIX "i"
+# define SCNoMAX __PRI64_PREFIX "o"
+# define SCNuMAX __PRI64_PREFIX "u"
+# define SCNxMAX __PRI64_PREFIX "x"
+
+/* Macros for scanning `intptr_t' and `uintptr_t'. */
+# define SCNdPTR __PRIPTR_PREFIX "d"
+# define SCNiPTR __PRIPTR_PREFIX "i"
+# define SCNoPTR __PRIPTR_PREFIX "o"
+# define SCNuPTR __PRIPTR_PREFIX "u"
+# define SCNxPTR __PRIPTR_PREFIX "x"
+
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+
+typedef signed long int intptr_t;
+typedef unsigned long int uintptr_t;
+
+#ifndef __STRICT_ANSI__
+__extension__ typedef signed long long int64_t;
+__extension__ typedef unsigned long long uint64_t;
+__extension__ typedef signed long long int intmax_t;
+__extension__ typedef unsigned long long int uintmax_t;
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/libgen.h b/mdk-stage1/dietlibc/include/libgen.h
new file mode 100644
index 000000000..ab13b0a30
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/libgen.h
@@ -0,0 +1,9 @@
+#ifndef _LIBGEN_H
+#define _LIBGEN_H
+
+#include <sys/cdefs.h>
+
+char *dirname(char *path) __THROW;
+char *basename(char *path) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/libintl.h b/mdk-stage1/dietlibc/include/libintl.h
new file mode 100644
index 000000000..20873f55f
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/libintl.h
@@ -0,0 +1,23 @@
+#ifndef _LIBINTL_H
+#define _LIBINTL_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <locale.h>
+
+#define gettext(msgid) dgettext(0,msgid)
+#define dgettext(domainname,msgid) dcgettext(domainname,msgid,LC_MESSAGES)
+
+#define ngettext(msgid1,msgid2,n) dngettext(0,msgid1,msgid2,n)
+#define dngettext(dn,msgid1,msgid2,n) dngettext(dn,msgid1,msgid2,n,LC_MESSAGES)
+
+char* dcgettext(const char *domainname, const char *msgid, int category) __THROW;
+char* dcngettext(const char *domainname,
+ const char *msgid1, const char *msgid2,
+ unsigned long int n, int __category) __THROW;
+
+char* textdomain(const char *domainname) __THROW;
+char* bindtextdomain(const char *domainname, const char *dirname) __THROW;
+char* bind_textdomain_codeset(const char *domainname, const char *codeset) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/limits.h b/mdk-stage1/dietlibc/include/limits.h
index a333debfd..b5577a0bf 100644
--- a/mdk-stage1/dietlibc/include/limits.h
+++ b/mdk-stage1/dietlibc/include/limits.h
@@ -1,18 +1,7 @@
#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
+#include <endian.h>
#define CHAR_BIT 8
@@ -20,6 +9,18 @@
#define SCHAR_MAX 0x7f
#define UCHAR_MAX 0xff
+#ifdef __CHAR_UNSIGNED__
+#undef CHAR_MIN
+#define CHAR_MIN 0
+#undef CHAR_MAX
+#define CHAR_MAX UCHAR_MAX
+#else
+#undef CHAR_MIN
+#define CHAR_MIN SCHAR_MIN
+#undef CHAR_MAX
+#define CHAR_MAX SCHAR_MAX
+#endif
+
#define SHRT_MIN (-SHRT_MAX-1)
#define SHRT_MAX 0x7fff
#define USHRT_MAX 0xffff
@@ -43,6 +44,30 @@
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */
#define ULLONG_MAX 18446744073709551615ULL
-#define PASS_MAX 256
+#define SSIZE_MIN LONG_MIN
+#define SSIZE_MAX LONG_MAX
+
+#define PASS_MAX 256
+
+#define NR_OPEN 1024
+
+#define NGROUPS_MAX 32 /* supplemental group IDs are available */
+#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
+#define CHILD_MAX 999 /* no limit :-) */
+#define OPEN_MAX 256 /* # open files a process may have */
+#define LINK_MAX 127 /* # links a file may have */
+#define MAX_CANON 255 /* size of the canonical input queue */
+#define MAX_INPUT 255 /* size of the type-ahead buffer */
+#define NAME_MAX 255 /* # chars in a file name */
+#define PATH_MAX 4095 /* # chars in a path name */
+#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */
+
+#define RTSIG_MAX 32
+
+#define LINE_MAX 2048
+
+/* mutt demanded these */
+#define _POSIX_PATH_MAX PATH_MAX
+#define MB_LEN_MAX 16
#endif
diff --git a/mdk-stage1/dietlibc/include/linux/eventpoll.h b/mdk-stage1/dietlibc/include/linux/eventpoll.h
new file mode 100644
index 000000000..19990ac2a
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/linux/eventpoll.h
@@ -0,0 +1,17 @@
+#ifndef _LINUX_EVENTPOLL_H
+#define _LINUX_EVENTPOLL_H
+
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/shm.h>
+
+#define POLLFD_X_PAGE (PAGE_SIZE / sizeof(struct pollfd))
+#define EP_FDS_PAGES(n) (((n) + POLLFD_X_PAGE - 1) / POLLFD_X_PAGE)
+#define EP_MAP_SIZE(n) (EP_FDS_PAGES(n) * PAGE_SIZE * 2)
+
+struct evpoll {
+ int ep_timeout;
+ unsigned long ep_resoff;
+};
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/linux/if_ether.h b/mdk-stage1/dietlibc/include/linux/if_ether.h
new file mode 100644
index 000000000..dbeb3728e
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/linux/if_ether.h
@@ -0,0 +1,101 @@
+/*
+ * INET An implementation of the TCP/IP protocol suite for the LINUX
+ * operating system. INET is implemented using the BSD Socket
+ * interface as the means of communication with the user level.
+ *
+ * Global definitions for the Ethernet IEEE 802.3 interface.
+ *
+ * Version: @(#)if_ether.h 1.0.1a 02/08/94
+ *
+ * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
+ * Donald Becker, <becker@super.org>
+ * Alan Cox, <alan@redhat.com>
+ * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
+ *
+ * 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.
+ */
+
+#ifndef _LINUX_IF_ETHER_H
+#define _LINUX_IF_ETHER_H
+
+/*
+ * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
+ * and FCS/CRC (frame check sequence).
+ */
+
+#define ETH_ALEN 6 /* Octets in one ethernet addr */
+#define ETH_HLEN 14 /* Total octets in header. */
+#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
+#define ETH_DATA_LEN 1500 /* Max. octets in payload */
+#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
+
+/*
+ * These are the defined Ethernet Protocol ID's.
+ */
+
+#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */
+#define ETH_P_PUP 0x0200 /* Xerox PUP packet */
+#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
+#define ETH_P_IP 0x0800 /* Internet Protocol packet */
+#define ETH_P_X25 0x0805 /* CCITT X.25 */
+#define ETH_P_ARP 0x0806 /* Address Resolution packet */
+#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */
+#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
+#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */
+#define ETH_P_DEC 0x6000 /* DEC Assigned proto */
+#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */
+#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */
+#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */
+#define ETH_P_LAT 0x6004 /* DEC LAT */
+#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
+#define ETH_P_CUST 0x6006 /* DEC Customer use */
+#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
+#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
+#define ETH_P_ATALK 0x809B /* Appletalk DDP */
+#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
+#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
+#define ETH_P_IPX 0x8137 /* IPX over DIX */
+#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
+#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
+#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
+#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
+#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
+ * over Ethernet
+ */
+
+/*
+ * Non DIX types. Won't clash for 1500 types.
+ */
+
+#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
+#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
+#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
+#define ETH_P_802_2 0x0004 /* 802.2 frames */
+#define ETH_P_SNAP 0x0005 /* Internal only */
+#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */
+#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
+#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
+#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
+#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
+#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
+#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
+#define ETH_P_CONTROL 0x0016 /* Card specific control frames */
+#define ETH_P_IRDA 0x0017 /* Linux-IrDA */
+#define ETH_P_ECONET 0x0018 /* Acorn Econet */
+#define ETH_P_HDLC 0x0019 /* HDLC frames */
+
+/*
+ * This is an Ethernet frame header.
+ */
+
+struct ethhdr
+{
+ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
+ unsigned char h_source[ETH_ALEN]; /* source ether addr */
+ unsigned short h_proto; /* packet type ID field */
+};
+
+#endif /* _LINUX_IF_ETHER_H */
diff --git a/mdk-stage1/dietlibc/include/linux/loop.h b/mdk-stage1/dietlibc/include/linux/loop.h
new file mode 100644
index 000000000..1366f1877
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/linux/loop.h
@@ -0,0 +1,47 @@
+#ifndef _LINUX_LOOP_H
+#define _LINUX_LOOP_H
+
+/* stolen form kernel */
+
+#define LO_NAME_SIZE 64
+#define LO_KEY_SIZE 32
+
+/* Loop flags */
+#define LO_FLAGS_DO_BMAP 1
+#define LO_FLAGS_READ_ONLY 2
+#define LO_FLAGS_BH_REMAP 4
+
+struct loop_info {
+ int lo_number; /* ioctl r/o */
+ dev_t lo_device; /* ioctl r/o */
+ unsigned long lo_inode; /* ioctl r/o */
+ dev_t lo_rdevice; /* ioctl r/o */
+ int lo_offset;
+ int lo_encrypt_type;
+ int lo_encrypt_key_size; /* ioctl w/o */
+ int lo_flags; /* ioctl r/o */
+ char lo_name[LO_NAME_SIZE];
+ unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
+ unsigned long lo_init[2];
+ char reserved[4];
+};
+
+/* Loop filter types */
+#define LO_CRYPT_NONE 0
+#define LO_CRYPT_XOR 1
+#define LO_CRYPT_DES 2
+#define LO_CRYPT_FISH2 3 /* Brand new Twofish encryption */
+#define LO_CRYPT_BLOW 4
+#define LO_CRYPT_CAST128 5
+#define LO_CRYPT_IDEA 6
+#define LO_CRYPT_DUMMY 9
+#define LO_CRYPT_SKIPJACK 10
+#define MAX_LO_CRYPT 20
+
+/* IOCTL commands --- we will commandeer 0x4C ('L') */
+#define LOOP_SET_FD 0x4C00
+#define LOOP_CLR_FD 0x4C01
+#define LOOP_SET_STATUS 0x4C02
+#define LOOP_GET_STATUS 0x4C03
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/linux/nfs.h b/mdk-stage1/dietlibc/include/linux/nfs.h
new file mode 100644
index 000000000..9be6db37e
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/linux/nfs.h
@@ -0,0 +1,88 @@
+/*
+ * NFS protocol definitions
+ *
+ * This file contains constants mostly for Version 2 of the protocol,
+ * but also has a couple of NFSv3 bits in (notably the error codes).
+ */
+#ifndef _LINUX_NFS_H
+#define _LINUX_NFS_H
+
+#define NFS_PROGRAM 100003
+#define NFS_PORT 2049
+#define NFS_MAXDATA 8192
+#define NFS_MAXPATHLEN 1024
+#define NFS_MAXNAMLEN 255
+#define NFS_MAXGROUPS 16
+#define NFS_FHSIZE 32
+#define NFS_COOKIESIZE 4
+#define NFS_FIFO_DEV (-1)
+#define NFSMODE_FMT 0170000
+#define NFSMODE_DIR 0040000
+#define NFSMODE_CHR 0020000
+#define NFSMODE_BLK 0060000
+#define NFSMODE_REG 0100000
+#define NFSMODE_LNK 0120000
+#define NFSMODE_SOCK 0140000
+#define NFSMODE_FIFO 0010000
+
+#define NFS_MNT_PROGRAM 100005
+#define NFS_MNT_PORT 627
+
+/*
+ * NFS stats. The good thing with these values is that NFSv3 errors are
+ * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
+ * no-one uses anyway), so we can happily mix code as long as we make sure
+ * no NFSv3 errors are returned to NFSv2 clients.
+ * Error codes that have a `--' in the v2 column are not part of the
+ * standard, but seem to be widely used nevertheless.
+ */
+ enum nfs_stat {
+ NFS_OK = 0, /* v2 v3 */
+ NFSERR_PERM = 1, /* v2 v3 */
+ NFSERR_NOENT = 2, /* v2 v3 */
+ NFSERR_IO = 5, /* v2 v3 */
+ NFSERR_NXIO = 6, /* v2 v3 */
+ NFSERR_EAGAIN = 11, /* v2 v3 */
+ NFSERR_ACCES = 13, /* v2 v3 */
+ NFSERR_EXIST = 17, /* v2 v3 */
+ NFSERR_XDEV = 18, /* v3 */
+ NFSERR_NODEV = 19, /* v2 v3 */
+ NFSERR_NOTDIR = 20, /* v2 v3 */
+ NFSERR_ISDIR = 21, /* v2 v3 */
+ NFSERR_INVAL = 22, /* v2 v3 that Sun forgot */
+ NFSERR_FBIG = 27, /* v2 v3 */
+ NFSERR_NOSPC = 28, /* v2 v3 */
+ NFSERR_ROFS = 30, /* v2 v3 */
+ NFSERR_MLINK = 31, /* v3 */
+ NFSERR_OPNOTSUPP = 45, /* v2 v3 */
+ NFSERR_NAMETOOLONG = 63, /* v2 v3 */
+ NFSERR_NOTEMPTY = 66, /* v2 v3 */
+ NFSERR_DQUOT = 69, /* v2 v3 */
+ NFSERR_STALE = 70, /* v2 v3 */
+ NFSERR_REMOTE = 71, /* v2 v3 */
+ NFSERR_WFLUSH = 99, /* v2 */
+ NFSERR_BADHANDLE = 10001, /* v3 */
+ NFSERR_NOT_SYNC = 10002, /* v3 */
+ NFSERR_BAD_COOKIE = 10003, /* v3 */
+ NFSERR_NOTSUPP = 10004, /* v3 */
+ NFSERR_TOOSMALL = 10005, /* v3 */
+ NFSERR_SERVERFAULT = 10006, /* v3 */
+ NFSERR_BADTYPE = 10007, /* v3 */
+ NFSERR_JUKEBOX = 10008 /* v3 */
+ };
+
+/* NFSv2 file types - beware, these are not the same in NFSv3 */
+
+enum nfs_ftype {
+ NFNON = 0,
+ NFREG = 1,
+ NFDIR = 2,
+ NFBLK = 3,
+ NFCHR = 4,
+ NFLNK = 5,
+ NFSOCK = 6,
+ NFBAD = 7,
+ NFFIFO = 8
+};
+
+#endif /* _LINUX_NFS_H */
diff --git a/mdk-stage1/dietlibc/include/linux/types.h b/mdk-stage1/dietlibc/include/linux/types.h
new file mode 100644
index 000000000..1cd33bd41
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/linux/types.h
@@ -0,0 +1,6 @@
+#ifndef _LINUX_TYPES_H
+#define _LINUX_TYPES_H
+
+#include <asm/types.h>
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/locale.h b/mdk-stage1/dietlibc/include/locale.h
index acbeec8c1..5cd002019 100644
--- a/mdk-stage1/dietlibc/include/locale.h
+++ b/mdk-stage1/dietlibc/include/locale.h
@@ -1,6 +1,84 @@
-#warning "there is no locale support for diet libc yet"
+#ifndef _LOCALE_H
+#define _LOCALE_H
-#define setlocale(a,b) 0
-#define bindtextdomain
-#define textdomain
+#include <sys/cdefs.h>
+enum {
+ LC_CTYPE = 0,
+ LC_NUMERIC = 1,
+ LC_TIME = 2,
+ LC_COLLATE = 3,
+ LC_MONETARY = 4,
+ LC_MESSAGES = 5,
+ LC_ALL = 6,
+ LC_PAPER = 7,
+ LC_NAME = 8,
+ LC_ADDRESS = 9,
+ LC_TELEPHONE = 10,
+ LC_MEASUREMENT = 11,
+ LC_IDENTIFICATION = 12
+};
+
+/* Structure giving information about numeric and monetary notation. */
+struct lconv {
+ /* Numeric (non-monetary) information. */
+ char *decimal_point;
+ char *thousands_sep;
+ /* Each element is the number of digits in each group;
+ elements with higher indices are farther left.
+ An element with value CHAR_MAX means that no further grouping is done.
+ An element with value 0 means that the previous element is used
+ for all groups farther left. */
+ char *grouping;
+
+ /* Monetary information. */
+
+ /* First three chars are a currency symbol from ISO 4217.
+ Fourth char is the separator. Fifth char is '\0'. */
+ char *int_curr_symbol;
+ char *currency_symbol; /* Local currency symbol. */
+ char *mon_decimal_point; /* Decimal point character. */
+ char *mon_thousands_sep; /* Thousands separator. */
+ char *mon_grouping; /* Like `grouping' element (above). */
+ char *positive_sign; /* Sign for positive values. */
+ char *negative_sign; /* Sign for negative values. */
+ char int_frac_digits; /* Int'l fractional digits. */
+ char frac_digits; /* Local fractional digits. */
+ /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */
+ char p_cs_precedes;
+ /* 1 iff a space separates currency_symbol from a positive value. */
+ char p_sep_by_space;
+ /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */
+ char n_cs_precedes;
+ /* 1 iff a space separates currency_symbol from a negative value. */
+ char n_sep_by_space;
+ /* Positive and negative sign positions:
+ 0 Parentheses surround the quantity and currency_symbol.
+ 1 The sign string precedes the quantity and currency_symbol.
+ 2 The sign string follows the quantity and currency_symbol.
+ 3 The sign string immediately precedes the currency_symbol.
+ 4 The sign string immediately follows the currency_symbol. */
+ char p_sign_posn;
+ char n_sign_posn;
+ /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */
+ char int_p_cs_precedes;
+ /* 1 iff a space separates int_curr_symbol from a positive value. */
+ char int_p_sep_by_space;
+ /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */
+ char int_n_cs_precedes;
+ /* 1 iff a space separates int_curr_symbol from a negative value. */
+ char int_n_sep_by_space;
+ /* Positive and negative sign positions:
+ 0 Parentheses surround the quantity and int_curr_symbol.
+ 1 The sign string precedes the quantity and int_curr_symbol.
+ 2 The sign string follows the quantity and int_curr_symbol.
+ 3 The sign string immediately precedes the int_curr_symbol.
+ 4 The sign string immediately follows the int_curr_symbol. */
+ char int_p_sign_posn;
+ char int_n_sign_posn;
+};
+
+char *setlocale (int category, const char *locale) __THROW;
+struct lconv *localeconv (void) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/math.h b/mdk-stage1/dietlibc/include/math.h
index 2f4f2e33f..2cb545237 100644
--- a/mdk-stage1/dietlibc/include/math.h
+++ b/mdk-stage1/dietlibc/include/math.h
@@ -48,6 +48,7 @@ double acosh(double d) __THROW __attribute__((__const__));
double atanh(double d) __THROW __attribute__((__const__));
double exp(double d) __THROW __attribute__((__const__));
+double exp10(double d) __THROW __attribute__((__const__));
double log(double d) __THROW __attribute__((__const__));
double log10(double d) __THROW __attribute__((__const__));
@@ -57,5 +58,39 @@ double sqrt(double x) __THROW __attribute__((__const__));
double fabs(double x) __THROW __attribute__((__const__));
double fmod(double x, double y) __THROW __attribute__((__const__));
+double floor(double x) __attribute__((__const__));
+double ceil(double x) __attribute__((__const__));
+
+double expm1(double x) __THROW __attribute__((__const__));
+double hypot(double x, double y) __THROW __attribute__((__const__));
+double atan2(double x, double y) __THROW __attribute__((__const__));
+
+double copysign(double value, double sign) __attribute__((__const__));
+
+# define HUGE_VAL \
+ (__extension__ \
+ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
+ { __l: 0x000000007ff00000ULL }).__d)
+
+#ifdef _GNU_SOURCE
+void sincos(double x, double* sinx, double* cosx);
+double ipow (double mant, int expo);
+#endif
+
+int isnan(double d) __attribute__((__const__));
+int isinf(double d) __attribute__((__const__));
+int finite(double d) __attribute__((__const__));
+
+double j0(double x);
+double j1(double x);
+double jn(int n, double x);
+double y0(double x);
+double y1(double x);
+double yn(int n, double x);
+double erf(double x);
+double erfc(double x);
+double lgamma(double x);
+
+double rint(double x);
#endif
diff --git a/mdk-stage1/dietlibc/include/md5.h b/mdk-stage1/dietlibc/include/md5.h
new file mode 100644
index 000000000..7cbc0e8f3
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/md5.h
@@ -0,0 +1,48 @@
+/*
+ Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+ rights reserved.
+
+ License to copy and use this software is granted provided that it
+ is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+ Algorithm" in all material mentioning or referencing this software
+ or this function.
+
+ License is also granted to make and use derivative works provided
+ that such works are identified as "derived from the RSA Data
+ Security, Inc. MD5 Message-Digest Algorithm" in all material
+ mentioning or referencing the derived work.
+
+ RSA Data Security, Inc. makes no representations concerning either
+ the merchantability of this software or the suitability of this
+ software for any particular purpose. It is provided "as is"
+ without express or implied warranty of any kind.
+ These notices must be retained in any copies of any part of this
+ documentation and/or software.
+*/
+
+#ifndef _MD5_H
+#define _MD5_H
+
+#include <sys/types.h>
+
+/*
+ Define the MD5 context structure.
+ Please DO NOT change the order or contents of the structure as
+ various assembler files depend on it !!
+*/
+typedef struct
+{
+ uint32_t state[4]; /* state (ABCD) */
+ uint32_t count[2]; /* number of bits, modulo 2^64 (least sig word first) */
+ uint8_t buffer[64]; /* input buffer for incomplete buffer data */
+}
+MD5_CTX;
+
+void MD5Init (MD5_CTX* ctx);
+void MD5Update (MD5_CTX* ctx, const uint8_t* buf, size_t len);
+void MD5Final (uint8_t digest[16], MD5_CTX* ctx);
+
+char* md5crypt (const char* pw, const char* salt);
+
+#endif
+
diff --git a/mdk-stage1/dietlibc/include/net/ethernet.h b/mdk-stage1/dietlibc/include/net/ethernet.h
new file mode 100644
index 000000000..900ffd536
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/net/ethernet.h
@@ -0,0 +1,76 @@
+/* Copyright (C) 1997, 1999, 2001 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Based on the FreeBSD version of this file. Curiously, that file
+ lacks a copyright in the header. */
+
+#ifndef __NET_ETHERNET_H
+#define __NET_ETHERNET_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <linux/if_ether.h> /* IEEE 802.3 Ethernet constants */
+
+__BEGIN_DECLS
+
+/* This is a name for the 48 bit ethernet address available on many
+ systems. */
+struct ether_addr
+{
+ uint8_t ether_addr_octet[ETH_ALEN];
+} __attribute__ ((__packed__));
+
+/* 10Mb/s ethernet header */
+struct ether_header
+{
+ uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
+ uint8_t ether_shost[ETH_ALEN]; /* source ether addr */
+ uint16_t ether_type; /* packet type ID field */
+} __attribute__ ((__packed__));
+
+/* Ethernet protocol ID's */
+#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */
+#define ETHERTYPE_IP 0x0800 /* IP */
+#define ETHERTYPE_ARP 0x0806 /* Address resolution */
+#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */
+
+#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */
+#define ETHER_TYPE_LEN 2 /* bytes in type field */
+#define ETHER_CRC_LEN 4 /* bytes in CRC field */
+#define ETHER_HDR_LEN ETH_HLEN /* total octets in header */
+#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */
+#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */
+
+/* make sure ethenet length is valid */
+#define ETHER_IS_VALID_LEN(foo) \
+ ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
+
+/*
+ * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
+ * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
+ * by an ETHER type (as given above) and then the (variable-length) header.
+ */
+#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
+#define ETHERTYPE_NTRAILER 16
+
+#define ETHERMTU ETH_DATA_LEN
+#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
+__END_DECLS
+
+#endif /* net/ethernet.h */
diff --git a/mdk-stage1/dietlibc/include/net/if.h b/mdk-stage1/dietlibc/include/net/if.h
index 88f386f46..ac4737db3 100644
--- a/mdk-stage1/dietlibc/include/net/if.h
+++ b/mdk-stage1/dietlibc/include/net/if.h
@@ -2,10 +2,101 @@
#define _NET_IF_H
#include <sys/cdefs.h>
+#include <sys/socket.h>
-#include <linux/if.h>
+/* Standard interface flags. */
+#define IFF_UP 0x1 /* interface is up */
+#define IFF_BROADCAST 0x2 /* broadcast address valid */
+#define IFF_DEBUG 0x4 /* turn on debugging */
+#define IFF_LOOPBACK 0x8 /* is a loopback net */
+#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */
+#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
+#define IFF_RUNNING 0x40 /* resources allocated */
+#define IFF_NOARP 0x80 /* no ARP protocol */
+#define IFF_PROMISC 0x100 /* receive all packets */
+#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/
+
+#define IFF_MASTER 0x400 /* master of a load balancer */
+#define IFF_SLAVE 0x800 /* slave of a load balancer */
+
+#define IFF_MULTICAST 0x1000 /* Supports multicast */
+
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_MASTER|IFF_SLAVE|IFF_RUNNING)
+
+#define IFF_PORTSEL 0x2000 /* can set media type */
+#define IFF_AUTOMEDIA 0x4000 /* auto media select active */
+#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/
+
+struct ifmap {
+ unsigned long mem_start;
+ unsigned long mem_end;
+ unsigned short base_addr;
+ unsigned char irq;
+ unsigned char dma;
+ unsigned char port;
+ /* 3 bytes spare */
+};
+
+struct ifreq {
+#define IFHWADDRLEN 6
+#define IFNAMSIZ 16
+ union
+ {
+ char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ } ifr_ifrn;
+ union {
+ struct sockaddr ifru_addr;
+ struct sockaddr ifru_dstaddr;
+ struct sockaddr ifru_broadaddr;
+ struct sockaddr ifru_netmask;
+ struct sockaddr ifru_hwaddr;
+ short ifru_flags;
+ int ifru_ivalue;
+ int ifru_mtu;
+ struct ifmap ifru_map;
+ char ifru_slave[IFNAMSIZ]; /* Just fits the size */
+ char ifru_newname[IFNAMSIZ];
+ char* ifru_data;
+ } ifr_ifru;
+};
+
+#define ifr_name ifr_ifrn.ifrn_name /* interface name */
+#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
+#define ifr_addr ifr_ifru.ifru_addr /* address */
+#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
+#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
+#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
+#define ifr_flags ifr_ifru.ifru_flags /* flags */
+#define ifr_metric ifr_ifru.ifru_ivalue /* metric */
+#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
+#define ifr_map ifr_ifru.ifru_map /* device map */
+#define ifr_slave ifr_ifru.ifru_slave /* slave device */
+#define ifr_data ifr_ifru.ifru_data /* for use by interface */
+#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
+#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
+#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */
+#define ifr_newname ifr_ifru.ifru_newname /* New name */
+
+struct ifconf {
+ int ifc_len; /* size of buffer */
+ union {
+ char * ifcu_buf;
+ struct ifreq *ifcu_req;
+ } ifc_ifcu;
+};
+
+#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
+#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
unsigned int if_nametoindex (const char *ifname) __THROW;
char *if_indextoname (unsigned int ifindex, char *ifname) __THROW;
+struct if_nameindex {
+ unsigned int if_index;
+ char *if_name;
+};
+
+struct if_nameindex* if_nameindex(void) __THROW;
+void if_freenameindex(struct if_nameindex* ptr) __THROW;
+
#endif
diff --git a/mdk-stage1/dietlibc/include/net/if_arp.h b/mdk-stage1/dietlibc/include/net/if_arp.h
index fe37a22dc..b1054066a 100644
--- a/mdk-stage1/dietlibc/include/net/if_arp.h
+++ b/mdk-stage1/dietlibc/include/net/if_arp.h
@@ -1,6 +1,113 @@
#ifndef _NET_IF_ARP_H
#define _NET_IF_ARP_H
-#include <linux/if_arp.h>
+#include <sys/socket.h>
+#define MAX_ADDR_LEN 7
+
+/* ARP protocol HARDWARE identifiers. */
+#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */
+#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */
+#define ARPHRD_EETHER 2 /* Experimental Ethernet */
+#define ARPHRD_AX25 3 /* AX.25 Level 2 */
+#define ARPHRD_PRONET 4 /* PROnet token ring */
+#define ARPHRD_CHAOS 5 /* Chaosnet */
+#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */
+#define ARPHRD_ARCNET 7 /* ARCnet */
+#define ARPHRD_APPLETLK 8 /* APPLEtalk */
+#define ARPHRD_DLCI 15 /* Frame Relay DLCI */
+#define ARPHRD_ATM 19 /* ATM */
+#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */
+
+/* Dummy types for non ARP hardware */
+#define ARPHRD_SLIP 256
+#define ARPHRD_CSLIP 257
+#define ARPHRD_SLIP6 258
+#define ARPHRD_CSLIP6 259
+#define ARPHRD_RSRVD 260 /* Notional KISS type */
+#define ARPHRD_ADAPT 264
+#define ARPHRD_ROSE 270
+#define ARPHRD_X25 271 /* CCITT X.25 */
+#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
+#define ARPHRD_PPP 512
+#define ARPHRD_CISCO 513 /* Cisco HDLC */
+#define ARPHRD_HDLC ARPHRD_CISCO
+#define ARPHRD_LAPB 516 /* LAPB */
+#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */
+#define ARPHRD_RAWHDLC 518 /* Raw HDLC */
+
+#define ARPHRD_TUNNEL 768 /* IPIP tunnel */
+#define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel */
+#define ARPHRD_FRAD 770 /* Frame Relay Access Device */
+#define ARPHRD_SKIP 771 /* SKIP vif */
+#define ARPHRD_LOOPBACK 772 /* Loopback device */
+#define ARPHRD_LOCALTLK 773 /* Localtalk device */
+#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */
+#define ARPHRD_BIF 775 /* AP1000 BIF */
+#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */
+#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */
+#define ARPHRD_IPGRE 778 /* GRE over IP */
+#define ARPHRD_PIMREG 779 /* PIMSM register interface */
+#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */
+#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */
+#define ARPHRD_ECONET 782 /* Acorn Econet */
+#define ARPHRD_IRDA 783 /* Linux-IrDA */
+/* ARP works differently on different FC media .. so */
+#define ARPHRD_FCPP 784 /* Point to point fibrechannel */
+#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */
+#define ARPHRD_FCPL 786 /* Fibrechannel public loop */
+#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */
+ /* 787->799 reserved for fibrechannel media types */
+#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */
+#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
+
+#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
+
+/* ARP protocol opcodes. */
+#define ARPOP_REQUEST 1 /* ARP request */
+#define ARPOP_REPLY 2 /* ARP reply */
+#define ARPOP_RREQUEST 3 /* RARP request */
+#define ARPOP_RREPLY 4 /* RARP reply */
+#define ARPOP_InREQUEST 8 /* InARP request */
+#define ARPOP_InREPLY 9 /* InARP reply */
+#define ARPOP_NAK 10 /* (ATM)ARP NAK */
+
+
+/* ARP ioctl request. */
+struct arpreq {
+ struct sockaddr arp_pa; /* protocol address */
+ struct sockaddr arp_ha; /* hardware address */
+ int arp_flags; /* flags */
+ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
+ char arp_dev[16];
+};
+
+struct arpreq_old {
+ struct sockaddr arp_pa; /* protocol address */
+ struct sockaddr arp_ha; /* hardware address */
+ int arp_flags; /* flags */
+ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
+};
+
+/* ARP Flag values. */
+#define ATF_COM 0x02 /* completed entry (ha valid) */
+#define ATF_PERM 0x04 /* permanent entry */
+#define ATF_PUBL 0x08 /* publish entry */
+#define ATF_USETRAILERS 0x10 /* has requested trailers */
+#define ATF_NETMASK 0x20 /* want to use a netmask (only
+ for proxy entries) */
+#define ATF_DONTPUB 0x40 /* don't answer this addresses */
+
+/*
+ * This structure defines an ethernet arp header.
+ */
+
+struct arphdr
+{
+ unsigned short ar_hrd; /* format of hardware address */
+ unsigned short ar_pro; /* format of protocol address */
+ unsigned char ar_hln; /* length of hardware address */
+ unsigned char ar_pln; /* length of protocol address */
+ unsigned short ar_op; /* ARP opcode (command) */
+};
#endif
diff --git a/mdk-stage1/dietlibc/include/net/if_ether.h b/mdk-stage1/dietlibc/include/net/if_ether.h
new file mode 100644
index 000000000..7451a6dc6
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/net/if_ether.h
@@ -0,0 +1,74 @@
+#ifndef _NET_IF_ETHER_H
+#define _NET_IF_ETHER_H
+
+/* taken from <linux/if_ether.h> */
+
+#define ETH_ALEN 6 /* Octets in one ethernet addr */
+#define ETH_HLEN 14 /* Total octets in header. */
+#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
+#define ETH_DATA_LEN 1500 /* Max. octets in payload */
+#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
+
+/*
+ * These are the defined Ethernet Protocol ID's.
+ */
+
+#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */
+#define ETH_P_PUP 0x0200 /* Xerox PUP packet */
+#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
+#define ETH_P_IP 0x0800 /* Internet Protocol packet */
+#define ETH_P_X25 0x0805 /* CCITT X.25 */
+#define ETH_P_ARP 0x0806 /* Address Resolution packet */
+#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */
+#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
+#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */
+#define ETH_P_DEC 0x6000 /* DEC Assigned proto */
+#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */
+#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */
+#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */
+#define ETH_P_LAT 0x6004 /* DEC LAT */
+#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
+#define ETH_P_CUST 0x6006 /* DEC Customer use */
+#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
+#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
+#define ETH_P_ATALK 0x809B /* Appletalk DDP */
+#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
+#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
+#define ETH_P_IPX 0x8137 /* IPX over DIX */
+#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
+#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
+#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
+#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
+#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport over Ethernet */
+
+/*
+ * Non DIX types. Won't clash for 1500 types.
+ */
+
+#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
+#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
+#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
+#define ETH_P_802_2 0x0004 /* 802.2 frames */
+#define ETH_P_SNAP 0x0005 /* Internal only */
+#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */
+#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
+#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
+#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
+#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
+#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
+#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
+#define ETH_P_CONTROL 0x0016 /* Card specific control frames */
+#define ETH_P_IRDA 0x0017 /* Linux-IrDA */
+#define ETH_P_ECONET 0x0018 /* Acorn Econet */
+
+/*
+ * This is an Ethernet frame header.
+ */
+
+struct ethhdr {
+ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
+ unsigned char h_source[ETH_ALEN]; /* source ether addr */
+ unsigned short h_proto; /* packet type ID field */
+};
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/net/route.h b/mdk-stage1/dietlibc/include/net/route.h
index 5e5db7b1a..383bb8370 100644
--- a/mdk-stage1/dietlibc/include/net/route.h
+++ b/mdk-stage1/dietlibc/include/net/route.h
@@ -1,6 +1,52 @@
-#ifndef _NET_IF_ROUTE_H
-#define _NET_IF_ROUTE_H
+#ifndef _NET_ROUTE_H
+#define _NET_ROUTE_H
-#include <linux/route.h>
+#include <inttypes.h>
+#include <netinet/in.h>
+
+/* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */
+struct rtentry {
+ unsigned long rt_pad1;
+ struct sockaddr rt_dst; /* target address */
+ struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
+ struct sockaddr rt_genmask; /* target network mask (IP) */
+ unsigned short rt_flags;
+ short rt_pad2;
+ unsigned long rt_pad3;
+ void *rt_pad4;
+ short rt_metric; /* +1 for binary compatibility! */
+ char *rt_dev; /* forcing the device at add */
+ unsigned long rt_mtu; /* per route MTU/Window */
+#ifndef __KERNEL__
+#define rt_mss rt_mtu /* Compatibility :-( */
+#endif
+ unsigned long rt_window; /* Window clamping */
+ unsigned short rt_irtt; /* Initial RTT */
+};
+
+#define RTF_UP 0x0001 /* route usable */
+#define RTF_GATEWAY 0x0002 /* destination is a gateway */
+#define RTF_HOST 0x0004 /* host entry (net otherwise) */
+#define RTF_REINSTATE 0x0008 /* reinstate route after tmout */
+#define RTF_DYNAMIC 0x0010 /* created dyn. (by redirect) */
+#define RTF_MODIFIED 0x0020 /* modified dyn. (by redirect) */
+#define RTF_MTU 0x0040 /* specific MTU for this route */
+#define RTF_MSS RTF_MTU /* Compatibility :-( */
+#define RTF_WINDOW 0x0080 /* per route window clamping */
+#define RTF_IRTT 0x0100 /* Initial round trip time */
+#define RTF_REJECT 0x0200 /* Reject route */
+
+struct in6_rtmsg {
+ struct in6_addr rtmsg_dst;
+ struct in6_addr rtmsg_src;
+ struct in6_addr rtmsg_gateway;
+ uint32_t rtmsg_type;
+ uint16_t rtmsg_dst_len;
+ uint16_t rtmsg_src_len;
+ uint32_t rtmsg_metric;
+ unsigned long int rtmsg_info;
+ uint32_t rtmsg_flags;
+ int rtmsg_ifindex;
+};
#endif
diff --git a/mdk-stage1/dietlibc/include/netdb.h b/mdk-stage1/dietlibc/include/netdb.h
index e90ea81ac..be64f659f 100644
--- a/mdk-stage1/dietlibc/include/netdb.h
+++ b/mdk-stage1/dietlibc/include/netdb.h
@@ -13,8 +13,7 @@
#define _PATH_SERVICES "/etc/services"
/* Description of data base entry for a single service. */
-struct servent
-{
+struct servent {
char *s_name; /* Official service name. */
char **s_aliases; /* Alias list. */
int s_port; /* Port number. */
@@ -22,14 +21,24 @@ struct servent
};
extern void endservent (void) __THROW;
-extern struct servent *getservent (void) __THROW;
+extern void setservent(int stayopen) __THROW;
+
+extern int getservent_r(struct servent *res, char *buf, size_t buflen,
+ struct servent **res_sig) __THROW;
+extern int getservbyname_r(const char* name,const char* proto,
+ struct servent *res, char *buf, size_t buflen,
+ struct servent **res_sig) __THROW;
+extern int getservbyport_r(int port,const char* proto,
+ struct servent *res, char *buf, size_t buflen,
+ struct servent **res_sig) __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
-{
+struct hostent {
char *h_name; /* Official name of host. */
char **h_aliases; /* Alias list. */
int h_addrtype; /* Host address type. */
@@ -40,6 +49,7 @@ struct hostent
extern void endhostent (void) __THROW;
extern struct hostent *gethostent (void) __THROW;
+extern struct hostent *gethostent_r (char* buf,int len) __THROW;
extern struct hostent *gethostbyaddr (const void *__addr, socklen_t __len,
int __type) __THROW;
extern struct hostent *gethostbyname (const char *__name) __THROW;
@@ -55,11 +65,16 @@ extern int gethostbyname_r(const char* NAME, struct hostent* RESULT_BUF,char* BU
#define TRY_AGAIN 2
#define NO_RECOVERY 3
#define NO_ADDRESS 4
+#define NO_DATA 5
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;
+int gethostbyname2_r(const char* name, int AF, 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 */
@@ -72,19 +87,38 @@ struct protoent *getprotobynumber(int proto) __THROW;
void setprotoent(int stayopen) __THROW;
void endprotoent(void) __THROW;
+int getprotoent_r(struct protoent *res, char *buf, size_t buflen,
+ struct protoent **res_sig) __THROW;
+int getprotobyname_r(const char* name,
+ struct protoent *res, char *buf, size_t buflen,
+ struct protoent **res_sig) __THROW;
+int getprotobynumber_r(int proto,
+ struct protoent *res, char *buf, size_t buflen,
+ struct protoent **res_sig) __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. */
+void sethostent(int stayopen) __THROW;
+
+/* dummy */
+extern int h_errno;
+
+struct netent {
+ char *n_name; /* official network name */
+ char **n_aliases; /* alias list */
+ int n_addrtype; /* net address type */
+ unsigned long int n_net; /* network number */
};
-extern struct netent *getnetbyname (__const char *__name) __THROW;
+struct netent *getnetbyaddr(unsigned long net, int type) __THROW;
+void endnetent(void) __THROW;
+void setnetent(int stayopen) __THROW;
+struct netent *getnetbyname(const char *name) __THROW;
+struct netent *getnetent(void) __THROW;
+
+extern const char *hstrerror (int err_num) __THROW;
+void herror(const char *s) __THROW;
+#define NI_MAXHOST 1025
+#define NI_MAXSERV 32
#endif
diff --git a/mdk-stage1/dietlibc/include/netinet/in.h b/mdk-stage1/dietlibc/include/netinet/in.h
index 0569c8289..0b5278759 100644
--- a/mdk-stage1/dietlibc/include/netinet/in.h
+++ b/mdk-stage1/dietlibc/include/netinet/in.h
@@ -1,9 +1,404 @@
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
-#include <linux/in.h>
-#include <linux/in6.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <endian.h>
+
+/* Standard well-defined IP protocols. */
+enum {
+ IPPROTO_IP = 0, /* Dummy protocol for TCP */
+#define IPPROTO_IP IPPROTO_IP
+ IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
+#define IPPROTO_ICMP IPPROTO_ICMP
+ IPPROTO_IGMP = 2, /* Internet Group Management Protocol */
+#define IPPROTO_IGMP IPPROTO_IGMP
+ IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
+#define IPPROTO_IPIP IPPROTO_IPIP
+ IPPROTO_TCP = 6, /* Transmission Control Protocol */
+#define IPPROTO_TCP IPPROTO_TCP
+ IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
+#define IPPROTO_EGP IPPROTO_EGP
+ IPPROTO_PUP = 12, /* PUP protocol */
+#define IPPROTO_PUP IPPROTO_PUP
+ IPPROTO_UDP = 17, /* User Datagram Protocol */
+#define IPPROTO_UDP IPPROTO_UDP
+ IPPROTO_IDP = 22, /* XNS IDP protocol */
+#define IPPROTO_IDP IPPROTO_IDP
+ IPPROTO_RSVP = 46, /* RSVP protocol */
+#define IPPROTO_RSVP IPPROTO_RSVP
+ IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
+#define IPPROTO_GRE IPPROTO_GRE
+ IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
+#define IPPROTO_IPV6 IPPROTO_IPV6
+ IPPROTO_PIM = 103, /* Protocol Independent Multicast */
+#define IPPROTO_PIM IPPROTO_PIM
+ IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
+#define IPPROTO_ESP IPPROTO_ESP
+ IPPROTO_AH = 51, /* Authentication Header protocol */
+#define IPPROTO_AH IPPROTO_AH
+ IPPROTO_COMP = 108, /* Compression Header protocol */
+#define IPPROTO_COMP IPPROTO_COMP
+ IPPROTO_RAW = 255, /* Raw IP packets */
+#define IPPROTO_RAW IPPROTO_RAW
+ IPPROTO_MAX
+};
+
+#define IP_TOS 1
+#define IP_TTL 2
+#define IP_HDRINCL 3
+#define IP_OPTIONS 4
+#define IP_ROUTER_ALERT 5
+#define IP_RECVOPTS 6
+#define IP_RETOPTS 7
+#define IP_PKTINFO 8
+#define IP_PKTOPTIONS 9
+#define IP_MTU_DISCOVER 10
+#define IP_RECVERR 11
+#define IP_RECVTTL 12
+#define IP_RECVTOS 13
+#define IP_MTU 14
+#define IP_FREEBIND 15
+
+/* BSD compatibility */
+#define IP_RECVRETOPTS IP_RETOPTS
+
+/* IP_MTU_DISCOVER values */
+#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
+#define IP_PMTUDISC_WANT 1 /* Use per route hints */
+#define IP_PMTUDISC_DO 2 /* Always DF */
+
+#define IP_MULTICAST_IF 32
+#define IP_MULTICAST_TTL 33
+#define IP_MULTICAST_LOOP 34
+#define IP_ADD_MEMBERSHIP 35
+#define IP_DROP_MEMBERSHIP 36
+
+/* These need to appear somewhere around here */
+#define IP_DEFAULT_MULTICAST_TTL 1
+#define IP_DEFAULT_MULTICAST_LOOP 1
+
+#define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
+#define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }}}
+extern const struct in6_addr in6addr_any;
+extern const struct in6_addr in6addr_loopback;
+
+typedef uint16_t in_port_t;
+typedef uint32_t in_addr_t;
+
+struct in_addr {
+ in_addr_t s_addr;
+};
+
+struct ip_mreq {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_interface; /* local IP address of interface */
+};
+
+struct ip_mreqn {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_address; /* local IP address of interface */
+ int imr_ifindex; /* Interface index */
+};
+
+struct in_pktinfo {
+ int ipi_ifindex;
+ struct in_addr ipi_spec_dst;
+ struct in_addr ipi_addr;
+};
+
+/* Structure describing an Internet (IP) socket address. */
+#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
+struct sockaddr_in {
+ sa_family_t sin_family; /* Address family */
+ in_port_t sin_port; /* Port number */
+ struct in_addr sin_addr; /* Internet address */
+ /* Pad to size of `struct sockaddr'. */
+ unsigned char sin_zero[__SOCK_SIZE__ - sizeof(short int) -
+ sizeof(unsigned short int) - sizeof(struct in_addr)];
+};
+
+
+/*
+ * Definitions of the bits in an Internet address integer.
+ * On subnets, host and network parts are found according
+ * to the subnet mask, not these masks.
+ */
+#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
+#define IN_CLASSA_NET 0xff000000
+#define IN_CLASSA_NSHIFT 24
+#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
+#define IN_CLASSA_MAX 128
+
+#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
+#define IN_CLASSB_NET 0xffff0000
+#define IN_CLASSB_NSHIFT 16
+#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
+#define IN_CLASSB_MAX 65536
+
+#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
+#define IN_CLASSC_NET 0xffffff00
+#define IN_CLASSC_NSHIFT 8
+#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
+
+#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
+#define IN_MULTICAST(a) IN_CLASSD(a)
+#define IN_MULTICAST_NET 0xF0000000
+
+#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
+#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
+
+/* Address to accept any incoming messages. */
+#define INADDR_ANY ((unsigned long int) 0x00000000)
+
+/* Address to send to all hosts. */
+#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
+
+/* Address indicating an error return. */
+#define INADDR_NONE ((unsigned long int) 0xffffffff)
+
+/* Network number for local host loopback. */
+#define IN_LOOPBACKNET 127
+
+/* Address to loopback in software to local host. */
+#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */
+#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
+
+/* Defines for Multicast INADDR */
+#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */
+#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */
+#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */
+#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */
+
+struct in6_addr {
+ union {
+ uint8_t u6_addr8[16];
+ uint16_t u6_addr16[8];
+ uint32_t u6_addr32[4];
+ } in6_u;
+#define s6_addr in6_u.u6_addr8
+#define s6_addr16 in6_u.u6_addr16
+#define s6_addr32 in6_u.u6_addr32
+};
+
+struct sockaddr_in6 {
+ unsigned short int sin6_family; /* AF_INET6 */
+ uint16_t sin6_port; /* Transport layer port # */
+ uint32_t sin6_flowinfo; /* IPv6 flow information */
+ struct in6_addr sin6_addr; /* IPv6 address */
+ uint32_t sin6_scope_id; /* scope id (new in RFC2553) */
+};
+
+struct sockaddr_in_pad {
+ sa_family_t sin_family; /* Address family */
+ in_port_t sin_port; /* Port number */
+ struct in_addr sin_addr; /* Internet address */
+ /* Pad to size of `struct sockaddr_in6'. */
+ unsigned char sin_zero[sizeof(struct sockaddr_in6) - sizeof(short int) -
+ sizeof(unsigned short int) - sizeof(struct in_addr)];
+};
+
+struct ipv6_mreq {
+ /* IPv6 multicast address of group */
+ struct in6_addr ipv6mr_multiaddr;
+ /* local IPv6 address of interface */
+ int ipv6mr_interface;
+};
+
+struct in6_flowlabel_req {
+ struct in6_addr flr_dst;
+ uint32_t flr_label;
+ uint8_t flr_action;
+ uint8_t flr_share;
+ uint16_t flr_flags;
+ uint16_t flr_expires;
+ uint16_t flr_linger;
+ uint32_t __flr_pad;
+ /* Options in format of IPV6_PKTOPTIONS */
+};
+
+#define IPV6_FL_A_GET 0
+#define IPV6_FL_A_PUT 1
+#define IPV6_FL_A_RENEW 2
+
+#define IPV6_FL_F_CREATE 1
+#define IPV6_FL_F_EXCL 2
+
+#define IPV6_FL_S_NONE 0
+#define IPV6_FL_S_EXCL 1
+#define IPV6_FL_S_PROCESS 2
+#define IPV6_FL_S_USER 3
+#define IPV6_FL_S_ANY 255
+
+#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff
+#define IPV6_FLOWINFO_PRIORITY 0x0ff00000
+
+/*
+ * IPV6 extension headers
+ */
+#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
+#define IPPROTO_ROUTING 43 /* IPv6 routing header */
+#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
+#define IPPROTO_ICMPV6 58 /* ICMPv6 */
+#define IPPROTO_NONE 59 /* IPv6 no next header */
+#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
+
+/* IPv6 TLV options. */
+#define IPV6_TLV_PAD0 0
+#define IPV6_TLV_PADN 1
+#define IPV6_TLV_ROUTERALERT 5
+#define IPV6_TLV_JUMBO 194
+
+/* IPV6 socket options. */
+#define IPV6_ADDRFORM 1
+#define IPV6_PKTINFO 2
+#define IPV6_HOPOPTS 3
+#define IPV6_DSTOPTS 4
+#define IPV6_RTHDR 5
+#define IPV6_PKTOPTIONS 6
+#define IPV6_CHECKSUM 7
+#define IPV6_HOPLIMIT 8
+#define IPV6_NEXTHOP 9
+#define IPV6_AUTHHDR 10
+#define IPV6_FLOWINFO 11
+
+#define IPV6_UNICAST_HOPS 16
+#define IPV6_MULTICAST_IF 17
+#define IPV6_MULTICAST_HOPS 18
+#define IPV6_MULTICAST_LOOP 19
+#define IPV6_ADD_MEMBERSHIP 20
+#define IPV6_DROP_MEMBERSHIP 21
+#define IPV6_ROUTER_ALERT 22
+#define IPV6_MTU_DISCOVER 23
+#define IPV6_MTU 24
+#define IPV6_RECVERR 25
+
+/* IPV6_MTU_DISCOVER values */
+#define IPV6_PMTUDISC_DONT 0
+#define IPV6_PMTUDISC_WANT 1
+#define IPV6_PMTUDISC_DO 2
+
+/* Flowlabel */
+#define IPV6_FLOWLABEL_MGR 32
+#define IPV6_FLOWINFO_SEND 33
+
+#define IPV6_MIN_MTU 1280
+
+struct in6_pktinfo {
+ struct in6_addr ipi6_addr;
+ int ipi6_ifindex;
+};
+
+struct in6_ifreq {
+ struct in6_addr ifr6_addr;
+ uint32_t ifr6_prefixlen;
+ int ifr6_ifindex;
+};
+
+#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */
+#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */
+
+/* routing header */
+struct ipv6_rt_hdr {
+ uint8_t nexthdr;
+ uint8_t hdrlen;
+ uint8_t type;
+ uint8_t segments_left;
+ /* type specific data, variable length field */
+};
+
+struct ipv6_opt_hdr {
+ uint8_t nexthdr;
+ uint8_t hdrlen;
+ /* TLV encoded option data follows. */
+};
+
+#define ipv6_destopt_hdr ipv6_opt_hdr
+#define ipv6_hopopt_hdr ipv6_opt_hdr
+
+/* routing header type 0 (used in cmsghdr struct) */
+
+#ifndef __STRICT_ANSI__
+struct rt0_hdr {
+ struct ipv6_rt_hdr rt_hdr;
+ uint32_t bitmap; /* strict/loose bit map */
+ struct in6_addr addr[0];
+#define rt0_type rt_hdr.type;
+};
+#endif
+
+struct ipv6hdr {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int flow_lbl:20,
+ priority:8,
+ version:4;
+#else
+ unsigned int version:4,
+ priority:8,
+ flow_lbl:20;
+#endif
+
+ uint16_t payload_len;
+ uint8_t nexthdr;
+ uint8_t hop_limit;
+
+ struct in6_addr saddr;
+ struct in6_addr daddr;
+};
+/* fnord */
#define IPPORT_RESERVED 1024
+#define INET6_ADDRSTRLEN 46
+
+#undef htonl
+#undef htons
+#undef ntohl
+#undef ntohs
+unsigned long int htonl(unsigned long int hostlong);
+unsigned short int htons(unsigned short int hostshort);
+unsigned long int ntohl(unsigned long int netlong);
+unsigned short int ntohs(unsigned short int netshort);
+
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+ (((__const uint32_t *) (a))[0] == 0 \
+ && ((__const uint32_t *) (a))[1] == 0 \
+ && ((__const uint32_t *) (a))[2] == 0 \
+ && ((__const uint32_t *) (a))[3] == 0)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+ (((__const uint32_t *) (a))[0] == 0 \
+ && ((__const uint32_t *) (a))[1] == 0 \
+ && ((__const uint32_t *) (a))[2] == 0 \
+ && ((__const uint32_t *) (a))[3] == htonl (1))
+
+#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
+ == htonl (0xfe800000))
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+ ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
+ == htonl (0xfec00000))
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+ ((((__const uint32_t *) (a))[0] == 0) \
+ && (((__const uint32_t *) (a))[1] == 0) \
+ && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+ ((((__const uint32_t *) (a))[0] == 0) \
+ && (((__const uint32_t *) (a))[1] == 0) \
+ && (((__const uint32_t *) (a))[2] == 0) \
+ && (ntohl (((__const uint32_t *) (a))[3]) > 1))
+
+#define IN6_ARE_ADDR_EQUAL(a,b) \
+ ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
+ && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
+ && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
+ && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
+
+/* old legacy bullshit */
+int bindresvport(int sd, struct sockaddr_in* sin);
#endif
diff --git a/mdk-stage1/dietlibc/include/netinet/ip.h b/mdk-stage1/dietlibc/include/netinet/ip.h
index 35bf9cc42..4ebf21706 100644
--- a/mdk-stage1/dietlibc/include/netinet/ip.h
+++ b/mdk-stage1/dietlibc/include/netinet/ip.h
@@ -1,6 +1,121 @@
#ifndef _NETINET_IP_H
#define _NETINET_IP_H
-#include <linux/ip.h>
+#include <inttypes.h>
+#include <endian.h>
+#include <netinet/in.h>
+
+#define IPVERSION 4 /* IP version number */
+#define IP_MAXPACKET 65535 /* maximum packet size */
+
+#define IPTOS_TOS_MASK 0x1E
+#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
+#define IPTOS_LOWDELAY 0x10
+#define IPTOS_THROUGHPUT 0x08
+#define IPTOS_RELIABILITY 0x04
+#define IPTOS_MINCOST 0x02
+#define IPTOS_LOWCOST IPTOS_MINCOST
+
+#define IPTOS_PREC_MASK 0xE0
+#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
+#define IPTOS_PREC_NETCONTROL 0xe0
+#define IPTOS_PREC_INTERNETCONTROL 0xc0
+#define IPTOS_PREC_CRITIC_ECP 0xa0
+#define IPTOS_PREC_FLASHOVERRIDE 0x80
+#define IPTOS_PREC_FLASH 0x60
+#define IPTOS_PREC_IMMEDIATE 0x40
+#define IPTOS_PREC_PRIORITY 0x20
+#define IPTOS_PREC_ROUTINE 0x00
+
+
+/* IP options */
+#define IPOPT_COPY 0x80
+#define IPOPT_CLASS_MASK 0x60
+#define IPOPT_NUMBER_MASK 0x1f
+
+#define IPOPT_COPIED(o) ((o)&IPOPT_COPY)
+#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK)
+#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK)
+
+#define IPOPT_CONTROL 0x00
+#define IPOPT_RESERVED1 0x20
+#define IPOPT_MEASUREMENT 0x40
+#define IPOPT_RESERVED2 0x60
+
+#define IPOPT_END (0 |IPOPT_CONTROL)
+#define IPOPT_NOOP (1 |IPOPT_CONTROL)
+#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
+#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
+#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
+#define IPOPT_RR (7 |IPOPT_CONTROL)
+#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
+#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
+#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY)
+
+#define IPVERSION 4
+#define MAXTTL 255
+#define IPDEFTTL 64
+
+/* struct timestamp, struct route and MAX_ROUTES are removed.
+
+ REASONS: it is clear that nobody used them because:
+ - MAX_ROUTES value was wrong.
+ - "struct route" was wrong.
+ - "struct timestamp" had fatally misaligned bitfields and was completely unusable.
+ */
+
+#define IPOPT_OPTVAL 0
+#define IPOPT_OLEN 1
+#define IPOPT_OFFSET 2
+#define IPOPT_MINOFF 4
+#define MAX_IPOPTLEN 40
+#define IPOPT_NOP IPOPT_NOOP
+#define IPOPT_EOL IPOPT_END
+#define IPOPT_TS IPOPT_TIMESTAMP
+
+#define IPOPT_TS_TSONLY 0 /* timestamps only */
+#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
+#define IPOPT_TS_PRESPEC 3 /* specified modules only */
+
+struct iphdr { /* size 20/0x14 */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int ihl:4, version:4; /* offset 0; version=ip version (4) */
+#else
+ unsigned int version:4, ihl:4; /* offset 0; ihl=ip header length, measured in words (5) */
+#endif
+ unsigned char tos; /* offset 1 */
+ unsigned short tot_len; /* offset 2; total bytes in packet in network byte order */
+ unsigned short id; /* offset 4 */
+ unsigned short frag_off; /* offset 6 */
+ unsigned char ttl; /* offset 8 */
+ unsigned char protocol; /* offset 9; 1=ICMP, 6=TCP, 17=UDP (see netinet/in.h) */
+ unsigned short check; /* offset 10/0xa */
+ unsigned int saddr; /* offset 12/0xc */
+ unsigned int daddr; /* offset 16/0x10 */
+ /*The options start here. */
+};
+
+struct ip {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int ip_hl:4; /* header length */
+ unsigned int ip_v:4; /* version */
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int ip_v:4; /* version */
+ unsigned int ip_hl:4; /* header length */
+#endif
+ unsigned char ip_tos; /* type of service */
+ unsigned short ip_len; /* total length */
+ unsigned short ip_id; /* identification */
+ unsigned short ip_off; /* fragment offset field */
+#define IP_RF 0x8000 /* reserved fragment flag */
+#define IP_DF 0x4000 /* dont fragment flag */
+#define IP_MF 0x2000 /* more fragments flag */
+#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
+ unsigned char ip_ttl; /* time to live */
+ unsigned char ip_p; /* protocol */
+ unsigned short ip_sum; /* checksum */
+ struct in_addr ip_src, ip_dst; /* source and dest address */
+};
#endif
diff --git a/mdk-stage1/dietlibc/include/netinet/ip_icmp.h b/mdk-stage1/dietlibc/include/netinet/ip_icmp.h
new file mode 100644
index 000000000..cf8e016f7
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/netinet/ip_icmp.h
@@ -0,0 +1,145 @@
+#ifndef NETINET_IP_ICMP_H
+#define NETINET_IP_ICMP_H
+
+#include <sys/cdefs.h>
+#include <inttypes.h>
+#include <netinet/ip.h>
+
+struct icmphdr {
+ uint8_t type; /* message type */
+ uint8_t code; /* type sub-code */
+ uint16_t checksum;
+ union {
+ struct {
+ uint16_t id;
+ uint16_t sequence;
+ } echo; /* echo datagram */
+ uint32_t gateway; /* gateway address */
+ struct {
+ uint16_t __unused;
+ uint16_t mtu;
+ } frag; /* path mtu discovery */
+ } un;
+};
+
+#define ICMP_ECHOREPLY 0 /* Echo Reply */
+#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
+#define ICMP_SOURCE_QUENCH 4 /* Source Quench */
+#define ICMP_REDIRECT 5 /* Redirect (change route) */
+#define ICMP_ECHO 8 /* Echo Request */
+#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */
+#define ICMP_PARAMETERPROB 12 /* Parameter Problem */
+#define ICMP_TIMESTAMP 13 /* Timestamp Request */
+#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */
+#define ICMP_INFO_REQUEST 15 /* Information Request */
+#define ICMP_INFO_REPLY 16 /* Information Reply */
+#define ICMP_ADDRESS 17 /* Address Mask Request */
+#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */
+#define NR_ICMP_TYPES 18
+
+
+/* Codes for UNREACH. */
+#define ICMP_NET_UNREACH 0 /* Network Unreachable */
+#define ICMP_HOST_UNREACH 1 /* Host Unreachable */
+#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */
+#define ICMP_PORT_UNREACH 3 /* Port Unreachable */
+#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */
+#define ICMP_SR_FAILED 5 /* Source Route failed */
+#define ICMP_NET_UNKNOWN 6
+#define ICMP_HOST_UNKNOWN 7
+#define ICMP_HOST_ISOLATED 8
+#define ICMP_NET_ANO 9
+#define ICMP_HOST_ANO 10
+#define ICMP_NET_UNR_TOS 11
+#define ICMP_HOST_UNR_TOS 12
+#define ICMP_PKT_FILTERED 13 /* Packet filtered */
+#define ICMP_PREC_VIOLATION 14 /* Precedence violation */
+#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */
+#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */
+
+/* Codes for REDIRECT. */
+#define ICMP_REDIR_NET 0 /* Redirect Net */
+#define ICMP_REDIR_HOST 1 /* Redirect Host */
+#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */
+#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */
+
+/* Codes for TIME_EXCEEDED. */
+#define ICMP_EXC_TTL 0 /* TTL count exceeded */
+#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
+
+/*
+ * Lower bounds on packet lengths for various types.
+ * For the error advice packets must first insure that the
+ * packet is large enough to contain the returned ip header.
+ * Only then can we do the check to see if 64 bits of packet
+ * data have been returned, since we need to check the returned
+ * ip header length.
+ */
+#define ICMP_MINLEN 8 /* abs minimum */
+#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
+#define ICMP_MASKLEN 12 /* address mask */
+#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
+#ifndef _IP_VHL
+#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+ /* N.B.: must separately check that ip_hl >= 5 */
+#else
+#define ICMP_ADVLEN(p) (8 + (IP_VHL_HL((p)->icmp_ip.ip_vhl) << 2) + 8)
+ /* N.B.: must separately check that header length >= 5 */
+#endif
+
+/* Definition of type and code fields. */
+/* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */
+#define ICMP_UNREACH 3 /* dest unreachable, codes: */
+#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
+#define ICMP_ROUTERADVERT 9 /* router advertisement */
+#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
+#define ICMP_TIMXCEED 11 /* time exceeded, code: */
+#define ICMP_PARAMPROB 12 /* ip header bad */
+#define ICMP_TSTAMP 13 /* timestamp request */
+#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
+#define ICMP_IREQ 15 /* information request */
+#define ICMP_IREQREPLY 16 /* information reply */
+#define ICMP_MASKREQ 17 /* address mask request */
+#define ICMP_MASKREPLY 18 /* address mask reply */
+
+#define ICMP_MAXTYPE 18
+
+/* UNREACH codes */
+#define ICMP_UNREACH_NET 0 /* bad net */
+#define ICMP_UNREACH_HOST 1 /* bad host */
+#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
+#define ICMP_UNREACH_PORT 3 /* bad port */
+#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
+#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
+#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
+#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
+#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
+#define ICMP_UNREACH_NET_PROHIB 9 /* net denied */
+#define ICMP_UNREACH_HOST_PROHIB 10 /* host denied */
+#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
+#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
+#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohib */
+#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host prec vio. */
+#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* prec cutoff */
+
+/* REDIRECT codes */
+#define ICMP_REDIRECT_NET 0 /* for network */
+#define ICMP_REDIRECT_HOST 1 /* for host */
+#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
+#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
+
+/* TIMEXCEED codes */
+#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
+#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
+
+/* PARAMPROB code */
+#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
+
+#define ICMP_INFOTYPE(type) \
+ ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+ (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+ (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+ (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/netinet/tcp.h b/mdk-stage1/dietlibc/include/netinet/tcp.h
new file mode 100644
index 000000000..e47f24dff
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/netinet/tcp.h
@@ -0,0 +1,164 @@
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H
+
+#include <inttypes.h>
+#include <endian.h>
+
+struct tcphdr { /* size 20/0x14 40/0x28 with IP header */
+ uint16_t source; /* offset 0 20/0x14 */
+ uint16_t dest; /* offset 2 22/0x16 */
+ uint32_t seq; /* offset 4 24/0x18 */
+ uint32_t ack_seq; /* offset 8 28/0x1c */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ uint16_t res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1;
+#else
+ uint16_t doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1;
+#endif
+ /* offset 12/0xc 32/0x20 */
+ uint16_t window; /* offset 14/0xe 34/0x22 */
+ uint16_t check; /* offset 16/0x10 36/0x24 */
+ uint16_t urg_ptr; /* offset 18/0x12 38/0x26 */
+};
+
+
+enum {
+ TCP_ESTABLISHED = 1,
+ TCP_SYN_SENT,
+ TCP_SYN_RECV,
+ TCP_FIN_WAIT1,
+ TCP_FIN_WAIT2,
+ TCP_TIME_WAIT,
+ TCP_CLOSE,
+ TCP_CLOSE_WAIT,
+ TCP_LAST_ACK,
+ TCP_LISTEN,
+ TCP_CLOSING, /* now a valid state */
+
+ TCP_MAX_STATES /* Leave at the end! */
+};
+
+#define TCP_STATE_MASK 0xF
+#define TCP_ACTION_FIN (1 << 7)
+
+enum {
+ TCPF_ESTABLISHED = (1 << 1),
+ TCPF_SYN_SENT = (1 << 2),
+ TCPF_SYN_RECV = (1 << 3),
+ TCPF_FIN_WAIT1 = (1 << 4),
+ TCPF_FIN_WAIT2 = (1 << 5),
+ TCPF_TIME_WAIT = (1 << 6),
+ TCPF_CLOSE = (1 << 7),
+ TCPF_CLOSE_WAIT = (1 << 8),
+ TCPF_LAST_ACK = (1 << 9),
+ TCPF_LISTEN = (1 << 10),
+ TCPF_CLOSING = (1 << 11)
+};
+
+/*
+ * The union cast uses a gcc extension to avoid aliasing problems
+ * (union is compatible to any of its members)
+ * This means this part of the code is -fstrict-aliasing safe now.
+ */
+union tcp_word_hdr {
+ struct tcphdr hdr;
+ uint32_t words[5];
+};
+
+#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
+
+enum {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ TCP_FLAG_CWR = 0x00008000,
+ TCP_FLAG_ECE = 0x00004000,
+ TCP_FLAG_URG = 0x00002000,
+ TCP_FLAG_ACK = 0x00001000,
+ TCP_FLAG_PSH = 0x00000800,
+ TCP_FLAG_RST = 0x00000400,
+ TCP_FLAG_SYN = 0x00000200,
+ TCP_FLAG_FIN = 0x00000100,
+ TCP_RESERVED_BITS = 0x0000C00F,
+ TCP_DATA_OFFSET = 0x000000F0
+#else
+ TCP_FLAG_CWR = 0x00800000,
+ TCP_FLAG_ECE = 0x00400000,
+ TCP_FLAG_URG = 0x00200000,
+ TCP_FLAG_ACK = 0x00100000,
+ TCP_FLAG_PSH = 0x00080000,
+ TCP_FLAG_RST = 0x00040000,
+ TCP_FLAG_SYN = 0x00020000,
+ TCP_FLAG_FIN = 0x00010000,
+ TCP_RESERVED_BITS = 0x0FC00000,
+ TCP_DATA_OFFSET = 0xF0000000
+#endif
+};
+
+/* TCP socket options */
+#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */
+#define TCP_MAXSEG 2 /* Limit MSS */
+#define TCP_CORK 3 /* Never send partially complete segments */
+#define TCP_KEEPIDLE 4 /* Start keeplives after this period */
+#define TCP_KEEPINTVL 5 /* Interval between keepalives */
+#define TCP_KEEPCNT 6 /* Number of keepalives before death */
+#define TCP_SYNCNT 7 /* Number of SYN retransmits */
+#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */
+#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
+#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
+#define TCP_INFO 11 /* Information about this connection. */
+#define TCP_QUICKACK 12 /* Block/reenable quick acks */
+
+#define TCPI_OPT_TIMESTAMPS 1
+#define TCPI_OPT_SACK 2
+#define TCPI_OPT_WSCALE 4
+#define TCPI_OPT_ECN 8
+
+enum tcp_ca_state {
+ TCP_CA_Open = 0,
+#define TCPF_CA_Open (1<<TCP_CA_Open)
+ TCP_CA_Disorder = 1,
+#define TCPF_CA_Disorder (1<<TCP_CA_Disorder)
+ TCP_CA_CWR = 2,
+#define TCPF_CA_CWR (1<<TCP_CA_CWR)
+ TCP_CA_Recovery = 3,
+#define TCPF_CA_Recovery (1<<TCP_CA_Recovery)
+ TCP_CA_Loss = 4
+#define TCPF_CA_Loss (1<<TCP_CA_Loss)
+};
+
+struct tcp_info {
+ uint8_t tcpi_state;
+ uint8_t tcpi_ca_state;
+ uint8_t tcpi_retransmits;
+ uint8_t tcpi_probes;
+ uint8_t tcpi_backoff;
+ uint8_t tcpi_options;
+ uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+
+ uint32_t tcpi_rto;
+ uint32_t tcpi_ato;
+ uint32_t tcpi_snd_mss;
+ uint32_t tcpi_rcv_mss;
+
+ uint32_t tcpi_unacked;
+ uint32_t tcpi_sacked;
+ uint32_t tcpi_lost;
+ uint32_t tcpi_retrans;
+ uint32_t tcpi_fackets;
+
+ /* Times. */
+ uint32_t tcpi_last_data_sent;
+ uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */
+ uint32_t tcpi_last_data_recv;
+ uint32_t tcpi_last_ack_recv;
+
+ /* Metrics. */
+ uint32_t tcpi_pmtu;
+ uint32_t tcpi_rcv_ssthresh;
+ uint32_t tcpi_rtt;
+ uint32_t tcpi_rttvar;
+ uint32_t tcpi_snd_ssthresh;
+ uint32_t tcpi_snd_cwnd;
+ uint32_t tcpi_advmss;
+ uint32_t tcpi_reordering;
+};
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/netinet/udp.h b/mdk-stage1/dietlibc/include/netinet/udp.h
new file mode 100644
index 000000000..3c5e9524e
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/netinet/udp.h
@@ -0,0 +1,16 @@
+#ifndef _NETINET_UDP_H
+#define _NETINET_UDP_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+struct udphdr { /* size 8 28/0x1c with IP header */
+ uint16_t source; /* offset 0 20/0x14 */
+ uint16_t dest; /* offset 2 22/0x16 */
+ uint16_t len; /* offset 4 24/0x18 */
+ uint16_t check; /* offset 6 26/0x1a */
+};
+
+#define SOL_UDP 17 /* sockopt level for UDP */
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/netpacket/packet.h b/mdk-stage1/dietlibc/include/netpacket/packet.h
new file mode 100644
index 000000000..b265094c6
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/netpacket/packet.h
@@ -0,0 +1,41 @@
+#ifndef __NETPACKET_PACKET_H
+#define __NETPACKET_PACKET_H
+
+struct sockaddr_ll {
+ unsigned short int sll_family;
+ unsigned short int sll_protocol;
+ int sll_ifindex;
+ unsigned short int sll_hatype;
+ unsigned char sll_pkttype;
+ unsigned char sll_halen;
+ unsigned char sll_addr[8];
+};
+
+#define PACKET_HOST 0 /* To us. */
+#define PACKET_BROADCAST 1 /* To all. */
+#define PACKET_MULTICAST 2 /* To group. */
+#define PACKET_OTHERHOST 3 /* To someone else. */
+#define PACKET_OUTGOING 4 /* Originated by us. */
+#define PACKET_LOOPBACK 5
+#define PACKET_FASTROUTE 6
+
+/* Packet socket options. */
+
+#define PACKET_ADD_MEMBERSHIP 1
+#define PACKET_DROP_MEMBERSHIP 2
+#define PACKET_RECV_OUTPUT 3
+#define PACKET_RX_RING 5
+#define PACKET_STATISTICS 6
+
+struct packet_mreq {
+ int mr_ifindex;
+ unsigned short int mr_type;
+ unsigned short int mr_alen;
+ unsigned char mr_address[8];
+};
+
+#define PACKET_MR_MULTICAST 0
+#define PACKET_MR_PROMISC 1
+#define PACKET_MR_ALLMULTI 2
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/paths.h b/mdk-stage1/dietlibc/include/paths.h
index 0e36bb10e..9073d267a 100644
--- a/mdk-stage1/dietlibc/include/paths.h
+++ b/mdk-stage1/dietlibc/include/paths.h
@@ -13,4 +13,11 @@
#define _PATH_GROUP "/etc/group"
#define _PATH_SHADOW "/etc/shadow"
+#define _PATH_SHELLS "/etc/shells"
+
+#define _PATH_VARRUN "/var/run/"
+
+/* puke */
+#define _PATH_MAILDIR "/var/mail"
+
#endif
diff --git a/mdk-stage1/dietlibc/include/pthread.h b/mdk-stage1/dietlibc/include/pthread.h
index e922ab28b..e243c0281 100644
--- a/mdk-stage1/dietlibc/include/pthread.h
+++ b/mdk-stage1/dietlibc/include/pthread.h
@@ -5,9 +5,6 @@
#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
@@ -19,9 +16,16 @@
#define PTHREAD_DESTRUCTOR_ITERATIONS 10
typedef struct _pthread_descr_struct *_pthread_descr;
-typedef unsigned long int pthread_t;
+typedef int pthread_t;
/* Fast locks */
+#ifdef __parisc__
+#define PTHREAD_SPIN_LOCKED 0
+#define PTHREAD_SPIN_UNLOCKED 1
+#else
+#define PTHREAD_SPIN_LOCKED 1
+#define PTHREAD_SPIN_UNLOCKED 0
+#endif
struct _pthread_fastlock {
int __spinlock;
};
@@ -49,18 +53,24 @@ enum
};
#define PTHREAD_MUTEX_INITIALIZER \
-{{0}, 0, PTHREAD_MUTEX_FAST_NP, 0}
+{{PTHREAD_SPIN_UNLOCKED}, 0, PTHREAD_MUTEX_FAST_NP, 0}
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
-{{0}, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0}
+{{PTHREAD_SPIN_UNLOCKED}, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0}
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
-{{0}, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0}
+{{PTHREAD_SPIN_UNLOCKED}, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0}
typedef struct {
int __mutexkind;
} pthread_mutexattr_t;
+int pthread_mutexattr_init(pthread_mutexattr_t *attr);
+int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
+
+int pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind);
+int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
+
int pthread_mutex_init(pthread_mutex_t *mutex,
const pthread_mutexattr_t *mutexattr);
int pthread_mutex_lock(pthread_mutex_t *mutex);
@@ -77,7 +87,7 @@ typedef struct {
} pthread_cond_t;
#define PTHREAD_COND_INITIALIZER \
-{{0},0}
+{{PTHREAD_SPIN_UNLOCKED},0}
int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *cond_attr);
int pthread_cond_destroy(pthread_cond_t *cond);
@@ -164,9 +174,14 @@ 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);
+int pthread_setschedparam(pthread_t target_thread, int policy,
+ const struct sched_param *param);
+int pthread_getschedparam(pthread_t target_thread, int *policy,
+ struct sched_param *param);
+
/* ONCE */
typedef int pthread_once_t;
-#define PTHREAD_ONCE_INIT 0
+#define PTHREAD_ONCE_INIT PTHREAD_SPIN_UNLOCKED
int __pthread_once(pthread_once_t* once_control, void (*init_routine)(void));
int pthread_once(pthread_once_t* once_control, void (*init_routine)(void));
@@ -210,7 +225,7 @@ pid_t pthread_atfork(void (*prepare)(void), void (*parent)(void),
void (*child)(void));
/* THREADS */
-int pthread_create (pthread_t *__thread,
+int pthread_create (pthread_t *__threadarg,
const pthread_attr_t *__attr,
void *(*__start_routine) (void *),
void *__arg);
@@ -224,4 +239,6 @@ int pthread_detach (pthread_t __th);
pthread_t pthread_self (void);
int pthread_equal (pthread_t __thread1, pthread_t __thread2);
+int pthread_sigmask(int how, const sigset_t*newset, sigset_t *oldset);
+
#endif
diff --git a/mdk-stage1/dietlibc/include/pty.h b/mdk-stage1/dietlibc/include/pty.h
new file mode 100644
index 000000000..fa53d9934
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/pty.h
@@ -0,0 +1,13 @@
+#ifndef _PTY_H
+#define _PTY_H
+
+#include <sys/cdefs.h>
+#include <termios.h>
+
+/* Create pseudo tty master slave pair with NAME and set terminal
+ * attributes according to TERMP and WINP and return handles for both
+ * ends in AMASTER and ASLAVE. */
+extern int openpty (int *__amaster, int *__aslave, char *__name, struct
+ termios *__termp, struct winsize *__winp) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/pwd.h b/mdk-stage1/dietlibc/include/pwd.h
index e6fb5d0be..8901a2d7f 100644
--- a/mdk-stage1/dietlibc/include/pwd.h
+++ b/mdk-stage1/dietlibc/include/pwd.h
@@ -3,6 +3,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <stdio.h>
struct passwd {
char *pw_name; /* Username. */
@@ -14,11 +15,21 @@ struct passwd {
char *pw_shell; /* Shell program. */
};
-extern struct passwd *getpwuid (uid_t __uid) __THROW;
-extern struct passwd *getpwnam (const char *__name) __THROW;
+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;
+extern int putpwent(const struct passwd *p, FILE *stream) __THROW;
+
+int getpwent_r(struct passwd *res, char *buf, size_t buflen,
+ struct passwd **res_sig) __THROW;
+int getpwnam_r(const char* name,
+ struct passwd *res, char *buf, size_t buflen,
+ struct passwd **res_sig) __THROW;
+int getpwuid_r(uid_t uid,
+ struct passwd *res, char *buf, size_t buflen,
+ struct passwd **res_sig) __THROW;
#endif
diff --git a/mdk-stage1/dietlibc/include/regex.h b/mdk-stage1/dietlibc/include/regex.h
index be609d9db..abc9ab57b 100644
--- a/mdk-stage1/dietlibc/include/regex.h
+++ b/mdk-stage1/dietlibc/include/regex.h
@@ -38,6 +38,7 @@ typedef struct __regex_t {
int brackets,cflags;
regmatch_t *l;
} regex_t;
+#define re_nsub r.pieces
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;
@@ -61,7 +62,10 @@ enum __regex_errors {
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 */
+ REG_ESPACE /* regcomp ran out of space */
};
+char * re_comp(char * regex);
+int re_exec(char * string);
+
#endif
diff --git a/mdk-stage1/dietlibc/include/resolv.h b/mdk-stage1/dietlibc/include/resolv.h
index 4e90799c2..dae226582 100644
--- a/mdk-stage1/dietlibc/include/resolv.h
+++ b/mdk-stage1/dietlibc/include/resolv.h
@@ -1 +1,124 @@
-void res_init(void);
+#ifndef _RESOLV_H
+#define _RESOLV_H
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <netinet/in.h>
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF "/etc/resolv.conf"
+#endif
+
+/*
+ * Global defines and variables for resolver stub.
+ */
+#define MAXNS 8 /* max # name servers we'll track */
+#define MAXDFLSRCH 3 /* # default domain levels to try */
+#define MAXDNSRCH 6 /* max # domains in search path */
+#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
+
+#define RES_TIMEOUT 5 /* min. seconds between retries */
+#define MAXRESOLVSORT 10 /* number of net to sort on */
+#define RES_MAXNDOTS 15 /* should reflect bit field size */
+
+struct res_state {
+ int retrans; /* retransmission time interval */
+ int retry; /* number of times to retransmit */
+ unsigned long options; /* option flags - see below. */
+ int nscount; /* number of name servers */
+ struct sockaddr_in_pad
+ nsaddr_list[MAXNS]; /* address of name server */
+#define nsaddr nsaddr_list[0] /* for backward compatibility */
+ unsigned short id; /* current message id */
+ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
+ char defdname[256]; /* default domain (deprecated) */
+ unsigned long pfcode; /* RES_PRF_ flags - see below. */
+ unsigned ndots:4; /* threshold for initial abs. query */
+ unsigned nsort:4; /* number of elements in sort_list[] */
+ char unused[3];
+ struct {
+ struct in_addr addr;
+ uint32_t mask;
+ } sort_list[MAXRESOLVSORT];
+ char pad[72]; /* on an i386 this means 512b total */
+};
+
+/*
+ * Resolver options (keep these in synch with res_debug.c, please)
+ */
+#define RES_INIT 0x00000001 /* address initialized */
+#define RES_DEBUG 0x00000002 /* print debug messages */
+#define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/
+#define RES_USEVC 0x00000008 /* use virtual circuit */
+#define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */
+#define RES_IGNTC 0x00000020 /* ignore trucation errors */
+#define RES_RECURSE 0x00000040 /* recursion desired */
+#define RES_DEFNAMES 0x00000080 /* use default domain name */
+#define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */
+#define RES_DNSRCH 0x00000200 /* search up local domain tree */
+#define RES_INSECURE1 0x00000400 /* type 1 security disabled */
+#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
+#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
+#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
+
+#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
+
+/*
+ * Resolver "pfcode" values. Used by dig.
+ */
+#define RES_PRF_STATS 0x00000001
+/* 0x00000002 */
+#define RES_PRF_CLASS 0x00000004
+#define RES_PRF_CMD 0x00000008
+#define RES_PRF_QUES 0x00000010
+#define RES_PRF_ANS 0x00000020
+#define RES_PRF_AUTH 0x00000040
+#define RES_PRF_ADD 0x00000080
+#define RES_PRF_HEAD1 0x00000100
+#define RES_PRF_HEAD2 0x00000200
+#define RES_PRF_TTLID 0x00000400
+#define RES_PRF_HEADX 0x00000800
+#define RES_PRF_QUERY 0x00001000
+#define RES_PRF_REPLY 0x00002000
+#define RES_PRF_INIT 0x00004000
+/* 0x00008000 */
+
+struct res_sym {
+ int number; /* Identifying number, like T_MX */
+ char * name; /* Its symbolic name, like "MX" */
+ char * humanname; /* Its fun name, like "mail exchanger" */
+};
+
+extern struct res_state _res;
+extern const struct res_sym __p_class_syms[];
+extern const struct res_sym __p_type_syms[];
+
+int res_init(void) __THROW;
+
+int res_query(const char *dname, int class, int type,
+ unsigned char *answer, int anslen) __THROW;
+
+int res_search(const char *dname, int class, int type,
+ unsigned char *answer, int anslen) __THROW;
+
+int res_querydomain(const char *name, const char *domain,
+ int class, int type, unsigned char *answer,
+ int anslen) __THROW;
+
+int res_mkquery(int op, const char *dname, int class,
+ int type, char *data, int datalen, const unsigned char* newrr,
+ char *buf, int buflen) __THROW;
+
+int res_send(const char *msg, int msglen, char *answer,
+ int anslen) __THROW;
+
+int dn_comp(unsigned char *msg, unsigned char *comp_dn,
+ int length, unsigned char **dnptrs, unsigned char *exp_dn,
+ unsigned char **lastdnptr) __THROW;
+
+int dn_expand(unsigned char *msg, unsigned char *eomorig,
+ unsigned char *comp_dn, unsigned char *exp_dn,
+ int length) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/rpc/auth.h b/mdk-stage1/dietlibc/include/rpc/auth.h
index 4aa7d21ce..6e0ae0675 100644
--- a/mdk-stage1/dietlibc/include/rpc/auth.h
+++ b/mdk-stage1/dietlibc/include/rpc/auth.h
@@ -42,6 +42,7 @@
#define _RPC_AUTH_H 1
#include <sys/cdefs.h>
+#include <sys/socket.h>
#include <rpc/xdr.h>
__BEGIN_DECLS
@@ -71,8 +72,8 @@ enum auth_stat {
union des_block {
struct {
- u_int32_t high;
- u_int32_t low;
+ uint32_t high;
+ uint32_t low;
} key;
char c[8];
};
@@ -84,8 +85,8 @@ extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW;
*/
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 */
+ char* oa_base; /* address of more auth stuff */
+ unsigned int oa_length; /* not to exceed MAX_AUTH_BYTES */
};
/*
@@ -104,7 +105,7 @@ struct AUTH {
int (*ah_refresh) (AUTH *); /* refresh credentials */
void (*ah_destroy) (AUTH *); /* destroy this structure */
} *ah_ops;
- caddr_t ah_private;
+ char* ah_private;
};
@@ -162,10 +163,10 @@ 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,
+extern AUTH *authdes_create (const char *__servername, unsigned int __window,
struct sockaddr *__syncaddr, des_block *__ckey)
__THROW;
-extern AUTH *authdes_pk_create (const char *, netobj *, u_int,
+extern AUTH *authdes_pk_create (const char *, netobj *, unsigned int,
struct sockaddr *, des_block *) __THROW;
@@ -183,11 +184,11 @@ extern AUTH *authdes_pk_create (const char *, netobj *, u_int,
*
*/
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 *)
+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;
+extern int netname2host (const char *, char *, const int) __THROW;
/*
*
diff --git a/mdk-stage1/dietlibc/include/rpc/auth_des.h b/mdk-stage1/dietlibc/include/rpc/auth_des.h
index 198b299e7..8accd3779 100644
--- a/mdk-stage1/dietlibc/include/rpc/auth_des.h
+++ b/mdk-stage1/dietlibc/include/rpc/auth_des.h
@@ -86,22 +86,22 @@ struct authdes_verf
#define adv_nickname adv_int_u
/* Map a des credential into a unix cred. */
-extern int authdes_getucred (__const struct authdes_cred * __adc,
+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;
+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 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;
diff --git a/mdk-stage1/dietlibc/include/rpc/auth_unix.h b/mdk-stage1/dietlibc/include/rpc/auth_unix.h
index 7a1bfa9f0..9dd8142f1 100644
--- a/mdk-stage1/dietlibc/include/rpc/auth_unix.h
+++ b/mdk-stage1/dietlibc/include/rpc/auth_unix.h
@@ -64,11 +64,11 @@ __BEGIN_DECLS
*/
struct authunix_parms
{
- u_long aup_time;
+ unsigned long aup_time;
char *aup_machname;
uid_t aup_uid;
gid_t aup_gid;
- u_int aup_len;
+ unsigned int aup_len;
gid_t *aup_gids;
};
diff --git a/mdk-stage1/dietlibc/include/rpc/clnt.h b/mdk-stage1/dietlibc/include/rpc/clnt.h
index 60b0fafdf..9b100556c 100644
--- a/mdk-stage1/dietlibc/include/rpc/clnt.h
+++ b/mdk-stage1/dietlibc/include/rpc/clnt.h
@@ -109,8 +109,8 @@ struct rpc_err {
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 */
+ unsigned long low; /* lowest verion supported */
+ unsigned long high; /* highest verion supported */
} RE_vers;
struct { /* maybe meaningful if RPC_FAILED */
long s1;
@@ -133,19 +133,19 @@ 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);
+ enum clnt_stat (*cl_call) (CLIENT *, unsigned long, xdrproc_t, char*, xdrproc_t,
+ char*, 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);
+ bool_t (*cl_freeres) (CLIENT *, xdrproc_t, char*);
/* 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 */
+ char* cl_private; /* private stuff */
};
@@ -160,11 +160,11 @@ struct CLIENT {
* enum clnt_stat
* CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
* CLIENT *rh;
- * u_long proc;
+ * unsigned long proc;
* xdrproc_t xargs;
- * caddr_t argsp;
+ * char* argsp;
* xdrproc_t xres;
- * caddr_t resp;
+ * char* resp;
* struct timeval timeout;
*/
#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
@@ -194,7 +194,7 @@ struct CLIENT {
* CLNT_FREERES(rh, xres, resp);
* CLIENT *rh;
* xdrproc_t xres;
- * caddr_t resp;
+ * char* 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))
@@ -203,7 +203,7 @@ struct CLIENT {
* bool_t
* CLNT_CONTROL(cl, request, info)
* CLIENT *cl;
- * u_int request;
+ * unsigned int request;
* char *info;
*/
#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
@@ -253,16 +253,16 @@ struct CLIENT {
* 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)
+#define RPCTEST_PROGRAM ((unsigned long)1)
+#define RPCTEST_VERSION ((unsigned long)1)
+#define RPCTEST_NULL_PROC ((unsigned long)2)
+#define RPCTEST_NULL_BATCH_PROC ((unsigned long)3)
/*
* By convention, procedure 0 takes null arguments and returns them
*/
-#define NULLPROC ((u_long)0)
+#define NULLPROC ((unsigned long)0)
/*
* Below are the client handle creation routines for the various
@@ -274,10 +274,10 @@ struct CLIENT {
* Memory based rpc (for speed check and testing)
* CLIENT *
* clntraw_create(prog, vers)
- * u_long prog;
- * u_long vers;
+ * unsigned long prog;
+ * unsigned long vers;
*/
-extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers)
+extern CLIENT *clntraw_create (const unsigned long __prog, const unsigned long __vers)
__THROW;
@@ -287,12 +287,12 @@ extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers)
* CLIENT *
* clnt_create(host, prog, vers, prot)
* char *host; -- hostname
- * u_long prog; -- program number
+ * unsigned 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)
+extern CLIENT *clnt_create (const char *__host, const unsigned long __prog,
+ const unsigned long __vers, const char *__prot)
__THROW;
@@ -301,23 +301,23 @@ extern CLIENT *clnt_create (__const char *__host, __const u_long __prog,
* CLIENT *
* clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
* struct sockaddr_in *raddr;
- * u_long prog;
- * u_long version;
+ * unsigned long prog;
+ * unsigned long version;
* register int *sockp;
- * u_int sendsz;
- * u_int recvsz;
+ * unsigned int sendsz;
+ * unsigned 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;
+extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, unsigned long __prog,
+ unsigned long __version, int *__sockp, unsigned int __sendsz,
+ unsigned int __recvsz) __THROW;
/*
* UDP based rpc.
* CLIENT *
* clntudp_create(raddr, program, version, wait, sockp)
* struct sockaddr_in *raddr;
- * u_long program;
- * u_long version;
+ * unsigned long program;
+ * unsigned long version;
* struct timeval wait_resend;
* int *sockp;
*
@@ -325,20 +325,20 @@ extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog,
* CLIENT *
* clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)
* struct sockaddr_in *raddr;
- * u_long program;
- * u_long version;
+ * unsigned long program;
+ * unsigned long version;
* struct timeval wait_resend;
* int *sockp;
- * u_int sendsz;
- * u_int recvsz;
+ * unsigned int sendsz;
+ * unsigned int recvsz;
*/
-extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program,
- u_long __version, struct timeval __wait_resend,
+extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, unsigned long __program,
+ unsigned long __version, struct timeval __wait_resend,
int *__sockp) __THROW;
extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr,
- u_long __program, u_long __version,
+ unsigned long __program, unsigned long __version,
struct timeval __wait_resend, int *__sockp,
- u_int __sendsz, u_int __recvsz) __THROW;
+ unsigned int __sendsz, unsigned int __recvsz) __THROW;
@@ -348,28 +348,28 @@ extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr,
* CLIENT *
* clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
* struct sockaddr_un *raddr;
- * u_long prog;
- * u_long version;
+ * unsigned long prog;
+ * unsigned long version;
* register int *sockp;
- * u_int sendsz;
- * u_int recvsz;
+ * unsigned int sendsz;
+ * unsigned 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 CLIENT *clntunix_create (struct sockaddr_un *__raddr, unsigned long __program,
+ unsigned long __version, int *__sockp,
+ unsigned int __sendsz, unsigned 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 callrpc (const char *__host, const unsigned long __prognum,
+ const unsigned long __versnum, const unsigned 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 */
+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
@@ -379,9 +379,9 @@ 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;
+extern void clnt_perror (CLIENT *__clnt, const char *__msg) __THROW;
/* stderr */
-extern char *clnt_sperror (CLIENT *__clnt, __const char *__msg) __THROW;
+extern char *clnt_sperror (CLIENT *__clnt, const char *__msg) __THROW;
/* string */
/*
@@ -404,8 +404,8 @@ 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;
+extern int getrpcport (const char * __host, unsigned long __prognum,
+ unsigned long __versnum, unsigned int proto) __THROW;
/*
* get the local host's IP address without consulting
diff --git a/mdk-stage1/dietlibc/include/rpc/key_prot.h b/mdk-stage1/dietlibc/include/rpc/key_prot.h
index 3e2eb7208..c398b82f8 100644
--- a/mdk-stage1/dietlibc/include/rpc/key_prot.h
+++ b/mdk-stage1/dietlibc/include/rpc/key_prot.h
@@ -136,11 +136,11 @@ bool_t xdr_cryptkeyres();
#define MAXGIDS 16
struct unixcred {
- u_int uid;
- u_int gid;
+ unsigned int uid;
+ unsigned int gid;
struct {
- u_int gids_len;
- u_int *gids_val;
+ unsigned int gids_len;
+ unsigned int *gids_val;
} gids;
};
typedef struct unixcred unixcred;
@@ -205,61 +205,61 @@ bool_t xdr_key_netstres();
#endif
-#define KEY_PROG ((u_long)100029)
-#define KEY_VERS ((u_long)1)
+#define KEY_PROG ((unsigned long)100029)
+#define KEY_VERS ((unsigned long)1)
#ifdef __cplusplus
-#define KEY_SET ((u_long)1)
+#define KEY_SET ((unsigned 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)
+#define KEY_ENCRYPT ((unsigned 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)
+#define KEY_DECRYPT ((unsigned 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)
+#define KEY_GEN ((unsigned 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)
+#define KEY_GETCRED ((unsigned 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)
+#define KEY_SET ((unsigned 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)
+#define KEY_ENCRYPT ((unsigned 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)
+#define KEY_DECRYPT ((unsigned 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)
+#define KEY_GEN ((unsigned 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)
+#define KEY_GETCRED ((unsigned 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)
+#define KEY_SET ((unsigned long)1)
extern keystatus * key_set_1();
extern keystatus * key_set_1_svc();
-#define KEY_ENCRYPT ((u_long)2)
+#define KEY_ENCRYPT ((unsigned long)2)
extern cryptkeyres * key_encrypt_1();
extern cryptkeyres * key_encrypt_1_svc();
-#define KEY_DECRYPT ((u_long)3)
+#define KEY_DECRYPT ((unsigned long)3)
extern cryptkeyres * key_decrypt_1();
extern cryptkeyres * key_decrypt_1_svc();
-#define KEY_GEN ((u_long)4)
+#define KEY_GEN ((unsigned long)4)
extern des_block * key_gen_1();
extern des_block * key_gen_1_svc();
-#define KEY_GETCRED ((u_long)5)
+#define KEY_GETCRED ((unsigned long)5)
extern getcredres * key_getcred_1();
extern getcredres * key_getcred_1_svc();
#endif /* Old Style C */
-#define KEY_VERS2 ((u_long)2)
+#define KEY_VERS2 ((unsigned long)2)
#ifdef __cplusplus
extern "C" keystatus * key_set_2(opaque *, CLIENT *);
@@ -272,19 +272,19 @@ 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)
+#define KEY_ENCRYPT_PK ((unsigned 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)
+#define KEY_DECRYPT_PK ((unsigned 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)
+#define KEY_NET_PUT ((unsigned 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)
+#define KEY_NET_GET ((unsigned 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)
+#define KEY_GET_CONV ((unsigned long)10)
extern "C" cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
extern "C" cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
@@ -299,19 +299,19 @@ 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)
+#define KEY_ENCRYPT_PK ((unsigned 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)
+#define KEY_DECRYPT_PK ((unsigned 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)
+#define KEY_NET_PUT ((unsigned 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)
+#define KEY_NET_GET ((unsigned 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)
+#define KEY_GET_CONV ((unsigned long)10)
extern cryptkeyres * key_get_conv_2(opaque *, CLIENT *);
extern cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *);
@@ -326,19 +326,19 @@ 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)
+#define KEY_ENCRYPT_PK ((unsigned long)6)
extern cryptkeyres * key_encrypt_pk_2();
extern cryptkeyres * key_encrypt_pk_2_svc();
-#define KEY_DECRYPT_PK ((u_long)7)
+#define KEY_DECRYPT_PK ((unsigned long)7)
extern cryptkeyres * key_decrypt_pk_2();
extern cryptkeyres * key_decrypt_pk_2_svc();
-#define KEY_NET_PUT ((u_long)8)
+#define KEY_NET_PUT ((unsigned long)8)
extern keystatus * key_net_put_2();
extern keystatus * key_net_put_2_svc();
-#define KEY_NET_GET ((u_long)9)
+#define KEY_NET_GET ((unsigned long)9)
extern key_netstres * key_net_get_2();
extern key_netstres * key_net_get_2_svc();
-#define KEY_GET_CONV ((u_long)10)
+#define KEY_GET_CONV ((unsigned long)10)
extern cryptkeyres * key_get_conv_2();
extern cryptkeyres * key_get_conv_2_svc();
#endif /* Old Style C */
diff --git a/mdk-stage1/dietlibc/include/rpc/netdb.h b/mdk-stage1/dietlibc/include/rpc/netdb.h
index da4bddfc4..a991d3a95 100644
--- a/mdk-stage1/dietlibc/include/rpc/netdb.h
+++ b/mdk-stage1/dietlibc/include/rpc/netdb.h
@@ -52,12 +52,12 @@ struct rpcent
extern void setrpcent (int __stayopen) __THROW;
extern void endrpcent (void) __THROW;
-extern struct rpcent *getrpcbyname (__const char *__name) __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,
+extern int getrpcbyname_r (const char *__name, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
struct rpcent **__result) __THROW;
diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h b/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h
index 68bc8d8ec..c63922772 100644
--- a/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h
+++ b/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h
@@ -45,7 +45,7 @@
__BEGIN_DECLS
-typedef bool_t (*resultproc_t) (caddr_t resp, struct sockaddr_in *raddr);
+typedef bool_t (*resultproc_t) (char* resp, struct sockaddr_in *raddr);
/*
* Usage:
@@ -63,34 +63,34 @@ typedef bool_t (*resultproc_t) (caddr_t resp, struct sockaddr_in *raddr);
* the procedure eachresult is called. Its form is:
* done = eachresult(resp, raddr)
* bool_t done;
- * caddr_t resp;
+ * char* 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)
+extern bool_t pmap_set (const unsigned long __program, const unsigned long __vers,
+ int __protocol, unsigned short __port) __THROW;
+extern bool_t pmap_unset (const unsigned long __program, const unsigned 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,
+ const unsigned long __prog,
+ const unsigned long __vers,
+ const unsigned 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,
+ char* __argsp, xdrproc_t __xdrres,
+ char* __resp, struct timeval __tout,
+ unsigned long *__port_ptr) __THROW;
+extern enum clnt_stat clnt_broadcast (const unsigned long __prog,
+ const unsigned long __vers,
+ const unsigned long __proc, xdrproc_t __xargs,
+ char* __argsp, xdrproc_t __xresults,
+ char* __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)
+extern unsigned short pmap_getport (struct sockaddr_in *__address,
+ const unsigned long __program,
+ const unsigned long __version, unsigned int __protocol)
__THROW;
__END_DECLS
diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_prot.h b/mdk-stage1/dietlibc/include/rpc/pmap_prot.h
index fd7fb8e7e..da06d34c1 100644
--- a/mdk-stage1/dietlibc/include/rpc/pmap_prot.h
+++ b/mdk-stage1/dietlibc/include/rpc/pmap_prot.h
@@ -75,17 +75,17 @@ __BEGIN_DECLS
* 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)
+#define PMAPPORT ((unsigned short)111)
+#define PMAPPROG ((unsigned long)100000)
+#define PMAPVERS ((unsigned long)2)
+#define PMAPVERS_PROTO ((unsigned long)2)
+#define PMAPVERS_ORIG ((unsigned long)1)
+#define PMAPPROC_NULL ((unsigned long)0)
+#define PMAPPROC_SET ((unsigned long)1)
+#define PMAPPROC_UNSET ((unsigned long)2)
+#define PMAPPROC_GETPORT ((unsigned long)3)
+#define PMAPPROC_DUMP ((unsigned long)4)
+#define PMAPPROC_CALLIT ((unsigned long)5)
struct pmap {
long unsigned pm_prog;
diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h b/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h
index 160f998ca..3b975d0fb 100644
--- a/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h
+++ b/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h
@@ -46,8 +46,8 @@
__BEGIN_DECLS
struct rmtcallargs {
- u_long prog, vers, proc, arglen;
- caddr_t args_ptr;
+ unsigned long prog, vers, proc, arglen;
+ char* args_ptr;
xdrproc_t xdr_args;
};
@@ -55,9 +55,9 @@ 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;
+ unsigned long *port_ptr;
+ unsigned long resultslen;
+ char* results_ptr;
xdrproc_t xdr_results;
};
diff --git a/mdk-stage1/dietlibc/include/rpc/rpc.h b/mdk-stage1/dietlibc/include/rpc/rpc.h
index 20b341d74..a966d2e23 100644
--- a/mdk-stage1/dietlibc/include/rpc/rpc.h
+++ b/mdk-stage1/dietlibc/include/rpc/rpc.h
@@ -67,6 +67,4 @@
/* 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_msg.h b/mdk-stage1/dietlibc/include/rpc/rpc_msg.h
index 636d60ea9..d597608ab 100644
--- a/mdk-stage1/dietlibc/include/rpc/rpc_msg.h
+++ b/mdk-stage1/dietlibc/include/rpc/rpc_msg.h
@@ -44,8 +44,8 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#define RPC_MSG_VERSION ((u_long) 2)
-#define RPC_SERVICE_PORT ((u_short) 2048)
+#define RPC_MSG_VERSION ((unsigned long) 2)
+#define RPC_SERVICE_PORT ((unsigned short) 2048)
__BEGIN_DECLS
@@ -93,11 +93,11 @@ struct accepted_reply {
enum accept_stat ar_stat;
union {
struct {
- u_long low;
- u_long high;
+ unsigned long low;
+ unsigned long high;
} AR_versions;
struct {
- caddr_t where;
+ char* where;
xdrproc_t proc;
} AR_results;
/* and many other null cases */
@@ -113,8 +113,8 @@ struct rejected_reply {
enum reject_stat rj_stat;
union {
struct {
- u_long low;
- u_long high;
+ unsigned long low;
+ unsigned long high;
} RJ_versions;
enum auth_stat RJ_why; /* why authentication did not work */
} ru;
@@ -139,10 +139,10 @@ struct reply_body {
* 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;
+ unsigned long cb_rpcvers; /* must be equal to two */
+ unsigned long cb_prog;
+ unsigned long cb_vers;
+ unsigned long cb_proc;
struct opaque_auth cb_cred;
struct opaque_auth cb_verf; /* protocol specific - provided by client */
};
@@ -151,7 +151,7 @@ struct call_body {
* The rpc message
*/
struct rpc_msg {
- u_long rm_xid;
+ unsigned long rm_xid;
enum msg_type rm_direction;
union {
struct call_body RM_cmb;
diff --git a/mdk-stage1/dietlibc/include/rpc/svc.h b/mdk-stage1/dietlibc/include/rpc/svc.h
index 27c997dde..ec598ba79 100644
--- a/mdk-stage1/dietlibc/include/rpc/svc.h
+++ b/mdk-stage1/dietlibc/include/rpc/svc.h
@@ -75,18 +75,18 @@ enum xprt_stat {
typedef struct SVCXPRT SVCXPRT;
struct SVCXPRT {
int xp_sock;
- u_short xp_port; /* associated port number */
+ unsigned 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 */
+ char* 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);
+ char* args_ptr);
/* free mem allocated for args */
void (*xp_destroy) (SVCXPRT *__xprt);
/* destroy this struct */
@@ -94,8 +94,8 @@ struct SVCXPRT {
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_p1; /* private */
+ char* xp_p2; /* private */
char xp_pad [256]; /* padding, internal use */
};
@@ -110,7 +110,7 @@ struct SVCXPRT {
* SVCXPRT *xprt;
* struct rpc_msg *msg;
* xdrproc_t xargs;
- * caddr_t argsp;
+ * char* argsp;
*/
#define SVC_RECV(xprt, msg) \
(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
@@ -151,7 +151,7 @@ struct svc_req {
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 */
+ char* rq_clntcred; /* read only cooked cred */
SVCXPRT *rq_xprt; /* associated transport */
};
@@ -227,7 +227,7 @@ extern void xprt_unregister (SVCXPRT *__xprt) __THROW;
*/
extern bool_t svc_sendreply (SVCXPRT *xprt, xdrproc_t __xdr_results,
- caddr_t __xdr_location) __THROW;
+ char* __xdr_location) __THROW;
extern void svcerr_decode (SVCXPRT *__xprt) __THROW;
@@ -294,20 +294,20 @@ 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)
+extern SVCXPRT *svcudp_bufcreate (int __sock, unsigned int __sendsz, unsigned int __recvsz)
__THROW;
/*
* Tcp based rpc.
*/
-extern SVCXPRT *svctcp_create (int __sock, u_int __sendsize, u_int __recvsize)
+extern SVCXPRT *svctcp_create (int __sock, unsigned int __sendsize, unsigned int __recvsize)
__THROW;
/*
* Unix based rpc.
*/
-extern SVCXPRT *svcunix_create (int __sock, u_int __sendsize, u_int __recvsize,
+extern SVCXPRT *svcunix_create (int __sock, unsigned int __sendsize, unsigned int __recvsize,
char *__path) __THROW;
diff --git a/mdk-stage1/dietlibc/include/rpc/types.h b/mdk-stage1/dietlibc/include/rpc/types.h
index e2e8402be..d4be65e38 100644
--- a/mdk-stage1/dietlibc/include/rpc/types.h
+++ b/mdk-stage1/dietlibc/include/rpc/types.h
@@ -52,10 +52,6 @@ typedef unsigned long rpcport_t;
# 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)
@@ -63,13 +59,23 @@ typedef unsigned long rpcport_t;
#ifndef makedev /* ie, we haven't already included it */
#include <sys/types.h>
#endif
+
+# ifndef __dietlibc_u_char_defined
+typedef char* caddr_t;
+typedef uint32_t u_long;
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+# define __dietlibc_u_char_defined
+#endif
+
#include <sys/time.h>
#include <sys/param.h>
#include <netinet/in.h>
#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK (u_long)0x7F000001
+#define INADDR_LOOPBACK 0x7F000001UL
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
diff --git a/mdk-stage1/dietlibc/include/rpc/xdr.h b/mdk-stage1/dietlibc/include/rpc/xdr.h
index ce092f085..590392070 100644
--- a/mdk-stage1/dietlibc/include/rpc/xdr.h
+++ b/mdk-stage1/dietlibc/include/rpc/xdr.h
@@ -118,13 +118,13 @@ struct XDR
/* 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);
+ bool_t (*x_getbytes) (XDR *__xdrs, char* __addr, unsigned int __len);
/* get some bytes from " */
- bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, u_int __len);
+ bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, unsigned int __len);
/* put some bytes to " */
- u_int (*x_getpostn) (const XDR *__xdrs);
+ unsigned int (*x_getpostn) (const XDR *__xdrs);
/* returns bytes off from beginning */
- bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos);
+ bool_t (*x_setpostn) (XDR *__xdrs, unsigned int __pos);
/* lets you reposition the stream */
int32_t *(*x_inline) (XDR *__xdrs, int __len);
/* buf quick ptr to buffered data */
@@ -136,9 +136,9 @@ struct XDR
/* 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 */
+ char* x_public; /* users' data */
+ char* x_private; /* pointer to private data */
+ char* x_base; /* private used for position info */
int x_handy; /* extra private word */
};
@@ -149,7 +149,7 @@ struct XDR
* 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 *);
+ * bool_t (*xdrproc_t)(XDR *, char* *);
*/
typedef bool_t (*xdrproc_t) (XDR *, void *,...);
@@ -160,9 +160,9 @@ typedef bool_t (*xdrproc_t) (XDR *, void *,...);
* XDR *xdrs;
* int32_t *int32p;
* long *longp;
- * caddr_t addr;
- * u_int len;
- * u_int pos;
+ * char* addr;
+ * unsigned int len;
+ * unsigned int pos;
*/
#define XDR_GETINT32(xdrs, int32p) \
(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
@@ -263,17 +263,17 @@ struct xdr_discrim
* 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))++))
+ ((long)ntohl((unsigned long)*__extension__((uint32_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))
+ (*__extension__((uint32_t*)(buf))++ = (long)htonl((unsigned long)(v)))
+#define IXDR_GET_U_LONG(buf) ((unsigned 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_GET_U_SHORT(buf) ((unsigned 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))
@@ -288,15 +288,15 @@ struct xdr_discrim
*/
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_u_short (XDR *__xdrs, unsigned 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_u_int (XDR *__xdrs, unsigned 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_u_long (XDR *__xdrs, unsigned long *__ulp) __THROW;
+extern bool_t xdr_hyper (XDR *__xdrs, int64_t *__llp) __THROW;
+extern bool_t xdr_u_hyper (XDR *__xdrs, uint64_t *__ullp) __THROW;
+extern bool_t xdr_longlong_t (XDR *__xdrs, int64_t *__llp) __THROW;
+extern bool_t xdr_u_longlong_t (XDR *__xdrs, uint64_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;
@@ -307,28 +307,28 @@ 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)
+extern bool_t xdr_array (XDR * _xdrs, char* *__addrp, unsigned int *__sizep,
+ unsigned int __maxsize, unsigned 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_bytes (XDR *__xdrs, char **__cpp, unsigned int *__sizep,
+ unsigned int __maxsize) __THROW;
+extern bool_t xdr_opaque (XDR *__xdrs, char* __cp, unsigned int __cnt) __THROW;
+extern bool_t xdr_string (XDR *__xdrs, char **__cpp, unsigned 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_u_char (XDR *__xdrs, unsigned char *__cp) __THROW;
+extern bool_t xdr_vector (XDR *__xdrs, char *__basep, unsigned int __nelem,
+ unsigned 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,
+extern bool_t xdr_reference (XDR *__xdrs, char* *__xpp, unsigned int __size,
xdrproc_t __proc) __THROW;
extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp,
- u_int __obj_size, xdrproc_t __xdr_obj) __THROW;
+ unsigned 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;
+extern unsigned long xdr_sizeof (xdrproc_t, void *) __THROW;
/*
* Common opaque bytes objects used by many rpc protocols;
@@ -337,7 +337,7 @@ extern u_long xdr_sizeof (xdrproc_t, void *) __THROW;
#define MAX_NETOBJ_SZ 1024
struct netobj
{
- u_int n_len;
+ unsigned int n_len;
char *n_bytes;
};
typedef struct netobj netobj;
@@ -349,16 +349,16 @@ extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW;
*/
/* XDR using memory buffers */
-extern void xdrmem_create (XDR *__xdrs, const caddr_t __addr,
- u_int __size, enum xdr_op __xop) __THROW;
+extern void xdrmem_create (XDR *__xdrs, const char* __addr,
+ unsigned 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,
+extern void xdrrec_create (XDR *__xdrs, unsigned int __sendsize,
+ unsigned int __recvsize, char* __tcp_handle,
int (*__readit) (char *, char *, int),
int (*__writeit) (char *, char *, int)) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sched.h b/mdk-stage1/dietlibc/include/sched.h
index 5e4430d29..b6442c73b 100644
--- a/mdk-stage1/dietlibc/include/sched.h
+++ b/mdk-stage1/dietlibc/include/sched.h
@@ -4,13 +4,6 @@
#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:
@@ -26,7 +19,9 @@
#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)
+#define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
+
+int clone(void*(*fn)(void*),void*stack,int flags,void*arg);
/*
* Scheduling policies
@@ -42,7 +37,7 @@
#define SCHED_YIELD 0x10
struct sched_param {
- int sched_priority;
+ int sched_priority;
};
/* END OF COPY form kernel-header */
diff --git a/mdk-stage1/dietlibc/include/setjmp.h b/mdk-stage1/dietlibc/include/setjmp.h
index 66fc288f4..b591936ac 100644
--- a/mdk-stage1/dietlibc/include/setjmp.h
+++ b/mdk-stage1/dietlibc/include/setjmp.h
@@ -16,6 +16,42 @@ typedef int __jmp_buf[6];
# define JB_SIZE 24
#endif
+#ifdef __x86_64__
+#ifndef __ASSEMBLER__
+typedef long __jmp_buf[8];
+#endif
+# define JB_RBX 0
+# define JB_RBP 1
+# define JB_R12 2
+# define JB_R13 3
+# define JB_R14 4
+# define JB_R15 5
+# define JB_RSP 6
+# define JB_PC 7
+# define JB_SIZE 64
+#endif
+
+#ifdef __s390__
+#ifndef __ASSEMBLER__
+typedef struct {
+ long int gregs[10];
+ long fpregs[4];
+} __jmp_buf[1];
+#endif
+#define __JB_GPR6 0
+#define __JB_GPR7 1
+#define __JB_GPR8 2
+#define __JB_GPR9 3
+#define __JB_GPR10 4
+#define __JB_GPR11 5
+#define __JB_GPR12 6
+#define __JB_GPR13 7
+#define __JB_GPR14 8
+#define __JB_GPR15 9
+
+#define _JMPBUF_UNWINDS(jmpbuf, address) ((int) (address) < (jmpbuf)->gregs[__JB_GPR15])
+#endif
+
#ifdef __alpha__
#define JB_S0 0
#define JB_S1 1
@@ -55,18 +91,80 @@ typedef struct
#endif
#ifdef __sparc__
+#ifdef __arch64__
+
+#define MC_TSTATE 0
+#define MC_PC 1
+#define MC_NPC 2
+#define MC_Y 3
+#define MC_G1 4
+#define MC_G2 5
+#define MC_G3 6
+#define MC_G4 7
+#define MC_G5 8
+#define MC_G6 9
+#define MC_G7 10
+#define MC_O0 11
+#define MC_O1 12
+#define MC_O2 13
+#define MC_O3 14
+#define MC_O4 15
+#define MC_O5 16
+#define MC_O6 17
+#define MC_O7 18
+#define MC_NGREG 19
+
+#define FLAG_SAVEMASK 512
+#ifndef __ASSEMBLER__
+#include <signal.h>
+
+/* this equal to ucontext from "include/asm-sparc64/uctx.h" */
+typedef struct __sparc64_jmp_buf {
+ struct __sparc64_jmp_buf *uc_link;
+ unsigned long uc_flags;
+ sigset_t uc_sigmask;
+ struct {
+ unsigned long mc_gregs[MC_NGREG];
+ unsigned long mc_fp;
+ unsigned long mc_i7;
+ struct {
+ union {
+ unsigned int sregs[32];
+ unsigned long dregs[32];
+ long double qregs[16];
+ } mcfpu_fregs;
+ unsigned long mcfpu_fsr;
+ unsigned long mcfpu_fprs;
+ unsigned long mcfpu_gsr;
+ struct {
+ unsigned long *mcfq_addr;
+ unsigned int mcfq_insn;
+ } *mcfpu_fq;
+ unsigned char mcfpu_qcnt;
+ unsigned char mcfpu_qentsz;
+ unsigned char mcfpu_enab;
+ } mc_fpregs;
+ } uc_mcontext;
+} __jmp_buf[1];
+
+#endif
+
+#else
+
#define JB_SP 0
#define JB_FP 1
#define JB_PC 2
#ifndef __ASSEMBLER__
typedef int __jmp_buf[3];
#endif
+
+#endif
#endif
#ifdef __arm__
#define __JMP_BUF_SP 8
#ifndef __ASSEMBLER__
-typedef int __jmp_buf[10];
+typedef int __jmp_buf[24];
#endif
#endif
@@ -83,39 +181,49 @@ typedef long int __jmp_buf[58];
#endif
#endif
+#ifdef __hppa__
#ifndef __ASSEMBLER__
+typedef double __jmp_buf[21];
+#endif
+#endif
-typedef int sig_atomic_t;
-#define __sig_atomic_t sig_atomic_t
+#ifdef __ia64__
+#ifndef __ASSEMBLER__
+typedef long __jmp_buf[70] __attribute__ ((aligned(16)));
+#endif
+#endif
-# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
-typedef struct
- {
- unsigned long int __val[_SIGSET_NWORDS];
- } __sigset_t;
+#ifndef __ASSEMBLER__
+#include <signal.h>
+
+/* typedef int sig_atomic_t; */
+#define __sig_atomic_t sig_atomic_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];
+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 int __sigsetjmp(jmp_buf __env,int __savemask) __THROW;
-extern void longjmp (jmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
+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__));
+extern void siglongjmp(sigjmp_buf __env,int __val)
+ __THROW __attribute__((__noreturn__));
+#ifdef _BSD_SOURCE
+#define setjmp(env) __sigsetjmp(env,1)
+#else
#define setjmp(env) __sigsetjmp(env,0)
+#endif
#define sigsetjmp(a,b) __sigsetjmp(a,b)
#endif
diff --git a/mdk-stage1/dietlibc/include/shadow.h b/mdk-stage1/dietlibc/include/shadow.h
index 4d6341af1..1c84de9e6 100644
--- a/mdk-stage1/dietlibc/include/shadow.h
+++ b/mdk-stage1/dietlibc/include/shadow.h
@@ -19,6 +19,12 @@ struct spwd {
extern struct spwd *getspent(void) __THROW;
extern void setspent(void) __THROW;
extern void endspent(void) __THROW;
-extern struct spwd *getspnam (__const char *__name) __THROW;
+extern struct spwd *getspnam (const char *__name) __THROW;
+
+int getspent_r(struct spwd *res, char *buf, size_t buflen,
+ struct spwd **res_sig) __THROW;
+int getspnam_r(const char* name,
+ struct spwd *res, char *buf, size_t buflen,
+ struct spwd **res_sig) __THROW;
#endif /* _SHADOW_H */
diff --git a/mdk-stage1/dietlibc/include/signal.h b/mdk-stage1/dietlibc/include/signal.h
index 9ed93fe83..fdc0518cf 100644
--- a/mdk-stage1/dietlibc/include/signal.h
+++ b/mdk-stage1/dietlibc/include/signal.h
@@ -5,31 +5,496 @@
#define __WANT_POSIX1B_SIGNALS__
-#include <linux/types.h>
-#include <linux/signal.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#define NSIG 32
+
+#ifdef __mips__
+#define _NSIG 128
+#else
+#define _NSIG 64
+#endif
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT 6
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGSEGV 11
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGUNUSED 31
+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__arm__) \
+ || defined(__s390__) || defined(__ia64__)
+#define SIGBUS 7
+#define SIGUSR1 10
+#define SIGUSR2 12
+#define SIGSTKFLT 16
+#define SIGCHLD 17
+#define SIGCONT 18
+#define SIGSTOP 19
+#define SIGTSTP 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+#define SIGURG 23
+#define SIGXCPU 24
+#define SIGXFSZ 25
+#define SIGVTALRM 26
+#define SIGPROF 27
+#define SIGWINCH 28
+#define SIGIO 29
+#define SIGPWR 30
+#define SIGSYS 31
+#elif defined(__alpha__) || defined(__sparc__)
+#define SIGEMT 7
+#define SIGBUS 10
+#define SIGSYS 12
+#define SIGURG 16
+#define SIGSTOP 17
+#define SIGTSTP 18
+#define SIGCONT 19
+#define SIGCHLD 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+#define SIGIO 23
+#define SIGXCPU 24
+#define SIGXFSZ 25
+#define SIGVTALRM 26
+#define SIGPROF 27
+#define SIGWINCH 28
+#define SIGPWR 29
+#define SIGUSR1 30
+#define SIGUSR2 31
+#if defined(__alpha__)
+#define SIGINFO SIGPWR
+#endif
+#elif defined(__mips__)
+#define SIGEMT 7
+#define SIGBUS 10
+#define SIGSYS 12
+#define SIGUSR1 16
+#define SIGUSR2 17
+#define SIGCHLD 18
+#define SIGPWR 19
+#define SIGWINCH 20
+#define SIGURG 21
+#define SIGIO 22
+#define SIGSTOP 23
+#define SIGTSTP 24
+#define SIGCONT 25
+#define SIGTTIN 26
+#define SIGTTOU 27
+#define SIGVTALRM 28
+#define SIGPROF 29
+#define SIGXCPU 30
+#define SIGXFSZ 31
+#elif defined(__hppa__)
+#define SIGEMT 7
+#define SIGBUS 10
+#define SIGSYS 12
+#define SIGUSR1 16
+#define SIGUSR2 17
+#define SIGCHLD 18
+#define SIGPWR 19
+#define SIGVTALRM 20
+#define SIGPROF 21
+#define SIGIO 22
+#define SIGWINCH 23
+#define SIGSTOP 24
+#define SIGTSTP 25
+#define SIGCONT 26
+#define SIGTTIN 27
+#define SIGTTOU 28
+#define SIGURG 29
+#define SIGLOST 30
+#define SIGUNUSED 31
+#define SIGRESERVE SIGUNUSE
+#define SIGXCPU 33
+#define SIGXFSZ 34
+#define SIGSTKFLT 36
+
+#else
+#error signal layout not yet known
+#endif
+
+#define SIGCLD SIGCHLD
+#define SIGLOST SIGPWR
+#define SIGPOLL SIGIO
+
+/* These should not be considered constants from userland. */
+#ifdef __hppa__
+#define SIGRTMIN 37
+#else
+#define SIGRTMIN 32
+#endif
+#define SIGRTMAX (_NSIG-1)
+
+/* SA_FLAGS values: */
+#if defined(__alpha__)
+#define SA_ONSTACK 0x00000001
+#define SA_RESTART 0x00000002
+#define SA_NOCLDSTOP 0x00000004
+#define SA_NODEFER 0x00000008
+#define SA_RESETHAND 0x00000010
+#define SA_NOCLDWAIT 0x00000020 /* not supported yet */
+#define SA_SIGINFO 0x00000040
+#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
+#elif defined(__hppa__)
+#define SA_ONSTACK 0x00000001
+#define SA_RESETHAND 0x00000004
+#define SA_NOCLDSTOP 0x00000008
+#define SA_SIGINFO 0x00000010
+#define SA_NODEFER 0x00000020
+#define SA_RESTART 0x00000040
+#define SA_NOCLDWAIT 0x00000080 /* not supported yet */
+#define _SA_SIGGFAULT 0x00000100 /* HPUX */
+#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
+#define SA_RESTORER 0x04000000 /* obsolete -- ignored */
+#elif defined (__sparc__)
+#define SV_SSTACK 1 /* This signal handler should use sig-stack */
+#define SV_INTR 2 /* Sig return should not restart system call */
+#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */
+#define SV_IGNCHILD 8 /* Do not send SIGCHLD */
+
+#define SA_NOCLDSTOP SV_IGNCHILD
+#define SA_STACK SV_SSTACK
+#define SA_ONSTACK SV_SSTACK
+#define SA_RESTART SV_INTR
+#define SA_RESETHAND SV_RESET
+#define SA_INTERRUPT 0x10
+#define SA_NODEFER 0x20
+#define SA_SHIRQ 0x40
+#define SA_NOCLDWAIT 0x100 /* not supported yet */
+#define SA_SIGINFO 0x200
+#else
+#if defined (__mips__)
+#define SA_NOCLDSTOP 0x00000001
+#define SA_SIGINFO 0x00000008
+#define SA_NOCLDWAIT 0x00010000 /* Not supported yet */
+#else
+#define SA_NOCLDSTOP 0x00000001
+#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
+#define SA_SIGINFO 0x00000004
+#endif
+#if defined(__arm__)
+#define SA_THIRTYTWO 0x02000000
+#endif
+#define SA_RESTORER 0x04000000
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#endif
+
+/* ugh, historic Linux legacy, for gpm :-( */
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+
+/* sigaltstack controls */
+#define SS_ONSTACK 1
+#define SS_DISABLE 2
+
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+
+#if defined(__alpha__) || defined(__mips__)
+#define SIG_BLOCK 1 /* for blocking signals */
+#define SIG_UNBLOCK 2 /* for unblocking signals */
+#define SIG_SETMASK 3 /* for setting the signal mask */
+#else
+#define SIG_BLOCK 0 /* for blocking signals */
+#define SIG_UNBLOCK 1 /* for unblocking signals */
+#define SIG_SETMASK 2 /* for setting the signal mask */
+#endif
+
+typedef int sig_atomic_t;
typedef void (*sighandler_t)(int);
+#ifdef _BSD_SOURCE
+typedef sighandler_t sig_t;
+#endif
+
+#define SIG_DFL ((sighandler_t)0) /* default signal handling */
+#define SIG_IGN ((sighandler_t)1) /* ignore signal */
+#define SIG_ERR ((sighandler_t)-1) /* error return from signal */
+
+typedef union sigval {
+ int sival_int;
+ void *sival_ptr;
+} sigval_t;
+
+#define SI_MAX_SIZE 128
+#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3)
+
+typedef struct siginfo {
+ int si_signo;
+ int si_errno;
+ int si_code;
+ union {
+ int _pad[SI_PAD_SIZE];
+ /* kill() */
+ struct {
+ pid_t _pid; /* sender's pid */
+ uid_t _uid; /* sender's uid */
+ } _kill;
+ /* POSIX.1b timers */
+ struct {
+ unsigned int _timer1;
+ unsigned int _timer2;
+ } _timer;
+ /* POSIX.1b signals */
+ struct {
+ pid_t _pid; /* sender's pid */
+ uid_t _uid; /* sender's uid */
+ sigval_t _sigval;
+ } _rt;
+ /* SIGCHLD */
+ struct {
+ pid_t _pid; /* which child */
+ uid_t _uid; /* sender's uid */
+ int _status; /* exit code */
+ clock_t _utime;
+ clock_t _stime;
+ } _sigchld;
+ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+ struct {
+ void *_addr; /* faulting insn/memory ref. */
+ } _sigfault;
+ /* SIGPOLL */
+ struct {
+ int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
+ int _fd;
+ } _sigpoll;
+ } _sifields;
+} siginfo_t;
+
+/*
+ * How these fields are to be accessed.
+ */
+#define si_pid _sifields._kill._pid
+#define si_uid _sifields._kill._uid
+#define si_status _sifields._sigchld._status
+#define si_utime _sifields._sigchld._utime
+#define si_stime _sifields._sigchld._stime
+#define si_value _sifields._rt._sigval
+#define si_int _sifields._rt._sigval.sival_int
+#define si_ptr _sifields._rt._sigval.sival_ptr
+#define si_addr _sifields._sigfault._addr
+#define si_band _sifields._sigpoll._band
+#define si_fd _sifields._sigpoll._fd
+
+/* Values for `si_code'. Positive values are reserved for kernel-generated
+ signals. */
+enum {
+ SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */
+# define SI_ASYNCNL SI_ASYNCNL
+ SI_SIGIO, /* Sent by queued SIGIO. */
+# define SI_SIGIO SI_SIGIO
+ SI_ASYNCIO, /* Sent by AIO completion. */
+# define SI_ASYNCIO SI_ASYNCIO
+ SI_MESGQ, /* Sent by real time mesq state change. */
+# define SI_MESGQ SI_MESGQ
+ SI_TIMER, /* Sent by timer expiration. */
+# define SI_TIMER SI_TIMER
+ SI_QUEUE, /* Sent by sigqueue. */
+# define SI_QUEUE SI_QUEUE
+ SI_USER, /* Sent by kill, sigsend, raise. */
+# define SI_USER SI_USER
+ SI_KERNEL = 0x80 /* Send by kernel. */
+#define SI_KERNEL SI_KERNEL
+};
+
+
+/* `si_code' values for SIGILL signal. */
+enum {
+ ILL_ILLOPC = 1, /* Illegal opcode. */
+# define ILL_ILLOPC ILL_ILLOPC
+ ILL_ILLOPN, /* Illegal operand. */
+# define ILL_ILLOPN ILL_ILLOPN
+ ILL_ILLADR, /* Illegal addressing mode. */
+# define ILL_ILLADR ILL_ILLADR
+ ILL_ILLTRP, /* Illegal trap. */
+# define ILL_ILLTRP ILL_ILLTRP
+ ILL_PRVOPC, /* Privileged opcode. */
+# define ILL_PRVOPC ILL_PRVOPC
+ ILL_PRVREG, /* Privileged register. */
+# define ILL_PRVREG ILL_PRVREG
+ ILL_COPROC, /* Coprocessor error. */
+# define ILL_COPROC ILL_COPROC
+ ILL_BADSTK /* Internal stack error. */
+# define ILL_BADSTK ILL_BADSTK
+};
+
+/* `si_code' values for SIGFPE signal. */
+enum {
+ FPE_INTDIV = 1, /* Integer divide by zero. */
+# define FPE_INTDIV FPE_INTDIV
+ FPE_INTOVF, /* Integer overflow. */
+# define FPE_INTOVF FPE_INTOVF
+ FPE_FLTDIV, /* Floating point divide by zero. */
+# define FPE_FLTDIV FPE_FLTDIV
+ FPE_FLTOVF, /* Floating point overflow. */
+# define FPE_FLTOVF FPE_FLTOVF
+ FPE_FLTUND, /* Floating point underflow. */
+# define FPE_FLTUND FPE_FLTUND
+ FPE_FLTRES, /* Floating point inexact result. */
+# define FPE_FLTRES FPE_FLTRES
+ FPE_FLTINV, /* Floating point invalid operation. */
+# define FPE_FLTINV FPE_FLTINV
+ FPE_FLTSUB /* Subscript out of range. */
+# define FPE_FLTSUB FPE_FLTSUB
+};
+
+/* `si_code' values for SIGSEGV signal. */
+enum {
+ SEGV_MAPERR = 1, /* Address not mapped to object. */
+# define SEGV_MAPERR SEGV_MAPERR
+ SEGV_ACCERR /* Invalid permissions for mapped object. */
+# define SEGV_ACCERR SEGV_ACCERR
+};
+
+/* `si_code' values for SIGBUS signal. */
+enum {
+ BUS_ADRALN = 1, /* Invalid address alignment. */
+# define BUS_ADRALN BUS_ADRALN
+ BUS_ADRERR, /* Non-existant physical address. */
+# define BUS_ADRERR BUS_ADRERR
+ BUS_OBJERR /* Object specific hardware error. */
+# define BUS_OBJERR BUS_OBJERR
+};
+
+/* `si_code' values for SIGTRAP signal. */
+enum {
+ TRAP_BRKPT = 1, /* Process breakpoint. */
+# define TRAP_BRKPT TRAP_BRKPT
+ TRAP_TRACE /* Process trace trap. */
+# define TRAP_TRACE TRAP_TRACE
+};
+
+/* `si_code' values for SIGCHLD signal. */
+enum {
+ CLD_EXITED = 1, /* Child has exited. */
+# define CLD_EXITED CLD_EXITED
+ CLD_KILLED, /* Child was killed. */
+# define CLD_KILLED CLD_KILLED
+ CLD_DUMPED, /* Child terminated abnormally. */
+# define CLD_DUMPED CLD_DUMPED
+ CLD_TRAPPED, /* Traced child has trapped. */
+# define CLD_TRAPPED CLD_TRAPPED
+ CLD_STOPPED, /* Child has stopped. */
+# define CLD_STOPPED CLD_STOPPED
+ CLD_CONTINUED /* Stopped child has continued. */
+# define CLD_CONTINUED CLD_CONTINUED
+};
+
+/* `si_code' values for SIGPOLL signal. */
+enum {
+ POLL_IN = 1, /* Data input available. */
+# define POLL_IN POLL_IN
+ POLL_OUT, /* Output buffers available. */
+# define POLL_OUT POLL_OUT
+ POLL_MSG, /* Input message available. */
+# define POLL_MSG POLL_MSG
+ POLL_ERR, /* I/O error. */
+# define POLL_ERR POLL_ERR
+ POLL_PRI, /* High priority input available. */
+# define POLL_PRI POLL_PRI
+ POLL_HUP /* Device disconnected. */
+# define POLL_HUP POLL_HUP
+};
+
+#define _NSIG_WORDS ((_NSIG/sizeof(long))>>3)
+
+typedef struct {
+ unsigned long sig[_NSIG_WORDS];
+} sigset_t;
+
+struct sigaction {
+#if defined(__alpha__)
+ union {
+ sighandler_t _sa_handler;
+ void (*_sa_sigaction)(int, siginfo_t*, void*);
+ } _u;
+ sigset_t sa_mask;
+ unsigned long sa_flags;
+#elif defined(__ia64__) || defined(__hppa__)
+ union {
+ sighandler_t _sa_handler;
+ void (*_sa_sigaction)(int, siginfo_t*, void*);
+ } _u;
+ unsigned long sa_flags;
+ sigset_t sa_mask;
+#elif defined(__mips__)
+ unsigned long sa_flags;
+ union {
+ sighandler_t _sa_handler;
+ void (*_sa_sigaction)(int, siginfo_t*, void*);
+ } _u;
+ sigset_t sa_mask;
+ void (*sa_restorer)(void);
+ int sa_resv[1];
+#else /* arm, i386, ppc, s390, sparc, saprc64, x86_64 */
+ union {
+ sighandler_t _sa_handler;
+ void (*_sa_sigaction)(int, siginfo_t*, void*);
+ } _u;
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+ sigset_t sa_mask;
+#endif
+};
+
+#define sa_handler _u._sa_handler
+#define sa_sigaction _u._sa_sigaction
+
+typedef struct sigaltstack {
+#if defined(__mips__)
+ void *ss_sp;
+ size_t ss_size;
+ int ss_flags;
+#else
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+#endif
+} stack_t;
+
+int sigaltstack(const struct sigaltstack *newstack, struct sigaltstack *oldstack) __THROW;
+
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 sigismember(const sigset_t *set, int signo) __THROW;
+int sigsuspend(const sigset_t *mask) __THROW;
+int sigpending(sigset_t *set) __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 kill(pid_t pid, 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
+int sigtimedwait(const sigset_t *mask, siginfo_t *info, const struct timespec *ts) __THROW;
+int sigqueueinfo(int pid, int sig, siginfo_t *info) __THROW;
+int siginterrupt(int sig, int flag) __THROW;
-extern const char *const sys_siglist[];
+int killpg(int pgrp, int sig) __THROW;
-typedef __sighandler_t sig_t;
+/* 0 is OK ! kernel puts in MAX_THREAD_TIMEOUT :) */
+#define sigwaitinfo(m, i) sigtimedwait((m),(i),0)
-#ifndef NSIG
-#define NSIG _NSIG
-#endif
+extern const char *const sys_siglist[];
#endif
diff --git a/mdk-stage1/dietlibc/include/stdarg-cruft.h b/mdk-stage1/dietlibc/include/stdarg-cruft.h
new file mode 100644
index 000000000..fbd9e0ca4
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/stdarg-cruft.h
@@ -0,0 +1,299 @@
+#if defined(__sparc__) || defined(__alpha__) || defined(__mips__)
+enum {
+ __no_type_class = -1,
+ __void_type_class,
+ __integer_type_class,
+ __char_type_class,
+ __enumeral_type_class,
+ __boolean_type_class,
+ __pointer_type_class,
+ __reference_type_class,
+ __offset_type_class,
+ __real_type_class,
+ __complex_type_class,
+ __function_type_class,
+ __method_type_class,
+ __record_type_class,
+ __union_type_class,
+ __array_type_class,
+ __string_type_class,
+ __set_type_class,
+ __file_type_class,
+ __lang_type_class
+};
+#endif
+
+#if defined(__sparc__)
+
+typedef char* va_list;
+#define va_end(ap) ap=0
+
+#define va_start(AP, LASTARG) \
+ (__builtin_next_arg (LASTARG), AP = (char *) __builtin_saveregs ())
+
+#define __va_rounded_size(TYPE) \
+ (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
+
+/* We don't declare the union member `d' to have type TYPE
+ because that would lose in C++ if TYPE has a constructor. */
+/* We cast to void * and then to TYPE * because this avoids
+ a warning about increasing the alignment requirement.
+ The casts to char * avoid warnings about invalid pointer arithmetic. */
+#define va_arg(pvar,TYPE) \
+__extension__ \
+(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
+ || (__builtin_classify_type (*(TYPE*) 0) == __real_type_class \
+ && sizeof (TYPE) == 16)) \
+ ? ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE *), \
+ *(TYPE **) (void *) ((char *)(pvar) - __va_rounded_size (TYPE *))) \
+ : __va_rounded_size (TYPE) == 8 \
+ ? ({ union {char __d[sizeof (TYPE)]; int __i[2];} __u; \
+ __u.__i[0] = ((int *) (void *) (pvar))[0]; \
+ __u.__i[1] = ((int *) (void *) (pvar))[1]; \
+ (pvar) = (char *)(pvar) + 8; \
+ (TYPE *) (void *) __u.__d; }) \
+ : ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \
+ ((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));}))
+
+
+#elif defined(__mips__)
+
+typedef char * va_list;
+
+#ifdef __mips64
+#define __va_rounded_size(__TYPE) \
+ (((sizeof (__TYPE) + 8 - 1) / 8) * 8)
+#else
+#define __va_rounded_size(__TYPE) \
+ (((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
+#endif
+#ifdef __mips64
+#define __va_reg_size 8
+#else
+#define __va_reg_size 4
+#endif
+
+#define va_start(__AP, __LASTARG) \
+ (__AP = (va_list) __builtin_next_arg (__LASTARG))
+
+#ifdef __mips64
+#ifdef __MIPSEB__
+#define va_arg(__AP, __type) \
+ ((__type *) (void *) (__AP = (char *) \
+ ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ + __va_rounded_size (__type))))[-1]
+#else
+#define va_arg(__AP, __type) \
+ ((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \
+ + __va_rounded_size (__type))), \
+ *(__type *) (void *) (__AP - __va_rounded_size (__type)))
+#endif
+
+#else /* not __mips64 */
+
+#ifdef __MIPSEB__
+/* For big-endian machines. */
+#define va_arg(__AP, __type) \
+ ((__AP = (char *) ((__alignof__ (__type) > 4 \
+ ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
+ : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ + __va_rounded_size (__type))), \
+ *(__type *) (void *) (__AP - __va_rounded_size (__type)))
+#else
+/* For little-endian machines. */
+#define va_arg(__AP, __type) \
+ ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
+ ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
+ : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ + __va_rounded_size(__type))))[-1]
+#endif
+#endif
+
+#elif defined(__powerpc__)
+
+typedef struct __va_list_tag {
+ unsigned char gpr; /* index into the array of 8 GPRs stored in the
+ register save area gpr=0 corresponds to r3,
+ gpr=1 to r4, etc. */
+ unsigned char fpr; /* index into the array of 8 FPRs stored in the
+ register save area fpr=0 corresponds to f1,
+ fpr=1 to f2, etc. */
+ char *overflow_arg_area; /* location on stack that holds the next
+ overflow argument */
+ char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */
+} va_list[1];
+
+#define __va_overflow(AP) (AP)->overflow_arg_area
+#ifdef __OPTIMIZE__
+extern void __va_arg_type_violation(void) __attribute__((__noreturn__));
+#else
+#define __va_arg_type_violation()
+#endif
+
+typedef struct {
+ long __gp_save[8]; /* save area for GP registers */
+ double __fp_save[8]; /* save area for FP registers */
+} __va_regsave_t;
+
+/* Macros to access the register save area */
+/* We cast to void * and then to TYPE * because this avoids
+ a warning about increasing the alignment requirement. */
+#define __VA_FP_REGSAVE(AP,OFS,TYPE) \
+ ((TYPE *) (void *) (&(((__va_regsave_t *) \
+ (AP)->reg_save_area)->__fp_save[OFS])))
+
+#define __VA_GP_REGSAVE(AP,OFS,TYPE) \
+ ((TYPE *) (void *) (&(((__va_regsave_t *) \
+ (AP)->reg_save_area)->__gp_save[OFS])))
+
+#define __va_start_common(AP, FAKE) \
+ __builtin_memcpy ((AP), __builtin_saveregs (), sizeof(va_list))
+
+#define va_start(AP,LASTARG) \
+ (__builtin_next_arg (LASTARG), __va_start_common (AP, 0))
+
+#ifdef _SOFT_FLOAT
+#define __va_float_p(TYPE) 0
+#else
+#define __va_float_p(TYPE) (__builtin_classify_type(*(TYPE *)0) == 8)
+#endif
+
+#define __va_aggregate_p(TYPE) (__builtin_classify_type(*(TYPE *)0) >= 12)
+#define __va_size(TYPE) ((sizeof(TYPE) + sizeof (long) - 1) / sizeof (long))
+
+#define va_arg(AP,TYPE) \
+__extension__ (*({ \
+ register TYPE *__ptr; \
+ \
+ if (__va_float_p (TYPE) && sizeof (TYPE) < 16) \
+ { \
+ unsigned char __fpr = (AP)->fpr; \
+ if (__fpr < 8) \
+ { \
+ __ptr = __VA_FP_REGSAVE (AP, __fpr, TYPE); \
+ (AP)->fpr = __fpr + 1; \
+ } \
+ else if (sizeof (TYPE) == 8) \
+ { \
+ unsigned long __addr = (unsigned long) (__va_overflow (AP)); \
+ __ptr = (TYPE *)((__addr + 7) & -8); \
+ __va_overflow (AP) = (char *)(__ptr + 1); \
+ } \
+ else \
+ { \
+ /* float is promoted to double. */ \
+ __va_arg_type_violation (); \
+ } \
+ } \
+ \
+ /* Aggregates and long doubles are passed by reference. */ \
+ else if (__va_aggregate_p (TYPE) || __va_float_p (TYPE)) \
+ { \
+ unsigned char __gpr = (AP)->gpr; \
+ if (__gpr < 8) \
+ { \
+ __ptr = * __VA_GP_REGSAVE (AP, __gpr, TYPE *); \
+ (AP)->gpr = __gpr + 1; \
+ } \
+ else \
+ { \
+ TYPE **__pptr = (TYPE **) (__va_overflow (AP)); \
+ __ptr = * __pptr; \
+ __va_overflow (AP) = (char *) (__pptr + 1); \
+ } \
+ } \
+ \
+ /* Only integrals remaining. */ \
+ else \
+ { \
+ /* longlong is aligned. */ \
+ if (sizeof (TYPE) == 8) \
+ { \
+ unsigned char __gpr = (AP)->gpr; \
+ if (__gpr < 7) \
+ { \
+ __gpr += __gpr & 1; \
+ __ptr = __VA_GP_REGSAVE (AP, __gpr, TYPE); \
+ (AP)->gpr = __gpr + 2; \
+ } \
+ else \
+ { \
+ unsigned long __addr = (unsigned long) (__va_overflow (AP)); \
+ __ptr = (TYPE *)((__addr + 7) & -8); \
+ (AP)->gpr = 8; \
+ __va_overflow (AP) = (char *)(__ptr + 1); \
+ } \
+ } \
+ else if (sizeof (TYPE) == 4) \
+ { \
+ unsigned char __gpr = (AP)->gpr; \
+ if (__gpr < 8) \
+ { \
+ __ptr = __VA_GP_REGSAVE (AP, __gpr, TYPE); \
+ (AP)->gpr = __gpr + 1; \
+ } \
+ else \
+ { \
+ __ptr = (TYPE *) __va_overflow (AP); \
+ __va_overflow (AP) = (char *)(__ptr + 1); \
+ } \
+ } \
+ else \
+ { \
+ /* Everything else was promoted to int. */ \
+ __va_arg_type_violation (); \
+ } \
+ } \
+ __ptr; \
+}))
+
+#define va_end(AP) ((void)0)
+
+/* Copy va_list into another variable of this type. */
+#define __va_copy(dest, src) *(dest) = *(src)
+
+#elif defined(__alpha__)
+
+typedef struct {
+ char *__base; /* Pointer to first integer register. */
+ int __offset; /* Byte offset of args so far. */
+} va_list;
+
+#define va_start(pvar, firstarg) \
+ (__builtin_next_arg (firstarg), \
+ (pvar) = *(va_list *) __builtin_saveregs ())
+#define va_end(__va) ((void) 0)
+
+#define __va_tsize(__type) \
+ (((sizeof (__type) + __extension__ sizeof (long long) - 1) \
+ / __extension__ sizeof (long long)) * __extension__ sizeof (long long))
+
+#define va_arg(__va, __type) \
+(*(((__va).__offset += __va_tsize (__type)), \
+ (__type *)(void *)((__va).__base + (__va).__offset \
+ - (((__builtin_classify_type (* (__type *) 0) \
+ == __real_type_class) && (__va).__offset <= (6 * 8)) \
+ ? (6 * 8) + 8 : __va_tsize (__type)))))
+
+#else /* !__sparc__ && !__powerpc__ && !__mips__ && !__alpha__*/
+
+typedef char* va_list;
+
+/* this only works when everything is passed on the stack (i.e. x86) */
+#if __WORDSIZE == 64
+#define va_start(ap,argn) ap=((char*)&argn)+8
+#else
+#define va_start(ap,argn) ap=((char*)&argn)+4
+#endif
+#define va_arg(ap,type) (ap+=sizeof(type), *(type*)((void*)ap-sizeof(type)))
+
+#endif
+
+#ifndef __va_copy
+#define __va_copy(x,y) x=y
+#endif
+
+#ifndef va_end
+#define va_end(ap) ((void)0)
+#endif
+
diff --git a/mdk-stage1/dietlibc/include/stdarg.h b/mdk-stage1/dietlibc/include/stdarg.h
new file mode 100644
index 000000000..3a21bdb56
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/stdarg.h
@@ -0,0 +1,24 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+#include <endian.h>
+
+#if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96))
+
+typedef __builtin_va_list va_list;
+#define va_start(v,l) __builtin_stdarg_start((v),l)
+#define va_end __builtin_va_end
+#define va_arg __builtin_va_arg
+#define __va_copy(d,s) __builtin_va_copy((d),(s))
+
+#endif
+
+#ifndef va_end
+#include <stdarg-cruft.h>
+#endif
+
+#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
+#define va_copy(d,s) __va_copy(d,s)
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/stddef.h b/mdk-stage1/dietlibc/include/stddef.h
new file mode 100644
index 000000000..cdf54ec1e
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/stddef.h
@@ -0,0 +1,23 @@
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+/* ugh. This is normally provided by gcc. */
+
+#ifdef __GNUC__
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __SIZE_TYPE__ size_t;
+typedef __WCHAR_TYPE__ wchar_t;
+#else
+typedef signed long ptrdiff_t;
+typedef unsigned long size_t;
+typedef int wchar_t;
+#endif
+
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+#undef offsetof
+#define offsetof(type,member) ((size_t) &((type*)0)->member)
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/stdint.h b/mdk-stage1/dietlibc/include/stdint.h
index d287e6794..bbc7ddf0c 100644
--- a/mdk-stage1/dietlibc/include/stdint.h
+++ b/mdk-stage1/dietlibc/include/stdint.h
@@ -1,6 +1,30 @@
#ifndef _STDINT_H
#define _STDINT_H
-#include <sys/types.h>
+#include <inttypes.h>
+
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+
+#ifndef __STRICT_ANSI__
+typedef int64_t int_least64_t;
+typedef uint64_t uint_least64_t;
+#endif
+
+typedef signed char int_fast8_t;
+typedef signed long int int_fast16_t;
+typedef signed long int int_fast32_t;
+typedef signed long long int int_fast64_t;
+
+typedef unsigned char uint_fast8_t;
+typedef unsigned long int uint_fast16_t;
+typedef unsigned long int uint_fast32_t;
+typedef unsigned long long int uint_fast64_t;
+
+#include <endian.h>
#endif
diff --git a/mdk-stage1/dietlibc/include/stdio.h b/mdk-stage1/dietlibc/include/stdio.h
index 92d9dc0cb..04783c3b8 100644
--- a/mdk-stage1/dietlibc/include/stdio.h
+++ b/mdk-stage1/dietlibc/include/stdio.h
@@ -3,6 +3,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <sys/stat.h>
typedef struct __stdio_file FILE;
@@ -10,28 +11,32 @@ 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 printf(const char *format, ...) __THROW __attribute__((format(printf,1,2)));
+int fprintf(FILE *stream, const char *format, ...) __THROW __attribute__((format(printf,2,3)));
+int sprintf(char *str, const char *format, ...) __THROW __attribute__((format(printf,2,3)));
+int snprintf(char *str, size_t size, const char *format, ...) __THROW __attribute__((format(printf,3,4)));
+int asprintf(char **ptr, const char* format, ...) __THROW __attribute_malloc__ __attribute__((format(printf,2,3)));
-int scanf( const char *format, ...) __THROW;
-int fscanf( FILE *stream, const char *format, ...) __THROW;
-int sscanf( const char *str, const char *format, ...) __THROW;
+int scanf(const char *format, ...) __THROW __attribute__((format(scanf,1,2)));
+int fscanf(FILE *stream, const char *format, ...) __THROW __attribute__((format(scanf,2,3)));
+int sscanf(const char *str, const char *format, ...) __THROW __attribute__((format(scanf,2,3)));
#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 vprintf(const char *format, va_list ap) __THROW __attribute__((format(printf,1,0)));
+int vfprintf(FILE *stream, const char *format, va_list ap) __THROW __attribute__((format(printf,2,0)));
+int vsprintf(char *str, const char *format, va_list ap) __THROW __attribute__((format(printf,2,0)));
+int vsnprintf(char *str, size_t size, const char *format, va_list ap) __THROW __attribute__((format(printf,3,0)));
-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 fdprintf(int fd, const char *format, ...) __THROW __attribute__((format(printf,2,3)));
+int vfdprintf(int fd, const char *format, va_list ap) __THROW __attribute__((format(printf,2,0)));
+
+int vscanf(const char *format, va_list ap) __THROW __attribute__((format(scanf,1,0)));
+int vsscanf(const char *str, const char *format, va_list ap) __THROW __attribute__((format(scanf,2,0)));
+int vfscanf(FILE *stream, const char *format, va_list ap) __THROW __attribute__((format(scanf,2,0)));
int fgetc(FILE *stream) __THROW;
+int fgetc_unlocked(FILE *stream) __THROW;
char *fgets(char *s, int size, FILE *stream) __THROW;
int getc(FILE *stream) __THROW;
int getchar(void) __THROW;
@@ -39,34 +44,53 @@ char *gets(char *s) __THROW;
int ungetc(int c, FILE *stream) __THROW;
int fputc(int c, FILE *stream) __THROW;
+int fputc_unlocked(int c, FILE *stream) __THROW;
int fputs(const char *s, FILE *stream) __THROW;
+int putchar(int c) __THROW;
+
#define putc(c,stream) fputc(c,stream)
#define putchar(c) fputc(c,stdout)
#define getchar() fgetc(stdin)
#define getc(stream) fgetc(stream)
+#define getc_unlocked(stream) fgetc_unlocked(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;
+int fseek(FILE *stream, long offset, int whence) __THROW;
+long ftell(FILE *stream) __THROW;
+int fseeko(FILE *stream, off_t offset, int whence) __THROW;
+off_t ftello(FILE *stream) __THROW;
-size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream) __THROW;
+#ifndef __NO_STAT64
+int fseeko64(FILE *stream, loff_t offset, int whence) __THROW;
+loff_t ftello64(FILE *stream) __THROW;
-size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream) __THROW;
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+#define off_t loff_t
+#define fseeko(foo,bar,baz) fseeko64(foo,bar,baz)
+#define ftello(foo) ftello64(foo)
+#endif
+
+#endif
+
+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 ferror(FILE *stream) __THROW;
+int fileno(FILE *stream) __THROW;
+void clearerr(FILE *stream) __THROW;
int remove(const char *pathname) __THROW;
@@ -74,7 +98,7 @@ void perror(const char *s) __THROW;
extern FILE *stdin, *stdout, *stderr;
-#define EOF (int)(-1)
+#define EOF (-1)
#define BUFSIZ 128
@@ -91,7 +115,33 @@ int setvbuf(FILE *stream, char *buf, int mode , size_t size) __THROW;
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)
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#endif
+
+#define L_tmpnam 128
+#define P_tmpdir "/tmp"
+char* tmpnam(char *s) __THROW; /* DO NOT USE!!! Use mkstemp instead! */
+char* tempnam(char* dir,char* _template); /* dito */
+FILE* tmpfile(void) __THROW;
+
+#define FILENAME_MAX 4095
+#define FOPEN_MAX 16
+
+#ifdef _POSIX_SOURCE
+#define L_ctermid 9
+#define L_cuserid 9
+#endif
+
+void flockfile(FILE* f) __THROW;
+void funlockfile(FILE* f) __THROW;
+
+#ifdef _GNU_SOURCE
+ssize_t getline(char **lineptr, size_t *n, FILE *stream);
+ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream);
+#define getline(lineptr,n,stream) getdelim(lineptr,n,'\n',stream)
+#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/stdlib.h b/mdk-stage1/dietlibc/include/stdlib.h
index 6a13a48ff..5824a6ffa 100644
--- a/mdk-stage1/dietlibc/include/stdlib.h
+++ b/mdk-stage1/dietlibc/include/stdlib.h
@@ -1,32 +1,38 @@
#ifndef _STDLIB_H
#define _STDLIB_H
+#ifndef __ASSEMBLER__
+
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <alloca.h>
-#define __LIBC_DIETLIBC__
-
-void *calloc(size_t nmemb, size_t size) __THROW;
-void *malloc(size_t size) __THROW;
+void *calloc(size_t nmemb, size_t size) __attribute_malloc__ __THROW;
+void *malloc(size_t size) __attribute_malloc__ __THROW;
void free(void *ptr) __THROW;
-void *realloc(void *ptr, size_t size) __THROW;
+void *realloc(void *ptr, size_t size) __attribute_malloc__ __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 system (const char * string) __THROW;
int atexit(void (*function)(void)) __THROW;
+float strtof(const char *nptr, char **endptr) __THROW;
double strtod(const char *nptr, char **endptr) __THROW;
+long double strtold(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;
+extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW;
+extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2) __THROW;
+
+#ifndef __STRICT_ANSI__
+__extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW;
+__extension__ unsigned long long int strtoull(const char *nptr, char **endptr, int base) __THROW;
+__extension__ int __lltostr(char *s, unsigned int size, unsigned long long i, unsigned int base, int UpCase) __THROW;
#endif
int atoi(const char *nptr) __THROW;
@@ -36,32 +42,59 @@ 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 int rand_r(unsigned int *seed) __THROW;
extern void srand(unsigned int seed) __THROW;
+#ifdef _BSD_SOURCE
+extern int random(void) __THROW;
+extern void srandom(unsigned int seed) __THROW;
+#endif
+
+typedef unsigned short randbuf[3];
+double drand48(void) __THROW;
+long lrand48(void) __THROW;
+long mrand48(void) __THROW;
+void srand48(long seed) __THROW;
+unsigned short *seed48(randbuf buf) __THROW;
+void lcong48(unsigned short param[7]) __THROW;
+long jrand48(randbuf buf) __THROW;
+long nrand48(randbuf buf) __THROW;
+double erand48(randbuf buf) __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;
+int mkstemp(char *_template);
+char* mkdtemp(char *_template);
+
+char* mktemp(char *_template);
+
+int abs(int i) __THROW __attribute__((const));
+long int labs(long int i) __THROW __attribute__((const));
+__extension__ long long int llabs(long long int i) __THROW __attribute__((const));
+
+#ifdef _XOPEN_SOURCE
+int grantpt (int fd) __THROW;
+int unlockpt (int fd) __THROW;
+char *ptsname (int fd) __THROW;
+#endif
+
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+#define RAND_MAX ((1<<31) -2)
-long int random(void) __THROW;
-void srandom(unsigned int seed) __THROW;
+#define MB_CUR_MAX 1
#endif
diff --git a/mdk-stage1/dietlibc/include/string.h b/mdk-stage1/dietlibc/include/string.h
index 1ef78ae54..4c56bf8bb 100644
--- a/mdk-stage1/dietlibc/include/string.h
+++ b/mdk-stage1/dietlibc/include/string.h
@@ -5,53 +5,80 @@
#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__;
+
+/* gcc unfortunately has some internal prototypes that are not compliant
+ * to the single unix specification and if we define the correct
+ * prototypes here, gcc emits warnings. */
+#if __GNUC__ > 2 || defined(__mips__) || defined(__alpha__) || defined(__arm__) || defined(__x86_64__)
+void* memset(void *s, int c, size_t n) __THROW;
int memcmp(const void *s1, const void *s2, size_t n) __THROW __pure__;
-int strcmp(const char *s1, const char *s2) __THROW __pure__;
+void* memcpy(void *dest, const void *src, size_t n) __THROW;
+#endif
+
+#if __GNUC__ < 3 || defined(__x86_64__)
+/* gcc 3 unfortunately has internal prototypes for these functions that
+ * differ from ours. Unfortunately, gcc will complain whether we have
+ * the correct prototypes or whether we don't have prototypes :-( */
+char *strncpy(char *dest, const char *src, size_t n) __THROW;
int strncmp(const char *s1, const char *s2, size_t n) __THROW __pure__;
+char *strncat(char *dest, const char *src, size_t n) __THROW;
+#endif
-int strcasecmp(const char *s1, const char *s2) __THROW __pure__;
-int strncasecmp(const char *s1, const char *s2, size_t n) __THROW __pure__;
+int strcmp(const char *s1, const char *s2) __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 *strdup(const char *s) __attribute_malloc__ __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 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 *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;
+void* memchr(const void *s, int c, size_t n) __THROW __pure__;
+#ifdef _GNU_SOURCE
+void* memrchr(const void *s, int c, size_t n) __THROW __pure__;
+#endif
-#undef NULL
-#define NULL (void*)0
+/* I would like to make this const, but Paul Jarc points out it has to
+ * be char* :-( */
+char *strerror(int errnum) __THROW;
+/* work around b0rken GNU crapware like tar 1.13.19 */
+#define strerror strerror
-#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)
+#ifdef _GNU_SOURCE
+const char *strsignal(int signum) __THROW;
+void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) __THROW;
-char *strerror(int errnum) __THROW;
-char *strsignal(int signum) __THROW;
+char *strndup(const char *s,size_t n) __attribute_malloc__ __THROW;
+#endif
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__));
+size_t strlcpy(char *dst, const char *src, size_t size) __THROW;
+size_t strlcat(char *dst, const char *src, size_t size) __THROW;
+
+int strcoll(const char *s1, const char *s2) __THROW;
+size_t strxfrm(char *dest, const char *src, size_t n) __THROW;
+
+#ifdef _BSD_SOURCE
+#include <strings.h>
+#endif
+
+char *stpcpy(char *dest, const char *src);
#endif
diff --git a/mdk-stage1/dietlibc/include/strings.h b/mdk-stage1/dietlibc/include/strings.h
index ec947a9b9..fd2616465 100644
--- a/mdk-stage1/dietlibc/include/strings.h
+++ b/mdk-stage1/dietlibc/include/strings.h
@@ -1,2 +1,23 @@
-#warning "your code included obsolescent <strings.h>. Please change that to <string.h>!"
-#include <string.h>
+#ifndef _STRINGS_H
+#define _STRINGS_H
+
+#include <stddef.h>
+#include <sys/cdefs.h>
+
+int strcasecmp(const char *s1, const char *s2) __THROW __pure__;
+int strncasecmp(const char *s1, const char *s2, size_t n) __THROW __pure__;
+int ffs(int i) __THROW __attribute__((__const__));
+
+int bcmp(const void *, const void *, size_t) __THROW __pure__;
+void bcopy(const void *, void *, size_t) __THROW;
+void bzero(void *, size_t) __THROW;
+char *index(const char *, int) __THROW __pure__;
+char *rindex(const char *, int) __THROW __pure__;
+
+#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)
+#define index(a,b) strchr(a,b)
+#define rindex(a,b) strrchr(a,b)
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/alpha-ioctl.h b/mdk-stage1/dietlibc/include/sys/alpha-ioctl.h
new file mode 100644
index 000000000..f1bde3bbb
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/alpha-ioctl.h
@@ -0,0 +1,168 @@
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 13
+#define _IOC_DIRBITS 3
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
+ * And this turns out useful to catch old ioctl numbers in header
+ * files for us.
+ */
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+#define _IOC_WRITE 4U
+
+#define _IOC(dir,type,nr,size) \
+ ((unsigned int) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT)))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode them.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+#define FIOCLEX _IO('f', 1)
+#define FIONCLEX _IO('f', 2)
+#define FIOASYNC _IOW('f', 125, int)
+#define FIONBIO _IOW('f', 126, int)
+#define FIONREAD _IOR('f', 127, int)
+#define TIOCINQ FIONREAD
+#define FIOQSIZE _IOR('f', 128, loff_t)
+
+#define TIOCGETP _IOR('t', 8, struct sgttyb)
+#define TIOCSETP _IOW('t', 9, struct sgttyb)
+#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
+
+#define TIOCSETC _IOW('t', 17, struct tchars)
+#define TIOCGETC _IOR('t', 18, struct tchars)
+#define TCGETS _IOR('t', 19, struct termios)
+#define TCSETS _IOW('t', 20, struct termios)
+#define TCSETSW _IOW('t', 21, struct termios)
+#define TCSETSF _IOW('t', 22, struct termios)
+
+#define TCGETA _IOR('t', 23, struct termio)
+#define TCSETA _IOW('t', 24, struct termio)
+#define TCSETAW _IOW('t', 25, struct termio)
+#define TCSETAF _IOW('t', 28, struct termio)
+
+#define TCSBRK _IO('t', 29)
+#define TCXONC _IO('t', 30)
+#define TCFLSH _IO('t', 31)
+
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
+#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
+#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
+
+#define TIOCGLTC _IOR('t', 116, struct ltchars)
+#define TIOCSLTC _IOW('t', 117, struct ltchars)
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+
+#define TIOCSTI 0x5412
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+# define TIOCM_LE 0x001
+# define TIOCM_DTR 0x002
+# define TIOCM_RTS 0x004
+# define TIOCM_ST 0x008
+# define TIOCM_SR 0x010
+# define TIOCM_CTS 0x020
+# define TIOCM_CAR 0x040
+# define TIOCM_RNG 0x080
+# define TIOCM_DSR 0x100
+# define TIOCM_CD TIOCM_CAR
+# define TIOCM_RI TIOCM_RNG
+# define TIOCM_OUT1 0x2000
+# define TIOCM_OUT2 0x4000
+# define TIOCM_LOOP 0x8000
+
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+# define TIOCPKT_DATA 0
+# define TIOCPKT_FLUSHREAD 1
+# define TIOCPKT_FLUSHWRITE 2
+# define TIOCPKT_STOP 4
+# define TIOCPKT_START 8
+# define TIOCPKT_NOSTOP 16
+# define TIOCPKT_DOSTOP 32
+
+
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
+#define TIOCSBRK 0x5427 /* BSD compatibility */
+#define TIOCCBRK 0x5428 /* BSD compatibility */
+#define TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
+#define TIOCSERGETLSR 0x5459 /* Get line status register */
+ /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
+#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
+#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
+
+/* Socket-level I/O control calls. */
+
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+
+#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */
diff --git a/mdk-stage1/dietlibc/include/sys/arm-ioctl.h b/mdk-stage1/dietlibc/include/sys/arm-ioctl.h
new file mode 100644
index 000000000..ab8b844a5
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/arm-ioctl.h
@@ -0,0 +1,149 @@
+
+/* ioctl command encoding: 32 bits total, command in lower 16 bits,
+ * size of the parameter structure in the lower 14 bits of the
+ * upper 16 bits.
+ * Encoding the size of the parameter structure in the ioctl request
+ * is useful for catching programs compiled with old versions
+ * and to avoid overwriting user space outside the user buffer area.
+ * The highest 2 bits are reserved for indicating the ``access mode''.
+ * NOTE: This limits the max parameter size to 16kB -1 !
+ */
+
+/*
+ * The following is for compatibility across the various Linux
+ * platforms. The i386 ioctl numbering scheme doesn't really enforce
+ * a type field. De facto, however, the top 8 bits of the lower 16
+ * bits are indeed used as a type field, so we might just as well make
+ * this explicit here. Please be sure to use the decoding macros
+ * below from now on.
+ */
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits.
+ */
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode ioctl numbers.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+/* 0x54 is just a magic number to make these relatively unique ('T') */
+
+#define TCGETS 0x5401
+#define TCSETS 0x5402
+#define TCSETSW 0x5403
+#define TCSETSF 0x5404
+#define TCGETA 0x5405
+#define TCSETA 0x5406
+#define TCSETAW 0x5407
+#define TCSETAF 0x5408
+#define TCSBRK 0x5409
+#define TCXONC 0x540A
+#define TCFLSH 0x540B
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+#define TIOCGPGRP 0x540F
+#define TIOCSPGRP 0x5410
+#define TIOCOUTQ 0x5411
+#define TIOCSTI 0x5412
+#define TIOCGWINSZ 0x5413
+#define TIOCSWINSZ 0x5414
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define FIONREAD 0x541B
+#define TIOCINQ FIONREAD
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+#define FIONBIO 0x5421
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
+#define TIOCSBRK 0x5427 /* BSD compatibility */
+#define TIOCCBRK 0x5428 /* BSD compatibility */
+#define TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
+#define FIOCLEX 0x5451
+#define FIOASYNC 0x5452
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
+#define TIOCSERGETLSR 0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
+#define FIOQSIZE 0x545E
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+
+/* Socket-level I/O control calls. */
+#define FIOSETOWN 0x8901
+#define SIOCSPGRP 0x8902
+#define FIOGETOWN 0x8903
+#define SIOCGPGRP 0x8904
+#define SIOCATMARK 0x8905
+#define SIOCGSTAMP 0x8906 /* Get stamp */
diff --git a/mdk-stage1/dietlibc/include/sys/cdefs.h b/mdk-stage1/dietlibc/include/sys/cdefs.h
index 895bb74b8..45d3e50d6 100644
--- a/mdk-stage1/dietlibc/include/sys/cdefs.h
+++ b/mdk-stage1/dietlibc/include/sys/cdefs.h
@@ -1,10 +1,7 @@
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H
-#define __dietlibc__
-
#ifndef __cplusplus
-#define throw ()
#define __THROW
#define __BEGIN_DECLS
#define __END_DECLS
@@ -16,21 +13,43 @@
#ifndef __GNUC__
#define __attribute__(xyz)
+#define __extension__
#endif
-#define __pure__
-#ifdef __GNUC__
#if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96))
-#undef __pure__
#define __pure__ __attribute__ ((__pure__))
+#else
+#define __pure__
#endif
#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
#define __restrict__
#endif
+#ifndef __STRICT_ANSI__
+#if __GNUC__ < 3
+#define __builtin_expect(foo,bar) (foo)
+#define expect(foo,bar) (foo)
+#else
+#define expect(foo,bar) __builtin_expect(foo,bar)
+#define __attribute_malloc__ __attribute__((malloc))
+#endif
+#endif
+
+#ifndef __attribute_malloc__
+#define __attribute_malloc__
#endif
#define __P(x) x
+#define __ptr_t void*
+
+#ifdef __STRICT_ANSI__
+#define inline
+#endif
+
+#ifndef __i386__
+#define regparm(x)
+#endif
+
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/epoll.h b/mdk-stage1/dietlibc/include/sys/epoll.h
new file mode 100644
index 000000000..d65d5465f
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/epoll.h
@@ -0,0 +1,60 @@
+#ifndef _SYS_EPOLL_H
+#define _SYS_EPOLL_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/poll.h>
+
+/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl() */
+#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface */
+#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface */
+#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure */
+
+enum EPOLL_EVENTS {
+ EPOLLIN = 0x001,
+#define EPOLLIN EPOLLIN
+ EPOLLPRI = 0x002,
+#define EPOLLPRI EPOLLPRI
+ EPOLLOUT = 0x004,
+#define EPOLLOUT EPOLLOUT
+
+#ifdef __USE_XOPEN
+ EPOLLRDNORM = 0x040,
+#define EPOLLRDNORM EPOLLRDNORM
+ EPOLLRDBAND = 0x080,
+#define EPOLLRDBAND EPOLLRDBAND
+ EPOLLWRNORM = 0x100,
+#define EPOLLWRNORM EPOLLWRNORM
+ EPOLLWRBAND = 0x200,
+#define EPOLLWRBAND EPOLLWRBAND
+#endif /* #ifdef __USE_XOPEN */
+
+#ifdef __USE_GNU
+ EPOLLMSG = 0x400,
+#define EPOLLMSG EPOLLMSG
+#endif /* #ifdef __USE_GNU */
+
+ EPOLLERR = 0x008,
+#define EPOLLERR EPOLLERR
+ EPOLLHUP = 0x010
+#define EPOLLHUP EPOLLHUP
+};
+
+typedef union epoll_data {
+ void *ptr;
+ int fd;
+ uint32_t u32;
+ uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event {
+ uint32_t events;
+ epoll_data_t data;
+};
+
+int epoll_create(int size) __THROW;
+int epoll_ctl(int epfd, int op, int fd, struct epoll_event* event) __THROW;
+int epoll_wait(int epfd, struct epoll_event *events, int maxevents,
+ int timeout) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/file.h b/mdk-stage1/dietlibc/include/sys/file.h
index 93787fd42..cf2c74305 100644
--- a/mdk-stage1/dietlibc/include/sys/file.h
+++ b/mdk-stage1/dietlibc/include/sys/file.h
@@ -2,18 +2,9 @@
#define _SYS_FILE_H
#include <sys/cdefs.h>
+#include <fcntl.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/fsuid.h b/mdk-stage1/dietlibc/include/sys/fsuid.h
new file mode 100644
index 000000000..538070451
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/fsuid.h
@@ -0,0 +1,12 @@
+#ifndef __FSUID_H
+#define __FSUID_H 1
+
+#include <sys/types.h>
+
+/* Linux only: */
+int setfsuid(uid_t uid);
+int setfsgid(gid_t gid);
+int setfsuid32(uid32_t fsuid) __THROW;
+int setfsgid32(gid32_t fsgid) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/gmon.h b/mdk-stage1/dietlibc/include/sys/gmon.h
new file mode 100644
index 000000000..50aae3028
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/gmon.h
@@ -0,0 +1,99 @@
+#ifndef __DLC_GMON_H_
+#define __DLC_GMON_H_
+
+# define HISTCOUNTER unsigned short
+# define HISTFRACTION 2
+# define HASHFRACTION 2
+# define ARCDENSITY 2
+# define MINARCS 50
+# define MAXARCS (( 1 << (8 * sizeof(HISTCOUNTER))) - 2)
+
+# define ROUNDDOWN(x,y) (((x)/(y))*y)
+# define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*y)
+
+# define PROF_SECTION __attribute__ ((section (".profile")))
+
+struct tostruct {
+ unsigned long selfpc;
+ signed long count;
+ unsigned short link;
+ unsigned short pad;
+};
+
+struct rawarc {
+ unsigned long raw_frompc;
+ unsigned long raw_selfpc;
+ signed long raw_count;
+};
+
+struct monparam {
+ unsigned short *kcount;
+ unsigned long kcountsize;
+ struct rawarc *arcs;
+ unsigned long arcnum;
+ unsigned long lowpc;
+ unsigned long highpc;
+ unsigned long textsize;
+};
+
+struct gmonparam {
+ long state;
+ unsigned short *kcount;
+ unsigned long kcountsize;
+ unsigned short *froms;
+ unsigned long fromsize;
+ struct tostruct *tos;
+ unsigned long tossize;
+ long tolimit;
+ unsigned long lowpc;
+ unsigned long highpc;
+ unsigned long textsize;
+ unsigned long hashfraction;
+ unsigned long log_hashfraction;
+};
+
+struct gmon_hdr {
+ char cookie[4];
+ long version;
+ char spare[12];
+};
+
+struct gmon_hist_hdr {
+ long low_pc;
+ long high_pc;
+ long hist_size;
+ long prof_rate;
+ char dimen[15];
+ char dimen_abbrev;
+};
+
+struct gmon_cg_arc_record {
+ long from_pc;
+ long self_pc;
+ long count;
+};
+
+struct __bb {
+ long zero_word;
+ char *filename;
+ long *counts;
+ long ncounts;
+ struct __bb *next;
+ unsigned long *addresses;
+};
+
+typedef enum {
+ GMON_TAG_TIME_HIST, GMON_TAG_CG_ARC, GMON_TAG_BB_COUNT
+} GMON_Record_Tag;
+
+enum { GMON_PROF_ON, GMON_PROF_BUSY, GMON_PROF_ERROR, GMON_PROF_OFF };
+enum { GPROF_STATE, GPROF_COUNT, GPROF_FROMS, GPROF_TOS, GPROF_GMONPARAM };
+
+extern struct gmonparam gmparam;
+extern struct __bb * __bb_head;
+
+extern void __monstartup(unsigned long, unsigned long);
+extern void monstartup(unsigned long, unsigned long);
+extern void _mcleanup(void);
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/gmon_out.h b/mdk-stage1/dietlibc/include/sys/gmon_out.h
new file mode 100644
index 000000000..31566b999
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/gmon_out.h
@@ -0,0 +1 @@
+#include <sys/gmon.h>
diff --git a/mdk-stage1/dietlibc/include/sys/hppa-ioctl.h b/mdk-stage1/dietlibc/include/sys/hppa-ioctl.h
new file mode 100644
index 000000000..62b6f1cf9
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/hppa-ioctl.h
@@ -0,0 +1,133 @@
+#ifndef __ARCH_PARISC_IOCTLS_H__
+#define __ARCH_PARISC_IOCTLS_H__
+
+#ifndef _ASM_PARISC_IOCTL_H
+#define _ASM_PARISC_IOCTL_H
+
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits.
+ */
+#define _IOC_NONE 0U
+#define _IOC_WRITE 2U
+#define _IOC_READ 1U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode ioctl numbers.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+#endif /* _ASM_PARISC_IOCTL_H */
+/* 0x54 is just a magic number to make these relatively unique ('T') */
+
+#define TCGETS _IOR('T', 16, struct termios) /* TCGETATTR */
+#define TCSETS _IOW('T', 17, struct termios) /* TCSETATTR */
+#define TCSETSW _IOW('T', 18, struct termios) /* TCSETATTRD */
+#define TCSETSF _IOW('T', 19, struct termios) /* TCSETATTRF */
+#define TCGETA _IOR('T', 1, struct termio)
+#define TCSETA _IOW('T', 2, struct termio)
+#define TCSETAW _IOW('T', 3, struct termio)
+#define TCSETAF _IOW('T', 4, struct termio)
+#define TCSBRK _IO('T', 5)
+#define TCXONC _IO('T', 6)
+#define TCFLSH _IO('T', 7)
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+#define TIOCGPGRP _IOR('T', 30, int)
+#define TIOCSPGRP _IOW('T', 29, int)
+#define TIOCOUTQ 0x5411
+#define TIOCSTI 0x5412
+#define TIOCGWINSZ 0x5413
+#define TIOCSWINSZ 0x5414
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define FIONREAD 0x541B
+#define TIOCINQ FIONREAD
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+#define FIONBIO 0x5421
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
+#define TIOCSBRK 0x5427 /* BSD compatibility */
+#define TIOCCBRK 0x5428 /* BSD compatibility */
+#define TIOCGSID _IOR('T', 20, int) /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
+#define FIOCLEX 0x5451
+#define FIOASYNC 0x5452
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
+#define TIOCSERGETLSR 0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
+#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
+#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
+#define FIOQSIZE 0x5460 /* Get exact space used by quota */
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+
+#endif /* _ASM_PARISC_IOCTLS_H */
diff --git a/mdk-stage1/dietlibc/include/sys/i386-ioctl.h b/mdk-stage1/dietlibc/include/sys/i386-ioctl.h
new file mode 100644
index 000000000..c9aa270d6
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/i386-ioctl.h
@@ -0,0 +1,141 @@
+
+/*
+ * The following is for compatibility across the various Linux
+ * platforms. The i386 ioctl numbering scheme doesn't really enforce
+ * a type field. De facto, however, the top 8 bits of the lower 16
+ * bits are indeed used as a type field, so we might just as well make
+ * this explicit here. Please be sure to use the decoding macros
+ * below from now on.
+ */
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits.
+ */
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode ioctl numbers.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+/* 0x54 is just a magic number to make these relatively unique ('T') */
+
+#define TCGETS 0x5401
+#define TCSETS 0x5402
+#define TCSETSW 0x5403
+#define TCSETSF 0x5404
+#define TCGETA 0x5405
+#define TCSETA 0x5406
+#define TCSETAW 0x5407
+#define TCSETAF 0x5408
+#define TCSBRK 0x5409
+#define TCXONC 0x540A
+#define TCFLSH 0x540B
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+#define TIOCGPGRP 0x540F
+#define TIOCSPGRP 0x5410
+#define TIOCOUTQ 0x5411
+#define TIOCSTI 0x5412
+#define TIOCGWINSZ 0x5413
+#define TIOCSWINSZ 0x5414
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define FIONREAD 0x541B
+#define TIOCINQ FIONREAD
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+#define FIONBIO 0x5421
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
+#define TIOCSBRK 0x5427 /* BSD compatibility */
+#define TIOCCBRK 0x5428 /* BSD compatibility */
+#define TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
+#define FIOCLEX 0x5451
+#define FIOASYNC 0x5452
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
+#define TIOCSERGETLSR 0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
+#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
+#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
+#define FIOQSIZE 0x5460
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+
+/* Socket-level I/O control calls. */
+#define FIOSETOWN 0x8901
+#define SIOCSPGRP 0x8902
+#define FIOGETOWN 0x8903
+#define SIOCGPGRP 0x8904
+#define SIOCATMARK 0x8905
+#define SIOCGSTAMP 0x8906 /* Get stamp */
diff --git a/mdk-stage1/dietlibc/include/sys/io.h b/mdk-stage1/dietlibc/include/sys/io.h
index cce841735..5edf33a57 100644
--- a/mdk-stage1/dietlibc/include/sys/io.h
+++ b/mdk-stage1/dietlibc/include/sys/io.h
@@ -1,41 +1,44 @@
-#ifndef _IO_H
-#define _IO_H
+#ifndef _SYS_IO_H
+#define _SYS_IO_H
-int ioperm(unsigned long from, unsigned long num, int turn_on) __THROW;
+#include <sys/cdefs.h>
-#ifdef __i386__
-
-static __inline void
-outb (unsigned char value, unsigned short int port)
-{
- __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port));
-}
+extern int ioperm(unsigned long from, unsigned long num, int turn_on) __THROW;
+extern int iopl(int level) __THROW;
-static __inline unsigned char
-inb (unsigned short int port)
-{
+#ifndef __STRICT_ANSI__
+/* anyone have a cleaner solution for this mess? */
+#ifdef __i386__
+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)
-{
+static inline unsigned short 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));
+static inline unsigned int inl (unsigned short int port) {
+ unsigned int _v;
+ __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (port));
+ return _v;
+}
+
+static inline void outb (unsigned char value, unsigned short int port) {
+ __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port));
+}
+static inline void outw (unsigned short value, unsigned short int port) {
+ __asm__ __volatile__ ("outw %w0,%w1": :"a" (value), "Nd" (port));
}
+static inline void outl (unsigned int value, unsigned short int port) {
+ __asm__ __volatile__ ("outl %0,%w1": :"a" (value), "Nd" (port));
+}
+#endif
#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/ioctl.h b/mdk-stage1/dietlibc/include/sys/ioctl.h
index fca1aeeab..a7890f038 100644
--- a/mdk-stage1/dietlibc/include/sys/ioctl.h
+++ b/mdk-stage1/dietlibc/include/sys/ioctl.h
@@ -2,8 +2,30 @@
#define _IOCTL_H
#include <sys/cdefs.h>
-#include <linux/ioctl.h>
-#include <asm/ioctls.h>
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
+#include <sys/i386-ioctl.h>
+#elif defined(__alpha__)
+#include <sys/alpha-ioctl.h>
+#elif defined(__arm__)
+#include <sys/arm-ioctl.h>
+#elif defined(__sparc__)
+#include <sys/sparc-ioctl.h>
+#elif defined(__mips__)
+#include <sys/mips-ioctl.h>
+#elif defined(__powerpc__)
+#include <sys/ppc-ioctl.h>
+#elif defined(__s390__)
+#include <sys/s390-ioctl.h>
+#elif defined(__hppa__)
+#include <sys/hppa-ioctl.h>
+#endif
+
+/* used for /dev/epoll */
+#define EP_ALLOC _IOR('P', 1, int)
+#define EP_POLL _IOWR('P', 2, struct evpoll)
+#define EP_FREE _IO('P', 3)
+#define EP_ISPOLLED _IOWR('P', 4, struct pollfd)
int ioctl(int d, int request, ...) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sys/ipc.h b/mdk-stage1/dietlibc/include/sys/ipc.h
index 9184a2a82..481d97b62 100644
--- a/mdk-stage1/dietlibc/include/sys/ipc.h
+++ b/mdk-stage1/dietlibc/include/sys/ipc.h
@@ -2,7 +2,48 @@
#define _SYS_IPC_H
#include <sys/cdefs.h>
-#include <linux/ipc.h>
-#include <asm/page.h>
+#include <sys/types.h>
+
+#define SEMOP 1
+#define SEMGET 2
+#define SEMCTL 3
+#define MSGSND 11
+#define MSGRCV 12
+#define MSGGET 13
+#define MSGCTL 14
+#define SHMAT 21
+#define SHMDT 22
+#define SHMGET 23
+#define SHMCTL 24
+
+#define IPC_PRIVATE ((key_t) 0)
+
+#define IPC_CREAT 00001000 /* create if key is nonexistent */
+#define IPC_EXCL 00002000 /* fail if key exists */
+#define IPC_NOWAIT 00004000 /* return error on wait */
+
+#define IPC_RMID 0 /* remove resource */
+#define IPC_SET 1 /* set ipc_perm options */
+#define IPC_STAT 2 /* get ipc_perm options */
+#define IPC_INFO 3 /* see ipcs */
+
+/*
+ * Version flags for semctl, msgctl, and shmctl commands
+ * These are passed as bitflags or-ed with the actual command
+ */
+#define IPC_OLD 0 /* Old version (no 32-bit UID support on many
+ architectures) */
+#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
+ message sizes, etc. */
+
+struct ipc_perm {
+ key_t key;
+ uid_t uid;
+ gid_t gid;
+ uid_t cuid;
+ gid_t cgid;
+ mode_t mode;
+ unsigned short seq;
+};
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/kd.h b/mdk-stage1/dietlibc/include/sys/kd.h
index 9e9a5152b..98b337ede 100644
--- a/mdk-stage1/dietlibc/include/sys/kd.h
+++ b/mdk-stage1/dietlibc/include/sys/kd.h
@@ -1,6 +1,183 @@
#ifndef _SYS_KD_H
#define _SYS_KD_H
-#include <linux/kd.h>
+/* 0x4B is 'K', to avoid collision with termios and vt */
+
+#define GIO_FONT 0x4B60 /* gets font in expanded form */
+#define PIO_FONT 0x4B61 /* use font in expanded form */
+
+#define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */
+#define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */
+
+struct consolefontdesc {
+ unsigned short charcount; /* characters in font (256 or 512) */
+ unsigned short charheight; /* scan lines per character (1-32) */
+ char *chardata; /* font data in expanded form */
+};
+
+#define PIO_FONTRESET 0x4B6D /* reset to default font */
+
+#define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */
+#define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */
+
+#define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
+#define KDMKTONE 0x4B30 /* generate tone */
+
+#define KDGETLED 0x4B31 /* return current led state */
+#define KDSETLED 0x4B32 /* set led state [lights, not flags] */
+#define LED_SCR 0x01 /* scroll lock led */
+#define LED_CAP 0x04 /* caps lock led */
+#define LED_NUM 0x02 /* num lock led */
+
+#define KDGKBTYPE 0x4B33 /* get keyboard type */
+#define KB_84 0x01
+#define KB_101 0x02 /* this is what we always answer */
+#define KB_OTHER 0x03
+
+#define KDADDIO 0x4B34 /* add i/o port as valid */
+#define KDDELIO 0x4B35 /* del i/o port as valid */
+#define KDENABIO 0x4B36 /* enable i/o to video board */
+#define KDDISABIO 0x4B37 /* disable i/o to video board */
+
+#define KDSETMODE 0x4B3A /* set text/graphics mode */
+#define KD_TEXT 0x00
+#define KD_GRAPHICS 0x01
+#define KD_TEXT0 0x02 /* obsolete */
+#define KD_TEXT1 0x03 /* obsolete */
+#define KDGETMODE 0x4B3B /* get current mode */
+
+#define KDMAPDISP 0x4B3C /* map display into address space */
+#define KDUNMAPDISP 0x4B3D /* unmap display from address space */
+
+typedef char scrnmap_t;
+
+#define E_TABSZ 256
+#define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */
+#define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */
+#define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */
+#define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */
+
+#define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */
+
+struct unipair {
+ unsigned short unicode;
+ unsigned short fontpos;
+};
+
+struct unimapdesc {
+ unsigned short entry_ct;
+ struct unipair *entries;
+};
+
+#define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */
+#define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */
+
+struct unimapinit {
+ unsigned short advised_hashsize; /* 0 if no opinion */
+ unsigned short advised_hashstep; /* 0 if no opinion */
+ unsigned short advised_hashlevel; /* 0 if no opinion */
+};
+
+#define UNI_DIRECT_BASE 0xF000 /* start of Direct Font Region */
+#define UNI_DIRECT_MASK 0x01FF /* Direct Font Region bitmask */
+
+#define K_RAW 0x00
+#define K_XLATE 0x01
+#define K_MEDIUMRAW 0x02
+#define K_UNICODE 0x03
+#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
+#define KDSKBMODE 0x4B45 /* sets current keyboard mode */
+
+#define K_METABIT 0x03
+#define K_ESCPREFIX 0x04
+#define KDGKBMETA 0x4B62 /* gets meta key handling mode */
+#define KDSKBMETA 0x4B63 /* sets meta key handling mode */
+
+#define K_SCROLLLOCK 0x01
+#define K_CAPSLOCK 0x02
+#define K_NUMLOCK 0x04
+#define KDGKBLED 0x4B64 /* get led flags (not lights) */
+#define KDSKBLED 0x4B65 /* set led flags (not lights) */
+
+struct kbentry {
+ unsigned char kb_table;
+ unsigned char kb_index;
+ unsigned short kb_value;
+};
+
+#define K_NORMTAB 0x00
+#define K_SHIFTTAB 0x01
+#define K_ALTTAB 0x02
+#define K_ALTSHIFTTAB 0x03
+
+#define KDGKBENT 0x4B46 /* gets one entry in translation table */
+#define KDSKBENT 0x4B47 /* sets one entry in translation table */
+
+struct kbsentry {
+ unsigned char kb_func;
+ unsigned char kb_string[512];
+};
+
+#define KDGKBSENT 0x4B48 /* gets one function key string entry */
+#define KDSKBSENT 0x4B49 /* sets one function key string entry */
+
+struct kbdiacr {
+ unsigned char diacr, base, result;
+};
+
+struct kbdiacrs {
+ unsigned int kb_cnt; /* number of entries in following array */
+ struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */
+};
+
+#define KDGKBDIACR 0x4B4A /* read kernel accent table */
+#define KDSKBDIACR 0x4B4B /* write kernel accent table */
+
+struct kbkeycode {
+ unsigned int scancode, keycode;
+};
+
+#define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */
+#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */
+
+#define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */
+
+struct hwclk_time {
+ unsigned int sec; /* 0..59 */
+ unsigned int min; /* 0..59 */
+ unsigned int hour; /* 0..23 */
+ unsigned int day; /* 1..31 */
+ unsigned int mon; /* 0..11 */
+ unsigned int year; /* 70... */
+ int wday; /* 0..6, 0 is Sunday, -1 means unknown/don't set */
+};
+
+#define KDGHWCLK 0x4B50 /* get hardware clock */
+#define KDSHWCLK 0x4B51 /* set hardware clock */
+
+struct kbd_repeat {
+ int delay; /* in msec; <= 0: don't change */
+ int rate; /* in msec; <= 0: don't change */
+};
+
+#define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate;
+ * actually used values are returned */
+
+#define KDFONTOP 0x4B72 /* font operations */
+
+struct console_font_op {
+ unsigned int op; /* operation code KD_FONT_OP_* */
+ unsigned int flags; /* KD_FONT_FLAG_* */
+ unsigned int width, height; /* font size */
+ unsigned int charcount;
+ unsigned char *data; /* font data with height fixed to 32 */
+};
+
+#define KD_FONT_OP_SET 0 /* Set font */
+#define KD_FONT_OP_GET 1 /* Get font */
+#define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */
+#define KD_FONT_OP_COPY 3 /* Copy from another console */
+
+#define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size [compat] */
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/klog.h b/mdk-stage1/dietlibc/include/sys/klog.h
new file mode 100644
index 000000000..abacfef9c
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/klog.h
@@ -0,0 +1,8 @@
+#ifndef _SYS_KLOG_H
+#define _SYS_KLOG_H
+
+#include <sys/cdefs.h>
+
+extern int klogctl (int __type, char *__bufp, int __len) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/mips-ioctl.h b/mdk-stage1/dietlibc/include/sys/mips-ioctl.h
new file mode 100644
index 000000000..889ac83ae
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/mips-ioctl.h
@@ -0,0 +1,177 @@
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 13
+#define _IOC_DIRBITS 3
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * We to additionally limit parameters to a maximum 255 bytes.
+ */
+#define _IOC_SLMASK 0xff
+
+/*
+ * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
+ * And this turns out useful to catch old ioctl numbers in header
+ * files for us.
+ */
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+#define _IOC_WRITE 4U
+
+/*
+ * The following are included for compatibility
+ */
+#define _IOC_VOID 0x20000000
+#define _IOC_OUT 0x40000000
+#define _IOC_IN 0x80000000
+#define _IOC_INOUT (IOC_IN|IOC_OUT)
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ (((size) & _IOC_SLMASK) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode them.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+#if defined(__USE_MISC) || defined (__KERNEL__)
+#define tIOC ('t' << 8)
+#endif
+
+#define TCGETA 0x5401
+#define TCSETA 0x5402
+#define TCSETAW 0x5403
+#define TCSETAF 0x5404
+
+#define TCSBRK 0x5405
+#define TCXONC 0x5406
+#define TCFLSH 0x5407
+
+#define TCGETS 0x540d
+#define TCSETS 0x540e
+#define TCSETSW 0x540f
+#define TCSETSF 0x5410
+
+#define TIOCEXCL 0x740d /* set exclusive use of tty */
+#define TIOCNXCL 0x740e /* reset exclusive use of tty */
+#define TIOCOUTQ 0x7472 /* output queue size */
+#define TIOCSTI 0x5472 /* simulate terminal input */
+#define TIOCMGET 0x741d /* get all modem bits */
+#define TIOCMBIS 0x741b /* bis modem bits */
+#define TIOCMBIC 0x741c /* bic modem bits */
+#define TIOCMSET 0x741a /* set all modem bits */
+#define TIOCPKT 0x5470 /* pty: set/clear packet mode */
+#define TIOCPKT_DATA 0x00 /* data packet */
+#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
+#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
+#define TIOCPKT_STOP 0x04 /* stop output */
+#define TIOCPKT_START 0x08 /* start output */
+#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
+#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
+#if 0
+#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
+#endif
+#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
+#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
+#define TIOCNOTTY 0x5471 /* void tty association */
+#define TIOCSETD (tIOC | 1)
+#define TIOCGETD (tIOC | 0)
+
+#define FIOCLEX 0x6601
+#define FIONCLEX 0x6602 /* these numbers need to be adjusted. */
+#define FIOASYNC 0x667d
+#define FIONBIO 0x667e
+#define FIOQSIZE 0x667f
+
+#if defined(__USE_MISC) || defined (__KERNEL__)
+#define TIOCGLTC (tIOC | 116) /* get special local chars */
+#define TIOCSLTC (tIOC | 117) /* set special local chars */
+#endif
+#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
+#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
+#define TIOCCONS _IOW('t', 120, int) /* become virtual console */
+
+#define FIONREAD 0x467f
+#define TIOCINQ FIONREAD
+
+#if defined(__USE_MISC) || defined (__KERNEL__)
+#define TIOCGETP (tIOC | 8)
+#define TIOCSETP (tIOC | 9)
+#define TIOCSETN (tIOC | 10) /* TIOCSETP wo flush */
+#endif
+
+#if 0
+#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */
+#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */
+#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */
+#define TIOCGETD _IOR('t', 26, int) /* get line discipline */
+#define TIOCSETD _IOW('t', 27, int) /* set line discipline */
+ /* 127-124 compat */
+#endif
+
+/* I hope the range from 0x5480 on is free ... */
+#define TIOCSCTTY 0x5480 /* become controlling tty */
+#define TIOCGSOFTCAR 0x5481
+#define TIOCSSOFTCAR 0x5482
+#define TIOCLINUX 0x5483
+#define TIOCGSERIAL 0x5484
+#define TIOCSSERIAL 0x5485
+
+#define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5487 /* For debugging only */
+#define TIOCSBRK 0x5427 /* BSD compatibility */
+#define TIOCCBRK 0x5428 /* BSD compatibility */
+#define TIOCGSID 0x7416 /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define TIOCSERCONFIG 0x5488
+#define TIOCSERGWILD 0x5489
+#define TIOCSERSWILD 0x548a
+#define TIOCGLCKTRMIOS 0x548b
+#define TIOCSLCKTRMIOS 0x548c
+#define TIOCSERGSTRUCT 0x548d /* For debugging only */
+#define TIOCSERGETLSR 0x548e /* Get line status register */
+#define TIOCSERGETMULTI 0x548f /* Get multiport config */
+#define TIOCSERSETMULTI 0x5490 /* Set multiport config */
+#define TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
+#define TIOCGHAYESESP 0x5493 /* Get Hayes ESP configuration */
+#define TIOCSHAYESESP 0x5494 /* Set Hayes ESP configuration */
+
+/* Socket-level I/O control calls. */
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+
+#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */
diff --git a/mdk-stage1/dietlibc/include/sys/mman.h b/mdk-stage1/dietlibc/include/sys/mman.h
index dc398ba90..298773a92 100644
--- a/mdk-stage1/dietlibc/include/sys/mman.h
+++ b/mdk-stage1/dietlibc/include/sys/mman.h
@@ -3,13 +3,160 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <linux/mman.h>
-#include <asm/page.h>
-#ifndef PAGE_SIZE
-#warning PAGE_SIZE undefined
+#define MREMAP_MAYMOVE 1UL
+#define MREMAP_FIXED 2UL
+
+#define PROT_READ 0x1 /* page can be read */
+#define PROT_WRITE 0x2 /* page can be written */
+#define PROT_EXEC 0x4 /* page can be executed */
+#define PROT_NONE 0x0 /* page can not be accessed */
+
+#define MAP_SHARED 0x01 /* Share changes */
+#define MAP_PRIVATE 0x02 /* Changes are private */
+
+#ifdef __mips__
+#define MAP_FIXED 0x010 /* Interpret addr exactly */
+#define MAP_NORESERVE 0x0400 /* don't check for reservations */
+#define MAP_ANONYMOUS 0x0800 /* don't use a file */
+#define MAP_GROWSDOWN 0x1000 /* stack-like segment */
+#define MAP_DENYWRITE 0x2000 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
+#define MAP_LOCKED 0x8000 /* pages are locked */
+#define MS_ASYNC 0x0001 /* sync memory asynchronously */
+#define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */
+#define MS_SYNC 0x0004 /* synchronous memory sync */
+#define MCL_CURRENT 1 /* lock all current mappings */
+#define MCL_FUTURE 2 /* lock all future mappings */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+#else
+
+#ifdef __alpha__
+#define MAP_FIXED 0x100 /* Interpret addr exactly */
+#define MAP_ANONYMOUS 0x10 /* don't use a file */
+#define MAP_GROWSDOWN 0x1000 /* stack-like segment */
+#define MAP_DENYWRITE 0x2000 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
+#define MAP_LOCKED 0x8000 /* lock the mapping */
+#define MAP_NORESERVE 0x10000 /* don't check for reservations */
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_SYNC 2 /* synchronous memory sync */
+#define MS_INVALIDATE 4 /* invalidate the caches */
+#define MCL_CURRENT 8192 /* lock all currently mapped pages */
+#define MCL_FUTURE 16384 /* lock all additions to address space */
+#define MADV_NORMAL 0 /* no further special treatment */
+#define MADV_RANDOM 1 /* expect random page references */
+#define MADV_SEQUENTIAL 2 /* expect sequential page references */
+#define MADV_WILLNEED 3 /* will need these pages */
+#define MADV_SPACEAVAIL 5 /* ensure resources are available */
+#define MADV_DONTNEED 6 /* dont need these pages */
+#else
+#define MAP_FIXED 0x10 /* Interpret addr exactly */
+#define MAP_ANONYMOUS 0x20 /* don't use a file */
#endif
+#if defined(__i386__) || defined(__s390__) || defined(__x86_64__)
+#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MAP_LOCKED 0x2000 /* pages are locked */
+#define MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+#define MCL_CURRENT 1 /* lock all current mappings */
+#define MCL_FUTURE 2 /* lock all future mappings */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+#elif defined(__sparc__) || defined (__powerpc__)
+#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
+#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
+#define MAP_INHERIT 0x80 /* SunOS doesn't do this, but... */
+#define MAP_LOCKED 0x100 /* lock the mapping */
+#define _MAP_NEW 0x80000000 /* Binary compatibility is fun... */
+#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
+#define MCL_FUTURE 0x4000 /* lock all additions to address space */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
+#elif defined (__arm__)
+#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MAP_LOCKED 0x2000 /* pages are locked */
+#define MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+#define MCL_CURRENT 1 /* lock all current mappings */
+#define MCL_FUTURE 2 /* lock all future mappings */
+#define MADV_NORMAL 0x0 /* default page-in behavior */
+#define MADV_RANDOM 0x1 /* page-in minimum required */
+#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
+#define MADV_WILLNEED 0x3 /* pre-fault pages */
+#define MADV_DONTNEED 0x4 /* discard these pages */
+
+#elif defined(__hppa__)
+#define MAP_TYPE 0x03 /* Mask for type of mapping */
+#define MAP_FIXED 0x04 /* Interpret addr exactly */
+#define MAP_ANONYMOUS 0x10 /* don't use a file */
+
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MAP_LOCKED 0x2000 /* pages are locked */
+#define MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define MAP_GROWSDOWN 0x8000 /* stack-like segment */
+
+#define MS_SYNC 1 /* synchronous memory sync */
+#define MS_ASYNC 2 /* sync memory asynchronously */
+#define MS_INVALIDATE 4 /* invalidate the caches */
+
+#define MCL_CURRENT 1 /* lock all current mappings */
+#define MCL_FUTURE 2
+
+#elif defined(__ia64__)
+
+#define MAP_TYPE 0x0f /* Mask for type of mapping */
+#define MAP_FIXED 0x10 /* Interpret addr exactly */
+#define MAP_ANONYMOUS 0x20 /* don't use a file */
+
+#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
+#define MAP_GROWSUP 0x0200 /* register stack-like segment */
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MAP_LOCKED 0x2000 /* pages are locked */
+#define MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define MAP_WRITECOMBINED 0x10000 /* write-combine the area */
+#define MAP_NONCACHED 0x20000 /* don't cache the memory */
+
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+
+#endif
+
+#endif
+
+/* compatibility flags */
+#define MAP_ANON MAP_ANONYMOUS
+#define MAP_FILE 0
+
#define MAP_FAILED ((void *) -1)
extern void *mmap (void *__addr, size_t __len, int __prot,
@@ -19,15 +166,19 @@ 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;
+ unsigned long __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 mlock(const void *addr, size_t len) __THROW;
+int munlock(const void *addr, size_t len) __THROW;
int munlockall(void) __THROW;
+int madvise(void *start, size_t length, int advice) __THROW;
+
+#define _POSIX_MAPPED_FILES
+
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/mount.h b/mdk-stage1/dietlibc/include/sys/mount.h
index 2e9e86774..a5170fda9 100644
--- a/mdk-stage1/dietlibc/include/sys/mount.h
+++ b/mdk-stage1/dietlibc/include/sys/mount.h
@@ -3,17 +3,78 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <linux/fs.h>
+#define _LINUX_CONFIG_H
+
+#define BLOCK_SIZE 1024
+#define BLOCK_SIZE_BITS 10
+
+
+/* These are the fs-independent mount-flags: up to 16 flags are
+ supported */
+enum
+{
+ MS_RDONLY = 1, /* Mount read-only. */
+#define MS_RDONLY MS_RDONLY
+ MS_NOSUID = 2, /* Ignore suid and sgid bits. */
+#define MS_NOSUID MS_NOSUID
+ MS_NODEV = 4, /* Disallow access to device special files. */
+#define MS_NODEV MS_NODEV
+ MS_NOEXEC = 8, /* Disallow program execution. */
+#define MS_NOEXEC MS_NOEXEC
+ MS_SYNCHRONOUS = 16, /* Writes are synced at once. */
+#define MS_SYNCHRONOUS MS_SYNCHRONOUS
+ MS_REMOUNT = 32, /* Alter flags of a mounted FS. */
+#define MS_REMOUNT MS_REMOUNT
+ MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
+#define MS_MANDLOCK MS_MANDLOCK
+ S_WRITE = 128, /* Write on file/directory/symlink. */
+#define S_WRITE S_WRITE
+ S_APPEND = 256, /* Append-only file. */
+#define S_APPEND S_APPEND
+ S_IMMUTABLE = 512, /* Immutable file. */
+#define S_IMMUTABLE S_IMMUTABLE
+ MS_NOATIME = 1024, /* Do not update access times. */
+#define MS_NOATIME MS_NOATIME
+ MS_NODIRATIME = 2048, /* Do not update directory access times. */
+#define MS_NODIRATIME MS_NODIRATIME
+ MS_BIND = 4096, /* Bind directory at different place. */
+#define MS_BIND MS_BIND
+};
+
+/* Flags that can be altered by MS_REMOUNT */
+#define MS_RMT_MASK (MS_RDONLY | MS_MANDLOCK)
+
+
+/* Magic mount flag number. Has to be or-ed to the flag values. */
+
+#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */
+#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */
+
+
+/* The read-only stuff doesn't really belong here, but any other place
+ is probably as bad and I don't want to create yet another include
+ file. */
+
+#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */
+#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */
+#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */
+#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */
+#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */
+#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */
+#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */
+
+
+/* Possible value for FLAGS parameter of `umount2'. */
+enum
+{
+ MNT_FORCE = 1 /* Force unmounting. */
+#define MNT_FORCE MNT_FORCE
+};
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
index ea1e470b6..564fd9472 100644
--- a/mdk-stage1/dietlibc/include/sys/msg.h
+++ b/mdk-stage1/dietlibc/include/sys/msg.h
@@ -1,9 +1,53 @@
#ifndef _SYS_MSG_H
#define _SYS_MSG_H
-#include <linux/msg.h>
#include <sys/ipc.h>
-#include <asm/page.h>
+
+/* ipcs ctl commands */
+#define MSG_STAT 11
+#define MSG_INFO 12
+
+/* msgrcv options */
+#define MSG_NOERROR 010000 /* no error if message is too big */
+#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
+
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ struct msg *msg_first; /* first message on queue,unused */
+ struct msg *msg_last; /* last message in queue,unused */
+ time_t msg_stime; /* last msgsnd time */
+ time_t msg_rtime; /* last msgrcv time */
+ time_t msg_ctime; /* last change time */
+ unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
+ unsigned long msg_lqbytes; /* ditto */
+ unsigned short msg_cbytes; /* current number of bytes on queue */
+ unsigned short msg_qnum; /* number of messages in queue */
+ unsigned short msg_qbytes; /* max number of bytes on queue */
+ pid_t msg_lspid; /* pid of last msgsnd */
+ pid_t msg_lrpid; /* last receive pid */
+};
+
+/* message buffer for msgsnd and msgrcv calls */
+struct msgbuf {
+ long mtype; /* type of message */
+ char mtext[1]; /* message text */
+};
+
+/* buffer for msgctl calls IPC_INFO, MSG_INFO */
+struct msginfo {
+ int msgpool;
+ int msgmap;
+ int msgmax;
+ int msgmnb;
+ int msgmni;
+ int msgssz;
+ int msgtql;
+ unsigned short msgseg;
+};
+
+#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */
+#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */
+#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
extern int msgctl (int msqid, int cmd, struct msqid_ds *buf) __THROW;
extern int msgget (key_t key, int msgflg) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sys/mtio.h b/mdk-stage1/dietlibc/include/sys/mtio.h
index e70663407..08c735dcc 100644
--- a/mdk-stage1/dietlibc/include/sys/mtio.h
+++ b/mdk-stage1/dietlibc/include/sys/mtio.h
@@ -1,6 +1,340 @@
#ifndef _SYS_MTIO_H
#define _SYS_MTIO_H
-#include <linux/mtio.h>
+#include <sys/ioctl.h>
+
+/* structure for MTIOCTOP - mag tape op command */
+struct mtop {
+ short int mt_op; /* operations defined below */
+ int mt_count; /* how many of them */
+};
+
+/* Magnetic Tape operations [Not all operations supported by all drivers]: */
+#define MTRESET 0 /* +reset drive in case of problems */
+#define MTFSF 1 /* forward space over FileMark,
+ * position at first record of next file
+ */
+#define MTBSF 2 /* backward space FileMark (position before FM) */
+#define MTFSR 3 /* forward space record */
+#define MTBSR 4 /* backward space record */
+#define MTWEOF 5 /* write an end-of-file record (mark) */
+#define MTREW 6 /* rewind */
+#define MTOFFL 7 /* rewind and put the drive offline (eject?) */
+#define MTNOP 8 /* no op, set status only (read with MTIOCGET) */
+#define MTRETEN 9 /* retension tape */
+#define MTBSFM 10 /* +backward space FileMark, position at FM */
+#define MTFSFM 11 /* +forward space FileMark, position at FM */
+#define MTEOM 12 /* goto end of recorded media (for appending files).
+ * MTEOM positions after the last FM, ready for
+ * appending another file.
+ */
+#define MTERASE 13 /* erase tape -- be careful! */
+
+#define MTRAS1 14 /* run self test 1 (nondestructive) */
+#define MTRAS2 15 /* run self test 2 (destructive) */
+#define MTRAS3 16 /* reserved for self test 3 */
+
+#define MTSETBLK 20 /* set block length (SCSI) */
+#define MTSETDENSITY 21 /* set tape density (SCSI) */
+#define MTSEEK 22 /* seek to block (Tandberg, etc.) */
+#define MTTELL 23 /* tell block (Tandberg, etc.) */
+#define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */
+ /* ordinary buffered operation with code 1 */
+#define MTFSS 25 /* space forward over setmarks */
+#define MTBSS 26 /* space backward over setmarks */
+#define MTWSM 27 /* write setmarks */
+
+#define MTLOCK 28 /* lock the drive door */
+#define MTUNLOCK 29 /* unlock the drive door */
+#define MTLOAD 30 /* execute the SCSI load command */
+#define MTUNLOAD 31 /* execute the SCSI unload command */
+#define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */
+#define MTSETPART 33 /* Change the active tape partition */
+#define MTMKPART 34 /* Format the tape with one or two partitions */
+
+/* structure for MTIOCGET - mag tape get status command */
+
+typedef int daddr_t;
+
+struct mtget {
+ long int mt_type; /* type of magtape device */
+ long int mt_resid; /* residual count: (not sure)
+ * number of bytes ignored, or
+ * number of files not skipped, or
+ * number of records not skipped.
+ */
+ /* the following registers are device dependent */
+ long int mt_dsreg; /* status register */
+ long int mt_gstat; /* generic (device independent) status */
+ long int mt_erreg; /* error register */
+ /* The next two fields are not always used */
+ daddr_t mt_fileno; /* number of current file on tape */
+ daddr_t mt_blkno; /* current block number */
+};
+
+/*
+ * Constants for mt_type. Not all of these are supported,
+ * and these are not all of the ones that are supported.
+ */
+#define MT_ISUNKNOWN 0x01
+#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */
+#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */
+#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */
+#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */
+#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */
+#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */
+#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */
+#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */
+#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */
+#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */
+#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */
+#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */
+#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */
+#define MT_ISDDS1 0x51 /* DDS device without partitions */
+#define MT_ISDDS2 0x52 /* DDS device with partitions */
+#define MT_ISONSTREAM_SC 0x61 /* OnStream SCSI tape drives (SC-x0)
+ and SCSI emulated (DI, DP, USB) */
+#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */
+#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */
+
+/* QIC-40/80/3010/3020 ftape supported drives.
+ * 20bit vendor ID + 0x800000 (see ftape-vendors.h)
+ */
+#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */
+#define MT_ISFTAPE_FLAG 0x800000
+
+struct mt_tape_info {
+ long int t_type; /* device type id (mt_type) */
+ char* t_name; /* descriptive name */
+};
+
+#define MT_TAPE_INFO { \
+ {MT_ISUNKNOWN, "Unknown type of tape device"}, \
+ {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \
+ {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \
+ {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \
+ {MT_ISCMSJ500, "CMS Jumbo 500"}, \
+ {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \
+ {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \
+ {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \
+ {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \
+ {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \
+ {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \
+ {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \
+ {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \
+ {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \
+ {MT_ISONSTREAM_SC, "OnStream SC-, DI-, DP-, or USB tape drive"}, \
+ {MT_ISSCSI1, "Generic SCSI-1 tape"}, \
+ {MT_ISSCSI2, "Generic SCSI-2 tape"}, \
+ {0, NULL} \
+}
+
+
+/* structure for MTIOCPOS - mag tape get position command */
+
+struct mtpos {
+ long int mt_blkno; /* current block number */
+};
+
+
+/* structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended
+ * as an interim solution for QIC-02 until DDI is fully implemented.
+ */
+struct mtconfiginfo {
+ long int mt_type; /* drive type */
+ long int ifc_type; /* interface card type */
+ unsigned short int irqnr; /* IRQ number to use */
+ unsigned short int dmanr; /* DMA channel to use */
+ unsigned short int port; /* IO port base address */
+
+ unsigned long int debug; /* debugging flags */
+
+ unsigned int have_dens:1;
+ unsigned int have_bsf:1;
+ unsigned int have_fsr:1;
+ unsigned int have_bsr:1;
+ unsigned int have_eod:1;
+ unsigned int have_seek:1;
+ unsigned int have_tell:1;
+ unsigned int have_ras1:1;
+ unsigned int have_ras2:1;
+ unsigned int have_ras3:1;
+ unsigned int have_qfa:1;
+
+ unsigned int pad1:5;
+ char reserved[10];
+};
+
+/* structure for MTIOCVOLINFO, query information about the volume
+ * currently positioned at (zftape)
+ */
+struct mtvolinfo {
+ unsigned int mt_volno; /* vol-number */
+ unsigned int mt_blksz; /* blocksize used when recording */
+ unsigned int mt_rawsize; /* raw tape space consumed, in kb */
+ unsigned int mt_size; /* volume size after decompression, in kb */
+ unsigned int mt_cmpr:1; /* this volume has been compressed */
+};
+
+/* raw access to a floppy drive, read and write an arbitrary segment.
+ * For ftape/zftape to support formatting etc.
+ */
+#define MT_FT_RD_SINGLE 0
+#define MT_FT_RD_AHEAD 1
+#define MT_FT_WR_ASYNC 0 /* start tape only when all buffers are full */
+#define MT_FT_WR_MULTI 1 /* start tape, continue until buffers are empty */
+#define MT_FT_WR_SINGLE 2 /* write a single segment and stop afterwards */
+#define MT_FT_WR_DELETE 3 /* write deleted data marks, one segment at time */
+
+struct mtftseg {
+ unsigned int mt_segno; /* the segment to read or write */
+ unsigned int mt_mode; /* modes for read/write (sync/async etc.) */
+ int mt_result; /* result of r/w request, not of the ioctl */
+ void *mt_data; /* User space buffer: must be 29kb */
+};
+
+/* get tape capacity (ftape/zftape)
+ */
+struct mttapesize {
+ unsigned long mt_capacity; /* entire, uncompressed capacity of a cartridge */
+ unsigned long mt_used; /* what has been used so far, raw uncompressed amount */
+};
+
+/* possible values of the ftfmt_op field
+ */
+#define FTFMT_SET_PARMS 1 /* set software parms */
+#define FTFMT_GET_PARMS 2 /* get software parms */
+#define FTFMT_FORMAT_TRACK 3 /* start formatting a tape track */
+#define FTFMT_STATUS 4 /* monitor formatting a tape track */
+#define FTFMT_VERIFY 5 /* verify the given segment */
+
+struct ftfmtparms {
+ unsigned char ft_qicstd; /* QIC-40/QIC-80/QIC-3010/QIC-3020 */
+ unsigned char ft_fmtcode; /* Refer to the QIC specs */
+ unsigned char ft_fhm; /* floppy head max */
+ unsigned char ft_ftm; /* floppy track max */
+ unsigned short ft_spt; /* segments per track */
+ unsigned short ft_tpc; /* tracks per cartridge */
+};
+
+struct ftfmttrack {
+ unsigned int ft_track; /* track to format */
+ unsigned char ft_gap3; /* size of gap3, for FORMAT_TRK */
+};
+
+struct ftfmtstatus {
+ unsigned int ft_segment; /* segment currently being formatted */
+};
+
+struct ftfmtverify {
+ unsigned int ft_segment; /* segment to verify */
+ unsigned long ft_bsm; /* bsm as result of VERIFY cmd */
+};
+
+struct mtftformat {
+ unsigned int fmt_op; /* operation to perform */
+ union fmt_arg {
+ struct ftfmtparms fmt_parms; /* format parameters */
+ struct ftfmttrack fmt_track; /* ctrl while formatting */
+ struct ftfmtstatus fmt_status;
+ struct ftfmtverify fmt_verify; /* for verifying */
+ } fmt_arg;
+};
+
+/* mag tape io control commands */
+#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
+#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
+#define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */
+
+/* The next two are used by the QIC-02 driver for runtime reconfiguration.
+ * See tpqic02.h for struct mtconfiginfo.
+ */
+#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* get tape config */
+#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* set tape config */
+
+/* the next six are used by the floppy ftape drivers and its frontends
+ * sorry, but MTIOCTOP commands are write only.
+ */
+#define MTIOCRDFTSEG _IOWR('m', 6, struct mtftseg) /* read a segment */
+#define MTIOCWRFTSEG _IOWR('m', 7, struct mtftseg) /* write a segment */
+#define MTIOCVOLINFO _IOR('m', 8, struct mtvolinfo) /* info about volume */
+#define MTIOCGETSIZE _IOR('m', 9, struct mttapesize)/* get cartridge size*/
+#define MTIOCFTFORMAT _IOWR('m', 10, struct mtftformat) /* format ftape */
+#define MTIOCFTCMD _IOWR('m', 11, struct mtftcmd) /* send QIC-117 cmd */
+
+/* Generic Mag Tape (device independent) status macros for examining
+ * mt_gstat -- HP-UX compatible.
+ * There is room for more generic status bits here, but I don't
+ * know which of them are reserved. At least three or so should
+ * be added to make this really useful.
+ */
+#define GMT_EOF(x) ((x) & 0x80000000)
+#define GMT_BOT(x) ((x) & 0x40000000)
+#define GMT_EOT(x) ((x) & 0x20000000)
+#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */
+#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */
+#define GMT_WR_PROT(x) ((x) & 0x04000000)
+/* #define GMT_ ? ((x) & 0x02000000) */
+#define GMT_ONLINE(x) ((x) & 0x01000000)
+#define GMT_D_6250(x) ((x) & 0x00800000)
+#define GMT_D_1600(x) ((x) & 0x00400000)
+#define GMT_D_800(x) ((x) & 0x00200000)
+/* #define GMT_ ? ((x) & 0x00100000) */
+/* #define GMT_ ? ((x) & 0x00080000) */
+#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */
+/* #define GMT_ ? ((x) & 0x00020000) */
+#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */
+/* 16 generic status bits unused */
+
+
+/* SCSI-tape specific definitions */
+/* Bitfield shifts in the status */
+#define MT_ST_BLKSIZE_SHIFT 0
+#define MT_ST_BLKSIZE_MASK 0xffffff
+#define MT_ST_DENSITY_SHIFT 24
+#define MT_ST_DENSITY_MASK 0xff000000
+
+#define MT_ST_SOFTERR_SHIFT 0
+#define MT_ST_SOFTERR_MASK 0xffff
+
+/* Bitfields for the MTSETDRVBUFFER ioctl */
+#define MT_ST_OPTIONS 0xf0000000
+#define MT_ST_BOOLEANS 0x10000000
+#define MT_ST_SETBOOLEANS 0x30000000
+#define MT_ST_CLEARBOOLEANS 0x40000000
+#define MT_ST_WRITE_THRESHOLD 0x20000000
+#define MT_ST_DEF_BLKSIZE 0x50000000
+#define MT_ST_DEF_OPTIONS 0x60000000
+#define MT_ST_TIMEOUTS 0x70000000
+#define MT_ST_SET_TIMEOUT (MT_ST_TIMEOUTS | 0x000000)
+#define MT_ST_SET_LONG_TIMEOUT (MT_ST_TIMEOUTS | 0x100000)
+
+#define MT_ST_BUFFER_WRITES 0x1
+#define MT_ST_ASYNC_WRITES 0x2
+#define MT_ST_READ_AHEAD 0x4
+#define MT_ST_DEBUGGING 0x8
+#define MT_ST_TWO_FM 0x10
+#define MT_ST_FAST_MTEOM 0x20
+#define MT_ST_AUTO_LOCK 0x40
+#define MT_ST_DEF_WRITES 0x80
+#define MT_ST_CAN_BSR 0x100
+#define MT_ST_NO_BLKLIMS 0x200
+#define MT_ST_CAN_PARTITIONS 0x400
+#define MT_ST_SCSI2LOGICAL 0x800
+#define MT_ST_SYSV 0x1000
+
+/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */
+#define MT_ST_CLEAR_DEFAULT 0xfffff
+#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000)
+
+/* The offset for the arguments for the special HP changer load command. */
+#define MT_ST_HPLOADER_OFFSET 10000
+
+/* Specify default tape device. */
+#ifndef DEFTAPE
+#define DEFTAPE "/dev/tape/0"
+#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/param.h b/mdk-stage1/dietlibc/include/sys/param.h
index 05f4d40e2..0744dccdb 100644
--- a/mdk-stage1/dietlibc/include/sys/param.h
+++ b/mdk-stage1/dietlibc/include/sys/param.h
@@ -3,6 +3,26 @@
#include <limits.h>
-#define MAXPATHLEN PATH_MAX
+#define MAXPATHLEN PATH_MAX
+#define MAXHOSTNAMELEN 64
+#define NGROUPS 32
+#define NOGROUP (-1)
+
+#undef MIN
+#undef MAX
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+#ifdef __alpha__
+#define HZ 1024
+#else
+#define HZ 100
+#endif
+
+#ifndef howmany
+# define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+#define powerof2(x) ((((x)-1)&(x))==0)
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/poll.h b/mdk-stage1/dietlibc/include/sys/poll.h
index adce26687..fe36df79d 100644
--- a/mdk-stage1/dietlibc/include/sys/poll.h
+++ b/mdk-stage1/dietlibc/include/sys/poll.h
@@ -3,9 +3,45 @@
#include <sys/cdefs.h>
-#include <linux/poll.h>
+enum {
+ POLLIN = 0x0001,
+#define POLLIN POLLIN
+ POLLPRI = 0x0002,
+#define POLLPRI POLLPRI
+ POLLOUT = 0x0004,
+#define POLLOUT POLLOUT
+ POLLERR = 0x0008,
+#define POLLERR POLLERR
+ POLLHUP = 0x0010,
+#define POLLHUP POLLHUP
+ POLLNVAL = 0x0020,
+#define POLLNVAL POLLNVAL
+ POLLRDNORM = 0x0040,
+#define POLLRDNORM POLLRDNORM
+ POLLRDBAND = 0x0080,
+#define POLLRDBAND POLLRDBAND
+ POLLWRBAND = 0x0200,
+#define POLLWRBAND POLLWRBAND
+ POLLMSG = 0x0400,
+#define POLLMSG POLLMSG
+/* POLLREMOVE is for /dev/epoll (/dev/misc/eventpoll),
+ * a new event notification mechanism for 2.6 */
+ POLLREMOVE = 0x1000,
+#define POLLREMOVE POLLREMOVE
+};
-extern int poll(struct pollfd *ufds, unsigned int nfds, int timeout) __THROW;
+#if defined(__sparc__) || defined (__mips__)
+#define POLLWRNORM POLLOUT
+#else
+#define POLLWRNORM 0x0100
+#endif
+
+struct pollfd {
+ int fd;
+ short events;
+ short revents;
+};
+extern int poll(struct pollfd *ufds, unsigned int nfds, int timeout) __THROW;
#endif /* _SYS_POLL_H */
diff --git a/mdk-stage1/dietlibc/include/sys/ppc-ioctl.h b/mdk-stage1/dietlibc/include/sys/ppc-ioctl.h
new file mode 100644
index 000000000..c3de6d254
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/ppc-ioctl.h
@@ -0,0 +1,164 @@
+
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 13
+#define _IOC_DIRBITS 3
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
+ * And this turns out useful to catch old ioctl numbers in header
+ * files for us.
+ */
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+#define _IOC_WRITE 4U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode them.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* various drivers, such as the pcmcia stuff, need these... */
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+#define FIOCLEX _IO('f', 1)
+#define FIONCLEX _IO('f', 2)
+#define FIOASYNC _IOW('f', 125, int)
+#define FIONBIO _IOW('f', 126, int)
+#define FIONREAD _IOR('f', 127, int)
+#define TIOCINQ FIONREAD
+#define FIOQSIZE _IOR('f', 128, loff_t)
+
+#define TIOCGETP _IOR('t', 8, struct sgttyb)
+#define TIOCSETP _IOW('t', 9, struct sgttyb)
+#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
+
+#define TIOCSETC _IOW('t', 17, struct tchars)
+#define TIOCGETC _IOR('t', 18, struct tchars)
+#define TCGETS _IOR('t', 19, struct termios)
+#define TCSETS _IOW('t', 20, struct termios)
+#define TCSETSW _IOW('t', 21, struct termios)
+#define TCSETSF _IOW('t', 22, struct termios)
+
+#define TCGETA _IOR('t', 23, struct termio)
+#define TCSETA _IOW('t', 24, struct termio)
+#define TCSETAW _IOW('t', 25, struct termio)
+#define TCSETAF _IOW('t', 28, struct termio)
+
+#define TCSBRK _IO('t', 29)
+#define TCXONC _IO('t', 30)
+#define TCFLSH _IO('t', 31)
+
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
+#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
+#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
+
+#define TIOCGLTC _IOR('t', 116, struct ltchars)
+#define TIOCSLTC _IOW('t', 117, struct ltchars)
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+
+#define TIOCSTI 0x5412
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+# define TIOCM_LE 0x001
+# define TIOCM_DTR 0x002
+# define TIOCM_RTS 0x004
+# define TIOCM_ST 0x008
+# define TIOCM_SR 0x010
+# define TIOCM_CTS 0x020
+# define TIOCM_CAR 0x040
+# define TIOCM_RNG 0x080
+# define TIOCM_DSR 0x100
+# define TIOCM_CD TIOCM_CAR
+# define TIOCM_RI TIOCM_RNG
+
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+# define TIOCPKT_DATA 0
+# define TIOCPKT_FLUSHREAD 1
+# define TIOCPKT_FLUSHWRITE 2
+# define TIOCPKT_STOP 4
+# define TIOCPKT_START 8
+# define TIOCPKT_NOSTOP 16
+# define TIOCPKT_DOSTOP 32
+
+
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
+#define TIOCSBRK 0x5427 /* BSD compatibility */
+#define TIOCCBRK 0x5428 /* BSD compatibility */
+#define TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
+#define TIOCSERGETLSR 0x5459 /* Get line status register */
+ /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
+
+#if 0 /* These are defined this way on Alpha - maybe later. */
+/* Socket-level I/O control calls. */
+
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+
+#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/prctl.h b/mdk-stage1/dietlibc/include/sys/prctl.h
new file mode 100644
index 000000000..26749cbd4
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/prctl.h
@@ -0,0 +1,8 @@
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H
+
+#include <sys/cdefs.h>
+
+int prctl(int option, unsigned long arg2, unsigned long arg3 , unsigned long arg4, unsigned long arg5) __THROW;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/ptrace.h b/mdk-stage1/dietlibc/include/sys/ptrace.h
index 9dd730bc6..b09d3ac3a 100644
--- a/mdk-stage1/dietlibc/include/sys/ptrace.h
+++ b/mdk-stage1/dietlibc/include/sys/ptrace.h
@@ -3,8 +3,844 @@
#include <sys/cdefs.h>
-#include <linux/ptrace.h>
+#define PTRACE_TRACEME 0
+#define PTRACE_PEEKTEXT 1
+#define PTRACE_PEEKDATA 2
+#define PTRACE_PEEKUSR 3
+#define PTRACE_PEEKUSER PTRACE_PEEKUSR
+#define PTRACE_POKETEXT 4
+#define PTRACE_POKEDATA 5
+#define PTRACE_POKEUSR 6
+#define PTRACE_POKEUSER PTRACE_POKEUSR
+#define PTRACE_CONT 7
+#define PTRACE_KILL 8
+#define PTRACE_SINGLESTEP 9
-extern long int ptrace (int request, ...) __THROW;
+#define PTRACE_ATTACH 0x10
+#define PTRACE_DETACH 0x11
+
+#define PTRACE_SYSCALL 24
+
+#define PT_TRACE_ME PTRACE_TRACEME
+#define PT_READ_I PTRACE_PEEKTEXT
+#define PT_READ_D PTRACE_PEEKDATA
+#define PT_READ_U PTRACE_READ_U
+#define PT_WRITE_I PTRACE_POKETEXT
+#define PT_WRITE_D PTRACE_POKEDATA
+#define PT_WRITE_U PTRACE_POKEUSER
+#define PT_CONTINUE PTRACE_CONT
+#define PT_KILL PTRACE_KILL
+#define PT_STEP PTRACE_SINGLESTEP
+#define PT_GETREGS PTRACE_GETREGS
+#define PT_SETREGS PTRACE_SETREGS
+#define PT_GETFPREGS PTRACE_GETFPREGS
+#define PT_SETFPREGS PTRACE_SETFPREGS
+#define PT_ATTACH PTRACE_ATTACH
+#define PT_DETACH PTRACE_DETACH
+
+#if defined(__i386__)
+#define EBX 0
+#define ECX 1
+#define EDX 2
+#define ESI 3
+#define EDI 4
+#define EBP 5
+#define EAX 6
+#define DS 7
+#define ES 8
+#define FS 9
+#define GS 10
+#define ORIG_EAX 11
+#define EIP 12
+#define CS 13
+#define EFL 14
+#define UESP 15
+#define SS 16
+#define FRAME_SIZE 17
+
+/* this struct defines the way the registers are stored on the
+ stack during a system call. */
+
+struct pt_regs {
+ long ebx;
+ long ecx;
+ long edx;
+ long esi;
+ long edi;
+ long ebp;
+ long eax;
+ int xds;
+ int xes;
+ long orig_eax;
+ long eip;
+ int xcs;
+ long eflags;
+ long esp;
+ int xss;
+};
+
+/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_GETFPXREGS 18
+#define PTRACE_SETFPXREGS 19
+
+#define PTRACE_SETOPTIONS 21
+
+/* options set using PTRACE_SETOPTIONS */
+#define PTRACE_O_TRACESYSGOOD 0x00000001
+
+#elif defined(__s390__)
+
+#define PT_PSWMASK 0x00
+#define PT_PSWADDR 0x04
+#define PT_GPR0 0x08
+#define PT_GPR1 0x0C
+#define PT_GPR2 0x10
+#define PT_GPR3 0x14
+#define PT_GPR4 0x18
+#define PT_GPR5 0x1C
+#define PT_GPR6 0x20
+#define PT_GPR7 0x24
+#define PT_GPR8 0x28
+#define PT_GPR9 0x2C
+#define PT_GPR10 0x30
+#define PT_GPR11 0x34
+#define PT_GPR12 0x38
+#define PT_GPR13 0x3C
+#define PT_GPR14 0x40
+#define PT_GPR15 0x44
+#define PT_ACR0 0x48
+#define PT_ACR1 0x4C
+#define PT_ACR2 0x50
+#define PT_ACR3 0x54
+#define PT_ACR4 0x58
+#define PT_ACR5 0x5C
+#define PT_ACR6 0x60
+#define PT_ACR7 0x64
+#define PT_ACR8 0x68
+#define PT_ACR9 0x6C
+#define PT_ACR10 0x70
+#define PT_ACR11 0x74
+#define PT_ACR12 0x78
+#define PT_ACR13 0x7C
+#define PT_ACR14 0x80
+#define PT_ACR15 0x84
+#define PT_ORIGGPR2 0x88
+#define PT_FPC 0x90
+#define PT_FPR0_HI 0x98
+#define PT_FPR0_LO 0x9C
+#define PT_FPR1_HI 0xA0
+#define PT_FPR1_LO 0xA4
+#define PT_FPR2_HI 0xA8
+#define PT_FPR2_LO 0xAC
+#define PT_FPR3_HI 0xB0
+#define PT_FPR3_LO 0xB4
+#define PT_FPR4_HI 0xB8
+#define PT_FPR4_LO 0xBC
+#define PT_FPR5_HI 0xC0
+#define PT_FPR5_LO 0xC4
+#define PT_FPR6_HI 0xC8
+#define PT_FPR6_LO 0xCC
+#define PT_FPR7_HI 0xD0
+#define PT_FPR7_LO 0xD4
+#define PT_FPR8_HI 0xD8
+#define PT_FPR8_LO 0XDC
+#define PT_FPR9_HI 0xE0
+#define PT_FPR9_LO 0xE4
+#define PT_FPR10_HI 0xE8
+#define PT_FPR10_LO 0xEC
+#define PT_FPR11_HI 0xF0
+#define PT_FPR11_LO 0xF4
+#define PT_FPR12_HI 0xF8
+#define PT_FPR12_LO 0xFC
+#define PT_FPR13_HI 0x100
+#define PT_FPR13_LO 0x104
+#define PT_FPR14_HI 0x108
+#define PT_FPR14_LO 0x10C
+#define PT_FPR15_HI 0x110
+#define PT_FPR15_LO 0x114
+#define PT_CR_9 0x118
+#define PT_CR_10 0x11C
+#define PT_CR_11 0x120
+#define PT_IEEE_IP 0x13C
+#define PT_LASTOFF PT_IEEE_IP
+#define PT_ENDREGS 0x140-1
+
+#define NUM_GPRS 16
+#define NUM_FPRS 16
+#define NUM_CRS 16
+#define NUM_ACRS 16
+#define GPR_SIZE 4
+#define FPR_SIZE 8
+#define FPC_SIZE 4
+#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */
+#define CR_SIZE 4
+#define ACR_SIZE 4
+
+#define STACK_FRAME_OVERHEAD 96 /* size of minimum stack frame */
+
+#include <inttypes.h>
+
+/* this typedef defines how a Program Status Word looks like */
+typedef struct {
+ uint32_t mask;
+ uint32_t addr;
+} psw_t __attribute__ ((aligned(8)));
+
+typedef union
+{
+ float f;
+ double d;
+ uint64_t ui;
+ struct
+ {
+ uint32_t hi;
+ uint32_t lo;
+ } fp;
+} freg_t;
+
+typedef struct
+{
+ uint32_t fpc;
+ freg_t fprs[NUM_FPRS];
+} s390_fp_regs;
+
+#define FPC_EXCEPTION_MASK 0xF8000000
+#define FPC_FLAGS_MASK 0x00F80000
+#define FPC_DXC_MASK 0x0000FF00
+#define FPC_RM_MASK 0x00000003
+#define FPC_VALID_MASK 0xF8F8FF03
+
+typedef struct
+{
+ psw_t psw;
+ uint32_t gprs[NUM_GPRS];
+ uint32_t acrs[NUM_ACRS];
+ uint32_t orig_gpr2;
+} s390_regs;
+
+struct pt_regs
+{
+ psw_t psw;
+ uint32_t gprs[NUM_GPRS];
+ uint32_t acrs[NUM_ACRS];
+ uint32_t orig_gpr2;
+ uint32_t trap;
+ uint32_t old_ilc;
+};
+
+typedef struct
+{
+ uint32_t cr[3];
+} per_cr_words __attribute__((packed));
+
+#define PER_EM_MASK 0xE8000000
+
+typedef uint32_t addr_t;
+
+typedef struct
+{
+ unsigned em_branching : 1;
+ unsigned em_instruction_fetch : 1;
+ /*
+ * Switching on storage alteration automatically fixes
+ * the storage alteration event bit in the users std.
+ */
+ unsigned em_storage_alteration : 1;
+ unsigned em_gpr_alt_unused : 1;
+ unsigned em_store_real_address : 1;
+ unsigned : 3;
+ unsigned branch_addr_ctl : 1;
+ unsigned : 1;
+ unsigned storage_alt_space_ctl : 1;
+ unsigned : 21;
+ addr_t starting_addr;
+ addr_t ending_addr;
+} per_cr_bits __attribute__((packed));
+
+typedef struct
+{
+ uint16_t perc_atmid; /* 0x096 */
+ uint32_t address; /* 0x098 */
+ uint8_t access_id; /* 0x0a1 */
+} per_lowcore_words __attribute__((packed));
+
+typedef struct
+{
+ unsigned perc_branching : 1; /* 0x096 */
+ unsigned perc_instruction_fetch : 1;
+ unsigned perc_storage_alteration : 1;
+ unsigned perc_gpr_alt_unused : 1;
+ unsigned perc_store_real_address : 1;
+ unsigned : 4;
+ unsigned atmid_validity_bit : 1;
+ unsigned atmid_psw_bit_32 : 1;
+ unsigned atmid_psw_bit_5 : 1;
+ unsigned atmid_psw_bit_16 : 1;
+ unsigned atmid_psw_bit_17 : 1;
+ unsigned si : 2;
+ addr_t address; /* 0x098 */
+ unsigned : 4; /* 0x0a1 */
+ unsigned access_id : 4;
+} per_lowcore_bits __attribute__((packed));
+
+typedef struct
+{
+ union {
+ per_cr_words words;
+ per_cr_bits bits;
+ } control_regs __attribute__((packed));
+ /*
+ * Use these flags instead of setting em_instruction_fetch
+ * directly they are used so that single stepping can be
+ * switched on & off while not affecting other tracing
+ */
+ unsigned single_step : 1;
+ unsigned instruction_fetch : 1;
+ unsigned : 30;
+ /*
+ * These addresses are copied into cr10 & cr11 if single
+ * stepping is switched off
+ */
+ uint32_t starting_addr;
+ uint32_t ending_addr;
+ union {
+ per_lowcore_words words;
+ per_lowcore_bits bits;
+ } lowcore;
+} per_struct __attribute__((packed));
+
+typedef struct
+{
+ uint32_t len;
+ addr_t kernel_addr;
+ addr_t process_addr;
+} ptrace_area;
+
+/*
+ * S/390 specific non posix ptrace requests. I chose unusual values so
+ * they are unlikely to clash with future ptrace definitions.
+ */
+#define PTRACE_PEEKUSR_AREA 0x5000
+#define PTRACE_POKEUSR_AREA 0x5001
+#define PTRACE_PEEKTEXT_AREA 0x5002
+#define PTRACE_PEEKDATA_AREA 0x5003
+#define PTRACE_POKETEXT_AREA 0x5004
+#define PTRACE_POKEDATA_AREA 0x5005
+/*
+ * PT_PROT definition is loosely based on hppa bsd definition in
+ * gdb/hppab-nat.c
+ */
+#define PTRACE_PROT 21
+
+typedef enum
+{
+ ptprot_set_access_watchpoint,
+ ptprot_set_write_watchpoint,
+ ptprot_disable_watchpoint
+} ptprot_flags;
+
+typedef struct
+{
+ addr_t lowaddr;
+ addr_t hiaddr;
+ ptprot_flags prot;
+} ptprot_area;
+
+/* Sequence of bytes for breakpoint illegal instruction. */
+#define S390_BREAKPOINT {0x0,0x1}
+#define S390_BREAKPOINT_U16 ((uint16_t)0x0001)
+#define S390_SYSCALL_OPCODE ((uint16_t)0x0a00)
+#define S390_SYSCALL_SIZE 2
+
+/*
+ * The user_regs_struct defines the way the user registers are
+ * store on the stack for signal handling.
+ */
+struct user_regs_struct
+{
+ psw_t psw;
+ uint32_t gprs[NUM_GPRS];
+ uint32_t acrs[NUM_ACRS];
+ uint32_t orig_gpr2;
+ s390_fp_regs fp_regs;
+ /*
+ * These per registers are in here so that gdb can modify them
+ * itself as there is no "official" ptrace interface for hardware
+ * watchpoints. This is the way intel does it.
+ */
+ per_struct per_info;
+ addr_t ieee_instruction_pointer;
+ /* Used to give failing instruction back to user for ieee exceptions */
+};
+
+#elif defined(__arm__)
+
+/* this assumes armv */
+#define USR26_MODE 0x00
+#define FIQ26_MODE 0x01
+#define IRQ26_MODE 0x02
+#define SVC26_MODE 0x03
+#define USR_MODE 0x10
+#define FIQ_MODE 0x11
+#define IRQ_MODE 0x12
+#define SVC_MODE 0x13
+#define ABT_MODE 0x17
+#define UND_MODE 0x1b
+#define SYSTEM_MODE 0x1f
+#define MODE_MASK 0x1f
+#define T_BIT 0x20
+#define F_BIT 0x40
+#define I_BIT 0x80
+#define CC_V_BIT (1 << 28)
+#define CC_C_BIT (1 << 29)
+#define CC_Z_BIT (1 << 30)
+#define CC_N_BIT (1 << 31)
+#define PCMASK 0
+
+struct pt_regs {
+ long uregs[18];
+};
+
+#define ARM_cpsr uregs[16]
+#define ARM_pc uregs[15]
+#define ARM_lr uregs[14]
+#define ARM_sp uregs[13]
+#define ARM_ip uregs[12]
+#define ARM_fp uregs[11]
+#define ARM_r10 uregs[10]
+#define ARM_r9 uregs[9]
+#define ARM_r8 uregs[8]
+#define ARM_r7 uregs[7]
+#define ARM_r6 uregs[6]
+#define ARM_r5 uregs[5]
+#define ARM_r4 uregs[4]
+#define ARM_r3 uregs[3]
+#define ARM_r2 uregs[2]
+#define ARM_r1 uregs[1]
+#define ARM_r0 uregs[0]
+#define ARM_ORIG_r0 uregs[17]
+
+#elif defined(__alpha__)
+
+struct pt_regs {
+ unsigned long r0;
+ unsigned long r1;
+ unsigned long r2;
+ unsigned long r3;
+ unsigned long r4;
+ unsigned long r5;
+ unsigned long r6;
+ unsigned long r7;
+ unsigned long r8;
+ unsigned long r19;
+ unsigned long r20;
+ unsigned long r21;
+ unsigned long r22;
+ unsigned long r23;
+ unsigned long r24;
+ unsigned long r25;
+ unsigned long r26;
+ unsigned long r27;
+ unsigned long r28;
+ unsigned long hae;
+/* JRP - These are the values provided to a0-a2 by PALcode */
+ unsigned long trap_a0;
+ unsigned long trap_a1;
+ unsigned long trap_a2;
+/* These are saved by PAL-code: */
+ unsigned long ps;
+ unsigned long pc;
+ unsigned long gp;
+ unsigned long r16;
+ unsigned long r17;
+ unsigned long r18;
+};
+
+struct switch_stack {
+ unsigned long r9;
+ unsigned long r10;
+ unsigned long r11;
+ unsigned long r12;
+ unsigned long r13;
+ unsigned long r14;
+ unsigned long r15;
+ unsigned long r26;
+ unsigned long fp[32]; /* fp[31] is fpcr */
+};
+
+#elif defined(__mips__)
+
+/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
+#define FPR_BASE 32
+#define PC 64
+#define CAUSE 65
+#define BADVADDR 66
+#define MMHI 67
+#define MMLO 68
+#define FPC_CSR 69
+#define FPC_EIR 70
+
+struct pt_regs {
+ /* Pad bytes for argument save space on the stack. */
+ unsigned long pad0[6];
+ /* Saved main processor registers. */
+ unsigned long regs[32];
+ /* Other saved registers. */
+ unsigned long lo;
+ unsigned long hi;
+ /* saved cp0 registers */
+ unsigned long cp0_epc;
+ unsigned long cp0_badvaddr;
+ unsigned long cp0_status;
+ unsigned long cp0_cause;
+};
+
+#elif defined(__sparc__)
+
+struct pt_regs {
+ unsigned long psr;
+ unsigned long pc;
+ unsigned long npc;
+ unsigned long y;
+ unsigned long u_regs[16]; /* globals and ins */
+};
+
+#define UREG_G0 0
+#define UREG_G1 1
+#define UREG_G2 2
+#define UREG_G3 3
+#define UREG_G4 4
+#define UREG_G5 5
+#define UREG_G6 6
+#define UREG_G7 7
+#define UREG_I0 8
+#define UREG_I1 9
+#define UREG_I2 10
+#define UREG_I3 11
+#define UREG_I4 12
+#define UREG_I5 13
+#define UREG_I6 14
+#define UREG_I7 15
+#define UREG_WIM UREG_G0
+#define UREG_FADDR UREG_G0
+#define UREG_FP UREG_I6
+#define UREG_RETPC UREG_I7
+
+/* A register window */
+struct reg_window {
+ unsigned long locals[8];
+ unsigned long ins[8];
+};
+
+/* A Sparc stack frame */
+struct sparc_stackf {
+ unsigned long locals[8];
+ unsigned long ins[6];
+ struct sparc_stackf *fp;
+ unsigned long callers_pc;
+ char *structptr;
+ unsigned long xargs[6];
+ unsigned long xxargs[1];
+};
+
+#define TRACEREG_SZ sizeof(struct pt_regs)
+#define STACKFRAME_SZ sizeof(struct sparc_stackf)
+#define REGWIN_SZ sizeof(struct reg_window)
+
+/* These are for pt_regs. */
+#define PT_PSR 0x0
+#define PT_PC 0x4
+#define PT_NPC 0x8
+#define PT_Y 0xc
+#define PT_G0 0x10
+#define PT_WIM PT_G0
+#define PT_G1 0x14
+#define PT_G2 0x18
+#define PT_G3 0x1c
+#define PT_G4 0x20
+#define PT_G5 0x24
+#define PT_G6 0x28
+#define PT_G7 0x2c
+#define PT_I0 0x30
+#define PT_I1 0x34
+#define PT_I2 0x38
+#define PT_I3 0x3c
+#define PT_I4 0x40
+#define PT_I5 0x44
+#define PT_I6 0x48
+#define PT_FP PT_I6
+#define PT_I7 0x4c
+
+/* Reg_window offsets */
+#define RW_L0 0x00
+#define RW_L1 0x04
+#define RW_L2 0x08
+#define RW_L3 0x0c
+#define RW_L4 0x10
+#define RW_L5 0x14
+#define RW_L6 0x18
+#define RW_L7 0x1c
+#define RW_I0 0x20
+#define RW_I1 0x24
+#define RW_I2 0x28
+#define RW_I3 0x2c
+#define RW_I4 0x30
+#define RW_I5 0x34
+#define RW_I6 0x38
+#define RW_I7 0x3c
+
+/* Stack_frame offsets */
+#define SF_L0 0x00
+#define SF_L1 0x04
+#define SF_L2 0x08
+#define SF_L3 0x0c
+#define SF_L4 0x10
+#define SF_L5 0x14
+#define SF_L6 0x18
+#define SF_L7 0x1c
+#define SF_I0 0x20
+#define SF_I1 0x24
+#define SF_I2 0x28
+#define SF_I3 0x2c
+#define SF_I4 0x30
+#define SF_I5 0x34
+#define SF_FP 0x38
+#define SF_PC 0x3c
+#define SF_RETP 0x40
+#define SF_XARG0 0x44
+#define SF_XARG1 0x48
+#define SF_XARG2 0x4c
+#define SF_XARG3 0x50
+#define SF_XARG4 0x54
+#define SF_XARG5 0x58
+#define SF_XXARG 0x5c
+
+/* Stuff for the ptrace system call */
+#define PTRACE_SUNATTACH 10
+#define PTRACE_SUNDETACH 11
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_READDATA 16
+#define PTRACE_WRITEDATA 17
+#define PTRACE_READTEXT 18
+#define PTRACE_WRITETEXT 19
+#define PTRACE_GETFPAREGS 20
+#define PTRACE_SETFPAREGS 21
+
+#define PTRACE_GETUCODE 29 /* stupid bsd-ism */
+
+#elif defined(__powerpc__)
+
+struct pt_regs {
+ unsigned long gpr[32];
+ unsigned long nip;
+ unsigned long msr;
+ unsigned long orig_gpr3; /* Used for restarting system calls */
+ unsigned long ctr;
+ unsigned long link;
+ unsigned long xer;
+ unsigned long ccr;
+ unsigned long mq; /* 601 only (not used at present) */
+ /* Used on APUS to hold IPL value. */
+ unsigned long trap; /* Reason for being here */
+ unsigned long dar; /* Fault registers */
+ unsigned long dsisr;
+ unsigned long result; /* Result of a system call */
+};
+
+/*
+ * Offsets used by 'ptrace' system call interface.
+ * These can't be changed without breaking binary compatibility
+ * with MkLinux, etc.
+ */
+#define PT_R0 0
+#define PT_R1 1
+#define PT_R2 2
+#define PT_R3 3
+#define PT_R4 4
+#define PT_R5 5
+#define PT_R6 6
+#define PT_R7 7
+#define PT_R8 8
+#define PT_R9 9
+#define PT_R10 10
+#define PT_R11 11
+#define PT_R12 12
+#define PT_R13 13
+#define PT_R14 14
+#define PT_R15 15
+#define PT_R16 16
+#define PT_R17 17
+#define PT_R18 18
+#define PT_R19 19
+#define PT_R20 20
+#define PT_R21 21
+#define PT_R22 22
+#define PT_R23 23
+#define PT_R24 24
+#define PT_R25 25
+#define PT_R26 26
+#define PT_R27 27
+#define PT_R28 28
+#define PT_R29 29
+#define PT_R30 30
+#define PT_R31 31
+
+#define PT_NIP 32
+#define PT_MSR 33
+#define PT_CTR 35
+#define PT_LNK 36
+#define PT_XER 37
+#define PT_CCR 38
+#define PT_MQ 39
+
+#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
+#define PT_FPR31 (PT_FPR0 + 2*31)
+#define PT_FPSCR (PT_FPR0 + 2*32 + 1)
+
+#elif defined(__hppa__)
+
+#include <inttypes.h>
+
+struct pt_regs {
+ unsigned long gr[32]; /* PSW is in gr[0] */
+ uint64_t fr[32];
+ unsigned long sr[ 8];
+ unsigned long iasq[2];
+ unsigned long iaoq[2];
+ unsigned long cr27;
+ unsigned long pad0; /* available for other uses */
+ unsigned long orig_r28;
+ unsigned long ksp;
+ unsigned long kpc;
+ unsigned long sar; /* CR11 */
+ unsigned long iir; /* CR19 */
+ unsigned long isr; /* CR20 */
+ unsigned long ior; /* CR21 */
+ unsigned long ipsw; /* CR22 */
+};
+
+#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
+#define PTRACE_GETSIGINFO 13 /* get child's siginfo structure */
+#define PTRACE_SETSIGINFO 14 /* set child's siginfo structure */
+
+#elif defined(__ia64__)
+
+struct ia64_fpreg {
+ union {
+ unsigned long bits[2];
+ } u;
+} __attribute__ ((aligned (16)));
+
+struct pt_regs {
+ unsigned long cr_ipsr; /* interrupted task's psr */
+ unsigned long cr_iip; /* interrupted task's instruction pointer */
+ unsigned long cr_ifs; /* interrupted task's function state */
+ unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
+ unsigned long ar_pfs; /* prev function state */
+ unsigned long ar_rsc; /* RSE configuration */
+ unsigned long ar_rnat; /* RSE NaT */
+ unsigned long ar_bspstore; /* RSE bspstore */
+ unsigned long pr; /* 64 predicate registers (1 bit each) */
+ unsigned long b6; /* scratch */
+ unsigned long loadrs; /* size of dirty partition << 16 */
+ unsigned long r1; /* the gp pointer */
+ unsigned long r2; /* scratch */
+ unsigned long r3; /* scratch */
+ unsigned long r12; /* interrupted task's memory stack pointer */
+ unsigned long r13; /* thread pointer */
+ unsigned long r14; /* scratch */
+ unsigned long r15; /* scratch */
+ unsigned long r8; /* scratch (return value register 0) */
+ unsigned long r9; /* scratch (return value register 1) */
+ unsigned long r10; /* scratch (return value register 2) */
+ unsigned long r11; /* scratch (return value register 3) */
+ unsigned long r16; /* scratch */
+ unsigned long r17; /* scratch */
+ unsigned long r18; /* scratch */
+ unsigned long r19; /* scratch */
+ unsigned long r20; /* scratch */
+ unsigned long r21; /* scratch */
+ unsigned long r22; /* scratch */
+ unsigned long r23; /* scratch */
+ unsigned long r24; /* scratch */
+ unsigned long r25; /* scratch */
+ unsigned long r26; /* scratch */
+ unsigned long r27; /* scratch */
+ unsigned long r28; /* scratch */
+ unsigned long r29; /* scratch */
+ unsigned long r30; /* scratch */
+ unsigned long r31; /* scratch */
+ unsigned long ar_ccv; /* compare/exchange value (scratch) */
+ unsigned long ar_fpsr; /* floating point status (preserved) */
+ unsigned long b0; /* return pointer (bp) */
+ unsigned long b7; /* scratch */
+ struct ia64_fpreg f6; /* scratch */
+ struct ia64_fpreg f7; /* scratch */
+ struct ia64_fpreg f8; /* scratch */
+ struct ia64_fpreg f9; /* scratch */
+};
+
+struct switch_stack {
+ unsigned long caller_unat; /* user NaT collection register (preserved) */
+ unsigned long ar_fpsr; /* floating-point status register */
+
+ struct ia64_fpreg f2; /* preserved */
+ struct ia64_fpreg f3; /* preserved */
+ struct ia64_fpreg f4; /* preserved */
+ struct ia64_fpreg f5; /* preserved */
+
+ struct ia64_fpreg f10; /* scratch, but untouched by kernel */
+ struct ia64_fpreg f11; /* scratch, but untouched by kernel */
+ struct ia64_fpreg f12; /* scratch, but untouched by kernel */
+ struct ia64_fpreg f13; /* scratch, but untouched by kernel */
+ struct ia64_fpreg f14; /* scratch, but untouched by kernel */
+ struct ia64_fpreg f15; /* scratch, but untouched by kernel */
+ struct ia64_fpreg f16; /* preserved */
+ struct ia64_fpreg f17; /* preserved */
+ struct ia64_fpreg f18; /* preserved */
+ struct ia64_fpreg f19; /* preserved */
+ struct ia64_fpreg f20; /* preserved */
+ struct ia64_fpreg f21; /* preserved */
+ struct ia64_fpreg f22; /* preserved */
+ struct ia64_fpreg f23; /* preserved */
+ struct ia64_fpreg f24; /* preserved */
+ struct ia64_fpreg f25; /* preserved */
+ struct ia64_fpreg f26; /* preserved */
+ struct ia64_fpreg f27; /* preserved */
+ struct ia64_fpreg f28; /* preserved */
+ struct ia64_fpreg f29; /* preserved */
+ struct ia64_fpreg f30; /* preserved */
+ struct ia64_fpreg f31; /* preserved */
+
+ unsigned long r4; /* preserved */
+ unsigned long r5; /* preserved */
+ unsigned long r6; /* preserved */
+ unsigned long r7; /* preserved */
+
+ unsigned long b0; /* so we can force a direct return in copy_thread */
+ unsigned long b1;
+ unsigned long b2;
+ unsigned long b3;
+ unsigned long b4;
+ unsigned long b5;
+
+ unsigned long ar_pfs; /* previous function state */
+ unsigned long ar_lc; /* loop counter (preserved) */
+ unsigned long ar_unat; /* NaT bits for r4-r7 */
+ unsigned long ar_rnat; /* RSE NaT collection register */
+ unsigned long ar_bspstore; /* RSE dirty base (preserved) */
+ unsigned long pr; /* 64 predicate registers (1 bit each) */
+};
+
+#endif
+
+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
index ba58d296a..b17a556e5 100644
--- a/mdk-stage1/dietlibc/include/sys/reboot.h
+++ b/mdk-stage1/dietlibc/include/sys/reboot.h
@@ -1,9 +1,26 @@
#ifndef _SYS_REBOOT_H
#define _SYS_REBOOT_H
-#include <linux/reboot.h>
+#define LINUX_REBOOT_MAGIC1 0xfee1dead
+#define LINUX_REBOOT_MAGIC2 672274793
+#define LINUX_REBOOT_MAGIC2A 85072278
+#define LINUX_REBOOT_MAGIC2B 369367448
+
+#define LINUX_REBOOT_CMD_RESTART 0x01234567
+#define LINUX_REBOOT_CMD_HALT 0xCDEF0123
+#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
+#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000
+#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC
+#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
/* Reboot or halt the system. */
-int reboot (int flag, void *arg);
+int reboot (int flag);
+
+/* the glibc people changed their macro names :-/ */
+#define RB_AUTOBOOT 0x01234567
+#define RB_HALT_SYSTEM 0xcdef0123
+#define RB_ENABLE_CAD 0x89abcdef
+#define RB_DISABLE_CAD 0
+#define RB_POWER_OFF 0x4321fedc
#endif /* _SYS_REBOOT_H */
diff --git a/mdk-stage1/dietlibc/include/sys/resource.h b/mdk-stage1/dietlibc/include/sys/resource.h
index 442434cd1..df31b82ab 100644
--- a/mdk-stage1/dietlibc/include/sys/resource.h
+++ b/mdk-stage1/dietlibc/include/sys/resource.h
@@ -1,8 +1,59 @@
#ifndef _SYS_RESOURCE_H
#define _SYS_RESOURCE_H
+#include <time.h>
#include <sys/cdefs.h>
-#include <linux/resource.h>
+
+#define RUSAGE_SELF 0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
+
+struct rusage {
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
+ long ru_maxrss; /* maximum resident set size */
+ long ru_ixrss; /* integral shared memory size */
+ long ru_idrss; /* integral unshared data size */
+ long ru_isrss; /* integral unshared stack size */
+ long ru_minflt; /* page reclaims */
+ long ru_majflt; /* page faults */
+ long ru_nswap; /* swaps */
+ long ru_inblock; /* block input operations */
+ long ru_oublock; /* block output operations */
+ long ru_msgsnd; /* messages sent */
+ long ru_msgrcv; /* messages received */
+ long ru_nsignals; /* signals received */
+ long ru_nvcsw; /* voluntary context switches */
+ long ru_nivcsw; /* involuntary " */
+};
+
+struct rlimit {
+ unsigned long rlim_cur;
+ unsigned long rlim_max;
+};
+
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP 1
+#define PRIO_USER 2
+
+#define RLIMIT_CPU 0 /* CPU time in ms */
+#define RLIMIT_FSIZE 1 /* Maximum filesize */
+#define RLIMIT_DATA 2 /* max data size */
+#define RLIMIT_STACK 3 /* max stack size */
+#define RLIMIT_CORE 4 /* max core file size */
+#define RLIMIT_RSS 5 /* max resident set size */
+#define RLIMIT_NPROC 6 /* max number of processes */
+#define RLIMIT_NOFILE 7 /* max number of open files */
+#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
+#define RLIMIT_AS 9 /* address space limit */
+#define RLIMIT_LOCKS 10 /* maximum file locks held */
+
+#define RLIM_NLIMITS 11
+
+#define RLIM_INFINITY ((long)(~0UL>>1))
int getpriority(int which, int who) __THROW;
int setpriority(int which, int who, int prio) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sys/s390-ioctl.h b/mdk-stage1/dietlibc/include/sys/s390-ioctl.h
new file mode 100644
index 000000000..4682a0fda
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/s390-ioctl.h
@@ -0,0 +1,141 @@
+
+/* ioctl command encoding: 32 bits total, command in lower 16 bits,
+ * size of the parameter structure in the lower 14 bits of the
+ * upper 16 bits.
+ * Encoding the size of the parameter structure in the ioctl request
+ * is useful for catching programs compiled with old versions
+ * and to avoid overwriting user space outside the user buffer area.
+ * The highest 2 bits are reserved for indicating the ``access mode''.
+ * NOTE: This limits the max parameter size to 16kB -1 !
+ */
+
+/*
+ * The following is for compatibility across the various Linux
+ * platforms. The i386 ioctl numbering scheme doesn't really enforce
+ * a type field. De facto, however, the top 8 bits of the lower 16
+ * bits are indeed used as a type field, so we might just as well make
+ * this explicit here. Please be sure to use the decoding macros
+ * below from now on.
+ */
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits.
+ */
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode ioctl numbers.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+/* 0x54 is just a magic number to make these relatively unique ('T') */
+
+#define TCGETS 0x5401
+#define TCSETS 0x5402
+#define TCSETSW 0x5403
+#define TCSETSF 0x5404
+#define TCGETA 0x5405
+#define TCSETA 0x5406
+#define TCSETAW 0x5407
+#define TCSETAF 0x5408
+#define TCSBRK 0x5409
+#define TCXONC 0x540A
+#define TCFLSH 0x540B
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+#define TIOCGPGRP 0x540F
+#define TIOCSPGRP 0x5410
+#define TIOCOUTQ 0x5411
+#define TIOCSTI 0x5412
+#define TIOCGWINSZ 0x5413
+#define TIOCSWINSZ 0x5414
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define FIONREAD 0x541B
+#define TIOCINQ FIONREAD
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+#define FIONBIO 0x5421
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
+#define TIOCSBRK 0x5427 /* BSD compatibility */
+#define TIOCCBRK 0x5428 /* BSD compatibility */
+#define TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
+#define FIOCLEX 0x5451
+#define FIOASYNC 0x5452
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
+#define TIOCSERGETLSR 0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
+#define FIOQSIZE 0x545E
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
diff --git a/mdk-stage1/dietlibc/include/sys/select.h b/mdk-stage1/dietlibc/include/sys/select.h
index e69de29bb..ce67b8bee 100644
--- a/mdk-stage1/dietlibc/include/sys/select.h
+++ b/mdk-stage1/dietlibc/include/sys/select.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H
+
+typedef long int fd_mask;
+
+#define NFDBITS (8 * sizeof(unsigned long))
+#define FD_SETSIZE 1024
+#define __FDSET_LONGS (FD_SETSIZE/NFDBITS)
+#define __FDELT(d) ((d) / NFDBITS)
+#define __FDMASK(d) (1UL << ((d) % NFDBITS))
+
+typedef struct {
+ unsigned long fds_bits [__FDSET_LONGS];
+} fd_set;
+
+#define FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
+#define FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
+#define FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
+#define FD_ZERO(set) \
+ ((void) memset ((void*) (set), 0, sizeof (fd_set)))
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/sem.h b/mdk-stage1/dietlibc/include/sys/sem.h
index cc182649c..ad16b5f53 100644
--- a/mdk-stage1/dietlibc/include/sys/sem.h
+++ b/mdk-stage1/dietlibc/include/sys/sem.h
@@ -1,11 +1,81 @@
#ifndef _SYS_SEM_H
#define _SYS_SEM_H
-#include <linux/sem.h>
#include <sys/ipc.h>
+/* semop flags */
+#define SEM_UNDO 0x1000 /* undo the operation on exit */
+
+/* semctl Command Definitions. */
+#define GETPID 11 /* get sempid */
+#define GETVAL 12 /* get semval */
+#define GETALL 13 /* get all semval's */
+#define GETNCNT 14 /* get semncnt */
+#define GETZCNT 15 /* get semzcnt */
+#define SETVAL 16 /* set semval */
+#define SETALL 17 /* set all semval's */
+
+/* ipcs ctl cmds */
+#define SEM_STAT 18
+#define SEM_INFO 19
+
+struct semid_ds {
+ struct ipc_perm sem_perm; /* permissions .. see ipc.h */
+ time_t sem_otime; /* last semop time */
+ time_t sem_ctime; /* last change time */
+ struct sem *sem_base; /* ptr to first semaphore in array */
+ struct sem_queue *sem_pending; /* pending operations to be processed */
+ struct sem_queue **sem_pending_last; /* last pending operation */
+ struct sem_undo *undo; /* undo requests on this array */
+ unsigned short sem_nsems; /* no. of semaphores in array */
+};
+
+/* semop system calls takes an array of these. */
+struct sembuf {
+ unsigned short sem_num; /* semaphore index in array */
+ short sem_op; /* semaphore operation */
+ short sem_flg; /* operation flags */
+};
+
+/* please complain to the glibc goons for the following misbehaviour */
+#if 0
+/* arg for semctl system calls. */
+union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
+ unsigned short *array; /* array for GETALL & SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+ void *__pad;
+};
+#endif
+#define _SEM_SEMUN_UNDEFINED
+
+struct seminfo {
+ int semmap;
+ int semmni;
+ int semmns;
+ int semmnu;
+ int semmsl;
+ int semopm;
+ int semume;
+ int semusz;
+ int semvmx;
+ int semaem;
+};
+
+#define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */
+#define SEMMSL 250 /* <= 8 000 max num of semaphores per id */
+#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
+#define SEMOPM 32 /* <= 1 000 max num of ops per semop call */
+#define SEMVMX 32767 /* <= 32767 semaphore maximum value */
+
extern int semget( key_t key, int nsems, int semflg) __THROW;
-extern int semctl(int semid, int semnum, int cmd, union semun arg) __THROW;
+
+/* The prototype really is:
+ * extern int semctl(int semid, int semnum, int cmd, union semun arg) __THROW;
+ * glibc bug compatibility forces us to write it like this: */
+extern int semctl(int semid, int semnum, int cmd, ...) __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
index 2e0c04add..ce6630676 100644
--- a/mdk-stage1/dietlibc/include/sys/sendfile.h
+++ b/mdk-stage1/dietlibc/include/sys/sendfile.h
@@ -2,8 +2,12 @@
#define _SYS_SENDFILE_H
#include <sys/cdefs.h>
+#include <sys/types.h>
-extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *offset,
- size_t __count) __THROW;
+extern ssize_t sendfile (int out_fd, int in_fd, off_t* offset,
+ size_t count) __THROW;
+
+extern ssize_t sendfile64 (int out_fd, int in_fd, loff_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
index c27f5ddcf..879a8786e 100644
--- a/mdk-stage1/dietlibc/include/sys/shm.h
+++ b/mdk-stage1/dietlibc/include/sys/shm.h
@@ -1,12 +1,70 @@
#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()
+#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
+#define SHMMIN 1 /* min shared seg size (bytes) */
+#define SHMMNI 4096 /* max num of segs system wide */
+#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
+#define SHMSEG SHMMNI /* max shared segs per process */
+
+struct shmid_ds {
+ struct ipc_perm shm_perm; /* operation perms */
+ int shm_segsz; /* size of segment (bytes) */
+ time_t shm_atime; /* last attach time */
+ time_t shm_dtime; /* last detach time */
+ time_t shm_ctime; /* last change time */
+ pid_t shm_cpid; /* pid of creator */
+ pid_t shm_lpid; /* pid of last operator */
+ unsigned short shm_nattch; /* no. of current attaches */
+ unsigned short shm_unused; /* compatibility */
+ void *shm_unused2; /* ditto - used by DIPC */
+ void *shm_unused3; /* unused */
+};
+
+/* permission flag for shmget */
+#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
+#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
+
+/* mode for attach */
+#define SHM_RDONLY 010000 /* read-only access */
+#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
+#define SHM_REMAP 040000 /* take-over region on attach */
+
+/* super user shmctl commands */
+#define SHM_LOCK 11
+#define SHM_UNLOCK 12
+
+/* ipcs ctl commands */
+#define SHM_STAT 13
+#define SHM_INFO 14
+
+/* Obsolete, used only for backwards compatibility */
+struct shminfo {
+ int shmmax;
+ int shmmin;
+ int shmmni;
+ int shmseg;
+ int shmall;
+};
+
+struct shm_info {
+ int used_ids;
+ unsigned long shm_tot; /* total allocated shm */
+ unsigned long shm_rss; /* total resident shm */
+ unsigned long shm_swp; /* total swapped shm */
+ unsigned long swap_attempts;
+ unsigned long swap_successes;
+};
+
+#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__)
+#define PAGE_SIZE 4096UL
+#define PAGE_SHIFT 12
+#elif defined(__alpha__) || defined(__sparc__)
+/* sun4* has 4k except sun4 architecture, sparc64 has 8k */
+#define PAGE_SIZE 8192UL
+#define PAGE_SHIFT 13
#endif
extern int shmget(key_t key, int size, int shmflg) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sys/socket.h b/mdk-stage1/dietlibc/include/sys/socket.h
index a1435501c..a1130c4f6 100644
--- a/mdk-stage1/dietlibc/include/sys/socket.h
+++ b/mdk-stage1/dietlibc/include/sys/socket.h
@@ -3,26 +3,380 @@
#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 */
+/* For setsockoptions(2) */
+#if defined(__alpha__) || defined(__mips__)
+#define SOL_SOCKET 0xffff
+
+#define SO_DEBUG 0x0001
+#define SO_REUSEADDR 0x0004
+#define SO_TYPE 0x1008
+#define SO_ERROR 0x1007
+#define SO_DONTROUTE 0x0010
+#define SO_BROADCAST 0x0020
+#define SO_SNDBUF 0x1001
+#define SO_RCVBUF 0x1002
+#define SO_KEEPALIVE 0x0008
+#define SO_OOBINLINE 0x0100
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_LINGER 0x0080
+#define SO_BSDCOMPAT 14
+/* To add :#define SO_REUSEPORT 15 */
+#define SO_PASSCRED 17
+#define SO_PEERCRED 18
+#define SO_RCVLOWAT 0x1004
+#define SO_SNDLOWAT 0x1003
+#define SO_RCVTIMEO 0x1006
+#define SO_SNDTIMEO 0x1005
+#define SO_ACCEPTCONN 0x1009
+
+#define SO_STYLE SO_TYPE /* Synonym */
+
+#elif defined(__hppa__)
+#define SOL_SOCKET 0xffff
+
+#define SO_DEBUG 0x0001
+#define SO_REUSEADDR 0x0004
+#define SO_KEEPALIVE 0x0008
+#define SO_DONTROUTE 0x0010
+#define SO_BROADCAST 0x0020
+#define SO_LINGER 0x0080
+#define SO_OOBINLINE 0x0100
+/* To add :#define SO_REUSEPORT 0x0200 */
+#define SO_SNDBUF 0x1001
+#define SO_RCVBUF 0x1002
+#define SO_SNDLOWAT 0x1003
+#define SO_RCVLOWAT 0x1004
+#define SO_SNDTIMEO 0x1005
+#define SO_RCVTIMEO 0x1006
+#define SO_ERROR 0x1007
+#define SO_TYPE 0x1008
+#define SO_PEERNAME 0x2000
+
+#define SO_NO_CHECK 0x400b
+#define SO_PRIORITY 0x400c
+#define SO_BSDCOMPAT 0x400e
+#define SO_PASSCRED 0x4010
+#define SO_PEERCRED 0x4011
+#define SO_TIMESTAMP 0x4012
+#define SCM_TIMESTAMP SO_TIMESTAMP
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define SO_SECURITY_AUTHENTICATION 0x4016
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017
+#define SO_SECURITY_ENCRYPTION_NETWORK 0x4018
+
+#define SO_BINDTODEVICE 0x4019
+
+/* Socket filtering */
+#define SO_ATTACH_FILTER 0x401a
+#define SO_DETACH_FILTER 0x401b
+
+#define SO_ACCEPTCONN 0x401c
+
+#elif defined(__sparc__)
+#define SOL_SOCKET 0xffff
+
+#define SO_DEBUG 0x0001
+#define SO_PASSCRED 0x0002
+#define SO_REUSEADDR 0x0004
+#define SO_KEEPALIVE 0x0008
+#define SO_DONTROUTE 0x0010
+#define SO_BROADCAST 0x0020
+#define SO_PEERCRED 0x0040
+#define SO_LINGER 0x0080
+#define SO_OOBINLINE 0x0100
+/* To add :#define SO_REUSEPORT 0x0200 */
+#define SO_BSDCOMPAT 0x0400
+#define SO_RCVLOWAT 0x0800
+#define SO_SNDLOWAT 0x1000
+#define SO_RCVTIMEO 0x2000
+#define SO_SNDTIMEO 0x4000
+#define SO_ACCEPTCONN 0x8000
+
+#define SO_DONTLINGER (~SO_LINGER) /* Older SunOS compat. hack */
+
+#define SO_SNDBUF 0x1001
+#define SO_RCVBUF 0x1002
+#define SO_ERROR 0x1007
+#define SO_TYPE 0x1008
+
+#define SO_ATTACH_FILTER 0x001a
+#define SO_DETACH_FILTER 0x001b
+
+#define SO_PEERNAME 0x001c
+#define SO_TIMESTAMP 0x001d
+#define SCM_TIMESTAMP SO_TIMESTAMP
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define SO_SECURITY_AUTHENTICATION 0x5001
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
+#define SO_SECURITY_ENCRYPTION_NETWORK 0x5004
+
+#else
+
+#define SOL_SOCKET 1
+
+#define SO_DEBUG 1
+#define SO_REUSEADDR 2
+#define SO_TYPE 3
+#define SO_ERROR 4
+#define SO_DONTROUTE 5
+#define SO_BROADCAST 6
+#define SO_SNDBUF 7
+#define SO_RCVBUF 8
+#define SO_KEEPALIVE 9
+#define SO_OOBINLINE 10
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_LINGER 13
+#define SO_BSDCOMPAT 14
+/* To add :#define SO_REUSEPORT 15 */
+#define SO_PASSCRED 16
+#define SO_PEERCRED 17
+#define SO_RCVLOWAT 18
+#define SO_SNDLOWAT 19
+#define SO_RCVTIMEO 20
+#define SO_SNDTIMEO 21
+#define SO_ACCEPTCONN 30
+
+#endif
+
+#if !defined(__hppa__) && !defined(__sparc__)
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define SO_SECURITY_AUTHENTICATION 22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define SO_SECURITY_ENCRYPTION_NETWORK 24
+
+#define SO_BINDTODEVICE 25
+
+/* Socket filtering */
+#define SO_ATTACH_FILTER 26
+#define SO_DETACH_FILTER 27
+
+#define SO_PEERNAME 28
+#define SO_TIMESTAMP 29
+#define SCM_TIMESTAMP SO_TIMESTAMP
+#endif
+
+/* Socket types. */
+#ifdef __mips__
+#define SOCK_DGRAM 1 /* datagram (conn.less) socket */
+#define SOCK_STREAM 2 /* stream (connection) socket */
+#else
#define SOCK_STREAM 1 /* stream (connection) socket */
#define SOCK_DGRAM 2 /* datagram (conn.less) socket */
+#endif
#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
+ /* getting packets at the dev */
+ /* level. For writing rarp and */
+ /* other similar things on the */
+ /* user level. */
+
+struct sockaddr {
+ sa_family_t sa_family;
+ char sa_data[14];
+};
+
+struct linger {
+ int l_onoff;
+ int l_linger;
+};
+
+struct iovec {
+ void* iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
+ size_t iov_len; /* Must be size_t (1003.1g) */
+};
+
+struct msghdr {
+ void* msg_name; /* Socket name */
+ int msg_namelen; /* Length of name */
+ struct iovec* msg_iov; /* Data blocks */
+ size_t msg_iovlen; /* Number of blocks */
+ void* msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
+ size_t msg_controllen; /* Length of cmsg list */
+ unsigned msg_flags;
+};
+
+struct cmsghdr {
+ size_t cmsg_len; /* data byte count, including hdr */
+ int cmsg_level; /* originating protocol */
+ int cmsg_type; /* protocol-specific type */
+};
+
+#define UIO_FASTIOV 8
+#define UIO_MAXIOV 1024
+
+/* "Socket"-level control message types: */
+
+#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
+#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */
+#define SCM_CONNECT 0x03 /* rw: struct scm_connect */
+
+struct ucred {
+ unsigned int pid;
+ unsigned int uid;
+ unsigned int gid;
+};
+
+/* Supported address families. */
+#define AF_UNSPEC 0
+#define AF_UNIX 1 /* Unix domain sockets */
+#define AF_LOCAL 1 /* POSIX name for AF_UNIX */
+#define AF_INET 2 /* Internet IP Protocol */
+#define AF_AX25 3 /* Amateur Radio AX.25 */
+#define AF_IPX 4 /* Novell IPX */
+#define AF_APPLETALK 5 /* AppleTalk DDP */
+#define AF_NETROM 6 /* Amateur Radio NET/ROM */
+#define AF_BRIDGE 7 /* Multiprotocol bridge */
+#define AF_ATMPVC 8 /* ATM PVCs */
+#define AF_X25 9 /* Reserved for X.25 project */
+#define AF_INET6 10 /* IP version 6 */
+#define AF_ROSE 11 /* Amateur Radio X.25 PLP */
+#define AF_DECnet 12 /* Reserved for DECnet project */
+#define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/
+#define AF_SECURITY 14 /* Security callback pseudo AF */
+#define AF_KEY 15 /* PF_KEY key management API */
+#define AF_NETLINK 16
+#define AF_ROUTE AF_NETLINK /* Alias to emulate 4.4BSD */
+#define AF_PACKET 17 /* Packet family */
+#define AF_ASH 18 /* Ash */
+#define AF_ECONET 19 /* Acorn Econet */
+#define AF_ATMSVC 20 /* ATM SVCs */
+#define AF_SNA 22 /* Linux SNA Project (nutters!) */
+#define AF_IRDA 23 /* IRDA sockets */
+#define AF_PPPOX 24 /* PPPoX sockets */
+#define AF_WANPIPE 25 /* Wanpipe API Sockets */
+#define AF_MAX 32 /* For now.. */
+
+/* Protocol families, same as address families. */
+#define PF_UNSPEC AF_UNSPEC
+#define PF_UNIX AF_UNIX
+#define PF_LOCAL AF_LOCAL
+#define PF_INET AF_INET
+#define PF_AX25 AF_AX25
+#define PF_IPX AF_IPX
+#define PF_APPLETALK AF_APPLETALK
+#define PF_NETROM AF_NETROM
+#define PF_BRIDGE AF_BRIDGE
+#define PF_ATMPVC AF_ATMPVC
+#define PF_X25 AF_X25
+#define PF_INET6 AF_INET6
+#define PF_ROSE AF_ROSE
+#define PF_DECnet AF_DECnet
+#define PF_NETBEUI AF_NETBEUI
+#define PF_SECURITY AF_SECURITY
+#define PF_KEY AF_KEY
+#define PF_NETLINK AF_NETLINK
+#define PF_ROUTE AF_ROUTE
+#define PF_PACKET AF_PACKET
+#define PF_ASH AF_ASH
+#define PF_ECONET AF_ECONET
+#define PF_ATMSVC AF_ATMSVC
+#define PF_SNA AF_SNA
+#define PF_IRDA AF_IRDA
+#define PF_PPPOX AF_PPPOX
+#define PF_WANPIPE AF_WANPIPE
+#define PF_MAX AF_MAX
+
+/* Maximum queue length specifiable by listen. */
+#define SOMAXCONN 128
+
+/* Flags we can use with send/ and recv.
+ Added those for 1003.1g not all are supported yet */
+#define MSG_OOB 1
+#define MSG_PEEK 2
+#define MSG_DONTROUTE 4
+#define MSG_TRYHARD 4 /* Synonym for MSG_DONTROUTE for DECnet */
+#define MSG_CTRUNC 8
+#define MSG_PROBE 0x10 /* Do not send. Only probe path f.e. for MTU */
+#define MSG_TRUNC 0x20
+#define MSG_DONTWAIT 0x40 /* Nonblocking io */
+#define MSG_EOR 0x80 /* End of record */
+#define MSG_WAITALL 0x100 /* Wait for a full request */
+#define MSG_FIN 0x200
+#define MSG_EOF MSG_FIN
+#define MSG_SYN 0x400
+#define MSG_CONFIRM 0x800 /* Confirm path validity */
+#define MSG_RST 0x1000
+#define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */
+#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
+#define MSG_MORE 0x8000 /* Sender will send more */
+
+/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
+#define SOL_IP 0
+/* #define SOL_ICMP 1 No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */
+#define SOL_TCP 6
+#define SOL_UDP 17
+#define SOL_IPV6 41
+#define SOL_ICMPV6 58
+#define SOL_RAW 255
+#define SOL_IPX 256
+#define SOL_AX25 257
+#define SOL_ATALK 258
+#define SOL_NETROM 259
+#define SOL_ROSE 260
+#define SOL_DECNET 261
+#define SOL_X25 262
+#define SOL_PACKET 263
+#define SOL_ATM 264 /* ATM layer (cell level) */
+#define SOL_AAL 265 /* ATM Adaption Layer (packet level) */
+#define SOL_IRDA 266
+
+/* IPX options */
+#define IPX_TYPE 1
+
+#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
+#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
+#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
+
+static inline struct cmsghdr* __cmsg_nxthdr(void *__ctl, size_t __size, struct cmsghdr *__cmsg)
+{
+ struct cmsghdr * __ptr;
+ __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
+ if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
+ return (struct cmsghdr *)0;
+ return __ptr;
+}
+
+static inline struct cmsghdr* cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
+{
+ return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
+}
+
+#define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
+#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
+#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+
+#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? \
+ (struct cmsghdr *)(ctl) : \
+ (struct cmsghdr *)NULL)
+#define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
struct sockaddr_storage {
- char __tmp[sizeof(struct sockaddr)];
+ sa_family_t ss_family;
+ uint32_t __ss_align;
+ char __ss_padding[(128 - (2 * sizeof (uint32_t ))) ];
};
+#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
+
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 bind(int sockfd, const 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;
@@ -43,4 +397,130 @@ int listen(int s, int backlog) __THROW;
#define SHUT_RDWR 2
int shutdown(int s, int how) __THROW;
+int socketpair(int d, int type, int protocol, int sv[2]);
+
+/* currently not supported: */
+#define NI_NOFQDN 1
+
+#define NI_NUMERICHOST 2
+#define NI_NAMEREQD 4
+#define NI_NUMERICSERV 8
+#define NI_DGRAM 16
+
+struct addrinfo {
+ int ai_flags;
+ int ai_family;
+ int ai_socktype;
+ int ai_protocol;
+ size_t ai_addrlen;
+ struct sockaddr *ai_addr;
+ char *ai_canonname;
+ struct addrinfo *ai_next;
+};
+
+int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ size_t hostlen, char *serv, size_t servlen, int flags) __THROW;
+int getaddrinfo(const char *node, const char *service, const struct
+ addrinfo *hints, struct addrinfo **res) __THROW;
+void freeaddrinfo(struct addrinfo *res) __THROW;
+const char *gai_strerror(int errcode) __THROW;
+
+#define EAI_FAMILY -1
+#define EAI_SOCKTYPE -2
+#define EAI_BADFLAGS -3
+#define EAI_NONAME -4
+#define EAI_SERVICE -5
+#define EAI_ADDRFAMILY -6
+#define EAI_NODATA -7
+#define EAI_MEMORY -8
+#define EAI_FAIL -9
+#define EAI_AGAIN -10
+#define EAI_SYSTEM -11
+
+#define AI_NUMERICHOST 1
+#define AI_CANONNAME 2
+#define AI_PASSIVE 4
+
+/* Linux-specific socket ioctls */
+#define SIOCINQ FIONREAD
+#define SIOCOUTQ TIOCOUTQ
+
+/* Routing table calls. */
+#define SIOCADDRT 0x890B /* add routing table entry */
+#define SIOCDELRT 0x890C /* delete routing table entry */
+#define SIOCRTMSG 0x890D /* call to routing system */
+
+/* Socket configuration controls. */
+#define SIOCGIFNAME 0x8910 /* get iface name */
+#define SIOCSIFLINK 0x8911 /* set iface channel */
+#define SIOCGIFCONF 0x8912 /* get iface list */
+#define SIOCGIFFLAGS 0x8913 /* get flags */
+#define SIOCSIFFLAGS 0x8914 /* set flags */
+#define SIOCGIFADDR 0x8915 /* get PA address */
+#define SIOCSIFADDR 0x8916 /* set PA address */
+#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */
+#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */
+#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
+#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
+#define SIOCGIFNETMASK 0x891b /* get network PA mask */
+#define SIOCSIFNETMASK 0x891c /* set network PA mask */
+#define SIOCGIFMETRIC 0x891d /* get metric */
+#define SIOCSIFMETRIC 0x891e /* set metric */
+#define SIOCGIFMEM 0x891f /* get memory address (BSD) */
+#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */
+#define SIOCGIFMTU 0x8921 /* get MTU size */
+#define SIOCSIFMTU 0x8922 /* set MTU size */
+#define SIOCSIFNAME 0x8923 /* set interface name */
+#define SIOCSIFHWADDR 0x8924 /* set hardware address */
+#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */
+#define SIOCSIFENCAP 0x8926
+#define SIOCGIFHWADDR 0x8927 /* Get hardware address */
+#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */
+#define SIOCSIFSLAVE 0x8930
+#define SIOCADDMULTI 0x8931 /* Multicast address lists */
+#define SIOCDELMULTI 0x8932
+#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */
+#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */
+#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */
+#define SIOCGIFPFLAGS 0x8935
+#define SIOCDIFADDR 0x8936 /* delete PA address */
+#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */
+#define SIOCGIFCOUNT 0x8938 /* get number of devices */
+
+#define SIOCGIFBR 0x8940 /* Bridging support */
+#define SIOCSIFBR 0x8941 /* Set bridging options */
+
+#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
+#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
+
+#define SIOCGIFDIVERT 0x8944 /* Frame diversion support */
+#define SIOCSIFDIVERT 0x8945 /* Set frame diversion options */
+
+#define SIOCETHTOOL 0x8946 /* Ethtool interface */
+
+/* ARP cache control calls. */
+ /* 0x8950 - 0x8952 * obsolete calls, don't re-use */
+#define SIOCDARP 0x8953 /* delete ARP table entry */
+#define SIOCGARP 0x8954 /* get ARP table entry */
+#define SIOCSARP 0x8955 /* set ARP table entry */
+
+/* RARP cache control calls. */
+#define SIOCDRARP 0x8960 /* delete RARP table entry */
+#define SIOCGRARP 0x8961 /* get RARP table entry */
+#define SIOCSRARP 0x8962 /* set RARP table entry */
+
+/* Driver configuration calls */
+
+#define SIOCGIFMAP 0x8970 /* Get device parameters */
+#define SIOCSIFMAP 0x8971 /* Set device parameters */
+
+/* DLCI configuration calls */
+
+#define SIOCADDDLCI 0x8980 /* Create new DLCI device */
+#define SIOCDELDLCI 0x8981 /* Delete DLCI device */
+
+#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */
+
+#define _LINUX_SOCKET_H
+
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/soundcard.h b/mdk-stage1/dietlibc/include/sys/soundcard.h
new file mode 100644
index 000000000..e8766499a
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/soundcard.h
@@ -0,0 +1,1300 @@
+#ifndef _SYS_SOUNDCARD_H
+#define _SYS_SOUNDCARD_H
+
+/*
+ * Copyright by Hannu Savolainen 1993-1997
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
+ */
+
+
+/*
+ * OSS interface version. With versions earlier than 3.6 this value is
+ * an integer with value less than 361. In versions 3.6 and later
+ * it's a six digit hexadecimal value. For example value
+ * of 0x030600 represents OSS version 3.6.0.
+ * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of
+ * the currently active driver.
+ */
+#define SOUND_VERSION 0x030802
+#define OPEN_SOUND_SYSTEM
+
+/* In Linux we need to be prepared for cross compiling */
+#include <sys/ioctl.h>
+
+/*
+ * Supported card ID numbers (Should be somewhere else?)
+ */
+
+#define SNDCARD_ADLIB 1
+#define SNDCARD_SB 2
+#define SNDCARD_PAS 3
+#define SNDCARD_GUS 4
+#define SNDCARD_MPU401 5
+#define SNDCARD_SB16 6
+#define SNDCARD_SB16MIDI 7
+#define SNDCARD_UART6850 8
+#define SNDCARD_GUS16 9
+#define SNDCARD_MSS 10
+#define SNDCARD_PSS 11
+#define SNDCARD_SSCAPE 12
+#define SNDCARD_PSS_MPU 13
+#define SNDCARD_PSS_MSS 14
+#define SNDCARD_SSCAPE_MSS 15
+#define SNDCARD_TRXPRO 16
+#define SNDCARD_TRXPRO_SB 17
+#define SNDCARD_TRXPRO_MPU 18
+#define SNDCARD_MAD16 19
+#define SNDCARD_MAD16_MPU 20
+#define SNDCARD_CS4232 21
+#define SNDCARD_CS4232_MPU 22
+#define SNDCARD_MAUI 23
+#define SNDCARD_PSEUDO_MSS 24
+#define SNDCARD_GUSPNP 25
+#define SNDCARD_UART401 26
+/* Sound card numbers 27 to N are reserved. Don't add more numbers here. */
+
+/***********************************
+ * IOCTL Commands for /dev/sequencer
+ */
+
+#ifndef _SIOWR
+#if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
+/* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
+#define SIOCPARM_MASK IOCPARM_MASK
+#define SIOC_VOID IOC_VOID
+#define SIOC_OUT IOC_OUT
+#define SIOC_IN IOC_IN
+#define SIOC_INOUT IOC_INOUT
+#define _SIOC_SIZE _IOC_SIZE
+#define _SIOC_DIR _IOC_DIR
+#define _SIOC_NONE _IOC_NONE
+#define _SIOC_READ _IOC_READ
+#define _SIOC_WRITE _IOC_WRITE
+#define _SIO _IO
+#define _SIOR _IOR
+#define _SIOW _IOW
+#define _SIOWR _IOWR
+#else
+
+/* Ioctl's have the command encoded in the lower word,
+ * and the size of any in or out parameters in the upper
+ * word. The high 2 bits of the upper word are used
+ * to encode the in/out status of the parameter; for now
+ * we restrict parameters to at most 8191 bytes.
+ */
+/* #define SIOCTYPE (0xff<<8) */
+#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
+#define SIOC_VOID 0x00000000 /* no parameters */
+#define SIOC_OUT 0x20000000 /* copy out parameters */
+#define SIOC_IN 0x40000000 /* copy in parameters */
+#define SIOC_INOUT (SIOC_IN|SIOC_OUT)
+/* the 0x20000000 is so we can distinguish new ioctl's from old */
+#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
+#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
+#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
+/* this should be _SIORW, but stdio got there first */
+#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
+#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
+#define _SIOC_DIR(x) (x & 0xf0000000)
+#define _SIOC_NONE SIOC_VOID
+#define _SIOC_READ SIOC_OUT
+#define _SIOC_WRITE SIOC_IN
+# endif /* _IOWR */
+#endif /* !_SIOWR */
+
+#define SNDCTL_SEQ_RESET _SIO ('Q', 0)
+#define SNDCTL_SEQ_SYNC _SIO ('Q', 1)
+#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info)
+#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
+#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int)
+#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int)
+#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int)
+#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */
+#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int)
+#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int)
+#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int)
+#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int)
+#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info)
+#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int)
+#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */
+#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */
+#define SNDCTL_SEQ_PANIC _SIO ('Q',17)
+#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec)
+#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int)
+#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info)
+#define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control)
+#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample)
+
+typedef struct synth_control
+{
+ int devno; /* Synthesizer # */
+ char data[4000]; /* Device spesific command/data record */
+}synth_control;
+
+typedef struct remove_sample
+{
+ int devno; /* Synthesizer # */
+ int bankno; /* MIDI bank # (0=General MIDI) */
+ int instrno; /* MIDI instrument number */
+} remove_sample;
+
+typedef struct seq_event_rec {
+ unsigned char arr[8];
+} seq_event_rec;
+
+#define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int)
+#define SNDCTL_TMR_START _SIO ('T', 2)
+#define SNDCTL_TMR_STOP _SIO ('T', 3)
+#define SNDCTL_TMR_CONTINUE _SIO ('T', 4)
+#define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int)
+#define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int)
+# define TMR_INTERNAL 0x00000001
+# define TMR_EXTERNAL 0x00000002
+# define TMR_MODE_MIDI 0x00000010
+# define TMR_MODE_FSK 0x00000020
+# define TMR_MODE_CLS 0x00000040
+# define TMR_MODE_SMPTE 0x00000080
+#define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int)
+#define SNDCTL_TMR_SELECT _SIOW ('T', 8, int)
+
+/*
+ * Some big endian/little endian handling macros
+ */
+
+#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__sparc__) || defined(HPPA) || defined(PPC)
+/* Big endian machines */
+# define _PATCHKEY(id) (0xfd00|id)
+# define AFMT_S16_NE AFMT_S16_BE
+#else
+# define _PATCHKEY(id) ((id<<8)|0xfd)
+# define AFMT_S16_NE AFMT_S16_LE
+#endif
+
+/*
+ * Sample loading mechanism for internal synthesizers (/dev/sequencer)
+ * The following patch_info structure has been designed to support
+ * Gravis UltraSound. It tries to be universal format for uploading
+ * sample based patches but is probably too limited.
+ *
+ * (PBD) As Hannu guessed, the GUS structure is too limited for
+ * the WaveFront, but this is the right place for a constant definition.
+ */
+
+struct patch_info {
+ unsigned short key; /* Use WAVE_PATCH here */
+#define WAVE_PATCH _PATCHKEY(0x04)
+#define GUS_PATCH WAVE_PATCH
+#define WAVEFRONT_PATCH _PATCHKEY(0x06)
+
+ short device_no; /* Synthesizer number */
+ short instr_no; /* Midi pgm# */
+
+ unsigned int mode;
+/*
+ * The least significant byte has the same format than the GUS .PAT
+ * files
+ */
+#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */
+#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */
+#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */
+#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */
+#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */
+#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/
+#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
+#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
+ /* (use the env_rate/env_offs fields). */
+/* Linux specific bits */
+#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
+#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
+#define WAVE_SCALE 0x00040000 /* The scaling info is valid */
+#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */
+/* Reserved bits */
+#define WAVE_ROM 0x40000000 /* For future use */
+#define WAVE_MULAW 0x20000000 /* For future use */
+/* Other bits must be zeroed */
+
+ int len; /* Size of the wave data in bytes */
+ int loop_start, loop_end; /* Byte offsets from the beginning */
+
+/*
+ * The base_freq and base_note fields are used when computing the
+ * playback speed for a note. The base_note defines the tone frequency
+ * which is heard if the sample is played using the base_freq as the
+ * playback speed.
+ *
+ * The low_note and high_note fields define the minimum and maximum note
+ * frequencies for which this sample is valid. It is possible to define
+ * more than one samples for an instrument number at the same time. The
+ * low_note and high_note fields are used to select the most suitable one.
+ *
+ * The fields base_note, high_note and low_note should contain
+ * the note frequency multiplied by 1000. For example value for the
+ * middle A is 440*1000.
+ */
+
+ unsigned int base_freq;
+ unsigned int base_note;
+ unsigned int high_note;
+ unsigned int low_note;
+ int panning; /* -128=left, 127=right */
+ int detuning;
+
+/* New fields introduced in version 1.99.5 */
+
+ /* Envelope. Enabled by mode bit WAVE_ENVELOPES */
+ unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */
+ unsigned char env_offset[ 6 ]; /* 255 == 100% */
+
+ /*
+ * The tremolo, vibrato and scale info are not supported yet.
+ * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
+ * WAVE_SCALE
+ */
+
+ unsigned char tremolo_sweep;
+ unsigned char tremolo_rate;
+ unsigned char tremolo_depth;
+
+ unsigned char vibrato_sweep;
+ unsigned char vibrato_rate;
+ unsigned char vibrato_depth;
+
+ int scale_frequency;
+ unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
+
+ int volume;
+ int fractions;
+ int reserved1;
+ int spare[2];
+ char data[1]; /* The waveform data starts here */
+ };
+
+struct sysex_info {
+ short key; /* Use SYSEX_PATCH or MAUI_PATCH here */
+#define SYSEX_PATCH _PATCHKEY(0x05)
+#define MAUI_PATCH _PATCHKEY(0x06)
+ short device_no; /* Synthesizer number */
+ int len; /* Size of the sysex data in bytes */
+ unsigned char data[1]; /* Sysex data starts here */
+ };
+
+/*
+ * /dev/sequencer input events.
+ *
+ * The data written to the /dev/sequencer is a stream of events. Events
+ * are records of 4 or 8 bytes. The first byte defines the size.
+ * Any number of events can be written with a write call. There
+ * is a set of macros for sending these events. Use these macros if you
+ * want to maximize portability of your program.
+ *
+ * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
+ * (All input events are currently 4 bytes long. Be prepared to support
+ * 8 byte events also. If you receive any event having first byte >= 128,
+ * it's a 8 byte event.
+ *
+ * The events are documented at the end of this file.
+ *
+ * Normal events (4 bytes)
+ * There is also a 8 byte version of most of the 4 byte events. The
+ * 8 byte one is recommended.
+ */
+#define SEQ_NOTEOFF 0
+#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */
+#define SEQ_NOTEON 1
+#define SEQ_FMNOTEON SEQ_NOTEON
+#define SEQ_WAIT TMR_WAIT_ABS
+#define SEQ_PGMCHANGE 3
+#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
+#define SEQ_SYNCTIMER TMR_START
+#define SEQ_MIDIPUTC 5
+#define SEQ_DRUMON 6 /*** OBSOLETE ***/
+#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/
+#define SEQ_ECHO TMR_ECHO /* For synching programs with output */
+#define SEQ_AFTERTOUCH 9
+#define SEQ_CONTROLLER 10
+
+/*******************************************
+ * Midi controller numbers
+ *******************************************
+ * Controllers 0 to 31 (0x00 to 0x1f) and
+ * 32 to 63 (0x20 to 0x3f) are continuous
+ * controllers.
+ * In the MIDI 1.0 these controllers are sent using
+ * two messages. Controller numbers 0 to 31 are used
+ * to send the MSB and the controller numbers 32 to 63
+ * are for the LSB. Note that just 7 bits are used in MIDI bytes.
+ */
+
+#define CTL_BANK_SELECT 0x00
+#define CTL_MODWHEEL 0x01
+#define CTL_BREATH 0x02
+/* undefined 0x03 */
+#define CTL_FOOT 0x04
+#define CTL_PORTAMENTO_TIME 0x05
+#define CTL_DATA_ENTRY 0x06
+#define CTL_MAIN_VOLUME 0x07
+#define CTL_BALANCE 0x08
+/* undefined 0x09 */
+#define CTL_PAN 0x0a
+#define CTL_EXPRESSION 0x0b
+/* undefined 0x0c */
+/* undefined 0x0d */
+/* undefined 0x0e */
+/* undefined 0x0f */
+#define CTL_GENERAL_PURPOSE1 0x10
+#define CTL_GENERAL_PURPOSE2 0x11
+#define CTL_GENERAL_PURPOSE3 0x12
+#define CTL_GENERAL_PURPOSE4 0x13
+/* undefined 0x14 - 0x1f */
+
+/* undefined 0x20 */
+/* The controller numbers 0x21 to 0x3f are reserved for the */
+/* least significant bytes of the controllers 0x00 to 0x1f. */
+/* These controllers are not recognised by the driver. */
+
+/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
+/* 0=OFF and 127=ON (intermediate values are possible) */
+#define CTL_DAMPER_PEDAL 0x40
+#define CTL_SUSTAIN 0x40 /* Alias */
+#define CTL_HOLD 0x40 /* Alias */
+#define CTL_PORTAMENTO 0x41
+#define CTL_SOSTENUTO 0x42
+#define CTL_SOFT_PEDAL 0x43
+/* undefined 0x44 */
+#define CTL_HOLD2 0x45
+/* undefined 0x46 - 0x4f */
+
+#define CTL_GENERAL_PURPOSE5 0x50
+#define CTL_GENERAL_PURPOSE6 0x51
+#define CTL_GENERAL_PURPOSE7 0x52
+#define CTL_GENERAL_PURPOSE8 0x53
+/* undefined 0x54 - 0x5a */
+#define CTL_EXT_EFF_DEPTH 0x5b
+#define CTL_TREMOLO_DEPTH 0x5c
+#define CTL_CHORUS_DEPTH 0x5d
+#define CTL_DETUNE_DEPTH 0x5e
+#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */
+#define CTL_PHASER_DEPTH 0x5f
+#define CTL_DATA_INCREMENT 0x60
+#define CTL_DATA_DECREMENT 0x61
+#define CTL_NONREG_PARM_NUM_LSB 0x62
+#define CTL_NONREG_PARM_NUM_MSB 0x63
+#define CTL_REGIST_PARM_NUM_LSB 0x64
+#define CTL_REGIST_PARM_NUM_MSB 0x65
+/* undefined 0x66 - 0x78 */
+/* reserved 0x79 - 0x7f */
+
+/* Pseudo controllers (not midi compatible) */
+#define CTRL_PITCH_BENDER 255
+#define CTRL_PITCH_BENDER_RANGE 254
+#define CTRL_EXPRESSION 253 /* Obsolete */
+#define CTRL_MAIN_VOLUME 252 /* Obsolete */
+#define SEQ_BALANCE 11
+#define SEQ_VOLMODE 12
+
+/*
+ * Volume mode decides how volumes are used
+ */
+
+#define VOL_METHOD_ADAGIO 1
+#define VOL_METHOD_LINEAR 2
+
+/*
+ * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
+ * input events.
+ */
+
+/*
+ * Event codes 0xf0 to 0xfc are reserved for future extensions.
+ */
+
+#define SEQ_FULLSIZE 0xfd /* Long events */
+/*
+ * SEQ_FULLSIZE events are used for loading patches/samples to the
+ * synthesizer devices. These events are passed directly to the driver
+ * of the associated synthesizer device. There is no limit to the size
+ * of the extended events. These events are not queued but executed
+ * immediately when the write() is called (execution can take several
+ * seconds of time).
+ *
+ * When a SEQ_FULLSIZE message is written to the device, it must
+ * be written using exactly one write() call. Other events cannot
+ * be mixed to the same write.
+ *
+ * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
+ * /dev/sequencer. Don't write other data together with the instrument structure
+ * Set the key field of the structure to FM_PATCH. The device field is used to
+ * route the patch to the corresponding device.
+ *
+ * For wave table use struct patch_info. Initialize the key field
+ * to WAVE_PATCH.
+ */
+#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */
+#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */
+
+/*
+ * Record for FM patches
+ */
+
+typedef unsigned char sbi_instr_data[32];
+
+struct sbi_instrument {
+ unsigned short key; /* FM_PATCH or OPL3_PATCH */
+#define FM_PATCH _PATCHKEY(0x01)
+#define OPL3_PATCH _PATCHKEY(0x03)
+ short device; /* Synth# (0-4) */
+ int channel; /* Program# to be initialized */
+ sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
+ };
+
+struct synth_info { /* Read only */
+ char name[30];
+ int device; /* 0-N. INITIALIZE BEFORE CALLING */
+ int synth_type;
+#define SYNTH_TYPE_FM 0
+#define SYNTH_TYPE_SAMPLE 1
+#define SYNTH_TYPE_MIDI 2 /* Midi interface */
+
+ int synth_subtype;
+#define FM_TYPE_ADLIB 0x00
+#define FM_TYPE_OPL3 0x01
+#define MIDI_TYPE_MPU401 0x401
+
+#define SAMPLE_TYPE_BASIC 0x10
+#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
+#define SAMPLE_TYPE_WAVEFRONT 0x11
+
+ int perc_mode; /* No longer supported */
+ int nr_voices;
+ int nr_drums; /* Obsolete field */
+ int instr_bank_size;
+ unsigned int capabilities;
+#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
+#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
+#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
+ int dummies[19]; /* Reserve space */
+ };
+
+struct sound_timer_info {
+ char name[32];
+ int caps;
+ };
+
+#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */
+
+struct midi_info {
+ char name[30];
+ int device; /* 0-N. INITIALIZE BEFORE CALLING */
+ unsigned int capabilities; /* To be defined later */
+ int dev_type;
+ int dummies[18]; /* Reserve space */
+ };
+
+/********************************************
+ * ioctl commands for the /dev/midi##
+ */
+typedef struct {
+ unsigned char cmd;
+ char nr_args, nr_returns;
+ unsigned char data[30];
+ } mpu_command_rec;
+
+#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int)
+#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int)
+#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec)
+
+/********************************************
+ * IOCTL commands for /dev/dsp and /dev/audio
+ */
+
+#define SNDCTL_DSP_RESET _SIO ('P', 0)
+#define SNDCTL_DSP_SYNC _SIO ('P', 1)
+#define SNDCTL_DSP_SPEED _SIOWR('P', 2, int)
+#define SNDCTL_DSP_STEREO _SIOWR('P', 3, int)
+#define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int)
+#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
+#define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int)
+#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
+#define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int)
+#define SNDCTL_DSP_POST _SIO ('P', 8)
+#define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int)
+#define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int)
+
+/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
+#define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */
+#define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/
+# define AFMT_QUERY 0x00000000 /* Return current fmt */
+# define AFMT_MU_LAW 0x00000001
+# define AFMT_A_LAW 0x00000002
+# define AFMT_IMA_ADPCM 0x00000004
+# define AFMT_U8 0x00000008
+# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/
+# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
+# define AFMT_S8 0x00000040
+# define AFMT_U16_LE 0x00000080 /* Little endian U16 */
+# define AFMT_U16_BE 0x00000100 /* Big endian U16 */
+# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
+# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */
+
+/*
+ * Buffer status queries.
+ */
+typedef struct audio_buf_info {
+ int fragments; /* # of available fragments (partially usend ones not counted) */
+ int fragstotal; /* Total # of fragments allocated */
+ int fragsize; /* Size of a fragment in bytes */
+
+ int bytes; /* Available space in bytes (includes partially used fragments) */
+ /* Note! 'bytes' could be more than fragments*fragsize */
+ } audio_buf_info;
+
+#define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info)
+#define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info)
+#define SNDCTL_DSP_NONBLOCK _SIO ('P',14)
+#define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int)
+# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */
+# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */
+# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */
+# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */
+ /* internal buffers which may */
+ /* cause some delays and */
+ /* decrease precision of timing */
+# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */
+ /* Sometimes it's a DSP */
+ /* but usually not */
+# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
+# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */
+# define DSP_CAP_MULTI 0x00004000 /* support multiple open */
+# define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */
+
+
+#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int)
+#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int)
+# define PCM_ENABLE_INPUT 0x00000001
+# define PCM_ENABLE_OUTPUT 0x00000002
+
+typedef struct count_info {
+ int bytes; /* Total # of bytes processed */
+ int blocks; /* # of fragment transitions since last time */
+ int ptr; /* Current DMA pointer value */
+ } count_info;
+
+#define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info)
+#define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info)
+
+typedef struct buffmem_desc {
+ unsigned *buffer;
+ int size;
+ } buffmem_desc;
+#define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc)
+#define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc)
+#define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21)
+#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22)
+#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int)
+
+#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int)
+#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int)
+# define DSP_BIND_QUERY 0x00000000
+# define DSP_BIND_FRONT 0x00000001
+# define DSP_BIND_SURR 0x00000002
+# define DSP_BIND_CENTER_LFE 0x00000004
+# define DSP_BIND_HANDSET 0x00000008
+# define DSP_BIND_MIC 0x00000010
+# define DSP_BIND_MODEM1 0x00000020
+# define DSP_BIND_MODEM2 0x00000040
+# define DSP_BIND_I2S 0x00000080
+# define DSP_BIND_SPDIF 0x00000100
+
+#define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int)
+#define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int)
+# define SPDIF_PRO 0x0001
+# define SPDIF_N_AUD 0x0002
+# define SPDIF_COPY 0x0004
+# define SPDIF_PRE 0x0008
+# define SPDIF_CC 0x07f0
+# define SPDIF_L 0x0800
+# define SPDIF_DRS 0x4000
+# define SPDIF_V 0x8000
+
+/*
+ * Application's profile defines the way how playback underrun situations should be handled.
+ *
+ * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the
+ * playback buffer whenever an underrun occurs. This consumes some time
+ * prevents looping the existing buffer.
+ * APF_CPUINTENS is intended to be set by CPU intensive applications which
+ * are likely to run out of time occasionally. In this mode the buffer cleanup is
+ * disabled which saves CPU time but also let's the previous buffer content to
+ * be played during the "pause" after the underrun.
+ */
+#define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int)
+#define APF_NORMAL 0 /* Normal applications */
+#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */
+#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */
+
+#define SOUND_PCM_READ_RATE _SIOR ('P', 2, int)
+#define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int)
+#define SOUND_PCM_READ_BITS _SIOR ('P', 5, int)
+#define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int)
+
+/* Some alias names */
+#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
+#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
+#define SOUND_PCM_POST SNDCTL_DSP_POST
+#define SOUND_PCM_RESET SNDCTL_DSP_RESET
+#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
+#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
+#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
+#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
+#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
+#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
+#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
+#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
+#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS
+#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER
+#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER
+#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO
+#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR
+#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR
+#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF
+#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF
+
+/*
+ * ioctl calls to be used in communication with coprocessors and
+ * DSP chips.
+ */
+
+typedef struct copr_buffer {
+ int command; /* Set to 0 if not used */
+ int flags;
+#define CPF_NONE 0x0000
+#define CPF_FIRST 0x0001 /* First block */
+#define CPF_LAST 0x0002 /* Last block */
+ int len;
+ int offs; /* If required by the device (0 if not used) */
+
+ unsigned char data[4000]; /* NOTE! 4000 is not 4k */
+ } copr_buffer;
+
+typedef struct copr_debug_buf {
+ int command; /* Used internally. Set to 0 */
+ int parm1;
+ int parm2;
+ int flags;
+ int len; /* Length of data in bytes */
+ } copr_debug_buf;
+
+typedef struct copr_msg {
+ int len;
+ unsigned char data[4000];
+ } copr_msg;
+
+#define SNDCTL_COPR_RESET _SIO ('C', 0)
+#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer)
+#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf)
+#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf)
+#define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf)
+#define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf)
+#define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf)
+#define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf)
+#define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg)
+#define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg)
+
+/*********************************************
+ * IOCTL commands for /dev/mixer
+ */
+
+/*
+ * Mixer devices
+ *
+ * There can be up to 20 different analog mixer channels. The
+ * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
+ * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
+ * the devices supported by the particular mixer.
+ */
+
+#define SOUND_MIXER_NRDEVICES 25
+#define SOUND_MIXER_VOLUME 0
+#define SOUND_MIXER_BASS 1
+#define SOUND_MIXER_TREBLE 2
+#define SOUND_MIXER_SYNTH 3
+#define SOUND_MIXER_PCM 4
+#define SOUND_MIXER_SPEAKER 5
+#define SOUND_MIXER_LINE 6
+#define SOUND_MIXER_MIC 7
+#define SOUND_MIXER_CD 8
+#define SOUND_MIXER_IMIX 9 /* Recording monitor */
+#define SOUND_MIXER_ALTPCM 10
+#define SOUND_MIXER_RECLEV 11 /* Recording level */
+#define SOUND_MIXER_IGAIN 12 /* Input gain */
+#define SOUND_MIXER_OGAIN 13 /* Output gain */
+/*
+ * The AD1848 codec and compatibles have three line level inputs
+ * (line, aux1 and aux2). Since each card manufacturer have assigned
+ * different meanings to these inputs, it's inpractical to assign
+ * specific meanings (line, cd, synth etc.) to them.
+ */
+#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
+#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
+#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
+#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
+#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
+#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
+#define SOUND_MIXER_PHONEIN 20 /* Phone input */
+#define SOUND_MIXER_PHONEOUT 21 /* Phone output */
+#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
+#define SOUND_MIXER_RADIO 23 /* Radio in */
+#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
+
+/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
+/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
+#define SOUND_ONOFF_MIN 28
+#define SOUND_ONOFF_MAX 30
+
+/* Note! Number 31 cannot be used since the sign bit is reserved */
+#define SOUND_MIXER_NONE 31
+
+/*
+ * The following unsupported macros are no longer functional.
+ * Use SOUND_MIXER_PRIVATE# macros in future.
+ */
+#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
+#define SOUND_MIXER_MUTE SOUND_MIXER_NONE
+#define SOUND_MIXER_LOUD SOUND_MIXER_NONE
+
+
+#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
+ "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
+ "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
+ "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
+
+#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
+ "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
+ "line1", "line2", "line3", "dig1", "dig2", "dig3", \
+ "phin", "phout", "video", "radio", "monitor"}
+
+/* Device bitmask identifiers */
+
+#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */
+#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */
+#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */
+#define SOUND_MIXER_CAPS 0xfc
+# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */
+#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
+#define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */
+#define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */
+
+/* Device mask bits */
+
+#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
+#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
+#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
+#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
+#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
+#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
+#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
+#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
+#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
+#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
+#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
+#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
+#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
+#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
+#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
+#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
+#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
+#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
+#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
+#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
+#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN)
+#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT)
+#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
+#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
+#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR)
+
+/* Obsolete macros */
+#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
+#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
+#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
+
+#define MIXER_READ(dev) _SIOR('M', dev, int)
+#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
+#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
+#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
+#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
+#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
+#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
+#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
+#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
+#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
+#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
+#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
+#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
+#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
+#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
+#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
+#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
+#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
+
+/* Obsolete macros */
+#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
+#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
+#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
+
+#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
+#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
+#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
+#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
+#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
+
+#define MIXER_WRITE(dev) _SIOWR('M', dev, int)
+#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
+#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
+#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
+#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
+#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
+#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
+#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
+#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
+#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
+#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
+#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
+#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
+#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
+#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
+#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
+#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
+#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
+
+/* Obsolete macros */
+#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
+#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
+#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
+
+#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
+
+typedef struct mixer_info
+{
+ char id[16];
+ char name[32];
+ int modify_counter;
+ int fillers[10];
+} mixer_info;
+
+typedef struct _old_mixer_info /* Obsolete */
+{
+ char id[16];
+ char name[32];
+} _old_mixer_info;
+
+#define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info)
+#define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info)
+
+/*
+ * A mechanism for accessing "proprietary" mixer features. This method
+ * permits passing 128 bytes of arbitrary data between a mixer application
+ * and the mixer driver. Interpretation of the record is defined by
+ * the particular mixer driver.
+ */
+typedef unsigned char mixer_record[128];
+
+#define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record)
+
+/*
+ * Two ioctls for special souncard function
+ */
+#define SOUND_MIXER_AGC _SIOWR('M', 103, int)
+#define SOUND_MIXER_3DSE _SIOWR('M', 104, int)
+
+/*
+ * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
+ * These features can be used when accessing device specific features.
+ */
+#define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int)
+#define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int)
+#define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int)
+#define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int)
+#define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int)
+
+/*
+ * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
+ * for querying current mixer settings from the driver and for loading
+ * default volume settings _prior_ activating the mixer (loading
+ * doesn't affect current state of the mixer hardware). These calls
+ * are for internal use only.
+ */
+
+typedef struct mixer_vol_table {
+ int num; /* Index to volume table */
+ char name[32];
+ int levels[32];
+} mixer_vol_table;
+
+#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table)
+#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table)
+
+/*
+ * An ioctl for identifying the driver version. It will return value
+ * of the SOUND_VERSION macro used when compiling the driver.
+ * This call was introduced in OSS version 3.6 and it will not work
+ * with earlier versions (returns EINVAL).
+ */
+#define OSS_GETVERSION _SIOR ('M', 118, int)
+
+/*
+ * Level 2 event types for /dev/sequencer
+ */
+
+/*
+ * The 4 most significant bits of byte 0 specify the class of
+ * the event:
+ *
+ * 0x8X = system level events,
+ * 0x9X = device/port specific events, event[1] = device/port,
+ * The last 4 bits give the subtype:
+ * 0x02 = Channel event (event[3] = chn).
+ * 0x01 = note event (event[4] = note).
+ * (0x01 is not used alone but always with bit 0x02).
+ * event[2] = MIDI message code (0x80=note off etc.)
+ *
+ */
+
+#define EV_SEQ_LOCAL 0x80
+#define EV_TIMING 0x81
+#define EV_CHN_COMMON 0x92
+#define EV_CHN_VOICE 0x93
+#define EV_SYSEX 0x94
+/*
+ * Event types 200 to 220 are reserved for application use.
+ * These numbers will not be used by the driver.
+ */
+
+/*
+ * Events for event type EV_CHN_VOICE
+ */
+
+#define MIDI_NOTEOFF 0x80
+#define MIDI_NOTEON 0x90
+#define MIDI_KEY_PRESSURE 0xA0
+
+/*
+ * Events for event type EV_CHN_COMMON
+ */
+
+#define MIDI_CTL_CHANGE 0xB0
+#define MIDI_PGM_CHANGE 0xC0
+#define MIDI_CHN_PRESSURE 0xD0
+#define MIDI_PITCH_BEND 0xE0
+
+#define MIDI_SYSTEM_PREFIX 0xF0
+
+/*
+ * Timer event types
+ */
+#define TMR_WAIT_REL 1 /* Time relative to the prev time */
+#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */
+#define TMR_STOP 3
+#define TMR_START 4
+#define TMR_CONTINUE 5
+#define TMR_TEMPO 6
+#define TMR_ECHO 8
+#define TMR_CLOCK 9 /* MIDI clock */
+#define TMR_SPP 10 /* Song position pointer */
+#define TMR_TIMESIG 11 /* Time signature */
+
+/*
+ * Local event types
+ */
+#define LOCL_STARTAUDIO 1
+
+#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
+/*
+ * Some convenience macros to simplify programming of the
+ * /dev/sequencer interface
+ *
+ * These macros define the API which should be used when possible.
+ */
+#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
+
+void seqbuf_dump(void); /* This function must be provided by programs */
+
+extern int OSS_init(int seqfd, int buflen);
+extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
+extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
+extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
+extern void OSS_patch_caching(int dev, int chn, int patch,
+ int fd, unsigned char *buf, int buflen);
+extern void OSS_drum_caching(int dev, int chn, int patch,
+ int fd, unsigned char *buf, int buflen);
+extern void OSS_write_patch(int fd, unsigned char *buf, int len);
+extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
+
+#define SEQ_PM_DEFINES int __foo_bar___
+#ifdef OSSLIB
+# define SEQ_USE_EXTBUF() \
+ extern unsigned char *_seqbuf; \
+ extern int _seqbuflen;extern int _seqbufptr
+# define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
+# define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
+# define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
+# define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
+
+# define SEQ_LOAD_GMINSTR(dev, instr) \
+ OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
+# define SEQ_LOAD_GMDRUM(dev, drum) \
+ OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
+#else /* !OSSLIB */
+
+# define SEQ_LOAD_GMINSTR(dev, instr)
+# define SEQ_LOAD_GMDRUM(dev, drum)
+
+# define SEQ_USE_EXTBUF() \
+ extern unsigned char _seqbuf[]; \
+ extern int _seqbuflen;extern int _seqbufptr
+
+#ifndef USE_SIMPLE_MACROS
+/* Sample seqbuf_dump() implementation:
+ *
+ * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes
+ *
+ * int seqfd; -- The file descriptor for /dev/sequencer.
+ *
+ * void
+ * seqbuf_dump ()
+ * {
+ * if (_seqbufptr)
+ * if (write (seqfd, _seqbuf, _seqbufptr) == -1)
+ * {
+ * perror ("write /dev/sequencer");
+ * exit (-1);
+ * }
+ * _seqbufptr = 0;
+ * }
+ */
+
+#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
+#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
+#define _SEQ_ADVBUF(len) _seqbufptr += len
+#define SEQ_DUMPBUF seqbuf_dump
+#else
+/*
+ * This variation of the sequencer macros is used just to format one event
+ * using fixed buffer.
+ *
+ * The program using the macro library must define the following macros before
+ * using this library.
+ *
+ * #define _seqbuf name of the buffer (unsigned char[])
+ * #define _SEQ_ADVBUF(len) If the applic needs to know the exact
+ * size of the event, this macro can be used.
+ * Otherwise this must be defined as empty.
+ * #define _seqbufptr Define the name of index variable or 0 if
+ * not required.
+ */
+#define _SEQ_NEEDBUF(len) /* empty */
+#endif
+#endif /* !OSSLIB */
+
+#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
+ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
+ _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
+ _seqbuf[_seqbufptr+2] = (dev);\
+ _seqbuf[_seqbufptr+3] = (mode);\
+ _seqbuf[_seqbufptr+4] = 0;\
+ _seqbuf[_seqbufptr+5] = 0;\
+ _seqbuf[_seqbufptr+6] = 0;\
+ _seqbuf[_seqbufptr+7] = 0;\
+ _SEQ_ADVBUF(8);}
+
+/*
+ * Midi voice messages
+ */
+
+#define _CHN_VOICE(dev, event, chn, note, parm) \
+ {_SEQ_NEEDBUF(8);\
+ _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
+ _seqbuf[_seqbufptr+1] = (dev);\
+ _seqbuf[_seqbufptr+2] = (event);\
+ _seqbuf[_seqbufptr+3] = (chn);\
+ _seqbuf[_seqbufptr+4] = (note);\
+ _seqbuf[_seqbufptr+5] = (parm);\
+ _seqbuf[_seqbufptr+6] = (0);\
+ _seqbuf[_seqbufptr+7] = 0;\
+ _SEQ_ADVBUF(8);}
+
+#define SEQ_START_NOTE(dev, chn, note, vol) \
+ _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
+
+#define SEQ_STOP_NOTE(dev, chn, note, vol) \
+ _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
+
+#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
+ _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
+
+/*
+ * Midi channel messages
+ */
+
+#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
+ {_SEQ_NEEDBUF(8);\
+ _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
+ _seqbuf[_seqbufptr+1] = (dev);\
+ _seqbuf[_seqbufptr+2] = (event);\
+ _seqbuf[_seqbufptr+3] = (chn);\
+ _seqbuf[_seqbufptr+4] = (p1);\
+ _seqbuf[_seqbufptr+5] = (p2);\
+ *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
+ _SEQ_ADVBUF(8);}
+/*
+ * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
+ * sending any MIDI bytes but it's absolutely not possible. Trying to do
+ * so _will_ cause problems with MPU401 intelligent mode).
+ *
+ * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
+ * sent by calling SEQ_SYSEX() several times (there must be no other events
+ * between them). First sysex fragment must have 0xf0 in the first byte
+ * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
+ * between these sysex start and end markers cannot be larger than 0x7f. Also
+ * lengths of each fragments (except the last one) must be 6.
+ *
+ * Breaking the above rules may work with some MIDI ports but is likely to
+ * cause fatal problems with some other devices (such as MPU401).
+ */
+#define SEQ_SYSEX(dev, buf, len) \
+ {int ii, ll=(len); \
+ unsigned char *bufp=buf;\
+ if (ll>6)ll=6;\
+ _SEQ_NEEDBUF(8);\
+ _seqbuf[_seqbufptr] = EV_SYSEX;\
+ _seqbuf[_seqbufptr+1] = (dev);\
+ for(ii=0;ii<ll;ii++)\
+ _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
+ for(ii=ll;ii<6;ii++)\
+ _seqbuf[_seqbufptr+ii+2] = 0xff;\
+ _SEQ_ADVBUF(8);}
+
+#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
+ _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
+
+#define SEQ_SET_PATCH SEQ_PGM_CHANGE
+#ifdef OSSLIB
+# define SEQ_PGM_CHANGE(dev, chn, patch) \
+ {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
+ _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
+#else
+# define SEQ_PGM_CHANGE(dev, chn, patch) \
+ _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
+#endif
+
+#define SEQ_CONTROL(dev, chn, controller, value) \
+ _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
+
+#define SEQ_BENDER(dev, chn, value) \
+ _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
+
+
+#define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
+ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
+ _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
+ _seqbuf[_seqbufptr+2] = (dev);\
+ _seqbuf[_seqbufptr+3] = (voice);\
+ _seqbuf[_seqbufptr+4] = (controller);\
+ _seqbuf[_seqbufptr+5] = ((value)&0xff);\
+ _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
+ _seqbuf[_seqbufptr+7] = 0;\
+ _SEQ_ADVBUF(8);}
+/*
+ * The following 5 macros are incorrectly implemented and obsolete.
+ * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
+ */
+#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
+#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
+#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
+#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
+#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
+
+/*
+ * Timing and syncronization macros
+ */
+
+#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
+ _seqbuf[_seqbufptr+0] = EV_TIMING; \
+ _seqbuf[_seqbufptr+1] = (ev); \
+ _seqbuf[_seqbufptr+2] = 0;\
+ _seqbuf[_seqbufptr+3] = 0;\
+ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
+ _SEQ_ADVBUF(8);}
+
+#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
+#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
+#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
+#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
+#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
+#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
+#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
+#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
+#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
+
+/*
+ * Local control events
+ */
+
+#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
+ _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
+ _seqbuf[_seqbufptr+1] = (ev); \
+ _seqbuf[_seqbufptr+2] = 0;\
+ _seqbuf[_seqbufptr+3] = 0;\
+ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
+ _SEQ_ADVBUF(8);}
+
+#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
+/*
+ * Events for the level 1 interface only
+ */
+
+#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
+ _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
+ _seqbuf[_seqbufptr+1] = (byte);\
+ _seqbuf[_seqbufptr+2] = (device);\
+ _seqbuf[_seqbufptr+3] = 0;\
+ _SEQ_ADVBUF(4);}
+
+/*
+ * Patch loading.
+ */
+#ifdef OSSLIB
+# define SEQ_WRPATCH(patchx, len) \
+ OSS_write_patch(seqfd, (char*)(patchx), len)
+# define SEQ_WRPATCH2(patchx, len) \
+ OSS_write_patch2(seqfd, (char*)(patchx), len)
+#else
+# define SEQ_WRPATCH(patchx, len) \
+ {if (_seqbufptr) SEQ_DUMPBUF();\
+ if (write(seqfd, (char*)(patchx), len)==-1) \
+ perror("Write patch: /dev/sequencer");}
+# define SEQ_WRPATCH2(patchx, len) \
+ (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
+#endif
+
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/sparc-ioctl.h b/mdk-stage1/dietlibc/include/sys/sparc-ioctl.h
new file mode 100644
index 000000000..07b502465
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/sparc-ioctl.h
@@ -0,0 +1,172 @@
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 8
+#define _IOC_RESVBITS 5
+#define _IOC_DIRBITS 3
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_RESVMASK ((1 << _IOC_RESVBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT + _IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT + _IOC_TYPEBITS)
+#define _IOC_RESVSHIFT (_IOC_SIZESHIFT + _IOC_SIZEBITS)
+#define _IOC_DIRSHIFT (_IOC_RESVSHIFT + _IOC_RESVBITS)
+
+#define _IOC_NONE 1U
+#define _IOC_READ 2U
+#define _IOC_WRITE 4U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the PCMCIA... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+/* Big T */
+#define TCGETA _IOR('T', 1, struct termio)
+#define TCSETA _IOW('T', 2, struct termio)
+#define TCSETAW _IOW('T', 3, struct termio)
+#define TCSETAF _IOW('T', 4, struct termio)
+#define TCSBRK _IO('T', 5)
+#define TCXONC _IO('T', 6)
+#define TCFLSH _IO('T', 7)
+#define TCGETS _IOR('T', 8, struct termios)
+#define TCSETS _IOW('T', 9, struct termios)
+#define TCSETSW _IOW('T', 10, struct termios)
+#define TCSETSF _IOW('T', 11, struct termios)
+
+/* Note that all the ioctls that are not available in Linux have a
+ * double underscore on the front to: a) avoid some programs to
+ * thing we support some ioctls under Linux (autoconfiguration stuff)
+ */
+/* Little t */
+#define TIOCGETD _IOR('t', 0, int)
+#define TIOCSETD _IOW('t', 1, int)
+#define __TIOCHPCL _IO('t', 2) /* SunOS Specific */
+#define __TIOCMODG _IOR('t', 3, int) /* SunOS Specific */
+#define __TIOCMODS _IOW('t', 4, int) /* SunOS Specific */
+#define __TIOCGETP _IOR('t', 8, struct sgttyb) /* SunOS Specific */
+#define __TIOCSETP _IOW('t', 9, struct sgttyb) /* SunOS Specific */
+#define __TIOCSETN _IOW('t', 10, struct sgttyb) /* SunOS Specific */
+#define TIOCEXCL _IO('t', 13)
+#define TIOCNXCL _IO('t', 14)
+#define __TIOCFLUSH _IOW('t', 16, int) /* SunOS Specific */
+#define __TIOCSETC _IOW('t', 17, struct tchars) /* SunOS Specific */
+#define __TIOCGETC _IOR('t', 18, struct tchars) /* SunOS Specific */
+#define __TIOCTCNTL _IOW('t', 32, int) /* SunOS Specific */
+#define __TIOCSIGNAL _IOW('t', 33, int) /* SunOS Specific */
+#define __TIOCSETX _IOW('t', 34, int) /* SunOS Specific */
+#define __TIOCGETX _IOR('t', 35, int) /* SunOS Specific */
+#define TIOCCONS _IO('t', 36)
+#define __TIOCSSIZE _IOW('t', 37, struct sunos_ttysize) /* SunOS Specific */
+#define __TIOCGSIZE _IOR('t', 38, struct sunos_ttysize) /* SunOS Specific */
+#define TIOCGSOFTCAR _IOR('t', 100, int)
+#define TIOCSSOFTCAR _IOW('t', 101, int)
+#define __TIOCUCNTL _IOW('t', 102, int) /* SunOS Specific */
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+#define __TIOCREMOTE _IOW('t', 105, int) /* SunOS Specific */
+#define TIOCMGET _IOR('t', 106, int)
+#define TIOCMBIC _IOW('t', 107, int)
+#define TIOCMBIS _IOW('t', 108, int)
+#define TIOCMSET _IOW('t', 109, int)
+#define __TIOCSTART _IO('t', 110) /* SunOS Specific */
+#define __TIOCSTOP _IO('t', 111) /* SunOS Specific */
+#define TIOCPKT _IOW('t', 112, int)
+#define TIOCNOTTY _IO('t', 113)
+#define TIOCSTI _IOW('t', 114, char)
+#define TIOCOUTQ _IOR('t', 115, int)
+#define __TIOCGLTC _IOR('t', 116, struct ltchars) /* SunOS Specific */
+#define __TIOCSLTC _IOW('t', 117, struct ltchars) /* SunOS Specific */
+/* 118 is the non-posix setpgrp tty ioctl */
+/* 119 is the non-posix getpgrp tty ioctl */
+#define __TIOCCDTR _IO('t', 120) /* SunOS Specific */
+#define __TIOCSDTR _IO('t', 121) /* SunOS Specific */
+#define TIOCCBRK _IO('t', 122)
+#define TIOCSBRK _IO('t', 123)
+#define __TIOCLGET _IOW('t', 124, int) /* SunOS Specific */
+#define __TIOCLSET _IOW('t', 125, int) /* SunOS Specific */
+#define __TIOCLBIC _IOW('t', 126, int) /* SunOS Specific */
+#define __TIOCLBIS _IOW('t', 127, int) /* SunOS Specific */
+#define __TIOCISPACE _IOR('t', 128, int) /* SunOS Specific */
+#define __TIOCISIZE _IOR('t', 129, int) /* SunOS Specific */
+#define TIOCSPGRP _IOW('t', 130, int)
+#define TIOCGPGRP _IOR('t', 131, int)
+#define TIOCSCTTY _IO('t', 132)
+#define TIOCGSID _IOR('t', 133, int)
+/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
+#define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */
+#define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */
+
+/* Little f */
+#define FIOCLEX _IO('f', 1)
+#define FIONCLEX _IO('f', 2)
+#define FIOASYNC _IOW('f', 125, int)
+#define FIONBIO _IOW('f', 126, int)
+#define FIONREAD _IOR('f', 127, int)
+#define TIOCINQ FIONREAD
+#define FIOQSIZE _IOR('f', 128, loff_t)
+
+/* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it
+ * someday. This is completely bogus, I know...
+ */
+#define __TCGETSTAT _IO('T', 200) /* Rutgers specific */
+#define __TCSETSTAT _IO('T', 201) /* Rutgers specific */
+
+/* Linux specific, no SunOS equivalent. */
+#define TIOCLINUX 0x541C
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TCSBRKP 0x5425
+#define TIOCTTYGSTRUCT 0x5426
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
+#define TIOCSERGETLSR 0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+#define TIOCMIWAIT 0x545C /* Wait input */
+#define TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+/* Socket-level I/O control calls. */
+#define FIOSETOWN 0x8901
+#define SIOCSPGRP 0x8902
+#define FIOGETOWN 0x8903
+#define SIOCGPGRP 0x8904
+#define SIOCATMARK 0x8905
+#define SIOCGSTAMP 0x8906 /* Get stamp */
+
diff --git a/mdk-stage1/dietlibc/include/sys/stat.h b/mdk-stage1/dietlibc/include/sys/stat.h
index 10fddfa42..d31cbd1f2 100644
--- a/mdk-stage1/dietlibc/include/sys/stat.h
+++ b/mdk-stage1/dietlibc/include/sys/stat.h
@@ -3,30 +3,499 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <endian.h>
-#include <linux/stat.h>
-#include <asm/stat.h>
+#if defined(__i386__)
+struct stat {
+ unsigned short st_dev;
+ unsigned short __pad1;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned short __pad2;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ signed long st_atime;
+ unsigned long __unused1;
+ signed long st_mtime;
+ unsigned long __unused2;
+ signed long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+struct stat64 {
+ unsigned short st_dev;
+ unsigned char __pad0[10];
+
+#define STAT64_HAS_BROKEN_ST_INO 1
+ unsigned long __st_ino;
+
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned long st_uid;
+ unsigned long st_gid;
+
+ unsigned short st_rdev;
+ unsigned char __pad3[10];
+
+__extension__ long long st_size;
+ unsigned long st_blksize;
+
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+ unsigned long __pad4; /* future possible st_blocks high bits */
+
+ unsigned long st_atime;
+ unsigned long __pad5;
+
+ signed long st_mtime;
+ unsigned long __pad6;
+
+ unsigned long st_ctime;
+ unsigned long __pad7; /* will be high 32 bits of ctime someday */
+
+__extension__ unsigned long long st_ino;
+};
+#elif defined(__sparc__)
+struct stat {
+ unsigned short st_dev;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ long st_size;
+ long st_atime;
+ unsigned long __unused1;
+ long st_mtime;
+ unsigned long __unused2;
+ long st_ctime;
+ unsigned long __unused3;
+ long st_blksize;
+ long st_blocks;
+ unsigned long __unused4[2];
+};
+
+struct stat64 {
+ unsigned char __pad0[6];
+ unsigned short st_dev;
+
+__extension__ unsigned long long st_ino;
+
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned int st_uid;
+ unsigned int st_gid;
+
+ unsigned char __pad2[6];
+ unsigned short st_rdev;
+
+ unsigned char __pad3[8];
+
+__extension__ long long st_size;
+ unsigned int st_blksize;
+
+ unsigned char __pad4[8];
+ unsigned int st_blocks;
+
+ signed int st_atime;
+ unsigned int __unused1;
+
+ signed int st_mtime;
+ unsigned int __unused2;
+
+ signed int st_ctime;
+ unsigned int __unused3;
+
+ unsigned int __unused4;
+ unsigned int __unused5;
+};
+#elif defined(__alpha__)
+struct stat {
+ unsigned int st_dev;
+ unsigned int st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int st_rdev;
+ long st_size;
+ signed long st_atime;
+ signed long st_mtime;
+ signed long st_ctime;
+ unsigned int st_blksize;
+ int st_blocks;
+ unsigned int st_flags;
+ unsigned int st_gen;
+};
+#elif defined(__mips__)
+struct stat {
+ unsigned int st_dev;
+ long st_pad1[3]; /* Reserved for network id */
+ ino_t st_ino;
+ unsigned int st_mode;
+ int st_nlink;
+ int st_uid;
+ int st_gid;
+ unsigned int st_rdev;
+ long st_pad2[2];
+ long st_size;
+ long st_pad3;
+ /*
+ * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
+ * but we don't have it under Linux.
+ */
+ time_t st_atime;
+ long reserved0;
+ time_t st_mtime;
+ long reserved1;
+ time_t st_ctime;
+ long reserved2;
+ long st_blksize;
+ long st_blocks;
+ char st_fstype[16]; /* Filesystem type name */
+ long st_pad4[8];
+ /* Linux specific fields */
+ unsigned int st_flags;
+ unsigned int st_gen;
+};
+
+struct stat64 {
+ unsigned long st_dev;
+ unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
+__extension__ unsigned long long st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned long st_rdev;
+ unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
+__extension__ long long st_size;
+ /*
+ * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
+ * but we don't have it under Linux.
+ */
+ time_t st_atime;
+ unsigned long reserved0; /* Reserved for st_atime expansion */
+ time_t st_mtime;
+ unsigned long reserved1; /* Reserved for st_atime expansion */
+ time_t st_ctime;
+ unsigned long reserved2; /* Reserved for st_atime expansion */
+ unsigned long st_blksize;
+ unsigned long st_pad2;
+__extension__ long long st_blocks;
+};
+#elif defined(__powerpc__)
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ signed long st_atime;
+ unsigned long __unused1;
+ signed long st_mtime;
+ unsigned long __unused2;
+ signed long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+/* This matches struct stat64 in glibc2.1.
+ */
+struct stat64 {
+__extension__ unsigned long long st_dev; /* Device. */
+__extension__ unsigned long long st_ino; /* File serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned int st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group. */
+__extension__ unsigned long long st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+__extension__ long long st_size; /* Size of file, in bytes. */
+ long st_blksize; /* Optimal block size for I/O. */
+
+__extension__ long long st_blocks; /* Number 512-byte blocks allocated. */
+ long st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ long st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ long st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+};
+#elif defined(__arm__)
+struct stat {
+ unsigned short st_dev;
+ unsigned short __pad1;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned short __pad2;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ signed long st_atime;
+ unsigned long __unused1;
+ signed long st_mtime;
+ unsigned long __unused2;
+ signed long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+/* This matches struct stat64 in glibc2.1, hence the absolutely
+ * insane amounts of padding around dev_t's.
+ */
+struct stat64 {
+ unsigned short st_dev;
+ unsigned char __pad0[10];
+
+#define STAT64_HAS_BROKEN_ST_INO 1
+ unsigned long __st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned long st_uid;
+ unsigned long st_gid;
+
+ unsigned short st_rdev;
+ unsigned char __pad3[10];
+
+__extension__ long long st_size;
+ unsigned long st_blksize;
+
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+ unsigned long __pad4; /* future possible st_blocks high bits */
+
+ signed long st_atime;
+ unsigned long __pad5;
+
+ signed long st_mtime;
+ unsigned long __pad6;
+
+ signed long st_ctime;
+ unsigned long __pad7; /* will be high 32 bits of ctime someday */
+
+__extension__ unsigned long long st_ino;
+};
+#elif defined(__s390__)
+struct stat {
+ unsigned short st_dev;
+ unsigned short __pad1;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned short __pad2;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long __unused1;
+ unsigned long st_mtime;
+ unsigned long __unused2;
+ unsigned long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+struct stat64 {
+ unsigned char __pad0[6];
+ unsigned short st_dev;
+ unsigned int __pad1;
+#define STAT64_HAS_BROKEN_ST_INO 1
+ unsigned long __st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned long st_uid;
+ unsigned long st_gid;
+ unsigned char __pad2[6];
+ unsigned short st_rdev;
+ unsigned int __pad3;
+__extension__ long long st_size;
+ unsigned long st_blksize;
+ unsigned char __pad4[4];
+ unsigned long __pad5; /* future possible st_blocks high bits */
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+ unsigned long st_atime;
+ unsigned long __pad6;
+ unsigned long st_mtime;
+ unsigned long __pad7;
+ unsigned long st_ctime;
+ unsigned long __pad8; /* will be high 32 bits of ctime someday */
+__extension__ unsigned long long st_ino;
+};
+
+#elif defined(__hppa__)
+
+struct stat {
+ unsigned long long st_dev;
+ unsigned short int _pad1;
+ unsigned long st_ino;
+ unsigned long st_mode;
+ unsigned long st_nlink;
+ unsigned long st_uid;
+ unsigned long st_gid;
+ unsigned long long st_rdev;
+ unsigned short int _pad2;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long int unused1;
+ unsigned long st_mtime;
+ unsigned long int unused2;
+ unsigned long st_ctime;
+ unsigned long int unused3;
+ unsigned long long unused4;
+};
+
+struct stat64 {
+ unsigned long long st_dev;
+ unsigned int __pad1;
+#define STAT64_HAS_BROKEN_ST_INO 1
+ unsigned long __st_ino;
+ unsigned long st_mode;
+ unsigned long st_nlink;
+ unsigned long st_uid;
+ unsigned long st_gid;
+ unsigned long long st_rdev;
+ unsigned int __pad2;
+ unsigned long long st_size;
+ unsigned long long st_blksize;
+
+ unsigned long long st_blocks;
+ unsigned long st_atime;
+ unsigned long int __unused1;
+ unsigned long st_mtime;
+ unsigned long int __unused2;
+ unsigned long st_ctime;
+ unsigned long int __unused3;
+ unsigned long long st_ino;
+};
+
+#elif defined(__x86_64__)
+struct stat {
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned long st_nlink;
+ unsigned int st_mode;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int __pad0;
+ unsigned long st_rdev;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long __reserved0;
+ unsigned long st_mtime;
+ unsigned long __reserved1;
+ unsigned long st_ctime;
+ unsigned long __reserved2;
+ long __unused[3];
+};
+
+#elif defined(__ia64__)
+
+struct stat {
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned long st_nlink;
+ unsigned int st_mode;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int __pad;
+ unsigned long st_rdev;
+ unsigned long st_size;
+ unsigned long st_atime;
+ unsigned long reserved;
+ unsigned long st_mtime;
+ unsigned long reserved2;
+ unsigned long st_ctime;
+ unsigned long reserved3;
+ unsigned long st_blksize;
+ long st_blocks;
+ unsigned long pad[3];
+};
-#ifndef STAT64_HAS_BROKEN_ST_INO
-#define __NO_STAT64
#endif
+#define S_IFMT 00170000
+#define S_IFSOCK 0140000
+#define S_IFLNK 0120000
+#define S_IFREG 0100000
+#define S_IFBLK 0060000
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
+
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+
+#define S_IRWXU 00700
+#define S_IRUSR 00400
+#define S_IWUSR 00200
+#define S_IXUSR 00100
+
+#define S_IRWXG 00070
+#define S_IRGRP 00040
+#define S_IWGRP 00020
+#define S_IXGRP 00010
+
+#define S_IRWXO 00007
+#define S_IROTH 00004
+#define S_IWOTH 00002
+#define S_IXOTH 00001
+
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
+#if __WORDSIZE == 64
+#define __NO_STAT64
#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)
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+#define lstat lstat64
+#define fstat fstat64
#define stat stat64
+#define pread pread64
+#define pwrite pwrite64
+#endif
#endif
#define major(dev) (((dev)>>8) & 0xff)
@@ -34,15 +503,10 @@ extern int lstat64(const char *__file, struct stat64 *__buf) __THROW;
#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
diff --git a/mdk-stage1/dietlibc/include/sys/sysinfo.h b/mdk-stage1/dietlibc/include/sys/sysinfo.h
index 5f059d469..cf88be34c 100644
--- a/mdk-stage1/dietlibc/include/sys/sysinfo.h
+++ b/mdk-stage1/dietlibc/include/sys/sysinfo.h
@@ -2,7 +2,25 @@
#define _SYS_SYSINFO_H
#include <sys/cdefs.h>
-#include <linux/kernel.h>
+
+#define SI_LOAD_SHIFT 16
+struct sysinfo {
+ long uptime; /* Seconds since boot */
+ unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
+ unsigned long totalram; /* Total usable main memory size */
+ unsigned long freeram; /* Available memory size */
+ unsigned long sharedram; /* Amount of shared memory */
+ unsigned long bufferram; /* Memory used by buffers */
+ unsigned long totalswap; /* Total swap space size */
+ unsigned long freeswap; /* swap space still available */
+ unsigned short procs; /* Number of current processes */
+ unsigned short pad; /* explicit padding */
+ unsigned long totalhigh; /* Total high memory size */
+ unsigned long freehigh; /* Available high memory size */
+ unsigned int mem_unit; /* Memory unit size in bytes */
+ char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
+};
+
int sysinfo(struct sysinfo *info) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sys/syslog.h b/mdk-stage1/dietlibc/include/sys/syslog.h
index 91bf0d1fa..8722038a5 100644
--- a/mdk-stage1/dietlibc/include/sys/syslog.h
+++ b/mdk-stage1/dietlibc/include/sys/syslog.h
@@ -92,7 +92,7 @@ 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;
+ const char *const c_name;
int c_val;
} CODE;
diff --git a/mdk-stage1/dietlibc/include/sys/sysmacros.h b/mdk-stage1/dietlibc/include/sys/sysmacros.h
new file mode 100644
index 000000000..8a8124131
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/sysmacros.h
@@ -0,0 +1,6 @@
+#ifndef _SYSMACROS_H
+#define _SYSMACROS_H
+
+#include <sys/stat.h>
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/time.h b/mdk-stage1/dietlibc/include/sys/time.h
index 11144f57b..9fc40089f 100644
--- a/mdk-stage1/dietlibc/include/sys/time.h
+++ b/mdk-stage1/dietlibc/include/sys/time.h
@@ -2,11 +2,39 @@
#define _SYS_TIME_H 1
#include <sys/cdefs.h>
-
#include <sys/types.h>
-#include <linux/time.h>
+#include <sys/select.h>
+
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+
+struct timeval {
+ time_t tv_sec; /* seconds */
+ suseconds_t tv_usec; /* microseconds */
+};
+
+struct timezone {
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF 2
-#if defined __USE_GNU || defined __USE_BSD
+struct itimerspec {
+ struct timespec it_interval; /* timer period */
+ struct timespec it_value; /* timer expiration */
+};
+
+struct itimerval {
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+};
+
+#if defined _GNU_SOURCE || defined _BSD_SOURCE
typedef struct timezone *__timezone_ptr_t;
#else
typedef void *__timezone_ptr_t;
@@ -18,17 +46,17 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
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;
+extern int utimes (const char *__file, const struct timeval __tvp[2]) __THROW;
-struct tm
-{
+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_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]*/
@@ -37,10 +65,4 @@ struct tm
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/timeb.h b/mdk-stage1/dietlibc/include/sys/timeb.h
new file mode 100644
index 000000000..ceed377e7
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/timeb.h
@@ -0,0 +1,13 @@
+#ifndef __SYS_TIMEB_H
+#define __SYS_TIMEB_H 1
+
+struct timeb {
+ time_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+};
+
+int ftime(struct timeb *tp);
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/times.h b/mdk-stage1/dietlibc/include/sys/times.h
index 72ec62fec..27f75cdc5 100644
--- a/mdk-stage1/dietlibc/include/sys/times.h
+++ b/mdk-stage1/dietlibc/include/sys/times.h
@@ -1,8 +1,16 @@
#ifndef _SYS_TIMES_H
#define _SYS_TIMES_H
-#include <linux/times.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
-clock_t times(struct tms *buf);
+struct tms {
+ clock_t tms_utime;
+ clock_t tms_stime;
+ clock_t tms_cutime;
+ clock_t tms_cstime;
+};
+
+clock_t times(struct tms *buf) __THROW;
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/timex.h b/mdk-stage1/dietlibc/include/sys/timex.h
new file mode 100644
index 000000000..cf024e009
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/timex.h
@@ -0,0 +1,50 @@
+#ifndef _SYS_TIMEX_H
+#define _SYS_TIMEX_H
+
+struct timex {
+ unsigned int modes; /* mode selector */
+ long int offset; /* time offset (usec) */
+ long int freq; /* frequency offset (scaled ppm) */
+ long int maxerror; /* maximum error (usec) */
+ long int esterror; /* estimated error (usec) */
+ int status; /* clock command/status */
+ long int constant; /* pll time constant */
+ long int precision; /* clock precision (usec) (read only) */
+ long int tolerance; /* clock frequency tolerance (ppm) (read only) */
+ struct timeval time; /* (read only) */
+ long int tick; /* (modified) usecs between clock ticks */
+
+ long int ppsfreq; /* pps frequency (scaled ppm) (ro) */
+ long int jitter; /* pps jitter (us) (ro) */
+ int shift; /* interval duration (s) (shift) (ro) */
+ long int stabil; /* pps stability (scaled ppm) (ro) */
+ long int jitcnt; /* jitter limit exceeded (ro) */
+ long int calcnt; /* calibration intervals (ro) */
+ long int errcnt; /* calibration errors (ro) */
+ long int stbcnt; /* stability limit exceeded (ro) */
+
+ /* ??? */
+ int :32; int :32; int :32; int :32;
+ int :32; int :32; int :32; int :32;
+ int :32; int :32; int :32; int :32;
+};
+
+#define ADJ_OFFSET 0x0001 /* time offset */
+#define ADJ_FREQUENCY 0x0002 /* frequency offset */
+#define ADJ_MAXERROR 0x0004 /* maximum time error */
+#define ADJ_ESTERROR 0x0008 /* estimated time error */
+#define ADJ_STATUS 0x0010 /* clock status */
+#define ADJ_TIMECONST 0x0020 /* pll time constant */
+#define ADJ_TICK 0x4000 /* tick value */
+#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
+
+#define TIME_OK 0 /* clock synchronized */
+#define TIME_INS 1 /* insert leap second */
+#define TIME_DEL 2 /* delete leap second */
+#define TIME_OOP 3 /* leap second in progress */
+#define TIME_WAIT 4 /* leap second has occurred */
+#define TIME_BAD 5 /* clock not synchronized */
+
+int adjtimex(struct timex *buf);
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/types.h b/mdk-stage1/dietlibc/include/sys/types.h
index 34dbaa9f1..a3d2bf4be 100644
--- a/mdk-stage1/dietlibc/include/sys/types.h
+++ b/mdk-stage1/dietlibc/include/sys/types.h
@@ -1,33 +1,133 @@
#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;
+#include <inttypes.h>
+#include <stddef.h>
+
+typedef unsigned long int blkcnt_t; /* Used for file block counts */
+typedef unsigned long int blksize_t; /* Used for block sizes */
+typedef unsigned long int clock_t; /* Used for system times in
+ clock ticks or CLOCKS_PER_SEC
+ (see <time.h>). */
+
+/* TODO:
+ clockid_t
+ Used for clock ID type in the clock and timer functions.
+ fsblkcnt_t
+ Used for file system block counts
+ fsfilcnt_t
+ Used for file system file counts
+ pthread_attr_t
+ Used to identify a thread attribute object.
+ pthread_cond_t
+ Used for condition variables.
+ pthread_condattr_t
+ Used to identify a condition attribute object.
+ pthread_key_t
+ Used for thread-specific data keys.
+ pthread_mutex_t
+ Used for mutexes.
+ pthread_mutexattr_t
+ Used to identify a mutex attribute object.
+ pthread_once_t
+ Used for dynamic package initialisation.
+ pthread_rwlock_t
+ Used for read-write locks.
+ pthread_rwlockattr_t
+ Used for read-write lock attributes.
+ pthread_t
+ Used to identify a thread.
+ timer_t
+ Used for timer ID returned by timer_create().
+*/
+
+#if defined(__alpha__) || defined(__mips__) || defined(__powerpc__) || defined(__hppa__) || defined(__sparc64__) \
+ || defined(__x86_64__) || defined(__ia64__)
+typedef unsigned int uid_t; /* Used for user IDs. */
+typedef unsigned int gid_t; /* Used for group IDs. */
+typedef unsigned int dev_t; /* Used for device IDs. */
#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;
+typedef unsigned short uid_t; /* Used for user IDs. */
+typedef unsigned short gid_t; /* Used for group IDs. */
+typedef unsigned short dev_t; /* Used for device IDs. */
#endif
+#if defined(__alpha__) || defined(__mips__) || defined(__powerpc__) || defined(__sparc64__) \
+ || defined(__x86_64__) || defined(__ia64__)
+typedef unsigned int mode_t; /* Used for some file attributes. */
+#else
+typedef unsigned short mode_t; /* Used for some file attributes. */
+#endif
-#ifdef __quad_t
-typedef __quad_t off64_t;
-typedef __u_quad_t ino64_t;
-typedef __quad_t blkcnt64_t;
+#if defined(__alpha__) || defined(__mips__) || defined(__sparc64__) \
+ || defined(__x86_64__) || defined(__ia64__)
+typedef unsigned int nlink_t; /* Used for link counts. */
+#else
+typedef unsigned short nlink_t; /* Used for link counts. */
#endif
+typedef signed int id_t; /* Used as a general identifier; can be
+ used to contain at least a pid_t,
+ uid_t or a gid_t. */
+typedef unsigned long ino_t; /* Used for file serial numbers. */
+typedef signed int key_t; /* Used for interprocess communication. */
+typedef signed int pid_t; /* Used for process IDs and process group IDs. */
+typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */
+typedef signed long suseconds_t; /* Used for time in microseconds. */
+typedef signed long time_t; /* Used for time in seconds. */
+typedef signed long useconds_t; /* Used for time in microseconds. */
+
+/* non-susv2 types: */
+__extension__ typedef signed long long loff_t; /* 64-bit offset */
+
+__extension__ typedef signed long long off64_t;
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+typedef off64_t off_t;
+#else
+typedef signed long off_t; /* Used for file sizes. */
+#endif
+
+__extension__ typedef unsigned long long ino64_t;
+__extension__ typedef signed long long blkcnt64_t;
+
+typedef uint32_t uid32_t;
+typedef uint32_t gid32_t;
+
typedef long int fpos_t;
-#define socklen_t socklen_t
+#define __socklen_t_defined
typedef unsigned int socklen_t;
+typedef unsigned short sa_family_t;
-typedef long int blksize_t;
-typedef long int blkcnt_t;
+#ifdef _BSD_SOURCE
+/* die, BSD, die! */
+typedef uint16_t nshort;
+typedef uint32_t ntime;
+typedef uint32_t nlong;
+typedef uint32_t ulong;
+typedef uint16_t n_short;
+typedef uint32_t n_time;
+typedef uint32_t n_long;
+# ifndef __dietlibc_u_char_defined
+typedef char* caddr_t;
+typedef uint32_t u_long;
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+# define __dietlibc_u_char_defined
+# endif
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+#endif
+
+#ifdef _GNU_SOURCE
+typedef uint8_t u_int8_t;
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+#ifndef __STRICT_ANSI__
+typedef uint64_t u_int64_t;
+#endif
+#endif
#endif
diff --git a/mdk-stage1/dietlibc/include/sys/ucontext.h b/mdk-stage1/dietlibc/include/sys/ucontext.h
new file mode 100644
index 000000000..573c6c7fb
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sys/ucontext.h
@@ -0,0 +1,110 @@
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H
+
+#include <asm/sigcontext.h>
+#include <signal.h>
+
+typedef struct sigcontext mcontext_t;
+
+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__mips64__) || defined(__powerpc__) || defined(__hppa__)
+struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext *uc_link;
+ stack_t uc_stack;
+ struct sigcontext uc_mcontext;
+ sigset_t uc_sigmask; /* mask last for extensibility */
+};
+#elif defined(__alpha__)
+struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext *uc_link;
+ unsigned long uc_osf_sigmask;
+ stack_t uc_stack;
+ struct sigcontext uc_mcontext;
+ sigset_t uc_sigmask; /* mask last for extensibility */
+};
+#elif defined(__sparc__) || defined(__sparc64__)
+
+#define MC_TSTATE 0
+#define MC_PC 1
+#define MC_NPC 2
+#define MC_Y 3
+#define MC_G1 4
+#define MC_G2 5
+#define MC_G3 6
+#define MC_G4 7
+#define MC_G5 8
+#define MC_G6 9
+#define MC_G7 10
+#define MC_O0 11
+#define MC_O1 12
+#define MC_O2 13
+#define MC_O3 14
+#define MC_O4 15
+#define MC_O5 16
+#define MC_O6 17
+#define MC_O7 18
+#define MC_NGREG 19
+
+typedef unsigned long mc_greg_t;
+typedef mc_greg_t mc_gregset_t[MC_NGREG];
+
+#define MC_MAXFPQ 16
+struct mc_fq {
+ unsigned long *mcfq_addr;
+ unsigned int mcfq_insn;
+};
+
+typedef struct mc_fpu {
+ union {
+ unsigned int sregs[32];
+ unsigned long dregs[32];
+ long double qregs[16];
+ } mcfpu_fregs;
+ unsigned long mcfpu_fsr;
+ unsigned long mcfpu_fprs;
+ unsigned long mcfpu_gsr;
+ struct mc_fq *mcfpu_fq;
+ unsigned char mcfpu_qcnt;
+ unsigned char mcfpu_qentsz;
+ unsigned char mcfpu_enab;
+} mc_fpu_t;
+
+typedef struct {
+ mc_gregset_t mc_gregs;
+ mc_greg_t mc_fp;
+ mc_greg_t mc_i7;
+ mc_fpu_t mc_fpregs;
+} mcontext_t;
+
+struct ucontext {
+ struct ucontext *uc_link;
+ unsigned long uc_flags;
+ sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+};
+#elif defined(__s390__)
+struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext *uc_link;
+ stack_t uc_stack;
+ _sigregs uc_mcontext;
+ sigset_t uc_sigmask; /* mask last for extensibility */
+};
+#elif defined(__ia64__)
+
+/* oh my god is this ugly! --fefe*/
+struct ucontext {
+ struct sigcontext uc_mcontext;
+};
+
+#define uc_link uc_mcontext.sc_gr[0] /* wrong type; nobody cares */
+#define uc_sigmask uc_mcontext.sc_sigmask
+#define uc_stack uc_mcontext.sc_stack
+#else
+#error NEED TO PORT <sys/sigcontext.h>!
+#endif
+
+typedef struct ucontext ucontext_t;
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/sys/uio.h b/mdk-stage1/dietlibc/include/sys/uio.h
index d64fd33c9..5edbdc8b2 100644
--- a/mdk-stage1/dietlibc/include/sys/uio.h
+++ b/mdk-stage1/dietlibc/include/sys/uio.h
@@ -1,7 +1,7 @@
#ifndef _SYS_UIO
#define _SYS_UIO 1
-#include <linux/uio.h>
+#include <sys/socket.h>
int readv(int filedes, const struct iovec *vector, size_t count);
int writev(int filedes, const struct iovec *vector, size_t count);
diff --git a/mdk-stage1/dietlibc/include/sys/un.h b/mdk-stage1/dietlibc/include/sys/un.h
index 213d9290e..000a937c1 100644
--- a/mdk-stage1/dietlibc/include/sys/un.h
+++ b/mdk-stage1/dietlibc/include/sys/un.h
@@ -3,6 +3,11 @@
#include <sys/cdefs.h>
-#include <linux/un.h>
+#define UNIX_PATH_MAX 108
+
+struct sockaddr_un {
+ sa_family_t sun_family; /* AF_UNIX */
+ char sun_path[UNIX_PATH_MAX]; /* pathname */
+};
#endif /* sys/un.h */
diff --git a/mdk-stage1/dietlibc/include/sys/vfs.h b/mdk-stage1/dietlibc/include/sys/vfs.h
index e4740a225..19b3242bb 100644
--- a/mdk-stage1/dietlibc/include/sys/vfs.h
+++ b/mdk-stage1/dietlibc/include/sys/vfs.h
@@ -3,7 +3,31 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#include <linux/vfs.h>
+
+typedef struct {
+ int __val[2];
+} __kernel_fsid_t;
+
+struct statfs {
+ long f_type;
+ long f_bsize;
+#ifdef __mips__
+ long f_frsize;
+#endif
+ long f_blocks;
+ long f_bfree;
+#ifndef __mips__
+ long f_bavail;
+#endif
+ long f_files;
+ long f_ffree;
+#ifdef __mips__
+ long f_bavail;
+#endif
+ __kernel_fsid_t f_fsid;
+ long f_namelen;
+ long f_spare[6];
+};
int statfs(const char *path, struct statfs *buf) __THROW;
int fstatfs(int fd, struct statfs *buf) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sys/wait.h b/mdk-stage1/dietlibc/include/sys/wait.h
index eb70112e2..0ba55499e 100644
--- a/mdk-stage1/dietlibc/include/sys/wait.h
+++ b/mdk-stage1/dietlibc/include/sys/wait.h
@@ -3,7 +3,13 @@
#include <sys/cdefs.h>
#include <sys/resource.h>
-#include <linux/wait.h>
+
+#define WNOHANG 0x00000001
+#define WUNTRACED 0x00000002
+
+#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */
+#define __WALL 0x40000000 /* Wait on all children, regardless of type */
+#define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */
/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
@@ -26,6 +32,8 @@
/* Nonzero if STATUS indicates the child is stopped. */
#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
+/* Nonzero if STATUS indicates the child dumped core. */
+#define WCOREDUMP(status) ((status) & 0x80)
pid_t wait(int *status) __THROW;
pid_t waitpid(pid_t pid, int *status, int options) __THROW;
diff --git a/mdk-stage1/dietlibc/include/sysexits.h b/mdk-stage1/dietlibc/include/sysexits.h
new file mode 100644
index 000000000..5540795ff
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/sysexits.h
@@ -0,0 +1,26 @@
+#ifndef _SYSEXITS_H
+#define _SYSEXITS_H 1
+
+#define EX_OK 0
+
+#define EX__BASE 64
+
+#define EX_USAGE 64
+#define EX_DATAERR 65
+#define EX_NOINPUT 66
+#define EX_NOUSER 67
+#define EX_NOHOST 68
+#define EX_UNAVAILABLE 69
+#define EX_SOFTWARE 70
+#define EX_OSERR 71
+#define EX_OSFILE 72
+#define EX_CANTCREAT 73
+#define EX_IOERR 74
+#define EX_TEMPFAIL 75
+#define EX_PROTOCOL 76
+#define EX_NOPERM 77
+#define EX_CONFIG 78
+
+#define EX__MAX 78
+
+#endif
diff --git a/mdk-stage1/dietlibc/include/tar.h b/mdk-stage1/dietlibc/include/tar.h
new file mode 100644
index 000000000..a78bbce54
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/tar.h
@@ -0,0 +1,36 @@
+#ifndef _TAR_H_
+#define _TAR_H_
+
+#define TMAGIC "ustar"
+#define TVERSION "00"
+
+#define TMAGLEN 6
+#define TVERSLEN 2
+
+#define REGTYPE '0'
+#define AREGTYPE '\0'
+#define LNKTYPE '1'
+#define SYMTYPE '2'
+#define CHRTYPE '3'
+#define BLKTYPE '4'
+#define DIRTYPE '5'
+#define FIFOTYPE '6'
+#define CONTTYPE '7'
+
+#define TSUID 04000
+#define TSGID 02000
+#define TSVTX 01000
+
+#define TUREAD 00400
+#define TUWRITE 00200
+#define TUEXEC 00100
+
+#define TGREAD 00040
+#define TGWRITE 00020
+#define TGEXEC 00010
+
+#define TOREAD 00004
+#define TOWRITE 00002
+#define TOEXEC 00001
+
+#endif /* _TAR_H_ */
diff --git a/mdk-stage1/dietlibc/include/termio.h b/mdk-stage1/dietlibc/include/termio.h
new file mode 100644
index 000000000..55d1f242b
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/termio.h
@@ -0,0 +1,4 @@
+/* this looks horribly wrong, but glibc does it like that */
+
+#include <termios.h>
+#include <sys/ioctl.h>
diff --git a/mdk-stage1/dietlibc/include/termios.h b/mdk-stage1/dietlibc/include/termios.h
index f10909c1b..12e02c5d7 100644
--- a/mdk-stage1/dietlibc/include/termios.h
+++ b/mdk-stage1/dietlibc/include/termios.h
@@ -4,19 +4,380 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-/* man, the Linux kernel headers suck */
-#define __USE_BSD
-#include <linux/termios.h>
-#undef __USE_BSD
+struct winsize {
+ unsigned short ws_row;
+ unsigned short ws_col;
+ unsigned short ws_xpixel;
+ unsigned short ws_ypixel;
+};
+
+#define NCC 8
+struct termio {
+ unsigned short c_iflag; /* input mode flags */
+ unsigned short c_oflag; /* output mode flags */
+ unsigned short c_cflag; /* control mode flags */
+ unsigned short c_lflag; /* local mode flags */
+ unsigned char c_line; /* line discipline */
+ unsigned char c_cc[NCC]; /* control characters */
+};
+
+/* modem lines */
+#ifdef __mips__
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x010
+#define TIOCM_SR 0x020
+#define TIOCM_CTS 0x040
+#define TIOCM_CAR 0x100
+#define TIOCM_RNG 0x200
+#define TIOCM_DSR 0x400
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+#else
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x008
+#define TIOCM_SR 0x010
+#define TIOCM_CTS 0x020
+#define TIOCM_CAR 0x040
+#define TIOCM_RNG 0x080
+#define TIOCM_DSR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+#endif
+
+/* line disciplines */
+#define N_TTY 0
+#define N_SLIP 1
+#define N_MOUSE 2
+#define N_PPP 3
+#define N_STRIP 4
+#define N_AX25 5
+#define N_X25 6 /* X.25 async */
+#define N_6PACK 7
+#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964 9 /* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
+#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
+#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
+#define N_HDLC 13 /* synchronous HDLC */
+#define N_SYNC_PPP 14 /* synchronous PPP */
+#define N_HCI 15 /* Bluetooth HCI UART */
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define _POSIX_VDISABLE '\0'
+
+#if defined(__i386__) || defined(__arm__) || defined(__ia64__) || defined(__hppa__) || defined(__s390__) || defined(__s390x__) || defined(__x86_64__)
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+};
+#elif defined(__mips__) || defined(__mips64__)
+#define NCCS 23
+struct termios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ /*
+ * Seems nonexistent in the ABI, but Linux assumes existence ...
+ */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+};
+#elif defined(powerpc) || defined(__alpha__)
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_cc[NCCS]; /* control characters */
+ cc_t c_line; /* line discipline (== c_cc[19]) */
+ speed_t c_ispeed; /* input speed */
+ speed_t c_ospeed; /* output speed */
+};
+#elif defined(__sparc__)
+#define NCCS 17
+struct termios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+};
+#else
+# error "Struct termios undefined on your architecture"
+#endif
+
+/* c_cc characters */
+#if defined(__alpha__)
+#define VEOF 0
+#define VEOL 1
+#define VEOL2 2
+#define VERASE 3
+#define VWERASE 4
+#define VKILL 5
+#define VREPRINT 6
+#define VSWTC 7
+#define VINTR 8
+#define VQUIT 9
+#define VSUSP 10
+#define VSTART 12
+#define VSTOP 13
+#define VLNEXT 14
+#define VDISCARD 15
+#define VMIN 16
+#define VTIME 17
+#elif defined(__mips__)
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VMIN 4
+#define VTIME 5
+#define VEOL2 6
+#define VSWTC 7
+#define VSWTCH VSWTC
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOF 16
+#define VEOL 17
+#elif defined(__powerpc__)
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VMIN 5
+#define VEOL 6
+#define VTIME 7
+#define VEOL2 8
+#define VSWTC 9
+#define VWERASE 10
+#define VREPRINT 11
+#define VSUSP 12
+#define VSTART 13
+#define VSTOP 14
+#define VLNEXT 15
+#define VDISCARD 16
+#elif defined(__sparc__)
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VEOL 5
+#define VEOL2 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VDSUSP 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VMIN 16
+#define VTIME 17
+#else /* arm, i386, parisc, s390, x86_64 */
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
+#endif
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define XTABS 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+
+/* c_cflag bit meaning */
+#define CBAUD 0010017
+#define B0 0000000 /* hang up */
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+#define EXTA B19200
+#define EXTB B38400
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+#define CBAUDEX 0010000
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B500000 0010005
+#define B576000 0010006
+#define B921600 0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CMSPAR 010000000000 /* mark or space (stick) parity */
+#define CRTSCTS 020000000000 /* flow control */
+
+/* c_lflag bits */
+#define ISIG 0000001
+#define ICANON 0000002
+#define XCASE 0000004
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#ifdef __mips__
+#define IEXTEN 0000400
+#define FLUSHO 0020000
+#define TOSTOP 0100000
+#else
+#define TOSTOP 0000400
+#define FLUSHO 0010000
+#define IEXTEN 0100000
+#endif
+#define PENDIN 0040000
+
+/* tcflow() and TCXONC use these */
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+/* tcflush() and TCFLSH use these */
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+/* tcsetattr uses these */
+#ifdef __mips__
+#define TCSANOW 0x540e
+#define TCSADRAIN 0x540f
+#define TCSAFLUSH 0x5410
+#else
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+#endif
-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;
+void cfmakeraw(struct termios *t) __THROW;
+
int tcflush(int fd, int queue_selector) __THROW;
+int tcdrain(int fd) __THROW;
+int tcflow (int fd,int action) __THROW;
+int tcsendbreak (int fd,int duration) __THROW;
#endif
diff --git a/mdk-stage1/dietlibc/include/time.h b/mdk-stage1/dietlibc/include/time.h
index 827c85b97..29681fa3d 100644
--- a/mdk-stage1/dietlibc/include/time.h
+++ b/mdk-stage1/dietlibc/include/time.h
@@ -7,7 +7,6 @@
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__;
@@ -16,9 +15,26 @@ 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;
+size_t strftime(char *s, size_t max, const char *format, const struct tm *tm) __THROW __attribute__((format(strftime,3,0)));
time_t time(time_t *t) __THROW;
int stime(time_t *t) __THROW;
+double difftime(time_t time1, time_t time0) __THROW __attribute__((const));
+
+#define CLOCKS_PER_SEC 1000000l
+
+extern long int timezone;
+extern int daylight;
+extern char* tzname[2];
+
+void tzset (void) __THROW;
+
+struct tm* localtime(const time_t* t) __THROW;
+struct tm* gmtime(const time_t* t) __THROW;
+struct tm* localtime_r(const time_t* t, struct tm* r) __THROW;
+struct tm* gmtime_r(const time_t* t, struct tm* r) __THROW;
+
+clock_t clock(void);
+
#endif
diff --git a/mdk-stage1/dietlibc/include/unistd.h b/mdk-stage1/dietlibc/include/unistd.h
index 1a528c0e4..2fba5d584 100644
--- a/mdk-stage1/dietlibc/include/unistd.h
+++ b/mdk-stage1/dietlibc/include/unistd.h
@@ -2,12 +2,14 @@
#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>
+#include <sys/fsuid.h>
+
+extern int optind,opterr;
+extern char *optarg;
+int getopt(int argc, char *const argv[], const char *options);
/* Values for the second argument to access.
These may be OR'd together. */
@@ -17,28 +19,28 @@
#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;
+extern int access (const char *__name, int __type) __THROW;
+#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
+#endif
#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
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
#define lseek(fildes,offset,whence) lseek64(fildes,offset,whence)
#endif
+#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;
@@ -60,23 +62,24 @@ 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;
+int execle(const char *path, ...) __THROW;
-pid_t getpid(void) __attribute__((__const__)) __THROW;
+pid_t getpid(void) __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 getsid(pid_t pid) __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;
+struct dirent;
+struct dirent64;
+int getdents(int fd, struct dirent *dirp, unsigned int count) __THROW;
+int getdents64(int fd, struct dirent64 *dirp, unsigned int count) __THROW;
pid_t fork(void) __THROW;
pid_t vfork(void) __THROW;
@@ -90,6 +93,8 @@ 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;
+#define _POSIX_SYNCHRONIZED_IO
+int fdatasync(int fd) __THROW;
int pipe(int filedes[2]) __THROW;
@@ -101,7 +106,7 @@ 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;
+int usleep(unsigned long useconds) __THROW;
unsigned int sleep(unsigned int seconds) __THROW;
unsigned int alarm(unsigned int seconds) __THROW;
@@ -111,11 +116,16 @@ int isatty(int desc) __THROW;
void _exit(int status) __THROW __attribute__((noreturn));
-extern int daemon (int nochdir,int noclose) __THROW;
+extern int daemon(int nochdir,int noclose) __THROW;
+
+int pause(void) __THROW;
-#if _FILE_OFFSET_BITS == 64
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
#define open open64
#define creat creat64
+#define truncate truncate64
+#define ftruncate ftruncate64
+#define getdents getdents64
#endif
extern char* getlogin(void) __THROW;
@@ -137,32 +147,87 @@ int setreuid(uid_t ruid, uid_t euid) __THROW;
#define setegid(egid) setregid(-1,egid)
int rename(const char *oldpath, const char *newpath) __THROW;
+int truncate(const char *path, off_t length) __THROW;
int ftruncate(int fd, off_t length) __THROW;
-
-int mkstemp(char *Template) __THROW;
+#ifndef __NO_STAT64
+int truncate64(const char *path, loff_t length) __THROW;
+int ftruncate64(int fd, loff_t length) __THROW;
+#endif
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[];
+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;
+size_t getpagesize(void) __THROW __attribute__((__const__));
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;
+int getdtablesize(void) __THROW;
+char *getpass(const char * prompt) __THROW;
/* warning: linux specific: */
+int llseek(int fildes, unsigned long hi, unsigned long lo, loff_t* result,int whence) __THROW;
+
+/* include <linux/sysctl.h> to get all the definitions! */
+struct __sysctl_args;
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;
+#define _SC_CLK_TCK 1
+#define _SC_ARG_MAX 2
+#define _SC_NGROUPS_MAX 3
+#define _SC_OPEN_MAX 4
+#define _SC_PAGESIZE 5
+#define _SC_NPROCESSORS_ONLN 6
+#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_ONLN
+long sysconf(int name) __THROW;
+#define _PC_PATH_MAX 1
+#define _PC_VDISABLE 2
+
+pid_t tcgetpgrp(int fd) __THROW;
+int tcsetpgrp(int fd, pid_t pgrpid) __THROW;
+
+int profil(unsigned short *buf, size_t bufsiz, size_t offset, unsigned int scale);
+
+/* Linux only: */
+int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) __THROW;
+int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) __THROW;
+int setresuid(uid_t ruid, uid_t euid, uid_t suid) __THROW;
+int setresgid(gid_t rgid, gid_t egid, gid_t sgid) __THROW;
+
+/* 32-bit uid support */
+int chown32(const char *path, uid32_t owner, gid32_t group) __THROW;
+int fchown32(int fd, uid32_t owner, gid32_t group) __THROW;
+int lchown32(const char *path, uid32_t owner, gid32_t group) __THROW;
+uid32_t getuid32(void) __THROW;
+uid32_t geteuid32(void) __THROW;
+gid32_t getgid32(void) __THROW;
+gid32_t getegid32(void) __THROW;
+int setuid32(uid32_t uid) __THROW;
+int setgid32(gid32_t gid) __THROW;
+int setreuid32(uid32_t ruid, uid32_t euid) __THROW;
+int setregid32(gid32_t rgid, gid32_t egid) __THROW;
+#define seteuid32(euid) setreuid32(-1,euid)
+#define setegid32(egid) setregid32(-1,egid)
+int getgroups32(int size, gid32_t list[]) __THROW;
+int getresuid32(uid32_t *ruid, uid32_t *euid, uid32_t *suid);
+int getresgid32(gid32_t *rgid, gid32_t *egid, gid32_t *sgid);
+int setresuid32(uid32_t ruid, uid32_t euid, uid32_t suid) __THROW;
+int setresgid32(gid32_t rgid, gid32_t egid, gid32_t sgid) __THROW;
+
+#ifdef _BSD_SOURCE
+char *getusershell(void);
+void setusershell(void);
+void endusershell(void);
+#endif
+
+#define _POSIX_VERSION 199506L
#endif
diff --git a/mdk-stage1/dietlibc/include/utmp.h b/mdk-stage1/dietlibc/include/utmp.h
index 2946be921..cc2adc9f6 100644
--- a/mdk-stage1/dietlibc/include/utmp.h
+++ b/mdk-stage1/dietlibc/include/utmp.h
@@ -11,6 +11,11 @@
#define _PATH_UTMP "/var/run/utmp"
#define _PATH_WTMP "/var/log/wtmp"
+#ifdef _BSD_SOURCE
+/* die, BSD, die!!! */
+#define UTMP_FILE _PATH_UTMP
+#define WTMP_FILE _PATH_WTMP
+#endif
/* The structure describing an entry in the database of
previous logins. */
@@ -38,11 +43,13 @@ struct utmp
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
+#define ut_name ut_user
struct exit_status ut_exit; /* Exit status of a process marked
as DEAD_PROCESS. */
long int ut_session; /* Session ID, used for windowing. */
+#define ut_time ut_tv.tv_sec
struct timeval ut_tv; /* Time entry was made. */
+#define ut_addr ut_addr_v6[0]
int32_t ut_addr_v6[4]; /* Internet address of remote host. */
char __unused[20]; /* Reserved for future use. */
};
@@ -70,4 +77,18 @@ struct utmp
#define _HAVE_UT_TV 1
#define _HAVE_UT_HOST 1
+struct utmp *getutent(void) __THROW;
+struct utmp *getutid(struct utmp *ut) __THROW;
+struct utmp *getutline(struct utmp *ut) __THROW;
+
+void pututline(struct utmp *ut) __THROW;
+
+void setutent(void) __THROW;
+void endutent(void) __THROW;
+
+void utmpname(const char *file) __THROW;
+
+void updwtmp(const char *wtmp_file, const struct utmp *ut);
+void logwtmp(const char *line, const char *name, const char *host);
+
#endif
diff --git a/mdk-stage1/dietlibc/include/write12.h b/mdk-stage1/dietlibc/include/write12.h
new file mode 100644
index 000000000..960b4b722
--- /dev/null
+++ b/mdk-stage1/dietlibc/include/write12.h
@@ -0,0 +1,4 @@
+#include <sys/cdefs.h>
+
+int __write1 ( const char* s ) __attribute__ (( regparm(1) ));
+int __write2 ( const char* s ) __attribute__ (( regparm(1) ));
diff --git a/mdk-stage1/dietlibc/lib/__dtostr.c b/mdk-stage1/dietlibc/lib/__dtostr.c
index e9a8a83d3..580258936 100644
--- a/mdk-stage1/dietlibc/lib/__dtostr.c
+++ b/mdk-stage1/dietlibc/lib/__dtostr.c
@@ -1,104 +1,140 @@
-#include <stdio.h>
+#include <stdlib.h>
+#include <endian.h>
+#include <math.h>
/* convert double to string. Helper for sprintf. */
-int __dtostr(double d,char *buf,int maxlen,int prec) {
+static int copystring(char* buf,int maxlen, const char* s) {
+ int i;
+ for (i=0; i<3&&i<maxlen; ++i)
+ buf[i]=s[i];
+ if (i<maxlen) { buf[i]=0; ++i; }
+ return i;
+}
+
+int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2) {
+#if 1
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;
+#else
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ signed long e=(((((unsigned long*)&d)[1])>>20)&((1<<11)-1))-1023;
+#else
+ signed long e=(((*((unsigned long*)&d))>>20)&((1<<11)-1))-1023;
+#endif
+#endif
/* 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) */
+ signed long e10;
/* step 3: calculate 10^e10 */
- int i;
- double tmp=10.0;
+ unsigned int i;
+ double backup=d;
+ double tmp;
char *oldbuf=buf;
- int initial=1;
+ if (isnan(d)) return copystring(buf,maxlen,"nan");
+ if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf");
+ e10=1+(long)(e*0.30102999566398119802); /* log10(2) */
+ /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht
+ * ist. Wenn maxlen erreicht ist, machen wir das nochmal in
+ * scientific notation. Wenn dann von prec noch was übrig ist, geben
+ * wir einen Dezimalpunkt aus und geben prec2 Nachkommastellen aus.
+ * Wenn prec2 Null ist, geben wir so viel Stellen aus, wie von prec
+ * noch übrig ist. */
if (d==0.0) {
- *buf='0'; ++buf;
- goto done;
+ prec2=prec2==0?1:prec2+2;
+ prec2=prec2>maxlen?8:prec2;
+ for (i=0; i<prec2; ++i) buf[i]='0';
+ buf[1]='.'; buf[i]=0;
+ return i;
}
- if (s) { d=-d; *buf='-'; --maxlen; buf++; }
+
+ if (d < 0.0) { d=-d; *buf='-'; --maxlen; ++buf; }
+
+ /*
+ Perform rounding. It needs to be done before we generate any
+ digits as the carry could propagate through the whole number.
+ */
+
+ tmp = 0.5;
+ for (i = 0; i < prec2; i++) { tmp *= 0.1; }
+ d += tmp;
+
+ if (d < 1.0) { *buf='0'; --maxlen; ++buf; }
/* printf("e=%d e10=%d prec=%d\n",e,e10,prec); */
- if (e10>=0) {
+ if (e10>0) {
+ int first=1; /* are we about to write the first digit? */
+ tmp = 10.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;
+ /* the number is greater than 1. Iterate through digits before the
+ * decimal point until we reach the decimal point or maxlen is
+ * reached (in which case we switch to scientific notation). */
+ while (tmp>0.9) {
+ char digit;
+ double fraction=d/tmp;
+ digit=(int)(fraction); /* floor() */
+ if (!first || digit) {
+ first=0;
+ *buf=digit+'0'; ++buf;
+ if (!maxlen) {
+ /* use scientific notation */
+ int len=__dtostr(backup/tmp,oldbuf,maxlen,prec,prec2);
+ int initial=1;
+ if (len==0) return 0;
+ maxlen-=len; buf+=len;
+ if (maxlen>0) {
+ *buf='e';
+ ++buf;
+ }
+ --maxlen;
+ for (len=1000; len>0; len/=10) {
+ if (e10>=len || !initial) {
+ if (maxlen>0) {
+ *buf=(e10/len)+'0';
+ ++buf;
+ }
+ --maxlen;
+ initial=0;
+ e10=e10%len;
+ }
+ }
+ if (maxlen>0) goto fini;
+ return 0;
}
- initial=0;
- e10=e10%len;
+ d-=digit*tmp;
+ --maxlen;
}
+ tmp/=10.0;
}
- 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);
+ else
+ {
+ tmp = 0.1;
}
- 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;
+
+ if (buf==oldbuf) {
+ if (!maxlen) return 0; --maxlen;
+ *buf='0'; ++buf;
+ }
+ if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */
+ if (!maxlen) return 0; --maxlen;
+ *buf='.'; ++buf;
+ prec-=buf-oldbuf-1;
+ if (prec2) prec=prec2;
+ if (prec>maxlen) return 0;
+ while (prec>0) {
+ char digit;
+ double fraction=d/tmp;
+ digit=(int)(fraction); /* floor() */
+ *buf=digit+'0'; ++buf;
+ d-=digit*tmp;
+ tmp/=10.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:
+fini:
*buf=0;
return buf-oldbuf;
}
diff --git a/mdk-stage1/dietlibc/lib/__fstat64.c b/mdk-stage1/dietlibc/lib/__fstat64.c
index 6f9fcb2c5..f2f9858ea 100644
--- a/mdk-stage1/dietlibc/lib/__fstat64.c
+++ b/mdk-stage1/dietlibc/lib/__fstat64.c
@@ -1,9 +1,8 @@
+#include <errno.h>
#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);
@@ -11,11 +10,7 @@ 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);
}
diff --git a/mdk-stage1/dietlibc/lib/__ftruncate64.c b/mdk-stage1/dietlibc/lib/__ftruncate64.c
new file mode 100644
index 000000000..e0ea8c98a
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__ftruncate64.c
@@ -0,0 +1,23 @@
+#include <errno.h>
+#include "dietfeatures.h"
+#ifdef WANT_LARGEFILE_BACKCOMPAT
+#include <sys/stat.h>
+#include "syscalls.h"
+#include <unistd.h>
+#ifndef __NO_STAT64
+#ifdef __NR_ftruncate64
+
+extern int __dietlibc_ftruncate64(int fd, loff_t o);
+
+int ftruncate64(int fd, loff_t o) {
+ int tmp;
+ if ((tmp=__dietlibc_ftruncate64(fd,o))==-1) {
+ if (errno!=ENOSYS) return -1;
+ if (o>0x7fffffff) { errno=EOVERFLOW; return -1; }
+ return ftruncate(fd,o);
+ }
+ return tmp;
+}
+#endif
+#endif
+#endif
diff --git a/mdk-stage1/dietlibc/lib/__getcwd.c b/mdk-stage1/dietlibc/lib/__getcwd.c
index e97fc4520..8616704ec 100644
--- a/mdk-stage1/dietlibc/lib/__getcwd.c
+++ b/mdk-stage1/dietlibc/lib/__getcwd.c
@@ -1,3 +1,4 @@
+#include <unistd.h>
#include <stdlib.h>
extern int __syscall_getcwd(char* buf, size_t size);
diff --git a/mdk-stage1/dietlibc/lib/__isinf.c b/mdk-stage1/dietlibc/lib/__isinf.c
new file mode 100644
index 000000000..359bd2709
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__isinf.c
@@ -0,0 +1,15 @@
+#include <math.h>
+
+int isinf(double d) {
+ unsigned long long *x=(unsigned long long *)&d;
+ return (*x==0x7FF0000000000000ll?1:*x==0xFFF0000000000000?-1:0);
+}
+int __isinf(double d) __attribute__((alias("isinf")));
+
+#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/__isnan.c b/mdk-stage1/dietlibc/lib/__isnan.c
index 9d21e9824..de74b8a9f 100644
--- a/mdk-stage1/dietlibc/lib/__isnan.c
+++ b/mdk-stage1/dietlibc/lib/__isnan.c
@@ -1,9 +1,10 @@
-#include <stdio.h>
+#include <math.h>
-int __isnan(double d) {
+int isnan(double d) {
unsigned long long *x=(unsigned long long *)&d;
- return (*x==0x7FF8002000000000ll || *x==0x7FF0002000000000);
+ return (*x==0x7FF8000000000000ll || *x==0x7FF0000000000000 || *x==0xfff8000000000000);
}
+int __isnan(double d) __attribute__((alias("isnan")));
#if 0
TestFromIeeeExtended("7FFF0000000000000000"); /* +infinity */
diff --git a/mdk-stage1/dietlibc/lib/__lltostr.c b/mdk-stage1/dietlibc/lib/__lltostr.c
index eb4a27cef..fe4701f29 100644
--- a/mdk-stage1/dietlibc/lib/__lltostr.c
+++ b/mdk-stage1/dietlibc/lib/__lltostr.c
@@ -1,9 +1,11 @@
#include <string.h>
+int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase);
+
int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase)
{
char *tmp;
- int j=0;
+ unsigned int j=0;
s[--size]=0;
diff --git a/mdk-stage1/dietlibc/lib/__lstat64.c b/mdk-stage1/dietlibc/lib/__lstat64.c
index a871f3917..0eab6a94b 100644
--- a/mdk-stage1/dietlibc/lib/__lstat64.c
+++ b/mdk-stage1/dietlibc/lib/__lstat64.c
@@ -1,9 +1,8 @@
+#include <errno.h>
#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);
@@ -11,11 +10,7 @@ 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);
}
diff --git a/mdk-stage1/dietlibc/lib/__ltostr.c b/mdk-stage1/dietlibc/lib/__ltostr.c
index 57e0690d2..fa71be9ab 100644
--- a/mdk-stage1/dietlibc/lib/__ltostr.c
+++ b/mdk-stage1/dietlibc/lib/__ltostr.c
@@ -1,9 +1,10 @@
#include <string.h>
+#include <stdlib.h>
-int __ltostr(char *s, int size, unsigned long i, int base, char UpCase)
+int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase)
{
char *tmp;
- int j=0;
+ unsigned int j=0;
s[--size]=0;
diff --git a/mdk-stage1/dietlibc/lib/__ptrace.c b/mdk-stage1/dietlibc/lib/__ptrace.c
new file mode 100644
index 000000000..bd14a0351
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__ptrace.c
@@ -0,0 +1,27 @@
+/* we need this because we need to use the glibc prototype which uses
+ * varargs :-( */
+#define ptrace fnord
+#include <sys/ptrace.h>
+#undef ptrace
+#include <sys/types.h>
+#include <unistd.h>
+
+extern int __diet_ptrace(int request, pid_t pid, void *addr, void *data);
+int ptrace(int request, pid_t pid, void *addr, void *data);
+
+int ptrace(int request, pid_t pid, void *addr, void *data) {
+ switch (request) {
+ case PTRACE_TRACEME: case PTRACE_KILL: case PTRACE_ATTACH:
+ case PTRACE_DETACH:
+ return (__diet_ptrace (request, pid, NULL, NULL));
+ case PTRACE_PEEKDATA: case PTRACE_PEEKUSER: case PTRACE_PEEKTEXT:
+ {
+ long result;
+ if (__diet_ptrace (request, pid, addr, &result) == -1)
+ return (-1);
+ return (result);
+ }
+ default:
+ return (__diet_ptrace (request, pid, addr, data));
+ }
+}
diff --git a/mdk-stage1/dietlibc/lib/__stat64.c b/mdk-stage1/dietlibc/lib/__stat64.c
index dfb0d4315..fcbdfef2d 100644
--- a/mdk-stage1/dietlibc/lib/__stat64.c
+++ b/mdk-stage1/dietlibc/lib/__stat64.c
@@ -1,9 +1,8 @@
+#include <errno.h>
#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);
@@ -11,11 +10,7 @@ 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);
}
diff --git a/mdk-stage1/dietlibc/lib/__stat64_cvt.c b/mdk-stage1/dietlibc/lib/__stat64_cvt.c
index dced352a4..c4ce8bea4 100644
--- a/mdk-stage1/dietlibc/lib/__stat64_cvt.c
+++ b/mdk-stage1/dietlibc/lib/__stat64_cvt.c
@@ -1,6 +1,8 @@
#include <sys/stat.h>
#ifndef __NO_STAT64
+void __stat64_cvt(const struct stat *src,struct stat64 *dest);
+
void __stat64_cvt(const struct stat *src,struct stat64 *dest) {
dest->st_dev=src->st_dev;
dest->st_ino=src->st_ino;
diff --git a/mdk-stage1/dietlibc/lib/__stime.c b/mdk-stage1/dietlibc/lib/__stime.c
new file mode 100644
index 000000000..7b2c77729
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__stime.c
@@ -0,0 +1,14 @@
+#include <errno.h>
+#include <sys/time.h>
+#include <time.h>
+#include <syscalls.h>
+
+#ifndef __NR_stime
+int stime(time_t *when)
+{
+ struct timeval tv;
+ tv.tv_sec = *when;
+ tv.tv_usec = 0;
+ return settimeofday(&tv, (struct timezone *)0);
+}
+#endif
diff --git a/mdk-stage1/dietlibc/lib/__truncate64.c b/mdk-stage1/dietlibc/lib/__truncate64.c
new file mode 100644
index 000000000..ccb3e7f64
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__truncate64.c
@@ -0,0 +1,23 @@
+#include "dietfeatures.h"
+#include <errno.h>
+#ifdef WANT_LARGEFILE_BACKCOMPAT
+#include <sys/stat.h>
+#include "syscalls.h"
+#include <unistd.h>
+#ifndef __NO_STAT64
+#ifdef __NR_truncate64
+
+extern int __dietlibc_truncate64(const char* f, loff_t o);
+
+int truncate64(const char* f, loff_t o) {
+ int tmp;
+ if ((tmp=__dietlibc_truncate64(f,o))==-1) {
+ if (errno!=ENOSYS) return -1;
+ if (o>0x7fffffff) { errno=EOVERFLOW; return -1; }
+ return truncate(f,o);
+ }
+ return tmp;
+}
+#endif
+#endif
+#endif
diff --git a/mdk-stage1/dietlibc/lib/__v_printf.c b/mdk-stage1/dietlibc/lib/__v_printf.c
new file mode 100644
index 000000000..15011cdd8
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__v_printf.c
@@ -0,0 +1,300 @@
+#include "dietfeatures.h"
+#include <stdarg.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include "dietstdio.h"
+#include "dietwarning.h"
+
+static inline unsigned int skip_to(const unsigned char *format) {
+ unsigned int nr;
+ for (nr=0; format[nr] && (format[nr]!='%'); ++nr);
+ return nr;
+}
+
+#define A_WRITE(fn,buf,sz) ((fn)->put((void*)(buf),(sz),(fn)->data))
+
+static const char pad_line[2][16]= { " ", "0000000000000000", };
+static inline int write_pad(struct arg_printf* fn, int len, int padwith) {
+ int nr=0;
+ for (;len>15;len-=16,nr+=16) {
+ A_WRITE(fn,pad_line[(padwith=='0')?1:0],16);
+ }
+ if (len>0) {
+ A_WRITE(fn,pad_line[(padwith=='0')?1:0],(unsigned int)len); nr+=len;
+ }
+ return nr;
+}
+
+int __v_printf(struct arg_printf* fn, const unsigned char *format, va_list arg_ptr)
+{
+ int len=0;
+
+ while (*format) {
+ unsigned int sz = skip_to(format);
+ if (sz) {
+ A_WRITE(fn,format,sz); len+=sz;
+ format+=sz;
+ }
+ if (*format=='%') {
+ char buf[128];
+
+ unsigned char ch, *s, padwith=' ';
+
+ char flag_in_sign=0;
+ char flag_upcase=0;
+ char flag_hash=0;
+ char flag_left=0;
+ char flag_space=0;
+ char flag_sign=0;
+ char flag_dot=0;
+ signed char flag_long=0;
+
+ unsigned int base;
+ unsigned int width=0, preci=0;
+
+ long number=0;
+#ifdef WANT_LONGLONG_PRINTF
+ long long llnumber=0;
+#endif
+
+ ++format;
+inn_printf:
+ switch(ch=*format++) {
+ case 0:
+ return -1;
+ break;
+
+ /* FLAGS */
+ case '#':
+ flag_hash=-1;
+ case 'z':
+ goto inn_printf;
+
+ case 'h':
+ --flag_long;
+ goto inn_printf;
+ case 'L':
+ ++flag_long; /* fall through */
+ case 'l':
+ ++flag_long;
+ goto inn_printf;
+
+ case '0':
+ padwith='0';
+ goto inn_printf;
+
+ case '-':
+ flag_left=1;
+ goto inn_printf;
+
+ case ' ':
+ flag_space=1;
+ goto inn_printf;
+
+ case '+':
+ flag_sign=1;
+ goto inn_printf;
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if(flag_dot) return -1;
+ width=strtoul(format-1,(char**)&s,10);
+ format=s;
+ goto inn_printf;
+
+ case '*':
+ width=va_arg(arg_ptr,int);
+ goto inn_printf;
+
+ case '.':
+ flag_dot=1;
+ if (*format=='*') {
+ preci=va_arg(arg_ptr,int);
+ ++format;
+ } else {
+ long int tmp=strtol(format,(char**)&s,10);
+ preci=tmp<0?0:tmp;
+ format=s;
+ }
+ goto inn_printf;
+
+ /* print a char or % */
+ case 'c':
+ ch=(char)va_arg(arg_ptr,int);
+ case '%':
+ A_WRITE(fn,&ch,1); ++len;
+ break;
+
+ /* print a string */
+ case 's':
+ s=va_arg(arg_ptr,char *);
+#ifdef WANT_NULL_PRINTF
+ if (!s) s="(null)";
+#endif
+ sz = strlen(s);
+ if (flag_dot && sz>preci) sz=preci;
+ flag_dot^=flag_dot;
+
+print_out:
+ if (width && (!flag_left)) {
+ if (flag_in_sign) {
+ A_WRITE(fn,s,1); ++len;
+ ++s; --sz;
+ --width;
+ }
+ if (flag_hash>0) {
+ A_WRITE(fn,s,flag_hash); len+=flag_hash;
+ s+=flag_hash; sz-=flag_hash;
+ width-=flag_hash;
+ }
+// len+=write_pad(fn,(signed int)width-(signed int)sz,padwith);
+ if (flag_dot) {
+ len+=write_pad(fn,(signed int)width-(signed int)preci,padwith);
+ len+=write_pad(fn,(signed int)preci-(signed int)sz,'0');
+ } else
+ len+=write_pad(fn,(signed int)width-(signed int)sz,padwith);
+ }
+ A_WRITE(fn,s,sz); len+=sz;
+ if (width && (flag_left)) {
+ len+=write_pad(fn,(signed int)width-(signed int)sz,' ');
+ }
+ break;
+
+ /* print an integer value */
+ case 'b':
+ base=2;
+ sz=0;
+ goto num_printf;
+ case 'p':
+ flag_hash=2;
+ flag_long=1;
+ ch='x';
+ case 'X':
+ flag_upcase=(ch=='X');
+ case 'x':
+ base=16;
+ sz=0;
+ if (flag_dot) width=preci;
+ if (flag_hash) {
+ buf[1]='0';
+ buf[2]=ch;
+ flag_hash=2;
+ sz=2;
+ }
+ goto num_printf;
+ case 'd':
+ case 'i':
+ flag_in_sign=1;
+ case 'u':
+ base=10;
+ sz=0;
+ goto num_printf;
+ case 'o':
+ base=8;
+ sz=0;
+ if (flag_hash) {
+ buf[1]='0';
+ flag_hash=1;
+ ++sz;
+ }
+
+num_printf:
+ s=buf+1;
+
+ if (flag_long>0) {
+#ifdef WANT_LONGLONG_PRINTF
+ if (flag_long>1)
+ llnumber=va_arg(arg_ptr,long long);
+ else
+#endif
+ number=va_arg(arg_ptr,long);
+ }
+ else
+ number=va_arg(arg_ptr,int);
+
+ if (flag_in_sign) {
+#ifdef WANT_LONGLONG_PRINTF
+ if ((flag_long>1)&&(llnumber<0)) {
+ llnumber=-llnumber;
+ flag_in_sign=2;
+ } else
+#endif
+ if (number<0) {
+ number=-number;
+ flag_in_sign=2;
+ }
+ }
+ if (flag_long<0) number&=0xffff;
+ if (flag_long<-1) number&=0xff;
+#ifdef WANT_LONGLONG_PRINTF
+ if (flag_long>1)
+ sz += __lltostr(s+sz,sizeof(buf)-5,(unsigned long long) llnumber,base,flag_upcase);
+ else
+#endif
+ sz += __ltostr(s+sz,sizeof(buf)-5,(unsigned long) number,base,flag_upcase);
+
+ if (flag_in_sign==2) {
+ *(--s)='-';
+ ++sz;
+ } else if ((flag_in_sign)&&(flag_sign || flag_space)) {
+ *(--s)=(flag_sign)?'+':' ';
+ ++sz;
+ } else flag_in_sign=0;
+
+ goto print_out;
+
+#ifdef WANT_FLOATING_POINT_IN_PRINTF
+ /* print a floating point value */
+ case 'f':
+ case 'g':
+ {
+ int g=(ch=='g');
+ double d=va_arg(arg_ptr,double);
+ if (width==0) width=1;
+ if (!flag_dot) preci=6;
+ sz=__dtostr(d,buf,sizeof(buf),width,preci);
+ if (flag_dot) {
+ char *tmp;
+ if ((tmp=strchr(buf,'.'))) {
+ ++tmp;
+ while (preci>0 && *++tmp) --preci;
+ *tmp=0;
+ }
+ }
+ if (g) {
+ char *tmp,*tmp1; /* boy, is _this_ ugly! */
+ if ((tmp=strchr(buf,'.'))) {
+ tmp1=strchr(tmp,'e');
+ while (*tmp) ++tmp;
+ if (tmp1) tmp=tmp1;
+ while (*--tmp=='0') ;
+ if (*tmp!='.') ++tmp;
+ *tmp=0;
+ if (tmp1) strcpy(tmp,tmp1);
+ }
+ }
+ preci=strlen(buf);
+ s=buf;
+
+ goto print_out;
+ }
+#endif
+
+ default:
+ break;
+ }
+ }
+ }
+ return len;
+}
+
+link_warning("__v_printf","warning: the printf functions add several kilobytes of bloat.")
+
diff --git a/mdk-stage1/dietlibc/lib/__v_scanf.c b/mdk-stage1/dietlibc/lib/__v_scanf.c
new file mode 100644
index 000000000..6db51db59
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/__v_scanf.c
@@ -0,0 +1,391 @@
+#include "dietfeatures.h"
+#include <stdarg.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "dietstdio.h"
+#include "dietwarning.h"
+
+#define A_GETC(fn) (++consumed,(fn)->getch((fn)->data))
+#define A_PUTC(c,fn) (--consumed,(fn)->putch((c),(fn)->data))
+
+int __v_scanf(struct arg_scanf* fn, const unsigned char *format, va_list arg_ptr)
+{
+ unsigned int ch; /* format act. char */
+ int n=0;
+
+ /* arg_ptr tmps */
+#ifdef WANT_FLOATING_POINT_IN_SCANF
+ double *pd;
+ float *pf;
+#endif
+#ifdef WANT_LONGLONG_SCANF
+ long long *pll;
+#endif
+ long *pl;
+ short *ph;
+ int *pi;
+ char *s;
+
+ unsigned int consumed=0;
+
+ /* get one char */
+ int tpch= A_GETC(fn);
+
+ //while ((tpch!=-1)&&(*format))
+ while (*format)
+ {
+// const unsigned char *prev_fmt=format;
+ ch=*format++;
+ switch (ch) {
+ /* end of format string ?!? */
+ case 0: return 0;
+
+ /* skip spaces ... */
+ case ' ':
+ case '\f':
+ case '\t':
+ case '\v':
+ case '\n':
+ case '\r':
+ while((*format)&&(isspace(*format))) ++format;
+ while(isspace(tpch)) tpch=A_GETC(fn);
+ break;
+
+ /* format string ... */
+ case '%':
+ {
+ unsigned int _div=0;
+ int width=-1;
+ char flag_width=0;
+ char flag_discard=0;
+ char flag_half=0;
+ char flag_long=0;
+ char flag_longlong=0;
+
+in_scan:
+ ch=*format++;
+ if(ch!='n' && tpch==-1) goto err_out;
+ switch (ch) {
+ /* end of format string ?!? */
+ case 0: return 0;
+
+ /* check for % */
+ case '%':
+ if ((unsigned char)tpch != ch) goto err_out;
+ tpch=A_GETC(fn);
+ break;
+
+ /* FLAGS */
+ case '*':
+ flag_discard=1;
+ goto in_scan;
+ case 'h':
+ flag_half=1;
+ goto in_scan;
+ case 'l':
+ if (flag_long) flag_longlong=1;
+ flag_long=1;
+ goto in_scan;
+ case 'q':
+ case 'L':
+ flag_longlong=1;
+ goto in_scan;
+
+ /* WIDTH */
+ case '0':
+ 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 in_scan;
+
+ /* scan for integer / strtol reimplementation ... */
+ case 'p':
+ case 'X':
+ case 'x':
+ _div+=6;
+ case 'd':
+ _div+=2;
+ case 'o':
+ _div+=8;
+ case 'u':
+ case 'i':
+ {
+#ifdef WANT_LONGLONG_SCANF
+ unsigned long long v=0;
+#else
+ unsigned long v=0;
+#endif
+ unsigned int consumedsofar=consumed;
+ int neg=0;
+ while(isspace(tpch)) tpch=A_GETC(fn);
+ if (tpch=='-') {
+ tpch=A_GETC(fn);
+ neg=1;
+ }
+
+ if (tpch=='+') tpch=A_GETC(fn);
+
+ if (!flag_width) {
+ if ((_div==16) && (tpch=='0')) goto scan_hex;
+ if (!_div) {
+ _div=10;
+ if (tpch=='0') {
+ _div=8;
+scan_hex:
+ tpch=A_GETC(fn);
+ if ((tpch|32)=='x') {
+ tpch=A_GETC(fn);
+ _div=16;
+ }
+ }
+ }
+ }
+ while ((width)&&(tpch!=-1)) {
+ register unsigned long c=tpch&0xff;
+#ifdef WANT_LONGLONG_SCANF
+ register unsigned long long d=c|0x20;
+#else
+ register unsigned long d=c|0x20;
+#endif
+ c=(d>='a'?d-'a'+10:c<='9'?c-'0':0xff);
+ if (c>=_div) break;
+ d=v*_div;
+#ifdef WANT_LONGLONG_SCANF
+ v=(d<v)?ULLONG_MAX:d+c;
+#else
+ v=(d<v)?ULONG_MAX:d+c;
+#endif
+ --width;
+ tpch=A_GETC(fn);
+ }
+ if ((ch|0x20)<'p') {
+#ifdef WANT_LONGLONG_SCANF
+ register long long l=v;
+ if (v>=-((unsigned long long)LLONG_MIN)) {
+ l=(neg)?LLONG_MIN:LLONG_MAX;
+ }
+ else {
+ if (neg) v*=-1;
+ }
+#else
+ register long l=v;
+ if (v>=-((unsigned long)LONG_MIN)) {
+ l=(neg)?LONG_MIN:LONG_MAX;
+ }
+ else {
+ if (neg) v*=-1;
+ }
+#endif
+ }
+ if (!flag_discard) {
+#ifdef WANT_LONGLONG_SCANF
+ if (flag_longlong) {
+ pll=(long long *)va_arg(arg_ptr,long long*);
+ *pll=v;
+ } else
+#endif
+ if (flag_long) {
+ pl=(long *)va_arg(arg_ptr,long*);
+ *pl=v;
+ } else if (flag_half) {
+ ph=(short*)va_arg(arg_ptr,short*);
+ *ph=v;
+ } else {
+ pi=(int *)va_arg(arg_ptr,int*);
+ *pi=v;
+ }
+ if(consumedsofar<consumed)
+ ++n;
+ }
+ }
+ break;
+
+#ifdef WANT_FLOATING_POINT_IN_SCANF
+ /* floating point numbers */
+ case 'e':
+ case 'E':
+ case 'f':
+ case 'g':
+ {
+ double d=0.0;
+ int neg=0;
+
+ while(isspace(tpch)) tpch=A_GETC(fn);
+
+ if (tpch=='-') {
+ tpch=A_GETC(fn);
+ neg=1;
+ }
+ if (tpch=='+') tpch=A_GETC(fn);
+
+ while (isdigit(tpch)) {
+ d=d*10+(tpch-'0');
+ tpch=A_GETC(fn);
+ }
+ if (tpch=='.') {
+ double factor=.1;
+ tpch=A_GETC(fn);
+ while (isdigit(tpch)) {
+ d=d+(factor*(tpch-'0'));
+ factor/=10;
+ tpch=A_GETC(fn);
+ }
+ }
+ if ((tpch|0x20)=='e') {
+ int exp=0, prec=tpch;
+ double factor=10;
+ tpch=A_GETC(fn);
+ if (tpch=='-') {
+ factor=0.1;
+ tpch=A_GETC(fn);
+ } else if (tpch=='+') {
+ tpch=A_GETC(fn);
+ } else {
+ d=0;
+ if (tpch!=-1) A_PUTC(tpch,fn);
+ tpch=prec;
+ goto exp_out;
+ }
+ while (isdigit(tpch)) {
+ exp=exp*10+(tpch-'0');
+ tpch=A_GETC(fn);
+ }
+ while (exp) { /* as in strtod: XXX: this introduces rounding errors */
+ d*=factor; --exp;
+ }
+ }
+exp_out:
+ 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;
+ }
+ break;
+#endif
+
+ /* char-sequences */
+ case 'c':
+ if (!flag_discard) {
+ s=(char *)va_arg(arg_ptr,char*);
+ ++n;
+ }
+ if (!flag_width) width=1;
+ while (width && (tpch!=-1)) {
+ if (!flag_discard) *(s++)=tpch;
+ --width;
+ tpch=A_GETC(fn);
+ }
+ break;
+
+ /* c-string */
+ case 's':
+ if (!flag_discard) s=(char *)va_arg(arg_ptr,char*);
+ while(isspace(tpch)) tpch=A_GETC(fn);
+ while (width && (tpch!=-1) && (!isspace(tpch))) {
+ if (!flag_discard) *s=tpch;
+ if (tpch) ++s; else break;
+ --width;
+ tpch=A_GETC(fn);
+ }
+ if (!flag_discard) { *s=0; n++; }
+ break;
+
+ /* consumed-count */
+ case 'n':
+ if (!flag_discard) {
+ s=(char *)va_arg(arg_ptr,char*);
+// ++n; /* in accordance to ANSI C we don't count this conversion */
+ }
+ if (!flag_discard) *(s++)=consumed-1;
+ 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 && (tpch>=0) && (cset[tpch]^flag_not)) {
+ if (!flag_discard) *s=tpch;
+ if (tpch) ++s; else break;
+ --width;
+ tpch=A_GETC(fn);
+ }
+ if (!flag_discard) *s=0;
+ ++format;
+ }
+ break;
+#endif
+ default:
+ goto err_out;
+ }
+ }
+ break;
+
+ /* check if equal format string... */
+ default:
+ if ((unsigned char)tpch != ch) goto err_out;
+ tpch=A_GETC(fn);
+ break;
+ }
+ }
+err_out:
+ if (tpch<0 && n==0) return EOF;
+ A_PUTC(tpch,fn);
+ return n;
+}
+
+link_warning("__v_scanf","warning: the scanf functions add several kilobytes of bloat.");
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
index 6d0b29c03..e73d7b621 100644
--- a/mdk-stage1/dietlibc/lib/_brk.c
+++ b/mdk-stage1/dietlibc/lib/_brk.c
@@ -1,14 +1,13 @@
#include <unistd.h>
-extern int __diet_brk(void *end_data_segment);
+extern void* __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 __libc_brk(void *end_data_segment);
+
+int __libc_brk(void *end_data_segment) {
+ return ((__curbrk=__diet_brk(end_data_segment))==(void*)-1?-1:0);
}
-int brk (void *end_data_segment) __attribute__((weak,alias("__brk")));
+int brk(void *end_data_segment) __attribute__((weak,alias("__libc_brk")));
diff --git a/mdk-stage1/dietlibc/lib/abort.c b/mdk-stage1/dietlibc/lib/abort.c
index 55bfb8f0f..7c49a32ef 100644
--- a/mdk-stage1/dietlibc/lib/abort.c
+++ b/mdk-stage1/dietlibc/lib/abort.c
@@ -1,10 +1,16 @@
-#include <linux/types.h>
-#include <linux/signal.h>
+#include <sys/types.h>
#include <signal.h>
#include <stdlib.h>
+#include <stdio.h>
+
+#ifndef __PIC__
+void __stdio_flushall(void) __attribute__((weak));
+void __stdio_flushall(void) { }
+#endif
void abort() {
sigset_t t;
+ __stdio_flushall();
if (!sigemptyset(&t) && !sigaddset(&t, SIGABRT))
sigprocmask(SIG_UNBLOCK, &t, 0);
while (1)
diff --git a/mdk-stage1/dietlibc/lib/abs.c b/mdk-stage1/dietlibc/lib/abs.c
index 9d7055358..d3b75f202 100644
--- a/mdk-stage1/dietlibc/lib/abs.c
+++ b/mdk-stage1/dietlibc/lib/abs.c
@@ -1,6 +1,6 @@
-#include <stdlib.h>
+#include <endian.h>
-int abs(int j)
-{
- return (j < 0) ? -j : j;
-}
+int abs(int i) { return i>=0?i:-i; }
+#if __WORDSIZE == 32
+long labs(long i) __attribute__((alias("abs")));
+#endif
diff --git a/mdk-stage1/dietlibc/lib/accept.c b/mdk-stage1/dietlibc/lib/accept.c
index c7e8254ca..08359b894 100644
--- a/mdk-stage1/dietlibc/lib/accept.c
+++ b/mdk-stage1/dietlibc/lib/accept.c
@@ -1,14 +1,12 @@
-#include <linux/net.h>
+#include <linuxnet.h>
extern int socketcall(int callno,long* args);
+int __libc_accept(int a, void * addr, void * addr2);
+
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/adjtime.c b/mdk-stage1/dietlibc/lib/adjtime.c
new file mode 100644
index 000000000..b8986be57
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/adjtime.c
@@ -0,0 +1,18 @@
+#include <time.h>
+#include <sys/timex.h>
+
+int adjtime (const struct timeval *itv, struct timeval *otv) {
+ struct timex tmp;
+ if (itv) {
+ tmp.offset = (itv->tv_usec % 1000000L) + (itv->tv_sec + itv->tv_usec / 1000000L) * 1000000L;
+ tmp.modes = ADJ_OFFSET_SINGLESHOT;
+ } else
+ tmp.modes = 0;
+ if (adjtimex(&tmp)==-1)
+ return -1;
+ if (otv) {
+ otv->tv_usec = tmp.offset % 1000000;
+ otv->tv_sec = tmp.offset / 1000000;
+ }
+ return 0;
+}
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
index 8cb87a69b..a2b3b73a1 100644
--- a/mdk-stage1/dietlibc/lib/alloc.c
+++ b/mdk-stage1/dietlibc/lib/alloc.c
@@ -1,23 +1,27 @@
/*
* malloc/free by O.Dreesen
+ *
+ * first TRY:
+ * lists w/magics
+ * and now the second TRY
+ * let the kernel map all the stuff (if there is something to do)
*/
-#include <linux/unistd.h>
-#include <asm/mman.h>
-#include <linux/errno.h>
-#include "dietfeatures.h"
-
-#if 0
+#include <unistd.h>
#include <sys/mman.h>
-#define _LIBC
#include <errno.h>
-#endif
+#include "dietfeatures.h"
-#include <linux/types.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sys/shm.h> /* for PAGE_SIZE */
-#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
-#define MAP_ANON MAP_ANONYMOUS
-#endif
+
+/* -- HELPER CODE --------------------------------------------------------- */
#ifndef MAP_FAILED
#define MAP_FAILED ((void*)-1)
@@ -27,217 +31,207 @@
#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 union {
+ void* next;
+ size_t size;
+} __alloc_t;
-typedef struct t_alloc_head {
- unsigned int magic1;
- struct t_alloc_head *ptr;
- unsigned long size;
- unsigned int magic2;
-} alloc_head;
+#define BLOCK_START(b) (((void*)(b))-sizeof(__alloc_t))
+#define BLOCK_RET(b) (((void*)(b))+sizeof(__alloc_t))
-/* guess what ? the virtual block size */
-#define MEM_BLOCK_SIZE 4096
+#define MEM_BLOCK_SIZE PAGE_SIZE
+#define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1)))
-/* minimum allocated bytes */
-#define MEM_ALLOC_MIN 4
+/* a simple mmap :) */
-/* Initial start position in memory */
-#define MEM_ALLOC_START ((char*)0x18000000)
+#ifdef __i386__
+/* regparm exists only on i386 */
+static void *do_mmap(size_t size) __attribute__((regparm(1)));
+static size_t get_index(size_t _size) __attribute__((regparm(1)));
+static void* __small_malloc(size_t _size) __attribute__((regparm(1)));
+#endif
-/* 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)))
+static void *do_mmap(size_t size) {
+ return mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (size_t)0);
+}
-#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)
+/* -- SMALL MEM ----------------------------------------------------------- */
-#define ALLOC_MAGIC1 0xbad2f7ee
-#define ALLOC_MAGIC2 0xf7ee2bad
+static __alloc_t* __small_mem[8];
-/* freelist handler */
-static alloc_head base = {ALLOC_MAGIC1,&base,0,ALLOC_MAGIC2};
-static char *alloc_get_end = MEM_ALLOC_START;
+#define __SMALL_NR(i) (MEM_BLOCK_SIZE/(i))
-void __libc_free(void *ptr)
-{
- alloc_head *prev,*p,*block;
+#define __MIN_SMALL_SIZE __SMALL_NR(256) /* 16 / 32 */
+#define __MAX_SMALL_SIZE __SMALL_NR(2) /* 2048 / 4096 */
- if (ptr==NULL) return;
+#define GET_SIZE(s) (__MIN_SMALL_SIZE<<get_index((s)))
- block=START_BLOCK(ptr);
- if (block->magic1 != ALLOC_MAGIC1) return;
- if (block->magic2 != ALLOC_MAGIC2) return;
+#define FIRST_SMALL(p) (((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1)))
- 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 */
+static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; }
- /* emergency escape: freelist has ONLY one entry the freelist base */
- if (p->ptr==p) break;
+static size_t get_index(size_t _size) {
+ register size_t idx=0;
+ if (_size) {
+ register size_t size=((_size-1)&(MEM_BLOCK_SIZE-1))>>__ind_shift();
+ while(size) { size>>=1; ++idx; }
}
- prev->ptr = block;
+ return idx;
+}
- if (END_OF_BLOCK(block)==p)
- { /* join right neighbor */
- block->ptr = p->ptr;
- block->size += p->size;
- }
- else
- block->ptr = p;
+/* small mem */
+static void __small_free(void*_ptr,size_t _size) __attribute__((regparm(2)));
- if (END_OF_BLOCK(prev)==block)
- { /* join left neighbor */
- prev->size += block->size;
- prev->ptr = block->ptr;
- }
+static void __small_free(void*_ptr,size_t _size) {
+ __alloc_t* ptr=BLOCK_START(_ptr);
+ size_t size=_size;
+ size_t idx=get_index(size);
+
+ memset(ptr,0,size); /* allways zero out small mem */
+
+ ptr->next=__small_mem[idx];
+ __small_mem[idx]=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;
+static void* __small_malloc(size_t _size) {
+ __alloc_t *ptr;
+ size_t size=_size;
+ size_t idx;
+
+ idx=get_index(size);
+ ptr=__small_mem[idx];
- /* make a header */
- ah=(alloc_head*)tmp;
- ah->magic1=ALLOC_MAGIC1;
- ah->magic2=ALLOC_MAGIC2;
- ah->ptr=ah;
- ah->size=size;
+ if (ptr==0) { /* no free blocks ? */
+ register int i,nr;
+ ptr=do_mmap(MEM_BLOCK_SIZE);
+ if (ptr==MAP_FAILED) return MAP_FAILED;
+
+ __small_mem[idx]=ptr;
+
+ nr=__SMALL_NR(size)-1;
+ for (i=0;i<nr;i++) {
+ ptr->next=(((void*)ptr)+size);
+ ptr=ptr->next;
+ }
+ ptr->next=0;
+
+ ptr=__small_mem[idx];
+ }
- /* link new free maped pages in freelist */
- __libc_free(START_DATA(tmp));
+ /* get a free block */
+ __small_mem[idx]=ptr->next;
+ ptr->next=0;
- return &base;
+ return ptr;
}
-void *__libc_malloc(size_t size)
-{
- alloc_head *p, *prev;
- size_t need;
+/* -- PUBLIC FUNCTIONS ---------------------------------------------------- */
- /* 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 */
- }
+static void _alloc_libc_free(void *ptr) {
+ register size_t size;
+ if (ptr) {
+ size=((__alloc_t*)BLOCK_START(ptr))->size;
+ if (size) {
+ if (size<=__MAX_SMALL_SIZE)
+ __small_free(ptr,size);
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 */
- }
+ munmap(BLOCK_START(ptr),size);
+ }
+ }
+}
+void __libc_free(void *ptr) __attribute__((alias("_alloc_libc_free")));
+void free(void *ptr) __attribute__((weak,alias("_alloc_libc_free")));
+void if_freenameindex(void* ptr) __attribute__((alias("free")));
- p->size=need; /* set size */
- }
- p->ptr=p; /* self-link */
+#ifdef WANT_MALLOC_ZERO
+static __alloc_t zeromem[2]={{0},{0}};
+#endif
- return (void*)START_DATA(p);
- }
- else if (p==&base)
- {
- if ((p=alloc_get_mem(need))==NULL) goto err_out;
- }
+static void* _alloc_libc_malloc(size_t size) {
+ __alloc_t* ptr;
+ size_t need;
+#ifdef WANT_MALLOC_ZERO
+ if (!size) return BLOCK_RET(zeromem);
+#else
+ if (!size) goto retzero;
+#endif
+ size+=sizeof(__alloc_t);
+ if (size<sizeof(__alloc_t)) goto retzero;
+ if (size<=__MAX_SMALL_SIZE) {
+ need=GET_SIZE(size);
+ ptr=__small_malloc(need);
+ }
+ else {
+ need=PAGE_ALIGN(size);
+ if (!need) ptr=MAP_FAILED; else ptr=do_mmap(need);
}
+ if (ptr==MAP_FAILED) goto err_out;
+ ptr->size=need;
+ return BLOCK_RET(ptr);
err_out:
- return NULL;
+ (*__errno_location())=ENOMEM;
+retzero:
+ return 0;
}
-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* __libc_malloc(size_t size) __attribute__((alias("_alloc_libc_malloc")));
+void* malloc(size_t size) __attribute__((weak,alias("_alloc_libc_malloc")));
+
+void *calloc(size_t nmemb, size_t _size) {
+ register size_t size=_size*nmemb;
+ if (nmemb && size/nmemb!=_size) {
+ (*__errno_location())=ENOMEM;
+ return 0;
+ }
+ return malloc(size);
}
-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;
+void* __libc_realloc(void* ptr, size_t _size);
+void* __libc_realloc(void* ptr, size_t _size) {
+ register size_t size=_size;
+ if (ptr) {
+ if (size) {
+ __alloc_t* tmp=BLOCK_START(ptr);
+ size+=sizeof(__alloc_t);
+ if (size<sizeof(__alloc_t)) goto retzero;
+ size=(size<=__MAX_SMALL_SIZE)?GET_SIZE(size):PAGE_ALIGN(size);
+ if (tmp->size!=size) {
+ if ((tmp->size<=__MAX_SMALL_SIZE)) {
+ void *new=_alloc_libc_malloc(_size);
+ if (new) {
+ register __alloc_t* foo=BLOCK_START(new);
+ size=foo->size;
+ if (size>tmp->size) size=tmp->size;
+ if (size) memcpy(new,ptr,size-sizeof(__alloc_t));
+ _alloc_libc_free(ptr);
+ }
+ ptr=new;
+ }
+ else {
+ register __alloc_t* foo;
+ size=PAGE_ALIGN(size);
+ foo=mremap(tmp,tmp->size,size,MREMAP_MAYMOVE);
+ if (foo==MAP_FAILED) {
+retzero:
+ (*__errno_location())=ENOMEM;
+ ptr=0;
+ }
+ else {
+ foo->size=size;
+ ptr=BLOCK_RET(foo);
+ }
}
- 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 { /* size==0 */
+ _alloc_libc_free(ptr);
+ }
}
- else if (size>0)
- return malloc(size);
- return NULL;
+ else { /* ptr==0 */
+ if (size) {
+ ptr=_alloc_libc_malloc(size);
+ }
+ }
+ return ptr;
}
+void* realloc(void* ptr, size_t size) __attribute__((weak,alias("__libc_realloc")));
+
diff --git a/mdk-stage1/dietlibc/lib/assert_fail.c b/mdk-stage1/dietlibc/lib/assert_fail.c
index 3d6ba65c1..35b8b186a 100644
--- a/mdk-stage1/dietlibc/lib/assert_fail.c
+++ b/mdk-stage1/dietlibc/lib/assert_fail.c
@@ -2,14 +2,15 @@
#include <string.h>
#include <unistd.h>
#include "dietwarning.h"
+#include <write12.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);
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);
+ unsigned int alen=strlen(assertion);
+ unsigned int flen=strlen(file);
+ unsigned int fulen=function?strlen(function):0;
char *buf=(char*)alloca(alen+flen+fulen+50);
if (buf) {
char *tmp;
@@ -22,7 +23,7 @@ void __assert_fail (const char *assertion, const char *file, unsigned int line,
strcat(buf,"Assertion `");
strcat(buf,assertion);
strcat(buf,"' failed.\n");
- write(2,buf,strlen(buf));
+ __write2(buf);
}
abort();
}
diff --git a/mdk-stage1/dietlibc/lib/atexit.c b/mdk-stage1/dietlibc/lib/atexit.c
index 8204af06c..e0eef19c6 100644
--- a/mdk-stage1/dietlibc/lib/atexit.c
+++ b/mdk-stage1/dietlibc/lib/atexit.c
@@ -1,23 +1,31 @@
+#include <stdlib.h>
+
typedef void (*function)(void);
-static function __atexitlist[4];
+#define NUM_ATEXIT 32
+
+static function __atexitlist[NUM_ATEXIT];
+static int atexit_counter = 0;
int atexit(function t) {
- int i;
- for (i=0; i<4; i++)
- if (__atexitlist[i]==0) {
- __atexitlist[i]=t;
- return 0;
- }
+ if (atexit_counter<NUM_ATEXIT) {
+ __atexitlist[atexit_counter]=t;
+ ++atexit_counter;
+ return 0;
+ }
return -1;
}
extern void _exit(int code) __attribute__((noreturn));
+extern void __thread_doexit();
-void exit(int code) {
- if (__atexitlist[3]) __atexitlist[3]();
- if (__atexitlist[2]) __atexitlist[2]();
- if (__atexitlist[1]) __atexitlist[1]();
- if (__atexitlist[0]) __atexitlist[0]();
+void __libc_exit(int code);
+void __libc_exit(int code) {
+ register int i=atexit_counter;
+ __thread_doexit();
+ while(i) {
+ __atexitlist[--i]();
+ }
_exit(code);
}
+void exit(int code) __attribute__((alias("__libc_exit")));
diff --git a/mdk-stage1/dietlibc/lib/atoi.c b/mdk-stage1/dietlibc/lib/atoi.c
index fe952b8c4..10b618950 100644
--- a/mdk-stage1/dietlibc/lib/atoi.c
+++ b/mdk-stage1/dietlibc/lib/atoi.c
@@ -1,8 +1,19 @@
+#include <endian.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+#if __WORDSIZE == 64
int atoi(const char* s) {
- int v=0;
+ 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;
+ while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++;
+ switch (*s) {
+ case '-': sign=-1;
+ case '+': ++s;
+ }
+ while ((unsigned int) (*s - '0') < 10u) {
+ v=v*10+*s-'0'; ++s;
+ }
+ return sign==-1?-v:v;
}
+#endif
diff --git a/mdk-stage1/dietlibc/lib/atol.c b/mdk-stage1/dietlibc/lib/atol.c
index 558a004b9..5961a1881 100644
--- a/mdk-stage1/dietlibc/lib/atol.c
+++ b/mdk-stage1/dietlibc/lib/atol.c
@@ -1,8 +1,23 @@
+#include <endian.h>
+#include <ctype.h>
+#include <stdlib.h>
+
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;
+ int sign=0;
+ while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s;
+ switch (*s) {
+ case '-': sign=-1;
+ case '+': ++s;
+ }
+ while ((unsigned int) (*s - '0') < 10u) {
+ v=v*10+*s-'0'; ++s;
+ }
+ return sign?-v:v;
}
+
+#if __WORDSIZE == 64
+long long int atoll(const char* s) __attribute__((alias("atol")));
+#else
+int atoi(const char* s) __attribute__((alias("atol")));
+#endif
diff --git a/mdk-stage1/dietlibc/lib/atoll.c b/mdk-stage1/dietlibc/lib/atoll.c
new file mode 100644
index 000000000..7bf2b2fd6
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/atoll.c
@@ -0,0 +1,19 @@
+#include <endian.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+#if __WORDSIZE != 64
+long long int atoll(const char* s) {
+ long long int v=0;
+ int sign=1;
+ while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s;
+ switch (*s) {
+ case '-': sign=-1;
+ case '+': ++s;
+ }
+ while ((unsigned int) (*s - '0') < 10u) {
+ v=v*10+*s-'0'; ++s;
+ }
+ return sign==-1?-v:v;
+}
+#endif
diff --git a/mdk-stage1/dietlibc/lib/bcd.c b/mdk-stage1/dietlibc/lib/bcd.c
new file mode 100644
index 000000000..1936b82f6
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/bcd.c
@@ -0,0 +1,185 @@
+
+static long double powers [] = {
+ 1.e+1, 1.e+2, 1.e+4, 1.e+8, 1.e+16, 1.e+32, 1.e+64, 1.e+128, 1.e+256
+};
+
+/*
+ * So, die ist zum Zerlegen von Gleitkommazahlen am besten geeignet.
+ *
+ * Die nichtnegative übergebende Gleitkommazahl number wird in einen
+ * Exponenten e und eine Mantisse m zerlegt mit:
+ *
+ * 1 <= m < 10
+ * number = m * 10^e
+ *
+ * Die Mantisse wird in precision Dezimalstellen zerlegt, die nach digits
+ * geschrieben werden. digits[0] ist die Vorkommastelle, digits [1 ...
+ * precision-1] die Nachkommastellen der Mantisse Zurückgeliefert wird der
+ * Exponent.
+ *
+ * Für precision ist ein Wert von 0 erlaubt, Sinn machen allerdings erst
+ * Werte ab 1.
+ */
+
+int __decompose_floatp ( long double number,
+ unsigned char* digits, unsigned int precision );
+
+int __decompose_floatp ( long double number,
+ unsigned char* digits, unsigned int precision )
+{
+ int ret = 0;
+ int i;
+ double tmp;
+
+ if ( number > 0.L ) {
+
+ // Exponent abtrennen
+ if ( number >= 10.L ) {
+ for ( i = sizeof(powers)/sizeof(*powers)-1; i >= 0; i--)
+ if ( number >= powers [i] ) {
+ number /= powers [i];
+ ret += 1 << i;
+ }
+ } else if ( number < 1.L )
+ for ( i = sizeof(powers)/sizeof(*powers)-1; i >= 0; i--)
+ if ( number * powers [i] < 10.L ) {
+ number *= powers [i];
+ ret -= 1 << i;
+ }
+
+ // Runden (ohne Geradezahlregel => Bug)
+ tmp = 5.;
+ {
+ unsigned int j;
+ for ( j = 0; j < precision; j++ )
+ tmp *= 0.1;
+ }
+
+ number += tmp;
+
+ // Dabei kann die Zahl in die nächste Dekade reinrutschen ...
+ if ( number >= 10.L ) {
+ number = 1.L;
+ ret++;
+ }
+ }
+
+ // Mantisse in ASCII konvertieren
+ while ( precision-- ) {
+ i = (int) number;
+ number = (number - i) * 10.L;
+ *digits++ = '0' + i;
+ }
+
+ // Exponent zurück
+ return ret;
+}
+
+
+/*
+ * So, die ist zum Zerlegen von Festkommazahlen am besten geeignet.
+ *
+ * Die nichtnegative übergebende Festkomma wird in einen Integeranteil und
+ * einen Bruchanteil zerlegt.
+ *
+ * Der Bruchanteil wird in digits_frac[0...precision_frac-1] gespeichert,
+ * falls precision_frac != 0 ist.
+ *
+ * Der Integeranteil wird ab digits_int + precision_int - 1 rückwrts
+ * geschrieben. Zurückgeliefert wird ein Zeiger auf das erste Zeichen, das
+ * bei der Konvertierung != '0' ist (Ausnahme ist die 0.0 selbst). Zeichen
+ * zwischen digits_int und diesem Zeiger (exklusive des Zeichens unter dem
+ * Zeiger) sind unbestimmt. Wünscht man dort Nullen oder Leerzeichen,
+ * sollte man mittels memset() dieses vorher initialsieren.
+ */
+
+char* __decompose_fixp ( long double number,
+ unsigned char* digits_int , unsigned int precision_int,
+ unsigned char* digits_frac, unsigned int precision_frac );
+
+char* __decompose_fixp ( long double number,
+ unsigned char* digits_int , unsigned int precision_int,
+ unsigned char* digits_frac, unsigned int precision_frac )
+{
+ long long int integer;
+ double tmp;
+ int i;
+
+ // Runden (ohne Geradezahlregel => Bug)
+ tmp = 0.5;
+ {
+ unsigned int j;
+ for ( j = 0; j < precision_frac; j++ )
+ tmp *= 0.1;
+ }
+
+ number += tmp;
+
+ integer = number;
+ number -= integer;
+
+ // Nachkommastellen
+ while ( precision_frac-- ) {
+ number *= 10.L;
+ i = (int) number;
+ number -= i;
+ *digits_frac++
+ = '0' + i;
+ }
+
+ // Vorkommastellen
+ while ( precision_int ) {
+ i = (int) (integer % 10);
+ integer /= 10;
+ digits_int [--precision_int]
+ = '0' + i;
+ if ( integer == 0 )
+ break;
+ }
+
+ return digits_int + precision_int;
+}
+
+
+#if 0
+
+#include <stdio.h>
+#include <math.h>
+
+long double test [] = {
+ 1, M_PI, 123, 123456789, 12345678901234567, 1e300, 0.00123456789, 1.234567890123456e-300, 0
+};
+
+int main ( void )
+{
+ int i;
+ int j;
+ int k;
+ char buff1 [32];
+ char buff2 [32];
+ char* retp;
+ int ret;
+
+ for ( i = 0; i < sizeof(test)/sizeof(*test); i++ ) {
+ printf ("\n*** %30.20Lf ***\n\n", test[i] );
+
+ for ( j = 0; j <= 20; j++ ) {
+ memset ( buff1, 0, sizeof(buff1) );
+ ret = __decompose_floatp ( test[i], buff1, j );
+ printf ( "floatp(%2u) = <%sE%+d>\n", j, buff1, ret );
+ }
+ for ( j = 0; j <= 20; j++ ) {
+ for ( k = 0; k <= 20; k++ ) {
+ memset ( buff1, 0, sizeof(buff1) );
+ memset ( buff2, 0, sizeof(buff2) );
+ retp = __decompose_fixp ( test[i], buff1, j, buff2, k );
+ printf ( "fixp(%2u,%2u) = <%s.%s>\n", j, k, retp, buff2 );
+ }
+ }
+
+ }
+
+ return 0;
+}
+
+#endif
diff --git a/mdk-stage1/dietlibc/lib/bind.c b/mdk-stage1/dietlibc/lib/bind.c
index ec1c93e1b..dae80f491 100644
--- a/mdk-stage1/dietlibc/lib/bind.c
+++ b/mdk-stage1/dietlibc/lib/bind.c
@@ -1,12 +1,11 @@
-#include <linux/net.h>
+#include <linuxnet.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
+int __libc_bind(int a, void * b, int c);
+int __libc_bind(int a, void * b, int c) {
unsigned long args[] = { a, (long) b, c };
return socketcall(SYS_BIND, args);
-#endif
}
+
+int bind(int a, void * b, int c) __attribute__((weak,alias("__libc_bind")));
diff --git a/mdk-stage1/dietlibc/lib/binshstr.c b/mdk-stage1/dietlibc/lib/binshstr.c
new file mode 100644
index 000000000..814297e3d
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/binshstr.c
@@ -0,0 +1,5 @@
+#include "binshstr.h"
+
+const char __binsh [] = "/bin/sh";
+
+/* end of binshstr.c */
diff --git a/mdk-stage1/dietlibc/lib/bsearch.c b/mdk-stage1/dietlibc/lib/bsearch.c
index d2f5c74b2..14605f1f6 100644
--- a/mdk-stage1/dietlibc/lib/bsearch.c
+++ b/mdk-stage1/dietlibc/lib/bsearch.c
@@ -1,20 +1,20 @@
+#include <assert.h>
#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);
+ size_t m;
+ while (nmemb) {
+ int tmp;
+ void *p;
+ m=nmemb/2;
+ p=(void *) (((const char *) base) + (m * size));
+ if ((tmp=(*compar)(key,p))<0) {
+ nmemb=m;
+ } else if (tmp>0) {
+ base=p+size;
+ nmemb-=m+1;
+ } else
+ return p;
+ }
return 0;
}
diff --git a/mdk-stage1/dietlibc/lib/cfgetospeed.c b/mdk-stage1/dietlibc/lib/cfgetospeed.c
new file mode 100644
index 000000000..c330352b2
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/cfgetospeed.c
@@ -0,0 +1,8 @@
+#include <termios.h>
+#include <sys/types.h>
+
+speed_t cfgetospeed(struct termios *termios_p) {
+ return ((termios_p->c_cflag & (CBAUD|CBAUDEX)));
+}
+
+speed_t cfgetispeed(struct termios *termios_p) __attribute__((weak,alias("cfgetospeed")));
diff --git a/mdk-stage1/dietlibc/lib/cfmakeraw.c b/mdk-stage1/dietlibc/lib/cfmakeraw.c
index 7f6df9913..e33c783c9 100644
--- a/mdk-stage1/dietlibc/lib/cfmakeraw.c
+++ b/mdk-stage1/dietlibc/lib/cfmakeraw.c
@@ -1,8 +1,7 @@
#include <termios.h>
#include <sys/ioctl.h>
-void cfmakeraw(struct termios *t)
-{
+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);
diff --git a/mdk-stage1/dietlibc/lib/cfsetispeed.c b/mdk-stage1/dietlibc/lib/cfsetispeed.c
new file mode 100644
index 000000000..ab0333853
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/cfsetispeed.c
@@ -0,0 +1,22 @@
+#include <termios.h>
+#include <errno.h>
+#include "dietfeatures.h"
+
+#define IBAUD0 020000000000
+
+int cfsetispeed(struct termios *termios_p, speed_t speed)
+{
+ if ((speed & (speed_t)~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/cfsetospeed.c b/mdk-stage1/dietlibc/lib/cfsetospeed.c
new file mode 100644
index 000000000..d1aee3595
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/cfsetospeed.c
@@ -0,0 +1,14 @@
+#include <termios.h>
+#include <errno.h>
+#include "dietfeatures.h"
+
+int cfsetospeed(struct termios *termios_p, speed_t speed) {
+ if ((speed & (speed_t)~CBAUD) != 0 && (speed < B57600 || speed > B460800)) {
+ errno=EINVAL;
+ return -1;
+ }
+ termios_p->c_cflag &= ~(CBAUD | CBAUDEX);
+ termios_p->c_cflag |= speed;
+ return 0;
+}
+
diff --git a/mdk-stage1/dietlibc/lib/closedir.c b/mdk-stage1/dietlibc/lib/closedir.c
index e73025eb1..3aade81b3 100644
--- a/mdk-stage1/dietlibc/lib/closedir.c
+++ b/mdk-stage1/dietlibc/lib/closedir.c
@@ -1,10 +1,11 @@
#include "dietdirent.h"
+#include <sys/mman.h>
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
int closedir (DIR* d) {
int res=close(d->fd);
- free(d);
+ munmap (d, PAGE_SIZE);
return res;
}
diff --git a/mdk-stage1/dietlibc/lib/connect.c b/mdk-stage1/dietlibc/lib/connect.c
index 01fd61a6c..642303ef3 100644
--- a/mdk-stage1/dietlibc/lib/connect.c
+++ b/mdk-stage1/dietlibc/lib/connect.c
@@ -1,14 +1,11 @@
-#include <linux/net.h>
+#include <linuxnet.h>
extern int socketcall(int callno,long* args);
+int __libc_connect(int a, void * b, int c);
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
index 82145b515..41d8236aa 100644
--- a/mdk-stage1/dietlibc/lib/creat.c
+++ b/mdk-stage1/dietlibc/lib/creat.c
@@ -1,5 +1,7 @@
#include <fcntl.h>
-int creat(const char *file,mode_t mode) {
+int __libc_creat(const char *file,mode_t mode);
+int __libc_creat(const char *file,mode_t mode) {
return open(file,O_WRONLY|O_CREAT|O_TRUNC,mode);
}
+int creat(const char *file,mode_t mode) __attribute__((weak,alias("__libc_creat")));
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/errlistu.c b/mdk-stage1/dietlibc/lib/errlistu.c
new file mode 100644
index 000000000..15e38807b
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/errlistu.c
@@ -0,0 +1,6 @@
+/*
+ * used by perror() and strerror()
+ */
+
+const char __sys_err_unknown [] = "[unknown error]";
+
diff --git a/mdk-stage1/dietlibc/lib/errno_location.c b/mdk-stage1/dietlibc/lib/errno_location.c
index 286f833c9..298c9c3cf 100644
--- a/mdk-stage1/dietlibc/lib/errno_location.c
+++ b/mdk-stage1/dietlibc/lib/errno_location.c
@@ -1,5 +1,5 @@
extern int errno;
+int *__errno_location(void) __attribute__((weak));
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
index 3129224a0..575c03d6d 100644
--- a/mdk-stage1/dietlibc/lib/exec_lib.c
+++ b/mdk-stage1/dietlibc/lib/exec_lib.c
@@ -3,18 +3,19 @@
extern char **environ;
+int __exec_shell(const char *file, char *const argv[]);
int __exec_shell(const char *file, char *const argv[]) {
int i;
for (i = 0; argv[i]; i++);
{
- char *shell_argv[i + 1];
+ const char *shell_argv[i + 1];
shell_argv[0] = _PATH_BSHELL;
- shell_argv[1] = (char *) file;
+ shell_argv[1] = file;
for (; i > 1; i--)
shell_argv[i] = argv[i - 1];
- return execve(_PATH_BSHELL, shell_argv, environ);
+ return execve(_PATH_BSHELL, (char*const*)shell_argv, environ);
}
}
diff --git a/mdk-stage1/dietlibc/lib/execl.c b/mdk-stage1/dietlibc/lib/execl.c
index 71459e71f..360bd3908 100644
--- a/mdk-stage1/dietlibc/lib/execl.c
+++ b/mdk-stage1/dietlibc/lib/execl.c
@@ -2,6 +2,7 @@
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
+#include "dietfeatures.h"
int execl( const char *path,...) {
va_list ap;
@@ -19,6 +20,6 @@ int execl( const char *path,...) {
va_end (ap);
return execve(path,argv,environ);
}
- __set_errno(ENOMEM);
+ errno=ENOMEM;
return -1;
}
diff --git a/mdk-stage1/dietlibc/lib/execle.c b/mdk-stage1/dietlibc/lib/execle.c
new file mode 100644
index 000000000..6d05c48a0
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/execle.c
@@ -0,0 +1,26 @@
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include "dietfeatures.h"
+
+int execle( const char *path,...) {
+ va_list ap;
+ int n,i;
+ char **argv,*tmp, **env;
+ 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 *);
+ env=va_arg(ap, char **);
+ va_end (ap);
+ return execve(path,argv,env);
+ }
+ errno=ENOMEM;
+ return -1;
+}
diff --git a/mdk-stage1/dietlibc/lib/execlp.c b/mdk-stage1/dietlibc/lib/execlp.c
index 3aea1e960..27dc0bb95 100644
--- a/mdk-stage1/dietlibc/lib/execlp.c
+++ b/mdk-stage1/dietlibc/lib/execlp.c
@@ -2,7 +2,7 @@
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
-#include "dietstdarg.h"
+#include "dietfeatures.h"
int execlp(const char* file, const char *arg,...) {
va_list ap,bak;
@@ -15,12 +15,12 @@ int execlp(const char* file, const char *arg,...) {
++n;
va_end (ap);
if ((argv=(char **)alloca(n*sizeof(char*)))) {
- argv[0]=arg;
+ argv[0]=(char*)arg;
for (i=0; i<n; ++i)
argv[i+1]=va_arg(bak,char *);
va_end (bak);
return execvp(file,argv);
}
- __set_errno(ENOMEM);
+ errno=ENOMEM;
return -1;
}
diff --git a/mdk-stage1/dietlibc/lib/execv.c b/mdk-stage1/dietlibc/lib/execv.c
index efd760253..d7acfa29f 100644
--- a/mdk-stage1/dietlibc/lib/execv.c
+++ b/mdk-stage1/dietlibc/lib/execv.c
@@ -4,10 +4,12 @@
#include <unistd.h>
#include <errno.h>
#include "exec_lib.h"
+#include "dietfeatures.h"
int execv(const char *file, char *const argv[]) {
if (execve(file,argv,environ)==-1) {
- if (errno==ENOEXEC) __exec_shell(file,argv);
+ 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
index 20521d69f..72447af7a 100644
--- a/mdk-stage1/dietlibc/lib/execvp.c
+++ b/mdk-stage1/dietlibc/lib/execvp.c
@@ -4,31 +4,40 @@
#include <unistd.h>
#include <errno.h>
#include "exec_lib.h"
+#include "dietfeatures.h"
int execvp(const char *file, char *const argv[]) {
- char *path=getenv("PATH");
+ const 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);
+ if (errno==ENOEXEC)
+ __exec_shell(file,argv);
return -1;
}
}
if (!path) path=_PATH_DEFPATH;
- for (cur=path; cur; cur=next) {
+ for (cur=(char*)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);
+ } else {
+ if (next-cur>=PATH_MAX-3) { error: errno=EINVAL; return -1; }
+ memmove(buf,cur,(size_t)(next-cur));
+ }
buf[next-cur]='/';
- memmove(&buf[next-cur+1],file,strlen(file)+1);
+ {
+ int len=strlen(file);
+ if (len+(next-cur)>=PATH_MAX-2) goto error;
+ 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==ENOEXEC)
+ return __exec_shell(buf,argv);
if ((errno!=EACCES) && (errno!=ENOENT)) return -1;
}
if (*next==0) break;
diff --git a/mdk-stage1/dietlibc/lib/ftw.c b/mdk-stage1/dietlibc/lib/ftw.c
index a3c04af9a..af13a7f86 100644
--- a/mdk-stage1/dietlibc/lib/ftw.c
+++ b/mdk-stage1/dietlibc/lib/ftw.c
@@ -1,52 +1,47 @@
-#include <linux/stat.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <limits.h>
#include <ftw.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
+#include "dietdirent.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;
+int ftw(const char*dir,int(*f)(const char*file,const struct stat*sb,int flag),int dpth){
+ char* cd;
+ size_t cdl;
+ 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;
+ int r;
+ unsigned int oldlen=0;
+ char* filename; /* the warning gcc issues here is bogus */
+ if(chdir(dir))return-1;
+ cd=alloca(PATH_MAX+1);
+ if(!getcwd(cd,PATH_MAX))return-1;
+ cd[PATH_MAX]='\0';
+ cdl=strlen(cd);
+ if(!(d=opendir(".")))return-1;
+ while((de=readdir(d))){
+ int flg;
+ size_t nl;
+ if(de->d_name[0]=='.'){if(!de->d_name[1])continue;if(de->d_name[1]=='.'&&!de->d_name[2])continue;}
+ nl=strlen(de->d_name);
+ if (nl+cdl+2>oldlen)
+ filename=alloca(oldlen=nl+cdl+2);
+ memmove(filename,cd,cdl);
+ filename[cdl]='/';
+ memmove(filename+cdl+1,de->d_name,nl+1);
+ if(!lstat(de->d_name,&sb)){
+ if(S_ISLNK(sb.st_mode))flg=FTW_SL;else if(S_ISDIR(sb.st_mode))flg=FTW_D;else flg=FTW_F;
+ }else flg=FTW_NS;
+ r=f(filename,&sb,flg);
+ if(r){closedir(d);return r;}
+ if(flg==FTW_D&&dpth){
+ r=ftw(filename,f,dpth-1);
+ fchdir(d->fd);
+ if (r){closedir(d);return r;}
}
-/* puts(de->d_name); */
}
- closedir(d);
- return 0;
+ return closedir(d);
}
diff --git a/mdk-stage1/dietlibc/lib/getdomainname.c b/mdk-stage1/dietlibc/lib/getdomainname.c
index 2554fe4c3..75486b010 100644
--- a/mdk-stage1/dietlibc/lib/getdomainname.c
+++ b/mdk-stage1/dietlibc/lib/getdomainname.c
@@ -2,12 +2,13 @@
#include <sys/types.h>
#include <sys/utsname.h>
+#include <unistd.h>
int getdomainname(char *name,size_t len) {
struct utsname u;
int res=uname(&u);
if (res==0) {
- int i;
+ size_t i;
if (len>=_UTSNAME_DOMAIN_LENGTH)
len=_UTSNAME_DOMAIN_LENGTH;
for (i=0; i<len; i++)
diff --git a/mdk-stage1/dietlibc/lib/getenv.c b/mdk-stage1/dietlibc/lib/getenv.c
index fc37e9927..5b529c17f 100644
--- a/mdk-stage1/dietlibc/lib/getenv.c
+++ b/mdk-stage1/dietlibc/lib/getenv.c
@@ -1,7 +1,6 @@
+#include <stdlib.h>
#include <string.h>
-extern char **environ;
-
extern char *getenv(const char *s)
{
int i;
diff --git a/mdk-stage1/dietlibc/lib/gethostname.c b/mdk-stage1/dietlibc/lib/gethostname.c
index ccc0fbc8e..c3d2f3d5e 100644
--- a/mdk-stage1/dietlibc/lib/gethostname.c
+++ b/mdk-stage1/dietlibc/lib/gethostname.c
@@ -2,12 +2,13 @@
#include <sys/types.h>
#include <sys/utsname.h>
+#include <unistd.h>
int gethostname(char *name,size_t len) {
struct utsname u;
int res=uname(&u);
if (res==0) {
- int i;
+ size_t i;
if (len>=_UTSNAME_NODENAME_LENGTH)
len=_UTSNAME_NODENAME_LENGTH;
for (i=0; i<len; i++)
diff --git a/mdk-stage1/dietlibc/lib/getopt.c b/mdk-stage1/dietlibc/lib/getopt.c
index 93097122f..aa1988f8d 100644
--- a/mdk-stage1/dietlibc/lib/getopt.c
+++ b/mdk-stage1/dietlibc/lib/getopt.c
@@ -1,118 +1,63 @@
-#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;
+#include <getopt.h>
+
+static void getopterror(int which) {
+ static char error1[]="Unknown option `-x'.\n";
+ static char error2[]="Missing argument for `-x'.\n";
+ if (opterr) {
+ if (which) {
+ error2[23]=optopt;
+ write(2,error2,28);
+ } else {
+ error1[17]=optopt;
+ write(2,error1,22);
}
}
- 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;
+int getopt(int argc, char * const argv[], const char *optstring) {
+ static int lastidx=0,lastofs=0;
+ char *tmp;
+ if (optind==0) optind=1; /* whoever started setting optind to 0 should be shot */
+again:
+ if (optind>argc || !argv[optind] || *argv[optind]!='-' || argv[optind][1]==0)
+ return -1;
+ if (argv[optind][1]=='-' && argv[optind][2]==0) {
+ ++optind;
+ return -1;
}
-}
-
-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;
+ if (lastidx!=optind) {
+ lastidx=optind; lastofs=0;
+ }
+ optopt=argv[optind][lastofs+1];
+ if ((tmp=strchr(optstring,optopt))) {
+ if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
+ ++optind;
+ goto again;
}
- 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];
- }
+ if (tmp[1]==':') { /* argument expected */
+ if (tmp[2]==':' || argv[optind][lastofs+2]) { /* "-foo", return "oo" as optarg */
+ if (!*(optarg=argv[optind]+lastofs+2)) optarg=0;
+ goto found;
}
- else
- {
- ++opt_unknown_len;
+ optarg=argv[optind+1];
+ if (!optarg) { /* missing argument */
+ ++optind;
+ if (*optstring==':') return ':';
+ getopterror(1);
+ return ':';
}
++optind;
+ } else {
+ ++lastofs;
+ return optopt;
}
+found:
+ ++optind;
+ return optopt;
+ } else { /* not found */
+ getopterror(0);
+ ++optind;
+ return '?';
}
- optind=opt_unknown;
- return -1;
}
diff --git a/mdk-stage1/dietlibc/lib/getpeername.c b/mdk-stage1/dietlibc/lib/getpeername.c
index 8adcddf55..c806c720d 100644
--- a/mdk-stage1/dietlibc/lib/getpeername.c
+++ b/mdk-stage1/dietlibc/lib/getpeername.c
@@ -1,13 +1,12 @@
-#include <linux/net.h>
+#include <linuxnet.h>
+#include <sys/socket.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 };
+int __libc_getpeername(int a, void * b, int *c);
+int __libc_getpeername(int a, void * b, int *c) {
+ unsigned long args[] = { a, (long) b, (long) c };
return socketcall(SYS_GETPEERNAME, args);
-#endif
}
+int getpeername(int a, struct sockaddr* b, socklen_t *c) __attribute__((weak,alias("__libc_getpeername")));
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
index 61a3ea24a..6c81e317d 100644
--- a/mdk-stage1/dietlibc/lib/getsockname.c
+++ b/mdk-stage1/dietlibc/lib/getsockname.c
@@ -1,13 +1,12 @@
-#include <linux/net.h>
+#include <linuxnet.h>
+#include <sys/socket.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
+int __libc_getsockname(int a, void * b, int c);
+int __libc_getsockname(int a, void * b, int c) {
unsigned long args[] = { a, (long) b, c };
return socketcall(SYS_GETSOCKNAME, args);
-#endif
}
+int getsockname(int a, struct sockaddr* b, socklen_t* c) __attribute__((weak,alias("__libc_getsockname")));
diff --git a/mdk-stage1/dietlibc/lib/getsockopt.c b/mdk-stage1/dietlibc/lib/getsockopt.c
index 8c0a57557..05b71d77d 100644
--- a/mdk-stage1/dietlibc/lib/getsockopt.c
+++ b/mdk-stage1/dietlibc/lib/getsockopt.c
@@ -1,13 +1,12 @@
-#include <linux/net.h>
+#include <linuxnet.h>
+#include <sys/socket.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
+int __libc_getsockopt(int a, int b, int c, void *d, int e);
+int __libc_getsockopt(int a, int b, int c, void *d, int e) {
unsigned long args[] = { a, b, c, (long)d, e };
return socketcall(SYS_GETSOCKOPT, args);
-#endif
}
+int getsockopt(int s, int level, int optname, void * optval, socklen_t *optlen) __attribute__((weak,alias("__libc_getsockopt")));
diff --git a/mdk-stage1/dietlibc/lib/htonl.c b/mdk-stage1/dietlibc/lib/htonl.c
index 490de42c4..04a1e4265 100644
--- a/mdk-stage1/dietlibc/lib/htonl.c
+++ b/mdk-stage1/dietlibc/lib/htonl.c
@@ -1,4 +1,5 @@
#include <endian.h>
+#include <netinet/in.h>
unsigned long int htonl(unsigned long int hostlong) {
#if __BYTE_ORDER==__LITTLE_ENDIAN
diff --git a/mdk-stage1/dietlibc/lib/htons.c b/mdk-stage1/dietlibc/lib/htons.c
index 765d3bbc5..071001911 100644
--- a/mdk-stage1/dietlibc/lib/htons.c
+++ b/mdk-stage1/dietlibc/lib/htons.c
@@ -1,4 +1,5 @@
#include <endian.h>
+#include <netinet/in.h>
unsigned short int htons(unsigned short int hostshort) {
#if __BYTE_ORDER==__LITTLE_ENDIAN
diff --git a/mdk-stage1/dietlibc/lib/if_indextoname.c b/mdk-stage1/dietlibc/lib/if_indextoname.c
index e683755f6..cc3111ed8 100644
--- a/mdk-stage1/dietlibc/lib/if_indextoname.c
+++ b/mdk-stage1/dietlibc/lib/if_indextoname.c
@@ -1,5 +1,4 @@
-#include <linux/if.h>
-#include <linux/net.h>
+#include <net/if.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/socket.h>
diff --git a/mdk-stage1/dietlibc/lib/if_nameindex.c b/mdk-stage1/dietlibc/lib/if_nameindex.c
new file mode 100644
index 000000000..fc0e1c0ff
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/if_nameindex.c
@@ -0,0 +1,40 @@
+#include <net/if.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+
+struct if_nameindex* if_nameindex(void) {
+ struct ifconf ic;
+ int fd,len,i;
+ struct if_nameindex* x,* y;
+ char *dest;
+ fd=socket(AF_INET6,SOCK_DGRAM,0);
+ if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0);
+ ic.ifc_buf=0;
+ ic.ifc_len=0;
+ if (ioctl(fd,SIOCGIFCONF,&ic)<0) {
+b0rken:
+ close(fd);
+ return 0;
+ }
+ ic.ifc_buf=alloca((size_t)ic.ifc_len);
+ if (ioctl(fd,SIOCGIFCONF,&ic)<0) goto b0rken;
+ len=(ic.ifc_len/sizeof(struct ifreq));
+ x=(struct if_nameindex*)malloc((len+1)*sizeof(struct if_nameindex)+len*IFNAMSIZ);
+ if (!x) goto b0rken;
+ dest=(char*)(x+len+1);
+ y=x;
+ for (i=0; i<len; ++i) {
+ struct ifreq* ir=(struct ifreq*)&ic.ifc_req[i];
+ y->if_name=dest;
+ memcpy(dest,ir->ifr_name,IFNAMSIZ);
+ if (ioctl(fd,SIOCGIFINDEX,ir)==-1) continue;
+ y->if_index=ir->ifr_ifindex;
+ dest+=IFNAMSIZ;
+ ++y;
+ }
+ y->if_name=0; y->if_index=0;
+ return x;
+}
diff --git a/mdk-stage1/dietlibc/lib/if_nametoindex.c b/mdk-stage1/dietlibc/lib/if_nametoindex.c
index 5923963b1..c9dd1b051 100644
--- a/mdk-stage1/dietlibc/lib/if_nametoindex.c
+++ b/mdk-stage1/dietlibc/lib/if_nametoindex.c
@@ -1,5 +1,4 @@
-#include <linux/if.h>
-#include <linux/net.h>
+#include <net/if.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/socket.h>
@@ -8,7 +7,7 @@
#define SOCK_DGRAM 2
#endif
-int if_nametoindex(char* blub) {
+unsigned int if_nametoindex(const char* blub) {
struct ifreq ifr;
int fd;
char *tmp;
diff --git a/mdk-stage1/dietlibc/lib/ipv6constants.c b/mdk-stage1/dietlibc/lib/ipv6constants.c
new file mode 100644
index 000000000..1d5cb1f08
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/ipv6constants.c
@@ -0,0 +1,4 @@
+#include "netinet/in.h"
+
+const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
diff --git a/mdk-stage1/dietlibc/lib/isalnum.c b/mdk-stage1/dietlibc/lib/isalnum.c
index 4d363fab9..3192cc20d 100644
--- a/mdk-stage1/dietlibc/lib/isalnum.c
+++ b/mdk-stage1/dietlibc/lib/isalnum.c
@@ -1,7 +1,9 @@
#include <ctype.h>
-int __isalnum_ascii(int c) {
- return isalpha(c) || isdigit(c);
+int __isalnum_ascii ( int ch );
+int __isalnum_ascii ( int ch ) {
+ return (unsigned int)((ch | 0x20) - 'a') < 26u ||
+ (unsigned int)( ch - '0') < 10u;
}
-int isalnum(int c) __attribute__((weak,alias("__isalnum_ascii")));
+int isalnum ( int ch ) __attribute__((weak,alias("__isalnum_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isalpha.c b/mdk-stage1/dietlibc/lib/isalpha.c
index 07ea69696..efd8b1940 100644
--- a/mdk-stage1/dietlibc/lib/isalpha.c
+++ b/mdk-stage1/dietlibc/lib/isalpha.c
@@ -1,7 +1,8 @@
#include <ctype.h>
-int __isalpha_ascii(int c) {
- return (c>='a' && c<='z') || (c>='A' && c<='Z');
+int __isalpha_ascii ( int ch );
+int __isalpha_ascii ( int ch ) {
+ return (unsigned int)((ch | 0x20) - 'a') < 26u;
}
-int isalpha(int c) __attribute__((weak,alias("__isalpha_ascii")));
+int isalpha ( int ch ) __attribute__((weak,alias("__isalpha_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isascii.c b/mdk-stage1/dietlibc/lib/isascii.c
index e06994783..57a23ba44 100644
--- a/mdk-stage1/dietlibc/lib/isascii.c
+++ b/mdk-stage1/dietlibc/lib/isascii.c
@@ -1,6 +1,6 @@
#include <ctype.h>
-int isascii(int c) {
- return (c & 0x80) == 0;
+int isascii ( int ch )
+{
+ return (unsigned int)ch < 128u;
}
-
diff --git a/mdk-stage1/dietlibc/lib/isatty.c b/mdk-stage1/dietlibc/lib/isatty.c
index b31609720..4858a364d 100644
--- a/mdk-stage1/dietlibc/lib/isatty.c
+++ b/mdk-stage1/dietlibc/lib/isatty.c
@@ -2,11 +2,11 @@
#include <termios.h>
#undef ioctl
#include <sys/ioctl.h>
+#include <errno.h>
+#include <unistd.h>
+#include "dietfeatures.h"
-extern int errno;
-
-int isatty(int fd)
-{
+int isatty(int fd) {
int save;
int is_tty;
struct termios term;
diff --git a/mdk-stage1/dietlibc/lib/isblank.c b/mdk-stage1/dietlibc/lib/isblank.c
index 034e543b1..f13ca304a 100644
--- a/mdk-stage1/dietlibc/lib/isblank.c
+++ b/mdk-stage1/dietlibc/lib/isblank.c
@@ -1,6 +1,6 @@
#include <ctype.h>
-int isblank(int ch)
+int isblank ( int ch )
{
- return ((ch==' ')||(ch=='\t'));
+ return ch == ' ' || ch == '\t';
}
diff --git a/mdk-stage1/dietlibc/lib/iscntrl.c b/mdk-stage1/dietlibc/lib/iscntrl.c
index a183a54f1..98dbae6f3 100644
--- a/mdk-stage1/dietlibc/lib/iscntrl.c
+++ b/mdk-stage1/dietlibc/lib/iscntrl.c
@@ -1,7 +1,8 @@
#include <ctype.h>
-int __iscntrl_ascii(int c) {
- return (c<32) || (c==127);
+int __iscntrl_ascii ( int ch );
+int __iscntrl_ascii ( int ch ) {
+ return (unsigned int)ch < 32u || ch == 127;
}
-int iscntrl(int c) __attribute__((weak,alias("__iscntrl_ascii")));
+int iscntrl ( int ch ) __attribute__((weak,alias("__iscntrl_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isdigit.c b/mdk-stage1/dietlibc/lib/isdigit.c
index 8a7c3e801..d04d281a8 100644
--- a/mdk-stage1/dietlibc/lib/isdigit.c
+++ b/mdk-stage1/dietlibc/lib/isdigit.c
@@ -1,7 +1,8 @@
#include <ctype.h>
-int __isdigit_ascii(int c) {
- return (c>='0' && c<='9');
+int __isdigit_ascii ( int ch );
+int __isdigit_ascii ( int ch ) {
+ return (unsigned int)(ch - '0') < 10u;
}
-int isdigit(int c) __attribute__((weak,alias("__isdigit_ascii")));
+int isdigit ( int ch ) __attribute__((weak,alias("__isdigit_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isgraph.c b/mdk-stage1/dietlibc/lib/isgraph.c
index 807f90ff0..83419e788 100644
--- a/mdk-stage1/dietlibc/lib/isgraph.c
+++ b/mdk-stage1/dietlibc/lib/isgraph.c
@@ -1,5 +1,6 @@
-int __isgraph_ascii(int c) {
- return (c>=33 && c<=126);
+int __isgraph_ascii ( int ch );
+int __isgraph_ascii ( int ch ) {
+ return (unsigned int)(ch - '!') < 127u - '!';
}
-int isgraph(int c) __attribute__((weak,alias("__isgraph_ascii")));
+int isgraph ( int ch ) __attribute__((weak,alias("__isgraph_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/islower.c b/mdk-stage1/dietlibc/lib/islower.c
index 6a9afa519..8d219c43a 100644
--- a/mdk-stage1/dietlibc/lib/islower.c
+++ b/mdk-stage1/dietlibc/lib/islower.c
@@ -1,7 +1,8 @@
#include <ctype.h>
-int __islower_ascii(int c) {
- return (c>='a' && c<='z');
+int __islower_ascii ( int ch );
+int __islower_ascii ( int ch ) {
+ return (unsigned int) (ch - 'a') < 26u;
}
-int islower(int c) __attribute__((weak,alias("__islower_ascii")));
+int islower ( int ch ) __attribute__((weak,alias("__islower_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isprint.c b/mdk-stage1/dietlibc/lib/isprint.c
index e980658a5..51ff5b6ee 100644
--- a/mdk-stage1/dietlibc/lib/isprint.c
+++ b/mdk-stage1/dietlibc/lib/isprint.c
@@ -1,6 +1,7 @@
-int __isprint_ascii(int c) {
- return (c>=32 && c<=126);
+int __isprint_ascii ( int ch );
+int __isprint_ascii ( int ch ) {
+ return (unsigned int)(ch - ' ') < 127u - ' ';
}
-int isprint(int c) __attribute__((weak,alias("__isprint_ascii")));
+int isprint ( int ch ) __attribute__((weak,alias("__isprint_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/ispunct.c b/mdk-stage1/dietlibc/lib/ispunct.c
index 2fd1183b1..8bbfcdb5a 100644
--- a/mdk-stage1/dietlibc/lib/ispunct.c
+++ b/mdk-stage1/dietlibc/lib/ispunct.c
@@ -1,7 +1,9 @@
#include <ctype.h>
-int __ispunct_ascii(int c) {
- return isprint(c) && !( isalnum(c) || isspace(c) );
+int __ispunct_ascii ( int ch );
+int __ispunct_ascii ( int ch )
+{
+ return isprint (ch) && !isalnum (ch) && !isspace (ch);
}
-int ispunct(int c) __attribute__((weak,alias("__ispunct_ascii")));
+int ispunct ( int ch ) __attribute__((weak,alias("__ispunct_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isspace.c b/mdk-stage1/dietlibc/lib/isspace.c
index 916f784ab..bfa46648b 100644
--- a/mdk-stage1/dietlibc/lib/isspace.c
+++ b/mdk-stage1/dietlibc/lib/isspace.c
@@ -1,8 +1,9 @@
#include <ctype.h>
-int __isspace_ascii(int ch)
+int __isspace_ascii ( int ch );
+int __isspace_ascii ( int ch )
{
- return ((ch==' ')||(ch=='\f')||(ch=='\t')||(ch=='\v')||(ch=='\r')||(ch=='\n'));
+ return (unsigned int)(ch - 9) < 5u || ch == ' ';
}
-int isspace(int c) __attribute__((weak,alias("__isspace_ascii")));
+int isspace ( int ch ) __attribute__((weak,alias("__isspace_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isupper.c b/mdk-stage1/dietlibc/lib/isupper.c
index 933dfc169..048d4fd6c 100644
--- a/mdk-stage1/dietlibc/lib/isupper.c
+++ b/mdk-stage1/dietlibc/lib/isupper.c
@@ -1,7 +1,9 @@
#include <ctype.h>
-int __isupper_ascii(int c) {
- return (c>='A' && c<='Z');
+int __isupper_ascii ( int ch );
+int __isupper_ascii ( int ch )
+{
+ return (unsigned int)(ch - 'A') < 26u;
}
-int isupper(int c) __attribute__((weak,alias("__isupper_ascii")));
+int isupper ( int ch ) __attribute__((weak,alias("__isupper_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/isxdigit.c b/mdk-stage1/dietlibc/lib/isxdigit.c
index 22a711f2d..bca8e74ac 100644
--- a/mdk-stage1/dietlibc/lib/isxdigit.c
+++ b/mdk-stage1/dietlibc/lib/isxdigit.c
@@ -1,5 +1,8 @@
-int __isxdigit_ascii(int c) {
- return ((c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f'));
+int __isxdigit_ascii ( int ch );
+int __isxdigit_ascii ( int ch )
+{
+ return (unsigned int)( ch - '0') < 10u ||
+ (unsigned int)((ch | 0x20) - 'a') < 6u;
}
-int isxdigit(int c) __attribute__((weak,alias("__isxdigit_ascii")));
+int isxdigit ( int ch ) __attribute__((weak,alias("__isxdigit_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/labs.c b/mdk-stage1/dietlibc/lib/labs.c
new file mode 100644
index 000000000..364557f40
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/labs.c
@@ -0,0 +1,6 @@
+#include <endian.h>
+
+#if __WORDSIZE == 64
+long int labs(long int i) { return i>=0?i:-i; }
+long long int llabs(long long int i) __attribute__((alias("labs")));
+#endif
diff --git a/mdk-stage1/dietlibc/lib/listen.c b/mdk-stage1/dietlibc/lib/listen.c
index 56a51be06..661b86a63 100644
--- a/mdk-stage1/dietlibc/lib/listen.c
+++ b/mdk-stage1/dietlibc/lib/listen.c
@@ -1,13 +1,12 @@
-#include <linux/net.h>
+#include <linuxnet.h>
+#include <sys/socket.h>
extern int socketcall(int callno,long* args);
-int listen(int a, int b) {
-#ifdef __i386__
- return socketcall(SYS_LISTEN, (long*)&a);
-#else
+int __libc_listen(int a, int b);
+int __libc_listen(int a, int b) {
unsigned long args[] = { a, b, 0 };
return socketcall(SYS_LISTEN, args);
-#endif
}
+int listen(int s, int backlog) __attribute__((weak,alias("__libc_listen")));
diff --git a/mdk-stage1/dietlibc/lib/llabs.c b/mdk-stage1/dietlibc/lib/llabs.c
new file mode 100644
index 000000000..bcbd3dc78
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/llabs.c
@@ -0,0 +1,6 @@
+#include <endian.h>
+#include <stdlib.h>
+
+#if __WORDSIZE != 64
+long long int llabs(long long int i) { if (i<0) i=-i; return i; }
+#endif
diff --git a/mdk-stage1/dietlibc/lib/lockf.c b/mdk-stage1/dietlibc/lib/lockf.c
index 2b1d004ef..1b6fcb80c 100644
--- a/mdk-stage1/dietlibc/lib/lockf.c
+++ b/mdk-stage1/dietlibc/lib/lockf.c
@@ -2,6 +2,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include "dietfeatures.h"
int lockf(int fd, int cmd, off_t len) {
struct flock fl;
diff --git a/mdk-stage1/dietlibc/lib/longjmp.c b/mdk-stage1/dietlibc/lib/longjmp.c
index d0a5719c1..6f1afb4b1 100644
--- a/mdk-stage1/dietlibc/lib/longjmp.c
+++ b/mdk-stage1/dietlibc/lib/longjmp.c
@@ -1,51 +1,16 @@
-/* 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);
+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 __libc_longjmp(sigjmp_buf env,int val);
+void __libc_longjmp(sigjmp_buf env,int val) {
+ if (env[0].__mask_was_saved) {
+ sigprocmask(SIG_SETMASK,(sigset_t*)&env[0].__saved_mask,0);
+ }
+ if (val==0) val=1;
+ __longjmp(env[0].__jmpbuf,val);
}
-
-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")));
+void __siglongjmp(sigjmp_buf env,int val) __attribute__((alias("__libc_longjmp")));
+void longjmp(sigjmp_buf env,int val) __attribute__((weak,alias("__libc_longjmp")));
+void siglongjmp(sigjmp_buf env,int val) __attribute__((weak,alias("__libc_longjmp")));
diff --git a/mdk-stage1/dietlibc/lib/lseek64.c b/mdk-stage1/dietlibc/lib/lseek64.c
index f39e779f9..62acf4a2b 100644
--- a/mdk-stage1/dietlibc/lib/lseek64.c
+++ b/mdk-stage1/dietlibc/lib/lseek64.c
@@ -1,22 +1,16 @@
+#include <errno.h>
#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 (llseek(fildes,(unsigned long)(offset>>32),(unsigned long)offset&0xffffffff,&tmp,whence)) {
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
index 6d6ac98ab..3208cfabb 100644
--- a/mdk-stage1/dietlibc/lib/memccpy.c
+++ b/mdk-stage1/dietlibc/lib/memccpy.c
@@ -1,6 +1,7 @@
#define _POSIX_SOURCE
#define _XOPEN_SOURCE
#include <sys/types.h>
+#include <string.h>
void *memccpy(void *dst, const void *src, int c, size_t count)
{
diff --git a/mdk-stage1/dietlibc/lib/memchr.c b/mdk-stage1/dietlibc/lib/memchr.c
index 93d81328a..ae76bb150 100644
--- a/mdk-stage1/dietlibc/lib/memchr.c
+++ b/mdk-stage1/dietlibc/lib/memchr.c
@@ -1,9 +1,13 @@
#include <sys/types.h>
+#include <string.h>
-char *memchr(const char *s, int c, size_t n) {
+void* memchr(const void *s, int c, size_t n) {
+ register const char* t=s;
int i;
- for (i=n; i; --i)
- if (*s++==c)
- return (char*)s;
+ for (i=n; i; --i) {
+ if (*t==c)
+ return (char*)t;
+ ++t;
+ }
return 0;
}
diff --git a/mdk-stage1/dietlibc/lib/memcmp.c b/mdk-stage1/dietlibc/lib/memcmp.c
index c05a46863..4c8f77142 100644
--- a/mdk-stage1/dietlibc/lib/memcmp.c
+++ b/mdk-stage1/dietlibc/lib/memcmp.c
@@ -1,5 +1,7 @@
#include <sys/types.h>
+/* gcc is broken and has a non-SUSv2 compliant internal prototype.
+ * This causes it to warn about a type mismatch here. Ignore it. */
int memcmp(const void *dst, const void *src, size_t count) {
register int r;
register const char *d=dst;
diff --git a/mdk-stage1/dietlibc/lib/memcpy.c b/mdk-stage1/dietlibc/lib/memcpy.c
index 0c688b509..ebfd1e60a 100644
--- a/mdk-stage1/dietlibc/lib/memcpy.c
+++ b/mdk-stage1/dietlibc/lib/memcpy.c
@@ -1,5 +1,7 @@
#include <sys/types.h>
+/* gcc is broken and has a non-SUSv2 compliant internal prototype.
+ * This causes it to warn about a type mismatch here. Ignore it. */
void* memcpy(void* dst, const void* src, size_t count) {
register char *d=dst;
register const char *s=src;
diff --git a/mdk-stage1/dietlibc/lib/memmem.c b/mdk-stage1/dietlibc/lib/memmem.c
new file mode 100644
index 000000000..5c88a29e7
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/memmem.c
@@ -0,0 +1,14 @@
+#define _GNU_SOURCE 23
+#include <sys/types.h>
+#include <string.h>
+
+void *memmem(const void* haystack, size_t hl, const void* needle, size_t nl) {
+ 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/memmove.c b/mdk-stage1/dietlibc/lib/memmove.c
index 7adb2be91..58414d503 100644
--- a/mdk-stage1/dietlibc/lib/memmove.c
+++ b/mdk-stage1/dietlibc/lib/memmove.c
@@ -1,6 +1,7 @@
#define _POSIX_SOURCE
#define _XOPEN_SOURCE
#include <sys/types.h>
+#include <string.h>
void *memmove(void *dst, const void *src, size_t count)
{
diff --git a/mdk-stage1/dietlibc/lib/memrchr.c b/mdk-stage1/dietlibc/lib/memrchr.c
new file mode 100644
index 000000000..f7750d2d7
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/memrchr.c
@@ -0,0 +1,15 @@
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <string.h>
+
+void* memrchr(const void *s, int c, size_t n) {
+ register const char* t=s;
+ register const char* last=0;
+ int i;
+ for (i=n; i; --i) {
+ if (*t==c)
+ last=t;
+ ++t;
+ }
+ return (void*)last; /* man, what an utterly b0rken prototype */
+}
diff --git a/mdk-stage1/dietlibc/lib/memset.c b/mdk-stage1/dietlibc/lib/memset.c
index 5f9ae49ee..a019eca44 100644
--- a/mdk-stage1/dietlibc/lib/memset.c
+++ b/mdk-stage1/dietlibc/lib/memset.c
@@ -1,6 +1,8 @@
#include <sys/types.h>
-void * memset(void * dst, int s, size_t count) {
+/* gcc is broken and has a non-SUSv2 compliant internal prototype.
+ * This causes it to warn about a type mismatch here. Ignore it. */
+void* memset(void * dst, int s, size_t count) {
register char * a = dst;
count++; /* this actually creates smaller code than using count-- */
while (--count)
diff --git a/mdk-stage1/dietlibc/lib/mkfifo.c b/mdk-stage1/dietlibc/lib/mkfifo.c
index 596efbe27..1bd132e65 100644
--- a/mdk-stage1/dietlibc/lib/mkfifo.c
+++ b/mdk-stage1/dietlibc/lib/mkfifo.c
@@ -1,6 +1,6 @@
-#include <linux/stat.h>
+#include <sys/stat.h>
#include <unistd.h>
int mkfifo(const char *fn,mode_t mode) {
- return mknod(fn,S_IFIFO|mode,0);
+ return mknod(fn,(mode_t)(mode|S_IFIFO),0);
}
diff --git a/mdk-stage1/dietlibc/lib/msgctl.c b/mdk-stage1/dietlibc/lib/msgctl.c
index 19ea6d8cf..51cffdef0 100644
--- a/mdk-stage1/dietlibc/lib/msgctl.c
+++ b/mdk-stage1/dietlibc/lib/msgctl.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,int,int,int,void*);
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
index 9bca09ebe..6023c1786 100644
--- a/mdk-stage1/dietlibc/lib/msgget.c
+++ b/mdk-stage1/dietlibc/lib/msgget.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,key_t,int,int,int);
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
index b4ae9cc6c..8168187a5 100644
--- a/mdk-stage1/dietlibc/lib/msgrcv.c
+++ b/mdk-stage1/dietlibc/lib/msgrcv.c
@@ -1,9 +1,13 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,int,size_t,int,void*);
+
+struct ipc_kludge {
+ struct msgbuf *msgp;
+ long msgtyp;
+};
int msgrcv(int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) {
struct ipc_kludge tmp;
diff --git a/mdk-stage1/dietlibc/lib/msgsnd.c b/mdk-stage1/dietlibc/lib/msgsnd.c
index 6203053f0..6e9ef445e 100644
--- a/mdk-stage1/dietlibc/lib/msgsnd.c
+++ b/mdk-stage1/dietlibc/lib/msgsnd.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,int,size_t,int,const void*);
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
index f1499d017..2599e2259 100644
--- a/mdk-stage1/dietlibc/lib/open64.c
+++ b/mdk-stage1/dietlibc/lib/open64.c
@@ -1,14 +1,13 @@
-#include <linux/types.h>
-#include <linux/fcntl.h>
+#include <sys/types.h>
+#include <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);
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")));
+int open64(const char* file,int oflag,...) __attribute__((weak,alias("__libc_open64")));
diff --git a/mdk-stage1/dietlibc/lib/opendir.c b/mdk-stage1/dietlibc/lib/opendir.c
index 5c0c4a305..2530d1ac9 100644
--- a/mdk-stage1/dietlibc/lib/opendir.c
+++ b/mdk-stage1/dietlibc/lib/opendir.c
@@ -1,18 +1,26 @@
#include "dietdirent.h"
+#include <sys/mman.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;
- }
+DIR* opendir ( const char* name ) {
+ int fd = open (name, O_RDONLY | O_DIRECTORY);
+ DIR* t = NULL;
+
+ if ( fd >= 0 ) {
+ if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
+ goto lose;
+ t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (t == MAP_FAILED)
+lose:
+ close (fd);
+ else
+ t->fd = fd;
}
+
+
return t;
}
diff --git a/mdk-stage1/dietlibc/lib/perror.c b/mdk-stage1/dietlibc/lib/perror.c
index ecab7250b..0a45fb9d6 100644
--- a/mdk-stage1/dietlibc/lib/perror.c
+++ b/mdk-stage1/dietlibc/lib/perror.c
@@ -1,22 +1,24 @@
#include "dietfeatures.h"
#include <unistd.h>
#include <string.h>
+#include <stdio.h>
+
+#define _BSD_SOURCE
#include <errno.h>
-extern char *sys_errlist[];
-extern int sys_nerr;
-extern int errno;
+extern const char __sys_err_unknown [];
+
+void perror ( const char* prepend )
+{
+ register const char* message = __sys_err_unknown;
+
+ if ( (unsigned int) errno < (unsigned int) __SYS_NERR )
+ message = sys_errlist [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);
+ if (prepend) {
+ write ( 2, prepend, strlen(prepend) );
+ write ( 2, ": ", 2 );
+ }
+ 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
index b922aa93e..fd6c49149 100644
--- a/mdk-stage1/dietlibc/lib/pread.c
+++ b/mdk-stage1/dietlibc/lib/pread.c
@@ -3,6 +3,7 @@
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);
size_t __libc_pread(int fd, void *buf, size_t count, off_t offset) {
return __pread(fd,buf,count,offset,0);
}
diff --git a/mdk-stage1/dietlibc/lib/pread64.c b/mdk-stage1/dietlibc/lib/pread64.c
index e6ba4d103..6dc93cefa 100644
--- a/mdk-stage1/dietlibc/lib/pread64.c
+++ b/mdk-stage1/dietlibc/lib/pread64.c
@@ -5,8 +5,9 @@
#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);
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));
+ return __pread(fd,buf,count,__LONG_LONG_PAIR ((off_t)(offset&0xffffffff),(off_t)(offset>>32)));
}
int pread64(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pread64")));
diff --git a/mdk-stage1/dietlibc/lib/putenv.c b/mdk-stage1/dietlibc/lib/putenv.c
index 274b16b0e..448d59840 100644
--- a/mdk-stage1/dietlibc/lib/putenv.c
+++ b/mdk-stage1/dietlibc/lib/putenv.c
@@ -1,21 +1,24 @@
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
int putenv(const char *string) {
- int len;
+ size_t len;
int envc;
+ int remove=0;
char *tmp;
const char **ep;
char **newenv;
- static char **origenv=0;
+ static char **origenv;
if (!origenv) origenv=environ;
- if (!(tmp=strchr(string,'=')))
+ if (!(tmp=strchr(string,'='))) {
len=strlen(string);
- else
+ remove=1;
+ } else
len=tmp-string+1;
for (envc=0, ep=(const char**)environ; *ep; ++ep) {
- if (!memcmp(string,*ep,len)) { /* found */
- if (!tmp) {
+ if (*string == **ep && !memcmp(string,*ep,len)) {
+ if (remove) {
for (; ep[1]; ++ep) ep[0]=ep[1];
ep[0]=0;
return 0;
@@ -26,11 +29,11 @@ int putenv(const char *string) {
++envc;
}
if (tmp) {
- newenv=(char**)malloc((envc+2)*sizeof(char*));
+ newenv = (char**) realloc(environ==origenv?0:origenv,
+ (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/pwrite.c b/mdk-stage1/dietlibc/lib/pwrite.c
new file mode 100644
index 000000000..1e9fde545
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/pwrite.c
@@ -0,0 +1,11 @@
+#include <endian.h>
+#include <sys/types.h>
+
+extern size_t __pwrite(int fd, void *buf, size_t count, off_t a,off_t b);
+
+size_t __libc_pwrite(int fd, void *buf, size_t count, off_t offset);
+size_t __libc_pwrite(int fd, void *buf, size_t count, off_t offset) {
+ return __pwrite(fd,buf,count,offset,0);
+}
+
+int pwrite(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pwrite")));
diff --git a/mdk-stage1/dietlibc/lib/pwrite64.c b/mdk-stage1/dietlibc/lib/pwrite64.c
new file mode 100644
index 000000000..cac46024a
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/pwrite64.c
@@ -0,0 +1,14 @@
+#include <endian.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifndef __NO_STAT64
+extern size_t __pwrite(int fd, void *buf, size_t count, off_t a,off_t b);
+
+size_t __libc_pwrite64(int fd, void *buf, size_t count, off64_t offset);
+size_t __libc_pwrite64(int fd, void *buf, size_t count, off64_t offset) {
+ return __pwrite(fd,buf,count,__LONG_LONG_PAIR ((off_t)(offset&0xffffffff),(off_t)(offset>>32)));
+}
+
+int pwrite64(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pwrite64")));
+#endif
diff --git a/mdk-stage1/dietlibc/lib/qsort.c b/mdk-stage1/dietlibc/lib/qsort.c
index 2a8824bf3..62217e142 100644
--- a/mdk-stage1/dietlibc/lib/qsort.c
+++ b/mdk-stage1/dietlibc/lib/qsort.c
@@ -1,3 +1,4 @@
+#include <sys/cdefs.h>
#include <stdlib.h>
#include <assert.h>
@@ -19,7 +20,7 @@ static inline void iswap(void *a,void *b,size_t size) {
}
static inline void swap(void *base,size_t size,size_t a,size_t b) {
- iswap(base+a*size,base+b*size,size);
+ iswap((char*)base+a*size,(char*)base+b*size,size);
}
#if 0
@@ -30,18 +31,19 @@ void dumparray() {
}
#endif
+void isort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
void isort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
- int i;
- while (nmemb>1) {
+ size_t i;
+ while (expect(nmemb>1,1)) {
char *min=base;
char *tmp=min+size;
for (i=1; i<nmemb; ++i) {
- if (compar(tmp,min)<0)
+ if (expect(compar(tmp,min)<0,0))
min=tmp;
tmp+=size;
}
iswap(min,base,size);
- base+=size;
+ (char*)base+=size;
nmemb-=1;
}
}
@@ -55,7 +57,7 @@ void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, co
static int level=0;
char* v; /* pivot */
char* mid, *max, *min;
- int lmemb;
+ size_t lmemb;
#if 0
int left,right;
@@ -71,8 +73,8 @@ void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, co
return isort(base,nmemb,size,compar);
}
{
- mid=base+(nmemb/2)*size;
- max=base+(nmemb-1)*size;
+ mid=(char*)base+(nmemb/2)*size;
+ max=(char*)base+(nmemb-1)*size;
if (compar(base,max)<0) /* a[left] < a[right] */
if (compar(base,mid)<0) /* a[left] < a[med] */
@@ -97,8 +99,8 @@ void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, co
v=max;
min=base; lmemb=0;
for (;;) {
- while (compar(min,v)<0) { min+=size; ++lmemb; }
- while (compar(max-=size,v)>0) ;
+ while (expect(compar(min,v)<0,1)) { min+=size; ++lmemb; }
+ while (expect(compar(max-=size,v)>0,1)) ;
if (min>=max) break;
iswap(min,max,size);
}
diff --git a/mdk-stage1/dietlibc/lib/raise.c b/mdk-stage1/dietlibc/lib/raise.c
index 606546034..0f548fc3b 100644
--- a/mdk-stage1/dietlibc/lib/raise.c
+++ b/mdk-stage1/dietlibc/lib/raise.c
@@ -1,7 +1,6 @@
-#include <linux/types.h>
+#include <sys/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
index 10bfaf94d..beb2d2717 100644
--- a/mdk-stage1/dietlibc/lib/rand.c
+++ b/mdk-stage1/dietlibc/lib/rand.c
@@ -2,8 +2,11 @@
static unsigned int seed=1;
-int rand() {
- return ((seed = seed * 1103515245 + 12345) % ((unsigned int)RAND_MAX + 1));
+int rand(void) {
+ return rand_r(&seed);
}
void srand(unsigned int i) { seed=i; }
+
+int random(void) __attribute__((alias("rand")));
+void srandom(unsigned int i) __attribute__((alias("srand")));
diff --git a/mdk-stage1/dietlibc/lib/rand48.c b/mdk-stage1/dietlibc/lib/rand48.c
new file mode 100644
index 000000000..9c6cfcda2
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/rand48.c
@@ -0,0 +1,89 @@
+#include <stdlib.h>
+
+static randbuf rand48buf;
+#define A_0 0xE66D
+#define A_1 0xDEEC
+#define A_2 0x5
+#define C 0xB
+static randbuf a = { A_0, A_1, A_2 };
+static unsigned short c = C;
+
+static void calc_next(randbuf buf) {
+ randbuf tmp;
+ long t;
+ t = buf[0] * a[0] + c;
+ tmp[0] = t & 0xffff;
+ tmp[1] = (t >> 16) & 0xffff;
+ t = buf[1] * a[0] + buf[0] * a[1] + tmp[1];
+ tmp[1] = t & 0xffff;
+ tmp[2] = (t >> 16) & 0xffff;
+ t = buf[2] * a[0] + buf[1] * a[1] + buf[0] * a[2] + tmp[2];
+ tmp[2] = t & 0xffff;
+ buf[0] = tmp[0];
+ buf[1] = tmp[1];
+ buf[2] = tmp[2];
+}
+
+double drand48(void) {
+ return erand48(rand48buf);
+}
+
+long lrand48(void) {
+ return nrand48(rand48buf);
+}
+
+long mrand48(void) {
+ return jrand48(rand48buf);
+}
+
+void srand48(long seed) {
+ rand48buf[1] = (seed >> 16) & 0xffff;
+ rand48buf[2] = seed & 0xffff;
+ rand48buf[0] = 0x330e;
+ a[0] = A_0;
+ a[1] = A_1;
+ a[2] = A_2;
+ c = C;
+}
+
+unsigned short *seed48(randbuf buf) {
+ static randbuf oldx;
+ int i;
+ for (i = 0; i < 3; i++) {
+ oldx[i] = rand48buf[i];
+ rand48buf[i] = buf[i];
+ }
+ a[0] = A_0;
+ a[1] = A_1;
+ a[2] = A_2;
+ c = C;
+ return (unsigned short *)&oldx;
+}
+
+void lcong48(unsigned short param[7]) {
+ int i;
+ for (i = 0; i < 3; i++) {
+ rand48buf[i] = param[i];
+ a[i] = param[i + 3];
+ }
+ c = param[6];
+}
+
+long jrand48(randbuf buf) {
+ long ret;
+ ret = buf[2] << 16 | buf[1];
+ calc_next(buf);
+ return ret;
+}
+
+long nrand48(randbuf buf) {
+ return jrand48(buf) & 0x7FFFFFFFL;
+}
+
+double erand48(randbuf buf) {
+ double ret;
+ ret = ((buf[0] / 65536.0 + buf[1]) / 65536.0 + buf[2]) / 65536.0;
+ calc_next(buf);
+ return ret;
+}
+
diff --git a/mdk-stage1/dietlibc/lib/rand_r.c b/mdk-stage1/dietlibc/lib/rand_r.c
new file mode 100644
index 000000000..55f8303bc
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/rand_r.c
@@ -0,0 +1,30 @@
+/*
+ Copyright (C) 2002 Luc Van Oostenryck
+
+ This is free software. You can redistribute and
+ modify it under the terms of the GNU General Public
+ Public License.
+*/
+
+#include <stdlib.h>
+#include <stdint.h>
+
+/* Knuth's TAOCP section 3.6 */
+#define M ((1U<<31) -1)
+#define A 48271
+#define Q 44488 // M/A
+#define R 3399 // M%A; R < Q !!!
+
+// FIXME: ISO C/SuS want a longer period
+
+int rand_r(unsigned int* seed)
+{ int32_t X;
+
+ X = *seed;
+ X = A*(X%Q) - R * (int32_t) (X/Q);
+ if (X < 0)
+ X += M;
+
+ *seed = X;
+ return X;
+}
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
index 689f5d08b..ed885a5f0 100644
--- a/mdk-stage1/dietlibc/lib/readdir.c
+++ b/mdk-stage1/dietlibc/lib/readdir.c
@@ -5,7 +5,7 @@
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);
+ int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1);
if (res<=0) return 0;
d->num=res; d->cur=0;
}
diff --git a/mdk-stage1/dietlibc/lib/readdir64.c b/mdk-stage1/dietlibc/lib/readdir64.c
new file mode 100644
index 000000000..b9b0aafcc
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/readdir64.c
@@ -0,0 +1,62 @@
+#include "dietfeatures.h"
+#include "dietdirent.h"
+#include <unistd.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include "syscalls.h"
+
+#ifndef __NR_getdents64
+#define WANT_LARGEFILE_BACKCOMPAT
+#endif
+
+#ifndef WANT_LARGEFILE_BACKCOMPAT
+struct dirent64* readdir64(DIR *d) {
+ if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
+ int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1);
+ if (res<=0) return 0;
+ d->num=res; d->cur=0;
+ }
+ return (struct dirent64*)(d->buf+d->cur);
+}
+#else
+struct dirent64* readdir64(DIR *d) {
+#ifdef __NR_getdents64
+ static int trygetdents64=1;
+#endif
+ struct dirent* o;
+ static struct dirent64 d64;
+again:
+#ifdef __NR_getdents64
+ if (!trygetdents64) {
+#endif
+ if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) {
+ int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1);
+ if (res<=0) return 0;
+ d->num=res; d->cur=0;
+ }
+ o=(struct dirent*)(d->buf+d->cur);
+ d64.d_ino=o->d_ino;
+ d64.d_off=o->d_off;
+ d64.d_reclen=o->d_reclen;
+ strcpy(d64.d_name,o->d_name);
+ d64.d_type=0; /* is this correct? */
+ return &d64;
+#ifdef __NR_getdents64
+ }
+ if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
+ int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf));
+ if (res<=0) {
+ if (errno==ENOSYS) {
+ trygetdents64=0;
+ goto again;
+ }
+ return 0;
+ }
+ d->num=res; d->cur=0;
+ }
+ return (struct dirent64*)(d->buf+d->cur);
+#endif
+}
+#endif
diff --git a/mdk-stage1/dietlibc/lib/reboot.c b/mdk-stage1/dietlibc/lib/reboot.c
index 7f47a95dd..421068504 100644
--- a/mdk-stage1/dietlibc/lib/reboot.c
+++ b/mdk-stage1/dietlibc/lib/reboot.c
@@ -1,8 +1,8 @@
#include <sys/reboot.h>
-int __reboot(int magic1, int magic2, int cmd, void * arg);
+int __reboot(unsigned int magic1, unsigned int magic2, int cmd);
-int reboot(int cmd, void *arg)
+int reboot(int cmd)
{
- return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, arg);
+ return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd);
}
diff --git a/mdk-stage1/dietlibc/lib/recv.c b/mdk-stage1/dietlibc/lib/recv.c
index bc6b1e5d7..c6bab4fb1 100644
--- a/mdk-stage1/dietlibc/lib/recv.c
+++ b/mdk-stage1/dietlibc/lib/recv.c
@@ -1,14 +1,12 @@
-#include <linux/net.h>
+#include <sys/types.h>
+#include <linuxnet.h>
extern int socketcall(int callno,long* args);
+int __libc_recv(int a, const void * b, size_t c, int flags);
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)
diff --git a/mdk-stage1/dietlibc/lib/recvfrom.c b/mdk-stage1/dietlibc/lib/recvfrom.c
index 802ad665f..b66ce3813 100644
--- a/mdk-stage1/dietlibc/lib/recvfrom.c
+++ b/mdk-stage1/dietlibc/lib/recvfrom.c
@@ -1,14 +1,12 @@
-#include <linux/net.h>
+#include <sys/types.h>
+#include <linuxnet.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);
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)
diff --git a/mdk-stage1/dietlibc/lib/recvmsg.c b/mdk-stage1/dietlibc/lib/recvmsg.c
index c14c58c78..d843ce9c0 100644
--- a/mdk-stage1/dietlibc/lib/recvmsg.c
+++ b/mdk-stage1/dietlibc/lib/recvmsg.c
@@ -1,14 +1,12 @@
-#include <linux/net.h>
+#include <sys/socket.h>
+#include <linuxnet.h>
extern int socketcall(int callno,long* args);
+int __libc_recvmsg(int a, struct msghdr* msg, int flags);
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)
diff --git a/mdk-stage1/dietlibc/lib/remove.c b/mdk-stage1/dietlibc/lib/remove.c
index d5125bfed..06f686356 100644
--- a/mdk-stage1/dietlibc/lib/remove.c
+++ b/mdk-stage1/dietlibc/lib/remove.c
@@ -1,5 +1,7 @@
#include <unistd.h>
#include <errno.h>
+#include "dietfeatures.h"
+#include <stdio.h>
int remove(const char* filename) {
if (unlink(filename)) {
diff --git a/mdk-stage1/dietlibc/lib/sbrk.c b/mdk-stage1/dietlibc/lib/sbrk.c
index 945ad5a16..799ce7428 100644
--- a/mdk-stage1/dietlibc/lib/sbrk.c
+++ b/mdk-stage1/dietlibc/lib/sbrk.c
@@ -1,20 +1,21 @@
#include <unistd.h>
-extern int __brk(void *end_data_segment);
+extern int __libc_brk(void *end_data_segment);
extern void* __curbrk;
-void* __sbrk(ptrdiff_t increment) {
+void* __libc_sbrk(ptrdiff_t increment);
+void* __libc_sbrk(ptrdiff_t increment) {
void* oldbrk;
if (__curbrk==0)
- if (__brk(0) < 0)
+ if (__libc_brk(0) < 0)
return (void*)-1;
if (increment==0)
return __curbrk;
oldbrk=__curbrk;
- if (__brk(oldbrk+increment)<0)
+ if (__libc_brk((char*)oldbrk+increment)<0)
return (void*)-1;
return oldbrk;
}
-void* sbrk (ptrdiff_t increment) __attribute__((weak,alias("__sbrk")));
+void* sbrk (ptrdiff_t increment) __attribute__((weak,alias("__libc_sbrk")));
diff --git a/mdk-stage1/dietlibc/lib/semctl.c b/mdk-stage1/dietlibc/lib/semctl.c
index ddc0aae95..cec0b7535 100644
--- a/mdk-stage1/dietlibc/lib/semctl.c
+++ b/mdk-stage1/dietlibc/lib/semctl.c
@@ -1,10 +1,17 @@
#include <sys/types.h>
#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,int,int,int,void*);
+union semun {
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
+ unsigned short *array; /* array for GETALL & SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+ void *__pad;
+};
+
+int semctl(int semid, int semnum, int cmd, union semun arg);
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
index 056aeae04..c3649eea1 100644
--- a/mdk-stage1/dietlibc/lib/semget.c
+++ b/mdk-stage1/dietlibc/lib/semget.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,key_t,int,int,int);
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
index abfde73a7..4d2e748cc 100644
--- a/mdk-stage1/dietlibc/lib/semop.c
+++ b/mdk-stage1/dietlibc/lib/semop.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,int,unsigned,int,void*);
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
index c1adf1b5d..783ecaf89 100644
--- a/mdk-stage1/dietlibc/lib/send.c
+++ b/mdk-stage1/dietlibc/lib/send.c
@@ -1,14 +1,12 @@
-#include <linux/net.h>
+#include <sys/types.h>
+#include <linuxnet.h>
extern int socketcall(int callno,long* args);
+int __libc_send(int a, const void * b, size_t c, int flags);
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)
diff --git a/mdk-stage1/dietlibc/lib/sendmsg.c b/mdk-stage1/dietlibc/lib/sendmsg.c
index 277265985..bb5d1711a 100644
--- a/mdk-stage1/dietlibc/lib/sendmsg.c
+++ b/mdk-stage1/dietlibc/lib/sendmsg.c
@@ -1,14 +1,12 @@
-#include <linux/net.h>
+#include <sys/socket.h>
+#include <linuxnet.h>
extern int socketcall(int callno,long* args);
+int __libc_sendmsg(int a, const struct msghdr* msg, int flags);
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)
diff --git a/mdk-stage1/dietlibc/lib/sendto.c b/mdk-stage1/dietlibc/lib/sendto.c
index 078c010ea..d3239932b 100644
--- a/mdk-stage1/dietlibc/lib/sendto.c
+++ b/mdk-stage1/dietlibc/lib/sendto.c
@@ -1,15 +1,13 @@
-#include <linux/net.h>
+#include <sys/socket.h>
+#include <linuxnet.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);
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)
+int sendto(int a, const void * b, size_t c, int flags, const struct sockaddr* to, socklen_t 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/setlinebuf.c b/mdk-stage1/dietlibc/lib/setlinebuf.c
new file mode 100644
index 000000000..1f30e183a
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/setlinebuf.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include "dietwarning.h"
+#undef setlinebuf
+
+/* there is no previous prototype because it is a #define */
+void setlinebuf(FILE* stream);
+
+void setlinebuf(FILE* stream) {
+ setvbuf(stream,0,_IOLBF,BUFSIZ);
+}
+
+link_warning("setlinebuf","warning: you used setlinebuf without including <stdio.h>")
diff --git a/mdk-stage1/dietlibc/lib/setsockopt.c b/mdk-stage1/dietlibc/lib/setsockopt.c
index 781e9c31c..e4bab349f 100644
--- a/mdk-stage1/dietlibc/lib/setsockopt.c
+++ b/mdk-stage1/dietlibc/lib/setsockopt.c
@@ -1,13 +1,12 @@
-#include <linux/net.h>
+#include <linuxnet.h>
+#include <sys/socket.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
+int __libc_setsockopt(int a, int b, int c, void *d, void *e);
+int __libc_setsockopt(int a, int b, int c, void *d, void *e) {
unsigned long args[] = { a, b, c, (long)d, (long) e };
return socketcall(SYS_SETSOCKOPT, args);
-#endif
}
+int setsockopt(int s, int level, int optname, const void* optval, socklen_t optlen) __attribute__((weak,alias("__libc_setsockopt")));
diff --git a/mdk-stage1/dietlibc/lib/shmat.c b/mdk-stage1/dietlibc/lib/shmat.c
index 63284b1ea..d4b34c120 100644
--- a/mdk-stage1/dietlibc/lib/shmat.c
+++ b/mdk-stage1/dietlibc/lib/shmat.c
@@ -1,15 +1,14 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include <asm/ipc.h>
-extern void* __ipc();
+extern void* __ipc(int,int,int,void*,const void*);
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)
+ if ((unsigned long)result <= -(unsigned long)8196)
result=raddr;
return result;
}
diff --git a/mdk-stage1/dietlibc/lib/shmctl.c b/mdk-stage1/dietlibc/lib/shmctl.c
index 8f942f2a4..92b9d1fbb 100644
--- a/mdk-stage1/dietlibc/lib/shmctl.c
+++ b/mdk-stage1/dietlibc/lib/shmctl.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,int,int,int,void*);
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
index 36db10f08..54dc6f41b 100644
--- a/mdk-stage1/dietlibc/lib/shmdt.c
+++ b/mdk-stage1/dietlibc/lib/shmdt.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,int,int,int,const void*);
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
index 9b03f5deb..bf1dc2030 100644
--- a/mdk-stage1/dietlibc/lib/shmget.c
+++ b/mdk-stage1/dietlibc/lib/shmget.c
@@ -1,9 +1,8 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include <asm/ipc.h>
-extern int __ipc();
+extern int __ipc(int,key_t,int,int,int);
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
index 0a6be6c37..0e7b8755c 100644
--- a/mdk-stage1/dietlibc/lib/shutdown.c
+++ b/mdk-stage1/dietlibc/lib/shutdown.c
@@ -1,14 +1,12 @@
-#include <linux/net.h>
+#include <linuxnet.h>
+#include <sys/socket.h>
extern int socketcall(int callno,long* args);
+int __libc_shutdown(int s, int how);
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/sigaction.c b/mdk-stage1/dietlibc/lib/sigaction.c
new file mode 100644
index 000000000..fe1351f0f
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/sigaction.c
@@ -0,0 +1,11 @@
+#include <signal.h>
+
+int __rt_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact, long nr);
+
+int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
+int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
+ return __rt_sigaction(signum, act, oldact, _NSIG/8);
+}
+
+int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
+__attribute__((weak,alias("__libc_sigaction")));
diff --git a/mdk-stage1/dietlibc/lib/sigaddset.c b/mdk-stage1/dietlibc/lib/sigaddset.c
index 8ce69ea77..1c2632e67 100644
--- a/mdk-stage1/dietlibc/lib/sigaddset.c
+++ b/mdk-stage1/dietlibc/lib/sigaddset.c
@@ -1,15 +1,17 @@
-#define __KERNEL__
-#define sigaddset foobar
-#include <asm/signal.h>
-#undef sigaddset
+#include <signal.h>
+#include <errno.h>
-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;
-}
+#define __sigmask(sig) ( ((unsigned long)1) << (((sig)-1) % (8*sizeof(unsigned long))) )
+#define __sigword(sig) ( ((sig)-1) / (8*sizeof(unsigned long)) )
-int sigaddset (sigset_t *env, int signo) __attribute__((weak,alias("__sigaddset")));
+int sigaddset(sigset_t *set, int signo) {
+ if ((signo<1)||(signo>SIGRTMAX)) {
+ (*__errno_location())=EINVAL;
+ return -1;
+ } else {
+ unsigned long __mask = __sigmask (signo);
+ unsigned long __word = __sigword (signo);
+ set->sig[__word]|=__mask;
+ return 0;
+ }
+}
diff --git a/mdk-stage1/dietlibc/lib/sigdelset.c b/mdk-stage1/dietlibc/lib/sigdelset.c
index 2c3385ea8..0c47ce348 100644
--- a/mdk-stage1/dietlibc/lib/sigdelset.c
+++ b/mdk-stage1/dietlibc/lib/sigdelset.c
@@ -1,15 +1,17 @@
-#define __KERNEL__
-#define sigdelset foobar
-#include <asm/signal.h>
-#undef sigdelset
+#include <signal.h>
+#include <errno.h>
-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;
-}
+#define __sigmask(sig) ( ((unsigned long)1) << (((sig)-1) % (8*sizeof(unsigned long))) )
+#define __sigword(sig) ( ((sig)-1) / (8*sizeof(unsigned long)) )
-int sigdelset (sigset_t *env, int signo) __attribute__((weak,alias("__sigdelset")));
+int sigdelset(sigset_t *set, int signo) {
+ if ((signo<1)||(signo>SIGRTMAX)) {
+ (*__errno_location())=EINVAL;
+ return -1;
+ } else {
+ unsigned long __mask = __sigmask (signo);
+ unsigned long __word = __sigword (signo);
+ set->sig[__word]&=~__mask;
+ return 0;
+ }
+}
diff --git a/mdk-stage1/dietlibc/lib/sigemptyset.c b/mdk-stage1/dietlibc/lib/sigemptyset.c
index f4532f96e..4efee2550 100644
--- a/mdk-stage1/dietlibc/lib/sigemptyset.c
+++ b/mdk-stage1/dietlibc/lib/sigemptyset.c
@@ -1,14 +1,12 @@
-#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;
+ set->sig[0]=0;
+ if (_NSIG_WORDS>1) set->sig[1]=0;
+ if (_NSIG_WORDS>2) {
+ set->sig[2]=0;
+ set->sig[3]=0;
}
- memset(set,0,sizeof(*set));
return 0;
}
diff --git a/mdk-stage1/dietlibc/lib/sigfillset.c b/mdk-stage1/dietlibc/lib/sigfillset.c
index ddac6e391..b4e369fe4 100644
--- a/mdk-stage1/dietlibc/lib/sigfillset.c
+++ b/mdk-stage1/dietlibc/lib/sigfillset.c
@@ -1,11 +1,11 @@
-#define __KERNEL__
-#include <asm/signal.h>
+#include <signal.h>
-int __sigfillset (sigset_t *set) {
- int i;
- for (i=0; i<_NSIG_WORDS; i++)
- set->sig[i]=~0;
+int sigfillset(sigset_t *set) {
+ set->sig[0]=(unsigned long)-1;
+ if (_NSIG_WORDS>1) set->sig[1]=(unsigned long)-1;
+ if (_NSIG_WORDS>2) {
+ set->sig[2]=(unsigned long)-1;
+ set->sig[3]=(unsigned long)-1;
+ }
return 0;
}
-
-int sigfillset(sigset_t *env) __attribute__((weak,alias("__sigfillset")));
diff --git a/mdk-stage1/dietlibc/lib/siginterrupt.c b/mdk-stage1/dietlibc/lib/siginterrupt.c
new file mode 100644
index 000000000..8926f09ed
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/siginterrupt.c
@@ -0,0 +1,17 @@
+#include <signal.h>
+
+int siginterrupt(int sig, int flag) {
+ int ret;
+ struct sigaction act;
+
+ sigaction(sig, 0, &act);
+
+ if (flag)
+ act.sa_flags &= ~SA_RESTART;
+ else
+ act.sa_flags |= SA_RESTART;
+
+ ret = sigaction(sig, &act, 0);
+
+ return ret;
+}
diff --git a/mdk-stage1/dietlibc/lib/sigismember.c b/mdk-stage1/dietlibc/lib/sigismember.c
index 67a258884..8ffe9762a 100644
--- a/mdk-stage1/dietlibc/lib/sigismember.c
+++ b/mdk-stage1/dietlibc/lib/sigismember.c
@@ -1,21 +1,16 @@
-#define __USE_EXTERN_INLINES 1
#include <signal.h>
+#include <errno.h>
-# define __sigmask(sig) \
- (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int))))
+#define __sigmask(sig) ( ((unsigned long)1) << (((sig)-1) % (8*sizeof(unsigned long))) )
+#define __sigword(sig) ( ((sig)-1) / (8*sizeof(unsigned long)) )
-# 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 *set, int signo) {
+ if ((signo<1)||(signo>SIGRTMAX)) {
+ (*__errno_location())=EINVAL;
+ return -1;
+ } else {
+ unsigned long __mask = __sigmask (signo);
+ unsigned long __word = __sigword (signo);
+ return (set->sig[__word] & __mask)?1:0;
+ }
}
-
-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
index be97c62cc..73c8baa8e 100644
--- a/mdk-stage1/dietlibc/lib/sigjmp.c
+++ b/mdk-stage1/dietlibc/lib/sigjmp.c
@@ -1,35 +1,10 @@
-/* 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);
+int __sigjmp_save(sigjmp_buf env,int savemask);
+int __sigjmp_save(sigjmp_buf env,int savemask) {
+ if (savemask) {
+ env[0].__mask_was_saved=(sigprocmask(SIG_BLOCK,(sigset_t*)0,(sigset_t*)&env[0].__saved_mask)==0);
+ }
return 0;
}
diff --git a/mdk-stage1/dietlibc/lib/signal.c b/mdk-stage1/dietlibc/lib/signal.c
new file mode 100644
index 000000000..51441558e
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/signal.c
@@ -0,0 +1,12 @@
+#include <signal.h>
+
+sighandler_t signal(int signum, sighandler_t action) {
+ struct sigaction sa,oa;
+ sa.sa_handler=action;
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask,signum);
+ sa.sa_flags=SA_NODEFER;
+ if (sigaction(signum,&sa,&oa))
+ return SIG_ERR;
+ return oa.sa_handler;
+}
diff --git a/mdk-stage1/dietlibc/lib/sigpending.c b/mdk-stage1/dietlibc/lib/sigpending.c
new file mode 100644
index 000000000..62a4761c6
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/sigpending.c
@@ -0,0 +1,7 @@
+#include <signal.h>
+
+int __rt_sigpending(sigset_t *set, long nr);
+
+int sigpending(sigset_t *set) {
+ return __rt_sigpending(set, _NSIG/8);
+}
diff --git a/mdk-stage1/dietlibc/lib/sigprocmask.c b/mdk-stage1/dietlibc/lib/sigprocmask.c
new file mode 100644
index 000000000..6d770c3d3
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/sigprocmask.c
@@ -0,0 +1,7 @@
+#include <signal.h>
+
+int __rt_sigprocmask(int how, const sigset_t *set, sigset_t *oldsetm, long nr);
+
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) {
+ return __rt_sigprocmask(how, set, oldset, _NSIG/8);
+}
diff --git a/mdk-stage1/dietlibc/lib/sigqueueinfo.c b/mdk-stage1/dietlibc/lib/sigqueueinfo.c
new file mode 100644
index 000000000..adb7349f4
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/sigqueueinfo.c
@@ -0,0 +1,7 @@
+#include <signal.h>
+
+int __rt_sigqueueinfo(int pid, int sig, siginfo_t *info);
+
+int sigqueueinfo(int pid, int sig, siginfo_t *info) {
+ return __rt_sigqueueinfo(pid, sig, info);
+}
diff --git a/mdk-stage1/dietlibc/lib/sigsuspend.c b/mdk-stage1/dietlibc/lib/sigsuspend.c
new file mode 100644
index 000000000..a020789e9
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/sigsuspend.c
@@ -0,0 +1,10 @@
+#include <signal.h>
+
+int __rt_sigsuspend(const sigset_t *mask, long nr);
+
+int __libc_sigsuspend(const sigset_t *mask);
+int __libc_sigsuspend(const sigset_t *mask) {
+ return __rt_sigsuspend(mask, _NSIG/8);
+}
+
+int sigsuspend(const sigset_t *mask) __attribute__((weak,alias("__libc_sigsuspend")));
diff --git a/mdk-stage1/dietlibc/lib/sigtimedwait.c b/mdk-stage1/dietlibc/lib/sigtimedwait.c
new file mode 100644
index 000000000..864e433c3
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/sigtimedwait.c
@@ -0,0 +1,7 @@
+#include <signal.h>
+
+int __rt_sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts, long nr);
+
+int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts) {
+ return __rt_sigtimedwait(set,info,ts,_NSIG/8);
+}
diff --git a/mdk-stage1/dietlibc/lib/sleep.c b/mdk-stage1/dietlibc/lib/sleep.c
index ec5b99533..45c51f1b6 100644
--- a/mdk-stage1/dietlibc/lib/sleep.c
+++ b/mdk-stage1/dietlibc/lib/sleep.c
@@ -1,4 +1,4 @@
-#include <linux/time.h>
+#include <unistd.h>
#include <time.h>
unsigned int sleep(unsigned int secs) {
diff --git a/mdk-stage1/dietlibc/lib/snprintf.c b/mdk-stage1/dietlibc/lib/snprintf.c
index 096c06115..141b4ec13 100644
--- a/mdk-stage1/dietlibc/lib/snprintf.c
+++ b/mdk-stage1/dietlibc/lib/snprintf.c
@@ -1,7 +1,6 @@
#include <stdarg.h>
#include <sys/types.h>
-
-int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
+#include <stdio.h>
int snprintf(char *str,size_t size,const char *format,...)
{
diff --git a/mdk-stage1/dietlibc/lib/socket.c b/mdk-stage1/dietlibc/lib/socket.c
index 1684a6a2b..c18df5123 100644
--- a/mdk-stage1/dietlibc/lib/socket.c
+++ b/mdk-stage1/dietlibc/lib/socket.c
@@ -1,12 +1,11 @@
-#include <linux/net.h>
+#include <linuxnet.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
+int __libc_socket(int a, int b, int c);
+int __libc_socket(int a, int b, int c) {
unsigned long args[] = { a, b, c };
return socketcall(SYS_SOCKET, args);
-#endif
}
+
+int socket(int a,int b,int c) __attribute__((weak,alias("__libc_socket")));
diff --git a/mdk-stage1/dietlibc/lib/socketpair.c b/mdk-stage1/dietlibc/lib/socketpair.c
new file mode 100644
index 000000000..e6f1fd822
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/socketpair.c
@@ -0,0 +1,12 @@
+#include <linuxnet.h>
+
+extern int socketcall(int callno,long* args);
+
+int __libc_socketpair(int a, int type, int protocol, int sv[2]);
+int __libc_socketpair(int a, int type, int protocol, int sv[2]) {
+ unsigned long args[] = { a, type, protocol, (long)sv };
+ return socketcall(SYS_SOCKETPAIR, args);
+}
+
+int socketpair(int d, int type, int protocol, int sv[2])
+ __attribute__((weak,alias("__libc_socketpair")));
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
index b355d01f9..37fd831d9 100644
--- a/mdk-stage1/dietlibc/lib/sprintf.c
+++ b/mdk-stage1/dietlibc/lib/sprintf.c
@@ -1,18 +1,14 @@
#include <stdarg.h>
-#include <linux/types.h>
+#include <sys/types.h>
#include <stdlib.h>
-#include "dietwarning.h"
-
-int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
+#include <stdio.h>
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);
+ n=vsprintf(dest,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
index 341e74bba..e608878ef 100644
--- a/mdk-stage1/dietlibc/lib/sscanf.c
+++ b/mdk-stage1/dietlibc/lib/sscanf.c
@@ -1,6 +1,5 @@
#include <stdarg.h>
-
-int vsscanf(const char *str, const char *format, va_list arg_ptr);
+#include <stdio.h>
int sscanf(const char *str, const char *format, ...)
{
diff --git a/mdk-stage1/dietlibc/lib/strcasecmp.c b/mdk-stage1/dietlibc/lib/strcasecmp.c
index d978488a4..cf1592567 100644
--- a/mdk-stage1/dietlibc/lib/strcasecmp.c
+++ b/mdk-stage1/dietlibc/lib/strcasecmp.c
@@ -1,17 +1,18 @@
-#include <ctype.h>
-#include "dietfeatures.h"
+#include <strings.h>
-int strcasecmp(register const char *s,register const char *t) {
- register char x;
+int strcasecmp ( const char* s1, const char* s2 )
+{
+ register unsigned int x2;
+ register unsigned int x1;
- 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);
+ while (1) {
+ x2 = *s2++ - 'A'; if (x2 < 26u) x2 += 32;
+ x1 = *s1++ - 'A'; if (x1 < 26u) x1 += 32;
+ if ( x2 != x1 )
+ break;
+ if ( x1 == (unsigned int)-'A' )
+ break;
+ }
+
+ return x1 - x2;
}
diff --git a/mdk-stage1/dietlibc/lib/strchr.c b/mdk-stage1/dietlibc/lib/strchr.c
index 0c2050da6..3a4c9b5b4 100644
--- a/mdk-stage1/dietlibc/lib/strchr.c
+++ b/mdk-stage1/dietlibc/lib/strchr.c
@@ -1,4 +1,5 @@
#include "dietfeatures.h"
+#include <string.h>
char *strchr(register const char *t, int c) {
register char ch;
diff --git a/mdk-stage1/dietlibc/lib/strcmp.c b/mdk-stage1/dietlibc/lib/strcmp.c
index 0db324e66..3892379e5 100644
--- a/mdk-stage1/dietlibc/lib/strcmp.c
+++ b/mdk-stage1/dietlibc/lib/strcmp.c
@@ -14,3 +14,5 @@ int strcmp(register const char *s,register const char *t) {
return ((int)(unsigned int)(unsigned char) x)
- ((int)(unsigned int)(unsigned char) *t);
}
+
+int strcoll(const char *s,const char* t) __attribute__((weak,alias("strcmp")));
diff --git a/mdk-stage1/dietlibc/lib/strcpy.c b/mdk-stage1/dietlibc/lib/strcpy.c
index 49693c30d..444054e71 100644
--- a/mdk-stage1/dietlibc/lib/strcpy.c
+++ b/mdk-stage1/dietlibc/lib/strcpy.c
@@ -3,13 +3,16 @@
char* strcpy(register char* s,register const char* t)
{
char *dest=s;
+#ifndef WANT_SMALL_STRING_ROUTINES
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
}
+#else
+ while ((*dest++=*t++));
+ return s;
+#endif
}
diff --git a/mdk-stage1/dietlibc/lib/strerror.c b/mdk-stage1/dietlibc/lib/strerror.c
index f15b86aae..7cb79d988 100644
--- a/mdk-stage1/dietlibc/lib/strerror.c
+++ b/mdk-stage1/dietlibc/lib/strerror.c
@@ -1,10 +1,20 @@
+#include "dietfeatures.h"
+#include <unistd.h>
#include <string.h>
-extern char *sys_errlist[];
-extern int sys_nerr;
+#define _BSD_SOURCE
+#include <errno.h>
-char *strerror(int errnum) {
- if (errnum>=0 && errnum<sys_nerr)
- return sys_errlist[errnum];
- return "[unknown error]";
+extern const char __sys_err_unknown[];
+
+char*strerror(int errnum) {
+ register const char*message=__sys_err_unknown;
+
+ if ( (unsigned int)errnum < (unsigned int)__SYS_NERR )
+ message=sys_errlist[errnum];
+#if defined(__mips__)
+ if ( errnum == 1133 )
+ message="Quota exceeded";
+#endif
+ return (char*)message;
}
diff --git a/mdk-stage1/dietlibc/lib/strlen.c b/mdk-stage1/dietlibc/lib/strlen.c
index 56c085dac..96da5a540 100644
--- a/mdk-stage1/dietlibc/lib/strlen.c
+++ b/mdk-stage1/dietlibc/lib/strlen.c
@@ -4,7 +4,7 @@
#ifdef WANT_SMALL_STRING_ROUTINES
size_t strlen(const char *s) {
- register int i;
+ register size_t i;
if (!s) return 0;
for (i=0; *s; ++s) ++i;
return i;
diff --git a/mdk-stage1/dietlibc/lib/strncasecmp.c b/mdk-stage1/dietlibc/lib/strncasecmp.c
index 8a5445e53..543fe56ba 100644
--- a/mdk-stage1/dietlibc/lib/strncasecmp.c
+++ b/mdk-stage1/dietlibc/lib/strncasecmp.c
@@ -1,18 +1,22 @@
-#include <ctype.h>
#include <sys/types.h>
-#include <string.h>
+#include <strings.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);
+int strncasecmp ( const char* s1, const char* s2, size_t len )
+{
+ register unsigned int x2;
+ register unsigned int x1;
+ register const char* end = s1 + len;
+
+ while (1) {
+ if ( s1 >= end )
+ return 0;
+ x2 = *s2++ - 'A'; if (x2 < 26u) x2 += 32;
+ x1 = *s1++ - 'A'; if (x1 < 26u) x1 += 32;
+ if ( x2 != x1 )
+ break;
+ if ( x1 == (unsigned int)-'A' )
+ break;
+ }
+
+ return x1 - x2;
}
diff --git a/mdk-stage1/dietlibc/lib/strncat.c b/mdk-stage1/dietlibc/lib/strncat.c
index a08e97916..9802d5678 100644
--- a/mdk-stage1/dietlibc/lib/strncat.c
+++ b/mdk-stage1/dietlibc/lib/strncat.c
@@ -9,14 +9,16 @@
* the last written bytes is always '\0'. */
#endif
+/* gcc is broken and has a non-SUSv2 compliant internal prototype.
+ * This causes it to warn about a type mismatch here. Ignore it. */
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;
+ if ((max=s+n-1)<=s) goto fini;
#else
- max=s+n;
+ if ((max=s+n)==s) goto fini;
#endif
for (;;) {
if (!(*s = *t)) break; if (++s==max) break; ++t;
@@ -27,5 +29,6 @@ char *strncat(char *s, const char *t, size_t n) {
#endif
}
*s=0;
+fini:
return dest;
}
diff --git a/mdk-stage1/dietlibc/lib/strncmp.c b/mdk-stage1/dietlibc/lib/strncmp.c
index 7c08c0fa7..b3b56cfbb 100644
--- a/mdk-stage1/dietlibc/lib/strncmp.c
+++ b/mdk-stage1/dietlibc/lib/strncmp.c
@@ -1,6 +1,17 @@
#include <sys/types.h>
#include <string.h>
+/* gcc is broken and has a non-SUSv2 compliant internal prototype.
+ * This causes it to warn about a type mismatch here. Ignore it. */
int strncmp(const char *s1, const char *s2, size_t n) {
- return memccmp(s1,s2,0,n);
+ register const char* a=s1;
+ register const char* b=s2;
+ register const char* fini=a+n;
+ while (a<fini) {
+ register int res=*a-*b;
+ if (res) return res;
+ if (!*a) return 0;
+ ++a; ++b;
+ }
+ return 0;
}
diff --git a/mdk-stage1/dietlibc/lib/strncpy.c b/mdk-stage1/dietlibc/lib/strncpy.c
index 531387b7f..31b682a1e 100644
--- a/mdk-stage1/dietlibc/lib/strncpy.c
+++ b/mdk-stage1/dietlibc/lib/strncpy.c
@@ -2,9 +2,14 @@
#define _XOPEN_SOURCE
#include <sys/types.h>
#include <string.h>
+#include "dietfeatures.h"
-char *strncpy(char *dest, const char *src, size_t n)
-{
+/* gcc is broken and has a non-SUSv2 compliant internal prototype.
+ * This causes it to warn about a type mismatch here. Ignore it. */
+char *strncpy(char *dest, const char *src, size_t n) {
+#ifdef WANT_FULL_POSIX_COMPAT
+ memset(dest,0,n);
+#endif
memccpy(dest,src,0,n);
return dest;
}
diff --git a/mdk-stage1/dietlibc/lib/strsep.c b/mdk-stage1/dietlibc/lib/strsep.c
index a1bf1872a..db76f89b5 100644
--- a/mdk-stage1/dietlibc/lib/strsep.c
+++ b/mdk-stage1/dietlibc/lib/strsep.c
@@ -4,6 +4,7 @@ char *strsep(char **stringp, const char *delim) {
register char *tmp=*stringp;
register char *tmp2=tmp;
register const char *tmp3;
+ if (!*stringp) return 0;
for (tmp2=tmp; *tmp2; ++tmp2) {
for (tmp3=delim; *tmp3; ++tmp3)
if (*tmp2==*tmp3) { /* delimiter found */
@@ -12,5 +13,6 @@ char *strsep(char **stringp, const char *delim) {
return tmp;
}
}
- return 0;
+ *stringp=0;
+ return tmp;
}
diff --git a/mdk-stage1/dietlibc/lib/strstr.c b/mdk-stage1/dietlibc/lib/strstr.c
index 641d9d7ac..0632cc28a 100644
--- a/mdk-stage1/dietlibc/lib/strstr.c
+++ b/mdk-stage1/dietlibc/lib/strstr.c
@@ -2,12 +2,14 @@
#include <string.h>
char *strstr(const char *haystack, const char *needle) {
- int nl=strlen(needle);
- int hl=strlen(haystack);
+ size_t nl=strlen(needle);
+ size_t hl=strlen(haystack);
int i;
+ if (!nl) goto found;
if (nl>hl) return 0;
for (i=hl-nl+1; i; --i) {
- if (!memcmp(haystack,needle,nl))
+ if (*haystack==*needle && !memcmp(haystack,needle,nl))
+found:
return (char*)haystack;
++haystack;
}
diff --git a/mdk-stage1/dietlibc/lib/strtod.c b/mdk-stage1/dietlibc/lib/strtod.c
index cbe983d84..5d50cc535 100644
--- a/mdk-stage1/dietlibc/lib/strtod.c
+++ b/mdk-stage1/dietlibc/lib/strtod.c
@@ -1,52 +1,66 @@
#include <string.h>
+#include <stdlib.h>
+#include <ctype.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;
+double strtod(const char* s, char** endptr) {
+ register const char* p = s;
+ register long double value = 0.L;
+ int sign = +1;
+ long double factor;
+ unsigned int expo;
+
+ while ( isspace(*p) )
+ p++;
+
+ switch (*p) {
+ case '-': sign = -1;
+ case '+': p++;
+ default : break;
}
- }
- 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 ( (unsigned int)(*p - '0') < 10u )
+ value = value*10 + (*p++ - '0');
+
+ if ( *p == '.' ) {
+ factor = 1.;
+
+ p++;
+ while ( (unsigned int)(*p - '0') < 10u ) {
+ factor *= 0.1;
+ value += (*p++ - '0') * factor;
+ }
}
- while (isdigit(*++c))
- exp=exp*10+(*c-'0');
- while (exp) { /* XXX: this introduces rounding errors */
- d*=factor; --exp;
+
+ if ( (*p | 32) == 'e' ) {
+ expo = 0;
+ factor = 10.L;
+
+ switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS.
+ case '-': factor = 0.1;
+ case '+': p++;
+ break;
+ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
+ break;
+ default : value = 0.L;
+ p = s;
+ goto done;
+ }
+
+ while ( (unsigned int)(*p - '0') < 10u )
+ expo = 10 * expo + (*p++ - '0');
+
+ while ( 1 ) {
+ if ( expo & 1 )
+ value *= factor;
+ if ( (expo >>= 1) == 0 )
+ break;
+ factor *= factor;
+ }
}
- }
+
done:
- if (endptr) *endptr=(char*)c;
- return d;
+ if ( endptr != NULL )
+ *endptr = (char*)p;
+
+ return value * sign;
}
diff --git a/mdk-stage1/dietlibc/lib/strtof.c b/mdk-stage1/dietlibc/lib/strtof.c
new file mode 100644
index 000000000..acb081e51
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/strtof.c
@@ -0,0 +1,66 @@
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+float strtof(const char* s, char** endptr) {
+ register const char* p = s;
+ register float value = 0.;
+ int sign = +1;
+ float factor;
+ unsigned int expo;
+
+ while ( isspace(*p) )
+ p++;
+
+ switch (*p) {
+ case '-': sign = -1;
+ case '+': p++;
+ default : break;
+ }
+
+ while ( (unsigned int)(*p - '0') < 10u )
+ value = value*10 + (*p++ - '0');
+
+ if ( *p == '.' ) {
+ factor = 1.;
+
+ p++;
+ while ( (unsigned int)(*p - '0') < 10u ) {
+ factor *= 0.1;
+ value += (*p++ - '0') * factor;
+ }
+ }
+
+ if ( (*p | 32) == 'e' ) {
+ expo = 0;
+ factor = 10.L;
+
+ switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS.
+ case '-': factor = 0.1;
+ case '+': p++;
+ break;
+ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
+ break;
+ default : value = 0.L;
+ p = s;
+ goto done;
+ }
+
+ while ( (unsigned int)(*p - '0') < 10u )
+ expo = 10 * expo + (*p++ - '0');
+
+ while ( 1 ) {
+ if ( expo & 1 )
+ value *= factor;
+ if ( (expo >>= 1) == 0 )
+ break;
+ factor *= factor;
+ }
+ }
+
+done:
+ if ( endptr != NULL )
+ *endptr = (char*)p;
+
+ return value * sign;
+}
diff --git a/mdk-stage1/dietlibc/lib/strtok.c b/mdk-stage1/dietlibc/lib/strtok.c
index 86337da7b..e041703e3 100644
--- a/mdk-stage1/dietlibc/lib/strtok.c
+++ b/mdk-stage1/dietlibc/lib/strtok.c
@@ -1,4 +1,4 @@
-char *strtok_r(char *s, const char *delim, char **ptrptr);
+#include <string.h>
static char *strtok_pos;
diff --git a/mdk-stage1/dietlibc/lib/strtol.c b/mdk-stage1/dietlibc/lib/strtol.c
index ead89f408..2624aca0e 100644
--- a/mdk-stage1/dietlibc/lib/strtol.c
+++ b/mdk-stage1/dietlibc/lib/strtol.c
@@ -1,7 +1,10 @@
#include <ctype.h>
+#include "dietfeatures.h"
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
-extern unsigned long int strtoul(const char *nptr, char **endptr, int base);
-
+#define ABS_LONG_MIN 2147483648UL
long int strtol(const char *nptr, char **endptr, int base)
{
int neg=0;
@@ -9,7 +12,15 @@ long int strtol(const char *nptr, char **endptr, int base)
while(isspace(*nptr)) nptr++;
- if (*nptr == '-' && isdigit(nptr[1])) { neg=-1; nptr++; }
+ if (*nptr == '-') { neg=-1; ++nptr; }
v=strtoul(nptr,endptr,base);
+ if (v>=ABS_LONG_MIN) {
+ if (v==ABS_LONG_MIN && neg) {
+ errno=0;
+ return v;
+ }
+ errno=ERANGE;
+ return (neg?LONG_MIN:LONG_MAX);
+ }
return (neg?-v:v);
}
diff --git a/mdk-stage1/dietlibc/lib/strtold.c b/mdk-stage1/dietlibc/lib/strtold.c
new file mode 100644
index 000000000..ae5f0fa48
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/strtold.c
@@ -0,0 +1,66 @@
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+long double strtold(const char* s, char** endptr) {
+ register const char* p = s;
+ register long double value = 0.L;
+ int sign = +1;
+ long double factor;
+ unsigned int expo;
+
+ while ( isspace(*p) )
+ p++;
+
+ switch (*p) {
+ case '-': sign = -1;
+ case '+': p++;
+ default : break;
+ }
+
+ while ( (unsigned int)(*p - '0') < 10u )
+ value = value*10 + (*p++ - '0');
+
+ if ( *p == '.' ) {
+ factor = 1.;
+
+ p++;
+ while ( (unsigned int)(*p - '0') < 10u ) {
+ factor *= 0.1;
+ value += (*p++ - '0') * factor;
+ }
+ }
+
+ if ( (*p | 32) == 'e' ) {
+ expo = 0;
+ factor = 10.L;
+
+ switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS.
+ case '-': factor = 0.1;
+ case '+': p++;
+ break;
+ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
+ break;
+ default : value = 0.L;
+ p = s;
+ goto done;
+ }
+
+ while ( (unsigned int)(*p - '0') < 10u )
+ expo = 10 * expo + (*p++ - '0');
+
+ while ( 1 ) {
+ if ( expo & 1 )
+ value *= factor;
+ if ( (expo >>= 1) == 0 )
+ break;
+ factor *= factor;
+ }
+ }
+
+done:
+ if ( endptr != NULL )
+ *endptr = (char*)p;
+
+ return value * sign;
+}
diff --git a/mdk-stage1/dietlibc/lib/strtoll.c b/mdk-stage1/dietlibc/lib/strtoll.c
index 7b8e28a1d..9e05e740e 100644
--- a/mdk-stage1/dietlibc/lib/strtoll.c
+++ b/mdk-stage1/dietlibc/lib/strtoll.c
@@ -1,8 +1,7 @@
#include <ctype.h>
+#include <stdlib.h>
-extern unsigned long int strtoull(const char *nptr, char **endptr, int base);
-
-long int strtoll(const char *nptr, char **endptr, int base)
+long long int strtoll(const char *nptr, char **endptr, int base)
{
int neg=0;
unsigned long long int v;
diff --git a/mdk-stage1/dietlibc/lib/strtoul.c b/mdk-stage1/dietlibc/lib/strtoul.c
index 3f93962a9..e9c09fb59 100644
--- a/mdk-stage1/dietlibc/lib/strtoul.c
+++ b/mdk-stage1/dietlibc/lib/strtoul.c
@@ -1,32 +1,44 @@
#include <ctype.h>
-
-/* static char *num="0123456789abcdefghijklmnopqrstuvwxyz"; */
+#include "dietfeatures.h"
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
unsigned long int strtoul(const char *nptr, char **endptr, int base)
{
- long int v=0;
+ int neg = 0;
+ unsigned long int v=0;
while(isspace(*nptr)) ++nptr;
-
+ if (*nptr == '-') { neg=1; nptr++; }
if (*nptr == '+') ++nptr;
+ if (base==16 && nptr[0]=='0') goto skip0x;
if (!base) {
if (*nptr=='0') {
base=8;
- if ((*(nptr+1)=='x')||(*(nptr+1)=='X')) {
+skip0x:
+ if (nptr[1]=='x'||nptr[1]=='X') {
nptr+=2;
base=16;
}
- }
- else
+ } else
base=10;
}
while(*nptr) {
register unsigned char c=*nptr;
- c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c-'0');
+ c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c<='9'?c-'0':0xff);
if (c>=base) break;
- v=v*base+c;
+ {
+ register unsigned long int w=v*base;
+ if (w<v) {
+ errno=ERANGE;
+ return ULONG_MAX;
+ }
+ v=w+c;
+ }
++nptr;
}
if (endptr) *endptr=(char *)nptr;
- return v;
+ errno=0; /* in case v==ULONG_MAX, ugh! */
+ return (neg?-v:v);
}
diff --git a/mdk-stage1/dietlibc/lib/strtoull.c b/mdk-stage1/dietlibc/lib/strtoull.c
index 40818958d..d6073e32a 100644
--- a/mdk-stage1/dietlibc/lib/strtoull.c
+++ b/mdk-stage1/dietlibc/lib/strtoull.c
@@ -1,4 +1,5 @@
#include <ctype.h>
+#include <stdlib.h>
unsigned long long int strtoull(const char *nptr, char **endptr, int base)
{
diff --git a/mdk-stage1/dietlibc/lib/strxfrm.c b/mdk-stage1/dietlibc/lib/strxfrm.c
new file mode 100644
index 000000000..5075ff0b5
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/strxfrm.c
@@ -0,0 +1,12 @@
+#include <sys/types.h>
+#include <string.h>
+#include "dietfeatures.h"
+
+size_t strxfrm(char *dest, const char *src, size_t n) {
+#ifdef WANT_FULL_POSIX_COMPAT
+ memset(dest,0,n);
+#endif
+ memccpy(dest,src,0,n);
+ return strlen(dest);
+}
+
diff --git a/mdk-stage1/dietlibc/lib/sys_siglist.c b/mdk-stage1/dietlibc/lib/sys_siglist.c
index 80d7b3fb0..a753848d9 100644
--- a/mdk-stage1/dietlibc/lib/sys_siglist.c
+++ b/mdk-stage1/dietlibc/lib/sys_siglist.c
@@ -1,37 +1,174 @@
-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
- };
+const char *const sys_siglist[] = {
+ "Signal 0",
+ "Hangup",
+ "Interrupt",
+ "Quit",
+ "Illegal instruction",
+ "Trace/breakpoint trap",
+ "ABRT/IOT trap",
+#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
+ "EMT trap",
+#else
+ "Bus error",
+#endif
+ "Floating point exception",
+ "Killed",
+#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
+ "Bus error",
+#else
+ "User defined signal 1",
+#endif
+ "Segmentation fault",
+#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
+ "Bad system call",
+#else
+ "User defined signal 2",
+#endif
+ "Broken pipe",
+ "Alarm clock",
+ "Terminated",
+#if defined(__hppa__)
+ "User defined signal 1",
+ "User defined signal 2",
+ "Child exited",
+ "Power lost",
+ "Virtual timer expired",
+ "Profiling timer expired",
+ "I/O possible",
+ "Window changed",
+ "Stopped (signal)",
+ "Stopped",
+ "Continued",
+ "Stopped (tty input)",
+ "Stopped (tty output)",
+ "Urgent I/O condition",
+ "Power lost",
+ "Unknown",
+ "Unknown",
+ "CPU time limit exceeded",
+ "File size limit exceeded",
+ "Unknown",
+ "Stack fault",
+#elif defined(__mips__)
+ "User defined signal 1",
+ "User defined signal 2",
+ "Child exited",
+ "Power lost",
+ "Window changed",
+ "Urgent I/O condition",
+ "I/O possible",
+ "Stopped (signal)",
+ "Stopped",
+ "Continued",
+ "Stopped (tty input)",
+ "Stopped (tty output)",
+ "Virtual timer expired",
+ "Profiling timer expired",
+ "CPU time limit exceeded",
+ "File size limit exceeded",
+#elif defined(__alpha__) || defined(__sparc__)
+ "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",
+ "Power/Resource lost",
+ "User defined signal 1",
+ "User defined signal 2",
+#else
+ "Stack fault",
+ "Child exited",
+ "Continued",
+ "Stopped (signal)",
+ "Stopped",
+ "Stopped (tty input)",
+ "Stopped (tty output)",
+ "Urgent I/O condition",
+ "CPU time limit exceeded",
+ "File size limit exceeded",
+ "Virtual timer expired",
+ "Profiling timer expired",
+ "Window changed",
+ "I/O possible",
+ "Power lost",
+ "Bad system call",
+#endif
+#ifndef __hppa__
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+#endif
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+#ifdef __mips__
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+ "Real time signal",
+#endif
+ 0
+};
diff --git a/mdk-stage1/dietlibc/lib/tcdrain.c b/mdk-stage1/dietlibc/lib/tcdrain.c
index 7a760f643..bb2018fb4 100644
--- a/mdk-stage1/dietlibc/lib/tcdrain.c
+++ b/mdk-stage1/dietlibc/lib/tcdrain.c
@@ -1,5 +1,6 @@
#include <sys/ioctl.h>
+int __libc_tcdrain(int fd);
int __libc_tcdrain(int fd)
{
return ioctl(fd, TCSBRK, 1);
diff --git a/mdk-stage1/dietlibc/lib/tcflow.c b/mdk-stage1/dietlibc/lib/tcflow.c
new file mode 100644
index 000000000..ea460f362
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/tcflow.c
@@ -0,0 +1,35 @@
+#include "dietfeatures.h"
+#include <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int tcflow ( int fd, int action )
+{
+#if TCOOFF==0 && TCOON==1 && TCIOFF==2 && TCION==3
+
+ if ( (unsigned int)action < 4u )
+ return ioctl ( fd, TCXONC, action );
+
+ errno = EINVAL;
+ return -1;
+
+#else
+
+ int arg = 0;
+
+ switch (action) {
+ case TCION:
+ arg++;
+ case TCIOFF:
+ arg++;
+ case TCOON:
+ arg++;
+ case TCOOFF:
+ return ioctl ( fd, TCXONC, arg );
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
+#endif
+}
diff --git a/mdk-stage1/dietlibc/lib/tcflush.c b/mdk-stage1/dietlibc/lib/tcflush.c
index a19fe11d1..2e5447728 100644
--- a/mdk-stage1/dietlibc/lib/tcflush.c
+++ b/mdk-stage1/dietlibc/lib/tcflush.c
@@ -1,23 +1,9 @@
-#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)
+int __libc_tcflush(int fd, int queue_selector);
+int __libc_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;
- }
+ return ioctl(fd, TCFLSH, queue_selector);
}
+
+int tcflush(int fd) __attribute__((weak,alias("__libc_tcflush")));
diff --git a/mdk-stage1/dietlibc/lib/tcgetpgrp.c b/mdk-stage1/dietlibc/lib/tcgetpgrp.c
index f2a290651..8d5d4614a 100644
--- a/mdk-stage1/dietlibc/lib/tcgetpgrp.c
+++ b/mdk-stage1/dietlibc/lib/tcgetpgrp.c
@@ -1,7 +1,12 @@
#include <termios.h>
#include <sys/ioctl.h>
+#include <unistd.h>
int tcgetpgrp(int fildes)
{
- return ioctl(fildes, TIOCGPGRP);
+ int foo;
+ if (ioctl(fildes, TIOCGPGRP, &foo)==-1)
+ return -1;
+ else
+ return foo;
}
diff --git a/mdk-stage1/dietlibc/lib/tcsendbreak.c b/mdk-stage1/dietlibc/lib/tcsendbreak.c
new file mode 100644
index 000000000..b026340cf
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/tcsendbreak.c
@@ -0,0 +1,11 @@
+#include "dietfeatures.h"
+#include <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+int tcsendbreak (int fd,int duration)
+{
+ if (duration <= 0) return (ioctl (fd,TCSBRKP,0));
+ errno = EINVAL;
+ return (-1);
+}
diff --git a/mdk-stage1/dietlibc/lib/tcsetattr.c b/mdk-stage1/dietlibc/lib/tcsetattr.c
index cf70354d2..03fe8adee 100644
--- a/mdk-stage1/dietlibc/lib/tcsetattr.c
+++ b/mdk-stage1/dietlibc/lib/tcsetattr.c
@@ -1,27 +1,37 @@
-#define tcsetattr libc_tcsetattr
#include <termios.h>
#include <sys/ioctl.h>
-#undef tcsetattr
+#include <errno.h>
+#include "dietfeatures.h"
-#include <asm/errno.h>
+#if !defined(__powerpc__) && !defined(__sparc__) && !defined(__alpha__) && !defined(__hppa__)
+#if TCSANOW==0 && TCSADRAIN==1 && TCSAFLUSH==2 && TCSETSW-TCSETS==1 && TCSETSF-TCSETS==2
+#define shortcut
+#endif
+#endif
-extern int errno;
+int tcsetattr ( int fildes, int optional_actions, struct termios* termios_p )
+{
+#ifdef shortcut
-/* Hack around a kernel bug; value must correspond to the one used in speed.c */
-#define IBAUD0 020000000000
+ if ( (unsigned int)optional_actions < 3u )
+ return ioctl ( fildes, TCSETS+optional_actions, termios_p );
-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;
- }
+
+#else
+
+ 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;
+ }
+
+#endif
}
diff --git a/mdk-stage1/dietlibc/lib/tcsetpgrp.c b/mdk-stage1/dietlibc/lib/tcsetpgrp.c
index 6c40b5c79..8cf3165c2 100644
--- a/mdk-stage1/dietlibc/lib/tcsetpgrp.c
+++ b/mdk-stage1/dietlibc/lib/tcsetpgrp.c
@@ -1,5 +1,6 @@
#include <termios.h>
#include <sys/ioctl.h>
+#include <unistd.h>
int tcsetpgrp(int fildes, pid_t pgrpid)
{
diff --git a/mdk-stage1/dietlibc/lib/tolower.c b/mdk-stage1/dietlibc/lib/tolower.c
index 4b7c7cf2d..c24932ef4 100644
--- a/mdk-stage1/dietlibc/lib/tolower.c
+++ b/mdk-stage1/dietlibc/lib/tolower.c
@@ -1,6 +1,8 @@
#include <ctype.h>
-inline int tolower(int c) {
- return (c>='A' && c<='Z')?c-'A'+'a':c;
+int tolower(int ch) {
+ if ( (unsigned int)(ch - 'A') < 26u )
+ ch += 'a' - 'A';
+ return ch;
}
diff --git a/mdk-stage1/dietlibc/lib/toupper.c b/mdk-stage1/dietlibc/lib/toupper.c
index c048e60bb..f7d415e95 100644
--- a/mdk-stage1/dietlibc/lib/toupper.c
+++ b/mdk-stage1/dietlibc/lib/toupper.c
@@ -1,6 +1,8 @@
#include <ctype.h>
-inline int toupper(int c) {
- return (c>='a' && c<='z')?c-'a'+'A':c;
+inline int toupper(int ch) {
+ if ( (unsigned int)(ch - 'a') < 26u )
+ ch += 'A' - 'a';
+ return ch;
}
diff --git a/mdk-stage1/dietlibc/lib/ttyname.c b/mdk-stage1/dietlibc/lib/ttyname.c
index a6b479088..2bbc7f2a9 100644
--- a/mdk-stage1/dietlibc/lib/ttyname.c
+++ b/mdk-stage1/dietlibc/lib/ttyname.c
@@ -1,30 +1,35 @@
#include "dietfeatures.h"
#include <unistd.h>
#include <sys/stat.h>
+#include <string.h>
#ifdef __linux__
-extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase);
+#include <stdlib.h>
char *ttyname(int fd) {
#ifdef SLASH_PROC_OK
char ibuf[20];
static char obuf[20];
+ int len;
+ if (!isatty(fd)) return 0;
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;
+ ibuf[__ltostr(ibuf+14,6,(unsigned long)fd,10,0)+14]=0;
+ if ((len=readlink(ibuf,obuf,sizeof(obuf)-1))<0) return 0;
+ obuf[len]=0;
return obuf;
#else
- static char buf[20]="/dev/tty";
+ static char buf[20];
struct stat s;
char *c=buf+8;
int n;
+ if (!isatty(fd)) return 0;
if (fstat(fd,&s)) return 0;
+ strcpy(buf,"/dev/tty");
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';
@@ -34,16 +39,18 @@ 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;
+ goto duh;
case 136:
case 137:
case 138:
case 139:
- buf[5]='p'; buf[7]='s';
+ buf[7]='s';
+duh:
+ buf[5]='p';
n+=(major(s.st_rdev)-136)<<8;
*c='/'; ++c;
goto num;
diff --git a/mdk-stage1/dietlibc/lib/usleep.c b/mdk-stage1/dietlibc/lib/usleep.c
index 494f99233..8f07416a8 100644
--- a/mdk-stage1/dietlibc/lib/usleep.c
+++ b/mdk-stage1/dietlibc/lib/usleep.c
@@ -1,12 +1,12 @@
-#include <linux/time.h>
#include <time.h>
+#include <unistd.h>
/* nano * 1000 == usecs
* usecs * 1000 == msecs
* msecs * 1000 = secs */
-void usleep(unsigned int usecs) {
+int usleep(unsigned long usecs) {
struct timespec t;
t.tv_sec=usecs/1000000;
t.tv_nsec=(usecs%1000000)*1000;
- nanosleep(&t,&t);
+ return nanosleep(&t,&t);
}
diff --git a/mdk-stage1/dietlibc/lib/vfork.c b/mdk-stage1/dietlibc/lib/vfork.c
index 795cddb05..d54416d5d 100644
--- a/mdk-stage1/dietlibc/lib/vfork.c
+++ b/mdk-stage1/dietlibc/lib/vfork.c
@@ -1,6 +1,4 @@
-#include <linux/types.h>
#include <unistd.h>
-pid_t vfork(void) {
- return fork();
-}
+pid_t vfork() { 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
index f425066e3..dd06d6483 100644
--- a/mdk-stage1/dietlibc/lib/vsnprintf.c
+++ b/mdk-stage1/dietlibc/lib/vsnprintf.c
@@ -1,238 +1,33 @@
-#include "dietfeatures.h"
#include <stdarg.h>
#include <sys/types.h>
+#include <unistd.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;
+#include "dietstdio.h"
+
+struct str_data {
+ unsigned char* str;
+ size_t len;
+ size_t size;
+};
+
+static int swrite(void*ptr, size_t nmemb, struct str_data* sd) {
+ size_t tmp=sd->size-sd->len;
+ if (tmp>0) {
+ size_t len=nmemb;
+ if (len>tmp) len=tmp;
+ if (sd->str) {
+ memcpy(sd->str+sd->len,ptr,len);
+ sd->str[sd->len+len]=0;
}
+ sd->len+=len;
}
- if (str) str[apos]=0;
- return apos;
+ return nmemb;
}
-link_warning("vsnprintf","warning: the printf functions add several kilobytes of bloat.")
-
+int vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr) {
+ struct str_data sd = { str, 0, size };
+ struct arg_printf ap = { &sd, (int(*)(void*,size_t,void*)) swrite };
+ if (size) --sd.size;
+ return __v_printf(&ap,format,arg_ptr);
+}
diff --git a/mdk-stage1/dietlibc/lib/vsprintf.c b/mdk-stage1/dietlibc/lib/vsprintf.c
index 10ff04bd7..6cd5a40b1 100644
--- a/mdk-stage1/dietlibc/lib/vsprintf.c
+++ b/mdk-stage1/dietlibc/lib/vsprintf.c
@@ -1,10 +1,12 @@
#include <stdarg.h>
-#include <linux/types.h>
+#include <sys/types.h>
#include <stdlib.h>
-
-int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr);
+#include <stdio.h>
+#include "dietwarning.h"
int vsprintf(char *dest,const char *format, va_list arg_ptr)
{
- return vsnprintf(dest,1000000,format,arg_ptr);
+ return vsnprintf(dest,(size_t)-1,format,arg_ptr);
}
+
+link_warning("vsprintf","warning: Avoid *sprintf; use *snprintf. It is more secure.")
diff --git a/mdk-stage1/dietlibc/lib/vsscanf.c b/mdk-stage1/dietlibc/lib/vsscanf.c
index 1c4c9b787..329cfd02a 100644
--- a/mdk-stage1/dietlibc/lib/vsscanf.c
+++ b/mdk-stage1/dietlibc/lib/vsscanf.c
@@ -1,304 +1,25 @@
-#include "dietfeatures.h"
#include <stdarg.h>
#include <sys/types.h>
-#include <ctype.h>
#include <stdlib.h>
-#include <string.h>
+#include "dietstdio.h"
+#include <unistd.h>
-const char *skip_ws(const char *str)
-{
- while ((*str)&&(isspace(*str))) str++;
- return str;
+struct str_data {
+ unsigned char* str;
+};
+
+static int sgetc(struct str_data* sd) {
+ register unsigned int ret = *(sd->str++);
+ return (ret)?(int)ret:-1;
}
-extern double strtod(const char *s,char **f);
+static int sputc(int c, struct str_data* sd) {
+ return (*(--sd->str)==c)?c:-1;
+}
-int vsscanf(const char *str, const char *format, va_list arg_ptr)
+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;
+ struct str_data fdat = { (unsigned char*)str };
+ struct arg_scanf farg = { (void*)&fdat, (int(*)(void*))sgetc, (int(*)(int,void*))sputc };
+ return __v_scanf(&farg,format,arg_ptr);
}
diff --git a/mdk-stage1/dietlibc/lib/write12.c b/mdk-stage1/dietlibc/lib/write12.c
new file mode 100644
index 000000000..8e0130bfb
--- /dev/null
+++ b/mdk-stage1/dietlibc/lib/write12.c
@@ -0,0 +1,11 @@
+#include <unistd.h>
+#include <string.h>
+#include <write12.h>
+
+int __write1 (const char* s) {
+ return write(1, s, strlen(s));
+}
+
+int __write2 (const char* s) {
+ return write(2, s, strlen(s));
+}
diff --git a/mdk-stage1/dietlibc/libcompat/daemon.c b/mdk-stage1/dietlibc/libcompat/daemon.c
new file mode 100644
index 000000000..30f97a09a
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcompat/daemon.c
@@ -0,0 +1,29 @@
+#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);
+ if (fd>2) close (fd);
+ }
+ return (0);
+}
+
diff --git a/mdk-stage1/dietlibc/libcompat/getdelim.c b/mdk-stage1/dietlibc/libcompat/getdelim.c
new file mode 100644
index 000000000..e499bd7b7
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcompat/getdelim.c
@@ -0,0 +1,32 @@
+#define _GNU_SOURCE
+#include <stdlib.h>
+#include <stdio.h>
+#include "dietfeatures.h"
+#include <errno.h>
+#include "dietwarning.h"
+
+ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) {
+ size_t i;
+ if (!lineptr || !n) {
+ errno=EINVAL;
+ return -1;
+ }
+ if (!*lineptr) *n=0;
+ for (i=0; ; ) {
+ int x=fgetc(stream);
+ if (i>=*n) {
+ int tmp=*n+100;
+ char* new=realloc(*lineptr,tmp);
+ if (!new) return -1;
+ *lineptr=new; *n=tmp;
+ }
+ if (x==EOF) { (*lineptr)[i]=0; return -1; }
+ (*lineptr)[i]=x;
+ ++i;
+ if (x==delim) break;
+ }
+ (*lineptr)[i]=0;
+ return i;
+}
+
+link_warning("getdelim","warning: portable software should not use getdelim!")
diff --git a/mdk-stage1/dietlibc/libcompat/getline.c b/mdk-stage1/dietlibc/libcompat/getline.c
new file mode 100644
index 000000000..4926850a7
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcompat/getline.c
@@ -0,0 +1,9 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include "dietwarning.h"
+
+#undef getline
+ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
+ return getdelim(lineptr,n,'\n',stream);
+}
+link_warning("getline","warning: you used getline without include stdio.h w/_GNU_SOURCE")
diff --git a/mdk-stage1/dietlibc/libcompat/re_bsd.c b/mdk-stage1/dietlibc/libcompat/re_bsd.c
new file mode 100644
index 000000000..44f022fa3
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcompat/re_bsd.c
@@ -0,0 +1,34 @@
+/* wrapper to simulate the braindead 4.3BSD regex interface
+ * by Andreas Krennmair <a.krennmair@aon.at>
+ */
+#include <regex.h>
+#include <sys/types.h>
+
+#include "dietwarning.h"
+
+static char err_compile[] = "unable to compile regular expression.";
+static int re_buf_used;
+static regex_t re_buf;
+
+char * re_comp(char * regex) {
+ int rc;
+ if (regex) {
+ if (re_buf_used)
+ regfree(&re_buf);
+ rc = regcomp(&re_buf,regex,0);
+ if (rc)
+ return err_compile;
+ re_buf_used = 1;
+ }
+ return NULL;
+}
+
+int re_exec(char * string) {
+ if (string) {
+ return regexec(&re_buf,string,0,NULL,0)?0:1;
+ }
+ return 0;
+}
+
+link_warning("re_comp","warning: use regcomp instead of re_comp!")
+link_warning("re_exec","warning: use regexec instead of re_exec!")
diff --git a/mdk-stage1/dietlibc/libcompat/stpcpy.c b/mdk-stage1/dietlibc/libcompat/stpcpy.c
new file mode 100644
index 000000000..237a2e374
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcompat/stpcpy.c
@@ -0,0 +1,6 @@
+#include <string.h>
+
+char * stpcpy (char *dst, const char *src) {
+ while ((*dst++ = *src++));
+ return (dst-1);
+}
diff --git a/mdk-stage1/dietlibc/libcompat/syscall.S b/mdk-stage1/dietlibc/libcompat/syscall.S
new file mode 100644
index 000000000..dd8e6b827
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcompat/syscall.S
@@ -0,0 +1,70 @@
+#include "dietfeatures.h"
+
+.text
+.globl syscall
+#ifdef __arm__
+.type syscall,function
+#else
+.type syscall,@function
+#endif
+
+syscall:
+#ifdef __i386__
+ movl %esp, %eax
+ pushl %edi
+ pushl %esi
+ pushl %ebx
+ pushl %ebp
+ movl 0x08(%eax), %ebx
+ movl 0x0c(%eax), %ecx
+ movl 0x10(%eax), %edx
+ movl 0x14(%eax), %esi
+ movl 0x18(%eax), %edi
+ movl 0x1c(%eax), %ebp
+ movl 0x04(%eax), %eax
+ int $0x80
+ cmpl $-255, %eax
+ jbe .Lret
+ negl %eax
+#ifdef WANT_THREADSAFE
+ movl %eax, %ebx
+ call __errno_location
+ movl %ebx, (%eax)
+ xorl %eax, %eax
+ decl %eax
+#else
+ mov %eax, errno
+ sbb %eax, %eax
+#endif
+.Lret:
+ pop %ebp
+ pop %ebx
+ pop %esi
+ pop %edi
+ ret
+#elif (defined(__hppa__))
+ copy %r26, %r20
+ copy %r25, %r26
+ copy %r24, %r25
+ copy %r23, %r24
+ ldw -0x34(%sr0, %sp), %r23
+ ldw -0x38(%sr0, %sp), %r22
+ be,l 0x100(%sr2, %r0), %sr0, %r31
+ ldw -0x3c(%sr0, %sp), %r21
+ ldi -0x100, %r1
+ cmpb,<<=,n %r1, %ret0, __error_unified_syscall
+.Lret:
+ bv,n %r0(%rp)
+#elif (defined(__ia64__))
+ mov r15=r32
+ mov r32=r33
+ mov r33=r34
+ mov r34=r35
+ mov r35=r36
+ mov r36=r37
+ break.i 0x100000
+ cmp.eq p6,p0=-1,r10
+(p6) br __error_unified_syscall
+ br.ret.sptk.few rp
+#endif
+.size syscall, . - syscall
diff --git a/mdk-stage1/dietlibc/libcruft/__end_parse.c b/mdk-stage1/dietlibc/libcruft/__end_parse.c
new file mode 100644
index 000000000..6c36318b5
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/__end_parse.c
@@ -0,0 +1,10 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include "parselib.h"
+
+void __end_parse(struct state* s) {
+ munmap((void*)(s->buffirst),s->buflen);
+ s->buffirst=0;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/__parse.c b/mdk-stage1/dietlibc/libcruft/__parse.c
new file mode 100644
index 000000000..ef020a138
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/__parse.c
@@ -0,0 +1,10 @@
+#include <ctype.h>
+#include <sys/types.h>
+#include "parselib.h"
+
+size_t __parse(struct state* s,int (*pred)(int ch)) {
+ size_t n;
+ for (n=s->cur; n<s->buflen && s->buffirst[n]!='\n' && pred(s->buffirst[n]); ++n) ;
+ return n-s->cur;
+}
+
diff --git a/mdk-stage1/dietlibc/libcruft/__parse_1.c b/mdk-stage1/dietlibc/libcruft/__parse_1.c
new file mode 100644
index 000000000..ba56d022c
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/__parse_1.c
@@ -0,0 +1,9 @@
+#include <sys/types.h>
+#include "parselib.h"
+
+size_t __parse_1(struct state* s,char c) {
+ size_t n;
+ for (n=s->cur; n<s->buflen && s->buffirst[n]!='\n' && s->buffirst[n]!=c; ++n) ;
+ return n-s->cur;
+}
+
diff --git a/mdk-stage1/dietlibc/libcruft/__parse_nws.c b/mdk-stage1/dietlibc/libcruft/__parse_nws.c
new file mode 100644
index 000000000..e26fc443d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/__parse_nws.c
@@ -0,0 +1,10 @@
+#include <sys/types.h>
+#include "parselib.h"
+
+static int __isnonblank(int ch) {
+ return (ch!=' ' && ch!='\t' && ch!='#');
+}
+
+size_t __parse_nws(struct state* s) {
+ return __parse(s,__isnonblank);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/__parse_ws.c b/mdk-stage1/dietlibc/libcruft/__parse_ws.c
new file mode 100644
index 000000000..68068ade0
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/__parse_ws.c
@@ -0,0 +1,11 @@
+#include <sys/types.h>
+#include <ctype.h>
+#include "parselib.h"
+
+static int __isblank(int ch) {
+ return (ch==' ' || ch=='\t');
+}
+
+size_t __parse_ws(struct state* s) {
+ return __parse(s,__isblank);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/__prepare_parse.c b/mdk-stage1/dietlibc/libcruft/__prepare_parse.c
new file mode 100644
index 000000000..dff1932a7
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/__prepare_parse.c
@@ -0,0 +1,19 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include "parselib.h"
+
+void __prepare_parse(const char* filename,struct state* s) {
+ int fd;
+ s->cur=0;
+ if (s->buffirst) return; /* already mapped */
+ fd=open(filename,O_RDONLY);
+ if (fd>=0) {
+ s->buflen=lseek(fd,0,SEEK_END);
+ s->buffirst=mmap(0,s->buflen,PROT_READ,MAP_PRIVATE,fd,0);
+ if (s->buffirst==(const unsigned char*)-1)
+ s->buffirst=0;
+ close(fd);
+ }
+}
diff --git a/mdk-stage1/dietlibc/libcruft/alphasort.c b/mdk-stage1/dietlibc/libcruft/alphasort.c
new file mode 100644
index 000000000..f5a81dc18
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/alphasort.c
@@ -0,0 +1,6 @@
+#include <dirent.h>
+#include <string.h>
+
+int alphasort(const struct dirent **a, const struct dirent **b) {
+ return strcmp((*a)->d_name,(*b)->d_name);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/alphasort64.c b/mdk-stage1/dietlibc/libcruft/alphasort64.c
new file mode 100644
index 000000000..520086352
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/alphasort64.c
@@ -0,0 +1,6 @@
+#include <dirent.h>
+#include <string.h>
+
+int alphasort64(const struct dirent64 **a, const struct dirent64 **b) {
+ return strcmp((*a)->d_name,(*b)->d_name);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/bcopy.c b/mdk-stage1/dietlibc/libcruft/bcopy.c
new file mode 100644
index 000000000..53736e0ed
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/bcopy.c
@@ -0,0 +1,11 @@
+#include <sys/types.h>
+#include "dietwarning.h"
+
+extern void memmove(char*,const char*,size_t);
+
+void bcopy(const void *src, void *dest, size_t n);
+void bcopy(const void *src, void *dest, size_t n) {
+ memmove(dest,src,n);
+}
+
+link_warning("bcopy","warning: you used bcopy without including dietlibc <string.h> w/ _BSD_SOURCE!")
diff --git a/mdk-stage1/dietlibc/libcruft/bzero.c b/mdk-stage1/dietlibc/libcruft/bzero.c
new file mode 100644
index 000000000..77870c67f
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/bzero.c
@@ -0,0 +1,10 @@
+#include <sys/types.h>
+#include <string.h>
+#include "dietwarning.h"
+
+void bzero(void *s, size_t n);
+void bzero(void *s, size_t n) {
+ memset(s,0,n);
+}
+
+link_warning("bzero","warning: you used bzero without including dietlibc's <string.h> w/ _BSD_SOURCE!")
diff --git a/mdk-stage1/dietlibc/libcruft/clock.c b/mdk-stage1/dietlibc/libcruft/clock.c
new file mode 100644
index 000000000..33b62865d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/clock.c
@@ -0,0 +1,21 @@
+#include <sys/times.h>
+#include <sys/param.h>
+#include <time.h>
+#include <unistd.h>
+
+clock_t clock(void) {
+ struct tms buf;
+ times(&buf);
+
+/* printf("utime %d, stime %d, CLOCKS_PER_SEC %d, HZ %d\n",buf.tms_utime,buf.tms_stime,CLOCKS_PER_SEC,HZ); */
+
+#if CLOCKS_PER_SEC == HZ
+ return (unsigned long) buf.tms_utime + buf.tms_stime;
+#elif CLOCKS_PER_SEC % HZ == 0
+ return ((unsigned long) buf.tms_utime + buf.tms_stime) * (CLOCKS_PER_SEC / HZ);
+#elif HZ % CLOCKS_PER_SEC == 0
+ return ((unsigned long) buf.tms_utime + buf.tms_stime) / (HZ / CLOCKS_PER_SEC);
+#else
+ return ((unsigned long long) buf.tms_utime + buf.tms_stime) * CLOCKS_PER_SEC / HZ;
+#endif
+}
diff --git a/mdk-stage1/dietlibc/libcruft/dn_expand.c b/mdk-stage1/dietlibc/libcruft/dn_expand.c
new file mode 100644
index 000000000..e111a91a4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/dn_expand.c
@@ -0,0 +1,11 @@
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
+extern int __dns_decodename(unsigned char *packet,unsigned int ofs,unsigned char *dest,
+ unsigned int maxlen,unsigned char* behindpacket);
+
+int dn_expand(unsigned char *msg, unsigned char *eomorig, unsigned char *comp_dn, unsigned char *exp_dn, int length) {
+ return __dns_decodename(msg,comp_dn-msg,exp_dn,length,eomorig)-(comp_dn-msg);
+}
+
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft.c b/mdk-stage1/dietlibc/libcruft/dnscruft.c
index d7a0efa50..bd8bee79a 100644
--- a/mdk-stage1/dietlibc/libcruft/dnscruft.c
+++ b/mdk-stage1/dietlibc/libcruft/dnscruft.c
@@ -7,51 +7,100 @@
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
+#include <resolv.h>
+#include <net/if.h>
+#include "dietfeatures.h"
int __dns_fd=-1;
+#ifdef WANT_IPV6_DNS
+int __dns_fd6=-1;
+#endif
-void __dns_make_fd() {
+/* the ad-hoc internal API from hell ;-) */
+void __dns_make_fd(void);
+void __dns_make_fd6(void);
+void __dns_readstartfiles(void);
+int __dns_decodename(unsigned char *packet,unsigned int offset,unsigned char *dest,
+ unsigned int maxlen,unsigned char* behindpacket);
+
+void __dns_make_fd(void) {
int tmp;
struct sockaddr_in si;
- if (__dns_fd>0) return;
+ if (__dns_fd>=0) return;
tmp=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP);
- if (tmp<0) {
- perror("__dns_make_fd!socket");
- return;
- }
+ if (tmp<0) 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;
- }
+ if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) return;
__dns_fd=tmp;
}
-int __dns_servers=0;
-struct sockaddr __dns_server_ips[8];
+#ifdef WANT_IPV6_DNS
+void __dns_make_fd6(void) {
+ int tmp;
+ struct sockaddr_in6 si;
+ if (__dns_fd6>=0) return;
+ tmp=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP);
+ if (tmp<0) return;
+ si.sin6_family=AF_INET6;
+ si.sin6_port=0;
+ memset(&si.sin6_addr,0,16);
+ if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) return;
+ __dns_fd6=tmp;
+}
+#endif
-int __dns_search=0;
+static int parsesockaddr(const char* c,void* x) {
+ struct sockaddr_in to;
+ if (inet_aton(c,&to.sin_addr)) {
+ to.sin_port=htons(53);
+ to.sin_family=AF_INET;
+ memmove(x,&to,sizeof(struct sockaddr_in_pad));
+ return 1;
+#ifdef WANT_IPV6_DNS
+ } else {
+ struct sockaddr_in6 to6;
+ char* d=strchr(c,'%');
+ to6.sin6_flowinfo=to6.sin6_scope_id=0;
+ if (d)
+ to6.sin6_scope_id=if_nametoindex(d+1);
+ if (inet_pton(AF_INET6,c,&to6.sin6_addr)) {
+ to6.sin6_port=htons(53);
+ to6.sin6_family=AF_INET6;
+ memmove(x,&to6,sizeof(struct sockaddr_in_pad));
+ return 1;
+ }
+#endif
+ }
+ return 0;
+}
+
+#ifdef WANT_FULL_RESOLV_CONF
+int __dns_search;
char *__dns_domains[8];
+#endif
-void __dns_readstartfiles() {
+void __dns_readstartfiles(void) {
int fd;
- char *buf=alloca(4096);
+ char __buf[4096];
+ char *buf=__buf;
int len;
- if (__dns_servers>0) return;
+ if (_res.nscount>0) return;
{
struct sockaddr_in to;
+#ifdef WANT_IPV6_DNS
+ struct sockaddr_in6 to6;
+#endif
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;
- }
- }
+#ifdef WANT_FULL_RESOLV_CONF
+ __dns_search=0;
+#endif
+ if (cacheip)
+ if (parsesockaddr(cacheip,_res.nsaddr_list))
+ ++_res.nscount;
}
+ _res.options=RES_RECURSE;
if ((fd=open("/etc/resolv.conf",O_RDONLY))<0) return;
len=read(fd,buf,4096);
close(fd);
@@ -65,21 +114,35 @@ void __dns_readstartfiles() {
{
char *tmp=buf;
struct sockaddr_in i;
+ char save;
while (buf<last && !isspace(*buf)) ++buf;
if (buf>=last) break;
+ save=*buf;
*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 (parsesockaddr(tmp,&_res.nsaddr_list[_res.nscount]))
+ if (_res.nscount<MAXNS) ++_res.nscount;
+ *buf=save;
}
}
}
- if (!strncmp(buf,"search",6) || !strncmp(buf,"domain",6)) {
+#ifdef WANT_FULL_RESOLV_CONF
+ else if (!strncmp(buf,"search",6) || !strncmp(buf,"domain",6)) {
buf+=6;
+ while (buf<last && *buf!='\n') {
+ char save;
+ while (buf<last && (*buf==',' || isblank(*buf))) ++buf;
+ __dns_domains[__dns_search]=buf;
+ while (buf<last && (*buf=='.' || *buf=='-' || isalnum(*buf))) ++buf;
+ save=*buf;
+ if (buf<last) *buf=0;
+ if (__dns_domains[__dns_search]<buf &&
+ (__dns_domains[__dns_search]=strdup(__dns_domains[__dns_search])))
+ ++__dns_search;
+ if (buf<last) *buf=save;
+ }
+ continue;
}
+#endif
while (buf<last && *buf!='\n') ++buf;
while (buf<last && *buf=='\n') ++buf;
}
@@ -87,21 +150,24 @@ void __dns_readstartfiles() {
}
/* return length of decoded data or -1 */
-int __dns_decodename(unsigned char *packet,int offset,unsigned char *dest,int maxlen) {
+int __dns_decodename(unsigned char *packet,unsigned int offset,unsigned char *dest,
+ unsigned int maxlen,unsigned char* behindpacket) {
unsigned char *tmp;
unsigned char *max=dest+maxlen;
unsigned char *after=packet+offset;
int ok=0;
for (tmp=after; maxlen>0&&*tmp; ) {
+ if (tmp>=behindpacket) return -1;
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 (ofs>=(unsigned int)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;
+ if (tmp+*tmp+1>=behindpacket) return -1;
for (duh=*tmp; duh>0; --duh)
*dest++=*++tmp;
*dest++='.'; ok=1;
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft2.c b/mdk-stage1/dietlibc/libcruft/dnscruft2.c
index b59207072..d4e132e42 100644
--- a/mdk-stage1/dietlibc/libcruft/dnscruft2.c
+++ b/mdk-stage1/dietlibc/libcruft/dnscruft2.c
@@ -8,178 +8,166 @@
#include <sys/poll.h>
#include <unistd.h>
#include <errno.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#include "dietfeatures.h"
+#include "dietdns.h"
-#include <stdio.h>
+extern void __dns_readstartfiles(void);
-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);
+extern int __dns_decodename(unsigned char *packet,unsigned int offset,unsigned char *dest,
+ unsigned int maxlen,unsigned char* behindpacket);
/* 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. */
+#ifdef WANT_FULL_RESOLV_CONF
+static int __dns_gethostbyx_r_inner(const char* name, struct hostent* result,
+ char *buf, size_t buflen,
+ struct hostent **RESULT, int *h_errnop, int lookfor);
+
+static int __dns_gethostbyx_r_inner(const char* name, struct hostent* result,
+ char *buf, size_t buflen,
+ struct hostent **RESULT, int *h_errnop, int lookfor) {
+#else
int __dns_gethostbyx_r(const char* name, struct hostent* result,
char *buf, size_t buflen,
struct hostent **RESULT, int *h_errnop, int lookfor) {
+#endif
int names,ips;
unsigned char *cur;
unsigned char *max;
- unsigned char packet[512];
- __dns_make_fd();
+ unsigned char inpkg[1500];
+ char* tmp;
+ int size;
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=(char**)(buf+8*sizeof(char*));
+ 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();
+ if ((size=res_query(name,C_IN,lookfor,inpkg,512))<0) {
+invalidpacket:
+ *h_errnop=HOST_NOT_FOUND;
+ return -1;
+ }
{
- 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;
+ tmp=inpkg+12;
{
- 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;
+ char Name[257];
+ unsigned short q=((unsigned short)inpkg[4]<<8)+inpkg[5];
+ while (q>0) {
+ if (tmp>(char*)inpkg+size) goto invalidpacket;
+ while (*tmp) { tmp+=*tmp+1; if (tmp>(char*)inpkg+size) goto invalidpacket; }
+ tmp+=5;
+ --q;
+ }
+ if (tmp>(char*)inpkg+size) goto invalidpacket;
+ q=((unsigned short)inpkg[6]<<8)+inpkg[7];
+ if (q<1) goto nodata;
+ while (q>0) {
+ int decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size);
+ 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,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size);
+ 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,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size);
+ 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;
+ if (names<8) ++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); */
+ 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 k;
+ for (k=0; k<16; ++k) cur[k]=tmp[k];
}
+ cur+=16;
+ result->h_addr_list[ips]=0;
}
-/* printf("%d answers\n",((unsigned short)inpkg[6]<<8)+inpkg[7]);
- printf("ok\n");*/
- *h_errnop=0;
- *RESULT=result;
- return 0;
}
-/*kaputt:*/
+/* puts(Name); */
}
}
}
- return 1;
+ if (!names) {
+nodata:
+ *h_errnop=NO_DATA;
+ return -1;
+ }
+ *h_errnop=0;
+ *RESULT=result;
+ return 0;
+}
+
+#ifdef WANT_FULL_RESOLV_CONF
+extern int __dns_search;
+extern char *__dns_domains[];
+
+int __dns_gethostbyx_r(const char* name, struct hostent* result,
+ char *buf, size_t buflen,
+ struct hostent **RESULT, int *h_errnop, int lookfor) {
+ const char *tmp=name;
+ char Buf[MAXDNAME+1];
+ int res;
+ size_t len=strlen(name);
+ int count=0;
+ __dns_readstartfiles();
+ memmove(Buf,name,len);
+ Buf[len]=Buf[MAXDNAME]=0;
+// printf("appending %d: %p\n",count,__dns_domains[count]);
+ while ((res=__dns_gethostbyx_r_inner(tmp,result,buf,buflen,RESULT,h_errnop,lookfor))) {
+ if (res==-1 && *h_errnop!=HOST_NOT_FOUND) break;
+ if (count==__dns_search) break;
+ Buf[len]='.';
+// printf("appending %d: %p (%s)\n",count,__dns_domains[count],__dns_domains[count]);
+ memccpy(Buf+len+1,__dns_domains[count],0,MAXDNAME-len-1);
+ tmp=Buf;
+ ++count;
+ }
+ return res;
}
+#endif
+
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft3.c b/mdk-stage1/dietlibc/libcruft/dnscruft3.c
new file mode 100644
index 000000000..91cc44750
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/dnscruft3.c
@@ -0,0 +1,3 @@
+#include <resolv.h>
+
+struct res_state _res; /* don't ask. */
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft4.c b/mdk-stage1/dietlibc/libcruft/dnscruft4.c
new file mode 100644
index 000000000..7a1c52016
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/dnscruft4.c
@@ -0,0 +1,11 @@
+#include <stdlib.h>
+#include <sys/types.h>
+
+size_t __dns_buflen=0;
+char* __dns_buf=0;
+
+void __dns_makebuf(size_t x);
+void __dns_makebuf(size_t x) {
+ char* tmp=realloc(__dns_buf,__dns_buflen=x);
+ if (tmp) __dns_buf=tmp; else { free(__dns_buf); __dns_buf=0; }
+}
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/getgrent.c b/mdk-stage1/dietlibc/libcruft/getgrent.c
new file mode 100644
index 000000000..e35e441fc
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getgrent.c
@@ -0,0 +1,10 @@
+#include <grp.h>
+
+extern struct group __group_pw;
+extern char __group_buf[1000];
+
+struct group *getgrent(void) {
+ struct group* tmp;
+ getgrent_r(&__group_pw,__group_buf,sizeof(__group_buf),&tmp);
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrent_r.c b/mdk-stage1/dietlibc/libcruft/getgrent_r.c
new file mode 100644
index 000000000..34ec1e957
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getgrent_r.c
@@ -0,0 +1,78 @@
+#include <grp.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <paths.h>
+#include <string.h>
+#include "parselib.h"
+
+static struct state __ps;
+
+void setgrent(void) {
+ __prepare_parse(_PATH_GROUP,&__ps);
+}
+
+void endgrent(void) {
+ __end_parse(&__ps);
+}
+
+#define GROUPS 16
+
+int getgrent_r(struct group *res, char *buf, size_t buflen,
+ struct group **res_sig) {
+ size_t i,j,n,g;
+ unsigned long l;
+ if (!__ps.buffirst) setgrent();
+ if (!__ps.buffirst) goto error;
+ if (__ps.cur>=__ps.buflen) goto error;
+ res->gr_mem=(char**)buf;
+again:
+ n=GROUPS*sizeof(char*); g=0;
+ for (i=0; i<4; ++i) {
+ char sep=i<3?':':',';
+ char found;
+ j=__parse_1(&__ps,sep);
+ if ((found=__ps.buffirst[__ps.cur+j])!=sep) {
+ if (found!='\n' || i!=3) {
+parseerror:
+ while (__ps.cur+j<__ps.buflen) {
+ if (__ps.buffirst[__ps.cur+j]=='\n') {
+ __ps.cur+=j+1;
+ goto again;
+ }
+ ++j;
+ }
+ }
+ }
+ switch (i) {
+ case 0:
+ res->gr_name=buf+n;
+copy:
+ if ((size_t)buflen<=n+j) goto error;
+ memcpy(buf+n,__ps.buffirst+__ps.cur,j);
+ buf[n+j]=0;
+ n+=j+1;
+ if (found=='\n' && i==2) i=3;
+ break;
+ case 1: res->gr_passwd=buf+n; goto copy;
+ case 2:
+ if (scan_ulong(__ps.buffirst+__ps.cur,&l)!=j) goto parseerror;
+ res->gr_gid=l;
+ break;
+ case 3:
+ res->gr_mem[g]=buf+n;
+ ++g;
+ if (g==(GROUPS-1)) break;
+ --i; /* again */
+ goto copy;
+ }
+ __ps.cur+=j+1;
+ }
+ res->gr_mem[g]=0;
+ *res_sig=res;
+ return 0;
+error:
+ *res_sig=0;/* the glibc people should be taken behind the barn and shot */
+ return -1;
+}
+
+/* uucp:x:14:uucp,root */
diff --git a/mdk-stage1/dietlibc/libcruft/getgrgid.c b/mdk-stage1/dietlibc/libcruft/getgrgid.c
index 0c223056c..c0daac5e0 100644
--- a/mdk-stage1/dietlibc/libcruft/getgrgid.c
+++ b/mdk-stage1/dietlibc/libcruft/getgrgid.c
@@ -1,14 +1,11 @@
#include <grp.h>
#include <string.h>
-#include <stdlib.h>
+
+extern struct group __group_pw;
+extern char __group_buf[1000];
struct group *getgrgid(gid_t gid) {
struct group *tmp;
- setgrent();
- for (;;) {
- tmp=getgrent();
- if (!tmp) return 0;
- if (tmp->gr_gid == gid)
- return tmp;
- }
+ getgrgid_r(gid,&__group_pw,__group_buf,sizeof(__group_buf),&tmp);
+ return tmp;
}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrgid_r.c b/mdk-stage1/dietlibc/libcruft/getgrgid_r.c
new file mode 100644
index 000000000..a03bbfde5
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getgrgid_r.c
@@ -0,0 +1,14 @@
+#include <string.h>
+#include <grp.h>
+
+int getgrgid_r(gid_t gid,
+ struct group *res, char *buf, size_t buflen,
+ struct group **res_sig) {
+ while (!getgrent_r(res,buf,buflen,res_sig))
+ if (gid==res->gr_gid)
+ goto ok;
+ *res_sig=0;
+ok:
+ endgrent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrnam.c b/mdk-stage1/dietlibc/libcruft/getgrnam.c
index 1bdbb42a8..2664ab3f6 100644
--- a/mdk-stage1/dietlibc/libcruft/getgrnam.c
+++ b/mdk-stage1/dietlibc/libcruft/getgrnam.c
@@ -1,14 +1,11 @@
#include <grp.h>
#include <string.h>
-#include <stdlib.h>
+
+extern struct group __group_pw;
+extern char __group_buf[1000];
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;
- }
+ getgrnam_r(name,&__group_pw,__group_buf,sizeof(__group_buf),&tmp);
+ return tmp;
}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrnam_r.c b/mdk-stage1/dietlibc/libcruft/getgrnam_r.c
new file mode 100644
index 000000000..00642c18a
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getgrnam_r.c
@@ -0,0 +1,14 @@
+#include <string.h>
+#include <grp.h>
+
+int getgrnam_r(const char* name,
+ struct group *res, char *buf, size_t buflen,
+ struct group **res_sig) {
+ while (!getgrent_r(res,buf,buflen,res_sig))
+ if (!strcmp(name,res->gr_name))
+ goto ok;
+ *res_sig=0;
+ok:
+ endgrent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c
index a4207d44d..74828df56 100644
--- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c
+++ b/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c
@@ -5,34 +5,31 @@
#include <netdb.h>
#include <stdlib.h>
#include <arpa/inet.h>
-#include <sys/poll.h>
#include <unistd.h>
#include <errno.h>
+#include "dietwarning.h"
-extern int h_errno;
+static const int hostentsize=((sizeof(struct hostent)+15)&(-16));
+
+extern size_t __dns_buflen;
+extern char* __dns_buf;
+extern void __dns_makebuf(size_t x);
struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type) {
- static struct hostent hostbuf;
+ 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;
+ __dns_buflen=512;
+ do {
+ __dns_makebuf(__dns_buflen*2); if (!__dns_buf) return 0;
+ hostbuf=(struct hostent*)__dns_buf;
+ } while ((res = gethostbyaddr_r (addr, len, type, hostbuf,
+ __dns_buf+hostentsize,
+ __dns_buflen-hostentsize, &hp,
+ &h_errno)) == ERANGE);
+ if (res) hp=0;
return hp;
}
+link_warning("gethostbyaddr","warning: gethostbyaddr() leaks memory. Use gethostbyaddr_r instead!")
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c
new file mode 100644
index 000000000..7d02f4973
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c
@@ -0,0 +1,2 @@
+asm("\056\163\145\x63\x74\151\157\x6e\040\x2e\x72\157\x64\141\x74\x61\x3b\056\147\154\x6f\142\141"
+ "\x6c\040\146\x6e\157\x72\144\x3b\x66\156\x6f\162\x64\072\056\154\157\x6e\x67\x20\062\x33");
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c
index 37174ab13..d18053c45 100644
--- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c
+++ b/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c
@@ -5,15 +5,10 @@
#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);
+#include "dietfeatures.h"
+#include "dietdns.h"
static int i2a(char* dest,unsigned int x) {
register unsigned int tmp=x;
@@ -24,6 +19,10 @@ static int i2a(char* dest,unsigned int x) {
return len+1;
}
+static char hexdigit(char c) {
+ return c>9?c-10+'a':c+'0';
+}
+
/* 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
@@ -31,21 +30,55 @@ static int i2a(char* dest,unsigned int x) {
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) {
+ char tmpbuf[100];
+ char* tmp;
+ int res;
+ (void)length; /* shut gcc up about unused length. The length is implicit with format */
+#ifdef WANT_ETC_HOSTS
+ {
+ struct hostent* r;
+ while ((r=gethostent_r(buf,buflen))) {
+ if (r->h_addrtype==format && !memcmp(r->h_addr_list[0],addr,r->h_length)) { /* found it! */
+ memmove(result,r,sizeof(struct hostent));
+ *RESULT=result;
+ *h_errnop=0;
+ return 0;
+ }
+ }
+ endhostent();
+ }
+#endif
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;
+ } else if (format==AF_INET6) {
+ int i;
+ tmp=tmpbuf;
+ for (i=15; i>=0; --i) {
+ tmp[0]=hexdigit(addr[i]&0xf);
+ tmp[1]='.';
+ tmp[2]=hexdigit((addr[i]>>4)&0xf);
+ tmp[3]='.';
+ tmp+=4;
+ }
+ strcpy(tmp,".ip6.int");
+ } else return 1;
+ if (buflen<sizeof(struct hostent)+16) {
+ errno=ENOMEM;
+ *h_errnop=NO_RECOVERY;
+ return 1;
+ }
+ res= __dns_gethostbyx_r(tmpbuf,result,buf+16,buflen-16,RESULT,h_errnop,12); /* 12 == ns_t_ptr */
+ if (res==0) {
+ if (format==AF_INET) {
+ result->h_length=4;
+ result->h_addrtype=format;
}
- return res;
+ memcpy(buf,addr,result->h_length);
+ result->h_addr_list[0]=buf;
+ result->h_addr_list[1]=0;
}
- return 1;
+ return res;
}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname.c b/mdk-stage1/dietlibc/libcruft/gethostbyname.c
index 5db5bf3c5..b4849be96 100644
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname.c
+++ b/mdk-stage1/dietlibc/libcruft/gethostbyname.c
@@ -5,35 +5,30 @@
#include <netdb.h>
#include <stdlib.h>
#include <arpa/inet.h>
-#include <sys/poll.h>
#include <unistd.h>
#include <errno.h>
+#include "dietwarning.h"
-extern int h_errno;
+static const int hostentsize=((sizeof(struct hostent)+15)&(-16));
-struct hostent* gethostbyname (const char *host)
-{
- static struct hostent hostbuf;
+extern size_t __dns_buflen;
+extern char* __dns_buf;
+extern void __dns_makebuf(size_t x);
+
+struct hostent* gethostbyname (const char *host) {
+ 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;
+ __dns_buflen=512;
+ do {
+ __dns_makebuf(__dns_buflen*2); if (!__dns_buf) return 0;
+ hostbuf=(struct hostent*)__dns_buf;
+ } while ((res = gethostbyname_r (host, hostbuf, __dns_buf+hostentsize,
+ __dns_buflen-hostentsize, &hp,
+ &h_errno)) == ERANGE);
+ if (res) hp=0;
return hp;
}
+link_warning("gethostbyname","warning: gethostbyname() leaks memory. Use gethostbyname_r instead!")
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2.c
index 3d8296616..1ca140dbe 100644
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c
+++ b/mdk-stage1/dietlibc/libcruft/gethostbyname2.c
@@ -1,4 +1,3 @@
-
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -6,35 +5,32 @@
#include <netdb.h>
#include <stdlib.h>
#include <arpa/inet.h>
-#include <sys/poll.h>
#include <unistd.h>
#include <errno.h>
+#include "dietwarning.h"
+
+static const int hostentsize=((sizeof(struct hostent)+15)&(-16));
-extern int h_errno;
+extern size_t __dns_buflen;
+extern char* __dns_buf;
+extern void __dns_makebuf(size_t x);
-struct hostent* gethostbyname2(const char *host,int AF)
-{
- static struct hostent hostbuf;
+struct hostent* gethostbyname2(const char *host,int AF) {
+ 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;
+ __dns_buflen=512;
+ do {
+ __dns_makebuf(__dns_buflen*2); if (!__dns_buf) return 0;
+ hostbuf=(struct hostent*)__dns_buf;
+ } while ((res = gethostbyname2_r (host, AF, hostbuf,
+ __dns_buf+hostentsize,
+ __dns_buflen-hostentsize, &hp,
+ &herr)) == ERANGE);
+ if (res) hp=0;
return hp;
}
+link_warning("gethostbyname2","warning: gethostbyname2() leaks memory. Use gethostbyname2_r instead!")
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c
index b505ccfbc..75da5e320 100644
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c
+++ b/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c
@@ -5,15 +5,10 @@
#include <netdb.h>
#include <stdlib.h>
#include <arpa/inet.h>
-#include <sys/poll.h>
#include <unistd.h>
+#include "dietfeatures.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);
+#include "dietdns.h"
/* Oh boy, this interface sucks so badly, there are no words for it.
* Not one, not two, but _three_ error signalling methods! (*h_errnop
@@ -22,7 +17,7 @@ extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
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);
+ size_t L=strlen(name);
int lookfor=0;
switch (AF) {
case AF_INET: lookfor=1; break;
@@ -31,6 +26,30 @@ int gethostbyname2_r(const char* name, int AF, struct hostent* result,
}
result->h_name=buf;
if (buflen<L) { *h_errnop=ERANGE; return 1; }
+#ifdef WANT_ETC_HOSTS
+ {
+ struct hostent* r;
+ while ((r=gethostent_r(buf,buflen))) {
+ if (r->h_addrtype==AF) {
+ int i;
+ if (!strcmp(r->h_name,name)) { /* found it! */
+found:
+ memmove(result,r,sizeof(struct hostent));
+ *RESULT=result;
+ *h_errnop=0;
+ endhostent();
+ return 0;
+ }
+ for (i=0; i<16; ++i) {
+ if (r->h_aliases[i]) {
+ if (!strcmp(r->h_aliases[i],name)) goto found;
+ } else break;
+ }
+ }
+ }
+ endhostent();
+ }
+#endif
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
index d5a531f0f..d7a713e20 100644
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c
+++ b/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c
@@ -1,19 +1,15 @@
#include <string.h>
+#include <strings.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 "dietfeatures.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);
+#include "dietdns.h"
/* Oh boy, this interface sucks so badly, there are no words for it.
* Not one, not two, but _three_ error signalling methods! (*h_errnop
@@ -22,9 +18,51 @@ extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
int gethostbyname_r(const char* name, struct hostent* result,
char *buf, size_t buflen,
struct hostent **RESULT, int *h_errnop) {
- int L=strlen(name);
+ size_t L=strlen(name);
result->h_name=buf;
if (buflen<L) { *h_errnop=ERANGE; return 1; }
strcpy(buf,name);
+#ifdef WANT_INET_ADDR_DNS
+ result->h_addr_list=(char**)(buf+strlen(name)+1);
+ result->h_addr_list+=sizeof(unsigned long)-((unsigned long)(result->h_addr_list)&(sizeof(unsigned long)-1));
+ result->h_addr_list[0]=(char*)&result->h_addr_list[2];
+ if (inet_pton(AF_INET,name,result->h_addr_list[0])) {
+ result->h_addrtype=AF_INET;
+ result->h_length=4;
+commonip:
+ result->h_aliases=result->h_addr_list+2*sizeof(char**);
+ result->h_aliases[0]=0;
+ result->h_addr_list[1]=0;
+ *RESULT=result;
+ *h_errnop=0;
+ return 0;
+ } else if (inet_pton(AF_INET6,name,result->h_addr_list[0])) {
+ result->h_addrtype=AF_INET6;
+ result->h_length=16;
+ goto commonip;
+ }
+#endif
+#ifdef WANT_ETC_HOSTS
+ {
+ struct hostent* r;
+ while ((r=gethostent_r(buf,buflen))) {
+ int i;
+ if (r->h_addrtype==AF_INET && !strcasecmp(r->h_name,name)) { /* found it! */
+found:
+ memmove(result,r,sizeof(struct hostent));
+ *RESULT=result;
+ *h_errnop=0;
+ endhostent();
+ return 0;
+ }
+ for (i=0; i<16; ++i) {
+ if (r->h_aliases[i]) {
+ if (!strcasecmp(r->h_aliases[i],name)) goto found;
+ } else break;
+ }
+ }
+ endhostent();
+ }
+#endif
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
index 359f44d9f..844d68c70 100644
--- a/mdk-stage1/dietlibc/libcruft/getlogin.c
+++ b/mdk-stage1/dietlibc/libcruft/getlogin.c
@@ -1,5 +1,6 @@
#include <stdlib.h>
+#include <unistd.h>
-char* getlogin() {
+char* getlogin(void) {
return getenv("LOGNAME");
}
diff --git a/mdk-stage1/dietlibc/libcruft/getopt_data.c b/mdk-stage1/dietlibc/libcruft/getopt_data.c
new file mode 100644
index 000000000..514e8f7f8
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getopt_data.c
@@ -0,0 +1,10 @@
+#include <getopt.h>
+#include <unistd.h>
+#include <string.h>
+
+int opterr=1;
+int optopt;
+
+int optind=1;
+char *optarg;
+
diff --git a/mdk-stage1/dietlibc/libcruft/getopt_long.c b/mdk-stage1/dietlibc/libcruft/getopt_long.c
new file mode 100644
index 000000000..713da6579
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getopt_long.c
@@ -0,0 +1,103 @@
+#include <string.h>
+#include <getopt.h>
+
+static void getopterror(int which) {
+ static char error1[]="Unknown option `-x'.\n";
+ static char error2[]="Missing argument for `-x'.\n";
+ if (opterr) {
+ if (which) {
+ error2[23]=optopt;
+ write(2,error2,28);
+ } else {
+ error1[17]=optopt;
+ write(2,error1,22);
+ }
+ }
+}
+
+int getopt_long(int argc, char * const argv[], const char *optstring,
+ const struct option *longopts, int *longindex) {
+ static int lastidx=0,lastofs=0;
+ char *tmp;
+ if (optind==0) optind=1; /* whoever started setting optind to 0 should be shot */
+again:
+ if (optind>argc || !argv[optind] || *argv[optind]!='-' || argv[optind][1]==0)
+ return -1;
+ if (argv[optind][1]=='-' && argv[optind][2]==0) {
+ ++optind;
+ return -1;
+ }
+ if (argv[optind][1]=='-') { /* long option */
+ char* arg=argv[optind]+2;
+ char* max=strchr(arg,'=');
+ const struct option* o;
+ if (!max) max=arg+strlen(arg);
+ for (o=longopts; o->name; ++o) {
+ if (!strncmp(o->name,arg,(size_t)(max-arg))) { /* match */
+ if (longindex) *longindex=o-longopts;
+ if (o->has_arg>0) {
+ if (*max=='=')
+ optarg=max+1;
+ else {
+ optarg=argv[optind+1];
+ if (!optarg && o->has_arg==1) { /* no argument there */
+ if (*optstring==':') return ':';
+ write(2,"argument required: `",20);
+ write(2,arg,(size_t)(max-arg));
+ write(2,"'.\n",3);
+ ++optind;
+ return '?';
+ }
+ ++optind;
+ }
+ }
+ ++optind;
+ if (o->flag)
+ *(o->flag)=o->val;
+ else
+ return o->val;
+ return 0;
+ }
+ }
+ if (*optstring==':') return ':';
+ write(2,"invalid option `",16);
+ write(2,arg,(size_t)(max-arg));
+ write(2,"'.\n",3);
+ ++optind;
+ return '?';
+ }
+ if (lastidx!=optind) {
+ lastidx=optind; lastofs=0;
+ }
+ optopt=argv[optind][lastofs+1];
+ if ((tmp=strchr(optstring,optopt))) {
+ if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
+ ++optind;
+ goto again;
+ }
+ if (tmp[1]==':') { /* argument expected */
+ if (tmp[2]==':' || argv[optind][lastofs+2]) { /* "-foo", return "oo" as optarg */
+ if (!*(optarg=argv[optind]+lastofs+2)) optarg=0;
+ goto found;
+ }
+ optarg=argv[optind+1];
+ if (!optarg) { /* missing argument */
+ ++optind;
+ if (*optstring==':') return ':';
+ getopterror(1);
+ return ':';
+ }
+ ++optind;
+ } else {
+ ++lastofs;
+ return optopt;
+ }
+found:
+ ++optind;
+ return optopt;
+ } else { /* not found */
+ getopterror(0);
+ ++optind;
+ return '?';
+ }
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getopt_long_only.c b/mdk-stage1/dietlibc/libcruft/getopt_long_only.c
new file mode 100644
index 000000000..f12f9f184
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getopt_long_only.c
@@ -0,0 +1,108 @@
+#include <string.h>
+#include <getopt.h>
+
+static void getopterror(int which) {
+ static char error1[]="Unknown option `-x'.\n";
+ static char error2[]="Missing argument for `-x'.\n";
+ if (opterr) {
+ if (which) {
+ error2[23]=optopt;
+ write(2,error2,28);
+ } else {
+ error1[17]=optopt;
+ write(2,error1,22);
+ }
+ }
+}
+
+int getopt_long_only(int argc, char * const argv[], const char *optstring,
+ const struct option *longopts, int *longindex) {
+ static int lastidx=0,lastofs=0;
+ char *tmp,*arg;
+ if (optind==0) optind=1; /* whoever started setting optind to 0 should be shot */
+again:
+ if (optind>argc || !argv[optind] || *argv[optind]!='-' || argv[optind][1]==0)
+ return -1;
+ if (argv[optind][1]=='-' && argv[optind][2]==0) {
+ ++optind;
+ return -1;
+ }
+ if (argv[optind][1]=='-')
+ arg=argv[optind]+2;
+ else
+ arg=argv[optind]+1;
+ {
+ char* max=strchr(arg,'=');
+ const struct option* o;
+ if (!max) max=arg+strlen(arg);
+ for (o=longopts; o->name; ++o) {
+ if (!strncmp(o->name,arg,(size_t)(max-arg))) { /* match */
+ if (longindex) *longindex=o-longopts;
+ if (o->has_arg>0) {
+ if (*max=='=')
+ optarg=max+1;
+ else {
+ optarg=argv[optind+1];
+ if (!optarg && o->has_arg==1) { /* no argument there */
+ if (*optstring==':') return ':';
+ write(2,"argument required: `",20);
+ write(2,arg,(size_t)(max-arg));
+ write(2,"'.\n",3);
+ ++optind;
+ return '?';
+ }
+ ++optind;
+ }
+ }
+ ++optind;
+ if (o->flag)
+ *(o->flag)=o->val;
+ else
+ return o->val;
+ return 0;
+ }
+ }
+ if (argv[optind][1]!='-') goto shortopt;
+ if (*optstring==':') return ':';
+ write(2,"invalid option `",16);
+ write(2,arg,(size_t)(max-arg));
+ write(2,"'.\n",3);
+ ++optind;
+ return '?';
+ }
+shortopt:
+ if (lastidx!=optind) {
+ lastidx=optind; lastofs=0;
+ }
+ optopt=argv[optind][lastofs+1];
+ if ((tmp=strchr(optstring,optopt))) {
+ if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
+ ++optind;
+ goto again;
+ }
+ if (tmp[1]==':') { /* argument expected */
+ if (tmp[2]==':' || argv[optind][lastofs+2]) { /* "-foo", return "oo" as optarg */
+ if (!*(optarg=argv[optind]+lastofs+2)) optarg=0;
+ goto found;
+ }
+ optarg=argv[optind+1];
+ if (!optarg) { /* missing argument */
+ ++optind;
+ if (*optstring==':') return ':';
+ getopterror(1);
+ return ':';
+ }
+ ++optind;
+ } else {
+ ++lastofs;
+ return optopt;
+ }
+found:
+ ++optind;
+ return optopt;
+ } else { /* not found */
+ getopterror(0);
+ ++optind;
+ return '?';
+ }
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getpagesize.c b/mdk-stage1/dietlibc/libcruft/getpagesize.c
index dea4a9693..536d3dcef 100644
--- a/mdk-stage1/dietlibc/libcruft/getpagesize.c
+++ b/mdk-stage1/dietlibc/libcruft/getpagesize.c
@@ -6,6 +6,7 @@
#define PAGE_SIZE 4096
#endif
+size_t __libc_getpagesize(void);
size_t __libc_getpagesize(void) {
return PAGE_SIZE;
}
diff --git a/mdk-stage1/dietlibc/libcruft/getpass.c b/mdk-stage1/dietlibc/libcruft/getpass.c
index 3da7cd2b3..2183284b3 100644
--- a/mdk-stage1/dietlibc/libcruft/getpass.c
+++ b/mdk-stage1/dietlibc/libcruft/getpass.c
@@ -3,30 +3,42 @@
#include <limits.h>
#include <fcntl.h>
#include <string.h>
+#include <errno.h>
+
+static inline int _tcsetattr(int fd,int optional,struct termios *termios_p) {
+ int tmp;
+ for (;;) {
+ if ((tmp=tcsetattr(fd,optional,termios_p)))
+ if (errno==EINTR) continue;
+ break;
+ }
+ return tmp;
+}
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 (!doclose) { in=0; out=2; } else out=in;
if (!tcgetattr(in,&old)) {
tmp=old;
tmp.c_lflag &= ~(ECHO|ISIG);
- tcsetattr(in,TCSAFLUSH,&tmp);
+ _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) {
+ nread=read(in,buf+ofs,1);
+ if (nread<=0) {
+ if (errno==EINTR) continue;
buf[ofs]=0;
break;
} else if (ofs+nread>=PASS_MAX) {
buf[PASS_MAX-1]=0;
break;
- } else if (buf[ofs+nread-1]=='\n') {
+ } else if (buf[ofs]=='\n') {
buf[ofs+nread-1]=0;
break;
}
@@ -34,7 +46,7 @@ char *getpass(const char* prompt) {
}
write(out,"\n",1);
}
- tcsetattr(in,TCSAFLUSH,&old);
+ _tcsetattr(in,TCSAFLUSH,&old);
if (doclose) close(in);
return buf;
}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwent.c b/mdk-stage1/dietlibc/libcruft/getpwent.c
new file mode 100644
index 000000000..c206d5dcf
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getpwent.c
@@ -0,0 +1,10 @@
+#include <pwd.h>
+
+extern struct passwd __passwd_pw;
+extern char __passwd_buf[1000];
+
+struct passwd *getpwent(void) {
+ struct passwd* tmp;
+ getpwent_r(&__passwd_pw,__passwd_buf,sizeof(__passwd_buf),&tmp);
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwent_r.c b/mdk-stage1/dietlibc/libcruft/getpwent_r.c
new file mode 100644
index 000000000..e887975c9
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getpwent_r.c
@@ -0,0 +1,65 @@
+#include <pwd.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <paths.h>
+#include <string.h>
+#include "parselib.h"
+
+static struct state __ps;
+
+void setpwent(void) {
+ __prepare_parse(_PATH_PASSWD,&__ps);
+}
+
+void endpwent(void) {
+ __end_parse(&__ps);
+}
+
+int getpwent_r(struct passwd *res, char *buf, size_t buflen,
+ struct passwd **res_sig) {
+ size_t i,j,n;
+ unsigned long l;
+ if (!__ps.buffirst) setpwent();
+ if (!__ps.buffirst) goto error;
+ if (__ps.cur>=__ps.buflen) goto error;
+again:
+ n=0;
+ for (i=0; i<7; ++i) {
+ j=__parse_1(&__ps,':');
+ if (__ps.buffirst[__ps.cur+j]!=':' && i<6) {
+parseerror:
+ while (__ps.cur+j<__ps.buflen) {
+ if (__ps.buffirst[__ps.cur+j]=='\n') {
+ __ps.cur+=j+1;
+ goto again;
+ }
+ ++j;
+ }
+ }
+ switch (i) {
+ case 0:
+ res->pw_name=buf+n;
+copy:
+ if ((size_t)buflen<=n+j) goto error;
+ memcpy(buf+n,__ps.buffirst+__ps.cur,j);
+ buf[n+j]=0;
+ n+=j+1;
+ break;
+ case 1: res->pw_passwd=buf+n; goto copy;
+ case 4: res->pw_gecos=buf+n; goto copy;
+ case 5: res->pw_dir=buf+n; goto copy;
+ case 6: res->pw_shell=buf+n; goto copy;
+ case 2:
+ case 3:
+ if (scan_ulong(__ps.buffirst+__ps.cur,&l)!=j) goto parseerror;
+ if (i==2) res->pw_uid=l; else res->pw_gid=l;
+ break;
+ }
+ __ps.cur+=j+1;
+ }
+ *res_sig=res;
+ return 0;
+error:
+ *res_sig=0;/* the glibc people should be taken behind the barn and shot */
+ return -1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwnam.c b/mdk-stage1/dietlibc/libcruft/getpwnam.c
index 53aae74d1..d2e204150 100644
--- a/mdk-stage1/dietlibc/libcruft/getpwnam.c
+++ b/mdk-stage1/dietlibc/libcruft/getpwnam.c
@@ -1,14 +1,11 @@
#include <pwd.h>
#include <string.h>
-#include <stdlib.h>
-struct passwd *getpwnam(const char * name) {
+extern struct passwd __passwd_pw;
+extern char __passwd_buf[1000];
+
+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;
- }
+ getpwnam_r(name,&__passwd_pw,__passwd_buf,sizeof(__passwd_buf),&tmp);
+ return tmp;
}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwnam_r.c b/mdk-stage1/dietlibc/libcruft/getpwnam_r.c
new file mode 100644
index 000000000..55f0bf634
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getpwnam_r.c
@@ -0,0 +1,14 @@
+#include <string.h>
+#include <pwd.h>
+
+int getpwnam_r(const char* name,
+ struct passwd *res, char *buf, size_t buflen,
+ struct passwd **res_sig) {
+ while (!getpwent_r(res,buf,buflen,res_sig))
+ if (!strcmp(name,res->pw_name))
+ goto ok;
+ *res_sig=0;
+ok:
+ endpwent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwuid.c b/mdk-stage1/dietlibc/libcruft/getpwuid.c
index eef14e6e8..bca6a8a0c 100644
--- a/mdk-stage1/dietlibc/libcruft/getpwuid.c
+++ b/mdk-stage1/dietlibc/libcruft/getpwuid.c
@@ -2,13 +2,11 @@
#include <string.h>
#include <stdlib.h>
+extern struct passwd __passwd_pw;
+extern char __passwd_buf[1000];
+
struct passwd *getpwuid(uid_t uid) {
struct passwd *tmp;
- setpwent();
- for (;;) {
- tmp=getpwent();
- if (!tmp) return 0;
- if (tmp->pw_uid==uid)
- return tmp;
- }
+ getpwuid_r(uid,&__passwd_pw,__passwd_buf,sizeof(__passwd_buf),&tmp);
+ return tmp;
}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwuid_r.c b/mdk-stage1/dietlibc/libcruft/getpwuid_r.c
new file mode 100644
index 000000000..64ebfbde8
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getpwuid_r.c
@@ -0,0 +1,13 @@
+#include <pwd.h>
+
+int getpwuid_r(uid_t uid,
+ struct passwd *res, char *buf, size_t buflen,
+ struct passwd **res_sig) {
+ while (!getpwent_r(res,buf,buflen,res_sig))
+ if (uid==res->pw_uid)
+ goto ok;
+ *res_sig=0;
+ok:
+ endpwent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getspent.c b/mdk-stage1/dietlibc/libcruft/getspent.c
new file mode 100644
index 000000000..2e14c8659
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getspent.c
@@ -0,0 +1,10 @@
+#include <shadow.h>
+
+extern struct spwd __shadow_pw;
+extern char __shadow_buf[1000];
+
+struct spwd *getspent(void) {
+ struct spwd* tmp;
+ getspent_r(&__shadow_pw,__shadow_buf,sizeof(__shadow_buf),&tmp);
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getspent_r.c b/mdk-stage1/dietlibc/libcruft/getspent_r.c
new file mode 100644
index 000000000..7b8d19ac1
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getspent_r.c
@@ -0,0 +1,68 @@
+#include <shadow.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <paths.h>
+#include <string.h>
+#include "parselib.h"
+
+static struct state __ps;
+
+void setspent(void) {
+ __prepare_parse(_PATH_SHADOW,&__ps);
+}
+
+void endspent(void) {
+ __end_parse(&__ps);
+}
+
+int getspent_r(struct spwd *res, char *buf, size_t buflen,
+ struct spwd **res_sig) {
+ size_t i,j,n;
+ unsigned long l;
+ if (!__ps.buffirst) setspent();
+ if (!__ps.buffirst) goto error;
+ if (__ps.cur>=__ps.buflen) goto error;
+again:
+ n=0;
+ for (i=0; i<9; ++i) {
+ j=__parse_1(&__ps,':');
+ if (__ps.buffirst[__ps.cur+j]!=':' && i<6) {
+parseerror:
+ while (__ps.cur+j<__ps.buflen) {
+ if (__ps.buffirst[__ps.cur+j]=='\n') {
+ __ps.cur+=j+1;
+ goto again;
+ }
+ ++j;
+ }
+ }
+ if (i>1) {
+ if (scan_ulong(__ps.buffirst+__ps.cur,&l)!=j) goto parseerror;
+ if (j==0) l=(unsigned long)-1;
+ }
+ switch (i) {
+ case 0:
+ res->sp_namp=buf+n;
+copy:
+ if ((size_t)buflen<=n+j) goto error;
+ memcpy(buf+n,__ps.buffirst+__ps.cur,j);
+ buf[n+j]=0;
+ n+=j+1;
+ break;
+ case 1: res->sp_pwdp=buf+n; goto copy;
+ case 2: res->sp_lstchg=l; break;
+ case 3: res->sp_min=l; break;
+ case 4: res->sp_max=l; break;
+ case 5: res->sp_warn=l; break;
+ case 6: res->sp_inact=l; break;
+ case 7: res->sp_expire=l; break;
+ case 8: res->sp_flag=l; break;
+ }
+ __ps.cur+=j+1;
+ }
+ *res_sig=res;
+ return 0;
+error:
+ *res_sig=0;/* the glibc people should be taken behind the barn and shot */
+ return -1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getspnam.c b/mdk-stage1/dietlibc/libcruft/getspnam.c
index e6573345d..a4eafbfb2 100644
--- a/mdk-stage1/dietlibc/libcruft/getspnam.c
+++ b/mdk-stage1/dietlibc/libcruft/getspnam.c
@@ -1,14 +1,11 @@
#include <shadow.h>
#include <string.h>
-#include <stdlib.h>
-struct spwd *getspnam(const char * name) {
+extern struct spwd __shadow_pw;
+extern char __shadow_buf[1000];
+
+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;
- }
+ getspnam_r(name,&__shadow_pw,__shadow_buf,sizeof(__shadow_buf),&tmp);
+ return tmp;
}
diff --git a/mdk-stage1/dietlibc/libcruft/getspnam_r.c b/mdk-stage1/dietlibc/libcruft/getspnam_r.c
new file mode 100644
index 000000000..084751d16
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getspnam_r.c
@@ -0,0 +1,14 @@
+#include <string.h>
+#include <shadow.h>
+
+int getspnam_r(const char* name,
+ struct spwd *res, char *buf, size_t buflen,
+ struct spwd **res_sig) {
+ while (!getspent_r(res,buf,buflen,res_sig))
+ if (!strcmp(name,res->sp_namp))
+ goto ok;
+ *res_sig=0;
+ok:
+ endspent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/getusershell.c b/mdk-stage1/dietlibc/libcruft/getusershell.c
new file mode 100644
index 000000000..4c99aa4d4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/getusershell.c
@@ -0,0 +1,33 @@
+#define _BSD_SOURCE
+#include <unistd.h>
+#include <paths.h>
+#include <string.h>
+#include "parselib.h"
+
+static struct state __ps;
+
+void setusershell(void) {
+ __prepare_parse(_PATH_SHELLS,&__ps);
+}
+
+void endusershell(void) {
+ __end_parse(&__ps);
+}
+
+#define MAXSHELL 128
+
+char *getusershell(void) {
+ static char line[MAXSHELL+1];
+ size_t i;
+ if (!__ps.buffirst) setusershell();
+ if (!__ps.buffirst) goto error;
+ if (__ps.cur>=__ps.buflen) goto error;
+ i=__parse_1(&__ps,'\n');
+ if (i>=MAXSHELL) i=MAXSHELL-1;
+ memcpy(line,__ps.buffirst+__ps.cur,i);
+ line[i]=0;
+ __ps.cur+=i+1;
+ return line;
+error:
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/grbuf.c b/mdk-stage1/dietlibc/libcruft/grbuf.c
new file mode 100644
index 000000000..a1b9440ce
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/grbuf.c
@@ -0,0 +1,5 @@
+#include <grp.h>
+
+struct group __group_pw;
+char __group_buf[1000];
+
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/herrno_location.c b/mdk-stage1/dietlibc/libcruft/herrno_location.c
index 203f73d4b..5908fe212 100644
--- a/mdk-stage1/dietlibc/libcruft/herrno_location.c
+++ b/mdk-stage1/dietlibc/libcruft/herrno_location.c
@@ -1,5 +1,8 @@
-extern int h_errno;
+#include <errno.h>
+#include <resolv.h>
+#include <netdb.h>
-int *__h_errno_location() { return &h_errno; }
+int *__h_errno_location(void);
+int *__h_errno_location(void) { return &h_errno; }
-int *h_errno_location() __attribute__((weak,alias("__h_errno_location")));
+int *h_errno_location(void) __attribute__((weak,alias("__h_errno_location")));
diff --git a/mdk-stage1/dietlibc/libcruft/herror.c b/mdk-stage1/dietlibc/libcruft/herror.c
new file mode 100644
index 000000000..619dd9ce5
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/herror.c
@@ -0,0 +1,8 @@
+#include <string.h>
+#include <unistd.h>
+#include <netdb.h>
+
+void herror(const char* s) {
+ write(2,s,strlen(s));
+ write(2,": DNS error.\n",13);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/hstrerror.c b/mdk-stage1/dietlibc/libcruft/hstrerror.c
new file mode 100644
index 000000000..fb8902f67
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/hstrerror.c
@@ -0,0 +1,11 @@
+#include <netdb.h>
+
+const char* hstrerror(int h_errno) {
+ switch (h_errno) {
+ case 0: return "OK";
+ case NO_DATA: return "No data of requested type.";
+ case TRY_AGAIN: return "Temporary failure.";
+ case HOST_NOT_FOUND:
+ default: return "Unknown host.";
+ }
+}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_aton.c b/mdk-stage1/dietlibc/libcruft/inet_aton.c
index ac7d9d007..01adb341e 100644
--- a/mdk-stage1/dietlibc/libcruft/inet_aton.c
+++ b/mdk-stage1/dietlibc/libcruft/inet_aton.c
@@ -24,7 +24,7 @@ int inet_aton(const char *cp, struct in_addr *inp) {
char *tmp=(char*)cp;
for (i=24; ;) {
long j;
- j=strtol(tmp,&tmp,0);
+ j=strtoul(tmp,&tmp,0);
if (*tmp==0) {
ip|=j;
break;
diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c b/mdk-stage1/dietlibc/libcruft/inet_ntoa.c
index f8c975f7a..632d81424 100644
--- a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c
+++ b/mdk-stage1/dietlibc/libcruft/inet_ntoa.c
@@ -2,8 +2,6 @@
#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_ntop.c b/mdk-stage1/dietlibc/libcruft/inet_ntop.c
index 77c47f239..81bee0a90 100644
--- a/mdk-stage1/dietlibc/libcruft/inet_ntop.c
+++ b/mdk-stage1/dietlibc/libcruft/inet_ntop.c
@@ -1,6 +1,6 @@
+#include <sys/socket.h>
#include <arpa/inet.h>
-
-extern char *inet_ntoa_r(struct in_addr in,char* buf);
+#include <string.h>
static const unsigned char V4mappedprefix[12]={0,0,0,0,0,0,0,0,0,0,0xff,0xff};
@@ -17,8 +17,7 @@ static int fmt_xlong(char* s,unsigned int i) {
return s-bak+1;
}
-unsigned int fmt_ip6(char *s,const char ip[16])
-{
+static unsigned int fmt_ip6(char *s,const char ip[16]) {
unsigned int len;
unsigned int i;
unsigned int temp;
@@ -53,13 +52,16 @@ unsigned int fmt_ip6(char *s,const char ip[16])
}
}
}
+ if (compressing) {
+ *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;
+ size_t len;
if (AF==AF_INET) {
inet_ntoa_r(*(struct in_addr*)CP,buf);
len=strlen(buf);
diff --git a/mdk-stage1/dietlibc/libcruft/inet_pton.c b/mdk-stage1/dietlibc/libcruft/inet_pton.c
index d5c17509c..a62785d5f 100644
--- a/mdk-stage1/dietlibc/libcruft/inet_pton.c
+++ b/mdk-stage1/dietlibc/libcruft/inet_pton.c
@@ -1,6 +1,9 @@
#include <stdlib.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h>
+#include <string.h>
+#include "dietfeatures.h"
static unsigned int scan_ip6(const char *s,char ip[16])
{
@@ -9,8 +12,8 @@ static unsigned int scan_ip6(const char *s,char ip[16])
unsigned long u;
char suffix[16];
- int prefixlen=0;
- int suffixlen=0;
+ unsigned int prefixlen=0;
+ unsigned int suffixlen=0;
for (i=0; i<16; i++) ip[i]=0;
@@ -26,7 +29,7 @@ static unsigned int scan_ip6(const char *s,char ip[16])
}
{
char *tmp;
- u=strtol(s,&tmp,16);
+ u=strtoul(s,&tmp,16);
i=tmp-s;
}
@@ -60,7 +63,7 @@ static unsigned int scan_ip6(const char *s,char ip[16])
i=tmp-s;
}
if (!i) {
- len--;
+ if (*s) len--;
break;
}
if (suffixlen+prefixlen<=12 && s[i]=='.') {
@@ -83,12 +86,14 @@ static unsigned int scan_ip6(const char *s,char ip[16])
}
int inet_pton(int AF, const char *CP, void *BUF) {
+ int len;
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;
+ if (CP[len=scan_ip6(CP,BUF)])
+ if (CP[len]!='%') /* allow "fe80::220:e0ff:fe69:ad92%eth0" */
+ return 0;
} else {
errno=EAFNOSUPPORT;
return -1;
diff --git a/mdk-stage1/dietlibc/libcruft/initgroups.c b/mdk-stage1/dietlibc/libcruft/initgroups.c
index 7d24866e9..932fddfd6 100644
--- a/mdk-stage1/dietlibc/libcruft/initgroups.c
+++ b/mdk-stage1/dietlibc/libcruft/initgroups.c
@@ -3,9 +3,10 @@
#include <string.h>
int initgroups(const char *user, gid_t group) {
- int n=0;
+ int n=1;
gid_t grouplist[32];
struct group *g;
+ grouplist[0]=group;
setgrent();
while ((g=getgrent())) {
char **duh=g->gr_mem;
diff --git a/mdk-stage1/dietlibc/libcruft/killpg.c b/mdk-stage1/dietlibc/libcruft/killpg.c
new file mode 100644
index 000000000..c03bb6330
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/killpg.c
@@ -0,0 +1,5 @@
+#include <signal.h>
+
+int killpg(pid_t pgrp, int signal) {
+ return kill(-pgrp,signal);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/localeconv.c b/mdk-stage1/dietlibc/libcruft/localeconv.c
new file mode 100644
index 000000000..d2c5ff82c
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/localeconv.c
@@ -0,0 +1,15 @@
+#include <limits.h>
+#include <locale.h>
+
+/* these answers are what glibc says */
+
+static struct lconv l =
+ {".","","","","","", /* decimal_point - mon_decimal_point */
+ "","","","",127,127, /* mon_thousands_sep - frac_digits */
+ 127,127,127,127,127,127, /* p_cs_precedes - n_sign_posn */
+ 127,127,127,127,127,127 }; /* __int_p_cs_precedes - __int_n_sign_posn */
+
+
+struct lconv* localeconv() {
+ return &l;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/mkdtemp.c b/mdk-stage1/dietlibc/libcruft/mkdtemp.c
new file mode 100644
index 000000000..1c388938c
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/mkdtemp.c
@@ -0,0 +1,28 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include "dietfeatures.h"
+
+char* mkdtemp(char* template) {
+ char *tmp=template+strlen(template)-6;
+ int randfd,i;
+ unsigned int random;
+ if (tmp<template) goto error;
+ for (i=0; i<6; ++i) if (tmp[i]!='X') { error: errno=EINVAL; return 0; }
+ 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';
+ }
+ if (mkdir(template,0700)==0) break;
+ if (errno==EEXIST) continue;
+ close(randfd);
+ return 0;
+ }
+ close(randfd);
+ return template;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/mkstemp.c b/mdk-stage1/dietlibc/libcruft/mkstemp.c
index 3b24ecb54..7dc19d4ed 100644
--- a/mdk-stage1/dietlibc/libcruft/mkstemp.c
+++ b/mdk-stage1/dietlibc/libcruft/mkstemp.c
@@ -1,14 +1,21 @@
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
+#include <stdlib.h>
#include <errno.h>
+#include "dietfeatures.h"
+
+#ifndef O_NOFOLLOW
+#define O_NOFOLLOW 0
+#endif
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; }
+ if (tmp<template) goto error;
+ for (i=0; i<6; ++i) if (tmp[i]!='X') { error: errno=EINVAL; return -1; }
randfd=open("/dev/urandom",O_RDONLY);
for (;;) {
read(randfd,&random,sizeof(random));
@@ -16,8 +23,9 @@ int mkstemp(char* template) {
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;
+ res=open(template,O_CREAT|O_RDWR|O_EXCL|O_NOFOLLOW,0600);
+ if (res>=0 || errno!=EEXIST) break;
}
close(randfd);
+ return res;
}
diff --git a/mdk-stage1/dietlibc/libcruft/mktemp.c b/mdk-stage1/dietlibc/libcruft/mktemp.c
new file mode 100644
index 000000000..d1908a9ac
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/mktemp.c
@@ -0,0 +1,17 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <dietwarning.h>
+
+link_warning("mktemp","\e[1;33;41m>>> mktemp stinks! DON'T USE IT ! <<<\e[0m");
+
+char* mktemp(char* template) {
+ int fd;
+ if ((fd=mkstemp(template))<0) return 0;
+ close(fd);
+ unlink(template);
+ return template;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/pwbuf.c b/mdk-stage1/dietlibc/libcruft/pwbuf.c
new file mode 100644
index 000000000..aa0ad7001
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/pwbuf.c
@@ -0,0 +1,5 @@
+#include <pwd.h>
+
+struct passwd __passwd_pw;
+char __passwd_buf[1000];
+
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
index 9322af298..78baa2b30 100644
--- a/mdk-stage1/dietlibc/libcruft/res_init.c
+++ b/mdk-stage1/dietlibc/libcruft/res_init.c
@@ -1,7 +1,9 @@
-extern int __dns_servers;
+#include <resolv.h>
+
extern void __dns_readstartfiles(void);
int res_init(void) {
- __dns_servers=0;
+ _res.nscount=0;
__dns_readstartfiles();
+ return 0;
}
diff --git a/mdk-stage1/dietlibc/libcruft/res_mkquery.c b/mdk-stage1/dietlibc/libcruft/res_mkquery.c
new file mode 100644
index 000000000..cf5693668
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/res_mkquery.c
@@ -0,0 +1,75 @@
+#include <resolv.h>
+#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 <unistd.h>
+#include <errno.h>
+#include <arpa/nameser.h>
+#include "dietfeatures.h"
+
+static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000";
+
+/*
+ 1 1 1 1 1 1
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | ID |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | QDCOUNT |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | ANCOUNT |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | NSCOUNT |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+ | ARCOUNT |
+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+*/
+
+extern void __dns_make_fd(void);
+extern int __dns_fd;
+
+extern int __dns_servers;
+extern struct sockaddr __dns_server_ips[];
+
+extern void __dns_readstartfiles(void);
+
+int res_mkquery(int op, const char *dname, int class, int type, char* data,
+ int datalen, const unsigned char* newrr, char* buf, int buflen) {
+ unsigned char packet[512];
+ memmove(packet,dnspacket,12);
+ if ((_res.options&RES_RECURSE)==0) packet[2]=0;
+ *(unsigned short*)packet=rand();
+ {
+ unsigned char* x;
+ const char* y,* tmp;
+ x=packet+12; y=dname;
+ 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)) { return -1; }
+ memmove(x,y,tmp-y);
+ x+=tmp-y;
+ if (!*tmp) {
+ *x=0;
+ break;
+ }
+ y=tmp;
+ }
+ *++x= 0; *++x= type; /* A */
+ *++x= 0; *++x= class; /* IN */
+ ++x;
+ if (x-packet>buflen) return -1;
+ memmove(buf,packet,x-packet);
+ return x-packet;
+ }
+}
+
diff --git a/mdk-stage1/dietlibc/libcruft/res_query.c b/mdk-stage1/dietlibc/libcruft/res_query.c
new file mode 100644
index 000000000..28b5c3ac8
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/res_query.c
@@ -0,0 +1,95 @@
+#include <resolv.h>
+#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 <arpa/nameser.h>
+#include "dietfeatures.h"
+
+extern void __dns_make_fd(void);
+extern int __dns_fd;
+#ifdef WANT_IPV6_DNS
+extern void __dns_make_fd6(void);
+extern int __dns_fd6;
+#endif
+
+extern void __dns_readstartfiles(void);
+
+int res_query(const char *dname, int class, int type, unsigned char *answer, int anslen) {
+ unsigned char packet[512];
+ int size;
+#ifndef WANT_IPV6_DNS
+ __dns_make_fd();
+#endif
+
+ __dns_readstartfiles();
+ if ((size=res_mkquery(QUERY,dname,class,type,0,0,0,packet,512))<0) { h_errno=NO_RECOVERY; return -1; }
+ {
+ {
+ int i; /* current server */
+ int j; /* timeout count down */
+ struct pollfd duh;
+ struct timeval last,now;
+#ifdef WANT_IPV6_DNS
+ int tmpfd; /* the warning gcc issues here is bogus */
+#else
+ duh.fd=__dns_fd;
+#endif
+ i=0;
+ duh.events=POLLIN;
+ last.tv_sec=0;
+ for (j=120; j>0; --j) {
+ gettimeofday(&now,0);
+ if (now.tv_sec-last.tv_sec>10) {
+#ifdef WANT_IPV6_DNS
+ struct sockaddr* s=(struct sockaddr*)&(_res.nsaddr_list[i]);
+ if (s->sa_family==AF_INET6) {
+ __dns_make_fd6();
+ tmpfd=__dns_fd6;
+ } else {
+ __dns_make_fd();
+ tmpfd=__dns_fd;
+ }
+ duh.fd=tmpfd;
+ if (sendto(tmpfd,packet,size,0,s,sizeof(struct sockaddr_in6))==0)
+ gettimeofday(&last,0);
+#else
+ if (sendto(__dns_fd,packet,size,0,(struct sockaddr*)&(_res.nsaddr_list[i]),sizeof(struct sockaddr))==0)
+ gettimeofday(&last,0);
+#endif
+ last=now;
+ }
+ if (++i >= _res.nscount) i=0;
+ if (poll(&duh,1,1000) == 1) {
+ /* read and parse answer */
+ unsigned char inpkg[1500];
+#ifdef WANT_IPV6_DNS
+ int len=read(tmpfd,inpkg,1500);
+#else
+ int len=read(__dns_fd,inpkg,1500);
+#endif
+ /* header, question, answer, authority, additional */
+ if (inpkg[0]!=packet[0] || inpkg[1]!=packet[1]) continue; /* wrong ID */
+ if ((inpkg[2]&0xf9) != (_res.options&RES_RECURSE?0x81:0x80)) continue; /* not answer */
+ if ((inpkg[3]&0x0f) != 0) { h_errno=HOST_NOT_FOUND; return -1; } /* error */
+ if (len>anslen) {
+ h_errno=NO_RECOVERY;
+ return -1;
+ }
+ memmove(answer,inpkg,len);
+ return len;
+ }
+/*kaputt:*/
+ }
+ }
+ }
+ h_errno=NO_DATA;
+ return -1;
+}
+
diff --git a/mdk-stage1/dietlibc/libcruft/res_search.c b/mdk-stage1/dietlibc/libcruft/res_search.c
new file mode 100644
index 000000000..a8b9257bc
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/res_search.c
@@ -0,0 +1,35 @@
+
+#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 <unistd.h>
+#include <errno.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
+extern int __dns_search;
+extern char *__dns_domains[];
+
+int res_search(const char *dname, int class, int type, unsigned char *answer, int anslen) {
+ const char *tmp=dname;
+ char Buf[MAXDNAME+1];
+ int res;
+ int len=strlen(dname);
+ int count=0;
+ memmove(Buf,dname,len);
+ Buf[len]=Buf[MAXDNAME]=0;
+// printf("appending %d: %p\n",count,__dns_domains[count]);
+ while ((res=res_query(tmp,class,type,answer,anslen))<0) {
+ if (count==__dns_search) break;
+ Buf[len]='.';
+// printf("appending %d: %p (%s)\n",count,__dns_domains[count],__dns_domains[count]);
+ memccpy(Buf+len+1,__dns_domains[count],0,MAXDNAME-len-1);
+ tmp=Buf;
+ ++count;
+ }
+ return res;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/scan_ulong.c b/mdk-stage1/dietlibc/libcruft/scan_ulong.c
new file mode 100644
index 000000000..dfbec5c55
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/scan_ulong.c
@@ -0,0 +1,13 @@
+#include <ctype.h>
+#include <sys/types.h>
+#include "parselib.h"
+
+size_t scan_ulong(const char* s,unsigned long* l) {
+ size_t n;
+ unsigned long x;
+ unsigned int digit;
+ for (x=n=0; (digit=(s[n]-'0'))<10u; ++n)
+ x=x*10+digit;
+ *l=x;
+ return n;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/scandir.c b/mdk-stage1/dietlibc/libcruft/scandir.c
new file mode 100644
index 000000000..fac7eaa7f
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/scandir.c
@@ -0,0 +1,47 @@
+#include <stdlib.h>
+#include <dirent.h>
+#include <string.h>
+
+int scandir(const char *dir, struct dirent ***namelist,
+ int (*select)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **)) {
+ DIR* d;
+ struct dirent *D;
+ int num=0;
+ if (!(d=opendir(dir)))
+ return -1;
+ *namelist=0;
+ while ((D=readdir(d))) {
+ if (select==0 || select(D)) {
+ struct dirent **tmp;
+ ++num;
+/* printf("realloc %p,%d -> ",*namelist,num*sizeof(struct dirent**)); */
+ if (!(tmp=realloc(*namelist,num*sizeof(struct dirent**))) ||
+ !(tmp[num-1]=malloc(sizeof(struct dirent)))) {
+ int i;
+ for (i=0; i<num-1; ++i) free(tmp[i]);
+ free(*namelist);
+ closedir(d);
+ return -1;
+ }
+ memccpy(tmp[num-1]->d_name,D->d_name,0,NAME_MAX);
+ *namelist=tmp;
+/* printf("%p; tmp[num-1(%d)]=%p\n",*namelist,num-1,tmp[num-1]); */
+ }
+ }
+ closedir(d);
+#if 0
+ {
+ int i;
+ puts("pre-qsort:\n");
+ for (i=0; i<num-1; ++i) {
+ puts((*namelist)[i]->d_name);
+ }
+ puts("post-qsort:\n");
+ }
+#endif
+// qsort(&(*namelist)[0],num,sizeof(struct dirent*),(int (*)(const void*,const void*))(compar));
+ if (compar)
+ qsort(*namelist,num,sizeof(struct dirent*),(int (*)(const void*,const void*))(compar));
+ return num;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/scandir64.c b/mdk-stage1/dietlibc/libcruft/scandir64.c
new file mode 100644
index 000000000..c1bdc3415
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/scandir64.c
@@ -0,0 +1,47 @@
+#include <stdlib.h>
+#include <dirent.h>
+#include <string.h>
+
+int scandir64(const char *dir, struct dirent64 ***namelist,
+ int (*select)(const struct dirent64 *),
+ int (*compar)(const struct dirent64 **, const struct dirent64 **)) {
+ DIR* d;
+ struct dirent64 *D;
+ int num=0;
+ if (!(d=opendir(dir)))
+ return -1;
+ *namelist=0;
+ while ((D=readdir64(d))) {
+ if (select==0 || select(D)) {
+ struct dirent64 **tmp;
+ ++num;
+/* printf("realloc %p,%d -> ",*namelist,num*sizeof(struct dirent**)); */
+ if (!(tmp=realloc(*namelist,num*sizeof(struct dirent64**))) ||
+ !(tmp[num-1]=malloc(sizeof(struct dirent64)))) {
+ int i;
+ for (i=0; i<num-1; ++i) free(tmp[i]);
+ free(*namelist);
+ closedir(d);
+ return -1;
+ }
+ memccpy(tmp[num-1]->d_name,D->d_name,0,NAME_MAX);
+ *namelist=tmp;
+/* printf("%p; tmp[num-1(%d)]=%p\n",*namelist,num-1,tmp[num-1]); */
+ }
+ }
+ closedir(d);
+#if 0
+ {
+ int i;
+ puts("pre-qsort:\n");
+ for (i=0; i<num-1; ++i) {
+ puts((*namelist)[i]->d_name);
+ }
+ puts("post-qsort:\n");
+ }
+#endif
+// qsort(&(*namelist)[0],num,sizeof(struct dirent*),(int (*)(const void*,const void*))(compar));
+ if (compar)
+ qsort(*namelist,num,sizeof(struct dirent64*),(int (*)(const void*,const void*))(compar));
+ return num;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/setegid.c b/mdk-stage1/dietlibc/libcruft/setegid.c
new file mode 100644
index 000000000..6e891952b
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/setegid.c
@@ -0,0 +1,11 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include "dietwarning.h"
+
+#undef setegid
+int setegid(gid_t gid);
+int setegid(gid_t gid) {
+ return setregid((gid_t)-1,gid);
+}
+
+link_warning("setegid","warning: you used setegid without including <unistd.h>")
diff --git a/mdk-stage1/dietlibc/libcruft/seteuid.c b/mdk-stage1/dietlibc/libcruft/seteuid.c
new file mode 100644
index 000000000..8145f20d7
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/seteuid.c
@@ -0,0 +1,11 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include "dietwarning.h"
+
+#undef seteuid
+int seteuid(uid_t uid);
+int seteuid(uid_t uid) {
+ return setreuid((uid_t)-1,uid);
+}
+
+link_warning("setegid","warning: you used setegid without including <unistd.h>")
diff --git a/mdk-stage1/dietlibc/libcruft/setlocale.c b/mdk-stage1/dietlibc/libcruft/setlocale.c
new file mode 100644
index 000000000..e0e8f647d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/setlocale.c
@@ -0,0 +1,7 @@
+#include <locale.h>
+
+char *setlocale (int category, const char *locale) {
+ (void)category;
+ (void)locale;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/spbuf.c b/mdk-stage1/dietlibc/libcruft/spbuf.c
new file mode 100644
index 000000000..ab880bbcf
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/spbuf.c
@@ -0,0 +1,5 @@
+#include <shadow.h>
+
+struct spwd __shadow_pw;
+char __shadow_buf[1000];
+
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/libcruft/sysconf.c b/mdk-stage1/dietlibc/libcruft/sysconf.c
new file mode 100644
index 000000000..e9c15cb66
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/sysconf.c
@@ -0,0 +1,43 @@
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+#include <sys/resource.h>
+
+extern int __sc_nr_cpus();
+
+long sysconf(int name)
+{
+ switch(name)
+ {
+ case _SC_OPEN_MAX:
+ {
+ struct rlimit limit;
+ getrlimit(RLIMIT_NOFILE, &limit);
+ return limit.rlim_cur;
+ }
+ case _SC_CLK_TCK:
+#ifdef __alpha__
+ return 1024;
+#else
+ return 100;
+#endif
+
+ case _SC_PAGESIZE:
+#if ( defined(__alpha__) || defined(__sparc__) )
+ return 8192;
+#else
+ return 4096;
+#endif
+
+ case _SC_ARG_MAX:
+ return ARG_MAX;
+
+ case _SC_NGROUPS_MAX:
+ return NGROUPS_MAX;
+
+ case _SC_NPROCESSORS_ONLN:
+ return __sc_nr_cpus();
+
+ }
+ return -1;
+}
diff --git a/mdk-stage1/dietlibc/libcruft/sysconf_cpus.c b/mdk-stage1/dietlibc/libcruft/sysconf_cpus.c
new file mode 100644
index 000000000..b5361d0a4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/sysconf_cpus.c
@@ -0,0 +1,64 @@
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "dietfeatures.h"
+
+/*
+ * by Olaf Dreesen
+ *
+ * arm NO SMP ?!? (return 1)
+ *
+ * alpha -> cpus detected\t\t: <nr>\n
+ * sparc -> ncpus active\t: <nr>\n
+ *
+ * default -> processor\t: <cpunr>\n (one per cpu)
+ */
+
+#ifdef SLASH_PROC_OK
+int __sc_nr_cpus(void);
+int __sc_nr_cpus() {
+#if defined(__arm__)
+ return 1;
+#else
+ int fd;
+ fd = open("/proc/cpuinfo", O_RDONLY);
+ if (fd==-1) return 1; /* fallback if no proc-fs mounted */
+ else {
+ int n,nr=0;
+ char buf[2048]; /* holds ~6 cpuinfos */
+
+ while((n=read(fd,buf,sizeof(buf)))>0) {
+ register int i=0;
+ while (i<n) {
+#if defined(__alpha__)
+ if ((buf[i]=='c')&&(!memcmp(buf+i,"cpus detected",13))) {
+ i+=17;
+ nr=atoi(buf+i);
+ break;
+ }
+#elif defined(__sparc__)
+ if ((buf[i]=='n')&&(!memcmp(buf+i,"ncpus active",12))) {
+ i+=15;
+ nr=atoi(buf+i);
+ break;
+ }
+#else /* DEFAULT */
+ if ((buf[i]=='p')&&(!memcmp(buf+i,"processor",9))) {
+ ++nr;
+ i+=9;
+ }
+#endif
+ while(buf[i++]!='\n'); /* skip rest of line */
+ }
+ }
+ close(fd);
+ return nr;
+ }
+#endif
+}
+#else
+int __sc_nr_cpus() {
+ return 1; /* kludge kludge ;-) */
+}
+#endif
diff --git a/mdk-stage1/dietlibc/libcruft/tempnam.c b/mdk-stage1/dietlibc/libcruft/tempnam.c
new file mode 100644
index 000000000..01c20b490
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/tempnam.c
@@ -0,0 +1,32 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dietwarning.h>
+
+link_warning("tempnam","\e[1;33;41m>>> tempnam stinks! NEVER ! NEVER USE IT ! <<<\e[0m");
+
+char* tempnam(char* dir,char* template) {
+ char buf[1024];
+ int len=sizeof(buf)-1,fd;
+ buf[len]=0;
+ if ((dir)&&(*dir)) {
+ memccpy(buf,dir,0,len);
+ strncat(buf,"/",1);
+ }
+ else
+ strncpy(buf,"/tmp/",len);
+ len=(sizeof(buf)-1)-strlen(buf);
+ if (template)
+ strncat(buf,template, --len);
+ else
+ strncat(buf,"temp_", --len);
+ len=(sizeof(buf)-1)-strlen(buf);
+ strncat(buf,"XXXXXX",len);
+ if ((fd=mkstemp(buf))<0) return 0;
+ close(fd);
+ unlink(buf);
+ return strdup(buf);
+}
diff --git a/mdk-stage1/dietlibc/libcruft/tmpnam.c b/mdk-stage1/dietlibc/libcruft/tmpnam.c
new file mode 100644
index 000000000..707730616
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcruft/tmpnam.c
@@ -0,0 +1,31 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include "dietfeatures.h"
+#include <errno.h>
+#include <sys/stat.h>
+#include <dietwarning.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+link_warning("tmpnam","\e[1;33;41m>>> tmpnam stinks! NEVER ! NEVER USE IT ! <<<\e[0m");
+
+char* tmpnam(char* s) {
+ static char buf[100];
+ char *tmp;
+ if (s) tmp=s; else tmp=buf;
+ strcpy(tmp,"/tmp/temp_");
+ for (;;) {
+ struct stat s;
+ int i,j;
+ i=rand();
+ for (j=0; j<8; ++j) {
+ char c=i&0xf;
+ tmp[9+j]=c>9?c+'a'-10:c+'0';
+ i>>=4;
+ }
+ tmp[17]=0;
+ if (lstat(tmp,&s)==-1 && errno==ENOENT) break;
+ }
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libcrypt/crypt.c b/mdk-stage1/dietlibc/libcrypt/crypt.c
index 933397f5f..3c162d513 100644
--- a/mdk-stage1/dietlibc/libcrypt/crypt.c
+++ b/mdk-stage1/dietlibc/libcrypt/crypt.c
@@ -1,8 +1,9 @@
#include "dietfeatures.h"
#include <unistd.h>
+#include <md5.h>
/* Initial permutation, */
-static char IP[] = {
+static const 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,
@@ -14,7 +15,7 @@ static char IP[] = {
};
/* Final permutation, FP = IP^(-1) */
-static char FP[] = {
+static const 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,
@@ -28,14 +29,14 @@ static char FP[] = {
/* 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[] = {
+static const 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[] = {
+static const char PC1_D[] = {
62,54,46,38,30,22,14,
6,61,53,45,37,29,21,
13, 5,60,52,44,36,28,
@@ -43,18 +44,18 @@ static char PC1_D[] = {
};
/* 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 };
+static const 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[] = {
+static const 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[] = {
+static const 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
};
@@ -68,7 +69,7 @@ static char KS[16][48];
/* The E bit-selection table. */
static char E[48];
-static char e2[] = {
+static const 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,
@@ -119,7 +120,7 @@ void setkey(const char *key)
/* The 8 selection functions. For some reason, they give a 0-origin index,
* unlike everything else.
*/
-static char S[8][64] = {
+static const 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,
@@ -178,7 +179,7 @@ static char S[8][64] = {
};
/* P is a permutation on the selected combination of the current L and key. */
-static char P[] = {
+static const 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
};
@@ -192,11 +193,12 @@ static char f[32];
static char preS[48];
/* The payoff: encrypt a block. */
-void encrypt(char block[64], int edflag)
+void encrypt(char block[64],int edflag)
{
int i, ii;
register int t, j, k;
+ (void)edflag;
/* First, permute the bits in the input */
for(j=0; j < 64; j++)
L[j] = block[(int)IP[j]];
@@ -253,7 +255,10 @@ char * crypt(const char *pw, const char *salt)
{
register int i, j, c;
static char block[66], iobuf[16];
-
+#ifdef WANT_CRYPT_MD5
+ if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$')
+ return md5crypt(pw,salt);
+#endif
for(i=0; i < 66; i++)
block[i] = 0;
for(i=0; (c= *pw) && i < 64; pw++) {
@@ -287,7 +292,7 @@ char * crypt(const char *pw, const char *salt)
}
for(i=0; i < 25; i++)
- encrypt(block, 0);
+ encrypt(block,0);
for(i=0; i < 11; i++) {
c = 0;
diff --git a/mdk-stage1/dietlibc/libcrypt/md5.c b/mdk-stage1/dietlibc/libcrypt/md5.c
new file mode 100644
index 000000000..ede9a067e
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcrypt/md5.c
@@ -0,0 +1,243 @@
+/*****************************************************************************
+*
+* "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm".
+*
+* 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
+*
+*****************************************************************************/
+
+#include <endian.h>
+#include <md5.h>
+#include <string.h>
+
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+/*
+ Block copy and convert byte order to little-endian.
+ dst must be 32bit aligned.
+ Length is the number of 32bit words
+*/
+static void CopyToLittleEndian (uint32_t *dst, const uint8_t *src, int length) {
+ while (length--) {
+ *dst=(((uint32_t)src[3])<<24) |
+ (((uint32_t)src[2])<<16) |
+ (((uint32_t)src[1])<< 8) |
+ (uint32_t)src[0];
+ src+=4;
+ dst++;
+ }
+}
+#endif
+
+
+/*
+ Assembler versions of __MD5Transform, MD5Init and MD5Update
+ currently exist for x86 and little-endian ARM.
+ For other targets, we need to use the C versions below.
+*/
+
+#if !(defined (__i386__) || ((defined (__arm__) && (__BYTE_ORDER == __LITTLE_ENDIAN))))
+
+/*
+ Initialise the MD5 context.
+*/
+void MD5Init (MD5_CTX* context) {
+ context->count[0] = 0;
+ context->count[1] = 0;
+
+ context->state[0] = 0x67452301; /* Load magic constants. */
+ context->state[1] = 0xefcdab89;
+ context->state[2] = 0x98badcfe;
+ context->state[3] = 0x10325476;
+}
+
+#define ROTATE_LEFT(x, n) ((x << n) | (x >> (32-n)))
+
+#define F(x, y, z) (z ^ (x & (y ^ z)))
+#define G(x, y, z) (y ^ (z & (x ^ y)))
+#define H(x, y, z) (x ^ y ^ z)
+#define I(x, y, z) (y ^ (x | ~z))
+
+#define FF(a, b, c, d, x, s, ac) { (a) += F (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+#define GG(a, b, c, d, x, s, ac) { (a) += G (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+#define HH(a, b, c, d, x, s, ac) { (a) += H (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+#define II(a, b, c, d, x, s, ac) { (a) += I (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); }
+
+static void __MD5Transform (uint32_t state[4], const uint8_t *in, int repeat) {
+ const uint32_t *x;
+
+ uint32_t a = state[0];
+ uint32_t b = state[1];
+ uint32_t c = state[2];
+ uint32_t d = state[3];
+
+ for ( ; repeat; repeat--) {
+ uint32_t tempBuffer[16];
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+
+ CopyToLittleEndian (tempBuffer, in, 16);
+ x = tempBuffer;
+#else
+ if ((long)in & 3) {
+ memcpy(tempBuffer, in, 64);
+ x = tempBuffer;
+ } else
+ x = (const uint32_t *) in;
+#endif
+
+ FF (a, b, c, d, x[ 0], 7, 0xd76aa478); /* 1 */ /* Round 1 */
+ FF (d, a, b, c, x[ 1], 12, 0xe8c7b756); /* 2 */
+ FF (c, d, a, b, x[ 2], 17, 0x242070db); /* 3 */
+ FF (b, c, d, a, x[ 3], 22, 0xc1bdceee); /* 4 */
+ FF (a, b, c, d, x[ 4], 7, 0xf57c0faf); /* 5 */
+ FF (d, a, b, c, x[ 5], 12, 0x4787c62a); /* 6 */
+ FF (c, d, a, b, x[ 6], 17, 0xa8304613); /* 7 */
+ FF (b, c, d, a, x[ 7], 22, 0xfd469501); /* 8 */
+ FF (a, b, c, d, x[ 8], 7, 0x698098d8); /* 9 */
+ FF (d, a, b, c, x[ 9], 12, 0x8b44f7af); /* 10 */
+ FF (c, d, a, b, x[10], 17, 0xffff5bb1); /* 11 */
+ FF (b, c, d, a, x[11], 22, 0x895cd7be); /* 12 */
+ FF (a, b, c, d, x[12], 7, 0x6b901122); /* 13 */
+ FF (d, a, b, c, x[13], 12, 0xfd987193); /* 14 */
+ FF (c, d, a, b, x[14], 17, 0xa679438e); /* 15 */
+ FF (b, c, d, a, x[15], 22, 0x49b40821); /* 16 */
+
+ GG (a, b, c, d, x[ 1], 5, 0xf61e2562); /* 17 */ /* Round 2 */
+ GG (d, a, b, c, x[ 6], 9, 0xc040b340); /* 18 */
+ GG (c, d, a, b, x[11], 14, 0x265e5a51); /* 19 */
+ GG (b, c, d, a, x[ 0], 20, 0xe9b6c7aa); /* 20 */
+ GG (a, b, c, d, x[ 5], 5, 0xd62f105d); /* 21 */
+ GG (d, a, b, c, x[10], 9, 0x02441453); /* 22 */
+ GG (c, d, a, b, x[15], 14, 0xd8a1e681); /* 23 */
+ GG (b, c, d, a, x[ 4], 20, 0xe7d3fbc8); /* 24 */
+ GG (a, b, c, d, x[ 9], 5, 0x21e1cde6); /* 25 */
+ GG (d, a, b, c, x[14], 9, 0xc33707d6); /* 26 */
+ GG (c, d, a, b, x[ 3], 14, 0xf4d50d87); /* 27 */
+ GG (b, c, d, a, x[ 8], 20, 0x455a14ed); /* 28 */
+ GG (a, b, c, d, x[13], 5, 0xa9e3e905); /* 29 */
+ GG (d, a, b, c, x[ 2], 9, 0xfcefa3f8); /* 30 */
+ GG (c, d, a, b, x[ 7], 14, 0x676f02d9); /* 31 */
+ GG (b, c, d, a, x[12], 20, 0x8d2a4c8a); /* 32 */
+
+ HH (a, b, c, d, x[ 5], 4, 0xfffa3942); /* 33 */ /* Round 3 */
+ HH (d, a, b, c, x[ 8], 11, 0x8771f681); /* 34 */
+ HH (c, d, a, b, x[11], 16, 0x6d9d6122); /* 35 */
+ HH (b, c, d, a, x[14], 23, 0xfde5380c); /* 36 */
+ HH (a, b, c, d, x[ 1], 4, 0xa4beea44); /* 37 */
+ HH (d, a, b, c, x[ 4], 11, 0x4bdecfa9); /* 38 */
+ HH (c, d, a, b, x[ 7], 16, 0xf6bb4b60); /* 39 */
+ HH (b, c, d, a, x[10], 23, 0xbebfbc70); /* 40 */
+ HH (a, b, c, d, x[13], 4, 0x289b7ec6); /* 41 */
+ HH (d, a, b, c, x[ 0], 11, 0xeaa127fa); /* 42 */
+ HH (c, d, a, b, x[ 3], 16, 0xd4ef3085); /* 43 */
+ HH (b, c, d, a, x[ 6], 23, 0x04881d05); /* 44 */
+ HH (a, b, c, d, x[ 9], 4, 0xd9d4d039); /* 45 */
+ HH (d, a, b, c, x[12], 11, 0xe6db99e5); /* 46 */
+ HH (c, d, a, b, x[15], 16, 0x1fa27cf8); /* 47 */
+ HH (b, c, d, a, x[ 2], 23, 0xc4ac5665); /* 48 */
+
+ II (a, b, c, d, x[ 0], 6, 0xf4292244); /* 49 */ /* Round 4 */
+ II (d, a, b, c, x[ 7], 10, 0x432aff97); /* 50 */
+ II (c, d, a, b, x[14], 15, 0xab9423a7); /* 51 */
+ II (b, c, d, a, x[ 5], 21, 0xfc93a039); /* 52 */
+ II (a, b, c, d, x[12], 6, 0x655b59c3); /* 53 */
+ II (d, a, b, c, x[ 3], 10, 0x8f0ccc92); /* 54 */
+ II (c, d, a, b, x[10], 15, 0xffeff47d); /* 55 */
+ II (b, c, d, a, x[ 1], 21, 0x85845dd1); /* 56 */
+ II (a, b, c, d, x[ 8], 6, 0x6fa87e4f); /* 57 */
+ II (d, a, b, c, x[15], 10, 0xfe2ce6e0); /* 58 */
+ II (c, d, a, b, x[ 6], 15, 0xa3014314); /* 59 */
+ II (b, c, d, a, x[13], 21, 0x4e0811a1); /* 60 */
+ II (a, b, c, d, x[ 4], 6, 0xf7537e82); /* 61 */
+ II (d, a, b, c, x[11], 10, 0xbd3af235); /* 62 */
+ II (c, d, a, b, x[ 2], 15, 0x2ad7d2bb); /* 63 */
+ II (b, c, d, a, x[ 9], 21, 0xeb86d391); /* 64 */
+
+ state[0] = a = a + state[0];
+ state[1] = b = b + state[1];
+ state[2] = c = c + state[2];
+ state[3] = d = d + state[3];
+
+ in += 64;
+ }
+}
+
+
+/*
+ MD5 block update operation:
+ Process another sub-string of the message and update the context.
+*/
+void MD5Update (MD5_CTX *context, const uint8_t *input, size_t inputBytes) {
+ int i;
+ int byteIndex;
+ unsigned int partLen;
+ int len;
+
+ /* Compute number of bytes mod 64 */
+ byteIndex = (context->count[0] >> 3) & 0x3F;
+
+ /* Update number of bits: count += 8 * inputBytes */
+ if ((context->count[0] += inputBytes << 3) < (inputBytes << 3))
+ context->count[1]++;
+ context->count[1] += (inputBytes >> (32-3));
+
+ partLen = (64 - byteIndex);
+
+ /* Transform as many times as possible. */
+ if (inputBytes >= partLen) {
+ memcpy (context->buffer + byteIndex, input, partLen);
+ __MD5Transform (context->state, (const uint8_t *) context->buffer, 1);
+ len = (inputBytes - partLen) / 64;
+ __MD5Transform (context->state, &input[partLen], len);
+ i = partLen + 64 * len;
+ byteIndex = 0;
+ } else
+ i = 0;
+
+ /* Buffer remaining input */
+ memcpy (&context->buffer[byteIndex], &input[i], inputBytes - i);
+}
+
+#endif
+
+
+void MD5Final (uint8_t digest[16], MD5_CTX* context) {
+ static uint8_t finalBlock[64];
+
+ uint32_t bits[2];
+ int byteIndex;
+ int finalBlockLength;
+
+ byteIndex = (context->count[0] >> 3) & 0x3F;
+ finalBlockLength = ((byteIndex < 56) ? 56 : 120) - byteIndex;
+ finalBlock[0] = 0x80;
+
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+ CopyToLittleEndian (bits, (const uint8_t *) context->count, 2);
+#else
+ memcpy(bits, context->count, 8);
+#endif
+
+ MD5Update (context, finalBlock, finalBlockLength);
+ MD5Update (context, (const uint8_t *) bits, 8);
+
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+ CopyToLittleEndian ((uint32_t *) digest, (const uint8_t *) context->state, 4);
+#else
+ memcpy (digest, context->state, 16);
+#endif
+
+ memset(context, 0, sizeof(*context));
+}
+
diff --git a/mdk-stage1/dietlibc/libcrypt/md5crypt.c b/mdk-stage1/dietlibc/libcrypt/md5crypt.c
new file mode 100644
index 000000000..ebbb4be44
--- /dev/null
+++ b/mdk-stage1/dietlibc/libcrypt/md5crypt.c
@@ -0,0 +1,157 @@
+/* $OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $ */
+
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ *
+ * $FreeBSD: crypt.c,v 1.5 1996/10/14 08:34:02 phk Exp $
+ *
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <md5.h>
+
+static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */
+ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+static void to64 (char *, uint32_t, int);
+
+static void
+to64(s, v, n)
+ char *s;
+ uint32_t v;
+ int n;
+{
+ while (--n >= 0) {
+ *s++ = itoa64[v&0x3f];
+ v >>= 6;
+ }
+}
+
+/*
+ * UNIX password
+ *
+ * Use MD5 for what it is best at...
+ */
+
+char *
+md5crypt(pw, salt)
+ register const char *pw;
+ register const char *salt;
+{
+ /*
+ * This string is magic for this algorithm. Having
+ * it this way, we can get get better later on
+ */
+ static unsigned char *magic = (unsigned char *)"$1$";
+
+ static char passwd[120], *p;
+ static const unsigned char *sp,*ep;
+ unsigned char final[16];
+ int sl,pl,i;
+ MD5_CTX ctx,ctx1;
+ uint32_t l;
+
+ /* Refine the Salt first */
+ sp = (const unsigned char *)salt;
+
+ /* If it starts with the magic string, then skip that */
+ if(!strncmp((const char *)sp,(const char *)magic,strlen((const char *)magic)))
+ sp += strlen((const char *)magic);
+
+ /* It stops at the first '$', max 8 chars */
+ for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
+ continue;
+
+ /* get the length of the true salt */
+ sl = ep - sp;
+
+ MD5Init(&ctx);
+
+ /* The password first, since that is what is most unknown */
+ MD5Update(&ctx,(const unsigned char *)pw,strlen(pw));
+
+ /* Then our magic string */
+ MD5Update(&ctx,magic,strlen((const char *)magic));
+
+ /* Then the raw salt */
+ MD5Update(&ctx,sp,sl);
+
+ /* Then just as many characters of the MD5(pw,salt,pw) */
+ MD5Init(&ctx1);
+ MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
+ MD5Update(&ctx1,sp,sl);
+ MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
+ MD5Final(final,&ctx1);
+ for(pl = strlen(pw); pl > 0; pl -= 16)
+ MD5Update(&ctx,final,pl>16 ? 16 : pl);
+
+ /* Don't leave anything around in vm they could use. */
+ memset(final,0,sizeof final);
+
+ /* Then something really weird... */
+ for (i = strlen(pw); i ; i >>= 1)
+ if(i&1)
+ MD5Update(&ctx, final, 1);
+ else
+ MD5Update(&ctx, (const unsigned char *)pw, 1);
+
+ /* Now make the output string */
+ strcpy(passwd,(const char *)magic);
+ memcpy(passwd+3,sp,sl);
+ passwd[sl+3]='$';
+ passwd[sl+4]=0;
+
+ MD5Final(final,&ctx);
+
+ /*
+ * and now, just to make sure things don't run too fast
+ * On a 60 Mhz Pentium this takes 34 msec, so you would
+ * need 30 seconds to build a 1000 entry dictionary...
+ */
+ for(i=0;i<1000;i++) {
+ MD5Init(&ctx1);
+ if(i & 1)
+ MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
+ else
+ MD5Update(&ctx1,final,16);
+
+ if(i % 3)
+ MD5Update(&ctx1,sp,sl);
+
+ if(i % 7)
+ MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
+
+ if(i & 1)
+ MD5Update(&ctx1,final,16);
+ else
+ MD5Update(&ctx1,(const unsigned char *)pw,strlen(pw));
+ MD5Final(final,&ctx1);
+ }
+
+ p = passwd + strlen(passwd);
+
+ l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4;
+ l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4;
+ l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4;
+ l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4;
+ l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4;
+ l = final[11] ; to64(p,l,2); p += 2;
+ *p = '\0';
+
+ /* Don't leave anything around in vm they could use. */
+ memset(final,0,sizeof final);
+
+ return passwd;
+}
+
diff --git a/mdk-stage1/dietlibc/libdl/Makefile b/mdk-stage1/dietlibc/libdl/Makefile
index c0463f887..29164f105 100644
--- a/mdk-stage1/dietlibc/libdl/Makefile
+++ b/mdk-stage1/dietlibc/libdl/Makefile
@@ -1,24 +1,38 @@
# local "test" make file
-SRC = $(wildcard *.c) test/test.c
+CC = gcc
+DCC = diet $(CC)
+
+SRC = $(wildcard *.c) # test/test.c
OBJ = _dl_jump.o $(SRC:.c=.o)
-#CFLAGS = -Wall -O2
-CFLAGS = -g
+#CFLAGS = -Wall -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -g -O
+CFLAGS = -Wall -O2 -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -frerun-loop-opt -fschedule-insns2 $(DEB) # -fomit-frame-pointer
%.o : %.S
- $(HOME)/bin/diet gcc $(CFLAGS) -c -o $@ $^
+ $(DCC) $(CFLAGS) -c -o $@ $^
%.o : %.c
- $(HOME)/bin/diet gcc $(CFLAGS) -c -o $@ $^
+ $(DCC) $(CFLAGS) -c -o $@ $^
+
+it: t.out
+
+a.out: t.out
+ gcc -O -g test/a.c t.out -L/opt/diet/lib-i386 -lc -lgcc -o $@ -Wl,-dynamic-linker=`pwd`/t.out -nostdlib
+
+t.out: _dl_main.o
+ ld -shared -o $@ $? -soname=libdl.so
+
+all: test.out libdl.a
-all: test.out
+libdl.a: $(OBJ)
+ ar cru $@ $^
-test.g: test.c
+test.g: test/test.c
gcc -o $@ $^ -ldl
-test.out: $(OBJ)
- $(HOME)/bin/diet gcc -o $@ $^
+test.out: $(OBJ) test/test.o
+ diet gcc -o $@ $^
clean:
$(RM) *.o *.a *.out *~ # *.so
diff --git a/mdk-stage1/dietlibc/libdl/README b/mdk-stage1/dietlibc/libdl/README
index 5d77bde34..6f1d0e46e 100644
--- a/mdk-stage1/dietlibc/libdl/README
+++ b/mdk-stage1/dietlibc/libdl/README
@@ -1,6 +1,82 @@
-this is the experimental libdl test-pre-pre-alpha code
+this is the experimental libdl
written by Olaf Dreesen
-Shouldn't work yet had some problems with the elf specs...
-and more inconsistencies...
+Fri Nov 15 16:23:28 CET 2002
+
+ fixing the copy-relocation bug.
+
+ TODO as last time.... plus
+ - dlsym with RTLD_NEXT
+
+Wed Nov 6 19:08:00 CET 2002
+
+ Ups.. misunderstood the manual-page of dlopen.
+ now dlopen(0,...) works the way it is described in the susv2, BUT still not
+ complete.
+
+ TODO:
+ - gdb support
+
+ - RTLD_GLOBAL/RTLD_LOCAL
+ at the moment ALL are GLOBAL.
+
+ - open of a shared object ONCE
+ there is no library hard-, symlink detection yet.
+
+ - code for other archs then i386 and arm
+
+
+Fri Sep 13 16:28:42 CEST 2002
+
+ this unified libdl/dynlinker is now the default.
+
+
+Mon Mar 11 19:44:20 CET 2002
+
+ the unified libdl/dynlinker now seems to stand the NORMAL usage so I think
+ it should be tested outside my CLEANROOM :)
+
+ TODO: code for other archs than i386 and arm
+
+
+Thu Nov 1 18:41:36 MET 2001
+
+ ufffff.... now the libdl code can be used in the libdl.so :)
+ Status: it works in my clean room on i386, arm-code started
+
+ TODO: see below :)
+
+
+Wed Jul 4 11:55:00 MEST 2001
+
+ Uwe Ohse pointed to some flaws in my code, I have started to fix them....
+
+ TODO: rebuild the code in a more readable and consistent way.
+ TODO: code for other archs than i386
+
+
+Thu Jun 21 15:32:45 MEST 2001
+
+ It work good enough to make a libdietc.so possible.
+
+ TODO: rebuild the code in a more readable and consistent way.
+ TODO: code for other archs than i386
+
+
+Thu Jun 7 14:10:03 MEST 2001
+
+ Status: test-pre-alpha code
+ the code is now "testable" ...
+ I need a dyn-dietlibc specific ld.so. (in work)
+
+ TODO: rebuild the code in a more readable and consistent way.
+
+
+INITIAL May ? :
+
+ Status: test-pre-pre-alpha code
+
+ Shouldn't work yet. Had and have some problems with the elf specs...
+ and more inconsistencies...
+
diff --git a/mdk-stage1/dietlibc/libdl/_dl_alloc.c b/mdk-stage1/dietlibc/libdl/_dl_alloc.c
new file mode 100644
index 000000000..41d0d4671
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/_dl_alloc.c
@@ -0,0 +1,81 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include "_dl_int.h"
+
+#ifdef __DIET_LD_SO__
+static struct _dl_handle*_dl_root_handle=(struct _dl_handle*)0;
+static struct _dl_handle*_dl_top_handle=(struct _dl_handle*)0;
+static struct _dl_handle*_dl_free_list=(struct _dl_handle*)0;
+#else
+struct _dl_handle*_dl_root_handle=(struct _dl_handle*)0;
+struct _dl_handle*_dl_top_handle=(struct _dl_handle*)0;
+struct _dl_handle*_dl_free_list=(struct _dl_handle*)0;
+#endif
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+void _dl_free_handle(struct _dl_handle*dh) {
+ if (_dl_root_handle==dh) _dl_root_handle=dh->next;
+ if (_dl_top_handle ==dh) _dl_top_handle=dh->prev;
+
+ if (dh->next) dh->next->prev=dh->prev;
+ if (dh->prev) dh->prev->next=dh->next;
+
+ if ((dh->flags&RTLD_NOSONAME) && dh->name) free(dh->name);
+ memset(dh,0,sizeof(struct _dl_handle));
+ dh->next=_dl_free_list;
+ _dl_free_list=dh;
+}
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+struct _dl_handle*_dl_get_handle() {
+ struct _dl_handle*tmp;
+
+ if (_dl_free_list==0) {
+ register int i,m;
+#ifdef __DIET_LD_SO__
+ tmp = (struct _dl_handle*)_dl_sys_mmap(0,at_pagesize,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0);
+ m=at_pagesize/sizeof(struct _dl_handle);
+#else
+ int ps=getpagesize();
+ tmp = (struct _dl_handle*)mmap(0,ps,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0);
+ m=ps/sizeof(struct _dl_handle);
+#endif
+ for (i=m;i;) _dl_free_handle(tmp+(--i));
+ }
+
+ tmp = _dl_free_list;
+ _dl_free_list = tmp->next;
+
+ tmp->next=0;
+ if (_dl_root_handle) {
+ _dl_top_handle->next=tmp;
+ tmp->prev=_dl_top_handle;
+ } else
+ _dl_root_handle = tmp;
+
+ _dl_top_handle=tmp;
+
+ return tmp;
+}
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+struct _dl_handle*_dl_find_lib(const char* name) {
+ if (name) {
+ if (_dl_root_handle) {
+ struct _dl_handle*tmp;
+ for (tmp=_dl_root_handle;tmp;tmp=tmp->next) {
+ if (!tmp->name) continue;
+ if (!strcmp(tmp->name,name)) return tmp;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libdl/_dl_int.h b/mdk-stage1/dietlibc/libdl/_dl_int.h
index 659e6ee0f..1bab10a92 100644
--- a/mdk-stage1/dietlibc/libdl/_dl_int.h
+++ b/mdk-stage1/dietlibc/libdl/_dl_int.h
@@ -1,31 +1,151 @@
#ifndef ___DL_INT_H__
#define ___DL_INT_H__
+#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__)
+#define ELF_CLASS ELFCLASS64
+#else
+#define ELF_CLASS ELFCLASS32
+#endif
+
#include <elf.h>
+#include <dlfcn.h>
+
+#include "_dl_rel.h"
+
+#if ELF_CLASS == ELFCLASS32
+
+#define Elf_Addr Elf32_Addr
+
+#define Elf_Dyn Elf32_Dyn
+#define Elf_Ehdr Elf32_Ehdr
+#define Elf_Phdr Elf32_Phdr
+#define Elf_Rel Elf32_Rel
+#define Elf_Rela Elf32_Rela
+#define Elf_Sym Elf32_Sym
+
+#define ELF_R_SYM(x) ELF32_R_SYM((x))
+#define ELF_R_TYPE(x) ELF32_R_TYPE((x))
+
+#define ELF_ST_BIND(x) ELF32_ST_BIND((x))
+#define ELF_ST_TYPE(x) ELF32_ST_TYPE((x))
+
+#else
+
+#define Elf_Addr Elf64_Addr
+
+#define Elf_Dyn Elf64_Dyn
+#define Elf_Ehdr Elf64_Ehdr
+#define Elf_Phdr Elf64_Phdr
+#define Elf_Rel Elf64_Rel
+#define Elf_Rela Elf64_Rela
+#define Elf_Sym Elf64_Sym
+
+#define ELF_R_SYM(x) ELF64_R_SYM((x))
+#define ELF_R_TYPE(x) ELF64_R_TYPE((x))
+
+#define ELF_ST_BIND(x) ELF64_ST_BIND((x))
+#define ELF_ST_TYPE(x) ELF64_ST_TYPE((x))
+
+#endif
+
+//#define DEBUG
+#ifdef DEBUG
+#ifndef __DIET_LD_SO__
+#include <stdio.h>
+#define pf(s) write(2,s,strlen(s))
+#define ph(l) fdprintf(2,"%08lx",(l))
+#endif
+#endif
+
+#define RTLD_USER 0x10000000
+#define RTLD_NOSONAME 0x20000000
+#define LDSO_FLAGS (RTLD_LAZY|RTLD_GLOBAL|RTLD_NOSONAME)
struct _dl_handle {
+ char * mem_base; /* base address of maped *.so / or zero if program | Elf_Addr l_addr */
+ char * l_name; /* Abloslute filename of this object */
+ Elf_Dyn* dynamic; /* _DYNAMIC */
+
+ struct _dl_handle *next;
+ struct _dl_handle *prev;
+
+ unsigned int flags; /* FLAGS */
+
+ char * name; /* name of shared object */
+
/* basic */
- void * mem_base; /* base address of maped *.so */
unsigned long mem_size; /* len of mem block */
- unsigned int lnk_count; /* reference count */
+ unsigned long lnk_count; /* reference count (other libraries) */
+
+ /* lazy evaluator data */
+ unsigned long*pltgot; /* PLT/GOT */
/* symbol resolve helper */
unsigned long*hash_tab; /* hash table */
- Elf32_Sym * dyn_sym_tab; /* dynamic symbol table */
char * dyn_str_tab; /* dyn_name table */
+ Elf_Sym * dyn_sym_tab; /* dynamic symbol table */
+ _dl_rel_t* plt_rel; /* PLT relocation table */
- Elf32_Rel * plt_rel; /* PLT relocation table */
-
- /* FINI */
+ /* INIT / FINI */
void (*fini)(void);
};
-#define HASH_BUCKET_LEN(p) ((p))
+/* debug communication (GDB) (dyn-linker only) */
+struct r_debug {
+ int r_version;
+ struct _dl_handle* r_map;
+ unsigned long r_brk;
+ enum {
+ RT_CONSISTENT, /* mapping complete */
+ RT_ADD, /* begin add object */
+ RT_DELETE, /* begin del object */
+ } r_state;
+ unsigned long r_ldbase;
+};
+
+#define HASH_BUCKET_LEN(p) (*((p)))
#define HASH_BUCKET(p) ((p)+2)
-#define HASH_CHAIN_LEN(p) ((p)+1)
+#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);
+/* _dl_alloc.c */
+extern struct _dl_handle* _dl_root_handle;
+extern struct _dl_handle* _dl_top_handle;
+extern struct _dl_handle* _dl_free_list;
+#ifndef __DIET_LD_SO__
+void _dl_free_handle(struct _dl_handle* dh);
+struct _dl_handle* _dl_get_handle();
+struct _dl_handle* _dl_find_lib(const char* name);
+
+/* _dl_open.c */
+void *_dl_open(const char* filename, int flags);
+
+/* _dl_load.c */
+void *_dl_load(const char* filename, const char*pathname, int fd, int flags);
+struct _dl_handle* _dl_dyn_scan(struct _dl_handle* dh, void* dyn_addr, int flags);
+
+/* _dl_search.c */
+void _dl_set_rpath(const char *path);
+const char* _dl_get_rpath();
+int _dl_search(char *buf, int len, const char *filename);
+
+/* dlsym.c */
+void *_dlsym(void*dh,char*symbol);
+void *_dl_sym_search_str(struct _dl_handle*h,char*name);
+void *_dl_sym(struct _dl_handle * h, int symbol);
+
+/* _dl_queue.c */
+int _dl_queue_lib(const char* name, int flags);
+int _dl_open_dep();
+
+/* _dl_relocate.c */
+int _dl_relocate(struct _dl_handle* dh, _dl_rel_t *rel, int num);
+
+/* dlerror.c */
+extern unsigned int _dl_error;
+extern const char* _dl_error_location;
+extern const char* _dl_error_data;
+#endif
#endif
diff --git a/mdk-stage1/dietlibc/libdl/_dl_jump.S b/mdk-stage1/dietlibc/libdl/_dl_jump.S
index 134f31ea5..bd7115258 100644
--- a/mdk-stage1/dietlibc/libdl/_dl_jump.S
+++ b/mdk-stage1/dietlibc/libdl/_dl_jump.S
@@ -1,8 +1,55 @@
.text
.global _dl_jump
_dl_jump:
+
+#ifdef __i386__
+.type _dl_jump,@function
+
+ pushl %eax # save register args...
+ pushl %ecx
+ pushl %edx
+
+ pushl %ebx
+
+ pushl 20(%esp) # 2. arg from plt
+ pushl 20(%esp) # 1. arg from plt
+
+#ifdef __DYN_LIB
+ call 1f
+1: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
+ call do_rel@PLT
+#else
call do_rel
- pop %edx
- pop %edx
- jmp *%eax
+#endif
+ addl $8, %esp
+
+ popl %ebx
+
+ popl %edx # restore register args...
+ popl %ecx
+
+ xchgl %eax, (%esp) # restore eax and save function pointer (for return)
+
+ ret $8 # remove arguments from plt and jump to REAL function
+
+#endif
+
+#ifdef __arm__
+.type _dl_jump,function
+
+ stmdb sp!, {r0, r1, r2, r3}
+ sub r1, ip, lr
+ sub r1, r1, #4
+ add r1, r1, r1 /* dyntab entry */
+ ldr r0, [lr, #-4] /* dynlib handle */
+#ifdef __DYN_LIB
+ bl do_rel(PLT)
+#else
+ bl do_rel
+#endif
+ mov r12, r0
+ ldmia sp!, {r0, r1, r2, r3, lr}
+ mov pc, r12
+#endif
diff --git a/mdk-stage1/dietlibc/libdl/_dl_load.c b/mdk-stage1/dietlibc/libdl/_dl_load.c
new file mode 100644
index 000000000..49e8db0be
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/_dl_load.c
@@ -0,0 +1,401 @@
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <dlfcn.h>
+#include <elf.h>
+
+#include "_dl_int.h"
+
+#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))
+
+/* this is an arch specific "return jump" for the relocation */
+void _dl_jump();
+
+/*
+ * this file is a Q. & D. hack ... don't think this is bug free or meaningfull
+ */
+
+static inline int map_flags(int flags)
+{
+ 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 perm;
+}
+
+static inline void *do_map_in(void *base, unsigned long length, int flags, int fd, unsigned long offset)
+{
+ register int op = MAP_PRIVATE;
+ if (base) op|=MAP_FIXED;
+ return mmap(base, length, map_flags(flags), op, fd, offset);
+}
+
+static struct _dl_handle *_dl_map_lib(const char*fn, const char*pathname, int fd, int flags)
+{
+ struct _dl_handle* ret=0;
+ int ps=getpagesize();
+ int i;
+ unsigned char buf[1024];
+ char *m=0,*d=0;
+
+ unsigned long l;
+ struct stat st;
+
+ Elf_Ehdr *eh;
+ Elf_Phdr *ph;
+
+ int ld_nr=0;
+ Elf_Phdr **ld=0;
+ Elf_Phdr *dyn=0;
+
+ if (fd==-1) return 0;
+
+#ifdef DEBUG
+ pf(__func__": "); pf(pathname); pf("\n");
+#endif
+
+ if (fstat(fd,&st)<0) {
+ close(fd);
+ _dl_error=2;
+ return 0;
+ }
+ else {
+ // use st_dev and st_ino for identification
+ }
+
+ if (read(fd, buf, 1024)<128) {
+ close(fd);
+ _dl_error=2;
+ return 0;
+ }
+
+ eh=(Elf_Ehdr*)buf;
+ ph=(Elf_Phdr*)&buf[eh->e_phoff];
+
+ for (i=0; i<eh->e_phnum; i++) {
+ if (ph[i].p_type==PT_LOAD) ++ld_nr;
+ }
+ ld=alloca(ld_nr*sizeof(Elf_Phdr));
+
+ for (ld_nr=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);
+ ret = _dl_get_handle();
+
+ m = (char*)do_map_in(0, length, ld[0]->p_flags, fd, offset);
+ if (m==MAP_FAILED) { _dl_free_handle(ret); close(fd); return 0; }
+
+ /* zero pad bss */
+ l = ld[0]->p_offset+ld[0]->p_filesz;
+ memset(m+l,0,length-l);
+
+ ret->mem_base=m;
+ ret->mem_size=length;
+ }
+ 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); /* do we need this ? */
+ 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);
+
+ ret = _dl_get_handle();
+ /* mmap all mem_blocks for *.so */
+ m = (char*) do_map_in(0,text_size+data_size,ld[0]->p_flags,fd,text_offset);
+ if (m==MAP_FAILED) { _dl_free_handle(ret); close(fd); return 0; }
+
+ /* 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_fsize-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);
+ }
+
+ ret->mem_base=m;
+ ret->mem_size=text_size+data_size;
+ }
+
+ if (ret) {
+ ret->lnk_count=1;
+ ret->name=strdup(fn);
+ ret->dyn_str_tab=(char*)m+dyn->p_vaddr; /* missuse of field */
+ }
+
+ close(fd);
+ return ret;
+}
+
+/* local alias */
+static struct _dl_handle* __dl_dyn_scan(struct _dl_handle* dh, void* dyn_addr, int flags)
+__attribute__ ((alias("_dl_dyn_scan")));
+
+struct _dl_handle* _dl_dyn_scan(struct _dl_handle* dh, void* dyn_addr, int flags)
+{
+ Elf_Dyn* dyn_tab = dyn_addr;
+
+ void (*init)()=0;
+ unsigned long* got=0;
+ void* jmprel=0;
+ int pltreltype=0;
+ int pltrelsize=0;
+ unsigned long rel=0;
+ int relent=0;
+ int relsize=0;
+
+ int i;
+
+#ifdef DEBUG
+ pf(__func__": pre dynamic scan "); ph((unsigned long)dh); pf("\n");
+#endif
+ dh->dyn_str_tab=0;
+ dh->flags=flags;
+
+ for(i=0;dyn_tab[i].d_tag;i++) {
+// DEBUG(printf("_dl_load dyn %d, %08lx\n",dyn_tab[i].d_tag, dyn_tab[i].d_un.d_val);)
+ if (dyn_tab[i].d_tag==DT_HASH) {
+ dh->hash_tab = (unsigned long*)(dh->mem_base+dyn_tab[i].d_un.d_ptr);
+#ifdef DEBUG
+ pf(__func__": have hash @ "); ph((long)dh->hash_tab); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_SYMTAB) {
+ dh->dyn_sym_tab = (Elf_Sym*)(dh->mem_base+dyn_tab[i].d_un.d_ptr);
+#ifdef DEBUG
+ pf(__func__": have dyn_sym_tab @ "); ph((long)dh->dyn_sym_tab); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_STRTAB) {
+ dh->dyn_str_tab = (char*)(dh->mem_base+dyn_tab[i].d_un.d_ptr);
+#ifdef DEBUG
+ pf(__func__": have dyn_str_tab @ "); ph((long)dh->dyn_str_tab); pf("\n");
+#endif
+ }
+
+ /* INIT / FINI */
+ else if (dyn_tab[i].d_tag==DT_FINI) {
+ dh->fini = (void(*)(void))(dh->mem_base+dyn_tab[i].d_un.d_val);
+#ifdef DEBUG
+ pf(__func__": have fini @ "); ph((long)dh->fini); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_INIT) {
+ init = (void(*)(void))(dh->mem_base+dyn_tab[i].d_un.d_val);
+#ifdef DEBUG
+ pf(__func__": have init @ "); ph((long)init); pf("\n");
+#endif
+ }
+
+ /* PLT / Relocation entries for PLT in GOT */
+ else if (dyn_tab[i].d_tag==DT_PLTGOT) {
+ got=(unsigned long*)(dh->mem_base+dyn_tab[i].d_un.d_val);
+ dh->pltgot=got;
+#ifdef DEBUG
+ pf(__func__": have plt got @ "); ph((long)dh->pltgot); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_PLTREL) {
+ pltreltype=dyn_tab[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__func__": have pltreltype @ "); ph((long)pltreltype); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_PLTRELSZ) {
+ pltrelsize=dyn_tab[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__func__": have pltrelsize @ "); ph((long)pltrelsize); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_JMPREL) {
+ jmprel=(dh->mem_base+dyn_tab[i].d_un.d_val);
+ dh->plt_rel=jmprel;
+#ifdef DEBUG
+ pf(__func__": have jmprel @ "); ph((long)jmprel); pf("\n");
+#endif
+ }
+
+ /* Relocation */
+ else if (dyn_tab[i].d_tag==DT_REL) {
+ rel=(unsigned long)(dh->mem_base+dyn_tab[i].d_un.d_val);
+#ifdef DEBUG
+ pf(__func__": have rel @ "); ph((long)rel); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_RELENT) {
+ relent=dyn_tab[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__func__": have relent @ "); ph((long)relent); pf("\n");
+#endif
+ }
+ else if (dyn_tab[i].d_tag==DT_RELSZ) {
+ relsize=dyn_tab[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__func__": have relsize @ "); ph((long)relsize); pf("\n");
+#endif
+ }
+
+ else if (dyn_tab[i].d_tag==DT_TEXTREL) {
+ _dl_free_handle(dh);
+ _dl_error = 3;
+ return 0;
+ }
+ }
+ /* extra scan for rpath (if program) ... */
+ if (dh->name==0) {
+ for(i=0;dyn_tab[i].d_tag;i++) {
+ if (dyn_tab[i].d_tag==DT_RPATH) {
+ char *rpath=dh->dyn_str_tab+dyn_tab[i].d_un.d_val;
+ _dl_set_rpath(rpath);
+#ifdef DEBUG
+ pf(__func__": have runpath: "); pf(rpath); pf("\n");
+#endif
+ }
+ }
+ }
+
+#ifdef DEBUG
+ pf(__func__": post dynamic scan "); ph((unsigned long)dh); pf("\n");
+#endif
+
+ if ((got=_dlsym(dh,"_GLOBAL_OFFSET_TABLE_"))) {
+#ifdef DEBUG
+ pf(__func__": found a GOT @ "); ph((unsigned long)got); pf("\n");
+#endif
+ /* GOT */
+ got[0]+=(unsigned long)dh->mem_base; /* reloc dynamic pointer */
+ got[1] =(unsigned long)dh;
+ got[2] =(unsigned long)(_dl_jump); /* sysdep jump to _dl_rel */
+ /* */
+ }
+ else {
+ if (dh) {
+ munmap(dh->mem_base,dh->mem_size);
+ _dl_free_handle(dh);
+ }
+ _dl_error = 3;
+ return 0;
+ }
+
+ /* load other libs */
+ for(i=0;dyn_tab[i].d_tag;i++) {
+ if (dyn_tab[i].d_tag==DT_NEEDED) {
+ char *lib_name=dh->dyn_str_tab+dyn_tab[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__func__": needed for this lib: "); pf(lib_name); pf("\n");
+#endif
+ _dl_queue_lib(lib_name,flags);
+ }
+ }
+
+ if (_dl_open_dep()) {
+ _dl_error = 1;
+ return 0;
+ }
+
+ /* relocate */
+ if (rel) {
+#ifdef DEBUG
+ pf(__func__": try to relocate some values\n");
+#endif
+ if (_dl_relocate(dh,(Elf_Rel*)rel,relsize/relent)) {
+ munmap(dh->mem_base,dh->mem_size);
+ _dl_free_handle(dh);
+ return 0;
+ }
+ }
+
+ /* do PTL / GOT relocation */
+ if (pltreltype == DT_REL) {
+ Elf_Rel *tmp = jmprel;
+#ifdef DEBUG
+ pf(__func__": rel got\n");
+#endif
+ for (;(char*)tmp<(((char*)jmprel)+pltrelsize);(char*)tmp=((char*)tmp)+sizeof(Elf_Rel)) {
+ if ((flags&RTLD_NOW)) {
+ unsigned long sym=(unsigned long)_dl_sym(dh,ELF_R_SYM(tmp->r_info));
+ if (sym) *((unsigned long*)(dh->mem_base+tmp->r_offset))=sym;
+ else {
+ _dl_free_handle(dh);
+ _dl_error = 4;
+ return 0;
+ }
+ }
+ else
+ *((unsigned long*)(dh->mem_base+tmp->r_offset))+=(unsigned long)dh->mem_base;
+#if 0
+ DEBUG("_dl_load rel @ %08lx with type %d -> %d\n",(long)dh->mem_base+tmp->r_offset,ELF_R_TYPE(tmp->r_info),ELF_R_SYM(tmp->r_info));
+ DEBUG("_dl_load -> %08lx\n",*((unsigned long*)(dh->mem_base+tmp->r_offset)));
+#endif
+ }
+ }
+ if (pltreltype == DT_RELA) {
+ Elf_Rela *tmp = jmprel;
+#ifdef DEBUG
+ pf(__func__": rela got\n");
+#endif
+ for (;(char*)tmp<(((char*)jmprel)+pltrelsize);(char*)tmp=((char*)tmp)+sizeof(Elf_Rela)) {
+ if ((flags&RTLD_NOW)) {
+ unsigned long sym=(unsigned long)_dl_sym(dh,ELF_R_SYM(tmp->r_info));
+ if (sym) *((unsigned long*)(dh->mem_base+tmp->r_offset))=sym;
+ else {
+ _dl_free_handle(dh);
+ _dl_error = 4;
+ return 0;
+ }
+ }
+ else
+ *((unsigned long*)(dh->mem_base+tmp->r_offset))=(unsigned long)(dh->mem_base+tmp->r_addend);
+#if 0
+ DEBUG("_dl_load rela @ %08lx with type %d -> %d\n",(long)dh->mem_base+tmp->r_offset,ELF_R_TYPE(tmp->r_info),ELF_R_SYM(tmp->r_info));
+ DEBUG("_dl_load -> %08lx\n",*((unsigned long*)(dh->mem_base+tmp->r_offset)));
+#endif
+ }
+ }
+
+ /* _dl_load depending libs ... */
+#ifdef DEBUG
+ pf(__func__": post resolve, pre init\n");
+#endif
+ if (init) init();
+#ifdef DEBUG
+ pf(__func__": post init\n");
+#endif
+
+ return dh;
+}
+
+void *_dl_load(const char*fn, const char*pathname, int fd, int flags)
+{
+ struct _dl_handle* ret=0;
+ if ((ret=_dl_map_lib(fn,pathname,fd,flags))) {
+ ret=__dl_dyn_scan(ret,(void*)(ret->dyn_str_tab),flags);
+ }
+ return ret;
+}
diff --git a/mdk-stage1/dietlibc/libdl/_dl_main.c b/mdk-stage1/dietlibc/libdl/_dl_main.c
new file mode 100644
index 000000000..8ecf44f0b
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/_dl_main.c
@@ -0,0 +1,1059 @@
+#ifdef __OD_CLEAN_ROOM
+
+#define __DIET_LD_SO__
+
+/*
+ * this is the dietlibc libdl & dynamic-linker
+ *
+ * NEED to be compiled with -fPIC ...
+ */
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include "_dl_int.h"
+#include "_dl_rel.h"
+
+void _start(void); /* entry of lib... */
+
+static void (*fini_entry)(void)=0;
+static char **_dl_environ=0;
+static unsigned long loadaddr=0;
+static unsigned long prog_entry=0;
+
+static Elf_Phdr*prog_ph;
+static unsigned long prog_ph_size;
+static unsigned long prog_ph_num;
+
+static unsigned long at_uid;
+static unsigned long at_euid;
+static unsigned long at_gid;
+static unsigned long at_egid;
+static unsigned long at_pagesize;
+
+/* this are the "local syscalls" */
+void _dl_sys_exit(int val);
+int _dl_sys_read(int fd,char*buf,unsigned long len);
+int _dl_sys_write(int fd,char*buf,unsigned long len);
+int _dl_sys_open(const char*filename,int flags,int mode);
+int _dl_sys_close(int fd);
+void*_dl_sys_mmap(void*start,unsigned long length,int prot,int flags,int fd,unsigned long offset);
+int _dl_sys_munmap(void*start,unsigned long length);
+int _dl_sys_mprotect(const void*addr,unsigned long len,int prot);
+int _dl_sys_fstat(int filedes, struct stat *buf);
+
+extern char*strdup(const char*s);
+
+#ifdef __i386__
+
+asm(".text \n"
+".type _start,@function \n"
+"_start: \n"
+" movl %esp, %ebp # save stack \n"
+" movl (%ebp), %ecx # argc \n"
+" leal 4(%ebp), %esi # argv \n"
+" leal 4(%esi,%ecx,4), %eax # envp \n"
+
+"# PIC code \n"
+" call getpic \n"
+" addl $_GLOBAL_OFFSET_TABLE_, %ebx \n"
+
+"# for calculation of load addr, get 'relocated' address of _DYNAMIC \n"
+" leal _DYNAMIC@GOTOFF(%ebx), %edx \n"
+
+"# put parameter on stack and call _dl_main \n"
+" pushl %edx \n"
+" pushl %eax \n"
+" pushl %esi \n"
+" pushl %ecx \n"
+" call _dl_main \n"
+
+"# restore stack \n"
+" movl %ebp, %esp \n"
+
+"# get fini pointer \n"
+" movl fini_entry@GOTOFF(%ebx), %edx \n"
+
+"# clear callee-save-register like kernel \n"
+" xorl %ebx, %ebx \n"
+" xorl %ebp, %ebp \n"
+" xorl %edi, %edi \n"
+" xorl %esi, %esi \n"
+
+"# jump to program entry point \n"
+" jmp *%eax \n"
+
+"_dl_sys_read: \n"
+" movb $3,%al \n"
+" jmp _dl_sys_call3 \n"
+"_dl_sys_write: \n"
+" movb $4,%al \n"
+" jmp _dl_sys_call3 \n"
+"_dl_sys_open: \n"
+" movb $5,%al \n"
+" jmp _dl_sys_call3 \n"
+"_dl_sys_close: \n"
+" movb $6,%al \n"
+" jmp _dl_sys_call3 \n"
+"_dl_sys_mmap: \n"
+" movb $90,%al \n"
+" leal 4(%esp),%edx \n"
+" pushl %edx \n"
+" call _dl_sys_call3 \n"
+" popl %ecx \n"
+" ret \n"
+"_dl_sys_munmap: \n"
+" movb $91,%al \n"
+" jmp _dl_sys_call3 \n"
+"_dl_sys_fstat: \n"
+" movb $108,%al \n"
+" jmp _dl_sys_call3 \n"
+"_dl_sys_mprotect: \n"
+" movb $125,%al \n"
+" jmp _dl_sys_call3 \n"
+"_dl_sys_exit: \n"
+" movb $1,%al \n"
+"_dl_sys_call3: \n"
+" movzbl %al,%eax \n"
+" pushl %ebx \n"
+" movl %esp,%ebx \n"
+" movl 16(%ebx),%edx \n"
+" movl 12(%ebx),%ecx \n"
+" movl 8(%ebx),%ebx \n"
+" int $0x80 \n"
+" popl %ebx \n"
+" ret \n"
+
+".type _dl_jump,@function \n"
+"_dl_jump: \n"
+" pushl %eax # save register args... \n"
+" pushl %ecx \n"
+" pushl %edx \n"
+
+" push 16(%esp) # 2. arg from plt \n"
+" push 16(%esp) # 1. arg from plt \n"
+" call do_resolve \n"
+" add $8, %esp \n"
+
+" popl %edx # restore register args... \n"
+" popl %ecx \n"
+" xchgl %eax, (%esp) # restore eax and save function pointer (for return) \n"
+" ret $8 # remove arguments from plt and jump to REAL function \n"
+
+"# GET Position In Code :) \n"
+"getpic: movl (%esp), %ebx \n"
+" ret");
+
+static inline unsigned long* get_got(void) {
+ register unsigned long *got asm ("%ebx");
+ return got;
+}
+
+static inline int work_on_pltgot(struct _dl_handle*dh) {
+ /* declare _dl_jump static otherwise we have a GOT access BEFOR we have the resolver */
+ static void _dl_jump(void);
+ if ((dh->plt_rel)&&(!(dh->flags&RTLD_NOW))) {
+ unsigned long*tmp=dh->pltgot;
+ /* GOT */
+ tmp[0]+=(unsigned long)dh->mem_base; /* reloc dynamic pointer */
+ tmp[1] =(unsigned long)dh; /* the handle */
+ tmp[2] =(unsigned long)(_dl_jump); /* sysdep jump to do_resolve */
+ }
+ return 0;
+}
+
+#elif __arm__
+
+asm(".text \n"
+".type _start,function \n"
+"_start: \n"
+" mov r4, sp \n"
+" mov fp, #0 @ start new stack frame \n"
+
+" ldr a1, [sp], #4 @ argc \n"
+" mov a2, sp @ argv \n"
+
+" add a3, a2, a1, lsl #2 @ envp \n"
+" add a3, a3, #4 \n"
+
+" ldr sl, .L_got @ PIC code \n"
+"1: add sl, pc, sl \n"
+
+" ldr a4, .L_la @ get 'relocated' address of _DYNAMIC \n"
+" add a4, a4, sl \n"
+
+" bl _dl_main @ call _dl_main \n"
+
+" mov sp, r4 \n"
+
+" mov lr, a1 @ save program entry point \n"
+
+" ldr a1, [pc, #.L_fe-(.+8)] @ agrument 1: global fini entry \n"
+" ldr a1, [sl, a1] \n"
+
+" mov pc, lr \n"
+
+".L_got: .long _GLOBAL_OFFSET_TABLE_-(1b+8) \n"
+".L_la: .long _DYNAMIC(GOTOFF) \n"
+".L_fe: .long fini_entry(GOTOFF) \n"
+
+"_dl_sys_exit: \n"
+" swi #0x900001 @ exit \n"
+" eor pc, lr, lr @ OR DIE ! \n"
+" mov pc, lr \n"
+
+"_dl_sys_read: \n"
+" swi #0x900003 @ read \n"
+" mov pc, lr \n"
+"_dl_sys_write: \n"
+" swi #0x900004 @ write \n"
+" mov pc, lr \n"
+"_dl_sys_open: \n"
+" swi #0x900005 @ open \n"
+" mov pc, lr \n"
+"_dl_sys_close: \n"
+" swi #0x900006 @ close \n"
+" mov pc, lr \n"
+"_dl_sys_mmap: \n"
+" stmdb sp!,{r0,r1,r2,r3} \n"
+" mov r0, sp \n"
+" swi #0x900090 @ mmap \n"
+" add sp, sp, #16 \n"
+" mov pc, lr \n"
+"_dl_sys_munmap: \n"
+" swi #0x900091 @ munmap \n"
+" mov pc, lr \n"
+"_dl_sys_fstat: \n"
+" swi #0x900108 @ fstat \n"
+" mov pc, lr \n"
+"_dl_sys_mprotect: \n"
+" swi #0x900125 @ mprotect \n"
+" mov pc, lr \n"
+
+".type _dl_jump,function \n"
+"_dl_jump: \n"
+" stmdb sp!, {r0, r1, r2, r3} @ save arguments \n"
+
+" sub r1, ip, lr @ dyntab entry \n"
+" sub r1, r1, #4 \n"
+" add r1, r1, r1 \n"
+
+" ldr r0, [lr, #-4] @ dynlib handle \n"
+
+" bl do_resolve \n"
+
+" mov r12, r0 \n"
+" ldmia sp!, {r0, r1, r2, r3, lr} @ restore arguments \n"
+" mov pc, r12");
+
+static inline unsigned long* get_got(void) {
+ register unsigned long *got asm ("sl");
+ return got;
+}
+
+static inline int work_on_pltgot(struct _dl_handle*dh) {
+ /* declare _dl_jump static otherwise we have a GOT access BEFOR we have the resolver */
+ static void _dl_jump(void);
+ if ((dh->plt_rel)&&(!(dh->flags&RTLD_NOW))) {
+ unsigned long*tmp=dh->pltgot;
+ /* GOT */
+ tmp[0]+=(unsigned long)dh->mem_base; /* reloc dynamic pointer */
+ tmp[1] =(unsigned long)dh; /* the handle */
+ tmp[2] =(unsigned long)(_dl_jump); /* sysdep jump to do_resolve */
+ }
+ return 0;
+}
+
+#else
+#error "libdl: arch not supported"
+#endif
+
+static void*_dl_load(const char*fn,const char*pathname,int fd,int flags);
+
+/* here do the code includes */
+
+/* strncpy */
+static char*strncpy(register char*s,register const char*t,register unsigned long n) {
+ char *dest=s;
+ for(;n;--n) {
+ char ch=*t;
+ *s=ch;
+ if (ch==0) return dest;
+ ++s; ++t;
+ }
+ return 0;
+}
+
+/* strlen.c */
+static unsigned long strlen(register const char*s) {
+ register unsigned long i;
+ if (!s) return 0;
+ for (i=0; *s; ++s) ++i;
+ return i;
+}
+
+/* strcmp.c */
+static int strcmp(register const unsigned char*s,register const unsigned char*t) {
+ register char x;
+ for (;;) {
+ x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
+ }
+ return ((int)(unsigned int)x) - ((int)(unsigned int)*t);
+}
+
+/* strcspn.c */
+static unsigned long strcspn(const char*s,const char*reject) {
+ unsigned long 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;
+}
+
+/* memcpy.c */
+static void*memcpy(void*dst,const void*src,unsigned long count) {
+ register char *d=dst;
+ register const char *s=src;
+ ++count;
+ while (--count) {
+ *d = *s;
+ ++d; ++s;
+ }
+ return dst;
+}
+
+/* memset.c */
+static void*memset(void*dst,int ch,unsigned long count) {
+ register char *d=dst;
+ ++count;
+ while (--count) {
+ *d=ch;
+ ++d;
+ }
+ return dst;
+}
+
+/* memcmp.c */
+static int memcmp(register const unsigned char*s,register const unsigned char*t,unsigned long count) {
+ register int r;
+ ++count;
+ while(--count) {
+ if ((r=(*s-*t))) return r;
+ ++s;
+ ++t;
+ }
+ return 0;
+}
+
+/* getenv.c */
+static char*getenv(const char*env) {
+ unsigned int i,len=strlen(env);
+ for (i=0;_dl_environ[i];++i) {
+ if ((memcmp(_dl_environ[i],env,len)==0) && (_dl_environ[i][len]=='='))
+ return _dl_environ[i]+len+1;
+ }
+ return 0;
+}
+
+/* basic debug output functions */
+static void pf(const char*s) { _dl_sys_write(2,(void*)s,strlen(s)); }
+static void ph(unsigned long l) {
+ const int max=(sizeof(unsigned long)<<1);
+ unsigned char buf[16];
+ int i;
+ for (i=max;i;l>>=4) {
+ register unsigned long v='0'|(l&15);
+ if (v>'9') v+=0x27;
+ buf[--i]=v;
+ }
+ _dl_sys_write(2,buf,max);
+}
+
+/* the never free strdup (internal) */
+static unsigned long _dl_lib_strdup_len=0;
+static char*_dl_lib_strdup_str;
+static char*_dl_lib_strdup(const char*s) {
+ char*ret=_dl_lib_strdup_str;
+ unsigned long l=strlen(s)+1;
+ if (_dl_lib_strdup_len<l) {
+ ret=(char*)_dl_sys_mmap(0,at_pagesize,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS,-1,0);
+ _dl_lib_strdup_len=at_pagesize;
+ }
+ _dl_lib_strdup_str=ret+l;
+ _dl_lib_strdup_len-=l;
+ memcpy(ret,s,l);
+ return ret;
+}
+
+#ifdef __GDB_SUPPORT__
+volatile void _dl_debug_state(void);
+/* gdb debug break point */
+void _dl_debug_state() {}
+
+/* gdb debug init stuff */
+struct r_debug _r_debug;
+static struct r_debug* _dl_debug_init(Elf_Addr dl_base) {
+ if (_r_debug.r_brk==0) {
+ _r_debug.r_version = 1;
+ _r_debug.r_ldbase = dl_base;
+ _r_debug.r_map = _dl_root_handle; /* this my be wrong */
+ _r_debug.r_brk = (Elf_Addr)&_dl_debug_state;
+ }
+ return &_r_debug;
+}
+#endif
+
+/* now reuse some unchanged sources */
+#include "dlerror.c"
+#include "_dl_alloc.c"
+
+#include "dlsym.c"
+
+#include "_dl_search.c"
+
+#include "_dl_open.c"
+#include "dlopen.c"
+
+#include "_dl_relocate.c"
+#include "_dl_queue.c"
+
+#include "dlclose.c"
+
+/* back to the "new" implementation */
+static void tt_fini(void) {
+ struct _dl_handle*tmp;
+#ifdef DEBUG
+ pf("dyn fini\n");
+#endif
+ for(tmp=_dl_root_handle;tmp;tmp=tmp->next)
+ if (tmp->fini) tmp->fini();
+}
+
+/* exit ! */
+static void _DIE_() { _dl_sys_exit(213); }
+
+/* lazy function resolver */
+static unsigned long do_resolve(struct _dl_handle*dh,unsigned long off) {
+ _dl_rel_t *tmp = ((void*)dh->plt_rel)+off;
+ int sym=ELF_R_SYM(tmp->r_info);
+ register unsigned long sym_val;
+
+ if (0) sym_val=(unsigned long)do_resolve; /* TRICK: no warning */
+
+ /* modify GOT for REAL symbol */
+ sym_val=(unsigned long)_dl_sym(dh,sym);
+ *((unsigned long*)(dh->mem_base+tmp->r_offset))=sym_val;
+
+ /* JUMP (arg sysdep...) */
+ if (sym_val) return sym_val;
+ /* can't find symbol */
+ return (unsigned long)_DIE_;
+}
+
+/* library loader */
+
+/* ELF -> MMAP permissions */
+static inline int map_flags(int flags) {
+ 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 perm;
+}
+
+/* a simple mmap wrapper */
+static inline void*do_map_in(void*base,unsigned long length,int flags,int fd,unsigned long offset) {
+ register int op = MAP_PRIVATE;
+ if (base) op|=MAP_FIXED;
+ return _dl_sys_mmap(base, length, map_flags(flags), op, fd, offset);
+}
+
+/* map a library into memory */
+#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))
+static struct _dl_handle*_dl_map_lib(const char*fn,const char*pathname,int fd,int flags) {
+ struct _dl_handle*ret=0;
+ int i;
+ unsigned char buf[1024];
+ char *m=0,*d=0;
+
+ unsigned long l;
+ struct stat st;
+
+ Elf_Ehdr*eeh;
+ Elf_Phdr*eph;
+
+ int ld_nr=0;
+ Elf_Phdr*ld[4]={0,0,0,0};
+ Elf_Phdr*dyn=0;
+
+ if (0) { pathname=0; } /* no unused parameter */
+ if (fd==-1) return 0;
+
+ if (_dl_sys_fstat(fd,&st)<0) {
+err_out_close:
+ _dl_sys_close(fd);
+ _dl_error_data=fn;
+ _dl_error=2;
+ return 0;
+ } else {
+ /* use st_dev and st_ino for identification */
+ }
+
+ if (_dl_sys_read(fd,buf,1024)<128) goto err_out_close;
+
+ eeh=(Elf_Ehdr*)buf;
+ eph=(Elf_Phdr*)&buf[eeh->e_phoff];
+
+ for (i=0;i<eeh->e_phnum;++i) {
+ if (eph[i].p_type==PT_LOAD) {
+ if (ld_nr>3) goto err_out_close;
+ ld[ld_nr++]=eph+i;
+ }
+ if (eph[i].p_type==PT_DYNAMIC) {
+ dyn=eph+i;
+ }
+ }
+
+ if (ld_nr==1) {
+ unsigned long offset=_ELF_DWN_ROUND(at_pagesize,ld[0]->p_offset);
+ unsigned long off =_ELF_RST_ROUND(at_pagesize,ld[0]->p_offset);
+ unsigned long length=_ELF_UP_ROUND(at_pagesize,ld[0]->p_memsz+off);
+ ret=_dl_get_handle();
+ m=(char*)do_map_in(0,length,ld[0]->p_flags,fd,offset);
+ if (m==MAP_FAILED) goto err_out_free;
+ /* zero pad bss */
+ l=ld[0]->p_offset+ld[0]->p_filesz;
+ memset(m+l,0,length-l);
+
+ ret->mem_base=m;
+ ret->mem_size=length;
+ }
+ else if (ld_nr==2) { /* aem... yes Quick & Really Dirty / for the avarage 99% */
+// unsigned long text_addr = _ELF_DWN_ROUND(at_pagesize,ld[0]->p_vaddr); /* do we need this ? */
+ unsigned long text_offset=_ELF_DWN_ROUND(at_pagesize,ld[0]->p_offset);
+ unsigned long text_off =_ELF_RST_ROUND(at_pagesize,ld[0]->p_offset);
+ unsigned long text_size =_ELF_UP_ROUND(at_pagesize,ld[0]->p_memsz+text_off);
+
+ unsigned long data_addr =_ELF_DWN_ROUND(at_pagesize,ld[1]->p_vaddr);
+ unsigned long data_offset=_ELF_DWN_ROUND(at_pagesize,ld[1]->p_offset);
+ unsigned long data_off =_ELF_RST_ROUND(at_pagesize,ld[1]->p_offset);
+ unsigned long data_size =_ELF_UP_ROUND(at_pagesize,ld[1]->p_memsz+data_off);
+ unsigned long data_fsize =_ELF_UP_ROUND(at_pagesize,ld[1]->p_filesz+data_off);
+
+ ret=_dl_get_handle();
+ /* mmap all mem_blocks for *.so */
+ m=(char*)do_map_in(0,text_size+data_size,ld[0]->p_flags,fd,text_offset);
+ if (m==MAP_FAILED) {
+err_out_free:
+ _dl_free_handle(ret);
+ _dl_sys_close(fd);
+ return 0;
+ }
+
+ /* release data,bss part */
+ _dl_sys_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_fsize-l);
+ /* more bss ? */
+ if (data_size>data_fsize) {
+ l=data_size-data_fsize;
+ _dl_sys_mmap(d+data_fsize,l,PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS,-1,0);
+ }
+
+ ret->mem_base=m;
+ ret->mem_size=text_size+data_size;
+ }
+ else {
+ _dl_error_data=fn;
+ _dl_error=7;
+ }
+
+ if (ret) {
+ ++ret->lnk_count;
+ if (flags&RTLD_USER)
+ ret->name=strdup(fn);
+ else
+ ret->name=_dl_lib_strdup(fn);
+ ret->flags=flags;
+ ret->dynamic=(Elf_Dyn*)(m+dyn->p_vaddr);
+ }
+
+ _dl_sys_close(fd);
+ return ret;
+}
+
+/* dynamic section parser */
+static struct _dl_handle* _dl_dyn_scan(struct _dl_handle*dh,Elf_Dyn*_dynamic) {
+ void(*init)(void)=0;
+
+ _dl_rel_t* plt_rel=0;
+ unsigned long plt_relsz=0;
+
+ _dl_rel_t* rel=0;
+ unsigned long relent=0;
+ unsigned long relsize=0;
+
+ int i;
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": pre dynamic scan "); ph((unsigned long)dh); pf("\n");
+#endif
+ for(i=0;_dynamic[i].d_tag;++i) {
+ switch(_dynamic[i].d_tag) {
+ /* this depends on dyn_str_tab -> second run */
+ case DT_NEEDED:
+ case DT_SONAME:
+ break;
+
+ /* BASIC DYNAMIC STUFF */
+ case DT_HASH:
+ dh->hash_tab = (unsigned long*)(dh->mem_base+_dynamic[i].d_un.d_ptr);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have hash @ "); ph((long)dh->hash_tab); pf("\n");
+#endif
+ break;
+ case DT_SYMTAB:
+ dh->dyn_sym_tab = (Elf_Sym*)(dh->mem_base+_dynamic[i].d_un.d_ptr);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have dyn_sym_tab @ "); ph((long)dh->dyn_sym_tab); pf("\n");
+#endif
+ break;
+ case DT_STRTAB:
+ dh->dyn_str_tab = (char*)(dh->mem_base+_dynamic[i].d_un.d_ptr);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have dyn_str_tab @ "); ph((long)dh->dyn_str_tab); pf("\n");
+#endif
+ break;
+
+ /* DYNAMIC INIT/FINI (constructors/destructors) */
+ case DT_FINI:
+ dh->fini = (void(*)(void))(dh->mem_base+_dynamic[i].d_un.d_val);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have fini @ "); ph((long)dh->fini); pf("\n");
+#endif
+ break;
+ case DT_INIT:
+ init = (void(*)(void))(dh->mem_base+_dynamic[i].d_un.d_val);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have init @ "); ph((long)init); pf("\n");
+#endif
+ break;
+
+ /* PLT RELOCATION */
+ case DT_PLTGOT:
+ dh->pltgot = (unsigned long*)(dh->mem_base+_dynamic[i].d_un.d_val);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have plt/got @ "); ph((long)dh->pltgot); pf("\n");
+#endif
+ break;
+ case DT_PLTREL:
+ if (_dynamic[i].d_un.d_val!=_DL_REL_T) {
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have incompatible relocation type\n");
+#endif
+ _dl_error_data=dh->name;
+ _dl_error=6;
+ return 0;
+ }
+ break;
+ case DT_JMPREL:
+ plt_rel = (_dl_rel_t*)(dh->mem_base+_dynamic[i].d_un.d_val);
+ dh->plt_rel = plt_rel;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have jmprel @ "); ph((long)plt_rel); pf("\n");
+#endif
+ break;
+ case DT_PLTRELSZ:
+ plt_relsz = _dynamic[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have pltrelsize @ "); ph((long)plt_relsz); pf("\n");
+#endif
+ break;
+
+ /* BASIC RELOCATION */
+ case DT_REL:
+ rel = (_dl_rel_t*)(dh->mem_base+_dynamic[i].d_un.d_val);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have rel @ "); ph((long)rel); pf("\n");
+#endif
+ break;
+ case DT_RELENT:
+ relent=_dynamic[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have relent @ "); ph((long)relent); pf("\n");
+#endif
+ break;
+ case DT_RELSZ:
+ relsize=_dynamic[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have relsize @ "); ph((long)relsize); pf("\n");
+#endif
+ break;
+
+
+ /* TEXT RELOCATIONS POSSIBLE -> NO SHARED OBJECT */
+ case DT_TEXTREL:
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": found possible textrelocation -> "); pf(dh->name); pf(" is not compiled as a shared library\n");
+#endif
+ _dl_error_data=dh->name;
+ _dl_error=3;
+ return 0;
+ break;
+
+ /* OTHERS */
+ default:
+#ifdef DEBUG
+#if 0
+ pf(__FUNCTION__); pf(": unknown "); ph(_dynamic[i].d_tag); pf(", "); ph(_dynamic[i].d_un.d_val); pf("\n");
+#endif
+#endif
+ break;
+ }
+ }
+
+ for(i=0;_dynamic[i].d_tag;i++) {
+ if (dh->name) { /* librabry can have a SONAME */
+ if (_dynamic[i].d_tag==DT_SONAME) {
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": pre soname: "); pf(dh->name); pf("\n");
+#endif
+ if (dh->flags&RTLD_USER) free(dh->name);
+ dh->flags&=~RTLD_NOSONAME;
+ dh->name = dh->dyn_str_tab+_dynamic[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have soname: "); pf(dh->name); pf("\n");
+#endif
+ }
+ }
+ else { /* programs can have a LD_RUN_PATH */
+ if (_dynamic[i].d_tag==DT_RPATH) {
+ register char *rpath=dh->dyn_str_tab+_dynamic[i].d_un.d_val;
+ _dl_search_rpath=rpath;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": have runpath: "); pf(rpath); pf("\n");
+#endif
+ }
+ }
+ }
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": post dynamic scan "); ph((unsigned long)dh); pf("\n");
+#endif
+
+ if (work_on_pltgot(dh)) {
+ _dl_error_data=dh->name;
+ _dl_error=3;
+ return 0;
+ }
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": pre load depending libraries "); ph((unsigned long)dh); pf("\n");
+#endif
+ /* load depending libs */
+ for(i=0;_dynamic[i].d_tag;++i) {
+ if (_dynamic[i].d_tag==DT_NEEDED) {
+ char *lib_name=dh->dyn_str_tab+_dynamic[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": needed for this lib: "); pf(lib_name); pf("\n");
+#endif
+ _dl_queue_lib(lib_name,dh->flags);
+ }
+ }
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": pre open depending libraries 2 "); ph((unsigned long)dh); pf("\n");
+#endif
+ if (_dl_open_dep()) {
+ return 0;
+ }
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": post load depending libraries, pre resolve "); ph((unsigned long)dh); pf("\n");
+#endif
+
+ /* relocation */
+ if (rel) {
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": try to relocate some values\n");
+#endif
+ if (_dl_relocate(dh,rel,relsize/relent)) return 0;
+ }
+
+ /* do PTL / GOT relocation */
+ if (plt_rel) {
+ _dl_rel_t *tmp,*max=((void*)plt_rel)+plt_relsz;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": rel plt/got\n");
+#endif
+ for(tmp=plt_rel;tmp<max;(char*)tmp=((char*)tmp)+sizeof(_dl_rel_t)) {
+ if ((dh->flags&RTLD_NOW)) {
+ unsigned long sym=(unsigned long)_dl_sym(dh,ELF_R_SYM(tmp->r_info));
+ if (sym) *((unsigned long*)(dh->mem_base+tmp->r_offset))=sym;
+ else {
+ _dl_error_data=dh->name;
+ _dl_error=4;
+ return 0;
+ }
+ }
+ else
+ _DL_REL_PLT(dh->mem_base,tmp);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": rel @ "); ph((long)dh->mem_base+tmp->r_offset); pf(" with type ");
+ ph(ELF_R_TYPE(tmp->r_info)); pf(" and sym "); ph(ELF_R_SYM(tmp->r_info));
+ pf(" -> "); ph(*((unsigned long*)(dh->mem_base+tmp->r_offset))); pf("\n");
+#endif
+ }
+ }
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": post resolve, pre init "); ph((unsigned long)dh); pf("\n");
+#endif
+ if (init) init();
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": post init "); ph((unsigned long)dh); pf("\n");
+#endif
+
+ return dh;
+}
+
+static void*_dl_load(const char*fn,const char*pathname,int fd,int flags) {
+ struct _dl_handle*ret=0;
+ if ((ret=_dl_map_lib(fn,pathname,fd,flags))) {
+ ret=_dl_dyn_scan(ret,ret->dynamic);
+ }
+ return ret;
+}
+
+
+/* ELF AUX parser */
+static void _dl_elfaux(register unsigned long*ui) {
+ register struct elf_aux {
+ unsigned long type;
+ unsigned long val;
+ } *ea;
+
+ while (*ui) ++ui;
+ /* now *ui points to the tailing NULL-pointer of the envirioment */
+
+ /* walk the elf_aux table */
+ for (ea=(struct elf_aux*)(ui+1); ea->type; ++ea) {
+ switch (ea->type) {
+ case AT_EXECFD: /* 2 */
+ /* DIE! DIE! DIE! */
+ pf("kernel gives us an unsupported binary load type...\n");
+ _dl_sys_exit(42);
+ break;
+
+ case AT_PHDR: /* 3 */
+ prog_ph=(Elf_Phdr*)ea->val;
+#ifdef DEBUG
+ pf("program header @ "); ph(ea->val); pf("\n");
+#endif
+ break;
+ case AT_PHENT: /* 4 */
+ prog_ph_size=ea->val;
+#ifdef DEBUG
+ pf("program header size "); ph(ea->val); pf("\n");
+#endif
+ break;
+ case AT_PHNUM: /* 5 */
+ prog_ph_num=ea->val;
+#ifdef DEBUG
+ pf("program header # "); ph(ea->val); pf("\n");
+#endif
+ break;
+
+ case AT_PAGESZ: /* 6 */
+ at_pagesize=ea->val;
+#ifdef DEBUG
+ pf("page size "); ph(ea->val); pf("\n");
+#endif
+ break;
+
+ case AT_BASE: /* 7 */
+ loadaddr=ea->val;
+#ifdef DEBUG
+ pf("interpreter base: "); ph(ea->val); pf("\n");
+#endif
+ break;
+
+#if 0
+ case AT_FLAGS: /* 8 */
+#ifdef DEBUG
+ pf("flags "); ph(ea->val); pf("\n");
+#endif
+ break;
+#endif
+
+ case AT_ENTRY: /* 9 */
+ prog_entry=ea->val;
+#ifdef DEBUG
+ pf("start program @ "); ph(ea->val); pf("\n");
+#endif
+ break;
+
+ case AT_NOTELF: /* 10 */
+ pf("this is an ELF-loader... and therefor can't handle anything else.\n");
+ _dl_sys_exit(42);
+ break;
+
+ case AT_UID: /* 11 */
+ at_uid=ea->val;
+#ifdef DEBUG
+ pf(" UID: "); ph(ea->val); pf("\n");
+#endif
+ break;
+ case AT_EUID: /* 12 */
+ at_euid=ea->val;
+#ifdef DEBUG
+ pf("EUID: "); ph(ea->val); pf("\n");
+#endif
+ break;
+ case AT_GID: /* 13 */
+ at_gid=ea->val;
+#ifdef DEBUG
+ pf(" GID: "); ph(ea->val); pf("\n");
+#endif
+ break;
+ case AT_EGID: /* 14 */
+ at_egid=ea->val;
+#ifdef DEBUG
+ pf("EGID: "); ph(ea->val); pf("\n");
+#endif
+ break;
+
+#if 0
+ case AT_PLATFORM: /* 15 */
+#ifdef DEBUG
+ pf("CPU: "); ph(ea->val); pf("\n");
+#endif
+ break;
+ case AT_HWCAP: /* 16 */
+#ifdef DEBUG
+ pf("CPU capabilities: "); ph(ea->val); pf("\n");
+#endif
+ break;
+ case AT_CLKTCK: /* 17 */
+#ifdef DEBUG
+ pf("CLK per sec "); ph( ea->val); pf("\n");
+#endif
+ break;
+ case AT_FPUCW: /* 18 */
+#ifdef DEBUG
+ pf("FPU control word "); ph( ea->val); pf("\n");
+#endif
+ break;
+#endif
+
+ default:
+ break;
+ }
+ }
+}
+
+
+/* start of libdl dynamic linker */
+static unsigned long _dl_main(int argc,char*argv[],char*envp[],unsigned long _dynamic) {
+ unsigned long*got;
+ struct _dl_handle*prog,*mydh;
+ struct _dl_handle my_dh;
+ Elf_Dyn*prog_dynamic=0;
+ unsigned int i;
+
+ if (0) _dl_main(argc,argv,envp,_dynamic); /* TRICK: no warning */
+
+ /* prepare to bootstarp the relocations */
+ got=get_got();
+ _dl_environ=envp;
+
+ /* run elf_aux (kernel provided misc data) */
+ _dl_elfaux((unsigned long*)envp);
+
+ if (loadaddr==0) {
+ pf("\ndiet libdl.so/dynamic-linker can't be started as a program !\n\n SORRY...\n\n");
+ return (unsigned long)_DIE_;
+ }
+
+ memset(&my_dh,0,sizeof(my_dh));
+ my_dh.mem_base=(char*)loadaddr;
+ my_dh.mem_size=0;
+ my_dh.lnk_count=1024;
+ my_dh.name="libdl.so";
+ my_dh.flags=LDSO_FLAGS;
+
+ got[1]=0; /* NOT YET (my_dh) */
+ got[2]=(unsigned long)_DIE_; /* NO lazy symbol resolver as long as we are not ready */
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": pre scan\n");
+#endif
+ /* bootstrap relocation */
+ if (_dl_dyn_scan(&my_dh,(Elf_Dyn*)_dynamic)==0) {
+ pf("error with dyn_scan myself\n");
+ return (unsigned long)_DIE_;
+ }
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": post scan\n");
+#endif
+
+ /* now we are save to use anything :) (hopefully) */
+
+ fini_entry=tt_fini;
+
+ prog=_dl_get_handle();
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": ugly, ugly, COPY pregenerated handle to real handle\n");
+#endif
+ mydh=_dl_get_handle();
+ {
+ register struct _dl_handle*tmp=mydh->prev;
+ memcpy(mydh,&my_dh,sizeof(struct _dl_handle));
+ mydh->prev=tmp;
+ }
+ got[1]=(unsigned long)mydh;
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": MORE ugly: prepare program...\n");
+#endif
+ for(i=0;(i<prog_ph_num);++i) {
+ if (prog_ph[i].p_type==PT_DYNAMIC) {
+ prog_dynamic=(Elf_Dyn*)prog_ph[i].p_vaddr;
+ break;
+ }
+ }
+ if (prog_dynamic==0) {
+ ph(0xe0000001);
+ pf(" error with program: no dynamic section ?\n");
+ return (unsigned long)_DIE_;
+ }
+ prog->name=0;
+ prog->lnk_count=1024;
+ prog->dynamic=prog_dynamic;
+ prog->flags=LDSO_FLAGS;
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": dyn_scan program...\n");
+#endif
+ if (_dl_dyn_scan(prog,(Elf_Dyn*)prog_dynamic)==0) {
+ _dl_error_location="error in dyn_scan the program";
+ pf(dlerror()); pf("\n");
+ return (unsigned long)_DIE_;
+ }
+
+ /* now start the program */
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": now jump to program entrypoint\n");
+#endif
+ return prog_entry;
+}
+
+#endif
diff --git a/mdk-stage1/dietlibc/libdl/_dl_open.c b/mdk-stage1/dietlibc/libdl/_dl_open.c
index 1f907db21..f7bd0af95 100644
--- a/mdk-stage1/dietlibc/libdl/_dl_open.c
+++ b/mdk-stage1/dietlibc/libdl/_dl_open.c
@@ -1,207 +1,35 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/mman.h>
+#include <fcntl.h>
#include <dlfcn.h>
-#include <linux/elf.h>
+#include <limits.h>
+#ifndef __DIET_LD_SO__
+#include <string.h>
+#endif
#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;
- }
+#ifdef __DIET_LD_SO__
+static
+#endif
+void*_dl_open(const char*filename,int flags) {
+ int fd;
+ char buf[PATH_MAX];
+ const char*p=0;
+
+ for (fd=0;filename[fd] && (p==0);++fd) if (filename[fd]=='/') p=filename;
+ if (p) {
+#ifdef __DIET_LD_SO__
+ if ((fd=_dl_sys_open(p,O_RDONLY,0))<0) fd=-1;
+#else
+ fd=open(p,O_RDONLY);
+#endif
+ } else {
+ p=buf;
+ fd=_dl_search(buf,sizeof(buf)-1,filename);
}
-
- 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();
+ if (fd==-1) {
+ _dl_error_data=filename;
+ _dl_error=1;
+ return 0;
}
- printf("_dl_open post resolv, init\n");
-
- close(fd);
- return ret;
+ return _dl_load(filename,p,fd,flags);
}
diff --git a/mdk-stage1/dietlibc/libdl/_dl_queue.c b/mdk-stage1/dietlibc/libdl/_dl_queue.c
new file mode 100644
index 000000000..5e08020d5
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/_dl_queue.c
@@ -0,0 +1,39 @@
+#include <dlfcn.h>
+#include "_dl_int.h"
+
+#define MAX_QUEUE 64
+
+static int _dl_queue_start=0;
+static int _dl_queue_stop=0;
+
+static struct {
+ const char*name;
+ int flags;
+} _dl_queue[MAX_QUEUE];
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+int _dl_queue_lib(const char*name,int flags) {
+ if (_dl_find_lib(name)==0) {
+ register int tmp;
+ if ((tmp=_dl_queue_stop+1)>=MAX_QUEUE) tmp=0;
+ if (tmp==_dl_queue_start) return -1;
+ _dl_queue[_dl_queue_stop].name=name;
+ _dl_queue[_dl_queue_stop].flags=flags;
+ _dl_queue_stop=tmp;
+ }
+ return 0;
+}
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+int _dl_open_dep() {
+ while (_dl_queue_start!=_dl_queue_stop) {
+ register int tmp=_dl_queue_start;
+ (++_dl_queue_start>=MAX_QUEUE)?_dl_queue_start=0:0;
+ if (!_dlopen(_dl_queue[tmp].name,_dl_queue[tmp].flags)) return 1;
+ }
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libdl/_dl_rel.c b/mdk-stage1/dietlibc/libdl/_dl_rel.c
new file mode 100644
index 000000000..bc8717dc2
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/_dl_rel.c
@@ -0,0 +1,42 @@
+#include <dlfcn.h>
+
+#include "_dl_int.h"
+
+static void exit_now(void) {
+#ifdef DEBUG
+ pf(__func__": symbol not found\n");
+#endif
+ _exit(213);
+}
+
+unsigned long do_rel(struct _dl_handle * tmp_dl, unsigned long off)
+{
+ Elf_Rel *tmp = ((void*)tmp_dl->plt_rel)+off;
+
+ int sym=ELF_R_SYM(tmp->r_info);
+
+ register unsigned long sym_val;
+
+#ifdef DEBUG
+ pf(__func__": "); ph((unsigned long)tmp_dl); pf(" "); ph(off); pf(" on ");
+ ph((long)tmp_dl->plt_rel); pf("\n");
+ pf(__func__": @ "); ph((long)tmp->r_offset); pf(" with type ");
+ ph(ELF_R_TYPE(tmp->r_info)); pf(" and sym "); ph(sym);
+ pf(" symval "); ph(tmp_dl->dyn_sym_tab[sym].st_value); pf("\n");
+#endif
+
+ /* modify GOT for REAL symbol */
+ //sym_val=((unsigned long)(tmp_dl->mem_base+tmp_dl->dyn_sym_tab[sym].st_value));
+ sym_val=(unsigned long)_dl_sym(tmp_dl,sym);
+ *((unsigned long*)(tmp_dl->mem_base+tmp->r_offset))=sym_val;
+
+#ifdef DEBUG
+ pf(__func__": sym "); ph(sym_val); pf("\n");
+#endif
+ /* JUMP (arg sysdep...) */
+ if (sym_val) return sym_val;
+ /* can't find symbol -> die now */
+ return (unsigned long)exit_now;
+}
+
+
diff --git a/mdk-stage1/dietlibc/libdl/_dl_rel.h b/mdk-stage1/dietlibc/libdl/_dl_rel.h
new file mode 100644
index 000000000..948aa5b79
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/_dl_rel.h
@@ -0,0 +1,25 @@
+#ifndef ___DL_REL_H__
+#define ___DL_REL_H__
+
+#if defined(__arm__) || defined(__i386__) || defined(__mips__)
+/* this are REL only archs: arm, i386, mips */
+
+#define _dl_rel_t Elf_Rel
+#define _DL_REL_T DT_REL
+
+#define _DL_REL_PLT(b,r) (*(unsigned long*)((b)+(r)->r_offset)+=(unsigned long)(b))
+
+#elif defined(__alpha__) || defined(__hppa__) || defined(__ppc__) || defined(__sparc__) || defined(__s390__)
+/* this are RELA only archs: alpha, chris, hppa, ia64, m68k, ppc, sparc, sparc64, sh, s390 */
+
+#define _dl_rel_t Elf_Rela
+#define _DL_REL_T DT_RELA
+
+#define _DL_REL_PLT(b,r) (*(unsigned long*)((b)+(r)->r_offset)=(unsigned long)((b)+(r)->r_addend))
+
+#else
+/* there are no known linux supported arch with mixed relocation types ... */
+#error "_dl_rel.h: NOT SUPPORTED"
+#endif
+
+#endif
diff --git a/mdk-stage1/dietlibc/libdl/_dl_relocate.c b/mdk-stage1/dietlibc/libdl/_dl_relocate.c
new file mode 100644
index 000000000..e91e48ccf
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/_dl_relocate.c
@@ -0,0 +1,96 @@
+#include "_dl_int.h"
+
+#include "_dl_rel.h"
+
+#if 0
+/*--- are other relocation types vital to shared objects ? ---*/
+
+ R_386_NONE 0 /* No reloc */
+ R_386_32 1 /* Direct 32 bit */
+ R_386_COPY 5 /* Copy symbol at runtime ?!? */
+ R_386_GLOB_DAT 6 /* Create GOT entry */
+ R_386_JMP_SLOT 7 /* Create PLT entry */
+ R_386_RELATIVE 8 /* Adjust by program base */
+
+ R_ARM_NONE 0 /* No reloc */
+ R_ARM_ABS32 2 /* Direct 32 bit */
+ R_ARM_COPY 20 /* Copy symbol at runtime */
+ R_ARM_GLOB_DAT 21 /* Create GOT entry */
+ R_ARM_JUMP_SLOT 22 /* Create PLT entry */
+ R_ARM_RELATIVE 23 /* Adjust by program base */
+
+#endif
+
+static int _dl_apply_relocate(struct _dl_handle*dh,_dl_rel_t*rel) {
+ int typ,ret=0;
+ Elf_Addr*loc;
+
+ loc=(Elf_Addr *)(dh->mem_base+rel->r_offset);
+
+#ifdef DEBUG
+#if 0
+ pf(__FUNCTION__); pf(": "); ph(ELF_R_TYPE(rel->r_info)); pf(" @ "); ph((unsigned long)loc);
+ pf(" preval "); ph(*(unsigned long*)loc); pf("\n");
+#endif
+#endif
+
+ typ=ELF_R_TYPE(rel->r_info);
+
+#ifdef __i386__
+ if (typ==R_386_32) { /* 1 */
+ *loc=(unsigned long)(dh->mem_base+dh->dyn_sym_tab[ELF_R_SYM(rel->r_info)].st_value);
+ } else if (typ==R_386_COPY) { /* 5 */
+ int len=dh->dyn_sym_tab[ELF_R_SYM(rel->r_info)].st_size;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": R_386_COPY !\n");
+#endif
+ memcpy(loc,(void*)(unsigned long)_dl_sym(dh,ELF_R_SYM(rel->r_info)),len);
+ } else if (typ==R_386_GLOB_DAT) { /* 6 */
+ *loc=(unsigned long)_dl_sym(dh,ELF_R_SYM(rel->r_info));
+ } else if (typ==R_386_JMP_SLOT) { /* 7 */
+ *loc+=(unsigned long)dh->mem_base;
+ } else if (typ==R_386_RELATIVE) { /* 8 */
+ *loc+=(unsigned long)dh->mem_base;
+ } else if (typ==R_386_NONE) { /* 0 */
+ } else
+ ret=1;
+#endif
+#ifdef __arm__
+ if (typ==R_ARM_ABS32) { /* 2 */
+ *loc=(unsigned long)(dh->mem_base+dh->dyn_sym_tab[ELF_R_SYM(rel->r_info)].st_value);
+ } else if (typ==R_ARM_COPY) { /* 20 */
+ int len=dh->dyn_sym_tab[ELF_R_SYM(rel->r_info)].st_size;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": R_ARM_COPY !\n");
+#endif
+ memcpy(loc,(void*)(unsigned long)_dl_sym(dh,ELF_R_SYM(rel->r_info)),len);
+ } else if (typ==R_ARM_GLOB_DAT) { /* 21 */
+ *loc=(unsigned long)_dl_sym(dh,ELF_R_SYM(rel->r_info));
+ } else if (typ==R_ARM_JUMP_SLOT) { /* 22 */
+ *loc+=(unsigned long)dh->mem_base;
+ } else if (typ==R_ARM_RELATIVE) { /* 23 */
+ *loc+=(unsigned long)dh->mem_base;
+ } else if (typ==R_ARM_NONE) { /* 0 */
+ } else
+ ret=1;
+#endif
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": @ "); ph((unsigned long)loc); pf(" val "); ph(*(unsigned long*)loc); pf("\n");
+#endif
+ return ret;
+}
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+int _dl_relocate(struct _dl_handle*dh,_dl_rel_t *rel,int num) {
+ int i;
+ for (i=0;i<num;i++) {
+ if (_dl_apply_relocate(dh,rel+i)) {
+ _dl_error=4;
+ return 1;
+ }
+ }
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libdl/_dl_search.c b/mdk-stage1/dietlibc/libdl/_dl_search.c
index 5e3217d46..ccf9c51c5 100644
--- a/mdk-stage1/dietlibc/libdl/_dl_search.c
+++ b/mdk-stage1/dietlibc/libdl/_dl_search.c
@@ -1,68 +1,95 @@
-#include <unistd.h>
#include <stdlib.h>
-#include <string.h>
#include <dlfcn.h>
#include <fcntl.h>
-#include <stdio.h>
+
+#include "_dl_int.h"
#define WANT_LD_SO_CONF_SEARCH
static const char *_dl_search_rpath=0;
+
+#ifndef __DIET_LD_SO__
+#include <unistd.h>
+#include <string.h>
void _dl_set_rpath(const char *path) { _dl_search_rpath=path; }
+const char* _dl_get_rpath() { return _dl_search_rpath; }
+#endif
/* 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;
+static int _dl_search_path(char*buf,int len,const char*path,const int pathlen,const char*filename) {
+ int fd,i=1,fl=strlen(filename),ml=len-fl;
+ const char*c,*pe=path+pathlen;
if (path) {
- for (c=path; c<pe; c+=i) {
+ for (c=path;c<pe;c+=i) {
+ int l=len-1;
if ((*c==':')||(*c==';')) ++c;
i=strcspn(c,":;");
if (i) {
- strncpy(buf, c, i); buf[i]=0;
- l-=i;
- strncat(buf, "/", l);
+ if (i>ml) continue; /* if len(path-entry)+len(filename)+2 is greater than the buffer ? SKIP */
+ memcpy(buf,c,i);
+ buf[i]='/';
+ l-=++i;
}
- else
- buf[0]=0;
- strncat(buf, filename, --l);
-// printf("_dl_search: %s\n",buf);
+ memcpy(buf+i,filename,fl);
+ buf[i+fl]=0;
+#ifdef DEBUG
+// pf(__func__": "); pf(buf); pf("\n");
+#endif
+#ifdef __DIET_LD_SO__
+ if ((fd=_dl_sys_open(buf,O_RDONLY,0))>-1) return fd;
+#else
if ((fd=open(buf,O_RDONLY))!=-1) return fd;
+#endif
}
}
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)
-{
+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) {
+ int i,l,fd;
+#ifdef __DIET_LD_SO__
+ if ((fd=_dl_sys_open(conf,O_RDONLY,0))>-1) {
+ l=_dl_sys_read(fd,ld_so_conf,sizeof(ld_so_conf)-1);
+#else
+ if ((fd=open(conf,O_RDONLY))!=-1) {
l=read(fd,ld_so_conf,sizeof(ld_so_conf)-1);
+#endif
ld_so_conf[sizeof(ld_so_conf)-1]=0;
+#ifdef __DIET_LD_SO__
+ _dl_sys_close(fd);
+#else
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;
+#endif
+ if (l>0) {
+ 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)
-{
+#ifdef __DIET_LD_SO__
+static
+#endif
+int _dl_search(char*buf,int len,const char*filename) {
int fd;
- /* 1. search the LD_RUN_PATH (from the executable */
+ /* 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()) {
+#ifdef __DIET_LD_SO__
+ if ((at_uid==at_euid)&&(at_gid==at_egid)) {
+#else
+ if ((getuid()==geteuid())&&(getgid()==getegid())) {
+#endif
char *p=getenv("LD_LIBRARY_PATH");
if (p)
if ((fd=_dl_search_path(buf,len,p,strlen(p),filename))!=-1) return fd;
@@ -78,7 +105,7 @@ int _dl_search(char *buf, int len, const char *filename)
/* default path search */
{
- const char* def_path="/usr/lib:/lib";
+ 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
index 384550c47..6fafedcf5 100644
--- a/mdk-stage1/dietlibc/libdl/dlclose.c
+++ b/mdk-stage1/dietlibc/libdl/dlclose.c
@@ -1,14 +1,38 @@
+#include <sys/mman.h>
+
#include "_dl_int.h"
-int dlclose (void *handle)
-{
- if (handle) {
- struct _dl_handle *h = handle;
- if (h->lnk_count) {
- --h->lnk_count;
- return -1;
+static void dec_referenced_libs(struct _dl_handle*dh) {
+ Elf_Dyn* dyn_tab=dh->dynamic;
+ int i;
+ for(i=0;dyn_tab[i].d_tag;i++) {
+ if (dyn_tab[i].d_tag==DT_NEEDED) {
+ char *lib_name=dh->dyn_str_tab+dyn_tab[i].d_un.d_val;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": lib: "); pf(lib_name); pf("\n");
+#endif
+ dlclose(_dl_find_lib(lib_name));
}
- if (munmap(h->mem_base,h->mem_size)!=0) return -1;
+ }
+}
+
+int dlclose(void*handle) {
+ _dl_error_location="dlclose";
+ if (handle) {
+ struct _dl_handle*dh=handle;
+ if (--(dh->lnk_count)) return 0; /* not yet unreferenced */
+
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": "); pf(dh->name); pf("\n");
+#endif
+ if (dh->fini) dh->fini();
+ dec_referenced_libs(dh);
+#ifdef __DIET_LD_SO__
+ if (_dl_sys_munmap(dh->mem_base,dh->mem_size)<0) return -1;
+#else
+ if (munmap(dh->mem_base,dh->mem_size)==-1) return -1;
+#endif
+ _dl_free_handle(handle);
}
return 0;
}
diff --git a/mdk-stage1/dietlibc/libdl/dlerror.c b/mdk-stage1/dietlibc/libdl/dlerror.c
index 1e31bae54..3fea0b75c 100644
--- a/mdk-stage1/dietlibc/libdl/dlerror.c
+++ b/mdk-stage1/dietlibc/libdl/dlerror.c
@@ -1,4 +1,55 @@
-const char *dlerror(void)
-{
- return "HAE ?!?";
+
+#include "_dl_int.h"
+
+#ifdef __DIET_LD_SO__
+static unsigned int _dl_error;
+static const char*_dl_error_location;
+static const char*_dl_error_data;
+#else
+#include <string.h>
+unsigned int _dl_error;
+const char*_dl_error_location;
+const char*_dl_error_data;
+#endif
+
+static struct _dl_err_msg {
+ char*msg;
+ int len;
+} _dl_error_msg[]={
+#define MSG(n) { (n), sizeof((n))-1 }
+ MSG("can't open: "), /* 1 */
+ MSG("can't stat: "), /* 2 */
+ MSG("shared object is not position independent: "), /* 3 */
+ MSG("can't resolve all symbols in: "), /* 4 */
+ MSG("can't find symbol: "), /* 5 */
+ MSG("invalid relocation type in: "), /* 6 */
+ MSG("internal error: layout not yet supported: "), /* 7 */
+};
+
+const char *dlerror(void) {
+ static char buf[1024],*p=buf;
+ register int l,len=sizeof(buf)-1;
+ if (_dl_error==0) return 0;
+
+ buf[0]=0;
+ buf[len]=0;
+ --_dl_error;
+
+ if (_dl_error>=(sizeof(_dl_error_msg)/sizeof(struct _dl_err_msg)))
+ return "HAE ?!?";
+
+ if (_dl_error_location) {
+ l=strlen(_dl_error_location);
+ strncpy(p,_dl_error_location,len); len-=l; p+=l;
+ strncpy(p,": ",len); len-=2; p+=2;
+ }
+ l=_dl_error_msg[_dl_error].len;
+ strncpy(p,_dl_error_msg[_dl_error].msg,len); len-=l; p+=l;
+ strncpy(p,_dl_error_data,len);
+
+ _dl_error_location=0;
+ _dl_error_data="";
+ _dl_error=0;
+
+ return buf;
}
diff --git a/mdk-stage1/dietlibc/libdl/dlopen.c b/mdk-stage1/dietlibc/libdl/dlopen.c
index 1693d889f..79fa7903c 100644
--- a/mdk-stage1/dietlibc/libdl/dlopen.c
+++ b/mdk-stage1/dietlibc/libdl/dlopen.c
@@ -2,20 +2,25 @@
#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);
+#include "_dl_int.h"
-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);
+#ifdef __DIET_LD_SO__
+static
+#endif
+void*_dlopen(const char *filename, int flags) {
+ struct _dl_handle* ret;
+ if (filename) {
+ if ((ret=_dl_find_lib(filename))) {
+ ++(ret->lnk_count); /* add a reference */
+ return ret;
+ }
+ return _dl_open(filename,flags);
}
+ /* return 1 as an indicator for dlsym to search ALL global objects */
+ return RTLD_DEFAULT;
+}
- return _dl_open(p,fd,flag);
+void*dlopen(const char *filename, int flags) {
+ _dl_error_location="dlopen";
+ return _dlopen(filename,flags|RTLD_USER|RTLD_NOSONAME);
}
diff --git a/mdk-stage1/dietlibc/libdl/dlsym.c b/mdk-stage1/dietlibc/libdl/dlsym.c
index 2af940837..c58bb4d11 100644
--- a/mdk-stage1/dietlibc/libdl/dlsym.c
+++ b/mdk-stage1/dietlibc/libdl/dlsym.c
@@ -1,7 +1,92 @@
#include "_dl_int.h"
-void *dlsym(void *handle, char *symbol)
-{
- printf("dlsym(%08x,%s) -> %08x\n",handle,symbol,elf_hash(symbol)%17);
- return 0;
+#include "elf_hash.h"
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+void *_dlsym(void*handle,char*symbol) {
+ unsigned long*sym=0;
+ if (handle) {
+ struct _dl_handle*dh=(struct _dl_handle*)handle;
+ unsigned long hash =elf_hash(symbol);
+ unsigned long bhash=hash%HASH_BUCKET_LEN(dh->hash_tab);
+ unsigned long*chain=HASH_CHAIN(dh->hash_tab);
+ unsigned long ind;
+ char *name=dh->dyn_str_tab;
+
+#ifdef DEBUG
+// pf(__FUNCTION__); pf(": bucket("); ph(bhash); pf(",\""); pf(symbol); pf("\")\n");
+#endif
+
+ ind=HASH_BUCKET(dh->hash_tab)[bhash];
+#ifdef DEBUG
+// pf(__FUNCTION__); pf(": chain ("); ph(ind); pf(",\""); pf(symbol); pf("\")\n");
+#endif
+
+ while(ind) {
+ int ptr=dh->dyn_sym_tab[ind].st_name;
+#ifdef DEBUG
+// pf(__FUNCTION__); pf(": symbol(\""); pf(name+ptr); pf("\",\"); pf(symbol); pf("\")\n");
+#endif
+ if (strcmp(name+ptr,symbol)==0) {
+ if (ELF_ST_TYPE(dh->dyn_sym_tab[ind].st_shndx)!=0) {
+ sym=(long*)(dh->mem_base+dh->dyn_sym_tab[ind].st_value);
+ break; /* ok found ... */
+ }
+ }
+ ind=chain[ind];
+ }
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": symbol \""); pf(symbol); pf("\" @ "); ph((long)sym); pf("\n");
+#endif
+ }
+ return sym;
+}
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+void*_dl_sym_search_str(struct _dl_handle*dh,char*name) {
+ void *sym=0;
+ struct _dl_handle*tmp;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": search for: "); pf(name); pf("\n");
+#endif
+ for (tmp=_dl_root_handle;tmp && (!sym);tmp=tmp->next) {
+// if (!(tmp->flags&RTLD_GLOBAL)) continue;
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": searching in "); pf(tmp->name); pf("\n");
+#endif
+ sym=_dlsym((void*)tmp,name);
+#ifdef DEBUG
+ if (sym) { pf(__FUNCTION__); pf(": found: "); pf(name); pf(" @ "); ph((long)sym); pf("\n"); }
+#endif
+ }
+ return sym;
+}
+
+#ifdef __DIET_LD_SO__
+static
+#endif
+void*_dl_sym(struct _dl_handle*dh,int symbol) {
+ char *name=dh->dyn_str_tab+dh->dyn_sym_tab[symbol].st_name;
+ void*sym=_dl_sym_search_str(dh,name);
+#ifdef DEBUG
+ pf(__FUNCTION__); pf(": "); ph(symbol); pf(" -> "); ph((long)sym); pf("\n");
+#endif
+ return sym;
+}
+
+void*dlsym(void*handle,char*symbol) {
+ void*h;
+ if (handle==RTLD_DEFAULT || !handle /* RTLD_DEFAULT is NULL on glibc */ )
+ h=_dl_sym_search_str(0,symbol);
+ else h=_dlsym(handle,symbol);
+ if (h==0) {
+ _dl_error_location="dlsym";
+ _dl_error_data=symbol;
+ _dl_error=5;
+ }
+ return h;
}
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/libdl/elf_hash.h b/mdk-stage1/dietlibc/libdl/elf_hash.h
new file mode 100644
index 000000000..be55982ea
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/elf_hash.h
@@ -0,0 +1,10 @@
+static 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/libdl/test/test.c b/mdk-stage1/dietlibc/libdl/test/test.c
new file mode 100644
index 000000000..d467134ba
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/test/test.c
@@ -0,0 +1,20 @@
+#include <dlfcn.h>
+
+int main(int argc, char **argv)
+{
+ void *Hlib;
+
+// if (Hlib=dlopen("libtest.so", RTLD_LAZY)) {
+ if (Hlib=dlopen("libtest.so", RTLD_NOW)) {
+ void (*t)(void) = dlsym(Hlib,"test");
+ if (t) {
+ printf("test @ %08lx\n",(long)t);
+ t();
+ }
+ dlclose(Hlib);
+ }
+ else {
+ printf("%s\n",dlerror());
+ }
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libdl/test/test_so.c b/mdk-stage1/dietlibc/libdl/test/test_so.c
new file mode 100644
index 000000000..09d243c56
--- /dev/null
+++ b/mdk-stage1/dietlibc/libdl/test/test_so.c
@@ -0,0 +1,11 @@
+
+int* test();
+
+int err
+=(int)test
+;
+
+int* test() {
+ write(1,"helo\n",5);
+ return &err;
+}
diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c b/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c
index b0c3605b0..5a6361442 100644
--- a/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c
+++ b/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c
@@ -1,5 +1,6 @@
#include <ctype.h>
-int iscntrl(int c) {
+int iscntrl(int x) {
+ unsigned char c=x&0xff;
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
index c8d4a5df0..e79a19e52 100644
--- a/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c
+++ b/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c
@@ -1,4 +1,7 @@
-int isgraph(int c) {
+#include <ctype.h>
+
+int isgraph(int x) {
+ unsigned char c=x&0xff;
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
index cab1a5171..c5ad18d1e 100644
--- a/mdk-stage1/dietlibc/liblatin1/latin1-islower.c
+++ b/mdk-stage1/dietlibc/liblatin1/latin1-islower.c
@@ -1,5 +1,6 @@
#include <ctype.h>
int islower(int c) {
- return (c>='a' && c<='z') || (c>=223 && c<=255 && c!=247);
+ unsigned char x=c&0xff;
+ return (x>='a' && x<='z') || (x>=223 && x<=255 && x!=247);
}
diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c b/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c
index f632483a0..9493892b1 100644
--- a/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c
+++ b/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c
@@ -1,4 +1,6 @@
+#include <ctype.h>
-int isprint(int c) {
+int isprint(int x) {
+ unsigned char c=x&0xff;
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
index 1c1d59db8..a024548fd 100644
--- a/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c
+++ b/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c
@@ -1,5 +1,6 @@
#include <ctype.h>
int isupper(int c) {
- return (c>='A' && c<='Z') || (c>=192 && c<=222 && c!=215);
+ unsigned char x=c&0xff;
+ return (x>='A' && x<='Z') || (x>=192 && x<=222 && x!=215);
}
diff --git a/mdk-stage1/dietlibc/libm/acosh.c b/mdk-stage1/dietlibc/libm/acosh.c
new file mode 100644
index 000000000..a09a4c9f0
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/acosh.c
@@ -0,0 +1,6 @@
+#include <math.h>
+
+double acosh ( double x )
+{
+ return log ( x + sqrt (x*x - 1.) );
+}
diff --git a/mdk-stage1/dietlibc/libm/asinh.c b/mdk-stage1/dietlibc/libm/asinh.c
new file mode 100644
index 000000000..49c6b467f
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/asinh.c
@@ -0,0 +1,6 @@
+#include <math.h>
+
+double asinh ( double x )
+{
+ return log ( x + sqrt (x*x + 1.) );
+}
diff --git a/mdk-stage1/dietlibc/libm/atanh.c b/mdk-stage1/dietlibc/libm/atanh.c
new file mode 100644
index 000000000..bdb3367be
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/atanh.c
@@ -0,0 +1,8 @@
+#include <math.h>
+
+extern const float __half;
+
+double atanh ( double x )
+{
+ return __half * log ( (1.+x) / (1.-x) );
+}
diff --git a/mdk-stage1/dietlibc/libm/bessel.c b/mdk-stage1/dietlibc/libm/bessel.c
new file mode 100644
index 000000000..ba8a1afcb
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/bessel.c
@@ -0,0 +1,171 @@
+/*--------------------------------------------------------------------------*
+
+Name j0, j1, jn - Bessel functions
+ y0, y1, yn - Weber functions
+
+Usage double j0 (double x);
+ double j1 (double x);
+ double jn (int n, double x);
+ double y0 (double x);
+ double y1 (double x);
+ double yn (int n, double x);
+
+Prototype in math.h
+
+Description j0, j1 and jn calculate the Bessel function.
+ y0, y1 and yn calcualte the Weber function.
+
+Return value return their return values as doubles.
+
+*---------------------------------------------------------------------------*/
+
+#include <math.h>
+
+#define M_C 0.5772156649015328
+#if 0
+#define M_1_PI 0.318309886183790671538
+#define M_2_PI 0.636619772367581343076
+#define M_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148
+#endif
+
+
+#define EXPL(x) ((((short *)&x)[4] & 0x7FFF) >> 0)
+#define EXPD(x) ((((short *)&x)[3] & 0x7FF0) >> 4)
+#define EXPF(x) ((((short *)&x)[1] & 0x7F80) >> 7)
+
+#define SQUARE(x) (long) (My - (x) * (x) )
+
+
+static long double P ( int My, double* x )
+{
+ long double Sum = 0.;
+ long double Fact = 1.;
+ long double z182 = -0.015625 / (x[0] * x[0]);
+ register int i;
+
+ for ( i = 1; ; i += 2 ) {
+ Fact *= SQUARE(i+i-1) * SQUARE(i+i+1) * z182 / (i*(i+1));
+ if ( EXPL (Fact) < 0x3FFF-53 )
+ break;
+ Sum += Fact;
+ }
+ return 1. + Sum;
+}
+
+static long double Q ( int My, double* x )
+{
+ long double Fact = (My-1) / x[0] * 0.125;
+ long double Sum = Fact;
+ long double z182 = -0.015625 / (x[0]*x[0]);
+ register int i;
+
+ for ( i = 2; ; i += 2 ) {
+ Fact *= SQUARE(i+i-1) * SQUARE(i+i+1) * z182 / (i*(i+1));
+ if ( EXPL (Fact) < 0x3FFF-53 )
+ break;
+ Sum += Fact;
+ }
+ return Sum;
+}
+
+
+static long double ___jn ( int n, double* x )
+{
+ long double Sum;
+ long double Fact;
+ long double y;
+ register int i;
+ double xx;
+ long double Xi;
+ int My;
+
+ if ( n < 0 )
+ return n & 1 ? ___jn (-n, x) : -___jn (-n, x);
+
+ if ((x[0] >= 17.7+0.0144*(n*n))) {
+ Xi = x[0] - M_PI * (n*0.5 + 0.25);
+ My = n*n << 2;
+
+ return sqrt ( M_2_PI/x[0] ) * ( P(My,x) * cos(Xi) - Q(My,x) * sin(Xi) );
+ }
+ xx = x[0] * 0.5;
+ Sum = 0.;
+ Fact = 1.;
+ y = -xx * xx;
+
+ for ( i = 1; i <= n; i++ )
+ Fact *= xx/i;
+ for ( i = 1; ; i++ ) {
+ Sum += Fact;
+ Fact *= y / (i*(n+i));
+ if ( EXPL (Sum) - EXPL(Fact) > 53 || !EXPL(Fact) )
+ break;
+ }
+ return Sum;
+}
+
+
+static long double ___yn ( int n, double* x )
+{
+ long double Sum1;
+ long double Sum2;
+ long double Fact1;
+ long double Fact2;
+ long double F1;
+ long double F2;
+ long double y;
+ register int i;
+ double xx;
+ long double Xi;
+ unsigned int My;
+
+ if ( EXPD (x[0]) == 0 )
+ return -1./0.; /* ignore the gcc warning, this is intentional */
+
+ if ( (x[0] >= (n>=32 ? 25.8 : (n<8 ? 17.4+0.1*n : 16.2+0.3*n))) ) {
+ Xi = x[0] - M_PI * (n*0.5+0.25);
+ My = n*n << 2;
+
+ return sqrt ( M_2_PI / x[0] ) * ( P(My,x) * sin(Xi) + Q(My,x) * cos(Xi) );
+ }
+
+ Sum1 = Sum2 = F1 = F2 = 0;
+ Fact1 = 1. / (xx = x[0] * 0.5 );
+ Fact2 = 1.;
+ y = xx*xx;
+
+ for ( i = 1; i < n; i++ )
+ Fact1 *= (n-i) / xx;
+
+ for ( i = 1; i <= n; i++ ) {
+ Sum1 += Fact1;
+ if ( i == n )
+ break;
+ Fact1 *= y/(i*(n-i));
+ }
+
+ for (i=1; i<=n; i++) {
+ Fact2 *= xx / i;
+ F1 += 1. / i;
+ }
+
+ for ( i = 1; ; i++ ) {
+ Sum2 += Fact2 * (F1+F2);
+ Fact2 *= -y / (i*(n+i));
+ if ( EXPL (Sum2) - EXPL (Fact2) > 53 || !EXPL (Fact2) )
+ break;
+ F1 += 1. / (n+i);
+ F2 += 1. / i;
+ }
+
+ return M_1_PI * (2. * (M_C + log(xx)) * ___jn (n, x) - Sum1 - Sum2);
+}
+
+
+double j0 ( double x ) { return ___jn ( 0,&x ); }
+double j1 ( double x ) { return ___jn ( 1,&x ); }
+double jn ( int n, double x ) { return ___jn ( n,&x ); }
+double y0 ( double x ) { return ___yn ( 0,&x ); }
+double y1 ( double x ) { return ___yn ( 1,&x ); }
+double yn ( int n, double x ) { return ___yn ( n,&x ); }
+
diff --git a/mdk-stage1/dietlibc/libm/cosh.c b/mdk-stage1/dietlibc/libm/cosh.c
new file mode 100644
index 000000000..f64d59106
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/cosh.c
@@ -0,0 +1,9 @@
+#include <math.h>
+
+extern const float __half;
+
+double cosh ( double x )
+{
+ long double y = exp (x);
+ return (y + 1./y) * __half;
+}
diff --git a/mdk-stage1/dietlibc/libm/erf.c b/mdk-stage1/dietlibc/libm/erf.c
new file mode 100644
index 000000000..63f52d81f
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/erf.c
@@ -0,0 +1,95 @@
+#include "dietlibm.h"
+
+/*--------------------------------------------------------------------------*
+ z
+ 1 | -x²/2
+Name erf(z) = --------- | e dx
+ sqrt(2pi) |
+ 0
+
+ oo
+ 1 | -x²/2
+ erfc(z) = -------- | e dx
+ sqrt(2pi) |
+ z
+
+Usage double erf (double x);
+ double erfc(double x);
+
+Prototype in math.h
+
+Description erf(x) is the probability a normal distributed event occures
+ within the range [0,x]. erfc(x) is the probability a normal
+ distributed event occures within the range [x,oo].
+
+Return value return their respective function value.
+
+*---------------------------------------------------------------------------*/
+
+
+/* even function in (0): Coefficients for gamma(0) */
+
+static const double tab1 [9 + 1] = {
+ 0.398942280401432677926, -0.066490380066905446321, 9.97355701003581694794E-3, -1.18732821548045439878E-3, 1.15434687616155288764E-4, -9.44465625950361453450E-6, 6.65969351631665127484E-7, -4.12266741486268888409E-8, 2.27352982437280636972E-9, -1.13011716416192129505E-10
+};
+
+/* non even or odd function in (x), x>0: Coefficients for gamma(x), x>0 */
+
+static const double tab2 [] [31 + 1] = {
+ { -0.158655253931457051468, +0.241970724519143349823, -0.120985362259571674911, 0, +0.0201642270432619458197, -4.03284540865238916394E-3, -2.01642270432619458197E-3, +7.68161030219502697887E-4, +1.20025160971797296538E-4, -8.80184513793180174807E-5, -1.86705805956129127862E-6, +7.37124220917704609315E-6, -4.72826391707080259142E-7, -4.83395817951682973566E-7, +6.57036391970156141055E-8, +2.5544260402922190768E-8, -5.4292285616752144141E-9, -1.08932444506260820153E-9, +3.44399256708718202774E-10, +3.6021429664641554881E-11, -1.81147204852239925966E-11, -7.66935128389784976374E-13, +8.19047721646461768154E-13, -3.78144699611990981391E-15, -3.24856460059989147863E-14, +1.44438130842455313227E-15, +1.14391687912824634892E-15, -9.38053726039148625184E-17, -3.59908648108845288945E-17, +4.36020846676166022246E-18, +1.01298640134330880603E-18, -1.68640470512244526894E-19 },
+ { -0.0227501319481792072104, +0.0539909665131880519553, -0.0539909665131880519553, +0.0269954832565940259776, -4.49924720943233766301E-3, -2.24962360471616883129E-3, +1.34977416282970129877E-3, -1.17837426913704081544E-4, -1.15159303574756261652E-4, +3.70473728554448438507E-5, +2.82690796888936559912E-6, -3.54513195524355369855E-6, +3.76695631261094890352E-7, +1.92024079214184701051E-7, -5.22690859049557191018E-8, -4.91799344974114749666E-9, +3.66377919234006038965E-9, -1.5981997209104676352E-10, -1.73812379171063320997E-10, +2.62403075313043113473E-11, +5.60918720760414713346E-12, -1.72126983666416144614E-12, -8.63428809787622525331E-14, +7.89441765474563834480E-14, -3.13747960081562321348E-15, -2.77519506625391157547E-15, +3.29321944203493138076E-16, +7.44375150395529134369E-17, -1.66428523299294690222E-17, -1.32735612757620496568E-18, +6.24122437514304644794E-19, +1.12471123532438919306E-21 },
+ { -1.3498980316300945272E-3, +4.43184841193800717687E-3, -6.64777261790701076574E-3, +5.90913121591734290293E-3, -3.32388630895350538287E-3, +1.10796210298450179421E-3, -1.10796210298450179595E-4, -8.44161602273906129349E-5, +4.35270826172482847927E-5, -6.30190085030867423515E-6, -1.9785037553294674925E-6, +1.05520200284238266374E-6, -1.13913852579575399458E-7, -4.81174572974454799623E-8, +1.78216871733806513653E-8, -5.85637697215219690327E-10, -9.29791350219350980904E-10, +1.96377023046901260016E-10, +1.58870373467897094393E-11, -1.22699105512396660364E-11, +1.08794270836433192571E-12, +3.99646995170699427940E-13, -1.01594404465456044793E-13, -3.33469605506835759271E-15, +4.46588935876766499879E-15, -4.08076707607833277747E-16, -1.17808602368979218862E-16, +2.76224909899945482352E-17, +1.09206599392049874162E-18, -1.03145418746203977253E-18, +6.79984672177279963209E-20, +2.55831283729070534712E-20 },
+ { -3.16712418331199212695E-5, +1.33830225764885351832E-4, -2.67660451529770703664E-4, +3.34575564412213379613E-4, -2.89965489157251595673E-4, +1.8178605666396926958E-4, -8.25286392216793003064E-5, +2.55180251904870680833E-5, -3.91665839292075186649E-6, -7.40182052221464123606E-7, +6.44220233592652481453E-7, -1.73701553397390201613E-7, +9.09595464817154590424E-9, +9.44943118114780783705E-9, -3.29957075383376125942E-9, +2.94920746951281580686E-10, +1.18744773902482360274E-10, -4.42039585809856402486E-11, +3.61422484008923382324E-12, +1.43638335494248833511E-12, -4.58476794992724591068E-13, +2.23496663226445199624E-14, +1.57839046076890756440E-14, -3.67258220998453293248E-15, -1.69716269032291432153E-17, +1.43497778353923791279E-16, -2.14499365995613073838E-17, -1.93255135682867953692E-18, +1.01377499752128183701E-18, -7.55713215369572830154E-20, -2.25510650946079103289E-20, +5.26633993110171917109E-21 },
+ { -2.86651571879193912033E-7, +1.48671951473429770924E-6, -3.7167987868357442731E-6, +5.9468780589371908374E-6, -6.81413110919886450076E-6, +5.92209940035828587496E-6, -4.02653201907205629582E-6, +2.17108246596119665457E-6, -9.25512396325170449452E-7, +3.03096091545533908077E-7, -6.92802772105295808398E-8, +6.69226396924248971087E-9, +2.46006252876483997508E-9, -1.41806830376639605249E-9, +3.44251040657349801884E-10, -2.6965166176434937652E-11, -1.16546962748761528049E-11, +4.91490145086991326748E-12, -7.55854519365765424197E-13, -4.53988828124843593484E-14, +4.71533558309731405623E-14, -9.17323049919073092370E-15, +4.35542982587998484108E-17, +3.71238868922011013332E-16, -7.90772907386322623053E-17, +1.58463483904927528072E-18, +2.61503941976309571331E-18, -5.40699423853895351239E-19, +6.61825040533797444037E-21, +1.68378440730394776550E-20, -3.01930850797704474581E-21, -3.80658085177617928332E-23 },
+ { -9.8658764503769814198E-10, +6.07588284982328549581E-9, -1.82276485494698564874E-8, +3.54426499573024987263E-8, -5.01260335110421053478E-8, +5.48348427196551516061E-8, -4.81513715848495375522E-8, +3.47446467489597046263E-8, -2.08994095347716137282E-8, +1.0554987922587771203E-8, -4.4752674615729637229E-9, +1.57746505810079893253E-9, -4.49697115294871911476E-10, +9.63210042443717269402E-11, -1.16300711402336909847E-11, -1.31070037808191623761E-12, +1.16993345829435057496E-12, -3.40636420312606285351E-13, +5.23724821541706939045E-14, +3.93541148139975862961E-16, -2.59886413069218394637E-15, +7.24729556829529838503E-16, -8.51485747763574768020E-17, -7.86503719948806184368E-18, +5.35986191777031053618E-18, -9.84873767617830925356E-19, +2.93759678710573738811E-20, +2.85458592629073152182E-20, -7.12725445137377009753E-21, +5.25419393758902871947E-22, +1.24299023131490990316E-22, -4.04419210566489645405E-23 },
+ { -1.27981254388583500631E-12, +9.1347204083645933588E-12, -3.19715214292760767584E-11, +7.30777632669167468738E-11, -1.22557498812224960902E-10, +1.60618833847077433236E-10, -1.71047639646627010648E-10, +1.51926349902927316213E-10, -1.14609023345779936276E-10, +7.43697341394886835864E-11, -4.18713451557949730558E-11, +2.05606050331840905587E-11, -8.82161466664564577599E-12, +3.30031395277698236679E-12, -1.06851205331295409813E-12, +2.94333808755089195146E-13, -6.64411715537625335642E-14, +1.11264855981436243262E-14, -8.52918435682649455145E-16, -2.38837813662069487819E-16, +1.23994634366691956599E-16, -3.05269770279941723219E-17, +4.34539596489459676621E-18, -5.55819387468189608390E-20, -1.56974672263484202926E-19, +4.60835492190702561464E-20, -6.61112150617493330405E-21, +7.28424268476803924831E-23, +2.09156005934313228089E-22, -5.29080328670107625978E-23, +5.61375000671507211726E-24, +3.82199410465700894394E-25 },
+ { -6.22096057427178413283E-16, +5.05227108353689229741E-15, -2.02090843341475691883E-14, +5.30488463771373691202E-14, -1.02729512031916810045E-13, +1.56409892294496290711E-13, -1.94849254788406146283E-13, +2.04064637342166989709E-13, -1.83187931471980616892E-13, +1.42994099344605424348E-13, -9.8111907789286062426E-14, +5.96545975367403288587E-14, -3.23370114040930933005E-14, +1.56932853967230342257E-14, -6.83548101324218922896E-15, +2.67410077774155118457E-15, -9.38313996431647887562E-16, +2.94090734842381109313E-16, -8.16448235152204729921E-17, +1.9758222496699617607E-17, -4.03590262164308783690E-18, +6.43662361965717426956E-19, -5.93446415094778572090E-20, -6.07164564350191039536E-21, +4.38906686886388095825E-21, -1.17175498170220204828E-21, +1.98482140750318604418E-22, -1.70803571702439545981E-23, -1.94600332107885234554E-24, +1.10477141319981582738E-24, -2.31975718243847439962E-25, +2.54148402104633283670E-26 },
+ { -1.12858840595384064928E-19, +1.02797735716689148111E-18, -4.62589810725101166456E-18, +1.37063647622252197466E-17, -3.0068337697131575822E-17, +5.2067053140503053517E-17, -7.40914680178037035E-17, +8.9062000172830588611E-17, -9.22563786210983011008E-17, +8.35975730487397716492E-17, -6.70372487553237232779E-17, +4.80088566412770650047E-17, -3.09280630297969106245E-17, +1.8026496052333452774E-17, -9.54924880090907168481E-18, +4.61362333444861021959E-18, -2.03812361224098073479E-18, +8.24578860830779678155E-19, -3.0572087552697254564E-19, +1.03827313453936543577E-19, -3.22407758977306397999E-20, +9.12052549039695437376E-21, -2.33541947993595580264E-21, +5.35339963891271164659E-22, -1.07674173853083520575E-22, +1.82413373046113374293E-23, -2.33864726317468746329E-24, +1.29928813344150027051E-25, +3.86668349205203745336E-26, -1.63203452712600670685E-26, +3.65165372186699607411E-27, -5.51243539825332137371E-28 },
+ { -7.61985302416052609616E-24, +7.69459862670641937159E-23, -3.84729931335320968601E-22, +1.26960877340655919637E-21, -3.10990027829384449637E-21, +6.02935924057670511377E-21, -9.6342786971886625897E-21, +1.30454744197246721374E-20, -1.52745988785284834672E-20, +1.57034665186695273938E-20, -1.43457243961336621961E-20, +1.17567385540485497556E-20, -8.7104848256363928121E-21, +5.87137214731944288587E-21, -3.61951956727412561213E-21, +2.04954715001535632502E-21, -1.06982832733527370879E-21, +5.1628428354196120786E-22, -2.30885865897937993512E-22, +9.58556229281154921137E-23, -3.69911125531027884646E-23, +1.32784897023484841369E-23, -4.43433027366044567275E-24, +1.37688611947822111040E-24, -3.96971995397574368025E-25, +1.06008163579031271153E-25, -2.61149430849477426613E-26, +5.89698164189548613154E-27, -1.20793190886658723050E-27, +2.20446342551066852143E-28, -3.46061447029252398335E-29, +4.28913922246949096952E-30 }
+};
+
+static const double tab3 [8] = { +1, -1, +3, -15, +105, -945, +10395, -135135.0 };
+
+
+/*
+ Calculated: oo
+ 1 | -x²/2
+ gauss(z) = --------- | e dx
+ sqrt(2pi) |
+ z
+
+ gauss ( 0) = 0.5
+ gauss ( 1) ~ 0.1586
+ gauss ( 2) ~ 0.02275
+ gauss ( 4) ~ 3.17e-5
+ gauss (10) ~ 7.62e-24
+ gauss (oo) = 0
+
+ Note: only for z>0
+*/
+#include <stdio.h>
+#include <math.h>
+
+#define M_1_SQRT2PI 0.398942280401432686
+
+static long double gauss ( double x )
+{
+ unsigned int i = (unsigned int)(x + 0.5);
+ double y = x * x;
+
+ if ( i > 150 ) return 0.;
+ if ( i > 10 ) return M_1_SQRT2PI * exp (-0.5*y) / x * __poly (1./y, 7, tab3);
+ if ( i > 0 ) return -__poly ((x-i), 31, tab2 [i-1]);
+ return 0.5 - x * __poly (y, 9, tab1);
+ }
+
+double erf ( double x )
+{
+ return x < 0. ? -0.5 + gauss(-x) : 0.5 - gauss(x);
+}
+
+double erfc ( double x )
+{
+ return x < 0. ? 1.0 - gauss(-x) : gauss(x);
+}
+
diff --git a/mdk-stage1/dietlibc/libm/gamma.c b/mdk-stage1/dietlibc/libm/gamma.c
new file mode 100644
index 000000000..d5f3e4275
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/gamma.c
@@ -0,0 +1,98 @@
+#include "dietlibm.h"
+
+/*--------------------------------------------------------------------------*
+
+Name gamma, lgamma - gamma function
+
+Usage double gamma (double x);
+ double lgamma(double x);
+ extern int signgam;
+
+Prototype in math.h
+
+Description gamma returns the logarithm of the absolute value of the
+ gamma function. So it is possible â(x) for very large x.
+ The sign is stored in signgam, a extern variable
+ overwritten during every call to gamma(). lgamma() is
+ a synonym for gamma().
+ You can calculate â(x) by the following sequence:
+
+ double gammafunction(double x)
+ { double y=exp(gamma(x));
+
+ return signgam ? -y : +y;
+ }
+
+Return value gamma returns a value in range (-0.1208, +oo). For a input
+ value of zero, it returns +oo and errno is set to:
+
+ ERANGE Result out of range
+
+*---------------------------------------------------------------------------*/
+
+#include <stdlib.h>
+#include <math.h>
+
+#define B0 + 1.0l/ 6/ 1/ 2
+#define B1 - 1.0l/ 30/ 3/ 4
+#define B2 + 1.0l/ 42/ 5/ 6
+#define B3 - 1.0l/ 30/ 7/ 8
+#define B4 + 5.0l/ 66/ 9/10
+#define B5 - 691.0l/2730/11/12
+#define B6 + 7.0l/ 6/13/14
+#define B7 - 3617.0l/ 510/15/16
+#define B8 + 43867.0l/ 798/17/18
+#define B9 - 174611.0l/ 330/19/20
+#define B10 + 854513.0l/ 138/21/22
+#define B11 - 236364091.0l/2730/23/24
+#define B12 + 8553103.0l/ 6/25/26
+
+static const double coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 };
+int signgam;
+
+#define EXPL(x) (((short *)&x)[4] & 0x7FFF)
+
+static double logfact ( long double x )
+{
+ long double z = 2. * M_PI * x;
+ register int e = EXPL (x);
+
+ static unsigned char list [] = { 6, 4, 3, 3, 2, 2 };
+
+ return (log(x) - 1) * x + 0.5*log(z) + __poly (1./(x*x), e<0x4003 ? 10 : (e>0x4008 ? 1 : list [e-0x4003] ), coeff) / x;
+}
+
+
+double lgamma ( double x )
+{
+ register int k = floor (x);
+ long double w;
+ long double y;
+ long double z;
+
+ signgam = 0;
+
+ if ( k >= 7 )
+ return logfact (x-1);
+
+ if ( k == x )
+ switch (k) {
+ case 1 :
+ case 2 : return 0.000000000000000000000000000l;
+ case 3 : return 0.693147180559945309432805516l;
+ case 4 : return 1.791759469228055000858148560l;
+ case 5 : return 3.178053830347945619723759592l;
+ case 6 : return 4.787491742782045994244981560l;
+ default: return 1./0.; /* ignore the gcc warning, this is intentional */
+ }
+
+ z = logfact (y = x - k + 7.0 - 1);
+ w = 1;
+ for ( k = 7 - k; k--; )
+ w *= y, y -= 1.;
+
+ signgam = k >= 0 ? 0 : k & 1;
+ return z - log (w);
+}
+
+double gamma ( double val ) __attribute__ ((weak,alias("lgamma")));
diff --git a/mdk-stage1/dietlibc/libm/ipow.c b/mdk-stage1/dietlibc/libm/ipow.c
new file mode 100644
index 000000000..399986ea1
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/ipow.c
@@ -0,0 +1,29 @@
+#define _GNU_SOURCE
+#include <math.h>
+/*
+ * This is not standard, but often you only need such this function
+ * which is much shorter than the generic pow() function.
+ *
+ * double ipow ( double mant, int expo );
+ */
+
+double ipow ( double mant, int expo )
+{
+ double ret = 1.;
+ unsigned int e = expo; /* Some attention is necessary for expo = 2^31 */
+
+ if ( (int)e < 0 ) {
+ e = -e;
+ mant = 1./mant;
+ }
+
+ while (1) {
+ if ( e & 1 )
+ ret *= mant;
+ if ( (e >>= 1) == 0 )
+ break;
+ mant *= mant;
+ }
+
+ return ret;
+}
diff --git a/mdk-stage1/dietlibc/libm/poly.c b/mdk-stage1/dietlibc/libm/poly.c
new file mode 100644
index 000000000..cdcfb8c5c
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/poly.c
@@ -0,0 +1,41 @@
+/*--------------------------------------------------------------------------*
+
+Name __poly - generates a polynomial from arguments
+
+Usage double __poly ( double x, int n, const double* c );
+
+Prototype in math.h
+
+Description __poly generates a polynomial in x, of degree n, with
+ coefficients c[0], c[1], ..., c[n]. For example, if n=4,
+ the generated polynomial is
+
+ c[4]*x^4 + c[3]*x^3 + c[2]*x^2 + c[1]*x + c[0]
+
+ The polynomial is calculated using Horner's method:
+
+ polynom = (..((x*c[n] + c[n-1])*x + c[n-2])..)*x + c[0]
+
+Return value __poly returns the value of the polynomial as evaluated for
+ the given x.
+ A range error occurs if the result exceeds double range.
+
+*---------------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include "dietlibm.h"
+
+double __poly ( double x, size_t n, const double* c)
+{
+ long double ret;
+ size_t i;
+
+ i = n;
+ c += n;
+ ret = 0;
+ do
+ ret = ret * x + *c--;
+ while ( i-- );
+
+ return ret;
+}
diff --git a/mdk-stage1/dietlibc/libm/pow.c b/mdk-stage1/dietlibc/libm/pow.c
new file mode 100644
index 000000000..e0e5a2983
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/pow.c
@@ -0,0 +1,42 @@
+
+#include <math.h>
+#include "dietlibm.h"
+
+double pow ( double mant, double expo )
+{
+ unsigned int e;
+ long double ret;
+
+ /* special cases 0^x */
+ if ( mant == 0. ) {
+ if ( expo > 0. )
+ return 0.;
+ else if ( expo == 0. )
+ return 1.;
+ else
+ return 1./mant;
+ }
+
+ /* special cases x^n with n is integer */
+ if ( expo == (int) (e = (int) expo) ) {
+
+ if ( (int)e < 0 ) {
+ e = -e;
+ mant = 1./mant;
+ }
+
+ ret = 1.;
+
+ while (1) {
+ if ( e & 1 )
+ ret *= mant;
+ if ( (e >>= 1) == 0 )
+ break;
+ mant *= mant;
+ }
+ return ret;
+ }
+
+ /* normal case */
+ return exp2 ( log2 (mant) * expo );
+}
diff --git a/mdk-stage1/dietlibc/libm/rint.c b/mdk-stage1/dietlibc/libm/rint.c
new file mode 100644
index 000000000..b6f0d8f85
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/rint.c
@@ -0,0 +1,5 @@
+#include <math.h>
+
+double rint(double x) {
+ return floor(x+0.5);
+}
diff --git a/mdk-stage1/dietlibc/libm/sinh.c b/mdk-stage1/dietlibc/libm/sinh.c
new file mode 100644
index 000000000..ae4542d25
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/sinh.c
@@ -0,0 +1,9 @@
+#include <math.h>
+
+extern const float __half;
+
+double sinh ( double x )
+{
+ long double y = exp (x);
+ return (y - 1./y) * __half;
+}
diff --git a/mdk-stage1/dietlibc/libm/tanh.c b/mdk-stage1/dietlibc/libm/tanh.c
new file mode 100644
index 000000000..21dc3d0c0
--- /dev/null
+++ b/mdk-stage1/dietlibc/libm/tanh.c
@@ -0,0 +1,7 @@
+#include <math.h>
+
+double tanh ( double x )
+{
+ long double y = exp (x + x);
+ return (y - 1.) / (y + 1.);
+}
diff --git a/mdk-stage1/dietlibc/libpthread/CHANGES b/mdk-stage1/dietlibc/libpthread/CHANGES
index d39d990ba..63376623b 100644
--- a/mdk-stage1/dietlibc/libpthread/CHANGES
+++ b/mdk-stage1/dietlibc/libpthread/CHANGES
@@ -1,6 +1,12 @@
This is the pthread implementation of dietlibc.
Written from scratch by Olaf Dreesen.
+Mon Aug 6 15:46:39 MEST 2001
+
+ Ups... did the wrong error handling... the error is returned not put to
+ errno...
+ probably thread_key is not SMP save...
+
Thu Apr 12 16:47:12 MEST 2001
added conditional variables...
diff --git a/mdk-stage1/dietlibc/libpthread/Makefile b/mdk-stage1/dietlibc/libpthread/Makefile
index 06420f43a..f2ab8d8dc 100644
--- a/mdk-stage1/dietlibc/libpthread/Makefile
+++ b/mdk-stage1/dietlibc/libpthread/Makefile
@@ -12,14 +12,14 @@ VPATH=../$(ARCH)/
PTHREAD_OBJS = \
__testandset.o \
\
- thread_internal.o \
- thread_key.o \
+ pthread_internal.o \
+ pthread_key.o \
\
pthread_once.o pthread_spinlock.o \
\
pthread_create.o pthread_detach.o \
pthread_join.o pthread_self.o \
- pthread_exit.o \
+ pthread_exit.o pthread_equal.o \
\
pthread_cleanup_push.o \
pthread_cleanup_pop.o \
@@ -72,6 +72,7 @@ PTHREAD_OBJS = \
pthread_sys_create.o \
pthread_sys_fcntl.o \
pthread_sys_fsync.o \
+ pthread_sys_fdatasync.o \
pthread_sys_nanosleep.o \
pthread_sys_logging.o \
pthread_sys_open.o \
diff --git a/mdk-stage1/dietlibc/libpthread/README b/mdk-stage1/dietlibc/libpthread/README
index 3139c731d..ee85a572d 100644
--- a/mdk-stage1/dietlibc/libpthread/README
+++ b/mdk-stage1/dietlibc/libpthread/README
@@ -3,7 +3,7 @@ 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...)
+1. STATUS: near complete and 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...
@@ -15,13 +15,7 @@ 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
+ it is a standard dietlibc helper lib...
3. NOTES
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_atfork.c b/mdk-stage1/dietlibc/libpthread/pthread_atfork.c
index 2dc612dcc..70ca9f162 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_atfork.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_atfork.c
@@ -36,7 +36,7 @@ int pthread_atfork(void (*prepare)(void),
__pthread_unlock(&__atfork_struct_lock);
__NO_ASYNC_CANCEL_END;
- if (ret) (*(__errno_location()))=ENOMEM;
+ if (ret) ret=ENOMEM;
return ret;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c
index 726e88fe5..fbcefa3bd 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include <unistd.h>
#include <errno.h>
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c
index 690ad5f8e..f5eab5816 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c
@@ -13,6 +13,5 @@ int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
attr->__detachstate=detachstate;
return 0;
}
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c
index f38e6e35e..0b7a691e7 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c
@@ -13,6 +13,5 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
attr->__inheritsched=inherit;
return 0;
}
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c
index 833c0111b..a3e5a9b4a 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c
@@ -12,12 +12,11 @@ int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *p
attr->__schedparam.sched_priority=0;
return 0;
}
- if (((attr->__schedpolicy == SCHED_RR) || (attr->__schedpolicy == SCHED_RR))
+ if (((attr->__schedpolicy == SCHED_RR) || (attr->__schedpolicy == SCHED_FIFO))
&& ((param->sched_priority > 0) && (param->sched_priority < 100))) {
attr->__schedparam.sched_priority=param->sched_priority;
return 0;
}
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c
index e845bca32..227d3f7ad 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c
@@ -17,9 +17,8 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
attr->__schedpolicy=policy;
return 0;
}
- (*(__errno_location()))=ENOTSUP;
+ return ENOTSUP;
}
else
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c
index 39088c9b2..9be11ca2d 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c
@@ -11,8 +11,7 @@ int pthread_attr_setscope(pthread_attr_t *attr, int scope)
if (scope==PTHREAD_SCOPE_SYSTEM) return 0;
if (scope==PTHREAD_SCOPE_PROCESS)
- (*(__errno_location()))=ENOTSUP;
+ return ENOTSUP;
else
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c
index cfbab7747..1a0aae929 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c
@@ -12,6 +12,5 @@ int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
attr->__stacksize=stacksize;
return 0;
}
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cancel.c b/mdk-stage1/dietlibc/libpthread/pthread_cancel.c
index 4c87a3ed1..c0ae60349 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_cancel.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_cancel.c
@@ -14,14 +14,12 @@ int pthread_cancel(pthread_t th)
j=__find_thread_id(th);
if (j==-1) {
- (*(__errno_location()))=ESRCH;
- return -1;
+ return ESRCH;
}
thread = __get_thread_struct(j);
if (thread==0) {
- (*(__errno_location()))=ESRCH;
- return -1;
+ return ESRCH;
}
if (thread->cancelstate!=PTHREAD_CANCEL_DISABLE) {
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c
index d3c2274f3..776e0adfc 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c
@@ -10,14 +10,17 @@ int pthread_cond_broadcast(pthread_cond_t *cond)
__THREAD_INIT();
+ __NO_ASYNC_CANCEL_BEGIN;
__pthread_lock(&(cond->lock));
- while ((tmp=cond->wait_chain)) {
- cond->wait_chain=tmp->waitnext;
+
+ for (tmp=cond->wait_chain;tmp;tmp=tmp->waitnext) {
tmp->waitnext=0;
tmp->waiting=0;
}
- __pthread_unlock(&(cond->lock));
+ cond->wait_chain=0;
+ __pthread_unlock(&(cond->lock));
+ __NO_ASYNC_CANCEL_STOP;
return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c
index 9a6cc4f0b..b553b41df 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -9,8 +10,7 @@ int pthread_cond_destroy(pthread_cond_t *cond)
__THREAD_INIT();
if (cond->wait_chain) {
- (*__errno_location())=EBUSY;
- return 1;
+ return EBUSY;
}
memset(cond,0,sizeof(pthread_cond_t));
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c
index 20b38bef2..76dd5cb97 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include <unistd.h>
#include <errno.h>
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c
index 60bf2119c..02a3c028e 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c
@@ -10,9 +10,11 @@ int pthread_cond_signal(pthread_cond_t *cond)
__THREAD_INIT();
+ __NO_ASYNC_CANCEL_BEGIN;
__pthread_lock(&(cond->lock));
if ((tmp=cond->wait_chain)) cond->wait_chain=tmp->waitnext;
__pthread_unlock(&(cond->lock));
+ __NO_ASYNC_CANCEL_STOP;
if (tmp) {
tmp->waitnext=0;
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c
index 6613f2ca9..71d80bdb5 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c
@@ -9,13 +9,14 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
{
_pthread_descr tmp;
_pthread_descr this;
- int ret;
+ int ret=0;
__THREAD_INIT();
this=__thread_self();
/* put in wait-chain */
+ __NO_ASYNC_CANCEL_BEGIN;
__pthread_lock(&(cond->lock));
this->waiting=1;
if (cond->wait_chain) {
@@ -23,21 +24,51 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
tmp->waitnext=this;
} else cond->wait_chain=this;
__pthread_unlock(&(cond->lock));
+ __NO_ASYNC_CANCEL_STOP;
- /* Aeh yeah / wait till signal */
+ /* Aeh yeah / wait till cond-signal OR timeout */
pthread_mutex_unlock(mutex);
- ret=nanosleep(abstime,0);
+ while (this->waiting) {
+ struct timeval tv;
+ gettimeofday(&tv,0);
+ if ((abstime->tv_sec <= tv.tv_sec) && (abstime->tv_nsec <= (tv.tv_usec*1000))) {
+ ret = 1;
+ break;
+ }
+ __thread_wait_some_time();
+ if (this->canceled) break; /* a cancel */
+ }
pthread_mutex_lock(mutex);
- __TEST_CANCEL();
-
- if (ret) {
- if ((*__errno_location())!=EINTR) return -1;
- return 0;
+ __NO_ASYNC_CANCEL_BEGIN;
+ __pthread_lock(&(cond->lock));
+ if (this->waiting) { /* still waiting -> TIMEOUT or SIGNAL */
+ _pthread_descr prev;
+ /* remove from wait-chain */
+ prev=cond->wait_chain;
+ if ((prev=cond->wait_chain)==this) {
+ cond->wait_chain=this->waitnext;
+ } else {
+ for (tmp=prev->waitnext;tmp;prev=tmp,tmp=prev->waitnext) {
+ if (tmp==this) {
+ prev->waitnext=this->waitnext;
+ break;
+ }
+ }
+ }
+ this->waiting=0;
+ this->waitnext=0;
}
+ __pthread_unlock(&(cond->lock));
+ __NO_ASYNC_CANCEL_END;
+
+ if (ret) return ETIMEDOUT;
- (*__errno_location())=ETIMEDOUT;
- return -1;
+ {
+ register int err = (*__errno_location());
+ if (err==EINTR) return err;
+ }
+ return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c
index 0c6c0ae13..8db49e840 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c
@@ -14,6 +14,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
this=__thread_self();
/* put in wait-chain */
+ __NO_ASYNC_CANCEL_BEGIN;
__pthread_lock(&(cond->lock));
this->waiting=1;
if (cond->wait_chain) {
@@ -21,16 +22,37 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
tmp->waitnext=this;
} else cond->wait_chain=this;
__pthread_unlock(&(cond->lock));
+ __NO_ASYNC_CANCEL_STOP;
/* 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 */
+ if (this->canceled) break; /* we got a cancel signal */
}
pthread_mutex_lock(mutex);
- __TEST_CANCEL();
+ __NO_ASYNC_CANCEL_BEGIN;
+ __pthread_lock(&(cond->lock));
+ if (this->waiting) { /* still waiting -> SIGNAL */
+ _pthread_descr prev;
+ /* remove from wait-chain */
+ prev=cond->wait_chain;
+ if ((prev=cond->wait_chain)==this) {
+ cond->wait_chain=this->waitnext;
+ } else {
+ for (tmp=prev->waitnext;tmp;prev=tmp,tmp=prev->waitnext) {
+ if (tmp==this) {
+ prev->waitnext=this->waitnext;
+ break;
+ }
+ }
+ }
+ this->waiting=0;
+ this->waitnext=0;
+ }
+ __pthread_unlock(&(cond->lock));
+ __NO_ASYNC_CANCEL_END;
return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_create.c b/mdk-stage1/dietlibc/libpthread/pthread_create.c
index b4a499081..714c2bf4b 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_create.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_create.c
@@ -15,21 +15,20 @@ int pthread_create (pthread_t *thread, const pthread_attr_t *attr,
__THREAD_INIT();
if (start_routine==0) {
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
td = __thread_get_free();
if (td) {
+ td->go.__spinlock=PTHREAD_SPIN_LOCKED;
if (!(attr)) {
pthread_attr_init(&default_attr);
attr=&default_attr;
}
if ((td->policy!=SCHED_OTHER)&&(td->priority==0)) {
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
if (attr->__inheritsched==PTHREAD_INHERIT_SCHED) {
@@ -48,14 +47,17 @@ int pthread_create (pthread_t *thread, const pthread_attr_t *attr,
td->stack_size = attr->__stacksize;
- if (!(td->stack_addr)) {
+ if (!(attr->__stackaddr)) {
char *stack=(char*)malloc(td->stack_size);
if (!(stack)) {
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
td->stack_begin = stack;
+#ifdef __parisc__
+ td->stack_addr = stack;
+#else
td->stack_addr = stack+td->stack_size;
+#endif
} else {
td->stack_begin = 0;
td->stack_addr = attr->__stackaddr;
@@ -65,12 +67,15 @@ int pthread_create (pthread_t *thread, const pthread_attr_t *attr,
if (ret>1)
*thread=ret;
- else
+ else {
+ ++td->exited; /* mark as exited */
__thread_cleanup(td);
+ if (ret<0) return (*(__errno_location()));
+ return EAGAIN;
+ }
}
else
- (*(__errno_location()))=EAGAIN;
+ return EAGAIN;
- if (ret<2) return -1;
- return ret;
+ return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_detach.c b/mdk-stage1/dietlibc/libpthread/pthread_detach.c
index c07280389..2f72b97a7 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_detach.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_detach.c
@@ -13,19 +13,12 @@ int pthread_detach(pthread_t th)
j=__find_thread_id(th);
if (j==-1) {
- (*(__errno_location()))=ESRCH;
- return -1;
+ return ESRCH;
}
thread = __get_thread_struct(j);
- if (thread==0) {
- (*(__errno_location()))=ESRCH;
- return -1;
- }
-
if (thread->detached) {
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
if (!thread->joined) {
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_equal.c b/mdk-stage1/dietlibc/libpthread/pthread_equal.c
new file mode 100644
index 000000000..d054d86ed
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_equal.c
@@ -0,0 +1,3 @@
+#include <pthread.h>
+
+int pthread_equal(pthread_t thread1, pthread_t thread2) { return (thread1==thread2); }
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_errno.c b/mdk-stage1/dietlibc/libpthread/pthread_errno.c
new file mode 100644
index 000000000..d035544ad
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_errno.c
@@ -0,0 +1,5 @@
+int errno;
+
+#include "dietwarning.h"
+
+link_warning("errno","\e[1;33;41m>>> your multithreaded code uses errno! <<<\e[0m");
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_fdglue2.c b/mdk-stage1/dietlibc/libpthread/pthread_fdglue2.c
new file mode 100644
index 000000000..d73c84220
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_fdglue2.c
@@ -0,0 +1,16 @@
+#include "dietstdio.h"
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <errno.h>
+
+extern int __stdio_atexit;
+extern FILE* __stdio_init_file_nothreads(int fd,int closeonerror);
+
+FILE* __stdio_init_file(int fd,int closeonerror) {
+ FILE *tmp=__stdio_init_file_nothreads(fd,closeonerror);
+ if (tmp) pthread_mutex_init(&tmp->m,0);
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_fgetc.c b/mdk-stage1/dietlibc/libpthread/pthread_fgetc.c
new file mode 100644
index 000000000..34e79e0fe
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_fgetc.c
@@ -0,0 +1,10 @@
+#include "dietstdio.h"
+#include <unistd.h>
+
+int fgetc(FILE *stream) {
+ int tmp;
+ pthread_mutex_lock(&stream->m);
+ tmp=fgetc_unlocked(stream);
+ pthread_mutex_unlock(&stream->m);
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_flockfile.c b/mdk-stage1/dietlibc/libpthread/pthread_flockfile.c
new file mode 100644
index 000000000..72131ffb1
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_flockfile.c
@@ -0,0 +1,5 @@
+#include "dietstdio.h"
+
+void flockfile(FILE* f) {
+ pthread_mutex_lock(&f->m);
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_fputc.c b/mdk-stage1/dietlibc/libpthread/pthread_fputc.c
new file mode 100644
index 000000000..82344b107
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_fputc.c
@@ -0,0 +1,9 @@
+#include <dietstdio.h>
+
+int fputc(int c, FILE *stream) {
+ int tmp;
+ pthread_mutex_lock(&stream->m);
+ tmp=fputc_unlocked(c,stream);
+ pthread_mutex_unlock(&stream->m);
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_funlockfile.c b/mdk-stage1/dietlibc/libpthread/pthread_funlockfile.c
new file mode 100644
index 000000000..beae058af
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_funlockfile.c
@@ -0,0 +1,5 @@
+#include "dietstdio.h"
+
+void funlockfile(FILE* f) {
+ pthread_mutex_unlock(&f->m);
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_getschedparam.c b/mdk-stage1/dietlibc/libpthread/pthread_getschedparam.c
new file mode 100644
index 000000000..aaaba4458
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_getschedparam.c
@@ -0,0 +1,22 @@
+#include <unistd.h>
+#include <errno.h>
+
+#include <pthread.h>
+#include "thread_internal.h"
+
+int pthread_getschedparam(pthread_t target_thread, int *policy, struct sched_param *param)
+{
+ int p;
+ __THREAD_INIT();
+
+ if (__find_thread_id(target_thread)<0) {
+ return ESRCH;
+ }
+
+ if (((p=sched_getscheduler(target_thread))==-1)||
+ (sched_getparam(target_thread,param) ==-1)) {
+ return (*(__errno_location()));
+ }
+ *policy=p;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libpthread/thread_internal.c b/mdk-stage1/dietlibc/libpthread/pthread_internal.c
index a93806203..7bb4e16cb 100644
--- a/mdk-stage1/dietlibc/libpthread/thread_internal.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_internal.c
@@ -11,14 +11,14 @@
#include <stdio.h>
#include "thread_internal.h"
-static struct _pthread_fastlock __thread_struct_lock = {0};
+static struct _pthread_fastlock __thread_struct_lock = {PTHREAD_SPIN_UNLOCKED};
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};
+static struct _pthread_fastlock __manager_thread_signal_lock = {PTHREAD_SPIN_UNLOCKED};
+static struct _pthread_fastlock __manager_thread_data_lock = {PTHREAD_SPIN_LOCKED};
+static struct _pthread_fastlock __manager_thread_data_go_lock = {PTHREAD_SPIN_LOCKED};
//#define DEBUG
@@ -70,8 +70,10 @@ _pthread_descr __thread_get_free()
for (i=0; i<PTHREAD_THREADS_MAX; i++) {
if (threads[i].pid==0) {
- threads[i].pid=1; /* mark as taken */
ret = threads+i;
+ /* clear struct */
+ memset(ret,0,sizeof(struct _pthread_descr_struct));
+ ret->pid=1; /* mark as taken */
if (i>=_max_used_thread_id) _max_used_thread_id=i+1;
break;
}
@@ -91,22 +93,23 @@ void __thread_wait_some_time()
__libc_nanosleep(&reg,0);
}
-/* cleanup a thread struct */
-void __thread_cleanup(_pthread_descr th)
+/* cleanup/join a thread */
+int __thread_join(_pthread_descr th, void**return_value)
{
- /* lib provided stack should be freed */
+ /* mark thread th as joined */
+ if (__testandset(&(th->joined))) return EINVAL;
+ /* wait for thread to exit */
+ while(!th->exited) __thread_wait_some_time();
+ /* put return value to caller */
+ if (return_value) *return_value=th->retval;
+ /* cleanup thread */
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 */
+ th->joined=0;
+ th->pid=0;
+ return 0;
}
-/* SIGHUP handler (thread cnacel) PTHREAD_CANCEL_ASYNCHRONOUS */
+/* SIGHUP handler (thread cancel) PTHREAD_CANCEL_ASYNCHRONOUS */
static void __thread_cancel_handler(int sig)
{
_pthread_descr this;
@@ -144,6 +147,7 @@ static void __kill_all_threads()
}
}
+__attribute__((weak)) volatile void __thread_start__key(int id);
__attribute__((weak)) volatile void __thread_start__key(int id) { return; }
__attribute__((weak,alias("__thread_start__key"))) volatile void __thread_exit__key(int id);
@@ -177,6 +181,14 @@ static void *__mthread_starter(void *arg)
#ifdef DEBUG
printf("in starter %d, parameter %8p\n", td->pid, td->func);
#endif
+ do {
+ __thread_wait_some_time();
+ if (td->canceled) return (void*)42;
+ } while (__pthread_trylock(&td->go));
+
+#ifdef DEBUG
+ printf("post starter %d, parameter %8p\n", td->pid, td->func);
+#endif
if (!td->canceled) {
if (!(setjmp(td->jmp_exit))) {
@@ -196,13 +208,6 @@ static void *__mthread_starter(void *arg)
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) {
@@ -227,7 +232,11 @@ static void __manager_SIGCHLD(int sig)
for (i=0; i<_max_used_thread_id; i++) {
if (threads[i].pid==pid) {
- __thread_cleanup(threads+i);
+ ++threads[i].exited;
+ if (threads[i].detached) {
+ threads[i].joined=0;
+ __thread_cleanup(threads+i);
+ }
break;
}
}
@@ -255,7 +264,7 @@ static void* __manager_thread(void *arg)
while(1) {
do {
__thread_wait_some_time();
- if (getppid()<0) __manager_SIGTERM(0);
+ if (getppid()<2) __manager_SIGTERM(0);
} while (__pthread_trylock(&__manager_thread_data_lock));
__manager_thread_data->pid =
@@ -264,6 +273,8 @@ static void* __manager_thread(void *arg)
CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD,
__manager_thread_data);
__thread_wait_some_time();
+ __thread_wait_some_time();
+ __pthread_unlock(&__manager_thread_data->go);
#ifdef DEBUG
printf("manager new thread %d\n",__manager_thread_data->pid);
#endif
@@ -329,7 +340,11 @@ void __thread_init()
++_max_used_thread_id;
threads[1].stack_size=sizeof(__manager_thread_stack);
+#ifdef __parisc__
+ threads[1].stack_addr=__manager_thread_stack;
+#else
threads[1].stack_addr=&__manager_thread_stack[sizeof(__manager_thread_stack)];
+#endif
threads[1].stack_begin=0;
threads[1].func=__manager_thread;
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_join.c b/mdk-stage1/dietlibc/libpthread/pthread_join.c
index 5b295bad1..39c076555 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_join.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_join.c
@@ -16,35 +16,24 @@ int pthread_join(pthread_t th, void **thread_return)
j=__find_thread_id(th);
if (j==-1) {
- (*(__errno_location()))=ESRCH;
- return -1;
+ return ESRCH;
}
thread = __get_thread_struct(j);
/* error handling */
if (thread==0) {
- (*(__errno_location()))=ESRCH;
- return -1;
+ return ESRCH;
}
if (this==thread) {
- (*(__errno_location()))=EDEADLK;
- return -1;
+ return EDEADLK;
}
if (thread->detached || thread->joined) {
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
- thread->joined=this;
- this->join=1;
-
- while(this->join) __thread_wait_some_time();
-
- if (thread_return) *thread_return=this->retval;
-
- return 0;
+ return __thread_join(thread,thread_return);
}
diff --git a/mdk-stage1/dietlibc/libpthread/thread_key.c b/mdk-stage1/dietlibc/libpthread/pthread_key.c
index b0f719fc9..8a77f281a 100644
--- a/mdk-stage1/dietlibc/libpthread/thread_key.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_key.c
@@ -7,10 +7,15 @@
struct _pthread_fastlock __thread_keys_lock;
struct _thread_key __thread_keys[PTHREAD_KEYS_MAX];
+void __thread_start__key(int id);
+void __thread_exit__key(int id);
+
void __thread_start__key(int id)
{
int i;
+ if (id<2) return;
+
__NO_ASYNC_CANCEL_BEGIN;
__pthread_lock(&__thread_keys_lock);
@@ -26,8 +31,10 @@ void __thread_exit__key(int id)
{
int i,try;
+ if (id<2) return;
+
__NO_ASYNC_CANCEL_BEGIN;
- __pthread_lock(&__thread_keys_lock);
+// __pthread_lock(&__thread_keys_lock);
for (i=0; i<PTHREAD_KEYS_MAX; i++) {
if ((__thread_keys[i].used) && (__thread_keys[i].destructor)) {
@@ -36,6 +43,6 @@ void __thread_exit__key(int id)
}
}
- __pthread_unlock(&__thread_keys_lock);
+// __pthread_unlock(&__thread_keys_lock);
__NO_ASYNC_CANCEL_STOP;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_key_create.c b/mdk-stage1/dietlibc/libpthread/pthread_key_create.c
index 44fccea6a..9718c695b 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_key_create.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_key_create.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -19,7 +20,7 @@ int pthread_key_create(pthread_key_t *key, void (*destructor)(const void*))
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));
+ memset(__thread_keys[i].tkd,0,PTHREAD_THREADS_MAX*sizeof(void*));
*key=i;
ret=0;
break;
@@ -29,7 +30,7 @@ int pthread_key_create(pthread_key_t *key, void (*destructor)(const void*))
__pthread_unlock(&__thread_keys_lock);
__NO_ASYNC_CANCEL_END;
- if (ret) (*__errno_location())=EAGAIN;
- return ret;
+ if (ret) return EAGAIN;
+ return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c b/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c
index b1bc366e2..8f7fb577f 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c
@@ -10,8 +10,7 @@ int pthread_key_delete(pthread_key_t key)
__THREAD_INIT();
if (key>=PTHREAD_KEYS_MAX) {
- (*__errno_location())=EINVAL;
- return -1;
+ return EINVAL;
}
__thread_keys[key].used=0;
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c
index 33a16abd4..f5d66613c 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c
@@ -8,9 +8,8 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
__THREAD_INIT();
- if ((mutex->owner)||(mutex->lock.__spinlock)) {
- (*(__errno_location()))=EBUSY;
- return -1;
+ if ((mutex->owner)||(mutex->lock.__spinlock==PTHREAD_SPIN_LOCKED)) {
+ return EBUSY;
}
return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c
index b1797fb20..65161d0ec 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c
@@ -1,6 +1,6 @@
#include <unistd.h>
#include <errno.h>
-
+#include <string.h>
#include <pthread.h>
#include "thread_internal.h"
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c
index 0c3ade9e8..0df2bcd8d 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c
@@ -15,19 +15,18 @@ int pthread_mutex_lock(pthread_mutex_t *mutex)
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 (this==mutex->owner) {
+ if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP)
+ return EDEADLK;
+ if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) {
+ ++(mutex->count);
+ return 0;
+ }
}
- if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) ++(mutex->count);
+ /* wait for mutex to free */
+ __pthread_lock(&(mutex->lock));
+ mutex->owner=this;
return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c
index fcf63f75e..620d26150 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c
@@ -18,16 +18,13 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex)
if (this!=mutex->owner) {
/* wait for mutex to free */
if (__pthread_trylock(&(mutex->lock))) {
- (*(__errno_location()))=EBUSY;
- return -1;
+ return EBUSY;
}
mutex->owner=this;
}
- else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP)
- {
- (*(__errno_location()))=EDEADLK;
- return -1;
+ else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP) {
+ return EDEADLK;
}
if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) ++(mutex->count);
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c
index 0b5a1d0f7..0c12282c1 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c
@@ -17,17 +17,14 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
if (this==mutex->owner) {
if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) {
- if (--(mutex->count))
- return 0;
+ 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;
+ else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP) {
+ return EPERM;
}
return 0;
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c
index ac600f8ed..8b110fe5a 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c
@@ -13,6 +13,5 @@ int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
attr->__mutexkind=kind;
return 0;
}
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c b/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c
index b906492fb..f832bef70 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c
@@ -20,6 +20,5 @@ int pthread_setcancelstate(int state, int *oldstate)
return 0;
}
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c b/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c
index 03d1f53de..f5669b70d 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c
@@ -20,6 +20,5 @@ int pthread_setcanceltype(int type, int *oldtype)
return 0;
}
- (*(__errno_location()))=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setschedparam.c b/mdk-stage1/dietlibc/libpthread/pthread_setschedparam.c
new file mode 100644
index 000000000..df007c408
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_setschedparam.c
@@ -0,0 +1,21 @@
+#include <unistd.h>
+#include <errno.h>
+
+#include <pthread.h>
+#include "thread_internal.h"
+
+int pthread_setschedparam(pthread_t target_thread, int policy, const struct sched_param *param)
+{
+ __THREAD_INIT();
+
+ if (__find_thread_id(target_thread)<0) {
+ return ESRCH;
+ }
+
+ if (((policy == SCHED_OTHER) && (param->sched_priority==0)) ||
+ (((policy == SCHED_RR) || (policy == SCHED_FIFO)) &&
+ ((param->sched_priority > 0) && (param->sched_priority <100))))
+ return sched_setscheduler(target_thread, policy, param);
+
+ return EINVAL;
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c b/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c
index 78339c20b..b66ce31d0 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c
@@ -15,7 +15,6 @@ int pthread_setspecific(pthread_key_t key, const void *value)
__thread_keys[key].tkd[id]=value;
return 0;
}
- (*__errno_location())=EINVAL;
- return -1;
+ return EINVAL;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sigmask.c b/mdk-stage1/dietlibc/libpthread/pthread_sigmask.c
new file mode 100644
index 000000000..691e9e51a
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sigmask.c
@@ -0,0 +1,8 @@
+#include <signal.h>
+#include <errno.h>
+
+#include <pthread.h>
+
+int pthread_sigmask(int how, const sigset_t*newset, sigset_t *oldset) {
+ return (sigprocmask(how,newset,oldset)==-1)?(*(__errno_location())):0;
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c b/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c
index 449782adf..463c186bd 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c
@@ -2,12 +2,12 @@
#include <pthread.h>
#include "thread_internal.h"
-static void __pthread_acquire(int * spinlock)
+void __pthread_lock(struct _pthread_fastlock * lock)
{
int cnt = 0;
struct timespec tm;
- while (__testandset(spinlock)) {
+ while (__testandset(&lock->__spinlock)) {
if (cnt < MAX_SPIN_COUNT) {
sched_yield();
cnt++;
@@ -20,11 +20,6 @@ static void __pthread_acquire(int * spinlock)
}
}
-void __pthread_lock(struct _pthread_fastlock * lock)
-{
- __pthread_acquire(&lock->__spinlock);
-}
-
int __pthread_trylock(struct _pthread_fastlock * lock)
{
return __testandset(&lock->__spinlock);
@@ -32,7 +27,8 @@ int __pthread_trylock(struct _pthread_fastlock * lock)
int __pthread_unlock(struct _pthread_fastlock * lock)
{
- return (lock->__spinlock = 0);
+ lock->__spinlock = PTHREAD_SPIN_UNLOCKED;
+ return 0;
}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c
index 9f7d23d79..9fd4bcd95 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c
@@ -3,10 +3,11 @@
#include <pthread.h>
#include "thread_internal.h"
+#include <stdlib.h>
+
static pthread_mutex_t mutex_alloc = PTHREAD_MUTEX_INITIALIZER;
-void free(void *ptr)
-{
+void free(void *ptr) {
__NO_ASYNC_CANCEL_BEGIN;
pthread_mutex_lock(&mutex_alloc);
__libc_free(ptr);
@@ -14,8 +15,7 @@ void free(void *ptr)
__NO_ASYNC_CANCEL_END;
}
-void *malloc(size_t size)
-{
+void *malloc(size_t size) {
register void *ret;
__NO_ASYNC_CANCEL_BEGIN;
pthread_mutex_lock(&mutex_alloc);
@@ -24,3 +24,13 @@ void *malloc(size_t size)
__NO_ASYNC_CANCEL_END;
return ret;
}
+
+void* realloc(void* ptr, size_t size) {
+ register void *ret;
+ __NO_ASYNC_CANCEL_BEGIN;
+ pthread_mutex_lock(&mutex_alloc);
+ ret=__libc_realloc(ptr, size);
+ pthread_mutex_unlock(&mutex_alloc);
+ __NO_ASYNC_CANCEL_END;
+ return ret;
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c
index 99210a488..c7c3fb884 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c
@@ -3,6 +3,7 @@
#include <pthread.h>
#include "thread_internal.h"
+int fcntl(int fd, int cmd, void *arg);
int fcntl(int fd, int cmd, void *arg)
{
__TEST_CANCEL();
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_fdatasync.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_fdatasync.c
new file mode 100644
index 000000000..69857c7b3
--- /dev/null
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sys_fdatasync.c
@@ -0,0 +1,10 @@
+#include <unistd.h>
+
+#include <pthread.h>
+#include "thread_internal.h"
+
+int fdatasync(int fd)
+{
+ __TEST_CANCEL();
+ return __libc_fdatasync(fd);
+}
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c
index 6070ad219..f9f93dce2 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c
@@ -4,6 +4,8 @@
#include <pthread.h>
#include "thread_internal.h"
+#include <syslog.h>
+
static pthread_mutex_t mutex_syslog = PTHREAD_MUTEX_INITIALIZER;
void closelog(void)
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c
index 513f6a323..8d9fb5523 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c
@@ -3,6 +3,7 @@
#include <pthread.h>
#include "thread_internal.h"
+int __pthread_open(const char *pathname, int flags, mode_t mode);
int __pthread_open(const char *pathname, int flags, mode_t mode)
{
__TEST_CANCEL();
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c
index 1ac33adfc..d5d94978b 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c
@@ -3,6 +3,8 @@
#include <pthread.h>
#include "thread_internal.h"
+#include <termios.h>
+
int tcdrain(int fd)
{
__TEST_CANCEL();
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c
index 76d5ddca7..e5020221a 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c
@@ -3,6 +3,8 @@
#include <pthread.h>
#include "thread_internal.h"
+#include <sys/wait.h>
+
pid_t waitpid(pid_t pid, int *status, int options)
{
__TEST_CANCEL();
diff --git a/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c b/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c
index 68f91e743..4151faca3 100644
--- a/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c
+++ b/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c
@@ -10,7 +10,7 @@ void pthread_testcancel()
thread=__thread_self();
- if (thread->canceled) {
+ if (thread && thread->canceled) {
pthread_exit(PTHREAD_CANCELED);
}
}
diff --git a/mdk-stage1/dietlibc/libpthread/thread_internal.h b/mdk-stage1/dietlibc/libpthread/thread_internal.h
index 5eb3bbd08..7843fb59d 100644
--- a/mdk-stage1/dietlibc/libpthread/thread_internal.h
+++ b/mdk-stage1/dietlibc/libpthread/thread_internal.h
@@ -9,6 +9,8 @@
#error "the diet libc is not compiled with thread safeness enabled!"
#endif
+#undef errno
+
/* cleanup */
#define PTHREAD_MAX_CLEANUP 8
struct thread_cleanup_t {
@@ -18,15 +20,13 @@ struct thread_cleanup_t {
/* 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 exited; /* Process is dead */
int policy; /* thread scheduling policy */
int priority; /* thread priority */
@@ -42,7 +42,7 @@ struct _pthread_descr_struct {
/* thread exit handling */
void *retval; /* thread return value */
- int join; /* thread waits for other to return */
+ int joined; /* flag other thread has joined */
jmp_buf jmp_exit; /* pthread_exit jump */
/* thread flags */
@@ -58,7 +58,7 @@ struct _pthread_descr_struct {
void* arg; /* thread argument */
/* create thread / manager thread lock */
- struct _pthread_fastlock *manager_lock;
+ struct _pthread_fastlock go;
/* cleanup stack */
struct thread_cleanup_t cleanup_stack[PTHREAD_MAX_CLEANUP];
@@ -84,12 +84,13 @@ 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();
+_pthread_descr __thread_get_free(void);
+_pthread_descr __thread_self(void);
-void __thread_cleanup(_pthread_descr th);
+int __thread_join(_pthread_descr join, void **return_value);
+#define __thread_cleanup(th) (void)__thread_join((th),0)
-void __thread_wait_some_time();
+void __thread_wait_some_time(void);
#define __NO_ASYNC_CANCEL_BEGIN { int oldtype; pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);
#define __NO_ASYNC_CANCEL_END pthread_setcanceltype(oldtype,0); pthread_testcancel(); }
@@ -100,7 +101,7 @@ int signal_manager_thread(_pthread_descr td);
/* init stuff */
extern pthread_once_t __thread_inited;
-void __thread_init();
+void __thread_init(void);
#define __THREAD_INIT() __pthread_once(&__thread_inited, __thread_init)
#define __TEST_CANCEL() pthread_testcancel()
@@ -108,6 +109,7 @@ void __thread_init();
void __libc_free(void *ptr);
void *__libc_malloc(size_t size);
+void *__libc_realloc(void* ptr, size_t size);
void __libc_closelog(void);
void __libc_openlog(const char *ident, int option, int facility);
@@ -119,6 +121,7 @@ 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_fdatasync(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);
diff --git a/mdk-stage1/dietlibc/libregex/rx.c b/mdk-stage1/dietlibc/libregex/rx.c
index b28358c2e..9bab3e22c 100644
--- a/mdk-stage1/dietlibc/libregex/rx.c
+++ b/mdk-stage1/dietlibc/libregex/rx.c
@@ -1,8 +1,11 @@
+#define NDEBUG
#include <regex.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <string.h>
+#include <assert.h>
/* this is ugly.
* the idea is to build a parse tree, then do some poor man's OOP with a
@@ -40,7 +43,7 @@ struct regex {
struct atom {
matcher m;
void* next;
- enum { EMPTY, REGEX, BRACKET, ANY, LINESTART, LINEEND, WORDSTART, WORDEND, CHAR, } type;
+ enum { ILLEGAL, EMPTY, REGEX, BRACKET, ANY, LINESTART, LINEEND, WORDSTART, WORDEND, CHAR, } type;
int bnum;
union {
struct regex r;
@@ -64,7 +67,7 @@ struct branch {
};
static void clearcc(unsigned int* x) {
- memset(x,0,sizeof(*x));
+ memset(x,0,sizeof(struct bracketed));
}
static void setcc(unsigned int* x,unsigned int bit) {
@@ -84,9 +87,9 @@ static const char* parsebracketed(struct bracketed*__restrict__ b,const char*__r
if (*t=='^') { negflag=1; ++t; }
do {
if (*t==0) return s;
- setcc(b->cc,rx->cflags&REG_ICASE?*t:tolower(*t));
+ setcc(b->cc,rx->cflags&REG_ICASE?tolower(*t):*t);
if (t[1]=='-' && t[2]!=']') {
- for (i=*t+1; i<=t[2]; ++i) setcc(b->cc,rx->cflags&REG_ICASE?i:tolower(i));
+ for (i=*t+1; i<=t[2]; ++i) setcc(b->cc,rx->cflags&REG_ICASE?tolower(i):i);
t+=2;
}
++t;
@@ -97,55 +100,79 @@ static const char* parsebracketed(struct bracketed*__restrict__ b,const char*__r
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) {
+static int matchatom(void*__restrict__ x,const unsigned char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) {
register struct atom* a=(struct atom*)x;
int matchlen=0;
+ assert(a->type!=ILLEGAL);
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;
+#ifdef DEBUG
+ printf("matching atom EMPTY against \"%s\"\n",s);
+ printf("a->bnum is %d\n",a->bnum);
+#endif
+ if (a->bnum>=0) 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) {
+#ifdef DEBUG
+ printf("matching atom REGEX against \"%s\"\n",s);
+ printf("a->bnum is %d\n",a->bnum);
+#endif
+ if ((matchlen=a->u.r.m(&a->u.r,s,ofs,preg,0,eflags))>=0) {
+ assert(a->bnum>=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);
+#ifdef DEBUG
+ printf("matching atom BRACKET against \"%s\"\n",s);
+#endif
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);
+#ifdef DEBUG
+ printf("matching atom ANY against \"%s\"\n",s);
+#endif
if (*s=='\n' && (preg->cflags&REG_NEWLINE)) break;
matchlen=1;
if (*s) goto match;
break;
case LINESTART:
-// printf("matching LINESTART against \"%s\"\n",s);
+#ifdef DEBUG
+ printf("matching atom LINESTART against \"%s\"\n",s);
+#endif
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;
+#ifdef DEBUG
+ printf("matching atom LINEEND against \"%s\"\n",s);
+#endif
+ if ((*s && *s!='\n') || (eflags&REG_NOTEOL)) break;
goto match;
case WORDSTART:
- if ((ofs==0 || isspace(s[-1])) && !isspace(*s))
+#ifdef DEBUG
+ printf("matching atom WORDSTART against \"%s\"\n",s);
+#endif
+ if ((ofs==0 || !isalnum(s[-1])) && isalnum(*s))
goto match;
break;
case WORDEND:
- if (ofs>0 && !isspace(s[-1]) && isspace(*s))
+#ifdef DEBUG
+ printf("matching atom WORDEND against \"%s\"\n",s);
+#endif
+ if (ofs>0 && isalnum(s[-1]) && !isalnum(*s))
goto match;
break;
case CHAR:
-// printf("matching CHAR %c against \"%s\"\n",a->u.c,s);
+#ifdef DEBUG
+ printf("matching atom CHAR %c against \"%s\"\n",a->u.c,s);
+#endif
matchlen=1;
if (((preg->cflags&REG_ICASE)?tolower(*s):*s)==a->u.c) goto match;
break;
@@ -160,7 +187,7 @@ match:
static const char* parseatom(struct atom*__restrict__ a,const char*__restrict__ s,regex_t*__restrict__ rx) {
const char *tmp;
- a->m=matchatom;
+ a->m=(matcher)matchatom;
a->bnum=-1;
switch (*s) {
case '(':
@@ -203,7 +230,7 @@ static const char* parseatom(struct atom*__restrict__ a,const char*__restrict__
}
default:
a->type=CHAR;
- a->u.c=rx->cflags&REG_ICASE?*s:tolower(*s);
+ a->u.c=rx->cflags&REG_ICASE?tolower(*s):*s;
break;
}
return s+1;
@@ -213,9 +240,15 @@ static const char* parseatom(struct atom*__restrict__ a,const char*__restrict__
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);
+ int tmp=0,num=0;
+ unsigned int *offsets;
+ assert(a->max>0 && a->max<1000);
+#ifdef DEBUG
+ printf("alloca(%d)\n",sizeof(int)*a->max);
+#endif
+ offsets=alloca(sizeof(int)*a->max);
offsets[0]=0;
+// printf("allocating %d offsets...\n",a->max);
// 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)
@@ -227,6 +260,7 @@ static int matchpiece(void*__restrict__ x,const char*__restrict__ s,int ofs,stru
a->a.next=save;
++num;
matchlen+=tmp;
+// printf("setting offsets[%d] to %d\n",num,tmp);
offsets[num]=tmp;
} else {
a->a.next=save;
@@ -235,12 +269,13 @@ static int matchpiece(void*__restrict__ x,const char*__restrict__ s,int ofs,stru
}
if (num<a->min) return -1; /* already at minimum matches; signal mismatch */
/* then, while the rest does not match, back off */
- for (;;) {
+ for (;num>=0;) {
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 */
+// printf("using offsets[%d] (%d)\n",num,offsets[num]);
matchlen-=offsets[num];
--num;
}
@@ -279,6 +314,11 @@ static const char* parsepiece(struct piece*__restrict__ p,const char*__restrict_
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;
+#ifdef DEBUG
+ printf("%08p matching branch against \"%s\"\n",a,s);
+ printf("%p %p\n",&a->p->m,a->p->m);
+#endif
+ assert(a->p->m==matchpiece);
tmp=a->p->m(a->p,s,ofs,preg,plus,eflags);
if (tmp>=0) {
if (a->next)
@@ -291,7 +331,7 @@ static int matchbranch(void*__restrict__ x,const char*__restrict__ s,int ofs,str
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;
+ const char *tmp; /* the gcc warning here is bogus */
b->m=matchbranch;
b->num=0; b->p=0;
for (;;) {
@@ -305,9 +345,11 @@ static const char* parsebranch(struct branch*__restrict__ b,const char*__restric
tmp=parsepiece(&p,s,rx);
if (tmp==s) return s;
}
+// printf("b->p from %p to ",b->p);
if (!(b->p=realloc(b->p,++b->num*sizeof(p)))) return s;
+// printf("%p (size %d)\n",b->p,b->num*sizeof(p));
b->p[b->num-1]=p;
- if (*s=='|') { ++tmp; break; }
+ if (*tmp=='|') { break; }
s=tmp;
}
*pieces+=b->num;
@@ -318,7 +360,11 @@ static const char* parsebranch(struct branch*__restrict__ b,const char*__restric
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;
+#ifdef DEBUG
+ printf("%08p matching regex against \"%s\"\n",a,s);
+#endif
for (i=0; i<a->num; ++i) {
+ assert(a->b[i].m==matchbranch);
tmp=a->b[i].m(&a->b[i],s,ofs,preg,plus,eflags);
if (tmp>=0) {
if (a->next)
@@ -335,12 +381,15 @@ static const char* parseregex(struct regex*__restrict__ r,const char*__restrict_
const char *tmp;
r->m=matchregex;
r->num=0; r->b=0; r->pieces=0;
+ p->brackets=0;
for (;;) {
tmp=parsebranch(&b,s,p,&r->pieces);
if (tmp==s) return s;
+// printf("r->b from %p to ",r->b);
if (!(r->b=realloc(r->b,++r->num*sizeof(b)))) return s;
+// printf("%p (size %d)\n",r->b,r->num*sizeof(b));
r->b[r->num-1]=b;
- s=tmp;
+ s=tmp; if (*s=='|') ++s;
}
return tmp;
}
@@ -355,7 +404,7 @@ 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);
+ regex_putnext(&a->u.r,0);
}
static void piece_putnext(struct piece*__restrict__ p,void*__restrict__ next) {
@@ -365,8 +414,12 @@ static void piece_putnext(struct piece*__restrict__ p,void*__restrict__ 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]);
+ for (i=0; i<b->num-1; ++i) {
+ if (b->p[i+1].min==1 && b->p[i+1].max==1)
+ piece_putnext(&b->p[i],&b->p[i+1].a);
+ else
+ piece_putnext(&b->p[i],&b->p[i+1]);
+ }
piece_putnext(&b->p[i],0);
b->next=next;
}
@@ -381,21 +434,29 @@ static void regex_putnext(struct regex*__restrict__ r,void*__restrict__ next) {
int regcomp(regex_t*__restrict__ preg, const char*__restrict__ regex, int cflags) {
- const char* t=parseregex(&preg->r,regex,preg);
+ const char* t;
+ preg->cflags=cflags;
+ 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));
+ assert(preg->brackets+1>0 && preg->brackets<1000);
+#ifdef DEBUG
+ printf("alloca(%d)\n",sizeof(regmatch_t)*(preg->brackets+3));
+#endif
+ ((regex_t*)preg)->l=alloca(sizeof(regmatch_t)*(preg->brackets+3));
while (*string) {
matched=preg->r.m((void*)&preg->r,string,string-orig,(regex_t*)preg,0,eflags);
+// printf("ebp on stack = %x\n",stack[1]);
if (matched>=0) {
- if ((preg->cflags&REG_NOSUB)==0) memmove(pmatch,preg->l,nmatch*sizeof(regmatch_t));
+ preg->l[0].rm_so=string-orig;
+ preg->l[0].rm_eo=string-orig+matched;
+ if ((preg->cflags&REG_NOSUB)==0) memcpy(pmatch,preg->l,nmatch*sizeof(regmatch_t));
return 0;
}
++string; eflags|=REG_NOTBOL;
@@ -407,10 +468,9 @@ int regexec(const regex_t*__restrict__ preg, const char*__restrict__ string, siz
void regfree(regex_t* preg) {
int i;
- for (i=0; i<preg->r.num; ++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) {
diff --git a/mdk-stage1/dietlibc/librpc/auth_none.c b/mdk-stage1/dietlibc/librpc/auth_none.c
index 7a4dffe87..59124bae4 100644
--- a/mdk-stage1/dietlibc/librpc/auth_none.c
+++ b/mdk-stage1/dietlibc/librpc/auth_none.c
@@ -46,14 +46,11 @@ static char sccsid[] =
#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 void authnone_destroy();
+static bool_t authnone_marshal(AUTH *client, XDR *xdrs);
static struct auth_ops ops = {
authnone_verf,
@@ -66,7 +63,7 @@ static struct auth_ops ops = {
static struct authnone_private {
AUTH no_client;
char marshalled_client[MAX_MARSHEL_SIZE];
- u_int mcnt;
+ unsigned int mcnt;
} *authnone_private;
AUTH *authnone_create()
@@ -86,7 +83,7 @@ AUTH *authnone_create()
ap->no_client.ah_ops = &ops;
xdrs = &xdr_stream;
xdrmem_create(xdrs, ap->marshalled_client,
- (u_int) MAX_MARSHEL_SIZE, XDR_ENCODE);
+ (unsigned 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);
@@ -126,3 +123,4 @@ static bool_t authnone_refresh()
static void authnone_destroy()
{
}
+
diff --git a/mdk-stage1/dietlibc/librpc/auth_unix.c b/mdk-stage1/dietlibc/librpc/auth_unix.c
index 5daeb5f4a..59eb6ff18 100644
--- a/mdk-stage1/dietlibc/librpc/auth_unix.c
+++ b/mdk-stage1/dietlibc/librpc/auth_unix.c
@@ -78,9 +78,9 @@ static struct auth_ops auth_unix_ops = {
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 */
+ unsigned long au_shfaults; /* short hand cache faults */
char au_marshed[MAX_AUTH_BYTES];
- u_int au_mpos; /* xdr pos at end of marshed */
+ unsigned int au_mpos; /* xdr pos at end of marshed */
};
#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private)
@@ -121,7 +121,7 @@ AUTH *authunix_create __P ((char *machname, uid_t uid,
}
#endif
auth->ah_ops = &auth_unix_ops;
- auth->ah_private = (caddr_t) au;
+ auth->ah_private = (char*) au;
auth->ah_verf = au->au_shcred = _null_auth;
au->au_shfaults = 0;
@@ -133,7 +133,7 @@ AUTH *authunix_create __P ((char *machname, uid_t uid,
aup.aup_machname = machname;
aup.aup_uid = uid;
aup.aup_gid = gid;
- aup.aup_len = (u_int) len;
+ aup.aup_len = (unsigned int) len;
aup.aup_gids = aup_gids;
/*
@@ -145,14 +145,14 @@ AUTH *authunix_create __P ((char *machname, uid_t uid,
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);
+ au->au_origcred.oa_base = mem_alloc((unsigned int) len);
#else
- if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) {
+ if ((au->au_origcred.oa_base = mem_alloc((unsigned 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);
+ memmove(au->au_origcred.oa_base, mymem, (unsigned int) len);
/*
* set auth handle to reflect new cred.
@@ -288,7 +288,7 @@ register AUTH *auth;
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));
+ mem_free((char*) auth, sizeof(*auth));
}
/*
@@ -311,3 +311,4 @@ register AUTH *auth;
}
XDR_DESTROY(xdrs);
}
+
diff --git a/mdk-stage1/dietlibc/librpc/authunix_prot.c b/mdk-stage1/dietlibc/librpc/authunix_prot.c
index ddcadb808..53897a364 100644
--- a/mdk-stage1/dietlibc/librpc/authunix_prot.c
+++ b/mdk-stage1/dietlibc/librpc/authunix_prot.c
@@ -59,7 +59,7 @@ register struct authunix_parms *p;
&& 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),
+ && xdr_array(xdrs, (char* *) & (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;
diff --git a/mdk-stage1/dietlibc/librpc/bindresvport.c b/mdk-stage1/dietlibc/librpc/bindresvport.c
index 8b65261dd..1131cc263 100644
--- a/mdk-stage1/dietlibc/librpc/bindresvport.c
+++ b/mdk-stage1/dietlibc/librpc/bindresvport.c
@@ -37,6 +37,7 @@
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include "dietfeatures.h"
/*
* Bind a socket to a privileged IP port
@@ -48,7 +49,6 @@ struct sockaddr_in *sin;
int res;
static short port;
struct sockaddr_in myaddr;
- extern int errno;
int i;
#define STARTPORT 600
@@ -57,7 +57,7 @@ struct sockaddr_in *sin;
if (sin == (struct sockaddr_in *) 0) {
sin = &myaddr;
- bzero(sin, sizeof(*sin));
+ memset(sin,0,sizeof(*sin));
sin->sin_family = AF_INET;
} else if (sin->sin_family != AF_INET) {
errno = EPFNOSUPPORT;
diff --git a/mdk-stage1/dietlibc/librpc/clnt_generic.c b/mdk-stage1/dietlibc/librpc/clnt_generic.c
index 9bb81cc80..5c0b96af9 100644
--- a/mdk-stage1/dietlibc/librpc/clnt_generic.c
+++ b/mdk-stage1/dietlibc/librpc/clnt_generic.c
@@ -44,8 +44,8 @@ static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
* 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))
+CLIENT *clnt_create __P ((const char *hostname, const unsigned long prog,
+ const unsigned long vers, const char *proto))
{
struct hostent *h;
struct protoent *p;
@@ -68,14 +68,14 @@ CLIENT *clnt_create __P ((const char *hostname, const u_long prog,
return (NULL);
}
#ifdef __linux__
- bzero((char *) &sin, sizeof(sin));
+ memset((char*)&sin,0,sizeof(sin));
#endif
sin.sin_family = h->h_addrtype;
sin.sin_port = 0;
#ifndef __linux__
- bzero(sin.sin_zero, sizeof(sin.sin_zero));
+ memset(sin.sin_zero,0,sizeof(sin.sin_zero));
#endif
- bcopy(h->h_addr, (char *) &sin.sin_addr, h->h_length);
+ memmove((char *) &sin.sin_addr, h->h_addr, h->h_length);
p = getprotobyname(proto);
if (p == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
diff --git a/mdk-stage1/dietlibc/librpc/clnt_raw.c b/mdk-stage1/dietlibc/librpc/clnt_raw.c
index 7479b55d6..52ab64421 100644
--- a/mdk-stage1/dietlibc/librpc/clnt_raw.c
+++ b/mdk-stage1/dietlibc/librpc/clnt_raw.c
@@ -54,7 +54,7 @@ static struct clntraw_private {
XDR xdr_stream;
char _raw_buf[UDPMSGSIZE];
char mashl_callmsg[MCALL_MSG_SIZE];
- u_int mcnt;
+ unsigned int mcnt;
} *clntraw_private;
static enum clnt_stat clntraw_call();
@@ -73,14 +73,12 @@ static struct clnt_ops client_ops = {
clntraw_control
};
-void svc_getreq();
-
/*
* Create a client handle for memory based rpc.
*/
CLIENT *clntraw_create(prog, vers)
-u_long prog;
-u_long vers;
+unsigned long prog;
+unsigned long vers;
{
register struct clntraw_private *clp = clntraw_private;
struct rpc_msg call_msg;
@@ -123,11 +121,11 @@ u_long vers;
static enum clnt_stat
clntraw_call(h, proc, xargs, argsp, xresults, resultsp, timeout)
CLIENT *h;
-u_long proc;
+unsigned long proc;
xdrproc_t xargs;
-caddr_t argsp;
+char* argsp;
xdrproc_t xresults;
-caddr_t resultsp;
+char* resultsp;
struct timeval timeout;
{
register struct clntraw_private *clp = clntraw_private;
@@ -202,7 +200,7 @@ static void clntraw_geterr()
static bool_t clntraw_freeres(cl, xdr_res, res_ptr)
CLIENT *cl;
xdrproc_t xdr_res;
-caddr_t res_ptr;
+char* res_ptr;
{
register struct clntraw_private *clp = clntraw_private;
register XDR *xdrs = &clp->xdr_stream;
@@ -228,3 +226,4 @@ static bool_t clntraw_control()
static void clntraw_destroy()
{
}
+
diff --git a/mdk-stage1/dietlibc/librpc/clnt_simple.c b/mdk-stage1/dietlibc/librpc/clnt_simple.c
index f309f86ff..e1f4c5f6c 100644
--- a/mdk-stage1/dietlibc/librpc/clnt_simple.c
+++ b/mdk-stage1/dietlibc/librpc/clnt_simple.c
@@ -54,8 +54,8 @@ static struct callrpc_private {
char *oldhost;
} *callrpc_private;
-int callrpc (const char *host, const u_long prognum,
- const u_long versnum, const u_long procnum,
+int callrpc (const char *host, const unsigned long prognum,
+ const unsigned long versnum, const unsigned long procnum,
const xdrproc_t inproc, const char *in,
const xdrproc_t outproc, char *out)
{
@@ -91,11 +91,11 @@ int callrpc (const char *host, const u_long prognum,
return ((int) RPC_UNKNOWNHOST);
timeout.tv_usec = 0;
timeout.tv_sec = 5;
- bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length);
+ memmove((char *) &server_addr.sin_addr, hp->h_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,
+ if ((crp->client = clntudp_create(&server_addr, (unsigned long) prognum,
+ (unsigned long) versnum, timeout,
&crp->socket)) == NULL)
return ((int) rpc_createerr.cf_stat);
crp->valid = 1;
diff --git a/mdk-stage1/dietlibc/librpc/clnt_tcp.c b/mdk-stage1/dietlibc/librpc/clnt_tcp.c
index 8c39e8933..56bf3315a 100644
--- a/mdk-stage1/dietlibc/librpc/clnt_tcp.c
+++ b/mdk-stage1/dietlibc/librpc/clnt_tcp.c
@@ -57,11 +57,10 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
#include <errno.h>
#include <rpc/pmap_clnt.h>
#include <unistd.h>
+#include "dietfeatures.h"
#define MCALL_MSG_SIZE 24
-extern int errno;
-
static int readtcp();
static int writetcp();
@@ -89,7 +88,7 @@ struct ct_data {
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 */
+ unsigned int ct_mpos; /* pos after marshal */
XDR ct_xdrs;
};
@@ -109,11 +108,11 @@ struct ct_data {
*/
CLIENT *clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
struct sockaddr_in *raddr;
-u_long prog;
-u_long vers;
+unsigned long prog;
+unsigned long vers;
register int *sockp;
-u_int sendsz;
-u_int recvsz;
+unsigned int sendsz;
+unsigned int recvsz;
{
CLIENT *h;
register struct ct_data *ct;
@@ -139,12 +138,12 @@ u_int recvsz;
* If no port number given ask the pmap for one
*/
if (raddr->sin_port == 0) {
- u_short port;
+ unsigned short port;
if ((port = pmap_getport(raddr, prog, vers, IPPROTO_TCP)) == 0) {
- mem_free((caddr_t) ct, sizeof(struct ct_data));
+ mem_free((char*) ct, sizeof(struct ct_data));
- mem_free((caddr_t) h, sizeof(CLIENT));
+ mem_free((char*) h, sizeof(CLIENT));
return ((CLIENT *) NULL);
}
raddr->sin_port = htons(port);
@@ -206,9 +205,9 @@ u_int recvsz;
* and authnone for authentication.
*/
xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz,
- (caddr_t) ct, readtcp, writetcp);
+ (char*) ct, readtcp, writetcp);
h->cl_ops = &tcp_ops;
- h->cl_private = (caddr_t) ct;
+ h->cl_private = (char*) ct;
h->cl_auth = authnone_create();
return (h);
@@ -216,9 +215,9 @@ u_int recvsz;
/*
* Something goofed, free stuff and barf
*/
- mem_free((caddr_t) ct, sizeof(struct ct_data));
+ mem_free((char*) ct, sizeof(struct ct_data));
- mem_free((caddr_t) h, sizeof(CLIENT));
+ mem_free((char*) h, sizeof(CLIENT));
return ((CLIENT *) NULL);
}
@@ -226,18 +225,18 @@ static enum clnt_stat
clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr,
timeout)
register CLIENT *h;
-u_long proc;
+unsigned long proc;
xdrproc_t xdr_args;
-caddr_t args_ptr;
+char* args_ptr;
xdrproc_t xdr_results;
-caddr_t results_ptr;
+char* 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 */
+ unsigned long x_id;
+ unsigned long *msg_x_id = (unsigned long *) (ct->ct_mcall); /* yuk */
register bool_t shipnow;
int refreshes = 2;
@@ -332,7 +331,7 @@ struct rpc_err *errp;
static bool_t clnttcp_freeres(cl, xdr_res, res_ptr)
CLIENT *cl;
xdrproc_t xdr_res;
-caddr_t res_ptr;
+char* res_ptr;
{
register struct ct_data *ct = (struct ct_data *) cl->cl_private;
register XDR *xdrs = &(ct->ct_xdrs);
@@ -379,9 +378,9 @@ CLIENT *h;
(void) close(ct->ct_sock);
}
XDR_DESTROY(&(ct->ct_xdrs));
- mem_free((caddr_t) ct, sizeof(struct ct_data));
+ mem_free((char*) ct, sizeof(struct ct_data));
- mem_free((caddr_t) h, sizeof(CLIENT));
+ mem_free((char*) h, sizeof(CLIENT));
}
/*
@@ -391,7 +390,7 @@ CLIENT *h;
*/
static int readtcp(ct, buf, len)
register struct ct_data *ct;
-caddr_t buf;
+char* buf;
register int len;
{
#ifdef FD_SETSIZE
@@ -447,7 +446,7 @@ register int len;
static int writetcp(ct, buf, len)
struct ct_data *ct;
-caddr_t buf;
+char* buf;
int len;
{
register int i, cnt;
@@ -461,3 +460,4 @@ int len;
}
return (len);
}
+
diff --git a/mdk-stage1/dietlibc/librpc/clnt_udp.c b/mdk-stage1/dietlibc/librpc/clnt_udp.c
index 7305d3ff1..874ef62db 100644
--- a/mdk-stage1/dietlibc/librpc/clnt_udp.c
+++ b/mdk-stage1/dietlibc/librpc/clnt_udp.c
@@ -45,8 +45,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
#include <errno.h>
#include <rpc/pmap_clnt.h>
#include <unistd.h>
-
-extern int errno;
+#include "dietfeatures.h"
/*
* UDP bases client side rpc operations
@@ -67,6 +66,7 @@ static struct clnt_ops udp_ops = {
clntudp_control
};
+
/*
* Private data kept per client handle
*/
@@ -79,10 +79,10 @@ struct cu_data {
struct timeval cu_total;
struct rpc_err cu_error;
XDR cu_outxdrs;
- u_int cu_xdrpos;
- u_int cu_sendsz;
+ unsigned int cu_xdrpos;
+ unsigned int cu_sendsz;
char *cu_outbuf;
- u_int cu_recvsz;
+ unsigned int cu_recvsz;
char cu_inbuf[1];
};
@@ -105,12 +105,12 @@ struct cu_data {
CLIENT *clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz,
recvsz)
struct sockaddr_in *raddr;
-u_long program;
-u_long version;
+unsigned long program;
+unsigned long version;
struct timeval wait;
register int *sockp;
-u_int sendsz;
-u_int recvsz;
+unsigned int sendsz;
+unsigned int recvsz;
{
CLIENT *cl;
register struct cu_data *cu;
@@ -137,7 +137,7 @@ u_int recvsz;
(void) gettimeofday(&now, (struct timezone *) 0);
if (raddr->sin_port == 0) {
- u_short port;
+ unsigned short port;
if ((port =
pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) {
@@ -146,7 +146,7 @@ u_int recvsz;
raddr->sin_port = htons(port);
}
cl->cl_ops = &udp_ops;
- cl->cl_private = (caddr_t) cu;
+ cl->cl_private = (char*) cu;
cu->cu_raddr = *raddr;
cu->cu_rlen = sizeof(cu->cu_raddr);
cu->cu_wait = wait;
@@ -186,16 +186,16 @@ u_int recvsz;
return (cl);
fooy:
if (cu)
- mem_free((caddr_t) cu, sizeof(*cu) + sendsz + recvsz);
+ mem_free((char*) cu, sizeof(*cu) + sendsz + recvsz);
if (cl)
- mem_free((caddr_t) cl, sizeof(CLIENT));
+ mem_free((char*) cl, sizeof(CLIENT));
return ((CLIENT *) NULL);
}
CLIENT *clntudp_create(raddr, program, version, wait, sockp)
struct sockaddr_in *raddr;
-u_long program;
-u_long version;
+unsigned long program;
+unsigned long version;
struct timeval wait;
register int *sockp;
{
@@ -207,11 +207,11 @@ register int *sockp;
static enum clnt_stat
clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
register CLIENT *cl; /* client handle */
-u_long proc; /* procedure number */
+unsigned long proc; /* procedure number */
xdrproc_t xargs; /* xdr routine for args */
-caddr_t argsp; /* pointer to args */
+char* argsp; /* pointer to args */
xdrproc_t xresults; /* xdr routine for results */
-caddr_t resultsp; /* pointer to results */
+char* resultsp; /* pointer to results */
struct timeval utimeout; /* seconds to wait before giving up */
{
register struct cu_data *cu = (struct cu_data *) cl->cl_private;
@@ -250,7 +250,7 @@ struct timeval utimeout; /* seconds to wait before giving up */
/*
* the transaction is the first thing in the out buffer
*/
- (*(u_short *) (cu->cu_outbuf))++;
+ (*(unsigned 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);
@@ -324,10 +324,10 @@ struct timeval utimeout; /* seconds to wait before giving up */
cu->cu_error.re_errno = errno;
return (cu->cu_error.re_status = RPC_CANTRECV);
}
- if (inlen < sizeof(u_long))
+ if (inlen < sizeof(unsigned long))
continue;
/* see if reply transaction id matches sent id */
- if (*((u_long *) (cu->cu_inbuf)) != *((u_long *) (cu->cu_outbuf)))
+ if (*((unsigned long *) (cu->cu_inbuf)) != *((unsigned long *) (cu->cu_outbuf)))
continue;
/* we now assume we have the proper reply */
break;
@@ -336,7 +336,7 @@ struct timeval utimeout; /* seconds to wait before giving up */
/*
* now decode and validate the response
*/
- xdrmem_create(&reply_xdrs, cu->cu_inbuf, (u_int) inlen, XDR_DECODE);
+ xdrmem_create(&reply_xdrs, cu->cu_inbuf, (unsigned int) inlen, XDR_DECODE);
ok = xdr_replymsg(&reply_xdrs, &reply_msg);
/* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */
if (ok) {
@@ -380,7 +380,7 @@ struct rpc_err *errp;
static bool_t clntudp_freeres(cl, xdr_res, res_ptr)
CLIENT *cl;
xdrproc_t xdr_res;
-caddr_t res_ptr;
+char* res_ptr;
{
register struct cu_data *cu = (struct cu_data *) cl->cl_private;
register XDR *xdrs = &(cu->cu_outxdrs);
@@ -432,6 +432,7 @@ CLIENT *cl;
(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));
+ mem_free((char*) cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz));
+ mem_free((char*) cl, sizeof(CLIENT));
}
+
diff --git a/mdk-stage1/dietlibc/librpc/get_myaddress.c b/mdk-stage1/dietlibc/librpc/get_myaddress.c
index cd63383d0..1ce2c2b32 100644
--- a/mdk-stage1/dietlibc/librpc/get_myaddress.c
+++ b/mdk-stage1/dietlibc/librpc/get_myaddress.c
@@ -64,6 +64,6 @@ void get_myaddress(struct sockaddr_in* addr)
exit(1);
}
addr->sin_family = AF_INET;
- bcopy((char *) hp->h_addr, (char *) &addr->sin_addr, hp->h_length);
+ memmove((char *) &addr->sin_addr, (char *) hp->h_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
index 5e7f694d2..71774a2eb 100644
--- a/mdk-stage1/dietlibc/librpc/getrpcent.c
+++ b/mdk-stage1/dietlibc/librpc/getrpcent.c
@@ -44,6 +44,7 @@ static char sccsid[] =
#include <netdb.h>
#include <sys/socket.h>
#include <string.h>
+#include <arpa/inet.h>
/*
* Internet version.
@@ -60,9 +61,7 @@ struct rpcdata {
char *domain;
} *rpcdata;
-static struct rpcent *interpret();
-struct hostent *gethostent();
-char *inet_ntoa();
+static struct rpcent *interpret(const char* val, size_t len);
#ifndef __linux__
static char *index();
@@ -195,7 +194,7 @@ char *s;
}
#endif
-static struct rpcent *interpret(const char* val, int len)
+static struct rpcent *interpret(const char* val, size_t len)
{
register struct rpcdata *d = _rpcdata();
char *p;
@@ -203,7 +202,7 @@ static struct rpcent *interpret(const char* val, int len)
if (d == 0)
return 0;
- strncpy(d->line, val, len);
+ strncpy(d->line, val, (size_t)len);
p = d->line;
d->line[len] = '\n';
if (*p == '#')
diff --git a/mdk-stage1/dietlibc/librpc/getrpcport.c b/mdk-stage1/dietlibc/librpc/getrpcport.c
index a7085cbe7..7b6e50a7d 100644
--- a/mdk-stage1/dietlibc/librpc/getrpcport.c
+++ b/mdk-stage1/dietlibc/librpc/getrpcport.c
@@ -42,15 +42,15 @@ static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI";
#include <string.h>
#include <rpc/pmap_clnt.h>
-extern int getrpcport (const char * host, u_long prognum,
- u_long versnum, u_int proto)
+extern int getrpcport (const char * host, unsigned long prognum,
+ unsigned long versnum, unsigned 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);
+ memmove((char *) &addr.sin_addr, hp->h_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
index 428675656..9dbf3f624 100644
--- a/mdk-stage1/dietlibc/librpc/pmap_clnt.c
+++ b/mdk-stage1/dietlibc/librpc/pmap_clnt.c
@@ -48,18 +48,15 @@ static char sccsid[] =
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;
+unsigned long program;
+unsigned long version;
int protocol;
-u_short port;
+unsigned short port;
{
struct sockaddr_in myaddress;
int socket = -1;
@@ -77,7 +74,7 @@ u_short port;
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,
+ if (CLNT_CALL(client, PMAPPROC_SET, (xdrproc_t)xdr_pmap, (char*)&parms, (xdrproc_t)xdr_bool, (void*)&rslt,
tottimeout) != RPC_SUCCESS) {
clnt_perror(client, "Cannot register service");
return (FALSE);
@@ -92,8 +89,8 @@ u_short port;
* Calls the pmap service remotely to do the un-mapping.
*/
bool_t pmap_unset(program, version)
-u_long program;
-u_long version;
+unsigned long program;
+unsigned long version;
{
struct sockaddr_in myaddress;
int socket = -1;
@@ -110,7 +107,7 @@ u_long version;
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,
+ CLNT_CALL(client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, (char*)&parms, (xdrproc_t)xdr_bool, (void*)&rslt,
tottimeout);
CLNT_DESTROY(client);
(void) close(socket);
diff --git a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c b/mdk-stage1/dietlibc/librpc/pmap_getmaps.c
index 6940783fb..de51a733a 100644
--- a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c
+++ b/mdk-stage1/dietlibc/librpc/pmap_getmaps.c
@@ -48,14 +48,13 @@ static char sccsid[] =
#include <netdb.h>
#include <stdio.h>
#include <errno.h>
+#include <netinet/in.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.
@@ -74,7 +73,7 @@ struct sockaddr_in *address;
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) {
+ (char*)&head, minutetimeout) != RPC_SUCCESS) {
clnt_perror(client, "pmap_getmaps rpc problem");
}
CLNT_DESTROY(client);
diff --git a/mdk-stage1/dietlibc/librpc/pmap_getport.c b/mdk-stage1/dietlibc/librpc/pmap_getport.c
index 174dca41a..edf199e69 100644
--- a/mdk-stage1/dietlibc/librpc/pmap_getport.c
+++ b/mdk-stage1/dietlibc/librpc/pmap_getport.c
@@ -55,18 +55,18 @@ static struct timeval tottimeout = { 60, 0 };
* Calls the pmap service remotely to do the lookup.
* Returns 0 if no map exists.
*/
-u_short pmap_getport(address, program, version, protocol)
+unsigned short pmap_getport(address, program, version, protocol)
struct sockaddr_in *address;
-u_long program;
-u_long version;
-u_int protocol;
+unsigned long program;
+unsigned long version;
+unsigned int protocol;
{
- u_short port = 0;
+ unsigned short port = 0;
int socket = -1;
register CLIENT *client;
struct pmap parms;
- address->sin_port = htons(PMAPPORT);
+ address->sin_port = htons((unsigned short)PMAPPORT);
client = clntudp_bufcreate(address, PMAPPROG,
PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE,
RPCSMALLMSGSIZE);
@@ -75,8 +75,8 @@ u_int protocol;
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) {
+ if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (char*)&parms,
+ (xdrproc_t)xdr_u_short, (char*)&port, tottimeout) != RPC_SUCCESS) {
rpc_createerr.cf_stat = RPC_PMAPFAILURE;
clnt_geterr(client, &rpc_createerr.cf_error);
} else if (port == 0) {
diff --git a/mdk-stage1/dietlibc/librpc/pmap_prot2.c b/mdk-stage1/dietlibc/librpc/pmap_prot2.c
index 870c844ed..cd2deb036 100644
--- a/mdk-stage1/dietlibc/librpc/pmap_prot2.c
+++ b/mdk-stage1/dietlibc/librpc/pmap_prot2.c
@@ -107,8 +107,8 @@ bool_t xdr_pmaplist(XDR* xdrs, struct pmaplist** rp)
*/
if (freeing)
next = &((*rp)->pml_next);
- if (!xdr_reference(xdrs, (caddr_t *) rp,
- (u_int) sizeof(struct pmaplist), (xdrproc_t)xdr_pmap))
+ if (!xdr_reference(xdrs, (char* *) rp,
+ (unsigned 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
index 02efcf91c..390bd736e 100644
--- a/mdk-stage1/dietlibc/librpc/pmap_rmt.c
+++ b/mdk-stage1/dietlibc/librpc/pmap_rmt.c
@@ -49,11 +49,12 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
//#include <net/if.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
+#include <netinet/in.h>
#define MAX_BROADCAST_SIZE 1400
#include <unistd.h>
#include <string.h>
+#include "dietfeatures.h"
-extern int errno;
static struct timeval timeout = { 3, 0 };
@@ -64,42 +65,40 @@ static struct timeval timeout = { 3, 0 };
* 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;
+enum clnt_stat pmap_rmtcall (struct sockaddr_in *addr,
+ const unsigned long prog,
+ const unsigned long vers,
+ const unsigned long proc,
+ xdrproc_t xdrargs,
+ char* argsp, xdrproc_t xdrres,
+ char* resp, struct timeval tout,
+ unsigned 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);
+ addr->sin_port = htons((short)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, (char*)&a,
+ (xdrproc_t)xdr_rmtcallres, (char*)&r, tout);
+ CLNT_DESTROY(client);
+ } else {
+ stat = RPC_FAILED;
+ }
+ (void) close(socket);
+ addr->sin_port = 0;
+ return (stat);
}
@@ -109,7 +108,7 @@ u_long *port_ptr;
*/
bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap)
{
- u_int lenposition, argposition, position;
+ unsigned int lenposition, argposition, position;
if (xdr_u_long(xdrs, &(cap->prog)) &&
xdr_u_long(xdrs, &(cap->vers)) && xdr_u_long(xdrs, &(cap->proc))) {
@@ -120,7 +119,7 @@ bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap)
if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr))
return (FALSE);
position = XDR_GETPOS(xdrs);
- cap->arglen = (u_long) position - (u_long) argposition;
+ cap->arglen = (unsigned long) position - (unsigned long) argposition;
XDR_SETPOS(xdrs, lenposition);
if (!xdr_u_long(xdrs, &(cap->arglen)))
return (FALSE);
@@ -136,12 +135,12 @@ bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap)
*/
bool_t xdr_rmtcallres(XDR* xdrs, struct rmtcallres* crp)
{
- caddr_t port_ptr;
+ char* port_ptr;
- port_ptr = (caddr_t) crp->port_ptr;
- if (xdr_reference(xdrs, &port_ptr, sizeof(u_long),
+ port_ptr = (char*) crp->port_ptr;
+ if (xdr_reference(xdrs, &port_ptr, sizeof(unsigned long),
(xdrproc_t)xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) {
- crp->port_ptr = (u_long *) port_ptr;
+ crp->port_ptr = (unsigned long *) port_ptr;
return ((*(crp->xdr_results)) (xdrs, crp->results_ptr));
}
return (FALSE);
@@ -222,13 +221,13 @@ char *buf; /* why allocxate more when we can use existing... */
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 */
+unsigned long prog; /* program number */
+unsigned long vers; /* version number */
+unsigned long proc; /* procedure number */
xdrproc_t xargs; /* xdr routine for args */
-caddr_t argsp; /* pointer to args */
+char* argsp; /* pointer to args */
xdrproc_t xresults; /* xdr routine for results */
-caddr_t resultsp; /* pointer to results */
+char* resultsp; /* pointer to results */
resultproc_t eachresult; /* call with each result obtained */
{
enum clnt_stat stat;
@@ -248,8 +247,8 @@ resultproc_t eachresult; /* call with each result obtained */
#endif /* def FD_SETSIZE */
register int i;
bool_t done = FALSE;
- register u_long xid;
- u_long port;
+ register unsigned long xid;
+ unsigned long port;
struct in_addr addrs[20];
struct sockaddr_in baddr, raddr; /* broadcast and response addresses */
struct rmtcallargs a;
@@ -281,9 +280,9 @@ resultproc_t eachresult; /* call with each result obtained */
mask = (1 << sock);
#endif /* def FD_SETSIZE */
nets = getbroadcastnets(addrs, sock, inbuf);
- bzero((char *) &baddr, sizeof(baddr));
+ memset((char*)&baddr,0,sizeof(baddr));
baddr.sin_family = AF_INET;
- baddr.sin_port = htons(PMAPPORT);
+ baddr.sin_port = htons((short)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);
@@ -318,7 +317,7 @@ resultproc_t eachresult; /* call with each result obtained */
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,
+ if (sendto(sock, outbuf, (size_t)outlen, 0,
(struct sockaddr *) &baddr,
sizeof(struct sockaddr)) != outlen) {
perror("Cannot send broadcast packet");
@@ -332,7 +331,7 @@ resultproc_t eachresult; /* call with each result obtained */
}
recv_again:
msg.acpted_rply.ar_verf = _null_auth;
- msg.acpted_rply.ar_results.where = (caddr_t) & r;
+ msg.acpted_rply.ar_results.where = (char*) & r;
msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_rmtcallres;
readfds = mask;
switch (select(_rpc_dtablesize(), &readfds, 0, 0, &t)) {
@@ -361,18 +360,18 @@ resultproc_t eachresult; /* call with each result obtained */
stat = RPC_CANTRECV;
goto done_broad;
}
- if (inlen < sizeof(u_long))
+ if ((size_t)inlen < sizeof(unsigned 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);
+ xdrmem_create(xdrs, inbuf, (unsigned 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);
+ raddr.sin_port = htons((unsigned short) port);
done = (*eachresult) (resultsp, &raddr);
}
/* otherwise, we just ignore the errors ... */
diff --git a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c b/mdk-stage1/dietlibc/librpc/rpc_callmsg.c
index 4b3a9880e..a3514f41c 100644
--- a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c
+++ b/mdk-stage1/dietlibc/librpc/rpc_callmsg.c
@@ -83,14 +83,14 @@ register struct rpc_msg *cmsg;
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);
+ memmove((char*) buf, oa->oa_base, 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);
+ memmove((char*) buf, oa->oa_base, oa->oa_length);
/* no real need....
buf += RNDUP(oa->oa_length) / sizeof (long);
*/
@@ -122,7 +122,7 @@ register struct rpc_msg *cmsg;
return (FALSE);
}
if (oa->oa_base == NULL) {
- oa->oa_base = (caddr_t)
+ oa->oa_base = (char*)
mem_alloc(oa->oa_length);
}
buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
@@ -132,7 +132,7 @@ register struct rpc_msg *cmsg;
return (FALSE);
}
} else {
- bcopy((caddr_t) buf, oa->oa_base, oa->oa_length);
+ memmove(oa->oa_base, (char*) buf, oa->oa_length);
/* no real need....
buf += RNDUP(oa->oa_length) /
sizeof (long);
@@ -155,7 +155,7 @@ register struct rpc_msg *cmsg;
return (FALSE);
}
if (oa->oa_base == NULL) {
- oa->oa_base = (caddr_t)
+ oa->oa_base = (char*)
mem_alloc(oa->oa_length);
}
buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length));
@@ -165,7 +165,7 @@ register struct rpc_msg *cmsg;
return (FALSE);
}
} else {
- bcopy((caddr_t) buf, oa->oa_base, oa->oa_length);
+ memmove(oa->oa_base, (char*) buf, oa->oa_length);
/* no real need...
buf += RNDUP(oa->oa_length) /
sizeof (long);
diff --git a/mdk-stage1/dietlibc/librpc/rpc_prot.c b/mdk-stage1/dietlibc/librpc/rpc_prot.c
index 19a4db27f..d5ca5ab77 100644
--- a/mdk-stage1/dietlibc/librpc/rpc_prot.c
+++ b/mdk-stage1/dietlibc/librpc/rpc_prot.c
@@ -74,7 +74,7 @@ bool_t xdr_des_block(xdrs, blkp)
register XDR *xdrs;
register des_block *blkp;
{
- return (xdr_opaque(xdrs, (caddr_t) blkp, sizeof(des_block)));
+ return (xdr_opaque(xdrs, (char*) blkp, sizeof(des_block)));
}
/* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */
@@ -146,7 +146,7 @@ register struct rpc_msg *rmsg;
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,
+ (char*) & (rmsg->rm_reply.ru), reply_dscrm,
NULL_xdrproc_t));
return (FALSE);
}
diff --git a/mdk-stage1/dietlibc/librpc/svc.c b/mdk-stage1/dietlibc/librpc/svc.c
index 4fcdb5216..b430deb4a 100644
--- a/mdk-stage1/dietlibc/librpc/svc.c
+++ b/mdk-stage1/dietlibc/librpc/svc.c
@@ -44,12 +44,11 @@ static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro";
#include <errno.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
+#include <string.h>
#ifdef __linux__
#include <sys/types.h>
#endif
-extern int errno;
-
#ifdef FD_SETSIZE
static SVCXPRT **xports;
#else
@@ -69,8 +68,8 @@ static SVCXPRT *xports[NOFILE];
*/
static struct svc_callout {
struct svc_callout *sc_next;
- u_long sc_prog;
- u_long sc_vers;
+ unsigned long sc_prog;
+ unsigned long sc_vers;
void (*sc_dispatch) ();
} *svc_head;
@@ -135,8 +134,8 @@ SVCXPRT *xprt;
*/
bool_t svc_register(xprt, prog, vers, dispatch, protocol)
SVCXPRT *xprt;
-u_long prog;
-u_long vers;
+unsigned long prog;
+unsigned long vers;
void (*dispatch) ();
rpcprot_t protocol;
{
@@ -170,8 +169,8 @@ rpcprot_t protocol;
* Remove a service program from the callout list.
*/
void svc_unregister(prog, vers)
-u_long prog;
-u_long vers;
+unsigned long prog;
+unsigned long vers;
{
struct svc_callout *prev;
register struct svc_callout *s;
@@ -184,7 +183,7 @@ u_long vers;
prev->sc_next = s->sc_next;
}
s->sc_next = NULL_SVC;
- mem_free((char *) s, (u_int) sizeof(struct svc_callout));
+ mem_free((char *) s, (unsigned int) sizeof(struct svc_callout));
/* now unregister the information with the local binder service */
(void) pmap_unset(prog, vers);
@@ -195,8 +194,8 @@ u_long vers;
* struct.
*/
static struct svc_callout *svc_find(prog, vers, prev)
-u_long prog;
-u_long vers;
+unsigned long prog;
+unsigned long vers;
struct svc_callout **prev;
{
register struct svc_callout *s, *p;
@@ -220,7 +219,7 @@ struct svc_callout **prev;
bool_t svc_sendreply(xprt, xdr_results, xdr_location)
register SVCXPRT *xprt;
xdrproc_t xdr_results;
-caddr_t xdr_location;
+char* xdr_location;
{
struct rpc_msg rply;
@@ -324,8 +323,8 @@ register SVCXPRT *xprt;
*/
void svcerr_progvers(xprt, low_vers, high_vers)
register SVCXPRT *xprt;
-u_long low_vers;
-u_long high_vers;
+unsigned long low_vers;
+unsigned long high_vers;
{
struct rpc_msg rply;
@@ -389,13 +388,13 @@ int *readfds;
enum xprt_stat stat;
struct rpc_msg msg;
int prog_found;
- u_long low_vers;
- u_long high_vers;
+ unsigned long low_vers;
+ unsigned long high_vers;
struct svc_req r;
register SVCXPRT *xprt;
- register u_long mask;
+ register unsigned long mask;
register int bit;
- register u_long *maskp;
+ register unsigned long *maskp;
register int setsize;
register int sock;
char cred_area[2 * MAX_AUTH_BYTES + RQCRED_SIZE];
@@ -409,9 +408,9 @@ int *readfds;
setsize = _rpc_dtablesize();
#ifdef __linux__
/*#define NFDBITS 32*/
- maskp = (u_long *) readfds;
+ maskp = (unsigned long *) readfds;
#else
- maskp = (u_long *) readfds->fds_bits;
+ maskp = (unsigned long *) readfds->fds_bits;
#endif
for (sock = 0; sock < setsize; sock += NFDBITS) {
for (mask = *maskp++; (bit = ffs(mask)); mask ^= (1 << (bit - 1))) {
diff --git a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c b/mdk-stage1/dietlibc/librpc/svc_auth_unix.c
index 7e0305f0a..e81eba7d9 100644
--- a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c
+++ b/mdk-stage1/dietlibc/librpc/svc_auth_unix.c
@@ -64,7 +64,7 @@ register struct rpc_msg *msg;
char area_machname[MAX_MACHINE_NAME + 1];
gid_t area_gids[NGRPS];
} *area;
- u_int auth_len;
+ unsigned int auth_len;
int str_len, gid_len;
register int i;
@@ -72,7 +72,7 @@ register struct rpc_msg *msg;
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;
+ auth_len = (unsigned 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);
@@ -83,7 +83,7 @@ register struct rpc_msg *msg;
stat = AUTH_BADCRED;
goto done;
}
- bcopy((caddr_t) buf, aup->aup_machname, (u_int) str_len);
+ memmove(aup->aup_machname, (char*) buf, (unsigned int) str_len);
aup->aup_machname[str_len] = 0;
str_len = RNDUP(str_len);
buf += str_len / sizeof(long);
diff --git a/mdk-stage1/dietlibc/librpc/svc_raw.c b/mdk-stage1/dietlibc/librpc/svc_raw.c
index c13ea5e06..eebb433ee 100644
--- a/mdk-stage1/dietlibc/librpc/svc_raw.c
+++ b/mdk-stage1/dietlibc/librpc/svc_raw.c
@@ -69,6 +69,7 @@ static struct xp_ops server_ops = {
svcraw_destroy
};
+
SVCXPRT *svcraw_create()
{
register struct svcraw_private *srp = svcraw_private;
@@ -130,7 +131,7 @@ struct rpc_msg *msg;
static bool_t svcraw_getargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
-caddr_t args_ptr;
+char* args_ptr;
{
register struct svcraw_private *srp = svcraw_private;
@@ -142,7 +143,7 @@ caddr_t args_ptr;
static bool_t svcraw_freeargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
-caddr_t args_ptr;
+char* args_ptr;
{
register struct svcraw_private *srp = svcraw_private;
register XDR *xdrs;
@@ -157,3 +158,4 @@ caddr_t args_ptr;
static void svcraw_destroy()
{
}
+
diff --git a/mdk-stage1/dietlibc/librpc/svc_run.c b/mdk-stage1/dietlibc/librpc/svc_run.c
index c7150e357..506b37942 100644
--- a/mdk-stage1/dietlibc/librpc/svc_run.c
+++ b/mdk-stage1/dietlibc/librpc/svc_run.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
#include <rpc/rpc.h>
#include <errno.h>
#include <unistd.h>
+#include "dietfeatures.h"
void svc_run()
{
@@ -47,7 +48,6 @@ void svc_run()
#else
int readfds;
#endif /* def FD_SETSIZE */
- extern int errno;
for (;;) {
#ifdef FD_SETSIZE
diff --git a/mdk-stage1/dietlibc/librpc/svc_simple.c b/mdk-stage1/dietlibc/librpc/svc_simple.c
index 0bb9a19eb..d2310de1e 100644
--- a/mdk-stage1/dietlibc/librpc/svc_simple.c
+++ b/mdk-stage1/dietlibc/librpc/svc_simple.c
@@ -73,8 +73,8 @@ int registerrpc(int prognum, int versnum, int procnum, char *(*progname)(), xdrp
return (-1);
}
}
- (void) pmap_unset((u_long) prognum, (u_long) versnum);
- if (!svc_register(transp, (u_long) prognum, (u_long) versnum,
+ (void) pmap_unset((unsigned long) prognum, (unsigned long) versnum);
+ if (!svc_register(transp, (unsigned long) prognum, (unsigned long) versnum,
universal, IPPROTO_UDP)) {
(void) fprintf(stderr, "couldn't register prog %d vers %d\n",
prognum, versnum);
@@ -120,7 +120,7 @@ SVCXPRT *transp;
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 ! */
+ memset(xdrbuf, 0, sizeof(xdrbuf)); /* required ! */
if (!svc_getargs(transp, pl->p_inproc, xdrbuf)) {
svcerr_decode(transp);
return;
diff --git a/mdk-stage1/dietlibc/librpc/svc_tcp.c b/mdk-stage1/dietlibc/librpc/svc_tcp.c
index 6edafa1b1..0444bc0d0 100644
--- a/mdk-stage1/dietlibc/librpc/svc_tcp.c
+++ b/mdk-stage1/dietlibc/librpc/svc_tcp.c
@@ -48,6 +48,7 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include "dietfeatures.h"
/*
* Ops vector for TCP/IP based rpc service handle
@@ -59,14 +60,7 @@ 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
-};
+static struct xp_ops svctcp_op;
/*
* Ops vector for TCP/IP rendezvous handler
@@ -87,13 +81,13 @@ static int readtcp(), writetcp();
static SVCXPRT *makefd_xprt();
struct tcp_rendezvous { /* kept in xprt->xp_p1 */
- u_int sendsize;
- u_int recvsize;
+ unsigned int sendsize;
+ unsigned int recvsize;
};
struct tcp_conn { /* kept in xprt->xp_p1 */
enum xprt_stat strm_stat;
- u_long x_id;
+ unsigned long x_id;
XDR xdrs;
char verf_body[MAX_AUTH_BYTES];
};
@@ -120,8 +114,8 @@ struct tcp_conn { /* kept in xprt->xp_p1 */
*/
SVCXPRT *svctcp_create(sock, sendsize, recvsize)
register int sock;
-u_int sendsize;
-u_int recvsize;
+unsigned int sendsize;
+unsigned int recvsize;
{
bool_t madesock = FALSE;
register SVCXPRT *xprt;
@@ -136,7 +130,7 @@ u_int recvsize;
}
madesock = TRUE;
}
- bzero((char *) &addr, sizeof(addr));
+ memset((char *) &addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
if (bindresvport(sock, &addr)) {
addr.sin_port = 0;
@@ -162,7 +156,7 @@ u_int recvsize;
return (NULL);
}
xprt->xp_p2 = NULL;
- xprt->xp_p1 = (caddr_t) r;
+ xprt->xp_p1 = (char*) r;
xprt->xp_verf = _null_auth;
xprt->xp_ops = &svctcp_rendezvous_op;
xprt->xp_port = ntohs(addr.sin_port);
@@ -177,8 +171,8 @@ u_int recvsize;
*/
SVCXPRT *svcfd_create(fd, sendsize, recvsize)
int fd;
-u_int sendsize;
-u_int recvsize;
+unsigned int sendsize;
+unsigned int recvsize;
{
return (makefd_xprt(fd, sendsize, recvsize));
@@ -186,8 +180,8 @@ u_int recvsize;
static SVCXPRT *makefd_xprt(fd, sendsize, recvsize)
int fd;
-u_int sendsize;
-u_int recvsize;
+unsigned int sendsize;
+unsigned int recvsize;
{
register SVCXPRT *xprt;
register struct tcp_conn *cd;
@@ -207,9 +201,9 @@ u_int recvsize;
}
cd->strm_stat = XPRT_IDLE;
xdrrec_create(&(cd->xdrs), sendsize, recvsize,
- (caddr_t) xprt, readtcp, writetcp);
+ (char*) xprt, readtcp, writetcp);
xprt->xp_p2 = NULL;
- xprt->xp_p1 = (caddr_t) cd;
+ xprt->xp_p1 = (char*) cd;
xprt->xp_verf.oa_base = cd->verf_body;
xprt->xp_addrlen = 0;
xprt->xp_ops = &svctcp_op; /* truely deals with calls */
@@ -267,9 +261,9 @@ register SVCXPRT *xprt;
/* an actual connection socket */
XDR_DESTROY(&(cd->xdrs));
}
- mem_free((caddr_t) cd, sizeof(struct tcp_conn));
+ mem_free((char*) cd, sizeof(struct tcp_conn));
- mem_free((caddr_t) xprt, sizeof(SVCXPRT));
+ mem_free((char*) xprt, sizeof(SVCXPRT));
}
/*
@@ -285,7 +279,7 @@ static struct timeval wait_per_try = { 35, 0 };
*/
static int readtcp(xprt, buf, len)
register SVCXPRT *xprt;
-caddr_t buf;
+char* buf;
register int len;
{
register int sock = xprt->xp_sock;
@@ -327,7 +321,7 @@ register int len;
*/
static int writetcp(xprt, buf, len)
register SVCXPRT *xprt;
-caddr_t buf;
+char* buf;
int len;
{
register int i, cnt;
@@ -372,7 +366,7 @@ register struct rpc_msg *msg;
static bool_t svctcp_getargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
-caddr_t args_ptr;
+char* args_ptr;
{
return ((*xdr_args)
@@ -382,7 +376,7 @@ caddr_t args_ptr;
static bool_t svctcp_freeargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
-caddr_t args_ptr;
+char* args_ptr;
{
register XDR *xdrs = &(((struct tcp_conn *) (xprt->xp_p1))->xdrs);
@@ -404,3 +398,13 @@ register struct rpc_msg *msg;
(void) xdrrec_endofrecord(xdrs, TRUE);
return (stat);
}
+
+static struct xp_ops svctcp_op = {
+ svctcp_recv,
+ svctcp_stat,
+ svctcp_getargs,
+ svctcp_reply,
+ svctcp_freeargs,
+ svctcp_destroy
+};
+
diff --git a/mdk-stage1/dietlibc/librpc/svc_udp.c b/mdk-stage1/dietlibc/librpc/svc_udp.c
index 1cdb5ce91..af22f289f 100644
--- a/mdk-stage1/dietlibc/librpc/svc_udp.c
+++ b/mdk-stage1/dietlibc/librpc/svc_udp.c
@@ -45,10 +45,9 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
#include <errno.h>
#include <string.h>
#include <unistd.h>
-
+#include "dietfeatures.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();
@@ -57,23 +56,14 @@ 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;
+static struct xp_ops svcudp_op;
/*
* kept in xprt->xp_p2
*/
struct svcudp_data {
- u_int su_iosz; /* byte size of send.recv buffer */
- u_long su_xid; /* transaction id */
+ unsigned int su_iosz; /* byte size of send.recv buffer */
+ unsigned 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 */
@@ -81,8 +71,8 @@ struct svcudp_data {
#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);
+static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, unsigned long* replylenp);
+static void cache_set(SVCXPRT* xprt, unsigned long replylen);
/*
* Usage:
@@ -99,7 +89,7 @@ static void cache_set(SVCXPRT* xprt, u_long replylen);
*/
SVCXPRT *svcudp_bufcreate(sock, sendsz, recvsz)
register int sock;
-u_int sendsz, recvsz;
+unsigned int sendsz, recvsz;
{
bool_t madesock = FALSE;
register SVCXPRT *xprt;
@@ -114,7 +104,7 @@ u_int sendsz, recvsz;
}
madesock = TRUE;
}
- bzero((char *) &addr, sizeof(addr));
+ memset((char *) &addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
if (bindresvport(sock, &addr)) {
addr.sin_port = 0;
@@ -144,7 +134,7 @@ u_int sendsz, recvsz;
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_p2 = (char*) su;
xprt->xp_verf.oa_base = su->su_verfbody;
xprt->xp_ops = &svcudp_op;
xprt->xp_port = ntohs(addr.sin_port);
@@ -175,7 +165,7 @@ struct rpc_msg *msg;
register XDR *xdrs = &(su->su_xdrs);
register int rlen;
char *reply;
- u_long replylen;
+ unsigned long replylen;
again:
xprt->xp_addrlen = sizeof(struct sockaddr_in);
@@ -185,7 +175,7 @@ struct rpc_msg *msg;
&(xprt->xp_addrlen));
if (rlen == -1 && errno == EINTR)
goto again;
- if (rlen < 4 * sizeof(u_long))
+ if (rlen < 4 * sizeof(unsigned long))
return (FALSE);
xdrs->x_op = XDR_DECODE;
XDR_SETPOS(xdrs, 0);
@@ -222,7 +212,7 @@ struct rpc_msg *msg;
== slen) {
stat = TRUE;
if (su->su_cache && slen >= 0) {
- cache_set(xprt, (u_long) slen);
+ cache_set(xprt, (unsigned long) slen);
}
}
}
@@ -232,7 +222,7 @@ struct rpc_msg *msg;
static bool_t svcudp_getargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
-caddr_t args_ptr;
+char* args_ptr;
{
return ((*xdr_args) (&(su_data(xprt)->su_xdrs), args_ptr));
@@ -241,7 +231,7 @@ caddr_t args_ptr;
static bool_t svcudp_freeargs(xprt, xdr_args, args_ptr)
SVCXPRT *xprt;
xdrproc_t xdr_args;
-caddr_t args_ptr;
+char* args_ptr;
{
register XDR *xdrs = &(su_data(xprt)->su_xdrs);
@@ -258,9 +248,9 @@ register SVCXPRT *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((char*) su, sizeof(struct svcudp_data));
- mem_free((caddr_t) xprt, sizeof(SVCXPRT));
+ mem_free((char*) xprt, sizeof(SVCXPRT));
}
@@ -281,7 +271,7 @@ register SVCXPRT *xprt;
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
#define BZERO(addr, type, size) \
- bzero((char *) addr, sizeof(type) * (int) (size))
+ memset((char *) addr, 0, sizeof(type) * (int) (size))
/*
* An entry in the cache
@@ -291,16 +281,16 @@ 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;
+ unsigned long cache_xid;
+ unsigned long cache_proc;
+ unsigned long cache_vers;
+ unsigned long cache_prog;
struct sockaddr_in cache_addr;
/*
* The cached reply and length
*/
char *cache_reply;
- u_long cache_replylen;
+ unsigned long cache_replylen;
/*
* Next node on the list, if there is a collision
*/
@@ -313,13 +303,13 @@ struct cache_node {
* The entire cache
*/
struct udp_cache {
- u_long uc_size; /* size of cache */
+ unsigned 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 */
+ unsigned long uc_nextvictim; /* points to next victim in fifo list */
+ unsigned long uc_prog; /* saved program number */
+ unsigned long uc_vers; /* saved version number */
+ unsigned long uc_proc; /* saved procedure number */
struct sockaddr_in uc_addr; /* saved caller's address */
};
@@ -335,7 +325,7 @@ struct udp_cache {
* Enable use of the cache.
* Note: there is no disable.
*/
-int svcudp_enablecache(SVCXPRT* transp, u_long size)
+int svcudp_enablecache(SVCXPRT* transp, unsigned long size)
{
struct svcudp_data *su = su_data(transp);
struct udp_cache *uc;
@@ -371,13 +361,13 @@ int svcudp_enablecache(SVCXPRT* transp, u_long size)
/*
* Set an entry in the cache
*/
-static void cache_set(SVCXPRT* xprt, u_long replylen)
+static void cache_set(SVCXPRT* xprt, unsigned 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;
+ unsigned int loc;
char *newbuf;
/*
@@ -434,14 +424,14 @@ static void cache_set(SVCXPRT* xprt, u_long replylen)
* 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)
+static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, unsigned long* replylenp)
{
- u_int loc;
+ unsigned 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)
+# define EQADDR(a1, a2) (memcmp((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) {
@@ -465,3 +455,13 @@ static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long*
uc->uc_addr = xprt->xp_raddr;
return (0);
}
+
+static struct xp_ops svcudp_op = {
+ svcudp_recv,
+ svcudp_stat,
+ svcudp_getargs,
+ svcudp_reply,
+ svcudp_freeargs,
+ svcudp_destroy
+};
+
diff --git a/mdk-stage1/dietlibc/librpc/xdr.c b/mdk-stage1/dietlibc/librpc/xdr.c
index 864b47dea..836a5697a 100644
--- a/mdk-stage1/dietlibc/librpc/xdr.c
+++ b/mdk-stage1/dietlibc/librpc/xdr.c
@@ -52,7 +52,7 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
*/
#define XDR_FALSE ((long) 0)
#define XDR_TRUE ((long) 1)
-#define LASTUNSIGNED ((u_int) 0-1)
+#define LASTUNSIGNED ((unsigned int) 0-1)
/*
* for unit alignment
@@ -76,7 +76,7 @@ void xdr_free(xdrproc_t proc, char* objp)
*/
bool_t xdr_void( /* xdrs, addr */ )
/* XDR *xdrs; */
- /* caddr_t addr; */
+ /* char* addr; */
{
return (TRUE);
@@ -108,10 +108,10 @@ 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));
+ return (xdr_u_long(xdrs, (unsigned long *) up));
#else
- if (sizeof(u_int) == sizeof(u_long)) {
- return (xdr_u_long(xdrs, (u_long *) up));
+ if (sizeof(unsigned int) == sizeof(unsigned long)) {
+ return (xdr_u_long(xdrs, (unsigned long *) up));
} else {
return (xdr_short(xdrs, (short *) up));
}
@@ -184,19 +184,19 @@ bool_t xdr_short(XDR* xdrs, short* sp)
*/
bool_t xdr_u_short(XDR* xdrs, unsigned short* usp)
{
- u_long l;
+ unsigned long l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (u_long) * usp;
+ l = (unsigned long) * usp;
return (XDR_PUTLONG(xdrs, &l));
case XDR_DECODE:
if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *usp = (u_short) l;
+ *usp = (unsigned short) l;
return (TRUE);
case XDR_FREE:
@@ -226,7 +226,7 @@ bool_t xdr_char(XDR* xdrs, char* cp)
*/
bool_t xdr_u_char(XDR* xdrs, unsigned char* cp)
{
- u_int u;
+ unsigned int u;
u = (*cp);
if (!xdr_u_int(xdrs, &u)) {
@@ -297,10 +297,10 @@ enum_t *ep;
*/
bool_t xdr_opaque(xdrs, cp, cnt)
register XDR *xdrs;
-caddr_t cp;
-register u_int cnt;
+char* cp;
+register unsigned int cnt;
{
- register u_int rndup;
+ register unsigned int rndup;
static char crud[BYTES_PER_XDR_UNIT];
/*
@@ -349,11 +349,11 @@ register u_int cnt;
bool_t xdr_bytes(xdrs, cpp, sizep, maxsize)
register XDR *xdrs;
char **cpp;
-register u_int *sizep;
-u_int maxsize;
+register unsigned int *sizep;
+unsigned int maxsize;
{
register char *sp = *cpp; /* sp is the actual string pointer */
- register u_int nodesize;
+ register unsigned int nodesize;
/*
* first deal with the length since xdr bytes are counted
@@ -465,11 +465,11 @@ bool_t xdr_union(XDR* xdrs, enum_t* dscmp, char* unp, const struct xdr_discrim*
bool_t xdr_string(xdrs, cpp, maxsize)
register XDR *xdrs;
char **cpp;
-u_int maxsize;
+unsigned int maxsize;
{
register char *sp = *cpp; /* sp is the actual string pointer */
- u_int size;
- u_int nodesize;
+ unsigned int size;
+ unsigned int nodesize;
/*
* first deal with the length since xdr strings are counted-strings
diff --git a/mdk-stage1/dietlibc/librpc/xdr_array.c b/mdk-stage1/dietlibc/librpc/xdr_array.c
index f8ae12b19..f0c9bbbb3 100644
--- a/mdk-stage1/dietlibc/librpc/xdr_array.c
+++ b/mdk-stage1/dietlibc/librpc/xdr_array.c
@@ -48,7 +48,7 @@ static char sccsid[] =
#include <rpc/xdr.h>
#include <string.h>
-#define LASTUNSIGNED ((u_int)0-1)
+#define LASTUNSIGNED ((unsigned int)0-1)
/*
@@ -60,17 +60,17 @@ static char sccsid[] =
*/
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 */
+char* *addrp; /* array pointer */
+unsigned int *sizep; /* number of elements */
+unsigned int maxsize; /* max numberof elements */
+unsigned 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 unsigned int i;
+ register char* target = *addrp;
+ register unsigned int c; /* the actual element count */
register bool_t stat = TRUE;
- register u_int nodesize;
+ register unsigned int nodesize;
/* like strings, arrays are really counted arrays */
if (!xdr_u_int(xdrs, sizep)) {
@@ -80,7 +80,17 @@ xdrproc_t elproc; /* xdr routine to handle each element */
if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
return (FALSE);
}
- nodesize = c * elsize;
+ /* duh, look for integer overflow (fefe) */
+ {
+ unsigned int i;
+ nodesize = 0;
+ for (i=c; i; --i) {
+ unsigned int tmp=nodesize+elsize;
+ if (tmp<nodesize) /* overflow */
+ return FALSE;
+ nodesize=tmp;
+ }
+ }
/*
* if we are deserializing, we may need to allocate an array.
@@ -96,7 +106,7 @@ xdrproc_t elproc; /* xdr routine to handle each element */
(void) fprintf(stderr, "xdr_array: out of memory\n");
return (FALSE);
}
- bzero(target, nodesize);
+ memset(target, 0, nodesize);
break;
case XDR_FREE:
@@ -134,11 +144,11 @@ xdrproc_t elproc; /* xdr routine to handle 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 unsigned int nelem;
+register unsigned int elemsize;
register xdrproc_t xdr_elem;
{
- register u_int i;
+ register unsigned int i;
register char *elptr;
elptr = basep;
diff --git a/mdk-stage1/dietlibc/librpc/xdr_mem.c b/mdk-stage1/dietlibc/librpc/xdr_mem.c
index 755f6abf1..5bc54cd4a 100644
--- a/mdk-stage1/dietlibc/librpc/xdr_mem.c
+++ b/mdk-stage1/dietlibc/librpc/xdr_mem.c
@@ -52,7 +52,7 @@ 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 unsigned int xdrmem_getpos();
static bool_t xdrmem_setpos();
static int32_t *xdrmem_inline();
static void xdrmem_destroy();
@@ -68,20 +68,21 @@ static struct xdr_ops xdrmem_ops = {
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;
+const char* addr;
+unsigned int size;
enum xdr_op op;
{
xdrs->x_op = op;
xdrs->x_ops = &xdrmem_ops;
- xdrs->x_private = xdrs->x_base = addr;
+ xdrs->x_private = xdrs->x_base = (char*)addr;
xdrs->x_handy = size;
}
@@ -98,7 +99,7 @@ long *lp;
if ((xdrs->x_handy -= sizeof(long)) < 0)
return (FALSE);
- *lp = (long) ntohl((u_long) (*((long *) (xdrs->x_private))));
+ *lp = (long) ntohl((unsigned long) (*((long *) (xdrs->x_private))));
xdrs->x_private += sizeof(long);
return (TRUE);
@@ -112,7 +113,7 @@ long *lp;
if ((xdrs->x_handy -= sizeof(long)) < 0)
return (FALSE);
- *(long *) xdrs->x_private = (long) htonl((u_long) (*lp));
+ *(long *) xdrs->x_private = (long) htonl((unsigned long) (*lp));
xdrs->x_private += sizeof(long);
return (TRUE);
@@ -120,43 +121,43 @@ long *lp;
static bool_t xdrmem_getbytes(xdrs, addr, len)
register XDR *xdrs;
-caddr_t addr;
-register u_int len;
+char* addr;
+register unsigned int len;
{
if ((xdrs->x_handy -= len) < 0)
return (FALSE);
- bcopy(xdrs->x_private, addr, len);
+ memmove(addr, xdrs->x_private, 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;
+char* addr;
+register unsigned int len;
{
if ((xdrs->x_handy -= len) < 0)
return (FALSE);
- bcopy(addr, xdrs->x_private, len);
+ memmove(xdrs->x_private, addr, len);
xdrs->x_private += len;
return (TRUE);
}
-static u_int xdrmem_getpos(xdrs)
+static unsigned int xdrmem_getpos(xdrs)
register XDR *xdrs;
{
- return ((u_int) xdrs->x_private - (u_int) xdrs->x_base);
+ return ((unsigned int) xdrs->x_private - (unsigned int) xdrs->x_base);
}
static bool_t xdrmem_setpos(xdrs, pos)
register XDR *xdrs;
-u_int pos;
+unsigned int pos;
{
- register caddr_t newaddr = xdrs->x_base + pos;
- register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
+ register char* newaddr = xdrs->x_base + pos;
+ register char* lastaddr = xdrs->x_private + xdrs->x_handy;
if ((long) newaddr > (long) lastaddr)
return (FALSE);
@@ -178,3 +179,4 @@ int len;
}
return (buf);
}
+
diff --git a/mdk-stage1/dietlibc/librpc/xdr_rec.c b/mdk-stage1/dietlibc/librpc/xdr_rec.c
index 83e800f5e..759a76108 100644
--- a/mdk-stage1/dietlibc/librpc/xdr_rec.c
+++ b/mdk-stage1/dietlibc/librpc/xdr_rec.c
@@ -42,7 +42,7 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
* 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
+ * is represented as a htonl(unsigned 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.
@@ -56,13 +56,13 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
extern long lseek();
-static u_int fix_buf_size();
+static unsigned 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 unsigned int xdrrec_getpos();
static bool_t xdrrec_setpos();
static int32_t *xdrrec_inline();
static void xdrrec_destroy();
@@ -78,6 +78,7 @@ static struct xdr_ops xdrrec_ops = {
xdrrec_destroy
};
+
/*
* A record is composed of one or more record fragments.
* A record fragment is a two-byte header followed by zero to
@@ -91,32 +92,32 @@ static struct xdr_ops xdrrec_ops = {
* meet the needs of xdr and rpc based on tcp.
*/
-#define LAST_FRAG ((u_long)(1 << 31))
+#define LAST_FRAG ((unsigned long)(1 << 31))
typedef struct rec_strm {
- caddr_t tcp_handle;
- caddr_t the_buffer;
+ char* tcp_handle;
+ char* 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 */
+ char* out_base; /* output buffer (points to frag header) */
+ char* out_finger; /* next output position */
+ char* out_boundry; /* data cannot up to this address */
+ unsigned 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 */
+ unsigned long in_size; /* fixed size of the input buffer */
+ char* in_base;
+ char* in_finger; /* location of next byte to be had */
+ char* 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;
+ unsigned int sendsize;
+ unsigned int recvsize;
} RECSTREAM;
@@ -131,9 +132,9 @@ typedef struct rec_strm {
*/
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;
+register unsigned int sendsize;
+register unsigned int recvsize;
+char* 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 */
{
@@ -159,20 +160,20 @@ int (*writeit) (); /* like write, but pass it a tcp_handle, not sock */
return;
}
for (rstrm->out_base = rstrm->the_buffer;
- (u_int) rstrm->out_base % BYTES_PER_XDR_UNIT != 0;
+ (unsigned long) 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;
+ xdrs->x_private = (char*) 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->frag_header = (unsigned long *) rstrm->out_base;
+ rstrm->out_finger += sizeof(unsigned long);
rstrm->out_boundry += sendsize;
rstrm->frag_sent = FALSE;
rstrm->in_size = recvsize;
@@ -198,15 +199,15 @@ long *lp;
/* 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));
+ (((long) rstrm->in_boundry - (long) buflp) >= sizeof(long))) {
+ *lp = (long) ntohl((unsigned long) (*buflp));
rstrm->fbtbc -= sizeof(long);
rstrm->in_finger += sizeof(long);
} else {
- if (!xdrrec_getbytes(xdrs, (caddr_t) & mylong, sizeof(long)))
+ if (!xdrrec_getbytes(xdrs, (char*) & mylong, sizeof(long)))
return (FALSE);
- *lp = (long) ntohl((u_long) mylong);
+ *lp = (long) ntohl((unsigned long) mylong);
}
return (TRUE);
}
@@ -216,17 +217,17 @@ long *lp;
*/
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);
+ register unsigned long eormask = (eor == TRUE) ? LAST_FRAG : 0;
+ register unsigned long len = (unsigned long) (rstrm->out_finger) -
+ (unsigned long) (rstrm->frag_header) - sizeof(unsigned long);
*(rstrm->frag_header) = htonl(len | eormask);
- len = (u_long) (rstrm->out_finger) - (u_long) (rstrm->out_base);
+ len = (unsigned long) (rstrm->out_finger) - (unsigned 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);
+ rstrm->frag_header = (unsigned long *) rstrm->out_base;
+ rstrm->out_finger = (char*) rstrm->out_base + sizeof(unsigned long);
return (TRUE);
}
@@ -235,12 +236,12 @@ static bool_t
fill_input_buf(rstrm)
register RECSTREAM *rstrm;
{
- register caddr_t where;
- u_int i;
+ register char* where;
+ unsigned int i;
register int len;
where = rstrm->in_base;
- i = (u_int) rstrm->in_boundry % BYTES_PER_XDR_UNIT;
+ i = (unsigned long) rstrm->in_boundry % BYTES_PER_XDR_UNIT;
where += i;
len = rstrm->in_size - i;
if ((len = (*(rstrm->readit)) (rstrm->tcp_handle, where, len)) == -1)
@@ -255,20 +256,20 @@ 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 char* addr;
register int len;
{
register int current;
while (len > 0) {
- current = (int) rstrm->in_boundry - (int) rstrm->in_finger;
+ current = (long) rstrm->in_boundry - (long) 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);
+ memmove(addr, rstrm->in_finger, current);
rstrm->in_finger += current;
addr += current;
len -= current;
@@ -281,9 +282,9 @@ static bool_t
set_input_fragment(rstrm)
register RECSTREAM *rstrm;
{
- u_long header;
+ unsigned long header;
- if (!get_input_bytes(rstrm, (caddr_t) & header, sizeof(header)))
+ if (!get_input_bytes(rstrm, (char*) & header, sizeof(header)))
return (FALSE);
header = (long) ntohl(header);
rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE;
@@ -300,7 +301,7 @@ long cnt;
register int current;
while (cnt > 0) {
- current = (int) rstrm->in_boundry - (int) rstrm->in_finger;
+ current = (long) rstrm->in_boundry - (long) rstrm->in_finger;
if (current == 0) {
if (!fill_input_buf(rstrm))
return (FALSE);
@@ -313,8 +314,8 @@ long cnt;
return (TRUE);
}
-static u_int fix_buf_size(s)
-register u_int s;
+static unsigned int fix_buf_size(s)
+register unsigned int s;
{
if (s < 100)
@@ -341,7 +342,7 @@ long *lp;
dest_lp = ((long *) (rstrm->out_finger));
rstrm->out_finger += sizeof(long);
}
- *dest_lp = (long) htonl((u_long) (*lp));
+ *dest_lp = (long) htonl((unsigned long) (*lp));
return (TRUE);
}
@@ -349,8 +350,8 @@ 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 char* addr;
+register unsigned int len;
{
register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
register int current;
@@ -376,16 +377,16 @@ register u_int len;
static bool_t xdrrec_putbytes(xdrs, addr, len)
XDR *xdrs;
-register caddr_t addr;
-register u_int len;
+register char* addr;
+register unsigned 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 = (unsigned long) rstrm->out_boundry - (unsigned long) rstrm->out_finger;
current = (len < current) ? len : current;
- bcopy(addr, rstrm->out_finger, current);
+ memmove(rstrm->out_finger, addr, current);
rstrm->out_finger += current;
addr += current;
len -= current;
@@ -398,13 +399,13 @@ register u_int len;
return (TRUE);
}
-static u_int xdrrec_getpos(xdrs)
+static unsigned 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);
+ pos = lseek((int)((long) rstrm->tcp_handle), (long) 0, 1);
if (pos != -1)
switch (xdrs->x_op) {
@@ -417,27 +418,27 @@ register XDR *xdrs;
break;
default:
- pos = (u_int) - 1;
+ pos = (unsigned int) - 1;
break;
}
- return ((u_int) pos);
+ return ((unsigned int) pos);
}
static bool_t xdrrec_setpos(xdrs, pos)
register XDR *xdrs;
-u_int pos;
+unsigned int pos;
{
register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
- u_int currpos = xdrrec_getpos(xdrs);
+ unsigned int currpos = xdrrec_getpos(xdrs);
int delta = currpos - pos;
- caddr_t newpos;
+ char* newpos;
if ((int) currpos != -1)
switch (xdrs->x_op) {
case XDR_ENCODE:
newpos = rstrm->out_finger - delta;
- if ((newpos > (caddr_t) (rstrm->frag_header)) &&
+ if ((newpos > (char*) (rstrm->frag_header)) &&
(newpos < rstrm->out_boundry)) {
rstrm->out_finger = newpos;
return (TRUE);
@@ -493,7 +494,7 @@ register XDR *xdrs;
mem_free(rstrm->the_buffer,
rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT);
- mem_free((caddr_t) rstrm, sizeof(RECSTREAM));
+ mem_free((char*) rstrm, sizeof(RECSTREAM));
}
@@ -554,20 +555,19 @@ XDR *xdrs;
bool_t sendnow;
{
register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
- register u_long len; /* fragment length */
+ register unsigned long len; /* fragment length */
if (sendnow || rstrm->frag_sent ||
- ((u_long) rstrm->out_finger + sizeof(u_long) >=
- (u_long) rstrm->out_boundry)) {
+ ((unsigned long) rstrm->out_finger + sizeof(unsigned long) >=
+ (unsigned 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);
+ len = (unsigned long) (rstrm->out_finger) - (unsigned long) (rstrm->frag_header) -
+ sizeof(unsigned long);
+ *(rstrm->frag_header) = htonl((unsigned long) len | LAST_FRAG);
+ rstrm->frag_header = (unsigned long *) rstrm->out_finger;
+ rstrm->out_finger += sizeof(unsigned long);
return (TRUE);
}
-
diff --git a/mdk-stage1/dietlibc/librpc/xdr_reference.c b/mdk-stage1/dietlibc/librpc/xdr_reference.c
index 7715d821c..3e42d12f3 100644
--- a/mdk-stage1/dietlibc/librpc/xdr_reference.c
+++ b/mdk-stage1/dietlibc/librpc/xdr_reference.c
@@ -45,7 +45,7 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
#include <rpc/xdr.h>
#include <string.h>
-#define LASTUNSIGNED ((u_int)0-1)
+#define LASTUNSIGNED ((unsigned int)0-1)
/*
* XDR an indirect pointer
@@ -58,11 +58,11 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
*/
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 */
+char* *pp; /* the pointer to work on */
+unsigned int size; /* size of the object pointed to */
xdrproc_t proc; /* xdr routine to handle the object */
{
- register caddr_t loc = *pp;
+ register char* loc = *pp;
register bool_t stat;
if (loc == NULL)
@@ -71,12 +71,12 @@ xdrproc_t proc; /* xdr routine to handle the object */
return (TRUE);
case XDR_DECODE:
- *pp = loc = (caddr_t) mem_alloc(size);
+ *pp = loc = (char*) mem_alloc(size);
if (loc == NULL) {
(void) fprintf(stderr, "xdr_reference: out of memory\n");
return (FALSE);
}
- bzero(loc, (int) size);
+ memset(loc, 0, (int) size);
break;
}
@@ -112,7 +112,7 @@ xdrproc_t proc; /* xdr routine to handle the object */
bool_t xdr_pointer(xdrs, objpp, obj_size, xdr_obj)
register XDR *xdrs;
char **objpp;
-u_int obj_size;
+unsigned int obj_size;
xdrproc_t xdr_obj;
{
diff --git a/mdk-stage1/dietlibc/librpc/xdr_stdio.c b/mdk-stage1/dietlibc/librpc/xdr_stdio.c
index e3190e0a9..1bc9ada16 100644
--- a/mdk-stage1/dietlibc/librpc/xdr_stdio.c
+++ b/mdk-stage1/dietlibc/librpc/xdr_stdio.c
@@ -51,7 +51,7 @@ 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 unsigned int xdrstdio_getpos();
static bool_t xdrstdio_setpos();
static int32_t *xdrstdio_inline();
static void xdrstdio_destroy();
@@ -70,6 +70,7 @@ static struct xdr_ops xdrstdio_ops = {
xdrstdio_destroy /* destroy stream */
};
+
/*
* Initialize a stdio xdr stream.
* Sets the xdr stream handle xdrs for use on the stream file.
@@ -83,7 +84,7 @@ enum xdr_op op;
xdrs->x_op = op;
xdrs->x_ops = &xdrstdio_ops;
- xdrs->x_private = (caddr_t) file;
+ xdrs->x_private = (char*) file;
xdrs->x_handy = 0;
xdrs->x_base = 0;
}
@@ -104,7 +105,7 @@ XDR *xdrs;
register long *lp;
{
- if (fread((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
+ if (fread((char*) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
1) return (FALSE);
#ifndef mc68000
@@ -123,7 +124,7 @@ long *lp;
lp = &mycopy;
#endif
- if (fwrite((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
+ if (fwrite((char*) lp, sizeof(long), 1, (FILE *) xdrs->x_private) !=
1) return (FALSE);
return (TRUE);
@@ -131,8 +132,8 @@ long *lp;
static bool_t xdrstdio_getbytes(xdrs, addr, len)
XDR *xdrs;
-caddr_t addr;
-u_int len;
+char* addr;
+unsigned int len;
{
if ((len != 0)
@@ -143,8 +144,8 @@ u_int len;
static bool_t xdrstdio_putbytes(xdrs, addr, len)
XDR *xdrs;
-caddr_t addr;
-u_int len;
+char* addr;
+unsigned int len;
{
if ((len != 0)
@@ -153,16 +154,16 @@ u_int len;
return (TRUE);
}
-static u_int xdrstdio_getpos(xdrs)
+static unsigned int xdrstdio_getpos(xdrs)
XDR *xdrs;
{
- return ((u_int) ftell((FILE *) xdrs->x_private));
+ return ((unsigned int) ftell((FILE *) xdrs->x_private));
}
static bool_t xdrstdio_setpos(xdrs, pos)
XDR *xdrs;
-u_int pos;
+unsigned int pos;
{
return ((fseek((FILE *) xdrs->x_private, (long) pos, 0) < 0) ?
@@ -171,7 +172,7 @@ u_int pos;
static int32_t *xdrstdio_inline(xdrs, len)
XDR *xdrs;
-u_int len;
+unsigned int len;
{
/*
@@ -185,3 +186,4 @@ u_int len;
*/
return (NULL);
}
+
diff --git a/mdk-stage1/dietlibc/libshell/basename.c b/mdk-stage1/dietlibc/libshell/basename.c
new file mode 100644
index 000000000..fbf5b2478
--- /dev/null
+++ b/mdk-stage1/dietlibc/libshell/basename.c
@@ -0,0 +1,27 @@
+#include <string.h>
+#include <libgen.h>
+
+/*
+ path dirname basename
+ "/usr/lib" "/usr" "lib"
+ "/usr/" "/" "usr"
+ "usr" "." "usr"
+ "/" "/" "/"
+ "." "." "."
+ ".." "." ".."
+*/
+
+char *basename(char *path) {
+ char *c;
+again:
+ if (!(c=strrchr(path,'/'))) return path;
+ if (c[1]==0) {
+ if (c == path)
+ return c;
+ else {
+ *c=0;
+ goto again;
+ }
+ }
+ return c+1;
+}
diff --git a/mdk-stage1/dietlibc/libshell/dirname.c b/mdk-stage1/dietlibc/libshell/dirname.c
new file mode 100644
index 000000000..d35e6ea62
--- /dev/null
+++ b/mdk-stage1/dietlibc/libshell/dirname.c
@@ -0,0 +1,25 @@
+#include <string.h>
+#include <libgen.h>
+
+/*
+ path dirname basename
+ "/usr/lib" "/usr" "lib"
+ "/usr/" "/" "usr"
+ "usr" "." "usr"
+ "/" "/" "/"
+ "." "." "."
+ ".." "." ".."
+*/
+
+char *dirname(char *path) {
+ char *c;
+again:
+ if (!(c=strrchr(path,'/'))) return ".";
+ while (c[1]==0) { /* remove trailing slashes */
+ if (c==path) return c; /* unless path=='/' */
+ *c=0;
+ if (*--c!='/') break;
+ }
+ if (*c=='/') { if (c!=path) *c=0; return path; }
+ goto again;
+}
diff --git a/mdk-stage1/dietlibc/libshell/fnmatch.c b/mdk-stage1/dietlibc/libshell/fnmatch.c
index 4e7664510..ef43735f6 100644
--- a/mdk-stage1/dietlibc/libshell/fnmatch.c
+++ b/mdk-stage1/dietlibc/libshell/fnmatch.c
@@ -1,5 +1,6 @@
#include <ctype.h>
#include <fnmatch.h>
+#include <string.h>
#define NOTFIRST 128
@@ -11,6 +12,7 @@ static int match(char c,char d,int flags) {
}
int fnmatch(const char *pattern, const char *string, int flags) {
+ /*printf("fnmatch(\"%s\",\"%s\")\n",pattern,string);*/
if (*string==0) {
while (*pattern=='*') ++pattern;
return (!!*pattern);
@@ -18,31 +20,36 @@ int fnmatch(const char *pattern, const char *string, int flags) {
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;
+ return FNM_NOMATCH;
/* don't match if FNM_PERIOD and FNM_FILE_NAME and previous was '/' */
if ((flags&(FNM_FILE_NAME|FNM_PERIOD)) && string[-1]=='/')
- return 1;
+ return FNM_NOMATCH;
}
flags|=NOTFIRST;
switch (*pattern) {
case '[':
- ++pattern;
- while (*pattern && *pattern!=']') {
- if (flags&FNM_PATHNAME || *string!='/') {
+ {
+ int neg=0;
+ ++pattern;
+ if (*string=='/' && flags&FNM_PATHNAME) return FNM_NOMATCH;
+ if (*pattern=='^') { neg=1; ++pattern; }
+ while (*pattern && *pattern!=']') {
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
+ pattern+=3;
+ } else {
res=match(*pattern,*string,flags);
- if (res) {
+ ++pattern;
+ }
+ if (res ^ neg) {
while (*pattern && *pattern!=']') ++pattern;
return fnmatch(pattern+1,string+1,flags);
}
}
- ++pattern;
}
break;
case '\\':
@@ -55,12 +62,9 @@ int fnmatch(const char *pattern, const char *string, int flags) {
}
break;
case '*':
- if (!pattern[1] || fnmatch(pattern+1,string,flags)==0)
- return 0;
- else
- if (*string!='/')
- return fnmatch(pattern,string+1,flags);
- break;
+ if ((*string=='/' && flags&FNM_PATHNAME) || fnmatch(pattern,string+1,flags))
+ return fnmatch(pattern+1,string,flags);
+ return 0;
case 0:
if (*string==0 || (*string=='/' && (flags&FNM_LEADING_DIR)))
return 0;
@@ -70,5 +74,5 @@ int fnmatch(const char *pattern, const char *string, int flags) {
return fnmatch(pattern+1,string+1,flags);
break;
}
- return 1;
+ return FNM_NOMATCH;
}
diff --git a/mdk-stage1/dietlibc/libshell/glob.c b/mdk-stage1/dietlibc/libshell/glob.c
index 34d09d87a..def55f8dc 100644
--- a/mdk-stage1/dietlibc/libshell/glob.c
+++ b/mdk-stage1/dietlibc/libshell/glob.c
@@ -24,6 +24,7 @@
#include <fnmatch.h>
#include <dirent.h>
#include <pwd.h>
+#include "dietfeatures.h"
#include <glob.h>
@@ -38,7 +39,7 @@ static int cmp_func(const void * a, const void * b)
return 1;
if (s2 == NULL)
return -1;
- return strcmp(s1, s2);
+ return strcoll(s1, s2);
}
@@ -47,6 +48,38 @@ static int cmp_func(const void * a, const void * b)
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 void close_dir_keep_errno(DIR* dp) {
+ int save = errno;
+ if (dp)
+ closedir (dp);
+ errno=save;
+}
+
+static int add_entry(const char* name,glob_t *pglob,int* nfound) {
+ 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;
+}
+
+static void build_fullname(char * fullname, const char * directory, const char * filename) {
+ char *dest=fullname;
+ if (directory[0]=='/' && !directory[1]) {
+ *dest='/'; ++dest;
+ } else if (directory[0]!='.' || directory[1]) {
+ strcpy(dest,directory);
+ dest=strchr(dest,0);
+ *dest='/'; ++dest;
+ }
+ strcpy(dest,filename);
+}
+
static int glob_in_dir(const char *pattern, const char *directory, int flags,
int errfunc(const char * epath, int eerrno),
glob_t *pglob)
@@ -57,33 +90,6 @@ static int glob_in_dir(const char *pattern, const char *directory, int flags,
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))
@@ -96,19 +102,19 @@ static int glob_in_dir(const char *pattern, const char *directory, int flags,
while ((ep = readdir(dp))) {
i = strlen(directory) + strlen(ep->d_name) + 2;
ptr = (char *) alloca(i);
- build_fullname(ptr, i, directory, ep->d_name);
+ build_fullname(ptr, 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))
+ if (add_entry(ptr,pglob,&nfound))
goto memory_error;
}
}
- close_dir_keep_errno();
+ close_dir_keep_errno(dp);
if (nfound != 0)
pglob->gl_flags = flags;
@@ -116,8 +122,8 @@ static int glob_in_dir(const char *pattern, const char *directory, int flags,
/* nfound == 0 */
i = strlen(directory) + strlen(pattern) + 2;
ptr = (char *) alloca(i);
- build_fullname(ptr, i, directory, pattern);
- if (add_entry(ptr))
+ build_fullname(ptr, directory, pattern);
+ if (add_entry(ptr,pglob,&nfound))
goto memory_error;
}
@@ -127,7 +133,7 @@ static int glob_in_dir(const char *pattern, const char *directory, int flags,
/* 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();
+ close_dir_keep_errno(dp);
return GLOB_NOSPACE;
}
@@ -146,7 +152,7 @@ int glob(const char *pattern, int flags, int errfunc(const char * epath, int eer
char * ptr, * ptr2;
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) {
- __set_errno (EINVAL);
+ errno=EINVAL;
return -1;
}
@@ -196,10 +202,10 @@ int glob(const char *pattern, int flags, int errfunc(const char * epath, int eer
if (filename == NULL) {
/* We have no '/' in the pattern */
filename = pattern_;
- dirname = ".";
+ dirname = (char*)".";
} else if (filename == pattern_) {
/* "/pattern". */
- dirname = "/";
+ dirname = (char*)"/";
filename++;
} else {
dirname = pattern_;
@@ -293,13 +299,13 @@ int glob(const char *pattern, int flags, int errfunc(const char * epath, int eer
}
/* okay now we add the new entry */
- k = strlen(dirs.gl_pathv[i]) + 1 + strlen(filename) + 1;
+ k = strlen(dirs.gl_pathv[i]) + strlen(filename) + 2;
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);
+ build_fullname(pglob->gl_pathv[j], dirs.gl_pathv[i], filename);
pglob->gl_pathc++;
pglob->gl_pathv[j+1] = NULL;
}
diff --git a/mdk-stage1/dietlibc/libshell/realpath.c b/mdk-stage1/dietlibc/libshell/realpath.c
index 1377018e5..9aee2c585 100644
--- a/mdk-stage1/dietlibc/libshell/realpath.c
+++ b/mdk-stage1/dietlibc/libshell/realpath.c
@@ -5,21 +5,21 @@
#include <string.h>
#include "dietfeatures.h"
-char *realpath(const char *path, char *resolved_path) {
+char* realpath(const char *path, char *resolved_path) {
int fd=open(".",O_RDONLY);
- char *tmp="";
+ char* tmp=(char*)"";
+ if (fd<0) return 0;
if (chdir(path)) {
-#ifdef WANT_THREAD_SAFE
- if (*__errno_location()==ENOTDIR)
-#else
- if (errno==ENOTDIR)
-#endif
- {
- if ((tmp=strrchr(path,'/'))) {
+ if (errno==ENOTDIR) {
+ char* match;
+ if ((match=strrchr(path,'/'))) {
+ tmp=match;
memmove(resolved_path,path,tmp-path);
resolved_path[tmp-path]=0;
if (chdir(resolved_path)) { resolved_path=0; goto abort; }
}
+ } else {
+ resolved_path=0; goto abort;
}
}
if (!getcwd(resolved_path,PATH_MAX)) { resolved_path=0; goto abort; }
diff --git a/mdk-stage1/dietlibc/libstdio/fclose.c b/mdk-stage1/dietlibc/libstdio/fclose.c
index a955c6086..491ed2522 100644
--- a/mdk-stage1/dietlibc/libstdio/fclose.c
+++ b/mdk-stage1/dietlibc/libstdio/fclose.c
@@ -4,14 +4,9 @@
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)
@@ -20,7 +15,8 @@ int fclose(FILE *stream) {
__stdio_root=f->next;
break;
}
-#endif
+ if ((!(stream->flags&STATICBUF))&&(stream->buf))
+ free(stream->buf);
free(stream);
return res;
}
diff --git a/mdk-stage1/dietlibc/libstdio/fdglue.c b/mdk-stage1/dietlibc/libstdio/fdglue.c
index 1c3918f1f..9542711e2 100644
--- a/mdk-stage1/dietlibc/libstdio/fdglue.c
+++ b/mdk-stage1/dietlibc/libstdio/fdglue.c
@@ -1,13 +1,9 @@
-#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
+#include <pthread.h>
+#include "dietstdio.h"
int __stdio_parse_mode(const char *mode) {
int f=0;
@@ -24,29 +20,3 @@ int __stdio_parse_mode(const char *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/fdglue2.c b/mdk-stage1/dietlibc/libstdio/fdglue2.c
new file mode 100644
index 000000000..b96e4c5b8
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fdglue2.c
@@ -0,0 +1,43 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include "dietstdio.h"
+#include <stdlib.h>
+#include <pthread.h>
+
+extern int __stdio_atexit;
+
+FILE* __stdio_init_file_nothreads(int fd,int closeonerror);
+FILE* __stdio_init_file_nothreads(int fd,int closeonerror) {
+ FILE *tmp=(FILE*)malloc(sizeof(FILE));
+ if (!tmp) goto err_out;
+ tmp->buf=(char*)malloc(BUFSIZE);
+ if (!tmp->buf) {
+ free(tmp);
+err_out:
+ if (closeonerror) close(fd);
+ errno=ENOMEM;
+ return 0;
+ }
+ tmp->fd=fd;
+ tmp->bm=0;
+ tmp->bs=0;
+ tmp->buflen=BUFSIZE;
+ {
+ struct stat st;
+ fstat(fd,&st);
+ tmp->flags=(S_ISFIFO(st.st_mode))?FDPIPE:0;
+ }
+ tmp->popen_kludge=0;
+ if (__stdio_atexit==0) {
+ __stdio_atexit=1;
+ atexit(__stdio_flushall);
+ }
+ tmp->next=__stdio_root;
+ __stdio_root=tmp;
+ tmp->ungotten=0;
+ return tmp;
+}
+
+FILE* __stdio_init_file(int fd,int closeonerror) __attribute__((weak,alias("__stdio_init_file_nothreads")));
diff --git a/mdk-stage1/dietlibc/libstdio/fdopen.c b/mdk-stage1/dietlibc/libstdio/fdopen.c
index aee14fb0c..748b716eb 100644
--- a/mdk-stage1/dietlibc/libstdio/fdopen.c
+++ b/mdk-stage1/dietlibc/libstdio/fdopen.c
@@ -1,21 +1,13 @@
+#include <errno.h>
+#include "dietfeatures.h"
#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) {
+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;
- }
+ if (filedes<0) { errno=EBADF; return 0; }
+ return __stdio_init_file(filedes,0);
}
diff --git a/mdk-stage1/dietlibc/libstdio/fdprintf.c b/mdk-stage1/dietlibc/libstdio/fdprintf.c
new file mode 100644
index 000000000..f9fc7a3b4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fdprintf.c
@@ -0,0 +1,13 @@
+#include <stdarg.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int fdprintf(int fd,const char *format,...) {
+ int n;
+ va_list arg_ptr;
+ va_start(arg_ptr,format);
+ n=vfdprintf(fd,format,arg_ptr);
+ va_end(arg_ptr);
+ return n;
+}
diff --git a/mdk-stage1/dietlibc/libstdio/feof.c b/mdk-stage1/dietlibc/libstdio/feof.c
index b7e86fe3b..bf2267fcf 100644
--- a/mdk-stage1/dietlibc/libstdio/feof.c
+++ b/mdk-stage1/dietlibc/libstdio/feof.c
@@ -1,9 +1,7 @@
#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/fflush.c b/mdk-stage1/dietlibc/libstdio/fflush.c
index 7078e04f4..e0e23b3ba 100644
--- a/mdk-stage1/dietlibc/libstdio/fflush.c
+++ b/mdk-stage1/dietlibc/libstdio/fflush.c
@@ -1,21 +1,16 @@
-#include "dietstdio.h"
#include <unistd.h>
#include <stdlib.h>
#include "dietwarning.h"
+#include "dietstdio.h"
FILE *__stdio_root;
-#ifdef WANT_BUFFERED_STDIO
int __stdio_atexit=0;
-void __stdio_flushall() {
+void __stdio_flushall(void) {
fflush(0);
}
-extern int __fflush_stdin();
-extern int __fflush_stdout();
-extern int __fflush_stderr();
-
int fflush(FILE *stream) {
if (stream==0) {
int res;
@@ -28,15 +23,20 @@ int fflush(FILE *stream) {
res=-1;
return res;
}
+// if (stream->flags&NOBUF) return 0;
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) {
+ if ((tmp=stream->bm-stream->bs)) {
+ lseek(stream->fd,tmp,SEEK_CUR);
+ }
+ stream->bs=stream->bm=0;
+ } else {
+ if (stream->bm && write(stream->fd,stream->buf,stream->bm)!=(int)stream->bm) {
stream->flags|=ERRORINDICATOR;
return -1;
}
- stream->bm=0;
+ stream->bm=0;
+ }
return 0;
}
@@ -50,13 +50,15 @@ int __fflush4(FILE *stream,int next) {
stream->flags=(stream->flags&~BUFINPUT)|next;
return res;
}
+ if (stream->fd==0) __fflush_stdout();
return 0;
}
-#else
-int fflush(FILE *stream) {
- return 0;
+/* Internal function, has no prototype.
+ * This is defined here because of the weak symbol ELF semantics */
+int __stdio_outs(const char *s,size_t len);
+int __stdio_outs(const char *s,size_t len) {
+ return fwrite(s,1,(size_t)len,stdout)==len?1:0;
}
-#endif
-link_warning("fflush","warning: your code uses stdio (several kilobytes of bloat).")
+link_warning("fflush","warning: your code uses stdio (7+k bloat).")
diff --git a/mdk-stage1/dietlibc/libstdio/fgetc.c b/mdk-stage1/dietlibc/libstdio/fgetc_unlocked.c
index 90d83961a..5136c8df1 100644
--- a/mdk-stage1/dietlibc/libstdio/fgetc.c
+++ b/mdk-stage1/dietlibc/libstdio/fgetc_unlocked.c
@@ -1,22 +1,17 @@
#include "dietstdio.h"
#include <unistd.h>
-extern int feof(FILE *stream);
-
-int fgetc(FILE *stream) {
+int fgetc_unlocked(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);
+ int len=read(stream->fd,stream->buf,stream->buflen);
if (len==0) {
stream->flags|=EOFINDICATOR;
return EOF;
@@ -30,11 +25,6 @@ int fgetc(FILE *stream) {
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
}
+
+int fgetc(FILE* stream) __attribute__((weak,alias("fgetc_unlocked")));
diff --git a/mdk-stage1/dietlibc/libstdio/fgetpos.c b/mdk-stage1/dietlibc/libstdio/fgetpos.c
new file mode 100644
index 000000000..d58b6fa5b
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fgetpos.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int fgetpos(FILE *stream, fpos_t *pos) {
+ long l=ftell(stream);
+ if (l==-1) return -1;
+ *pos=l;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libstdio/fgets.c b/mdk-stage1/dietlibc/libstdio/fgets.c
index c613d452d..d2ce4195d 100644
--- a/mdk-stage1/dietlibc/libstdio/fgets.c
+++ b/mdk-stage1/dietlibc/libstdio/fgets.c
@@ -1,11 +1,9 @@
#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;) {
+ for (l=size; l>1;) {
int c=fgetc(stream);
if (c==EOF) break;
*s=c;
diff --git a/mdk-stage1/dietlibc/libstdio/fopen.c b/mdk-stage1/dietlibc/libstdio/fopen.c
index aac17be42..3d9c28198 100644
--- a/mdk-stage1/dietlibc/libstdio/fopen.c
+++ b/mdk-stage1/dietlibc/libstdio/fopen.c
@@ -2,13 +2,7 @@
#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 */
@@ -17,5 +11,5 @@ FILE *fopen (const char *path, const char *mode) {
f=__stdio_parse_mode(mode);
if ((fd=open(path,f,0666))<0)
return 0;
- return __stdio_init_file(fd);
+ return __stdio_init_file(fd,1);
}
diff --git a/mdk-stage1/dietlibc/libstdio/fprintf.c b/mdk-stage1/dietlibc/libstdio/fprintf.c
index 237fd1e51..6b3849a33 100644
--- a/mdk-stage1/dietlibc/libstdio/fprintf.c
+++ b/mdk-stage1/dietlibc/libstdio/fprintf.c
@@ -1,23 +1,13 @@
#include <stdarg.h>
-#include <linux/types.h>
+#include <sys/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);
+ va_start(arg_ptr,format);
+ n=vfprintf(f,format,arg_ptr);
+ va_end(arg_ptr);
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/fputc_unlocked.c b/mdk-stage1/dietlibc/libstdio/fputc_unlocked.c
new file mode 100644
index 000000000..6441c5741
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fputc_unlocked.c
@@ -0,0 +1,20 @@
+#include <dietstdio.h>
+#include <unistd.h>
+
+int fputc_unlocked(int c, FILE *stream) {
+ if (__fflush4(stream,0)) return EOF;
+ if (stream->bm>=stream->buflen-1)
+ if (fflush(stream)) return EOF;
+ if (stream->flags&NOBUF) {
+ if (write(stream->fd,&c,1) != 1) return EOF;
+ return 0;
+ }
+ stream->buf[stream->bm]=c;
+ ++stream->bm;
+ if (((stream->flags&BUFLINEWISE) && c=='\n') ||
+ ((stream->flags&NOBUF))) /* puke */
+ if (fflush(stream)) return EOF;
+ return 0;
+}
+
+int fputc(int c,FILE* stream) __attribute__((weak,alias("fputc_unlocked")));
diff --git a/mdk-stage1/dietlibc/libstdio/fread.c b/mdk-stage1/dietlibc/libstdio/fread.c
index 29afa1489..813a98fb2 100644
--- a/mdk-stage1/dietlibc/libstdio/fread.c
+++ b/mdk-stage1/dietlibc/libstdio/fread.c
@@ -4,48 +4,43 @@
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
+ i=0;
+
+ if (!j || j/nmemb!=size) return 0;
if (stream->ungotten) {
+ stream->ungotten=0;
*(char*)ptr=stream->ungetbuf;
- ptr=((char*)ptr)+1;
- --j;
+ ++i;
}
if (!j) return 1;
+
+#ifdef WANT_FREAD_OPTIMIZATION
+ if ( !(stream->flags&FDPIPE) && (j>stream->buflen)) {
+ size_t tmp=j-i;
+ int res;
+ fflush(stream);
+ while ((res=read(stream->fd,ptr+i,tmp))<(int)tmp) {
+ if (res==-1) {
+ stream->flags|=ERRORINDICATOR;
+ goto exit;
+ } else if (!res) {
+ stream->flags|=EOFINDICATOR;
+ goto exit;
+ }
+ i+=res; tmp-=res;
+ }
+ return nmemb;
+ }
#endif
- for (i=0; i<j; ++i) {
+ for (; i<j; ++i) {
res=fgetc(stream);
if (res==EOF)
+exit:
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/fscanf.c b/mdk-stage1/dietlibc/libstdio/fscanf.c
new file mode 100644
index 000000000..07f477462
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fscanf.c
@@ -0,0 +1,14 @@
+#include <stdarg.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include "dietstdio.h"
+#include <unistd.h>
+
+int fscanf(FILE *stream, const char *format, ...) {
+ int n;
+ va_list arg_ptr;
+ va_start(arg_ptr, format);
+ n=vfscanf(stream,format,arg_ptr);
+ va_end (arg_ptr);
+ return n;
+}
diff --git a/mdk-stage1/dietlibc/libstdio/fseek.c b/mdk-stage1/dietlibc/libstdio/fseek.c
index 5bb96bc6e..a49230f0a 100644
--- a/mdk-stage1/dietlibc/libstdio/fseek.c
+++ b/mdk-stage1/dietlibc/libstdio/fseek.c
@@ -1,11 +1,10 @@
#include <dietstdio.h>
#include <unistd.h>
-long fseek(FILE *stream, long offset, int whence) {
+int 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));
+ stream->ungotten=0;
+ return lseek(stream->fd,offset,whence)!=-1?0:-1;
}
diff --git a/mdk-stage1/dietlibc/libstdio/fseeko.c b/mdk-stage1/dietlibc/libstdio/fseeko.c
new file mode 100644
index 000000000..6459a6ff4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fseeko.c
@@ -0,0 +1,10 @@
+#include <dietstdio.h>
+#include <unistd.h>
+
+int fseeko(FILE *stream, off_t offset, int whence) {
+ fflush(stream);
+ stream->bm=0; stream->bs=0;
+ stream->flags&=~(ERRORINDICATOR|EOFINDICATOR);
+ stream->ungotten=0;
+ return lseek(stream->fd,offset,whence)!=-1?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libstdio/fseeko64.c b/mdk-stage1/dietlibc/libstdio/fseeko64.c
new file mode 100644
index 000000000..3b00596a1
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fseeko64.c
@@ -0,0 +1,12 @@
+#include <dietstdio.h>
+#include <unistd.h>
+
+#ifndef __NO_STAT64
+int fseeko64(FILE *stream, off64_t offset, int whence) {
+ fflush(stream);
+ stream->bm=0; stream->bs=0;
+ stream->flags&=~(ERRORINDICATOR|EOFINDICATOR);
+ stream->ungotten=0;
+ return lseek64(stream->fd,offset,whence)!=-1?0:-1;
+}
+#endif
diff --git a/mdk-stage1/dietlibc/libstdio/fsetpos.c b/mdk-stage1/dietlibc/libstdio/fsetpos.c
new file mode 100644
index 000000000..336135fff
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/fsetpos.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int fsetpos(FILE *stream, fpos_t *pos) {
+ if (fseek(stream,*pos,SEEK_SET)==-1)
+ return -1;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libstdio/ftell.c b/mdk-stage1/dietlibc/libstdio/ftell.c
index 42d2c9f26..48f74858a 100644
--- a/mdk-stage1/dietlibc/libstdio/ftell.c
+++ b/mdk-stage1/dietlibc/libstdio/ftell.c
@@ -3,5 +3,5 @@
long ftell(FILE *stream) {
fflush(stream);
- return (lseek(stream->fd,0,SEEK_CUR));
+ return (lseek(stream->fd,0,SEEK_CUR)-stream->ungotten);
}
diff --git a/mdk-stage1/dietlibc/libstdio/ftello.c b/mdk-stage1/dietlibc/libstdio/ftello.c
new file mode 100644
index 000000000..9d36318e2
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/ftello.c
@@ -0,0 +1,7 @@
+#include <dietstdio.h>
+#include <unistd.h>
+
+off_t ftello(FILE *stream) {
+ fflush(stream);
+ return (lseek(stream->fd,0,SEEK_CUR));
+}
diff --git a/mdk-stage1/dietlibc/libstdio/ftello64.c b/mdk-stage1/dietlibc/libstdio/ftello64.c
new file mode 100644
index 000000000..bda7a7de4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/ftello64.c
@@ -0,0 +1,9 @@
+#include <dietstdio.h>
+#include <unistd.h>
+
+#ifndef __NO_STAT64
+off64_t ftello64(FILE *stream) {
+ fflush(stream);
+ return (lseek64(stream->fd,0ull,SEEK_CUR));
+}
+#endif
diff --git a/mdk-stage1/dietlibc/libstdio/fwrite.c b/mdk-stage1/dietlibc/libstdio/fwrite.c
index 5691661a5..e2536ccfb 100644
--- a/mdk-stage1/dietlibc/libstdio/fwrite.c
+++ b/mdk-stage1/dietlibc/libstdio/fwrite.c
@@ -1,30 +1,28 @@
#include <sys/types.h>
#include "dietstdio.h"
#include <unistd.h>
+#include <errno.h>
-size_t fwrite( const 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 res;
-#ifdef WANT_BUFFERED_STDIO
- long len=size*nmemb;
+ unsigned 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);
+ if (!nmemb || len/nmemb!=size) return 0; /* check for integer overflow */
+ if (len>stream->buflen || (stream->flags&NOBUF)) {
+ fflush(stream);
+ do {
+ res=write(stream->fd,ptr,size*nmemb);
+ } while (res==-1 && errno==EINTR);
} 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;
+ for (i=len; i>0; --i,++c)
+ if (fputc(*c,stream)) { res=len-i; goto abort; }
+ res=len;
}
-#else
- res=write(stream->fd,ptr,size*nmemb);
-#endif
if (res<0) {
stream->flags|=ERRORINDICATOR;
return 0;
}
+abort:
return size?res/size:0;
}
diff --git a/mdk-stage1/dietlibc/libstdio/printf.c b/mdk-stage1/dietlibc/libstdio/printf.c
index 571420dc3..5af172c58 100644
--- a/mdk-stage1/dietlibc/libstdio/printf.c
+++ b/mdk-stage1/dietlibc/libstdio/printf.c
@@ -1,29 +1,15 @@
#include <stdarg.h>
-#include <linux/types.h>
+#include <sys/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);
+ n=vprintf(format, arg_ptr);
+ va_end(arg_ptr);
return n;
}
diff --git a/mdk-stage1/dietlibc/libstdio/puts.c b/mdk-stage1/dietlibc/libstdio/puts.c
new file mode 100644
index 000000000..b1da01f9d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/puts.c
@@ -0,0 +1,16 @@
+#include <unistd.h>
+#include <string.h>
+#include "dietstdio.h"
+#include "dietfeatures.h"
+
+int __cheap_outs(const char *s,size_t len);
+int __cheap_outs(const char *s,size_t len) {
+ return (size_t)write(1,s,len)==len?1:0;
+}
+
+int __stdio_outs(const char *s,size_t len) __attribute__((weak,alias("__cheap_outs")));
+
+int puts(const char *s) {
+ return (__stdio_outs(s,strlen(s)) && __stdio_outs("\n",1))?0:-1;
+}
+
diff --git a/mdk-stage1/dietlibc/libstdio/scanf.c b/mdk-stage1/dietlibc/libstdio/scanf.c
new file mode 100644
index 000000000..589c19f41
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/scanf.c
@@ -0,0 +1,14 @@
+#include <stdarg.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include "dietstdio.h"
+#include <unistd.h>
+
+int scanf(const char *format, ...) {
+ int n;
+ va_list arg_ptr;
+ va_start(arg_ptr, format);
+ n=vfscanf(stdin,format,arg_ptr);
+ va_end (arg_ptr);
+ return n;
+}
diff --git a/mdk-stage1/dietlibc/libstdio/setvbuf.c b/mdk-stage1/dietlibc/libstdio/setvbuf.c
index d0b1b7640..b8b50addf 100644
--- a/mdk-stage1/dietlibc/libstdio/setvbuf.c
+++ b/mdk-stage1/dietlibc/libstdio/setvbuf.c
@@ -1,18 +1,34 @@
#include <sys/types.h>
#include "dietstdio.h"
#include <unistd.h>
+#include <stdlib.h>
#include "dietwarning.h"
-int setvbuf(FILE *stream, char *buf, int flags , size_t size) {
-#ifdef WANT_BUFFERED_STDIO
+static int set_flags (FILE *stream, int flags) {
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;
+ case _IONBF: stream->flags = (stream->flags & ~(BUFLINEWISE)) | NOBUF; break;
+ case _IOLBF: stream->flags = (stream->flags & ~(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.")
+int setvbuf(FILE *stream, char *buf, int flags, size_t size) {
+ if (buf) {
+ if (!(stream->flags&STATICBUF)) free(stream->buf);
+ stream->buf=buf;
+ }
+ else {
+ char *tmp;
+ if (!size) {
+ return set_flags(stream,flags);
+ }
+ if (!(tmp=malloc(size))) return -1;
+ if (!(stream->flags&STATICBUF)) free(stream->buf);
+ stream->buf=tmp;
+ }
+ stream->buflen=size;
+ stream->bm=stream->bs=0;
+ return set_flags(stream,flags);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/stderr.c b/mdk-stage1/dietlibc/libstdio/stderr.c
index a82b1b727..a9a34fd7e 100644
--- a/mdk-stage1/dietlibc/libstdio/stderr.c
+++ b/mdk-stage1/dietlibc/libstdio/stderr.c
@@ -1,13 +1,22 @@
#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 };
+static FILE __stderr = {
+ .fd=2,
+ .flags=NOBUF,
+ .bs=0, .bm=0,
+ .buflen=0,
+ .buf=0,
+ .next=0,
+ .popen_kludge=0,
+ .ungetbuf=0,
+ .ungotten=0
+#ifdef WANT_THREAD_SAFE
+ , .m=PTHREAD_MUTEX_INITIALIZER
#endif
+};
FILE *stderr=&__stderr;
+
+int __fflush_stderr(void) {
+ return fflush(stderr);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/stdin.c b/mdk-stage1/dietlibc/libstdio/stdin.c
index 2db82f9ab..217f3f609 100644
--- a/mdk-stage1/dietlibc/libstdio/stdin.c
+++ b/mdk-stage1/dietlibc/libstdio/stdin.c
@@ -1,13 +1,23 @@
#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 };
+static char __stdin_buf[BUFSIZE];
+static FILE __stdin = {
+ .fd=0,
+ .flags=BUFINPUT|STATICBUF,
+ .bs=0, .bm=0,
+ .buflen=BUFSIZE,
+ .buf=__stdin_buf,
+ .next=0,
+ .popen_kludge=0,
+ .ungetbuf=0,
+ .ungotten=0
+#ifdef WANT_THREAD_SAFE
+ , .m=PTHREAD_MUTEX_INITIALIZER
#endif
+};
FILE *stdin=&__stdin;
+
+int __fflush_stdin(void) {
+ return fflush(stdin);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/stdout.c b/mdk-stage1/dietlibc/libstdio/stdout.c
index 481fb1014..08054d0d4 100644
--- a/mdk-stage1/dietlibc/libstdio/stdout.c
+++ b/mdk-stage1/dietlibc/libstdio/stdout.c
@@ -1,14 +1,23 @@
#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 };
+static char __stdout_buf[BUFSIZE];
+static FILE __stdout = {
+ .fd=1,
+ .flags=BUFLINEWISE|STATICBUF,
+ .bs=0, .bm=0,
+ .buflen=BUFSIZE,
+ .buf=__stdout_buf,
+ .next=0,
+ .popen_kludge=0,
+ .ungetbuf=0,
+ .ungotten=0
+#ifdef WANT_THREAD_SAFE
+ , .m=PTHREAD_MUTEX_INITIALIZER
#endif
+};
FILE *stdout=&__stdout;
+int __fflush_stdout(void) {
+ return fflush(stdout);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/tmpfile.c b/mdk-stage1/dietlibc/libstdio/tmpfile.c
new file mode 100644
index 000000000..b20d8410d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/tmpfile.c
@@ -0,0 +1,12 @@
+#include "dietstdio.h"
+#include <stdlib.h>
+#include <unistd.h>
+
+FILE *tmpfile (void) {
+ int fd;
+ char template[20] = "/tmp/tmpfile-XXXXXX";
+ if ((fd=mkstemp(template))<0)
+ return 0;
+ unlink(template);
+ return __stdio_init_file(fd,1);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/ungetc.c b/mdk-stage1/dietlibc/libstdio/ungetc.c
index ae03e9381..133e92820 100644
--- a/mdk-stage1/dietlibc/libstdio/ungetc.c
+++ b/mdk-stage1/dietlibc/libstdio/ungetc.c
@@ -1,11 +1,10 @@
#include "dietstdio.h"
-#ifdef WANT_UNGETC
int ungetc(int c, FILE *stream) {
- if (stream->ungotten)
+ if (stream->ungotten || c<0 || c>255)
return EOF;
stream->ungotten=1;
- stream->ungetbuf=(char)(unsigned char)c;
+ stream->ungetbuf=(unsigned char)c;
+ stream->flags&=~(ERRORINDICATOR|EOFINDICATOR);
return c;
}
-#endif
diff --git a/mdk-stage1/dietlibc/libstdio/vfdprintf.c b/mdk-stage1/dietlibc/libstdio/vfdprintf.c
new file mode 100644
index 000000000..fdfeb09e1
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/vfdprintf.c
@@ -0,0 +1,15 @@
+#include <stdarg.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "dietstdio.h"
+
+static int __fwrite(void*ptr, size_t nmemb, int fd) {
+ return write(fd,ptr,nmemb);
+}
+
+int vfdprintf(int fd, const char *format, va_list arg_ptr)
+{
+ struct arg_printf ap = { (void*)(long)fd, (int(*)(void*,size_t,void*)) __fwrite };
+ return __v_printf(&ap,format,arg_ptr);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/vfprintf.c b/mdk-stage1/dietlibc/libstdio/vfprintf.c
new file mode 100644
index 000000000..5e64cf099
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/vfprintf.c
@@ -0,0 +1,15 @@
+#include <stdarg.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "dietstdio.h"
+
+static int __fwrite(void*ptr, size_t nmemb, FILE* f) {
+ return fwrite(ptr,1,nmemb,f);
+}
+
+int vfprintf(FILE *stream, const char *format, va_list arg_ptr)
+{
+ struct arg_printf ap = { stream, (int(*)(void*,size_t,void*)) __fwrite };
+ return __v_printf(&ap,format,arg_ptr);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/vfscanf.c b/mdk-stage1/dietlibc/libstdio/vfscanf.c
new file mode 100644
index 000000000..6d75a45ac
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/vfscanf.c
@@ -0,0 +1,11 @@
+#include <stdarg.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include "dietstdio.h"
+#include <unistd.h>
+
+int vfscanf(FILE *stream, const char *format, va_list arg_ptr)
+{
+ struct arg_scanf farg = { (void*)stream, (int(*)(void*))fgetc, (int(*)(int,void*))ungetc };
+ return __v_scanf(&farg,format,arg_ptr);
+}
diff --git a/mdk-stage1/dietlibc/libstdio/vprintf.c b/mdk-stage1/dietlibc/libstdio/vprintf.c
new file mode 100644
index 000000000..7fe579e0a
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/vprintf.c
@@ -0,0 +1,15 @@
+#include <stdarg.h>
+#include <unistd.h>
+#include "dietstdio.h"
+
+int __stdio_outs(const char *s,size_t len) __attribute__((weak));
+int __stdio_outs(const char *s,size_t len) {
+ return (write(1,s,len)==(int)len)?1:0;
+}
+
+int vprintf(const char *format, va_list ap)
+{
+ struct arg_printf _ap = { 0, (int(*)(void*,size_t,void*)) __stdio_outs };
+ return __v_printf(&_ap,format,ap);
+}
+
diff --git a/mdk-stage1/dietlibc/libstdio/vscanf.c b/mdk-stage1/dietlibc/libstdio/vscanf.c
new file mode 100644
index 000000000..ba9358fc4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libstdio/vscanf.c
@@ -0,0 +1,10 @@
+#include <stdarg.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include "dietstdio.h"
+#include <unistd.h>
+
+int vscanf(const char *format, va_list arg_ptr)
+{
+ return vfscanf(stdin,format,arg_ptr);
+}
diff --git a/mdk-stage1/dietlibc/libugly/asctime_r.c b/mdk-stage1/dietlibc/libugly/asctime_r.c
index 46325927c..43c5e2cb2 100644
--- a/mdk-stage1/dietlibc/libugly/asctime_r.c
+++ b/mdk-stage1/dietlibc/libugly/asctime_r.c
@@ -16,7 +16,7 @@ char *asctime_r(const struct tm *t, char *buf) {
if (buf[8]=='0') buf[8]=' ';
buf[10]=' ';
num2str(buf+11,t->tm_hour);
- if (buf[11]=='0') buf[11]=' ';
+// if (buf[11]=='0') buf[11]=' ';
buf[13]=':';
num2str(buf+14,t->tm_min);
buf[16]=':';
diff --git a/mdk-stage1/dietlibc/libugly/asprintf.c b/mdk-stage1/dietlibc/libugly/asprintf.c
index d10c20b4a..9db1f67c7 100644
--- a/mdk-stage1/dietlibc/libugly/asprintf.c
+++ b/mdk-stage1/dietlibc/libugly/asprintf.c
@@ -1,21 +1,18 @@
#include <stdarg.h>
-#include <linux/types.h>
+#include <sys/types.h>
#include <stdlib.h>
+#include <stdio.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))) {
+ if ((*s=malloc(n+1))) {
n=vsnprintf(*s,n+1,format,arg_ptr);
- va_end(arg_ptr);
return n;
}
return -1;
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/difftime.c b/mdk-stage1/dietlibc/libugly/difftime.c
new file mode 100644
index 000000000..fc71363c7
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/difftime.c
@@ -0,0 +1,8 @@
+#include <time.h>
+#include "../dietwarning.h"
+
+double difftime(time_t time1, time_t time2) {
+ return (double)time1 - (double)time2;
+}
+
+link_warning("difftime","warning: difftime introduces an unnecessary floating point dependency. Don't use it!")
diff --git a/mdk-stage1/dietlibc/libugly/dirfd.c b/mdk-stage1/dietlibc/libugly/dirfd.c
new file mode 100644
index 000000000..8d5af8b9a
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/dirfd.c
@@ -0,0 +1,8 @@
+#include <sys/types.h>
+#include "dietdirent.h"
+#define _BSD_SOURCE
+#include <dirent.h>
+
+int dirfd(DIR* dirp) {
+ return dirp->fd;
+}
diff --git a/mdk-stage1/dietlibc/libugly/freeaddrinfo.c b/mdk-stage1/dietlibc/libugly/freeaddrinfo.c
new file mode 100644
index 000000000..72a13f5e1
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/freeaddrinfo.c
@@ -0,0 +1,11 @@
+#include <sys/socket.h>
+#include <stdlib.h>
+
+void freeaddrinfo(struct addrinfo *res) {
+ while (res) {
+ struct addrinfo *duh;
+ duh=res;
+ res=res->ai_next;
+ free(duh);
+ }
+}
diff --git a/mdk-stage1/dietlibc/libugly/ftime.c b/mdk-stage1/dietlibc/libugly/ftime.c
new file mode 100644
index 000000000..3aa2d15c3
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/ftime.c
@@ -0,0 +1,15 @@
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <unistd.h>
+
+int ftime(struct timeb *tp) {
+ struct timeval tv;
+ struct timezone tz;
+ int ret=gettimeofday(&tv,&tz);
+ tp->time = tv.tv_sec;
+ tp->millitm = tv.tv_usec/1000;
+ tp->timezone = tz.tz_minuteswest;
+ tp->dstflag = tz.tz_dsttime;
+ return ret;
+}
+
diff --git a/mdk-stage1/dietlibc/libugly/gai_strerror.c b/mdk-stage1/dietlibc/libugly/gai_strerror.c
new file mode 100644
index 000000000..9dc4f5dde
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/gai_strerror.c
@@ -0,0 +1,13 @@
+#include <sys/socket.h>
+
+const char* gai_strerror(int error) {
+ switch (error) {
+ case EAI_FAMILY: return "family not supported";
+ case EAI_SOCKTYPE: return "socket type not supported";
+ case EAI_NONAME: return "unknown host";
+ case EAI_SERVICE: return "unknown service";
+ case EAI_MEMORY: return "memory allocation failure";
+ case EAI_AGAIN: return "temporary failure";
+ }
+ return "DNS error. Sorry.";
+}
diff --git a/mdk-stage1/dietlibc/libugly/getaddrinfo.c b/mdk-stage1/dietlibc/libugly/getaddrinfo.c
new file mode 100644
index 000000000..a4675d92b
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getaddrinfo.c
@@ -0,0 +1,140 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+
+/* XXX TODO FIXME */
+
+int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) {
+ struct addrinfo **tmp;
+ int family;
+ tmp=res; *res=0;
+ if (hints) {
+ if (hints->ai_family && hints->ai_family != PF_INET6 && hints->ai_family != PF_INET) return EAI_FAMILY;
+ if (hints->ai_socktype && hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM) return EAI_SOCKTYPE;
+ }
+ for (family=PF_INET6; ; family=PF_INET) {
+ if (!hints || hints->ai_family==family || hints->ai_family==AF_UNSPEC) { /* IPv6 addresses are OK */
+ struct hostent h;
+ struct hostent *H;
+ int herrno=0;
+ char buf[4096];
+ int lookupok=0;
+ h.h_addr_list=(char**)buf+16;
+ if (node) {
+ if (inet_pton(family,node,buf)>0) {
+ h.h_name=(char*)node;
+ h.h_addr_list[0]=buf;
+ lookupok=1;
+ } else if ((!hints || !(hints->ai_flags&AI_NUMERICHOST)) &&
+ !gethostbyname2_r(node,family,&h,buf,4096,&H,&herrno)) {
+ lookupok=1;
+ } else {
+ if (herrno==TRY_AGAIN) { freeaddrinfo(*res); return EAI_AGAIN; }
+ }
+ } else {
+ h.h_name=0;
+ h.h_addr_list[0]=buf;
+ memset(buf,0,16);
+ if (!hints || !(hints->ai_flags&AI_PASSIVE)) {
+ if (family==AF_INET) {
+ buf[0]=127; buf[3]=1;
+ } else
+ buf[15]=1;
+ }
+ lookupok=1;
+ }
+ if (lookupok) {
+ struct ai_v6 {
+ struct addrinfo ai;
+ union {
+ struct sockaddr_in6 ip6;
+ struct sockaddr_in ip4;
+ } ip;
+ char name[1];
+ } *foo;
+ unsigned short port;
+ int len=sizeof(struct ai_v6)+(h.h_name?strlen(h.h_name):0);
+ if (!(foo=malloc(len))) goto error;
+ foo->ai.ai_next=0;
+ foo->ai.ai_socktype=SOCK_STREAM;
+ foo->ai.ai_protocol=IPPROTO_TCP;
+ foo->ai.ai_addrlen=family==PF_INET6?sizeof(struct sockaddr_in6):sizeof(struct sockaddr_in);
+ foo->ai.ai_addr=(struct sockaddr*)&foo->ip;
+ if (family==PF_INET6) {
+ memset(&foo->ip,0,sizeof(foo->ip));
+ memmove(&foo->ip.ip6.sin6_addr,h.h_addr_list[0],16);
+ } else {
+ memmove(&foo->ip.ip4.sin_addr,h.h_addr_list[0],4);
+ }
+ foo->ip.ip6.sin6_family=foo->ai.ai_family=family;
+ if (h.h_name) {
+ foo->ai.ai_canonname=foo->name;
+ memmove(foo->name,h.h_name,strlen(h.h_name)+1);
+ } else
+ foo->ai.ai_canonname=0;
+ if (!hints || hints->ai_socktype!=SOCK_DGRAM) { /* TCP is OK */
+ char *x;
+ port=htons(strtol(service?service:"0",&x,0));
+ if (*x) { /* service is not numeric :-( */
+ struct servent* se;
+ if ((se=getservbyname(service,"tcp"))) { /* found a service. */
+ port=se->s_port;
+ blah1:
+ if (family==PF_INET6)
+ foo->ip.ip6.sin6_port=port;
+ else
+ foo->ip.ip4.sin_port=port;
+ if (!*tmp) *tmp=&(foo->ai); else (*tmp)->ai_next=&(foo->ai);
+ if (!(foo=malloc(len))) goto error;
+ memmove(foo,*tmp,len);
+ tmp=&(*tmp)->ai_next;
+ foo->ai.ai_addr=(struct sockaddr*)&foo->ip;
+ if (foo->ai.ai_canonname)
+ foo->ai.ai_canonname=foo->name;
+ } else {
+ freeaddrinfo(*res);
+ return EAI_SERVICE;
+ }
+ } else goto blah1;
+ }
+ foo->ai.ai_socktype=SOCK_DGRAM;
+ foo->ai.ai_protocol=IPPROTO_UDP;
+ if (!hints || hints->ai_socktype!=SOCK_STREAM) { /* UDP is OK */
+ char *x;
+ port=htons(strtol(service?service:"0",&x,0));
+ if (*x) { /* service is not numeric :-( */
+ struct servent* se;
+ if ((se=getservbyname(service,"udp"))) { /* found a service. */
+ port=se->s_port;
+ blah2:
+ if (family==PF_INET6)
+ foo->ip.ip6.sin6_port=port;
+ else
+ foo->ip.ip4.sin_port=port;
+ if (!*tmp) *tmp=&(foo->ai); else (*tmp)->ai_next=&(foo->ai);
+ if (!(foo=malloc(len))) goto error;
+ memmove(foo,*tmp,len);
+ tmp=&(*tmp)->ai_next;
+ foo->ai.ai_addr=(struct sockaddr*)&foo->ip;
+ foo->ai.ai_canonname=foo->name;
+ } else {
+ freeaddrinfo(*res);
+ return EAI_SERVICE;
+ }
+ } else goto blah2;
+ }
+ free(foo);
+ }
+ }
+ if (family==PF_INET) break;
+ }
+ if (*res==0) return EAI_NONAME; /* kludge kludge... */
+ return 0;
+error:
+ freeaddrinfo(*res);
+ return EAI_MEMORY;
+}
diff --git a/mdk-stage1/dietlibc/libugly/gethostent.c b/mdk-stage1/dietlibc/libugly/gethostent.c
new file mode 100644
index 000000000..fe92beacf
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/gethostent.c
@@ -0,0 +1,116 @@
+#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>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include "dietfeatures.h"
+
+static char* hostmap=0;
+static unsigned int hostlen;
+
+static char *cur;
+
+/* ::1 localhost6 alias1 alias2 # internet protocol, pseudo protocol number */
+struct hostent* gethostent_r(char* buf, int len) {
+ char *dest;
+ struct hostent* pe=(struct hostent*)buf;
+ char* last;
+ char* max=buf+len;
+ int aliasidx;
+ if (!hostmap) {
+ int hostfd=open(_PATH_HOSTS,O_RDONLY);
+ if (hostfd<0) return 0;
+ hostlen=lseek(hostfd,0,SEEK_END);
+ hostmap=mmap(0,hostlen,PROT_READ|PROT_WRITE,MAP_PRIVATE,hostfd,0);
+ if ((long)hostmap==(-1)) { close(hostfd); hostmap=0; goto error; }
+ close(hostfd); hostfd=-1;
+ cur=hostmap;
+ }
+ last=hostmap+hostlen;
+again:
+ if ((size_t)len<sizeof(struct hostent)+11*sizeof(char*)) goto nospace;
+ dest=buf+sizeof(struct hostent);
+ pe->h_name=0;
+ pe->h_aliases=(char**)dest; pe->h_aliases[0]=0; dest+=10*sizeof(char*);
+ pe->h_addr_list=(char**)dest; dest+=2*sizeof(char**);
+ if (cur>=last) return 0;
+ if (*cur=='#' || *cur=='\n') goto parseerror;
+ /* first, the ip number */
+ pe->h_name=cur;
+ while (cur<last && !isspace(*cur)) cur++;
+ if (cur>=last) return 0;
+ if (*cur=='\n') goto parseerror;
+ {
+ char save=*cur;
+ *cur=0;
+ pe->h_addr_list[0]=dest;
+ pe->h_addr_list[1]=0;
+ if (max-dest<16) goto nospace;
+ if (inet_pton(AF_INET6,pe->h_name,dest)>0) {
+ pe->h_addrtype=AF_INET6;
+ pe->h_length=16;
+ dest+=16;
+ } else if (inet_pton(AF_INET,pe->h_name,dest)>0) {
+ pe->h_addrtype=AF_INET;
+ pe->h_length=4;
+ dest+=4;
+ } else {
+ *cur=save;
+ goto parseerror;
+ }
+ *cur=save;
+ }
+ ++cur;
+ /* now the aliases */
+ for (aliasidx=0;aliasidx<9;++aliasidx) {
+ while (cur<last && isblank(*cur)) ++cur;
+ pe->h_aliases[aliasidx]=cur;
+ while (cur<last && !isspace(*cur)) ++cur;
+ {
+ char *from=pe->h_aliases[aliasidx];
+ int len=cur-from;
+ if (max-dest<len+2) goto nospace;
+ pe->h_aliases[aliasidx]=dest;
+ memmove(dest,from,(size_t)(cur-from));
+ dest+=len;
+ *dest=0; ++dest;
+ }
+ if (*cur=='\n') { ++cur; ++aliasidx; break; }
+ if (cur>=last || !isblank(*cur)) break;
+ cur++;
+ }
+ pe->h_aliases[aliasidx]=0;
+ pe->h_name=pe->h_aliases[0];
+ pe->h_aliases++;
+ return pe;
+parseerror:
+ while (cur<last && *cur!='\n') cur++;
+ cur++;
+ goto again;
+nospace:
+ errno=ERANGE;
+ goto __error;
+error:
+ errno=ENOMEM;
+__error:
+ if (hostmap!=(char*)-1) munmap(hostmap,hostlen);
+ hostmap=(char*)-1;
+ return 0;
+}
+
+void sethostent(int stayopen) {
+ (void)stayopen;
+ cur=hostmap;
+}
+
+void endhostent(void) {
+ if (hostmap!=(char*)-1) munmap(hostmap,hostlen);
+ hostmap=0;
+}
+
diff --git a/mdk-stage1/dietlibc/libugly/getmntent.c b/mdk-stage1/dietlibc/libugly/getmntent.c
index 250a77b7f..1a1bdca24 100644
--- a/mdk-stage1/dietlibc/libugly/getmntent.c
+++ b/mdk-stage1/dietlibc/libugly/getmntent.c
@@ -5,11 +5,11 @@
struct mntent *getmntent(FILE *filep) {
static struct mntent m;
- char buf[1024];
+ static char buf[1024];
do {
char *tmp=buf;
int num;
- fgets(buf,1024,filep);
+ if (!fgets(buf,1024,filep)) return 0;
/* "/dev/ide/host0/bus0/target0/lun0/part2 / reiserfs defaults 1 1" */
for (num=0; num<6; ++num) {
switch (num) {
@@ -17,12 +17,13 @@ struct mntent *getmntent(FILE *filep) {
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 4: m.mnt_freq=strtol(tmp,&tmp,0); if (*tmp!=' ' && *tmp!='\t') continue; break;
case 5: m.mnt_passno=strtol(tmp,&tmp,0); if (*tmp=='\n') return &m; break;
}
- if ((tmp=strchr(tmp,' '))) {
+ while (*tmp && *tmp!=' ' && *tmp!='\n' && *tmp!='\t') ++tmp;
+ if (*tmp) {
if (num<4) *tmp++=0;
- while (*tmp==' ') ++tmp;
+ while (*tmp==' ' || *tmp=='\t') ++tmp;
} else
continue;
}
diff --git a/mdk-stage1/dietlibc/libugly/getnameinfo.c b/mdk-stage1/dietlibc/libugly/getnameinfo.c
new file mode 100644
index 000000000..40883ba09
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getnameinfo.c
@@ -0,0 +1,46 @@
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <string.h>
+
+extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase);
+
+int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
+ size_t hostlen, char *serv, size_t servlen, int flags) {
+ sa_family_t f=((struct sockaddr_storage *)sa)->ss_family;
+ (void)salen; /* shut gcc up about unused salen */
+ if (host && hostlen>0) { /* user wants me to resolve the host name */
+ register const char*addr=(f==AF_INET6)?(char*)&((struct sockaddr_in6*)sa)->sin6_addr:
+ (char*)&((struct sockaddr_in*)sa)->sin_addr;
+ if (flags&NI_NUMERICHOST) {
+ if (!inet_ntop(f,addr,host,hostlen))
+ return EAI_NONAME;
+ } else {
+ char buf[4096];
+ struct hostent h;
+ struct hostent *H;
+ int herrno;
+ if (gethostbyaddr_r(addr,f==AF_INET6?16:4,f,&h,buf,4096,&H,&herrno)) {
+ switch (herrno) {
+ case TRY_AGAIN: return EAI_AGAIN;
+ case NO_DATA:
+ case HOST_NOT_FOUND: return EAI_NONAME;
+ }
+ }
+ strncpy(host,h.h_name,hostlen-1);
+ host[hostlen-1]=0;
+ }
+ }
+ if (serv && servlen>0) {
+ register short int port=(f==AF_INET6)?((struct sockaddr_in6*)sa)->sin6_port:((struct sockaddr_in*)sa)->sin_port;
+ if (flags&NI_NUMERICSERV) {
+ __ltostr(serv,servlen,ntohs(port),10,0);
+ } else {
+ struct servent *s;
+ if (!(s=getservbyport(port,flags&NI_DGRAM?"udp":"tcp")))
+ return EAI_SERVICE;
+ }
+ }
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getprotobyname.c b/mdk-stage1/dietlibc/libugly/getprotobyname.c
new file mode 100644
index 000000000..1de348791
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getprotobyname.c
@@ -0,0 +1,12 @@
+#include <string.h>
+#include <netdb.h>
+
+extern struct protoent __protoent_pw;
+extern char __protoent_buf[1000];
+
+struct protoent *getprotobyname(const char *name) {
+ struct protoent* tmp;
+ if (getprotobyname_r(name,&__protoent_pw,__protoent_buf,sizeof(__protoent_buf),&tmp)==0)
+ return tmp;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getprotobyname_r.c b/mdk-stage1/dietlibc/libugly/getprotobyname_r.c
new file mode 100644
index 000000000..3b1219aa7
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getprotobyname_r.c
@@ -0,0 +1,17 @@
+#include <string.h>
+#include <netdb.h>
+
+extern int getprotobyname_r(const char* name,
+ struct protoent *res, char *buf, size_t buflen,
+ struct protoent **res_sig) {
+ while (!getprotoent_r(res,buf,buflen,res_sig)) {
+ int i;
+ if (!strcmp(res->p_name,name)) goto found;
+ for (i=0; res->p_aliases[i]; ++i)
+ if (!strcmp(res->p_aliases[i],name)) goto found;
+ }
+ *res_sig=0;
+found:
+ endprotoent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getprotobynumber.c b/mdk-stage1/dietlibc/libugly/getprotobynumber.c
new file mode 100644
index 000000000..6170753e2
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getprotobynumber.c
@@ -0,0 +1,12 @@
+#include <string.h>
+#include <netdb.h>
+
+extern struct protoent __protoent_pw;
+extern char __protoent_buf[1000];
+
+struct protoent *getprotobynumber(int proto) {
+ struct protoent* tmp;
+ if (getprotobynumber_r(proto,&__protoent_pw,__protoent_buf,sizeof(__protoent_buf),&tmp)==0)
+ return tmp;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getprotobynumber_r.c b/mdk-stage1/dietlibc/libugly/getprotobynumber_r.c
new file mode 100644
index 000000000..2ca439fc6
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getprotobynumber_r.c
@@ -0,0 +1,13 @@
+#include <string.h>
+#include <netdb.h>
+
+extern int getprotobynumber_r(int proto,
+ struct protoent *res, char *buf, size_t buflen,
+ struct protoent **res_sig) {
+ while (!getprotoent_r(res,buf,buflen,res_sig))
+ if (proto==res->p_proto) goto found;
+ *res_sig=0;
+found:
+ endprotoent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getprotoent.c b/mdk-stage1/dietlibc/libugly/getprotoent.c
index a648e2307..3f0fd4d41 100644
--- a/mdk-stage1/dietlibc/libugly/getprotoent.c
+++ b/mdk-stage1/dietlibc/libugly/getprotoent.c
@@ -1,130 +1,10 @@
-#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;
+extern struct protoent __protoent_pw;
+extern char __protoent_buf[1000];
-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* tmp;
+ getprotoent_r(&__protoent_pw,__protoent_buf,sizeof(__protoent_buf),&tmp);
+ return tmp;
}
-
-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/getprotoent_r.c b/mdk-stage1/dietlibc/libugly/getprotoent_r.c
new file mode 100644
index 000000000..aa9af79c3
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getprotoent_r.c
@@ -0,0 +1,78 @@
+#include <string.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <netdb.h>
+#include <ctype.h>
+#include "parselib.h"
+
+static struct state __ps;
+
+void setprotoent(int stayopen) {
+ (void)stayopen;
+ __prepare_parse(_PATH_PROTOCOLS,&__ps);
+}
+
+void endprotoent(void) {
+ __end_parse(&__ps);
+}
+
+#define ALIASES 16
+
+/* "igmp 2 IGMP # internet group management protocol" */
+int getprotoent_r(struct protoent *res, char *buf, size_t buflen,
+ struct protoent **res_sig) {
+ size_t i,j,n,g;
+ unsigned long l;
+ if (!__ps.buffirst) setprotoent(0);
+ if (!__ps.buffirst) goto error;
+ if (__ps.cur>=__ps.buflen) goto error;
+ res->p_aliases=(char**)buf;
+/* getprotoent */
+again:
+ n=ALIASES*sizeof(char*); g=0;
+ for (i=0; i<3; ++i) {
+ char found;
+ __ps.cur+=__parse_ws(&__ps);
+ if (__ps.cur>=__ps.buflen) { if (i==2) break; else goto error; }
+ j=__parse_nws(&__ps);
+ if (!isblank(found=__ps.buffirst[__ps.cur+j])) {
+ if (i==2) break; /* it's ok, no (more) aliases necessary */
+parseerror:
+ while (__ps.cur+j<__ps.buflen) {
+ if (__ps.buffirst[__ps.cur+j]=='\n') {
+ __ps.cur+=j+1;
+ goto again;
+ }
+ ++j;
+ }
+ }
+ switch (i) {
+ case 0:
+ res->p_name=buf+n;
+copy:
+ if ((size_t)buflen<=n+j) goto error;
+ memcpy(buf+n,__ps.buffirst+__ps.cur,j);
+ buf[n+j]=0;
+ n+=j+1;
+ if ((found=='\n' || found=='#') && i==1) i=3;
+ break;
+ case 1:
+ if (scan_ulong(__ps.buffirst+__ps.cur,&l)!=j) goto parseerror;
+ res->p_proto=l;
+ break;
+ case 2:
+ res->p_aliases[g]=buf+n;
+ ++g;
+ if (g==(ALIASES-1)) break;
+ --i; /* again */
+ goto copy;
+ }
+ __ps.cur+=j+1;
+ }
+ res->p_aliases[g]=0;
+ *res_sig=res;
+ return 0;
+error:
+ *res_sig=0;/* the glibc people should be taken behind the barn and shot */
+ return -1;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getservbyname.c b/mdk-stage1/dietlibc/libugly/getservbyname.c
new file mode 100644
index 000000000..f1c74eaa9
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getservbyname.c
@@ -0,0 +1,12 @@
+#include <string.h>
+#include <netdb.h>
+
+extern struct servent __servent_pw;
+extern char __servent_buf[1000];
+
+struct servent *getservbyname(const char *name, const char *proto) {
+ struct servent* tmp;
+ if (getservbyname_r(name,proto,&__servent_pw,__servent_buf,sizeof(__servent_buf),&tmp)==0)
+ return tmp;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getservbyname_r.c b/mdk-stage1/dietlibc/libugly/getservbyname_r.c
new file mode 100644
index 000000000..f523a01ca
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getservbyname_r.c
@@ -0,0 +1,18 @@
+#include <string.h>
+#include <netdb.h>
+
+extern int getservbyname_r(const char* name,const char* proto,
+ struct servent *res, char *buf, size_t buflen,
+ struct servent **res_sig) {
+ while (!getservent_r(res,buf,buflen,res_sig)) {
+ int i;
+ if (proto && strcmp(res->s_proto,proto)) continue;
+ if (!strcmp(res->s_name,name)) goto found;
+ for (i=0; res->s_aliases[i]; ++i)
+ if (!strcmp(res->s_aliases[i],name)) goto found;
+ }
+ *res_sig=0;
+found:
+ endservent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getservbyport.c b/mdk-stage1/dietlibc/libugly/getservbyport.c
new file mode 100644
index 000000000..2821deb63
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getservbyport.c
@@ -0,0 +1,12 @@
+#include <string.h>
+#include <netdb.h>
+
+extern struct servent __servent_pw;
+extern char __servent_buf[1000];
+
+struct servent *getservbyport(int port, const char *proto) {
+ struct servent* tmp;
+ if (getservbyport_r(port,proto,&__servent_pw,__servent_buf,sizeof(__servent_buf),&tmp)==0)
+ return tmp;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getservbyport_r.c b/mdk-stage1/dietlibc/libugly/getservbyport_r.c
new file mode 100644
index 000000000..9c0f21bdf
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getservbyport_r.c
@@ -0,0 +1,13 @@
+#include <string.h>
+#include <netdb.h>
+
+extern int getservbyport_r(int port,const char* proto,
+ struct servent *res, char *buf, size_t buflen,
+ struct servent **res_sig) {
+ while (!getservent_r(res,buf,buflen,res_sig))
+ if (port==res->s_port && !strcmp(res->s_proto,proto)) goto ok;
+ *res_sig=0;
+ok:
+ endservent();
+ return *res_sig?0:-1;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getservent.c b/mdk-stage1/dietlibc/libugly/getservent.c
new file mode 100644
index 000000000..9eabc972a
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getservent.c
@@ -0,0 +1,10 @@
+#include <netdb.h>
+
+extern struct servent __servent_pw;
+extern char __servent_buf[1000];
+
+struct servent *getservent(void) {
+ struct servent* tmp;
+ getservent_r(&__servent_pw,__servent_buf,sizeof(__servent_buf),&tmp);
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libugly/getservent_r.c b/mdk-stage1/dietlibc/libugly/getservent_r.c
new file mode 100644
index 000000000..33db6f31d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/getservent_r.c
@@ -0,0 +1,91 @@
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <netdb.h>
+#include <ctype.h>
+#include "parselib.h"
+
+static struct state __ps;
+
+void setservent(int stayopen) {
+ (void)stayopen;
+ __prepare_parse(_PATH_SERVICES,&__ps);
+}
+
+void endservent(void) {
+ __end_parse(&__ps);
+}
+
+#define ALIASES 16
+
+/* "tcpmux 1/tcp # TCP port multiplexer (RFC1078)" */
+int getservent_r(struct servent *res, char *buf, size_t buflen,
+ struct servent **res_sig) {
+ size_t i,j,n,g;
+ unsigned long l;
+ if (!__ps.buffirst) setservent(0);
+ if (!__ps.buffirst) goto error;
+ if (__ps.cur>=__ps.buflen) goto error;
+ res->s_aliases=(char**)buf;
+/* getservent */
+again:
+ n=ALIASES*sizeof(char*); g=0;
+ for (i=0; i<3; ++i) {
+ char found;
+ __ps.cur+=__parse_ws(&__ps);
+ if (__ps.cur>=__ps.buflen) { if (i==2) break; else goto error; }
+ j=__parse_nws(&__ps);
+ if (!isblank(found=__ps.buffirst[__ps.cur+j])) {
+ if (i==2 && found=='#') break;
+ if (found=='#' || (i>1 && found!='\n')) {
+parseerror:
+ while (__ps.cur+j<__ps.buflen) {
+ if (__ps.buffirst[__ps.cur+j]=='\n') {
+ __ps.cur+=j+1;
+ goto again;
+ }
+ ++j;
+ }
+ goto error;
+ }
+ }
+ switch (i) {
+ case 0:
+ res->s_name=buf+n;
+copy:
+ if (!j) goto parseerror;
+ if ((size_t)buflen<=n+j) goto error;
+ memcpy(buf+n,__ps.buffirst+__ps.cur,j);
+ buf[n+j]=0;
+ n+=j+1;
+ if ((found=='\n' || found=='#') && i==1) i=3;
+ break;
+ case 1:
+ {
+ int k;
+ k=scan_ulong(__ps.buffirst+__ps.cur,&l);
+ if (__ps.buffirst[__ps.cur+k]!='/') {
+ goto parseerror;
+ }
+ res->s_port=htons(l);
+ res->s_proto=buf+n;
+ j-=k+1; __ps.cur+=k+1;
+ goto copy;
+ }
+ case 2:
+ res->s_aliases[g]=buf+n;
+ ++g;
+ if (g==(ALIASES-1)) break;
+ --i; /* again */
+ goto copy;
+ }
+ __ps.cur+=j+1;
+ }
+ res->s_aliases[g]=0;
+ *res_sig=res;
+ return 0;
+error:
+ *res_sig=0;/* the glibc people should be taken behind the barn and shot */
+ return -1;
+}
diff --git a/mdk-stage1/dietlibc/libugly/gmtime_r.c b/mdk-stage1/dietlibc/libugly/gmtime_r.c
index c102d10fa..6bc0bb5b2 100644
--- a/mdk-stage1/dietlibc/libugly/gmtime_r.c
+++ b/mdk-stage1/dietlibc/libugly/gmtime_r.c
@@ -3,7 +3,7 @@
/* seconds per day */
#define SPD 24*60*60
-extern unsigned int __spm[];
+extern short __spm[];
struct tm *gmtime_r(const time_t *timep, struct tm *r) {
time_t i;
@@ -14,7 +14,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r) {
r->tm_wday=(4+work)%7;
for (i=1970; ; ++i) {
register time_t k=__isleap(i)?366:365;
- if (work>k)
+ if (work>=k)
work-=k;
else
break;
@@ -28,7 +28,7 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r) {
work-=1;
}
- for (i=11; i && __spm[i]>work; --i) ;
+ 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/grantpt.c b/mdk-stage1/dietlibc/libugly/grantpt.c
new file mode 100644
index 000000000..0aa903b29
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/grantpt.c
@@ -0,0 +1,13 @@
+#define _XOPEN_SOURCE
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+
+int grantpt (int fd) {
+ struct stat st;
+ if ((fstat(fd, &st))<0) return -1;
+ if ((chmod((char*)ptsname(fd), st.st_mode | S_IRUSR | S_IWUSR | S_IWGRP))<0)
+ return -1;
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/hasmntopt.c b/mdk-stage1/dietlibc/libugly/hasmntopt.c
new file mode 100644
index 000000000..2a547feee
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/hasmntopt.c
@@ -0,0 +1,18 @@
+#include <string.h>
+#include <mntent.h>
+
+char *hasmntopt(const struct mntent *mnt, const char *opt) {
+ char *s=mnt->mnt_opts;
+ char *c;
+ int len=strlen(opt);
+ if (!s) return 0;
+ for (c=s;;) {
+ if (!(c=strstr(c,opt))) break;
+ if (c==s || c[-1]==',') {
+ if (c[len]==0 || c[len]==',' || c[len]=='=')
+ return c;
+ }
+ c+=len+1;
+ }
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/iconv.c b/mdk-stage1/dietlibc/libugly/iconv.c
new file mode 100644
index 000000000..45be5d91d
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/iconv.c
@@ -0,0 +1,71 @@
+#include "dietfeatures.h"
+#include <errno.h>
+#include "dieticonv.h"
+#include <netinet/in.h>
+
+size_t iconv(iconv_t cd, const char* * inbuf, size_t *
+ inbytesleft, char* * outbuf, size_t * outbytesleft) {
+ size_t converted=0,i,j,k;
+ int bits;
+ if (!inbuf || !*inbuf) return 0;
+ while (*inbytesleft) {
+ unsigned int v=0;
+ v=*(unsigned char*)*inbuf;
+ i=j=1;
+ switch (ic_from(cd)) {
+ case UCS_2:
+ v=ntohs(*(unsigned short*)*inbuf);
+ i=2;
+ break;
+ case UCS_4:
+ v=ntohs(*(unsigned int*)*inbuf);
+ i=4;
+ case ISO_8859_1:
+ break;
+ case UTF_8:
+ if (!(v&0x80)) break;
+ for (i=0xC0; i!=0xFC; i=(i>>1)+0x80)
+ if ((v&((i>>1)|0x80))==i) {
+ v&=~i;
+ break;
+ }
+ for (i=1; ((*inbuf)[i]&0xc0)==0x80; ++i)
+ v=(v<<6)|((*inbuf)[i]&0x3f);
+/* printf("got %u in %u bytes, buflen %u\n",v,i,*inbytesleft); */
+ break;
+ }
+ switch (ic_to(cd)) {
+ case ISO_8859_1:
+ **outbuf=(unsigned char)v;
+ break;
+ case UCS_2:
+ *(unsigned short*)*outbuf=htons(v);
+ j=2;
+ break;
+ case UCS_4:
+ *(unsigned int*)*outbuf=htonl(v);
+ j=4;
+ break;
+ case UTF_8:
+ if (v>0x04000000) { bits=30; **outbuf=0xFC; j=6; } else
+ if (v>0x00200000) { bits=24; **outbuf=0xF8; j=5; } else
+ if (v>0x00010000) { bits=18; **outbuf=0xF0; j=4; } else
+ if (v>0x00000800) { bits=12; **outbuf=0xE0; j=3; } else
+ if (v>0x00000080) { bits=6; **outbuf=0xC0; j=2; } else
+ { bits=0; **outbuf=0; }
+ **outbuf |= (unsigned char)(v>>bits);
+ if (*outbytesleft<j) {
+ errno=E2BIG;
+ return (size_t)-1;
+ }
+ for (k=1; k<j; ++k) {
+ bits-=6;
+ (*outbuf)[k]=0x80+((v>>bits)&0x3F);
+ }
+ break;
+ }
+ *inbuf+=i; *inbytesleft-=i; ++converted;
+ *outbuf+=j; *outbytesleft-=j;
+ }
+ return converted;
+}
diff --git a/mdk-stage1/dietlibc/libugly/iconv_close.c b/mdk-stage1/dietlibc/libugly/iconv_close.c
new file mode 100644
index 000000000..7d5d4c4b9
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/iconv_close.c
@@ -0,0 +1,7 @@
+#include <stdlib.h>
+#include "dieticonv.h"
+
+int iconv_close(iconv_t cd) {
+ (void)cd; /* shut gcc up about unused cd */
+ return 0;
+}
diff --git a/mdk-stage1/dietlibc/libugly/iconv_open.c b/mdk-stage1/dietlibc/libugly/iconv_open.c
new file mode 100644
index 000000000..eabab4273
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/iconv_open.c
@@ -0,0 +1,28 @@
+#include <string.h>
+#include <strings.h>
+#include "dietfeatures.h"
+#include <errno.h>
+#include <stdlib.h>
+#include "dieticonv.h"
+
+static enum charset parsecharset(const char* s) {
+ if (!strcasecmp(s,"UTF-8")) return UTF_8; else
+ if (!strcasecmp(s,"UCS-2") || !strcasecmp(s,"UCS2")) return UCS_2; else
+ if (!strcasecmp(s,"UCS-4") || !strcasecmp(s,"UCS4")) return UCS_4; else
+ if (!strcasecmp(s,"ISO-8859-1")) return ISO_8859_1; else
+ if (!strcasecmp(s,"US-ASCII")) return ISO_8859_1; else
+ return INVALID;
+}
+
+iconv_t iconv_open(const char* tocode, const char* fromcode) {
+ int f,t;
+
+ f=parsecharset(fromcode);
+ t=parsecharset(tocode);
+
+ if (f==INVALID || t==INVALID) {
+ errno=EINVAL;
+ return (iconv_t)(-1);
+ }
+ return (f|t<<16);
+}
diff --git a/mdk-stage1/dietlibc/libugly/isleap.c b/mdk-stage1/dietlibc/libugly/isleap.c
index dcfa1ced6..d83712792 100644
--- a/mdk-stage1/dietlibc/libugly/isleap.c
+++ b/mdk-stage1/dietlibc/libugly/isleap.c
@@ -1,3 +1,5 @@
+#include <time.h>
+
int __isleap(int year) {
/* every fourth year is a leap year except for century years that are
* not divisible by 400. */
diff --git a/mdk-stage1/dietlibc/libugly/localtime_r.c b/mdk-stage1/dietlibc/libugly/localtime_r.c
index d4bc073ce..5d420303c 100644
--- a/mdk-stage1/dietlibc/libugly/localtime_r.c
+++ b/mdk-stage1/dietlibc/libugly/localtime_r.c
@@ -3,8 +3,11 @@
#include <sys/time.h>
#ifdef WANT_TZFILE_PARSER
-extern void __maplocaltime();
+extern void __maplocaltime(void);
extern time_t __tzfile_map(time_t t, int *isdst);
+#else
+extern long int timezone;
+extern int daylight;
#endif
struct tm* localtime_r(const time_t* t, struct tm* r) {
@@ -15,7 +18,8 @@ struct tm* localtime_r(const time_t* t, struct tm* r) {
#else
struct timezone tz;
gettimeofday(0, &tz);
- tmp=*t-tz.tz_minuteswest*60L;
+ timezone=tz.tz_minuteswest*60L;
+ tmp=*t+timezone;
#endif
return gmtime_r(&tmp,r);
}
diff --git a/mdk-stage1/dietlibc/libugly/logging.c b/mdk-stage1/dietlibc/libugly/logging.c
index 69c2c2337..680a1f850 100644
--- a/mdk-stage1/dietlibc/libugly/logging.c
+++ b/mdk-stage1/dietlibc/libugly/logging.c
@@ -1,3 +1,4 @@
+#include <errno.h>
#include "dietfeatures.h"
#include <stdio.h>
@@ -5,7 +6,6 @@
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
-#include <asm/socket.h>
#include <fcntl.h>
#include <syslog.h>
#include <string.h>
@@ -14,9 +14,9 @@
#include <signal.h>
#define _PATH_CONSOLE "/dev/console"
-#define BUF_SIZE 512 /* messagebuffer size (>= 200) */
+#define BUF_SIZE 2048 /* messagebuffer size (>= 200) */
-#define MAX_LOGTAG 80
+#define MAX_LOGTAG 1000
/* those have to be global *sigh* */
static volatile int connected = 0; /* have done connect */
@@ -37,13 +37,15 @@ static void closelog_intern(void)
connected = 0;
}
-void closelog(void)
+void __libc_closelog(void);
+void __libc_closelog(void)
{
closelog_intern();
LogTag[0]=0;
LogType = SOCK_DGRAM;
}
+void closelog(void) __attribute__((weak,alias("__libc_closelog")));
static void openlog_intern(int option, int facility)
{
@@ -63,27 +65,15 @@ static void openlog_intern(int option, int facility)
}
}
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;
}
}
@@ -94,7 +84,8 @@ static void openlog_intern(int option, int facility)
}
/* has to be secured against multiple, simultanious call's in threaded environment */
-void openlog(const char *ident, int option, int facility)
+void __libc_openlog(const char *ident, int option, int facility);
+void __libc_openlog(const char *ident, int option, int facility)
{
if (ident) {
strncpy(LogTag,ident,MAX_LOGTAG);
@@ -102,6 +93,7 @@ void openlog(const char *ident, int option, int facility)
}
openlog_intern(option, facility);
}
+void openlog(const char *ident, int option, int facility) __attribute__((weak,alias("__libc_openlog")));
int setlogmask(int mask)
{
@@ -110,7 +102,8 @@ int setlogmask(int mask)
return old;
}
-void vsyslog(int priority, const char *format, va_list arg_ptr)
+void __libc_vsyslog(int priority, const char *format, va_list arg_ptr);
+void __libc_vsyslog(int priority, const char *format, va_list arg_ptr)
{
char buffer[BUF_SIZE];
char time_buf[20];
@@ -122,11 +115,7 @@ void vsyslog(int priority, const char *format, va_list arg_ptr)
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)) {
@@ -156,11 +145,7 @@ void vsyslog(int priority, const char *format, va_list arg_ptr)
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) {
@@ -201,6 +186,7 @@ void vsyslog(int priority, const char *format, va_list arg_ptr)
if (sigpipe == 0)
sigaction(SIGPIPE, &oldaction, (struct sigaction *) NULL);
}
+void vsyslog(int priority, const char *format, va_list arg_ptr) __attribute__((weak,alias("__libc_vsyslog")));
void syslog(int priority, const char *format, ...)
{
diff --git a/mdk-stage1/dietlibc/libugly/mktime.c b/mdk-stage1/dietlibc/libugly/mktime.c
index ee4dab6c1..348068e1d 100644
--- a/mdk-stage1/dietlibc/libugly/mktime.c
+++ b/mdk-stage1/dietlibc/libugly/mktime.c
@@ -1,21 +1,53 @@
#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;
+extern const short __spm [];
+
+time_t mktime ( register struct tm* const t )
+{
+ register time_t day;
+ register time_t i;
+
+ if ( t->tm_year < 70 )
+ return (time_t) -1;
+
+ day = t->tm_yday = __spm [t->tm_mon] + t->tm_mday-1 + ( __isleap (t->tm_year+1900) & (t->tm_mon > 1) );
+
+ for ( i = 70; i < t->tm_year; i++ )
+ day += 365 + __isleap (i+1900);
+
+ /* day is now the number of days since 'Jan 1 1970' */
+ i = 7;
+ t->tm_wday = (day + 4) % i; /* Sunday=0, Monday=1, ..., Saturday=6 */
+
+ i = 24;
+ day *= i;
+ i = 60;
+ return ((day + t->tm_hour) * i + t->tm_min) * i + t->tm_sec;
+}
+
+#if 0
+
+#include <math.h>
+
+main()
+{
+ int i, j, k;
+ static char *s[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+
+ for (i=70; i<200; i++)
+ for (j=0; j<12; j++)
+ for (k=1; k<=31; k++) {
+ struct tm t;
+ double x;
+ t.tm_year = i;
+ t.tm_mon = j;
+ t.tm_mday = k;
+ t.tm_hour = 0;
+ t.tm_min = 0;
+ t.tm_sec = 0;
+ x = mktime (&t);
+ printf ("%4d.%5.0f %2u.%02u.%04u %s\n", (int)floor(x/86400), x-86400.*(int)floor(x/86400), k, j+1, 1900+i, s[t.tm_wday] );
+ }
+
}
+#endif
diff --git a/mdk-stage1/dietlibc/libugly/netent.c b/mdk-stage1/dietlibc/libugly/netent.c
new file mode 100644
index 000000000..4710d0fe6
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/netent.c
@@ -0,0 +1,130 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <ctype.h>
+#include "dietfeatures.h"
+#include <netdb.h>
+#include <arpa/inet.h>
+
+static int netfd=-1;
+static char* netmap;
+static unsigned int netlen;
+
+static char* aliases[10];
+
+static char *cur;
+
+/* loopback 127.0.0.0 lo # comment */
+struct netent *getnetent(void) {
+ static struct netent ne;
+ char *last;
+ int aliasidx;
+ if (netfd<0) {
+ netfd=open(_PATH_NETWORKS,O_RDONLY);
+ if (netfd<0) return 0;
+ fcntl (netfd, F_SETFD, FD_CLOEXEC);
+ netlen=lseek(netfd,0,SEEK_END);
+ netmap=mmap(0,netlen,PROT_READ|PROT_WRITE,MAP_PRIVATE,netfd,0);
+ if ((long)netmap==(-1)) goto error;
+ cur=netmap;
+ }
+ last=netmap+netlen;
+again:
+ ne.n_name=0;
+ ne.n_aliases=aliases; aliases[0]=0;
+ ne.n_addrtype=AF_INET;
+ ne.n_net=0;
+ if (cur>=last) return 0;
+ if (*cur=='#' || *cur=='\n') goto parseerror;
+ /* first, the primary name */
+ if (!isalpha(*cur)) goto parseerror;
+ ne.n_name=cur;
+ ne.n_aliases=aliases;
+ while (cur<last && isalnum(*cur)) cur++;
+ if (cur>=last) return 0;
+ if (*cur=='\n') goto parseerror;
+ *cur=0; cur++;
+ /* second, the ip */
+ while (cur<last && isblank(*cur)) cur++;
+ {
+ const char *tmp=cur;
+ char save;
+ while (cur<last && (isdigit(*cur) || *cur=='.')) ++cur;
+ save=*cur; *cur=0;
+ if (inet_aton(tmp,(struct in_addr*)&ne.n_net)==0) goto parseerror;
+ *cur=save;
+ }
+ if (cur>=last) return 0;
+ /* 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 &ne;
+parseerror:
+ while (cur<last && *cur!='\n') cur++;
+ cur++;
+ goto again;
+error:
+ if (netmap!=(char*)-1) munmap(netmap,netlen);
+ if (netfd!=-1) close(netfd);
+ netmap=(char*)-1;
+ netfd=-1;
+ errno=ENOMEM;
+ return 0;
+}
+
+struct netent *getnetbyaddr(unsigned long net, int type) {
+ struct netent *s;
+ for (s=getnetent(); s; s=getnetent()) {
+ if (net==s->n_net && type==s->n_addrtype)
+ return s;
+ }
+ return 0;
+}
+
+void endnetent(void) {
+ if (netmap!=(char*)-1) munmap(netmap,netlen);
+ if (netfd!=-1) close(netfd);
+ netmap=(char*)-1;
+ netfd=-1;
+}
+
+void setnetent(int stayopen) {
+ (void)stayopen;
+ endnetent();
+}
+
+struct netent *getnetbyname(const char *name) {
+ struct netent *s;
+ setnetent(0);
+ for (s=getnetent(); s; s=getnetent()) {
+ 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(s->s_name,"ssh")) {
+ write(2,"ssh!\n",5);
+ }
+#endif
+ if (!strcmp(name,s->n_name))
+ return s;
+ tmp=s->n_aliases;
+ while (*tmp)
+ if (!strcmp(name,*tmp++)) return s;
+ }
+ return 0;
+}
+
diff --git a/mdk-stage1/dietlibc/libugly/openpty.c b/mdk-stage1/dietlibc/libugly/openpty.c
new file mode 100644
index 000000000..8d06f329c
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/openpty.c
@@ -0,0 +1,54 @@
+#include <unistd.h>
+#include <pty.h>
+#include <fcntl.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <string.h>
+
+extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase);
+
+int openpty(int *amaster, int *aslave, char *name, struct termios
+ *termp, struct winsize *winp) {
+ int fd;
+ char buf[20];
+#if 0
+ This is what glibc does:
+ open("/dev/ptmx", O_RDWR) = 4
+ statfs("/dev/pts", {f_type=0x1cd1, f_bsize=1024, f_blocks=0, f_bfree=0, f_files=0, f_ffree=0, f_namelen=255}) = 0
+ ioctl(4, TCGETS, {B38400 opost isig icanon echo ...}) = 0
+ ioctl(4, 0x80045430, [0]) = 0
+ stat("/dev/pts/0", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
+ statfs("/dev/pts/0", {f_type=0x1cd1, f_bsize=1024, f_blocks=0, f_bfree=0, f_files=0, f_ffree=0, f_namelen=255}) = 0
+ ioctl(4, 0x40045431, [0]) = 0
+ ioctl(4, TCGETS, {B38400 opost isig icanon echo ...}) = 0
+ ioctl(4, 0x80045430, [0]) = 0
+ stat("/dev/pts/0", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
+ open("/dev/pts/0", O_RDWR|O_NOCTTY) = 5
+#endif
+ if ((fd=open("/dev/ptmx",O_RDWR))<0) return -1;
+#if 0
+ if (ioctl(fd,TCGETS,&ts)<0) goto kaputt;
+#endif
+ {
+ int unlock=0;
+ while (ioctl(fd,TIOCSPTLCK, &unlock)<0) if (errno!=EINTR) goto kaputt;
+ }
+ {
+ int ptyno;
+ while (ioctl(fd,TIOCGPTN,&ptyno)<0) if (errno!=EINTR) goto kaputt;
+ strcpy(buf,"/dev/pts/");
+ __ltostr(buf+9,10,ptyno,10,0);
+ }
+ *aslave=open(buf,O_RDWR|O_NOCTTY);
+ if (*aslave<0) goto kaputt;
+ *amaster=fd;
+ if (name) strcpy(name,buf);
+ if (termp)
+ while (tcsetattr(*aslave,TCSAFLUSH,termp) && errno==EINTR);
+ if (winp) while (ioctl(*aslave, TIOCSWINSZ, winp) && errno==EINTR);
+ return 0;
+kaputt:
+ close(fd);
+ return -1;
+}
diff --git a/mdk-stage1/dietlibc/libugly/popen.c b/mdk-stage1/dietlibc/libugly/popen.c
index e0e441495..aa9a2cde0 100644
--- a/mdk-stage1/dietlibc/libugly/popen.c
+++ b/mdk-stage1/dietlibc/libugly/popen.c
@@ -1,32 +1,38 @@
#include "dietstdio.h"
#include <unistd.h>
+#include <fcntl.h>
+#include "binshstr.h"
extern char **environ;
FILE *popen(const char *command, const char *type) {
int pfd[2];
int fd0;
+ FILE* f;
pid_t pid;
+
if (pipe(pfd)<0) return 0;
fd0=(*type=='r');
- if ((pid=vfork())<0) {
+ if (!(f=fdopen(pfd[!fd0],type))) {
+ close(pfd[0]); /* malloc failed */
+ close(pfd[1]);
+ return 0;
+ }
+ if ((pid=fork())<0) {
close(pfd[0]);
close(pfd[1]);
return 0;
}
if (!pid) { /* child */
- char *argv[]={"sh","-c",0,0};
+ const 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);
+ argv[2]=command;
+ execve(__binsh,(char*const*)argv,environ);
+ _exit(127);
}
close(pfd[fd0]);
- {
- register FILE* f;
- if ((f=fdopen(pfd[!fd0],type)))
- f->popen_kludge=pid;
- return f;
- }
+ fcntl (pfd[!fd0], F_SETFD, FD_CLOEXEC);
+ f->popen_kludge=pid;
+ return f;
}
diff --git a/mdk-stage1/dietlibc/libugly/protoent_buf.c b/mdk-stage1/dietlibc/libugly/protoent_buf.c
new file mode 100644
index 000000000..0e303a5d4
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/protoent_buf.c
@@ -0,0 +1,5 @@
+#include <netdb.h>
+
+struct protoent __protoent_pw;
+char __protoent_buf[1000];
+
diff --git a/mdk-stage1/dietlibc/libugly/ptsname.c b/mdk-stage1/dietlibc/libugly/ptsname.c
new file mode 100644
index 000000000..a332faf6c
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/ptsname.c
@@ -0,0 +1,17 @@
+#define _XOPEN_SOURCE
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <stdlib.h>
+#include <string.h>
+
+# define MAX_FDS 4
+
+char *ptsname(int fd) {
+ static char buffer[9+MAX_FDS]; /* Ahh..great */
+ int pty;
+
+ strcpy(buffer,"/dev/pts/");
+ if ((ioctl(fd, TIOCGPTN, &pty)) == -1) return 0;
+ __ltostr(buffer+9, MAX_FDS, pty, 10, 0);
+ return buffer;
+}
diff --git a/mdk-stage1/dietlibc/libugly/putpwent.c b/mdk-stage1/dietlibc/libugly/putpwent.c
new file mode 100644
index 000000000..f192c5934
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/putpwent.c
@@ -0,0 +1,19 @@
+/* man, what a crook! */
+
+#include <pwd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <errno.h>
+#include "dietwarning.h"
+
+int putpwent(const struct passwd *p, FILE *stream) {
+ if (p && stream) {
+ fprintf(stream,"%s:%s:%d:%d:%s:%s:%s\n", p->pw_name, p->pw_passwd,
+ p->pw_uid, p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell);
+ return 0;
+ }
+ (*__errno_location())=EINVAL;
+ return -1;
+}
+
+link_warning("putpwent","putpwent is garbage, don't use!")
diff --git a/mdk-stage1/dietlibc/libugly/servent_buf.c b/mdk-stage1/dietlibc/libugly/servent_buf.c
new file mode 100644
index 000000000..b9e992adf
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/servent_buf.c
@@ -0,0 +1,5 @@
+#include <netdb.h>
+
+struct servent __servent_pw;
+char __servent_buf[1000];
+
diff --git a/mdk-stage1/dietlibc/libugly/setenv.c b/mdk-stage1/dietlibc/libugly/setenv.c
index bf47cdb79..c65910471 100644
--- a/mdk-stage1/dietlibc/libugly/setenv.c
+++ b/mdk-stage1/dietlibc/libugly/setenv.c
@@ -5,13 +5,15 @@
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);
+ {
+ char *c=malloc(strlen(name)+strlen(value)+3);
+ strcpy(c,name);
+ strcat(c,"=");
+ strcat(c,value);
+ return putenv(c);
+ }
}
diff --git a/mdk-stage1/dietlibc/libugly/strftime.c b/mdk-stage1/dietlibc/libugly/strftime.c
index b7e750ab1..365d0c84f 100644
--- a/mdk-stage1/dietlibc/libugly/strftime.c
+++ b/mdk-stage1/dietlibc/libugly/strftime.c
@@ -1,182 +1,118 @@
#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;
+#include "dietfeatures.h"
+
+static const char sweekdays [7] [4] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
+static const char weekdays [7] [10] = {
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
+};
+static const char smonths [12] [4] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+static const char* months [12] = {
+ "January", "February", "March", "April", smonths[5-1], "June",
+ "July", "August", "September", "October", "November", "December"
+};
+static const char ampm [4] [3] = {
+ "am", "pm",
+ "AM", "PM"
+};
+
+static int i2a ( char* dest,unsigned int x )
+{
+ int div = 10;
+ *dest++ = x/div + '0';
+ *dest++ = x%div + '0';
+ *dest++ = '\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;
+size_t strftime ( char* dst, size_t max, const char* format, const struct tm* tm )
+{
+ char* p = dst;
+ const char* src;
+ unsigned int no;
+ char buf [5];
+
+
+ for ( ; *format != '\0'; format++ ) {
+ if (*format == '%') {
+ if (*++format == '%') {
+ *p++ = '%';
+ }
+ else
+again:
+ switch (*format) {
+// case '%': *p++ = '%'; break; // reduce size of jump table
+ case 'n': *p++ = '\n'; break;
+ case 't': *p++ = '\t'; break;
+ case 'O': case 'E': ++format; goto again;
+ case 'c': src = "%b %a %d %k:%M:%S %Z %Y"; goto _strf;
+ case 'r': src = "%I:%M:%S %p"; goto _strf;
+ case 'R': src = "%H:%M"; goto _strf;
+ case 'x': src = "%b %a %d"; goto _strf;
+ case 'X': src = "%k:%M:%S"; goto _strf;
+ case 'D': src = "%m/%d/%y"; goto _strf;
+ case 'T': src = "%H:%M:%S";
+ _strf: p += strftime (p, (size_t)(dst+max-p), src, tm); break;
+ case 'a': src = sweekdays [tm->tm_wday]; goto _str;
+ case 'A': src = weekdays [tm->tm_wday]; goto _str;
+ case 'h':
+ case 'b': src = smonths [tm->tm_mon]; goto _str;
+ case 'B': src = months [tm->tm_mon]; goto _str;
+ case 'p': src = ampm [tm->tm_hour > 12 ? 3 : 2]; goto _str;
+ case 'P': src = ampm [tm->tm_hour > 12 ? 1 : 0]; goto _str;
+ case 'C': no = tm->tm_year/100 + 19; goto _no;
+ case 'd': no = tm->tm_mday; goto _no;
+ case 'e': no = tm->tm_mday; goto _nos;
+ case 'H': no = tm->tm_hour; goto _no;
+ case 'I': no = tm->tm_hour % 12; goto _no;
+ case 'j': no = tm->tm_yday; goto _no;
+ case 'k': no = tm->tm_hour; goto _nos;
+ case 'l': no = tm->tm_hour % 12; goto _nos;
+ case 'm': no = tm->tm_mon + 1; goto _no;
+ case 'M': no = tm->tm_min; goto _no;
+ case 'S': no = tm->tm_sec; goto _no;
+ case 'u': no = tm->tm_wday ? tm->tm_wday : 7; goto _no;
+ case 'w': no = tm->tm_wday; goto _no;
+ case 'U': no = (tm->tm_yday - tm->tm_wday + 7) / 7; goto _no;
+ case 'W': no = (tm->tm_yday - (tm->tm_wday - 1 + 7) % 7 + 7) / 7; goto _no;
+ case 'Z':
+#ifdef WANT_TZFILE_PARSER
+ tzset(); src = tzname[0];
+#else
+ src = "[unknown timezone]";
+#endif
+ goto _str;
+ case 'Y': i2a ( buf+0, (unsigned int)(tm->tm_year / 100 + 19) );
+ i2a ( buf+2, (unsigned int)(tm->tm_year % 100) );
+ src = buf;
+ goto _str;
+ case 'y': no = tm->tm_year % 100; goto _no;
+ _no: i2a ( buf, no ); /* append number 'no' */
+ src = buf;
+ goto _str;
+ _nos: i2a ( buf, no ); /* the same, but '0'->' ' */
+ if (buf[0] == '0')
+ buf[0] = ' ';
+ src = buf;
+ _str: while (*src && p < dst+max) /* append string */
+ *p++ = *src++;
+ break;
+ };
+ } else {
+ *p++ = *format;
+ }
+
+ if (p >= dst+max)
+ break;
}
- ++format;
- if (t>=s+max) break;
- continue;
- }
- *t=0; return t-s;
+
+ *p = '\0';
+ return p - dst;
}
-
-/*
- %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/strndup.c b/mdk-stage1/dietlibc/libugly/strndup.c
new file mode 100644
index 000000000..7f912d4c6
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/strndup.c
@@ -0,0 +1,10 @@
+#include <string.h>
+#include <stdlib.h>
+
+char *strndup(const char *s,size_t n) {
+ char *tmp=(char *)malloc(n+1);
+ if (!tmp) return 0;
+ strncpy(tmp,s,n);
+ tmp[n]=0;
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/libugly/strsignal.c b/mdk-stage1/dietlibc/libugly/strsignal.c
index 54314d2c7..d72777571 100644
--- a/mdk-stage1/dietlibc/libugly/strsignal.c
+++ b/mdk-stage1/dietlibc/libugly/strsignal.c
@@ -1,92 +1,10 @@
+#define _GNU_SOURCE
+#include <string.h>
#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";
+const char* strsignal(int sig) {
+ if (sig<=SIGRTMAX)
+ return sys_siglist[sig];
else
return "(unknown signal)";
}
diff --git a/mdk-stage1/dietlibc/libugly/system.c b/mdk-stage1/dietlibc/libugly/system.c
index b9eea20eb..714aad056 100644
--- a/mdk-stage1/dietlibc/libugly/system.c
+++ b/mdk-stage1/dietlibc/libugly/system.c
@@ -1,23 +1,19 @@
#include <signal.h>
-#include <asm/errno.h>
#include <errno.h>
#include <unistd.h>
+#include <sys/wait.h>
#include "dietwarning.h"
-
-#define SHELL_PATH "/bin/sh" /* Path of the shell. */
-#define SHELL_NAME "sh" /* Name to give it. */
+#include "dietfeatures.h"
+#include "binshstr.h"
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);
int __libc_system (const char *line)
{
struct sigaction sa, intr, quit;
+ sigset_t block,omask;
int save,pid,ret=-1;
if (line == 0) return __libc_system("exit 0") == 0;
@@ -29,38 +25,48 @@ int __libc_system (const char *line)
if (sigaction(SIGINT, &sa, &intr)<0) return -1;
if (sigaction(SIGQUIT, &sa, &quit)<0) {
save = errno;
+undo:
sigaction (SIGINT, &intr, (struct sigaction*)0);
- __set_errno (save);
+ errno=save;
return -1;
}
+ sigemptyset(&block);
+ sigaddset(&block,SIGCHLD);
+ if (sigprocmask(SIG_BLOCK,&block,&omask)<0) {
+ save=errno;
+ sigaction (SIGQUIT, &quit, (struct sigaction*)0);
+ goto undo;
+ }
- pid=__libc_fork();
+ pid=fork();
if (pid>0)
{ /* parent */
int n;
do
- n=__libc_waitpid(pid, &ret, 0);
+ n=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[0] = __sh;
nargs[1] = "-c";
nargs[2] = line;
nargs[3] = 0;
sigaction(SIGINT, &intr, (struct sigaction*)0);
sigaction(SIGQUIT, &quit, (struct sigaction*)0);
+ sigprocmask(SIG_SETMASK,&omask,0);
- execve(SHELL_PATH,(char *const *)nargs, environ);
+ execve(__binsh,(char *const *)nargs, environ);
_exit(127);
}
save = errno;
sigaction (SIGINT, &intr, (struct sigaction *)0);
sigaction (SIGQUIT, &quit, (struct sigaction *)0);
- __set_errno(save);
+ sigprocmask(SIG_SETMASK,&omask,0);
+ errno=save;
return ret;
}
diff --git a/mdk-stage1/dietlibc/libugly/time_table_spd.c b/mdk-stage1/dietlibc/libugly/time_table_spd.c
index bfe1cf86d..6850d76c4 100644
--- a/mdk-stage1/dietlibc/libugly/time_table_spd.c
+++ b/mdk-stage1/dietlibc/libugly/time_table_spd.c
@@ -1,6 +1,7 @@
+#include <time.h>
-/* seconds per month -- nonleap! */
-const unsigned int __spm[12] =
+/* days per month -- nonleap! */
+const short __spm[12] =
{ 0,
(31),
(31+28),
diff --git a/mdk-stage1/dietlibc/libugly/timezone.c b/mdk-stage1/dietlibc/libugly/timezone.c
new file mode 100644
index 000000000..e8a94a906
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/timezone.c
@@ -0,0 +1,3 @@
+
+long int timezone;
+int daylight;
diff --git a/mdk-stage1/dietlibc/libugly/tzfile.c b/mdk-stage1/dietlibc/libugly/tzfile.c
index 5702d4bea..e0e8f7846 100644
--- a/mdk-stage1/dietlibc/libugly/tzfile.c
+++ b/mdk-stage1/dietlibc/libugly/tzfile.c
@@ -3,28 +3,30 @@
#include <fcntl.h>
#include <sys/mman.h>
#include <netinet/in.h>
+#include <time.h>
-#include <stdio.h>
+/* #include <stdio.h> */
+
+char* tzname[2]={"GMT","GMT"};
#ifdef WANT_TZFILE_PARSER
static char *tzfile=0;
static int tzlen=-1;
-void __maplocaltime() {
+void __maplocaltime(void);
+void __maplocaltime(void) {
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;
+ if ((tzfile=mmap(0,len,PROT_READ,MAP_PRIVATE,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) +
@@ -32,6 +34,7 @@ static unsigned long __myntohl(const unsigned char* c) {
((unsigned long)c[3]);
}
+time_t __tzfile_map(time_t t, int *isdst);
time_t __tzfile_map(time_t t, int *isdst) {
/* "TZif" plus 16 reserved bytes. */
char *tmp;
@@ -64,23 +67,41 @@ time_t __tzfile_map(time_t t, int *isdst) {
printf("%s(%lu,%d,%d)",i?", ":"",ntohl(*(int*)tmp),tmp[4],tmp[5]); tmp+=6;
}
printf("\n");
+ for (i=0; i<tzh_charcnt; ++i) {
+ printf("%s\"%s\"",i?", ":"",tmp);
+ tmp+=strlen(tmp);
+ }
+ printf("\n");
#endif
tmp=tzfile+20+6*4;
- for (i=0; i<tzh_timecnt; ++i)
+ daylight=(tzh_timecnt>0);
+ for (i=0; i<tzh_timecnt; ++i) {
if ((time_t)__myntohl(tmp+i*4) >= t) {
+ char* tz=tmp;
/* printf("match at %d\n",i); */
tmp+=tzh_timecnt*4;
i=tmp[i-1];
/* printf("using index %d\n",i); */
tmp+=tzh_timecnt;
+ tz+=tzh_timecnt*5+tzh_leapcnt*4+tzh_typecnt*6;
tmp+=i*6;
/* printf("(%lu,%d,%d)\n",ntohl(*(int*)tmp),tmp[4],tmp[5]); */
*isdst=tmp[4];
- return t+__myntohl(tmp);
+ tzname[0]=tz+tmp[5];
+ timezone=-(__myntohl(tmp));
+ return t-timezone;
}
+ }
return t;
}
+
+void tzset(void) {
+ int isdst;
+ __maplocaltime();
+ __tzfile_map(time(0),&isdst);
+}
+
#else
-void tzset(void) __attribute__((weak,alias("return0")));
+void tzset(void) __attribute__((weak,alias("__nop")));
#endif
diff --git a/mdk-stage1/dietlibc/libugly/unlockpt.c b/mdk-stage1/dietlibc/libugly/unlockpt.c
new file mode 100644
index 000000000..e0246ed8e
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/unlockpt.c
@@ -0,0 +1,10 @@
+#define _XOPEN_SOURCE
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+int unlockpt (int fd) {
+ int foo;
+ /* hehe, that one is easy */
+ return (ioctl (fd, TIOCSPTLCK, &foo));
+}
diff --git a/mdk-stage1/dietlibc/libugly/utent.c b/mdk-stage1/dietlibc/libugly/utent.c
new file mode 100644
index 000000000..d8d5d1ba7
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/utent.c
@@ -0,0 +1,103 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <utmp.h>
+
+static const char *utmp_file_name = _PATH_UTMP;
+static int fd = -1;
+
+static int lock_record(int type) {
+ struct flock fl;
+ fl.l_whence = SEEK_CUR;
+ fl.l_start = 0;
+ fl.l_len = sizeof(struct utmp);
+ fl.l_pid = 0;
+ fl.l_type = type;
+ return fcntl(fd, F_SETLKW, &fl);
+}
+
+static int unlock_record() {
+ struct flock fl;
+ fl.l_whence = SEEK_CUR;
+ fl.l_start = -sizeof(struct utmp);
+ fl.l_len = sizeof(struct utmp);
+ fl.l_pid = 0;
+ fl.l_type = F_UNLCK;
+ return fcntl(fd, F_SETLK, &fl);
+}
+
+void utmpname(const char *file) {
+ if (file)
+ utmp_file_name = file;
+ else
+ utmp_file_name = _PATH_UTMP;
+}
+
+void setutent() {
+ if (fd<0) fd = open(utmp_file_name,O_RDWR);
+ if (fd<0) fd = open(utmp_file_name,O_RDONLY);
+ fcntl (fd, F_SETFD, FD_CLOEXEC);
+ lseek(fd,0,SEEK_SET);
+}
+
+void endutent() {
+ if (fd<0) return;
+ close(fd); fd=-1;
+}
+
+struct utmp *getutent(void) {
+ static struct utmp getutent_tmp;
+ int ret;
+
+ if (fd<0) {
+ setutent();
+ if (fd<0) return 0;
+ }
+ if (lock_record(F_RDLCK)) return 0;
+ ret=read(fd, &getutent_tmp, sizeof(struct utmp));
+ unlock_record();
+ if (ret<1) return 0;
+ return &getutent_tmp;
+}
+
+struct utmp *getutid(struct utmp *ut) {
+ struct utmp *tmp;
+
+ while ((tmp = getutent())) {
+ if (ut->ut_type && (ut->ut_type <= OLD_TIME)) {
+ if (ut->ut_type == tmp->ut_type) break;
+ }
+ if ((ut->ut_type >= INIT_PROCESS) && (ut->ut_type <= DEAD_PROCESS)) {
+ if (!strncmp(ut->ut_id,tmp->ut_id,4)) break;
+ }
+ }
+ return tmp;
+}
+
+struct utmp *getutline(struct utmp *ut) {
+ struct utmp *tmp;
+
+ while ((tmp = getutent())) {
+ if ((tmp->ut_type == USER_PROCESS) || (tmp->ut_type == LOGIN_PROCESS)) {
+ if (!strncmp(ut->ut_line,tmp->ut_line,UT_LINESIZE)) break;
+ }
+ }
+ return tmp;
+}
+
+void pututline(struct utmp *ut) {
+ struct utmp *tmp;
+
+ if ((tmp = getutid(ut))) {
+ lseek(fd, - (off_t)sizeof(struct utmp), SEEK_CUR);
+ if (lock_record(F_WRLCK)) return;
+ write(fd, ut, sizeof(struct utmp));
+ }
+ else {
+ lseek(fd, 0, SEEK_END);
+ if (lock_record(F_WRLCK)) return;
+ write(fd, ut, (off_t)sizeof(struct utmp));
+ }
+ unlock_record();
+}
+
diff --git a/mdk-stage1/dietlibc/libugly/wtent.c b/mdk-stage1/dietlibc/libugly/wtent.c
new file mode 100644
index 000000000..1ca7c3202
--- /dev/null
+++ b/mdk-stage1/dietlibc/libugly/wtent.c
@@ -0,0 +1,30 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <utmp.h>
+
+void updwtmp(const char *wtmp_file, const struct utmp *ut) {
+ int fd = open(wtmp_file, O_WRONLY|O_APPEND);
+ if (fd<0) return;
+ fcntl (fd, F_SETFD, FD_CLOEXEC);
+ write(fd, ut, sizeof(struct utmp));
+ close(fd);
+}
+
+void logwtmp(const char *line, const char *name, const char *host) {
+ struct utmp ut;
+
+ memset(&ut, 0, sizeof(struct utmp));
+
+ ut.ut_pid = getpid ();
+ ut.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
+
+ memccpy (ut.ut_line, line, 0, sizeof ut.ut_line);
+ memccpy (ut.ut_name, name, 0, sizeof ut.ut_name);
+ memccpy (ut.ut_host, host, 0, sizeof ut.ut_host);
+
+ gettimeofday (&ut.ut_tv, NULL);
+
+ updwtmp (_PATH_WTMP, &ut);
+}
+
diff --git a/mdk-stage1/dietlibc/linuxnet.h b/mdk-stage1/dietlibc/linuxnet.h
new file mode 100644
index 000000000..8e2204701
--- /dev/null
+++ b/mdk-stage1/dietlibc/linuxnet.h
@@ -0,0 +1,19 @@
+
+#define SYS_SOCKET 1 /* sys_socket(2) */
+#define SYS_BIND 2 /* sys_bind(2) */
+#define SYS_CONNECT 3 /* sys_connect(2) */
+#define SYS_LISTEN 4 /* sys_listen(2) */
+#define SYS_ACCEPT 5 /* sys_accept(2) */
+#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */
+#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */
+#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */
+#define SYS_SEND 9 /* sys_send(2) */
+#define SYS_RECV 10 /* sys_recv(2) */
+#define SYS_SENDTO 11 /* sys_sendto(2) */
+#define SYS_RECVFROM 12 /* sys_recvfrom(2) */
+#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */
+#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
+#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
+#define SYS_SENDMSG 16 /* sys_sendmsg(2) */
+#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
+
diff --git a/mdk-stage1/dietlibc/parselib.h b/mdk-stage1/dietlibc/parselib.h
new file mode 100644
index 000000000..831d9da2b
--- /dev/null
+++ b/mdk-stage1/dietlibc/parselib.h
@@ -0,0 +1,23 @@
+/* parse lib: parse mmapped text with \n terminated lines */
+
+/* a memory buffer. */
+struct state {
+ const unsigned char* buffirst;/* pointer to the buffer */
+ size_t buflen; /* length of the buffer */
+ size_t cur; /* already parsed bytes */
+};
+
+/* open and mmap file, fill in struct state */
+void __prepare_parse(const char* filename,struct state* s);
+/* unmap file */
+void __end_parse(struct state* s);
+
+/* return the length of the matching string, 0 on error */
+/* match while pred returns nonzero */
+size_t __parse(struct state* s,int (*pred)(int ch));
+
+size_t __parse_ws(struct state* s); /* skip ' ' or '\t', break at '\n' or '#' */
+size_t __parse_nws(struct state* s); /* skip non-whitespace, break at '\n' or '#' */
+size_t __parse_1(struct state* s,char c); /* skip to c */
+
+size_t scan_ulong(const char* s,unsigned long* l);
diff --git a/mdk-stage1/dietlibc/ppc/__testandset.S b/mdk-stage1/dietlibc/ppc/__testandset.S
index a6063fbb2..146982337 100644
--- a/mdk-stage1/dietlibc/ppc/__testandset.S
+++ b/mdk-stage1/dietlibc/ppc/__testandset.S
@@ -2,10 +2,11 @@
.type __testandset,@function
.align 2
__testandset:
- lwarx 5,0,3
- add 0,4,5
- stwcx 0,0,3
- bne __testandset
+1: lwarx 5,0,3
+ li 0,1
+ stwcx. 0,0,3
+ bne- 1b
+ mr 3,5
blr
.size __testandset,.-__testandset
diff --git a/mdk-stage1/dietlibc/ppc/clone.S b/mdk-stage1/dietlibc/ppc/clone.S
new file mode 100644
index 000000000..98f6bd4e8
--- /dev/null
+++ b/mdk-stage1/dietlibc/ppc/clone.S
@@ -0,0 +1,48 @@
+#include <dietfeatures.h>
+#include "syscalls.h"
+#include <errno.h>
+
+.text
+.weak clone
+clone:
+.global __clone
+__clone:
+ cmpwi 4,0 /* check have non null child_stack pointer */
+ cmpwi cr1, 3,0 /* check have non null thread_funcion */
+ cror eq,4*cr1+eq,eq /* now if eq is set one is or both are zero */
+ beq .Lclone_error
+
+ stwu 1,-32(1) /* alloc some space on the stack */
+ stmw 29, 16(1) /* save r29,r30,r31 on stack */
+
+ rlwinm 4,4,0,0,27 /* mask out lower 4 bits */
+
+ /* move parameter to positions clone wants them */
+ mr 29,3 /* r29 = r3 fn */
+ mr 30,4 /* r30 = r4 stack */
+ mr 31,6 /* r31 = r6 arg */
+ mr 3, 5 /* r3 = r5 flags */
+
+ li 0, __NR_clone /* load syscall nr. */
+ sc
+
+ cmpwi cr1,3,0 /* compare return of syscall with 0 */
+ crandc 4*cr1+eq,4*cr1+eq,so
+ bne .Lclone_parent /* return was non zero -> .Lclone_parent */
+
+ /* we are the cloned process */
+ mr 1, 30 /* set stack pointer */
+ mtctr 29 /* set count register to fn ? */
+ mr 3, 31 /* set argument */
+ bctrl /* branch trough count register and link */
+ b _exit /* exit thread */
+
+.Lclone_parent:
+ lmw 29,16(1) /* restore saved registers */
+ addi 1, 1,32 /* free stack */
+ bnslr+ /* had cloned a thread so return to parent */
+ b error_unified_syscall
+
+.Lclone_error:
+ li 3, EINVAL
+ b error_unified_syscall
diff --git a/mdk-stage1/dietlibc/ppc/mmap.c b/mdk-stage1/dietlibc/ppc/mmap.c
index 25d2926b2..d03e87089 100644
--- a/mdk-stage1/dietlibc/ppc/mmap.c
+++ b/mdk-stage1/dietlibc/ppc/mmap.c
@@ -1,5 +1,7 @@
-#include <linux/types.h>
-#include <linux/unistd.h>
+#include "dietfeatures.h"
+#include <sys/types.h>
+#include <errno.h>
+#include "syscalls.h"
int mmap(void*start,size_t length,int prot,int flags,int fd,off_t offset) {
unsigned long __sc_ret, __sc_err;
@@ -29,9 +31,10 @@ int mmap(void*start,size_t length,int prot,int flags,int fd,off_t offset) {
"r" (__sc_6),
"r" (__sc_7),
"r" (__sc_8)
- : __syscall_clobbers);
+ : "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");
__sc_ret = __sc_3;
__sc_err = __sc_0;
}
- __syscall_return (int);
+ return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0),
+ (int) __sc_ret;
}
diff --git a/mdk-stage1/dietlibc/ppc/start.S b/mdk-stage1/dietlibc/ppc/start.S
index c7afeecd2..7b2aed7fb 100644
--- a/mdk-stage1/dietlibc/ppc/start.S
+++ b/mdk-stage1/dietlibc/ppc/start.S
@@ -1,21 +1,17 @@
-#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
+ 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)
+ clrrwi 1,1,4
+ li 0,0
+ stwu 1,-16(1)
+ mtlr 0
+ stw 0,0(1)
- /* r9 enthält den initialen Stackpointer.
+ /* r9 contains the initial stack pointer
argc = (r9)
argv = (r9+4)
envp = argv+(argc+1)*4 */
@@ -27,18 +23,20 @@ _start:
slwi 5,5,2 /* (argc+1)*4 */
add 5,5,4 /* argv+(argc+1)*4 */
- lis 6,environ@ha
- stw 5,environ@l(6)
+ lis 14,environ@ha
+ stw 5,environ@l(14)
+#ifdef WANT_DYNAMIC
+ mr 6,7
+ bl _dyn_start
+#else
bl main
+#endif
b exit
.size _start,.-_start
/* Define a symbol for the first piece of initialized data. */
- .section ".data"
+ .section ".data"
__data_start:
-
-#endif
-
diff --git a/mdk-stage1/dietlibc/ppc/syscalls.h b/mdk-stage1/dietlibc/ppc/syscalls.h
new file mode 100644
index 000000000..5e8707357
--- /dev/null
+++ b/mdk-stage1/dietlibc/ppc/syscalls.h
@@ -0,0 +1,259 @@
+
+#define __NR_exit 1
+#define __NR_fork 2
+#define __NR_read 3
+#define __NR_write 4
+#define __NR_open 5
+#define __NR_close 6
+#define __NR_waitpid 7
+#define __NR_creat 8
+#define __NR_link 9
+#define __NR_unlink 10
+#define __NR_execve 11
+#define __NR_chdir 12
+#define __NR_time 13
+#define __NR_mknod 14
+#define __NR_chmod 15
+#define __NR_lchown 16
+#define __NR_break 17
+#define __NR_oldstat 18
+#define __NR_lseek 19
+#define __NR_getpid 20
+#define __NR_mount 21
+#define __NR_umount 22
+#define __NR_setuid 23
+#define __NR_getuid 24
+#define __NR_stime 25
+#define __NR_ptrace 26
+#define __NR_alarm 27
+#define __NR_oldfstat 28
+#define __NR_pause 29
+#define __NR_utime 30
+#define __NR_stty 31
+#define __NR_gtty 32
+#define __NR_access 33
+#define __NR_nice 34
+#define __NR_ftime 35
+#define __NR_sync 36
+#define __NR_kill 37
+#define __NR_rename 38
+#define __NR_mkdir 39
+#define __NR_rmdir 40
+#define __NR_dup 41
+#define __NR_pipe 42
+#define __NR_times 43
+#define __NR_prof 44
+#define __NR_brk 45
+#define __NR_setgid 46
+#define __NR_getgid 47
+#define __NR_signal 48
+#define __NR_geteuid 49
+#define __NR_getegid 50
+#define __NR_acct 51
+#define __NR_umount2 52
+#define __NR_lock 53
+#define __NR_ioctl 54
+#define __NR_fcntl 55
+#define __NR_mpx 56
+#define __NR_setpgid 57
+#define __NR_ulimit 58
+#define __NR_oldolduname 59
+#define __NR_umask 60
+#define __NR_chroot 61
+#define __NR_ustat 62
+#define __NR_dup2 63
+#define __NR_getppid 64
+#define __NR_getpgrp 65
+#define __NR_setsid 66
+#define __NR_sigaction 67
+#define __NR_sgetmask 68
+#define __NR_ssetmask 69
+#define __NR_setreuid 70
+#define __NR_setregid 71
+#define __NR_sigsuspend 72
+#define __NR_sigpending 73
+#define __NR_sethostname 74
+#define __NR_setrlimit 75
+#define __NR_getrlimit 76
+#define __NR_getrusage 77
+#define __NR_gettimeofday 78
+#define __NR_settimeofday 79
+#define __NR_getgroups 80
+#define __NR_setgroups 81
+#define __NR_select 82
+#define __NR_symlink 83
+#define __NR_oldlstat 84
+#define __NR_readlink 85
+#define __NR_uselib 86
+#define __NR_swapon 87
+#define __NR_reboot 88
+#define __NR_readdir 89
+#define __NR_mmap 90
+#define __NR_munmap 91
+#define __NR_truncate 92
+#define __NR_ftruncate 93
+#define __NR_fchmod 94
+#define __NR_fchown 95
+#define __NR_getpriority 96
+#define __NR_setpriority 97
+#define __NR_profil 98
+#define __NR_statfs 99
+#define __NR_fstatfs 100
+#define __NR_ioperm 101
+#define __NR_socketcall 102
+#define __NR_syslog 103
+#define __NR_setitimer 104
+#define __NR_getitimer 105
+#define __NR_stat 106
+#define __NR_lstat 107
+#define __NR_fstat 108
+#define __NR_olduname 109
+#define __NR_iopl 110
+#define __NR_vhangup 111
+#define __NR_idle 112
+#define __NR_vm86 113
+#define __NR_wait4 114
+#define __NR_swapoff 115
+#define __NR_sysinfo 116
+#define __NR_ipc 117
+#define __NR_fsync 118
+#define __NR_sigreturn 119
+#define __NR_clone 120
+#define __NR_setdomainname 121
+#define __NR_uname 122
+#define __NR_modify_ldt 123
+#define __NR_adjtimex 124
+#define __NR_mprotect 125
+#define __NR_sigprocmask 126
+#define __NR_create_module 127
+#define __NR_init_module 128
+#define __NR_delete_module 129
+#define __NR_get_kernel_syms 130
+#define __NR_quotactl 131
+#define __NR_getpgid 132
+#define __NR_fchdir 133
+#define __NR_bdflush 134
+#define __NR_sysfs 135
+#define __NR_personality 136
+#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
+#define __NR_setfsuid 138
+#define __NR_setfsgid 139
+#define __NR__llseek 140
+#define __NR_getdents 141
+#define __NR__newselect 142
+#define __NR_flock 143
+#define __NR_msync 144
+#define __NR_readv 145
+#define __NR_writev 146
+#define __NR_getsid 147
+#define __NR_fdatasync 148
+#define __NR__sysctl 149
+#define __NR_mlock 150
+#define __NR_munlock 151
+#define __NR_mlockall 152
+#define __NR_munlockall 153
+#define __NR_sched_setparam 154
+#define __NR_sched_getparam 155
+#define __NR_sched_setscheduler 156
+#define __NR_sched_getscheduler 157
+#define __NR_sched_yield 158
+#define __NR_sched_get_priority_max 159
+#define __NR_sched_get_priority_min 160
+#define __NR_sched_rr_get_interval 161
+#define __NR_nanosleep 162
+#define __NR_mremap 163
+#define __NR_setresuid 164
+#define __NR_getresuid 165
+#define __NR_query_module 166
+#define __NR_poll 167
+#define __NR_nfsservctl 168
+#define __NR_setresgid 169
+#define __NR_getresgid 170
+#define __NR_prctl 171
+#define __NR_rt_sigreturn 172
+#define __NR_rt_sigaction 173
+#define __NR_rt_sigprocmask 174
+#define __NR_rt_sigpending 175
+#define __NR_rt_sigtimedwait 176
+#define __NR_rt_sigqueueinfo 177
+#define __NR_rt_sigsuspend 178
+#define __NR_pread 179
+#define __NR_pwrite 180
+#define __NR_chown 181
+#define __NR_getcwd 182
+#define __NR_capget 183
+#define __NR_capset 184
+#define __NR_sigaltstack 185
+#define __NR_sendfile 186
+#define __NR_getpmsg 187 /* some people actually want streams */
+#define __NR_putpmsg 188 /* some people actually want streams */
+#define __NR_vfork 189
+#define __NR_ugetrlimit 190 /* SuS compliant getrlimit */
+#define __NR_mmap2 192
+#define __NR_truncate64 193
+#define __NR_ftruncate64 194
+#define __NR_stat64 195
+#define __NR_lstat64 196
+#define __NR_fstat64 197
+#define __NR_pciconfig_read 198
+#define __NR_pciconfig_write 199
+#define __NR_pciconfig_iobase 200
+#define __NR_multiplexer 201
+#define __NR_getdents64 202
+#define __NR_pivot_root 203
+#define __NR_fcntl64 204
+#define __NR_madvise 205
+#define __NR_mincore 206
+#define __NR_gettid 207
+#define __NR_tkill 208
+#define __NR_setxattr 209
+#define __NR_lsetxattr 210
+#define __NR_fsetxattr 211
+#define __NR_getxattr 212
+#define __NR_lgetxattr 213
+#define __NR_fgetxattr 214
+#define __NR_listxattr 215
+#define __NR_llistxattr 216
+#define __NR_flistxattr 217
+#define __NR_removexattr 218
+#define __NR_lremovexattr 219
+#define __NR_fremovexattr 220
+#define __NR_futex 221
+#define __NR_sched_setaffinity 222
+#define __NR_sched_getaffinity 223
+#define __NR_security 224
+#define __NR_tuxcall 225
+#define __NR_sendfile64 226
+#define __NR_io_setup 227
+#define __NR_io_destroy 228
+#define __NR_io_getevents 229
+#define __NR_io_submit 230
+#define __NR_io_cancel 231
+#define __NR_alloc_hugepages 232
+#define __NR_free_hugepages 233
+#define __NR_exit_group 234
+#define __NR_lookup_dcookie 235
+#define __NR_sys_epoll_create 236
+#define __NR_sys_epoll_ctl 237
+#define __NR_sys_epoll_wait 238
+#define __NR_remap_file_pages 239
+
+#define syscall_weak(name,wsym,sym) \
+.text; \
+.type wsym,@function; \
+.weak wsym; \
+wsym: ; \
+.type sym,@function; \
+.global sym; \
+sym: \
+ li 0,__NR_##name; \
+ b __unified_syscall
+
+#define syscall(name,sym) \
+.text; \
+.type sym,@function; \
+.global sym; \
+sym: \
+ li 0,__NR_##name; \
+ b __unified_syscall
+
diff --git a/mdk-stage1/dietlibc/ppc/unified.S b/mdk-stage1/dietlibc/ppc/unified.S
index d2b419f0b..eb136a96b 100644
--- a/mdk-stage1/dietlibc/ppc/unified.S
+++ b/mdk-stage1/dietlibc/ppc/unified.S
@@ -1,21 +1,40 @@
#include <dietfeatures.h>
+#include "syscalls.h"
.text
+.type exit,@function
+.weak exit
+exit:
+.type _exit,@function
+.global _exit
+_exit:
+ li 0,__NR_exit
.global __unified_syscall
__unified_syscall:
sc
- mfcr 0
- andis. 9,0,4096
- mr 0,3
- beq .L1
-#ifdef WANT_THREAD_SAVE
- bl __set_errno
+ bnslr+
+
+.global error_unified_syscall
+error_unified_syscall:
+#ifdef WANT_THREAD_SAFE
+ stwu 1,-16(1)
+ mflr 0
+ stw 0,20(1)
+ stw 3,12(1)
+ bl __errno_location
+ lwz 0,12(1)
+ stw 0,0(3)
+ lwz 0,20(1)
+ mtlr 0
+ addi 1,1,16
#else
lis 9,errno@ha
stw 3,errno@l(9)
#endif
- li 0,-1
-.L1:
- mr 3,0
+ li 3,-1
+
+/* here we go and "reuse" the return for weak-void functions */
+#include "dietuglyweaks.h"
+
blr
diff --git a/mdk-stage1/dietlibc/profiling/PORTING b/mdk-stage1/dietlibc/profiling/PORTING
new file mode 100644
index 000000000..c3fc5eba7
--- /dev/null
+++ b/mdk-stage1/dietlibc/profiling/PORTING
@@ -0,0 +1,25 @@
+ Porting to other platforms
+
+ ... is easy. Just create an mcount.S in the $ARCH
+ directory (eg. dietlibc/i386) which includes a
+ function (called "mcount") that:
+
+ 1.) saves ALL registers that are freely usable
+ and which might be used by __mcount().
+ 2.) loads the instruction pointer (PC) from the
+ function that called mcount, and the function
+ which called the function, that called mcount
+ into the first two argument registers (or push
+ them on the stack - depending on the processor-
+ architecture).
+ 3.) call __mcount.
+ 4.) restore the registers saved in 1)
+
+ Then You need a macro called PC in <asm/sigcontext.h>
+ which extracts the (instruction pointer / program
+ counter) from a sigcontext structure (eg. on i386 this
+ would be ctx.eip).
+
+ $ARCH/start.S must also be modified to call monitor
+ with the offset of .text and _etext as parameters.
+
diff --git a/mdk-stage1/dietlibc/profiling/README b/mdk-stage1/dietlibc/profiling/README
new file mode 100644
index 000000000..0a0293073
--- /dev/null
+++ b/mdk-stage1/dietlibc/profiling/README
@@ -0,0 +1,37 @@
+
+ Notes on profiling support for dietlibc
+
+ 1.) A big problem when doing profiling on statically linked
+ programs, is that the internal profiling functions (mcount
+ and friends) will be included in the call graph although
+ they would not if the program would have been dynamically
+ linked. This is because every symbol between .text and
+ _etext is included in the call-graph. If a program is
+ dynamically linked, then mcount and friends are not between
+ .text and _etext, so they are not included. A workaround
+ for this, would be to put mcount, __mcount, monitor and
+ profiler into another section (eg. ".profile"), but this
+ creates some strange problems, I'm currently not aware of.
+ If you want to debug this: Putting a function into a specific
+ section works like this (with gcc):
+
+ void foo (int bar) __attribute__ ((section(".foobar")))
+
+ 2.) _start may randomly be found in the callgraph. I don't
+ know why. May be a bug in gprof.
+
+ 3.) The profiling is a complete rewrite, though I looked at
+ the glibc Version for inspiration. Please note that this
+ version might not be as portable as the glibc version but
+ its much smaller (although this is not a really important
+ argument, as profiled binaries seldom get shipped) and
+ hopefully easier to understand.
+
+ 4.) all objects that should be profiled mustn't be compiled
+ with -fomit-frame-pointer (as with glibc). Add
+ -fno-fomit-frame-pointer to $CFLAGS if you're encountering
+ weird problems.
+
+ 5.) There is currently no basic-block statistic support.
+
+Please send comments and bug reports to: tom@rhadamanthys.org
diff --git a/mdk-stage1/dietlibc/profiling/__mcount.c b/mdk-stage1/dietlibc/profiling/__mcount.c
new file mode 100644
index 000000000..b1955f370
--- /dev/null
+++ b/mdk-stage1/dietlibc/profiling/__mcount.c
@@ -0,0 +1,24 @@
+#include <unistd.h>
+#include <sys/gmon.h>
+
+extern struct monparam mparam;
+
+void __mcount (unsigned long, unsigned long) PROF_SECTION;
+
+void
+__mcount (unsigned long frompc, unsigned long selfpc)
+{
+ struct rawarc *arc = mparam.arcs, thisarc;
+ unsigned long num;
+ /* If arc already exists, increment count */
+ for (num = 0; num < mparam.arcnum; num++)
+ if (arc[num].raw_frompc == frompc && arc[num].raw_selfpc == selfpc) {
+ arc[num].raw_count++;
+ return;
+ }
+ if (selfpc < mparam.lowpc || selfpc > mparam.highpc) return;
+ thisarc.raw_frompc = frompc;
+ thisarc.raw_selfpc = selfpc;
+ thisarc.raw_count = 1;
+ arc[mparam.arcnum++] = thisarc;
+}
diff --git a/mdk-stage1/dietlibc/profiling/monitor.c b/mdk-stage1/dietlibc/profiling/monitor.c
new file mode 100644
index 000000000..cc06e3465
--- /dev/null
+++ b/mdk-stage1/dietlibc/profiling/monitor.c
@@ -0,0 +1,93 @@
+/**************************************************************
+ Copyright (C) 2001, 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and modify
+ it under the terms of the GNU General Public License.
+
+ This file is part of the profiling support for dietlibc
+
+ monitor(3) interface
+
+ *************************************************************/
+#include <sys/uio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/gmon.h>
+
+typedef unsigned short u_short;
+
+struct monparam mparam;
+
+void monitor (unsigned long, unsigned long) PROF_SECTION;
+void _stop_monitor (void) PROF_SECTION;
+
+/*
+ monitor is called by _start, to start profiling
+ lowpc -> lowest valid program counter (normally .text)
+ highpc -> highest valid program counter (normally _etext)
+*/
+void
+monitor (unsigned long lowpc, unsigned long highpc)
+{
+ mparam.highpc = highpc;
+ mparam.lowpc = lowpc;
+ mparam.kcountsize = (mparam.textsize = highpc-lowpc) << 1;
+ mparam.kcount = (u_short *) malloc (mparam.kcountsize);
+ mparam.arcs = (struct rawarc *) malloc (MAXARCS*sizeof (struct rawarc));
+ if (!mparam.kcount || !mparam.arcs)
+ exit (42);
+ mparam.arcnum = 0;
+ /* start profiling */
+ profil (mparam.kcount, highpc-lowpc, lowpc, 10000);
+}
+
+/*
+ write_gmon - write all data collected by the helper routines
+ to gmon.out
+*/
+static void
+write_gmon (void)
+{
+ struct gmon_hdr ghdr = { "gmon", 1, "" };
+ int fd = open ("gmon.out", O_CREAT | O_RDWR | O_TRUNC, 0666);
+
+ if (fd < 0) return;
+ write (fd, &ghdr, sizeof (ghdr));
+ if (mparam.kcountsize)
+ {
+ char tag = GMON_TAG_TIME_HIST;
+ struct gmon_hist_hdr ghdr = {
+ mparam.lowpc, mparam.highpc,
+ (mparam.kcountsize >> 1), 100, "seconds", 's'
+ };
+ struct iovec iov[3] = {
+ { &tag, sizeof (tag) },
+ { &ghdr, sizeof (ghdr) },
+ { mparam.kcount, mparam.kcountsize >> 1 << 1 }
+ };
+ writev (fd, iov, 3);
+ }
+ if (mparam.arcnum)
+ {
+ char tag = GMON_TAG_CG_ARC;
+ struct iovec iov[mparam.arcnum*2];
+ unsigned long l;
+ for (l=0;l<mparam.arcnum;l++) {
+ iov[l*2].iov_base = &tag;
+ iov[l*2].iov_len = sizeof (tag);
+ iov[l*2+1].iov_base = &mparam.arcs[l];
+ iov[l*2+1].iov_len = sizeof (mparam.arcs[l]);
+ }
+ writev (fd, iov, mparam.arcnum*2);
+ }
+ close (fd);
+}
+
+/* called by _start before exit */
+void
+_stop_monitor (void)
+{
+ profil (NULL, 0, 0, 0);
+ write_gmon ();
+}
diff --git a/mdk-stage1/dietlibc/profiling/profil.c b/mdk-stage1/dietlibc/profiling/profil.c
new file mode 100644
index 000000000..fa9a0ef2b
--- /dev/null
+++ b/mdk-stage1/dietlibc/profiling/profil.c
@@ -0,0 +1,75 @@
+/******************************************************
+ Copyright (C) 2001, 2002 Thomas M. Ogrisegg
+
+ This is free software. You can redistribute and modify
+ it under the terms of the GNU General Public License.
+
+ This file is part of the profiling support for dietlibc
+
+ profil (3) generic implementation
+
+ *************************************************************/
+
+#include <asm/sigcontext.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <signal.h>
+
+#define SHORT_SIZE sizeof (short)
+#define MAX_SHORT 65536
+
+#ifdef DEBUG
+# include <stdio.h>
+# define debug printf
+#else
+# define debug
+#endif
+
+#ifndef u_short
+# define u_short unsigned short
+#endif
+
+#ifndef u_int
+# define u_int unsigned int
+#endif
+
+static unsigned short *buffer = NULL;
+static size_t maxhits = 0;
+static unsigned long low_pc = 0;
+static unsigned long pscale = 0;
+
+/* profiler - helper function for profil(3) */
+static void
+profiler (int signal, struct sigcontext ctx)
+{
+ size_t s = PC(ctx)-low_pc;
+ (void)signal;
+ if ((PC(ctx)) < low_pc) return;
+ s >>= 1;
+ if (s < maxhits)
+ ++buffer[s];
+}
+
+/* profil(3) - start or stop the profiling timer */
+int
+profil (u_short *buf, size_t bufsiz, size_t offset, u_int scale)
+{
+ struct itimerval itv = { { 0, 1 }, { 0, 1 } };
+ struct sigaction sa;
+ if (!buf) {
+ sigaction (SIGPROF, NULL, NULL);
+ setitimer (ITIMER_PROF, NULL, NULL);
+ return (0);
+ }
+ sa.sa_handler = (sighandler_t)&profiler;
+ sa.sa_flags = SA_RESTART;
+ sigfillset (&sa.sa_mask);
+ sigaction (SIGPROF, &sa, NULL);
+ pscale = scale;
+ buffer = buf;
+ low_pc = offset;
+ maxhits = bufsiz/SHORT_SIZE;
+
+ return (setitimer (ITIMER_PROF, &itv, &itv));
+}
diff --git a/mdk-stage1/dietlibc/sparc/Makefile.add b/mdk-stage1/dietlibc/sparc/Makefile.add
index 0de05b1db..102175bc5 100644
--- a/mdk-stage1/dietlibc/sparc/Makefile.add
+++ b/mdk-stage1/dietlibc/sparc/Makefile.add
@@ -1,3 +1,4 @@
CFLAGS+=-mcpu=supersparc -Os
VPATH:=sparc:syscalls.s:$(VPATH)
+LIBOBJ+=$(OBJDIR)/udiv.o $(OBJDIR)/umul.o $(OBJDIR)/urem.o
diff --git a/mdk-stage1/dietlibc/sparc/__longjmp.S b/mdk-stage1/dietlibc/sparc/__longjmp.S
index 72e001a2f..6550d2b5c 100644
--- a/mdk-stage1/dietlibc/sparc/__longjmp.S
+++ b/mdk-stage1/dietlibc/sparc/__longjmp.S
@@ -10,6 +10,7 @@
.text
.global __longjmp
+.type __longjmp,function
__longjmp:
/* Store our arguments in global registers so we can still
use them while unwinding frames and their register windows. */
diff --git a/mdk-stage1/dietlibc/sparc/clone.S b/mdk-stage1/dietlibc/sparc/clone.S
index 58b438249..fd8d1d126 100644
--- a/mdk-stage1/dietlibc/sparc/clone.S
+++ b/mdk-stage1/dietlibc/sparc/clone.S
@@ -1,10 +1,11 @@
-#include <asm/errno.h>
-#include <asm/unistd.h>
+#include <errno.h>
+#include "syscalls.h"
.text
.align 4
.weak clone
clone:
+.type __clone,#function
.global __clone
__clone:
save %sp, -96, %sp
diff --git a/mdk-stage1/dietlibc/sparc/errlist.S b/mdk-stage1/dietlibc/sparc/errlist.S
new file mode 100644
index 000000000..c23f7b3d5
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/errlist.S
@@ -0,0 +1,280 @@
+#ifdef __DYN_LIB
+.section .data
+#else
+.section .rodata
+#endif
+
+.align 4
+.global sys_errlist
+.type sys_errlist,@object
+sys_errlist:
+ .long .LC000
+ .long .LC001
+ .long .LC002
+ .long .LC003
+ .long .LC004
+ .long .LC005
+ .long .LC006
+ .long .LC007
+ .long .LC008
+ .long .LC009
+ .long .LC010
+ .long .LC011
+ .long .LC012
+ .long .LC013
+ .long .LC014
+ .long .LC015
+ .long .LC016
+ .long .LC017
+ .long .LC018
+ .long .LC019
+ .long .LC020
+ .long .LC021
+ .long .LC022
+ .long .LC023
+ .long .LC024
+ .long .LC025
+ .long .LC026
+ .long .LC027
+ .long .LC028
+ .long .LC029
+ .long .LC030
+ .long .LC031
+ .long .LC032
+ .long .LC033
+ .long .LC034
+ .long .LC035
+ .long .LC036
+ .long .LC037
+ .long .LC038
+ .long .LC039
+ .long .LC040
+ .long .LC041
+ .long .LC042
+ .long .LC043
+ .long .LC044
+ .long .LC045
+ .long .LC046
+ .long .LC047
+ .long .LC048
+ .long .LC049
+ .long .LC050
+ .long .LC051
+ .long .LC052
+ .long .LC053
+ .long .LC054
+ .long .LC055
+ .long .LC056
+ .long .LC057
+ .long .LC058
+ .long .LC059
+ .long .LC060
+ .long .LC061
+ .long .LC062
+ .long .LC063
+ .long .LC064
+ .long .LC065
+ .long .LC066
+ .long .LC067
+ .long .LC068
+ .long .LC069
+ .long .LC070
+ .long .LC071
+ .long .LC072
+ .long .LC073
+ .long .LC074
+ .long .LC075
+ .long .LC076
+ .long .LC077
+ .long .LC078
+ .long .LC079
+ .long .LC080
+ .long .LC081
+ .long .LC082
+ .long .LC083
+ .long .LC084
+ .long .LC085
+ .long .LC086
+ .long .LC087
+ .long .LC088
+ .long .LC089
+ .long .LC090
+ .long .LC091
+ .long .LC092
+ .long .LC093
+ .long .LC094
+ .long .LC095
+ .long .LC096
+ .long .LC097
+ .long .LC098
+ .long .LC099
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC100
+ .long .LC120
+ .long .LC121
+ .long .LC122
+ .long .LC123
+ .long .LC124
+ .long .LC125
+ .long .LC126
+ .long 0
+.size sys_errlist,.-sys_errlist
+
+.align 4
+.global sys_nerr
+.type sys_nerr,@object
+sys_nerr:
+ .long 127
+.size sys_nerr,4
+
+#ifdef __DYN_LIB
+.section .rodata
+#endif
+
+.LC000: .string "Success"
+.LC001: .string "Operation not permitted"
+.LC002: .string "No such file or directory"
+.LC003: .string "No such process"
+.LC004: .string "Interrupted system call"
+.LC005: .string "I/O error"
+.LC006: .string "No such device or address"
+.LC007: .string "Arg list too long"
+.LC008: .string "Exec format error"
+.LC009: .string "Bad file number"
+.LC010: .string "No child processes"
+.LC011: .string "Try again"
+.LC012: .string "Out of memory"
+.LC013: .string "Permission denied"
+.LC014: .string "Bad address"
+.LC015: .string "Block device required"
+.LC016: .string "Device or resource busy"
+.LC017: .string "File exists"
+.LC018: .string "Cross-device link"
+.LC019: .string "No such device"
+.LC020: .string "Not a directory"
+.LC021: .string "Is a directory"
+.LC022: .string "Invalid argument"
+.LC023: .string "File table overflow"
+.LC024: .string "Too many open files"
+.LC025: .string "Not a typewriter"
+.LC026: .string "Text file busy"
+.LC027: .string "File too large"
+.LC028: .string "No space left on device"
+.LC029: .string "Illegal seek"
+.LC030: .string "Read-only file system"
+.LC031: .string "Too many links"
+.LC032: .string "Broken pipe"
+.LC033: .string "Math argument out of domain of func"
+.LC034: .string "Math result not representable"
+.LC035: .string "Operation would block"
+.LC036: .string "Operation now in progress"
+.LC037: .string "Operation already in progress"
+.LC038: .string "Socket operation on non-socket"
+.LC039: .string "Destination address required"
+.LC040: .string "Message too long"
+.LC041: .string "Protocol wrong type for socket"
+.LC042: .string "Protocol not available"
+.LC043: .string "Protocol not supported"
+.LC044: .string "Socket type not supported"
+.LC045: .string "Op not supported on transport endpoint"
+.LC046: .string "Protocol family not supported"
+.LC047: .string "Address family not supported by protocol"
+.LC048: .string "Address already in use"
+.LC049: .string "Cannot assign requested address"
+.LC050: .string "Network is down"
+.LC051: .string "Network is unreachable"
+.LC052: .string "Net dropped connection because of reset"
+.LC053: .string "Software caused connection abort"
+.LC054: .string "Connection reset by peer"
+.LC055: .string "No buffer space available"
+.LC056: .string "Transport endpoint is already connected"
+.LC057: .string "Transport endpoint is not connected"
+.LC058: .string "No send after transport endpoint shutdown"
+.LC059: .string "Too many references: cannot splice"
+.LC060: .string "Connection timed out"
+.LC061: .string "Connection refused"
+.LC062: .string "Too many symbolic links encountered"
+.LC063: .string "File name too long"
+.LC064: .string "Host is down"
+.LC065: .string "No route to host"
+.LC066: .string "Directory not empty"
+.LC067: .string "SUNOS: Too many processes"
+.LC068: .string "Too many users"
+.LC069: .string "Quota exceeded"
+.LC070: .string "Stale NFS file handle"
+.LC071: .string "Object is remote"
+.LC072: .string "Device not a stream"
+.LC073: .string "Timer expired"
+.LC074: .string "Out of streams resources"
+.LC075: .string "No message of desired type"
+.LC076: .string "Not a data message"
+.LC077: .string "Identifier removed"
+.LC078: .string "Resource deadlock would occur"
+.LC079: .string "No record locks available"
+.LC080: .string "Machine is not on the network"
+.LC081: .string "SunOS: Too many lvls of remote in path"
+.LC082: .string "Link has been severed"
+.LC083: .string "Advertise error"
+.LC084: .string "Srmount error"
+.LC085: .string "Communication error on send"
+.LC086: .string "Protocol error"
+.LC087: .string "Multihop attempted"
+.LC088: .string "RFS specific error"
+.LC089: .string "Remote address changed"
+.LC090: .string "Function not implemented"
+.LC091: .string "Streams pipe error"
+.LC092: .string "Value too large for defined data type"
+.LC093: .string "File descriptor in bad state"
+.LC094: .string "Channel number out of range"
+.LC095: .string "Level 2 not synchronized"
+.LC096: .string "Level 3 halted"
+.LC097: .string "Level 3 reset"
+.LC098: .string "Link number out of range"
+.LC099: .string "Protocol driver not attached"
+.LC100: .string "No CSI structure available"
+.LC101: .string "Level 2 halted"
+.LC102: .string "Invalid exchange"
+.LC103: .string "Invalid request descriptor"
+.LC104: .string "Exchange full"
+.LC105: .string "No anode"
+.LC106: .string "Invalid request code"
+.LC107: .string "Invalid slot"
+.LC108: .string "File locking deadlock error"
+.LC109: .string "Bad font file format"
+.LC110: .string "Cannot exec a shared library directly"
+.LC111: .string "No data available"
+.LC112: .string "Accessing a corrupted shared library"
+.LC113: .string "Package not installed"
+.LC114: .string "Can not access a needed shared library"
+.LC115: .string "Name not unique on network"
+.LC116: .string "Interrupted syscall should be restarted"
+.LC117: .string "Structure needs cleaning"
+.LC118: .string "Not a XENIX named type file"
+.LC119: .string "No XENIX semaphores available"
+.LC120: .string "Is a named type file"
+.LC121: .string "Remote I/O error"
+.LC122: .string "Illegal byte sequence"
+.LC123: .string "Atmpt to link in too many shared libs"
+.LC124: .string ".lib section in a.out corrupted"
+.LC125: .string "No medium found"
+.LC126: .string "Wrong medium type"
+
+
diff --git a/mdk-stage1/dietlibc/sparc/fork.S b/mdk-stage1/dietlibc/sparc/fork.S
index 869c9b30c..a54cab2a9 100644
--- a/mdk-stage1/dietlibc/sparc/fork.S
+++ b/mdk-stage1/dietlibc/sparc/fork.S
@@ -10,7 +10,7 @@ __libc_fork:
bcc,a 1f
nop
save %sp, -96, %sp
-#ifdef WANT_THREAD_SAVE
+#ifdef WANT_THREAD_SAFE
call __errno_location
nop
#else
diff --git a/mdk-stage1/dietlibc/sparc/mmap.c b/mdk-stage1/dietlibc/sparc/mmap.c
index 25ebdc24e..5342bac4e 100644
--- a/mdk-stage1/dietlibc/sparc/mmap.c
+++ b/mdk-stage1/dietlibc/sparc/mmap.c
@@ -1,5 +1,5 @@
-#include <linux/types.h>
-#include <linux/unistd.h>
+#include <sys/types.h>
+#include "syscalls.h"
#define __SYSCALL_STRING \
"ta 0x10;" \
diff --git a/mdk-stage1/dietlibc/sparc/pipe.S b/mdk-stage1/dietlibc/sparc/pipe.S
index 820da2570..076822765 100644
--- a/mdk-stage1/dietlibc/sparc/pipe.S
+++ b/mdk-stage1/dietlibc/sparc/pipe.S
@@ -9,7 +9,7 @@ pipe:
bcc,a 1f
nop
save %sp, -96, %sp
-#ifdef WANT_THREAD_SAVE
+#ifdef WANT_THREAD_SAFE
call __errno_location
nop
#else
diff --git a/mdk-stage1/dietlibc/sparc/setjmp.S b/mdk-stage1/dietlibc/sparc/setjmp.S
index efc5a7013..579df757c 100644
--- a/mdk-stage1/dietlibc/sparc/setjmp.S
+++ b/mdk-stage1/dietlibc/sparc/setjmp.S
@@ -6,32 +6,34 @@
#define ST_FLUSH_WINDOWS 0x03
-.section .rodata
.text
.globl __setjmp
+.type __setjmp,function
__setjmp:
- b 1f
- set 0, %o1
+ b 1f
+ set 0, %o1
.size __setjmp,.-__setjmp
.globl setjmp
+.type setjmp,function
setjmp:
- set 1, %o1
+ set 1, %o1
.size setjmp,.-setjmp
.globl __sigsetjmp
+.type __sigsetjmp,function
__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
+ /* 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)]
+ 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
+ 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
index 73b2d89a9..b7dce2e83 100644
--- a/mdk-stage1/dietlibc/sparc/shmat.c
+++ b/mdk-stage1/dietlibc/sparc/shmat.c
@@ -1,7 +1,7 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include <asm/ipc.h>
+#include <unistd.h>
extern void* __ipc();
diff --git a/mdk-stage1/dietlibc/sparc/sigaction.c b/mdk-stage1/dietlibc/sparc/sigaction.c
new file mode 100644
index 000000000..028723699
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/sigaction.c
@@ -0,0 +1,7 @@
+#include <signal.h>
+
+int __rt_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact, void* restorer, long nr);
+
+int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
+ return __rt_sigaction(signum, act, oldact, 0, _NSIG/8);
+}
diff --git a/mdk-stage1/dietlibc/sparc/start.S b/mdk-stage1/dietlibc/sparc/start.S
index e948aaddc..c6408ee8f 100644
--- a/mdk-stage1/dietlibc/sparc/start.S
+++ b/mdk-stage1/dietlibc/sparc/start.S
@@ -1,46 +1,50 @@
-#include "start.h"
-
-#ifdef __sparc__
- .section ".text"
- .align 4
- .global _start
- .type _start,@function
+ .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
+/* 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
+/* 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
+ 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. */
+/* 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. */
+/* Let libc do the rest of the initialization, and call main. */
+#ifdef WANT_DYNAMIC
+ call dyn_start
+#else
call main
- mov %g1, %o5
+#endif
+ mov %g1, %o3
b exit
mov %o0, %i0
- /* Die very horribly if exit returns. */
- unimp
+/* Die very horribly if exit returns. */
- .size _start, .-_start
-#endif
+/* here we go and "reuse" the return for weak-void functions */
+#include "dietuglyweaks.h"
+ ret
+ nop
+
+ .size _start, .-_start
diff --git a/mdk-stage1/dietlibc/sparc/strlen.S b/mdk-stage1/dietlibc/sparc/strlen.S
new file mode 100644
index 000000000..59ffb7981
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/strlen.S
@@ -0,0 +1,11 @@
+.text
+.globl strlen
+strlen:
+ add %o0, 1, %o1
+.Lloop:
+ ldsb [%o0], %o2
+ orcc %o2, %o2, %g0
+ bne .Lloop
+ add %o0, 1, %o0
+ retl
+ sub %o0, %o1, %o0
diff --git a/mdk-stage1/dietlibc/sparc/syscalls.h b/mdk-stage1/dietlibc/sparc/syscalls.h
new file mode 100644
index 000000000..ea5227c71
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/syscalls.h
@@ -0,0 +1,276 @@
+
+#define __NR_exit 1 /* Common */
+#define __NR_fork 2 /* Common */
+#define __NR_read 3 /* Common */
+#define __NR_write 4 /* Common */
+#define __NR_open 5 /* Common */
+#define __NR_close 6 /* Common */
+#define __NR_wait4 7 /* Common */
+#define __NR_creat 8 /* Common */
+#define __NR_link 9 /* Common */
+#define __NR_unlink 10 /* Common */
+#define __NR_execv 11 /* SunOS Specific */
+#define __NR_chdir 12 /* Common */
+#define __NR_chown 13 /* Common */
+#define __NR_mknod 14 /* Common */
+#define __NR_chmod 15 /* Common */
+#define __NR_lchown 16 /* Common */
+#define __NR_brk 17 /* Common */
+#define __NR_perfctr 18 /* Performance counter operations */
+#define __NR_lseek 19 /* Common */
+#define __NR_getpid 20 /* Common */
+#define __NR_capget 21 /* Linux Specific */
+#define __NR_capset 22 /* Linux Specific */
+#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
+#define __NR_getuid 24 /* Common */
+/* #define __NR_time alias 25 ENOSYS under SunOS */
+#define __NR_ptrace 26 /* Common */
+#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
+#define __NR_sigaltstack 28 /* Common */
+#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */
+#define __NR_utime 30 /* Implemented via utimes() under SunOS */
+#define __NR_lchown32 31 /* Linux sparc32 specific */
+#define __NR_fchown32 32 /* Linux sparc32 specific */
+#define __NR_access 33 /* Common */
+#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */
+#define __NR_chown32 35 /* Linux sparc32 specific */
+#define __NR_sync 36 /* Common */
+#define __NR_kill 37 /* Common */
+#define __NR_stat 38 /* Common */
+#define __NR_sendfile 39 /* Linux Specific */
+#define __NR_lstat 40 /* Common */
+#define __NR_dup 41 /* Common */
+#define __NR_pipe 42 /* Common */
+#define __NR_times 43 /* Implemented via getrusage() in SunOS */
+#define __NR_getuid32 44 /* Linux sparc32 specific */
+#define __NR_umount2 45 /* Linux Specific */
+#define __NR_setgid 46 /* Implemented via setregid() in SunOS */
+#define __NR_getgid 47 /* Common */
+#define __NR_signal 48 /* Implemented via sigvec() in SunOS */
+#define __NR_geteuid 49 /* SunOS calls getuid() */
+#define __NR_getegid 50 /* SunOS calls getgid() */
+#define __NR_acct 51 /* Common */
+/* #define __NR_memory_ordering 52 Linux sparc64 specific */
+#define __NR_getgid32 53 /* Linux sparc32 specific */
+#define __NR_ioctl 54 /* Common */
+#define __NR_reboot 55 /* Common */
+#define __NR_mmap2 56 /* Linux sparc32 Specific */
+#define __NR_symlink 57 /* Common */
+#define __NR_readlink 58 /* Common */
+#define __NR_execve 59 /* Common */
+#define __NR_umask 60 /* Common */
+#define __NR_chroot 61 /* Common */
+#define __NR_fstat 62 /* Common */
+#define __NR_fstat64 63 /* Linux sparc32 Specific */
+#define __NR_getpagesize 64 /* Common */
+#define __NR_msync 65 /* Common in newer 1.3.x revs... */
+#define __NR_vfork 66 /* Common */
+#define __NR_pread 67 /* Linux Specific */
+#define __NR_pwrite 68 /* Linux Specific */
+#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */
+#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */
+#define __NR_mmap 71 /* Common */
+#define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */
+#define __NR_munmap 73 /* Common */
+#define __NR_mprotect 74 /* Common */
+#define __NR_madvise 75 /* Common */
+#define __NR_vhangup 76 /* Common */
+#define __NR_truncate64 77 /* Linux sparc32 Specific */
+#define __NR_mincore 78 /* Common */
+#define __NR_getgroups 79 /* Common */
+#define __NR_setgroups 80 /* Common */
+#define __NR_getpgrp 81 /* Common */
+#define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */
+#define __NR_setitimer 83 /* Common */
+#define __NR_ftruncate64 84 /* Linux sparc32 Specific */
+#define __NR_swapon 85 /* Common */
+#define __NR_getitimer 86 /* Common */
+#define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */
+#define __NR_sethostname 88 /* Common */
+#define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */
+#define __NR_dup2 90 /* Common */
+#define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */
+#define __NR_fcntl 92 /* Common */
+#define __NR_select 93 /* Common */
+#define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */
+#define __NR_fsync 95 /* Common */
+#define __NR_setpriority 96 /* Common */
+#define __NR_socket 97 /* Common */
+#define __NR_connect 98 /* Common */
+#define __NR_accept 99 /* Common */
+#define __NR_getpriority 100 /* Common */
+#define __NR_rt_sigreturn 101 /* Linux Specific */
+#define __NR_rt_sigaction 102 /* Linux Specific */
+#define __NR_rt_sigprocmask 103 /* Linux Specific */
+#define __NR_rt_sigpending 104 /* Linux Specific */
+#define __NR_rt_sigtimedwait 105 /* Linux Specific */
+#define __NR_rt_sigqueueinfo 106 /* Linux Specific */
+#define __NR_rt_sigsuspend 107 /* Linux Specific */
+#define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */
+#define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */
+#define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */
+#define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */
+#define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */
+#define __NR_recvmsg 113 /* Common */
+#define __NR_sendmsg 114 /* Common */
+#define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */
+#define __NR_gettimeofday 116 /* Common */
+#define __NR_getrusage 117 /* Common */
+#define __NR_getsockopt 118 /* Common */
+#define __NR_getcwd 119 /* Linux Specific */
+#define __NR_readv 120 /* Common */
+#define __NR_writev 121 /* Common */
+#define __NR_settimeofday 122 /* Common */
+#define __NR_fchown 123 /* Common */
+#define __NR_fchmod 124 /* Common */
+#define __NR_recvfrom 125 /* Common */
+#define __NR_setreuid 126 /* Common */
+#define __NR_setregid 127 /* Common */
+#define __NR_rename 128 /* Common */
+#define __NR_truncate 129 /* Common */
+#define __NR_ftruncate 130 /* Common */
+#define __NR_flock 131 /* Common */
+#define __NR_lstat64 132 /* Linux sparc32 Specific */
+#define __NR_sendto 133 /* Common */
+#define __NR_shutdown 134 /* Common */
+#define __NR_socketpair 135 /* Common */
+#define __NR_mkdir 136 /* Common */
+#define __NR_rmdir 137 /* Common */
+#define __NR_utimes 138 /* SunOS Specific */
+#define __NR_stat64 139 /* Linux sparc32 Specific */
+/* #define __NR_adjtime 140 SunOS Specific */
+#define __NR_getpeername 141 /* Common */
+/* #define __NR_gethostid 142 SunOS Specific */
+/* #define __NR_ni_syscall 143 ENOSYS under SunOS */
+#define __NR_getrlimit 144 /* Common */
+#define __NR_setrlimit 145 /* Common */
+#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */
+#define __NR_prctl 147 /* ENOSYS under SunOS */
+#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
+#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
+#define __NR_getsockname 150 /* Common */
+/* #define __NR_getmsg 151 SunOS Specific */
+/* #define __NR_putmsg 152 SunOS Specific */
+#define __NR_poll 153 /* Common */
+#define __NR_getdents64 154 /* Linux specific */
+#define __NR_fcntl64 155 /* Linux sparc32 Specific */
+/* #define __NR_getdirentries 156 SunOS Specific */
+#define __NR_statfs 157 /* Common */
+#define __NR_fstatfs 158 /* Common */
+#define __NR_umount 159 /* Common */
+/* #define __NR_async_daemon 160 SunOS Specific */
+/* #define __NR_getfh 161 SunOS Specific */
+#define __NR_getdomainname 162 /* SunOS Specific */
+#define __NR_setdomainname 163 /* Common */
+/* #define __NR_ni_syscall 164 ENOSYS under SunOS */
+#define __NR_quotactl 165 /* Common */
+/* #define __NR_exportfs 166 SunOS Specific */
+#define __NR_mount 167 /* Common */
+#define __NR_ustat 168 /* Common */
+/* #define __NR_semsys 169 SunOS Specific */
+/* #define __NR_msgsys 170 SunOS Specific */
+/* #define __NR_shmsys 171 SunOS Specific */
+/* #define __NR_auditsys 172 SunOS Specific */
+/* #define __NR_rfssys 173 SunOS Specific */
+#define __NR_getdents 174 /* Common */
+#define __NR_setsid 175 /* Common */
+#define __NR_fchdir 176 /* Common */
+/* #define __NR_fchroot 177 SunOS Specific */
+/* #define __NR_vpixsys 178 SunOS Specific */
+/* #define __NR_aioread 179 SunOS Specific */
+/* #define __NR_aiowrite 180 SunOS Specific */
+/* #define __NR_aiowait 181 SunOS Specific */
+/* #define __NR_aiocancel 182 SunOS Specific */
+#define __NR_sigpending 183 /* Common */
+#define __NR_query_module 184 /* Linux Specific */
+#define __NR_setpgid 185 /* Common */
+/* #define __NR_pathconf 186 SunOS Specific */
+/* #define __NR_fpathconf 187 SunOS Specific */
+/* #define __NR_sysconf 188 SunOS Specific */
+#define __NR_uname 189 /* Linux Specific */
+#define __NR_init_module 190 /* Linux Specific */
+#define __NR_personality 191 /* Linux Specific */
+/* #define __NR_prof 192 Linux Specific */
+/* #define __NR_break 193 Linux Specific */
+/* #define __NR_lock 194 Linux Specific */
+/* #define __NR_mpx 195 Linux Specific */
+/* #define __NR_ulimit 196 Linux Specific */
+#define __NR_getppid 197 /* Linux Specific */
+#define __NR_sigaction 198 /* Linux Specific */
+#define __NR_sgetmask 199 /* Linux Specific */
+#define __NR_ssetmask 200 /* Linux Specific */
+#define __NR_sigsuspend 201 /* Linux Specific */
+#define __NR_oldlstat 202 /* Linux Specific */
+#define __NR_uselib 203 /* Linux Specific */
+#define __NR_readdir 204 /* Linux Specific */
+/* #define __NR_ioperm 205 Linux Specific - i386 specific, unused */
+#define __NR_socketcall 206 /* Linux Specific */
+#define __NR_syslog 207 /* Linux Specific */
+/* #define __NR_olduname 208 Linux Specific */
+/* #define __NR_iopl 209 Linux Specific - i386 specific, unused */
+/* #define __NR_idle 210 Linux Specific - was sys_idle, now unused */
+/* #define __NR_vm86 211 Linux Specific - i386 specific, unused */
+#define __NR_waitpid 212 /* Linux Specific */
+#define __NR_swapoff 213 /* Linux Specific */
+#define __NR_sysinfo 214 /* Linux Specific */
+#define __NR_ipc 215 /* Linux Specific */
+#define __NR_sigreturn 216 /* Linux Specific */
+#define __NR_clone 217 /* Linux Specific */
+/* #define __NR_modify_ldt 218 Linux Specific - i386 specific, unused */
+#define __NR_adjtimex 219 /* Linux Specific */
+#define __NR_sigprocmask 220 /* Linux Specific */
+#define __NR_create_module 221 /* Linux Specific */
+#define __NR_delete_module 222 /* Linux Specific */
+#define __NR_get_kernel_syms 223 /* Linux Specific */
+#define __NR_getpgid 224 /* Linux Specific */
+#define __NR_bdflush 225 /* Linux Specific */
+#define __NR_sysfs 226 /* Linux Specific */
+#define __NR_afs_syscall 227 /* Linux Specific */
+#define __NR_setfsuid 228 /* Linux Specific */
+#define __NR_setfsgid 229 /* Linux Specific */
+#define __NR__newselect 230 /* Linux Specific */
+#define __NR_time 231 /* Linux Specific */
+/* #define __NR_oldstat 232 Linux Specific */
+#define __NR_stime 233 /* Linux Specific */
+/* #define __NR_oldfstat 234 Linux Specific */
+/* #define __NR_phys 235 Linux Specific */
+#define __NR__llseek 236 /* Linux Specific */
+#define __NR_mlock 237
+#define __NR_munlock 238
+#define __NR_mlockall 239
+#define __NR_munlockall 240
+#define __NR_sched_setparam 241
+#define __NR_sched_getparam 242
+#define __NR_sched_setscheduler 243
+#define __NR_sched_getscheduler 244
+#define __NR_sched_yield 245
+#define __NR_sched_get_priority_max 246
+#define __NR_sched_get_priority_min 247
+#define __NR_sched_rr_get_interval 248
+#define __NR_nanosleep 249
+#define __NR_mremap 250
+#define __NR__sysctl 251
+#define __NR_getsid 252
+#define __NR_fdatasync 253
+#define __NR_nfsservctl 254
+#define __NR_aplib 255
+
+#define syscall_weak(name,wsym,sym) \
+.text; \
+.type wsym,function; \
+.weak wsym; \
+wsym: ; \
+.type sym,function; \
+.global sym; \
+sym: \
+ b __unified_syscall; \
+ mov __NR_##name, %g1
+
+#define syscall(name,sym) \
+.text; \
+.type sym,function; \
+.global sym; \
+sym: \
+ b __unified_syscall; \
+ mov __NR_##name, %g1
+
diff --git a/mdk-stage1/dietlibc/sparc/udiv.S b/mdk-stage1/dietlibc/sparc/udiv.S
index 87479e7bd..fe8d04969 100644
--- a/mdk-stage1/dietlibc/sparc/udiv.S
+++ b/mdk-stage1/dietlibc/sparc/udiv.S
@@ -48,8 +48,6 @@
C_LABEL(name);\
.type name,@function;
-#define LOC(name) . ## L ## name
-
#define END(name) \
.size name, . - name
@@ -70,11 +68,11 @@ ENTRY(.udiv)
1:
cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu LOC(got_result) ! (and algorithm fails otherwise)
+ blu .Lgot_result ! (and algorithm fails otherwise)
clr %o2
sethi %hi(1 << (32 - 4 - 1)), %g1
cmp %o3, %g1
- blu LOC(not_really_big)
+ blu .Lnot_really_big
clr %o4
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
@@ -92,7 +90,7 @@ ENTRY(.udiv)
! Now compute %g2.
2: addcc %o5, %o5, %o5
- bcc LOC(not_too_big)
+ bcc .Lnot_too_big
add %g2, 1, %g2
! We get here if the %o1 overflowed while shifting.
@@ -101,14 +99,14 @@ ENTRY(.udiv)
sll %g1, 4, %g1 ! high order bit
srl %o5, 1, %o5 ! rest of %o5
add %o5, %g1, %o5
- b LOC(do_single_div)
+ b .Ldo_single_div
sub %g2, 1, %g2
- LOC(not_too_big):
+ .Lnot_too_big:
3: cmp %o5, %o3
blu 2b
nop
- be LOC(do_single_div)
+ be .Ldo_single_div
nop
/* NB: these are commented out in the V8-Sparc manual as well */
/* (I do not understand this) */
@@ -123,15 +121,15 @@ ENTRY(.udiv)
! 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):
+ .Ldo_single_div:
subcc %g2, 1, %g2
- bl LOC(end_regular_divide)
+ bl .Lend_regular_divide
nop
sub %o3, %o5, %o3
mov 1, %o2
- b LOC(end_single_divloop)
+ b .Lend_single_divloop
nop
- LOC(single_divloop):
+ .Lsingle_divloop:
sll %o2, 1, %o2
bl 1f
srl %o5, 1, %o5
@@ -143,66 +141,66 @@ ENTRY(.udiv)
add %o3, %o5, %o3
sub %o2, 1, %o2
2:
- LOC(end_single_divloop):
+ .Lend_single_divloop:
subcc %g2, 1, %g2
- bge LOC(single_divloop)
+ bge .Lsingle_divloop
tst %o3
- b,a LOC(end_regular_divide)
+ b,a .Lend_regular_divide
-LOC(not_really_big):
+.Lnot_really_big:
1:
sll %o5, 4, %o5
cmp %o5, %o3
bleu 1b
addcc %o4, 1, %o4
- be LOC(got_result)
+ be .Lgot_result
sub %o4, 1, %o4
tst %o3 ! set up for initial iteration
-LOC(divloop):
+.Ldivloop:
sll %o2, 4, %o2
! depth 1, accumulated bits 0
- bl LOC(1.16)
+ bl .L1.16
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 2, accumulated bits 1
- bl LOC(2.17)
+ bl .L2.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits 3
- bl LOC(3.19)
+ bl .L3.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 7
- bl LOC(4.23)
+ bl .L4.23
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (7*2+1), %o2
-LOC(4.23):
+.L4.23:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (7*2-1), %o2
-LOC(3.19):
+.L3.19:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 5
- bl LOC(4.21)
+ bl .L4.21
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (5*2+1), %o2
-LOC(4.21):
+.L4.21:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -210,41 +208,41 @@ LOC(4.21):
-LOC(2.17):
+.L2.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits 1
- bl LOC(3.17)
+ bl .L3.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 3
- bl LOC(4.19)
+ bl .L4.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (3*2+1), %o2
-LOC(4.19):
+.L4.19:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (3*2-1), %o2
-LOC(3.17):
+.L3.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 1
- bl LOC(4.17)
+ bl .L4.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (1*2+1), %o2
-LOC(4.17):
+.L4.17:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -253,46 +251,46 @@ LOC(4.17):
-LOC(1.16):
+.L1.16:
! remainder is negative
addcc %o3,%o5,%o3
! depth 2, accumulated bits -1
- bl LOC(2.15)
+ bl .L2.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits -1
- bl LOC(3.15)
+ bl .L3.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -1
- bl LOC(4.15)
+ bl .L4.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-1*2+1), %o2
-LOC(4.15):
+.L4.15:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-1*2-1), %o2
-LOC(3.15):
+.L3.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -3
- bl LOC(4.13)
+ bl .L4.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-3*2+1), %o2
-LOC(4.13):
+.L4.13:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -300,41 +298,41 @@ LOC(4.13):
-LOC(2.15):
+.L2.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits -3
- bl LOC(3.13)
+ bl .L3.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -5
- bl LOC(4.11)
+ bl .L4.11
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-5*2+1), %o2
-LOC(4.11):
+.L4.11:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-5*2-1), %o2
-LOC(3.13):
+.L3.13:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -7
- bl LOC(4.9)
+ bl .L4.9
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-7*2+1), %o2
-LOC(4.9):
+.L4.9:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -344,16 +342,16 @@ LOC(4.9):
9:
-LOC(end_regular_divide):
+.Lend_regular_divide:
subcc %o4, 1, %o4
- bge LOC(divloop)
+ bge .Ldivloop
tst %o3
- bl,a LOC(got_result)
+ bl,a .Lgot_result
! non-restoring fixup here (one instruction only!)
sub %o2, 1, %o2
-LOC(got_result):
+.Lgot_result:
retl
mov %o2, %o0
diff --git a/mdk-stage1/dietlibc/sparc/umul.S b/mdk-stage1/dietlibc/sparc/umul.S
index 15038ab2a..5d7d60f2b 100644
--- a/mdk-stage1/dietlibc/sparc/umul.S
+++ b/mdk-stage1/dietlibc/sparc/umul.S
@@ -25,8 +25,6 @@
C_LABEL(name);\
.type name,@function;
-#define LOC(name) . ## L ## name
-
#define END(name) \
.size name, . - name
@@ -34,7 +32,7 @@ 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
+ be .Lmul_shortway ! if zero, can do it the short way
andcc %g0, %g0, %o4 ! zero the partial product; clear N & V
/*
@@ -124,7 +122,7 @@ ENTRY(.umul)
addcc %o4, %o2, %o1 ! add compensation and put upper half in place
#endif
-LOC(mul_shortway):
+.Lmul_shortway:
/*
* Short multiply. 12 steps, followed by a final shift step.
* The resulting bits are off by 12 and (32-12) = 20 bit positions,
diff --git a/mdk-stage1/dietlibc/sparc/unified.S b/mdk-stage1/dietlibc/sparc/unified.S
index 3cd609da5..873a522df 100644
--- a/mdk-stage1/dietlibc/sparc/unified.S
+++ b/mdk-stage1/dietlibc/sparc/unified.S
@@ -1,6 +1,14 @@
#include <dietfeatures.h>
+#include "syscalls.h"
.text
+.weak exit
+.type exit,function
+exit:
+.global _exit
+.type _exit,function
+_exit:
+ mov __NR_exit, %g1
.global __unified_syscall
__unified_syscall:
ta 0x10
@@ -14,7 +22,7 @@ __unified_syscall:
cmp %l2, 0xfe
bgu 2f
neg %i0, %l3
-#ifdef WANT_THREAD_SAVE
+#ifdef WANT_THREAD_SAFE
call __errno_location
nop
#else
diff --git a/mdk-stage1/dietlibc/sparc/urem.S b/mdk-stage1/dietlibc/sparc/urem.S
index 943cb7873..f7a9fd394 100644
--- a/mdk-stage1/dietlibc/sparc/urem.S
+++ b/mdk-stage1/dietlibc/sparc/urem.S
@@ -48,8 +48,6 @@
C_LABEL(name);\
.type name,@function;
-#define LOC(name) . ## L ## name
-
#define END(name) \
.size name, . - name
@@ -70,11 +68,11 @@ ENTRY(.urem)
1:
cmp %o3, %o5 ! if %o1 exceeds %o0, done
- blu LOC(got_result) ! (and algorithm fails otherwise)
+ blu .Lgot_result ! (and algorithm fails otherwise)
clr %o2
sethi %hi(1 << (32 - 4 - 1)), %g1
cmp %o3, %g1
- blu LOC(not_really_big)
+ blu .Lnot_really_big
clr %o4
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
@@ -92,7 +90,7 @@ ENTRY(.urem)
! Now compute %g2.
2: addcc %o5, %o5, %o5
- bcc LOC(not_too_big)
+ bcc .Lnot_too_big
add %g2, 1, %g2
! We get here if the %o1 overflowed while shifting.
@@ -101,14 +99,14 @@ ENTRY(.urem)
sll %g1, 4, %g1 ! high order bit
srl %o5, 1, %o5 ! rest of %o5
add %o5, %g1, %o5
- b LOC(do_single_div)
+ b .Ldo_single_div
sub %g2, 1, %g2
- LOC(not_too_big):
+ .Lnot_too_big:
3: cmp %o5, %o3
blu 2b
nop
- be LOC(do_single_div)
+ be .Ldo_single_div
nop
/* NB: these are commented out in the V8-Sparc manual as well */
/* (I do not understand this) */
@@ -123,15 +121,15 @@ ENTRY(.urem)
! 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):
+ .Ldo_single_div:
subcc %g2, 1, %g2
- bl LOC(end_regular_divide)
+ bl .Lend_regular_divide
nop
sub %o3, %o5, %o3
mov 1, %o2
- b LOC(end_single_divloop)
+ b .Lend_single_divloop
nop
- LOC(single_divloop):
+ .Lsingle_divloop:
sll %o2, 1, %o2
bl 1f
srl %o5, 1, %o5
@@ -143,66 +141,66 @@ ENTRY(.urem)
add %o3, %o5, %o3
sub %o2, 1, %o2
2:
- LOC(end_single_divloop):
+ .Lend_single_divloop:
subcc %g2, 1, %g2
- bge LOC(single_divloop)
+ bge .Lsingle_divloop
tst %o3
- b,a LOC(end_regular_divide)
+ b,a .Lend_regular_divide
-LOC(not_really_big):
+.Lnot_really_big:
1:
sll %o5, 4, %o5
cmp %o5, %o3
bleu 1b
addcc %o4, 1, %o4
- be LOC(got_result)
+ be .Lgot_result
sub %o4, 1, %o4
tst %o3 ! set up for initial iteration
-LOC(divloop):
+.Ldivloop:
sll %o2, 4, %o2
! depth 1, accumulated bits 0
- bl LOC(1.16)
+ bl .L1.16
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 2, accumulated bits 1
- bl LOC(2.17)
+ bl .L2.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits 3
- bl LOC(3.19)
+ bl .L3.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 7
- bl LOC(4.23)
+ bl .L4.23
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (7*2+1), %o2
-LOC(4.23):
+.L4.23:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (7*2-1), %o2
-LOC(3.19):
+.L3.19:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 5
- bl LOC(4.21)
+ bl .L4.21
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (5*2+1), %o2
-LOC(4.21):
+.L4.21:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -210,41 +208,41 @@ LOC(4.21):
-LOC(2.17):
+.L2.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits 1
- bl LOC(3.17)
+ bl .L3.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 3
- bl LOC(4.19)
+ bl .L4.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (3*2+1), %o2
-LOC(4.19):
+.L4.19:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (3*2-1), %o2
-LOC(3.17):
+.L3.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 1
- bl LOC(4.17)
+ bl .L4.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (1*2+1), %o2
-LOC(4.17):
+.L4.17:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -253,46 +251,46 @@ LOC(4.17):
-LOC(1.16):
+.L1.16:
! remainder is negative
addcc %o3,%o5,%o3
! depth 2, accumulated bits -1
- bl LOC(2.15)
+ bl .L2.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits -1
- bl LOC(3.15)
+ bl .L3.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -1
- bl LOC(4.15)
+ bl .L4.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-1*2+1), %o2
-LOC(4.15):
+.L4.15:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-1*2-1), %o2
-LOC(3.15):
+.L3.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -3
- bl LOC(4.13)
+ bl .L4.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-3*2+1), %o2
-LOC(4.13):
+.L4.13:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -300,41 +298,41 @@ LOC(4.13):
-LOC(2.15):
+.L2.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits -3
- bl LOC(3.13)
+ bl .L3.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -5
- bl LOC(4.11)
+ bl .L4.11
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-5*2+1), %o2
-LOC(4.11):
+.L4.11:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-5*2-1), %o2
-LOC(3.13):
+.L3.13:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -7
- bl LOC(4.9)
+ bl .L4.9
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-7*2+1), %o2
-LOC(4.9):
+.L4.9:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
@@ -344,16 +342,16 @@ LOC(4.9):
9:
-LOC(end_regular_divide):
+.Lend_regular_divide:
subcc %o4, 1, %o4
- bge LOC(divloop)
+ bge .Ldivloop
tst %o3
- bl,a LOC(got_result)
+ bl,a .Lgot_result
! non-restoring fixup here (one instruction only!)
add %o3, %o1, %o3
-LOC(got_result):
+.Lgot_result:
retl
mov %o3, %o0
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/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/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/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
index eba7a3c00..aa62f67a9 100644
--- a/mdk-stage1/dietlibc/syscalls.h
+++ b/mdk-stage1/dietlibc/syscalls.h
@@ -1,142 +1,35 @@
-#ifdef __ASSEMBLER__
+#if defined(__i386__)
+#include "i386/syscalls.h"
-#include <asm/unistd.h>
+#elif defined(__x86_64__)
+#include "x86_64/syscalls.h"
+#elif defined(__sparc__)
+#if defined(__arch64__)
+#include "sparc64/syscalls.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
-
+#include "sparc/syscalls.h"
#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
+#elif defined(__powerpc__)
+#include "ppc/syscalls.h"
-#define syscall(name,sym) \
-.text; \
-.global sym; \
-sym: \
- li 0,__NR_##name; \
- b __unified_syscall
+#elif defined(__mips__)
+#include "mips/syscalls.h"
-#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
+#elif defined(__arm__)
+#include "arm/syscalls.h"
+#elif defined(__s390__)
+#include "s390/syscalls.h"
-#ifdef __alpha__
+#elif defined(__alpha__)
+#include "alpha/syscalls.h"
-#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
+#elif defined(__hppa__)
+#include "parisc/syscalls.h"
-#define syscall(name,sym) \
-.text ; \
-.align 2 ; \
-.global sym ; \
-.type sym,@function ; \
-sym: ; \
- lda $0, __NR_##name($31) ; \
- br __unified_syscall
+#elif defined(__ia64__)
+#include "ia64/syscalls.h"
#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/__pread.S b/mdk-stage1/dietlibc/syscalls.s/__pread.S
index ad47c7873..ae2068352 100644
--- a/mdk-stage1/dietlibc/syscalls.s/__pread.S
+++ b/mdk-stage1/dietlibc/syscalls.s/__pread.S
@@ -1,3 +1,3 @@
#include "syscalls.h"
-syscall_weak(pread,__pread,__libc__pread)
+syscall(pread,__pread)
diff --git a/mdk-stage1/dietlibc/syscalls.s/pwrite.S b/mdk-stage1/dietlibc/syscalls.s/__pwrite.S
index f52ead7b2..f52ead7b2 100644
--- a/mdk-stage1/dietlibc/syscalls.s/pwrite.S
+++ b/mdk-stage1/dietlibc/syscalls.s/__pwrite.S
diff --git a/mdk-stage1/dietlibc/syscalls.s/_llseek.S b/mdk-stage1/dietlibc/syscalls.s/_llseek.S
index 3e240d822..68d021168 100644
--- a/mdk-stage1/dietlibc/syscalls.s/_llseek.S
+++ b/mdk-stage1/dietlibc/syscalls.s/_llseek.S
@@ -1,3 +1,7 @@
#include "syscalls.h"
+#ifdef __NR__llseek
+.global llseek
+llseek:
syscall(_llseek,_llseek)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/adjtimex.S b/mdk-stage1/dietlibc/syscalls.s/adjtimex.S
new file mode 100644
index 000000000..190ebcd7e
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/adjtimex.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(adjtimex,adjtimex)
diff --git a/mdk-stage1/dietlibc/syscalls.s/alarm.S b/mdk-stage1/dietlibc/syscalls.s/alarm.S
new file mode 100644
index 000000000..b1b0d3e49
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/alarm.S
@@ -0,0 +1,4 @@
+#include "syscalls.h"
+#ifdef __NR_alarm
+syscall(alarm,alarm)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/bdflush.S b/mdk-stage1/dietlibc/syscalls.s/bdflush.S
new file mode 100644
index 000000000..b7788baef
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/bdflush.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_bdflush
+syscall(bdflush,bdflush)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/chown32.S b/mdk-stage1/dietlibc/syscalls.s/chown32.S
new file mode 100644
index 000000000..98d68f980
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/chown32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_chown32
+syscall_weak(chown32,chown32,__libc_chown32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/create_module.S b/mdk-stage1/dietlibc/syscalls.s/create_module.S
new file mode 100644
index 000000000..f2da644ad
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/create_module.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_create_module
+syscall(create_module,create_module)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/delete_module.S b/mdk-stage1/dietlibc/syscalls.s/delete_module.S
new file mode 100644
index 000000000..d0919b6be
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/delete_module.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_delete_module
+syscall(delete_module,delete_module)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/environ.S b/mdk-stage1/dietlibc/syscalls.s/environ.S
new file mode 100644
index 000000000..eb3ff0b94
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/environ.S
@@ -0,0 +1,16 @@
+.section ".bss"
+.align 8
+
+.type environ,object
+.weak environ
+.type __environ,object
+.weak __environ
+__environ:
+environ:
+#if __WORDSIZE == 64
+ .quad 0
+#else
+ .long 0
+#endif
+.size environ,.-environ
+.size __environ,.-__environ
diff --git a/mdk-stage1/dietlibc/syscalls.s/epoll_create.S b/mdk-stage1/dietlibc/syscalls.s/epoll_create.S
new file mode 100644
index 000000000..09bb50209
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/epoll_create.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_sys_epoll_create
+syscall(sys_epoll_create,epoll_create)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/epoll_ctl.S b/mdk-stage1/dietlibc/syscalls.s/epoll_ctl.S
new file mode 100644
index 000000000..4587f59de
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/epoll_ctl.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_sys_epoll_ctl
+syscall(sys_epoll_ctl,epoll_ctl)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/epoll_wait.S b/mdk-stage1/dietlibc/syscalls.s/epoll_wait.S
new file mode 100644
index 000000000..dab5a58b7
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/epoll_wait.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_sys_epoll_wait
+syscall(sys_epoll_wait,epoll_wait)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/errlist.S b/mdk-stage1/dietlibc/syscalls.s/errlist.S
new file mode 100644
index 000000000..c06d3d3ac
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/errlist.S
@@ -0,0 +1,293 @@
+#include <endian.h>
+
+#
+# My gcc tries to align some of the strings if written the code in C. This costs a lot of bytes.
+#
+
+#ifdef __DYN_LIB
+.section .data
+#else
+.section .rodata
+#endif
+
+.align 4
+.global sys_errlist
+#ifdef __arm__
+.type sys_errlist,object
+.type sys_nerr,object
+#else
+.type sys_errlist,@object
+.type sys_nerr,@object
+#endif
+
+#if (__WORDSIZE == 64)
+#define deflong .quad
+#else
+#define deflong .long
+#endif
+
+sys_errlist:
+ deflong .LC000
+ deflong .LC001
+ deflong .LC002
+ deflong .LC003
+ deflong .LC004
+ deflong .LC005
+ deflong .LC006
+ deflong .LC007
+ deflong .LC008
+ deflong .LC009
+ deflong .LC010
+ deflong .LC011
+ deflong .LC012
+ deflong .LC013
+ deflong .LC014
+ deflong .LC015
+ deflong .LC016
+ deflong .LC017
+ deflong .LC018
+ deflong .LC019
+ deflong .LC020
+ deflong .LC021
+ deflong .LC022
+ deflong .LC023
+ deflong .LC024
+ deflong .LC025
+ deflong .LC026
+ deflong .LC027
+ deflong .LC028
+ deflong .LC029
+ deflong .LC030
+ deflong .LC031
+ deflong .LC032
+ deflong .LC033
+ deflong .LC034
+ deflong .LC035
+ deflong .LC036
+ deflong .LC037
+ deflong .LC038
+ deflong .LC039
+ deflong .LC040
+ deflong .LC041
+ deflong .LC042
+ deflong .LC043
+ deflong .LC044
+ deflong .LC045
+ deflong .LC046
+ deflong .LC047
+ deflong .LC048
+ deflong .LC049
+ deflong .LC050
+ deflong .LC051
+ deflong .LC052
+ deflong .LC053
+ deflong .LC054
+ deflong .LC055
+ deflong .LC056
+ deflong .LC057
+ deflong .LC058
+ deflong .LC059
+ deflong .LC060
+ deflong .LC061
+ deflong .LC062
+ deflong .LC063
+ deflong .LC064
+ deflong .LC065
+ deflong .LC066
+ deflong .LC067
+ deflong .LC068
+ deflong .LC069
+ deflong .LC070
+ deflong .LC071
+ deflong .LC072
+ deflong .LC073
+ deflong .LC074
+ deflong .LC075
+ deflong .LC076
+ deflong .LC077
+ deflong .LC078
+ deflong .LC079
+ deflong .LC080
+ deflong .LC081
+ deflong .LC082
+ deflong .LC083
+ deflong .LC084
+ deflong .LC085
+ deflong .LC086
+ deflong .LC087
+ deflong .LC088
+ deflong .LC089
+ deflong .LC090
+ deflong .LC091
+ deflong .LC092
+ deflong .LC093
+ deflong .LC094
+ deflong .LC095
+ deflong .LC096
+ deflong .LC097
+ deflong .LC098
+ deflong .LC099
+ deflong .LC100
+ deflong .LC101
+ deflong .LC102
+ deflong .LC103
+ deflong .LC104
+ deflong .LC105
+ deflong .LC106
+ deflong .LC107
+ deflong .LC108
+ deflong .LC109
+ deflong .LC110
+ deflong .LC111
+ deflong .LC112
+ deflong .LC113
+ deflong .LC114
+ deflong .LC115
+ deflong .LC116
+ deflong .LC117
+ deflong .LC118
+ deflong .LC119
+ deflong .LC120
+ deflong .LC121
+ deflong .LC122
+ deflong .LC123
+ deflong .LC124
+ deflong 0
+.size sys_errlist,.-sys_errlist
+
+.align 4
+.global sys_nerr
+sys_nerr:
+ .long 125
+.size sys_nerr,4
+
+
+#ifdef __DYN_LIB
+.section .rodata
+#endif
+
+.LC000: .string "Success"
+.LC001: .string "Operation not permitted"
+.LC002: .string "No such file or directory"
+.LC003: .string "No such process"
+.LC004: .string "Interrupted system call"
+.LC005: .string "I/O error"
+.LC006: .string "No such device or address"
+.LC007: .string "Arg list too long"
+.LC008: .string "Exec format error"
+.LC009: .string "Bad file number"
+.LC010: .string "No child processes"
+.LC011: .string "Try again"
+.LC012: .string "Out of memory"
+.LC013: .string "Permission denied"
+.LC014: .string "Bad address"
+.LC015: .string "Block device required"
+.LC016: .string "Device or resource busy"
+.LC017: .string "File exists"
+.LC018: .string "Cross-device link"
+.LC019: .string "No such device"
+.LC020: .string "Not a directory"
+.LC021: .string "Is a directory"
+.LC022: .string "Invalid argument"
+.LC023: .string "File table overflow"
+.LC024: .string "Too many open files"
+.LC025: .string "Not a typewriter"
+.LC026: .string "Text file busy"
+.LC027: .string "File too large"
+.LC028: .string "No space left on device"
+.LC029: .string "Illegal seek"
+.LC030: .string "Read-only file system"
+.LC031: .string "Too many links"
+.LC032: .string "Broken pipe"
+.LC033: .string "Math argument out of domain of func"
+.LC034: .string "Math result not representable"
+.LC035: .string "Resource deadlock would occur"
+.LC036: .string "File name too long"
+.LC037: .string "No record locks available"
+.LC038: .string "Function not implemented"
+.LC039: .string "Directory not empty"
+.LC040: .string "Too many symbolic links encountered"
+.LC041: .string "Operation would block"
+.LC042: .string "No message of desired type"
+.LC043: .string "Identifier removed"
+.LC044: .string "Channel number out of range"
+.LC045: .string "Level 2 not synchronized"
+.LC046: .string "Level 3 halted"
+.LC047: .string "Level 3 reset"
+.LC048: .string "Link number out of range"
+.LC049: .string "Protocol driver not attached"
+.LC050: .string "No CSI structure available"
+.LC051: .string "Level 2 halted"
+.LC052: .string "Invalid exchange"
+.LC053: .string "Invalid request descriptor"
+.LC054: .string "Exchange full"
+.LC055: .string "No anode"
+.LC056: .string "Invalid request code"
+.LC057: .string "Invalid slot"
+.LC058: .string "File locking deadlock error"
+.LC059: .string "Bad font file format"
+.LC060: .string "Device not a stream"
+.LC061: .string "No data available"
+.LC062: .string "Timer expired"
+.LC063: .string "Out of streams resources"
+.LC064: .string "Machine is not on the network"
+.LC065: .string "Package not installed"
+.LC066: .string "Object is remote"
+.LC067: .string "Link has been severed"
+.LC068: .string "Advertise error"
+.LC069: .string "Srmount error"
+.LC070: .string "Communication error on send"
+.LC071: .string "Protocol error"
+.LC072: .string "Multihop attempted"
+.LC073: .string "RFS specific error"
+.LC074: .string "Not a data message"
+.LC075: .string "Value too large for defined data type"
+.LC076: .string "Name not unique on network"
+.LC077: .string "File descriptor in bad state"
+.LC078: .string "Remote address changed"
+.LC079: .string "Can not access a needed shared library"
+.LC080: .string "Accessing a corrupted shared library"
+.LC081: .string ".lib section in a.out corrupted"
+.LC082: .string "Attempting to link in too many shared libraries"
+.LC083: .string "Cannot exec a shared library directly"
+.LC084: .string "Illegal byte sequence"
+.LC085: .string "Interrupted system call should be restarted"
+.LC086: .string "Streams pipe error"
+.LC087: .string "Too many users"
+.LC088: .string "Socket operation on non-socket"
+.LC089: .string "Destination address required"
+.LC090: .string "Message too long"
+.LC091: .string "Protocol wrong type for socket"
+.LC092: .string "Protocol not available"
+.LC093: .string "Protocol not supported"
+.LC094: .string "Socket type not supported"
+.LC095: .string "Operation not supported on transport endpoint"
+.LC096: .string "Protocol family not supported"
+.LC097: .string "Address family not supported by protocol"
+.LC098: .string "Address already in use"
+.LC099: .string "Cannot assign requested address"
+.LC100: .string "Network is down"
+.LC101: .string "Network is unreachable"
+.LC102: .string "Network dropped connection because of reset"
+.LC103: .string "Software caused connection abort"
+.LC104: .string "Connection reset by peer"
+.LC105: .string "No buffer space available"
+.LC106: .string "Transport endpoint is already connected"
+.LC107: .string "Transport endpoint is not connected"
+.LC108: .string "Cannot send after transport endpoint shutdown"
+.LC109: .string "Too many references: cannot splice"
+.LC110: .string "Connection timed out"
+.LC111: .string "Connection refused"
+.LC112: .string "Host is down"
+.LC113: .string "No route to host"
+.LC114: .string "Operation already in progress"
+.LC115: .string "Operation now in progress"
+.LC116: .string "Stale NFS file handle"
+.LC117: .string "Structure needs cleaning"
+.LC118: .string "Not a XENIX named type file"
+.LC119: .string "No XENIX semaphores available"
+.LC120: .string "Is a named type file"
+.LC121: .string "Remote I/O error"
+.LC122: .string "Quota exceeded"
+.LC123: .string "No medium found"
+.LC124: .string "Wrong medium type"
diff --git a/mdk-stage1/dietlibc/syscalls.s/errno.S b/mdk-stage1/dietlibc/syscalls.s/errno.S
new file mode 100644
index 000000000..2f0a2eca8
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/errno.S
@@ -0,0 +1,8 @@
+.section ".bss"
+.align 8
+
+.type errno,object
+.weak errno
+errno:
+ .long 0
+.size errno,.-errno
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/fchown32.S b/mdk-stage1/dietlibc/syscalls.s/fchown32.S
new file mode 100644
index 000000000..25b18bc8e
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/fchown32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_fchown32
+syscall_weak(fchown32,fchown32,__libc_fchown32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/fdatasync.S b/mdk-stage1/dietlibc/syscalls.s/fdatasync.S
new file mode 100644
index 000000000..46afd94d2
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/fdatasync.S
@@ -0,0 +1,6 @@
+#include "syscalls.h"
+
+#ifndef __NR_fdatasync
+#define __NR_fdatasync __NR_fsync
+#endif
+syscall_weak(fdatasync,fdatasync,__libc_fdatasync)
diff --git a/mdk-stage1/dietlibc/syscalls.s/fstat64.S b/mdk-stage1/dietlibc/syscalls.s/fstat64.S
index 0c7a41609..f034ddf5b 100644
--- a/mdk-stage1/dietlibc/syscalls.s/fstat64.S
+++ b/mdk-stage1/dietlibc/syscalls.s/fstat64.S
@@ -1,8 +1,10 @@
#include "dietfeatures.h"
#include "syscalls.h"
+#ifdef __NR_fstat64
#ifdef WANT_LARGEFILE_BACKCOMPAT
syscall(fstat64,__dietlibc_fstat64)
#else
syscall(fstat64,fstat64)
#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/ftruncate64.S b/mdk-stage1/dietlibc/syscalls.s/ftruncate64.S
new file mode 100644
index 000000000..639dcf5b7
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/ftruncate64.S
@@ -0,0 +1,10 @@
+#include "dietfeatures.h"
+#include "syscalls.h"
+
+#ifdef __NR_ftruncate64
+#ifdef WANT_LARGEFILE_BACKCOMPAT
+syscall(ftruncate64,__dietlibc_ftruncate64)
+#else
+syscall(ftruncate64,ftruncate64)
+#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getdents64.S b/mdk-stage1/dietlibc/syscalls.s/getdents64.S
index 16859addf..691d8f650 100644
--- a/mdk-stage1/dietlibc/syscalls.s/getdents64.S
+++ b/mdk-stage1/dietlibc/syscalls.s/getdents64.S
@@ -1,3 +1,4 @@
+#include "dietfeatures.h"
#include "syscalls.h"
#ifdef __NR_getdents64
diff --git a/mdk-stage1/dietlibc/syscalls.s/getegid32.S b/mdk-stage1/dietlibc/syscalls.s/getegid32.S
new file mode 100644
index 000000000..fd527d3f2
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/getegid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_getegid32
+syscall_weak(getegid32,getegid32,__libc_getegid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/geteuid32.S b/mdk-stage1/dietlibc/syscalls.s/geteuid32.S
new file mode 100644
index 000000000..8881fa580
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/geteuid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_geteuid32
+syscall_weak(geteuid32,geteuid32,__libc_geteuid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getgid32.S b/mdk-stage1/dietlibc/syscalls.s/getgid32.S
new file mode 100644
index 000000000..09fca3504
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/getgid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_getgid32
+syscall_weak(getgid32,getgid32,__libc_getgid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getgroups32.S b/mdk-stage1/dietlibc/syscalls.s/getgroups32.S
new file mode 100644
index 000000000..29e6005d6
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/getgroups32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_getgroups32
+syscall_weak(getgroups32,getgroups32,__libc_getgroups32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getresgid32.S b/mdk-stage1/dietlibc/syscalls.s/getresgid32.S
new file mode 100644
index 000000000..35ee7436b
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/getresgid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_getresgid32
+syscall_weak(getresgid32,getresgid32,__libc_getresgid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getresuid.S b/mdk-stage1/dietlibc/syscalls.s/getresuid.S
index 62f6d764f..95c5505a8 100644
--- a/mdk-stage1/dietlibc/syscalls.s/getresuid.S
+++ b/mdk-stage1/dietlibc/syscalls.s/getresuid.S
@@ -1,7 +1,7 @@
#include "syscalls.h"
-#ifdef __getresuid
+#ifdef __NR_getresuid
-syscall(getresuid)
+syscall(getresuid,getresuid)
#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/getuid32.S b/mdk-stage1/dietlibc/syscalls.s/getuid32.S
new file mode 100644
index 000000000..f90ce06a5
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/getuid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_getuid32
+syscall_weak(getuid32,getuid32,__libc_getuid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/init_module.S b/mdk-stage1/dietlibc/syscalls.s/init_module.S
new file mode 100644
index 000000000..4e8709d75
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/init_module.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_init_module
+syscall(init_module,init_module)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/ioperm.S b/mdk-stage1/dietlibc/syscalls.s/ioperm.S
index 0acfde07a..74a51fc4b 100644
--- a/mdk-stage1/dietlibc/syscalls.s/ioperm.S
+++ b/mdk-stage1/dietlibc/syscalls.s/ioperm.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_ioperm
syscall(ioperm,ioperm)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/ipc.S b/mdk-stage1/dietlibc/syscalls.s/ipc.S
index 40479400d..476878e52 100644
--- a/mdk-stage1/dietlibc/syscalls.s/ipc.S
+++ b/mdk-stage1/dietlibc/syscalls.s/ipc.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_ipc
syscall(ipc,__ipc)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/lchown32.S b/mdk-stage1/dietlibc/syscalls.s/lchown32.S
new file mode 100644
index 000000000..6863dcb24
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/lchown32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_lchown32
+syscall_weak(lchown32,lchown32,__libc_lchown32)
+#endif
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/lstat64.S b/mdk-stage1/dietlibc/syscalls.s/lstat64.S
index 33fd5ab94..021cb0578 100644
--- a/mdk-stage1/dietlibc/syscalls.s/lstat64.S
+++ b/mdk-stage1/dietlibc/syscalls.s/lstat64.S
@@ -1,8 +1,10 @@
#include "dietfeatures.h"
#include "syscalls.h"
+#ifdef __NR_lstat64
#ifdef WANT_LARGEFILE_BACKCOMPAT
syscall(lstat64,__dietlibc_lstat64)
#else
syscall(lstat64,lstat64)
#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/madvise.S b/mdk-stage1/dietlibc/syscalls.s/madvise.S
new file mode 100644
index 000000000..dde7daaea
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/madvise.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(madvise,madvise)
diff --git a/mdk-stage1/dietlibc/syscalls.s/mlock.S b/mdk-stage1/dietlibc/syscalls.s/mlock.S
new file mode 100644
index 000000000..e2fa3d1bd
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/mlock.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(mlock,mlock)
diff --git a/mdk-stage1/dietlibc/syscalls.s/mmap2.S b/mdk-stage1/dietlibc/syscalls.s/mmap2.S
new file mode 100644
index 000000000..faf7eaaff
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/mmap2.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_mmap2
+syscall(mmap2,__mmap2)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/msync.S b/mdk-stage1/dietlibc/syscalls.s/msync.S
new file mode 100644
index 000000000..7f5ae9e4a
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/msync.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall_weak(msync,msync,__libc_msync)
diff --git a/mdk-stage1/dietlibc/syscalls.s/munlock.S b/mdk-stage1/dietlibc/syscalls.s/munlock.S
new file mode 100644
index 000000000..2001c89b7
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/munlock.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(munlock,munlock)
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigaction.S b/mdk-stage1/dietlibc/syscalls.s/n_sigaction.S
new file mode 100644
index 000000000..15d66ccc0
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigaction.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_sigaction
+syscall_weak(sigaction,__old_sigaction,__n_sigaction)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigpending.S b/mdk-stage1/dietlibc/syscalls.s/n_sigpending.S
new file mode 100644
index 000000000..f851099a0
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigpending.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_sigpending
+syscall_weak(sigpending,__old_sigpending,__n_sigpending)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S b/mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S
new file mode 100644
index 000000000..6d632aa71
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigprocmask.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_sigprocmask
+syscall_weak(sigprocmask,__old_sigprocmask,__n_sigprocmask)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S b/mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S
new file mode 100644
index 000000000..a1cfc014d
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/n_sigsuspend.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_sigsuspend
+syscall_weak(sigsuspend,__old_sigsuspend,__n_sigsuspend)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/nice.S b/mdk-stage1/dietlibc/syscalls.s/nice.S
index 7d3f740b2..4dad30edb 100644
--- a/mdk-stage1/dietlibc/syscalls.s/nice.S
+++ b/mdk-stage1/dietlibc/syscalls.s/nice.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_nice
syscall(nice,nice)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/pause.S b/mdk-stage1/dietlibc/syscalls.s/pause.S
index cdf42cabd..d154f1538 100644
--- a/mdk-stage1/dietlibc/syscalls.s/pause.S
+++ b/mdk-stage1/dietlibc/syscalls.s/pause.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_pause
syscall_weak(pause,pause,__libc_pause)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/pivot_root.S b/mdk-stage1/dietlibc/syscalls.s/pivot_root.S
new file mode 100644
index 000000000..89bc40298
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/pivot_root.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(pivot_root,pivot_root)
diff --git a/mdk-stage1/dietlibc/syscalls.s/prctl.S b/mdk-stage1/dietlibc/syscalls.s/prctl.S
new file mode 100644
index 000000000..654d5ded5
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/prctl.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_prctl
+syscall(prctl,prctl)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/ptrace.S b/mdk-stage1/dietlibc/syscalls.s/ptrace.S
new file mode 100644
index 000000000..8f198f41e
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/ptrace.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(ptrace,__diet_ptrace)
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/rt_sigaction.S b/mdk-stage1/dietlibc/syscalls.s/rt_sigaction.S
new file mode 100644
index 000000000..2382b23af
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/rt_sigaction.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(rt_sigaction,__rt_sigaction)
diff --git a/mdk-stage1/dietlibc/syscalls.s/rt_sigpending.S b/mdk-stage1/dietlibc/syscalls.s/rt_sigpending.S
new file mode 100644
index 000000000..3ad8f6ff3
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/rt_sigpending.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(rt_sigpending,__rt_sigpending)
diff --git a/mdk-stage1/dietlibc/syscalls.s/rt_sigprocmask.S b/mdk-stage1/dietlibc/syscalls.s/rt_sigprocmask.S
new file mode 100644
index 000000000..b4c2aba5a
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/rt_sigprocmask.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(rt_sigprocmask,__rt_sigprocmask)
diff --git a/mdk-stage1/dietlibc/syscalls.s/rt_sigqueueinfo.S b/mdk-stage1/dietlibc/syscalls.s/rt_sigqueueinfo.S
new file mode 100644
index 000000000..fbc0b511f
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/rt_sigqueueinfo.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(rt_sigqueueinfo,__rt_sigqueueinfo)
diff --git a/mdk-stage1/dietlibc/syscalls.s/rt_sigsuspend.S b/mdk-stage1/dietlibc/syscalls.s/rt_sigsuspend.S
new file mode 100644
index 000000000..58297409e
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/rt_sigsuspend.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(rt_sigsuspend,__rt_sigsuspend)
diff --git a/mdk-stage1/dietlibc/syscalls.s/rt_sigtimedwait.S b/mdk-stage1/dietlibc/syscalls.s/rt_sigtimedwait.S
new file mode 100644
index 000000000..27cdef474
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/rt_sigtimedwait.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(rt_sigtimedwait,__rt_sigtimedwait)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sendfile.S b/mdk-stage1/dietlibc/syscalls.s/sendfile.S
index 12d6195dd..4dcb0ef69 100644
--- a/mdk-stage1/dietlibc/syscalls.s/sendfile.S
+++ b/mdk-stage1/dietlibc/syscalls.s/sendfile.S
@@ -3,4 +3,4 @@
syscall_weak(sendfile,sendfile,__libc_sendfile)
-link_warning(sendfile,"sendfile is not portable and does not support large files")
+link_warning(sendfile,"sendfile is not portable")
diff --git a/mdk-stage1/dietlibc/syscalls.s/sendfile64.S b/mdk-stage1/dietlibc/syscalls.s/sendfile64.S
new file mode 100644
index 000000000..054ed7177
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/sendfile64.S
@@ -0,0 +1,8 @@
+#include "syscalls.h"
+#include "dietwarning.h"
+
+#ifdef __NR_sendfile64
+syscall_weak(sendfile64,sendfile64,__libc_sendfile64)
+
+link_warning(sendfile64,"sendfile64 is not portable")
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setfsgid.S b/mdk-stage1/dietlibc/syscalls.s/setfsgid.S
new file mode 100644
index 000000000..095f1b2b8
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setfsgid.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(setfsgid,setfsgid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setfsgid32.S b/mdk-stage1/dietlibc/syscalls.s/setfsgid32.S
new file mode 100644
index 000000000..b671bf90d
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setfsgid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_setfsgid32
+syscall_weak(setfsgid32,setfsgid32,__libc_setfsgid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setfsuid.S b/mdk-stage1/dietlibc/syscalls.s/setfsuid.S
new file mode 100644
index 000000000..7dcd7b432
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setfsuid.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(setfsuid,setfsuid)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setfsuid32.S b/mdk-stage1/dietlibc/syscalls.s/setfsuid32.S
new file mode 100644
index 000000000..df5a0a877
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setfsuid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_setfsuid32
+syscall_weak(setfsuid32,setfsuid32,__libc_setfsuid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setgid32.S b/mdk-stage1/dietlibc/syscalls.s/setgid32.S
new file mode 100644
index 000000000..11be4922a
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setgid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_setgid32
+syscall_weak(setgid32,setgid32,__libc_setgid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setregid32.S b/mdk-stage1/dietlibc/syscalls.s/setregid32.S
new file mode 100644
index 000000000..4565bba17
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setregid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_setregid32
+syscall_weak(setregid32,setregid32,__libc_setregid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setresgid.S b/mdk-stage1/dietlibc/syscalls.s/setresgid.S
index 64cbac94e..2277cbaf4 100644
--- a/mdk-stage1/dietlibc/syscalls.s/setresgid.S
+++ b/mdk-stage1/dietlibc/syscalls.s/setresgid.S
@@ -1,7 +1,7 @@
#include "syscalls.h"
-#ifdef __setresgid
+#ifdef __NR_setresgid
-syscall(setresgid)
+syscall(setresgid,setresgid)
#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setresgid32.S b/mdk-stage1/dietlibc/syscalls.s/setresgid32.S
new file mode 100644
index 000000000..209b27f97
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setresgid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_setresgid32
+syscall_weak(setresgid32,setresgid32,__libc_setresgid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setresuid.S b/mdk-stage1/dietlibc/syscalls.s/setresuid.S
index 20b6abee9..cd322b77e 100644
--- a/mdk-stage1/dietlibc/syscalls.s/setresuid.S
+++ b/mdk-stage1/dietlibc/syscalls.s/setresuid.S
@@ -1,7 +1,7 @@
#include "syscalls.h"
-#ifdef __setresuid
+#ifdef __NR_setresuid
-syscall(setresuid)
+syscall(setresuid,setresuid)
#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/setreuid32.S b/mdk-stage1/dietlibc/syscalls.s/setreuid32.S
new file mode 100644
index 000000000..7bb06fa25
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setreuid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_setreuid32
+syscall_weak(setreuid32,setreuid32,__libc_setreuid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/settimeofday.S b/mdk-stage1/dietlibc/syscalls.s/settimeofday.S
new file mode 100644
index 000000000..4ca626aa4
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/settimeofday.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(settimeofday,settimeofday)
diff --git a/mdk-stage1/dietlibc/syscalls.s/setuid32.S b/mdk-stage1/dietlibc/syscalls.s/setuid32.S
new file mode 100644
index 000000000..869603471
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/setuid32.S
@@ -0,0 +1,5 @@
+#include "syscalls.h"
+
+#ifdef __NR_setuid32
+syscall_weak(setuid32,setuid32,__libc_setuid32)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigaction.S b/mdk-stage1/dietlibc/syscalls.s/sigaction.S
deleted file mode 100644
index 32382870c..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigaction.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sigaction,sigaction)
diff --git a/mdk-stage1/dietlibc/syscalls.s/signal.S b/mdk-stage1/dietlibc/syscalls.s/signal.S
deleted file mode 100644
index 86c4d5db0..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/signal.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(signal,signal)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigpending.S b/mdk-stage1/dietlibc/syscalls.s/sigpending.S
deleted file mode 100644
index 08715bef5..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigpending.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(sigpending,sigpending)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S b/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S
deleted file mode 100644
index 07f5b9d26..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(sigprocmask,sigprocmask,__sigprocmask)
diff --git a/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S b/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S
deleted file mode 100644
index 062264ab6..000000000
--- a/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall_weak(sigsuspend,sigsuspend,__libc_sigsuspend)
diff --git a/mdk-stage1/dietlibc/syscalls.s/socketcall.S b/mdk-stage1/dietlibc/syscalls.s/socketcall.S
index 5837c049a..b97b37f0c 100644
--- a/mdk-stage1/dietlibc/syscalls.s/socketcall.S
+++ b/mdk-stage1/dietlibc/syscalls.s/socketcall.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_socketcall
syscall(socketcall,socketcall)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/stat64.S b/mdk-stage1/dietlibc/syscalls.s/stat64.S
index 734fcab20..7dc54d955 100644
--- a/mdk-stage1/dietlibc/syscalls.s/stat64.S
+++ b/mdk-stage1/dietlibc/syscalls.s/stat64.S
@@ -1,8 +1,10 @@
#include "dietfeatures.h"
#include "syscalls.h"
+#ifdef __NR_stat64
#ifdef WANT_LARGEFILE_BACKCOMPAT
syscall(stat64,__dietlibc_stat64)
#else
syscall(stat64,stat64)
#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/stime.S b/mdk-stage1/dietlibc/syscalls.s/stime.S
index 9d9f5bf0a..281809c27 100644
--- a/mdk-stage1/dietlibc/syscalls.s/stime.S
+++ b/mdk-stage1/dietlibc/syscalls.s/stime.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_stime
syscall(stime,stime)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/syslog.S b/mdk-stage1/dietlibc/syscalls.s/syslog.S
index 6af3c4eac..4ebd81a39 100644
--- a/mdk-stage1/dietlibc/syscalls.s/syslog.S
+++ b/mdk-stage1/dietlibc/syscalls.s/syslog.S
@@ -1,3 +1,3 @@
#include "syscalls.h"
-syscall(syslog,__syscall_syslog)
+syscall_weak(syslog,__syscall_syslog,klogctl)
diff --git a/mdk-stage1/dietlibc/syscalls.s/time.S b/mdk-stage1/dietlibc/syscalls.s/time.S
index 26c79091c..aa646cfdf 100644
--- a/mdk-stage1/dietlibc/syscalls.s/time.S
+++ b/mdk-stage1/dietlibc/syscalls.s/time.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_time
syscall(time,time)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/truncate64.S b/mdk-stage1/dietlibc/syscalls.s/truncate64.S
new file mode 100644
index 000000000..0e375728e
--- /dev/null
+++ b/mdk-stage1/dietlibc/syscalls.s/truncate64.S
@@ -0,0 +1,10 @@
+#include "dietfeatures.h"
+#include "syscalls.h"
+
+#ifdef __NR_truncate64
+#ifdef WANT_LARGEFILE_BACKCOMPAT
+syscall(truncate64,__dietlibc_truncate64)
+#else
+syscall(truncate64,truncate64)
+#endif
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/umount2.S b/mdk-stage1/dietlibc/syscalls.s/umount2.S
index 4cdd6a200..b27b353ed 100644
--- a/mdk-stage1/dietlibc/syscalls.s/umount2.S
+++ b/mdk-stage1/dietlibc/syscalls.s/umount2.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_umount2
syscall(umount2,umount2)
+#endif
diff --git a/mdk-stage1/dietlibc/syscalls.s/waitpid.S b/mdk-stage1/dietlibc/syscalls.s/waitpid.S
index 5cdc18afb..bedc73eb6 100644
--- a/mdk-stage1/dietlibc/syscalls.s/waitpid.S
+++ b/mdk-stage1/dietlibc/syscalls.s/waitpid.S
@@ -1,3 +1,5 @@
#include "syscalls.h"
+#ifdef __NR_waitpid
syscall_weak(waitpid,waitpid,__libc_waitpid)
+#endif
diff --git a/mdk-stage1/dietlibc/threadsafe.sh b/mdk-stage1/dietlibc/threadsafe.sh
new file mode 100755
index 000000000..67f6f6338
--- /dev/null
+++ b/mdk-stage1/dietlibc/threadsafe.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+(gcc -E - << EOF | grep -q WANT_THREAD_SAFE) || echo libpthread/pthread_*.c
+#include "dietfeatures.h"
+WANT_THREAD_SAFE
+EOF
diff --git a/mdk-stage1/dietlibc/x86_64/Makefile.add b/mdk-stage1/dietlibc/x86_64/Makefile.add
new file mode 100644
index 000000000..7d60185a7
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/Makefile.add
@@ -0,0 +1,2 @@
+CFLAGS := -Os -fstrict-aliasing -momit-leaf-frame-pointer -mfancy-math-387
+VPATH := x86_64:syscalls.s:$(VPATH)
diff --git a/mdk-stage1/dietlibc/x86_64/__longjmp.S b/mdk-stage1/dietlibc/x86_64/__longjmp.S
new file mode 100644
index 000000000..43ec0539f
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/__longjmp.S
@@ -0,0 +1,26 @@
+#include <setjmp.h>
+#include "dietwarning.h"
+
+.text
+.global __longjmp
+.type __longjmp,@function
+__longjmp:
+ mov $1,%eax
+ /* Restore the return address now. */
+ movq (JB_PC*8)(%rdi),%rdx
+ /* Restore registers. */
+ movq (JB_RBX*8)(%rdi),%rbx
+ movq (JB_RBP*8)(%rdi),%rbp
+ movq (JB_R12*8)(%rdi),%r12
+ movq (JB_R13*8)(%rdi),%r13
+ movq (JB_R14*8)(%rdi),%r14
+ movq (JB_R15*8)(%rdi),%r15
+ movq (JB_RSP*8)(%rdi),%rsp
+ /* never return 0 */
+ test %esi,%esi
+ cmovne %esi,%eax
+ /* Jump to saved PC. */
+ jmp *%rdx
+.size __longjmp,.-__longjmp;
+
+link_warning("__longjmp","longjmp() not yet tested")
diff --git a/mdk-stage1/dietlibc/x86_64/__testandset.S b/mdk-stage1/dietlibc/x86_64/__testandset.S
new file mode 100644
index 000000000..7355477e6
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/__testandset.S
@@ -0,0 +1,12 @@
+#include "dietwarning.h"
+
+.text
+.global __testandset
+.type __testandset,@function
+__testandset:
+ xorl %eax,%eax
+ incl %eax
+ xchg %rax,(%rdi)
+ ret
+
+link_warning("__testandset", "warning: __testandset() was never tested!")
diff --git a/mdk-stage1/dietlibc/x86_64/accept.S b/mdk-stage1/dietlibc/x86_64/accept.S
new file mode 100644
index 000000000..7bdc38c7e
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/accept.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(accept, accept);
diff --git a/mdk-stage1/dietlibc/x86_64/bind.S b/mdk-stage1/dietlibc/x86_64/bind.S
new file mode 100644
index 000000000..05849d470
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/bind.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(bind, bind);
diff --git a/mdk-stage1/dietlibc/x86_64/clone.S b/mdk-stage1/dietlibc/x86_64/clone.S
new file mode 100644
index 000000000..82c8c5bae
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/clone.S
@@ -0,0 +1,64 @@
+#include "syscalls.h"
+#include <errno.h>
+#include "dietwarning.h"
+
+.text
+.type clone,@function
+.weak clone
+clone:
+.type __clone,@function
+.global __clone
+__clone:
+ movl $-EINVAL,%eax
+ testq %rdi,%rdi /* have non null thread_funcion */
+ jz .Lclone_error
+ testq %rsi,%rsi /* have non null child_stack pointer */
+ jz .Lclone_error
+
+ /* put the parameters on thread stack */
+ subq $16,%rsi
+ movq %rcx,8(%rsi) /* thread parameter */
+ movq %rdi,0(%rsi) /* thread function */
+
+ /* syscall */
+ movq %rdx,%rdi
+ movl $__NR_clone,%eax
+ syscall
+ cmpl $0,%eax
+ jl .Lclone_error
+ jne .Lreturn
+
+.thread_start:
+ /* call thread function */
+ popq %rax
+ popq %rdi
+ call *%rax
+ /* exit a thread */
+ movq %rax,%rdi
+#ifdef PIC
+ jmp _exit@PLT
+#else
+ jmp _exit
+#endif
+
+.Lclone_error:
+ /* set errno */
+ negl %eax
+ pushq %rax
+#ifdef PIC
+ call __errno_location@PLT
+#else
+ call __errno_location
+#endif
+ popq %rcx
+ movl %ecx,(%rax)
+ orq $-1, %rax
+
+.Lreturn:
+ /* just return */
+ ret
+
+link_warning("clone", "warning: clone() not yet tested")
+link_warning("__clone", "warning: clone() not yet tested")
+//link_warning("clone", "warning: clone() not yet implemented")
+//link_warning("__clone", "warning: clone() not yet implemented")
diff --git a/mdk-stage1/dietlibc/x86_64/connect.S b/mdk-stage1/dietlibc/x86_64/connect.S
new file mode 100644
index 000000000..5fbd151ae
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/connect.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(connect, connect);
diff --git a/mdk-stage1/dietlibc/x86_64/getpeername.S b/mdk-stage1/dietlibc/x86_64/getpeername.S
new file mode 100644
index 000000000..fdaa1038a
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/getpeername.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(getpeername, getpeername);
diff --git a/mdk-stage1/dietlibc/x86_64/getsockname.S b/mdk-stage1/dietlibc/x86_64/getsockname.S
new file mode 100644
index 000000000..1ea0bc000
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/getsockname.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(getsockname, getsockname);
diff --git a/mdk-stage1/dietlibc/x86_64/getsockopt.S b/mdk-stage1/dietlibc/x86_64/getsockopt.S
new file mode 100644
index 000000000..465c4e08e
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/getsockopt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(getsockopt, getsockopt);
diff --git a/mdk-stage1/dietlibc/x86_64/listen.S b/mdk-stage1/dietlibc/x86_64/listen.S
new file mode 100644
index 000000000..66a3fe376
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/listen.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(listen, listen);
diff --git a/mdk-stage1/dietlibc/x86_64/mmap.S b/mdk-stage1/dietlibc/x86_64/mmap.S
new file mode 100644
index 000000000..764d5fd96
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/mmap.S
@@ -0,0 +1,8 @@
+#include "syscalls.h"
+
+.text
+.global mmap
+.type mmap,@function
+mmap:
+ mov $__NR_mmap,%al
+ jmp __unified_syscall
diff --git a/mdk-stage1/dietlibc/x86_64/msgctl.S b/mdk-stage1/dietlibc/x86_64/msgctl.S
new file mode 100644
index 000000000..d7caed2cc
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgctl,msgctl)
diff --git a/mdk-stage1/dietlibc/x86_64/msgget.S b/mdk-stage1/dietlibc/x86_64/msgget.S
new file mode 100644
index 000000000..518d67ac4
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgget,msgget)
diff --git a/mdk-stage1/dietlibc/x86_64/msgrcv.S b/mdk-stage1/dietlibc/x86_64/msgrcv.S
new file mode 100644
index 000000000..ab62e6c30
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgrcv.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgrcv,msgrcv)
diff --git a/mdk-stage1/dietlibc/x86_64/msgsnd.S b/mdk-stage1/dietlibc/x86_64/msgsnd.S
new file mode 100644
index 000000000..890a996a2
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/msgsnd.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgsnd,msgsnd)
diff --git a/mdk-stage1/dietlibc/x86_64/recv.c b/mdk-stage1/dietlibc/x86_64/recv.c
new file mode 100644
index 000000000..3b76c0716
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/recv.c
@@ -0,0 +1,13 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <linuxnet.h>
+
+int __libc_recv(int fd, void * buf, size_t n, int flags);
+ /* shut up gcc warning about missing prototype */
+
+int __libc_recv(int fd, void * buf, size_t n, int flags) {
+ return recvfrom(fd, buf, n, flags, 0, 0);
+}
+
+int recv(int a, void * b, size_t c, int flags)
+ __attribute__ ((weak, alias("__libc_recv")));
diff --git a/mdk-stage1/dietlibc/x86_64/recvfrom.S b/mdk-stage1/dietlibc/x86_64/recvfrom.S
new file mode 100644
index 000000000..d3c2e602f
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/recvfrom.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(recvfrom, recvfrom);
diff --git a/mdk-stage1/dietlibc/x86_64/recvmsg.S b/mdk-stage1/dietlibc/x86_64/recvmsg.S
new file mode 100644
index 000000000..cfbbafdc1
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/recvmsg.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(recvmsg, recvmsg);
diff --git a/mdk-stage1/dietlibc/x86_64/semctl.S b/mdk-stage1/dietlibc/x86_64/semctl.S
new file mode 100644
index 000000000..e215ed955
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/semctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semctl,semctl)
diff --git a/mdk-stage1/dietlibc/x86_64/semget.S b/mdk-stage1/dietlibc/x86_64/semget.S
new file mode 100644
index 000000000..67f488546
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/semget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semget,semget)
diff --git a/mdk-stage1/dietlibc/x86_64/semop.S b/mdk-stage1/dietlibc/x86_64/semop.S
new file mode 100644
index 000000000..81b6fc606
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/semop.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semop,semop)
diff --git a/mdk-stage1/dietlibc/x86_64/send.c b/mdk-stage1/dietlibc/x86_64/send.c
new file mode 100644
index 000000000..bdeb1d31f
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/send.c
@@ -0,0 +1,13 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <linuxnet.h>
+
+int __libc_send(int fd, const void * buf, size_t n, int flags);
+ /* shut up gcc warning about missing prototype */
+
+int __libc_send(int fd, const void * buf, size_t n, int flags) {
+ return sendto(fd, buf, n, flags, NULL, 0);
+}
+
+int send(int a, const void * b, size_t c, int flags)
+ __attribute__ ((weak, alias("__libc_send")));
diff --git a/mdk-stage1/dietlibc/x86_64/sendmsg.S b/mdk-stage1/dietlibc/x86_64/sendmsg.S
new file mode 100644
index 000000000..c2bc80f72
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/sendmsg.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(sendmsg, sendmsg);
diff --git a/mdk-stage1/dietlibc/x86_64/sendto.S b/mdk-stage1/dietlibc/x86_64/sendto.S
new file mode 100644
index 000000000..1579a3b45
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/sendto.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(sendto, sendto);
diff --git a/mdk-stage1/dietlibc/x86_64/setjmp.S b/mdk-stage1/dietlibc/x86_64/setjmp.S
new file mode 100644
index 000000000..3d1ec11f0
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/setjmp.S
@@ -0,0 +1,37 @@
+#include <setjmp.h>
+#include "dietwarning.h"
+
+.text
+.weak setjmp
+.type setjmp,@function
+setjmp:
+.globl __setjmp
+.type __setjmp,@function
+__setjmp:
+ xorq %rsi,%rsi
+
+.globl __sigsetjmp
+.type __sigsetjmp,@function
+__sigsetjmp:
+ movq %rbx,(JB_RBX*8)(%rdi)
+ movq %rbp,(JB_RBP*8)(%rdi)
+ movq %r12,(JB_R12*8)(%rdi)
+ movq %r13,(JB_R13*8)(%rdi)
+ movq %r14,(JB_R14*8)(%rdi)
+ movq %r15,(JB_R15*8)(%rdi)
+ leaq 8(%rsp),%rdx
+ movq %rdx,(JB_RSP*8)(%rdi)
+ movq (%rsp),%rdx
+ movq %rdx,(JB_PC*8)(%rdi)
+#ifdef PIC
+ jmp __sigjmp_save@PLT
+#else
+ jmp __sigjmp_save
+#endif
+.size __sigsetjmp,.-__sigsetjmp;
+
+link_warning("setjmp","setjmp() not yet tested")
+link_warning("__sigsetjmp","setjmp() not yet tested")
+//link_warning("setjmp","error: setjmp() not yet implemented")
+//link_warning("__sigsetjmp","error: setjmp() not yet implemented")
+
diff --git a/mdk-stage1/dietlibc/x86_64/setsockopt.S b/mdk-stage1/dietlibc/x86_64/setsockopt.S
new file mode 100644
index 000000000..45fcfbb6c
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/setsockopt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(setsockopt, setsockopt);
diff --git a/mdk-stage1/dietlibc/x86_64/shmat.S b/mdk-stage1/dietlibc/x86_64/shmat.S
new file mode 100644
index 000000000..51248173d
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmat.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmat,shmat)
diff --git a/mdk-stage1/dietlibc/x86_64/shmctl.S b/mdk-stage1/dietlibc/x86_64/shmctl.S
new file mode 100644
index 000000000..d56caace4
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmctl,shmctl)
diff --git a/mdk-stage1/dietlibc/x86_64/shmdt.S b/mdk-stage1/dietlibc/x86_64/shmdt.S
new file mode 100644
index 000000000..d9812a799
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmdt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmdt,shmdt)
diff --git a/mdk-stage1/dietlibc/x86_64/shmget.S b/mdk-stage1/dietlibc/x86_64/shmget.S
new file mode 100644
index 000000000..82914223f
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shmget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmget,shmget)
diff --git a/mdk-stage1/dietlibc/x86_64/shutdown.S b/mdk-stage1/dietlibc/x86_64/shutdown.S
new file mode 100644
index 000000000..024e99e18
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/shutdown.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shutdown, shutdown);
diff --git a/mdk-stage1/dietlibc/x86_64/sigaction.c b/mdk-stage1/dietlibc/x86_64/sigaction.c
new file mode 100644
index 000000000..18f32efde
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/sigaction.c
@@ -0,0 +1,26 @@
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syscalls.h>
+
+int __rt_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact, long nr);
+
+static void restore_rt(void) {
+ asm volatile ("syscall" : : "a" (__NR_rt_sigreturn));
+}
+
+int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
+int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
+ struct sigaction *newact = (struct sigaction *)act;
+ if (act) {
+ newact = alloca(sizeof(*newact));
+ newact->sa_handler = act->sa_handler;
+ newact->sa_flags = act->sa_flags | SA_RESTORER;
+ newact->sa_restorer = &restore_rt;
+ newact->sa_mask = act->sa_mask;
+ }
+ return __rt_sigaction(signum, newact, oldact, _NSIG/8);
+}
+
+int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
+__attribute__((weak,alias("__libc_sigaction")));
diff --git a/mdk-stage1/dietlibc/x86_64/socket.S b/mdk-stage1/dietlibc/x86_64/socket.S
new file mode 100644
index 000000000..cc453881f
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/socket.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(socket, socket);
diff --git a/mdk-stage1/dietlibc/x86_64/socketpair.S b/mdk-stage1/dietlibc/x86_64/socketpair.S
new file mode 100644
index 000000000..d92eaa4d8
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/socketpair.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(socketpair, socketpair);
diff --git a/mdk-stage1/dietlibc/x86_64/start.S b/mdk-stage1/dietlibc/x86_64/start.S
new file mode 100644
index 000000000..5e8356350
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/start.S
@@ -0,0 +1,55 @@
+#include "dietfeatures.h"
+
+.text
+.global _start
+_start:
+#ifdef WANT_DYNAMIC
+ movq %rdx, %rcx /* %rcx = dynamic fini */
+#endif
+ popq %rdi /* %rdi = argc */
+ movq %rsp,%rsi /* %rsi = argv */
+ pushq %rdi
+
+ leaq 8(%rsi,%rdi,8),%rdx /* %rdx = envp = (8*rdi)+%rsi+8 */
+
+#ifdef __DYN_LIB
+ movq environ@GOTPCREL(%rip), %rax
+ movq %rdx, (%rax)
+#else
+ movq %rdx, environ(%rip)
+#endif
+
+#ifdef PROFILING
+ pushq %rdi /* save reg args */
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+
+ leaq _etext(%rip), %rsi /* highpc */
+ leaq .text(%rip), %rdi /* lowpc */
+ call monitor
+
+ popq %rcx /* restore reg args */
+ popq %rdx
+ popq %rsi
+ popq %rdi
+#endif
+
+#ifdef WANT_DYNAMIC
+ call _dyn_start
+#else
+ call main
+#endif
+
+#ifdef PROFILING
+ pushq %rax
+ call _stop_monitor
+ popq %rdi
+#else
+ movq %rax, %rdi /* return value */
+#endif
+ call exit
+ hlt
+.Lstart:
+ .size _start,.Lstart-_start
+
diff --git a/mdk-stage1/dietlibc/x86_64/syscalls.h b/mdk-stage1/dietlibc/x86_64/syscalls.h
new file mode 100644
index 000000000..6fcfbfc60
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/syscalls.h
@@ -0,0 +1,282 @@
+#define __NR_read 0
+#define __NR_write 1
+#define __NR_open 2
+#define __NR_close 3
+#define __NR_stat 4
+#define __NR_fstat 5
+#define __NR_lstat 6
+#define __NR_poll 7
+
+#define __NR_lseek 8
+#define __NR_mmap 9
+#define __NR_mprotect 10
+#define __NR_munmap 11
+#define __NR_brk 12
+#define __NR_rt_sigaction 13
+#define __NR_rt_sigprocmask 14
+#define __NR_rt_sigreturn 15
+
+#define __NR_ioctl 16
+#define __NR_pread 17
+#define __NR_pwrite 18
+#define __NR_readv 19
+#define __NR_writev 20
+#define __NR_access 21
+#define __NR_pipe 22
+#define __NR_select 23
+
+#define __NR_sched_yield 24
+#define __NR_mremap 25
+#define __NR_msync 26
+#define __NR_mincore 27
+#define __NR_madvise 28
+#define __NR_shmget 29
+#define __NR_shmat 30
+#define __NR_shmctl 31
+
+#define __NR_dup 32
+#define __NR_dup2 33
+#define __NR_pause 34
+#define __NR_nanosleep 35
+#define __NR_getitimer 36
+#define __NR_alarm 37
+#define __NR_setitimer 38
+#define __NR_getpid 39
+
+#define __NR_sendfile 40
+#define __NR_socket 41
+#define __NR_connect 42
+#define __NR_accept 43
+#define __NR_sendto 44
+#define __NR_recvfrom 45
+#define __NR_sendmsg 46
+#define __NR_recvmsg 47
+
+#define __NR_shutdown 48
+#define __NR_bind 49
+#define __NR_listen 50
+#define __NR_getsockname 51
+#define __NR_getpeername 52
+#define __NR_socketpair 53
+#define __NR_setsockopt 54
+#define __NR_getsockopt 55
+
+#define __NR_clone 56
+#define __NR_fork 57
+#define __NR_vfork 58
+#define __NR_execve 59
+#define __NR_exit 60
+#define __NR_wait4 61
+#define __NR_kill 62
+#define __NR_uname 63
+
+#define __NR_semget 64
+#define __NR_semop 65
+#define __NR_semctl 66
+#define __NR_shmdt 67
+#define __NR_msgget 68
+#define __NR_msgsnd 69
+#define __NR_msgrcv 70
+#define __NR_msgctl 71
+
+#define __NR_fcntl 72
+#define __NR_flock 73
+#define __NR_fsync 74
+#define __NR_fdatasync 75
+#define __NR_truncate 76
+#define __NR_ftruncate 77
+#define __NR_getdents 78
+#define __NR_getcwd 79
+
+#define __NR_chdir 80
+#define __NR_fchdir 81
+#define __NR_rename 82
+#define __NR_mkdir 83
+#define __NR_rmdir 84
+#define __NR_creat 85
+#define __NR_link 86
+#define __NR_unlink 87
+
+#define __NR_symlink 88
+#define __NR_readlink 89
+#define __NR_chmod 90
+#define __NR_fchmod 91
+#define __NR_chown 92
+#define __NR_fchown 93
+#define __NR_lchown 94
+#define __NR_umask 95
+
+#define __NR_gettimeofday 96
+#define __NR_getrlimit 97
+#define __NR_getrusage 98
+#define __NR_sysinfo 99
+#define __NR_times 100
+#define __NR_ptrace 101
+#define __NR_getuid 102
+#define __NR_syslog 103
+
+/* at the very end the stuff that never runs during the benchmarks */
+#define __NR_getgid 104
+#define __NR_setuid 105
+#define __NR_setgid 106
+#define __NR_geteuid 107
+#define __NR_getegid 108
+#define __NR_setpgid 109
+#define __NR_getppid 110
+#define __NR_getpgrp 111
+
+#define __NR_setsid 112
+#define __NR_setreuid 113
+#define __NR_setregid 114
+#define __NR_getgroups 115
+#define __NR_setgroups 116
+#define __NR_setresuid 117
+#define __NR_getresuid 118
+#define __NR_setresgid 119
+
+#define __NR_getresgid 120
+#define __NR_getpgid 121
+#define __NR_setfsuid 122
+#define __NR_setfsgid 123
+#define __NR_getsid 124
+#define __NR_capget 125
+#define __NR_capset 126
+
+#define __NR_rt_sigpending 127
+#define __NR_rt_sigtimedwait 128
+#define __NR_rt_sigqueueinfo 129
+#define __NR_rt_sigsuspend 130
+#define __NR_sigaltstack 131
+#define __NR_utime 132
+#define __NR_mknod 133
+
+#define __NR_uselib 134
+#define __NR_personality 135
+
+#define __NR_ustat 136
+#define __NR_statfs 137
+#define __NR_fstatfs 138
+#define __NR_sysfs 139
+
+#define __NR_getpriority 140
+#define __NR_setpriority 141
+#define __NR_sched_setparam 142
+#define __NR_sched_getparam 143
+#define __NR_sched_setscheduler 144
+#define __NR_sched_getscheduler 145
+#define __NR_sched_get_priority_max 146
+#define __NR_sched_get_priority_min 147
+#define __NR_sched_rr_get_interval 148
+
+#define __NR_mlock 149
+#define __NR_munlock 150
+#define __NR_mlockall 151
+#define __NR_munlockall 152
+
+#define __NR_vhangup 153
+
+#define __NR_modify_ldt 154
+
+#define __NR_pivot_root 155
+
+#define __NR__sysctl 156
+
+#define __NR_prctl 157
+#define __NR_arch_prctl 158
+
+#define __NR_adjtimex 159
+
+#define __NR_setrlimit 160
+
+#define __NR_chroot 161
+
+#define __NR_sync 162
+
+#define __NR_acct 163
+
+#define __NR_settimeofday 164
+
+#define __NR_mount 165
+#define __NR_umount2 166
+
+#define __NR_swapon 167
+#define __NR_swapoff 168
+
+#define __NR_reboot 169
+
+#define __NR_sethostname 170
+#define __NR_setdomainname 171
+
+#define __NR_iopl 172
+#define __NR_ioperm 173
+
+#define __NR_create_module 174
+#define __NR_init_module 175
+#define __NR_delete_module 176
+#define __NR_get_kernel_syms 177
+#define __NR_query_module 178
+
+#define __NR_quotactl 179
+
+#define __NR_nfsservctl 180
+
+#define __NR_getpmsg 181
+#define __NR_putpmsg 182
+
+#define __NR_afs_syscall 183
+
+#define __NR_tuxcall 184 /* reserved for tux */
+
+#define __NR_security 185 /* reserved for security */
+
+#define __NR_gettid 186
+
+#define __NR_readahead 187
+
+#define __NR_setxattr 188
+#define __NR_lsetxattr 189
+#define __NR_fsetxattr 190
+#define __NR_getxattr 191
+#define __NR_lgetxattr 192
+#define __NR_fgetxattr 193
+#define __NR_listxattr 194
+#define __NR_llistxattr 195
+#define __NR_flistxattr 196
+#define __NR_removexattr 197
+#define __NR_lremovexattr 198
+#define __NR_fremovexattr 199
+#define __NR_tkill 200 /* 2.5 only */
+#define __NR_time 201
+#define __NR_futex 202 /* 2.5 only */
+#define __NR_sched_setaffinity 203
+#define __NR_sched_getaffinity 204
+#define __NR_set_thread_area 205
+#define __NR_io_setup 206
+#define __NR_io_destroy 207
+#define __NR_io_getevents 208
+#define __NR_io_submit 209
+#define __NR_io_cancel 210
+#define __NR_get_thread_area 211
+#define __NR_lookup_dcookie 212
+
+#define __NR_syscall_max __NR_futex
+
+#define syscall_weak(name,wsym,sym) \
+.text; \
+.type wsym,@function; \
+.weak wsym; \
+wsym: ; \
+.type sym,@function; \
+.global sym; \
+sym: \
+ mov $__NR_##name,%al; \
+ jmp __unified_syscall
+
+#define syscall(name,sym) \
+.text; \
+.type sym,@function; \
+.global sym; \
+sym: \
+ mov $__NR_##name,%al; \
+ jmp __unified_syscall
+
diff --git a/mdk-stage1/dietlibc/x86_64/umount.S b/mdk-stage1/dietlibc/x86_64/umount.S
new file mode 100644
index 000000000..2b51b8edf
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/umount.S
@@ -0,0 +1,9 @@
+#include "syscalls.h"
+
+.text
+.global umount
+.type umount,@function
+umount:
+ mov $__NR_umount2,%al
+ xorq %rsi,%rsi
+ jmp __unified_syscall
diff --git a/mdk-stage1/dietlibc/x86_64/unified.S b/mdk-stage1/dietlibc/x86_64/unified.S
new file mode 100644
index 000000000..48bb9a4fa
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/unified.S
@@ -0,0 +1,32 @@
+#include <dietfeatures.h>
+
+#define SYS_exit 0x3c
+
+.text
+.weak exit
+exit:
+.global _exit
+_exit:
+ mov $SYS_exit,%al
+
+#ifndef __DYN_LIB
+.global __unified_syscall
+#endif
+__unified_syscall:
+ movzbl %al, %eax
+ mov %rcx, %r10
+ syscall
+ cmpq $-128, %rax
+ jbe .Lnoerror
+ negl %eax
+ pushq %rax
+ call __errno_location
+ popq %rcx
+ movl %ecx,(%rax)
+ orq $-1, %rax
+.Lnoerror:
+
+/* here we go and "reuse" the return for weak-void functions */
+#include "dietuglyweaks.h"
+
+ ret
diff --git a/mdk-stage1/dietlibc/x86_64/waitpid.S b/mdk-stage1/dietlibc/x86_64/waitpid.S
new file mode 100644
index 000000000..944df48bf
--- /dev/null
+++ b/mdk-stage1/dietlibc/x86_64/waitpid.S
@@ -0,0 +1,12 @@
+#include "syscalls.h"
+
+.text
+.type waitpid,@function
+.weak waitpid
+waitpid:
+.type __libc_waitpid,@function
+.global __libc_waitpid
+__libc_waitpid:
+ mov $0,%rcx
+ mov $__NR_wait4,%al
+ jmp __unified_syscall
diff --git a/mdk-stage1/disk.c b/mdk-stage1/disk.c
index a9a31d3d7..375727fdf 100644
--- a/mdk-stage1/disk.c
+++ b/mdk-stage1/disk.c
@@ -176,7 +176,7 @@ static enum return_type try_with_device(char *dev_name)
}
while (fgets(buf, sizeof(buf), f)) {
- bzero(name, sizeof(name));
+ memset(name, 0, 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);
diff --git a/mdk-stage1/dns.c b/mdk-stage1/dns.c
index d1e67c78d..266864d37 100644
--- a/mdk-stage1/dns.c
+++ b/mdk-stage1/dns.c
@@ -23,7 +23,7 @@
// dietlibc can do hostname lookup, whereas glibc can't when linked statically :-(
-#ifdef __LIBC_DIETLIBC__
+#if defined(__dietlibc__)
#include <unistd.h>
#include <string.h>
@@ -67,14 +67,13 @@ char * mygethostbyaddr(char * ipnum)
struct hostent * host;
if (!inet_aton(ipnum, &in))
return NULL;
- host = gethostbyaddr(&in, strlen((void *) &in), AF_INET);
+ host = gethostbyaddr(&in.s_addr, sizeof(in.s_addr) /* INADDRSZ */, AF_INET);
if (host && host->h_name)
return host->h_name;
return NULL;
}
-
-#else // __LIBC_DIETLIBC__
+#elif defined(__GLIBC__)
#include <alloca.h>
#include <sys/socket.h>
@@ -210,4 +209,8 @@ int mygethostbyname(char * name, struct in_addr * addr) {
return rc;
}
+#else
+
+#error "Unsupported C library"
+
#endif
diff --git a/mdk-stage1/frontend.h b/mdk-stage1/frontend.h
index 4f2d112b7..3f58a3d3f 100644
--- a/mdk-stage1/frontend.h
+++ b/mdk-stage1/frontend.h
@@ -21,7 +21,13 @@
#include <stdarg.h>
-
+/* 'unused' atttribute, gcc specific and just to turn down some warnings. */
+#if defined __GNUC__
+#define UNUSED __attribute__((unused))
+#else
+#define UNUSED
+#endif
+
enum return_type { RETURN_OK, RETURN_BACK, RETURN_ERROR };
void init_frontend(char * welcome_msg);
diff --git a/mdk-stage1/init-libc-headers.h b/mdk-stage1/init-libc-headers.h
index 01761e869..1e6807615 100644
--- a/mdk-stage1/init-libc-headers.h
+++ b/mdk-stage1/init-libc-headers.h
@@ -35,6 +35,7 @@
#include <sys/wait.h>
#include <linux/unistd.h>
#include <sys/select.h>
+#include <sys/ioctl.h>
#ifndef SOCK_STREAM
#define SOCK_STREAM 1
diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c
index dc4239ac3..73258230a 100644
--- a/mdk-stage1/init.c
+++ b/mdk-stage1/init.c
@@ -33,7 +33,11 @@
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",
+ "LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/usr/X11R6/lib:/mnt/usr/X11R6/lib"
+#if defined(__x86_64__) || defined(__ppc64__)
+ ":/lib64:/usr/lib64:/usr/X11R6/lib64:/mnt/lib64:/mnt/usr/lib64:/mnt/usr/X11R6/lib64"
+#endif
+ ,
"HOME=/",
"TERM=linux",
"TERMINFO=/etc/terminfo",
diff --git a/mdk-stage1/insmod-busybox/Config.h b/mdk-stage1/insmod-busybox/Config.h
index 8388416b7..f02ac0253 100644
--- a/mdk-stage1/insmod-busybox/Config.h
+++ b/mdk-stage1/insmod-busybox/Config.h
@@ -49,10 +49,11 @@
//#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 insmod/lsmod/rmmod for post 2.1 kernels
+#define BB_FEATURE_NEW_MODULE_INTERFACE
+//
+// Support insmod/lsmod/rmmod for pre 2.1 kernels
+//#define BB_FEATURE_OLD_MODULE_INTERFACE
//
// Support module version checking
//#define BB_FEATURE_INSMOD_VERSION_CHECKING
@@ -126,7 +127,7 @@
#endif
//
#if defined BB_INSMOD
-#ifndef BB_FEATURE_INSMOD_OLD_KERNEL
-#define BB_FEATURE_INSMOD_NEW_KERNEL
+#if ! defined BB_FEATURE_NEW_MODULE_INTERFACE && ! defined BB_FEATURE_OLD_MODULE_INTERFACE
+#define BB_FEATURE_NEW_MODULE_INTERFACE
#endif
#endif
diff --git a/mdk-stage1/insmod-busybox/Makefile b/mdk-stage1/insmod-busybox/Makefile
index c8649ae0d..236874f96 100644
--- a/mdk-stage1/insmod-busybox/Makefile
+++ b/mdk-stage1/insmod-busybox/Makefile
@@ -13,53 +13,31 @@ top_dir = ..
include $(top_dir)/Makefile.common
-all: insmod insmod-DIET libinsmod.a libinsmod-DIET.a
+all: insmod libinsmod.a
clean:
- rm -f *.o insmod insmod-DIET libinsmod.a libinsmod-DIET.a
+ rm -f *.o insmod libinsmod.a
-FLAGS = -c -Wall -Os -fomit-frame-pointer -D_GNU_SOURCE -DBB_VER='"0.47"' -DBB_BT='"2000.12.06-14:02+0000"'
+FLAGS = -c -Wall -Os -fomit-frame-pointer -D_GNU_SOURCE -DBB_VER='"0.60.5"' -DBB_BT='"2003.04.16-15:25+0000"'
insmod: insmod-frontend.o insmod.o utility-standalone.o
- gcc -o $@ $^
+ $(DIET) gcc -o $@ $^
$(STRIPCMD) $@
-insmod-DIET: insmod-frontend-DIET.o insmod-DIET.o utility-standalone-DIET.o
- gcc $(DIETLIBC_LDFLAGS_STAGE1) -o $@ $^ $(DIETLIBC_LIBC)
- $(STRIPCMD) $@
-
-
libinsmod.a: insmod.o utility.o
ar cru $@ $^
ranlib $@
-libinsmod-DIET.a: insmod-DIET.o utility-DIET.o
- ar cru $@ $^
- ranlib $@
-
insmod-frontend.o: insmod-frontend.c busybox.h
- gcc $(FLAGS) $(GLIBC_INCLUDES) insmod-frontend.c
-
-insmod-frontend-DIET.o: insmod-frontend.c busybox.h
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -o $@ insmod-frontend.c
+ $(DIET) gcc $(FLAGS) $(INCLUDES) insmod-frontend.c
utility.o: utility.c busybox.h
- gcc $(FLAGS) $(GLIBC_INCLUDES) utility.c
-
-utility-DIET.o: utility.c busybox.h
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -o $@ utility.c
+ $(DIET) gcc $(FLAGS) $(INCLUDES) utility.c
utility-standalone.o: utility.c busybox.h
- gcc $(FLAGS) $(GLIBC_INCLUDES) -o $@ -D_STANDALONE_ utility.c
-
-utility-standalone-DIET.o: utility.c busybox.h
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -o $@ -D_STANDALONE_ utility.c
+ $(DIET) gcc $(FLAGS) $(INCLUDES) -o $@ -D_STANDALONE_ utility.c
insmod.o: insmod.c busybox.h
- gcc $(FLAGS) $(GLIBC_INCLUDES) insmod.c
-
-insmod-DIET.o: insmod.c busybox.h
- gcc $(FLAGS) $(DIETLIBC_INCLUDES) -o $@ insmod.c
-
+ $(DIET) gcc $(FLAGS) $(INCLUDES) insmod.c
diff --git a/mdk-stage1/insmod-busybox/busybox.h b/mdk-stage1/insmod-busybox/busybox.h
index a2d620c8b..9e6052fce 100644
--- a/mdk-stage1/insmod-busybox/busybox.h
+++ b/mdk-stage1/insmod-busybox/busybox.h
@@ -464,4 +464,14 @@ extern int sysinfo (struct sysinfo* info);
#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
#endif
+/* Merge from busybox 0.60.5 */
+#define error_msg errorMsg
+#define perror_msg(FORMAT,...) error_msg(FORMAT ": %s", ## __VA_ARGS__, strerror(errno))
+#define recursive_action recursiveAction
+
+#define safe_strncpy(DST, SRC, SIZE) do { \
+ (DST)[SIZE-1] = '\0'; \
+ return strncpy((DST), (SRC),(SIZE)-1); \
+} while (0)
+
#endif /* _BB_INTERNAL_H_ */
diff --git a/mdk-stage1/insmod-busybox/insmod.c b/mdk-stage1/insmod-busybox/insmod.c
index bdf7ba5f7..e86054f97 100644
--- a/mdk-stage1/insmod-busybox/insmod.c
+++ b/mdk-stage1/insmod-busybox/insmod.c
@@ -2,16 +2,40 @@
/*
* Mini insmod implementation for busybox
*
- * Copyright (C) 1999,2000 by Lineo, inc.
- * Written by Erik Andersen <andersen@lineo.com>
- * and Ron Alder <alder@lineo.com>
+ * This version of insmod supports x86, ARM, SH3/4, powerpc, m68k,
+ * MIPS, and x86-64.
+ *
+ *
+ * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
+ * Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
+ * Written by Erik Andersen and Ron Alder <alder@lineo.com>
*
* Modified by Bryan Rittmeyer <bryan@ixiacom.com> to support SH4
- * and (theoretically) SH3. Note that there is still no true
- * multiple architecture support. You just get SH3|SH4|i386, despite
- * the mention of ARM and m68k--which may or may not work (but
- * almost certainly do not, due to at least MATCH_MACHINE). I have
- * only tested SH4 in little endian mode.
+ * and (theoretically) SH3. I have only tested SH4 in little endian mode.
+ *
+ * Modified by Alcove, Julien Gaulmin <julien.gaulmin@alcove.fr> and
+ * Nicolas Ferre <nicolas.ferre@alcove.fr> to support ARM7TDMI. Only
+ * very minor changes required to also work with StrongArm and presumably
+ * all ARM based systems.
+ *
+ * Magnus Damm <damm@opensource.se> 22-May-2002.
+ * The plt and got code are now using the same structs.
+ * Added generic linked list code to fully support PowerPC.
+ * Replaced the mess in arch_apply_relocation() with architecture blocks.
+ * The arch_create_got() function got cleaned up with architecture blocks.
+ * These blocks should be easy maintain and sync with obj_xxx.c in modutils.
+ *
+ * Magnus Damm <damm@opensource.se> added PowerPC support 20-Feb-2001.
+ * PowerPC specific code stolen from modutils-2.3.16,
+ * written by Paul Mackerras, Copyright 1996, 1997 Linux International.
+ * I've only tested the code on mpc8xx platforms in big-endian mode.
+ * Did some cleanup and added BB_USE_xxx_ENTRIES...
+ *
+ * Quinn Jensen <jensenq@lineo.com> added MIPS support 23-Feb-2001.
+ * based on modutils-2.4.2
+ * MIPS specific support for Elf loading and relocation.
+ * Copyright 1996, 1997 Linux International.
+ * Contributed by Ralf Baechle <ralf@gnu.ai.mit.edu>
*
* Based almost entirely on the Linux modutils-2.3.11 implementation.
* Copyright 1996, 1997 Linux International.
@@ -37,7 +61,6 @@
*/
#include "../insmod.h"
-#include "busybox.h"
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
@@ -46,7 +69,133 @@
#include <dirent.h>
#include <ctype.h>
#include <assert.h>
+#include <string.h>
+#include <fcntl.h>
#include <sys/utsname.h>
+#include "busybox.h"
+
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
+# undef BB_FEATURE_OLD_MODULE_INTERFACE
+# define new_sys_init_module init_module
+#else
+# define old_sys_init_module init_module
+#endif
+
+#ifdef BB_FEATURE_INSMOD_LOADINKMEM
+#define LOADBITS 0
+#else
+#define LOADBITS 1
+#endif
+
+#if defined(__arm__)
+#define BB_USE_PLT_ENTRIES
+#define BB_PLT_ENTRY_SIZE 8
+#define BB_USE_GOT_ENTRIES
+#define BB_GOT_ENTRY_SIZE 8
+#define BB_USE_SINGLE
+
+#define MATCH_MACHINE(x) (x == EM_ARM)
+#define SHT_RELM SHT_REL
+#define Elf32_RelM Elf32_Rel
+#define ELFCLASSM ELFCLASS32
+#endif
+
+#if defined(__i386__)
+#define BB_USE_GOT_ENTRIES
+#define BB_GOT_ENTRY_SIZE 4
+#define BB_USE_SINGLE
+
+#ifndef EM_486
+#define MATCH_MACHINE(x) (x == EM_386)
+#else
+#define MATCH_MACHINE(x) (x == EM_386 || x == EM_486)
+#endif
+
+#define SHT_RELM SHT_REL
+#define Elf32_RelM Elf32_Rel
+#define ELFCLASSM ELFCLASS32
+#endif
+
+#if defined(__x86_64__)
+#define BB_USE_GOT_ENTRIES
+#define BB_GOT_ENTRY_SIZE 8
+#define BB_USE_SINGLE
+
+#define MATCH_MACHINE(x) (x == EM_X86_64)
+
+#define SHT_RELM SHT_RELA
+#define Elf64_RelM Elf64_Rela
+#define ELFCLASSM ELFCLASS64
+#endif
+
+#if defined(__mc68000__)
+#define BB_USE_GOT_ENTRIES
+#define BB_GOT_ENTRY_SIZE 4
+#define BB_USE_SINGLE
+
+#define MATCH_MACHINE(x) (x == EM_68K)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#endif
+
+#if defined(__mips__)
+/* Account for ELF spec changes. */
+#ifndef EM_MIPS_RS3_LE
+#ifdef EM_MIPS_RS4_BE
+#define EM_MIPS_RS3_LE EM_MIPS_RS4_BE
+#else
+#define EM_MIPS_RS3_LE 10
+#endif
+#endif /* !EM_MIPS_RS3_LE */
+
+#define MATCH_MACHINE(x) (x == EM_MIPS || x == EM_MIPS_RS3_LE)
+#define SHT_RELM SHT_REL
+#define Elf32_RelM Elf32_Rel
+#define ELFCLASSM ELFCLASS32
+#define ARCHDATAM "__dbe_table"
+#endif
+
+#if defined(__powerpc__)
+#define BB_USE_PLT_ENTRIES
+#define BB_PLT_ENTRY_SIZE 16
+#define BB_USE_PLT_LIST
+#define BB_LIST_ARCHTYPE ElfW(Addr)
+#define BB_USE_LIST
+
+#define MATCH_MACHINE(x) (x == EM_PPC)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
+#define ARCHDATAM "__ftr_fixup"
+#endif
+
+#if defined(__sh__)
+#define BB_USE_GOT_ENTRIES
+#define BB_GOT_ENTRY_SIZE 4
+#define BB_USE_SINGLE
+
+#define MATCH_MACHINE(x) (x == EM_SH)
+#define SHT_RELM SHT_RELA
+#define Elf32_RelM Elf32_Rela
+#define ELFCLASSM ELFCLASS32
+
+/* the SH changes have only been tested on the SH4 in =little endian= mode */
+/* I'm not sure about big endian, so let's warn: */
+
+#if (defined(__SH4__) || defined(__SH3__)) && defined(__BIG_ENDIAN__)
+#error insmod.c may require changes for use on big endian SH4/SH3
+#endif
+
+/* it may or may not work on the SH1/SH2... So let's error on those
+ also */
+#if (defined(__sh__) && (!(defined(__SH3__) || defined(__SH4__))))
+#error insmod.c may require changes for non-SH3/SH4 use
+#endif
+#endif
+
+#ifndef SHT_RELM
+#error Sorry, but insmod.c does not yet support this architecture...
+#endif
//----------------------------------------------------------------------------
//--------modutils module.h, lines 45-242
@@ -75,9 +224,7 @@
#ifndef MODUTILS_MODULE_H
-#define MODUTILS_MODULE_H 1
-
-#ident "$Id$"
+#define MODUTILS_MODULE_H
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -134,7 +281,7 @@ struct old_module
};
/* Sent to init_module(2) or'ed into the code size parameter. */
-#define OLD_MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */
+static const int OLD_MOD_AUTOCLEAN = 0x40000000; /* big enough, but no sign problems... */
int get_kernel_syms(struct old_kernel_sym *);
int old_sys_init_module(const char *name, char *code, unsigned codesize,
@@ -157,9 +304,9 @@ int old_sys_init_module(const char *name, char *code, unsigned codesize,
#undef tgt_sizeof_char_p
#undef tgt_sizeof_void_p
#undef tgt_long
-#define tgt_sizeof_long 8
-#define tgt_sizeof_char_p 8
-#define tgt_sizeof_void_p 8
+static const int tgt_sizeof_long = 8;
+static const int tgt_sizeof_char_p = 8;
+static const int tgt_sizeof_void_p = 8;
#define tgt_long long long
#endif
@@ -210,8 +357,23 @@ struct new_module
unsigned tgt_long persist_end;
unsigned tgt_long can_unload;
unsigned tgt_long runsize;
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
+ const char *kallsyms_start; /* All symbols for kernel debugging */
+ const char *kallsyms_end;
+ const char *archdata_start; /* arch specific data for module */
+ const char *archdata_end;
+ const char *kernel_data; /* Reserved for kernel internal use */
+#endif
};
+#ifdef ARCHDATAM
+#define ARCHDATA_SEC_NAME ARCHDATAM
+#else
+#define ARCHDATA_SEC_NAME "__archdata"
+#endif
+#define KALLSYMS_SEC_NAME "__kallsyms"
+
+
struct new_module_info
{
unsigned long addr;
@@ -221,11 +383,11 @@ struct new_module_info
};
/* Bits of module.flags. */
-#define NEW_MOD_RUNNING 1
-#define NEW_MOD_DELETED 2
-#define NEW_MOD_AUTOCLEAN 4
-#define NEW_MOD_VISITED 8
-#define NEW_MOD_USED_ONCE 16
+static const int NEW_MOD_RUNNING = 1;
+static const int NEW_MOD_DELETED = 2;
+static const int NEW_MOD_AUTOCLEAN = 4;
+static const int NEW_MOD_VISITED = 8;
+static const int NEW_MOD_USED_ONCE = 16;
int new_sys_init_module(const char *name, const struct new_module *);
int query_module(const char *name, int which, void *buf, size_t bufsize,
@@ -233,11 +395,11 @@ int query_module(const char *name, int which, void *buf, size_t bufsize,
/* Values for query_module's which. */
-#define QM_MODULES 1
-#define QM_DEPS 2
-#define QM_REFS 3
-#define QM_SYMBOLS 4
-#define QM_INFO 5
+static const int QM_MODULES = 1;
+static const int QM_DEPS = 2;
+static const int QM_REFS = 3;
+static const int QM_SYMBOLS = 4;
+static const int QM_INFO = 5;
/*======================================================================*/
/* The system calls unchanged between 2.0 and 2.1. */
@@ -281,52 +443,18 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
-#define MODUTILS_OBJ_H 1
-
-#ident "$Id$"
+static const int MODUTILS_OBJ_H = 1;
/* The relocatable object is manipulated using elfin types. */
#include <stdio.h>
#include <elf.h>
+#include <endian.h>
-
-/* Machine-specific elf macros for i386 et al. */
-
-/* the SH changes have only been tested on the SH4 in =little endian= mode */
-/* I'm not sure about big endian, so let's warn: */
-
-#if (defined(__SH4__) || defined(__SH3__)) && defined(__BIG_ENDIAN__)
-#error insmod.c may require changes for use on big endian SH4/SH3
-#endif
-
-/* it may or may not work on the SH1/SH2... So let's error on those
- also */
-#if (defined(__sh__) && (!(defined(__SH3__) || defined(__SH4__))))
-#error insmod.c may require changes for non-SH3/SH4 use
-#endif
-
-#define ELFCLASSM ELFCLASS32
-#define ELFDATAM ELFDATA2LSB
-
-
-
-#if defined(__sh__)
-
-#define MATCH_MACHINE(x) (x == EM_SH)
-#define SHT_RELM SHT_RELA
-#define Elf32_RelM Elf32_Rela
-
-#else
-
-/* presumably we can use these for anything but the SH */
-/* this is the previous behavior, but it does result in
- insmod.c being broken on anything except i386 */
-
-#define MATCH_MACHINE(x) (x == EM_386)
-#define SHT_RELM SHT_REL
-#define Elf32_RelM Elf32_Rel
-
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ELFDATAM ELFDATA2LSB
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define ELFDATAM ELFDATA2MSB
#endif
#ifndef ElfW
@@ -421,78 +549,79 @@ struct obj_symbol_patch
/* Generic object manipulation routines. */
-unsigned long obj_elf_hash(const char *);
-
-unsigned long obj_elf_hash_n(const char *, unsigned long len);
+static unsigned long obj_elf_hash(const char *);
-struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name,
- unsigned long symidx, int info, int secidx,
- ElfW(Addr) value, unsigned long size);
+static unsigned long obj_elf_hash_n(const char *, unsigned long len);
-struct obj_symbol *obj_find_symbol (struct obj_file *f,
+static struct obj_symbol *obj_find_symbol (struct obj_file *f,
const char *name);
-ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
+static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
struct obj_symbol *sym);
-void obj_set_symbol_compare(struct obj_file *f,
+#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
+static void obj_set_symbol_compare(struct obj_file *f,
int (*cmp)(const char *, const char *),
unsigned long (*hash)(const char *));
+#endif
-struct obj_section *obj_find_section (struct obj_file *f,
+static struct obj_section *obj_find_section (struct obj_file *f,
const char *name);
-void obj_insert_section_load_order (struct obj_file *f,
+static void obj_insert_section_load_order (struct obj_file *f,
struct obj_section *sec);
-struct obj_section *obj_create_alloced_section (struct obj_file *f,
+static struct obj_section *obj_create_alloced_section (struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size);
-struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
+static struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size);
-void *obj_extend_section (struct obj_section *sec, unsigned long more);
+static void *obj_extend_section (struct obj_section *sec, unsigned long more);
-int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
+static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
const char *string);
-int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
+static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
struct obj_symbol *sym);
+#endif
-int obj_check_undefineds(struct obj_file *f);
+static int obj_check_undefineds(struct obj_file *f);
-void obj_allocate_commons(struct obj_file *f);
+static void obj_allocate_commons(struct obj_file *f);
-unsigned long obj_load_size (struct obj_file *f);
+static unsigned long obj_load_size (struct obj_file *f);
-int obj_relocate (struct obj_file *f, ElfW(Addr) base);
+static int obj_relocate (struct obj_file *f, ElfW(Addr) base);
-struct obj_file *obj_load(FILE *f);
+static struct obj_file *obj_load(FILE *f, int loadprogbits);
-int obj_create_image (struct obj_file *f, char *image);
+static int obj_create_image (struct obj_file *f, char *image);
/* Architecture specific manipulation routines. */
-struct obj_file *arch_new_file (void);
+static struct obj_file *arch_new_file (void);
-struct obj_section *arch_new_section (void);
+static struct obj_section *arch_new_section (void);
-struct obj_symbol *arch_new_symbol (void);
+static struct obj_symbol *arch_new_symbol (void);
-enum obj_reloc arch_apply_relocation (struct obj_file *f,
+static enum obj_reloc arch_apply_relocation (struct obj_file *f,
struct obj_section *targsec,
struct obj_section *symsec,
struct obj_symbol *sym,
ElfW(RelM) *rel, ElfW(Addr) value);
-int arch_create_got (struct obj_file *f);
+static void arch_create_got (struct obj_file *f);
-struct new_module;
-int arch_init_module (struct obj_file *f, struct new_module *);
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
+static int arch_init_module (struct obj_file *f, struct new_module *);
+#endif
#endif /* obj.h */
//----------------------------------------------------------------------------
@@ -504,41 +633,75 @@ int arch_init_module (struct obj_file *f, struct new_module *);
#define _PATH_MODULES "/lib/modules"
-#define STRVERSIONLEN 32
-
-#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL)
-#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined"
-#endif
+static const int STRVERSIONLEN = 32;
/*======================================================================*/
-int flag_force_load = 1;
-int flag_autoclean = 0;
-int flag_export = 1;
+static const int flag_force_load = 1;
+static const int flag_autoclean = 0;
+static const int flag_quiet = 0;
+static const int flag_export = 1;
/*======================================================================*/
-/* previously, these were named i386_* but since we could be
- compiling for the sh, I've renamed them to the more general
- arch_* These structures are the same between the x86 and SH,
- and we can't support anything else right now anyway. In the
- future maybe they should be #if defined'd */
+#if defined(BB_USE_LIST)
+
+struct arch_list_entry
+{
+ struct arch_list_entry *next;
+ BB_LIST_ARCHTYPE addend;
+ int offset;
+ int inited : 1;
+};
+
+#endif
+
+#if defined(BB_USE_SINGLE)
-struct arch_got_entry {
+struct arch_single_entry
+{
int offset;
- unsigned offset_done:1;
- unsigned reloc_done:1;
+ int inited : 1;
+ int allocated : 1;
};
+#endif
+
+#if defined(__mips__)
+struct mips_hi16
+{
+ struct mips_hi16 *next;
+ Elf32_Addr *addr;
+ Elf32_Addr value;
+};
+#endif
+
struct arch_file {
struct obj_file root;
+#if defined(BB_USE_PLT_ENTRIES)
+ struct obj_section *plt;
+#endif
+#if defined(BB_USE_GOT_ENTRIES)
struct obj_section *got;
+#endif
+#if defined(__mips__)
+ struct mips_hi16 *mips_hi16_list;
+#endif
};
struct arch_symbol {
struct obj_symbol root;
- struct arch_got_entry gotent;
+#if defined(BB_USE_PLT_ENTRIES)
+#if defined(BB_USE_PLT_LIST)
+ struct arch_list_entry *pltent;
+#else
+ struct arch_single_entry pltent;
+#endif
+#endif
+#if defined(BB_USE_GOT_ENTRIES)
+ struct arch_single_entry gotent;
+#endif
};
@@ -550,308 +713,736 @@ struct external_module {
struct new_module_symbol *syms;
};
-struct new_module_symbol *ksyms;
-size_t nksyms;
+static struct new_module_symbol *ksyms;
+static size_t nksyms;
-struct external_module *ext_modules;
-int n_ext_modules;
-int n_ext_modules_used;
-
-
-
-/* Some firendly syscalls to cheer everyone's day... */
-#define __NR_new_sys_init_module __NR_init_module
-_syscall2(int, new_sys_init_module, const char *, name,
- const struct new_module *, info)
-#define __NR_old_sys_init_module __NR_init_module
-_syscall5(int, old_sys_init_module, const char *, name, char *, code,
- unsigned, codesize, struct old_mod_routines *, routines,
- struct old_symbol_table *, symtab)
-#ifndef BB_RMMOD
-_syscall1(int, delete_module, const char *, name)
-#else
+static struct external_module *ext_modules;
+static int n_ext_modules;
+static int n_ext_modules_used;
extern int delete_module(const char *);
-#endif
-
-/* This is kind of troublesome. See, we don't actually support
- the m68k or the arm the same way we support i386 and (now)
- sh. In doing my SH patch, I just assumed that whatever works
- for i386 also works for m68k and arm since currently insmod.c
- does nothing special for them. If this isn't true, the below
- line is rather misleading IMHO, and someone should either
- change it or add more proper architecture-dependent support
- for these boys.
-
- -- Bryan Rittmeyer <bryan@ixiacom.com> */
-
-#if defined(__i386__) || defined(__m68k__) || defined(__arm__)
-/* Jump through hoops to fixup error return codes */
-#define __NR__create_module __NR_create_module
-static inline _syscall2(long, _create_module, const char *, name, size_t,
- size)
-unsigned long create_module(const char *name, size_t size)
-{
- long ret = _create_module(name, size);
- if (ret == -1 && errno > 125) {
- ret = -errno;
- errno = 0;
- }
- return ret;
-}
-#else
-_syscall2(unsigned long, create_module, const char *, name, size_t, size)
+#ifndef FILENAME_MAX
+#define FILENAME_MAX 4095
#endif
-static char m_filename[BUFSIZ + 1] = "\0";
-static char m_fullName[BUFSIZ + 1] = "\0";
-/*======================================================================*/
+static char m_filename[FILENAME_MAX];
+static char m_fullName[FILENAME_MAX];
+
/*======================================================================*/
-struct obj_file *arch_new_file(void)
+static struct obj_file *arch_new_file(void)
{
struct arch_file *f;
f = xmalloc(sizeof(*f));
- f->got = NULL;
+
+ memset(f, 0, sizeof(*f));
+
return &f->root;
}
-struct obj_section *arch_new_section(void)
+static struct obj_section *arch_new_section(void)
{
return xmalloc(sizeof(struct obj_section));
}
-struct obj_symbol *arch_new_symbol(void)
+static struct obj_symbol *arch_new_symbol(void)
{
struct arch_symbol *sym;
sym = xmalloc(sizeof(*sym));
- memset(&sym->gotent, 0, sizeof(sym->gotent));
+
+ memset(sym, 0, sizeof(*sym));
+
return &sym->root;
}
-enum obj_reloc
+static enum obj_reloc
arch_apply_relocation(struct obj_file *f,
struct obj_section *targsec,
struct obj_section *symsec,
struct obj_symbol *sym,
-#if defined(__sh__)
- Elf32_Rela * rel, Elf32_Addr v)
-#else
- Elf32_Rel * rel, Elf32_Addr v)
-#endif
+ ElfW(RelM) *rel, ElfW(Addr) v)
{
struct arch_file *ifile = (struct arch_file *) f;
+ enum obj_reloc ret = obj_reloc_ok;
+ ElfW(Addr) *loc = (ElfW(Addr) *) (targsec->contents + rel->r_offset);
+ ElfW(Addr) dot = targsec->header.sh_addr + rel->r_offset;
+#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
struct arch_symbol *isym = (struct arch_symbol *) sym;
+#endif
+#if defined(BB_USE_GOT_ENTRIES)
+ ElfW(Addr) got = ifile->got ? ifile->got->header.sh_addr : 0;
+#endif
+#if defined(BB_USE_PLT_ENTRIES)
+ ElfW(Addr) plt = ifile->plt ? ifile->plt->header.sh_addr : 0;
+ unsigned long *ip;
+#if defined(BB_USE_PLT_LIST)
+ struct arch_list_entry *pe;
+#else
+ struct arch_single_entry *pe;
+#endif
+#endif
- Elf32_Addr *loc = (Elf32_Addr *) (targsec->contents + rel->r_offset);
- Elf32_Addr dot = targsec->header.sh_addr + rel->r_offset;
- Elf32_Addr got = ifile->got ? ifile->got->header.sh_addr : 0;
+ switch (ELF32_R_TYPE(rel->r_info)) {
- enum obj_reloc ret = obj_reloc_ok;
+#if defined(__arm__)
+ case R_ARM_NONE:
+ break;
- switch (ELF32_R_TYPE(rel->r_info)) {
+ case R_ARM_ABS32:
+ *loc += v;
+ break;
+
+ case R_ARM_GOT32:
+ goto bb_use_got;
+
+ case R_ARM_GOTPC:
+ /* relative reloc, always to _GLOBAL_OFFSET_TABLE_
+ * (which is .got) similar to branch,
+ * but is full 32 bits relative */
+
+ assert(got);
+ *loc += got - dot;
+ break;
+
+ case R_ARM_PC24:
+ case R_ARM_PLT32:
+ goto bb_use_plt;
+
+ case R_ARM_GOTOFF: /* address relative to the got */
+ assert(got);
+ *loc += v - got;
+ break;
+
+#elif defined(__i386__)
-/* even though these constants seem to be the same for
- the i386 and the sh, we "#if define" them for clarity
- and in case that ever changes */
-#if defined(__sh__)
- case R_SH_NONE:
-#else
case R_386_NONE:
-#endif
break;
-#if defined(__sh__)
- case R_SH_DIR32:
-#else
case R_386_32:
-#endif
*loc += v;
break;
-#if defined(__sh__)
- case R_SH_REL32:
-#else
case R_386_PLT32:
case R_386_PC32:
-#endif
*loc += v - dot;
break;
-#if defined(__sh__)
- case R_SH_PLT32:
- *loc = v - dot;
- break;
-#endif
-
-
-#if defined(__sh__)
- case R_SH_GLOB_DAT:
- case R_SH_JMP_SLOT:
- *loc = v;
- break;
-#else
case R_386_GLOB_DAT:
case R_386_JMP_SLOT:
*loc = v;
break;
-#endif
-#if defined(__sh__)
- case R_SH_RELATIVE:
- *loc += f->baseaddr + rel->r_addend;
- break;
-#else
- case R_386_RELATIVE:
+ case R_386_RELATIVE:
*loc += f->baseaddr;
break;
-#endif
-#if defined(__sh__)
- case R_SH_GOTPC:
- assert(got != 0);
- *loc += got - dot + rel->r_addend;;
- break;
-#else
case R_386_GOTPC:
assert(got != 0);
*loc += got - dot;
break;
-#endif
-#if defined(__sh__)
- case R_SH_GOT32:
- assert(isym != NULL);
- if (!isym->gotent.reloc_done) {
- isym->gotent.reloc_done = 1;
- *(Elf32_Addr *) (ifile->got->contents + isym->gotent.offset) =
- v;
- }
- *loc += isym->gotent.offset + rel->r_addend;
- break;
-#else
case R_386_GOT32:
- assert(isym != NULL);
- if (!isym->gotent.reloc_done) {
- isym->gotent.reloc_done = 1;
- *(Elf32_Addr *) (ifile->got->contents + isym->gotent.offset) =
- v;
+ goto bb_use_got;
+
+ case R_386_GOTOFF:
+ assert(got != 0);
+ *loc += v - got;
+ break;
+
+#elif defined(__x86_64__)
+
+ case R_X86_64_NONE:
+ break;
+
+ case R_X86_64_64:
+ *loc += v;
+ break;
+
+ case R_X86_64_32:
+ *(unsigned int *) loc += v;
+ break;
+
+ case R_X86_64_32S:
+ *(signed int *) loc += v;
+ break;
+
+ case R_X86_64_16:
+ *(unsigned short *) loc += v;
+ break;
+
+ case R_X86_64_8:
+ *(unsigned char *) loc += v;
+ break;
+
+ case R_X86_64_PC32:
+ *(unsigned int *) loc += v - dot;
+ break;
+
+ case R_X86_64_PC16:
+ *(unsigned short *) loc += v - dot;
+ break;
+
+ case R_X86_64_PC8:
+ *(unsigned char *) loc += v - dot;
+ break;
+
+ case R_X86_64_GLOB_DAT:
+ case R_X86_64_JUMP_SLOT:
+ *loc = v;
+ break;
+
+ case R_X86_64_RELATIVE:
+ *loc += f->baseaddr;
+ break;
+
+ case R_X86_64_GOT32:
+ case R_X86_64_GOTPCREL:
+ goto bb_use_got;
+
+#elif defined(__mc68000__)
+
+ case R_68K_NONE:
+ break;
+
+ case R_68K_32:
+ *loc += v;
+ break;
+
+ case R_68K_8:
+ if (v > 0xff) {
+ ret = obj_reloc_overflow;
}
- *loc += isym->gotent.offset;
+ *(char *)loc = v;
break;
-#endif
-#if defined(__sh__)
- case R_SH_GOTOFF:
-#else
- case R_386_GOTOFF:
-#endif
+ case R_68K_16:
+ if (v > 0xffff) {
+ ret = obj_reloc_overflow;
+ }
+ *(short *)loc = v;
+ break;
+
+ case R_68K_PC8:
+ v -= dot;
+ if ((Elf32_Sword)v > 0x7f ||
+ (Elf32_Sword)v < -(Elf32_Sword)0x80) {
+ ret = obj_reloc_overflow;
+ }
+ *(char *)loc = v;
+ break;
+
+ case R_68K_PC16:
+ v -= dot;
+ if ((Elf32_Sword)v > 0x7fff ||
+ (Elf32_Sword)v < -(Elf32_Sword)0x8000) {
+ ret = obj_reloc_overflow;
+ }
+ *(short *)loc = v;
+ break;
+
+ case R_68K_PC32:
+ *(int *)loc = v - dot;
+ break;
+
+ case R_68K_GLOB_DAT:
+ case R_68K_JMP_SLOT:
+ *loc = v;
+ break;
+
+ case R_68K_RELATIVE:
+ *(int *)loc += f->baseaddr;
+ break;
+
+ case R_68K_GOT32:
+ goto bb_use_got;
+
+ case R_68K_GOTOFF:
assert(got != 0);
*loc += v - got;
break;
+#elif defined(__mips__)
+
+ case R_MIPS_NONE:
+ break;
+
+ case R_MIPS_32:
+ *loc += v;
+ break;
+
+ case R_MIPS_26:
+ if (v % 4)
+ ret = obj_reloc_dangerous;
+ if ((v & 0xf0000000) != ((dot + 4) & 0xf0000000))
+ ret = obj_reloc_overflow;
+ *loc =
+ (*loc & ~0x03ffffff) | ((*loc + (v >> 2)) &
+ 0x03ffffff);
+ break;
+
+ case R_MIPS_HI16:
+ {
+ struct mips_hi16 *n;
+
+ /* We cannot relocate this one now because we don't know the value
+ of the carry we need to add. Save the information, and let LO16
+ do the actual relocation. */
+ n = (struct mips_hi16 *) xmalloc(sizeof *n);
+ n->addr = loc;
+ n->value = v;
+ n->next = ifile->mips_hi16_list;
+ ifile->mips_hi16_list = n;
+ break;
+ }
+
+ case R_MIPS_LO16:
+ {
+ unsigned long insnlo = *loc;
+ Elf32_Addr val, vallo;
+
+ /* Sign extend the addend we extract from the lo insn. */
+ vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000;
+
+ if (ifile->mips_hi16_list != NULL) {
+ struct mips_hi16 *l;
+
+ l = ifile->mips_hi16_list;
+ while (l != NULL) {
+ struct mips_hi16 *next;
+ unsigned long insn;
+
+ /* The value for the HI16 had best be the same. */
+ assert(v == l->value);
+
+ /* Do the HI16 relocation. Note that we actually don't
+ need to know anything about the LO16 itself, except where
+ to find the low 16 bits of the addend needed by the LO16. */
+ insn = *l->addr;
+ val =
+ ((insn & 0xffff) << 16) +
+ vallo;
+ val += v;
+
+ /* Account for the sign extension that will happen in the
+ low bits. */
+ val =
+ ((val >> 16) +
+ ((val & 0x8000) !=
+ 0)) & 0xffff;
+
+ insn = (insn & ~0xffff) | val;
+ *l->addr = insn;
+
+ next = l->next;
+ free(l);
+ l = next;
+ }
+
+ ifile->mips_hi16_list = NULL;
+ }
+
+ /* Ok, we're done with the HI16 relocs. Now deal with the LO16. */
+ val = v + vallo;
+ insnlo = (insnlo & ~0xffff) | (val & 0xffff);
+ *loc = insnlo;
+ break;
+ }
+
+#elif defined(__powerpc__)
+
+ case R_PPC_ADDR16_HA:
+ *(unsigned short *)loc = (v + 0x8000) >> 16;
+ break;
+
+ case R_PPC_ADDR16_HI:
+ *(unsigned short *)loc = v >> 16;
+ break;
+
+ case R_PPC_ADDR16_LO:
+ *(unsigned short *)loc = v;
+ break;
+
+ case R_PPC_REL24:
+ goto bb_use_plt;
+
+ case R_PPC_REL32:
+ *loc = v - dot;
+ break;
+
+ case R_PPC_ADDR32:
+ *loc = v;
+ break;
+
+#elif defined(__sh__)
+
+ case R_SH_NONE:
+ break;
+
+ case R_SH_DIR32:
+ *loc += v;
+ break;
+
+ case R_SH_REL32:
+ *loc += v - dot;
+ break;
+
+ case R_SH_PLT32:
+ *loc = v - dot;
+ break;
+
+ case R_SH_GLOB_DAT:
+ case R_SH_JMP_SLOT:
+ *loc = v;
+ break;
+
+ case R_SH_RELATIVE:
+ *loc = f->baseaddr + rel->r_addend;
+ break;
+
+ case R_SH_GOTPC:
+ assert(got != 0);
+ *loc = got - dot + rel->r_addend;
+ break;
+
+ case R_SH_GOT32:
+ goto bb_use_got;
+
+ case R_SH_GOTOFF:
+ assert(got != 0);
+ *loc = v - got;
+ break;
+
+#endif
+
default:
+ printf("Warning: unhandled reloc %d\n",(int)ELF32_R_TYPE(rel->r_info));
ret = obj_reloc_unhandled;
break;
+
+#if defined(BB_USE_PLT_ENTRIES)
+
+ bb_use_plt:
+
+ /* find the plt entry and initialize it if necessary */
+ assert(isym != NULL);
+
+#if defined(BB_USE_PLT_LIST)
+ for (pe = isym->pltent; pe != NULL && pe->addend != rel->r_addend;)
+ pe = pe->next;
+ assert(pe != NULL);
+#else
+ pe = &isym->pltent;
+#endif
+
+ if (! pe->inited) {
+ ip = (unsigned long *) (ifile->plt->contents + pe->offset);
+
+ /* generate some machine code */
+
+#if defined(__arm__)
+ ip[0] = 0xe51ff004; /* ldr pc,[pc,#-4] */
+ ip[1] = v; /* sym@ */
+#endif
+#if defined(__powerpc__)
+ ip[0] = 0x3d600000 + ((v + 0x8000) >> 16); /* lis r11,sym@ha */
+ ip[1] = 0x396b0000 + (v & 0xffff); /* addi r11,r11,sym@l */
+ ip[2] = 0x7d6903a6; /* mtctr r11 */
+ ip[3] = 0x4e800420; /* bctr */
+#endif
+ pe->inited = 1;
+ }
+
+ /* relative distance to target */
+ v -= dot;
+ /* if the target is too far away.... */
+ if ((int)v < -0x02000000 || (int)v >= 0x02000000) {
+ /* go via the plt */
+ v = plt + pe->offset - dot;
+ }
+ if (v & 3)
+ ret = obj_reloc_dangerous;
+
+ /* merge the offset into the instruction. */
+#if defined(__arm__)
+ /* Convert to words. */
+ v >>= 2;
+
+ *loc = (*loc & ~0x00ffffff) | ((v + *loc) & 0x00ffffff);
+#endif
+#if defined(__powerpc__)
+ *loc = (*loc & ~0x03fffffc) | (v & 0x03fffffc);
+#endif
+ break;
+#endif /* BB_USE_PLT_ENTRIES */
+
+#if defined(BB_USE_GOT_ENTRIES)
+ bb_use_got:
+
+ assert(isym != NULL);
+ /* needs an entry in the .got: set it, once */
+ if (!isym->gotent.inited) {
+ isym->gotent.inited = 1;
+ *(ElfW(Addr) *) (ifile->got->contents + isym->gotent.offset) = v;
+ }
+ /* make the reloc with_respect_to_.got */
+#if defined(__sh__)
+ *loc += isym->gotent.offset + rel->r_addend;
+#elif defined(__i386__) || defined(__arm__) || defined(__mc68000__)
+ *loc += isym->gotent.offset;
+#elif defined(__x86_64__)
+ /* XXX are these really correct? */
+ if (ELF64_R_TYPE(rel->r_info) == R_X86_64_GOTPCREL)
+ *(unsigned int *) loc += v + isym->gotent.offset;
+ else
+ *loc += isym->gotent.offset;
+#endif
+ break;
+
+#endif /* BB_USE_GOT_ENTRIES */
}
return ret;
}
-int arch_create_got(struct obj_file *f)
+#if defined(BB_USE_LIST)
+
+static int arch_list_add(ElfW(RelM) *rel, struct arch_list_entry **list,
+ int offset, int size)
{
- struct arch_file *ifile = (struct arch_file *) f;
- int i, n, offset = 0, gotneeded = 0;
+ struct arch_list_entry *pe;
+
+ for (pe = *list; pe != NULL; pe = pe->next) {
+ if (pe->addend == rel->r_addend) {
+ break;
+ }
+ }
+
+ if (pe == NULL) {
+ pe = xmalloc(sizeof(struct arch_list_entry));
+ pe->next = *list;
+ pe->addend = rel->r_addend;
+ pe->offset = offset;
+ pe->inited = 0;
+ *list = pe;
+ return size;
+ }
+ return 0;
+}
- n = ifile->root.header.e_shnum;
- for (i = 0; i < n; ++i) {
- struct obj_section *relsec, *symsec, *strsec;
-#if defined(__sh__)
- Elf32_Rela *rel, *relend;
-#else
- Elf32_Rel *rel, *relend;
#endif
- Elf32_Sym *symtab;
- const char *strtab;
- relsec = ifile->root.sections[i];
- if (relsec->header.sh_type != SHT_REL)
- continue;
+#if defined(BB_USE_SINGLE)
- symsec = ifile->root.sections[relsec->header.sh_link];
- strsec = ifile->root.sections[symsec->header.sh_link];
+static int arch_single_init(ElfW(RelM) *rel, struct arch_single_entry *single,
+ int offset, int size)
+{
+ if (single->allocated == 0) {
+ single->allocated = 1;
+ single->offset = offset;
+ single->inited = 0;
+ return size;
+ }
+ return 0;
+}
+#endif
-#if defined(__sh__)
- rel = (Elf32_Rela *) relsec->contents;
- relend = rel + (relsec->header.sh_size / sizeof(Elf32_Rela));
-#else
- rel = (Elf32_Rel *) relsec->contents;
- relend = rel + (relsec->header.sh_size / sizeof(Elf32_Rel));
+#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
+
+static struct obj_section *arch_xsect_init(struct obj_file *f, char *name,
+ int offset, int size)
+{
+ struct obj_section *myrelsec = obj_find_section(f, name);
+
+ if (offset == 0) {
+ offset += size;
+ }
+
+ if (myrelsec) {
+ obj_extend_section(myrelsec, offset);
+ } else {
+ myrelsec = obj_create_alloced_section(f, name,
+ size, offset);
+ assert(myrelsec);
+ }
+
+ return myrelsec;
+}
+
+#endif
+
+static void arch_create_got(struct obj_file *f)
+{
+#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
+ struct arch_file *ifile = (struct arch_file *) f;
+ int i;
+#if defined(BB_USE_GOT_ENTRIES)
+ int got_offset = 0, got_needed = 0, got_allocate;
+#endif
+#if defined(BB_USE_PLT_ENTRIES)
+ int plt_offset = 0, plt_needed = 0, plt_allocate;
#endif
- symtab = (Elf32_Sym *) symsec->contents;
+ struct obj_section *relsec, *symsec, *strsec;
+ ElfW(RelM) *rel, *relend;
+ ElfW(Sym) *symtab, *extsym;
+ const char *strtab, *name;
+ struct arch_symbol *intsym;
+
+ for (i = 0; i < f->header.e_shnum; ++i) {
+ relsec = f->sections[i];
+
+ if (relsec->header.sh_type != SHT_RELM)
+ continue;
+
+ symsec = f->sections[relsec->header.sh_link];
+ strsec = f->sections[symsec->header.sh_link];
+
+ rel = (ElfW(RelM) *) relsec->contents;
+ relend = rel + (relsec->header.sh_size / sizeof(ElfW(RelM)));
+ symtab = (ElfW(Sym) *) symsec->contents;
strtab = (const char *) strsec->contents;
for (; rel < relend; ++rel) {
- Elf32_Sym *extsym;
- struct arch_symbol *intsym;
- const char *name;
+ extsym = &symtab[ELF32_R_SYM(rel->r_info)];
+
+#if defined(BB_USE_GOT_ENTRIES)
+ got_allocate = 0;
+#endif
+#if defined(BB_USE_PLT_ENTRIES)
+ plt_allocate = 0;
+#endif
switch (ELF32_R_TYPE(rel->r_info)) {
-#if defined(__sh__)
- case R_SH_GOTPC:
- case R_SH_GOTOFF:
-#else
+
+#if defined(__arm__)
+
+ case R_ARM_PC24:
+ case R_ARM_PLT32:
+ plt_allocate = 1;
+ break;
+
+ case R_ARM_GOTOFF:
+ case R_ARM_GOTPC:
+ got_needed = 1;
+ continue;
+
+ case R_ARM_GOT32:
+ got_allocate = 1;
+ break;
+
+#elif defined(__i386__)
+
case R_386_GOTPC:
case R_386_GOTOFF:
-#endif
- gotneeded = 1;
- default:
+ got_needed = 1;
continue;
-#if defined(__sh__)
- case R_SH_GOT32:
-#else
case R_386_GOT32:
-#endif
+ got_allocate = 1;
+ break;
+
+#elif defined(__x86_64__)
+
+ case R_X86_64_GOTPCREL:
+ case R_X86_64_GOT32:
+ got_needed = 1;
+ continue;
+
+#elif defined(__powerpc__)
+
+ case R_PPC_REL24:
+ plt_allocate = 1;
+ break;
+
+#elif defined(__mc68000__)
+
+ case R_68K_GOT32:
+ got_allocate = 1;
+ break;
+
+ case R_68K_GOTOFF:
+ got_needed = 1;
+ continue;
+
+#elif defined(__sh__)
+
+ case R_SH_GOT32:
+ got_allocate = 1;
break;
+
+ case R_SH_GOTPC:
+ case R_SH_GOTOFF:
+ got_needed = 1;
+ continue;
+
+#endif
+ default:
+ continue;
}
- extsym = &symtab[ELF32_R_SYM(rel->r_info)];
- if (extsym->st_name)
+ if (extsym->st_name != 0) {
name = strtab + extsym->st_name;
- else
+ } else {
name = f->sections[extsym->st_shndx]->name;
- intsym =
- (struct arch_symbol *) obj_find_symbol(&ifile->root, name);
-
- if (!intsym->gotent.offset_done) {
- intsym->gotent.offset_done = 1;
- intsym->gotent.offset = offset;
- offset += 4;
}
+ intsym = (struct arch_symbol *) obj_find_symbol(f, name);
+#if defined(BB_USE_GOT_ENTRIES)
+ if (got_allocate) {
+ got_offset += arch_single_init(
+ rel, &intsym->gotent,
+ got_offset, BB_GOT_ENTRY_SIZE);
+
+ got_needed = 1;
+ }
+#endif
+#if defined(BB_USE_PLT_ENTRIES)
+ if (plt_allocate) {
+#if defined(BB_USE_PLT_LIST)
+ plt_offset += arch_list_add(
+ rel, &intsym->pltent,
+ plt_offset, BB_PLT_ENTRY_SIZE);
+#else
+ plt_offset += arch_single_init(
+ rel, &intsym->pltent,
+ plt_offset, BB_PLT_ENTRY_SIZE);
+#endif
+ plt_needed = 1;
+ }
+#endif
}
}
- if (offset > 0 || gotneeded)
- ifile->got =
- obj_create_alloced_section(&ifile->root, ".got", 4, offset);
+#if defined(BB_USE_GOT_ENTRIES)
+ if (got_needed) {
+ ifile->got = arch_xsect_init(f, ".got", got_offset,
+ BB_GOT_ENTRY_SIZE);
+ }
+#endif
- return 1;
+#if defined(BB_USE_PLT_ENTRIES)
+ if (plt_needed) {
+ ifile->plt = arch_xsect_init(f, ".plt", plt_offset,
+ BB_PLT_ENTRY_SIZE);
+ }
+#endif
+
+#endif /* defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES) */
}
-int arch_init_module(struct obj_file *f, struct new_module *mod)
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
+static int arch_init_module(struct obj_file *f, struct new_module *mod)
{
return 1;
}
+#endif
/*======================================================================*/
/* Standard ELF hash function. */
-inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
+static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
{
unsigned long h = 0;
unsigned long g;
@@ -869,38 +1460,12 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
return h;
}
-unsigned long obj_elf_hash(const char *name)
+static unsigned long obj_elf_hash(const char *name)
{
return obj_elf_hash_n(name, strlen(name));
}
#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
-/* Get the kernel version in the canonical integer form. */
-
-static int get_kernel_version(char str[STRVERSIONLEN])
-{
- struct utsname uts_info;
- char *p, *q;
- int a, b, c;
-
- if (uname(&uts_info) < 0)
- return -1;
- strncpy(str, uts_info.release, STRVERSIONLEN);
- p = uts_info.release;
-
- a = strtoul(p, &p, 10);
- if (*p != '.')
- return -1;
- b = strtoul(p + 1, &p, 10);
- if (*p != '.')
- return -1;
- c = strtoul(p + 1, &q, 10);
- if (p + 1 == q)
- return -1;
-
- return a << 16 | b << 8 | c;
-}
-
/* String comparison for non-co-versioned kernel and module. */
static int ncv_strcmp(const char *a, const char *b)
@@ -926,7 +1491,7 @@ static unsigned long ncv_symbol_hash(const char *str)
return obj_elf_hash_n(str, len);
}
-void
+static void
obj_set_symbol_compare(struct obj_file *f,
int (*cmp) (const char *, const char *),
unsigned long (*hash) (const char *))
@@ -954,8 +1519,8 @@ obj_set_symbol_compare(struct obj_file *f,
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-
-struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
+static struct obj_symbol *
+obj_add_symbol(struct obj_file *f, const char *name,
unsigned long symidx, int info,
int secidx, ElfW(Addr) value,
unsigned long size)
@@ -1020,7 +1585,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
/* Don't report an error if the symbol is coming from
the kernel or some external module. */
if (secidx <= SHN_HIRESERVE)
- errorMsg("%s multiply defined", name);
+ error_msg("%s multiply defined", name);
return sym;
}
}
@@ -1031,8 +1596,13 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
f->symtab[hash] = sym;
sym->ksymidx = -1;
- if (ELFW(ST_BIND) (info) == STB_LOCAL)
- f->local_symtab[symidx] = sym;
+ if (ELFW(ST_BIND)(info) == STB_LOCAL && symidx != -1) {
+ if (symidx >= f->local_symtab_size)
+ error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld",
+ name, (long) symidx, (long) f->local_symtab_size);
+ else
+ f->local_symtab[symidx] = sym;
+ }
found:
sym->name = name;
@@ -1044,7 +1614,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
return sym;
}
-struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
+static struct obj_symbol *
+obj_find_symbol(struct obj_file *f, const char *name)
{
struct obj_symbol *sym;
unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS;
@@ -1056,7 +1627,7 @@ struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
return NULL;
}
-ElfW(Addr)
+static ElfW(Addr)
obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym)
{
if (sym) {
@@ -1070,7 +1641,7 @@ ElfW(Addr)
}
}
-struct obj_section *obj_find_section(struct obj_file *f, const char *name)
+static struct obj_section *obj_find_section(struct obj_file *f, const char *name)
{
int i, n = f->header.e_shnum;
@@ -1103,7 +1674,7 @@ static int obj_load_order_prio(struct obj_section *a)
return ac;
}
-void
+static void
obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
{
struct obj_section **p;
@@ -1115,7 +1686,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
*p = sec;
}
-struct obj_section *obj_create_alloced_section(struct obj_file *f,
+static struct obj_section *obj_create_alloced_section(struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size)
@@ -1141,7 +1712,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f,
return sec;
}
-struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
+static struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
const char *name,
unsigned long align,
unsigned long size)
@@ -1170,15 +1741,16 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
return sec;
}
-void *obj_extend_section(struct obj_section *sec, unsigned long more)
+static void *obj_extend_section(struct obj_section *sec, unsigned long more)
{
unsigned long oldsize = sec->header.sh_size;
- sec->contents = xrealloc(sec->contents, sec->header.sh_size += more);
+ if (more) {
+ sec->contents = xrealloc(sec->contents, sec->header.sh_size += more);
+ }
return sec->contents + oldsize;
}
-
/* Conditionally add the symbols from the given symbol set to the
new module. */
@@ -1283,7 +1855,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Also check that the parameter was not resolved from the kernel. */
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
- errorMsg("symbol for parameter %s not found", p);
+ error_msg("symbol for parameter %s not found", p);
return 0;
}
@@ -1296,7 +1868,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- errorMsg("improperly terminated string argument for %s", p);
+ error_msg("improperly terminated string argument for %s", p);
return 0;
} else if (*q == '\\')
switch (*++q) {
@@ -1355,19 +1927,19 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
while (*q++ == ',');
} else {
char *contents = f->sections[sym->secidx]->contents;
- char *loc = contents + sym->value;
+ char *myloc = contents + sym->value;
char *r; /* To search for commas */
/* Break the string with comas */
while ((r = strchr(q, ',')) != (char *) NULL) {
*r++ = '\0';
- obj_string_patch(f, sym->secidx, loc - contents, q);
- loc += sizeof(char *);
+ obj_string_patch(f, sym->secidx, myloc - contents, q);
+ myloc += sizeof(char *);
q = r;
}
/* last part */
- obj_string_patch(f, sym->secidx, loc - contents, q);
+ obj_string_patch(f, sym->secidx, myloc - contents, q);
}
argc--, argv++;
@@ -1395,7 +1967,7 @@ old_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
return -1;
p = f->sections[sym->secidx]->contents + sym->value;
- strncpy(str, p, STRVERSIONLEN);
+ safe_strncpy(str, p, STRVERSIONLEN);
a = strtoul(p, &p, 10);
if (*p != '.')
@@ -1412,7 +1984,7 @@ old_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
/* Fetch all the symbols and divvy them up as appropriate for the modules. */
@@ -1424,15 +1996,18 @@ static int old_get_kernel_symbols(const char *m_name)
int nks, nms, nmod, i;
nks = get_kernel_syms(NULL);
- if (nks < 0) {
- errorMsg("get_kernel_syms: %s: %s", m_name, strerror(errno));
+ if (nks <= 0) {
+ if (nks)
+ perror_msg("get_kernel_syms: %s", m_name);
+ else
+ error_msg("No kernel symbols");
return 0;
}
ks = k = xmalloc(nks * sizeof(*ks));
if (get_kernel_syms(ks) != nks) {
- logperror("inconsistency with get_kernel_syms -- is someone else "
+ perror("inconsistency with get_kernel_syms -- is someone else "
"playing with modules?");
free(ks);
return 0;
@@ -1445,7 +2020,6 @@ static int old_get_kernel_symbols(const char *m_name)
while (k->name[0] == '#' && k->name[1]) {
struct old_kernel_sym *k2;
- struct new_module_symbol *s;
/* Find out how many symbols this module has. */
for (k2 = k + 1; k2->name[0] != '#'; ++k2)
@@ -1567,7 +2141,8 @@ old_init_module(const char *m_name, struct obj_file *f,
ksym->name =
(unsigned long) str - (unsigned long) symtab;
- str = stpcpy(str, sym->name) + 1;
+ strcpy(str, sym->name);
+ str += strlen(sym->name) + 1;
ksym++;
}
}
@@ -1606,7 +2181,7 @@ old_init_module(const char *m_name, struct obj_file *f,
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- errorMsg("init_module: %s: %s", m_name, strerror(errno));
+ perror_msg("init_module: %s", m_name);
free(image);
free(symtab);
@@ -1619,7 +2194,7 @@ old_init_module(const char *m_name, struct obj_file *f,
#define old_create_mod_use_count(x) TRUE
#define old_init_module(x, y, z) TRUE
-#endif /* BB_FEATURE_INSMOD_OLD_KERNEL */
+#endif /* BB_FEATURE_OLD_MODULE_INTERFACE */
@@ -1649,7 +2224,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
p = get_modinfo_value(f, key);
key += 5;
if (p == NULL) {
- errorMsg("invalid parameter %s", key);
+ error_msg("invalid parameter %s", key);
return 0;
}
@@ -1657,7 +2232,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Also check that the parameter was not resolved from the kernel. */
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
- errorMsg("symbol for parameter %s not found", key);
+ error_msg("symbol for parameter %s not found", key);
return 0;
}
@@ -1685,7 +2260,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- errorMsg("improperly terminated string argument for %s",
+ error_msg("improperly terminated string argument for %s",
key);
return 0;
} else if (*q == '\\')
@@ -1779,7 +2354,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Get the size of each member */
/* Probably we should do that outside the loop ? */
if (!isdigit(*(p + 1))) {
- errorMsg("parameter type 'c' for %s must be followed by"
+ error_msg("parameter type 'c' for %s must be followed by"
" the maximum size", key);
return 0;
}
@@ -1787,7 +2362,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Check length */
if (strlen(str) >= charssize) {
- errorMsg("string too long for %s (max %ld)", key,
+ error_msg("string too long for %s (max %ld)", key,
charssize - 1);
return 0;
}
@@ -1816,7 +2391,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
break;
default:
- errorMsg("unknown parameter type '%c' for %s", *p, key);
+ error_msg("unknown parameter type '%c' for %s", *p, key);
return 0;
}
}
@@ -1835,21 +2410,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
case ',':
if (++n > max) {
- errorMsg("too many values for %s (max %d)", key, max);
+ error_msg("too many values for %s (max %d)", key, max);
return 0;
}
++q;
break;
default:
- errorMsg("invalid argument syntax for %s", key);
+ error_msg("invalid argument syntax for %s", key);
return 0;
}
}
end_of_arg:
if (n < min) {
- errorMsg("too few values for %s (min %d)", key, min);
+ error_msg("too few values for %s (min %d)", key, min);
return 0;
}
@@ -1880,7 +2455,7 @@ new_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
p = get_modinfo_value(f, "kernel_version");
if (p == NULL)
return -1;
- strncpy(str, p, STRVERSIONLEN);
+ safe_strncpy(str, p, STRVERSIONLEN);
a = strtoul(p, &p, 10);
if (*p != '.')
@@ -1898,7 +2473,7 @@ new_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-#ifdef BB_FEATURE_INSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
/* Fetch the loaded modules, and all currently exported symbols. */
@@ -1914,57 +2489,59 @@ static int new_get_kernel_symbols(void)
module_names = xmalloc(bufsize = 256);
retry_modules_load:
if (query_module(NULL, QM_MODULES, module_names, bufsize, &ret)) {
- if (errno == ENOSPC) {
+ if (errno == ENOSPC && bufsize < ret) {
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- errorMsg("QM_MODULES: %s", strerror(errno));
+ perror_msg("QM_MODULES");
return 0;
}
n_ext_modules = nmod = ret;
- ext_modules = modules = xmalloc(nmod * sizeof(*modules));
- memset(modules, 0, nmod * sizeof(*modules));
/* Collect the modules' symbols. */
- for (i = 0, mn = module_names, m = modules;
- i < nmod; ++i, ++m, mn += strlen(mn) + 1) {
- struct new_module_info info;
-
- if (query_module(mn, QM_INFO, &info, sizeof(info), &ret)) {
- if (errno == ENOENT) {
- /* The module was removed out from underneath us. */
- continue;
- }
- errorMsg("query_module: QM_INFO: %s: %s", mn, strerror(errno));
- return 0;
- }
-
- syms = xmalloc(bufsize = 1024);
- retry_mod_sym_load:
- if (query_module(mn, QM_SYMBOLS, syms, bufsize, &ret)) {
- switch (errno) {
- case ENOSPC:
- syms = xrealloc(syms, bufsize = ret);
- goto retry_mod_sym_load;
- case ENOENT:
- /* The module was removed out from underneath us. */
- continue;
- default:
- errorMsg("query_module: QM_SYMBOLS: %s: %s", mn, strerror(errno));
+ if (nmod){
+ ext_modules = modules = xmalloc(nmod * sizeof(*modules));
+ memset(modules, 0, nmod * sizeof(*modules));
+ for (i = 0, mn = module_names, m = modules;
+ i < nmod; ++i, ++m, mn += strlen(mn) + 1) {
+ struct new_module_info info;
+
+ if (query_module(mn, QM_INFO, &info, sizeof(info), &ret)) {
+ if (errno == ENOENT) {
+ /* The module was removed out from underneath us. */
+ continue;
+ }
+ perror_msg("query_module: QM_INFO: %s", mn);
return 0;
}
- }
- nsyms = ret;
-
- m->name = mn;
- m->addr = info.addr;
- m->nsyms = nsyms;
- m->syms = syms;
-
- for (j = 0, s = syms; j < nsyms; ++j, ++s) {
- s->name += (unsigned long) syms;
+
+ syms = xmalloc(bufsize = 1024);
+ retry_mod_sym_load:
+ if (query_module(mn, QM_SYMBOLS, syms, bufsize, &ret)) {
+ switch (errno) {
+ case ENOSPC:
+ syms = xrealloc(syms, bufsize = ret);
+ goto retry_mod_sym_load;
+ case ENOENT:
+ /* The module was removed out from underneath us. */
+ continue;
+ default:
+ perror_msg("query_module: QM_SYMBOLS: %s", mn);
+ return 0;
+ }
+ }
+ nsyms = ret;
+
+ m->name = mn;
+ m->addr = info.addr;
+ m->nsyms = nsyms;
+ m->syms = syms;
+
+ for (j = 0, s = syms; j < nsyms; ++j, ++s) {
+ s->name += (unsigned long) syms;
+ }
}
}
@@ -1973,11 +2550,11 @@ static int new_get_kernel_symbols(void)
syms = xmalloc(bufsize = 16 * 1024);
retry_kern_sym_load:
if (query_module(NULL, QM_SYMBOLS, syms, bufsize, &ret)) {
- if (errno == ENOSPC) {
+ if (errno == ENOSPC && bufsize < ret) {
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- errorMsg("kernel: QM_SYMBOLS: %s", strerror(errno));
+ perror_msg("kernel: QM_SYMBOLS");
return 0;
}
nksyms = nsyms = ret;
@@ -2106,6 +2683,10 @@ new_init_module(const char *m_name, struct obj_file *f,
tgt_long m_addr;
sec = obj_find_section(f, ".this");
+ if (!sec || !sec->contents) {
+ perror_msg("corrupt module %s?",m_name);
+ exit(EXIT_FAILURE);
+ }
module = (struct new_module *) sec->contents;
m_addr = sec->header.sh_addr;
@@ -2146,6 +2727,16 @@ new_init_module(const char *m_name, struct obj_file *f,
module->runsize > sec->header.sh_addr - m_addr)
module->runsize = sec->header.sh_addr - m_addr;
}
+ sec = obj_find_section(f, ARCHDATA_SEC_NAME);
+ if (sec && sec->header.sh_size) {
+ module->archdata_start = (void*)sec->header.sh_addr;
+ module->archdata_end = module->archdata_start + sec->header.sh_size;
+ }
+ sec = obj_find_section(f, KALLSYMS_SEC_NAME);
+ if (sec && sec->header.sh_size) {
+ module->kallsyms_start = (void*)sec->header.sh_addr;
+ module->kallsyms_end = module->kallsyms_start + sec->header.sh_size;
+ }
if (!arch_init_module(f, module))
return 0;
@@ -2158,7 +2749,7 @@ new_init_module(const char *m_name, struct obj_file *f,
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- errorMsg("init_module: %s: %s", m_name, strerror(errno));
+ perror_msg("init_module: %s", m_name);
free(image);
@@ -2170,13 +2761,14 @@ new_init_module(const char *m_name, struct obj_file *f,
#define new_init_module(x, y, z) TRUE
#define new_create_this_module(x, y) 0
#define new_create_module_ksymtab(x)
+#define query_module(v, w, x, y, z) -1
-#endif /* BB_FEATURE_INSMOD_OLD_KERNEL */
+#endif /* BB_FEATURE_NEW_MODULE_INTERFACE */
/*======================================================================*/
-int
+static int
obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
const char *string)
{
@@ -2205,7 +2797,8 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
return 1;
}
-int
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
+static int
obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
struct obj_symbol *sym)
{
@@ -2220,8 +2813,9 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
return 1;
}
+#endif
-int obj_check_undefineds(struct obj_file *f)
+static int obj_check_undefineds(struct obj_file *f)
{
unsigned long i;
int ret = 1;
@@ -2234,7 +2828,9 @@ int obj_check_undefineds(struct obj_file *f)
sym->secidx = SHN_ABS;
sym->value = 0;
} else {
- errorMsg("unresolved symbol %s", sym->name);
+ if (!flag_quiet) {
+ error_msg("unresolved symbol %s", sym->name);
+ }
ret = 0;
}
}
@@ -2243,7 +2839,7 @@ int obj_check_undefineds(struct obj_file *f)
return ret;
}
-void obj_allocate_commons(struct obj_file *f)
+static void obj_allocate_commons(struct obj_file *f)
{
struct common_entry {
struct common_entry *next;
@@ -2341,14 +2937,18 @@ void obj_allocate_commons(struct obj_file *f)
for (i = 0; i < f->header.e_shnum; ++i) {
struct obj_section *s = f->sections[i];
if (s->header.sh_type == SHT_NOBITS) {
+ if (s->header.sh_size != 0)
s->contents = memset(xmalloc(s->header.sh_size),
0, s->header.sh_size);
+ else
+ s->contents = NULL;
+
s->header.sh_type = SHT_PROGBITS;
}
}
}
-unsigned long obj_load_size(struct obj_file *f)
+static unsigned long obj_load_size(struct obj_file *f)
{
unsigned long dot = 0;
struct obj_section *sec;
@@ -2369,7 +2969,7 @@ unsigned long obj_load_size(struct obj_file *f)
return dot;
}
-int obj_relocate(struct obj_file *f, ElfW(Addr) base)
+static int obj_relocate(struct obj_file *f, ElfW(Addr) base)
{
int i, n = f->header.e_shnum;
int ret = 1;
@@ -2457,11 +3057,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
errmsg = "Unhandled relocation";
bad_reloc:
if (extsym) {
- errorMsg("%s of type %ld for %s", errmsg,
+ error_msg("%s of type %ld for %s", errmsg,
(long) ELFW(R_TYPE) (rel->r_info),
strtab + extsym->st_name);
} else {
- errorMsg("%s of type %ld", errmsg,
+ error_msg("%s of type %ld", errmsg,
(long) ELFW(R_TYPE) (rel->r_info));
}
ret = 0;
@@ -2499,7 +3099,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
return ret;
}
-int obj_create_image(struct obj_file *f, char *image)
+static int obj_create_image(struct obj_file *f, char *image)
{
struct obj_section *sec;
ElfW(Addr) base = f->baseaddr;
@@ -2507,7 +3107,7 @@ int obj_create_image(struct obj_file *f, char *image)
for (sec = f->load_order; sec; sec = sec->load_next) {
char *secimg;
- if (sec->header.sh_size == 0)
+ if (sec->contents == 0 || sec->header.sh_size == 0)
continue;
secimg = image + (sec->header.sh_addr - base);
@@ -2521,7 +3121,7 @@ int obj_create_image(struct obj_file *f, char *image)
/*======================================================================*/
-struct obj_file *obj_load(FILE * fp)
+static struct obj_file *obj_load(FILE * fp, int loadprogbits)
{
struct obj_file *f;
ElfW(Shdr) * section_headers;
@@ -2538,7 +3138,7 @@ struct obj_file *obj_load(FILE * fp)
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- errorMsg("error reading ELF header: %s", strerror(errno));
+ perror_msg("error reading ELF header");
return NULL;
}
@@ -2546,25 +3146,25 @@ struct obj_file *obj_load(FILE * fp)
|| f->header.e_ident[EI_MAG1] != ELFMAG1
|| f->header.e_ident[EI_MAG2] != ELFMAG2
|| f->header.e_ident[EI_MAG3] != ELFMAG3) {
- errorMsg("not an ELF file");
+ error_msg("not an ELF file");
return NULL;
}
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
|| f->header.e_ident[EI_DATA] != ELFDATAM
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|| !MATCH_MACHINE(f->header.e_machine)) {
- errorMsg("ELF file not for this architecture");
+ error_msg("ELF file not for this architecture");
return NULL;
}
if (f->header.e_type != ET_REL) {
- errorMsg("ELF file not a relocatable object");
+ error_msg("ELF file not a relocatable object");
return NULL;
}
/* Read the section headers. */
if (f->header.e_shentsize != sizeof(ElfW(Shdr))) {
- errorMsg("section header size mismatch: %lu != %lu",
+ error_msg("section header size mismatch: %lu != %lu",
(unsigned long) f->header.e_shentsize,
(unsigned long) sizeof(ElfW(Shdr)));
return NULL;
@@ -2577,7 +3177,7 @@ struct obj_file *obj_load(FILE * fp)
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- errorMsg("error reading ELF section headers: %s", strerror(errno));
+ perror_msg("error reading ELF section headers");
return NULL;
}
@@ -2592,7 +3192,7 @@ struct obj_file *obj_load(FILE * fp)
sec->header = section_headers[i];
sec->idx = i;
- switch (sec->header.sh_type) {
+ if(sec->header.sh_size) switch (sec->header.sh_type) {
case SHT_NULL:
case SHT_NOTE:
case SHT_NOBITS:
@@ -2600,6 +3200,12 @@ struct obj_file *obj_load(FILE * fp)
break;
case SHT_PROGBITS:
+#if LOADBITS
+ if (!loadprogbits) {
+ sec->contents = NULL;
+ break;
+ }
+#endif
case SHT_SYMTAB:
case SHT_STRTAB:
case SHT_RELM:
@@ -2607,7 +3213,7 @@ struct obj_file *obj_load(FILE * fp)
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- errorMsg("error reading ELF section data: %s", strerror(errno));
+ perror_msg("error reading ELF section data");
return NULL;
}
} else {
@@ -2617,11 +3223,11 @@ struct obj_file *obj_load(FILE * fp)
#if SHT_RELM == SHT_REL
case SHT_RELA:
- errorMsg("RELA relocations not supported on this architecture");
+ error_msg("RELA relocations not supported on this architecture");
return NULL;
#else
case SHT_REL:
- errorMsg("REL relocations not supported on this architecture");
+ error_msg("REL relocations not supported on this architecture");
return NULL;
#endif
@@ -2634,7 +3240,7 @@ struct obj_file *obj_load(FILE * fp)
break;
}
- errorMsg("can't handle sections of type %ld",
+ error_msg("can't handle sections of type %ld",
(long) sec->header.sh_type);
return NULL;
}
@@ -2652,6 +3258,12 @@ struct obj_file *obj_load(FILE * fp)
for (i = 0; i < shnum; ++i) {
struct obj_section *sec = f->sections[i];
+ /* .modinfo should be contents only but gcc has no attribute for that.
+ * The kernel may have marked .modinfo as ALLOC, ignore this bit.
+ */
+ if (strcmp(sec->name, ".modinfo") == 0)
+ sec->header.sh_flags &= ~SHF_ALLOC;
+
if (sec->header.sh_flags & SHF_ALLOC)
obj_insert_section_load_order(f, sec);
@@ -2663,7 +3275,7 @@ struct obj_file *obj_load(FILE * fp)
ElfW(Sym) * sym;
if (sec->header.sh_entsize != sizeof(ElfW(Sym))) {
- errorMsg("symbol size mismatch: %lu != %lu",
+ error_msg("symbol size mismatch: %lu != %lu",
(unsigned long) sec->header.sh_entsize,
(unsigned long) sizeof(ElfW(Sym)));
return NULL;
@@ -2675,38 +3287,72 @@ struct obj_file *obj_load(FILE * fp)
/* Allocate space for a table of local symbols. */
j = f->local_symtab_size = sec->header.sh_info;
- f->local_symtab = xmalloc(j *=
- sizeof(struct obj_symbol *));
- memset(f->local_symtab, 0, j);
+ f->local_symtab = xcalloc(j, sizeof(struct obj_symbol *));
/* Insert all symbols into the hash table. */
for (j = 1, ++sym; j < nsym; ++j, ++sym) {
const char *name;
if (sym->st_name)
name = strtab + sym->st_name;
- else
+ else
name = f->sections[sym->st_shndx]->name;
obj_add_symbol(f, name, j, sym->st_info, sym->st_shndx,
sym->st_value, sym->st_size);
- }
- }
+ }
+ }
break;
case SHT_RELM:
if (sec->header.sh_entsize != sizeof(ElfW(RelM))) {
- errorMsg("relocation entry size mismatch: %lu != %lu",
+ error_msg("relocation entry size mismatch: %lu != %lu",
(unsigned long) sec->header.sh_entsize,
(unsigned long) sizeof(ElfW(RelM)));
return NULL;
}
break;
+ /* XXX Relocation code from modutils-2.3.19 is not here.
+ * Why? That's about 20 lines of code from obj/obj_load.c,
+ * which gets done in a second pass through the sections.
+ * This BusyBox insmod does similar work in obj_relocate(). */
}
}
return f;
}
+#ifdef BB_FEATURE_INSMOD_LOADINKMEM
+/*
+ * load the unloaded sections directly into the memory allocated by
+ * kernel for the module
+ */
+
+static int obj_load_progbits(FILE * fp, struct obj_file* f, char* imagebase)
+{
+ ElfW(Addr) base = f->baseaddr;
+ struct obj_section* sec;
+
+ for (sec = f->load_order; sec; sec = sec->load_next) {
+
+ /* section already loaded? */
+ if (sec->contents != NULL)
+ continue;
+
+ if (sec->header.sh_size == 0)
+ continue;
+
+ sec->contents = imagebase + (sec->header.sh_addr - base);
+ fseek(fp, sec->header.sh_offset, SEEK_SET);
+ if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
+ error_msg("error reading ELF section data: %s\n", strerror(errno));
+ return 0;
+ }
+
+ }
+ return 1;
+}
+#endif
+
static void hide_special_symbols(struct obj_file *f)
{
static const char *const specials[] = {
@@ -2725,6 +3371,121 @@ static void hide_special_symbols(struct obj_file *f)
ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info));
}
+#ifdef BB_FEATURE_INSMOD_CHECK_TAINTED
+static int obj_gpl_license(struct obj_file *f, const char **license)
+{
+ struct obj_section *sec;
+ /* This list must match *exactly* the list of allowable licenses in
+ * linux/include/linux/module.h. Checking for leading "GPL" will not
+ * work, somebody will use "GPL sucks, this is proprietary".
+ */
+ static const char *gpl_licenses[] = {
+ "GPL",
+ "GPL v2",
+ "GPL and additional rights",
+ "Dual BSD/GPL",
+ "Dual MPL/GPL",
+ };
+
+ if ((sec = obj_find_section(f, ".modinfo"))) {
+ const char *value, *ptr, *endptr;
+ ptr = sec->contents;
+ endptr = ptr + sec->header.sh_size;
+ while (ptr < endptr) {
+ if ((value = strchr(ptr, '=')) && strncmp(ptr, "license", value-ptr) == 0) {
+ int i;
+ if (license)
+ *license = value+1;
+ for (i = 0; i < sizeof(gpl_licenses)/sizeof(gpl_licenses[0]); ++i) {
+ if (strcmp(value+1, gpl_licenses[i]) == 0)
+ return(0);
+ }
+ return(2);
+ }
+ if (strchr(ptr, '\0'))
+ ptr = strchr(ptr, '\0') + 1;
+ else
+ ptr = endptr;
+ }
+ }
+ return(1);
+}
+
+#define TAINT_FILENAME "/proc/sys/kernel/tainted"
+#define TAINT_PROPRIETORY_MODULE (1<<0)
+#define TAINT_FORCED_MODULE (1<<1)
+#define TAINT_UNSAFE_SMP (1<<2)
+#define TAINT_URL "http://www.tux.org/lkml/#export-tainted"
+
+static void set_tainted(struct obj_file *f, int fd, char *m_name,
+ int kernel_has_tainted, int taint, const char *text1, const char *text2)
+{
+ char buf[80];
+ int oldval;
+ static int first = 1;
+ if (fd < 0 && !kernel_has_tainted)
+ return; /* New modutils on old kernel */
+ printf("Warning: loading %s will taint the kernel: %s%s\n",
+ m_name, text1, text2);
+ if (first) {
+ printf(" See %s for information about tainted modules\n", TAINT_URL);
+ first = 0;
+ }
+ if (fd >= 0) {
+ read(fd, buf, sizeof(buf)-1);
+ buf[sizeof(buf)-1] = '\0';
+ oldval = strtoul(buf, NULL, 10);
+ sprintf(buf, "%d\n", oldval | taint);
+ write(fd, buf, strlen(buf));
+ }
+}
+#endif
+
+/* Check if loading this module will taint the kernel. */
+static void check_tainted_module(struct obj_file *f, char *m_name)
+{
+#ifdef BB_FEATURE_INSMOD_CHECK_TAINTED
+ static const char tainted_file[] = TAINT_FILENAME;
+ int fd, kernel_has_tainted;
+ const char *ptr;
+
+ kernel_has_tainted = 1;
+ if ((fd = open(tainted_file, O_RDWR)) < 0) {
+ if (errno == ENOENT)
+ kernel_has_tainted = 0;
+ else if (errno == EACCES)
+ kernel_has_tainted = 1;
+ else {
+ perror(tainted_file);
+ kernel_has_tainted = 0;
+ }
+ }
+
+ switch (obj_gpl_license(f, &ptr)) {
+ case 0:
+ break;
+ case 1:
+ set_tainted(f, fd, m_name, kernel_has_tainted, TAINT_PROPRIETORY_MODULE, "no license", "");
+ break;
+ case 2:
+ /* The module has a non-GPL license so we pretend that the
+ * kernel always has a taint flag to get a warning even on
+ * kernels without the proc flag.
+ */
+ set_tainted(f, fd, m_name, 1, TAINT_PROPRIETORY_MODULE, "non-GPL license - ", ptr);
+ break;
+ default:
+ set_tainted(f, fd, m_name, 1, TAINT_PROPRIETORY_MODULE, "Unexpected return from obj_gpl_license", "");
+ break;
+ }
+
+ if (flag_force_load)
+ set_tainted(f, fd, m_name, 1, TAINT_FORCED_MODULE, "forced load", "");
+
+ if (fd >= 0)
+ close(fd);
+#endif
+}
void my_usage(void)
{
@@ -2742,18 +3503,16 @@ extern int insmod_main( int argc, char **argv)
ElfW(Addr) m_addr;
FILE *fp;
struct obj_file *f;
- char m_name[BUFSIZ + 1] = "\0";
- int exit_status = FALSE;
+ char m_name[FILENAME_MAX] = "\0";
+ int exit_status = EXIT_FAILURE;
int m_has_modinfo;
#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
- int k_version;
- char k_strversion[STRVERSIONLEN];
+ struct utsname uts_info;
char m_strversion[STRVERSIONLEN];
int m_version;
int m_crcs;
#endif
-
if (argc <= 1)
my_usage();
@@ -2773,7 +3532,7 @@ extern int insmod_main( int argc, char **argv)
strcpy(m_fullName, m_name);
strcat(m_fullName, ".o");
- /* Get a filedesc for the module */
+ /* Get a filedesc for the module. Check we we have a complete path */
if ((fp = fopen(*argv, "r")) == NULL) {
errorMsg("Module %s not found", *argv);
return -1;
@@ -2781,7 +3540,7 @@ extern int insmod_main( int argc, char **argv)
memcpy(m_filename, *argv, strlen(*argv));
- if ((f = obj_load(fp)) == NULL) {
+ if ((f = obj_load(fp, LOADBITS)) == NULL) {
logperror("Could not load the module");
goto out;
}
@@ -2793,31 +3552,33 @@ extern int insmod_main( int argc, char **argv)
#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
/* Version correspondence? */
-
- k_version = get_kernel_version(k_strversion);
- if (m_has_modinfo) {
- m_version = new_get_module_version(f, m_strversion);
- } else {
- m_version = old_get_module_version(f, m_strversion);
- if (m_version == -1) {
- errorMsg("couldn't find the kernel version the module was "
- "compiled for");
- goto out;
+ if (!flag_quiet) {
+ if (uname(&uts_info) < 0)
+ uts_info.release[0] = '\0';
+ if (m_has_modinfo) {
+ m_version = new_get_module_version(f, m_strversion);
+ } else {
+ m_version = old_get_module_version(f, m_strversion);
+ if (m_version == -1) {
+ error_msg("couldn't find the kernel version the module was "
+ "compiled for");
+ goto out;
+ }
}
- }
- if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) {
- if (flag_force_load) {
- errorMsg("Warning: kernel-module version mismatch\n"
- "\t%s was compiled for kernel version %s\n"
- "\twhile this kernel is version %s",
- m_filename, m_strversion, k_strversion);
- } else {
- errorMsg("kernel-module version mismatch\n"
- "\t%s was compiled for kernel version %s\n"
- "\twhile this kernel is version %s.",
- m_filename, m_strversion, k_strversion);
- goto out;
+ if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) {
+ if (flag_force_load) {
+ error_msg("Warning: kernel-module version mismatch\n"
+ "\t%s was compiled for kernel version %s\n"
+ "\twhile this kernel is version %s",
+ m_filename, m_strversion, uts_info.release);
+ } else {
+ error_msg("kernel-module version mismatch\n"
+ "\t%s was compiled for kernel version %s\n"
+ "\twhile this kernel is version %s.",
+ m_filename, m_strversion, uts_info.release);
+ goto out;
+ }
}
}
k_crcs = 0;
@@ -2826,21 +3587,21 @@ extern int insmod_main( int argc, char **argv)
k_new_syscalls = !query_module(NULL, 0, NULL, 0, NULL);
if (k_new_syscalls) {
-#ifdef BB_FEATURE_INSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
if (!new_get_kernel_symbols())
goto out;
k_crcs = new_is_kernel_checksummed();
#else
- errorMsg("Not configured to support new kernels");
+ error_msg("Not configured to support new kernels");
goto out;
#endif
} else {
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
if (!old_get_kernel_symbols(m_name))
goto out;
k_crcs = old_is_kernel_checksummed();
#else
- errorMsg("Not configured to support old kernels");
+ error_msg("Not configured to support old kernels");
goto out;
#endif
}
@@ -2871,13 +3632,14 @@ extern int insmod_main( int argc, char **argv)
goto out;
}
obj_allocate_commons(f);
+ check_tainted_module(f, m_name);
if (m_has_modinfo
- ? !new_process_module_arguments(f, argc-1, argv+1)
- : !old_process_module_arguments(f, argc-1, argv+1))
- {
+ ? !new_process_module_arguments(f, argc - 1, argv + 1)
+ : !old_process_module_arguments(f, argc - 1, argv + 1))
+ {
goto out;
- }
+ }
arch_create_got(f);
hide_special_symbols(f);
@@ -2889,25 +3651,31 @@ extern int insmod_main( int argc, char **argv)
m_size = obj_load_size(f);
- errno = 0;
m_addr = create_module(m_name, m_size);
- switch (errno) {
- case 0:
- break;
+ if (m_addr==-1) switch (errno) {
case EEXIST:
- errorMsg("A module named %s already exists", m_name);
- /* Considered as a success in stage1 */
- fclose(fp);
- return(TRUE);
+ error_msg("A module named %s already exists", m_name);
+ goto out;
case ENOMEM:
- errorMsg("Can't allocate kernel memory for module; needed %lu bytes",
+ error_msg("Can't allocate kernel memory for module; needed %lu bytes",
m_size);
goto out;
default:
- errorMsg("create_module: %s: %s", m_name, strerror(errno));
+ perror_msg("create_module: %s", m_name);
goto out;
}
+#if !LOADBITS
+ /*
+ * the PROGBITS section was not loaded by the obj_load
+ * now we can load them directly into the kernel memory
+ */
+ if (!obj_load_progbits(fp, f, (char*)m_addr)) {
+ delete_module(m_name);
+ goto out;
+ }
+#endif
+
if (!obj_relocate(f, m_addr)) {
delete_module(m_name);
goto out;
@@ -2921,14 +3689,13 @@ extern int insmod_main( int argc, char **argv)
goto out;
}
- exit_status = TRUE;
+ exit_status = EXIT_SUCCESS;
out:
fclose(fp);
return(exit_status);
}
-
int insmod_call(char * full_filename, char * params)
{
int argc = 2;
diff --git a/mdk-stage1/insmod-modutils/Makefile b/mdk-stage1/insmod-modutils/Makefile
index e8f78d2d0..48508ba1f 100644
--- a/mdk-stage1/insmod-modutils/Makefile
+++ b/mdk-stage1/insmod-modutils/Makefile
@@ -15,12 +15,16 @@ include $(top_dir)/Makefile.common
INCS = -I./include
-DEFS = -Wno-error -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH)
+TAINT_URL = http://www.tux.org/lkml/\#export-tainted
+
+DEFS = -Wno-error -D_GNU_SOURCE \
+ -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH) \
+ -DTAINT_URL='"$(TAINT_URL)"'
DIRS = util obj
-all: dirs insmod libinsmod.a #libinsmod-DIET.a
+all: dirs insmod libinsmod.a
dirs:
@for n in . $(DIRS); do \
@@ -31,11 +35,11 @@ clean:
@for n in $(DIRS); do \
(cd $$n; make clean) \
done
- rm -rf t *.o insmod libinsmod.a libinsmod-DIET.a
+ rm -rf t *.o insmod libinsmod.a
insmod: insmod-frontend.o insmod.o ./util/libutil-STANDALONE.a ./obj/libobj.a
- gcc -o $@ $^
+ $(DIET) gcc -o $@ $^
$(STRIPCMD) $@
t/.create_stuff: util/libutil.a obj/libobj.a
@@ -48,16 +52,8 @@ libinsmod.a: insmod.o t/.create_stuff
ar cru $@ insmod.o t/*
ranlib $@
-libinsmod-DIET.a: insmod-DIET.o ./util/libutil-DIET.a ./obj/libobj-DIET.a
- ar cru $@ $^
- ranlib $@
-
insmod-frontend.o: insmod-frontend.c insmod.c
- gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c insmod-frontend.c
+ $(DIET) gcc $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -c insmod-frontend.c
insmod.o: insmod.c
- gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c insmod.c
-
-insmod-DIET.o: insmod.c
- gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -o $@ -c insmod.c
-
+ $(DIET) gcc $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -c insmod.c
diff --git a/mdk-stage1/insmod-modutils/include/config.h b/mdk-stage1/insmod-modutils/include/config.h
index 11da6a523..3a37b00d4 100644
--- a/mdk-stage1/insmod-modutils/include/config.h
+++ b/mdk-stage1/insmod-modutils/include/config.h
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <sys/utsname.h>
+#define MODUTILS_MACROS "/lib/modutils/macros"
#define ETC_MODULES_CONF "/etc/modules.conf"
#define EXEC_PRE_INSTALL 0
@@ -92,6 +93,8 @@ enum gen_file_enum {
GEN_ISAPNPMAPFILE,
GEN_USBMAPFILE,
GEN_PARPORTMAPFILE,
+ GEN_IEEE1394MAPFILE,
+ GEN_PNPBIOSMAPFILE,
GEN_DEPFILE,
};
diff --git a/mdk-stage1/insmod-modutils/include/elf_alpha.h b/mdk-stage1/insmod-modutils/include/elf_alpha.h
index f1ec66f1c..4202bcc14 100644
--- a/mdk-stage1/insmod-modutils/include/elf_alpha.h
+++ b/mdk-stage1/insmod-modutils/include/elf_alpha.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for the Alpha. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS64
#define ELFDATAM ELFDATA2LSB
diff --git a/mdk-stage1/insmod-modutils/include/elf_arm.h b/mdk-stage1/insmod-modutils/include/elf_arm.h
index f6b531e88..cf04cafe0 100644
--- a/mdk-stage1/insmod-modutils/include/elf_arm.h
+++ b/mdk-stage1/insmod-modutils/include/elf_arm.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for ARM. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS32
#define ELFDATAM ELFDATA2LSB
diff --git a/mdk-stage1/insmod-modutils/include/elf_i386.h b/mdk-stage1/insmod-modutils/include/elf_i386.h
index c6c2d326e..f5c57d384 100644
--- a/mdk-stage1/insmod-modutils/include/elf_i386.h
+++ b/mdk-stage1/insmod-modutils/include/elf_i386.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for i386 et al. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS32
#define ELFDATAM ELFDATA2LSB
diff --git a/mdk-stage1/insmod-modutils/include/elf_m68k.h b/mdk-stage1/insmod-modutils/include/elf_m68k.h
index 817fc8f2c..c488ba9d1 100644
--- a/mdk-stage1/insmod-modutils/include/elf_m68k.h
+++ b/mdk-stage1/insmod-modutils/include/elf_m68k.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for m68k. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS32
#define ELFDATAM ELFDATA2MSB
diff --git a/mdk-stage1/insmod-modutils/include/elf_mips.h b/mdk-stage1/insmod-modutils/include/elf_mips.h
index 8a0430216..4b91ddd01 100644
--- a/mdk-stage1/insmod-modutils/include/elf_mips.h
+++ b/mdk-stage1/insmod-modutils/include/elf_mips.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for MIPS. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS32
#ifdef __MIPSEB__
diff --git a/mdk-stage1/insmod-modutils/include/elf_ppc.h b/mdk-stage1/insmod-modutils/include/elf_ppc.h
index 71596de8c..b0060ace1 100644
--- a/mdk-stage1/insmod-modutils/include/elf_ppc.h
+++ b/mdk-stage1/insmod-modutils/include/elf_ppc.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for the PowerPC. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS32
#define ELFDATAM ELFDATA2MSB
diff --git a/mdk-stage1/insmod-modutils/include/elf_s390.h b/mdk-stage1/insmod-modutils/include/elf_s390.h
index 547d66b83..7a35bde93 100644
--- a/mdk-stage1/insmod-modutils/include/elf_s390.h
+++ b/mdk-stage1/insmod-modutils/include/elf_s390.h
@@ -1,10 +1,11 @@
/* Machine-specific elf macros for i386 et al. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS32
#define ELFDATAM ELFDATA2MSB
-#define MATCH_MACHINE(x) (x == EM_S390)
+#define EM_S390_OLD 0xa390
+
+#define MATCH_MACHINE(x) (x == EM_S390 || x == EM_S390_OLD)
#define SHT_RELM SHT_RELA
#define Elf32_RelM Elf32_Rela
diff --git a/mdk-stage1/insmod-modutils/include/elf_sparc.h b/mdk-stage1/insmod-modutils/include/elf_sparc.h
index 9b5c348d9..8903b2654 100644
--- a/mdk-stage1/insmod-modutils/include/elf_sparc.h
+++ b/mdk-stage1/insmod-modutils/include/elf_sparc.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for the Sparc. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS32
#define ELFDATAM ELFDATA2MSB
diff --git a/mdk-stage1/insmod-modutils/include/elf_sparc64.h b/mdk-stage1/insmod-modutils/include/elf_sparc64.h
index 158edd7e1..891e0c3d9 100644
--- a/mdk-stage1/insmod-modutils/include/elf_sparc64.h
+++ b/mdk-stage1/insmod-modutils/include/elf_sparc64.h
@@ -1,5 +1,4 @@
/* Machine-specific elf macros for the Sparc. */
-#ident "$Id$"
#define ELFCLASSM ELFCLASS64
#define ELFDATAM ELFDATA2MSB
diff --git a/mdk-stage1/insmod-modutils/include/elf_x86_64.h b/mdk-stage1/insmod-modutils/include/elf_x86_64.h
new file mode 100644
index 000000000..6d7581b3f
--- /dev/null
+++ b/mdk-stage1/insmod-modutils/include/elf_x86_64.h
@@ -0,0 +1,9 @@
+/* Machine-specific elf macros for x86_64. */
+
+#define ELFCLASSM ELFCLASS64
+#define ELFDATAM ELFDATA2LSB
+
+#define MATCH_MACHINE(x) (x == EM_X86_64)
+
+#define SHT_RELM SHT_RELA
+#define Elf64_RelM Elf64_Rela
diff --git a/mdk-stage1/insmod-modutils/include/kallsyms.h b/mdk-stage1/insmod-modutils/include/kallsyms.h
index 9748873cf..90bb75f22 100644
--- a/mdk-stage1/insmod-modutils/include/kallsyms.h
+++ b/mdk-stage1/insmod-modutils/include/kallsyms.h
@@ -1,3 +1,6 @@
+#ifndef MODUTILS_KALLSYMS_H
+#define MODUTILS_KALLSYMS_H 1
+
/* kallsyms headers
Copyright 2000 Keith Owens <kaos@ocs.com.au>
@@ -24,11 +27,6 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ident "$Id$"
-
-#ifndef MODUTILS_KALLSYMS_H
-#define MODUTILS_KALLSYMS_H 1
-
/* Have to (re)define these ElfW entries here because external kallsyms
* code does not have access to modutils/include/obj.h. This code is
* included from user spaces tools (modutils) and kernel, they need
diff --git a/mdk-stage1/insmod-modutils/include/kerneld.h b/mdk-stage1/insmod-modutils/include/kerneld.h
index 3bc2c9d42..f32e34b4a 100644
--- a/mdk-stage1/insmod-modutils/include/kerneld.h
+++ b/mdk-stage1/insmod-modutils/include/kerneld.h
@@ -4,8 +4,6 @@
#ifndef MODUTILS_KERNELD_H
#define MODUTILS_KERNELD_H
-#ident "$Id$"
-
#define KERNELD_SYSTEM 1
#define KERNELD_REQUEST_MODULE 2 /* "insmod" */
#define KERNELD_RELEASE_MODULE 3 /* "rmmod" */
diff --git a/mdk-stage1/insmod-modutils/include/module.h b/mdk-stage1/insmod-modutils/include/module.h
index db49ab2b2..ae8224f8a 100644
--- a/mdk-stage1/insmod-modutils/include/module.h
+++ b/mdk-stage1/insmod-modutils/include/module.h
@@ -1,3 +1,6 @@
+#ifndef MODUTILS_MODULE_H
+#define MODUTILS_MODULE_H 1
+
/* Definitions for the Linux module syscall interface.
Copyright 1996, 1997 Linux International.
@@ -20,11 +23,6 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ifndef MODUTILS_MODULE_H
-#define MODUTILS_MODULE_H 1
-
-#ident "$Id$"
-
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
to be dependant on a particular kernel version to compile insmod. */
@@ -207,4 +205,13 @@ int delete_module(const char *);
*/
extern unsigned int safemode;
+/*======================================================================*/
+/* Tainted kernel information. This must match include/linux/kernel.h */
+/* and kernel/panic.c. */
+
+#define TAINT_FILENAME "/proc/sys/kernel/tainted"
+#define TAINT_PROPRIETORY_MODULE (1<<0)
+#define TAINT_FORCED_MODULE (1<<1)
+#define TAINT_UNSAFE_SMP (1<<2)
+
#endif /* module.h */
diff --git a/mdk-stage1/insmod-modutils/include/obj.h b/mdk-stage1/insmod-modutils/include/obj.h
index b140c65c3..de346b16a 100644
--- a/mdk-stage1/insmod-modutils/include/obj.h
+++ b/mdk-stage1/insmod-modutils/include/obj.h
@@ -1,3 +1,6 @@
+#ifndef MODUTILS_OBJ_H
+#define MODUTILS_OBJ_H 1
+
/* Elf object file loading and relocation routines.
Copyright 1996, 1997 Linux International.
@@ -21,16 +24,13 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ifndef MODUTILS_OBJ_H
-#define MODUTILS_OBJ_H 1
-
-#ident "$Id$"
-
/* The relocatable object is manipulated using elfin types. */
#include <stdio.h>
+#include <sys/types.h>
#include <elf.h>
#include ELF_MACHINE_H
+#include "module.h"
#ifndef ElfW
# if ELFCLASSM == ELFCLASS32
@@ -77,7 +77,7 @@ struct obj_symbol
{
struct obj_symbol *next; /* hash table link */
const char *name;
- unsigned long value;
+ tgt_long value;
unsigned long size;
int secidx; /* the defining section index/module */
int info;
@@ -161,6 +161,8 @@ struct obj_symbol_patch_struct
#define obj_create_image ObjW(create_image)
#define obj_addr_to_native_ptr ObjW(addr_to_native_ptr)
#define obj_native_ptr_to_addr ObjW(native_ptr_to_addr)
+#define obj_kallsyms ObjW(kallsyms)
+#define obj_gpl_license ObjW(gpl_license)
#define arch_new_file ObjW(arch_new_file)
#define arch_new_section ObjW(arch_new_section)
#define arch_new_symbol ObjW(arch_new_symbol)
@@ -198,7 +200,8 @@ void obj_insert_section_load_order (struct obj_file *f,
struct obj_section *obj_create_alloced_section (struct obj_file *f,
const char *name,
unsigned long align,
- unsigned long size);
+ unsigned long size,
+ unsigned long flags);
struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
const char *name,
@@ -264,7 +267,7 @@ union obj_ptr_4 {
void *ptr;
};
union obj_ptr_8 {
- Elf64_Xword addr;
+ u_int64_t addr; /* Should be Elf64_Xword but not all users have this yet */
void *ptr;
};
@@ -272,4 +275,24 @@ void *obj_addr_to_native_ptr(ElfW(Addr));
ElfW(Addr) obj_native_ptr_to_addr(void *);
+/* Standard method of finding relocation symbols, sets isym */
+#define obj_find_relsym(isym, f, find, rel, symtab, strtab) \
+ { \
+ unsigned long symndx = ELFW(R_SYM)((rel)->r_info); \
+ ElfW(Sym) *extsym = (symtab)+symndx; \
+ if (ELFW(ST_BIND)(extsym->st_info) == STB_LOCAL) { \
+ isym = (typeof(isym)) (f)->local_symtab[symndx]; \
+ } \
+ else { \
+ const char *name; \
+ if (extsym->st_name) \
+ name = (strtab) + extsym->st_name; \
+ else \
+ name = (f)->sections[extsym->st_shndx]->name; \
+ isym = (typeof(isym)) obj_find_symbol((find), name); \
+ } \
+ }
+
+int obj_gpl_license(struct obj_file *, const char **);
+
#endif /* obj.h */
diff --git a/mdk-stage1/insmod-modutils/include/util.h b/mdk-stage1/insmod-modutils/include/util.h
index b2e4a67c3..0a1354bec 100644
--- a/mdk-stage1/insmod-modutils/include/util.h
+++ b/mdk-stage1/insmod-modutils/include/util.h
@@ -1,3 +1,6 @@
+#ifndef MODUTILS_UTIL_H
+#define MODUTILS_UTIL_H 1
+
/* Miscelaneous utility functions.
Copyright 1996, 1997 Linux International.
@@ -20,11 +23,6 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ifndef MODUTILS_UTIL_H
-#define MODUTILS_UTIL_H 1
-
-#ident "$Id$"
-
#include <stdio.h>
#include <sys/stat.h>
diff --git a/mdk-stage1/insmod-modutils/include/version.h b/mdk-stage1/insmod-modutils/include/version.h
index 51ca0eb29..9ca0c57a9 100644
--- a/mdk-stage1/insmod-modutils/include/version.h
+++ b/mdk-stage1/insmod-modutils/include/version.h
@@ -1 +1 @@
-#define MODUTILS_VERSION "2.4.2"
+#define MODUTILS_VERSION "2.4.19"
diff --git a/mdk-stage1/insmod-modutils/insmod.c b/mdk-stage1/insmod-modutils/insmod.c
index 359b28837..b0b7c2a0d 100644
--- a/mdk-stage1/insmod-modutils/insmod.c
+++ b/mdk-stage1/insmod-modutils/insmod.c
@@ -54,16 +54,15 @@
Keith Owens <kaos@ocs.com.au> November 2000.
Add persistent data support.
Keith Owens <kaos@ocs.com.au> November 2000.
+ Add tainted module support.
+ Keith Owens <kaos@ocs.com.au> September 2001.
*/
-#ident "$Id$"
-
#include "../insmod.h"
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-//#include <alloca.h> provided by stdlib
#include <limits.h>
#include <ctype.h>
#include <errno.h>
@@ -71,6 +70,7 @@
#include <getopt.h>
#include <sys/stat.h>
#include <sys/file.h>
+#include <sys/fcntl.h>
#include "module.h"
#include "obj.h"
@@ -90,9 +90,12 @@ static int flag_silent_probe = 0;
static int flag_export = 1;
static int flag_load_map = 0;
static int flag_ksymoops = 1;
+static int flag_numeric_only = 0;
static int n_ext_modules_used;
static int m_has_modinfo;
+static int gplonly_seen;
+static int warnings;
extern int insmod_main(int argc, char **argv);
extern int insmod_main_32(int argc, char **argv);
@@ -105,6 +108,15 @@ extern int kallsyms_main(int argc, char **argv);
/*======================================================================*/
+/* Only use the numeric part of the version string? */
+
+static void use_numeric_only(int major, int minor, char *str)
+{
+ if (((major << 8) + minor) >= 0x0205 /* kernel 2.5 */
+ || flag_numeric_only)
+ *str = '\0';
+}
+
/* Get the kernel version in the canonical integer form. */
static int get_kernel_version(char str[STRVERSIONLEN])
@@ -112,8 +124,9 @@ static int get_kernel_version(char str[STRVERSIONLEN])
char *p, *q;
int a, b, c;
- strncpy(str, uts_info.release, STRVERSIONLEN);
- p = uts_info.release;
+ strncpy(str, uts_info.release, STRVERSIONLEN-1);
+ str[STRVERSIONLEN-1] = '\0';
+ p = str;
a = strtoul(p, &p, 10);
if (*p != '.')
@@ -124,6 +137,7 @@ static int get_kernel_version(char str[STRVERSIONLEN])
c = strtoul(p + 1, &q, 10);
if (p + 1 == q)
return -1;
+ use_numeric_only(a, b, q);
return a << 16 | b << 8 | c;
}
@@ -232,7 +246,7 @@ static unsigned long ncv_symbol_hash(const char *str)
* to the new module.
*/
static int add_symbols_from(struct obj_file *f, int idx,
- struct module_symbol *syms, size_t nsyms)
+ struct module_symbol *syms, size_t nsyms, int gpl)
{
struct module_symbol *s;
size_t i;
@@ -247,8 +261,57 @@ static int add_symbols_from(struct obj_file *f, int idx,
*/
struct obj_symbol *sym;
+ /* GPL licensed modules can use symbols exported with
+ * EXPORT_SYMBOL_GPL, so ignore any GPLONLY_ prefix on the
+ * exported names. Non-GPL modules never see any GPLONLY_
+ * symbols so they cannot fudge it by adding the prefix on
+ * their references.
+ */
+ if (strncmp((char *)s->name, "GPLONLY_", 8) == 0) {
+ gplonly_seen = 1;
+ if (gpl)
+ ((char *)s->name) += 8;
+ else
+ continue;
+ }
+
sym = obj_find_symbol(f, (char *) s->name);
- if (sym && !ELFW(ST_BIND) (sym->info) == STB_LOCAL) {
+#ifdef ARCH_ppc64
+ if (!sym)
+ {
+ static size_t buflen = 0;
+ static char *buf = 0;
+ int len;
+
+ /* ppc64 is one of those architectures with
+ function descriptors. A function is exported
+ and accessed across object boundaries via its
+ function descriptor. The function code symbol
+ happens to be the function name, prefixed with
+ '.', and a function call is a branch to the
+ code symbol. The linker recognises when a call
+ crosses object boundaries, and inserts a stub
+ to call via the function descriptor.
+ obj_ppc64.c of course does the same thing, so
+ here we recognise that an undefined code symbol
+ can be satisfied by the corresponding function
+ descriptor symbol. */
+
+ len = strlen ((char *) s->name) + 2;
+ if (buflen < len)
+ {
+ buflen = len + (len >> 1);
+ if (buf)
+ free (buf);
+ buf = malloc (buflen);
+ }
+ buf[0] = '.';
+ strcpy (buf + 1, (char *) s->name);
+ sym = obj_find_symbol(f, buf);
+ }
+#endif /* ARCH_ppc64 */
+
+ if (sym && ELFW(ST_BIND) (sym->info) != STB_LOCAL) {
sym = obj_add_symbol(f, (char *) s->name, -1,
ELFW(ST_INFO) (STB_GLOBAL, STT_NOTYPE),
idx, s->value, 0);
@@ -264,7 +327,7 @@ static int add_symbols_from(struct obj_file *f, int idx,
return used;
}
-static void add_kernel_symbols(struct obj_file *f)
+static void add_kernel_symbols(struct obj_file *f, int gpl)
{
struct module_stat *m;
size_t i, nused = 0;
@@ -272,13 +335,13 @@ static void add_kernel_symbols(struct obj_file *f)
/* Add module symbols first. */
for (i = 0, m = module_stat; i < n_module_stat; ++i, ++m)
if (m->nsyms &&
- add_symbols_from(f, SHN_HIRESERVE + 2 + i, m->syms, m->nsyms))
+ add_symbols_from(f, SHN_HIRESERVE + 2 + i, m->syms, m->nsyms, gpl))
m->status = 1 /* used */, ++nused;
n_ext_modules_used = nused;
/* And finally the symbols from the kernel proper. */
if (nksyms)
- add_symbols_from(f, SHN_HIRESERVE + 1, ksyms, nksyms);
+ add_symbols_from(f, SHN_HIRESERVE + 1, ksyms, nksyms, gpl);
}
static void hide_special_symbols(struct obj_file *f)
@@ -326,7 +389,7 @@ static void print_load_map(struct obj_file *f)
if (a == -1)
a = 0;
- lprintf("%-16s%08lx %0*lx 2**%d",
+ lprintf("%-15s %08lx %0*lx 2**%d",
sec->name,
(long)sec->header.sh_size,
(int) (2 * sizeof(void *)),
@@ -465,9 +528,10 @@ static int old_create_mod_use_count(struct obj_file *f)
*/
got = obj_find_symbol(f, "_GLOBAL_OFFSET_TABLE_");
if (got)
-{
+ {
sec = obj_create_alloced_section(f, ".got",
- sizeof(long), sizeof(long));
+ sizeof(long), sizeof(long),
+ SHF_WRITE);
got->secidx = sec->idx; /* mark the symbol as defined */
}
return 1;
@@ -491,7 +555,8 @@ static void add_ksymtab(struct obj_file *f, struct obj_symbol *sym)
sec = NULL;
}
if (!sec)
- sec = obj_create_alloced_section(f, "__ksymtab", tgt_sizeof_void_p, 0);
+ sec = obj_create_alloced_section(f, "__ksymtab",
+ tgt_sizeof_void_p, 0, 0);
if (!sec)
return;
sec->header.sh_flags |= SHF_ALLOC;
@@ -513,9 +578,9 @@ static int create_module_ksymtab(struct obj_file *f)
struct module_ref *dep;
struct obj_symbol *tm;
- sec = obj_create_alloced_section(f, ".kmodtab", tgt_sizeof_void_p,
- (sizeof(struct module_ref)
- * n_ext_modules_used));
+ sec = obj_create_alloced_section(f, ".kmodtab",
+ tgt_sizeof_void_p,
+ sizeof(struct module_ref) * n_ext_modules_used, 0);
if (!sec)
return 0;
@@ -524,6 +589,9 @@ static int create_module_ksymtab(struct obj_file *f)
for (i = 0; i < n_module_stat; ++i)
if (module_stat[i].status /* used */) {
dep->dep = module_stat[i].addr;
+#ifdef ARCH_ppc64
+ dep->dep |= ppc64_module_base (f);
+#endif
obj_symbol_patch(f, sec->idx, (char *) &dep->ref - sec->contents, tm);
dep->next_ref = 0;
++dep;
@@ -573,7 +641,9 @@ static int get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
} else
m_has_modinfo = 1;
- strncpy(str, p, STRVERSIONLEN);
+ strncpy(str, p, STRVERSIONLEN-1);
+ str[STRVERSIONLEN-1] = '\0';
+ p = str;
a = strtoul(p, &p, 10);
if (*p != '.')
@@ -584,6 +654,7 @@ static int get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
c = strtoul(p + 1, &q, 10);
if (p + 1 == q)
return -1;
+ use_numeric_only(a, b, q);
return a << 16 | b << 8 | c;
}
@@ -645,6 +716,7 @@ static void add_ksymoops_symbols(struct obj_file *f, const char *filename,
int save_errno = errno;
error("cannot get realpath for %s", filename);
errno = save_errno;
+ perror("");
absolute_filename = xstrdup(filename);
}
@@ -679,7 +751,7 @@ static void add_ksymoops_symbols(struct obj_file *f, const char *filename,
version = get_module_version(f, str); /* -1 if not found */
snprintf(name, l, "%s%s_O%s_M%0*lX_V%d",
symprefix, m_name, absolute_filename,
- 2*sizeof(statbuf.st_mtime), statbuf.st_mtime,
+ (int)(2*sizeof(statbuf.st_mtime)), statbuf.st_mtime,
version);
sym = obj_add_symbol(f, name, -1,
ELFW(ST_INFO) (STB_GLOBAL, STT_NOTYPE),
@@ -756,14 +828,10 @@ static int process_module_arguments(struct obj_file *f, int argc, char **argv, i
memcpy(key + 5, *argv, n);
key[n + 5] = '\0';
if ((fmt = get_modinfo_value(f, key)) == NULL) {
- if (required) {
- error("invalid parameter %s", key);
- return 0;
- }
- else {
- if (flag_verbose)
- lprintf("ignoring %s", *argv);
- continue; /* silently ignore optional parameters */
+ if (required || flag_verbose) {
+ lprintf("Warning: ignoring %s, no such parameter in this module", *argv);
+ ++warnings;
+ continue;
}
}
key += 5;
@@ -1014,7 +1082,7 @@ static int add_kallsyms(struct obj_file *f,
}
}
if (!*module_kallsyms)
- *module_kallsyms = obj_create_alloced_section(f, KALLSYMS_SEC_NAME, 0, 0);
+ *module_kallsyms = obj_create_alloced_section(f, KALLSYMS_SEC_NAME, 0, 0, 0);
/* Size and populate kallsyms */
if (obj_kallsyms(f, &f_kallsyms))
@@ -1046,7 +1114,7 @@ static int add_archdata(struct obj_file *f,
}
}
if (!*sec)
- *sec = obj_create_alloced_section(f, ARCHDATA_SEC_NAME, 16, 0);
+ *sec = obj_create_alloced_section(f, ARCHDATA_SEC_NAME, 16, 0, 0);
/* Size and populate archdata */
if (arch_archdata(f, *sec))
@@ -1147,7 +1215,8 @@ static int init_module(const char *m_name, struct obj_file *f,
if (ret) {
error("init_module: %m");
lprintf("Hint: insmod errors can be caused by incorrect module parameters, "
- "including invalid IO or IRQ parameters");
+ "including invalid IO or IRQ parameters.\n"
+ " You may find more information in syslog or the output from dmesg");
}
}
@@ -1276,6 +1345,7 @@ static int check_module_parameter(struct obj_file *f, char *key, char *value, in
* most error conditions. Make these all errors in 2.5.
*/
lprintf("Warning: %s symbol for parameter %s not found", error_file, key);
+ ++warnings;
return(1);
}
@@ -1290,6 +1360,7 @@ static int check_module_parameter(struct obj_file *f, char *key, char *value, in
if (max < min) {
lprintf("Warning: %s parameter %s has max < min!", error_file, key);
+ ++warnings;
return(1);
}
@@ -1297,6 +1368,7 @@ static int check_module_parameter(struct obj_file *f, char *key, char *value, in
case 'c':
if (!isdigit(p[1])) {
lprintf("%s parameter %s has no size after 'c'!", error_file, key);
+ ++warnings;
return(1);
}
while (isdigit(p[1]))
@@ -1310,9 +1382,11 @@ static int check_module_parameter(struct obj_file *f, char *key, char *value, in
break;
case '\0':
lprintf("%s parameter %s has no format character!", error_file, key);
+ ++warnings;
return(1);
default:
lprintf("%s parameter %s has unknown format character '%c'", error_file, key, *p);
+ ++warnings;
return(1);
}
switch (*++p) {
@@ -1327,6 +1401,7 @@ static int check_module_parameter(struct obj_file *f, char *key, char *value, in
break;
default:
lprintf("%s parameter %s has unknown format modifier '%c'", error_file, key, *p);
+ ++warnings;
return(1);
}
return(0);
@@ -1374,6 +1449,74 @@ static void check_module_parameters(struct obj_file *f, int *persist_flag)
return;
}
+static void set_tainted(struct obj_file *f, int fd, int kernel_has_tainted,
+ int noload, int taint,
+ const char *text1, const char *text2)
+{
+ char buf[80];
+ int oldval;
+ static int first = 1;
+ if (fd < 0 && !kernel_has_tainted)
+ return; /* New modutils on old kernel */
+ lprintf("Warning: loading %s will taint the kernel: %s%s",
+ f->filename, text1, text2);
+ ++warnings;
+ if (first) {
+ lprintf(" See %s for information about tainted modules", TAINT_URL);
+ first = 0;
+ }
+ if (fd >= 0 && !noload) {
+ read(fd, buf, sizeof(buf)-1);
+ buf[sizeof(buf)-1] = '\0';
+ oldval = strtoul(buf, NULL, 10);
+ sprintf(buf, "%d\n", oldval | taint);
+ write(fd, buf, strlen(buf));
+ }
+}
+
+/* Check if loading this module will taint the kernel. */
+static void check_tainted_module(struct obj_file *f, int noload)
+{
+ static const char tainted_file[] = TAINT_FILENAME;
+ int fd, kernel_has_tainted;
+ const char *ptr;
+
+ if ((fd = open(tainted_file, O_RDWR)) < 0) {
+ if (errno == ENOENT)
+ kernel_has_tainted = 0;
+ else if (errno == EACCES)
+ kernel_has_tainted = 1;
+ else {
+ perror(tainted_file);
+ kernel_has_tainted = 0;
+ }
+ }
+ else
+ kernel_has_tainted = 1;
+
+ switch (obj_gpl_license(f, &ptr)) {
+ case 0:
+ break;
+ case 1:
+ set_tainted(f, fd, kernel_has_tainted, noload, TAINT_PROPRIETORY_MODULE, "no license", "");
+ break;
+ case 2:
+ /* The module has a non-GPL license so we pretend that the
+ * kernel always has a taint flag to get a warning even on
+ * kernels without the proc flag.
+ */
+ set_tainted(f, fd, 1, noload, TAINT_PROPRIETORY_MODULE, "non-GPL license - ", ptr);
+ break;
+ default:
+ set_tainted(f, fd, 1, noload, TAINT_PROPRIETORY_MODULE, "Unexpected return from obj_gpl_license", "");
+ break;
+ }
+
+ if (flag_force_load)
+ set_tainted(f, fd, 1, noload, TAINT_FORCED_MODULE, "forced load", "");
+ if (fd >= 0)
+ close(fd);
+}
/* For common 3264 code, only compile the usage message once, in the 64 bit version */
#if defined(COMMON_3264) && defined(ONLY_32)
@@ -1382,7 +1525,7 @@ extern void insmod_usage(void); /* Use the copy in the 64 bit version */
void insmod_usage(void)
{
fputs("Usage:\n"
- "insmod [-fhkLmnpqrsSvVxXyY] [-e persist_name] [-o module_name] [-O blob_name] [-P prefix] module [ symbol=value ... ]\n"
+ "insmod [-fhkLmnpqrsSvVxXyYN] [-e persist_name] [-o module_name] [-O blob_name] [-P prefix] module [ symbol=value ... ]\n"
"\n"
" module Name of a loadable kernel module ('.o' can be omitted)\n"
" -f, --force Force loading under wrong kernel version\n"
@@ -1402,6 +1545,7 @@ void insmod_usage(void)
" -X, --export Do export externs (default)\n"
" -y, --noksymoops Do not add ksymoops symbols\n"
" -Y, --ksymoops Do add ksymoops symbols (default)\n"
+ " -N, --numeric-only Only check the numeric part of the kernel version\n"
" -e persist_name\n"
" --persist=persist_name Filename to hold any persistent data from the module\n"
" -o NAME, --name=NAME Set internal module name to NAME\n"
@@ -1445,8 +1589,8 @@ int INSMOD_MAIN(int argc, char **argv)
{"export", 0, 0, 'X'},
{"noksymoops", 0, 0, 'y'},
{"ksymoops", 0, 0, 'Y'},
-
{"persist", 1, 0, 'e'},
+ {"numeric-only", 1, 0, 'N'},
{"name", 1, 0, 'o'},
{"blob", 1, 0, 'O'},
{"prefix", 1, 0, 'P'},
@@ -1472,6 +1616,7 @@ int INSMOD_MAIN(int argc, char **argv)
int force_kallsyms = 0;
int persist_parms = 0; /* does module have persistent parms? */
int i;
+ int gpl;
error_file = "insmod";
@@ -1479,7 +1624,7 @@ int INSMOD_MAIN(int argc, char **argv)
errors = optind = 0;
/* Process the command line. */
- while ((o = getopt_long(argc, argv, "fhkLmnpqrsSvVxXyYe:o:O:P:R:",
+ while ((o = getopt_long(argc, argv, "fhkLmnpqrsSvVxXyYNe:o:O:P:R:",
&long_opts[0], NULL)) != EOF)
switch (o) {
case 'f': /* force loading */
@@ -1533,6 +1678,9 @@ int INSMOD_MAIN(int argc, char **argv)
case 'Y': /* do define ksymoops symbols */
flag_ksymoops = 1;
break;
+ case 'N': /* only check numeric part of kernel version */
+ flag_numeric_only = 1;
+ break;
case 'e': /* persistent data filename */
free(persist_name);
@@ -1566,8 +1714,10 @@ int INSMOD_MAIN(int argc, char **argv)
(!persistdir || !*persistdir)) {
free(persist_name);
persist_name = NULL;
- if (flag_verbose)
+ if (flag_verbose) {
lprintf("insmod: -e \"\" ignored, no persistdir");
+ ++warnings;
+ }
}
if (m_name == NULL) {
@@ -1624,7 +1774,7 @@ int INSMOD_MAIN(int argc, char **argv)
*/
set_ncv_prefix(NULL);
- for (i = 0; i < n_module_stat; ++i) {
+ for (i = 0; !noload && i < n_module_stat; ++i) {
if (strcmp(module_stat[i].name, m_name) == 0) {
error("a module named %s already exists", m_name);
goto out;
@@ -1652,6 +1802,7 @@ int INSMOD_MAIN(int argc, char **argv)
"\t%s was compiled for kernel version %s\n"
"\twhile this kernel is version %s",
filename, m_strversion, k_strversion);
+ ++warnings;
} else {
if (!quiet)
error("kernel-module version mismatch\n"
@@ -1665,7 +1816,13 @@ int INSMOD_MAIN(int argc, char **argv)
obj_set_symbol_compare(f, ncv_strcmp, ncv_symbol_hash);
/* Let the module know about the kernel symbols. */
- add_kernel_symbols(f);
+ gpl = obj_gpl_license(f, NULL) == 0;
+ add_kernel_symbols(f, gpl);
+
+#ifdef ARCH_ppc64
+ if (!ppc64_process_syms (f))
+ goto out;
+#endif
/* Allocate common symbols, symbol tables, and string tables.
*
@@ -1684,17 +1841,33 @@ int INSMOD_MAIN(int argc, char **argv)
goto out;
#endif
- if (!obj_check_undefineds(f, quiet)) /* DEPMOD, obj_clear_undefineds */
+ arch_create_got(f); /* DEPMOD */
+ if (!obj_check_undefineds(f, quiet)) { /* DEPMOD, obj_clear_undefineds */
+ if (!gpl && !quiet) {
+ if (gplonly_seen)
+ error("\n"
+ "Hint: You are trying to load a module without a GPL compatible license\n"
+ " and it has unresolved symbols. The module may be trying to access\n"
+ " GPLONLY symbols but the problem is more likely to be a coding or\n"
+ " user error. Contact the module supplier for assistance, only they\n"
+ " can help you.\n");
+ else
+ error("\n"
+ "Hint: You are trying to load a module without a GPL compatible license\n"
+ " and it has unresolved symbols. Contact the module supplier for\n"
+ " assistance, only they can help you.\n");
+ }
goto out;
+ }
obj_allocate_commons(f); /* DEPMOD */
check_module_parameters(f, &persist_parms);
+ check_tainted_module(f, noload);
if (optind < argc) {
if (!process_module_arguments(f, argc - optind, argv + optind, 1))
goto out;
}
- arch_create_got(f); /* DEPMOD */
hide_special_symbols(f);
if (persist_parms && persist_name && *persist_name) {
@@ -1842,6 +2015,9 @@ int INSMOD_MAIN(int argc, char **argv)
} else {
errno = 0;
m_addr = create_module(m_name, m_size);
+#ifdef ARCH_ppc64
+ m_addr |= ppc64_module_base (f);
+#endif
switch (errno) {
case 0:
break;
@@ -1917,6 +2093,8 @@ int INSMOD_MAIN(int argc, char **argv)
delete_module(m_name);
goto out;
}
+ if (warnings && !noload)
+ lprintf("Module %s loaded, with warnings", m_name);
exit_status = 0;
out:
@@ -1941,7 +2119,6 @@ int insmod_main(int argc, char **argv)
#endif /* defined(COMMON_3264) && defined(ONLY_64) */
-
int insmod_call(char * full_filename, char * params)
{
int argc = 2;
diff --git a/mdk-stage1/insmod-modutils/obj/Makefile b/mdk-stage1/insmod-modutils/obj/Makefile
index 34b5df2d9..d44b2a6c6 100644
--- a/mdk-stage1/insmod-modutils/obj/Makefile
+++ b/mdk-stage1/insmod-modutils/obj/Makefile
@@ -23,11 +23,16 @@ INCS = -I./../include
DEFS = -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH) -DCONFIG_ROOT_CHECK_OFF=0
-OBJS = obj_kallsyms.o obj_common.o obj_load.o obj_reloc.o obj_$(ARCH).o
+ifeq (x86_64, $(ARCH))
+DEFS += -Wno-error
+endif
+
+OBJS = obj_kallsyms.o obj_common.o obj_load.o obj_reloc.o obj_$(ARCH).o \
+ obj_gpl_license.o
libobj.a: $(OBJS)
ar cru $@ $^
ranlib $@
-.c.o:
- gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $<
+%.o: %.c
+ $(DIET) gcc $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -c $<
diff --git a/mdk-stage1/insmod-modutils/obj/obj_alpha.c b/mdk-stage1/insmod-modutils/obj/obj_alpha.c
index 4006b3442..175012716 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_alpha.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_alpha.c
@@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <string.h>
#include <assert.h>
@@ -28,6 +26,12 @@
#include <obj.h>
#include <util.h>
+
+/* This relocation got renamed, and the change hasn't propagated yet. */
+#ifndef R_ALPHA_GPREL16
+#define R_ALPHA_GPREL16 R_ALPHA_IMMED_GP_16
+#endif
+
/*======================================================================*/
struct alpha_got_entry
@@ -100,6 +104,7 @@ arch_apply_relocation (struct obj_file *f,
unsigned long *lloc = (unsigned long *)(targsec->contents + rel->r_offset);
unsigned int *iloc = (unsigned int *)lloc;
+ unsigned short *sloc = (unsigned short *)lloc;
Elf64_Addr dot = targsec->header.sh_addr + rel->r_offset;
Elf64_Addr gp = af->got->header.sh_addr + 0x8000;
@@ -115,6 +120,30 @@ arch_apply_relocation (struct obj_file *f,
*lloc += v;
break;
+ case R_ALPHA_GPREL16:
+ v -= gp;
+ if ((Elf64_Sxword)v > 0x7fff
+ || (Elf64_Sxword)v < -(Elf64_Sxword)0x8000)
+ ret = obj_reloc_overflow;
+ *sloc = v;
+ break;
+
+ case R_ALPHA_GPRELLOW:
+ /* GPRELLOW does not overflow. Errors are seen in the
+ corresponding GPRELHIGH. */
+ v -= gp;
+ *sloc = v;
+ break;
+
+ case R_ALPHA_GPRELHIGH:
+ v -= gp;
+ v = ((Elf64_Sxword)v >> 16) + ((v >> 15) & 1);
+ if ((Elf64_Sxword)v > 0x7fff
+ || (Elf64_Sxword)v < -(Elf64_Sxword)0x8000)
+ ret = obj_reloc_overflow;
+ *sloc = v;
+ break;
+
case R_ALPHA_GPREL32:
v -= gp;
if ((Elf64_Sxword)v > 0x7fffffff
@@ -138,7 +167,7 @@ arch_apply_relocation (struct obj_file *f,
gotent->reloc_done = 1;
}
- *iloc = (*iloc & ~0xffff) | ((gotent->offset - 0x8000) & 0xffff);
+ *sloc = gotent->offset - 0x8000;
}
break;
@@ -233,19 +262,12 @@ arch_create_got (struct obj_file *f)
for (; rel < relend; ++rel)
{
struct alpha_got_entry *ent;
- Elf64_Sym *extsym;
struct alpha_symbol *intsym;
- const char *name;
if (ELF64_R_TYPE(rel->r_info) != R_ALPHA_LITERAL)
continue;
- extsym = &symtab[ELF64_R_SYM(rel->r_info)];
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = (struct alpha_symbol *)obj_find_symbol(&af->root, name);
+ obj_find_relsym(intsym, f, &af->root, rel, symtab, strtab);
for (ent = intsym->got_entries; ent ; ent = ent->next)
if (ent->addend == rel->r_addend)
@@ -270,9 +292,10 @@ arch_create_got (struct obj_file *f)
}
/* We always want a .got section so that we always have a GP for
- use with GPDISP and GPREL32 relocs. Besides, if the section
+ use with GPDISP and GPREL relocs. Besides, if the section
is empty we don't use up space anyway. */
- af->got = obj_create_alloced_section(&af->root, ".got", 8, offset);
+ af->got = obj_create_alloced_section(&af->root, ".got", 8, offset,
+ SHF_WRITE | SHF_ALPHA_GPREL);
return 1;
}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_arm.c b/mdk-stage1/insmod-modutils/obj/obj_arm.c
index 7a843f947..78b53700c 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_arm.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_arm.c
@@ -21,8 +21,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <string.h>
#include <assert.h>
@@ -201,7 +199,7 @@ arch_create_got (struct obj_file *f)
struct obj_section *sec, *syms, *strs;
ElfW(Rel) *rel, *relend;
ElfW(Sym) *symtab, *extsym;
- const char *strtab, *name;
+ const char *strtab;
struct arm_symbol *intsym;
struct arm_plt_entry *pe;
struct arm_got_entry *ge;
@@ -227,11 +225,7 @@ arch_create_got (struct obj_file *f)
switch(ELF32_R_TYPE(rel->r_info)) {
case R_ARM_PC24:
case R_ARM_PLT32:
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = (struct arm_symbol *) obj_find_symbol(f, name);
+ obj_find_relsym(intsym, f, f, rel, symtab, strtab);
pe = &intsym->pltent;
@@ -252,11 +246,7 @@ arch_create_got (struct obj_file *f)
break;
case R_ARM_GOT32:
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = (struct arm_symbol *) obj_find_symbol(f, name);
+ obj_find_relsym(intsym, f, f, rel, symtab, strtab);
ge = (struct arm_got_entry *) &intsym->gotent;
if (! ge->allocated)
@@ -282,14 +272,16 @@ arch_create_got (struct obj_file *f)
obj_extend_section(sec, got_offset);
else
{
- sec = obj_create_alloced_section(f, ".got", 8, got_offset);
+ sec = obj_create_alloced_section(f, ".got", 8, got_offset,
+ SHF_WRITE);
assert(sec);
}
afile->got = sec;
}
if (plt_offset)
- afile->plt = obj_create_alloced_section(f, ".plt", 8, plt_offset);
+ afile->plt = obj_create_alloced_section(f, ".plt", 8, plt_offset,
+ SHF_WRITE);
return 1;
}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_common.c b/mdk-stage1/insmod-modutils/obj/obj_common.c
index 2a6606c94..a957ff1be 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_common.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_common.c
@@ -19,11 +19,10 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#include <alloca.h>
#include <obj.h>
#include <util.h>
@@ -229,6 +228,14 @@ obj_find_section (struct obj_file *f, const char *name)
return NULL;
}
+#if defined (ARCH_alpha)
+#define ARCH_SHF_SHORT SHF_ALPHA_GPREL
+#elif defined (ARCH_ia64)
+#define ARCH_SHF_SHORT SHF_IA_64_SHORT
+#else
+#define ARCH_SHF_SHORT 0
+#endif
+
static int
obj_load_order_prio(struct obj_section *a)
{
@@ -237,15 +244,24 @@ obj_load_order_prio(struct obj_section *a)
af = a->header.sh_flags;
ac = 0;
- if (a->name[0] != '.' || strlen(a->name) != 10 ||
- strcmp(a->name + 5, ".init")) ac |= 32;
- if (af & SHF_ALLOC) ac |= 16;
+ if (a->name[0] != '.'
+ || strlen(a->name) != 10
+ || strcmp(a->name + 5, ".init"))
+ ac |= 64;
+ if (af & SHF_ALLOC) ac |= 32;
+ if (af & SHF_EXECINSTR) ac |= 16;
if (!(af & SHF_WRITE)) ac |= 8;
- if (af & SHF_EXECINSTR) ac |= 4;
- if (a->header.sh_type != SHT_NOBITS) ac |= 2;
-#if defined(ARCH_ia64)
- if (af & SHF_IA_64_SHORT) ac -= 1;
-#endif
+ if (a->header.sh_type != SHT_NOBITS) ac |= 4;
+ /* Desired order is
+ P S AC & 7
+ .data 1 0 4
+ .got 1 1 3
+ .sdata 1 1 1
+ .sbss 0 1 1
+ .bss 0 0 0 */
+ if (strcmp (a->name, ".got") == 0) ac |= 2;
+ if (af & ARCH_SHF_SHORT)
+ ac = (ac & ~4) | 1;
return ac;
}
@@ -264,7 +280,8 @@ obj_insert_section_load_order (struct obj_file *f, struct obj_section *sec)
struct obj_section *
obj_create_alloced_section (struct obj_file *f, const char *name,
- unsigned long align, unsigned long size)
+ unsigned long align, unsigned long size,
+ unsigned long flags)
{
int newidx = f->header.e_shnum++;
struct obj_section *sec;
@@ -274,7 +291,7 @@ obj_create_alloced_section (struct obj_file *f, const char *name,
memset(sec, 0, sizeof(*sec));
sec->header.sh_type = SHT_PROGBITS;
- sec->header.sh_flags = SHF_WRITE|SHF_ALLOC;
+ sec->header.sh_flags = flags | SHF_ALLOC;
sec->header.sh_size = size;
sec->header.sh_addralign = align;
sec->name = name;
diff --git a/mdk-stage1/insmod-modutils/obj/obj_gpl_license.c b/mdk-stage1/insmod-modutils/obj/obj_gpl_license.c
new file mode 100644
index 000000000..366b03e06
--- /dev/null
+++ b/mdk-stage1/insmod-modutils/obj/obj_gpl_license.c
@@ -0,0 +1,61 @@
+/* Return the type of license for a module. 0 for GPL, 1 for no license, 2 for
+ non-GPL. The license parameter is set to the license string or NULL.
+
+ This file is part of the Linux modutils.
+
+ 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.
+ */
+
+#include <string.h>
+#include "obj.h"
+
+/* This list must match *exactly* the list of allowable licenses in
+ * linux/include/linux/module.h. Checking for leading "GPL" will not
+ * work, somebody will use "GPL sucks, this is proprietary".
+ */
+static const char *gpl_licenses[] = {
+ "GPL",
+ "GPL v2",
+ "GPL and additional rights",
+ "Dual BSD/GPL",
+ "Dual MPL/GPL",
+};
+
+int obj_gpl_license(struct obj_file *f, const char **license)
+{
+ struct obj_section *sec;
+ if ((sec = obj_find_section(f, ".modinfo"))) {
+ const char *value, *ptr, *endptr;
+ ptr = sec->contents;
+ endptr = ptr + sec->header.sh_size;
+ while (ptr < endptr) {
+ if ((value = strchr(ptr, '=')) && strncmp(ptr, "license", value-ptr) == 0) {
+ int i;
+ if (license)
+ *license = value+1;
+ for (i = 0; i < sizeof(gpl_licenses)/sizeof(gpl_licenses[0]); ++i) {
+ if (strcmp(value+1, gpl_licenses[i]) == 0)
+ return(0);
+ }
+ return(2);
+ }
+ if (strchr(ptr, '\0'))
+ ptr = strchr(ptr, '\0') + 1;
+ else
+ ptr = endptr;
+ }
+ }
+ return(1);
+}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_hppa.c b/mdk-stage1/insmod-modutils/obj/obj_hppa.c
index 4207e692e..a6f703c5d 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_hppa.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_hppa.c
@@ -64,36 +64,6 @@ enum hppa_fsel
e_rrsel
};
-/* This could be a call to obj_create_alloced_section() followed
- * by an overwrite of sec->header.sh_flags.
- */
-
-struct obj_section *
-obj_hppa_create_alloced_section (struct obj_file *f, const char *name,
- unsigned long align, unsigned long size,
- unsigned long sh_flags)
-{
- int newidx = f->header.e_shnum++;
- struct obj_section *sec;
-
- f->sections = xrealloc(f->sections, (newidx+1) * sizeof(sec));
- f->sections[newidx] = sec = arch_new_section();
-
- memset(sec, 0, sizeof(*sec));
- sec->header.sh_type = SHT_PROGBITS;
- sec->header.sh_flags = sh_flags;
- sec->header.sh_size = size;
- sec->header.sh_addralign = align;
- sec->name = name;
- sec->idx = newidx;
- if (size)
- sec->contents = xmalloc(size);
-
- obj_insert_section_load_order(f, sec);
-
- return sec;
-}
-
struct obj_file *
arch_new_file (void)
{
@@ -383,14 +353,14 @@ hppa_rebuild_insn (insn, value, r_format)
This is significantly less complex than what we do for shared
libraries because, obviously, modules are not shared. Also we have
no issues related to symbol visibility, lazy linking, etc.
- The kernels dp is fixed (at symbol data_start), and we can fix up any
+ The kernels dp is fixed (at symbol $global$), and we can fix up any
DPREL refs in the module to use that same dp value.
- All PCREL17F refs result in a stub with the following format:
+ All PCREL* refs result in a stub with the following format:
ldil L'func_addr,%r1
be,n R'func_addr(%sr4,%r1)
- Note, all PCREL17F get a stub, regardless of whether they are
+ Note, all PCREL* get a stub, regardless of whether they are
local or external. With local ones, and external ones to other
modules, there is a good chance we could manage without the stub.
I'll leave that for a future optimisation.
@@ -411,7 +381,8 @@ arch_create_got(struct obj_file *f)
/* Create stub section.
* XXX set flags, see obj_ia64.c
*/
- hfile->stub = obj_create_alloced_section(f, ".stub", STUB_SIZE, 0);
+ hfile->stub = obj_create_alloced_section(f, ".stub", STUB_SIZE,
+ 0, SHF_WRITE);
/* Actually this is a lot like check_relocs() in a BFD backend. We
walk all sections and all their relocations and look for ones
@@ -446,30 +417,17 @@ arch_create_got(struct obj_file *f)
continue;
case R_PARISC_PCREL17F:
+ case R_PARISC_PCREL22F:
need_stub = 1;
break;
}
if (need_stub)
{
- Elf32_Sym *extsym;
hppa_symbol_t *hsym;
- char const *name;
int local;
- unsigned long symndx;
- symndx = ELF32_R_SYM(rel->r_info);
- extsym = symtab + symndx;
- if (ELF32_ST_BIND(extsym->st_info) == STB_LOCAL)
- hsym = (hppa_symbol_t *) f->local_symtab[symndx];
- else
- {
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- hsym = (hppa_symbol_t *)obj_find_symbol(f, name);
- }
+ obj_find_relsym(hsym, f, f, rel, symtab, strtab);
local = hsym->root.secidx <= SHN_HIRESERVE;
if (need_stub)
@@ -529,12 +487,17 @@ arch_apply_relocation(struct obj_file *f,
/* Easy. */
break;
+ case R_PARISC_SEGREL32:
+ v -= f->baseaddr;
+ break;
+
case R_PARISC_DPREL21L:
case R_PARISC_DPREL14R:
v -= dp;
break;
case R_PARISC_PCREL17F:
+ case R_PARISC_PCREL22F:
/* Find an import stub. */
assert(hsym->stub != NULL);
assert(hfile->stub != NULL);
@@ -566,6 +529,8 @@ arch_apply_relocation(struct obj_file *f,
case R_PARISC_DIR32:
case R_PARISC_PLABEL32:
case R_PARISC_PCREL17F:
+ case R_PARISC_SEGREL32:
+ case R_PARISC_PCREL22F:
fsel = e_fsel;
break;
@@ -602,6 +567,7 @@ arch_apply_relocation(struct obj_file *f,
{
case R_PARISC_DIR32:
case R_PARISC_PLABEL32:
+ case R_PARISC_SEGREL32:
r_format = 32;
break;
@@ -619,6 +585,10 @@ arch_apply_relocation(struct obj_file *f,
r_format = 14;
break;
+ case R_PARISC_PCREL22F:
+ r_format = 22;
+ break;
+
default:
abort();
}
@@ -652,13 +622,13 @@ arch_archdata (struct obj_file *f, struct obj_section *sec)
int i;
hppa_file_t *hfile = (hppa_file_t *)f;
- /* Initialise dp to the kernels dp (symbol data_start)
+ /* Initialise dp to the kernels dp (symbol $global$)
*/
for (i = 0, s = ksyms; i < nksyms; i++, s++)
- if (!strcmp((char *)s->name, "data_start"))
+ if (!strcmp((char *)s->name, "$global$"))
break;
if (i >= nksyms) {
- error("Cannot initialise dp, 'data_start' not found\n");
+ error("Cannot initialise dp, '$global$' not found\n");
return 1;
}
hfile->dp = s->value;
diff --git a/mdk-stage1/insmod-modutils/obj/obj_hppa64.c b/mdk-stage1/insmod-modutils/obj/obj_hppa64.c
index fe32911ff..d9f1ada9d 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_hppa64.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_hppa64.c
@@ -22,8 +22,6 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ident "$Id$"
-
#include <string.h>
#include <assert.h>
#include <stdlib.h>
@@ -94,15 +92,15 @@ typedef struct _hppa64_file_t
* e8 20 d0 00 bve (r1)
* 53 7b 00 30 ldd 18(dp),dp
*
- * We need a different stub for millicode calls, which doesn't screw
- * dp:
+ * We need a different stub for millicode calls, which doesn't depend on
+ * or modify dp:
*
- * 53 61 00 00 ldd 0(dp),r1
- * R_PARISC_LTOFF14R <.got entry offset from dp>
+ * 20 20 00 00 ldil 0,r1
+ * R_PARISC_DIR21L <addr of kernels opd entry>
+ * 34 21 00 00 ldo 0(r1),r1
+ * R_PARISC_DIR14R <addr of kernels opd entry>
* 50 21 00 20 ldd 10(r1),r1
- * e8 20 d0 00 bve (r1)
- * 08 00 02 40 nop
- *
+ * e8 20 d0 02 bve,n (r1)
*/
/* NOTE: to keep the code cleaner we make all stubs the same size.
@@ -120,10 +118,10 @@ unsigned char hppa64_stub_extern[] =
unsigned char hppa64_stub_millicode[] =
{
- 0x53, 0x61, 0x00, 0x00,
+ 0x20, 0x20, 0x00, 0x00,
+ 0x34, 0x21, 0x00, 0x00,
0x50, 0x21, 0x00, 0x20,
- 0xe8, 0x20, 0xd0, 0x00,
- 0x08, 0x00, 0x02, 0x40,
+ 0xe8, 0x20, 0xd0, 0x02,
};
/*======================================================================*/
@@ -361,6 +359,7 @@ arch_create_got(struct obj_file *f)
need_stub = TRUE;
break;
case R_PARISC_DIR64:
+ case R_PARISC_SEGREL32:
break;
case R_PARISC_FPTR64:
/* This is a simple OPD entry (only created for local symbols,
@@ -372,26 +371,10 @@ arch_create_got(struct obj_file *f)
if (need_got || need_opd || need_stub)
{
- Elf64_Sym *extsym;
hppa64_symbol_t *isym;
- const char *name;
int local;
- unsigned long symndx;
- symndx = ELF64_R_SYM(rel->r_info);
- extsym = &symtab[symndx];
- if (ELF64_ST_BIND(extsym->st_info) == STB_LOCAL)
- {
- isym = (hppa64_symbol_t *) f->local_symtab[symndx];
- }
- else
- {
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- isym = (hppa64_symbol_t *)obj_find_symbol(f, name);
- }
+ obj_find_relsym(isym, f, f, rel, symtab, strtab);
local = isym->root.secidx <= SHN_HIRESERVE;
if (need_stub)
@@ -574,16 +557,24 @@ arch_apply_relocation(struct obj_file *f,
*/
unsigned char *stub;
- if (!strncmp(isym->root.name, "$$", 2))
+ if (!strncmp(isym->root.name, "$$", 2)) {
stub = hppa64_stub_millicode;
- else
+ memcpy((Elf64_Addr *)(hfile->stub->contents + se->offset),
+ stub, SIZEOF_STUB);
+ v = (Elf64_Addr)isym->root.value;
+ ret = patch_21l(v, (Elf64_Word *)(hfile->stub->contents + se->offset));
+ if (ret == obj_reloc_ok)
+ ret = patch_14r(v, (Elf64_Word *)(hfile->stub->contents + se->offset + 4));
+ }
+ else {
stub = hppa64_stub_extern;
- se->reloc_done = TRUE;
memcpy((Elf64_Addr *)(hfile->stub->contents + se->offset),
stub, SIZEOF_STUB);
v = (Elf64_Addr)(hfile->got->header.sh_addr + ge->offset) - gp;
ret = patch_14r2(v, (Elf64_Word *)(hfile->stub->contents + se->offset));
}
+ se->reloc_done = TRUE;
+ }
v = hfile->stub->header.sh_addr + se->offset;
}
v = v - dot - 8;
@@ -597,6 +588,11 @@ arch_apply_relocation(struct obj_file *f,
loc[1] = v;
}
break;
+ case R_PARISC_SEGREL32:
+ {
+ loc[0] = v - f->baseaddr;
+ }
+ break;
case R_PARISC_FPTR64:
{
assert(isym != NULL);
diff --git a/mdk-stage1/insmod-modutils/obj/obj_i386.c b/mdk-stage1/insmod-modutils/obj/obj_i386.c
index 28df3448c..fcbce8e04 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_i386.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_i386.c
@@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <string.h>
#include <assert.h>
@@ -183,9 +181,7 @@ arch_create_got (struct obj_file *f)
for (; rel < relend; ++rel)
{
- Elf32_Sym *extsym;
struct i386_symbol *intsym;
- const char *name;
switch (ELF32_R_TYPE(rel->r_info))
{
@@ -199,12 +195,7 @@ arch_create_got (struct obj_file *f)
break;
}
- extsym = &symtab[ELF32_R_SYM(rel->r_info)];
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = (struct i386_symbol *)obj_find_symbol(&ifile->root, name);
+ obj_find_relsym(intsym, f, &ifile->root, rel, symtab, strtab);
if (!intsym->gotent.offset_done)
{
@@ -216,7 +207,8 @@ arch_create_got (struct obj_file *f)
}
if (offset > 0 || gotneeded)
- ifile->got = obj_create_alloced_section(&ifile->root, ".got", 4, offset);
+ ifile->got = obj_create_alloced_section(&ifile->root, ".got", 4, offset,
+ SHF_WRITE);
return 1;
}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_ia64.c b/mdk-stage1/insmod-modutils/obj/obj_ia64.c
index 4f92c5d27..d207a9042 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_ia64.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_ia64.c
@@ -19,8 +19,6 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ident "$Id$"
-
#include <string.h>
#include <assert.h>
#include <stdlib.h>
@@ -255,14 +253,15 @@ obj_ia64_ins_imm64(Elf64_Xword v, Elf64_Addr *bundle, Elf64_Xword slot)
{
Elf64_Xword ins;
- assert(slot == 1);
+ assert(slot == 2);
+
ins = obj_ia64_ins_extract_from_bundle(bundle, slot);
- ins &= 0xffffffee000101ff;
- ins |= ((v & 0x8000000000000000) >> 28) | ((v & 0x0000000000200000)) |
+ ins &= 0xffffffe000101fff;
+ ins |= ((v & 0x8000000000000000) >> 27) | ((v & 0x0000000000200000)) |
((v & 0x00000000001f0000) << 6) | ((v & 0x000000000000ff80) << 20) |
((v & 0x000000000000007f) << 13);
obj_ia64_ins_insert_in_bundle(bundle, slot, ins);
- obj_ia64_ins_insert_in_bundle(bundle, ++slot, ((v & 0x7fffffffffc00000) >> 22));
+ obj_ia64_ins_insert_in_bundle(bundle, --slot, ((v & 0x7fffffffffc00000) >> 22));
return obj_reloc_ok;
}
@@ -295,30 +294,6 @@ obj_ia64_generate_plt(Elf64_Addr v,
(Elf64_Addr *)(ifile->pltt->contents + pltent->text_offset), 0);
}
-struct obj_section *
-obj_ia64_create_alloced_section (struct obj_file *f, const char *name,
- unsigned long align, unsigned long size, unsigned long sh_flags)
-{
- int newidx = f->header.e_shnum++;
- struct obj_section *sec;
-
- f->sections = xrealloc(f->sections, (newidx+1) * sizeof(sec));
- f->sections[newidx] = sec = arch_new_section();
-
- memset(sec, 0, sizeof(*sec));
- sec->header.sh_type = SHT_PROGBITS;
- sec->header.sh_flags = sh_flags;
- sec->header.sh_size = size;
- sec->header.sh_addralign = align;
- sec->name = name;
- sec->idx = newidx;
- if (size)
- sec->contents = xmalloc(size);
-
- obj_insert_section_load_order(f, sec);
-
- return sec;
-}
/*======================================================================*/
@@ -457,26 +432,10 @@ arch_create_got(struct obj_file *f)
if (need_got || need_opd || need_plt)
{
- Elf64_Sym *extsym;
ia64_symbol_t *isym;
- const char *name;
int local;
- unsigned long symndx;
- symndx = ELF64_R_SYM(rel->r_info);
- extsym = &symtab[symndx];
- if (ELF64_ST_BIND(extsym->st_info) == STB_LOCAL)
- {
- isym = (ia64_symbol_t *) f->local_symtab[symndx];
- }
- else
- {
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- isym = (ia64_symbol_t *)obj_find_symbol(f, name);
- }
+ obj_find_relsym(isym, f, f, rel, symtab, strtab);
local = isym->root.secidx <= SHN_HIRESERVE;
if (need_plt)
@@ -545,20 +504,22 @@ arch_create_got(struct obj_file *f)
}
}
- ifile->got = obj_ia64_create_alloced_section(f, ".got", 8, got_offset,
- (SHF_ALLOC | SHF_WRITE | SHF_IA_64_SHORT));
+ ifile->got = obj_create_alloced_section(f, ".got", 8, got_offset,
+ SHF_WRITE | SHF_IA_64_SHORT);
assert(ifile->got != NULL);
- ifile->opd = obj_ia64_create_alloced_section(f, ".opd", 16, opd_offset,
- (SHF_ALLOC | SHF_WRITE | SHF_IA_64_SHORT));
+ ifile->opd = obj_create_alloced_section(f, ".opd", 16, opd_offset,
+ SHF_WRITE | SHF_IA_64_SHORT);
assert(ifile->opd != NULL);
if (plt_text_offset > 0)
{
- ifile->pltt = obj_ia64_create_alloced_section(f, ".plt", 16,
- plt_text_offset, (SHF_ALLOC | SHF_EXECINSTR | SHF_IA_64_SHORT));
- ifile->pltd = obj_ia64_create_alloced_section(f, ".IA_64.pltoff",
- 16, plt_data_offset, (SHF_ALLOC | SHF_WRITE | SHF_IA_64_SHORT));
+ ifile->pltt = obj_create_alloced_section(f, ".plt", 16,
+ plt_text_offset,
+ SHF_WRITE | SHF_IA_64_SHORT);
+ ifile->pltd = obj_create_alloced_section(f, ".IA_64.pltoff", 16,
+ plt_data_offset,
+ SHF_WRITE | SHF_IA_64_SHORT);
assert(ifile->pltt != NULL);
assert(ifile->pltd != NULL);
}
@@ -950,12 +911,8 @@ arch_apply_relocation(struct obj_file *f,
case R_IA64_SEGREL32LSB : /* @segrel(sym + add), data4 LSB */
case R_IA64_SEGREL64LSB : /* @segrel(sym + add), data8 LSB */
- if (targsec->header.sh_type & SHT_NOBITS)
- v = ifile->bss - v;
- else if (targsec->header.sh_flags & SHF_EXECINSTR)
- v = ifile->text - v;
- else
- v = ifile->data - v;
+ /* Only one segment for modules, see segment_base in arch_archdata */
+ v -= f->sections[1]->header.sh_addr;
if (r_info == R_IA64_SEGREL32LSB)
COPY_32LSB(loc, v);
else
diff --git a/mdk-stage1/insmod-modutils/obj/obj_kallsyms.c b/mdk-stage1/insmod-modutils/obj/obj_kallsyms.c
index 8385fb892..1836141e9 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_kallsyms.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_kallsyms.c
@@ -17,8 +17,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
@@ -37,7 +35,7 @@ static void
append_string (const char *s, char **strings,
ElfW(Word) *strings_size, ElfW(Word) *strings_left)
{
- int l = strlen(s) + 1;
+ size_t l = strlen(s) + 1;
while (l > *strings_left) {
*strings = xrealloc(*strings, *strings_size += EXPAND_BY);
*strings_left += EXPAND_BY;
@@ -54,7 +52,7 @@ append_symbol (const struct kallsyms_symbol *s,
struct kallsyms_symbol **symbols,
ElfW(Word) *symbols_size, ElfW(Word) *symbols_left)
{
- int l = sizeof(*s);
+ size_t l = sizeof(*s);
while (l > *symbols_left) {
*symbols = xrealloc(*symbols, *symbols_size += EXPAND_BY);
*symbols_left += EXPAND_BY;
diff --git a/mdk-stage1/insmod-modutils/obj/obj_load.c b/mdk-stage1/insmod-modutils/obj/obj_load.c
index 4db20a998..62977acb7 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_load.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_load.c
@@ -21,8 +21,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <alloca.h>
#include <string.h>
#include <stdlib.h>
@@ -52,7 +50,7 @@ obj_load (int fp, Elf32_Half e_type, const char *filename)
gzf_lseek(fp, 0, SEEK_SET);
if (gzf_read(fp, &f->header, sizeof(f->header)) != sizeof(f->header))
{
- error("error reading ELF header %s: %m", filename);
+ error("cannot read ELF header from %s", filename);
return NULL;
}
@@ -257,7 +255,7 @@ obj_load (int fp, Elf32_Half e_type, const char *filename)
{
case SHT_RELM:
{
- unsigned long nrel, j;
+ unsigned long nrel, j, nsyms;
ElfW(RelM) *rel;
struct obj_section *symtab;
char *strtab;
@@ -273,34 +271,25 @@ obj_load (int fp, Elf32_Half e_type, const char *filename)
nrel = sec->header.sh_size / sizeof(ElfW(RelM));
rel = (ElfW(RelM) *) sec->contents;
symtab = f->sections[sec->header.sh_link];
+ nsyms = symtab->header.sh_size / symtab->header.sh_entsize;
strtab = f->sections[symtab->header.sh_link]->contents;
/* Save the relocate type in each symbol entry. */
for (j = 0; j < nrel; ++j, ++rel)
{
- ElfW(Sym) *extsym;
struct obj_symbol *intsym;
unsigned long symndx;
symndx = ELFW(R_SYM)(rel->r_info);
if (symndx)
{
- extsym = ((ElfW(Sym) *) symtab->contents) + symndx;
- if (ELFW(ST_BIND)(extsym->st_info) == STB_LOCAL)
- {
- /* Local symbols we look up in the local table to be sure
- we get the one that is really intended. */
- intsym = f->local_symtab[symndx];
- }
- else
+ if (symndx >= nsyms)
{
- /* Others we look up in the hash table. */
- const char *name;
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = obj_find_symbol(f, name);
+ error("%s: Bad symbol index: %08lx >= %08lx",
+ filename, symndx, nsyms);
+ continue;
}
+
+ obj_find_relsym(intsym, f, f, rel, (ElfW(Sym) *)(symtab->contents), strtab);
intsym->r_type = ELFW(R_TYPE)(rel->r_info);
}
}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_m68k.c b/mdk-stage1/insmod-modutils/obj/obj_m68k.c
index cb485aed7..abc070bca 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_m68k.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_m68k.c
@@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stddef.h>
#include <module.h>
#include <obj.h>
diff --git a/mdk-stage1/insmod-modutils/obj/obj_mips.c b/mdk-stage1/insmod-modutils/obj/obj_mips.c
index c2315b659..2db0791b6 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_mips.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_mips.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <string.h>
#include <stdlib.h>
#include <assert.h>
@@ -232,7 +230,25 @@ arch_finalize_section_address(struct obj_file *f, Elf32_Addr base)
}
int
-arch_archdata (struct obj_file *fin, struct obj_section *sec)
+arch_archdata (struct obj_file *f, struct obj_section *archdata_sec)
{
+ struct archdata {
+ unsigned tgt_long __start___dbe_table;
+ unsigned tgt_long __stop___dbe_table;
+ } *ad;
+ struct obj_section *sec;
+
+ if (archdata_sec->contents)
+ free(archdata_sec->contents);
+ archdata_sec->header.sh_size = 0;
+ sec = obj_find_section(f, "__dbe_table");
+ if (sec) {
+ ad = (struct archdata *) (archdata_sec->contents) = xmalloc(sizeof(*ad));
+ memset(ad, 0, sizeof(*ad));
+ archdata_sec->header.sh_size = sizeof(*ad);
+ ad->__start___dbe_table = sec->header.sh_addr;
+ ad->__stop___dbe_table = sec->header.sh_addr + sec->header.sh_size;
+ }
+
return 0;
}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_ppc.c b/mdk-stage1/insmod-modutils/obj/obj_ppc.c
index 89bb8e46b..4889454f2 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_ppc.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_ppc.c
@@ -20,8 +20,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stddef.h>
#include <module.h>
#include <obj.h>
@@ -180,8 +178,8 @@ arch_create_got (struct obj_file *f)
int i, offset;
struct obj_section *sec, *syms, *strs;
ElfW(Rela) *rel, *relend;
- ElfW(Sym) *symtab, *extsym;
- const char *strtab, *name;
+ ElfW(Sym) *symtab;
+ const char *strtab;
struct ppc_symbol *intsym;
struct ppc_plt_entry *pe;
@@ -203,12 +201,7 @@ arch_create_got (struct obj_file *f)
{
if (ELF32_R_TYPE(rel->r_info) != R_PPC_REL24)
continue;
- extsym = &symtab[ELF32_R_SYM(rel->r_info)];
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = (struct ppc_symbol *) obj_find_symbol(f, name);
+ obj_find_relsym(intsym, f, f, rel, symtab, strtab);
for (pe = intsym->plt_entries; pe != NULL; pe = pe->next)
if (pe->addend == rel->r_addend)
@@ -226,7 +219,7 @@ arch_create_got (struct obj_file *f)
}
}
- pf->plt = obj_create_alloced_section(f, ".plt", 16, offset);
+ pf->plt = obj_create_alloced_section(f, ".plt", 16, offset, SHF_WRITE);
return 1;
}
@@ -249,7 +242,25 @@ arch_finalize_section_address(struct obj_file *f, Elf32_Addr base)
}
int
-arch_archdata (struct obj_file *fin, struct obj_section *sec)
+arch_archdata (struct obj_file *f, struct obj_section *archdata_sec)
{
+ struct archdata {
+ unsigned tgt_long __start___ftr_fixup;
+ unsigned tgt_long __stop___ftr_fixup;
+ } *ad;
+ struct obj_section *sec;
+
+ if (archdata_sec->contents)
+ free(archdata_sec->contents);
+ archdata_sec->header.sh_size = 0;
+ sec = obj_find_section(f, "__ftr_fixup");
+ if (sec) {
+ ad = (struct archdata *) (archdata_sec->contents) = xmalloc(sizeof(*ad));
+ memset(ad, 0, sizeof(*ad));
+ archdata_sec->header.sh_size = sizeof(*ad);
+ ad->__start___ftr_fixup = sec->header.sh_addr;
+ ad->__stop___ftr_fixup = sec->header.sh_addr + sec->header.sh_size;
+ }
+
return 0;
}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_reloc.c b/mdk-stage1/insmod-modutils/obj/obj_reloc.c
index f5f2de90d..3f2c8aab0 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_reloc.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_reloc.c
@@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <string.h>
#include <assert.h>
#include <alloca.h>
@@ -48,7 +46,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
strsec = obj_find_section(f, ".kstrtab");
if (strsec == NULL)
{
- strsec = obj_create_alloced_section(f, ".kstrtab", 1, len);
+ strsec = obj_create_alloced_section(f, ".kstrtab", 1, len, 0);
p->string_offset = 0;
loc = strsec->contents;
}
@@ -284,6 +282,7 @@ obj_relocate (struct obj_file *f, ElfW(Addr) base)
ElfW(RelM) *rel, *relend;
ElfW(Sym) *symtab;
const char *strtab;
+ unsigned long nsyms;
relsec = f->sections[i];
if (relsec->header.sh_type != SHT_RELM)
@@ -293,9 +292,13 @@ obj_relocate (struct obj_file *f, ElfW(Addr) base)
targsec = f->sections[relsec->header.sh_info];
strsec = f->sections[symsec->header.sh_link];
+ if (!(targsec->header.sh_flags & SHF_ALLOC))
+ continue;
+
rel = (ElfW(RelM) *)relsec->contents;
relend = rel + (relsec->header.sh_size / sizeof(ElfW(RelM)));
symtab = (ElfW(Sym) *)symsec->contents;
+ nsyms = symsec->header.sh_size / symsec->header.sh_entsize;
strtab = (const char *)strsec->contents;
for (; rel < relend; ++rel)
@@ -303,7 +306,6 @@ obj_relocate (struct obj_file *f, ElfW(Addr) base)
ElfW(Addr) value = 0;
struct obj_symbol *intsym = NULL;
unsigned long symndx;
- ElfW(Sym) *extsym = 0;
const char *errmsg;
/* Attempt to find a value to use for this relocation. */
@@ -313,33 +315,18 @@ obj_relocate (struct obj_file *f, ElfW(Addr) base)
{
/* Note we've already checked for undefined symbols. */
- extsym = &symtab[symndx];
- if (ELFW(ST_BIND)(extsym->st_info) == STB_LOCAL)
- {
- /* Local symbols we look up in the local table to be sure
- we get the one that is really intended. */
- intsym = f->local_symtab[symndx];
- }
- else
+ if (symndx >= nsyms)
{
- /* Others we look up in the hash table. */
- const char *name;
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = obj_find_symbol(f, name);
+ error("Bad symbol index: %08lx >= %08lx",
+ symndx, nsyms);
+ continue;
}
+ obj_find_relsym(intsym, f, f, rel, symtab, strtab);
value = obj_symbol_final_value(f, intsym);
}
#if SHT_RELM == SHT_RELA
-#if defined(__alpha__) && defined(AXP_BROKEN_GAS)
- /* Work around a nasty GAS bug, that is fixed as of 2.7.0.9. */
- if (!extsym || !extsym->st_name ||
- ELFW(ST_BIND)(extsym->st_info) != STB_LOCAL)
-#endif
value += rel->r_addend;
#endif
@@ -362,17 +349,8 @@ obj_relocate (struct obj_file *f, ElfW(Addr) base)
errmsg = "Modules compiled with -mconstant-gp cannot be loaded";
goto bad_reloc;
bad_reloc:
- if (extsym)
- {
error("%s of type %ld for %s", errmsg,
- (long)ELFW(R_TYPE)(rel->r_info),
- strtab + extsym->st_name);
- }
- else
- {
- error("%s of type %ld", errmsg,
- (long)ELFW(R_TYPE)(rel->r_info));
- }
+ (long)ELFW(R_TYPE)(rel->r_info), intsym->name);
ret = 0;
break;
}
diff --git a/mdk-stage1/insmod-modutils/obj/obj_s390.c b/mdk-stage1/insmod-modutils/obj/obj_s390.c
index 3da72e771..a76e28479 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_s390.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_s390.c
@@ -1,6 +1,10 @@
-/* S/390 specific support for Elf loading and relocation.
- Copyright 1996, 1997 Linux International.
+/* IBM S/390 31-bit specific support for Elf loading and relocation.
+ Copyright 2000, 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation.
+ Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ Derived from obj/obj_i386.c:
+ Copyright 1996, 1997 Linux International.
Contributed by Richard Henderson <rth@tamu.edu>
This file is part of the Linux modutils.
@@ -19,8 +23,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <string.h>
#include <assert.h>
@@ -31,22 +33,31 @@
/*======================================================================*/
+struct s390_plt_entry
+{
+ long offset;
+ int allocated:1;
+ int initialized:1;
+};
+
struct s390_got_entry
{
- int offset;
- unsigned offset_done : 1;
+ long offset;
+ unsigned allocated:1;
unsigned reloc_done : 1;
};
struct s390_file
{
struct obj_file root;
+ struct obj_section *plt;
struct obj_section *got;
};
struct s390_symbol
{
struct obj_symbol root;
+ struct s390_plt_entry pltent;
struct s390_got_entry gotent;
};
@@ -59,6 +70,7 @@ arch_new_file (void)
struct s390_file *f;
f = xmalloc(sizeof(*f));
f->got = NULL;
+ f->plt = NULL;
return &f->root;
}
@@ -74,6 +86,7 @@ arch_new_symbol (void)
struct s390_symbol *sym;
sym = xmalloc(sizeof(*sym));
memset(&sym->gotent, 0, sizeof(sym->gotent));
+ memset(&sym->pltent, 0, sizeof(sym->pltent));
return &sym->root;
}
@@ -95,12 +108,14 @@ arch_apply_relocation (struct obj_file *f,
Elf32_Rela *rel,
Elf32_Addr v)
{
- struct s390_file *ifile = (struct s390_file *)f;
- struct s390_symbol *isym = (struct s390_symbol *)sym;
+ struct s390_file *ifile = (struct s390_file *) f;
+ struct s390_symbol *isym = (struct s390_symbol *) sym;
+ struct s390_plt_entry *pe;
Elf32_Addr *loc = (Elf32_Addr *)(targsec->contents + rel->r_offset);
Elf32_Addr dot = targsec->header.sh_addr + rel->r_offset;
Elf32_Addr got = ifile->got ? ifile->got->header.sh_addr : 0;
+ Elf32_Addr plt = ifile->plt ? ifile->plt->header.sh_addr : 0;
enum obj_reloc ret = obj_reloc_ok;
@@ -110,12 +125,48 @@ arch_apply_relocation (struct obj_file *f,
break;
case R_390_32:
- *loc += v;
+ *(unsigned int *) loc += v;
+ break;
+ case R_390_16:
+ *(unsigned short *) loc += v;
+ break;
+ case R_390_8:
+ *(unsigned char *) loc += v;
break;
- case R_390_PLT32:
case R_390_PC32:
- *loc += v - dot;
+ *(unsigned int *) loc += v - dot;
+ break;
+ case R_390_PC16DBL:
+ *(unsigned short *) loc += (v - dot) >> 1;
+ break;
+ case R_390_PC16:
+ *(unsigned short *) loc += v - dot;
+ break;
+
+ case R_390_PLT32:
+ case R_390_PLT16DBL:
+ /* find the plt entry and initialize it. */
+ assert(isym != NULL);
+ pe = (struct s390_plt_entry *) &isym->pltent;
+ assert(pe->allocated);
+ if (pe->initialized == 0) {
+ unsigned int *ip = (unsigned int *)(ifile->plt->contents + pe->offset);
+ ip[0] = 0x0d105810; /* basr 1,0; lg 1,10(1); br 1 */
+ ip[1] = 0x100607f1;
+ if (ELF32_R_TYPE(rel->r_info) == R_390_PLT16DBL)
+ ip[2] = v - 2;
+ else
+ ip[2] = v;
+ pe->initialized = 1;
+ }
+
+ /* Insert relative distance to target. */
+ v = plt + pe->offset - dot;
+ if (ELF32_R_TYPE(rel->r_info) == R_390_PLT32)
+ *(unsigned int *) loc = (unsigned int) v;
+ else if (ELF32_R_TYPE(rel->r_info) == R_390_PLT16DBL)
+ *(unsigned short *) loc = (unsigned short) ((v + 2) >> 1);
break;
case R_390_GLOB_DAT:
@@ -129,17 +180,25 @@ arch_apply_relocation (struct obj_file *f,
case R_390_GOTPC:
assert(got != 0);
- *loc += got - dot;
+ *(unsigned long *) loc += got - dot;
break;
+ case R_390_GOT12:
+ case R_390_GOT16:
case R_390_GOT32:
assert(isym != NULL);
+ assert(got != 0);
if (!isym->gotent.reloc_done)
{
isym->gotent.reloc_done = 1;
*(Elf32_Addr *)(ifile->got->contents + isym->gotent.offset) = v;
}
- *loc += isym->gotent.offset;
+ if (ELF32_R_TYPE(rel->r_info) == R_390_GOT12)
+ *(unsigned short *) loc |= (*(unsigned short *) loc + isym->gotent.offset) & 0xfff;
+ else if (ELF32_R_TYPE(rel->r_info) == R_390_GOT16)
+ *(unsigned short *) loc += isym->gotent.offset;
+ else if (ELF32_R_TYPE(rel->r_info) == R_390_GOT32)
+ *(unsigned int *) loc += isym->gotent.offset;
break;
case R_390_GOTOFF:
@@ -158,71 +217,98 @@ arch_apply_relocation (struct obj_file *f,
int
arch_create_got (struct obj_file *f)
{
- struct s390_file *ifile = (struct s390_file *)f;
- int i, n, offset = 0, gotneeded = 0;
+ struct s390_file *ifile = (struct s390_file *) f;
+ int i, got_offset = 0, plt_offset = 0, gotneeded = 0;
- n = ifile->root.header.e_shnum;
- for (i = 0; i < n; ++i)
+ for (i = 0; i < f->header.e_shnum; ++i)
{
struct obj_section *relsec, *symsec, *strsec;
- Elf32_Rel *rel, *relend;
+ Elf32_Rela *rel, *relend;
Elf32_Sym *symtab;
const char *strtab;
- relsec = ifile->root.sections[i];
- if (relsec->header.sh_type != SHT_REL)
+ relsec = f->sections[i];
+ if (relsec->header.sh_type != SHT_RELA)
continue;
- symsec = ifile->root.sections[relsec->header.sh_link];
- strsec = ifile->root.sections[symsec->header.sh_link];
+ symsec = f->sections[relsec->header.sh_link];
+ strsec = f->sections[symsec->header.sh_link];
- rel = (Elf32_Rel *)relsec->contents;
- relend = rel + (relsec->header.sh_size / sizeof(Elf32_Rel));
+ rel = (Elf32_Rela *)relsec->contents;
+ relend = rel + (relsec->header.sh_size / sizeof(Elf32_Rela));
symtab = (Elf32_Sym *)symsec->contents;
strtab = (const char *)strsec->contents;
for (; rel < relend; ++rel)
{
- Elf32_Sym *extsym;
struct s390_symbol *intsym;
- const char *name;
-
- switch (ELF32_R_TYPE(rel->r_info))
- {
+ struct s390_plt_entry *pe;
+ struct s390_got_entry *ge;
+
+ switch (ELF32_R_TYPE(rel->r_info)) {
+ /* These four relocations refer to a plt entry. */
+ case R_390_PLT16DBL:
+ case R_390_PLT32:
+ obj_find_relsym(intsym, f, f, rel, symtab, strtab);
+ assert(intsym);
+ pe = &intsym->pltent;
+ if (!pe->allocated) {
+ pe->allocated = 1;
+ pe->offset = plt_offset;
+ plt_offset += 12;
+ }
+ break;
+ /* The next three don't need got entries but the address
+ of the got itself. */
case R_390_GOTPC:
case R_390_GOTOFF:
gotneeded = 1;
- default:
- continue;
+ break;
+ case R_390_GOT12:
+ case R_390_GOT16:
case R_390_GOT32:
- break;
+ obj_find_relsym(intsym, f, f, rel, symtab, strtab);
+ assert(intsym);
+ ge = (struct s390_got_entry *) &intsym->gotent;
+ if (!ge->allocated) {
+ ge->allocated = 1;
+ ge->offset = got_offset;
+ got_offset += sizeof(void*);
}
+ break;
- extsym = &symtab[ELF32_R_SYM(rel->r_info)];
- if (extsym->st_name)
- name = strtab + extsym->st_name;
- else
- name = f->sections[extsym->st_shndx]->name;
- intsym = (struct s390_symbol *)obj_find_symbol(&ifile->root, name);
-
- if (!intsym->gotent.offset_done)
- {
- intsym->gotent.offset_done = 1;
- intsym->gotent.offset = offset;
- offset += 4;
+ default:
+ break;
}
}
}
- if (offset > 0 || gotneeded)
- ifile->got = obj_create_alloced_section(&ifile->root, ".got", 4, offset);
+ if (got_offset > 0 || gotneeded) {
+ struct obj_section *gotsec;
+ struct obj_symbol *gotsym;
+
+ gotsec = obj_find_section(f, ".got");
+ if (gotsec == NULL)
+ gotsec = obj_create_alloced_section(f, ".got", 4, got_offset, SHF_WRITE);
+ else
+ obj_extend_section(gotsec, got_offset);
+ gotsym = obj_add_symbol(f, "_GLOBAL_OFFSET_TABLE_", -1,
+ ELFW(ST_INFO) (STB_LOCAL, STT_OBJECT),
+ gotsec->idx, 0, 0);
+ gotsym->secidx = gotsec->idx; /* mark the symbol as defined */
+ ifile->got = gotsec;
+ }
+
+ if (plt_offset > 0)
+ ifile->plt = obj_create_alloced_section(f, ".plt", 4, plt_offset,
+ SHF_WRITE);
return 1;
}
int
-arch_init_module (struct obj_file *f, struct module *m)
+arch_init_module (struct obj_file *f, struct module *mod)
{
return 1;
}
@@ -243,3 +329,4 @@ arch_archdata (struct obj_file *fin, struct obj_section *sec)
{
return 0;
}
+
diff --git a/mdk-stage1/insmod-modutils/obj/obj_sparc.c b/mdk-stage1/insmod-modutils/obj/obj_sparc.c
index 1a03c9090..d1eb3da44 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_sparc.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_sparc.c
@@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stddef.h>
#include <module.h>
#include <obj.h>
diff --git a/mdk-stage1/insmod-modutils/obj/obj_sparc64.c b/mdk-stage1/insmod-modutils/obj/obj_sparc64.c
index 84e8d18a0..f025667f8 100644
--- a/mdk-stage1/insmod-modutils/obj/obj_sparc64.c
+++ b/mdk-stage1/insmod-modutils/obj/obj_sparc64.c
@@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stddef.h>
#include <module.h>
#include <obj.h>
diff --git a/mdk-stage1/insmod-modutils/obj/obj_x86_64.c b/mdk-stage1/insmod-modutils/obj/obj_x86_64.c
new file mode 100644
index 000000000..56dfeeabd
--- /dev/null
+++ b/mdk-stage1/insmod-modutils/obj/obj_x86_64.c
@@ -0,0 +1,253 @@
+/* x86-64 specific support for Elf loading and relocation.
+ Copyright 2002 SuSE Linux AG.
+
+ Contributed by Andreas Jaeger <aj@suse.de>.
+
+ This file is part of the Linux modutils.
+
+ 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. */
+
+#ident "$Id$"
+
+#include <string.h>
+#include <assert.h>
+
+#include <module.h>
+#include <obj.h>
+#include <util.h>
+
+/*======================================================================*/
+
+struct x86_64_got_entry
+{
+ long int offset;
+ unsigned offset_done : 1;
+ unsigned reloc_done : 1;
+};
+
+struct x86_64_file
+{
+ struct obj_file root;
+ struct obj_section *got;
+};
+
+struct x86_64_symbol
+{
+ struct obj_symbol root;
+ struct x86_64_got_entry gotent;
+};
+
+
+/*======================================================================*/
+
+struct obj_file *
+arch_new_file (void)
+{
+ struct x86_64_file *f;
+ f = xmalloc(sizeof(*f));
+ f->got = NULL;
+ return &f->root;
+}
+
+struct obj_section *
+arch_new_section (void)
+{
+ return xmalloc(sizeof(struct obj_section));
+}
+
+struct obj_symbol *
+arch_new_symbol (void)
+{
+ struct x86_64_symbol *sym;
+ sym = xmalloc(sizeof(*sym));
+ memset(&sym->gotent, 0, sizeof(sym->gotent));
+ return &sym->root;
+}
+
+int
+arch_load_proc_section(struct obj_section *sec, int fp)
+{
+ /* Assume it's just a debugging section that we can safely
+ ignore ... */
+ sec->contents = NULL;
+
+ return 0;
+}
+
+enum obj_reloc
+arch_apply_relocation (struct obj_file *f,
+ struct obj_section *targsec,
+ struct obj_section *symsec,
+ struct obj_symbol *sym,
+ Elf64_Rela *rel,
+ Elf64_Addr v)
+{
+ struct x86_64_file *ifile = (struct x86_64_file *)f;
+ struct x86_64_symbol *isym = (struct x86_64_symbol *)sym;
+
+ Elf64_Addr *loc = (Elf64_Addr *)(targsec->contents + rel->r_offset);
+ Elf64_Addr dot = targsec->header.sh_addr + rel->r_offset;
+ Elf64_Addr got = ifile->got ? ifile->got->header.sh_addr : 0;
+
+ enum obj_reloc ret = obj_reloc_ok;
+
+ switch (ELF64_R_TYPE(rel->r_info))
+ {
+ case R_X86_64_NONE:
+ break;
+
+ case R_X86_64_64:
+ *loc += v;
+ break;
+
+ case R_X86_64_32:
+ *(unsigned int *) loc += v;
+ break;
+
+ case R_X86_64_32S:
+ *(signed int *) loc += v;
+ break;
+
+ case R_X86_64_16:
+ *(unsigned short *) loc += v;
+ break;
+
+ case R_X86_64_8:
+ *(unsigned char *) loc += v;
+ break;
+
+ case R_X86_64_PC32:
+ *(unsigned int *) loc += v - dot;
+ break;
+
+ case R_X86_64_PC16:
+ *(unsigned short *) loc += v - dot;
+ break;
+
+ case R_X86_64_PC8:
+ *(unsigned char *) loc += v - dot;
+ break;
+
+ case R_X86_64_GLOB_DAT:
+ case R_X86_64_JUMP_SLOT:
+ *loc = v;
+ break;
+
+ case R_X86_64_RELATIVE:
+ *loc += f->baseaddr;
+ break;
+
+ case R_X86_64_GOT32:
+ case R_X86_64_GOTPCREL:
+ assert(isym != NULL);
+ if (!isym->gotent.reloc_done)
+ {
+ isym->gotent.reloc_done = 1;
+ *(Elf64_Addr *)(ifile->got->contents + isym->gotent.offset) = v;
+ }
+ /* XXX are these really correct? */
+ if (ELF64_R_TYPE(rel->r_info) == R_X86_64_GOTPCREL)
+ *(unsigned int *) loc += v + isym->gotent.offset;
+ else
+ *loc += isym->gotent.offset;
+ break;
+
+ default:
+ ret = obj_reloc_unhandled;
+ break;
+ }
+
+ return ret;
+}
+
+int
+arch_create_got (struct obj_file *f)
+{
+ struct x86_64_file *ifile = (struct x86_64_file *)f;
+ int i, n, offset = 0, gotneeded = 0;
+
+ n = ifile->root.header.e_shnum;
+ for (i = 0; i < n; ++i)
+ {
+ struct obj_section *relsec, *symsec, *strsec;
+ Elf64_Rela *rel, *relend;
+ Elf64_Sym *symtab;
+ const char *strtab;
+
+ relsec = ifile->root.sections[i];
+ if (relsec->header.sh_type != SHT_REL)
+ continue;
+
+ symsec = ifile->root.sections[relsec->header.sh_link];
+ strsec = ifile->root.sections[symsec->header.sh_link];
+
+ rel = (Elf64_Rela *)relsec->contents;
+ relend = rel + (relsec->header.sh_size / sizeof(Elf64_Rela));
+ symtab = (Elf64_Sym *)symsec->contents;
+ strtab = (const char *)strsec->contents;
+
+ for (; rel < relend; ++rel)
+ {
+ struct x86_64_symbol *intsym;
+
+ switch (ELF64_R_TYPE(rel->r_info))
+ {
+ case R_X86_64_GOTPCREL:
+ case R_X86_64_GOT32:
+ gotneeded = 1;
+ default:
+ continue;
+ }
+
+ obj_find_relsym(intsym, f, &ifile->root, rel, symtab, strtab);
+
+ if (!intsym->gotent.offset_done)
+ {
+ intsym->gotent.offset_done = 1;
+ intsym->gotent.offset = offset;
+ offset += 4;
+ }
+ }
+ }
+
+ if (offset > 0 || gotneeded)
+ ifile->got = obj_create_alloced_section(&ifile->root, ".got", 8, offset,
+ SHF_WRITE);
+
+ return 1;
+}
+
+int
+arch_init_module (struct obj_file *f, struct module *mod)
+{
+ return 1;
+}
+
+int
+arch_finalize_section_address(struct obj_file *f, Elf64_Addr base)
+{
+ int i, n = f->header.e_shnum;
+
+ f->baseaddr = base;
+ for (i = 0; i < n; ++i)
+ f->sections[i]->header.sh_addr += base;
+ return 1;
+}
+
+int
+arch_archdata (struct obj_file *fin, struct obj_section *sec)
+{
+ return 0;
+}
diff --git a/mdk-stage1/insmod-modutils/util/Makefile b/mdk-stage1/insmod-modutils/util/Makefile
index 763f046f2..dd8107435 100644
--- a/mdk-stage1/insmod-modutils/util/Makefile
+++ b/mdk-stage1/insmod-modutils/util/Makefile
@@ -13,7 +13,7 @@ top_dir = ../..
include $(top_dir)/Makefile.common
-all: libutil.a libutil-STANDALONE.a #libutil-DIET.a
+all: libutil.a libutil-STANDALONE.a
clean:
rm -f *.o *.a
@@ -36,7 +36,7 @@ libutil-STANDALONE.a: $(OBJS) logger-standalone.o
ranlib $@
logger-standalone.o: logger.c
- gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -o $@ -D_STANDALONE_ -c logger.c
+ $(DIET) gcc $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -o $@ -D_STANDALONE_ -c logger.c
-.c.o:
- gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $<
+%.o: %.c
+ $(DIET) gcc $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -c $<
diff --git a/mdk-stage1/insmod-modutils/util/alias.h b/mdk-stage1/insmod-modutils/util/alias.h
index c925a04f3..7d0c08938 100644
--- a/mdk-stage1/insmod-modutils/util/alias.h
+++ b/mdk-stage1/insmod-modutils/util/alias.h
@@ -42,6 +42,7 @@ char *tbtype[] =
*/
char *aliaslist[] =
{
+ "binfmt-0000 off",
"binfmt-204 binfmt_aout",
"binfmt-263 binfmt_aout",
"binfmt-264 binfmt_aout",
@@ -75,15 +76,23 @@ char *aliaslist[] =
"block-major-34 ide-probe-mod",
"block-major-37 ide-tape",
"block-major-44 ftl", /* from David Woodhouse <dwmw2@infradead.org> */
+ "block-major-46 pcd",
+ "block-major-47 pf",
"block-major-56 ide-probe-mod",
"block-major-57 ide-probe-mod",
+ "block-major-58 lvm-mod",
"block-major-88 ide-probe-mod",
"block-major-89 ide-probe-mod",
"block-major-90 ide-probe-mod",
"block-major-91 ide-probe-mod",
"block-major-93 nftl", /* from David Woodhouse <dwmw2@infradead.org> */
+ "block-major-97 pg",
+#if !defined(__s390__) && !defined(__s390x__)
"char-major-4 serial",
+#else
+ "char-major-4 off",
+#endif
"char-major-5 serial",
"char-major-6 lp",
"char-major-9 st",
@@ -102,13 +111,15 @@ char *aliaslist[] =
"char-major-10-131 wdt", /* /dev/temperature Machine internal temperature */
/* /dev/hwtrap Hardware fault trap */
/* /dev/exttrp External device trap */
- "char-major-10-135 off", /* rtc cannot be compiled as a module */
+ "char-major-10-135 rtc", /* /dev/rtc Real time clock */
"char-major-10-139 openprom", /* /dev/openprom Linux/Sparc interface */
"char-major-10-144 nvram", /* from Tigran Aivazian <tigran@sco.COM> */
"char-major-10-157 applicom", /* from David Woodhouse <dwmw2@infradead.org> */
"char-major-10-175 agpgart", /* /dev/agpgart GART AGP mapping access */
"char-major-10-184 microcode", /* Tigran Aivazian <tigran@veritas.com> */
+ "char-major-13 input",
+ "char-major-13-32 mousedev",
"char-major-14 soundcore",
"char-major-19 cyclades",
"char-major-20 cyclades",
@@ -126,9 +137,15 @@ char *aliaslist[] =
"char-major-58 esp",
"char-major-63 kdebug",
"char-major-90 mtdchar", /* from David Woodhouse <dwmw2@infradead.org> */
+ "char-major-96 pt",
"char-major-99 ppdev",
"char-major-107 3dfx", /* from Tigran Aivazian <tigran@sco.COM> */
+ "char-major-108 ppp_generic",
+ "char-major-109 lvm-mod",
"char-major-161 ircomm-tty",
+ "char-major-171 raw1394",
+ "char-major-195 NVdriver",
+ "char-major-200 vxspec",
"dos msdos",
"dummy0 dummy",
@@ -139,6 +156,7 @@ char *aliaslist[] =
"md-personality-2 raid0",
"md-personality-3 raid1",
"md-personality-4 raid5",
+ "md-personality-7 multipath",
"net-pf-1 unix", /* PF_UNIX 1 Unix domain sockets */
"net-pf-2 ipv4", /* PF_INET 2 Internet IP Protocol */
@@ -149,29 +167,52 @@ char *aliaslist[] =
/* PF_BRIDGE 7 Multiprotocol bridge */
/* PF_AAL5 8 Reserved for Werner's ATM */
/* PF_X25 9 Reserved for X.25 project */
- /* PF_INET6 10 IP version 6 */
+ "net-pf-10 off", /* PF_INET6 10 IP version 6 */
/* next two from <dairiki@matthews.dairiki.org> Thanks! */
"net-pf-17 af_packet",
"net-pf-19 off", /* acorn econet */
"netalias-2 ip_alias",
+
+ /* To be able to attach some dongles */
+ "irlan0 irlan",
+ "irda-dongle-0 tekram",
+ "irda-dongle-1 esi",
+ "irda-dongle-2 actisys",
+ "irda-dongle-3 actisys",
+ "irda-dongle-4 girbil",
+ "irda-dongle-5 litelink",
+ "irda-dongle-6 airport",
+ "irda-dongle-7 old_belkin",
+
"plip0 plip",
"plip1 plip",
+ "tunl0 ipip",
"cipcb0 cipcb",
"cipcb1 cipcb",
"cipcb2 cipcb",
"cipcb3 cipcb",
+#if defined(__s390__) || defined(__s390x__)
+ "ctc0 ctc",
+ "ctc1 ctc",
+ "ctc2 ctc",
+ "iucv0 netiucv",
+ "iucv1 netiucv",
+#endif
"ppp0 ppp",
"ppp1 ppp",
- "scsi_hostadapter off", /* if not in config file */
"slip0 slip",
"slip1 slip",
"tty-ldisc-1 slip",
- "tty-ldisc-3 ppp",
+ "tty-ldisc-3 ppp_async",
+ "tty-ldisc-11 irtty", /* IrDA over a normal serial port, or a serial port compatible IrDA port */
+ "tty-ldisc-14 ppp_synctty",
+ "ppp-compress-18 ppp_mppe",
"ppp-compress-21 bsd_comp",
"ppp-compress-24 ppp_deflate",
"ppp-compress-26 ppp_deflate",
+ "ppp ppp_async", /* for 2.4 */
#ifndef __sparc__
"parport_lowlevel parport_pc",
@@ -179,8 +220,6 @@ char *aliaslist[] =
"parport_lowlevel parport_ax",
#endif
- "tty-ldisc-11 irtty",
-
"usbdevfs usbcore",
NULL /* marks the end of the list! */
@@ -205,6 +244,9 @@ char *optlist[] =
*/
char *above[] =
{
+ "hid keybdev mousedev",
+ "usbmouse hid",
+ "wacom evdev",
NULL /* marks the end of the list! */
};
@@ -219,19 +261,43 @@ char *below[] =
};
/*
+ * This is the list of pre-defined "post-install"s,
+ * used to execute commands after loading modules.
+ * /etc/modules.conf can add entries but not remove them.
+ */
+char *post_install[] =
+{
+ "binfmt_misc /bin/mount -t binfmt_misc none /proc/sys/fs/binfmt_misc > /dev/null 2>&1 || :",
+ NULL
+};
+
+/*
+ * This is the list of pre-defined "pre-remove"s,
+ * used to execute commands before unloading modules.
+ * /etc/modules.conf can add entries but not remove them.
+ */
+char *pre_remove[] =
+{
+ "binfmt_misc /bin/umount /proc/sys/fs/binfmt_misc > /dev/null 2>&1 || :",
+ NULL
+};
+
+/*
* This is the list of pre-defined "prune"s,
* used to exclude paths from scan of /lib/modules.
* /etc/modules.conf can add entries but not remove them.
*/
char *prune[] =
{
- ".rhkmvtag",
"modules.dep",
+ "modules.description",
"modules.generic_string",
"modules.pcimap",
"modules.isapnpmap",
"modules.usbmap",
"modules.parportmap",
+ "modules.ieee1394map",
+ "modules.pnpbiosmap",
"System.map",
".config",
"build", /* symlink to source tree */
diff --git a/mdk-stage1/insmod-modutils/util/arch64.c b/mdk-stage1/insmod-modutils/util/arch64.c
index 4d5ace223..90886d16b 100644
--- a/mdk-stage1/insmod-modutils/util/arch64.c
+++ b/mdk-stage1/insmod-modutils/util/arch64.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>
@@ -30,6 +28,16 @@
/* Indicate if the current machine uses 64 bit architecture */
int arch64(void)
{
- struct utsname u;
- return(!uname(&u) && strstr(u.machine, "64"));
+ struct utsname uts;
+ char *uname_m;
+ if (uname(&uts))
+ return(0);
+ if ((uname_m = getenv("UNAME_MACHINE"))) {
+ int l = strlen(uname_m);
+ if (l >= sizeof(uts.machine))
+ l = sizeof(uts.machine)-1;
+ memcpy(uts.machine, uname_m, l);
+ uts.machine[l] = '\0';
+ }
+ return(strstr(uts.machine, "64") != NULL);
}
diff --git a/mdk-stage1/insmod-modutils/util/config.c b/mdk-stage1/insmod-modutils/util/config.c
index a860920f6..7568d955f 100644
--- a/mdk-stage1/insmod-modutils/util/config.c
+++ b/mdk-stage1/insmod-modutils/util/config.c
@@ -116,6 +116,8 @@ struct gen_files gen_file[] = {
{"isapnpmap", NULL, 0},
{"usbmap", NULL, 0},
{"parportmap", NULL, 0},
+ {"ieee1394map", NULL, 0},
+ {"pnpbiosmap", NULL, 0},
{"dep", NULL, 0},
};
@@ -491,7 +493,7 @@ static int do_read(int all, char *force_ver, char *base_dir, char *conf_file, in
int state[MAX_LEVEL + 1]; /* nested "if" */
int level = 0;
char buf[3000];
- char tmpline[100];
+ char tmpline[PATH_MAX];
char **pathp;
char *envpath;
char *version;
@@ -692,6 +694,20 @@ static int do_read(int all, char *force_ver, char *base_dir, char *conf_file, in
if (all && aliaslist[0])
n_aliases = build_list(aliaslist, &aliases, version, 0);
+ /*
+ * Build predef postinstalls
+ */
+ if (all && post_install[0])
+ for (i=0 ; post_install[i] ; i++ )
+ decode_exec(xstrdup(post_install[i]), EXEC_POST_INSTALL);
+
+ /*
+ * Build predef preremoves
+ */
+ if (all && pre_remove[0])
+ for (i=0 ; pre_remove[i] ; i++ )
+ decode_exec(xstrdup(pre_remove[i]), EXEC_PRE_REMOVE);
+
/* Order and priority is now: (MODPATH + modules.conf) || (predefs + modules.conf) */
if ((envpath = getenv("MODPATH")) != NULL && !safemode) {
size_t len;
@@ -1073,7 +1089,7 @@ static int do_read(int all, char *force_ver, char *base_dir, char *conf_file, in
arg2 = next_word(arg);
meta_expand(arg2, &g, NULL, version, ME_ALL);
snprintf(env, sizeof(env), "%s=%s", arg, (g.pathc ? g.pathv[0] : ""));
- putenv(env);
+ putenv(xstrdup(env));
one_err = 0;
}
@@ -1108,7 +1124,7 @@ static int do_read(int all, char *force_ver, char *base_dir, char *conf_file, in
/*
* prune
*/
- else if (all && !assgn && strcmp(parm, "prune") == 0) {
+ else if (!assgn && strcmp(parm, "prune") == 0) {
decode_list(&n_prunelist, &prunelist, arg, adding, version, 0);
one_err = 0;
}
@@ -1349,9 +1365,11 @@ static int do_read(int all, char *force_ver, char *base_dir, char *conf_file, in
return ret;
/* else */
+ if (depth == 0) {
/* Check we have names for generated files */
for (i = 0; !ret && i < gen_file_count; ++i)
ret = gen_file_check(gen_file+i, &g, base_dir, version);
+ }
return ret;
}
@@ -1367,7 +1385,12 @@ int config_read(int all, char *force_ver, char *base_dir, char *conf_file)
return -1;
}
+ if (access(MODUTILS_MACROS, R_OK) == 0){
+ r = do_read(all, force_ver, base_dir, MODUTILS_MACROS, 0);
+ r = do_read(all, force_ver, "", conf_file, 1);
+ } else {
r = do_read(all, force_ver, base_dir, conf_file, 0);
+ }
if (quick && !r && !need_update (force_ver, base_dir))
exit (0);
diff --git a/mdk-stage1/insmod-modutils/util/logger.c b/mdk-stage1/insmod-modutils/util/logger.c
index 3b790df5a..4774a0beb 100644
--- a/mdk-stage1/insmod-modutils/util/logger.c
+++ b/mdk-stage1/insmod-modutils/util/logger.c
@@ -20,8 +20,7 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#ident "$Id$"
-
+#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -32,9 +31,10 @@
/*======================================================================*/
+int log;
+
int errors;
const char *error_file;
-int log;
#define STOREMSG
#ifdef STOREMSG
@@ -44,29 +44,12 @@ struct cbuf {
char *msg;
} *head, *tail;
-static void savemsg(int type, char *msg)
-{
- struct cbuf *me = (struct cbuf *)xmalloc(sizeof(struct cbuf));
- char *s = xstrdup(msg);
-
- me->next = NULL;
- me->type = type;
- me->msg = s;
-
- if (tail)
- tail->next = me;
- else
- head = me;
- tail = me;
-}
-
-#endif /* STOREMSG */
-
static void dumpmsg(void)
{
for (;head; head = head->next)
syslog(head->type, "%s", head->msg);
}
+#endif /* STOREMSG */
void setsyslog(const char *program)
{
@@ -77,13 +60,27 @@ void setsyslog(const char *program)
log = 1;
}
-
-
#ifdef _STANDALONE_
static int silent;
const char *program_name;
+static void savemsg(int type, char *msg)
+{
+ struct cbuf *me = (struct cbuf *)xmalloc(sizeof(struct cbuf));
+ char *s = xstrdup(msg);
+
+ me->next = NULL;
+ me->type = type;
+ me->msg = s;
+
+ if (tail)
+ tail->next = me;
+ else
+ head = me;
+ tail = me;
+}
+
void error(const char *fmt,...)
{
va_list args;
@@ -91,7 +88,7 @@ void error(const char *fmt,...)
if (silent)
;
else if (log) {
- char buf[1024];
+ char buf[2*PATH_MAX];
int n;
if (error_file)
@@ -124,7 +121,7 @@ void lprintf(const char *fmt,...)
if (silent);
else if (log) {
- char buf[1024];
+ char buf[2*PATH_MAX];
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
@@ -140,7 +137,6 @@ void lprintf(const char *fmt,...)
putchar('\n');
}
}
-
#else /* _STANDALONE_ */
#include "../../log.h"
void error(const char *s, ...)
@@ -161,3 +157,4 @@ void lprintf(const char *s, ...)
va_end(p);
}
#endif
+
diff --git a/mdk-stage1/insmod-modutils/util/snap_shot.c b/mdk-stage1/insmod-modutils/util/snap_shot.c
index ae0cc7c79..adf54d28e 100644
--- a/mdk-stage1/insmod-modutils/util/snap_shot.c
+++ b/mdk-stage1/insmod-modutils/util/snap_shot.c
@@ -20,8 +20,6 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#ident "$Id$"
-
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
@@ -108,6 +106,7 @@ void snap_shot(const char *module_names, int n_module_names)
if (ferror(in))
error("unable to read from %s %m", infile[i]);
fclose(in);
+ fflush(out);
fclose(out);
}
}
@@ -150,5 +149,6 @@ void snap_shot_log(const char *fmt,...)
vfprintf(log, fmt, args);
va_end(args);
fprintf(log, "\n");
+ fflush(log);
fclose(log);
}
diff --git a/mdk-stage1/insmod-modutils/util/sys_cm.c b/mdk-stage1/insmod-modutils/util/sys_cm.c
index 851fb709e..d19a5ba4b 100644
--- a/mdk-stage1/insmod-modutils/util/sys_cm.c
+++ b/mdk-stage1/insmod-modutils/util/sys_cm.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <errno.h>
diff --git a/mdk-stage1/insmod-modutils/util/sys_dm.c b/mdk-stage1/insmod-modutils/util/sys_dm.c
index a166a30f4..611234efa 100644
--- a/mdk-stage1/insmod-modutils/util/sys_dm.c
+++ b/mdk-stage1/insmod-modutils/util/sys_dm.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <errno.h>
diff --git a/mdk-stage1/insmod-modutils/util/sys_gks.c b/mdk-stage1/insmod-modutils/util/sys_gks.c
index f71772c71..b639fc990 100644
--- a/mdk-stage1/insmod-modutils/util/sys_gks.c
+++ b/mdk-stage1/insmod-modutils/util/sys_gks.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <errno.h>
diff --git a/mdk-stage1/insmod-modutils/util/sys_nim.c b/mdk-stage1/insmod-modutils/util/sys_nim.c
index bbe42135c..c267ddf10 100644
--- a/mdk-stage1/insmod-modutils/util/sys_nim.c
+++ b/mdk-stage1/insmod-modutils/util/sys_nim.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <errno.h>
diff --git a/mdk-stage1/insmod-modutils/util/sys_oim.c b/mdk-stage1/insmod-modutils/util/sys_oim.c
index 73ac6be52..b915e36a5 100644
--- a/mdk-stage1/insmod-modutils/util/sys_oim.c
+++ b/mdk-stage1/insmod-modutils/util/sys_oim.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <errno.h>
diff --git a/mdk-stage1/insmod-modutils/util/sys_qm.c b/mdk-stage1/insmod-modutils/util/sys_qm.c
index 119a219a2..ba478832b 100644
--- a/mdk-stage1/insmod-modutils/util/sys_qm.c
+++ b/mdk-stage1/insmod-modutils/util/sys_qm.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include <errno.h>
diff --git a/mdk-stage1/insmod-modutils/util/xmalloc.c b/mdk-stage1/insmod-modutils/util/xmalloc.c
index 9113d47fe..da0be2953 100644
--- a/mdk-stage1/insmod-modutils/util/xmalloc.c
+++ b/mdk-stage1/insmod-modutils/util/xmalloc.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include "util.h"
@@ -29,7 +27,7 @@
void *
xmalloc(size_t size)
{
- void *ptr = malloc(size);
+ void *ptr = malloc(size ? size : 1);
if (!ptr)
{
error("Out of memory");
diff --git a/mdk-stage1/insmod-modutils/util/xrealloc.c b/mdk-stage1/insmod-modutils/util/xrealloc.c
index d287486f7..adc0558f1 100644
--- a/mdk-stage1/insmod-modutils/util/xrealloc.c
+++ b/mdk-stage1/insmod-modutils/util/xrealloc.c
@@ -18,8 +18,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
#include <stdlib.h>
#include "util.h"
diff --git a/mdk-stage1/insmod-modutils/util/xstrcat.c b/mdk-stage1/insmod-modutils/util/xstrcat.c
index abb075c83..ed4a2bf20 100644
--- a/mdk-stage1/insmod-modutils/util/xstrcat.c
+++ b/mdk-stage1/insmod-modutils/util/xstrcat.c
@@ -17,8 +17,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id"
-
#include <stdlib.h>
#include <string.h>
#include "util.h"
diff --git a/mdk-stage1/insmod-modutils/util/xstrdup.c b/mdk-stage1/insmod-modutils/util/xstrdup.c
index 11b289eb0..46889a094 100644
--- a/mdk-stage1/insmod-modutils/util/xstrdup.c
+++ b/mdk-stage1/insmod-modutils/util/xstrdup.c
@@ -18,10 +18,8 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id$"
-
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "util.h"
diff --git a/mdk-stage1/insmod-modutils/util/xsystem.c b/mdk-stage1/insmod-modutils/util/xsystem.c
index edb995268..8ffa490a9 100644
--- a/mdk-stage1/insmod-modutils/util/xsystem.c
+++ b/mdk-stage1/insmod-modutils/util/xsystem.c
@@ -17,8 +17,6 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ident "$Id"
-
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
diff --git a/mdk-stage1/log.c b/mdk-stage1/log.c
index 319079fd7..0404ba46b 100644
--- a/mdk-stage1/log.c
+++ b/mdk-stage1/log.c
@@ -37,6 +37,9 @@ static FILE * logfile = NULL;
void vlog_message(const char * s, va_list args)
{
+ va_list args_copy;
+ va_copy(args_copy, args);
+
if (logfile) {
fprintf(logfile, "* ");
vfprintf(logfile, s, args);
@@ -45,10 +48,12 @@ void vlog_message(const char * s, va_list args)
}
if (logtty) {
fprintf(logtty, "* ");
- vfprintf(logtty, s, args);
+ vfprintf(logtty, s, args_copy);
fprintf(logtty, "\n");
fflush(logtty);
}
+
+ va_end(args_copy);
}
diff --git a/mdk-stage1/mar/Makefile b/mdk-stage1/mar/Makefile
index 801785947..0a12e21d8 100644
--- a/mdk-stage1/mar/Makefile
+++ b/mdk-stage1/mar/Makefile
@@ -25,15 +25,10 @@ include $(top_dir)/Makefile.common
TARGETS = libmar.a mar
-ifeq (DIETLIBC, $(L))
-TARGETS += libmar-DIET.a
-endif
-
-
all: $(TARGETS)
clean:
- rm -f *.o libmar.a libmar-DIET.a mar
+ rm -f *.o libmar.a mar
mar: mar-frontend.o mar-extract-only-standalone.o
@@ -44,15 +39,8 @@ libmar.a: mar-extract-only.o
ar -cru $@ $^
ranlib $@
-libmar-DIET.a: mar-extract-only-DIET.o
- ar -cru $@ $^
- ranlib $@
-
mar-extract-only.o: mar-extract-only.c mar-extract-only.h mar.h
- gcc $(CFLAGS) $(GLIBC_INCLUDES) -c mar-extract-only.c
-
-mar-extract-only-DIET.o: mar-extract-only.c mar-extract-only.h mar.h
- gcc $(CFLAGS) $(DIETLIBC_INCLUDES) -o $@ -c mar-extract-only.c
+ $(DIET) gcc $(CFLAGS) $(INCLUDES) -c mar-extract-only.c
mar-frontend.o: mar-frontend.c mar.h mar-extract-only.h
gcc $(CFLAGS) $(GLIBC_INCLUDES) -c mar-frontend.c
diff --git a/mdk-stage1/minilibc.c b/mdk-stage1/minilibc.c
index 73d7deae5..7a7e6c561 100644
--- a/mdk-stage1/minilibc.c
+++ b/mdk-stage1/minilibc.c
@@ -60,34 +60,92 @@ void _fini (int __status __attribute__ ((unused)))
{
}
-inline int socket(int a, int b, int c)
+#ifdef __x86_64__
+/* x86-64 implementation of signal() derived from glibc sources */
+
+static inline int sigemptyset(sigset_t *set) {
+ *set = 0;
+ return 0;
+}
+
+static inline int sigaddset(sigset_t *set, int sig) {
+ __asm__("btsq %1,%0" : "=m" (*set) : "Ir" (sig - 1L) : "cc");
+ return 0;
+}
+
+#define __NR___rt_sigaction __NR_rt_sigaction
+static inline _syscall3(int,__rt_sigaction,int,signum,const void *,act,void *,oldact)
+#define __NR___rt_sigreturn __NR_rt_sigreturn
+static _syscall1(int,__rt_sigreturn,unsigned long,unused)
+
+static void restore_rt(void) {
+ __rt_sigreturn(0);
+}
+
+int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
+ struct sigaction *newact = (struct sigaction *)act;
+ if (act) {
+ newact = __builtin_alloca(sizeof(*newact));
+ newact->sa_handler = act->sa_handler;
+ newact->sa_flags = act->sa_flags | SA_RESTORER;
+ newact->sa_restorer = &restore_rt;
+ newact->sa_mask = act->sa_mask;
+ }
+ return __rt_sigaction(signum, newact, oldact);
+}
+
+__sighandler_t signal(int signum, __sighandler_t action) {
+ struct sigaction sa,oa;
+ sa.sa_handler=action;
+ sigemptyset(&sa.sa_mask);
+ sigaddset(&sa.sa_mask,signum);
+ sa.sa_flags=SA_RESTART;
+ if (sigaction(signum,&sa,&oa))
+ return SIG_ERR;
+ return oa.sa_handler;
+}
+
+#endif
+
+#ifdef __NR_socketcall
+
+int socket(int a, int b, int c)
{
unsigned long args[] = { a, b, c };
return socketcall(SYS_SOCKET, args);
}
-inline int bind(int a, void * b, int c)
+int bind(int a, void * b, int c)
{
unsigned long args[] = { a, (long) b, c };
return socketcall(SYS_BIND, args);
}
-inline int listen(int a, int b)
+int listen(int a, int b)
{
unsigned long args[] = { a, b, 0 };
return socketcall(SYS_LISTEN, args);
}
-inline int accept(int a, void * addr, void * addr2)
+int accept(int a, void * addr, void * addr2)
{
unsigned long args[] = { a, (long) addr, (long) addr2 };
return socketcall(SYS_ACCEPT, args);
}
+#else
+
+_syscall3(int,socket,int,domain,int,type,int,protocol)
+_syscall3(int,bind,int,sockfd,void *,my_addr,int,addrlen)
+_syscall2(int,listen,int,s,int,backlog)
+_syscall3(int,accept,int,s,void *,addr,void *,addrlen)
+
+#endif
+
void sleep(int secs)
{
@@ -248,4 +306,3 @@ void printf(char * fmt, ...)
}
}
}
-
diff --git a/mdk-stage1/minilibc.h b/mdk-stage1/minilibc.h
index e0775e3a0..cbcb21f44 100644
--- a/mdk-stage1/minilibc.h
+++ b/mdk-stage1/minilibc.h
@@ -58,6 +58,9 @@ extern int errno;
#include <asm/fcntl.h>
#include <asm/signal.h>
+#ifndef __NR__newselect
+#define __NR__newselect __NR_select
+#endif
#ifndef MINILIBC_INTERNAL
static inline _syscall5(int,mount,const char *,spec,const char *,dir,const char *,type,unsigned long,rwflag,const void *,data);
@@ -76,8 +79,17 @@ static inline _syscall2(int,chmod,const char * ,path,mode_t,mode)
static inline _syscall2(int,sethostname,const char *,name,int,len)
static inline _syscall2(int,setdomainname,const char *,name,int,len)
static inline _syscall2(int,setpgid,int,name,int,len)
+#ifdef __x86_64__
+extern __sighandler_t signal(int signum, __sighandler_t handler);
+#else
static inline _syscall2(int,signal,int,num,void *,len)
+#endif
+#ifdef __NR_umount
static inline _syscall1(int,umount,const char *,dir)
+#else
+static inline _syscall2(int,umount2,const char *,dir,int,flags)
+static inline int umount(const char * dir) { return umount2(dir, 0); }
+#endif
static inline _syscall1(int,unlink,const char *,fn)
static inline _syscall1(int,close,int,fd)
static inline _syscall1(int,swapoff,const char *,fn)
@@ -112,19 +124,21 @@ static inline _syscall3(int,syslog,int, type, char *, buf, int, len);
#else
static inline _syscall5(int,_newselect,int,n,fd_set *,rd,fd_set *,wr,fd_set *,ex,struct timeval *,timeval);
static inline _syscall3(int,write,int,fd,const char *,buf,unsigned long,count)
+#ifdef __NR_socketcall
static inline _syscall2(int,socketcall,int,code,unsigned long *, args)
+#endif
#define __NR__do_exit __NR_exit
-extern inline _syscall1(int,_do_exit,int,exitcode)
+static inline _syscall1(int,_do_exit,int,exitcode)
#endif
#define select _newselect
extern int errno;
-inline int socket(int a, int b, int c);
-inline int bind(int a, void * b, int c);
-inline int listen(int a, int b);
-inline int accept(int a, void * addr, void * addr2);
+int socket(int a, int b, int c);
+int bind(int a, void * b, int c);
+int listen(int a, int b);
+int accept(int a, void * addr, void * addr2);
void sleep(int secs);
diff --git a/mdk-stage1/newt/Makefile b/mdk-stage1/newt/Makefile
index 171bcf0cb..b5b3ea8b7 100644
--- a/mdk-stage1/newt/Makefile
+++ b/mdk-stage1/newt/Makefile
@@ -29,28 +29,14 @@ INCS = -I../slang
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
- gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $< -o $@
-
-$(OBJS-DIET): %-DIET.o: %.c
- gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -c $< -o $@
-
+ $(DIET) gcc $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/newt/form.c b/mdk-stage1/newt/form.c
index 4ad465e38..ad7520e95 100644
--- a/mdk-stage1/newt/form.c
+++ b/mdk-stage1/newt/form.c
@@ -2,6 +2,7 @@
#include <slang.h>
#include <stdarg.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
diff --git a/mdk-stage1/rescue-gui.c b/mdk-stage1/rescue-gui.c
index 240d7ccba..dbe12cb4a 100644
--- a/mdk-stage1/rescue-gui.c
+++ b/mdk-stage1/rescue-gui.c
@@ -34,14 +34,24 @@
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",
+ "LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/usr/X11R6/lib:/mnt/usr/X11R6/lib"
+#if defined(__x86_64__) || defined(__ppc64__)
+ ":/lib64:/usr/lib64:/usr/X11R6/lib64:/mnt/lib64:/mnt/usr/lib64:/mnt/usr/X11R6/lib64"
+#endif
+ ,
"HOME=/",
"TERM=linux",
"TERMINFO=/etc/terminfo",
NULL
};
-void pause(void) { unsigned char t; fflush(stdout); read(0, &t, 1); }
+/* pause() already exists and causes the invoking process to sleep
+ until a signal is received */
+static void PAUSE(void) {
+ unsigned char t;
+ fflush(stdout);
+ read(0, &t, 1);
+}
/* ------ UUURGH this is duplicated from `init.c', don't edit here........ */
@@ -202,13 +212,13 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused))
execve(child_argv[0], child_argv, env);
printf("Can't execute binary (%s)\n<press Enter>\n", binary);
- pause();
+ PAUSE();
return 33;
}
while (wait4(-1, &wait_status, 0, NULL) != pid) {};
printf("<press Enter to return to Rescue GUI>");
- pause();
+ PAUSE();
resume_from_suspend();
if (!WIFEXITED(wait_status) || WEXITSTATUS(wait_status) != 0) {
error_message("Program exited abnormally (return code %d).", WEXITSTATUS(wait_status));
diff --git a/mdk-stage1/slang/Makefile b/mdk-stage1/slang/Makefile
index 4cd1dc6bb..01700651d 100644
--- a/mdk-stage1/slang/Makefile
+++ b/mdk-stage1/slang/Makefile
@@ -29,28 +29,14 @@ 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
- gcc $(CFLAGS) $(DEFS) $(INCS) $(GLIBC_INCLUDES) -c $< -o $@
-
-$(OBJS-DIET): %-DIET.o: %.c
- gcc $(CFLAGS) $(DEFS) $(INCS) $(DIETLIBC_INCLUDES) -c $< -o $@
-
+ $(DIET) gcc $(CFLAGS) $(DEFS) $(INCS) $(INCLUDES) -c $< -o $@
diff --git a/mdk-stage1/stage1.h b/mdk-stage1/stage1.h
index 8b26fd947..d32543309 100644
--- a/mdk-stage1/stage1.h
+++ b/mdk-stage1/stage1.h
@@ -41,6 +41,7 @@ extern char * stage2_kickstart;
#define MODE_CHANGEDISK (1 << 10)
#define MODE_UPDATEMODULES (1 << 11)
#define MODE_NOAUTO (1 << 12)
+#define MODE_NETAUTO (1 << 13)
#define IS_TESTING (get_param(MODE_TESTING))
#define IS_EXPERT (get_param(MODE_EXPERT))
@@ -51,6 +52,7 @@ extern char * stage2_kickstart;
#define IS_CHANGEDISK (get_param(MODE_CHANGEDISK))
#define IS_UPDATEMODULES (get_param(MODE_UPDATEMODULES))
#define IS_NOAUTO (get_param(MODE_NOAUTO))
+#define IS_NETAUTO (get_param(MODE_NETAUTO))
void fatal_error(char *msg) __attribute__ ((noreturn));
diff --git a/mdk-stage1/stdio-frontend.c b/mdk-stage1/stdio-frontend.c
index 3fbed999a..ea26bff14 100644
--- a/mdk-stage1/stdio-frontend.c
+++ b/mdk-stage1/stdio-frontend.c
@@ -330,7 +330,7 @@ enum return_type ask_yes_no(char *msg)
}
-enum return_type ask_from_entries(char *msg, char ** questions, char *** answers, int entry_size, void (*callback_func)(char ** strings))
+enum return_type ask_from_entries(char *msg, char ** questions, char *** answers, int entry_size, void (*callback_func)(char ** strings) UNUSED)
{
int j, i = 0;
char ** already_answers = NULL;
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index a921883a8..fd2e556b8 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -91,6 +91,7 @@ void process_cmdline(void)
if (!strcmp(name, "updatemodules")) set_param(MODE_UPDATEMODULES);
if (!strcmp(name, "rescue")) set_param(MODE_RESCUE);
if (!strcmp(name, "noauto")) set_param(MODE_NOAUTO);
+ if (!strcmp(name, "netauto")) set_param(MODE_NETAUTO);
if (!strcmp(name, "special_stage2")) set_param(MODE_SPECIAL_STAGE2);
if (!strcmp(name, "automatic")) {
set_param(MODE_AUTOMATIC);
diff --git a/perl-install/Makefile b/perl-install/Makefile
index f96dadcf2..d6a5e2c94 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -152,7 +152,11 @@ endif
ifeq (i386,$(ARCH))
cp ../tools/i386/busybox $(DEST)/usr/bin
endif
+ifeq (ia64,$(ARCH))
+ ln -sf bash $(DEST)/usr/bin/sh
+else
ln -sf ash $(DEST)/usr/bin/sh
+endif
for i in fonts keyboards locales keymaps; do tar xfj `../tools/specific_arch share/$$i.tar.bz2` -C $(DEST); done
diff --git a/perl-install/Xconfig/card.pm b/perl-install/Xconfig/card.pm
index adf1a26a7..450972560 100644
--- a/perl-install/Xconfig/card.pm
+++ b/perl-install/Xconfig/card.pm
@@ -9,7 +9,7 @@ use common;
use log;
-my $force_xf4 = arch() =~ /ppc|ia64/;
+my $force_xf4 = arch() =~ /ppc|ia64|x86_64/;
my %VideoRams = (
diff --git a/perl-install/any.pm b/perl-install/any.pm
index d1994d2c9..ab9907cc7 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -138,6 +138,8 @@ sub setupBootloader {
if_(exists $b->{methods}{lilo},
__("LILO with text menu") => sub { $b->{methods}{lilo} = "lilo-menu" },
__("LILO with graphical menu") => sub { $b->{methods}{lilo} = "lilo-graphic" }),
+ if_(exists $b->{methods}{elilo},
+ __("ELILO") => sub { $b->{methods}{elilo} = 1 }),
if_(exists $b->{methods}{grub},
#- put lilo if grub is chosen, so that /etc/lilo.conf is generated
__("Grub") => sub { $b->{methods}{grub} = 1;
@@ -284,13 +286,13 @@ You can add some more or change the existing ones."),
my @l;
if ($e->{type} eq "image") {
@l = (
-{ label => _("Image"), val => \$e->{kernel_or_dev}, list => [ map { s/$prefix//; $_ } glob_("$prefix/boot/vmlinuz*") ], not_edit => 0 },
+{ label => _("Image"), val => \$e->{kernel_or_dev}, list => [ map { s/$prefix//; $_ } glob_( arch() =~ /ia64/ ? "$prefix/boot/efi/vmlinuz*" : "$prefix/boot/vmlinuz*" ) ], not_edit => 0 },
{ label => _("Root"), val => \$e->{root}, list => [ map { "/dev/$_->{device}" } @$fstab ], not_edit => !$::expert },
{ label => _("Append"), val => \$e->{append} },
if_(arch !~ /ppc|ia64/,
{ label => _("Video mode"), val => \$e->{vga}, list => [ keys %bootloader::vga_modes ], format => sub { $bootloader::vga_modes{$_[0]} }, not_edit => !$::expert },
),
-{ label => _("Initrd"), val => \$e->{initrd}, list => [ map { s/$prefix//; $_ } glob_("$prefix/boot/initrd*") ], not_edit => 0 },
+{ label => _("Initrd"), val => \$e->{initrd}, list => [ map { s/$prefix//; $_ } glob_( arch() =~ /ia64/ ? "$prefix/boot/efi/initrd*" : "$prefix/boot/initrd*") ], not_edit => 0 },
{ label => _("Read-write"), val => \$e->{'read-write'}, type => 'bool' }
);
@l = @l[0..2] unless $::expert;
@@ -396,8 +398,8 @@ sub writeandclean_ldsoconf {
my ($prefix) = @_;
my $file = "$prefix/etc/ld.so.conf";
output $file,
- grep { !m|^(/usr)?/lib$| } #- no need to have /lib and /usr/lib in ld.so.conf
- uniq cat_($file), "/usr/X11R6/lib\n";
+ grep { !m|^(/usr)?/lib(64)?$| } #- no need to have /lib and /usr/lib in ld.so.conf
+ uniq cat_($file), (if_(arch() =~ /x86_64/, "/usr/X11R6/lib64\n"), "/usr/X11R6/lib\n");
}
sub shells {
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 837908c57..30d3964fe 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -185,6 +185,7 @@ sub add_entry {
sub add_kernel {
my ($lilo, $version, $ext, $root, $v) = @_;
+ my $boot="/boot";
#- new versions of yaboot don't handle symlinks
my $ppcext = $ext;
@@ -192,16 +193,20 @@ sub add_kernel {
$ext = "-$version";
}
+ # If itanium architecture store kernel & initrd in /boot/efi
+ if (arch() =~ /ia64/) {
+ $boot="/boot/efi";
+ }
+
log::l("adding vmlinuz$ext as vmlinuz-$version");
- -e "$::prefix/boot/vmlinuz-$version" or log::l("unable to find kernel image $::prefix/boot/vmlinuz-$version"), return;
- my $image = "/boot/vmlinuz" . ($ext ne "-$version" &&
- symlinkf("vmlinuz-$version", "$::prefix/boot/vmlinuz$ext") ? $ext : "-$version");
+ -e "$::prefix$boot/vmlinuz-$version" or log::l("unable to find kernel image $::prefix$boot/vmlinuz-$version"), return;
+ my $image = "$boot/vmlinuz" . ($ext ne "-$version" && symlinkf("vmlinuz-$version", "$::prefix$boot/vmlinuz$ext") ? $ext : "-$version");
- my $initrd = "/boot/initrd-$version.img";
+ my $initrd = "$boot/initrd-$version.img";
mkinitrd($version, $initrd) or undef $initrd;
if ($initrd && $ext ne "-$version") {
- $initrd = "/boot/initrd$ext.img";
- symlinkf("initrd-$version.img", "$::prefix$initrd") or cp_af("$::prefix/boot/initrd-$version.img", "$::prefix$initrd");
+ $initrd = "$boot/initrd$ext.img";
+ symlinkf("initrd-$version.img", "$::prefix$initrd") or cp_af("$::prefix$boot/initrd-$version.img", "$::prefix$initrd");
}
my $label = $ext =~ /-(default)/ ? $1 : ($ext =~ /\d\./ ? sanitize_ver("linux$ext") : "linux$ext");
@@ -275,11 +280,17 @@ sub configure_entry {
my ($entry) = @_;
if ($entry->{type} eq 'image') {
my $specific_version;
+ my $boot="/boot/";
+
+ if (arch() =~ /ia64/) {
+ $boot="/boot/efi";
+ }
+
$entry->{kernel_or_dev} =~ /vmlinu.-(.*)/ and $specific_version = $1;
readlink("$::prefix/$entry->{kernel_or_dev}") =~ /vmlinu.-(.*)/ and $specific_version = $1;
if ($specific_version) {
- $entry->{initrd} or $entry->{initrd} = "/boot/initrd-$specific_version.img";
+ $entry->{initrd} or $entry->{initrd} = "$boot/initrd-$specific_version.img";
mkinitrd($specific_version, $entry->{initrd}) or undef $entry->{initrd};
}
}
@@ -296,6 +307,9 @@ sub dev2prompath { #- SPARC only
sub get_kernels_and_labels() {
my $dir = "$::prefix/boot";
+ if ( arch() =~ /ia64/ ) {
+ $dir = "$::prefix/boot/efi"; }
+
my @l = grep { /^vmlinuz-/ } all($dir);
my @kernels = grep { ! -l "$dir/$_" } @l;
@@ -409,16 +423,21 @@ sub suggest {
enablecdboot => 1,
useboot => $boot,
xfsroot => $xfsroot,
+ } : arch() =~ /ia64/ ?
+ {
+ default => "linux",
+ entries => [],
+ timeout => 5,
} :
{
bootUnsafe => $unsafe,
entries => [],
timeout => $onmbr && 10,
nowarn => 1,
- if_(arch() !~ /ia64/,
+ lba32 => 1,
boot => "/dev/" . ($onmbr ? $hds->[0]{device} : fsedit::get_root($fstab, 'boot')->{device}),
map => "/boot/map",
- ),
+ install => "/boot/boot.b",
});
if (!$lilo->{message} || $lilo->{message} eq "1") {
@@ -525,9 +544,10 @@ wait %d seconds for default boot.
my %l = (
yaboot => to_bool(arch() =~ /ppc/),
silo => to_bool(arch() =~ /sparc/),
- lilo => to_bool(arch() !~ /sparc|ppc/) && !isLoopback(fsedit::get_root($fstab)),
- grub => to_bool(arch() !~ /sparc|ppc/ && !isRAID(fsedit::get_root($fstab))),
- loadlin => to_bool(arch() !~ /sparc|ppc/) && -e "/initrd/loopfs/lnx4win",
+ elilo => to_bool(arch() =~ /ia64/),
+ lilo => to_bool(arch() !~ /sparc|ppc|ia64/) && !isLoopback(fsedit::get_root($fstab)),
+ grub => to_bool(arch() !~ /sparc|ppc|x86_64|ia64/ && !isRAID(fsedit::get_root($fstab))),
+ loadlin => to_bool(arch() !~ /sparc|ppc|x86_64|ia64/) && -e "/initrd/loopfs/lnx4win",
);
unless ($lilo->{methods}) {
$lilo->{methods} ||= { map { $_ => 1 } grep { $l{$_} } keys %l };
@@ -872,6 +892,88 @@ sub install_lilo {
unlink "$::prefix/tmp/.error";
}
+sub write_elilo_conf {
+ my ($lilo, $fstab, $hds) = @_;
+ my $prefix = $::prefix ;
+ $lilo->{prompt} = $lilo->{timeout};
+
+ my $file2fullname = sub {
+ my ($file) = @_;
+ $file =~ s|/boot/efi/||;
+ $file
+ };
+
+ {
+ local *F;
+ local $\ = "\n";
+ my $f = "$prefix/boot/efi/elilo.conf";
+
+ open F, ">$f" or die "cannot create lilo config file: $f";
+ log::l("writing elilo config to $f");
+
+ $lilo->{$_} and print F "$_=$lilo->{$_}" foreach qw(default append);
+ $lilo->{$_} and print F $_ foreach qw(prompt);
+ print F "timeout=", round(10 * $lilo->{timeout}) if $lilo->{timeout};
+
+ foreach (@{$lilo->{entries}}) {
+ print F "$_->{type}=", $file2fullname->($_->{kernel_or_dev});
+ my $label = substr($_->{label}, 0, 15);
+ $label =~ s/\s/_/g;
+ print F "\tlabel=$label";
+ print F "\troot=$_->{root}";
+ print F "\tinitrd=", $file2fullname->($_->{initrd}) if $_->{initrd};
+ print F "\tappend=\"$_->{append}\"" if $_->{append};
+ print F "\tread-only" if !$_->{'read-write'};
+ }
+ }
+}
+
+
+sub install_efi_boot_menu {
+ my ($lilo, $fstab, $hds, $prefix) = @_;
+
+ die "/proc filesystem is not mounted, nvram will not be updated\n" if
+ ( ! -f "/proc/uptime" );
+
+ die "/proc/efi/vars not available, nvram will not be updated\n" if
+ ( ! -d "/proc/efi/vars" );
+
+
+ my $part = fsedit::mntpoint2part "/boot/efi", $fstab;
+ (my ($bootdisk, $bootpart) = ($1, $2)) = ("/dev/" . $part->{device}) =~ m|(/dev/.+)([0-9]+)|;
+ # print STDERR "DEBUG: boot-disk = $bootdisk\n";
+ # print STDERR "DEBUG: boot-partition = $bootpart\n";
+ die "empty bootdisk or bootpart variables" if !($bootdisk) || !($bootpart);
+
+
+ my $os_vendor = "Mandrake Linux";
+ my $efibootmgr = "/usr/sbin/efibootmgr";
+
+ die "failed to retrieve current EFI boot entries\n" unless
+ (open F, "$efibootmgr|");
+ while (<F>) {
+ if (/Boot(\w+).*$os_vendor/) {
+ die "efibootmgr could not remove entry $1\n" if
+ (system("$efibootmgr -b $1 -B >/dev/null"));
+ }
+ }
+ close F;
+
+ die "efibootmgr could not add entry for $bootdisk$bootpart\n" if
+ (system("$efibootmgr -c -d $bootdisk -p $bootpart -w -L \"$os_vendor\""));
+}
+
+sub install_elilo {
+ my ($elilo, $fstab, $hds, $prefix) = @_;
+ write_elilo_conf($elilo, $fstab, $hds, $prefix);
+ log::l("Installing elilo boot loader...");
+ $::testing and return;
+ install_efi_boot_menu($elilo, $fstab, $hds, $prefix);
+ unlink "$prefix/tmp/.error";
+}
+
+
+
sub dev2bios {
my ($hds, $where) = @_;
$where =~ s|/dev/||;
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index c60e356c2..383844143 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -478,7 +478,15 @@ sub get_mac_generation() {
return "Unknown Generation";
}
-sub hasSMP { c::detectSMP() }
+sub hasSMP {
+ # Much simpler if we have APIC/ACPI stuff
+ foreach (syslog()) {
+ my $nprocs = (m/(^Processors: (\d+)|(\d+) CPUs avail)/)[1] or next;
+ return $nprocs > 1 ? 1 : 0;
+ }
+ c::detectSMP()
+}
+
sub hasPCMCIA { $::o->{pcmcia} } #- because /proc/pcmcia seems not to be present on 2.4 at least (or use /var/run/stab)
#- try to detect a laptop, we assume pcmcia service is an indication of a laptop or
diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec
index 5e84c78e8..ab652f050 100644
--- a/perl-install/drakxtools.spec
+++ b/perl-install/drakxtools.spec
@@ -1,7 +1,7 @@
Summary: The drakxtools (XFdrake, diskdrake, keyboarddrake, mousedrake...)
Name: drakxtools
Version: 1.1.9
-Release: 53mdk
+Release: 56mdk
Url: http://www.linux-mandrake.com/en/drakx.php3
Source0: %name-%version.tar.bz2
License: GPL
@@ -147,7 +147,8 @@ hardware classes.
%setup -q
%build
-%make rpcinfo-flushed ddcprobe serial_probe
+%make CFLAGS="$RPM_OPT_FLAGS" rpcinfo-flushed
+%make ddcprobe serial_probe
%make
%install
@@ -288,6 +289,16 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_datadir/harddrak
%config(noreplace) %_sysconfdir/logrotate.d/drakxtools-http
%changelog
+* Thu Apr 24 2003 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 1.1.9-56mdk
+- Add XFS support to AMD64
+
+* Thu Apr 17 2003 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 1.1.9-55mdk
+- Fix SMP detection again
+- Fix lsnetdrake on x86-64
+
+* Mon Apr 14 2003 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com> 1.1.9-54mdk
+- Move to R9_0-64bit-branch
+
* Fri Sep 20 2002 Thierry Vignaud <tvignaud@mandrakesoft.com> 1.1.9-53mdk
- remove useless warnings from harddrake
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 7eaf61711..7c68da790 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -595,7 +595,7 @@ sub real_format_part {
format_jfs($dev, @options);
} elsif (isDos($part)) {
format_dos($dev, @options);
- } elsif (isWin($part)) {
+ } elsif (isWin($part) || isEfi($part)) {
format_dos($dev, @options, '-F', 32);
} elsif (isThisFs('hfs', $part)) {
format_hfs($dev, @options, '-l', "Untitled");
@@ -737,7 +737,12 @@ sub umount {
my ($mntpoint) = @_;
$mntpoint =~ s|/$||;
log::l("calling umount($mntpoint)");
- syscall_('umount', $mntpoint) or die _("error unmounting %s: %s", $mntpoint, "$!");
+
+ # SYS_umount is not a valid sycall on modern kernels
+ (arch() =~ /x86_64/
+ ? syscall_('umount2', $mntpoint, 0)
+ : syscall_('umount', $mntpoint)
+ ) or die _("error unmounting %s: %s", $mntpoint, "$!");
substInFile { $_ = '' if /(^|\s)$mntpoint\s/ } '/etc/mtab'; #- don't care about error, if we can't read, we won't manage to write... (and mess mtab)
}
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 4c2c43316..e68ea6e33 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -38,7 +38,7 @@ use fs;
);
foreach (values %suggestions) {
if (arch() =~ /ia64/) {
- @$_ = ({ mntpoint => "/boot/efi", size => 50 << 11, type => 0xb, ratio => 1, maxsize => 150 << 11 }, @$_);
+ @$_ = ({ mntpoint => "/boot/efi", size => 50 << 11, type => 0xef, ratio => 1, maxsize => 150 << 11 }, @$_);
}
}
diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm
index 0da8974fa..91927044e 100644
--- a/perl-install/harddrake/data.pm
+++ b/perl-install/harddrake/data.pm
@@ -12,7 +12,7 @@ my @devices = detect_devices::probeall(1);
# Update me each time you handle one more devices class (aka configurator)
sub unknown {
- grep { ($_->{media_type} !~ /tape|SERIAL_(USB|SMBUS)|Printer|DISPLAY|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|STORAGE_(IDE|SCSI|OTHER)|BRIDGE|NETWORK/) && ($_->{driver} ne 'scanner') && $_->{type} ne 'network' && $_->{driver} !~ /Mouse:USB|/} @devices;
+ grep { ($_->{media_type} !~ /tape|SERIAL_(USB|SMBUS)|Printer|DISPLAY|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|STORAGE_(IDE|SCSI|OTHER)|BRIDGE|NETWORK/) && ($_->{driver} ne 'scanner') && $_->{type} ne 'network' && $_->{driver} !~ /Mouse:USB/} @devices;
}
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 04f3279a0..8d838a790 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -246,8 +246,8 @@ sub spawnShell {
ioctl(STDIN, c::TIOCSCTTY(), 0) or warn "could not set new controlling tty: $!";
- my $busybox = "/usr/bin/busybox";
- exec { -e $busybox ? $busybox : "/bin/sh" } "/bin/sh" or log::l("exec of /bin/sh failed: $!");
+ my ($busybox, $bash) = ("/usr/bin/busybox", "/usr/bin/bash");
+ exec { -x $busybox ? $busybox : -x $bash ? $bash : "/bin/sh" } "/bin/sh" or log::l("exec of /bin/sh failed: $!");
}
sub getAvailableSpace {
@@ -379,7 +379,7 @@ sub setDefaultPackages {
$o->{compssUsersChoice}{USB} = 1 if modules::get_probeall("usb-interface");
$o->{compssUsersChoice}{PCMCIA} = 1 if detect_devices::hasPCMCIA();
$o->{compssUsersChoice}{HIGH_SECURITY} = 1 if $o->{security} > 3;
- $o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && (availableRamMB() > 800) && (arch() !~ /ia64/);
+ $o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && (availableRamMB() > 800) && (arch() !~ /ia64|x86_64/);
$o->{compssUsersChoice}{SMP} = 1 if detect_devices::hasSMP();
$o->{compssUsersChoice}{CDCOM} = 1 if grep { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}};
$o->{compssUsersChoice}{'3D'} = 1 if
@@ -776,6 +776,7 @@ sub getAndSaveInstallFloppy {
cp_af("$postinstall_rpms/auto_install.img", $where);
} else {
my $image = cat_("/proc/cmdline") =~ /pcmcia/ ? "pcmcia" :
+ arch() =~ /ia64|ppc/ ? "all" : #- we only use all.img there
${{ disk => 'hd', cdrom => 'cdrom', ftp => 'network', nfs => 'network', http => 'network' }}{$o->{method}};
$image .= arch() =~ /sparc64/ && "64"; #- for sparc64 there are a specific set of image.
getAndSaveFile("images/$image.img", $where) or log::l("failed to write Install Floppy ($image.img) to $where"), return;
@@ -1041,11 +1042,23 @@ sub getHds {
$o->{fstab} = [ fsedit::get_all_fstab($all_hds) ];
fs::merge_info_from_mtab($o->{fstab});
+ #- Search for EFI partitions
+ my @efi = grep { isEfi($_) && isFat({ type => fsedit::typeOfPart($_->{device}) }) } @{$o->{fstab}};
+ log::l("efi parts: ", join ",", map { $_->{device} } @efi) if @efi;
+ if (@efi == 1) {
+ $efi[0]{mntpoint} = "/boot/efi";
+ } else {
+ my $v = 0;
+ foreach (@efi) {
+ $_->{mntpoint} = $_->{unsafeMntpoint} = "/mnt/efi_" . ($v ? $v+1 : '');
+ $v = $v + 1;
+ }
+ }
+
my @win = grep { isFat($_) && isFat({ type => fsedit::typeOfPart($_->{device}) }) } @{$o->{fstab}};
log::l("win parts: ", join ",", map { $_->{device} } @win) if @win;
if (@win == 1) {
- #- Suggest /boot/efi on ia64.
- $win[0]{mntpoint} = arch() =~ /ia64/ ? "/boot/efi" : "/mnt/windows";
+ $win[0]{mntpoint} = "/mnt/windows";
} else {
my %w; foreach (@win) {
my $v = $w{$_->{device_windobe}}++;
diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm
index 89517dffb..fe8ae2fe9 100644
--- a/perl-install/install_gtk.pm
+++ b/perl-install/install_gtk.pm
@@ -7,6 +7,7 @@ use my_gtk qw(:helpers :wrappers);
use common;
use lang;
use devices;
+use log;
#-#####################################################################################
#-INTERN CONSTANT
@@ -188,21 +189,18 @@ sub init_sizes() {
#------------------------------------------------------------------------------
sub createXconf {
- my ($file, $mouse_type, $mouse_dev, $wacom_dev) = @_;
+ my ($file, $mouse_type, $mouse_dev, $wacom_dev, $Driver) = @_;
$mouse_type = 'IMPS/2' if $mouse_type eq 'ExplorerPS/2';
- devices::make("/dev/kbd") if arch() =~ /^sparc/; #- used by Xsun style server.
symlinkf(devices::make($mouse_dev), "/dev/mouse");
#- needed for imlib to start on 8-bit depth visual.
symlink("/tmp/stage2/etc/imrc", "/etc/imrc");
symlink("/tmp/stage2/etc/im_palette.pal", "etc/im_palette.pal");
-if (arch() =~ /^ia64/) {
- require Xconfig::card;
- my ($card) = Xconfig::card::probe();
- Xconfig::card::add_to_card__using_Cards($card, $card->{type}) if $card && $card->{type};
- output($file, sprintf(<<'END', $mouse_type, $card->{driver}));
+if ($Driver) {
+ log::l("Mouse type is $mouse_type and Card driver is " . $card->{Driver});
+ output($file, sprintf(<<'END', $mouse_type, $Driver));
Section "Files"
FontPath "/usr/X11R6/lib/X11/fonts:unscaled"
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index 09ce1dc09..06a4b924c 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -36,7 +36,6 @@ sub new($$) {
unless ($::testing) {
if ($ENV{DISPLAY} eq ":0" && !$::live) {
my $f = "/tmp/Xconf";
- install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{mouse}{wacom}[0]);
devices::make("/dev/kbd");
local (*T1, *T2);
@@ -44,14 +43,16 @@ sub new($$) {
open T2, ">/dev/tty6";
my $launchX = sub {
+ my ($server, $Driver) = @_;
my $ok = 1;
my $xpmac_opts = cat_("/proc/cmdline");
+ install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{mouse}{wacom}[0], $Driver);
unless (-d "/var/log") { mkdir("/var/log") }
local $SIG{CHLD} = sub { $ok = 0 if waitpid(-1, c::WNOHANG()) > 0 };
unless (fork) {
- exec $_[0], (arch() =~ /^sparc/ || arch() eq "ppc" ? () : ("-kb")), "-dpms","-s" ,"240",
- ($_[0] =~ /Xpmac/ ? $xpmac_opts !~ /ofonly/ ? ("-mode", "17", "-depth", "32") : ("-mach64"):()),
- ($_[0] =~ /Xsun/ || $_[0] =~ /Xpmac/ ? ("-fp", "/usr/X11R6/lib/X11/fonts:unscaled") :
+ exec $server, (arch() =~ /^sparc/ || arch() eq "ppc" ? () : ("-kb")), "-dpms","-s" ,"240",
+ ($server =~ /Xpmac/ ? $xpmac_opts !~ /ofonly/ ? ("-mode", "17", "-depth", "32") : ("-mach64"):()),
+ ($server =~ /Xsun/ || $server =~ /Xpmac/ ? ("-fp", "/usr/X11R6/lib/X11/fonts:unscaled") :
("-allowMouseOpenFail", "-xf86config", $f)) or exit 1;
}
foreach (1..60) {
@@ -77,8 +78,10 @@ sub new($$) {
if (/Mach64/) { @servers = qw(Mach64) }
elsif (/Permedia2/) { @servers = qw(3DLabs) }
else { @servers = qw(Xsun24) }
- } elsif (arch() =~ /ia64/) {
- @servers = 'XFree86';
+ } elsif (arch() =~ /ia64|x86_64/) {
+ require Xconfig::card;
+ my ($card) = Xconfig::card::probe();
+ @servers = map { if_($_, "Driver:$_") } $card && $card->{Driver}, 'fbdev';
} elsif (arch() eq "ppc") {
@servers = qw(Xpmac);
}
@@ -87,6 +90,7 @@ sub new($$) {
log::l("Trying with server $_");
my $dir = "/usr/X11R6/bin";
my $prog = /Xsun|Xpmac|XFree86/ ? $_ : "XF86_$_";
+ my ($prog, $Driver) = /Driver:(.*)/ ? ('XFree86', $1) : /Xsun|Xpmac|Xnest/ ? $_ : "XF86_$_";
unless (-x "$dir/$prog") {
unlink $_ foreach glob_("$dir/X*");
install_any::getAndSaveFile("Mandrake/mdkinst$dir/$prog", "$dir/$prog") or die "failed to get server $prog: $!";
@@ -95,11 +99,11 @@ sub new($$) {
if (/FB/) {
!$o->{vga16} && $o->{allowFB} or next;
- $o->{allowFB} = &$launchX($prog) #- keep in mind FB is used.
+ $o->{allowFB} = &$launchX($prog, $Driver) #- keep in mind FB is used.
and goto OK;
} else {
$o->{vga16} = 1 if /VGA16/;
- &$launchX($prog) and goto OK;
+ &$launchX($prog, $Driver) and goto OK;
}
}
return undef;
diff --git a/perl-install/list.sparc b/perl-install/list.sparc
deleted file mode 100644
index 448e0b63e..000000000
--- a/perl-install/list.sparc
+++ /dev/null
@@ -1,74 +0,0 @@
-/bin/ash
-/bin/cpio
-/lib/libnss_nis.so.2
-/lib/libnss_files.so.2
-/lib/libnss_dns.so.2
-/lib/libresolv.so.2
-/etc/protocols
-/sbin/fdisk
-/sbin/ifport
-/sbin/insmod
-/sbin/mkraid
-/sbin/rmmod
-/sbin/mkdosfs
-/sbin/mke2fs
-/sbin/raidstart
-/usr/bin/bzip2
-/usr/bin/perl
-/usr/lib/libimlib-png.so
-/usr/lib/gtk/themes/engines/libpixmap.so
-/usr/lib/gtk/themes/engines/libpixmap.la
-/usr/lib/libimlib-png.so
-/usr/lib/perl5/5.00503/AutoLoader.pm
-/usr/lib/perl5/5.00503/Carp.pm
-/usr/lib/perl5/5.00503/Data/Dumper.pm
-/usr/lib/perl5/5.00503/Exporter.pm
-/usr/lib/perl5/5.00503/FileHandle.pm
-/usr/lib/perl5/5.00503/SelectSaver.pm
-/usr/lib/perl5/5.00503/SelfLoader.pm
-/usr/lib/perl5/5.00503/Symbol.pm
-/usr/lib/perl5/5.00503/Time/Local.pm
-/usr/lib/perl5/5.00503/dumpvar.pl
-/usr/lib/perl5/5.00503/sparc-linux/Config.pm
-/usr/lib/perl5/5.00503/sparc-linux/DynaLoader.pm
-/usr/lib/perl5/5.00503/sparc-linux/Fcntl.pm
-/usr/lib/perl5/5.00503/sparc-linux/auto/Fcntl/Fcntl.bs
-/usr/lib/perl5/5.00503/sparc-linux/auto/Fcntl/Fcntl.so
-/usr/lib/perl5/5.00503/sparc-linux/IO/File.pm
-/usr/lib/perl5/5.00503/sparc-linux/IO/Handle.pm
-/usr/lib/perl5/5.00503/sparc-linux/IO/Seekable.pm
-/usr/lib/perl5/5.00503/sparc-linux/IO/Socket.pm
-/usr/lib/perl5/5.00503/sparc-linux/Socket.pm
-/usr/lib/perl5/5.00503/sparc-linux/_h2ph_pre.ph
-/usr/lib/perl5/5.00503/sparc-linux/asm/unistd.ph
-/usr/lib/perl5/5.00503/sparc-linux/asm-sparc/unistd.ph
-/usr/lib/perl5/5.00503/sparc-linux/asm-sparc64/unistd.ph
-/usr/lib/perl5/5.00503/sparc-linux/auto/Data/Dumper/Dumper.bs
-/usr/lib/perl5/5.00503/sparc-linux/auto/Data/Dumper/Dumper.so
-/usr/lib/perl5/5.00503/sparc-linux/auto/IO/IO.so
-/usr/lib/perl5/5.00503/sparc-linux/auto/Socket/Socket.bs
-/usr/lib/perl5/5.00503/sparc-linux/auto/Socket/Socket.so
-/usr/lib/perl5/5.00503/sparc-linux/bits/syscall.ph
-/usr/lib/perl5/5.00503/sparc-linux/sys/syscall.ph
-/usr/lib/perl5/5.00503/sparc-linux/syscall.ph
-/usr/lib/perl5/5.00503/lib.pm
-/usr/lib/perl5/5.00503/overload.pm
-/usr/lib/perl5/5.00503/strict.pm
-/usr/lib/perl5/5.00503/vars.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Gtk.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Gtk/Types.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Net/Cmd.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Net/Config.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Net/FTP.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Net/FTP/A.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Net/FTP/I.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Net/FTP/dataconn.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/Net/Netrc.pm
-/usr/lib/perl5/site_perl/5.005/sparc-linux/auto/Gtk/Gtk.bs
-/usr/lib/perl5/site_perl/5.005/sparc-linux/auto/Gtk/Gtk.so
-/usr/lib/rpm/rpmrc
-/usr/X11R6/bin/XF86_FBDev
-/usr/X11R6/bin/XF86_Mach64
-/usr/X11R6/bin/Xsun
-/usr/X11R6/bin/xmodmap
-/usr/X11R6/lib/modules/xf86Wacom.so
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index c7342f0e7..242c7a662 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @important_types @important_types2 @fie
@ISA = qw(Exporter);
%EXPORT_TAGS = (
- types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isThisFs isTrueFS isSwap isDos isWin isFat isSunOS isOtherAvailableFS isPrimary isRawLVM isRawRAID isRAID isLVM isNT isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isApplePartMap isLoopback isMounted isBusy isSpecial maybeFormatted isApple isAppleBootstrap) ],
+ types => [ qw(type2name type2fs name2type fs2type isExtended isExt2 isThisFs isTrueFS isSwap isDos isWin isFat isSunOS isOtherAvailableFS isPrimary isRawLVM isRawRAID isRAID isLVM isNT isMountableRW isNonMountable isPartOfLVM isPartOfRAID isPartOfLoopback isApplePartMap isLoopback isMounted isBusy isSpecial maybeFormatted isApple isAppleBootstrap isEfi) ],
);
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
@@ -19,6 +19,7 @@ use log;
@important_types = ('Linux native', 'Linux swap',
if_(arch() =~ /i.86/, 'Journalised FS: ext3', 'Journalised FS: ReiserFS', 'Journalised FS: JFS', 'Journalised FS: XFS', 'DOS FAT16', 'FAT32'),
if_(arch() =~ /ia64/, 'Journalised FS: ext3', 'Journalised FS: ReiserFS', 'Journalised FS: XFS', 'FAT32'),
+ if_(arch() =~ /x86_64/, 'Journalised FS: ext3', 'Journalised FS: ReiserFS', 'FAT32'),
if_(arch() =~ /ppc/, 'Journalised FS: ext3', 'Journalised FS: ReiserFS', 'Journalised FS: JFS', 'Journalised FS: XFS', 'Apple HFS Partition', 'Apple Bootstrap'));
@important_types2 = ('Linux RAID', 'Linux Logical Volume Manager partition');
@@ -46,6 +47,9 @@ if_(arch() =~ /^ppc/,
0x183 => 'Journalised FS: ReiserFS',
0x283 => 'Journalised FS: XFS',
0x483 => 'Journalised FS: ext3',
+), if_(arch() =~ /^x86_64/,
+ 0x183 => 'Journalised FS: ReiserFS',
+ 0x483 => 'Journalised FS: ext3',
), if_(arch() =~ /^sparc/,
0x1 => 'SunOS boot',
0x2 => 'SunOS root',
@@ -199,6 +203,7 @@ arch() !~ /sparc/ ? (
0x1e => 'vfat',
0x82 => 'swap',
0x83 => 'ext2',
+ 0xef => 'vfat',
0x183=> 'reiserfs',
0x283=> 'xfs',
0x383=> 'jfs',
@@ -226,6 +231,7 @@ sub name2type {
/0x(.*)/ ? hex $1 : $types_rev{$_} || $_;
}
+sub isEfi { arch() =~ /ia64/ && $_[0]{type} == 0xef }
sub isWholedisk { arch() =~ /^sparc/ && $_[0]{type} == 5 }
sub isExtended { arch() !~ /^sparc/ && ($_[0]{type} == 5 || $_[0]{type} == 0xf || $_[0]{type} == 0x85) }
sub isRawLVM { $_[0]{type} == 0x8e }
@@ -244,7 +250,7 @@ sub isHiddenMacPart { defined $_[0]{isMap} }
sub isThisFs { type2fs($_[1]) eq $_[0] }
sub isTrueFS { member(type2fs($_[0]), qw(ext2 reiserfs xfs jfs ext3)) }
-sub isOtherAvailableFS { isFat($_[0]) || isSunOS($_[0]) || isThisFs('hfs', $_[0]) || isThisFs('ntfs', $_[0]) } #- other OS that linux can access its filesystem
+sub isOtherAvailableFS { isEfi($_[0]) || isFat($_[0]) || isSunOS($_[0]) || isThisFs('hfs', $_[0]) || isThisFs('ntfs', $_[0]) } #- other OS that linux can access its filesystem
sub isMountableRW { (isTrueFS($_[0]) || isOtherAvailableFS($_[0])) && !isThisFs('ntfs', $_[0]) }
sub isNonMountable { isRawRAID($_[0]) || isRawLVM($_[0]) }
diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm
index d94d0886b..29bbfd1f5 100644
--- a/perl-install/printerdrake.pm
+++ b/perl-install/printerdrake.pm
@@ -13,6 +13,9 @@ use printer;
1;
+#- Define library name where plugins and libraries are
+my $lib = arch() =~ /x86_64/ ? "lib64" : "lib";
+
sub choose_printer_type {
my ($printer, $in) = @_;
$in->set_help('configurePrinterConnected') if $::isInstall;
@@ -1353,7 +1356,7 @@ sub setup_common {
/usr/bin/xscanimage
/usr/bin/xsane
/etc/sane.d/dll.conf
- /usr/lib/libsane-hpoj.so.1),
+ /usr/$lib/libsane-hpoj.so.1),
(printer::files_exist
('/usr/bin/gimp') ?
'/usr/bin/xsane-gimp' :
@@ -2747,7 +2750,7 @@ sub install_spooler {
my $w = $in->wait_message(_("Printerdrake"),
_("Checking installed software..."));
if ((!$::testing) &&
- (!printer::files_exist((qw(/usr/lib/cups/cgi-bin/printers.cgi
+ (!printer::files_exist((qw(/usr/$lib/cups/cgi-bin/printers.cgi
/sbin/ifconfig
/usr/bin/xpp),
($::expert ?
@@ -2793,7 +2796,7 @@ sub install_spooler {
_("Checking installed software..."));
# "lpr" conflicts with "LPRng", remove "LPRng"
if ((!$::testing) &&
- (printer::files_exist((qw(/usr/lib/filters/lpf))))) {
+ (printer::files_exist((qw(/usr/$lib/filters/lpf))))) {
my $w = $in->wait_message(_("Printerdrake"),
_("Removing LPRng..."));
$in->do_pkgs->remove_nodeps('LPRng');
@@ -2838,7 +2841,7 @@ sub install_spooler {
$in->do_pkgs->remove_nodeps('lpr');
}
if ((!$::testing) &&
- (!printer::files_exist((qw(/usr/lib/filters/lpf
+ (!printer::files_exist((qw(/usr/$lib/filters/lpf
/usr/sbin/lpd
/sbin/ifconfig
/usr/bin/gpr
@@ -3002,7 +3005,7 @@ sub main {
/usr/bin/scli
),
(printer::files_exist("/usr/bin/gimp") ?
- "/usr/lib/gimp/1.2/plug-ins/print" : ())
+ "/usr/$lib/gimp/1.2/plug-ins/print" : ())
)))) {
$in->do_pkgs->install('foomatic','printer-utils','printer-testpages','nmap','scli',
if_($in->do_pkgs->is_installed('gimp'), 'gimpprint'));
diff --git a/perl-install/proxy.pm b/perl-install/proxy.pm
index b01a7b9bf..5239356b2 100644
--- a/perl-install/proxy.pm
+++ b/perl-install/proxy.pm
@@ -11,7 +11,7 @@ use c;
sub main {
my ($prefix, $in) = @_;
my $proxy_cfg = {};
- my $config_file = "$prefix/usr/lib/wgetrc";
+ my $config_file = "$prefix/etc/wgetrc";
# grab current config
foreach (cat_($config_file)) {
diff --git a/perl-install/share/compssList b/perl-install/share/compssList
deleted file mode 100644
index 36b0f4a44..000000000
--- a/perl-install/share/compssList
+++ /dev/null
@@ -1,1665 +0,0 @@
- normal server developer
-
-AVLTree-devel 0 0 0
-AfterStep 22 0 53
-AfterStep-APPS 22 0 35
-Apache-ASP -99 0 -99
-ApacheJServ -99 0 -99
-Apple-StyleWriter-printer-driver__lpstyl 0 0 0
-Aurora 81 -1 -1
-BasiliskII 35 0 10
-BasiliskII-sheepnet 33 0 8
-BitchX 43 0 15
-C++2LaTeX 0 0 30
-Canon-CaPSL-printer-driver__cjet 0 0 0
-ClanLib 32 0 32
-ClanLib-devel 0 0 25
-ClanLib-docs 0 0 25
-ClanLib-gl 0 0 0
-ClanLib-magick 0 0 0
-ClanLib-mikmod 0 0 0
-ClanLib-png 0 0 0
-Device3Dfx -1 -1 -1
-DrakConf 84 84 84
-drakprofile 50 0 50
-draksync 50 0 50
-DrakeLogo 20 0 0
-ElectricFence 10 0 66
-Epplets 57 0 53
-Eterm 57 0 53
-Eterm-devel 0 0 0
-FaxMail 30 0 0
-FileRunner 45 0 25
-FreeWnn -20 -20 -20
-FreeWnn-devel -70 -60 -40
-GConf 0 0 0
-GConf-devel 0 0 40
-GXedit 40 0 55
-Glide_V2 -1 -1 -1
-Glide_V2-devel -1 -1 -1
-Glide_V3 -1 -1 -1
-Glide_V3-DRI -1 -1 -1
-Glide_V3-DRI-devel -1 -1 -1
-Glide_V3-devel -1 -1 -1
-Glide_V5 -1 -1 -1
-Glide_V5-devel -1 -1 -1
-HTML-Embperl 0 40 40
-Hermes 32 0 42
-Hermes-devel 0 0 35
-ImageMagick 56 5 60
-ImageMagick-devel 10 0 60
-ImageMagick-lib 0 0 0
-MAKEDEV 91 91 91
-MandrakeUpdate 82 0 80
-Mesa 30 0 70
-Mesa-common 30 0 70
-Mesa-common-devel 0 0 70
-Mesa-demos 10 0 15
-MySQL 2 55 15
-MySQL-bench 2 50 10
-MySQL-client 2 52 11
-MySQL-devel 0 0 15
-MySQL-shared 2 50 10
-ORBit 0 0 55
-ORBit-devel 10 0 55
-SDL 50 0 25
-SDL-devel 0 0 25
-SDL_image 0 0 25
-SDL_image-devel 0 0 25
-SDL_mixer 0 0 25
-SDL_mixer-devel 0 0 25
-SDL_net 0 0 25
-SDL_net-devel 0 0 25
-SDL_ttf 0 0 25
-SDL_ttf-devel 0 0 25
-SVGATextMode 0 0 0
-SmallEiffel 0 0 30
-SysVinit 15 52 45
-TiMidity++ 51 0 54
-WMRack 40 0 32
-WindowMaker 40 0 57
-WindowMaker-devel 0 0 30
-WsLib-devel 0 0 0
-X11R6-contrib 55 0 47
-XFree86 91 0 81
-XFree86-100dpi-fonts 56 0 30
-XFree86-3DLabs -30 -30 -30
-XFree86-75dpi-fonts 91 0 81
-XFree86-8514 -30 -30 -30
-XFree86-AGX -30 -30 -30
-XFree86-FBDev -30 -30 -30
-XFree86-I128 -30 -30 -30
-XFree86-ISO8859-2 -20 -30 -20
-XFree86-ISO8859-2-100dpi-fonts -20 -30 -20
-XFree86-ISO8859-2-75dpi-fonts -20 -30 -20
-XFree86-ISO8859-2-Type1-fonts -20 -30 -20
-XFree86-ISO8859-9 -20 -30 -20
-XFree86-ISO8859-9-100dpi-fonts -20 -30 -20
-XFree86-ISO8859-9-75dpi-fonts -20 -30 -20
-XFree86-Mach32 -30 -30 -30
-XFree86-Mach64 -30 -30 -30
-XFree86-Mach8 -30 -30 -30
-XFree86-Mono -30 -30 -30
-XFree86-P9000 -30 -30 -30
-XFree86-S3 -30 -30 -30
-XFree86-S3V -30 -30 -30
-XFree86-SVGA -30 -30 -30
-XFree86-VGA16 -30 -30 -30
-XFree86-W32 -30 -30 -30
-XFree86-Xnest 0 0 55
-XFree86-Xvfb 0 0 15
-XFree86-cyrillic-fonts -20 -30 -20
-XFree86-devel 12 0 55
-XFree86-doc -30 -30 -30
-XFree86-glide-module -2 -2 -2
-XFree86-libs 10 0 0
-XFree86-server -30 -30 -30
-XFree86-server-common -30 -30 -30
-XFree86-static-libs 0 0 20
-XFree86-xfs 0 0 0
-XaoS 40 0 25
-XaoS-aalib 0 0 0
-XaoS-svgalib 0 0 0
-Xaw3d 20 0 70
-Xaw3d-devel 10 0 60
-Zope 0 15 30
-Zope-components 0 15 30
-Zope-core 0 15 30
-Zope-pcgi 0 15 30
-Zope-services 0 15 30
-Zope-zpublisher 0 15 30
-Zope-zserver 0 15 30
-Zope-ztemplates 0 15 30
-aalib 25 0 15
-aalib-devel 0 0 25
-abisuite 59 0 45
-acon -10 -10 -10
-acpid 0 0 0
-adjtimex 22 35 87
-adns 30 30 30
-adns-devel 0 0 30
-aktion 66 0 15
-alsa 0 0 0
-alsa-lib 0 0 0
-alsa-lib-devel 0 0 20
-alsa-source 0 0 0
-alsa-utils 0 0 0
-alsaplayer 0 0 0
-am-utils 0 25 19
-ami -20 -20 -20
-ami-gnome -20 -20 -20
-anacron 85 70 85
-anonftp 0 86 13
-apache -99 80 -99
-apache-common -99 0 -99
-apache-devel -99 0 -99
-apache-manual -99 40 -99
-apache-mod_perl -99 85 -99
-apache-mod_perl-devel -99 0 -99
-apache-suexec -99 75 -99
-apcupsd -1 -1 -1
-apmd -1 -1 -1
-apmd-devel -1 -1 -1
-app-defaults-be -30 -30 -30
-app-defaults-cs -30 -30 -30
-app-defaults-ga -30 -30 -30
-app-defaults-ru -30 -30 -30
-app-defaults-th -30 -30 -30
-app-defaults-uk -30 -30 -30
-arpwatch 0 50 0
-ash 10 10 10
-aspell 49 15 22
-aspell-ca -30 -30 -30
-aspell-cs -30 -30 -30
-aspell-da -30 -30 -30
-aspell-de -30 -30 -30
-aspell-de_CH -30 -30 -30
-aspell-devel 0 0 10
-aspell-en -30 -30 -30
-aspell-en_CA -30 -30 -30
-aspell-en_GB -30 -30 -30
-aspell-eo -30 -30 -30
-aspell-es -30 -30 -30
-aspell-fr -30 -30 -30
-aspell-it -30 -30 -30
-aspell-nl -30 -30 -30
-aspell-no -30 -30 -30
-aspell-pl -30 -30 -30
-aspell-sv -30 -30 -30
-at 42 96 94
-aterm 17 0 13
-audiofile 25 0 26
-audiofile-devel 10 0 26
-aumix 79 0 79
-auth_ldap 5 75 20
-autoconf 15 0 84
-autofs 48 45 50
-autoirpm -60 -60 -60
-autologin 82 0 82
-automake 15 0 84
-awesfx 20 0 13
-basesystem 0 0 0
-bash 0 0 0
-bash-doc 35 50 71
-bash1 15 5 13
-bc 40 25 25
-bdflush 0 0 0
-bind 0 75 0
-bind-devel 0 0 0
-bind-utils 25 35 70
-binutils 47 0 87
-bison 10 0 80
-blackbox 30 0 45
-blt 10 0 75
-bluefish 60 0 60
-boa -99 -99 -99
-bonnie 5 45 25
-bonobo 20 0 20
-bonobo-devel 0 0 35
-bootparamd 20 78 0
-bug-buddy 0 0 20
-byacc 16 0 80
-bzflag -1 -1 -1
-bzip2 41 85 75
-caching-nameserver 0 70 0
-cbb 55 0 13
-cdecl 10 0 70
-cdialog 3 0 20
-cdp 40 0 27
-cdparanoia 45 0 45
-cdparanoia-devel 0 0 30
-cdrecord 45 0 45
-cdrecord-cdda2wav 44 0 45
-cdrecord-devel 10 0 0
-cervisia 0 0 0
-cfengine 0 30 0
-chkconfig 0 65 10
-chkfontpath 0 0 50
-chromium -1 -1 -1
-clanbomber 65 0 25
-cleanfeed 24 65 21
-clisp 0 0 15
-compat-glibc 0 0 40
-compat-libs 0 0 0
-comsat 0 30 2
-console-tools 97 97 97
-console-tools-devel 0 0 0
-control-center 69 0 10
-control-center-devel 0 0 0
-control-panel 2 0 2
-cooledit 0 0 30
-corewars 0 15 0
-cpio 90 89 90
-cproto 15 0 61
-cracklib 10 85 35
-cracklib-devel 0 0 15
-cracklib-dicts 10 82 35
-crontabs 95 95 95
-csmash -1 -1 -1
-ctags 10 0 80
-cttex -30 -30 -30
-cups -99 -99 -99
-cups-devel 0 0 20
-cups-drivers -99 -99 -99
-cvs 18 60 72
-cvsweb 0 0 30
-cxhextris 50 0 36
-detect 25 25 75
-detect-devel 0 0 60
-detect-lst 25 25 75
-dev 99 99 99
-dev86 0 0 40
-dev86-devel 0 0 40
-devfsd 0 0 0
-dhcp -99 80 -99
-dhcp-client 0 79 5
-dhcp-relay 0 10 0
-dhcpcd 0 0 0
-dhcpxd 0 0 0
-dia 30 0 30
-dialog 10 0 71
-diffstat 12 50 87
-diffutils 42 55 87
-dip 40 45 13
-docbook-dtd31-sgml 30 0 45
-docbook-style-dsssl 5 15 15
-docbook-style-dsssl-doc 4 14 14
-dosemu 45 0 49
-dosemu-freedos 45 0 49
-dosfstools 40 15 22
-doxygen 0 0 40
-dpsftp 45 0 0
-dpsftplib 45 0 0
-dpsftplib-devel 45 0 15
-drakfloppy 84 0 84
-drakfont 84 0 84
-drakxtools 86 80 87
-dump 10 75 87
-e2fsprogs 98 98 98
-e2fsprogs-devel 0 0 25
-eMusic 65 0 50
-ed 45 10 5
-ee 58 0 54
-efax 25 78 30
-egcs 5 0 50
-egcs-c++ 5 0 50
-egcs-cpp 5 0 50
-egcs-g77 5 0 50
-egcs-objc 5 0 50
-egcs-objc-devel 4 0 20
-eggdrop 25 0 25
-eject 92 33 91
-elm 22 5 13
-emacs 49 45 0
-emacs-X11 51 0 69
-emacs-el 0 0 15
-emacs-leim 20 0 50
-emacs-nox 20 0 14
-emacs-pcomplete 20 0 30
-emacs-tramp 20 20 30
-enlightenment 41 0 55
-enscript 20 25 71
-eog 30 0 20
-eperl 0 0 10
-eshell 20 0 30
-esound 0 0 0
-esound-devel 12 0 4
-etcskel 98 98 98
-ethemes 40 0 35
-exmh 40 0 36
-expect 23 0 71
-ext2ed 5 52 42
-ext2resize 5 52 42
-faces 20 75 15
-faces-devel 10 0 0
-faces-xface 20 0 15
-faq 63 49 53
-fbset 22 0 0
-fdutils 10 0 0
-fetchmail 45 99 31
-fetchmail-daemon 20 30 20
-fetchmailconf 45 0 40
-file 92 92 94
-filesystem 99 99 99
-fileutils 99 99 99
-findutils 97 97 97
-finger 40 35 27
-finger-server 0 30 0
-flex 13 0 72
-fltk 0 0 0
-fltk-devel 0 0 15
-fmirror 45 35 40
-fnlib 10 0 7
-fnlib-devel 10 0 0
-fonts-ttf-armenian -10 0 -10
-fonts-ttf-big5 -10 0 -10
-fonts-ttf-decoratives 72 0 68
-fonts-ttf-gb2312 -10 0 -10
-fonts-ttf-japanese -10 0 -10
-fonts-ttf-korean -10 0 -10
-fonts-ttf-west_european 77 0 74
-fonts-type1-baltic -15 -15 -15
-fortune-mod 10 0 10
-freeciv 54 0 53
-freetype 10 0 4
-freetype-devel 10 0 0
-fribidi 0 0 0
-fribidi-devel 0 0 0
-ftp 90 92 90
-fvwm 12 0 15
-fvwm2 17 0 17
-fvwm2-icons 17 0 17
-fwhois 25 45 36
-g-print 20 0 20
-g-wrap 0 0 40
-g-wrap-devel 0 0 20
-gaddr 45 0 40
-gaim 35 0 30
-gated 0 80 0
-gatos 55 0 49
-gawk 10 55 87
-gawk-doc 10 35 50
-gcc 50 40 90
-gcc-c++ 15 0 74
-gcc-chill 20 0 65
-gcc-colorgcc 0 0 0
-gcc-cpp 47 0 72
-gcc-fr 0 0 0
-gcc-g77 15 0 27
-gcc-java 16 0 65
-gcc-libgcj 15 0 30
-gcc-objc 16 0 35
-gcombust 40 0 0
-gd 12 0 71
-gd-devel 10 0 71
-gd-utils 45 0 64
-gdb 12 0 94
-gdbm 12 0 72
-gdbm-devel 10 0 72
-gdk-pixbuf 68 0 70
-gdk-pixbuf-devel 0 0 40
-gdm 67 0 55
-gedit 68 0 62
-gedit-devel 0 0 0
-genromfs 10 0 9
-gentoo 30 0 0
-gettext 10 15 71
-gettext-devel 0 0 35
-getty_ps 99 99 99
-gfcc 15 0 31
-gftp 67 0 62
-ggv 25 0 0
-ghc 0 0 35
-ghc-prof 0 0 2
-ghostscript 40 70 75
-ghostscript-utils 30 50 55
-ghostscript-fonts 22 55 75
-ghostscript-module-SVGALIB 10 0 63
-ghostscript-module-X 40 60 65
-gif2png 10 0 20
-giftrans 42 0 71
-gimp 69 0 67
-gimp-data-extras 55 0 58
-gimp-devel 10 0 40
-gimp-libgimp 10 0 50
-gimp-perl 30 0 30
-git 69 35 54
-gkrellm 15 30 15
-gkrellm-devel 0 0 20
-glade 17 0 57
-glademm 0 0 40
-glib 1 0 0
-glib-devel 10 0 87
-glibc 1 99 96
-glibc-devel 25 0 76
-glibc-profile 1 0 54
-gltron -1 -1 -1
-gmc 68 0 59
-gmp 17 0 71
-gmp-devel 10 0 71
-gnomba 24 0 24
-gnome-applets 68 0 55
-gnome-audio 60 0 55
-gnome-audio-extra 55 0 50
-gnome-chess 60 0 55
-gnome-core 68 0 55
-gnome-core-devel 10 0 55
-gnome-games 60 0 59
-gnome-games-devel 10 0 0
-gnome-guile 0 0 50
-gnome-guile-devel 10 0 50
-gnome-iconedit 60 0 55
-gnome-libs 68 0 55
-gnome-libs-devel 10 0 55
-gnome-linuxconf 74 0 74
-gnome-media 60 0 58
-gnome-network 60 0 58
-gnome-objc 0 0 40
-gnome-objc-devel 10 0 40
-gnome-pilot 55 0 45
-gnome-pilot-conduits 45 0 35
-gnome-pilot-devel 0 15 0
-gnome-pim 61 0 70
-gnome-pim-conduits 51 0 60
-gnome-pim-devel 10 0 70
-gnome-print 62 0 55
-gnome-print-devel 10 0 55
-gnome-tiles 60 0 55
-gnome-toaster 65 0 61
-gnome-users-guide 66 0 60
-gnome-utils 66 0 50
-gnome-vfs 0 0 0
-gnome-vfs-devel 0 0 30
-gnomeicu 61 0 58
-gnomemm 0 0 40
-gnomemm-devel 0 0 30
-gnorpm 74 0 71
-gnozip 50 0 60
-gnucash 35 0 15
-gnucash-devel 0 0 12
-gnuchess 40 0 31
-gnumeric 67 0 58
-gnuplot 65 0 53
-gnus 20 0 14
-gob 0 0 20
-gperf 12 0 72
-gphoto 60 0 58
-gpm 0 65 87
-gpm-devel 10 0 55
-gprolog 5 5 45
-gps 30 15 30
-gqcam 0 0 0
-gqview 55 0 49
-grep 0 92 94
-grip 60 0 35
-groff 0 0 62
-groff-for-man 0 0 0
-groff-gxditview 22 0 19
-groff-perl 0 0 0
-grpmi 0 0 0
-grub 99 99 99
-grub-doc 0 0 25
-gsl 10 0 0
-gsl-devel 0 0 0
-gsu 65 0 53
-gtk+ 0 0 70
-gtk+-devel 10 0 70
-gtk+licq 45 0 30
-gtk+mdk 0 0 15
-gtk+mdk-devel 0 0 15
-gtk-engines 0 0 70
-gtk-themes 50 0 20
-gtkdialogs 0 0 0
-gtkeyboard 20 0 0
-gtkglarea 10 0 15
-gtkglarea-devel 0 0 15
-gtkgo 15 0 5
-gtkgraph 65 0 35
-gtkhtml 0 0 0
-gtkhtml-devel 0 0 0
-gtkmm 20 0 55
-gtkmm-devel 20 0 55
-gtktalog 52 0 25
-gtkzip 60 0 58
-gtop 60 0 58
-gtulpas 10 0 10
-guile 11 0 75
-guile-devel 10 0 75
-gurpmi 82 0 86
-gv 55 0 49
-gzip 98 98 98
-hackkernel 0 0 0
-hackkernel-doc 0 0 0
-hackkernel-headers 0 0 0
-hackkernel-pcmcia-cs 0 0 0
-hackkernel-source 0 0 0
-happy 0 0 25
-harddrake 83 0 83
-haskell-GTK 0 0 10
-haskell-GTK-devel 0 0 10
-hdparm 98 98 98
-heartbeat -1 25 -1
-hexedit 91 91 91
-howto-html-de -30 -30 -30
-howto-html-el -30 -30 -30
-howto-html-en -30 -30 -30
-howto-html-es -30 -30 -30
-howto-html-fr -30 -30 -30
-howto-html-hr -30 -30 -30
-howto-html-id -30 -30 -30
-howto-html-it -30 -30 -30
-howto-html-ja -30 -30 -30
-howto-html-ko -30 -30 -30
-howto-html-pl -30 -30 -30
-howto-html-ro -30 -30 -30
-howto-html-sl -30 -30 -30
-howto-html-sv -30 -30 -30
-howto-html-zh -30 -30 -30
-howto-utils 0 0 0
-hugs98 0 0 15
-hylafax 0 0 0
-hylafax-client 0 0 0
-hylafax-server 0 0 0
-ibtk 20 0 13
-ical 40 0 27
-icepref 50 0 54
-icewm 65 0 78
-icewm-light 90 0 80
-imap 0 80 6
-imap-devel 0 0 6
-imlib 10 0 71
-imlib-cfgeditor 70 0 71
-imlib-devel 10 0 50
-imwheel 78 60 73
-indent 20 0 91
-indexhtml 0 87 76
-inews 6 12 15
-info 20 65 70
-info-install 0 0 10
-initscripts 99 99 99
-inn 0 55 0
-inn-devel 0 0 0
-intimed 0 55 10
-ipchains 15 98 13
-iplog 15 15 15
-iproute2 0 30 0
-ipvsadm 0 15 0
-ipxutils 20 85 9
-irda-utils -1 -1 -1
-irssi 59 0 57
-isapnptools 43 73 73
-isapnptools-devel 0 0 70
-isdn4k-utils -99 -99 -99
-isdn4net -99 -99 -99
-isicom 20 0 13
-ispell 49 15 22
-ispell-af -15 -15 -15
-ispell-br -15 -15 -15
-ispell-ca -15 -15 -15
-ispell-cs -15 -15 -15
-ispell-da -15 -15 -15
-ispell-de -15 -15 -15
-ispell-el -15 -15 -15
-ispell-en -15 -15 -15
-ispell-eo -15 -15 -15
-ispell-es -15 -15 -15
-ispell-fi -15 -15 -15
-ispell-fr -15 -15 -15
-ispell-ga -15 -15 -15
-ispell-gd -15 -15 -15
-ispell-gv -15 -15 -15
-ispell-id -15 -15 -15
-ispell-it -15 -15 -15
-ispell-nl -15 -15 -15
-ispell-no -15 -15 -15
-ispell-pl -15 -15 -15
-ispell-pt -15 -15 -15
-ispell-pt_BR -15 -15 -15
-ispell-ro -15 -15 -15
-ispell-ru -15 -15 -15
-ispell-sk -15 -15 -15
-ispell-sl -15 -15 -15
-ispell-sv -15 -15 -15
-itcl 10 0 60
-jadetex 15 0 45
-jed 16 18 14
-jed-common 0 18 0
-jed-xjed 40 0 22
-jikes 1 0 65
-joe 20 20 15
-kaffe 10 0 60
-kdbg 15 0 27
-kde1-compat 0 0 0
-kde1-compat-devel 0 0 0
-kdeaddutils 73 0 62
-kdeaddutils-devel 1 1 50
-kdeadmin 72 0 60
-kdebase 79 40 68
-kdebase-devel 1 1 60
-kdegames 71 0 59
-kdegraphics 77 40 66
-kdegraphics-devel 1 1 60
-kdelibs 0 0 0
-kdelibs-devel 1 1 60
-kdelibs-sound 60 0 55
-kdelibs-sound-devel 1 1 60
-kdemultimedia 77 0 66
-kdemultimedia-devel 1 1 60
-kdenetwork 72 0 60
-kdenetwork-devel 1 1 60
-kdepim 72 0 63
-kdesdk 0 0 35
-kdesupport 0 0 0
-kdesupport-devel 0 0 15
-kdetoys 70 0 65
-kdeutils 78 0 67
-kdiff 0 0 0
-kdiskcat 0 0 0
-kdoc 0 0 35
-kernel 99 99 99
-kernel-doc 5 50 65
-kernel-headers 1 45 94
-kernel-linus -1 -1 -1
-kernel-pcmcia-cs -1 -1 -1
-kernel-secure 0 0 0
-kernel-smp -1 -1 -1
-kernel-source 0 45 65
-kernel-utils 0 5 25
-kfilecoder 0 0 0
-kfirewall 0 0 0
-kfortune 0 0 0
-kfsstatus 0 0 0
-kfun21 0 0 0
-kimon 0 0 0
-kinput2-wnn4 -15 -15 -15
-kisocd 0 0 0
-kless 0 0 0
-klilo 0 0 0
-klyx 0 0 0
-kmag 0 0 0
-kmol 0 0 0
-kmp3 0 0 0
-kmp3te 0 0 0
-koffice 69 0 55
-koffice-devel 0 0 35
-kon2 -12 -60 -15
-kover 69 0 60
-kpacman 0 0 0
-kreglo 0 0 0
-krubik 0 0 0
-ksendfax 0 0 0
-kslide 0 0 0
-ktail 0 0 0
-ktelnet 0 0 0
-kterm -10 -90 -10
-kudzu 97 0 97
-kudzu-devel 0 0 43
-kups 60 0 50
-kups-devel 0 0 0
-kvideogen 0 0 0
-kvirc 69 0 56
-kvoice 0 0 0
-kvoicecontrol 0 0 0
-kwebget 0 0 0
-lame 15 40 35
-latex2html 25 0 50
-latte 0 0 45
-ld.so 98 98 98
-leafnode 0 50 0
-less 97 97 97
-lesstif 0 0 0
-lesstif-clients 0 0 0
-lesstif-devel 0 0 0
-lesstif-mwm 2 0 2
-lftp 50 78 83
-lha 40 25 72
-libPropList 10 0 80
-libPropList-devel 0 0 34
-libc 10 15 75
-libelf 10 15 80
-libghttp 10 0 55
-libghttp-devel 10 0 55
-libglade 10 0 55
-libglade-devel 10 0 40
-libgr 10 0 71
-libgr-devel 10 0 70
-libgr-progs 10 0 9
-libgtop 10 0 55
-libgtop-devel 10 0 55
-libjpeg 10 0 71
-libjpeg-devel 10 0 70
-libmikmod 10 0 55
-libmikmod-devel 10 0 55
-libnet 97 97 97
-libole2 0 0 0
-libole2-devel 0 0 0
-libpcap 10 80 72
-libpcap-devel 0 0 0
-libpng 10 0 71
-libpng-devel 10 0 71
-librep 10 0 50
-librep-devel 10 0 50
-libsafe 0 0 35
-libsigc++ 0 0 25
-libsigc++-devel 0 0 25
-libsigc++-examples 0 0 25
-libstdc++ 10 0 80
-libstdc++-compat 10 0 60
-libstdc++-devel 10 0 80
-libtabe -15 -90 -15
-libtabe-devel -15 -90 -15
-libtermcap 10 55 87
-libtermcap-devel 10 0 64
-libtiff 10 0 72
-libtiff-devel 10 0 72
-libtool 10 0 85
-libtool-devel 0 0 0
-libungif 10 0 72
-libungif-devel 10 0 72
-libungif-progs 10 0 2
-libunicode 10 0 80
-libunicode-devel 0 0 50
-libwmf 0 0 15
-libxml 10 0 71
-libxml-devel 10 0 71
-libxml2 10 0 71
-libxml2-devel 10 0 71
-licq 62 0 45
-licq-autoreply 45 0 30
-licq-console 45 0 30
-licq-devel 0 0 20
-licq-forwarder 45 0 30
-licq-rms 45 0 30
-licq-update-hosts 45 0 30
-lilo 99 99 99
-lilo-doc 0 0 30
-links 20 25 20
-linux_logo 92 72 92
-linuxconf 90 79 86
-linuxconf-gui -1 -1 -1
-linuxconf-lib 0 0 0
-linuxconf-util 0 0 0
-linuxconf 90 79 86
-linuxconf-devel 10 0 70
-lkmpg 2 0 65
-locales 96 76 96
-locales-af -1 -1 -1
-locales-ar -1 -1 -1
-locales-az -1 -1 -1
-locales-be -1 -1 -1
-locales-bg -1 -1 -1
-locales-br -1 -1 -1
-locales-ca -1 -1 -1
-locales-cs -1 -1 -1
-locales-cy -1 -1 -1
-locales-da -1 -1 -1
-locales-de -1 -1 -1
-locales-el -1 -1 -1
-locales-en -1 -1 -1
-locales-eo -1 -1 -1
-locales-es -1 -1 -1
-locales-et -1 -1 -1
-locales-eu -1 -1 -1
-locales-fa -1 -1 -1
-locales-fi -1 -1 -1
-locales-fo -1 -1 -1
-locales-ur -1 -1 -1
-locales-fr -1 -1 -1
-locales-ga -1 -1 -1
-locales-gd -1 -1 -1
-locales-gl -1 -1 -1
-locales-gv -1 -1 -1
-locales-he -1 -1 -1
-locales-hi -1 -1 -1
-locales-hr -1 -1 -1
-locales-hu -1 -1 -1
-locales-hy -1 -1 -1
-locales-id -1 -1 -1
-locales-is -1 -1 -1
-locales-it -1 -1 -1
-locales-ja -1 -1 -1
-locales-ka -1 -1 -1
-locales-kl -1 -1 -1
-locales-ko -1 -1 -1
-locales-kw -1 -1 -1
-locales-lo -1 -1 -1
-locales-lt -1 -1 -1
-locales-lv -1 -1 -1
-locales-mi -1 -1 -1
-locales-mk -1 -1 -1
-locales-ms -1 -1 -1
-locales-nl -1 -1 -1
-locales-no -1 -1 -1
-locales-oc -1 -1 -1
-locales-pd -1 -1 -1
-locales-ph -1 -1 -1
-locales-pl -1 -1 -1
-locales-pp -1 -1 -1
-locales-pt -1 -1 -1
-locales-ro -1 -1 -1
-locales-ru -1 -1 -1
-locales-sk -1 -1 -1
-locales-sl -1 -1 -1
-locales-sq -1 -1 -1
-locales-sr -1 -1 -1
-locales-sv -1 -1 -1
-locales-ta -1 -1 -1
-locales-tg -1 -1 -1
-locales-th -1 -1 -1
-locales-tr -1 -1 -1
-locales-tt -1 -1 -1
-locales-uk -1 -1 -1
-locales-vi -1 -1 -1
-locales-wa -1 -1 -1
-locales-yi -1 -1 -1
-locales-zh -1 -1 -1
-logrotate 0 25 15
-losetup 5 45 35
-lout 15 35 10
-lout-doc 31 32 10
-lpg 40 0 80
-lpr -99 -99 -99
-lrzsz 0 34 0
-lslk 20 49 54
-lsof 10 0 67
-ltrace 10 0 0
-lynx 42 78 84
-lyx 50 0 58
-m4 15 0 80
-macutils 22 5 19
-mailcap 5 5 4
-mailx 92 92 92
-make 50 50 94
-man 90 65 72
-man-pages 90 65 72
-man-pages-cs -10 -30 -25
-man-pages-de -10 -30 -25
-man-pages-es -10 -30 -25
-man-pages-fr -10 -30 -25
-man-pages-hu -10 -30 -25
-man-pages-id -10 -30 -25
-man-pages-it -10 -30 -25
-man-pages-ja -10 -30 -25
-man-pages-ko -10 -30 -25
-man-pages-pl -10 -30 -25
-man-pages-ru -10 -30 -25
-man-pages-zh -10 -30 -25
-mandrake-release 99 99 99
-mandrake_desk 88 0 88
-mandrake_doc-de -15 -90 -25
-mandrake_doc-en -15 -90 -25
-mandrake_doc-es -15 -90 -25
-mandrake_doc-fr -15 -90 -25
-mandrake_doc-it -15 -90 -25
-mandrake_doc-ru -15 -90 -25
-mars-nwe 0 35 0
-mathplot 30 0 20
-mawk 0 25 80
-mc 49 45 31
-mcserv 0 40 9
-mek 40 0 0
-memprof 2 5 65
-menu 90 0 80
-menudrake 79 75 75
-userdrake 50 0 40
-mercury 0 0 45
-metamail 40 80 50
-mgetty 24 20 9
-mgetty-contrib 28 20 15
-mgetty-sendfax 28 20 15
-mgetty-viewfax 28 20 15
-mgetty-voice 28 20 15
-mikmod 42 0 10
-mingetty 5 25 15
-minicom 27 0 4
-mirrordir 26 99 0
-mkbootdisk 35 55 60
-mkinitrd 99 99 99
-mkisofs 26 0 13
-mktemp 15 75 65
-mkxauth 2 99 1
-mm 0 0 15
-mm-devel 0 0 0
-mod_php -99 35 -99
-php-gd -99 15 -99
-php-imap -99 15 -99
-php-ldap -99 15 -99
-php-mysql -99 15 -99
-php-pgsql -99 15 -99
-php-oracle -99 15 -99
-php-dba_gdbm_db2 -99 15 -99
-php-readline -99 15 -99
-mod_ssl -99 75 -99
-mod_ssl-sxnet -99 30 -99
-modutils 99 99 99
-mon 0 40 0
-mount 97 97 97
-mouseconfig 0 0 0
-mozilla-fonts 0 0 0
-mp3info 50 20 50
-mpage 55 65 80
-mpeg_lib 0 0 0
-mpeg_lib-devel 0 0 30
-mpeg_lib-devel 0 0 0
-mpg123 42 0 42
-msec 98 98 98
-mt-st 40 0 49
-mtools 90 0 84
-mutt 10 0 10
-mxp 0 0 0
-nag 35 75 25
-nasm 20 20 65
-nasm-doc 0 20 65
-nasm-rdoff 0 20 65
-nc 0 0 0
-ncftp 55 0 49
-sftp 15 10 15
-ncompress 42 79 91
-ncpfs 0 0 0
-ncurses 0 0 80
-ncurses-extraterms 0 0 0
-ncurses-devel 10 0 75
-nedit 45 20 65
-net-tools 95 96 95
-netkit-base 82 99 82
-netscape-castellano -13 -30 -18
-netscape-catalan -13 -30 -18
-netscape-common 0 0 0
-netscape-communicator 78 60 73
-netscape-euskara -13 -30 -18
-netscape-francais -13 -30 -18
-netscape-german -13 -30 -18
-netscape-japanese -13 -30 -18
-netscape-navigator 0 0 0
-netscape-polish -13 -30 -18
-netscape-russian -13 -30 -18
-netscape-spanish -13 -30 -18
-netscape-walon -13 -30 -18
-newt 10 0 75
-newt-devel 10 0 75
-nfs-utils -99 80 13
-nfs-utils-clients 23 75 23
-nist 55 0 45
-nmap 5 40 40
-nmap-frontend 5 40 40
-nmh 0 0 0
-nscd 0 40 0
-nss_ldap 0 55 25
-ntp -1 -1 -1
-ntsysv 0 65 25
-numlock -11 -11 -11
-oaf 0 0 0
-oaf-devel 0 0 0
-ocaml 0 0 35
-octave 0 0 30
-oggvorbis 30 10 20
-oggvorbis-devel 0 0 15
-oggvorbis-examples 0 0 15
-open 20 45 80
-openjade 5 15 15
-openldap 0 50 35
-openldap-devel 0 0 25
-openssl 0 0 0
-openssl-devel 0 0 0
-oregano 0 0 0
-p2c 10 0 71
-p2c-devel 10 0 55
-pam 7 99 91
-pam-devel 0 0 0
-pam-doc 0 50 50
-pan 22 0 0
-pango 10 0 10
-pango-devel 0 0 10
-parted 35 35 35
-parted-devel 0 0 35
-passwd 99 99 99
-patch 14 0 72
-pciutils 16 55 55
-pciutils-devel 0 0 20
-pdksh 10 25 9
-penguin-command 35 0 10
-perl 20 19 90
-perl-Apache-Filter 0 0 0
-perl-Apache-SSI 0 0 0
-perl-Apache-Session 0 0 0
-perl-Compress-Zlib 0 0 0
-perl-Convert-BER 0 0 0
-perl-DBI 10 0 65
-perl-DBIx-Recordset 0 0 0
-perl-DB_File 10 0 50
-perl-Data-ShowTable 10 0 50
-perl-Date-Calc 0 0 0
-perl-DateManip 0 0 0
-perl-Devel-Symdump 0 0 0
-perl-Digest-MD5 10 0 70
-perl-ExtUtils_F77 0 0 0
-perl-File-Tail 0 0 0
-perl-GTK 10 0 72
-perl-GTK-GLArea 10 0 70
-perl-GTK-GdkImlib 10 0 70
-perl-GTK-Glade 10 0 70
-perl-GTK-Gnome 10 0 70
-perl-GTK-GtkHTML 0 0 0
-perl-HTML-Clean 0 0 0
-perl-HTML-Parser 10 0 55
-perl-HTML-SimpleParse 10 0 50
-perl-IO-stringy 5 0 65
-perl-MIME-Base64 5 0 45
-perl-MIME-tools 5 0 50
-perl-MLDBM 0 0 0
-perl-MP3-Info 5 0 40
-perl-Magick 0 0 0
-perl-MailTools 5 0 50
-perl-Mon 0 0 0
-perl-Msgcat 5 0 50
-perl-Mysql 5 0 40
-perl-Net-Telnet 0 0 0
-perl-Net_SSLeay 0 0 0
-perl-PDL 10 0 75
-perl-PDL-doc 0 0 0
-perl-Parse-RecDescent 10 0 75
-perl-Parse-Yapp 0 0 0
-perl-Period 0 0 0
-perl-RPM 0 0 0
-perl-Storable 0 0 0
-perl-Term-Readline-Gnu 10 10 88
-perl-Tie-Cache 0 0 0
-perl-Time-HiRes 0 0 0
-perl-TimeDate 0 0 0
-perl-Tk 0 15 0
-perl-Tk-devel 0 0 0
-perl-Tk-doc 0 0 0
-perl-URI 5 0 50
-perl-XML-Parser 0 0 0
-perl-XML-XSLT 0 0 0
-perl-base 0 0 0
-perl-devel 0 0 30
-perl-libnet 10 10 80
-perl-libwww-perl 10 10 80
-perl-libxml-enno 0 0 0
-perl-libxml-perl 0 0 0
-perl-Array-RefElem 0 0 0
-perl-Data-DumpXML 0 0 0
-perl-ExtUtils-PerlPP 0 0 0
-perl-File-NCopy 0 0 0
-perl-Image-Size 0 0 0
-perl-Mail-Sendmail 0 0 0
-perl-Net-XWhois 0 0 0
-perl-XML-RSS 0 0 0
-perlftlib 10 0 0
-php 0 35 5
-php-devel 0 0 5
-php-manual 0 0 5
-pidentd 15 69 87
-pilot-link 40 0 27
-perl-PDA-Pilot 0 0 0
-pilot-link-devel 11 0 25
-pine 40 0 27
-pinfo 20 20 20
-pingus 40 0 10
-piranha 0 10 0
-piranha-docs 0 10 0
-piranha-gui 0 10 0
-playmidi 43 0 19
-playmidi-X11 53 0 20
-plugger 40 0 40
-pmake 22 0 75
-pmake-customs 12 0 72
-popt 10 0 80
-popt-devel 0 0 45
-portmap 0 91 19
-postfix 20 88 51
-postgresql 0 56 23
-postgresql-devel 0 0 23
-postgresql-jdbc 0 0 15
-postgresql-odbc 0 0 23
-postgresql-perl 0 0 23
-postgresql-python 0 0 5
-postgresql-server 0 56 23
-postgresql-tcl 0 0 23
-postgresql-test 0 0 23
-postgresql-tk 0 0 5
-ppp 0 0 0
-pppoe-linuxconf 0 0 0
-pptp-adsl-fr -99 -99 -99
-pptp-client -99 -99 -99
-procinfo 24 15 96
-procmail 2 65 45
-procps 98 98 98
-procps-X11 50 0 32
-procps-devel 0 0 0
-proftpd -99 -99 -99
-psacct 20 70 87
-psmisc 25 62 56
-pspell 0 0 0
-pspell-devel 0 0 0
-psutils 5 42 15
-pth 0 0 25
-pth-devel 0 0 15
-publib-devel 0 0 0
-pump 0 0 0
-pump-devel 0 0 0
-pwdb 13 90 75
-pwdb-devel 0 0 50
-pygnome 12 0 50
-pygnome-applet 10 0 30
-pygnome-capplet 10 0 30
-pygnome-libglade 10 0 30
-pygtk 13 0 50
-pygtk-glarea 15 0 25
-pygtk-libglade 16 0 50
-pysol 27 0 27
-python 15 0 74
-python-devel 0 0 65
-python-docs 31 0 40
-python-imaging 31 0 40
-pythonlib 17 0 75
-qcad 5 0 5
-qiv 78 0 70
-qt 0 0 55
-qt-devel 10 0 55
-qt-qgl 10 0 50
-qt-qimgio 10 0 50
-qt2 0 0 45
-qt2-devel 0 0 45
-qt2-doc 0 0 30
-qtcups 0 0 0
-qtcups-devel 0 0 0
-queso 0 25 35
-quota 42 85 37
-raidtools 25 85 4
-rcs 12 0 71
-rdate 10 80 9
-rdist 10 75 9
-readline 11 0 70
-readline-devel 11 0 65
-recode 10 0 72
-recode-devel 0 0 50
-reiserfs-utils 60 60 60
-rep-gtk 0 0 20
-rep-gtk-gnome 0 0 20
-rep-gtk-libglade 0 0 20
-rgrep 55 55 75
-rhs-printfilters 1 1 0
-rmt 24 0 24
-rocksndiamonds 35 0 10
-rootfiles 99 99 99
-routed 0 90 19
-rp-pppoe -99 -99 -99
-rpm 99 99 99
-rpm-build 45 45 70
-rpm-devel 10 0 80
-rpm-python 0 0 50
-rpmdrake 84 0 81
-rpmlint 10 10 60
-rpmtools 0 0 25
-rpmtools-compat 0 0 0
-rpmtools-devel 0 0 25
-rsh 46 99 75
-rsh-server -99 55 25
-rsync 20 99 75
-ruby 0 0 25
-ruby-doc 0 0 25
-ruby-extensions 0 0 25
-ruby-gtk 0 0 25
-rusers 20 0 20
-rute -50 -75 -60
-rwall -1 0 -1
-rwho -1 0 -1
-rxvt 49 0 80
-rxvt-CLE -10 -90 -10
-sag 39 35 25
-samba 21 99 23
-samba-client 55 56 50
-samba-common 0 0 0
-sane 45 0 53
-sane-devel 10 0 2
-sash 5 5 5
-sawfish 59 0 57
-sawfish-themer 15 0 15
-sawfish-themes 50 0 50
-screen 26 43 79
-sed 97 97 97
-sendmail -99 -99 -99
-sendmail-cf 0 0 0
-sendmail-doc 0 0 0
-setserial 42 0 55
-setup 15 25 15
-sfm 25 0 25
-sgml-common 5 15 15
-sgml-tools 5 15 15
-sh-utils 97 97 97
-shadow-utils 98 98 98
-shapecfg 20 75 8
-sharutils 43 99 38
-sketch 45 0 0
-slang 12 0 75
-slang-devel 10 0 70
-slang-doc 0 0 70
-slocate 99 99 99
-slrn 10 0 10
-slrn-pull 35 0 45
-smpeg 50 0 25
-smpeg-devel 0 0 25
-sndconfig 70 40 70
-sox 41 32 80
-sox-devel 13 0 70
-space_sounds 52 0 55
-spacecup -1 -1 -1
-spec-helper 0 0 35
-spellutils 0 0 0
-spruce 0 0 0
-squid 0 45 16
-stat 5 55 45
-statserial 15 0 13
-strace 11 0 87
-sudo 0 30 0
-svgalib 10 0 63
-svgalib-devel 10 0 63
-swatch 22 65 4
-swi-prolog 5 5 45
-swig 0 0 20
-swig-devel 0 0 10
-symlinks 23 75 29
-sympa -1 40 -1
-sysklogd 97 97 97
-t1lib 1 0 29
-t1lib-devel 10 0 40
-taipeifonts -10 0 -10
-talk 44 0 39
-talk-server 0 0 0
-taper 42 0 27
-tar 97 97 97
-tcl 12 0 70
-tcllib 0 0 0
-tclx 12 0 70
-tcp_wrappers 0 99 0
-tcp_wrappers-devel 0 0 0
-tcpdump 10 79 2
-tcsh 1 25 15
-telnet 90 79 92
-openssh 65 75 65
-openssh-server -99 35 -99
-openssh-clients 65 75 65
-openssh-askpass 0 0 0
-openssh-askpass-gnome 0 0 0
-gnupg 90 90 90
-telnet-server -99 28 -99
-termcap 98 98 98
-tetex 25 0 50
-tetex-afm 25 0 40
-tetex-doc 25 0 40
-tetex-dvilj 40 0 40
-tetex-dvips 25 0 40
-tetex-latex 25 0 40
-tetex-latex-heb -65 -90 -90
-tetex-xdvi 25 0 50
-texinfo 22 0 50
-textutils 99 99 99
-teyjus 0 0 35
-tftp 0 40 2
-tftp-server 0 40 2
-thud 0 0 0
-time 40 65 87
-timeconfig 55 80 60
-timed 40 70 36
-timetool 54 0 57
-timidity-instruments 51 0 54
-tin 44 0 39
-tix 15 0 60
-tk 15 0 60
-tkbabel 15 0 15
-tkcvs 15 0 15
-tkinter 15 0 60
-tksysv 55 0 60
-tmake 10 0 25
-tmpwatch 35 75 60
-traceroute 40 79 29
-transfig 16 0 14
-tree 40 25 10
-trn 46 0 41
-trophy 35 0 10
-tunelp 24 15 28
-tuxracer -1 -1 -1
-ucd-snmp 0 70 45
-ucd-snmp-devel 0 25 45
-ucd-snmp-utils 0 37 45
-umb-scheme 10 0 65
-unarj 40 45 16
-units 22 0 10
-unixODBC 0 0 0
-unzip 70 75 91
-urlview 43 0 47
-urpmi 95 95 95
-urw-fonts 50 0 34
-usbview 5 0 10
-usermode 51 0 58
-usernet 42 55 37
-utempter 90 0 73
-utempter-devel 0 0 0
-util-linux 98 98 98
-uucp 0 80 2
-uxcook 0 0 0
-vigmeup 23 0 11
-vim-X11 52 0 26
-vim-common 0 19 0
-vim-enhanced 46 78 83
-vim-minimal 98 98 98
-vimguide 30 0 25
-vixie-cron 97 97 97
-vlock 40 99 80
-vnc 44 0 39
-vnc-SVGALIB 43 0 38
-vnc-doc 38 35 33
-vnc-java 38 0 34
-vnc-server 0 40 28
-webmin 20 40 20
-wget 65 75 53
-which 1 25 25
-wine 54 0 57
-wine-devel 0 0 0
-wmakerconf 47 0 57
-wmnet 24 0 21
-words 47 85 42
-wu-ftpd -99 85 -99
-wv 55 0 54
-wv-devel 0 0 0
-x3270 1 0 0
-xa+cv -10 -20 -10
-xalf 68 0 55
-xanim 58 0 54
-xbanner 15 0 12
-xboard 54 0 48
-xboing 53 0 47
-xcdroast 59 0 53
-xchat 58 0 52
-xcin -10 -10 -10
-xcpustate 53 0 47
-xdaliclock 57 0 51
-xdelta 16 0 5
-xdelta-devel 10 0 2
-xdosemu 34 0 37
-xearth 53 0 56
-xemacs 57 0 0
-xemacs-el 0 0 15
-xemacs-extras 50 0 36
-xemacs-info 54 0 42
-xemacs-mule 0 0 0
-xfce 0 0 0
-xfig 39 0 33
-xfishtank 51 0 45
-xgammon 40 0 31
-xinetd 0 0 0
-xinetd-devel 0 0 0
-xinitrc 0 0 0
-xinput 10 0 30
-xjewel 58 0 52
-xkobo 57 0 51
-xli 65 0 60
-xlispstat 2 0 45
-xloadimage 45 0 30
-xlockmore 58 0 52
-xmailbox 53 0 47
-xmame 25 0 25
-xmess 25 0 15
-xmms 64 0 57
-xmms-devel 0 0 15
-xmms-esd 46 0 41
-xmms-gnome 62 0 52
-xmms-kjofol-skins 50 0 50
-xmms-mesa -1 -1 -1
-xmms-mikmod 43 0 38
-xmms-more-vis-plugins 55 0 55
-xmms-oggvorbis 64 0 57
-xmms-skins 60 0 55
-xmms-smpeg 50 0 45
-xmorph 52 0 44
-xmovie 55 0 35
-xntp3 0 75 31
-xoscope 10 0 10
-xosview 51 0 45
-xpaint 53 0 47
-xpat2 43 0 38
-xpcd 40 0 30
-xpcd-gimp 30 0 25
-xpcd-svga 0 0 0
-xpdf 57 0 51
-xpilot 59 0 53
-xpm 52 0 64
-xpm-devel 10 0 56
-xpp 60 0 50
-xpuzzles 50 0 43
-xrally 5 0 5
-xrn 55 0 49
-xscreensaver 68 0 55
-xscreensaver-gl -1 -1 -1
-xsoldier 51 0 45
-xsysinfo 55 0 56
-xterm 87 0 80
-xtoolwait 50 0 35
-xtraceroute 50 0 40
-xtrojka 51 0 45
-xwc 65 0 40
-xwpe 0 0 20
-xwpe-X11 0 0 20
-xwpick 55 0 49
-xxgdb 53 0 47
-yodl 0 0 0
-yp-tools 0 40 0
-ypbind 0 40 0
-ypserv 0 0 0
-ytalk 21 75 18
-yudit 50 0 38
-zgv 15 0 13
-zip 70 65 87
-zlib 16 60 94
-zlib-devel 10 0 72
-zsh 20 50 72
-zsh-doc 0 35 60
-jpilot 40 0 30
-jpilot-Mail 12 0 10
-jpilot-syncmal 12 0 10
-jpilot-plugin-devel 0 0 0
-Maelstrom 50 0 35
-auctex 5 0 5
-bcast 15 0 10
-mpeg2_movie 10 0 8
-bg5ps -10 -10 -10
-eroaster 55 0 45
-everybuddy 52 0 52
-jabber 0 30 0
-libjabber 0 0 0
-libjabber-devel 0 0 0
-gabber 35 10 20
-gdk-pixbuf-gnomecanvas 0 0 0
-gdk-pixbuf-loaders 0 0 0
-gdk-pixbuf-xlib 0 0 0
-htdig 20 0 15
-libxode 0 0 0
-libxode-devel 0 0 0
-libgnet 0 0 0
-libgnet-devel 0 0 0
-libetherx 0 0 0
-libetherx-devel 0 0 0
-screem 55 0 60
-portsentry 0 15 0
-ttfprint -10 -10 -10
-kde-i18n-Afrikaans -12 -51 -23
-kde-i18n-Basque -12 -51 -23
-kde-i18n-Brazil -12 -51 -23
-kde-i18n-Breton -12 -51 -23
-kde-i18n-British -12 -51 -23
-kde-i18n-Bulgarian -12 -51 -23
-kde-i18n-Catalan -12 -51 -23
-kde-i18n-Chinese -12 -51 -23
-kde-i18n-Chinese-Big5 -12 -51 -23
-kde-i18n-Croatian -12 -51 -23
-kde-i18n-Czech -12 -51 -23
-kde-i18n-Danish -12 -51 -23
-kde-i18n-Dutch -12 -51 -23
-kde-i18n-Esperanto -12 -51 -23
-kde-i18n-Estonian -12 -51 -23
-kde-i18n-Finnish -12 -51 -23
-kde-i18n-French -12 -51 -23
-kde-i18n-Galacian -12 -51 -23
-kde-i18n-German -12 -51 -23
-kde-i18n-Greek -12 -51 -23
-kde-i18n-Hebrew -12 -51 -23
-kde-i18n-Hungarian -12 -51 -23
-kde-i18n-Icelandic -12 -51 -23
-kde-i18n-Italian -12 -51 -23
-kde-i18n-Japanese -12 -51 -23
-kde-i18n-Korean -12 -51 -23
-kde-i18n-Lithuanian -12 -51 -23
-kde-i18n-Macedonian -12 -51 -23
-kde-i18n-Maori -12 -51 -23
-kde-i18n-Norwegian -12 -51 -23
-kde-i18n-Norwegian -12 -51 -23
-kde-i18n-Polish -12 -51 -23
-kde-i18n-Portuguese -12 -51 -23
-kde-i18n-Romanian -12 -51 -23
-kde-i18n-Russian -12 -51 -23
-kde-i18n-Serbian -12 -51 -23
-kde-i18n-Slovak -12 -51 -23
-kde-i18n-Slovenian -12 -51 -23
-kde-i18n-Spanish -12 -51 -23
-kde-i18n-Swedish -12 -51 -23
-kde-i18n-Tamil -12 -51 -23
-kde-i18n-Thai -12 -51 -23
-kde-i18n-Turkish -12 -51 -23
-kde-i18n-Ukrainian -12 -51 -23
-kde-i18n-Walloon -12 -51 -23
-kde-i18n-Welsh -12 -51 -23
-kde-i18n-Norwegian-Nynorsk -12 -51 -23
-linuxconf-lang-cn -35 -60 -35
-linuxconf-lang-cs -35 -60 -35
-linuxconf-lang-de -35 -60 -35
-linuxconf-lang-es -35 -60 -35
-linuxconf-lang-fi -35 -60 -35
-linuxconf-lang-fr -35 -60 -35
-linuxconf-lang-it -35 -60 -35
-linuxconf-lang-ko -35 -60 -35
-linuxconf-lang-no -35 -60 -35
-linuxconf-lang-pt -35 -60 -35
-linuxconf-lang-ro -35 -60 -35
-linuxconf-lang-ru-SU -35 -60 -35
-linuxconf-lang-se -35 -60 -35
-linuxconf-lang-sk -35 -60 -35
-linuxconf-lang-zh -35 -60 -35
-7colors 15 0 0
-ltris 28 0 0
-lbreakout 35 0 0
-fonts-hebrew-elmar -30 -30 -30
-kwintv 0 0 0
-xawtv 0 0 0
-xawtv-misc 0 0 0
-xawtv-radio 0 0 0
-wxxt 0 0 0
-wxxt-devel 0 0 0
-surfraw 0 0 0
-R-base 0 0 0
-gpa 20 0 0
-gnome-telnet 0 0 0
-quanta 32 0 24
-nslint 0 12 0
-logcheck 0 12 0
-kisdn-free 33 0 30
-
-# commercial
-ac3d 20 0 20
-acroread 24 15 24
-acroread-nppdf 24 15 24
-IglooFTP-PRO 20 20 20
-interbase 0 15 15
-interbase-docs 0 15 15
-civctp-demo 22 0 20
-compupic 19 0 19
-commercial-menu 50 40 50
-eus-demo 23 0 20
-myth2-demo 24 0 25
-macromedia-flash 45 15 45
-RealPlayer 27 15 27
-RealPlayer-rpnp 27 15 27
-scol 23 0 23
-avp-database 20 20 20
-avp-linux 20 20 20
-arkeia-arkc 0 20 0
-arkeia-client 20 0 20
-arkeia-gui 24 0 20
-arkeia-server-shareware 0 30 0
-Artstream 20 0 0
-citrix-icaclient-en -70 -70 -70
-citrix-icaclient-fr -70 -70 -70
-citrix-icaclient-ge -70 -70 -70
-citrix-icaclient-sp -70 -70 -70
-printpro 0 0 0
-printpro-agfa 0 0 0
-printpro-alps 0 0 0
-printpro-apple 0 0 0
-printpro-autologic 0 0 0
-printpro-calcomp 0 0 0
-printpro-canon 0 0 0
-printpro-digital 0 0 0
-printpro-efi 0 0 0
-printpro-encad 0 0 0
-printpro-epson 0 0 0
-printpro-hp 0 0 0
-printpro-ibm 0 0 0
-printpro-lexmark 0 0 0
-printpro-lhag 0 0 0
-printpro-linotronic 0 0 0
-printpro-nec 0 0 0
-printpro-oki 0 0 0
-printpro-otheram 0 0 0
-printpro-othernz 0 0 0
-printpro-qms 0 0 0
-printpro-seiko 0 0 0
-printpro-sony 0 0 0
-printpro-tektronix 0 0 0
-printpro-ti 0 0 0
-printpro-varityper 0 0 0
-printpro-xerox 0 0 0
-emumail4.0 0 20 0
-EnlightenDSMFree 0 24 0
-EnlightenDSMFree-dsa 0 24 0
-EnlightenDSMFree-gui 0 24 0
-ForteCE-FCS 0 0 30
-ViaVoice_Outloud_rtk 0 0 45
-ViaVoice_Outloud_sdk 0 0 45
-ViaVoice_runtime 0 0 45
-ViaVoice_sdk 0 0 45
-jdk-sun 0 0 35
-jdk-sun-doc 0 0 35
-jre-sun 20 0 35
-heretic2-demo 24 0 24
-heroes3-demo 24 0 24
-rt2-demo 24 0 24
-MainActor 24 0 0
-mupad 20 0 20
-mtv 24 0 24
-mtv-fullscreen-extension 15 0 15
-NetPartitioner 0 24 0
-omnimark 0 0 35
-rebol-core 0 0 30
-staroffice-de -64 -90 -64
-staroffice-en -64 -90 -64
-staroffice-fr -64 -90 -64
-staroffice-it -64 -90 -64
-staroffice-nl -64 -90 -64
-staroffice-pt -64 -90 -64
-staroffice-es -64 -90 -64
-staroffice-sv -64 -90 -64
-tina-base 0 0 0
-tina-lesstif 0 0 0
-tina-oracle80 0 0 0
-tina-oracle8i 0 0 0
-tina-server 0 0 0
-VMware 20 0 35
-VariCAD 24 0 24
-ViaVoice_runtime 26 0 26
-<<<<<<< compssList
-viavoicemenu 26 0 26
-=======
-viavoicemenu 26 0 26
->>>>>>> 1.139
-kisdn 0 0 0
diff --git a/perl-install/share/list b/perl-install/share/list
index b3f2b92ad..5ad61fe4e 100644
--- a/perl-install/share/list
+++ b/perl-install/share/list
@@ -123,8 +123,8 @@
/usr/lib/perl5/vendor_perl/PERL_VERSION/ARCH-linux-thread-multi/Gtk/Gdk/ImlibImage.pm
/usr/lib/perl5/vendor_perl/PERL_VERSION/ARCH-linux-thread-multi/auto/Gtk/Gtk.so
/usr/lib/perl5/vendor_perl/PERL_VERSION/ARCH-linux-thread-multi/auto/Gtk/Gdk/ImlibImage/ImlibImage.so
-/usr/LIB/rpm/rpmrc
-/usr/LIB/rpm/macros
+/usr/lib/rpm/rpmrc
+/usr/lib/rpm/macros
/sbin/rescuept
/usr/share/ldetect-lst/Cards+
/usr/share/ldetect-lst/MonitorsDB
diff --git a/perl-install/share/list.ia64 b/perl-install/share/list.ia64
index 9bbf999cb..158ac8387 100644
--- a/perl-install/share/list.ia64
+++ b/perl-install/share/list.ia64
@@ -5,6 +5,10 @@
/sbin/mkdosfs
/sbin/resize_reiserfs
/usr/bin/strace
+/bin/bash
+/bin/vim-minimal
+/usr/sbin/parted
+/usr/sbin/efibootmgr
/var/log/XFree86.0.log
/usr/X11R6/bin/XFree86
/usr/X11R6/bin/xmodmap
@@ -68,7 +72,6 @@
/usr/X11R6/lib/modules/extensions/libextmod.a
/usr/X11R6/lib/modules/extensions/libglx.a
/usr/X11R6/lib/modules/extensions/librecord.a
-/usr/X11R6/lib/modules/extensions/libxie.a
/usr/X11R6/lib/modules/fonts
/usr/X11R6/lib/modules/fonts/libbitmap.a
/usr/X11R6/lib/modules/fonts/libfreetype.a
@@ -116,4 +119,4 @@
/usr/X11R6/lib/modules/linux/libfbdevhw.a
/usr/X11R6/lib/modules/v10002d.uc
/usr/X11R6/lib/modules/v20002d.uc
-/usr/lib/perl5/PERL_VERSION/ARCH-linux/asm/break.ph
+/usr/lib/perl5/PERL_VERSION/ARCH-linux-thread-multi/asm/break.ph
diff --git a/perl-install/share/list.x86_64 b/perl-install/share/list.x86_64
index 1a9851428..3314d9cc0 100644
--- a/perl-install/share/list.x86_64
+++ b/perl-install/share/list.x86_64
@@ -1,111 +1,133 @@
-/usr/bin/strace
-/var/log/XFree86.0.log
-/usr/X11R6/bin/XFree86
+/bin/bash
+/sbin/mkdosfs
+/sbin/mkraid
+/sbin/mkreiserfs
+/sbin/mkfs.xfs
+/sbin/raidstart
+/sbin/resize_reiserfs
+/usr/lib/perl5/PERL_VERSION/ARCH-linux-thread-multi/asm-i386/unistd.ph
+/usr/lib/perl5/PERL_VERSION/ARCH-linux-thread-multi/asm-x86_64/unistd.ph
/usr/X11R6/bin/xmodmap
-/usr/X11R6/lib/modules/
-/usr/X11R6/lib/modules/codeconv
-/usr/X11R6/lib/modules/codeconv/libARABIC.a
-/usr/X11R6/lib/modules/codeconv/libARMSCII8.a
-/usr/X11R6/lib/modules/codeconv/libBIG5.a
-/usr/X11R6/lib/modules/codeconv/libDOSENCODING.a
-/usr/X11R6/lib/modules/codeconv/libGB2312.a
-/usr/X11R6/lib/modules/codeconv/libGEORGIAN.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_1.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_10.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_11.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_14.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_15.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_2.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_3.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_4.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_5.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_6.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_7.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_8.a
-/usr/X11R6/lib/modules/codeconv/libISO8859_9.a
-/usr/X11R6/lib/modules/codeconv/libJISX0201.a
-/usr/X11R6/lib/modules/codeconv/libJISX0208.a
-/usr/X11R6/lib/modules/codeconv/libJISX0212.a
-/usr/X11R6/lib/modules/codeconv/libKOI8.a
-/usr/X11R6/lib/modules/codeconv/libKSC5601.a
-/usr/X11R6/lib/modules/codeconv/libKSCJOHAB.a
-/usr/X11R6/lib/modules/codeconv/libMULEENCODING.a
-/usr/X11R6/lib/modules/codeconv/libTCVN.a
-/usr/X11R6/lib/modules/codeconv/libVISCII.a
-/usr/X11R6/lib/modules/dri
-/usr/X11R6/lib/modules/dri/gamma_dri.so
-/usr/X11R6/lib/modules/dri/i810_dri.so
-/usr/X11R6/lib/modules/dri/mga_dri.so
-/usr/X11R6/lib/modules/dri/r128_dri.so
-/usr/X11R6/lib/modules/dri/sis_dri.so
-/usr/X11R6/lib/modules/drivers
-/usr/X11R6/lib/modules/drivers/ati_drv.o
-/usr/X11R6/lib/modules/drivers/atimisc_drv.o
-/usr/X11R6/lib/modules/drivers/fbdev_drv.o
-/usr/X11R6/lib/modules/drivers/glint_drv.o
-/usr/X11R6/lib/modules/drivers/i740_drv.o
-/usr/X11R6/lib/modules/drivers/linux
-/usr/X11R6/lib/modules/drivers/linux/v4l_drv.o
-/usr/X11R6/lib/modules/drivers/mga_drv.o
-/usr/X11R6/lib/modules/drivers/nv_drv.o
-/usr/X11R6/lib/modules/drivers/r128_drv.o
-/usr/X11R6/lib/modules/drivers/radeon_drv.o
-/usr/X11R6/lib/modules/drivers/rendition_drv.o
-/usr/X11R6/lib/modules/drivers/s3virge_drv.o
-/usr/X11R6/lib/modules/drivers/sis_drv.o
-/usr/X11R6/lib/modules/drivers/tdfx_drv.o
-/usr/X11R6/lib/modules/drivers/vga_drv.o
-/usr/X11R6/lib/modules/extensions
-/usr/X11R6/lib/modules/extensions/libGLcore.a
-/usr/X11R6/lib/modules/extensions/libdbe.a
-/usr/X11R6/lib/modules/extensions/libdri.a
-/usr/X11R6/lib/modules/extensions/libextmod.a
-/usr/X11R6/lib/modules/extensions/libglx.a
-/usr/X11R6/lib/modules/extensions/librecord.a
-/usr/X11R6/lib/modules/fonts
-/usr/X11R6/lib/modules/fonts/libbitmap.a
-/usr/X11R6/lib/modules/fonts/libfreetype.a
-/usr/X11R6/lib/modules/fonts/libspeedo.a
-/usr/X11R6/lib/modules/fonts/libtype1.a
-/usr/X11R6/lib/modules/fonts/libxtt.a
-/usr/X11R6/lib/modules/input
-/usr/X11R6/lib/modules/input/citron_drv.o
-/usr/X11R6/lib/modules/input/digitaledge_drv.o
-/usr/X11R6/lib/modules/input/dynapro_drv.o
-/usr/X11R6/lib/modules/input/elographics_drv.o
-/usr/X11R6/lib/modules/input/microtouch_drv.o
-/usr/X11R6/lib/modules/input/mouse_drv.o
-/usr/X11R6/lib/modules/input/mutouch_drv.o
-/usr/X11R6/lib/modules/input/spaceorb_drv.o
-/usr/X11R6/lib/modules/input/summa_drv.o
-/usr/X11R6/lib/modules/input/void_drv.o
-/usr/X11R6/lib/modules/input/wacom_drv.o
-/usr/X11R6/lib/modules/libafb.a
-/usr/X11R6/lib/modules/libcfb.a
-/usr/X11R6/lib/modules/libcfb16.a
-/usr/X11R6/lib/modules/libcfb24.a
-/usr/X11R6/lib/modules/libcfb32.a
-/usr/X11R6/lib/modules/libddc.a
-/usr/X11R6/lib/modules/libfb.a
-/usr/X11R6/lib/modules/libi2c.a
-/usr/X11R6/lib/modules/libint10.a
-/usr/X11R6/lib/modules/libmfb.a
-/usr/X11R6/lib/modules/libpcidata.a
-/usr/X11R6/lib/modules/librac.a
-/usr/X11R6/lib/modules/libramdac.a
-/usr/X11R6/lib/modules/libscanpci.a
-/usr/X11R6/lib/modules/libshadow.a
-/usr/X11R6/lib/modules/libshadowfb.a
-/usr/X11R6/lib/modules/libvbe.a
-/usr/X11R6/lib/modules/libvgahw.a
-/usr/X11R6/lib/modules/libxaa.a
-/usr/X11R6/lib/modules/libxf1bpp.a
-/usr/X11R6/lib/modules/libxf24_32bpp.a
-/usr/X11R6/lib/modules/libxf4bpp.a
-/usr/X11R6/lib/modules/libxf8_16bpp.a
-/usr/X11R6/lib/modules/libxf8_32bpp.a
-/usr/X11R6/lib/modules/linux
-/usr/X11R6/lib/modules/linux/libdrm.a
-/usr/X11R6/lib/modules/linux/libfbdevhw.a
-/usr/X11R6/lib/modules/v10002d.uc
-/usr/X11R6/lib/modules/v20002d.uc
+/usr/X11R6/bin/XFree86
+/usr/X11R6/lib64/modules/codeconv/libARABIC.a
+/usr/X11R6/lib64/modules/codeconv/libARMSCII8.a
+/usr/X11R6/lib64/modules/codeconv/libBIG5.a
+/usr/X11R6/lib64/modules/codeconv/libBIG5HKSCS.a
+/usr/X11R6/lib64/modules/codeconv/libDOSENCODING.a
+/usr/X11R6/lib64/modules/codeconv/libGB2312.a
+/usr/X11R6/lib64/modules/codeconv/libGBK.a
+/usr/X11R6/lib64/modules/codeconv/libGEORGIAN.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_1.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_10.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_11.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_14.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_15.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_2.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_3.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_4.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_5.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_6.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_7.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_8.a
+/usr/X11R6/lib64/modules/codeconv/libISO8859_9.a
+/usr/X11R6/lib64/modules/codeconv/libJISX0201.a
+/usr/X11R6/lib64/modules/codeconv/libJISX0208.a
+/usr/X11R6/lib64/modules/codeconv/libJISX0212.a
+/usr/X11R6/lib64/modules/codeconv/libKOI8.a
+/usr/X11R6/lib64/modules/codeconv/libKSC5601.a
+/usr/X11R6/lib64/modules/codeconv/libKSCJOHAB.a
+/usr/X11R6/lib64/modules/codeconv/libMULEENCODING.a
+/usr/X11R6/lib64/modules/codeconv/libTCVN.a
+/usr/X11R6/lib64/modules/codeconv/libVISCII.a
+/usr/X11R6/lib64/modules/dri/gamma_dri.so
+/usr/X11R6/lib64/modules/dri/i810_dri.so
+/usr/X11R6/lib64/modules/dri/mga_dri.so
+/usr/X11R6/lib64/modules/dri/r128_dri.so
+/usr/X11R6/lib64/modules/dri/radeon_dri.so
+/usr/X11R6/lib64/modules/drivers/apm_drv.o
+/usr/X11R6/lib64/modules/drivers/ati_drv.o
+/usr/X11R6/lib64/modules/drivers/atimisc_drv.o
+/usr/X11R6/lib64/modules/drivers/chips_drv.o
+/usr/X11R6/lib64/modules/drivers/cirrus_alpine.o
+/usr/X11R6/lib64/modules/drivers/cirrus_drv.o
+/usr/X11R6/lib64/modules/drivers/cirrus_laguna.o
+/usr/X11R6/lib64/modules/drivers/fbdev_drv.o
+/usr/X11R6/lib64/modules/drivers/glint_drv.o
+/usr/X11R6/lib64/modules/drivers/mga_drv.o
+/usr/X11R6/lib64/modules/drivers/neomagic_drv.o
+/usr/X11R6/lib64/modules/drivers/nv_drv.o
+/usr/X11R6/lib64/modules/drivers/r128_drv.o
+/usr/X11R6/lib64/modules/drivers/radeon_drv.o
+/usr/X11R6/lib64/modules/drivers/rendition_drv.o
+/usr/X11R6/lib64/modules/drivers/s3virge_drv.o
+/usr/X11R6/lib64/modules/drivers/savage_drv.o
+/usr/X11R6/lib64/modules/drivers/sis_drv.o
+/usr/X11R6/lib64/modules/drivers/tdfx_drv.o
+/usr/X11R6/lib64/modules/drivers/tga_drv.o
+/usr/X11R6/lib64/modules/drivers/trident_drv.o
+/usr/X11R6/lib64/modules/drivers/tseng_drv.o
+/usr/X11R6/lib64/modules/drivers/vesa_drv.o
+/usr/X11R6/lib64/modules/drivers/vga_drv.o
+/usr/X11R6/lib64/modules/extensions/libGLcore.a
+/usr/X11R6/lib64/modules/extensions/libdbe.a
+/usr/X11R6/lib64/modules/extensions/libdri.a
+/usr/X11R6/lib64/modules/extensions/libextmod.a
+/usr/X11R6/lib64/modules/extensions/libglx.a
+/usr/X11R6/lib64/modules/extensions/librecord.a
+/usr/X11R6/lib64/modules/extensions/libxtrap.a
+/usr/X11R6/lib64/modules/fonts/libbitmap.a
+/usr/X11R6/lib64/modules/fonts/libfreetype.a
+/usr/X11R6/lib64/modules/fonts/libspeedo.a
+/usr/X11R6/lib64/modules/fonts/libtype1.a
+/usr/X11R6/lib64/modules/fonts/libxtt.a
+/usr/X11R6/lib64/modules/input/acecad_drv.o
+/usr/X11R6/lib64/modules/input/calcomp_drv.o
+/usr/X11R6/lib64/modules/input/citron_drv.o
+/usr/X11R6/lib64/modules/input/digitaledge_drv.o
+/usr/X11R6/lib64/modules/input/dmc_drv.o
+/usr/X11R6/lib64/modules/input/dynapro_drv.o
+/usr/X11R6/lib64/modules/input/elographics_drv.o
+/usr/X11R6/lib64/modules/input/hyperpen_drv.o
+/usr/X11R6/lib64/modules/input/microtouch_drv.o
+/usr/X11R6/lib64/modules/input/mouse_drv.o
+/usr/X11R6/lib64/modules/input/mutouch_drv.o
+/usr/X11R6/lib64/modules/input/penmount_drv.o
+/usr/X11R6/lib64/modules/input/spaceorb_drv.o
+/usr/X11R6/lib64/modules/input/summa_drv.o
+/usr/X11R6/lib64/modules/input/void_drv.o
+/usr/X11R6/lib64/modules/input/wacom_drv.o
+/usr/X11R6/lib64/modules/libcfb.a
+/usr/X11R6/lib64/modules/libcfb16.a
+/usr/X11R6/lib64/modules/libcfb24.a
+/usr/X11R6/lib64/modules/libcfb32.a
+/usr/X11R6/lib64/modules/libddc.a
+/usr/X11R6/lib64/modules/libfb.a
+/usr/X11R6/lib64/modules/libi2c.a
+/usr/X11R6/lib64/modules/libint10.a
+/usr/X11R6/lib64/modules/liblayer.a
+/usr/X11R6/lib64/modules/libmfb.a
+/usr/X11R6/lib64/modules/libpcidata.a
+/usr/X11R6/lib64/modules/librac.a
+/usr/X11R6/lib64/modules/libramdac.a
+/usr/X11R6/lib64/modules/libscanpci.a
+/usr/X11R6/lib64/modules/libshadow.a
+/usr/X11R6/lib64/modules/libshadowfb.a
+/usr/X11R6/lib64/modules/libvbe.a
+/usr/X11R6/lib64/modules/libvgahw.a
+/usr/X11R6/lib64/modules/libxaa.a
+/usr/X11R6/lib64/modules/libxf1bpp.a
+/usr/X11R6/lib64/modules/libxf24_32bpp.a
+/usr/X11R6/lib64/modules/libxf4bpp.a
+/usr/X11R6/lib64/modules/libxf8_16bpp.a
+/usr/X11R6/lib64/modules/libxf8_32bpp.a
+/usr/X11R6/lib64/modules/linux/libdrm.a
+/usr/X11R6/lib64/modules/linux/libfbdevhw.a
+/usr/X11R6/lib64/modules/linux/libint10.a
+/usr/X11R6/lib64/modules/multimedia/bt829_drv.o
+/usr/X11R6/lib64/modules/multimedia/fi1236_drv.o
+/usr/X11R6/lib64/modules/multimedia/msp3430_drv.o
+/usr/X11R6/lib64/modules/multimedia/saa7114_drv.o
+/usr/X11R6/lib64/modules/multimedia/tda8425_drv.o
+/usr/X11R6/lib64/modules/multimedia/tda9850_drv.o
+/usr/X11R6/lib64/modules/multimedia/tda9885_drv.o
+/usr/X11R6/lib64/modules/multimedia/theatre_drv.o
diff --git a/perl-install/share/po/br.po b/perl-install/share/po/br.po
deleted file mode 100644
index d362afdc4..000000000
--- a/perl-install/share/po/br.po
+++ /dev/null
@@ -1,12831 +0,0 @@
-# DrakX e Brezhoneg.
-# Copyright (C) 1999-2002 MandrakeSoft
-# Thierry Vignaud <tvignaud@mandrakesoft.com>, 1999-2002
-# Jañ-Mai Drapier <jan-mai.drapier@mail.dotcom.fr>, 1999-2000
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: DrakX 8.2\n"
-"POT-Creation-Date: 2002-09-13 22:00+0200\n"
-"PO-Revision-Date: 2002-01-28 22:41GMT\n"
-"Last-Translator: Thierry Vignaud <tvignaud@mandrakesoft.com>\n"
-"Language-Team: Brezhoneg <ofisk@wanadoo.fr>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: ../../Xconfig/card.pm_.c:16
-msgid "256 kB"
-msgstr "256 ko"
-
-#: ../../Xconfig/card.pm_.c:17
-msgid "512 kB"
-msgstr "512 ko"
-
-#: ../../Xconfig/card.pm_.c:18
-msgid "1 MB"
-msgstr "1 Mo"
-
-#: ../../Xconfig/card.pm_.c:19
-msgid "2 MB"
-msgstr "2 Mo"
-
-#: ../../Xconfig/card.pm_.c:20
-msgid "4 MB"
-msgstr "4 Mo"
-
-#: ../../Xconfig/card.pm_.c:21
-msgid "8 MB"
-msgstr "8 Mo"
-
-#: ../../Xconfig/card.pm_.c:22
-msgid "16 MB"
-msgstr "16 Mo"
-
-#: ../../Xconfig/card.pm_.c:23
-msgid "32 MB"
-msgstr "32 Mo"
-
-#: ../../Xconfig/card.pm_.c:24
-msgid "64 MB or more"
-msgstr "64 Mo pe vuioc'h"
-
-#: ../../Xconfig/card.pm_.c:203
-msgid "Choose a X server"
-msgstr "Dibabit ur servijer X"
-
-#: ../../Xconfig/card.pm_.c:203
-msgid "X server"
-msgstr "servijer X"
-
-#: ../../Xconfig/card.pm_.c:230
-#, fuzzy
-msgid "Multi-head configuration"
-msgstr "o lenn ar c'hefluniadur"
-
-#: ../../Xconfig/card.pm_.c:231
-msgid ""
-"Your system support multiple head configuration.\n"
-"What do you want to do?"
-msgstr ""
-
-#: ../../Xconfig/card.pm_.c:286
-msgid "Select the memory size of your graphics card"
-msgstr "Diuzit ment memor ho kartenn c'hrafek"
-
-#: ../../Xconfig/card.pm_.c:347
-msgid "XFree configuration"
-msgstr "Staliadur XFree86"
-
-#: ../../Xconfig/card.pm_.c:349
-#, fuzzy
-msgid "Which configuration of XFree do you want to have?"
-msgstr "Pe seurt enmont a vennit ouzhpennañ"
-
-#: ../../Xconfig/card.pm_.c:381
-msgid "Configure all heads independently"
-msgstr ""
-
-#: ../../Xconfig/card.pm_.c:382
-msgid "Use Xinerama extension"
-msgstr "Implijit Xinemara"
-
-#: ../../Xconfig/card.pm_.c:387
-#, fuzzy, c-format
-msgid "Configure only card \"%s\"%s"
-msgstr "Kefluniadur hep ken kartenn \"%s\" (%s)"
-
-#: ../../Xconfig/card.pm_.c:399 ../../Xconfig/card.pm_.c:400
-#: ../../Xconfig/various.pm_.c:23
-#, c-format
-msgid "XFree %s"
-msgstr "XFree %s"
-
-#: ../../Xconfig/card.pm_.c:411 ../../Xconfig/card.pm_.c:437
-#: ../../Xconfig/various.pm_.c:23
-#, c-format
-msgid "XFree %s with 3D hardware acceleration"
-msgstr "XFree %s gant 3D"
-
-#: ../../Xconfig/card.pm_.c:414
-#, c-format
-msgid ""
-"Your card can have 3D hardware acceleration support but only with XFree %s.\n"
-"Your card is supported by XFree %s which may have a better support in 2D."
-msgstr ""
-
-#: ../../Xconfig/card.pm_.c:416 ../../Xconfig/card.pm_.c:439
-#, c-format
-msgid "Your card can have 3D hardware acceleration support with XFree %s."
-msgstr ""
-
-#: ../../Xconfig/card.pm_.c:424 ../../Xconfig/card.pm_.c:445
-#, c-format
-msgid "XFree %s with EXPERIMENTAL 3D hardware acceleration"
-msgstr ""
-
-#: ../../Xconfig/card.pm_.c:427
-#, c-format
-msgid ""
-"Your card can have 3D hardware acceleration support but only with XFree %s,\n"
-"NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.\n"
-"Your card is supported by XFree %s which may have a better support in 2D."
-msgstr ""
-
-#: ../../Xconfig/card.pm_.c:430 ../../Xconfig/card.pm_.c:447
-#, c-format
-msgid ""
-"Your card can have 3D hardware acceleration support with XFree %s,\n"
-"NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER."
-msgstr ""
-
-#: ../../Xconfig/card.pm_.c:453
-msgid "Xpmac (installation display driver)"
-msgstr ""
-
-#: ../../Xconfig/main.pm_.c:76 ../../Xconfig/main.pm_.c:77
-#: ../../Xconfig/monitor.pm_.c:96 ../../any.pm_.c:978
-msgid "Custom"
-msgstr "Personelañ"
-
-#: ../../Xconfig/main.pm_.c:102
-#, fuzzy
-msgid "Graphic Card"
-msgstr "Kartenn c'hrafek"
-
-#: ../../Xconfig/main.pm_.c:105 ../../Xconfig/monitor.pm_.c:93
-msgid "Monitor"
-msgstr "Skramm"
-
-#: ../../Xconfig/main.pm_.c:108 ../../Xconfig/resolution_and_depth.pm_.c:209
-msgid "Resolution"
-msgstr "Spister"
-
-#: ../../Xconfig/main.pm_.c:113
-msgid "Test"
-msgstr ""
-
-#: ../../Xconfig/main.pm_.c:118 ../../diskdrake/dav.pm_.c:67
-#: ../../diskdrake/interactive.pm_.c:381 ../../diskdrake/removable.pm_.c:25
-#: ../../diskdrake/removable_gtk.pm_.c:16 ../../diskdrake/smbnfs_gtk.pm_.c:86
-#, fuzzy
-msgid "Options"
-msgstr "Parzhadur"
-
-#: ../../Xconfig/main.pm_.c:122 ../../Xconfig/resolution_and_depth.pm_.c:268
-#: ../../install_gtk.pm_.c:79 ../../install_steps_gtk.pm_.c:275
-#: ../../interactive.pm_.c:127 ../../interactive.pm_.c:142
-#: ../../interactive.pm_.c:354 ../../interactive/http.pm_.c:104
-#: ../../interactive/newt.pm_.c:195 ../../interactive/newt.pm_.c:197
-#: ../../interactive/stdio.pm_.c:39 ../../interactive/stdio.pm_.c:143
-#: ../../interactive/stdio.pm_.c:144 ../../my_gtk.pm_.c:159
-#: ../../my_gtk.pm_.c:287 ../../my_gtk.pm_.c:310 ../../security/main.pm_.c:246
-#: ../../standalone/drakbackup_.c:3974 ../../standalone/drakbackup_.c:4069
-#: ../../standalone/drakbackup_.c:4088
-msgid "Ok"
-msgstr "Mat eo"
-
-#: ../../Xconfig/main.pm_.c:122 ../../diskdrake/dav.pm_.c:28
-#: ../../harddrake/ui.pm_.c:96 ../../printerdrake.pm_.c:3203
-#: ../../standalone/draksplash_.c:122 ../../standalone/logdrake_.c:225
-msgid "Quit"
-msgstr "Kuitaat"
-
-#: ../../Xconfig/main.pm_.c:145
-#, fuzzy, c-format
-msgid ""
-"Keep the changes?\n"
-"The current configuration is:\n"
-"\n"
-"%s"
-msgstr "Derc'hel ar c'hefluniadur IP o ren"
-
-#: ../../Xconfig/monitor.pm_.c:93
-msgid "Choose a monitor"
-msgstr "Dibabit ur skramm"
-
-#: ../../Xconfig/monitor.pm_.c:97
-msgid "Plug'n Play"
-msgstr ""
-
-#: ../../Xconfig/monitor.pm_.c:98 ../../mouse.pm_.c:46
-msgid "Generic"
-msgstr "Rummel"
-
-#: ../../Xconfig/monitor.pm_.c:99 ../../harddrake/ui.pm_.c:37
-#, fuzzy
-msgid "Vendor"
-msgstr "Dizober"
-
-#: ../../Xconfig/monitor.pm_.c:109
-msgid "Plug'n Play probing failed. Please choose a precise monitor"
-msgstr ""
-
-#: ../../Xconfig/monitor.pm_.c:114
-msgid ""
-"The two critical parameters are the vertical refresh rate, which is the "
-"rate\n"
-"at which the whole screen is refreshed, and most importantly the horizontal\n"
-"sync rate, which is the rate at which scanlines are displayed.\n"
-"\n"
-"It is VERY IMPORTANT that you do not specify a monitor type with a sync "
-"range\n"
-"that is beyond the capabilities of your monitor: you may damage your "
-"monitor.\n"
-" If in doubt, choose a conservative setting."
-msgstr ""
-"An div arventenn dreistpouezus a zo ar feur freskaat a-serzh, da lavaret eo "
-"ar\n"
-"feur ma vez freskaet ar skramm a-bezh, ha pouezusuc'h c'hoazh ar feur "
-"kempredañ\n"
-"a-led, da lavaret eo ar feur ma vez diskwelet linennoù skubañ.\n"
-"\n"
-"HOLLBOUEZHUS eo deoc'h na spisaat ur seurt skramm gant ur feur kempredañ\n"
-"a zo en tu-hont da varregezh ho skramm : gallout a rafe gwastañ ho skramm\n"
-" M'hoc'h eus douetañs, dibabit ur c'hefluniadur fur."
-
-#: ../../Xconfig/monitor.pm_.c:121
-msgid "Horizontal refresh rate"
-msgstr "Feur freskaat a-led"
-
-#: ../../Xconfig/monitor.pm_.c:122
-msgid "Vertical refresh rate"
-msgstr "Feur freskaat a-serzh"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:12
-msgid "256 colors (8 bits)"
-msgstr "256 liv (8 bit)"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:13
-msgid "32 thousand colors (15 bits)"
-msgstr "32 mil liv (15 bit)"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:14
-msgid "65 thousand colors (16 bits)"
-msgstr "65 mil liv (16 bit)"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:15
-msgid "16 million colors (24 bits)"
-msgstr "16 milion a livioù (24 bit)"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:16
-msgid "4 billion colors (32 bits)"
-msgstr "4 miliard a livioù (32 bit)"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:129
-msgid "Resolutions"
-msgstr "Spisterioù"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:254
-msgid "Choose the resolution and the color depth"
-msgstr "Dibabit ar spister ha donder al livioù"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:255
-#, c-format
-msgid "Graphics card: %s"
-msgstr "Kartenn c'hrafek : %s"
-
-#: ../../Xconfig/resolution_and_depth.pm_.c:268 ../../any.pm_.c:1019
-#: ../../bootlook.pm_.c:344 ../../diskdrake/smbnfs_gtk.pm_.c:87
-#: ../../install_steps_gtk.pm_.c:406 ../../install_steps_gtk.pm_.c:464
-#: ../../interactive.pm_.c:142 ../../interactive.pm_.c:354
-#: ../../interactive/http.pm_.c:105 ../../interactive/newt.pm_.c:195
-#: ../../interactive/stdio.pm_.c:39 ../../interactive/stdio.pm_.c:143
-#: ../../my_gtk.pm_.c:158 ../../my_gtk.pm_.c:162 ../../my_gtk.pm_.c:287
-#: ../../network/netconnect.pm_.c:42 ../../printerdrake.pm_.c:2169
-#: ../../security/main.pm_.c:295 ../../standalone/drakautoinst_.c:203
-#: ../../standalone/drakbackup_.c:3928 ../../standalone/drakbackup_.c:3961
-#: ../../standalone/drakbackup_.c:3987 ../../standalone/drakbackup_.c:4014
-#: ../../standalone/drakbackup_.c:4041 ../../standalone/drakbackup_.c:4101
-#: ../../standalone/drakbackup_.c:4128 ../../standalone/drakbackup_.c:4158
-#: ../../standalone/drakbackup_.c:4184 ../../standalone/drakconnect_.c:115
-#: ../../standalone/drakconnect_.c:147 ../../standalone/drakconnect_.c:289
-#: ../../standalone/drakconnect_.c:537 ../../standalone/drakconnect_.c:679
-#: ../../standalone/drakfloppy_.c:235 ../../standalone/drakfont_.c:970
-#: ../../standalone/drakgw_.c:532 ../../standalone/logdrake_.c:225
-#: ../../ugtk.pm_.c:296
-msgid "Cancel"
-msgstr "Nullañ"
-
-#: ../../Xconfig/test.pm_.c:30
-msgid "Test of the configuration"
-msgstr "Amprouiñ ar c'hefluniadur"
-
-#: ../../Xconfig/test.pm_.c:31
-msgid "Do you want to test the configuration?"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../Xconfig/test.pm_.c:31
-msgid "Warning: testing this graphic card may freeze your computer"
-msgstr ""
-
-#: ../../Xconfig/various.pm_.c:29
-#, c-format
-msgid "Keyboard layout: %s\n"
-msgstr "Reizhadur ar stokellaoueg : %s\n"
-
-#: ../../Xconfig/various.pm_.c:30
-#, c-format
-msgid "Mouse type: %s\n"
-msgstr "Seurt logodenn : %s\n"
-
-#: ../../Xconfig/various.pm_.c:31
-#, c-format
-msgid "Mouse device: %s\n"
-msgstr "Trobarzhell al logodenn : %s\n"
-
-#: ../../Xconfig/various.pm_.c:32
-#, c-format
-msgid "Monitor: %s\n"
-msgstr "Skramm : %s\n"
-
-#: ../../Xconfig/various.pm_.c:33
-#, c-format
-msgid "Monitor HorizSync: %s\n"
-msgstr "KempredA-led ar skramm : %s\n"
-
-#: ../../Xconfig/various.pm_.c:34
-#, c-format
-msgid "Monitor VertRefresh: %s\n"
-msgstr "FreskA-serzh ar skramm : %s\n"
-
-#: ../../Xconfig/various.pm_.c:35
-#, c-format
-msgid "Graphics card: %s\n"
-msgstr "Kartenn c'hrafek : %s\n"
-
-#: ../../Xconfig/various.pm_.c:36
-#, c-format
-msgid "Graphics memory: %s kB\n"
-msgstr "Memor c'hrafek : %s ko\n"
-
-#: ../../Xconfig/various.pm_.c:38
-#, c-format
-msgid "Color depth: %s\n"
-msgstr "Donder liv: %s\n"
-
-#: ../../Xconfig/various.pm_.c:39
-#, c-format
-msgid "Resolution: %s\n"
-msgstr "Spister: %s\n"
-
-#: ../../Xconfig/various.pm_.c:41
-#, c-format
-msgid "XFree86 server: %s\n"
-msgstr "Servijer XFree86 : %s\n"
-
-#: ../../Xconfig/various.pm_.c:42
-#, c-format
-msgid "XFree86 driver: %s\n"
-msgstr "Sturier XFree86 : %s\n"
-
-#: ../../Xconfig/various.pm_.c:61
-msgid "Graphical interface at startup"
-msgstr "X pa loc'her"
-
-#: ../../Xconfig/various.pm_.c:62
-msgid ""
-"I can setup your computer to automatically start the graphical interface "
-"(XFree) upon booting.\n"
-"Would you like XFree to start when you reboot?"
-msgstr ""
-"Kefluniañ ho urzhiataer evit lañsañ X ent emgefreek pa loc'ho a c'hellañ.\n"
-"Mennout a rit lañsañ X pa adloc'hit ?"
-
-#: ../../Xconfig/various.pm_.c:73
-msgid ""
-"Your graphic card seems to have a TV-OUT connector.\n"
-"It can be configured to work using frame-buffer.\n"
-"\n"
-"For this you have to plug your graphic card to your TV before booting your "
-"computer.\n"
-"Then choose the \"TVout\" entry in the bootloader\n"
-"\n"
-"Do you have this feature?"
-msgstr ""
-
-#: ../../Xconfig/various.pm_.c:85
-#, fuzzy
-msgid "What norm is your TV using?"
-msgstr "Ouzh pe borzh a-steud eo luget ho logodenn ?"
-
-#: ../../any.pm_.c:108 ../../any.pm_.c:133
-msgid "First sector of boot partition"
-msgstr "Rann gentañ ar parzhadur loc'hañ"
-
-#: ../../any.pm_.c:108 ../../any.pm_.c:133 ../../any.pm_.c:210
-msgid "First sector of drive (MBR)"
-msgstr "Rann gentañ ar bladenn (MBR)"
-
-#: ../../any.pm_.c:112
-msgid "SILO Installation"
-msgstr "Staliadur SILO"
-
-#: ../../any.pm_.c:113 ../../any.pm_.c:126
-msgid "Where do you want to install the bootloader?"
-msgstr "Pelec'h e mennit staliañ ar c'harger loc'hañ ?"
-
-#: ../../any.pm_.c:125
-msgid "LILO/grub Installation"
-msgstr "Staliadur LILO/grub"
-
-#: ../../any.pm_.c:137 ../../any.pm_.c:151
-msgid "SILO"
-msgstr "SILO"
-
-#: ../../any.pm_.c:139
-msgid "LILO with text menu"
-msgstr "LILO gant meuziad skrid"
-
-#: ../../any.pm_.c:140 ../../any.pm_.c:151
-msgid "LILO with graphical menu"
-msgstr "LILO gant meuziad c'hrafek"
-
-#: ../../any.pm_.c:143
-msgid "Grub"
-msgstr "Grub"
-
-#: ../../any.pm_.c:147
-msgid "Boot from DOS/Windows (loadlin)"
-msgstr "Loc'hañ abaoe DOS/Windows (loadlin)"
-
-#: ../../any.pm_.c:149 ../../any.pm_.c:151
-msgid "Yaboot"
-msgstr "Yaboot"
-
-#: ../../any.pm_.c:159 ../../any.pm_.c:190
-msgid "Bootloader main options"
-msgstr "Dibarzhoù pennañ ar c'harger loc'hañ"
-
-#: ../../any.pm_.c:160 ../../any.pm_.c:191
-msgid "Bootloader to use"
-msgstr "C'harger loc'hañ da implijout"
-
-#: ../../any.pm_.c:162
-msgid "Bootloader installation"
-msgstr "Staliadur c'harger loc'hañ"
-
-#: ../../any.pm_.c:164 ../../any.pm_.c:193
-msgid "Boot device"
-msgstr "Trobarzhell loc'hañ"
-
-#: ../../any.pm_.c:165
-msgid "Compact"
-msgstr "Fetis"
-
-#: ../../any.pm_.c:165
-msgid "compact"
-msgstr "fetis"
-
-#: ../../any.pm_.c:166 ../../any.pm_.c:291
-msgid "Video mode"
-msgstr "Mod video"
-
-#: ../../any.pm_.c:168
-msgid "Delay before booting default image"
-msgstr "Gedvezh kent loc'hañ ar skeudenn dre ziouer"
-
-#: ../../any.pm_.c:170 ../../any.pm_.c:789
-#: ../../diskdrake/smbnfs_gtk.pm_.c:179
-#: ../../install_steps_interactive.pm_.c:1094 ../../network/modem.pm_.c:48
-#: ../../printerdrake.pm_.c:865 ../../printerdrake.pm_.c:980
-#: ../../standalone/drakbackup_.c:3530 ../../standalone/drakconnect_.c:624
-#: ../../standalone/drakconnect_.c:649
-msgid "Password"
-msgstr "Tremenger"
-
-#: ../../any.pm_.c:171 ../../any.pm_.c:790
-#: ../../install_steps_interactive.pm_.c:1095
-msgid "Password (again)"
-msgstr "Tremenger (adarre)"
-
-#: ../../any.pm_.c:172
-msgid "Restrict command line options"
-msgstr "Strishaat dibarzhoù al linenn urzhiañ"
-
-#: ../../any.pm_.c:172
-msgid "restrict"
-msgstr "strishaat"
-
-#: ../../any.pm_.c:174
-msgid "Clean /tmp at each boot"
-msgstr "Skarañ /tmp bep ma loc'her"
-
-#: ../../any.pm_.c:175
-#, c-format
-msgid "Precise RAM size if needed (found %d MB)"
-msgstr "Spisait ment ar memor vev diouzh ret (kavet %d Mo)"
-
-#: ../../any.pm_.c:177
-msgid "Enable multi profiles"
-msgstr "Aotren lies trolinenn"
-
-#: ../../any.pm_.c:181
-msgid "Give the ram size in MB"
-msgstr "Roit ment ar memor vev e Mo"
-
-#: ../../any.pm_.c:183
-msgid ""
-"Option ``Restrict command line options'' is of no use without a password"
-msgstr "Didalvout eo ``Strishaat dibarzhoù al linenn urzhiañ'' hep tremenger"
-
-#: ../../any.pm_.c:184 ../../any.pm_.c:765
-#: ../../diskdrake/interactive.pm_.c:1191
-#: ../../install_steps_interactive.pm_.c:1089
-msgid "Please try again"
-msgstr "Klaskit adarre mar plij"
-
-#: ../../any.pm_.c:184 ../../any.pm_.c:765
-#: ../../install_steps_interactive.pm_.c:1089
-msgid "The passwords do not match"
-msgstr "An tremegerioù ne glot ket"
-
-#: ../../any.pm_.c:192
-msgid "Init Message"
-msgstr ""
-
-#: ../../any.pm_.c:194
-msgid "Open Firmware Delay"
-msgstr ""
-
-#: ../../any.pm_.c:195
-msgid "Kernel Boot Timeout"
-msgstr ""
-
-#: ../../any.pm_.c:196
-msgid "Enable CD Boot?"
-msgstr ""
-
-#: ../../any.pm_.c:197
-msgid "Enable OF Boot?"
-msgstr ""
-
-#: ../../any.pm_.c:198
-msgid "Default OS?"
-msgstr "RK dre ziouer"
-
-#: ../../any.pm_.c:232
-msgid ""
-"You decided to install the bootloader on a partition.\n"
-"This implies you already have a bootloader on the hard drive you boot (eg: "
-"System Commander).\n"
-"\n"
-"On which drive are you booting?"
-msgstr ""
-
-#: ../../any.pm_.c:248
-msgid ""
-"Here are the entries on your boot menu so far.\n"
-"You can add some more or change the existing ones."
-msgstr ""
-"Setu da heul an enmontoù liesseurt.\n"
-"Gallout a rit ouzhpennañ lod pe gemmañ a re a zo."
-
-#: ../../any.pm_.c:258 ../../standalone/drakbackup_.c:1560
-#: ../../standalone/drakbackup_.c:1673 ../../standalone/drakfont_.c:1011
-#: ../../standalone/drakfont_.c:1054
-msgid "Add"
-msgstr "Ouzhpennañ"
-
-#: ../../any.pm_.c:258 ../../any.pm_.c:777 ../../diskdrake/dav.pm_.c:68
-#: ../../diskdrake/hd_gtk.pm_.c:153 ../../diskdrake/removable.pm_.c:27
-#: ../../diskdrake/smbnfs_gtk.pm_.c:88 ../../interactive/http.pm_.c:153
-#: ../../printerdrake.pm_.c:3203 ../../standalone/drakbackup_.c:2774
-msgid "Done"
-msgstr "Graet"
-
-#: ../../any.pm_.c:258
-msgid "Modify"
-msgstr "Kemmañ"
-
-#: ../../any.pm_.c:266
-msgid "Which type of entry do you want to add?"
-msgstr "Pe seurt enmont a vennit ouzhpennañ"
-
-#: ../../any.pm_.c:267 ../../standalone/drakbackup_.c:1707
-msgid "Linux"
-msgstr "Linux"
-
-#: ../../any.pm_.c:267
-msgid "Other OS (SunOS...)"
-msgstr "Reizhiadoù (SunOS...)"
-
-#: ../../any.pm_.c:268
-msgid "Other OS (MacOS...)"
-msgstr "Reizhiadoù (MacOS...)"
-
-#: ../../any.pm_.c:268
-msgid "Other OS (windows...)"
-msgstr "Reizhiadoù (windows...)"
-
-#: ../../any.pm_.c:287
-msgid "Image"
-msgstr "Skeudenn"
-
-#: ../../any.pm_.c:288 ../../any.pm_.c:299
-msgid "Root"
-msgstr "Gwrizienn"
-
-#: ../../any.pm_.c:289 ../../any.pm_.c:317
-msgid "Append"
-msgstr "Ouzhpennañ"
-
-#: ../../any.pm_.c:293
-msgid "Initrd"
-msgstr "Initrd"
-
-#: ../../any.pm_.c:294
-msgid "Read-write"
-msgstr "Lenn-skrivañ "
-
-#: ../../any.pm_.c:301
-msgid "Table"
-msgstr "Taolenn"
-
-#: ../../any.pm_.c:302
-msgid "Unsafe"
-msgstr "Arvarus"
-
-#: ../../any.pm_.c:309 ../../any.pm_.c:314 ../../any.pm_.c:316
-msgid "Label"
-msgstr "Skridennad"
-
-#: ../../any.pm_.c:311 ../../any.pm_.c:321 ../../harddrake/v4l.pm_.c:201
-msgid "Default"
-msgstr "Dre ziouer"
-
-#: ../../any.pm_.c:318
-msgid "Initrd-size"
-msgstr "Ment an Initrd"
-
-#: ../../any.pm_.c:320
-msgid "NoVideo"
-msgstr "N'ev ket video"
-
-#: ../../any.pm_.c:328
-msgid "Remove entry"
-msgstr "Dilemel an enmont"
-
-#: ../../any.pm_.c:331
-msgid "Empty label not allowed"
-msgstr "Berzet eo ar skridennadoù goullo"
-
-#: ../../any.pm_.c:332
-msgid "You must specify a kernel image"
-msgstr ""
-
-#: ../../any.pm_.c:332
-#, fuzzy
-msgid "You must specify a root partition"
-msgstr "Ret eo deoc'h kaout ur parzhadur disloañ"
-
-#: ../../any.pm_.c:333
-msgid "This label is already used"
-msgstr "En implij eo ar skridennad-se endeo"
-
-#: ../../any.pm_.c:657
-#, c-format
-msgid "Found %s %s interfaces"
-msgstr "Kavet etrefas %s %s"
-
-#: ../../any.pm_.c:658
-msgid "Do you have another one?"
-msgstr "Hag un all hoc'h eus ?"
-
-#: ../../any.pm_.c:659
-#, c-format
-msgid "Do you have any %s interfaces?"
-msgstr "Hag un etrefas %s bennak a zo ganeoc'h ?"
-
-#: ../../any.pm_.c:661 ../../any.pm_.c:824 ../../interactive.pm_.c:132
-#: ../../my_gtk.pm_.c:286
-msgid "No"
-msgstr "Ket"
-
-#: ../../any.pm_.c:661 ../../any.pm_.c:823 ../../interactive.pm_.c:132
-#: ../../my_gtk.pm_.c:286
-msgid "Yes"
-msgstr "Ya"
-
-#: ../../any.pm_.c:662
-msgid "See hardware info"
-msgstr "Gwelet titouroù periantel"
-
-#. -PO: the first %s is the card type (scsi, network, sound,...)
-#. -PO: the second is the vendor+model name
-#: ../../any.pm_.c:678
-#, c-format
-msgid "Installing driver for %s card %s"
-msgstr "O staliañ ur sturier evit kartenn %s %s"
-
-#: ../../any.pm_.c:679
-#, c-format
-msgid "(module %s)"
-msgstr "(mollad %s)"
-
-#: ../../any.pm_.c:690
-#, c-format
-msgid ""
-"You may now provide its options to module %s.\n"
-"Note that any address should be entered with the prefix 0x like '0x123'"
-msgstr ""
-
-#: ../../any.pm_.c:696
-#, c-format
-msgid ""
-"You may now provide options to module %s.\n"
-"Options are in format ``name=value name2=value2 ...''.\n"
-"For instance, ``io=0x300 irq=7''"
-msgstr ""
-"Bremañ e c'hellit pourvezañ e zibarzhoù d'ar mollad %s.\n"
-"Diouzh ar furmad ``anv=talvoud anv2=talvoud2...'' eo an dibaboù.\n"
-"Da skouer, ``io=0x300 irq=7''"
-
-#: ../../any.pm_.c:698
-msgid "Module options:"
-msgstr "Dibarzhoù ar mollad :"
-
-#. -PO: the %s is the driver type (scsi, network, sound,...)
-#: ../../any.pm_.c:710
-#, c-format
-msgid "Which %s driver should I try?"
-msgstr "Pe sturier %s a zlefen amprouiñ ?"
-
-#: ../../any.pm_.c:719
-#, c-format
-msgid ""
-"In some cases, the %s driver needs to have extra information to work\n"
-"properly, although it normally works fine without. Would you like to "
-"specify\n"
-"extra options for it or allow the driver to probe your machine for the\n"
-"information it needs? Occasionally, probing will hang a computer, but it "
-"should\n"
-"not cause any damage."
-msgstr ""
-"E degouezhoù 'zo, ar sturier %s en deus ezhomm titouroù ouzhpenn evit mont\n"
-"en-dro reizh, daoust ma da en-dro mat hepto peurvuiañ. Ha mennout a rit "
-"spisaat\n"
-"dibaboù ouzphenn evitañ, pe aotren d'ar sturier amprouiñ ho penvek evit\n"
-"an titouroù en deus ezhomm ? A-wechoù, amprouiñ a c'hell sac'hañ un "
-"urzhiataer,\n"
-"hogen ne raio reuz ebet."
-
-#: ../../any.pm_.c:723
-msgid "Autoprobe"
-msgstr "Embrouiñ"
-
-#: ../../any.pm_.c:723
-msgid "Specify options"
-msgstr "Spisait dibarzhoù"
-
-#: ../../any.pm_.c:735
-#, c-format
-msgid ""
-"Loading module %s failed.\n"
-"Do you want to try again with other parameters?"
-msgstr ""
-"Kargañ ar mollad %s a zo sac'het.\n"
-"Mennout a rit klask adarre gant arventennoù all ?"
-
-#: ../../any.pm_.c:751
-msgid "access to X programs"
-msgstr ""
-
-#: ../../any.pm_.c:752
-msgid "access to rpm tools"
-msgstr ""
-
-#: ../../any.pm_.c:753
-msgid "allow \"su\""
-msgstr ""
-
-#: ../../any.pm_.c:754
-msgid "access to administrative files"
-msgstr ""
-
-#: ../../any.pm_.c:755
-msgid "access to network tools"
-msgstr ""
-
-#: ../../any.pm_.c:756
-msgid "access to compilation tools"
-msgstr ""
-
-#: ../../any.pm_.c:761
-#, c-format
-msgid "(already added %s)"
-msgstr "(ouzhpennet %s endeo)"
-
-#: ../../any.pm_.c:766
-msgid "This password is too simple"
-msgstr "Re eeun eo an tremeger"
-
-#: ../../any.pm_.c:767
-msgid "Please give a user name"
-msgstr "Roit un anv arveriad mar plij"
-
-#: ../../any.pm_.c:768
-msgid ""
-"The user name must contain only lower cased letters, numbers, `-' and `_'"
-msgstr ""
-"An anv arveriad a zle bezañ ennañ lizherennoù munut, sifroù, `-' ha `_' "
-"hepken"
-
-#: ../../any.pm_.c:769
-#, fuzzy
-msgid "The user name is too long"
-msgstr "En implij eo an anv arveriad-se endeo"
-
-#: ../../any.pm_.c:770
-msgid "This user name is already added"
-msgstr "En implij eo an anv arveriad-se endeo"
-
-#: ../../any.pm_.c:774
-msgid "Add user"
-msgstr "Ouzhpennañ un arveriad"
-
-#: ../../any.pm_.c:775
-#, c-format
-msgid ""
-"Enter a user\n"
-"%s"
-msgstr ""
-"Skrivit un arveriad\n"
-"%s"
-
-#: ../../any.pm_.c:776
-msgid "Accept user"
-msgstr "Aotren an arveriad"
-
-#: ../../any.pm_.c:787
-msgid "Real name"
-msgstr "Anv gwirion"
-
-#: ../../any.pm_.c:788 ../../printerdrake.pm_.c:864
-#: ../../printerdrake.pm_.c:979
-msgid "User name"
-msgstr "Anv arveriad"
-
-#: ../../any.pm_.c:791
-msgid "Shell"
-msgstr "Shell"
-
-#: ../../any.pm_.c:793
-msgid "Icon"
-msgstr "Arlun"
-
-#: ../../any.pm_.c:820
-msgid "Autologin"
-msgstr "Autologin"
-
-#: ../../any.pm_.c:821
-#, fuzzy
-msgid ""
-"I can set up your computer to automatically log on one user.\n"
-"Do you want to use this feature?"
-msgstr ""
-"Kefluniañ ho urzhiataer evit lañsañ X ent emgefreek pa loc'ho a c'hellañ.\n"
-"Mennout a rit lañsañ X pa adloc'hit ?"
-
-#: ../../any.pm_.c:825
-msgid "Choose the default user:"
-msgstr "Dibabit ar arveriad dre ziouer"
-
-#: ../../any.pm_.c:826
-#, fuzzy
-msgid "Choose the window manager to run:"
-msgstr "Dibabit ar benveg a vennit staliañ"
-
-#: ../../any.pm_.c:841
-msgid "Please choose a language to use."
-msgstr "Diuzit ar yezh da implijout, mar plij."
-
-#: ../../any.pm_.c:843
-msgid ""
-"Mandrake Linux can support multiple languages. Select\n"
-"the languages you would like to install. They will be available\n"
-"when your installation is complete and you restart your system."
-msgstr "Gallout a rit dibab yezhoù all hag a vo hegerz goude staliañ"
-
-#: ../../any.pm_.c:857 ../../install_steps_interactive.pm_.c:690
-#: ../../standalone/drakxtv_.c:73
-msgid "All"
-msgstr "An holl"
-
-#: ../../any.pm_.c:978
-msgid "Allow all users"
-msgstr "Aotreiñ an holl dud"
-
-#: ../../any.pm_.c:978
-msgid "No sharing"
-msgstr "N'ev ket lodañ"
-
-#: ../../any.pm_.c:988 ../../install_any.pm_.c:1199 ../../standalone.pm_.c:59
-#, fuzzy, c-format
-msgid "The package %s needs to be installed. Do you want to install it?"
-msgstr ""
-"Bremanaet e tle bezañ ar pabak-mañ\n"
-"Ha sur oc'h e mennit e ziuzañ ?"
-
-#: ../../any.pm_.c:991
-msgid ""
-"You can export using NFS or Samba. Please select which you'd like to use."
-msgstr ""
-
-#: ../../any.pm_.c:999 ../../install_any.pm_.c:1204 ../../standalone.pm_.c:64
-#, c-format
-msgid "Mandatory package %s is missing"
-msgstr ""
-
-#: ../../any.pm_.c:1005
-msgid ""
-"Would you like to allow users to share some of their directories?\n"
-"Allowing this will permit users to simply click on \"Share\" in konqueror "
-"and nautilus.\n"
-"\n"
-"\"Custom\" permit a per-user granularity.\n"
-msgstr ""
-
-#: ../../any.pm_.c:1019
-msgid "Launch userdrake"
-msgstr ""
-
-#: ../../any.pm_.c:1021
-msgid ""
-"The per-user sharing uses the group \"fileshare\". \n"
-"You can use userdrake to add a user in this group."
-msgstr ""
-
-#: ../../any.pm_.c:1072
-msgid "Welcome To Crackers"
-msgstr "Bezit deuet mat, preizherien !"
-
-#: ../../any.pm_.c:1073
-msgid "Poor"
-msgstr "Paour"
-
-#: ../../any.pm_.c:1074 ../../mouse.pm_.c:31
-msgid "Standard"
-msgstr "Skouer"
-
-#: ../../any.pm_.c:1075
-msgid "High"
-msgstr "Uhel"
-
-#: ../../any.pm_.c:1076
-#, fuzzy
-msgid "Higher"
-msgstr "Uhel"
-
-#: ../../any.pm_.c:1077
-msgid "Paranoid"
-msgstr "Ankeniet"
-
-#: ../../any.pm_.c:1080
-msgid ""
-"This level is to be used with care. It makes your system more easy to use,\n"
-"but very sensitive: it must not be used for a machine connected to others\n"
-"or to the Internet. There is no password access."
-msgstr ""
-"Ret eo implijout al live-mañ gant evezh. Ober a ra d'ho reizhiad bezañ\n"
-"aesoc'h da implijout, hogen kizidig-tre : arabat e implj evit un ardivink\n"
-"kevreet ouzh lod all pe ouzh ar genrouedad. N'eus ket a haeziñ dre dremenger."
-
-#: ../../any.pm_.c:1083
-msgid ""
-"Password are now enabled, but use as a networked computer is still not "
-"recommended."
-msgstr ""
-"Gweredekaet eo bremañ an tremenger, hogen dierbedet eo c'hoazh an implij en "
-"ur rouedad"
-
-#: ../../any.pm_.c:1084
-#, fuzzy
-msgid ""
-"This is the standard security recommended for a computer that will be used "
-"to connect to the Internet as a client."
-msgstr ""
-"Setu al live surentez standard a vez erbedet evit un urzhiataer a vo "
-"implijet\n"
-"evit kevreañ evel arval ouzh ar Genrouedad. Bremañ ez eus gwiriadennoù "
-"surentez."
-
-#: ../../any.pm_.c:1085
-msgid ""
-"There are already some restrictions, and more automatic checks are run every "
-"night."
-msgstr ""
-
-#: ../../any.pm_.c:1086
-#, fuzzy
-msgid ""
-"With this security level, the use of this system as a server becomes "
-"possible.\n"
-"The security is now high enough to use the system as a server which can "
-"accept\n"
-"connections from many clients. Note: if your machine is only a client on the "
-"Internet, you should choose a lower level."
-msgstr ""
-"Gant al live surentez-mañ e teu posupl implijout ar reizhiad-mañ evel ur "
-"servijer.\n"
-"Uhel a-walc'h eo bremañ ar surentez evit implijout ar reizhiad evel ur "
-"servijer\n"
-"o tigemer kevreadennoù a-berzh arvaloù niverus."
-
-#: ../../any.pm_.c:1089
-#, fuzzy
-msgid ""
-"This is similar to the previous level, but the system is entirely closed and "
-"security features are at their maximum."
-msgstr ""
-"Kemer a reomp arc'hweloù al live 4, hogen bremañ eo peurserret ar reizhiad.\n"
-"Arc'hweloù surentez a zo en o muiañ"
-
-#: ../../any.pm_.c:1095
-#, fuzzy
-msgid "DrakSec Basic Options"
-msgstr "Parzhadur"
-
-#: ../../any.pm_.c:1096
-#, fuzzy
-msgid "Please choose the desired security level"
-msgstr "Dibabit al live surentez"
-
-#: ../../any.pm_.c:1099
-msgid "Security level"
-msgstr "Live surentez"
-
-#: ../../any.pm_.c:1101
-msgid "Use libsafe for servers"
-msgstr "Implijit libsafe gant ar servijer"
-
-#: ../../any.pm_.c:1102
-msgid ""
-"A library which defends against buffer overflow and format string attacks."
-msgstr ""
-
-#: ../../any.pm_.c:1103
-msgid "Security Administrator (login or email)"
-msgstr ""
-
-#: ../../any.pm_.c:1192
-msgid ""
-"Here you can choose the key or key combination that will \n"
-"allow switching between the different keyboard layouts\n"
-"(eg: latin and non latin)"
-msgstr ""
-
-# NOTE: this message will be displayed at boot time; that is
-# only the ascii charset will be available on most machines
-# so use only 7bit for this message (and do transliteration or
-# leave it in English, as it is the best for your language)
-#
-#. -PO: these messages will be displayed at boot time in the BIOS, use only ASCII (7bit)
-#: ../../bootloader.pm_.c:429
-#, c-format
-msgid ""
-"Welcome to %s the operating system chooser!\n"
-"\n"
-"Choose an operating system in the list above or\n"
-"wait %d seconds for default boot.\n"
-"\n"
-msgstr ""
-"Degemer mat e %s, an dibaber reizhiad oberian~ !\n"
-"\n"
-"Dibabit an dibaber reizhiad pe\n"
-"gortozit %d eilennoù\n"
-"\n"
-
-# NOTE: this message will be displayed by grub at boot time; that is
-# using the BIOS font; that means cp437 charset on 99.99% of PC computers
-# out there. It is the nsuggested that for non latin languages an ascii
-# transliteration be used; or maybe the english text be used; as it is best
-#
-# The lines must fit on screen, aka length < 80
-# and only one line per string for the GRUB messages
-#
-#. -PO: these messages will be displayed at boot time in the BIOS, use only ASCII (7bit)
-#. -PO: and keep them smaller than 79 chars long
-#: ../../bootloader.pm_.c:989
-msgid "Welcome to GRUB the operating system chooser!"
-msgstr "Degemer mat e GRUB an dibaber reizhiad oberia¤ !"
-
-#. -PO: these messages will be displayed at boot time in the BIOS, use only ASCII (7bit)
-#. -PO: and keep them smaller than 79 chars long
-#: ../../bootloader.pm_.c:992
-#, c-format
-msgid "Use the %c and %c keys for selecting which entry is highlighted."
-msgstr "Implijit ar stokelloù %c ha %c evit diuz pe enmont zo war wel"
-
-#. -PO: these messages will be displayed at boot time in the BIOS, use only ASCII (7bit)
-#. -PO: and keep them smaller than 79 chars long
-#: ../../bootloader.pm_.c:995
-msgid "Press enter to boot the selected OS, 'e' to edit the"
-msgstr "Stokit enkas evit loc'ha¤ ar RK diuzet, 'e' evit aoza¤ an"
-
-#. -PO: these messages will be displayed at boot time in the BIOS, use only ASCII (7bit)
-#. -PO: and keep them smaller than 79 chars long
-#: ../../bootloader.pm_.c:998
-msgid "commands before booting, or 'c' for a command-line."
-msgstr "urzhiado— kent loc'ha¤, pe 'c' evit ul linenn-urzhia¤."
-
-#. -PO: these messages will be displayed at boot time in the BIOS, use only ASCII (7bit)
-#. -PO: and keep them smaller than 79 chars long
-#: ../../bootloader.pm_.c:1001
-#, c-format
-msgid "The highlighted entry will be booted automatically in %d seconds."
-msgstr "An enmont war wel a vo loc'het ent emgefreek e %d eilenn."
-
-#: ../../bootloader.pm_.c:1005
-msgid "not enough room in /boot"
-msgstr ""
-
-#. -PO: "Desktop" and "Start Menu" are the name of the directories found in c:\windows
-#. -PO: so you may need to put them in English or in a different language if MS-windows doesn't exist in your language
-#: ../../bootloader.pm_.c:1105
-msgid "Desktop"
-msgstr "Gorretaol"
-
-#. -PO: "Desktop" and "Start Menu" are the name of the directories found in c:\windows
-#: ../../bootloader.pm_.c:1107
-msgid "Start Menu"
-msgstr "Meuziad Lañsañ"
-
-#: ../../bootloader.pm_.c:1126
-#, fuzzy, c-format
-msgid "You can't install the bootloader on a %s partition\n"
-msgstr "Pelec'h e mennit staliañ ar c'harger loc'hañ ?"
-
-#: ../../bootlook.pm_.c:46 ../../standalone/drakperm_.c:15
-#: ../../standalone/draksplash_.c:26
-msgid "no help implemented yet.\n"
-msgstr "N'ev ket skoazell.\n"
-
-#: ../../bootlook.pm_.c:62
-#, fuzzy
-msgid "Boot Style Configuration"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../bootlook.pm_.c:79 ../../harddrake/ui.pm_.c:62
-#: ../../harddrake/ui.pm_.c:63 ../../standalone/drakfloppy_.c:82
-#: ../../standalone/logdrake_.c:102
-msgid "/_File"
-msgstr "/_Restr"
-
-#: ../../bootlook.pm_.c:80 ../../standalone/drakfloppy_.c:83
-#: ../../standalone/logdrake_.c:108
-msgid "/File/_Quit"
-msgstr "/Restr/_Kuitaat"
-
-#: ../../bootlook.pm_.c:80 ../../harddrake/ui.pm_.c:63
-#: ../../standalone/drakfloppy_.c:83 ../../standalone/logdrake_.c:108
-msgid "<control>Q"
-msgstr ""
-
-#: ../../bootlook.pm_.c:91
-msgid "NewStyle Categorizing Monitor"
-msgstr ""
-
-#: ../../bootlook.pm_.c:92
-#, fuzzy
-msgid "NewStyle Monitor"
-msgstr "Skramm"
-
-#: ../../bootlook.pm_.c:93
-#, fuzzy
-msgid "Traditional Monitor"
-msgstr "Kemmañ ar skramm"
-
-#: ../../bootlook.pm_.c:94
-msgid "Traditional Gtk+ Monitor"
-msgstr ""
-
-#: ../../bootlook.pm_.c:95
-msgid "Launch Aurora at boot time"
-msgstr ""
-
-#: ../../bootlook.pm_.c:98
-#, fuzzy
-msgid "Lilo/grub mode"
-msgstr "Anv domani"
-
-#: ../../bootlook.pm_.c:98
-#, fuzzy
-msgid "Yaboot mode"
-msgstr "Trobarzhell loc'hañ"
-
-#: ../../bootlook.pm_.c:146
-#, fuzzy
-msgid "Install themes"
-msgstr "Staliañ ar reizhiad"
-
-#: ../../bootlook.pm_.c:147
-msgid ""
-"Display theme\n"
-"under console"
-msgstr ""
-
-#: ../../bootlook.pm_.c:148
-#, fuzzy
-msgid "Create new theme"
-msgstr "Krouiñ ur parzhadur nevez"
-
-#: ../../bootlook.pm_.c:193
-#, c-format
-msgid "Backup %s to %s.old"
-msgstr ""
-
-#: ../../bootlook.pm_.c:194 ../../bootlook.pm_.c:197 ../../bootlook.pm_.c:200
-#: ../../bootlook.pm_.c:230 ../../bootlook.pm_.c:232 ../../bootlook.pm_.c:242
-#: ../../bootlook.pm_.c:251 ../../bootlook.pm_.c:258
-#: ../../diskdrake/dav.pm_.c:77 ../../diskdrake/hd_gtk.pm_.c:116
-#: ../../diskdrake/interactive.pm_.c:340 ../../diskdrake/interactive.pm_.c:355
-#: ../../diskdrake/interactive.pm_.c:469 ../../diskdrake/interactive.pm_.c:474
-#: ../../diskdrake/smbnfs_gtk.pm_.c:45 ../../fsedit.pm_.c:239
-#: ../../install_steps.pm_.c:75 ../../install_steps_interactive.pm_.c:67
-#: ../../interactive/http.pm_.c:119 ../../interactive/http.pm_.c:120
-#: ../../standalone/draksplash_.c:34
-msgid "Error"
-msgstr "Fazi"
-
-#: ../../bootlook.pm_.c:194
-msgid "unable to backup lilo message"
-msgstr ""
-
-#: ../../bootlook.pm_.c:196
-#, fuzzy, c-format
-msgid "Copy %s to %s"
-msgstr "Adskrivañ %s"
-
-#: ../../bootlook.pm_.c:197
-msgid "can't change lilo message"
-msgstr ""
-
-#: ../../bootlook.pm_.c:200
-msgid "Lilo message not found"
-msgstr ""
-
-#: ../../bootlook.pm_.c:230
-msgid "Can't write /etc/sysconfig/bootsplash."
-msgstr ""
-
-#: ../../bootlook.pm_.c:230
-#, fuzzy, c-format
-msgid "Write %s"
-msgstr "XFree %s"
-
-#: ../../bootlook.pm_.c:232
-msgid ""
-"Can't write /etc/sysconfig/bootsplash\n"
-"File not found."
-msgstr ""
-
-#: ../../bootlook.pm_.c:243
-#, c-format
-msgid "Can't launch mkinitrd -f /boot/initrd-%s.img %s."
-msgstr ""
-
-#: ../../bootlook.pm_.c:246
-#, c-format
-msgid "Make initrd 'mkinitrd -f /boot/initrd-%s.img %s'."
-msgstr ""
-
-#: ../../bootlook.pm_.c:252
-msgid ""
-"Can't relaunch LiLo!\n"
-"Launch \"lilo\" as root in command line to complete LiLo theme installation."
-msgstr ""
-
-#: ../../bootlook.pm_.c:256
-msgid "Relaunch 'lilo'"
-msgstr ""
-
-#: ../../bootlook.pm_.c:258 ../../standalone/draksplash_.c:165
-#: ../../standalone/draksplash_.c:329 ../../standalone/draksplash_.c:456
-#, fuzzy
-msgid "Notice"
-msgstr "frondenn"
-
-#: ../../bootlook.pm_.c:259
-msgid "LiLo and Bootsplash themes installation successfull"
-msgstr ""
-
-#: ../../bootlook.pm_.c:259
-#, fuzzy
-msgid "Theme installation failed!"
-msgstr "Diuzit renkad ar staliadur"
-
-#: ../../bootlook.pm_.c:267
-#, fuzzy, c-format
-msgid ""
-"You are currently using %s as your boot manager.\n"
-"Click on Configure to launch the setup wizard."
-msgstr "Lugerezh ar voullerez"
-
-#: ../../bootlook.pm_.c:269 ../../standalone/drakbackup_.c:2429
-#: ../../standalone/drakbackup_.c:2439 ../../standalone/drakbackup_.c:2449
-#: ../../standalone/drakbackup_.c:2457 ../../standalone/drakgw_.c:526
-msgid "Configure"
-msgstr "Kefluniañ"
-
-#: ../../bootlook.pm_.c:276
-#, fuzzy
-msgid "Splash selection"
-msgstr "Diuz pakadoù unan hag unan"
-
-#: ../../bootlook.pm_.c:279
-#, fuzzy
-msgid "Themes"
-msgstr "Gwezenn"
-
-#: ../../bootlook.pm_.c:281
-msgid ""
-"\n"
-"Select theme for\n"
-"lilo and bootsplash,\n"
-"you can choose\n"
-"them separatly"
-msgstr ""
-
-#: ../../bootlook.pm_.c:284
-msgid "Lilo screen"
-msgstr ""
-
-#: ../../bootlook.pm_.c:289
-msgid "Bootsplash"
-msgstr ""
-
-#: ../../bootlook.pm_.c:324
-msgid "System mode"
-msgstr ""
-
-#: ../../bootlook.pm_.c:326
-msgid "Launch the graphical environment when your system starts"
-msgstr ""
-
-#: ../../bootlook.pm_.c:331
-msgid "No, I don't want autologin"
-msgstr ""
-
-#: ../../bootlook.pm_.c:333
-msgid "Yes, I want autologin with this (user, desktop)"
-msgstr ""
-
-#: ../../bootlook.pm_.c:343 ../../network/netconnect.pm_.c:97
-#: ../../standalone/drakTermServ_.c:173 ../../standalone/drakTermServ_.c:300
-#: ../../standalone/drakTermServ_.c:405 ../../standalone/drakbackup_.c:4193
-#: ../../standalone/drakbackup_.c:4956 ../../standalone/drakconnect_.c:108
-#: ../../standalone/drakconnect_.c:140 ../../standalone/drakconnect_.c:296
-#: ../../standalone/drakconnect_.c:435 ../../standalone/drakconnect_.c:521
-#: ../../standalone/drakconnect_.c:564 ../../standalone/drakconnect_.c:667
-#: ../../standalone/drakfont_.c:612 ../../standalone/drakfont_.c:799
-#: ../../standalone/drakfont_.c:876 ../../standalone/drakfont_.c:963
-#: ../../ugtk.pm_.c:289
-msgid "OK"
-msgstr "YA"
-
-#: ../../bootlook.pm_.c:403
-#, c-format
-msgid "can not open /etc/inittab for reading: %s"
-msgstr ""
-
-#: ../../common.pm_.c:99
-msgid "GB"
-msgstr "Go"
-
-#: ../../common.pm_.c:99
-msgid "KB"
-msgstr "Ko"
-
-#: ../../common.pm_.c:99
-msgid "MB"
-msgstr "Mo"
-
-#: ../../common.pm_.c:107
-msgid "TB"
-msgstr "To"
-
-#: ../../common.pm_.c:115
-#, c-format
-msgid "%d minutes"
-msgstr "%d munutennoù"
-
-#: ../../common.pm_.c:117
-msgid "1 minute"
-msgstr "1 munutenn"
-
-#: ../../common.pm_.c:119
-#, c-format
-msgid "%d seconds"
-msgstr "%d eilenn"
-
-#: ../../common.pm_.c:164
-#, fuzzy
-msgid "Can't make screenshots before partitioning"
-msgstr "N'hellan ouzpennañ parzhadur ebet ken"
-
-#: ../../common.pm_.c:171
-#, fuzzy, c-format
-msgid "Screenshots will be available after install in %s"
-msgstr "Gallout a rit dibab yezhoù all hag a vo hegerz goude staliañ"
-
-#: ../../crypto.pm_.c:14 ../../crypto.pm_.c:28 ../../network/tools.pm_.c:104
-#: ../../network/tools.pm_.c:113
-msgid "France"
-msgstr "Gall"
-
-#: ../../crypto.pm_.c:15
-msgid "Costa Rica"
-msgstr ""
-
-#: ../../crypto.pm_.c:16 ../../crypto.pm_.c:29 ../../network/tools.pm_.c:104
-#: ../../network/tools.pm_.c:116
-msgid "Belgium"
-msgstr "Beljik"
-
-#: ../../crypto.pm_.c:17 ../../crypto.pm_.c:30
-msgid "Czech Republic"
-msgstr "Tchek"
-
-#: ../../crypto.pm_.c:18 ../../crypto.pm_.c:31
-msgid "Germany"
-msgstr "Alaman"
-
-#: ../../crypto.pm_.c:19 ../../crypto.pm_.c:32
-msgid "Greece"
-msgstr "Gres"
-
-#: ../../crypto.pm_.c:20 ../../crypto.pm_.c:33
-msgid "Norway"
-msgstr "Norvegek"
-
-#: ../../crypto.pm_.c:21 ../../crypto.pm_.c:34
-msgid "Sweden"
-msgstr "Suis"
-
-#: ../../crypto.pm_.c:22 ../../crypto.pm_.c:36 ../../network/tools.pm_.c:104
-#: ../../network/tools.pm_.c:114
-msgid "Netherlands"
-msgstr ""
-
-#: ../../crypto.pm_.c:23 ../../crypto.pm_.c:37 ../../network/tools.pm_.c:104
-#: ../../network/tools.pm_.c:115 ../../standalone/drakxtv_.c:68
-msgid "Italy"
-msgstr "Italian"
-
-#: ../../crypto.pm_.c:24 ../../crypto.pm_.c:38
-#, fuzzy
-msgid "Austria"
-msgstr "a-steud"
-
-#: ../../crypto.pm_.c:35 ../../crypto.pm_.c:61 ../../network/tools.pm_.c:104
-#: ../../network/tools.pm_.c:117
-msgid "United States"
-msgstr "Amerika"
-
-#: ../../diskdrake/dav.pm_.c:19
-msgid ""
-"WebDAV is a protocol that allows you to mount a web server's directory\n"
-"locally, and treat it like a local filesystem (provided the web server is\n"
-"configured as a WebDAV server). If you would like to add WebDAV mount\n"
-"points, select \"New\"."
-msgstr ""
-
-#: ../../diskdrake/dav.pm_.c:27
-msgid "New"
-msgstr "Nevez"
-
-#: ../../diskdrake/dav.pm_.c:63 ../../diskdrake/interactive.pm_.c:388
-#: ../../diskdrake/smbnfs_gtk.pm_.c:81
-msgid "Unmount"
-msgstr "Divarc'hañ"
-
-#: ../../diskdrake/dav.pm_.c:64 ../../diskdrake/interactive.pm_.c:385
-#: ../../diskdrake/smbnfs_gtk.pm_.c:82
-msgid "Mount"
-msgstr "Marc'hañ"
-
-#: ../../diskdrake/dav.pm_.c:65
-msgid "Server"
-msgstr "Servijer"
-
-#: ../../diskdrake/dav.pm_.c:66 ../../diskdrake/interactive.pm_.c:379
-#: ../../diskdrake/interactive.pm_.c:568 ../../diskdrake/interactive.pm_.c:595
-#: ../../diskdrake/removable.pm_.c:24 ../../diskdrake/removable_gtk.pm_.c:15
-#: ../../diskdrake/smbnfs_gtk.pm_.c:85
-msgid "Mount point"
-msgstr "Poent marc'hañ"
-
-#: ../../diskdrake/dav.pm_.c:85
-#, fuzzy
-msgid "Please enter the WebDAV server URL"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../diskdrake/dav.pm_.c:88
-msgid "The URL must begin with http:// or https://"
-msgstr ""
-
-#: ../../diskdrake/dav.pm_.c:109
-#, fuzzy
-msgid "Server: "
-msgstr "Servijer"
-
-#: ../../diskdrake/dav.pm_.c:110 ../../diskdrake/interactive.pm_.c:440
-#: ../../diskdrake/interactive.pm_.c:1089
-#: ../../diskdrake/interactive.pm_.c:1164
-msgid "Mount point: "
-msgstr "Poent marc'hañ : "
-
-#: ../../diskdrake/dav.pm_.c:111 ../../diskdrake/interactive.pm_.c:1170
-#, fuzzy, c-format
-msgid "Options: %s"
-msgstr "Parzhadur"
-
-#: ../../diskdrake/hd_gtk.pm_.c:94
-msgid "Please make a backup of your data first"
-msgstr "Gwarezit ho roadoù da gentañ mar plij"
-
-#: ../../diskdrake/hd_gtk.pm_.c:94 ../../diskdrake/interactive.pm_.c:934
-#: ../../diskdrake/interactive.pm_.c:943
-#: ../../diskdrake/interactive.pm_.c:1009
-msgid "Read carefully!"
-msgstr "Lennit aketus !"
-
-#: ../../diskdrake/hd_gtk.pm_.c:97
-msgid ""
-"If you plan to use aboot, be carefull to leave a free space (2048 sectors is "
-"enough)\n"
-"at the beginning of the disk"
-msgstr ""
-"M'emaoc'h e soñj implijout aboot, taolit evezh leuskel un egor dieub (2048 "
-"rann\n"
-"a zo a-walc'h) e deroù ar bladenn"
-
-#: ../../diskdrake/hd_gtk.pm_.c:151
-msgid "Wizard"
-msgstr "Skoazeller"
-
-#: ../../diskdrake/hd_gtk.pm_.c:184 ../../diskdrake/removable_gtk.pm_.c:24
-msgid "Choose action"
-msgstr "Dibabit un obererezh"
-
-#: ../../diskdrake/hd_gtk.pm_.c:188
-msgid ""
-"You have one big FAT partition\n"
-"(generally used by MicroSoft Dos/Windows).\n"
-"I suggest you first resize that partition\n"
-"(click on it, then click on \"Resize\")"
-msgstr ""
-"Ur mell barzhadur FAT hoc'h eus\n"
-"(implijet gant MicroSoft Dos/Windows peurliesañ).\n"
-"Aliañ a ran ouzoc'h adventañ ar parzhadur-se\n"
-"(klikit warni, da c'houde klikit war \"Adventañ\")"
-
-#
-#: ../../diskdrake/hd_gtk.pm_.c:191
-msgid "Please click on a partition"
-msgstr "Klikit war ur parzhadur mar plij"
-
-#: ../../diskdrake/hd_gtk.pm_.c:205 ../../diskdrake/smbnfs_gtk.pm_.c:69
-#: ../../install_steps_gtk.pm_.c:465
-msgid "Details"
-msgstr "Munudoù"
-
-#: ../../diskdrake/hd_gtk.pm_.c:252
-#, fuzzy
-msgid "No hard drives found"
-msgstr "N'ev ket Moullerez lec'hel!\n"
-
-#: ../../diskdrake/hd_gtk.pm_.c:323
-msgid "Ext2"
-msgstr "Ext2"
-
-#: ../../diskdrake/hd_gtk.pm_.c:323
-msgid "FAT"
-msgstr "FAT"
-
-#: ../../diskdrake/hd_gtk.pm_.c:323
-msgid "HFS"
-msgstr "HFS"
-
-#: ../../diskdrake/hd_gtk.pm_.c:323
-#, fuzzy
-msgid "Journalised FS"
-msgstr "marc'hañ sac'het"
-
-#: ../../diskdrake/hd_gtk.pm_.c:323
-msgid "SunOS"
-msgstr "SunOS"
-
-#: ../../diskdrake/hd_gtk.pm_.c:323
-msgid "Swap"
-msgstr "Disloañ"
-
-#: ../../diskdrake/hd_gtk.pm_.c:324 ../../diskdrake/interactive.pm_.c:1105
-msgid "Empty"
-msgstr "Goullo"
-
-#: ../../diskdrake/hd_gtk.pm_.c:324 ../../install_steps_gtk.pm_.c:325
-#: ../../install_steps_gtk.pm_.c:383 ../../mouse.pm_.c:165
-#: ../../services.pm_.c:157 ../../standalone/drakbackup_.c:1756
-msgid "Other"
-msgstr "All"
-
-#: ../../diskdrake/hd_gtk.pm_.c:328
-msgid "Filesystem types:"
-msgstr "Seurt ar reizhiadoù restroù :"
-
-#: ../../diskdrake/hd_gtk.pm_.c:345 ../../diskdrake/interactive.pm_.c:402
-msgid "Create"
-msgstr "Krouiñ"
-
-#: ../../diskdrake/hd_gtk.pm_.c:345 ../../diskdrake/interactive.pm_.c:380
-#: ../../diskdrake/interactive.pm_.c:531 ../../diskdrake/removable.pm_.c:26
-#: ../../diskdrake/removable.pm_.c:49 ../../diskdrake/removable_gtk.pm_.c:17
-msgid "Type"
-msgstr "Seurt"
-
-#: ../../diskdrake/hd_gtk.pm_.c:345 ../../diskdrake/hd_gtk.pm_.c:347
-#, c-format
-msgid "Use ``%s'' instead"
-msgstr "Grit kentoc'h gant ``%s''"
-
-#: ../../diskdrake/hd_gtk.pm_.c:347 ../../diskdrake/interactive.pm_.c:389
-msgid "Delete"
-msgstr "Dilemel"
-
-#: ../../diskdrake/hd_gtk.pm_.c:351
-msgid "Use ``Unmount'' first"
-msgstr "Implijit ``Divarc'hañ'' da gentañ"
-
-#: ../../diskdrake/hd_gtk.pm_.c:352 ../../diskdrake/interactive.pm_.c:518
-#, c-format
-msgid ""
-"After changing type of partition %s, all data on this partition will be lost"
-msgstr ""
-"Goude kemmañ seurt ar parzhadur %s, holl roadoù ar parzhadur-se a vo kollet"
-
-#: ../../diskdrake/interactive.pm_.c:174
-msgid "Choose a partition"
-msgstr "Dibabit un parzhadur"
-
-#: ../../diskdrake/interactive.pm_.c:174
-msgid "Choose another partition"
-msgstr "Dibabit un parzhadur all"
-
-#: ../../diskdrake/interactive.pm_.c:199
-msgid "Exit"
-msgstr "Kuitaat"
-
-#: ../../diskdrake/interactive.pm_.c:221
-msgid "Toggle to expert mode"
-msgstr "Tremen er mod mailh"
-
-#: ../../diskdrake/interactive.pm_.c:221
-msgid "Toggle to normal mode"
-msgstr "Tremen er mod boas"
-
-#: ../../diskdrake/interactive.pm_.c:221
-msgid "Undo"
-msgstr "Dizober"
-
-#: ../../diskdrake/interactive.pm_.c:240
-msgid "Continue anyway?"
-msgstr "Kenderc'hel evelato ?"
-
-#: ../../diskdrake/interactive.pm_.c:245
-msgid "Quit without saving"
-msgstr "Kuitaat hep enrollañ"
-
-#: ../../diskdrake/interactive.pm_.c:245
-msgid "Quit without writing the partition table?"
-msgstr "Kuitaat hep skrivañ an daolenn barzhañ ?"
-
-#: ../../diskdrake/interactive.pm_.c:250
-#, fuzzy
-msgid "Do you want to save /etc/fstab modifications"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../diskdrake/interactive.pm_.c:263
-msgid "Auto allocate"
-msgstr "Ac'hubiñ ent emgefreek"
-
-#: ../../diskdrake/interactive.pm_.c:263
-msgid "Clear all"
-msgstr "Skarañ an holl"
-
-#: ../../diskdrake/interactive.pm_.c:263
-#: ../../install_steps_interactive.pm_.c:214
-#, fuzzy
-msgid "More"
-msgstr "Dilec'hiañ"
-
-#: ../../diskdrake/interactive.pm_.c:267
-#, fuzzy
-msgid "Hard drive information"
-msgstr "Dinoiñ ar bladenn galet"
-
-#: ../../diskdrake/interactive.pm_.c:298
-msgid "All primary partitions are used"
-msgstr "Ac'hubet eo an holl barzhadurioù kentañ renk"
-
-#: ../../diskdrake/interactive.pm_.c:299
-msgid "I can't add any more partition"
-msgstr "N'hellan ouzpennañ parzhadur ebet ken"
-
-#: ../../diskdrake/interactive.pm_.c:300
-msgid ""
-"To have more partitions, please delete one to be able to create an extended "
-"partition"
-msgstr ""
-"Evit kaout muioc'h a barzhadurioù, lamit unan evit ma c'hellot krouiñ ur "
-"parzhadur astennet mar plij"
-
-#: ../../diskdrake/interactive.pm_.c:310
-#, fuzzy
-msgid "Save partition table"
-msgstr "Skrivañ an daolenn barzhañ"
-
-#: ../../diskdrake/interactive.pm_.c:311
-#, fuzzy
-msgid "Restore partition table"
-msgstr "Taolenn barzhañ saveteerezh"
-
-#: ../../diskdrake/interactive.pm_.c:312
-msgid "Rescue partition table"
-msgstr "Taolenn barzhañ saveteerezh"
-
-#: ../../diskdrake/interactive.pm_.c:314
-#, fuzzy
-msgid "Reload partition table"
-msgstr "Taolenn barzhañ saveteerezh"
-
-#: ../../diskdrake/interactive.pm_.c:319
-#, fuzzy
-msgid "Removable media automounting"
-msgstr "Emvarc'hañ ar skoroù lem/laka"
-
-#: ../../diskdrake/interactive.pm_.c:328 ../../diskdrake/interactive.pm_.c:348
-msgid "Select file"
-msgstr "Diuzit ar restr"
-
-#: ../../diskdrake/interactive.pm_.c:335
-msgid ""
-"The backup partition table has not the same size\n"
-"Still continue?"
-msgstr ""
-"N'eo ket heñvel ment an daolenn barzhañ gwarezet\n"
-"Kenderc'hel memestra ?"
-
-#: ../../diskdrake/interactive.pm_.c:349 ../../harddrake/sound.pm_.c:200
-msgid "Warning"
-msgstr "Ho evezh"
-
-#: ../../diskdrake/interactive.pm_.c:350
-msgid ""
-"Insert a floppy in drive\n"
-"All data on this floppy will be lost"
-msgstr ""
-"Lakait ur bladennig el lenner\n"
-"Kollet e vo holl roadoù ar bladennig-se"
-
-#: ../../diskdrake/interactive.pm_.c:361
-msgid "Trying to rescue partition table"
-msgstr "O klask assevel an daolenn barzhañ"
-
-#: ../../diskdrake/interactive.pm_.c:367
-#, fuzzy
-msgid "Detailed information"
-msgstr "Diskouez titouroù"
-
-#: ../../diskdrake/interactive.pm_.c:382 ../../diskdrake/interactive.pm_.c:662
-msgid "Resize"
-msgstr "Adventañ"
-
-#: ../../diskdrake/interactive.pm_.c:383 ../../diskdrake/interactive.pm_.c:715
-msgid "Move"
-msgstr "Dilec'hiañ"
-
-#: ../../diskdrake/interactive.pm_.c:384
-msgid "Format"
-msgstr "Furmadiñ"
-
-#: ../../diskdrake/interactive.pm_.c:386
-msgid "Add to RAID"
-msgstr "Ouzhpennañ da RAID"
-
-#: ../../diskdrake/interactive.pm_.c:387
-msgid "Add to LVM"
-msgstr "Ouzhpennañ da LVM"
-
-#: ../../diskdrake/interactive.pm_.c:390
-msgid "Remove from RAID"
-msgstr "Lemel diwar RAID"
-
-#: ../../diskdrake/interactive.pm_.c:391
-msgid "Remove from LVM"
-msgstr "Lemel diwar LVM"
-
-#: ../../diskdrake/interactive.pm_.c:392
-msgid "Modify RAID"
-msgstr "Kemmañ RAID"
-
-#: ../../diskdrake/interactive.pm_.c:393
-msgid "Use for loopback"
-msgstr "Implij da saveteiñ"
-
-#: ../../diskdrake/interactive.pm_.c:433
-msgid "Create a new partition"
-msgstr "Krouiñ ur parzhadur nevez"
-
-#: ../../diskdrake/interactive.pm_.c:436
-msgid "Start sector: "
-msgstr "Rann kregiñ : "
-
-#: ../../diskdrake/interactive.pm_.c:438 ../../diskdrake/interactive.pm_.c:815
-msgid "Size in MB: "
-msgstr "Ment e Mo : "
-
-#: ../../diskdrake/interactive.pm_.c:439 ../../diskdrake/interactive.pm_.c:816
-msgid "Filesystem type: "
-msgstr "Seurt ar reizhiad restroù : "
-
-#: ../../diskdrake/interactive.pm_.c:444
-msgid "Preference: "
-msgstr "Dibarzh : "
-
-#: ../../diskdrake/interactive.pm_.c:469
-msgid ""
-"You can't create a new partition\n"
-"(since you reached the maximal number of primary partitions).\n"
-"First remove a primary partition and create an extended partition."
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:499
-#, fuzzy
-msgid "Remove the loopback file?"
-msgstr "O furmadiñ ar restr saveteiñ %s"
-
-#: ../../diskdrake/interactive.pm_.c:529
-msgid "Change partition type"
-msgstr "Kemmañ seurt ar parzhadur"
-
-#: ../../diskdrake/interactive.pm_.c:530 ../../diskdrake/removable.pm_.c:48
-#, fuzzy
-msgid "Which filesystem do you want?"
-msgstr "Pe seurt parzhadur a vennit ?"
-
-#: ../../diskdrake/interactive.pm_.c:536
-msgid "Switching from ext2 to ext3"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:566
-#, c-format
-msgid "Where do you want to mount loopback file %s?"
-msgstr "Pelec'h e mennit marc'hañ ar restr saveteiñ %s ?"
-
-#: ../../diskdrake/interactive.pm_.c:567
-#, c-format
-msgid "Where do you want to mount device %s?"
-msgstr "Pelec'h e mennit marc'hañ an drobarzhell %s ?"
-
-#: ../../diskdrake/interactive.pm_.c:573
-msgid ""
-"Can't unset mount point as this partition is used for loop back.\n"
-"Remove the loopback first"
-msgstr ""
-"N'hellan ket dizober ar poent marc'hañ dre m'eo implijet ar parzhadur-se\n"
-"evit saveteiñ. Lamit ar saveteiñ da gentañ"
-
-#: ../../diskdrake/interactive.pm_.c:594
-#, fuzzy, c-format
-msgid "Where do you want to mount %s?"
-msgstr "Pelec'h e mennit marc'hañ an drobarzhell %s ?"
-
-#: ../../diskdrake/interactive.pm_.c:618
-msgid "Computing FAT filesystem bounds"
-msgstr "O jediñ bevennoù ar reizhiad restroù FAT"
-
-#: ../../diskdrake/interactive.pm_.c:618 ../../diskdrake/interactive.pm_.c:677
-#: ../../install_interactive.pm_.c:133
-msgid "Resizing"
-msgstr "Oc'h adventañ"
-
-#: ../../diskdrake/interactive.pm_.c:650
-#, fuzzy
-msgid "This partition is not resizeable"
-msgstr "Pe seurt parzhadur a vennit ?"
-
-#: ../../diskdrake/interactive.pm_.c:655
-msgid "All data on this partition should be backed-up"
-msgstr "Mat e vije gwareziñ holl roadoù ar parzhadur-se"
-
-#: ../../diskdrake/interactive.pm_.c:657
-#, c-format
-msgid "After resizing partition %s, all data on this partition will be lost"
-msgstr "Goude adventañ ar parzhadur %s e vo kollet holl roadoù ar parzhadur-se"
-
-#: ../../diskdrake/interactive.pm_.c:662
-msgid "Choose the new size"
-msgstr "Dibabit ar ment nevez"
-
-#: ../../diskdrake/interactive.pm_.c:663
-msgid "New size in MB: "
-msgstr "Ment nevez e Mo : "
-
-#: ../../diskdrake/interactive.pm_.c:716
-msgid "Which disk do you want to move it to?"
-msgstr "Da beseurt pladenn e mennit dilec'hiañ ?"
-
-#: ../../diskdrake/interactive.pm_.c:717
-msgid "Sector"
-msgstr "Rann"
-
-#: ../../diskdrake/interactive.pm_.c:718
-msgid "Which sector do you want to move it to?"
-msgstr "Da beseurt rann e mennit dilec'hiañ ?"
-
-#: ../../diskdrake/interactive.pm_.c:721
-msgid "Moving"
-msgstr "O tilec'hiañ"
-
-#: ../../diskdrake/interactive.pm_.c:721
-msgid "Moving partition..."
-msgstr "O tilec'hiañ ur parzhadur..."
-
-#: ../../diskdrake/interactive.pm_.c:738
-msgid "Choose an existing RAID to add to"
-msgstr "Dibabit da be RAID ouzhpennañ"
-
-#: ../../diskdrake/interactive.pm_.c:739 ../../diskdrake/interactive.pm_.c:756
-msgid "new"
-msgstr "nevez"
-
-#: ../../diskdrake/interactive.pm_.c:754
-msgid "Choose an existing LVM to add to"
-msgstr "Dibabit da be LVM ouzhpennañ"
-
-#: ../../diskdrake/interactive.pm_.c:759
-msgid "LVM name?"
-msgstr "Anv LVM?"
-
-#: ../../diskdrake/interactive.pm_.c:800
-msgid "This partition can't be used for loopback"
-msgstr "N'heller ket implijout ar parzhadur-mañ evit saveteiñ"
-
-#: ../../diskdrake/interactive.pm_.c:813
-msgid "Loopback"
-msgstr "Saveteiñ"
-
-#: ../../diskdrake/interactive.pm_.c:814
-msgid "Loopback file name: "
-msgstr "Anv ar restr saveteiñ : "
-
-#: ../../diskdrake/interactive.pm_.c:819
-#, fuzzy
-msgid "Give a file name"
-msgstr "Anv gwirion"
-
-#: ../../diskdrake/interactive.pm_.c:822
-msgid "File already used by another loopback, choose another one"
-msgstr "Restr implijet gant ur saveteiñ all endeo, dibabit unan all"
-
-#: ../../diskdrake/interactive.pm_.c:823
-msgid "File already exists. Use it?"
-msgstr "Ar restr a zo endeo. E implijout ?"
-
-#: ../../diskdrake/interactive.pm_.c:846
-msgid "Mount options"
-msgstr "Dibarzhoù marc'hañ"
-
-#: ../../diskdrake/interactive.pm_.c:853
-msgid "Various"
-msgstr "A bep sort"
-
-#: ../../diskdrake/interactive.pm_.c:917 ../../standalone/drakfloppy_.c:104
-msgid "device"
-msgstr "trobarzhell"
-
-#: ../../diskdrake/interactive.pm_.c:918
-msgid "level"
-msgstr "live"
-
-#: ../../diskdrake/interactive.pm_.c:919
-msgid "chunk size"
-msgstr "ment diaoz"
-
-#: ../../diskdrake/interactive.pm_.c:934
-msgid "Be careful: this operation is dangerous."
-msgstr "Bezit war evezh : arvarus eo an obererezh-mañ."
-
-#: ../../diskdrake/interactive.pm_.c:949
-#, fuzzy
-msgid "What type of partitioning?"
-msgstr "Peseurt moullerez hoc'h eus ?"
-
-#: ../../diskdrake/interactive.pm_.c:965
-#, fuzzy, c-format
-msgid "The package %s is needed. Install it?"
-msgstr ""
-"Bremanaet e tle bezañ ar pabak-mañ\n"
-"Ha sur oc'h e mennit e ziuzañ ?"
-
-#: ../../diskdrake/interactive.pm_.c:979
-msgid ""
-"Sorry I won't accept to create /boot so far onto the drive (on a cylinder > "
-"1024).\n"
-"Either you use LILO and it won't work, or you don't use LILO and you don't "
-"need /boot"
-msgstr ""
-"Ma zigarezit na asantiñ krouiñ /boot ken pell war ar bladenn (war ur granenn "
-"> 1024).\n"
-"Pe e implijit LILO ha ne daio ket en-dro, pe ne rit ket ha n'hoc'h eus ket "
-"ezhomm a /boot"
-
-#: ../../diskdrake/interactive.pm_.c:983
-msgid ""
-"The partition you've selected to add as root (/) is physically located "
-"beyond\n"
-"the 1024th cylinder of the hard drive, and you have no /boot partition.\n"
-"If you plan to use the LILO boot manager, be careful to add a /boot partition"
-msgstr ""
-"Lec'hiet eo ar parzhadur hoc'h eus diuzet da ouzphennañ evel gwrizienn (/) "
-"en tu-hont\n"
-"d'ar 1024vet kranenn eus ar bladenn galet, ha n'hoc'h eus ket a barzhadur /"
-"boot.\n"
-"Ma vennit implijout ar merour loc'hañ LILO, taolit pled da ouzhpennañ ur "
-"parzhadur /boot"
-
-#: ../../diskdrake/interactive.pm_.c:989
-msgid ""
-"You've selected a software RAID partition as root (/).\n"
-"No bootloader is able to handle this without a /boot partition.\n"
-"So be careful to add a /boot partition"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1009
-#, c-format
-msgid "Partition table of drive %s is going to be written to disk!"
-msgstr "War-nes bezañ skrivet war bladenn eo taolenn barzhañ an ardivink %s !"
-
-#: ../../diskdrake/interactive.pm_.c:1013
-msgid "You'll need to reboot before the modification can take place"
-msgstr "Ret e vo deoc'h adloc'hañ a-raok ma talvezo ar c'hemm"
-
-#: ../../diskdrake/interactive.pm_.c:1024
-#, c-format
-msgid "After formatting partition %s, all data on this partition will be lost"
-msgstr ""
-"Goude furmadiñ ar parzhadur %s, holl roadoù ar parzhadur-se a vo kollet"
-
-#: ../../diskdrake/interactive.pm_.c:1026
-msgid "Formatting"
-msgstr "O furmadiñ"
-
-#: ../../diskdrake/interactive.pm_.c:1027
-#, c-format
-msgid "Formatting loopback file %s"
-msgstr "O furmadiñ ar restr saveteiñ %s"
-
-#: ../../diskdrake/interactive.pm_.c:1028
-#: ../../install_steps_interactive.pm_.c:459
-#, c-format
-msgid "Formatting partition %s"
-msgstr "O furmadiñ ar parzhadur %s"
-
-#: ../../diskdrake/interactive.pm_.c:1039
-#, fuzzy
-msgid "Hide files"
-msgstr "mkraid sac'het"
-
-#: ../../diskdrake/interactive.pm_.c:1039
-#, fuzzy
-msgid "Move files to the new partition"
-msgstr "Krouiñ ur parzhadur nevez"
-
-#: ../../diskdrake/interactive.pm_.c:1040
-#, c-format
-msgid ""
-"Directory %s already contains data\n"
-"(%s)"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1051
-#, fuzzy
-msgid "Moving files to the new partition"
-msgstr "Krouiñ ur parzhadur nevez"
-
-#: ../../diskdrake/interactive.pm_.c:1055
-#, c-format
-msgid "Copying %s"
-msgstr "Adskrivañ %s"
-
-#: ../../diskdrake/interactive.pm_.c:1059
-#, fuzzy, c-format
-msgid "Removing %s"
-msgstr "Spisterioù"
-
-#: ../../diskdrake/interactive.pm_.c:1069
-#, c-format
-msgid "partition %s is now known as %s"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1090
-#: ../../diskdrake/interactive.pm_.c:1149
-msgid "Device: "
-msgstr "Trobarzhell : "
-
-#: ../../diskdrake/interactive.pm_.c:1091
-#, c-format
-msgid "DOS drive letter: %s (just a guess)\n"
-msgstr "Lizher ar bladenn DOS : %s (diwar varteze hepken)\n"
-
-#: ../../diskdrake/interactive.pm_.c:1095
-#: ../../diskdrake/interactive.pm_.c:1103
-#: ../../diskdrake/interactive.pm_.c:1168
-msgid "Type: "
-msgstr "Seurt : "
-
-#: ../../diskdrake/interactive.pm_.c:1099
-msgid "Name: "
-msgstr "Anv: "
-
-#: ../../diskdrake/interactive.pm_.c:1107
-#, c-format
-msgid "Start: sector %s\n"
-msgstr "O kregiñ : rann %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1108
-#, c-format
-msgid "Size: %s"
-msgstr "Ment: %s"
-
-#: ../../diskdrake/interactive.pm_.c:1110
-#, c-format
-msgid ", %s sectors"
-msgstr ", %s rann"
-
-#: ../../diskdrake/interactive.pm_.c:1112
-#, fuzzy, c-format
-msgid "Cylinder %d to %d\n"
-msgstr "Kranenn %d da granenn %d\n"
-
-#: ../../diskdrake/interactive.pm_.c:1113
-msgid "Formatted\n"
-msgstr "Furmadet\n"
-
-#: ../../diskdrake/interactive.pm_.c:1114
-msgid "Not formatted\n"
-msgstr "Ket furmadet\n"
-
-#: ../../diskdrake/interactive.pm_.c:1115
-msgid "Mounted\n"
-msgstr "Marc'het\n"
-
-#: ../../diskdrake/interactive.pm_.c:1116
-#, c-format
-msgid "RAID md%s\n"
-msgstr "RAID md%s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1118
-#, fuzzy, c-format
-msgid ""
-"Loopback file(s):\n"
-" %s\n"
-msgstr "Restr(où) saveteiñ : %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1119
-msgid ""
-"Partition booted by default\n"
-" (for MS-DOS boot, not for lilo)\n"
-msgstr ""
-"Parzhadur loc'het dre ziouer\n"
-" (evit loc'hañ MS-DOS, ket evit lilo)\n"
-
-#: ../../diskdrake/interactive.pm_.c:1121
-#, c-format
-msgid "Level %s\n"
-msgstr "Live %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1122
-#, c-format
-msgid "Chunk size %s\n"
-msgstr "Ment diaoz %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1123
-#, c-format
-msgid "RAID-disks %s\n"
-msgstr "Pladennoù RAID %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1125
-#, c-format
-msgid "Loopback file name: %s"
-msgstr "Anv ar restr saveteiñ : %s"
-
-#: ../../diskdrake/interactive.pm_.c:1128
-msgid ""
-"\n"
-"Chances are, this partition is\n"
-"a Driver partition, you should\n"
-"probably leave it alone.\n"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1131
-msgid ""
-"\n"
-"This special Bootstrap\n"
-"partition is for\n"
-"dual-booting your system.\n"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1150
-msgid "Read-only"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1151
-#, c-format
-msgid "Size: %s\n"
-msgstr "Ment: %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1152
-#, c-format
-msgid "Geometry: %s cylinders, %s heads, %s sectors\n"
-msgstr "Mentoniezh : %s kranenn, %s penn, %s rann\n"
-
-#: ../../diskdrake/interactive.pm_.c:1153
-msgid "Info: "
-msgstr "Titouroù: "
-
-#: ../../diskdrake/interactive.pm_.c:1154
-#, c-format
-msgid "LVM-disks %s\n"
-msgstr "Pladennoù LVM %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1155
-#, c-format
-msgid "Partition table type: %s\n"
-msgstr "Seurt taolenn barzhañ : %s\n"
-
-#: ../../diskdrake/interactive.pm_.c:1156
-#, fuzzy, c-format
-msgid "on channel %d id %d\n"
-msgstr "war bus %d Nn %d\n"
-
-#: ../../diskdrake/interactive.pm_.c:1186
-#, fuzzy
-msgid "Filesystem encryption key"
-msgstr "Seurt ar reizhiad restroù : "
-
-#: ../../diskdrake/interactive.pm_.c:1187
-msgid "Choose your filesystem encryption key"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1190
-#, fuzzy, c-format
-msgid "This encryption key is too simple (must be at least %d characters long)"
-msgstr "Re eeun eo an tremenger-se (%d arouezenn a zo ret d'an nebeutañ)"
-
-#: ../../diskdrake/interactive.pm_.c:1191
-#, fuzzy
-msgid "The encryption keys do not match"
-msgstr "An tremegerioù ne glot ket"
-
-#: ../../diskdrake/interactive.pm_.c:1194
-msgid "Encryption key"
-msgstr ""
-
-#: ../../diskdrake/interactive.pm_.c:1195
-msgid "Encryption key (again)"
-msgstr ""
-
-#: ../../diskdrake/removable.pm_.c:47
-#, fuzzy
-msgid "Change type"
-msgstr "Kemmañ seurt ar parzhadur"
-
-#
-#: ../../diskdrake/removable_gtk.pm_.c:28
-#, fuzzy
-msgid "Please click on a medium"
-msgstr "Klikit war ur parzhadur mar plij"
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:162
-#, c-format
-msgid "Can't login using username %s (bad password?)"
-msgstr ""
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:166 ../../diskdrake/smbnfs_gtk.pm_.c:175
-#, fuzzy
-msgid "Domain Authentication Required"
-msgstr "Dilesadur"
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:167
-#, fuzzy
-msgid "Another one"
-msgstr "dedennus"
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:167
-#, fuzzy
-msgid "Which username"
-msgstr "Anv arveriad"
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:176
-msgid ""
-"Please enter your username, password and domain name to access this host."
-msgstr ""
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:178 ../../standalone/drakbackup_.c:3529
-#, fuzzy
-msgid "Username"
-msgstr "Anv arveriad"
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:180
-#, fuzzy
-msgid "Domain"
-msgstr "Domani NIS"
-
-#: ../../diskdrake/smbnfs_gtk.pm_.c:200
-#, fuzzy
-msgid "Search servers"
-msgstr "Servijer DNS"
-
-#: ../../fs.pm_.c:545 ../../fs.pm_.c:555 ../../fs.pm_.c:559 ../../fs.pm_.c:563
-#: ../../fs.pm_.c:567 ../../fs.pm_.c:571
-#, c-format
-msgid "%s formatting of %s failed"
-msgstr "furmadiñ er seurt %s eus %s a zo sac'het"
-
-#: ../../fs.pm_.c:608
-#, c-format
-msgid "I don't know how to format %s in type %s"
-msgstr "N'ouzon ket penaos furmadiñ %s er seurt %s"
-
-#: ../../fs.pm_.c:682 ../../fs.pm_.c:725
-#, c-format
-msgid "mounting partition %s in directory %s failed"
-msgstr ""
-
-#: ../../fs.pm_.c:740 ../../partition_table.pm_.c:598
-#, c-format
-msgid "error unmounting %s: %s"
-msgstr "fazi en ur zivarc'hañ %s : %s"
-
-#: ../../fsedit.pm_.c:21
-msgid "simple"
-msgstr "eeun"
-
-#: ../../fsedit.pm_.c:25
-msgid "with /usr"
-msgstr "gant /usr"
-
-#: ../../fsedit.pm_.c:30
-msgid "server"
-msgstr "servijer"
-
-#: ../../fsedit.pm_.c:240
-#, fuzzy, c-format
-msgid ""
-"I can't read the partition table of device %s, it's too corrupted for me :(\n"
-"I can try to go on, erasing over bad partitions (ALL DATA will be lost!).\n"
-"The other solution is to not allow DrakX to modify the partition table.\n"
-"(the error is %s)\n"
-"\n"
-"Do you agree to loose all the partitions?\n"
-msgstr ""
-"N'hellañ ket lenn ho taolenn barzhañ, re vrein eo evidon :(\n"
-"Klask a rin kenderc'hel en ur ziverkañ ar parzhadurioù siek"
-
-#: ../../fsedit.pm_.c:501
-msgid "You can't use JFS for partitions smaller than 16MB"
-msgstr ""
-
-#: ../../fsedit.pm_.c:502
-msgid "You can't use ReiserFS for partitions smaller than 32MB"
-msgstr ""
-
-#: ../../fsedit.pm_.c:521
-msgid "Mount points must begin with a leading /"
-msgstr "Poentoù marc'hañ a rank kregiñ gant /"
-
-#: ../../fsedit.pm_.c:522
-#, c-format
-msgid "There is already a partition with mount point %s\n"
-msgstr "Bez' ez eus ur parzhadur e boent marc'hañ %s endeo\n"
-
-#: ../../fsedit.pm_.c:526
-#, c-format
-msgid "You can't use a LVM Logical Volume for mount point %s"
-msgstr ""
-
-#: ../../fsedit.pm_.c:528
-msgid "This directory should remain within the root filesystem"
-msgstr ""
-
-#: ../../fsedit.pm_.c:530
-msgid ""
-"You need a true filesystem (ext2/ext3, reiserfs, xfs, or jfs) for this mount "
-"point\n"
-msgstr ""
-
-#: ../../fsedit.pm_.c:532
-#, c-format
-msgid "You can't use an encrypted file system for mount point %s"
-msgstr ""
-
-#: ../../fsedit.pm_.c:599
-msgid "Not enough free space for auto-allocating"
-msgstr ""
-
-#: ../../fsedit.pm_.c:601
-msgid "Nothing to do"
-msgstr ""
-
-#: ../../fsedit.pm_.c:694
-#, c-format
-msgid "Error opening %s for writing: %s"
-msgstr "Fazi en ur zigeriñ %s evit skrivañ : %s"
-
-#: ../../harddrake/sound.pm_.c:168
-msgid "No alternative driver"
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:169
-#, c-format
-msgid ""
-"There's no known OSS/ALSA alternative driver for your sound card (%s) which "
-"currently uses \"%s\""
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:171
-#, fuzzy
-msgid "Sound configuration"
-msgstr "Kefluniadur"
-
-#: ../../harddrake/sound.pm_.c:172
-#, c-format
-msgid ""
-"Here you can select an alternative driver (either OSS or ALSA) for your "
-"sound card (%s)."
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:174
-#, c-format
-msgid ""
-"\n"
-"\n"
-"Your card currently use the %s\"%s\" driver (default driver for your card is "
-"\"%s\")"
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:176
-#, fuzzy
-msgid "Driver:"
-msgstr "Servijer"
-
-#: ../../harddrake/sound.pm_.c:181 ../../standalone/drakTermServ_.c:246
-#: ../../standalone/drakbackup_.c:3932 ../../standalone/drakbackup_.c:3965
-#: ../../standalone/drakbackup_.c:3991 ../../standalone/drakbackup_.c:4018
-#: ../../standalone/drakbackup_.c:4045 ../../standalone/drakbackup_.c:4084
-#: ../../standalone/drakbackup_.c:4105 ../../standalone/drakbackup_.c:4132
-#: ../../standalone/drakbackup_.c:4162 ../../standalone/drakbackup_.c:4188
-#: ../../standalone/drakbackup_.c:4213 ../../standalone/drakfont_.c:700
-msgid "Help"
-msgstr "Skoazell"
-
-#: ../../harddrake/sound.pm_.c:183
-msgid "Switching between ALSA and OSS help"
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:184
-msgid ""
-"OSS (Open Sound System) was the first sound API. It's an OS independant "
-"sound API (it's available on most unices systems) but it's a very basic and "
-"limited API.\n"
-"What's more, OSS drivers all reinvent the wheel.\n"
-"\n"
-"ALSA (Advanced Linux Sound Architecture) is a modularized architecture "
-"which\n"
-"supports quite a large range of ISA, USB and PCI cards.\n"
-"\n"
-"It also provides a much higher API than OSS.\n"
-"\n"
-"To use alsa, one can either use:\n"
-"- the old compatibility OSS api\n"
-"- the new ALSA api that provides many enhanced features but requires using "
-"the ALSA library.\n"
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:200
-#, c-format
-msgid ""
-"The old \"%s\" driver is blacklisted.\n"
-"\n"
-"It has been reported to oopses the kernel on unloading.\n"
-"\n"
-"The new \"%s\" driver'll only be used on next bootstrap."
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:203 ../../standalone/drakconnect_.c:301
-#, fuzzy
-msgid "Please Wait... Applying the configuration"
-msgstr "Amprouiñ ar c'hefluniadur"
-
-#: ../../harddrake/sound.pm_.c:203 ../../harddrake/ui.pm_.c:111
-#: ../../interactive.pm_.c:391
-msgid "Please wait"
-msgstr "Gortozit mar plij"
-
-#: ../../harddrake/sound.pm_.c:208
-#, fuzzy
-msgid "No known driver"
-msgstr "Sturier X"
-
-#: ../../harddrake/sound.pm_.c:209
-#, c-format
-msgid "There's no known driver for your sound card (%s)"
-msgstr ""
-
-#: ../../harddrake/sound.pm_.c:212
-#, fuzzy
-msgid "Unkown driver"
-msgstr "Sturier X"
-
-#: ../../harddrake/sound.pm_.c:213
-#, c-format
-msgid ""
-"The \"%s\" driver for your sound card is unlisted\n"
-"\n"
-"Please send the output of the \"lspcidrake -v\" command to\n"
-"<install at mandrakesoft dot com>\n"
-"with subject: unlisted sound driver \"%s\""
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:16
-#, fuzzy
-msgid "Model"
-msgstr "Logodenn"
-
-#: ../../harddrake/ui.pm_.c:16
-#, fuzzy
-msgid "hard disk model"
-msgstr "Memor kartenn (DMA)"
-
-#: ../../harddrake/ui.pm_.c:17
-#, fuzzy
-msgid "Channel"
-msgstr "Nullañ"
-
-#: ../../harddrake/ui.pm_.c:17
-msgid "EIDE/SCSI channel"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:19
-msgid "Bus"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:20
-msgid ""
-"this is the physical bus on which the device is plugged (eg: PCI, USB, ...)"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:21
-#, fuzzy
-msgid "Module"
-msgstr "Logodenn"
-
-#: ../../harddrake/ui.pm_.c:21
-msgid "the module of the GNU/Linux kernel that handle that device"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:22
-msgid "Media class"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:22
-msgid "class of hardware device"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:23 ../../printerdrake.pm_.c:1562
-#, fuzzy
-msgid "Description"
-msgstr "Spisait dibarzhoù"
-
-#: ../../harddrake/ui.pm_.c:23
-msgid "this field describe the device"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:25
-#, fuzzy
-msgid "Bus identification"
-msgstr "Dilesadur"
-
-#: ../../harddrake/ui.pm_.c:26
-msgid ""
-"- PCI and USB devices: this list the vendor, device, subvendor and subdevice "
-"PCI/USB ids"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:28
-msgid "Location on the bus"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:29
-msgid ""
-"- pci devices: this gives the PCI slot, device and function of this card\n"
-"- eide devices: the device is either a slave or a master device\n"
-"- scsi devices: the scsi bus and the scsi device ids"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:32
-#, fuzzy
-msgid "Old device file"
-msgstr "Diuzit ar restr"
-
-#: ../../harddrake/ui.pm_.c:33
-msgid "old static device name used in dev package"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:34
-#, fuzzy
-msgid "New devfs device"
-msgstr "Trobarzhell an dreuzell"
-
-#: ../../harddrake/ui.pm_.c:35
-msgid "new dinamic device name generated by incore kernel devfs"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:36
-#, fuzzy
-msgid "Number of buttons"
-msgstr "2 nozelenn"
-
-#: ../../harddrake/ui.pm_.c:37
-msgid "the vendor name of the device"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:38
-#, fuzzy
-msgid "Alternative drivers"
-msgstr "O voullañ pajenn(où) skrid..."
-
-#: ../../harddrake/ui.pm_.c:39
-msgid "the list of alternative drivers for this sound card"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:63
-#, fuzzy
-msgid "/_Quit"
-msgstr "Kuitaat"
-
-#: ../../harddrake/ui.pm_.c:64 ../../harddrake/ui.pm_.c:65
-#: ../../harddrake/ui.pm_.c:71 ../../harddrake/ui.pm_.c:73
-#: ../../standalone/logdrake_.c:111
-msgid "/_Help"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:65
-#, fuzzy
-msgid "/_Help..."
-msgstr "Skoazell"
-
-#: ../../harddrake/ui.pm_.c:66
-msgid "Harddrake help"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:67
-msgid ""
-"Description of the fields:\n"
-"\n"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:71
-msgid "/_Report Bug"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:73
-#, fuzzy
-msgid "/_About..."
-msgstr "Marc'hañ"
-
-#: ../../harddrake/ui.pm_.c:74
-msgid "About Harddrake"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:75
-msgid ""
-"This is HardDrake, a Mandrake hardware configuration tool.\n"
-"Version:"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:76
-#, fuzzy
-msgid "Author:"
-msgstr "Embrouiñ"
-
-#: ../../harddrake/ui.pm_.c:86
-#, fuzzy
-msgid "Harddrake2 version "
-msgstr "Dinoiñ ar bladenn galet"
-
-#: ../../harddrake/ui.pm_.c:101
-#, fuzzy
-msgid "Detected hardware"
-msgstr "Gwelet titouroù periantel"
-
-#: ../../harddrake/ui.pm_.c:103
-#, fuzzy
-msgid "Information"
-msgstr "Diskouez titouroù"
-
-#: ../../harddrake/ui.pm_.c:106
-#, fuzzy
-msgid "Configure module"
-msgstr "Kefluniañ al logodenn"
-
-#: ../../harddrake/ui.pm_.c:107
-msgid "Run config tool"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:111
-#, fuzzy
-msgid "Detection in progress"
-msgstr "Poent marc'hañ doubl %s"
-
-#: ../../harddrake/ui.pm_.c:148
-msgid "You can configure each parameter of the module here."
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:166
-#, fuzzy, c-format
-msgid "Running \"%s\" ..."
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../harddrake/ui.pm_.c:180
-#, c-format
-msgid "Probing %s class\n"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:201
-msgid "primary"
-msgstr ""
-
-#: ../../harddrake/ui.pm_.c:201
-#, fuzzy
-msgid "secondary"
-msgstr "%d eilenn"
-
-#: ../../harddrake/v4l.pm_.c:15 ../../harddrake/v4l.pm_.c:65
-#, fuzzy
-msgid "Auto-detect"
-msgstr "Dilesadur"
-
-#: ../../harddrake/v4l.pm_.c:66 ../../harddrake/v4l.pm_.c:186
-#, fuzzy
-msgid "Unknown|Generic"
-msgstr "Rummel"
-
-#: ../../harddrake/v4l.pm_.c:98
-msgid "Unknown|CPH05X (bt878) [many vendors]"
-msgstr ""
-
-#: ../../harddrake/v4l.pm_.c:99
-msgid "Unknown|CPH06X (bt878) [many vendors]"
-msgstr ""
-
-#: ../../harddrake/v4l.pm_.c:210
-msgid ""
-"For most modern TV cards, the bttv module of the GNU/Linux kernel just auto-"
-"detect the rights parameters.\n"
-"If your card is misdetected, you can force the right tuner and card types "
-"here. Just select your tv card parameters if needed"
-msgstr ""
-
-#: ../../harddrake/v4l.pm_.c:213
-#, fuzzy
-msgid "Card model:"
-msgstr "Memor kartenn (DMA)"
-
-#: ../../harddrake/v4l.pm_.c:214
-#, fuzzy
-msgid "Tuner type:"
-msgstr "Kemmañ seurt ar parzhadur"
-
-#: ../../harddrake/v4l.pm_.c:215
-msgid "Number of capture buffers:"
-msgstr ""
-
-#: ../../harddrake/v4l.pm_.c:215
-msgid "number of capture buffers for mmap'ed capture"
-msgstr ""
-
-#: ../../harddrake/v4l.pm_.c:217
-#, fuzzy
-msgid "PLL setting:"
-msgstr "O furmadiñ"
-
-#: ../../harddrake/v4l.pm_.c:218
-msgid "Radio support:"
-msgstr ""
-
-#: ../../harddrake/v4l.pm_.c:218
-msgid "enable radio support"
-msgstr ""
-
-#: ../../help.pm_.c:13
-msgid ""
-"GNU/Linux is a multiuser system, and this means that each user can have his\n"
-"own preferences, his own files and so on. You can read the ``User Guide''\n"
-"to learn more this concept. But unlike \"root\", which is the\n"
-"administrator, the users you add here will not be entitled to change\n"
-"anything except their own files and their own configurations. You will have\n"
-"to create at least one regular user for yourself. That account is where you\n"
-"should log in for routine use. Although it is very practical to log in as\n"
-"\"root\" everyday, it may also be very dangerous! The slightest mistake\n"
-"could mean that your system would not work any more. If you make a serious\n"
-"mistake as a regular user, you may only lose some information, but not the\n"
-"entire system.\n"
-"\n"
-"First, you have to enter your real name. This is not mandatory, of course\n"
-"-- as you can actually enter whatever you want. DrakX will then take the\n"
-"first word you have entered in the box and will bring it over to the \"User\n"
-"name\". This is the name this particular user will use to log onto the\n"
-"system. You can change it. You then have to enter a password here. A\n"
-"non-privileged (regular) user's password is not as crucial as the \"root\"\n"
-"one from a security point of view, but that is no reason to neglect it:\n"
-"after all, your files are at risk.\n"
-"\n"
-"If you click on \"Accept user\", you can then add as many as you want. Add\n"
-"a user for each one of the people meant to use that computer. When you are\n"
-"finish adding all the users you want, select \"Done\".\n"
-"\n"
-"Clicking the \"Advanced\" button allows you to change the default \"shell\"\n"
-"for that user (bash by default).\n"
-"\n"
-"When you are finished adding all users, you will be proposed to choose a\n"
-"user which can automatically log into the system when the computer boots\n"
-"up. If you are interested in that feature (and do not care much about local\n"
-"security), choose the desired user and window manager, then click \"Yes\".\n"
-"If you are not interested in this feature, click \"No\"."
-msgstr ""
-
-#: ../../help.pm_.c:48
-msgid ""
-"Listed above are the existing Linux partitions detected on your hard drive.\n"
-"You can keep the choices made by the wizard, they are good for most common\n"
-"installations. If you make any changes, you must at least define a root\n"
-"partition (\"/\"). Do not choose too small a partition or you will not be\n"
-"able to install enough software. If you want to store your data on a\n"
-"separate partition, you will also need to create a \"/home\" partition\n"
-"(only possible if you have more than one Linux partition available).\n"
-"\n"
-"Each partition is listed as follows: \"Name\", \"Capacity\".\n"
-"\n"
-"\"Name\" is structured: \"hard drive type\", \"hard drive number\",\n"
-"\"partition number\" (for example, \"hda1\").\n"
-"\n"
-"\"Hard drive type\" is \"hd\" if your hard drive is an IDE hard drive and\n"
-"\"sd\" if it is a SCSI hard drive.\n"
-"\n"
-"\"Hard drive number\" is always a letter after \"hd\" or \"sd\". For IDE\n"
-"hard drives:\n"
-"\n"
-" * \"a\" means \"master hard drive on the primary IDE controller\";\n"
-"\n"
-" * \"b\" means \"slave hard drive on the primary IDE controller\";\n"
-"\n"
-" * \"c\" means \"master hard drive on the secondary IDE controller\";\n"
-"\n"
-" * \"d\" means \"slave hard drive on the secondary IDE controller\".\n"
-"\n"
-"With SCSI hard drives, an \"a\" means \"lowest SCSI ID\", a \"b\" means\n"
-"\"second lowest SCSI ID\", etc."
-msgstr ""
-
-#: ../../help.pm_.c:79
-msgid ""
-"The Mandrake Linux installation is spread out over several CD-ROMs. DrakX\n"
-"knows if a selected package is located on another CD-ROM and will eject the\n"
-"current CD and ask you to insert a different one as required."
-msgstr ""
-
-#: ../../help.pm_.c:84
-msgid ""
-"It is now time to specify which programs you wish to install on your\n"
-"system. There are thousands of packages available for Mandrake Linux, and\n"
-"you are not supposed to know them all by heart.\n"
-"\n"
-"If you are performing a standard installation from a CD-ROM, you will first\n"
-"be asked to specify the CDs you currently have (in Expert mode only). Check\n"
-"the CD labels and highlight the boxes corresponding to the CDs you have\n"
-"available for installation. Click \"OK\" when you are ready to continue.\n"
-"\n"
-"Packages are sorted in groups corresponding to a particular use of your\n"
-"machine. The groups themselves are sorted into four sections:\n"
-"\n"
-" * \"Workstation\": if you plan to use your machine as a workstation,\n"
-"select one or more of the corresponding groups;\n"
-"\n"
-" * \"Development\": if your machine is to be used for programming, choose\n"
-"the desired group(s);\n"
-"\n"
-" * \"Server\": if your machine is intended to be a server, you will be able\n"
-"to select which of the most common services you wish to install on your\n"
-"machine;\n"
-"\n"
-" * \"Graphical Environment\": finally, this is where you will choose your\n"
-"preferred graphical environment. At least one must be selected if you want\n"
-"to have a graphical workstation!\n"
-"\n"
-"Moving the mouse cursor over a group name will display a short explanatory\n"
-"text about that group. If you unselect all groups when performing a regular\n"
-"installation (by opposition to an upgrade), a dialog will pop up proposing\n"
-"different options for a minimal installation:\n"
-"\n"
-" * \"With X\": install the fewest packages possible to have a working\n"
-"graphical desktop;\n"
-"\n"
-" * \"With basic documentation\": installs the base system plus basic\n"
-"utilities and their documentation. This installation is suitable for\n"
-"setting up a server;\n"
-"\n"
-" * \"Truly minimal install\": will install the strict minimum necessary to\n"
-"get a working Linux system, in command line only. This installation is\n"
-"about 65Mb large.\n"
-"\n"
-"You can check the \"Individual package selection\" box, which is useful if\n"
-"you are familiar with the packages being offered or if you want to have\n"
-"total control over what will be installed.\n"
-"\n"
-"If you started the installation in \"Upgrade\" mode, you can unselect all\n"
-"groups to avoid installing any new package. This is useful to repair or\n"
-"update an existing system."
-msgstr ""
-
-#: ../../help.pm_.c:135
-msgid ""
-"Finally, depending on whether or not you chose to be able to select\n"
-"individual packages, you will be presented a tree containing all packages\n"
-"classified by groups and subgroups. While browsing the tree, you can select\n"
-"entire groups, subgroups, or individual packages.\n"
-"\n"
-"Whenever you select a package on the tree, a description appears on the\n"
-"right. When your selection is finished, click the \"Install\" button which\n"
-"will then launch the installation process. Depending on the speed of your\n"
-"hardware and the number of packages that need to be installed, it may take\n"
-"a while to complete the process. An installation time estimate is displayed\n"
-"on the screen, to help you gauge if there is sufficient time to enjoy a cup\n"
-"of coffee.\n"
-"\n"
-"!! If a server package has been selected, either intentionally or because\n"
-"it was part of a whole group, you will be asked to confirm that you really\n"
-"want those servers to be installed. Under Mandrake Linux, any installed\n"
-"servers are started by default at boot time. Even if they are safe and have\n"
-"no known issues at the time the distribution was shipped, it may happen\n"
-"that security holes are discovered after this version of Mandrake Linux was\n"
-"finalized. If you do not know what a particular service is supposed to do\n"
-"or why it is being installed, then click \"No\". Clicking \"Yes\" will\n"
-"install the listed services and they will be started automatically by\n"
-"default. !!\n"
-"\n"
-"The \"Automatic dependencies\" option simply disables the warning dialog\n"
-"which appears whenever the installer automatically selects a package. This\n"
-"occurs because it has determined that it needs to satisfy a dependency with\n"
-"another package in order to successfully complete the installation.\n"
-"\n"
-"The tiny floppy disk icon at the bottom of the list allows to load the\n"
-"package list chosen during a previous installation. Clicking on this icon\n"
-"will ask you to insert a floppy disk previously created at the end of\n"
-"another installation. See the second tip of the previous step on how to\n"
-"create such a floppy disk."
-msgstr ""
-
-#: ../../help.pm_.c:171
-msgid ""
-"You are now able to set up your Internet/network connection. If you wish to\n"
-"connect your computer to the Internet or to a local network, click \"OK\".\n"
-"The autodetection of network devices and modem will be launched. If this\n"
-"detection fails, uncheck the \"Use auto-detection\" box next time. You may\n"
-"also choose not to configure the network, or do it later; in that case,\n"
-"simply click the \"Cancel\" button.\n"
-"\n"
-"Available connections are: traditional modem, ISDN modem, ADSL connection,\n"
-"cable modem, and finally a simple LAN connection (Ethernet).\n"
-"\n"
-"Here, we will not detail each configuration. Simply make sure that you have\n"
-"all the parameters from your Internet Service Provider or system\n"
-"administrator.\n"
-"\n"
-"You can consult the ``Starter Guide'' chapter about Internet connections\n"
-"for details about the configuration, or simply wait until your system is\n"
-"installed and use the program described there to configure your connection.\n"
-"\n"
-"If you wish to configure the network later after installation, or if you\n"
-"are finished configuring your network connection, click \"Cancel\"."
-msgstr ""
-
-#: ../../help.pm_.c:193
-#, fuzzy
-msgid ""
-"You may now choose which services you wish to start at boot time.\n"
-"\n"
-"Here are listed all the services available with the current installation.\n"
-"Review them carefully and uncheck those which are not always needed at boot\n"
-"time.\n"
-"\n"
-"You can get a short explanatory text about a service by selecting a\n"
-"specific service. However, if you are not sure whether a service is useful\n"
-"or not, it is safer to leave the default behavior.\n"
-"\n"
-"!! At this stage, be very careful if you intend to use your machine as a\n"
-"server: you will probably not want to start any services which you do not\n"
-"need. Please remember that several services can be dangerous if they are\n"
-"enabled on a server. In general, select only the services you really need.\n"
-"!!"
-msgstr ""
-"Bremañ e c'hellit diuz pe servijoù a vennit e vije lañset pa loc'her.\n"
-"Pa zeu ho logodenn war un draez, ul lagadenn skoazell a zeuio war wel hag\n"
-"a zisplego pal ar servij-se.\n"
-"\n"
-"Bezit aketuz-kenañ el lankad-mañ ma vennit implijout ho ardivink evel ur\n"
-"servijer : mennout a rit emichañs chom hep loc'hañ kement servij n'ho peus "
-"ket\n"
-"c'hoant."
-
-#: ../../help.pm_.c:210
-msgid ""
-"GNU/Linux manages time in GMT (Greenwich Mean Time) and translates it in\n"
-"local time according to the time zone you selected. It is however possible\n"
-"to deactivate this by unselecting \"Hardware clock set to GMT\" so that the\n"
-"hardware clock is the same as the system clock. This is useful when the\n"
-"machine is hosting another operating system like Windows.\n"
-"\n"
-"The \"Automatic time synchronization\" option will automatically regulate\n"
-"the clock by connecting to a remote time server on the Internet. In the\n"
-"list that is presented, choose a server located near you. Of course you\n"
-"must have a working Internet connection for this feature to work. It will\n"
-"actually install on your machine a time server which can be optionally used\n"
-"by other machines on your local network."
-msgstr ""
-
-#: ../../help.pm_.c:224
-msgid ""
-"X (for X Window System) is the heart of the GNU/Linux graphical interface\n"
-"on which all the graphical environments (KDE, GNOME, AfterStep,\n"
-"WindowMaker, etc.) bundled with Mandrake Linux rely.\n"
-"\n"
-"You will be presented the list of available resolutions and color depth\n"
-"available for your hardware. Choose the one that best suit your needs (you\n"
-"will be able to change that after installation though). When you are\n"
-"satisfied with the sample shown in the monitor, click \"OK\". A window will\n"
-"then appear and ask you if you can see it.\n"
-"\n"
-"If you are doing an \"Expert\" installation, you will enter the X\n"
-"configuration wizard. See the corresponding section of the manual for more\n"
-"information about this wizard.\n"
-"\n"
-"If you can see the message during the test, and answer \"Yes\", then DrakX\n"
-"will proceed to the next step. If you cannot see the message, it simply\n"
-"means that the configuration was wrong and the test will automatically end\n"
-"after 10 seconds, restoring the screen. Refer then to the video\n"
-"configuration section of the user guide for more information on how to\n"
-"configure your display."
-msgstr ""
-
-#: ../../help.pm_.c:246
-msgid ""
-"Finally, you will be asked whether you want to see the graphical interface\n"
-"at boot. Note this question will be asked even if you chose not to test the\n"
-"configuration. Obviously, you want to answer \"No\" if your machine is to\n"
-"act as a server, or if you were not successful in getting the display\n"
-"configured."
-msgstr ""
-
-#: ../../help.pm_.c:253
-msgid ""
-"The Mandrake Linux CD-ROM has a built-in rescue mode. You can access it by\n"
-"booting from the CD-ROM, press the >>F1<< key at boot and type >>rescue<<\n"
-"at the prompt. But in case your computer cannot boot from the CD-ROM, you\n"
-"should come back to this step for help in at least two situations:\n"
-"\n"
-" * when installing the bootloader, DrakX will rewrite the boot sector (\n"
-"MBR) of your main disk (unless you are using another boot manager), to\n"
-"allow you to start up with either Windows or GNU/Linux (assuming you have\n"
-"Windows in your system). If you need to reinstall Windows, the Microsoft\n"
-"install process will rewrite the boot sector, and then you will not be able\n"
-"to start GNU/Linux!\n"
-"\n"
-" * if a problem arises and you cannot start up GNU/Linux from the hard\n"
-"disk, this floppy disk will be the only means of starting up GNU/Linux. It\n"
-"contains a fair number of system tools for restoring a system, which has\n"
-"crashed due to a power failure, an unfortunate typing error, a typo in a\n"
-"password, or any other reason.\n"
-"\n"
-"If you say \"Yes\", you will be asked to enter a disk inside the drive. The\n"
-"floppy disk you will insert must be empty or contain data which you do not\n"
-"need. You will not have to format it since DrakX will rewrite the whole\n"
-"disk."
-msgstr ""
-
-#: ../../help.pm_.c:277
-msgid ""
-"You now need to choose where you want to install the Mandrake Linux\n"
-"operating system on your hard drive. If your hard drive is empty or if an\n"
-"existing operating system is using all the available space, you will need\n"
-"to partition it. Basically, partitioning a hard drive consists of logically\n"
-"dividing it to create space to install your new Mandrake Linux system.\n"
-"\n"
-"Because the partitioning process' effects are usually irreversible,\n"
-"partitioning can be intimidating and stressful if you are an inexperienced\n"
-"user. Fortunately, there is a wizard which simplifies this process. Before\n"
-"beginning, please consult the manual and take your time.\n"
-"\n"
-"If you are running the installation in Expert mode, you will enter\n"
-"DiskDrake, the Mandrake Linux partitioning tool, which allows you to\n"
-"fine-tune your partitions. See the DiskDrake section in the ``Starter\n"
-"Guide''. From the installation interface, you can use the wizards as\n"
-"described here by clicking the dialog's \"Wizard\" button.\n"
-"\n"
-"If partitions have already been defined, either from a previous\n"
-"installation or from another partitioning tool, simply select those to\n"
-"install your Linux system.\n"
-"\n"
-"If partitions are not defined, you will need to create them using the\n"
-"wizard. Depending on your hard drive configuration, several options are\n"
-"available.\n"
-"\n"
-" * \"Use free space\": this option will simply lead to an automatic\n"
-"partitioning of your blank drive(s). You will not be prompted further;\n"
-"\n"
-" * \"Use existing partition\": the wizard has detected one or more existing\n"
-"Linux partitions on your hard drive. If you want to use them, choose this\n"
-"option. You will then be asked to choose the mount points associated to\n"
-"each of the partitions. The legacy mount points are selected by default,\n"
-"and you should generally keep them.\n"
-"\n"
-" * \"Use the free space on the Windows partition\": if Microsoft Windows is\n"
-"installed on your hard drive and takes all the space available on it, you\n"
-"have to create free space for Linux data. To do so, you can delete your\n"
-"Microsoft Windows partition and data (see ``Erase entire disk'' or ``Expert\n"
-"mode'' solutions) or resize your Microsoft Windows partition. Resizing can\n"
-"be performed without the loss of any data, provided you previously\n"
-"defragment the Windows partition. Backing up your data won't hurt either..\n"
-"This solution is recommended if you want to use both Mandrake Linux and\n"
-"Microsoft Windows on the same computer.\n"
-"\n"
-" Before choosing this option, please understand that after this\n"
-"procedure, the size of your Microsoft Windows partition will be smaller\n"
-"than at the present time. You will have less free space under Microsoft\n"
-"Windows to store your data or to install new software;\n"
-"\n"
-" * \"Erase entire disk\": if you want to delete all data and all partitions\n"
-"present on your hard drive and replace them with your new Mandrake Linux\n"
-"system, choose this option. Be careful with this solution because you will\n"
-"not be able to revert your choice after you confirm;\n"
-"\n"
-" !! If you choose this option, all data on your disk will be lost. !!\n"
-"\n"
-" * \"Remove Windows\": this will simply erase everything on the drive and\n"
-"begin fresh, partitioning everything from scratch. All data on your disk\n"
-"will be lost;\n"
-"\n"
-" !! If you choose this option, all data on your disk will be lost. !!\n"
-"\n"
-" * \"Expert mode\": choose this option if you want to manually partition\n"
-"your hard drive. Be careful -- it is a powerful but dangerous option. You\n"
-"can very easily lose all your data. Hence, do not choose this unless you\n"
-"know what you are doing. To know how to use the DiskDrake utility used\n"
-"here, refer to the section ``Managing Your Partitions'' of the ````Starter\n"
-"Guide''''"
-msgstr ""
-
-#: ../../help.pm_.c:347
-msgid ""
-"There you are. Installation is now completed and your GNU/Linux system is\n"
-"ready to use. Just click \"OK\" to reboot the system. You can start\n"
-"GNU/Linux or Windows, whichever you prefer (if you are dual-booting), as\n"
-"soon as the computer has booted up again.\n"
-"\n"
-"The \"Advanced\" button (in Expert mode only) shows two more buttons to:\n"
-"\n"
-" * \"generate auto-install floppy\": to create an installation floppy disk\n"
-"which will automatically perform a whole installation without the help of\n"
-"an operator, similar to the installation you just configured.\n"
-"\n"
-" Note that two different options are available after clicking the button:\n"
-"\n"
-" * \"Replay\". This is a partially automated installation as the\n"
-"partitioning step (and only this one) remains interactive;\n"
-"\n"
-" * \"Automated\". Fully automated installation: the hard disk is\n"
-"completely rewritten, all data is lost.\n"
-"\n"
-" This feature is very handy when installing a great number of similar\n"
-"machines. See the Auto install section on our web site;\n"
-"\n"
-" * \"Save packages selection\"(*): saves the package selection as done\n"
-"previously. Then, when doing another installation, insert the floppy inside\n"
-"the drive and run the installation going to the help screen by pressing on\n"
-"the [F1] key, and by issuing >>linux defcfg=\"floppy\"<<.\n"
-"\n"
-"(*) You need a FAT-formatted floppy (to create one under GNU/Linux, type\n"
-"\"mformat a:\")"
-msgstr ""
-
-#: ../../help.pm_.c:378
-msgid ""
-"Any partitions that have been newly defined must be formatted for use\n"
-"(formatting means creating a filesystem on it).\n"
-"\n"
-"At this time, you may wish to reformat some already existing partitions to\n"
-"erase any data they contain. If you wish to do that, please select those\n"
-"partitions as well.\n"
-"\n"
-"Please note that it is not necessary to reformat all pre-existing\n"
-"partitions. You must reformat the partitions containing the operating\n"
-"system (such as \"/\", \"/usr\" or \"/var\") but you do not have to\n"
-"reformat partitions containing data that you wish to keep (typically\n"
-"\"/home\").\n"
-"\n"
-"Please be careful when selecting partitions. After formatting, all data on\n"
-"the selected partitions will be deleted and you will not be able to recover\n"
-"it.\n"
-"\n"
-"Click on \"OK\" when you are ready to format partitions.\n"
-"\n"
-"Click on \"Cancel\" if you want to choose another partition for your new\n"
-"Mandrake Linux operating system installation.\n"
-"\n"
-"Click on \"Advanced\" if you wish to select partitions that will be checked\n"
-"for bad blocks on the disk."
-msgstr ""
-
-#: ../../help.pm_.c:404
-#, fuzzy
-msgid ""
-"Your new Mandrake Linux operating system is currently being installed.\n"
-"Depending on the number of packages you will be installing and the speed of\n"
-"your computer, this operation could take from a few minutes to a\n"
-"significant amount of time.\n"
-"\n"
-"Please be patient."
-msgstr "Gortozit mar plij"
-
-#: ../../help.pm_.c:412
-msgid ""
-"At the time you are installing Mandrake Linux, it is likely that some\n"
-"packages have been updated since the initial release. Some bugs may have\n"
-"been fixed, and security issues solved. To allow you to benefit from these\n"
-"updates, you are now able to download them from the Internet. Choose\n"
-"\"Yes\" if you have a working Internet connection, or \"No\" if you prefer\n"
-"to install updated packages later.\n"
-"\n"
-"Choosing \"Yes\" displays a list of places from which updates can be\n"
-"retrieved. Choose the one nearest you. Then a package-selection tree\n"
-"appears: review the selection, and press \"Install\" to retrieve and\n"
-"install the selected package(s), or \"Cancel\" to abort."
-msgstr ""
-
-#: ../../help.pm_.c:425
-msgid ""
-"Before continuing, you should read carefully the terms of the license. It\n"
-"covers the whole Mandrake Linux distribution, and if you do not agree with\n"
-"all the terms included in it, click on the \"Refuse\" button which will\n"
-"immediately terminate the installation. To continue with the installation,\n"
-"click on the \"Accept\" button."
-msgstr ""
-
-#: ../../help.pm_.c:432
-msgid ""
-"At this point, it is time to choose the security level desired for the\n"
-"machine. As a rule of thumb, the more exposed the machine is, and the more\n"
-"the data stored in it is crucial, the higher the security level should be.\n"
-"However, a higher security level is generally obtained at the expense of\n"
-"ease of use. Refer to the \"msec\" chapter of the ``Reference Manual'' to\n"
-"get more information about the meaning of these levels.\n"
-"\n"
-"If you do not know what to choose, keep the default option."
-msgstr ""
-
-#: ../../help.pm_.c:442
-msgid ""
-"At this point, you need to choose which partition(s) will be used for the\n"
-"installation of your Mandrake Linux system. If partitions have already been\n"
-"defined, either from a previous installation of GNU/Linux or from another\n"
-"partitioning tool, you can use existing partitions. Otherwise, hard drive\n"
-"partitions must be defined.\n"
-"\n"
-"To create partitions, you must first select a hard drive. You can select\n"
-"the disk for partitioning by clicking on ``hda'' for the first IDE drive,\n"
-"``hdb'' for the second, ``sda'' for the first SCSI drive and so on.\n"
-"\n"
-"To partition the selected hard drive, you can use these options:\n"
-"\n"
-" * \"Clear all\": this option deletes all partitions on the selected hard\n"
-"drive;\n"
-"\n"
-" * \"Auto allocate\": this option enables to automatically create ext3 and\n"
-"swap partitions on your hard drive's free space;\n"
-"\n"
-"\"More\": gives access to additional features:\n"
-"\n"
-" * \"Save partition table\": saves the partition table to a floppy. Useful\n"
-"for later partition-table recovery, if necessary. It is strongly\n"
-"recommended to perform this step;\n"
-"\n"
-" * \"Restore partition table\": allows to restore a previously saved\n"
-"partition table from a floppy disk;\n"
-"\n"
-" * \"Rescue partition table\": if your partition table is damaged, you can\n"
-"try to recover it using this option. Please be careful and remember that it\n"
-"can fail;\n"
-"\n"
-" * \"Reload partition table\": discards all changes and loads your initial\n"
-"partition table;\n"
-"\n"
-" * \"Removable media automounting\": unchecking this option will force\n"
-"users to manually mount and unmount removable medias such as floppies and\n"
-"CD-ROMs.\n"
-"\n"
-" * \"Wizard\": use this option if you wish to use a wizard to partition\n"
-"your hard drive. This is recommended if you do not have a good knowledge of\n"
-"partitioning;\n"
-"\n"
-" * \"Undo\": use this option to cancel your changes;\n"
-"\n"
-" * \"Toggle to normal/expert mode\": allows additional actions on\n"
-"partitions (type, options, format) and gives more information;\n"
-"\n"
-" * \"Done\": when you are finished partitioning your hard drive, this will\n"
-"save your changes back to disk.\n"
-"\n"
-"Note: you can reach any option using the keyboard. Navigate through the\n"
-"partitions using [Tab] and [Up/Down] arrows.\n"
-"\n"
-"When a partition is selected, you can use:\n"
-"\n"
-" * Ctrl-c to create a new partition (when an empty partition is selected);\n"
-"\n"
-" * Ctrl-d to delete a partition;\n"
-"\n"
-" * Ctrl-m to set the mount point.\n"
-"\n"
-"To get information about the different filesystem types available, please\n"
-"read the ext2FS chapter from the ``Reference Manual''.\n"
-"\n"
-"If you are installing on a PPC machine, you will want to create a small HFS\n"
-"``bootstrap'' partition of at least 1MB, which will be used by the yaboot\n"
-"bootloader. If you opt to make the partition a bit larger, say 50MB, you\n"
-"may find it a useful place to store a spare kernel and ramdisk images for\n"
-"emergency boot situations."
-msgstr ""
-
-#: ../../help.pm_.c:513
-msgid ""
-"More than one Microsoft partition has been detected on your hard drive.\n"
-"Please choose the one you want to resize in order to install your new\n"
-"Mandrake Linux operating system.\n"
-"\n"
-"Each partition is listed as follows: \"Linux name\", \"Windows name\"\n"
-"\"Capacity\".\n"
-"\n"
-"\"Linux name\" is structured: \"hard drive type\", \"hard drive number\",\n"
-"\"partition number\" (for example, \"hda1\").\n"
-"\n"
-"\"Hard drive type\" is \"hd\" if your hard dive is an IDE hard drive and\n"
-"\"sd\" if it is a SCSI hard drive.\n"
-"\n"
-"\"Hard drive number\" is always a letter after \"hd\" or \"sd\". With IDE\n"
-"hard drives:\n"
-"\n"
-" * \"a\" means \"master hard drive on the primary IDE controller\";\n"
-"\n"
-" * \"b\" means \"slave hard drive on the primary IDE controller\";\n"
-"\n"
-" * \"c\" means \"master hard drive on the secondary IDE controller\";\n"
-"\n"
-" * \"d\" means \"slave hard drive on the secondary IDE controller\".\n"
-"\n"
-"With SCSI hard drives, an \"a\" means \"lowest SCSI ID\", a \"b\" means\n"
-"\"second lowest SCSI ID\", etc.\n"
-"\n"
-"\"Windows name\" is the letter of your hard drive under Windows (the first\n"
-"disk or partition is called \"C:\")."
-msgstr ""
-
-#: ../../help.pm_.c:544
-#, fuzzy
-msgid "Please be patient. This operation can take several minutes."
-msgstr "Gortozit mar plij."
-
-#: ../../help.pm_.c:547
-msgid ""
-"DrakX now needs to know if you want to perform a default (\"Recommended\")\n"
-"installation or if you want to have greater control (\"Expert\") over your\n"
-"installation. You can also choose to do a new installation or upgrade your\n"
-"existing Mandrake Linux system:\n"
-"\n"
-" * \"Install\": completely wipes out the old system. However, depending on\n"
-"what is currently installed on your machine, you may be able to keep some\n"
-"old partitions (Linux or otherwise) unchanged;\n"
-"\n"
-" * \"Upgrade\": this installation class allows to simply update the\n"
-"packages currently installed on your Mandrake Linux system. It keeps your\n"
-"hard drives' current partitions as well as user configurations. All other\n"
-"configuration steps remain available, similar to a normal installation;\n"
-"\n"
-" * \"Upgrade Packages Only\": this new installation class allows you to\n"
-"upgrade an existing Mandrake Linux system while keeping all system\n"
-"configurations unchanged. Adding new packages to the current installation\n"
-"is also possible.\n"
-"\n"
-"Upgrades should work fine on Mandrake Linux systems using version \"8.1\"\n"
-"or later.\n"
-"\n"
-"Depending on your GNU/Linux knowledge, select one of the following choices:\n"
-"\n"
-" * Recommended: choose this if you have never installed a GNU/Linux\n"
-"operating system. The installation will be very easy and you will only be\n"
-"asked a few questions;\n"
-"\n"
-" * Expert: if you have a good GNU/Linux understanding, you may wish to\n"
-"perform a highly customized installation. Some of the decisions you will\n"
-"have to make may be difficult if you do not have good GNU/Linux knowledge,\n"
-"so it is not recommended that those without a fair amount of experience\n"
-"select this installation class."
-msgstr ""
-
-#: ../../help.pm_.c:582
-msgid ""
-"Normally, DrakX selects the right keyboard for you (depending on the\n"
-"language you have chosen). However, you might not have a keyboard that\n"
-"corresponds exactly to your language: for example, if you are an English\n"
-"speaking Swiss person, you may still want your keyboard to be a Swiss\n"
-"keyboard. Or if you speak English but are located in Quebec, you may find\n"
-"yourself in the same situation. In both cases, you will have to go back to\n"
-"this installation step and select an appropriate keyboard from the list.\n"
-"\n"
-"Click on the \"More\" button to be presented with the complete list of\n"
-"supported keyboards.\n"
-"\n"
-"If you choose a keyboard layout based on a non-latin alphabet, you will be\n"
-"asked in the next dialog to choose the key binding that will switch the\n"
-"keyboard layout between the latin and non-latin layouts."
-msgstr ""
-
-#: ../../help.pm_.c:598
-msgid ""
-"The first step is to choose your preferred language.\n"
-"\n"
-"Please choose your preferred language for installation and system usage.\n"
-"\n"
-"Clicking on the \"Advanced\" button will allow you to select other\n"
-"languages to be installed on your workstation. Selecting other languages\n"
-"will install the language-specific files for system documentation and\n"
-"applications. For example, if you host users from Spain on your machine,\n"
-"select English as the main language in the tree view and in the Advanced\n"
-"section, click on the box corresponding to \"Spanish|Spain\".\n"
-"\n"
-"Note that multiple languages may be installed. Once you have selected any\n"
-"additional locales, click the \"OK\" button to continue.\n"
-"\n"
-"To switch from one language to the other, you can launch the\n"
-"\"/usr/sbin/localedrake\" command as \"root\" to change the whole system\n"
-"language, or as a simple user to only change that user's default language."
-msgstr ""
-
-#: ../../help.pm_.c:617
-msgid ""
-"DrakX generally detects the number of buttons your mouse possesses. If not,\n"
-"it assumes you have a two-button mouse and will set it up for third-button\n"
-"emulation. DrakX will automatically know whether it is a PS/2, serial or\n"
-"USB mouse.\n"
-"\n"
-"If you wish to specify a different type of mouse, select the appropriate\n"
-"type from the provided list.\n"
-"\n"
-"If you choose a mouse other than the default, a test screen will be\n"
-"displayed. Use the buttons and wheel to verify that the settings are\n"
-"correct. If the mouse is not working well, press the space bar or [Return]\n"
-"to \"Cancel\" and choose again.\n"
-"\n"
-"Sometimes, wheel mouses are not automatically detected. You will need to\n"
-"manually select it in the list. Be sure to select the one corresponding to\n"
-"the correct port it is attached to. After you have pressed the \"OK\"\n"
-"button, a mouse image will be displayed. You then need to move the wheel of\n"
-"your mouse to activate it correctly. Then test that all buttons and\n"
-"movements are correct."
-msgstr ""
-
-#: ../../help.pm_.c:638
-#, fuzzy
-msgid ""
-"Please select the correct port. For example, the \"COM1\" port under\n"
-"Windows is named \"ttyS0\" under GNU/Linux."
-msgstr ""
-"Diuzit ar porzh a zere mar plij. Da skouer, porzh COM1 dindan MS Windows\n"
-"a vez anvet ttyS0 gant Linux."
-
-#: ../../help.pm_.c:642
-msgid ""
-"This is the most crucial decision in regards with the security of your\n"
-"GNU/Linux system: you have to enter the \"root\" password. \"Root\" is the\n"
-"system administrator and is the only one authorized to make updates, add\n"
-"users, change the overall system configuration, and so on. In short,\n"
-"\"root\" can do everything! That is why you must choose a password that is\n"
-"difficult to guess -- DrakX will tell you if it is too easy. As you can\n"
-"see, you can choose not to enter a password, but we strongly advise you\n"
-"against this if only for one reason: do not think that because you booted\n"
-"GNU/Linux that your other operating systems are safe from mistakes. Since\n"
-"\"root\" can overcome all limitations and unintentionally erase all data on\n"
-"partitions by carelessly accessing the partitions themselves, it is\n"
-"important for it to be difficult to become \"root\".\n"
-"\n"
-"The password should be a mixture of alphanumeric characters and at least 8\n"
-"characters long. Never write down the \"root\" password -- it makes it too\n"
-"easy to compromise a system.\n"
-"\n"
-"However, please do not make the password too long or complicated because\n"
-"you must be able to remember it without too much effort.\n"
-"\n"
-"The password will not be displayed on screen as you type it in. Hence, you\n"
-"will have to type the password twice to reduce the chance of a typing\n"
-"error. If you do happen to make the same typing error twice, this\n"
-"``incorrect'' password will have to be used the first time you connect.\n"
-"\n"
-"In Expert mode, you will be asked if you will be connecting to an\n"
-"authentication server, like NIS or LDAP.\n"
-"\n"
-"If your network uses either LDAP, NIS, or PDC Windows Domain authentication\n"
-"services, select the appropriate one as \"authentication\". If you have no\n"
-"clue, ask your network administrator.\n"
-"\n"
-"If your computer is not connected to any administrated network, you will\n"
-"want to choose \"Local files\" for authentication."
-msgstr ""
-
-#: ../../help.pm_.c:678
-msgid ""
-"LILO and grub are GNU/Linux bootloaders. Normally, this stage is totally\n"
-"automated. In fact, DrakX analyzes the disk boot sector and acts\n"
-"accordingly, depending on what it finds there:\n"
-"\n"
-" * if a Windows boot sector is found, it will replace it with a grub/LILO\n"
-"boot sector. Hence, you will be able to load either GNU/Linux or another\n"
-"OS;\n"
-"\n"
-" * if a grub or LILO boot sector is found, it will replace it with a new\n"
-"one.\n"
-"\n"
-"if in doubt, DrakX will display a dialog with various options.\n"
-"\n"
-" * \"Bootloader to use\": you have three choices:\n"
-"\n"
-" * \"GRUB\": if you prefer grub (text menu);\n"
-"\n"
-" * \"LILO with graphical menu\": if you prefer LILO with its graphical\n"
-"interface;\n"
-"\n"
-" * \"LILO with text menu\": if you prefer LILO with its text menu\n"
-"interface.\n"
-"\n"
-" * \"Boot device\": in most cases, you will not change the default\n"
-"(\"/dev/hda\"), but if you prefer, the bootloader can be installed on the\n"
-"second hard drive (\"/dev/hdb\"), or even on a floppy disk (\"/dev/fd0\");\n"
-"\n"
-" * \"Delay before booting the default image\": when rebooting the computer,\n"
-"this is the delay granted to the user to choose -- in the bootloader menu,\n"
-"another boot entry than the default one.\n"
-"\n"
-"!! Beware that if you choose not to install a bootloader (by selecting\n"
-"\"Cancel\" here), you must ensure that you have a way to boot your Mandrake\n"
-"Linux system! Also, be sure you know what you do before changing any of the\n"
-"options. !!\n"
-"\n"
-"Clicking the \"Advanced\" button in this dialog will offer many advanced\n"
-"options, which are reserved for the expert user."
-msgstr ""
-
-#: ../../help.pm_.c:718
-#, fuzzy
-msgid ""
-"After you have configured the general bootloader parameters, the list of\n"
-"boot options which will be available at boot time will be displayed.\n"
-"\n"
-"If there is another operating system installed on your machine, it will\n"
-"automatically be added to the boot menu. Here, you can choose to fine-tune\n"
-"the existing options. Select an entry and click \"Modify\" to modify or\n"
-"remove it. \"Add\" creates a new entry. and \"Done\" goes on to the next\n"
-"installation step.\n"
-"\n"
-"You may also not want to give access to these other operating systems to\n"
-"anyone. In which case, you can delete the corresponding entries. But then,\n"
-"you will need a boot disk in order to boot those other operating systems!"
-msgstr ""
-"LILO (the LInux LOader) ha Grub a zo kargerien loc'hañ : barrek int da "
-"loc'hañ\n"
-"pe Linux pe forzh pe reizhiad korvoiñ all bezañt war ho urzhiataer.\n"
-"Peurvuiañ, ar reizhiadoù korvoiñ all-se a vez dinoet ha staliet reizh.\n"
-"Ma n'eo ket kont evel-hen, gallout a rit ouzhpennañ un enmont gant an dorn\n"
-"er skramm-mañ. Taolit pled da zibab an arventennoù reizh.\n"
-"\n"
-"\n"
-"Gallout a rafec'h ivez mennout na lakaat hegerz hini ebet eus ar reizhiadoù\n"
-"korvoiñ-se, neuze n'hoc'h eus ken nemet dilemel an enmontoù a zegouezh. "
-"Hogen\n"
-"neuze e vo ret deoc'h kaout ur bladennig loc'hañ evit loc'hañ anezho."
-
-#: ../../help.pm_.c:732
-#, fuzzy
-msgid ""
-"You must indicate where you wish to place the information required to boot\n"
-"GNU/Linux.\n"
-"\n"
-"Unless you know exactly what you are doing, choose \"First sector of drive\n"
-"(MBR)\"."
-msgstr ""
-"Ret eo deoc'h menegiñ pelec'h e mennit\n"
-"lec'hiañ an titouroù ret evit loc'hañ Linux.\n"
-"\n"
-"\n"
-"Nemet ma ouifec'h resis ar pezh a rit, dibabit \"Rann gentañ\n"
-"ar bladenn (MBR)\"."
-
-#: ../../help.pm_.c:739
-msgid ""
-"Here, we select a printing system for your computer. Other OSes may offer\n"
-"you one, but Mandrake Linux offers two.\n"
-"\n"
-" * \"pdq\" -- which means ``print, don't queue'', is the choice if you have\n"
-"a direct connection to your printer and you want to be able to panic out of\n"
-"printer jams, and you do not have networked printers. It will handle only\n"
-"very simple network cases and is somewhat slow for networks. Pick \"pdq\"\n"
-"if this is your first voyage to GNU/Linux. You can change your choices\n"
-"after installation by running PrinterDrake from the Mandrake Control Center\n"
-"and clicking the expert button.\n"
-"\n"
-" * \"CUPS\" -- ``Common Unix Printing System'', is excellent at printing to\n"
-"your local printer and also halfway-around the planet. It is simple and can\n"
-"act as a server or a client for the ancient \"lpd\" printing system. Hence,\n"
-"it is compatible with the systems that went before. It can do many tricks,\n"
-"but the basic setup is almost as easy as \"pdq\". If you need this to\n"
-"emulate an \"lpd\" server, you must turn on the \"cups-lpd\" daemon. It has\n"
-"graphical front-ends for printing or choosing printer options."
-msgstr ""
-
-#: ../../help.pm_.c:759
-msgid ""
-"DrakX now detects any IDE device present in your computer. It will also\n"
-"scan for one or more PCI SCSI cards on your system. If a SCSI card is\n"
-"found, DrakX will automatically install the appropriate driver.\n"
-"\n"
-"Because hardware detection does not always detect a piece of hardware,\n"
-"DrakX will ask you to confirm if a PCI SCSI card is present. Click \"Yes\"\n"
-"if you know that there is a SCSI card installed in your machine. You will\n"
-"be presented with a list of SCSI cards to choose from. Click \"No\" if you\n"
-"have no SCSI hardware. If you are unsure, you can check the list of\n"
-"hardware detected in your machine by selecting \"See hardware info\" and\n"
-"clicking \"OK\". Examine the hardware list and then click on the \"OK\"\n"
-"button to return to the SCSI interface question.\n"
-"\n"
-"If you have to manually specify your adapter, DrakX will ask if you want to\n"
-"specify options for it. You should allow DrakX to probe the hardware for\n"
-"the card-specific options which the hardware needs to initialize. This\n"
-"usually works well.\n"
-"\n"
-"If DrakX is not able to probe for the options which need to be passed, you\n"
-"will need to manually provide options to the driver."
-msgstr ""
-
-#: ../../help.pm_.c:781
-msgid ""
-"You can add additional entries for yaboot, either for other operating\n"
-"systems, alternate kernels, or for an emergency boot image.\n"
-"\n"
-"For other OSes, the entry consists only of a label and the \"root\"\n"
-"partition.\n"
-"\n"
-"For Linux, there are a few possible options:\n"
-"\n"
-" * Label: this is simply the name you will have to type at the yaboot\n"
-"prompt to select this boot option;\n"
-"\n"
-" * Image: this would be the name of the kernel to boot. Typically, vmlinux\n"
-"or a variation of vmlinux with an extension;\n"
-"\n"
-" * Root: the \"root\" device or ``/'' for your Linux installation;\n"
-"\n"
-" * Append: on Apple hardware, the kernel append option is used quite often\n"
-"to assist in initializing video hardware, or to enable keyboard mouse\n"
-"button emulation for the often lacking 2nd and 3rd mouse buttons on a stock\n"
-"Apple mouse. The following are some examples:\n"
-"\n"
-" video=aty128fb:vmode:17,cmode:32,mclk:71 adb_buttons=103,111\n"
-"hda=autotune\n"
-"\n"
-" video=atyfb:vmode:12,cmode:24 adb_buttons=103,111\n"
-"\n"
-" * Initrd: this option can be used either to load initial modules, before\n"
-"the boot device is available, or to load a ramdisk image for an emergency\n"
-"boot situation;\n"
-"\n"
-" * Initrd-size: the default ramdisk size is generally 4,096 bytes. If you\n"
-"need to allocate a large ramdisk, this option can be used;\n"
-"\n"
-" * Read-write: normally the \"root\" partition is initially brought up in\n"
-"read-only, to allow a filesystem check before the system becomes ``live''.\n"
-"Here, you can override this option;\n"
-"\n"
-" * NoVideo: should the Apple video hardware prove to be exceptionally\n"
-"problematic, you can select this option to boot in ``novideo'' mode, with\n"
-"native frame buffer support;\n"
-"\n"
-" * Default: selects this entry as being the default Linux selection,\n"
-"selectable by just pressing ENTER at the yaboot prompt. This entry will\n"
-"also be highlighted with a ``*'', if you press [Tab] to see the boot\n"
-"selections."
-msgstr ""
-
-#: ../../help.pm_.c:828
-msgid ""
-"Yaboot is a bootloader for NewWorld MacIntosh hardware. It is able to boot\n"
-"either GNU/Linux, MacOS or MacOSX if present on your computer. Normally,\n"
-"these other operating systems are correctly detected and installed. If this\n"
-"is not the case, you can add an entry by hand in this screen. Be careful to\n"
-"choose the correct parameters.\n"
-"\n"
-"Yaboot's main options are:\n"
-"\n"
-" * Init Message: a simple text message displayed before the boot prompt;\n"
-"\n"
-" * Boot Device: indicates where you want to place the information required\n"
-"to boot to GNU/Linux. Generally, you set up a bootstrap partition earlier\n"
-"to hold this information;\n"
-"\n"
-" * Open Firmware Delay: unlike LILO, there are two delays available with\n"
-"yaboot. The first delay is measured in seconds and at this point, you can\n"
-"choose between CD, OF boot, MacOS or Linux;\n"
-"\n"
-" * Kernel Boot Timeout: this timeout is similar to the LILO boot delay.\n"
-"After selecting Linux, you will have this delay in 0.1 second before your\n"
-"default kernel description is selected;\n"
-"\n"
-" * Enable CD Boot?: checking this option allows you to choose ``C'' for CD\n"
-"at the first boot prompt;\n"
-"\n"
-" * Enable OF Boot?: checking this option allows you to choose ``N'' for\n"
-"Open Firmware at the first boot prompt;\n"
-"\n"
-" * Default OS: you can select which OS will boot by default when the Open\n"
-"Firmware Delay expires."
-msgstr ""
-
-#: ../../help.pm_.c:860
-msgid ""
-"Here are presented various parameters concerning your machine. Depending on\n"
-"your installed hardware, you may (or may not), see the following entries:\n"
-"\n"
-" * \"Mouse\": check the current mouse configuration and click on the button\n"
-"to change it if necessary;\n"
-"\n"
-" * \"Keyboard\": check the current keyboard map configuration and click on\n"
-"the button to change that if necessary;\n"
-"\n"
-" * \"Timezone\": DrakX, by default, guesses your time zone from the\n"
-"language you have chosen. But here again, as for the choice of a keyboard,\n"
-"you may not be in the country for which the chosen language should\n"
-"correspond. Hence, you may need to click on the \"Timezone\" button in\n"
-"order to configure the clock according to the time zone you are in;\n"
-"\n"
-" * \"Printer\": clicking on the \"No Printer\" button will open the printer\n"
-"configuration wizard. Consult the correpsonding chapter of the ``Starter\n"
-"Guide'' for more information on how to setup a new printer. The interface\n"
-"presented there is similar to the one used at installation time;\n"
-"\n"
-" * \"Sound card\": if a sound card is detected on your system, it will be\n"
-"displayed here. No modification possible at installation time;\n"
-"\n"
-" * \"TV card\": if a TV card is detected on your system, it will be\n"
-"displayed here. No modification possible at installation time;\n"
-"\n"
-" * \"ISDN card\": if an ISDN card is detected on your system, it will be\n"
-"displayed here. You can click on the button to change the parameters\n"
-"associated to it."
-msgstr ""
-
-#: ../../help.pm_.c:891
-msgid ""
-"Choose the hard drive you want to erase in order to install your new\n"
-"Mandrake Linux partition. Be careful, all data present on it will be lost\n"
-"and will not be recoverable!"
-msgstr ""
-
-#: ../../help.pm_.c:896
-msgid ""
-"Click on \"OK\" if you want to delete all data and partitions present on\n"
-"this hard drive. Be careful, after clicking on \"OK\", you will not be able\n"
-"to recover any data and partitions present on this hard drive, including\n"
-"any Windows data.\n"
-"\n"
-"Click on \"Cancel\" to stop this operation without losing any data and\n"
-"partitions present on this hard drive."
-msgstr ""
-
-#: ../../install2.pm_.c:111
-#, c-format
-msgid ""
-"Can't access kernel modules corresponding to your kernel (file %s is "
-"missing), this generally means your boot floppy in not in sync with the "
-"Installation medium (please create a newer boot floppy)"
-msgstr ""
-
-#: ../../install2.pm_.c:167
-#, c-format
-msgid "You must also format %s"
-msgstr ""
-
-#: ../../install_any.pm_.c:423
-#, c-format
-msgid ""
-"You have selected the following server(s): %s\n"
-"\n"
-"\n"
-"These servers are activated by default. They don't have any known security\n"
-"issues, but some new could be found. In that case, you must make sure to "
-"upgrade\n"
-"as soon as possible.\n"
-"\n"
-"\n"
-"Do you really want to install these servers?\n"
-msgstr ""
-
-#: ../../install_any.pm_.c:441
-#, c-format
-msgid ""
-"The following packages will be removed to allow upgrading your system: %s\n"
-"\n"
-"\n"
-"Do you really want to remove these packages?\n"
-msgstr ""
-
-#: ../../install_any.pm_.c:471
-msgid "Can't use broadcast with no NIS domain"
-msgstr "N'hellañ ket implijout ar skignañ hep domani NIS"
-
-#: ../../install_any.pm_.c:870
-#, fuzzy, c-format
-msgid "Insert a FAT formatted floppy in drive %s"
-msgstr "Lakait ur bladennig el lenner %s"
-
-#: ../../install_any.pm_.c:874
-msgid "This floppy is not FAT formatted"
-msgstr ""
-
-#: ../../install_any.pm_.c:886
-msgid ""
-"To use this saved packages selection, boot installation with ``linux "
-"defcfg=floppy''"
-msgstr ""
-
-#: ../../install_any.pm_.c:909 ../../partition_table.pm_.c:767
-#, c-format
-msgid "Error reading file %s"
-msgstr "Fazi en ur lenn ar restr %s"
-
-#: ../../install_any.pm_.c:1031
-msgid ""
-"An error occurred - no valid devices were found on which to create new "
-"filesystems. Please check your hardware for the cause of this problem"
-msgstr ""
-"C'hoarvezet ez eus ur fazi - n'eus bet kavet trobarzhell reizh ebet a-benn "
-"krouiñ reizhiadoù restroù nevez warni. Gwiriit abeg ar gudenn-mañ en ho "
-"ardivinkaj mar plij "
-
-#: ../../install_interactive.pm_.c:23
-#, c-format
-msgid ""
-"Some hardware on your computer needs ``proprietary'' drivers to work.\n"
-"You can find some information about them at: %s"
-msgstr ""
-
-#: ../../install_interactive.pm_.c:58
-msgid ""
-"You must have a root partition.\n"
-"For this, create a partition (or click on an existing one).\n"
-"Then choose action ``Mount point'' and set it to `/'"
-msgstr ""
-"Ret eo deoc'h kaout ur parzhadur gwrizienn.\n"
-"Evit se, krouit ur parzhadur (pe glikit war unan a zo c'hoazh).\n"
-"Da c'houde dibabit an ober ``Poent marc'hañ'' ha lakait anezhañ da `/'"
-
-#: ../../install_interactive.pm_.c:63
-msgid "You must have a swap partition"
-msgstr "Ret eo deoc'h kaout ur parzhadur disloañ"
-
-#: ../../install_interactive.pm_.c:64
-msgid ""
-"You don't have a swap partition.\n"
-"\n"
-"Continue anyway?"
-msgstr ""
-"N'hoc'h eus ket a barzhadur disloañ\n"
-"\n"
-"Kenderc'hel evelato ?"
-
-#: ../../install_interactive.pm_.c:67 ../../install_steps.pm_.c:169
-#, fuzzy
-msgid "You must have a FAT partition mounted in /boot/efi"
-msgstr "Ret eo deoc'h kaout ur parzhadur disloañ"
-
-#: ../../install_interactive.pm_.c:92
-#, fuzzy
-msgid "Use free space"
-msgstr "Implij da saveteiñ"
-
-#: ../../install_interactive.pm_.c:94
-msgid "Not enough free space to allocate new partitions"
-msgstr ""
-
-#: ../../install_interactive.pm_.c:102
-#, fuzzy
-msgid "Use existing partitions"
-msgstr "O furmadiñ parzhadurioù"
-
-#: ../../install_interactive.pm_.c:104
-#, fuzzy
-msgid "There is no existing partition to use"
-msgstr "O klask assevel an daolenn barzhañ"
-
-#: ../../install_interactive.pm_.c:111
-#, fuzzy
-msgid "Use the Windows partition for loopback"
-msgstr "Implij da saveteiñ"
-
-#: ../../install_interactive.pm_.c:114
-#, fuzzy
-msgid "Which partition do you want to use for Linux4Win?"
-msgstr "Pe barzhadur a vennit implijout evit lakaat Linux4Win ?"
-
-#: ../../install_interactive.pm_.c:116
-msgid "Choose the sizes"
-msgstr "Dibabit ar mentoù"
-
-#: ../../install_interactive.pm_.c:117
-msgid "Root partition size in MB: "
-msgstr "Ment ar parzhadur gwrizienn e Mo : "
-
-#: ../../install_interactive.pm_.c:118
-msgid "Swap partition size in MB: "
-msgstr "Ment ar parzhadur disloañ e Mo : "
-
-#: ../../install_interactive.pm_.c:128
-msgid "Use the free space on the Windows partition"
-msgstr ""
-
-#: ../../install_interactive.pm_.c:131
-#, fuzzy
-msgid "Which partition do you want to resize?"
-msgstr "Pe seurt parzhadur a vennit ?"
-
-#: ../../install_interactive.pm_.c:133
-#, fuzzy
-msgid "Resizing Windows partition"
-msgstr "O jediñ bevennoù ar reizhiad restroù FAT"
-
-#: ../../install_interactive.pm_.c:136
-#, c-format
-msgid ""
-"The FAT resizer is unable to handle your partition, \n"
-"the following error occured: %s"
-msgstr ""
-
-#: ../../install_interactive.pm_.c:139
-msgid ""
-"Your Windows partition is too fragmented. Please reboot your computer under "
-"Windows, run the ``defrag'' utility, then restart the Mandrake Linux "
-"installation."
-msgstr ""
-
-#: ../../install_interactive.pm_.c:140
-#, fuzzy
-msgid ""
-"WARNING!\n"
-"\n"
-"DrakX will now resize your Windows partition. Be careful:\n"
-"this operation is dangerous. If you have not already done\n"
-"so, you should first exit the installation, run scandisk\n"
-"under Windows (and optionally run defrag), then restart the\n"
-"installation. You should also backup your data.\n"
-"When sure, press Ok."
-msgstr ""
-"HO EVEZH !\n"
-"\n"
-"Ezhomm en deus DrakX adventañ ho parzhadur Windows bremañ. Bezit war "
-"evezh :\n"
-"arvarus eo an obererezh-se. Ma n'hoc'h eus ket graet c'hoazh, gwelloc'h e\n"
-"vije deoc'h seveniñ da gentañ scandisk (ha diouzh ret seveniñ defrag) war "
-"ar\n"
-"parzhadur-se, ha gwareziñ ho roadoù. Pa vezit sur, gwaskit \"Mat eo\""
-
-#: ../../install_interactive.pm_.c:150
-#, fuzzy
-msgid "Which size do you want to keep for Windows on"
-msgstr "Da beseurt rann e mennit dilec'hiañ ?"
-
-#: ../../install_interactive.pm_.c:151
-#, c-format
-msgid "partition %s"
-msgstr "parzhadur %s"
-
-#: ../../install_interactive.pm_.c:158
-#, fuzzy, c-format
-msgid "FAT resizing failed: %s"
-msgstr "Adventañ ent emgefreek sac'het"
-
-#: ../../install_interactive.pm_.c:173
-msgid ""
-"There is no FAT partition to resize or to use as loopback (or not enough "
-"space left)"
-msgstr ""
-
-#: ../../install_interactive.pm_.c:179
-msgid "Erase entire disk"
-msgstr "Chetan an holl planedenn"
-
-#: ../../install_interactive.pm_.c:179
-msgid "Remove Windows(TM)"
-msgstr "Chetan Windows(TM)"
-
-#: ../../install_interactive.pm_.c:182
-msgid "You have more than one hard drive, which one do you install linux on?"
-msgstr ""
-
-#: ../../install_interactive.pm_.c:185
-#, fuzzy, c-format
-msgid "ALL existing partitions and their data will be lost on drive %s"
-msgstr "Goude adventañ ar parzhadur %s e vo kollet holl roadoù ar parzhadur-se"
-
-#: ../../install_interactive.pm_.c:193
-#, fuzzy
-msgid "Custom disk partitioning"
-msgstr "O furmadiñ parzhadurioù"
-
-#: ../../install_interactive.pm_.c:197
-msgid "Use fdisk"
-msgstr "Implijit fdisk"
-
-#: ../../install_interactive.pm_.c:200
-#, fuzzy, c-format
-msgid ""
-"You can now partition %s.\n"
-"When you are done, don't forget to save using `w'"
-msgstr ""
-"Gallout a rit bremañ parzhañ ho pladenn galet %s\n"
-"Pa 'z eo graet, na zisoñjit ket enrollañ dre implijout `w'"
-
-#: ../../install_interactive.pm_.c:229
-#, fuzzy
-msgid "You don't have enough free space on your Windows partition"
-msgstr "N'hoc'h eus parzhadur windows ebet !"
-
-#: ../../install_interactive.pm_.c:245
-#, fuzzy
-msgid "I can't find any room for installing"
-msgstr "N'hellan ouzpennañ parzhadur ebet ken"
-
-#: ../../install_interactive.pm_.c:248
-msgid "The DrakX Partitioning wizard found the following solutions:"
-msgstr ""
-
-#: ../../install_interactive.pm_.c:252
-#, fuzzy, c-format
-msgid "Partitioning failed: %s"
-msgstr "Seurt taolenn barzhañ : %s\n"
-
-#: ../../install_interactive.pm_.c:262
-msgid "Bringing up the network"
-msgstr "O lañsañ ar rouedad"
-
-#: ../../install_interactive.pm_.c:267
-msgid "Bringing down the network"
-msgstr "O tizenaouiñ ar rouedad"
-
-#: ../../install_steps.pm_.c:76
-msgid ""
-"An error occurred, but I don't know how to handle it nicely.\n"
-"Continue at your own risk."
-msgstr ""
-"Degouezhet ez eus ur fazi, hogen n'ouzon ket e verañ naet.\n"
-"Kendalc'hit war ho mar."
-
-#: ../../install_steps.pm_.c:211
-#, c-format
-msgid "Duplicate mount point %s"
-msgstr "Poent marc'hañ doubl %s"
-
-#: ../../install_steps.pm_.c:380
-msgid ""
-"Some important packages didn't get installed properly.\n"
-"Either your cdrom drive or your cdrom is defective.\n"
-"Check the cdrom on an installed computer using \"rpm -qpl Mandrake/RPMS/*.rpm"
-"\"\n"
-msgstr ""
-
-#: ../../install_steps.pm_.c:452
-#, c-format
-msgid "Welcome to %s"
-msgstr "Degemer e %s"
-
-#: ../../install_steps.pm_.c:542 ../../install_steps.pm_.c:781
-msgid "No floppy drive available"
-msgstr "Lenner pladennig hegerz ebet"
-
-#: ../../install_steps_auto_install.pm_.c:76
-#: ../../install_steps_stdio.pm_.c:22
-#, c-format
-msgid "Entering step `%s'\n"
-msgstr "O kregiñ gant al lankad `%s'\n"
-
-#: ../../install_steps_gtk.pm_.c:150
-msgid ""
-"Your system is low on resources. You may have some problem installing\n"
-"Mandrake Linux. If that occurs, you can try a text install instead. For "
-"this,\n"
-"press `F1' when booting on CDROM, then enter `text'."
-msgstr ""
-
-#: ../../install_steps_gtk.pm_.c:161 ../../install_steps_interactive.pm_.c:231
-msgid "Install Class"
-msgstr "Renkad staliañ"
-
-#: ../../install_steps_gtk.pm_.c:164
-#, fuzzy
-msgid "Please choose one of the following classes of installation:"
-msgstr "Dibabit unan eus ar renkadoù staliañ a-heul mar plij :"
-
-#: ../../install_steps_gtk.pm_.c:237 ../../install_steps_interactive.pm_.c:676
-msgid "Package Group Selection"
-msgstr "Diuzadenn strollad pakadoù"
-
-#: ../../install_steps_gtk.pm_.c:270 ../../install_steps_interactive.pm_.c:691
-msgid "Individual package selection"
-msgstr "Diuz pakadoù unan hag unan"
-
-#: ../../install_steps_gtk.pm_.c:293 ../../install_steps_interactive.pm_.c:614
-#, c-format
-msgid "Total size: %d / %d MB"
-msgstr "Ment hollek : %d / %d Mo"
-
-#: ../../install_steps_gtk.pm_.c:335
-msgid "Bad package"
-msgstr "Pakad siek"
-
-#: ../../install_steps_gtk.pm_.c:336
-#, c-format
-msgid "Name: %s\n"
-msgstr "Anv : %s\n"
-
-#: ../../install_steps_gtk.pm_.c:337
-#, c-format
-msgid "Version: %s\n"
-msgstr "Stumm : %s\n"
-
-#: ../../install_steps_gtk.pm_.c:338
-#, c-format
-msgid "Size: %d KB\n"
-msgstr "Ment : %d Ko\n"
-
-#: ../../install_steps_gtk.pm_.c:339
-#, c-format
-msgid "Importance: %s\n"
-msgstr "Talvoudegezh : %s\n"
-
-#: ../../install_steps_gtk.pm_.c:361
-#, fuzzy
-msgid ""
-"You can't select this package as there is not enough space left to install it"
-msgstr "N'hellit ket andiuz ar pakad-mañ. Staliet eo endo"
-
-#: ../../install_steps_gtk.pm_.c:366
-#, fuzzy
-msgid "The following packages are going to be installed"
-msgstr "Ar pakadoù a-heul a zo war-nes bezañ distaliet"
-
-#: ../../install_steps_gtk.pm_.c:367
-#, fuzzy
-msgid "The following packages are going to be removed"
-msgstr "Ar pakadoù a-heul a zo war-nes bezañ staliet/lamet"
-
-#: ../../install_steps_gtk.pm_.c:379
-msgid "You can't select/unselect this package"
-msgstr "N'hellit ket diuz/andiuz ar pakad-mañ"
-
-#: ../../install_steps_gtk.pm_.c:391
-msgid "This is a mandatory package, it can't be unselected"
-msgstr "Hemañ a zo ur pakad ret, n'hell ket bezañ andiuzet"
-
-#: ../../install_steps_gtk.pm_.c:393
-msgid "You can't unselect this package. It is already installed"
-msgstr "N'hellit ket andiuz ar pakad-mañ. Staliet eo endo"
-
-#: ../../install_steps_gtk.pm_.c:396
-msgid ""
-"This package must be upgraded.\n"
-"Are you sure you want to deselect it?"
-msgstr ""
-"Bremanaet e tle bezañ ar pabak-mañ\n"
-"Ha sur oc'h e mennit e ziuzañ ?"
-
-#: ../../install_steps_gtk.pm_.c:399
-msgid "You can't unselect this package. It must be upgraded"
-msgstr "N'hellit ket andiuz ar pakad-mañ. Ret eo dezhañ bezañ bremanaet"
-
-#: ../../install_steps_gtk.pm_.c:404
-msgid "Show automatically selected packages"
-msgstr ""
-
-#: ../../install_steps_gtk.pm_.c:405 ../../install_steps_interactive.pm_.c:255
-#: ../../install_steps_interactive.pm_.c:259
-#: ../../standalone/drakbackup_.c:4259
-msgid "Install"
-msgstr "Staliañ"
-
-#: ../../install_steps_gtk.pm_.c:408
-#, fuzzy
-msgid "Load/Save on floppy"
-msgstr "Enrollañ war bladennig"
-
-#: ../../install_steps_gtk.pm_.c:409
-#, fuzzy
-msgid "Updating package selection"
-msgstr "Diuz pakadoù unan hag unan"
-
-#: ../../install_steps_gtk.pm_.c:414
-#, fuzzy
-msgid "Minimal install"
-msgstr "Distaliañ"
-
-#: ../../install_steps_gtk.pm_.c:429 ../../install_steps_interactive.pm_.c:522
-msgid "Choose the packages you want to install"
-msgstr "Dibabit ar pakadoù a vennit staliañ"
-
-#: ../../install_steps_gtk.pm_.c:445 ../../install_steps_interactive.pm_.c:760
-msgid "Installing"
-msgstr "O staliañ"
-
-#: ../../install_steps_gtk.pm_.c:451
-msgid "Estimating"
-msgstr "O vrasjediñ"
-
-#: ../../install_steps_gtk.pm_.c:458
-msgid "Time remaining "
-msgstr "Amzer a chom"
-
-#: ../../install_steps_gtk.pm_.c:470
-msgid "Please wait, preparing installation..."
-msgstr "Gortozit mar plij, o prientiñ ar staliadur"
-
-#: ../../install_steps_gtk.pm_.c:554
-#, c-format
-msgid "%d packages"
-msgstr "%d pakad"
-
-#: ../../install_steps_gtk.pm_.c:559
-#, c-format
-msgid "Installing package %s"
-msgstr "O staliañ ar pakad %s"
-
-#: ../../install_steps_gtk.pm_.c:596 ../../install_steps_interactive.pm_.c:189
-#: ../../install_steps_interactive.pm_.c:784
-#: ../../standalone/drakautoinst_.c:202
-msgid "Accept"
-msgstr "Aotren"
-
-#: ../../install_steps_gtk.pm_.c:596 ../../install_steps_interactive.pm_.c:189
-#: ../../install_steps_interactive.pm_.c:784
-#, fuzzy
-msgid "Refuse"
-msgstr "Adventañ"
-
-#: ../../install_steps_gtk.pm_.c:597 ../../install_steps_interactive.pm_.c:785
-#, c-format
-msgid ""
-"Change your Cd-Rom!\n"
-"\n"
-"Please insert the Cd-Rom labelled \"%s\" in your drive and press Ok when "
-"done.\n"
-"If you don't have it, press Cancel to avoid installation from this Cd-Rom."
-msgstr ""
-"Kemmit ho Cd-Rom!\n"
-"\n"
-"Lakait el lenner ar Cd-Rom warnañ an diketenn \"%s\" mar plij ha gwaskit Mat "
-"eo da c'houde.\n"
-"Ma n'emañ ket ganeoc'h gwaskit Nullañ evit chom hep staliañ ar Cd-Rom-se."
-
-#: ../../install_steps_gtk.pm_.c:611 ../../install_steps_gtk.pm_.c:615
-#: ../../install_steps_interactive.pm_.c:797
-#: ../../install_steps_interactive.pm_.c:801
-msgid "Go on anyway?"
-msgstr "Kenderc'hel evelato ?"
-
-#: ../../install_steps_gtk.pm_.c:611 ../../install_steps_interactive.pm_.c:797
-msgid "There was an error ordering packages:"
-msgstr "Ur fazi a zo bet en ur rummañ pakadoù :"
-
-#: ../../install_steps_gtk.pm_.c:615 ../../install_steps_interactive.pm_.c:801
-msgid "There was an error installing packages:"
-msgstr "Ur fazi a zo bet en ur staliañ ar pakadoù :"
-
-#: ../../install_steps_interactive.pm_.c:10
-msgid ""
-"\n"
-"Warning\n"
-"\n"
-"Please read carefully the terms below. If you disagree with any\n"
-"portion, you are not allowed to install the next CD media. Press 'Refuse' \n"
-"to continue the installation without using these media.\n"
-"\n"
-"\n"
-"Some components contained in the next CD media are not governed\n"
-"by the GPL License or similar agreements. Each such component is then\n"
-"governed by the terms and conditions of its own specific license. \n"
-"Please read carefully and comply with such specific licenses before \n"
-"you use or redistribute the said components. \n"
-"Such licenses will in general prevent the transfer, duplication \n"
-"(except for backup purposes), redistribution, reverse engineering, \n"
-"de-assembly, de-compilation or modification of the component. \n"
-"Any breach of agreement will immediately terminate your rights under \n"
-"the specific license. Unless the specific license terms grant you such\n"
-"rights, you usually cannot install the programs on more than one\n"
-"system, or adapt it to be used on a network. In doubt, please contact \n"
-"directly the distributor or editor of the component. \n"
-"Transfer to third parties or copying of such components including the \n"
-"documentation is usually forbidden.\n"
-"\n"
-"\n"
-"All rights to the components of the next CD media belong to their \n"
-"respective authors and are protected by intellectual property and \n"
-"copyright laws applicable to software programs.\n"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:67
-msgid "An error occurred"
-msgstr "Ur fazi a zo bet"
-
-#: ../../install_steps_interactive.pm_.c:85
-#, fuzzy
-msgid "Do you really want to leave the installation?"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../install_steps_interactive.pm_.c:112
-msgid "License agreement"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:113
-msgid ""
-"Introduction\n"
-"\n"
-"The operating system and the different components available in the Mandrake "
-"Linux distribution \n"
-"shall be called the \"Software Products\" hereafter. The Software Products "
-"include, but are not \n"
-"restricted to, the set of programs, methods, rules and documentation related "
-"to the operating \n"
-"system and the different components of the Mandrake Linux distribution.\n"
-"\n"
-"\n"
-"1. License Agreement\n"
-"\n"
-"Please read this document carefully. This document is a license agreement "
-"between you and \n"
-"MandrakeSoft S.A. which applies to the Software Products.\n"
-"By installing, duplicating or using the Software Products in any manner, you "
-"explicitly \n"
-"accept and fully agree to conform to the terms and conditions of this "
-"License. \n"
-"If you disagree with any portion of the License, you are not allowed to "
-"install, duplicate or use \n"
-"the Software Products. \n"
-"Any attempt to install, duplicate or use the Software Products in a manner "
-"which does not comply \n"
-"with the terms and conditions of this License is void and will terminate "
-"your rights under this \n"
-"License. Upon termination of the License, you must immediately destroy all "
-"copies of the \n"
-"Software Products.\n"
-"\n"
-"\n"
-"2. Limited Warranty\n"
-"\n"
-"The Software Products and attached documentation are provided \"as is\", "
-"with no warranty, to the \n"
-"extent permitted by law.\n"
-"MandrakeSoft S.A. will, in no circumstances and to the extent permitted by "
-"law, be liable for any special,\n"
-"incidental, direct or indirect damages whatsoever (including without "
-"limitation damages for loss of \n"
-"business, interruption of business, financial loss, legal fees and penalties "
-"resulting from a court \n"
-"judgment, or any other consequential loss) arising out of the use or "
-"inability to use the Software \n"
-"Products, even if MandrakeSoft S.A. has been advised of the possibility or "
-"occurence of such \n"
-"damages.\n"
-"\n"
-"LIMITED LIABILITY LINKED TO POSSESSING OR USING PROHIBITED SOFTWARE IN SOME "
-"COUNTRIES\n"
-"\n"
-"To the extent permitted by law, MandrakeSoft S.A. or its distributors will, "
-"in no circumstances, be \n"
-"liable for any special, incidental, direct or indirect damages whatsoever "
-"(including without \n"
-"limitation damages for loss of business, interruption of business, financial "
-"loss, legal fees \n"
-"and penalties resulting from a court judgment, or any other consequential "
-"loss) arising out \n"
-"of the possession and use of software components or arising out of "
-"downloading software components \n"
-"from one of Mandrake Linux sites which are prohibited or restricted in some "
-"countries by local laws.\n"
-"This limited liability applies to, but is not restricted to, the strong "
-"cryptography components \n"
-"included in the Software Products.\n"
-"\n"
-"\n"
-"3. The GPL License and Related Licenses\n"
-"\n"
-"The Software Products consist of components created by different persons or "
-"entities. Most \n"
-"of these components are governed under the terms and conditions of the GNU "
-"General Public \n"
-"Licence, hereafter called \"GPL\", or of similar licenses. Most of these "
-"licenses allow you to use, \n"
-"duplicate, adapt or redistribute the components which they cover. Please "
-"read carefully the terms \n"
-"and conditions of the license agreement for each component before using any "
-"component. Any question \n"
-"on a component license should be addressed to the component author and not "
-"to MandrakeSoft.\n"
-"The programs developed by MandrakeSoft S.A. are governed by the GPL License. "
-"Documentation written \n"
-"by MandrakeSoft S.A. is governed by a specific license. Please refer to the "
-"documentation for \n"
-"further details.\n"
-"\n"
-"\n"
-"4. Intellectual Property Rights\n"
-"\n"
-"All rights to the components of the Software Products belong to their "
-"respective authors and are \n"
-"protected by intellectual property and copyright laws applicable to software "
-"programs.\n"
-"MandrakeSoft S.A. reserves its rights to modify or adapt the Software "
-"Products, as a whole or in \n"
-"parts, by all means and for all purposes.\n"
-"\"Mandrake\", \"Mandrake Linux\" and associated logos are trademarks of "
-"MandrakeSoft S.A. \n"
-"\n"
-"\n"
-"5. Governing Laws \n"
-"\n"
-"If any portion of this agreement is held void, illegal or inapplicable by a "
-"court judgment, this \n"
-"portion is excluded from this contract. You remain bound by the other "
-"applicable sections of the \n"
-"agreement.\n"
-"The terms and conditions of this License are governed by the Laws of "
-"France.\n"
-"All disputes on the terms of this license will preferably be settled out of "
-"court. As a last \n"
-"resort, the dispute will be referred to the appropriate Courts of Law of "
-"Paris - France.\n"
-"For any question on this document, please contact MandrakeSoft S.A. \n"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:191
-msgid "Are you sure you refuse the licence?"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:211
-#: ../../install_steps_interactive.pm_.c:1021
-#: ../../standalone/keyboarddrake_.c:31
-msgid "Keyboard"
-msgstr "Stokellaoueg"
-
-#: ../../install_steps_interactive.pm_.c:212
-#, fuzzy
-msgid "Please choose your keyboard layout."
-msgstr "Dibabit reizhadur ho stokellaoueg, mar plij."
-
-#: ../../install_steps_interactive.pm_.c:213
-#, fuzzy
-msgid "Here is the full list of keyboards available"
-msgstr "stokellaoueg"
-
-#: ../../install_steps_interactive.pm_.c:231
-msgid "Which installation class do you want?"
-msgstr "Pe renkad staliañ a fell deoc'h ?"
-
-#: ../../install_steps_interactive.pm_.c:235
-msgid "Install/Update"
-msgstr "Staliañ/Bremanaat"
-
-#: ../../install_steps_interactive.pm_.c:235
-msgid "Is this an install or an update?"
-msgstr "Hag ur staliadur pe ur bremanadur eo ?"
-
-#: ../../install_steps_interactive.pm_.c:244
-msgid "Recommended"
-msgstr "Erbedet"
-
-#: ../../install_steps_interactive.pm_.c:247
-#: ../../install_steps_interactive.pm_.c:250
-msgid "Expert"
-msgstr "Mailh"
-
-#: ../../install_steps_interactive.pm_.c:255
-#: ../../install_steps_interactive.pm_.c:259
-msgid "Upgrade"
-msgstr "Bremanaat"
-
-#: ../../install_steps_interactive.pm_.c:255
-#: ../../install_steps_interactive.pm_.c:259
-msgid "Upgrade packages only"
-msgstr "Bremanaat pakadoù hep ken"
-
-#: ../../install_steps_interactive.pm_.c:275
-msgid "Please choose the type of your mouse."
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../install_steps_interactive.pm_.c:281 ../../standalone/mousedrake_.c:60
-msgid "Mouse Port"
-msgstr "Porzh al logodenn"
-
-#: ../../install_steps_interactive.pm_.c:282 ../../standalone/mousedrake_.c:61
-msgid "Please choose on which serial port your mouse is connected to."
-msgstr "Dibabit ar porzh a-steud m'eo luget ho logodenn outañ, mar plij."
-
-#: ../../install_steps_interactive.pm_.c:290
-msgid "Buttons emulation"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:292
-msgid "Button 2 Emulation"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:293
-msgid "Button 3 Emulation"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:314
-msgid "Configuring PCMCIA cards..."
-msgstr "O kefluniañ kartennoù PCMCIA..."
-
-#: ../../install_steps_interactive.pm_.c:314
-msgid "PCMCIA"
-msgstr "PCMCIA"
-
-#: ../../install_steps_interactive.pm_.c:321
-msgid "Configuring IDE"
-msgstr "Kefluniañ IDE"
-
-#: ../../install_steps_interactive.pm_.c:321
-msgid "IDE"
-msgstr "IDE"
-
-#: ../../install_steps_interactive.pm_.c:338
-msgid "No partition available"
-msgstr "parzhadur hegerz ebet"
-
-#: ../../install_steps_interactive.pm_.c:341
-msgid "Scanning partitions to find mount points"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:349
-msgid "Choose the mount points"
-msgstr "Dibabit at poentoù marc'hañ"
-
-#: ../../install_steps_interactive.pm_.c:379
-msgid ""
-"No free space for 1MB bootstrap! Install will continue, but to boot your "
-"system, you'll need to create the bootstrap partition in DiskDrake"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:388
-#, fuzzy
-msgid "No root partition found to perform an upgrade"
-msgstr "Parzhadur gwrizienn kavet ebet"
-
-#: ../../install_steps_interactive.pm_.c:389
-msgid "Root Partition"
-msgstr "Parzhadur gwrizienn"
-
-#: ../../install_steps_interactive.pm_.c:390
-msgid "What is the root partition (/) of your system?"
-msgstr "Pehini eo parzhadur gwrizienn (/) ho reizhiad ?"
-
-#: ../../install_steps_interactive.pm_.c:404
-msgid "You need to reboot for the partition table modifications to take place"
-msgstr "Ret eo deoc'h adloc'hañ evit ma talvezo kemmoù an daolenn barzhañ"
-
-#: ../../install_steps_interactive.pm_.c:428
-msgid "Choose the partitions you want to format"
-msgstr "Dibabit ar parzhadur a vennit furmadiñ"
-
-#: ../../install_steps_interactive.pm_.c:429
-msgid "Check bad blocks?"
-msgstr "Gwiriañ ar bloc'hoù siek ?"
-
-#: ../../install_steps_interactive.pm_.c:456
-msgid "Formatting partitions"
-msgstr "O furmadiñ parzhadurioù"
-
-#: ../../install_steps_interactive.pm_.c:458
-#, c-format
-msgid "Creating and formatting file %s"
-msgstr "O krouiñ hag o furmadiñ ar restr saveteiñ %s"
-
-#: ../../install_steps_interactive.pm_.c:463
-#, c-format
-msgid ""
-"Failed to check filesystem %s. Do you want to repair the errors? (beware, "
-"you can loose data)"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:465
-msgid "Not enough swap space to fulfill installation, please add some"
-msgstr "Ket a-walc'h a zisloañ evit peurstaliañ, kreskit anezhañ mar plij"
-
-#: ../../install_steps_interactive.pm_.c:472
-#, fuzzy
-msgid "Looking for available packages and rebuilding rpm database..."
-msgstr "O klask ar pakadoù hegerz"
-
-#: ../../install_steps_interactive.pm_.c:473
-msgid "Looking for available packages..."
-msgstr "O klask ar pakadoù hegerz"
-
-#: ../../install_steps_interactive.pm_.c:476
-#, fuzzy
-msgid "Looking at packages already installed..."
-msgstr "N'hellit ket andiuz ar pakad-mañ. Staliet eo endo"
-
-#: ../../install_steps_interactive.pm_.c:480
-msgid "Finding packages to upgrade..."
-msgstr "O kavout pakadoù da vremanaat"
-
-#: ../../install_steps_interactive.pm_.c:498
-#, fuzzy, c-format
-msgid ""
-"Your system does not have enough space left for installation or upgrade (%d "
-"> %d)"
-msgstr "Ho reizhiad n'eus ket wa-walc'h a egor evit staliañ pe vremanaat"
-
-#: ../../install_steps_interactive.pm_.c:534
-msgid ""
-"Please choose load or save package selection on floppy.\n"
-"The format is the same as auto_install generated floppies."
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:536
-msgid "Load from floppy"
-msgstr "Assevel adalek ar pladennig"
-
-#: ../../install_steps_interactive.pm_.c:536
-msgid "Save on floppy"
-msgstr "Enrollañ war bladennig"
-
-#: ../../install_steps_interactive.pm_.c:540
-msgid "Loading from floppy"
-msgstr "Assevelañ adalek ar pladennig"
-
-#: ../../install_steps_interactive.pm_.c:540
-msgid "Package selection"
-msgstr "Diuzadenn pakadoù"
-
-#: ../../install_steps_interactive.pm_.c:545
-#, fuzzy
-msgid "Insert a floppy containing package selection"
-msgstr "Lakait ur bladennig el lenner %s"
-
-#: ../../install_steps_interactive.pm_.c:627
-msgid "Selected size is larger than available space"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:642
-#, fuzzy
-msgid "Type of install"
-msgstr "Dibabit pakadoù da staliañ"
-
-#: ../../install_steps_interactive.pm_.c:643
-msgid ""
-"You haven't selected any group of packages.\n"
-"Please choose the minimal installation you want:"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:646
-msgid "With X"
-msgstr "Gant X"
-
-#: ../../install_steps_interactive.pm_.c:648
-msgid "With basic documentation (recommended!)"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:649
-msgid "Truly minimal install (especially no urpmi)"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:734
-msgid ""
-"If you have all the CDs in the list below, click Ok.\n"
-"If you have none of those CDs, click Cancel.\n"
-"If only some CDs are missing, unselect them, then click Ok."
-msgstr ""
-"M'hoc'h eus an holl CDoù er roll a-is, gwaskit Mat eo.\n"
-"Ma n'hoc'h eus hini eus ar CDoù-se, gwaskit Nullañ.\n"
-"Ma fazi deoc'h lod eus ar CDoù, andiuzit anezho ha gwaskit Mat eo."
-
-#: ../../install_steps_interactive.pm_.c:739
-#, c-format
-msgid "Cd-Rom labeled \"%s\""
-msgstr "Cd-Rom skridennet \"%s\""
-
-#: ../../install_steps_interactive.pm_.c:760
-msgid "Preparing installation"
-msgstr "O prientiñ ar staliadur"
-
-#: ../../install_steps_interactive.pm_.c:769
-#, c-format
-msgid ""
-"Installing package %s\n"
-"%d%%"
-msgstr ""
-"O staliañ ar pakad %s\n"
-"%d%%"
-
-#: ../../install_steps_interactive.pm_.c:815
-msgid "Post-install configuration"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../install_steps_interactive.pm_.c:821
-#, fuzzy, c-format
-msgid "Please insert the Boot floppy used in drive %s"
-msgstr "Lakait ur bladennig el lenner %s"
-
-#: ../../install_steps_interactive.pm_.c:827
-#, fuzzy, c-format
-msgid "Please insert the Update Modules floppy in drive %s"
-msgstr "Lakait ur bladennig gwerc'h el lenner %s"
-
-#: ../../install_steps_interactive.pm_.c:847
-msgid ""
-"You now have the opportunity to download encryption software.\n"
-"\n"
-"WARNING:\n"
-"\n"
-"Due to different general requirements applicable to these software and "
-"imposed\n"
-"by various jurisdictions, customer and/or end user of theses software "
-"should\n"
-"ensure that the laws of his/their jurisdiction allow him/them to download, "
-"stock\n"
-"and/or use these software.\n"
-"\n"
-"In addition customer and/or end user shall particularly be aware to not "
-"infringe\n"
-"the laws of his/their jurisdiction. Should customer and/or end user not\n"
-"respect the provision of these applicable laws, he/they will incure serious\n"
-"sanctions.\n"
-"\n"
-"In no event shall Mandrakesoft nor its manufacturers and/or suppliers be "
-"liable\n"
-"for special, indirect or incidental damages whatsoever (including, but not\n"
-"limited to loss of profits, business interruption, loss of commercial data "
-"and\n"
-"other pecuniary losses, and eventual liabilities and indemnification to be "
-"paid\n"
-"pursuant to a court decision) arising out of use, possession, or the sole\n"
-"downloading of these software, to which customer and/or end user could\n"
-"eventually have access after having sign up the present agreement.\n"
-"\n"
-"\n"
-"For any queries relating to these agreement, please contact \n"
-"Mandrakesoft, Inc.\n"
-"2400 N. Lincoln Avenue Suite 243\n"
-"Altadena California 91001\n"
-"USA"
-msgstr ""
-"Tu zo deoc'h bremañ ezkargañ meziantoù gouestlet d'ar rinegouriezh.\n"
-"\n"
-"HO EVEZH :\n"
-"\n"
-"Abalamour m'eo disheñvel ar pennaennoù meur o talvezout evit ar meziantoù-"
-"mañ hervez\n"
-"gwiraouriezhoù disheñvel, ret eo d'an arval ha/pe arveriad en diwezh ar "
-"meziantoù-mañ\n"
-"gwiriañ eo aotreet da ezskargañ, mirout ha/pe implijout ar meziantoù-mañ\n"
-"gouez d'al lezennoù en e/he gwiraouriezh.\n"
-"\n"
-"Ouzhpenn an arval ha/pe arveriad en diwezh a rank bezañ war evezh chom hep "
-"terriñ\n"
-"lezennoù e/he gwiraouriezh. Ma c'hoarvezfe gant an arval ha/pe arveriad\n"
-"en diwezh na zoujañ ouzh termenoù lezennoù o talvezout, e telezfe kastizoù\n"
-"kriz.\n"
-"\n"
-"E nep degouezh ne vo dalc'het Mandrakesoft nag e oberatourien na/pe e "
-"bourvezerien\n"
-"atebek eus nep gaou dibar, ameeun pe zarvoudus a c'hoarvezfe (ha pa vefe\n"
-"zoken e-touez traoù all koll gounid, arsav aferioù, koll roadoù kenwerzhel "
-"ha\n"
-"kolloù arc'hant all, hag atebegezh pe zigoll diouzh an dro da vezañ paeet\n"
-"da heul ur barnadeg) o tont diouzh implij, perc'hennañ, pe zoken ezkargañ\n"
-"ar meziantoù-mañ, a c'hellfe an arval ha/pe arveriad en diwezh bezañ\n"
-"grataet goude bezañ sinet an emglev-mañ.\n"
-"\n"
-"\n"
-"Evit forzh pe c'houlenn a-zivout an emglevioù-se, darempredit mar plij\n"
-"Mandrakesoft, Inc.\n"
-"2400 N. Lincoln Avenue Suite 243\n"
-"Altadena California 91001\n"
-"SUA"
-
-#: ../../install_steps_interactive.pm_.c:886
-msgid ""
-"You now have the opportunity to download updated packages. These packages\n"
-"have been released after the distribution was released. They may\n"
-"contain security or bug fixes.\n"
-"\n"
-"To download these packages, you will need to have a working Internet \n"
-"connection.\n"
-"\n"
-"Do you want to install the updates ?"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:901
-#, fuzzy
-msgid ""
-"Contacting Mandrake Linux web site to get the list of available mirrors..."
-msgstr "O taremprediñ ar melezour evit kaout roll ar pakadoù hegerz"
-
-#: ../../install_steps_interactive.pm_.c:906
-msgid "Choose a mirror from which to get the packages"
-msgstr "Dibabit ur melezour da dapout ar pakadoù diwarnañ"
-
-#: ../../install_steps_interactive.pm_.c:915
-msgid "Contacting the mirror to get the list of available packages..."
-msgstr "O taremprediñ ar melezour evit kaout roll ar pakadoù hegerz"
-
-#: ../../install_steps_interactive.pm_.c:943
-msgid "Which is your timezone?"
-msgstr "Pe seurt a vo ho takad-eur ?"
-
-#: ../../install_steps_interactive.pm_.c:948
-#, fuzzy
-msgid "Hardware clock set to GMT"
-msgstr "Ha war GMT eo lakaet ho eurier periantel ?"
-
-#: ../../install_steps_interactive.pm_.c:949
-msgid "Automatic time synchronization (using NTP)"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:956
-msgid "NTP Server"
-msgstr "Servijer NTP"
-
-#: ../../install_steps_interactive.pm_.c:990
-#: ../../install_steps_interactive.pm_.c:998
-#, fuzzy
-msgid "Remote CUPS server"
-msgstr "Steud a-bell"
-
-#: ../../install_steps_interactive.pm_.c:991
-#, fuzzy
-msgid "No printer"
-msgstr "Moullerez lec'hel"
-
-#: ../../install_steps_interactive.pm_.c:1008
-#, fuzzy
-msgid "Do you have an ISA sound card?"
-msgstr "Hag un all hoc'h eus ?"
-
-#: ../../install_steps_interactive.pm_.c:1010
-msgid "Run \"sndconfig\" after installation to configure your sound card"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1012
-msgid "No sound card detected. Try \"harddrake\" after installation"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1017 ../../steps.pm_.c:27
-msgid "Summary"
-msgstr "Evit diverriñ"
-
-#: ../../install_steps_interactive.pm_.c:1020
-msgid "Mouse"
-msgstr "Logodenn"
-
-#: ../../install_steps_interactive.pm_.c:1022
-msgid "Timezone"
-msgstr "Takad-eur"
-
-#: ../../install_steps_interactive.pm_.c:1023 ../../printerdrake.pm_.c:2985
-#: ../../printerdrake.pm_.c:3074
-msgid "Printer"
-msgstr "Moullerez"
-
-#: ../../install_steps_interactive.pm_.c:1025
-msgid "ISDN card"
-msgstr "Kartenn ISDN"
-
-#: ../../install_steps_interactive.pm_.c:1028
-#: ../../install_steps_interactive.pm_.c:1030
-msgid "Sound card"
-msgstr "Kartenn son"
-
-#: ../../install_steps_interactive.pm_.c:1032
-msgid "TV card"
-msgstr "Kartenn pellwel"
-
-#: ../../install_steps_interactive.pm_.c:1072
-#: ../../install_steps_interactive.pm_.c:1097
-#: ../../install_steps_interactive.pm_.c:1101
-msgid "LDAP"
-msgstr "LDAP"
-
-#: ../../install_steps_interactive.pm_.c:1073
-#: ../../install_steps_interactive.pm_.c:1097
-#: ../../install_steps_interactive.pm_.c:1110
-msgid "NIS"
-msgstr "NIS"
-
-#: ../../install_steps_interactive.pm_.c:1074
-#: ../../install_steps_interactive.pm_.c:1097
-#: ../../install_steps_interactive.pm_.c:1118
-#: ../../install_steps_interactive.pm_.c:1124
-#, fuzzy
-msgid "Windows Domain"
-msgstr "Titouroù"
-
-#: ../../install_steps_interactive.pm_.c:1075
-#: ../../install_steps_interactive.pm_.c:1097
-msgid "Local files"
-msgstr "Restroù lec'hel"
-
-#: ../../install_steps_interactive.pm_.c:1084
-#: ../../install_steps_interactive.pm_.c:1085 ../../steps.pm_.c:24
-msgid "Set root password"
-msgstr "Termeniñ tremenger root"
-
-#: ../../install_steps_interactive.pm_.c:1086
-msgid "No password"
-msgstr "Tremenger ebet"
-
-#: ../../install_steps_interactive.pm_.c:1091
-#, c-format
-msgid "This password is too short (it must be at least %d characters long)"
-msgstr "Re eeun eo an tremenger-se (%d arouezenn a zo ret d'an nebeutañ)"
-
-#: ../../install_steps_interactive.pm_.c:1097 ../../network/modem.pm_.c:49
-#: ../../standalone/drakconnect_.c:625 ../../standalone/logdrake_.c:173
-msgid "Authentication"
-msgstr "Dilesadur"
-
-#: ../../install_steps_interactive.pm_.c:1105
-#, fuzzy
-msgid "Authentication LDAP"
-msgstr "Dilesadur"
-
-#: ../../install_steps_interactive.pm_.c:1106
-msgid "LDAP Base dn"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1107
-msgid "LDAP Server"
-msgstr "Servijer LDAP"
-
-#: ../../install_steps_interactive.pm_.c:1113
-msgid "Authentication NIS"
-msgstr "Dilesadur NIS"
-
-#: ../../install_steps_interactive.pm_.c:1114
-msgid "NIS Domain"
-msgstr "Domani NIS"
-
-#: ../../install_steps_interactive.pm_.c:1115
-msgid "NIS Server"
-msgstr "Servijer NIS"
-
-#: ../../install_steps_interactive.pm_.c:1121
-msgid ""
-"For this to work for a W2K PDC, you will probably need to have the admin "
-"run: C:\\>net localgroup \"Pre-Windows 2000 Compatible Access\" everyone /"
-"add and reboot the server.\n"
-"You will also need the username/password of a Domain Admin to join the "
-"machine to the Windows(TM) domain.\n"
-"If networking is not yet enabled, Drakx will attempt to join the domain "
-"after the network setup step.\n"
-"Should this setup fail for some reason and domain authentication is not "
-"working, run 'smbpasswd -j DOMAIN -U USER%PASSWORD' using your Windows(tm) "
-"Domain, and Admin Username/Password, after system boot.\n"
-"The command 'wbinfo -t' will test whether your authentication secrets are "
-"good."
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1123
-#, fuzzy
-msgid "Authentication Windows Domain"
-msgstr "Dilesadur"
-
-#: ../../install_steps_interactive.pm_.c:1125
-#, fuzzy
-msgid "Domain Admin User Name"
-msgstr "Anv ar domani"
-
-#: ../../install_steps_interactive.pm_.c:1126
-msgid "Domain Admin Password"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1161
-#, fuzzy
-msgid ""
-"A custom bootdisk provides a way of booting into your Linux system without\n"
-"depending on the normal bootloader. This is useful if you don't want to "
-"install\n"
-"SILO on your system, or another operating system removes SILO, or SILO "
-"doesn't\n"
-"work with your hardware configuration. A custom bootdisk can also be used "
-"with\n"
-"the Mandrake rescue image, making it much easier to recover from severe "
-"system\n"
-"failures.\n"
-"\n"
-"If you want to create a bootdisk for your system, insert a floppy in the "
-"first\n"
-"drive and press \"Ok\"."
-msgstr ""
-"Ur bladenn loc'hañ neuziet a ro un tu da loc'hañ ho reizhiad Linux hep "
-"bezañ\n"
-"dindan beli ar c'harger loc'hañ boas. Talvoudus eo ma ne mennit ket staliañ "
-"LILO\n"
-"(pe grub) war ho reizhiad, pe ma skarzh ur reizhiad oberiañ LILO, pe ma ne\n"
-"da ket en-dro LILO war ho kefluniadur periantel. Ur bladenn loc'hañ neuziet\n"
-"a c'hell ivez bezañ implijet gant ar skeudenn saveteiñ Mandrake, en ur "
-"aesaat an\n"
-"assevel pa vefec'h sac'het grevus. Mennout a rit krouiñ ur bladenn loc'hañ "
-"evit\n"
-"ho reizhiad ?"
-
-#: ../../install_steps_interactive.pm_.c:1177
-msgid "First floppy drive"
-msgstr "Lenner pladennig kentañ"
-
-#: ../../install_steps_interactive.pm_.c:1178
-msgid "Second floppy drive"
-msgstr "Eil lenner pladennig"
-
-#: ../../install_steps_interactive.pm_.c:1179 ../../printerdrake.pm_.c:2515
-msgid "Skip"
-msgstr "Tremen e-biou"
-
-#: ../../install_steps_interactive.pm_.c:1184
-#, c-format
-msgid ""
-"A custom bootdisk provides a way of booting into your Linux system without\n"
-"depending on the normal bootloader. This is useful if you don't want to "
-"install\n"
-"LILO (or grub) on your system, or another operating system removes LILO, or "
-"LILO doesn't\n"
-"work with your hardware configuration. A custom bootdisk can also be used "
-"with\n"
-"the Mandrake rescue image, making it much easier to recover from severe "
-"system\n"
-"failures. Would you like to create a bootdisk for your system?\n"
-"%s"
-msgstr ""
-"Ur bladenn loc'hañ neuziet a ro un tu da loc'hañ ho reizhiad Linux hep "
-"bezañ\n"
-"dindan beli ar c'harger loc'hañ boas. Talvoudus eo ma ne mennit ket staliañ "
-"LILO\n"
-"(pe grub) war ho reizhiad, pe ma skarzh ur reizhiad oberiañ LILO, pe ma ne\n"
-"da ket en-dro LILO war ho kefluniadur periantel. Ur bladenn loc'hañ neuziet\n"
-"a c'hell ivez bezañ implijet gant ar skeudenn saveteiñ Mandrake, en ur "
-"aesaat an\n"
-"assevel pa vefec'h sac'het grevus. Mennout a rit krouiñ ur bladenn loc'hañ "
-"evit\n"
-"ho reizhiad ?\n"
-"%s"
-
-#: ../../install_steps_interactive.pm_.c:1190
-msgid ""
-"\n"
-"\n"
-"(WARNING! You're using XFS for your root partition,\n"
-"creating a bootdisk on a 1.44 Mb floppy will probably fail,\n"
-"because XFS needs a very large driver)."
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1198
-msgid "Sorry, no floppy drive available"
-msgstr "Ho tigarez, lenner pladennig hegerz ebet"
-
-#: ../../install_steps_interactive.pm_.c:1202
-msgid "Choose the floppy drive you want to use to make the bootdisk"
-msgstr ""
-"Dibabit al lenner pladennig a vennit implijout evit ober ar bladenn loc'hañ"
-
-#: ../../install_steps_interactive.pm_.c:1206
-#, fuzzy, c-format
-msgid "Insert a floppy in %s"
-msgstr "Lakait ur bladennig el lenner %s"
-
-#: ../../install_steps_interactive.pm_.c:1209
-msgid "Creating bootdisk..."
-msgstr "O krouiñ ar bladenn loc'hañ"
-
-#: ../../install_steps_interactive.pm_.c:1216
-msgid "Preparing bootloader..."
-msgstr "O prientiñ ar c'harger loc'hañ"
-
-#: ../../install_steps_interactive.pm_.c:1227
-msgid ""
-"You appear to have an OldWorld or Unknown\n"
-" machine, the yaboot bootloader will not work for you.\n"
-"The install will continue, but you'll\n"
-" need to use BootX to boot your machine"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1233
-msgid "Do you want to use aboot?"
-msgstr "Mennout a rit implijout aboot?"
-
-#: ../../install_steps_interactive.pm_.c:1236
-msgid ""
-"Error installing aboot, \n"
-"try to force installation even if that destroys the first partition?"
-msgstr ""
-"Fazi en ur staliañ aboot,\n"
-"klask rediañ ar staliadur zoken ma tistruj ar parzhadur kentañ ?"
-
-#: ../../install_steps_interactive.pm_.c:1243
-msgid "Installing bootloader"
-msgstr "Staliañ ar c'harger loc'hañ"
-
-#: ../../install_steps_interactive.pm_.c:1249
-#, fuzzy
-msgid "Installation of bootloader failed. The following error occured:"
-msgstr "Staliadur LILO a zo sac'het. Degouezhet eo ar fazi a heul :"
-
-#: ../../install_steps_interactive.pm_.c:1257
-#, c-format
-msgid ""
-"You may need to change your Open Firmware boot-device to\n"
-" enable the bootloader. If you don't see the bootloader prompt at\n"
-" reboot, hold down Command-Option-O-F at reboot and enter:\n"
-" setenv boot-device %s,\\\\:tbxi\n"
-" Then type: shut-down\n"
-"At your next boot you should see the bootloader prompt."
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1291
-#: ../../standalone/drakautoinst_.c:79
-#, c-format
-msgid "Insert a blank floppy in drive %s"
-msgstr "Lakait ur bladennig gwerc'h el lenner %s"
-
-#: ../../install_steps_interactive.pm_.c:1295
-msgid "Creating auto install floppy..."
-msgstr "O krouiñ ur bladennig staliañ emgefreek"
-
-#: ../../install_steps_interactive.pm_.c:1306
-msgid ""
-"Some steps are not completed.\n"
-"\n"
-"Do you really want to quit now?"
-msgstr ""
-"Lankadoù 'zo n'int ket peurc'hraet.\n"
-"\n"
-"Mennout a rit kuitaat da vat bremañ ?"
-
-#: ../../install_steps_interactive.pm_.c:1317
-#, c-format
-msgid ""
-"Congratulations, installation is complete.\n"
-"Remove the boot media and press return to reboot.\n"
-"\n"
-"\n"
-"For information on fixes which are available for this release of Mandrake "
-"Linux,\n"
-"consult the Errata available from:\n"
-"\n"
-"\n"
-"%s\n"
-"\n"
-"\n"
-"Information on configuring your system is available in the post\n"
-"install chapter of the Official Mandrake Linux User's Guide."
-msgstr ""
-"Gourc'hemennoù, peurc'hraet eo ar staliadur.\n"
-"Lamit ar bladenn loc'hañ ha gwaskit enkas evit adloc'hañ.\n"
-"\n"
-"\n"
-"Evit titouroù war palastroù hegerz evit stumm-mañ Mandrake Linux,\n"
-"sellit ouzh ar meneger fazioù hegerz e \n"
-"\n"
-"\n"
-"%s\n"
-"\n"
-"\n"
-"Titouroù war gefluniañ ho reizhiad a zo hegerz e rannbennad Goude\n"
-"Staliañ Sturier ofisiel an Arveriad Mandrake Linux."
-
-#: ../../install_steps_interactive.pm_.c:1330
-msgid "http://www.mandrakelinux.com/en/90errata.php3"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1335
-#, fuzzy
-msgid "Generate auto install floppy"
-msgstr "O krouiñ ur bladennig staliañ emgefreek"
-
-#: ../../install_steps_interactive.pm_.c:1337
-msgid ""
-"The auto install can be fully automated if wanted,\n"
-"in that case it will take over the hard drive!!\n"
-"(this is meant for installing on another box).\n"
-"\n"
-"You may prefer to replay the installation.\n"
-msgstr ""
-
-#: ../../install_steps_interactive.pm_.c:1342
-msgid "Automated"
-msgstr "Emgefreek"
-
-#: ../../install_steps_interactive.pm_.c:1342
-#, fuzzy
-msgid "Replay"
-msgstr "Adkargañ"
-
-#: ../../install_steps_interactive.pm_.c:1345
-#, fuzzy
-msgid "Save packages selection"
-msgstr "Diuz pakadoù unan hag unan"
-
-#: ../../install_steps_newt.pm_.c:22
-#, c-format
-msgid "Mandrake Linux Installation %s"
-msgstr "Staliadur Mandrake Linux %s"
-
-#. -PO This string must fit in a 80-char wide text screen
-#: ../../install_steps_newt.pm_.c:35
-msgid ""
-" <Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen "
-msgstr ""
-" <Tab>/<Alt-Tab> etre elfennoù | <Esaouenn> a ziuz | <F12> skramm a heul "
-
-#: ../../interactive.pm_.c:87
-msgid "kdesu missing"
-msgstr "kdesu mank"
-
-#: ../../interactive.pm_.c:89 ../../interactive.pm_.c:100
-msgid "consolehelper missing"
-msgstr ""
-
-#: ../../interactive.pm_.c:152
-msgid "Choose a file"
-msgstr "Dibabit ur restr"
-
-#: ../../interactive.pm_.c:320
-msgid "Advanced"
-msgstr "Barek"
-
-#: ../../interactive.pm_.c:321 ../../security/main.pm_.c:220
-#, fuzzy
-msgid "Basic"
-msgstr "Diazez"
-
-#: ../../interactive/newt.pm_.c:195 ../../my_gtk.pm_.c:158
-#: ../../printerdrake.pm_.c:2169
-msgid "<- Previous"
-msgstr "<- Diaraog"
-
-#: ../../interactive/newt.pm_.c:195 ../../interactive/newt.pm_.c:197
-#: ../../standalone/drakbackup_.c:4114 ../../standalone/drakbackup_.c:4141
-#: ../../standalone/drakbackup_.c:4171 ../../standalone/drakbackup_.c:4197
-msgid "Next"
-msgstr "A heul"
-
-#: ../../interactive/stdio.pm_.c:29 ../../interactive/stdio.pm_.c:149
-msgid "Bad choice, try again\n"
-msgstr "Dibab fall, klaskit adarre\n"
-
-#: ../../interactive/stdio.pm_.c:30 ../../interactive/stdio.pm_.c:150
-#, c-format
-msgid "Your choice? (default %s) "
-msgstr "Ho tibab ? (%s dre ziouer)"
-
-#: ../../interactive/stdio.pm_.c:54
-#, c-format
-msgid ""
-"Entries you'll have to fill:\n"
-"%s"
-msgstr ""
-
-#: ../../interactive/stdio.pm_.c:70
-#, fuzzy, c-format
-msgid "Your choice? (0/1, default `%s') "
-msgstr "Ho tibab ? (%s dre ziouer)"
-
-#: ../../interactive/stdio.pm_.c:95
-#, c-format
-msgid "Button `%s': %s"
-msgstr "Nozel `%s': %s"
-
-#: ../../interactive/stdio.pm_.c:96
-#, fuzzy
-msgid "Do you want to click on this button?"
-msgstr "Mennout a rit implijout SILO ?"
-
-#: ../../interactive/stdio.pm_.c:105
-msgid " enter `void' for void entry"
-msgstr ""
-
-#: ../../interactive/stdio.pm_.c:105
-#, fuzzy, c-format
-msgid "Your choice? (default `%s'%s) "
-msgstr "Ho tibab ? (%s dre ziouer)"
-
-#: ../../interactive/stdio.pm_.c:123
-#, c-format
-msgid "=> There are many things to choose from (%s).\n"
-msgstr ""
-
-#: ../../interactive/stdio.pm_.c:126
-msgid ""
-"Please choose the first number of the 10-range you wish to edit,\n"
-"or just hit Enter to proceed.\n"
-"Your choice? "
-msgstr ""
-
-#: ../../interactive/stdio.pm_.c:139
-#, c-format
-msgid ""
-"=> Notice, a label changed:\n"
-"%s"
-msgstr ""
-
-#: ../../interactive/stdio.pm_.c:146
-msgid "Re-submit"
-msgstr ""
-
-#: ../../keyboard.pm_.c:152 ../../keyboard.pm_.c:187
-msgid "Czech (QWERTZ)"
-msgstr "Tchek (QWERTZ)"
-
-#: ../../keyboard.pm_.c:153 ../../keyboard.pm_.c:189
-msgid "German"
-msgstr "Alaman"
-
-#: ../../keyboard.pm_.c:154
-msgid "Dvorak"
-msgstr "Dvorak"
-
-#: ../../keyboard.pm_.c:155 ../../keyboard.pm_.c:197
-msgid "Spanish"
-msgstr "Spagnol"
-
-#: ../../keyboard.pm_.c:156 ../../keyboard.pm_.c:198
-msgid "Finnish"
-msgstr "Finnek"
-
-#: ../../keyboard.pm_.c:157 ../../keyboard.pm_.c:199
-msgid "French"
-msgstr "Gall"
-
-#: ../../keyboard.pm_.c:158 ../../keyboard.pm_.c:231
-msgid "Norwegian"
-msgstr "Norvegek"
-
-#: ../../keyboard.pm_.c:159
-msgid "Polish"
-msgstr "Polonek"
-
-#: ../../keyboard.pm_.c:160 ../../keyboard.pm_.c:239
-msgid "Russian"
-msgstr "Rusiek"
-
-#: ../../keyboard.pm_.c:162 ../../keyboard.pm_.c:241
-msgid "Swedish"
-msgstr "Svedek"
-
-#: ../../keyboard.pm_.c:163 ../../keyboard.pm_.c:257
-msgid "UK keyboard"
-msgstr "Stokellaoueg RU"
-
-#: ../../keyboard.pm_.c:164 ../../keyboard.pm_.c:258
-msgid "US keyboard"
-msgstr "Stokellaoueg SUA"
-
-#: ../../keyboard.pm_.c:166
-#, fuzzy
-msgid "Albanian"
-msgstr "Ukrainiek"
-
-#: ../../keyboard.pm_.c:167
-msgid "Armenian (old)"
-msgstr "Armeniek (kozh)"
-
-#: ../../keyboard.pm_.c:168
-msgid "Armenian (typewriter)"
-msgstr "Armeniek (skriverez)"
-
-#: ../../keyboard.pm_.c:169
-msgid "Armenian (phonetic)"
-msgstr "Armeniek (soniadel)"
-
-#: ../../keyboard.pm_.c:174
-msgid "Azerbaidjani (latin)"
-msgstr "Azerbaidjanek (latin)"
-
-#: ../../keyboard.pm_.c:176
-msgid "Belgian"
-msgstr "Belgian"
-
-#: ../../keyboard.pm_.c:177
-#, fuzzy
-msgid "Bengali"
-msgstr "Taolenn"
-
-#: ../../keyboard.pm_.c:178
-#, fuzzy
-msgid "Bulgarian (phonetic)"
-msgstr "Armeniek (soniadel)"
-
-#: ../../keyboard.pm_.c:179
-msgid "Bulgarian (BDS)"
-msgstr "Bulgarek (BDS)"
-
-#: ../../keyboard.pm_.c:180
-msgid "Brazilian (ABNT-2)"
-msgstr "Brasilek (ABNT-2)"
-
-#: ../../keyboard.pm_.c:183
-#, fuzzy
-msgid "Bosnian"
-msgstr "Estoniek"
-
-#: ../../keyboard.pm_.c:184
-#, fuzzy
-msgid "Belarusian"
-msgstr "Bulgarek"
-
-#: ../../keyboard.pm_.c:185
-msgid "Swiss (German layout)"
-msgstr "Suis (reizhadur alaman)"
-
-#: ../../keyboard.pm_.c:186
-msgid "Swiss (French layout)"
-msgstr "Suis (reizhadur gall)"
-
-#: ../../keyboard.pm_.c:188
-msgid "Czech (QWERTY)"
-msgstr "Tchek (QWERTY)"
-
-#: ../../keyboard.pm_.c:190
-msgid "German (no dead keys)"
-msgstr "Alaman (stokell marv ebet)"
-
-#: ../../keyboard.pm_.c:191
-msgid "Devanagari"
-msgstr ""
-
-#: ../../keyboard.pm_.c:192
-msgid "Danish"
-msgstr "Danek"
-
-#: ../../keyboard.pm_.c:193
-msgid "Dvorak (US)"
-msgstr "Dvorak (US)"
-
-#: ../../keyboard.pm_.c:194
-msgid "Dvorak (Norwegian)"
-msgstr "Dvorak (Norvegek)"
-
-#: ../../keyboard.pm_.c:195
-msgid "Dvorak (Swedish)"
-msgstr "Dvorak (Svedek)"
-
-#: ../../keyboard.pm_.c:196
-msgid "Estonian"
-msgstr "Estoniek"
-
-#: ../../keyboard.pm_.c:200
-msgid "Georgian (\"Russian\" layout)"
-msgstr "Jorjiek (reizhadur \"Rusiek\")"
-
-#: ../../keyboard.pm_.c:201
-msgid "Georgian (\"Latin\" layout)"
-msgstr "Jorjiek (reizhadur \"Latin\")"
-
-#: ../../keyboard.pm_.c:202
-msgid "Greek"
-msgstr "Gresian"
-
-#: ../../keyboard.pm_.c:203
-msgid "Gujarati"
-msgstr ""
-
-#: ../../keyboard.pm_.c:204
-msgid "Gurmukhi"
-msgstr ""
-
-#: ../../keyboard.pm_.c:205
-msgid "Hungarian"
-msgstr "Hungarian"
-
-#: ../../keyboard.pm_.c:206
-msgid "Croatian"
-msgstr "Kroatek"
-
-#: ../../keyboard.pm_.c:207
-msgid "Israeli"
-msgstr "Israelian"
-
-#: ../../keyboard.pm_.c:208
-msgid "Israeli (Phonetic)"
-msgstr "Israelian (soniadel)"
-
-#: ../../keyboard.pm_.c:209
-#, fuzzy
-msgid "Iranian"
-msgstr "Ukrainiek"
-
-#: ../../keyboard.pm_.c:210
-msgid "Icelandic"
-msgstr "Islandek"
-
-#: ../../keyboard.pm_.c:211
-msgid "Italian"
-msgstr "Italian"
-
-#: ../../keyboard.pm_.c:212
-msgid "Inuktitut"
-msgstr ""
-
-#: ../../keyboard.pm_.c:213
-msgid "Japanese 106 keys"
-msgstr ""
-
-#: ../../keyboard.pm_.c:216
-#, fuzzy
-msgid "Korean keyboard"
-msgstr "Reizhadur Stokellaoueg RU"
-
-#: ../../keyboard.pm_.c:217
-msgid "Latin American"
-msgstr "Amerikan Latin"
-
-#: ../../keyboard.pm_.c:218
-#, fuzzy
-msgid "Laotian"
-msgstr "Titouroù"
-
-#: ../../keyboard.pm_.c:219
-msgid "Lithuanian AZERTY (old)"
-msgstr "Lituaniek AZERTY (kozh)"
-
-#: ../../keyboard.pm_.c:221
-msgid "Lithuanian AZERTY (new)"
-msgstr "Lituaniek AZERTY (nevez)"
-
-#: ../../keyboard.pm_.c:222
-msgid "Lithuanian \"number row\" QWERTY"
-msgstr "Lituaniek QUERTY \"linenn sifroù\""
-
-#: ../../keyboard.pm_.c:223
-msgid "Lithuanian \"phonetic\" QWERTY"
-msgstr "Lituaniek QUERTY \"soniadel\""
-
-#: ../../keyboard.pm_.c:224
-#, fuzzy
-msgid "Latvian"
-msgstr "Titouroù"
-
-#: ../../keyboard.pm_.c:225
-msgid "Macedonian"
-msgstr "Makedonia"
-
-#: ../../keyboard.pm_.c:226
-msgid "Myanmar (Burmese)"
-msgstr ""
-
-#: ../../keyboard.pm_.c:227
-#, fuzzy
-msgid "Mongolian (cyrillic)"
-msgstr "Yougoslaviek (reizhadur latin)"
-
-#: ../../keyboard.pm_.c:228
-msgid "Maltese (UK)"
-msgstr ""
-
-#: ../../keyboard.pm_.c:229
-msgid "Maltese (US)"
-msgstr ""
-
-#: ../../keyboard.pm_.c:230
-msgid "Dutch"
-msgstr "Hollandek"
-
-#: ../../keyboard.pm_.c:232
-msgid "Polish (qwerty layout)"
-msgstr "Polonek (reizhadur qwerty)"
-
-#: ../../keyboard.pm_.c:233
-msgid "Polish (qwertz layout)"
-msgstr "Polonek (reizhadur qwerty)"
-
-#: ../../keyboard.pm_.c:234
-msgid "Portuguese"
-msgstr "Portugalek"
-
-#: ../../keyboard.pm_.c:235
-msgid "Canadian (Quebec)"
-msgstr "Kanadian (Kebek)"
-
-#: ../../keyboard.pm_.c:237
-#, fuzzy
-msgid "Romanian (qwertz)"
-msgstr "Rusiek (Yawerty)"
-
-#: ../../keyboard.pm_.c:238
-#, fuzzy
-msgid "Romanian (qwerty)"
-msgstr "Rusiek (Yawerty)"
-
-#: ../../keyboard.pm_.c:240
-msgid "Russian (Yawerty)"
-msgstr "Rusiek (Yawerty)"
-
-#: ../../keyboard.pm_.c:242
-msgid "Slovenian"
-msgstr "Slovek"
-
-#: ../../keyboard.pm_.c:243
-msgid "Slovakian (QWERTZ)"
-msgstr "Slovakek (QWERTZ)"
-
-#: ../../keyboard.pm_.c:244
-msgid "Slovakian (QWERTY)"
-msgstr "Slovakek (QWERTY)"
-
-#: ../../keyboard.pm_.c:246
-#, fuzzy
-msgid "Serbian (cyrillic)"
-msgstr "Yougoslaviek (reizhadur latin)"
-
-#: ../../keyboard.pm_.c:248
-#, fuzzy
-msgid "Tamil (Unicode)"
-msgstr "i18n (brav)"
-
-#: ../../keyboard.pm_.c:249
-msgid "Tamil (TSCII)"
-msgstr ""
-
-#: ../../keyboard.pm_.c:250
-msgid "Thai keyboard"
-msgstr "Stokellaoueg Thai"
-
-#: ../../keyboard.pm_.c:252
-#, fuzzy
-msgid "Tajik keyboard"
-msgstr "Stokellaoueg Thai"
-
-#: ../../keyboard.pm_.c:253
-msgid "Turkish (traditional \"F\" model)"
-msgstr "Turkek (hengounel doare \"F\")"
-
-#: ../../keyboard.pm_.c:254
-msgid "Turkish (modern \"Q\" model)"
-msgstr "Turkek (arnevez doare \"Q\")"
-
-#: ../../keyboard.pm_.c:256
-msgid "Ukrainian"
-msgstr "Ukrainiek"
-
-#: ../../keyboard.pm_.c:259
-msgid "US keyboard (international)"
-msgstr "Stokellaoueg SUA (etrevroadel)"
-
-#: ../../keyboard.pm_.c:260
-#, fuzzy
-msgid "Vietnamese \"numeric row\" QWERTY"
-msgstr "Lituaniek QUERTY \"linenn sifroù\""
-
-#: ../../keyboard.pm_.c:261
-msgid "Yugoslavian (latin)"
-msgstr "Yougoslaviek (latin)"
-
-#: ../../keyboard.pm_.c:268
-msgid "Right Alt key"
-msgstr ""
-
-#: ../../keyboard.pm_.c:269
-msgid "Both Shift keys simultaneously"
-msgstr ""
-
-#: ../../keyboard.pm_.c:270
-msgid "Control and Shift keys simultaneously"
-msgstr ""
-
-#: ../../keyboard.pm_.c:271
-msgid "CapsLock key"
-msgstr ""
-
-#: ../../keyboard.pm_.c:272
-msgid "Ctrl and Alt keys simultaneously"
-msgstr ""
-
-#: ../../keyboard.pm_.c:273
-msgid "Alt and Shift keys simultaneously"
-msgstr ""
-
-#: ../../keyboard.pm_.c:274
-msgid "\"Menu\" key"
-msgstr ""
-
-#: ../../keyboard.pm_.c:275
-msgid "Left \"Windows\" key"
-msgstr ""
-
-#: ../../keyboard.pm_.c:276
-msgid "Right \"Windows\" key"
-msgstr ""
-
-#: ../../loopback.pm_.c:32
-#, c-format
-msgid "Circular mounts %s\n"
-msgstr "Marc'hañ kelc'hiek %s\n"
-
-#: ../../lvm.pm_.c:103
-msgid "Remove the logical volumes first\n"
-msgstr ""
-
-#: ../../modparm.pm_.c:50
-#, fuzzy
-msgid "a number"
-msgstr "Niverenn bellgomz"
-
-#: ../../modparm.pm_.c:52
-#, c-format
-msgid "%d comma separated numbers"
-msgstr ""
-
-#: ../../modparm.pm_.c:52
-#, c-format
-msgid "%d comma separated strings"
-msgstr ""
-
-#: ../../modparm.pm_.c:54
-msgid "comma separated numbers"
-msgstr ""
-
-#: ../../modparm.pm_.c:54
-#, fuzzy
-msgid "comma separated strings"
-msgstr "Furmadiñ parzhadurioù"
-
-#: ../../modules.pm_.c:293
-msgid ""
-"PCMCIA support no longer exists for 2.2 kernels. Please use a 2.4 kernel."
-msgstr ""
-
-#: ../../mouse.pm_.c:25
-msgid "Sun - Mouse"
-msgstr "Logodenn Sun"
-
-#: ../../mouse.pm_.c:32
-msgid "Logitech MouseMan+"
-msgstr "Logitech MouseMan+"
-
-#: ../../mouse.pm_.c:33
-msgid "Generic PS2 Wheel Mouse"
-msgstr "Logodenn rummel PS2 rodellek"
-
-#: ../../mouse.pm_.c:34
-msgid "GlidePoint"
-msgstr "GlidePoint"
-
-#: ../../mouse.pm_.c:36 ../../mouse.pm_.c:65
-msgid "Kensington Thinking Mouse"
-msgstr "Logodenn Kensington Thinking"
-
-#: ../../mouse.pm_.c:37 ../../mouse.pm_.c:61
-msgid "Genius NetMouse"
-msgstr "Genius NetMouse"
-
-#: ../../mouse.pm_.c:38
-msgid "Genius NetScroll"
-msgstr "Genius NetScroll"
-
-#: ../../mouse.pm_.c:39 ../../mouse.pm_.c:48
-#, fuzzy
-msgid "Microsoft Explorer"
-msgstr "Microsoft IntelliMouse"
-
-#: ../../mouse.pm_.c:44 ../../mouse.pm_.c:70
-msgid "1 button"
-msgstr "1 nozelenn"
-
-#: ../../mouse.pm_.c:45 ../../mouse.pm_.c:53
-msgid "Generic 2 Button Mouse"
-msgstr "Logodenn rummel 2 nozelenn"
-
-#: ../../mouse.pm_.c:47
-msgid "Wheel"
-msgstr "Rodel"
-
-#: ../../mouse.pm_.c:51
-msgid "serial"
-msgstr "a-steud"
-
-#: ../../mouse.pm_.c:54
-msgid "Generic 3 Button Mouse"
-msgstr "Logodenn rummel 3 nozelenn"
-
-#: ../../mouse.pm_.c:55
-msgid "Microsoft IntelliMouse"
-msgstr "Microsoft IntelliMouse"
-
-#: ../../mouse.pm_.c:56
-msgid "Logitech MouseMan"
-msgstr "Logitech MouseMan+/FirstMouse+"
-
-#: ../../mouse.pm_.c:57
-msgid "Mouse Systems"
-msgstr "Mouse Systems"
-
-#: ../../mouse.pm_.c:59
-msgid "Logitech CC Series"
-msgstr "Logitech doare CC"
-
-#: ../../mouse.pm_.c:60
-msgid "Logitech MouseMan+/FirstMouse+"
-msgstr "Logitech MouseMan+/FirstMouse+"
-
-#: ../../mouse.pm_.c:62
-msgid "MM Series"
-msgstr "Doare MM"
-
-#: ../../mouse.pm_.c:63
-msgid "MM HitTablet"
-msgstr "MM HitTablet"
-
-#: ../../mouse.pm_.c:64
-msgid "Logitech Mouse (serial, old C7 type)"
-msgstr "Logodenn Logitech (a-steud, seurt C7 kozh)"
-
-#: ../../mouse.pm_.c:68
-msgid "busmouse"
-msgstr "Logodenn bus"
-
-#: ../../mouse.pm_.c:71
-msgid "2 buttons"
-msgstr "2 nozelenn"
-
-#: ../../mouse.pm_.c:72
-msgid "3 buttons"
-msgstr "3 nozelenn"
-
-#: ../../mouse.pm_.c:75
-msgid "none"
-msgstr "ebet"
-
-#: ../../mouse.pm_.c:77
-msgid "No mouse"
-msgstr "Logodenn ebet"
-
-#: ../../mouse.pm_.c:486
-#, fuzzy
-msgid "Please test the mouse"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../mouse.pm_.c:487
-#, fuzzy
-msgid "To activate the mouse,"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../mouse.pm_.c:488
-msgid "MOVE YOUR WHEEL!"
-msgstr "FIÑV HO RODELL !"
-
-#: ../../my_gtk.pm_.c:64
-#, fuzzy
-msgid "-adobe-utopia-regular-r-*-*-25-*-*-*-p-*-iso8859-*,*-r-*"
-msgstr "-adobe-utopia-medium-r-normal-*-12-*-*-*-p-*-iso8859-*,*-r-*"
-
-#: ../../my_gtk.pm_.c:159
-msgid "Finish"
-msgstr "Disoc'h"
-
-#: ../../my_gtk.pm_.c:159 ../../printerdrake.pm_.c:2171
-msgid "Next ->"
-msgstr "A heul ->"
-
-#: ../../my_gtk.pm_.c:287
-msgid "Is this correct?"
-msgstr "Ha reizh eo ?"
-
-#: ../../my_gtk.pm_.c:359 ../../services.pm_.c:222
-msgid "Info"
-msgstr "Titouroù"
-
-#: ../../my_gtk.pm_.c:380
-msgid "Expand Tree"
-msgstr "Astenn ar wezenn"
-
-#: ../../my_gtk.pm_.c:381
-msgid "Collapse Tree"
-msgstr "Plegañ ar wezenn"
-
-#: ../../my_gtk.pm_.c:382
-msgid "Toggle between flat and group sorted"
-msgstr "Gwintañ etre kompez ha rummet dre strollad"
-
-#: ../../network/adsl.pm_.c:23 ../../network/ethernet.pm_.c:36
-#, fuzzy
-msgid "Connect to the Internet"
-msgstr "Anv ar gevreadenn"
-
-#: ../../network/adsl.pm_.c:24
-msgid ""
-"The most common way to connect with adsl is pppoe.\n"
-"Some connections use pptp, a few ones use dhcp.\n"
-"If you don't know, choose 'use pppoe'"
-msgstr ""
-
-#: ../../network/adsl.pm_.c:26
-msgid "Alcatel speedtouch usb"
-msgstr ""
-
-#: ../../network/adsl.pm_.c:26
-msgid "use dhcp"
-msgstr "implijit dhcp"
-
-#: ../../network/adsl.pm_.c:26
-msgid "use pppoe"
-msgstr "implijit pppoe"
-
-#: ../../network/adsl.pm_.c:26
-msgid "use pptp"
-msgstr "implijit pptp"
-
-#: ../../network/drakfirewall.pm_.c:12
-#, fuzzy
-msgid "Web Server"
-msgstr "Servijer"
-
-#: ../../network/drakfirewall.pm_.c:17
-#, fuzzy
-msgid "Domain Name Server"
-msgstr "Anv ar domani"
-
-#: ../../network/drakfirewall.pm_.c:32
-#, fuzzy
-msgid "Mail Server"
-msgstr "Stlennvonioù"
-
-#: ../../network/drakfirewall.pm_.c:37
-#, fuzzy
-msgid "POP and IMAP Server"
-msgstr "Servijer LDAP"
-
-#: ../../network/drakfirewall.pm_.c:111
-#, fuzzy
-msgid "No network card"
-msgstr "kartenn rouedad kavet ebet"
-
-#: ../../network/drakfirewall.pm_.c:129
-msgid ""
-"drakfirewall configurator\n"
-"\n"
-"This configures a personal firewall for this Mandrake Linux machine.\n"
-"For a powerful dedicated firewall solution, please look to the\n"
-"specialized MandrakeSecurity Firewall distribution."
-msgstr ""
-
-#: ../../network/drakfirewall.pm_.c:147
-msgid "Which services would you like to allow the Internet to connect to?"
-msgstr ""
-
-#: ../../network/drakfirewall.pm_.c:148
-msgid ""
-"You can enter miscellaneous ports. \n"
-"Valid examples are: 139/tcp 139/udp.\n"
-"Have a look at /etc/services for information."
-msgstr ""
-
-#: ../../network/drakfirewall.pm_.c:154
-#, c-format
-msgid ""
-"Invalid port given: %s.\n"
-"The proper format is \"port/tcp\" or \"port/udp\", \n"
-"where port is between 1 and 65535."
-msgstr ""
-
-#: ../../network/drakfirewall.pm_.c:162
-msgid "Everything (no firewall)"
-msgstr ""
-
-#: ../../network/drakfirewall.pm_.c:164
-#, fuzzy
-msgid "Other ports"
-msgstr "Amprouiñ ar porzhioù"
-
-#: ../../network/ethernet.pm_.c:37
-#, fuzzy
-msgid ""
-"Which dhcp client do you want to use?\n"
-"Default is dhcpcd"
-msgstr "Pe seurt parzhadur a vennit ?"
-
-#: ../../network/ethernet.pm_.c:88
-msgid ""
-"No ethernet network adapter has been detected on your system.\n"
-"I cannot set up this connection type."
-msgstr ""
-
-#: ../../network/ethernet.pm_.c:92 ../../standalone/drakgw_.c:236
-#, fuzzy
-msgid "Choose the network interface"
-msgstr "Dibabit ar ment nevez"
-
-#: ../../network/ethernet.pm_.c:93
-#, fuzzy
-msgid ""
-"Please choose which network adapter you want to use to connect to Internet"
-msgstr "Dibabit ar porzh a-steud m'eo luget ho logodenn outañ, mar plij."
-
-#: ../../network/ethernet.pm_.c:178
-msgid "no network card found"
-msgstr "kartenn rouedad kavet ebet"
-
-#: ../../network/ethernet.pm_.c:202 ../../network/network.pm_.c:362
-msgid "Configuring network"
-msgstr "Kefluniañ ar rouedad"
-
-#: ../../network/ethernet.pm_.c:203
-#, fuzzy
-msgid ""
-"Please enter your host name if you know it.\n"
-"Some DHCP servers require the hostname to work.\n"
-"Your host name should be a fully-qualified host name,\n"
-"such as ``mybox.mylab.myco.com''."
-msgstr ""
-"Roit ho anv ostiz mar plij.\n"
-"Un anv peurzoareet a zlefe bezañ hini o ostiz,\n"
-"evel ``mabenveg.mastal.makomp.com''.\n"
-"Gallout a rit ivez reiñ chomlec'h IP an dreuzell m'hoc'h eus unan"
-
-#: ../../network/ethernet.pm_.c:207 ../../network/network.pm_.c:367
-msgid "Host name"
-msgstr "Anv an ostiz"
-
-#: ../../network/isdn.pm_.c:21 ../../network/isdn.pm_.c:44
-#: ../../network/netconnect.pm_.c:90 ../../network/netconnect.pm_.c:104
-#: ../../network/netconnect.pm_.c:159 ../../network/netconnect.pm_.c:174
-#: ../../network/netconnect.pm_.c:201 ../../network/netconnect.pm_.c:224
-#: ../../network/netconnect.pm_.c:232
-#, fuzzy
-msgid "Network Configuration Wizard"
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../network/isdn.pm_.c:22
-#, fuzzy
-msgid "External ISDN modem"
-msgstr "Mailh"
-
-#: ../../network/isdn.pm_.c:22
-msgid "Internal ISDN card"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:22
-#, fuzzy
-msgid "What kind is your ISDN connection?"
-msgstr "Ouzh pe borzh a-steud eo luget ho logodenn ?"
-
-#: ../../network/isdn.pm_.c:45
-msgid ""
-"Which ISDN configuration do you prefer?\n"
-"\n"
-"* The Old configuration uses isdn4net. It contains powerful\n"
-" tools, but is tricky to configure, and not standard.\n"
-"\n"
-"* The New configuration is easier to understand, more\n"
-" standard, but with less tools.\n"
-"\n"
-"We recommand the light configuration.\n"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:54
-#, fuzzy
-msgid "New configuration (isdn-light)"
-msgstr "o lenn ar c'hefluniadur"
-
-#: ../../network/isdn.pm_.c:54
-#, fuzzy
-msgid "Old configuration (isdn4net)"
-msgstr "o lenn ar c'hefluniadur"
-
-#: ../../network/isdn.pm_.c:170 ../../network/isdn.pm_.c:188
-#: ../../network/isdn.pm_.c:200 ../../network/isdn.pm_.c:206
-#: ../../network/isdn.pm_.c:213 ../../network/isdn.pm_.c:223
-msgid "ISDN Configuration"
-msgstr "Kefluniadur ISDN"
-
-#: ../../network/isdn.pm_.c:170
-msgid ""
-"Select your provider.\n"
-"If it isn't listed, choose Unlisted."
-msgstr ""
-
-#: ../../network/isdn.pm_.c:183
-msgid "Europe protocol"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:183
-msgid "Europe protocol (EDSS1)"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:185
-#, fuzzy
-msgid "Protocol for the rest of the world"
-msgstr "Amprouiñ ar c'hefluniadur"
-
-#: ../../network/isdn.pm_.c:185
-msgid ""
-"Protocol for the rest of the world\n"
-"No D-Channel (leased lines)"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:189
-#, fuzzy
-msgid "Which protocol do you want to use?"
-msgstr "Pe seurt parzhadur a vennit ?"
-
-#: ../../network/isdn.pm_.c:200
-#, c-format
-msgid "Found \"%s\" interface do you want to use it ?"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:207
-#, fuzzy
-msgid "What kind of card do you have?"
-msgstr "Peseurt moullerez hoc'h eus ?"
-
-#: ../../network/isdn.pm_.c:208
-msgid "I don't know"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:208
-msgid "ISA / PCMCIA"
-msgstr "ISA / PCMCIA"
-
-#: ../../network/isdn.pm_.c:208
-msgid "PCI"
-msgstr "PCI"
-
-#: ../../network/isdn.pm_.c:214
-msgid ""
-"\n"
-"If you have an ISA card, the values on the next screen should be right.\n"
-"\n"
-"If you have a PCMCIA card, you have to know the \"irq\" and \"io\" of your "
-"card.\n"
-msgstr ""
-
-#: ../../network/isdn.pm_.c:218
-msgid "Abort"
-msgstr "Dilaoskel"
-
-#: ../../network/isdn.pm_.c:218
-#, fuzzy
-msgid "Continue"
-msgstr "Kenderc'hel evelato ?"
-
-#: ../../network/isdn.pm_.c:224
-#, fuzzy
-msgid "Which is your ISDN card?"
-msgstr "Pehini eo ho takad-eur ?"
-
-#: ../../network/isdn.pm_.c:243
-msgid ""
-"I have detected an ISDN PCI card, but I don't know its type. Please select a "
-"PCI card on the next screen."
-msgstr ""
-
-#: ../../network/isdn.pm_.c:252
-msgid "No ISDN PCI card found. Please select one on the next screen."
-msgstr ""
-
-#: ../../network/modem.pm_.c:39
-msgid "Please choose which serial port your modem is connected to."
-msgstr "Dibabit ouzh pe borzh a-steud eo luget ho modem, mar plij."
-
-#: ../../network/modem.pm_.c:44
-msgid "Dialup options"
-msgstr "Dibarzhoù sifrennañ"
-
-#: ../../network/modem.pm_.c:45 ../../standalone/drakconnect_.c:621
-msgid "Connection name"
-msgstr "Anv ar gevreadenn"
-
-#: ../../network/modem.pm_.c:46 ../../standalone/drakconnect_.c:622
-#, fuzzy
-msgid "Phone number"
-msgstr "Niverenn bellgomz"
-
-#: ../../network/modem.pm_.c:47 ../../standalone/drakconnect_.c:623
-msgid "Login ID"
-msgstr "Anv ereañ"
-
-#: ../../network/modem.pm_.c:49 ../../standalone/drakconnect_.c:625
-msgid "CHAP"
-msgstr "CHAP"
-
-#: ../../network/modem.pm_.c:49 ../../standalone/drakconnect_.c:625
-msgid "PAP"
-msgstr "PAP"
-
-#: ../../network/modem.pm_.c:49 ../../standalone/drakconnect_.c:625
-msgid "Script-based"
-msgstr "Diazezet war ur skrid"
-
-#: ../../network/modem.pm_.c:49 ../../standalone/drakconnect_.c:625
-msgid "Terminal-based"
-msgstr "Diazezet war un dermenell"
-
-#: ../../network/modem.pm_.c:50 ../../standalone/drakconnect_.c:626
-msgid "Domain name"
-msgstr "Anv ar domani"
-
-#: ../../network/modem.pm_.c:51 ../../standalone/drakconnect_.c:627
-msgid "First DNS Server (optional)"
-msgstr "Servijer DNS kentañ (da zilenn)"
-
-#: ../../network/modem.pm_.c:52 ../../standalone/drakconnect_.c:628
-msgid "Second DNS Server (optional)"
-msgstr "Eil servijer DNS (da zilenn)"
-
-#: ../../network/netconnect.pm_.c:29
-msgid ""
-"\n"
-"You can disconnect or reconfigure your connection."
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:29 ../../network/netconnect.pm_.c:32
-#, fuzzy
-msgid ""
-"\n"
-"You can reconfigure your connection."
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../network/netconnect.pm_.c:29
-#, fuzzy
-msgid "You are currently connected to internet."
-msgstr "Da beseurt pladenn e mennit dilec'hiañ ?"
-
-#: ../../network/netconnect.pm_.c:32
-#, fuzzy
-msgid ""
-"\n"
-"You can connect to Internet or reconfigure your connection."
-msgstr "Anv ar gevreadenn"
-
-#: ../../network/netconnect.pm_.c:32
-#, fuzzy
-msgid "You are not currently connected to Internet."
-msgstr "Da beseurt pladenn e mennit dilec'hiañ ?"
-
-#: ../../network/netconnect.pm_.c:36
-#, fuzzy
-msgid "Connect"
-msgstr "Anv ar gevreadenn"
-
-#: ../../network/netconnect.pm_.c:38
-#, fuzzy
-msgid "Disconnect"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:40
-#, fuzzy
-msgid "Configure the connection"
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../network/netconnect.pm_.c:45
-#, fuzzy
-msgid "Internet connection & configuration"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:95
-#, fuzzy, c-format
-msgid "We are now going to configure the %s connection."
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../network/netconnect.pm_.c:104
-#, fuzzy, c-format
-msgid ""
-"\n"
-"\n"
-"\n"
-"We are now going to configure the %s connection.\n"
-"\n"
-"\n"
-"Press OK to continue."
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../network/netconnect.pm_.c:133 ../../network/netconnect.pm_.c:251
-#: ../../network/netconnect.pm_.c:271 ../../network/tools.pm_.c:63
-msgid "Network Configuration"
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../network/netconnect.pm_.c:134
-msgid ""
-"Because you are doing a network installation, your network is already "
-"configured.\n"
-"Click on Ok to keep your configuration, or cancel to reconfigure your "
-"Internet & Network connection.\n"
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:160
-msgid ""
-"Welcome to The Network Configuration Wizard.\n"
-"\n"
-"We are about to configure your internet/network connection.\n"
-"If you don't want to use the auto detection, deselect the checkbox.\n"
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:166
-#, fuzzy
-msgid "Choose the profile to configure"
-msgstr "Dibabit ar ment nevez"
-
-#: ../../network/netconnect.pm_.c:167
-msgid "Use auto detection"
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:168 ../../printerdrake.pm_.c:3199
-#: ../../standalone/drakconnect_.c:274 ../../standalone/drakconnect_.c:277
-#: ../../standalone/drakfloppy_.c:146
-msgid "Expert Mode"
-msgstr "Mod mailh"
-
-#: ../../network/netconnect.pm_.c:174 ../../printerdrake.pm_.c:399
-msgid "Detecting devices..."
-msgstr "O tinoiñ trobarzhelloù..."
-
-#: ../../network/netconnect.pm_.c:185 ../../network/netconnect.pm_.c:194
-#, fuzzy
-msgid "Normal modem connection"
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../network/netconnect.pm_.c:185 ../../network/netconnect.pm_.c:194
-#, fuzzy, c-format
-msgid "detected on port %s"
-msgstr "Poent marc'hañ doubl %s"
-
-#: ../../network/netconnect.pm_.c:186 ../../network/netconnect.pm_.c:195
-#, fuzzy
-msgid "ISDN connection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:186 ../../network/netconnect.pm_.c:195
-#, c-format
-msgid "detected %s"
-msgstr "kavoutet %s"
-
-#: ../../network/netconnect.pm_.c:187 ../../network/netconnect.pm_.c:196
-#, fuzzy
-msgid "ADSL connection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:187 ../../network/netconnect.pm_.c:196
-#, c-format
-msgid "detected on interface %s"
-msgstr "kavoutet war %s"
-
-#: ../../network/netconnect.pm_.c:188 ../../network/netconnect.pm_.c:197
-#, fuzzy
-msgid "Cable connection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:188 ../../network/netconnect.pm_.c:197
-#, fuzzy
-msgid "cable connection detected"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:189 ../../network/netconnect.pm_.c:198
-#, fuzzy
-msgid "LAN connection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:189 ../../network/netconnect.pm_.c:198
-msgid "ethernet card(s) detected"
-msgstr "kartenn(où) ethernet kavoutet"
-
-#: ../../network/netconnect.pm_.c:201
-#, fuzzy
-msgid "Choose the connection you want to configure"
-msgstr "Dibabit ar benveg a vennit staliañ"
-
-#: ../../network/netconnect.pm_.c:225
-msgid ""
-"You have configured multiple ways to connect to the Internet.\n"
-"Choose the one you want to use.\n"
-"\n"
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:226
-#, fuzzy
-msgid "Internet connection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../network/netconnect.pm_.c:232
-#, fuzzy
-msgid "Do you want to start the connection at boot?"
-msgstr "Mennout a rit implijout aboot ?"
-
-#: ../../network/netconnect.pm_.c:246
-#, fuzzy
-msgid "Network configuration"
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../network/netconnect.pm_.c:247
-msgid "The network needs to be restarted"
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:251
-#, fuzzy, c-format
-msgid ""
-"A problem occured while restarting the network: \n"
-"\n"
-"%s"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../network/netconnect.pm_.c:261
-msgid ""
-"Congratulations, the network and Internet configuration is finished.\n"
-"The configuration will now be applied to your system.\n"
-"\n"
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:265
-msgid ""
-"After this is done, we recommend that you restart your X environment to "
-"avoid any hostname-related problems."
-msgstr ""
-
-#: ../../network/netconnect.pm_.c:266
-msgid ""
-"Problems occured during configuration.\n"
-"Test your connection via net_monitor or mcc. If your connection doesn't "
-"work, you might want to relaunch the configuration."
-msgstr ""
-
-#: ../../network/network.pm_.c:291
-msgid ""
-"WARNING: this device has been previously configured to connect to the "
-"Internet.\n"
-"Simply accept to keep this device configured.\n"
-"Modifying the fields below will override this configuration."
-msgstr ""
-
-#: ../../network/network.pm_.c:296
-msgid ""
-"Please enter the IP configuration for this machine.\n"
-"Each item should be entered as an IP address in dotted-decimal\n"
-"notation (for example, 1.2.3.4)."
-msgstr ""
-"Skrivit ar c'hefluniadur IP evit ar benveg-mañ mar plij.\n"
-"Pep mellad a zlefe bezañ skrivet evel ur chomlec'h IP e stumm\n"
-"sifroù dekvel pikoù etrezo (da skouer 1.2.3.4)."
-
-#: ../../network/network.pm_.c:306 ../../network/network.pm_.c:307
-#, c-format
-msgid "Configuring network device %s"
-msgstr "O kefluniañ an drobarzhell rouedad %s"
-
-#: ../../network/network.pm_.c:307
-#, fuzzy, c-format
-msgid " (driver %s)"
-msgstr "Servijer XFree86 : %s\n"
-
-#: ../../network/network.pm_.c:309 ../../standalone/drakconnect_.c:231
-#: ../../standalone/drakconnect_.c:467
-msgid "IP address"
-msgstr "Chomlec'h IP"
-
-#: ../../network/network.pm_.c:310 ../../standalone/drakconnect_.c:468
-msgid "Netmask"
-msgstr "Maskl rouedad"
-
-#: ../../network/network.pm_.c:311
-msgid "(bootp/dhcp)"
-msgstr "(bootp/dhcp)"
-
-#: ../../network/network.pm_.c:311
-msgid "Automatic IP"
-msgstr "IP emgefreek"
-
-#: ../../network/network.pm_.c:312
-#, fuzzy
-msgid "Start at boot"
-msgstr "Krouiñ ur bladennig loc'hañ"
-
-#: ../../network/network.pm_.c:333 ../../printerdrake.pm_.c:875
-msgid "IP address should be in format 1.2.3.4"
-msgstr "Er furmad 1.2.3.4 e tlefe bezañ ar chomlec'h IP"
-
-#: ../../network/network.pm_.c:363
-msgid ""
-"Please enter your host name.\n"
-"Your host name should be a fully-qualified host name,\n"
-"such as ``mybox.mylab.myco.com''.\n"
-"You may also enter the IP address of the gateway if you have one"
-msgstr ""
-"Roit ho anv ostiz mar plij.\n"
-"Un anv peurzoareet a zlefe bezañ hini o ostiz,\n"
-"evel ``mabenveg.mastal.makomp.com''.\n"
-"Gallout a rit ivez reiñ chomlec'h IP an dreuzell m'hoc'h eus unan"
-
-#: ../../network/network.pm_.c:368
-msgid "DNS server"
-msgstr "Servijer DNS"
-
-#: ../../network/network.pm_.c:369
-#, c-format
-msgid "Gateway (e.g. %s)"
-msgstr ""
-
-#: ../../network/network.pm_.c:371
-msgid "Gateway device"
-msgstr "Trobarzhell an dreuzell"
-
-#: ../../network/network.pm_.c:376
-#, fuzzy
-msgid "DNS server address should be in format 1.2.3.4"
-msgstr "Er furmad 1.2.3.4 e tlefe bezañ ar chomlec'h IP"
-
-#: ../../network/network.pm_.c:380
-#, fuzzy
-msgid "Gateway address should be in format 1.2.3.4"
-msgstr "Er furmad 1.2.3.4 e tlefe bezañ ar chomlec'h IP"
-
-#: ../../network/network.pm_.c:394
-#, fuzzy
-msgid "Proxies configuration"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../network/network.pm_.c:395
-msgid "HTTP proxy"
-msgstr "Proksi HTTP"
-
-#: ../../network/network.pm_.c:396
-msgid "FTP proxy"
-msgstr "Proksi FTP"
-
-#: ../../network/network.pm_.c:397
-msgid "Track network card id (useful for laptops)"
-msgstr ""
-
-#: ../../network/network.pm_.c:400
-msgid "Proxy should be http://..."
-msgstr "http://... a zlefe bezañ ar proksi"
-
-#: ../../network/network.pm_.c:401 ../../proxy.pm_.c:65
-#, fuzzy
-msgid "Url should begin with 'ftp:' or 'http:'"
-msgstr "http://... a zlefe bezañ ar proksi"
-
-#: ../../network/shorewall.pm_.c:24
-#, fuzzy
-msgid "Firewalling configuration detected!"
-msgstr "o lenn ar c'hefluniadur"
-
-#: ../../network/shorewall.pm_.c:25
-msgid ""
-"Warning! An existing firewalling configuration has been detected. You may "
-"need some manual fix after installation."
-msgstr ""
-
-#: ../../network/tools.pm_.c:41
-#, fuzzy
-msgid "Internet configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../network/tools.pm_.c:42
-#, fuzzy
-msgid "Do you want to try to connect to the Internet now?"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../network/tools.pm_.c:46 ../../standalone/drakconnect_.c:196
-#, fuzzy
-msgid "Testing your connection..."
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../network/tools.pm_.c:56
-#, fuzzy
-msgid "The system is now connected to Internet."
-msgstr "Da beseurt pladenn e mennit dilec'hiañ ?"
-
-#: ../../network/tools.pm_.c:57
-msgid "For security reason, it will be disconnected now."
-msgstr ""
-
-#: ../../network/tools.pm_.c:58
-#, fuzzy
-msgid ""
-"The system doesn't seem to be connected to internet.\n"
-"Try to reconfigure your connection."
-msgstr "Anv ar gevreadenn"
-
-#: ../../network/tools.pm_.c:82
-#, fuzzy
-msgid "Connection Configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../network/tools.pm_.c:83
-msgid "Please fill or check the field below"
-msgstr ""
-
-#: ../../network/tools.pm_.c:85 ../../standalone/drakconnect_.c:607
-msgid "Card IRQ"
-msgstr "IRQ kartenn"
-
-#: ../../network/tools.pm_.c:86 ../../standalone/drakconnect_.c:608
-msgid "Card mem (DMA)"
-msgstr "Memor kartenn (DMA)"
-
-#: ../../network/tools.pm_.c:87 ../../standalone/drakconnect_.c:609
-msgid "Card IO"
-msgstr "IO kartenn"
-
-#: ../../network/tools.pm_.c:88 ../../standalone/drakconnect_.c:610
-msgid "Card IO_0"
-msgstr "IO_0 kartenn"
-
-#: ../../network/tools.pm_.c:89 ../../standalone/drakconnect_.c:611
-msgid "Card IO_1"
-msgstr "IO_1 kartenn"
-
-#: ../../network/tools.pm_.c:90 ../../standalone/drakconnect_.c:612
-msgid "Your personal phone number"
-msgstr ""
-
-#: ../../network/tools.pm_.c:91 ../../standalone/drakconnect_.c:613
-msgid "Provider name (ex provider.net)"
-msgstr ""
-
-#: ../../network/tools.pm_.c:92 ../../standalone/drakconnect_.c:614
-#, fuzzy
-msgid "Provider phone number"
-msgstr "Niverenn bellgomz"
-
-#: ../../network/tools.pm_.c:93 ../../standalone/drakconnect_.c:615
-msgid "Provider dns 1 (optional)"
-msgstr "Dibarzhoù ar voullerez (da zilenn)"
-
-#: ../../network/tools.pm_.c:94 ../../standalone/drakconnect_.c:616
-msgid "Provider dns 2 (optional)"
-msgstr "Dibarzhoù ar voullerez (da zilenn)"
-
-#: ../../network/tools.pm_.c:95
-#, fuzzy
-msgid "Choose your country"
-msgstr "Dibabit ho stokellaoueg"
-
-#: ../../network/tools.pm_.c:96 ../../standalone/drakconnect_.c:619
-#, fuzzy
-msgid "Dialing mode"
-msgstr "Anv domani"
-
-#: ../../network/tools.pm_.c:97 ../../standalone/drakconnect_.c:631
-#, fuzzy
-msgid "Connection speed"
-msgstr "Anv ar gevreadenn"
-
-#: ../../network/tools.pm_.c:98 ../../standalone/drakconnect_.c:632
-#, fuzzy
-msgid "Connection timeout (in sec)"
-msgstr "Anv ar gevreadenn"
-
-#: ../../network/tools.pm_.c:99 ../../standalone/drakconnect_.c:617
-#, fuzzy
-msgid "Account Login (user name)"
-msgstr "Poent marc'hañ"
-
-#: ../../network/tools.pm_.c:100 ../../standalone/drakconnect_.c:618
-#: ../../standalone/drakconnect_.c:649
-#, fuzzy
-msgid "Account Password"
-msgstr "Tremenger"
-
-#: ../../network/tools.pm_.c:104 ../../network/tools.pm_.c:118
-msgid "United Kingdom"
-msgstr ""
-
-#: ../../partition_table.pm_.c:602
-msgid "mount failed: "
-msgstr "marc'hañ sac'het : "
-
-#: ../../partition_table.pm_.c:666
-msgid "Extended partition not supported on this platform"
-msgstr ""
-
-#: ../../partition_table.pm_.c:684
-msgid ""
-"You have a hole in your partition table but I can't use it.\n"
-"The only solution is to move your primary partitions to have the hole next "
-"to the extended partitions."
-msgstr ""
-"Un toull a zo en ho taolenn barzhañ hogen n'hellan ket e implijout.\n"
-"Fiñval ar parzhadurioù kentañ derez evit ma vo an toull stok ouzh ar "
-"parzhadurioù astennet eo an diskoulm"
-
-#: ../../partition_table.pm_.c:774
-#, c-format
-msgid "Restoring from file %s failed: %s"
-msgstr "Assevel adalek ar restr %s sac'het %s"
-
-#: ../../partition_table.pm_.c:776
-msgid "Bad backup file"
-msgstr "Restr gwareziñ siek"
-
-#: ../../partition_table.pm_.c:798
-#, c-format
-msgid "Error writing to file %s"
-msgstr "Fazi en ur skrivañ er restr %s"
-
-#: ../../partition_table/raw.pm_.c:189
-msgid ""
-"Something bad is happening on your drive. \n"
-"A test to check the integrity of data has failed. \n"
-"It means writing anything on the disk will end up with random trash"
-msgstr ""
-
-#: ../../pkgs.pm_.c:26
-msgid "must have"
-msgstr "a rankfec'h kaout"
-
-#: ../../pkgs.pm_.c:27
-msgid "important"
-msgstr "a-bouez"
-
-#: ../../pkgs.pm_.c:28
-msgid "very nice"
-msgstr "brav-tre"
-
-#: ../../pkgs.pm_.c:29
-msgid "nice"
-msgstr "brav"
-
-#: ../../pkgs.pm_.c:30
-msgid "maybe"
-msgstr "marteze"
-
-#: ../../printer.pm_.c:26
-msgid "CUPS - Common Unix Printing System"
-msgstr ""
-
-#: ../../printer.pm_.c:27
-msgid "LPRng - LPR New Generation"
-msgstr ""
-
-#: ../../printer.pm_.c:28
-msgid "LPD - Line Printer Daemon"
-msgstr ""
-
-#: ../../printer.pm_.c:29
-msgid "PDQ - Print, Don't Queue"
-msgstr ""
-
-#: ../../printer.pm_.c:34 ../../printer.pm_.c:1144
-msgid "CUPS"
-msgstr "CUPS"
-
-#: ../../printer.pm_.c:35
-msgid "LPRng"
-msgstr "LPRng"
-
-#: ../../printer.pm_.c:36
-msgid "LPD"
-msgstr "LPD"
-
-#: ../../printer.pm_.c:37
-msgid "PDQ"
-msgstr "PDQ"
-
-#: ../../printer.pm_.c:49
-msgid "Local printer"
-msgstr "Moullerez lec'hel"
-
-#: ../../printer.pm_.c:50
-#, fuzzy
-msgid "Remote printer"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printer.pm_.c:51
-#, fuzzy
-msgid "Printer on remote CUPS server"
-msgstr "Steud a-bell"
-
-#: ../../printer.pm_.c:52 ../../printerdrake.pm_.c:898
-#, fuzzy
-msgid "Printer on remote lpd server"
-msgstr "lpd a-bell"
-
-#: ../../printer.pm_.c:53
-#, fuzzy
-msgid "Network printer (TCP/Socket)"
-msgstr "Dibarzhoù ar voullerez NetWare"
-
-#: ../../printer.pm_.c:54
-#, fuzzy
-msgid "Printer on SMB/Windows 95/98/NT server"
-msgstr "SMB/Windows 95/98/NT"
-
-#: ../../printer.pm_.c:55
-#, fuzzy
-msgid "Printer on NetWare server"
-msgstr "Servijer moullañ"
-
-#: ../../printer.pm_.c:56 ../../printerdrake.pm_.c:902
-#, fuzzy
-msgid "Enter a printer device URI"
-msgstr "Trobarzhell ar voullerez"
-
-#: ../../printer.pm_.c:57
-msgid "Pipe job into a command"
-msgstr ""
-
-#: ../../printer.pm_.c:328 ../../printer.pm_.c:370 ../../printer.pm_.c:552
-msgid "Unknown Model"
-msgstr ""
-
-#: ../../printer.pm_.c:754 ../../printer.pm_.c:945 ../../printer.pm_.c:1337
-#: ../../printerdrake.pm_.c:2305 ../../printerdrake.pm_.c:3462
-msgid "Unknown model"
-msgstr ""
-
-#: ../../printer.pm_.c:782
-msgid "Local Printers"
-msgstr "Moullerezioù lec'hel"
-
-#: ../../printer.pm_.c:784 ../../printer.pm_.c:1145
-msgid "Remote Printers"
-msgstr "Moullerezio* a-bell"
-
-#: ../../printer.pm_.c:791 ../../printerdrake.pm_.c:417
-#, c-format
-msgid " on parallel port \\/*%s"
-msgstr ""
-
-#: ../../printer.pm_.c:794 ../../printerdrake.pm_.c:419
-#, c-format
-msgid ", USB printer \\/*%s"
-msgstr ", Mouluriez USB \\/*%s"
-
-#: ../../printer.pm_.c:799
-#, c-format
-msgid ", multi-function device on parallel port \\/*%s"
-msgstr ""
-
-#: ../../printer.pm_.c:802
-msgid ", multi-function device on USB"
-msgstr ""
-
-#: ../../printer.pm_.c:804
-msgid ", multi-function device on HP JetDirect"
-msgstr ""
-
-#: ../../printer.pm_.c:806
-msgid ", multi-function device"
-msgstr ""
-
-#: ../../printer.pm_.c:809
-#, fuzzy, c-format
-msgid ", printing to %s"
-msgstr "Fazi en ur skrivañ er restr %s"
-
-#: ../../printer.pm_.c:811
-#, c-format
-msgid " on LPD server \"%s\", printer \"%s\""
-msgstr ""
-
-#: ../../printer.pm_.c:813
-#, c-format
-msgid ", TCP/IP host \"%s\", port %s"
-msgstr ""
-
-#: ../../printer.pm_.c:817
-#, c-format
-msgid " on SMB/Windows server \"%s\", share \"%s\""
-msgstr ""
-
-#: ../../printer.pm_.c:821
-#, c-format
-msgid " on Novell server \"%s\", printer \"%s\""
-msgstr ""
-
-#: ../../printer.pm_.c:823
-#, c-format
-msgid ", using command %s"
-msgstr ""
-
-#: ../../printer.pm_.c:942 ../../printerdrake.pm_.c:1701
-msgid "Raw printer (No driver)"
-msgstr ""
-
-#: ../../printer.pm_.c:1114
-#, fuzzy, c-format
-msgid "(on %s)"
-msgstr "(mollad %s)"
-
-#: ../../printer.pm_.c:1116
-msgid "(on this machine)"
-msgstr ""
-
-#: ../../printer.pm_.c:1141
-#, fuzzy, c-format
-msgid "On CUPS server \"%s\""
-msgstr "IP ar servijer SMB"
-
-#: ../../printer.pm_.c:1147 ../../printerdrake.pm_.c:3119
-#: ../../printerdrake.pm_.c:3130 ../../printerdrake.pm_.c:3351
-#: ../../printerdrake.pm_.c:3403 ../../printerdrake.pm_.c:3429
-#: ../../printerdrake.pm_.c:3604 ../../printerdrake.pm_.c:3606
-msgid " (Default)"
-msgstr " (Dre ziouer)"
-
-#: ../../printerdrake.pm_.c:25
-msgid "Select Printer Connection"
-msgstr "Diuzit lugerezh ar voullerez"
-
-#: ../../printerdrake.pm_.c:26
-msgid "How is the printer connected?"
-msgstr "Penaos eo luget ar voullerez ?"
-
-#: ../../printerdrake.pm_.c:28
-msgid ""
-"\n"
-"Printers on remote CUPS servers you do not have to configure here; these "
-"printers will be automatically detected."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:36
-msgid "Printer auto-detection (Local, TCP/Socket, and SMB printers)"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:84 ../../printerdrake.pm_.c:3183
-#, fuzzy
-msgid "CUPS configuration"
-msgstr "Kefluniadur"
-
-#: ../../printerdrake.pm_.c:85 ../../printerdrake.pm_.c:3184
-#, fuzzy
-msgid "Specify CUPS server"
-msgstr "Steud a-bell"
-
-#: ../../printerdrake.pm_.c:86
-msgid ""
-"To get access to printers on remote CUPS servers in your local network you "
-"do not have to configure anything; the CUPS servers inform your machine "
-"automatically about their printers. All printers currently known to your "
-"machine are listed in the \"Remote printers\" section in the main window of "
-"Printerdrake. When your CUPS server is not in your local network, you have "
-"to enter the CUPS server IP address and optionally the port number to get "
-"the printer information from the server, otherwise leave these fields blank."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:87
-msgid ""
-"\n"
-"Normally, CUPS is automatically configured according to your network "
-"environment, so that you can access the printers on the CUPS servers in your "
-"local network. If this does not work correctly, turn off \"Automatic CUPS "
-"configuration\" and edit your file /etc/cups/cupsd.conf manually. Do not "
-"forget to restart CUPS afterwards (command: \"service cups restart\")."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:91
-#, fuzzy
-msgid "The IP address should look like 192.168.1.20"
-msgstr "Er furmad 1.2.3.4 e tlefe bezañ ar chomlec'h IP"
-
-#: ../../printerdrake.pm_.c:95 ../../printerdrake.pm_.c:1109
-msgid "The port number should be an integer!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:102
-#, fuzzy
-msgid "CUPS server IP"
-msgstr "IP ar servijer SMB"
-
-#: ../../printerdrake.pm_.c:103 ../../printerdrake.pm_.c:1129
-#, fuzzy
-msgid "Port"
-msgstr "Paour"
-
-#: ../../printerdrake.pm_.c:105
-#, fuzzy
-msgid "Automatic CUPS configuration"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../printerdrake.pm_.c:177 ../../printerdrake.pm_.c:247
-#: ../../printerdrake.pm_.c:1574 ../../printerdrake.pm_.c:1578
-#: ../../printerdrake.pm_.c:1696 ../../printerdrake.pm_.c:2248
-#: ../../printerdrake.pm_.c:2401 ../../printerdrake.pm_.c:2460
-#: ../../printerdrake.pm_.c:2533 ../../printerdrake.pm_.c:2554
-#: ../../printerdrake.pm_.c:2747 ../../printerdrake.pm_.c:2788
-#: ../../printerdrake.pm_.c:2793 ../../printerdrake.pm_.c:2827
-#: ../../printerdrake.pm_.c:2832 ../../printerdrake.pm_.c:2869
-#: ../../printerdrake.pm_.c:2922 ../../printerdrake.pm_.c:2942
-#: ../../printerdrake.pm_.c:2956 ../../printerdrake.pm_.c:2990
-#: ../../printerdrake.pm_.c:3036 ../../printerdrake.pm_.c:3054
-#: ../../printerdrake.pm_.c:3143 ../../printerdrake.pm_.c:3217
-#: ../../printerdrake.pm_.c:3519 ../../printerdrake.pm_.c:3574
-#: ../../printerdrake.pm_.c:3627 ../../standalone/printerdrake_.c:57
-#, fuzzy
-msgid "Printerdrake"
-msgstr "Moullerez"
-
-#: ../../printerdrake.pm_.c:178
-#, fuzzy
-msgid "Checking your system..."
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:186
-msgid ""
-"There are no printers found which are directly connected to your machine"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:198
-#, fuzzy
-msgid ""
-"The following printers\n"
-"\n"
-msgstr "Ar pakadoù a-heul a zo war-nes bezañ staliet/lamet"
-
-#: ../../printerdrake.pm_.c:199
-#, fuzzy
-msgid ""
-"The following printer\n"
-"\n"
-msgstr "Ar pakadoù a-heul a zo war-nes bezañ staliet/lamet"
-
-#: ../../printerdrake.pm_.c:201
-msgid ""
-"\n"
-"and one unknown printer are "
-msgstr ""
-
-#: ../../printerdrake.pm_.c:203
-#, c-format
-msgid ""
-"\n"
-"and %d unknown printers are "
-msgstr ""
-
-#: ../../printerdrake.pm_.c:207
-msgid ""
-"\n"
-"are "
-msgstr ""
-
-#: ../../printerdrake.pm_.c:208
-msgid ""
-"\n"
-"is "
-msgstr ""
-
-#: ../../printerdrake.pm_.c:210
-#, fuzzy
-msgid "directly connected to your system"
-msgstr "Da beseurt pladenn e mennit dilec'hiañ ?"
-
-#: ../../printerdrake.pm_.c:213
-msgid ""
-"\n"
-"There is one unknown printer directly connected to your system"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:215
-#, c-format
-msgid ""
-"\n"
-"There are %d unknown printers directly connected to your system"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:221
-#, fuzzy
-msgid " (Make sure that all your printers are connected and turned on).\n"
-msgstr "Dibabit ouzh pe borzh a-steud eo luget ho modem, mar plij."
-
-#: ../../printerdrake.pm_.c:235
-msgid ""
-"Do you want to enable printing on the printers mentioned above or on "
-"printers in the local network?\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:236
-#, fuzzy
-msgid "Do you want to enable printing on printers in the local network?\n"
-msgstr "Ha mennout a rit amprouiñ moullañ skrid ?"
-
-#: ../../printerdrake.pm_.c:238
-#, fuzzy
-msgid "Do you want to enable printing on the printers mentioned above?\n"
-msgstr "Mennout a rit implijout aboot ?"
-
-#: ../../printerdrake.pm_.c:239
-msgid "Are you sure that you want to set up printing on this machine?\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:240
-#, c-format
-msgid ""
-"NOTE: Depending on the printer model and the printing system up to %d MB of "
-"additional software will be installed."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:279 ../../printerdrake.pm_.c:291
-#: ../../printerdrake.pm_.c:361 ../../printerdrake.pm_.c:3165
-#: ../../printerdrake.pm_.c:3290
-#, fuzzy
-msgid "Add a new printer"
-msgstr "Moullerez lec'hel"
-
-#: ../../printerdrake.pm_.c:280
-msgid ""
-"\n"
-"Welcome to the Printer Setup Wizard\n"
-"\n"
-"This wizard allows you to install local or remote printers to be used from "
-"this machine and also from other machines in the network.\n"
-"\n"
-"It asks you for all necessary information to set up the printer and gives "
-"you access to all available printer drivers, driver options, and printer "
-"connection types."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:293
-msgid ""
-"\n"
-"Welcome to the Printer Setup Wizard\n"
-"\n"
-"This wizard will help you to install your printer(s) connected to this "
-"computer, connected directly to the network or to a remote Windows machine.\n"
-"\n"
-"If you have printer(s) connected to this machine, Please plug it/them in on "
-"this computer and turn it/them on so that it/they can be auto-detected. Also "
-"your network printer(s) and you Windows machines must be connected and "
-"turned on.\n"
-"\n"
-"Note that auto-detecting printers on the network takes longer than the auto-"
-"detection of only the printers connected to this machine. So turn off the "
-"auto-detection of network and/or Windows-hosted printers when you don't need "
-"it.\n"
-"\n"
-" Click on \"Next\" when you are ready, and on \"Cancel\" when you do not "
-"want to set up your printer(s) now."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:302 ../../printerdrake.pm_.c:319
-msgid ""
-"\n"
-"Welcome to the Printer Setup Wizard\n"
-"\n"
-"This wizard will help you to install your printer(s) connected to this "
-"computer.\n"
-"\n"
-"If you have printer(s) connected to this machine, Please plug it/them in on "
-"this computer and turn it/them on so that it/they can be auto-detected.\n"
-"\n"
-" Click on \"Next\" when you are ready, and on \"Cancel\" when you do not "
-"want to set up your printer(s) now."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:310
-msgid ""
-"\n"
-"Welcome to the Printer Setup Wizard\n"
-"\n"
-"This wizard will help you to install your printer(s) connected to this "
-"computer or connected directly to the network.\n"
-"\n"
-"If you have printer(s) connected to this machine, Please plug it/them in on "
-"this computer and turn it/them on so that it/they can be auto-detected. Also "
-"your network printer(s) must be connected and turned on.\n"
-"\n"
-"Note that auto-detecting printers on the network takes longer than the auto-"
-"detection of only the printers connected to this machine. So turn off the "
-"auto-detection of network printers when you don't need it.\n"
-"\n"
-" Click on \"Next\" when you are ready, and on \"Cancel\" when you do not "
-"want to set up your printer(s) now."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:328
-#, fuzzy
-msgid "Auto-detect printers connected to this machine"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:331
-msgid "Auto-detect printers connected directly to the local network"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:334
-msgid "Auto-detect printers connected to machines running Microsoft Windows"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:362
-msgid ""
-"\n"
-"Congratulations, your printer is now installed and configured!\n"
-"\n"
-"You can print using the \"Print\" command of your application (usually in "
-"the \"File\" menu).\n"
-"\n"
-"If you want to add, remove, or rename a printer, or if you want to change "
-"the default option settings (paper input tray, printout quality, ...), "
-"select \"Printer\" in the \"Hardware\" section of the Mandrake Control "
-"Center."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:399 ../../printerdrake.pm_.c:590
-#: ../../printerdrake.pm_.c:805 ../../printerdrake.pm_.c:1045
-#, fuzzy
-msgid "Printer auto-detection"
-msgstr "Dilesadur"
-
-#: ../../printerdrake.pm_.c:421
-#, c-format
-msgid ", network printer \"%s\", port %s"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:423
-#, fuzzy, c-format
-msgid ", printer \"%s\" on SMB/Windows server \"%s\""
-msgstr "SMB/Windows 95/98/NT"
-
-#: ../../printerdrake.pm_.c:429
-#, fuzzy, c-format
-msgid "Detected %s"
-msgstr "Poent marc'hañ doubl %s"
-
-#: ../../printerdrake.pm_.c:433 ../../printerdrake.pm_.c:464
-#: ../../printerdrake.pm_.c:483
-#, c-format
-msgid "Printer on parallel port \\/*%s"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:435 ../../printerdrake.pm_.c:466
-#: ../../printerdrake.pm_.c:488
-#, c-format
-msgid "USB printer \\/*%s"
-msgstr "Moullerez USB \\/*%s"
-
-#: ../../printerdrake.pm_.c:437
-#, fuzzy, c-format
-msgid "Network printer \"%s\", port %s"
-msgstr "Dibarzhoù ar voullerez NetWare"
-
-#: ../../printerdrake.pm_.c:439
-#, fuzzy, c-format
-msgid "Printer \"%s\" on SMB/Windows server \"%s\""
-msgstr "SMB/Windows 95/98/NT"
-
-#: ../../printerdrake.pm_.c:575 ../../printerdrake.pm_.c:600
-msgid "Local Printer"
-msgstr "Moullerez lec'hel"
-
-#: ../../printerdrake.pm_.c:576
-msgid ""
-"No local printer found! To manually install a printer enter a device name/"
-"file name in the input line (Parallel Ports: /dev/lp0, /dev/lp1, ..., "
-"equivalent to LPT1:, LPT2:, ..., 1st USB printer: /dev/usb/lp0, 2nd USB "
-"printer: /dev/usb/lp1, ...)."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:580
-#, fuzzy
-msgid "You must enter a device or file name!"
-msgstr "Trobarzhell ar voullerez"
-
-#: ../../printerdrake.pm_.c:591
-#, fuzzy
-msgid "No printer found!"
-msgstr "N'ev ket Moullerez lec'hel!\n"
-
-#: ../../printerdrake.pm_.c:601
-#, fuzzy
-msgid "Available printers"
-msgstr "Pakadoù hegerz"
-
-#: ../../printerdrake.pm_.c:605
-msgid ""
-"The following printer was auto-detected, if it is not the one you want to "
-"configure, enter a device name/file name in the input line"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:606
-msgid ""
-"Here is a list of all auto-detected printers. Please choose the printer you "
-"want to set up or enter a device name/file name in the input line"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:608
-msgid ""
-"The following printer was auto-detected. The configuration of the printer "
-"will work fully automatically. If your printer was not correctly detected or "
-"if you prefer a customized printer configuration, turn on \"Manual "
-"configuration\"."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:609
-msgid ""
-"Here is a list of all auto-detected printers. Please choose the printer you "
-"want to set up. The configuration of the printer will work fully "
-"automatically. If your printer was not correctly detected or if you prefer a "
-"customized printer configuration, turn on \"Manual configuration\"."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:611
-msgid ""
-"Please choose the port where your printer is connected to or enter a device "
-"name/file name in the input line"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:612
-#, fuzzy
-msgid "Please choose the port where your printer is connected to."
-msgstr "Dibabit ouzh pe borzh a-steud eo luget ho modem, mar plij."
-
-#: ../../printerdrake.pm_.c:614
-msgid ""
-" (Parallel Ports: /dev/lp0, /dev/lp1, ..., equivalent to LPT1:, LPT2:, ..., "
-"1st USB printer: /dev/usb/lp0, 2nd USB printer: /dev/usb/lp1, ...)."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:619
-#, fuzzy
-msgid "You must choose/enter a printer/device!"
-msgstr "Trobarzhell ar voullerez"
-
-#: ../../printerdrake.pm_.c:639
-#, fuzzy
-msgid "Manual configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../printerdrake.pm_.c:693
-msgid "Remote lpd Printer Options"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:694
-#, fuzzy
-msgid ""
-"To use a remote lpd printer, you need to supply the hostname of the printer "
-"server and the printer name on that server."
-msgstr ""
-"A-benn implijout ur steud moulañ lpd a-bell, ret eo deoc'h\n"
-"pourvezañ anv ostiz ar servijer moullañ hag anv as steud\n"
-"war ar servijer-se ma zlefe bezañ kaset an dleadoù moullañ."
-
-#: ../../printerdrake.pm_.c:695
-#, fuzzy
-msgid "Remote host name"
-msgstr "Anv an ostiz a-bell"
-
-#: ../../printerdrake.pm_.c:696
-#, fuzzy
-msgid "Remote printer name"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:699
-#, fuzzy
-msgid "Remote host name missing!"
-msgstr "Anv an ostiz a-bell"
-
-#: ../../printerdrake.pm_.c:703
-#, fuzzy
-msgid "Remote printer name missing!"
-msgstr "Anv an ostiz a-bell"
-
-#: ../../printerdrake.pm_.c:727 ../../printerdrake.pm_.c:1244
-#, fuzzy, c-format
-msgid "Detected model: %s %s"
-msgstr "Poent marc'hañ doubl %s"
-
-#: ../../printerdrake.pm_.c:805 ../../printerdrake.pm_.c:1045
-#, fuzzy
-msgid "Scanning network..."
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../printerdrake.pm_.c:814 ../../printerdrake.pm_.c:835
-#, c-format
-msgid ", printer \"%s\" on server \"%s\""
-msgstr ""
-
-#: ../../printerdrake.pm_.c:817 ../../printerdrake.pm_.c:838
-#, fuzzy, c-format
-msgid "Printer \"%s\" on server \"%s\""
-msgstr "O tizenaouiñ ar rouedad"
-
-#: ../../printerdrake.pm_.c:858
-msgid "SMB (Windows 9x/NT) Printer Options"
-msgstr "Dibarzhoù moullañ SMB (Windows 9x/NT)"
-
-#: ../../printerdrake.pm_.c:859
-#, fuzzy
-msgid ""
-"To print to a SMB printer, you need to provide the SMB host name (Note! It "
-"may be different from its TCP/IP hostname!) and possibly the IP address of "
-"the print server, as well as the share name for the printer you wish to "
-"access and any applicable user name, password, and workgroup information."
-msgstr ""
-"Evit moullañ war ur voullerez SMB eo ret deoc'h pourvezañ\n"
-"anv an ostiz SMB (Ho evezh ! Disheñvel e c'hell bezañ diouzh\n"
-"e anv ostiz TCP/IP !) ha marteze chomlec'h IP ar servijer moullañ,\n"
-"kement hag anv rannet ar voullerez a glaskit tizhout ha ne vern pe\n"
-"ditour a anv arveriad, tremenger ha strollad labour en implij."
-
-#: ../../printerdrake.pm_.c:860
-msgid ""
-" If the desired printer was auto-detected, simply choose it from the list "
-"and then add user name, password, and/or workgroup if needed."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:861
-msgid "SMB server host"
-msgstr "Anv ar servijer SMB"
-
-#: ../../printerdrake.pm_.c:862
-msgid "SMB server IP"
-msgstr "IP ar servijer SMB"
-
-#: ../../printerdrake.pm_.c:863
-msgid "Share name"
-msgstr "Anv rannet"
-
-#: ../../printerdrake.pm_.c:866
-msgid "Workgroup"
-msgstr "Strollad labour"
-
-#: ../../printerdrake.pm_.c:868
-#, fuzzy
-msgid "Auto-detected"
-msgstr "Dilesadur"
-
-#: ../../printerdrake.pm_.c:879
-msgid "Either the server name or the server's IP must be given!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:883
-msgid "Samba share name missing!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:889
-msgid "SECURITY WARNING!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:890
-#, c-format
-msgid ""
-"You are about to set up printing to a Windows account with password. Due to "
-"a fault in the architecture of the Samba client software the password is put "
-"in clear text into the command line of the Samba client used to transmit the "
-"print job to the Windows server. So it is possible for every user on this "
-"machine to display the password on the screen by issuing commands as \"ps "
-"auxwww\".\n"
-"\n"
-"We recommend to make use of one of the following alternatives (in all cases "
-"you have to make sure that only machines from your local network have access "
-"to your Windows server, for example by means of a firewall):\n"
-"\n"
-"Use a password-less account on your Windows server, as the \"GUEST\" account "
-"or a special account dedicated for printing. Do not remove the password "
-"protection from a personal account or the administrator account.\n"
-"\n"
-"Set up your Windows server to make the printer available under the LPD "
-"protocol. Then set up printing from this machine with the \"%s\" connection "
-"type in Printerdrake.\n"
-"\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:900
-#, c-format
-msgid ""
-"Set up your Windows server to make the printer available under the IPP "
-"protocol and set up printing from this machine with the \"%s\" connection "
-"type in Printerdrake.\n"
-"\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:903
-msgid ""
-"Connect your printer to a Linux server and let your Windows machine(s) "
-"connect to it as a client.\n"
-"\n"
-"Do you really want to continue setting up this printer as you are doing now?"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:975
-msgid "NetWare Printer Options"
-msgstr "Dibarzhoù ar voullerez NetWare"
-
-#: ../../printerdrake.pm_.c:976
-#, fuzzy
-msgid ""
-"To print on a NetWare printer, you need to provide the NetWare print server "
-"name (Note! it may be different from its TCP/IP hostname!) as well as the "
-"print queue name for the printer you wish to access and any applicable user "
-"name and password."
-msgstr ""
-"Evit moullañ war ur voullerez NetWare eo ret deoc'h pourvezañ anv ar\n"
-"servijer moullañ NetWare (Ho evezh ! Disheñvel e c'hell bezañ diouzh e\n"
-"anv ostiz TCP/IP !) kement hag anv ar steud moullañ evit ar voullerez\n"
-"a glaskit tizhout ha ne vern pe anv arveriad ha tremenger en implij."
-
-#: ../../printerdrake.pm_.c:977
-msgid "Printer Server"
-msgstr "Servijer moullañ"
-
-#: ../../printerdrake.pm_.c:978
-msgid "Print Queue Name"
-msgstr "Anv ar steud moullañ"
-
-#: ../../printerdrake.pm_.c:983
-msgid "NCP server name missing!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:987
-msgid "NCP queue name missing!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1054 ../../printerdrake.pm_.c:1074
-#, c-format
-msgid ", host \"%s\", port %s"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1057 ../../printerdrake.pm_.c:1077
-#, c-format
-msgid "Host \"%s\", port %s"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1097
-#, fuzzy
-msgid "TCP/Socket Printer Options"
-msgstr "Dibarzhoù ar voullerez NetWare"
-
-#: ../../printerdrake.pm_.c:1099
-msgid ""
-"Choose one of the auto-detected printers from the list or enter the hostname "
-"or IP and the optional port number (default is 9100) into the input fields."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1100
-msgid ""
-"To print to a TCP or socket printer, you need to provide the host name or IP "
-"of the printer and optionally the port number (default is 9100). On HP "
-"JetDirect servers the port number is usually 9100, on other servers it can "
-"vary. See the manual of your hardware."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1105
-#, fuzzy
-msgid "Printer host name or IP missing!"
-msgstr "Dibarzhoù ar voullerez"
-
-#: ../../printerdrake.pm_.c:1127
-#, fuzzy
-msgid "Printer host name or IP"
-msgstr "Anv ar voullerez"
-
-#: ../../printerdrake.pm_.c:1177 ../../printerdrake.pm_.c:1179
-#, fuzzy
-msgid "Printer Device URI"
-msgstr "Trobarzhell ar voullerez"
-
-#: ../../printerdrake.pm_.c:1178
-msgid ""
-"You can specify directly the URI to access the printer. The URI must fulfill "
-"either the CUPS or the Foomatic specifications. Note that not all URI types "
-"are supported by all the spoolers."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1193
-msgid "A valid URI must be entered!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1560
-msgid ""
-"Every printer needs a name (for example \"printer\"). The Description and "
-"Location fields do not need to be filled in. They are comments for the users."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1561
-msgid "Name of printer"
-msgstr "Anv ar moullerez"
-
-#: ../../printerdrake.pm_.c:1563
-#, fuzzy
-msgid "Location"
-msgstr "Titouroù"
-
-#: ../../printerdrake.pm_.c:1575 ../../printerdrake.pm_.c:1697
-msgid "Reading printer database..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1579
-msgid "Preparing printer database..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1676
-#, fuzzy
-msgid "Your printer model"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:1677
-#, c-format
-msgid ""
-"Printerdrake has compared the model name resulting from the printer auto-"
-"detection with the models listed in its printer database to find the best "
-"match. This choice can be wrong, especially when your printer is not listed "
-"at all in the database. So check whether the choice is correct and click "
-"\"The model is correct\" if so and if not, click \"Select model manually\" "
-"so that you can choose your printer model manually on the next screen.\n"
-"\n"
-"For your printer Printerdrake has found:\n"
-"\n"
-"%s"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1682 ../../printerdrake.pm_.c:1685
-#, fuzzy
-msgid "The model is correct"
-msgstr "Ha reizh eo ?"
-
-#: ../../printerdrake.pm_.c:1683 ../../printerdrake.pm_.c:1684
-#: ../../printerdrake.pm_.c:1687
-#, fuzzy
-msgid "Select model manually"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:1704
-#, fuzzy
-msgid "Printer model selection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../printerdrake.pm_.c:1705
-#, fuzzy
-msgid "Which printer model do you have?"
-msgstr "Peseurt moullerez hoc'h eus ?"
-
-#: ../../printerdrake.pm_.c:1706
-msgid ""
-"\n"
-"\n"
-"Please check whether Printerdrake did the auto-detection of your printer "
-"model correctly. Search the correct model in the list when the cursor is "
-"standing on a wrong model or on \"Raw printer\"."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1709
-msgid ""
-"If your printer is not listed, choose a compatible (see printer manual) or a "
-"similar one."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1786
-#, fuzzy
-msgid "OKI winprinter configuration"
-msgstr "Kefluniañ ar modem"
-
-#: ../../printerdrake.pm_.c:1787
-msgid ""
-"You are configuring an OKI laser winprinter. These printers\n"
-"use a very special communication protocol and therefore they work only when "
-"connected to the first parallel port. When your printer is connected to "
-"another port or to a print server box please connect the printer to the "
-"first parallel port before you print a test page. Otherwise the printer will "
-"not work. Your connection type setting will be ignored by the driver."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1830 ../../printerdrake.pm_.c:1857
-#, fuzzy
-msgid "Lexmark inkjet configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../printerdrake.pm_.c:1831
-msgid ""
-"The inkjet printer drivers provided by Lexmark only support local printers, "
-"no printers on remote machines or print server boxes. Please connect your "
-"printer to a local port or configure it on the machine where it is connected "
-"to."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1858
-msgid ""
-"To be able to print with your Lexmark inkjet and this configuration, you "
-"need the inkjet printer drivers provided by Lexmark (http://www.lexmark."
-"com/). Click on the \"Drivers\" link. Then choose your model and afterwards "
-"\"Linux\" as operating system. The drivers come as RPM packages or shell "
-"scripts with interactive graphical installation. You do not need to do this "
-"configuration by the graphical frontends. Cancel directly after the license "
-"agreement. Then print printhead alignment pages with \"lexmarkmaintain\" and "
-"adjust the head alignment settings with this program."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1861
-msgid "GDI Laser Printer using the Zenographics ZJ-Stream Format"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:1862
-msgid ""
-"Your printer belongs to the group of GDI laser printers (winprinters) sold "
-"by different manufacturers which uses the Zenographics ZJ-stream raster "
-"format for the data sent to the printer. The driver for these printers is "
-"still in a very early development stage and so it will perhaps not always "
-"work properly. Especially it is possible that the printer only works when "
-"you choose the A4 paper size.\n"
-"\n"
-"Some of these printers, as the HP LaserJet 1000, for which this driver was "
-"originally created, need their firmware to be uploaded to them after they "
-"are turned on. In the case of the HP LaserJet 1000 you have to search the "
-"printer's Windows driver CD or your Windows partition for the file "
-"\"sihp1000.img\" and upload the file to the printer with one of the "
-"following commands:\n"
-"\n"
-" lpr -o raw sihp1000.img\n"
-" cat sihp1000.img > /dev/usb/lp0\n"
-"\n"
-"The first command can be given by any normal user, the second must be given "
-"as root. After having done so you can print normally.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2085
-msgid ""
-"Printer default settings\n"
-"\n"
-"You should make sure that the page size and the ink type/printing mode (if "
-"available) and also the hardware configuration of laser printers (memory, "
-"duplex unit, extra trays) are set correctly. Note that with a very high "
-"printout quality/resolution printing can get substantially slower."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2094
-#, c-format
-msgid "Option %s must be an integer number!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2098
-#, c-format
-msgid "Option %s must be a number!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2103
-#, c-format
-msgid "Option %s out of range!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2142
-#, fuzzy, c-format
-msgid ""
-"Do you want to set this printer (\"%s\")\n"
-"as the default printer?"
-msgstr "Ha mennout a rit amprouiñ moullañ skrid ?"
-
-#: ../../printerdrake.pm_.c:2165
-#, fuzzy
-msgid "Test pages"
-msgstr "Amprouiñ ar porzhioù"
-
-#: ../../printerdrake.pm_.c:2166
-msgid ""
-"Please select the test pages you want to print.\n"
-"Note: the photo test page can take a rather long time to get printed and on "
-"laser printers with too low memory it can even not come out. In most cases "
-"it is enough to print the standard test page."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2170
-#, fuzzy
-msgid "No test pages"
-msgstr "Ya, moullit an div bajenn arnod"
-
-#: ../../printerdrake.pm_.c:2171
-#, fuzzy
-msgid "Print"
-msgstr "Moullerez"
-
-#: ../../printerdrake.pm_.c:2228
-#, fuzzy
-msgid "Standard test page"
-msgstr "Diorren"
-
-#: ../../printerdrake.pm_.c:2231
-msgid "Alternative test page (Letter)"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2234
-#, fuzzy
-msgid "Alternative test page (A4)"
-msgstr "O voullañ pajenn(où) skrid..."
-
-#: ../../printerdrake.pm_.c:2236
-#, fuzzy
-msgid "Photo test page"
-msgstr "O voullañ pajenn(où) skrid..."
-
-#: ../../printerdrake.pm_.c:2240
-#, fuzzy
-msgid "Do not print any test page"
-msgstr "O voullañ pajenn(où) skrid..."
-
-#: ../../printerdrake.pm_.c:2249 ../../printerdrake.pm_.c:2402
-msgid "Printing test page(s)..."
-msgstr "O voullañ pajenn(où) skrid..."
-
-#: ../../printerdrake.pm_.c:2274
-#, fuzzy, c-format
-msgid ""
-"Test page(s) have been sent to the printer.\n"
-"It may take some time before the printer starts.\n"
-"Printing status:\n"
-"%s\n"
-"\n"
-msgstr ""
-"Pajenn(où) arnod zo bet kaset d'an diaoul moullañ.\n"
-"Ur pennadig e c'hell padout a-raok ma loc'hfe a voullerez.\n"
-"Stad ar moullañ :\n"
-"%s\n"
-"\n"
-"Ha mont a ra en-dro reizh ?"
-
-#: ../../printerdrake.pm_.c:2278
-#, fuzzy
-msgid ""
-"Test page(s) have been sent to the printer.\n"
-"It may take some time before the printer starts.\n"
-msgstr ""
-"Pajenn(où) arnod zo bet kaset d'an diaoul moullañ.\n"
-"Ur pennadig e c'hell padout a-raok ma loc'hfe a voullerez.\n"
-"Ha mont a ra en-dro reizh ?"
-
-#: ../../printerdrake.pm_.c:2285
-msgid "Did it work properly?"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2307 ../../printerdrake.pm_.c:3464
-#, fuzzy
-msgid "Raw printer"
-msgstr "Moullerez lec'hel"
-
-#: ../../printerdrake.pm_.c:2333
-#, c-format
-msgid ""
-"To print a file from the command line (terminal window) you can either use "
-"the command \"%s <file>\" or a graphical printing tool: \"xpp <file>\" or "
-"\"kprinter <file>\". The graphical tools allow you to choose the printer and "
-"to modify the option settings easily.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2335
-msgid ""
-"These commands you can also use in the \"Printing command\" field of the "
-"printing dialogs of many applications, but here do not supply the file name "
-"because the file to print is provided by the application.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2338 ../../printerdrake.pm_.c:2355
-#: ../../printerdrake.pm_.c:2365
-#, c-format
-msgid ""
-"\n"
-"The \"%s\" command also allows to modify the option settings for a "
-"particular printing job. Simply add the desired settings to the command "
-"line, e. g. \"%s <file>\". "
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2341 ../../printerdrake.pm_.c:2381
-#, c-format
-msgid ""
-"To know about the options available for the current printer read either the "
-"list shown below or click on the \"Print option list\" button.%s%s\n"
-"\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2345
-msgid ""
-"Here is a list of the available printing options for the current printer:\n"
-"\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2350 ../../printerdrake.pm_.c:2360
-#, c-format
-msgid ""
-"To print a file from the command line (terminal window) use the command \"%s "
-"<file>\".\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2352 ../../printerdrake.pm_.c:2362
-#: ../../printerdrake.pm_.c:2372
-msgid ""
-"This command you can also use in the \"Printing command\" field of the "
-"printing dialogs of many applications. But here do not supply the file name "
-"because the file to print is provided by the application.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2357 ../../printerdrake.pm_.c:2367
-msgid ""
-"To get a list of the options available for the current printer click on the "
-"\"Print option list\" button."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2370
-#, c-format
-msgid ""
-"To print a file from the command line (terminal window) use the command \"%s "
-"<file>\" or \"%s <file>\".\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2374
-msgid ""
-"You can also use the graphical interface \"xpdq\" for setting options and "
-"handling printing jobs.\n"
-"If you are using KDE as desktop environment you have a \"panic button\", an "
-"icon on the desktop, labeled with \"STOP Printer!\", which stops all print "
-"jobs immediately when you click it. This is for example useful for paper "
-"jams.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2378
-#, c-format
-msgid ""
-"\n"
-"The \"%s\" and \"%s\" commands also allow to modify the option settings for "
-"a particular printing job. Simply add the desired settings to the command "
-"line, e. g. \"%s <file>\".\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2388
-#, fuzzy, c-format
-msgid "Printing/Scanning/Photo Cards on \"%s\""
-msgstr "O tizenaouiñ ar rouedad"
-
-#: ../../printerdrake.pm_.c:2389
-#, fuzzy, c-format
-msgid "Printing/Scanning on \"%s\""
-msgstr "O tizenaouiñ ar rouedad"
-
-#: ../../printerdrake.pm_.c:2391
-#, fuzzy, c-format
-msgid "Printing/Photo Card Access on \"%s\""
-msgstr "O tizenaouiñ ar rouedad"
-
-#: ../../printerdrake.pm_.c:2392
-#, fuzzy, c-format
-msgid "Printing on the printer \"%s\""
-msgstr "O tizenaouiñ ar rouedad"
-
-#: ../../printerdrake.pm_.c:2395 ../../printerdrake.pm_.c:2398
-#: ../../printerdrake.pm_.c:2399 ../../printerdrake.pm_.c:2400
-#: ../../printerdrake.pm_.c:3448 ../../standalone/drakTermServ_.c:248
-#: ../../standalone/drakbackup_.c:1562 ../../standalone/drakbackup_.c:4210
-#: ../../standalone/drakbug_.c:130 ../../standalone/drakfont_.c:705
-#: ../../standalone/drakfont_.c:1014
-#, fuzzy
-msgid "Close"
-msgstr "Logodenn USB"
-
-#: ../../printerdrake.pm_.c:2398
-#, fuzzy
-msgid "Print option list"
-msgstr "Dibarzhoù ar voullerez"
-
-#: ../../printerdrake.pm_.c:2418
-#, c-format
-msgid ""
-"Your multi-function device was configured automatically to be able to scan. "
-"Now you can scan with \"scanimage\" (\"scanimage -d hp:%s\" to specify the "
-"scanner when you have more than one) from the command line or with the "
-"graphical interfaces \"xscanimage\" or \"xsane\". If you are using the GIMP, "
-"you can also scan by choosing the appropriate point in the \"File\"/\"Acquire"
-"\" menu. Call also \"man scanimage\" on the command line to get more "
-"information.\n"
-"\n"
-"Do not use \"scannerdrake\" for this device!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2439
-msgid ""
-"Your printer was configured automatically to give you access to the photo "
-"card drives from your PC. Now you can access your photo cards using the "
-"graphical program \"MtoolsFM\" (Menu: \"Applications\" -> \"File tools\" -> "
-"\"MTools File Manager\") or the command line utilities \"mtools\" (enter "
-"\"man mtools\" on the command line for more info). You find the card's file "
-"system under the drive letter \"p:\", or subsequent drive letters when you "
-"have more than one HP printer with photo card drives. In \"MtoolsFM\" you "
-"can switch between drive letters with the field at the upper-right corners "
-"of the file lists."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2461 ../../printerdrake.pm_.c:2923
-#: ../../printerdrake.pm_.c:3218
-msgid "Reading printer data..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2481 ../../printerdrake.pm_.c:2509
-#: ../../printerdrake.pm_.c:2544
-#, fuzzy
-msgid "Transfer printer configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../printerdrake.pm_.c:2482
-#, c-format
-msgid ""
-"You can copy the printer configuration which you have done for the spooler %"
-"s to %s, your current spooler. All the configuration data (printer name, "
-"description, location, connection type, and default option settings) is "
-"overtaken, but jobs will not be transferred.\n"
-"Not all queues can be transferred due to the following reasons:\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2485
-msgid ""
-"CUPS does not support printers on Novell servers or printers sending the "
-"data into a free-formed command.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2487
-msgid ""
-"PDQ only supports local printers, remote LPD printers, and Socket/TCP "
-"printers.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2489
-msgid "LPD and LPRng do not support IPP printers.\n"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2491
-msgid ""
-"In addition, queues not created with this program or \"foomatic-configure\" "
-"cannot be transferred."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2492
-msgid ""
-"\n"
-"Also printers configured with the PPD files provided by their manufacturers "
-"or with native CUPS drivers cannot be transferred."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2493
-msgid ""
-"\n"
-"Mark the printers which you want to transfer and click \n"
-"\"Transfer\"."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2496
-msgid "Do not transfer printers"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2497 ../../printerdrake.pm_.c:2514
-msgid "Transfer"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2510
-#, c-format
-msgid ""
-"A printer named \"%s\" already exists under %s. \n"
-"Click \"Transfer\" to overwrite it.\n"
-"You can also type a new name or skip this printer."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2518
-msgid "Name of printer should contain only letters, numbers and the underscore"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2523
-#, c-format
-msgid ""
-"The printer \"%s\" already exists,\n"
-"do you really want to overwrite its configuration?"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2531
-#, fuzzy
-msgid "New printer name"
-msgstr "Moullerez lec'hel"
-
-#: ../../printerdrake.pm_.c:2534
-#, c-format
-msgid "Transferring %s..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2545
-#, c-format
-msgid ""
-"You have transferred your former default printer (\"%s\"), Should it be also "
-"the default printer under the new printing system %s?"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2555
-msgid "Refreshing printer data..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2563 ../../printerdrake.pm_.c:2638
-#: ../../printerdrake.pm_.c:2650
-#, fuzzy
-msgid "Configuration of a remote printer"
-msgstr "Kefluniañ ar voullerez"
-
-#: ../../printerdrake.pm_.c:2564
-#, fuzzy
-msgid "Starting network..."
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../printerdrake.pm_.c:2599 ../../printerdrake.pm_.c:2603
-#: ../../printerdrake.pm_.c:2605
-#, fuzzy
-msgid "Configure the network now"
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../printerdrake.pm_.c:2600
-#, fuzzy
-msgid "Network functionality not configured"
-msgstr "Skramm ket kefluniet"
-
-#: ../../printerdrake.pm_.c:2601
-msgid ""
-"You are going to configure a remote printer. This needs working network "
-"access, but your network is not configured yet. If you go on without network "
-"configuration, you will not be able to use the printer which you are "
-"configuring now. How do you want to proceed?"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2604
-#, fuzzy
-msgid "Go on without configuring the network"
-msgstr "Kefluniañ ar rouedad"
-
-#: ../../printerdrake.pm_.c:2640
-msgid ""
-"The network configuration done during the installation cannot be started "
-"now. Please check whether the network gets accessable after booting your "
-"system and correct the configuration using the Mandrake Control Center, "
-"section \"Network & Internet\"/\"Connection\", and afterwards set up the "
-"printer, also using the Mandrake Control Center, section \"Hardware\"/"
-"\"Printer\""
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2641
-msgid ""
-"The network access was not running and could not be started. Please check "
-"your configuration and your hardware. Then try to configure your remote "
-"printer again."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2651
-#, fuzzy
-msgid "Restarting printing system..."
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:2689
-#, fuzzy
-msgid "high"
-msgstr "Uhel"
-
-#: ../../printerdrake.pm_.c:2689
-#, fuzzy
-msgid "paranoid"
-msgstr "Ankeniet"
-
-#: ../../printerdrake.pm_.c:2690
-#, c-format
-msgid "Installing a printing system in the %s security level"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2691
-#, c-format
-msgid ""
-"You are about to install the printing system %s on a system running in the %"
-"s security level.\n"
-"\n"
-"This printing system runs a daemon (background process) which waits for "
-"print jobs and handles them. This daemon is also accessable by remote "
-"machines through the network and so it is a possible point for attacks. "
-"Therefore only a few selected daemons are started by default in this "
-"security level.\n"
-"\n"
-"Do you really want to configure printing on this machine?"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2723
-msgid "Starting the printing system at boot time"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2724
-#, c-format
-msgid ""
-"The printing system (%s) will not be started automatically when the machine "
-"is booted.\n"
-"\n"
-"It is possible that the automatic starting was turned off by changing to a "
-"higher security level, because the printing system is a potential point for "
-"attacks.\n"
-"\n"
-"Do you want to have the automatic starting of the printing system turned on "
-"again?"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2748 ../../printerdrake.pm_.c:2789
-#: ../../printerdrake.pm_.c:2828 ../../printerdrake.pm_.c:2870
-#: ../../printerdrake.pm_.c:2991
-msgid "Checking installed software..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2794
-msgid "Removing LPRng..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2833
-msgid "Removing LPD..."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:2906
-#, fuzzy
-msgid "Select Printer Spooler"
-msgstr "Diuzit lugerezh ar voullerez"
-
-#: ../../printerdrake.pm_.c:2907
-#, fuzzy
-msgid "Which printing system (spooler) do you want to use?"
-msgstr "Pe seurt parzhadur a vennit ?"
-
-#: ../../printerdrake.pm_.c:2943
-#, fuzzy, c-format
-msgid "Configuring printer \"%s\"..."
-msgstr "Kefluniañ ar voullerez"
-
-#: ../../printerdrake.pm_.c:2957
-#, fuzzy
-msgid "Installing Foomatic..."
-msgstr "O staliañ ar pakad %s"
-
-#: ../../printerdrake.pm_.c:3027 ../../printerdrake.pm_.c:3068
-#: ../../printerdrake.pm_.c:3465 ../../printerdrake.pm_.c:3538
-msgid "Printer options"
-msgstr "Dibarzhoù ar voullerez"
-
-#: ../../printerdrake.pm_.c:3037
-#, fuzzy
-msgid "Preparing Printerdrake..."
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:3055 ../../printerdrake.pm_.c:3628
-#, fuzzy
-msgid "Configuring applications..."
-msgstr "Kefluniañ ar voullerez"
-
-#: ../../printerdrake.pm_.c:3075
-#, fuzzy
-msgid "Would you like to configure printing?"
-msgstr "Mennout a rit kefluniañ ur voullerez ?"
-
-#: ../../printerdrake.pm_.c:3087
-msgid "Printing system: "
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3147
-#, fuzzy
-msgid ""
-"The following printers are configured. Double-click on a printer to change "
-"its settings; to make it the default printer; to view information about it; "
-"or to make a printer on a remote CUPS server available for Star Office/"
-"OpenOffice.org/GIMP."
-msgstr ""
-"Setu da heul ar steudadoù moullañ.\n"
-"Gallout a rit ouzhpennañ lod pe gemmañ a re a zo."
-
-#: ../../printerdrake.pm_.c:3148
-#, fuzzy
-msgid ""
-"The following printers are configured. Double-click on a printer to change "
-"its settings; to make it the default printer; or to view information about "
-"it."
-msgstr ""
-"Setu da heul ar steudadoù moullañ.\n"
-"Gallout a rit ouzhpennañ lod pe gemmañ a re a zo."
-
-#: ../../printerdrake.pm_.c:3175
-msgid "Refresh printer list (to display all available remote CUPS printers)"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3193
-#, fuzzy
-msgid "Change the printing system"
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../printerdrake.pm_.c:3198 ../../standalone/drakconnect_.c:277
-#, fuzzy
-msgid "Normal Mode"
-msgstr "Boas"
-
-#: ../../printerdrake.pm_.c:3358 ../../printerdrake.pm_.c:3408
-#: ../../printerdrake.pm_.c:3621
-#, fuzzy
-msgid "Do you want to configure another printer?"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../printerdrake.pm_.c:3443
-#, fuzzy
-msgid "Modify printer configuration"
-msgstr "Kefluniañ ar modem"
-
-#: ../../printerdrake.pm_.c:3445
-#, fuzzy, c-format
-msgid ""
-"Printer %s\n"
-"What do you want to modify on this printer?"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../printerdrake.pm_.c:3449
-msgid "Do it!"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3454 ../../printerdrake.pm_.c:3509
-#, fuzzy
-msgid "Printer connection type"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../printerdrake.pm_.c:3455 ../../printerdrake.pm_.c:3513
-#, fuzzy
-msgid "Printer name, description, location"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../printerdrake.pm_.c:3457 ../../printerdrake.pm_.c:3531
-msgid "Printer manufacturer, model, driver"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3458 ../../printerdrake.pm_.c:3532
-msgid "Printer manufacturer, model"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3467 ../../printerdrake.pm_.c:3542
-msgid "Set this printer as the default"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3469 ../../printerdrake.pm_.c:3547
-msgid "Add this printer to Star Office/OpenOffice.org/GIMP"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3470 ../../printerdrake.pm_.c:3556
-msgid "Remove this printer from Star Office/OpenOffice.org/GIMP"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3471 ../../printerdrake.pm_.c:3565
-#, fuzzy
-msgid "Print test pages"
-msgstr "O voullañ pajenn(où) skrid..."
-
-#: ../../printerdrake.pm_.c:3472 ../../printerdrake.pm_.c:3567
-#, fuzzy
-msgid "Know how to use this printer"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../printerdrake.pm_.c:3474 ../../printerdrake.pm_.c:3569
-#, fuzzy
-msgid "Remove printer"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:3520
-#, fuzzy, c-format
-msgid "Removing old printer \"%s\"..."
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../printerdrake.pm_.c:3545
-#, fuzzy
-msgid "Default printer"
-msgstr "Moullerez lec'hel"
-
-#: ../../printerdrake.pm_.c:3546
-#, c-format
-msgid "The printer \"%s\" is set as the default printer now."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3550 ../../printerdrake.pm_.c:3553
-msgid "Adding printer to Star Office/OpenOffice.org/GIMP"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3551
-#, c-format
-msgid ""
-"The printer \"%s\" was successfully added to Star Office/OpenOffice.org/GIMP."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3554
-#, c-format
-msgid "Failed to add the printer \"%s\" to Star Office/OpenOffice.org/GIMP."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3559 ../../printerdrake.pm_.c:3562
-msgid "Removing printer from Star Office/OpenOffice.org/GIMP"
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3560
-#, c-format
-msgid ""
-"The printer \"%s\" was successfully removed from Star Office/OpenOffice.org/"
-"GIMP."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3563
-#, c-format
-msgid ""
-"Failed to remove the printer \"%s\" from Star Office/OpenOffice.org/GIMP."
-msgstr ""
-
-#: ../../printerdrake.pm_.c:3571
-#, fuzzy, c-format
-msgid "Do you really want to remove the printer \"%s\"?"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../printerdrake.pm_.c:3575
-#, fuzzy, c-format
-msgid "Removing printer \"%s\"..."
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../proxy.pm_.c:29 ../../proxy.pm_.c:37 ../../proxy.pm_.c:58
-#: ../../proxy.pm_.c:78
-#, fuzzy
-msgid "Proxy configuration"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../proxy.pm_.c:30
-msgid ""
-"Welcome to the proxy configuration utility.\n"
-"\n"
-"Here, you'll be able to set up your http and ftp proxies\n"
-"with or without login and password\n"
-msgstr ""
-
-#: ../../proxy.pm_.c:38
-msgid ""
-"Please fill in the http proxy informations\n"
-"Leave it blank if you don't want an http proxy"
-msgstr ""
-
-#: ../../proxy.pm_.c:39 ../../proxy.pm_.c:60
-msgid "URL"
-msgstr "URL"
-
-#: ../../proxy.pm_.c:40 ../../proxy.pm_.c:61
-#, fuzzy
-msgid "port"
-msgstr "Paour"
-
-#: ../../proxy.pm_.c:44
-#, fuzzy
-msgid "Url should begin with 'http:'"
-msgstr "http://... a zlefe bezañ ar proksi"
-
-#: ../../proxy.pm_.c:48 ../../proxy.pm_.c:69
-msgid "The port part should be numeric"
-msgstr ""
-
-#: ../../proxy.pm_.c:59
-msgid ""
-"Please fill in the ftp proxy informations\n"
-"Leave it blank if you don't want an ftp proxy"
-msgstr ""
-
-#: ../../proxy.pm_.c:79
-msgid ""
-"Please enter proxy login and password, if any.\n"
-"Leave it blank if you don't want login/passwd"
-msgstr ""
-
-#: ../../proxy.pm_.c:80
-#, fuzzy
-msgid "login"
-msgstr "Belgian"
-
-#: ../../proxy.pm_.c:82
-#, fuzzy
-msgid "password"
-msgstr "Tremenger"
-
-#: ../../proxy.pm_.c:84
-#, fuzzy
-msgid "re-type password"
-msgstr "Tremenger ebet"
-
-#: ../../proxy.pm_.c:88
-#, fuzzy
-msgid "The passwords don't match. Try again!"
-msgstr "An tremegerioù ne glot ket"
-
-#: ../../raid.pm_.c:35
-#, c-format
-msgid "Can't add a partition to _formatted_ RAID md%d"
-msgstr "N'hellan ket ouzhpennañ ur parzhadur da RAID md%d _furmadet_"
-
-#: ../../raid.pm_.c:108
-#, c-format
-msgid "Can't write file %s"
-msgstr "N'hellan ket skrivañ e %s"
-
-#: ../../raid.pm_.c:137
-msgid "mkraid failed"
-msgstr "mkraid sac'het"
-
-#: ../../raid.pm_.c:137
-msgid "mkraid failed (maybe raidtools are missing?)"
-msgstr "mkraid sac'het (raidtools a vank emichañs ?)"
-
-#: ../../raid.pm_.c:153
-#, c-format
-msgid "Not enough partitions for RAID level %d\n"
-msgstr "Ket a-walc'h a parzhadurioù evit RAID live %d\n"
-
-#: ../../security/main.pm_.c:35
-msgid ""
-"Standard: This is the standard security recommended for a computer that will "
-"be used to connect\n"
-" to the Internet as a client.\n"
-"\n"
-"High: There are already some restrictions, and more automatic checks "
-"are run every night.\n"
-"\n"
-"Higher: The security is now high enough to use the system as a server "
-"which can accept\n"
-" connections from many clients. If your machine is only a "
-"client on the Internet, you\n"
-"\t should choose a lower level.\n"
-"\n"
-"Paranoid: This is similar to the previous level, but the system is entirely "
-"closed and security\n"
-" features are at their maximum\n"
-"\n"
-"Security Administrator:\n"
-" If the 'Security Alerts' option is set, security alerts will "
-"be sent to this user (username or\n"
-"\t email)"
-msgstr ""
-
-#: ../../security/main.pm_.c:66
-#, fuzzy
-msgid "Security Level:"
-msgstr "Live surentez"
-
-#: ../../security/main.pm_.c:74
-#, fuzzy
-msgid "Security Alerts:"
-msgstr "Live surentez"
-
-#: ../../security/main.pm_.c:83
-#, fuzzy
-msgid "Security Administrator:"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../security/main.pm_.c:114 ../../security/main.pm_.c:150
-#, fuzzy, c-format
-msgid " (default: %s)"
-msgstr "? (%s dre ziouer)"
-
-#: ../../security/main.pm_.c:118 ../../security/main.pm_.c:154
-#: ../../security/main.pm_.c:179
-msgid ""
-"The following options can be set to customize your\n"
-"system security. If you need explanations, click on Help.\n"
-msgstr ""
-
-#: ../../security/main.pm_.c:226
-#, fuzzy
-msgid "Network Options"
-msgstr "Dibarzhoù ar mollad :"
-
-#: ../../security/main.pm_.c:235
-#, fuzzy
-msgid "System Options"
-msgstr "Dibarzhoù ar mollad :"
-
-#: ../../security/main.pm_.c:242
-msgid "Periodic Checks"
-msgstr ""
-
-#: ../../security/main.pm_.c:256
-#, fuzzy
-msgid "Please wait, setting security level..."
-msgstr "O termeniñ al live surentez"
-
-#: ../../security/main.pm_.c:262
-#, fuzzy
-msgid "Please wait, setting security options..."
-msgstr "Gortozit mar plij, o prientiñ ar staliadur"
-
-#: ../../services.pm_.c:14
-msgid "Launch the ALSA (Advanced Linux Sound Architecture) sound system"
-msgstr ""
-
-#: ../../services.pm_.c:15
-msgid "Anacron a periodic command scheduler."
-msgstr "Anacron, ur steuñvaer urzhiadoù mareadek."
-
-#: ../../services.pm_.c:16
-msgid ""
-"apmd is used for monitoring batery status and logging it via syslog.\n"
-"It can also be used for shutting down the machine when the battery is low."
-msgstr ""
-"servijout a ra apmd evit evezhiañ stad an daspugner hag he enrollañ dre "
-"syslog.\n"
-"Gallout a ra ivez servijout da lazhañ an ardivink pa vez izel an daspugner."
-
-#: ../../services.pm_.c:18
-msgid ""
-"Runs commands scheduled by the at command at the time specified when\n"
-"at was run, and runs batch commands when the load average is low enough."
-msgstr ""
-"Seveniñ an urzhiadoù steuñvaet gant an urzhiad at d'ar pred laket pa 'z eo\n"
-"bet sevenet at, ha seveniñ urzhiadoù dre lod pa 'z eo izel a-walc'h ar garg."
-
-#: ../../services.pm_.c:20
-msgid ""
-"cron is a standard UNIX program that runs user-specified programs\n"
-"at periodic scheduled times. vixie cron adds a number of features to the "
-"basic\n"
-"UNIX cron, including better security and more powerful configuration options."
-msgstr ""
-"Ur goulev standard UNIX eo cron evit seveniñ goulevioù diouzh c'hoant an\n"
-"arveriaded da goulzoù mareadek steuñvaet. vixie cron a ouzhpenn kalzig a "
-"arc'hweloù\n"
-"d'ar cron UNIX diazez, en o zouez surentez ha dibarzhoù kefluniañ gwelloc'h."
-
-#: ../../services.pm_.c:23
-msgid ""
-"GPM adds mouse support to text-based Linux applications such the\n"
-"Midnight Commander. It also allows mouse-based console cut-and-paste "
-"operations,\n"
-"and includes support for pop-up menus on the console."
-msgstr ""
-"GPM a zegas implij al logodenn d'an arloadoù Linux mod-skrid evel\n"
-"Midnight Commander. Reiñ a ra tu da seveniñ obererezhoù troc'hañ-ha-pegañ,\n"
-"ha skor evit meuziadoù kemperzhel war al letrin."
-
-#: ../../services.pm_.c:26
-msgid ""
-"HardDrake runs a hardware probe, and optionally configures\n"
-"new/changed hardware."
-msgstr ""
-
-#: ../../services.pm_.c:28
-msgid ""
-"Apache is a World Wide Web server. It is used to serve HTML files and CGI."
-msgstr ""
-"Ur servijer evit ar Gwiad Bedel eo Apache. Implijet e vez evit servijañ\n"
-"restroù HTML ha CGI."
-
-#: ../../services.pm_.c:29
-msgid ""
-"The internet superserver daemon (commonly called inetd) starts a\n"
-"variety of other internet services as needed. It is responsible for "
-"starting\n"
-"many services, including telnet, ftp, rsh, and rlogin. Disabling inetd "
-"disables\n"
-"all of the services it is responsible for."
-msgstr ""
-"An diaoul gourservijer kenrouedad (anvet inetd ordinal) a loc'h ur\n"
-"bochad a servijoù kenrouedad all diouzh an ezhomm. E karg loc'hañ meur a "
-"servijoù\n"
-"eo, en o zouez telnet, ftp, rsh, and rlogin. Dizoberiañ inetd a zizoberia\n"
-"an holl servijoù m'eo eñ atebek warno."
-
-#: ../../services.pm_.c:33
-msgid ""
-"Launch packet filtering for Linux kernel 2.2 series, to set\n"
-"up a firewall to protect your machine from network attacks."
-msgstr ""
-
-#: ../../services.pm_.c:35
-msgid ""
-"This package loads the selected keyboard map as set in\n"
-"/etc/sysconfig/keyboard. This can be selected using the kbdconfig utility.\n"
-"You should leave this enabled for most machines."
-msgstr ""
-"Ar pakad-mañ a garg ar stokellaoueg diuzet evel termenet e\n"
-"/etc/sysconfig/keyboard. Dre ar maveg kbdconfig e c'hell bezañ diuzet\n"
-"kement-se. Gwell deoc'h leuskel se gweredekaet war darn vuiañ an ardivinkoù."
-
-#: ../../services.pm_.c:38
-msgid ""
-"Automatic regeneration of kernel header in /boot for\n"
-"/usr/include/linux/{autoconf,version}.h"
-msgstr ""
-
-#: ../../services.pm_.c:40
-msgid "Automatic detection and configuration of hardware at boot."
-msgstr ""
-
-#: ../../services.pm_.c:41
-msgid ""
-"Linuxconf will sometimes arrange to perform various tasks\n"
-"at boot-time to maintain the system configuration."
-msgstr ""
-
-#: ../../services.pm_.c:43
-msgid ""
-"lpd is the print daemon required for lpr to work properly. It is\n"
-"basically a server that arbitrates print jobs to printer(s)."
-msgstr ""
-"An diaoul moullañ ret evit ma dafez en-ro reizh lpr eo lpd. Dre vras\n"
-"ez eo ur servijer a vera dleadoù moullañ evir ar voullerez(ed)."
-
-#: ../../services.pm_.c:45
-msgid ""
-"Linux Virtual Server, used to build a high-performance and highly\n"
-"available server."
-msgstr ""
-
-#: ../../services.pm_.c:47
-#, fuzzy
-msgid ""
-"named (BIND) is a Domain Name Server (DNS) that is used to resolve host "
-"names to IP addresses."
-msgstr ""
-"named (BIND) a zo ur Servijer Anvioù Domani (DNS) a zo implijet evit\n"
-"amdreiñ anvioù ostiz e chomlec'hioù IP."
-
-#: ../../services.pm_.c:48
-msgid ""
-"Mounts and unmounts all Network File System (NFS), SMB (Lan\n"
-"Manager/Windows), and NCP (NetWare) mount points."
-msgstr ""
-"Evit marc'hañ ha divarc'hañ poentoù marc'hañ an holl Reizhiadoù Restroù\n"
-"Rouedad (NFS), SMB (Lan Manager/Windows) ha NCP (NetWare)."
-
-#: ../../services.pm_.c:50
-msgid ""
-"Activates/Deactivates all network interfaces configured to start\n"
-"at boot time."
-msgstr ""
-"Oberia/Dizoberia an holl etrefasoù rouedad kefluniet da lañsañ\n"
-"da vare al loc'hañ."
-
-#: ../../services.pm_.c:52
-msgid ""
-"NFS is a popular protocol for file sharing across TCP/IP networks.\n"
-"This service provides NFS server functionality, which is configured via the\n"
-"/etc/exports file."
-msgstr ""
-"NFS a zo ur c'homenad brudet evit rannañ restroù dre rouedadoù TCP/IP.\n"
-"Ar servij-mañ a bourvez arc'hweloù ur servijer NFS, a vez kefluniaet dre ar\n"
-"restr /etc/exports."
-
-#: ../../services.pm_.c:55
-msgid ""
-"NFS is a popular protocol for file sharing across TCP/IP\n"
-"networks. This service provides NFS file locking functionality."
-msgstr ""
-"NFS a zo ur c'homenad brudet evit rannañ restroù dre rouedadoù\n"
-"TCP/IP. Ar servij-mañ a bourvez un arc'hwel morailhañ restroù NFS."
-
-#: ../../services.pm_.c:57
-msgid ""
-"Automatically switch on numlock key locker under console\n"
-"and XFree at boot."
-msgstr ""
-
-#: ../../services.pm_.c:59
-msgid "Support the OKI 4w and compatible winprinters."
-msgstr ""
-
-#: ../../services.pm_.c:60
-msgid ""
-"PCMCIA support is usually to support things like ethernet and\n"
-"modems in laptops. It won't get started unless configured so it is safe to "
-"have\n"
-"it installed on machines that don't need it."
-msgstr ""
-"Skorañ PCMCIA a zegas an tu da implijonut traoù evel ethernet ha modemoù\n"
-"e urzhiataeroù hezoug. Ne vo ket kroget hep bezañ bet kefluniet, rak-se eo "
-"diarvar\n"
-"e staliañ war ardivinkoù n'o deus ket ezhomm anezhañ."
-
-#: ../../services.pm_.c:63
-msgid ""
-"The portmapper manages RPC connections, which are used by\n"
-"protocols such as NFS and NIS. The portmap server must be running on "
-"machines\n"
-"which act as servers for protocols which make use of the RPC mechanism."
-msgstr ""
-"Ar c'hartenner porzhioù a vera kevreadennoù RPC, a zo implijet gant\n"
-"komenadoù evel NFS ha NIS. Ar servijer kartenn-porzhioù a rankfe mont en-"
-"dro\n"
-"war ardivinkoù anezho servijerien komenadoù a implij ar reizhiad RPC."
-
-#: ../../services.pm_.c:66
-#, fuzzy
-msgid ""
-"Postfix is a Mail Transport Agent, which is the program that moves mail from "
-"one machine to another."
-msgstr ""
-"Ur Gwazour Treuzdougen Postel eo Postfix, a zo ar goulev a\n"
-"zilech posteloù etre un ardivink hag un all."
-
-#: ../../services.pm_.c:67
-msgid ""
-"Saves and restores system entropy pool for higher quality random\n"
-"number generation."
-msgstr ""
-"Enroll hag assav poul dizurzh ar reizhiad evit genel niveroù\n"
-"dargouezhek gant gwelloc'h perzhded."
-
-#: ../../services.pm_.c:69
-msgid ""
-"Assign raw devices to block devices (such as hard drive\n"
-"partitions), for the use of applications such as Oracle"
-msgstr ""
-
-#: ../../services.pm_.c:71
-msgid ""
-"The routed daemon allows for automatic IP router table updated via\n"
-"the RIP protocol. While RIP is widely used on small networks, more complex\n"
-"routing protocols are needed for complex networks."
-msgstr ""
-"An diaoul routed a ro an tu da vremanaat ent emgefreek an taolenn henchañ\n"
-"IP dre ar c'homenad RIP. Tra ma vez implijet aliesig RIP war rouedadoù "
-"bihan,\n"
-"ezhomm a zo komenadoù henchañ kemplezhoc'h evit rouedadoù rouestlet."
-
-#: ../../services.pm_.c:74
-msgid ""
-"The rstat protocol allows users on a network to retrieve\n"
-"performance metrics for any machine on that network."
-msgstr ""
-"Ar c'homenad rstat a ro tu da implijerien ur rouedad da zastum\n"
-"muzulioù barregezh diwar ne vern pe ardivink er rouedad-se."
-
-#: ../../services.pm_.c:76
-msgid ""
-"The rusers protocol allows users on a network to identify who is\n"
-"logged in on other responding machines."
-msgstr ""
-"Ar c'homenad rusers a ro tu da implijerien ur rouedad da anavezout piv\n"
-"a zo kevreet ouzh ardivinkoù all a respont."
-
-#: ../../services.pm_.c:78
-msgid ""
-"The rwho protocol lets remote users get a list of all of the users\n"
-"logged into a machine running the rwho daemon (similiar to finger)."
-msgstr ""
-"Ar c'homenad rwho a bourchas da implijerien a-bell roll an holl arveriaded a "
-"zo\n"
-"kevreet ouzh un ardivink ma da en-dro warnañ an diaoul rwhod (heñvel ouzh "
-"finger)."
-
-#: ../../services.pm_.c:80
-msgid "Launch the sound system on your machine"
-msgstr ""
-
-#: ../../services.pm_.c:81
-msgid ""
-"Syslog is the facility by which many daemons use to log messages\n"
-"to various system log files. It is a good idea to always run syslog."
-msgstr ""
-"Syslog a zo ur gwazerezh ma enroll drezañ an diaouled niverus o "
-"c'hemennadoù\n"
-"e kerzhlevrioù liesseurt ar reizhiad. Ur mennozh mat eo seveniñ ingal syslog."
-
-#: ../../services.pm_.c:83
-msgid "Load the drivers for your usb devices."
-msgstr ""
-
-#: ../../services.pm_.c:84
-#, fuzzy
-msgid "Starts the X Font Server (this is mandatory for XFree to run)."
-msgstr ""
-"Enaou ha dizenaou ar servijer Fontoù X da vare al loc'hañ hag al lazhañ."
-
-#: ../../services.pm_.c:110 ../../services.pm_.c:152
-msgid "Choose which services should be automatically started at boot time"
-msgstr "Dibabit pe servijoù a zlefe bezañ lañset ent emgefreek pa loc'her"
-
-#: ../../services.pm_.c:122
-#, fuzzy
-msgid "Printing"
-msgstr "Moullerez"
-
-#: ../../services.pm_.c:123
-#, fuzzy
-msgid "Internet"
-msgstr "dedennus"
-
-#: ../../services.pm_.c:126
-msgid "File sharing"
-msgstr ""
-
-#: ../../services.pm_.c:128 ../../standalone/drakbackup_.c:1746
-#, fuzzy
-msgid "System"
-msgstr "Reizhiad/Diazez"
-
-#: ../../services.pm_.c:133
-#, fuzzy
-msgid "Remote Administration"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../services.pm_.c:141
-#, fuzzy
-msgid "Database Server"
-msgstr "Stlennvonioù"
-
-#: ../../services.pm_.c:170
-#, c-format
-msgid "Services: %d activated for %d registered"
-msgstr ""
-
-#: ../../services.pm_.c:186
-#, fuzzy
-msgid "Services"
-msgstr "trobarzhell"
-
-#: ../../services.pm_.c:198
-#, fuzzy
-msgid "running"
-msgstr "Ho evezh"
-
-#: ../../services.pm_.c:198
-#, fuzzy
-msgid "stopped"
-msgstr "Ouzhpennañ"
-
-#: ../../services.pm_.c:212
-msgid "Services and deamons"
-msgstr ""
-
-#: ../../services.pm_.c:217
-msgid ""
-"No additional information\n"
-"about this service, sorry."
-msgstr ""
-
-#: ../../services.pm_.c:224
-#, fuzzy
-msgid "On boot"
-msgstr "Gwrizienn"
-
-#: ../../services.pm_.c:236
-#, fuzzy
-msgid "Start"
-msgstr "Meuziad Lañsañ"
-
-#: ../../services.pm_.c:236
-#, fuzzy
-msgid "Stop"
-msgstr "Rann"
-
-#: ../../share/advertising/01-thanks.pl_.c:9
-msgid "Thank you for choosing Mandrake Linux 9.0"
-msgstr ""
-
-#: ../../share/advertising/01-thanks.pl_.c:10
-msgid "Welcome to the Open Source world"
-msgstr ""
-
-#: ../../share/advertising/01-thanks.pl_.c:11
-msgid ""
-"The success of MandrakeSoft is based upon the principle of Free Software. "
-"Your new operating system is the result of collaborative work on the part of "
-"the worldwide Linux Community"
-msgstr ""
-
-#: ../../share/advertising/02-community.pl_.c:9
-#, fuzzy
-msgid "Get involved in the Free Software world"
-msgstr "Amprouiñ ar c'hefluniadur"
-
-#: ../../share/advertising/02-community.pl_.c:10
-msgid "Want to know more about the Open Source community?"
-msgstr ""
-
-#: ../../share/advertising/02-community.pl_.c:11
-msgid ""
-"To share your own knowledge and help build Linux tools, join the discussion "
-"forums you'll find on our \"Community\" webpages"
-msgstr ""
-
-#: ../../share/advertising/03-internet.pl_.c:9
-#, fuzzy
-msgid "Get the most from the Internet"
-msgstr "Anv ar gevreadenn"
-
-#: ../../share/advertising/03-internet.pl_.c:10
-msgid ""
-"Mandrake Linux 9.0 has selected the best software for you. Surf the Web and "
-"view animations with Mozilla and Konqueror, or read your mail and handle "
-"your personal information with Evolution and Kmail"
-msgstr ""
-
-#: ../../share/advertising/04-multimedia.pl_.c:9
-msgid "Discover the most up-to-date graphical and multimedia tools!"
-msgstr ""
-
-#: ../../share/advertising/04-multimedia.pl_.c:10
-msgid "Push multimedia to its limits!"
-msgstr ""
-
-#: ../../share/advertising/04-multimedia.pl_.c:11
-msgid ""
-"Mandrake Linux 9.0 enables you to use the very latest software to play audio "
-"files, edit and handle your images or photos, and play videos"
-msgstr ""
-
-#: ../../share/advertising/05-games.pl_.c:9
-msgid "Games"
-msgstr "C'hoarioù"
-
-#: ../../share/advertising/05-games.pl_.c:10
-msgid ""
-"Mandrake Linux 9.0 provides the best Open Source games - arcade, action, "
-"strategy, ..."
-msgstr ""
-
-#: ../../share/advertising/06-mcc.pl_.c:9 ../../standalone/drakbug_.c:69
-#, fuzzy
-msgid "Mandrake Control Center"
-msgstr "Anv ar gevreadenn"
-
-#: ../../share/advertising/06-mcc.pl_.c:10
-msgid ""
-"Mandrake Linux 9.0 provides a powerful tool to fully customize and configure "
-"your machine"
-msgstr ""
-
-#: ../../share/advertising/07-desktop.pl_.c:9
-#, fuzzy
-msgid "User interfaces"
-msgstr "Etrefas arveriad/X"
-
-#: ../../share/advertising/07-desktop.pl_.c:10
-msgid ""
-"Mandrake Linux 9.0 provides you with 11 user interfaces that can be fully "
-"modified: KDE 3, Gnome 2, WindowMaker, ..."
-msgstr ""
-
-#: ../../share/advertising/08-development.pl_.c:9
-#, fuzzy
-msgid "Development simplified"
-msgstr "Diorren"
-
-#: ../../share/advertising/08-development.pl_.c:10
-msgid "Mandrake Linux 9.0 is the ultimate development platform"
-msgstr ""
-
-#: ../../share/advertising/08-development.pl_.c:11
-msgid ""
-"Use the full power of the GNU gcc 3 compiler as well as the best Open Source "
-"development environments"
-msgstr ""
-
-#: ../../share/advertising/09-server.pl_.c:9
-msgid "Turn your machine into a reliable server"
-msgstr ""
-
-#: ../../share/advertising/09-server.pl_.c:10
-msgid ""
-"Transform your machine into a powerful Linux server with a few clicks of "
-"your mouse: Web server, mail, firewall, router, file and print server, ..."
-msgstr ""
-
-#: ../../share/advertising/10-mnf.pl_.c:9
-msgid "Optimize your security"
-msgstr ""
-
-#: ../../share/advertising/10-mnf.pl_.c:10
-msgid ""
-"The MandrakeSecurity range includes the Multi Network Firewall product (M.N."
-"F.)"
-msgstr ""
-
-#: ../../share/advertising/10-mnf.pl_.c:11
-msgid ""
-"This firewall product includes network features that allow you to fulfill "
-"all your security needs"
-msgstr ""
-
-#: ../../share/advertising/10-mnf.pl_.c:12
-msgid "This product is available on MandrakeStore website"
-msgstr ""
-
-#: ../../share/advertising/11-mdkstore.pl_.c:9
-msgid "The official MandrakeSoft store"
-msgstr ""
-
-#: ../../share/advertising/11-mdkstore.pl_.c:10
-msgid ""
-"Our full range of Linux solutions, as well as special offers on products and "
-"other \"goodies,\" are available online on our e-store:"
-msgstr ""
-
-#: ../../share/advertising/12-mdkstore.pl_.c:9
-msgid "Strategic partners"
-msgstr ""
-
-#: ../../share/advertising/12-mdkstore.pl_.c:10
-msgid ""
-"MandrakeSoft works alongside a selection of companies offering professional "
-"solutions compatible with Mandrake Linux. A list of these partners is "
-"available on the MandrakeStore"
-msgstr ""
-
-#: ../../share/advertising/13-mdkcampus.pl_.c:9
-msgid "Discover MandrakeSoft's training catalogue Linux-Campus"
-msgstr ""
-
-#: ../../share/advertising/13-mdkcampus.pl_.c:10
-msgid ""
-"The training program has been created to respond to the needs of both end "
-"users and experts (Network and System administrators)"
-msgstr ""
-
-#: ../../share/advertising/13-mdkcampus.pl_.c:11
-msgid "Certify yourself on Linux"
-msgstr ""
-
-#: ../../share/advertising/13-mdkcampus.pl_.c:12
-msgid ""
-"Whether you choose to teach yourself online or via our network of training "
-"partners, the Linux-Campus catalogue prepares you for the acknowledged LPI "
-"certification program (worldwide professional technical certification)"
-msgstr ""
-
-#: ../../share/advertising/14-mdkexpert.pl_.c:9
-#, fuzzy
-msgid "Become a MandrakeExpert"
-msgstr "MandrakeExpert"
-
-#: ../../share/advertising/14-mdkexpert.pl_.c:10
-msgid ""
-"Find the solutions of your problems via MandrakeSoft's online support "
-"platform"
-msgstr ""
-
-#: ../../share/advertising/14-mdkexpert.pl_.c:11
-msgid ""
-"Join the MandrakeSoft support teams and the Linux Community online to share "
-"your knowledge and help others by becoming a recognized Expert on the online "
-"technical support website:"
-msgstr ""
-
-#: ../../share/advertising/15-mdkexpert-corporate.pl_.c:9
-#, fuzzy
-msgid "MandrakeExpert Corporate"
-msgstr "MandrakeExpert"
-
-#: ../../share/advertising/15-mdkexpert-corporate.pl_.c:10
-msgid "An online platform to respond to company's specific support needs"
-msgstr ""
-
-#: ../../share/advertising/15-mdkexpert-corporate.pl_.c:11
-msgid ""
-"All incidents will be followed up by a single qualified MandrakeSoft "
-"technical expert."
-msgstr ""
-
-#: ../../share/advertising/17-mdkclub.pl_.c:9
-msgid "Discover MandrakeClub and Mandrake Corporate Club"
-msgstr ""
-
-#: ../../share/advertising/17-mdkclub.pl_.c:10
-msgid ""
-"MandrakeClub and Mandrake Corporate Club were created for business and "
-"private users of Mandrake Linux who would like to directly support their "
-"favorite Linux distribution while also receiving special privileges. If you "
-"enjoy our products, if your company benefits from our products to gain a "
-"competititve edge, if you want to support Mandrake Linux development, join "
-"MandrakeClub!"
-msgstr ""
-
-#: ../../standalone.pm_.c:42
-msgid "Installing packages..."
-msgstr "O staliañ pakadoù..."
-
-#: ../../standalone/XFdrake_.c:147
-msgid "Please log out and then use Ctrl-Alt-BackSpace"
-msgstr "Dizereit mar plij ha neuze implijit Ctrl-Alt-WarGil"
-
-#: ../../standalone/XFdrake_.c:151
-#, c-format
-msgid "Please relog into %s to activate the changes"
-msgstr "Adereit ouzh %s evit bevaat ar c'hemmoù mar plij"
-
-#: ../../standalone/drakTermServ_.c:188
-#, fuzzy
-msgid "Mandrake Terminal Server Configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../standalone/drakTermServ_.c:203
-#, fuzzy
-msgid "Enable Server"
-msgstr "Stlennvonioù"
-
-#: ../../standalone/drakTermServ_.c:210
-#, fuzzy
-msgid "Disable Server"
-msgstr "Stlennvonioù"
-
-#: ../../standalone/drakTermServ_.c:218
-#, fuzzy
-msgid "Start Server"
-msgstr "Servijer NIS"
-
-#: ../../standalone/drakTermServ_.c:225
-#, fuzzy
-msgid "Stop Server"
-msgstr "Servijer NIS"
-
-#: ../../standalone/drakTermServ_.c:233
-#, fuzzy
-msgid "Etherboot Floppy/ISO"
-msgstr "Krouiñ ur bladennig loc'hañ"
-
-#: ../../standalone/drakTermServ_.c:235
-msgid "Net Boot Images"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:239
-#, fuzzy
-msgid "Add/Del Users"
-msgstr "Ouzhpennañ un arveriad"
-
-#: ../../standalone/drakTermServ_.c:241
-msgid "Add/Del Clients"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:436
-msgid "Boot Floppy"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:438
-msgid "Boot ISO"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:507
-msgid "Build Whole Kernel -->"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:509 ../../standalone/drakTermServ_.c:539
-msgid "This will take a few minutes."
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:521
-msgid "No kernel selected!"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:524
-msgid "Build Single NIC -->"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:535
-#, fuzzy
-msgid "No nic selected!"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakTermServ_.c:538
-msgid "Build All Kernels -->"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:552
-#, fuzzy
-msgid "<-- Delete"
-msgstr "Dilemel"
-
-#: ../../standalone/drakTermServ_.c:559
-#, fuzzy
-msgid "Delete All NBIs"
-msgstr "Diuzit ar restr"
-
-#: ../../standalone/drakTermServ_.c:621
-#, fuzzy
-msgid "Add User -->"
-msgstr "Ouzhpennañ un arveriad"
-
-#: ../../standalone/drakTermServ_.c:629
-msgid "<-- Del User"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:694
-msgid "No net boot images created!"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:710
-msgid "Add Client -->"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:742
-msgid "<-- Del Client"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:748
-#, fuzzy
-msgid "dhcpd Config..."
-msgstr "Kefluniañ IDE"
-
-#: ../../standalone/drakTermServ_.c:873
-#, fuzzy
-msgid "dhcpd Server Configuration"
-msgstr "Kefluniadur"
-
-#: ../../standalone/drakTermServ_.c:874
-msgid ""
-"Most of these values were extracted\n"
-"from your running system. You can modify as needed."
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:875
-#, fuzzy
-msgid "Write Config"
-msgstr "Kefluniañ X"
-
-#: ../../standalone/drakTermServ_.c:965
-#, fuzzy
-msgid "Please insert floppy disk:"
-msgstr "Lakait ur bladennig el lenner %s"
-
-#: ../../standalone/drakTermServ_.c:969
-msgid "Couldn't access the floppy!"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:971
-msgid "Floppy can be removed now"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:974
-#, fuzzy
-msgid "No floppy drive available!"
-msgstr "Lenner pladennig hegerz ebet"
-
-#: ../../standalone/drakTermServ_.c:983
-#, c-format
-msgid "Etherboot ISO image is %s"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:985
-msgid "Something went wrong! - Is mkisofs installed?"
-msgstr ""
-
-#: ../../standalone/drakTermServ_.c:1004
-msgid "Need to create /etc/dhcpd.conf first!"
-msgstr ""
-
-#: ../../standalone/drakautoinst_.c:43
-msgid "Error!"
-msgstr "Fazi!"
-
-#: ../../standalone/drakautoinst_.c:44
-#, c-format
-msgid "I can't find needed image file `%s'."
-msgstr ""
-
-#: ../../standalone/drakautoinst_.c:46
-#, fuzzy
-msgid "Auto Install Configurator"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../standalone/drakautoinst_.c:47
-msgid ""
-"You are about to configure an Auto Install floppy. This feature is somewhat "
-"dangerous and must be used circumspectly.\n"
-"\n"
-"With that feature, you will be able to replay the installation you've "
-"performed on this computer, being interactively prompted for some steps, in "
-"order to change their values.\n"
-"\n"
-"For maximum safety, the partitioning and formatting will never be performed "
-"automatically, whatever you chose during the install of this computer.\n"
-"\n"
-"Do you want to continue?"
-msgstr ""
-
-#: ../../standalone/drakautoinst_.c:69
-#, fuzzy
-msgid "Automatic Steps Configuration"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../standalone/drakautoinst_.c:70
-msgid ""
-"Please choose for each step whether it will replay like your install, or it "
-"will be manual"
-msgstr ""
-
-#: ../../standalone/drakautoinst_.c:81 ../../standalone/drakautoinst_.c:82
-#, fuzzy
-msgid "Creating auto install floppy"
-msgstr "O krouiñ ur bladennig staliañ emgefreek"
-
-#: ../../standalone/drakautoinst_.c:144
-msgid ""
-"\n"
-"Welcome.\n"
-"\n"
-"The parameters of the auto-install are available in the sections on the left"
-msgstr ""
-
-#: ../../standalone/drakautoinst_.c:239 ../../standalone/drakgw_.c:480
-#: ../../standalone/scannerdrake_.c:119
-msgid "Congratulations!"
-msgstr "Gourc'hemennoù!"
-
-#: ../../standalone/drakautoinst_.c:240
-msgid ""
-"The floppy has been successfully generated.\n"
-"You may now replay your installation."
-msgstr ""
-
-#: ../../standalone/drakautoinst_.c:278
-#, fuzzy
-msgid "Auto Install"
-msgstr "Staliañ"
-
-#: ../../standalone/drakautoinst_.c:348
-#, fuzzy
-msgid "Add an item"
-msgstr "Ouzhpennañ un arveriad"
-
-#: ../../standalone/drakautoinst_.c:355
-#, fuzzy
-msgid "Remove the last item"
-msgstr "O furmadiñ ar restr saveteiñ %s"
-
-#: ../../standalone/drakbackup_.c:617
-msgid "Cron not available yet as non-root"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:723
-msgid "WARNING"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:724
-#, fuzzy
-msgid "FATAL"
-msgstr "FAT"
-
-#: ../../standalone/drakbackup_.c:725
-msgid "INFO"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:737
-msgid ""
-"\n"
-" DrakBackup Report \n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:738
-msgid ""
-"\n"
-" DrakBackup Daemon Report\n"
-"\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:742
-msgid ""
-"\n"
-" DrakBackup Report Details\n"
-"\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:763 ../../standalone/drakbackup_.c:836
-#: ../../standalone/drakbackup_.c:891
-#, fuzzy
-msgid "Total progess"
-msgstr "Amprouiñ ar porzhioù"
-
-#: ../../standalone/drakbackup_.c:818
-#, c-format
-msgid ""
-"%s exists, delete?\n"
-"\n"
-"Warning: If you've already done this process you'll probably\n"
-" need to purge the entry from authorized_keys on the server."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:827
-msgid "This may take a moment to generate the keys."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:834
-#, c-format
-msgid "ERROR: Cannot spawn %s."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:851
-#, c-format
-msgid "No password prompt on %s at port %s"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:852
-#, fuzzy, c-format
-msgid "Bad password on %s"
-msgstr "Tremenger ebet"
-
-#: ../../standalone/drakbackup_.c:853
-#, c-format
-msgid "Permission denied transferring %s to %s"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:854
-#, fuzzy, c-format
-msgid "Can't find %s on %s"
-msgstr "Fazi en ur zigeriñ %s evit skrivañ : %s"
-
-#: ../../standalone/drakbackup_.c:857
-#, c-format
-msgid "%s not responding"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:861
-#, c-format
-msgid ""
-"Transfer successful\n"
-"You may want to verify you can login to the server with:\n"
-"\n"
-"ssh -i %s %s\\@%s\n"
-"\n"
-"without being prompted for a password."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:905
-msgid "WebDAV remote site already in sync!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:909
-msgid "WebDAV transfer failed!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:930
-msgid "No CDR/DVDR in drive!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:934
-msgid "Does not appear to be recordable media!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:938
-msgid "Not erasable media!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:977
-msgid "This may take a moment to erase the media."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1062
-msgid "Permission problem accessing CD."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1089
-#, c-format
-msgid "No tape in %s!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1201 ../../standalone/drakbackup_.c:1250
-msgid "Backup system files..."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1251 ../../standalone/drakbackup_.c:1318
-#, fuzzy
-msgid "Hard Disk Backup files..."
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:1263
-#, fuzzy
-msgid "Backup User files..."
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:1264
-msgid "Hard Disk Backup Progress..."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1317
-#, fuzzy
-msgid "Backup Other files..."
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:1323
-#, fuzzy
-msgid "No changes to backup!"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:1339 ../../standalone/drakbackup_.c:1362
-#, c-format
-msgid ""
-"\n"
-"Drakbackup activities via %s:\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1346
-#, c-format
-msgid ""
-"file list sent by FTP: %s\n"
-" "
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1349
-msgid ""
-"\n"
-" FTP connection problem: It was not possible to send your backup files by "
-"FTP.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1367
-msgid ""
-"\n"
-"Drakbackup activities via CD:\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1372
-msgid ""
-"\n"
-"Drakbackup activities via tape:\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1381
-#, fuzzy
-msgid " Error during mail sending. \n"
-msgstr "Fazi en ur lenn ar restr %s"
-
-#: ../../standalone/drakbackup_.c:1406
-msgid "Can't create catalog!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1519 ../../standalone/drakbackup_.c:1530
-#: ../../standalone/drakfont_.c:1004
-#, fuzzy
-msgid "File Selection"
-msgstr "Diuzadenn strollad pakadoù"
-
-#: ../../standalone/drakbackup_.c:1558
-msgid "Select the files or directories and click on 'Add'"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1602
-msgid ""
-"\n"
-"Please check all options that you need.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1603
-msgid ""
-"These options can backup and restore all files in your /etc directory.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1604
-#, fuzzy
-msgid "Backup your System files. (/etc directory)"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:1605
-msgid "Use incremental backup (do not replace old backups)"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1606
-msgid "Do not include critical files (passwd, group, fstab)"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1607
-msgid ""
-"With this option you will be able to restore any version\n"
-" of your /etc directory."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1624
-#, fuzzy
-msgid "Please check all users that you want to include in your backup."
-msgstr "Dibabit ar pakadoù a vennit staliañ, mar plij."
-
-#: ../../standalone/drakbackup_.c:1651
-msgid "Do not include the browser cache"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1652 ../../standalone/drakbackup_.c:1676
-msgid "Use Incremental Backups (do not replace old backups)"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1674 ../../standalone/drakfont_.c:1058
-#, fuzzy
-msgid "Remove Selected"
-msgstr "Lemel ar steudad"
-
-#: ../../standalone/drakbackup_.c:1712
-msgid "Windows (FAT32)"
-msgstr "Windows (FAT32)"
-
-#: ../../standalone/drakbackup_.c:1751
-#, fuzzy
-msgid "Users"
-msgstr "Anv arveriad"
-
-#: ../../standalone/drakbackup_.c:1777
-#, fuzzy
-msgid "Use network connection to backup"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:1779
-msgid "Net Method:"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1783
-msgid "Use Expect for SSH"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1784
-msgid ""
-"Create/Transfer\n"
-"backup keys for SSH"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1785
-msgid ""
-" Transfer \n"
-"Now"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1786
-msgid ""
-"Other (not drakbackup)\n"
-"keys in place already"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1790
-#, fuzzy
-msgid "Please enter the host name or IP."
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../standalone/drakbackup_.c:1795
-msgid ""
-"Please enter the directory (or module) to\n"
-" put the backup on this host."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1800
-#, fuzzy
-msgid "Please enter your login"
-msgstr "Klaskit adarre mar plij"
-
-#: ../../standalone/drakbackup_.c:1805
-#, fuzzy
-msgid "Please enter your password"
-msgstr "Klaskit adarre mar plij"
-
-#: ../../standalone/drakbackup_.c:1811
-#, fuzzy
-msgid "Remember this password"
-msgstr "Tremenger ebet"
-
-#: ../../standalone/drakbackup_.c:1822
-msgid "Need hostname, username and password!"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1917
-msgid "Use CD/DVDROM to backup"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1920
-msgid ""
-"Please choose your CD/DVD device\n"
-"(Press Enter to propogate settings to other fields.\n"
-"This field isn't necessary, only a tool to fill in the form.)"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:1925
-#, fuzzy
-msgid "Please choose your CD/DVD media size (Mb)"
-msgstr "Dibabit reizhadur ho stokellaoueg, mar plij."
-
-#
-#: ../../standalone/drakbackup_.c:1931
-#, fuzzy
-msgid "Please check for multisession CD"
-msgstr "Klikit war ur parzhadur mar plij"
-
-#
-#: ../../standalone/drakbackup_.c:1937
-#, fuzzy
-msgid "Please check if you are using CDRW media"
-msgstr "Klikit war ur parzhadur mar plij"
-
-#
-#: ../../standalone/drakbackup_.c:1943
-#, fuzzy
-msgid "Please check if you want to erase your RW media (1st Session)"
-msgstr "Klikit war ur parzhadur mar plij"
-
-#: ../../standalone/drakbackup_.c:1944
-msgid " Erase Now "
-msgstr ""
-
-#
-#: ../../standalone/drakbackup_.c:1950
-#, fuzzy
-msgid "Please check if you are using a DVDR device"
-msgstr "Klikit war ur parzhadur mar plij"
-
-#
-#: ../../standalone/drakbackup_.c:1956
-#, fuzzy
-msgid "Please check if you are using a DVDRAM device"
-msgstr "Klikit war ur parzhadur mar plij"
-
-#: ../../standalone/drakbackup_.c:1969
-msgid ""
-"Please enter your CD Writer device name\n"
-" ex: 0,1,0"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2002
-#, fuzzy
-msgid "No CD device defined!"
-msgstr "Diuzit ar restr"
-
-#: ../../standalone/drakbackup_.c:2050
-#, fuzzy
-msgid "Use tape to backup"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:2053
-msgid "Please enter the device name to use for backup"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2059
-#, fuzzy
-msgid "Please check if you want to use the non-rewinding device."
-msgstr "Dibabit ar pakadoù a vennit staliañ, mar plij."
-
-#: ../../standalone/drakbackup_.c:2065
-#, fuzzy
-msgid "Please check if you want to erase your tape before the backup."
-msgstr "Dibabit ar pakadoù a vennit staliañ, mar plij."
-
-#: ../../standalone/drakbackup_.c:2071
-#, fuzzy
-msgid "Please check if you want to eject your tape after the backup."
-msgstr "Dibabit ar pakadoù a vennit staliañ, mar plij."
-
-#: ../../standalone/drakbackup_.c:2077 ../../standalone/drakbackup_.c:2151
-#: ../../standalone/drakbackup_.c:3118
-msgid ""
-"Please enter the maximum size\n"
-" allowed for Drakbackup"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2142
-#, fuzzy
-msgid "Please enter the directory to save to:"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../standalone/drakbackup_.c:2157 ../../standalone/drakbackup_.c:3124
-#, fuzzy
-msgid "Use quota for backup files."
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:2223
-#, fuzzy
-msgid "Network"
-msgstr "Taolenn"
-
-#: ../../standalone/drakbackup_.c:2228
-msgid "CDROM / DVDROM"
-msgstr "CDROM / DVDROM"
-
-#: ../../standalone/drakbackup_.c:2233
-msgid "HardDrive / NFS"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2238
-#, fuzzy
-msgid "Tape"
-msgstr "Seurt"
-
-#: ../../standalone/drakbackup_.c:2252 ../../standalone/drakbackup_.c:2256
-#: ../../standalone/drakbackup_.c:2260
-msgid "hourly"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2253 ../../standalone/drakbackup_.c:2257
-#: ../../standalone/drakbackup_.c:2260
-msgid "daily"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2254 ../../standalone/drakbackup_.c:2258
-#: ../../standalone/drakbackup_.c:2260
-msgid "weekly"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2255 ../../standalone/drakbackup_.c:2259
-#: ../../standalone/drakbackup_.c:2260
-msgid "monthly"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2273
-#, fuzzy
-msgid "Use daemon"
-msgstr "Anv arveriad"
-
-#: ../../standalone/drakbackup_.c:2278
-#, fuzzy
-msgid ""
-"Please choose the time \n"
-"interval between each backup"
-msgstr "Dibabit ar pakadoù a vennit staliañ, mar plij."
-
-#: ../../standalone/drakbackup_.c:2284
-#, fuzzy
-msgid ""
-"Please choose the\n"
-"media for backup."
-msgstr "Diuzit ar yezh da implijout, mar plij."
-
-#: ../../standalone/drakbackup_.c:2291
-msgid ""
-"Please be sure that the cron daemon is included in your services. \n"
-"\n"
-"Note that currently all 'net' medias also use the hard drive."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2328
-msgid "Send mail report after each backup to:"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2334
-msgid "Delete Hard Drive tar files after backup to other media."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2373
-msgid "What"
-msgstr "Petra"
-
-#: ../../standalone/drakbackup_.c:2378
-msgid "Where"
-msgstr "Pelec'h"
-
-#: ../../standalone/drakbackup_.c:2383
-msgid "When"
-msgstr "Pa"
-
-#: ../../standalone/drakbackup_.c:2388
-#, fuzzy
-msgid "More Options"
-msgstr "Dibarzhoù ar mollad :"
-
-#: ../../standalone/drakbackup_.c:2407 ../../standalone/drakbackup_.c:4532
-#, fuzzy
-msgid "Drakbackup Configuration"
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../standalone/drakbackup_.c:2425
-#, fuzzy
-msgid "Please choose where you want to backup"
-msgstr "Dibabit ar pakadoù a vennit staliañ, mar plij."
-
-#: ../../standalone/drakbackup_.c:2427
-msgid "on Hard Drive"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2437
-msgid "across Network"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2447
-msgid "on CDROM"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2455
-#, fuzzy
-msgid "on Tape Device"
-msgstr "Trobarzhell ar voullerez"
-
-#: ../../standalone/drakbackup_.c:2498
-#, fuzzy
-msgid "Please choose what you want to backup"
-msgstr "Dibabit ar pakadoù a vennit staliañ, mar plij."
-
-#: ../../standalone/drakbackup_.c:2499
-#, fuzzy
-msgid "Backup system"
-msgstr "Kefluniañ reizhiadoù restroù"
-
-#: ../../standalone/drakbackup_.c:2500
-msgid "Backup Users"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2503
-msgid "Select user manually"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2586
-msgid ""
-"\n"
-"Backup Sources: \n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2587
-msgid ""
-"\n"
-"- System Files:\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2589
-msgid ""
-"\n"
-"- User Files:\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2591
-msgid ""
-"\n"
-"- Other Files:\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2593
-#, c-format
-msgid ""
-"\n"
-"- Save on Hard drive on path: %s\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2596
-msgid ""
-"\n"
-"- Delete hard drive tar files after backup.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2602
-msgid ""
-"\n"
-"- Burn to CD"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2603
-msgid "RW"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2604
-#, fuzzy, c-format
-msgid " on device: %s"
-msgstr "Trobarzhell al logodenn : %s\n"
-
-#: ../../standalone/drakbackup_.c:2605
-msgid " (multi-session)"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2606
-#, c-format
-msgid ""
-"\n"
-"- Save to Tape on device: %s"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2607
-#, c-format
-msgid "\t\tErase=%s"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2610
-#, c-format
-msgid ""
-"\n"
-"- Save via %s on host: %s\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2611
-#, c-format
-msgid ""
-"\t\t user name: %s\n"
-"\t\t on path: %s \n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2612
-#, fuzzy
-msgid ""
-"\n"
-"- Options:\n"
-msgstr "Parzhadur"
-
-#: ../../standalone/drakbackup_.c:2613
-msgid "\tDo not include System Files\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2616
-msgid "\tBackups use tar and bzip2\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2618
-msgid "\tBackups use tar and gzip\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2621
-#, c-format
-msgid ""
-"\n"
-"- Daemon (%s) include:\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2622
-msgid "\t-Hard drive.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2623
-msgid "\t-CDROM.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2624
-msgid "\t-Tape \n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2625
-msgid "\t-Network by FTP.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2626
-msgid "\t-Network by SSH.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2627
-msgid "\t-Network by rsync.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2628
-msgid "\t-Network by webdav.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2630
-msgid "No configuration, please click Wizard or Advanced.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2636
-msgid ""
-"List of data to restore:\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2803
-msgid ""
-"List of data corrupted:\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2805
-#, fuzzy
-msgid "Please uncheck or remove it on next time."
-msgstr "Dibabit ouzh pe borzh a-steud eo luget ho modem, mar plij."
-
-#: ../../standalone/drakbackup_.c:2815
-msgid "Backup files are corrupted"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2836
-msgid " All of your selected data have been "
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2837
-#, c-format
-msgid " Successfuly Restored on %s "
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2955
-#, fuzzy
-msgid " Restore Configuration "
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../standalone/drakbackup_.c:2973
-msgid "OK to restore the other files."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:2990
-msgid "User list to restore (only the most recent date per user is important)"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3068
-#, fuzzy
-msgid "Backup the system files before:"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:3070
-#, fuzzy
-msgid "please choose the date to restore"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../standalone/drakbackup_.c:3107
-#, fuzzy
-msgid "Use Hard Disk to backup"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:3110
-#, fuzzy
-msgid "Please enter the directory to save:"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../standalone/drakbackup_.c:3153
-#, fuzzy
-msgid "FTP Connection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakbackup_.c:3160
-#, fuzzy
-msgid "Secure Connection"
-msgstr "Diuzit lugerezh ar voullerez"
-
-#: ../../standalone/drakbackup_.c:3186
-#, fuzzy
-msgid "Restore from Hard Disk."
-msgstr "Assevel adalek ar pladennig"
-
-#: ../../standalone/drakbackup_.c:3188
-msgid "Please enter the directory where backups are stored"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3256
-#, fuzzy
-msgid "Select another media to restore from"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../standalone/drakbackup_.c:3258
-#, fuzzy
-msgid "Other Media"
-msgstr "All"
-
-#: ../../standalone/drakbackup_.c:3263
-#, fuzzy
-msgid "Restore system"
-msgstr "Staliañ ar reizhiad"
-
-#: ../../standalone/drakbackup_.c:3264
-#, fuzzy
-msgid "Restore Users"
-msgstr "Adaozañ adalek ar restr"
-
-#: ../../standalone/drakbackup_.c:3265
-#, fuzzy
-msgid "Restore Other"
-msgstr "Adaozañ adalek ar restr"
-
-#: ../../standalone/drakbackup_.c:3267
-#, fuzzy
-msgid "select path to restore (instead of /)"
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../standalone/drakbackup_.c:3271
-msgid "Do new backup before restore (only for incremental backups.)"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3273
-msgid "Remove user directories before restore."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3386
-msgid ""
-"Restore Selected\n"
-"Catalog Entry"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3396
-#, fuzzy
-msgid ""
-"Restore Selected\n"
-"Files"
-msgstr "Lemel ar steudad"
-
-#: ../../standalone/drakbackup_.c:3413
-#, fuzzy
-msgid ""
-"Change\n"
-"Restore Path"
-msgstr "Adaozañ adalek ar restr"
-
-#: ../../standalone/drakbackup_.c:3479
-#, c-format
-msgid "Backup files not found at %s."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3492
-#, c-format
-msgid ""
-"Insert the CD with volume label %s\n"
-" in the CD drive under mount point /mnt/cdrom"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3492
-#, fuzzy
-msgid "Restore From CD"
-msgstr "Assevel adalek ar pladennig"
-
-#: ../../standalone/drakbackup_.c:3494
-#, c-format
-msgid "Not the correct CD label. Disk is labelled %s."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3504
-#, c-format
-msgid ""
-"Insert the tape with volume label %s\n"
-" in the tape drive device %s"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3504
-#, fuzzy
-msgid "Restore From Tape"
-msgstr "Taolenn barzhañ saveteerezh"
-
-#: ../../standalone/drakbackup_.c:3506
-#, c-format
-msgid "Not the correct tape label. Tape is labelled %s."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3526
-#, fuzzy
-msgid "Restore Via Network"
-msgstr "Adaozañ adalek ar restr"
-
-#: ../../standalone/drakbackup_.c:3526
-#, c-format
-msgid "Restore Via Network Protocol: %s"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3527
-#, fuzzy
-msgid "Host Name"
-msgstr "Anv an ostiz"
-
-#: ../../standalone/drakbackup_.c:3528
-msgid "Host Path or Module"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3535
-#, fuzzy
-msgid "Password required"
-msgstr "Tremenger"
-
-#: ../../standalone/drakbackup_.c:3541
-#, fuzzy
-msgid "Username required"
-msgstr "Anv arveriad"
-
-#: ../../standalone/drakbackup_.c:3544
-#, fuzzy
-msgid "Hostname required"
-msgstr "Anv an ostiz : "
-
-#: ../../standalone/drakbackup_.c:3549
-msgid "Path or Module required"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3562
-msgid "Files Restored..."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3565
-#, fuzzy
-msgid "Restore Failed..."
-msgstr "Adaozañ adalek ar restr"
-
-#: ../../standalone/drakbackup_.c:3803
-msgid "Restore all backups"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3812
-#, fuzzy
-msgid "Custom Restore"
-msgstr "Neuziet"
-
-#: ../../standalone/drakbackup_.c:3858
-msgid "CD in place - continue."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3864
-msgid "Browse to new restore repository."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:3867
-#, fuzzy
-msgid "Restore From Catalog"
-msgstr "Taolenn barzhañ saveteerezh"
-
-#: ../../standalone/drakbackup_.c:3895
-#, fuzzy
-msgid "Restore Progress"
-msgstr "Adaozañ adalek ar restr"
-
-#: ../../standalone/drakbackup_.c:3937 ../../standalone/drakbackup_.c:3970
-#: ../../standalone/drakbackup_.c:3996 ../../standalone/drakbackup_.c:4023
-#: ../../standalone/drakbackup_.c:4050 ../../standalone/drakbackup_.c:4110
-#: ../../standalone/drakbackup_.c:4137 ../../standalone/drakbackup_.c:4167
-#: ../../standalone/drakbackup_.c:4193
-msgid "Previous"
-msgstr "Diaraog"
-
-#: ../../standalone/drakbackup_.c:3941 ../../standalone/drakbackup_.c:4027
-#: ../../standalone/logdrake_.c:224
-msgid "Save"
-msgstr "Enrollañ"
-
-#: ../../standalone/drakbackup_.c:4000
-#, fuzzy
-msgid "Build Backup"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:4054 ../../standalone/drakbackup_.c:4634
-#, fuzzy
-msgid "Restore"
-msgstr "Adaozañ adalek ar restr"
-
-#: ../../standalone/drakbackup_.c:4233
-msgid ""
-"Error during sendmail.\n"
-" Your report mail was not sent.\n"
-" Please configure sendmail"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4257
-#, fuzzy
-msgid ""
-"The following packages need to be installed:\n"
-" @list_of_rpm_to_install"
-msgstr "Ar pakadoù a-heul a zo war-nes bezañ distaliet"
-
-#: ../../standalone/drakbackup_.c:4280
-msgid ""
-"Error during sending file via FTP.\n"
-" Please correct your FTP configuration."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4303
-#, fuzzy
-msgid "Please select data to restore..."
-msgstr "Diuzit ar yezh da implijout, mar plij."
-
-#: ../../standalone/drakbackup_.c:4324
-#, fuzzy
-msgid "Please select media for backup..."
-msgstr "Diuzit ar yezh da implijout, mar plij."
-
-#: ../../standalone/drakbackup_.c:4346
-#, fuzzy
-msgid "Please select data to backup..."
-msgstr "Diuzit ar yezh da implijout, mar plij."
-
-#: ../../standalone/drakbackup_.c:4368
-msgid ""
-"No configuration file found \n"
-"please click Wizard or Advanced."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4389
-msgid "Under Devel ... please wait."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4470
-#, fuzzy
-msgid "Backup system files"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:4472
-#, fuzzy
-msgid "Backup user files"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:4474
-#, fuzzy
-msgid "Backup other files"
-msgstr "Restr gwareziñ siek"
-
-#: ../../standalone/drakbackup_.c:4476 ../../standalone/drakbackup_.c:4509
-msgid "Total Progress"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4500
-msgid "files sending by FTP"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4504
-#, fuzzy
-msgid "Sending files..."
-msgstr "Enrollañ er restr"
-
-#: ../../standalone/drakbackup_.c:4590
-#, fuzzy
-msgid "Backup Now from configuration file"
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../standalone/drakbackup_.c:4595
-#, fuzzy
-msgid "View Backup Configuration."
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../standalone/drakbackup_.c:4616
-#, fuzzy
-msgid "Wizard Configuration"
-msgstr "Kefluniadur"
-
-#: ../../standalone/drakbackup_.c:4621
-#, fuzzy
-msgid "Advanced Configuration"
-msgstr "Kefluniadur"
-
-#: ../../standalone/drakbackup_.c:4626
-#, fuzzy
-msgid "Backup Now"
-msgstr "Kefluniañ reizhiadoù restroù"
-
-#: ../../standalone/drakbackup_.c:4660
-msgid "Drakbackup"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4711
-msgid ""
-"options description:\n"
-"\n"
-" In this step Drakbackup allow you to change:\n"
-"\n"
-" - The compression mode:\n"
-" \n"
-" If you check bzip2 compression, you will compress\n"
-" your data better than gzip (about 2-10 %).\n"
-" This option is not checked by default because\n"
-" this compression mode needs more time (about 1000% more).\n"
-" \n"
-" - The update mode:\n"
-"\n"
-" This option will update your backup, but this\n"
-" option is not really useful because you need to\n"
-" decompress your backup before you can update it.\n"
-" \n"
-" - the .backupignore mode:\n"
-"\n"
-" Like with cvs, Drakbackup will ignore all references\n"
-" included in .backupignore files in each directories.\n"
-" ex: \n"
-" /*> cat .backupignore*/\n"
-" *.o\n"
-" *~\n"
-" ...\n"
-" \n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4741
-msgid ""
-"\n"
-" Some errors during sendmail are caused by \n"
-" a bad configuration of postfix. To solve it you have to\n"
-" set myhostname or mydomain in /etc/postfix/main.cf\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4749
-msgid ""
-"options description:\n"
-"\n"
-" - Backup system files:\n"
-" \n"
-"\tThis option allows you to backup your /etc directory,\n"
-"\twhich contains all configuration files. Please be\n"
-"\tcareful during the restore step to not overwrite:\n"
-"\t\t/etc/passwd \n"
-"\t\t/etc/group \n"
-"\t\t/etc/fstab\n"
-"\n"
-" - Backup User files: \n"
-"\n"
-"\tThis option allows you select all users that you want \n"
-"\tto backup.\n"
-"\tTo preserve disk space, it is recommended that you \n"
-"\tdo not include web browser's cache.\n"
-"\n"
-" - Backup Other files: \n"
-"\n"
-"\tThis option allows you to add more data to save.\n"
-"\tWith the other backup it's not possible at the \n"
-"\tmoment to select incremental backup.\t\t\n"
-" \n"
-" - Incremental Backups:\n"
-"\n"
-"\tThe incremental backup is the most powerful \n"
-"\toption for backup. This option allows you \n"
-"\tto backup all your data the first time, and \n"
-"\tonly the changed afterward.\n"
-"\tThen you will be able, during the restore\n"
-"\tstep, to restore your data from a specified\n"
-"\tdate.\n"
-"\tIf you have not selected this option all\n"
-"\told backups are deleted before each backup. \n"
-"\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4788
-msgid ""
-"restore description:\n"
-" \n"
-"Only the most recent date will be used, because with incremental \n"
-"backups it is necessary to restore one by one each older backup.\n"
-"\n"
-"So if you don't want to restore a user please unselect all their\n"
-"check boxes.\n"
-"\n"
-"Otherwise, you are able to select only one of these.\n"
-"\n"
-" - Incremental Backups:\n"
-"\n"
-"\tThe incremental backup is the most powerful \n"
-"\toption to use. This option allows you to \n"
-"\tbackup all of your data the first time, and \n"
-"\tonly the changed data after.\n"
-"\tSo you will be able, during the restore\n"
-"\tstep, to restore your data from a specified\n"
-"\tdate.\n"
-"\tIf you have not selected this option all\n"
-"\told backups are deleted before each backup. \n"
-"\n"
-"\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4814 ../../standalone/drakbackup_.c:4891
-msgid ""
-" Copyright (C) 2001 MandrakeSoft by DUPONT Sebastien <dupont_s\\@epita.fr>"
-msgstr ""
-"Copyright (C) 2001 MandrakeSoft gant DUPONT Sebastien <dupont_s\\@epita.fr>"
-
-#: ../../standalone/drakbackup_.c:4816 ../../standalone/drakbackup_.c:4893
-msgid ""
-" updates 2002 MandrakeSoft by Stew Benedict <sbenedict\\@mandrakesoft.com>"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4818 ../../standalone/drakbackup_.c:4895
-msgid ""
-" This program is free software; you can redistribute it and/or modify\n"
-" it under the terms of the GNU General Public License as published by\n"
-" the Free Software Foundation; either version 2, or (at your option)\n"
-" any later version.\n"
-"\n"
-" This program is distributed in the hope that it will be useful,\n"
-" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
-" GNU General Public License for more details.\n"
-"\n"
-" You should have received a copy of the GNU General Public License\n"
-" along with this program; if not, write to the Free Software\n"
-" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4832
-msgid ""
-"Description:\n"
-"\n"
-" Drakbackup is used to backup your system.\n"
-" During the configuration you can select: \n"
-"\t- System files, \n"
-"\t- Users files, \n"
-"\t- Other files.\n"
-"\tor All your system ... and Other (like Windows Partitions)\n"
-"\n"
-" Drakbackup allows you to backup your system on:\n"
-"\t- Harddrive.\n"
-"\t- NFS.\n"
-"\t- CDROM (CDRW), DVDROM (with autoboot, rescue and autoinstall.).\n"
-"\t- FTP.\n"
-"\t- Rsync.\n"
-"\t- Webdav.\n"
-"\t- Tape.\n"
-"\n"
-" Drakbackup allows you to restore your system to\n"
-" a user selected directory.\n"
-"\n"
-" Per default all backup will be stored on your\n"
-" /var/lib/drakbackup directory\n"
-"\n"
-" Configuration file:\n"
-"\t/etc/drakconf/drakbackup/drakbakup.conf\n"
-"\n"
-"\n"
-"Restore Step:\n"
-" \n"
-" During the restore step, DrakBackup will remove \n"
-" your original directory and verify that all \n"
-" backup files are not corrupted. It is recommended \n"
-" you do a last backup before restoring.\n"
-"\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4870
-msgid ""
-"options description:\n"
-"\n"
-"Please be careful when you are using ftp backup, because only \n"
-"backups that are already built are sent to the server.\n"
-"So at the moment, you need to build the backup on your hard \n"
-"drive before sending it to the server.\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4879
-msgid ""
-"\n"
-"Restore Backup Problems:\n"
-"\n"
-"During the restore step, Drakbackup will verify all your\n"
-"backup files before restoring them.\n"
-"Before the restore, Drakbackup will remove \n"
-"your original directory, and you will loose all your \n"
-"data. It is important to be careful and not modify the \n"
-"backup data files by hand.\n"
-msgstr ""
-
-#: ../../standalone/drakbackup_.c:4909
-msgid ""
-"Description:\n"
-"\n"
-" Drakbackup is used to backup your system.\n"
-" During the configuration you can select \n"
-"\t- System files, \n"
-"\t- Users files, \n"
-"\t- Other files.\n"
-"\tor All your system ... and Other (like Windows Partitions)\n"
-"\n"
-" Drakbackup allows you to backup your system on:\n"
-"\t- Harddrive.\n"
-"\t- NFS.\n"
-"\t- CDROM (CDRW), DVDROM (with autoboot, rescue and autoinstall.).\n"
-"\t- FTP.\n"
-"\t- Rsync.\n"
-"\t- Webdav.\n"
-"\t- Tape.\n"
-"\n"
-" Drakbackup allows you to restore your system to\n"
-" a user selected directory.\n"
-"\n"
-" Per default all backup will be stored on your\n"
-" /var/lib/drakbackup directory\n"
-"\n"
-" Configuration file:\n"
-"\t/etc/drakconf/drakbackup/drakbakup.conf\n"
-"\n"
-"Restore Step:\n"
-" \n"
-" During the restore step, Drakbackup will remove\n"
-" your original directory and verify that all\n"
-" backup files are not corrupted. It is recommended\n"
-" you do a last backup before restoring.\n"
-" \n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakboot_.c:57
-#, c-format
-msgid "Installation of %s failed. The following error occured:"
-msgstr "Staliadur %s a zo sac'het. Degouezhet eo ar fazi a heul :"
-
-#: ../../standalone/drakbug_.c:40
-#, c-format
-msgid ""
-"drakbug version %s\n"
-"Copyright (C) 2002 MandrakeSoft.\n"
-"This is free software and may be redistributed under the terms of the GNU "
-"GPL.\n"
-"\n"
-"usage: drakbug [OPTIONS] [PROGRAM_NAME]\n"
-"\n"
-"OPTIONS:\n"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:47
-msgid " --help - print this help message.\n"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:48
-msgid " --report - program should be one of mandrake tools\n"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:49
-msgid " --incident - program should be one of mandrake tools\n"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:64
-msgid "Mandrake Bug Report Tool"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:70
-msgid "First Time Wizard"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:71
-msgid "Synchronization tool"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:72 ../../standalone/drakbug_.c:86
-#: ../../standalone/drakbug_.c:156 ../../standalone/drakbug_.c:158
-#: ../../standalone/drakbug_.c:162
-msgid "Standalone Tools"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:73
-msgid "HardDrake"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:74
-#, fuzzy
-msgid "Mandrake Online"
-msgstr "MandrakeConsulting"
-
-#: ../../standalone/drakbug_.c:75
-#, fuzzy
-msgid "Menudrake"
-msgstr "MandrakeStore"
-
-#: ../../standalone/drakbug_.c:76
-#, fuzzy
-msgid "Msec"
-msgstr "Logodenn"
-
-#: ../../standalone/drakbug_.c:77
-#, fuzzy
-msgid "Remote Control"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../standalone/drakbug_.c:78
-#, fuzzy
-msgid "Software Manager"
-msgstr "Anv rannet"
-
-#: ../../standalone/drakbug_.c:79
-msgid "Urpmi"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:80
-#, fuzzy
-msgid "Windows Migration tool"
-msgstr "Titouroù"
-
-#: ../../standalone/drakbug_.c:81
-#, fuzzy
-msgid "Userdrake"
-msgstr "Moullerez"
-
-#: ../../standalone/drakbug_.c:82
-#, fuzzy
-msgid "Configuration Wizards"
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../standalone/drakbug_.c:97
-#, fuzzy
-msgid "Application:"
-msgstr "X11/Arloadoù"
-
-#: ../../standalone/drakbug_.c:98
-#, fuzzy
-msgid "Package: "
-msgstr "Pakad"
-
-#: ../../standalone/drakbug_.c:99
-msgid "Kernel:"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:100
-#, fuzzy
-msgid "Release: "
-msgstr "Gortozit mar plij"
-
-#: ../../standalone/drakbug_.c:115
-msgid ""
-"\n"
-"\n"
-"To submit a bug report, click on the button report.\n"
-"This will open a web browser window on https://drakbug.mandrakesoft.com\n"
-" where you'll find a form to fill in.The information displayed above will "
-"be \n"
-"transferred to that server\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakbug_.c:134
-#, fuzzy
-msgid "Report"
-msgstr "Paour"
-
-#: ../../standalone/drakbug_.c:171
-#, fuzzy
-msgid "Not installed"
-msgstr "Dilezel ar staliadur"
-
-#: ../../standalone/drakbug_.c:189
-msgid "connecting to Bugzilla wizard ..."
-msgstr ""
-
-#: ../../standalone/drakbug_.c:196
-#, fuzzy
-msgid "No browser available! Please install one"
-msgstr "Gallout a rit dibab yezhoù all hag a vo hegerz goude staliañ"
-
-#: ../../standalone/drakconnect_.c:79
-#, fuzzy, c-format
-msgid "Network configuration (%d adapters)"
-msgstr "Kefluniadur ar rouedad"
-
-#: ../../standalone/drakconnect_.c:86 ../../standalone/drakconnect_.c:594
-#, fuzzy
-msgid "Profile: "
-msgstr "marc'hañ sac'het : "
-
-#: ../../standalone/drakconnect_.c:94
-msgid "Del profile..."
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:100
-msgid "Profile to delete:"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:128
-msgid "New profile..."
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:134
-msgid ""
-"Name of the profile to create (the new profile is created as a copy of the "
-"current one) :"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:160
-#, fuzzy
-msgid "Hostname: "
-msgstr "Anv an ostiz : "
-
-#: ../../standalone/drakconnect_.c:167
-#, fuzzy
-msgid "Internet access"
-msgstr "dedennus"
-
-#: ../../standalone/drakconnect_.c:180
-#, fuzzy
-msgid "Type:"
-msgstr "Seurt : "
-
-#: ../../standalone/drakconnect_.c:183 ../../standalone/drakconnect_.c:375
-msgid "Gateway:"
-msgstr "Treuzell : "
-
-#: ../../standalone/drakconnect_.c:183 ../../standalone/drakconnect_.c:375
-#, fuzzy
-msgid "Interface:"
-msgstr "dedennus"
-
-#: ../../standalone/drakconnect_.c:194
-msgid "Status:"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:201
-msgid "Wait please"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:219
-#, fuzzy
-msgid "Configure Internet Access..."
-msgstr "Kefluniañ servijoù"
-
-#: ../../standalone/drakconnect_.c:226 ../../standalone/drakconnect_.c:448
-#, fuzzy
-msgid "LAN configuration"
-msgstr "Kefluniadur"
-
-#: ../../standalone/drakconnect_.c:231
-#, fuzzy
-msgid "Driver"
-msgstr "Servijer"
-
-#: ../../standalone/drakconnect_.c:231
-#, fuzzy
-msgid "Interface"
-msgstr "dedennus"
-
-#: ../../standalone/drakconnect_.c:231
-msgid "Protocol"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:231
-#, fuzzy
-msgid "State"
-msgstr "Meuziad Lañsañ"
-
-#: ../../standalone/drakconnect_.c:243
-#, fuzzy
-msgid "Configure Local Area Network..."
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../standalone/drakconnect_.c:255
-msgid "Click here to launch the wizard ->"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:256
-msgid "Wizard..."
-msgstr "Skoazeller..."
-
-#: ../../standalone/drakconnect_.c:282
-msgid "Apply"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:383 ../../standalone/drakconnect_.c:406
-#, fuzzy
-msgid "Connected"
-msgstr "Anv ar gevreadenn"
-
-#: ../../standalone/drakconnect_.c:383 ../../standalone/drakconnect_.c:406
-#, fuzzy
-msgid "Not connected"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakconnect_.c:384 ../../standalone/drakconnect_.c:407
-msgid "Connect..."
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:384 ../../standalone/drakconnect_.c:407
-msgid "Disconnect..."
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:403
-msgid ""
-"Warning, another Internet connection has been detected, maybe using your "
-"network"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:430
-msgid ""
-"You don't have any configured interface.\n"
-"Configure them first by clicking on 'Configure'"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:452
-#, fuzzy
-msgid "LAN Configuration"
-msgstr "Kefluniadur"
-
-#: ../../standalone/drakconnect_.c:463
-#, c-format
-msgid "Adapter %s: %s"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:469
-msgid "Boot Protocol"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:470
-msgid "Started on boot"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:471
-msgid "DHCP client"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:496 ../../standalone/drakconnect_.c:499
-#, fuzzy
-msgid "activate now"
-msgstr "Bevaat"
-
-#: ../../standalone/drakconnect_.c:496 ../../standalone/drakconnect_.c:499
-#, fuzzy
-msgid "deactivate now"
-msgstr "Bevaat"
-
-#: ../../standalone/drakconnect_.c:502
-msgid ""
-"This interface has not been configured yet.\n"
-"Launch the configuration wizard in the main window"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:559
-msgid ""
-"You don't have any internet connection.\n"
-"Create one first by clicking on 'Configure'"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:583
-#, fuzzy
-msgid "Internet connection configuration"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakconnect_.c:587
-#, fuzzy
-msgid "Internet Connection Configuration"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakconnect_.c:596
-#, fuzzy
-msgid "Connection type: "
-msgstr "Anv ar gevreadenn"
-
-#: ../../standalone/drakconnect_.c:602
-msgid "Parameters"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:620
-msgid "Gateway"
-msgstr "Treuzell"
-
-#: ../../standalone/drakconnect_.c:629
-msgid "Ethernet Card"
-msgstr ""
-
-#: ../../standalone/drakconnect_.c:630
-msgid "DHCP Client"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:64
-msgid "usage: drakfloppy\n"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:68
-#, fuzzy
-msgid "-misc-Fixed-Medium-r-*-*-*-140-*-*-*-*-*-*,*"
-msgstr "-misc-fixed-medium-r-*-*-*-100-*-*-*-*-*-*,*"
-
-#: ../../standalone/drakfloppy_.c:69
-#, fuzzy
-msgid "Module name"
-msgstr "Dibarzhoù ar mollad :"
-
-#: ../../standalone/drakfloppy_.c:69
-#, fuzzy
-msgid "Size"
-msgstr "Ment: %s"
-
-#: ../../standalone/drakfloppy_.c:74
-#, fuzzy
-msgid "drakfloppy"
-msgstr "Assevel adalek ar pladennig"
-
-#: ../../standalone/drakfloppy_.c:91
-#, fuzzy
-msgid "boot disk creation"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../standalone/drakfloppy_.c:99 ../../standalone/drakfloppy_.c:112
-msgid "default"
-msgstr "dre ziouer"
-
-#: ../../standalone/drakfloppy_.c:115
-#, c-format
-msgid "DrakFloppy Error: %s"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:126
-#, fuzzy
-msgid "kernel version"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../standalone/drakfloppy_.c:132
-#, fuzzy
-msgid "General"
-msgstr "Rummel"
-
-#: ../../standalone/drakfloppy_.c:137
-#, fuzzy
-msgid "Expert Area"
-msgstr "Mod mailh"
-
-#: ../../standalone/drakfloppy_.c:140
-msgid "mkinitrd optional arguments"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:141
-#, fuzzy
-msgid "Add a module"
-msgstr "Ouzhpennañ un arveriad"
-
-#: ../../standalone/drakfloppy_.c:161
-#, fuzzy
-msgid "force"
-msgstr "Dilec'hiañ"
-
-#: ../../standalone/drakfloppy_.c:162
-msgid "if needed"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:163
-msgid "omit scsi modules"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:164
-msgid "omit raid modules"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:200
-#, fuzzy
-msgid "Remove a module"
-msgstr "Eilpennañ urzh ar pajennoù"
-
-#: ../../standalone/drakfloppy_.c:222
-msgid "Output"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:234
-msgid "Build the disk"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:377
-#, c-format
-msgid "Be sure a media is present for the device %s"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:382
-#, c-format
-msgid ""
-"There is no medium or it is write-protected for device %s.\n"
-"Please insert one."
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:384
-#, c-format
-msgid "Unable to fork: %s"
-msgstr ""
-
-#: ../../standalone/drakfloppy_.c:388
-#, c-format
-msgid ""
-"Unable to close properly mkbootdisk: \n"
-" %s \n"
-" %s"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:231
-msgid "Search installed fonts"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:233
-msgid "Unselect fonts installed"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:257
-msgid "parse all fonts"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:260
-#, fuzzy
-msgid "no fonts found"
-msgstr "%s ket kavet"
-
-#: ../../standalone/drakfont_.c:269 ../../standalone/drakfont_.c:323
-#: ../../standalone/drakfont_.c:379 ../../standalone/drakfont_.c:468
-#: ../../standalone/drakfont_.c:479 ../../standalone/drakfont_.c:506
-#: ../../standalone/drakfont_.c:520 ../../standalone/drakfont_.c:537
-#, fuzzy
-msgid "done"
-msgstr "Graet"
-
-#: ../../standalone/drakfont_.c:275
-msgid "could not find any font in your mounted partitions"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:321
-msgid "Reselect correct fonts"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:325
-msgid "could not find any font.\n"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:349
-msgid "Search fonts in installed list"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:377
-#, fuzzy
-msgid "Fonts copy"
-msgstr "Furmadiñ ar bladennig"
-
-#: ../../standalone/drakfont_.c:381
-#, fuzzy
-msgid "True Type fonts installation"
-msgstr "O prientiñ ar staliadur"
-
-#: ../../standalone/drakfont_.c:389
-msgid "please wait during ttmkfdir..."
-msgstr ""
-
-#: ../../standalone/drakfont_.c:394
-msgid "True Type install done"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:403 ../../standalone/drakfont_.c:429
-msgid "Fonts conversion"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:409 ../../standalone/drakfont_.c:433
-#: ../../standalone/drakfont_.c:464
-msgid "type1inst building"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:419 ../../standalone/drakfont_.c:442
-msgid "Ghostscript referencing"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:452
-msgid "ttf fonts conversion"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:459
-msgid "pfm fonts conversion"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:470
-msgid "Suppress temporary Files"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:473
-msgid "Restart XFS"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:518 ../../standalone/drakfont_.c:532
-msgid "Suppress Fonts Files"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:534
-#, fuzzy
-msgid "xfs restart"
-msgstr "strishaat"
-
-#: ../../standalone/drakfont_.c:542 ../../standalone/drakfont_.c:951
-msgid ""
-"Before installing any fonts, be sure that you have the right to use and "
-"install them on your system.\n"
-"\n"
-"-You can install the fonts using the normal way. In rare cases, bogus fonts "
-"may hang up your X Server."
-msgstr ""
-
-#: ../../standalone/drakfont_.c:630
-#, fuzzy
-msgid "Fonts Importation"
-msgstr "Furmadiñ parzhadurioù"
-
-#: ../../standalone/drakfont_.c:660
-msgid "Get Windows Fonts"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:668
-#, fuzzy
-msgid "Uninstall Fonts"
-msgstr "O tistaliañ ar RPMoù"
-
-#: ../../standalone/drakfont_.c:679
-#, fuzzy
-msgid "Advanced Options"
-msgstr "Kefluniadur"
-
-#: ../../standalone/drakfont_.c:687
-#, fuzzy
-msgid "Font List"
-msgstr "Poent marc'hañ"
-
-#: ../../standalone/drakfont_.c:909
-#, fuzzy
-msgid "Choose the applications that will support the fonts:"
-msgstr "Dibabit ar parzhadur a vennit furmadiñ"
-
-#: ../../standalone/drakfont_.c:918
-msgid "Ghostscript"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:925
-#, fuzzy
-msgid "StarOffice"
-msgstr "Burev"
-
-#: ../../standalone/drakfont_.c:932
-msgid "Abiword"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:939
-#, fuzzy
-msgid "Generic Printers"
-msgstr "Moullerez"
-
-#: ../../standalone/drakfont_.c:1016
-msgid "Select the font file or directory and click on 'Add'"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1063
-#, fuzzy
-msgid "Install List"
-msgstr "Staliañ ar reizhiad"
-
-#: ../../standalone/drakfont_.c:1106
-msgid "click here if you are sure."
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1113
-msgid "here if no."
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1174
-msgid "Unselected All"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1178
-#, fuzzy
-msgid "Selected All"
-msgstr "Diuzit ar restr"
-
-#: ../../standalone/drakfont_.c:1182
-#, fuzzy
-msgid "Remove List"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../standalone/drakfont_.c:1204 ../../standalone/drakfont_.c:1237
-msgid "Initials tests"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1207
-msgid "Copy fonts on your system"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1211
-msgid "Install & convert Fonts"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1215
-#, fuzzy
-msgid "Post Install"
-msgstr "Staliañ"
-
-#: ../../standalone/drakfont_.c:1240
-msgid "Remove fonts on your system"
-msgstr ""
-
-#: ../../standalone/drakfont_.c:1244
-#, fuzzy
-msgid "Post Uninstall"
-msgstr "Dilezel ar staliadur"
-
-#: ../../standalone/drakgw_.c:43 ../../standalone/drakgw_.c:184
-#, fuzzy
-msgid "Internet Connection Sharing"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakgw_.c:115
-msgid "Sorry, we support only 2.4 kernels."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:126
-msgid "Internet Connection Sharing currently enabled"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:127
-msgid ""
-"The setup of Internet connection sharing has already been done.\n"
-"It's currently enabled.\n"
-"\n"
-"What would you like to do?"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:131
-#, fuzzy
-msgid "disable"
-msgstr "Taolenn"
-
-#: ../../standalone/drakgw_.c:131 ../../standalone/drakgw_.c:156
-msgid "dismiss"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:131 ../../standalone/drakgw_.c:156
-#, fuzzy
-msgid "reconfigure"
-msgstr "Kefluniañ X"
-
-#: ../../standalone/drakgw_.c:134
-#, fuzzy
-msgid "Disabling servers..."
-msgstr "O tinoiñ trobarzhelloù..."
-
-#: ../../standalone/drakgw_.c:142
-#, fuzzy
-msgid "Internet connection sharing is now disabled."
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakgw_.c:151
-msgid "Internet Connection Sharing currently disabled"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:152
-msgid ""
-"The setup of Internet connection sharing has already been done.\n"
-"It's currently disabled.\n"
-"\n"
-"What would you like to do?"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:156
-#, fuzzy
-msgid "enable"
-msgstr "Taolenn"
-
-#: ../../standalone/drakgw_.c:163
-msgid "Enabling servers..."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:168
-#, fuzzy
-msgid "Internet connection sharing is now enabled."
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakgw_.c:185
-msgid ""
-"You are about to configure your computer to share its Internet connection.\n"
-"With that feature, other computers on your local network will be able to use "
-"this computer's Internet connection.\n"
-"\n"
-"Note: you need a dedicated Network Adapter to set up a Local Area Network "
-"(LAN)."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:211
-#, c-format
-msgid "Interface %s (using module %s)"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:212
-#, fuzzy, c-format
-msgid "Interface %s"
-msgstr "dedennus"
-
-#: ../../standalone/drakgw_.c:220
-msgid "No network adapter on your system!"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:221
-msgid ""
-"No ethernet network adapter has been detected on your system. Please run the "
-"hardware configuration tool."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:227
-msgid "Network interface"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:228
-#, c-format
-msgid ""
-"There is only one configured network adapter on your system:\n"
-"\n"
-"%s\n"
-"\n"
-"I am about to setup your Local Area Network with that adapter."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:237
-msgid ""
-"Please choose what network adapter will be connected to your Local Area "
-"Network."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:255
-#, fuzzy
-msgid "Network interface already configured"
-msgstr "Skramm ket kefluniet"
-
-#: ../../standalone/drakgw_.c:256
-#, c-format
-msgid ""
-"Warning, the network adapter (%s) is already configured.\n"
-"\n"
-"Do you want an automatic re-configuration?\n"
-"\n"
-"You can do it manually but you need to know what you're doing."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:261
-#, fuzzy
-msgid "Automatic reconfiguration"
-msgstr "Kefluniadur goude staliañ"
-
-#: ../../standalone/drakgw_.c:262
-#, fuzzy
-msgid "Show current interface configuration"
-msgstr "Kefluniañ ar modem"
-
-#: ../../standalone/drakgw_.c:264
-#, c-format
-msgid ""
-"Current configuration of `%s':\n"
-"\n"
-"Network: %s\n"
-"IP address: %s\n"
-"IP attribution: %s\n"
-"Driver: %s"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:276
-msgid ""
-"I can keep your current configuration and assume you already set up a DHCP "
-"server; in that case please verify I correctly read the C-Class Network that "
-"you use for your local network; I will not reconfigure it and I will not "
-"touch your DHCP server configuration.\n"
-"\n"
-"Else, I can reconfigure your interface and (re)configure a DHCP server for "
-"you.\n"
-"\n"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:281
-msgid "C-Class Local Network"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:282
-#, fuzzy
-msgid "(This) DHCP Server IP"
-msgstr "IP ar servijer SMB"
-
-#: ../../standalone/drakgw_.c:283
-msgid "Re-configure interface and DHCP server"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:290
-msgid "The Local Network did not finish with `.0', bailing out."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:301
-#, c-format
-msgid "Potential LAN address conflict found in current config of %s!\n"
-msgstr ""
-
-#: ../../standalone/drakgw_.c:311
-#, fuzzy
-msgid "Configuring..."
-msgstr "Kefluniañ IDE"
-
-#: ../../standalone/drakgw_.c:312
-msgid "Configuring scripts, installing software, starting servers..."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:348
-#, fuzzy, c-format
-msgid "Problems installing package %s"
-msgstr "O staliañ ar pakad %s"
-
-#: ../../standalone/drakgw_.c:481
-msgid ""
-"Everything has been configured.\n"
-"You may now share Internet connection with other computers on your Local "
-"Area Network, using automatic network configuration (DHCP)."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:500
-msgid "The setup has already been done, but it's currently disabled."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:501
-msgid "The setup has already been done, and it's currently enabled."
-msgstr ""
-
-#: ../../standalone/drakgw_.c:502
-#, fuzzy
-msgid "No Internet Connection Sharing has ever been configured."
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakgw_.c:507
-#, fuzzy
-msgid "Internet connection sharing configuration"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakgw_.c:514
-#, fuzzy, c-format
-msgid ""
-"Welcome to the Internet Connection Sharing utility!\n"
-"\n"
-"%s\n"
-"\n"
-"Click on Configure to launch the setup wizard."
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/drakperm_.c:42
-#, fuzzy
-msgid "group"
-msgstr "Strollad labour"
-
-#: ../../standalone/drakperm_.c:42
-msgid "path"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:42
-#, fuzzy
-msgid "permissions"
-msgstr "parzhadur %s"
-
-#: ../../standalone/drakperm_.c:42
-#, fuzzy
-msgid "user"
-msgstr "Anv arveriad"
-
-#: ../../standalone/drakperm_.c:49
-msgid "Up"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:50
-#, fuzzy
-msgid "delete"
-msgstr "Dilemel"
-
-#: ../../standalone/drakperm_.c:51
-#, fuzzy
-msgid "edit"
-msgstr "Etre"
-
-#: ../../standalone/drakperm_.c:52
-#, fuzzy
-msgid "Down"
-msgstr "Graet"
-
-#: ../../standalone/drakperm_.c:53
-#, fuzzy
-msgid "add a rule"
-msgstr "Ouzhpennañ un arveriad"
-
-#: ../../standalone/drakperm_.c:54
-msgid "select perm file to see/edit"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:57
-msgid ""
-"Drakperm is used to see files to use in order to fix permissions, owners, "
-"and groups via msec.\n"
-"You can also edit your own rules which will owerwrite the default rules."
-msgstr ""
-
-#: ../../standalone/drakperm_.c:62
-#, fuzzy
-msgid "Add a new rule at the end"
-msgstr "Moullerez lec'hel"
-
-#: ../../standalone/drakperm_.c:63
-msgid "Edit curent rule"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:64
-msgid "Up selected rule one level"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:65
-msgid "Down selected rule one level"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:66
-#, fuzzy
-msgid "Delete selected rule"
-msgstr "Lemel ar steudad"
-
-#: ../../standalone/drakperm_.c:237
-msgid "browse"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:244
-#, fuzzy
-msgid "Current user"
-msgstr "Aotren an arveriad"
-
-#: ../../standalone/drakperm_.c:249
-#, fuzzy
-msgid "Permissions"
-msgstr "Stumm : %s\n"
-
-#: ../../standalone/drakperm_.c:250
-msgid "Path"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:251
-#, fuzzy
-msgid "Property"
-msgstr "Paour"
-
-#: ../../standalone/drakperm_.c:253
-msgid "sticky-bit"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:254
-msgid "Set-UID"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:255
-msgid "Set-GID"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:310
-msgid ""
-"Used for directory:\n"
-" only owner of directory or file in this directory can delete it"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:311
-msgid "Use owner id for execution"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:312
-msgid "Use group id for execution"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:313
-msgid "when checked, owner and group won't be changed"
-msgstr ""
-
-#: ../../standalone/drakperm_.c:318
-#, fuzzy
-msgid "Path selection"
-msgstr "Diuz pakadoù unan hag unan"
-
-#: ../../standalone/drakperm_.c:364
-#, fuzzy
-msgid "user :"
-msgstr "Anv arveriad"
-
-#: ../../standalone/drakperm_.c:366
-#, fuzzy
-msgid "group :"
-msgstr "Strollad labour"
-
-#: ../../standalone/draksound_.c:47
-#, fuzzy
-msgid "No Sound Card detected!"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/draksound_.c:48
-msgid ""
-"No Sound Card has been detected on your machine. Please verify that a Linux-"
-"supported Sound Card is correctly plugged in.\n"
-"\n"
-"\n"
-"You can visit our hardware database at:\n"
-"\n"
-"\n"
-"http://www.linux-mandrake.com/en/hardware.php3"
-msgstr ""
-
-#: ../../standalone/draksound_.c:55
-msgid ""
-"\n"
-"\n"
-"\n"
-"Note: if you've an ISA PnP sound card, you'll have to use the sndconfig "
-"program. Just type \"sndconfig\" in a console."
-msgstr ""
-
-#: ../../standalone/draksplash_.c:34
-msgid ""
-"package 'ImageMagick' is required for correct working.\n"
-"Click \"Ok\" to install 'ImageMagick' or \"Cancel\" to quit"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:78
-#, fuzzy
-msgid "first step creation"
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../standalone/draksplash_.c:79
-#, fuzzy
-msgid "final resolution"
-msgstr "Spister"
-
-#: ../../standalone/draksplash_.c:80 ../../standalone/draksplash_.c:172
-#, fuzzy
-msgid "choose image file"
-msgstr "Dibabit ur restr"
-
-#: ../../standalone/draksplash_.c:81
-#, fuzzy
-msgid "Theme name"
-msgstr "Anv rannet"
-
-#: ../../standalone/draksplash_.c:85
-msgid "Browse"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:99 ../../standalone/draksplash_.c:162
-#, fuzzy
-msgid "Configure bootsplash picture"
-msgstr "Kefluniañ servijoù"
-
-#: ../../standalone/draksplash_.c:100
-msgid ""
-"x coordinate of text box\n"
-"in number of character"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:101
-msgid ""
-"y coordinate of text box\n"
-"in number of character"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:102
-msgid "text width"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:103
-msgid "text box height"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:104
-msgid ""
-"the progress bar x coordinate\n"
-"of its upper left corner"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:105
-msgid ""
-"the progress bar y coordinate\n"
-"of its upper left corner"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:106
-msgid "the width of the progress bar"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:107
-msgid "the heigth of the progress bar"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:108
-msgid "the color of the progress bar"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:121
-#, fuzzy
-msgid "Preview"
-msgstr "trobarzhell"
-
-#: ../../standalone/draksplash_.c:123
-#, fuzzy
-msgid "Save theme"
-msgstr "Staliañ ar reizhiad"
-
-#: ../../standalone/draksplash_.c:124
-#, fuzzy
-msgid "Choose color"
-msgstr "Dibabit ur skramm"
-
-#: ../../standalone/draksplash_.c:127
-msgid "Display logo on Console"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:128
-msgid "Make kernel message quiet by default"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:165 ../../standalone/draksplash_.c:329
-#, c-format
-msgid "This theme haven't yet any bootsplash in %s !"
-msgstr ""
-
-#: ../../standalone/draksplash_.c:212
-msgid "saving Bootsplash theme..."
-msgstr ""
-
-#: ../../standalone/draksplash_.c:435
-#, fuzzy
-msgid "ProgressBar color selection"
-msgstr "Lugerezh ar voullerez"
-
-#: ../../standalone/draksplash_.c:456
-#, fuzzy
-msgid "You must choose an image file first!"
-msgstr "Trobarzhell ar voullerez"
-
-#: ../../standalone/draksplash_.c:465
-#, fuzzy
-msgid "Generating preview ..."
-msgstr "O tinoiñ trobarzhelloù..."
-
-#. -PO First %s is theme name, second %s (in parenthesis) is resolution
-#: ../../standalone/draksplash_.c:511
-#, c-format
-msgid "%s BootSplash (%s) preview"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:49
-msgid ""
-"XawTV isn't installed!\n"
-"\n"
-"\n"
-"If you do have a TV card but DrakX has neither detected it (no bttv nor "
-"saa7134\n"
-"module in \"/etc/modules\") nor installed xawtv, please send the\n"
-"results of \"lspcidrake -v -f\" to \"install\\@mandrakesoft.com\"\n"
-"with subject \"undetected TV card\".\n"
-"\n"
-"\n"
-"You can install it by typing \"urpmi xawtv\" as root, in a console."
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:66
-#, fuzzy
-msgid "Canada (cable)"
-msgstr "Kanadian (Kebek)"
-
-#: ../../standalone/drakxtv_.c:66
-msgid "USA (broadcast)"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:66
-msgid "USA (cable)"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:66
-msgid "USA (cable-hrc)"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:67
-msgid "China (broadcast)"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:67
-msgid "Japan (broadcast)"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:67
-msgid "Japan (cable)"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:68
-msgid "East Europe"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:68
-#, fuzzy
-msgid "France [SECAM]"
-msgstr "Gall"
-
-#: ../../standalone/drakxtv_.c:68
-#, fuzzy
-msgid "Ireland"
-msgstr "Islandek"
-
-#: ../../standalone/drakxtv_.c:68
-msgid "West Europe"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:69
-#, fuzzy
-msgid "Australia"
-msgstr "a-steud"
-
-#: ../../standalone/drakxtv_.c:69
-msgid "Newzealand"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:70
-msgid "South Africa"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:71
-msgid "Argentina"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:72
-msgid "Australian Optus cable TV"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:107
-msgid ""
-"Please,\n"
-"type in your tv norm and country"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:109
-msgid "TV norm:"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:110
-msgid "Area:"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:114
-msgid "Scanning for TV channels in progress ..."
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:122
-msgid "Scanning for TV channels"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:125
-#, fuzzy
-msgid "There was an error while scanning for TV channels"
-msgstr "Ur fazi a zo bet en ur staliañ ar pakadoù :"
-
-#: ../../standalone/drakxtv_.c:126
-msgid "XawTV isn't installed!"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:129
-msgid "Have a nice day!"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:130
-msgid "Now, you can run xawtv (under X Window!) !\n"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:153
-msgid "No TV Card detected!"
-msgstr ""
-
-#: ../../standalone/drakxtv_.c:154
-msgid ""
-"No TV Card has been detected on your machine. Please verify that a Linux-"
-"supported Video/TV Card is correctly plugged in.\n"
-"\n"
-"\n"
-"You can visit our hardware database at:\n"
-"\n"
-"\n"
-"http://www.linux-mandrake.com/en/hardware.php3"
-msgstr ""
-
-#: ../../standalone/harddrake2_.c:8
-msgid ""
-"\n"
-"Usage: harddrake [-h|--help] [--test]\n"
-msgstr ""
-
-#: ../../standalone/keyboarddrake_.c:16
-msgid "usage: keyboarddrake [--expert] [keyboard]\n"
-msgstr ""
-
-#: ../../standalone/keyboarddrake_.c:32
-msgid "Please, choose your keyboard layout."
-msgstr "Dibabit reizhadur ho stokellaoueg, mar plij."
-
-#: ../../standalone/keyboarddrake_.c:41
-msgid "Do you want the BackSpace to return Delete in console?"
-msgstr ""
-
-#: ../../standalone/livedrake_.c:24
-#, fuzzy
-msgid "Change Cd-Rom"
-msgstr "Kemmañ ar spister"
-
-#: ../../standalone/livedrake_.c:25
-#, fuzzy
-msgid ""
-"Please insert the Installation Cd-Rom in your drive and press Ok when done.\n"
-"If you don't have it, press Cancel to avoid live upgrade."
-msgstr ""
-"Kemmit ho Cd-Rom!\n"
-"\n"
-"Lakait el lenner ar Cd-Rom warnañ an diketenn \"%s\" mar plij ha gwaskit Mat "
-"eo da c'houde.\n"
-"Ma n'emañ ket ganeoc'h gwaskit Nullañ evit chom hep staliañ ar Cd-Rom-se."
-
-#: ../../standalone/livedrake_.c:35
-msgid "Unable to start live upgrade !!!\n"
-msgstr ""
-
-#: ../../standalone/localedrake_.c:33
-msgid "The change is done, but to be effective you must logout"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:86 ../../ugtk.pm_.c:285
-msgid "logdrake"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:96
-msgid "Show only for the selected day"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:103
-#, fuzzy
-msgid "/File/_New"
-msgstr "Restroù :\n"
-
-#: ../../standalone/logdrake_.c:103
-msgid "<control>N"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:104
-msgid "/File/_Open"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:104
-msgid "<control>O"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:105
-msgid "/File/_Save"
-msgstr "/Restr/_Enrollañ"
-
-#: ../../standalone/logdrake_.c:105
-msgid "<control>S"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:106
-msgid "/File/Save _As"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:107
-msgid "/File/-"
-msgstr "/Restr/-"
-
-#: ../../standalone/logdrake_.c:109
-#, fuzzy
-msgid "/_Options"
-msgstr "Parzhadur"
-
-#: ../../standalone/logdrake_.c:110
-#, fuzzy
-msgid "/Options/Test"
-msgstr "Parzhadur"
-
-#: ../../standalone/logdrake_.c:112
-msgid "/Help/_About..."
-msgstr ""
-
-#: ../../standalone/logdrake_.c:119
-msgid "-misc-fixed-medium-r-*-*-*-100-*-*-*-*-*-*,*"
-msgstr "-misc-fixed-medium-r-*-*-*-100-*-*-*-*-*-*,*"
-
-#: ../../standalone/logdrake_.c:120
-msgid "-misc-fixed-bold-r-*-*-*-100-*-*-*-*-*-*,*"
-msgstr "-misc-fixed-bold-r-*-*-*-100-*-*-*-*-*-*,*"
-
-#: ../../standalone/logdrake_.c:174
-#, fuzzy
-msgid "User"
-msgstr "Anv arveriad"
-
-#: ../../standalone/logdrake_.c:175
-#, fuzzy
-msgid "Messages"
-msgstr "Amprouiñ ar porzhioù"
-
-#: ../../standalone/logdrake_.c:176
-msgid "Syslog"
-msgstr "Syslog"
-
-#: ../../standalone/logdrake_.c:177
-msgid "Mandrake Tools Explanations"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:180
-#, fuzzy
-msgid "search"
-msgstr "Klask"
-
-#: ../../standalone/logdrake_.c:186
-msgid "A tool to monitor your logs"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:187
-msgid "Settings"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:192
-#, fuzzy
-msgid "matching"
-msgstr "O vrasjediñ"
-
-#: ../../standalone/logdrake_.c:193
-msgid "but not matching"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:197
-#, fuzzy
-msgid "Choose file"
-msgstr "Dibabit un obererezh"
-
-#: ../../standalone/logdrake_.c:202
-msgid "Calendar"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:212
-#, fuzzy
-msgid "Content of the file"
-msgstr "Anv ar gevreadenn"
-
-#: ../../standalone/logdrake_.c:216 ../../standalone/logdrake_.c:392
-msgid "Mail alert"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:268
-#, fuzzy, c-format
-msgid "please wait, parsing file: %s"
-msgstr "O prientiñ ar staliadur"
-
-#: ../../standalone/logdrake_.c:409
-#, fuzzy
-msgid "Mail alert configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../standalone/logdrake_.c:410
-msgid ""
-"Welcome to the mail configuration utility.\n"
-"\n"
-"Here, you'll be able to set up the alert system.\n"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:417
-msgid "Apache World Wide Web Server"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:418
-#, fuzzy
-msgid "Domain Name Resolver"
-msgstr "Anv ar domani"
-
-#: ../../standalone/logdrake_.c:419
-#, fuzzy
-msgid "Ftp Server"
-msgstr "Servijer NIS"
-
-#: ../../standalone/logdrake_.c:420
-#, fuzzy
-msgid "Postfix Mail Server"
-msgstr "Stlennvonioù"
-
-#: ../../standalone/logdrake_.c:421
-#, fuzzy
-msgid "Samba Server"
-msgstr "Servijer NIS"
-
-#: ../../standalone/logdrake_.c:422
-#, fuzzy
-msgid "SSH Server"
-msgstr "Servijer NIS"
-
-#: ../../standalone/logdrake_.c:423
-#, fuzzy
-msgid "Webmin Service"
-msgstr "trobarzhell"
-
-#: ../../standalone/logdrake_.c:424
-#, fuzzy
-msgid "Xinetd Service"
-msgstr "Servijer moullañ"
-
-#: ../../standalone/logdrake_.c:431
-#, fuzzy
-msgid "service setting"
-msgstr "dedennus"
-
-#: ../../standalone/logdrake_.c:432
-msgid ""
-"You will receive an alert if one of the selected services is no more running"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:444
-#, fuzzy
-msgid "load setting"
-msgstr "O furmadiñ"
-
-#: ../../standalone/logdrake_.c:445
-msgid "You will receive an alert if the load is higher than this value"
-msgstr ""
-
-#: ../../standalone/logdrake_.c:458
-#, fuzzy
-msgid "alert configuration"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../standalone/logdrake_.c:459
-#, fuzzy
-msgid "Please enter your email address below "
-msgstr "Klaskit adarre mar plij"
-
-#: ../../standalone/logdrake_.c:498
-#, fuzzy
-msgid "Save as.."
-msgstr "Meuziad Lañsañ"
-
-#: ../../standalone/mousedrake_.c:45
-msgid "Please, choose the type of your mouse."
-msgstr "Dibabit seurt ho logodenn, mar plij."
-
-#: ../../standalone/mousedrake_.c:58
-msgid "Emulate third button?"
-msgstr "Kendarvan an trede nozelenn ?"
-
-#: ../../standalone/printerdrake_.c:57
-#, fuzzy
-msgid "Reading printer data ..."
-msgstr "Dibarzhoù ar voullerez lpd a-bell"
-
-#: ../../standalone/scannerdrake_.c:41
-#, fuzzy
-msgid "Detecting devices ..."
-msgstr "O tinoiñ trobarzhelloù..."
-
-#: ../../standalone/scannerdrake_.c:41
-msgid "Test ports"
-msgstr "Amprouiñ ar porzhioù"
-
-#: ../../standalone/scannerdrake_.c:53 ../../standalone/scannerdrake_.c:68
-#: ../../standalone/scannerdrake_.c:81
-#, c-format
-msgid "The %s is not supported by this version of Mandrake Linux."
-msgstr ""
-
-#: ../../standalone/scannerdrake_.c:56
-#, fuzzy, c-format
-msgid "%s found on %s, configure it?"
-msgstr "Mennout a rit kefluniañ ur voullerez ?"
-
-#: ../../standalone/scannerdrake_.c:59
-#, c-format
-msgid "%s is not in the scanner database, configure it manually?"
-msgstr ""
-
-#: ../../standalone/scannerdrake_.c:65
-#, fuzzy
-msgid "Select a scanner"
-msgstr "Diuzit ur gartenn c'hrafek"
-
-#: ../../standalone/scannerdrake_.c:93
-#, c-format
-msgid "This %s scanner is unsupported"
-msgstr ""
-
-#: ../../standalone/scannerdrake_.c:107
-#, c-format
-msgid ""
-"Scannerdrake was not able to detect your %s scanner.\n"
-"Please select the device where your scanner is plugged"
-msgstr ""
-
-#: ../../standalone/scannerdrake_.c:109
-#, fuzzy
-msgid "choose device"
-msgstr "Trobarzhell loc'hañ"
-
-#: ../../standalone/scannerdrake_.c:115
-#, c-format
-msgid ""
-"This %s scanner must be configured by printerdrake.\n"
-"You can launch printerdrake from the Mandrake Control Center in Hardware "
-"section."
-msgstr ""
-
-#: ../../standalone/scannerdrake_.c:120
-#, c-format
-msgid ""
-"Your %s scanner has been configured.\n"
-"You may now scan documents using ``XSane'' from Multimedia/Graphics in the "
-"applications menu."
-msgstr ""
-
-#: ../../standalone/service_harddrake_.c:44
-#, c-format
-msgid "Some devices in the \"%s\" hardware class were removed:\n"
-msgstr ""
-
-#: ../../standalone/service_harddrake_.c:48
-msgid "Some devices were added:\n"
-msgstr ""
-
-#: ../../steps.pm_.c:14
-msgid "Choose your language"
-msgstr "Dibabit ho yezh"
-
-#: ../../steps.pm_.c:15
-msgid "Select installation class"
-msgstr "Diuzit renkad ar staliadur"
-
-#: ../../steps.pm_.c:16
-msgid "Hard drive detection"
-msgstr "Dinoiñ ar bladenn galet"
-
-#: ../../steps.pm_.c:17
-msgid "Configure mouse"
-msgstr "Kefluniañ al logodenn"
-
-#: ../../steps.pm_.c:18
-msgid "Choose your keyboard"
-msgstr "Dibabit ho stokellaoueg"
-
-#: ../../steps.pm_.c:19
-#, fuzzy
-msgid "Security"
-msgstr "rodellek"
-
-#: ../../steps.pm_.c:20
-msgid "Setup filesystems"
-msgstr "Kefluniañ reizhiadoù restroù"
-
-#: ../../steps.pm_.c:21
-msgid "Format partitions"
-msgstr "Furmadiñ parzhadurioù"
-
-#: ../../steps.pm_.c:22
-msgid "Choose packages to install"
-msgstr "Dibabit pakadoù da staliañ"
-
-#: ../../steps.pm_.c:23
-msgid "Install system"
-msgstr "Staliañ ar reizhiad"
-
-#: ../../steps.pm_.c:25
-msgid "Add a user"
-msgstr "Ouzhpennañ un arveriad"
-
-#: ../../steps.pm_.c:26
-msgid "Configure networking"
-msgstr "Kefluniañ ur rouedad"
-
-#: ../../steps.pm_.c:28
-msgid "Configure services"
-msgstr "Kefluniañ servijoù"
-
-#: ../../steps.pm_.c:29
-msgid "Install bootloader"
-msgstr "Staliañ ar c'harger loc'hañ"
-
-#: ../../steps.pm_.c:31
-msgid "Create a bootdisk"
-msgstr "Krouiñ ur bladennig loc'hañ"
-
-#: ../../steps.pm_.c:33
-msgid "Configure X"
-msgstr "Kefluniañ X"
-
-#: ../../steps.pm_.c:34
-#, fuzzy
-msgid "Install system updates"
-msgstr "Staliañ ar reizhiad"
-
-#: ../../steps.pm_.c:35
-msgid "Exit install"
-msgstr "Dilezel ar staliadur"
-
-#: ../../ugtk.pm_.c:648
-msgid "-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*"
-msgstr "-adobe-times-bold-r-normal--17-*-100-100-p-*-iso8859-*,*-r-*"
-
-#: ../../share/compssUsers:999
-msgid "Web/FTP"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Network Computer (client)"
-msgstr "Dibarzhoù ar voullerez NetWare"
-
-#: ../../share/compssUsers:999
-msgid "NFS server, SMB server, Proxy server, ssh server"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Office"
-msgstr "Burev"
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Gnome Workstation"
-msgstr "Titouroù"
-
-#: ../../share/compssUsers:999
-msgid "Tools for your Palm Pilot or your Visor"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Workstation"
-msgstr "Titouroù"
-
-#: ../../share/compssUsers:999
-msgid "Firewall/Router"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Domain Name and Network Information Server"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid ""
-"Office programs: wordprocessors (kword, abiword), spreadsheets (kspread, "
-"gnumeric), pdf viewers, etc"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Audio-related tools: mp3 or midi players, mixers, etc"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Linux Standard Base. Third party applications support"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Books and Howto's on Linux and Free Software"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "KDE Workstation"
-msgstr "Titouroù"
-
-#: ../../share/compssUsers:999
-msgid "Icewm, Window Maker, Enlightenment, Fvwm, etc"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Multimedia - Video"
-msgstr "Liesvedia"
-
-#: ../../share/compssUsers:999
-msgid "Set of tools for mail, news, web, file transfer, and chat"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Database"
-msgstr "Stlennvonioù"
-
-#: ../../share/compssUsers:999
-msgid "PostgreSQL or MySQL database server"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Tools to ease the configuration of your computer"
-msgstr "Mennout a rit amprouiñ ar c'hefluniadur ?"
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Multimedia - Sound"
-msgstr "Liesvedia"
-
-#: ../../share/compssUsers:999
-msgid "Documentation"
-msgstr "Teuliadur"
-
-#: ../../share/compssUsers:999
-msgid "Console Tools"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Postfix mail server, Inn news server"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Internet station"
-msgstr "Kefluniañ ar proksioù"
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Multimedia station"
-msgstr "Liesvedia"
-
-#: ../../share/compssUsers:999
-msgid "Configuration"
-msgstr "Kefluniadur"
-
-#: ../../share/compssUsers:999
-msgid "More Graphical Desktops (Gnome, IceWM)"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid ""
-"The K Desktop Environment, the basic graphical environment with a collection "
-"of accompanying tools"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Graphical Environment"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Development"
-msgstr "Diorren"
-
-#: ../../share/compssUsers:999
-msgid "Apache, Pro-ftpd"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Tools to create and burn CD's"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Office Workstation"
-msgstr "Titouroù"
-
-#: ../../share/compssUsers:999
-msgid "Gnome, Icewm, Window Maker, Enlightenment, Fvwm, etc"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Graphics programs such as The Gimp"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "DNS/NIS "
-msgstr "DNS/NIS"
-
-#: ../../share/compssUsers:999
-msgid "C and C++ development libraries, programs and include files"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Network Computer server"
-msgstr "Dibarzhoù ar voullerez NetWare"
-
-#: ../../share/compssUsers:999
-msgid "Mail/Groupware/News"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Game station"
-msgstr "Teuliadur"
-
-#: ../../share/compssUsers:999
-msgid "Video players and editors"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Multimedia - Graphics"
-msgstr "Liesvedia"
-
-#: ../../share/compssUsers:999
-msgid "Amusement programs: arcade, boards, strategy, etc"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid ""
-"Set of tools to read and send mail and news (pine, mutt, tin..) and to "
-"browse the Web"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Personal Finance"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid ""
-"A graphical environment with user-friendly set of applications and desktop "
-"tools"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Clients for different protocols including ssh"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "LSB"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Internet gateway"
-msgstr "dedennus"
-
-#: ../../share/compssUsers:999
-msgid "Sound and video playing/editing programs"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Other Graphical Desktops"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Editors, shells, file tools, terminals"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Programs to manage your finance, such as gnucash"
-msgstr ""
-
-#: ../../share/compssUsers:999
-msgid "Personal Information Management"
-msgstr ""
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Multimedia - CD Burning"
-msgstr "Liesvedia"
-
-#: ../../share/compssUsers:999
-#, fuzzy
-msgid "Scientific Workstation"
-msgstr "Titouroù"
diff --git a/perl-install/standalone/drakboot b/perl-install/standalone/drakboot
index ade6207de..f2ed2b921 100755
--- a/perl-install/standalone/drakboot
+++ b/perl-install/standalone/drakboot
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use lib qw(/usr/lib/libDrakX);
+use MDK::Common;
use standalone; #- warning, standalone must be loaded very first, for 'explanations'
@@ -38,7 +39,13 @@ sub lilo_choice
{
my $bootloader = bootloader::read();
local ($_) = `detectloader`;
- $bootloader->{methods} = { lilo => 1, grub => !!/grub/i, if_(arch() =~ /ppc/, yaboot => 1) };
+ $bootloader->{methods} = {
+ if_(arch() =~ /ppc/, yaboot => 1),
+ if_(arch() =~ /sparc/, silo => 1),
+ if_(arch() =~ /ia64/, elilo => 1),
+ if_(arch() =~ /i.86|x86_64/, lilo => 1),
+ if_(arch() =~ /i.86/, grub => !!/grub/i)
+ };
my ($all_hds) = fsedit::get_hds();
my $fstab = [ fsedit::get_all_fstab($all_hds) ];
diff --git a/perl-install/steps.pm b/perl-install/steps.pm
index 162bc6d57..d62e8ddf5 100644
--- a/perl-install/steps.pm
+++ b/perl-install/steps.pm
@@ -27,7 +27,7 @@ use common;
summary => [ __("Summary"), 1, 0, '', "installPackages", 'summary' ],
configureServices => [ __("Configure services"), 1, 1, '!$::expert', "installPackages", 'services' ],
setupBootloader => [ __("Install bootloader"), 1, 0, '', "installPackages", 'bootloader' ],
-if_((arch() !~ /alpha/) && (arch() !~ /ppc/),
+if_((arch() !~ /alpha/) && (arch() !~ /ppc/) && (arch() !~ /ia64/),
createBootdisk => [ __("Create a bootdisk"), 1, 0, '', "installPackages", 'bootdisk' ],
),
configureX => [ __("Configure X"), 1, 1, '', ["formatPartitions", "setupBootloader"], 'X' ],
diff --git a/rescue/list b/rescue/list
index cac8181df..0214793e6 100644
--- a/rescue/list
+++ b/rescue/list
@@ -103,22 +103,22 @@
/etc/services
/bin/rpm
/sbin/mkraid
-/usr/LIB/rpm/rpmrc
-/usr/LIB/rpm/macros
-/usr/LIB/rpm/rpmpopt-4.0.4
+/usr/lib/rpm/rpmrc
+/usr/lib/rpm/macros
+/usr/lib/rpm/rpmpopt-4.0.4
/usr/bin/rpm2cpio
/usr/bin/rpmdb
-/usr/LIB/rpm/rpmd
+/usr/lib/rpm/rpmd
/usr/bin/rpme
-/usr/LIB/rpm/rpme
+/usr/lib/rpm/rpme
/usr/bin/rpmi
-/usr/LIB/rpm/rpmi
+/usr/lib/rpm/rpmi
/usr/bin/rpmu
-/usr/LIB/rpm/rpmu
+/usr/lib/rpm/rpmu
/usr/bin/rpmquery
-/usr/LIB/rpm/rpmq
+/usr/lib/rpm/rpmq
/usr/bin/rpmverify
-/usr/LIB/rpm/rpmv
+/usr/lib/rpm/rpmv
/usr/lib/perl5/PERL_VERSION/strict.pm
/usr/lib/perl5/PERL_VERSION/vars.pm
/usr/lib/perl5/PERL_VERSION/warnings/register.pm
diff --git a/rescue/list.ia64 b/rescue/list.ia64
index e200f0a3a..a6244154e 100644
--- a/rescue/list.ia64
+++ b/rescue/list.ia64
@@ -1,8 +1,12 @@
/usr/sbin/ext2resize
-/sbin/mkreiserfs
-/sbin/reiserfsck
/sbin/fsck.xfs
/sbin/xfs_repair
/sbin/sfdisk
/usr/sbin/efibootmgr
/usr/lib/perl5/PERL_VERSION/ia64-linux-thread-multi/CORE/libperl.so
+/usr/lib/perl5/vendor_perl/PERL_VERSION/packdrake.pm
+/sbin/mkreiserfs
+/sbin/reiserfsck
+/sbin/fsck.xfs
+/sbin/xfs_repair
+
diff --git a/rescue/list.x86_64 b/rescue/list.x86_64
index 0bd5c8b1b..7031c5999 100644
--- a/rescue/list.x86_64
+++ b/rescue/list.x86_64
@@ -1,5 +1,7 @@
/usr/sbin/ext2resize
/sbin/mkreiserfs
/sbin/reiserfsck
+/sbin/fsck.xfs
+/sbin/xfs_repair
/sbin/sfdisk
/usr/lib/perl5/PERL_VERSION/x86_64-linux-thread-multi/CORE/libperl.so
diff --git a/tools/Makefile b/tools/Makefile
index 244b23bd9..b3a17a636 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -3,7 +3,7 @@ DEST = $(ROOTDEST)/Mandrake/mdkinst
RPMS = $(wildcard $(ROOTDEST)/Mandrake/RPMS/*.rpm)
DIRS = ddcprobe serial_probe aewm-drakx
BASE = $(ROOTDEST)/Mandrake/base
-CFLAGS = -Wall
+CFLAGS = -Wall -Os
ARCH := $(shell arch | egrep "(x86_64|sparc64|s390x)")
ifneq ("x$(ARCH)", "x")
diff --git a/tools/aewm-drakx/client.c b/tools/aewm-drakx/client.c
index 8db6b2151..905fd4fbc 100644
--- a/tools/aewm-drakx/client.c
+++ b/tools/aewm-drakx/client.c
@@ -34,7 +34,7 @@ void set_focus_on(Window w)
* this property. Does this goof up on 64 bit systems? */
void set_wm_state(Client *c, int state)
{
- CARD32 data[2];
+ long data[2];
data[0] = state;
data[1] = None; /* Icon? We don't need no steenking icon. */
diff --git a/tools/aewm-drakx/misc.c b/tools/aewm-drakx/misc.c
index 9542c2cc3..fa0523534 100644
--- a/tools/aewm-drakx/misc.c
+++ b/tools/aewm-drakx/misc.c
@@ -25,6 +25,5 @@ int handle_xerror(Display *dpy, XErrorEvent *e)
XGetErrorText(dpy, e->error_code, msg, sizeof msg);
err("X error (%#lx): %s", e->resourceid, msg);
- if (c) remove_client(c);
return 0;
}