1/*
2 *  This program is free software; you can redistribute it and/or modify
3 *  it under the terms of the GNU General Public License version 2.
4 *
5 *  This program is distributed in the hope that it will be useful,
6 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
7 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8 *  GNU General Public License for more details.
9 *
10 * Test that the shm_unlink() function sets errno = ENOENT  if the named shared
11 * memory object does not exist.
12 */
13
14
15#include <stdio.h>
16#include <sys/mman.h>
17#include <errno.h>
18#include "posixtest.h"
19
20#define SHM_NAME "posixtest_11-1"
21
22int main() {
23	int result;
24
25	/* Ensure that the name SHM_NAME is removed */
26	shm_unlink(SHM_NAME);
27
28	result = shm_unlink(SHM_NAME);
29
30	if(result == -1 && errno == ENOENT) {
31		printf("Test PASSED\n");
32		return PTS_PASS;
33	} else if (result == -1) {
34		perror("Unexpected error");
35		return PTS_UNRESOLVED;
36	}
37
38	printf("shm_unlink() success.");
39	return PTS_FAIL;
40
41}
42