Nocna_smjena (forumula za izracunavanje velicine: sizeof(buf) - sizeof(buf.mtype) + 1)
Zašto +1?
Iz manpagea:
The msgp argument is a pointer to a caller-defined structure of the following general form:
struct msgbuf {
long mtype; /* message type, must be > 0 */
char mtext[1]; /* message data */
};
The mtext field is an array (or other structure) whose size is specified by msgsz, a nonnegative integer
value. Messages of zero length (i.e., no mtext field) are permitted.
msgsz
je točno veličina polja mtext
, što je točno sizeof(buf) - sizeof(buf.mtype)