diff --git a/lang/cem/libcc.ansi/headers/grp.h b/lang/cem/libcc.ansi/headers/grp.h index d881f3b73..6d9d6939b 100644 --- a/lang/cem/libcc.ansi/headers/grp.h +++ b/lang/cem/libcc.ansi/headers/grp.h @@ -6,7 +6,11 @@ struct group { /* see getgrent(3) */ char *gr_name; char *gr_passwd; +#if defined(_POSIX_SOURCE) && defined(_MINIX) + char gr_gid; +#else int gr_gid; +#endif char **gr_mem; }; diff --git a/lang/cem/libcc.ansi/headers/setjmp.h b/lang/cem/libcc.ansi/headers/setjmp.h index 74fbdaab1..d5b636f2a 100644 --- a/lang/cem/libcc.ansi/headers/setjmp.h +++ b/lang/cem/libcc.ansi/headers/setjmp.h @@ -9,9 +9,24 @@ #if !defined(_SETJMP_H) #define _SETJMP_H -typedef char jmp_buf[256]; +/* In a jmp_buf, there is room for: 1 mask (long), 1 flag (int) and 3 + * pointers (stack-pointer, local base and program-counter). This may be + * too big, but that doesn't matter. It could also be too small, when + * sigset_t is larger than a long. + * The identifier __setjmp has a special meaning to the compiler. + */ -int setjmp(jmp_buf __env); +typedef char jmp_buf[ sizeof(long) + sizeof(int) + 3 * sizeof(void *)]; + +int __setjmp(jmp_buf __env, int __savemask); + +#define setjmp(env) __setjmp(env, 0) void longjmp(jmp_buf __env, int __val); +#if defined(_POSIX_SOURCE) +typedef jmp_buf sigjmp_buf; +#define sigsetjmp(env, savemask) __setjmp(env, savemask) +int siglongjmp(sigjmp_buf __env, int __val); +#endif + #endif /* _SETJMP_H */ diff --git a/lang/cem/libcc.ansi/headers/signal.h b/lang/cem/libcc.ansi/headers/signal.h index 4a519e2dd..f4c226c20 100644 --- a/lang/cem/libcc.ansi/headers/signal.h +++ b/lang/cem/libcc.ansi/headers/signal.h @@ -11,6 +11,22 @@ typedef int sig_atomic_t; +#if defined(_POSIX_SOURCE) +#if defined(_MINIX) +typedef unsigned short sigset_t; + +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +struct sigaction { + void (*sa_handler)(int);/* SIG_DFL, SIG_IGN or pointer to function */ + sigset_t sa_mask; /* signals blocked during handling */ + int sa_flags; /* special flags */ +}; +#endif +#endif + #define SIG_ERR ((void (*)(int))-1) #if defined(em22) || defined(em24) || defined(em44) #define SIG_DFL ((void (*)(int))-2) @@ -62,6 +78,15 @@ typedef int sig_atomic_t; #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ #define _NSIG 32 +#elif defined(_MINIX) +/* The following signals are defined but not supported */ +#define SIGCHLD 17 /* child process terminated or stopped */ +#define SIGCONT 18 /* continue if stopped */ +#define SIGSTOP 19 /* stop signal */ +#define SIGTSTP 20 /* interactive stop signal */ +#define SIGTTIN 21 /* background process wants to read */ +#define SIGTTOU 22 /* background process wants to write */ +#define _NSIG 16 #else #define _NSIG 16 #endif /* __USG or __BSD4_2 */ diff --git a/lang/cem/libcc.ansi/headers/stdarg.h b/lang/cem/libcc.ansi/headers/stdarg.h index b3e30be20..d580a98e8 100644 --- a/lang/cem/libcc.ansi/headers/stdarg.h +++ b/lang/cem/libcc.ansi/headers/stdarg.h @@ -14,7 +14,7 @@ typedef char *va_list; #define __vasz(x) ((sizeof(x)+sizeof(int)-1) & ~(sizeof(int) -1)) #define va_start(ap, parmN) (ap = (va_list)&parmN + __vasz(parmN)) -#define va_arg(ap, type) (*((type *)((ap += __vasz(type)) - __vasz(type)))) +#define va_arg(ap, type) (*((type *)(void *)((ap += __vasz(type)) - __vasz(type)))) #define va_end(ap) #endif /* _STDARG_H */ diff --git a/lang/cem/libcc.ansi/headers/stddef.h b/lang/cem/libcc.ansi/headers/stddef.h index 8cc619b4a..27ab5fd1c 100644 --- a/lang/cem/libcc.ansi/headers/stddef.h +++ b/lang/cem/libcc.ansi/headers/stddef.h @@ -11,7 +11,7 @@ #define NULL ((void *)0) -#define offsetof(type, ident) (((size_t) &(((type *)0)->ident))) +#define offsetof(type, ident) ((size_t) &(((type *)0)->ident)) #if _EM_PSIZE == 2 typedef int ptrdiff_t; /* result of substracting two pointers */