wait.h in linux 2.2 and 2.4

Dave Morrison dave at bnl.gov
Sat Sep 23 17:42:58 CEST 2000


Hi folks,

I've had trouble getting recent versions of arla to compile in the face of
recent changes in the 2.2.x linux kernels.  It seems there've been changes
in linux/wait.h that satisfy arla's check for HAVE_WAIT_QUEUE_HEAD_T, but
which still lack the `task_list' element found in the (almost) 2.4
kernels.  This causes the compilation of xfs/linux/xfs_dev.c to croak.  I
gamely whipped up a new autoconf macro to do the right kind of check and
tweaked the ifdef's in xfs_dev.c to use it.  Maybe it's not exactly the
right thing to do, but it seems to work for me in both the 2.2 and 2.4
worlds.  So, here's a patch against the CVS sources, followed by a new
autoconf macro:

Index: configure.in
===================================================================
RCS file: /stacken-cvs/arla/configure.in,v
retrieving revision 1.437
diff -u -r1.437 configure.in
--- configure.in	2000/09/14 07:19:30	1.437
+++ configure.in	2000/09/22 18:19:17
@@ -1492,6 +1492,7 @@
 smap)
 
 AC_LINUX_TYPE_WAIT_QUEUE_HEAD_T
+AC_LINUX_TYPE_WAIT_QUEUE_TASK_LIST
 AC_LINUX_FUNC_INIT_WAITQUEUE_HEAD
 AC_LINUX_FUNC_INIT_MUTEX
 AC_LINUX_FILLDIR_DT_TYPE
Index: cf/linux-func-init-wait-queue-head.m4
===================================================================
RCS file: /stacken-cvs/arla/cf/linux-func-init-wait-queue-head.m4,v
retrieving revision 1.1
diff -u -r1.1 linux-func-init-wait-queue-head.m4
--- cf/linux-func-init-wait-queue-head.m4	1999/05/16 23:21:54	1.1
+++ cf/linux-func-init-wait-queue-head.m4	2000/09/22 18:19:18
@@ -5,7 +5,8 @@
 AC_DEFUN(AC_LINUX_FUNC_INIT_WAITQUEUE_HEAD, [
 AC_CACHE_CHECK([for init_waitqueue_head],
 ac_cv_func_init_waitqueue_head,[
-AC_TRY_COMPILE_KERNEL([#include <linux/wait.h>],
+AC_TRY_COMPILE_KERNEL([#include <linux/stddef.h>
+#include <linux/wait.h>],
 [wait_queue_head_t foo;
 init_waitqueue_head(&foo)],
 ac_cv_func_init_waitqueue_head=yes,
Index: xfs/linux/xfs_dev.c
===================================================================
RCS file: /stacken-cvs/arla/xfs/linux/xfs_dev.c,v
retrieving revision 1.69
diff -u -r1.69 xfs_dev.c
--- xfs/linux/xfs_dev.c	2000/09/13 04:31:06	1.69
+++ xfs/linux/xfs_dev.c	2000/09/22 18:19:24
@@ -817,7 +817,7 @@
 	for (; t != sleepq; t = t->next) {
 	    printk(" %d", t->message->sequence_num);
 
-#ifdef HAVE_WAIT_QUEUE_HEAD_T
+#ifdef HAVE_WAIT_QUEUE_TASK_LIST
 	    if (!list_empty(&t->wait_queue.task_list)) {
 		const wait_queue_t *w = (const wait_queue_t *)
 		    list_entry(t->wait_queue.task_list.next,
@@ -828,7 +828,7 @@
 #else
 	    if (t->wait_queue && t->wait_queue->task)
 		printk(" (pid %d)", t->wait_queue->task->pid);
-#endif /* !HAVE_WAIT_QUEUE_HEAD_T */
+#endif /* !HAVE_WAIT_QUEUE_TASK_LIST */
 	}
     }
 }

The new autoconf macro:

diff -uN arla-0.34.3/cf/linux-type-wait-queue-task-list.m4
arla/cf/linux-type-wait-queue-task-list.m4
--- arla-0.34.3/cf/linux-type-wait-queue-task-list.m4	Wed Dec 31
19:00:00 1969
+++ arla/cf/linux-type-wait-queue-task-list.m4	Fri Sep 22 14:19:22 2000
@@ -0,0 +1,19 @@
+dnl
+dnl $Id$
+dnl
+
+AC_DEFUN(AC_LINUX_TYPE_WAIT_QUEUE_TASK_LIST, [
+AC_CACHE_CHECK([for wait_queue_task_list],
+ac_cv_type_wait_queue_task_list,[
+AC_TRY_COMPILE_KERNEL([#include <linux/stddef.h>
+#include <linux/wait.h>],
+[wait_queue_head_t foo;
+void *p;
+p = &foo.task_list;],
+ac_cv_type_wait_queue_task_list=yes,
+ac_cv_type_wait_queue_task_list=no)])
+if test "$ac_cv_type_wait_queue_task_list" = "yes"; then
+  AC_DEFINE(HAVE_WAIT_QUEUE_TASK_LIST, 1,
+	[define if you have a wait_queue_task_list])
+fi
+])

Hope this is useful,
Dave

-- 
David Morrison  Brookhaven National Laboratory  phone: 631-344-5840
                Physics Department, Bldg 510 C    fax: 631-344-3253
		          Upton, NY 11973-5000  email: dave at bnl.gov






More information about the Arla-drinkers mailing list