//my_pxsem_fifo/sem_post.c
#include	"unpipc.h"
#include	"semaphore.h"

int
mysem_post(mysem_t *sem)
{
	char	c;

	if (sem->sem_magic != SEM_MAGIC) {
		errno = EINVAL;
		return(-1);
	}

	if (write(sem->sem_fd[1], &c, 1) == 1)
		return(0);
	return(-1);
}
