Ensure that PTRACE_GETSIGINFO et al are always defined on Linux

* configure.ac (AC_CHECK_DECLS): Add PTRACE_* constants.
* defs.h [LINUX]: Define those PTRACE_* constants that are not provided
by <sys/ptrace.h>.
This commit is contained in:
Дмитрий Левин 2011-03-15 17:19:09 +00:00
parent 4e4fcafe9e
commit 03aefdadb2
2 changed files with 21 additions and 8 deletions

View File

@ -306,6 +306,16 @@ AC_CHECK_MEMBERS([struct sigcontext.sc_hi2],,, [#include <signal.h>
AC_CHECK_DECLS([sys_errlist])
AC_CHECK_DECLS([sys_siglist, _sys_siglist],,, [#include <signal.h>])
AC_CHECK_DECLS([\
PTRACE_SETOPTIONS, \
PTRACE_GETEVENTMSG, \
PTRACE_GETSIGINFO, \
PTRACE_O_TRACEFORK, \
PTRACE_O_TRACEVFORK, \
PTRACE_O_TRACECLONE, \
PTRACE_EVENT_FORK, \
PTRACE_EVENT_VFORK, \
PTRACE_EVENT_CLONE],,, [#include <sys/ptrace.h>])
AC_PATH_PROG([PERL], [perl])

19
defs.h
View File

@ -309,29 +309,32 @@ extern int mp_ioctl (int f, int c, void *a, int s);
#endif
#ifdef LINUX
# ifndef PTRACE_SETOPTIONS
# if !HAVE_DECL_PTRACE_SETOPTIONS
# define PTRACE_SETOPTIONS 0x4200
# endif
# ifndef PTRACE_GETEVENTMSG
# if !HAVE_DECL_PTRACE_GETEVENTMSG
# define PTRACE_GETEVENTMSG 0x4201
# endif
# ifndef PTRACE_O_TRACEFORK
# if !HAVE_DECL_PTRACE_GETSIGINFO
# define PTRACE_GETSIGINFO 0x4202
# endif
# if !HAVE_DECL_PTRACE_O_TRACEFORK
# define PTRACE_O_TRACEFORK 0x00000002
# endif
# ifndef PTRACE_O_TRACEVFORK
# if !HAVE_DECL_PTRACE_O_TRACEVFORK
# define PTRACE_O_TRACEVFORK 0x00000004
# endif
# ifndef PTRACE_O_TRACECLONE
# if !HAVE_DECL_PTRACE_O_TRACECLONE
# define PTRACE_O_TRACECLONE 0x00000008
# endif
# ifndef PTRACE_EVENT_FORK
# if !HAVE_DECL_PTRACE_EVENT_FORK
# define PTRACE_EVENT_FORK 1
# endif
# ifndef PTRACE_EVENT_VFORK
# if !HAVE_DECL_PTRACE_EVENT_VFORK
# define PTRACE_EVENT_VFORK 2
# endif
# ifndef PTRACE_EVENT_CLONE
# if !HAVE_DECL_PTRACE_EVENT_CLONE
# define PTRACE_EVENT_CLONE 3
# endif
#endif /* LINUX */