diff options
author | Mystery Man <unknown@mandriva.org> | 2002-08-01 17:20:30 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2002-08-01 17:20:30 +0000 |
commit | 10e8a05be15a93ecb30d80420a7df79a41df0b6f (patch) | |
tree | 0fe3a8fe9665e857dcea7c8d35b539ab0295a6fa /mdk-stage1/dietlibc | |
parent | 20bc98cdccfed607ee0c3050a3a3bd196c0a1d38 (diff) | |
download | drakx-10e8a05be15a93ecb30d80420a7df79a41df0b6f.tar drakx-10e8a05be15a93ecb30d80420a7df79a41df0b6f.tar.gz drakx-10e8a05be15a93ecb30d80420a7df79a41df0b6f.tar.bz2 drakx-10e8a05be15a93ecb30d80420a7df79a41df0b6f.tar.xz drakx-10e8a05be15a93ecb30d80420a7df79a41df0b6f.zip |
This commit was manufactured by cvs2svn to create tag 'V1_1_9_1mdk'.V1_1_9_1mdk
Diffstat (limited to 'mdk-stage1/dietlibc')
822 files changed, 0 insertions, 29357 deletions
diff --git a/mdk-stage1/dietlibc/.cvsignore b/mdk-stage1/dietlibc/.cvsignore deleted file mode 100644 index 7c88cb004..000000000 --- a/mdk-stage1/dietlibc/.cvsignore +++ /dev/null @@ -1,12 +0,0 @@ -t -elftrunc -mapfile -t1 -load -compile -bin-alpha -bin-arm -bin-i386 -bin-mips -bin-ppc -bin-sparc diff --git a/mdk-stage1/dietlibc/AUTHOR b/mdk-stage1/dietlibc/AUTHOR deleted file mode 100644 index 6d8ab1a05..000000000 --- a/mdk-stage1/dietlibc/AUTHOR +++ /dev/null @@ -1 +0,0 @@ -Felix von Leitner <felix-dietlibc@fefe.de> diff --git a/mdk-stage1/dietlibc/Makefile b/mdk-stage1/dietlibc/Makefile deleted file mode 100644 index b6e7b2783..000000000 --- a/mdk-stage1/dietlibc/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -ARCH=$(shell uname -m | sed 's/i[4-9]86/i386/') - -OBJDIR=bin-$(ARCH) - -all: $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/librpc.a $(OBJDIR)/diet - -CFLAGS=-pipe -CROSS= - -VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:librpc:libregex:syscalls.c - -SYSCALLOBJ=$(patsubst syscalls.s/%.S,$(OBJDIR)/%.o,$(wildcard syscalls.s/*.S)) - -LIBOBJ=$(patsubst lib/%.c,$(OBJDIR)/%.o,$(wildcard lib/*.c)) -LIBUGLYOBJ=$(patsubst libugly/%.c,$(OBJDIR)/%.o,$(wildcard libugly/*.c)) -LIBSTDIOOBJ=$(patsubst libstdio/%.c,$(OBJDIR)/%.o,$(wildcard libstdio/*.c)) -LIBCRUFTOBJ=$(patsubst libcruft/%.c,$(OBJDIR)/%.o,$(wildcard libcruft/*.c)) -LIBCRYPTOBJ=$(patsubst libcrypt/%.c,$(OBJDIR)/%.o,$(wildcard libcrypt/*.c)) -LIBSHELLOBJ=$(patsubst libshell/%.c,$(OBJDIR)/%.o,$(wildcard libshell/*.c)) - -LIBRPCOBJ=$(patsubst librpc/%.c,$(OBJDIR)/%.o,$(wildcard librpc/*.c)) -LIBREGEXOBJ=$(patsubst libregex/%.c,$(OBJDIR)/%.o,$(wildcard libregex/*.c)) - -include $(ARCH)/Makefile.add - -ifeq ($(CFLAGS),-pipe) -CFLAGS+=-O -fomit-frame-pointer -endif - -ifneq ($(DEBUG),) -CFLAGS = -g -COMMENT = : -endif -CFLAGS += -Wall -Wno-switch - -PWD=$(shell pwd) - -.SUFFIXES: -.SUFFIXES: .S .c - -$(OBJDIR): - mkdir $@ - -% :: %,v - -$(OBJDIR)/%.o: %.S - $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@ - -$(OBJDIR)/%.o: %.c - $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@ - $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@ - -DIETLIBC_OBJ = $(SYSCALLOBJ) $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \ -$(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) \ -$(OBJDIR)/__longjmp.o $(OBJDIR)/setjmp.o $(OBJDIR)/unified.o \ -$(OBJDIR)/mmap.o $(OBJDIR)/clone.o - -$(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o - $(CROSS)ar cru $@ $(DIETLIBC_OBJ) - -$(OBJDIR)/librpc.a: $(LIBRPCOBJ) - $(CROSS)ar cru $@ $(LIBRPCOBJ) - -LIBLATIN1_OBJS=$(patsubst liblatin1/%.c,$(OBJDIR)/%.o,$(wildcard liblatin1/*.c)) -$(OBJDIR)/liblatin1.a: $(LIBLATIN1_OBJS) - $(CROSS)ar cru $@ $^ - -$(OBJDIR)/libdietc.so: $(OBJDIR)/dietlibc.a - $(CROSS)ld -whole-archive -shared -o $@ $^ - -$(SYSCALLOBJ): syscalls.h - -$(OBJDIR)/diet: diet.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a - $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(PWD)\" - $(CROSS)strip -R .comment -R .note $@ - -$(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load - -$(OBJDIR)/compile: - echo 'exec gcc $(CFLAGS) -I$(PWD)/$(OBJDIR)/include -c $${1+"$$@"}' > $@ - chmod 755 $@ - -$(OBJDIR)/load: - echo 'main="$$1"; shift; exec gcc -nostdlib -o "$$main" $(PWD)/$(OBJDIR)/start.o "$$main".o $${1+"$$@"} $(PWD)/$(OBJDIR)/dietlibc.a -lgcc' > $@ - chmod 755 $@ - -clean: - rm -f *.o *.a t t1 compile load exports mapfile libdietc.so - rm -rf bin-* - -tar: clean - rm -f armv4l - ln -sf arm armv4l - cd ..; tar cvvf dietlibc.tar.bz2 dietlibc --use=bzip2 --exclude CVS - -$(OBJDIR)/exports: $(OBJDIR)/dietlibc.a - nm -g $(OBJDIR)/dietlibc.a | grep -w T | awk '{ print $$3 }' | sort -u > $(OBJDIR)/exports - -.PHONY: t t1 -t: - $(CROSS)$(CC) -g $(CFLAGS) -fno-builtin -nostdlib -Iinclude -o t t.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a -lgcc -Wl,-Map,mapfile - -t1: - $(CROSS)$(CC) -g -o t1 t.c - -install: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/diet - cp $(OBJDIR)/start.o $(INSTALLPREFIX)$(prefix)/lib/dietstart.o - cp $(OBJDIR)/dietlibc.a $(INSTALLPREFIX)$(prefix)/lib/libdietc.a - cp $(OBJDIR)/liblatin1.a $(INSTALLPREFIX)$(prefix)/lib/libdietlatin1.a - cp $(OBJDIR)/diet $(INSTALLPREFIX)$(prefix)/bin/diet - -.PHONY: sparc ppc mips arm alpha i386 - -arm sparc ppc alpha i386: - $(MAKE) ARCH=$@ CROSS=$@-linux- all t bin-$@/libdietc.so - -mips: - $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all t bin-$@/libdietc.so - -cross: - $(MAKE) arm sparc ppc alpha i386 mips - - -# these depend on dietfeatures.h for large file backward compatibility -$(OBJDIR)/__fstat64.o $(OBJDIR)/__lstat64.o $(OBJDIR)/__stat64.o: dietfeatures.h - -# these depend on dietfeatures.h for thread support -$(OBJDIR)/alloc.o $(OBJDIR)/perror.o $(OBJDIR)/logging.o $(OBJDIR)/unified.o: dietfeatures.h - -# these depend on dietfeatures.h for linker warnings -$(OBJDIR)/assert_fail.o $(OBJDIR)/sprintf.o $(OBJDIR)/vsnprintf.o $(OBJDIR)/___div.o $(OBJDIR)/fflush.o $(OBJDIR)/setvbuf.o $(OBJDIR)/system.o $(OBJDIR)/sendfile.o $(OBJDIR)/setenv.o: dietfeatures.h - -# these depend on dietfeatures.h for buffered stdio -fclose.o $(OBJDIR)/fdglue.o $(OBJDIR)/fflush.o $(OBJDIR)/fgetc.o $(OBJDIR)/fputc.o $(OBJDIR)/fread.o $(OBJDIR)/fseek.o $(OBJDIR)/printf.o $(OBJDIR)/setvbuf.o $(OBJDIR)/stderr.o $(OBJDIR)/stdin.o $(OBJDIR)/stdout.o $(OBJDIR)/fwrite.o $(OBJDIR)/puts.o: dietfeatures.h - -# these depend on dietfeatures.h for fast string routines -strcasecmp.o $(OBJDIR)/strcat.o $(OBJDIR)/strchr.o $(OBJDIR)/strcmp.o $(OBJDIR)/strcpy.o $(OBJDIR)/strlen.o $(OBJDIR)/strncasecmp.o $(OBJDIR)/strncat.o $(OBJDIR)/strrchr.o: dietfeatures.h - -# these depend on dietfeatures.h for /proc -$(OBJDIR)/tty.o: dietfeatures.h - -# these depend on dietfeatures.h for ungetc support ;-) -$(OBJDIR)/ungetc.o: dietfeatures.h - -# these depend on dietfeatures.h for WANT_TZFILE_PARSER -$(OBJDIR)/localtime_r.o: dietfeatures.h diff --git a/mdk-stage1/dietlibc/README b/mdk-stage1/dietlibc/README deleted file mode 100644 index ce9838832..000000000 --- a/mdk-stage1/dietlibc/README +++ /dev/null @@ -1,43 +0,0 @@ -diet libc to statically link programs that don't need all the bloat -from glibc. - -malloc, printf and scanf contributed from Olaf Dreesen. - -To compile: - - $ make - -make should compile the diet libc itself without warnings. In addition -to the diet libc, the default make target includes t, which is a test -program and probably contains code which produces warnings. You can -safely ignore them. - -When make is done, it will have created dietlibc.a in bin-i386 (or -bin-ppc, bin-alpha, bin-sparc, bin-ppc or bin-arm, depending on your -architecture). In that directory you will also find a program called -"diet", which you need to copy in a directory in your $PATH: - - # install bin-i386/diet /usr/local/bin - -Then you can compile programs by prepending diet to the command line, -i.e. - - $ diet gcc -s -Os -pipe -o t t.c - -diet is cross-compiler friendly and can also be used like this: - - $ diet sparc-linux-gcc -o t t.c - -diet will then link against dietlibc.a from bin-sparc, of course. -diet comes with a man page (diet.1), which you can copy to an -appropriate location, too: - - # cp diet.1 /usr/local/man/man1 - -After you compiled the diet libc successfully, I invite you to check out -the embedded utils (http://www.fefe.de/embutils/) and the diet libc -binary repository (ftp://foobar.math.fu-berlin.de/pub/dietlibc/), too. -The embedded utils are small replacements for common utilities like mv, -chown, ls, and even a small tar that can extract tar files. The binary -repository contains a few utilities I linked against the diet libc, for -example gzip, bzip2 and fdisk. diff --git a/mdk-stage1/dietlibc/alpha/Makefile.add b/mdk-stage1/dietlibc/alpha/Makefile.add deleted file mode 100644 index 10ff0faef..000000000 --- a/mdk-stage1/dietlibc/alpha/Makefile.add +++ /dev/null @@ -1,5 +0,0 @@ - -CFLAGS+=-Os -Iinclude -fomit-frame-pointer -fstrict-aliasing -VPATH:=alpha:syscalls.s:$(VPATH) - -LIBOBJ+=$(patsubst %,$(OBJDIR)/%,divq.o divl.o remq.o reml.o seteuid.o __time.o) diff --git a/mdk-stage1/dietlibc/alpha/__longjmp.S b/mdk-stage1/dietlibc/alpha/__longjmp.S deleted file mode 100644 index d86d76717..000000000 --- a/mdk-stage1/dietlibc/alpha/__longjmp.S +++ /dev/null @@ -1,38 +0,0 @@ -#ifdef __alpha__ - -#include <setjmp.h> - -.text -.align 2 - -.global __longjmp -__longjmp: - mov $17, $0 /* a1 -> v0 */ - - ldq $9, (JB_S0*8) ($16) /* s0 */ - ldq $10, (JB_S1*8) ($16) /* s1 */ - ldq $11, (JB_S2*8) ($16) /* s2 */ - ldq $12, (JB_S3*8) ($16) /* s3 */ - ldq $13, (JB_S4*8) ($16) /* s4 */ - ldq $14, (JB_S5*8) ($16) /* s5 */ - - ldq $26, (JB_PC*8) ($16) /* ra */ - ldq $fp, (JB_FP*8) ($16) /* fp */ - ldq $1, (JB_SP*8) ($16) /* sp */ - - ldt $f2, (JB_F2*8) ($16) /* f2 */ - ldt $f3, (JB_F3*8) ($16) /* f3 */ - ldt $f4, (JB_F4*8) ($16) /* f4 */ - ldt $f5, (JB_F5*8) ($16) /* f5 */ - ldt $f6, (JB_F6*8) ($16) /* f6 */ - ldt $f7, (JB_F7*8) ($16) /* f7 */ - ldt $f8, (JB_F8*8) ($16) /* f8 */ - ldt $f9, (JB_F9*8) ($16) /* f9 */ - - cmoveq $0, 0x1, $0 - mov $1, $sp - - ret $31, ($26), 1 - - -#endif diff --git a/mdk-stage1/dietlibc/alpha/__time.c b/mdk-stage1/dietlibc/alpha/__time.c deleted file mode 100644 index 07275e0e3..000000000 --- a/mdk-stage1/dietlibc/alpha/__time.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <time.h> -#include <sys/time.h> - -time_t time(time_t *foo) { - struct timeval tv; - time_t tmp=(time_t)-1; - if (gettimeofday(&tv,0)==0) - tmp=(time_t)tv.tv_sec; - if (foo) *foo=tmp; - return tmp; -} diff --git a/mdk-stage1/dietlibc/alpha/accept.S b/mdk-stage1/dietlibc/alpha/accept.S deleted file mode 100644 index 459c45d7a..000000000 --- a/mdk-stage1/dietlibc/alpha/accept.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(accept,accept,__libc_accept) diff --git a/mdk-stage1/dietlibc/alpha/bind.S b/mdk-stage1/dietlibc/alpha/bind.S deleted file mode 100644 index 86a04cb70..000000000 --- a/mdk-stage1/dietlibc/alpha/bind.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(bind,bind) diff --git a/mdk-stage1/dietlibc/alpha/clone.S b/mdk-stage1/dietlibc/alpha/clone.S deleted file mode 100644 index b7e32d707..000000000 --- a/mdk-stage1/dietlibc/alpha/clone.S +++ /dev/null @@ -1,42 +0,0 @@ -#include "syscalls.h" -#include <asm/errno.h> - -.text -.align 2 -.weak clone -clone: -.global __clone -.type __clone,@function -__clone: - ldiq $0, EINVAL - beq $16, .Lerror - beq $17, .Lerror - - subq $17, 16, $17 - stq $16, 0($17) - stq $19, 8($17) - mov $18, $16 - - lda $0, __NR_clone($31) - callsys - bne $19, .Lerror - - beq $0, .Lstart_thread - - ret $31, ($26), 0x01 - -.Lerror: - jmp error_unified_syscall - -.Lstart_thread: - clr $fp - - ldq $27, 0($sp) - ldq $16, 8($sp) - - jsr $26, ($27), 0x04 - - ldgp $gp, 0($26) - mov $0, $16 - jsr $26, exit - diff --git a/mdk-stage1/dietlibc/alpha/connect.S b/mdk-stage1/dietlibc/alpha/connect.S deleted file mode 100644 index c191ca808..000000000 --- a/mdk-stage1/dietlibc/alpha/connect.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(connect,connect,__libc_connect) diff --git a/mdk-stage1/dietlibc/alpha/divl.S b/mdk-stage1/dietlibc/alpha/divl.S deleted file mode 100644 index 3af22a5e8..000000000 --- a/mdk-stage1/dietlibc/alpha/divl.S +++ /dev/null @@ -1,101 +0,0 @@ -/* taken from glibc 2.2 */ - - .set noreorder - .set noat - - .ent __divlu - .globl __divlu - - .align 3 -__divlu : - lda $30 , - 48 ($30 ) - .frame $30 , 48 , $23 , 0 - .prologue 0 -.Ludiv: - stq $1 , 0($30 ) - zapnot $25 ,15, $1 - stq $2 , 8($30 ) - zapnot $24 ,15, $2 - stq $0 , 16($30 ) - clr $27 - stq $3 , 24($30 ) - ldiq $0 , 1 - stq $4 ,32($30 ) - beq $1 , .Ldivbyzero - - .align 3 - - -1: cmpult $1 , $2 , $at - s8addq $1 , $31 , $1 - s8addq $0 , $31 , $0 - bne $at , 1b - - - -3: addq $27 ,$0 , $4 - srl $0 , 1, $0 - cmpule $1 , $2 , $at - subq $2 , $1 , $3 - cmovne $at ,$4 , $27 - srl $1 , 1, $1 - cmovne $at , $3 , $2 - bne $0 , 3b - -.Ldone: ldq $1 , 0($30 ) - ldq $2 , 8($30 ) - ldq $0 , 16($30 ) - ldq $3 , 24($30 ) - ldq $4 ,32($30 ) - lda $30 , 48 ($30 ) - ret $31 , ($23 ), 1 - -.Ldivbyzero: - mov $16 , $3 - ldiq $16 , -2 - call_pal 170 - mov $3 , $16 - clr $27 - br .Ldone - - .end __divlu - - .ent __divl - .globl __divl - - .align 3 -__divl : - lda $30 , - 48 ($30 ) - .frame $30 , 48 , $23 , 0 - .prologue 0 - or $24 , $25 , $at - sextl $at , $at - bge $at , .Ludiv - - - stq $24 , 0($30 ) - negl $24 , $at - stq $25 , 8($30 ) - cmovge $at , $at , $24 - stq $23 , 16($30 ) - negl $25 , $at - stq $3 , 24($30 ) - cmovge $at , $at , $25 - - - bsr $23 , __divlu - - - ldq $24 , 0($30 ) - ldq $25 , 8($30 ) - xor $24 , $25 , $at - negl $27 , $3 - sextl $at , $at - ldq $23 , 16($30 ) - cmovlt $at , $3 , $27 - ldq $3 , 24($30 ) - - lda $30 , 48 ($30 ) - ret $31 , ($23 ), 1 - - .end __divl diff --git a/mdk-stage1/dietlibc/alpha/divq.S b/mdk-stage1/dietlibc/alpha/divq.S deleted file mode 100644 index cf70862c4..000000000 --- a/mdk-stage1/dietlibc/alpha/divq.S +++ /dev/null @@ -1,102 +0,0 @@ -/* taken from glibc 2.2 */ - - .set noreorder - .set noat - - .ent __divqu - .globl __divqu - - .align 3 -__divqu : - lda $30 , - 48 ($30 ) - .frame $30 , 48 , $23 , 0 - .prologue 0 -$udiv: - stq $1 , 0($30 ) - mov $25 , $1 - stq $2 , 8($30 ) - mov $24 , $2 - stq $0 , 16($30 ) - clr $27 - stq $3 , 24($30 ) - ldiq $0 , 1 - stq $4 ,32($30 ) - beq $1 , $divbyzero - - .align 3 - - -1: cmpult $1 , $2 , $at - blt $1 , 2f - addq $1 , $1 , $1 - addq $0 , $0 , $0 - bne $at , 1b - unop -2: -3: addq $27 ,$0 , $4 - srl $0 , 1, $0 - cmpule $1 , $2 , $at - subq $2 , $1 , $3 - cmovne $at ,$4 , $27 - srl $1 , 1, $1 - cmovne $at , $3 , $2 - bne $0 , 3b - -$done: ldq $1 , 0($30 ) - ldq $2 , 8($30 ) - ldq $0 , 16($30 ) - ldq $3 , 24($30 ) - ldq $4 ,32($30 ) - lda $30 , 48 ($30 ) - ret $31 , ($23 ), 1 - -$divbyzero: - mov $16 , $3 - ldiq $16 , -2 - call_pal 170 - mov $3 , $16 - clr $27 - br $done - - .end __divqu - - .ent __divq - .globl __divq - - .align 3 -__divq : - lda $30 , - 48 ($30 ) - .frame $30 , 48 , $23 , 0 - .prologue 0 - or $24 , $25 , $at - - bge $at , $udiv - - - stq $24 , 0($30 ) - negq $24 , $at - stq $25 , 8($30 ) - cmovge $at , $at , $24 - stq $23 , 16($30 ) - negq $25 , $at - stq $3 , 24($30 ) - cmovge $at , $at , $25 - - - bsr $23 , __divqu - - - ldq $24 , 0($30 ) - ldq $25 , 8($30 ) - xor $24 , $25 , $at - negq $27 , $3 - - ldq $23 , 16($30 ) - cmovlt $at , $3 , $27 - ldq $3 , 24($30 ) - - lda $30 , 48 ($30 ) - ret $31 , ($23 ), 1 - - .end __divq - diff --git a/mdk-stage1/dietlibc/alpha/getegid.S b/mdk-stage1/dietlibc/alpha/getegid.S deleted file mode 100644 index 89c35d45e..000000000 --- a/mdk-stage1/dietlibc/alpha/getegid.S +++ /dev/null @@ -1,11 +0,0 @@ -.text -.align 2 -.global getegid -getegid: - lda $sp,-8($sp) - stq $26, 0($sp) - jsr getgid - ldq $26, 0($sp) - lda $sp, 8($sp) - cmovge $0, $20, $0 - ret diff --git a/mdk-stage1/dietlibc/alpha/geteuid.S b/mdk-stage1/dietlibc/alpha/geteuid.S deleted file mode 100644 index 087ca7348..000000000 --- a/mdk-stage1/dietlibc/alpha/geteuid.S +++ /dev/null @@ -1,11 +0,0 @@ -.text -.align 2 -.global geteuid -geteuid: - lda $sp,-8($sp) - stq $26, 0($sp) - jsr getuid - ldq $26, 0($sp) - lda $sp, 8($sp) - cmovge $0, $20, $0 - ret diff --git a/mdk-stage1/dietlibc/alpha/getgid.S b/mdk-stage1/dietlibc/alpha/getgid.S deleted file mode 100644 index 7350082f3..000000000 --- a/mdk-stage1/dietlibc/alpha/getgid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getxgid,getgid) diff --git a/mdk-stage1/dietlibc/alpha/getpeername.S b/mdk-stage1/dietlibc/alpha/getpeername.S deleted file mode 100644 index 3b3f48b1a..000000000 --- a/mdk-stage1/dietlibc/alpha/getpeername.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getpeername,getpeername) diff --git a/mdk-stage1/dietlibc/alpha/getpid.S b/mdk-stage1/dietlibc/alpha/getpid.S deleted file mode 100644 index d8b3523b2..000000000 --- a/mdk-stage1/dietlibc/alpha/getpid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getxpid,getpid) diff --git a/mdk-stage1/dietlibc/alpha/getppid.S b/mdk-stage1/dietlibc/alpha/getppid.S deleted file mode 100644 index e181268c3..000000000 --- a/mdk-stage1/dietlibc/alpha/getppid.S +++ /dev/null @@ -1,11 +0,0 @@ -.text -.align 2 -.global getppid -getppid: - lda $sp,-8($sp) - stq $26, 0($sp) - jsr getpid - ldq $26, 0($sp) - lda $sp, 8($sp) - cmovge $0, $20, $0 - ret diff --git a/mdk-stage1/dietlibc/alpha/getsockname.S b/mdk-stage1/dietlibc/alpha/getsockname.S deleted file mode 100644 index 2727d88da..000000000 --- a/mdk-stage1/dietlibc/alpha/getsockname.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getsockname,getsockname) diff --git a/mdk-stage1/dietlibc/alpha/getsockopt.S b/mdk-stage1/dietlibc/alpha/getsockopt.S deleted file mode 100644 index 44b4a910a..000000000 --- a/mdk-stage1/dietlibc/alpha/getsockopt.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getsockopt,getsockopt) diff --git a/mdk-stage1/dietlibc/alpha/getuid.S b/mdk-stage1/dietlibc/alpha/getuid.S deleted file mode 100644 index fcb5570c2..000000000 --- a/mdk-stage1/dietlibc/alpha/getuid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getxuid,getuid) diff --git a/mdk-stage1/dietlibc/alpha/listen.S b/mdk-stage1/dietlibc/alpha/listen.S deleted file mode 100644 index 1102831d4..000000000 --- a/mdk-stage1/dietlibc/alpha/listen.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(listen,listen) diff --git a/mdk-stage1/dietlibc/alpha/mmap.S b/mdk-stage1/dietlibc/alpha/mmap.S deleted file mode 100644 index 2e57fbb74..000000000 --- a/mdk-stage1/dietlibc/alpha/mmap.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(mmap,mmap) diff --git a/mdk-stage1/dietlibc/alpha/msgctl.S b/mdk-stage1/dietlibc/alpha/msgctl.S deleted file mode 100644 index d7caed2cc..000000000 --- a/mdk-stage1/dietlibc/alpha/msgctl.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(msgctl,msgctl) diff --git a/mdk-stage1/dietlibc/alpha/msgget.S b/mdk-stage1/dietlibc/alpha/msgget.S deleted file mode 100644 index 518d67ac4..000000000 --- a/mdk-stage1/dietlibc/alpha/msgget.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(msgget,msgget) diff --git a/mdk-stage1/dietlibc/alpha/msgrcv.S b/mdk-stage1/dietlibc/alpha/msgrcv.S deleted file mode 100644 index ab62e6c30..000000000 --- a/mdk-stage1/dietlibc/alpha/msgrcv.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(msgrcv,msgrcv) diff --git a/mdk-stage1/dietlibc/alpha/msgsnd.S b/mdk-stage1/dietlibc/alpha/msgsnd.S deleted file mode 100644 index 890a996a2..000000000 --- a/mdk-stage1/dietlibc/alpha/msgsnd.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(msgsnd,msgsnd) diff --git a/mdk-stage1/dietlibc/alpha/pipe.S b/mdk-stage1/dietlibc/alpha/pipe.S deleted file mode 100644 index 3dfef10bf..000000000 --- a/mdk-stage1/dietlibc/alpha/pipe.S +++ /dev/null @@ -1,17 +0,0 @@ -#include "syscalls.h" - -.text -.align 2 -.global pipe -.type pipe,@function -pipe: - lda $0, __NR_pipe($31) - callsys - bne $19, .Lerror - stl $0, 0($16) - stl $20, 4($16) - clr $0 - ret $31, ($26), 0x01 -.Lerror: - br error_unified_syscall - diff --git a/mdk-stage1/dietlibc/alpha/recv.S b/mdk-stage1/dietlibc/alpha/recv.S deleted file mode 100644 index 17664f2e2..000000000 --- a/mdk-stage1/dietlibc/alpha/recv.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(recv,recv,__libc_recv) diff --git a/mdk-stage1/dietlibc/alpha/recvfrom.S b/mdk-stage1/dietlibc/alpha/recvfrom.S deleted file mode 100644 index d8e3922af..000000000 --- a/mdk-stage1/dietlibc/alpha/recvfrom.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(recvfrom,recvfrom,__libc_recvfrom) diff --git a/mdk-stage1/dietlibc/alpha/recvmsg.S b/mdk-stage1/dietlibc/alpha/recvmsg.S deleted file mode 100644 index 6ce87eebb..000000000 --- a/mdk-stage1/dietlibc/alpha/recvmsg.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(recvmsg,recvmsg) diff --git a/mdk-stage1/dietlibc/alpha/reml.S b/mdk-stage1/dietlibc/alpha/reml.S deleted file mode 100644 index 2d89e3280..000000000 --- a/mdk-stage1/dietlibc/alpha/reml.S +++ /dev/null @@ -1,101 +0,0 @@ -/* taken from glibc 2.2 */ - - .set noreorder - .set noat - - .ent __remlu - .globl __remlu - - .align 3 -__remlu : - lda $30 , -32($30) - .frame $30 , 32 , $23 , 0 - .prologue 0 -.Ludiv: - stq $1 , 0($30) - zapnot $25 , 15 , $1 - stq $2 , 8($30) - zapnot $24 , 15 , $27 - stq $0 , 16($30) - clr $2 - stq $3 , 24($30) - ldiq $0 , 1 - - beq $1 , .Ldivbyzero - - .align 3 - - -1: cmpult $1 , $27 , $at - s8addq $1 , $31 , $1 - s8addq $0 , $31 , $0 - bne $at , 1b - - - -3: - srl $0 , 1 , $0 - cmpule $1 , $27 , $at - subq $27 , $1 , $3 - - srl $1 , 1 , $1 - cmovne $at , $3 , $27 - bne $0 , 3b - -.Ldone: ldq $1 , 0($30) - ldq $2 , 8($30) - ldq $0 , 16($30) - ldq $3 , 24($30) - - lda $30 , 32($30) - ret $31 , ($23), 1 - -.Ldivbyzero: - mov $16 , $3 - ldiq $16 , -2 - call_pal 170 - mov $3 , $16 - clr $27 - br .Ldone - - .end __remlu - - .ent __reml - .globl __reml - - .align 3 -__reml : - lda $30 , - 32 ($30 ) - .frame $30 , 32 , $23 , 0 - .prologue 0 - or $24 , $25 , $at - sextl $at , $at - bge $at , .Ludiv - - - stq $24 , 0($30 ) - negl $24 , $at - stq $25 , 8($30 ) - cmovge $at , $at , $24 - stq $23 , 16($30 ) - negl $25 , $at - stq $3 , 24($30 ) - cmovge $at , $at , $25 - - - bsr $23 , __remlu - - - ldq $24 , 0($30 ) - ldq $25 , 8($30 ) - mov $24 , $at - negl $27 , $3 - sextl $at , $at - ldq $23 , 16($30 ) - cmovlt $at , $3 , $27 - ldq $3 , 24($30 ) - - lda $30 , 32 ($30 ) - ret $31 , ($23 ), 1 - - .end __reml diff --git a/mdk-stage1/dietlibc/alpha/remq.S b/mdk-stage1/dietlibc/alpha/remq.S deleted file mode 100644 index 713484da3..000000000 --- a/mdk-stage1/dietlibc/alpha/remq.S +++ /dev/null @@ -1,97 +0,0 @@ -/* taken from glibc 2.2 */ - - .set noreorder - .set noat - - .ent __remqu - .globl __remqu - - .align 3 -__remqu : - lda $30 , - 32 ($30 ) - .frame $30 , 32 , $23 , 0 - .prologue 0 -.Ludiv: - stq $1 , 0($30 ) - mov $25 , $1 - stq $2 , 8($30 ) - mov $24 , $27 - stq $0 , 16($30 ) - clr $2 - stq $3 , 24($30 ) - ldiq $0 , 1 - - beq $1 , .Ldivbyzero - - .align 3 - -1: cmpult $1 , $27 , $at - blt $1 , 2f - addq $1 , $1 , $1 - addq $0 , $0 , $0 - bne $at , 1b - unop -2: -3: - srl $0 , 1, $0 - cmpule $1 , $27 , $at - subq $27 , $1 , $3 - - srl $1 , 1, $1 - cmovne $at , $3 , $27 - bne $0 , 3b - -.Ldone: ldq $1 , 0($30 ) - ldq $2 , 8($30 ) - ldq $0 , 16($30 ) - ldq $3 , 24($30 ) - - lda $30 , 32 ($30 ) - ret $31 , ($23 ), 1 - -.Ldivbyzero: - mov $16 , $3 - ldiq $16 , -2 - call_pal 170 - mov $3 , $16 - clr $27 - br .Ldone - - .end __remqu - - .ent __remq - .globl __remq - - .align 3 -__remq : - lda $30 , - 32 ($30 ) - .frame $30 , 32 , $23 , 0 - .prologue 0 - or $24 , $25 , $at - - bge $at , .Ludiv - - stq $24 , 0($30 ) - negq $24 , $at - stq $25 , 8($30 ) - cmovge $at , $at , $24 - stq $23 , 16($30 ) - negq $25 , $at - stq $3 , 24($30 ) - cmovge $at , $at , $25 - - bsr $23 , __remqu - - ldq $24 , 0($30 ) - ldq $25 , 8($30 ) - mov $24 , $at - negq $27 , $3 - - ldq $23 , 16($30 ) - cmovlt $at , $3 , $27 - ldq $3 , 24($30 ) - - lda $30 , 32 ($30 ) - ret $31 , ($23 ), 1 - - .end __remq diff --git a/mdk-stage1/dietlibc/alpha/semctl.S b/mdk-stage1/dietlibc/alpha/semctl.S deleted file mode 100644 index e215ed955..000000000 --- a/mdk-stage1/dietlibc/alpha/semctl.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(semctl,semctl) diff --git a/mdk-stage1/dietlibc/alpha/semget.S b/mdk-stage1/dietlibc/alpha/semget.S deleted file mode 100644 index 67f488546..000000000 --- a/mdk-stage1/dietlibc/alpha/semget.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(semget,semget) diff --git a/mdk-stage1/dietlibc/alpha/semop.S b/mdk-stage1/dietlibc/alpha/semop.S deleted file mode 100644 index 81b6fc606..000000000 --- a/mdk-stage1/dietlibc/alpha/semop.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(semop,semop) diff --git a/mdk-stage1/dietlibc/alpha/send.S b/mdk-stage1/dietlibc/alpha/send.S deleted file mode 100644 index cfd11be2a..000000000 --- a/mdk-stage1/dietlibc/alpha/send.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(send,send,__libc_send) diff --git a/mdk-stage1/dietlibc/alpha/sendmsg.S b/mdk-stage1/dietlibc/alpha/sendmsg.S deleted file mode 100644 index 14646ad68..000000000 --- a/mdk-stage1/dietlibc/alpha/sendmsg.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sendmsg,sendmsg) diff --git a/mdk-stage1/dietlibc/alpha/sendto.S b/mdk-stage1/dietlibc/alpha/sendto.S deleted file mode 100644 index 17a033011..000000000 --- a/mdk-stage1/dietlibc/alpha/sendto.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(sendto,sendto,__libc_sendto) diff --git a/mdk-stage1/dietlibc/alpha/seteuid.c b/mdk-stage1/dietlibc/alpha/seteuid.c deleted file mode 100644 index a7cf47893..000000000 --- a/mdk-stage1/dietlibc/alpha/seteuid.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <sys/types.h> -#include <unistd.h> - -#undef seteuid -int seteuid(uid_t euid) { - return setreuid(-1,euid); -} diff --git a/mdk-stage1/dietlibc/alpha/setjmp.S b/mdk-stage1/dietlibc/alpha/setjmp.S deleted file mode 100644 index 3768056be..000000000 --- a/mdk-stage1/dietlibc/alpha/setjmp.S +++ /dev/null @@ -1,46 +0,0 @@ -#include <setjmp.h> - -.text -.global __sigsetjmp -__sigsetjmp: - ldgp $gp, 0($gp) - - mov $sp, $1 - lda $sp, -16($sp) - - stq $26, 0($sp) /* save ra */ - - stq $9, (JB_S0*8) ($16) /* s0 */ - stq $10, (JB_S1*8) ($16) /* s1 */ - stq $11, (JB_S2*8) ($16) /* s2 */ - stq $12, (JB_S3*8) ($16) /* s3 */ - stq $13, (JB_S4*8) ($16) /* s4 */ - stq $14, (JB_S5*8) ($16) /* s5 */ - - stq $26, (JB_PC*8) ($16) /* ra */ - stq $fp, (JB_FP*8) ($16) /* fp */ - stq $1, (JB_SP*8) ($16) /* sp */ - - stt $f2, (JB_F2*8) ($16) /* f2 */ - stt $f3, (JB_F3*8) ($16) /* f3 */ - stt $f4, (JB_F4*8) ($16) /* f4 */ - stt $f5, (JB_F5*8) ($16) /* f5 */ - stt $f6, (JB_F6*8) ($16) /* f6 */ - stt $f7, (JB_F7*8) ($16) /* f7 */ - stt $f8, (JB_F8*8) ($16) /* f8 */ - stt $f9, (JB_F9*8) ($16) /* f9 */ - - br $26, __sigjmp_save /* call __sigjmp_save */ - - ldq $26, 0($sp) /* restore ra */ - - lda $sp, 16($sp) - ret $31, ($26), 1 /* back to caller */ - -.weak setjmp -setjmp: -.weak __setjmp -__setjmp: - ldgp $gp, 0($gp) - mov 0, $17 - br __sigsetjmp diff --git a/mdk-stage1/dietlibc/alpha/setsockopt.S b/mdk-stage1/dietlibc/alpha/setsockopt.S deleted file mode 100644 index e3fe1d321..000000000 --- a/mdk-stage1/dietlibc/alpha/setsockopt.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setsockopt,setsockopt) diff --git a/mdk-stage1/dietlibc/alpha/shmat.S b/mdk-stage1/dietlibc/alpha/shmat.S deleted file mode 100644 index 51248173d..000000000 --- a/mdk-stage1/dietlibc/alpha/shmat.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(shmat,shmat) diff --git a/mdk-stage1/dietlibc/alpha/shmctl.S b/mdk-stage1/dietlibc/alpha/shmctl.S deleted file mode 100644 index d56caace4..000000000 --- a/mdk-stage1/dietlibc/alpha/shmctl.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(shmctl,shmctl) diff --git a/mdk-stage1/dietlibc/alpha/shmdt.S b/mdk-stage1/dietlibc/alpha/shmdt.S deleted file mode 100644 index d9812a799..000000000 --- a/mdk-stage1/dietlibc/alpha/shmdt.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(shmdt,shmdt) diff --git a/mdk-stage1/dietlibc/alpha/shmget.S b/mdk-stage1/dietlibc/alpha/shmget.S deleted file mode 100644 index 82914223f..000000000 --- a/mdk-stage1/dietlibc/alpha/shmget.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(shmget,shmget) diff --git a/mdk-stage1/dietlibc/alpha/shutdown.S b/mdk-stage1/dietlibc/alpha/shutdown.S deleted file mode 100644 index 9b5139325..000000000 --- a/mdk-stage1/dietlibc/alpha/shutdown.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(shutdown,shutdown) diff --git a/mdk-stage1/dietlibc/alpha/signal.S b/mdk-stage1/dietlibc/alpha/signal.S deleted file mode 100644 index ceca0f02d..000000000 --- a/mdk-stage1/dietlibc/alpha/signal.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(osf_signal,signal) diff --git a/mdk-stage1/dietlibc/alpha/sigprocmask.S b/mdk-stage1/dietlibc/alpha/sigprocmask.S deleted file mode 100644 index d9da836c2..000000000 --- a/mdk-stage1/dietlibc/alpha/sigprocmask.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(osf_sigprocmask,sigprocmask,__sigprocmask) diff --git a/mdk-stage1/dietlibc/alpha/socket.S b/mdk-stage1/dietlibc/alpha/socket.S deleted file mode 100644 index 85401f56e..000000000 --- a/mdk-stage1/dietlibc/alpha/socket.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(socket,socket) diff --git a/mdk-stage1/dietlibc/alpha/socketcall.S b/mdk-stage1/dietlibc/alpha/socketcall.S deleted file mode 100644 index b150bd5d5..000000000 --- a/mdk-stage1/dietlibc/alpha/socketcall.S +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" - -/* - * Doesn't exist on alpha ( accept, bind, ... are SYSCALLS !?! ) - */ diff --git a/mdk-stage1/dietlibc/alpha/start.S b/mdk-stage1/dietlibc/alpha/start.S deleted file mode 100644 index 00b8e950d..000000000 --- a/mdk-stage1/dietlibc/alpha/start.S +++ /dev/null @@ -1,35 +0,0 @@ -#include "start.h" - -#ifdef __alpha__ - -.text -.align 2 - .set noreorder - -.global __start -__start: -.global _start -_start: - clr $fp /* clear frame pointer */ - - br $gp,.Lstart /* set global pointer */ -.Lstart: - ldgp $gp, 0($gp) - -/* prepare to call main */ - ldl $16, 0($sp) /* argc */ - - lda $17, 8($sp) /* argv */ - - addq $16, 1, $18 /* argp */ - s8addq $18, $17, $18 /* (8*(argc+1))+argv -> argp */ - - stq $18, environ - - mov $0, $21 /* mov v0(dynload) to a5 */ - - jsr $26, main - mov $0, $16 - jsr $26, exit /* YES, CALL! for threads and atexit ! (+4 byte) */ - -#endif diff --git a/mdk-stage1/dietlibc/alpha/strlen.c b/mdk-stage1/dietlibc/alpha/strlen.c deleted file mode 100644 index ac532254a..000000000 --- a/mdk-stage1/dietlibc/alpha/strlen.c +++ /dev/null @@ -1,32 +0,0 @@ -#include <string.h> - -static const unsigned long long magic = 0x0101010101010101LL; - -size_t strlen(const char *s) -{ - const char *t = s; - unsigned long long word; - - if (!s) return 0; - - /* Byte compare up until 64 bit word boundary */ - for (; ((unsigned long long) t & 7); t++) - if (!*t) return t - s; - - /* Word compare */ - do { - word = *((unsigned long long *) t); t += 8; - word = (word - magic) &~ word; - word &= (magic << 7); - } while (word == 0); - - /* word & 0x8080808080808080 == word */ - word = (word - 1) & (magic << 8); - word += (word << 32); - word += (word << 16); - word += (word << 8); - t += word >> 56; - return ((const char *) t) - 8 - s; -} - - diff --git a/mdk-stage1/dietlibc/alpha/time.S b/mdk-stage1/dietlibc/alpha/time.S deleted file mode 100644 index e69de29bb..000000000 --- a/mdk-stage1/dietlibc/alpha/time.S +++ /dev/null diff --git a/mdk-stage1/dietlibc/alpha/unified.S b/mdk-stage1/dietlibc/alpha/unified.S deleted file mode 100644 index 02a1c9bcd..000000000 --- a/mdk-stage1/dietlibc/alpha/unified.S +++ /dev/null @@ -1,29 +0,0 @@ -#include <dietfeatures.h> - -.global __unified_syscall -__unified_syscall: - callsys - bne $19, .Lerror - ret $31, ($26), 0x01 - -.Lerror: -.global error_unified_syscall -error_unified_syscall: -#ifdef WANT_THREAD_SAVE - lda $sp, -16($sp) /* alloc 2 qwords on stack */ - stq $26, 0($sp) /* save ra to stack */ - stq $0, 8($sp) /* save v0 to stack */ - - jsr $26, __errno_location /* call __errno_location */ - - ldq $1, 8($sp) /* write old v0 to errno */ - stl $1, 0($0) - - lda $0, -1($31) /* new return value is -1 */ - ldq $26, 0($sp) /* restore return address */ - lda $sp, 16($sp) /* free 2 qwords on stack */ -#else - lda $1, errno - stl $0, 0($1) -#endif - ret $31, ($26), 0x01 /* return */ diff --git a/mdk-stage1/dietlibc/alpha/utime.S b/mdk-stage1/dietlibc/alpha/utime.S deleted file mode 100644 index a9a8aada6..000000000 --- a/mdk-stage1/dietlibc/alpha/utime.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(utimes,utime) diff --git a/mdk-stage1/dietlibc/alpha/waitpid.S b/mdk-stage1/dietlibc/alpha/waitpid.S deleted file mode 100644 index 6dc1c99db..000000000 --- a/mdk-stage1/dietlibc/alpha/waitpid.S +++ /dev/null @@ -1,10 +0,0 @@ -#include <syscalls.h> - -.text -.align 2 -.weak waitpid -waitpid: -.global __libc_waitpid -__libc_waitpid: - clr $19 - br wait4 diff --git a/mdk-stage1/dietlibc/diet.c b/mdk-stage1/dietlibc/diet.c deleted file mode 100644 index 1de6befc8..000000000 --- a/mdk-stage1/dietlibc/diet.c +++ /dev/null @@ -1,112 +0,0 @@ -#include <string.h> -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> - -/* goal: - * when invoked as - * "diet gcc -c t.c" - * exec - * "gcc -I/path/to/dietlibc/include -c t.c" - * - * when invoked as - * "diet sparc-linux-gcc -o t t.o" - * exec - * "sparc-linux-gcc -nostdlib -static -o t t.o /path/to/dietlibc/bin-sparc/start.o /path/to/dietlibc/bin-sparc/dietlibc.a" -*/ - -void error(const char *message) { - write(2,message,strlen(message)); - exit(1); -} - -int main(int argc,char *argv[]) { - int link=0; - int compile=0; - char diethome[]=DIETHOME; - char platform[1000]=DIETHOME "/bin-"; - char *nostdlib="-nostdlib"; - char *libgcc="-lgcc"; - char dashL[1000]="-L"; - int i; - - if (argc<2) { - error("usage: diet [gcc command line]\n" - "e.g. diet gcc -c t.c\n" - "or diet sparc-linux-gcc -o foo foo.c bar.o\n"); - } - { - char *tmp=strchr(argv[1],0)-2; - char *tmp2; - char *cc=argv[1]; - if (tmp<cc) goto donttouch; - if ((tmp2=strchr(cc,'-'))) { /* cross compiling? */ - int len=strlen(platform); - if (tmp2-cc>90) error("platform name too long!\n"); - memmove(platform+len,argv[1],tmp2-cc); - platform[tmp2-cc+len]=0; -/* printf("found platform %s\n",platform); */ - } else { -#ifdef __sparc__ - strcat(platform,"sparc"); -#endif -#ifdef __ppc__ - strcat(platform,"ppc"); -#endif -#ifdef __i386__ - strcat(platform,"i386"); -#endif -#ifdef __alpha__ - strcat(platform,"alpha"); -#endif -#ifdef __arm__ - strcat(platform,"arm"); -#endif -#ifdef __mips__ - strcat(platform,"mips"); -#endif - } - strcat(dashL,platform); - if (!strcmp(tmp,"cc")) { - char **newargv; - char **dest; - char *a,*b,*c; -/* we need to add -I... if the command line contains -c, -S or -E */ - for (i=2; i<argc; ++i) - if (!strcmp(argv[i],"-c") || !strcmp(argv[i],"-S") || !strcmp(argv[i],"-E")) - compile=1; -/* we need to add -nostdlib if we are not compiling*/ - link=!compile; -#if 0 - for (i=2; i<argc; ++i) - if (!strcmp(argv[i],"-o")) - if (!compile) link=1; -#endif - newargv=alloca(sizeof(char*)*(argc+6)); - a=alloca(strlen(diethome)+20); - b=alloca(strlen(platform)+20); - c=alloca(strlen(platform)+20); - - strcpy(a,"-I"); strcat(a,diethome); strcat(a,"/include"); - strcpy(b,platform); strcat(b,"/start.o"); - strcpy(c,platform); strcat(c,"/dietlibc.a"); - - dest=newargv; - *dest++=argv[1]; - if (link) { *dest++=nostdlib; *dest++=dashL; } - if (compile || link) *dest++=a; - for (i=2; i<argc; ++i) - *dest++=argv[i]; - if (link) { *dest++=b; *dest++=c; *dest++=libgcc; } - *dest=0; - execvp(newargv[0],newargv); - goto error; - } else if (!strcmp(tmp,"ld")) { - } - } -donttouch: - execvp(argv[1],argv+1); -error: - error("execvp failed!\n"); - return 1; -} diff --git a/mdk-stage1/dietlibc/dietdirent.h b/mdk-stage1/dietlibc/dietdirent.h deleted file mode 100644 index d732cf7dc..000000000 --- a/mdk-stage1/dietlibc/dietdirent.h +++ /dev/null @@ -1,6 +0,0 @@ -struct __dirstream { - int fd; - char buf[1024]; - unsigned int num; - unsigned int cur; -}; /* stream data from opendir() */ diff --git a/mdk-stage1/dietlibc/dietfeatures.h b/mdk-stage1/dietlibc/dietfeatures.h deleted file mode 100644 index e1de38577..000000000 --- a/mdk-stage1/dietlibc/dietfeatures.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _DIETFEATURES_H -#define _DIETFEATURES_H - -/* feel free to comment some of these out to reduce code size */ - -//#define WANT_FLOATING_POINT_IN_PRINTF -//#define WANT_FLOATING_POINT_IN_SCANF -#define WANT_CHARACTER_CLASSES_IN_SCANF -#define WANT_NULL_PRINTF - -#define SLASH_PROC_OK - -// #define WANT_BUFFERED_STDIO - -/* use errno_location instead of errno */ -// #define WANT_THREAD_SAFE - -/* make the startcode, etc. dynamic aware */ -/* #undef WANT_DYNAMIC */ - -/* do you want smaller or faster string routines? */ -/* #define WANT_FASTER_STRING_ROUTINES */ - -/* do you want ungetc? makes fgetc more complex */ -#define WANT_UNGETC - -// #define WANT_LINKER_WARNINGS - -/* you need to define this if you want to run your programs with large - * file support on kernel 2.2 or 2.4 */ -// #define WANT_LARGEFILE_BACKCOMPAT - -/* do you want localtime(3) to read /etc/localtime? - * Needed for daylight saving time etc. */ -// #define WANT_TZFILE_PARSER - -/* stop uncommenting here ;-) */ -#ifndef WANT_FASTER_STRING_ROUTINES -#define WANT_SMALL_STRING_ROUTINES -#endif - -#endif diff --git a/mdk-stage1/dietlibc/dietstdarg.h b/mdk-stage1/dietlibc/dietstdarg.h deleted file mode 100644 index 827671b22..000000000 --- a/mdk-stage1/dietlibc/dietstdarg.h +++ /dev/null @@ -1,12 +0,0 @@ -#include <stdarg.h> - -/* this assumes that va_copy() will be a macro, it is on gcc */ -#ifndef va_copy -# ifdef __va_copy -# define va_copy(x, y) __va_copy(x, y) -# else -/* assume copying it works... */ -# define va_copy(x, y) x = y -# endif -#endif - diff --git a/mdk-stage1/dietlibc/dietstdio.h b/mdk-stage1/dietlibc/dietstdio.h deleted file mode 100644 index a1cbeba83..000000000 --- a/mdk-stage1/dietlibc/dietstdio.h +++ /dev/null @@ -1,81 +0,0 @@ -/* diet stdio -- no buffering ;-} */ - -#include "dietfeatures.h" -#include <sys/types.h> -#ifdef WANT_THREAD_SAVE -#include <pthread.h> -#endif - -#define BUFSIZE 128 - -typedef struct __file { - int fd; - int flags; -#ifdef WANT_BUFFERED_STDIO - unsigned int bs; /* read: bytes in buffer */ - unsigned int bm; /* position in buffer */ - char buf[BUFSIZE]; - struct __file *next; /* for fflush */ -#endif - pid_t popen_kludge; -#ifdef WANT_UNGETC - char ungetbuf; - char ungotten; -#endif -#ifdef WANT_THREAD_SAVE - pthread_mutex_t m; -#endif -} FILE; - -extern FILE *__stdio_root; - -#define ERRORINDICATOR 1 -#define EOFINDICATOR 2 -#define BUFINPUT 4 -#define BUFLINEWISE 8 -#define NOBUF 16 -#define UNSEEKABLE 32 - -#define _IONBF 0 -#define _IOLBF 1 -#define _IOFBF 2 - -/* internal function to flush buffer. - * However, if next is BUFINPUT and the buffer is an input buffer, it - * will not be flushed. Vice versa for output */ -extern int __fflush4(FILE *stream,int next); - -FILE *fopen (const char *path, const char *mode); -FILE *fdopen (int fildes, const char *mode); -FILE *freopen (const char *path, const char *mode, FILE *stream); - -int fgetc(FILE *stream); -char *fgets(char *s, int size, FILE *stream); -int getc(FILE *stream); -int getchar(void); -char *gets(char *s); -int ungetc(int c, FILE *stream); - -int fputc(int c, FILE *stream); -int fputs(const char *s, FILE *stream); -int putc(int c, FILE *stream); -int putchar(int c); -int puts(const char *s); - -long fseek( FILE *stream, long offset, int whence); -long ftell( FILE *stream); -void rewind( FILE *stream); -int fgetpos( FILE *stream, fpos_t *pos); -int fsetpos( FILE *stream, fpos_t *pos); - -size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream); - -size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream); - -int fflush(FILE *stream); - -int fclose(FILE *stream); - -extern FILE *stdout, *stderr, *stdin; - -#define EOF (int)(-1) diff --git a/mdk-stage1/dietlibc/dietwarning.h b/mdk-stage1/dietlibc/dietwarning.h deleted file mode 100644 index f7c67a175..000000000 --- a/mdk-stage1/dietlibc/dietwarning.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LINKER_WARNINGS - -#ifndef __ASSEMBLER__ - -#define link_warning(symbol,msg) \ - asm (".section .gnu.warning." symbol "\n\t.string \"" msg "\"\n\t.previous"); - -#else - -#define link_warning(symbol,msg) \ - .section .gnu.warning.##symbol ;\ - .string msg ;\ - .previous - -#endif - -#else - -#define link_warning(foo,bar) - -#endif diff --git a/mdk-stage1/dietlibc/dirstream.h b/mdk-stage1/dietlibc/dirstream.h deleted file mode 100644 index dc8fba79c..000000000 --- a/mdk-stage1/dietlibc/dirstream.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -/* - * POSIX Standard: 5.1.2 Directory Operations <dirent.h> - */ - -#ifndef _DIRSTREAM_H - -#define _DIRSTREAM_H 1 - -#include <sys/types.h> -#include <dirent.h> -#ifdef _POSIX_THREADS -#include <pthread.h> -#endif - -/* For now, syscall readdir () only supports one entry at a time. It - * will be changed in the future. -#define NUMENT 3 -*/ -#ifndef NUMENT -#define NUMENT 1 -#endif - -#define SINGLE_READDIR 11 -#define MULTI_READDIR 12 -#define NEW_READDIR 13 - -/* Directory stream type. */ -struct __dirstream { - /* file descriptor */ - int dd_fd; - - /* offset of the next dir entry in buffer */ - off_t dd_nextloc; - - /* bytes of valid entries in buffer */ - size_t dd_size; - - /* -> directory buffer */ - struct dirent *dd_buf; - - /* we have to convert */ - struct dirent convbuf; - - /* offset of the next dir entry in directory. */ - off_t dd_nextoff; - - /* total size of buffer */ - size_t dd_max; - - enum {unknown, have_getdents, no_getdents} dd_getdents; - - /* lock */ -#ifdef _POSIX_THREADS - pthread_mutex_t *dd_lock; -#else - void *dd_lock; -#endif -}; /* stream data from opendir() */ - -#endif /* dirent.h */ diff --git a/mdk-stage1/dietlibc/i386/Makefile.add b/mdk-stage1/dietlibc/i386/Makefile.add deleted file mode 100644 index b685cc360..000000000 --- a/mdk-stage1/dietlibc/i386/Makefile.add +++ /dev/null @@ -1,3 +0,0 @@ - -CFLAGS+=-march=i386 -mcpu=i386 -Os -fomit-frame-pointer -VPATH:=i386:syscalls.s:$(VPATH) diff --git a/mdk-stage1/dietlibc/i386/__longjmp.S b/mdk-stage1/dietlibc/i386/__longjmp.S deleted file mode 100644 index 098275037..000000000 --- a/mdk-stage1/dietlibc/i386/__longjmp.S +++ /dev/null @@ -1,18 +0,0 @@ -#include <setjmp.h> - -.text -.global __longjmp -__longjmp: - movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */ - movl 8(%esp), %eax /* Second argument is return value. */ - /* Save the return address now. */ - movl (JB_PC*4)(%ecx), %edx - /* Restore registers. */ - movl (JB_BX*4)(%ecx), %ebx - movl (JB_SI*4)(%ecx), %esi - movl (JB_DI*4)(%ecx), %edi - movl (JB_BP*4)(%ecx), %ebp - movl (JB_SP*4)(%ecx), %esp - /* Jump to saved PC. */ - jmp *%edx -.size __longjmp,.-__longjmp; diff --git a/mdk-stage1/dietlibc/i386/__testandset.S b/mdk-stage1/dietlibc/i386/__testandset.S deleted file mode 100644 index af7b4d5a0..000000000 --- a/mdk-stage1/dietlibc/i386/__testandset.S +++ /dev/null @@ -1,8 +0,0 @@ -.text -.global __testandset -__testandset: - xorl %eax, %eax - movl 0x4(%esp),%edx - incl %eax - xchgl %eax,(%edx) - ret diff --git a/mdk-stage1/dietlibc/i386/clone.S b/mdk-stage1/dietlibc/i386/clone.S deleted file mode 100644 index ac02eb468..000000000 --- a/mdk-stage1/dietlibc/i386/clone.S +++ /dev/null @@ -1,51 +0,0 @@ -#include <asm/unistd.h> - -.text -.weak clone -clone: -.global __clone -__clone: - movl 4(%esp), %ecx /* have non null thread_funcion */ - testl %ecx, %ecx - je .Lclone_error - - movl 8(%esp), %ecx /* have non null child_stack pointer */ - testl %ecx, %ecx - je .Lclone_error - - /* put the parameter on thread stack */ - subl $8, %ecx - - movl 16(%esp), %eax /* arg */ - movl %eax, 4(%ecx) - - movl 4(%esp), %eax /* thread_func */ - movl %eax, 0(%ecx) - - /* the syscall */ - pushl %ebx - movl 16(%esp), %ebx /* flags */ - movl $__NR_clone, %eax - int $0x80 - popl %ebx - - testl %eax, %eax - jl .Lclone_error - je .Lstart_thread - ret - -.Lstart_thread: - xorl %ebp,%ebp - call *%ebx - pushl %eax - call _exit - -.Lclone_error: - negl %eax - pushl %eax - call __errno_location - popl %ecx - movl %ecx, (%eax) - xorl %eax, %eax - decl %eax - ret diff --git a/mdk-stage1/dietlibc/i386/mmap.c b/mdk-stage1/dietlibc/i386/mmap.c deleted file mode 100644 index 26ecb55c0..000000000 --- a/mdk-stage1/dietlibc/i386/mmap.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <linux/types.h> -#include <linux/unistd.h> - -#define __NR__mmap __NR_mmap -_syscall1(int,_mmap,unsigned long *,buffer) - -char *mmap(char *addr, size_t len, int prot, int flags, int fd, unsigned long off) { - unsigned long buffer[6]; - buffer[0] = (unsigned long)addr; - buffer[1] = (unsigned long)len; - buffer[2] = (unsigned long)prot; - buffer[3] = (unsigned long)flags; - buffer[4] = (unsigned long)fd; - buffer[5] = (unsigned long)off; - return (char*) _mmap(buffer); -} diff --git a/mdk-stage1/dietlibc/i386/select.S b/mdk-stage1/dietlibc/i386/select.S deleted file mode 100644 index 9e7066eae..000000000 --- a/mdk-stage1/dietlibc/i386/select.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(_newselect,select,__libc_select) diff --git a/mdk-stage1/dietlibc/i386/setjmp.S b/mdk-stage1/dietlibc/i386/setjmp.S deleted file mode 100644 index 9bfecf565..000000000 --- a/mdk-stage1/dietlibc/i386/setjmp.S +++ /dev/null @@ -1,62 +0,0 @@ -#include <setjmp.h> - -/* setjmp for i386. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -.section .rodata -.text -.weak setjmp -setjmp: -.globl __setjmp -__setjmp: - popl %eax /* Pop return address. */ - popl %ecx /* Pop jmp_buf. */ - pushl $0 /* Push zero argument. */ - pushl %ecx /* Push jmp_buf. */ - pushl %eax /* Push back return address. */ - -.globl __sigsetjmp -__sigsetjmp: - movl 4(%esp), %eax /* User's jmp_buf in %eax. */ - /* Save registers. */ - movl %ebx, (JB_BX*4)(%eax) - movl %esi, (JB_SI*4)(%eax) - movl %edi, (JB_DI*4)(%eax) - movl %ebp, (JB_BP*4)(%eax) - leal 4(%esp), %ecx /* Save SP as it will be after we return. */ - movl %ecx, (JB_SP*4)(%eax) - movl 0(%esp), %ecx /* Save PC we are returning to now. */ - movl %ecx, (JB_PC*4)(%eax) - - /* Make a tail call to __sigjmp_save; it takes the same args. */ -#ifdef PIC - /* We cannot use the PLT, because it requires that %ebx be set, but - we can't save and restore our caller's value. Instead, we do an - indirect jump through the GOT, using for the temporary register - %ecx, which is call-clobbered. */ - call L(here) -L(here): - popl %ecx - addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ecx - movl C_SYMBOL_NAME(__sigjmp_save@GOT)(%ecx), %ecx - jmp *%ecx -#else - jmp __sigjmp_save -#endif -.size __sigsetjmp,.-__sigsetjmp; diff --git a/mdk-stage1/dietlibc/i386/start.S b/mdk-stage1/dietlibc/i386/start.S deleted file mode 100644 index 167bb779c..000000000 --- a/mdk-stage1/dietlibc/i386/start.S +++ /dev/null @@ -1,42 +0,0 @@ -#include "start.h" - -#ifdef __i386__ -.text -.globl _start -_start: -#if 0 - popl %ecx - movl %esp, %esi - leal 4(%esp,%ecx,4),%eax -#else - movl (%esp),%ecx /* %ecx = argc */ - leal 4(%esp),%esi /* %esi = argv */ - - leal 4(%esi,%ecx,4),%eax /* eax = 4*ecx+4 = envp */ -#endif - pushl %eax - pushl %esi - pushl %ecx - movl %eax,environ - -#ifdef WANT_DYNAMIC -/* in %edx we have the dynamic _fini ( register this if non null ) */ - test %edx, %edx - je .Linit - push %edx - call atexit - pop %edx -.Linit: - call _init - push $_fini - call atexit - pop %edx -#endif - - call main - pushl %eax - call exit -.Lfefe: - .size _start,.Lfefe-_start -#endif - diff --git a/mdk-stage1/dietlibc/i386/unified.S b/mdk-stage1/dietlibc/i386/unified.S deleted file mode 100644 index f182bdb4b..000000000 --- a/mdk-stage1/dietlibc/i386/unified.S +++ /dev/null @@ -1,34 +0,0 @@ -#include <dietfeatures.h> - -.text -.global __unified_syscall -__unified_syscall: - movzbl %al, %eax - push %edi - push %esi - push %ebx - movl %esp,%edi - movl 0x10(%edi),%ebx - movl 0x14(%edi),%ecx - movl 0x18(%edi),%edx - movl 0x1c(%edi),%esi - movl 0x20(%edi),%edi - int $0x80 - cmp $-124,%eax - jbe .Lnoerror -#ifdef WANT_THREAD_SAVE - movl %eax,%ebx - call __errno_location - neg %ebx - movl %ebx,(%eax) -#else - neg %eax - mov %eax,errno -#endif - xor %eax,%eax - dec %eax -.Lnoerror: - pop %ebx - pop %esi - pop %edi - ret diff --git a/mdk-stage1/dietlibc/include/alloca.h b/mdk-stage1/dietlibc/include/alloca.h deleted file mode 100644 index e69de29bb..000000000 --- a/mdk-stage1/dietlibc/include/alloca.h +++ /dev/null diff --git a/mdk-stage1/dietlibc/include/arpa/inet.h b/mdk-stage1/dietlibc/include/arpa/inet.h deleted file mode 100644 index 6d5a6dc35..000000000 --- a/mdk-stage1/dietlibc/include/arpa/inet.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _ARPA_INET_H -#define _ARPA_INET_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <netinet/in.h> - -int inet_aton(const char *cp, struct in_addr *inp) __THROW; -unsigned long int inet_addr(const char *cp) __THROW; -unsigned long int inet_network(const char *cp) __THROW; -char *inet_ntoa(struct in_addr in) __THROW; -struct in_addr inet_makeaddr(int net, int host) __THROW; -unsigned long int inet_lnaof(struct in_addr in) __THROW; -unsigned long int inet_netof(struct in_addr in) __THROW; - -int inet_pton (int AF, const char* CP, void* BUF) __THROW; -const char* inet_ntop (int AF, const void* CP, char* BUF, size_t LEN) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/arpa/nameser.h b/mdk-stage1/dietlibc/include/arpa/nameser.h deleted file mode 100644 index 1ee048d66..000000000 --- a/mdk-stage1/dietlibc/include/arpa/nameser.h +++ /dev/null @@ -1,217 +0,0 @@ -#ifndef _ARPA_NAMESER_H -#define _ARPA_NAMESER_H - -#include <endian.h> - -#define NS_PACKETSZ 512 /* maximum packet size */ -#define NS_MAXDNAME 1025 /* maximum domain name */ -#define NS_MAXCDNAME 255 /* maximum compressed domain name */ -#define NS_MAXLABEL 63 /* maximum length of domain label */ -#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ -#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ -#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ -#define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */ -#define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */ -#define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */ -#define NS_INADDRSZ 4 /* IPv4 T_A */ -#define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ -#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ -#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ - -/* - * Currently defined type values for resources and queries. - */ -typedef enum __ns_type { - ns_t_invalid = 0, /* Cookie. */ - ns_t_a = 1, /* Host address. */ - ns_t_ns = 2, /* Authoritative server. */ - ns_t_md = 3, /* Mail destination. */ - ns_t_mf = 4, /* Mail forwarder. */ - ns_t_cname = 5, /* Canonical name. */ - ns_t_soa = 6, /* Start of authority zone. */ - ns_t_mb = 7, /* Mailbox domain name. */ - ns_t_mg = 8, /* Mail group member. */ - ns_t_mr = 9, /* Mail rename name. */ - ns_t_null = 10, /* Null resource record. */ - ns_t_wks = 11, /* Well known service. */ - ns_t_ptr = 12, /* Domain name pointer. */ - ns_t_hinfo = 13, /* Host information. */ - ns_t_minfo = 14, /* Mailbox information. */ - ns_t_mx = 15, /* Mail routing information. */ - ns_t_txt = 16, /* Text strings. */ - ns_t_rp = 17, /* Responsible person. */ - ns_t_afsdb = 18, /* AFS cell database. */ - ns_t_x25 = 19, /* X_25 calling address. */ - ns_t_isdn = 20, /* ISDN calling address. */ - ns_t_rt = 21, /* Router. */ - ns_t_nsap = 22, /* NSAP address. */ - ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ - ns_t_sig = 24, /* Security signature. */ - ns_t_key = 25, /* Security key. */ - ns_t_px = 26, /* X.400 mail mapping. */ - ns_t_gpos = 27, /* Geographical position (withdrawn). */ - ns_t_aaaa = 28, /* Ip6 Address. */ - ns_t_loc = 29, /* Location Information. */ - ns_t_nxt = 30, /* Next domain (security). */ - ns_t_eid = 31, /* Endpoint identifier. */ - ns_t_nimloc = 32, /* Nimrod Locator. */ - ns_t_srv = 33, /* Server Selection. */ - ns_t_atma = 34, /* ATM Address */ - ns_t_naptr = 35, /* Naming Authority PoinTeR */ - ns_t_kx = 36, /* Key Exchange */ - ns_t_cert = 37, /* Certification record */ - ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ - ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ - ns_t_sink = 40, /* Kitchen sink (experimentatl) */ - ns_t_opt = 41, /* EDNS0 option (meta-RR) */ - ns_t_tsig = 250, /* Transaction signature. */ - ns_t_ixfr = 251, /* Incremental zone transfer. */ - ns_t_axfr = 252, /* Transfer zone of authority. */ - ns_t_mailb = 253, /* Transfer mailbox records. */ - ns_t_maila = 254, /* Transfer mail agent records. */ - ns_t_any = 255, /* Wildcard match. */ - ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ - ns_t_max = 65536 -} ns_type; - -/* - * Values for class field - */ -typedef enum __ns_class { - ns_c_invalid = 0, /* Cookie. */ - ns_c_in = 1, /* Internet. */ - ns_c_2 = 2, /* unallocated/unsupported. */ - ns_c_chaos = 3, /* MIT Chaos-net. */ - ns_c_hs = 4, /* MIT Hesiod. */ - /* Query class values which do not appear in resource records */ - ns_c_none = 254, /* for prereq. sections in update requests */ - ns_c_any = 255, /* Wildcard match. */ - ns_c_max = 65536 -} ns_class; - -typedef struct { - unsigned id :16; /* query identification number */ -#if BYTE_ORDER == BIG_ENDIAN - /* fields in third byte */ - unsigned qr: 1; /* response flag */ - unsigned opcode: 4; /* purpose of message */ - unsigned aa: 1; /* authoritive answer */ - unsigned tc: 1; /* truncated message */ - unsigned rd: 1; /* recursion desired */ - /* fields in fourth byte */ - unsigned ra: 1; /* recursion available */ - unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned ad: 1; /* authentic data from named */ - unsigned cd: 1; /* checking disabled by resolver */ - unsigned rcode :4; /* response code */ -#endif -#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN - /* fields in third byte */ - unsigned rd :1; /* recursion desired */ - unsigned tc :1; /* truncated message */ - unsigned aa :1; /* authoritive answer */ - unsigned opcode :4; /* purpose of message */ - unsigned qr :1; /* response flag */ - /* fields in fourth byte */ - unsigned rcode :4; /* response code */ - unsigned cd: 1; /* checking disabled by resolver */ - unsigned ad: 1; /* authentic data from named */ - unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ - unsigned ra :1; /* recursion available */ -#endif - /* remaining bytes */ - unsigned qdcount :16; /* number of question entries */ - unsigned ancount :16; /* number of answer entries */ - unsigned nscount :16; /* number of authority entries */ - unsigned arcount :16; /* number of resource entries */ -} HEADER; - -#define PACKETSZ NS_PACKETSZ -#define MAXDNAME NS_MAXDNAME -#define MAXCDNAME NS_MAXCDNAME -#define MAXLABEL NS_MAXLABEL -#define HFIXEDSZ NS_HFIXEDSZ -#define QFIXEDSZ NS_QFIXEDSZ -#define RRFIXEDSZ NS_RRFIXEDSZ -#define INT32SZ NS_INT32SZ -#define INT16SZ NS_INT16SZ -#define INADDRSZ NS_INADDRSZ -#define IN6ADDRSZ NS_IN6ADDRSZ -#define INDIR_MASK NS_CMPRSFLGS -#define NAMESERVER_PORT NS_DEFAULTPORT - -#define S_ZONE ns_s_zn -#define S_PREREQ ns_s_pr -#define S_UPDATE ns_s_ud -#define S_ADDT ns_s_ar - -#define QUERY ns_o_query -#define IQUERY ns_o_iquery -#define STATUS ns_o_status -#define NS_NOTIFY_OP ns_o_notify -#define NS_UPDATE_OP ns_o_update - -#define NOERROR ns_r_noerror -#define FORMERR ns_r_formerr -#define SERVFAIL ns_r_servfail -#define NXDOMAIN ns_r_nxdomain -#define NOTIMP ns_r_notimpl -#define REFUSED ns_r_refused -#define YXDOMAIN ns_r_yxdomain -#define YXRRSET ns_r_yxrrset -#define NXRRSET ns_r_nxrrset -#define NOTAUTH ns_r_notauth -#define NOTZONE ns_r_notzone - -#define DELETE ns_uop_delete -#define ADD ns_uop_add - -#define T_A ns_t_a -#define T_NS ns_t_ns -#define T_MD ns_t_md -#define T_MF ns_t_mf -#define T_CNAME ns_t_cname -#define T_SOA ns_t_soa -#define T_MB ns_t_mb -#define T_MG ns_t_mg -#define T_MR ns_t_mr -#define T_NULL ns_t_null -#define T_WKS ns_t_wks -#define T_PTR ns_t_ptr -#define T_HINFO ns_t_hinfo -#define T_MINFO ns_t_minfo -#define T_MX ns_t_mx -#define T_TXT ns_t_txt -#define T_RP ns_t_rp -#define T_AFSDB ns_t_afsdb -#define T_X25 ns_t_x25 -#define T_ISDN ns_t_isdn -#define T_RT ns_t_rt -#define T_NSAP ns_t_nsap -#define T_NSAP_PTR ns_t_nsap_ptr -#define T_SIG ns_t_sig -#define T_KEY ns_t_key -#define T_PX ns_t_px -#define T_GPOS ns_t_gpos -#define T_AAAA ns_t_aaaa -#define T_LOC ns_t_loc -#define T_NXT ns_t_nxt -#define T_EID ns_t_eid -#define T_NIMLOC ns_t_nimloc -#define T_SRV ns_t_srv -#define T_ATMA ns_t_atma -#define T_NAPTR ns_t_naptr -#define T_TSIG ns_t_tsig -#define T_IXFR ns_t_ixfr -#define T_AXFR ns_t_axfr -#define T_MAILB ns_t_mailb -#define T_MAILA ns_t_maila -#define T_ANY ns_t_any - -#define C_IN ns_c_in -#define C_CHAOS ns_c_chaos -#define C_HS ns_c_hs -#define C_NONE ns_c_none -#define C_ANY ns_c_any - -#endif diff --git a/mdk-stage1/dietlibc/include/assert.h b/mdk-stage1/dietlibc/include/assert.h deleted file mode 100644 index bb573d0f2..000000000 --- a/mdk-stage1/dietlibc/include/assert.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _ASSERT_H -#define _ASSERT_H - -#include <sys/cdefs.h> - -/* This prints an "Assertion failed" message and aborts. */ -extern void __assert_fail (__const char *__assertion, __const char *__file, - unsigned int __line, __const char *__function) - __THROW __attribute__ ((__noreturn__)); - -#ifdef __PRETTY_FUNCTION__ -#define __ASSERT_FUNCTION __PRETTY_FUNCTION__ -#else -#define __ASSERT_FUNCTION __func__ -#endif - -#undef assert -#ifdef NDEBUG -#define assert(expr) -#else -# define assert(expr) \ - ((void) ((expr) ? 0 : \ - (__assert_fail (#expr, \ - __FILE__, __LINE__, __ASSERT_FUNCTION), 0))) -#endif - -#endif diff --git a/mdk-stage1/dietlibc/include/ctype.h b/mdk-stage1/dietlibc/include/ctype.h deleted file mode 100644 index 9322e8c7b..000000000 --- a/mdk-stage1/dietlibc/include/ctype.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _CTYPE_H -#define _CTYPE_H - -#include <sys/cdefs.h> - -extern int isascii (int c) __THROW __attribute__ ((__const__)); -extern int isblank (int c) __THROW __attribute__ ((__const__)); -extern int isalnum (int c) __THROW __attribute__ ((__const__)); -extern int isalpha (int c) __THROW __attribute__ ((__const__)); -extern int isdigit (int c) __THROW __attribute__ ((__const__)); -extern int isspace (int c) __THROW __attribute__ ((__const__)); - -extern int isupper (int c) __THROW __attribute__ ((__const__)); -extern int islower (int c) __THROW __attribute__ ((__const__)); - -extern int tolower(int c) __THROW __attribute__ ((__const__)); -extern int toupper(int c) __THROW __attribute__ ((__const__)); - -extern int isprint(int c) __THROW __attribute__ ((__const__)); -extern int ispunct(int c) __THROW __attribute__ ((__const__)); -extern int iscntrl(int c) __THROW __attribute__ ((__const__)); - -/* fscking GNU extensions! */ -extern int isxdigit(int c) __THROW __attribute__ ((__const__)); - -extern int isgraph(int c) __THROW __attribute__ ((__const__)); - -#endif diff --git a/mdk-stage1/dietlibc/include/daemon.h b/mdk-stage1/dietlibc/include/daemon.h deleted file mode 100644 index 9049f367d..000000000 --- a/mdk-stage1/dietlibc/include/daemon.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _DAEMON_H -#define _DAEMON_H - -extern int daemon (int nochdir,int noclose); - -#endif diff --git a/mdk-stage1/dietlibc/include/dirent.h b/mdk-stage1/dietlibc/include/dirent.h deleted file mode 100644 index b0ad4f5ec..000000000 --- a/mdk-stage1/dietlibc/include/dirent.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _DIRENT_H -#define _DIRENT_H 1 - -#include <sys/cdefs.h> -#include <sys/types.h> - -#include <linux/dirent.h> - -#define d_fileno d_ino /* Backwards compatibility. */ - -#undef _DIRENT_HAVE_D_NAMLEN -#define _DIRENT_HAVE_D_RECLEN -#define _DIRENT_HAVE_D_OFF -#define _DIRENT_HAVE_D_TYPE - -typedef struct __dirstream DIR; - -DIR *opendir (const char *__name) __THROW; -int closedir (DIR *__dirp) __THROW; -struct dirent *readdir (DIR *__dirp) __THROW; -struct dirent64 *readdir64 (DIR *__dirp) __THROW; -void rewinddir (DIR *__dirp) __THROW; -void seekdir (DIR *__dirp, long int __pos) __THROW; -long int telldir (DIR *__dirp) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/dlfcn.h b/mdk-stage1/dietlibc/include/dlfcn.h deleted file mode 100644 index b96f8f615..000000000 --- a/mdk-stage1/dietlibc/include/dlfcn.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _DLFCN_H -#define _DLFCN_H 1 - -#define RTLD_LAZY 0x00000 -#define RTLD_NOW 0x00001 - -#define RTLD_LOCAL 0x00000 -#define RTLD_GLOBAL 0x10000 - -void *dlopen (const char *filename, int flag); -const char *dlerror(void); -void *dlsym(void *handle, char *symbol); -int dlclose (void *handle); - -#endif diff --git a/mdk-stage1/dietlibc/include/elf.h b/mdk-stage1/dietlibc/include/elf.h deleted file mode 100644 index be09dbee4..000000000 --- a/mdk-stage1/dietlibc/include/elf.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/elf.h> diff --git a/mdk-stage1/dietlibc/include/endian.h b/mdk-stage1/dietlibc/include/endian.h deleted file mode 100644 index 463c24fff..000000000 --- a/mdk-stage1/dietlibc/include/endian.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _ENDIAN_H -#define _ENDIAN_H - -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 - -#ifdef __i386__ -#define __BYTE_ORDER __LITTLE_ENDIAN -#define __FLOAT_WORD_ORDER __BYTE_ORDER -#endif - -#ifdef __sparc__ -#define __BYTE_ORDER __BIG_ENDIAN -#define __FLOAT_WORD_ORDER __BYTE_ORDER -#endif - -#ifdef __mips__ -#ifdef __MIPSEB__ -#define __BIG_ENDIAN__ -#endif -#endif - -#ifndef __BYTE_ORDER -#ifdef __BIG_ENDIAN__ -#define __BYTE_ORDER __BIG_ENDIAN -#define __FLOAT_WORD_ORDER __BYTE_ORDER -#else -#define __BYTE_ORDER __LITTLE_ENDIAN -#define __FLOAT_WORD_ORDER __BYTE_ORDER -#endif -#endif - -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#define BIG_ENDIAN __BIG_ENDIAN -#define BYTE_ORDER __BYTE_ORDER - -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define __LONG_LONG_PAIR(HI, LO) LO, HI -#elif __BYTE_ORDER == __BIG_ENDIAN -# define __LONG_LONG_PAIR(HI, LO) HI, LO -#endif - -#endif diff --git a/mdk-stage1/dietlibc/include/errno.h b/mdk-stage1/dietlibc/include/errno.h deleted file mode 100644 index d1c68f39c..000000000 --- a/mdk-stage1/dietlibc/include/errno.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _ERRNO_H -#define _ERRNO_H - -extern int errno; - -#include <linux/errno.h> - -extern int *__errno_location(void); -extern void __set_errno(int error); - -#endif diff --git a/mdk-stage1/dietlibc/include/fcntl.h b/mdk-stage1/dietlibc/include/fcntl.h deleted file mode 100644 index b792502c1..000000000 --- a/mdk-stage1/dietlibc/include/fcntl.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _FCNTL_H -#define _FCNTL_H - -#include <sys/cdefs.h> - -#include <sys/types.h> -#include <unistd.h> - -#include <asm/fcntl.h> - -extern int fcntl (int __fd, int __cmd, ...) __THROW; -extern int open (const char *__file, int __oflag, ...) __THROW; -extern int open64 (const char *__file, int __oflag, ...) __THROW; -extern int creat (const char *__file, mode_t __mode) __THROW; -extern int creat64 (const char *__file, mode_t __mode) __THROW; -extern int lockf (int __fd, int __cmd, off_t __len) __THROW; -extern int lockf64 (int __fd, int __cmd, off64_t __len) __THROW; - -#define F_ULOCK 0 /* Unlock a previously locked region. */ -#define F_LOCK 1 /* Lock a region for exclusive use. */ -#define F_TLOCK 2 /* Test and lock a region for exclusive use. */ -#define F_TEST 3 /* Test a region for other processes locks. */ - -#endif diff --git a/mdk-stage1/dietlibc/include/features.h b/mdk-stage1/dietlibc/include/features.h deleted file mode 100644 index 5b0283f20..000000000 --- a/mdk-stage1/dietlibc/include/features.h +++ /dev/null @@ -1,3 +0,0 @@ -#warning "someone included features.h, apparently someone is including glibc headers!" - -#define __dietlibc__ diff --git a/mdk-stage1/dietlibc/include/fnmatch.h b/mdk-stage1/dietlibc/include/fnmatch.h deleted file mode 100644 index 762b43ff7..000000000 --- a/mdk-stage1/dietlibc/include/fnmatch.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _FNMATCH_H -#define _FNMATCH_H - -#include <sys/cdefs.h> - -int fnmatch(const char *pattern, const char *string, int flags) __THROW; - -#define FNM_NOESCAPE 1 -#define FNM_PATHNAME 2 -#define FNM_FILE_NAME 2 -#define FNM_PERIOD 4 -#define FNM_LEADING_DIR 8 -#define FNM_CASEFOLD 16 - -#endif diff --git a/mdk-stage1/dietlibc/include/ftw.h b/mdk-stage1/dietlibc/include/ftw.h deleted file mode 100644 index c888f0021..000000000 --- a/mdk-stage1/dietlibc/include/ftw.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _FTW_H -#define _FTW_H - -#include <sys/cdefs.h> -#include <sys/stat.h> - -struct FTW - { - int base; - int level; - }; - -int ftw (const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag), int depth) __THROW; -int nftw (const char *dir, int (*fn)(const char *file, const struct stat *sb, int flag, struct FTW *s), int depth, int flags) __THROW; - -enum -{ - FTW_F, /* Regular file. */ -#define FTW_F FTW_F - FTW_D, /* Directory. */ -#define FTW_D FTW_D - FTW_DNR, /* Unreadable directory. */ -#define FTW_DNR FTW_DNR - FTW_NS, /* Unstatable file. */ -#define FTW_NS FTW_NS - FTW_SL, /* Symbolic link. */ -# define FTW_SL FTW_SL -/* These flags are only passed from the `nftw' function. */ - FTW_DP, /* Directory, all subdirs have been visited. */ -# define FTW_DP FTW_DP - FTW_SLN /* Symbolic link naming non-existing file. */ -# define FTW_SLN FTW_SLN -}; - -typedef int (*__ftw_func_t) (__const char *__filename, - __const struct stat *__status, int __flag) __THROW; - -typedef int (*__nftw_func_t) (__const char *__filename, - __const struct stat *__status, int __flag, - struct FTW *__info) __THROW; - -#ifndef __NO_STAT64 -typedef int (*__ftw64_func_t) (__const char *__filename, - __const struct stat64 *__status, int __flag) __THROW; - -typedef int (*__nftw64_func_t) (__const char *__filename, - __const struct stat64 *__status, - int __flag, struct FTW *__info) __THROW; -#endif - -#endif diff --git a/mdk-stage1/dietlibc/include/getopt.h b/mdk-stage1/dietlibc/include/getopt.h deleted file mode 100644 index ebfc5522d..000000000 --- a/mdk-stage1/dietlibc/include/getopt.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __GETOPT_H__ -#define __GETOPT_H__ - -extern int optind,opterr; -extern char *optarg; -int getopt(int argc, char *argv[], char *options); - -/* the following was taken from GNU getopt, it's not actually supported - * by the diet libc! */ -extern int optopt; - -struct option { - const char* name; - int has_arg; - int* flag; - int val; -}; - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -extern int getopt_long(int argc, char *const *argv, - const char *shortopts, const struct option *longopts, - int *longind); - -extern int getopt_long_only(int argc, char *const *argv, - const char *shortopts, const struct option *longopts, - int *longind); - - -#endif diff --git a/mdk-stage1/dietlibc/include/glob.h b/mdk-stage1/dietlibc/include/glob.h deleted file mode 100644 index 80febbccf..000000000 --- a/mdk-stage1/dietlibc/include/glob.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _GLOB_H -#define _GLOB_H - - -typedef struct { - size_t gl_pathc; /* Count of paths matched so far */ - char **gl_pathv; /* List of matched pathnames. */ - size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ - int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ -} glob_t; - - -int glob(const char *pattern, int flags, - int errfunc(const char * epath, int eerrno), - glob_t *pglob) __THROW; - -void globfree(glob_t *pglob) __THROW; - - - -/* Bits set in the FLAGS argument to `glob'. */ -#define GLOB_ERR (1 << 0)/* Return on read errors. */ -#define GLOB_MARK (1 << 1)/* Append a slash to each name. */ -#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */ -#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */ -#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */ -#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */ -#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ -#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ - -#define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ -#define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ -#define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ -#define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */ -#define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */ -#define GLOB_ONLYDIR (1 << 13)/* Match only directories. */ -#define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error - if the user name is not available. */ -#define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \ - GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \ - GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \ - GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK) - - -/* Error returns from `glob'. */ -#define GLOB_NOSPACE 1 /* Ran out of memory. */ -#define GLOB_ABORTED 2 /* Read error. */ -#define GLOB_NOMATCH 3 /* No matches found. */ -#define GLOB_NOSYS 4 /* Not implemented. */ -/* Previous versions of this file defined GLOB_ABEND instead of - GLOB_ABORTED. Provide a compatibility definition here. */ -#define GLOB_ABEND GLOB_ABORTED - - -#endif diff --git a/mdk-stage1/dietlibc/include/grp.h b/mdk-stage1/dietlibc/include/grp.h deleted file mode 100644 index 32bf49afc..000000000 --- a/mdk-stage1/dietlibc/include/grp.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _GRP_H -#define _GRP_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -struct group - { - char *gr_name; /* Group name. */ - char *gr_passwd; /* Password. */ - gid_t gr_gid; /* Group ID. */ - char **gr_mem; /* Member list. */ - }; - -extern struct group *getgrgid (gid_t uid) __THROW; -extern struct group *getgrnam (const char *name) __THROW; - -extern struct group *getgrent(void) __THROW; -extern void setgrent(void) __THROW; -extern void endgrent(void) __THROW; - -extern int setgroups(size_t n, const gid_t *groups) __THROW; -extern int initgroups(const char *user, gid_t group) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/inttypes.h b/mdk-stage1/dietlibc/include/inttypes.h deleted file mode 100644 index e69de29bb..000000000 --- a/mdk-stage1/dietlibc/include/inttypes.h +++ /dev/null diff --git a/mdk-stage1/dietlibc/include/limits.h b/mdk-stage1/dietlibc/include/limits.h deleted file mode 100644 index a333debfd..000000000 --- a/mdk-stage1/dietlibc/include/limits.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _LIMITS_H -#define _LIMITS_H - -#include <linux/limits.h> - -#define __WORDSIZE 32 - -#ifdef __alpha__ -#undef __WORDSIZE -#define __WORDSIZE 64 -#endif - -#ifndef PATH_MAX -#define PATH_MAX 4096 -#endif - -#define CHAR_BIT 8 - -#define SCHAR_MIN (-128) -#define SCHAR_MAX 0x7f -#define UCHAR_MAX 0xff - -#define SHRT_MIN (-SHRT_MAX-1) -#define SHRT_MAX 0x7fff -#define USHRT_MAX 0xffff - -#define INT_MIN (-INT_MAX-1) -#define INT_MAX 0x7fffffff -#define UINT_MAX 0xffffffff - -#if __WORDSIZE == 64 -#define LONG_MAX 9223372036854775807L -#define ULONG_MAX 18446744073709551615UL -#else -#define LONG_MAX 2147483647L -#define ULONG_MAX 4294967295UL -#endif -#define LONG_MIN (-LONG_MAX - 1L) - -#define LLONG_MAX 9223372036854775807LL -#define LLONG_MIN (-LLONG_MAX - 1LL) - -/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ -#define ULLONG_MAX 18446744073709551615ULL - -#define PASS_MAX 256 - -#endif diff --git a/mdk-stage1/dietlibc/include/locale.h b/mdk-stage1/dietlibc/include/locale.h deleted file mode 100644 index acbeec8c1..000000000 --- a/mdk-stage1/dietlibc/include/locale.h +++ /dev/null @@ -1,6 +0,0 @@ -#warning "there is no locale support for diet libc yet" - -#define setlocale(a,b) 0 -#define bindtextdomain -#define textdomain - diff --git a/mdk-stage1/dietlibc/include/malloc.h b/mdk-stage1/dietlibc/include/malloc.h deleted file mode 100644 index c8b49f26d..000000000 --- a/mdk-stage1/dietlibc/include/malloc.h +++ /dev/null @@ -1 +0,0 @@ -#include <stdlib.h> diff --git a/mdk-stage1/dietlibc/include/math.h b/mdk-stage1/dietlibc/include/math.h deleted file mode 100644 index 2f4f2e33f..000000000 --- a/mdk-stage1/dietlibc/include/math.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef _MATH_H -#define _MATH_H - -#include <sys/cdefs.h> - -#define M_E 2.7182818284590452354 /* e */ -#define M_LOG2E 1.4426950408889634074 /* log_2 e */ -#define M_LOG10E 0.43429448190325182765 /* log_10 e */ -#define M_LN2 0.69314718055994530942 /* log_e 2 */ -#define M_LN10 2.30258509299404568402 /* log_e 10 */ -#define M_PI 3.14159265358979323846 /* pi */ -#define M_PI_2 1.57079632679489661923 /* pi/2 */ -#define M_PI_4 0.78539816339744830962 /* pi/4 */ -#define M_1_PI 0.31830988618379067154 /* 1/pi */ -#define M_2_PI 0.63661977236758134308 /* 2/pi */ -#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ -#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ - -#define M_El 2.7182818284590452353602874713526625L /* e */ -#define M_LOG2El 1.4426950408889634073599246810018922L /* log_2 e */ -#define M_LOG10El 0.4342944819032518276511289189166051L /* log_10 e */ -#define M_LN2l 0.6931471805599453094172321214581766L /* log_e 2 */ -#define M_LN10l 2.3025850929940456840179914546843642L /* log_e 10 */ -#define M_PIl 3.1415926535897932384626433832795029L /* pi */ -#define M_PI_2l 1.5707963267948966192313216916397514L /* pi/2 */ -#define M_PI_4l 0.7853981633974483096156608458198757L /* pi/4 */ -#define M_1_PIl 0.3183098861837906715377675267450287L /* 1/pi */ -#define M_2_PIl 0.6366197723675813430755350534900574L /* 2/pi */ -#define M_2_SQRTPIl 1.1283791670955125738961589031215452L /* 2/sqrt(pi) */ -#define M_SQRT2l 1.4142135623730950488016887242096981L /* sqrt(2) */ -#define M_SQRT1_2l 0.7071067811865475244008443621048490L /* 1/sqrt(2) */ - -double sin(double d) __THROW __attribute__((__const__)); -double cos(double d) __THROW __attribute__((__const__)); -double tan(double d) __THROW __attribute__((__const__)); - -double sinh(double d) __THROW __attribute__((__const__)); -double cosh(double d) __THROW __attribute__((__const__)); -double tanh(double d) __THROW __attribute__((__const__)); - -double asin(double d) __THROW __attribute__((__const__)); -double acos(double d) __THROW __attribute__((__const__)); -double atan(double d) __THROW __attribute__((__const__)); - -double asinh(double d) __THROW __attribute__((__const__)); -double acosh(double d) __THROW __attribute__((__const__)); -double atanh(double d) __THROW __attribute__((__const__)); - -double exp(double d) __THROW __attribute__((__const__)); -double log(double d) __THROW __attribute__((__const__)); -double log10(double d) __THROW __attribute__((__const__)); - -double pow(double x, double y) __THROW __attribute__((__const__)); - -double sqrt(double x) __THROW __attribute__((__const__)); -double fabs(double x) __THROW __attribute__((__const__)); -double fmod(double x, double y) __THROW __attribute__((__const__)); - - -#endif diff --git a/mdk-stage1/dietlibc/include/memory.h b/mdk-stage1/dietlibc/include/memory.h deleted file mode 100644 index 39adee705..000000000 --- a/mdk-stage1/dietlibc/include/memory.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _MEMORY_H -#define _MEMORY_H - -#include <string.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/mntent.h b/mdk-stage1/dietlibc/include/mntent.h deleted file mode 100644 index 301403224..000000000 --- a/mdk-stage1/dietlibc/include/mntent.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef _MNTENT_H -#define _MNTENT_H - -#include <sys/cdefs.h> -#include <stdio.h> -#include <paths.h> - -#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */ -#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */ - -/* General filesystem types. */ -#define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */ -#define MNTTYPE_NFS "nfs" /* Network file system. */ -#define MNTTYPE_SWAP "swap" /* Swap device. */ - - -/* Generic mount options. */ -#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */ -#define MNTOPT_RO "ro" /* Read only. */ -#define MNTOPT_RW "rw" /* Read/write. */ -#define MNTOPT_SUID "suid" /* Set uid allowed. */ -#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */ -#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */ - -__BEGIN_DECLS - -/* Structure describing a mount table entry. */ -struct mntent - { - char *mnt_fsname; /* Device or server for filesystem. */ - char *mnt_dir; /* Directory mounted on. */ - char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */ - char *mnt_opts; /* Comma-separated options for fs. */ - int mnt_freq; /* Dump frequency (in days). */ - int mnt_passno; /* Pass number for `fsck'. */ - }; - - -/* Prepare to begin reading and/or writing mount table entries from the - beginning of FILE. MODE is as for `fopen'. */ -extern FILE *setmntent (const char *file, const char *mode) __THROW; - -/* Read one mount table entry from STREAM. Returns a pointer to storage - reused on the next call, or null for EOF or error (use feof/ferror to - check). */ -extern struct mntent *getmntent (FILE* stream) __THROW; - -#ifdef __USE_MISC -/* Reentrant version of the above function. */ -extern struct mntent *getmntent_r (FILE* stream, - struct mntent* result, - char* buffer, - int bufsize) __THROW; -#endif - -/* Write the mount table entry described by MNT to STREAM. - Return zero on success, nonzero on failure. */ -extern int addmntent (FILE* stream, - const struct mntent* mnt) __THROW; - -/* Close a stream opened with `setmntent'. */ -extern int endmntent (FILE *stream) __THROW; - -/* Search MNT->mnt_opts for an option matching OPT. - Returns the address of the substring, or null if none found. */ -extern char *hasmntopt (const struct mntent *__mnt, - const char *opt) __THROW; - - -__END_DECLS - -#endif /* mntent.h */ diff --git a/mdk-stage1/dietlibc/include/net/if.h b/mdk-stage1/dietlibc/include/net/if.h deleted file mode 100644 index 88f386f46..000000000 --- a/mdk-stage1/dietlibc/include/net/if.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _NET_IF_H -#define _NET_IF_H - -#include <sys/cdefs.h> - -#include <linux/if.h> - -unsigned int if_nametoindex (const char *ifname) __THROW; -char *if_indextoname (unsigned int ifindex, char *ifname) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/net/if_arp.h b/mdk-stage1/dietlibc/include/net/if_arp.h deleted file mode 100644 index fe37a22dc..000000000 --- a/mdk-stage1/dietlibc/include/net/if_arp.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _NET_IF_ARP_H -#define _NET_IF_ARP_H - -#include <linux/if_arp.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/net/route.h b/mdk-stage1/dietlibc/include/net/route.h deleted file mode 100644 index 5e5db7b1a..000000000 --- a/mdk-stage1/dietlibc/include/net/route.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _NET_IF_ROUTE_H -#define _NET_IF_ROUTE_H - -#include <linux/route.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/netdb.h b/mdk-stage1/dietlibc/include/netdb.h deleted file mode 100644 index e90ea81ac..000000000 --- a/mdk-stage1/dietlibc/include/netdb.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef _NETDB_H -#define _NETDB_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -/* Absolute file name for network data base files. */ -#define _PATH_HEQUIV "/etc/hosts.equiv" -#define _PATH_HOSTS "/etc/hosts" -#define _PATH_NETWORKS "/etc/networks" -#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" -#define _PATH_PROTOCOLS "/etc/protocols" -#define _PATH_SERVICES "/etc/services" - -/* Description of data base entry for a single service. */ -struct servent -{ - char *s_name; /* Official service name. */ - char **s_aliases; /* Alias list. */ - int s_port; /* Port number. */ - char *s_proto; /* Protocol to use. */ -}; - -extern void endservent (void) __THROW; -extern struct servent *getservent (void) __THROW; -extern struct servent *getservbyname (const char *__name, - const char *__proto) __THROW; -extern struct servent *getservbyport (int __port, const char *__proto) - __THROW; - -struct hostent -{ - char *h_name; /* Official name of host. */ - char **h_aliases; /* Alias list. */ - int h_addrtype; /* Host address type. */ - socklen_t h_length; /* Length of address. */ - char **h_addr_list; /* List of addresses from name server. */ -#define h_addr h_addr_list[0] /* Address, for backward compatibility. */ -}; - -extern void endhostent (void) __THROW; -extern struct hostent *gethostent (void) __THROW; -extern struct hostent *gethostbyaddr (const void *__addr, socklen_t __len, - int __type) __THROW; -extern struct hostent *gethostbyname (const char *__name) __THROW; -extern struct hostent *gethostbyname2 (const char *__name, int __af) __THROW; - -/* this glibc "invention" is so ugly, I'm going to throw up any minute - * now */ -extern int gethostbyname_r(const char* NAME, struct hostent* RESULT_BUF,char* BUF, - size_t BUFLEN, struct hostent** RESULT, - int* H_ERRNOP) __THROW; - -#define HOST_NOT_FOUND 1 -#define TRY_AGAIN 2 -#define NO_RECOVERY 3 -#define NO_ADDRESS 4 - -extern int gethostbyaddr_r(const char* addr, size_t length, int format, - struct hostent* result, char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop) __THROW; - -struct protoent { - char *p_name; /* official protocol name */ - char **p_aliases; /* alias list */ - int p_proto; /* protocol number */ -}; - -struct protoent *getprotoent(void) __THROW; -struct protoent *getprotobyname(const char *name) __THROW; -struct protoent *getprotobynumber(int proto) __THROW; -void setprotoent(int stayopen) __THROW; -void endprotoent(void) __THROW; - - -/* Description of data base entry for a single network. NOTE: here a - poor assumption is made. The network number is expected to fit - into an unsigned long int variable. */ -struct netent -{ - char *n_name; /* Official name of network. */ - char **n_aliases; /* Alias list. */ - int n_addrtype; /* Net address type. */ - uint32_t n_net; /* Network number. */ -}; - -extern struct netent *getnetbyname (__const char *__name) __THROW; - - -#endif diff --git a/mdk-stage1/dietlibc/include/netinet/in.h b/mdk-stage1/dietlibc/include/netinet/in.h deleted file mode 100644 index 0569c8289..000000000 --- a/mdk-stage1/dietlibc/include/netinet/in.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _NETINET_IN_H -#define _NETINET_IN_H - -#include <linux/in.h> -#include <linux/in6.h> - -#define IPPORT_RESERVED 1024 - -#endif diff --git a/mdk-stage1/dietlibc/include/netinet/in_systm.h b/mdk-stage1/dietlibc/include/netinet/in_systm.h deleted file mode 100644 index e69de29bb..000000000 --- a/mdk-stage1/dietlibc/include/netinet/in_systm.h +++ /dev/null diff --git a/mdk-stage1/dietlibc/include/netinet/ip.h b/mdk-stage1/dietlibc/include/netinet/ip.h deleted file mode 100644 index 35bf9cc42..000000000 --- a/mdk-stage1/dietlibc/include/netinet/ip.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _NETINET_IP_H -#define _NETINET_IP_H - -#include <linux/ip.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/paths.h b/mdk-stage1/dietlibc/include/paths.h deleted file mode 100644 index 0e36bb10e..000000000 --- a/mdk-stage1/dietlibc/include/paths.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _PATHS_H -#define _PATHS_H - -#define _PATH_BSHELL "/bin/sh" -#define _PATH_DEFPATH "/bin:/usr/bin:" - -#define _PATH_DEVNULL "/dev/null" - -#define _PATH_CONSOLE "/dev/console" -#define _PATH_MOUNTED "/etc/mtab" - -#define _PATH_PASSWD "/etc/passwd" -#define _PATH_GROUP "/etc/group" -#define _PATH_SHADOW "/etc/shadow" - -#endif diff --git a/mdk-stage1/dietlibc/include/pthread.h b/mdk-stage1/dietlibc/include/pthread.h deleted file mode 100644 index e922ab28b..000000000 --- a/mdk-stage1/dietlibc/include/pthread.h +++ /dev/null @@ -1,227 +0,0 @@ -#ifndef _PTHREAD_H -#define _PTHREAD_H 1 - -#include <sched.h> -#include <signal.h> -#include <setjmp.h> - -/* arg... kernel haeder... */ -#define ENOTSUP 524 /* Operation is not supported */ - -#define PTHREAD_STACK_SIZE 16384 - -#define PTHREAD_THREADS_MAX 128 - -#define MAX_SPIN_COUNT 50 -#define SPIN_SLEEP_DURATION 2000001 - -#define PTHREAD_KEYS_MAX 7 -#define PTHREAD_DESTRUCTOR_ITERATIONS 10 - -typedef struct _pthread_descr_struct *_pthread_descr; -typedef unsigned long int pthread_t; - -/* Fast locks */ -struct _pthread_fastlock { - int __spinlock; -}; - -/* Mutexes */ -typedef struct { - struct _pthread_fastlock lock; - _pthread_descr owner; - int kind; - unsigned int count; -} pthread_mutex_t; - -enum { - PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, -}; - -enum -{ - PTHREAD_PROCESS_PRIVATE, -#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE - PTHREAD_PROCESS_SHARED -#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED -}; - -#define PTHREAD_MUTEX_INITIALIZER \ -{{0}, 0, PTHREAD_MUTEX_FAST_NP, 0} - -#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ -{{0}, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0} - -#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ -{{0}, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0} - -typedef struct { - int __mutexkind; -} pthread_mutexattr_t; - -int pthread_mutex_init(pthread_mutex_t *mutex, - const pthread_mutexattr_t *mutexattr); -int pthread_mutex_lock(pthread_mutex_t *mutex); -int pthread_mutex_unlock(pthread_mutex_t *mutex); -int pthread_mutex_trylock(pthread_mutex_t *mutex); -int pthread_mutex_destroy(pthread_mutex_t *mutex); - -/* Conditions */ -typedef void* pthread_condattr_t; - -typedef struct { - struct _pthread_fastlock lock; - _pthread_descr wait_chain; -} pthread_cond_t; - -#define PTHREAD_COND_INITIALIZER \ -{{0},0} - -int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *cond_attr); -int pthread_cond_destroy(pthread_cond_t *cond); -int pthread_cond_signal(pthread_cond_t *cond); -int pthread_cond_broadcast(pthread_cond_t *cond); -int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime); -int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); - -/* only for completeness (always return NULL) */ -int pthread_condattr_init(pthread_condattr_t *attr); -int pthread_condattr_destroy(pthread_condattr_t *attr); -int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared); -int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared); - -/* thread specific variables */ -typedef unsigned int pthread_key_t; - -int pthread_key_create(pthread_key_t *key, void (*destructor)(const void*)); -int pthread_key_delete(pthread_key_t key); -int pthread_setspecific(pthread_key_t key, const void *value); -const void *pthread_getspecific(pthread_key_t key); - - -/* Attributes for threads. */ -typedef struct -{ - int __detachstate; - int __schedpolicy; - struct sched_param __schedparam; - int __inheritsched; - int __scope; - void * __stackaddr; - unsigned long __stacksize; -} pthread_attr_t; - -enum -{ - PTHREAD_CREATE_JOINABLE, -#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE - PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED -}; - -enum -{ - PTHREAD_EXPLICIT_SCHED, -#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED - PTHREAD_INHERIT_SCHED -#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED -}; - -enum /* for completeness */ -{ - PTHREAD_SCOPE_SYSTEM, -#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM - PTHREAD_SCOPE_PROCESS -#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS -}; - -int pthread_attr_init(pthread_attr_t *attr); -int pthread_attr_destroy(pthread_attr_t *attr); - -int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate); -int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate); - -int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy); -int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy); - -int pthread_attr_setschedparam(pthread_attr_t *attr, - const struct sched_param *param); -int pthread_attr_getschedparam(const pthread_attr_t *attr, - struct sched_param *param); - -int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit); -int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit); - -int pthread_attr_setscope(pthread_attr_t *attr, int scope); -int pthread_attr_getscope(const pthread_attr_t *attr, int *scope); - -int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack); -int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stack); - -int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); -int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize); - -/* ONCE */ -typedef int pthread_once_t; -#define PTHREAD_ONCE_INIT 0 - -int __pthread_once(pthread_once_t* once_control, void (*init_routine)(void)); -int pthread_once(pthread_once_t* once_control, void (*init_routine)(void)); - -/* CANCEL */ - -enum { - PTHREAD_CANCEL_ENABLE, -#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE - PTHREAD_CANCEL_DISABLE, -#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE -}; - -enum { - PTHREAD_CANCEL_ASYNCHRONOUS, -#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS - PTHREAD_CANCEL_DEFERRED, -#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED -}; - -#define PTHREAD_CANCELED ((void *) -1) - -int pthread_cancel(pthread_t thread); -int pthread_setcancelstate(int state, int *oldstate); - -int pthread_setcanceltype(int type, int *oldtype); - -void pthread_testcancel(void); - -/* CLEANUP */ - -void pthread_cleanup_push(void (*routine)(void*), void *arg); -void pthread_cleanup_pop (int execute); - -void pthread_cleanup_push_defer_np(void (*routine)(void *), void *arg); -void pthread_cleanup_pop_restore_np(int execute); - -/* FORK */ - -pid_t pthread_atfork(void (*prepare)(void), void (*parent)(void), - void (*child)(void)); - -/* THREADS */ -int pthread_create (pthread_t *__thread, - const pthread_attr_t *__attr, - void *(*__start_routine) (void *), - void *__arg); - -void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); - -int pthread_join (pthread_t __th, void **__thread_return); - -int pthread_detach (pthread_t __th); - -pthread_t pthread_self (void); -int pthread_equal (pthread_t __thread1, pthread_t __thread2); - -#endif diff --git a/mdk-stage1/dietlibc/include/pwd.h b/mdk-stage1/dietlibc/include/pwd.h deleted file mode 100644 index e6fb5d0be..000000000 --- a/mdk-stage1/dietlibc/include/pwd.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _PWD_H -#define _PWD_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -struct passwd { - char *pw_name; /* Username. */ - char *pw_passwd; /* Password. */ - uid_t pw_uid; /* User ID. */ - gid_t pw_gid; /* Group ID. */ - char *pw_gecos; /* Real name. */ - char *pw_dir; /* Home directory. */ - char *pw_shell; /* Shell program. */ -}; - -extern struct passwd *getpwuid (uid_t __uid) __THROW; -extern struct passwd *getpwnam (const char *__name) __THROW; - -extern struct passwd *getpwent(void) __THROW; -extern void setpwent(void) __THROW; -extern void endpwent(void) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/regex.h b/mdk-stage1/dietlibc/include/regex.h deleted file mode 100644 index be609d9db..000000000 --- a/mdk-stage1/dietlibc/include/regex.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _REGEX_H -#define _REGEX_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -typedef ptrdiff_t regoff_t; - -typedef struct { - regoff_t rm_so; - regoff_t rm_eo; -} regmatch_t; - -#define REG_EXTENDED 1 -#define REG_ICASE 2 -#define REG_NOSUB 4 -#define REG_NEWLINE 8 - -#define REG_NOTBOL 1 -#define REG_NOTEOL 2 - -#define REG_NOMATCH -1 - -#define RE_DUP_MAX 255 - -struct __regex_t; - -typedef int (*matcher)(void*,const char*,int ofs,struct __regex_t *t,int plus,int eflags); - -typedef struct __regex_t { - struct regex { - matcher m; - void* next; - int pieces; - int num; - struct branch *b; - } r; - int brackets,cflags; - regmatch_t *l; -} regex_t; - -int regcomp(regex_t *preg, const char *regex, int cflags) __THROW; -int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) __THROW; -size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) __THROW; -void regfree(regex_t *preg) __THROW; - -enum __regex_errors { - REG_NOERROR, - REG_BADRPT, /* Invalid use of repetition operators such as using `*' as the first character. */ - REG_BADBR, /* Invalid use of back reference operator. */ - REG_EBRACE, /* Un-matched brace interval operators. */ - REG_EBRACK, /* Un-matched bracket list operators. */ - REG_ERANGE, /* Invalid use of the range operator, eg. the ending point of the - range occurs prior to the starting point. */ - REG_ECTYPE, /* Unknown character class name. */ - REG_ECOLLATE, /* Invalid collating element. */ - REG_EPAREN, /* Un-matched parenthesis group operators. */ - REG_ESUBREG, /* Invalid back reference to a subexpression. */ - REG_EEND, /* Non specific error. This is not defined by POSIX.2. */ - REG_EESCAPE, /* Trailing backslash. */ - REG_BADPAT, /* Invalid use of pattern operators such as group or list. */ - REG_ESIZE, /* Compiled regular expression requires a pattern buffer - larger than 64Kb. This is not defined by POSIX.2. */ - REG_ESPACE, /* regcomp ran out of space */ -}; - -#endif diff --git a/mdk-stage1/dietlibc/include/resolv.h b/mdk-stage1/dietlibc/include/resolv.h deleted file mode 100644 index 4e90799c2..000000000 --- a/mdk-stage1/dietlibc/include/resolv.h +++ /dev/null @@ -1 +0,0 @@ -void res_init(void); diff --git a/mdk-stage1/dietlibc/include/rpc/auth.h b/mdk-stage1/dietlibc/include/rpc/auth.h deleted file mode 100644 index 4aa7d21ce..000000000 --- a/mdk-stage1/dietlibc/include/rpc/auth.h +++ /dev/null @@ -1,213 +0,0 @@ -/* @(#)auth.h 2.3 88/08/07 4.0 RPCSRC; from 1.17 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * auth.h, Authentication interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The data structures are completely opaque to the client. The client - * is required to pass a AUTH * to routines that create rpc - * "sessions". - */ - -#ifndef _RPC_AUTH_H - -#define _RPC_AUTH_H 1 -#include <sys/cdefs.h> -#include <rpc/xdr.h> - -__BEGIN_DECLS - -#define MAX_AUTH_BYTES 400 -#define MAXNETNAMELEN 255 /* maximum length of network user's name */ - -/* - * Status returned from authentication check - */ -enum auth_stat { - AUTH_OK=0, - /* - * failed at remote end - */ - AUTH_BADCRED=1, /* bogus credentials (seal broken) */ - AUTH_REJECTEDCRED=2, /* client should begin new session */ - AUTH_BADVERF=3, /* bogus verifier (seal broken) */ - AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ - AUTH_TOOWEAK=5, /* rejected due to security reasons */ - /* - * failed locally - */ - AUTH_INVALIDRESP=6, /* bogus response verifier */ - AUTH_FAILED=7 /* some unknown reason */ -}; - -union des_block { - struct { - u_int32_t high; - u_int32_t low; - } key; - char c[8]; -}; -typedef union des_block des_block; -extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW; - -/* - * Authentication info. Opaque to client. - */ -struct opaque_auth { - enum_t oa_flavor; /* flavor of auth */ - caddr_t oa_base; /* address of more auth stuff */ - u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ -}; - -/* - * Auth handle, interface to client side authenticators. - */ -typedef struct AUTH AUTH; -struct AUTH { - struct opaque_auth ah_cred; - struct opaque_auth ah_verf; - union des_block ah_key; - struct auth_ops { - void (*ah_nextverf) (AUTH *); - int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */ - int (*ah_validate) (AUTH *, struct opaque_auth *); - /* validate verifier */ - int (*ah_refresh) (AUTH *); /* refresh credentials */ - void (*ah_destroy) (AUTH *); /* destroy this structure */ - } *ah_ops; - caddr_t ah_private; -}; - - -/* - * Authentication ops. - * The ops and the auth handle provide the interface to the authenticators. - * - * AUTH *auth; - * XDR *xdrs; - * struct opaque_auth verf; - */ -#define AUTH_NEXTVERF(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define auth_nextverf(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) - -#define AUTH_MARSHALL(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define auth_marshall(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) - -#define AUTH_VALIDATE(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define auth_validate(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) - -#define AUTH_REFRESH(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) -#define auth_refresh(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) - -#define AUTH_DESTROY(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) -#define auth_destroy(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) - - -extern struct opaque_auth _null_auth; - - -/* - * These are the various implementations of client side authenticators. - */ - -/* - * Unix style authentication - * AUTH *authunix_create(machname, uid, gid, len, aup_gids) - * char *machname; - * int uid; - * int gid; - * int len; - * int *aup_gids; - */ -extern AUTH *authunix_create (char *__machname,uid_t __uid, gid_t __gid, - int __len, gid_t *__aup_gids) __THROW; -extern AUTH *authunix_create_default (void) __THROW; -extern AUTH *authnone_create (void) __THROW; -extern AUTH *authdes_create (const char *__servername, u_int __window, - struct sockaddr *__syncaddr, des_block *__ckey) - __THROW; -extern AUTH *authdes_pk_create (const char *, netobj *, u_int, - struct sockaddr *, des_block *) __THROW; - - -#define AUTH_NONE 0 /* no authentication */ -#define AUTH_NULL 0 /* backward compatibility */ -#define AUTH_SYS 1 /* unix style (uid, gids) */ -#define AUTH_UNIX AUTH_SYS -#define AUTH_SHORT 2 /* short hand unix style */ -#define AUTH_DES 3 /* des style (encrypted timestamps) */ -#define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */ -#define AUTH_KERB 4 /* kerberos style */ - -/* - * Netname manipulating functions - * - */ -extern int getnetname (char *) __THROW; -extern int host2netname (char *, __const char *, __const char *) __THROW; -extern int user2netname (char *, __const uid_t, __const char *) __THROW; -extern int netname2user (__const char *, uid_t *, gid_t *, int *, gid_t *) - __THROW; -extern int netname2host (__const char *, char *, __const int) __THROW; - -/* - * - * These routines interface to the keyserv daemon - * - */ -extern int key_decryptsession (char *, des_block *) __THROW; -extern int key_decryptsession_pk (char *, netobj *, des_block *) __THROW; -extern int key_encryptsession (char *, des_block *) __THROW; -extern int key_encryptsession_pk (char *, netobj *, des_block *) __THROW; -extern int key_gendes (des_block *) __THROW; -extern int key_setsecret (char *) __THROW; -extern int key_secretkey_is_set (void) __THROW; -extern int key_get_conv (char *, des_block *) __THROW; - -/* - * XDR an opaque authentication struct. - */ -extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *) __THROW; - -__END_DECLS - -#endif /* rpc/auth.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/auth_des.h b/mdk-stage1/dietlibc/include/rpc/auth_des.h deleted file mode 100644 index 198b299e7..000000000 --- a/mdk-stage1/dietlibc/include/rpc/auth_des.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _RPC_AUTH_DES_H -#define _RPC_AUTH_DES_H 1 - -#include <sys/cdefs.h> -#include <rpc/auth.h> - -__BEGIN_DECLS - -/* There are two kinds of "names": fullnames and nicknames */ -enum authdes_namekind - { - ADN_FULLNAME, - ADN_NICKNAME - }; - -/* A fullname contains the network name of the client, - a conversation key and the window */ -struct authdes_fullname - { - char *name; /* network name of client, up to MAXNETNAMELEN */ - des_block key; /* conversation key */ - uint32_t window; /* associated window */ - }; - -/* A credential */ -struct authdes_cred - { - enum authdes_namekind adc_namekind; - struct authdes_fullname adc_fullname; - uint32_t adc_nickname; - }; - -/* A timeval replacement for !32bit platforms */ -struct rpc_timeval - { - uint32_t tv_sec; /* Seconds. */ - uint32_t tv_usec; /* Microseconds. */ - }; - -/* A des authentication verifier */ -struct authdes_verf - { - union - { - struct rpc_timeval adv_ctime; /* clear time */ - des_block adv_xtime; /* crypt time */ - } - adv_time_u; - uint32_t adv_int_u; - }; - -/* des authentication verifier: client variety - - adv_timestamp is the current time. - adv_winverf is the credential window + 1. - Both are encrypted using the conversation key. */ -#define adv_timestamp adv_time_u.adv_ctime -#define adv_xtimestamp adv_time_u.adv_xtime -#define adv_winverf adv_int_u - -/* des authentication verifier: server variety - - adv_timeverf is the client's timestamp + client's window - adv_nickname is the server's nickname for the client. - adv_timeverf is encrypted using the conversation key. */ -#define adv_timeverf adv_time_u.adv_ctime -#define adv_xtimeverf adv_time_u.adv_xtime -#define adv_nickname adv_int_u - -/* Map a des credential into a unix cred. */ -extern int authdes_getucred (__const struct authdes_cred * __adc, - uid_t * __uid, gid_t * __gid, - short *__grouplen, gid_t * __groups) __THROW; - -/* Get the public key for NAME and place it in KEY. NAME can only be - up to MAXNETNAMELEN bytes long and the destination buffer KEY should - have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */ -extern int getpublickey (__const char *__name, char *__key) __THROW; - -/* Get the secret key for NAME and place it in KEY. PASSWD is used to - decrypt the encrypted key stored in the database. NAME can only be - up to MAXNETNAMELEN bytes long and the destination buffer KEY - should have HEXKEYBYTES + 1 bytes long to fit all characters from - the key. */ -extern int getsecretkey (__const char *__name, char *__key, - __const char *__passwd) __THROW; - -extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep, - struct rpc_timeval *__timeout) __THROW; - -__END_DECLS - - -#endif /* rpc/auth_des.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/auth_unix.h b/mdk-stage1/dietlibc/include/rpc/auth_unix.h deleted file mode 100644 index 7a1bfa9f0..000000000 --- a/mdk-stage1/dietlibc/include/rpc/auth_unix.h +++ /dev/null @@ -1,90 +0,0 @@ -/* @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC; from 1.8 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)auth_unix.h 1.5 86/07/16 SMI */ - -/* - * auth_unix.h, Protocol for UNIX style authentication parameters for RPC - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -/* - * The system is very weak. The client uses no encryption for it - * credentials and only sends null verifiers. The server sends backs - * null verifiers or optionally a verifier that suggests a new short hand - * for the credentials. - */ - -#ifndef _RPC_AUTH_UNIX_H -#define _RPC_AUTH_UNIX_H 1 - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <rpc/types.h> -#include <rpc/auth.h> -#include <rpc/xdr.h> - -__BEGIN_DECLS - -/* The machine name is part of a credential; it may not exceed 255 bytes */ -#define MAX_MACHINE_NAME 255 - -/* gids compose part of a credential; there may not be more than 16 of them */ -#define NGRPS 16 - -/* - * Unix style credentials. - */ -struct authunix_parms - { - u_long aup_time; - char *aup_machname; - uid_t aup_uid; - gid_t aup_gid; - u_int aup_len; - gid_t *aup_gids; - }; - -extern bool_t xdr_authunix_parms (XDR *__xdrs, struct authunix_parms *__p) - __THROW; - -/* - * If a response verifier has flavor AUTH_SHORT, - * then the body of the response verifier encapsulates the following structure; - * again it is serialized in the obvious fashion. - */ -struct short_hand_verf - { - struct opaque_auth new_cred; - }; - -__END_DECLS - -#endif /* rpc/auth_unix.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/clnt.h b/mdk-stage1/dietlibc/include/rpc/clnt.h deleted file mode 100644 index 60b0fafdf..000000000 --- a/mdk-stage1/dietlibc/include/rpc/clnt.h +++ /dev/null @@ -1,421 +0,0 @@ -/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * clnt.h - Client side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _RPC_CLNT_H -#define _RPC_CLNT_H 1 - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <rpc/types.h> -#include <rpc/auth.h> -#include <sys/un.h> - -__BEGIN_DECLS - -/* - * Rpc calls return an enum clnt_stat. This should be looked at more, - * since each implementation is required to live with this (implementation - * independent) list of errors. - */ -enum clnt_stat { - RPC_SUCCESS=0, /* call succeeded */ - /* - * local errors - */ - RPC_CANTENCODEARGS=1, /* can't encode arguments */ - RPC_CANTDECODERES=2, /* can't decode results */ - RPC_CANTSEND=3, /* failure in sending call */ - RPC_CANTRECV=4, /* failure in receiving result */ - RPC_TIMEDOUT=5, /* call timed out */ - /* - * remote errors - */ - RPC_VERSMISMATCH=6, /* rpc versions not compatible */ - RPC_AUTHERROR=7, /* authentication error */ - RPC_PROGUNAVAIL=8, /* program not available */ - RPC_PROGVERSMISMATCH=9, /* program version mismatched */ - RPC_PROCUNAVAIL=10, /* procedure unavailable */ - RPC_CANTDECODEARGS=11, /* decode arguments error */ - RPC_SYSTEMERROR=12, /* generic "other problem" */ - RPC_NOBROADCAST = 21, /* Broadcasting not supported */ - /* - * callrpc & clnt_create errors - */ - RPC_UNKNOWNHOST=13, /* unknown host name */ - RPC_UNKNOWNPROTO=17, /* unknown protocol */ - RPC_UNKNOWNADDR = 19, /* Remote address unknown */ - - /* - * rpcbind errors - */ - RPC_RPCBFAILURE=14, /* portmapper failed in its call */ -#define RPC_PMAPFAILURE RPC_RPCBFAILURE - RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ - RPC_N2AXLATEFAILURE = 22, /* Name to addr translation failed */ - /* - * unspecified error - */ - RPC_FAILED=16, - RPC_INTR=18, - RPC_TLIERROR=20, - RPC_UDERROR=23, - /* - * asynchronous errors - */ - RPC_INPROGRESS = 24, - RPC_STALERACHANDLE = 25 -}; - - -/* - * Error info. - */ -struct rpc_err { - enum clnt_stat re_status; - union { - int RE_errno; /* related system error */ - enum auth_stat RE_why; /* why the auth error occurred */ - struct { - u_long low; /* lowest verion supported */ - u_long high; /* highest verion supported */ - } RE_vers; - struct { /* maybe meaningful if RPC_FAILED */ - long s1; - long s2; - } RE_lb; /* life boot & debugging only */ - } ru; -#define re_errno ru.RE_errno -#define re_why ru.RE_why -#define re_vers ru.RE_vers -#define re_lb ru.RE_lb -}; - - -/* - * Client rpc handle. - * Created by individual implementations, see e.g. rpc_udp.c. - * Client is responsible for initializing auth, see e.g. auth_none.c. - */ -typedef struct CLIENT CLIENT; -struct CLIENT { - AUTH *cl_auth; /* authenticator */ - struct clnt_ops { - enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t, - caddr_t, struct timeval); - /* call remote procedure */ - void (*cl_abort) (void); /* abort a call */ - void (*cl_geterr) (CLIENT *, struct rpc_err *); - /* get specific error code */ - bool_t (*cl_freeres) (CLIENT *, xdrproc_t, caddr_t); - /* frees results */ - void (*cl_destroy) (CLIENT *); /* destroy this structure */ - bool_t (*cl_control) (CLIENT *, int, char *); - /* the ioctl() of rpc */ - } *cl_ops; - caddr_t cl_private; /* private stuff */ -}; - - -/* - * client side rpc interface ops - * - * Parameter types are: - * - */ - -/* - * enum clnt_stat - * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) - * CLIENT *rh; - * u_long proc; - * xdrproc_t xargs; - * caddr_t argsp; - * xdrproc_t xres; - * caddr_t resp; - * struct timeval timeout; - */ -#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) -#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) - -/* - * void - * CLNT_ABORT(rh); - * CLIENT *rh; - */ -#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) -#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) - -/* - * struct rpc_err - * CLNT_GETERR(rh); - * CLIENT *rh; - */ -#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) -#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) - - -/* - * bool_t - * CLNT_FREERES(rh, xres, resp); - * CLIENT *rh; - * xdrproc_t xres; - * caddr_t resp; - */ -#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) -#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) - -/* - * bool_t - * CLNT_CONTROL(cl, request, info) - * CLIENT *cl; - * u_int request; - * char *info; - */ -#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) -#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) - -/* - * control operations that apply to all transports - * - * Note: options marked XXX are no-ops in this implementation of RPC. - * The are present in TI-RPC but can't be implemented here since they - * depend on the presence of STREAMS/TLI, which we don't have. - */ -#define CLSET_TIMEOUT 1 /* set timeout (timeval) */ -#define CLGET_TIMEOUT 2 /* get timeout (timeval) */ -#define CLGET_SERVER_ADDR 3 /* get server's address (sockaddr) */ -#define CLGET_FD 6 /* get connections file descriptor */ -#define CLGET_SVC_ADDR 7 /* get server's address (netbuf) XXX */ -#define CLSET_FD_CLOSE 8 /* close fd while clnt_destroy */ -#define CLSET_FD_NCLOSE 9 /* Do not close fd while clnt_destroy*/ -#define CLGET_XID 10 /* Get xid */ -#define CLSET_XID 11 /* Set xid */ -#define CLGET_VERS 12 /* Get version number */ -#define CLSET_VERS 13 /* Set version number */ -#define CLGET_PROG 14 /* Get program number */ -#define CLSET_PROG 15 /* Set program number */ -#define CLSET_SVC_ADDR 16 /* get server's address (netbuf) XXX */ -#define CLSET_PUSH_TIMOD 17 /* push timod if not already present XXX */ -#define CLSET_POP_TIMOD 18 /* pop timod XXX */ -/* - * Connectionless only control operations - */ -#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ -#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ - -/* - * void - * CLNT_DESTROY(rh); - * CLIENT *rh; - */ -#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) -#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) - - -/* - * RPCTEST is a test program which is accessible on every rpc - * transport/port. It is used for testing, performance evaluation, - * and network administration. - */ - -#define RPCTEST_PROGRAM ((u_long)1) -#define RPCTEST_VERSION ((u_long)1) -#define RPCTEST_NULL_PROC ((u_long)2) -#define RPCTEST_NULL_BATCH_PROC ((u_long)3) - -/* - * By convention, procedure 0 takes null arguments and returns them - */ - -#define NULLPROC ((u_long)0) - -/* - * Below are the client handle creation routines for the various - * implementations of client side rpc. They can return NULL if a - * creation failure occurs. - */ - -/* - * Memory based rpc (for speed check and testing) - * CLIENT * - * clntraw_create(prog, vers) - * u_long prog; - * u_long vers; - */ -extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers) - __THROW; - - -/* - * Generic client creation routine. Supported protocols are "udp", "tcp" and - * "unix" - * CLIENT * - * clnt_create(host, prog, vers, prot) - * char *host; -- hostname - * u_long prog; -- program number - * u_ong vers; -- version number - * char *prot; -- protocol - */ -extern CLIENT *clnt_create (__const char *__host, __const u_long __prog, - __const u_long __vers, __const char *__prot) - __THROW; - - -/* - * TCP based rpc - * CLIENT * - * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long prog; - * u_long version; - * register int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog, - u_long __version, int *__sockp, u_int __sendsz, - u_int __recvsz) __THROW; - -/* - * UDP based rpc. - * CLIENT * - * clntudp_create(raddr, program, version, wait, sockp) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait_resend; - * int *sockp; - * - * Same as above, but you specify max packet sizes. - * CLIENT * - * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * u_long program; - * u_long version; - * struct timeval wait_resend; - * int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program, - u_long __version, struct timeval __wait_resend, - int *__sockp) __THROW; -extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr, - u_long __program, u_long __version, - struct timeval __wait_resend, int *__sockp, - u_int __sendsz, u_int __recvsz) __THROW; - - - - -/* - * AF_UNIX based rpc - * CLIENT * - * clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz) - * struct sockaddr_un *raddr; - * u_long prog; - * u_long version; - * register int *sockp; - * u_int sendsz; - * u_int recvsz; - */ -extern CLIENT *clntunix_create (struct sockaddr_un *__raddr, u_long __program, - u_long __version, int *__sockp, - u_int __sendsz, u_int __recvsz) __THROW; - - -extern int callrpc (__const char *__host, __const u_long __prognum, - __const u_long __versnum, __const u_long __procnum, - __const xdrproc_t __inproc, __const char *__in, - __const xdrproc_t __outproc, char *__out) __THROW; -extern int _rpc_dtablesize (void) __THROW; - -/* - * Print why creation failed - */ -extern void clnt_pcreateerror (__const char *__msg) __THROW; /* stderr */ -extern char *clnt_spcreateerror(__const char *__msg) __THROW; /* string */ - -/* - * Like clnt_perror(), but is more verbose in its output - */ -extern void clnt_perrno (enum clnt_stat __num) __THROW; /* stderr */ - -/* - * Print an English error message, given the client error code - */ -extern void clnt_perror (CLIENT *__clnt, __const char *__msg) __THROW; - /* stderr */ -extern char *clnt_sperror (CLIENT *__clnt, __const char *__msg) __THROW; - /* string */ - -/* - * If a creation fails, the following allows the user to figure out why. - */ -struct rpc_createerr { - enum clnt_stat cf_stat; - struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */ -}; - -extern struct rpc_createerr rpc_createerr; - - - -/* - * Copy error message to buffer. - */ -extern char *clnt_sperrno (enum clnt_stat __num) __THROW; /* string */ - -/* - * get the port number on the host for the rpc program,version and proto - */ -extern int getrpcport (__const char * __host, u_long __prognum, - u_long __versnum, u_int proto) __THROW; - -/* - * get the local host's IP address without consulting - * name service library functions - */ -extern void get_myaddress (struct sockaddr_in *) __THROW; - -#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ -#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ - -__END_DECLS - -#endif /* rpc/clnt.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/des_crypt.h b/mdk-stage1/dietlibc/include/rpc/des_crypt.h deleted file mode 100644 index 6a65887d3..000000000 --- a/mdk-stage1/dietlibc/include/rpc/des_crypt.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI - * - * des_crypt.h, des library routine interface - * Copyright (C) 1986, Sun Microsystems, Inc. - */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -#ifndef __DES_CRYPT_H__ -#define __DES_CRYPT_H__ 1 - -#include <features.h> - -__BEGIN_DECLS - -#define DES_MAXDATA 8192 /* max bytes encrypted in one call */ -#define DES_DIRMASK (1 << 0) -#define DES_ENCRYPT (0*DES_DIRMASK) /* Encrypt */ -#define DES_DECRYPT (1*DES_DIRMASK) /* Decrypt */ - - -#define DES_DEVMASK (1 << 1) -#define DES_HW (0*DES_DEVMASK) /* Use hardware device */ -#define DES_SW (1*DES_DEVMASK) /* Use software device */ - - -#define DESERR_NONE 0 /* succeeded */ -#define DESERR_NOHWDEVICE 1 /* succeeded, but hw device not available */ -#define DESERR_HWERROR 2 /* failed, hardware/driver error */ -#define DESERR_BADPARAM 3 /* failed, bad parameter to call */ - -#define DES_FAILED(err) \ - ((err) > DESERR_NOHWDEVICE) - -/* - * cbc_crypt() - * ecb_crypt() - * - * Encrypt (or decrypt) len bytes of a buffer buf. - * The length must be a multiple of eight. - * The key should have odd parity in the low bit of each byte. - * ivec is the input vector, and is updated to the new one (cbc only). - * The mode is created by oring together the appropriate parameters. - * DESERR_NOHWDEVICE is returned if DES_HW was specified but - * there was no hardware to do it on (the data will still be - * encrypted though, in software). - */ - - -/* - * Cipher Block Chaining mode - */ -extern int cbc_crypt (char *__key, char *__buf, unsigned __len, - unsigned __mode, char *__ivec) __THROW; - -/* - * Electronic Code Book mode - */ -extern int ecb_crypt (char *__key, char *__buf, unsigned __len, - unsigned __mode) __THROW; - -/* - * Set des parity for a key. - * DES parity is odd and in the low bit of each byte - */ -extern void des_setparity (char *__key) __THROW; - -__END_DECLS - -#endif diff --git a/mdk-stage1/dietlibc/include/rpc/key_prot.h b/mdk-stage1/dietlibc/include/rpc/key_prot.h deleted file mode 100644 index 3e2eb7208..000000000 --- a/mdk-stage1/dietlibc/include/rpc/key_prot.h +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#ifndef _KEY_PROT_H_RPCGEN -#define _KEY_PROT_H_RPCGEN - -#include <rpc/rpc.h> - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if 0 -#pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI" -#endif -/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ - -/* - * Compiled from key_prot.x using rpcgen. - * DO NOT EDIT THIS FILE! - * This is NOT source code! - */ -#define PROOT 3 -#define HEXMODULUS "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b" -#define HEXKEYBYTES 48 -#define KEYSIZE 192 -#define KEYBYTES 24 -#define KEYCHECKSUMSIZE 16 - -enum keystatus { - KEY_SUCCESS = 0, - KEY_NOSECRET = 1, - KEY_UNKNOWN = 2, - KEY_SYSTEMERR = 3, -}; -typedef enum keystatus keystatus; -#ifdef __cplusplus -extern "C" bool_t xdr_keystatus(XDR *, keystatus*); -#elif __STDC__ -extern bool_t xdr_keystatus(XDR *, keystatus*); -#else /* Old Style C */ -bool_t xdr_keystatus(); -#endif /* Old Style C */ - - -typedef char keybuf[HEXKEYBYTES]; -#ifdef __cplusplus -extern "C" bool_t xdr_keybuf(XDR *, keybuf); -#elif __STDC__ -extern bool_t xdr_keybuf(XDR *, keybuf); -#else /* Old Style C */ -bool_t xdr_keybuf(); -#endif /* Old Style C */ - - -typedef char *netnamestr; -#ifdef __cplusplus -extern "C" bool_t xdr_netnamestr(XDR *, netnamestr*); -#elif __STDC__ -extern bool_t xdr_netnamestr(XDR *, netnamestr*); -#else /* Old Style C */ -bool_t xdr_netnamestr(); -#endif /* Old Style C */ - - -struct cryptkeyarg { - netnamestr remotename; - des_block deskey; -}; -typedef struct cryptkeyarg cryptkeyarg; -#ifdef __cplusplus -extern "C" bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*); -#elif __STDC__ -extern bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*); -#else /* Old Style C */ -bool_t xdr_cryptkeyarg(); -#endif /* Old Style C */ - - -struct cryptkeyarg2 { - netnamestr remotename; - netobj remotekey; - des_block deskey; -}; -typedef struct cryptkeyarg2 cryptkeyarg2; -#ifdef __cplusplus -extern "C" bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*); -#elif __STDC__ -extern bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*); -#else /* Old Style C */ -bool_t xdr_cryptkeyarg2(); -#endif /* Old Style C */ - - -struct cryptkeyres { - keystatus status; - union { - des_block deskey; - } cryptkeyres_u; -}; -typedef struct cryptkeyres cryptkeyres; -#ifdef __cplusplus -extern "C" bool_t xdr_cryptkeyres(XDR *, cryptkeyres*); -#elif __STDC__ -extern bool_t xdr_cryptkeyres(XDR *, cryptkeyres*); -#else /* Old Style C */ -bool_t xdr_cryptkeyres(); -#endif /* Old Style C */ - -#define MAXGIDS 16 - -struct unixcred { - u_int uid; - u_int gid; - struct { - u_int gids_len; - u_int *gids_val; - } gids; -}; -typedef struct unixcred unixcred; -#ifdef __cplusplus -extern "C" bool_t xdr_unixcred(XDR *, unixcred*); -#elif __STDC__ -extern bool_t xdr_unixcred(XDR *, unixcred*); -#else /* Old Style C */ -bool_t xdr_unixcred(); -#endif /* Old Style C */ - - -struct getcredres { - keystatus status; - union { - unixcred cred; - } getcredres_u; -}; -typedef struct getcredres getcredres; -#ifdef __cplusplus -extern "C" bool_t xdr_getcredres(XDR *, getcredres*); -#elif __STDC__ -extern bool_t xdr_getcredres(XDR *, getcredres*); -#else /* Old Style C */ -bool_t xdr_getcredres(); -#endif /* Old Style C */ - - -struct key_netstarg { - keybuf st_priv_key; - keybuf st_pub_key; - netnamestr st_netname; -}; -typedef struct key_netstarg key_netstarg; -#ifdef __cplusplus -extern "C" bool_t xdr_key_netstarg(XDR *, key_netstarg*); -#elif __STDC__ -extern bool_t xdr_key_netstarg(XDR *, key_netstarg*); -#else /* Old Style C */ -bool_t xdr_key_netstarg(); -#endif /* Old Style C */ - - -struct key_netstres { - keystatus status; - union { - key_netstarg knet; - } key_netstres_u; -}; -typedef struct key_netstres key_netstres; -#ifdef __cplusplus -extern "C" bool_t xdr_key_netstres(XDR *, key_netstres*); -#elif __STDC__ -extern bool_t xdr_key_netstres(XDR *, key_netstres*); -#else /* Old Style C */ -bool_t xdr_key_netstres(); -#endif /* Old Style C */ - - -#ifndef opaque -#define opaque char -#endif - - -#define KEY_PROG ((u_long)100029) -#define KEY_VERS ((u_long)1) - -#ifdef __cplusplus -#define KEY_SET ((u_long)1) -extern "C" keystatus * key_set_1(opaque *, CLIENT *); -extern "C" keystatus * key_set_1_svc(opaque *, struct svc_req *); -#define KEY_ENCRYPT ((u_long)2) -extern "C" cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *); -extern "C" cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *); -#define KEY_DECRYPT ((u_long)3) -extern "C" cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *); -extern "C" cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *); -#define KEY_GEN ((u_long)4) -extern "C" des_block * key_gen_1(void *, CLIENT *); -extern "C" des_block * key_gen_1_svc(void *, struct svc_req *); -#define KEY_GETCRED ((u_long)5) -extern "C" getcredres * key_getcred_1(netnamestr *, CLIENT *); -extern "C" getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *); - -#elif __STDC__ -#define KEY_SET ((u_long)1) -extern keystatus * key_set_1(opaque *, CLIENT *); -extern keystatus * key_set_1_svc(opaque *, struct svc_req *); -#define KEY_ENCRYPT ((u_long)2) -extern cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *); -extern cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *); -#define KEY_DECRYPT ((u_long)3) -extern cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *); -extern cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *); -#define KEY_GEN ((u_long)4) -extern des_block * key_gen_1(void *, CLIENT *); -extern des_block * key_gen_1_svc(void *, struct svc_req *); -#define KEY_GETCRED ((u_long)5) -extern getcredres * key_getcred_1(netnamestr *, CLIENT *); -extern getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *); - -#else /* Old Style C */ -#define KEY_SET ((u_long)1) -extern keystatus * key_set_1(); -extern keystatus * key_set_1_svc(); -#define KEY_ENCRYPT ((u_long)2) -extern cryptkeyres * key_encrypt_1(); -extern cryptkeyres * key_encrypt_1_svc(); -#define KEY_DECRYPT ((u_long)3) -extern cryptkeyres * key_decrypt_1(); -extern cryptkeyres * key_decrypt_1_svc(); -#define KEY_GEN ((u_long)4) -extern des_block * key_gen_1(); -extern des_block * key_gen_1_svc(); -#define KEY_GETCRED ((u_long)5) -extern getcredres * key_getcred_1(); -extern getcredres * key_getcred_1_svc(); -#endif /* Old Style C */ -#define KEY_VERS2 ((u_long)2) - -#ifdef __cplusplus -extern "C" keystatus * key_set_2(opaque *, CLIENT *); -extern "C" keystatus * key_set_2_svc(opaque *, struct svc_req *); -extern "C" cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *); -extern "C" cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *); -extern "C" cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *); -extern "C" cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *); -extern "C" des_block * key_gen_2(void *, CLIENT *); -extern "C" des_block * key_gen_2_svc(void *, struct svc_req *); -extern "C" getcredres * key_getcred_2(netnamestr *, CLIENT *); -extern "C" getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *); -#define KEY_ENCRYPT_PK ((u_long)6) -extern "C" cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *); -extern "C" cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); -#define KEY_DECRYPT_PK ((u_long)7) -extern "C" cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *); -extern "C" cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); -#define KEY_NET_PUT ((u_long)8) -extern "C" keystatus * key_net_put_2(key_netstarg *, CLIENT *); -extern "C" keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *); -#define KEY_NET_GET ((u_long)9) -extern "C" key_netstres * key_net_get_2(void *, CLIENT *); -extern "C" key_netstres * key_net_get_2_svc(void *, struct svc_req *); -#define KEY_GET_CONV ((u_long)10) -extern "C" cryptkeyres * key_get_conv_2(opaque *, CLIENT *); -extern "C" cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *); - -#elif __STDC__ -extern keystatus * key_set_2(opaque *, CLIENT *); -extern keystatus * key_set_2_svc(opaque *, struct svc_req *); -extern cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *); -extern cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *); -extern cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *); -extern cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *); -extern des_block * key_gen_2(void *, CLIENT *); -extern des_block * key_gen_2_svc(void *, struct svc_req *); -extern getcredres * key_getcred_2(netnamestr *, CLIENT *); -extern getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *); -#define KEY_ENCRYPT_PK ((u_long)6) -extern cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *); -extern cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); -#define KEY_DECRYPT_PK ((u_long)7) -extern cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *); -extern cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *); -#define KEY_NET_PUT ((u_long)8) -extern keystatus * key_net_put_2(key_netstarg *, CLIENT *); -extern keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *); -#define KEY_NET_GET ((u_long)9) -extern key_netstres * key_net_get_2(void *, CLIENT *); -extern key_netstres * key_net_get_2_svc(void *, struct svc_req *); -#define KEY_GET_CONV ((u_long)10) -extern cryptkeyres * key_get_conv_2(opaque *, CLIENT *); -extern cryptkeyres * key_get_conv_2_svc(opaque *, struct svc_req *); - -#else /* Old Style C */ -extern keystatus * key_set_2(); -extern keystatus * key_set_2_svc(); -extern cryptkeyres * key_encrypt_2(); -extern cryptkeyres * key_encrypt_2_svc(); -extern cryptkeyres * key_decrypt_2(); -extern cryptkeyres * key_decrypt_2_svc(); -extern des_block * key_gen_2(); -extern des_block * key_gen_2_svc(); -extern getcredres * key_getcred_2(); -extern getcredres * key_getcred_2_svc(); -#define KEY_ENCRYPT_PK ((u_long)6) -extern cryptkeyres * key_encrypt_pk_2(); -extern cryptkeyres * key_encrypt_pk_2_svc(); -#define KEY_DECRYPT_PK ((u_long)7) -extern cryptkeyres * key_decrypt_pk_2(); -extern cryptkeyres * key_decrypt_pk_2_svc(); -#define KEY_NET_PUT ((u_long)8) -extern keystatus * key_net_put_2(); -extern keystatus * key_net_put_2_svc(); -#define KEY_NET_GET ((u_long)9) -extern key_netstres * key_net_get_2(); -extern key_netstres * key_net_get_2_svc(); -#define KEY_GET_CONV ((u_long)10) -extern cryptkeyres * key_get_conv_2(); -extern cryptkeyres * key_get_conv_2_svc(); -#endif /* Old Style C */ - -#endif /* !_KEY_PROT_H_RPCGEN */ diff --git a/mdk-stage1/dietlibc/include/rpc/netdb.h b/mdk-stage1/dietlibc/include/rpc/netdb.h deleted file mode 100644 index da4bddfc4..000000000 --- a/mdk-stage1/dietlibc/include/rpc/netdb.h +++ /dev/null @@ -1,74 +0,0 @@ -/* @(#)netdb.h 2.1 88/07/29 3.9 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)rpc.h 1.8 87/07/24 SMI */ - -/* Cleaned up for GNU C library roland@gnu.ai.mit.edu: - added multiple inclusion protection and use of <sys/cdefs.h>. - In GNU this file is #include'd by <netdb.h>. */ - -#ifndef _RPC_NETDB_H -#define _RPC_NETDB_H 1 - -#include <sys/cdefs.h> - -#define __need_size_t -#include <stddef.h> - -__BEGIN_DECLS - -struct rpcent -{ - char *r_name; /* Name of server for this rpc program. */ - char **r_aliases; /* Alias list. */ - int r_number; /* RPC program number. */ -}; - -extern void setrpcent (int __stayopen) __THROW; -extern void endrpcent (void) __THROW; -extern struct rpcent *getrpcbyname (__const char *__name) __THROW; -extern struct rpcent *getrpcbynumber (int __number) __THROW; -extern struct rpcent *getrpcent (void) __THROW; - -#ifdef __USE_MISC -extern int getrpcbyname_r (__const char *__name, struct rpcent *__result_buf, - char *__buffer, size_t __buflen, - struct rpcent **__result) __THROW; - -extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf, - char *__buffer, size_t __buflen, - struct rpcent **__result) __THROW; - -extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer, - size_t __buflen, struct rpcent **__result) __THROW; -#endif - -__END_DECLS - -#endif /* rpc/netdb.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h b/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h deleted file mode 100644 index 68bc8d8ec..000000000 --- a/mdk-stage1/dietlibc/include/rpc/pmap_clnt.h +++ /dev/null @@ -1,98 +0,0 @@ -/* @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.11 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * pmap_clnt.h - * Supplies C routines to get to portmap services. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _RPC_PMAP_CLNT_H -#define _RPC_PMAP_CLNT_H 1 - -#include <sys/cdefs.h> -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/clnt.h> - -__BEGIN_DECLS - -typedef bool_t (*resultproc_t) (caddr_t resp, struct sockaddr_in *raddr); - -/* - * Usage: - * success = pmap_set(program, version, protocol, port); - * success = pmap_unset(program, version); - * port = pmap_getport(address, program, version, protocol); - * head = pmap_getmaps(address); - * clnt_stat = pmap_rmtcall(address, program, version, procedure, - * xdrargs, argsp, xdrres, resp, tout, port_ptr) - * (works for udp only.) - * clnt_stat = clnt_broadcast(program, version, procedure, - * xdrargs, argsp, xdrres, resp, eachresult) - * (like pmap_rmtcall, except the call is broadcasted to all - * locally connected nets. For each valid response received, - * the procedure eachresult is called. Its form is: - * done = eachresult(resp, raddr) - * bool_t done; - * caddr_t resp; - * struct sockaddr_in raddr; - * where resp points to the results of the call and raddr is the - * address if the responder to the broadcast. - */ - -extern bool_t pmap_set (__const u_long __program, __const u_long __vers, - int __protocol, u_short __port) __THROW; -extern bool_t pmap_unset (__const u_long __program, __const u_long __vers) - __THROW; -extern struct pmaplist *pmap_getmaps (struct sockaddr_in *__address) __THROW; -extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr, - __const u_long __prog, - __const u_long __vers, - __const u_long __proc, - xdrproc_t __xdrargs, - caddr_t __argsp, xdrproc_t __xdrres, - caddr_t __resp, struct timeval __tout, - u_long *__port_ptr) __THROW; -extern enum clnt_stat clnt_broadcast (__const u_long __prog, - __const u_long __vers, - __const u_long __proc, xdrproc_t __xargs, - caddr_t __argsp, xdrproc_t __xresults, - caddr_t __resultsp, - resultproc_t __eachresult) __THROW; -extern u_short pmap_getport (struct sockaddr_in *__address, - __const u_long __program, - __const u_long __version, u_int __protocol) - __THROW; - -__END_DECLS - -#endif /* rpc/pmap_clnt.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_prot.h b/mdk-stage1/dietlibc/include/rpc/pmap_prot.h deleted file mode 100644 index fd7fb8e7e..000000000 --- a/mdk-stage1/dietlibc/include/rpc/pmap_prot.h +++ /dev/null @@ -1,108 +0,0 @@ -/* @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC; from 1.14 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * pmap_prot.h - * Protocol for the local binder service, or pmap. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _RPC_PMAP_PROT_H -#define _RPC_PMAP_PROT_H 1 - -#include <sys/cdefs.h> - -#include <rpc/xdr.h> - -__BEGIN_DECLS - -/* The following procedures are supported by the protocol: - * - * PMAPPROC_NULL() returns () - * takes nothing, returns nothing - * - * PMAPPROC_SET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Registers the tuple - * [prog, vers, prot, port]. - * - * PMAPPROC_UNSET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Un-registers pair - * [prog, vers]. prot and port are ignored. - * - * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). - * 0 is failure. Otherwise returns the port number where the pair - * [prog, vers] is registered. It may lie! - * - * PMAPPROC_DUMP() RETURNS (struct pmaplist *) - * - * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) - * RETURNS (port, string<>); - * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); - * Calls the procedure on the local machine. If it is not registered, - * this procedure is quite; ie it does not return error information!!! - * This procedure only is supported on rpc/udp and calls via - * rpc/udp. This routine only passes null authentication parameters. - * This file has no interface to xdr routines for PMAPPROC_CALLIT. - * - * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. - */ - -#define PMAPPORT ((u_short)111) -#define PMAPPROG ((u_long)100000) -#define PMAPVERS ((u_long)2) -#define PMAPVERS_PROTO ((u_long)2) -#define PMAPVERS_ORIG ((u_long)1) -#define PMAPPROC_NULL ((u_long)0) -#define PMAPPROC_SET ((u_long)1) -#define PMAPPROC_UNSET ((u_long)2) -#define PMAPPROC_GETPORT ((u_long)3) -#define PMAPPROC_DUMP ((u_long)4) -#define PMAPPROC_CALLIT ((u_long)5) - -struct pmap { - long unsigned pm_prog; - long unsigned pm_vers; - long unsigned pm_prot; - long unsigned pm_port; -}; - -extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs) __THROW; - -struct pmaplist { - struct pmap pml_map; - struct pmaplist *pml_next; -}; - -extern bool_t xdr_pmaplist (XDR *__xdrs, struct pmaplist **__rp) __THROW; - -__END_DECLS - -#endif /* rpc/pmap_prot.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h b/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h deleted file mode 100644 index 160f998ca..000000000 --- a/mdk-stage1/dietlibc/include/rpc/pmap_rmt.h +++ /dev/null @@ -1,68 +0,0 @@ -/* @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC; from 1.2 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * Structures and XDR routines for parameters to and replies from - * the portmapper remote-call-service. - * - * Copyright (C) 1986, Sun Microsystems, Inc. - */ - -#ifndef _RPC_PMAP_RMT_H -#define _RPC_PMAP_RMT_H 1 - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <rpc/types.h> -#include <rpc/xdr.h> - -__BEGIN_DECLS - -struct rmtcallargs { - u_long prog, vers, proc, arglen; - caddr_t args_ptr; - xdrproc_t xdr_args; -}; - -extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp) - __THROW; - -struct rmtcallres { - u_long *port_ptr; - u_long resultslen; - caddr_t results_ptr; - xdrproc_t xdr_results; -}; - -extern bool_t xdr_rmtcallres (XDR *__xdrs, struct rmtcallres *__crp) __THROW; - -__END_DECLS - -#endif /* rpc/pmap_rmt.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/rpc.h b/mdk-stage1/dietlibc/include/rpc/rpc.h deleted file mode 100644 index 20b341d74..000000000 --- a/mdk-stage1/dietlibc/include/rpc/rpc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * rpc.h, Just includes the billions of rpc header files necessary to - * do remote procedure calling. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _RPC_RPC_H -#define _RPC_RPC_H 1 - -#include <rpc/types.h> /* some typedefs */ -#include <netinet/in.h> - -/* external data representation interfaces */ -#include <rpc/xdr.h> /* generic (de)serializer */ - -/* Client side only authentication */ -#include <rpc/auth.h> /* generic authenticator (client side) */ - -/* Client side (mostly) remote procedure call */ -#include <rpc/clnt.h> /* generic rpc stuff */ - -/* semi-private protocol headers */ -#include <rpc/rpc_msg.h> /* protocol for rpc messages */ -#include <rpc/auth_unix.h> /* protocol for unix style cred */ -#include <rpc/auth_des.h> /* protocol for des style cred */ - -/* Server side only remote procedure callee */ -#include <rpc/svc.h> /* service manager and multiplexer */ -#include <rpc/svc_auth.h> /* service side authenticator */ - -/* - * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION - * OF UNIX BASED ON NFSSRC. These systems will already have the structures - * defined by <rpc/netdb.h> included in <netdb.h>. - */ -/* routines for parsing /etc/rpc */ -#include <rpc/netdb.h> /* structures and routines to parse /etc/rpc */ - -int bindresvport(int sd, struct sockaddr_in* sin) __THROW; - -#endif /* rpc/rpc.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/rpc_des.h b/mdk-stage1/dietlibc/include/rpc/rpc_des.h deleted file mode 100644 index 0f36d1697..000000000 --- a/mdk-stage1/dietlibc/include/rpc/rpc_des.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Generic DES driver interface - * Keep this file hardware independent! - * Copyright (c) 1986 by Sun Microsystems, Inc. - */ - -#ifndef _DES_H -#define _DES_H - -#include <sys/types.h> - -#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ -#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ - -enum desdir - { - ENCRYPT, DECRYPT - }; -enum desmode - { - CBC, ECB - }; - -/* - * parameters to ioctl call - */ -struct desparams - { - u_char des_key[8]; /* key (with low bit parity) */ - enum desdir des_dir; /* direction */ - enum desmode des_mode; /* mode */ - u_char des_ivec[8]; /* input vector */ - unsigned des_len; /* number of bytes to crypt */ - union - { - u_char UDES_data[DES_QUICKLEN]; - u_char *UDES_buf; - } - UDES; -#define des_data UDES.UDES_data /* direct data here if quick */ -#define des_buf UDES.UDES_buf /* otherwise, pointer to data */ - }; - -#endif diff --git a/mdk-stage1/dietlibc/include/rpc/rpc_msg.h b/mdk-stage1/dietlibc/include/rpc/rpc_msg.h deleted file mode 100644 index 636d60ea9..000000000 --- a/mdk-stage1/dietlibc/include/rpc/rpc_msg.h +++ /dev/null @@ -1,202 +0,0 @@ -/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)rpc_msg.h 1.7 86/07/16 SMI */ - -#ifndef _RPC_MSG_H -#define _RPC_MSG_H 1 - -#include <sys/cdefs.h> - -#include <rpc/xdr.h> -#include <rpc/clnt.h> - -/* - * rpc_msg.h - * rpc message definition - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#define RPC_MSG_VERSION ((u_long) 2) -#define RPC_SERVICE_PORT ((u_short) 2048) - -__BEGIN_DECLS - -/* - * Bottom up definition of an rpc message. - * NOTE: call and reply use the same overall struct but - * different parts of unions within it. - */ - -enum msg_type { - CALL=0, - REPLY=1 -}; - -enum reply_stat { - MSG_ACCEPTED=0, - MSG_DENIED=1 -}; - -enum accept_stat { - SUCCESS=0, - PROG_UNAVAIL=1, - PROG_MISMATCH=2, - PROC_UNAVAIL=3, - GARBAGE_ARGS=4, - SYSTEM_ERR=5 -}; - -enum reject_stat { - RPC_MISMATCH=0, - AUTH_ERROR=1 -}; - -/* - * Reply part of an rpc exchange - */ - -/* - * Reply to an rpc request that was accepted by the server. - * Note: there could be an error even though the request was - * accepted. - */ -struct accepted_reply { - struct opaque_auth ar_verf; - enum accept_stat ar_stat; - union { - struct { - u_long low; - u_long high; - } AR_versions; - struct { - caddr_t where; - xdrproc_t proc; - } AR_results; - /* and many other null cases */ - } ru; -#define ar_results ru.AR_results -#define ar_vers ru.AR_versions -}; - -/* - * Reply to an rpc request that was rejected by the server. - */ -struct rejected_reply { - enum reject_stat rj_stat; - union { - struct { - u_long low; - u_long high; - } RJ_versions; - enum auth_stat RJ_why; /* why authentication did not work */ - } ru; -#define rj_vers ru.RJ_versions -#define rj_why ru.RJ_why -}; - -/* - * Body of a reply to an rpc request. - */ -struct reply_body { - enum reply_stat rp_stat; - union { - struct accepted_reply RP_ar; - struct rejected_reply RP_dr; - } ru; -#define rp_acpt ru.RP_ar -#define rp_rjct ru.RP_dr -}; - -/* - * Body of an rpc request call. - */ -struct call_body { - u_long cb_rpcvers; /* must be equal to two */ - u_long cb_prog; - u_long cb_vers; - u_long cb_proc; - struct opaque_auth cb_cred; - struct opaque_auth cb_verf; /* protocol specific - provided by client */ -}; - -/* - * The rpc message - */ -struct rpc_msg { - u_long rm_xid; - enum msg_type rm_direction; - union { - struct call_body RM_cmb; - struct reply_body RM_rmb; - } ru; -#define rm_call ru.RM_cmb -#define rm_reply ru.RM_rmb -}; -#define acpted_rply ru.RM_rmb.ru.RP_ar -#define rjcted_rply ru.RM_rmb.ru.RP_dr - - -/* - * XDR routine to handle a rpc message. - * xdr_callmsg(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW; - -/* - * XDR routine to pre-serialize the static part of a rpc message. - * xdr_callhdr(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; - */ -extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW; - -/* - * XDR routine to handle a rpc reply. - * xdr_replymsg(xdrs, rmsg) - * XDR *xdrs; - * struct rpc_msg *rmsg; - */ -extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW; - -/* - * Fills in the error part of a reply message. - * _seterr_reply(msg, error) - * struct rpc_msg *msg; - * struct rpc_err *error; - */ -extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error) - __THROW; - -__END_DECLS - -#endif /* rpc/rpc_msg.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/svc.h b/mdk-stage1/dietlibc/include/rpc/svc.h deleted file mode 100644 index 27c997dde..000000000 --- a/mdk-stage1/dietlibc/include/rpc/svc.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * svc.h, Server-side remote procedure call interface. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _RPC_SVC_H -#define _RPC_SVC_H 1 - -#include <sys/cdefs.h> -#include <rpc/rpc_msg.h> - -__BEGIN_DECLS - -/* - * This interface must manage two items concerning remote procedure calling: - * - * 1) An arbitrary number of transport connections upon which rpc requests - * are received. The two most notable transports are TCP and UDP; they are - * created and registered by routines in svc_tcp.c and svc_udp.c, respectively; - * they in turn call xprt_register and xprt_unregister. - * - * 2) An arbitrary number of locally registered services. Services are - * described by the following four data: program number, version number, - * "service dispatch" function, a transport handle, and a boolean that - * indicates whether or not the exported program should be registered with a - * local binder service; if true the program's number and version and the - * port number from the transport handle are registered with the binder. - * These data are registered with the rpc svc system via svc_register. - * - * A service's dispatch function is called whenever an rpc request comes in - * on a transport. The request's program and version numbers must match - * those of the registered service. The dispatch function is passed two - * parameters, struct svc_req * and SVCXPRT *, defined below. - */ - -enum xprt_stat { - XPRT_DIED, - XPRT_MOREREQS, - XPRT_IDLE -}; - -/* - * Server side transport handle - */ -typedef struct SVCXPRT SVCXPRT; -struct SVCXPRT { - int xp_sock; - u_short xp_port; /* associated port number */ - const struct xp_ops { - bool_t (*xp_recv) (SVCXPRT *__xprt, struct rpc_msg *__msg); - /* receive incoming requests */ - enum xprt_stat (*xp_stat) (SVCXPRT *__xprt); - /* get transport status */ - bool_t (*xp_getargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, - caddr_t args_ptr); /* get arguments */ - bool_t (*xp_reply) (SVCXPRT *__xprt, struct rpc_msg *__msg); - /* send reply */ - bool_t (*xp_freeargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, - caddr_t args_ptr); - /* free mem allocated for args */ - void (*xp_destroy) (SVCXPRT *__xprt); - /* destroy this struct */ - } *xp_ops; - int xp_addrlen; /* length of remote address */ - struct sockaddr_in xp_raddr; /* remote address */ - struct opaque_auth xp_verf; /* raw response verifier */ - caddr_t xp_p1; /* private */ - caddr_t xp_p2; /* private */ - char xp_pad [256]; /* padding, internal use */ -}; - -/* - * Approved way of getting address of caller - */ -#define svc_getcaller(x) (&(x)->xp_raddr) - -/* - * Operations defined on an SVCXPRT handle - * - * SVCXPRT *xprt; - * struct rpc_msg *msg; - * xdrproc_t xargs; - * caddr_t argsp; - */ -#define SVC_RECV(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) -#define svc_recv(xprt, msg) \ - (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) - -#define SVC_STAT(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) -#define svc_stat(xprt) \ - (*(xprt)->xp_ops->xp_stat)(xprt) - -#define SVC_GETARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) -#define svc_getargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp)) - -#define SVC_REPLY(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) -#define svc_reply(xprt, msg) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg)) - -#define SVC_FREEARGS(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) -#define svc_freeargs(xprt, xargs, argsp) \ - (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp)) - -#define SVC_DESTROY(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) -#define svc_destroy(xprt) \ - (*(xprt)->xp_ops->xp_destroy)(xprt) - - -/* - * Service request - */ -struct svc_req { - rpcprog_t rq_prog; /* service program number */ - rpcvers_t rq_vers; /* service protocol version */ - rpcproc_t rq_proc; /* the desired procedure */ - struct opaque_auth rq_cred; /* raw creds from the wire */ - caddr_t rq_clntcred; /* read only cooked cred */ - SVCXPRT *rq_xprt; /* associated transport */ -}; - -#ifndef __DISPATCH_FN_T -#define __DISPATCH_FN_T -typedef void (*__dispatch_fn_t) (struct svc_req*, SVCXPRT*); -#endif - -/* - * Service registration - * - * svc_register(xprt, prog, vers, dispatch, protocol) - * SVCXPRT *xprt; - * rpcprog_t prog; - * rpcvers_t vers; - * void (*dispatch)(struct svc_req*, SVCXPRT*); - * rpcprot_t protocol; like TCP or UDP, zero means do not register - */ -extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog, - rpcvers_t __vers, __dispatch_fn_t __dispatch, - rpcprot_t __protocol) __THROW; - -/* - * Service un-registration - * - * svc_unregister(prog, vers) - * rpcprog_t prog; - * rpcvers_t vers; - */ -extern void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW; - -/* - * Transport registration. - * - * xprt_register(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_register (SVCXPRT *__xprt) __THROW; - -/* - * Transport un-register - * - * xprt_unregister(xprt) - * SVCXPRT *xprt; - */ -extern void xprt_unregister (SVCXPRT *__xprt) __THROW; - - -/* - * When the service routine is called, it must first check to see if it - * knows about the procedure; if not, it should call svcerr_noproc - * and return. If so, it should deserialize its arguments via - * SVC_GETARGS (defined above). If the deserialization does not work, - * svcerr_decode should be called followed by a return. Successful - * decoding of the arguments should be followed the execution of the - * procedure's code and a call to svc_sendreply. - * - * Also, if the service refuses to execute the procedure due to too- - * weak authentication parameters, svcerr_weakauth should be called. - * Note: do not confuse access-control failure with weak authentication! - * - * NB: In pure implementations of rpc, the caller always waits for a reply - * msg. This message is sent when svc_sendreply is called. - * Therefore pure service implementations should always call - * svc_sendreply even if the function logically returns void; use - * xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows - * for the abuse of pure rpc via batched calling or pipelining. In the - * case of a batched call, svc_sendreply should NOT be called since - * this would send a return message, which is what batching tries to avoid. - * It is the service/protocol writer's responsibility to know which calls are - * batched and which are not. Warning: responding to batch calls may - * deadlock the caller and server processes! - */ - -extern bool_t svc_sendreply (SVCXPRT *xprt, xdrproc_t __xdr_results, - caddr_t __xdr_location) __THROW; - -extern void svcerr_decode (SVCXPRT *__xprt) __THROW; - -extern void svcerr_weakauth (SVCXPRT *__xprt) __THROW; - -extern void svcerr_noproc (SVCXPRT *__xprt) __THROW; - -extern void svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers, - rpcvers_t __high_vers) __THROW; - -extern void svcerr_auth (SVCXPRT *__xprt, enum auth_stat __why) __THROW; - -extern void svcerr_noprog (SVCXPRT *__xprt) __THROW; - -extern void svcerr_systemerr (SVCXPRT *__xprt) __THROW; - -/* - * Lowest level dispatching -OR- who owns this process anyway. - * Somebody has to wait for incoming requests and then call the correct - * service routine. The routine svc_run does infinite waiting; i.e., - * svc_run never returns. - * Since another (coexistent) package may wish to selectively wait for - * incoming calls or other events outside of the rpc architecture, the - * routine svc_getreq is provided. It must be passed readfds, the - * "in-place" results of a select system call (see select, section 2). - */ - -/* - * Global keeper of rpc service descriptors in use - * dynamic; must be inspected before each call to select - */ - -extern struct pollfd *svc_pollfd; -extern int svc_max_pollfd; -extern fd_set svc_fdset; -#define svc_fds svc_fdset.fds_bits[0] /* compatibility */ - -/* - * a small program implemented by the svc_rpc implementation itself; - * also see clnt.h for protocol numbers. - */ -extern void svc_getreq (int __rdfds) __THROW; -extern void svc_getreq_common (const int __fd) __THROW; -extern void svc_getreqset (fd_set *__readfds) __THROW; -extern void svc_getreq_poll (struct pollfd *, const int) __THROW; -extern void svc_exit (void) __THROW; -extern void svc_run (void) __THROW; - -/* - * Socket to use on svcxxx_create call to get default socket - */ -#define RPC_ANYSOCK -1 - -/* - * These are the existing service side transport implementations - */ - -/* - * Memory based rpc for testing and timing. - */ -extern SVCXPRT *svcraw_create (void) __THROW; - -/* - * Udp based rpc. - */ -extern SVCXPRT *svcudp_create (int __sock) __THROW; -extern SVCXPRT *svcudp_bufcreate (int __sock, u_int __sendsz, u_int __recvsz) - __THROW; - -/* - * Tcp based rpc. - */ -extern SVCXPRT *svctcp_create (int __sock, u_int __sendsize, u_int __recvsize) - __THROW; - - -/* - * Unix based rpc. - */ -extern SVCXPRT *svcunix_create (int __sock, u_int __sendsize, u_int __recvsize, - char *__path) __THROW; - - -__END_DECLS - -#endif /* rpc/svc.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/svc_auth.h b/mdk-stage1/dietlibc/include/rpc/svc_auth.h deleted file mode 100644 index cd4b8da29..000000000 --- a/mdk-stage1/dietlibc/include/rpc/svc_auth.h +++ /dev/null @@ -1,54 +0,0 @@ -/* @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* @(#)svc_auth.h 1.6 86/07/16 SMI */ - -/* - * svc_auth.h, Service side of rpc authentication. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _RPC_SVC_AUTH_H -#define _RPC_SVC_AUTH_H 1 - -#include <sys/cdefs.h> -#include <rpc/svc.h> - -__BEGIN_DECLS - -/* - * Server side authenticator - */ -extern enum auth_stat _authenticate (struct svc_req *__rqst, - struct rpc_msg *__msg) __THROW; - -__END_DECLS - -#endif /* rpc/svc_auth.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/types.h b/mdk-stage1/dietlibc/include/rpc/types.h deleted file mode 100644 index e2e8402be..000000000 --- a/mdk-stage1/dietlibc/include/rpc/types.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* fixincludes should not add extern "C" to this file */ -/* - * Rpc additions to <sys/types.h> - */ -#ifndef _RPC_TYPES_H -#define _RPC_TYPES_H 1 - -typedef int bool_t; -typedef int enum_t; -/* This needs to be changed to uint32_t in the future */ -typedef unsigned long rpcprog_t; -typedef unsigned long rpcvers_t; -typedef unsigned long rpcproc_t; -typedef unsigned long rpcprot_t; -typedef unsigned long rpcport_t; - -#define __dontcare__ -1 - -#ifndef FALSE -# define FALSE (0) -#endif - -#ifndef TRUE -# define TRUE (1) -#endif - -#ifndef NULL -# define NULL 0 -#endif - -#include <stdlib.h> /* For malloc decl. */ -#define mem_alloc(bsize) malloc(bsize) -#define mem_free(ptr, bsize) free(ptr) - -#ifndef makedev /* ie, we haven't already included it */ -#include <sys/types.h> -#endif -#include <sys/time.h> -#include <sys/param.h> - -#include <netinet/in.h> - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK (u_long)0x7F000001 -#endif -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - -#endif /* rpc/types.h */ diff --git a/mdk-stage1/dietlibc/include/rpc/xdr.h b/mdk-stage1/dietlibc/include/rpc/xdr.h deleted file mode 100644 index ce092f085..000000000 --- a/mdk-stage1/dietlibc/include/rpc/xdr.h +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * xdr.h, External Data Representation Serialization Routines. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#ifndef _RPC_XDR_H -#define _RPC_XDR_H 1 - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <rpc/types.h> - -/* We need FILE. */ -#include <stdio.h> - -__BEGIN_DECLS - -/* - * XDR provides a conventional way for converting between C data - * types and an external bit-string representation. Library supplied - * routines provide for the conversion on built-in C data types. These - * routines and utility routines defined here are used to help implement - * a type encode/decode routine for each user-defined type. - * - * Each data type provides a single procedure which takes two arguments: - * - * bool_t - * xdrproc(xdrs, argresp) - * XDR *xdrs; - * <type> *argresp; - * - * xdrs is an instance of a XDR handle, to which or from which the data - * type is to be converted. argresp is a pointer to the structure to be - * converted. The XDR handle contains an operation field which indicates - * which of the operations (ENCODE, DECODE * or FREE) is to be performed. - * - * XDR_DECODE may allocate space if the pointer argresp is null. This - * data can be freed with the XDR_FREE operation. - * - * We write only one procedure per data type to make it easy - * to keep the encode and decode procedures for a data type consistent. - * In many cases the same code performs all operations on a user defined type, - * because all the hard work is done in the component type routines. - * decode as a series of calls on the nested data types. - */ - -/* - * Xdr operations. XDR_ENCODE causes the type to be encoded into the - * stream. XDR_DECODE causes the type to be extracted from the stream. - * XDR_FREE can be used to release the space allocated by an XDR_DECODE - * request. - */ -enum xdr_op { - XDR_ENCODE = 0, - XDR_DECODE = 1, - XDR_FREE = 2 -}; - -/* - * This is the number of bytes per unit of external data. - */ -#define BYTES_PER_XDR_UNIT (4) -/* - * This only works if the above is a power of 2. But it's defined to be - * 4 by the appropriate RFCs. So it will work. And it's normally quicker - * than the old routine. - */ -#if 1 -#define RNDUP(x) (((x) + BYTES_PER_XDR_UNIT - 1) & ~(BYTES_PER_XDR_UNIT - 1)) -#else /* this is the old routine */ -#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \ - * BYTES_PER_XDR_UNIT) -#endif - -/* - * The XDR handle. - * Contains operation which is being applied to the stream, - * an operations vector for the particular implementation (e.g. see xdr_mem.c), - * and two private fields for the use of the particular implementation. - */ -typedef struct XDR XDR; -struct XDR - { - enum xdr_op x_op; /* operation; fast additional param */ - struct xdr_ops - { - bool_t (*x_getlong) (XDR *__xdrs, long *__lp); - /* get a long from underlying stream */ - bool_t (*x_putlong) (XDR *__xdrs, const long *__lp); - /* put a long to " */ - bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len); - /* get some bytes from " */ - bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, u_int __len); - /* put some bytes to " */ - u_int (*x_getpostn) (const XDR *__xdrs); - /* returns bytes off from beginning */ - bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos); - /* lets you reposition the stream */ - int32_t *(*x_inline) (XDR *__xdrs, int __len); - /* buf quick ptr to buffered data */ - void (*x_destroy) (XDR *__xdrs); - /* free privates of this xdr_stream */ - bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip); - /* get a int from underlying stream */ - bool_t (*x_putint32) (XDR *__xdrs, const int32_t *__ip); - /* put a int to " */ - } - *x_ops; - caddr_t x_public; /* users' data */ - caddr_t x_private; /* pointer to private data */ - caddr_t x_base; /* private used for position info */ - int x_handy; /* extra private word */ - }; - -/* - * A xdrproc_t exists for each data type which is to be encoded or decoded. - * - * The second argument to the xdrproc_t is a pointer to an opaque pointer. - * The opaque pointer generally points to a structure of the data type - * to be decoded. If this pointer is 0, then the type routines should - * allocate dynamic storage of the appropriate size and return it. - * bool_t (*xdrproc_t)(XDR *, caddr_t *); - */ -typedef bool_t (*xdrproc_t) (XDR *, void *,...); - - -/* - * Operations defined on a XDR handle - * - * XDR *xdrs; - * int32_t *int32p; - * long *longp; - * caddr_t addr; - * u_int len; - * u_int pos; - */ -#define XDR_GETINT32(xdrs, int32p) \ - (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) -#define xdr_getint32(xdrs, int32p) \ - (*(xdrs)->x_ops->x_getint32)(xdrs, int32p) - -#define XDR_PUTINT32(xdrs, int32p) \ - (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) -#define xdr_putint32(xdrs, int32p) \ - (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) - -#define XDR_GETLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) - -#define XDR_PUTLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) - -#define XDR_GETBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) -#define xdr_getbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) - -#define XDR_PUTBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) -#define xdr_putbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) - -#define XDR_GETPOS(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) -#define xdr_getpos(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) - -#define XDR_SETPOS(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) -#define xdr_setpos(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) - -#define XDR_INLINE(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) -#define xdr_inline(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) - -#define XDR_DESTROY(xdrs) \ - do { \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs); \ - } while (0) -#define xdr_destroy(xdrs) \ - do { \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs); \ - } while (0) - -/* - * Support struct for discriminated unions. - * You create an array of xdrdiscrim structures, terminated with - * a entry with a null procedure pointer. The xdr_union routine gets - * the discriminant value and then searches the array of structures - * for a matching value. If a match is found the associated xdr routine - * is called to handle that part of the union. If there is - * no match, then a default routine may be called. - * If there is no match and no default routine it is an error. - */ -#define NULL_xdrproc_t ((xdrproc_t)0) -struct xdr_discrim -{ - int value; - xdrproc_t proc; -}; - -/* - * Inline routines for fast encode/decode of primitive data types. - * Caveat emptor: these use single memory cycles to get the - * data from the underlying buffer, and will fail to operate - * properly if the data is not aligned. The standard way to use these - * is to say: - * if ((buf = XDR_INLINE(xdrs, count)) == NULL) - * return (FALSE); - * <<< macro calls >>> - * where ``count'' is the number of bytes of data occupied - * by the primitive data types. - * - * N.B. and frozen for all time: each data type here uses 4 bytes - * of external representation. - */ - -#define IXDR_GET_INT32(buf) ((int32_t)ntohl((uint32_t)*(buf)++)) -#define IXDR_PUT_INT32(buf, v) (*(buf)++ = (int32_t)htonl((uint32_t)(v))) -#define IXDR_GET_U_INT32(buf) ((uint32_t)IXDR_GET_INT32(buf)) -#define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32(buf, (int32_t)(v)) - -/* WARNING: The IXDR_*_LONG defines are removed by Sun for new platforms - * and shouldn't be used any longer. Code which use this defines or longs - * in the RPC code will not work on 64bit Solaris platforms ! - */ -#define IXDR_GET_LONG(buf) \ - ((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++)) -#define IXDR_PUT_LONG(buf, v) \ - (*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v))) -#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_LONG(buf)) -#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v)) - - -#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) -#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) -#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_LONG(buf)) -#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_LONG(buf)) - -#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_LONG(buf, (long)(v)) -#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_LONG(buf, (long)(v)) -#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v)) -#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_LONG(buf, (long)(v)) - -/* - * These are the "generic" xdr routines. - * None of these can have const applied because it's not possible to - * know whether the call is a read or a write to the passed parameter - * also, the XDR structure is always updated by some of these calls. - */ -extern bool_t xdr_void (void) __THROW; -extern bool_t xdr_short (XDR *__xdrs, short *__sp) __THROW; -extern bool_t xdr_u_short (XDR *__xdrs, u_short *__usp) __THROW; -extern bool_t xdr_int (XDR *__xdrs, int *__ip) __THROW; -extern bool_t xdr_u_int (XDR *__xdrs, u_int *__up) __THROW; -extern bool_t xdr_long (XDR *__xdrs, long *__lp) __THROW; -extern bool_t xdr_u_long (XDR *__xdrs, u_long *__ulp) __THROW; -extern bool_t xdr_hyper (XDR *__xdrs, __quad_t *__llp) __THROW; -extern bool_t xdr_u_hyper (XDR *__xdrs, __u_quad_t *__ullp) __THROW; -extern bool_t xdr_longlong_t (XDR *__xdrs, __quad_t *__llp) __THROW; -extern bool_t xdr_u_longlong_t (XDR *__xdrs, __u_quad_t *__ullp) __THROW; -extern bool_t xdr_int8_t (XDR *__xdrs, int8_t *__ip) __THROW; -extern bool_t xdr_uint8_t (XDR *__xdrs, uint8_t *__up) __THROW; -extern bool_t xdr_int16_t (XDR *__xdrs, int16_t *__ip) __THROW; -extern bool_t xdr_uint16_t (XDR *__xdrs, uint16_t *__up) __THROW; -extern bool_t xdr_int32_t (XDR *__xdrs, int32_t *__ip) __THROW; -extern bool_t xdr_uint32_t (XDR *__xdrs, uint32_t *__up) __THROW; -extern bool_t xdr_int64_t (XDR *__xdrs, int64_t *__ip) __THROW; -extern bool_t xdr_uint64_t (XDR *__xdrs, uint64_t *__up) __THROW; -extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW; -extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW; -extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep, - u_int __maxsize, u_int __elsize, xdrproc_t __elproc) - __THROW; -extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep, - u_int __maxsize) __THROW; -extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW; -extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW; -extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp, - const struct xdr_discrim *__choices, - xdrproc_t dfault) __THROW; -extern bool_t xdr_char (XDR *__xdrs, char *__cp) __THROW; -extern bool_t xdr_u_char (XDR *__xdrs, u_char *__cp) __THROW; -extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem, - u_int __elemsize, xdrproc_t __xdr_elem) __THROW; -extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW; -extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW; -extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size, - xdrproc_t __proc) __THROW; -extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp, - u_int __obj_size, xdrproc_t __xdr_obj) __THROW; -extern bool_t xdr_wrapstring (XDR *__xdrs, char **__cpp) __THROW; -extern u_long xdr_sizeof (xdrproc_t, void *) __THROW; - -/* - * Common opaque bytes objects used by many rpc protocols; - * declared here due to commonality. - */ -#define MAX_NETOBJ_SZ 1024 -struct netobj -{ - u_int n_len; - char *n_bytes; -}; -typedef struct netobj netobj; -extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW; - -/* - * These are the public routines for the various implementations of - * xdr streams. - */ - -/* XDR using memory buffers */ -extern void xdrmem_create (XDR *__xdrs, const caddr_t __addr, - u_int __size, enum xdr_op __xop) __THROW; - -/* XDR using stdio library */ -extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop) - __THROW; - -/* XDR pseudo records for tcp */ -extern void xdrrec_create (XDR *__xdrs, u_int __sendsize, - u_int __recvsize, caddr_t __tcp_handle, - int (*__readit) (char *, char *, int), - int (*__writeit) (char *, char *, int)) __THROW; - -/* make end of xdr record */ -extern bool_t xdrrec_endofrecord (XDR *__xdrs, bool_t __sendnow) __THROW; - -/* move to beginning of next record */ -extern bool_t xdrrec_skiprecord (XDR *__xdrs) __THROW; - -/* true if no more input */ -extern bool_t xdrrec_eof (XDR *__xdrs) __THROW; - -/* free memory buffers for xdr */ -extern void xdr_free (xdrproc_t __proc, char *__objp) __THROW; - -__END_DECLS - -#endif /* rpc/xdr.h */ diff --git a/mdk-stage1/dietlibc/include/sched.h b/mdk-stage1/dietlibc/include/sched.h deleted file mode 100644 index 5e4430d29..000000000 --- a/mdk-stage1/dietlibc/include/sched.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef _SCHED_H -#define _SCHED_H 1 - -#include <time.h> - -#include <sys/types.h> -#ifndef u16 -#define u16 __u16 -#endif - -/* till those F**KIN' kernel headers are sane: A COPY ! - * #include <linux/sched.h> - * A COPY OF THE STUFF WE NEED.... *GRUMBLE* */ - -/* - * cloning flags: - */ -#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ -#define CLONE_VM 0x00000100 /* set if VM shared between processes */ -#define CLONE_FS 0x00000200 /* set if fs info shared between processes */ -#define CLONE_FILES 0x00000400 /* set if open files shared between processes */ -#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ -#define CLONE_PID 0x00001000 /* set if pid shared */ -#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ -#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ -#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ -#define CLONE_THREAD 0x00010000 /* Same thread group? */ - -#define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREA) - -/* - * Scheduling policies - */ -#define SCHED_OTHER 0 -#define SCHED_FIFO 1 -#define SCHED_RR 2 - -/* - * This is an additional bit set when we want to - * yield the CPU for one re-schedule.. - */ -#define SCHED_YIELD 0x10 - -struct sched_param { - int sched_priority; -}; - -/* END OF COPY form kernel-header */ - -int __sched_setparam(pid_t pid, const struct sched_param *p); -int sched_setparam(pid_t pid, const struct sched_param *p); - -int __sched_getparam(pid_t pid, struct sched_param *p); -int sched_getparam(pid_t pid, struct sched_param *p); - -int __sched_getscheduler(pid_t pid); -int sched_getscheduler(pid_t pid); - -int __sched_setscheduler(pid_t pid, int policy, const struct sched_param *p); -int sched_setscheduler(pid_t pid, int policy, const struct sched_param *p); - -int __sched_yield(void); -int sched_yield(void); - -int __sched_get_priority_max(int policy); -int sched_get_priority_max(int policy); - -int __sched_get_priority_min(int policy); -int sched_get_priority_min(int policy); - -int __sched_rr_get_interval(pid_t pid, struct timespec *tp); -int sched_rr_get_interval(pid_t pid, struct timespec *tp); - -#endif diff --git a/mdk-stage1/dietlibc/include/scsi/scsi.h b/mdk-stage1/dietlibc/include/scsi/scsi.h deleted file mode 100644 index 652e44ee9..000000000 --- a/mdk-stage1/dietlibc/include/scsi/scsi.h +++ /dev/null @@ -1,224 +0,0 @@ -/* Copyright (C) 1998, 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - * This header file contains public constants and structures used by - * the scsi code for linux. - */ - -#ifndef _SCSI_SCSI_H -#define _SCSI_SCSI_H 1 - -/* - * SCSI opcodes - */ - -#define TEST_UNIT_READY 0x00 -#define REZERO_UNIT 0x01 -#define REQUEST_SENSE 0x03 -#define FORMAT_UNIT 0x04 -#define READ_BLOCK_LIMITS 0x05 -#define REASSIGN_BLOCKS 0x07 -#define READ_6 0x08 -#define WRITE_6 0x0a -#define SEEK_6 0x0b -#define READ_REVERSE 0x0f -#define WRITE_FILEMARKS 0x10 -#define SPACE 0x11 -#define INQUIRY 0x12 -#define RECOVER_BUFFERED_DATA 0x14 -#define MODE_SELECT 0x15 -#define RESERVE 0x16 -#define RELEASE 0x17 -#define COPY 0x18 -#define ERASE 0x19 -#define MODE_SENSE 0x1a -#define START_STOP 0x1b -#define RECEIVE_DIAGNOSTIC 0x1c -#define SEND_DIAGNOSTIC 0x1d -#define ALLOW_MEDIUM_REMOVAL 0x1e - -#define SET_WINDOW 0x24 -#define READ_CAPACITY 0x25 -#define READ_10 0x28 -#define WRITE_10 0x2a -#define SEEK_10 0x2b -#define WRITE_VERIFY 0x2e -#define VERIFY 0x2f -#define SEARCH_HIGH 0x30 -#define SEARCH_EQUAL 0x31 -#define SEARCH_LOW 0x32 -#define SET_LIMITS 0x33 -#define PRE_FETCH 0x34 -#define READ_POSITION 0x34 -#define SYNCHRONIZE_CACHE 0x35 -#define LOCK_UNLOCK_CACHE 0x36 -#define READ_DEFECT_DATA 0x37 -#define MEDIUM_SCAN 0x38 -#define COMPARE 0x39 -#define COPY_VERIFY 0x3a -#define WRITE_BUFFER 0x3b -#define READ_BUFFER 0x3c -#define UPDATE_BLOCK 0x3d -#define READ_LONG 0x3e -#define WRITE_LONG 0x3f -#define CHANGE_DEFINITION 0x40 -#define WRITE_SAME 0x41 -#define READ_TOC 0x43 -#define LOG_SELECT 0x4c -#define LOG_SENSE 0x4d -#define MODE_SELECT_10 0x55 -#define RESERVE_10 0x56 -#define RELEASE_10 0x57 -#define MODE_SENSE_10 0x5a -#define PERSISTENT_RESERVE_IN 0x5e -#define PERSISTENT_RESERVE_OUT 0x5f -#define MOVE_MEDIUM 0xa5 -#define READ_12 0xa8 -#define WRITE_12 0xaa -#define WRITE_VERIFY_12 0xae -#define SEARCH_HIGH_12 0xb0 -#define SEARCH_EQUAL_12 0xb1 -#define SEARCH_LOW_12 0xb2 -#define READ_ELEMENT_STATUS 0xb8 -#define SEND_VOLUME_TAG 0xb6 -#define WRITE_LONG_2 0xea - -/* - * Status codes - */ - -#define GOOD 0x00 -#define CHECK_CONDITION 0x01 -#define CONDITION_GOOD 0x02 -#define BUSY 0x04 -#define INTERMEDIATE_GOOD 0x08 -#define INTERMEDIATE_C_GOOD 0x0a -#define RESERVATION_CONFLICT 0x0c -#define COMMAND_TERMINATED 0x11 -#define QUEUE_FULL 0x14 - -#define STATUS_MASK 0x3e - -/* - * SENSE KEYS - */ - -#define NO_SENSE 0x00 -#define RECOVERED_ERROR 0x01 -#define NOT_READY 0x02 -#define MEDIUM_ERROR 0x03 -#define HARDWARE_ERROR 0x04 -#define ILLEGAL_REQUEST 0x05 -#define UNIT_ATTENTION 0x06 -#define DATA_PROTECT 0x07 -#define BLANK_CHECK 0x08 -#define COPY_ABORTED 0x0a -#define ABORTED_COMMAND 0x0b -#define VOLUME_OVERFLOW 0x0d -#define MISCOMPARE 0x0e - - -/* - * DEVICE TYPES - */ - -#define TYPE_DISK 0x00 -#define TYPE_TAPE 0x01 -#define TYPE_PROCESSOR 0x03 /* HP scanners use this */ -#define TYPE_WORM 0x04 /* Treated as ROM by our system */ -#define TYPE_ROM 0x05 -#define TYPE_SCANNER 0x06 -#define TYPE_MOD 0x07 /* Magneto-optical disk - - * - treated as TYPE_DISK */ -#define TYPE_MEDIUM_CHANGER 0x08 -#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ -#define TYPE_NO_LUN 0x7f - -/* - * standard mode-select header prepended to all mode-select commands - * - * moved here from cdrom.h -- kraxel - */ - -struct ccs_modesel_head - { - unsigned char _r1; /* reserved. */ - unsigned char medium; /* device-specific medium type. */ - unsigned char _r2; /* reserved. */ - unsigned char block_desc_length; /* block descriptor length. */ - unsigned char density; /* device-specific density code. */ - unsigned char number_blocks_hi; /* number of blocks in this block - desc. */ - unsigned char number_blocks_med; - unsigned char number_blocks_lo; - unsigned char _r3; - unsigned char block_length_hi; /* block length for blocks in this - desc. */ - unsigned char block_length_med; - unsigned char block_length_lo; - }; - -/* - * MESSAGE CODES - */ - -#define COMMAND_COMPLETE 0x00 -#define EXTENDED_MESSAGE 0x01 -#define EXTENDED_MODIFY_DATA_POINTER 0x00 -#define EXTENDED_SDTR 0x01 -#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ -#define EXTENDED_WDTR 0x03 -#define SAVE_POINTERS 0x02 -#define RESTORE_POINTERS 0x03 -#define DISCONNECT 0x04 -#define INITIATOR_ERROR 0x05 -#define ABORT 0x06 -#define MESSAGE_REJECT 0x07 -#define NOP 0x08 -#define MSG_PARITY_ERROR 0x09 -#define LINKED_CMD_COMPLETE 0x0a -#define LINKED_FLG_CMD_COMPLETE 0x0b -#define BUS_DEVICE_RESET 0x0c - -#define INITIATE_RECOVERY 0x0f /* SCSI-II only */ -#define RELEASE_RECOVERY 0x10 /* SCSI-II only */ - -#define SIMPLE_QUEUE_TAG 0x20 -#define HEAD_OF_QUEUE_TAG 0x21 -#define ORDERED_QUEUE_TAG 0x22 - -/* - * Here are some scsi specific ioctl commands which are sometimes useful. - */ -/* These are a few other constants only used by scsi devices. */ - -#define SCSI_IOCTL_GET_IDLUN 0x5382 - -/* Used to turn on and off tagged queuing for scsi devices. */ - -#define SCSI_IOCTL_TAGGED_ENABLE 0x5383 -#define SCSI_IOCTL_TAGGED_DISABLE 0x5384 - -/* Used to obtain the host number of a device. */ -#define SCSI_IOCTL_PROBE_HOST 0x5385 - -/* Used to get the bus number for a device. */ -#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 - -#endif /* scsi/scsi.h */ diff --git a/mdk-stage1/dietlibc/include/scsi/scsi_ioctl.h b/mdk-stage1/dietlibc/include/scsi/scsi_ioctl.h deleted file mode 100644 index bc9931838..000000000 --- a/mdk-stage1/dietlibc/include/scsi/scsi_ioctl.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SCSI_IOCTL_H -#define _SCSI_IOCTL_H - -/* IOCTLs for SCSI. */ -#define SCSI_IOCTL_SEND_COMMAND 1 /* Send a command to the SCSI host. */ -#define SCSI_IOCTL_TEST_UNIT_READY 2 /* Test if unit is ready. */ -#define SCSI_IOCTL_BENCHMARK_COMMAND 3 -#define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters. */ -#define SCSI_IOCTL_START_UNIT 5 -#define SCSI_IOCTL_STOP_UNIT 6 -#define SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */ -#define SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */ - -#endif - - diff --git a/mdk-stage1/dietlibc/include/scsi/sg.h b/mdk-stage1/dietlibc/include/scsi/sg.h deleted file mode 100644 index 00334654e..000000000 --- a/mdk-stage1/dietlibc/include/scsi/sg.h +++ /dev/null @@ -1,274 +0,0 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* - History: - Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user - process control of SCSI devices. - Development Sponsored by Killy Corp. NY NY -*/ - -#ifndef _SCSI_SG_H -#define _SCSI_SG_H 1 - -#include <sys/types.h> - -/* New interface introduced in the 3.x SG drivers follows */ - -/* Same structure as used by readv() Linux system call. It defines one - scatter-gather element. */ -typedef struct sg_iovec -{ - void * iov_base; /* Starting address */ - size_t iov_len; /* Length in bytes */ -} sg_iovec_t; - - -typedef struct sg_io_hdr -{ - int interface_id; /* [i] 'S' for SCSI generic (required) */ - int dxfer_direction; /* [i] data transfer direction */ - unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ - unsigned char mx_sb_len; /* [i] max length to write to sbp */ - unsigned short int iovec_count; /* [i] 0 implies no scatter gather */ - unsigned int dxfer_len; /* [i] byte count of data transfer */ - void * dxferp; /* [i], [*io] points to data transfer memory - or scatter gather list */ - unsigned char * cmdp; /* [i], [*i] points to command to perform */ - unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */ - unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ - unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */ - int pack_id; /* [i->o] unused internally (normally) */ - void * usr_ptr; /* [i->o] unused internally */ - unsigned char status; /* [o] scsi status */ - unsigned char masked_status;/* [o] shifted, masked scsi status */ - unsigned char msg_status; /* [o] messaging level data (optional) */ - unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ - unsigned short int host_status; /* [o] errors from host adapter */ - unsigned short int driver_status;/* [o] errors from software driver */ - int resid; /* [o] dxfer_len - actual_transferred */ - unsigned int duration; /* [o] time taken by cmd (unit: millisec) */ - unsigned int info; /* [o] auxiliary information */ -} sg_io_hdr_t; - - -/* Use negative values to flag difference from original sg_header structure. */ -#define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */ -#define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */ -#define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */ -#define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the - additional property than during indirect - IO the user buffer is copied into the - kernel buffers before the transfer */ - - -/* following flag values can be "or"-ed together */ -#define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */ -#define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */ - /* the 2nd byte of SCSI command */ -#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ - /* user space (debug indirect IO) */ - -/* The following 'info' values are "or"-ed together. */ -#define SG_INFO_OK_MASK 0x1 -#define SG_INFO_OK 0x0 /* no sense, host nor driver "noise" */ -#define SG_INFO_CHECK 0x1 /* something abnormal happened */ - -#define SG_INFO_DIRECT_IO_MASK 0x6 -#define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */ -#define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */ -#define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */ - - -/* Request information about a specific SG device, used by - SG_GET_SCSI_ID ioctl (). */ -struct sg_scsi_id { - /* Host number as in "scsi<n>" where 'n' is one of 0, 1, 2 etc. */ - int host_no; - int channel; - /* SCSI id of target device. */ - int scsi_id; - int lun; - /* TYPE_... defined in <scsi/scsi.h>. */ - int scsi_type; - /* Host (adapter) maximum commands per lun. */ - short int h_cmd_per_lun; - /* Device (or adapter) maximum queue length. */ - short int d_queue_depth; - /* Unused, set to 0 for now. */ - int unused[2]; -}; - -/* Used by SG_GET_REQUEST_TABLE ioctl(). */ -typedef struct sg_req_info { - char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */ - char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */ - char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */ - char problem; /* 0 -> no problem detected, 1 -> error to report */ - int pack_id; /* pack_id associated with request */ - void * usr_ptr; /* user provided pointer (in new interface) */ - unsigned int duration; /* millisecs elapsed since written (req_state==1) - or request duration (req_state==2) */ - int unused; -} sg_req_info_t; - - -/* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow. - [Those that only apply to the SG 2.x drivers are at the end of the file.] - (_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */ - -#define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ - -/* Used to configure SCSI command transformation layer for ATAPI devices */ -/* Only supported by the ide-scsi driver */ -#define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */ - /* 3rd arg = 0 to disable transform, 1 to enable it */ -#define SG_GET_TRANSFORM 0x2205 - -#define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */ -#define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */ - -/* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */ -#define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */ -/* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */ - -/* Override host setting and always DMA using low memory ( <16MB on i386) */ -#define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */ -#define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */ - -/* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which - tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN. - If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0 - then pack_id ignored by read() and oldest readable fetched. */ -#define SG_SET_FORCE_PACK_ID 0x227b -#define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */ - -#define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */ - -/* Yields max scatter gather tablesize allowed by current host adapter */ -#define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ - -#define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ - -/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ -#define SG_SCSI_RESET 0x2284 -/* Associated values that can be given to SG_SCSI_RESET follow */ -#define SG_SCSI_RESET_NOTHING 0 -#define SG_SCSI_RESET_DEVICE 1 -#define SG_SCSI_RESET_BUS 2 -#define SG_SCSI_RESET_HOST 3 - -/* synchronous SCSI command ioctl, (only in version 3 interface) */ -#define SG_IO 0x2285 /* similar effect as write() followed by read() */ - -#define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */ - -/* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */ -#define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */ -#define SG_GET_KEEP_ORPHAN 0x2288 - - -#define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ -/* Largest size (in bytes) a single scatter-gather list element can have. - The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on - i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported - by adapter then this value is the largest data block that can be - read/written by a single scsi command. The user can find the value of - PAGE_SIZE by calling getpagesize() defined in unistd.h . */ - -#define SG_DEFAULT_RETRIES 1 - -/* Defaults, commented if they differ from original sg driver */ -#define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */ -#define SG_DEF_FORCE_PACK_ID 0 -#define SG_DEF_KEEP_ORPHAN 0 -#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */ - -/* maximum outstanding requests, write() yields EDOM if exceeded */ -#define SG_MAX_QUEUE 16 - -#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */ - -/* Alternate style type names, "..._t" variants preferred */ -typedef struct sg_io_hdr Sg_io_hdr; -typedef struct sg_io_vec Sg_io_vec; -typedef struct sg_scsi_id Sg_scsi_id; -typedef struct sg_req_info Sg_req_info; - - -/* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ -/* The older SG interface based on the 'sg_header' structure follows. */ -/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ - -#define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */ - -struct sg_header - { - /* Length of incoming packet (including header). */ - int pack_len; - /* Maximal length of expected reply. */ - int reply_len; - /* Id number of packet. */ - int pack_id; - /* 0==ok, otherwise error number. */ - int result; - /* Force 12 byte command length for group 6 & 7 commands. */ - unsigned int twelve_byte:1; - /* SCSI status from target. */ - unsigned int target_status:5; - /* Host status (see "DID" codes). */ - unsigned int host_status:8; - /* Driver status+suggestion. */ - unsigned int driver_status:8; - /* Unused. */ - unsigned int other_flags:10; - /* Output in 3 cases: - when target_status is CHECK_CONDITION or - when target_status is COMMAND_TERMINATED or - when (driver_status & DRIVER_SENSE) is true. */ - unsigned char sense_buffer[SG_MAX_SENSE]; - }; - - -/* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t - interface is used. They are kept for backward compatibility with - the original and version 2 drivers. */ - -#define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)arg==timeout. */ -#define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */ - -/* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */ -#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */ -#define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */ - -/* Turn on error sense trace (1..8), dump this device to log/console (9) - or dump all sg device states ( >9 ) to log/console. */ -#define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */ - -#define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given - number on the next write() on this file - descriptor. */ - -/* Defaults, commented if they differ from original sg driver */ -#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ -#define SG_DEF_COMMAND_Q 0 /* command queuing is always on when - the new interface is used */ -#define SG_DEF_UNDERRUN_FLAG 0 - - -#endif /* scsi/sg.h */ diff --git a/mdk-stage1/dietlibc/include/setjmp.h b/mdk-stage1/dietlibc/include/setjmp.h deleted file mode 100644 index 66fc288f4..000000000 --- a/mdk-stage1/dietlibc/include/setjmp.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef _SETJMP_H -#define _SETJMP_H - -#include <sys/cdefs.h> - -#ifdef __i386__ -#ifndef __ASSEMBLER__ -typedef int __jmp_buf[6]; -#endif -# define JB_BX 0 -# define JB_SI 1 -# define JB_DI 2 -# define JB_BP 3 -# define JB_SP 4 -# define JB_PC 5 -# define JB_SIZE 24 -#endif - -#ifdef __alpha__ -#define JB_S0 0 -#define JB_S1 1 -#define JB_S2 2 -#define JB_S3 3 -#define JB_S4 4 -#define JB_S5 5 -#define JB_PC 6 -#define JB_FP 7 -#define JB_SP 8 -#define JB_F2 9 -#define JB_F3 10 -#define JB_F4 11 -#define JB_F5 12 -#define JB_F6 13 -#define JB_F7 14 -#define JB_F8 15 -#define JB_F9 16 -#ifndef __ASSEMBLER__ -typedef long int __jmp_buf[17]; -#endif -#endif - -#ifdef __mips__ -#ifndef __ASSEMBLER__ -typedef struct - { - void * __pc; /* Program counter. */ - void * __sp; /* Stack pointer. */ - int __regs[8]; /* Callee-saved registers s0 through s7. */ - void * __fp; /* The frame pointer. */ - void * __gp; /* The global pointer. */ - int __fpc_csr; /* Floating point status register. */ - double __fpregs[6]; /* Callee-saved floating point registers. */ - } __jmp_buf[1]; -#endif -#endif - -#ifdef __sparc__ -#define JB_SP 0 -#define JB_FP 1 -#define JB_PC 2 -#ifndef __ASSEMBLER__ -typedef int __jmp_buf[3]; -#endif -#endif - -#ifdef __arm__ -#define __JMP_BUF_SP 8 -#ifndef __ASSEMBLER__ -typedef int __jmp_buf[10]; -#endif -#endif - -#ifdef __powerpc__ -# define JB_GPR1 0 /* Also known as the stack pointer */ -# define JB_GPR2 1 -# define JB_LR 2 /* The address we will return to */ -# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */ -# define JB_CR 21 /* Condition code registers. */ -# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */ -# define JB_SIZE (58*4) -#ifndef __ASSEMBLER__ -typedef long int __jmp_buf[58]; -#endif -#endif - -#ifndef __ASSEMBLER__ - -typedef int sig_atomic_t; -#define __sig_atomic_t sig_atomic_t - -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; - -/* Calling environment, plus possibly a saved signal mask. */ -typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */ - { - /* NOTE: The machine-dependent definitions of `__sigsetjmp' - assume that a `jmp_buf' begins with a `__jmp_buf'. - Do not move this member or add others before it. */ - __jmp_buf __jmpbuf; /* Calling environment. */ - int __mask_was_saved; /* Saved the signal mask? */ - __sigset_t __saved_mask; /* Saved signal mask. */ - } jmp_buf[1]; - -extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW; - -extern void longjmp (jmp_buf __env, int __val) - __THROW __attribute__ ((__noreturn__)); - -typedef jmp_buf sigjmp_buf; - -extern void siglongjmp (sigjmp_buf __env, int __val) - __THROW __attribute__ ((__noreturn__)); - -#define setjmp(env) __sigsetjmp(env,0) -#define sigsetjmp(a,b) __sigsetjmp(a,b) - -#endif - -#endif diff --git a/mdk-stage1/dietlibc/include/shadow.h b/mdk-stage1/dietlibc/include/shadow.h deleted file mode 100644 index 4d6341af1..000000000 --- a/mdk-stage1/dietlibc/include/shadow.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _SHADOW_H -#define _SHADOW_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -struct spwd { - char *sp_namp; /* user login name */ - char *sp_pwdp; /* encrypted password */ - long sp_lstchg; /* last password change */ - int sp_min; /* days until change allowed. */ - int sp_max; /* days before change required */ - int sp_warn; /* days warning for expiration */ - int sp_inact; /* days before account inactive */ - int sp_expire; /* date when account expires */ - int sp_flag; /* reserved for future use */ -}; - -extern struct spwd *getspent(void) __THROW; -extern void setspent(void) __THROW; -extern void endspent(void) __THROW; -extern struct spwd *getspnam (__const char *__name) __THROW; - -#endif /* _SHADOW_H */ diff --git a/mdk-stage1/dietlibc/include/signal.h b/mdk-stage1/dietlibc/include/signal.h deleted file mode 100644 index 9ed93fe83..000000000 --- a/mdk-stage1/dietlibc/include/signal.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _SIGNAL_H -#define _SIGNAL_H - -#include <sys/cdefs.h> - -#define __WANT_POSIX1B_SIGNALS__ - -#include <linux/types.h> -#include <linux/signal.h> - -typedef void (*sighandler_t)(int); - -int sigemptyset(sigset_t *set) __THROW; -int sigfillset(sigset_t *set) __THROW; -int sigaddset(sigset_t *set, int signum) __THROW; -int sigdelset(sigset_t *set, int signum) __THROW; -int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) __THROW; -sighandler_t signal(int signum, sighandler_t action); -int raise (int sig) __THROW; -int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) __THROW; -int sigaltstack(const struct sigaltstack *newstack, struct sigaltstack *oldstack) __THROW; - -#ifndef SIGCLD -#define SIGCLD SIGCHLD -#endif - -extern const char *const sys_siglist[]; - -typedef __sighandler_t sig_t; - -#ifndef NSIG -#define NSIG _NSIG -#endif - -#endif diff --git a/mdk-stage1/dietlibc/include/stdint.h b/mdk-stage1/dietlibc/include/stdint.h deleted file mode 100644 index d287e6794..000000000 --- a/mdk-stage1/dietlibc/include/stdint.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _STDINT_H -#define _STDINT_H - -#include <sys/types.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/stdio.h b/mdk-stage1/dietlibc/include/stdio.h deleted file mode 100644 index 92d9dc0cb..000000000 --- a/mdk-stage1/dietlibc/include/stdio.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef _STDIO_H -#define _STDIO_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -typedef struct __stdio_file FILE; - -FILE *fopen (const char *path, const char *mode) __THROW; -FILE *fdopen (int fildes, const char *mode) __THROW; -FILE *freopen (const char *path, const char *mode, FILE *stream) __THROW; - -int printf(const char *format, ...) __THROW; -int fprintf(FILE *stream, const char *format, ...) __THROW; -int sprintf(char *str, const char *format, ...) __THROW; -int snprintf(char *str, size_t size, const char *format, ...) __THROW; -int asprintf(char **ptr, const char* format, ...) __THROW; - -int scanf( const char *format, ...) __THROW; -int fscanf( FILE *stream, const char *format, ...) __THROW; -int sscanf( const char *str, const char *format, ...) __THROW; - -#include <stdarg.h> - -int vprintf(const char *format, va_list ap) __THROW; -int vfprintf(FILE *stream, const char *format, va_list ap) __THROW; -int vsprintf(char *str, const char *format, va_list ap) __THROW; -int vsnprintf(char *str, size_t size, const char *format, va_list ap) __THROW; - -int vscanf( const char *format, va_list ap) __THROW; -int vsscanf( const char *str, const char *format, va_list ap) __THROW; -int vfscanf( FILE *stream, const char *format, va_list ap) __THROW; - -int fgetc(FILE *stream) __THROW; -char *fgets(char *s, int size, FILE *stream) __THROW; -int getc(FILE *stream) __THROW; -int getchar(void) __THROW; -char *gets(char *s) __THROW; -int ungetc(int c, FILE *stream) __THROW; - -int fputc(int c, FILE *stream) __THROW; -int fputs(const char *s, FILE *stream) __THROW; - -#define putc(c,stream) fputc(c,stream) -#define putchar(c) fputc(c,stdout) - -#define getchar() fgetc(stdin) -#define getc(stream) fgetc(stream) - -int puts(const char *s) __THROW; - -long fseek( FILE *stream, long offset, int whence) __THROW; -long ftell( FILE *stream) __THROW; -void rewind( FILE *stream) __THROW; -int fgetpos( FILE *stream, fpos_t *pos) __THROW; -int fsetpos( FILE *stream, fpos_t *pos) __THROW; - -size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream) __THROW; - -size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream) __THROW; - -int fflush(FILE *stream) __THROW; - -int fclose(FILE *stream) __THROW; - -void clearerr(FILE *stream) __THROW; -int feof (FILE *stream) __THROW; -int ferror( FILE *stream) __THROW; -int fileno( FILE *stream) __THROW; - -int remove(const char *pathname) __THROW; - -void perror(const char *s) __THROW; - -extern FILE *stdin, *stdout, *stderr; - -#define EOF (int)(-1) - -#define BUFSIZ 128 - -#define _IONBF 0 -#define _IOLBF 1 -#define _IOFBF 2 - -int setvbuf(FILE *stream, char *buf, int mode , size_t size) __THROW; - -#define setbuf(stream,buf) setvbuf(stream,buf,buf?_IOFBF:_IONBF,BUFSIZ) -#define setbuffer(stream,buf,size) setvbuf(stream,buf,buf?_IOFBF:_IONBF,size) -#define setlinebuf(stream) setvbuf(stream,0,_IOLBF,BUFSIZ) - -FILE *popen(const char *command, const char *type) __THROW; -int pclose(FILE *stream) __THROW; - -#define getc_unlocked(stream) getc(stream) -#define putc_unlocked(c,stream) putc(c,stream) - -#endif diff --git a/mdk-stage1/dietlibc/include/stdlib.h b/mdk-stage1/dietlibc/include/stdlib.h deleted file mode 100644 index 6a13a48ff..000000000 --- a/mdk-stage1/dietlibc/include/stdlib.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _STDLIB_H -#define _STDLIB_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -#define __LIBC_DIETLIBC__ - -void *calloc(size_t nmemb, size_t size) __THROW; -void *malloc(size_t size) __THROW; -void free(void *ptr) __THROW; -void *realloc(void *ptr, size_t size) __THROW; - -char *getenv(const char *name) __THROW __pure__; -int putenv(const char *string) __THROW; -int setenv(const char *name, const char *value, int overwrite) __THROW; -void unsetenv(const char *name) __THROW; - -int atexit(void (*function)(void)) __THROW; - -double strtod(const char *nptr, char **endptr) __THROW; -long int strtol(const char *nptr, char **endptr, int base) __THROW; -unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW; - -int __ltostr(char *s, int size, unsigned long i, int base, char UpCase) __THROW; -#ifdef __GNUC__ -long long int strtoll(const char *nptr, char **endptr, int base) __THROW; -unsigned long long int strtoull(const char *nptr, char **endptr, int base) __THROW; -int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase) __THROW; -#endif - -int atoi(const char *nptr) __THROW; -long int atol(const char *nptr) __THROW; -double atof(const char *nptr) __THROW; - -void exit(int status) __THROW __attribute__((noreturn)); -void abort(void) __THROW; - -/* warning: the rand() implementation of the diet libc really sucks. */ -#define RAND_MAX 32767 - -extern int rand(void) __THROW; -extern void srand(unsigned int seed) __THROW; - -void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) __THROW; -void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) __THROW; - -extern char **environ; - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 - -/* now this function is the greatest bullshit I have ever seen. - * The ISO people must be out of their minds. */ -typedef struct { int quot,rem; } div_t; -div_t div(int numer, int denom) __THROW __attribute__((const)); - -void *alloca(size_t size) __THROW; /* gcc built-in */ - -char *realpath(const char *path, char *resolved_path) __THROW; - -int abs(int j) __THROW; - -long int random(void) __THROW; -void srandom(unsigned int seed) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/string.h b/mdk-stage1/dietlibc/include/string.h deleted file mode 100644 index 1ef78ae54..000000000 --- a/mdk-stage1/dietlibc/include/string.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _STRING_H -#define _STRING_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -char *strcpy(char *dest, const char *src) __THROW; -char *strncpy(char *dest, const char *src, size_t n) __THROW; - -void *memccpy(void *dest, const void *src, int c, size_t n) __THROW; -void *memcpy(void *dest, const void *src, size_t n) __THROW; -void *memmove(void *dest, const void *src, size_t n) __THROW; - -int memccmp(const void *s1, const void *s2, int c, size_t n) __THROW __pure__; -int memcmp(const void *s1, const void *s2, size_t n) __THROW __pure__; -int strcmp(const char *s1, const char *s2) __THROW __pure__; -int strncmp(const char *s1, const char *s2, size_t n) __THROW __pure__; - -int strcasecmp(const char *s1, const char *s2) __THROW __pure__; -int strncasecmp(const char *s1, const char *s2, size_t n) __THROW __pure__; - -size_t strlen(const char *s) __THROW __pure__; - -char *strstr(const char *haystack, const char *needle) __THROW __pure__; - -char *strdup(const char *s) __THROW; - -char *strchr(const char *s, int c) __THROW __pure__; -char *strrchr(const char *s, int c) __THROW __pure__; - -char *strcat(char *dest, const char *src) __THROW; -char *strncat(char *dest, const char *src, size_t n) __THROW; - -size_t strspn(const char *s, const char *accept) __THROW; -size_t strcspn(const char *s, const char *reject) __THROW; - -char *strpbrk(const char *s, const char *accept) __THROW; -char *strsep(char **stringp, const char *delim) __THROW; - -void* memset(void *s, int c, size_t n) __THROW; - -#undef NULL -#define NULL (void*)0 - -#define bzero(s,n) memset(s,0,n) -#define bcopy(src,dest,n) memmove(dest,src,n) -#define bcmp(a,b,n) memcmp(a,b,n) - -char *strerror(int errnum) __THROW; -char *strsignal(int signum) __THROW; - -char *strtok(char *s, const char *delim) __THROW; -char *strtok_r(char *s, const char *delim, char **ptrptr) __THROW; - -int ffs(int i) __THROW __attribute__((__const__)); - -#endif diff --git a/mdk-stage1/dietlibc/include/strings.h b/mdk-stage1/dietlibc/include/strings.h deleted file mode 100644 index ec947a9b9..000000000 --- a/mdk-stage1/dietlibc/include/strings.h +++ /dev/null @@ -1,2 +0,0 @@ -#warning "your code included obsolescent <strings.h>. Please change that to <string.h>!" -#include <string.h> diff --git a/mdk-stage1/dietlibc/include/sys/cdefs.h b/mdk-stage1/dietlibc/include/sys/cdefs.h deleted file mode 100644 index 895bb74b8..000000000 --- a/mdk-stage1/dietlibc/include/sys/cdefs.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _SYS_CDEFS_H -#define _SYS_CDEFS_H - -#define __dietlibc__ - -#ifndef __cplusplus -#define throw () -#define __THROW -#define __BEGIN_DECLS -#define __END_DECLS -#else -#define __THROW throw () -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS } -#endif - -#ifndef __GNUC__ -#define __attribute__(xyz) -#endif - -#define __pure__ -#ifdef __GNUC__ -#if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 96)) -#undef __pure__ -#define __pure__ __attribute__ ((__pure__)) -#endif - -#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) -#define __restrict__ -#endif - -#endif - -#define __P(x) x - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/file.h b/mdk-stage1/dietlibc/include/sys/file.h deleted file mode 100644 index 93787fd42..000000000 --- a/mdk-stage1/dietlibc/include/sys/file.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _SYS_FILE_H -#define _SYS_FILE_H - -#include <sys/cdefs.h> - -extern int fcntl(int fd, int cmd, ...) __THROW; -extern int flock(int fd, int operation) __THROW; - -/* Operations for the `flock' call. */ -#define LOCK_SH 1 /* Shared lock. */ -#define LOCK_EX 2 /* Exclusive lock. */ -#define LOCK_UN 8 /* Unlock. */ - -/* Can be OR'd in to one of the above. */ -#define LOCK_NB 4 /* Don't block when locking. */ - - - -#endif /* _SYS_FILE_H */ diff --git a/mdk-stage1/dietlibc/include/sys/io.h b/mdk-stage1/dietlibc/include/sys/io.h deleted file mode 100644 index cce841735..000000000 --- a/mdk-stage1/dietlibc/include/sys/io.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _IO_H -#define _IO_H - -int ioperm(unsigned long from, unsigned long num, int turn_on) __THROW; - -#ifdef __i386__ - -static __inline void -outb (unsigned char value, unsigned short int port) -{ - __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port)); -} - -static __inline unsigned char -inb (unsigned short int port) -{ - unsigned char _v; - - __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port)); - return _v; -} - -static __inline unsigned short int -inw (unsigned short int port) -{ - unsigned short _v; - - __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (port)); - return _v; -} - -static __inline void -outw (unsigned short int value, unsigned short int port) -{ - __asm__ __volatile__ ("outw %w0,%w1": :"a" (value), "Nd" (port)); - -} - -#endif - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/ioctl.h b/mdk-stage1/dietlibc/include/sys/ioctl.h deleted file mode 100644 index fca1aeeab..000000000 --- a/mdk-stage1/dietlibc/include/sys/ioctl.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _IOCTL_H -#define _IOCTL_H - -#include <sys/cdefs.h> -#include <linux/ioctl.h> -#include <asm/ioctls.h> - -int ioctl(int d, int request, ...) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/ipc.h b/mdk-stage1/dietlibc/include/sys/ipc.h deleted file mode 100644 index 9184a2a82..000000000 --- a/mdk-stage1/dietlibc/include/sys/ipc.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _SYS_IPC_H -#define _SYS_IPC_H - -#include <sys/cdefs.h> -#include <linux/ipc.h> -#include <asm/page.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/kd.h b/mdk-stage1/dietlibc/include/sys/kd.h deleted file mode 100644 index 9e9a5152b..000000000 --- a/mdk-stage1/dietlibc/include/sys/kd.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _SYS_KD_H -#define _SYS_KD_H - -#include <linux/kd.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/mman.h b/mdk-stage1/dietlibc/include/sys/mman.h deleted file mode 100644 index dc398ba90..000000000 --- a/mdk-stage1/dietlibc/include/sys/mman.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _SYS_MMAN_H -#define _SYS_MMAN_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <linux/mman.h> -#include <asm/page.h> - -#ifndef PAGE_SIZE -#warning PAGE_SIZE undefined -#endif - -#define MAP_FAILED ((void *) -1) - -extern void *mmap (void *__addr, size_t __len, int __prot, - int __flags, int __fd, off_t __offset); - -extern int munmap (void *__addr, size_t __len) __THROW; -extern int mprotect (void *__addr, size_t __len, int __prot) __THROW; -extern int msync (void *__addr, size_t __len, int __flags) __THROW; -extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, - int __may_move) __THROW; -extern int mincore (void *__start, size_t __len, unsigned char *__vec); - -#ifdef __quad_t -extern void *mmap64 (void *__addr, size_t __len, int __prot, - int __flags, int __fd, off64_t __offset) __THROW; -#endif - -int mlockall(int flags) __THROW; -int munlockall(void) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/mount.h b/mdk-stage1/dietlibc/include/sys/mount.h deleted file mode 100644 index 2e9e86774..000000000 --- a/mdk-stage1/dietlibc/include/sys/mount.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _SYS_MOUNT_H -#define _SYS_MOUNT_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <linux/fs.h> - -int mount(const char* specialfile, const char* dir, const char* filesystemtype, - unsigned long rwflag, const void * data) __THROW; - -int umount(const char *specialfile) __THROW; - -int umount(const char *dir) __THROW; - -int umount2(const char *specialfile, int mflag) __THROW; - -int umount2(const char *dir, int mflag) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/msg.h b/mdk-stage1/dietlibc/include/sys/msg.h deleted file mode 100644 index ea1e470b6..000000000 --- a/mdk-stage1/dietlibc/include/sys/msg.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _SYS_MSG_H -#define _SYS_MSG_H - -#include <linux/msg.h> -#include <sys/ipc.h> -#include <asm/page.h> - -extern int msgctl (int msqid, int cmd, struct msqid_ds *buf) __THROW; -extern int msgget (key_t key, int msgflg) __THROW; -extern int msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) __THROW; -extern int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/mtio.h b/mdk-stage1/dietlibc/include/sys/mtio.h deleted file mode 100644 index e70663407..000000000 --- a/mdk-stage1/dietlibc/include/sys/mtio.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _SYS_MTIO_H -#define _SYS_MTIO_H - -#include <linux/mtio.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/param.h b/mdk-stage1/dietlibc/include/sys/param.h deleted file mode 100644 index 05f4d40e2..000000000 --- a/mdk-stage1/dietlibc/include/sys/param.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _SYS_PARAM_H -#define _SYS_PARAM_H - -#include <limits.h> - -#define MAXPATHLEN PATH_MAX - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/poll.h b/mdk-stage1/dietlibc/include/sys/poll.h deleted file mode 100644 index adce26687..000000000 --- a/mdk-stage1/dietlibc/include/sys/poll.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _SYS_POLL_H -#define _SYS_POLL_H - -#include <sys/cdefs.h> - -#include <linux/poll.h> - -extern int poll(struct pollfd *ufds, unsigned int nfds, int timeout) __THROW; - - -#endif /* _SYS_POLL_H */ diff --git a/mdk-stage1/dietlibc/include/sys/ptrace.h b/mdk-stage1/dietlibc/include/sys/ptrace.h deleted file mode 100644 index 9dd730bc6..000000000 --- a/mdk-stage1/dietlibc/include/sys/ptrace.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _SYS_PTRACE_H -#define _SYS_PTRACE_H - -#include <sys/cdefs.h> - -#include <linux/ptrace.h> - -extern long int ptrace (int request, ...) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/reboot.h b/mdk-stage1/dietlibc/include/sys/reboot.h deleted file mode 100644 index ba58d296a..000000000 --- a/mdk-stage1/dietlibc/include/sys/reboot.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _SYS_REBOOT_H -#define _SYS_REBOOT_H - -#include <linux/reboot.h> - -/* Reboot or halt the system. */ -int reboot (int flag, void *arg); - -#endif /* _SYS_REBOOT_H */ diff --git a/mdk-stage1/dietlibc/include/sys/resource.h b/mdk-stage1/dietlibc/include/sys/resource.h deleted file mode 100644 index 442434cd1..000000000 --- a/mdk-stage1/dietlibc/include/sys/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _SYS_RESOURCE_H -#define _SYS_RESOURCE_H - -#include <sys/cdefs.h> -#include <linux/resource.h> - -int getpriority(int which, int who) __THROW; -int setpriority(int which, int who, int prio) __THROW; - -int getrlimit (int resource, struct rlimit *rlim); -int getrusage (int who, struct rusage *usage); -int setrlimit (int resource, const struct rlimit *rlim); - -typedef unsigned long rlim_t; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/select.h b/mdk-stage1/dietlibc/include/sys/select.h deleted file mode 100644 index e69de29bb..000000000 --- a/mdk-stage1/dietlibc/include/sys/select.h +++ /dev/null diff --git a/mdk-stage1/dietlibc/include/sys/sem.h b/mdk-stage1/dietlibc/include/sys/sem.h deleted file mode 100644 index cc182649c..000000000 --- a/mdk-stage1/dietlibc/include/sys/sem.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _SYS_SEM_H -#define _SYS_SEM_H - -#include <linux/sem.h> -#include <sys/ipc.h> - -extern int semget( key_t key, int nsems, int semflg) __THROW; -extern int semctl(int semid, int semnum, int cmd, union semun arg) __THROW; -extern int semop(int semid, struct sembuf *sops, unsigned nsops) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/sendfile.h b/mdk-stage1/dietlibc/include/sys/sendfile.h deleted file mode 100644 index 2e0c04add..000000000 --- a/mdk-stage1/dietlibc/include/sys/sendfile.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _SYS_SENDFILE_H -#define _SYS_SENDFILE_H - -#include <sys/cdefs.h> - -extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *offset, - size_t __count) __THROW; - -#endif /* sys/sendfile.h */ diff --git a/mdk-stage1/dietlibc/include/sys/shm.h b/mdk-stage1/dietlibc/include/sys/shm.h deleted file mode 100644 index c27f5ddcf..000000000 --- a/mdk-stage1/dietlibc/include/sys/shm.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _SYS_SHM_H -#define _SYS_SHM_H - -#include <linux/shm.h> -#include <sys/ipc.h> -#include <asm/page.h> - -#ifndef PAGE_SIZE -#define PAGE_SIZE getpagesize() -#endif - -extern int shmget(key_t key, int size, int shmflg) __THROW; -extern void *shmat(int shmid, const void *shmaddr, int shmflg) __THROW; -extern int shmdt (const void *shmaddr) __THROW; -extern int shmctl(int shmid, int cmd, struct shmid_ds *buf) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/signal.h b/mdk-stage1/dietlibc/include/sys/signal.h deleted file mode 100644 index 2e602dad8..000000000 --- a/mdk-stage1/dietlibc/include/sys/signal.h +++ /dev/null @@ -1 +0,0 @@ -#include <signal.h> diff --git a/mdk-stage1/dietlibc/include/sys/socket.h b/mdk-stage1/dietlibc/include/sys/socket.h deleted file mode 100644 index a1435501c..000000000 --- a/mdk-stage1/dietlibc/include/sys/socket.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _SYS_SOCKET_H -#define _SYS_SOCKET_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <linux/socket.h> - -#ifndef SOCK_DGRAM -/* the Linux kernel headers suck really badly on non-x86 */ -#define SOCK_STREAM 1 /* stream (connection) socket */ -#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ -#define SOCK_RAW 3 /* raw socket */ -#define SOCK_RDM 4 /* reliably-delivered message */ -#define SOCK_SEQPACKET 5 /* sequential packet socket */ -#define SOCK_PACKET 10 /* linux specific way of */ -#endif - -struct sockaddr_storage { - char __tmp[sizeof(struct sockaddr)]; -}; - -int socket(int domain, int type, int protocol) __THROW; -int accept(int s, struct sockaddr *addr, socklen_t *addrlen) __THROW; -int connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen) __THROW; -int bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) __THROW; -int recv(int s, void *buf, size_t len, int flags) __THROW; -int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) __THROW; -int recvmsg(int s, struct msghdr *msg, int flags) __THROW; -int send(int s, const void *msg, size_t len, int flags) __THROW; -int sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) __THROW; -int sendmsg(int s, const struct msghdr *msg, int flags) __THROW; - -int getpeername(int s, struct sockaddr *name, socklen_t *namelen) __THROW; -int getsockname(int s , struct sockaddr * name , socklen_t * namelen) __THROW; - -int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) __THROW; -int setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) __THROW; - -int listen(int s, int backlog) __THROW; - -#define SHUT_RD 0 -#define SHUT_WR 1 -#define SHUT_RDWR 2 -int shutdown(int s, int how) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/stat.h b/mdk-stage1/dietlibc/include/sys/stat.h deleted file mode 100644 index 10fddfa42..000000000 --- a/mdk-stage1/dietlibc/include/sys/stat.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _SYS_STAT_H -#define _SYS_STAT_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -#include <linux/stat.h> -#include <asm/stat.h> - -#ifndef STAT64_HAS_BROKEN_ST_INO -#define __NO_STAT64 -#endif - -extern int stat(const char *__file, struct stat *__buf) __THROW; -extern int fstat(int __fd, struct stat *__buf) __THROW; -extern int lstat(const char *__file, struct stat *__buf) __THROW; - -#ifdef __NO_STAT64 -#undef _FILE_OFFSET_BITS -#else -extern int stat64(const char *__file, struct stat64 *__buf) __THROW; -extern int fstat64(int __fd, struct stat64 *__buf) __THROW; -extern int lstat64(const char *__file, struct stat64 *__buf) __THROW; -#endif - -#if _FILE_OFFSET_BITS == 64 -#define lstat(file,buf) lstat64(file,buf) -#define fstat(file,buf) fstat64(file,buf) -#define stat stat64 -#endif - -#define major(dev) (((dev)>>8) & 0xff) -#define minor(dev) ((dev) & 0xff) -#define makedev(major, minor) ((((unsigned int) (major)) << 8) | ((unsigned int) (minor))) - -extern int chmod (const char *__file, mode_t __mode) __THROW; - -extern int fchmod (int __fd, mode_t __mode) __THROW; - -extern mode_t umask (mode_t __mask) __THROW; - -extern int mkdir (const char *__path, mode_t __mode) __THROW; - -extern int mknod (const char *__path, mode_t __mode, dev_t __dev) __THROW; - -extern int mkfifo (const char *__path, mode_t __mode) __THROW; - -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/syscall.h b/mdk-stage1/dietlibc/include/sys/syscall.h deleted file mode 100644 index 5d6b5a4ad..000000000 --- a/mdk-stage1/dietlibc/include/sys/syscall.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _SYSCALL_H -#define _SYSCALL_H - -#include <asm/unistd.h> - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/sysinfo.h b/mdk-stage1/dietlibc/include/sys/sysinfo.h deleted file mode 100644 index 5f059d469..000000000 --- a/mdk-stage1/dietlibc/include/sys/sysinfo.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _SYS_SYSINFO_H -#define _SYS_SYSINFO_H - -#include <sys/cdefs.h> -#include <linux/kernel.h> - -int sysinfo(struct sysinfo *info) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/syslog.h b/mdk-stage1/dietlibc/include/sys/syslog.h deleted file mode 100644 index 91bf0d1fa..000000000 --- a/mdk-stage1/dietlibc/include/sys/syslog.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef _SYS_SYSLOG_H -#define _SYS_SYSLOG_H 1 - -#include <sys/cdefs.h> -#include <stdarg.h> - -#define _PATH_LOG "/dev/log" - -/* - * priorities/facilities are encoded into a single 32-bit quantity, where the - * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility - * (0-big number). Both the priorities and the facilities map roughly - * one-to-one to strings in the syslogd(8) source code. This mapping is - * included in this file. - * - * priorities (these are ordered) - */ -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but significant condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ - /* extract priority */ -#define LOG_PRI(p) ((p) & LOG_PRIMASK) -#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) - -/* facility codes */ -#define LOG_KERN (0<<3) /* kernel messages */ -#define LOG_USER (1<<3) /* random user-level messages */ -#define LOG_MAIL (2<<3) /* mail system */ -#define LOG_DAEMON (3<<3) /* system daemons */ -#define LOG_AUTH (4<<3) /* security/authorization messages */ -#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ -#define LOG_LPR (6<<3) /* line printer subsystem */ -#define LOG_NEWS (7<<3) /* network news subsystem */ -#define LOG_UUCP (8<<3) /* UUCP subsystem */ -#define LOG_CRON (9<<3) /* clock daemon */ -#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ -#define LOG_FTP (11<<3) /* ftp daemon */ - - /* other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16<<3) /* reserved for local use */ -#define LOG_LOCAL1 (17<<3) /* reserved for local use */ -#define LOG_LOCAL2 (18<<3) /* reserved for local use */ -#define LOG_LOCAL3 (19<<3) /* reserved for local use */ -#define LOG_LOCAL4 (20<<3) /* reserved for local use */ -#define LOG_LOCAL5 (21<<3) /* reserved for local use */ -#define LOG_LOCAL6 (22<<3) /* reserved for local use */ -#define LOG_LOCAL7 (23<<3) /* reserved for local use */ - -#define LOG_NFACILITIES 24 /* current number of facilities */ -#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ - /* facility of pri */ -#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) - -/* - * arguments to setlogmask. - */ -#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything. - * LOG_NDELAY is the inverse of what it used to be. - */ -#define LOG_PID 0x01 /* log the pid with each message */ -#define LOG_CONS 0x02 /* log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ -#define LOG_NDELAY 0x08 /* don't delay open */ -#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ -#define LOG_PERROR 0x20 /* log to stderr as well */ - -/* Open connection to system logger. */ -/* against the glibc-routine ident has not to be const ! */ -/* instead ident is limited to 80 characters ! */ -void openlog (const char *ident, int option, int facility); - -void closelog (void) __THROW; - -int setlogmask (int mask) __THROW; - -void syslog (int priority, const char *format, ...) __THROW; - -void vsyslog (int priority, const char *format, va_list arg_ptr) __THROW; - -/* yuck yuck yuck, only needed for syslogd. */ -typedef struct _code { - char *c_name; - int c_val; -} CODE; - -extern CODE prioritynames[]; -extern CODE facilitynames[]; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/time.h b/mdk-stage1/dietlibc/include/sys/time.h deleted file mode 100644 index 11144f57b..000000000 --- a/mdk-stage1/dietlibc/include/sys/time.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _SYS_TIME_H -#define _SYS_TIME_H 1 - -#include <sys/cdefs.h> - -#include <sys/types.h> -#include <linux/time.h> - -#if defined __USE_GNU || defined __USE_BSD -typedef struct timezone *__timezone_ptr_t; -#else -typedef void *__timezone_ptr_t; -#endif - -int getitimer(int which, struct itimerval *value) __THROW; -int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) __THROW; - -int gettimeofday(struct timeval *tv, struct timezone *tz) __THROW; -int settimeofday(const struct timeval *tv , const struct timezone *tz) __THROW; - -extern int adjtime (const struct timeval *__delta, - struct timeval *__olddelta) __THROW; - -struct tm -{ - int tm_sec; /* Seconds. [0-60] (1 leap second) */ - int tm_min; /* Minutes. [0-59] */ - int tm_hour; /* Hours. [0-23] */ - int tm_mday; /* Day. [1-31] */ - int tm_mon; /* Month. [0-11] */ - int tm_year; /* Year - 1900. */ - int tm_wday; /* Day of week. [0-6] */ - int tm_yday; /* Days in year.[0-365] */ - int tm_isdst; /* DST. [-1/0/1]*/ - - long int tm_gmtoff; /* Seconds east of UTC. */ - const char *tm_zone; /* Timezone abbreviation. */ -}; - -struct tm* gmtime(const time_t *t) __THROW; -struct tm* gmtime_r(const time_t *t, struct tm *r) __THROW; - -struct tm* localtime(const time_t *t) __THROW; -struct tm* localtime_r(const time_t *t, struct tm *r) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/times.h b/mdk-stage1/dietlibc/include/sys/times.h deleted file mode 100644 index 72ec62fec..000000000 --- a/mdk-stage1/dietlibc/include/sys/times.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _SYS_TIMES_H -#define _SYS_TIMES_H - -#include <linux/times.h> - -clock_t times(struct tms *buf); - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/types.h b/mdk-stage1/dietlibc/include/sys/types.h deleted file mode 100644 index 34dbaa9f1..000000000 --- a/mdk-stage1/dietlibc/include/sys/types.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H - -#include <linux/types.h> -#include <linux/posix_types.h> -#include <linux/socket.h> - -#ifdef __GNUC__ -#define __quad_t __quad_t -typedef long long int __quad_t; -typedef unsigned long long int __u_quad_t; -#else -#warning no long long support - no 64 bit file I/O support -typedef long int __quad_t; -typedef unsigned long int __u_quad_t; -#endif - - -#ifdef __quad_t -typedef __quad_t off64_t; -typedef __u_quad_t ino64_t; -typedef __quad_t blkcnt64_t; -#endif - -typedef long int fpos_t; - -#define socklen_t socklen_t -typedef unsigned int socklen_t; - -typedef long int blksize_t; -typedef long int blkcnt_t; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/uio.h b/mdk-stage1/dietlibc/include/sys/uio.h deleted file mode 100644 index d64fd33c9..000000000 --- a/mdk-stage1/dietlibc/include/sys/uio.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _SYS_UIO -#define _SYS_UIO 1 - -#include <linux/uio.h> - -int readv(int filedes, const struct iovec *vector, size_t count); -int writev(int filedes, const struct iovec *vector, size_t count); - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/un.h b/mdk-stage1/dietlibc/include/sys/un.h deleted file mode 100644 index 213d9290e..000000000 --- a/mdk-stage1/dietlibc/include/sys/un.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _SYS_UN_H -#define _SYS_UN_H - -#include <sys/cdefs.h> - -#include <linux/un.h> - -#endif /* sys/un.h */ diff --git a/mdk-stage1/dietlibc/include/sys/utsname.h b/mdk-stage1/dietlibc/include/sys/utsname.h deleted file mode 100644 index 37bf6c811..000000000 --- a/mdk-stage1/dietlibc/include/sys/utsname.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H 1 - -#include <sys/cdefs.h> - -/* Length of the entries in `struct utsname' is 65. */ -#define _UTSNAME_LENGTH 65 -#define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH - -/* Linux provides as additional information in the `struct utsname' - the name of the current domain. Define _UTSNAME_DOMAIN_LENGTH - to a value != 0 to activate this entry. */ -#define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH - -struct utsname { - /* Name of the implementation of the operating system. */ - char sysname[_UTSNAME_LENGTH]; - - /* Name of this node on the network. */ - char nodename[_UTSNAME_NODENAME_LENGTH]; - - /* Current release level of this implementation. */ - char release[_UTSNAME_LENGTH]; - /* Current version level of this release. */ - char version[_UTSNAME_LENGTH]; - - /* Name of the hardware type the system is running on. */ - char machine[_UTSNAME_LENGTH]; - - /* Name of the domain of this node on the network. */ - char domainname[_UTSNAME_DOMAIN_LENGTH]; -}; - -extern int uname (struct utsname *__name) __THROW; -#endif diff --git a/mdk-stage1/dietlibc/include/sys/vfs.h b/mdk-stage1/dietlibc/include/sys/vfs.h deleted file mode 100644 index e4740a225..000000000 --- a/mdk-stage1/dietlibc/include/sys/vfs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _SYS_VFS_H -#define _SYS_VFS_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <linux/vfs.h> - -int statfs(const char *path, struct statfs *buf) __THROW; -int fstatfs(int fd, struct statfs *buf) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/sys/wait.h b/mdk-stage1/dietlibc/include/sys/wait.h deleted file mode 100644 index eb70112e2..000000000 --- a/mdk-stage1/dietlibc/include/sys/wait.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H - -#include <sys/cdefs.h> -#include <sys/resource.h> -#include <linux/wait.h> - -/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ -#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) -#define WEXITSTATUS __WEXITSTATUS - -/* If WIFSIGNALED(STATUS), the terminating signal. */ -#define __WTERMSIG(status) ((status) & 0x7f) -#define WTERMSIG __WTERMSIG - -/* If WIFSTOPPED(STATUS), the signal that stopped the child. */ -#define __WSTOPSIG(status) __WEXITSTATUS(status) -#define WSTOPSIG __WSTOPSIG - -/* Nonzero if STATUS indicates normal termination. */ -#define WIFEXITED(status) (__WTERMSIG(status) == 0) - -/* Nonzero if STATUS indicates termination by a signal. */ -#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) - -/* Nonzero if STATUS indicates the child is stopped. */ -#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) - - -pid_t wait(int *status) __THROW; -pid_t waitpid(pid_t pid, int *status, int options) __THROW; - -pid_t wait3(int *status, int options, struct rusage *rusage) __THROW; - -pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/syslog.h b/mdk-stage1/dietlibc/include/syslog.h deleted file mode 100644 index 830b4928a..000000000 --- a/mdk-stage1/dietlibc/include/syslog.h +++ /dev/null @@ -1 +0,0 @@ -#include <sys/syslog.h> diff --git a/mdk-stage1/dietlibc/include/termios.h b/mdk-stage1/dietlibc/include/termios.h deleted file mode 100644 index f10909c1b..000000000 --- a/mdk-stage1/dietlibc/include/termios.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _TERMIOS_H -#define _TERMIOS_H - -#include <sys/cdefs.h> -#include <sys/types.h> - -/* man, the Linux kernel headers suck */ -#define __USE_BSD -#include <linux/termios.h> -#undef __USE_BSD - -pid_t tcgetpgrp(int fd) __THROW; -int tcsetpgrp(int fd, pid_t pgrpid) __THROW; -int tcgetattr(int fd, struct termios *termios_p) __THROW; -int tcsetattr(int fd, int optional_actions, struct termios *termios_p) __THROW; -speed_t cfgetospeed(struct termios *termios_p) __THROW; -int cfsetospeed(struct termios *termios_p, speed_t speed) __THROW; -speed_t cfgetispeed(struct termios *termios_p) __THROW; -int cfsetispeed(struct termios *termios_p, speed_t speed) __THROW; -int tcflush(int fd, int queue_selector) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/time.h b/mdk-stage1/dietlibc/include/time.h deleted file mode 100644 index 827c85b97..000000000 --- a/mdk-stage1/dietlibc/include/time.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _TIME_H -#define _TIME_H - -#include <sys/cdefs.h> -#include <sys/time.h> - -extern int __isleap(int year); - -int nanosleep(const struct timespec *req, struct timespec *rem) __THROW; -unsigned int sleep(unsigned int secs) __THROW; - -time_t mktime(struct tm *timeptr) __THROW __pure__; - -char *asctime(const struct tm *timeptr) __THROW; -char *asctime_r(const struct tm *timeptr, char *buf) __THROW; - -char *ctime(const time_t *timep) __THROW; - -size_t strftime(char *s, size_t max, const char *format, const struct tm *tm) __THROW; -time_t time(time_t *t) __THROW; - -int stime(time_t *t) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/unistd.h b/mdk-stage1/dietlibc/include/unistd.h deleted file mode 100644 index 1a528c0e4..000000000 --- a/mdk-stage1/dietlibc/include/unistd.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef _UNISTD_H -#define _UNISTD_H - -#include <sys/cdefs.h> -#include <dirent.h> -#include <sys/types.h> -#include <sys/time.h> -#include <getopt.h> -#include <linux/sysctl.h> -#include <sys/stat.h> - -/* Values for the second argument to access. - These may be OR'd together. */ -#define R_OK 4 /* Test for read permission. */ -#define W_OK 2 /* Test for write permission. */ -#define X_OK 1 /* Test for execute permission. */ -#define F_OK 0 /* Test for existence. */ - -/* Test for access to NAME using the real UID and real GID. */ -extern int access (__const char *__name, int __type) __THROW; - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -off_t lseek(int fildes, off_t offset, int whence) __THROW; -int llseek(int fildes, unsigned long hi, unsigned long lo, loff_t* result,int whence) __THROW; -#ifndef __NO_STAT64 -loff_t lseek64(int fildes, loff_t offset, int whence) __THROW; -#endif -#if _FILE_OFFSET_BITS == 64 -#define lseek(fildes,offset,whence) lseek64(fildes,offset,whence) -#endif - -int chdir(const char *path) __THROW; -int fchdir(int fd) __THROW; -int mkdir(const char *pathname, mode_t mode) __THROW; -int rmdir(const char *pathname) __THROW; -char *getcwd(char *buf, size_t size) __THROW; - -int open(const char* pathname,int flags, ...) __THROW; -int open64(const char* pathname,int flags, ...) __THROW; -int creat(const char* pathname,mode_t mode) __THROW; -int creat64(const char* pathname,mode_t mode) __THROW; -int write(int fd,const void* buf,size_t len) __THROW; -int read(int fd,void* buf,size_t len) __THROW; -int close(int fd) __THROW; - -int unlink(const char *pathname) __THROW; - -int pread(int fd, void *buf, size_t count, off_t offset); -int pwrite(int fd, const void *buf, size_t count, off_t offset); - -int execve(const char *filename, char *const argv [], char *const envp[]) __THROW; -int execlp(const char *file, const char *arg, ...) __THROW; -int execv(const char *path, char *const argv[]) __THROW; -int execvp(const char *file, char *const argv[]) __THROW; -int execl(const char *path, ...) __THROW; - -pid_t getpid(void) __attribute__((__const__)) __THROW; -pid_t getppid(void) __THROW; -int kill(pid_t pid, int sig) __THROW; - -int setpgid (pid_t pid,pid_t pgid) __THROW; -pid_t getpgid (pid_t pid) __THROW; -int setpgrp (void) __THROW; -pid_t getpgrp (void) __THROW; -pid_t setsid (void) __THROW; -int dup (int oldfd) __THROW; -int dup2 (int oldfd,int newfd) __THROW; - -int mknod(const char *pathname, mode_t mode, dev_t dev) __THROW; - -int getdents(unsigned int fd, struct dirent *dirp, unsigned int count) __THROW; -int getdents64(unsigned int fd, struct dirent64 *dirp, unsigned int count) __THROW; - -pid_t fork(void) __THROW; -pid_t vfork(void) __THROW; - -int readlink(const char *path, char *buf, size_t bufsiz) __THROW; -int symlink(const char *oldpath, const char *newpath) __THROW; -int link(const char *oldpath, const char *newpath) __THROW; - -int chown(const char *path, uid_t owner, gid_t group) __THROW; -int fchown(int fd, uid_t owner, gid_t group) __THROW; -int lchown(const char *path, uid_t owner, gid_t group) __THROW; - -int fsync(int fd) __THROW; - -int pipe(int filedes[2]) __THROW; - -char *ttyname (int desc) __THROW; - -int brk(void *end_data_segment) __THROW; -void *sbrk(ptrdiff_t increment) __THROW; - -int gethostname(char *name, size_t len) __THROW; -int sethostname(const char *name, size_t len) __THROW; - -void usleep(unsigned long usec) __THROW; -unsigned int sleep(unsigned int seconds) __THROW; - -unsigned int alarm(unsigned int seconds) __THROW; -int sync(void) __THROW; - -int isatty(int desc) __THROW; - -void _exit(int status) __THROW __attribute__((noreturn)); - -extern int daemon (int nochdir,int noclose) __THROW; - -#if _FILE_OFFSET_BITS == 64 -#define open open64 -#define creat creat64 -#endif - -extern char* getlogin(void) __THROW; -/* warning: the diet libc getlogin() simply returns getenv("LOGNAME") */ - -int chroot(const char *path) __THROW; - -uid_t getuid(void) __THROW; -uid_t geteuid(void) __THROW; -gid_t getgid(void) __THROW; -gid_t getegid(void) __THROW; -int setuid(uid_t uid) __THROW; -/* int seteuid(uid_t uid) __THROW; */ -int setgid(gid_t gid) __THROW; -/* int setegid(gid_t gid) __THROW; */ -int setregid(gid_t rgid, gid_t egid) __THROW; -int setreuid(uid_t ruid, uid_t euid) __THROW; -#define seteuid(euid) setreuid(-1,euid) -#define setegid(egid) setregid(-1,egid) - -int rename(const char *oldpath, const char *newpath) __THROW; -int ftruncate(int fd, off_t length) __THROW; - -int mkstemp(char *Template) __THROW; - -int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) __THROW; - -int nice(int inc) __THROW; - -extern char *__environ[]; - -char *crypt(const char *key, const char *salt) __THROW; -void encrypt(char block[64], int edflag) __THROW; -void setkey(const char *key) __THROW; - -size_t getpagesize(void) __attribute__((__const__)) __THROW; - -int getdomainname(char *name, size_t len) __THROW; -int setdomainname(const char *name, size_t len) __THROW; - -int getgroups(int size, gid_t list[]) __THROW; - -/* warning: linux specific: */ -int _sysctl(struct __sysctl_args *args) __THROW; -int sendfile(int out_fd, int in_fd, off_t *offset, size_t count) __THROW; - -int getdtablesize(void) __THROW; -char *getpass(const char * prompt) __THROW; - -#endif diff --git a/mdk-stage1/dietlibc/include/utime.h b/mdk-stage1/dietlibc/include/utime.h deleted file mode 100644 index 41674f379..000000000 --- a/mdk-stage1/dietlibc/include/utime.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _UTIME_H -#define _UTIME_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <time.h> - -struct utimbuf { - time_t actime; /* access time */ - time_t modtime; /* modification time */ -}; - -int utime(const char *filename, struct utimbuf *buf) __THROW; - - -#endif diff --git a/mdk-stage1/dietlibc/include/utmp.h b/mdk-stage1/dietlibc/include/utmp.h deleted file mode 100644 index 2946be921..000000000 --- a/mdk-stage1/dietlibc/include/utmp.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef _UTMP_H -#define _UTMP_H - -#include <sys/cdefs.h> -#include <sys/types.h> -#include <time.h> - -#define UT_LINESIZE 32 -#define UT_NAMESIZE 32 -#define UT_HOSTSIZE 256 - -#define _PATH_UTMP "/var/run/utmp" -#define _PATH_WTMP "/var/log/wtmp" - -/* The structure describing an entry in the database of - previous logins. */ -struct lastlog - { - time_t ll_time; - char ll_line[UT_LINESIZE]; - char ll_host[UT_HOSTSIZE]; - }; - -/* The structure describing the status of a terminated process. This - type is used in `struct utmp' below. */ -struct exit_status - { - short int e_termination; /* Process termination status. */ - short int e_exit; /* Process exit status. */ - }; - -/* The structure describing an entry in the user accounting database. */ -struct utmp -{ - short int ut_type; /* Type of login. */ - pid_t ut_pid; /* Process ID of login process. */ - char ut_line[UT_LINESIZE]; /* Devicename. */ - char ut_id[4]; /* Inittab ID. */ - char ut_user[UT_NAMESIZE]; /* Username. */ - char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ -#define ut_name ut_host - struct exit_status ut_exit; /* Exit status of a process marked - as DEAD_PROCESS. */ - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ - int32_t ut_addr_v6[4]; /* Internet address of remote host. */ - char __unused[20]; /* Reserved for future use. */ -}; - -/* Values for the `ut_type' field of a `struct utmp'. */ -#define EMPTY 0 /* No valid user accounting information. */ - -#define RUN_LVL 1 /* The system's runlevel. */ -#define BOOT_TIME 2 /* Time of system boot. */ -#define NEW_TIME 3 /* Time after system clock changed. */ -#define OLD_TIME 4 /* Time when system clock changed. */ - -#define INIT_PROCESS 5 /* Process spawned by the init process. */ -#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ -#define USER_PROCESS 7 /* Normal process. */ -#define DEAD_PROCESS 8 /* Terminated process. */ - -#define ACCOUNTING 9 - -/* Tell the user that we have a modern system with UT_HOST, UT_PID, - UT_TYPE, UT_ID and UT_TV fields. */ -#define _HAVE_UT_TYPE 1 -#define _HAVE_UT_PID 1 -#define _HAVE_UT_ID 1 -#define _HAVE_UT_TV 1 -#define _HAVE_UT_HOST 1 - -#endif diff --git a/mdk-stage1/dietlibc/lib/__dtostr.c b/mdk-stage1/dietlibc/lib/__dtostr.c deleted file mode 100644 index e9a8a83d3..000000000 --- a/mdk-stage1/dietlibc/lib/__dtostr.c +++ /dev/null @@ -1,104 +0,0 @@ -#include <stdio.h> -/* convert double to string. Helper for sprintf. */ - -int __dtostr(double d,char *buf,int maxlen,int prec) { - unsigned long long *x=(unsigned long long *)&d; - /* step 1: extract sign, mantissa and exponent */ - signed int s=*x>>63; - signed long e=((*x>>52)&((1<<11)-1))-1023; -/* unsigned long long m=*x & ((1ull<<52)-1); */ - /* step 2: exponent is base 2, compute exponent for base 10 */ - signed long e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ - /* step 3: calculate 10^e10 */ - int i; - double tmp=10.0; - char *oldbuf=buf; - int initial=1; - - if (d==0.0) { - *buf='0'; ++buf; - goto done; - } - if (s) { d=-d; *buf='-'; --maxlen; buf++; } -/* printf("e=%d e10=%d prec=%d\n",e,e10,prec); */ - if (e10>=0) { - i=e10; - while (i>10) { tmp=tmp*1e10; i-=10; } - while (i>1) { tmp=tmp*10; --i; } - } else { - i=(e10=-e10); - while (i>10) { tmp=tmp*1e-10; i-=10; } - while (i>1) { tmp=tmp/10; --i; } - } - while (d/tmp<1) { - --e10; - tmp/=10.0; - } - /* step 4: see if precision is sufficient to display all digits */ - if (e10>prec) { - /* use scientific notation */ - int len=__dtostr(d/tmp,buf,maxlen,prec); - if (len==0) return 0; - maxlen-=len; buf+=len; - if (--maxlen>=0) { - *buf='e'; - ++buf; - } - for (len=1000; len>0; len/=10) { - if (e10>=len || !initial) { - if (--maxlen>=0) { - *buf=(e10/len)+'0'; - ++buf; - } - initial=0; - e10=e10%len; - } - } - if (maxlen>=0) return buf-oldbuf; - return 0; - } - /* step 5: loop through the digits, inserting the decimal point when - * appropriate */ - if (d<1.0) { - double x=1.0; - int first=1; - do { - if (--maxlen<0) return buf-oldbuf; - *buf='0'; ++buf; - if (first) { - first=0; - *buf='.'; ++buf; - if (--maxlen<0) return buf-oldbuf; - } - x/=10.0; - } while (x>d); - } - for (; prec>0; ) { - double tmp2=d/tmp; - char c; - d-=((int)tmp2*tmp); - c=((int)tmp2); - if ((!initial)||c) { - if (--maxlen>=0) { - initial=0; - *buf=c+'0'; - ++buf; - } else - return 0; - --prec; - } - if (tmp>0.5 && tmp<1.5) { - tmp=1e-1; - initial=0; - if (--maxlen>=0) { - *buf='.'; - ++buf; - } else - return 0; - } else - tmp/=10.0; - } -done: - *buf=0; - return buf-oldbuf; -} diff --git a/mdk-stage1/dietlibc/lib/__fstat64.c b/mdk-stage1/dietlibc/lib/__fstat64.c deleted file mode 100644 index 6f9fcb2c5..000000000 --- a/mdk-stage1/dietlibc/lib/__fstat64.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include <sys/stat.h> -#ifndef __NO_STAT64 -#include <errno.h> - -extern int __dietlibc_fstat64(int __fd, struct stat64 *__buf); -extern void __stat64_cvt(const struct stat *src,struct stat64 *dest); - -int fstat64(int __fd, struct stat64 *__buf) { - if (__dietlibc_fstat64(__fd,__buf)) { - struct stat temp; -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - if (fstat(__fd,&temp)) return -1; - __stat64_cvt(&temp,__buf); - } - return 0; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/__getcwd.c b/mdk-stage1/dietlibc/lib/__getcwd.c deleted file mode 100644 index e97fc4520..000000000 --- a/mdk-stage1/dietlibc/lib/__getcwd.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdlib.h> - -extern int __syscall_getcwd(char* buf, size_t size); - -char *getcwd(char *buf, size_t size) { - int tmp; - if ((tmp=__syscall_getcwd(buf,size))<0) return 0; - buf[tmp]=0; - return buf; -} diff --git a/mdk-stage1/dietlibc/lib/__isnan.c b/mdk-stage1/dietlibc/lib/__isnan.c deleted file mode 100644 index 9d21e9824..000000000 --- a/mdk-stage1/dietlibc/lib/__isnan.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <stdio.h> - -int __isnan(double d) { - unsigned long long *x=(unsigned long long *)&d; - return (*x==0x7FF8002000000000ll || *x==0x7FF0002000000000); -} - -#if 0 -TestFromIeeeExtended("7FFF0000000000000000"); /* +infinity */ -TestFromIeeeExtended("FFFF0000000000000000"); /* -infinity */ -TestFromIeeeExtended("7FFF8001000000000000"); /* Quiet NaN(1) */ -TestFromIeeeExtended("7FFF0001000000000000"); /* Signalling NaN(1) */ -TestFromIeeeExtended("3FFFFEDCBA9876543210"); /* accuracy test */ -#endif diff --git a/mdk-stage1/dietlibc/lib/__lltostr.c b/mdk-stage1/dietlibc/lib/__lltostr.c deleted file mode 100644 index eb4a27cef..000000000 --- a/mdk-stage1/dietlibc/lib/__lltostr.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <string.h> - -int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase) -{ - char *tmp; - int j=0; - - s[--size]=0; - - tmp=s+size; - - if ((base==0)||(base>36)) base=10; - - j=0; - if (!i) - { - *(--tmp)='0'; - j=1; - } - - while((tmp>s)&&(i)) - { - tmp--; - if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1; - i=i/base; - j++; - } - memmove(s,tmp,j+1); - - return j; -} diff --git a/mdk-stage1/dietlibc/lib/__lstat64.c b/mdk-stage1/dietlibc/lib/__lstat64.c deleted file mode 100644 index a871f3917..000000000 --- a/mdk-stage1/dietlibc/lib/__lstat64.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include <sys/stat.h> -#ifndef __NO_STAT64 -#include <errno.h> - -extern int __dietlibc_lstat64(const char *__file, struct stat64 *__buf); -extern void __stat64_cvt(const struct stat *src,struct stat64 *dest); - -int lstat64(const char *__file, struct stat64 *__buf) { - if (__dietlibc_lstat64(__file,__buf)) { - struct stat temp; -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - if (lstat(__file,&temp)) return -1; - __stat64_cvt(&temp,__buf); - } - return 0; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/__ltostr.c b/mdk-stage1/dietlibc/lib/__ltostr.c deleted file mode 100644 index 57e0690d2..000000000 --- a/mdk-stage1/dietlibc/lib/__ltostr.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <string.h> - -int __ltostr(char *s, int size, unsigned long i, int base, char UpCase) -{ - char *tmp; - int j=0; - - s[--size]=0; - - tmp=s+size; - - if ((base==0)||(base>36)) base=10; - - j=0; - if (!i) - { - *(--tmp)='0'; - j=1; - } - - while((tmp>s)&&(i)) - { - tmp--; - if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1; - i=i/base; - j++; - } - memmove(s,tmp,j+1); - - return j; -} diff --git a/mdk-stage1/dietlibc/lib/__stat64.c b/mdk-stage1/dietlibc/lib/__stat64.c deleted file mode 100644 index dfb0d4315..000000000 --- a/mdk-stage1/dietlibc/lib/__stat64.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include <sys/stat.h> -#ifndef __NO_STAT64 -#include <errno.h> - -extern int __dietlibc_stat64(const char *__file, struct stat64 *__buf); -extern void __stat64_cvt(const struct stat *src,struct stat64 *dest); - -int stat64(const char *__file, struct stat64 *__buf) { - if (__dietlibc_stat64(__file,__buf)) { - struct stat temp; -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - if (stat(__file,&temp)) return -1; - __stat64_cvt(&temp,__buf); - } - return 0; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/__stat64_cvt.c b/mdk-stage1/dietlibc/lib/__stat64_cvt.c deleted file mode 100644 index dced352a4..000000000 --- a/mdk-stage1/dietlibc/lib/__stat64_cvt.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <sys/stat.h> -#ifndef __NO_STAT64 - -void __stat64_cvt(const struct stat *src,struct stat64 *dest) { - dest->st_dev=src->st_dev; - dest->st_ino=src->st_ino; - dest->st_mode=src->st_mode; - dest->st_nlink=src->st_nlink; - dest->st_uid=src->st_gid; - dest->st_rdev=src->st_rdev; - dest->st_size=src->st_size; - dest->st_blksize=src->st_blksize; - dest->st_blocks=src->st_blocks; - dest->st_atime=src->st_atime; - dest->st_mtime=src->st_mtime; - dest->st_ctime=src->st_ctime; -} -#endif diff --git a/mdk-stage1/dietlibc/lib/__xmknod.c b/mdk-stage1/dietlibc/lib/__xmknod.c deleted file mode 100644 index 4739a1f5f..000000000 --- a/mdk-stage1/dietlibc/lib/__xmknod.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <sys/stat.h> - -int __xmknod(int ver,char* filename,mode_t mode,dev_t *dev) { - return mknod(filename,mode,*dev); -} - diff --git a/mdk-stage1/dietlibc/lib/_brk.c b/mdk-stage1/dietlibc/lib/_brk.c deleted file mode 100644 index 6d0b29c03..000000000 --- a/mdk-stage1/dietlibc/lib/_brk.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <unistd.h> - -extern int __diet_brk(void *end_data_segment); - -void* __curbrk=0; - -int __brk(void *end_data_segment) { - int res; - if ((res=__diet_brk(end_data_segment))==0) - __curbrk=end_data_segment; - return res; -} - -int brk (void *end_data_segment) __attribute__((weak,alias("__brk"))); diff --git a/mdk-stage1/dietlibc/lib/abort.c b/mdk-stage1/dietlibc/lib/abort.c deleted file mode 100644 index 55bfb8f0f..000000000 --- a/mdk-stage1/dietlibc/lib/abort.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <linux/types.h> -#include <linux/signal.h> -#include <signal.h> -#include <stdlib.h> - -void abort() { - sigset_t t; - if (!sigemptyset(&t) && !sigaddset(&t, SIGABRT)) - sigprocmask(SIG_UNBLOCK, &t, 0); - while (1) - if (raise(SIGABRT)) - exit(127); -} diff --git a/mdk-stage1/dietlibc/lib/abs.c b/mdk-stage1/dietlibc/lib/abs.c deleted file mode 100644 index 9d7055358..000000000 --- a/mdk-stage1/dietlibc/lib/abs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdlib.h> - -int abs(int j) -{ - return (j < 0) ? -j : j; -} diff --git a/mdk-stage1/dietlibc/lib/accept.c b/mdk-stage1/dietlibc/lib/accept.c deleted file mode 100644 index c7e8254ca..000000000 --- a/mdk-stage1/dietlibc/lib/accept.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_accept(int a, void * addr, void * addr2) { -#ifdef __i386__ - return socketcall(SYS_ACCEPT, (long*)&a); -#else - unsigned long args[] = { a, (long) addr, (long) addr2 }; - return socketcall(SYS_ACCEPT, args); -#endif -} - -int accept(int a, void * addr, void * addr2) __attribute__((weak,alias("__libc_accept"))); diff --git a/mdk-stage1/dietlibc/lib/alarm.c b/mdk-stage1/dietlibc/lib/alarm.c deleted file mode 100644 index fd35372f2..000000000 --- a/mdk-stage1/dietlibc/lib/alarm.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1991, 1992, 1994, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include <unistd.h> -#include <sys/time.h> - -/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. - If SECONDS is zero, any currently scheduled alarm will be cancelled. - The function returns the number of seconds remaining until the last - alarm scheduled would have signaled, or zero if there wasn't one. - There is no return value to indicate an error, but you can set `errno' - to 0 and check its value after calling `alarm', and this might tell you. - The signal may come late due to processor scheduling. */ -unsigned int -alarm (seconds) - unsigned int seconds; -{ - struct itimerval old, new; - unsigned int retval; - - new.it_interval.tv_usec = 0; - new.it_interval.tv_sec = 0; - new.it_value.tv_usec = 0; - new.it_value.tv_sec = (long int) seconds; - if (setitimer (ITIMER_REAL, &new, &old) < 0) - return 0; - - retval = old.it_value.tv_sec; - if (old.it_value.tv_usec) - ++retval; - return retval; -} diff --git a/mdk-stage1/dietlibc/lib/alloc.c b/mdk-stage1/dietlibc/lib/alloc.c deleted file mode 100644 index 8cb87a69b..000000000 --- a/mdk-stage1/dietlibc/lib/alloc.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * malloc/free by O.Dreesen - */ - -#include <linux/unistd.h> -#include <asm/mman.h> -#include <linux/errno.h> -#include "dietfeatures.h" - -#if 0 -#include <sys/mman.h> -#define _LIBC -#include <errno.h> -#endif - -#include <linux/types.h> - -#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON) -#define MAP_ANON MAP_ANONYMOUS -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((void*)-1) -#endif - -#ifndef NULL -#define NULL ((void*)0) -#endif - -extern void * mmap(void *start, size_t length, int prot , int flags, int fd, off_t offset); -extern void *memset(void *s, int c, size_t n); -extern void *memcpy(void *dest, const void *src, size_t n); - -typedef struct t_alloc_head { - unsigned int magic1; - struct t_alloc_head *ptr; - unsigned long size; - unsigned int magic2; -} alloc_head; - -/* guess what ? the virtual block size */ -#define MEM_BLOCK_SIZE 4096 - -/* minimum allocated bytes */ -#define MEM_ALLOC_MIN 4 - -/* Initial start position in memory */ -#define MEM_ALLOC_START ((char*)0x18000000) - -/* Make every block align */ -#define MEM_ALIGN(s) (((s)+MEM_ALLOC_MIN-1)&(~(MEM_ALLOC_MIN-1))) -#define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(~(MEM_BLOCK_SIZE-1))) -#define PAGE_ALIGNP(p) ((char*)PAGE_ALIGN((size_t)(p))) - -#define END_OF_BLOCK(p) ((alloc_head*)(((char*)(p))+((p)->size))) -#define START_BLOCK(p) ((alloc_head*)(((char*)(p))-sizeof(alloc_head))) -#define START_DATA(p) (((char*)(p))+sizeof(alloc_head)) -#define MIN_ALLOC(s) (((((s)+sizeof(alloc_head)-1)/MEM_ALLOC_MIN)+1)*MEM_ALLOC_MIN) - -#define ALLOC_MAGIC1 0xbad2f7ee -#define ALLOC_MAGIC2 0xf7ee2bad - -/* freelist handler */ -static alloc_head base = {ALLOC_MAGIC1,&base,0,ALLOC_MAGIC2}; -static char *alloc_get_end = MEM_ALLOC_START; - -void __libc_free(void *ptr) -{ - alloc_head *prev,*p,*block; - - if (ptr==NULL) return; - - block=START_BLOCK(ptr); - if (block->magic1 != ALLOC_MAGIC1) return; - if (block->magic2 != ALLOC_MAGIC2) return; - - prev=&base; - for (p=prev->ptr ; ; prev=p, p=p->ptr) - { - if ((block>prev)&&(block<p)) break; /* found the gap block belongs */ - if ((prev>p)&&(block<p)) break; /* block pre freelist */ - if ((prev>p)&&(block>prev)) break; /* block after freelist */ - - /* emergency escape: freelist has ONLY one entry the freelist base */ - if (p->ptr==p) break; - } - prev->ptr = block; - - if (END_OF_BLOCK(block)==p) - { /* join right neighbor */ - block->ptr = p->ptr; - block->size += p->size; - } - else - block->ptr = p; - - if (END_OF_BLOCK(prev)==block) - { /* join left neighbor */ - prev->size += block->size; - prev->ptr = block->ptr; - } -} -void free(void *ptr) __attribute__((weak,alias("__libc_free"))); - -static void *alloc_get_mem(unsigned long size) -{ - char *tmp; - alloc_head *ah; - - size=PAGE_ALIGN(size); - - /* map free pages @ alloc_get_end */ - tmp=mmap(alloc_get_end, size, PROT_READ|PROT_WRITE, - MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0); - if (tmp==MAP_FAILED) - { - /* OK we can't map free pages @ alloc_get_end so try free position */ - tmp=mmap(0, size, PROT_READ|PROT_WRITE, - MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); - if (tmp==MAP_FAILED) - { - errno = ENOMEM; - return NULL; /* PANIC ! */ - } - alloc_get_end=tmp; - } - - alloc_get_end+=size; - - /* make a header */ - ah=(alloc_head*)tmp; - ah->magic1=ALLOC_MAGIC1; - ah->magic2=ALLOC_MAGIC2; - ah->ptr=ah; - ah->size=size; - - /* link new free maped pages in freelist */ - __libc_free(START_DATA(tmp)); - - return &base; -} - -void *__libc_malloc(size_t size) -{ - alloc_head *p, *prev; - size_t need; - - /* needed MEM_ALLOC_MIN */ - need=MIN_ALLOC(size); - - prev=&base; - for (p=prev->ptr;;prev=p,p=p->ptr) - { - if (p->size>=need) - { - if (p->size==need) - { /* fit PERFECT */ - prev->ptr=p->ptr; /* relink freelist */ - } - else - { - alloc_head *tmp=(alloc_head*)(((char*)p)+need); - if ((p->size-need)<sizeof(alloc_head)) - { /* work around: if there is not enough space for freelist head. - * this waste some bytes ( < sizeof(alloc_head) ) */ - need=p->size; - prev->ptr=p->ptr; /* relink freelist */ - } - else - { - prev->ptr=tmp; - tmp->magic1=ALLOC_MAGIC1; - tmp->magic2=ALLOC_MAGIC2; - tmp->ptr=p->ptr; - tmp->size=p->size-need; /* remaining size */ - } - - p->size=need; /* set size */ - } - p->ptr=p; /* self-link */ - - return (void*)START_DATA(p); - } - else if (p==&base) - { - if ((p=alloc_get_mem(need))==NULL) goto err_out; - } - } -err_out: - return NULL; -} -void *malloc(size_t size) __attribute__((weak,alias("__libc_malloc"))); - -void *calloc(size_t nmemb,size_t size) -{ - size_t n=nmemb*size; - void *tmp=malloc(n); - if (tmp) memset(tmp,0,n); - return tmp; -} - -void *realloc(void *ptr,size_t size) -{ - alloc_head *tmp=0,*tf=0; - long need=0; - long diff=0; - - if (ptr) - { - if (size) - { - tmp=START_BLOCK(ptr); - need=MIN_ALLOC(size); /* only this size will survive */ - diff=tmp->size-need; - if (diff<0) - { - if ((tf=malloc(size))) - { - memcpy(tf,ptr,tmp->size-sizeof(alloc_head)); - free(ptr); - return tf; - } - return NULL; - } - if (diff>=sizeof(alloc_head)) - { - tmp->size=need; - tf=END_OF_BLOCK(tmp); - tf->magic1=ALLOC_MAGIC1; - tf->magic2=ALLOC_MAGIC2; - tf->ptr=tf; - tf->size=diff; - free(START_DATA(tf)); - } - return ptr; - } - else - free(ptr); - } - else if (size>0) - return malloc(size); - return NULL; -} diff --git a/mdk-stage1/dietlibc/lib/assert_fail.c b/mdk-stage1/dietlibc/lib/assert_fail.c deleted file mode 100644 index 3d6ba65c1..000000000 --- a/mdk-stage1/dietlibc/lib/assert_fail.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include "dietwarning.h" - -extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase); - -void __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function) -{ - int alen=strlen(assertion); - int flen=strlen(file); - int fulen=strlen(function); - char *buf=(char*)alloca(alen+flen+fulen+50); - if (buf) { - char *tmp; - *buf=0; - if (file) strcat(strcat(buf,file),":"); - tmp=buf+strlen(buf); - __ltostr(tmp,10,line,10,0); - strcat(buf,": "); - if (function) strcat(strcat(buf,function),": "); - strcat(buf,"Assertion `"); - strcat(buf,assertion); - strcat(buf,"' failed.\n"); - write(2,buf,strlen(buf)); - } - abort(); -} - -link_warning("__assert_fail","warning: your code still has assertions enabled!") diff --git a/mdk-stage1/dietlibc/lib/atexit.c b/mdk-stage1/dietlibc/lib/atexit.c deleted file mode 100644 index 8204af06c..000000000 --- a/mdk-stage1/dietlibc/lib/atexit.c +++ /dev/null @@ -1,23 +0,0 @@ -typedef void (*function)(void); - -static function __atexitlist[4]; - -int atexit(function t) { - int i; - for (i=0; i<4; i++) - if (__atexitlist[i]==0) { - __atexitlist[i]=t; - return 0; - } - return -1; -} - -extern void _exit(int code) __attribute__((noreturn)); - -void exit(int code) { - if (__atexitlist[3]) __atexitlist[3](); - if (__atexitlist[2]) __atexitlist[2](); - if (__atexitlist[1]) __atexitlist[1](); - if (__atexitlist[0]) __atexitlist[0](); - _exit(code); -} diff --git a/mdk-stage1/dietlibc/lib/atof.c b/mdk-stage1/dietlibc/lib/atof.c deleted file mode 100644 index 54221390e..000000000 --- a/mdk-stage1/dietlibc/lib/atof.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdlib.h> - -double atof(const char *nptr) { -#if 0 - return strtod(nptr,0); -#else - double tmp=strtod(nptr,0); - return tmp; -#endif -} diff --git a/mdk-stage1/dietlibc/lib/atoi.c b/mdk-stage1/dietlibc/lib/atoi.c deleted file mode 100644 index fe952b8c4..000000000 --- a/mdk-stage1/dietlibc/lib/atoi.c +++ /dev/null @@ -1,8 +0,0 @@ -int atoi(const char* s) { - int v=0; - int sign=1; - if (*s=='-') { sign=-1; ++s; } else if (*s=='+') ++s; - while (*s && (*s>='0') && (*s<='9')) - v=v*10+*s++-'0'; - return v*sign; -} diff --git a/mdk-stage1/dietlibc/lib/atol.c b/mdk-stage1/dietlibc/lib/atol.c deleted file mode 100644 index 558a004b9..000000000 --- a/mdk-stage1/dietlibc/lib/atol.c +++ /dev/null @@ -1,8 +0,0 @@ -long int atol(const char* s) { - long int v=0; - int sign=1; - if (*s=='-') { sign=-1; ++s; } else if (*s=='+') ++s; - while (*s && (*s>='0') && (*s<='9')) - v=v*10+*s++-'0'; - return v*sign; -} diff --git a/mdk-stage1/dietlibc/lib/bind.c b/mdk-stage1/dietlibc/lib/bind.c deleted file mode 100644 index ec1c93e1b..000000000 --- a/mdk-stage1/dietlibc/lib/bind.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int bind(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_BIND, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_BIND, args); -#endif -} diff --git a/mdk-stage1/dietlibc/lib/bsearch.c b/mdk-stage1/dietlibc/lib/bsearch.c deleted file mode 100644 index d2f5c74b2..000000000 --- a/mdk-stage1/dietlibc/lib/bsearch.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <stdlib.h> - -void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { - const char *v, *r; - int res; - r=base+(nmemb-1)*size; - do { - register int num=nmemb/2; - v=base+num*size; - if ((res=compar(key,v))<0) { - r=v-size; - nmemb=num; - } else { - if (res==0) return (void*)v; - base=v+size; - nmemb-=num; - } - } while ((char*)base<=r); - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/cfmakeraw.c b/mdk-stage1/dietlibc/lib/cfmakeraw.c deleted file mode 100644 index 7f6df9913..000000000 --- a/mdk-stage1/dietlibc/lib/cfmakeraw.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <termios.h> -#include <sys/ioctl.h> - -void cfmakeraw(struct termios *t) -{ - t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - t->c_oflag &= ~OPOST; - t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t->c_cflag &= ~(CSIZE|PARENB); - t->c_cflag |= CS8; - t->c_cc[VMIN] = 1; - t->c_cc[VTIME] = 0; -} - diff --git a/mdk-stage1/dietlibc/lib/closedir.c b/mdk-stage1/dietlibc/lib/closedir.c deleted file mode 100644 index e73025eb1..000000000 --- a/mdk-stage1/dietlibc/lib/closedir.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "dietdirent.h" -#include <unistd.h> -#include <dirent.h> -#include <stdlib.h> - -int closedir (DIR* d) { - int res=close(d->fd); - free(d); - return res; -} diff --git a/mdk-stage1/dietlibc/lib/connect.c b/mdk-stage1/dietlibc/lib/connect.c deleted file mode 100644 index 01fd61a6c..000000000 --- a/mdk-stage1/dietlibc/lib/connect.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_connect(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_CONNECT, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_CONNECT, args); -#endif -} - -int connect(int a, void * b, int c) __attribute__((weak,alias("__libc_connect"))); diff --git a/mdk-stage1/dietlibc/lib/creat.c b/mdk-stage1/dietlibc/lib/creat.c deleted file mode 100644 index 82145b515..000000000 --- a/mdk-stage1/dietlibc/lib/creat.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <fcntl.h> - -int creat(const char *file,mode_t mode) { - return open(file,O_WRONLY|O_CREAT|O_TRUNC,mode); -} diff --git a/mdk-stage1/dietlibc/lib/creat64.c b/mdk-stage1/dietlibc/lib/creat64.c deleted file mode 100644 index 8cf897b57..000000000 --- a/mdk-stage1/dietlibc/lib/creat64.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <fcntl.h> - -#ifndef O_LARGEFILE -#define O_LARGEFILE 0 -#endif - -int creat64(const char *file,mode_t mode) { - return open(file,O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE,mode); -} diff --git a/mdk-stage1/dietlibc/lib/errlist.c b/mdk-stage1/dietlibc/lib/errlist.c deleted file mode 100644 index d0e712190..000000000 --- a/mdk-stage1/dietlibc/lib/errlist.c +++ /dev/null @@ -1,132 +0,0 @@ - -const char *const sys_errlist[] = { - "Success", /* 0 */ - "Operation not permitted", /* EPERM */ - "No such file or directory", /* ENOENT */ - "No such process", /* ESRCH */ - "Interrupted system call", /* EINTR */ - "I/O error", /* EIO */ - "No such device or address", /* ENXIO */ - "Arg list too long", /* E2BIG */ - "Exec format error", /* ENOEXEC */ - "Bad file number", /* EBADF */ - "No child processes", /* ECHILD */ - "Try again", /* EAGAIN */ - "Out of memory", /* ENOMEM */ - "Permission denied", /* EACCES */ - "Bad address", /* EFAULT */ - "Block device required", /* ENOTBLK */ - "Device or resource busy", /* EBUSY */ - "File exists", /* EEXIST */ - "Cross-device link", /* EXDEV */ - "No such device", /* ENODEV */ - "Not a directory", /* ENOTDIR */ - "Is a directory", /* EISDIR */ - "Invalid argument", /* EINVAL */ - "File table overflow", /* ENFILE */ - "Too many open files", /* EMFILE */ - "Not a typewriter", /* ENOTTY */ - "Text file busy", /* ETXTBSY */ - "File too large", /* EFBIG */ - "No space left on device", /* ENOSPC */ - "Illegal seek", /* ESPIPE */ - "Read-only file system", /* EROFS */ - "Too many links", /* EMLINK */ - "Broken pipe", /* EPIPE */ - "Math argument out of domain of func", /* EDOM */ - "Math result not representable", /* ERANGE */ - "Resource deadlock would occur", /* EDEADLK */ - "File name too long", /* ENAMETOOLONG */ - "No record locks available", /* ENOLCK */ - "Function not implemented", /* ENOSYS */ - "Directory not empty", /* ENOTEMPTY */ - "Too many symbolic links encountered", /* ELOOP */ - "Operation would block", /* EWOULDBLOCK */ - "No message of desired type", /* ENOMSG */ - "Identifier removed", /* EIDRM */ - "Channel number out of range", /* ECHRNG */ - "Level 2 not synchronized", /* EL2NSYNC */ - "Level 3 halted", /* EL3HLT */ - "Level 3 reset", /* EL3RST */ - "Link number out of range", /* ELNRNG */ - "Protocol driver not attached", /* EUNATCH */ - "No CSI structure available", /* ENOCSI */ - "Level 2 halted", /* EL2HLT */ - "Invalid exchange", /* EBADE */ - "Invalid request descriptor", /* EBADR */ - "Exchange full", /* EXFULL */ - "No anode", /* ENOANO */ - "Invalid request code", /* EBADRQC */ - "Invalid slot", /* EBADSLT */ - "File locking deadlock error", /* EDEADLOCK */ - "Bad font file format", /* EBFONT */ - "Device not a stream", /* ENOSTR */ - "No data available", /* ENODATA */ - "Timer expired", /* ETIME */ - "Out of streams resources", /* ENOSR */ - "Machine is not on the network", /* ENONET */ - "Package not installed", /* ENOPKG */ - "Object is remote", /* EREMOTE */ - "Link has been severed", /* ENOLINK */ - "Advertise error", /* EADV */ - "Srmount error", /* ESRMNT */ - "Communication error on send", /* ECOMM */ - "Protocol error", /* EPROTO */ - "Multihop attempted", /* EMULTIHOP */ - "RFS specific error", /* EDOTDOT */ - "Not a data message", /* EBADMSG */ - "Value too large for defined data type", /* EOVERFLOW */ - "Name not unique on network", /* ENOTUNIQ */ - "File descriptor in bad state", /* EBADFD */ - "Remote address changed", /* EREMCHG */ - "Can not access a needed shared library", /* ELIBACC */ - "Accessing a corrupted shared library", /* ELIBBAD */ - ".lib section in a.out corrupted", /* ELIBSCN */ - "Attempting to link in too many shared libraries", /* ELIBMAX */ - "Cannot exec a shared library directly", /* ELIBEXEC */ - "Illegal byte sequence", /* EILSEQ */ - "Interrupted system call should be restarted", /* ERESTART */ - "Streams pipe error", /* ESTRPIPE */ - "Too many users", /* EUSERS */ - "Socket operation on non-socket", /* ENOTSOCK */ - "Destination address required", /* EDESTADDRREQ */ - "Message too long", /* EMSGSIZE */ - "Protocol wrong type for socket", /* EPROTOTYPE */ - "Protocol not available", /* ENOPROTOOPT */ - "Protocol not supported", /* EPROTONOSUPPORT */ - "Socket type not supported", /* ESOCKTNOSUPPORT */ - "Operation not supported on transport endpoint", /* EOPNOTSUPP */ - "Protocol family not supported", /* EPFNOSUPPORT */ - "Address family not supported by protocol", /* EAFNOSUPPORT */ - "Address already in use", /* EADDRINUSE */ - "Cannot assign requested address", /* EADDRNOTAVAIL */ - "Network is down", /* ENETDOWN */ - "Network is unreachable", /* ENETUNREACH */ - "Network dropped connection because of reset", /* ENETRESET */ - "Software caused connection abort", /* ECONNABORTED */ - "Connection reset by peer", /* ECONNRESET */ - "No buffer space available", /* ENOBUFS */ - "Transport endpoint is already connected", /* EISCONN */ - "Transport endpoint is not connected", /* ENOTCONN */ - "Cannot send after transport endpoint shutdown", /* ESHUTDOWN */ - "Too many references: cannot splice", /* ETOOMANYREFS */ - "Connection timed out", /* ETIMEDOUT */ - "Connection refused", /* ECONNREFUSED */ - "Host is down", /* EHOSTDOWN */ - "No route to host", /* EHOSTUNREACH */ - "Operation already in progress", /* EALREADY */ - "Operation now in progress", /* EINPROGRESS */ - "Stale NFS file handle", /* ESTALE */ - "Structure needs cleaning", /* EUCLEAN */ - "Not a XENIX named type file", /* ENOTNAM */ - "No XENIX semaphores available", /* ENAVAIL */ - "Is a named type file", /* EISNAM */ - "Remote I/O error", /* EREMOTEIO */ - "Quota exceeded", /* EDQUOT */ - "No medium found", /* ENOMEDIUM */ - "Wrong medium type", /* EMEDIUMTYPE */ - 0 -}; - - -const int sys_nerr = ((sizeof (sys_errlist))/(sizeof(char *))-1); diff --git a/mdk-stage1/dietlibc/lib/errno_location.c b/mdk-stage1/dietlibc/lib/errno_location.c deleted file mode 100644 index 286f833c9..000000000 --- a/mdk-stage1/dietlibc/lib/errno_location.c +++ /dev/null @@ -1,5 +0,0 @@ -extern int errno; - -int *__errno_location() { return &errno; } - -int *errno_location() __attribute__((weak,alias("__errno_location"))); diff --git a/mdk-stage1/dietlibc/lib/exec_lib.c b/mdk-stage1/dietlibc/lib/exec_lib.c deleted file mode 100644 index 3129224a0..000000000 --- a/mdk-stage1/dietlibc/lib/exec_lib.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <unistd.h> -#include <paths.h> - -extern char **environ; - -int __exec_shell(const char *file, char *const argv[]) { - int i; - - for (i = 0; argv[i]; i++); - - { - char *shell_argv[i + 1]; - shell_argv[0] = _PATH_BSHELL; - shell_argv[1] = (char *) file; - for (; i > 1; i--) - shell_argv[i] = argv[i - 1]; - return execve(_PATH_BSHELL, shell_argv, environ); - } -} - diff --git a/mdk-stage1/dietlibc/lib/exec_lib.h b/mdk-stage1/dietlibc/lib/exec_lib.h deleted file mode 100644 index 0971bd1fb..000000000 --- a/mdk-stage1/dietlibc/lib/exec_lib.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __EXEC_LIB_H -#define __EXEC_LIB_H - -#include <paths.h> - -extern int __exec_shell(const char *file, char *const argv[]); - -#endif /* __EXEC_LIB_H */ - diff --git a/mdk-stage1/dietlibc/lib/execl.c b/mdk-stage1/dietlibc/lib/execl.c deleted file mode 100644 index 71459e71f..000000000 --- a/mdk-stage1/dietlibc/lib/execl.c +++ /dev/null @@ -1,24 +0,0 @@ -#include <stdarg.h> -#include <unistd.h> -#include <errno.h> -#include <stdlib.h> - -int execl( const char *path,...) { - va_list ap; - int n,i; - char **argv,*tmp; - va_start(ap, path); - n=1; - while ((tmp=va_arg(ap,char *))) - ++n; - va_end (ap); - if ((argv=(char **)alloca(n*sizeof(char*)))) { - va_start(ap, path); - for (i=0; i<n; ++i) - argv[i]=va_arg(ap,char *); - va_end (ap); - return execve(path,argv,environ); - } - __set_errno(ENOMEM); - return -1; -} diff --git a/mdk-stage1/dietlibc/lib/execlp.c b/mdk-stage1/dietlibc/lib/execlp.c deleted file mode 100644 index 3aea1e960..000000000 --- a/mdk-stage1/dietlibc/lib/execlp.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <stdarg.h> -#include <unistd.h> -#include <errno.h> -#include <stdlib.h> -#include "dietstdarg.h" - -int execlp(const char* file, const char *arg,...) { - va_list ap,bak; - int n,i; - char **argv,*tmp; - va_start(ap, arg); - va_copy(bak,ap); - n=2; - while ((tmp=va_arg(ap,char *))) - ++n; - va_end (ap); - if ((argv=(char **)alloca(n*sizeof(char*)))) { - argv[0]=arg; - for (i=0; i<n; ++i) - argv[i+1]=va_arg(bak,char *); - va_end (bak); - return execvp(file,argv); - } - __set_errno(ENOMEM); - return -1; -} diff --git a/mdk-stage1/dietlibc/lib/execv.c b/mdk-stage1/dietlibc/lib/execv.c deleted file mode 100644 index efd760253..000000000 --- a/mdk-stage1/dietlibc/lib/execv.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <limits.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include "exec_lib.h" - -int execv(const char *file, char *const argv[]) { - if (execve(file,argv,environ)==-1) { - if (errno==ENOEXEC) __exec_shell(file,argv); - } - return -1; -} diff --git a/mdk-stage1/dietlibc/lib/execvp.c b/mdk-stage1/dietlibc/lib/execvp.c deleted file mode 100644 index 20521d69f..000000000 --- a/mdk-stage1/dietlibc/lib/execvp.c +++ /dev/null @@ -1,38 +0,0 @@ -#include <limits.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include "exec_lib.h" - -int execvp(const char *file, char *const argv[]) { - char *path=getenv("PATH"); - char *cur,*next; - char buf[PATH_MAX]; - if (strchr((char*)file,'/')) { - if (execve(file,argv,environ)==-1) { - if (errno==ENOEXEC) __exec_shell(file,argv); - return -1; - } - } - if (!path) path=_PATH_DEFPATH; - for (cur=path; cur; cur=next) { - next=strchr(cur,':'); - if (!next) - next=cur+strlen(cur); - if (next==cur) { - buf[0]='.'; - cur--; - } else - memmove(buf,cur,next-cur); - buf[next-cur]='/'; - memmove(&buf[next-cur+1],file,strlen(file)+1); - if (execve(buf,argv,environ)==-1) { - if (errno==ENOEXEC) return __exec_shell(buf,argv); - if ((errno!=EACCES) && (errno!=ENOENT)) return -1; - } - if (*next==0) break; - next++; - } - return -1; -} diff --git a/mdk-stage1/dietlibc/lib/ftw.c b/mdk-stage1/dietlibc/lib/ftw.c deleted file mode 100644 index a3c04af9a..000000000 --- a/mdk-stage1/dietlibc/lib/ftw.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <linux/stat.h> -#include <unistd.h> -#include <limits.h> -#include <ftw.h> -#include <dirent.h> -#include <string.h> -#include <stdlib.h> - -int ftw(const char *dir,int (*fn)(const char *file, const struct stat *sb, int flag), int depth) { - char *cwd; - int cwdlen; - DIR *d; - struct dirent *de; - struct stat sb; - if (chdir(dir)) return -1; - cwd=alloca(PATH_MAX+1); - if (!getcwd(cwd,PATH_MAX)) return -1; - cwd[PATH_MAX]=0; - cwdlen=strlen(cwd); -/* write(1,"ftw in ",7); puts(cwd); */ - if (!(d=opendir("."))) return -1; - while ((de=readdir(d))) { - int res; - int flag; - int nlen; - char *filename; - if (de->d_name[0]=='.' && - (de->d_name[1]==0 || - (de->d_name[1]=='.' && de->d_name[2]==0))) continue; - nlen=strlen(de->d_name); - filename=alloca(nlen+cwdlen+3); - memmove(filename,cwd,cwdlen); - filename[cwdlen]='/'; - memmove(filename+cwdlen+1,de->d_name,nlen+1); - if (!lstat(de->d_name,&sb)) { - if (S_ISLNK(sb.st_mode)) flag=FTW_SL; else - if (S_ISDIR(sb.st_mode)) flag=FTW_D; else - flag=FTW_F; - } else - flag=FTW_NS; - res=fn(filename,&sb,flag); - if (res) return res; - if (flag==FTW_D && depth>0) { - res=ftw(filename,fn,depth-1); - chdir(dir); - if (res) return res; - } -/* puts(de->d_name); */ - } - closedir(d); - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/getdomainname.c b/mdk-stage1/dietlibc/lib/getdomainname.c deleted file mode 100644 index 2554fe4c3..000000000 --- a/mdk-stage1/dietlibc/lib/getdomainname.c +++ /dev/null @@ -1,17 +0,0 @@ -#define _GNU_SOURCE - -#include <sys/types.h> -#include <sys/utsname.h> - -int getdomainname(char *name,size_t len) { - struct utsname u; - int res=uname(&u); - if (res==0) { - int i; - if (len>=_UTSNAME_DOMAIN_LENGTH) - len=_UTSNAME_DOMAIN_LENGTH; - for (i=0; i<len; i++) - name[i]=u.domainname[i]; - } - return res; -} diff --git a/mdk-stage1/dietlibc/lib/getenv.c b/mdk-stage1/dietlibc/lib/getenv.c deleted file mode 100644 index fc37e9927..000000000 --- a/mdk-stage1/dietlibc/lib/getenv.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <string.h> - -extern char **environ; - -extern char *getenv(const char *s) -{ - int i; - unsigned int len; - - if (!environ || !s) return 0; - len = strlen(s); - for (i = 0;environ[i];++i) - if ((memcmp(environ[i],s,len)==0) && (environ[i][len] == '=')) - return environ[i] + len + 1; - return 0; -} - diff --git a/mdk-stage1/dietlibc/lib/gethostname.c b/mdk-stage1/dietlibc/lib/gethostname.c deleted file mode 100644 index ccc0fbc8e..000000000 --- a/mdk-stage1/dietlibc/lib/gethostname.c +++ /dev/null @@ -1,18 +0,0 @@ -#define _GNU_SOURCE - -#include <sys/types.h> -#include <sys/utsname.h> - -int gethostname(char *name,size_t len) { - struct utsname u; - int res=uname(&u); - if (res==0) { - int i; - if (len>=_UTSNAME_NODENAME_LENGTH) - len=_UTSNAME_NODENAME_LENGTH; - for (i=0; i<len; i++) - name[i]=u.nodename[i]; - } - return res; -} - diff --git a/mdk-stage1/dietlibc/lib/getopt.c b/mdk-stage1/dietlibc/lib/getopt.c deleted file mode 100644 index 93097122f..000000000 --- a/mdk-stage1/dietlibc/lib/getopt.c +++ /dev/null @@ -1,118 +0,0 @@ -#include "getopt.h" -#include <string.h> - -/* - * by Olaf Dreesen - */ - -int opterr; - -int optind=1; -char *optarg; - -static int opt_unknown=1,opt_unknown_len; - -static int getopt_check(int c,char*o,int ol) -{ - int i; - if (c==':') return 2; - for (i=0;i<ol;i++) - { - if (o[i]==c) - { - if (o[i+1]==':') return 1; - return 0; - } - } - return 2; -} - -static void getopt_sort(char*v[],int oi) -{ - int i; - char *tmp, *tmp2=0; - - if (opt_unknown_len) - { - tmp=v[optind-(1+oi)]; - if (oi) tmp2=v[optind-1]; - - for (i=opt_unknown+opt_unknown_len;i>opt_unknown;i--) v[i+oi]=v[i-1]; - - v[opt_unknown++]=tmp; - if (oi) v[opt_unknown++]=tmp2; - } -} - -static char* nextchar; -int getopt(int c,char*v[],char*o) -{ - int ol=strlen(o); - int ret=0; - int oi=0; - - optarg=0; - - while (nextchar || (optind<c)) - { - if (nextchar) - { - if ((ret=(*(++nextchar)))) - { - switch (getopt_check(ret,o,ol)) - { - case 1: - if (*(++nextchar)) - optarg=nextchar; - else - { - if (optind<c) - { - oi=1; - optarg=v[optind++]; - } - else - ret='?'; - } - nextchar=0; - case 0: - if (!nextchar) - getopt_sort(v,oi); - else - if (!(*(nextchar+1))) - getopt_sort(v,oi); - return ret; - break; - default: - return '?'; - break; - } - } - else - nextchar=0; - } - else - { - if ((v[optind][0]=='-')&&((v[optind][1]!=0))) - { - if ((v[optind][1]=='-')&&(v[optind][2]==0)) - { - getopt_sort(v,oi); - optind=opt_unknown; - return -1; - } - else - { - nextchar=v[optind]; - } - } - else - { - ++opt_unknown_len; - } - ++optind; - } - } - optind=opt_unknown; - return -1; -} diff --git a/mdk-stage1/dietlibc/lib/getpeername.c b/mdk-stage1/dietlibc/lib/getpeername.c deleted file mode 100644 index 8adcddf55..000000000 --- a/mdk-stage1/dietlibc/lib/getpeername.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int getpeername(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_GETPEERNAME, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_GETPEERNAME, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/getpgrp.c b/mdk-stage1/dietlibc/lib/getpgrp.c deleted file mode 100644 index ee2ab0257..000000000 --- a/mdk-stage1/dietlibc/lib/getpgrp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <unistd.h> - -int getpgrp() -{ - return getpgid(0); -} diff --git a/mdk-stage1/dietlibc/lib/getservent.c b/mdk-stage1/dietlibc/lib/getservent.c deleted file mode 100644 index bf25d046b..000000000 --- a/mdk-stage1/dietlibc/lib/getservent.c +++ /dev/null @@ -1,137 +0,0 @@ -#include <unistd.h> -#include <fcntl.h> -#include <netdb.h> -#include <sys/mman.h> -#include <errno.h> -#include <netinet/in.h> -#include <string.h> -#include <ctype.h> - -static int servicesfd=-1; -static char* servicesmap; -static unsigned int serviceslen; - -static char* aliases[10]; - -static char *cur; - -/* nameserver 42/tcp name # IEN 116 */ -struct servent *getservent(void) { - static struct servent se; - char *last; - int aliasidx; - if (servicesfd<0) { - servicesfd=open(_PATH_SERVICES,O_RDONLY); - if (servicesfd<0) return 0; - serviceslen=lseek(servicesfd,0,SEEK_END); - servicesmap=mmap(0,serviceslen,PROT_READ|PROT_WRITE,MAP_PRIVATE,servicesfd,0); - if ((long)servicesmap==(-1)) goto error; - cur=servicesmap; - } - last=servicesmap+serviceslen; -again: - se.s_name=0; - se.s_aliases=aliases; aliases[0]=0; - se.s_port=0; - se.s_proto=0; - if (cur>=last) return 0; - if (*cur=='#' || *cur=='\n') goto parseerror; - /* first, the primary name */ - if (!isalpha(*cur)) goto parseerror; - se.s_name=cur; - se.s_aliases=aliases; - while (cur<last && isalnum(*cur)) cur++; - if (cur>=last) return 0; - if (*cur=='\n') goto parseerror; - *cur=0; cur++; - /* second, the port */ - while (cur<last && isblank(*cur)) cur++; - while (cur<last && isdigit(*cur)) { - se.s_port=se.s_port*10+*cur-'0'; - cur++; - } - se.s_port=htons(se.s_port); - if (cur>=last) return 0; - /* third, "/tcp" or "/udp" */ - if (*cur!='/') goto parseerror; - cur++; - se.s_proto=cur; - while (cur<last && isalpha(*cur)) ++cur; - if (cur>=last) return 0; - if (*cur=='\n') { *cur++=0; return &se; } - *cur=0; cur++; - /* now the aliases */ - for (aliasidx=0;aliasidx<10;++aliasidx) { - while (cur<last && isblank(*cur)) ++cur; - aliases[aliasidx]=cur; - while (cur<last && isalpha(*cur)) ++cur; - if (*cur=='\n') { *cur++=0; ++aliasidx; break; } - if (cur>=last || !isblank(*cur)) break; - *cur++=0; - } - aliases[aliasidx]=0; - return &se; -parseerror: - while (cur<last && *cur!='\n') cur++; - cur++; - goto again; -error: - if (servicesmap!=(char*)-1) munmap(servicesmap,serviceslen); - if (servicesfd!=-1) close(servicesfd); - servicesmap=(char*)-1; - servicesfd=-1; - errno=ENOMEM; - return 0; -} - -void setservent(int stayopen) { - cur=servicesmap; -} - -struct servent *getservbyname(const char *name, const char *proto) { - struct servent *s; - setservent(0); - for (s=getservent(); s; s=getservent()) { - char **tmp; -#if 0 - write(1,"found ",6); - write(1,s->s_name,strlen(s->s_name)); - write(1,"/",1); - write(1,s->s_proto,strlen(s->s_proto)); - write(1,"\n",1); - if (!strcmp(name,"auth")) { - tmp=s->s_aliases; - write(1," aka ",5); - while (*tmp) { - write(1,*tmp,strlen(*tmp)); - write(1,", ",2); - ++tmp; - } - write(1,"\n",1); - } -#endif - if (!strcmp(name,s->s_name) && !strcmp(proto,s->s_proto)) - return s; - tmp=s->s_aliases; - while (*tmp) - if (!strcmp(name,*tmp++)) return s; - } - return 0; -} - -struct servent *getservbyport(int port, const char *proto) { - struct servent *s; - for (s=getservent(); s; s=getservent()) { - if (port==s->s_port && !strcmp(proto,s->s_proto)) - return s; - } - return 0; -} - -void endservent(void) { - if (servicesmap!=(char*)-1) munmap(servicesmap,serviceslen); - if (servicesfd!=-1) close(servicesfd); - servicesmap=(char*)-1; - servicesfd=-1; -} - diff --git a/mdk-stage1/dietlibc/lib/getsockname.c b/mdk-stage1/dietlibc/lib/getsockname.c deleted file mode 100644 index 61a3ea24a..000000000 --- a/mdk-stage1/dietlibc/lib/getsockname.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int getsockname(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_GETSOCKNAME, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_GETSOCKNAME, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/getsockopt.c b/mdk-stage1/dietlibc/lib/getsockopt.c deleted file mode 100644 index 8c0a57557..000000000 --- a/mdk-stage1/dietlibc/lib/getsockopt.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int getsockopt(int a, int b, int c, void *d, int e) { -#ifdef __i386__ - return socketcall(SYS_GETSOCKOPT, (long*)&a); -#else - unsigned long args[] = { a, b, c, (long)d, e }; - return socketcall(SYS_GETSOCKOPT, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/htonl.c b/mdk-stage1/dietlibc/lib/htonl.c deleted file mode 100644 index 490de42c4..000000000 --- a/mdk-stage1/dietlibc/lib/htonl.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <endian.h> - -unsigned long int htonl(unsigned long int hostlong) { -#if __BYTE_ORDER==__LITTLE_ENDIAN - return (hostlong>>24) | ((hostlong&0xff0000)>>8) | - ((hostlong&0xff00)<<8) | (hostlong<<24); -#else - return hostlong; -#endif -} - -unsigned long int ntohl(unsigned long int hostlong) __attribute__((weak,alias("htonl"))); diff --git a/mdk-stage1/dietlibc/lib/htons.c b/mdk-stage1/dietlibc/lib/htons.c deleted file mode 100644 index 765d3bbc5..000000000 --- a/mdk-stage1/dietlibc/lib/htons.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <endian.h> - -unsigned short int htons(unsigned short int hostshort) { -#if __BYTE_ORDER==__LITTLE_ENDIAN - return ((hostshort>>8)&0xff) | (hostshort<<8); -#else - return hostshort; -#endif -} - -unsigned short int ntohs(unsigned short int hostshort) __attribute__((weak,alias("htons"))); diff --git a/mdk-stage1/dietlibc/lib/if_indextoname.c b/mdk-stage1/dietlibc/lib/if_indextoname.c deleted file mode 100644 index e683755f6..000000000 --- a/mdk-stage1/dietlibc/lib/if_indextoname.c +++ /dev/null @@ -1,29 +0,0 @@ -#include <linux/if.h> -#include <linux/net.h> -#include <sys/ioctl.h> -#include <unistd.h> -#include <sys/socket.h> - -#ifndef SOCK_DGRAM -#define SOCK_DGRAM 2 -#endif - -char* if_indextoname(unsigned int interface,char* blub) { - struct ifreq ifr; - int fd; - - fd=socket(AF_INET6,SOCK_DGRAM,0); - if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0); - ifr.ifr_ifindex=interface; - if (ioctl(fd,SIOCGIFNAME,&ifr)==0) { - int i; - close(fd); - for (i=0; i<IFNAMSIZ-1; i++) - if (!(blub[i]=ifr.ifr_name[i])) - return blub; - blub[i]=0; - return blub; - } - close(fd); - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/if_nametoindex.c b/mdk-stage1/dietlibc/lib/if_nametoindex.c deleted file mode 100644 index 5923963b1..000000000 --- a/mdk-stage1/dietlibc/lib/if_nametoindex.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <linux/if.h> -#include <linux/net.h> -#include <sys/ioctl.h> -#include <unistd.h> -#include <sys/socket.h> - -#ifndef SOCK_DGRAM -#define SOCK_DGRAM 2 -#endif - -int if_nametoindex(char* blub) { - struct ifreq ifr; - int fd; - char *tmp; - int len=sizeof(ifr.ifr_name); - fd=socket(AF_INET6,SOCK_DGRAM,0); - if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0); - for (tmp=ifr.ifr_name; len>0; --len) { - if ((*tmp++=*blub++)==0) break; - } - if (ioctl(fd,SIOCGIFINDEX,&ifr)==0) { - close(fd); - return ifr.ifr_ifindex; - } - close(fd); - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/isalnum.c b/mdk-stage1/dietlibc/lib/isalnum.c deleted file mode 100644 index 4d363fab9..000000000 --- a/mdk-stage1/dietlibc/lib/isalnum.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <ctype.h> - -int __isalnum_ascii(int c) { - return isalpha(c) || isdigit(c); -} - -int isalnum(int c) __attribute__((weak,alias("__isalnum_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isalpha.c b/mdk-stage1/dietlibc/lib/isalpha.c deleted file mode 100644 index 07ea69696..000000000 --- a/mdk-stage1/dietlibc/lib/isalpha.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <ctype.h> - -int __isalpha_ascii(int c) { - return (c>='a' && c<='z') || (c>='A' && c<='Z'); -} - -int isalpha(int c) __attribute__((weak,alias("__isalpha_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isascii.c b/mdk-stage1/dietlibc/lib/isascii.c deleted file mode 100644 index e06994783..000000000 --- a/mdk-stage1/dietlibc/lib/isascii.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <ctype.h> - -int isascii(int c) { - return (c & 0x80) == 0; -} - diff --git a/mdk-stage1/dietlibc/lib/isatty.c b/mdk-stage1/dietlibc/lib/isatty.c deleted file mode 100644 index b31609720..000000000 --- a/mdk-stage1/dietlibc/lib/isatty.c +++ /dev/null @@ -1,20 +0,0 @@ -#define ioctl libc_ioctl -#include <termios.h> -#undef ioctl -#include <sys/ioctl.h> - -extern int errno; - -int isatty(int fd) -{ - int save; - int is_tty; - struct termios term; - - save = errno; - is_tty = ioctl(fd, TCGETS, &term) == 0; - errno = save; - - return is_tty; -} - diff --git a/mdk-stage1/dietlibc/lib/isblank.c b/mdk-stage1/dietlibc/lib/isblank.c deleted file mode 100644 index 034e543b1..000000000 --- a/mdk-stage1/dietlibc/lib/isblank.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <ctype.h> - -int isblank(int ch) -{ - return ((ch==' ')||(ch=='\t')); -} diff --git a/mdk-stage1/dietlibc/lib/iscntrl.c b/mdk-stage1/dietlibc/lib/iscntrl.c deleted file mode 100644 index a183a54f1..000000000 --- a/mdk-stage1/dietlibc/lib/iscntrl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <ctype.h> - -int __iscntrl_ascii(int c) { - return (c<32) || (c==127); -} - -int iscntrl(int c) __attribute__((weak,alias("__iscntrl_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isdigit.c b/mdk-stage1/dietlibc/lib/isdigit.c deleted file mode 100644 index 8a7c3e801..000000000 --- a/mdk-stage1/dietlibc/lib/isdigit.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <ctype.h> - -int __isdigit_ascii(int c) { - return (c>='0' && c<='9'); -} - -int isdigit(int c) __attribute__((weak,alias("__isdigit_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isgraph.c b/mdk-stage1/dietlibc/lib/isgraph.c deleted file mode 100644 index 807f90ff0..000000000 --- a/mdk-stage1/dietlibc/lib/isgraph.c +++ /dev/null @@ -1,5 +0,0 @@ -int __isgraph_ascii(int c) { - return (c>=33 && c<=126); -} - -int isgraph(int c) __attribute__((weak,alias("__isgraph_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/islower.c b/mdk-stage1/dietlibc/lib/islower.c deleted file mode 100644 index 6a9afa519..000000000 --- a/mdk-stage1/dietlibc/lib/islower.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <ctype.h> - -int __islower_ascii(int c) { - return (c>='a' && c<='z'); -} - -int islower(int c) __attribute__((weak,alias("__islower_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isprint.c b/mdk-stage1/dietlibc/lib/isprint.c deleted file mode 100644 index e980658a5..000000000 --- a/mdk-stage1/dietlibc/lib/isprint.c +++ /dev/null @@ -1,6 +0,0 @@ - -int __isprint_ascii(int c) { - return (c>=32 && c<=126); -} - -int isprint(int c) __attribute__((weak,alias("__isprint_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/ispunct.c b/mdk-stage1/dietlibc/lib/ispunct.c deleted file mode 100644 index 2fd1183b1..000000000 --- a/mdk-stage1/dietlibc/lib/ispunct.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <ctype.h> - -int __ispunct_ascii(int c) { - return isprint(c) && !( isalnum(c) || isspace(c) ); -} - -int ispunct(int c) __attribute__((weak,alias("__ispunct_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isspace.c b/mdk-stage1/dietlibc/lib/isspace.c deleted file mode 100644 index 916f784ab..000000000 --- a/mdk-stage1/dietlibc/lib/isspace.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <ctype.h> - -int __isspace_ascii(int ch) -{ - return ((ch==' ')||(ch=='\f')||(ch=='\t')||(ch=='\v')||(ch=='\r')||(ch=='\n')); -} - -int isspace(int c) __attribute__((weak,alias("__isspace_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isupper.c b/mdk-stage1/dietlibc/lib/isupper.c deleted file mode 100644 index 933dfc169..000000000 --- a/mdk-stage1/dietlibc/lib/isupper.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <ctype.h> - -int __isupper_ascii(int c) { - return (c>='A' && c<='Z'); -} - -int isupper(int c) __attribute__((weak,alias("__isupper_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isxdigit.c b/mdk-stage1/dietlibc/lib/isxdigit.c deleted file mode 100644 index 22a711f2d..000000000 --- a/mdk-stage1/dietlibc/lib/isxdigit.c +++ /dev/null @@ -1,5 +0,0 @@ -int __isxdigit_ascii(int c) { - return ((c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f')); -} - -int isxdigit(int c) __attribute__((weak,alias("__isxdigit_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/listen.c b/mdk-stage1/dietlibc/lib/listen.c deleted file mode 100644 index 56a51be06..000000000 --- a/mdk-stage1/dietlibc/lib/listen.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int listen(int a, int b) { -#ifdef __i386__ - return socketcall(SYS_LISTEN, (long*)&a); -#else - unsigned long args[] = { a, b, 0 }; - return socketcall(SYS_LISTEN, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/lockf.c b/mdk-stage1/dietlibc/lib/lockf.c deleted file mode 100644 index 2b1d004ef..000000000 --- a/mdk-stage1/dietlibc/lib/lockf.c +++ /dev/null @@ -1,37 +0,0 @@ -#include <sys/types.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> - -int lockf(int fd, int cmd, off_t len) { - struct flock fl; - fl.l_whence=SEEK_CUR; - fl.l_start=0; - fl.l_len=len; - fl.l_pid=0; - switch (cmd) { - case F_TEST: - if (fcntl(fd,F_GETLK,&fl)<0) - return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) - return 0; - errno=EACCES; - return -1; - case F_ULOCK: - fl.l_type=F_UNLCK; - cmd=F_SETLK; - break; - case F_LOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLKW; - break; - case F_TLOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLK; - break; - default: - errno=EINVAL; - return -1; - } - return fcntl(fd,cmd,&fl); -} diff --git a/mdk-stage1/dietlibc/lib/longjmp.c b/mdk-stage1/dietlibc/lib/longjmp.c deleted file mode 100644 index d0a5719c1..000000000 --- a/mdk-stage1/dietlibc/lib/longjmp.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 1991, 92, 94, 95, 97, 98 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* #include <stddef.h> */ -#include <setjmp.h> -#include <signal.h> - -extern int __sigprocmask(int how,void* set,void* oldset); -extern void __longjmp(void* env, int val); - -/* -extern void _longjmp_unwind (jmp_buf env, int val); -*/ -/* Set the signal mask to the one specified in ENV, and jump - to the position specified in ENV, causing the setjmp - call there to return VAL, or 1 if VAL is 0. */ -void __siglongjmp (sigjmp_buf env, int val) -{ - /* Perform any cleanups needed by the frames being unwound. */ - /* - _longjmp_unwind (env, val); - */ - - if (env[0].__mask_was_saved) - /* Restore the saved signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, - (sigset_t *) NULL); - - /* Call the machine-dependent function to restore machine state. */ - __longjmp (env[0].__jmpbuf, val ?: 1); -} - -void siglongjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); -void longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); -void _longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); -void __libc_longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); diff --git a/mdk-stage1/dietlibc/lib/lseek64.c b/mdk-stage1/dietlibc/lib/lseek64.c deleted file mode 100644 index f39e779f9..000000000 --- a/mdk-stage1/dietlibc/lib/lseek64.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include <sys/stat.h> -#ifndef __NO_STAT64 -#include <errno.h> -#include <unistd.h> - -loff_t lseek64(int fildes, loff_t offset, int whence) { - loff_t tmp; - if (llseek(fildes,offset>>32,offset&0xffffffff,&tmp,whence)) { -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - return (loff_t)lseek(fildes,(off_t)offset,whence); - } - return tmp; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/memccmp.c b/mdk-stage1/dietlibc/lib/memccmp.c deleted file mode 100644 index 3a8c14f60..000000000 --- a/mdk-stage1/dietlibc/lib/memccmp.c +++ /dev/null @@ -1,17 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include <sys/types.h> - -int memccmp(const void *dst, const void *src, int c, size_t count) -{ - register const char *a = dst; - register const char *b = src; - while (count--) - { - register int res=(*a - *b); - if (res) return res; - if (*a==c) return 0; - ++a; ++b; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/memccpy.c b/mdk-stage1/dietlibc/lib/memccpy.c deleted file mode 100644 index 6d6ac98ab..000000000 --- a/mdk-stage1/dietlibc/lib/memccpy.c +++ /dev/null @@ -1,19 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include <sys/types.h> - -void *memccpy(void *dst, const void *src, int c, size_t count) -{ - char *a = dst; - const char *b = src; - while (count--) - { - *a++ = *b; - if (*b==c) - { - return (void *)a; - } - b++; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/memchr.c b/mdk-stage1/dietlibc/lib/memchr.c deleted file mode 100644 index 93d81328a..000000000 --- a/mdk-stage1/dietlibc/lib/memchr.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <sys/types.h> - -char *memchr(const char *s, int c, size_t n) { - int i; - for (i=n; i; --i) - if (*s++==c) - return (char*)s; - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/memcmp.c b/mdk-stage1/dietlibc/lib/memcmp.c deleted file mode 100644 index c05a46863..000000000 --- a/mdk-stage1/dietlibc/lib/memcmp.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <sys/types.h> - -int memcmp(const void *dst, const void *src, size_t count) { - register int r; - register const char *d=dst; - register const char *s=src; - while (count--) { - if ((r=(*d - *s))) - return r; - ++d; - ++s; - } - return 0; -} - -int bcmp(const char *a,const char *b,size_t c) __attribute__((weak,alias("memcmp"))); diff --git a/mdk-stage1/dietlibc/lib/memcpy.c b/mdk-stage1/dietlibc/lib/memcpy.c deleted file mode 100644 index 0c688b509..000000000 --- a/mdk-stage1/dietlibc/lib/memcpy.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <sys/types.h> - -void* memcpy(void* dst, const void* src, size_t count) { - register char *d=dst; - register const char *s=src; - ++count; /* this actually produces better code than using count-- */ - while (--count) { - *d = *s; - ++d; ++s; - } - return dst; -} diff --git a/mdk-stage1/dietlibc/lib/memmove.c b/mdk-stage1/dietlibc/lib/memmove.c deleted file mode 100644 index 7adb2be91..000000000 --- a/mdk-stage1/dietlibc/lib/memmove.c +++ /dev/null @@ -1,23 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include <sys/types.h> - -void *memmove(void *dst, const void *src, size_t count) -{ - char *a = dst; - const char *b = src; - if (src!=dst) - { - if (src>dst) - { - while (count--) *a++ = *b++; - } - else - { - a+=count-1; - b+=count-1; - while (count--) *a-- = *b--; - } - } - return dst; -} diff --git a/mdk-stage1/dietlibc/lib/memset.c b/mdk-stage1/dietlibc/lib/memset.c deleted file mode 100644 index 5f9ae49ee..000000000 --- a/mdk-stage1/dietlibc/lib/memset.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <sys/types.h> - -void * memset(void * dst, int s, size_t count) { - register char * a = dst; - count++; /* this actually creates smaller code than using count-- */ - while (--count) - *a++ = s; - return dst; -} diff --git a/mdk-stage1/dietlibc/lib/mkfifo.c b/mdk-stage1/dietlibc/lib/mkfifo.c deleted file mode 100644 index 596efbe27..000000000 --- a/mdk-stage1/dietlibc/lib/mkfifo.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <linux/stat.h> -#include <unistd.h> - -int mkfifo(const char *fn,mode_t mode) { - return mknod(fn,S_IFIFO|mode,0); -} diff --git a/mdk-stage1/dietlibc/lib/msgctl.c b/mdk-stage1/dietlibc/lib/msgctl.c deleted file mode 100644 index 19ea6d8cf..000000000 --- a/mdk-stage1/dietlibc/lib/msgctl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/msg.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int msgctl(int msqid, int cmd, struct msqid_ds *buf) { - return __ipc(MSGCTL,msqid,cmd,0,buf); -} diff --git a/mdk-stage1/dietlibc/lib/msgget.c b/mdk-stage1/dietlibc/lib/msgget.c deleted file mode 100644 index 9bca09ebe..000000000 --- a/mdk-stage1/dietlibc/lib/msgget.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/msg.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int msgget(key_t key,int flag) { - return __ipc(MSGGET,key,flag,0,0); -} diff --git a/mdk-stage1/dietlibc/lib/msgrcv.c b/mdk-stage1/dietlibc/lib/msgrcv.c deleted file mode 100644 index b4ae9cc6c..000000000 --- a/mdk-stage1/dietlibc/lib/msgrcv.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/msg.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int msgrcv(int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) { - struct ipc_kludge tmp; - tmp.msgp = msgp; - tmp.msgtyp = msgtyp; - return __ipc(MSGRCV,msqid, msgsz, msgflg, &tmp); -} diff --git a/mdk-stage1/dietlibc/lib/msgsnd.c b/mdk-stage1/dietlibc/lib/msgsnd.c deleted file mode 100644 index 6203053f0..000000000 --- a/mdk-stage1/dietlibc/lib/msgsnd.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/msg.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) { - return __ipc(MSGSND,msqid, msgsz, msgflg, msgp); -} diff --git a/mdk-stage1/dietlibc/lib/nop.c b/mdk-stage1/dietlibc/lib/nop.c deleted file mode 100644 index c05bea813..000000000 --- a/mdk-stage1/dietlibc/lib/nop.c +++ /dev/null @@ -1,7 +0,0 @@ - -int __fflush_stdin() __attribute__((weak,alias("__return0"))); -int __fflush_stdout() __attribute__((weak,alias("__return0"))); -int __fflush_stderr() __attribute__((weak,alias("__return0"))); - -/* used for weak aliases */ -int __return0() { return 0; } diff --git a/mdk-stage1/dietlibc/lib/open64.c b/mdk-stage1/dietlibc/lib/open64.c deleted file mode 100644 index f1499d017..000000000 --- a/mdk-stage1/dietlibc/lib/open64.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <linux/types.h> -#include <linux/fcntl.h> - -#ifndef O_LARGEFILE -#define O_LARGEFILE 0 -#endif - -extern int open(const char* file,int oflag,int mode); - -int __libc_open64(const char* file,int oflag,int mode) { - return open(file,oflag|O_LARGEFILE,mode); -} - -int open64(const char* file,int oflag,int mode) __attribute__((weak,alias("__libc_open64"))); diff --git a/mdk-stage1/dietlibc/lib/opendir.c b/mdk-stage1/dietlibc/lib/opendir.c deleted file mode 100644 index 5c0c4a305..000000000 --- a/mdk-stage1/dietlibc/lib/opendir.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "dietdirent.h" -#include <unistd.h> -#include <dirent.h> -#include <stdlib.h> -#include <fcntl.h> - -DIR *opendir (const char *name) { - DIR *t=(DIR*)malloc(sizeof(DIR)); - if (t) { - if ((t->fd=open(name,O_RDONLY|O_DIRECTORY))>=0) { - t->num=t->cur=0; - } else { - free(t); - t=0; - } - } - return t; -} diff --git a/mdk-stage1/dietlibc/lib/perror.c b/mdk-stage1/dietlibc/lib/perror.c deleted file mode 100644 index ecab7250b..000000000 --- a/mdk-stage1/dietlibc/lib/perror.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "dietfeatures.h" -#include <unistd.h> -#include <string.h> -#include <errno.h> - -extern char *sys_errlist[]; -extern int sys_nerr; -extern int errno; - -void perror(const char *s) { - register char *message="[unknown error]"; - write(2,s,strlen(s)); - write(2,": ",2); - if (errno>=0 && errno<sys_nerr) -#ifdef WANT_THREAD_SAFE - message=sys_errlist[*__errno_location()]; -#else - message=sys_errlist[errno]; -#endif - write(2,message,strlen(message)); - write(2,"\n",1); -} diff --git a/mdk-stage1/dietlibc/lib/pread.c b/mdk-stage1/dietlibc/lib/pread.c deleted file mode 100644 index b922aa93e..000000000 --- a/mdk-stage1/dietlibc/lib/pread.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <endian.h> -#include <sys/types.h> - -extern size_t __pread(int fd, void *buf, size_t count, off_t a,off_t b); - -size_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { - return __pread(fd,buf,count,offset,0); -} - -int pread(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pread"))); diff --git a/mdk-stage1/dietlibc/lib/pread64.c b/mdk-stage1/dietlibc/lib/pread64.c deleted file mode 100644 index e6ba4d103..000000000 --- a/mdk-stage1/dietlibc/lib/pread64.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <endian.h> -#include <sys/types.h> -#include <sys/stat.h> - -#ifndef __NO_STAT64 -extern size_t __pread(int fd, void *buf, size_t count, off_t a,off_t b); - -size_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { - return __pread(fd,buf,count,__LONG_LONG_PAIR (offset&0xffffffff,offset>>32)); -} - -int pread64(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pread64"))); -#endif diff --git a/mdk-stage1/dietlibc/lib/putenv.c b/mdk-stage1/dietlibc/lib/putenv.c deleted file mode 100644 index 274b16b0e..000000000 --- a/mdk-stage1/dietlibc/lib/putenv.c +++ /dev/null @@ -1,37 +0,0 @@ -#include <stdlib.h> -#include <string.h> - -int putenv(const char *string) { - int len; - int envc; - char *tmp; - const char **ep; - char **newenv; - static char **origenv=0; - if (!origenv) origenv=environ; - if (!(tmp=strchr(string,'='))) - len=strlen(string); - else - len=tmp-string+1; - for (envc=0, ep=(const char**)environ; *ep; ++ep) { - if (!memcmp(string,*ep,len)) { /* found */ - if (!tmp) { - for (; ep[1]; ++ep) ep[0]=ep[1]; - ep[0]=0; - return 0; - } - *ep=string; - return 0; - } - ++envc; - } - if (tmp) { - newenv=(char**)malloc((envc+2)*sizeof(char*)); - if (!newenv) return -1; - newenv[0]=(char*)string; - memcpy(newenv+1,environ,(envc+1)*sizeof(char*)); - if (environ!=origenv) free(environ); - environ=newenv; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/puts.c b/mdk-stage1/dietlibc/lib/puts.c deleted file mode 100644 index 54415151d..000000000 --- a/mdk-stage1/dietlibc/lib/puts.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <unistd.h> -#include <string.h> -#include "dietstdio.h" -#include "dietfeatures.h" - -int puts(const char *s) { -#ifdef WANT_BUFFERED_STDIO - return fwrite(s,1,strlen(s),stdout) && fputc('\n',stdout); -#else - return write(1,s,strlen(s)) && write(1,"\n",1); -#endif -} diff --git a/mdk-stage1/dietlibc/lib/qsort.c b/mdk-stage1/dietlibc/lib/qsort.c deleted file mode 100644 index 2a8824bf3..000000000 --- a/mdk-stage1/dietlibc/lib/qsort.c +++ /dev/null @@ -1,125 +0,0 @@ -#include <stdlib.h> -#include <assert.h> - -/* comments: - 1. insertion sort sofort, nicht nachträglich - 2. threshold = 16 - */ - -static inline void iswap(void *a,void *b,size_t size) { - register char *x=a; - register char *y=b; - register char *z=x+size; - while (x<z) { - register char tmp=*x; - *x=*y; - *y=tmp; - ++x; ++y; - } -} - -static inline void swap(void *base,size_t size,size_t a,size_t b) { - iswap(base+a*size,base+b*size,size); -} - -#if 0 -extern int array[]; - -void dumparray() { - printf("array now {%d,%d,%d,%d,%d}\n",array[0],array[1],array[2],array[3],array[4]); -} -#endif - -void isort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { - int i; - while (nmemb>1) { - char *min=base; - char *tmp=min+size; - for (i=1; i<nmemb; ++i) { - if (compar(tmp,min)<0) - min=tmp; - tmp+=size; - } - iswap(min,base,size); - base+=size; - nmemb-=1; - } -} - -void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { -#ifdef DEBUG - char *dbase=base; - char *dmax=base+(nmemb-1)*size; - char dmemb=nmemb; -#endif - static int level=0; - char* v; /* pivot */ - char* mid, *max, *min; - int lmemb; - -#if 0 - int left,right; - left=(int*)base-array; - right=left+nmemb-1; - ++level; - { int i; for (i=0; i<level; ++i) printf(" "); } - printf("qsort: level %d; base=%p, %dx%d; array[%d..%d]\n",level,base,nmemb,size,left,right); - assert(left>=0 && right<=1000); -#endif - if (nmemb<=8) { - --level; - return isort(base,nmemb,size,compar); - } - { - mid=base+(nmemb/2)*size; - max=base+(nmemb-1)*size; - - if (compar(base,max)<0) /* a[left] < a[right] */ - if (compar(base,mid)<0) /* a[left] < a[med] */ - if (compar(max,mid)<0) /* a[left] < a[right] < a[med] */ - v=max; - else /* a[left] < a[med] < a[right] */ - v=mid; - else /* a[med] < a[left] < a[right] */ - v=base; - else /* a[right] < a[left] */ - if (compar(base,mid)<0) /* a[right] < a[left] < a[med] */ - v=base; - else /* a[right] < a[left] && a[med] < a[left] */ - if (compar(max,mid)<0) /* a[right] < a[med] < a[left] */ - v=mid; - else - v=max; -// printf("%d %d %d -> median %d\n",*(int*)base,*(int*)mid,*(int*)max,*(int*)v); - } - if (v != max) - iswap(v,max,size); - v=max; - min=base; lmemb=0; - for (;;) { - while (compar(min,v)<0) { min+=size; ++lmemb; } - while (compar(max-=size,v)>0) ; - if (min>=max) break; - iswap(min,max,size); - } - iswap(min,v,size); -#ifdef DEBUG -// { int i; for (i=0; i<level; ++i) printf(" "); } -// printf("-=< base=%p, min=%p, nmemb=%d, lmemb=%d (%d)\n",base,min,nmemb,lmemb,(min-(char*)base)/size); - assert(lmemb==((min-(char*)base)/size)); -#endif - if (min>(char*)base+size) { -#ifdef DEBUG - assert(base==dbase); -#endif -// { int i; for (i=0; i<level; ++i) printf(" "); } -// printf("+-left %d [%d..%d] of [%d..%d]\n",level+1,left,left+lmemb,left,right); - qsort(base,lmemb,size,compar); - } - if (nmemb>lmemb+1) { -// { int i; for (i=0; i<level; ++i) printf(" "); } -// printf("+-right %d [%d..%d] of [%d..%d]\n",level+1,left+lmemb,right,left,right); - qsort(min+size,nmemb-lmemb-1,size,compar); - } - --level; -} diff --git a/mdk-stage1/dietlibc/lib/raise.c b/mdk-stage1/dietlibc/lib/raise.c deleted file mode 100644 index 606546034..000000000 --- a/mdk-stage1/dietlibc/lib/raise.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <linux/types.h> -#include <unistd.h> -#include <signal.h> -#include "syscalls.h" - -int raise(int sig) { - return kill(getpid(),sig); -} diff --git a/mdk-stage1/dietlibc/lib/rand.c b/mdk-stage1/dietlibc/lib/rand.c deleted file mode 100644 index 10bfaf94d..000000000 --- a/mdk-stage1/dietlibc/lib/rand.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdlib.h> - -static unsigned int seed=1; - -int rand() { - return ((seed = seed * 1103515245 + 12345) % ((unsigned int)RAND_MAX + 1)); -} - -void srand(unsigned int i) { seed=i; } diff --git a/mdk-stage1/dietlibc/lib/random.c b/mdk-stage1/dietlibc/lib/random.c deleted file mode 100644 index e7785c455..000000000 --- a/mdk-stage1/dietlibc/lib/random.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdlib.h> - -static unsigned int seed=1; - -long int random() { - return ((seed = seed * 1103515245 + 12345) % ((unsigned int)RAND_MAX + 1)); -} - -void srandom(unsigned int i) { seed=i; } diff --git a/mdk-stage1/dietlibc/lib/readdir.c b/mdk-stage1/dietlibc/lib/readdir.c deleted file mode 100644 index 689f5d08b..000000000 --- a/mdk-stage1/dietlibc/lib/readdir.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "dietdirent.h" -#include <unistd.h> -#include <dirent.h> -#include <stdlib.h> - -struct dirent* readdir(DIR *d) { - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { - int res=getdents(d->fd,(struct dirent*)d->buf,1023); - if (res<=0) return 0; - d->num=res; d->cur=0; - } - return (struct dirent*)(d->buf+d->cur); -} diff --git a/mdk-stage1/dietlibc/lib/reboot.c b/mdk-stage1/dietlibc/lib/reboot.c deleted file mode 100644 index 7f47a95dd..000000000 --- a/mdk-stage1/dietlibc/lib/reboot.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <sys/reboot.h> - -int __reboot(int magic1, int magic2, int cmd, void * arg); - -int reboot(int cmd, void *arg) -{ - return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, arg); -} diff --git a/mdk-stage1/dietlibc/lib/recv.c b/mdk-stage1/dietlibc/lib/recv.c deleted file mode 100644 index bc6b1e5d7..000000000 --- a/mdk-stage1/dietlibc/lib/recv.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_recv(int a, const void * b, size_t c, int flags) { -#ifdef __i386__ - return socketcall(SYS_RECV,(long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags }; - return socketcall(SYS_RECV, args); -#endif -} - -int recv(int a, const void * b, size_t c, int flags) - __attribute__ ((weak, alias("__libc_recv"))); diff --git a/mdk-stage1/dietlibc/lib/recvfrom.c b/mdk-stage1/dietlibc/lib/recvfrom.c deleted file mode 100644 index 802ad665f..000000000 --- a/mdk-stage1/dietlibc/lib/recvfrom.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) { -#ifdef __i386__ - return socketcall(SYS_RECVFROM, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags, (long) to, (long) tolen }; - return socketcall(SYS_RECVFROM, args); -#endif -} - -int recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) - __attribute__ ((weak,alias("__libc_recvfrom"))) ; diff --git a/mdk-stage1/dietlibc/lib/recvmsg.c b/mdk-stage1/dietlibc/lib/recvmsg.c deleted file mode 100644 index c14c58c78..000000000 --- a/mdk-stage1/dietlibc/lib/recvmsg.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_recvmsg(int a, struct msghdr* msg, int flags) { -#ifdef __i386__ - return socketcall(SYS_RECVMSG, (long*)&a); -#else - unsigned long args[] = { a, (long) msg, flags }; - return socketcall(SYS_RECVMSG, args); -#endif -} - -int recvmsg(int a, struct msghdr *msg, int flags) - __attribute__ ((weak,alias("__libc_recvmsg"))) ; diff --git a/mdk-stage1/dietlibc/lib/remove.c b/mdk-stage1/dietlibc/lib/remove.c deleted file mode 100644 index d5125bfed..000000000 --- a/mdk-stage1/dietlibc/lib/remove.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -int remove(const char* filename) { - if (unlink(filename)) { - if (errno==EISDIR) - return rmdir(filename); - return -1; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/rewind.c b/mdk-stage1/dietlibc/lib/rewind.c deleted file mode 100644 index 48434a316..000000000 --- a/mdk-stage1/dietlibc/lib/rewind.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <dietstdio.h> -#include <unistd.h> - -void rewind( FILE *stream) { - fseek(stream, 0L, SEEK_SET); -} diff --git a/mdk-stage1/dietlibc/lib/rewinddir.c b/mdk-stage1/dietlibc/lib/rewinddir.c deleted file mode 100644 index addc7bde9..000000000 --- a/mdk-stage1/dietlibc/lib/rewinddir.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "dietdirent.h" -#include <unistd.h> -#include <dirent.h> - -void rewinddir(DIR *d) { - if (lseek(d->fd,0,SEEK_SET) != (off_t)-1) - d->num=d->cur=0; -} diff --git a/mdk-stage1/dietlibc/lib/sbrk.c b/mdk-stage1/dietlibc/lib/sbrk.c deleted file mode 100644 index 945ad5a16..000000000 --- a/mdk-stage1/dietlibc/lib/sbrk.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <unistd.h> - -extern int __brk(void *end_data_segment); - -extern void* __curbrk; - -void* __sbrk(ptrdiff_t increment) { - void* oldbrk; - if (__curbrk==0) - if (__brk(0) < 0) - return (void*)-1; - if (increment==0) - return __curbrk; - oldbrk=__curbrk; - if (__brk(oldbrk+increment)<0) - return (void*)-1; - return oldbrk; -} - -void* sbrk (ptrdiff_t increment) __attribute__((weak,alias("__sbrk"))); diff --git a/mdk-stage1/dietlibc/lib/seekdir.c b/mdk-stage1/dietlibc/lib/seekdir.c deleted file mode 100644 index cf111fbc8..000000000 --- a/mdk-stage1/dietlibc/lib/seekdir.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "dietdirent.h" -#include <unistd.h> -#include <dirent.h> - -void seekdir(DIR *d,off_t offset) { - if (lseek(d->fd,offset,SEEK_SET) != (off_t)-1) - d->num=d->cur=0; -} diff --git a/mdk-stage1/dietlibc/lib/semctl.c b/mdk-stage1/dietlibc/lib/semctl.c deleted file mode 100644 index ddc0aae95..000000000 --- a/mdk-stage1/dietlibc/lib/semctl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int semctl(int semid, int semnum, int cmd, union semun arg) { - return __ipc(SEMCTL,semid,semnum,cmd,&arg); -} diff --git a/mdk-stage1/dietlibc/lib/semget.c b/mdk-stage1/dietlibc/lib/semget.c deleted file mode 100644 index 056aeae04..000000000 --- a/mdk-stage1/dietlibc/lib/semget.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int semget(key_t key, int nsems, int semflg) { - return __ipc(SEMGET,key,nsems,semflg,0); -} diff --git a/mdk-stage1/dietlibc/lib/semop.c b/mdk-stage1/dietlibc/lib/semop.c deleted file mode 100644 index abfde73a7..000000000 --- a/mdk-stage1/dietlibc/lib/semop.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int semop(int semid,struct sembuf *sops,unsigned nsops) { - return __ipc(SEMOP,semid,nsops,0,sops); -} diff --git a/mdk-stage1/dietlibc/lib/send.c b/mdk-stage1/dietlibc/lib/send.c deleted file mode 100644 index c1adf1b5d..000000000 --- a/mdk-stage1/dietlibc/lib/send.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_send(int a, const void * b, size_t c, int flags) { -#ifdef __i386__ - return socketcall(SYS_SEND, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags }; - return socketcall(SYS_SEND, args); -#endif -} - -int send(int a, const void * b, size_t c, int flags) - __attribute__ ((weak, alias("__libc_send"))); diff --git a/mdk-stage1/dietlibc/lib/sendmsg.c b/mdk-stage1/dietlibc/lib/sendmsg.c deleted file mode 100644 index 277265985..000000000 --- a/mdk-stage1/dietlibc/lib/sendmsg.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_sendmsg(int a, const struct msghdr* msg, int flags) { -#ifdef __i386__ - return socketcall(SYS_SENDMSG, (long*)&a); -#else - unsigned long args[] = { a, (long) msg, flags }; - return socketcall(SYS_SENDMSG, args); -#endif -} - -int sendmsg(int a, const struct msghdr *msg, int flags) - __attribute__ ((weak,alias("__libc_sendmsg"))) ; diff --git a/mdk-stage1/dietlibc/lib/sendto.c b/mdk-stage1/dietlibc/lib/sendto.c deleted file mode 100644 index 078c010ea..000000000 --- a/mdk-stage1/dietlibc/lib/sendto.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_sendto(int a, const void * b, size_t c, int flags, void *to, int tolen) { -#ifdef __i386__ - return socketcall(SYS_SENDTO, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags, (long) to, tolen }; - return socketcall(SYS_SENDTO, args); -#endif -} - -int sendto(int a, const void * b, size_t c, int flags, void *to, int tolen) - __attribute__ ((weak, alias("__libc_sendto"))); diff --git a/mdk-stage1/dietlibc/lib/set_errno.c b/mdk-stage1/dietlibc/lib/set_errno.c deleted file mode 100644 index 6553bc496..000000000 --- a/mdk-stage1/dietlibc/lib/set_errno.c +++ /dev/null @@ -1,9 +0,0 @@ -extern int errno; - -void __set_errno(int error) __attribute__ ((weak)); - -void __set_errno(int error) -{ - errno=error; -} - diff --git a/mdk-stage1/dietlibc/lib/setpgrp.c b/mdk-stage1/dietlibc/lib/setpgrp.c deleted file mode 100644 index 825ca3725..000000000 --- a/mdk-stage1/dietlibc/lib/setpgrp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <unistd.h> - -int setpgrp() -{ - return setpgid(0,0); -} diff --git a/mdk-stage1/dietlibc/lib/setsockopt.c b/mdk-stage1/dietlibc/lib/setsockopt.c deleted file mode 100644 index 781e9c31c..000000000 --- a/mdk-stage1/dietlibc/lib/setsockopt.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int setsockopt(int a, int b, int c, void *d, void *e) { -#ifdef __i386__ - return socketcall(SYS_SETSOCKOPT, (long*)&a); -#else - unsigned long args[] = { a, b, c, (long)d, (long) e }; - return socketcall(SYS_SETSOCKOPT, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/shmat.c b/mdk-stage1/dietlibc/lib/shmat.c deleted file mode 100644 index 63284b1ea..000000000 --- a/mdk-stage1/dietlibc/lib/shmat.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <asm/ipc.h> - -extern void* __ipc(); - -void* shmat(int shmid,const void* shmaddr,int shmflg) { - void* raddr; - register void* result; - result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); - if ((unsigned long)result <= -(unsigned long)SHMLBA) - result=raddr; - return result; -} diff --git a/mdk-stage1/dietlibc/lib/shmctl.c b/mdk-stage1/dietlibc/lib/shmctl.c deleted file mode 100644 index 8f942f2a4..000000000 --- a/mdk-stage1/dietlibc/lib/shmctl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int shmctl(int shmid, int cmd, struct shmid_ds *buf) { - return __ipc(SHMCTL,shmid,cmd,0,buf); -} diff --git a/mdk-stage1/dietlibc/lib/shmdt.c b/mdk-stage1/dietlibc/lib/shmdt.c deleted file mode 100644 index 36db10f08..000000000 --- a/mdk-stage1/dietlibc/lib/shmdt.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int shmdt(const void* shmaddr) { - return __ipc(SHMDT,0,0,0,shmaddr); -} diff --git a/mdk-stage1/dietlibc/lib/shmget.c b/mdk-stage1/dietlibc/lib/shmget.c deleted file mode 100644 index 9b03f5deb..000000000 --- a/mdk-stage1/dietlibc/lib/shmget.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <asm/ipc.h> - -extern int __ipc(); - -int shmget(key_t key, int size, int shmflg) { - return __ipc(SHMGET,key,size,shmflg,0); -} diff --git a/mdk-stage1/dietlibc/lib/shutdown.c b/mdk-stage1/dietlibc/lib/shutdown.c deleted file mode 100644 index 0a6be6c37..000000000 --- a/mdk-stage1/dietlibc/lib/shutdown.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int __libc_shutdown(int s, int how) { -#ifdef __i386__ - return socketcall(SYS_SHUTDOWN, (long*)&s); -#else - unsigned long args[] = { s, (long) how, 0 }; - return socketcall(SYS_SHUTDOWN, args); -#endif -} - -int shutdown(int s, int how) __attribute__((weak,alias("__libc_shutdown"))); diff --git a/mdk-stage1/dietlibc/lib/sigaddset.c b/mdk-stage1/dietlibc/lib/sigaddset.c deleted file mode 100644 index 8ce69ea77..000000000 --- a/mdk-stage1/dietlibc/lib/sigaddset.c +++ /dev/null @@ -1,15 +0,0 @@ -#define __KERNEL__ -#define sigaddset foobar -#include <asm/signal.h> -#undef sigaddset - -int __sigaddset(sigset_t *set, int signo) { - unsigned long sig = signo - 1; - if (_NSIG_WORDS == 1) - set->sig[0] |= 1UL << sig; - else - set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW); - return 0; -} - -int sigaddset (sigset_t *env, int signo) __attribute__((weak,alias("__sigaddset"))); diff --git a/mdk-stage1/dietlibc/lib/sigdelset.c b/mdk-stage1/dietlibc/lib/sigdelset.c deleted file mode 100644 index 2c3385ea8..000000000 --- a/mdk-stage1/dietlibc/lib/sigdelset.c +++ /dev/null @@ -1,15 +0,0 @@ -#define __KERNEL__ -#define sigdelset foobar -#include <asm/signal.h> -#undef sigdelset - -int __sigdelset(sigset_t *set, int signo) { - unsigned long sig = signo - 1; - if (_NSIG_WORDS == 1) - set->sig[0] &= ~(1UL << sig); - else - set->sig[sig / _NSIG_BPW] &= ~(1UL << (sig % _NSIG_BPW)); - return 0; -} - -int sigdelset (sigset_t *env, int signo) __attribute__((weak,alias("__sigdelset"))); diff --git a/mdk-stage1/dietlibc/lib/sigemptyset.c b/mdk-stage1/dietlibc/lib/sigemptyset.c deleted file mode 100644 index f4532f96e..000000000 --- a/mdk-stage1/dietlibc/lib/sigemptyset.c +++ /dev/null @@ -1,14 +0,0 @@ -#define __USE_EXTERN_INLINES 1 -#include <signal.h> -#include <errno.h> -#include <string.h> - -int sigemptyset(sigset_t *set) { - if (set==NULL) { - __set_errno(EINVAL); - return -1; - } - memset(set,0,sizeof(*set)); - return 0; -} - diff --git a/mdk-stage1/dietlibc/lib/sigfillset.c b/mdk-stage1/dietlibc/lib/sigfillset.c deleted file mode 100644 index ddac6e391..000000000 --- a/mdk-stage1/dietlibc/lib/sigfillset.c +++ /dev/null @@ -1,11 +0,0 @@ -#define __KERNEL__ -#include <asm/signal.h> - -int __sigfillset (sigset_t *set) { - int i; - for (i=0; i<_NSIG_WORDS; i++) - set->sig[i]=~0; - return 0; -} - -int sigfillset(sigset_t *env) __attribute__((weak,alias("__sigfillset"))); diff --git a/mdk-stage1/dietlibc/lib/sigismember.c b/mdk-stage1/dietlibc/lib/sigismember.c deleted file mode 100644 index 67a258884..000000000 --- a/mdk-stage1/dietlibc/lib/sigismember.c +++ /dev/null @@ -1,21 +0,0 @@ -#define __USE_EXTERN_INLINES 1 -#include <signal.h> - -# define __sigmask(sig) \ - (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) - -# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) - -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; - -int __sigismember(const __sigset_t *set, int signo) { - unsigned long int __mask = __sigmask (signo); - unsigned long int __word = __sigword (signo); - return (set->__val[__word] & __mask); -} - -int sigismember(const sigset_t *env, int signo) __attribute__((weak,alias("__sigismember"))); diff --git a/mdk-stage1/dietlibc/lib/sigjmp.c b/mdk-stage1/dietlibc/lib/sigjmp.c deleted file mode 100644 index be97c62cc..000000000 --- a/mdk-stage1/dietlibc/lib/sigjmp.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include <setjmp.h> -#include <signal.h> -#include <string.h> - -/* This function is called by the `sigsetjmp' macro - before doing a `__setjmp' on ENV[0].__jmpbuf. - Always return zero. */ - -int -__sigjmp_save (sigjmp_buf env, int savemask) -{ - env[0].__mask_was_saved = (savemask && - sigprocmask (SIG_BLOCK, (sigset_t *) NULL, - (sigset_t*)&env[0].__saved_mask) == 0); - - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/sleep.c b/mdk-stage1/dietlibc/lib/sleep.c deleted file mode 100644 index ec5b99533..000000000 --- a/mdk-stage1/dietlibc/lib/sleep.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <linux/time.h> -#include <time.h> - -unsigned int sleep(unsigned int secs) { - struct timespec t; - t.tv_sec=secs; - t.tv_nsec=0; - nanosleep(&t,&t); - return secs-t.tv_sec; -} - diff --git a/mdk-stage1/dietlibc/lib/snprintf.c b/mdk-stage1/dietlibc/lib/snprintf.c deleted file mode 100644 index 096c06115..000000000 --- a/mdk-stage1/dietlibc/lib/snprintf.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <stdarg.h> -#include <sys/types.h> - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int snprintf(char *str,size_t size,const char *format,...) -{ - int n; - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsnprintf(str,size,format,arg_ptr); - va_end (arg_ptr); - return n; -} diff --git a/mdk-stage1/dietlibc/lib/socket.c b/mdk-stage1/dietlibc/lib/socket.c deleted file mode 100644 index 1684a6a2b..000000000 --- a/mdk-stage1/dietlibc/lib/socket.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <linux/net.h> - -extern int socketcall(int callno,long* args); - -int socket(int a, int b, int c) { -#ifdef __i386__ - return socketcall(SYS_SOCKET, (long*)&a); -#else - unsigned long args[] = { a, b, c }; - return socketcall(SYS_SOCKET, args); -#endif -} diff --git a/mdk-stage1/dietlibc/lib/speed.c b/mdk-stage1/dietlibc/lib/speed.c deleted file mode 100644 index a7fcca7c9..000000000 --- a/mdk-stage1/dietlibc/lib/speed.c +++ /dev/null @@ -1,67 +0,0 @@ -#include <unistd.h> -#include <termios.h> -#include <sys/types.h> - -#include <asm/errno.h> - -extern int errno; - -/* Hack around a kernel bug; value must correspond to the one used in tcsetattr.c */ -#define IBAUD0 020000000000 - - -/* Return the output baud rate stored in *TERMIOS_P. */ -speed_t cfgetospeed (struct termios *termios_p) -{ - return termios_p->c_cflag & (CBAUD | CBAUDEX); -} - - -/* Return the input baud rate stored in *TERMIOS_P. - Although for Linux there is no difference between input and output - speed, the numerical 0 is a special case for the input baud rate. It - should set the input baud rate to the output baud rate. */ -speed_t cfgetispeed (struct termios *termios_p) -{ - return ((termios_p->c_iflag & IBAUD0) - ? 0 : termios_p->c_cflag & (CBAUD | CBAUDEX)); -} - - -/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -int cfsetospeed (struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) { - errno = EINVAL; - return -1; - } - - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - - return 0; -} - - -/* Set the input baud rate stored in *TERMIOS_P to SPEED. - Although for Linux there is no difference between input and output - speed, the numerical 0 is a special case for the input baud rate. It - should set the input baud rate to the output baud rate. */ -int cfsetispeed (struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) { - errno = EINVAL; - return -1; - } - - if (speed == 0) - termios_p->c_iflag |= IBAUD0; - else - { - termios_p->c_iflag &= ~IBAUD0; - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - } - - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/sprintf.c b/mdk-stage1/dietlibc/lib/sprintf.c deleted file mode 100644 index b355d01f9..000000000 --- a/mdk-stage1/dietlibc/lib/sprintf.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <stdarg.h> -#include <linux/types.h> -#include <stdlib.h> -#include "dietwarning.h" - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int sprintf(char *dest,const char *format,...) -{ - int n; - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsnprintf(dest,1000000,format,arg_ptr); - va_end (arg_ptr); - return n; -} - -link_warning("sprintf","warning: Avoid sprintf; use snprintf. It is more secure and faster.") diff --git a/mdk-stage1/dietlibc/lib/sscanf.c b/mdk-stage1/dietlibc/lib/sscanf.c deleted file mode 100644 index 341e74bba..000000000 --- a/mdk-stage1/dietlibc/lib/sscanf.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <stdarg.h> - -int vsscanf(const char *str, const char *format, va_list arg_ptr); - -int sscanf(const char *str, const char *format, ...) -{ - int n; - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsscanf(str,format,arg_ptr); - va_end (arg_ptr); - return n; -} diff --git a/mdk-stage1/dietlibc/lib/strcasecmp.c b/mdk-stage1/dietlibc/lib/strcasecmp.c deleted file mode 100644 index d978488a4..000000000 --- a/mdk-stage1/dietlibc/lib/strcasecmp.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <ctype.h> -#include "dietfeatures.h" - -int strcasecmp(register const char *s,register const char *t) { - register char x; - - for (;;) { - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; -#endif - } - return ((int)(unsigned int)(unsigned char) x) - - ((int)(unsigned int)(unsigned char) *t); -} diff --git a/mdk-stage1/dietlibc/lib/strcat.c b/mdk-stage1/dietlibc/lib/strcat.c deleted file mode 100644 index 8a755afea..000000000 --- a/mdk-stage1/dietlibc/lib/strcat.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "dietfeatures.h" -#include <string.h> - -char* strcat(register char* s,register const char* t) -{ - char *dest=s; - s+=strlen(s); - for (;;) { - if (!(*s = *t)) break; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (!(*s = *t)) break; ++s; ++t; - if (!(*s = *t)) break; ++s; ++t; - if (!(*s = *t)) break; ++s; ++t; -#endif - } - return dest; -} - diff --git a/mdk-stage1/dietlibc/lib/strchr.c b/mdk-stage1/dietlibc/lib/strchr.c deleted file mode 100644 index 0c2050da6..000000000 --- a/mdk-stage1/dietlibc/lib/strchr.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "dietfeatures.h" - -char *strchr(register const char *t, int c) { - register char ch; - - ch = c; - for (;;) { - if (*t == ch) break; if (!*t) return 0; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (*t == ch) break; if (!*t) return 0; ++t; - if (*t == ch) break; if (!*t) return 0; ++t; - if (*t == ch) break; if (!*t) return 0; ++t; -#endif - } - return (char*)t; -} - -char *index(char *t,int c) __attribute__((weak,alias("strchr"))); diff --git a/mdk-stage1/dietlibc/lib/strcmp.c b/mdk-stage1/dietlibc/lib/strcmp.c deleted file mode 100644 index 0db324e66..000000000 --- a/mdk-stage1/dietlibc/lib/strcmp.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "dietfeatures.h" - -int strcmp(register const char *s,register const char *t) { - register char x; - - for (;;) { - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; -#endif - } - return ((int)(unsigned int)(unsigned char) x) - - ((int)(unsigned int)(unsigned char) *t); -} diff --git a/mdk-stage1/dietlibc/lib/strcpy.c b/mdk-stage1/dietlibc/lib/strcpy.c deleted file mode 100644 index 49693c30d..000000000 --- a/mdk-stage1/dietlibc/lib/strcpy.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "dietfeatures.h" - -char* strcpy(register char* s,register const char* t) -{ - char *dest=s; - for (;;) { - if (!(*s = *t)) return dest; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (!(*s = *t)) return dest; ++s; ++t; - if (!(*s = *t)) return dest; ++s; ++t; - if (!(*s = *t)) return dest; ++s; ++t; -#endif - } -} - diff --git a/mdk-stage1/dietlibc/lib/strcspn.c b/mdk-stage1/dietlibc/lib/strcspn.c deleted file mode 100644 index 37053c72c..000000000 --- a/mdk-stage1/dietlibc/lib/strcspn.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <sys/types.h> -#include <string.h> - -size_t strcspn(const char *s, const char *reject) -{ - size_t l=0; - int a=1,i,al=strlen(reject); - - while((a)&&(*s)) - { - for(i=0;(a)&&(i<al);i++) - if (*s==reject[i]) a=0; - if (a) l++; - s++; - } - return l; -} diff --git a/mdk-stage1/dietlibc/lib/strdup.c b/mdk-stage1/dietlibc/lib/strdup.c deleted file mode 100644 index 6a2ea5f95..000000000 --- a/mdk-stage1/dietlibc/lib/strdup.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <string.h> -#include <stdlib.h> - -char *strdup(const char *s) { - char *tmp=(char *)malloc(strlen(s)+1); - if (!tmp) return 0; - strcpy(tmp,s); - return tmp; -} diff --git a/mdk-stage1/dietlibc/lib/strerror.c b/mdk-stage1/dietlibc/lib/strerror.c deleted file mode 100644 index f15b86aae..000000000 --- a/mdk-stage1/dietlibc/lib/strerror.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <string.h> - -extern char *sys_errlist[]; -extern int sys_nerr; - -char *strerror(int errnum) { - if (errnum>=0 && errnum<sys_nerr) - return sys_errlist[errnum]; - return "[unknown error]"; -} diff --git a/mdk-stage1/dietlibc/lib/strlcat.c b/mdk-stage1/dietlibc/lib/strlcat.c deleted file mode 100644 index fd35ec8af..000000000 --- a/mdk-stage1/dietlibc/lib/strlcat.c +++ /dev/null @@ -1,72 +0,0 @@ -/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(initial dst) + strlen(src); if retval >= siz, - * truncation occurred. - */ -size_t strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (*d != '\0' && n-- != 0) - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen + (s - src)); /* count does not include NUL */ -} diff --git a/mdk-stage1/dietlibc/lib/strlcpy.3 b/mdk-stage1/dietlibc/lib/strlcpy.3 deleted file mode 100644 index e00af8d6b..000000000 --- a/mdk-stage1/dietlibc/lib/strlcpy.3 +++ /dev/null @@ -1,169 +0,0 @@ -.\" $OpenBSD: strlcpy.3,v 1.10 2000/11/06 01:03:25 aaron Exp $ -.\" -.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd June 22, 1998 -.Dt STRLCPY 3 -.Os -.Sh NAME -.Nm strlcpy , -.Nm strlcat -.Nd size-bounded string copying and concatenation -.Sh SYNOPSIS -.Fd #include <string.h> -.Ft size_t -.Fn strlcpy "char *dst" "const char *src" "size_t size" -.Ft size_t -.Fn strlcat "char *dst" "const char *src" "size_t size" -.Sh DESCRIPTION -The -.Fn strlcpy -and -.Fn strlcat -functions copy and concatenate strings respectively. -They are designed -to be safer, more consistent, and less error prone replacements for -.Xr strncpy 3 -and -.Xr strncat 3 . -Unlike those functions, -.Fn strlcpy -and -.Fn strlcat -take the full size of the buffer (not just the length) and guarantee to -NUL-terminate the result (as long as -.Fa size -is larger than 0 or, in the case of -.Fn strlcat , -as long as there is at least one byte free in -.Fa dst ) . -Note that you should include a byte for the NUL in -.Fa size . -Also note that -.Fn strlcpy -and -.Fn strlcat -only operate on true -.Dq C -strings. -This means that for -.Fn strlcpy -.Fa src -must be NUL-terminated and for -.Fn strlcat -both -.Fa src -and -.Fa dst -must be NUL-terminated. -.Pp -The -.Fn strlcpy -function copies up to -.Fa size -- 1 characters from the NUL-terminated string -.Fa src -to -.Fa dst , -NUL-terminating the result. -.Pp -The -.Fn strlcat -function appends the NUL-terminated string -.Fa src -to the end of -.Fa dst . -It will append at most -.Fa size -- strlen(dst) - 1 bytes, NUL-terminating the result. -.Sh RETURN VALUES -The -.Fn strlcpy -and -.Fn strlcat -functions return the total length of the string they tried to create. -For -.Fn strlcpy -that means the length of -.Fa src . -For -.Fn strlcat -that means the initial length of -.Fa dst -plus -the length of -.Fa src . -While this may seem somewhat confusing it was done to make -truncation detection simple. -.Sh EXAMPLES -The following code fragment illustrates the simple case: -.Bd -literal -offset indent -char *s, *p, buf[BUFSIZ]; - -\&... - -(void)strlcpy(buf, s, sizeof(buf)); -(void)strlcat(buf, p, sizeof(buf)); -.Ed -.Pp -To detect truncation, perhaps while building a pathname, something -like the following might be used: -.Bd -literal -offset indent -char *dir, *file, pname[MAXPATHLEN]; - -\&... - -if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname)) - goto toolong; -if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname)) - goto toolong; -.Ed -.Pp -Since we know how many characters we copied the first time, we can -speed things up a bit by using a copy instead of an append: -.Bd -literal -offset indent -char *dir, *file, pname[MAXPATHLEN]; -size_t n; - -\&... - -n = strlcpy(pname, dir, sizeof(pname)); -if (n >= sizeof(pname)) - goto toolong; -if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n) - goto toolong; -.Ed -.Pp -However, one may question the validity of such optimizations, as they -defeat the whole purpose of -.Fn strlcpy -and -.Fn strlcat . -As a matter of fact, the first version of this manual page got it wrong. -.Sh SEE ALSO -.Xr snprintf 3 , -.Xr strncat 3 , -.Xr strncpy 3 diff --git a/mdk-stage1/dietlibc/lib/strlcpy.c b/mdk-stage1/dietlibc/lib/strlcpy.c deleted file mode 100644 index b935b9527..000000000 --- a/mdk-stage1/dietlibc/lib/strlcpy.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: strlcpy.c,v 1.3 1999/04/24 01:17:37 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcpy.c,v 1.3 1999/04/24 01:17:37 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include <sys/types.h> -#include <string.h> - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t strlcpy(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} diff --git a/mdk-stage1/dietlibc/lib/strlen.c b/mdk-stage1/dietlibc/lib/strlen.c deleted file mode 100644 index 56c085dac..000000000 --- a/mdk-stage1/dietlibc/lib/strlen.c +++ /dev/null @@ -1,47 +0,0 @@ -#include <endian.h> -#include "dietfeatures.h" -#include <string.h> - -#ifdef WANT_SMALL_STRING_ROUTINES -size_t strlen(const char *s) { - register int i; - if (!s) return 0; - for (i=0; *s; ++s) ++i; - return i; -} -#else -static const unsigned long magic = 0x01010101; - -size_t strlen(const char *s) -{ - const char *t = s; - unsigned long word; - - if (!s) return 0; - - /* Byte compare up until word boundary */ - for (; ((unsigned long) t & 3); t++) - if (!*t) return t - s; - - /* Word compare */ - do { - word = *((unsigned long *) t); t += 4; - word = (word - magic) &~ word; - word &= (magic << 7); - } while (word == 0); - -#if BYTE_ORDER == LITTLE_ENDIAN - /* word & 0x80808080 == word */ - word = (word - 1) & (magic << 10); - word += (word << 8) + (word << 16); - t += word >> 26; -#else - if ((word & 0x80800000) == 0) { - word <<= 16; - t += 2; - } - if ((word & 0x80000000) == 0) t += 1; -#endif - return ((const char *) t) - 4 - s; -} -#endif diff --git a/mdk-stage1/dietlibc/lib/strncasecmp.c b/mdk-stage1/dietlibc/lib/strncasecmp.c deleted file mode 100644 index 8a5445e53..000000000 --- a/mdk-stage1/dietlibc/lib/strncasecmp.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <ctype.h> -#include <sys/types.h> -#include <string.h> - -int strncasecmp(const char *s, const char *t, size_t n) { - register char x; - register const char* u=s+n; - for (;;) { - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; -#endif - } - return ((int)(unsigned int)(unsigned char) x) - - ((int)(unsigned int)(unsigned char) *t); -} diff --git a/mdk-stage1/dietlibc/lib/strncat.c b/mdk-stage1/dietlibc/lib/strncat.c deleted file mode 100644 index a08e97916..000000000 --- a/mdk-stage1/dietlibc/lib/strncat.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "dietfeatures.h" -#include <string.h> - -#ifdef WANT_NON_COMPLIANT_STRNCAT -/* this implementation is not standards compliant. - * the standard says that strncat(dest,"foobar",3) should write 'f', 'o' - * and 'o'. The programmer is then expected to overwrite the last byte - * with '\0', which is often forgotten. This implementation makes sure - * the last written bytes is always '\0'. */ -#endif - -char *strncat(char *s, const char *t, size_t n) { - char *dest=s; - register char *max; - s+=strlen(s); -#ifdef WANT_NON_COMPLIANT_STRNCAT - max=s+n-1; -#else - max=s+n; -#endif - for (;;) { - if (!(*s = *t)) break; if (++s==max) break; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (!(*s = *t)) break; if (++s==max) break; ++t; - if (!(*s = *t)) break; if (++s==max) break; ++t; - if (!(*s = *t)) break; if (++s==max) break; ++t; -#endif - } - *s=0; - return dest; -} diff --git a/mdk-stage1/dietlibc/lib/strncmp.c b/mdk-stage1/dietlibc/lib/strncmp.c deleted file mode 100644 index 7c08c0fa7..000000000 --- a/mdk-stage1/dietlibc/lib/strncmp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <sys/types.h> -#include <string.h> - -int strncmp(const char *s1, const char *s2, size_t n) { - return memccmp(s1,s2,0,n); -} diff --git a/mdk-stage1/dietlibc/lib/strncpy.c b/mdk-stage1/dietlibc/lib/strncpy.c deleted file mode 100644 index 531387b7f..000000000 --- a/mdk-stage1/dietlibc/lib/strncpy.c +++ /dev/null @@ -1,10 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include <sys/types.h> -#include <string.h> - -char *strncpy(char *dest, const char *src, size_t n) -{ - memccpy(dest,src,0,n); - return dest; -} diff --git a/mdk-stage1/dietlibc/lib/strpbrk.c b/mdk-stage1/dietlibc/lib/strpbrk.c deleted file mode 100644 index e18fd2a2d..000000000 --- a/mdk-stage1/dietlibc/lib/strpbrk.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <sys/types.h> -#include <string.h> - -char *strpbrk(const char *s, const char *accept) { - register int i,l=strlen(accept); - for (; *s; s++) - for (i=0; i<l; i++) - if (*s == accept[i]) - return (char*)s; - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/strrchr.c b/mdk-stage1/dietlibc/lib/strrchr.c deleted file mode 100644 index 1abb655e2..000000000 --- a/mdk-stage1/dietlibc/lib/strrchr.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <string.h> -#include "dietfeatures.h" - -char *strrchr(const char *t, int c) { - register char ch; - register const char *l=0; - - ch = c; - for (;;) { - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; -#endif - } - return (char*)l; -} - -char *rindex(const char *t,int c) __attribute__((weak,alias("strrchr"))); diff --git a/mdk-stage1/dietlibc/lib/strsep.c b/mdk-stage1/dietlibc/lib/strsep.c deleted file mode 100644 index a1bf1872a..000000000 --- a/mdk-stage1/dietlibc/lib/strsep.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <string.h> - -char *strsep(char **stringp, const char *delim) { - register char *tmp=*stringp; - register char *tmp2=tmp; - register const char *tmp3; - for (tmp2=tmp; *tmp2; ++tmp2) { - for (tmp3=delim; *tmp3; ++tmp3) - if (*tmp2==*tmp3) { /* delimiter found */ - *tmp2=0; - *stringp=tmp2+1; - return tmp; - } - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/strspn.c b/mdk-stage1/dietlibc/lib/strspn.c deleted file mode 100644 index 2b3a4c116..000000000 --- a/mdk-stage1/dietlibc/lib/strspn.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <sys/types.h> -#include <string.h> - -size_t strspn(const char *s, const char *accept) -{ - size_t l=0; - int a=1,i,al=strlen(accept); - - while((a)&&(*s)) - { - for(a=i=0;(!a)&&(i<al);i++) - if (*s==accept[i]) a=1; - if (a) l++; - s++; - } - return l; -} diff --git a/mdk-stage1/dietlibc/lib/strstr.c b/mdk-stage1/dietlibc/lib/strstr.c deleted file mode 100644 index 641d9d7ac..000000000 --- a/mdk-stage1/dietlibc/lib/strstr.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <sys/types.h> -#include <string.h> - -char *strstr(const char *haystack, const char *needle) { - int nl=strlen(needle); - int hl=strlen(haystack); - int i; - if (nl>hl) return 0; - for (i=hl-nl+1; i; --i) { - if (!memcmp(haystack,needle,nl)) - return (char*)haystack; - ++haystack; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/strtod.c b/mdk-stage1/dietlibc/lib/strtod.c deleted file mode 100644 index cbe983d84..000000000 --- a/mdk-stage1/dietlibc/lib/strtod.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <string.h> - -extern char isspace(char c); - -#ifdef __GNUC__ -static inline char isdigit(char c) { return (c>='0' && c<='9'); } -#endif - -double strtod(const char *nptr, char **endptr) { - double d=0; - register const char *c=nptr; - char neg=0; - while (*c && isspace(*c)) ++c; - switch (*c) { - case '-': neg=1; - case '+': c++; break; - default: break; - } - while (isdigit(*c)) { - d=d*10+(*c-'0'); - ++c; - } - if (*c=='.') { - double factor=.1; - while (isdigit(*++c)) { - d=d+(factor*(*c-'0')); - factor/=10; - } - } - if ((*c|32)=='e') { - int exp=0; - double factor=10; - if (c[1]<'0') { - switch (c[1]) { - case '-': factor=0.1; - case '+': c++; break; - default: - d=0; - c=nptr; - goto done; - } - } - while (isdigit(*++c)) - exp=exp*10+(*c-'0'); - while (exp) { /* XXX: this introduces rounding errors */ - d*=factor; --exp; - } - } -done: - if (endptr) *endptr=(char*)c; - return d; -} diff --git a/mdk-stage1/dietlibc/lib/strtok.c b/mdk-stage1/dietlibc/lib/strtok.c deleted file mode 100644 index 86337da7b..000000000 --- a/mdk-stage1/dietlibc/lib/strtok.c +++ /dev/null @@ -1,8 +0,0 @@ -char *strtok_r(char *s, const char *delim, char **ptrptr); - -static char *strtok_pos; - -char *strtok(char *s, const char *delim) -{ - return strtok_r(s,delim,&strtok_pos); -} diff --git a/mdk-stage1/dietlibc/lib/strtok_r.c b/mdk-stage1/dietlibc/lib/strtok_r.c deleted file mode 100644 index 93f9401de..000000000 --- a/mdk-stage1/dietlibc/lib/strtok_r.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <string.h> - -char *strtok_r(char *s, const char *delim, char **ptrptr) -{ - int i; - char *tmp=0; - - if (s) (*ptrptr)=s; - - if (**ptrptr) - { - while(!(i=strcspn(*ptrptr,delim))) (*ptrptr)++; - if (**ptrptr) - { - tmp=(*ptrptr); - (*ptrptr)+=i; - if (**ptrptr) *(*ptrptr)++=0; - } - } - return tmp; -} diff --git a/mdk-stage1/dietlibc/lib/strtol.c b/mdk-stage1/dietlibc/lib/strtol.c deleted file mode 100644 index ead89f408..000000000 --- a/mdk-stage1/dietlibc/lib/strtol.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <ctype.h> - -extern unsigned long int strtoul(const char *nptr, char **endptr, int base); - -long int strtol(const char *nptr, char **endptr, int base) -{ - int neg=0; - unsigned long int v; - - while(isspace(*nptr)) nptr++; - - if (*nptr == '-' && isdigit(nptr[1])) { neg=-1; nptr++; } - v=strtoul(nptr,endptr,base); - return (neg?-v:v); -} diff --git a/mdk-stage1/dietlibc/lib/strtoll.c b/mdk-stage1/dietlibc/lib/strtoll.c deleted file mode 100644 index 7b8e28a1d..000000000 --- a/mdk-stage1/dietlibc/lib/strtoll.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <ctype.h> - -extern unsigned long int strtoull(const char *nptr, char **endptr, int base); - -long int strtoll(const char *nptr, char **endptr, int base) -{ - int neg=0; - unsigned long long int v; - - while(isspace(*nptr)) nptr++; - - if (*nptr == '-' && isdigit(nptr[1])) { neg=-1; nptr++; } - v=strtoull(nptr,endptr,base); - return (neg?-v:v); -} diff --git a/mdk-stage1/dietlibc/lib/strtoul.c b/mdk-stage1/dietlibc/lib/strtoul.c deleted file mode 100644 index 3f93962a9..000000000 --- a/mdk-stage1/dietlibc/lib/strtoul.c +++ /dev/null @@ -1,32 +0,0 @@ -#include <ctype.h> - -/* static char *num="0123456789abcdefghijklmnopqrstuvwxyz"; */ - -unsigned long int strtoul(const char *nptr, char **endptr, int base) -{ - long int v=0; - - while(isspace(*nptr)) ++nptr; - - if (*nptr == '+') ++nptr; - if (!base) { - if (*nptr=='0') { - base=8; - if ((*(nptr+1)=='x')||(*(nptr+1)=='X')) { - nptr+=2; - base=16; - } - } - else - base=10; - } - while(*nptr) { - register unsigned char c=*nptr; - c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c-'0'); - if (c>=base) break; - v=v*base+c; - ++nptr; - } - if (endptr) *endptr=(char *)nptr; - return v; -} diff --git a/mdk-stage1/dietlibc/lib/strtoull.c b/mdk-stage1/dietlibc/lib/strtoull.c deleted file mode 100644 index 40818958d..000000000 --- a/mdk-stage1/dietlibc/lib/strtoull.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <ctype.h> - -unsigned long long int strtoull(const char *nptr, char **endptr, int base) -{ - long long int v=0; - - while(isspace(*nptr)) ++nptr; - - if (*nptr == '+') ++nptr; - if (!base) { - if (*nptr=='0') { - base=8; - if ((*(nptr+1)=='x')||(*(nptr+1)=='X')) { - nptr+=2; - base=16; - } - } - else - base=10; - } - while(*nptr) { - register unsigned char c=*nptr; - c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c-'0'); - if (c>=base) break; - v=v*base+c; - ++nptr; - } - if (endptr) *endptr=(char *)nptr; - return v; -} diff --git a/mdk-stage1/dietlibc/lib/sys_siglist.c b/mdk-stage1/dietlibc/lib/sys_siglist.c deleted file mode 100644 index 80d7b3fb0..000000000 --- a/mdk-stage1/dietlibc/lib/sys_siglist.c +++ /dev/null @@ -1,37 +0,0 @@ -const char *const sys_siglist[] = - { - "Signal 0", - "Hangup", - "Interrupt", - "Quit", - "Illegal instruction", - "Trace/breakpoint trap", - "IOT trap", - "EMT trap", - "Floating point exception", - "Killed", - "Bus error", - "Segmentation fault", - "Bad system call", - "Broken pipe", - "Alarm clock", - "Terminated", - "Urgent I/O condition", - "Stopped (signal)", - "Stopped", - "Continued", - "Child exited", - "Stopped (tty input)", - "Stopped (tty output)", - "I/O possible", - "CPU time limit exceeded", - "File size limit exceeded", - "Virtual timer expired", - "Profiling timer expired", - "Window changed", - "Resource lost", - "User defined signal 1", - "User defined signal 2", - 0 - }; - diff --git a/mdk-stage1/dietlibc/lib/tcdrain.c b/mdk-stage1/dietlibc/lib/tcdrain.c deleted file mode 100644 index 7a760f643..000000000 --- a/mdk-stage1/dietlibc/lib/tcdrain.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <sys/ioctl.h> - -int __libc_tcdrain(int fd) -{ - return ioctl(fd, TCSBRK, 1); -} - -int tcdrain(int fd) __attribute__((weak,alias("__libc_tcdrain"))); diff --git a/mdk-stage1/dietlibc/lib/tcflush.c b/mdk-stage1/dietlibc/lib/tcflush.c deleted file mode 100644 index a19fe11d1..000000000 --- a/mdk-stage1/dietlibc/lib/tcflush.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <unistd.h> -#include <termios.h> -#include <sys/ioctl.h> - -#include <asm/errno.h> - -extern int errno; - -/* Flush pending data on FD. */ -int tcflush(int fd, int queue_selector) -{ - switch (queue_selector) { - case TCIFLUSH: - return ioctl(fd, TCFLSH, 0); - case TCOFLUSH: - return ioctl(fd, TCFLSH, 1); - case TCIOFLUSH: - return ioctl(fd, TCFLSH, 2); - default: - errno = EINVAL; - return -1; - } -} diff --git a/mdk-stage1/dietlibc/lib/tcgetattr.c b/mdk-stage1/dietlibc/lib/tcgetattr.c deleted file mode 100644 index f35d39442..000000000 --- a/mdk-stage1/dietlibc/lib/tcgetattr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <termios.h> -#include <sys/ioctl.h> - -int tcgetattr(int fildes, struct termios *termios_p) -{ - return ioctl(fildes, TCGETS, termios_p); -} diff --git a/mdk-stage1/dietlibc/lib/tcgetpgrp.c b/mdk-stage1/dietlibc/lib/tcgetpgrp.c deleted file mode 100644 index f2a290651..000000000 --- a/mdk-stage1/dietlibc/lib/tcgetpgrp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <termios.h> -#include <sys/ioctl.h> - -int tcgetpgrp(int fildes) -{ - return ioctl(fildes, TIOCGPGRP); -} diff --git a/mdk-stage1/dietlibc/lib/tcsetattr.c b/mdk-stage1/dietlibc/lib/tcsetattr.c deleted file mode 100644 index cf70354d2..000000000 --- a/mdk-stage1/dietlibc/lib/tcsetattr.c +++ /dev/null @@ -1,27 +0,0 @@ -#define tcsetattr libc_tcsetattr -#include <termios.h> -#include <sys/ioctl.h> -#undef tcsetattr - -#include <asm/errno.h> - -extern int errno; - -/* Hack around a kernel bug; value must correspond to the one used in speed.c */ -#define IBAUD0 020000000000 - -int tcsetattr(int fildes, int optional_actions, struct termios *termios_p) -{ - termios_p->c_iflag &= ~IBAUD0; - switch (optional_actions) { - case TCSANOW: - return ioctl(fildes, TCSETS, termios_p); - case TCSADRAIN: - return ioctl(fildes, TCSETSW, termios_p); - case TCSAFLUSH: - return ioctl(fildes, TCSETSF, termios_p); - default: - errno = EINVAL; - return -1; - } -} diff --git a/mdk-stage1/dietlibc/lib/tcsetpgrp.c b/mdk-stage1/dietlibc/lib/tcsetpgrp.c deleted file mode 100644 index 6c40b5c79..000000000 --- a/mdk-stage1/dietlibc/lib/tcsetpgrp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <termios.h> -#include <sys/ioctl.h> - -int tcsetpgrp(int fildes, pid_t pgrpid) -{ - return ioctl(fildes, TIOCSPGRP, &pgrpid); -} diff --git a/mdk-stage1/dietlibc/lib/telldir.c b/mdk-stage1/dietlibc/lib/telldir.c deleted file mode 100644 index 58be5d034..000000000 --- a/mdk-stage1/dietlibc/lib/telldir.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "dietdirent.h" -#include <unistd.h> -#include <dirent.h> - -off_t telldir(DIR *d) { - return lseek(d->fd,0,SEEK_CUR)-d->num+d->cur; -} diff --git a/mdk-stage1/dietlibc/lib/tolower.c b/mdk-stage1/dietlibc/lib/tolower.c deleted file mode 100644 index 4b7c7cf2d..000000000 --- a/mdk-stage1/dietlibc/lib/tolower.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <ctype.h> - -inline int tolower(int c) { - return (c>='A' && c<='Z')?c-'A'+'a':c; -} - diff --git a/mdk-stage1/dietlibc/lib/toupper.c b/mdk-stage1/dietlibc/lib/toupper.c deleted file mode 100644 index c048e60bb..000000000 --- a/mdk-stage1/dietlibc/lib/toupper.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <ctype.h> - -inline int toupper(int c) { - return (c>='a' && c<='z')?c-'a'+'A':c; -} - diff --git a/mdk-stage1/dietlibc/lib/ttyname.c b/mdk-stage1/dietlibc/lib/ttyname.c deleted file mode 100644 index a6b479088..000000000 --- a/mdk-stage1/dietlibc/lib/ttyname.c +++ /dev/null @@ -1,59 +0,0 @@ -#include "dietfeatures.h" -#include <unistd.h> -#include <sys/stat.h> - -#ifdef __linux__ - -extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase); - -char *ttyname(int fd) { -#ifdef SLASH_PROC_OK - char ibuf[20]; - static char obuf[20]; - strcpy(ibuf,"/proc/self/fd/"); - ibuf[__ltostr(ibuf+14,6,fd,10,0)+14]=0; - if (readlink(ibuf,obuf,sizeof(obuf)-1)<0) return 0; - return obuf; -#else - static char buf[20]="/dev/tty"; - struct stat s; - char *c=buf+8; - int n; - if (fstat(fd,&s)) return 0; - if (S_ISCHR(s.st_mode)) { - n=minor(s.st_rdev); - switch (major(s.st_rdev)) { - case 4: - buf[5]='t'; buf[7]='y'; - if (n>63) { - n-=64; - *c='S'; - ++c; - } -num: - c[__ltostr(c,6,n,10,0)]=0; - break; - case 2: - buf[5]='p'; buf[7]='y'; - buf[8]='p'-(n>>4); - buf[9]=n%4+'0'; - if (buf[9]>'9') *c+='a'-'0'; - buf[10]=0; - case 136: - case 137: - case 138: - case 139: - buf[5]='p'; buf[7]='s'; - n+=(major(s.st_rdev)-136)<<8; - *c='/'; ++c; - goto num; - default: - return 0; - } - return buf; - } - return 0; -#endif -} - -#endif diff --git a/mdk-stage1/dietlibc/lib/usleep.c b/mdk-stage1/dietlibc/lib/usleep.c deleted file mode 100644 index 494f99233..000000000 --- a/mdk-stage1/dietlibc/lib/usleep.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <linux/time.h> -#include <time.h> - -/* nano * 1000 == usecs - * usecs * 1000 == msecs - * msecs * 1000 = secs */ -void usleep(unsigned int usecs) { - struct timespec t; - t.tv_sec=usecs/1000000; - t.tv_nsec=(usecs%1000000)*1000; - nanosleep(&t,&t); -} diff --git a/mdk-stage1/dietlibc/lib/vfork.c b/mdk-stage1/dietlibc/lib/vfork.c deleted file mode 100644 index 795cddb05..000000000 --- a/mdk-stage1/dietlibc/lib/vfork.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <linux/types.h> -#include <unistd.h> - -pid_t vfork(void) { - return fork(); -} diff --git a/mdk-stage1/dietlibc/lib/vfprintf.c b/mdk-stage1/dietlibc/lib/vfprintf.c deleted file mode 100644 index c33a2404b..000000000 --- a/mdk-stage1/dietlibc/lib/vfprintf.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include "dietstdarg.h" - -int vfprintf(FILE *fstream, const char *format, va_list ap) -{ - char *tmp; - va_list cp_ap; - size_t n = 0; - - va_copy(cp_ap, ap); - n=vsnprintf(0, 1000000, format, cp_ap); - tmp=alloca(n+2); - vsnprintf(tmp, n+1, format, ap); - fwrite(tmp, n,1, fstream); - return n; -} - diff --git a/mdk-stage1/dietlibc/lib/vprintf.c b/mdk-stage1/dietlibc/lib/vprintf.c deleted file mode 100644 index 46ecc47a4..000000000 --- a/mdk-stage1/dietlibc/lib/vprintf.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <stdarg.h> -#include <linux/types.h> -#include <unistd.h> -#include <stdlib.h> - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int vprintf(const char *format, va_list ap) -{ - char tmp[1000000]; - size_t n = vsnprintf(tmp, sizeof(tmp), format, ap); - write(1, tmp, n); - return n; -} diff --git a/mdk-stage1/dietlibc/lib/vsnprintf.c b/mdk-stage1/dietlibc/lib/vsnprintf.c deleted file mode 100644 index f425066e3..000000000 --- a/mdk-stage1/dietlibc/lib/vsnprintf.c +++ /dev/null @@ -1,238 +0,0 @@ -#include "dietfeatures.h" -#include <stdarg.h> -#include <sys/types.h> -#include <stdlib.h> -#include <string.h> -#include "dietwarning.h" - -extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase); -extern int __dtostr(double d,char *buf,int maxlen,int prec); - -int vsnprintf (char *str, size_t size, const char *format, va_list arg_ptr) -{ - size_t apos,i; - char ch,buf[1024]; - char *pb; - char flag_in_sign; - char flag_hash,flag_zero,flag_left,flag_space,flag_sign,flag_dot,flag_long; - long number,width,preci,buf_len,pad; - char padwith; - - size--; - - apos=0; - while (apos<size) - { - ch=*format++; - switch (ch) - { - case '%': - flag_hash=0; - flag_zero=0; - flag_left=0; - flag_space=0; - flag_sign=0; - flag_dot=0; - flag_in_sign=0; - flag_long=0; - - width=0; - padwith=' '; - -inn_vsnprintf: - if (apos>=size) continue; /* ARGL !!! */ - - ch=*format++; - switch (ch) - { -/* Format end ?!? */ - case 0: - return -1; - break; - -/* Format flag chars */ - case '#': - flag_hash=1; - goto inn_vsnprintf; - - case 'l': - ++flag_long; - goto inn_vsnprintf; - - case '0': - padwith='0'; - goto inn_vsnprintf; - - case '-': - flag_left=1; - goto inn_vsnprintf; - - case ' ': - flag_space=1; - goto inn_vsnprintf; - - case '+': - flag_sign=1; - goto inn_vsnprintf; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if(flag_dot) return -1; - width=strtol(--format,&pb,10); - format=pb; - goto inn_vsnprintf; - - case '*': - width=va_arg(arg_ptr,int); - goto inn_vsnprintf; - - case '.': - flag_dot=1; - if (*format=='*') { - preci=va_arg(arg_ptr,int); - ++format; - } else { - preci=strtol(format,&pb,10); - format=pb; - } - goto inn_vsnprintf; - -/* Format conversion chars */ - case 'c': - ch=(char)va_arg(arg_ptr,int); - case '%': - if (str) str[apos]=ch; ++apos; - break; - - case 's': - pb=va_arg(arg_ptr,char *); -#ifdef WANT_NULL_PRINTF - if (!pb) pb="(null)"; -#endif - buf_len=strlen(pb); - if (flag_dot && buf_len>preci) buf_len=preci; - if (buf_len>size-apos) buf_len=size-apos; - -print_out: - if (str) { - if (width && (!flag_left)) - { - for (pad=width-buf_len; pad>0; --pad) str[apos++]=padwith; - } - for(i=0;i<buf_len;++i) { str[apos++]=pb[i]; } /* strncpy */ - if (width && (flag_left)) - { - for (pad=width-buf_len; pad>0; --pad) str[apos++]=padwith; - } - } else { - if (width) { - apos+=width>buf_len?width:buf_len; - } else { - apos+=size>buf_len?buf_len:size; - } - } - - break; - - /* Numbers */ - case 'b': - i=2; - goto num_vsnprintf; - case 'p': - flag_hash=1; - width=sizeof(void *)<<1; - padwith='0'; - ch='x'; - case 'X': - case 'x': - i=16; - if (flag_hash) - { - if (str) { - str[apos++]='0'; - str[apos++]=ch; - } else - apos+=2; - } - goto num_vsnprintf; - case 'd': - case 'i': - flag_in_sign=1; - case 'u': - i=10; - goto num_vsnprintf; - case 'o': - i=8; - if (flag_hash) { if (str) str[apos]='0'; ++apos; } - -num_vsnprintf: - if (apos>=size) continue; /* ARGL !!! */ - - if (flag_long) - number=va_arg(arg_ptr,long); - else - number=va_arg(arg_ptr,int); - - if (flag_in_sign && (number<0)) - { - number*=-1; - flag_in_sign=2; - } - - buf_len=__ltostr(buf+1,sizeof(buf)-1,(unsigned long) number,i,0); - pb=buf+1; - - if (flag_in_sign==2) - { - *(--pb)='-'; - buf_len++; - } - else if ((flag_in_sign)&&(flag_sign || flag_space)) - { - *(--pb)=(flag_sign)?'+':' '; - buf_len++; - } - goto print_out; - -#ifdef WANT_FLOATING_POINT_IN_PRINTF - case 'f': - case 'g': - { - double d=va_arg(arg_ptr,double); - buf_len=__dtostr(d,buf,sizeof(buf),width?width:6); - if (flag_dot) { - char *tmp; - if ((tmp=strchr(buf,'.'))) { - while (preci>-1 && *++tmp) --preci; - *tmp=0; - } - } - pb=buf; - goto print_out; - } -#endif - default: - break; - } - break; - case 0: - if (str) str[apos]=0; - return apos; - default: - if (str) str[apos]=ch; apos++; - break; - } - } - if (str) str[apos]=0; - return apos; -} - -link_warning("vsnprintf","warning: the printf functions add several kilobytes of bloat.") - diff --git a/mdk-stage1/dietlibc/lib/vsprintf.c b/mdk-stage1/dietlibc/lib/vsprintf.c deleted file mode 100644 index 10ff04bd7..000000000 --- a/mdk-stage1/dietlibc/lib/vsprintf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdarg.h> -#include <linux/types.h> -#include <stdlib.h> - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int vsprintf(char *dest,const char *format, va_list arg_ptr) -{ - return vsnprintf(dest,1000000,format,arg_ptr); -} diff --git a/mdk-stage1/dietlibc/lib/vsscanf.c b/mdk-stage1/dietlibc/lib/vsscanf.c deleted file mode 100644 index 1c4c9b787..000000000 --- a/mdk-stage1/dietlibc/lib/vsscanf.c +++ /dev/null @@ -1,304 +0,0 @@ -#include "dietfeatures.h" -#include <stdarg.h> -#include <sys/types.h> -#include <ctype.h> -#include <stdlib.h> -#include <string.h> - -const char *skip_ws(const char *str) -{ - while ((*str)&&(isspace(*str))) str++; - return str; -} - -extern double strtod(const char *s,char **f); - -int vsscanf(const char *str, const char *format, va_list arg_ptr) -{ - int n=0,div; - unsigned char ch; - - char flag_discard, flag_malloc, flag_half, flag_long, flag_longlong; - char flag_width; - - unsigned long width; - - /* arg_ptr tmps */ -#ifdef WANT_FLOATING_POINT_IN_SCANF - double d,*pd; - float *pf; -#endif - - long l=0,*pl; - short *ph; - int *pi; - char *s; - - while ((*str)&&(*format)) - { - const char *prevfmt=format; - format=skip_ws(format); - ch=*format++; - if (!ch) continue; - - switch (ch) - { - case '%': - div=0; - flag_discard=0; - flag_malloc=0; - flag_half=0; - flag_long=0; - flag_longlong=0; - - flag_width=0; - width=-1; - -inn_vsscanf: - ch=*format++; - - switch (ch) - { - case 0: - return 0; - - case '%': - if (*(str++)!=ch) return n; - break; - - /* flags */ - case '*': - flag_discard=1; - goto inn_vsscanf; - - case 'a': - flag_malloc=1; - goto inn_vsscanf; - - case 'h': - flag_half=1; - goto inn_vsscanf; - - case 'l': - if (flag_long) flag_longlong=1; - flag_long=1; - goto inn_vsscanf; - - /* longlong ? NOT YET ! */ - case 'q': - case 'L': - flag_longlong=1; - goto inn_vsscanf; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - width=strtol(format-1,&s,10); - format=s; - flag_width=1; - goto inn_vsscanf; - - /* conversion */ - - case 'n': - while (width && *str) - { - *(s++)=*(str++); - --width; - l++; - } - if (!flag_discard) - { - pl=(long *)va_arg(arg_ptr,long*); - *pl=l; - ++n; - } - break; - - case 'p': - case 'X': - case 'x': - div+=6; - case 'd': - div+=2; - case 'o': - div+=8; - case 'u': - case 'i': - if (*(str=skip_ws(str))) - { - l=strtol(str,&s,div); - if (str!=s) - { - if (!flag_discard) - { - if (flag_long) - { - pl=(long *)va_arg(arg_ptr,long*); - *pl=l; - } - else if (flag_half) - { - ph=(short *)va_arg(arg_ptr,short*); - *ph=l; - } - else - { - pi=(int *)va_arg(arg_ptr,int*); - *pi=l; - } - ++n; - } - str=s; - } - else - return n; - } - break; - -#ifdef WANT_FLOATING_POINT_IN_SCANF - case 'e': - case 'E': - case 'f': - case 'g': - if (*(str=skip_ws(str))) - { - d=strtod(str,&s); - if (str!=s) - { - if (!flag_discard) - { - if (flag_long) - { - pd=(double *)va_arg(arg_ptr,double*); - *pd=d; - } - else - { - pf=(float *)va_arg(arg_ptr,float*); - *pf=d; - } - ++n; - } - str=s; - } - else - return n; - } - break; -#endif - - case 'c': - if (!flag_discard) - { - s=(char *)va_arg(arg_ptr,char*); - ++n; - } - if (!flag_width) width=1; - while (width && *str) - { - if (!flag_discard) *(s++)=*(str); - ++str; - --width; - } - break; - - case 's': - if (!flag_discard) - { - s=(char *)va_arg(arg_ptr,char*); - ++n; - } - if (*(str=skip_ws(str))) - { - while (width && (!isspace(*str))) - { - if (!flag_discard) *(s++)=*(str); - if (!*str) break; - ++str; - --width; - } - *s=0; - } - break; - -#ifdef WANT_CHARACTER_CLASSES_IN_SCANF - case '[': - { - char cset[256]; - int flag_not=0; - int flag_dash=0; - memset(cset,0,sizeof(cset)); - ch=*format++; - - /* first char specials */ - if (ch=='^') - { - flag_not=1; - ch=*format++; - } - if ((ch=='-')||(ch==']')) - { - cset[ch]=1; - ch=*format++; - } - - /* almost all non special chars */ - for (;(*format) && (*format!=']');++format) { - if (flag_dash) - { - register unsigned char tmp=*format; - for (;ch<=tmp;++ch) cset[ch]=1; - flag_dash=0; - ch=*(++format); - } - else if (*format=='-') flag_dash=1; - else - { - cset[ch]=1; - ch=*format; - } - } - - /* last char specials */ - if (flag_dash) cset['-']=1; - else cset[ch]=1; - - /* like %c or %s */ - if (!flag_discard) - { - s=(char *)va_arg(arg_ptr,char*); - ++n; - } - while (width && (cset[(unsigned char)(*str)]-flag_not)) - { - if (!flag_discard) *(s++)=*(str); - if (!*str) break; - ++str; - --width; - } - } - break; -#endif - } - break; - - default: - if (prevfmt<format) { - while (prevfmt<format) { - if (*str!=*prevfmt) return n; - ++str; ++prevfmt; - } - } else - if (*(str++)!=ch) return n; - break; - } - } - return n; -} diff --git a/mdk-stage1/dietlibc/lib/wait.c b/mdk-stage1/dietlibc/lib/wait.c deleted file mode 100644 index 8459af18c..000000000 --- a/mdk-stage1/dietlibc/lib/wait.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <sys/types.h> -#include <sys/wait.h> - -pid_t wait(int *status) { - return waitpid(-1,status,0); -} diff --git a/mdk-stage1/dietlibc/lib/wait3.c b/mdk-stage1/dietlibc/lib/wait3.c deleted file mode 100644 index 19e90740c..000000000 --- a/mdk-stage1/dietlibc/lib/wait3.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <sys/wait.h> - -int wait3(int* status,int opts,struct rusage* rusage) { - return wait4(-1,status,opts,rusage); -} diff --git a/mdk-stage1/dietlibc/libcruft/___div.c b/mdk-stage1/dietlibc/libcruft/___div.c deleted file mode 100644 index d359dc47b..000000000 --- a/mdk-stage1/dietlibc/libcruft/___div.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "dietwarning.h" -#include <stdlib.h> - -div_t div(int numer, int denom) { - div_t temp; - temp.quot=numer/denom; - temp.rem=numer%denom; - return temp; -} - -link_warning("div","warning: your code uses div(), which is completely superfluous!"); diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft.c b/mdk-stage1/dietlibc/libcruft/dnscruft.c deleted file mode 100644 index d7a0efa50..000000000 --- a/mdk-stage1/dietlibc/libcruft/dnscruft.c +++ /dev/null @@ -1,115 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <sys/socket.h> -#include <unistd.h> -#include <fcntl.h> -#include <arpa/inet.h> -#include <string.h> -#include <ctype.h> -#include <stdlib.h> - -int __dns_fd=-1; - -void __dns_make_fd() { - int tmp; - struct sockaddr_in si; - if (__dns_fd>0) return; - tmp=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP); - if (tmp<0) { - perror("__dns_make_fd!socket"); - return; - } - si.sin_family=AF_INET; - si.sin_port=0; - si.sin_addr.s_addr=INADDR_ANY; - if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) { - perror("__dns_make_fd!bind"); - return; - } - __dns_fd=tmp; -} - -int __dns_servers=0; -struct sockaddr __dns_server_ips[8]; - -int __dns_search=0; -char *__dns_domains[8]; - -void __dns_readstartfiles() { - int fd; - char *buf=alloca(4096); - int len; - if (__dns_servers>0) return; - { - struct sockaddr_in to; - char *cacheip=getenv("DNSCACHEIP"); - if (cacheip) { - to.sin_port=htons(53); - to.sin_family=AF_INET; - if (inet_aton(cacheip,&to.sin_addr)) { - memmove(__dns_server_ips,&to,sizeof(struct sockaddr)); - ++__dns_servers; - } - } - } - if ((fd=open("/etc/resolv.conf",O_RDONLY))<0) return; - len=read(fd,buf,4096); - close(fd); - { - char *last=buf+len; - for (; buf<last;) { - if (!strncmp(buf,"nameserver",10)) { - buf+=10; - while (buf<last && *buf!='\n') { - while (buf<last && isblank(*buf)) ++buf; - { - char *tmp=buf; - struct sockaddr_in i; - while (buf<last && !isspace(*buf)) ++buf; - if (buf>=last) break; - *buf=0; - if (inet_aton(tmp,&i.sin_addr)) { - i.sin_family=AF_INET; - i.sin_port=htons(53); - memmove(&__dns_server_ips[__dns_servers],&i,sizeof(struct sockaddr)); - if (__dns_servers<8) ++__dns_servers; - } - } - } - } - if (!strncmp(buf,"search",6) || !strncmp(buf,"domain",6)) { - buf+=6; - } - while (buf<last && *buf!='\n') ++buf; - while (buf<last && *buf=='\n') ++buf; - } - } -} - -/* return length of decoded data or -1 */ -int __dns_decodename(unsigned char *packet,int offset,unsigned char *dest,int maxlen) { - unsigned char *tmp; - unsigned char *max=dest+maxlen; - unsigned char *after=packet+offset; - int ok=0; - for (tmp=after; maxlen>0&&*tmp; ) { - if ((*tmp>>6)==3) { /* goofy DNS decompression */ - unsigned int ofs=((unsigned int)(*tmp&0x3f)<<8)|*(tmp+1); - if (ofs>=offset) return -1; /* RFC1035: "pointer to a _prior_ occurrance" */ - if (after<tmp+2) after=tmp+2; - tmp=packet+ofs; - ok=0; - } else { - unsigned int duh; - if (dest+*tmp+1>max) return -1; - for (duh=*tmp; duh>0; --duh) - *dest++=*++tmp; - *dest++='.'; ok=1; - ++tmp; - if (tmp>after) { after=tmp; if (!*tmp) ++after; } - } - } - if (ok) --dest; - *dest=0; - return after-packet; -} diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft2.c b/mdk-stage1/dietlibc/libcruft/dnscruft2.c deleted file mode 100644 index b59207072..000000000 --- a/mdk-stage1/dietlibc/libcruft/dnscruft2.c +++ /dev/null @@ -1,185 +0,0 @@ -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <stdlib.h> -#include <arpa/inet.h> -#include <sys/poll.h> -#include <unistd.h> -#include <errno.h> - -#include <stdio.h> - -extern int h_errno; - -static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000"; - -extern void __dns_make_fd(); -extern int __dns_fd; - -extern int __dns_servers; -extern struct sockaddr __dns_server_ips[]; - -extern void __dns_readstartfiles(); - -extern int __dns_decodename(unsigned char *packet,int offset,unsigned char *dest,int maxlen); - -/* Oh boy, this interface sucks so badly, there are no words for it. - * Not one, not two, but _three_ error signalling methods! (*h_errnop - * nonzero? return value nonzero? *RESULT zero?) The glibc goons - * really outdid themselves with this one. */ -int __dns_gethostbyx_r(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor) { - int names,ips; - unsigned char *cur; - unsigned char *max; - unsigned char packet[512]; - __dns_make_fd(); - - if (lookfor==1) { - result->h_aliases=(char**)(buf+8*4); - result->h_addrtype=AF_INET; - result->h_length=4; - result->h_addr_list=(char**)buf; - } else { - result->h_aliases=(char**)(buf+8*16); - result->h_addrtype=AF_INET6; - result->h_length=16; - result->h_addr_list=(char**)buf; - } - result->h_aliases[0]=0; - - cur=buf+16*sizeof(char*); - max=buf+buflen; - names=ips=0; - - memmove(packet,dnspacket,12); - *(unsigned short*)packet=rand(); - { - unsigned char* x; - const char* y,* tmp; - x=packet+12; y=name; - while (*y) { - while (*y=='.') ++y; - for (tmp=y; *tmp && *tmp!='.'; ++tmp) ; - *x=tmp-y; - if (!(tmp-y)) break; - ++x; - if (x>=packet+510-(tmp-y)) { *h_errnop=ERANGE; return 1; } - memmove(x,y,tmp-y); - x+=tmp-y; - if (!*tmp) { - *x=0; - break; - } - y=tmp; - } - *++x= 0; *++x= lookfor; /* A */ - *++x= 0; *++x= 1; /* IN */ - ++x; - { - int i; /* current server */ - int j; /* timeout count down */ - struct pollfd duh; - i=0; j=30; - __dns_readstartfiles(); - duh.fd=__dns_fd; - duh.events=POLLIN; - for (j=30; j>0; --j) { - sendto(__dns_fd,packet,x-packet,0,(struct sockaddr*)&(__dns_server_ips[i]),sizeof(struct sockaddr)); - if (++i > __dns_servers) i=0; - if (poll(&duh,1,1) == 1) { - /* read and parse answer */ - unsigned char inpkg[1500]; - /*int len=*/ read(__dns_fd,inpkg,1500); -#if 0 - { - int tft=open("duh",0); - read(tft,inpkg,1500); - close(tft); - } -#endif - /* header, question, answer, authority, additional */ - if (inpkg[0]!=packet[0] || inpkg[1]!=packet[1]) continue; /* wrong ID */ - if ((inpkg[2]&0xf9) != 0x81) continue; /* not answer */ - if ((inpkg[3]&0x0f) != 0) break; /* error */ - tmp=inpkg+12; - { - char name[257]; - unsigned short q=((unsigned short)inpkg[4]<<8)+inpkg[5]; - while (q>0) { - while (*tmp) tmp+=*tmp+1; - tmp+=5; - --q; - } - q=((unsigned short)inpkg[6]<<8)+inpkg[7]; - if (q<1) break; - while (q>0) { - int decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256); - if (decofs<0) break; - tmp=inpkg+decofs; - --q; - if (tmp[0]!=0 || tmp[1]!=lookfor || /* TYPE != A */ - tmp[2]!=0 || tmp[3]!=1) { /* CLASS != IN */ - if (tmp[1]==5) { /* CNAME */ - tmp+=10; - decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256); - if (decofs<0) break; - tmp=inpkg+decofs; - } else - break; - continue; - } - tmp+=10; /* skip type, class, TTL and length */ - { - int slen; - if (lookfor==1 || lookfor==28) /* A or AAAA*/ { - slen=strlen(name); - if (cur+slen+8+(lookfor==28?12:0)>=max) { *h_errnop=NO_RECOVERY; return 1; } - } else if (lookfor==12) /* PTR */ { - decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256); - if (decofs<0) break; - tmp=inpkg+decofs; - slen=strlen(name); - } else - slen=strlen(name); - strcpy(cur,name); - if (names==0) - result->h_name=cur; - else - result->h_aliases[names-1]=cur; - result->h_aliases[names]=0; - ++names; -/* cur+=slen+1; */ - cur+=(slen|3)+1; - result->h_addr_list[ips++] = cur; - if (lookfor==1) /* A */ { - *(int*)cur=*(int*)tmp; - cur+=4; - result->h_addr_list[ips]=0; - } else if (lookfor==28) /* AAAA */ { - { - int i; - for (i=0; i<16; ++i) cur[i]=tmp[i]; - } - cur+=16; - result->h_addr_list[ips]=0; - } - } -/* puts(name); */ - } - } -/* printf("%d answers\n",((unsigned short)inpkg[6]<<8)+inpkg[7]); - printf("ok\n");*/ - *h_errnop=0; - *RESULT=result; - return 0; - } -/*kaputt:*/ - } - } - } - return 1; -} diff --git a/mdk-stage1/dietlibc/libcruft/entlib.c b/mdk-stage1/dietlibc/libcruft/entlib.c deleted file mode 100644 index f88b3f057..000000000 --- a/mdk-stage1/dietlibc/libcruft/entlib.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * dietlibc/lib/entlib.c - Generic delimited-line parsing library - * - * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com> - * - * This is a brand new implementation, based on the interface - * described in man-pages-1.34-1mdk man pages package. - */ - - -#include "entlib.h" /* this is our only include */ - - -/* - * __ent_start - * - * Allocates and zeroes the module's state structure, - * and open a handle to /etc/passwd. - * - * Returns -1 on failure and sets errno, or zero for success. - */ - -int __ent_start(const char *pathname, struct __ent_state **st_ref) -{ - struct __ent_state *st; - - if (*st_ref) - return 0; - - st = calloc(1, sizeof(*st)); - if (!st) { - errno = ENOMEM; - return -1; - } - - st->fd = open(pathname, O_RDONLY); - if (st->fd == -1) { - /* errno should have been set by open(2) */ - free(st); - st = NULL; - return -1; - } - - *st_ref = st; - return 0; -} - - -/* - * __ent_get_line - * - * Eliminates a previous line from the buffer, if any. - * Then reads in a new line from /etc/passwd, if necessary. - * - * Returns -1 on failure, or zero for success. - */ - -int __ent_get_line(struct __ent_state *st) -{ - int rc; - - /* overwrite previous line, by shifting the rest - * of the rest to the front of the buffer - */ - if (st->bufptr) { - unsigned int slop = st->buflen - st->bufptr; - memmove(st->ent_buf, &st->ent_buf[st->bufptr], slop); - st->bufptr = 0; - st->buflen = slop; - st->ent_buf[st->buflen] = 0; /* null terminate */ - } - - if (st->buflen == __ENT_BUFSIZ || strchr(st->ent_buf, '\n')) - return 0; - - rc = read(st->fd, &st->ent_buf[st->buflen], __ENT_BUFSIZ - st->buflen); - if (rc < 0) - return -1; - - st->buflen += rc; - if (st->buflen == 0) - return -1; - - return 0; -} - - -/* - * __ent_split - * - * Splits a string into parts based on a delimiter. - * Stops processing when \n is reached also. - * - * Returns -1 on failure, or zero on success. - */ - -int __ent_split(struct __ent_state *st, char **parts, - int n_parts, int delimiter, int require_exact) -{ - char *s = &st->ent_buf[st->bufptr]; - int idx = 0; - - /* empty list */ - if (!*s) { - if (!require_exact) - return 0; - return -1; - } - - /* scan through string, sticking string pointers - * into parts[] as delimiters are found - */ - parts[idx++] = s; - while (*s) { - st->bufptr++; - if (*s == '\n') { - *s = 0; /* null terminate */ - break; - } - if (*s == delimiter) { - *s = 0; /* null terminate */ - /* boundary error: too many delimiters */ - if (idx == n_parts) - return -1; - s++; - parts[idx++] = s; - } else { - s++; - } - } - - if (!require_exact) - return 0; - return (n_parts == idx) ? 0 : -1; -} - - -void __ent_set(struct __ent_state *st) -{ - if (!st) - return; - st->buflen = st->bufptr = 0; - lseek(st->fd, 0, SEEK_SET); -} - - -void __ent_end(struct __ent_state *st) -{ - if (!st) - return; - close(st->fd); - free(st); -} diff --git a/mdk-stage1/dietlibc/libcruft/entlib.h b/mdk-stage1/dietlibc/libcruft/entlib.h deleted file mode 100644 index 2659d542e..000000000 --- a/mdk-stage1/dietlibc/libcruft/entlib.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * dietlibc/lib/entlib.h - Generic delimited-line parsing library header - * - * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com> - * - * This is a brand new implementation, based on the interface - * described in man-pages-1.34-1mdk man pages package. - */ - -#ifndef __ENTLIB_H -#define __ENTLIB_H - -#include <sys/types.h> /* for open(2), lseek(2) */ -#include <sys/stat.h> /* for open(2) */ -#include <fcntl.h> /* for open(2) */ -#include <unistd.h> /* for close(2), lseek(2) */ -#include <stdlib.h> /* for calloc(3), free(3) */ -#include <errno.h> /* for errno */ -#include <string.h> /* for memmove(3) */ -#include <stdlib.h> /* for atoi(3) */ -#include <paths.h> /* for the file locations */ - -#include <pwd.h> /* for struct passwd */ -#include <grp.h> /* for struct group */ -#include <shadow.h> /* for struct spwd */ - -/* should be a multiple of 64 to create decent alignment */ -#define __ENT_BUFSIZ (64 * 2) -#define __ENT_RAW_BUFSIZ (__ENT_BUFSIZ + 2) /* some overlap required */ - -struct __ent_state { - char ent_buf[__ENT_RAW_BUFSIZ]; /* raw file data buffer */ - unsigned int buflen; /* amount of valid data in ent_buf */ - unsigned int bufptr; /* next valid position in ent_buf */ - int fd; /* /etc/passwd file descriptor */ -}; - -extern int __ent_start(const char *pathname, struct __ent_state **st_ref); -extern int __ent_get_line(struct __ent_state *st); -extern int __ent_split(struct __ent_state *st, char **parts, int n_parts, int delimiter, int require_exact); -extern void __ent_set(struct __ent_state *st); -extern void __ent_end(struct __ent_state *st); - -#endif /* __ENTLIB_H */ diff --git a/mdk-stage1/dietlibc/libcruft/getdtablesize.c b/mdk-stage1/dietlibc/libcruft/getdtablesize.c deleted file mode 100644 index 227354714..000000000 --- a/mdk-stage1/dietlibc/libcruft/getdtablesize.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <unistd.h> -#include <limits.h> - -int getdtablesize(void) { - return OPEN_MAX; -} diff --git a/mdk-stage1/dietlibc/libcruft/getgrgid.c b/mdk-stage1/dietlibc/libcruft/getgrgid.c deleted file mode 100644 index 0c223056c..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrgid.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <grp.h> -#include <string.h> -#include <stdlib.h> - -struct group *getgrgid(gid_t gid) { - struct group *tmp; - setgrent(); - for (;;) { - tmp=getgrent(); - if (!tmp) return 0; - if (tmp->gr_gid == gid) - return tmp; - } -} diff --git a/mdk-stage1/dietlibc/libcruft/getgrnam.c b/mdk-stage1/dietlibc/libcruft/getgrnam.c deleted file mode 100644 index 1bdbb42a8..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrnam.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <grp.h> -#include <string.h> -#include <stdlib.h> - -struct group *getgrnam(const char* name) { - struct group *tmp; - setgrent(); - for (;;) { - tmp=getgrent(); - if (!tmp) return 0; - if (!strcmp(tmp->gr_name,name)) - return tmp; - } -} diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c deleted file mode 100644 index a4207d44d..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c +++ /dev/null @@ -1,38 +0,0 @@ -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <stdlib.h> -#include <arpa/inet.h> -#include <sys/poll.h> -#include <unistd.h> -#include <errno.h> - -extern int h_errno; - -struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type) { - static struct hostent hostbuf; - struct hostent *hp; - size_t hstbuflen; - char *tmphstbuf; - int res; - int herr; - - hstbuflen = 1024; - /* Allocate buffer, remember to free it to avoid a memory leakage. */ - tmphstbuf = malloc (hstbuflen); - - while ((res = gethostbyaddr_r (addr, len, type, &hostbuf, tmphstbuf, hstbuflen, - &hp, &herr)) == ERANGE) - { - /* Enlarge the buffer. */ - hstbuflen *= 2; - tmphstbuf = realloc (tmphstbuf, hstbuflen); - } - /* Check for errors. */ - if (res || hp == NULL) - return NULL; - return hp; -} - diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c deleted file mode 100644 index 37174ab13..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <stdlib.h> -#include <arpa/inet.h> -#include <sys/poll.h> -#include <unistd.h> -#include <errno.h> - -#include <stdio.h> - -extern int __dns_gethostbyx_r(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor); - -static int i2a(char* dest,unsigned int x) { - register unsigned int tmp=x; - register int len=0; - if (x>=100) { *dest++=tmp/100+'0'; tmp=tmp%100; ++len; } - if (x>=10) { *dest++=tmp/10+'0'; tmp=tmp%10; ++len; } - *dest++=tmp+'0'; - return len+1; -} - -/* Oh boy, this interface sucks so badly, there are no words for it. - * Not one, not two, but _three_ error signalling methods! (*h_errnop - * nonzero? return value nonzero? *RESULT zero?) The glibc goons - * really outdid themselves with this one. */ -int gethostbyaddr_r(const char* addr, size_t length, int format, - struct hostent* result, char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop) { - if (format==AF_INET) { - char tmpbuf[50]; - char *tmp; - int res; - tmp=tmpbuf+i2a(tmpbuf,(unsigned char)addr[3]); *tmp++='.'; - tmp+=i2a(tmp,(unsigned char)addr[2]); *tmp++='.'; - tmp+=i2a(tmp,(unsigned char)addr[1]); *tmp++='.'; - tmp+=i2a(tmp,(unsigned char)addr[0]); strcpy(tmp,".in-addr.arpa"); - res= __dns_gethostbyx_r(tmpbuf,result,buf+4,buflen-4,RESULT,h_errnop,12); /* 12 == ns_t_ptr */ - if (res==0) { - result->h_addr_list[0]=buf; - result->h_addr_list[1]=buf; - *(int*)buf=*(int*)addr; - } - return res; - } - return 1; -} diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname.c b/mdk-stage1/dietlibc/libcruft/gethostbyname.c deleted file mode 100644 index 5db5bf3c5..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname.c +++ /dev/null @@ -1,39 +0,0 @@ -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <stdlib.h> -#include <arpa/inet.h> -#include <sys/poll.h> -#include <unistd.h> -#include <errno.h> - -extern int h_errno; - -struct hostent* gethostbyname (const char *host) -{ - static struct hostent hostbuf; - struct hostent *hp; - size_t hstbuflen; - char *tmphstbuf; - int res; - int herr; - - hstbuflen = 1024; - /* Allocate buffer, remember to free it to avoid a memory leakage. */ - tmphstbuf = malloc (hstbuflen); - - while ((res = gethostbyname_r (host, &hostbuf, tmphstbuf, hstbuflen, - &hp, &herr)) == ERANGE) - { - /* Enlarge the buffer. */ - hstbuflen *= 2; - tmphstbuf = realloc (tmphstbuf, hstbuflen); - } - /* Check for errors. */ - if (res || hp == NULL) - return NULL; - return hp; -} - diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2.c deleted file mode 100644 index 3d8296616..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c +++ /dev/null @@ -1,40 +0,0 @@ - -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <stdlib.h> -#include <arpa/inet.h> -#include <sys/poll.h> -#include <unistd.h> -#include <errno.h> - -extern int h_errno; - -struct hostent* gethostbyname2(const char *host,int AF) -{ - static struct hostent hostbuf; - struct hostent *hp; - size_t hstbuflen; - char *tmphstbuf; - int res; - int herr; - - hstbuflen = 1024; - /* Allocate buffer, remember to free it to avoid a memory leakage. */ - tmphstbuf = malloc (hstbuflen); - - while ((res = gethostbyname2_r (host, AF,&hostbuf, tmphstbuf, hstbuflen, - &hp, &herr)) == ERANGE) - { - /* Enlarge the buffer. */ - hstbuflen *= 2; - tmphstbuf = realloc (tmphstbuf, hstbuflen); - } - /* Check for errors. */ - if (res || hp == NULL) - return NULL; - return hp; -} - diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c deleted file mode 100644 index b505ccfbc..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <stdlib.h> -#include <arpa/inet.h> -#include <sys/poll.h> -#include <unistd.h> -#include <errno.h> - -#include <stdio.h> - -extern int __dns_gethostbyx_r(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor); - -/* Oh boy, this interface sucks so badly, there are no words for it. - * Not one, not two, but _three_ error signalling methods! (*h_errnop - * nonzero? return value nonzero? *RESULT zero?) The glibc goons - * really outdid themselves with this one. */ -int gethostbyname2_r(const char* name, int AF, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop) { - int L=strlen(name); - int lookfor=0; - switch (AF) { - case AF_INET: lookfor=1; break; - case AF_INET6: lookfor=28; break; - default: *h_errnop=EINVAL; return 1; - } - result->h_name=buf; - if (buflen<L) { *h_errnop=ERANGE; return 1; } - strcpy(buf,name); - return __dns_gethostbyx_r(name,result,buf+L,buflen-L,RESULT,h_errnop,lookfor); -} diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c deleted file mode 100644 index d5a531f0f..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <string.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <stdlib.h> -#include <arpa/inet.h> -#include <sys/poll.h> -#include <unistd.h> -#include <errno.h> - -#include <stdio.h> - -extern int __dns_gethostbyx_r(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor); - -/* Oh boy, this interface sucks so badly, there are no words for it. - * Not one, not two, but _three_ error signalling methods! (*h_errnop - * nonzero? return value nonzero? *RESULT zero?) The glibc goons - * really outdid themselves with this one. */ -int gethostbyname_r(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop) { - int L=strlen(name); - result->h_name=buf; - if (buflen<L) { *h_errnop=ERANGE; return 1; } - strcpy(buf,name); - return __dns_gethostbyx_r(name,result,buf+L,buflen-L,RESULT,h_errnop,1); -} diff --git a/mdk-stage1/dietlibc/libcruft/getlogin.c b/mdk-stage1/dietlibc/libcruft/getlogin.c deleted file mode 100644 index 359f44d9f..000000000 --- a/mdk-stage1/dietlibc/libcruft/getlogin.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <stdlib.h> - -char* getlogin() { - return getenv("LOGNAME"); -} diff --git a/mdk-stage1/dietlibc/libcruft/getpagesize.c b/mdk-stage1/dietlibc/libcruft/getpagesize.c deleted file mode 100644 index dea4a9693..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpagesize.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> - -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 -#endif - -size_t __libc_getpagesize(void) { - return PAGE_SIZE; -} - -size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize"))); - diff --git a/mdk-stage1/dietlibc/libcruft/getpass.c b/mdk-stage1/dietlibc/libcruft/getpass.c deleted file mode 100644 index 3da7cd2b3..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpass.c +++ /dev/null @@ -1,40 +0,0 @@ -#include <termios.h> -#include <unistd.h> -#include <limits.h> -#include <fcntl.h> -#include <string.h> - -char *getpass(const char* prompt) { - struct termios old,tmp; - int out,in=open("/dev/tty",O_RDWR); - int doclose=(in>=0); - static char buf[PASS_MAX]; - if (doclose) { in=0; out=2; } else out=in; - if (!tcgetattr(in,&old)) { - tmp=old; - tmp.c_lflag &= ~(ECHO|ISIG); - tcsetattr(in,TCSAFLUSH,&tmp); - } - write(out,prompt,strlen(prompt)); - { - int nread,ofs=0; - for (;;) { - nread=read(in,buf+ofs,PASS_MAX-ofs); - if (nread<0) { - buf[ofs]=0; - break; - } else if (ofs+nread>=PASS_MAX) { - buf[PASS_MAX-1]=0; - break; - } else if (buf[ofs+nread-1]=='\n') { - buf[ofs+nread-1]=0; - break; - } - ofs+=nread; - } - write(out,"\n",1); - } - tcsetattr(in,TCSAFLUSH,&old); - if (doclose) close(in); - return buf; -} diff --git a/mdk-stage1/dietlibc/libcruft/getpwnam.c b/mdk-stage1/dietlibc/libcruft/getpwnam.c deleted file mode 100644 index 53aae74d1..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwnam.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <pwd.h> -#include <string.h> -#include <stdlib.h> - -struct passwd *getpwnam(const char * name) { - struct passwd *tmp; - setpwent(); - for (;;) { - tmp=getpwent(); - if (!tmp) return 0; - if (!strcmp(tmp->pw_name,name)) - return tmp; - } -} diff --git a/mdk-stage1/dietlibc/libcruft/getpwuid.c b/mdk-stage1/dietlibc/libcruft/getpwuid.c deleted file mode 100644 index eef14e6e8..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwuid.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <pwd.h> -#include <string.h> -#include <stdlib.h> - -struct passwd *getpwuid(uid_t uid) { - struct passwd *tmp; - setpwent(); - for (;;) { - tmp=getpwent(); - if (!tmp) return 0; - if (tmp->pw_uid==uid) - return tmp; - } -} diff --git a/mdk-stage1/dietlibc/libcruft/getspnam.c b/mdk-stage1/dietlibc/libcruft/getspnam.c deleted file mode 100644 index e6573345d..000000000 --- a/mdk-stage1/dietlibc/libcruft/getspnam.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <shadow.h> -#include <string.h> -#include <stdlib.h> - -struct spwd *getspnam(const char * name) { - struct spwd *tmp; - setspent(); - for (;;) { - tmp=getspent(); - if (!tmp) return 0; - if (!strcmp(tmp->sp_namp,name)) - return tmp; - } -} diff --git a/mdk-stage1/dietlibc/libcruft/grent.c b/mdk-stage1/dietlibc/libcruft/grent.c deleted file mode 100644 index 0357657de..000000000 --- a/mdk-stage1/dietlibc/libcruft/grent.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * dietlibc/lib/grent.c - getgrent(3)/setgrent(3)/endgrent(3) implementation - * - * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com> - * - * This is a brand new implementation, based on the interface - * described in man-pages-1.34-1mdk man pages package. - */ - - -#include "entlib.h" /* this is our only include */ - -#define MAX_GROUP_MEMBERS 16 /* matches Linux kernel task struct */ - -static struct __ent_state *st = NULL; /* state held across calls */ -static char *gr_mem[MAX_GROUP_MEMBERS+1]; -static struct group gr; - -struct group *getgrent(void) -{ - char *parts[4], *grouplist; - unsigned int bufptr; - - if (__ent_start(_PATH_GROUP, &st)) - return NULL; - if (__ent_get_line(st)) - goto err_out; - if (__ent_split(st, parts, 4, ':', 1) < 0) - goto err_out; - - gr.gr_name = parts[0]; - gr.gr_passwd = parts[1]; - gr.gr_gid = (gid_t) atoi(parts[2]); - grouplist = parts[3]; - - memset(&gr_mem, 0, sizeof(gr_mem)); - gr.gr_mem = gr_mem; - - /* rewind bufptr to beginning of group list */ - bufptr = st->bufptr; - st->bufptr = (int) (grouplist - st->ent_buf); - - __ent_split(st, gr_mem, MAX_GROUP_MEMBERS, ',', 0); - st->bufptr = bufptr; - - return &gr; - -err_out: - st->buflen = st->bufptr = 0; /* invalidate file data buffer */ - return NULL; -} - -void setgrent(void) { __ent_set(st); } -void endgrent(void) { __ent_end(st); st=NULL; } diff --git a/mdk-stage1/dietlibc/libcruft/h_errno.c b/mdk-stage1/dietlibc/libcruft/h_errno.c deleted file mode 100644 index 73ead0469..000000000 --- a/mdk-stage1/dietlibc/libcruft/h_errno.c +++ /dev/null @@ -1 +0,0 @@ -int h_errno; diff --git a/mdk-stage1/dietlibc/libcruft/herrno_location.c b/mdk-stage1/dietlibc/libcruft/herrno_location.c deleted file mode 100644 index 203f73d4b..000000000 --- a/mdk-stage1/dietlibc/libcruft/herrno_location.c +++ /dev/null @@ -1,5 +0,0 @@ -extern int h_errno; - -int *__h_errno_location() { return &h_errno; } - -int *h_errno_location() __attribute__((weak,alias("__h_errno_location"))); diff --git a/mdk-stage1/dietlibc/libcruft/inet_addr.c b/mdk-stage1/dietlibc/libcruft/inet_addr.c deleted file mode 100644 index 0b8531ab1..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_addr.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -unsigned long int inet_addr(const char *cp) { - struct in_addr foo; - if (inet_aton(cp,&foo)) - return foo.s_addr; - else - return (unsigned long int)-1; -} diff --git a/mdk-stage1/dietlibc/libcruft/inet_aton.c b/mdk-stage1/dietlibc/libcruft/inet_aton.c deleted file mode 100644 index ac7d9d007..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_aton.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <stdlib.h> - -/* inet_aton() converts the Internet host address cp from the standard - * numbers-and-dots notation into binary data and stores it in the - * structure that inp points to. inet_aton returns nonzero if the - * address is valid, zero if not. */ - -/* problem is, inet_aton is historically quite, uh, lenient. - * the following are all acceptable: - * 0x7f000001 == 127.1 == 127.0.0.1.0 == 127.0.0.1 - * btw: 127.0.0.x.y == 127.0.0.(x|y) - * and: 10.1.1 == 10.1.0.1 (huh?!) - * and: 10 == 0.0.0.10 (?!?!?) - * The Berkeley people must have been so stoned that they are still high. - */ - -/* I hereby disclaim that I wrote this code. */ -int inet_aton(const char *cp, struct in_addr *inp) { - int i; - unsigned int ip=0; - char *tmp=(char*)cp; - for (i=24; ;) { - long j; - j=strtol(tmp,&tmp,0); - if (*tmp==0) { - ip|=j; - break; - } - if (*tmp=='.') { - if (j>255) return 0; - ip|=(j<<i); - if (i>0) i-=8; - ++tmp; - continue; - } - return 0; - } - inp->s_addr=htonl(ip); - return 1; -} diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c b/mdk-stage1/dietlibc/libcruft/inet_ntoa.c deleted file mode 100644 index f8c975f7a..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -extern char *inet_ntoa_r(struct in_addr in,char* buf); - -char *inet_ntoa(struct in_addr in) { - static char buf[20]; - return inet_ntoa_r(in,buf); -} diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c b/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c deleted file mode 100644 index dcf0eab7b..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c +++ /dev/null @@ -1,22 +0,0 @@ -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -static unsigned int i2a(char* dest,unsigned int x) { - register unsigned int tmp=x; - register unsigned int len=0; - if (x>=100) { *dest++=tmp/100+'0'; tmp=tmp%100; ++len; } - if (x>=10) { *dest++=tmp/10+'0'; tmp=tmp%10; ++len; } - *dest++=tmp+'0'; - return len+1; -} - -char *inet_ntoa_r(struct in_addr in,char* buf) { - unsigned int len; - unsigned char *ip=(unsigned char*)∈ - len=i2a(buf,ip[0]); buf[len]='.'; ++len; - len+=i2a(buf+ len,ip[1]); buf[len]='.'; ++len; - len+=i2a(buf+ len,ip[2]); buf[len]='.'; ++len; - len+=i2a(buf+ len,ip[3]); buf[len]=0; - return buf; -} diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntop.c b/mdk-stage1/dietlibc/libcruft/inet_ntop.c deleted file mode 100644 index 77c47f239..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_ntop.c +++ /dev/null @@ -1,75 +0,0 @@ -#include <arpa/inet.h> - -extern char *inet_ntoa_r(struct in_addr in,char* buf); - -static const unsigned char V4mappedprefix[12]={0,0,0,0,0,0,0,0,0,0,0xff,0xff}; - -static char tohex(char hexdigit) { - return hexdigit>9?hexdigit+'a'-10:hexdigit+'0'; -} - -static int fmt_xlong(char* s,unsigned int i) { - char* bak=s; - *s=tohex((i>>12)&0xf); if (s!=bak || *s!='0') ++s; - *s=tohex((i>>8)&0xf); if (s!=bak || *s!='0') ++s; - *s=tohex((i>>4)&0xf); if (s!=bak || *s!='0') ++s; - *s=tohex(i&0xf); - return s-bak+1; -} - -unsigned int fmt_ip6(char *s,const char ip[16]) -{ - unsigned int len; - unsigned int i; - unsigned int temp; - unsigned int compressing; - int j; - - len = 0; compressing = 0; - for (j=0; j<16; j+=2) { - if (j==12 && !memcmp(ip,V4mappedprefix,12)) { - inet_ntoa_r(*(struct in_addr*)(ip+12),s); - temp=strlen(s); - return len+temp; - } - temp = ((unsigned long) (unsigned char) ip[j] << 8) + - (unsigned long) (unsigned char) ip[j+1]; - if (temp == 0) { - if (!compressing) { - compressing=1; - if (j==0) { - *s++=':'; ++len; - } - } - } else { - if (compressing) { - compressing=0; - *s++=':'; ++len; - } - i = fmt_xlong(s,temp); len += i; s += i; - if (j<14) { - *s++ = ':'; - ++len; - } - } - } - *s=0; - return len; -} - -const char* inet_ntop(int AF, const void *CP, char *BUF, size_t LEN) { - char buf[100]; - int len; - if (AF==AF_INET) { - inet_ntoa_r(*(struct in_addr*)CP,buf); - len=strlen(buf); - } else if (AF==AF_INET6) { - len=fmt_ip6(buf,CP); - } else - return 0; - if (len<LEN) { - strcpy(BUF,buf); - return BUF; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/libcruft/inet_pton.c b/mdk-stage1/dietlibc/libcruft/inet_pton.c deleted file mode 100644 index d5c17509c..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_pton.c +++ /dev/null @@ -1,97 +0,0 @@ -#include <stdlib.h> -#include <arpa/inet.h> -#include <errno.h> - -static unsigned int scan_ip6(const char *s,char ip[16]) -{ - unsigned int i; - unsigned int len=0; - unsigned long u; - - char suffix[16]; - int prefixlen=0; - int suffixlen=0; - - for (i=0; i<16; i++) ip[i]=0; - - for (;;) { - if (*s == ':') { - len++; - if (s[1] == ':') { /* Found "::", skip to part 2 */ - s+=2; - len++; - break; - } - s++; - } - { - char *tmp; - u=strtol(s,&tmp,16); - i=tmp-s; - } - - if (!i) return 0; - if (prefixlen==12 && s[i]=='.') { - /* the last 4 bytes may be written as IPv4 address */ - if (inet_aton(s,(struct in_addr*)(ip+12))) - return i+len; - else - return 0; - } - ip[prefixlen++] = (u >> 8); - ip[prefixlen++] = (u & 255); - s += i; len += i; - if (prefixlen==16) - return len; - } - -/* part 2, after "::" */ - for (;;) { - if (*s == ':') { - if (suffixlen==0) - break; - s++; - len++; - } else if (suffixlen!=0) - break; - { - char *tmp; - u=strtol(s,&tmp,16); - i=tmp-s; - } - if (!i) { - len--; - break; - } - if (suffixlen+prefixlen<=12 && s[i]=='.') { - if (inet_aton(s,(struct in_addr*)(suffix+suffixlen))) { - suffixlen+=4; - len+=strlen(s); - break; - } else - prefixlen=12-suffixlen; /* make end-of-loop test true */ - } - suffix[suffixlen++] = (u >> 8); - suffix[suffixlen++] = (u & 255); - s += i; len += i; - if (prefixlen+suffixlen==16) - break; - } - for (i=0; i<suffixlen; i++) - ip[16-suffixlen+i] = suffix[i]; - return len; -} - -int inet_pton(int AF, const char *CP, void *BUF) { - if (AF==AF_INET) { - if (!inet_aton(CP,(struct in_addr*)BUF)) - return 0; - } else if (AF==AF_INET6) { - if (CP[scan_ip6(CP,BUF)]) - return 0; - } else { - errno=EAFNOSUPPORT; - return -1; - } - return 1; -} diff --git a/mdk-stage1/dietlibc/libcruft/initgroups.c b/mdk-stage1/dietlibc/libcruft/initgroups.c deleted file mode 100644 index 7d24866e9..000000000 --- a/mdk-stage1/dietlibc/libcruft/initgroups.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <grp.h> -#include <sys/types.h> -#include <string.h> - -int initgroups(const char *user, gid_t group) { - int n=0; - gid_t grouplist[32]; - struct group *g; - setgrent(); - while ((g=getgrent())) { - char **duh=g->gr_mem; - while (*duh) { - if (!strcmp(*duh,user)) { - grouplist[n]=g->gr_gid; - if (++n>=32) - break; - } - duh++; - } - } - return setgroups(n,grouplist); -} - diff --git a/mdk-stage1/dietlibc/libcruft/mkstemp.c b/mdk-stage1/dietlibc/libcruft/mkstemp.c deleted file mode 100644 index 3b24ecb54..000000000 --- a/mdk-stage1/dietlibc/libcruft/mkstemp.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <errno.h> - -int mkstemp(char* template) { - char *tmp=template+strlen(template)-6; - int randfd; - int i,res; - unsigned int random; - for (i=0; i<6; ++i) if (tmp[i]!='X') { __set_errno(EINVAL); return -1; } - randfd=open("/dev/urandom",O_RDONLY); - for (;;) { - read(randfd,&random,sizeof(random)); - for (i=0; i<6; ++i) { - int hexdigit=(random>>(i*5))&0x1f; - tmp[i]=hexdigit>9?hexdigit+'a'-10:hexdigit+'0'; - } - res=open(template,O_CREAT|O_RDWR|O_EXCL,0600); - if (res>=0) return res; - } - close(randfd); -} diff --git a/mdk-stage1/dietlibc/libcruft/pwent.c b/mdk-stage1/dietlibc/libcruft/pwent.c deleted file mode 100644 index 30a8a0957..000000000 --- a/mdk-stage1/dietlibc/libcruft/pwent.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * dietlibc/lib/pwent.c - getpwent(3)/setpwent(3)/endpwent(3) implementation - * - * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com> - * - * This is a brand new implementation, based on the interface - * described in man-pages-1.34-1mdk man pages package. - */ - - -#include "entlib.h" /* this is our only include */ - -static struct __ent_state *st = NULL; /* state held across calls */ -static struct passwd pw; - -struct passwd *getpwent(void) -{ - char *parts[7]; - - if (__ent_start(_PATH_PASSWD, &st)) - return NULL; - if (__ent_get_line(st)) - goto err_out; - if (__ent_split(st, parts, 7, ':', 1) < 0) - goto err_out; - - pw.pw_name = parts[0]; - pw.pw_passwd = parts[1]; - pw.pw_uid = (uid_t) atoi(parts[2]); - pw.pw_gid = (gid_t) atoi(parts[3]); - pw.pw_gecos = parts[4]; - pw.pw_dir = parts[5]; - pw.pw_shell = parts[6]; - - return &pw; - -err_out: - st->buflen = st->bufptr = 0; /* invalidate file data buffer */ - return NULL; -} - -void setpwent(void) { __ent_set(st); } -void endpwent(void) { __ent_end(st); st=NULL; } diff --git a/mdk-stage1/dietlibc/libcruft/res_init.c b/mdk-stage1/dietlibc/libcruft/res_init.c deleted file mode 100644 index 9322af298..000000000 --- a/mdk-stage1/dietlibc/libcruft/res_init.c +++ /dev/null @@ -1,7 +0,0 @@ -extern int __dns_servers; -extern void __dns_readstartfiles(void); - -int res_init(void) { - __dns_servers=0; - __dns_readstartfiles(); -} diff --git a/mdk-stage1/dietlibc/libcruft/spent.c b/mdk-stage1/dietlibc/libcruft/spent.c deleted file mode 100644 index e4beb81e4..000000000 --- a/mdk-stage1/dietlibc/libcruft/spent.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * dietlibc/lib/spent.c - getspent(3)/setspent(3)/endspent(3) implementation - * - * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com> - * - * This is a brand new implementation, based on the interface - * described in man-pages-1.34-1mdk man pages package. - */ - - -#include "entlib.h" /* this is our only include */ - -static struct __ent_state *st = NULL; /* state held across calls */ -static struct spwd sp; - -struct spwd *getspent(void) -{ - char *parts[9]; - - if (__ent_start(_PATH_SHADOW, &st)) - return NULL; - if (__ent_get_line(st)) - goto err_out; - if (__ent_split(st, parts, 9, ':', 1) < 0) - goto err_out; - - sp.sp_namp = parts[0]; - sp.sp_pwdp = parts[1]; - sp.sp_lstchg = atoi(parts[2]); /* XXX: atol */ - sp.sp_min = atoi(parts[3]); - sp.sp_max = atoi(parts[4]); - sp.sp_warn = atoi(parts[5]); - sp.sp_inact = atoi(parts[6]); - sp.sp_expire = atoi(parts[7]); - sp.sp_flag = atoi(parts[8]); - - return &sp; - -err_out: - st->buflen = st->bufptr = 0; /* invalidate file data buffer */ - return NULL; -} - -void setspent(void) { __ent_set(st); } -void endspent(void) { __ent_end(st); st=NULL; } diff --git a/mdk-stage1/dietlibc/libcrypt/crypt.c b/mdk-stage1/dietlibc/libcrypt/crypt.c deleted file mode 100644 index 933397f5f..000000000 --- a/mdk-stage1/dietlibc/libcrypt/crypt.c +++ /dev/null @@ -1,309 +0,0 @@ -#include "dietfeatures.h" -#include <unistd.h> - -/* Initial permutation, */ -static char IP[] = { - 57,49,41,33,25,17, 9, 1, - 59,51,43,35,27,19,11, 3, - 61,53,45,37,29,21,13, 5, - 63,55,47,39,31,23,15, 7, - 56,48,40,32,24,16, 8, 0, - 58,50,42,34,26,18,10, 2, - 60,52,44,36,28,20,12, 4, - 62,54,46,38,30,22,14, 6 -}; - -/* Final permutation, FP = IP^(-1) */ -static char FP[] = { - 39, 7,47,15,55,23,63,31, - 38, 6,46,14,54,22,62,30, - 37, 5,45,13,53,21,61,29, - 36, 4,44,12,52,20,60,28, - 35, 3,43,11,51,19,59,27, - 34, 2,42,10,50,18,58,26, - 33, 1,41, 9,49,17,57,25, - 32, 0,40, 8,48,16,56,24 -}; - -/* Permuted-choice 1 from the key bits to yield C and D. - * Note that bits 8,16... are left out: They are intended for a parity check. - */ -static char PC1_C[] = { - 56,48,40,32,24,16, 8, - 0,57,49,41,33,25,17, - 9, 1,58,50,42,34,26, - 18,10, 2,59,51,43,35 -}; - -static char PC1_D[] = { - 62,54,46,38,30,22,14, - 6,61,53,45,37,29,21, - 13, 5,60,52,44,36,28, - 20,12, 4,27,19,11, 3 -}; - -/* Sequence of shifts used for the key schedule. */ -static char shifts[] = { 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1 }; - -/* - * Permuted-choice 2, to pick out the bits from the CD array that generate - * the key schedule. - */ -static char PC2_C[] = { - 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, - 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1 -}; - -static char PC2_D[] = { - 12, 23, 2, 8, 18, 26, 1, 11, 22, 16, 4, 19, - 15, 20, 10, 27, 5, 24, 17, 13, 21, 7, 0, 3 -}; - -/* The C and D arrays used to calculate the key schedule. */ - -static char C[28]; -static char D[28]; -/* The key schedule. Generated from the key. */ -static char KS[16][48]; - -/* The E bit-selection table. */ -static char E[48]; -static char e2[] = { - 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, - 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, - 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, - 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 -}; - -/* Set up the key schedule from the key. */ -void setkey(const char *key) -{ - register int i, j, k; - int t; - int s; - - /* First, generate C and D by permuting the key. The low order bit of each - * 8-bit char is not used, so C and D are only 28 bits apiece. - */ - for(i=0; i < 28; i++) { - C[i] = key[(int)PC1_C[i]]; - D[i] = key[(int)PC1_D[i]]; - } - /* To generate Ki, rotate C and D according to schedule and pick up a - * permutation using PC2. - */ - for(i=0; i < 16; i++) { - /* rotate. */ - s = shifts[i]; - for(k=0; k < s; k++) { - t = C[0]; - for(j=0; j < 27; j++) - C[j] = C[j+1]; - C[27] = t; - t = D[0]; - for(j=0; j < 27; j++) - D[j] = D[j+1]; - D[27] = t; - } - /* get Ki. Note C and D are concatenated. */ - for(j=0; j < 24; j++) { - KS[i][j] = C[(int)PC2_C[j]]; - KS[i][j+24] = D[(int)PC2_D[j]]; - } - } - - for(i=0; i < 48; i++) - E[i] = e2[i]; -} - -/* The 8 selection functions. For some reason, they give a 0-origin index, - * unlike everything else. - */ -static char S[8][64] = { - { - 14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7, - 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8, - 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0, - 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13 - }, - - { - 15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10, - 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5, - 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15, - 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9 - }, - - { - 10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8, - 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1, - 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7, - 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12 - }, - - { - 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15, - 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9, - 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4, - 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14 - }, - - { - 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9, - 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6, - 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14, - 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3 - }, - - { - 12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11, - 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8, - 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6, - 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13 - }, - - { - 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1, - 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6, - 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2, - 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12 - }, - - { - 13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7, - 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2, - 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8, - 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11 - } -}; - -/* P is a permutation on the selected combination of the current L and key. */ -static char P[] = { - 15, 6,19,20, 28,11,27,16, 0,14,22,25, 4,17,30, 9, - 1, 7,23,13, 31,26, 2, 8, 18,12,29, 5, 21,10, 3,24 -}; - -/* The current block, divided into 2 halves. */ -static char L[32], R[32]; -static char tempL[32]; -static char f[32]; - -/* The combination of the key and the input, before selection. */ -static char preS[48]; - -/* The payoff: encrypt a block. */ -void encrypt(char block[64], int edflag) -{ - int i, ii; - register int t, j, k; - - /* First, permute the bits in the input */ - for(j=0; j < 64; j++) - L[j] = block[(int)IP[j]]; - /* Perform an encryption operation 16 times. */ - for(ii=0; ii < 16; ii++) { - i = ii; - /* Save the R array, which will be the new L. */ - for(j=0; j < 32; j++) - tempL[j] = R[j]; - /* Expand R to 48 bits using the E selector; - * exclusive-or with the current key bits. - */ - for(j=0; j < 48; j++) - preS[j] = R[E[j]-1] ^ KS[i][j]; - /* The pre-select bits are now considered in 8 groups of 6 bits each. - * The 8 selection functions map these 6-bit quantities into 4-bit - * quantities and the results permuted to make an f(R, K). - * The indexing into the selection functions is peculiar; - * it could be simplified by rewriting the tables. - */ - for(j=0; j < 8; j++) { - t = ((j<<1)+j)<<1; - k = S[j][(preS[t]<<5)+ - (preS[t+1]<<3)+ - (preS[t+2]<<2)+ - (preS[t+3]<<1)+ - (preS[t+4] )+ - (preS[t+5]<<4)]; - t = j << 2; - f[t ] = (k>>3)&01; - f[t+1] = (k>>2)&01; - f[t+2] = (k>>1)&01; - f[t+3] = (k )&01; - } - /* The new R is L ^ f(R, K). The f here has to be permuted first, though. */ - for(j=0; j < 32; j++) - R[j] = L[j] ^ f[(int)P[j]]; - /* Finally, the new L (the original R) is copied back. */ - for(j=0; j < 32; j++) - L[j] = tempL[j]; - } - /* The output L and R are reversed. */ - for(j=0; j < 32; j++) { - L[j] ^= R[j]; - R[j] ^= L[j]; - L[j] ^= R[j]; - } - /* The final output gets the inverse permutation of the very original. */ - for(j=0; j < 64; j++) - block[j] = L[(int)FP[j]]; -} - -char * crypt(const char *pw, const char *salt) -{ - register int i, j, c; - static char block[66], iobuf[16]; - - for(i=0; i < 66; i++) - block[i] = 0; - for(i=0; (c= *pw) && i < 64; pw++) { - for(j=0; j < 7; j++, i++) - block[i] = (c>>(6-j)) & 01; - i++; - } - - setkey(block); - - for(i=0; i < 66; i++) - block[i] = 0; - - for(i=0; i < 2; i++) { - c = *salt++; - iobuf[i] = c; - if(c > 'Z') - c -= 6; - if(c > '9') - c -= 7; - c -= '.'; - for(j=0; j < 6; j++) { - if((c>>j) & 01) { - int ind1 = (((i<<1)+i)<< 1) + j; - int ind2 = ind1 + 24; - E[ind1] ^= E[ind2]; - E[ind2] ^= E[ind1]; - E[ind1] ^= E[ind2]; - } - } - } - - for(i=0; i < 25; i++) - encrypt(block, 0); - - for(i=0; i < 11; i++) { - c = 0; - for(j=0; j < 6; j++) { - c <<= 1; - c |= block[(((i<<1)+i)<<1)+j]; - } - c += '.'; - if(c > '9') - c += 7; - if(c > 'Z') - c += 6; - iobuf[i+2] = c; - } - iobuf[i+2] = 0; - if(iobuf[1] == 0) - iobuf[1] = iobuf[0]; - return(iobuf); -} diff --git a/mdk-stage1/dietlibc/libdl/Makefile b/mdk-stage1/dietlibc/libdl/Makefile deleted file mode 100644 index c0463f887..000000000 --- a/mdk-stage1/dietlibc/libdl/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# local "test" make file - -SRC = $(wildcard *.c) test/test.c -OBJ = _dl_jump.o $(SRC:.c=.o) - -#CFLAGS = -Wall -O2 -CFLAGS = -g - -%.o : %.S - $(HOME)/bin/diet gcc $(CFLAGS) -c -o $@ $^ - -%.o : %.c - $(HOME)/bin/diet gcc $(CFLAGS) -c -o $@ $^ - -all: test.out - -test.g: test.c - gcc -o $@ $^ -ldl - -test.out: $(OBJ) - $(HOME)/bin/diet gcc -o $@ $^ - -clean: - $(RM) *.o *.a *.out *~ # *.so diff --git a/mdk-stage1/dietlibc/libdl/README b/mdk-stage1/dietlibc/libdl/README deleted file mode 100644 index 5d77bde34..000000000 --- a/mdk-stage1/dietlibc/libdl/README +++ /dev/null @@ -1,6 +0,0 @@ -this is the experimental libdl test-pre-pre-alpha code - -written by Olaf Dreesen - -Shouldn't work yet had some problems with the elf specs... -and more inconsistencies... diff --git a/mdk-stage1/dietlibc/libdl/_dl_int.h b/mdk-stage1/dietlibc/libdl/_dl_int.h deleted file mode 100644 index 659e6ee0f..000000000 --- a/mdk-stage1/dietlibc/libdl/_dl_int.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef ___DL_INT_H__ -#define ___DL_INT_H__ - -#include <elf.h> - -struct _dl_handle { - /* basic */ - void * mem_base; /* base address of maped *.so */ - unsigned long mem_size; /* len of mem block */ - unsigned int lnk_count; /* reference count */ - - /* symbol resolve helper */ - unsigned long*hash_tab; /* hash table */ - Elf32_Sym * dyn_sym_tab; /* dynamic symbol table */ - char * dyn_str_tab; /* dyn_name table */ - - Elf32_Rel * plt_rel; /* PLT relocation table */ - - /* FINI */ - void (*fini)(void); -}; - -#define HASH_BUCKET_LEN(p) ((p)) -#define HASH_BUCKET(p) ((p)+2) - -#define HASH_CHAIN_LEN(p) ((p)+1) -#define HASH_CHAIN(p) ((p)+2+HASH_BUCKET_LEN(p)) - -unsigned long elf_hash(const unsigned char *name); - -#endif diff --git a/mdk-stage1/dietlibc/libdl/_dl_jump.S b/mdk-stage1/dietlibc/libdl/_dl_jump.S deleted file mode 100644 index 134f31ea5..000000000 --- a/mdk-stage1/dietlibc/libdl/_dl_jump.S +++ /dev/null @@ -1,8 +0,0 @@ -.text -.global _dl_jump -_dl_jump: - call do_rel - pop %edx - pop %edx - jmp *%eax - diff --git a/mdk-stage1/dietlibc/libdl/_dl_open.c b/mdk-stage1/dietlibc/libdl/_dl_open.c deleted file mode 100644 index 1f907db21..000000000 --- a/mdk-stage1/dietlibc/libdl/_dl_open.c +++ /dev/null @@ -1,207 +0,0 @@ -#include <stdio.h> -#include <unistd.h> -#include <sys/mman.h> -#include <dlfcn.h> -#include <linux/elf.h> - -#include "_dl_int.h" - -struct _dl_handle dl_test; - -#define _ELF_DWN_ROUND(ps,n) ((n)&(~((ps)-1))) -#define _ELF_UP_ROUND(ps,n) ((((n)&((ps)-1))?(ps):0)+ _ELF_DWN_ROUND((ps),(n))) -#define _ELF_RST_ROUND(ps,n) ((n)&((ps)-1)) - -void _dl_jump(); - -/* - * this file is a Q. & D. hack ... don't think this is bug free or meaningfull - */ - -static void *do_map_in(void *base, unsigned long length, int flags, int fd, unsigned long offset) -{ - int perm = 0; - if (flags & PF_X) perm|=PROT_EXEC; - if (flags & PF_R) perm|=PROT_READ; - if (flags & PF_W) perm|=PROT_WRITE; - return mmap(base, length, perm, MAP_PRIVATE|((base)?MAP_FIXED:0), fd, offset); -} - -unsigned long do_rel(struct _dl_handle * tmp_dl, unsigned long off) -{ -// struct _dl_handle * tmp_dl = ((void*)*((&off)-1)); - Elf32_Rel *tmp = ((void*)tmp_dl->plt_rel)+off; - int sym=ELF32_R_SYM(tmp->r_info); - register unsigned long sym_val; - - printf("do_rel %08x %08x\n",tmp_dl,off); - - printf ("do_rel %08x+%x\n",tmp_dl->plt_rel,off); - printf("do_rel @ %08x with type %d -> %d\n",tmp->r_offset,ELF32_R_TYPE(tmp->r_info),sym); - - printf("do_rel sym %08x\n",tmp_dl->dyn_sym_tab[sym].st_value); - - /* modify GOT for REAL symbol */ - sym_val=((unsigned long)(tmp_dl->mem_base+tmp_dl->dyn_sym_tab[sym].st_value)); - *((unsigned long*)(tmp_dl->mem_base+tmp->r_offset))=sym_val; - - printf("do_rel sym %08x\n",sym_val); - /* HOWTO JUMP ?!? */ - return sym_val; -} - -void *_dl_open(const char*pathname, int fd, int flag) -{ - int ps=getpagesize(); - int i; - unsigned char buf[1024]; - char *m=0,*d; - struct _dl_handle *ret=0; - - unsigned long l; - - Elf32_Ehdr *eh; - Elf32_Phdr *ph; - - int ld_nr=0; - Elf32_Phdr *ld[4]={0,0,0,0}; - Elf32_Phdr *dyn=0; - - if (fd==-1) return 0; - - printf("_dl_open: %s\n",pathname); - - read(fd, buf, 1024); - eh=(Elf32_Ehdr*)buf; - ph=(Elf32_Phdr*)&buf[eh->e_phoff]; - - for (i=0; i<eh->e_phnum; i++) { - if (ph[i].p_type==PT_LOAD) { - ld[ld_nr++]=ph+i; - } - if (ph[i].p_type==PT_DYNAMIC) { - dyn=ph+i; - } - } - - if (ld_nr==1) { - unsigned long offset = _ELF_DWN_ROUND(ps,ld[0]->p_offset); - unsigned long off = _ELF_RST_ROUND(ps,ld[0]->p_offset); - unsigned long length = _ELF_UP_ROUND(ps,ld[0]->p_memsz+off); - m = (char*)do_map_in(0, length, ld[0]->p_flags, fd, offset); - - /* zero pad bss */ - l = ld[0]->p_offset+ld[0]->p_filesz; - memset(m+l,0,length-l); - - dl_test.mem_base=m; - dl_test.mem_size=length; - dl_test.lnk_count=0; - - ret = &dl_test; - } - else if (ld_nr==2) { /* aem... yes Quick & Really Dirty / for the avarage 99% */ - //unsigned long text_addr = _ELF_DWN_ROUND(ps,ld[0]->p_vaddr); - unsigned long text_offset = _ELF_DWN_ROUND(ps,ld[0]->p_offset); - unsigned long text_off = _ELF_RST_ROUND(ps,ld[0]->p_offset); - unsigned long text_size = _ELF_UP_ROUND(ps,ld[0]->p_memsz+text_off); - - unsigned long data_addr = _ELF_DWN_ROUND(ps,ld[1]->p_vaddr); - unsigned long data_offset = _ELF_DWN_ROUND(ps,ld[1]->p_offset); - unsigned long data_off = _ELF_RST_ROUND(ps,ld[1]->p_offset); - unsigned long data_size = _ELF_UP_ROUND(ps,ld[1]->p_memsz+data_off); - unsigned long data_fsize = _ELF_UP_ROUND(ps,ld[1]->p_filesz+data_off); - - /* mmap all mem_blocks for *.so */ - l = text_size+data_size; - - dl_test.mem_size=l; - - m = (char*) do_map_in(0,l,ld[0]->p_flags,fd,text_offset); - - /* release data,bss part */ - mprotect(m+data_addr, data_size, PROT_NONE); - - /* mmap data,bss part */ - d = (char*) do_map_in(m+data_addr,data_fsize,ld[1]->p_flags,fd,data_offset); - - /* zero pad bss */ - l = data_off+ld[1]->p_filesz; - memset(d+l,0,data_size-l); - - /* more bss ? */ - if (data_size>data_fsize) { - l = data_size-data_fsize; - mmap(d+data_fsize, l, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0); - } - - dl_test.mem_base=m; - dl_test.lnk_count=0; - ret = &dl_test; - } - - printf("_dl_open pre resolv\n"); - if (ret) { - Elf32_Dyn* dyn_tab = (void*)m+dyn->p_vaddr; - void (*init)(); - unsigned long* got=0; - void* jmprel=0; - int pltreltype=0; - int pltrelsize=0; - - printf("_dl_open IN resolv\n"); - for(i=0;dyn_tab[i].d_tag;i++) { - if (dyn_tab[i].d_tag==DT_HASH) { - ret->hash_tab = (unsigned long*)(m+dyn_tab[i].d_un.d_ptr); - } - if (dyn_tab[i].d_tag==DT_SYMTAB) { - ret->dyn_sym_tab = (Elf32_Sym*)(m+dyn_tab[i].d_un.d_ptr); - } - if (dyn_tab[i].d_tag==DT_STRTAB) { - ret->dyn_str_tab = (char*)(m+dyn_tab[i].d_un.d_ptr); - } - if (dyn_tab[i].d_tag==DT_FINI) { - ret->fini = (void(*)(void))(m+dyn_tab[i].d_un.d_val); - } - if (dyn_tab[i].d_tag==DT_INIT) { - init = (void(*)(void))(m+dyn_tab[i].d_un.d_val); - printf("init @ %08x\n",init); - } - if (dyn_tab[i].d_tag==DT_PLTGOT) { - got=(unsigned long*)(m+dyn_tab[i].d_un.d_val); - } - if (dyn_tab[i].d_tag==DT_PLTREL) { - pltreltype=dyn_tab[i].d_un.d_val; - } - if (dyn_tab[i].d_tag==DT_PLTRELSZ) { - pltrelsize=dyn_tab[i].d_un.d_val; - } - if (dyn_tab[i].d_tag==DT_JMPREL) { - jmprel=(m+dyn_tab[i].d_un.d_val); - dl_test.plt_rel=jmprel; - } - } - /* GOT */ - got[0]+=(unsigned long)m; - got[1]=(unsigned long)&dl_test; -// got[2]=(unsigned long)do_rel; - got[2]=(unsigned long)(_dl_jump); - /* */ - - if (pltreltype == DT_REL) { - Elf32_Rel *tmp = jmprel; - for (;(char*)tmp<(((char*)jmprel)+pltrelsize);(char*)tmp=((char*)tmp)+sizeof(Elf32_Rel)) { - *((unsigned long*)(m+tmp->r_offset))+=(unsigned long)m; -// *((unsigned long*)(m+tmp->r_offset))+=(unsigned long)do_rel; - printf("rel @ %08x with type %d -> %d\n",tmp->r_offset,ELF32_R_TYPE(tmp->r_info),ELF32_R_SYM(tmp->r_info)); - } - } - - printf("_dl_open post resolv, pre init\n"); - init(); - } - printf("_dl_open post resolv, init\n"); - - close(fd); - return ret; -} diff --git a/mdk-stage1/dietlibc/libdl/_dl_search.c b/mdk-stage1/dietlibc/libdl/_dl_search.c deleted file mode 100644 index 5e3217d46..000000000 --- a/mdk-stage1/dietlibc/libdl/_dl_search.c +++ /dev/null @@ -1,84 +0,0 @@ -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <dlfcn.h> - -#include <fcntl.h> -#include <stdio.h> - -#define WANT_LD_SO_CONF_SEARCH - -static const char *_dl_search_rpath=0; -void _dl_set_rpath(const char *path) { _dl_search_rpath=path; } - -/* search a colon (semicolon) seperated path for the libraray "filename" */ -static int _dl_search_path(char *buf, int len, const char*path, const int pathlen, const char *filename) -{ - int fd,l=len,i=1; - const char *c,*pe=path+pathlen; - - if (path) { - for (c=path; c<pe; c+=i) { - if ((*c==':')||(*c==';')) ++c; - i=strcspn(c,":;"); - if (i) { - strncpy(buf, c, i); buf[i]=0; - l-=i; - strncat(buf, "/", l); - } - else - buf[0]=0; - strncat(buf, filename, --l); -// printf("_dl_search: %s\n",buf); - if ((fd=open(buf,O_RDONLY))!=-1) return fd; - } - } - return -1; -} - -/* parse the SMALL file "conf" for lib directories (aem... hang me if you can :) ) */ -static int _dl_search_conf(char *buf, int len, const char *conf, const char *filename) -{ - char ld_so_conf[1024]; - int i,l,fd=open(conf,O_RDONLY); - if (fd!=-1) { - l=read(fd,ld_so_conf,sizeof(ld_so_conf)-1); - ld_so_conf[sizeof(ld_so_conf)-1]=0; - close(fd); - if (ld_so_conf[l-1]=='\n') ld_so_conf[--l]=0; - for (i=0;i<l;i++) if (ld_so_conf[i]=='\n') ld_so_conf[i]=':'; - if ((fd=_dl_search_path(buf,len,ld_so_conf,l,filename))!=-1) return fd; - } - return -1; -} - -int _dl_search(char *buf, int len, const char *filename) -{ - int fd; - - /* 1. search the LD_RUN_PATH (from the executable */ - if (_dl_search_rpath) { - if ((fd=_dl_search_path(buf,len,_dl_search_rpath,strlen(_dl_search_rpath),filename))!=-1) return fd; - } - - /* 2. IF we have a "secure" enviroment THEN search LD_LIBRARY_PATH */ - if (getuid()==geteuid()) { - char *p=getenv("LD_LIBRARY_PATH"); - if (p) - if ((fd=_dl_search_path(buf,len,p,strlen(p),filename))!=-1) return fd; - } - - /* 3. search all pathes in the the /etc/diet.ld.conf, a dietlibc extension :) */ - if ((fd=_dl_search_conf(buf,len,"/etc/diet.ld.conf",filename))!=-1) return fd; - -#ifdef WANT_LD_SO_CONF_SEARCH - /* 4. search all pathes in the the /etc/ld.so.conf / can't handle this ...=lib?? crap */ - if ((fd=_dl_search_conf(buf,len,"/etc/ld.so.conf",filename))!=-1) return fd; -#endif - - /* default path search */ - { - const char* def_path="/usr/lib:/lib"; - return _dl_search_path(buf,len,def_path,strlen(def_path),filename); - } -} diff --git a/mdk-stage1/dietlibc/libdl/dlclose.c b/mdk-stage1/dietlibc/libdl/dlclose.c deleted file mode 100644 index 384550c47..000000000 --- a/mdk-stage1/dietlibc/libdl/dlclose.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "_dl_int.h" - -int dlclose (void *handle) -{ - if (handle) { - struct _dl_handle *h = handle; - if (h->lnk_count) { - --h->lnk_count; - return -1; - } - if (munmap(h->mem_base,h->mem_size)!=0) return -1; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/libdl/dlerror.c b/mdk-stage1/dietlibc/libdl/dlerror.c deleted file mode 100644 index 1e31bae54..000000000 --- a/mdk-stage1/dietlibc/libdl/dlerror.c +++ /dev/null @@ -1,4 +0,0 @@ -const char *dlerror(void) -{ - return "HAE ?!?"; -} diff --git a/mdk-stage1/dietlibc/libdl/dlopen.c b/mdk-stage1/dietlibc/libdl/dlopen.c deleted file mode 100644 index 1693d889f..000000000 --- a/mdk-stage1/dietlibc/libdl/dlopen.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <fcntl.h> -#include <dlfcn.h> -#include <limits.h> - -int _dl_search(char*buf, int bufsize, const char*filename); -void *_dl_open(const char*pathname, int fd, int flag); - -void *dlopen (const char *filename, int flag) -{ - int fd; - char buf[PATH_MAX]; - const char *p; - if (*filename=='/') - fd=open(p=filename,O_RDONLY); - else { - p=buf; - fd=_dl_search(buf,sizeof(buf),filename); - } - - return _dl_open(p,fd,flag); -} diff --git a/mdk-stage1/dietlibc/libdl/dlsym.c b/mdk-stage1/dietlibc/libdl/dlsym.c deleted file mode 100644 index 2af940837..000000000 --- a/mdk-stage1/dietlibc/libdl/dlsym.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "_dl_int.h" - -void *dlsym(void *handle, char *symbol) -{ - printf("dlsym(%08x,%s) -> %08x\n",handle,symbol,elf_hash(symbol)%17); - return 0; -} diff --git a/mdk-stage1/dietlibc/libdl/elf_hash.c b/mdk-stage1/dietlibc/libdl/elf_hash.c deleted file mode 100644 index 463dba0dd..000000000 --- a/mdk-stage1/dietlibc/libdl/elf_hash.c +++ /dev/null @@ -1,12 +0,0 @@ -unsigned long elf_hash(const unsigned char *name) -{ - unsigned long h=0, g; - - while (*name) - { - h = (h<<4) + *(name++); - if (g = h&0xf0000000) h ^= g>>24; - h &= ~g; - } - return h; -} diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c b/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c deleted file mode 100644 index b0c3605b0..000000000 --- a/mdk-stage1/dietlibc/liblatin1/latin1-iscntrl.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <ctype.h> - -int iscntrl(int c) { - return (c<32) || (c>=127 && c<=160); -} diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c b/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c deleted file mode 100644 index c8d4a5df0..000000000 --- a/mdk-stage1/dietlibc/liblatin1/latin1-isgraph.c +++ /dev/null @@ -1,4 +0,0 @@ -int isgraph(int c) { - return (c>=33 && c<=126) || (c>=161 && c<=255); -} - diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-islower.c b/mdk-stage1/dietlibc/liblatin1/latin1-islower.c deleted file mode 100644 index cab1a5171..000000000 --- a/mdk-stage1/dietlibc/liblatin1/latin1-islower.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <ctype.h> - -int islower(int c) { - return (c>='a' && c<='z') || (c>=223 && c<=255 && c!=247); -} diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c b/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c deleted file mode 100644 index f632483a0..000000000 --- a/mdk-stage1/dietlibc/liblatin1/latin1-isprint.c +++ /dev/null @@ -1,4 +0,0 @@ - -int isprint(int c) { - return (c>=32 && c<=126) || (c>=160 && c<=255); -} diff --git a/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c b/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c deleted file mode 100644 index 1c1d59db8..000000000 --- a/mdk-stage1/dietlibc/liblatin1/latin1-isupper.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <ctype.h> - -int isupper(int c) { - return (c>='A' && c<='Z') || (c>=192 && c<=222 && c!=215); -} diff --git a/mdk-stage1/dietlibc/libpthread/CHANGES b/mdk-stage1/dietlibc/libpthread/CHANGES deleted file mode 100644 index d39d990ba..000000000 --- a/mdk-stage1/dietlibc/libpthread/CHANGES +++ /dev/null @@ -1,45 +0,0 @@ -This is the pthread implementation of dietlibc. -Written from scratch by Olaf Dreesen. - -Thu Apr 12 16:47:12 MEST 2001 - - added conditional variables... - except pthread_cond_timedwait all should work man-page like - pthread_cond_timedwait dosen't handle cancel request according to man-page - - added thread specific key handling (all according to man-page) - -Fri Mar 30 18:47:37 MEST 2001 - - uff found some logic errors and fixed them. - pthread_create had a problem with user provided stacks. - - -Fri Mar 23 14:09:54 MET 2001 - - arg.. the kernel-header are so inconsistent... - on x86 it works on arm and sparc not due to MISSING defines, miss-places - includes and __KERNEL__ checks.... - the best in this category is that the kernel-header are changed that the - buggy (g)libc haven't to change... (f..k glibc, the headers HAVE to be - CONSISTENT) - a public defined symbol on arch X have to be in Y to unless marked... - that is mainly speaking SCHED.H ! arg.... - - -Wed Mar 14 04:28:45 MET 2001 - - I have implemented the "Manager Thread" so that nested thread creation - works. really ugly stuff... don't look at it unless you're sitting on solid - ground. - - -Mon Mar 12 16:16:00 CET 2001 - - first of all: - I strongly suggest NOT to use it yet, it's very, very, ... very - experimental. I guess you got the point. there is still much debug code, - incomplete functions and unusable states.... - - I'm still working on the final alpha... - diff --git a/mdk-stage1/dietlibc/libpthread/Makefile b/mdk-stage1/dietlibc/libpthread/Makefile deleted file mode 100644 index 06420f43a..000000000 --- a/mdk-stage1/dietlibc/libpthread/Makefile +++ /dev/null @@ -1,139 +0,0 @@ -all: libpthread.a - -ARCH=$(shell uname -m | sed 's/i[4-9]86/i386/') - -CFLAGS=-pipe -CROSS= - -CC=gcc - -VPATH=../$(ARCH)/ - -PTHREAD_OBJS = \ - __testandset.o \ - \ - thread_internal.o \ - thread_key.o \ - \ - pthread_once.o pthread_spinlock.o \ - \ - pthread_create.o pthread_detach.o \ - pthread_join.o pthread_self.o \ - pthread_exit.o \ - \ - pthread_cleanup_push.o \ - pthread_cleanup_pop.o \ - \ - pthread_attr_getdetachstate.o \ - pthread_attr_getinheritsched.o \ - pthread_attr_getschedparam.o \ - pthread_attr_getschedpolicy.o \ - pthread_attr_getscope.o \ - pthread_attr_getstackaddr.o \ - pthread_attr_getstacksize.o \ - pthread_attr_init.o \ - pthread_attr_setdetachstate.o \ - pthread_attr_setinheritsched.o \ - pthread_attr_setschedparam.o \ - pthread_attr_setschedpolicy.o \ - pthread_attr_setscope.o \ - pthread_attr_setstackaddr.o \ - pthread_attr_setstacksize.o \ - \ - pthread_cancel.o pthread_setcancelstate.o \ - pthread_setcanceltype.o pthread_testcancel.o \ - \ - pthread_mutex_init.o \ - pthread_mutex_destroy.o \ - pthread_mutex_lock.o \ - pthread_mutex_trylock.o \ - pthread_mutex_unlock.o \ - \ - pthread_mutexattr_getkind_np.o \ - pthread_mutexattr_init.o \ - pthread_mutexattr_setkind_np.o \ - \ - pthread_condattr.o \ - pthread_cond_broadcast.o \ - pthread_cond_destroy.o \ - pthread_cond_init.o \ - pthread_cond_signal.o \ - pthread_cond_timedwait.o \ - pthread_cond_wait.o \ - \ - pthread_key_create.o \ - pthread_key_delete.o \ - pthread_getspecific.o \ - pthread_setspecific.o \ - \ - pthread_atfork.o \ - pthread_sys_alloc.o \ - pthread_sys_close.o \ - pthread_sys_create.o \ - pthread_sys_fcntl.o \ - pthread_sys_fsync.o \ - pthread_sys_nanosleep.o \ - pthread_sys_logging.o \ - pthread_sys_open.o \ - pthread_sys_pause.o \ - pthread_sys_read.o \ - pthread_sys_sigsuspend.o \ - pthread_sys_tcdrain.o \ - pthread_sys_waitpid.o \ - pthread_sys_write.o - -%.o : %.c - $(CC) $(CFLAGS) -c -o $@ $? - -include ../$(ARCH)/Makefile.add - -ifeq ($(CFLAGS),-pipe) -CFLAGS+=-O -fomit-frame-pointer -endif - -#CFLAGS = -g -CFLAGS += -Wall - -CFLAGS += -I.. -I../include -Wall - -PWD=$(shell pwd) - -.SUFFIXES: -.SUFFIXES: .S .c - -% :: %,v - -%.o: %.S - $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< - -%.o: %.c - $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -# $(CROSS)strip -x -R .comment -R .note $@ - -libpthread.a: $(PTHREAD_OBJS) - ar cr $@ $^ - -libpthread.so: libpthread.a - $(CROSS)ld -whole-archive -shared -o $@ $^ - - -clean: - $(RM) *.o *.a *.so *.out *~ - -exports: libpthread.a - nm -g libpthread.a | grep -w T | awk '{ print $$3 }' | sort -u > exports - -.PHONY: test.out - -test.out: test.o libpthread.a $(LIBS) - $(CROSS)$(CC) -g $(CFLAGS) -nostdlib ../bin-$(ARCH)/start.o -o $@ $^ ../bin-$(ARCH)/dietlibc.a -lgcc - - -.PHONY: sparc ppc mips arm alpha i386 - -sparc ppc alpha i386: - $(MAKE) ARCH=$@ CROSS=$@-linux- all t libdietc.so - -mips arm: - $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all t libdietc.so - diff --git a/mdk-stage1/dietlibc/libpthread/README b/mdk-stage1/dietlibc/libpthread/README deleted file mode 100644 index 3139c731d..000000000 --- a/mdk-stage1/dietlibc/libpthread/README +++ /dev/null @@ -1,42 +0,0 @@ -LIBPTHREAD - - This is the pthread implementation of dietlibc. - Written from scratch by Olaf Dreesen. - -1. STATUS: incomplete but should work (or not... I had a lot of heisen-bugs...) - On non i386 archs the kernel header have major differences... - NO workaround yet for this problems... - -It's like linuxthreads a clone base thread implementation. - -I have implemented a "Manager Thread" with all the pain it involves... -Nested thread creation is now working fine... - - -2. HOW-TO make this lib: - - 1. generate the dietlibc in the parent directory. - and make sure you have WANT_THREAD_SAVE active in the file: - dietfeatures.h - - 2. change back here and type make - - and then you should have a libpthread.a - - -3. NOTES - -NON STANDARD SIGNAL HANDLING for the threads: - - SIGHUP the targeted thread is canceled - depends on the cancel type of the thread. - - ASYNCHRONOUS: the signal handler will KILL the thread immediately. - - DEFERRED: the signal handler mark its thread as canceled. - (only for the sig-handler to do some sane stuff...) - - SIGTERM the thread is KILLED - if the thread signaled is the main thread, then ALL child-threads - will get a SIGHUP and after some micros a SIGTERM.... - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_atfork.c b/mdk-stage1/dietlibc/libpthread/pthread_atfork.c deleted file mode 100644 index 2dc612dcc..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_atfork.c +++ /dev/null @@ -1,77 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -#define PTHREAD_NUM_ATFORK 4 - -static struct _pthread_fastlock __atfork_struct_lock; -static struct { - int used; - void (*prepare)(void); - void (*parent)(void); - void (*child)(void); -} pthread_atfork_buf[PTHREAD_NUM_ATFORK]; - -int pthread_atfork(void (*prepare)(void), - void (*parent)(void), - void (*child)(void)) -{ - int i,ret=-1; - - __NO_ASYNC_CANCEL_BEGIN; - __pthread_lock(&__atfork_struct_lock); - - for (i=0;i<PTHREAD_NUM_ATFORK; ++i) { - if (!(pthread_atfork_buf[i].used)) { - pthread_atfork_buf[i].prepare=prepare; - pthread_atfork_buf[i].parent=parent; - pthread_atfork_buf[i].child=child; - ret=0; - break; - } - } - - __pthread_unlock(&__atfork_struct_lock); - __NO_ASYNC_CANCEL_END; - - if (ret) (*(__errno_location()))=ENOMEM; - return ret; -} - -pid_t fork(void) -{ - pid_t pid; - int i=PTHREAD_NUM_ATFORK; - - __NO_ASYNC_CANCEL_BEGIN; - - __TEST_CANCEL(); - __pthread_lock(&__atfork_struct_lock); - - while (i) { - if (pthread_atfork_buf[--i].used) - if (pthread_atfork_buf[i].prepare) - pthread_atfork_buf[i].prepare(); - } - - pid=__libc_fork(); - - if (pid>0) { /* parent */ - for (i=0;i<PTHREAD_NUM_ATFORK;++i) - if (pthread_atfork_buf[i].used) - if (pthread_atfork_buf[i].parent) - pthread_atfork_buf[i].parent(); - } else if (pid==0) { /* child */ - for (i=0;i<PTHREAD_NUM_ATFORK;++i) - if (pthread_atfork_buf[i].used) - if (pthread_atfork_buf[i].child) - pthread_atfork_buf[i].child(); - } - - __pthread_unlock(&__atfork_struct_lock); - __NO_ASYNC_CANCEL_END; - - return pid; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getdetachstate.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getdetachstate.c deleted file mode 100644 index ccdfc0e47..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getdetachstate.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate) -{ - __THREAD_INIT(); - - *detachstate=attr->__detachstate; - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getinheritsched.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getinheritsched.c deleted file mode 100644 index 314fd8ade..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getinheritsched.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit) -{ - __THREAD_INIT(); - - *inherit = attr->__inheritsched; - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedparam.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedparam.c deleted file mode 100644 index f0a9a07d1..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedparam.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param) -{ - __THREAD_INIT(); - - param->sched_priority=attr->__schedparam.sched_priority; - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedpolicy.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedpolicy.c deleted file mode 100644 index 53f1bed8c..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getschedpolicy.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy) -{ - __THREAD_INIT(); - - *policy = attr->__schedpolicy; - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getscope.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getscope.c deleted file mode 100644 index 99a33110d..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getscope.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_getscope(const pthread_attr_t *attr, int *scope) -{ - __THREAD_INIT(); - - *scope=PTHREAD_SCOPE_SYSTEM; - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstackaddr.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getstackaddr.c deleted file mode 100644 index d71421901..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstackaddr.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stack) -{ - __THREAD_INIT(); - - *stack=attr->__stackaddr; - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstacksize.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_getstacksize.c deleted file mode 100644 index 4785979a0..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_getstacksize.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize) -{ - __THREAD_INIT(); - - *stacksize=attr->__stacksize; - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c deleted file mode 100644 index 726e88fe5..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_init.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_init(pthread_attr_t *attr) -{ - __THREAD_INIT(); - - memset(attr,0,sizeof(pthread_attr_t)); - attr->__stacksize=PTHREAD_STACK_SIZE; - return 0; -} - -int pthread_attr_destroy(pthread_attr_t *attr) __attribute__((alias("pthread_attr_init"))); - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c deleted file mode 100644 index 690ad5f8e..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setdetachstate.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) -{ - __THREAD_INIT(); - - if ((detachstate == PTHREAD_CREATE_JOINABLE) || - (detachstate == PTHREAD_CREATE_DETACHED)) { - attr->__detachstate=detachstate; - return 0; - } - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c deleted file mode 100644 index f38e6e35e..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setinheritsched.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit) -{ - __THREAD_INIT(); - - if ((inherit==PTHREAD_INHERIT_SCHED) || - (inherit==PTHREAD_EXPLICIT_SCHED)) { - attr->__inheritsched=inherit; - return 0; - } - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c deleted file mode 100644 index 833c0111b..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedparam.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param) -{ - __THREAD_INIT(); - - if ((attr->__schedpolicy == SCHED_OTHER) && (param->sched_priority == 0)) { - attr->__schedparam.sched_priority=0; - return 0; - } - if (((attr->__schedpolicy == SCHED_RR) || (attr->__schedpolicy == SCHED_RR)) - && ((param->sched_priority > 0) && (param->sched_priority < 100))) { - attr->__schedparam.sched_priority=param->sched_priority; - return 0; - } - (*(__errno_location()))=EINVAL; - return -1; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c deleted file mode 100644 index e845bca32..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setschedpolicy.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) -{ - __THREAD_INIT(); - - if (policy==SCHED_OTHER) { - attr->__schedpolicy=policy; - return 0; - } - if ((policy==SCHED_FIFO) || (policy==SCHED_RR)) { - if (geteuid()==0) { - attr->__schedpolicy=policy; - return 0; - } - (*(__errno_location()))=ENOTSUP; - } - else - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c deleted file mode 100644 index 39088c9b2..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setscope.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_setscope(pthread_attr_t *attr, int scope) -{ - __THREAD_INIT(); - - if (scope==PTHREAD_SCOPE_SYSTEM) return 0; - - if (scope==PTHREAD_SCOPE_PROCESS) - (*(__errno_location()))=ENOTSUP; - else - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstackaddr.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setstackaddr.c deleted file mode 100644 index 4b320cd9d..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstackaddr.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack) -{ - __THREAD_INIT(); - - attr->__stackaddr=stack; - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c b/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c deleted file mode 100644 index cfbab7747..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_attr_setstacksize.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize) -{ - __THREAD_INIT(); - - if (stacksize>=PTHREAD_STACK_SIZE) { - attr->__stacksize=stacksize; - return 0; - } - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cancel.c b/mdk-stage1/dietlibc/libpthread/pthread_cancel.c deleted file mode 100644 index 4c87a3ed1..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cancel.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_cancel(pthread_t th) -{ - pthread_t j; - _pthread_descr thread; - - __THREAD_INIT(); - - j=__find_thread_id(th); - - if (j==-1) { - (*(__errno_location()))=ESRCH; - return -1; - } - thread = __get_thread_struct(j); - - if (thread==0) { - (*(__errno_location()))=ESRCH; - return -1; - } - - if (thread->cancelstate!=PTHREAD_CANCEL_DISABLE) { - thread->canceled=1; - if (thread->canceltype!=PTHREAD_CANCEL_DEFERRED) { - kill(thread->pid,SIGHUP); - } - } - - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_pop.c b/mdk-stage1/dietlibc/libpthread/pthread_cleanup_pop.c deleted file mode 100644 index 641bb6083..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_pop.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -void pthread_cleanup_pop(int execute) -{ - _pthread_descr this; - struct thread_cleanup_t tmp; - int i=PTHREAD_MAX_CLEANUP; - - __THREAD_INIT(); - - this = __thread_self(); - - while(i>0) { - if (this->cleanup_stack[--i].func) { - tmp.func=this->cleanup_stack[i].func; - tmp.arg=this->cleanup_stack[i].arg; - this->cleanup_stack[i].func=0; - break; - } - } - - if (execute) tmp.func(tmp.arg); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_push.c b/mdk-stage1/dietlibc/libpthread/pthread_cleanup_push.c deleted file mode 100644 index cd2aabf71..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cleanup_push.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -void pthread_cleanup_push(void (*func)(void*), void *arg) -{ - _pthread_descr this; - int i; - - __THREAD_INIT(); - - this = __thread_self(); - - for (i=0; i<PTHREAD_MAX_CLEANUP; ++i) { - if (this->cleanup_stack[i].func==0) { - this->cleanup_stack[i].func=func; - this->cleanup_stack[i].arg=arg; - break; - } - } -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c deleted file mode 100644 index d3c2274f3..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cond_broadcast.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_cond_broadcast(pthread_cond_t *cond) -{ - _pthread_descr tmp; - - __THREAD_INIT(); - - __pthread_lock(&(cond->lock)); - while ((tmp=cond->wait_chain)) { - cond->wait_chain=tmp->waitnext; - tmp->waitnext=0; - tmp->waiting=0; - } - __pthread_unlock(&(cond->lock)); - - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c deleted file mode 100644 index 9a6cc4f0b..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cond_destroy.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_cond_destroy(pthread_cond_t *cond) -{ - __THREAD_INIT(); - - if (cond->wait_chain) { - (*__errno_location())=EBUSY; - return 1; - } - - memset(cond,0,sizeof(pthread_cond_t)); - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c deleted file mode 100644 index 20b38bef2..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cond_init.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *cond_attr) -{ - __THREAD_INIT(); - - memset(cond,0,sizeof(pthread_cond_t)); - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c deleted file mode 100644 index 60bf2119c..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cond_signal.c +++ /dev/null @@ -1,24 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_cond_signal(pthread_cond_t *cond) -{ - _pthread_descr tmp=0; - - __THREAD_INIT(); - - __pthread_lock(&(cond->lock)); - if ((tmp=cond->wait_chain)) cond->wait_chain=tmp->waitnext; - __pthread_unlock(&(cond->lock)); - - if (tmp) { - tmp->waitnext=0; - tmp->waiting=0; - } - - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c deleted file mode 100644 index 6613f2ca9..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cond_timedwait.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime) -{ - _pthread_descr tmp; - _pthread_descr this; - int ret; - - __THREAD_INIT(); - - this=__thread_self(); - - /* put in wait-chain */ - __pthread_lock(&(cond->lock)); - this->waiting=1; - if (cond->wait_chain) { - for(tmp=cond->wait_chain;tmp->waitnext;tmp=tmp->waitnext); - tmp->waitnext=this; - } else cond->wait_chain=this; - __pthread_unlock(&(cond->lock)); - - /* Aeh yeah / wait till signal */ - pthread_mutex_unlock(mutex); - ret=nanosleep(abstime,0); - pthread_mutex_lock(mutex); - - __TEST_CANCEL(); - - if (ret) { - if ((*__errno_location())!=EINTR) return -1; - return 0; - } - - (*__errno_location())=ETIMEDOUT; - return -1; -} - - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c b/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c deleted file mode 100644 index 0c6c0ae13..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_cond_wait.c +++ /dev/null @@ -1,37 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) -{ - _pthread_descr tmp; - _pthread_descr this; - - __THREAD_INIT(); - - this=__thread_self(); - - /* put in wait-chain */ - __pthread_lock(&(cond->lock)); - this->waiting=1; - if (cond->wait_chain) { - for(tmp=cond->wait_chain;tmp->waitnext;tmp=tmp->waitnext); - tmp->waitnext=this; - } else cond->wait_chain=this; - __pthread_unlock(&(cond->lock)); - - /* Aeh yeah / wait till signal */ - pthread_mutex_unlock(mutex); - while (this->waiting) { - __thread_wait_some_time(); - if (this->canceled) this->waiting=0; /* we got a cancel signal */ - } - pthread_mutex_lock(mutex); - - __TEST_CANCEL(); - return 0; -} - - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_condattr.c b/mdk-stage1/dietlibc/libpthread/pthread_condattr.c deleted file mode 100644 index c537890ba..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_condattr.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <pthread.h> - -int pthread_condattr_init(pthread_condattr_t *attr) -{ - return 0; -} - -int pthread_condattr_destroy(pthread_condattr_t *attr) -__attribute__((alias("pthread_condattr_init"))); - -int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared) -__attribute__((alias("pthread_condattr_init"))); - -int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared) -__attribute__((alias("pthread_condattr_init"))); diff --git a/mdk-stage1/dietlibc/libpthread/pthread_create.c b/mdk-stage1/dietlibc/libpthread/pthread_create.c deleted file mode 100644 index b4a499081..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_create.c +++ /dev/null @@ -1,76 +0,0 @@ -#include <unistd.h> -#include <stdlib.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_create (pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine) (void *), void *arg) -{ - int ret=0; - _pthread_descr td; - pthread_attr_t default_attr; - - __THREAD_INIT(); - - if (start_routine==0) { - (*(__errno_location()))=EINVAL; - return -1; - } - - td = __thread_get_free(); - - if (td) { - if (!(attr)) { - pthread_attr_init(&default_attr); - attr=&default_attr; - } - - if ((td->policy!=SCHED_OTHER)&&(td->priority==0)) { - (*(__errno_location()))=EINVAL; - return -1; - } - - if (attr->__inheritsched==PTHREAD_INHERIT_SCHED) { - _pthread_descr this = __thread_self(); - td->policy = this->policy; - td->priority = this->priority; - } else { - td->policy = attr->__schedpolicy; - td->priority = attr->__schedparam.sched_priority; - } - - td->func = start_routine; - td->arg = arg; - - td->detached = attr->__detachstate; - - td->stack_size = attr->__stacksize; - - if (!(td->stack_addr)) { - char *stack=(char*)malloc(td->stack_size); - if (!(stack)) { - (*(__errno_location()))=EINVAL; - return -1; - } - td->stack_begin = stack; - td->stack_addr = stack+td->stack_size; - } else { - td->stack_begin = 0; - td->stack_addr = attr->__stackaddr; - } - - ret = signal_manager_thread(td); - - if (ret>1) - *thread=ret; - else - __thread_cleanup(td); - } - else - (*(__errno_location()))=EAGAIN; - - if (ret<2) return -1; - return ret; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_detach.c b/mdk-stage1/dietlibc/libpthread/pthread_detach.c deleted file mode 100644 index c07280389..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_detach.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_detach(pthread_t th) -{ - pthread_t j; - _pthread_descr thread; - - __THREAD_INIT(); - - j=__find_thread_id(th); - - if (j==-1) { - (*(__errno_location()))=ESRCH; - return -1; - } - thread = __get_thread_struct(j); - - if (thread==0) { - (*(__errno_location()))=ESRCH; - return -1; - } - - if (thread->detached) { - (*(__errno_location()))=EINVAL; - return -1; - } - - if (!thread->joined) { - thread->detached=1; - } - - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_exit.c b/mdk-stage1/dietlibc/libpthread/pthread_exit.c deleted file mode 100644 index 41eac0a33..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_exit.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -void pthread_exit(void *retval) -{ - _pthread_descr this; - - __THREAD_INIT(); - - this = __thread_self(); - this->retval = retval; - - longjmp(this->jmp_exit,1); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_getspecific.c b/mdk-stage1/dietlibc/libpthread/pthread_getspecific.c deleted file mode 100644 index c2f84c814..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_getspecific.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX]; -const void *pthread_getspecific(pthread_key_t key) -{ - int id; - __THREAD_INIT(); - - id=__find_thread_id(getpid()); - - if ((key<PTHREAD_KEYS_MAX) && (__thread_keys[key].used)) { - return __thread_keys[key].tkd[id]; - } - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_join.c b/mdk-stage1/dietlibc/libpthread/pthread_join.c deleted file mode 100644 index 5b295bad1..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_join.c +++ /dev/null @@ -1,50 +0,0 @@ -#include <unistd.h> -#include <stdlib.h> -#include <errno.h> - -#include "thread_internal.h" -#include <pthread.h> - -int pthread_join(pthread_t th, void **thread_return) -{ - pthread_t j; - _pthread_descr this, thread; - - __THREAD_INIT(); - - this = __thread_self(); - j=__find_thread_id(th); - - if (j==-1) { - (*(__errno_location()))=ESRCH; - return -1; - } - - thread = __get_thread_struct(j); - - /* error handling */ - if (thread==0) { - (*(__errno_location()))=ESRCH; - return -1; - } - - if (this==thread) { - (*(__errno_location()))=EDEADLK; - return -1; - } - - if (thread->detached || thread->joined) { - (*(__errno_location()))=EINVAL; - return -1; - } - - thread->joined=this; - this->join=1; - - while(this->join) __thread_wait_some_time(); - - if (thread_return) *thread_return=this->retval; - - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_key_create.c b/mdk-stage1/dietlibc/libpthread/pthread_key_create.c deleted file mode 100644 index 44fccea6a..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_key_create.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -extern struct _pthread_fastlock __thread_keys_lock; -extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX]; -int pthread_key_create(pthread_key_t *key, void (*destructor)(const void*)) -{ - int ret=-1,i; - - __THREAD_INIT(); - - __NO_ASYNC_CANCEL_BEGIN; - __pthread_lock(&__thread_keys_lock); - - for (i=0; i<PTHREAD_KEYS_MAX; i++) { - if (!__thread_keys[i].used) { - __thread_keys[i].used=1; - __thread_keys[i].destructor=destructor; - memset(__thread_keys[i].tkd,0,PTHREAD_THREADS_MAX*sizeof(struct _thread_key)); - *key=i; - ret=0; - break; - } - } - - __pthread_unlock(&__thread_keys_lock); - __NO_ASYNC_CANCEL_END; - - if (ret) (*__errno_location())=EAGAIN; - return ret; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c b/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c deleted file mode 100644 index b1bc366e2..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_key_delete.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX]; -int pthread_key_delete(pthread_key_t key) -{ - __THREAD_INIT(); - - if (key>=PTHREAD_KEYS_MAX) { - (*__errno_location())=EINVAL; - return -1; - } - - __thread_keys[key].used=0; - - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c deleted file mode 100644 index 33a16abd4..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_destroy.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_mutex_destroy(pthread_mutex_t *mutex) -{ - __THREAD_INIT(); - - if ((mutex->owner)||(mutex->lock.__spinlock)) { - (*(__errno_location()))=EBUSY; - return -1; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c deleted file mode 100644 index b1797fb20..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_init.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_mutex_init(pthread_mutex_t *mutex, - const pthread_mutexattr_t *mutexattr) -{ - __THREAD_INIT(); - - memset(mutex,0,sizeof(pthread_mutex_t)); - if (mutexattr) { - mutex->kind=mutexattr->__mutexkind; - } - return 0; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c deleted file mode 100644 index 0c3ade9e8..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_lock.c +++ /dev/null @@ -1,33 +0,0 @@ -#include <unistd.h> -#include <sched.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -/* will never return EINVAL ! */ - -int pthread_mutex_lock(pthread_mutex_t *mutex) -{ - _pthread_descr this; - - __THREAD_INIT(); - - this = __thread_self(); - - if (this!=mutex->owner) { - /* wait for mutex to free */ - __pthread_lock(&(mutex->lock)); - - mutex->owner=this; - } - else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP) - { - (*(__errno_location()))=EDEADLK; - return -1; - } - - if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) ++(mutex->count); - - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c deleted file mode 100644 index fcf63f75e..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_trylock.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <unistd.h> -#include <sched.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -/* will never return EINVAL ! */ - -int pthread_mutex_trylock(pthread_mutex_t *mutex) -{ - _pthread_descr this; - - __THREAD_INIT(); - - this = __thread_self(); - - if (this!=mutex->owner) { - /* wait for mutex to free */ - if (__pthread_trylock(&(mutex->lock))) { - (*(__errno_location()))=EBUSY; - return -1; - } - - mutex->owner=this; - } - else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP) - { - (*(__errno_location()))=EDEADLK; - return -1; - } - - if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) ++(mutex->count); - - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c b/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c deleted file mode 100644 index 0b5a1d0f7..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutex_unlock.c +++ /dev/null @@ -1,34 +0,0 @@ -#include <unistd.h> -#include <sched.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -/* will never return EINVAL ! */ - -int pthread_mutex_unlock(pthread_mutex_t *mutex) -{ - _pthread_descr this; - - __THREAD_INIT(); - - this = __thread_self(); - - if (this==mutex->owner) { - if (mutex->kind==PTHREAD_MUTEX_RECURSIVE_NP) { - if (--(mutex->count)) - return 0; - } - - mutex->owner=0; - __pthread_unlock(&(mutex->lock)); - } - else if (mutex->kind==PTHREAD_MUTEX_ERRORCHECK_NP) - { - (*(__errno_location()))=EPERM; - return -1; - } - - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_getkind_np.c b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_getkind_np.c deleted file mode 100644 index 63cd9133c..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_getkind_np.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind) -{ - __THREAD_INIT(); - - *kind=attr->__mutexkind; - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_init.c b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_init.c deleted file mode 100644 index ff60e4c74..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_init.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_mutexattr_init(pthread_mutexattr_t *attr) -{ - __THREAD_INIT(); - - attr->__mutexkind = 0; - return 0; -} - -int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) __attribute__((alias ("pthread_mutexattr_init"))); diff --git a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c b/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c deleted file mode 100644 index ac600f8ed..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_mutexattr_setkind_np.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind) -{ - __THREAD_INIT(); - - if ((kind==PTHREAD_MUTEX_FAST_NP) || (kind==PTHREAD_MUTEX_RECURSIVE_NP) || - (kind==PTHREAD_MUTEX_ERRORCHECK_NP)) { - attr->__mutexkind=kind; - return 0; - } - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_once.c b/mdk-stage1/dietlibc/libpthread/pthread_once.c deleted file mode 100644 index 16d9cb392..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_once.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <pthread.h> -#include "thread_internal.h" - -int __pthread_once (pthread_once_t* once_control, void (*init_routine)(void)) -{ - if (!(__testandset(once_control))) init_routine(); - return 0; -} -int pthread_once (pthread_once_t* once_control, void (*init_routine)(void)) __attribute__((alias("__pthread_once"))); diff --git a/mdk-stage1/dietlibc/libpthread/pthread_self.c b/mdk-stage1/dietlibc/libpthread/pthread_self.c deleted file mode 100644 index 394686dd4..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_self.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <unistd.h> -#include <pthread.h> - -pthread_t pthread_self() { return getpid(); } diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c b/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c deleted file mode 100644 index b906492fb..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_setcancelstate.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_setcancelstate(int state, int *oldstate) -{ - _pthread_descr thread; - - __THREAD_INIT(); - - if ((state==PTHREAD_CANCEL_ENABLE) || (state==PTHREAD_CANCEL_DISABLE)) - { - thread = __thread_self(); - - if (oldstate) *oldstate = thread->cancelstate; - thread->cancelstate = state; - - return 0; - } - - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c b/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c deleted file mode 100644 index 03d1f53de..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_setcanceltype.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pthread_setcanceltype(int type, int *oldtype) -{ - _pthread_descr thread; - - __THREAD_INIT(); - - if ((type==PTHREAD_CANCEL_DEFERRED) || (type==PTHREAD_CANCEL_ASYNCHRONOUS)) - { - thread = __thread_self(); - - if (oldtype) *oldtype = thread->canceltype; - thread->canceltype = type; - - return 0; - } - - (*(__errno_location()))=EINVAL; - return -1; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c b/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c deleted file mode 100644 index 78339c20b..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_setspecific.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -extern struct _thread_key __thread_keys[PTHREAD_KEYS_MAX]; -int pthread_setspecific(pthread_key_t key, const void *value) -{ - int id; - __THREAD_INIT(); - - id=__find_thread_id(getpid()); - if ((key<PTHREAD_KEYS_MAX) && (__thread_keys[key].used)) { - __thread_keys[key].tkd[id]=value; - return 0; - } - (*__errno_location())=EINVAL; - return -1; -} - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c b/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c deleted file mode 100644 index 449782adf..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_spinlock.c +++ /dev/null @@ -1,38 +0,0 @@ -#include <time.h> -#include <pthread.h> -#include "thread_internal.h" - -static void __pthread_acquire(int * spinlock) -{ - int cnt = 0; - struct timespec tm; - - while (__testandset(spinlock)) { - if (cnt < MAX_SPIN_COUNT) { - sched_yield(); - cnt++; - } else { - tm.tv_sec = 0; - tm.tv_nsec = SPIN_SLEEP_DURATION; - __libc_nanosleep(&tm, 0); - cnt = 0; - } - } -} - -void __pthread_lock(struct _pthread_fastlock * lock) -{ - __pthread_acquire(&lock->__spinlock); -} - -int __pthread_trylock(struct _pthread_fastlock * lock) -{ - return __testandset(&lock->__spinlock); -} - -int __pthread_unlock(struct _pthread_fastlock * lock) -{ - return (lock->__spinlock = 0); -} - - diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c deleted file mode 100644 index 9f7d23d79..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_alloc.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -static pthread_mutex_t mutex_alloc = PTHREAD_MUTEX_INITIALIZER; - -void free(void *ptr) -{ - __NO_ASYNC_CANCEL_BEGIN; - pthread_mutex_lock(&mutex_alloc); - __libc_free(ptr); - pthread_mutex_unlock(&mutex_alloc); - __NO_ASYNC_CANCEL_END; -} - -void *malloc(size_t size) -{ - register void *ret; - __NO_ASYNC_CANCEL_BEGIN; - pthread_mutex_lock(&mutex_alloc); - ret=__libc_malloc(size); - pthread_mutex_unlock(&mutex_alloc); - __NO_ASYNC_CANCEL_END; - return ret; -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_close.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_close.c deleted file mode 100644 index 84d5d5f36..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_close.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int close(int fd) -{ - __TEST_CANCEL(); - return __libc_close(fd); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_create.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_create.c deleted file mode 100644 index 9d47844f5..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_create.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int creat(const char *pathname, mode_t mode) -{ - __TEST_CANCEL(); - return __libc_creat(pathname,mode); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c deleted file mode 100644 index 99210a488..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_fcntl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int fcntl(int fd, int cmd, void *arg) -{ - __TEST_CANCEL(); - return __libc_fcntl(fd,cmd,arg); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_fsync.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_fsync.c deleted file mode 100644 index a2c995069..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_fsync.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int fsync(int fd) -{ - __TEST_CANCEL(); - return __libc_fsync(fd); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c deleted file mode 100644 index 6070ad219..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_logging.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <unistd.h> -#include <stdarg.h> - -#include <pthread.h> -#include "thread_internal.h" - -static pthread_mutex_t mutex_syslog = PTHREAD_MUTEX_INITIALIZER; - -void closelog(void) -{ - pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock,&mutex_syslog); - pthread_mutex_lock(&mutex_syslog); - __libc_closelog(); - pthread_cleanup_pop(1); -} - -void openlog(const char *ident, int option, int facility) -{ - pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock,&mutex_syslog); - pthread_mutex_lock(&mutex_syslog); - __libc_openlog(ident, option, facility); - pthread_cleanup_pop(1); -} - -void vsyslog(int priority, const char *format, va_list arg_ptr) -{ - pthread_cleanup_push((void(*)(void*))pthread_mutex_unlock,&mutex_syslog); - pthread_mutex_lock(&mutex_syslog); - __libc_vsyslog(priority, format, arg_ptr); - pthread_cleanup_pop(1); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_nanosleep.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_nanosleep.c deleted file mode 100644 index 699de4654..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_nanosleep.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <time.h> -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int nanosleep(const struct timespec *req, struct timespec *rem) -{ - __TEST_CANCEL(); - return __libc_nanosleep(req,rem); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c deleted file mode 100644 index 513f6a323..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_open.c +++ /dev/null @@ -1,12 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int __pthread_open(const char *pathname, int flags, mode_t mode) -{ - __TEST_CANCEL(); - return __libc_open(pathname,flags,mode); -} - -int open(const char *pathname, int flags, ...) __attribute__((alias("__pthread_open"))); diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_pause.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_pause.c deleted file mode 100644 index ab15ead11..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_pause.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int pause() -{ - __TEST_CANCEL(); - return __libc_pause(); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_read.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_read.c deleted file mode 100644 index 60f886003..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_read.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int read(int fd, void *buf, size_t count) -{ - __TEST_CANCEL(); - return __libc_read(fd,buf,count); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_sigsuspend.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_sigsuspend.c deleted file mode 100644 index 72cd783ae..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_sigsuspend.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int sigsuspend(const sigset_t *mask) -{ - __TEST_CANCEL(); - return __libc_sigsuspend(mask); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c deleted file mode 100644 index 1ac33adfc..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_tcdrain.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int tcdrain(int fd) -{ - __TEST_CANCEL(); - return __libc_tcdrain(fd); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c deleted file mode 100644 index 76d5ddca7..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_waitpid.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -pid_t waitpid(pid_t pid, int *status, int options) -{ - __TEST_CANCEL(); - return __libc_waitpid(pid,status,options); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_sys_write.c b/mdk-stage1/dietlibc/libpthread/pthread_sys_write.c deleted file mode 100644 index 37541ae42..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_sys_write.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <unistd.h> - -#include <pthread.h> -#include "thread_internal.h" - -int write(int fd, const void *buf, size_t count) -{ - __TEST_CANCEL(); - return __libc_write(fd,buf,count); -} diff --git a/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c b/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c deleted file mode 100644 index 68f91e743..000000000 --- a/mdk-stage1/dietlibc/libpthread/pthread_testcancel.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -void pthread_testcancel() -{ - _pthread_descr thread; - __THREAD_INIT(); - - thread=__thread_self(); - - if (thread->canceled) { - pthread_exit(PTHREAD_CANCELED); - } -} diff --git a/mdk-stage1/dietlibc/libpthread/test.c b/mdk-stage1/dietlibc/libpthread/test.c deleted file mode 100644 index 3272c1753..000000000 --- a/mdk-stage1/dietlibc/libpthread/test.c +++ /dev/null @@ -1,72 +0,0 @@ -#include <stdio.h> -#include <pthread.h> - -#include <unistd.h> -#include <signal.h> - -#include <errno.h> - -int ra; - -void test(int sig) -{ - printf("SIGNAL %d in %d\n",sig,getpid()); - fflush(stdout); - signal(SIGHUP, test); -} - -void* thread(void* arg) -{ - int i; - for (i=0;i<10; i++) - { - printf("child %ld %8p\n", pthread_self(),arg); - sleep(1); - } - return arg; -} - -void* thread2(void *arg) -{ - pthread_t t; - int i; - - printf("child %ld %8p\n", pthread_self(),arg); - for (i=0; i<3; ++i) { - printf("child starting next in %d secs %ld %8p\n", 3-i, pthread_self(),arg); - sleep(1); - } - pthread_create(&t,0, thread, (void*)2); - printf("new child @ %ld\n",t); - return (void*)t; -} - -int main(int argc, char*argv[]) -{ - pthread_t t; - - signal(SIGHUP, test); - - pthread_create(&t,0, thread2, 0); - pthread_create(&t,0, thread, (void *)3); - pthread_create(&t,0, thread, (void *)1); - - puts("main"); - -#if 0 - { - int i; - for(i=0;i<4;i++) sleep(1); - } -#else - { - int *tt; - int i = pthread_join(t,(void*)&tt); - printf("join %d %p %d\n",i,tt,(*(__errno_location()))); - } -#endif - - puts("main exit"); - - return 0; -} diff --git a/mdk-stage1/dietlibc/libpthread/thread_internal.c b/mdk-stage1/dietlibc/libpthread/thread_internal.c deleted file mode 100644 index a93806203..000000000 --- a/mdk-stage1/dietlibc/libpthread/thread_internal.c +++ /dev/null @@ -1,344 +0,0 @@ -#include <signal.h> -#include <string.h> -#include <sys/wait.h> -#include <unistd.h> -#include <stdlib.h> -#include <errno.h> - -#include <sched.h> -#include <sys/resource.h> - -#include <stdio.h> -#include "thread_internal.h" - -static struct _pthread_fastlock __thread_struct_lock = {0}; -static struct _pthread_descr_struct threads[PTHREAD_THREADS_MAX]; -static int _max_used_thread_id=1; -pthread_once_t __thread_inited; - -static struct _pthread_fastlock __manager_thread_signal_lock = {0}; -static struct _pthread_fastlock __manager_thread_data_lock = {1}; -static struct _pthread_fastlock __manager_thread_data_go_lock = {1}; - -//#define DEBUG - -/* find thread */ -int __find_thread_id(int pid) -{ - register int i; - for (i=0; i<_max_used_thread_id; i++) - if (threads[i].pid==pid) - return i; - return -1; -} - -/* get thread */ -_pthread_descr __get_thread_struct(int id) -{ - return threads+id; -} - -/* thread errno location */ -int *__errno_location(void) -{ - int id=0; - if (__thread_inited) id=__find_thread_id(getpid()); - if (id<0) - return 0; - else - return &threads[id].errno; -} - -/* thread self */ -_pthread_descr __thread_self() -{ - register int i=__find_thread_id(getpid()); - if (i<0) - return 0; - else - return threads+i; -} - -/* allocate a thread slot */ -_pthread_descr __thread_get_free() -{ - _pthread_descr ret=0; - int i; - - __NO_ASYNC_CANCEL_BEGIN; - __pthread_lock(&__thread_struct_lock); - - for (i=0; i<PTHREAD_THREADS_MAX; i++) { - if (threads[i].pid==0) { - threads[i].pid=1; /* mark as taken */ - ret = threads+i; - if (i>=_max_used_thread_id) _max_used_thread_id=i+1; - break; - } - } - - __pthread_unlock(&__thread_struct_lock); - __NO_ASYNC_CANCEL_END; - return ret; -} - -/* sleep a little (reschedule for this time) */ -void __thread_wait_some_time() -{ - struct timespec reg; - reg.tv_sec=0; - reg.tv_nsec=SPIN_SLEEP_DURATION; - __libc_nanosleep(®,0); -} - -/* cleanup a thread struct */ -void __thread_cleanup(_pthread_descr th) -{ - /* lib provided stack should be freed */ - if (th->stack_begin) free(th->stack_begin); - - /* an other thread has joined this on */ - if (th->joined) { - th->joined->retval=th->retval; - th->joined->join=0; - th->joined=0; - } - th->pid=0; /* mark struct as free */ -} - -/* SIGHUP handler (thread cnacel) PTHREAD_CANCEL_ASYNCHRONOUS */ -static void __thread_cancel_handler(int sig) -{ - _pthread_descr this; - this = __thread_self(); - this->canceled=1; - if (this->canceltype==PTHREAD_CANCEL_ASYNCHRONOUS) - pthread_exit(PTHREAD_CANCELED); - signal( SIGHUP, __thread_cancel_handler ); -} - -/* kill ALL threads / other then prime task and manager thread */ -static void __kill_all_threads() -{ - int i; - - for (i=2; i<_max_used_thread_id; i++) { - if (threads[i].pid>1) { -#ifdef DEBUG - printf("CANCEL ! %d\n",threads[i].pid); -#endif - threads[i].canceled=1; - kill(threads[i].pid, SIGHUP); /* cancel thread */ - } - } - - __thread_wait_some_time(); - - for (i=2; i<_max_used_thread_id; i++) { - if (threads[i].pid>1) { -#ifdef DEBUG - printf("KILL ! %d\n",threads[i].pid); -#endif - kill(threads[i].pid, SIGTERM); /* KILL thread */ - } - } -} - -__attribute__((weak)) volatile void __thread_start__key(int id) { return; } -__attribute__((weak,alias("__thread_start__key"))) volatile void __thread_exit__key(int id); - -/* support for manager */ -static void *__mthread_starter(void *arg) -{ - _pthread_descr td = (_pthread_descr)arg; - int i = td->stack_size-4096; - - /* just to be sure */ - td->pid=getpid(); - - /* signal handling for a thread */ - signal(SIGTERM, _exit); - signal(SIGCHLD, SIG_DFL); - signal(SIGHUP, __thread_cancel_handler ); - - /* limit stack so that we NEVER have to worry */ - setrlimit(RLIMIT_STACK, (struct rlimit *)(&i)); - - /* set scheduler */ - if (td->policy!=SCHED_OTHER) { - struct sched_param sp; - sp.sched_priority=td->priority; - sched_setscheduler(td->pid,td->policy, &sp); - } - - /* thread_key glue */ - __thread_start__key(td-threads); - -#ifdef DEBUG - printf("in starter %d, parameter %8p\n", td->pid, td->func); -#endif - - if (!td->canceled) { - if (!(setjmp(td->jmp_exit))) { - td->retval=td->func(td->arg); -#ifdef DEBUG - } else { - printf("pthread_exit called in %d\n", td->pid); -#endif - } - } - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,0); - - /* thread_key glue */ - __thread_exit__key(td-threads); - -#ifdef DEBUG - printf("end starter %d, retval %8p\n", td->pid, td->retval); -#endif - - /* wake joined thread and put retval */ - if (td->joined) { - td->joined->retval=td->retval; - td->joined->join=0; - td->joined=0; - } - - /* execute all functions on the cleanup-stack */ - for (i=PTHREAD_MAX_CLEANUP;i;) { - if (td->cleanup_stack[--i].func) { - td->cleanup_stack[i].func(td->cleanup_stack[i].arg); - } - } - - return 0; -} - - -/* manager thread and signal handler */ -static char __manager_thread_stack[12*1024]; -static volatile _pthread_descr __manager_thread_data; -static void __manager_SIGCHLD(int sig) -{ - int pid, status, i; - - while(1) { - pid = __libc_waitpid (-1, &status, WNOHANG); - if (pid <= 0) break; - - for (i=0; i<_max_used_thread_id; i++) { - if (threads[i].pid==pid) { - __thread_cleanup(threads+i); - break; - } - } - } -} - -static void __manager_SIGTERM(int sig) -{ - __kill_all_threads(); - _exit(0); -} - -static void* __manager_thread(void *arg) -{ - struct sigaction sig_action_chld; - sig_action_chld.sa_handler = __manager_SIGCHLD; - sigemptyset(&sig_action_chld.sa_mask); - sig_action_chld.sa_flags = SA_RESTART; - - sigaction(SIGCHLD, &sig_action_chld, 0); - signal(SIGTERM, __manager_SIGTERM); - signal(SIGHUP, SIG_IGN); - - __pthread_unlock(&__manager_thread_data_go_lock); /* release init */ - while(1) { - do { - __thread_wait_some_time(); - if (getppid()<0) __manager_SIGTERM(0); - } while (__pthread_trylock(&__manager_thread_data_lock)); - - __manager_thread_data->pid = - __clone(__mthread_starter, - __manager_thread_data->stack_addr, - CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, - __manager_thread_data); - __thread_wait_some_time(); -#ifdef DEBUG - printf("manager new thread %d\n",__manager_thread_data->pid); -#endif - __pthread_unlock(&__manager_thread_data_go_lock); /* release sender */ - } - return 0; -} - -/* pthread_create bottom half */ -int signal_manager_thread(_pthread_descr td) -{ - __NO_ASYNC_CANCEL_BEGIN; - - __pthread_lock(&__manager_thread_signal_lock); /* lock */ - - __manager_thread_data = td; - __thread_wait_some_time(); - __pthread_unlock(&__manager_thread_data_lock); /* signal manager to start */ - __thread_wait_some_time(); - __pthread_lock(&__manager_thread_data_go_lock); /* wait for manager */ - - __pthread_unlock(&__manager_thread_signal_lock); /* unlock */ - - __NO_ASYNC_CANCEL_END; - - return td->pid; -} - - -/* thread stop */ -static void __thread_main_exit() -{ - if (getpid()!=threads[0].pid) { -#ifdef DEBUG - printf("A THREAD ? %d\n",getpid()); -#endif - kill(threads[0].pid, SIGTERM); - while(1) __thread_wait_some_time(); - } -#ifdef DEBUG - else - printf("EXIT ! %d\n",getpid()); -#endif - - /* stop ALL threads */ - kill(threads[1].pid, SIGTERM); - __thread_wait_some_time(); - __kill_all_threads(); -} - -/* thread intern init */ -void __thread_init() -{ - if (atexit(__thread_main_exit)==-1) - exit(42); - -#ifdef DEBUG - printf("INIT ! %d\n",getpid()); - memset(threads,0,sizeof(threads)); -#endif - - threads[0].pid = getpid(); - - ++_max_used_thread_id; - threads[1].stack_size=sizeof(__manager_thread_stack); - threads[1].stack_addr=&__manager_thread_stack[sizeof(__manager_thread_stack)]; - threads[1].stack_begin=0; - threads[1].func=__manager_thread; - - threads[1].pid = __clone(__mthread_starter, threads[1].stack_addr, - CLONE_VM | CLONE_FS | CLONE_FILES, threads+1); - -#ifdef DEBUG - printf("manager thread @ : %d\n",threads[1].pid); -#endif - __pthread_lock(&__manager_thread_data_go_lock); /* wait for manager to be ready */ -} - diff --git a/mdk-stage1/dietlibc/libpthread/thread_internal.h b/mdk-stage1/dietlibc/libpthread/thread_internal.h deleted file mode 100644 index 5eb3bbd08..000000000 --- a/mdk-stage1/dietlibc/libpthread/thread_internal.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef __THREAD_INTERNAL_H__ -#define __THREAD_INTERNAL_H__ - -#include <pthread.h> -#include <stdarg.h> -#include <setjmp.h> -#include "dietfeatures.h" -#ifndef WANT_THREAD_SAFE -#error "the diet libc is not compiled with thread safeness enabled!" -#endif - -/* cleanup */ -#define PTHREAD_MAX_CLEANUP 8 -struct thread_cleanup_t { - void (*func)(void*); - void *arg; -}; - -/* the thread descriptor / internal */ -struct _pthread_descr_struct { - /* runtime handling */ - struct _pthread_descr_struct *joined; /* a joined thread or NULL */ - - /* conditional variables */ - struct _pthread_descr_struct *waitnext; /* an other waiting thread or NULL */ - int waiting; /* internal waiting "lock" */ - - /* thread/process data */ - int pid; /* Process id */ - - int policy; /* thread scheduling policy */ - int priority; /* thread priority */ - - /* errno handling */ - int errno; - int h_errno; - - /* stack handling */ - unsigned int stack_size; /* stack size for setrlimit */ - void *stack_addr; /* stack address for clone */ - void *stack_begin; /* begin of lib-stack / lowest address (free) */ - - /* thread exit handling */ - void *retval; /* thread return value */ - int join; /* thread waits for other to return */ - jmp_buf jmp_exit; /* pthread_exit jump */ - - /* thread flags */ - int detached; /* thread is detached */ - int canceled; /* thread canceled */ - - /* cancel handling */ - int cancelstate; /* cancel state */ - int canceltype; /* type of cancellation */ - - /* thread basics */ - void* (*func) (void* arg); /* thread function */ - void* arg; /* thread argument */ - - /* create thread / manager thread lock */ - struct _pthread_fastlock *manager_lock; - - /* cleanup stack */ - struct thread_cleanup_t cleanup_stack[PTHREAD_MAX_CLEANUP]; - -} __attribute__ ((aligned(32))); - -/* thread keys */ -struct _thread_key { - int used; - void (*destructor)(const void*); - const void *tkd[PTHREAD_THREADS_MAX]; -}; - -/* internal stuff */ -int __testandset(int *spinlock); - -void __pthread_lock(struct _pthread_fastlock * lock); -int __pthread_trylock(struct _pthread_fastlock * lock); -int __pthread_unlock(struct _pthread_fastlock * lock); - -int __clone(void* (*fn)(void*), void* stack, int flags, void *arg); - -int __find_thread_id(int pid); -_pthread_descr __get_thread_struct(int id); - -_pthread_descr __thread_get_free(); -_pthread_descr __thread_self(); - -void __thread_cleanup(_pthread_descr th); - -void __thread_wait_some_time(); - -#define __NO_ASYNC_CANCEL_BEGIN { int oldtype; pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); -#define __NO_ASYNC_CANCEL_END pthread_setcanceltype(oldtype,0); pthread_testcancel(); } -#define __NO_ASYNC_CANCEL_STOP pthread_setcanceltype(oldtype,0); } - -/* manager thread stuff */ -int signal_manager_thread(_pthread_descr td); - -/* init stuff */ -extern pthread_once_t __thread_inited; -void __thread_init(); -#define __THREAD_INIT() __pthread_once(&__thread_inited, __thread_init) -#define __TEST_CANCEL() pthread_testcancel() - -/* diet libc syscalls */ - -void __libc_free(void *ptr); -void *__libc_malloc(size_t size); - -void __libc_closelog(void); -void __libc_openlog(const char *ident, int option, int facility); -void __libc_vsyslog(int priority, const char *format, va_list arg_ptr); - -pid_t __libc_fork(void); - -int __libc_close(int fd); -int __libc_creat(const char *pathname, mode_t mode); -int __libc_fcntl(int fd, int cmd, void *arg); -int __libc_fsync(int fd); -int __libc_nanosleep(const struct timespec *req, struct timespec *rem); -int __libc_open(const char *pathname, int flags, mode_t mode); -int __libc_pause(void); -int __libc_read(int fd, void *buf, size_t count); -int __libc_sigsuspend(const sigset_t *mask); -int __libc_tcdrain(int fd); -pid_t __libc_waitpid(pid_t pid, int *status, int options); -int __libc_write(int fd, const void *buf, size_t count); - -#endif diff --git a/mdk-stage1/dietlibc/libpthread/thread_key.c b/mdk-stage1/dietlibc/libpthread/thread_key.c deleted file mode 100644 index b0f719fc9..000000000 --- a/mdk-stage1/dietlibc/libpthread/thread_key.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <unistd.h> -#include <errno.h> - -#include <pthread.h> -#include "thread_internal.h" - -struct _pthread_fastlock __thread_keys_lock; -struct _thread_key __thread_keys[PTHREAD_KEYS_MAX]; - -void __thread_start__key(int id) -{ - int i; - - __NO_ASYNC_CANCEL_BEGIN; - __pthread_lock(&__thread_keys_lock); - - for (i=0; i<PTHREAD_KEYS_MAX; i++) { - __thread_keys[i].tkd[id]=0; - } - - __pthread_unlock(&__thread_keys_lock); - __NO_ASYNC_CANCEL_END; -} - -void __thread_exit__key(int id) -{ - int i,try; - - __NO_ASYNC_CANCEL_BEGIN; - __pthread_lock(&__thread_keys_lock); - - for (i=0; i<PTHREAD_KEYS_MAX; i++) { - if ((__thread_keys[i].used) && (__thread_keys[i].destructor)) { - for (try=0;__thread_keys[i].tkd[id] && (try<PTHREAD_DESTRUCTOR_ITERATIONS);++try) - __thread_keys[i].destructor(__thread_keys[i].tkd[id]); - } - } - - __pthread_unlock(&__thread_keys_lock); - __NO_ASYNC_CANCEL_STOP; -} diff --git a/mdk-stage1/dietlibc/libregex/rx.c b/mdk-stage1/dietlibc/libregex/rx.c deleted file mode 100644 index b28358c2e..000000000 --- a/mdk-stage1/dietlibc/libregex/rx.c +++ /dev/null @@ -1,434 +0,0 @@ -#include <regex.h> -#include <stdlib.h> -#include <ctype.h> -#include <sys/types.h> -#include <string.h> - -/* this is ugly. - * the idea is to build a parse tree, then do some poor man's OOP with a - * generic matcher function call that is always that the start of each - * record, and a next pointer. When the parse tree is done, we need to - * recursively set the next pointers to point to the part of the parse - * tree that needs to match next. - * This is the prototype of the generic match function call pointer. - * The first argument is the "this" pointer, the second is the text to - * be matched against, ofs is the offset from the start of the matched - * text (so we can match "^") and matches is an array where match - * positions are stored. */ -/* now declared in regex.h: */ -/* typedef int (*matcher)(void*,const char*,int ofs,regmatch_t* matches,int plus,int eflags); */ - -/* one would think that this is approach is an order of magnitude slower - * than the standard NFA approach, but it isn't. The busybox grep took - * 0.26 seconds for a fixed string compared to 0.19 seconds for the - * glibc regex. */ - -/* first part: parse a regex into a parse tree */ -struct bracketed { - unsigned int cc[32]; -}; - -/* now declared in regex.h: -struct regex { - matcher m; - void* next; - int pieces; - int num; - struct branch *b; -}; */ - -struct atom { - matcher m; - void* next; - enum { EMPTY, REGEX, BRACKET, ANY, LINESTART, LINEEND, WORDSTART, WORDEND, CHAR, } type; - int bnum; - union { - struct regex r; - struct bracketed b; - char c; - } u; -}; - -struct piece { - matcher m; - void* next; - struct atom a; - unsigned char min,max; -}; - -struct branch { - matcher m; - void* next; - int num; - struct piece *p; -}; - -static void clearcc(unsigned int* x) { - memset(x,0,sizeof(*x)); -} - -static void setcc(unsigned int* x,unsigned int bit) { - x[bit/32]|=(1<<((bit%32)-1)); -} - -static int issetcc(unsigned int* x,unsigned int bit) { - return x[bit/32] & (1<<((bit%32)-1)); -} - -static const char* parsebracketed(struct bracketed*__restrict__ b,const char*__restrict__ s,regex_t*__restrict__ rx) { - const char* t; - int i,negflag=0; - if (*s!='[') return s; - t=s+1; - clearcc(b->cc); - if (*t=='^') { negflag=1; ++t; } - do { - if (*t==0) return s; - setcc(b->cc,rx->cflags®_ICASE?*t:tolower(*t)); - if (t[1]=='-' && t[2]!=']') { - for (i=*t+1; i<=t[2]; ++i) setcc(b->cc,rx->cflags®_ICASE?i:tolower(i)); - t+=2; - } - ++t; - } while (*t!=']'); - if (negflag) for (i=0; i<32; ++i) b->cc[i]=~b->cc[i]; - return t+1; -} - -static const char* parseregex(struct regex* r,const char* s,regex_t* rx); - -static int matchatom(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) { - register struct atom* a=(struct atom*)x; - int matchlen=0; - switch (a->type) { - case EMPTY: -// printf("matching EMPTY against \"%s\"\n",s); - preg->l[a->bnum].rm_so=preg->l[a->bnum].rm_eo=ofs; - goto match; - case REGEX: -// printf("matching REGEX against \"%s\"\n",s); - if ((matchlen=a->u.r.m(a,s,ofs,preg,0,eflags))>=0) { - preg->l[a->bnum].rm_so=ofs; - preg->l[a->bnum].rm_eo=ofs+matchlen; - goto match; - } - break; - case BRACKET: -// printf("matching BRACKET against \"%s\"\n",s); - matchlen=1; - if (*s=='\n' && (preg->cflags®_NEWLINE)) break; - if (*s && issetcc(a->u.b.cc,(preg->cflags®_ICASE?tolower(*s):*s))) - goto match; - break; - case ANY: -// printf("matching ANY against \"%s\"\n",s); - if (*s=='\n' && (preg->cflags®_NEWLINE)) break; - matchlen=1; - if (*s) goto match; - break; - case LINESTART: -// printf("matching LINESTART against \"%s\"\n",s); - if (ofs==0 && (eflags®_NOTBOL)==0) { - goto match; - } - break; - case LINEEND: -// printf("matching LINEEND against \"%s\"\n",s); - if ((*s && *s!='\n') || (eflags®_NOTEOL)==0) break; - goto match; - case WORDSTART: - if ((ofs==0 || isspace(s[-1])) && !isspace(*s)) - goto match; - break; - case WORDEND: - if (ofs>0 && !isspace(s[-1]) && isspace(*s)) - goto match; - break; - case CHAR: -// printf("matching CHAR %c against \"%s\"\n",a->u.c,s); - matchlen=1; - if (((preg->cflags®_ICASE)?tolower(*s):*s)==a->u.c) goto match; - break; - } - return -1; -match: - if (a->next) - return ((struct atom*)(a->next))->m(a->next,s+matchlen,ofs+matchlen,preg,plus+matchlen,eflags); - else - return plus+matchlen; -} - -static const char* parseatom(struct atom*__restrict__ a,const char*__restrict__ s,regex_t*__restrict__ rx) { - const char *tmp; - a->m=matchatom; - a->bnum=-1; - switch (*s) { - case '(': - a->bnum=++rx->brackets; - if (s[1]==')') { - a->type=EMPTY; - return s+2; - } - a->type=REGEX; - if ((tmp=parseregex(&a->u.r,s+1,rx))!=s) { - if (*tmp==')') - return tmp+1; - } - case 0: - case '|': - case ')': - return s; - case '[': - a->type=BRACKET; - if ((tmp=parsebracketed(&a->u.b,s,rx))!=s) - return tmp; - return s; - case '.': - a->type=ANY; - break; - case '^': - a->type=LINESTART; - break; - case '$': - a->type=LINEEND; - break; - case '\\': - if (!*++s) return s; - if (*s=='<') { - a->type=WORDSTART; - break; - } else if (*s=='>') { - a->type=WORDEND; - break; - } - default: - a->type=CHAR; - a->u.c=rx->cflags®_ICASE?*s:tolower(*s); - break; - } - return s+1; -} - -/* needs to do "greedy" matching, i.e. match as often as possible */ -static int matchpiece(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) { - register struct piece* a=(struct piece*)x; - int matchlen=0; - int tmp,num=0; - unsigned int *offsets=alloca(sizeof(int)*a->max); - offsets[0]=0; -// printf("matchpiece \"%s\"...\n",s); - /* first, try to match the atom as often as possible, up to a->max times */ - if (a->max == 1 && a->min == 1) - return a->a.m(&a->a,s+matchlen,ofs+matchlen,preg,0,eflags); - while (num<a->max) { - void* save=a->a.next; - a->a.next=0; - if ((tmp=a->a.m(&a->a,s+matchlen,ofs+matchlen,preg,0,eflags))>=0) { - a->a.next=save; - ++num; - matchlen+=tmp; - offsets[num]=tmp; - } else { - a->a.next=save; - break; - } - } - if (num<a->min) return -1; /* already at minimum matches; signal mismatch */ - /* then, while the rest does not match, back off */ - for (;;) { - if (a->next) - tmp=((struct atom*)(a->next))->m(a->next,s+matchlen,ofs+matchlen,preg,plus+matchlen,eflags); - else - tmp=plus+matchlen; - if (tmp>=0) break; /* it did match; don't back off any further */ - matchlen-=offsets[num]; - --num; - } - return tmp; -} - -static const char* parsepiece(struct piece*__restrict__ p,const char*__restrict__ s,regex_t*__restrict__ rx) { - const char* tmp=parseatom(&p->a,s,rx); - if (tmp==s) return s; - p->m=matchpiece; - p->min=p->max=1; - switch (*tmp) { - case '*': p->min=0; p->max=RE_DUP_MAX; break; - case '+': p->min=1; p->max=RE_DUP_MAX; break; - case '?': p->min=0; p->max=1; break; - case '{': - if (isdigit(*++tmp)) { - p->min=*tmp-'0'; p->max=RE_DUP_MAX; - while (isdigit(*++tmp)) p->min=p->min*10+*tmp-'0'; - if (*tmp==',') { - if (isdigit(*++tmp)) { - p->max=*tmp-'0'; - while (isdigit(*++tmp)) p->max=p->max*10+*tmp-'0'; - } - } - if (*tmp!='}') return s; - ++tmp; - } - default: - return tmp; - } - return tmp+1; -} - -/* trivial, just pass through */ -static int matchbranch(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) { - register struct branch* a=(struct branch*)x; - int tmp; - tmp=a->p->m(a->p,s,ofs,preg,plus,eflags); - if (tmp>=0) { - if (a->next) - return ((struct atom*)(a->next))->m(a->next,s+tmp,ofs+tmp,preg,plus+tmp,eflags); - else - return plus+tmp; - } - return -1; -} - -static const char* parsebranch(struct branch*__restrict__ b,const char*__restrict__ s,regex_t*__restrict__ rx,int*__restrict__ pieces) { - struct piece p; - const char *tmp; - b->m=matchbranch; - b->num=0; b->p=0; - for (;;) { - if (*s=='|') { - if (b->num==0) { - tmp=s+1; - p.a.type=EMPTY; - p.min=p.max=1; - } - } else { - tmp=parsepiece(&p,s,rx); - if (tmp==s) return s; - } - if (!(b->p=realloc(b->p,++b->num*sizeof(p)))) return s; - b->p[b->num-1]=p; - if (*s=='|') { ++tmp; break; } - s=tmp; - } - *pieces+=b->num; - return tmp; -} - -/* try the branches one by one */ -static int matchregex(void*__restrict__ x,const char*__restrict__ s,int ofs,struct __regex_t*__restrict__ preg,int plus,int eflags) { - register struct regex* a=(struct regex*)x; - int i,tmp; - for (i=0; i<a->num; ++i) { - tmp=a->b[i].m(&a->b[i],s,ofs,preg,plus,eflags); - if (tmp>=0) { - if (a->next) - return ((struct atom*)(a->next))->m(a->next,s+tmp,ofs+tmp,preg,plus+tmp,eflags); - else - return plus+tmp; - } - } - return -1; -} - -static const char* parseregex(struct regex*__restrict__ r,const char*__restrict__ s,regex_t*__restrict__ p) { - struct branch b; - const char *tmp; - r->m=matchregex; - r->num=0; r->b=0; r->pieces=0; - for (;;) { - tmp=parsebranch(&b,s,p,&r->pieces); - if (tmp==s) return s; - if (!(r->b=realloc(r->b,++r->num*sizeof(b)))) return s; - r->b[r->num-1]=b; - s=tmp; - } - return tmp; -} - - -/* The matcher relies on the presence of next pointers, of which the - * parser does not know the correct destination. So we need an - * additional pass through the data structure that sets the next - * pointers correctly. */ -static void regex_putnext(struct regex* r,void* next); - -static void atom_putnext(struct atom*__restrict__ a,void*__restrict__ next) { - a->next=next; - if (a->type==REGEX) - regex_putnext(&a->u.r,next); -} - -static void piece_putnext(struct piece*__restrict__ p,void*__restrict__ next) { - p->next=next; - atom_putnext(&p->a,next); -} - -static void branch_putnext(struct branch*__restrict__ b,void*__restrict__ next) { - int i; - for (i=0; i<b->num-1; ++i) - piece_putnext(&b->p[i],&b->p[i+1]); - piece_putnext(&b->p[i],0); - b->next=next; -} - -static void regex_putnext(struct regex*__restrict__ r,void*__restrict__ next) { - int i; - for (i=0; i<r->num; ++i) - branch_putnext(&r->b[i],next); - r->next=next; -} - - - -int regcomp(regex_t*__restrict__ preg, const char*__restrict__ regex, int cflags) { - const char* t=parseregex(&preg->r,regex,preg); - if (t==regex) return -1; - regex_putnext(&preg->r,0); - preg->cflags=cflags; - return 0; -} - -int regexec(const regex_t*__restrict__ preg, const char*__restrict__ string, size_t nmatch, regmatch_t pmatch[], int eflags) { - int matched; - const char *orig=string; - ((regex_t*)preg)->l=alloca(sizeof(regmatch_t)*(preg->brackets+1)); - while (*string) { - matched=preg->r.m((void*)&preg->r,string,string-orig,(regex_t*)preg,0,eflags); - if (matched>=0) { - if ((preg->cflags®_NOSUB)==0) memmove(pmatch,preg->l,nmatch*sizeof(regmatch_t)); - return 0; - } - ++string; eflags|=REG_NOTBOL; - } - return REG_NOMATCH; -} - - - -void regfree(regex_t* preg) { - int i; - for (i=0; i<preg->r.num; ++i) { - free(preg->r.b[i].p); - free(preg->r.b); - } -} - -size_t regerror(int errcode, const regex_t*__restrict__ preg, char*__restrict__ errbuf, size_t errbuf_size) { - strncpy(errbuf,"invalid regular expression (sorry)",errbuf_size); - return strlen(errbuf); -} - - - - -#if 0 -int main() { - struct regex r; - int bnum=-1; - const char* t=parseregex(&r,"^a*ab$",&bnum); - regex_putnext(&r,0); - printf("%d pieces, %s\n",r.pieces,t); - printf("%d\n",r.m(&r,"aaab",0,0,0)); - return 0; -} -#endif diff --git a/mdk-stage1/dietlibc/librpc/auth_none.c b/mdk-stage1/dietlibc/librpc/auth_none.c deleted file mode 100644 index 7a4dffe87..000000000 --- a/mdk-stage1/dietlibc/librpc/auth_none.c +++ /dev/null @@ -1,128 +0,0 @@ -/* @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * auth_none.c - * Creates a client authentication handle for passing "null" - * credentials and verifiers to remote systems. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/auth.h> -#define MAX_MARSHEL_SIZE 20 - -/* - * Authenticator operations routines - */ -static void authnone_verf(); -static void authnone_destroy(); -static bool_t authnone_marshal(); -static bool_t authnone_validate(); -static bool_t authnone_refresh(); - -static struct auth_ops ops = { - authnone_verf, - authnone_marshal, - authnone_validate, - authnone_refresh, - authnone_destroy -}; - -static struct authnone_private { - AUTH no_client; - char marshalled_client[MAX_MARSHEL_SIZE]; - u_int mcnt; -} *authnone_private; - -AUTH *authnone_create() -{ - register struct authnone_private *ap = authnone_private; - XDR xdr_stream; - register XDR *xdrs; - - if (ap == 0) { - ap = (struct authnone_private *) calloc(1, sizeof(*ap)); - if (ap == 0) - return (0); - authnone_private = ap; - } - if (!ap->mcnt) { - ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth; - ap->no_client.ah_ops = &ops; - xdrs = &xdr_stream; - xdrmem_create(xdrs, ap->marshalled_client, - (u_int) MAX_MARSHEL_SIZE, XDR_ENCODE); - (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred); - (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf); - ap->mcnt = XDR_GETPOS(xdrs); - XDR_DESTROY(xdrs); - } - return (&ap->no_client); -} - - /*ARGSUSED*/ static bool_t authnone_marshal(client, xdrs) -AUTH *client; -XDR *xdrs; -{ - register struct authnone_private *ap = authnone_private; - - if (ap == 0) - return (0); - return ((*xdrs->x_ops->x_putbytes) (xdrs, - ap->marshalled_client, ap->mcnt)); -} - -static void authnone_verf() -{ -} - -static bool_t authnone_validate() -{ - - return (TRUE); -} - -static bool_t authnone_refresh() -{ - - return (FALSE); -} - -static void authnone_destroy() -{ -} diff --git a/mdk-stage1/dietlibc/librpc/auth_unix.c b/mdk-stage1/dietlibc/librpc/auth_unix.c deleted file mode 100644 index 5daeb5f4a..000000000 --- a/mdk-stage1/dietlibc/librpc/auth_unix.c +++ /dev/null @@ -1,313 +0,0 @@ -/* @(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * auth_unix.c, Implements UNIX style authentication parameters. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * The system is very weak. The client uses no encryption for it's - * credentials and only sends null verifiers. The server sends backs - * null verifiers or optionally a verifier that suggests a new short hand - * for the credentials. - * - */ - -#include <stdio.h> -#include <unistd.h> -#include <sys/types.h> -#include <string.h> - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/auth.h> -#include <rpc/auth_unix.h> - -/* - * Unix authenticator operations vector - */ -static void authunix_nextverf(); -static bool_t authunix_marshal(); -static bool_t authunix_validate(); -static bool_t authunix_refresh(); -static void authunix_destroy(); - -static struct auth_ops auth_unix_ops = { - authunix_nextverf, - authunix_marshal, - authunix_validate, - authunix_refresh, - authunix_destroy -}; - -/* - * This struct is pointed to by the ah_private field of an auth_handle. - */ -struct audata { - struct opaque_auth au_origcred; /* original credentials */ - struct opaque_auth au_shcred; /* short hand cred */ - u_long au_shfaults; /* short hand cache faults */ - char au_marshed[MAX_AUTH_BYTES]; - u_int au_mpos; /* xdr pos at end of marshed */ -}; - -#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private) - -static void marshal_new_auth(); - - -/* - * Create a unix style authenticator. - * Returns an auth handle with the given stuff in it. - */ -AUTH *authunix_create __P ((char *machname, uid_t uid, - gid_t gid, int len, - gid_t *aup_gids)) -{ - struct authunix_parms aup; - char mymem[MAX_AUTH_BYTES]; - struct timeval now; - XDR xdrs; - register AUTH *auth; - register struct audata *au; - - /* - * Allocate and set up auth handle - */ - auth = (AUTH *) mem_alloc(sizeof(*auth)); -#ifndef KERNEL - if (auth == NULL) { - (void) fprintf(stderr, "authunix_create: out of memory\n"); - return (NULL); - } -#endif - au = (struct audata *) mem_alloc(sizeof(*au)); -#ifndef KERNEL - if (au == NULL) { - (void) fprintf(stderr, "authunix_create: out of memory\n"); - return (NULL); - } -#endif - auth->ah_ops = &auth_unix_ops; - auth->ah_private = (caddr_t) au; - auth->ah_verf = au->au_shcred = _null_auth; - au->au_shfaults = 0; - - /* - * fill in param struct from the given params - */ - (void) gettimeofday(&now, (struct timezone *) 0); - aup.aup_time = now.tv_sec; - aup.aup_machname = machname; - aup.aup_uid = uid; - aup.aup_gid = gid; - aup.aup_len = (u_int) len; - aup.aup_gids = aup_gids; - - /* - * Serialize the parameters into origcred - */ - xdrmem_create(&xdrs, mymem, MAX_AUTH_BYTES, XDR_ENCODE); - if (!xdr_authunix_parms(&xdrs, &aup)) - abort(); - au->au_origcred.oa_length = len = XDR_GETPOS(&xdrs); - au->au_origcred.oa_flavor = AUTH_UNIX; -#ifdef KERNEL - au->au_origcred.oa_base = mem_alloc((u_int) len); -#else - if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) { - (void) fprintf(stderr, "authunix_create: out of memory\n"); - return (NULL); - } -#endif - bcopy(mymem, au->au_origcred.oa_base, (u_int) len); - - /* - * set auth handle to reflect new cred. - */ - auth->ah_cred = au->au_origcred; - marshal_new_auth(auth); - return (auth); -} - -/* - * Returns an auth handle with parameters determined by doing lots of - * syscalls. - */ -AUTH *authunix_create_default() -{ - register int len; - char machname[MAX_MACHINE_NAME + 1]; - register int uid; - register int gid; - gid_t gids[NGRPS]; - - if (gethostname(machname, MAX_MACHINE_NAME) == -1) - abort(); - machname[MAX_MACHINE_NAME] = 0; - uid = geteuid(); - gid = getegid(); - if ((len = getgroups(NGRPS, gids)) < 0) - abort(); - return (authunix_create(machname, uid, gid, len, gids)); -} - -/* - * authunix operations - */ - -static void authunix_nextverf(auth) -AUTH *auth; -{ - /* no action necessary */ -} - -static bool_t authunix_marshal(auth, xdrs) -AUTH *auth; -XDR *xdrs; -{ - register struct audata *au = AUTH_PRIVATE(auth); - - return (XDR_PUTBYTES(xdrs, au->au_marshed, au->au_mpos)); -} - -static bool_t authunix_validate(auth, verf) -register AUTH *auth; -struct opaque_auth verf; -{ - register struct audata *au; - XDR xdrs; - - if (verf.oa_flavor == AUTH_SHORT) { - au = AUTH_PRIVATE(auth); - xdrmem_create(&xdrs, verf.oa_base, verf.oa_length, XDR_DECODE); - - if (au->au_shcred.oa_base != NULL) { - mem_free(au->au_shcred.oa_base, au->au_shcred.oa_length); - au->au_shcred.oa_base = NULL; - } - if (xdr_opaque_auth(&xdrs, &au->au_shcred)) { - auth->ah_cred = au->au_shcred; - } else { - xdrs.x_op = XDR_FREE; - (void) xdr_opaque_auth(&xdrs, &au->au_shcred); - au->au_shcred.oa_base = NULL; - auth->ah_cred = au->au_origcred; - } - marshal_new_auth(auth); - } - return (TRUE); -} - -static bool_t authunix_refresh(auth) -register AUTH *auth; -{ - register struct audata *au = AUTH_PRIVATE(auth); - struct authunix_parms aup; - struct timeval now; - XDR xdrs; - register int stat; - - if (auth->ah_cred.oa_base == au->au_origcred.oa_base) { - /* there is no hope. Punt */ - return (FALSE); - } - au->au_shfaults++; - - /* first deserialize the creds back into a struct authunix_parms */ - aup.aup_machname = NULL; - aup.aup_gids = (gid_t *) NULL; - xdrmem_create(&xdrs, au->au_origcred.oa_base, - au->au_origcred.oa_length, XDR_DECODE); - stat = xdr_authunix_parms(&xdrs, &aup); - if (!stat) - goto done; - - /* update the time and serialize in place */ - (void) gettimeofday(&now, (struct timezone *) 0); - aup.aup_time = now.tv_sec; - xdrs.x_op = XDR_ENCODE; - XDR_SETPOS(&xdrs, 0); - stat = xdr_authunix_parms(&xdrs, &aup); - if (!stat) - goto done; - auth->ah_cred = au->au_origcred; - marshal_new_auth(auth); - done: - /* free the struct authunix_parms created by deserializing */ - xdrs.x_op = XDR_FREE; - (void) xdr_authunix_parms(&xdrs, &aup); - XDR_DESTROY(&xdrs); - return (stat); -} - -static void authunix_destroy(auth) -register AUTH *auth; -{ - register struct audata *au = AUTH_PRIVATE(auth); - - mem_free(au->au_origcred.oa_base, au->au_origcred.oa_length); - - if (au->au_shcred.oa_base != NULL) - mem_free(au->au_shcred.oa_base, au->au_shcred.oa_length); - - mem_free(auth->ah_private, sizeof(struct audata)); - - if (auth->ah_verf.oa_base != NULL) - mem_free(auth->ah_verf.oa_base, auth->ah_verf.oa_length); - - mem_free((caddr_t) auth, sizeof(*auth)); -} - -/* - * Marshals (pre-serializes) an auth struct. - * sets private data, au_marshed and au_mpos - */ -static void marshal_new_auth(auth) -register AUTH *auth; -{ - XDR xdr_stream; - register XDR *xdrs = &xdr_stream; - register struct audata *au = AUTH_PRIVATE(auth); - - xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE); - if ((!xdr_opaque_auth(xdrs, &(auth->ah_cred))) || - (!xdr_opaque_auth(xdrs, &(auth->ah_verf)))) { - perror("auth_none.c - Fatal marshalling problem"); - } else { - au->au_mpos = XDR_GETPOS(xdrs); - } - XDR_DESTROY(xdrs); -} diff --git a/mdk-stage1/dietlibc/librpc/authunix_prot.c b/mdk-stage1/dietlibc/librpc/authunix_prot.c deleted file mode 100644 index ddcadb808..000000000 --- a/mdk-stage1/dietlibc/librpc/authunix_prot.c +++ /dev/null @@ -1,69 +0,0 @@ -/* @(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * authunix_prot.c - * XDR for UNIX style authentication parameters for RPC - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/auth.h> -#include <rpc/auth_unix.h> - -/* - * XDR for unix authentication parameters. - */ -bool_t xdr_authunix_parms(xdrs, p) -register XDR *xdrs; -register struct authunix_parms *p; -{ - int a,b; - - if (xdr_u_long(xdrs, &(p->aup_time)) - && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME) - && xdr_int(xdrs, &a) - && xdr_int(xdrs, &b) - && xdr_array(xdrs, (caddr_t *) & (p->aup_gids), - &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int)) { - p->aup_uid=(uid_t)a; - p->aup_gid=(gid_t)b; - return (TRUE); - } - return (FALSE); -} diff --git a/mdk-stage1/dietlibc/librpc/bindresvport.c b/mdk-stage1/dietlibc/librpc/bindresvport.c deleted file mode 100644 index 8b65261dd..000000000 --- a/mdk-stage1/dietlibc/librpc/bindresvport.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * Copyright (c) 1987 by Sun Microsystems, Inc. - */ - -#include <unistd.h> -#include <string.h> -#include <sys/types.h> -#include <errno.h> -#include <sys/socket.h> -#include <netinet/in.h> - -/* - * Bind a socket to a privileged IP port - */ -int bindresvport(sd, sin) -int sd; -struct sockaddr_in *sin; -{ - int res; - static short port; - struct sockaddr_in myaddr; - extern int errno; - int i; - -#define STARTPORT 600 -#define ENDPORT (IPPORT_RESERVED - 1) -#define NPORTS (ENDPORT - STARTPORT + 1) - - if (sin == (struct sockaddr_in *) 0) { - sin = &myaddr; - bzero(sin, sizeof(*sin)); - sin->sin_family = AF_INET; - } else if (sin->sin_family != AF_INET) { - errno = EPFNOSUPPORT; - return (-1); - } - if (port == 0) { - port = (getpid() % NPORTS) + STARTPORT; - } - res = -1; - errno = EADDRINUSE; - for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) { - sin->sin_port = htons(port++); - if (port > ENDPORT) { - port = STARTPORT; - } - res = bind(sd, (struct sockaddr*)sin, sizeof(struct sockaddr_in)); - } - return (res); -} diff --git a/mdk-stage1/dietlibc/librpc/clnt_generic.c b/mdk-stage1/dietlibc/librpc/clnt_generic.c deleted file mode 100644 index 9bb81cc80..000000000 --- a/mdk-stage1/dietlibc/librpc/clnt_generic.c +++ /dev/null @@ -1,112 +0,0 @@ -/* @(#)clnt_generic.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI"; -#endif -/* - * Copyright (C) 1987, Sun Microsystems, Inc. - */ -#include <rpc/rpc.h> -#include <sys/socket.h> -#include <errno.h> -#include <netdb.h> -#include <string.h> - -/* - * Generic client creation: takes (hostname, program-number, protocol) and - * returns client handle. Default options are set, which the user can - * change using the rpc equivalent of ioctl()'s. - */ -CLIENT *clnt_create __P ((const char *hostname, const u_long prog, - const u_long vers, const char *proto)) -{ - struct hostent *h; - struct protoent *p; - struct sockaddr_in sin; - int sock; - struct timeval tv; - CLIENT *client; - - h = gethostbyname(hostname); - if (h == NULL) { - rpc_createerr.cf_stat = RPC_UNKNOWNHOST; - return (NULL); - } - if (h->h_addrtype != AF_INET) { - /* - * Only support INET for now - */ - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = EAFNOSUPPORT; - return (NULL); - } -#ifdef __linux__ - bzero((char *) &sin, sizeof(sin)); -#endif - sin.sin_family = h->h_addrtype; - sin.sin_port = 0; -#ifndef __linux__ - bzero(sin.sin_zero, sizeof(sin.sin_zero)); -#endif - bcopy(h->h_addr, (char *) &sin.sin_addr, h->h_length); - p = getprotobyname(proto); - if (p == NULL) { - rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; - rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; - return (NULL); - } - sock = RPC_ANYSOCK; - switch (p->p_proto) { - case IPPROTO_UDP: - tv.tv_sec = 5; - tv.tv_usec = 0; - client = clntudp_create(&sin, prog, vers, tv, &sock); - if (client == NULL) { - return (NULL); - } - tv.tv_sec = 25; - clnt_control(client, CLSET_TIMEOUT, (char*)&tv); - break; - case IPPROTO_TCP: - client = clnttcp_create(&sin, prog, vers, &sock, 0, 0); - if (client == NULL) { - return (NULL); - } - tv.tv_sec = 25; - tv.tv_usec = 0; - clnt_control(client, CLSET_TIMEOUT, (char*)&tv); - break; - default: - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; - return (NULL); - } - return (client); -} diff --git a/mdk-stage1/dietlibc/librpc/clnt_perror.c b/mdk-stage1/dietlibc/librpc/clnt_perror.c deleted file mode 100644 index 4ede1a43e..000000000 --- a/mdk-stage1/dietlibc/librpc/clnt_perror.c +++ /dev/null @@ -1,302 +0,0 @@ -/* @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro"; -#endif - -/* - * clnt_perror.c - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - */ -#include <stdio.h> - -#include <rpc/types.h> -#include <rpc/auth.h> -#include <rpc/clnt.h> - -//extern char *sys_errlist[]; -//static char *auth_errmsg(); - -extern char *strcpy(); - -#if 0 -static char *buf; - -static char *_buf() -{ - - if (buf == 0) - buf = (char *) malloc(256); - return (buf); -} -#endif - -/* - * Print reply error info - */ -char *clnt_sperror __P ((CLIENT *rpch, const char *s)) -{ -#if 0 - struct rpc_err e; - void clnt_perrno(); - char *err; - char *str = _buf(); - char *strstart = str; - - if (str == 0) - return (0); - CLNT_GETERR(rpch, &e); - - (void) sprintf(str, "%s: ", s); - str += strlen(str); - - (void) strcpy(str, clnt_sperrno(e.re_status)); - str += strlen(str); - - switch (e.re_status) { - case RPC_SUCCESS: - case RPC_CANTENCODEARGS: - case RPC_CANTDECODERES: - case RPC_TIMEDOUT: - case RPC_PROGUNAVAIL: - case RPC_PROCUNAVAIL: - case RPC_CANTDECODEARGS: - case RPC_SYSTEMERROR: - case RPC_UNKNOWNHOST: - case RPC_UNKNOWNPROTO: - case RPC_PMAPFAILURE: - case RPC_PROGNOTREGISTERED: - case RPC_FAILED: - break; - - case RPC_CANTSEND: - case RPC_CANTRECV: - (void) sprintf(str, "; errno = %s", sys_errlist[e.re_errno]); - str += strlen(str); - break; - - case RPC_VERSMISMATCH: - (void) sprintf(str, - "; low version = %lu, high version = %lu", - e.re_vers.low, e.re_vers.high); - str += strlen(str); - break; - - case RPC_AUTHERROR: - err = auth_errmsg(e.re_why); - (void) sprintf(str, "; why = "); - str += strlen(str); - if (err != NULL) { - (void) sprintf(str, "%s", err); - } else { - (void) sprintf(str, - "(unknown authentication error - %d)", - (int) e.re_why); - } - str += strlen(str); - break; - - case RPC_PROGVERSMISMATCH: - (void) sprintf(str, - "; low version = %lu, high version = %lu", - e.re_vers.low, e.re_vers.high); - str += strlen(str); - break; - - default: /* unknown */ - (void) sprintf(str, - "; s1 = %lu, s2 = %lu", e.re_lb.s1, e.re_lb.s2); - str += strlen(str); - break; - } - (void) sprintf(str, "\n"); - return (strstart); -#endif - return (0); -} - -void clnt_perror __P ((CLIENT *rpch, const char *s)) -{ - (void) fprintf(stderr, "%s", clnt_sperror(rpch, s)); -} - - -struct rpc_errtab { - enum clnt_stat status; - char *message; -}; - -#if 0 -static struct rpc_errtab rpc_errlist[] = { - {RPC_SUCCESS, - "RPC: Success"}, - {RPC_CANTENCODEARGS, - "RPC: Can't encode arguments"}, - {RPC_CANTDECODERES, - "RPC: Can't decode result"}, - {RPC_CANTSEND, - "RPC: Unable to send"}, - {RPC_CANTRECV, - "RPC: Unable to receive"}, - {RPC_TIMEDOUT, - "RPC: Timed out"}, - {RPC_VERSMISMATCH, - "RPC: Incompatible versions of RPC"}, - {RPC_AUTHERROR, - "RPC: Authentication error"}, - {RPC_PROGUNAVAIL, - "RPC: Program unavailable"}, - {RPC_PROGVERSMISMATCH, - "RPC: Program/version mismatch"}, - {RPC_PROCUNAVAIL, - "RPC: Procedure unavailable"}, - {RPC_CANTDECODEARGS, - "RPC: Server can't decode arguments"}, - {RPC_SYSTEMERROR, - "RPC: Remote system error"}, - {RPC_UNKNOWNHOST, - "RPC: Unknown host"}, - {RPC_UNKNOWNPROTO, - "RPC: Unknown protocol"}, - {RPC_PMAPFAILURE, - "RPC: Port mapper failure"}, - {RPC_PROGNOTREGISTERED, - "RPC: Program not registered"}, - {RPC_FAILED, - "RPC: Failed (unspecified error)"} -}; -#endif - -/* - * This interface for use by clntrpc - */ -char *clnt_sperrno(stat) -enum clnt_stat stat; -{ -#if 0 - int i; - - for (i = 0; i < sizeof(rpc_errlist) / sizeof(struct rpc_errtab); i++) { - if (rpc_errlist[i].status == stat) { - return (rpc_errlist[i].message); - } - } -#endif - return ("RPC: (unknown error code)"); -} - -void clnt_perrno(num) -enum clnt_stat num; -{ - (void) fprintf(stderr, "%s", clnt_sperrno(num)); -} - - -char *clnt_spcreateerror __P ((__const char *s)) -{ -#if 0 - extern int sys_nerr; - extern char *sys_errlist[]; - char *str = _buf(); - - if (str == 0) - return (0); - (void) sprintf(str, "%s: ", s); - (void) strcat(str, clnt_sperrno(rpc_createerr.cf_stat)); - switch (rpc_createerr.cf_stat) { - case RPC_PMAPFAILURE: - (void) strcat(str, " - "); - (void) strcat(str, clnt_sperrno(rpc_createerr.cf_error.re_status)); - break; - - case RPC_SYSTEMERROR: - (void) strcat(str, " - "); - if (rpc_createerr.cf_error.re_errno > 0 - && rpc_createerr.cf_error.re_errno < sys_nerr) - (void) strcat(str, - sys_errlist[rpc_createerr.cf_error.re_errno]); - else - (void) sprintf(&str[strlen(str)], "Error %d", - rpc_createerr.cf_error.re_errno); - break; - } - (void) strcat(str, "\n"); - return (str); -#endif - return(0); -} - -extern void clnt_pcreateerror __P ((__const char *s)) -{ - (void) fprintf(stderr, "%s", clnt_spcreateerror(s)); -} - -struct auth_errtab { - enum auth_stat status; - char *message; -}; - -#if 0 -static struct auth_errtab auth_errlist[] = { - {AUTH_OK, - "Authentication OK"}, - {AUTH_BADCRED, - "Invalid client credential"}, - {AUTH_REJECTEDCRED, - "Server rejected credential"}, - {AUTH_BADVERF, - "Invalid client verifier"}, - {AUTH_REJECTEDVERF, - "Server rejected verifier"}, - {AUTH_TOOWEAK, - "Client credential too weak"}, - {AUTH_INVALIDRESP, - "Invalid server verifier"}, - {AUTH_FAILED, - "Failed (unspecified error)"}, -}; - -static char *auth_errmsg(stat) -enum auth_stat stat; -{ - int i; - - for (i = 0; i < sizeof(auth_errlist) / sizeof(struct auth_errtab); i++) { - if (auth_errlist[i].status == stat) { - return (auth_errlist[i].message); - } - } - return (NULL); -} -#endif diff --git a/mdk-stage1/dietlibc/librpc/clnt_raw.c b/mdk-stage1/dietlibc/librpc/clnt_raw.c deleted file mode 100644 index 7479b55d6..000000000 --- a/mdk-stage1/dietlibc/librpc/clnt_raw.c +++ /dev/null @@ -1,230 +0,0 @@ -/* @(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * clnt_raw.c - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * Memory based rpc for simple testing and timing. - * Interface to create an rpc client and server in the same process. - * This lets us similate rpc and get round trip overhead, without - * any interference from the kernal. - */ - -#include <rpc/rpc.h> - -#define MCALL_MSG_SIZE 24 - -/* - * This is the "network" we will be moving stuff over. - */ -static struct clntraw_private { - CLIENT client_object; - XDR xdr_stream; - char _raw_buf[UDPMSGSIZE]; - char mashl_callmsg[MCALL_MSG_SIZE]; - u_int mcnt; -} *clntraw_private; - -static enum clnt_stat clntraw_call(); -static void clntraw_abort(); -static void clntraw_geterr(); -static bool_t clntraw_freeres(); -static bool_t clntraw_control(); -static void clntraw_destroy(); - -static struct clnt_ops client_ops = { - clntraw_call, - clntraw_abort, - clntraw_geterr, - clntraw_freeres, - clntraw_destroy, - clntraw_control -}; - -void svc_getreq(); - -/* - * Create a client handle for memory based rpc. - */ -CLIENT *clntraw_create(prog, vers) -u_long prog; -u_long vers; -{ - register struct clntraw_private *clp = clntraw_private; - struct rpc_msg call_msg; - XDR *xdrs = &clp->xdr_stream; - CLIENT *client = &clp->client_object; - - if (clp == 0) { - clp = (struct clntraw_private *) calloc(1, sizeof(*clp)); - if (clp == 0) - return (0); - clntraw_private = clp; - } - /* - * pre-serialize the staic part of the call msg and stash it away - */ - call_msg.rm_direction = CALL; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - call_msg.rm_call.cb_prog = prog; - call_msg.rm_call.cb_vers = vers; - xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); - if (!xdr_callhdr(xdrs, &call_msg)) { - perror("clnt_raw.c - Fatal header serialization error."); - } - clp->mcnt = XDR_GETPOS(xdrs); - XDR_DESTROY(xdrs); - - /* - * Set xdrmem for client/server shared buffer - */ - xdrmem_create(xdrs, clp->_raw_buf, UDPMSGSIZE, XDR_FREE); - - /* - * create client handle - */ - client->cl_ops = &client_ops; - client->cl_auth = authnone_create(); - return (client); -} - -static enum clnt_stat -clntraw_call(h, proc, xargs, argsp, xresults, resultsp, timeout) -CLIENT *h; -u_long proc; -xdrproc_t xargs; -caddr_t argsp; -xdrproc_t xresults; -caddr_t resultsp; -struct timeval timeout; -{ - register struct clntraw_private *clp = clntraw_private; - register XDR *xdrs = &clp->xdr_stream; - struct rpc_msg msg; - enum clnt_stat status; - struct rpc_err error; - - if (clp == 0) - return (RPC_FAILED); - call_again: - /* - * send request - */ - xdrs->x_op = XDR_ENCODE; - XDR_SETPOS(xdrs, 0); - ((struct rpc_msg *) clp->mashl_callmsg)->rm_xid++; - if ((!XDR_PUTBYTES(xdrs, clp->mashl_callmsg, clp->mcnt)) || - (!XDR_PUTLONG(xdrs, (long *) &proc)) || - (!AUTH_MARSHALL(h->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) { - return (RPC_CANTENCODEARGS); - } - (void) XDR_GETPOS(xdrs); /* called just to cause overhead */ - - /* - * We have to call server input routine here because this is - * all going on in one process. Yuk. - */ - svc_getreq(1); - - /* - * get results - */ - xdrs->x_op = XDR_DECODE; - XDR_SETPOS(xdrs, 0); - msg.acpted_rply.ar_verf = _null_auth; - msg.acpted_rply.ar_results.where = resultsp; - msg.acpted_rply.ar_results.proc = xresults; - if (!xdr_replymsg(xdrs, &msg)) - return (RPC_CANTDECODERES); - _seterr_reply(&msg, &error); - status = error.re_status; - - if (status == RPC_SUCCESS) { - if (!AUTH_VALIDATE(h->cl_auth, &msg.acpted_rply.ar_verf)) { - status = RPC_AUTHERROR; - } - } /* end successful completion */ - else { - if (AUTH_REFRESH(h->cl_auth)) - goto call_again; - } /* end of unsuccessful completion */ - - if (status == RPC_SUCCESS) { - if (!AUTH_VALIDATE(h->cl_auth, &msg.acpted_rply.ar_verf)) { - status = RPC_AUTHERROR; - } - if (msg.acpted_rply.ar_verf.oa_base != NULL) { - xdrs->x_op = XDR_FREE; - (void) xdr_opaque_auth(xdrs, &(msg.acpted_rply.ar_verf)); - } - } - - return (status); -} - -static void clntraw_geterr() -{ -} - - -static bool_t clntraw_freeres(cl, xdr_res, res_ptr) -CLIENT *cl; -xdrproc_t xdr_res; -caddr_t res_ptr; -{ - register struct clntraw_private *clp = clntraw_private; - register XDR *xdrs = &clp->xdr_stream; - bool_t rval; - - if (clp == 0) { - rval = (bool_t) RPC_FAILED; - return (rval); - } - xdrs->x_op = XDR_FREE; - return ((*xdr_res) (xdrs, res_ptr)); -} - -static void clntraw_abort() -{ -} - -static bool_t clntraw_control() -{ - return (FALSE); -} - -static void clntraw_destroy() -{ -} diff --git a/mdk-stage1/dietlibc/librpc/clnt_simple.c b/mdk-stage1/dietlibc/librpc/clnt_simple.c deleted file mode 100644 index f309f86ff..000000000 --- a/mdk-stage1/dietlibc/librpc/clnt_simple.c +++ /dev/null @@ -1,116 +0,0 @@ -/* @(#)clnt_simple.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * clnt_simple.c - * Simplified front end to rpc. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <stdio.h> -#include <unistd.h> -#include <rpc/rpc.h> -#include <sys/socket.h> -#include <netdb.h> -#include <string.h> - -static struct callrpc_private { - CLIENT *client; - int socket; - int oldprognum, oldversnum, valid; - char *oldhost; -} *callrpc_private; - -int callrpc (const char *host, const u_long prognum, - const u_long versnum, const u_long procnum, - const xdrproc_t inproc, const char *in, - const xdrproc_t outproc, char *out) -{ - register struct callrpc_private *crp = callrpc_private; - struct sockaddr_in server_addr; - enum clnt_stat clnt_stat; - struct hostent *hp; - struct timeval timeout, tottimeout; - - if (crp == 0) { - crp = (struct callrpc_private *) calloc(1, sizeof(*crp)); - if (crp == 0) - return (0); - callrpc_private = crp; - } - if (crp->oldhost == NULL) { - crp->oldhost = malloc(256); - crp->oldhost[0] = 0; - crp->socket = RPC_ANYSOCK; - } - if (crp->valid && crp->oldprognum == prognum - && crp->oldversnum == versnum && strcmp(crp->oldhost, host) == 0) { - /* reuse old client */ - } else { - crp->valid = 0; - (void) close(crp->socket); - crp->socket = RPC_ANYSOCK; - if (crp->client) { - clnt_destroy(crp->client); - crp->client = NULL; - } - if ((hp = gethostbyname(host)) == NULL) - return ((int) RPC_UNKNOWNHOST); - timeout.tv_usec = 0; - timeout.tv_sec = 5; - bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length); - server_addr.sin_family = AF_INET; - server_addr.sin_port = 0; - if ((crp->client = clntudp_create(&server_addr, (u_long) prognum, - (u_long) versnum, timeout, - &crp->socket)) == NULL) - return ((int) rpc_createerr.cf_stat); - crp->valid = 1; - crp->oldprognum = prognum; - crp->oldversnum = versnum; - (void) strcpy(crp->oldhost, host); - } - tottimeout.tv_sec = 25; - tottimeout.tv_usec = 0; - clnt_stat = clnt_call(crp->client, procnum, inproc, (char*)in, - outproc, out, tottimeout); - /* - * if call failed, empty cache - */ - if (clnt_stat != RPC_SUCCESS) - crp->valid = 0; - return ((int) clnt_stat); -} diff --git a/mdk-stage1/dietlibc/librpc/clnt_tcp.c b/mdk-stage1/dietlibc/librpc/clnt_tcp.c deleted file mode 100644 index 8c39e8933..000000000 --- a/mdk-stage1/dietlibc/librpc/clnt_tcp.c +++ /dev/null @@ -1,463 +0,0 @@ -/* @(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; -#endif - -/* - * clnt_tcp.c, Implements a TCP/IP based, client side RPC. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * TCP based RPC supports 'batched calls'. - * A sequence of calls may be batched-up in a send buffer. The rpc call - * return immediately to the client even though the call was not necessarily - * sent. The batching occurs if the results' xdr routine is NULL (0) AND - * the rpc timeout value is zero (see clnt.h, rpc). - * - * Clients should NOT casually batch calls that in fact return results; that is, - * the server side should be aware that a call is batched and not produce any - * return message. Batched calls that produce many result messages can - * deadlock (netlock) the client and the server.... - * - * Now go hang yourself. - */ - -#include <stdio.h> -#include <rpc/rpc.h> -#include <sys/socket.h> -#include <netdb.h> -#include <errno.h> -#include <rpc/pmap_clnt.h> -#include <unistd.h> - -#define MCALL_MSG_SIZE 24 - -extern int errno; - -static int readtcp(); -static int writetcp(); - -static enum clnt_stat clnttcp_call(); -static void clnttcp_abort(); -static void clnttcp_geterr(); -static bool_t clnttcp_freeres(); -static bool_t clnttcp_control(); -static void clnttcp_destroy(); - -static struct clnt_ops tcp_ops = { - clnttcp_call, - clnttcp_abort, - clnttcp_geterr, - clnttcp_freeres, - clnttcp_destroy, - clnttcp_control -}; - -struct ct_data { - int ct_sock; - bool_t ct_closeit; - struct timeval ct_wait; - bool_t ct_waitset; /* wait set by clnt_control? */ - struct sockaddr_in ct_addr; - struct rpc_err ct_error; - char ct_mcall[MCALL_MSG_SIZE]; /* marshalled callmsg */ - u_int ct_mpos; /* pos after marshal */ - XDR ct_xdrs; -}; - -/* - * Create a client handle for a tcp/ip connection. - * If *sockp<0, *sockp is set to a newly created TCP socket and it is - * connected to raddr. If *sockp non-negative then - * raddr is ignored. The rpc/tcp package does buffering - * similar to stdio, so the client must pick send and receive buffer sizes,]; - * 0 => use the default. - * If raddr->sin_port is 0, then a binder on the remote machine is - * consulted for the right port number. - * NB: *sockp is copied into a private area. - * NB: It is the clients responsibility to close *sockp. - * NB: The rpch->cl_auth is set null authentication. Caller may wish to set this - * something more useful. - */ -CLIENT *clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) -struct sockaddr_in *raddr; -u_long prog; -u_long vers; -register int *sockp; -u_int sendsz; -u_int recvsz; -{ - CLIENT *h; - register struct ct_data *ct; - struct timeval now; - struct rpc_msg call_msg; - - h = (CLIENT *) mem_alloc(sizeof(*h)); - if (h == NULL) { - (void) fprintf(stderr, "clnttcp_create: out of memory\n"); - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = errno; - goto fooy; - } - ct = (struct ct_data *) mem_alloc(sizeof(*ct)); - if (ct == NULL) { - (void) fprintf(stderr, "clnttcp_create: out of memory\n"); - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = errno; - goto fooy; - } - - /* - * If no port number given ask the pmap for one - */ - if (raddr->sin_port == 0) { - u_short port; - - if ((port = pmap_getport(raddr, prog, vers, IPPROTO_TCP)) == 0) { - mem_free((caddr_t) ct, sizeof(struct ct_data)); - - mem_free((caddr_t) h, sizeof(CLIENT)); - return ((CLIENT *) NULL); - } - raddr->sin_port = htons(port); - } - - /* - * If no socket given, open one - */ - if (*sockp < 0) { - *sockp = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - (void) bindresvport(*sockp, (struct sockaddr_in *) 0); - if ((*sockp < 0) - || (connect(*sockp, (struct sockaddr *) raddr, - sizeof(*raddr)) < 0)) { - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = errno; - (void) close(*sockp); - goto fooy; - } - ct->ct_closeit = TRUE; - } else { - ct->ct_closeit = FALSE; - } - - /* - * Set up private data struct - */ - ct->ct_sock = *sockp; - ct->ct_wait.tv_usec = 0; - ct->ct_waitset = FALSE; - ct->ct_addr = *raddr; - - /* - * Initialize call message - */ - (void) gettimeofday(&now, (struct timezone *) 0); - call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec; - call_msg.rm_direction = CALL; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - call_msg.rm_call.cb_prog = prog; - call_msg.rm_call.cb_vers = vers; - - /* - * pre-serialize the staic part of the call msg and stash it away - */ - xdrmem_create(&(ct->ct_xdrs), ct->ct_mcall, MCALL_MSG_SIZE, - XDR_ENCODE); - if (!xdr_callhdr(&(ct->ct_xdrs), &call_msg)) { - if (ct->ct_closeit) { - (void) close(*sockp); - } - goto fooy; - } - ct->ct_mpos = XDR_GETPOS(&(ct->ct_xdrs)); - XDR_DESTROY(&(ct->ct_xdrs)); - - /* - * Create a client handle which uses xdrrec for serialization - * and authnone for authentication. - */ - xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz, - (caddr_t) ct, readtcp, writetcp); - h->cl_ops = &tcp_ops; - h->cl_private = (caddr_t) ct; - h->cl_auth = authnone_create(); - return (h); - - fooy: - /* - * Something goofed, free stuff and barf - */ - mem_free((caddr_t) ct, sizeof(struct ct_data)); - - mem_free((caddr_t) h, sizeof(CLIENT)); - return ((CLIENT *) NULL); -} - -static enum clnt_stat -clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, - timeout) -register CLIENT *h; -u_long proc; -xdrproc_t xdr_args; -caddr_t args_ptr; -xdrproc_t xdr_results; -caddr_t results_ptr; -struct timeval timeout; -{ - register struct ct_data *ct = (struct ct_data *) h->cl_private; - register XDR *xdrs = &(ct->ct_xdrs); - struct rpc_msg reply_msg; - u_long x_id; - u_long *msg_x_id = (u_long *) (ct->ct_mcall); /* yuk */ - register bool_t shipnow; - int refreshes = 2; - - if (!ct->ct_waitset) { - ct->ct_wait = timeout; - } - - shipnow = - (xdr_results == (xdrproc_t) 0 && timeout.tv_sec == 0 - && timeout.tv_usec == 0) ? FALSE : TRUE; - - call_again: - xdrs->x_op = XDR_ENCODE; - ct->ct_error.re_status = RPC_SUCCESS; - x_id = ntohl(--(*msg_x_id)); - if ((!XDR_PUTBYTES(xdrs, ct->ct_mcall, ct->ct_mpos)) || - (!XDR_PUTLONG(xdrs, (long *) &proc)) || - (!AUTH_MARSHALL(h->cl_auth, xdrs)) || - (!(*xdr_args) (xdrs, args_ptr))) { - if (ct->ct_error.re_status == RPC_SUCCESS) - ct->ct_error.re_status = RPC_CANTENCODEARGS; - (void) xdrrec_endofrecord(xdrs, TRUE); - return (ct->ct_error.re_status); - } - if (!xdrrec_endofrecord(xdrs, shipnow)) - return (ct->ct_error.re_status = RPC_CANTSEND); - if (!shipnow) - return (RPC_SUCCESS); - /* - * Hack to provide rpc-based message passing - */ - if (timeout.tv_sec == 0 && timeout.tv_usec == 0) { - return (ct->ct_error.re_status = RPC_TIMEDOUT); - } - - - /* - * Keep receiving until we get a valid transaction id - */ - xdrs->x_op = XDR_DECODE; - while (TRUE) { - reply_msg.acpted_rply.ar_verf = _null_auth; - reply_msg.acpted_rply.ar_results.where = NULL; - reply_msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void; - if (!xdrrec_skiprecord(xdrs)) - return (ct->ct_error.re_status); - /* now decode and validate the response header */ - if (!xdr_replymsg(xdrs, &reply_msg)) { - if (ct->ct_error.re_status == RPC_SUCCESS) - continue; - return (ct->ct_error.re_status); - } - if (reply_msg.rm_xid == x_id) - break; - } - - /* - * process header - */ - _seterr_reply(&reply_msg, &(ct->ct_error)); - if (ct->ct_error.re_status == RPC_SUCCESS) { - if (!AUTH_VALIDATE(h->cl_auth, &reply_msg.acpted_rply.ar_verf)) { - ct->ct_error.re_status = RPC_AUTHERROR; - ct->ct_error.re_why = AUTH_INVALIDRESP; - } else if (!(*xdr_results) (xdrs, results_ptr)) { - if (ct->ct_error.re_status == RPC_SUCCESS) - ct->ct_error.re_status = RPC_CANTDECODERES; - } - /* free verifier ... */ - if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) { - xdrs->x_op = XDR_FREE; - (void) xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf)); - } - } /* end successful completion */ - else { - /* maybe our credentials need to be refreshed ... */ - if (refreshes-- && AUTH_REFRESH(h->cl_auth)) - goto call_again; - } /* end of unsuccessful completion */ - return (ct->ct_error.re_status); -} - -static void clnttcp_geterr(h, errp) -CLIENT *h; -struct rpc_err *errp; -{ - register struct ct_data *ct = (struct ct_data *) h->cl_private; - - *errp = ct->ct_error; -} - -static bool_t clnttcp_freeres(cl, xdr_res, res_ptr) -CLIENT *cl; -xdrproc_t xdr_res; -caddr_t res_ptr; -{ - register struct ct_data *ct = (struct ct_data *) cl->cl_private; - register XDR *xdrs = &(ct->ct_xdrs); - - xdrs->x_op = XDR_FREE; - return ((*xdr_res) (xdrs, res_ptr)); -} - -static void clnttcp_abort() -{ -} - -static bool_t clnttcp_control(cl, request, info) -CLIENT *cl; -int request; -char *info; -{ - register struct ct_data *ct = (struct ct_data *) cl->cl_private; - - switch (request) { - case CLSET_TIMEOUT: - ct->ct_wait = *(struct timeval *) info; - ct->ct_waitset = TRUE; - break; - case CLGET_TIMEOUT: - *(struct timeval *) info = ct->ct_wait; - break; - case CLGET_SERVER_ADDR: - *(struct sockaddr_in *) info = ct->ct_addr; - break; - default: - return (FALSE); - } - return (TRUE); -} - - -static void clnttcp_destroy(h) -CLIENT *h; -{ - register struct ct_data *ct = (struct ct_data *) h->cl_private; - - if (ct->ct_closeit) { - (void) close(ct->ct_sock); - } - XDR_DESTROY(&(ct->ct_xdrs)); - mem_free((caddr_t) ct, sizeof(struct ct_data)); - - mem_free((caddr_t) h, sizeof(CLIENT)); -} - -/* - * Interface between xdr serializer and tcp connection. - * Behaves like the system calls, read & write, but keeps some error state - * around for the rpc level. - */ -static int readtcp(ct, buf, len) -register struct ct_data *ct; -caddr_t buf; -register int len; -{ -#ifdef FD_SETSIZE - fd_set mask; - fd_set readfds; - - if (len == 0) - return (0); - FD_ZERO(&mask); - FD_SET(ct->ct_sock, &mask); -#else - register int mask = 1 << (ct->ct_sock); - int readfds; - - if (len == 0) - return (0); - -#endif /* def FD_SETSIZE */ - while (TRUE) { - readfds = mask; - switch (select - (_rpc_dtablesize(), &readfds, 0, 0, - &(ct->ct_wait))) { - case 0: - ct->ct_error.re_status = RPC_TIMEDOUT; - return (-1); - - case -1: - if (errno == EINTR) - continue; - ct->ct_error.re_status = RPC_CANTRECV; - ct->ct_error.re_errno = errno; - return (-1); - } - break; - } - switch (len = read(ct->ct_sock, buf, len)) { - - case 0: - /* premature eof */ - ct->ct_error.re_errno = ECONNRESET; - ct->ct_error.re_status = RPC_CANTRECV; - len = -1; /* it's really an error */ - break; - - case -1: - ct->ct_error.re_errno = errno; - ct->ct_error.re_status = RPC_CANTRECV; - break; - } - return (len); -} - -static int writetcp(ct, buf, len) -struct ct_data *ct; -caddr_t buf; -int len; -{ - register int i, cnt; - - for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = write(ct->ct_sock, buf, cnt)) == -1) { - ct->ct_error.re_errno = errno; - ct->ct_error.re_status = RPC_CANTSEND; - return (-1); - } - } - return (len); -} diff --git a/mdk-stage1/dietlibc/librpc/clnt_udp.c b/mdk-stage1/dietlibc/librpc/clnt_udp.c deleted file mode 100644 index 7305d3ff1..000000000 --- a/mdk-stage1/dietlibc/librpc/clnt_udp.c +++ /dev/null @@ -1,437 +0,0 @@ -/* @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * clnt_udp.c, Implements a UDP/IP based, client side RPC. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <stdio.h> -#include <rpc/rpc.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <netdb.h> -#include <errno.h> -#include <rpc/pmap_clnt.h> -#include <unistd.h> - -extern int errno; - -/* - * UDP bases client side rpc operations - */ -static enum clnt_stat clntudp_call(); -static void clntudp_abort(); -static void clntudp_geterr(); -static bool_t clntudp_freeres(); -static bool_t clntudp_control(); -static void clntudp_destroy(); - -static struct clnt_ops udp_ops = { - clntudp_call, - clntudp_abort, - clntudp_geterr, - clntudp_freeres, - clntudp_destroy, - clntudp_control -}; - -/* - * Private data kept per client handle - */ -struct cu_data { - int cu_sock; - bool_t cu_closeit; - struct sockaddr_in cu_raddr; - int cu_rlen; - struct timeval cu_wait; - struct timeval cu_total; - struct rpc_err cu_error; - XDR cu_outxdrs; - u_int cu_xdrpos; - u_int cu_sendsz; - char *cu_outbuf; - u_int cu_recvsz; - char cu_inbuf[1]; -}; - -/* - * Create a UDP based client handle. - * If *sockp<0, *sockp is set to a newly created UPD socket. - * If raddr->sin_port is 0 a binder on the remote machine - * is consulted for the correct port number. - * NB: It is the clients responsibility to close *sockp. - * NB: The rpch->cl_auth is initialized to null authentication. - * Caller may wish to set this something more useful. - * - * wait is the amount of time used between retransmitting a call if - * no response has been heard; retransmition occurs until the actual - * rpc call times out. - * - * sendsz and recvsz are the maximum allowable packet sizes that can be - * sent and received. - */ -CLIENT *clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, - recvsz) -struct sockaddr_in *raddr; -u_long program; -u_long version; -struct timeval wait; -register int *sockp; -u_int sendsz; -u_int recvsz; -{ - CLIENT *cl; - register struct cu_data *cu; - struct timeval now; - struct rpc_msg call_msg; - - cl = (CLIENT *) mem_alloc(sizeof(CLIENT)); - if (cl == NULL) { - (void) fprintf(stderr, "clntudp_create: out of memory\n"); - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = errno; - goto fooy; - } - sendsz = ((sendsz + 3) / 4) * 4; - recvsz = ((recvsz + 3) / 4) * 4; - cu = (struct cu_data *) mem_alloc(sizeof(*cu) + sendsz + recvsz); - if (cu == NULL) { - (void) fprintf(stderr, "clntudp_create: out of memory\n"); - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = errno; - goto fooy; - } - cu->cu_outbuf = &cu->cu_inbuf[recvsz]; - - (void) gettimeofday(&now, (struct timezone *) 0); - if (raddr->sin_port == 0) { - u_short port; - - if ((port = - pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) { - goto fooy; - } - raddr->sin_port = htons(port); - } - cl->cl_ops = &udp_ops; - cl->cl_private = (caddr_t) cu; - cu->cu_raddr = *raddr; - cu->cu_rlen = sizeof(cu->cu_raddr); - cu->cu_wait = wait; - cu->cu_total.tv_sec = -1; - cu->cu_total.tv_usec = -1; - cu->cu_sendsz = sendsz; - cu->cu_recvsz = recvsz; - call_msg.rm_xid = getpid() ^ now.tv_sec ^ now.tv_usec; - call_msg.rm_direction = CALL; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - call_msg.rm_call.cb_prog = program; - call_msg.rm_call.cb_vers = version; - xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE); - if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) { - goto fooy; - } - cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs)); - if (*sockp < 0) { - int dontblock = 1; - - *sockp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (*sockp < 0) { - rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = errno; - goto fooy; - } - /* attempt to bind to prov port */ - (void) bindresvport(*sockp, (struct sockaddr_in *) 0); - /* the sockets rpc controls are non-blocking */ - (void) ioctl(*sockp, FIONBIO, (char *) &dontblock); - cu->cu_closeit = TRUE; - } else { - cu->cu_closeit = FALSE; - } - cu->cu_sock = *sockp; - cl->cl_auth = authnone_create(); - return (cl); - fooy: - if (cu) - mem_free((caddr_t) cu, sizeof(*cu) + sendsz + recvsz); - if (cl) - mem_free((caddr_t) cl, sizeof(CLIENT)); - return ((CLIENT *) NULL); -} - -CLIENT *clntudp_create(raddr, program, version, wait, sockp) -struct sockaddr_in *raddr; -u_long program; -u_long version; -struct timeval wait; -register int *sockp; -{ - - return (clntudp_bufcreate(raddr, program, version, wait, sockp, - UDPMSGSIZE, UDPMSGSIZE)); -} - -static enum clnt_stat -clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) -register CLIENT *cl; /* client handle */ -u_long proc; /* procedure number */ -xdrproc_t xargs; /* xdr routine for args */ -caddr_t argsp; /* pointer to args */ -xdrproc_t xresults; /* xdr routine for results */ -caddr_t resultsp; /* pointer to results */ -struct timeval utimeout; /* seconds to wait before giving up */ -{ - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - register XDR *xdrs; - register int outlen; - register int inlen; - int fromlen; - -#ifdef FD_SETSIZE - fd_set readfds; - fd_set mask; -#else - int readfds; - register int mask; -#endif /* def FD_SETSIZE */ - struct sockaddr_in from; - struct rpc_msg reply_msg; - XDR reply_xdrs; - struct timeval time_waited; - bool_t ok; - int nrefreshes = 2; /* number of times to refresh cred */ - struct timeval timeout; - - if (cu->cu_total.tv_usec == -1) { - timeout = utimeout; /* use supplied timeout */ - } else { - timeout = cu->cu_total; /* use default timeout */ - } - - time_waited.tv_sec = 0; - time_waited.tv_usec = 0; - call_again: - xdrs = &(cu->cu_outxdrs); - xdrs->x_op = XDR_ENCODE; - XDR_SETPOS(xdrs, cu->cu_xdrpos); - /* - * the transaction is the first thing in the out buffer - */ - (*(u_short *) (cu->cu_outbuf))++; - if ((!XDR_PUTLONG(xdrs, (long *) &proc)) || - (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) - return (cu->cu_error.re_status = RPC_CANTENCODEARGS); - outlen = (int) XDR_GETPOS(xdrs); - - send_again: - if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0, - (struct sockaddr *) &(cu->cu_raddr), cu->cu_rlen) - != outlen) { - cu->cu_error.re_errno = errno; - return (cu->cu_error.re_status = RPC_CANTSEND); - } - - /* - * Hack to provide rpc-based message passing - */ - if (timeout.tv_sec == 0 && timeout.tv_usec == 0) { - return (cu->cu_error.re_status = RPC_TIMEDOUT); - } - /* - * sub-optimal code appears here because we have - * some clock time to spare while the packets are in flight. - * (We assume that this is actually only executed once.) - */ - reply_msg.acpted_rply.ar_verf = _null_auth; - reply_msg.acpted_rply.ar_results.where = resultsp; - reply_msg.acpted_rply.ar_results.proc = xresults; -#ifdef FD_SETSIZE - FD_ZERO(&mask); - FD_SET(cu->cu_sock, &mask); -#else - mask = 1 << cu->cu_sock; -#endif /* def FD_SETSIZE */ - for (;;) { - readfds = mask; - switch (select(_rpc_dtablesize(), &readfds, 0, 0, &(cu->cu_wait))) { - - case 0: - time_waited.tv_sec += cu->cu_wait.tv_sec; - time_waited.tv_usec += cu->cu_wait.tv_usec; - while (time_waited.tv_usec >= 1000000) { - time_waited.tv_sec++; - time_waited.tv_usec -= 1000000; - } - if ((time_waited.tv_sec < timeout.tv_sec) || - ((time_waited.tv_sec == timeout.tv_sec) && - (time_waited.tv_usec < timeout.tv_usec))) - goto send_again; - return (cu->cu_error.re_status = RPC_TIMEDOUT); - - /* - * buggy in other cases because time_waited is not being - * updated. - */ - case -1: - if (errno == EINTR) - continue; - cu->cu_error.re_errno = errno; - return (cu->cu_error.re_status = RPC_CANTRECV); - } - do { - fromlen = sizeof(struct sockaddr); - - inlen = recvfrom(cu->cu_sock, cu->cu_inbuf, - (int) cu->cu_recvsz, 0, - (struct sockaddr *) &from, &fromlen); - } while (inlen < 0 && errno == EINTR); - if (inlen < 0) { - if (errno == EWOULDBLOCK) - continue; - cu->cu_error.re_errno = errno; - return (cu->cu_error.re_status = RPC_CANTRECV); - } - if (inlen < sizeof(u_long)) - continue; - /* see if reply transaction id matches sent id */ - if (*((u_long *) (cu->cu_inbuf)) != *((u_long *) (cu->cu_outbuf))) - continue; - /* we now assume we have the proper reply */ - break; - } - - /* - * now decode and validate the response - */ - xdrmem_create(&reply_xdrs, cu->cu_inbuf, (u_int) inlen, XDR_DECODE); - ok = xdr_replymsg(&reply_xdrs, &reply_msg); - /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */ - if (ok) { - _seterr_reply(&reply_msg, &(cu->cu_error)); - if (cu->cu_error.re_status == RPC_SUCCESS) { - if (!AUTH_VALIDATE(cl->cl_auth, - &reply_msg.acpted_rply.ar_verf)) { - cu->cu_error.re_status = RPC_AUTHERROR; - cu->cu_error.re_why = AUTH_INVALIDRESP; - } - if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) { - xdrs->x_op = XDR_FREE; - (void) xdr_opaque_auth(xdrs, - &(reply_msg.acpted_rply.ar_verf)); - } - } /* end successful completion */ - else { - /* maybe our credentials need to be refreshed ... */ - if (nrefreshes > 0 && AUTH_REFRESH(cl->cl_auth)) { - nrefreshes--; - goto call_again; - } - } /* end of unsuccessful completion */ - } /* end of valid reply message */ - else { - cu->cu_error.re_status = RPC_CANTDECODERES; - } - return (cu->cu_error.re_status); -} - -static void clntudp_geterr(cl, errp) -CLIENT *cl; -struct rpc_err *errp; -{ - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - - *errp = cu->cu_error; -} - - -static bool_t clntudp_freeres(cl, xdr_res, res_ptr) -CLIENT *cl; -xdrproc_t xdr_res; -caddr_t res_ptr; -{ - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - register XDR *xdrs = &(cu->cu_outxdrs); - - xdrs->x_op = XDR_FREE; - return ((*xdr_res) (xdrs, res_ptr)); -} - -static void clntudp_abort( /*h */ ) - /*CLIENT *h; */ -{ -} - -static bool_t clntudp_control(cl, request, info) -CLIENT *cl; -int request; -char *info; -{ - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - - switch (request) { - case CLSET_TIMEOUT: - cu->cu_total = *(struct timeval *) info; - break; - case CLGET_TIMEOUT: - *(struct timeval *) info = cu->cu_total; - break; - case CLSET_RETRY_TIMEOUT: - cu->cu_wait = *(struct timeval *) info; - break; - case CLGET_RETRY_TIMEOUT: - *(struct timeval *) info = cu->cu_wait; - break; - case CLGET_SERVER_ADDR: - *(struct sockaddr_in *) info = cu->cu_raddr; - break; - default: - return (FALSE); - } - return (TRUE); -} - -static void clntudp_destroy(cl) -CLIENT *cl; -{ - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - - if (cu->cu_closeit) { - (void) close(cu->cu_sock); - } - XDR_DESTROY(&(cu->cu_outxdrs)); - mem_free((caddr_t) cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz)); - mem_free((caddr_t) cl, sizeof(CLIENT)); -} diff --git a/mdk-stage1/dietlibc/librpc/get_myaddress.c b/mdk-stage1/dietlibc/librpc/get_myaddress.c deleted file mode 100644 index cd63383d0..000000000 --- a/mdk-stage1/dietlibc/librpc/get_myaddress.c +++ /dev/null @@ -1,69 +0,0 @@ -/* @(#)get_myaddress.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * get_myaddress.c - * - * Get client's IP address via ioctl. This avoids using the yellowpages. - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/types.h> -#include <rpc/pmap_prot.h> -#include <sys/socket.h> -#include <stdio.h> -//#include <net/if.h> -#include <sys/ioctl.h> -#include <arpa/inet.h> -#include <netinet/in.h> - -/* DO use gethostbyname because it's portable */ -#include <unistd.h> -#include <netdb.h> -#include <string.h> -void get_myaddress(struct sockaddr_in* addr) -{ - char localhost[256 + 1]; - struct hostent *hp; - - gethostname(localhost, 256); - if ((hp = gethostbyname(localhost)) == NULL) { - perror("get_myaddress: gethostbyname"); - exit(1); - } - addr->sin_family = AF_INET; - bcopy((char *) hp->h_addr, (char *) &addr->sin_addr, hp->h_length); - addr->sin_port = htons(PMAPPORT); -} diff --git a/mdk-stage1/dietlibc/librpc/getrpcent.c b/mdk-stage1/dietlibc/librpc/getrpcent.c deleted file mode 100644 index 5e7f694d2..000000000 --- a/mdk-stage1/dietlibc/librpc/getrpcent.c +++ /dev/null @@ -1,274 +0,0 @@ -/* @(#)getrpcent.c 2.2 88/07/29 4.0 RPCSRC */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)getrpcent.c 1.9 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * Copyright (c) 1985 by Sun Microsystems, Inc. - */ - -#include <stdio.h> -#include <sys/types.h> -#include <rpc/rpc.h> -#include <netdb.h> -#include <sys/socket.h> -#include <string.h> - -/* - * Internet version. - */ -struct rpcdata { - FILE *rpcf; - char *current; - int currentlen; - int stayopen; -#define MAXALIASES 35 - char *rpc_aliases[MAXALIASES]; - struct rpcent rpc; - char line[BUFSIZ + 1]; - char *domain; -} *rpcdata; - -static struct rpcent *interpret(); -struct hostent *gethostent(); -char *inet_ntoa(); - -#ifndef __linux__ -static char *index(); -#else -char *index(); -#endif - -static char RPCDB[] = "/etc/rpc"; - -static struct rpcdata *_rpcdata() -{ - register struct rpcdata *d = rpcdata; - - if (d == 0) { - d = (struct rpcdata *) calloc(1, sizeof(struct rpcdata)); - - rpcdata = d; - } - return (d); -} - -struct rpcent *getrpcbynumber(number) -register int number; -{ - register struct rpcdata *d = _rpcdata(); - register struct rpcent *p; - - if (d == 0) - return (0); - setrpcent(0); - while ((p = getrpcent())) { - if (p->r_number == number) - break; - } - endrpcent(); - return (p); -} - -struct rpcent * -#ifdef __linux__ -getrpcbyname(const char *name) -#else -getrpcbyname(name) -char *name; -#endif -{ - struct rpcent *rpc; - char **rp; - - setrpcent(0); - while ((rpc = getrpcent())) { - if (strcmp(rpc->r_name, name) == 0) - return (rpc); - for (rp = rpc->r_aliases; *rp != NULL; rp++) { - if (strcmp(*rp, name) == 0) - return (rpc); - } - } - endrpcent(); - return (NULL); -} - -#ifdef __linux__ -void -#endif -setrpcent(f) -int f; -{ - register struct rpcdata *d = _rpcdata(); - - if (d == 0) - return; - if (d->rpcf == NULL) - d->rpcf = fopen(RPCDB, "r"); - else - rewind(d->rpcf); - if (d->current) - free(d->current); - d->current = NULL; - d->stayopen |= f; -} - -#ifdef __linux__ -void -#endif -endrpcent() -{ - register struct rpcdata *d = _rpcdata(); - - if (d == 0) - return; - if (d->current && !d->stayopen) { - free(d->current); - d->current = NULL; - } - if (d->rpcf && !d->stayopen) { - fclose(d->rpcf); - d->rpcf = NULL; - } -} - -struct rpcent *getrpcent() -{ - register struct rpcdata *d = _rpcdata(); - - if (d == 0) - return (NULL); - if (d->rpcf == NULL && (d->rpcf = fopen(RPCDB, "r")) == NULL) - return (NULL); - if (fgets(d->line, BUFSIZ, d->rpcf) == NULL) - return (NULL); - return interpret(d->line, strlen(d->line)); -} - -#ifdef __linux__ -static char *firstwhite(s) -char *s; -{ - char *s1, *s2; - - s1 = index(s, ' '); - s2 = index(s, '\t'); - if (s1) { - if (s2) - return (s1 < s2) ? s1 : s2; - else - return s1; - } else - return s2; -} -#endif - -static struct rpcent *interpret(const char* val, int len) -{ - register struct rpcdata *d = _rpcdata(); - char *p; - register char *cp, **q; - - if (d == 0) - return 0; - strncpy(d->line, val, len); - p = d->line; - d->line[len] = '\n'; - if (*p == '#') - return (getrpcent()); - cp = index(p, '#'); - if (cp == NULL) { - cp = index(p, '\n'); - if (cp == NULL) - return (getrpcent()); - } - *cp = '\0'; -#ifdef __linux__ - if ((cp = firstwhite(p))) - *cp++ = 0; - else - return (getrpcent()); -#else - cp = index(p, ' '); - if (cp == NULL) { - cp = index(p, '\t'); - if (cp == NULL) - return (getrpcent()); - } - *cp++ = '\0'; -#endif - /* THIS STUFF IS INTERNET SPECIFIC */ - d->rpc.r_name = d->line; - while (*cp == ' ' || *cp == '\t') - cp++; - d->rpc.r_number = atoi(cp); - q = d->rpc.r_aliases = d->rpc_aliases; -#ifdef __linux__ - if ((cp = firstwhite(cp))) - *cp++ = '\0'; -#else - cp = index(p, ' '); - if (cp != NULL) - *cp++ = '\0'; - else { - cp = index(p, '\t'); - if (cp != NULL) - *cp++ = '\0'; - } -#endif - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; - } - if (q < &(d->rpc_aliases[MAXALIASES - 1])) - *q++ = cp; -#ifdef __linux__ - if ((cp = firstwhite(cp))) - *cp++ = '\0'; -#else - cp = index(p, ' '); - if (cp != NULL) - *cp++ = '\0'; - else { - cp = index(p, '\t'); - if (cp != NULL) - *cp++ = '\0'; - } -#endif - } - *q = NULL; - return (&d->rpc); -} diff --git a/mdk-stage1/dietlibc/librpc/getrpcport.c b/mdk-stage1/dietlibc/librpc/getrpcport.c deleted file mode 100644 index a7085cbe7..000000000 --- a/mdk-stage1/dietlibc/librpc/getrpcport.c +++ /dev/null @@ -1,57 +0,0 @@ -/* @(#)getrpcport.c 2.1 88/07/29 4.0 RPCSRC */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)getrpcport.c 1.3 87/08/11 SMI"; -#endif -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * Copyright (c) 1985 by Sun Microsystems, Inc. - */ - -#include <stdio.h> -#include <rpc/rpc.h> -#include <netdb.h> -#include <sys/socket.h> -#include <string.h> -#include <rpc/pmap_clnt.h> - -extern int getrpcport (const char * host, u_long prognum, - u_long versnum, u_int proto) -{ - struct sockaddr_in addr; - struct hostent *hp; - - if ((hp = gethostbyname(host)) == NULL) - return (0); - bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length); - addr.sin_family = AF_INET; - addr.sin_port = 0; - return (pmap_getport(&addr, prognum, versnum, proto)); -} diff --git a/mdk-stage1/dietlibc/librpc/pmap_clnt.c b/mdk-stage1/dietlibc/librpc/pmap_clnt.c deleted file mode 100644 index 428675656..000000000 --- a/mdk-stage1/dietlibc/librpc/pmap_clnt.c +++ /dev/null @@ -1,118 +0,0 @@ -/* @(#)pmap_clnt.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)pmap_clnt.c 1.37 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * pmap_clnt.c - * Client interface to pmap rpc service. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/rpc.h> -#include <rpc/pmap_prot.h> -#include <rpc/pmap_clnt.h> -#include <unistd.h> - -static struct timeval timeout = { 5, 0 }; -static struct timeval tottimeout = { 60, 0 }; - -void clnt_perror(); - - -/* - * Set a mapping between program,version and port. - * Calls the pmap service remotely to do the mapping. - */ -bool_t pmap_set(program, version, protocol, port) -u_long program; -u_long version; -int protocol; -u_short port; -{ - struct sockaddr_in myaddress; - int socket = -1; - register CLIENT *client; - struct pmap parms; - bool_t rslt; - - get_myaddress(&myaddress); - client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS, - timeout, &socket, RPCSMALLMSGSIZE, - RPCSMALLMSGSIZE); - if (client == (CLIENT *) NULL) - return (FALSE); - parms.pm_prog = program; - parms.pm_vers = version; - parms.pm_prot = protocol; - parms.pm_port = port; - if (CLNT_CALL(client, PMAPPROC_SET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, - tottimeout) != RPC_SUCCESS) { - clnt_perror(client, "Cannot register service"); - return (FALSE); - } - CLNT_DESTROY(client); - (void) close(socket); - return (rslt); -} - -/* - * Remove the mapping between program,version and port. - * Calls the pmap service remotely to do the un-mapping. - */ -bool_t pmap_unset(program, version) -u_long program; -u_long version; -{ - struct sockaddr_in myaddress; - int socket = -1; - register CLIENT *client; - struct pmap parms; - bool_t rslt; - - get_myaddress(&myaddress); - client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS, - timeout, &socket, RPCSMALLMSGSIZE, - RPCSMALLMSGSIZE); - if (client == (CLIENT *) NULL) - return (FALSE); - parms.pm_prog = program; - parms.pm_vers = version; - parms.pm_port = parms.pm_prot = 0; - CLNT_CALL(client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, - tottimeout); - CLNT_DESTROY(client); - (void) close(socket); - return (rslt); -} diff --git a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c b/mdk-stage1/dietlibc/librpc/pmap_getmaps.c deleted file mode 100644 index 6940783fb..000000000 --- a/mdk-stage1/dietlibc/librpc/pmap_getmaps.c +++ /dev/null @@ -1,85 +0,0 @@ -/* @(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * pmap_getmap.c - * Client interface to pmap rpc service. - * contains pmap_getmaps, which is only tcp service involved - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/rpc.h> -#include <rpc/pmap_prot.h> -#include <rpc/pmap_clnt.h> -#include <sys/socket.h> -#include <netdb.h> -#include <stdio.h> -#include <errno.h> -//#include <net/if.h> -#include <sys/ioctl.h> -#define NAMELEN 255 -#define MAX_BROADCAST_SIZE 1400 -#include <unistd.h> - -extern int errno; - -/* - * Get a copy of the current port maps. - * Calls the pmap service remotely to do get the maps. - */ -struct pmaplist *pmap_getmaps(address) -struct sockaddr_in *address; -{ - struct pmaplist *head = (struct pmaplist *) NULL; - int socket = -1; - struct timeval minutetimeout; - register CLIENT *client; - - minutetimeout.tv_sec = 60; - minutetimeout.tv_usec = 0; - address->sin_port = htons(PMAPPORT); - client = clnttcp_create(address, PMAPPROG, PMAPVERS, &socket, 50, 500); - if (client != (CLIENT *) NULL) { - if (CLNT_CALL(client, PMAPPROC_DUMP, (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_pmaplist, - (caddr_t)&head, minutetimeout) != RPC_SUCCESS) { - clnt_perror(client, "pmap_getmaps rpc problem"); - } - CLNT_DESTROY(client); - } - (void) close(socket); - address->sin_port = 0; - return (head); -} diff --git a/mdk-stage1/dietlibc/librpc/pmap_getport.c b/mdk-stage1/dietlibc/librpc/pmap_getport.c deleted file mode 100644 index 174dca41a..000000000 --- a/mdk-stage1/dietlibc/librpc/pmap_getport.c +++ /dev/null @@ -1,90 +0,0 @@ -/* @(#)pmap_getport.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * pmap_getport.c - * Client interface to pmap rpc service. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/rpc.h> -#include <rpc/pmap_prot.h> -#include <rpc/pmap_clnt.h> -#include <sys/socket.h> -//#include <net/if.h> -#include <unistd.h> - -static struct timeval timeout = { 5, 0 }; -static struct timeval tottimeout = { 60, 0 }; - -/* - * Find the mapped port for program,version. - * Calls the pmap service remotely to do the lookup. - * Returns 0 if no map exists. - */ -u_short pmap_getport(address, program, version, protocol) -struct sockaddr_in *address; -u_long program; -u_long version; -u_int protocol; -{ - u_short port = 0; - int socket = -1; - register CLIENT *client; - struct pmap parms; - - address->sin_port = htons(PMAPPORT); - client = clntudp_bufcreate(address, PMAPPROG, - PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE, - RPCSMALLMSGSIZE); - if (client != (CLIENT *) NULL) { - parms.pm_prog = program; - parms.pm_vers = version; - parms.pm_prot = protocol; - parms.pm_port = 0; /* not needed or used */ - if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (caddr_t)&parms, - (xdrproc_t)xdr_u_short, (caddr_t)&port, tottimeout) != RPC_SUCCESS) { - rpc_createerr.cf_stat = RPC_PMAPFAILURE; - clnt_geterr(client, &rpc_createerr.cf_error); - } else if (port == 0) { - rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED; - } - CLNT_DESTROY(client); - } - (void) close(socket); - address->sin_port = 0; - return (port); -} diff --git a/mdk-stage1/dietlibc/librpc/pmap_prot.c b/mdk-stage1/dietlibc/librpc/pmap_prot.c deleted file mode 100644 index ec8b5af79..000000000 --- a/mdk-stage1/dietlibc/librpc/pmap_prot.c +++ /dev/null @@ -1,58 +0,0 @@ -/* @(#)pmap_prot.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * pmap_prot.c - * Protocol for the local binder service, or pmap. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/pmap_prot.h> - - -bool_t xdr_pmap(xdrs, regs) -XDR *xdrs; -struct pmap *regs; -{ - - if (xdr_u_long(xdrs, ®s->pm_prog) && - xdr_u_long(xdrs, ®s->pm_vers) && - xdr_u_long(xdrs, ®s->pm_prot)) - return (xdr_u_long(xdrs, ®s->pm_port)); - return (FALSE); -} diff --git a/mdk-stage1/dietlibc/librpc/pmap_prot2.c b/mdk-stage1/dietlibc/librpc/pmap_prot2.c deleted file mode 100644 index 870c844ed..000000000 --- a/mdk-stage1/dietlibc/librpc/pmap_prot2.c +++ /dev/null @@ -1,116 +0,0 @@ -/* @(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * pmap_prot2.c - * Protocol for the local binder service, or pmap. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <rpc/pmap_prot.h> - - -/* - * What is going on with linked lists? (!) - * First recall the link list declaration from pmap_prot.h: - * - * struct pmaplist { - * struct pmap pml_map; - * struct pmaplist *pml_map; - * }; - * - * Compare that declaration with a corresponding xdr declaration that - * is (a) pointer-less, and (b) recursive: - * - * typedef union switch (bool_t) { - * - * case TRUE: struct { - * struct pmap; - * pmaplist_t foo; - * }; - * - * case FALSE: struct {}; - * } pmaplist_t; - * - * Notice that the xdr declaration has no nxt pointer while - * the C declaration has no bool_t variable. The bool_t can be - * interpreted as ``more data follows me''; if FALSE then nothing - * follows this bool_t; if TRUE then the bool_t is followed by - * an actual struct pmap, and then (recursively) by the - * xdr union, pamplist_t. - * - * This could be implemented via the xdr_union primitive, though this - * would cause a one recursive call per element in the list. Rather than do - * that we can ``unwind'' the recursion - * into a while loop and do the union arms in-place. - * - * The head of the list is what the C programmer wishes to past around - * the net, yet is the data that the pointer points to which is interesting; - * this sounds like a job for xdr_reference! - */ -bool_t xdr_pmaplist(XDR* xdrs, struct pmaplist** rp) -{ - /* - * more_elements is pre-computed in case the direction is - * XDR_ENCODE or XDR_FREE. more_elements is overwritten by - * xdr_bool when the direction is XDR_DECODE. - */ - bool_t more_elements; - register int freeing = (xdrs->x_op == XDR_FREE); - register struct pmaplist **next=0; - - while (TRUE) { - more_elements = (bool_t) (*rp != NULL); - if (!xdr_bool(xdrs, &more_elements)) - return (FALSE); - if (!more_elements) - return (TRUE); /* we are done */ - /* - * the unfortunate side effect of non-recursion is that in - * the case of freeing we must remember the next object - * before we free the current object ... - */ - if (freeing) - next = &((*rp)->pml_next); - if (!xdr_reference(xdrs, (caddr_t *) rp, - (u_int) sizeof(struct pmaplist), (xdrproc_t)xdr_pmap)) - return (FALSE); - - rp = (freeing) ? next : &((*rp)->pml_next); - } -} diff --git a/mdk-stage1/dietlibc/librpc/pmap_rmt.c b/mdk-stage1/dietlibc/librpc/pmap_rmt.c deleted file mode 100644 index 02efcf91c..000000000 --- a/mdk-stage1/dietlibc/librpc/pmap_rmt.c +++ /dev/null @@ -1,403 +0,0 @@ -/* @(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; -#endif - -/* - * pmap_rmt.c - * Client interface to pmap rpc service. - * remote call and broadcast service - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/rpc.h> -#include <rpc/pmap_prot.h> -#include <rpc/pmap_clnt.h> -#include <rpc/pmap_rmt.h> -#include <sys/socket.h> -#include <stdio.h> -#include <errno.h> -//#include <net/if.h> -#include <sys/ioctl.h> -#include <arpa/inet.h> -#define MAX_BROADCAST_SIZE 1400 -#include <unistd.h> -#include <string.h> - -extern int errno; -static struct timeval timeout = { 3, 0 }; - - -/* - * pmapper remote-call-service interface. - * This routine is used to call the pmapper remote call service - * which will look up a service program in the port maps, and then - * remotely call that routine with the given parameters. This allows - * programs to do a lookup and call in one step. -*/ -enum clnt_stat -pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, - port_ptr) -struct sockaddr_in *addr; -u_long prog, vers, proc; -xdrproc_t xdrargs, xdrres; -caddr_t argsp, resp; -struct timeval tout; -u_long *port_ptr; -{ - int socket = -1; - register CLIENT *client; - struct rmtcallargs a; - struct rmtcallres r; - enum clnt_stat stat; - - addr->sin_port = htons(PMAPPORT); - client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &socket); - if (client != (CLIENT *) NULL) { - a.prog = prog; - a.vers = vers; - a.proc = proc; - a.args_ptr = argsp; - a.xdr_args = xdrargs; - r.port_ptr = port_ptr; - r.results_ptr = resp; - r.xdr_results = xdrres; - stat = CLNT_CALL(client, PMAPPROC_CALLIT, (xdrproc_t)xdr_rmtcall_args, (caddr_t)&a, - (xdrproc_t)xdr_rmtcallres, (caddr_t)&r, tout); - CLNT_DESTROY(client); - } else { - stat = RPC_FAILED; - } - (void) close(socket); - addr->sin_port = 0; - return (stat); -} - - -/* - * XDR remote call arguments - * written for XDR_ENCODE direction only - */ -bool_t xdr_rmtcall_args(XDR* xdrs, struct rmtcallargs* cap) -{ - u_int lenposition, argposition, position; - - if (xdr_u_long(xdrs, &(cap->prog)) && - xdr_u_long(xdrs, &(cap->vers)) && xdr_u_long(xdrs, &(cap->proc))) { - lenposition = XDR_GETPOS(xdrs); - if (!xdr_u_long(xdrs, &(cap->arglen))) - return (FALSE); - argposition = XDR_GETPOS(xdrs); - if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) - return (FALSE); - position = XDR_GETPOS(xdrs); - cap->arglen = (u_long) position - (u_long) argposition; - XDR_SETPOS(xdrs, lenposition); - if (!xdr_u_long(xdrs, &(cap->arglen))) - return (FALSE); - XDR_SETPOS(xdrs, position); - return (TRUE); - } - return (FALSE); -} - -/* - * XDR remote call results - * written for XDR_DECODE direction only - */ -bool_t xdr_rmtcallres(XDR* xdrs, struct rmtcallres* crp) -{ - caddr_t port_ptr; - - port_ptr = (caddr_t) crp->port_ptr; - if (xdr_reference(xdrs, &port_ptr, sizeof(u_long), - (xdrproc_t)xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) { - crp->port_ptr = (u_long *) port_ptr; - return ((*(crp->xdr_results)) (xdrs, crp->results_ptr)); - } - return (FALSE); -} - - -/* - * The following is kludged-up support for simple rpc broadcasts. - * Someday a large, complicated system will replace these trivial - * routines which only support udp/ip . - */ - -static int getbroadcastnets(addrs, sock, buf) -struct in_addr *addrs; -int sock; /* any valid socket will do */ -char *buf; /* why allocxate more when we can use existing... */ -{ -#ifdef __linux__ - struct sockaddr_in addr; - - get_myaddress(&addr); -#if 1 - printf("%s(%d): no inet_makeaddr()\n", __FILE__, __LINE__); -#else - addrs[0] = inet_makeaddr(inet_netof(addr.sin_addr), INADDR_ANY); -#endif - return 1; -#else - struct ifconf ifc; - struct ifreq ifreq, *ifr; - struct sockaddr_in *sin; - int n, i; - - ifc.ifc_len = UDPMSGSIZE; - ifc.ifc_buf = buf; - if (ioctl(sock, SIOCGIFCONF, (char *) &ifc) < 0) { - perror("broadcast: ioctl (get interface configuration)"); - return (0); - } - ifr = ifc.ifc_req; - for (i = 0, n = ifc.ifc_len / sizeof(struct ifreq); n > 0; n--, ifr++) { - ifreq = *ifr; - if (ioctl(sock, SIOCGIFFLAGS, (char *) &ifreq) < 0) { - perror("broadcast: ioctl (get interface flags)"); - continue; - } - if ((ifreq.ifr_flags & IFF_BROADCAST) && - (ifreq.ifr_flags & IFF_UP) && - ifr->ifr_addr.sa_family == AF_INET) { - sin = (struct sockaddr_in *) &ifr->ifr_addr; -#ifdef SIOCGIFBRDADDR /* 4.3BSD */ - if (ioctl(sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0) { -#if 1 - printf("%s(%d): no inet_makeaddr()\n", __FILE__, __LINE__); -#else - addrs[i++] = inet_makeaddr(inet_netof - (sin->sin_addr.s_addr), - INADDR_ANY); -#endif - } else { - addrs[i++] = ((struct sockaddr_in *) - &ifreq.ifr_addr)->sin_addr; - } -#else /* 4.2 BSD */ -#if 1 - printf("%s(%d): no inet_makeaddr()\n", __FILE__, __LINE__); -#else - addrs[i++] = inet_makeaddr(inet_netof - (sin->sin_addr.s_addr), INADDR_ANY); -#endif -#endif - } - } - return (i); -#endif -} - -enum clnt_stat -clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, - eachresult) -u_long prog; /* program number */ -u_long vers; /* version number */ -u_long proc; /* procedure number */ -xdrproc_t xargs; /* xdr routine for args */ -caddr_t argsp; /* pointer to args */ -xdrproc_t xresults; /* xdr routine for results */ -caddr_t resultsp; /* pointer to results */ -resultproc_t eachresult; /* call with each result obtained */ -{ - enum clnt_stat stat; - AUTH *unix_auth = authunix_create_default(); - XDR xdr_stream; - register XDR *xdrs = &xdr_stream; - int outlen, inlen, fromlen, nets; - register int sock; - int on = 1; - -#ifdef FD_SETSIZE - fd_set mask; - fd_set readfds; -#else - int readfds; - register int mask; -#endif /* def FD_SETSIZE */ - register int i; - bool_t done = FALSE; - register u_long xid; - u_long port; - struct in_addr addrs[20]; - struct sockaddr_in baddr, raddr; /* broadcast and response addresses */ - struct rmtcallargs a; - struct rmtcallres r; - struct rpc_msg msg; - struct timeval t; - char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE]; - - /* - * initialization: create a socket, a broadcast address, and - * preserialize the arguments into a send buffer. - */ - if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { - perror("Cannot create socket for broadcast rpc"); - stat = RPC_CANTSEND; - goto done_broad; - } -#ifdef SO_BROADCAST - if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on)) < 0) { - perror("Cannot set socket option SO_BROADCAST"); - stat = RPC_CANTSEND; - goto done_broad; - } -#endif /* def SO_BROADCAST */ -#ifdef FD_SETSIZE - FD_ZERO(&mask); - FD_SET(sock, &mask); -#else - mask = (1 << sock); -#endif /* def FD_SETSIZE */ - nets = getbroadcastnets(addrs, sock, inbuf); - bzero((char *) &baddr, sizeof(baddr)); - baddr.sin_family = AF_INET; - baddr.sin_port = htons(PMAPPORT); - baddr.sin_addr.s_addr = htonl(INADDR_ANY); -/* baddr.sin_addr.S_un.S_addr = htonl(INADDR_ANY); */ - (void) gettimeofday(&t, (struct timezone *) 0); - msg.rm_xid = xid = getpid() ^ t.tv_sec ^ t.tv_usec; - t.tv_usec = 0; - msg.rm_direction = CALL; - msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - msg.rm_call.cb_prog = PMAPPROG; - msg.rm_call.cb_vers = PMAPVERS; - msg.rm_call.cb_proc = PMAPPROC_CALLIT; - msg.rm_call.cb_cred = unix_auth->ah_cred; - msg.rm_call.cb_verf = unix_auth->ah_verf; - a.prog = prog; - a.vers = vers; - a.proc = proc; - a.xdr_args = xargs; - a.args_ptr = argsp; - r.port_ptr = &port; - r.xdr_results = xresults; - r.results_ptr = resultsp; - xdrmem_create(xdrs, outbuf, MAX_BROADCAST_SIZE, XDR_ENCODE); - if ((!xdr_callmsg(xdrs, &msg)) || (!xdr_rmtcall_args(xdrs, &a))) { - stat = RPC_CANTENCODEARGS; - goto done_broad; - } - outlen = (int) xdr_getpos(xdrs); - xdr_destroy(xdrs); - /* - * Basic loop: broadcast a packet and wait a while for response(s). - * The response timeout grows larger per iteration. - */ - for (t.tv_sec = 4; t.tv_sec <= 14; t.tv_sec += 2) { - for (i = 0; i < nets; i++) { - baddr.sin_addr = addrs[i]; - if (sendto(sock, outbuf, outlen, 0, - (struct sockaddr *) &baddr, - sizeof(struct sockaddr)) != outlen) { - perror("Cannot send broadcast packet"); - stat = RPC_CANTSEND; - goto done_broad; - } - } - if (eachresult == NULL) { - stat = RPC_SUCCESS; - goto done_broad; - } - recv_again: - msg.acpted_rply.ar_verf = _null_auth; - msg.acpted_rply.ar_results.where = (caddr_t) & r; - msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_rmtcallres; - readfds = mask; - switch (select(_rpc_dtablesize(), &readfds, 0, 0, &t)) { - - case 0: /* timed out */ - stat = RPC_TIMEDOUT; - continue; - - case -1: /* some kind of error */ - if (errno == EINTR) - goto recv_again; - perror("Broadcast select problem"); - stat = RPC_CANTRECV; - goto done_broad; - - } /* end of select results switch */ - try_again: - fromlen = sizeof(struct sockaddr); - - inlen = recvfrom(sock, inbuf, UDPMSGSIZE, 0, - (struct sockaddr *) &raddr, &fromlen); - if (inlen < 0) { - if (errno == EINTR) - goto try_again; - perror("Cannot receive reply to broadcast"); - stat = RPC_CANTRECV; - goto done_broad; - } - if (inlen < sizeof(u_long)) - goto recv_again; - /* - * see if reply transaction id matches sent id. - * If so, decode the results. - */ - xdrmem_create(xdrs, inbuf, (u_int) inlen, XDR_DECODE); - if (xdr_replymsg(xdrs, &msg)) { - if ((msg.rm_xid == xid) && - (msg.rm_reply.rp_stat == MSG_ACCEPTED) && - (msg.acpted_rply.ar_stat == SUCCESS)) { - raddr.sin_port = htons((u_short) port); - done = (*eachresult) (resultsp, &raddr); - } - /* otherwise, we just ignore the errors ... */ - } else { -#ifdef notdef - /* some kind of deserialization problem ... */ - if (msg.rm_xid == xid) - fprintf(stderr, "Broadcast deserialization problem"); - /* otherwise, just random garbage */ -#endif - } - xdrs->x_op = XDR_FREE; - msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void; - (void) xdr_replymsg(xdrs, &msg); - (void) (*xresults) (xdrs, resultsp); - xdr_destroy(xdrs); - if (done) { - stat = RPC_SUCCESS; - goto done_broad; - } else { - goto recv_again; - } - } - done_broad: - (void) close(sock); - AUTH_DESTROY(unix_auth); - return (stat); -} diff --git a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c b/mdk-stage1/dietlibc/librpc/rpc_callmsg.c deleted file mode 100644 index 4b3a9880e..000000000 --- a/mdk-stage1/dietlibc/librpc/rpc_callmsg.c +++ /dev/null @@ -1,189 +0,0 @@ -/* @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * rpc_callmsg.c - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - */ - -#include <sys/param.h> - -#include <rpc/rpc.h> -#include <string.h> - -/* - * XDR a call message - */ -bool_t xdr_callmsg(xdrs, cmsg) -register XDR *xdrs; -register struct rpc_msg *cmsg; -{ - register int32_t *buf; - register struct opaque_auth *oa; - - if (xdrs->x_op == XDR_ENCODE) { - if (cmsg->rm_call.cb_cred.oa_length > MAX_AUTH_BYTES) { - return (FALSE); - } - if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES) { - return (FALSE); - } - buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT - + RNDUP(cmsg->rm_call.cb_cred.oa_length) - + 2 * BYTES_PER_XDR_UNIT - + RNDUP(cmsg->rm_call.cb_verf.oa_length)); - if (buf != NULL) { - IXDR_PUT_LONG(buf, cmsg->rm_xid); - IXDR_PUT_ENUM(buf, cmsg->rm_direction); - if (cmsg->rm_direction != CALL) { - return (FALSE); - } - IXDR_PUT_LONG(buf, cmsg->rm_call.cb_rpcvers); - if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) { - return (FALSE); - } - IXDR_PUT_LONG(buf, cmsg->rm_call.cb_prog); - IXDR_PUT_LONG(buf, cmsg->rm_call.cb_vers); - IXDR_PUT_LONG(buf, cmsg->rm_call.cb_proc); - oa = &cmsg->rm_call.cb_cred; - IXDR_PUT_ENUM(buf, oa->oa_flavor); - IXDR_PUT_LONG(buf, oa->oa_length); - if (oa->oa_length) { - bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length); - buf += RNDUP(oa->oa_length) / sizeof(long); - } - oa = &cmsg->rm_call.cb_verf; - IXDR_PUT_ENUM(buf, oa->oa_flavor); - IXDR_PUT_LONG(buf, oa->oa_length); - if (oa->oa_length) { - bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length); - /* no real need.... - buf += RNDUP(oa->oa_length) / sizeof (long); - */ - } - return (TRUE); - } - } - if (xdrs->x_op == XDR_DECODE) { - buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT); - if (buf != NULL) { - cmsg->rm_xid = IXDR_GET_LONG(buf); - cmsg->rm_direction = IXDR_GET_ENUM(buf, enum msg_type); - - if (cmsg->rm_direction != CALL) { - return (FALSE); - } - cmsg->rm_call.cb_rpcvers = IXDR_GET_LONG(buf); - if (cmsg->rm_call.cb_rpcvers != RPC_MSG_VERSION) { - return (FALSE); - } - cmsg->rm_call.cb_prog = IXDR_GET_LONG(buf); - cmsg->rm_call.cb_vers = IXDR_GET_LONG(buf); - cmsg->rm_call.cb_proc = IXDR_GET_LONG(buf); - oa = &cmsg->rm_call.cb_cred; - oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t); - oa->oa_length = IXDR_GET_LONG(buf); - if (oa->oa_length) { - if (oa->oa_length > MAX_AUTH_BYTES) { - return (FALSE); - } - if (oa->oa_base == NULL) { - oa->oa_base = (caddr_t) - mem_alloc(oa->oa_length); - } - buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length)); - if (buf == NULL) { - if (xdr_opaque(xdrs, oa->oa_base, - oa->oa_length) == FALSE) { - return (FALSE); - } - } else { - bcopy((caddr_t) buf, oa->oa_base, oa->oa_length); - /* no real need.... - buf += RNDUP(oa->oa_length) / - sizeof (long); - */ - } - } - oa = &cmsg->rm_call.cb_verf; - buf = XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT); - if (buf == NULL) { - if (xdr_enum(xdrs, &oa->oa_flavor) == FALSE || - xdr_u_int(xdrs, &oa->oa_length) == FALSE) { - return (FALSE); - } - } else { - oa->oa_flavor = IXDR_GET_ENUM(buf, enum_t); - oa->oa_length = IXDR_GET_LONG(buf); - } - if (oa->oa_length) { - if (oa->oa_length > MAX_AUTH_BYTES) { - return (FALSE); - } - if (oa->oa_base == NULL) { - oa->oa_base = (caddr_t) - mem_alloc(oa->oa_length); - } - buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length)); - if (buf == NULL) { - if (xdr_opaque(xdrs, oa->oa_base, - oa->oa_length) == FALSE) { - return (FALSE); - } - } else { - bcopy((caddr_t) buf, oa->oa_base, oa->oa_length); - /* no real need... - buf += RNDUP(oa->oa_length) / - sizeof (long); - */ - } - } - return (TRUE); - } - } - if (xdr_u_long(xdrs, &(cmsg->rm_xid)) && - xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) && - (cmsg->rm_direction == CALL) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && - (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) && - xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred))) - return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf))); - return (FALSE); -} diff --git a/mdk-stage1/dietlibc/librpc/rpc_commondata.c b/mdk-stage1/dietlibc/librpc/rpc_commondata.c deleted file mode 100644 index 39648d284..000000000 --- a/mdk-stage1/dietlibc/librpc/rpc_commondata.c +++ /dev/null @@ -1,42 +0,0 @@ -/* @(#)rpc_commondata.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#include <rpc/rpc.h> -/* - * This file should only contain common data (global data) that is exported - * by public interfaces - */ -struct opaque_auth _null_auth; - -#ifdef FD_SETSIZE -fd_set svc_fdset; -#else -int svc_fds; -#endif /* def FD_SETSIZE */ -struct rpc_createerr rpc_createerr; diff --git a/mdk-stage1/dietlibc/librpc/rpc_dtablesize.c b/mdk-stage1/dietlibc/librpc/rpc_dtablesize.c deleted file mode 100644 index b08ebaccd..000000000 --- a/mdk-stage1/dietlibc/librpc/rpc_dtablesize.c +++ /dev/null @@ -1,50 +0,0 @@ -/* @(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro"; -#endif - -#include <unistd.h> - -/* - * Cache the result of getdtablesize(), so we don't have to do an - * expensive system call every time. - */ -int _rpc_dtablesize() -{ - static int size; - - if (size == 0) { - size = getdtablesize(); - } - return (size); -} diff --git a/mdk-stage1/dietlibc/librpc/rpc_prot.c b/mdk-stage1/dietlibc/librpc/rpc_prot.c deleted file mode 100644 index 19a4db27f..000000000 --- a/mdk-stage1/dietlibc/librpc/rpc_prot.c +++ /dev/null @@ -1,281 +0,0 @@ -/* @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * rpc_prot.c - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * This set of routines implements the rpc message definition, - * its serializer and some common rpc utility routines. - * The routines are meant for various implementations of rpc - - * they are NOT for the rpc client or rpc service implementations! - * Because authentication stuff is easy and is part of rpc, the opaque - * routines are also in this program. - */ - -#include <sys/param.h> - -#include <rpc/rpc.h> - -/* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */ - -struct opaque_auth _null_auth; - -/* - * XDR an opaque authentication struct - * (see auth.h) - */ -bool_t xdr_opaque_auth(xdrs, ap) -register XDR *xdrs; -register struct opaque_auth *ap; -{ - - if (xdr_enum(xdrs, &(ap->oa_flavor))) - return (xdr_bytes(xdrs, &ap->oa_base, - &ap->oa_length, MAX_AUTH_BYTES)); - return (FALSE); -} - -/* - * XDR a DES block - */ -bool_t xdr_des_block(xdrs, blkp) -register XDR *xdrs; -register des_block *blkp; -{ - return (xdr_opaque(xdrs, (caddr_t) blkp, sizeof(des_block))); -} - -/* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */ - -/* - * XDR the MSG_ACCEPTED part of a reply message union - */ -bool_t xdr_accepted_reply(xdrs, ar) -register XDR *xdrs; -register struct accepted_reply *ar; -{ - - /* personalized union, rather than calling xdr_union */ - if (!xdr_opaque_auth(xdrs, &(ar->ar_verf))) - return (FALSE); - if (!xdr_enum(xdrs, (enum_t *) & (ar->ar_stat))) - return (FALSE); - switch (ar->ar_stat) { - - case SUCCESS: - return ((*(ar->ar_results.proc)) (xdrs, ar->ar_results.where)); - - case PROG_MISMATCH: - if (!xdr_u_long(xdrs, &(ar->ar_vers.low))) - return (FALSE); - return (xdr_u_long(xdrs, &(ar->ar_vers.high))); - } - return (TRUE); /* TRUE => open ended set of problems */ -} - -/* - * XDR the MSG_DENIED part of a reply message union - */ -bool_t xdr_rejected_reply(xdrs, rr) -register XDR *xdrs; -register struct rejected_reply *rr; -{ - - /* personalized union, rather than calling xdr_union */ - if (!xdr_enum(xdrs, (enum_t *) & (rr->rj_stat))) - return (FALSE); - switch (rr->rj_stat) { - - case RPC_MISMATCH: - if (!xdr_u_long(xdrs, &(rr->rj_vers.low))) - return (FALSE); - return (xdr_u_long(xdrs, &(rr->rj_vers.high))); - - case AUTH_ERROR: - return (xdr_enum(xdrs, (enum_t *) & (rr->rj_why))); - } - return (FALSE); -} - -static struct xdr_discrim reply_dscrm[3] = { - {(int) MSG_ACCEPTED, (xdrproc_t)xdr_accepted_reply}, - {(int) MSG_DENIED, (xdrproc_t)xdr_rejected_reply}, - {__dontcare__, NULL_xdrproc_t} -}; - -/* - * XDR a reply message - */ -bool_t xdr_replymsg(xdrs, rmsg) -register XDR *xdrs; -register struct rpc_msg *rmsg; -{ - if (xdr_u_long(xdrs, &(rmsg->rm_xid)) && - xdr_enum(xdrs, (enum_t *) & (rmsg->rm_direction)) && - (rmsg->rm_direction == REPLY)) - return (xdr_union(xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat), - (caddr_t) & (rmsg->rm_reply.ru), reply_dscrm, - NULL_xdrproc_t)); - return (FALSE); -} - - -/* - * Serializes the "static part" of a call message header. - * The fields include: rm_xid, rm_direction, rpcvers, prog, and vers. - * The rm_xid is not really static, but the user can easily munge on the fly. - */ -bool_t xdr_callhdr(xdrs, cmsg) -register XDR *xdrs; -register struct rpc_msg *cmsg; -{ - - cmsg->rm_direction = CALL; - cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION; - if ( - (xdrs->x_op == XDR_ENCODE) && - xdr_u_long(xdrs, &(cmsg->rm_xid)) && - xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog))) - return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers))); - return (FALSE); -} - -/* ************************** Client utility routine ************* */ - -static void accepted(acpt_stat, error) -register enum accept_stat acpt_stat; -register struct rpc_err *error; -{ - - switch (acpt_stat) { - - case PROG_UNAVAIL: - error->re_status = RPC_PROGUNAVAIL; - return; - - case PROG_MISMATCH: - error->re_status = RPC_PROGVERSMISMATCH; - return; - - case PROC_UNAVAIL: - error->re_status = RPC_PROCUNAVAIL; - return; - - case GARBAGE_ARGS: - error->re_status = RPC_CANTDECODEARGS; - return; - - case SYSTEM_ERR: - error->re_status = RPC_SYSTEMERROR; - return; - - case SUCCESS: - error->re_status = RPC_SUCCESS; - return; - } - /* something's wrong, but we don't know what ... */ - error->re_status = RPC_FAILED; - error->re_lb.s1 = (long) MSG_ACCEPTED; - error->re_lb.s2 = (long) acpt_stat; -} - -static void rejected(rjct_stat, error) -register enum reject_stat rjct_stat; -register struct rpc_err *error; -{ - - switch (rjct_stat) { - - case RPC_VERSMISMATCH: - error->re_status = RPC_VERSMISMATCH; - return; - - case AUTH_ERROR: - error->re_status = RPC_AUTHERROR; - return; - } - /* something's wrong, but we don't know what ... */ - error->re_status = RPC_FAILED; - error->re_lb.s1 = (long) MSG_DENIED; - error->re_lb.s2 = (long) rjct_stat; -} - -/* - * given a reply message, fills in the error - */ -void _seterr_reply(msg, error) -register struct rpc_msg *msg; -register struct rpc_err *error; -{ - - /* optimized for normal, SUCCESSful case */ - switch (msg->rm_reply.rp_stat) { - - case MSG_ACCEPTED: - if (msg->acpted_rply.ar_stat == SUCCESS) { - error->re_status = RPC_SUCCESS; - return; - }; - accepted(msg->acpted_rply.ar_stat, error); - break; - - case MSG_DENIED: - rejected(msg->rjcted_rply.rj_stat, error); - break; - - default: - error->re_status = RPC_FAILED; - error->re_lb.s1 = (long) (msg->rm_reply.rp_stat); - break; - } - switch (error->re_status) { - - case RPC_VERSMISMATCH: - error->re_vers.low = msg->rjcted_rply.rj_vers.low; - error->re_vers.high = msg->rjcted_rply.rj_vers.high; - break; - - case RPC_AUTHERROR: - error->re_why = msg->rjcted_rply.rj_why; - break; - - case RPC_PROGVERSMISMATCH: - error->re_vers.low = msg->acpted_rply.ar_vers.low; - error->re_vers.high = msg->acpted_rply.ar_vers.high; - break; - } -} diff --git a/mdk-stage1/dietlibc/librpc/svc.c b/mdk-stage1/dietlibc/librpc/svc.c deleted file mode 100644 index 4fcdb5216..000000000 --- a/mdk-stage1/dietlibc/librpc/svc.c +++ /dev/null @@ -1,479 +0,0 @@ -/* @(#)svc.c 2.4 88/08/11 4.0 RPCSRC; from 1.44 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)svc.c 1.41 87/10/13 Copyr 1984 Sun Micro"; -#endif - -/* - * svc.c, Server-side remote procedure call interface. - * - * There are two sets of procedures here. The xprt routines are - * for handling transport handles. The svc routines handle the - * list of service routines. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <errno.h> -#include <rpc/rpc.h> -#include <rpc/pmap_clnt.h> -#ifdef __linux__ -#include <sys/types.h> -#endif - -extern int errno; - -#ifdef FD_SETSIZE -static SVCXPRT **xports; -#else -#define NOFILE 32 - -static SVCXPRT *xports[NOFILE]; -#endif /* def FD_SETSIZE */ - -#define NULL_SVC ((struct svc_callout *)0) -#define RQCRED_SIZE 400 /* this size is excessive */ - -/* - * The services list - * Each entry represents a set of procedures (an rpc program). - * The dispatch routine takes request structs and runs the - * apropriate procedure. - */ -static struct svc_callout { - struct svc_callout *sc_next; - u_long sc_prog; - u_long sc_vers; - void (*sc_dispatch) (); -} *svc_head; - -static struct svc_callout *svc_find(); - -/* *************** SVCXPRT related stuff **************** */ - -/* - * Activate a transport handle. - */ -void xprt_register(xprt) -SVCXPRT *xprt; -{ - register int sock = xprt->xp_sock; - -#ifdef FD_SETSIZE - if (xports == NULL) { - xports = (SVCXPRT **) - mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *)); - } - if (sock < _rpc_dtablesize()) { - xports[sock] = xprt; - FD_SET(sock, &svc_fdset); - } -#else - if (sock < NOFILE) { - xports[sock] = xprt; - svc_fds |= (1 << sock); - } -#endif /* def FD_SETSIZE */ - -} - -/* - * De-activate a transport handle. - */ -void xprt_unregister(xprt) -SVCXPRT *xprt; -{ - register int sock = xprt->xp_sock; - -#ifdef FD_SETSIZE - if ((sock < _rpc_dtablesize()) && (xports[sock] == xprt)) { - xports[sock] = (SVCXPRT *) 0; - FD_CLR(sock, &svc_fdset); - } -#else - if ((sock < NOFILE) && (xports[sock] == xprt)) { - xports[sock] = (SVCXPRT *) 0; - svc_fds &= ~(1 << sock); - } -#endif /* def FD_SETSIZE */ -} - - -/* ********************** CALLOUT list related stuff ************* */ - -/* - * Add a service program to the callout list. - * The dispatch routine will be called when a rpc request for this - * program number comes in. - */ -bool_t svc_register(xprt, prog, vers, dispatch, protocol) -SVCXPRT *xprt; -u_long prog; -u_long vers; -void (*dispatch) (); -rpcprot_t protocol; -{ - struct svc_callout *prev; - register struct svc_callout *s; - - if ((s = svc_find(prog, vers, &prev)) != NULL_SVC) { - if (s->sc_dispatch == dispatch) - goto pmap_it; /* he is registering another xptr */ - return (FALSE); - } - s = (struct svc_callout *) mem_alloc(sizeof(struct svc_callout)); - - if (s == (struct svc_callout *) 0) { - return (FALSE); - } - s->sc_prog = prog; - s->sc_vers = vers; - s->sc_dispatch = dispatch; - s->sc_next = svc_head; - svc_head = s; - pmap_it: - /* now register the information with the local binder service */ - if (protocol) { - return (pmap_set(prog, vers, protocol, xprt->xp_port)); - } - return (TRUE); -} - -/* - * Remove a service program from the callout list. - */ -void svc_unregister(prog, vers) -u_long prog; -u_long vers; -{ - struct svc_callout *prev; - register struct svc_callout *s; - - if ((s = svc_find(prog, vers, &prev)) == NULL_SVC) - return; - if (prev == NULL_SVC) { - svc_head = s->sc_next; - } else { - prev->sc_next = s->sc_next; - } - s->sc_next = NULL_SVC; - mem_free((char *) s, (u_int) sizeof(struct svc_callout)); - - /* now unregister the information with the local binder service */ - (void) pmap_unset(prog, vers); -} - -/* - * Search the callout list for a program number, return the callout - * struct. - */ -static struct svc_callout *svc_find(prog, vers, prev) -u_long prog; -u_long vers; -struct svc_callout **prev; -{ - register struct svc_callout *s, *p; - - p = NULL_SVC; - for (s = svc_head; s != NULL_SVC; s = s->sc_next) { - if ((s->sc_prog == prog) && (s->sc_vers == vers)) - goto done; - p = s; - } - done: - *prev = p; - return (s); -} - -/* ******************* REPLY GENERATION ROUTINES ************ */ - -/* - * Send a reply to an rpc request - */ -bool_t svc_sendreply(xprt, xdr_results, xdr_location) -register SVCXPRT *xprt; -xdrproc_t xdr_results; -caddr_t xdr_location; -{ - struct rpc_msg rply; - - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; - rply.acpted_rply.ar_stat = SUCCESS; - rply.acpted_rply.ar_results.where = xdr_location; - rply.acpted_rply.ar_results.proc = xdr_results; - return (SVC_REPLY(xprt, &rply)); -} - -/* - * No procedure error reply - */ -void svcerr_noproc(xprt) -register SVCXPRT *xprt; -{ - struct rpc_msg rply; - - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; - rply.acpted_rply.ar_stat = PROC_UNAVAIL; - SVC_REPLY(xprt, &rply); -} - -/* - * Can't decode args error reply - */ -void svcerr_decode(xprt) -register SVCXPRT *xprt; -{ - struct rpc_msg rply; - - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; - rply.acpted_rply.ar_stat = GARBAGE_ARGS; - SVC_REPLY(xprt, &rply); -} - -/* - * Some system error - */ -void svcerr_systemerr(xprt) -register SVCXPRT *xprt; -{ - struct rpc_msg rply; - - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; - rply.acpted_rply.ar_stat = SYSTEM_ERR; - SVC_REPLY(xprt, &rply); -} - -/* - * Authentication error reply - */ -void svcerr_auth(xprt, why) -SVCXPRT *xprt; -enum auth_stat why; -{ - struct rpc_msg rply; - - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_DENIED; - rply.rjcted_rply.rj_stat = AUTH_ERROR; - rply.rjcted_rply.rj_why = why; - SVC_REPLY(xprt, &rply); -} - -/* - * Auth too weak error reply - */ -void svcerr_weakauth(xprt) -SVCXPRT *xprt; -{ - - svcerr_auth(xprt, AUTH_TOOWEAK); -} - -/* - * Program unavailable error reply - */ -void svcerr_noprog(xprt) -register SVCXPRT *xprt; -{ - struct rpc_msg rply; - - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; - rply.acpted_rply.ar_stat = PROG_UNAVAIL; - SVC_REPLY(xprt, &rply); -} - -/* - * Program version mismatch error reply - */ -void svcerr_progvers(xprt, low_vers, high_vers) -register SVCXPRT *xprt; -u_long low_vers; -u_long high_vers; -{ - struct rpc_msg rply; - - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; - rply.acpted_rply.ar_stat = PROG_MISMATCH; - rply.acpted_rply.ar_vers.low = low_vers; - rply.acpted_rply.ar_vers.high = high_vers; - SVC_REPLY(xprt, &rply); -} - -/* ******************* SERVER INPUT STUFF ******************* */ - -/* - * Get server side input from some transport. - * - * Statement of authentication parameters management: - * This function owns and manages all authentication parameters, specifically - * the "raw" parameters (msg.rm_call.cb_cred and msg.rm_call.cb_verf) and - * the "cooked" credentials (rqst->rq_clntcred). - * However, this function does not know the structure of the cooked - * credentials, so it make the following assumptions: - * a) the structure is contiguous (no pointers), and - * b) the cred structure size does not exceed RQCRED_SIZE bytes. - * In all events, all three parameters are freed upon exit from this routine. - * The storage is trivially management on the call stack in user land, but - * is mallocated in kernel land. - */ - -void svc_getreq(rdfds) -int rdfds; -{ -#ifdef FD_SETSIZE - fd_set readfds; - - FD_ZERO(&readfds); -/*#ifdef __linux__*/ -#if 0 - readfds = rdfds; -#else - readfds.fds_bits[0] = rdfds; -#endif - svc_getreqset(&readfds); -#else - int readfds = rdfds & svc_fds; - - svc_getreqset(&readfds); -#endif /* def FD_SETSIZE */ -} - -void svc_getreqset(readfds) -#ifdef FD_SETSIZE -fd_set *readfds; -{ -#else -int *readfds; -{ - int readfds_local = *readfds; -#endif /* def FD_SETSIZE */ - enum xprt_stat stat; - struct rpc_msg msg; - int prog_found; - u_long low_vers; - u_long high_vers; - struct svc_req r; - register SVCXPRT *xprt; - register u_long mask; - register int bit; - register u_long *maskp; - register int setsize; - register int sock; - char cred_area[2 * MAX_AUTH_BYTES + RQCRED_SIZE]; - - msg.rm_call.cb_cred.oa_base = cred_area; - msg.rm_call.cb_verf.oa_base = &(cred_area[MAX_AUTH_BYTES]); - r.rq_clntcred = &(cred_area[2 * MAX_AUTH_BYTES]); - - -#ifdef FD_SETSIZE - setsize = _rpc_dtablesize(); -#ifdef __linux__ -/*#define NFDBITS 32*/ - maskp = (u_long *) readfds; -#else - maskp = (u_long *) readfds->fds_bits; -#endif - for (sock = 0; sock < setsize; sock += NFDBITS) { - for (mask = *maskp++; (bit = ffs(mask)); mask ^= (1 << (bit - 1))) { - /* sock has input waiting */ - xprt = xports[sock + bit - 1]; -#else - for (sock = 0; readfds_local != 0; sock++, readfds_local >>= 1) { - if ((readfds_local & 1) != 0) { - /* sock has input waiting */ - xprt = xports[sock]; -#endif /* def FD_SETSIZE */ - /* now receive msgs from xprtprt (support batch calls) */ - do { - if (SVC_RECV(xprt, &msg)) { - - /* now find the exported program and call it */ - register struct svc_callout *s; - enum auth_stat why; - - r.rq_xprt = xprt; - r.rq_prog = msg.rm_call.cb_prog; - r.rq_vers = msg.rm_call.cb_vers; - r.rq_proc = msg.rm_call.cb_proc; - r.rq_cred = msg.rm_call.cb_cred; - /* first authenticate the message */ - if ((why = _authenticate(&r, &msg)) != AUTH_OK) { - svcerr_auth(xprt, why); - goto call_done; - } - /* now match message with a registered service */ - prog_found = FALSE; - low_vers = 0 - 1; - high_vers = 0; - for (s = svc_head; s != NULL_SVC; s = s->sc_next) { - if (s->sc_prog == r.rq_prog) { - if (s->sc_vers == r.rq_vers) { - (*s->sc_dispatch) (&r, xprt); - goto call_done; - } /* found correct version */ - prog_found = TRUE; - if (s->sc_vers < low_vers) - low_vers = s->sc_vers; - if (s->sc_vers > high_vers) - high_vers = s->sc_vers; - } /* found correct program */ - } - /* - * if we got here, the program or version - * is not served ... - */ - if (prog_found) - svcerr_progvers(xprt, low_vers, high_vers); - else - svcerr_noprog(xprt); - /* Fall through to ... */ - } - call_done: - if ((stat = SVC_STAT(xprt)) == XPRT_DIED) { - SVC_DESTROY(xprt); - break; - } - } while (stat == XPRT_MOREREQS); - } - } -} diff --git a/mdk-stage1/dietlibc/librpc/svc_auth.c b/mdk-stage1/dietlibc/librpc/svc_auth.c deleted file mode 100644 index 336586d95..000000000 --- a/mdk-stage1/dietlibc/librpc/svc_auth.c +++ /dev/null @@ -1,115 +0,0 @@ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)svc_auth.c 2.1 88/08/07 4.0 RPCSRC; from 1.19 87/08/11 Copyr 1984 Sun Micro"; -#endif -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * svc_auth_nodes.c, Server-side rpc authenticator interface, - * *WITHOUT* DES authentication. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/rpc.h> - -/* - * svcauthsw is the bdevsw of server side authentication. - * - * Server side authenticators are called from authenticate by - * using the client auth struct flavor field to index into svcauthsw. - * The server auth flavors must implement a routine that looks - * like: - * - * enum auth_stat - * flavorx_auth(rqst, msg) - * register struct svc_req *rqst; - * register struct rpc_msg *msg; - * - */ - -enum auth_stat _svcauth_null(); /* no authentication */ -enum auth_stat _svcauth_unix(); /* unix style (uid, gids) */ -enum auth_stat _svcauth_short(); /* short hand unix style */ - -static struct { - enum auth_stat (*authenticator) (); -} svcauthsw[] = { - { _svcauth_null }, /* AUTH_NULL */ - { _svcauth_unix }, /* AUTH_UNIX */ - { _svcauth_short }, /* AUTH_SHORT */ -}; - -#define AUTH_MAX 2 /* HIGHEST AUTH NUMBER */ - - -/* - * The call rpc message, msg has been obtained from the wire. The msg contains - * the raw form of credentials and verifiers. authenticate returns AUTH_OK - * if the msg is successfully authenticated. If AUTH_OK then the routine also - * does the following things: - * set rqst->rq_xprt->verf to the appropriate response verifier; - * sets rqst->rq_client_cred to the "cooked" form of the credentials. - * - * NB: rqst->rq_cxprt->verf must be pre-alloctaed; - * its length is set appropriately. - * - * The caller still owns and is responsible for msg->u.cmb.cred and - * msg->u.cmb.verf. The authentication system retains ownership of - * rqst->rq_client_cred, the cooked credentials. - * - * There is an assumption that any flavour less than AUTH_NULL is - * invalid. - */ -enum auth_stat _authenticate(rqst, msg) -register struct svc_req *rqst; -struct rpc_msg *msg; -{ - register int cred_flavor; - - rqst->rq_cred = msg->rm_call.cb_cred; - rqst->rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor; - rqst->rq_xprt->xp_verf.oa_length = 0; - cred_flavor = rqst->rq_cred.oa_flavor; - if ((cred_flavor <= AUTH_MAX) && (cred_flavor >= AUTH_NULL)) { - return ((*(svcauthsw[cred_flavor].authenticator)) (rqst, msg)); - } - - return (AUTH_REJECTEDCRED); -} - -enum auth_stat _svcauth_null( /*rqst, msg */ ) - /*struct svc_req *rqst; - struct rpc_msg *msg; */ -{ - - return (AUTH_OK); -} diff --git a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c b/mdk-stage1/dietlibc/librpc/svc_auth_unix.c deleted file mode 100644 index 7e0305f0a..000000000 --- a/mdk-stage1/dietlibc/librpc/svc_auth_unix.c +++ /dev/null @@ -1,136 +0,0 @@ -/* @(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC; from 1.28 88/02/08 SMI */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro"; -#endif - -/* - * svc_auth_unix.c - * Handles UNIX flavor authentication parameters on the service side of rpc. - * There are two svc auth implementations here: AUTH_UNIX and AUTH_SHORT. - * _svcauth_unix does full blown unix style uid,gid+gids auth, - * _svcauth_short uses a shorthand auth to index into a cache of longhand auths. - * Note: the shorthand has been gutted for efficiency. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <stdio.h> -#include <rpc/rpc.h> -#include <string.h> - -/* - * Unix longhand authenticator - */ -enum auth_stat _svcauth_unix(rqst, msg) -register struct svc_req *rqst; -register struct rpc_msg *msg; -{ - register enum auth_stat stat; - XDR xdrs; - register struct authunix_parms *aup; - register int32_t *buf; - struct area { - struct authunix_parms area_aup; - char area_machname[MAX_MACHINE_NAME + 1]; - gid_t area_gids[NGRPS]; - } *area; - u_int auth_len; - int str_len, gid_len; - register int i; - - area = (struct area *) rqst->rq_clntcred; - aup = &area->area_aup; - aup->aup_machname = area->area_machname; - aup->aup_gids = area->area_gids; - auth_len = (u_int) msg->rm_call.cb_cred.oa_length; - xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len, - XDR_DECODE); - buf = XDR_INLINE(&xdrs, auth_len); - if (buf != NULL) { - aup->aup_time = IXDR_GET_LONG(buf); - str_len = IXDR_GET_U_LONG(buf); - if (str_len > MAX_MACHINE_NAME) { - stat = AUTH_BADCRED; - goto done; - } - bcopy((caddr_t) buf, aup->aup_machname, (u_int) str_len); - aup->aup_machname[str_len] = 0; - str_len = RNDUP(str_len); - buf += str_len / sizeof(long); - - aup->aup_uid = IXDR_GET_LONG(buf); - aup->aup_gid = IXDR_GET_LONG(buf); - gid_len = IXDR_GET_U_LONG(buf); - if (gid_len > NGRPS) { - stat = AUTH_BADCRED; - goto done; - } - aup->aup_len = gid_len; - for (i = 0; i < gid_len; i++) { - aup->aup_gids[i] = IXDR_GET_LONG(buf); - } - /* - * five is the smallest unix credentials structure - - * timestamp, hostname len (0), uid, gid, and gids len (0). - */ - if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) { - (void) printf("bad auth_len gid %d str %d auth %d\n", - gid_len, str_len, auth_len); - stat = AUTH_BADCRED; - goto done; - } - } else if (!xdr_authunix_parms(&xdrs, aup)) { - xdrs.x_op = XDR_FREE; - (void) xdr_authunix_parms(&xdrs, aup); - stat = AUTH_BADCRED; - goto done; - } - rqst->rq_xprt->xp_verf.oa_flavor = AUTH_NULL; - rqst->rq_xprt->xp_verf.oa_length = 0; - stat = AUTH_OK; - done: - XDR_DESTROY(&xdrs); - return (stat); -} - - -/* - * Shorthand unix authenticator - * Looks up longhand in a cache. - */ - /*ARGSUSED*/ enum auth_stat _svcauth_short(rqst, msg) -struct svc_req *rqst; -struct rpc_msg *msg; -{ - return (AUTH_REJECTEDCRED); -} diff --git a/mdk-stage1/dietlibc/librpc/svc_raw.c b/mdk-stage1/dietlibc/librpc/svc_raw.c deleted file mode 100644 index c13ea5e06..000000000 --- a/mdk-stage1/dietlibc/librpc/svc_raw.c +++ /dev/null @@ -1,159 +0,0 @@ -/* @(#)svc_raw.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * svc_raw.c, This a toy for simple testing and timing. - * Interface to create an rpc client and server in the same UNIX process. - * This lets us similate rpc and get rpc (round trip) overhead, without - * any interference from the kernal. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <rpc/rpc.h> - - -/* - * This is the "network" that we will be moving data over - */ -static struct svcraw_private { - char _raw_buf[UDPMSGSIZE]; - SVCXPRT server; - XDR xdr_stream; - char verf_body[MAX_AUTH_BYTES]; -} *svcraw_private; - -static bool_t svcraw_recv(); -static enum xprt_stat svcraw_stat(); -static bool_t svcraw_getargs(); -static bool_t svcraw_reply(); -static bool_t svcraw_freeargs(); -static void svcraw_destroy(); - -static struct xp_ops server_ops = { - svcraw_recv, - svcraw_stat, - svcraw_getargs, - svcraw_reply, - svcraw_freeargs, - svcraw_destroy -}; - -SVCXPRT *svcraw_create() -{ - register struct svcraw_private *srp = svcraw_private; - - if (srp == 0) { - srp = (struct svcraw_private *) calloc(1, sizeof(*srp)); - if (srp == 0) - return (0); - } - srp->server.xp_sock = 0; - srp->server.xp_port = 0; - srp->server.xp_ops = &server_ops; - srp->server.xp_verf.oa_base = srp->verf_body; - xdrmem_create(&srp->xdr_stream, srp->_raw_buf, UDPMSGSIZE, XDR_FREE); - return (&srp->server); -} - -static enum xprt_stat svcraw_stat() -{ - - return (XPRT_IDLE); -} - -static bool_t svcraw_recv(xprt, msg) -SVCXPRT *xprt; -struct rpc_msg *msg; -{ - register struct svcraw_private *srp = svcraw_private; - register XDR *xdrs; - - if (srp == 0) - return (0); - xdrs = &srp->xdr_stream; - xdrs->x_op = XDR_DECODE; - XDR_SETPOS(xdrs, 0); - if (!xdr_callmsg(xdrs, msg)) - return (FALSE); - return (TRUE); -} - -static bool_t svcraw_reply(xprt, msg) -SVCXPRT *xprt; -struct rpc_msg *msg; -{ - register struct svcraw_private *srp = svcraw_private; - register XDR *xdrs; - - if (srp == 0) - return (FALSE); - xdrs = &srp->xdr_stream; - xdrs->x_op = XDR_ENCODE; - XDR_SETPOS(xdrs, 0); - if (!xdr_replymsg(xdrs, msg)) - return (FALSE); - (void) XDR_GETPOS(xdrs); /* called just for overhead */ - return (TRUE); -} - -static bool_t svcraw_getargs(xprt, xdr_args, args_ptr) -SVCXPRT *xprt; -xdrproc_t xdr_args; -caddr_t args_ptr; -{ - register struct svcraw_private *srp = svcraw_private; - - if (srp == 0) - return (FALSE); - return ((*xdr_args) (&srp->xdr_stream, args_ptr)); -} - -static bool_t svcraw_freeargs(xprt, xdr_args, args_ptr) -SVCXPRT *xprt; -xdrproc_t xdr_args; -caddr_t args_ptr; -{ - register struct svcraw_private *srp = svcraw_private; - register XDR *xdrs; - - if (srp == 0) - return (FALSE); - xdrs = &srp->xdr_stream; - xdrs->x_op = XDR_FREE; - return ((*xdr_args) (xdrs, args_ptr)); -} - -static void svcraw_destroy() -{ -} diff --git a/mdk-stage1/dietlibc/librpc/svc_run.c b/mdk-stage1/dietlibc/librpc/svc_run.c deleted file mode 100644 index c7150e357..000000000 --- a/mdk-stage1/dietlibc/librpc/svc_run.c +++ /dev/null @@ -1,71 +0,0 @@ -/* @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro"; -#endif - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * This is the rpc server side idle loop - * Wait for input, call server program. - */ -#include <rpc/rpc.h> -#include <errno.h> -#include <unistd.h> - -void svc_run() -{ -#ifdef FD_SETSIZE - fd_set readfds; -#else - int readfds; -#endif /* def FD_SETSIZE */ - extern int errno; - - for (;;) { -#ifdef FD_SETSIZE - readfds = svc_fdset; -#else - readfds = svc_fds; -#endif /* def FD_SETSIZE */ - switch (select(_rpc_dtablesize(), &readfds, 0, 0, 0)) { - case -1: - if (errno == EINTR) { - continue; - } - perror("svc_run: - select failed"); - return; - case 0: - continue; - default: - svc_getreqset(&readfds); - } - } -} diff --git a/mdk-stage1/dietlibc/librpc/svc_simple.c b/mdk-stage1/dietlibc/librpc/svc_simple.c deleted file mode 100644 index 0bb9a19eb..000000000 --- a/mdk-stage1/dietlibc/librpc/svc_simple.c +++ /dev/null @@ -1,144 +0,0 @@ -/* @(#)svc_simple.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * svc_simple.c - * Simplified front end to rpc. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <stdio.h> -#include <rpc/rpc.h> -#include <sys/socket.h> -#include <netdb.h> -#include <rpc/pmap_clnt.h> -#include <string.h> - -static struct proglst { - char *(*p_progname) (); - int p_prognum; - int p_procnum; - xdrproc_t p_inproc, p_outproc; - struct proglst *p_nxt; -} *proglst; -static void universal(); -static SVCXPRT *transp; -struct proglst *pl; - -int registerrpc(int prognum, int versnum, int procnum, char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc) -{ - - if (procnum == NULLPROC) { - (void) fprintf(stderr, - "can't reassign procedure number %d\n", NULLPROC); - return (-1); - } - if (transp == 0) { - transp = svcudp_create(RPC_ANYSOCK); - if (transp == NULL) { - (void) fprintf(stderr, "couldn't create an rpc server\n"); - return (-1); - } - } - (void) pmap_unset((u_long) prognum, (u_long) versnum); - if (!svc_register(transp, (u_long) prognum, (u_long) versnum, - universal, IPPROTO_UDP)) { - (void) fprintf(stderr, "couldn't register prog %d vers %d\n", - prognum, versnum); - return (-1); - } - pl = (struct proglst *) malloc(sizeof(struct proglst)); - - if (pl == NULL) { - (void) fprintf(stderr, "registerrpc: out of memory\n"); - return (-1); - } - pl->p_progname = progname; - pl->p_prognum = prognum; - pl->p_procnum = procnum; - pl->p_inproc = inproc; - pl->p_outproc = outproc; - pl->p_nxt = proglst; - proglst = pl; - return (0); -} - -static void universal(rqstp, transp) -struct svc_req *rqstp; -SVCXPRT *transp; -{ - int prog, proc; - char *outdata; - char xdrbuf[UDPMSGSIZE]; - struct proglst *pl; - - /* - * enforce "procnum 0 is echo" convention - */ - if (rqstp->rq_proc == NULLPROC) { - if (svc_sendreply(transp, (xdrproc_t)xdr_void, (char *) NULL) == FALSE) { - (void) fprintf(stderr, "xxx\n"); - exit(1); - } - return; - } - prog = rqstp->rq_prog; - proc = rqstp->rq_proc; - for (pl = proglst; pl != NULL; pl = pl->p_nxt) - if (pl->p_prognum == prog && pl->p_procnum == proc) { - /* decode arguments into a CLEAN buffer */ - bzero(xdrbuf, sizeof(xdrbuf)); /* required ! */ - if (!svc_getargs(transp, pl->p_inproc, xdrbuf)) { - svcerr_decode(transp); - return; - } - outdata = (*(pl->p_progname)) (xdrbuf); - if (outdata == NULL && pl->p_outproc != (xdrproc_t)xdr_void) - /* there was an error */ - return; - if (!svc_sendreply(transp, pl->p_outproc, outdata)) { - (void) fprintf(stderr, - "trouble replying to prog %d\n", - pl->p_prognum); - exit(1); - } - /* free the decoded arguments */ - (void) svc_freeargs(transp, pl->p_inproc, xdrbuf); - return; - } - (void) fprintf(stderr, "never registered prog %d\n", prog); - exit(1); -} diff --git a/mdk-stage1/dietlibc/librpc/svc_tcp.c b/mdk-stage1/dietlibc/librpc/svc_tcp.c deleted file mode 100644 index 6edafa1b1..000000000 --- a/mdk-stage1/dietlibc/librpc/svc_tcp.c +++ /dev/null @@ -1,406 +0,0 @@ -/* @(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * svc_tcp.c, Server side for TCP/IP based RPC. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * Actually implements two flavors of transporter - - * a tcp rendezvouser (a listner and connection establisher) - * and a record/tcp stream. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <rpc/rpc.h> -#include <sys/socket.h> -#include <errno.h> -#include <string.h> -#include <unistd.h> - -/* - * Ops vector for TCP/IP based rpc service handle - */ -static bool_t svctcp_recv(); -static enum xprt_stat svctcp_stat(); -static bool_t svctcp_getargs(); -static bool_t svctcp_reply(); -static bool_t svctcp_freeargs(); -static void svctcp_destroy(); - -static struct xp_ops svctcp_op = { - svctcp_recv, - svctcp_stat, - svctcp_getargs, - svctcp_reply, - svctcp_freeargs, - svctcp_destroy -}; - -/* - * Ops vector for TCP/IP rendezvous handler - */ -static bool_t rendezvous_request(); -static enum xprt_stat rendezvous_stat(); - -static struct xp_ops svctcp_rendezvous_op = { - rendezvous_request, - rendezvous_stat, - (void*)abort, - (void*)abort, - (void*)abort, - svctcp_destroy -}; - -static int readtcp(), writetcp(); -static SVCXPRT *makefd_xprt(); - -struct tcp_rendezvous { /* kept in xprt->xp_p1 */ - u_int sendsize; - u_int recvsize; -}; - -struct tcp_conn { /* kept in xprt->xp_p1 */ - enum xprt_stat strm_stat; - u_long x_id; - XDR xdrs; - char verf_body[MAX_AUTH_BYTES]; -}; - -/* - * Usage: - * xprt = svctcp_create(sock, send_buf_size, recv_buf_size); - * - * Creates, registers, and returns a (rpc) tcp based transporter. - * Once *xprt is initialized, it is registered as a transporter - * see (svc.h, xprt_register). This routine returns - * a NULL if a problem occurred. - * - * If sock<0 then a socket is created, else sock is used. - * If the socket, sock is not bound to a port then svctcp_create - * binds it to an arbitrary port. The routine then starts a tcp - * listener on the socket's associated port. In any (successful) case, - * xprt->xp_sock is the registered socket number and xprt->xp_port is the - * associated port number. - * - * Since tcp streams do buffered io similar to stdio, the caller can specify - * how big the send and receive buffers are via the second and third parms; - * 0 => use the system default. - */ -SVCXPRT *svctcp_create(sock, sendsize, recvsize) -register int sock; -u_int sendsize; -u_int recvsize; -{ - bool_t madesock = FALSE; - register SVCXPRT *xprt; - register struct tcp_rendezvous *r; - struct sockaddr_in addr; - int len = sizeof(struct sockaddr_in); - - if (sock == RPC_ANYSOCK) { - if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { - perror("svc_tcp.c - tcp socket creation problem"); - return ((SVCXPRT *) NULL); - } - madesock = TRUE; - } - bzero((char *) &addr, sizeof(addr)); - addr.sin_family = AF_INET; - if (bindresvport(sock, &addr)) { - addr.sin_port = 0; - (void) bind(sock, (struct sockaddr *) &addr, len); - } - if ((getsockname(sock, (struct sockaddr *) &addr, &len) != 0) || - (listen(sock, 2) != 0)) { - perror("svctcp_.c - cannot getsockname or listen"); - if (madesock) - (void) close(sock); - return ((SVCXPRT *) NULL); - } - r = (struct tcp_rendezvous *) mem_alloc(sizeof(*r)); - if (r == NULL) { - (void) fprintf(stderr, "svctcp_create: out of memory\n"); - return (NULL); - } - r->sendsize = sendsize; - r->recvsize = recvsize; - xprt = (SVCXPRT *) mem_alloc(sizeof(SVCXPRT)); - if (xprt == NULL) { - (void) fprintf(stderr, "svctcp_create: out of memory\n"); - return (NULL); - } - xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) r; - xprt->xp_verf = _null_auth; - xprt->xp_ops = &svctcp_rendezvous_op; - xprt->xp_port = ntohs(addr.sin_port); - xprt->xp_sock = sock; - xprt_register(xprt); - return (xprt); -} - -/* - * Like svtcp_create(), except the routine takes any *open* UNIX file - * descriptor as its first input. - */ -SVCXPRT *svcfd_create(fd, sendsize, recvsize) -int fd; -u_int sendsize; -u_int recvsize; -{ - - return (makefd_xprt(fd, sendsize, recvsize)); -} - -static SVCXPRT *makefd_xprt(fd, sendsize, recvsize) -int fd; -u_int sendsize; -u_int recvsize; -{ - register SVCXPRT *xprt; - register struct tcp_conn *cd; - - xprt = (SVCXPRT *) mem_alloc(sizeof(SVCXPRT)); - if (xprt == (SVCXPRT *) NULL) { - (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n"); - goto done; - } - cd = (struct tcp_conn *) mem_alloc(sizeof(struct tcp_conn)); - - if (cd == (struct tcp_conn *) NULL) { - (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n"); - mem_free((char *) xprt, sizeof(SVCXPRT)); - xprt = (SVCXPRT *) NULL; - goto done; - } - cd->strm_stat = XPRT_IDLE; - xdrrec_create(&(cd->xdrs), sendsize, recvsize, - (caddr_t) xprt, readtcp, writetcp); - xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) cd; - xprt->xp_verf.oa_base = cd->verf_body; - xprt->xp_addrlen = 0; - xprt->xp_ops = &svctcp_op; /* truely deals with calls */ - xprt->xp_port = 0; /* this is a connection, not a rendezvouser */ - xprt->xp_sock = fd; - xprt_register(xprt); - done: - return (xprt); -} - -static bool_t rendezvous_request(xprt) -register SVCXPRT *xprt; -{ - int sock; - struct tcp_rendezvous *r; - struct sockaddr_in addr; - int len; - - r = (struct tcp_rendezvous *) xprt->xp_p1; - again: - len = sizeof(struct sockaddr_in); - - if ((sock = accept(xprt->xp_sock, (struct sockaddr *) &addr, - &len)) < 0) { - if (errno == EINTR) - goto again; - return (FALSE); - } - /* - * make a new transporter (re-uses xprt) - */ - xprt = makefd_xprt(sock, r->sendsize, r->recvsize); - xprt->xp_raddr = addr; - xprt->xp_addrlen = len; - return (FALSE); /* there is never an rpc msg to be processed */ -} - -static enum xprt_stat rendezvous_stat() -{ - - return (XPRT_IDLE); -} - -static void svctcp_destroy(xprt) -register SVCXPRT *xprt; -{ - register struct tcp_conn *cd = (struct tcp_conn *) xprt->xp_p1; - - xprt_unregister(xprt); - (void) close(xprt->xp_sock); - if (xprt->xp_port != 0) { - /* a rendezvouser socket */ - xprt->xp_port = 0; - } else { - /* an actual connection socket */ - XDR_DESTROY(&(cd->xdrs)); - } - mem_free((caddr_t) cd, sizeof(struct tcp_conn)); - - mem_free((caddr_t) xprt, sizeof(SVCXPRT)); -} - -/* - * All read operations timeout after 35 seconds. - * A timeout is fatal for the connection. - */ -static struct timeval wait_per_try = { 35, 0 }; - -/* - * reads data from the tcp conection. - * any error is fatal and the connection is closed. - * (And a read of zero bytes is a half closed stream => error.) - */ -static int readtcp(xprt, buf, len) -register SVCXPRT *xprt; -caddr_t buf; -register int len; -{ - register int sock = xprt->xp_sock; - -#ifdef FD_SETSIZE - fd_set mask; - fd_set readfds; - - FD_ZERO(&mask); - FD_SET(sock, &mask); -#else - register int mask = 1 << sock; - int readfds; -#endif /* def FD_SETSIZE */ - do { - readfds = mask; - if (select(_rpc_dtablesize(), &readfds, 0, 0, &wait_per_try) <= 0) { - if (errno == EINTR) { - continue; - } - goto fatal_err; - } -#ifdef FD_SETSIZE - } while (!FD_ISSET(sock, &readfds)); -#else - } while (readfds != mask); -#endif /* def FD_SETSIZE */ - if ((len = read(sock, buf, len)) > 0) { - return (len); - } - fatal_err: - ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED; - return (-1); -} - -/* - * writes data to the tcp connection. - * Any error is fatal and the connection is closed. - */ -static int writetcp(xprt, buf, len) -register SVCXPRT *xprt; -caddr_t buf; -int len; -{ - register int i, cnt; - - for (cnt = len; cnt > 0; cnt -= i, buf += i) { - if ((i = write(xprt->xp_sock, buf, cnt)) < 0) { - ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED; - return (-1); - } - } - return (len); -} - -static enum xprt_stat svctcp_stat(xprt) -SVCXPRT *xprt; -{ - register struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1); - - if (cd->strm_stat == XPRT_DIED) - return (XPRT_DIED); - if (!xdrrec_eof(&(cd->xdrs))) - return (XPRT_MOREREQS); - return (XPRT_IDLE); -} - -static bool_t svctcp_recv(xprt, msg) -SVCXPRT *xprt; -register struct rpc_msg *msg; -{ - register struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1); - register XDR *xdrs = &(cd->xdrs); - - xdrs->x_op = XDR_DECODE; - (void) xdrrec_skiprecord(xdrs); - if (xdr_callmsg(xdrs, msg)) { - cd->x_id = msg->rm_xid; - return (TRUE); - } - return (FALSE); -} - -static bool_t svctcp_getargs(xprt, xdr_args, args_ptr) -SVCXPRT *xprt; -xdrproc_t xdr_args; -caddr_t args_ptr; -{ - - return ((*xdr_args) - (&(((struct tcp_conn *) (xprt->xp_p1))->xdrs), args_ptr)); -} - -static bool_t svctcp_freeargs(xprt, xdr_args, args_ptr) -SVCXPRT *xprt; -xdrproc_t xdr_args; -caddr_t args_ptr; -{ - register XDR *xdrs = &(((struct tcp_conn *) (xprt->xp_p1))->xdrs); - - xdrs->x_op = XDR_FREE; - return ((*xdr_args) (xdrs, args_ptr)); -} - -static bool_t svctcp_reply(xprt, msg) -SVCXPRT *xprt; -register struct rpc_msg *msg; -{ - register struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1); - register XDR *xdrs = &(cd->xdrs); - register bool_t stat; - - xdrs->x_op = XDR_ENCODE; - msg->rm_xid = cd->x_id; - stat = xdr_replymsg(xdrs, msg); - (void) xdrrec_endofrecord(xdrs, TRUE); - return (stat); -} diff --git a/mdk-stage1/dietlibc/librpc/svc_udp.c b/mdk-stage1/dietlibc/librpc/svc_udp.c deleted file mode 100644 index 1cdb5ce91..000000000 --- a/mdk-stage1/dietlibc/librpc/svc_udp.c +++ /dev/null @@ -1,467 +0,0 @@ -/* @(#)svc_udp.c 2.2 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * svc_udp.c, - * Server side for UDP/IP based RPC. (Does some caching in the hopes of - * achieving execute-at-most-once semantics.) - * - * Copyright (C) 1984, Sun Microsystems, Inc. - */ - -#include <stdio.h> -#include <rpc/rpc.h> -#include <sys/socket.h> -#include <errno.h> -#include <string.h> -#include <unistd.h> - - -#define rpc_buffer(xprt) ((xprt)->xp_p1) -#define MAX(a, b) ((a > b) ? a : b) - -static bool_t svcudp_recv(); -static bool_t svcudp_reply(); -static enum xprt_stat svcudp_stat(); -static bool_t svcudp_getargs(); -static bool_t svcudp_freeargs(); -static void svcudp_destroy(); - -static struct xp_ops svcudp_op = { - svcudp_recv, - svcudp_stat, - svcudp_getargs, - svcudp_reply, - svcudp_freeargs, - svcudp_destroy -}; - -extern int errno; - -/* - * kept in xprt->xp_p2 - */ -struct svcudp_data { - u_int su_iosz; /* byte size of send.recv buffer */ - u_long su_xid; /* transaction id */ - XDR su_xdrs; /* XDR handle */ - char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */ - char *su_cache; /* cached data, NULL if no cache */ -}; - -#define su_data(xprt) ((struct svcudp_data *)(xprt->xp_p2)) - -static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long* replylenp); -static void cache_set(SVCXPRT* xprt, u_long replylen); - -/* - * Usage: - * xprt = svcudp_create(sock); - * - * If sock<0 then a socket is created, else sock is used. - * If the socket, sock is not bound to a port then svcudp_create - * binds it to an arbitrary port. In any (successful) case, - * xprt->xp_sock is the registered socket number and xprt->xp_port is the - * associated port number. - * Once *xprt is initialized, it is registered as a transporter; - * see (svc.h, xprt_register). - * The routines returns NULL if a problem occurred. - */ -SVCXPRT *svcudp_bufcreate(sock, sendsz, recvsz) -register int sock; -u_int sendsz, recvsz; -{ - bool_t madesock = FALSE; - register SVCXPRT *xprt; - register struct svcudp_data *su; - struct sockaddr_in addr; - int len = sizeof(struct sockaddr_in); - - if (sock == RPC_ANYSOCK) { - if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { - perror("svcudp_create: socket creation problem"); - return ((SVCXPRT *) NULL); - } - madesock = TRUE; - } - bzero((char *) &addr, sizeof(addr)); - addr.sin_family = AF_INET; - if (bindresvport(sock, &addr)) { - addr.sin_port = 0; - (void) bind(sock, (struct sockaddr *) &addr, len); - } - if (getsockname(sock, (struct sockaddr *) &addr, &len) != 0) { - perror("svcudp_create - cannot getsockname"); - if (madesock) - (void) close(sock); - return ((SVCXPRT *) NULL); - } - xprt = (SVCXPRT *) mem_alloc(sizeof(SVCXPRT)); - if (xprt == NULL) { - (void) fprintf(stderr, "svcudp_create: out of memory\n"); - return (NULL); - } - su = (struct svcudp_data *) mem_alloc(sizeof(*su)); - if (su == NULL) { - (void) fprintf(stderr, "svcudp_create: out of memory\n"); - return (NULL); - } - su->su_iosz = ((MAX(sendsz, recvsz) + 3) / 4) * 4; - if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL) { - (void) fprintf(stderr, "svcudp_create: out of memory\n"); - return (NULL); - } - xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz, - XDR_DECODE); - su->su_cache = NULL; - xprt->xp_p2 = (caddr_t) su; - xprt->xp_verf.oa_base = su->su_verfbody; - xprt->xp_ops = &svcudp_op; - xprt->xp_port = ntohs(addr.sin_port); - xprt->xp_sock = sock; - xprt_register(xprt); - return (xprt); -} - -SVCXPRT *svcudp_create(sock) -int sock; -{ - - return (svcudp_bufcreate(sock, UDPMSGSIZE, UDPMSGSIZE)); -} - -static enum xprt_stat svcudp_stat(xprt) -SVCXPRT *xprt; -{ - - return (XPRT_IDLE); -} - -static bool_t svcudp_recv(xprt, msg) -register SVCXPRT *xprt; -struct rpc_msg *msg; -{ - register struct svcudp_data *su = su_data(xprt); - register XDR *xdrs = &(su->su_xdrs); - register int rlen; - char *reply; - u_long replylen; - - again: - xprt->xp_addrlen = sizeof(struct sockaddr_in); - - rlen = recvfrom(xprt->xp_sock, rpc_buffer(xprt), (int) su->su_iosz, - 0, (struct sockaddr *) &(xprt->xp_raddr), - &(xprt->xp_addrlen)); - if (rlen == -1 && errno == EINTR) - goto again; - if (rlen < 4 * sizeof(u_long)) - return (FALSE); - xdrs->x_op = XDR_DECODE; - XDR_SETPOS(xdrs, 0); - if (!xdr_callmsg(xdrs, msg)) - return (FALSE); - su->su_xid = msg->rm_xid; - if (su->su_cache != NULL) { - if (cache_get(xprt, msg, &reply, &replylen)) { - (void) sendto(xprt->xp_sock, reply, (int) replylen, 0, - (struct sockaddr *) &xprt->xp_raddr, - xprt->xp_addrlen); - return (TRUE); - } - } - return (TRUE); -} - -static bool_t svcudp_reply(xprt, msg) -register SVCXPRT *xprt; -struct rpc_msg *msg; -{ - register struct svcudp_data *su = su_data(xprt); - register XDR *xdrs = &(su->su_xdrs); - register int slen; - register bool_t stat = FALSE; - - xdrs->x_op = XDR_ENCODE; - XDR_SETPOS(xdrs, 0); - msg->rm_xid = su->su_xid; - if (xdr_replymsg(xdrs, msg)) { - slen = (int) XDR_GETPOS(xdrs); - if (sendto(xprt->xp_sock, rpc_buffer(xprt), slen, 0, - (struct sockaddr *) &(xprt->xp_raddr), xprt->xp_addrlen) - == slen) { - stat = TRUE; - if (su->su_cache && slen >= 0) { - cache_set(xprt, (u_long) slen); - } - } - } - return (stat); -} - -static bool_t svcudp_getargs(xprt, xdr_args, args_ptr) -SVCXPRT *xprt; -xdrproc_t xdr_args; -caddr_t args_ptr; -{ - - return ((*xdr_args) (&(su_data(xprt)->su_xdrs), args_ptr)); -} - -static bool_t svcudp_freeargs(xprt, xdr_args, args_ptr) -SVCXPRT *xprt; -xdrproc_t xdr_args; -caddr_t args_ptr; -{ - register XDR *xdrs = &(su_data(xprt)->su_xdrs); - - xdrs->x_op = XDR_FREE; - return ((*xdr_args) (xdrs, args_ptr)); -} - -static void svcudp_destroy(xprt) -register SVCXPRT *xprt; -{ - register struct svcudp_data *su = su_data(xprt); - - xprt_unregister(xprt); - (void) close(xprt->xp_sock); - XDR_DESTROY(&(su->su_xdrs)); - mem_free(rpc_buffer(xprt), su->su_iosz); - mem_free((caddr_t) su, sizeof(struct svcudp_data)); - - mem_free((caddr_t) xprt, sizeof(SVCXPRT)); -} - - -/***********this could be a separate file*********************/ - -/* - * Fifo cache for udp server - * Copies pointers to reply buffers into fifo cache - * Buffers are sent again if retransmissions are detected. - */ - -#define SPARSENESS 4 /* 75% sparse */ - -#define CACHE_PERROR(msg) \ - (void) fprintf(stderr,"%s\n", msg) - -#define ALLOC(type, size) \ - (type *) mem_alloc((unsigned) (sizeof(type) * (size))) - -#define BZERO(addr, type, size) \ - bzero((char *) addr, sizeof(type) * (int) (size)) - -/* - * An entry in the cache - */ -typedef struct cache_node *cache_ptr; -struct cache_node { - /* - * Index into cache is xid, proc, vers, prog and address - */ - u_long cache_xid; - u_long cache_proc; - u_long cache_vers; - u_long cache_prog; - struct sockaddr_in cache_addr; - /* - * The cached reply and length - */ - char *cache_reply; - u_long cache_replylen; - /* - * Next node on the list, if there is a collision - */ - cache_ptr cache_next; -}; - - - -/* - * The entire cache - */ -struct udp_cache { - u_long uc_size; /* size of cache */ - cache_ptr *uc_entries; /* hash table of entries in cache */ - cache_ptr *uc_fifo; /* fifo list of entries in cache */ - u_long uc_nextvictim; /* points to next victim in fifo list */ - u_long uc_prog; /* saved program number */ - u_long uc_vers; /* saved version number */ - u_long uc_proc; /* saved procedure number */ - struct sockaddr_in uc_addr; /* saved caller's address */ -}; - - -/* - * the hashing function - */ -#define CACHE_LOC(transp, xid) \ - (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size)) - - -/* - * Enable use of the cache. - * Note: there is no disable. - */ -int svcudp_enablecache(SVCXPRT* transp, u_long size) -{ - struct svcudp_data *su = su_data(transp); - struct udp_cache *uc; - - if (su->su_cache != NULL) { - CACHE_PERROR("enablecache: cache already enabled"); - return (0); - } - uc = ALLOC(struct udp_cache, 1); - if (uc == NULL) { - CACHE_PERROR("enablecache: could not allocate cache"); - return (0); - } - uc->uc_size = size; - uc->uc_nextvictim = 0; - uc->uc_entries = ALLOC(cache_ptr, size * SPARSENESS); - if (uc->uc_entries == NULL) { - CACHE_PERROR("enablecache: could not allocate cache data"); - return (0); - } - BZERO(uc->uc_entries, cache_ptr, size * SPARSENESS); - uc->uc_fifo = ALLOC(cache_ptr, size); - if (uc->uc_fifo == NULL) { - CACHE_PERROR("enablecache: could not allocate cache fifo"); - return (0); - } - BZERO(uc->uc_fifo, cache_ptr, size); - su->su_cache = (char *) uc; - return (1); -} - - -/* - * Set an entry in the cache - */ -static void cache_set(SVCXPRT* xprt, u_long replylen) -{ - register cache_ptr victim; - register cache_ptr *vicp; - register struct svcudp_data *su = su_data(xprt); - struct udp_cache *uc = (struct udp_cache *) su->su_cache; - u_int loc; - char *newbuf; - - /* - * Find space for the new entry, either by - * reusing an old entry, or by mallocing a new one - */ - victim = uc->uc_fifo[uc->uc_nextvictim]; - if (victim != NULL) { - loc = CACHE_LOC(xprt, victim->cache_xid); - for (vicp = &uc->uc_entries[loc]; - *vicp != NULL && *vicp != victim; - vicp = &(*vicp)->cache_next); - if (*vicp == NULL) { - CACHE_PERROR("cache_set: victim not found"); - return; - } - *vicp = victim->cache_next; /* remote from cache */ - newbuf = victim->cache_reply; - } else { - victim = ALLOC(struct cache_node, 1); - - if (victim == NULL) { - CACHE_PERROR("cache_set: victim alloc failed"); - return; - } - newbuf = mem_alloc(su->su_iosz); - if (newbuf == NULL) { - CACHE_PERROR("cache_set: could not allocate new rpc_buffer"); - return; - } - } - - /* - * Store it away - */ - victim->cache_replylen = replylen; - victim->cache_reply = rpc_buffer(xprt); - rpc_buffer(xprt) = newbuf; - xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz, - XDR_ENCODE); - victim->cache_xid = su->su_xid; - victim->cache_proc = uc->uc_proc; - victim->cache_vers = uc->uc_vers; - victim->cache_prog = uc->uc_prog; - victim->cache_addr = uc->uc_addr; - loc = CACHE_LOC(xprt, victim->cache_xid); - victim->cache_next = uc->uc_entries[loc]; - uc->uc_entries[loc] = victim; - uc->uc_fifo[uc->uc_nextvictim++] = victim; - uc->uc_nextvictim %= uc->uc_size; -} - -/* - * Try to get an entry from the cache - * return 1 if found, 0 if not found - */ -static int cache_get(SVCXPRT* xprt, struct rpc_msg* msg, char** replyp, u_long* replylenp) -{ - u_int loc; - register cache_ptr ent; - register struct svcudp_data *su = su_data(xprt); - register struct udp_cache *uc = (struct udp_cache *) su->su_cache; - -# define EQADDR(a1, a2) (bcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0) - - loc = CACHE_LOC(xprt, su->su_xid); - for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next) { - if (ent->cache_xid == su->su_xid && - ent->cache_proc == uc->uc_proc && - ent->cache_vers == uc->uc_vers && - ent->cache_prog == uc->uc_prog && - EQADDR(ent->cache_addr, uc->uc_addr)) { - *replyp = ent->cache_reply; - *replylenp = ent->cache_replylen; - return (1); - } - } - /* - * Failed to find entry - * Remember a few things so we can do a set later - */ - uc->uc_proc = msg->rm_call.cb_proc; - uc->uc_vers = msg->rm_call.cb_vers; - uc->uc_prog = msg->rm_call.cb_prog; - uc->uc_addr = xprt->xp_raddr; - return (0); -} diff --git a/mdk-stage1/dietlibc/librpc/xdr.c b/mdk-stage1/dietlibc/librpc/xdr.c deleted file mode 100644 index 864b47dea..000000000 --- a/mdk-stage1/dietlibc/librpc/xdr.c +++ /dev/null @@ -1,536 +0,0 @@ -/* @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; -#endif - -/* - * xdr.c, Generic XDR routines implementation. - * - * Copyright (C) 1986, Sun Microsystems, Inc. - * - * These are the "generic" xdr routines used to serialize and de-serialize - * most common data items. See xdr.h for more info on the interface to - * xdr. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <string.h> - -/* - * constants specific to the xdr "protocol" - */ -#define XDR_FALSE ((long) 0) -#define XDR_TRUE ((long) 1) -#define LASTUNSIGNED ((u_int) 0-1) - -/* - * for unit alignment - */ -static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; - -/* - * Free a data structure using XDR - * Not a filter, but a convenient utility nonetheless - */ -void xdr_free(xdrproc_t proc, char* objp) -{ - XDR x; - - x.x_op = XDR_FREE; - (*proc) (&x, objp); -} - -/* - * XDR nothing - */ -bool_t xdr_void( /* xdrs, addr */ ) - /* XDR *xdrs; */ - /* caddr_t addr; */ -{ - - return (TRUE); -} - -/* - * XDR integers - */ -bool_t xdr_int(XDR* xdrs, int* ip) -{ - -#ifdef lint - (void) (xdr_short(xdrs, (short *) ip)); - return (xdr_long(xdrs, (long *) ip)); -#else - if (sizeof(int) == sizeof(long)) { - return (xdr_long(xdrs, (long *) ip)); - } else { - return (xdr_short(xdrs, (short *) ip)); - } -#endif -} - -/* - * XDR unsigned integers - */ -bool_t xdr_u_int(XDR* xdrs, unsigned int* up) -{ - -#ifdef lint - (void) (xdr_short(xdrs, (short *) up)); - return (xdr_u_long(xdrs, (u_long *) up)); -#else - if (sizeof(u_int) == sizeof(u_long)) { - return (xdr_u_long(xdrs, (u_long *) up)); - } else { - return (xdr_short(xdrs, (short *) up)); - } -#endif -} - -/* - * XDR long integers - * same as xdr_u_long - open coded to save a proc call! - */ -bool_t xdr_long(XDR* xdrs, long* lp) -{ - - if (xdrs->x_op == XDR_ENCODE) - return (XDR_PUTLONG(xdrs, lp)); - - if (xdrs->x_op == XDR_DECODE) - return (XDR_GETLONG(xdrs, lp)); - - if (xdrs->x_op == XDR_FREE) - return (TRUE); - - return (FALSE); -} - -/* - * XDR unsigned long integers - * same as xdr_long - open coded to save a proc call! - */ -bool_t xdr_u_long(XDR* xdrs, unsigned long* ulp) -{ - - if (xdrs->x_op == XDR_DECODE) - return (XDR_GETLONG(xdrs, (long *) ulp)); - if (xdrs->x_op == XDR_ENCODE) - return (XDR_PUTLONG(xdrs, (long *) ulp)); - if (xdrs->x_op == XDR_FREE) - return (TRUE); - return (FALSE); -} - -/* - * XDR short integers - */ -bool_t xdr_short(XDR* xdrs, short* sp) -{ - long l; - - switch (xdrs->x_op) { - - case XDR_ENCODE: - l = (long) *sp; - return (XDR_PUTLONG(xdrs, &l)); - - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { - return (FALSE); - } - *sp = (short) l; - return (TRUE); - - case XDR_FREE: - return (TRUE); - } - return (FALSE); -} - -/* - * XDR unsigned short integers - */ -bool_t xdr_u_short(XDR* xdrs, unsigned short* usp) -{ - u_long l; - - switch (xdrs->x_op) { - - case XDR_ENCODE: - l = (u_long) * usp; - return (XDR_PUTLONG(xdrs, &l)); - - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { - return (FALSE); - } - *usp = (u_short) l; - return (TRUE); - - case XDR_FREE: - return (TRUE); - } - return (FALSE); -} - - -/* - * XDR a char - */ -bool_t xdr_char(XDR* xdrs, char* cp) -{ - int i; - - i = (*cp); - if (!xdr_int(xdrs, &i)) { - return (FALSE); - } - *cp = i; - return (TRUE); -} - -/* - * XDR an unsigned char - */ -bool_t xdr_u_char(XDR* xdrs, unsigned char* cp) -{ - u_int u; - - u = (*cp); - if (!xdr_u_int(xdrs, &u)) { - return (FALSE); - } - *cp = u; - return (TRUE); -} - -/* - * XDR booleans - */ -bool_t xdr_bool(xdrs, bp) -register XDR *xdrs; -bool_t *bp; -{ - long lb; - - switch (xdrs->x_op) { - - case XDR_ENCODE: - lb = *bp ? XDR_TRUE : XDR_FALSE; - return (XDR_PUTLONG(xdrs, &lb)); - - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &lb)) { - return (FALSE); - } - *bp = (lb == XDR_FALSE) ? FALSE : TRUE; - return (TRUE); - - case XDR_FREE: - return (TRUE); - } - return (FALSE); -} - -/* - * XDR enumerations - */ -bool_t xdr_enum(xdrs, ep) -XDR *xdrs; -enum_t *ep; -{ -#ifndef lint - enum sizecheck { SIZEVAL }; /* used to find the size of an enum */ - - /* - * enums are treated as ints - */ - if (sizeof(enum sizecheck) == sizeof(long)) { - return (xdr_long(xdrs, (long *) ep)); - } else if (sizeof(enum sizecheck) == sizeof(short)) { - return (xdr_short(xdrs, (short *) ep)); - } else { - return (FALSE); - } -#else - (void) (xdr_short(xdrs, (short *) ep)); - return (xdr_long(xdrs, (long *) ep)); -#endif -} - -/* - * XDR opaque data - * Allows the specification of a fixed size sequence of opaque bytes. - * cp points to the opaque object and cnt gives the byte length. - */ -bool_t xdr_opaque(xdrs, cp, cnt) -register XDR *xdrs; -caddr_t cp; -register u_int cnt; -{ - register u_int rndup; - static char crud[BYTES_PER_XDR_UNIT]; - - /* - * if no data we are done - */ - if (cnt == 0) - return (TRUE); - - /* - * round byte count to full xdr units - */ - rndup = cnt % BYTES_PER_XDR_UNIT; - if (rndup > 0) - rndup = BYTES_PER_XDR_UNIT - rndup; - - if (xdrs->x_op == XDR_DECODE) { - if (!XDR_GETBYTES(xdrs, cp, cnt)) { - return (FALSE); - } - if (rndup == 0) - return (TRUE); - return (XDR_GETBYTES(xdrs, crud, rndup)); - } - - if (xdrs->x_op == XDR_ENCODE) { - if (!XDR_PUTBYTES(xdrs, cp, cnt)) { - return (FALSE); - } - if (rndup == 0) - return (TRUE); - return (XDR_PUTBYTES(xdrs, xdr_zero, rndup)); - } - - if (xdrs->x_op == XDR_FREE) { - return (TRUE); - } - - return (FALSE); -} - -/* - * XDR counted bytes - * *cpp is a pointer to the bytes, *sizep is the count. - * If *cpp is NULL maxsize bytes are allocated - */ -bool_t xdr_bytes(xdrs, cpp, sizep, maxsize) -register XDR *xdrs; -char **cpp; -register u_int *sizep; -u_int maxsize; -{ - register char *sp = *cpp; /* sp is the actual string pointer */ - register u_int nodesize; - - /* - * first deal with the length since xdr bytes are counted - */ - if (!xdr_u_int(xdrs, sizep)) { - return (FALSE); - } - nodesize = *sizep; - if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) { - return (FALSE); - } - - /* - * now deal with the actual bytes - */ - switch (xdrs->x_op) { - - case XDR_DECODE: - if (nodesize == 0) { - return (TRUE); - } - if (sp == NULL) { - *cpp = sp = (char *) mem_alloc(nodesize); - } - if (sp == NULL) { - (void) fprintf(stderr, "xdr_bytes: out of memory\n"); - return (FALSE); - } - /* fall into ... */ - - case XDR_ENCODE: - return (xdr_opaque(xdrs, sp, nodesize)); - - case XDR_FREE: - if (sp != NULL) { - mem_free(sp, nodesize); - *cpp = NULL; - } - return (TRUE); - } - return (FALSE); -} - -/* - * Implemented here due to commonality of the object. - */ -bool_t xdr_netobj(xdrs, np) -XDR *xdrs; -struct netobj *np; -{ - - return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); -} - -/* - * XDR a descriminated union - * Support routine for discriminated unions. - * You create an array of xdrdiscrim structures, terminated with - * an entry with a null procedure pointer. The routine gets - * the discriminant value and then searches the array of xdrdiscrims - * looking for that value. It calls the procedure given in the xdrdiscrim - * to handle the discriminant. If there is no specific routine a default - * routine may be called. - * If there is no specific or default routine an error is returned. - */ -bool_t xdr_union(XDR* xdrs, enum_t* dscmp, char* unp, const struct xdr_discrim* choices, xdrproc_t dfault) -{ - register enum_t dscm; - - /* - * we deal with the discriminator; it's an enum - */ - if (!xdr_enum(xdrs, dscmp)) { - return (FALSE); - } - dscm = *dscmp; - - /* - * search choices for a value that matches the discriminator. - * if we find one, execute the xdr routine for that value. - */ - for (; choices->proc != NULL_xdrproc_t; choices++) { - if (choices->value == dscm) - return ((*(choices->proc)) (xdrs, unp, LASTUNSIGNED)); - } - - /* - * no match - execute the default xdr routine if there is one - */ - return ((dfault == NULL_xdrproc_t) ? FALSE : - (*dfault) (xdrs, unp, LASTUNSIGNED)); -} - - -/* - * Non-portable xdr primitives. - * Care should be taken when moving these routines to new architectures. - */ - - -/* - * XDR null terminated ASCII strings - * xdr_string deals with "C strings" - arrays of bytes that are - * terminated by a NULL character. The parameter cpp references a - * pointer to storage; If the pointer is null, then the necessary - * storage is allocated. The last parameter is the max allowed length - * of the string as specified by a protocol. - */ -bool_t xdr_string(xdrs, cpp, maxsize) -register XDR *xdrs; -char **cpp; -u_int maxsize; -{ - register char *sp = *cpp; /* sp is the actual string pointer */ - u_int size; - u_int nodesize; - - /* - * first deal with the length since xdr strings are counted-strings - */ - switch (xdrs->x_op) { - case XDR_FREE: - if (sp == NULL) { - return (TRUE); /* already free */ - } - /* fall through... */ - case XDR_ENCODE: - size = strlen(sp); - break; - } - if (!xdr_u_int(xdrs, &size)) { - return (FALSE); - } - if (size > maxsize) { - return (FALSE); - } - nodesize = size + 1; - - /* - * now deal with the actual bytes - */ - switch (xdrs->x_op) { - - case XDR_DECODE: - if (nodesize == 0) { - return (TRUE); - } - if (sp == NULL) - *cpp = sp = (char *) mem_alloc(nodesize); - if (sp == NULL) { - (void) fprintf(stderr, "xdr_string: out of memory\n"); - return (FALSE); - } - sp[size] = 0; - /* fall into ... */ - - case XDR_ENCODE: - return (xdr_opaque(xdrs, sp, size)); - - case XDR_FREE: - mem_free(sp, nodesize); - *cpp = NULL; - return (TRUE); - } - return (FALSE); -} - -/* - * Wrapper for xdr_string that can be called directly from - * routines like clnt_call - */ -bool_t xdr_wrapstring(xdrs, cpp) -XDR *xdrs; -char **cpp; -{ - if (xdr_string(xdrs, cpp, LASTUNSIGNED)) { - return (TRUE); - } - return (FALSE); -} diff --git a/mdk-stage1/dietlibc/librpc/xdr_array.c b/mdk-stage1/dietlibc/librpc/xdr_array.c deleted file mode 100644 index f8ae12b19..000000000 --- a/mdk-stage1/dietlibc/librpc/xdr_array.c +++ /dev/null @@ -1,152 +0,0 @@ -/* @(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * xdr_array.c, Generic XDR routines impelmentation. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * These are the "non-trivial" xdr primitives used to serialize and de-serialize - * arrays. See xdr.h for more info on the interface to xdr. - */ - -#include <stdio.h> - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <string.h> - -#define LASTUNSIGNED ((u_int)0-1) - - -/* - * XDR an array of arbitrary elements - * *addrp is a pointer to the array, *sizep is the number of elements. - * If addrp is NULL (*sizep * elsize) bytes are allocated. - * elsize is the size (in bytes) of each element, and elproc is the - * xdr procedure to call to handle each element of the array. - */ -bool_t xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) -register XDR *xdrs; -caddr_t *addrp; /* array pointer */ -u_int *sizep; /* number of elements */ -u_int maxsize; /* max numberof elements */ -u_int elsize; /* size in bytes of each element */ -xdrproc_t elproc; /* xdr routine to handle each element */ -{ - register u_int i; - register caddr_t target = *addrp; - register u_int c; /* the actual element count */ - register bool_t stat = TRUE; - register u_int nodesize; - - /* like strings, arrays are really counted arrays */ - if (!xdr_u_int(xdrs, sizep)) { - return (FALSE); - } - c = *sizep; - if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) { - return (FALSE); - } - nodesize = c * elsize; - - /* - * if we are deserializing, we may need to allocate an array. - * We also save time by checking for a null array if we are freeing. - */ - if (target == NULL) - switch (xdrs->x_op) { - case XDR_DECODE: - if (c == 0) - return (TRUE); - *addrp = target = mem_alloc(nodesize); - if (target == NULL) { - (void) fprintf(stderr, "xdr_array: out of memory\n"); - return (FALSE); - } - bzero(target, nodesize); - break; - - case XDR_FREE: - return (TRUE); - } - - /* - * now we xdr each element of array - */ - for (i = 0; (i < c) && stat; i++) { - stat = (*elproc) (xdrs, target, LASTUNSIGNED); - target += elsize; - } - - /* - * the array may need freeing - */ - if (xdrs->x_op == XDR_FREE) { - mem_free(*addrp, nodesize); - *addrp = NULL; - } - return (stat); -} - -/* - * xdr_vector(): - * - * XDR a fixed length array. Unlike variable-length arrays, - * the storage of fixed length arrays is static and unfreeable. - * > basep: base of the array - * > size: size of the array - * > elemsize: size of each element - * > xdr_elem: routine to XDR each element - */ -bool_t xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem) -register XDR *xdrs; -register char *basep; -register u_int nelem; -register u_int elemsize; -register xdrproc_t xdr_elem; -{ - register u_int i; - register char *elptr; - - elptr = basep; - for (i = 0; i < nelem; i++) { - if (!(*xdr_elem) (xdrs, elptr, LASTUNSIGNED)) { - return (FALSE); - } - elptr += elemsize; - } - return (TRUE); -} diff --git a/mdk-stage1/dietlibc/librpc/xdr_float.c b/mdk-stage1/dietlibc/librpc/xdr_float.c deleted file mode 100644 index f8eb5e99c..000000000 --- a/mdk-stage1/dietlibc/librpc/xdr_float.c +++ /dev/null @@ -1,284 +0,0 @@ -/* @(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * xdr_float.c, Generic XDR routines impelmentation. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * These are the "floating point" xdr routines used to (de)serialize - * most common data items. See xdr.h for more info on the interface to - * xdr. - */ - -#include <stdio.h> - -#include <rpc/types.h> -#include <rpc/xdr.h> - -/* - * NB: Not portable. - * This routine works on Suns (Sky / 68000's) and Vaxen. - */ - -#ifdef __linux__ -/* cheat big time */ -#define sparc -#endif - -#ifdef vax - -/* What IEEE single precision floating point looks like on a Vax */ -struct ieee_single { - unsigned int mantissa:23; - unsigned int exp:8; - unsigned int sign:1; -}; - -/* Vax single precision floating point */ -struct vax_single { - unsigned int mantissa1:7; - unsigned int exp:8; - unsigned int sign:1; - unsigned int mantissa2:16; -}; - -#define VAX_SNG_BIAS 0x81 -#define IEEE_SNG_BIAS 0x7f - -static struct sgl_limits { - struct vax_single s; - struct ieee_single ieee; -} sgl_limits[2] = { - { { - 0x7f, 0xff, 0x0, 0xffff}, /* Max Vax */ - { - 0x0, 0xff, 0x0}}, /* Max IEEE */ - { { - 0x0, 0x0, 0x0, 0x0}, /* Min Vax */ - { - 0x0, 0x0, 0x0}} /* Min IEEE */ -}; -#endif /* vax */ - -bool_t xdr_float(xdrs, fp) -register XDR *xdrs; -register float *fp; -{ -#if !defined(mc68000) && !defined(sparc) - struct ieee_single is; - struct vax_single vs, *vsp; - struct sgl_limits *lim; - int i; -#endif - switch (xdrs->x_op) { - - case XDR_ENCODE: -#if defined(mc68000) || defined(sparc) - return (XDR_PUTLONG(xdrs, (long *) fp)); -#else - vs = *((struct vax_single *) fp); - for (i = 0, lim = sgl_limits; - - i < sizeof(sgl_limits) / sizeof(struct sgl_limits); - i++, lim++) { - if ((vs.mantissa2 == lim->s.mantissa2) && - (vs.exp == lim->s.exp) && - (vs.mantissa1 == lim->s.mantissa1)) { - is = lim->ieee; - goto shipit; - } - } - is.exp = vs.exp - VAX_SNG_BIAS + IEEE_SNG_BIAS; - is.mantissa = (vs.mantissa1 << 16) | vs.mantissa2; - shipit: - is.sign = vs.sign; - return (XDR_PUTLONG(xdrs, (long *) &is)); -#endif - - case XDR_DECODE: -#if defined(mc68000) || defined(sparc) - return (XDR_GETLONG(xdrs, (long *) fp)); -#else - vsp = (struct vax_single *) fp; - if (!XDR_GETLONG(xdrs, (long *) &is)) - return (FALSE); - for (i = 0, lim = sgl_limits; - - i < sizeof(sgl_limits) / sizeof(struct sgl_limits); - i++, lim++) { - if ((is.exp == lim->ieee.exp) && - (is.mantissa == lim->ieee.mantissa)) { - *vsp = lim->s; - goto doneit; - } - } - vsp->exp = is.exp - IEEE_SNG_BIAS + VAX_SNG_BIAS; - vsp->mantissa2 = is.mantissa; - vsp->mantissa1 = (is.mantissa >> 16); - doneit: - vsp->sign = is.sign; - return (TRUE); -#endif - - case XDR_FREE: - return (TRUE); - } - return (FALSE); -} - -/* - * This routine works on Suns (Sky / 68000's) and Vaxen. - */ - -#ifdef vax -/* What IEEE double precision floating point looks like on a Vax */ -struct ieee_double { - unsigned int mantissa1:20; - unsigned int exp:11; - unsigned int sign:1; - unsigned int mantissa2:32; -}; - -/* Vax double precision floating point */ -struct vax_double { - unsigned int mantissa1:7; - unsigned int exp:8; - unsigned int sign:1; - unsigned int mantissa2:16; - unsigned int mantissa3:16; - unsigned int mantissa4:16; -}; - -#define VAX_DBL_BIAS 0x81 -#define IEEE_DBL_BIAS 0x3ff -#define MASK(nbits) ((1 << nbits) - 1) - -static struct dbl_limits { - struct vax_double d; - struct ieee_double ieee; -} dbl_limits[2] = { - { { - 0x7f, 0xff, 0x0, 0xffff, 0xffff, 0xffff}, /* Max Vax */ - { - 0x0, 0x7ff, 0x0, 0x0}}, /* Max IEEE */ - { { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* Min Vax */ - { - 0x0, 0x0, 0x0, 0x0}} /* Min IEEE */ -}; - -#endif /* vax */ - - -bool_t xdr_double(xdrs, dp) -register XDR *xdrs; -double *dp; -{ - register long *lp; - -#if !defined(mc68000) && !defined(sparc) - struct ieee_double id; - struct vax_double vd; - register struct dbl_limits *lim; - int i; -#endif - - switch (xdrs->x_op) { - - case XDR_ENCODE: -#if defined(mc68000) || defined(sparc) - lp = (long *) dp; -#else - vd = *((struct vax_double *) dp); - for (i = 0, lim = dbl_limits; - - i < sizeof(dbl_limits) / sizeof(struct dbl_limits); - i++, lim++) { - if ((vd.mantissa4 == lim->d.mantissa4) && - (vd.mantissa3 == lim->d.mantissa3) && - (vd.mantissa2 == lim->d.mantissa2) && - (vd.mantissa1 == lim->d.mantissa1) && - (vd.exp == lim->d.exp)) { - id = lim->ieee; - goto shipit; - } - } - id.exp = vd.exp - VAX_DBL_BIAS + IEEE_DBL_BIAS; - id.mantissa1 = (vd.mantissa1 << 13) | (vd.mantissa2 >> 3); - id.mantissa2 = ((vd.mantissa2 & MASK(3)) << 29) | - (vd.mantissa3 << 13) | ((vd.mantissa4 >> 3) & MASK(13)); - shipit: - id.sign = vd.sign; - lp = (long *) &id; -#endif - return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp)); - - case XDR_DECODE: -#if defined(mc68000) || defined(sparc) - lp = (long *) dp; - return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp)); -#else - lp = (long *) &id; - if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp)) - return (FALSE); - for (i = 0, lim = dbl_limits; - - i < sizeof(dbl_limits) / sizeof(struct dbl_limits); - i++, lim++) { - if ((id.mantissa2 == lim->ieee.mantissa2) && - (id.mantissa1 == lim->ieee.mantissa1) && - (id.exp == lim->ieee.exp)) { - vd = lim->d; - goto doneit; - } - } - vd.exp = id.exp - IEEE_DBL_BIAS + VAX_DBL_BIAS; - vd.mantissa1 = (id.mantissa1 >> 13); - vd.mantissa2 = ((id.mantissa1 & MASK(13)) << 3) | - (id.mantissa2 >> 29); - vd.mantissa3 = (id.mantissa2 >> 13); - vd.mantissa4 = (id.mantissa2 << 3); - doneit: - vd.sign = id.sign; - *dp = *((double *) &vd); - return (TRUE); -#endif - - case XDR_FREE: - return (TRUE); - } - return (FALSE); -} diff --git a/mdk-stage1/dietlibc/librpc/xdr_mem.c b/mdk-stage1/dietlibc/librpc/xdr_mem.c deleted file mode 100644 index 755f6abf1..000000000 --- a/mdk-stage1/dietlibc/librpc/xdr_mem.c +++ /dev/null @@ -1,180 +0,0 @@ -/* @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * xdr_mem.h, XDR implementation using memory buffers. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * If you have some data to be interpreted as external data representation - * or to be converted to external data representation in a memory buffer, - * then this is the package for you. - * - */ - - -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <netinet/in.h> -#include <string.h> - -static bool_t xdrmem_getlong(); -static bool_t xdrmem_putlong(); -static bool_t xdrmem_getbytes(); -static bool_t xdrmem_putbytes(); -static u_int xdrmem_getpos(); -static bool_t xdrmem_setpos(); -static int32_t *xdrmem_inline(); -static void xdrmem_destroy(); - -static struct xdr_ops xdrmem_ops = { - xdrmem_getlong, - xdrmem_putlong, - xdrmem_getbytes, - xdrmem_putbytes, - xdrmem_getpos, - xdrmem_setpos, - xdrmem_inline, - xdrmem_destroy -}; - -/* - * The procedure xdrmem_create initializes a stream descriptor for a - * memory buffer. - */ -void xdrmem_create(xdrs, addr, size, op) -register XDR *xdrs; -caddr_t addr; -u_int size; -enum xdr_op op; -{ - - xdrs->x_op = op; - xdrs->x_ops = &xdrmem_ops; - xdrs->x_private = xdrs->x_base = addr; - xdrs->x_handy = size; -} - -static void xdrmem_destroy( /*xdrs */ ) - /*XDR *xdrs; */ -{ -} - -static bool_t xdrmem_getlong(xdrs, lp) -register XDR *xdrs; -long *lp; -{ - - if ((xdrs->x_handy -= sizeof(long)) < 0) - return (FALSE); - - *lp = (long) ntohl((u_long) (*((long *) (xdrs->x_private)))); - xdrs->x_private += sizeof(long); - - return (TRUE); -} - -static bool_t xdrmem_putlong(xdrs, lp) -register XDR *xdrs; -long *lp; -{ - - if ((xdrs->x_handy -= sizeof(long)) < 0) - return (FALSE); - - *(long *) xdrs->x_private = (long) htonl((u_long) (*lp)); - xdrs->x_private += sizeof(long); - - return (TRUE); -} - -static bool_t xdrmem_getbytes(xdrs, addr, len) -register XDR *xdrs; -caddr_t addr; -register u_int len; -{ - - if ((xdrs->x_handy -= len) < 0) - return (FALSE); - bcopy(xdrs->x_private, addr, len); - xdrs->x_private += len; - return (TRUE); -} - -static bool_t xdrmem_putbytes(xdrs, addr, len) -register XDR *xdrs; -caddr_t addr; -register u_int len; -{ - - if ((xdrs->x_handy -= len) < 0) - return (FALSE); - bcopy(addr, xdrs->x_private, len); - xdrs->x_private += len; - return (TRUE); -} - -static u_int xdrmem_getpos(xdrs) -register XDR *xdrs; -{ - - return ((u_int) xdrs->x_private - (u_int) xdrs->x_base); -} - -static bool_t xdrmem_setpos(xdrs, pos) -register XDR *xdrs; -u_int pos; -{ - register caddr_t newaddr = xdrs->x_base + pos; - register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; - - if ((long) newaddr > (long) lastaddr) - return (FALSE); - xdrs->x_private = newaddr; - xdrs->x_handy = (int) lastaddr - (int) newaddr; - return (TRUE); -} - -static int32_t *xdrmem_inline(xdrs, len) -register XDR *xdrs; -int len; -{ - int32_t *buf = 0; - - if (xdrs->x_handy >= len) { - xdrs->x_handy -= len; - buf = (int32_t *) xdrs->x_private; - xdrs->x_private += len; - } - return (buf); -} diff --git a/mdk-stage1/dietlibc/librpc/xdr_rec.c b/mdk-stage1/dietlibc/librpc/xdr_rec.c deleted file mode 100644 index 83e800f5e..000000000 --- a/mdk-stage1/dietlibc/librpc/xdr_rec.c +++ /dev/null @@ -1,573 +0,0 @@ -/* @(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking" - * layer above tcp (for rpc's use). - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * These routines interface XDRSTREAMS to a tcp/ip connection. - * There is a record marking layer between the xdr stream - * and the tcp transport level. A record is composed on one or more - * record fragments. A record fragment is a thirty-two bit header followed - * by n bytes of data, where n is contained in the header. The header - * is represented as a htonl(u_long). Thegh order bit encodes - * whether or not the fragment is the last fragment of the record - * (1 => fragment is last, 0 => more fragments to follow. - * The other 31 bits encode the byte length of the fragment. - */ - -#include <stdio.h> -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <netinet/in.h> -#include <string.h> - -extern long lseek(); - -static u_int fix_buf_size(); - -static bool_t xdrrec_getlong(); -static bool_t xdrrec_putlong(); -static bool_t xdrrec_getbytes(); -static bool_t xdrrec_putbytes(); -static u_int xdrrec_getpos(); -static bool_t xdrrec_setpos(); -static int32_t *xdrrec_inline(); -static void xdrrec_destroy(); - -static struct xdr_ops xdrrec_ops = { - xdrrec_getlong, - xdrrec_putlong, - xdrrec_getbytes, - xdrrec_putbytes, - xdrrec_getpos, - xdrrec_setpos, - xdrrec_inline, - xdrrec_destroy -}; - -/* - * A record is composed of one or more record fragments. - * A record fragment is a two-byte header followed by zero to - * 2**32-1 bytes. The header is treated as a long unsigned and is - * encode/decoded to the network via htonl/ntohl. The low order 31 bits - * are a byte count of the fragment. The highest order bit is a boolean: - * 1 => this fragment is the last fragment of the record, - * 0 => this fragment is followed by more fragment(s). - * - * The fragment/record machinery is not general; it is constructed to - * meet the needs of xdr and rpc based on tcp. - */ - -#define LAST_FRAG ((u_long)(1 << 31)) - -typedef struct rec_strm { - caddr_t tcp_handle; - caddr_t the_buffer; - /* - * out-goung bits - */ - int (*writeit) (); - caddr_t out_base; /* output buffer (points to frag header) */ - caddr_t out_finger; /* next output position */ - caddr_t out_boundry; /* data cannot up to this address */ - u_long *frag_header; /* beginning of curren fragment */ - bool_t frag_sent; /* true if buffer sent in middle of record */ - /* - * in-coming bits - */ - int (*readit) (); - u_long in_size; /* fixed size of the input buffer */ - caddr_t in_base; - caddr_t in_finger; /* location of next byte to be had */ - caddr_t in_boundry; /* can read up to this location */ - long fbtbc; /* fragment bytes to be consumed */ - bool_t last_frag; - u_int sendsize; - u_int recvsize; -} RECSTREAM; - - -/* - * Create an xdr handle for xdrrec - * xdrrec_create fills in xdrs. Sendsize and recvsize are - * send and recv buffer sizes (0 => use default). - * tcp_handle is an opaque handle that is passed as the first parameter to - * the procedures readit and writeit. Readit and writeit are read and - * write respectively. They are like the system - * calls expect that they take an opaque handle rather than an fd. - */ -void xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) -register XDR *xdrs; -register u_int sendsize; -register u_int recvsize; -caddr_t tcp_handle; -int (*readit) (); /* like read, but pass it a tcp_handle, not sock */ -int (*writeit) (); /* like write, but pass it a tcp_handle, not sock */ -{ - register RECSTREAM *rstrm = (RECSTREAM *) mem_alloc(sizeof(RECSTREAM)); - - if (rstrm == NULL) { - (void) fprintf(stderr, "xdrrec_create: out of memory\n"); - /* - * This is bad. Should rework xdrrec_create to - * return a handle, and in this case return NULL - */ - return; - } - /* - * adjust sizes and allocate buffer quad byte aligned - */ - rstrm->sendsize = sendsize = fix_buf_size(sendsize); - rstrm->recvsize = recvsize = fix_buf_size(recvsize); - rstrm->the_buffer = - mem_alloc(sendsize + recvsize + BYTES_PER_XDR_UNIT); - if (rstrm->the_buffer == NULL) { - (void) fprintf(stderr, "xdrrec_create: out of memory\n"); - return; - } - for (rstrm->out_base = rstrm->the_buffer; - (u_int) rstrm->out_base % BYTES_PER_XDR_UNIT != 0; - rstrm->out_base++); - rstrm->in_base = rstrm->out_base + sendsize; - /* - * now the rest ... - */ - xdrs->x_ops = &xdrrec_ops; - xdrs->x_private = (caddr_t) rstrm; - rstrm->tcp_handle = tcp_handle; - rstrm->readit = readit; - rstrm->writeit = writeit; - rstrm->out_finger = rstrm->out_boundry = rstrm->out_base; - rstrm->frag_header = (u_long *) rstrm->out_base; - rstrm->out_finger += sizeof(u_long); - rstrm->out_boundry += sendsize; - rstrm->frag_sent = FALSE; - rstrm->in_size = recvsize; - rstrm->in_boundry = rstrm->in_base; - rstrm->in_finger = (rstrm->in_boundry += recvsize); - rstrm->fbtbc = 0; - rstrm->last_frag = TRUE; -} - - -/* - * The reoutines defined below are the xdr ops which will go into the - * xdr handle filled in by xdrrec_create. - */ - -static bool_t xdrrec_getlong(xdrs, lp) -XDR *xdrs; -long *lp; -{ - register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - register long *buflp = (long *) (rstrm->in_finger); - long mylong; - - /* first try the inline, fast case */ - if ((rstrm->fbtbc >= sizeof(long)) && - (((int) rstrm->in_boundry - (int) buflp) >= sizeof(long))) { - *lp = (long) ntohl((u_long) (*buflp)); - rstrm->fbtbc -= sizeof(long); - rstrm->in_finger += sizeof(long); - } else { - if (!xdrrec_getbytes(xdrs, (caddr_t) & mylong, sizeof(long))) - return (FALSE); - - *lp = (long) ntohl((u_long) mylong); - } - return (TRUE); -} - -/* - * Internal useful routines - */ -static bool_t flush_out(RECSTREAM* rstrm, bool_t eor) -{ - register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; - register u_long len = (u_long) (rstrm->out_finger) - - (u_long) (rstrm->frag_header) - sizeof(u_long); - - *(rstrm->frag_header) = htonl(len | eormask); - len = (u_long) (rstrm->out_finger) - (u_long) (rstrm->out_base); - if ((*(rstrm->writeit)) (rstrm->tcp_handle, rstrm->out_base, (int) len) - != (int) len) - return (FALSE); - rstrm->frag_header = (u_long *) rstrm->out_base; - rstrm->out_finger = (caddr_t) rstrm->out_base + sizeof(u_long); - return (TRUE); -} - -static bool_t -/* knows nothing about records! Only about input buffers */ -fill_input_buf(rstrm) -register RECSTREAM *rstrm; -{ - register caddr_t where; - u_int i; - register int len; - - where = rstrm->in_base; - i = (u_int) rstrm->in_boundry % BYTES_PER_XDR_UNIT; - where += i; - len = rstrm->in_size - i; - if ((len = (*(rstrm->readit)) (rstrm->tcp_handle, where, len)) == -1) - return (FALSE); - rstrm->in_finger = where; - where += len; - rstrm->in_boundry = where; - return (TRUE); -} - -static bool_t -/* knows nothing about records! Only about input buffers */ -get_input_bytes(rstrm, addr, len) -register RECSTREAM *rstrm; -register caddr_t addr; -register int len; -{ - register int current; - - while (len > 0) { - current = (int) rstrm->in_boundry - (int) rstrm->in_finger; - if (current == 0) { - if (!fill_input_buf(rstrm)) - return (FALSE); - continue; - } - current = (len < current) ? len : current; - bcopy(rstrm->in_finger, addr, current); - rstrm->in_finger += current; - addr += current; - len -= current; - } - return (TRUE); -} - -static bool_t -/* next two bytes of the input stream are treated as a header */ -set_input_fragment(rstrm) -register RECSTREAM *rstrm; -{ - u_long header; - - if (!get_input_bytes(rstrm, (caddr_t) & header, sizeof(header))) - return (FALSE); - header = (long) ntohl(header); - rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE; - rstrm->fbtbc = header & (~LAST_FRAG); - return (TRUE); -} - -static bool_t -/* consumes input bytes; knows nothing about records! */ -skip_input_bytes(rstrm, cnt) -register RECSTREAM *rstrm; -long cnt; -{ - register int current; - - while (cnt > 0) { - current = (int) rstrm->in_boundry - (int) rstrm->in_finger; - if (current == 0) { - if (!fill_input_buf(rstrm)) - return (FALSE); - continue; - } - current = (cnt < current) ? cnt : current; - rstrm->in_finger += current; - cnt -= current; - } - return (TRUE); -} - -static u_int fix_buf_size(s) -register u_int s; -{ - - if (s < 100) - s = 4000; - return (RNDUP(s)); -} -static bool_t xdrrec_putlong(xdrs, lp) -XDR *xdrs; -long *lp; -{ - register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - register long *dest_lp = ((long *) (rstrm->out_finger)); - - if ((rstrm->out_finger += sizeof(long)) > rstrm->out_boundry) { - /* - * this case should almost never happen so the code is - * inefficient - */ - rstrm->out_finger -= sizeof(long); - - rstrm->frag_sent = TRUE; - if (!flush_out(rstrm, FALSE)) - return (FALSE); - dest_lp = ((long *) (rstrm->out_finger)); - rstrm->out_finger += sizeof(long); - } - *dest_lp = (long) htonl((u_long) (*lp)); - return (TRUE); -} - -static bool_t -/* must manage buffers, fragments, and records */ -xdrrec_getbytes(xdrs, addr, len) -XDR *xdrs; -register caddr_t addr; -register u_int len; -{ - register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - register int current; - - while (len > 0) { - current = rstrm->fbtbc; - if (current == 0) { - if (rstrm->last_frag) - return (FALSE); - if (!set_input_fragment(rstrm)) - return (FALSE); - continue; - } - current = (len < current) ? len : current; - if (!get_input_bytes(rstrm, addr, current)) - return (FALSE); - addr += current; - rstrm->fbtbc -= current; - len -= current; - } - return (TRUE); -} - -static bool_t xdrrec_putbytes(xdrs, addr, len) -XDR *xdrs; -register caddr_t addr; -register u_int len; -{ - register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - register int current; - - while (len > 0) { - current = (u_int) rstrm->out_boundry - (u_int) rstrm->out_finger; - current = (len < current) ? len : current; - bcopy(addr, rstrm->out_finger, current); - rstrm->out_finger += current; - addr += current; - len -= current; - if (rstrm->out_finger == rstrm->out_boundry) { - rstrm->frag_sent = TRUE; - if (!flush_out(rstrm, FALSE)) - return (FALSE); - } - } - return (TRUE); -} - -static u_int xdrrec_getpos(xdrs) -register XDR *xdrs; -{ - register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; - register long pos; - - pos = lseek((int) rstrm->tcp_handle, (long) 0, 1); - if (pos != -1) - switch (xdrs->x_op) { - - case XDR_ENCODE: - pos += rstrm->out_finger - rstrm->out_base; - break; - - case XDR_DECODE: - pos -= rstrm->in_boundry - rstrm->in_finger; - break; - - default: - pos = (u_int) - 1; - break; - } - return ((u_int) pos); -} - -static bool_t xdrrec_setpos(xdrs, pos) -register XDR *xdrs; -u_int pos; -{ - register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; - u_int currpos = xdrrec_getpos(xdrs); - int delta = currpos - pos; - caddr_t newpos; - - if ((int) currpos != -1) - switch (xdrs->x_op) { - - case XDR_ENCODE: - newpos = rstrm->out_finger - delta; - if ((newpos > (caddr_t) (rstrm->frag_header)) && - (newpos < rstrm->out_boundry)) { - rstrm->out_finger = newpos; - return (TRUE); - } - break; - - case XDR_DECODE: - newpos = rstrm->in_finger - delta; - if ((delta < (int) (rstrm->fbtbc)) && - (newpos <= rstrm->in_boundry) && - (newpos >= rstrm->in_base)) { - rstrm->in_finger = newpos; - rstrm->fbtbc -= delta; - return (TRUE); - } - break; - } - return (FALSE); -} - -static int32_t *xdrrec_inline(xdrs, len) -register XDR *xdrs; -int len; -{ - register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; - int32_t *buf = NULL; - - switch (xdrs->x_op) { - - case XDR_ENCODE: - if ((rstrm->out_finger + len) <= rstrm->out_boundry) { - buf = (int32_t *) rstrm->out_finger; - rstrm->out_finger += len; - } - break; - - case XDR_DECODE: - if ((len <= rstrm->fbtbc) && - ((rstrm->in_finger + len) <= rstrm->in_boundry)) { - buf = (int32_t *) rstrm->in_finger; - rstrm->fbtbc -= len; - rstrm->in_finger += len; - } - break; - } - return (buf); -} - -static void xdrrec_destroy(xdrs) -register XDR *xdrs; -{ - register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; - - mem_free(rstrm->the_buffer, - rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT); - mem_free((caddr_t) rstrm, sizeof(RECSTREAM)); -} - - -/* - * Exported routines to manage xdr records - */ - -/* - * Before reading (deserializing from the stream, one should always call - * this procedure to guarantee proper record alignment. - */ -bool_t xdrrec_skiprecord(xdrs) -XDR *xdrs; -{ - register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - - while (rstrm->fbtbc > 0 || (!rstrm->last_frag)) { - if (!skip_input_bytes(rstrm, rstrm->fbtbc)) - return (FALSE); - rstrm->fbtbc = 0; - if ((!rstrm->last_frag) && (!set_input_fragment(rstrm))) - return (FALSE); - } - rstrm->last_frag = FALSE; - return (TRUE); -} - -/* - * Look ahead fuction. - * Returns TRUE iff there is no more input in the buffer - * after consuming the rest of the current record. - */ -bool_t xdrrec_eof(xdrs) -XDR *xdrs; -{ - register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - - while (rstrm->fbtbc > 0 || (!rstrm->last_frag)) { - if (!skip_input_bytes(rstrm, rstrm->fbtbc)) - return (TRUE); - rstrm->fbtbc = 0; - if ((!rstrm->last_frag) && (!set_input_fragment(rstrm))) - return (TRUE); - } - if (rstrm->in_finger == rstrm->in_boundry) - return (TRUE); - return (FALSE); -} - -/* - * The client must tell the package when an end-of-record has occurred. - * The second paraemters tells whether the record should be flushed to the - * (output) tcp stream. (This let's the package support batched or - * pipelined procedure calls.) TRUE => immmediate flush to tcp connection. - */ -bool_t xdrrec_endofrecord(xdrs, sendnow) -XDR *xdrs; -bool_t sendnow; -{ - register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); - register u_long len; /* fragment length */ - - if (sendnow || rstrm->frag_sent || - ((u_long) rstrm->out_finger + sizeof(u_long) >= - (u_long) rstrm->out_boundry)) { - rstrm->frag_sent = FALSE; - return (flush_out(rstrm, TRUE)); - } - len = (u_long) (rstrm->out_finger) - (u_long) (rstrm->frag_header) - - sizeof(u_long); - *(rstrm->frag_header) = htonl((u_long) len | LAST_FRAG); - rstrm->frag_header = (u_long *) rstrm->out_finger; - rstrm->out_finger += sizeof(u_long); - return (TRUE); -} - - diff --git a/mdk-stage1/dietlibc/librpc/xdr_reference.c b/mdk-stage1/dietlibc/librpc/xdr_reference.c deleted file mode 100644 index 7715d821c..000000000 --- a/mdk-stage1/dietlibc/librpc/xdr_reference.c +++ /dev/null @@ -1,130 +0,0 @@ -/* @(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; -#endif - -/* - * xdr_reference.c, Generic XDR routines impelmentation. - * - * Copyright (C) 1987, Sun Microsystems, Inc. - * - * These are the "non-trivial" xdr primitives used to serialize and de-serialize - * "pointers". See xdr.h for more info on the interface to xdr. - */ - -#include <stdio.h> -#include <rpc/types.h> -#include <rpc/xdr.h> -#include <string.h> - -#define LASTUNSIGNED ((u_int)0-1) - -/* - * XDR an indirect pointer - * xdr_reference is for recursively translating a structure that is - * referenced by a pointer inside the structure that is currently being - * translated. pp references a pointer to storage. If *pp is null - * the necessary storage is allocated. - * size is the sizeof the referneced structure. - * proc is the routine to handle the referenced structure. - */ -bool_t xdr_reference(xdrs, pp, size, proc) -register XDR *xdrs; -caddr_t *pp; /* the pointer to work on */ -u_int size; /* size of the object pointed to */ -xdrproc_t proc; /* xdr routine to handle the object */ -{ - register caddr_t loc = *pp; - register bool_t stat; - - if (loc == NULL) - switch (xdrs->x_op) { - case XDR_FREE: - return (TRUE); - - case XDR_DECODE: - *pp = loc = (caddr_t) mem_alloc(size); - if (loc == NULL) { - (void) fprintf(stderr, "xdr_reference: out of memory\n"); - return (FALSE); - } - bzero(loc, (int) size); - break; - } - - stat = (*proc) (xdrs, loc, LASTUNSIGNED); - - if (xdrs->x_op == XDR_FREE) { - mem_free(loc, size); - *pp = NULL; - } - return (stat); -} - - -/* - * xdr_pointer(): - * - * XDR a pointer to a possibly recursive data structure. This - * differs with xdr_reference in that it can serialize/deserialiaze - * trees correctly. - * - * What's sent is actually a union: - * - * union object_pointer switch (boolean b) { - * case TRUE: object_data data; - * case FALSE: void nothing; - * } - * - * > objpp: Pointer to the pointer to the object. - * > obj_size: size of the object. - * > xdr_obj: routine to XDR an object. - * - */ -bool_t xdr_pointer(xdrs, objpp, obj_size, xdr_obj) -register XDR *xdrs; -char **objpp; -u_int obj_size; -xdrproc_t xdr_obj; -{ - - bool_t more_data; - - more_data = (*objpp != NULL); - if (!xdr_bool(xdrs, &more_data)) { - return (FALSE); - } - if (!more_data) { - *objpp = NULL; - return (TRUE); - } - return (xdr_reference(xdrs, objpp, obj_size, xdr_obj)); -} diff --git a/mdk-stage1/dietlibc/librpc/xdr_stdio.c b/mdk-stage1/dietlibc/librpc/xdr_stdio.c deleted file mode 100644 index e3190e0a9..000000000 --- a/mdk-stage1/dietlibc/librpc/xdr_stdio.c +++ /dev/null @@ -1,187 +0,0 @@ -/* @(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = - - "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro"; -#endif - -/* - * xdr_stdio.c, XDR implementation on standard i/o file. - * - * Copyright (C) 1984, Sun Microsystems, Inc. - * - * This set of routines implements a XDR on a stdio stream. - * XDR_ENCODE serializes onto the stream, XDR_DECODE de-serializes - * from the stream. - */ - -#include <rpc/types.h> -#include <stdio.h> -#include <rpc/xdr.h> - -static bool_t xdrstdio_getlong(); -static bool_t xdrstdio_putlong(); -static bool_t xdrstdio_getbytes(); -static bool_t xdrstdio_putbytes(); -static u_int xdrstdio_getpos(); -static bool_t xdrstdio_setpos(); -static int32_t *xdrstdio_inline(); -static void xdrstdio_destroy(); - -/* - * Ops vector for stdio type XDR - */ -static struct xdr_ops xdrstdio_ops = { - xdrstdio_getlong, /* deseraialize a long int */ - xdrstdio_putlong, /* seraialize a long int */ - xdrstdio_getbytes, /* deserialize counted bytes */ - xdrstdio_putbytes, /* serialize counted bytes */ - xdrstdio_getpos, /* get offset in the stream */ - xdrstdio_setpos, /* set offset in the stream */ - xdrstdio_inline, /* prime stream for inline macros */ - xdrstdio_destroy /* destroy stream */ -}; - -/* - * Initialize a stdio xdr stream. - * Sets the xdr stream handle xdrs for use on the stream file. - * Operation flag is set to op. - */ -void xdrstdio_create(xdrs, file, op) -register XDR *xdrs; -FILE *file; -enum xdr_op op; -{ - - xdrs->x_op = op; - xdrs->x_ops = &xdrstdio_ops; - xdrs->x_private = (caddr_t) file; - xdrs->x_handy = 0; - xdrs->x_base = 0; -} - -/* - * Destroy a stdio xdr stream. - * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create. - */ -static void xdrstdio_destroy(xdrs) -register XDR *xdrs; -{ - (void) fflush((FILE *) xdrs->x_private); - /* xx should we close the file ?? */ -}; - -static bool_t xdrstdio_getlong(xdrs, lp) -XDR *xdrs; -register long *lp; -{ - - if (fread((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) != - 1) return (FALSE); - -#ifndef mc68000 - *lp = ntohl(*lp); -#endif - return (TRUE); -} - -static bool_t xdrstdio_putlong(xdrs, lp) -XDR *xdrs; -long *lp; -{ - -#ifndef mc68000 - long mycopy = htonl(*lp); - - lp = &mycopy; -#endif - if (fwrite((caddr_t) lp, sizeof(long), 1, (FILE *) xdrs->x_private) != - 1) return (FALSE); - - return (TRUE); -} - -static bool_t xdrstdio_getbytes(xdrs, addr, len) -XDR *xdrs; -caddr_t addr; -u_int len; -{ - - if ((len != 0) - && (fread(addr, (int) len, 1, (FILE *) xdrs->x_private) != 1)) - return (FALSE); - return (TRUE); -} - -static bool_t xdrstdio_putbytes(xdrs, addr, len) -XDR *xdrs; -caddr_t addr; -u_int len; -{ - - if ((len != 0) - && (fwrite(addr, (int) len, 1, (FILE *) xdrs->x_private) != 1)) - return (FALSE); - return (TRUE); -} - -static u_int xdrstdio_getpos(xdrs) -XDR *xdrs; -{ - - return ((u_int) ftell((FILE *) xdrs->x_private)); -} - -static bool_t xdrstdio_setpos(xdrs, pos) -XDR *xdrs; -u_int pos; -{ - - return ((fseek((FILE *) xdrs->x_private, (long) pos, 0) < 0) ? - FALSE : TRUE); -} - -static int32_t *xdrstdio_inline(xdrs, len) -XDR *xdrs; -u_int len; -{ - - /* - * Must do some work to implement this: must insure - * enough data in the underlying stdio buffer, - * that the buffer is aligned so that we can indirect through a - * long *, and stuff this pointer in xdrs->x_buf. Doing - * a fread or fwrite to a scratch buffer would defeat - * most of the gains to be had here and require storage - * management on this buffer, so we don't do this. - */ - return (NULL); -} diff --git a/mdk-stage1/dietlibc/libshell/fnmatch.c b/mdk-stage1/dietlibc/libshell/fnmatch.c deleted file mode 100644 index 4e7664510..000000000 --- a/mdk-stage1/dietlibc/libshell/fnmatch.c +++ /dev/null @@ -1,74 +0,0 @@ -#include <ctype.h> -#include <fnmatch.h> - -#define NOTFIRST 128 - -static int match(char c,char d,int flags) { - if (flags&FNM_CASEFOLD) - return (tolower(c)==tolower(d)); - else - return (c==d); -} - -int fnmatch(const char *pattern, const char *string, int flags) { - if (*string==0) { - while (*pattern=='*') ++pattern; - return (!!*pattern); - } - if (*string=='.' && *pattern!='.' && (flags&FNM_PERIOD)) { - /* don't match if FNM_PERIOD and this is the first char */ - if ((flags&FNM_PERIOD) && (!(flags&NOTFIRST))) - return 1; - /* don't match if FNM_PERIOD and FNM_FILE_NAME and previous was '/' */ - if ((flags&(FNM_FILE_NAME|FNM_PERIOD)) && string[-1]=='/') - return 1; - } - flags|=NOTFIRST; - switch (*pattern) { - case '[': - ++pattern; - while (*pattern && *pattern!=']') { - if (flags&FNM_PATHNAME || *string!='/') { - int res=0; - if (pattern[1]=='-') { - if (*string>=*pattern && *string<=pattern[2]) res=1; - if (flags&FNM_CASEFOLD) { - if (tolower(*string)>=tolower(*pattern) && tolower(*string)<=tolower(pattern[2])) res=1; - } - } else - res=match(*pattern,*string,flags); - if (res) { - while (*pattern && *pattern!=']') ++pattern; - return fnmatch(pattern+1,string+1,flags); - } - } - ++pattern; - } - break; - case '\\': - if (flags&FNM_NOESCAPE) { - if (*string=='\\') - return fnmatch(pattern+1,string+1,flags); - } else { - if (*string==pattern[1]) - return fnmatch(pattern+2,string+1,flags); - } - break; - case '*': - if (!pattern[1] || fnmatch(pattern+1,string,flags)==0) - return 0; - else - if (*string!='/') - return fnmatch(pattern,string+1,flags); - break; - case 0: - if (*string==0 || (*string=='/' && (flags&FNM_LEADING_DIR))) - return 0; - break; - default: - if (match(*pattern,*string,flags)) - return fnmatch(pattern+1,string+1,flags); - break; - } - return 1; -} diff --git a/mdk-stage1/dietlibc/libshell/glob.c b/mdk-stage1/dietlibc/libshell/glob.c deleted file mode 100644 index 34d09d87a..000000000 --- a/mdk-stage1/dietlibc/libshell/glob.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * dietlibc/libshell/glob.c - * - * Copyright 2001 Guillaume Cottenceau <gc@mandrakesoft.com> - * - * This is free software, licensed under the Gnu General Public License. - * - */ - -/* - * unsupported: GLOB_BRACE GLOB_ALTDIRFUNC GLOB_MAGCHAR - */ - -#define DEBUG(x) - -#include <stdlib.h> -#include <unistd.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <assert.h> -#include <fnmatch.h> -#include <dirent.h> -#include <pwd.h> - -#include <glob.h> - - - -/* If i18n, should be using strcoll */ -static int cmp_func(const void * a, const void * b) -{ - const char *const s1 = *(const char *const * const) a; - const char *const s2 = *(const char *const * const) b; - if (s1 == NULL) - return 1; - if (s2 == NULL) - return -1; - return strcmp(s1, s2); -} - - -/* Like `glob', but PATTERN is a final pathname component, - and matches are searched for in DIRECTORY. - The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done. - The GLOB_APPEND flag is assumed to be set (always appends). - Prepends DIRECTORY in constructed PGLOB. */ -static int glob_in_dir(const char *pattern, const char *directory, int flags, - int errfunc(const char * epath, int eerrno), - glob_t *pglob) -{ - DIR *dp = opendir(directory); - int nfound = 0; - - int i; - char * ptr; - - void close_dir_keep_errno(void) { - int save = errno; - if (dp) - closedir (dp); - __set_errno(save); - } - int add_entry(const char * name) { - pglob->gl_pathv = (char **) realloc(pglob->gl_pathv, - (pglob->gl_pathc + pglob->gl_offs + 2) - * sizeof (char *)); - if (pglob->gl_pathv == NULL) - return 1; - pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc] = strdup(name); - pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc + 1] = NULL; - pglob->gl_pathc++; - nfound++; - return 0; - } - void build_fullname(char * fullname, int fullnamesize, const char * directory, const char * filename) { - if (!strcmp(directory, "/")) - snprintf(fullname, fullnamesize, "/%s", filename); - else if (!strcmp(directory, ".")) - snprintf(fullname, fullnamesize, "%s", filename); - else - snprintf(fullname, fullnamesize, "%s/%s", directory, filename); - } - - if (!dp) { - if (errno != ENOTDIR - && ((errfunc != NULL && (*errfunc) (directory, errno)) - || (flags & GLOB_ERR))) - return GLOB_ABORTED; - } else { - int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) - | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)); - struct dirent *ep; - while ((ep = readdir(dp))) { - i = strlen(directory) + strlen(ep->d_name) + 2; - ptr = (char *) alloca(i); - build_fullname(ptr, i, directory, ep->d_name); - if (flags & GLOB_ONLYDIR) { - struct stat statr; - if (stat(ptr, &statr) || !S_ISDIR(statr.st_mode)) - continue; - } - if (fnmatch(pattern, ep->d_name, fnm_flags) == 0) - if (add_entry(ptr)) - goto memory_error; - } - } - - close_dir_keep_errno(); - - if (nfound != 0) - pglob->gl_flags = flags; - else if (flags & GLOB_NOCHECK) { - /* nfound == 0 */ - i = strlen(directory) + strlen(pattern) + 2; - ptr = (char *) alloca(i); - build_fullname(ptr, i, directory, pattern); - if (add_entry(ptr)) - goto memory_error; - } - - return (nfound == 0) ? GLOB_NOMATCH : 0; - - memory_error: - /* We're in trouble since we can't free the already allocated memory. [allocated from strdup(filame)] - * Well, after all, when malloc returns NULL we're already in a bad mood, and no doubt the - * program will manage to segfault by itself very soon :-). */ - close_dir_keep_errno(); - return GLOB_NOSPACE; -} - - - -int glob(const char *pattern, int flags, int errfunc(const char * epath, int eerrno), glob_t *pglob) -{ - char * pattern_; - char * filename; - char * dirname; - size_t oldcount; - struct stat statr; - - size_t i; /* tmp variables are declared here to save a bit of object space */ - int j, k; /* */ - char * ptr, * ptr2; - - if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) { - __set_errno (EINVAL); - return -1; - } - - if (!(flags & GLOB_DOOFFS)) - pglob->gl_offs = 0; - - - /* Duplicate pattern so I can make modif to it later (to handle - TILDE stuff replacing old contents, and to null-terminate the - directory) */ - pattern_ = alloca(strlen(pattern) + 1); - strcpy(pattern_, pattern); - - /* Check for TILDE stuff */ - if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern_[0] == '~') { - char * home_dir = NULL; - if (pattern_[1] == '\0' || pattern_[1] == '/') { - /* She's asking for ~, her homedir */ - home_dir = getenv("HOME"); - } else { - /* She's asking for another one's homedir */ - struct passwd * p; - ptr2 = alloca(strlen(pattern_) + 1); - strcpy(ptr2, pattern_ + 1); - ptr = strchr(ptr2, '/'); - if (ptr != NULL) - *ptr = '\0'; - if (((p = getpwnam(ptr2)) != NULL)) - home_dir = p->pw_dir; - } - if (home_dir != NULL) { - i = strlen(home_dir) + strlen(pattern_); /* pessimistic (the ~ case) */ - ptr = alloca(i); - strncpy(ptr, home_dir, i); - ptr2 = pattern_ + 1; - while (*ptr2 != '/' && *ptr2 != '\0') - ptr2++; - strncat(ptr, ptr2, i); - pattern_ = ptr; - } else if (flags & GLOB_TILDE_CHECK) - return GLOB_NOMATCH; - } - - /* Find the filename */ - filename = strrchr(pattern_, '/'); - - if (filename == NULL) { - /* We have no '/' in the pattern */ - filename = pattern_; - dirname = "."; - } else if (filename == pattern_) { - /* "/pattern". */ - dirname = "/"; - filename++; - } else { - dirname = pattern_; - filename++; - /* allow dirname to be null terminated */ - *(filename-1) = '\0'; - - if (filename[0] == '\0' && strcmp(pattern_, "/")) { - /* "pattern/". Expand "pattern", appending slashes. */ - j = glob(dirname, flags | GLOB_MARK, errfunc, pglob); - if (j == 0) - pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK) - | (flags & GLOB_MARK)); - return j; - } - } - - - /* Reserve memory for pglob */ - if (!(flags & GLOB_APPEND)) { - pglob->gl_pathc = 0; - if (!(flags & GLOB_DOOFFS)) - pglob->gl_pathv = NULL; - else { - pglob->gl_pathv = (char **) malloc((pglob->gl_offs + 1) * sizeof (char *)); - if (pglob->gl_pathv == NULL) - return GLOB_NOSPACE; - for (i = 0; i <= pglob->gl_offs; i++) - pglob->gl_pathv[i] = NULL; - } - } - - - oldcount = pglob->gl_pathc + pglob->gl_offs; - - - /* Begin real work */ - if (!strcmp(dirname, "/") || !strcmp(dirname, ".") - || (!strchr(dirname, '*') && !strchr(dirname, '?') && !strchr(dirname, '['))) { - /* Approx of a terminal state, glob directly in dir. */ - j = glob_in_dir(filename, dirname, flags, errfunc, pglob); - if (j != 0) - return j; - } else { - /* We are not in a terminal state, so we have to glob for - the directory, and then glob for the pattern in each - directory found. */ - glob_t dirs; - - j = glob(dirname, ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE | GLOB_ALTDIRFUNC)) - | GLOB_NOSORT | GLOB_ONLYDIR), - errfunc, &dirs); - if (j != 0) - return j; - - /* We have successfully globbed the directory name. - For each name we found, call glob_in_dir on it and FILENAME, - appending the results to PGLOB. */ - for (i = 0; i < dirs.gl_pathc; i++) { - j = glob_in_dir(filename, dirs.gl_pathv[i], ((flags | GLOB_APPEND) & ~GLOB_NOCHECK), - errfunc, pglob); - if (j == GLOB_NOMATCH) - /* No matches in this directory. Try the next. */ - continue; - if (j != 0) { - globfree(&dirs); - globfree(pglob); - return j; - } - } - - /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls. - But if we have not found any matching entry and the GLOB_NOCHECK - flag was set we must return the list consisting of the disrectory - names followed by the filename. */ - if (pglob->gl_pathc + pglob->gl_offs == oldcount) - { - /* No matches. */ - if (flags & GLOB_NOCHECK) - { - for (i = 0; i < dirs.gl_pathc; i++) { - if (stat(dirs.gl_pathv[i], &statr) || !S_ISDIR(statr.st_mode)) - continue; - - /* stat is okay, we will add the entry, but before let's resize the pathv */ - j = pglob->gl_pathc + pglob->gl_offs; - pglob->gl_pathv = (char **) realloc(pglob->gl_pathv, (j + 2) * sizeof (char *)); - if (pglob->gl_pathv == NULL) { - globfree (&dirs); - return GLOB_NOSPACE; - } - - /* okay now we add the new entry */ - k = strlen(dirs.gl_pathv[i]) + 1 + strlen(filename) + 1; - if ((pglob->gl_pathv[j] = malloc(k)) == NULL) { - globfree(&dirs); - globfree(pglob); - return GLOB_NOSPACE; - } - snprintf(pglob->gl_pathv[j], k, "%s/%s", dirs.gl_pathv[i], filename); - pglob->gl_pathc++; - pglob->gl_pathv[j+1] = NULL; - } - } else { - globfree(&dirs); - return GLOB_NOMATCH; - } - } - - globfree (&dirs); - } - - - if (flags & GLOB_MARK) { - for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; i++) - if (!stat(pglob->gl_pathv[i], &statr) && S_ISDIR(statr.st_mode)) { - size_t len = strlen(pglob->gl_pathv[i]) + 2; - ptr = realloc(pglob->gl_pathv[i], len); - if (ptr == NULL) { - globfree(pglob); - return GLOB_NOSPACE; - } - strcpy(&ptr[len - 2], "/"); - pglob->gl_pathv[i] = ptr; - } - } - - if (!(flags & GLOB_NOSORT)) { - qsort(&pglob->gl_pathv[oldcount], - pglob->gl_pathc + pglob->gl_offs - oldcount, - sizeof(char *), cmp_func); - } - - return 0; -} - - -/* Free storage allocated in PGLOB by a previous `glob' call. */ -void globfree (glob_t * pglob) -{ - if (pglob->gl_pathv != NULL) { - size_t i; - for (i = 0; i < pglob->gl_pathc; i++) - if (pglob->gl_pathv[pglob->gl_offs + i] != NULL) - free((void *) pglob->gl_pathv[pglob->gl_offs + i]); - free((void *) pglob->gl_pathv); - } -} diff --git a/mdk-stage1/dietlibc/libshell/realpath.c b/mdk-stage1/dietlibc/libshell/realpath.c deleted file mode 100644 index 1377018e5..000000000 --- a/mdk-stage1/dietlibc/libshell/realpath.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <limits.h> -#include <stdlib.h> -#include <errno.h> -#include <fcntl.h> -#include <string.h> -#include "dietfeatures.h" - -char *realpath(const char *path, char *resolved_path) { - int fd=open(".",O_RDONLY); - char *tmp=""; - if (chdir(path)) { -#ifdef WANT_THREAD_SAFE - if (*__errno_location()==ENOTDIR) -#else - if (errno==ENOTDIR) -#endif - { - if ((tmp=strrchr(path,'/'))) { - memmove(resolved_path,path,tmp-path); - resolved_path[tmp-path]=0; - if (chdir(resolved_path)) { resolved_path=0; goto abort; } - } - } - } - if (!getcwd(resolved_path,PATH_MAX)) { resolved_path=0; goto abort; } - strcat(resolved_path,tmp); -abort: - fchdir(fd); - close(fd); - return resolved_path; -} diff --git a/mdk-stage1/dietlibc/libstdio/clearerr.c b/mdk-stage1/dietlibc/libstdio/clearerr.c deleted file mode 100644 index 8bde8c702..000000000 --- a/mdk-stage1/dietlibc/libstdio/clearerr.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "dietstdio.h" - -void clearerr( FILE *stream) { - stream->flags&=~(ERRORINDICATOR|EOFINDICATOR); -} diff --git a/mdk-stage1/dietlibc/libstdio/fclose.c b/mdk-stage1/dietlibc/libstdio/fclose.c deleted file mode 100644 index a955c6086..000000000 --- a/mdk-stage1/dietlibc/libstdio/fclose.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "dietstdio.h" -#include <stdlib.h> -#include <unistd.h> - -int fclose(FILE *stream) { - int res; -#ifdef WANT_BUFFERED_STDIO - FILE *f,*fl; -#endif - if (!stream) - return EOF; - fflush(stream); - res=close(stream->fd); -#ifdef WANT_BUFFERED_STDIO - for (fl=0,f=__stdio_root; f; fl=f,f=f->next) - if (f==stream) { - if (fl) - fl->next=f->next; - else - __stdio_root=f->next; - break; - } -#endif - free(stream); - return res; -} diff --git a/mdk-stage1/dietlibc/libstdio/fdglue.c b/mdk-stage1/dietlibc/libstdio/fdglue.c deleted file mode 100644 index 1c3918f1f..000000000 --- a/mdk-stage1/dietlibc/libstdio/fdglue.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "dietstdio.h" -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <stdlib.h> - -#ifdef WANT_BUFFERED_STDIO -extern int __stdio_atexit; -extern void __stdio_flushall(); -#endif - -int __stdio_parse_mode(const char *mode) { - int f=0; - for (;;) { - switch (*mode) { - case 0: return f; - case 'b': break; - case 'r': f=O_RDONLY; break; - case 'w': f=O_WRONLY|O_CREAT|O_TRUNC; break; - case 'a': f=O_WRONLY|O_CREAT|O_APPEND; break; - case '+': f=(f&(~O_WRONLY))|O_RDWR; break; - } - ++mode; - } -} - -FILE* __stdio_init_file(int fd) { - FILE *tmp=(FILE*)malloc(sizeof(FILE)); - if (!tmp) { - close(fd); - errno=ENOMEM; - return 0; - } - tmp->fd=fd; -#ifdef WANT_BUFFERED_STDIO - tmp->bm=0; - tmp->bs=0; -#endif -#ifdef WANT_UNGETC - tmp->ungotten = 0; -#endif - tmp->flags=0; -#ifdef WANT_BUFFERED_STDIO - if (__stdio_atexit==0) { - __stdio_atexit=1; - atexit(__stdio_flushall); - } - tmp->next=__stdio_root; - __stdio_root=tmp; -#endif - return tmp; -} diff --git a/mdk-stage1/dietlibc/libstdio/fdopen.c b/mdk-stage1/dietlibc/libstdio/fdopen.c deleted file mode 100644 index aee14fb0c..000000000 --- a/mdk-stage1/dietlibc/libstdio/fdopen.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <sys/types.h> -#include <dietstdio.h> -#include <unistd.h> - -#define SEEK_END 2 - -int __stdio_parse_mode(const char *mode); -FILE* __stdio_init_file(int fd); - -FILE *fdopen (int filedes, const char *mode) { - int f=0; /* O_RDONLY, O_WRONLY or O_RDWR */ - int fd; - - f=__stdio_parse_mode(mode); - if ((fd=filedes)<0) return 0; - { - FILE * ret = __stdio_init_file(fd); - ret->flags |= UNSEEKABLE; - return ret; - } -} diff --git a/mdk-stage1/dietlibc/libstdio/feof.c b/mdk-stage1/dietlibc/libstdio/feof.c deleted file mode 100644 index b7e86fe3b..000000000 --- a/mdk-stage1/dietlibc/libstdio/feof.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <dietstdio.h> - -int feof(FILE *stream) { -#ifdef WANT_UNGETC - /* yuck!!! */ - if (stream->ungotten) return 0; -#endif - return (stream->flags&EOFINDICATOR); -} diff --git a/mdk-stage1/dietlibc/libstdio/ferror.c b/mdk-stage1/dietlibc/libstdio/ferror.c deleted file mode 100644 index e86873be0..000000000 --- a/mdk-stage1/dietlibc/libstdio/ferror.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <dietstdio.h> - -int ferror(FILE *stream) { - return (stream->flags&ERRORINDICATOR); -} diff --git a/mdk-stage1/dietlibc/libstdio/fflush.c b/mdk-stage1/dietlibc/libstdio/fflush.c deleted file mode 100644 index 7078e04f4..000000000 --- a/mdk-stage1/dietlibc/libstdio/fflush.c +++ /dev/null @@ -1,62 +0,0 @@ -#include "dietstdio.h" -#include <unistd.h> -#include <stdlib.h> -#include "dietwarning.h" - -FILE *__stdio_root; - -#ifdef WANT_BUFFERED_STDIO -int __stdio_atexit=0; - -void __stdio_flushall() { - fflush(0); -} - -extern int __fflush_stdin(); -extern int __fflush_stdout(); -extern int __fflush_stderr(); - -int fflush(FILE *stream) { - if (stream==0) { - int res; - FILE *f; - __fflush_stdin(); - __fflush_stdout(); - __fflush_stderr(); - for (res=0, f=__stdio_root; f; f=f->next) - if (fflush(f)) - res=-1; - return res; - } - if (stream->flags&BUFINPUT) { - register int tmp; - if ((tmp=stream->bm-stream->bs)) lseek(stream->fd,tmp,SEEK_CUR); - } else - if (stream->bm && write(stream->fd,stream->buf,stream->bm)!=stream->bm) { - stream->flags|=ERRORINDICATOR; - return -1; - } - stream->bm=0; - return 0; -} - -int __fflush4(FILE *stream,int next) { - if (!__stdio_atexit) { - __stdio_atexit=1; - atexit(__stdio_flushall); - } - if ((stream->flags&BUFINPUT)!=next) { - int res=fflush(stream); - stream->flags=(stream->flags&~BUFINPUT)|next; - return res; - } - return 0; -} - -#else -int fflush(FILE *stream) { - return 0; -} -#endif - -link_warning("fflush","warning: your code uses stdio (several kilobytes of bloat).") diff --git a/mdk-stage1/dietlibc/libstdio/fgetc.c b/mdk-stage1/dietlibc/libstdio/fgetc.c deleted file mode 100644 index 90d83961a..000000000 --- a/mdk-stage1/dietlibc/libstdio/fgetc.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "dietstdio.h" -#include <unistd.h> - -extern int feof(FILE *stream); - -int fgetc(FILE *stream) { - unsigned char c; -#ifdef WANT_UNGETC - if (stream->ungotten) { - stream->ungotten=0; - return stream->ungetbuf; - } -#endif - if (feof(stream)) - return EOF; -#ifdef WANT_BUFFERED_STDIO - if (__fflush4(stream,BUFINPUT)) return EOF; - if (stream->bm>=stream->bs) { - int len=read(stream->fd,stream->buf,BUFSIZE); - if (len==0) { - stream->flags|=EOFINDICATOR; - return EOF; - } else if (len<0) { - stream->flags|=ERRORINDICATOR; - return EOF; - } - stream->bm=0; - stream->bs=len; - } - c=stream->buf[stream->bm]; - ++stream->bm; - return c; -#else - if (read(stream->fd,&c,1)!=1) { - stream->flags|=ERRORINDICATOR; - return EOF; - } - return c; -#endif -} diff --git a/mdk-stage1/dietlibc/libstdio/fgets.c b/mdk-stage1/dietlibc/libstdio/fgets.c deleted file mode 100644 index c613d452d..000000000 --- a/mdk-stage1/dietlibc/libstdio/fgets.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "dietstdio.h" - -extern int ferror(FILE *stream); - -char *fgets(char *s, int size, FILE *stream) { - char *orig=s; - int l; - for (l=size; l>0;) { - int c=fgetc(stream); - if (c==EOF) break; - *s=c; - ++s; - --l; - if (c=='\n') break; - } - if (l==size || ferror(stream)) - return 0; - *s=0; - return orig; -} diff --git a/mdk-stage1/dietlibc/libstdio/fileno.c b/mdk-stage1/dietlibc/libstdio/fileno.c deleted file mode 100644 index f021d3881..000000000 --- a/mdk-stage1/dietlibc/libstdio/fileno.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <dietstdio.h> - -int fileno(FILE *stream) { - return stream->fd; -} diff --git a/mdk-stage1/dietlibc/libstdio/fopen.c b/mdk-stage1/dietlibc/libstdio/fopen.c deleted file mode 100644 index aac17be42..000000000 --- a/mdk-stage1/dietlibc/libstdio/fopen.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <sys/types.h> -#include <dietstdio.h> -#include <unistd.h> - -#define SEEK_END 2 - -extern int __stdio_atexit; -extern void __stdio_flushall(); - -extern int __stdio_parse_mode(const char *mode); -extern FILE* __stdio_init_file(int fd); - -FILE *fopen (const char *path, const char *mode) { - int f=0; /* O_RDONLY, O_WRONLY or O_RDWR */ - int fd; - - f=__stdio_parse_mode(mode); - if ((fd=open(path,f,0666))<0) - return 0; - return __stdio_init_file(fd); -} diff --git a/mdk-stage1/dietlibc/libstdio/fprintf.c b/mdk-stage1/dietlibc/libstdio/fprintf.c deleted file mode 100644 index 237fd1e51..000000000 --- a/mdk-stage1/dietlibc/libstdio/fprintf.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <stdarg.h> -#include <linux/types.h> -#include <stdio.h> -#include <stdlib.h> - -extern int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int fprintf(FILE *f,const char *format,...) { - int n; - char *printf_buf; -/* char printf_buf[1024]; */ - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsnprintf(0,1000000,format,arg_ptr); -/* write(1,printf_buf,strlen(printf_buf)); */ - va_end (arg_ptr); - va_start (arg_ptr, format); - printf_buf=alloca(n+2); - n=vsnprintf(printf_buf,n+1,format,arg_ptr); - va_end (arg_ptr); - fwrite(printf_buf,n,1,f); - return n; -} diff --git a/mdk-stage1/dietlibc/libstdio/fputc.c b/mdk-stage1/dietlibc/libstdio/fputc.c deleted file mode 100644 index b816f7c4d..000000000 --- a/mdk-stage1/dietlibc/libstdio/fputc.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <dietstdio.h> -#ifndef WANT_BUFFERED_STDIO -#include <unistd.h> -#endif - -int fputc(int c, FILE *stream) { -#ifdef WANT_BUFFERED_STDIO - if (__fflush4(stream,0)) return EOF; - if (stream->bm>=BUFSIZE-1) - if (fflush(stream)) return EOF; - stream->buf[stream->bm]=c; - ++stream->bm; - if ((stream->flags&BUFLINEWISE) && c=='\n') /* puke */ - if (fflush(stream)) return EOF; -#else - write(stream->fd,&c,1); -#endif - return 0; -} diff --git a/mdk-stage1/dietlibc/libstdio/fputs.c b/mdk-stage1/dietlibc/libstdio/fputs.c deleted file mode 100644 index 51ee9a96e..000000000 --- a/mdk-stage1/dietlibc/libstdio/fputs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "dietstdio.h" -#include <string.h> - -int fputs(const char *s, FILE *stream) { - return fwrite(s,strlen(s),1,stream); -} diff --git a/mdk-stage1/dietlibc/libstdio/fread.c b/mdk-stage1/dietlibc/libstdio/fread.c deleted file mode 100644 index 29afa1489..000000000 --- a/mdk-stage1/dietlibc/libstdio/fread.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <sys/types.h> -#include "dietstdio.h" -#include <unistd.h> - -size_t fread( void *ptr, size_t size, size_t nmemb, FILE *stream) { - int res; -#ifdef WANT_BUFFERED_STDIO - unsigned long i,j; - j=size*nmemb; -#ifdef WANT_UNGETC - if (stream->ungotten) { - *(char*)ptr=stream->ungetbuf; - ptr=((char*)ptr)+1; - --j; - } - if (!j) return 1; -#endif - for (i=0; i<j; ++i) { - res=fgetc(stream); - if (res==EOF) - return i/size; - else - ((unsigned char*)ptr)[i]=(unsigned char)res; - } - return nmemb; -#else -#ifdef WANT_UNGETC - unsigned long j=size*nmemb; -#endif - fflush(stream); -#ifdef WANT_UNGETC - if (stream->ungotten) { - *(char*)ptr=stream->ungetbuf; - ptr=((char*)ptr)+1; - --j; - } - if (!j) return 1; - res=read(stream->fd,ptr,j); -#else - res=read(stream->fd,ptr,size*nmemb); -#endif - if (res<0) { - stream->flags|=ERRORINDICATOR; - return 0; - } else if (res<size*nmemb) - if (!(stream->flags & UNSEEKABLE) - || ((stream->flags & UNSEEKABLE) && res == 0)) - stream->flags|=EOFINDICATOR; - return res/size; -#endif -} diff --git a/mdk-stage1/dietlibc/libstdio/freopen.c b/mdk-stage1/dietlibc/libstdio/freopen.c deleted file mode 100644 index 8d4644a10..000000000 --- a/mdk-stage1/dietlibc/libstdio/freopen.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <sys/types.h> -#include <dietstdio.h> -#include <unistd.h> - -FILE *freopen (const char *path, const char *mode, FILE *stream) { - fclose(stream); - stream=fopen(path,mode); - return stream; -} diff --git a/mdk-stage1/dietlibc/libstdio/fseek.c b/mdk-stage1/dietlibc/libstdio/fseek.c deleted file mode 100644 index 5bb96bc6e..000000000 --- a/mdk-stage1/dietlibc/libstdio/fseek.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <dietstdio.h> -#include <unistd.h> - -long fseek(FILE *stream, long offset, int whence) { - fflush(stream); -#ifdef WANT_BUFFERED_STDIO - stream->bm=0; stream->bs=0; -#endif - stream->flags&=~(ERRORINDICATOR|EOFINDICATOR); - return (lseek(stream->fd,offset,whence)); -} diff --git a/mdk-stage1/dietlibc/libstdio/ftell.c b/mdk-stage1/dietlibc/libstdio/ftell.c deleted file mode 100644 index 42d2c9f26..000000000 --- a/mdk-stage1/dietlibc/libstdio/ftell.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <dietstdio.h> -#include <unistd.h> - -long ftell(FILE *stream) { - fflush(stream); - return (lseek(stream->fd,0,SEEK_CUR)); -} diff --git a/mdk-stage1/dietlibc/libstdio/fwrite.c b/mdk-stage1/dietlibc/libstdio/fwrite.c deleted file mode 100644 index 5691661a5..000000000 --- a/mdk-stage1/dietlibc/libstdio/fwrite.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <sys/types.h> -#include "dietstdio.h" -#include <unistd.h> - -size_t fwrite( const void *ptr, size_t size, size_t nmemb, FILE *stream) { - int res; -#ifdef WANT_BUFFERED_STDIO - long len=size*nmemb; - long i; - if (len>BUFSIZE || (stream->flags&NOBUF)) { - if (!(stream->flags&NOBUF)) fflush(stream); - res=write(stream->fd,ptr,size*nmemb); - } else { - register const unsigned char *c=ptr; - for (i=size*nmemb; i>0; --i,++c) - if (fputc(*c,stream)) { - res=-1; - break; - } - res=size*nmemb; - } -#else - res=write(stream->fd,ptr,size*nmemb); -#endif - if (res<0) { - stream->flags|=ERRORINDICATOR; - return 0; - } - return size?res/size:0; -} diff --git a/mdk-stage1/dietlibc/libstdio/printf.c b/mdk-stage1/dietlibc/libstdio/printf.c deleted file mode 100644 index 571420dc3..000000000 --- a/mdk-stage1/dietlibc/libstdio/printf.c +++ /dev/null @@ -1,29 +0,0 @@ -#include <stdarg.h> -#include <linux/types.h> -#include <unistd.h> -#include <stdlib.h> -#include "dietstdio.h" - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int printf(const char *format,...) -{ - int n; - char *printf_buf; -/* char printf_buf[1024]; */ - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsnprintf(0,1000000,format,arg_ptr); -/* write(1,printf_buf,strlen(printf_buf)); */ - va_end (arg_ptr); - va_start (arg_ptr, format); - printf_buf=alloca(n+2); - n=vsnprintf(printf_buf,n+1,format,arg_ptr); -#ifdef WANT_BUFFERED_STDIO - fwrite(printf_buf,n,1,stdout); -#else - write(1,printf_buf,n); -#endif - va_end (arg_ptr); - return n; -} diff --git a/mdk-stage1/dietlibc/libstdio/putchar.c b/mdk-stage1/dietlibc/libstdio/putchar.c deleted file mode 100644 index 7e5285a48..000000000 --- a/mdk-stage1/dietlibc/libstdio/putchar.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdio.h> - -#undef putchar -int putchar(int c) { - return fputc(c,stdout); -} diff --git a/mdk-stage1/dietlibc/libstdio/setvbuf.c b/mdk-stage1/dietlibc/libstdio/setvbuf.c deleted file mode 100644 index d0b1b7640..000000000 --- a/mdk-stage1/dietlibc/libstdio/setvbuf.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <sys/types.h> -#include "dietstdio.h" -#include <unistd.h> -#include "dietwarning.h" - -int setvbuf(FILE *stream, char *buf, int flags , size_t size) { -#ifdef WANT_BUFFERED_STDIO - switch (flags) { - case _IONBF: stream->flags = (stream->flags & ~(BUFLINEWISE)) | NOBUF; break; - case _IOLBF: stream->flags = (stream->flags & ~(BUFLINEWISE|NOBUF)) | BUFLINEWISE; break; - case _IOFBF: stream->flags = stream->flags & ~(NOBUF | BUFLINEWISE); break; - default: return -1; - } -#endif - return 0; -} - -link_warning("setvbuf","setvbuf does not implement changing the buffer in diet libc.") diff --git a/mdk-stage1/dietlibc/libstdio/stderr.c b/mdk-stage1/dietlibc/libstdio/stderr.c deleted file mode 100644 index a82b1b727..000000000 --- a/mdk-stage1/dietlibc/libstdio/stderr.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <dietstdio.h> - -#ifdef WANT_BUFFERED_STDIO -static FILE __stderr = { 2, NOBUF, 0, 0 }; - -int __fflush_stderr() { - return fflush(stderr); -} -#else -static FILE __stderr = { 2, 0 }; -#endif - -FILE *stderr=&__stderr; diff --git a/mdk-stage1/dietlibc/libstdio/stdin.c b/mdk-stage1/dietlibc/libstdio/stdin.c deleted file mode 100644 index 2db82f9ab..000000000 --- a/mdk-stage1/dietlibc/libstdio/stdin.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <dietstdio.h> - -#ifdef WANT_BUFFERED_STDIO -static FILE __stdin = { 0, BUFINPUT, 0, 0 }; - -int __fflush_stdin() { - return fflush(stdin); -} -#else -static FILE __stdin = { 0, 0 }; -#endif - -FILE *stdin=&__stdin; diff --git a/mdk-stage1/dietlibc/libstdio/stdout.c b/mdk-stage1/dietlibc/libstdio/stdout.c deleted file mode 100644 index 481fb1014..000000000 --- a/mdk-stage1/dietlibc/libstdio/stdout.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <dietstdio.h> - -#ifdef WANT_BUFFERED_STDIO -static FILE __stdout = { 1, BUFLINEWISE, 0, 0 }; - -int __fflush_stdout() { - return fflush(stdout); -} -#else -static FILE __stdout = { 1, 0 }; -#endif - -FILE *stdout=&__stdout; - diff --git a/mdk-stage1/dietlibc/libstdio/ungetc.c b/mdk-stage1/dietlibc/libstdio/ungetc.c deleted file mode 100644 index ae03e9381..000000000 --- a/mdk-stage1/dietlibc/libstdio/ungetc.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "dietstdio.h" - -#ifdef WANT_UNGETC -int ungetc(int c, FILE *stream) { - if (stream->ungotten) - return EOF; - stream->ungotten=1; - stream->ungetbuf=(char)(unsigned char)c; - return c; -} -#endif diff --git a/mdk-stage1/dietlibc/libugly/asctime.c b/mdk-stage1/dietlibc/libugly/asctime.c deleted file mode 100644 index e1fcc8706..000000000 --- a/mdk-stage1/dietlibc/libugly/asctime.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <time.h> - -static char buf[25]; - -char *asctime(const struct tm *timeptr) { - return asctime_r(timeptr,buf); -} diff --git a/mdk-stage1/dietlibc/libugly/asctime_r.c b/mdk-stage1/dietlibc/libugly/asctime_r.c deleted file mode 100644 index 46325927c..000000000 --- a/mdk-stage1/dietlibc/libugly/asctime_r.c +++ /dev/null @@ -1,29 +0,0 @@ -#include <time.h> - -static const char days[] = "Sun Mon Tue Wed Thu Fri Sat "; -static const char months[] = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec "; - -static void num2str(char *c,int i) { - c[0]=i/10+'0'; - c[1]=i%10+'0'; -} - -char *asctime_r(const struct tm *t, char *buf) { - /* "Wed Jun 30 21:49:08 1993\n" */ - *(int*)buf=*(int*)(days+(t->tm_wday<<2)); - *(int*)(buf+4)=*(int*)(months+(t->tm_mon<<2)); - num2str(buf+8,t->tm_mday); - if (buf[8]=='0') buf[8]=' '; - buf[10]=' '; - num2str(buf+11,t->tm_hour); - if (buf[11]=='0') buf[11]=' '; - buf[13]=':'; - num2str(buf+14,t->tm_min); - buf[16]=':'; - num2str(buf+17,t->tm_sec); - buf[19]=' '; - num2str(buf+20,(t->tm_year+1900)/100); - num2str(buf+22,(t->tm_year+1900)%100); - buf[24]='\n'; - return buf; -} diff --git a/mdk-stage1/dietlibc/libugly/asprintf.c b/mdk-stage1/dietlibc/libugly/asprintf.c deleted file mode 100644 index d10c20b4a..000000000 --- a/mdk-stage1/dietlibc/libugly/asprintf.c +++ /dev/null @@ -1,22 +0,0 @@ -#include <stdarg.h> -#include <linux/types.h> -#include <stdlib.h> -#include "dietwarning.h" - -extern int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int asprintf(char **s, const char *format,...) -{ - int n; - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsnprintf(0,1000000,format,arg_ptr); - va_end (arg_ptr); - va_start (arg_ptr, format); - if ((*s=malloc(n+2))) { - n=vsnprintf(*s,n+1,format,arg_ptr); - va_end(arg_ptr); - return n; - } - return -1; -} diff --git a/mdk-stage1/dietlibc/libugly/ctime.c b/mdk-stage1/dietlibc/libugly/ctime.c deleted file mode 100644 index a0e12d673..000000000 --- a/mdk-stage1/dietlibc/libugly/ctime.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <time.h> - -char *ctime(const time_t *timep) { - return asctime(localtime(timep)); -} diff --git a/mdk-stage1/dietlibc/libugly/daemon.c b/mdk-stage1/dietlibc/libugly/daemon.c deleted file mode 100644 index 6748cc3c9..000000000 --- a/mdk-stage1/dietlibc/libugly/daemon.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <paths.h> - -#include "daemon.h" - -int daemon (int nochdir,int noclose) -{ - int fd; - switch (fork ()) - { - case -1: - return (-1); - case 0: - break; - default: - _exit (0); - } - if (setsid () == -1) - return (-1); - if (!nochdir) chdir ("/"); - if (!noclose) - { - fd = open (_PATH_DEVNULL,O_RDWR,0); - if (fd == -1) return (-1); - dup2 (fd,STDIN_FILENO); - dup2 (fd,STDOUT_FILENO); - dup2 (fd,STDERR_FILENO); - close (fd); - } - return (0); -} - diff --git a/mdk-stage1/dietlibc/libugly/endmntent.c b/mdk-stage1/dietlibc/libugly/endmntent.c deleted file mode 100644 index 00ade38e5..000000000 --- a/mdk-stage1/dietlibc/libugly/endmntent.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> -#include <mntent.h> - -int endmntent(FILE *filep) { - return fclose(filep); -} - diff --git a/mdk-stage1/dietlibc/libugly/facilitynames.c b/mdk-stage1/dietlibc/libugly/facilitynames.c deleted file mode 100644 index 8b0e1f21f..000000000 --- a/mdk-stage1/dietlibc/libugly/facilitynames.c +++ /dev/null @@ -1,32 +0,0 @@ -#include <sys/syslog.h> - -#ifndef INTERNAL_MARK -#define INTERNAL_MARK 0x300 -#endif - -CODE facilitynames[] = - { - { "auth", LOG_AUTH }, - { "authpriv", LOG_AUTHPRIV }, - { "cron", LOG_CRON }, - { "daemon", LOG_DAEMON }, - { "ftp", LOG_FTP }, - { "kern", LOG_KERN }, - { "lpr", LOG_LPR }, - { "mail", LOG_MAIL }, - { "mark", INTERNAL_MARK }, /* INTERNAL */ - { "news", LOG_NEWS }, - { "security", LOG_AUTH }, /* DEPRECATED */ - { "syslog", LOG_SYSLOG }, - { "user", LOG_USER }, - { "uucp", LOG_UUCP }, - { "local0", LOG_LOCAL0 }, - { "local1", LOG_LOCAL1 }, - { "local2", LOG_LOCAL2 }, - { "local3", LOG_LOCAL3 }, - { "local4", LOG_LOCAL4 }, - { "local5", LOG_LOCAL5 }, - { "local6", LOG_LOCAL6 }, - { "local7", LOG_LOCAL7 }, - { 0, -1 } - }; diff --git a/mdk-stage1/dietlibc/libugly/getmntent.c b/mdk-stage1/dietlibc/libugly/getmntent.c deleted file mode 100644 index 250a77b7f..000000000 --- a/mdk-stage1/dietlibc/libugly/getmntent.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <mntent.h> -#include <string.h> - -struct mntent *getmntent(FILE *filep) { - static struct mntent m; - char buf[1024]; - do { - char *tmp=buf; - int num; - fgets(buf,1024,filep); -/* "/dev/ide/host0/bus0/target0/lun0/part2 / reiserfs defaults 1 1" */ - for (num=0; num<6; ++num) { - switch (num) { - case 0: m.mnt_fsname=tmp; break; - case 1: m.mnt_dir=tmp; break; - case 2: m.mnt_type=tmp; break; - case 3: m.mnt_opts=tmp; break; - case 4: m.mnt_freq=strtol(tmp,&tmp,0); if (*tmp!=' ') continue; break; - case 5: m.mnt_passno=strtol(tmp,&tmp,0); if (*tmp=='\n') return &m; break; - } - if ((tmp=strchr(tmp,' '))) { - if (num<4) *tmp++=0; - while (*tmp==' ') ++tmp; - } else - continue; - } - } while (1); -} diff --git a/mdk-stage1/dietlibc/libugly/getprotoent.c b/mdk-stage1/dietlibc/libugly/getprotoent.c deleted file mode 100644 index a648e2307..000000000 --- a/mdk-stage1/dietlibc/libugly/getprotoent.c +++ /dev/null @@ -1,130 +0,0 @@ -#include <unistd.h> -#include <fcntl.h> -#include <netdb.h> -#include <sys/mman.h> -#include <errno.h> -#include <netinet/in.h> -#include <string.h> -#include <ctype.h> - -static int protofd=-1; -static char* protomap; -static unsigned int protolen; - -static char* aliases[10]; - -static char *cur; - -/* ip 0 IP # internet protocol, pseudo protocol number */ -struct protoent *getprotoent(void) { - static struct protoent pe; - char *last; - int aliasidx; - if (protofd<0) { - protofd=open(_PATH_SERVICES,O_RDONLY); - if (protofd<0) return 0; - protolen=lseek(protofd,0,SEEK_END); - protomap=mmap(0,protolen,PROT_READ|PROT_WRITE,MAP_PRIVATE,protofd,0); - if ((long)protomap==(-1)) goto error; - cur=protomap; - } - last=protomap+protolen; -again: - pe.p_name=0; - pe.p_aliases=aliases; aliases[0]=0; - pe.p_proto=0; - if (cur>=last) return 0; - if (*cur=='#' || *cur=='\n') goto parseerror; - /* first, the primary name */ - if (!isalpha(*cur)) goto parseerror; - pe.p_name=cur; - pe.p_aliases=aliases; - while (cur<last && isalnum(*cur)) cur++; - if (cur>=last) return 0; - if (*cur=='\n') goto parseerror; - *cur=0; cur++; - /* second, the protocol number */ - while (cur<last && isblank(*cur)) cur++; - while (cur<last && isdigit(*cur)) { - pe.p_proto=pe.p_proto*10+*cur-'0'; - cur++; - } -/* pe.p_proto=htons(pe.s_proto); */ - if (cur>=last) return 0; - if (*cur=='\n') { *cur++=0; return &pe; } - *cur=0; cur++; - /* now the aliases */ - for (aliasidx=0;aliasidx<10;++aliasidx) { - while (cur<last && isblank(*cur)) ++cur; - aliases[aliasidx]=cur; - while (cur<last && isalpha(*cur)) ++cur; - if (*cur=='\n') { *cur++=0; ++aliasidx; break; } - if (cur>=last || !isblank(*cur)) break; - *cur++=0; - } - aliases[aliasidx]=0; - return &pe; -parseerror: - while (cur<last && *cur!='\n') cur++; - cur++; - goto again; -error: - if (protomap!=(char*)-1) munmap(protomap,protolen); - if (protofd!=-1) close(protofd); - protomap=(char*)-1; - protofd=-1; - errno=ENOMEM; - return 0; -} - -void setprotoent(int stayopen) { - cur=protomap; -} - -struct protoent *getprotobyname(const char *name) { - struct protoent *s; - setprotoent(0); - for (s=getprotoent(); s; s=getprotoent()) { - char **tmp; -#if 0 - write(1,"found ",6); - write(1,s->p_name,strlen(s->p_name)); - write(1,"/",1); - write(1,s->p_proto,strlen(s->p_proto)); - write(1,"\n",1); - if (!strcmp(name,"auth")) { - tmp=s->p_aliases; - write(1," aka ",5); - while (*tmp) { - write(1,*tmp,strlen(*tmp)); - write(1,", ",2); - ++tmp; - } - write(1,"\n",1); - } -#endif - if (!strcmp(name,s->p_name)) - return s; - tmp=s->p_aliases; - while (*tmp) - if (!strcmp(name,*tmp++)) return s; - } - return 0; -} - -struct protoent *getprotobynumber(int proto) { - struct protoent *s; - for (s=getprotoent(); s; s=getprotoent()) { - if (proto==s->p_proto) - return s; - } - return 0; -} - -void endprotoent(void) { - if (protomap!=(char*)-1) munmap(protomap,protolen); - if (protofd!=-1) close(protofd); - protomap=(char*)-1; - protofd=-1; -} - diff --git a/mdk-stage1/dietlibc/libugly/gmtime.c b/mdk-stage1/dietlibc/libugly/gmtime.c deleted file mode 100644 index d33af7972..000000000 --- a/mdk-stage1/dietlibc/libugly/gmtime.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <time.h> - -struct tm* gmtime(const time_t *t) { - static struct tm tmp; - return gmtime_r(t,&tmp); -} diff --git a/mdk-stage1/dietlibc/libugly/gmtime_r.c b/mdk-stage1/dietlibc/libugly/gmtime_r.c deleted file mode 100644 index c102d10fa..000000000 --- a/mdk-stage1/dietlibc/libugly/gmtime_r.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <time.h> - -/* seconds per day */ -#define SPD 24*60*60 - -extern unsigned int __spm[]; - -struct tm *gmtime_r(const time_t *timep, struct tm *r) { - time_t i; - register time_t work=*timep%(SPD); - r->tm_sec=work%60; work/=60; - r->tm_min=work%60; r->tm_hour=work/60; - work=*timep/(SPD); - r->tm_wday=(4+work)%7; - for (i=1970; ; ++i) { - register time_t k=__isleap(i)?366:365; - if (work>k) - work-=k; - else - break; - } - r->tm_year=i-1900; - r->tm_yday=work; - - r->tm_mday=1; - if (__isleap(i) && (work>58)) { - if (work==59) r->tm_mday=2; /* 29.2. */ - work-=1; - } - - for (i=11; i && __spm[i]>work; --i) ; - r->tm_mon=i; - r->tm_mday+=work-__spm[i]; - return r; -} diff --git a/mdk-stage1/dietlibc/libugly/isleap.c b/mdk-stage1/dietlibc/libugly/isleap.c deleted file mode 100644 index dcfa1ced6..000000000 --- a/mdk-stage1/dietlibc/libugly/isleap.c +++ /dev/null @@ -1,6 +0,0 @@ -int __isleap(int year) { - /* every fourth year is a leap year except for century years that are - * not divisible by 400. */ -/* return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); */ - return (!(year%4) && ((year%100) || !(year%400))); -} diff --git a/mdk-stage1/dietlibc/libugly/localtime.c b/mdk-stage1/dietlibc/libugly/localtime.c deleted file mode 100644 index 6fa6acf8a..000000000 --- a/mdk-stage1/dietlibc/libugly/localtime.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <time.h> - -struct tm* localtime(const time_t* t) { - static struct tm tmp; - return localtime_r(t,&tmp); -} diff --git a/mdk-stage1/dietlibc/libugly/localtime_r.c b/mdk-stage1/dietlibc/libugly/localtime_r.c deleted file mode 100644 index d4bc073ce..000000000 --- a/mdk-stage1/dietlibc/libugly/localtime_r.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "dietfeatures.h" -#include <time.h> -#include <sys/time.h> - -#ifdef WANT_TZFILE_PARSER -extern void __maplocaltime(); -extern time_t __tzfile_map(time_t t, int *isdst); -#endif - -struct tm* localtime_r(const time_t* t, struct tm* r) { - time_t tmp; -#ifdef WANT_TZFILE_PARSER - __maplocaltime(); - tmp=__tzfile_map(*t,&r->tm_isdst); -#else - struct timezone tz; - gettimeofday(0, &tz); - tmp=*t-tz.tz_minuteswest*60L; -#endif - return gmtime_r(&tmp,r); -} diff --git a/mdk-stage1/dietlibc/libugly/logging.c b/mdk-stage1/dietlibc/libugly/logging.c deleted file mode 100644 index 69c2c2337..000000000 --- a/mdk-stage1/dietlibc/libugly/logging.c +++ /dev/null @@ -1,211 +0,0 @@ -#include "dietfeatures.h" - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <errno.h> -#include <unistd.h> -#include <asm/socket.h> -#include <fcntl.h> -#include <syslog.h> -#include <string.h> -#include <time.h> -#include <sys/socket.h> -#include <signal.h> - -#define _PATH_CONSOLE "/dev/console" -#define BUF_SIZE 512 /* messagebuffer size (>= 200) */ - -#define MAX_LOGTAG 80 - -/* those have to be global *sigh* */ -static volatile int connected = 0; /* have done connect */ -static volatile int LogMask = 0xff; /* mask of priorities to be logged */ -static char LogTag[MAX_LOGTAG]; /* string to tag the entry with */ -static int LogFile = -1; /* fd for log */ -static int LogType = SOCK_DGRAM; /* type of socket connection */ -static int LogFacility = LOG_USER; /* default facility code */ -static int LogStat; /* status bits, set by openlog() */ -extern char *__progname; /* Program name, from crt0. */ -static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ - -static void closelog_intern(void) -{ - if (!connected) return; - close(LogFile); - LogFile = -1; - connected = 0; -} - -void closelog(void) -{ - closelog_intern(); - - LogTag[0]=0; - LogType = SOCK_DGRAM; -} - -static void openlog_intern(int option, int facility) -{ - LogStat = option; - if (facility && ((facility & ~LOG_FACMASK) == 0)) - LogFacility = facility; - - /* yep, there is a continue inside ;) */ - while(1) { - if (LogFile == -1) { - SyslogAddr.sa_family = AF_UNIX; - strncpy(SyslogAddr.sa_data, _PATH_LOG, sizeof(SyslogAddr.sa_data)); - if (LogStat & LOG_NDELAY) - { - if ((LogFile = socket(AF_UNIX, LogType, 0)) == -1) return; - fcntl(LogFile, F_SETFD, 1); - } - } - if ((LogFile != -1) && !connected) { -#ifdef WANT_THREAD_SAFE - int old_errno = (*(__errno_location())); -#else - int old_errno=errno; -#endif - if(connect(LogFile, &SyslogAddr, sizeof(SyslogAddr)) == -1) { -#ifdef WANT_THREAD_SAFE - int saved_errno = (*(__errno_location())); -#else - int saved_errno=errno; -#endif - close(LogFile); - LogFile = -1; - if((LogType == SOCK_DGRAM) && (saved_errno == EPROTOTYPE)) { - /* retry with SOCK_STREAM instead of SOCK_DGRAM */ - LogType = SOCK_STREAM; -#ifdef WANT_THREAD_SAFE - (*(__errno_location()))=old_errno; -#else - errno=old_errno; -#endif - continue; - } - } - else connected = 1; - } - break; - } -} - -/* has to be secured against multiple, simultanious call's in threaded environment */ -void openlog(const char *ident, int option, int facility) -{ - if (ident) { - strncpy(LogTag,ident,MAX_LOGTAG); - LogTag[MAX_LOGTAG-1]=0; - } - openlog_intern(option, facility); -} - -int setlogmask(int mask) -{ - int old = LogMask; - if (mask) LogMask = mask; - return old; -} - -void vsyslog(int priority, const char *format, va_list arg_ptr) -{ - char buffer[BUF_SIZE]; - char time_buf[20]; - int buflen, headerlen; - time_t now; - struct tm now_tm; - pid_t pid; - int fd; - int sigpipe; - struct sigaction action, oldaction; - struct sigaction *oldaction_ptr = NULL; -#ifdef WANT_THREAD_SAFE - int saved_errno = (*(__errno_location())); -#else - int saved_errno = errno; -#endif - - /* check for invalid priority/facility bits */ - if (priority & ~(LOG_PRIMASK|LOG_FACMASK)) { - syslog(LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID, "syslog: unknown facility/priorityority: %x", priority); - priority &= LOG_PRIMASK|LOG_FACMASK; - } - - /* check priority against setlogmask */ - if ((LOG_MASK(LOG_PRI(priority)) && LogMask) == 0) return; - - /* Set default facility if none specified. */ - if ((priority & LOG_FACMASK) == 0) priority |= LogFacility; - - pid = getpid(); - time(&now); - strftime(time_buf, 20, "%h %e %T", localtime_r (&now, &now_tm)); - - if (LogStat & LOG_PID) - headerlen = snprintf(buffer, 130, "<%d>%s %s[%d]: ", priority, time_buf, LogTag, pid); - else - headerlen = snprintf(buffer, 130, "<%d>%s %s: ", priority, time_buf, LogTag); - - if (!LogTag[0]) { - if ((LogStat & LOG_PID) != LOG_PID) - headerlen = snprintf(buffer, 130, "<%d>%s (unknown)[%d]: ", priority, time_buf, pid); - strcat(buffer+headerlen, "syslog without openlog w/ ident, please check code!"); - buflen = 41; - } - else { -#ifdef WANT_THREAD_SAFE - (*(__errno_location()))=saved_errno; -#else - errno=saved_errno; -#endif - buflen = vsnprintf(buffer+headerlen, BUF_SIZE - headerlen, format, arg_ptr); - } - if (LogStat & LOG_PERROR) { - write(1, buffer+headerlen, buflen); - if (buffer[headerlen+buflen] != '\n') write(1,"\n", 1); - } - - /* prepare for broken connection */ - memset(&action, 0, sizeof(action)); - action.sa_handler = SIG_IGN; - sigemptyset(&action.sa_mask); - - if ((sigpipe = sigaction (SIGPIPE, &action, &oldaction))==0) - oldaction_ptr = &oldaction; - - if (!connected) openlog_intern(LogStat | LOG_NDELAY, 0); - - /* If we have a SOCK_STREAM connection, also send ASCII NUL as a - * record terminator. */ - if (LogType == SOCK_STREAM) buflen++; - - if (!connected || (send(LogFile, buffer, buflen+headerlen, 0) != buflen+headerlen)) { - if (LogType == SOCK_STREAM) buflen--; - closelog_intern(); - /* - * Output the message to the console; don't worry about blocking, - * if console blocks everything will. Make sure the error reported - * is the one from the syslogd failure. - */ - if ((LogStat & LOG_CONS) && - ((fd = open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)) - { - write(fd, buffer, buflen+headerlen); - write(fd, "\r\n", 2); - } - } - - if (sigpipe == 0) - sigaction(SIGPIPE, &oldaction, (struct sigaction *) NULL); -} - -void syslog(int priority, const char *format, ...) -{ - va_list arg_ptr; - va_start(arg_ptr, format); - vsyslog(priority, format, arg_ptr); - va_end(arg_ptr); -} diff --git a/mdk-stage1/dietlibc/libugly/mktime.c b/mdk-stage1/dietlibc/libugly/mktime.c deleted file mode 100644 index ee4dab6c1..000000000 --- a/mdk-stage1/dietlibc/libugly/mktime.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <time.h> - -/* seconds per day */ -#define SPD 24*60*60 - -extern unsigned int __spm[]; - -time_t mktime(struct tm *t) { - time_t x=0; - unsigned int i; - if (t->tm_year<70) return (time_t)(-1); - for (i=70; i<t->tm_year; ++i) { - x+=__isleap(i+1900)?366:365; - } - t->tm_yday=__spm[t->tm_mon] + t->tm_mday-1 + ((t->tm_mon>2) && __isleap(t->tm_year)?1:0); - x+=t->tm_yday; - /* x is now the number of days since Jan 1 1970 */ - t->tm_wday=(4+x)%7; - x = x*SPD + t->tm_hour*60*60 + t->tm_min*60 + t->tm_sec; - return x; -} diff --git a/mdk-stage1/dietlibc/libugly/pclose.c b/mdk-stage1/dietlibc/libugly/pclose.c deleted file mode 100644 index e33076c19..000000000 --- a/mdk-stage1/dietlibc/libugly/pclose.c +++ /dev/null @@ -1,11 +0,0 @@ -#include <sys/types.h> -#include <sys/wait.h> -#include "dietstdio.h" - -int pclose(FILE *f) { - int status; - fclose(f); - if (waitpid(f->popen_kludge,&status,0)>=0) - return status; - return -1; -} diff --git a/mdk-stage1/dietlibc/libugly/popen.c b/mdk-stage1/dietlibc/libugly/popen.c deleted file mode 100644 index e0e441495..000000000 --- a/mdk-stage1/dietlibc/libugly/popen.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "dietstdio.h" -#include <unistd.h> - -extern char **environ; - -FILE *popen(const char *command, const char *type) { - int pfd[2]; - int fd0; - pid_t pid; - if (pipe(pfd)<0) return 0; - fd0=(*type=='r'); - if ((pid=vfork())<0) { - close(pfd[0]); - close(pfd[1]); - return 0; - } - if (!pid) { /* child */ - char *argv[]={"sh","-c",0,0}; - close(pfd[!fd0]); close(fd0); - dup2(pfd[fd0],fd0); close(pfd[fd0]); - argv[2]=(char*)command; - execve("/bin/sh",argv,environ); - _exit(255); - } - close(pfd[fd0]); - { - register FILE* f; - if ((f=fdopen(pfd[!fd0],type))) - f->popen_kludge=pid; - return f; - } -} diff --git a/mdk-stage1/dietlibc/libugly/prioritynames.c b/mdk-stage1/dietlibc/libugly/prioritynames.c deleted file mode 100644 index 87a99b76d..000000000 --- a/mdk-stage1/dietlibc/libugly/prioritynames.c +++ /dev/null @@ -1,22 +0,0 @@ -#include <sys/syslog.h> - -#ifndef INTERNAL_NOPRI -#define INTERNAL_NOPRI 0x10 -#endif - -CODE prioritynames[] = - { - { "alert", LOG_ALERT }, - { "crit", LOG_CRIT }, - { "debug", LOG_DEBUG }, - { "emerg", LOG_EMERG }, - { "err", LOG_ERR }, - { "error", LOG_ERR }, /* DEPRECATED */ - { "info", LOG_INFO }, - { "none", INTERNAL_NOPRI }, /* INTERNAL */ - { "notice", LOG_NOTICE }, - { "panic", LOG_EMERG }, /* DEPRECATED */ - { "warn", LOG_WARNING }, /* DEPRECATED */ - { "warning", LOG_WARNING }, - { 0, -1 } - }; diff --git a/mdk-stage1/dietlibc/libugly/setenv.c b/mdk-stage1/dietlibc/libugly/setenv.c deleted file mode 100644 index bf47cdb79..000000000 --- a/mdk-stage1/dietlibc/libugly/setenv.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <string.h> -#include <stdlib.h> - -#include <dietwarning.h> -link_warning("setenv","setenv calls malloc. Avoid it in small programs."); - -int setenv(const char *name, const char *value, int overwrite) { - char *c=malloc(strlen(name)+strlen(value)+3); - if (getenv(name)) { - if (!overwrite) return 0; - unsetenv(name); - } - strcpy(c,name); - strcat(c,"="); - strcat(c,value); - return putenv(c); -} diff --git a/mdk-stage1/dietlibc/libugly/setmntent.c b/mdk-stage1/dietlibc/libugly/setmntent.c deleted file mode 100644 index a91d3902b..000000000 --- a/mdk-stage1/dietlibc/libugly/setmntent.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> -#include <mntent.h> - -FILE *setmntent(const char *filename, const char *type) { - return fopen(filename,type); -} - diff --git a/mdk-stage1/dietlibc/libugly/strftime.c b/mdk-stage1/dietlibc/libugly/strftime.c deleted file mode 100644 index b7e750ab1..000000000 --- a/mdk-stage1/dietlibc/libugly/strftime.c +++ /dev/null @@ -1,182 +0,0 @@ -#include <sys/types.h> -#include <time.h> - -static char *sweekdays[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; -static char *weekdays[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; -static char *smonths[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; -static char *months[]={"January","February","March","April","May","June","July","August","September","October","November","December"}; -static char *ampm[]={"am","pm","AM","PM"}; - -static int i2a(char* dest,unsigned int x) { - register unsigned int tmp=x; - register int len=0; - *dest++=tmp/10+'0'; tmp=tmp%10; ++len; - *dest++=tmp+'0'; - return 2; -} - -static int i2as(char* dest,unsigned int x) { - int len=i2a(dest,x); - if (*dest=='0') *dest=' '; - return len; -} - -size_t strftime(char *s, size_t max, const char *format, const struct tm *tm) { - char *t=s; - const char *src; - char buf[5]; - while (*format) { - switch (*format) { - case 0: break; - case '%': - switch (*++format) { - case '%': *t='%'; ++t; break; - case 'a': src=sweekdays[tm->tm_wday]; goto append; - case 'A': src=weekdays[tm->tm_wday]; goto append; - case 'h': - case 'b': src=smonths[tm->tm_mon]; goto append; - case 'B': src=months[tm->tm_mon]; goto append; - case 'c': t+=strftime(t,max-(t-s),"%b %a %d %k:%M:%S %Z %Y",tm); break; - case 'C': buf[i2a(buf,(tm->tm_year+1900)/100)]=0; src=buf; goto append; - case 'd': buf[i2a(buf,tm->tm_mday)]=0; src=buf; goto append; - case 'e': buf[i2as(buf,tm->tm_mday)]=0; src=buf; goto append; - case 'H': buf[i2a(buf,tm->tm_hour)]=0; src=buf; goto append; - case 'I': buf[i2a(buf,tm->tm_hour%12)]=0; src=buf; goto append; - case 'j': buf[i2a(buf,tm->tm_yday)]=0; src=buf; goto append; - case 'k': buf[i2as(buf,tm->tm_hour)]=0; src=buf; goto append; - case 'l': buf[i2as(buf,tm->tm_hour%12)]=0; src=buf; goto append; - case 'm': buf[i2a(buf,tm->tm_mon+1)]=0; src=buf; goto append; - case 'M': buf[i2a(buf,tm->tm_min)]=0; src=buf; goto append; - case 'n': *t='\n'; break; - case 'p': src=ampm[tm->tm_hour>11?3:2]; goto append; - case 'P': src=ampm[tm->tm_hour>11?1:0]; goto append; - case 'r': t+=strftime(t,max-(t-s),"%I:%M:%S %p",tm); break; - case 'R': t+=strftime(t,max-(t-s),"%H:%M",tm); break; - case 'S': buf[i2a(buf,tm->tm_sec)]=0; src=buf; goto append; - case 't': *t='\t'; break; - case 'T': t+=strftime(t,max-(t-s),"%H:%M:%S",tm); break; - case 'u': buf[i2a(buf,tm->tm_wday?tm->tm_wday:7)]=0; src=buf; goto append; - case 'w': buf[i2a(buf,tm->tm_wday)]=0; src=buf; goto append; - case 'x': t+=strftime(t,max-(t-s),"%b %a %d",tm); break; - case 'X': t+=strftime(t,max-(t-s),"%k:%M:%S",tm); break; - case 'y': buf[i2a(buf,tm->tm_year%100)]=0; src=buf; goto append; - case 'Y': i2a(buf,(tm->tm_year+1900)/100); buf[i2a(buf+2,(tm->tm_year%100))+2]=0; src=buf; goto append; - case 'Z': src="GMT"; goto append; /* hehe */ -append: - while (*src && t<s+max) { *t=*src; ++t; ++src; } - }; - break; - default: - *t=*format; ++t; - } - ++format; - if (t>=s+max) break; - continue; - } - *t=0; return t-s; -} - - - -/* - %u The day of the week as a decimal, range 1 to 7, - Monday being 1. See also %w. (SU) - - %U The week number of the current year as a decimal - number, range 00 to 53, starting with the first - Sunday as the first day of week 01. See also %V and - %W. - - %V The ISO 8601:1988 week number of the current year - as a decimal number, range 01 to 53, where week 1 - is the first week that has at least 4 days in the - current year, and with Monday as the first day of - the week. See also %U and %W. (SU) - - %w The day of the week as a decimal, range 0 to 6, - Sunday being 0. See also %u. - - %W The week number of the current year as a decimal - number, range 00 to 53, starting with the first - Monday as the first day of week 01. - - %x The preferred date representation for the current - locale without the time. - - %X The preferred time representation for the current - locale without the date. - - %y The year as a decimal number without a century - (range 00 to 99). - - %Y The year as a decimal number including the century. - - %z The time-zone as hour offset from GMT. Required to - emit RFC822-conformant dates (using "%a, %d %b %Y - %H:%M:%S %z"). (GNU) - - %Z The time zone or name or abbreviation. - - %+ The date and time in date(1) format. (TZ) - - %% A literal `%' character. - - Some conversion specifiers can be modified by preceding - them by the E or O modifier to indicate that an alterna - tive format should be used. If the alternative format or - specification does not exist for the current locale, the - behaviour will be as if the unmodified conversion specifi - cation were used. (SU) The Single Unix Specification men - tions %Ec, %EC, %Ex, %EX, %Ry, %EY, %Od, %Oe, %OH, %OI, - %Om, %OM, %OS, %Ou, %OU, %OV, %Ow, %OW, %Oy, where the - effect of the O modifier is to use alternative numeric - symbols (say, roman numerals), and that of the E modifier - - - -GNU 29 March 1999 3 - - - - - -STRFTIME(3) Linux Programmer's Manual STRFTIME(3) - - - is to use a locale-dependent alternative representation. - - The broken-down time structure tm is defined in <time.h>. - See also ctime(3). - - -RETURN VALUE - The strftime() function returns the number of characters - placed in the array s, not including the terminating NUL - character, provided the string, including the terminating - NUL, fits. Otherwise, it returns 0, and the contents of - the array is undefined. (Thus at least since libc 4.4.4; - very old versions of libc, such as libc 4.4.1, would - return max if the array was too small.) - - Note that the return value 0 does not necessarily indicate - an error; for example, in many locales %p yields an empty - string. - -ENVIRONMENT - The environment variables TZ and LC_TIME are used. - -CONFORMING TO - ANSI C, SVID 3, ISO 9899. There are strict inclusions - between the set of conversions given in ANSI C (unmarked), - those given in the Single Unix Specification (marked SU), - those given in Olson's timezone package (marked TZ), and - those given in glibc (marked GNU), except that %+ is not - supported in glibc2. On the other hand glibc2 has several - more extensions. POSIX.1 only refers to ANSI C; POSIX.2 - describes under date(1) several extensions that could - apply to strftime as well. - -SEE ALSO - date(1), time(2), ctime(3), setlocale(3), sprintf(3) - -*/ diff --git a/mdk-stage1/dietlibc/libugly/strsignal.c b/mdk-stage1/dietlibc/libugly/strsignal.c deleted file mode 100644 index 54314d2c7..000000000 --- a/mdk-stage1/dietlibc/libugly/strsignal.c +++ /dev/null @@ -1,92 +0,0 @@ -#include <signal.h> -/* F....ng Kernel haeder is damn broken... */ -#ifndef _NSIG -#define _NSIG 64 -#endif -#include <asm/signal.h> - -char * strsignal(int sig) { - if (sig==SIGHUP) - return "Hangup"; - else if (sig==SIGINT) - return "Interrupt"; - else if (sig==SIGQUIT) - return "Quit"; - else if (sig==SIGILL) - return "Illegal instruction"; - else if (sig==SIGTRAP) - return "Trace/breakpoint trap"; - else if (sig==SIGABRT) - return "Aborted"; - else if (sig==SIGFPE) - return "Floating point exception"; - else if (sig==SIGKILL) - return "Killed"; - else if (sig==SIGBUS) - return "Bus error"; - else if (sig==SIGSEGV) - return "Segmentation fault"; - else if (sig==SIGPIPE) - return "Broken pipe"; - else if (sig==SIGALRM) - return "Alarm clock"; - else if (sig==SIGTERM) - return "Terminated"; - else if (sig==SIGURG) - return "Urgent I/O condition"; - else if (sig==SIGSTOP) - return "Stopped (signal)"; - else if (sig==SIGTSTP) - return "Stopped"; - else if (sig==SIGCONT) - return "Continue"; - else if (sig==SIGCHLD) - return "Child exited"; - else if (sig==SIGTTIN) - return "Stopped (tty input)"; - else if (sig==SIGTTOU) - return "Stopped (tty output)"; - else if (sig==SIGIO) - return "I/O possible"; - else if (sig==SIGXCPU) - return "CPU time limit exceeded"; - else if (sig==SIGXFSZ) - return "File size limit exceeded"; - else if (sig==SIGVTALRM) - return "Virtual timer expired"; - else if (sig==SIGPROF) - return "Profiling timer expired"; - else if (sig==SIGWINCH) - return "Window changed"; - else if (sig==SIGUSR1) - return "User defined signal 1"; - else if (sig==SIGUSR2) - return "User defined signal 1"; -#ifdef SIGEMT - else if (sig==SIGEMT) - return "EMT trap"; -#endif -#ifdef SIGSYS - else if (sig==SIGSYS) - return "Bad system call"; -#endif -#ifdef SIGSTKFLT - else if (sig==SIGSTKFLT) - return "Stack fault"; -#endif -#ifdef SIGINFO - else if (sig==SIGINFO) - return "Information request"; -#elif defined(SIGPWR) && (!defined(SIGLOST) || (SIGPWR!=SIGLOST)) - else if (sig==SIGPWR) - return "Power falure"; -#endif -#ifdef SIGLOST - else if (sig==SIGLOST) - return "Resource lost"; -#endif - else if ((sig>=SIGRTMIN)&&(sig<=SIGRTMAX)) - return "Real time signal"; - else - return "(unknown signal)"; -} diff --git a/mdk-stage1/dietlibc/libugly/system.c b/mdk-stage1/dietlibc/libugly/system.c deleted file mode 100644 index b9eea20eb..000000000 --- a/mdk-stage1/dietlibc/libugly/system.c +++ /dev/null @@ -1,69 +0,0 @@ -#include <signal.h> -#include <asm/errno.h> -#include <errno.h> -#include <unistd.h> -#include "dietwarning.h" - -#define SHELL_PATH "/bin/sh" /* Path of the shell. */ -#define SHELL_NAME "sh" /* Name to give it. */ - -extern char **environ; - -int __libc_fork(); -int __libc_waitpid(int pid, int *status, int options); -int execve(const char*filename, char *const argv[], char *const envp[]); -void __set_errno(int errno); -int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); - -int __libc_system (const char *line) -{ - struct sigaction sa, intr, quit; - int save,pid,ret=-1; - - if (line == 0) return __libc_system("exit 0") == 0; - - sa.sa_handler = SIG_IGN; - sa.sa_flags = 0; - sigemptyset (&sa.sa_mask); - - if (sigaction(SIGINT, &sa, &intr)<0) return -1; - if (sigaction(SIGQUIT, &sa, &quit)<0) { - save = errno; - sigaction (SIGINT, &intr, (struct sigaction*)0); - __set_errno (save); - return -1; - } - - pid=__libc_fork(); - if (pid>0) - { /* parent */ - int n; - do - n=__libc_waitpid(pid, &ret, 0); - while ((n==-1) && (errno==EINTR)); - if (n!=pid) ret=-1; - } - else if (!pid) - { /* child */ - const char *nargs[4]; - nargs[0] = SHELL_NAME; - nargs[1] = "-c"; - nargs[2] = line; - nargs[3] = 0; - - sigaction(SIGINT, &intr, (struct sigaction*)0); - sigaction(SIGQUIT, &quit, (struct sigaction*)0); - - execve(SHELL_PATH,(char *const *)nargs, environ); - _exit(127); - } - save = errno; - sigaction (SIGINT, &intr, (struct sigaction *)0); - sigaction (SIGQUIT, &quit, (struct sigaction *)0); - __set_errno(save); - return ret; -} - -int system (const char *line) __attribute__((weak,alias("__libc_system"))); - -link_warning("system","warning: system() is a security risk. Use fork and execvp instead!") diff --git a/mdk-stage1/dietlibc/libugly/time_table_spd.c b/mdk-stage1/dietlibc/libugly/time_table_spd.c deleted file mode 100644 index bfe1cf86d..000000000 --- a/mdk-stage1/dietlibc/libugly/time_table_spd.c +++ /dev/null @@ -1,17 +0,0 @@ - -/* seconds per month -- nonleap! */ -const unsigned int __spm[12] = - { 0, - (31), - (31+28), - (31+28+31), - (31+28+31+30), - (31+28+31+30+31), - (31+28+31+30+31+30), - (31+28+31+30+31+30+31), - (31+28+31+30+31+30+31+31), - (31+28+31+30+31+30+31+31+30), - (31+28+31+30+31+30+31+31+30+31), - (31+28+31+30+31+30+31+31+30+31+30), - }; - diff --git a/mdk-stage1/dietlibc/libugly/tzfile.c b/mdk-stage1/dietlibc/libugly/tzfile.c deleted file mode 100644 index 5702d4bea..000000000 --- a/mdk-stage1/dietlibc/libugly/tzfile.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "dietfeatures.h" -#include <unistd.h> -#include <fcntl.h> -#include <sys/mman.h> -#include <netinet/in.h> - -#include <stdio.h> - -#ifdef WANT_TZFILE_PARSER -static char *tzfile=0; -static int tzlen=-1; - -void __maplocaltime() { - int fd; - unsigned int len; - if (tzlen>=0) return; - tzlen=0; - if ((fd=open("/etc/localtime",O_RDONLY))<0) return; - len=lseek(fd,0,SEEK_END); - if ((tzfile=mmap(0,len,PROT_READ,MAP_SHARED,fd,0))==MAP_FAILED) return; - close(fd); - if (ntohl(*(int*)tzfile) != 0x545a6966) return; - tzlen=len; -} - -char *tzset(void) __attribute__((weak,alias("__maplocaltime"))); - -static unsigned long __myntohl(const unsigned char* c) { - return (((unsigned long)c[0])<<24) + - (((unsigned long)c[1])<<16) + - (((unsigned long)c[2])<<8) + - ((unsigned long)c[3]); -} - -time_t __tzfile_map(time_t t, int *isdst) { - /* "TZif" plus 16 reserved bytes. */ - char *tmp; - int i; - int tzh_ttisgmtcnt, tzh_ttisstdcnt, tzh_leapcnt, tzh_timecnt, tzh_typecnt, tzh_charcnt; - *isdst=0; - if (!tzfile) return t; - tzh_ttisgmtcnt=ntohl(*(int*)(tzfile+20)); - tzh_ttisstdcnt=ntohl(*(int*)(tzfile+24)); - tzh_leapcnt=ntohl(*(int*)(tzfile+28)); - tzh_timecnt=ntohl(*(int*)(tzfile+32)); - tzh_typecnt=ntohl(*(int*)(tzfile+36)); - tzh_charcnt=ntohl(*(int*)(tzfile+40)); - -#if 0 - tmp=tzfile+20+6*4; - printf("ttisgmtcnt %d ttisstdcnt %d leapcnt %d timecnt %d typecnt %d charcnt %d\n",tzh_ttisgmtcnt,tzh_ttisstdcnt, tzh_leapcnt, tzh_timecnt, tzh_typecnt, tzh_charcnt); - printf("transition times: "); - for (i=0; i<tzh_timecnt; ++i) { - printf("%s%lu",i?", ":"",ntohl(*(int*)tmp)); tmp+=4; - } - printf("\n"); - printf("indices: "); - for (i=0; i<tzh_timecnt; ++i) { - printf("%s%d",i?", ":"",*tmp); ++tmp; - } - printf("\n"); - printf("transition times: "); - for (i=0; i<tzh_typecnt; ++i) { - printf("%s(%lu,%d,%d)",i?", ":"",ntohl(*(int*)tmp),tmp[4],tmp[5]); tmp+=6; - } - printf("\n"); -#endif - - tmp=tzfile+20+6*4; - for (i=0; i<tzh_timecnt; ++i) - if ((time_t)__myntohl(tmp+i*4) >= t) { -/* printf("match at %d\n",i); */ - tmp+=tzh_timecnt*4; - i=tmp[i-1]; -/* printf("using index %d\n",i); */ - tmp+=tzh_timecnt; - tmp+=i*6; -/* printf("(%lu,%d,%d)\n",ntohl(*(int*)tmp),tmp[4],tmp[5]); */ - *isdst=tmp[4]; - return t+__myntohl(tmp); - } - return t; -} -#else -void tzset(void) __attribute__((weak,alias("return0"))); -#endif diff --git a/mdk-stage1/dietlibc/libugly/unsetenv.c b/mdk-stage1/dietlibc/libugly/unsetenv.c deleted file mode 100644 index 46e880271..000000000 --- a/mdk-stage1/dietlibc/libugly/unsetenv.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdlib.h> - -void unsetenv(const char *name) { - putenv(name); -} - diff --git a/mdk-stage1/dietlibc/ppc/Makefile.add b/mdk-stage1/dietlibc/ppc/Makefile.add deleted file mode 100644 index 641cf1ade..000000000 --- a/mdk-stage1/dietlibc/ppc/Makefile.add +++ /dev/null @@ -1,3 +0,0 @@ - -CFLAGS+=-mpowerpc-gpopt -mpowerpc-gfxopt -Os -VPATH:=ppc:syscalls.s:$(VPATH) diff --git a/mdk-stage1/dietlibc/ppc/__longjmp.S b/mdk-stage1/dietlibc/ppc/__longjmp.S deleted file mode 100644 index 8113eeeea..000000000 --- a/mdk-stage1/dietlibc/ppc/__longjmp.S +++ /dev/null @@ -1,59 +0,0 @@ -#include <setjmp.h> - - -#ifdef PIC -#define JUMPTARGET(name) name##@plt -#else -#define JUMPTARGET(name) name -#endif - -.global __longjmp -.type __longjmp,@function -.align 2 -__longjmp: - lwz 1,(JB_GPR1*4)(3) - lwz 2,(JB_GPR2*4)(3) - lwz 0,(JB_LR*4)(3) - lwz 14,((JB_GPRS+0)*4)(3) - lfd 14,((JB_FPRS+0*2)*4)(3) - lwz 15,((JB_GPRS+1)*4)(3) - lfd 15,((JB_FPRS+1*2)*4)(3) - lwz 16,((JB_GPRS+2)*4)(3) - lfd 16,((JB_FPRS+2*2)*4)(3) - lwz 17,((JB_GPRS+3)*4)(3) - lfd 17,((JB_FPRS+3*2)*4)(3) - lwz 18,((JB_GPRS+4)*4)(3) - lfd 18,((JB_FPRS+4*2)*4)(3) - lwz 19,((JB_GPRS+5)*4)(3) - lfd 19,((JB_FPRS+5*2)*4)(3) - lwz 20,((JB_GPRS+6)*4)(3) - lfd 20,((JB_FPRS+6*2)*4)(3) - mtlr 0 - lwz 21,((JB_GPRS+7)*4)(3) - lfd 21,((JB_FPRS+7*2)*4)(3) - lwz 22,((JB_GPRS+8)*4)(3) - lfd 22,((JB_FPRS+8*2)*4)(3) - lwz 0,(JB_CR*4)(3) - lwz 23,((JB_GPRS+9)*4)(3) - lfd 23,((JB_FPRS+9*2)*4)(3) - lwz 24,((JB_GPRS+10)*4)(3) - lfd 24,((JB_FPRS+10*2)*4)(3) - lwz 25,((JB_GPRS+11)*4)(3) - lfd 25,((JB_FPRS+11*2)*4)(3) - mtcrf 0xFF,0 - lwz 26,((JB_GPRS+12)*4)(3) - lfd 26,((JB_FPRS+12*2)*4)(3) - lwz 27,((JB_GPRS+13)*4)(3) - lfd 27,((JB_FPRS+13*2)*4)(3) - lwz 28,((JB_GPRS+14)*4)(3) - lfd 28,((JB_FPRS+14*2)*4)(3) - lwz 29,((JB_GPRS+15)*4)(3) - lfd 29,((JB_FPRS+15*2)*4)(3) - lwz 30,((JB_GPRS+16)*4)(3) - lfd 30,((JB_FPRS+16*2)*4)(3) - lwz 31,((JB_GPRS+17)*4)(3) - lfd 31,((JB_FPRS+17*2)*4)(3) - mr 3,4 - blr -.size __longjmp,.-__longjmp - diff --git a/mdk-stage1/dietlibc/ppc/__testandset.S b/mdk-stage1/dietlibc/ppc/__testandset.S deleted file mode 100644 index a6063fbb2..000000000 --- a/mdk-stage1/dietlibc/ppc/__testandset.S +++ /dev/null @@ -1,11 +0,0 @@ -.global __testandset -.type __testandset,@function -.align 2 -__testandset: - lwarx 5,0,3 - add 0,4,5 - stwcx 0,0,3 - bne __testandset - blr -.size __testandset,.-__testandset - diff --git a/mdk-stage1/dietlibc/ppc/mmap.c b/mdk-stage1/dietlibc/ppc/mmap.c deleted file mode 100644 index 25d2926b2..000000000 --- a/mdk-stage1/dietlibc/ppc/mmap.c +++ /dev/null @@ -1,37 +0,0 @@ -#include <linux/types.h> -#include <linux/unistd.h> - -int mmap(void*start,size_t length,int prot,int flags,int fd,off_t offset) { - unsigned long __sc_ret, __sc_err; - { - register unsigned long __sc_0 __asm__ ("r0"); - register unsigned long __sc_3 __asm__ ("r3"); - register unsigned long __sc_4 __asm__ ("r4"); - register unsigned long __sc_5 __asm__ ("r5"); - register unsigned long __sc_6 __asm__ ("r6"); - register unsigned long __sc_7 __asm__ ("r7"); - register unsigned long __sc_8 __asm__ ("r8"); - - __sc_3 = (unsigned long) (start); - __sc_4 = (unsigned long) (length); - __sc_5 = (unsigned long) (prot); - __sc_6 = (unsigned long) (flags); - __sc_7 = (unsigned long) (fd); - __sc_8 = (unsigned long) (offset); - __sc_0 = __NR_mmap; - __asm__ __volatile__ - ("sc \n\t" - "mfcr %1 " - : "=&r" (__sc_3), "=&r" (__sc_0) - : "0" (__sc_3), "1" (__sc_0), - "r" (__sc_4), - "r" (__sc_5), - "r" (__sc_6), - "r" (__sc_7), - "r" (__sc_8) - : __syscall_clobbers); - __sc_ret = __sc_3; - __sc_err = __sc_0; - } - __syscall_return (int); -} diff --git a/mdk-stage1/dietlibc/ppc/setjmp.S b/mdk-stage1/dietlibc/ppc/setjmp.S deleted file mode 100644 index 50fa2bdd4..000000000 --- a/mdk-stage1/dietlibc/ppc/setjmp.S +++ /dev/null @@ -1,56 +0,0 @@ -#include <setjmp.h> - -#ifdef PIC -#define JUMPTARGET(name) name##@plt -#else -#define JUMPTARGET(name) name -#endif - -.global __sigsetjmp -.type __sigsetjmp,@function -.align 2 -__sigsetjmp: - stw 1,(JB_GPR1*4)(3) - mflr 0 - stw 2,(JB_GPR2*4)(3) - stw 14,((JB_GPRS+0)*4)(3) - stfd 14,((JB_FPRS+0*2)*4)(3) - stw 0,(JB_LR*4)(3) - stw 15,((JB_GPRS+1)*4)(3) - stfd 15,((JB_FPRS+1*2)*4)(3) - mfcr 0 - stw 16,((JB_GPRS+2)*4)(3) - stfd 16,((JB_FPRS+2*2)*4)(3) - stw 0,(JB_CR*4)(3) - stw 17,((JB_GPRS+3)*4)(3) - stfd 17,((JB_FPRS+3*2)*4)(3) - stw 18,((JB_GPRS+4)*4)(3) - stfd 18,((JB_FPRS+4*2)*4)(3) - stw 19,((JB_GPRS+5)*4)(3) - stfd 19,((JB_FPRS+5*2)*4)(3) - stw 20,((JB_GPRS+6)*4)(3) - stfd 20,((JB_FPRS+6*2)*4)(3) - stw 21,((JB_GPRS+7)*4)(3) - stfd 21,((JB_FPRS+7*2)*4)(3) - stw 22,((JB_GPRS+8)*4)(3) - stfd 22,((JB_FPRS+8*2)*4)(3) - stw 23,((JB_GPRS+9)*4)(3) - stfd 23,((JB_FPRS+9*2)*4)(3) - stw 24,((JB_GPRS+10)*4)(3) - stfd 24,((JB_FPRS+10*2)*4)(3) - stw 25,((JB_GPRS+11)*4)(3) - stfd 25,((JB_FPRS+11*2)*4)(3) - stw 26,((JB_GPRS+12)*4)(3) - stfd 26,((JB_FPRS+12*2)*4)(3) - stw 27,((JB_GPRS+13)*4)(3) - stfd 27,((JB_FPRS+13*2)*4)(3) - stw 28,((JB_GPRS+14)*4)(3) - stfd 28,((JB_FPRS+14*2)*4)(3) - stw 29,((JB_GPRS+15)*4)(3) - stfd 29,((JB_FPRS+15*2)*4)(3) - stw 30,((JB_GPRS+16)*4)(3) - stfd 30,((JB_FPRS+16*2)*4)(3) - stw 31,((JB_GPRS+17)*4)(3) - stfd 31,((JB_FPRS+17*2)*4)(3) - b JUMPTARGET (__sigjmp_save) -.size __sigsetjmp,.-__sigsetjmp diff --git a/mdk-stage1/dietlibc/ppc/start.S b/mdk-stage1/dietlibc/ppc/start.S deleted file mode 100644 index c7afeecd2..000000000 --- a/mdk-stage1/dietlibc/ppc/start.S +++ /dev/null @@ -1,44 +0,0 @@ -#include "start.h" - -#ifdef __powerpc__ - -.text -.global _start -.type _start,@function -_start: - /* Save the stack pointer, in case we're statically linked under Linux. */ - mr 9,1 - /* Set up an initial stack frame, and clear the LR. */ - clrrwi 1,1,4 - li 0,0 - stwu 1,-16(1) - mtlr 0 - stw 0,0(1) - - /* r9 enthält den initialen Stackpointer. - argc = (r9) - argv = (r9+4) - envp = argv+(argc+1)*4 */ - - lwzu 3,0(9) /* argc */ - addi 4,9,4 /* argv */ - add 5,0,3 /* argc... */ - addi 5,5,1 /* argc+1...*/ - slwi 5,5,2 /* (argc+1)*4 */ - add 5,5,4 /* argv+(argc+1)*4 */ - - lis 6,environ@ha - stw 5,environ@l(6) - - bl main - b exit -.size _start,.-_start - - -/* Define a symbol for the first piece of initialized data. */ - .section ".data" -__data_start: - - -#endif - diff --git a/mdk-stage1/dietlibc/ppc/unified.S b/mdk-stage1/dietlibc/ppc/unified.S deleted file mode 100644 index d2b419f0b..000000000 --- a/mdk-stage1/dietlibc/ppc/unified.S +++ /dev/null @@ -1,21 +0,0 @@ -#include <dietfeatures.h> - -.text -.global __unified_syscall -__unified_syscall: - sc - mfcr 0 - andis. 9,0,4096 - mr 0,3 - beq .L1 -#ifdef WANT_THREAD_SAVE - bl __set_errno -#else - lis 9,errno@ha - stw 3,errno@l(9) -#endif - li 0,-1 -.L1: - mr 3,0 - blr - diff --git a/mdk-stage1/dietlibc/sparc/Makefile.add b/mdk-stage1/dietlibc/sparc/Makefile.add deleted file mode 100644 index 0de05b1db..000000000 --- a/mdk-stage1/dietlibc/sparc/Makefile.add +++ /dev/null @@ -1,3 +0,0 @@ - -CFLAGS+=-mcpu=supersparc -Os -VPATH:=sparc:syscalls.s:$(VPATH) diff --git a/mdk-stage1/dietlibc/sparc/__longjmp.S b/mdk-stage1/dietlibc/sparc/__longjmp.S deleted file mode 100644 index 72e001a2f..000000000 --- a/mdk-stage1/dietlibc/sparc/__longjmp.S +++ /dev/null @@ -1,67 +0,0 @@ -#include <setjmp.h> - -#define JB_SP 0 -#define JB_FP 1 -#define JB_PC 2 - -#define ENV(base,reg) [%base + (reg * 4)] -#define ST_FLUSH_WINDOWS 3 -#define RW_FP [%fp + 0x48] - -.text -.global __longjmp -__longjmp: - /* Store our arguments in global registers so we can still - use them while unwinding frames and their register windows. */ - - ld ENV(o0,JB_FP), %g3 /* Cache target FP in register %g3. */ - mov %o0, %g1 /* ENV in %g1 */ - orcc %o1, %g0, %g2 /* VAL in %g2 */ - be,a 0f /* Branch if zero; else skip delay slot. */ - mov 1, %g2 /* Delay slot only hit if zero: VAL = 1. */ -0: - xor %fp, %g3, %o0 - add %fp, 512, %o1 - andncc %o0, 4095, %o0 - bne .Lthread - cmp %o1, %g3 - bl .Lthread - - /* Now we will loop, unwinding the register windows up the stack - until the restored %fp value matches the target value in %g3. */ - -.Lloop: - cmp %fp, %g3 /* Have we reached the target frame? */ - bl,a .Lloop /* Loop while current fp is below target. */ - restore /* Unwind register window in delay slot. */ - be,a .Lfound /* Better have hit it exactly. */ - ld ENV(g1,JB_SP), %o0 /* Delay slot: extract target SP. */ - -.Lthread: - /* - * Do a "flush register windows trap". The trap handler in the - * kernel writes all the register windows to their stack slots, and - * marks them all as invalid (needing to be sucked up from the - * stack when used). This ensures that all information needed to - * unwind to these callers is in memory, not in the register - * windows. - */ - ta ST_FLUSH_WINDOWS - ld ENV(g1,JB_PC), %o7 /* Set return PC. */ - ld ENV(g1,JB_SP), %fp /* Set saved SP on restore below. */ - sub %fp, 64, %sp /* Allocate a register frame. */ - st %g3, RW_FP /* Set saved FP on restore below. */ - retl - restore %g2, 0, %o0 /* Restore values from above register frame. */ - -.Lfound: - /* We have unwound register windows so %fp matches the target. */ - mov %o0, %sp /* OK, install new SP. */ - -.Lsp_ok: - ld ENV(g1,JB_PC), %o0 /* Extract target return PC. */ - jmp %o0 + 8 /* Return there. */ - mov %g2, %o0 /* Delay slot: set return value. */ - -.size __longjmp, . - __longjmp - diff --git a/mdk-stage1/dietlibc/sparc/__testandset.S b/mdk-stage1/dietlibc/sparc/__testandset.S deleted file mode 100644 index 84f6cf597..000000000 --- a/mdk-stage1/dietlibc/sparc/__testandset.S +++ /dev/null @@ -1,6 +0,0 @@ -.text -.align 4 -.global __testandset -__testandset: - retl - ldstub [%o0], %o0 diff --git a/mdk-stage1/dietlibc/sparc/clone.S b/mdk-stage1/dietlibc/sparc/clone.S deleted file mode 100644 index 58b438249..000000000 --- a/mdk-stage1/dietlibc/sparc/clone.S +++ /dev/null @@ -1,45 +0,0 @@ -#include <asm/errno.h> -#include <asm/unistd.h> - -.text -.align 4 -.weak clone -clone: -.global __clone -__clone: - save %sp, -96, %sp - - tst %i0 /* check for function pointer */ - be .Lerror - tst %i1 /* check for stack pointer */ - be .Lerror - nop - - mov %i1, %o1 /* child-stack */ - mov %i2, %o0 /* clone-flags */ - mov __NR_clone, %g1 - ta 0x10 /* syscall: clone */ - bcs .Lerror - - tst %o1 - bne .Lstart /* we are the child :) */ - nop - mov %o0, %i0 /* return child pid */ - ret - restore - -.Lerror: - call __errno_location - nop - mov EINVAL, %l0 - st %l0, [%o0] - ret - restore %g0, -1, %o0 - -.Lstart: - call %i0 /* call child-function */ - mov %i3, %o0 /* put arg in the right place for the child */ - - call _exit /* child returned */ - nop - diff --git a/mdk-stage1/dietlibc/sparc/fork.S b/mdk-stage1/dietlibc/sparc/fork.S deleted file mode 100644 index 869c9b30c..000000000 --- a/mdk-stage1/dietlibc/sparc/fork.S +++ /dev/null @@ -1,25 +0,0 @@ -#include "syscalls.h" - -.text -.weak fork -fork: -.global __libc_fork -__libc_fork: - mov 2, %g1 - ta 0x10 - bcc,a 1f - nop - save %sp, -96, %sp -#ifdef WANT_THREAD_SAVE - call __errno_location - nop -#else - sethi %hi(errno), %o0 - or %o0, %lo(errno), %o0 -#endif - st %i0, [ %o0 ] - retl - restore %g0, -1, %o0 -1: dec %o1 - retl - and %o0, %o1, %o0 diff --git a/mdk-stage1/dietlibc/sparc/mmap.c b/mdk-stage1/dietlibc/sparc/mmap.c deleted file mode 100644 index 25ebdc24e..000000000 --- a/mdk-stage1/dietlibc/sparc/mmap.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <linux/types.h> -#include <linux/unistd.h> - -#define __SYSCALL_STRING \ - "ta 0x10;" \ - "bcs 2f;" \ - " nop;" \ - "1:" \ - ".subsection 2;" \ - "2:" \ - "save %%sp, -192, %%sp;" \ - "call __errno_location;" \ - " nop;" \ - "st %%i0,[%%o0];" \ - "ba 1b;" \ - " restore %%g0, -1, %%o0;" \ - ".previous;" - -#define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g7", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ - "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ - "cc", "memory" - -#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ -({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __o5 __asm__ ("o5") = (long)(arg6); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ - __asm__ (__SYSCALL_STRING : "=r" (__g1), "=r" (__o0) : \ - "0" (__g1), "1" (__o0), "r" (__o1), "r" (__o2), \ - "r" (__o3), "r" (__o4), "r" (__o5) : \ - __SYSCALL_CLOBBERS); \ - __o0; \ -}) -int mmap(void*start,size_t length,int prot,int flags,int fd,off_t offset) { - return inline_syscall6(mmap,start,length,prot,flags,fd,offset); -} diff --git a/mdk-stage1/dietlibc/sparc/pipe.S b/mdk-stage1/dietlibc/sparc/pipe.S deleted file mode 100644 index 820da2570..000000000 --- a/mdk-stage1/dietlibc/sparc/pipe.S +++ /dev/null @@ -1,26 +0,0 @@ -#include "syscalls.h" - -.text -.global pipe -pipe: - mov %o0, %o2 - mov __NR_pipe, %g1 - ta 0x10 - bcc,a 1f - nop - save %sp, -96, %sp -#ifdef WANT_THREAD_SAVE - call __errno_location - nop -#else - sethi %hi(errno), %o0 - or %o0, %lo(errno), %o0 -#endif - st %i0, [ %o0 ] - ret - restore %g0, -1, %o0 - -1: st %o0, [ %o2 ] - st %o1, [ %o2 + 4 ] - retl - mov %g0, %o0 diff --git a/mdk-stage1/dietlibc/sparc/setjmp.S b/mdk-stage1/dietlibc/sparc/setjmp.S deleted file mode 100644 index efc5a7013..000000000 --- a/mdk-stage1/dietlibc/sparc/setjmp.S +++ /dev/null @@ -1,37 +0,0 @@ -#include <setjmp.h> - -#define JB_SP 0 -#define JB_FP 1 -#define JB_PC 2 - -#define ST_FLUSH_WINDOWS 0x03 - -.section .rodata -.text -.globl __setjmp -__setjmp: - b 1f - set 0, %o1 -.size __setjmp,.-__setjmp - -.globl setjmp -setjmp: - set 1, %o1 -.size setjmp,.-setjmp - -.globl __sigsetjmp -__sigsetjmp: -1: - /* Save our PC, SP and FP. Save the signal mask if requested with - a tail-call for simplicity; it always returns zero. */ - ta ST_FLUSH_WINDOWS - - st %o7, [%o0 + (JB_PC * 4)] - st %sp, [%o0 + (JB_SP * 4)] - st %fp, [%o0 + (JB_FP * 4)] - - mov %o7, %g1 - call __sigjmp_save - mov %g1, %o7 -.size __sigsetjmp,.-__sigsetjmp - diff --git a/mdk-stage1/dietlibc/sparc/shmat.c b/mdk-stage1/dietlibc/sparc/shmat.c deleted file mode 100644 index 73b2d89a9..000000000 --- a/mdk-stage1/dietlibc/sparc/shmat.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <asm/ipc.h> - -extern void* __ipc(); - -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 -#endif - -void* shmat(int shmid,const void* shmaddr,int shmflg) { - void* raddr; - register void* result; - result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); - if ((unsigned long)result <= -(unsigned long)PAGE_SIZE) - result=raddr; - return result; -} diff --git a/mdk-stage1/dietlibc/sparc/start.S b/mdk-stage1/dietlibc/sparc/start.S deleted file mode 100644 index e948aaddc..000000000 --- a/mdk-stage1/dietlibc/sparc/start.S +++ /dev/null @@ -1,46 +0,0 @@ -#include "start.h" - -#ifdef __sparc__ - .section ".text" - .align 4 - .global _start - .type _start,@function -_start: - - /* Terminate the stack frame, and reserve space for functions to - drop their arguments. */ - mov %g0, %fp - sub %sp, 6*4, %sp - - /* Extract the arguments and environment as encoded on the stack. The - argument info starts after one register window (16 words) past the SP. */ - ld [%sp+22*4], %o0 - add %sp, 23*4, %o1 - add %o1, %o0, %o2 - add %o2, %o0, %o2 - add %o2, %o0, %o2 - add %o2, %o0, %o2 - add %o2, 4, %o2 - - sethi %hi(environ), %o3 - or %o3, %lo(environ), %o3 - st %o2, [%o3] - - /* When starting a binary via the dynamic linker, %g1 contains the - address of the shared library termination function, which will be - registered with atexit(). If we are statically linked, this will - be NULL. */ - - /* Let libc do the rest of the initialization, and call main. */ - call main - mov %g1, %o5 - - b exit - mov %o0, %i0 - - /* Die very horribly if exit returns. */ - unimp - - .size _start, .-_start -#endif - diff --git a/mdk-stage1/dietlibc/sparc/udiv.S b/mdk-stage1/dietlibc/sparc/udiv.S deleted file mode 100644 index 87479e7bd..000000000 --- a/mdk-stage1/dietlibc/sparc/udiv.S +++ /dev/null @@ -1,363 +0,0 @@ -#ifdef __sparc__ - /* This file is generated from divrem.m4; DO NOT EDIT! */ -/* - * Division and remainder, from Appendix E of the Sparc Version 8 - * Architecture Manual, with fixes from Gordon Irlam. - */ - -/* - * Input: dividend and divisor in %o0 and %o1 respectively. - * - * m4 parameters: - * .udiv name of function to generate - * div div=div => %o0 / %o1; div=rem => %o0 % %o1 - * false false=true => signed; false=false => unsigned - * - * Algorithm parameters: - * N how many bits per iteration we try to get (4) - * WORDSIZE total number of bits (32) - * - * Derived constants: - * TOPBITS number of bits in the top decade of a number - * - * Important variables: - * Q the partial quotient under development (initially 0) - * R the remainder so far, initially the dividend - * ITER number of main division loop iterations required; - * equal to ceil(log2(quotient) / N). Note that this - * is the log base (2^N) of the quotient. - * V the current comparand, initially divisor*2^(ITER*N-1) - * - * Cost: - * Current estimate for non-large dividend is - * ceil(log2(quotient) / N) * (10 + 7N/2) + C - * A large dividend is one greater than 2^(31-TOPBITS) and takes a - * different path, as the upper bits of the quotient must be developed - * one bit at a time. - */ - - - -#define C_LABEL(name) name: - -#define C_SYMBOL_NAME(name) name - -#define ENTRY(name) \ - .global C_SYMBOL_NAME(name); \ - .align 4;\ - C_LABEL(name);\ - .type name,@function; - -#define LOC(name) . ## L ## name - -#define END(name) \ - .size name, . - name - -#define ST_DIV0 0x02 - -ENTRY(.udiv) - - ! Ready to divide. Compute size of quotient; scale comparand. - orcc %o1, %g0, %o5 - bne 1f - mov %o0, %o3 - - ! Divide by zero trap. If it returns, return 0 (about as - ! wrong as possible, but that is what SunOS does...). - ta ST_DIV0 - retl - clr %o0 - -1: - cmp %o3, %o5 ! if %o1 exceeds %o0, done - blu LOC(got_result) ! (and algorithm fails otherwise) - clr %o2 - sethi %hi(1 << (32 - 4 - 1)), %g1 - cmp %o3, %g1 - blu LOC(not_really_big) - clr %o4 - - ! Here the dividend is >= 2**(31-N) or so. We must be careful here, - ! as our usual N-at-a-shot divide step will cause overflow and havoc. - ! The number of bits in the result here is N*ITER+SC, where SC <= N. - ! Compute ITER in an unorthodox manner: know we need to shift V into - ! the top decade: so do not even bother to compare to R. - 1: - cmp %o5, %g1 - bgeu 3f - mov 1, %g2 - sll %o5, 4, %o5 - b 1b - add %o4, 1, %o4 - - ! Now compute %g2. - 2: addcc %o5, %o5, %o5 - bcc LOC(not_too_big) - add %g2, 1, %g2 - - ! We get here if the %o1 overflowed while shifting. - ! This means that %o3 has the high-order bit set. - ! Restore %o5 and subtract from %o3. - sll %g1, 4, %g1 ! high order bit - srl %o5, 1, %o5 ! rest of %o5 - add %o5, %g1, %o5 - b LOC(do_single_div) - sub %g2, 1, %g2 - - LOC(not_too_big): - 3: cmp %o5, %o3 - blu 2b - nop - be LOC(do_single_div) - nop - /* NB: these are commented out in the V8-Sparc manual as well */ - /* (I do not understand this) */ - ! %o5 > %o3: went too far: back up 1 step - ! srl %o5, 1, %o5 - ! dec %g2 - ! do single-bit divide steps - ! - ! We have to be careful here. We know that %o3 >= %o5, so we can do the - ! first divide step without thinking. BUT, the others are conditional, - ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high- - ! order bit set in the first step, just falling into the regular - ! division loop will mess up the first time around. - ! So we unroll slightly... - LOC(do_single_div): - subcc %g2, 1, %g2 - bl LOC(end_regular_divide) - nop - sub %o3, %o5, %o3 - mov 1, %o2 - b LOC(end_single_divloop) - nop - LOC(single_divloop): - sll %o2, 1, %o2 - bl 1f - srl %o5, 1, %o5 - ! %o3 >= 0 - sub %o3, %o5, %o3 - b 2f - add %o2, 1, %o2 - 1: ! %o3 < 0 - add %o3, %o5, %o3 - sub %o2, 1, %o2 - 2: - LOC(end_single_divloop): - subcc %g2, 1, %g2 - bge LOC(single_divloop) - tst %o3 - b,a LOC(end_regular_divide) - -LOC(not_really_big): -1: - sll %o5, 4, %o5 - cmp %o5, %o3 - bleu 1b - addcc %o4, 1, %o4 - be LOC(got_result) - sub %o4, 1, %o4 - - tst %o3 ! set up for initial iteration -LOC(divloop): - sll %o2, 4, %o2 - ! depth 1, accumulated bits 0 - bl LOC(1.16) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 2, accumulated bits 1 - bl LOC(2.17) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits 3 - bl LOC(3.19) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 7 - bl LOC(4.23) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (7*2+1), %o2 - -LOC(4.23): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (7*2-1), %o2 - - -LOC(3.19): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 5 - bl LOC(4.21) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (5*2+1), %o2 - -LOC(4.21): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (5*2-1), %o2 - - - -LOC(2.17): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits 1 - bl LOC(3.17) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 3 - bl LOC(4.19) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (3*2+1), %o2 - -LOC(4.19): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (3*2-1), %o2 - - -LOC(3.17): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 1 - bl LOC(4.17) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (1*2+1), %o2 - -LOC(4.17): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (1*2-1), %o2 - - - - -LOC(1.16): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 2, accumulated bits -1 - bl LOC(2.15) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits -1 - bl LOC(3.15) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -1 - bl LOC(4.15) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2+1), %o2 - -LOC(4.15): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2-1), %o2 - - -LOC(3.15): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -3 - bl LOC(4.13) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2+1), %o2 - -LOC(4.13): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2-1), %o2 - - - -LOC(2.15): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits -3 - bl LOC(3.13) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -5 - bl LOC(4.11) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2+1), %o2 - -LOC(4.11): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2-1), %o2 - - -LOC(3.13): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -7 - bl LOC(4.9) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2+1), %o2 - -LOC(4.9): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2-1), %o2 - - - - - 9: -LOC(end_regular_divide): - subcc %o4, 1, %o4 - bge LOC(divloop) - tst %o3 - bl,a LOC(got_result) - ! non-restoring fixup here (one instruction only!) - sub %o2, 1, %o2 - - -LOC(got_result): - - retl - mov %o2, %o0 - -END(.udiv) - -#endif diff --git a/mdk-stage1/dietlibc/sparc/umul.S b/mdk-stage1/dietlibc/sparc/umul.S deleted file mode 100644 index 15038ab2a..000000000 --- a/mdk-stage1/dietlibc/sparc/umul.S +++ /dev/null @@ -1,170 +0,0 @@ -#ifdef __sparc__ -/* - * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the - * upper 32 bits of the 64-bit product). - * - * This code optimizes short (less than 13-bit) multiplies. Short - * multiplies require 25 instruction cycles, and long ones require - * 45 instruction cycles. - * - * On return, overflow has occurred (%o1 is not zero) if and only if - * the Z condition code is clear, allowing, e.g., the following: - * - * call .umul - * nop - * bnz overflow (or tnz) - */ - -#define C_LABEL(name) name: - -#define C_SYMBOL_NAME(name) name - -#define ENTRY(name) \ - .global C_SYMBOL_NAME(name); \ - .align 4;\ - C_LABEL(name);\ - .type name,@function; - -#define LOC(name) . ## L ## name - -#define END(name) \ - .size name, . - name - -ENTRY(.umul) - or %o0, %o1, %o4 - mov %o0, %y ! multiplier -> Y - andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args - be LOC(mul_shortway) ! if zero, can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product; clear N & V - - /* - * Long multiply. 32 steps, followed by a final shift step. - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %o1, %o4 ! 13 - mulscc %o4, %o1, %o4 ! 14 - mulscc %o4, %o1, %o4 ! 15 - mulscc %o4, %o1, %o4 ! 16 - mulscc %o4, %o1, %o4 ! 17 - mulscc %o4, %o1, %o4 ! 18 - mulscc %o4, %o1, %o4 ! 19 - mulscc %o4, %o1, %o4 ! 20 - mulscc %o4, %o1, %o4 ! 21 - mulscc %o4, %o1, %o4 ! 22 - mulscc %o4, %o1, %o4 ! 23 - mulscc %o4, %o1, %o4 ! 24 - mulscc %o4, %o1, %o4 ! 25 - mulscc %o4, %o1, %o4 ! 26 - mulscc %o4, %o1, %o4 ! 27 - mulscc %o4, %o1, %o4 ! 28 - mulscc %o4, %o1, %o4 ! 29 - mulscc %o4, %o1, %o4 ! 30 - mulscc %o4, %o1, %o4 ! 31 - mulscc %o4, %o1, %o4 ! 32 - mulscc %o4, %g0, %o4 ! final shift - - /* - * Normally, with the shift-and-add approach, if both numbers are - * positive you get the correct result. With 32-bit two's-complement - * numbers, -x is represented as - * - * x 32 - * ( 2 - ------ ) mod 2 * 2 - * 32 - * 2 - * - * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s, - * we can treat this as if the radix point were just to the left - * of the sign bit (multiply by 2^32), and get - * - * -x = (2 - x) mod 2 - * - * Then, ignoring the `mod 2's for convenience: - * - * x * y = xy - * -x * y = 2y - xy - * x * -y = 2x - xy - * -x * -y = 4 - 2x - 2y + xy - * - * For signed multiplies, we subtract (x << 32) from the partial - * product to fix this problem for negative multipliers (see mul.s). - * Because of the way the shift into the partial product is calculated - * (N xor V), this term is automatically removed for the multiplicand, - * so we don't have to adjust. - * - * But for unsigned multiplies, the high order bit wasn't a sign bit, - * and the correction is wrong. So for unsigned multiplies where the - * high order bit is one, we end up with xy - (y << 32). To fix it - * we add y << 32. - */ -#if 0 - tst %o1 - bl,a 1f ! if %o1 < 0 (high order bit = 1), - add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half) -1: rd %y, %o0 ! get lower half of product - retl - addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0 -#else - /* Faster code from tege@sics.se. */ - sra %o1, 31, %o2 ! make mask from sign bit - and %o0, %o2, %o2 ! %o2 = 0 or %o0, depending on sign of %o1 - rd %y, %o0 ! get lower half of product - retl - addcc %o4, %o2, %o1 ! add compensation and put upper half in place -#endif - -LOC(mul_shortway): - /* - * Short multiply. 12 steps, followed by a final shift step. - * The resulting bits are off by 12 and (32-12) = 20 bit positions, - * but there is no problem with %o0 being negative (unlike above), - * and overflow is impossible (the answer is at most 24 bits long). - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %g0, %o4 ! final shift - - /* - * %o4 has 20 of the bits that should be in the result; %y has - * the bottom 12 (as %y's top 12). That is: - * - * %o4 %y - * +----------------+----------------+ - * | -12- | -20- | -12- | -20- | - * +------(---------+------)---------+ - * -----result----- - * - * The 12 bits of %o4 left of the `result' area are all zero; - * in fact, all top 20 bits of %o4 are zero. - */ - - rd %y, %o5 - sll %o4, 12, %o0 ! shift middle bits left 12 - srl %o5, 20, %o5 ! shift low bits right 20 - or %o5, %o0, %o0 - retl - addcc %g0, %g0, %o1 ! %o1 = zero, and set Z - -END(.umul) -#endif diff --git a/mdk-stage1/dietlibc/sparc/unified.S b/mdk-stage1/dietlibc/sparc/unified.S deleted file mode 100644 index 3cd609da5..000000000 --- a/mdk-stage1/dietlibc/sparc/unified.S +++ /dev/null @@ -1,28 +0,0 @@ -#include <dietfeatures.h> - -.text -.global __unified_syscall -__unified_syscall: - ta 0x10 - - bcc 1f - save %sp, -104, %sp - - neg %i0, %i0 -1: - add %i0, 0xff, %l2 - cmp %l2, 0xfe - bgu 2f - neg %i0, %l3 -#ifdef WANT_THREAD_SAVE - call __errno_location - nop -#else - sethi %hi(errno), %o0 - or %o0, %lo(errno), %o0 -#endif - st %l3, [ %o0 ] - mov -1, %i0 -2: - ret - restore diff --git a/mdk-stage1/dietlibc/sparc/urem.S b/mdk-stage1/dietlibc/sparc/urem.S deleted file mode 100644 index 943cb7873..000000000 --- a/mdk-stage1/dietlibc/sparc/urem.S +++ /dev/null @@ -1,362 +0,0 @@ -#ifdef __sparc__ - /* This file is generated from divrem.m4; DO NOT EDIT! */ -/* - * Division and remainder, from Appendix E of the Sparc Version 8 - * Architecture Manual, with fixes from Gordon Irlam. - */ - -/* - * Input: dividend and divisor in %o0 and %o1 respectively. - * - * m4 parameters: - * .urem name of function to generate - * rem rem=div => %o0 / %o1; rem=rem => %o0 % %o1 - * false false=true => signed; false=false => unsigned - * - * Algorithm parameters: - * N how many bits per iteration we try to get (4) - * WORDSIZE total number of bits (32) - * - * Derived constants: - * TOPBITS number of bits in the top decade of a number - * - * Important variables: - * Q the partial quotient under development (initially 0) - * R the remainder so far, initially the dividend - * ITER number of main division loop iterations required; - * equal to ceil(log2(quotient) / N). Note that this - * is the log base (2^N) of the quotient. - * V the current comparand, initially divisor*2^(ITER*N-1) - * - * Cost: - * Current estimate for non-large dividend is - * ceil(log2(quotient) / N) * (10 + 7N/2) + C - * A large dividend is one greater than 2^(31-TOPBITS) and takes a - * different path, as the upper bits of the quotient must be developed - * one bit at a time. - */ - - - -#define C_LABEL(name) name: - -#define C_SYMBOL_NAME(name) name - -#define ENTRY(name) \ - .global C_SYMBOL_NAME(name); \ - .align 4;\ - C_LABEL(name);\ - .type name,@function; - -#define LOC(name) . ## L ## name - -#define END(name) \ - .size name, . - name - -#define ST_DIV0 0x02 - -ENTRY(.urem) - - ! Ready to divide. Compute size of quotient; scale comparand. - orcc %o1, %g0, %o5 - bne 1f - mov %o0, %o3 - - ! Divide by zero trap. If it returns, return 0 (about as - ! wrong as possible, but that is what SunOS does...). - ta ST_DIV0 - retl - clr %o0 - -1: - cmp %o3, %o5 ! if %o1 exceeds %o0, done - blu LOC(got_result) ! (and algorithm fails otherwise) - clr %o2 - sethi %hi(1 << (32 - 4 - 1)), %g1 - cmp %o3, %g1 - blu LOC(not_really_big) - clr %o4 - - ! Here the dividend is >= 2**(31-N) or so. We must be careful here, - ! as our usual N-at-a-shot divide step will cause overflow and havoc. - ! The number of bits in the result here is N*ITER+SC, where SC <= N. - ! Compute ITER in an unorthodox manner: know we need to shift V into - ! the top decade: so do not even bother to compare to R. - 1: - cmp %o5, %g1 - bgeu 3f - mov 1, %g2 - sll %o5, 4, %o5 - b 1b - add %o4, 1, %o4 - - ! Now compute %g2. - 2: addcc %o5, %o5, %o5 - bcc LOC(not_too_big) - add %g2, 1, %g2 - - ! We get here if the %o1 overflowed while shifting. - ! This means that %o3 has the high-order bit set. - ! Restore %o5 and subtract from %o3. - sll %g1, 4, %g1 ! high order bit - srl %o5, 1, %o5 ! rest of %o5 - add %o5, %g1, %o5 - b LOC(do_single_div) - sub %g2, 1, %g2 - - LOC(not_too_big): - 3: cmp %o5, %o3 - blu 2b - nop - be LOC(do_single_div) - nop - /* NB: these are commented out in the V8-Sparc manual as well */ - /* (I do not understand this) */ - ! %o5 > %o3: went too far: back up 1 step - ! srl %o5, 1, %o5 - ! dec %g2 - ! do single-bit divide steps - ! - ! We have to be careful here. We know that %o3 >= %o5, so we can do the - ! first divide step without thinking. BUT, the others are conditional, - ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high- - ! order bit set in the first step, just falling into the regular - ! division loop will mess up the first time around. - ! So we unroll slightly... - LOC(do_single_div): - subcc %g2, 1, %g2 - bl LOC(end_regular_divide) - nop - sub %o3, %o5, %o3 - mov 1, %o2 - b LOC(end_single_divloop) - nop - LOC(single_divloop): - sll %o2, 1, %o2 - bl 1f - srl %o5, 1, %o5 - ! %o3 >= 0 - sub %o3, %o5, %o3 - b 2f - add %o2, 1, %o2 - 1: ! %o3 < 0 - add %o3, %o5, %o3 - sub %o2, 1, %o2 - 2: - LOC(end_single_divloop): - subcc %g2, 1, %g2 - bge LOC(single_divloop) - tst %o3 - b,a LOC(end_regular_divide) - -LOC(not_really_big): -1: - sll %o5, 4, %o5 - cmp %o5, %o3 - bleu 1b - addcc %o4, 1, %o4 - be LOC(got_result) - sub %o4, 1, %o4 - - tst %o3 ! set up for initial iteration -LOC(divloop): - sll %o2, 4, %o2 - ! depth 1, accumulated bits 0 - bl LOC(1.16) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 2, accumulated bits 1 - bl LOC(2.17) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits 3 - bl LOC(3.19) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 7 - bl LOC(4.23) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (7*2+1), %o2 - -LOC(4.23): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (7*2-1), %o2 - - -LOC(3.19): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 5 - bl LOC(4.21) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (5*2+1), %o2 - -LOC(4.21): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (5*2-1), %o2 - - - -LOC(2.17): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits 1 - bl LOC(3.17) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits 3 - bl LOC(4.19) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (3*2+1), %o2 - -LOC(4.19): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (3*2-1), %o2 - - -LOC(3.17): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits 1 - bl LOC(4.17) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (1*2+1), %o2 - -LOC(4.17): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (1*2-1), %o2 - - - - -LOC(1.16): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 2, accumulated bits -1 - bl LOC(2.15) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 3, accumulated bits -1 - bl LOC(3.15) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -1 - bl LOC(4.15) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2+1), %o2 - -LOC(4.15): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-1*2-1), %o2 - - -LOC(3.15): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -3 - bl LOC(4.13) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2+1), %o2 - -LOC(4.13): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-3*2-1), %o2 - - - -LOC(2.15): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 3, accumulated bits -3 - bl LOC(3.13) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - ! depth 4, accumulated bits -5 - bl LOC(4.11) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2+1), %o2 - -LOC(4.11): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-5*2-1), %o2 - - -LOC(3.13): - ! remainder is negative - addcc %o3,%o5,%o3 - ! depth 4, accumulated bits -7 - bl LOC(4.9) - srl %o5,1,%o5 - ! remainder is positive - subcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2+1), %o2 - -LOC(4.9): - ! remainder is negative - addcc %o3,%o5,%o3 - b 9f - add %o2, (-7*2-1), %o2 - - - - - 9: -LOC(end_regular_divide): - subcc %o4, 1, %o4 - bge LOC(divloop) - tst %o3 - bl,a LOC(got_result) - ! non-restoring fixup here (one instruction only!) - add %o3, %o1, %o3 - - -LOC(got_result): - - retl - mov %o3, %o0 - -END(.urem) -#endif diff --git a/mdk-stage1/dietlibc/start.h b/mdk-stage1/dietlibc/start.h deleted file mode 100644 index 7f9e6be28..000000000 --- a/mdk-stage1/dietlibc/start.h +++ /dev/null @@ -1,14 +0,0 @@ -.section ".bss" -.align 8 - -.weak errno -errno: -.global __errno -__errno: - .long 0 - -.weak environ -environ: -.global __environ -__environ: - .long 0 diff --git a/mdk-stage1/dietlibc/syscalls.c/_llseek.c b/mdk-stage1/dietlibc/syscalls.c/_llseek.c deleted file mode 100644 index fdf49eba5..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/_llseek.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <unistd.h> -#include <sys/types.h> -#include "syscalls.h" - -_syscall5(int,_llseek,uint,fd,ulong,hi,ulong,lo,loff_t*,res,uint,wh); diff --git a/mdk-stage1/dietlibc/syscalls.c/_newselect.c b/mdk-stage1/dietlibc/syscalls.c/_newselect.c deleted file mode 100644 index cb42193bd..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/_newselect.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <linux/types.h> -#include <linux/time.h> -#include "syscalls.h" - -_syscall5(int,_newselect,int,n,fd_set *,rd,fd_set *,wr,fd_set *,ex,struct timeval *,timeval); - diff --git a/mdk-stage1/dietlibc/syscalls.c/access.c b/mdk-stage1/dietlibc/syscalls.c/access.c deleted file mode 100644 index 80944733a..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/access.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,access,const char*,pathname,int,mode) diff --git a/mdk-stage1/dietlibc/syscalls.c/chdir.c b/mdk-stage1/dietlibc/syscalls.c/chdir.c deleted file mode 100644 index a679f528d..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/chdir.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,chdir,void*,path) diff --git a/mdk-stage1/dietlibc/syscalls.c/chmod.c b/mdk-stage1/dietlibc/syscalls.c/chmod.c deleted file mode 100644 index 80ad33b40..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/chmod.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,chmod,const char * ,path,mode_t,mode) - diff --git a/mdk-stage1/dietlibc/syscalls.c/chown.c b/mdk-stage1/dietlibc/syscalls.c/chown.c deleted file mode 100644 index 5a9352684..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/chown.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,chown,char*,path,uid_t,owner,gid_t,group) - diff --git a/mdk-stage1/dietlibc/syscalls.c/chroot.c b/mdk-stage1/dietlibc/syscalls.c/chroot.c deleted file mode 100644 index ab39f7ebe..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/chroot.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,chroot,void*,path) - diff --git a/mdk-stage1/dietlibc/syscalls.c/clone.c b/mdk-stage1/dietlibc/syscalls.c/clone.c deleted file mode 100644 index 985eee4c8..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/clone.c +++ /dev/null @@ -1 +0,0 @@ -#warning "No CLONE support yet" diff --git a/mdk-stage1/dietlibc/syscalls.c/close.c b/mdk-stage1/dietlibc/syscalls.c/close.c deleted file mode 100644 index a7d7f0076..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/close.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,close,int,fd) diff --git a/mdk-stage1/dietlibc/syscalls.c/dup.c b/mdk-stage1/dietlibc/syscalls.c/dup.c deleted file mode 100644 index 9c28f0bd6..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/dup.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,dup,int,fd) - diff --git a/mdk-stage1/dietlibc/syscalls.c/dup2.c b/mdk-stage1/dietlibc/syscalls.c/dup2.c deleted file mode 100644 index 399314aa8..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/dup2.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,dup2,int,one,int,two) - diff --git a/mdk-stage1/dietlibc/syscalls.c/execve.c b/mdk-stage1/dietlibc/syscalls.c/execve.c deleted file mode 100644 index c2bac0117..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/execve.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,execve,const char *,fn,void *,argv,void *,envp) - diff --git a/mdk-stage1/dietlibc/syscalls.c/exit.c b/mdk-stage1/dietlibc/syscalls.c/exit.c deleted file mode 100644 index 87087c939..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/exit.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,exit,int,exitcode) diff --git a/mdk-stage1/dietlibc/syscalls.c/fchdir.c b/mdk-stage1/dietlibc/syscalls.c/fchdir.c deleted file mode 100644 index b3a41dc7a..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/fchdir.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,fchdir,int,fd) diff --git a/mdk-stage1/dietlibc/syscalls.c/fchmod.c b/mdk-stage1/dietlibc/syscalls.c/fchmod.c deleted file mode 100644 index 09e52b6c7..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/fchmod.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,fchmod,int,filedes,mode_t,mode) - diff --git a/mdk-stage1/dietlibc/syscalls.c/fchown.c b/mdk-stage1/dietlibc/syscalls.c/fchown.c deleted file mode 100644 index 58923a137..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/fchown.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,fchown,int,fd,uid_t,owner,gid_t,group) - diff --git a/mdk-stage1/dietlibc/syscalls.c/fcntl.c b/mdk-stage1/dietlibc/syscalls.c/fcntl.c deleted file mode 100644 index b21be9531..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/fcntl.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,fcntl,int,fd,int,cmd,long,arg) - diff --git a/mdk-stage1/dietlibc/syscalls.c/flock.c b/mdk-stage1/dietlibc/syscalls.c/flock.c deleted file mode 100644 index 6fcb336ef..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/flock.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,flock,int,fd,int,op) - diff --git a/mdk-stage1/dietlibc/syscalls.c/fork.c b/mdk-stage1/dietlibc/syscalls.c/fork.c deleted file mode 100644 index 1d4b892b6..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/fork.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "syscalls.h" - -#ifndef __sparc__ - -_syscall0(int,fork) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.c/fsync.c b/mdk-stage1/dietlibc/syscalls.c/fsync.c deleted file mode 100644 index db6198b8a..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/fsync.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,fsync,int,fd) - diff --git a/mdk-stage1/dietlibc/syscalls.c/ftruncate.c b/mdk-stage1/dietlibc/syscalls.c/ftruncate.c deleted file mode 100644 index 5f002a899..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/ftruncate.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <sys/types.h> -#include "syscalls.h" - -_syscall2(int,ftruncate,int,fd,off_t,length) diff --git a/mdk-stage1/dietlibc/syscalls.c/getcwd.c b/mdk-stage1/dietlibc/syscalls.c/getcwd.c deleted file mode 100644 index 9e5e4a3e2..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getcwd.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" - -/* this syscall exists since Linux 2.1.92 */ - -_syscall2(int,getcwd,char*,buf,unsigned long,size) diff --git a/mdk-stage1/dietlibc/syscalls.c/getdents.c b/mdk-stage1/dietlibc/syscalls.c/getdents.c deleted file mode 100644 index be941b21e..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getdents.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int, getdents, unsigned int, fd, void *, dirp, unsigned int, count); - diff --git a/mdk-stage1/dietlibc/syscalls.c/getegid.c b/mdk-stage1/dietlibc/syscalls.c/getegid.c deleted file mode 100644 index 3213d640c..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getegid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall0(gid_t,getegid) diff --git a/mdk-stage1/dietlibc/syscalls.c/geteuid.c b/mdk-stage1/dietlibc/syscalls.c/geteuid.c deleted file mode 100644 index 5b31a3cca..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/geteuid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall0(uid_t,geteuid) diff --git a/mdk-stage1/dietlibc/syscalls.c/getgid.c b/mdk-stage1/dietlibc/syscalls.c/getgid.c deleted file mode 100644 index 2f7d96286..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getgid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall0(gid_t,getgid) diff --git a/mdk-stage1/dietlibc/syscalls.c/getgroups.c b/mdk-stage1/dietlibc/syscalls.c/getgroups.c deleted file mode 100644 index 3e4d6797a..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getgroups.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,getgroups,int,size,int*,list) diff --git a/mdk-stage1/dietlibc/syscalls.c/getpgid.c b/mdk-stage1/dietlibc/syscalls.c/getpgid.c deleted file mode 100644 index 0b4ff528b..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getpgid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall1(pid_t,getpgid,pid_t,pid) diff --git a/mdk-stage1/dietlibc/syscalls.c/getpid.c b/mdk-stage1/dietlibc/syscalls.c/getpid.c deleted file mode 100644 index d60a8db9a..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getpid.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall0(int,getpid) diff --git a/mdk-stage1/dietlibc/syscalls.c/getppid.c b/mdk-stage1/dietlibc/syscalls.c/getppid.c deleted file mode 100644 index ee87a8eae..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getppid.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall0(int,getppid) diff --git a/mdk-stage1/dietlibc/syscalls.c/getpriority.c b/mdk-stage1/dietlibc/syscalls.c/getpriority.c deleted file mode 100644 index 6f94bcf42..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getpriority.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,getpriority,int,which,int,who) - diff --git a/mdk-stage1/dietlibc/syscalls.c/getresgid.c b/mdk-stage1/dietlibc/syscalls.c/getresgid.c deleted file mode 100644 index 264ec7dce..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getresgid.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -#ifdef __NR_getresgid - -_syscall3(int,getresgid,gid_t*,rgid,gid_t*,egid,gid_t*,sgid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.c/getresuid.c b/mdk-stage1/dietlibc/syscalls.c/getresuid.c deleted file mode 100644 index 74e2daec2..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getresuid.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -#ifdef __getresuid - -_syscall3(int,getresuid,uid_t*,ruid,uid_t*,euid,uid_t*,suid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.c/getrlimit.c b/mdk-stage1/dietlibc/syscalls.c/getrlimit.c deleted file mode 100644 index 635b2baf4..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getrlimit.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,getrlimit,int,resource,void*,rlim) diff --git a/mdk-stage1/dietlibc/syscalls.c/getrusage.c b/mdk-stage1/dietlibc/syscalls.c/getrusage.c deleted file mode 100644 index 815d3e617..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getrusage.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,getrusage,int,who,void*,rusage) diff --git a/mdk-stage1/dietlibc/syscalls.c/getsid.c b/mdk-stage1/dietlibc/syscalls.c/getsid.c deleted file mode 100644 index 69974c36c..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getsid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall1(pid_t,getsid,pid_t,pid) diff --git a/mdk-stage1/dietlibc/syscalls.c/gettimeofday.c b/mdk-stage1/dietlibc/syscalls.c/gettimeofday.c deleted file mode 100644 index 5f4931a0c..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/gettimeofday.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include <linux/time.h> -#include "syscalls.h" - -_syscall2(int,gettimeofday,struct timeval *,tv,void *,tz) diff --git a/mdk-stage1/dietlibc/syscalls.c/getuid.c b/mdk-stage1/dietlibc/syscalls.c/getuid.c deleted file mode 100644 index bf38447a6..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/getuid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall0(uid_t,getuid) diff --git a/mdk-stage1/dietlibc/syscalls.c/ioctl.c b/mdk-stage1/dietlibc/syscalls.c/ioctl.c deleted file mode 100644 index 1612109d3..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/ioctl.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,ioctl,int,fd,int,request,void *,argp) - diff --git a/mdk-stage1/dietlibc/syscalls.c/kill.c b/mdk-stage1/dietlibc/syscalls.c/kill.c deleted file mode 100644 index e56b0ac1b..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/kill.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,kill,pid_t,pid,int,sig) diff --git a/mdk-stage1/dietlibc/syscalls.c/lchown.c b/mdk-stage1/dietlibc/syscalls.c/lchown.c deleted file mode 100644 index 976d2ee1f..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/lchown.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,lchown,char*,path,uid_t,owner,gid_t,group) - diff --git a/mdk-stage1/dietlibc/syscalls.c/link.c b/mdk-stage1/dietlibc/syscalls.c/link.c deleted file mode 100644 index ab9b427d9..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/link.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,link,const char *,a,const char *,b) - diff --git a/mdk-stage1/dietlibc/syscalls.c/lseek.c b/mdk-stage1/dietlibc/syscalls.c/lseek.c deleted file mode 100644 index 9925a2185..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/lseek.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(unsigned long,lseek,int,fd,unsigned long,offset,int,whence) - diff --git a/mdk-stage1/dietlibc/syscalls.c/mkdir.c b/mdk-stage1/dietlibc/syscalls.c/mkdir.c deleted file mode 100644 index aac682c99..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/mkdir.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,mkdir,void*,path,mode_t,mode) diff --git a/mdk-stage1/dietlibc/syscalls.c/mknod.c b/mdk-stage1/dietlibc/syscalls.c/mknod.c deleted file mode 100644 index 00e836b73..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/mknod.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,mknod,const char*,pathname,mode_t,mode,dev_t,dev) - diff --git a/mdk-stage1/dietlibc/syscalls.c/mount.c b/mdk-stage1/dietlibc/syscalls.c/mount.c deleted file mode 100644 index 2d71ee812..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/mount.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall5(int,mount,const char *,spec,const char *,dir,const char *,type,unsigned long,rwflag,const void *,data); - diff --git a/mdk-stage1/dietlibc/syscalls.c/mprotect.c b/mdk-stage1/dietlibc/syscalls.c/mprotect.c deleted file mode 100644 index 634a12089..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/mprotect.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,mprotect,const void *,addr, size_t, len, int, prot) diff --git a/mdk-stage1/dietlibc/syscalls.c/mremap.c b/mdk-stage1/dietlibc/syscalls.c/mremap.c deleted file mode 100644 index 37d066bac..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/mremap.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall4(int,mremap,void*,old_address,size_t,old_size,size_t,new_size,unsigned long,flags) - diff --git a/mdk-stage1/dietlibc/syscalls.c/munmap.c b/mdk-stage1/dietlibc/syscalls.c/munmap.c deleted file mode 100644 index 40bc98270..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/munmap.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,munmap,void*,start,size_t,len) - diff --git a/mdk-stage1/dietlibc/syscalls.c/nanosleep.c b/mdk-stage1/dietlibc/syscalls.c/nanosleep.c deleted file mode 100644 index 71aca1f09..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/nanosleep.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include <linux/time.h> -#include "syscalls.h" - -_syscall2(int,nanosleep,struct timeval *,in,struct timeval *,out) diff --git a/mdk-stage1/dietlibc/syscalls.c/open.c b/mdk-stage1/dietlibc/syscalls.c/open.c deleted file mode 100644 index 8b3ccfcc3..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/open.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,open,const char *,fn,int,flags,mode_t,mode) diff --git a/mdk-stage1/dietlibc/syscalls.c/pipe.c b/mdk-stage1/dietlibc/syscalls.c/pipe.c deleted file mode 100644 index 42197c881..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/pipe.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall1(int,pipe,int *,filedes) diff --git a/mdk-stage1/dietlibc/syscalls.c/poll.c b/mdk-stage1/dietlibc/syscalls.c/poll.c deleted file mode 100644 index 10d0d1f78..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/poll.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,poll,void *,ufds,int,nfds,int,timeout) diff --git a/mdk-stage1/dietlibc/syscalls.c/read.c b/mdk-stage1/dietlibc/syscalls.c/read.c deleted file mode 100644 index f5532054e..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/read.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,read,int,fd,const char *,buf,unsigned long,count) diff --git a/mdk-stage1/dietlibc/syscalls.c/readlink.c b/mdk-stage1/dietlibc/syscalls.c/readlink.c deleted file mode 100644 index 482f8fe27..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/readlink.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" -#include <linux/types.h> - -_syscall3(int,readlink,char*,path,char*,buf,size_t,bufsiz) - diff --git a/mdk-stage1/dietlibc/syscalls.c/reboot.c b/mdk-stage1/dietlibc/syscalls.c/reboot.c deleted file mode 100644 index 0ad474894..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/reboot.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,reboot,int,magic,int,magic_too,int,flag) - diff --git a/mdk-stage1/dietlibc/syscalls.c/rename.c b/mdk-stage1/dietlibc/syscalls.c/rename.c deleted file mode 100644 index f86d50728..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/rename.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,rename,char*,oldpath,char*,newpath) - diff --git a/mdk-stage1/dietlibc/syscalls.c/rmdir.c b/mdk-stage1/dietlibc/syscalls.c/rmdir.c deleted file mode 100644 index 303885264..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/rmdir.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,rmdir,void*,path) diff --git a/mdk-stage1/dietlibc/syscalls.c/setdomainname.c b/mdk-stage1/dietlibc/syscalls.c/setdomainname.c deleted file mode 100644 index 83d3aa8b8..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setdomainname.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,setdomainname,const char *,name,int,len) - diff --git a/mdk-stage1/dietlibc/syscalls.c/setgid.c b/mdk-stage1/dietlibc/syscalls.c/setgid.c deleted file mode 100644 index 1f7263aeb..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setgid.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,setgid,int,gid) diff --git a/mdk-stage1/dietlibc/syscalls.c/setgroups.c b/mdk-stage1/dietlibc/syscalls.c/setgroups.c deleted file mode 100644 index fed3b85c1..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setgroups.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,setgroups,int,size,const int*,list) - diff --git a/mdk-stage1/dietlibc/syscalls.c/sethostname.c b/mdk-stage1/dietlibc/syscalls.c/sethostname.c deleted file mode 100644 index e4b736f87..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/sethostname.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,sethostname,const char *,name,int,len) - diff --git a/mdk-stage1/dietlibc/syscalls.c/setitimer.c b/mdk-stage1/dietlibc/syscalls.c/setitimer.c deleted file mode 100644 index 28935cab7..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setitimer.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,setitimer,int,which,void *,value,void *,ovalue) - diff --git a/mdk-stage1/dietlibc/syscalls.c/setpgid.c b/mdk-stage1/dietlibc/syscalls.c/setpgid.c deleted file mode 100644 index 66fbf82dd..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setpgid.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,setpgid,int,name,int,len) diff --git a/mdk-stage1/dietlibc/syscalls.c/setpriority.c b/mdk-stage1/dietlibc/syscalls.c/setpriority.c deleted file mode 100644 index bc04227d2..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setpriority.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,setpriority,int,which,int,who,int,prio) - diff --git a/mdk-stage1/dietlibc/syscalls.c/setregid.c b/mdk-stage1/dietlibc/syscalls.c/setregid.c deleted file mode 100644 index c6911aca8..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setregid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,setregid,gid_t,rgid,gid_t,egid) diff --git a/mdk-stage1/dietlibc/syscalls.c/setresgid.c b/mdk-stage1/dietlibc/syscalls.c/setresgid.c deleted file mode 100644 index 817fd2942..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setresgid.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -#ifdef __NR_setresgid - -_syscall3(int,setresgid,gid_t*,rgid,gid_t*,egid,gid_t*,sgid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.c/setresuid.c b/mdk-stage1/dietlibc/syscalls.c/setresuid.c deleted file mode 100644 index 7073d8ac2..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setresuid.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -#ifdef __NR_setresuid - -_syscall3(int,setresuid,uid_t*,ruid,uid_t*,euid,uid_t*,suid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.c/setreuid.c b/mdk-stage1/dietlibc/syscalls.c/setreuid.c deleted file mode 100644 index c0c23a12d..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setreuid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,setreuid,uid_t,ruid,uid_t,euid) diff --git a/mdk-stage1/dietlibc/syscalls.c/setrlimit.c b/mdk-stage1/dietlibc/syscalls.c/setrlimit.c deleted file mode 100644 index 213234282..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setrlimit.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,setrlimit,int,resource,void*,rlim) diff --git a/mdk-stage1/dietlibc/syscalls.c/setsid.c b/mdk-stage1/dietlibc/syscalls.c/setsid.c deleted file mode 100644 index 4b35a1316..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setsid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall0(pid_t,setsid) diff --git a/mdk-stage1/dietlibc/syscalls.c/setuid.c b/mdk-stage1/dietlibc/syscalls.c/setuid.c deleted file mode 100644 index 620876c9f..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/setuid.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,setuid,int,uid) diff --git a/mdk-stage1/dietlibc/syscalls.c/sigaction.c b/mdk-stage1/dietlibc/syscalls.c/sigaction.c deleted file mode 100644 index cfa5c683f..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/sigaction.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,sigaction,int,signum,void*,act,void*,oldact) diff --git a/mdk-stage1/dietlibc/syscalls.c/signal.c b/mdk-stage1/dietlibc/syscalls.c/signal.c deleted file mode 100644 index 1a913be45..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/signal.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,signal,int,num,void *,len) diff --git a/mdk-stage1/dietlibc/syscalls.c/sigpending.c b/mdk-stage1/dietlibc/syscalls.c/sigpending.c deleted file mode 100644 index 08fb23991..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/sigpending.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,sigpending,void*,set) diff --git a/mdk-stage1/dietlibc/syscalls.c/sigprocmask.c b/mdk-stage1/dietlibc/syscalls.c/sigprocmask.c deleted file mode 100644 index e9dcc2d67..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/sigprocmask.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,sigprocmask,int,how,void*,set,void*,oldset) diff --git a/mdk-stage1/dietlibc/syscalls.c/sigsuspend.c b/mdk-stage1/dietlibc/syscalls.c/sigsuspend.c deleted file mode 100644 index 0fe90e623..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/sigsuspend.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,sigsuspend,void*,mask) diff --git a/mdk-stage1/dietlibc/syscalls.c/socketcall.c b/mdk-stage1/dietlibc/syscalls.c/socketcall.c deleted file mode 100644 index eee1ae86d..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/socketcall.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,socketcall,int,code,unsigned long *, args) diff --git a/mdk-stage1/dietlibc/syscalls.c/swapoff.c b/mdk-stage1/dietlibc/syscalls.c/swapoff.c deleted file mode 100644 index e1daa89a9..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/swapoff.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,swapoff,const char *,fn) - diff --git a/mdk-stage1/dietlibc/syscalls.c/swapon.c b/mdk-stage1/dietlibc/syscalls.c/swapon.c deleted file mode 100644 index 543e41e79..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/swapon.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,swapon,const char*,path,int,swapflags) diff --git a/mdk-stage1/dietlibc/syscalls.c/symlink.c b/mdk-stage1/dietlibc/syscalls.c/symlink.c deleted file mode 100644 index b3f4d0b1c..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/symlink.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,symlink,const char *,a,const char *,b) diff --git a/mdk-stage1/dietlibc/syscalls.c/sync.c b/mdk-stage1/dietlibc/syscalls.c/sync.c deleted file mode 100644 index cca17461f..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/sync.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall0(int,sync) diff --git a/mdk-stage1/dietlibc/syscalls.c/syslog.c b/mdk-stage1/dietlibc/syscalls.c/syslog.c deleted file mode 100644 index aace870ea..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/syslog.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,syslog,int, type, char *, buf, int, len); diff --git a/mdk-stage1/dietlibc/syscalls.c/time.c b/mdk-stage1/dietlibc/syscalls.c/time.c deleted file mode 100644 index dc15b28f9..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/time.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall1(time_t,time,time_t*,path) diff --git a/mdk-stage1/dietlibc/syscalls.c/truncate.c b/mdk-stage1/dietlibc/syscalls.c/truncate.c deleted file mode 100644 index 721bd7134..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/truncate.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall2(int,truncate,const char*,path,off_t,length) diff --git a/mdk-stage1/dietlibc/syscalls.c/umask.c b/mdk-stage1/dietlibc/syscalls.c/umask.c deleted file mode 100644 index 506038243..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/umask.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall1(int,umask,mode_t,mask) - diff --git a/mdk-stage1/dietlibc/syscalls.c/umount.c b/mdk-stage1/dietlibc/syscalls.c/umount.c deleted file mode 100644 index 4d3ef7637..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/umount.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,umount,const char *,dir) diff --git a/mdk-stage1/dietlibc/syscalls.c/uname.c b/mdk-stage1/dietlibc/syscalls.c/uname.c deleted file mode 100644 index 68f135007..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/uname.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall1(int,uname,void *,utsname) - diff --git a/mdk-stage1/dietlibc/syscalls.c/unlink.c b/mdk-stage1/dietlibc/syscalls.c/unlink.c deleted file mode 100644 index 860ccebbf..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/unlink.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall1(int,unlink,const char *,fn) diff --git a/mdk-stage1/dietlibc/syscalls.c/utime.c b/mdk-stage1/dietlibc/syscalls.c/utime.c deleted file mode 100644 index 185bdf9e8..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/utime.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall2(int,utime,void*,filename,void*,buf) diff --git a/mdk-stage1/dietlibc/syscalls.c/vhangup.c b/mdk-stage1/dietlibc/syscalls.c/vhangup.c deleted file mode 100644 index bb0669765..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/vhangup.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall0(int,vhangup) diff --git a/mdk-stage1/dietlibc/syscalls.c/wait4.c b/mdk-stage1/dietlibc/syscalls.c/wait4.c deleted file mode 100644 index 4ae7eabcd..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/wait4.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall4(int,wait4,pid_t,pid,int *,status,int,opts,void *,rusage) diff --git a/mdk-stage1/dietlibc/syscalls.c/waitpid.c b/mdk-stage1/dietlibc/syscalls.c/waitpid.c deleted file mode 100644 index b7167f9ce..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/waitpid.c +++ /dev/null @@ -1,4 +0,0 @@ -#include <linux/types.h> -#include "syscalls.h" - -_syscall3(int,waitpid,int,pid,int *,status,int,options) diff --git a/mdk-stage1/dietlibc/syscalls.c/write.c b/mdk-stage1/dietlibc/syscalls.c/write.c deleted file mode 100644 index d1f7347d5..000000000 --- a/mdk-stage1/dietlibc/syscalls.c/write.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -_syscall3(int,write,int,fd,const char *,buf,unsigned long,count) diff --git a/mdk-stage1/dietlibc/syscalls.h b/mdk-stage1/dietlibc/syscalls.h deleted file mode 100644 index eba7a3c00..000000000 --- a/mdk-stage1/dietlibc/syscalls.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifdef __ASSEMBLER__ - -#include <asm/unistd.h> - -#else - -#include <linux/unistd.h> - -#endif - -#ifdef __i386__ - -#define syscall_weak(name,wsym,sym) \ -.text; \ -.weak wsym; \ -wsym: ; \ -.global sym; \ -sym: \ - movb $__NR_##name,%al; \ - jmp __unified_syscall - -#define syscall(name,sym) \ -.text; \ -.global sym; \ -sym: \ - movb $__NR_##name,%al; \ - jmp __unified_syscall - -#endif - -#ifdef __sparc__ - -#define syscall_weak(name,wsym,sym) \ -.text; \ -.weak wsym; \ -wsym: ; \ -.global sym; \ -sym: \ - b __unified_syscall; \ - mov __NR_##name, %g1 - -#define syscall(name,sym) \ -.text; \ -.global sym; \ -sym: \ - b __unified_syscall; \ - mov __NR_##name, %g1 - -#endif - -#ifdef __powerpc__ - -#define syscall_weak(name,wsym,sym) \ -.text; \ -.weak wsym; \ -wsym: ; \ -.global sym; \ -sym: \ - li 0,__NR_##name; \ - b __unified_syscall - -#define syscall(name,sym) \ -.text; \ -.global sym; \ -sym: \ - li 0,__NR_##name; \ - b __unified_syscall - -#endif - - -#ifdef __mips__ - -#define syscall_weak(name,wsym,sym) \ -.text; \ -.weak wsym; \ -wsym: ; \ -.global sym; \ -.ent sym; \ -sym: \ - li $2,__NR_##name; \ - la $25,__unified_syscall; \ - jr $25; \ -.end sym - -#define syscall(name,sym) \ -.text; \ -.global sym; \ -.ent sym; \ -sym: \ - li $2,__NR_##name; \ - la $25,__unified_syscall; \ - jr $25; \ -.end sym - -#endif - -#ifdef __arm__ - -#define syscall_weak(name,wsym,sym) \ -.text; \ -.weak wsym; \ -wsym: ; \ -.global sym; \ -sym: \ - swi __NR_##name; \ - b __unified_syscall - -#define syscall(name,sym) \ -.text; \ -.global sym; \ -sym: \ - swi __NR_##name; \ - b __unified_syscall - -#endif - - -#ifdef __alpha__ - -#define syscall_weak(name,wsym,sym) \ -.text ; \ -.align 2 ; \ -.weak wsym; \ -.type wsym,@function ; \ -wsym: ; \ -.global sym ; \ -.type sym,@function ; \ -sym: ; \ - lda $0, __NR_##name($31) ; \ - br __unified_syscall - -#define syscall(name,sym) \ -.text ; \ -.align 2 ; \ -.global sym ; \ -.type sym,@function ; \ -sym: ; \ - lda $0, __NR_##name($31) ; \ - br __unified_syscall - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/__getpagesize.S b/mdk-stage1/dietlibc/syscalls.s/__getpagesize.S deleted file mode 100644 index c9fd97898..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/__getpagesize.S +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" - -#ifdef __NR_getpagesize -syscall(getpagesize,getpagesize) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/__pread.S b/mdk-stage1/dietlibc/syscalls.s/__pread.S deleted file mode 100644 index ad47c7873..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/__pread.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(pread,__pread,__libc__pread) diff --git a/mdk-stage1/dietlibc/syscalls.s/__reboot.S b/mdk-stage1/dietlibc/syscalls.s/__reboot.S deleted file mode 100644 index 0de4f25b2..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/__reboot.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(reboot,__reboot) diff --git a/mdk-stage1/dietlibc/syscalls.s/_llseek.S b/mdk-stage1/dietlibc/syscalls.s/_llseek.S deleted file mode 100644 index 3e240d822..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/_llseek.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(_llseek,_llseek) diff --git a/mdk-stage1/dietlibc/syscalls.s/access.S b/mdk-stage1/dietlibc/syscalls.s/access.S deleted file mode 100644 index d1edafd8c..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/access.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(access,access) diff --git a/mdk-stage1/dietlibc/syscalls.s/brk.S b/mdk-stage1/dietlibc/syscalls.s/brk.S deleted file mode 100644 index 6e21810bd..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/brk.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(brk,__diet_brk) diff --git a/mdk-stage1/dietlibc/syscalls.s/chdir.S b/mdk-stage1/dietlibc/syscalls.s/chdir.S deleted file mode 100644 index 204f3dd6c..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/chdir.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(chdir,chdir) diff --git a/mdk-stage1/dietlibc/syscalls.s/chmod.S b/mdk-stage1/dietlibc/syscalls.s/chmod.S deleted file mode 100644 index c1b85f5a4..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/chmod.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(chmod,chmod) diff --git a/mdk-stage1/dietlibc/syscalls.s/chown.S b/mdk-stage1/dietlibc/syscalls.s/chown.S deleted file mode 100644 index daac3bf13..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/chown.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(chown,chown) diff --git a/mdk-stage1/dietlibc/syscalls.s/chroot.S b/mdk-stage1/dietlibc/syscalls.s/chroot.S deleted file mode 100644 index 65de1e473..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/chroot.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(chroot,chroot) diff --git a/mdk-stage1/dietlibc/syscalls.s/close.S b/mdk-stage1/dietlibc/syscalls.s/close.S deleted file mode 100644 index 361ca5272..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/close.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(close,close,__libc_close) diff --git a/mdk-stage1/dietlibc/syscalls.s/dup.S b/mdk-stage1/dietlibc/syscalls.s/dup.S deleted file mode 100644 index b2977fd43..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/dup.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(dup,dup) diff --git a/mdk-stage1/dietlibc/syscalls.s/dup2.S b/mdk-stage1/dietlibc/syscalls.s/dup2.S deleted file mode 100644 index 774bfbfe7..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/dup2.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(dup2,dup2) diff --git a/mdk-stage1/dietlibc/syscalls.s/execve.S b/mdk-stage1/dietlibc/syscalls.s/execve.S deleted file mode 100644 index ff952ae7d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/execve.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(execve,execve) diff --git a/mdk-stage1/dietlibc/syscalls.s/exit.S b/mdk-stage1/dietlibc/syscalls.s/exit.S deleted file mode 100644 index 11c989529..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/exit.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(exit,exit,_exit) diff --git a/mdk-stage1/dietlibc/syscalls.s/fchdir.S b/mdk-stage1/dietlibc/syscalls.s/fchdir.S deleted file mode 100644 index 0aeaf610b..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fchdir.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(fchdir,fchdir) diff --git a/mdk-stage1/dietlibc/syscalls.s/fchmod.S b/mdk-stage1/dietlibc/syscalls.s/fchmod.S deleted file mode 100644 index 30bc2e210..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fchmod.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(fchmod,fchmod) diff --git a/mdk-stage1/dietlibc/syscalls.s/fchown.S b/mdk-stage1/dietlibc/syscalls.s/fchown.S deleted file mode 100644 index bc2a296ea..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fchown.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(fchown,fchown) diff --git a/mdk-stage1/dietlibc/syscalls.s/fcntl.S b/mdk-stage1/dietlibc/syscalls.s/fcntl.S deleted file mode 100644 index 2285929a0..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fcntl.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(fcntl,fcntl,__libc_fcntl) diff --git a/mdk-stage1/dietlibc/syscalls.s/flock.S b/mdk-stage1/dietlibc/syscalls.s/flock.S deleted file mode 100644 index 7b4daeff7..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/flock.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(flock,flock) diff --git a/mdk-stage1/dietlibc/syscalls.s/fork.S b/mdk-stage1/dietlibc/syscalls.s/fork.S deleted file mode 100644 index b40c3f708..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fork.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(fork,fork,__libc_fork) diff --git a/mdk-stage1/dietlibc/syscalls.s/fstat.S b/mdk-stage1/dietlibc/syscalls.s/fstat.S deleted file mode 100644 index 9dd465cda..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fstat.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(fstat,fstat) diff --git a/mdk-stage1/dietlibc/syscalls.s/fstat64.S b/mdk-stage1/dietlibc/syscalls.s/fstat64.S deleted file mode 100644 index 0c7a41609..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fstat64.S +++ /dev/null @@ -1,8 +0,0 @@ -#include "dietfeatures.h" -#include "syscalls.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -syscall(fstat64,__dietlibc_fstat64) -#else -syscall(fstat64,fstat64) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/fstatfs.S b/mdk-stage1/dietlibc/syscalls.s/fstatfs.S deleted file mode 100644 index a23c8770c..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fstatfs.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(fstatfs,fstatfs) diff --git a/mdk-stage1/dietlibc/syscalls.s/fsync.S b/mdk-stage1/dietlibc/syscalls.s/fsync.S deleted file mode 100644 index 66af59ef9..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/fsync.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(fsync,fsync,__libc_fsync) diff --git a/mdk-stage1/dietlibc/syscalls.s/ftruncate.S b/mdk-stage1/dietlibc/syscalls.s/ftruncate.S deleted file mode 100644 index dde57a615..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/ftruncate.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(ftruncate,ftruncate) diff --git a/mdk-stage1/dietlibc/syscalls.s/getcwd.S b/mdk-stage1/dietlibc/syscalls.s/getcwd.S deleted file mode 100644 index e13262f20..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getcwd.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getcwd,__syscall_getcwd) diff --git a/mdk-stage1/dietlibc/syscalls.s/getdents.S b/mdk-stage1/dietlibc/syscalls.s/getdents.S deleted file mode 100644 index f476e939d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getdents.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getdents,getdents) diff --git a/mdk-stage1/dietlibc/syscalls.s/getdents64.S b/mdk-stage1/dietlibc/syscalls.s/getdents64.S deleted file mode 100644 index 16859addf..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getdents64.S +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" - -#ifdef __NR_getdents64 -syscall(getdents64,getdents64) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/getegid.S b/mdk-stage1/dietlibc/syscalls.s/getegid.S deleted file mode 100644 index 64843ee35..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getegid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getegid,getegid) diff --git a/mdk-stage1/dietlibc/syscalls.s/geteuid.S b/mdk-stage1/dietlibc/syscalls.s/geteuid.S deleted file mode 100644 index 55dc00981..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/geteuid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(geteuid,geteuid) diff --git a/mdk-stage1/dietlibc/syscalls.s/getgid.S b/mdk-stage1/dietlibc/syscalls.s/getgid.S deleted file mode 100644 index 39f092685..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getgid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getgid,getgid) diff --git a/mdk-stage1/dietlibc/syscalls.s/getgroups.S b/mdk-stage1/dietlibc/syscalls.s/getgroups.S deleted file mode 100644 index b4c57689c..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getgroups.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getgroups,getgroups) diff --git a/mdk-stage1/dietlibc/syscalls.s/getitimer.S b/mdk-stage1/dietlibc/syscalls.s/getitimer.S deleted file mode 100644 index 9a2084080..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getitimer.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getitimer,getitimer) diff --git a/mdk-stage1/dietlibc/syscalls.s/getpgid.S b/mdk-stage1/dietlibc/syscalls.s/getpgid.S deleted file mode 100644 index e568f060f..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getpgid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getpgid,getpgid) diff --git a/mdk-stage1/dietlibc/syscalls.s/getpid.S b/mdk-stage1/dietlibc/syscalls.s/getpid.S deleted file mode 100644 index 093884785..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getpid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getpid,getpid) diff --git a/mdk-stage1/dietlibc/syscalls.s/getppid.S b/mdk-stage1/dietlibc/syscalls.s/getppid.S deleted file mode 100644 index b05e64ae3..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getppid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getppid,getppid) diff --git a/mdk-stage1/dietlibc/syscalls.s/getpriority.S b/mdk-stage1/dietlibc/syscalls.s/getpriority.S deleted file mode 100644 index 848b27ed7..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getpriority.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getpriority,getpriority) diff --git a/mdk-stage1/dietlibc/syscalls.s/getresgid.S b/mdk-stage1/dietlibc/syscalls.s/getresgid.S deleted file mode 100644 index a1d873c15..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getresgid.S +++ /dev/null @@ -1,7 +0,0 @@ -#include "syscalls.h" - -#ifdef __NR_getresgid - -syscall(getresgid,getresgid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/getresuid.S b/mdk-stage1/dietlibc/syscalls.s/getresuid.S deleted file mode 100644 index 62f6d764f..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getresuid.S +++ /dev/null @@ -1,7 +0,0 @@ -#include "syscalls.h" - -#ifdef __getresuid - -syscall(getresuid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/getrlimit.S b/mdk-stage1/dietlibc/syscalls.s/getrlimit.S deleted file mode 100644 index 1c63c0196..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getrlimit.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getrlimit,getrlimit) diff --git a/mdk-stage1/dietlibc/syscalls.s/getrusage.S b/mdk-stage1/dietlibc/syscalls.s/getrusage.S deleted file mode 100644 index 2972c4938..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getrusage.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getrusage,getrusage) diff --git a/mdk-stage1/dietlibc/syscalls.s/getsid.S b/mdk-stage1/dietlibc/syscalls.s/getsid.S deleted file mode 100644 index cf5cce9d5..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getsid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getsid,getsid) diff --git a/mdk-stage1/dietlibc/syscalls.s/gettimeofday.S b/mdk-stage1/dietlibc/syscalls.s/gettimeofday.S deleted file mode 100644 index f364b787a..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/gettimeofday.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(gettimeofday,gettimeofday) diff --git a/mdk-stage1/dietlibc/syscalls.s/getuid.S b/mdk-stage1/dietlibc/syscalls.s/getuid.S deleted file mode 100644 index c53c25a7a..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/getuid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(getuid,getuid) diff --git a/mdk-stage1/dietlibc/syscalls.s/ioctl.S b/mdk-stage1/dietlibc/syscalls.s/ioctl.S deleted file mode 100644 index 463d319dc..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/ioctl.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(ioctl,ioctl) diff --git a/mdk-stage1/dietlibc/syscalls.s/ioperm.S b/mdk-stage1/dietlibc/syscalls.s/ioperm.S deleted file mode 100644 index 0acfde07a..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/ioperm.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(ioperm,ioperm) diff --git a/mdk-stage1/dietlibc/syscalls.s/iopl.S b/mdk-stage1/dietlibc/syscalls.s/iopl.S deleted file mode 100644 index 06a6c53fb..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/iopl.S +++ /dev/null @@ -1,6 +0,0 @@ - -#include "syscalls.h" - -#ifdef __NR_iopl -syscall(iopl,iopl) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/ipc.S b/mdk-stage1/dietlibc/syscalls.s/ipc.S deleted file mode 100644 index 40479400d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/ipc.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(ipc,__ipc) diff --git a/mdk-stage1/dietlibc/syscalls.s/kill.S b/mdk-stage1/dietlibc/syscalls.s/kill.S deleted file mode 100644 index eb466dd33..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/kill.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(kill,kill) diff --git a/mdk-stage1/dietlibc/syscalls.s/lchown.S b/mdk-stage1/dietlibc/syscalls.s/lchown.S deleted file mode 100644 index 19dfefaef..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/lchown.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(lchown,lchown) diff --git a/mdk-stage1/dietlibc/syscalls.s/link.S b/mdk-stage1/dietlibc/syscalls.s/link.S deleted file mode 100644 index 8015d11c8..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/link.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(link,link) diff --git a/mdk-stage1/dietlibc/syscalls.s/llseek.S b/mdk-stage1/dietlibc/syscalls.s/llseek.S deleted file mode 100644 index 0318b492e..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/llseek.S +++ /dev/null @@ -1,6 +0,0 @@ -#include "dietfeatures.h" -#include "syscalls.h" - -#ifdef __NR__llseek -syscall(_llseek,llseek) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/lseek.S b/mdk-stage1/dietlibc/syscalls.s/lseek.S deleted file mode 100644 index 93707a22a..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/lseek.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(lseek,lseek,__libc_lseek) diff --git a/mdk-stage1/dietlibc/syscalls.s/lstat.S b/mdk-stage1/dietlibc/syscalls.s/lstat.S deleted file mode 100644 index 5720161c0..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/lstat.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(lstat,lstat) diff --git a/mdk-stage1/dietlibc/syscalls.s/lstat64.S b/mdk-stage1/dietlibc/syscalls.s/lstat64.S deleted file mode 100644 index 33fd5ab94..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/lstat64.S +++ /dev/null @@ -1,8 +0,0 @@ -#include "dietfeatures.h" -#include "syscalls.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -syscall(lstat64,__dietlibc_lstat64) -#else -syscall(lstat64,lstat64) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/mkdir.S b/mdk-stage1/dietlibc/syscalls.s/mkdir.S deleted file mode 100644 index d6214ee46..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/mkdir.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(mkdir,mkdir) diff --git a/mdk-stage1/dietlibc/syscalls.s/mknod.S b/mdk-stage1/dietlibc/syscalls.s/mknod.S deleted file mode 100644 index c1b2af12d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/mknod.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(mknod,mknod) diff --git a/mdk-stage1/dietlibc/syscalls.s/mlockall.S b/mdk-stage1/dietlibc/syscalls.s/mlockall.S deleted file mode 100644 index 6ad0eef9d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/mlockall.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(mlockall,mlockall) diff --git a/mdk-stage1/dietlibc/syscalls.s/mount.S b/mdk-stage1/dietlibc/syscalls.s/mount.S deleted file mode 100644 index 2fd845561..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/mount.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(mount,mount) diff --git a/mdk-stage1/dietlibc/syscalls.s/mprotect.S b/mdk-stage1/dietlibc/syscalls.s/mprotect.S deleted file mode 100644 index 73e9a8e17..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/mprotect.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(mprotect,mprotect) diff --git a/mdk-stage1/dietlibc/syscalls.s/mremap.S b/mdk-stage1/dietlibc/syscalls.s/mremap.S deleted file mode 100644 index 259ccec99..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/mremap.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(mremap,mremap) diff --git a/mdk-stage1/dietlibc/syscalls.s/munlockall.S b/mdk-stage1/dietlibc/syscalls.s/munlockall.S deleted file mode 100644 index 776811dea..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/munlockall.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(munlockall,munlockall) diff --git a/mdk-stage1/dietlibc/syscalls.s/munmap.S b/mdk-stage1/dietlibc/syscalls.s/munmap.S deleted file mode 100644 index b43a7b22d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/munmap.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(munmap,munmap) diff --git a/mdk-stage1/dietlibc/syscalls.s/nanosleep.S b/mdk-stage1/dietlibc/syscalls.s/nanosleep.S deleted file mode 100644 index 279a52604..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/nanosleep.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(nanosleep,nanosleep,__libc_nanosleep) diff --git a/mdk-stage1/dietlibc/syscalls.s/nice.S b/mdk-stage1/dietlibc/syscalls.s/nice.S deleted file mode 100644 index 7d3f740b2..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/nice.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(nice,nice) diff --git a/mdk-stage1/dietlibc/syscalls.s/open.S b/mdk-stage1/dietlibc/syscalls.s/open.S deleted file mode 100644 index 280efd0d9..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/open.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(open,open,__libc_open) diff --git a/mdk-stage1/dietlibc/syscalls.s/pause.S b/mdk-stage1/dietlibc/syscalls.s/pause.S deleted file mode 100644 index cdf42cabd..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/pause.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(pause,pause,__libc_pause) diff --git a/mdk-stage1/dietlibc/syscalls.s/personality.S b/mdk-stage1/dietlibc/syscalls.s/personality.S deleted file mode 100644 index 34b467084..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/personality.S +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" - -#ifdef __NR_personality -syscall(personality,personality) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/pipe.S b/mdk-stage1/dietlibc/syscalls.s/pipe.S deleted file mode 100644 index 03994d055..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/pipe.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(pipe,pipe) diff --git a/mdk-stage1/dietlibc/syscalls.s/poll.S b/mdk-stage1/dietlibc/syscalls.s/poll.S deleted file mode 100644 index 359f55ddd..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/poll.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(poll,poll) diff --git a/mdk-stage1/dietlibc/syscalls.s/ptrace.s b/mdk-stage1/dietlibc/syscalls.s/ptrace.s deleted file mode 100644 index 392e6a4ed..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/ptrace.s +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(ptrace,ptrace) diff --git a/mdk-stage1/dietlibc/syscalls.s/pwrite.S b/mdk-stage1/dietlibc/syscalls.s/pwrite.S deleted file mode 100644 index f52ead7b2..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/pwrite.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(pwrite,__pwrite) diff --git a/mdk-stage1/dietlibc/syscalls.s/query_module.S b/mdk-stage1/dietlibc/syscalls.s/query_module.S deleted file mode 100644 index cb2f1d852..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/query_module.S +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" - -#ifdef __NR_query_module -syscall(query_module,query_module) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/read.S b/mdk-stage1/dietlibc/syscalls.s/read.S deleted file mode 100644 index 33fdb7531..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/read.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(read,read,__libc_read) diff --git a/mdk-stage1/dietlibc/syscalls.s/readlink.S b/mdk-stage1/dietlibc/syscalls.s/readlink.S deleted file mode 100644 index 850e77c4e..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/readlink.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(readlink,readlink) diff --git a/mdk-stage1/dietlibc/syscalls.s/readv.S b/mdk-stage1/dietlibc/syscalls.s/readv.S deleted file mode 100644 index 757c26bfb..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/readv.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(readv,readv) diff --git a/mdk-stage1/dietlibc/syscalls.s/rename.S b/mdk-stage1/dietlibc/syscalls.s/rename.S deleted file mode 100644 index f92f1dc5d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/rename.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(rename,rename) diff --git a/mdk-stage1/dietlibc/syscalls.s/rmdir.S b/mdk-stage1/dietlibc/syscalls.s/rmdir.S deleted file mode 100644 index 341216e8c..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/rmdir.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(rmdir,rmdir) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_max.S b/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_max.S deleted file mode 100644 index caf403672..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_max.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_get_priority_max,sched_get_priority_max) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_min.S b/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_min.S deleted file mode 100644 index a0c3337dc..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_get_priority_min.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_get_priority_min,sched_get_priority_min) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_getparam.S b/mdk-stage1/dietlibc/syscalls.s/sched_getparam.S deleted file mode 100644 index 7190a40ae..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_getparam.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_getparam,sched_getparam) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_getscheduler.S b/mdk-stage1/dietlibc/syscalls.s/sched_getscheduler.S deleted file mode 100644 index 08709b65e..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_getscheduler.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_getscheduler,sched_getscheduler) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_rr_get_interval.S b/mdk-stage1/dietlibc/syscalls.s/sched_rr_get_interval.S deleted file mode 100644 index 150b9a98d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_rr_get_interval.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_rr_get_interval,sched_rr_get_interval) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_setparam.S b/mdk-stage1/dietlibc/syscalls.s/sched_setparam.S deleted file mode 100644 index 3a6dd1dcc..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_setparam.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_setparam,sched_setparam) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_setscheduler.S b/mdk-stage1/dietlibc/syscalls.s/sched_setscheduler.S deleted file mode 100644 index 27869d6ce..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_setscheduler.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_setscheduler,sched_setscheduler) diff --git a/mdk-stage1/dietlibc/syscalls.s/sched_yield.S b/mdk-stage1/dietlibc/syscalls.s/sched_yield.S deleted file mode 100644 index ccb9ac1d0..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sched_yield.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sched_yield,sched_yield) diff --git a/mdk-stage1/dietlibc/syscalls.s/select.S b/mdk-stage1/dietlibc/syscalls.s/select.S deleted file mode 100644 index f585d0449..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/select.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(select,select) diff --git a/mdk-stage1/dietlibc/syscalls.s/sendfile.S b/mdk-stage1/dietlibc/syscalls.s/sendfile.S deleted file mode 100644 index 12d6195dd..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sendfile.S +++ /dev/null @@ -1,6 +0,0 @@ -#include "syscalls.h" -#include "dietwarning.h" - -syscall_weak(sendfile,sendfile,__libc_sendfile) - -link_warning(sendfile,"sendfile is not portable and does not support large files") diff --git a/mdk-stage1/dietlibc/syscalls.s/setdomainname.S b/mdk-stage1/dietlibc/syscalls.s/setdomainname.S deleted file mode 100644 index eaade25da..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setdomainname.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setdomainname,setdomainname) diff --git a/mdk-stage1/dietlibc/syscalls.s/setgid.S b/mdk-stage1/dietlibc/syscalls.s/setgid.S deleted file mode 100644 index 69b18a9c9..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setgid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setgid,setgid) diff --git a/mdk-stage1/dietlibc/syscalls.s/setgroups.S b/mdk-stage1/dietlibc/syscalls.s/setgroups.S deleted file mode 100644 index ce8e800a6..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setgroups.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setgroups,setgroups) diff --git a/mdk-stage1/dietlibc/syscalls.s/sethostname.S b/mdk-stage1/dietlibc/syscalls.s/sethostname.S deleted file mode 100644 index 7616d4848..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sethostname.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sethostname,sethostname) diff --git a/mdk-stage1/dietlibc/syscalls.s/setitimer.S b/mdk-stage1/dietlibc/syscalls.s/setitimer.S deleted file mode 100644 index bcb0623ba..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setitimer.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setitimer,setitimer) diff --git a/mdk-stage1/dietlibc/syscalls.s/setpgid.S b/mdk-stage1/dietlibc/syscalls.s/setpgid.S deleted file mode 100644 index e93db31dc..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setpgid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setpgid,setpgid) diff --git a/mdk-stage1/dietlibc/syscalls.s/setpriority.S b/mdk-stage1/dietlibc/syscalls.s/setpriority.S deleted file mode 100644 index 57d7bc388..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setpriority.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setpriority,setpriority) diff --git a/mdk-stage1/dietlibc/syscalls.s/setregid.S b/mdk-stage1/dietlibc/syscalls.s/setregid.S deleted file mode 100644 index 3a7abbc28..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setregid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setregid,setregid) diff --git a/mdk-stage1/dietlibc/syscalls.s/setresgid.S b/mdk-stage1/dietlibc/syscalls.s/setresgid.S deleted file mode 100644 index 64cbac94e..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setresgid.S +++ /dev/null @@ -1,7 +0,0 @@ -#include "syscalls.h" - -#ifdef __setresgid - -syscall(setresgid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/setresuid.S b/mdk-stage1/dietlibc/syscalls.s/setresuid.S deleted file mode 100644 index 20b6abee9..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setresuid.S +++ /dev/null @@ -1,7 +0,0 @@ -#include "syscalls.h" - -#ifdef __setresuid - -syscall(setresuid) - -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/setreuid.S b/mdk-stage1/dietlibc/syscalls.s/setreuid.S deleted file mode 100644 index 33ca8deed..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setreuid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setreuid,setreuid) diff --git a/mdk-stage1/dietlibc/syscalls.s/setrlimit.S b/mdk-stage1/dietlibc/syscalls.s/setrlimit.S deleted file mode 100644 index 605105658..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setrlimit.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setrlimit,setrlimit) diff --git a/mdk-stage1/dietlibc/syscalls.s/setsid.S b/mdk-stage1/dietlibc/syscalls.s/setsid.S deleted file mode 100644 index d1ef1c58e..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setsid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setsid,setsid) diff --git a/mdk-stage1/dietlibc/syscalls.s/setuid.S b/mdk-stage1/dietlibc/syscalls.s/setuid.S deleted file mode 100644 index d20571cbf..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/setuid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(setuid,setuid) diff --git a/mdk-stage1/dietlibc/syscalls.s/sigaction.S b/mdk-stage1/dietlibc/syscalls.s/sigaction.S deleted file mode 100644 index 32382870c..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sigaction.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sigaction,sigaction) diff --git a/mdk-stage1/dietlibc/syscalls.s/sigaltstack.S b/mdk-stage1/dietlibc/syscalls.s/sigaltstack.S deleted file mode 100644 index b07d90f40..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sigaltstack.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(sigaltstack,sigaltstack,__sigaltstack) diff --git a/mdk-stage1/dietlibc/syscalls.s/signal.S b/mdk-stage1/dietlibc/syscalls.s/signal.S deleted file mode 100644 index 86c4d5db0..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/signal.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(signal,signal) diff --git a/mdk-stage1/dietlibc/syscalls.s/sigpending.S b/mdk-stage1/dietlibc/syscalls.s/sigpending.S deleted file mode 100644 index 08715bef5..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sigpending.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sigpending,sigpending) diff --git a/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S b/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S deleted file mode 100644 index 07f5b9d26..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sigprocmask.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(sigprocmask,sigprocmask,__sigprocmask) diff --git a/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S b/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S deleted file mode 100644 index 062264ab6..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sigsuspend.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(sigsuspend,sigsuspend,__libc_sigsuspend) diff --git a/mdk-stage1/dietlibc/syscalls.s/socketcall.S b/mdk-stage1/dietlibc/syscalls.s/socketcall.S deleted file mode 100644 index 5837c049a..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/socketcall.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(socketcall,socketcall) diff --git a/mdk-stage1/dietlibc/syscalls.s/stat.S b/mdk-stage1/dietlibc/syscalls.s/stat.S deleted file mode 100644 index 2aa3bc088..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/stat.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(stat,stat) diff --git a/mdk-stage1/dietlibc/syscalls.s/stat64.S b/mdk-stage1/dietlibc/syscalls.s/stat64.S deleted file mode 100644 index 734fcab20..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/stat64.S +++ /dev/null @@ -1,8 +0,0 @@ -#include "dietfeatures.h" -#include "syscalls.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -syscall(stat64,__dietlibc_stat64) -#else -syscall(stat64,stat64) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/statfs.S b/mdk-stage1/dietlibc/syscalls.s/statfs.S deleted file mode 100644 index 7560f569d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/statfs.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(statfs,statfs) diff --git a/mdk-stage1/dietlibc/syscalls.s/stime.S b/mdk-stage1/dietlibc/syscalls.s/stime.S deleted file mode 100644 index 9d9f5bf0a..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/stime.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(stime,stime) diff --git a/mdk-stage1/dietlibc/syscalls.s/swapoff.S b/mdk-stage1/dietlibc/syscalls.s/swapoff.S deleted file mode 100644 index f75ec94e0..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/swapoff.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(swapoff,swapoff) diff --git a/mdk-stage1/dietlibc/syscalls.s/swapon.S b/mdk-stage1/dietlibc/syscalls.s/swapon.S deleted file mode 100644 index d10594168..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/swapon.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(swapon,swapon) diff --git a/mdk-stage1/dietlibc/syscalls.s/symlink.S b/mdk-stage1/dietlibc/syscalls.s/symlink.S deleted file mode 100644 index 07a6a7fdc..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/symlink.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(symlink,symlink) diff --git a/mdk-stage1/dietlibc/syscalls.s/sync.S b/mdk-stage1/dietlibc/syscalls.s/sync.S deleted file mode 100644 index 1ee021693..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sync.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sync,sync) diff --git a/mdk-stage1/dietlibc/syscalls.s/sysctl.S b/mdk-stage1/dietlibc/syscalls.s/sysctl.S deleted file mode 100644 index 536e62b3d..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sysctl.S +++ /dev/null @@ -1,5 +0,0 @@ -#include "syscalls.h" - -#ifdef __NR_sysctl -syscall(sysctl,_sysctl) -#endif diff --git a/mdk-stage1/dietlibc/syscalls.s/sysinfo.S b/mdk-stage1/dietlibc/syscalls.s/sysinfo.S deleted file mode 100644 index eaec7941e..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/sysinfo.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(sysinfo,sysinfo) diff --git a/mdk-stage1/dietlibc/syscalls.s/syslog.S b/mdk-stage1/dietlibc/syscalls.s/syslog.S deleted file mode 100644 index 6af3c4eac..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/syslog.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(syslog,__syscall_syslog) diff --git a/mdk-stage1/dietlibc/syscalls.s/time.S b/mdk-stage1/dietlibc/syscalls.s/time.S deleted file mode 100644 index 26c79091c..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/time.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(time,time) diff --git a/mdk-stage1/dietlibc/syscalls.s/times.S b/mdk-stage1/dietlibc/syscalls.s/times.S deleted file mode 100644 index dcc8a6dd0..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/times.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(times,times) diff --git a/mdk-stage1/dietlibc/syscalls.s/truncate.S b/mdk-stage1/dietlibc/syscalls.s/truncate.S deleted file mode 100644 index 7052bdcee..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/truncate.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(truncate,truncate) diff --git a/mdk-stage1/dietlibc/syscalls.s/umask.S b/mdk-stage1/dietlibc/syscalls.s/umask.S deleted file mode 100644 index 9f8ffeda6..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/umask.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(umask,umask) diff --git a/mdk-stage1/dietlibc/syscalls.s/umount.S b/mdk-stage1/dietlibc/syscalls.s/umount.S deleted file mode 100644 index 4a423d964..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/umount.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(umount,umount) diff --git a/mdk-stage1/dietlibc/syscalls.s/umount2.S b/mdk-stage1/dietlibc/syscalls.s/umount2.S deleted file mode 100644 index 4cdd6a200..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/umount2.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(umount2,umount2) diff --git a/mdk-stage1/dietlibc/syscalls.s/uname.S b/mdk-stage1/dietlibc/syscalls.s/uname.S deleted file mode 100644 index a460d2aa6..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/uname.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(uname,uname) diff --git a/mdk-stage1/dietlibc/syscalls.s/unlink.S b/mdk-stage1/dietlibc/syscalls.s/unlink.S deleted file mode 100644 index bd6713061..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/unlink.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(unlink,unlink) diff --git a/mdk-stage1/dietlibc/syscalls.s/utime.S b/mdk-stage1/dietlibc/syscalls.s/utime.S deleted file mode 100644 index 08cd22158..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/utime.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(utime,utime) diff --git a/mdk-stage1/dietlibc/syscalls.s/vhangup.S b/mdk-stage1/dietlibc/syscalls.s/vhangup.S deleted file mode 100644 index 6e2d1d343..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/vhangup.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(vhangup,vhangup) diff --git a/mdk-stage1/dietlibc/syscalls.s/wait4.S b/mdk-stage1/dietlibc/syscalls.s/wait4.S deleted file mode 100644 index ca6773569..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/wait4.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(wait4,wait4) diff --git a/mdk-stage1/dietlibc/syscalls.s/waitpid.S b/mdk-stage1/dietlibc/syscalls.s/waitpid.S deleted file mode 100644 index 5cdc18afb..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/waitpid.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(waitpid,waitpid,__libc_waitpid) diff --git a/mdk-stage1/dietlibc/syscalls.s/write.S b/mdk-stage1/dietlibc/syscalls.s/write.S deleted file mode 100644 index ba20395df..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/write.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall_weak(write,write,__libc_write) diff --git a/mdk-stage1/dietlibc/syscalls.s/writev.S b/mdk-stage1/dietlibc/syscalls.s/writev.S deleted file mode 100644 index 8ec7aa6b0..000000000 --- a/mdk-stage1/dietlibc/syscalls.s/writev.S +++ /dev/null @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall(writev,writev) |