From fae5965c529df977c2df57bb083a8f364475e6d9 Mon Sep 17 00:00:00 2001 From: nathanw Date: Wed, 29 Dec 2004 00:59:57 +0000 Subject: [PATCH] Implement pthread_attr_{set,get}schedpolicy() at the same level as the other scheduling stuff: only handle SCHED_OTHER. Like the rest of the scheduling stuff, this is for the benefit of code that can't be bothered to test against _POSIX_THREAD_PRIORITY_SCHEDULING. --- lib/libpthread/pthread.h | 4 +++- lib/libpthread/pthread_attr.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/lib/libpthread/pthread.h b/lib/libpthread/pthread.h index fb9126c6f155..b054b889b4ca 100644 --- a/lib/libpthread/pthread.h +++ b/lib/libpthread/pthread.h @@ -1,4 +1,4 @@ -/* $NetBSD: pthread.h,v 1.19 2004/12/15 16:29:53 wiz Exp $ */ +/* $NetBSD: pthread.h,v 1.20 2004/12/29 00:59:57 nathanw Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -70,6 +70,8 @@ int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *); int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *); +int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); +int pthread_attr_setschedpolicy(pthread_attr_t *, int); int pthread_attr_getscope(const pthread_attr_t *, int *); int pthread_attr_setscope(pthread_attr_t *, int); int pthread_attr_getstack(const pthread_attr_t *, void **, size_t *); diff --git a/lib/libpthread/pthread_attr.c b/lib/libpthread/pthread_attr.c index acb22e78b3c5..730b5d561bd8 100644 --- a/lib/libpthread/pthread_attr.c +++ b/lib/libpthread/pthread_attr.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_attr.c,v 1.3 2003/11/09 18:56:48 christos Exp $ */ +/* $NetBSD: pthread_attr.c,v 1.4 2004/12/29 00:59:57 nathanw Exp $ */ /*- * Copyright (c) 2001,2002,2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__RCSID("$NetBSD: pthread_attr.c,v 1.3 2003/11/09 18:56:48 christos Exp $"); +__RCSID("$NetBSD: pthread_attr.c,v 1.4 2004/12/29 00:59:57 nathanw Exp $"); #include #include @@ -267,6 +267,31 @@ pthread_attr_getschedparam(const pthread_attr_t *attr, } +int +/*ARGSUSED*/ +pthread_attr_setschedpolicy(pthread_attr_t *attr, + int policy) +{ + + if (policy != SCHED_OTHER) + return ENOTSUP; + + return 0; +} + + +int +/*ARGSUSED*/ +pthread_attr_getschedpolicy(const pthread_attr_t *attr, + int *policy) +{ + + policy = SCHED_OTHER; + + return 0; +} + + int pthread_attr_getstack(const pthread_attr_t *attr, void **addr, size_t *size) {