RecvmsgがMSG_CTRUNCをフラグとして受け入れないのはなぜですか?

RecvmsgがMSG_CTRUNCをフラグとして受け入れないのはなぜですか?

できるだけman 2 recv recvmsg返すMSG_TRUNC

   MSG_TRUNC
          indicates that the trailing portion of a datagram was dis‐
          carded because the datagram was larger than the buffer sup‐
          plied.

場合によっては、フィールドでパラメータMSG_TRUNCとして使用できる割り当てが必要なバッファのサイズを知りたいからです。flags

   MSG_TRUNC (since Linux 2.2)
          For raw (AF_PACKET), Internet datagram (since Linux
          2.4.27/2.6.8), netlink (since Linux 2.6.22), and UNIX datagram
          (since Linux 3.4) sockets: return the real length of the
          packet or datagram, even when it was longer than the passed
          buffer.

文書にもrecvmsg返される可能性があると述べられています。MSG_CTRUNC

   MSG_CTRUNC
          indicates that some control data were discarded due to lack of
          space in the buffer for ancillary data.

ただし、補助データの実際の長さを取得する方法はありません。 RecvmsgがMSG_CTRUNCそれを受け入れると、補助データの実際のサイズを取得できませんか?

ベストアンサー1

おすすめ記事