4389fd03dec7520bc8e3ff4ea8e4f1f335e71162
[openafs.git] / src / cf / linux-test4.m4
1 AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [
2   AC_CHECK_LINUX_BUILD([for exported tasklist_lock],
3                        [ac_cv_linux_exports_tasklist_lock],
4 [#include <linux/sched.h>],
5 [
6 extern rwlock_t tasklist_lock __attribute__((weak)); 
7 read_lock(&tasklist_lock);
8 ],
9                        [EXPORTED_TASKLIST_LOCK],
10                        [define if tasklist_lock exported])
11 ])
12
13 AC_DEFUN([LINUX_COMPLETION_H_EXISTS], [
14   AC_CHECK_LINUX_BUILD([for linux/completion.h],
15                        [ac_cv_linux_completion_h_exists],
16 [#include <linux/version.h>
17 #include <linux/completion.h>],
18 [struct completion _c;
19 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
20 lose
21 #endif],
22                        [HAVE_LINUX_COMPLETION_H]
23                        [Define if your kernel has a usable linux/completion.h])
24 ])
25
26 AC_DEFUN([LINUX_DEFINES_FOR_EACH_PROCESS], [
27   AC_MSG_CHECKING([for defined for_each_process])
28   AC_CACHE_VAL([ac_cv_linux_defines_for_each_process], [
29     AC_TRY_KBUILD(
30 [#include <linux/sched.h>],
31 [#ifndef for_each_process
32 #error for_each_process not defined
33 #endif],
34       ac_cv_linux_defines_for_each_process=yes,
35       ac_cv_linux_defines_for_each_process=no)])
36   AC_MSG_RESULT($ac_cv_linux_defines_for_each_process)])
37
38
39 AC_DEFUN([LINUX_DEFINES_PREV_TASK], [
40   AC_MSG_CHECKING([for defined prev_task])
41   AC_CACHE_VAL([ac_cv_linux_defines_prev_task], [
42     AC_TRY_KBUILD(
43 [#include <linux/sched.h>],
44 [#ifndef prev_task
45 #error prev_task not defined
46 #endif],
47       ac_cv_linux_defines_prev_task=yes,
48       ac_cv_linux_defines_prev_task=no)])
49   AC_MSG_RESULT($ac_cv_linux_defines_prev_task)])
50
51
52 AC_DEFUN([LINUX_EXPORTS_INIT_MM], [
53   AC_CHECK_LINUX_BUILD([for exported init_mm],
54                        [ac_cv_linux_exports_init_mm],
55                        [extern struct mm_struct init_mm;],
56                        [void *address = &init_mm; printk("%p\n", address);],
57                        [EXPORTED_INIT_MM],
58                        [define if your kernel exports init_mm])
59   ])
60
61
62 AC_DEFUN([LINUX_EXPORTS_KALLSYMS_ADDRESS], [
63   AC_CHECK_LINUX_BUILD([for exported kallsyms_address_to_symbol],
64                        [ac_cv_linux_exports_kallsyms_address],
65                        [#include <linux/modversions.h>],
66 [#ifndef __ver_kallsyms_address_to_symbol
67 #error kallsyms_address_to_symbol not exported
68 #endif],
69                        [EXPORTED_KALLSYMS_ADDRESS],
70                        [define if your linux kernel exports kallsyms address])
71 ])
72
73
74 AC_DEFUN([LINUX_EXPORTS_KALLSYMS_SYMBOL], [
75   AC_CHECK_LINUX_BUILD([for exported kallsyms_symbol_to_address],
76                        [ac_cv_linux_exports_kallsyms_symbol],
77                        [#include <linux/modversions.h>],
78 [#ifndef __ver_kallsyms_symbol_to_address
79 #error kallsyms_symbol_to_address not exported
80 #endif],
81                        [EXPORTED_KALLSYMS_SYMBOL],
82                        [define if your linux kernel exports kallsyms])
83 ])
84
85
86 AC_DEFUN([LINUX_EXPORTS_SYS_CALL_TABLE], [
87   AC_CHECK_LINUX_BUILD([for exported sys_call_table],
88                        [ac_cv_linux_exports_sys_call_table],
89                        [#include <linux/modversions.h>],
90 [#ifndef __ver_sys_call_table
91 #error sys_call_table not exported
92 #endif],
93                        [EXPORTED_SYS_CALL_TABLE],
94                        [define if your linux kernel exports sys_call_table])
95 ])
96
97
98 AC_DEFUN([LINUX_EXPORTS_IA32_SYS_CALL_TABLE], [
99   AC_CHECK_LINUX_BUILD([for exported ia32_sys_call_table],
100                        [ac_cv_linux_exports_ia32_sys_call_table],
101                        [#include <linux/modversions.h>],
102 [#ifndef __ver_ia32_sys_call_table
103 #error ia32_sys_call_table not exported
104 #endif],
105                        [EXPORTED_IA32_SYS_CALL_TABLE],
106                        [define if your linux kernel exports ia32_sys_call_table])
107 ])
108
109
110 AC_DEFUN([LINUX_EXPORTS_SYS_CHDIR], [
111   AC_CHECK_LINUX_BUILD([for exported sys_chdir],
112                        [ac_cv_linux_exports_sys_chdir],
113                        [extern asmlinkage long sys_chdir(void) __attribute__((weak));],
114                        [void *address = &sys_chdir; printk("%p\n", address);],
115                        [EXPORTED_SYS_CHDIR],
116                        [define if your linux kernel exports sys_chdir])
117 ])
118
119
120 AC_DEFUN([LINUX_EXPORTS_SYS_OPEN], [
121   AC_CHECK_LINUX_BUILD([for exported sys_open],
122                        [ac_cv_linux_exports_sys_open],
123                        [extern asmlinkage long sys_open(void) __attribute__((weak));],
124                        [void *address = &sys_open; printk("%p\n", address);],
125                        [EXPORTED_SYS_OPEN],
126                        [define if your linux kernel exports sys_open])
127 ])
128
129
130 AC_DEFUN([LINUX_RECALC_SIGPENDING_ARG_TYPE], [
131   AC_CHECK_LINUX_BUILD([for recalc_sigpending arg type],
132                        [ac_cv_linux_func_recalc_sigpending_takes_void],
133                        [#include <linux/sched.h>],
134                        [recalc_sigpending();],
135                        [RECALC_SIGPENDING_TAKES_VOID],
136                        [define if your recalc_sigpending takes void])
137 ])
138
139
140 AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [
141   AC_CHECK_LINUX_BUILD([for signal->rlim in struct task_struct],
142                        [ac_cv_linux_sched_struct_task_struct_has_signal_rlim],
143                        [#include <linux/sched.h>],
144                        [struct task_struct _tsk; printk("%d\n", _tsk.signal->rlim);],
145                        [STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM],
146                        [define if your struct task_struct has signal->rlim])
147 ])
148
149
150 AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [
151   AC_CHECK_LINUX_BUILD([for 3rd argument in posix_lock_file found in new kernels],
152                        [ac_cv_linux_kernel_posix_lock_file_wait_arg],
153                        [#include <linux/fs.h>],
154                        [posix_lock_file(0,0,0);],
155                        [POSIX_LOCK_FILE_WAIT_ARG],
156                        [define if your kernel uses 3 arguments for posix_lock_file])
157 ])
158
159 AC_DEFUN([LINUX_KERNEL_SOCK_CREATE], [
160   AC_CHECK_LINUX_BUILD([for 5th argument in sock_create found in some SELinux kernels],
161                        [ac_cv_linux_kernel_sock_create_v],
162                        [#include <linux/net.h>],
163                        [sock_create(0,0,0,0,0);],
164                        [LINUX_KERNEL_SOCK_CREATE_V],
165                        [define if your linux kernel uses 5 arguments for sock_create])
166 ])
167
168
169 AC_DEFUN([LINUX_INODE_SETATTR_RETURN_TYPE], [
170   AC_CHECK_LINUX_BUILD([for inode_setattr return type],
171                        [ac_cv_linux_func_inode_setattr_returns_int],
172                        [#include <linux/fs.h>],
173                        [struct inode _inode;
174                         struct iattr _iattr;
175                         int i;
176                         i = inode_setattr(&_inode, &_iattr);],
177                        [INODE_SETATTR_NOT_VOID],
178                        [define if your setattr return return non-void])
179 ])
180
181
182
183 AC_DEFUN([LINUX_AOP_WRITEBACK_CONTROL], [
184   AC_CHECK_LINUX_BUILD([whether aop.writepage takes a writeback_control],
185                        [ac_cv_linux_func_a_writepage_takes_writeback_control],
186 [#include <linux/fs.h>
187 #include <linux/mm.h>
188 #include <linux/writeback.h>],
189 [struct address_space_operations _aops;
190 struct page _page;
191 struct writeback_control _writeback_control;
192 (void)_aops.writepage(&_page, &_writeback_control);],
193                        [AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL],
194                        [define if aops.writepage takes a struct writeback_control])
195 ])
196
197
198 AC_DEFUN([LINUX_REFRIGERATOR], [
199   AC_CHECK_LINUX_BUILD([whether refrigerator takes PF_FREEZE],
200                        [ac_cv_linux_func_refrigerator_takes_pf_freeze],
201 [#include <linux/sched.h>
202 #ifdef HAVE_LINUX_FREEZER_H
203 #include <linux/freezer.h>
204 #endif],
205                        [refrigerator(PF_FREEZE);],
206                        [LINUX_REFRIGERATOR_TAKES_PF_FREEZE],
207                        [define if your refrigerator takes PF_FREEZE])
208 ])
209
210
211 AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_NAMEIDATA], [
212   AC_CHECK_LINUX_BUILD([whether inode_operations.create takes a nameidata],
213                        [ac_cv_linux_func_i_create_takes_nameidata],
214 [#include <linux/fs.h>
215 #include <linux/namei.h>],
216 [struct inode _inode;
217 struct dentry _dentry;
218 struct nameidata _nameidata;
219 (void)_inode.i_op->create(&_inode, &_dentry, 0, &_nameidata);],
220
221                        [IOP_CREATE_TAKES_NAMEIDATA],
222                        [define if your iops.create takes a nameidata argument])
223 ])
224
225
226 AC_DEFUN([LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA], [
227   AC_CHECK_LINUX_BUILD([whether inode_operations.lookup takes a nameidata],
228                        [ac_cv_linux_func_i_lookup_takes_nameidata],
229 [#include <linux/fs.h>
230 #include <linux/namei.h>],
231 [struct inode _inode;
232 struct dentry _dentry;
233 struct nameidata _nameidata;
234 (void)_inode.i_op->lookup(&_inode, &_dentry, &_nameidata);],
235                        [IOP_LOOKUP_TAKES_NAMEIDATA],
236                        [define if your iops.lookup takes a nameidata argument])
237 ])
238
239
240 AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [
241   AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes a nameidata],
242                        [ac_cv_linux_func_i_permission_takes_nameidata],
243 [#include <linux/fs.h>
244 #include <linux/namei.h>],
245 [struct inode _inode;
246 struct dentry _dentry;
247 struct nameidata _nameidata;
248 (void)_inode.i_op->permission(&_inode, 0, &_nameidata);],
249                        [IOP_PERMISSION_TAKES_NAMEIDATA],
250                        [define if your iops.permission takes a nameidata argument])
251 ])
252
253
254 AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [
255   AC_CHECK_LINUX_BUILD([whether inode_operations.put_link takes an opaque cookie],
256                        [ac_cv_linux_func_i_put_link_takes_cookie],
257 [#include <linux/fs.h>
258 #include <linux/namei.h>],
259 [struct inode _inode;
260 struct dentry _dentry;
261 struct nameidata _nameidata;
262 void *cookie;
263 (void)_inode.i_op->put_link(&_dentry, &_nameidata, cookie);],
264                        [IOP_PUT_LINK_TAKES_COOKIE],
265                        [define if your iops.put_link takes a cookie])
266 ])
267
268
269 AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA], [
270   AC_CHECK_LINUX_BUILD([whether dentry_operations.d_revalidate takes a nameidata],
271                        [ac_cv_linux_func_d_revalidate_takes_nameidata],
272 [#include <linux/fs.h>
273 #include <linux/namei.h>],
274 [struct dentry _dentry;
275 struct nameidata _nameidata;
276 (void)_dentry.d_op->d_revalidate(&_dentry, &_nameidata);],
277                        [DOP_REVALIDATE_TAKES_NAMEIDATA],
278                        [define if your dops.d_revalidate takes a nameidata argument])
279 ])
280
281
282 AC_DEFUN([LINUX_GET_SB_HAS_STRUCT_VFSMOUNT], [
283   AC_CHECK_LINUX_BUILD([for struct vfsmount * in get_sb_nodev()],
284                        [ac_cv_linux_get_sb_has_struct_vfsmount],
285                        [#include <linux/fs.h>],
286                        [get_sb_nodev(0,0,0,0,0);],
287                        [GET_SB_HAS_STRUCT_VFSMOUNT],
288                        [define if your get_sb_nodev needs a struct vfsmount argument])
289 ])
290
291
292 AC_DEFUN([LINUX_STATFS_TAKES_DENTRY], [
293   AC_CHECK_LINUX_BUILD([for dentry in statfs],
294                        [ac_cv_linux_statfs_takes_dentry],
295 [#include <linux/fs.h>
296 #include <linux/statfs.h>],
297                        [extern int vfs_statfs(struct dentry *, struct kstatfs *);],
298                        [STATFS_TAKES_DENTRY],
299                        [define if your statfs takes a dentry argument])
300 ])
301
302
303 AC_DEFUN([LINUX_LINUX_KEYRING_SUPPORT], [
304   AC_CHECK_LINUX_BUILD([for linux kernel keyring support],
305                        [ac_cv_linux_keyring_support],
306 [#include <linux/rwsem.h>
307 #ifdef HAVE_LINUX_KEY_TYPE_H
308 #include <linux/key-type.h>
309 #endif
310 #include <linux/key.h>
311 #include <linux/keyctl.h>],
312 [#ifdef CONFIG_KEYS
313 request_key(NULL, NULL, NULL);
314 #if !defined(KEY_POS_VIEW) || !defined(KEY_POS_SEARCH) || !defined(KEY_POS_SETATTR) 
315 #error "Your linux/key.h does not contain KEY_POS_VIEW or KEY_POS_SEARCH or KEY_POS_SETATTR"
316 #endif
317 #else
318 #error rebuild your kernel with CONFIG_KEYS
319 #endif],
320                        [LINUX_KEYRING_SUPPORT],
321                        [define if your kernel has keyring support])
322 ])
323
324
325 AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
326   AC_CACHE_CHECK([if key_alloc() takes a struct task *],
327                  [ac_cv_key_alloc_needs_struct_task],
328 [
329     save_CPPFLAGS="$CPPFLAGS"
330     CPPFLAGS="$CPPFLAGS -Werror -Wno-pointer-arith"
331     AC_TRY_KBUILD(
332 [#include <linux/rwsem.h>
333 #include <linux/key.h>
334 ],
335 [struct task_struct *t=NULL;
336 (void) key_alloc(NULL, NULL, 0, 0, t, 0, 0);],
337       ac_cv_key_alloc_needs_struct_task=yes,
338       ac_cv_key_alloc_needs_struct_task=no)
339     CPPFLAGS="$save_CPPFLAGS"])
340   AS_IF([test "x$ac_cv_key_alloc_needs_struct_task" = "xyes"],
341         [AC_DEFINE([KEY_ALLOC_NEEDS_STRUCT_TASK], 1,
342                    [define if key_alloc takes a struct task *])])
343 ])
344
345
346 AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_CRED], [
347   AC_CACHE_CHECK([if key_alloc() takes credentials],
348                   [ac_cv_key_alloc_needs_cred],
349 [
350     save_CPPFLAGS="$CPPFLAGS"
351     CPPFLAGS="$CPPFLAGS -Werror -Wno-pointer-arith"
352     AC_TRY_KBUILD(
353 [#include <linux/rwsem.h>
354 #include <linux/key.h>],
355 [struct cred *c = NULL;
356 (void) key_alloc(NULL, NULL, 0, 0, c, 0, 0);],
357       ac_cv_key_alloc_needs_cred=yes,
358       ac_cv_key_alloc_needs_cred=no)
359     CPPFLAGS="$save_CPPFLAGS"])
360   AS_IF([test "x$ac_cv_key_alloc_needs_cred" = "xyes"],
361         [AC_DEFINE([KEY_ALLOC_NEEDS_CRED], 1,
362                    [define if key_alloc takes credentials])])
363 ])
364
365
366 AC_DEFUN([LINUX_INIT_WORK_HAS_DATA], [
367   AC_CHECK_LINUX_BUILD([whether INIT_WORK has a _data argument],
368                        [ac_cv_linux_init_work_has_data],
369 [#include <linux/kernel.h>
370 #include <linux/workqueue.h>],
371
372 void f(struct work_struct *w) {}
373 struct work_struct *w;
374 int *i;
375 INIT_WORK(w,f,i);],
376                        [INIT_WORK_HAS_DATA],
377                        [define if INIT_WORK takes a data (3rd) argument])
378 ])
379
380
381 AC_DEFUN([LINUX_REGISTER_SYSCTL_TABLE_NOFLAG], [
382   AC_CHECK_LINUX_BUILD([whether register_sysctl_table has an insert_at_head argument],
383                        [ac_cv_linux_register_sysctl_table_noflag],
384                        [#include <linux/sysctl.h>],
385                        [ctl_table *t; register_sysctl_table (t);],
386                        [REGISTER_SYSCTL_TABLE_NOFLAG],
387                        [define if register_sysctl_table has no insert_at head flag])
388 ])
389
390
391 AC_DEFUN([LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T], [
392   AC_CHECK_LINUX_BUILD([whether file_operations.flush takes a fl_owner_t],
393                        [ac_cv_linux_func_f_flush_takes_fl_owner_t],
394                        [#include <linux/fs.h>],
395 [struct inode _inode;
396 struct file _file;
397 fl_owner_t id;
398 (void)_inode.i_fop->flush(&_file, &id);],
399                        [FOP_FLUSH_TAKES_FL_OWNER_T],
400                        [define if your fops.flush takes an fl_owner_t argument])
401 ])
402
403
404 AC_DEFUN([LINUX_HAVE_KMEM_CACHE_T], [
405   AC_CHECK_LINUX_BUILD([whether kmem_cache_t exists],
406                        [ac_cv_linux_have_kmem_cache_t],
407                        [#include <linux/slab.h>],
408                        [kmem_cache_t *k;],
409                        [HAVE_KMEM_CACHE_T],
410                        [define if kmem_cache_t exists])
411 ])
412
413
414 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [
415   AC_CHECK_LINUX_BUILD([whether kmem_cache_create takes a destructor argument],
416                        [ac_cv_linux_kmem_cache_create_takes_dtor],
417                        [#include <linux/slab.h>],
418                        [kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);],
419                        [KMEM_CACHE_TAKES_DTOR],
420                        [define if kmem_cache_create takes a destructor argument])
421 ])
422
423
424 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[
425   AC_CACHE_CHECK([whether kmem_cache_create constructor takes a void pointer],
426                  [ac_cv_linux_kmem_cache_create_ctor_takes_void], [
427     save_CPPFLAGS="$CPPFLAGS"
428     CPPFLAGS="$CPPFLAGS -Werror"
429     AC_TRY_KBUILD([#include <linux/slab.h>],
430                   [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);],
431                   ac_cv_linux_kmem_cache_create_ctor_takes_void=yes,
432                   ac_cv_linux_kmem_cache_create_ctor_takes_void=no)
433     CPPFLAGS="$save_CPPFLAGS"
434   ])
435   AS_IF([test "x$ac_cv_linux_kmem_cache_create_ctor_takes_void" = "xyes"],
436         [AC_DEFINE([KMEM_CACHE_CTOR_TAKES_VOID], 1,
437                    [define if kmem_cache_create constructor takes a single void ptr])])
438 ])
439
440
441 dnl This function checks not just the existence of the splice functions,
442 dnl but also that the signature matches (they gained an extra argument
443 dnl around 2.6.17)
444 AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
445   AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations],
446                        [ac_cv_linux_fs_struct_fop_has_splice],
447                        [#include <linux/fs.h>],
448                        [struct file_operations _fop;
449                         _fop.splice_write(NULL, NULL, NULL, 0, 0);
450                         _fop.splice_read(NULL, NULL, NULL, 0, 0);],
451                        [STRUCT_FILE_OPERATIONS_HAS_SPLICE],
452                        [define if struct file_operations has splice functions])
453 ])
454
455
456 AC_DEFUN([LINUX_KMEM_CACHE_INIT], [
457   AC_CHECK_LINUX_BUILD([for new kmem_cache init function parameters],
458                        [ac_cv_linux_kmem_cache_init],
459                        [#include <linux/slab.h>],
460                        [extern struct kmem_cache *
461                         kmem_cache_create(const char *, size_t, size_t,
462                                           unsigned long,
463                                           void (*)(struct kmem_cache *, void *));
464                         return;],
465                        [KMEM_CACHE_INIT],
466                        [define for new kmem_cache init function parameters])
467 ])
468
469
470 AC_DEFUN([LINUX_SYSCTL_TABLE_CHECKING], [
471   AC_CHECK_LINUX_BUILD([for sysctl table checking],
472                        [ac_cv_linux_sysctl_table_checking],
473                        [#include <linux/sysctl.h>],
474                        [extern int sysctl_check_table(int) __attribute__((weak));
475                         sysctl_check_table(NULL);],
476                        [SYSCTL_TABLE_CHECKING],
477                        [define if your kernel has sysctl table checking])
478 ])
479
480
481 AC_DEFUN([LINUX_EXPORTS_PROC_ROOT_FS], [
482   AC_CHECK_LINUX_BUILD([if proc_root_fs is defined and exported],
483                        [ac_cv_linux_exports_proc_root_fs],
484                        [#include <linux/proc_fs.h>],
485                        [struct proc_dir_entry *p = proc_root_fs;],
486                        [EXPORTED_PROC_ROOT_FS],
487                        [define if proc_root_fs is exported])
488 ])
489
490
491 AC_DEFUN([LINUX_D_PATH_TAKES_STRUCT_PATH], [
492   AC_CHECK_LINUX_BUILD([if d_path() takes a struct path argument],
493                        [ac_cv_linux_d_path_takes_struct_path],
494                        [#include <linux/dcache.h>],
495                        [struct path *p; d_path(p, NULL, 0);],
496                        [D_PATH_TAKES_STRUCT_PATH],
497                        [define if d_path() takes a struct path argument])
498 ])
499
500
501 AC_DEFUN([LINUX_NEW_EXPORT_OPS], [
502   AC_CHECK_LINUX_BUILD([if kernel uses new export ops],
503                        [ac_cv_linux_new_export_ops],
504                        [#include <linux/exportfs.h>],
505                        [struct export_operations _eops;
506                         eops.fh_to_parent(NULL, NULL, 0, 0);],
507                        [NEW_EXPORT_OPS],
508                        [define if kernel uses new export ops])
509 ])
510
511
512 AC_DEFUN([LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT], [
513   AC_CHECK_LINUX_BUILD([if posix_test_lock returns a struct file_lock],
514                        [ac_cv_linux_posix_test_lock_returns_conflict],
515                        [#include <linux/fs.h>],
516                        [struct file_lock *lock;
517                         struct file * file;
518                         lock = posix_test_lock(file, lock);],
519                        [POSIX_TEST_LOCK_RETURNS_CONFLICT],
520                        [define if posix_test_lock returns the conflicting lock])
521 ])
522
523
524 AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
525   AC_CHECK_LINUX_BUILD([if posix_test_lock takes a conflict argument],
526                        [ac_cv_linux_posix_test_lock_conflict_arg],
527                        [#include <linux/fs.h>],
528                        [struct file_lock *lock;
529                         struct file *file;
530                         posix_test_lock(file, lock, lock);],
531                        [POSIX_TEST_LOCK_CONFLICT_ARG],
532                        [define if posix_test_lock takes a conflict argument])
533 ])
534
535
536 AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
537   AC_CHECK_LINUX_BUILD([for exported key_type_keyring],
538                        [ac_cv_linux_exports_key_type_keyring],
539 [
540 #ifdef HAVE_LINUX_KEY_TYPE_H
541 #include <linux/key-type.h>
542 #endif
543 #include <linux/key.h>
544 ],
545                        [printk("%s", key_type_keyring.name);],
546                        [EXPORTED_KEY_TYPE_KEYRING],
547                        [define if key_type_keyring is exported])
548 ])
549
550
551 AC_DEFUN([LINUX_KEYS_HAVE_SESSION_TO_PARENT], [
552   AC_CHECK_LINUX_BUILD([for KEYCTL_SESSION_TO_PARENT],
553                        [ac_cv_linux_have_session_to_parent],
554                        [#include <linux/keyctl.h>],
555                        [int i = KEYCTL_SESSION_TO_PARENT;],
556                        [HAVE_SESSION_TO_PARENT],
557                        [define if keyctl has the KEYCTL_SESSION_TO_PARENT function])
558 ])
559
560
561 AC_DEFUN([LINUX_HAVE_TRY_TO_FREEZE], [
562   AC_CHECK_LINUX_BUILD([for try_to_freeze],
563                        [ac_cv_linux_have_try_to_freeze],
564 [#include <linux/sched.h>
565 #ifdef HAVE_LINUX_FREEZER_H
566 #include <linux/freezer.h>
567 #endif],
568 [#ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
569    try_to_freeze(PF_FREEZE);
570 #else
571    try_to_freeze();
572 #endif],
573                        [HAVE_TRY_TO_FREEZE],
574                        [define if your kernel has the try_to_freeze function])
575 ])
576