Man:
To send or receive a message, the calling process allocates a 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 non-negative integer value.
А в учебнике приведён код типа
msgsnd(id, &msg, sizeof(msg), 0);
Т.е. в этом случае размер будет на sizeof(long) больше. Учебник ошибается?
Форум —
Development