Can't find MQ_PRIO_MAX in include

2013-05-31 Thread Fabrice Boissier
Hello,

I'm trying to use some POSIX MQ on Debian.
I tried my code on Debian, FreeBSD and Cygwin, and it went well.
I encountered a problem on FreeBSD about the maximum priority, then I
searched about a fixed maximum, and I found MQ_PRIO_MAX.
On FreeBSD and Cygwin it works properly, but on Debian, I can't find the
macro MQ_PRIO_MAX.

Precisely :
I included mqueue.h for the mq_attr definition, mq_open function, ...
And MQ_PRIO_MAX seems to be defined in limits.h in POSIX explanations.
So, I included limits.h, and Debian still can't find MQ_PRIO_MAX.
I googled a little, and found it in linux/mqueue.h !
But if I put only linux/mqueue.h, mq_open, mq_close... are undefined.
If I put linux/mqueue.h and mqueue.h, mq_attr is redefined.
If I put only mqueue.h, MQ_PRIO_MAX is undefined.

How should I found MQ_PRIO_MAX correctly on Debian ?
My CFLAGS are : -W -Wall -Werror -ansi -pedantic
My LDFLAGS are : -lrt
I'm working on a Debian Squeeze (2.6.32-042stab076.8 #1 SMP Tue May 14
20:38:14 MSK 2013 x86_64), with ldd (Debian EGLIBC 2.11.3-4) 2.11.3.

Shouldn't MQ_PRIO_MAX be define in limits.h in the next releases ?

Thank you in advance !

-- 
Fabrice BOISSIER // Metalman


Re: Can't find MQ_PRIO_MAX in include

2013-05-31 Thread Neil Williams
On Fri, 31 May 2013 11:21:15 +0200
Fabrice Boissier fabrice.boiss...@gmail.com wrote:

 macro MQ_PRIO_MAX.
 How should I found MQ_PRIO_MAX correctly on Debian ?

 Debian Squeeze (2.6.32-042stab076.8 #1 SMP Tue May 14
 20:38:14 MSK 2013 x86_64), 

So a linux kernel, the match is:

/usr/include/linux/mqueue.h:#define MQ_PRIO_MAX 32768

$ dpkg -S /usr/include/linux/mqueue.h
linux-libc-dev:amd64: /usr/include/linux/mqueue.h

Ensure linux-libc-dev is installed and look for the .h in the linux/
directory.

http://packages.debian.org/search?searchon=contentskeywords=mqueue.hmode=pathsuite=stablearch=any

-- 


Neil Williams
=
http://www.linux.codehelp.co.uk/



pgpDkV76JaQ75.pgp
Description: PGP signature


Re: Can't find MQ_PRIO_MAX in include

2013-05-31 Thread Fabrice Boissier
linux-libc-dev and libc6-dev already installed, and the file
/usr/include/linux/mqueue.h contains MQ_PRIO_MAX and the struct mq_attr.

But the structure mq_attr in /usr/include/linux/mqueue.h is in conflict
with the one declared in the /usr/include/mqueue.h (precisely in
/usr/include/bits/mqueue.h that is included by /usr/include/mqueue.h)

Either MQ_PRIO_MAX and some other constants should be defined in limits.h,
or struct mq_attr shouldn't be defined twice.


2013/5/31 Neil Williams codeh...@debian.org

 On Fri, 31 May 2013 11:21:15 +0200
 Fabrice Boissier fabrice.boiss...@gmail.com wrote:

  macro MQ_PRIO_MAX.
  How should I found MQ_PRIO_MAX correctly on Debian ?

  Debian Squeeze (2.6.32-042stab076.8 #1 SMP Tue May 14
  20:38:14 MSK 2013 x86_64),

 So a linux kernel, the match is:

 /usr/include/linux/mqueue.h:#define MQ_PRIO_MAX 32768

 $ dpkg -S /usr/include/linux/mqueue.h
 linux-libc-dev:amd64: /usr/include/linux/mqueue.h

 Ensure linux-libc-dev is installed and look for the .h in the linux/
 directory.


 http://packages.debian.org/search?searchon=contentskeywords=mqueue.hmode=pathsuite=stablearch=any

 --


 Neil Williams
 =
 http://www.linux.codehelp.co.uk/




-- 
Fabrice BOISSIER // Metalman
Epita2012 - SRS
root SRS (Fév 2011 - Fév 2012)


Re: Can't find MQ_PRIO_MAX in include

2013-05-31 Thread Ben Hutchings
On Fri, 2013-05-31 at 11:21 +0200, Fabrice Boissier wrote:
 Hello,
 
 
 I'm trying to use some POSIX MQ on Debian.
 
 I tried my code on Debian, FreeBSD and Cygwin, and it went well.
 
 I encountered a problem on FreeBSD about the maximum priority, then I
 searched about a fixed maximum, and I found MQ_PRIO_MAX.
 
 On FreeBSD and Cygwin it works properly, but on Debian, I can't find
 the macro MQ_PRIO_MAX.
[...]

This is not a support forum for Linux development.  But as people have
already started giving you silly answers:

Per POSIX, you cannot assume this macro (or any such constant limit) is
defined, and must use sysconf(_SC_MQ_PRIO_MAX) at run-time if it is not.

Ben.

-- 
Ben Hutchings
If at first you don't succeed, you're doing about average.


signature.asc
Description: This is a digitally signed message part


Re: Can't find MQ_PRIO_MAX in include

2013-05-31 Thread Fabrice Boissier
2013/5/31 Ben Hutchings b...@decadent.org.uk

 On Fri, 2013-05-31 at 11:21 +0200, Fabrice Boissier wrote:
  Hello,

[...]

 This is not a support forum for Linux development.  But as people have
 already started giving you silly answers:


I previously searched... and nearly nobody uses POSIX MQ (except QNX ?!).
I previously asked on a Debian forum, and nobody could answer...

Per POSIX, you cannot assume this macro (or any such constant limit) is
 defined, and must use sysconf(_SC_MQ_PRIO_MAX) at run-time if it is not.


Personally, a twice declaration of a structure is probably not very very
good... ok, that's none of my business, I don't criticize this point.
But, the macro I was searching for is defined in a file, and as a third
developper I can't directly access it during precompilation... why ?
It seems nobody care about POSIX MQ, and it's a little puzzling that Debian
doesn't show the macro in limits.h or mqueue.h, even if it's declared in
some headers.
My point was only to be sure if that was expectable or not.


-- 
Fabrice BOISSIER // Metalman