/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/*
* semaphore(9f)
*/
/* This is the API we're emulating */
#include <sys/semaphore.h>
/* <synch.h> */
int _lwp_sema_init(lwp_sema_t *, int);
int _lwp_sema_wait(lwp_sema_t *);
int _lwp_sema_trywait(lwp_sema_t *);
int _lwp_sema_post(lwp_sema_t *);
/* ARGSUSED */
void
{
}
/* ARGSUSED */
void
{
}
void
{
int rv;
do {
}
void
{
(void) _lwp_sema_post(sem);
}
/*
* Return values:
* 1: interrupted
* 0: success
*/
int
{
int rv;
switch (rv) {
case 0:
/* rv = 0 ; success */
break;
case EINTR:
default:
break;
}
return (rv);
}
/*
* Return values:
* 0: could not get semaphore
* 1: successful (backwards from sema_p_sig!)
*/
int
{
int rv;
switch (rv) {
case 0:
break;
case EBUSY:
default:
rv = 0; /* failed */
break;
}
return (rv);
}