added signal/siginfo detection

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@639 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.2
Stéphane Fillod, F8CFE 2001-08-22 21:10:17 +00:00
rodzic 4d5ad486aa
commit 1c82c36aa6
2 zmienionych plików z 35 dodań i 27 usunięć

Wyświetl plik

@ -6,7 +6,7 @@ AC_CONFIG_SRCDIR([include/hamlib/rig.h])
AM_INIT_AUTOMAKE(hamlib, 1.1.2) AM_INIT_AUTOMAKE(hamlib, 1.1.2)
AM_CONFIG_HEADER(include/config.h) AM_CONFIG_HEADER(include/config.h)
AC_PREREQ(2.50)dnl dnl Minimum Autoconf version required. AC_PREREQ(2.50)dnl dnl Minimum Autoconf version required.
AC_REVISION($Revision: 1.2 $) AC_REVISION($Revision: 1.3 $)
dnl directory for docs (html) dnl directory for docs (html)
hamlibdocdir=$datadir/doc/hamlib hamlibdocdir=$datadir/doc/hamlib
@ -23,6 +23,8 @@ AC_PROG_GCC_TRADITIONAL
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_AWK
AC_PROG_CXX AC_PROG_CXX
AC_MSG_CHECKING(if you want to build C++ binding and demo) AC_MSG_CHECKING(if you want to build C++ binding and demo)
@ -44,8 +46,9 @@ fi
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h getopt.h) AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h unistd.h getopt.h errno.h])
AC_CHECK_HEADERS(sys/ioccom.h linux/ppdev.h sgtty.h term.h termio.h termios.h) AC_CHECK_HEADERS([sys/ioccom.h linux/ppdev.h sgtty.h term.h termio.h termios.h])
AC_CHECK_HEADERS([windows.h winioctl.h winbase.h])
dnl AC_HEADER_STAT dnl AC_HEADER_STAT
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
@ -53,6 +56,8 @@ AC_C_CONST
AC_C_INLINE AC_C_INLINE
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
AC_HEADER_TIME AC_HEADER_TIME
AC_TYPE_SIGNAL
AC_CHECK_TYPES([siginfo_t],[],[],[#include <signal.h>])
dnl Checks for libraries. dnl Checks for libraries.
@ -71,7 +76,9 @@ dnl Checks for library functions.
AC_CHECK_FUNCS(atexit snprintf select strerror) AC_CHECK_FUNCS(atexit snprintf select strerror)
AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o") AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
AC_CHECK_FUNCS(usleep,,LIBOBJS="$LIBOBJS usleep.o") AC_CHECK_FUNCS(usleep,,LIBOBJS="$LIBOBJS usleep.o")
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_VPRINTF
dnl initialize libtool dnl initialize libtool
dnl Enable building of the convenience library dnl Enable building of the convenience library

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - event handling * Hamlib Interface - event handling
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
* *
* $Id: event.c,v 1.9 2001-07-13 19:08:15 f4cfe Exp $ * $Id: event.c,v 1.10 2001-08-22 21:10:17 f4cfe Exp $
* *
* This library is free software; you can redistribute it and/or modify * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as * it under the terms of the GNU Library General Public License as
@ -43,10 +43,10 @@
#include "event.h" #include "event.h"
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef HAVE_SIGINFO_T
static void sa_sigiohandler(int signum); static RETSIGTYPE sa_sigioaction(int signum, siginfo_t *si, void *data);
#else #else
static void sa_sigioaction(int signum, siginfo_t *si, void *data); static RETSIGTYPE sa_sigiohandler(int signum);
#endif #endif
/* This one should be in an include file */ /* This one should be in an include file */
@ -65,18 +65,18 @@ int add_trn_rig(RIG *rig)
/* /*
* FIXME: multiple open will register several time SIGIO hndlr * FIXME: multiple open will register several time SIGIO hndlr
*/ */
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef HAVE_SIGINFO_T
act.sa_handler = sa_sigiohandler;
#else
act.sa_sigaction = sa_sigioaction; act.sa_sigaction = sa_sigioaction;
#else
act.sa_handler = sa_sigiohandler;
#endif #endif
sigemptyset(&act.sa_mask); sigemptyset(&act.sa_mask);
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef HAVE_SIGINFO_T
act.sa_flags = 0;
#else
act.sa_flags = SA_SIGINFO; act.sa_flags = SA_SIGINFO;
#else
act.sa_flags = 0;
#endif #endif
status = sigaction(SIGIO, &act, NULL); status = sigaction(SIGIO, &act, NULL);
@ -89,8 +89,7 @@ int add_trn_rig(RIG *rig)
rig_debug(RIG_DEBUG_ERR,"rig_open fcntl SETOWN failed: %s\n", rig_debug(RIG_DEBUG_ERR,"rig_open fcntl SETOWN failed: %s\n",
strerror(errno)); strerror(errno));
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef HAVE_SIGINFO_T
#else
status = fcntl(rig->state.rigport.fd, F_SETSIG, SIGIO); status = fcntl(rig->state.rigport.fd, F_SETSIG, SIGIO);
if (status < 0) if (status < 0)
rig_debug(RIG_DEBUG_ERR,"rig_open fcntl SETSIG failed: %s\n", rig_debug(RIG_DEBUG_ERR,"rig_open fcntl SETSIG failed: %s\n",
@ -127,7 +126,8 @@ static int search_rig_and_decode(RIG *rig, rig_ptr_t data)
fd_set rfds; fd_set rfds;
struct timeval tv; struct timeval tv;
int retval; int retval;
#if 0
#if 0&&defined(HAVE_SIGINFO_T)
siginfo_t *si = (siginfo_t*)data; siginfo_t *si = (siginfo_t*)data;
if (rig->state.rigport.fd != si->si_fd) if (rig->state.rigport.fd != si->si_fd)
@ -171,21 +171,22 @@ static int search_rig_and_decode(RIG *rig, rig_ptr_t data)
* check the rig is not holding SIGIO, * check the rig is not holding SIGIO,
* then call rig->caps->decode_event() (this is done by search_rig) * then call rig->caps->decode_event() (this is done by search_rig)
*/ */
#if defined(_WIN32) || defined(__CYGWIN__) #ifdef HAVE_SIGINFO_T
static void sa_sigiohandler(int signum) static RETSIGTYPE sa_sigioaction(int signum, siginfo_t *si, rig_ptr_t data)
{
rig_debug(RIG_DEBUG_VERBOSE, "sa_sigiohandler: activity detected\n");
foreach_opened_rig(search_rig_and_decode, NULL);
}
#else
static void sa_sigioaction(int signum, siginfo_t *si, rig_ptr_t data)
{ {
rig_debug(RIG_DEBUG_VERBOSE, "sa_sigioaction: activity detected\n"); rig_debug(RIG_DEBUG_VERBOSE, "sa_sigioaction: activity detected\n");
foreach_opened_rig(search_rig_and_decode, si); foreach_opened_rig(search_rig_and_decode, si);
} }
#else
static RETSIGTYPE sa_sigiohandler(int signum)
{
rig_debug(RIG_DEBUG_VERBOSE, "sa_sigiohandler: activity detected\n");
foreach_opened_rig(search_rig_and_decode, NULL);
}
#endif #endif