summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libpthread/man/Makefile.inc5
-rw-r--r--lib/libpthread/man/pthread_schedparam.316
-rw-r--r--lib/libpthread/man/sched_prio.371
-rw-r--r--lib/libpthread/shlib_version2
-rw-r--r--lib/libpthread/uthread/Makefile.inc3
-rw-r--r--lib/libpthread/uthread/sched_prio.c45
6 files changed, 133 insertions, 9 deletions
diff --git a/lib/libpthread/man/Makefile.inc b/lib/libpthread/man/Makefile.inc
index 959b9b16264..7819c0f7435 100644
--- a/lib/libpthread/man/Makefile.inc
+++ b/lib/libpthread/man/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.24 2010/04/12 01:54:23 tedu Exp $
+# $OpenBSD: Makefile.inc,v 1.25 2010/11/07 13:29:21 fgsch Exp $
# $FreeBSD: Makefile.inc,v 1.6 1999/08/28 00:03:02 peter Exp $
# POSIX thread man files
@@ -59,6 +59,7 @@ MAN+= \
pthread_suspend_np.3 \
pthread_testcancel.3 \
pthread_yield.3 \
+ sched_prio.3 \
sem_destroy.3 \
sem_getvalue.3 \
sem_init.3 \
@@ -103,6 +104,8 @@ MLINKS+=flockfile.3 funlockfile.3 \
pthread_testcancel.3 pthread_setcancelstate.3 \
pthread_testcancel.3 pthread_setcanceltype.3 \
pthread_getconcurrency.3 pthread_setconcurrency.3 \
+ sched_prio.3 sched_get_priority_max.3 \
+ sched_prio.3 sched_get_priority_min.3 \
sem_open.3 sem_close.3 \
sem_open.3 sem_unlink.3 \
sem_wait.3 sem_trywait.3
diff --git a/lib/libpthread/man/pthread_schedparam.3 b/lib/libpthread/man/pthread_schedparam.3
index f145b7e7c6e..1aa49349d4a 100644
--- a/lib/libpthread/man/pthread_schedparam.3
+++ b/lib/libpthread/man/pthread_schedparam.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pthread_schedparam.3,v 1.2 2007/05/31 19:19:37 jmc Exp $
+.\" $OpenBSD: pthread_schedparam.3,v 1.3 2010/11/07 13:29:21 fgsch Exp $
.\" Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
.\" All rights reserved.
.\"
@@ -27,7 +27,7 @@
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/lib/libc_r/man/pthread_schedparam.3,v 1.4 2001/07/15 07:53:27 dd Exp $
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: November 7 2010 $
.Dt PTHREAD_SCHEDPARAM 3
.Os
.Sh NAME
@@ -53,10 +53,11 @@ The scheduling policy for a thread can either be
(round-robin).
The thread priority (accessed via
.Va param->sched_priority )
-must be at least
-.Dv PTHREAD_MIN_PRIORITY
-and no more than
-.Dv PTHREAD_MAX_PRIORITY .
+must be within the range returned by the
+.Fn sched_get_priority_min
+and
+.Fn sched_get_priority_max
+functions.
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error.
@@ -81,6 +82,9 @@ will fail if:
Non-existent thread
.Va thread .
.El
+.Sh SEE ALSO
+.Xr sched_get_priority_max 3 ,
+.Xr sched_get_priority_min 3
.Sh STANDARDS
.Fn pthread_setschedparam
and
diff --git a/lib/libpthread/man/sched_prio.3 b/lib/libpthread/man/sched_prio.3
new file mode 100644
index 00000000000..4b15fd94e6f
--- /dev/null
+++ b/lib/libpthread/man/sched_prio.3
@@ -0,0 +1,71 @@
+.\" $OpenBSD: sched_prio.3,v 1.1 2010/11/07 13:29:21 fgsch Exp $
+.\"
+.\" Copyright (c) 2010 Federico G. Schwindt <fgsch@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for
+.\" any purpose with or without fee is hereby granted, provided that
+.\" the above copyright notice and this permission notice appear in all
+.\" copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+.\" WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+.\" WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+.\" AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
+.\" OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+.\" PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: November 7 2010 $
+.Dt SCHED_PRIO 3
+.Os
+.Sh NAME
+.Nm sched_get_priority_max ,
+.Nm sched_get_priority_min
+.Nd get priority limits
+.Sh SYNOPSIS
+.Fd #include <sched.h>
+.Ft int
+.Fn sched_get_priority_max "int policy"
+.Ft int
+.Fn sched_get_priority_min "int policy"
+.Sh DESCRIPTION
+The
+.Fn sched_get_priority_max
+and
+.Fn sched_get_priority_min
+functions return the maximum and minimum priority values, respectively,
+for the scheduling policy specified by
+.Fa policy .
+.Pp
+The scheduling policy for a thread can either be
+.Dv SCHED_FIFO
+(first in, first out),
+.Dv SCHED_RR
+(round-robin) or
+.Dv SCHED_OTHER .
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn sched_get_priority_max
+and
+.Fn sched_get_priority_min
+return the maximum and minimum priority values, respectively.
+Otherwise, a value of -1 is returned and errno is set to indicate the error.
+.Sh ERRORS
+The
+.Fn sched_get_priority_max
+and
+.Fn sched_get_priority_min
+functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+Invalid value for
+.Fa policy .
+.Sh STANDARDS
+.Fn sched_get_priority_max
+and
+.Fn sched_get_priority_min
+conforms to
+.St -p1003.1-2008 .
+.Pp
+This implementation does not support process scheduling.
diff --git a/lib/libpthread/shlib_version b/lib/libpthread/shlib_version
index 262f3bc13b6..b91c32ce7c8 100644
--- a/lib/libpthread/shlib_version
+++ b/lib/libpthread/shlib_version
@@ -1,2 +1,2 @@
major=13
-minor=0
+minor=1
diff --git a/lib/libpthread/uthread/Makefile.inc b/lib/libpthread/uthread/Makefile.inc
index 66908ef5a21..7b457350353 100644
--- a/lib/libpthread/uthread/Makefile.inc
+++ b/lib/libpthread/uthread/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.22 2010/02/03 20:49:00 miod Exp $
+# $OpenBSD: Makefile.inc,v 1.23 2010/11/07 13:29:21 fgsch Exp $
# $FreeBSD: Makefile.inc,v 1.19 1999/08/28 00:03:19 peter Exp $
# uthread sources
@@ -7,6 +7,7 @@
CFLAGS += -I${SRCDIR}/arch/${MACHINE_CPU}
SRCS+= \
+ sched_prio.c \
uthread_accept.c \
uthread_atfork.c \
uthread_attr_destroy.c \
diff --git a/lib/libpthread/uthread/sched_prio.c b/lib/libpthread/uthread/sched_prio.c
new file mode 100644
index 00000000000..1e48a747554
--- /dev/null
+++ b/lib/libpthread/uthread/sched_prio.c
@@ -0,0 +1,45 @@
+/* $OpenBSD: sched_prio.c,v 1.1 2010/11/07 13:29:21 fgsch Exp $ */
+
+/*
+ * Copyright (c) 2010 Federico G. Schwindt <fgsch@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose with or without fee is hereby granted, provided that
+ * the above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
+ * OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <errno.h>
+#ifdef _THREAD_SAFE
+#include <pthread.h>
+#include "pthread_private.h"
+
+int
+sched_get_priority_max(int policy)
+{
+ if (policy < SCHED_FIFO || policy > SCHED_RR) {
+ errno = EINVAL;
+ return (-1);
+ }
+ return (PTHREAD_MAX_PRIORITY);
+}
+
+int
+sched_get_priority_min(int policy)
+{
+ if (policy < SCHED_FIFO || policy > SCHED_RR) {
+ errno = EINVAL;
+ return (-1);
+ }
+ return (PTHREAD_MIN_PRIORITY);
+}
+#endif