Sponsored Content
Top Forums UNIX for Dummies Questions & Answers IPC Message Queue. msgrcv doesnt work.. Post 302385851 by pludi on Sunday 10th of January 2010 10:06:59 AM
Old 01-10-2010
Please no not post homework in the main Forums. Thread closed.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cd.. doesnt work

hi when i want to go to previous directory by typing cd.. i get the following message $ cd.. ksh: cd..: not found Please help rintingtong (2 Replies)
Discussion started by: rintingtong
2 Replies

2. HP-UX

ls command doesnt work

Good Day I mistakely renamed the dld.sl file in the /usr/lib directory. When i try to ls/ftp into the box i get this error :eek: crt0: ERROR couldn't open /usr/lib/dld.sl errno:000000002 I have tried to rename it back from the renamed file to the original file name, but it gives me the... (2 Replies)
Discussion started by: shawnbishop
2 Replies

3. HP-UX

posix ipc message queue

Hello, My question is related to "pipcs -qa" command under HP-UX 11i PA-RISC 64 bits. We have a little C program that creates posix ipc message queues using the mq_open() system function. The program fail with 'No space left on device' error when we create big queues. What is the system... (6 Replies)
Discussion started by: cadanir
6 Replies

4. UNIX for Dummies Questions & Answers

cp doesnt work - Help

When trying to copy a file in Solaris 8 it doesnt copy file or give a error. This worked 100% until the 29th. I've checked the rights and everything seems fine: drwxrwxrwx 2 bmuser bmgroup 11776 Jan 3 10:32 spool This is the file I want to copy: -rwxrwxrwx 1 bmuser bmgroup ... (26 Replies)
Discussion started by: rudi.okelly
26 Replies

5. Programming

How to limit max no of message in a posix message queue

Hii can anyone pls tell how to limit the max no of message in a posix message queue. I have made changes in proc/sys/fs/mqueue/msg_max But still whenever i try to read the value of max. message in the queue using attr.mq_curmsgs (where struct mq_attr attr) its giving the default value as 10.... (0 Replies)
Discussion started by: mohit3884
0 Replies

6. Programming

IPC - queue problems

Hi, I´m having a lot of problems when working with message queues, both on HP-UX Systems and Sun Solaris. When we fill a queue with a messages, the system hangs and locks everything that relies on the use of IPC resources. Anyone knows how to eliminate this problem? Thanks, Haroldo Teixeira (2 Replies)
Discussion started by: haroldo
2 Replies

7. Shell Programming and Scripting

Email alert doesnt contain any message

I have created a script which will monitor disk space in unix, it will send an email alert that will notify the specified receipients. I used echo in the mailx command but the email doesnt contain any message. I have used printf to store the message ($message2) and when tried to display on the... (2 Replies)
Discussion started by: lscanaleta
2 Replies

8. Shell Programming and Scripting

loop doesnt work

It just does the break...even though the files are not the same... # Compare extracts #========================================== count=0 while (( count < 5 )) do (( count+=1 )) echo "Try $count" file1=$(ls -l /tmp/psjava.xml|... (5 Replies)
Discussion started by: sigh2010
5 Replies

9. AIX

Vi doesnt work

Hi Guys, I have a strange problem.( AIX 6.1) "vi" is not working at all..Whenever i #vi <anythin> ,, it returns the prompt back. Any clues folks?? (14 Replies)
Discussion started by: muzahed
14 Replies

10. UNIX for Dummies Questions & Answers

why doesnt it work?

I am trying to print out two fields in a file using awk. So, I have got awk -F '\t' 'NF = 2 {print $1 $2 "]"}' two.txt in a script called what.awk When i run this version like this - ./what.awk then it runs however I want to run the program like this awk -f what.awk two.txt. When I... (8 Replies)
Discussion started by: The undertaker
8 Replies
MSGRCV(3P)						     POSIX Programmer's Manual							MSGRCV(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
msgrcv - XSI message receive operation SYNOPSIS
#include <sys/msg.h> ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); DESCRIPTION
The msgrcv() function operates on XSI message queues (see the Base Definitions volume of IEEE Std 1003.1-2001, Section 3.224, Message Queue). It is unspecified whether this function interoperates with the realtime interprocess communication facilities defined in Realtime . The msgrcv() function shall read a message from the queue associated with the message queue identifier specified by msqid and place it in the user-defined buffer pointed to by msgp. The application shall ensure that the argument msgp points to a user-defined buffer that contains first a field of type long specifying the type of the message, and then a data portion that holds the data bytes of the message. The structure below is an example of what this user- defined buffer might look like: struct mymsg { long mtype; /* Message type. */ char mtext[1]; /* Message text. */ } The structure member mtype is the received message's type as specified by the sending process. The structure member mtext is the text of the message. The argument msgsz specifies the size in bytes of mtext. The received message shall be truncated to msgsz bytes if it is larger than msgsz and (msgflg & MSG_NOERROR) is non-zero. The truncated part of the message shall be lost and no indication of the truncation shall be given to the calling process. If the value of msgsz is greater than {SSIZE_MAX}, the result is implementation-defined. The argument msgtyp specifies the type of message requested as follows: * If msgtyp is 0, the first message on the queue shall be received. * If msgtyp is greater than 0, the first message of type msgtyp shall be received. * If msgtyp is less than 0, the first message of the lowest type that is less than or equal to the absolute value of msgtyp shall be received. The argument msgflg specifies the action to be taken if a message of the desired type is not on the queue. These are as follows: * If (msgflg & IPC_NOWAIT) is non-zero, the calling thread shall return immediately with a return value of -1 and errno set to [ENOMSG]. * If (msgflg & IPC_NOWAIT) is 0, the calling thread shall 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 shall be set equal to [EIDRM] and -1 shall be 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 exe- cution 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 shall be decremented by 1. * msg_lrpid shall be set equal to the process ID of the calling process. * msg_rtime shall be set equal to the current time. RETURN VALUE
Upon successful completion, msgrcv() shall return a value equal to the number of bytes actually placed into the buffer mtext. Otherwise, no message shall be received, msgrcv() shall return (ssize_t)-1, and errno shall be set to indicate the error. ERRORS
The msgrcv() function shall fail if: E2BIG The value of mtext is greater than msgsz and (msgflg & MSG_NOERROR) is 0. EACCES Operation permission is denied to the calling process; see XSI Interprocess Communication . 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. The following sections are informative. EXAMPLES
Receiving a Message The following example receives the first message on the queue (based on the value of the msgtyp argument, 0). The queue is identified by the msqid argument (assuming that the value has previously been set). This call specifies that an error should be reported if no message is available, but not if the message is too large. The message size is calculated directly using the sizeof operator. #include <sys/msg.h> ... int result; int msqid; struct message { long type; char text[20]; } msg; long msgtyp = 0; ... result = msgrcv(msqid, (void *) &msg, sizeof(msg.text), msgtyp, MSG_NOERROR | IPC_NOWAIT); APPLICATION USAGE
The POSIX Realtime Extension defines alternative interfaces for interprocess communication (IPC). Application developers who need to use IPC should design their applications so that modules using the IPC routines described in XSI Interprocess Communication can be easily modi- fied to use the alternative interfaces. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
XSI Interprocess Communication, Realtime, mq_close(), mq_getattr(), mq_notify(), mq_open(), mq_receive(), mq_send(), mq_setattr(), mq_unlink(), msgctl(), msgget(), msgsnd(), sigaction(), the Base Definitions volume of IEEE Std 1003.1-2001, <sys/msg.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 MSGRCV(3P)
All times are GMT -4. The time now is 09:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy