Anteprima
Vedrai una selezione di 1 pagina su 3
Sistemi operativi - Syscall msgrcv Pag. 1
1 su 3
D/illustrazione/soddisfatti o rimborsati
Disdici quando
vuoi
Acquista con carta
o PayPal
Scarica i documenti
tutte le volte che vuoi
Estratto del documento

msgrcv

If (msgflg & IPC_NOWAIT) is non-zero, the calling thread will return immediately with a return value of -1 and errno set to [ENOMSG].

If (msgflg & IPC_NOWAIT) is 0, the calling thread will suspend execution until one of the following occurs:

  • A message of the desired type is placed on the queue.
  • The message queue identifier msqid is removed from the system; when this occurs, errno is set equal to [EIDRM] and -1 is returned.
  • The calling thread receives a signal that is to be caught; in this case a message is not received and the calling thread resumes execution in the manner prescribed in sigaction().

Upon successful completion, the following actions are taken with respect to the data structure associated with msqid:

  • msg_qnum is decremented by 1.
  • msg_lrpid is set equal to the process ID of the calling process.
  • msg_rtime is set equal to the current time.

RETURN VALUE

Upon successful completion, msgrcv() returns a value equal to

The number of bytes actually placed into the buffer mtext. Otherwise, no message will be received, msgrcv() will return(ssize_t)-1 and errno will be set to indicate the error.

ERRORS

  • [E2BIG] The value of is greater than msgsz and (msgflg & MSG_NOERROR) is 0.mtext
  • [EACCES] Operation permission is denied to the calling process. See IPC.
  • [EIDRM] The message queue identifier msqid is removed from the system.
  • [EINTR] The msgrcv() function was interrupted by a signal.
  • [EINVAL] msqid is not a valid message queue identifier.
  • [ENOMSG] The queue does not contain a message of the desired type and (msgflg &IPC_NOWAIT) is non-zero.

EXAMPLES

None.

APPLICATION USAGE

The POSIX Realtime Extension defines alternative interfaces for interprocess

Dettagli
Publisher
A.A. 2012-2013
3 pagine
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.