#include <sys/stream.h>
Architecture independent level 1 (DDI/DKI).
qsize() evaluates the queue q and returns the number of messages it contains.
If there are no message on the queue, qsize() returns 0. Otherwise, it returns the integer representing the number of messages on the queue.
qsize() can be called from user or interrupt context.
Writing Device Drivers
STREAMS Programming Guide