lkml.org 
[lkml]   [2003]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectLinux Kernel Message Queue Implementation
Date
[1] msgsnd (int, struct msgbuf *, int, int) INTERFACE ERROR !!

[2] msgsnd() has "struct msgbuf*" as its 2nd parameter. When I tried to write an application which uses message queues for IPC i declared my message queue buffer as -

struct my_msgq_buf
{
long mtype;
char *name;
double amount;
};

I allocated the memory of name dynamically using "malloc" and wrote into the message Queue using msgsnd. And the msgsnd returns successfully. When I do an msgrcv with the above structure type, I always recieve NULL values in my structure buffer !!

But, When I use the structure as declared below -

struct my_msgq_buf
{
long mtype;
char name[30];
double amount;
};

Every thing interstingly seems to be working fine.! The interface for msgsnd and msgrcv should have "void *" pointers rather than having a "struct msgbuf *" as parameters.

[3] Kernel
[4] 2.4.7-10
[5]
[6]
[7] i586. Intel Pentium 166 MHz MMX.
[8]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.039 / U:1.956 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site