/*
* 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.
*/
#include "lint.h"
#include "thr_uberdata.h"
#include <sched.h>
/*
* Default attribute object for pthread_create() with NULL attr pointer.
* Note that the 'guardsize' field is initialized on the first call.
*/
const thrattr_t *
def_thrattr(void)
{
0, /* stksize */
NULL, /* stkaddr */
PTHREAD_CREATE_JOINABLE, /* detachstate */
PTHREAD_CREATE_NONDAEMON_NP, /* daemonstate */
PTHREAD_SCOPE_PROCESS, /* scope */
0, /* prio */
SCHED_OTHER, /* policy */
PTHREAD_INHERIT_SCHED, /* inherit */
0 /* guardsize */
};
return (&thrattr);
}
/*
* pthread_attr_init: allocates the attribute object and initializes it
* with the default values.
*/
int
{
*ap = *def_thrattr();
return (0);
}
return (ENOMEM);
}
/*
* pthread_attr_destroy: frees the attribute object and invalidates it
* with NULL value.
*/
int
{
return (EINVAL);
return (0);
}
/*
* pthread_attr_clone: make a copy of a pthread_attr_t.
*/
int
{
return (EINVAL);
return (ENOMEM);
return (0);
}
/*
* pthread_attr_equal: compare two pthread_attr_t's, return 1 if equal.
* A NULL pthread_attr_t pointer implies default attributes.
* This is a consolidation-private interface, for librt.
*/
int
{
return (0);
}
/*
* pthread_attr_setstacksize: sets the user stack size, minimum should
* be PTHREAD_STACK_MIN (MINSTACK).
* This is equivalent to stksize argument in thr_create().
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getstacksize: gets the user stack size.
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setstackaddr: sets the user stack addr.
* This is equivalent to stkaddr argument in thr_create().
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getstackaddr: gets the user stack addr.
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setdetachstate: sets the detach state to DETACHED or JOINABLE.
* PTHREAD_CREATE_DETACHED is equivalent to thr_create(THR_DETACHED).
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getdetachstate: gets the detach state.
*/
int
{
detachstate != NULL) {
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setdaemonstate_np: sets the daemon state to DAEMON or NONDAEMON.
* PTHREAD_CREATE_DAEMON is equivalent to thr_create(THR_DAEMON).
* For now, this is a private interface in libc.
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getdaemonstate_np: gets the daemon state.
* For now, this is a private interface in libc.
*/
int
{
daemonstate != NULL) {
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setscope: sets the scope to SYSTEM or PROCESS.
* This is equivalent to setting THR_BOUND flag in thr_create().
*/
int
{
(scope == PTHREAD_SCOPE_SYSTEM ||
scope == PTHREAD_SCOPE_PROCESS)) {
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getscope: gets the scheduling scope.
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setinheritsched: sets the scheduling parameters to be
* EXPLICIT or INHERITED from parent thread.
*/
int
{
(inherit == PTHREAD_EXPLICIT_SCHED ||
inherit == PTHREAD_INHERIT_SCHED)) {
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getinheritsched: gets the scheduling inheritance.
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setschedpolicy: sets the scheduling policy.
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getpolicy: gets the scheduling policy.
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setschedparam: sets the scheduling parameters.
* Currently, we support priority only.
*/
int
const struct sched_param *param)
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getschedparam: gets the scheduling parameters.
* Currently, only priority is defined as sched parameter.
*/
int
struct sched_param *param)
{
return (0);
}
return (EINVAL);
}
/*
* UNIX98
* pthread_attr_setguardsize: sets the guardsize
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* UNIX98
* pthread_attr_getguardsize: gets the guardsize
*/
int
{
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_setstack: sets the user stack addr and stack size.
* This is equivalent to the stack_base and stack_size arguments
* to thr_create().
*/
int
{
return (EACCES);
return (0);
}
return (EINVAL);
}
/*
* pthread_attr_getstack: gets the user stack addr and stack size.
*/
int
{
return (0);
}
return (EINVAL);
}