tech-userlevel archive

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

Re: Why do sendmmsg and recvmmsg take unsigned int flags?



    Date:        Fri, 12 Jun 2026 01:12:37 +0300
    From:        Valery Ushakov <uwe%stderr.spb.ru@localhost>
    Message-ID:  <aisy1faw6x2MhDcZ%snips.stderr.spb.ru@localhost>

  | We also seem to have `unsigned int flags` since day one.  Note that
  | `flags` is the same as in send/recv &co, where it's `int flags`.
  |
  | Should we fix this?

No.   Any new interface that has "flags" should use unsigned, it is
a safer data type for the purpose.

Old interfaces tended to just use int as it was easier (less to enter)
and after all, "ints and unsigned ints work just the same unless the
sign bit is set" - from the days when everyone knew exactly what the
compiler would generate, and it was just the same.

One could argue that the mm functions shouldn't have a flags arg in
their func protoptyes at all, as they are dealing with a sequence of
messages, each of which has a flags field in its msghdr, which really
should be all that is needed.

kre



Home | Main Index | Thread Index | Old Index