Re: return type of mqueue functions are wrong

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello  Lénaïc

On Sun, Jul 25, 2010 at 11:59 AM, Lénaïc Huard <lenaic.huard@xxxxxxxxxxx> wrote:
> Hello,
>
> I think I've found a little error in the manpages of the mqueue functions
> (mq_close, mq_getattr, mq_setattr, mq_unlink, mq_notify, mq_send and
> mq_timedsend). In the linux manpages, all these functions are documented as
> returning an mqd_t whereas in the mqueue.h shipped with the glibc, these
> functions are returning an int.
>
> This is not a big matter in Linux where mqd_t is a typedef for int, but the
> problem is that a programmer worried about the portability of his code might
> be tempted to write things like
>
>  if( mq_getattr( _mqdes, &aMqAttr ) == (mqd_t)-1 )
>    ...
>
> And this is not portable. (For example, it won't compile on Solaris where
> mqd_t is a typedef for void * but where mq_getattr returns an int like on
> Linux.)
>
> If the functions were documented as returning an int, one won't put the cast,
> and the code would be portable.

(Thanks for the careful explanation!) Of course, you are correct. I've
fixed all of these pages for release 3.26.

thanks,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface" http://blog.man7.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux