Sponsored Content
Top Forums Programming POSIX Message Queue Memory Allocation Post 302597322 by sumtata on Friday 10th of February 2012 02:21:45 AM
Old 02-10-2012
POSIX Message Queue Memory Allocation

Hi,

I wanted to know whether the POSIX message queues are statically allocated memory by the kernel based on the parameters specified in the open or as and when we send messages, memory are allocated?

Does the kernel reserve the specified memory for the message queue irrespective of whether the queue is empty or full?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

memory allocation

I would like to know how I could allocate some more memory to a process. Please note that I am not the root user. (1 Reply)
Discussion started by: sagar
1 Replies

2. Programming

POSIX Message Queue - Settings

How can I increase the POSIX Msg Q parameter SC_MQ_PRIO_MAX? The maximum is defined as 32. Can I increase the number? If so, how? Deepa (0 Replies)
Discussion started by: Deepa
0 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. Linux

POSIX message queue size

Hi all, Please tell me how to change POSIX message queue maximum size? "ulimit" is not a solution because it controls shell resources. But i need to control queue size before login in and starting the shell. It is needed to limit queue size for applications started before login in. Sorry for my... (7 Replies)
Discussion started by: Vourhey
7 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

Is there a problem with the memory allocation???

I have a scenario like the client has to search for the active server.There will be many servers.But not all server are active.And at a time not more than one server will be active. The client will be in active state always i.e, it should always search for an active server until it gets one.I... (1 Reply)
Discussion started by: vigneshinbox
1 Replies

7. Programming

Memory allocation in C

Hi Experts I need some help in static memory allocation in C. I have a program in which I declared 2 variables, one char array and one integer. I was little surprised to see the addresses of the variables. First: int x; char a; printf("%u %u\n', &x, a); I got the addresses displayed... (2 Replies)
Discussion started by: unx_freak
2 Replies

8. Programming

Please help:program hang stuck there signal handling on POSIX Message Queue UNIX C programming

in a single main() function,so need signal handling. Use Posix Message Queue IPC mechanism , can ignore the priority and other linked list message,to implement the scenario: client:Knock Knock server:who's there client: Eric Server:Eric,Welcome. client:exit all process terminated ... (1 Reply)
Discussion started by: ouou
1 Replies

9. Programming

POSIX message queue mq_open directory

hello, I try to test the POSIX mq_open function on book unp like below: #include "unpipc.h" # include <mqueue.h> int main(int argc, char **argv) { int c, flags; mqd_t mqd; flags = O_RDWR | O_CREAT; while ((c = getopt(argc, argv, "e")) != -1) { ... (3 Replies)
Discussion started by: anpufeng
3 Replies

10. UNIX for Dummies Questions & Answers

Memory allocation problem

I am using ubuntu. I have written a program to calculate prime factors. it works perfectly fine till entered number is less than 9989 (or so ) but when one enters a number higher than that, for example 15000, it does not work. Can anyone guide me whats the problem ? although new codes are welcome,... (2 Replies)
Discussion started by: Abhishek_kumar
2 Replies
mq_send(3)						     Library Functions Manual							mq_send(3)

NAME
mq_send - Places a message in the message queue (P1003.1b) LIBRARY
Realtime Library (librt.so, librt.a) SYNOPSIS
#include <mqueue.h> int mq_send ( mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio); PARAMETERS
mqdes Specifies a message queue descriptor. *msg_ptr Specifies a pointer to a buffer containing the message to be sent. msg_len Indicates the number of bytes of the message to be sent. msg_prio Indicates the priority of the message being sent. DESCRIPTION
The mq_send function places a message in the message queue. This function inserts the message in the queue at the position indicated by the msg_prio argument. A message with a relatively large numeric value for the msg_prio argument has a high priority, and it is therefore inserted before messages with lower values for the msg_prio argument. This function inserts messages with equal priority into the queue in first-in/first-out order. Thus the function inserts a message with a given priority after already-queued messages that have the same pri- ority. If the message queue is full, and the O_NONBLOCK flag associated with it is not set, the mq_send function blocks until sufficient space in the message queue becomes available or until a signal interrupts the mq_send function. If two or more processes are waiting to send messages when space becomes available in the queue, the highest-priority process that has been waiting the longest sends the message first. The mq_send function returns an error if the specified queue is full and the O_NONBLOCK flag is set for that queue. RETURN VALUES
On successful completion, the mq_send function returns a value of 0 (zero). Otherwise, no message is sent, -1 is returned, and errno is set to indicate the error. ERRORS
The mq_send function fails under the following conditions: [EAGAIN] The O_NONBLOCK flag is set in the message queue description associated with mqdes, and the specified message queue is full. [EBADF] The mqdes argument is not a valid message queue descriptor open for writing. [EFAULT] An internal virtual memory error occurred. [EINTR] A signal interrupted the call to mq_send. [EINVAL] The value of msg_prio is outside the valid range. [EMSGSIZE] The specified message length, msg_len, exceeds the message size attribute of the message queue. Note that a zero-length message is valid. RELATED INFORMATION
Functions: mq_receive(3), mq_setattr(3) Guide to Realtime Programming delim off mq_send(3)
All times are GMT -4. The time now is 08:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy