Re: sendmsg() arguments

Alex Belits (abelits@phobos.illtel.denver.co.us)
Mon, 17 May 1999 14:25:53 -0700 (PDT)


On Mon, 17 May 1999 kuznet@ms2.inr.ac.ru wrote:

> > The only problem I have with that, is that msg_name=NULL was used in
> > some my program to indicate that there is no name,
>
> Let's continue the analogy. Do you find useful to supply
> NULL buffer to write() and some not-zero length?

write() deals with data without assigning any meaning to its type and
structure -- the argument is void, and size does not specify anything but
the amount of data involved (and 0 is the special case). In the case of
message the pointer has specific meaning of address, and size is
secondary, derived from its type. If I know that the address is of
specific type, and it is NULL, it probably will make sense to put sizeof
if that type as the size.

> I do not. And I see no differences between data buffer,
> address buffer and ancillary data buffer

Address may have size even if it's NULL.

> and no reasons
> to introduce code lines considering unnatural special cases.
>
> > > BTW some time ago recvfrom() behaved in the same manner,
> > > but broken way appeared to be described as valid in UNIX98,
> > > so that it was changed.
> >
> > Maybe for consistency sake, sendmsg() can be made to match this?
>
> Maybe, yes. Though, to be honest, it is rather recvfrom()/sendto()
> should be fixed to be self-consistent 8)
>
> BTW for beginning fix your program. 8)

It's already fixed, I just don't think that there are no others that
behave the same way.

-- 
Alex

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