semaphore.c revision a574db851cdc636fc3939b68e80d79fe7fbd57f2
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#pragma ident "%Z%%M% %I% %E% SMI"
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * This file contains the semaphore operations.
9512fe850e98fdd448c638ca63fdd92a8a510255ahlstatic void sema_change_pri(kthread_t *t, pri_t pri, pri_t *t_prip);
sema_impl_t *s;
*tpp = t;
sema_impl_t *s;
if (tp == t) {
static kthread_t *
sema_impl_t *s;
if (tp == t) {
CL_SETRUN(t);
sema_impl_t *s;
while (s->s_count == 0) {
if (panicstr) {
swtch();
s->s_count--;
int cancel_pending;
int cancelled = 0;
sema_impl_t *s;
while (s->s_count == 0) {
thread_lock_high(t);
setrun(t);
swtch();
if (cancelled)
s->s_count--;
sema_impl_t *s;
if (panicstr) {
s->s_count++;
sema_impl_t *s;
int gotit = 0;
if (s->s_count > 0) {
s->s_count--;
return (gotit);
sema_impl_t *s;
if (panicstr)
return (s->s_count <= 0);