Estratto del documento

Msgsnd - message send operation

Source: The Single UNIX® Specification, Version 2

Copyright: © 1997 The Open Group

Synopsis

#include <sys/msg.h>
int msgsnd(int const void *msgp, size_t intmsqid, msgsz, msgflg);

Description

The msgsnd() function is used to send a message to the queue associated with the message queue identifier specified by msqid.

The argument msgp points to a user-defined buffer that must contain first a field of type long that will specify the type of the message, and then a data portion that will hold the data bytes of the message. The structure below is an example of what this user-defined buffer might look like:

struct mymsg {
    long int mtype;   /* message type */
    char mtext[1];    /* message text */
}

The structure member is a non-zero positive type that can be used by the mtype long int receiving process for message selection.

The structure member is any text of length msgsz bytes. The argument msgsz can range from 0 to a system-imposed maximum.

The argument msgflg specifies the action to be taken if one or more of the following are true:

  • The number of bytes already on the queue is equal to see <sys/msg.h>.msg_qbytes,
  • The total number of messages on all queues system-wide is equal to the system-imposed limit.

These actions are as follows:

  • If (msgflg & IPC_NOWAIT) is non-zero, the message will not be sent and the calling thread will return immediately.
  • If (msgflg & IPC_NOWAIT) is 0, the calling thread will suspend execution until one of the following occurs:
    • The condition responsible for the suspension no longer exists, in which case the message is sent.
    • The message queue identifier msqid is removed from the system.
Anteprima
Vedrai una selezione di 1 pagina su 3
Sistemi operativi - Syscall msgsnd Pag. 1
1 su 3
D/illustrazione/soddisfatti o rimborsati
Acquista con carta o PayPal
Scarica i documenti tutte le volte che vuoi
Dettagli
SSD
Scienze matematiche e informatiche INF/01 Informatica

I contenuti di questa pagina costituiscono rielaborazioni personali del Publisher N. A. di informazioni apprese con la frequenza delle lezioni di Sistemi operativi e studio autonomo di eventuali libri di riferimento in preparazione dell'esame finale o della tesi. Non devono intendersi come materiale ufficiale dell'università Università degli studi di Napoli Federico II o del prof Cotroneo Domenico.
Appunti correlati Invia appunti e guadagna

Domande e risposte

Hai bisogno di aiuto?
Chiedi alla community