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 ?


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.

Looks like Linux's version is seriously outdated. CIRCLEQ is (rather strongly) deprecated in BSDs since 2001, and it even got removed from the documentation, even if the implementation is still in queue.h. We are supposed to use TAILQ, which offers the same functionality with better performance/less problems/saner implementation.

Meanwhile, in Linux it's still even documented, but you can find changes in kconfig migrating from CIRCLEQ to TAILQ citing the BSD deprecation.

The concrete problem in CIRCLEQ seems to be that it uses a specific head, different to a list node, but which is anyway linked as a node; so the head pointer has to be kept around and checked at every node access to see if the node turns out to be the head. So there are 2 problems: the checks at every access, and the need to keep the head pointer at hand, taking registers or cache.

Need Your Help

How to download software dependencies in Maven 2?

java maven maven-2 jira jira-plugin

I am very new in using Maven. Appreciate if anyone can give me some helps.

Call fnRowCallback on table redraw in datatable

javascript jquery datatables jquery-datatables

I am doing some post processing in datatable in fnRowCallback. But they are not being called when the table is redrawn. (i.e, when some event like changing the number of displayed rows are called f...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.