From 1f7cfb607bf1a62df298a178e77b5cf8b6c4c24d Mon Sep 17 00:00:00 2001 From: ryoon Date: Tue, 4 Oct 2011 11:55:34 +0000 Subject: Fix PR pkg/45402. * Add DragonFly support from SVN 2600. * Regen configure script. --- misc/tmux/distinfo | 7 +- misc/tmux/patches/patch-configure | 501 +++++++++++++++++++++++++++++- misc/tmux/patches/patch-configure.ac | 28 +- misc/tmux/patches/patch-osdep-dragonfly.c | 133 ++++++++ 4 files changed, 662 insertions(+), 7 deletions(-) create mode 100644 misc/tmux/patches/patch-osdep-dragonfly.c (limited to 'misc/tmux') diff --git a/misc/tmux/distinfo b/misc/tmux/distinfo index e3671b77876..548f3626b54 100644 --- a/misc/tmux/distinfo +++ b/misc/tmux/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.15 2011/09/16 05:18:57 minskim Exp $ +$NetBSD: distinfo,v 1.16 2011/10/04 11:55:34 ryoon Exp $ SHA1 (tmux-1.5.tar.gz) = e26132f02f344f8d6d06ae87d11f6a7aad880f67 RMD160 (tmux-1.5.tar.gz) = 08eec02bcbd91b3c37a36a05167f3758e7911973 Size (tmux-1.5.tar.gz) = 374093 bytes -SHA1 (patch-configure) = 86974baa9f2e51d46dda93f78ea6f60ba78d0eeb -SHA1 (patch-configure.ac) = 2b9b076f184f73ed00e509fc96f5da7e7358a710 +SHA1 (patch-configure) = 945501bfb2ae1fc3edf78947f2ddcc662e950c50 +SHA1 (patch-configure.ac) = a9f12fee5bec74ad6e608ab7d5442b346816bb3d +SHA1 (patch-osdep-dragonfly.c) = dbd6ab3e3437aaae7c333ac884f39bc7d0a5b917 diff --git a/misc/tmux/patches/patch-configure b/misc/tmux/patches/patch-configure index d717bad725e..109d5403a20 100644 --- a/misc/tmux/patches/patch-configure +++ b/misc/tmux/patches/patch-configure @@ -1,10 +1,20 @@ -$NetBSD: patch-configure,v 1.1 2011/09/16 05:18:58 minskim Exp $ +$NetBSD: patch-configure,v 1.2 2011/10/04 11:55:34 ryoon Exp $ Compatibility for b64_ntop. SVN Revisions 2565 and 2568. +Add DragonFly support, SVN 2600. --- configure.orig 2011-07-09 16:12:35.000000000 +0000 +++ configure -@@ -637,6 +637,8 @@ NO_FORKPTY_TRUE +@@ -603,6 +603,8 @@ IS_FREEBSD_FALSE + IS_FREEBSD_TRUE + IS_LINUX_FALSE + IS_LINUX_TRUE ++IS_DRAGONFLY_FALSE ++IS_DRAGONFLY_TRUE + IS_DARWIN_FALSE + IS_DARWIN_TRUE + IS_AIX_FALSE +@@ -637,6 +639,8 @@ NO_FORKPTY_TRUE NO_IMSG_FALSE NO_IMSG_TRUE XOPEN_DEFINES @@ -13,7 +23,174 @@ Compatibility for b64_ntop. SVN Revisions 2565 and 2568. IS_GLIBC_FALSE IS_GLIBC_TRUE IS_SUNCC_FALSE -@@ -4605,119 +4607,83 @@ if test "x$found_curses" = xno; then +@@ -1315,11 +1319,9 @@ Configuration: + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + + Installation directories: +- --prefix=PREFIX +- install architecture-independent files in PREFIX ++ --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] +- --exec-prefix=EPREFIX +- install architecture-dependent files in EPREFIX ++ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + + By default, \`make install' will install all the files in +@@ -1344,8 +1346,7 @@ Fine tuning of the installation director + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] +- --docdir=DIR +- documentation root [DATAROOTDIR/doc/tmux] ++ --docdir=DIR documentation root [DATAROOTDIR/doc/tmux] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] +@@ -1377,26 +1378,18 @@ Optional Features: + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors +- --enable-debug +- create a debug build +- --enable-static +- create a static build ++ --enable-debug create a debug build ++ --enable-static create a static build + + Some influential environment variables: +- CC +- C compiler command +- CFLAGS +- C compiler flags +- LDFLAGS +- linker flags, e.g. -L if you have libraries in a ++ CC C compiler command ++ CFLAGS C compiler flags ++ LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory +- LIBS +- libraries to pass to the linker, e.g. -l +- CPPFLAGS +- C/C++/Objective C preprocessor flags, e.g. -I if ++ LIBS libraries to pass to the linker, e.g. -l ++ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory +- CPP +- C preprocessor ++ CPP C preprocessor + + Use these variables to override the choices made by `configure' or to help + it to find libraries and programs with nonstandard names/locations. +@@ -2083,32 +2076,26 @@ $as_echo "/* confdefs.h */" > confdefs.h + + cat >>confdefs.h <<_ACEOF + #define PACKAGE_NAME "$PACKAGE_NAME" +- + _ACEOF + + cat >>confdefs.h <<_ACEOF + #define PACKAGE_TARNAME "$PACKAGE_TARNAME" +- + _ACEOF + + cat >>confdefs.h <<_ACEOF + #define PACKAGE_VERSION "$PACKAGE_VERSION" +- + _ACEOF + + cat >>confdefs.h <<_ACEOF + #define PACKAGE_STRING "$PACKAGE_STRING" +- + _ACEOF + + cat >>confdefs.h <<_ACEOF + #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +- + _ACEOF + + cat >>confdefs.h <<_ACEOF + #define PACKAGE_URL "$PACKAGE_URL" +- + _ACEOF + + +@@ -2661,13 +2648,11 @@ fi + + cat >>confdefs.h <<_ACEOF + #define PACKAGE "$PACKAGE" +- + _ACEOF + + + cat >>confdefs.h <<_ACEOF + #define VERSION "$VERSION" +- + _ACEOF + + # Some tools Automake needs. +@@ -3839,8 +3824,7 @@ else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + $as_echo "no" >&6; } + +-$as_echo "#define NO_MINUS_C_MINUS_O 1 +-" >>confdefs.h ++$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + + fi + +@@ -4239,8 +4223,7 @@ fi + $as_echo "$ac_cv_header_stdc" >&6; } + if test $ac_cv_header_stdc = yes; then + +-$as_echo "#define STDC_HEADERS 1 +-" >>confdefs.h ++$as_echo "#define STDC_HEADERS 1" >>confdefs.h + + fi + +@@ -4248,15 +4231,13 @@ fi + for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h + do : +- as_ac_Header=`$as_echo "ac_cv_header_$ac_header +-" | $as_tr_sh` ++ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` + ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default + " + eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF + #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +- + _ACEOF + + fi +@@ -4284,14 +4265,12 @@ for ac_header in \ + + + do : +- as_ac_Header=`$as_echo "ac_cv_header_$ac_header +-" | $as_tr_sh` ++ 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" + eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF + #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +- + _ACEOF + + fi +@@ -4470,7 +4449,6 @@ $as_echo "$ac_cv_lib_rt_clock_gettime" > + if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then : + cat >>confdefs.h <<_ACEOF + #define HAVE_LIBRT 1 +- + _ACEOF + + LIBS="-lrt $LIBS" +@@ -4605,119 +4583,83 @@ if test "x$found_curses" = xno; then as_fn_error "\"curses not found\"" "$LINENO" 5 fi @@ -179,3 +356,321 @@ Compatibility for b64_ntop. SVN Revisions 2565 and 2568. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntoa" >&5 $as_echo_n "checking for library containing inet_ntoa... " >&6; } if test "${ac_cv_search_inet_ntoa+set}" = set; then : +@@ -4869,7 +4811,6 @@ $as_echo "$ac_cv_lib_xnet_socket" >&6; } + if test "x$ac_cv_lib_xnet_socket" = x""yes; then : + cat >>confdefs.h <<_ACEOF + #define HAVE_LIBXNET 1 +- + _ACEOF + + LIBS="-lxnet $LIBS" +@@ -5053,8 +4994,7 @@ else + fi + + if test "x$found_imsg_init" = xyes; then +- $as_echo "#define HAVE_IMSG 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_IMSG 1" >>confdefs.h + + fi + if test "x$found_imsg_init" = xno; then +@@ -5126,8 +5066,7 @@ else + fi + + if test "x$found_forkpty" = xyes; then +- $as_echo "#define HAVE_FORKPTY 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h + + fi + if test "x$found_forkpty" = xno; then +@@ -5148,8 +5087,7 @@ else + fi + + if test "x$found_closefrom" = xyes; then +- $as_echo "#define HAVE_CLOSEFROM 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_CLOSEFROM 1" >>confdefs.h + + fi + if test "x$found_closefrom" = xno; then +@@ -5170,8 +5108,7 @@ else + fi + + if test "x$found_daemon" = xyes; then +- $as_echo "#define HAVE_DAEMON 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_DAEMON 1" >>confdefs.h + + fi + if test "x$found_daemon" = xno; then +@@ -5192,8 +5129,7 @@ else + fi + + if test "x$found_setenv" = xyes; then +- $as_echo "#define HAVE_SETENV 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_SETENV 1" >>confdefs.h + + fi + if test "x$found_setenv" = xno; then +@@ -5214,8 +5150,7 @@ else + fi + + if test "x$found_strlcpy" = xyes; then +- $as_echo "#define HAVE_STRLCPY 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h + + fi + if test "x$found_strlcpy" = xno; then +@@ -5236,8 +5171,7 @@ else + fi + + if test "x$found_strlcat" = xyes; then +- $as_echo "#define HAVE_STRLCAT 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_STRLCAT 1" >>confdefs.h + + fi + if test "x$found_strlcat" = xno; then +@@ -5258,8 +5192,7 @@ else + fi + + if test "x$found_asprintf" = xyes; then +- $as_echo "#define HAVE_ASPRINTF 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_ASPRINTF 1" >>confdefs.h + + fi + if test "x$found_asprintf" = xno; then +@@ -5280,8 +5213,7 @@ else + fi + + if test "x$found_fgetln" = xyes; then +- $as_echo "#define HAVE_FGETLN 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_FGETLN 1" >>confdefs.h + + fi + if test "x$found_fgetln" = xno; then +@@ -5302,8 +5234,7 @@ else + fi + + if test "x$found_strcasestr" = xyes; then +- $as_echo "#define HAVE_STRCASESTR 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_STRCASESTR 1" >>confdefs.h + + fi + if test "x$found_strcasestr" = xno; then +@@ -5324,8 +5255,7 @@ else + fi + + if test "x$found_strsep" = xyes; then +- $as_echo "#define HAVE_STRSEP 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_STRSEP 1" >>confdefs.h + + fi + if test "x$found_strsep" = xno; then +@@ -5346,8 +5276,7 @@ else + fi + + if test "x$found_strtonum" = xyes; then +- $as_echo "#define HAVE_STRTONUM 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_STRTONUM 1" >>confdefs.h + + fi + if test "x$found_strtonum" = xno; then +@@ -5368,8 +5297,7 @@ else + fi + + if test "x$found_strnvis" = xyes; then +- $as_echo "#define HAVE_VIS 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_VIS 1" >>confdefs.h + + fi + if test "x$found_strnvis" = xno; then +@@ -5404,7 +5332,6 @@ fi + + cat >>confdefs.h <<_ACEOF + #define HAVE_DECL_OPTARG $ac_have_decl +- + _ACEOF + if test $ac_have_decl = 1; then : + +@@ -5424,7 +5351,6 @@ fi + + cat >>confdefs.h <<_ACEOF + #define HAVE_DECL_OPTIND $ac_have_decl +- + _ACEOF + if test $ac_have_decl = 1; then : + +@@ -5444,7 +5370,6 @@ fi + + cat >>confdefs.h <<_ACEOF + #define HAVE_DECL_OPTRESET $ac_have_decl +- + _ACEOF + if test $ac_have_decl = 1; then : + +@@ -5462,8 +5387,7 @@ $as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + $as_echo "no" >&6; } +- $as_echo "#define HAVE_GETOPT 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_GETOPT 1" >>confdefs.h + + fi + fi +@@ -5485,14 +5409,12 @@ for ac_func in \ + + + do : +- as_ac_var=`$as_echo "ac_cv_func_$ac_func +-" | $as_tr_sh` ++ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" + eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF + #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +- + _ACEOF + + fi +@@ -5516,8 +5438,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ + + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : +- $as_echo "#define HAVE_BSD_TYPES 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_BSD_TYPES 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } + else +@@ -5547,8 +5468,7 @@ else + fi + + if test "x$found_queue_h" = xyes; then +- $as_echo "#define HAVE_QUEUE_H 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_QUEUE_H 1" >>confdefs.h + + fi + +@@ -5569,8 +5489,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ + + _ACEOF + if ac_fn_c_try_link "$LINENO"; then : +- $as_echo "#define HAVE___PROGNAME 1 +-" >>confdefs.h ++ $as_echo "#define HAVE___PROGNAME 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } + else +@@ -5586,8 +5505,7 @@ ac_fn_c_check_decl "$LINENO" "F_CLOSEM" + + " + if test "x$ac_cv_have_decl_F_CLOSEM" = x""yes; then : +- $as_echo "#define HAVE_FCNTL_CLOSEM 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_FCNTL_CLOSEM 1" >>confdefs.h + + fi + +@@ -5596,8 +5514,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/\$\$" >&5 + $as_echo_n "checking for /proc/\$\$... " >&6; } + if test -d /proc/$$; then +- $as_echo "#define HAVE_PROC_PID 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_PROC_PID 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } +@@ -5610,8 +5527,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /proc/\$\$/fd" >&5 + $as_echo_n "checking for /proc/\$\$/fd... " >&6; } + if test -d /proc/$$/fd; then +- $as_echo "#define HAVE_DIRFD 1 +-" >>confdefs.h ++ $as_echo "#define HAVE_DIRFD 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } +@@ -5632,17 +5548,21 @@ $as_echo "aix" >&6; } + *darwin*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: darwin" >&5 + $as_echo "darwin" >&6; } +- $as_echo "#define BROKEN_CMSG_FIRSTHDR 1 +-" >>confdefs.h ++ $as_echo "#define BROKEN_CMSG_FIRSTHDR 1" >>confdefs.h + + PLATFORM=darwin + ;; ++ *dragonfly*) ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: dragonfly" >&5 ++$as_echo "dragonfly" >&6; } ++ PLATFORM=dragonfly ++ ;; + *linux*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: linux" >&5 + $as_echo "linux" >&6; } + PLATFORM=linux + ;; +- *freebsd*|*dragonfly*) ++ *freebsd*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: freebsd" >&5 + $as_echo "freebsd" >&6; } + PLATFORM=freebsd +@@ -5695,6 +5615,14 @@ else + IS_DARWIN_FALSE= + fi + ++ if test "x$PLATFORM" = xdragonfly; then ++ IS_DRAGONFLY_TRUE= ++ IS_DRAGONFLY_FALSE='#' ++else ++ IS_DRAGONFLY_TRUE='#' ++ IS_DRAGONFLY_FALSE= ++fi ++ + if test "x$PLATFORM" = xlinux; then + IS_LINUX_TRUE= + IS_LINUX_FALSE='#' +@@ -5920,6 +5848,10 @@ if test -z "${IS_GLIBC_TRUE}" && test -z + as_fn_error "conditional \"IS_GLIBC\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 + fi ++if test -z "${NO_B64_NTOP_TRUE}" && test -z "${NO_B64_NTOP_FALSE}"; then ++ as_fn_error "conditional \"NO_B64_NTOP\" was never defined. ++Usually this means the macro was only invoked conditionally." "$LINENO" 5 ++fi + if test -z "${NO_IMSG_TRUE}" && test -z "${NO_IMSG_FALSE}"; then + as_fn_error "conditional \"NO_IMSG\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 +@@ -5984,6 +5916,10 @@ if test -z "${IS_DARWIN_TRUE}" && test - + as_fn_error "conditional \"IS_DARWIN\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 + fi ++if test -z "${IS_DRAGONFLY_TRUE}" && test -z "${IS_DRAGONFLY_FALSE}"; then ++ as_fn_error "conditional \"IS_DRAGONFLY\" was never defined. ++Usually this means the macro was only invoked conditionally." "$LINENO" 5 ++fi + if test -z "${IS_LINUX_TRUE}" && test -z "${IS_LINUX_FALSE}"; then + as_fn_error "conditional \"IS_LINUX\" was never defined. + Usually this means the macro was only invoked conditionally." "$LINENO" 5 +@@ -6462,7 +6398,6 @@ Usage: $0 [OPTION]... [TAG]... + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] +- + instantiate the configuration file FILE + + Configuration files: diff --git a/misc/tmux/patches/patch-configure.ac b/misc/tmux/patches/patch-configure.ac index 46805ec0110..2071cc932a4 100644 --- a/misc/tmux/patches/patch-configure.ac +++ b/misc/tmux/patches/patch-configure.ac @@ -1,6 +1,7 @@ -$NetBSD: patch-configure.ac,v 1.1 2011/09/16 05:18:58 minskim Exp $ +$NetBSD: patch-configure.ac,v 1.2 2011/10/04 11:55:34 ryoon Exp $ Compatibility for b64_ntop. SVN Revisions 2565 and 2568. +Add DragonFly support, SVN 2600. --- configure.ac.orig 2011-07-09 16:00:17.000000000 +0000 +++ configure.ac @@ -51,3 +52,28 @@ Compatibility for b64_ntop. SVN Revisions 2565 and 2568. AC_SEARCH_LIBS(inet_ntoa, nsl) AC_SEARCH_LIBS(socket, socket) AC_CHECK_LIB(xnet, socket) +@@ -385,11 +420,15 @@ case "$host_os" in + AC_DEFINE(BROKEN_CMSG_FIRSTHDR) + PLATFORM=darwin + ;; ++ *dragonfly*) ++ AC_MSG_RESULT(dragonfly) ++ PLATFORM=dragonfly ++ ;; + *linux*) + AC_MSG_RESULT(linux) + PLATFORM=linux + ;; +- *freebsd*|*dragonfly*) ++ *freebsd*) + AC_MSG_RESULT(freebsd) + PLATFORM=freebsd + ;; +@@ -421,6 +460,7 @@ esac + AC_SUBST(PLATFORM) + AM_CONDITIONAL(IS_AIX, test "x$PLATFORM" = xaix) + AM_CONDITIONAL(IS_DARWIN, test "x$PLATFORM" = xdarwin) ++AM_CONDITIONAL(IS_DRAGONFLY, test "x$PLATFORM" = xdragonfly) + AM_CONDITIONAL(IS_LINUX, test "x$PLATFORM" = xlinux) + AM_CONDITIONAL(IS_FREEBSD, test "x$PLATFORM" = xfreebsd) + AM_CONDITIONAL(IS_NETBSD, test "x$PLATFORM" = xnetbsd) diff --git a/misc/tmux/patches/patch-osdep-dragonfly.c b/misc/tmux/patches/patch-osdep-dragonfly.c new file mode 100644 index 00000000000..3ac0aa3064e --- /dev/null +++ b/misc/tmux/patches/patch-osdep-dragonfly.c @@ -0,0 +1,133 @@ +$NetBSD: patch-osdep-dragonfly.c,v 1.1 2011/10/04 11:55:34 ryoon Exp $ + +Add DragonFly support, SVN 2600 + +--- osdep-dragonfly.c.orig 2011-10-04 09:36:43.000000000 +0000 ++++ osdep-dragonfly.c +@@ -0,0 +1,126 @@ ++/* $: osdep-dragonfly.c 2600 2011-09-29 08:43:01Z nicm $ */ ++ ++/* ++ * Copyright (c) 2009 Nicholas Marriott ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER ++ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *); ++char *osdep_get_name(int, char *); ++struct event_base *osdep_event_init(void); ++ ++#ifndef nitems ++#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) ++#endif ++ ++#define is_runnable(p) \ ++ ((p)->kp_stat == SACTIVE || (p)->kp_stat == SIDL) ++#define is_stopped(p) \ ++ ((p)->kp_stat == SSTOP || (p)->kp_stat == SZOMB) ++ ++struct kinfo_proc * ++cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2) ++{ ++ if (is_runnable(p1) && !is_runnable(p2)) ++ return (p1); ++ if (!is_runnable(p1) && is_runnable(p2)) ++ return (p2); ++ ++ if (is_stopped(p1) && !is_stopped(p2)) ++ return (p1); ++ if (!is_stopped(p1) && is_stopped(p2)) ++ return (p2); ++ ++ if (strcmp(p1->kp_comm, p2->kp_comm) < 0) ++ return (p1); ++ if (strcmp(p1->kp_comm, p2->kp_comm) > 0) ++ return (p2); ++ ++ if (p1->kp_pid > p2->kp_pid) ++ return (p1); ++ return (p2); ++} ++ ++char * ++osdep_get_name(int fd, char *tty) ++{ ++ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PGRP, 0 }; ++ struct stat sb; ++ size_t len; ++ struct kinfo_proc *buf, *newbuf, *bestp; ++ u_int i; ++ char *name; ++ ++ buf = NULL; ++ ++ if (stat(tty, &sb) == -1) ++ return (NULL); ++ if ((mib[3] = tcgetpgrp(fd)) == -1) ++ return (NULL); ++ ++retry: ++ if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) == -1) ++ return (NULL); ++ len = (len * 5) / 4; ++ ++ if ((newbuf = realloc(buf, len)) == NULL) ++ goto error; ++ buf = newbuf; ++ ++ if (sysctl(mib, nitems(mib), buf, &len, NULL, 0) == -1) { ++ if (errno == ENOMEM) ++ goto retry; ++ goto error; ++ } ++ ++ bestp = NULL; ++ for (i = 0; i < len / sizeof (struct kinfo_proc); i++) { ++ if (buf[i].kp_tdev != sb.st_rdev) ++ continue; ++ if (bestp == NULL) ++ bestp = &buf[i]; ++ else ++ bestp = cmp_procs(&buf[i], bestp); ++ } ++ ++ name = NULL; ++ if (bestp != NULL) ++ name = strdup(bestp->kp_comm); ++ ++ free(buf); ++ return (name); ++ ++error: ++ free(buf); ++ return (NULL); ++} ++ ++struct event_base * ++osdep_event_init(void) ++{ ++ return (event_init()); ++} -- cgit v1.2.3