msgsnd Invalid argument

1.3k views Asked by At

With the following code:

#define MSGLEN 128

typedef struct {
long id;
char message[MSGLEN];
} data;

data msg;

msgsnd(msg_id, &msg, MSGLEN, IPC_NOWAIT);

I get an Invalid argument error, but

msgsnd(msg_id, &msg.message, MSGLEN, IPC_NOWAIT);

is working. Of course I created the message que with msgget and kernel.msgmax = 65536

1

There are 1 answers

0
yakana On

OK... my fault. For everyone who encounters the same problem:

msg.id = 1;

The id must be greater than 0.