summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authord <d@openbsd.org>1999-01-17 23:57:16 +0000
committerd <d@openbsd.org>1999-01-17 23:57:16 +0000
commitf25deca83cd23c61999e15860603c64565b96c0e (patch)
tree6e06f09e0fd5cc020a8cdf46c13f5c24447c6e3e
parentmi+md jmp_buf; save i386s fs and gs for WINE (csapuntz@stanford.edu) (diff)
downloadwireguard-openbsd-f25deca83cd23c61999e15860603c64565b96c0e.tar.xz
wireguard-openbsd-f25deca83cd23c61999e15860603c64565b96c0e.zip
pthread_getschedparam() and pthread_setschedparam() stubs
-rw-r--r--lib/libc_r/uthread/uthread_setprio.c33
-rw-r--r--lib/libpthread/uthread/uthread_setprio.c33
2 files changed, 64 insertions, 2 deletions
diff --git a/lib/libc_r/uthread/uthread_setprio.c b/lib/libc_r/uthread/uthread_setprio.c
index 87a50d0f5ba..7de34d3c7c1 100644
--- a/lib/libc_r/uthread/uthread_setprio.c
+++ b/lib/libc_r/uthread/uthread_setprio.c
@@ -29,11 +29,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: uthread_setprio.c,v 1.2 1999/01/06 05:29:26 d Exp $
+ * $OpenBSD: uthread_setprio.c,v 1.3 1999/01/17 23:57:16 d Exp $
*/
#include <errno.h>
#ifdef _THREAD_SAFE
#include <pthread.h>
+#include <sched.h>
#include "pthread_private.h"
int
@@ -54,4 +55,34 @@ pthread_setprio(pthread_t pthread, int prio)
/* Return the error status: */
return (ret);
}
+
+int
+pthread_getschedparam(thread, policy, param)
+ pthread_t thread;
+ int *policy;
+ struct sched_param *param;
+{
+ int ret = 0;
+
+ if ((ret = _find_thread(thread)) == 0) {
+ if (policy)
+ *policy = SCHED_RR;
+ if (param)
+ param->sched_priority = thread->pthread_priority;
+ }
+ return (ret);
+}
+
+int
+pthread_setschedparam(thread, policy, param)
+ pthread_t thread;
+ int policy;
+ const struct sched_param *param;
+{
+
+ if (policy == SCHED_RR)
+ return pthread_setprio(thread, param->sched_priority);
+ else
+ return (EINVAL);
+}
#endif
diff --git a/lib/libpthread/uthread/uthread_setprio.c b/lib/libpthread/uthread/uthread_setprio.c
index 87a50d0f5ba..7de34d3c7c1 100644
--- a/lib/libpthread/uthread/uthread_setprio.c
+++ b/lib/libpthread/uthread/uthread_setprio.c
@@ -29,11 +29,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: uthread_setprio.c,v 1.2 1999/01/06 05:29:26 d Exp $
+ * $OpenBSD: uthread_setprio.c,v 1.3 1999/01/17 23:57:16 d Exp $
*/
#include <errno.h>
#ifdef _THREAD_SAFE
#include <pthread.h>
+#include <sched.h>
#include "pthread_private.h"
int
@@ -54,4 +55,34 @@ pthread_setprio(pthread_t pthread, int prio)
/* Return the error status: */
return (ret);
}
+
+int
+pthread_getschedparam(thread, policy, param)
+ pthread_t thread;
+ int *policy;
+ struct sched_param *param;
+{
+ int ret = 0;
+
+ if ((ret = _find_thread(thread)) == 0) {
+ if (policy)
+ *policy = SCHED_RR;
+ if (param)
+ param->sched_priority = thread->pthread_priority;
+ }
+ return (ret);
+}
+
+int
+pthread_setschedparam(thread, policy, param)
+ pthread_t thread;
+ int policy;
+ const struct sched_param *param;
+{
+
+ if (policy == SCHED_RR)
+ return pthread_setprio(thread, param->sched_priority);
+ else
+ return (EINVAL);
+}
#endif