/*
* 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
*/
/*
*/
#include "lint.h"
#include "mtlib.h"
#include <semaphore.h>
#include <synch.h>
#include <errno.h>
#include <stdarg.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <thread.h>
#include "pos4obj.h"
typedef struct semaddr {
} semaddr_t;
static long semvaluemax = 0;
sem_t *
{
int fd = 0;
int error = 0;
int cr_flag = 0;
return (SEM_FAILED);
/* acquire semaphore lock to have atomic operation */
return (SEM_FAILED);
/* modify oflag to have RDWR and filter CREATE mode only */
if (semvaluemax == 0 &&
semvaluemax = -1;
/* check value < the max for a named semaphore */
if (semvaluemax < 0 ||
goto out;
}
}
errno = 0;
goto out;
if (cr_flag)
else
/* find out inode # for the opened file */
goto out;
/* if created, acquire total_size in the file */
if ((cr_flag & DFILE_CREATE) != 0) {
goto out;
} else {
/*
* if this semaphore has already been opened, inode
* will indicate then return the same semaphore address
*/
(void) __close_nc(fd);
}
}
}
/* new sem descriptor to be allocated and new address to be mapped */
goto out;
}
(void) __close_nc(fd);
cr_flag &= ~DFILE_OPEN;
if (sem == MAP_FAILED)
goto out;
cr_flag |= DFILE_MMAP;
/* if created, initialize */
if (cr_flag & DFILE_CREATE) {
if (error) {
goto out;
}
}
/* add to the list pointed by semheadp */
return (sem);
}
/* fall into the error case */
out:
if ((cr_flag & DFILE_OPEN) != 0)
(void) __close_nc(fd);
if ((cr_flag & DFILE_CREATE) != 0)
if ((cr_flag & DFILE_MMAP) != 0)
return (SEM_FAILED);
}
int
{
}
}
return (-1);
}
int
{
int error;
int oerrno;
if (__pos4obj_check(path) < 0)
return (-1);
return (-1);
return (error);
}
/*
* SUSV3 requires ("shall fail") an EINVAL failure for operations
* on invalid semaphores, including uninitialized unnamed semaphores.
* The best we can do is check that the magic number is correct.
* This is not perfect, but it allows the test suite to pass.
* (Standards bodies are filled with fools and idiots.)
*/
static int
{
return (-1);
}
return (0);
}
int
{
int error;
return (-1);
}
return (0);
}
int
{
int error;
if (sem_invalid(sem))
return (-1);
return (-1);
}
return (0);
}
int
{
int error;
if (sem_invalid(sem))
return (-1);
return (-1);
}
return (0);
}
int
{
int error;
if (sem_invalid(sem))
return (-1);
return (-1);
}
return (0);
}
int
{
int error;
if (sem_invalid(sem))
return (-1);
return (-1);
}
return (0);
}
int
{
int error;
if (sem_invalid(sem))
return (-1);
return (-1);
}
return (0);
}
int
{
int error;
if (sem_invalid(sem))
return (-1);
return (-1);
}
return (0);
}
int
{
if (sem_invalid(sem))
return (-1);
return (0);
}