1 /* 2 Copyright (c) 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 6 source tree. 7 */ 8 9 /* 10 * successful unamed semaphore initialization return zero 11 * on successful completion. 12 */ 13 14 #include <sys/types.h> 15 #include <stdio.h> 16 #include <errno.h> 17 #include <unistd.h> 18 #include <semaphore.h> 19 #include <sys/stat.h> 20 #include <fcntl.h> 21 #include "posixtest.h" 22 23 #define TEST "5-2" 24 #define FUNCTION "sem_init" 25 #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " 26 27 int main(void) 28 { 29 sem_t mysemp; 30 31 if (sem_init(&mysemp, 0, 1) == 0) { 32 puts("TEST PASSED"); 33 sem_destroy(&mysemp); 34 return PTS_PASS; 35 } else { 36 puts("TEST FAILED"); 37 return PTS_FAIL; 38 } 39 } 40