Search code examples
linuxqueuediffbsd

where to find Linux version sys/queue.h header file?


sys/queue.h first appeared in 4.4BSD. Linux has included it in its distribution, but the version seems not up-to-date.

FreeBSD version implements singly-linked lists, singly-linked tail queues, lists and tail queues. Linux version implements lists, tail queues, and circular queues.

I installed libbsd-dev package in my Ubuntu PC and then found BSD version's sys/queue.h in /usr/include/bsd/sys/queue.h.

My questions:

  • Where can I find the Linux version of this header file?

  • What's the main difference between these two implementations? Is Linux version just a out-dated version of BSD's ?


Solution

  • They share the same ancestry, but it looks like any development that have been done in them diverged a long time ago.

    If you want to use it in your project your best bet is to just copy the one you like the most into your project and use that. Don't depend on the system providing it for you. It's just a header file with a bunch of macros and doesn't need a library or any dependencies to work and as such isn't operating system specific at all. I usually take the one from OpenBSD for my projects.