Skip to content

Commit

Permalink
ext: add proctitle setting functions to set process titles portably
Browse files Browse the repository at this point in the history
  • Loading branch information
Elizabeth J. Myers committed Apr 5, 2012
1 parent 94f624b commit b6bf18f
Show file tree
Hide file tree
Showing 7 changed files with 445 additions and 6 deletions.
39 changes: 37 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3769,7 +3769,7 @@ fi
done
for ac_header in poll.h winsock2.h sys/epoll.h sys/select.h
for ac_header in poll.h winsock2.h sys/epoll.h sys/select.h sys/pstat.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
Expand All @@ -3782,7 +3782,7 @@ fi
done
for ac_func in fcntl kqueue mmap select dispatch_block port_create
for ac_func in fcntl kqueue mmap select dispatch_block port_create setproctitle pstat
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
Expand All @@ -3795,6 +3795,41 @@ fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PS_STRINGS" >&5
$as_echo_n "checking for PS_STRINGS... " >&6; }
if ${pgac_cv_var_PS_STRINGS+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <machine/vmparam.h>
#include <sys/exec.h>
int
main ()
{
PS_STRINGS->ps_nargvstr = 1;
PS_STRINGS->ps_argvstr = "foo";
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
pgac_cv_var_PS_STRINGS=yes
else
pgac_cv_var_PS_STRINGS=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_PS_STRINGS" >&5
$as_echo "$pgac_cv_var_PS_STRINGS" >&6; }
if test "$pgac_cv_var_PS_STRINGS" = yes ; then
$as_echo "#define HAVE_PS_STRINGS /**/" >>confdefs.h
fi
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down
17 changes: 15 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,21 @@ AS_IF([test "x$GCC" = "xyes"], [
CFLAGS="$CFLAGS $MORECFLAGS"
])

AC_CHECK_HEADERS([poll.h winsock2.h sys/epoll.h sys/select.h])
AC_CHECK_FUNCS([fcntl kqueue mmap select dispatch_block port_create])
AC_CHECK_HEADERS([poll.h winsock2.h sys/epoll.h sys/select.h sys/pstat.h])
AC_CHECK_FUNCS([fcntl kqueue mmap select dispatch_block port_create setproctitle pstat])

AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
[AC_TRY_LINK(
[#include <machine/vmparam.h>
#include <sys/exec.h>
],
[PS_STRINGS->ps_nargvstr = 1;
PS_STRINGS->ps_argvstr = "foo";],
[pgac_cv_var_PS_STRINGS=yes],
[pgac_cv_var_PS_STRINGS=no])])
if test "$pgac_cv_var_PS_STRINGS" = yes ; then
AC_DEFINE([HAVE_PS_STRINGS], [], [Define to 1 if the PS_STRINGS struct exists on your platform (likely no).])
fi

AC_PATH_PROG(AR, ar)
AC_PATH_PROG(RANLIB, ranlib)
Expand Down
6 changes: 4 additions & 2 deletions src/libmowgli/ext/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ SRCS = confparse.c \
error_backtrace.c \
getopt_long.c \
global_storage.c \
program_opts.c
program_opts.c \
proctitle.c

INCLUDES = confparse.h \
error_backtrace.h \
getopt_long.h \
global_storage.h \
program_opts.h
program_opts.h \
proctitle.h

include ../../../buildsys.mk

Expand Down
Loading

0 comments on commit b6bf18f

Please sign in to comment.