Home | History | Annotate | Download | only in sem_init
      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  * un-successful unamed semaphore initialization return -1, otherwise 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-1"
     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) == -1) {
     32 		puts("TEST FAILED");
     33 		return PTS_FAIL;
     34 	} else {
     35 		puts("TEST PASSED");
     36 		sem_destroy(&mysemp);
     37 		return PTS_PASS;
     38 	}
     39 }
     40