source: rtems/testsuites/psxtests/psxhdrs/semaphore/sem_close.c @ 7ea4c02

5
Last change on this file since 7ea4c02 was 7ea4c02, checked in by Himanshu40 <himanshuwindows8.1@…>, on 11/29/18 at 17:03:19

psxtests : Add POSIX API Signature Compliance Tests for semaphore.h (GCI 2018)

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 *  @file
3 *  @brief sem_close() API Conformance Test
4 */
5
6 /*
7  *  COPYRIGHT (c) 2018.
8  *  Himanshu Sekhar Nayak
9  *
10  *  Permission to use, copy, modify, and/or distribute this software
11  *  for any purpose with or without fee is hereby granted.
12  *
13  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
14  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
15  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
16  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
17  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21
22  #ifdef HAVE_CONFIG_H
23  #include "config.h"
24  #endif
25
26  #include <fcntl.h>
27  #include <sys/stat.h>
28  #include <semaphore.h>
29
30  int test( void );
31
32  int test( void )
33  {
34    sem_t *sem1;
35    int oflag = O_CREAT;
36    int result;
37    int value;
38
39    value = 1;
40
41    sem1 = sem_open( "sem", oflag, 0777, value );
42    result = sem_close( sem1 );
43
44    return result;
45  }
Note: See TracBrowser for help on using the repository browser.