diff --git a/Makefile b/Makefile index b2b754b..83bd5c0 100644 --- a/Makefile +++ b/Makefile @@ -180,9 +180,9 @@ help: # all # ================================================= .PHONY: all gcc gdb gprof binutils fd2sfd fd2pragma ira sfdc vasm libnix ixemul libgcc clib2 libdebug libpthread ndk ndk13 min -all: gcc binutils gdb gprof fd2sfd fd2pragma ira sfdc vasm libnix ixemul libgcc clib2 libdebug libpthread ndk ndk13 libSDL12 +all: gcc binutils gdb gprof fd2sfd fd2pragma ira sfdc vasm libnix ixemul libgcc clib2 libdebug libpthread ndk ndk13 libSDL12 $(BUILD)/libnix/libb/libnix4.library -min: binutils gcc gprof libnix libgcc +min: binutils gcc gprof libnix libgcc $(BUILD)/libnix/libb/libnix4.library # ================================================= # clean @@ -902,6 +902,13 @@ $(BUILD)/gcc/_libgcc_done: $(BUILD)/libnix/_done $(BUILD)/libpthread/_done $(LIB $(L0)"install libgcc"$(L1) $(MAKE) -C $(BUILD)/gcc install-target $(L2) @echo "done" >$@ +# ================================================= +# libnix4.library +# ================================================= +$(BUILD)/libnix/libb/libnix4.library: $(BUILD)/gcc/_libgcc_done + $(L0)"make libnix4.library"$(L1) CFLAGS="$(CFLAGS_FOR_TARGET)" \ + $(MAKE) -C $(BUILD)/libnix -f $(PROJECTS)/libnix/Makefile.gcc6 root=$(PROJECTS)/libnix libb/libnix4.library $(L2) + # ================================================= # clib2 # ================================================= diff --git a/sys-include/sys/_pthreadtypes.h b/sys-include/sys/_pthreadtypes.h index f60ab82..c4a5bae 100644 --- a/sys-include/sys/_pthreadtypes.h +++ b/sys-include/sys/_pthreadtypes.h @@ -43,8 +43,8 @@ typedef __uint32_t pthread_t; /* identify a thread */ #define PTHREAD_EXPLICIT_SCHED 2 /* set from provided attribute object */ /* P1003.1c/D10, p. 141 */ -#define PTHREAD_CREATE_DETACHED 0 -#define PTHREAD_CREATE_JOINABLE 1 +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_CREATE_DETACHED 1 #if defined(__AMIGA__) struct pthread_attr; diff --git a/sys-include/sys/dirent.h b/sys-include/sys/dirent.h deleted file mode 100644 index a3fb5c0..0000000 --- a/sys-include/sys/dirent.h +++ /dev/null @@ -1,13 +0,0 @@ -/* includes , which is this file. On a - system which supports , this file is overridden by - dirent.h in the libc/sys/.../sys directory. On a system which does - not support , we will get this file which uses #error to force - an error. */ - -#ifdef __cplusplus -extern "C" { -#endif -#error " not supported" -#ifdef __cplusplus -} -#endif diff --git a/sys-include/sys/resource.h b/sys-include/sys/resource.h index ff0b836..5c1f97a 100644 --- a/sys-include/sys/resource.h +++ b/sys-include/sys/resource.h @@ -3,15 +3,79 @@ #include +/* + * Resource limit IDs + * + * ( Compatibility detail: there are architectures that have + * a different rlimit ID order in the 5-9 range and want + * to keep that order for binary compatibility. The reasons + * are historic and all new rlimits are identical across all + * arches. If an arch has such special order for some rlimits + * then it defines them prior including asm-generic/resource.h. ) + */ + +#define RLIMIT_CPU 0 /* CPU time in sec */ +#define RLIMIT_FSIZE 1 /* Maximum filesize */ +#define RLIMIT_DATA 2 /* max data size */ +#define RLIMIT_STACK 3 /* max stack size */ +#define RLIMIT_CORE 4 /* max core file size */ + +#ifndef RLIMIT_RSS +# define RLIMIT_RSS 5 /* max resident set size */ +#endif + +#ifndef RLIMIT_NPROC +# define RLIMIT_NPROC 6 /* max number of processes */ +#endif + +#ifndef RLIMIT_NOFILE +# define RLIMIT_NOFILE 7 /* max number of open files */ +#endif + +#ifndef RLIMIT_MEMLOCK +# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ +#endif + +#ifndef RLIMIT_AS +# define RLIMIT_AS 9 /* address space limit */ +#endif + +#define RLIMIT_LOCKS 10 /* maximum file locks held */ +#define RLIMIT_SIGPENDING 11 /* max number of pending signals */ +#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */ +#define RLIMIT_NICE 13 /* max nice prio allowed to raise to + 0-39 for nice level 19 .. -20 */ +#define RLIMIT_RTPRIO 14 /* maximum realtime priority */ +#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */ +#define RLIM_NLIMITS 16 + +/* + * SuS says limits have to be unsigned. + * Which makes a ton more sense anyway. + * + * Some architectures override this (for compatibility reasons): + */ +#ifndef RLIM_INFINITY +# define RLIM_INFINITY (~0UL) +#endif + #define RUSAGE_SELF 0 /* calling process */ #define RUSAGE_CHILDREN -1 /* terminated child processes */ struct rusage { - struct timeval ru_utime; /* user time used */ - struct timeval ru_stime; /* system time used */ + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ }; -__stdargs int getrusage (int, struct rusage*); +typedef unsigned rlim_t; + +struct rlimit { + rlim_t rlim_cur; /* Soft limit */ + rlim_t rlim_max; /* Hard limit (ceiling for rlim_cur) */ +}; + +__stdargs int getrusage(int, struct rusage*); +__stdargs int getrlimit(int resource, struct rlimit *rlim); +__stdargs int setrlimit(int resource, struct rlimit *rlim); #endif - diff --git a/sys-include/sys/unistd.h b/sys-include/sys/unistd.h index 442e6db..c9bdea2 100644 --- a/sys-include/sys/unistd.h +++ b/sys-include/sys/unistd.h @@ -13,7 +13,8 @@ extern "C" { #include #include -extern char **environ; +extern char ***environ_ptr; +#define environ (*environ_ptr) __stdargs void _exit (int __status) _ATTRIBUTE ((__noreturn__)); diff --git a/sys-include/sys/wait.h b/sys-include/sys/wait.h index f17e53f..7c74daa 100644 --- a/sys-include/sys/wait.h +++ b/sys-include/sys/wait.h @@ -26,6 +26,14 @@ extern "C" { #define WTERMSIG(w) ((w) & 0x7f) #define WSTOPSIG WEXITSTATUS +union wait { + int w_termsig; + int w_coredump; + int w_retcode; + int w_stopsig; + int w_status; +}; + pid_t wait (int *); pid_t waitpid (pid_t, int *, int);