#include <syslog.h>
#include <sched.h>
#include "alsactl.h"
+#include "os_compat.h"
#ifndef SYS_ASOUND_DIR
#define SYS_ASOUND_DIR "/var/lib/alsa"
#include <syslog.h>
#include <signal.h>
#include "alsaloop.h"
+#include "os_compat.h"
struct loopback_thread {
int threaded;
#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)
{
#include <syslog.h>
#include <pthread.h>
#include "alsaloop.h"
+#include "os_compat.h"
#define XRUN_PROFILE_UNKNOWN (-10000000)
"-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"
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;
#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>
#include "gettext.h"
#include "formats.h"
#include "version.h"
+#include "os_compat.h"
#define ABS(a) (a) < 0 ? -(a) : (a)
#ifndef FORMATS_H
#define FORMATS_H 1
-#include <endian.h>
-#include <byteswap.h>
+#include "bswap.h"
/* Definitions for .VOC files */
#include <alsa/asoundlib.h>
+#include "os_compat.h"
+
enum container_type {
CONTAINER_TYPE_PARSER = 0,
CONTAINER_TYPE_BUILDER,
#include "common.h"
#include "alsa.h"
#include "latencytest.h"
+#include "os_compat.h"
struct pcm_container {
snd_pcm_t *handle;
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"],
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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
#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
#include "aconfig.h"
#include "gettext.h"
#include "version.h"
+#include "os_compat.h"
#ifdef ENABLE_NLS
#include <locale.h>