2 Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
3 Created by: majid.awad REMOVE-THIS AT intel DOT com
4 This file is licensed under the GPL license. For the full content
5 of this license, see the COPYING file at the top level of this
10 sem_open test case that attempts to open a new semaphoree, and then
11 try to un-lock it with sem_post. Making sure the semaphore is not locked.
14 #include <sys/types.h>
18 #include <semaphore.h>
21 #include "posixtest.h"
24 #define FUNCTION "sem_open"
25 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": "
33 sprintf(semname, "/" FUNCTION "_" TEST "_%d", getpid());
35 mysemp = sem_open(semname, O_CREAT, 0777, 1);
36 if( mysemp == SEM_FAILED || mysemp == NULL ) {
37 perror(ERROR_PREFIX "sem_open");
38 return PTS_UNRESOLVED;
42 /* Checking if mysemp has a value returned. From sem_open */
43 if ( sem_post(mysemp) == 0 ) {