Why it does not make sense if msginfo.msgssz is greater than 256?

Xin LI delphij at delphij.net
Sun Jan 6 21:13:39 PST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

While pursuing sys/kern/sysv_msg.c, we found the following comment:

 * Each message is broken up and stored in segments that are msgssz bytes
 * long.  For efficiency reasons, this should be a power of two.  Also,
 * it doesn't make sense if it is less than 8 or greater than about 256.
 * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of
 * two between 8 and 1024 inclusive (and panic's if it isn't).

And it seems to be come from the following comment:

        /*
         * msginfo.msgssz should be a power of two for efficiency reasons.
         * It is also pretty silly if msginfo.msgssz is less than 8
         * or greater than about 256 so ...
         */

Why is there the limitation (recommendation)?

Thanks in advance!

Cheers,
- --
Xin LI <delphij at delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFHgbTyi+vbBBjt66ARAuJmAKCAw8qZuYtVMIxjY1BXkNad57BVTACgt6zF
3l5/4Bd55EoNy8aFhm+RXyc=
=qWJk
-----END PGP SIGNATURE-----


More information about the freebsd-arch mailing list