Use autoconf to check for p_corefile in struct proc, rather than
authorNickolai Zeldovich <kolya@mit.edu>
Fri, 15 Feb 2002 05:07:13 +0000 (05:07 +0000)
committerNickolai Zeldovich <kolya@mit.edu>
Fri, 15 Feb 2002 05:07:13 +0000 (05:07 +0000)
assuming it exists in Solaris 7 and above; nneul@umr.edu reports
that it doesn't for some kernel revision.

acinclude.m4
src/cf/solaris-pcorefile.m4 [new file with mode: 0644]
src/rx/rx_kcommon.c

index 000d3f0..4c96a7f 100644 (file)
@@ -153,6 +153,7 @@ case $system in
                MKAFS_OSTYPE=SOLARIS
                 AC_MSG_RESULT(sun4)
                SOLARIS_UFSVFS_HAS_DQRWLOCK
+               SOLARIS_PROC_HAS_P_COREFILE
                 ;;
         *-hpux*)
                MKAFS_OSTYPE=HPUX
diff --git a/src/cf/solaris-pcorefile.m4 b/src/cf/solaris-pcorefile.m4
new file mode 100644 (file)
index 0000000..6764e42
--- /dev/null
@@ -0,0 +1,17 @@
+AC_DEFUN(SOLARIS_PROC_HAS_P_COREFILE, [
+AC_MSG_CHECKING(for p_corefile in struct proc)
+AC_CACHE_VAL(ac_cv_solaris_proc_has_p_corefile,
+[
+AC_TRY_COMPILE(
+[#define _KERNEL
+#include <sys/proc.h>],
+[struct proc _proc;
+(void) _proc.p_corefile;], 
+ac_cv_solaris_proc_has_p_corefile=yes,
+ac_cv_solaris_proc_has_p_corefile=no)])
+AC_MSG_RESULT($ac_cv_solaris_proc_has_p_corefile)
+if test "$ac_cv_solaris_proc_has_p_corefile" = "yes"; then
+  AC_DEFINE(HAVE_P_COREFILE, 1, [define if struct proc has p_corefile])
+fi
+])
+
index 44438e6..b888d8f 100644 (file)
@@ -1061,7 +1061,7 @@ void rxk_Listener(void)
 #endif
 #ifdef AFS_SUN5_ENV
     AFS_GUNLOCK();
-#ifdef AFS_SUN57_ENV
+#ifdef HAVE_P_COREFILE
     if (!curproc->p_corefile)  /* newproc doesn't set it, but exit frees it */
        curproc->p_corefile = refstr_alloc("core");
 #endif