Fix some ports improperly using the POSIX feature test macros. Just

checking if they're defined is wrong as -1 is a valid value to indicate
the feature is not supported. No package bumps as the code sections in
question are not being built at the moment.

from Brad
This commit is contained in:
ajacoutot 2012-03-30 06:09:54 +00:00
parent 3426005e53
commit 091bb20796
5 changed files with 143 additions and 5 deletions

View File

@ -1,14 +1,68 @@
$OpenBSD: patch-src_main_c,v 1.1 2011/10/30 16:05:35 dcoppa Exp $
--- src/main.c.orig Sun Oct 30 16:38:20 2011
+++ src/main.c Sun Oct 30 16:39:18 2011
@@ -235,8 +235,9 @@ int main(int argc, char **argv)
$OpenBSD: patch-src_main_c,v 1.2 2012/03/30 06:09:54 ajacoutot Exp $
--- src/main.c.orig Tue Oct 11 06:44:58 2011
+++ src/main.c Sat Mar 24 10:57:15 2012
@@ -41,7 +41,7 @@
#include <errno.h>
#include <string.h>
#include <stdlib.h>
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
#include <sched.h>
#endif
#include "server.h"
@@ -200,7 +200,7 @@ void daemonize()
}
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
void setscheduler()
{
int rc;
@@ -219,7 +219,7 @@ void printhelp()
printf("uMurmur version %s. Mumble protocol %d.%d.%d\n", UMURMUR_VERSION, PROTVER_MAJOR, PROTVER_MINOR, PROTVER_PATCH);
printf("Usage: umurmurd [-d] [-r] [-h] [-p <pidfile>] [-t] [-c <conf file>] [-a <addr>] [-b <port>]\n");
printf(" -d - Do not daemonize - run in foreground.\n");
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
printf(" -r - Run with realtime priority\n");
#endif
printf(" -p <pidfile> - Write PID to this file\n");
@@ -234,15 +234,16 @@ void printhelp()
int main(int argc, char **argv)
{
bool_t nodaemon = false;
#ifdef _POSIX_PRIORITY_SCHEDULING
-#ifdef _POSIX_PRIORITY_SCHEDULING
- bool_t realtime = false, testconfig = false;
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
+ bool_t realtime = false;
#endif
+ bool_t testconfig = false;
char *conffile = NULL, *pidfile = NULL;
int c;
struct utsname utsbuf;
/* Arguments */
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
while ((c = getopt(argc, argv, "drp:c:a:b:ht")) != EOF) {
#else
while ((c = getopt(argc, argv, "dp:c:a:b:ht")) != EOF) {
@@ -269,7 +270,7 @@ int main(int argc, char **argv)
case 't':
testconfig = true;
break;
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
case 'r':
realtime = true;
break;
@@ -333,7 +334,7 @@ int main(int argc, char **argv)
Chan_init();
Client_init();
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
if (realtime)
setscheduler();
#endif

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-src_process_cpp,v 1.1 2012/03/30 06:09:54 ajacoutot Exp $
--- src/process.cpp.orig Fri Jan 16 07:27:00 2009
+++ src/process.cpp Sat Mar 24 10:15:59 2012
@@ -526,7 +526,7 @@ void Process::attach(const char *dev)
void Process::setScheduler(const char *pol)
{
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
struct sched_param p;
int policy;
@@ -582,7 +582,7 @@ void Process::setScheduler(const char *pol)
void Process::setPriority(int pri)
{
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
struct sched_param p;
int policy = sched_getscheduler(0);
int min = sched_get_priority_min(policy);
@@ -607,7 +607,7 @@ void Process::setPriority(int pri)
bool Process::isScheduler(void)
{
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
return true;
#else
return false;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-encodedv_dvconnect_c,v 1.3 2012/03/30 06:09:54 ajacoutot Exp $
--- encodedv/dvconnect.c.orig Sat Mar 24 10:10:08 2012
+++ encodedv/dvconnect.c Sat Mar 24 10:13:34 2012
@@ -857,7 +857,7 @@ int send_raw(const char*const* filenames, int channel,
int rt_raisepri (int pri)
{
-#ifdef _SC_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
struct sched_param scp;
/*

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-lib_clplumbing_realtime_c,v 1.1 2012/03/30 06:09:54 ajacoutot Exp $
--- lib/clplumbing/realtime.c.orig Fri Mar 23 18:05:27 2012
+++ lib/clplumbing/realtime.c Sat Mar 24 10:19:25 2012
@@ -31,7 +31,7 @@
# include <sys/time.h>
# include <sys/resource.h>
#endif
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
# include <sched.h>
#endif
#include <string.h>
@@ -44,7 +44,7 @@
static gboolean cl_realtimepermitted = TRUE;
static void cl_rtmalloc_setup(void);
-#if defined(SCHED_RR) && defined(_POSIX_PRIORITY_SCHEDULING) && !defined(ON_DARWIN)
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) && defined(SCHED_RR) && !defined(ON_DARWIN)
# define DEFAULT_REALTIME SCHED_RR
#endif

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-lib_stonith_expect_c,v 1.1 2012/03/30 06:09:54 ajacoutot Exp $
--- lib/stonith/expect.c.orig Fri Mar 23 18:01:26 2012
+++ lib/stonith/expect.c Sat Mar 24 10:19:56 2012
@@ -47,7 +47,7 @@
#define ENABLE_PIL_DEFS_PRIVATE
#include <pils/plugin.h>
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0)
# include <sched.h>
#endif
@@ -301,7 +301,7 @@ StartProcess(const char * cmd, int * readfd, int * wri
dup2(rdpipe[1], 1);
close(rdpipe[0]);
close(rdpipe[1]);
-#if defined(SCHED_OTHER) && !defined(ON_DARWIN)
+#if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING > 0) && defined(SCHED_OTHER) && !defined(ON_DARWIN)
{
/*
* Try and (re)set our scheduling to "normal"