The following code
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <string.h>
#include <errno.h>
int
main(int argc, char **argv)
{
char *p;
int shm_fd;
int error;
size_t len;
if ((shm_fd = shm_open("/somename", O_CREAT | O_RDWR, 0666)) < 0) {
perror("shm_open");
exit(1);
}
error = close(shm_fd);
if (error < 0) {
perror("close");
}
return 0;
}
Works fine on fedora22 x86_64, freebsd 10.2 x86_64. But it fails on OSX 10.10 with
close: Invalid argument
What is wrong with the call on OSX?