#include <sys/mman.h>
#include <sys/ipc.h>
#include <sys/shm.h>
+#include <fcntl.h>
//#include "list.h"
#include "relay.h"
#include "channels.h"
*size = PAGE_ALIGN(*size);
result = buf->shmid = shmget(getpid(), *size, IPC_CREAT | IPC_EXCL | 0700);
- if(buf->shmid == -1) {
+ if(result == -1 && errno == EINVAL) {
+ ERR("shmget() returned EINVAL; maybe /proc/sys/kernel/shmmax should be increased.");
+ return -1;
+ }
+ else if(result == -1) {
PERROR("shmget");
return -1;
}
ltt_buf->data_ready_fd_read = fds[0];
ltt_buf->data_ready_fd_write = fds[1];
+ /* FIXME: do we actually need this? */
+ result = fcntl(fds[0], F_SETFL, O_NONBLOCK);
+ if(result == -1) {
+ PERROR("fcntl");
+ }
+
//ust// ltt_buf->commit_seq = malloc(sizeof(ltt_buf->commit_seq) * n_subbufs);
//ust// if(!ltt_buf->commit_seq) {
//ust// return -1;