瀏覽代碼

Checkpoint.

Douglas William Thrift 14 年之前
父節點
當前提交
e3933f4f26
共有 4 個文件被更改,包括 375 次插入2 次删除
  1. 1 1
      GNUmakefile.in
  2. 365 0
      configure
  3. 8 0
      configure.ac
  4. 1 1
      dtpstree.cpp

+ 1 - 1
GNUmakefile.in

@@ -23,7 +23,7 @@ VPATH := @srcdir@
 srcdir := @srcdir@
 top_builddir := @top_builddir@
 
-CPPFLAGS := @CPPFLAGS@ $(filter -DPACKAGE_TARNAME% -DPACKAGE_VERSION% -DHAVE_NCURSES% -DHAVE_CURSES% -DHAVE_TERM%,@DEFS@)
+CPPFLAGS := @CPPFLAGS@ $(filter -DPACKAGE_TARNAME% -DPACKAGE_VERSION% -DHAVE_NCURSES% -DHAVE_CURSES% -DHAVE_TERM% -DHAVE_STRUCT_KINFO_PROC%,@DEFS@)
 CXX := @CXX@
 CXXFLAGS := @CXXFLAGS@ -Wall -Wno-long-long -Wno-parentheses
 LDFLAGS := @LDFLAGS@

+ 365 - 0
configure

@@ -4704,6 +4704,371 @@ $as_echo "$as_me: error: You need libkvm" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
+{ $as_echo "$as_me:$LINENO: checking for struct kinfo_proc2" >&5
+$as_echo_n "checking for struct kinfo_proc2... " >&6; }
+if test "${ac_cv_type_struct_kinfo_proc2+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_struct_kinfo_proc2=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+$ac_includes_default
+
+
+int
+main ()
+{
+if (sizeof (struct kinfo_proc2))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+$ac_includes_default
+
+
+int
+main ()
+{
+if (sizeof ((struct kinfo_proc2)))
+	  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_struct_kinfo_proc2=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_struct_kinfo_proc2" >&5
+$as_echo "$ac_cv_type_struct_kinfo_proc2" >&6; }
+if test $ac_cv_type_struct_kinfo_proc2 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_KINFO_PROC2 1
+_ACEOF
+
+break
+fi
+{ $as_echo "$as_me:$LINENO: checking for struct kinfo_proc" >&5
+$as_echo_n "checking for struct kinfo_proc... " >&6; }
+if test "${ac_cv_type_struct_kinfo_proc+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_struct_kinfo_proc=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+$ac_includes_default
+
+
+int
+main ()
+{
+if (sizeof (struct kinfo_proc))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+$ac_includes_default
+
+
+int
+main ()
+{
+if (sizeof ((struct kinfo_proc)))
+	  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_type_struct_kinfo_proc=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_struct_kinfo_proc" >&5
+$as_echo "$ac_cv_type_struct_kinfo_proc" >&6; }
+if test $ac_cv_type_struct_kinfo_proc = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_KINFO_PROC 1
+_ACEOF
+
+break
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether KERN_PROC_PROC is declared" >&5
+$as_echo_n "checking whether KERN_PROC_PROC is declared... " >&6; }
+if test "${ac_cv_have_decl_KERN_PROC_PROC+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+#ifndef KERN_PROC_PROC
+  (void) KERN_PROC_PROC;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_KERN_PROC_PROC=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_have_decl_KERN_PROC_PROC=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_KERN_PROC_PROC" >&5
+$as_echo "$ac_cv_have_decl_KERN_PROC_PROC" >&6; }
+if test $ac_cv_have_decl_KERN_PROC_PROC = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_KERN_PROC_PROC 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_KERN_PROC_PROC 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether KERN_PROC_ALL is declared" >&5
+$as_echo_n "checking whether KERN_PROC_ALL is declared... " >&6; }
+if test "${ac_cv_have_decl_KERN_PROC_ALL+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+#ifndef KERN_PROC_ALL
+  (void) KERN_PROC_ALL;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_KERN_PROC_ALL=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_have_decl_KERN_PROC_ALL=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_KERN_PROC_ALL" >&5
+$as_echo "$ac_cv_have_decl_KERN_PROC_ALL" >&6; }
+if test $ac_cv_have_decl_KERN_PROC_ALL = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_KERN_PROC_ALL 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_KERN_PROC_ALL 0
+_ACEOF
+
+
+fi
+
+
 ac_config_files="$ac_config_files GNUmakefile"
 
 cat >confcache <<\_ACEOF

+ 8 - 0
configure.ac

@@ -78,5 +78,13 @@ AS_CASE([$ac_cv_header_curses_h$ac_cv_header_ncurses_curses_h], [*yes*],
 AC_DEFUN([DT_MSG_KVM], [AC_MSG_ERROR([You need libkvm])])
 AC_CHECK_HEADER([kvm.h], [], [DT_MSG_KVM])
 AC_SEARCH_LIBS([kvm_openfiles], [kvm], [], [DT_MSG_KVM])
+AC_CHECK_TYPES([struct kinfo_proc2, struct kinfo_proc], [break], [],
+	[#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+AC_INCLUDES_DEFAULT]
+)
+AC_CHECK_DECLS([KERN_PROC_PROC, KERN_PROC_ALL])
 AC_CONFIG_FILES([GNUmakefile])
 AC_OUTPUT

+ 1 - 1
dtpstree.cpp

@@ -82,7 +82,7 @@ inline uid_t ruid(Type *proc);
 template <typename Type>
 inline char *comm(Type *proc);
 
-#if !defined(__NetBSD__) && !defined(__OpenBSD__)
+#ifndef HAVE_KINFO_PROC2
 typedef kinfo_proc Proc;
 
 const int Flags(O_RDONLY);