summaryrefslogtreecommitdiff
path: root/audio/csound-bath/patches/patch-au
diff options
context:
space:
mode:
Diffstat (limited to 'audio/csound-bath/patches/patch-au')
-rw-r--r--audio/csound-bath/patches/patch-au56
1 files changed, 56 insertions, 0 deletions
diff --git a/audio/csound-bath/patches/patch-au b/audio/csound-bath/patches/patch-au
new file mode 100644
index 00000000000..71c616bb271
--- /dev/null
+++ b/audio/csound-bath/patches/patch-au
@@ -0,0 +1,56 @@
+$NetBSD: patch-au,v 1.1 2003/01/19 21:31:13 hubertf Exp $
+
+--- main.c.orig Mon Dec 23 14:11:59 2002
++++ main.c
+@@ -51,13 +51,21 @@
+ #include <unistd.h> /* Linux real-time by Istvan Varga, Jan 2002 */
+ #include <sys/types.h>
+ #include <errno.h>
++#if defined(__NetBSD__)
++#include <sys/time.h>
++#include <sys/resource.h>
++#define HIGH_PRIORITY -20
++#else
+ #include <sched.h>
+ #include <sys/mman.h>
++#endif
+
+ void set_rt_priority(int argc, char **argv)
+ {
+ int rtmode;
++#if !defined(__NetBSD__)
+ struct sched_param p;
++#endif
+ int i;
+
+ if (geteuid() != 0) return; /* not root, nothing to do */
+@@ -88,7 +96,7 @@
+ return;
+ }
+
+-#ifndef __FreeBSD__
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ /* lock all pages into physical memory */
+ if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0) {
+ err_printf( "csound: cannot lock memory pages: %s\n",
+@@ -97,6 +105,12 @@ void set_rt_priority(int argc, char **ar
+ }
+ #endif
+
++#if defined(__NetBSD__)
++ if (setpriority(PRIO_PROCESS, 0, HIGH_PRIORITY) != 0) {
++ err_printf( "csound: cannot set high priority: %s\n", strerror(errno));
++ exit(-1);
++ }
++#else
+ /* set round robin mode with max. priority */
+ p.sched_priority = sched_get_priority_max(SCHED_RR);
+ if (sched_setscheduler(0, SCHED_RR, &p) != 0) {
+@@ -104,6 +118,7 @@
+ strerror(errno));
+ exit(-1);
+ }
++#endif
+ /* give up root permissions */
+ setuid(getuid());
+ }