+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
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
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
/* 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
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)
#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;
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);
[
# Guess or punt.
case "$host_os" in
-solaris2*|irix5*)
+solaris2*|irix5*|svr4.2uw*|svr5*)
ac_cv_pollable_procfs=yes
;;
*)
sysv4*)
opsys=svr4
;;
+sysv5*)
+ opsys=svr4
+ ;;
irix[56]*)
opsys=svr4
;;
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
#ifdef SVR4
#include <sys/procfs.h>
-#ifdef SVR4_MP
+#ifdef HAVE_MP_PROCFS
#include <sys/uio.h>
#endif
#else /* !SVR4 */
#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) \
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;
#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
#include "defs.h"
#ifdef SVR4
-#ifndef SVR4_MP
+#ifndef HAVE_MP_PROCFS
static struct xlat proc_status_flags[] = {
{ PR_STOPPED, "PR_STOPPED" },
}
}
-#endif /* SVR4_MP */
+#endif /* HAVE_MP_PROCFS */
#endif /* SVR4 */
#ifdef SVR4
#include <sys/stropts.h>
#include <poll.h>
-#ifdef SVR4_MP
+#ifdef HAVE_MP_PROCFS
#include <sys/uio.h>
#endif
#endif
#endif /* !HAVE_POLLABLE_PROCFS */
-#ifdef SVR4_MP
+#ifdef HAVE_MP_PROCFS
#define POLLWANT POLLWRNORM
#else
#define POLLWANT POLLPRI
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) {
tcp_last = NULL;
}
-#ifdef SVR4_MP
+#ifdef HAVE_MP_PROCFS
int mp_ioctl (int fd, int cmd, void *arg, int size) {
}
return 0;
}
-#endif /* !SVR4_MP */
+#endif /* !UNIXWARE */
#endif /* !MIPS */
#endif /* SUNOS4 */
#ifdef SVR4
-#ifdef SVR4_MP
+#ifdef HAVE_MP_PROCFS
if (pread(tcp->pfd_as, laddr, len, addr) == -1)
return -1;
#else
if (read(tcp->pfd, laddr, len) == -1)
return -1;
#endif /* !HAVE_PREAD */
-#endif /* SVR4_MP */
+#endif /* HAVE_MP_PROCFS */
#endif /* SVR4 */
return 0;