mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:45:41 +01:00
Add OpenBSD support
- ERESTART not supported platform: use EINTR instead - add include/os_compat.h, well-used OS specific definition - copied include/bswap.h from alsa-lib - EPIPE and ESTRPIPE are different usage, but currently EPIPE is used when ESTRPIPE is not defined. To fix this problem, assign ESPIPE instead. Fixes: https://github.com/alsa-project/alsa-utils/pull/186 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
1350900246
commit
613372dc7c
13 changed files with 106 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <syslog.h>
|
||||
#include <sched.h>
|
||||
#include "alsactl.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
#ifndef SYS_ASOUND_DIR
|
||||
#define SYS_ASOUND_DIR "/var/lib/alsa"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <syslog.h>
|
||||
#include <signal.h>
|
||||
#include "alsaloop.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
struct loopback_thread {
|
||||
int threaded;
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
#include <ctype.h>
|
||||
#include <syslog.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <sys/time.h>
|
||||
#include "alsaloop.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
static char *id_str(snd_ctl_elem_id_t *id)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <syslog.h>
|
||||
#include <pthread.h>
|
||||
#include "alsaloop.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
#define XRUN_PROFILE_UNKNOWN (-10000000)
|
||||
|
||||
|
|
|
@ -85,7 +85,9 @@ static void usage(void)
|
|||
"-T, --timestamp=... adds a timestamp in front of each dumped message\n"
|
||||
" realtime\n"
|
||||
" monotonic\n"
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
" raw\n"
|
||||
#endif
|
||||
"-t, --timeout=seconds exits when no data has been received\n"
|
||||
" for the specified duration\n"
|
||||
"-a, --active-sensing include active sensing bytes\n"
|
||||
|
@ -534,8 +536,10 @@ int main(int argc, char *argv[])
|
|||
cid = CLOCK_REALTIME;
|
||||
else if (strcasecmp(optarg, "monotonic") == 0)
|
||||
cid = CLOCK_MONOTONIC;
|
||||
#ifdef CLOCK_MONOTONIC_RAW
|
||||
else if (strcasecmp(optarg, "raw") == 0)
|
||||
cid = CLOCK_MONOTONIC_RAW;
|
||||
#endif
|
||||
else
|
||||
error("Clock type not known");
|
||||
break;
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
#define _GNU_SOURCE
|
||||
#include "aconfig.h"
|
||||
#include <stdio.h>
|
||||
#if HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -53,6 +55,7 @@
|
|||
#include "gettext.h"
|
||||
#include "formats.h"
|
||||
#include "version.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
#define ABS(a) (a) < 0 ? -(a) : (a)
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef FORMATS_H
|
||||
#define FORMATS_H 1
|
||||
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#include "bswap.h"
|
||||
|
||||
/* Definitions for .VOC files */
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "os_compat.h"
|
||||
|
||||
enum container_type {
|
||||
CONTAINER_TYPE_PARSER = 0,
|
||||
CONTAINER_TYPE_BUILDER,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "common.h"
|
||||
#include "alsa.h"
|
||||
#include "latencytest.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
struct pcm_container {
|
||||
snd_pcm_t *handle;
|
||||
|
|
|
@ -28,7 +28,7 @@ AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
|
|||
fi
|
||||
|
||||
|
||||
AC_CHECK_HEADERS([dlfcn.h])
|
||||
AC_CHECK_HEADERS([dlfcn.h malloc.h])
|
||||
|
||||
dnl Check components
|
||||
AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"],
|
||||
|
|
44
include/bswap.h
Normal file
44
include/bswap.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* ALSA lib - compatibility header for providing byte swapping macros
|
||||
* Copyright (c) 2016 by Thomas Klausner <wiz@NetBSD.org>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BSWAP_H
|
||||
#define __BSWAP_H
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
|
||||
#include <sys/endian.h>
|
||||
#define bswap_16 bswap16
|
||||
#define bswap_32 bswap32
|
||||
#define bswap_64 bswap64
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <sys/endian.h>
|
||||
#define bswap_16 swap16
|
||||
#define bswap_32 swap32
|
||||
#define bswap_64 swap64
|
||||
#elif defined (__sun)
|
||||
#include <sys/byteorder.h>
|
||||
#define bswap_16 BSWAP_16
|
||||
#define bswap_32 BSWAP_32
|
||||
#define bswap_64 BSWAP_64
|
||||
#else
|
||||
#include <byteswap.h>
|
||||
#endif
|
||||
|
||||
#endif
|
43
include/os_compat.h
Normal file
43
include/os_compat.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* ALSA lib - compatibility header for supporting various OSes
|
||||
* Copyright (C) 2022 by Takayoshi SASANO <uaa@cvs.openbsd.org>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __OS_COMPAT_H
|
||||
#define __OS_COMPAT_H
|
||||
|
||||
#ifndef ESTRPIPE
|
||||
#define ESTRPIPE ESPIPE
|
||||
#endif
|
||||
|
||||
#ifndef ERESTART
|
||||
#define ERESTART EINTR
|
||||
#endif
|
||||
|
||||
#ifndef SCHED_IDLE
|
||||
#define SCHED_IDLE SCHED_OTHER
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
/* these functions in <sched.h> are not implemented */
|
||||
#define sched_getparam(pid, param) (-1)
|
||||
#define sched_setscheduler(pid, policy, param) (-1)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -44,7 +44,7 @@
|
|||
#include <getopt.h>
|
||||
#include <inttypes.h>
|
||||
#include <ctype.h>
|
||||
#include <byteswap.h>
|
||||
#include "bswap.h"
|
||||
#include <signal.h>
|
||||
|
||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
||||
|
@ -56,6 +56,7 @@
|
|||
#include "aconfig.h"
|
||||
#include "gettext.h"
|
||||
#include "version.h"
|
||||
#include "os_compat.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <locale.h>
|
||||
|
|
Loading…
Reference in a new issue