changed setjmp implementation for POSIX
made some changes for MINIX
This commit is contained in:
parent
1fdf2d2e19
commit
777fb8a624
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue