pthr_mutex.c revision 7257d1b4d25bfac0c802847390e98a464fd787ac
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lint.h"
#include "thr_uberdata.h"
#include <pthread.h>
/*
* pthread_mutexattr_init: allocates the mutex attribute object and
* initializes it with the default values.
*/
int
{
return (ENOMEM);
return (0);
}
/*
* pthread_mutexattr_destroy: frees the mutex attribute object and
* invalidates it with NULL value.
*/
int
{
return (EINVAL);
return (0);
}
/*
* pthread_mutexattr_setpshared: sets the shared attribute
* to PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED.
* This is equivalent to setting the USYNC_THREAD/USYNC_PROCESS
* flag in mutex_init().
*/
int
{
(pshared != PTHREAD_PROCESS_PRIVATE &&
return (EINVAL);
return (0);
}
/*
* pthread_mutexattr_getpshared: gets the shared attribute.
*/
int
{
return (EINVAL);
return (0);
}
/*
* pthread_mutexattr_setprioceiling: sets the prioceiling attribute.
*/
int
{
return (EINVAL);
return (0);
}
/*
* pthread_mutexattr_getprioceiling: gets the prioceiling attribute.
*/
#pragma weak _pthread_mutexattr_getprioceiling = \
int
{
return (EINVAL);
return (0);
}
/*
* pthread_mutexattr_setprotocol: sets the protocol attribute.
*/
int
{
return (EINVAL);
if (protocol != PTHREAD_PRIO_NONE &&
protocol != PTHREAD_PRIO_INHERIT &&
return (ENOTSUP);
return (0);
}
/*
* pthread_mutexattr_getprotocol: gets the protocol attribute.
*/
int
{
return (EINVAL);
return (0);
}
/*
* pthread_mutexattr_setrobust_np: sets the robustness attribute
* to PTHREAD_MUTEX_ROBUST_NP or PTHREAD_MUTEX_STALL_NP.
*/
int
{
(robust != PTHREAD_MUTEX_ROBUST_NP &&
return (EINVAL);
return (0);
}
/*
* pthread_mutexattr_getrobust_np: gets the robustness attribute.
*/
int
{
return (EINVAL);
return (0);
}
/*
* pthread_mutex_init: Initializes the mutex object. It copies the
* various attributes into one type argument and calls mutex_init().
*/
int
{
int type;
int prioceiling = 0;
/*
* All of the pshared, type, protocol, robust attributes
* translate to bits in the mutex_type field.
*/
return (EINVAL);
} else {
}
}
/*
* pthread_mutex_setprioceiling: sets the prioceiling.
* From the SUSv3 (POSIX) specification for pthread_mutex_setprioceiling():
* The process of locking the mutex need not
* adhere to the priority protect protocol.
* We pass the MUTEX_NOCEIL flag to mutex_lock_internal() so that
* a non-realtime thread can successfully execute this operation.
*/
int
{
int error;
return (EINVAL);
if (error == 0) {
if (oceil)
}
return (error);
}
/*
* pthread_mutex_getprioceiling: gets the prioceiling.
*/
int
{
return (0);
}
/*
* UNIX98
* pthread_mutexattr_settype: sets the type attribute
*/
int
{
return (EINVAL);
switch (type) {
case PTHREAD_MUTEX_NORMAL:
type = LOCK_NORMAL;
break;
case PTHREAD_MUTEX_ERRORCHECK:
break;
case PTHREAD_MUTEX_RECURSIVE:
break;
default:
return (EINVAL);
}
return (0);
}
/*
* UNIX98
* pthread_mutexattr_gettype: gets the type attribute.
*/
int
{
int type;
return (EINVAL);
case LOCK_NORMAL:
break;
case LOCK_ERRORCHECK:
break;
case LOCK_RECURSIVE | LOCK_ERRORCHECK:
break;
default:
return (EINVAL);
}
return (0);
}