Add UnixWare support to configure
This commit is contained in:
parent
aec6238b12
commit
ea78f0f771
@ -1,3 +1,7 @@
|
||||
Mon Nov 29 16:33:04 CET 1999 Wichert Akkerman <wakkerma@debian.org>
|
||||
|
||||
* Merge patches from John Hughes to make configure support UnixWare
|
||||
|
||||
Sat Nov 27 21:38:17 CET 1999 Wichert Akkerman <wakkerma@debian.org>
|
||||
|
||||
* Enhance sys_query_module
|
||||
|
@ -9,13 +9,6 @@ lot of processes at once.
|
||||
|
||||
There is no thread support but it wouldn't be very difficult to add it.
|
||||
|
||||
There is currently no configure-support yet for UnixWare system. To compile
|
||||
on UnixWare 2.1 you need to add the following to config.h yourself:
|
||||
|
||||
#define SVR4_MP 1
|
||||
#define UNIXWARE 2
|
||||
#define HAVE_POLLABLE_PROCFS 1
|
||||
|
||||
On UnixWare using the -f option to follow forked children sometimes shows
|
||||
many "unfinished" system calls as strace bounces between each runnable child.
|
||||
A crude workaround for this is available by adding
|
||||
|
12
acconfig.h
12
acconfig.h
@ -9,6 +9,9 @@
|
||||
or a derivative like Solaris 2.x or Irix 5.x. */
|
||||
#undef SVR4
|
||||
|
||||
/* Define for UnixWare systems. */
|
||||
#undef UNIXWARE
|
||||
|
||||
/* Define if this is an i386, i486 or pentium architecture. */
|
||||
#undef I386
|
||||
|
||||
@ -30,9 +33,18 @@
|
||||
/* Define if this is an powerpc architecture. */
|
||||
#undef POWERPC
|
||||
|
||||
/* Define if you have a SVR4 MP type procfs. I.E. /dev/xxx/ctl,
|
||||
/dev/xxx/status. Also implies that you have the pr_lwp
|
||||
member in prstatus. */
|
||||
#undef HAVE_MP_PROCFS
|
||||
|
||||
/* Define if you have SVR4 and the poll system call works on /proc files. */
|
||||
#undef HAVE_POLLABLE_PROCFS
|
||||
|
||||
/* Define if you have SVR4_MP and you need to use the poll hack
|
||||
to avoid unfinished system calls. */
|
||||
#undef POLL_HACK
|
||||
|
||||
/* Define if the prstatus structure in sys/procfs.h has a pr_syscall member. */
|
||||
#undef HAVE_PR_SYSCALL
|
||||
|
||||
|
87
aclocal.m4
vendored
87
aclocal.m4
vendored
@ -68,6 +68,66 @@ then
|
||||
fi
|
||||
])
|
||||
|
||||
dnl ### A macro to determine if we have a "MP" type procfs
|
||||
AC_DEFUN(AC_MP_PROCFS,
|
||||
[AC_MSG_CHECKING(for MP procfs)
|
||||
AC_CACHE_VAL(ac_cv_mp_procfs,
|
||||
[AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <sys/procfs.h>
|
||||
|
||||
main()
|
||||
{
|
||||
int pid;
|
||||
char proc[32];
|
||||
FILE *ctl;
|
||||
FILE *status;
|
||||
int cmd;
|
||||
struct pstatus pstatus;
|
||||
|
||||
if ((pid = fork()) == 0) {
|
||||
pause();
|
||||
exit(0);
|
||||
}
|
||||
sprintf(proc, "/proc/%d/ctl", pid);
|
||||
if ((ctl = fopen(proc, "w")) == NULL)
|
||||
goto fail;
|
||||
sprintf(proc, "/proc/%d/status", pid);
|
||||
if ((status = fopen (proc, "r")) == NULL)
|
||||
goto fail;
|
||||
cmd = PCSTOP;
|
||||
if (write (fileno (ctl), &cmd, sizeof cmd) < 0)
|
||||
goto fail;
|
||||
if (read (fileno (status), &pstatus, sizeof pstatus) < 0)
|
||||
goto fail;
|
||||
kill(pid, SIGKILL);
|
||||
exit(0);
|
||||
fail:
|
||||
kill(pid, SIGKILL);
|
||||
exit(1);
|
||||
}
|
||||
],
|
||||
ac_cv_mp_procfs=yes,
|
||||
ac_cv_mp_procfs=no,
|
||||
[
|
||||
# Guess or punt.
|
||||
case "$host_os" in
|
||||
svr4.2*|svr5*)
|
||||
ac_cv_mp_procfs=yes
|
||||
;;
|
||||
*)
|
||||
ac_cv_mp_procfs=no
|
||||
;;
|
||||
esac
|
||||
])])
|
||||
AC_MSG_RESULT($ac_cv_mp_procfs)
|
||||
if test "$ac_cv_mp_procfs" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_MP_PROCFS)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl ### A macro to determine if procfs is pollable.
|
||||
AC_DEFUN(AC_POLLABLE_PROCFS,
|
||||
[AC_MSG_CHECKING(for pollable procfs)
|
||||
@ -79,6 +139,21 @@ AC_CACHE_VAL(ac_cv_pollable_procfs,
|
||||
#include <sys/stropts.h>
|
||||
#include <poll.h>
|
||||
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
#define PIOCSTOP PCSTOP
|
||||
#define POLLWANT POLLWRNORM
|
||||
#define PROC "/proc/%d/ctl"
|
||||
#define PROC_MODE "w"
|
||||
int IOCTL (int fd, int cmd, int arg) {
|
||||
return write (fd, &cmd, sizeof cmd);
|
||||
}
|
||||
#else
|
||||
#define POLLWANT POLLPRI
|
||||
#define PROC "/proc/%d"
|
||||
#define PROC_MODE "r+"
|
||||
#define IOCTL ioctl
|
||||
#endif
|
||||
|
||||
main()
|
||||
{
|
||||
int pid;
|
||||
@ -90,16 +165,16 @@ main()
|
||||
pause();
|
||||
exit(0);
|
||||
}
|
||||
sprintf(proc, "/proc/%d", pid);
|
||||
if ((pfp = fopen(proc, "r+")) == NULL)
|
||||
sprintf(proc, PROC, pid);
|
||||
if ((pfp = fopen(proc, PROC_MODE)) == NULL)
|
||||
goto fail;
|
||||
if (ioctl(fileno(pfp), PIOCSTOP, NULL) < 0)
|
||||
if (IOCTL(fileno(pfp), PIOCSTOP, NULL) < 0)
|
||||
goto fail;
|
||||
pfd.fd = fileno(pfp);
|
||||
pfd.events = POLLPRI;
|
||||
pfd.events = POLLWANT;
|
||||
if (poll(&pfd, 1, 0) < 0)
|
||||
goto fail;
|
||||
if (!(pfd.revents & POLLPRI))
|
||||
if (!(pfd.revents & POLLWANT))
|
||||
goto fail;
|
||||
kill(pid, SIGKILL);
|
||||
exit(0);
|
||||
@ -113,7 +188,7 @@ ac_cv_pollable_procfs=no,
|
||||
[
|
||||
# Guess or punt.
|
||||
case "$host_os" in
|
||||
solaris2*|irix5*)
|
||||
solaris2*|irix5*|svr4.2uw*|svr5*)
|
||||
ac_cv_pollable_procfs=yes
|
||||
;;
|
||||
*)
|
||||
|
12
configure.in
12
configure.in
@ -16,6 +16,9 @@ solaris2*)
|
||||
sysv4*)
|
||||
opsys=svr4
|
||||
;;
|
||||
sysv5*)
|
||||
opsys=svr4
|
||||
;;
|
||||
irix[56]*)
|
||||
opsys=svr4
|
||||
;;
|
||||
@ -77,11 +80,20 @@ CFLAGS="-D_GNU_SOURCE $CFLAGS"
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_SUBST(opsys)
|
||||
AC_DEFINE_UNQUOTED($OPSYS)
|
||||
case "$host_os" in
|
||||
sysv4.2uw*)
|
||||
AC_DEFINE(UNIXWARE, 2)
|
||||
;;
|
||||
sysv5*)
|
||||
AC_DEFINE(UNIXWARE, 7)
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(arch)
|
||||
AC_DEFINE_UNQUOTED($ARCH)
|
||||
AC_SUBST(osarch)
|
||||
AC_PROG_CC
|
||||
AC_PROG_HOSTCC($host_alias $host)
|
||||
AC_MP_PROCFS
|
||||
AC_POLLABLE_PROCFS
|
||||
AC_STRUCT_PR_SYSCALL
|
||||
AC_STRUCT_MSG_CONTROL
|
||||
|
6
defs.h
6
defs.h
@ -82,7 +82,7 @@
|
||||
|
||||
#ifdef SVR4
|
||||
#include <sys/procfs.h>
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#else /* !SVR4 */
|
||||
@ -148,7 +148,7 @@ extern int ptrace();
|
||||
|
||||
|
||||
#ifdef SVR4
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
extern int mp_ioctl (int f, int c, void *a, int s);
|
||||
#define IOCTL(f,c,a) mp_ioctl (f, c, a, sizeof *a)
|
||||
#define IOCTL_STATUS(t) \
|
||||
@ -204,7 +204,7 @@ struct tcb {
|
||||
long inst[2]; /* Instructions on above */
|
||||
int pfd; /* proc file descriptor */
|
||||
#ifdef SVR4
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
int pfd_stat;
|
||||
int pfd_as;
|
||||
pstatus_t status;
|
||||
|
2
ioctl.c
2
ioctl.c
@ -108,7 +108,7 @@ long code, arg;
|
||||
#endif /* !LINUX */
|
||||
return sock_ioctl(tcp, code, arg);
|
||||
#ifdef SVR4
|
||||
#ifndef SVR4_MP
|
||||
#ifndef HAVE_MP_PROCFS
|
||||
case 'q':
|
||||
return proc_ioctl(tcp, code, arg);
|
||||
#endif
|
||||
|
4
proc.c
4
proc.c
@ -30,7 +30,7 @@
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef SVR4
|
||||
#ifndef SVR4_MP
|
||||
#ifndef HAVE_MP_PROCFS
|
||||
|
||||
static struct xlat proc_status_flags[] = {
|
||||
{ PR_STOPPED, "PR_STOPPED" },
|
||||
@ -183,6 +183,6 @@ int code, arg;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SVR4_MP */
|
||||
#endif /* HAVE_MP_PROCFS */
|
||||
#endif /* SVR4 */
|
||||
|
||||
|
8
strace.c
8
strace.c
@ -45,7 +45,7 @@
|
||||
#ifdef SVR4
|
||||
#include <sys/stropts.h>
|
||||
#include <poll.h>
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#endif
|
||||
@ -108,7 +108,7 @@ static int proc_poll_pipe[2] = { -1, -1 };
|
||||
|
||||
#endif /* !HAVE_POLLABLE_PROCFS */
|
||||
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
#define POLLWANT POLLWRNORM
|
||||
#else
|
||||
#define POLLWANT POLLPRI
|
||||
@ -581,7 +581,7 @@ int attaching;
|
||||
static int last_pfd;
|
||||
#endif
|
||||
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
/* Open the process pseudo-files in /proc. */
|
||||
sprintf(proc, "/proc/%d/ctl", tcp->pid);
|
||||
if ((tcp->pfd = open(proc, O_WRONLY|O_EXCL)) < 0) {
|
||||
@ -1736,7 +1736,7 @@ struct tcb *tcp;
|
||||
tcp_last = NULL;
|
||||
}
|
||||
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
|
||||
int mp_ioctl (int fd, int cmd, void *arg, int size) {
|
||||
|
||||
|
2
system.c
2
system.c
@ -1356,7 +1356,7 @@ struct tcb *tcp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* !SVR4_MP */
|
||||
#endif /* !UNIXWARE */
|
||||
|
||||
#endif /* !MIPS */
|
||||
|
||||
|
4
util.c
4
util.c
@ -624,7 +624,7 @@ char *laddr;
|
||||
#endif /* SUNOS4 */
|
||||
|
||||
#ifdef SVR4
|
||||
#ifdef SVR4_MP
|
||||
#ifdef HAVE_MP_PROCFS
|
||||
if (pread(tcp->pfd_as, laddr, len, addr) == -1)
|
||||
return -1;
|
||||
#else
|
||||
@ -643,7 +643,7 @@ char *laddr;
|
||||
if (read(tcp->pfd, laddr, len) == -1)
|
||||
return -1;
|
||||
#endif /* !HAVE_PREAD */
|
||||
#endif /* SVR4_MP */
|
||||
#endif /* HAVE_MP_PROCFS */
|
||||
#endif /* SVR4 */
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user