Thread overview
How to use Linux message queues?
Nov 14, 2014
Neven
Nov 14, 2014
Sean Kelly
Nov 14, 2014
Gary Willoughby
Nov 15, 2014
Neven
Nov 15, 2014
Gary Willoughby
Nov 15, 2014
Gary Willoughby
Nov 15, 2014
Neven
November 14, 2014
I've tried importing core.sys.posix.sys.msg however I get the error that is doesn't exist.

I sort of solved the problem with:

extern (C) int msgget ( key_t key, int msgflg );
extern (C) int msgsnd ( int msqid, msgbuf *msgp, int msgsz, int msgflg );

struct msgbuf {
    long mtype;         /* type of message */
    int a;
    int b;
};

though this is ugly and I don't have useful constants located in C headers. I'm wondering is there a better way to utilize Linux message queue IPC in D?
November 14, 2014
Sounds like a module that should be in core.sys.linux.  Care to submit a pull request?
November 14, 2014
On Friday, 14 November 2014 at 16:45:45 UTC, Sean Kelly wrote:
> Sounds like a module that should be in core.sys.linux.  Care to submit a pull request?

Yes, these are usually added when someone requires them.

Neven, if you're able, submitting a pull request to druntime of the complete module would be awesome. You can see how the others are structure here:

https://github.com/D-Programming-Language/druntime/tree/master/src/core/sys/posix/sys
November 15, 2014
On Friday, 14 November 2014 at 16:45:45 UTC, Sean Kelly wrote:
> Sounds like a module that should be in core.sys.linux.  Care to submit a pull request?

Ok, I've tried to make a module, though since I'm a D beginner (also a student who fiddles with D for Operating system classes) could you first feedback my code? I'm unsure in few parts which I commented on.

I spent some time reading manuals, reading through ipc.d for info how to do it, and reading msg.h in my distro (Linux Mint x86-64 17) includes.

http://pastebin.com/xxJe2FYa

November 15, 2014
On Saturday, 15 November 2014 at 00:33:02 UTC, Neven wrote:
> On Friday, 14 November 2014 at 16:45:45 UTC, Sean Kelly wrote:
>> Sounds like a module that should be in core.sys.linux.  Care to submit a pull request?
>
> Ok, I've tried to make a module, though since I'm a D beginner (also a student who fiddles with D for Operating system classes) could you first feedback my code? I'm unsure in few parts which I commented on.
>
> I spent some time reading manuals, reading through ipc.d for info how to do it, and reading msg.h in my distro (Linux Mint x86-64 17) includes.
>
> http://pastebin.com/xxJe2FYa

Not a bad start. A little tip, use c_long and c_ulong from core.stdc.config instead of long/ulong when interfacing with C. This is because its size changes when compiled on different architectures.
November 15, 2014
On Saturday, 15 November 2014 at 00:33:02 UTC, Neven wrote:
> Ok, I've tried to make a module, though since I'm a D beginner (also a student who fiddles with D for Operating system classes)

Incidentally, where are you studying? It would be nice to know where D is being taught.
November 15, 2014
On Saturday, 15 November 2014 at 12:04:45 UTC, Gary Willoughby wrote:
> On Saturday, 15 November 2014 at 00:33:02 UTC, Neven wrote:
>> Ok, I've tried to make a module, though since I'm a D beginner (also a student who fiddles with D for Operating system classes)
>
> Incidentally, where are you studying? It would be nice to know where D is being taught.

I submitted a pull request.

D isn't officially taught and as far as I know only I use it on faculty. We were instructed we could use whatever language we like to code our exercises and later demonstrate its correctness.

My faculty is FER - http://www.fer.unizg.hr/en
Link is English version of faculty web page.