⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configure

📁 linux进程跟踪的工具和源代码
💻
📖 第 1 页 / 共 5 页
字号:
#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);}EOFif { (eval echo configure:1010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/nullthen  ac_cv_mp_procfs=yeselse  echo "configure: failed program was:" >&5  cat conftest.$ac_ext >&5  rm -fr conftest*  ac_cv_mp_procfs=nofirm -fr conftest*fifiecho "$ac_t""$ac_cv_mp_procfs" 1>&6if test "$ac_cv_mp_procfs" = yesthen	cat >> confdefs.h <<\EOF#define HAVE_MP_PROCFS 1EOFfiecho $ac_n "checking for pollable procfs""... $ac_c" 1>&6echo "configure:1034: checking for pollable procfs" >&5if eval "test \"`echo '$''{'ac_cv_pollable_procfs'+set}'`\" = set"; then  echo $ac_n "(cached) $ac_c" 1>&6else  if test "$cross_compiling" = yes; then  # Guess or punt.case "$host_os" insolaris2*|irix5*|svr4.2uw*|svr5*)	ac_cv_pollable_procfs=yes	;;*)	ac_cv_pollable_procfs=no	;;esacelse  cat > conftest.$ac_ext <<EOF#line 1052 "configure"#include "confdefs.h"#include <stdio.h>#include <signal.h>#include <sys/procfs.h>#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#endifmain(){	int pid;	char proc[32];	FILE *pfp;	struct pollfd pfd;	if ((pid = fork()) == 0) {		pause();		exit(0);	}	sprintf(proc, PROC, pid);	if ((pfp = fopen(proc, PROC_MODE)) == NULL)		goto fail;	if (IOCTL(fileno(pfp), PIOCSTOP, NULL) < 0)		goto fail;	pfd.fd = fileno(pfp);	pfd.events = POLLWANT;	if (poll(&pfd, 1, 0) < 0)		goto fail;	if (!(pfd.revents & POLLWANT))		goto fail;	kill(pid, SIGKILL);	exit(0);fail:	kill(pid, SIGKILL);	exit(1);}EOFif { (eval echo configure:1106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/nullthen  ac_cv_pollable_procfs=yeselse  echo "configure: failed program was:" >&5  cat conftest.$ac_ext >&5  rm -fr conftest*  ac_cv_pollable_procfs=nofirm -fr conftest*fifiecho "$ac_t""$ac_cv_pollable_procfs" 1>&6if test "$ac_cv_pollable_procfs" = yesthen	cat >> confdefs.h <<\EOF#define HAVE_POLLABLE_PROCFS 1EOFfiecho $ac_n "checking for pr_syscall in struct prstatus""... $ac_c" 1>&6echo "configure:1130: checking for pr_syscall in struct prstatus" >&5if eval "test \"`echo '$''{'ac_cv_struct_pr_syscall'+set}'`\" = set"; then  echo $ac_n "(cached) $ac_c" 1>&6else  cat > conftest.$ac_ext <<EOF#line 1135 "configure"#include "confdefs.h"#include <sys/procfs.h>int main() {#ifdef HAVE_MP_PROCFSpstatus_t s;s.pr_lwp.pr_syscall#elseprstatus_t s;s.pr_syscall#endif; return 0; }EOFif { (eval echo configure:1148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then  rm -rf conftest*  ac_cv_struct_pr_syscall=yeselse  echo "configure: failed program was:" >&5  cat conftest.$ac_ext >&5  rm -rf conftest*  ac_cv_struct_pr_syscall=nofirm -f conftest*fiecho "$ac_t""$ac_cv_struct_pr_syscall" 1>&6if test "$ac_cv_struct_pr_syscall" = yesthen	cat >> confdefs.h <<\EOF#define HAVE_PR_SYSCALL 1EOFfiecho $ac_n "checking for msg_control in struct msghdr""... $ac_c" 1>&6echo "configure:1170: checking for msg_control in struct msghdr" >&5if eval "test \"`echo '$''{'ac_cv_struct_msg_control'+set}'`\" = set"; then  echo $ac_n "(cached) $ac_c" 1>&6else  cat > conftest.$ac_ext <<EOF#line 1175 "configure"#include "confdefs.h"#include <sys/types.h>#include <sys/socket.h>int main() {#undef msg_controlstruct msghdr m; m.msg_control;; return 0; }EOFif { (eval echo configure:1184: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then  rm -rf conftest*  ac_cv_struct_msg_control=yeselse  echo "configure: failed program was:" >&5  cat conftest.$ac_ext >&5  rm -rf conftest*  ac_cv_struct_msg_control=nofirm -f conftest*fiecho "$ac_t""$ac_cv_struct_msg_control" 1>&6if test "$ac_cv_struct_msg_control" = yesthen	cat >> confdefs.h <<\EOF#define HAVE_MSG_CONTROL 1EOFfifor ac_prog in mawk gawk nawk awkdo# Extract the first word of "$ac_prog", so it can be a program name with args.set dummy $ac_prog; ac_word=$2echo $ac_n "checking for $ac_word""... $ac_c" 1>&6echo "configure:1210: checking for $ac_word" >&5if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then  echo $ac_n "(cached) $ac_c" 1>&6else  if test -n "$AWK"; then  ac_cv_prog_AWK="$AWK" # Let the user override the test.else  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"  ac_dummy="$PATH"  for ac_dir in $ac_dummy; do    test -z "$ac_dir" && ac_dir=.    if test -f $ac_dir/$ac_word; then      ac_cv_prog_AWK="$ac_prog"      break    fi  done  IFS="$ac_save_ifs"fifiAWK="$ac_cv_prog_AWK"if test -n "$AWK"; then  echo "$ac_t""$AWK" 1>&6else  echo "$ac_t""no" 1>&6fitest -n "$AWK" && breakdoneecho $ac_n "checking for primary include directory""... $ac_c" 1>&6echo "configure:1241: checking for primary include directory" >&5includedir=/usr/includeif test -n "$GCC"then	>conftest.c	new_includedir=`		$CC -v -E conftest.c 2>&1 | $AWK '			/^End of search list/ { print last; exit }			{ last = $1 }		'	`	rm -f conftest.c	if test -n "$new_includedir" && test -d "$new_includedir"	then		includedir=$new_includedir	fifiecho "$ac_t""$includedir" 1>&6if test "x$OPSYS" = "xSUNOS4" && test "x$ARCH" = "xSPARC"then	echo $ac_n "checking for valid machine include directory""... $ac_c" 1>&6echo "configure:1263: checking for valid machine include directory" >&5	if test -d "$includedir/sun4"	then		rm -f machine		ln -s $includedir/sun4 machine		echo "$ac_t""yes" 1>&6		cat >> confdefs.h <<\EOF#define SUNOS4_KERNEL_ARCH_KLUDGE 1EOF	else		echo "$ac_t""no" 1>&6	fifiif test -z "$WARNFLAGS"then	if test -n "$GCC"	then		# If we're using gcc we want warning flags.		WARNFLAGS=-Wall	fifiif test "x$OPSYS" = "xSUNOS4"then	if test -n "$GCC"	then		# SunOS 4.x header files don't declare int functions.		WARNFLAGS="$WARNFLAGS -Wno-implicit"	fifiecho $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6echo "configure:1296: checking how to run the C preprocessor" >&5# On Suns, sometimes $CPP names a directory.if test -n "$CPP" && test -d "$CPP"; then  CPP=fiif test -z "$CPP"; thenif eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then  echo $ac_n "(cached) $ac_c" 1>&6else    # This must be in double quotes, not single quotes, because CPP may get  # substituted into the Makefile and "${CC-cc}" will confuse make.  CPP="${CC-cc} -E"  # On the NeXT, cc -E runs the code through the compiler's parser,  # not just through cpp.  cat > conftest.$ac_ext <<EOF#line 1311 "configure"#include "confdefs.h"#include <assert.h>Syntax ErrorEOFac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"{ (eval echo configure:1317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`if test -z "$ac_err"; then  :else  echo "$ac_err" >&5  echo "configure: failed program was:" >&5  cat conftest.$ac_ext >&5  rm -rf conftest*  CPP="${CC-cc} -E -traditional-cpp"  cat > conftest.$ac_ext <<EOF#line 1328 "configure"#include "confdefs.h"#include <assert.h>Syntax ErrorEOFac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"{ (eval echo configure:1334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`if test -z "$ac_err"; then  :else  echo "$ac_err" >&5  echo "configure: failed program was:" >&5  cat conftest.$ac_ext >&5  rm -rf conftest*  CPP="${CC-cc} -nologo -E"  cat > conftest.$ac_ext <<EOF#line 1345 "configure"#include "confdefs.h"#include <assert.h>Syntax ErrorEOFac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"{ (eval echo configure:1351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`if test -z "$ac_err"; then  :else  echo "$ac_err" >&5  echo "configure: failed program was:" >&5  cat conftest.$ac_ext >&5  rm -rf conftest*  CPP=/lib/cppfirm -f conftest*firm -f conftest*firm -f conftest*  ac_cv_prog_CPP="$CPP"fi  CPP="$ac_cv_prog_CPP"else  ac_cv_prog_CPP="$CPP"fiecho "$ac_t""$CPP" 1>&6if test $ac_cv_prog_gcc = yes; then    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6echo "configure:1377: checking whether ${CC-cc} needs -traditional" >&5if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then  echo $ac_n "(cached) $ac_c" 1>&6else    ac_pattern="Autoconf.*'x'"  cat > conftest.$ac_ext <<EOF#line 1383 "configure"#include "confdefs.h"#include <sgtty.h>Autoconf TIOCGETPEOFif (eval "$ac_cpp conftest.$ac_ext") 2>&5 |  egrep "$ac_pattern" >/dev/null 2>&1; then  rm -rf conftest*  ac_cv_prog_gcc_traditional=yeselse  rm -rf conftest*  ac_cv_prog_gcc_traditional=nofirm -f conftest*  if test $ac_cv_prog_gcc_traditional = no; then    cat > conftest.$ac_ext <<EOF#line 1401 "configure"#include "confdefs.h"#include <termio.h>Autoconf TCGETAEOFif (eval "$ac_cpp conftest.$ac_ext") 2>&5 |  egrep "$ac_pattern" >/dev/null 2>&1; then  rm -rf conftest*  ac_cv_prog_gcc_traditional=yesfirm -f conftest*  fifiecho "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6  if test $ac_cv_prog_gcc_traditional = yes; then    CC="$CC -traditional"  fifi# Find a good install program.  We prefer a C program (faster),# so one script is as good as another.  But avoid the broken or# incompatible versions:# SysV /etc/install, /usr/sbin/install# SunOS /usr/etc/install# IRIX /sbin/install# AIX /bin/install# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag# AFS /usr/afsws/bin/install, which mishandles nonexistent args# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"# ./install, which can be erroneously created by make from ./install.sh.echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6echo "configure:1434: checking for a BSD compatible install" >&5if test -z "$INSTALL"; thenif eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then  echo $ac_n "(cached) $ac_c" 1>&6else    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"  for ac_dir in $PATH; do    # Account for people who put trailing slashes in PATH elements.    case "$ac_dir/" in    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;    *)      # OSF1 and SCO ODT 3.0 have their own names for install.      # Don't use installbsd from OSF since it installs stuff as root      # by default.      for ac_prog in ginstall scoinst install; do        if test -f $ac_dir/$ac_prog; then	  if test $ac_prog = install &&            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then	    # AIX install.  It has an incompatible calling convention.	    :	  else	    ac_cv_path_install="$ac_dir/$ac_prog -c"	    break 2	  fi	fi      done

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -