2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * Linux module support routines.
14 #include <afsconfig.h>
15 #include "afs/param.h"
20 #include "afs/sysincludes.h"
21 #include "afsincludes.h"
22 #include "h/unistd.h" /* For syscall numbers. */
25 #ifdef AFS_AMD64_LINUX20_ENV
26 #include "../asm/ia32_unistd.h"
29 #include <linux/module.h>
30 #include <linux/slab.h>
31 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
32 #include <linux/init.h>
33 #include <linux/sched.h>
35 #if !defined(EXPORTED_SYS_CALL_TABLE) && defined(HAVE_KERNEL_LINUX_SYSCALL_H)
36 #include <linux/syscall.h>
39 #ifdef AFS_SPARC64_LINUX24_ENV
40 #define __NR_setgroups32 82 /* This number is not exported for some bizarre reason. */
43 asmlinkage int (*sys_settimeofdayp) (struct timeval * tv,
44 struct timezone * tz);
45 asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist);
47 #ifdef EXPORTED_SYS_CALL_TABLE
48 #ifdef AFS_SPARC64_LINUX20_ENV
49 extern unsigned int sys_call_table[]; /* changed to uint because SPARC64 has syscaltable of 32bit items */
51 extern void *sys_call_table[]; /* safer for other linuces */
53 #else /* EXPORTED_SYS_CALL_TABLE */
54 #ifdef AFS_SPARC64_LINUX20_ENV
55 static unsigned int *sys_call_table; /* changed to uint because SPARC64 has syscaltable of 32bit items */
57 static void **sys_call_table; /* safer for other linuces */
60 extern struct file_system_type afs_file_system;
62 static long get_page_offset(void);
64 #if defined(AFS_LINUX24_ENV)
65 DECLARE_MUTEX(afs_global_lock);
67 struct semaphore afs_global_lock = MUTEX;
69 int afs_global_owner = 0;
70 unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */
72 /* Since sys_ni_syscall is not exported, I need to cache it in order to restore
75 #ifdef AFS_SPARC64_LINUX20_ENV
76 static unsigned int afs_ni_syscall = 0;
78 static void *afs_ni_syscall = 0;
81 #ifdef AFS_AMD64_LINUX20_ENV
82 #ifdef EXPORTED_IA32_SYS_CALL_TABLE
83 extern void *ia32_sys_call_table[];
85 static void **ia32_sys_call_table;
88 static void *ia32_ni_syscall = 0;
89 asmlinkage long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist);
90 #if defined(__NR_ia32_setgroups32)
91 asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist);
92 #endif /* __NR_ia32_setgroups32 */
93 #endif /* AFS_AMD64_LINUX20_ENV */
95 #ifdef AFS_PPC64_LINUX20_ENV
96 asmlinkage long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist);
97 #endif /* AFS_AMD64_LINUX20_ENV */
99 #ifdef AFS_SPARC64_LINUX20_ENV
100 static unsigned int afs_ni_syscall32 = 0;
101 asmlinkage int (*sys32_setgroupsp) (int gidsetsize,
102 __kernel_gid_t32 * grouplist);
103 #if defined(__NR_setgroups32)
104 asmlinkage int (*sys32_setgroups32p) (int gidsetsize,
105 __kernel_gid_t32 * grouplist);
106 #endif /* __NR_setgroups32 */
107 #ifdef EXPORTED_SYS_CALL_TABLE
108 extern unsigned int sys_call_table32[];
109 #else /* EXPORTED_SYS_CALL_TABLE */
110 static unsigned int *sys_call_table32;
111 #endif /* EXPORTED_SYS_CALL_TABLE */
114 afs_syscall32(long syscall, long parm1, long parm2, long parm3, long parm4,
117 __asm__ __volatile__("srl %o4, 0, %o4\n\t" "mov %o7, %i7\n\t"
118 "call afs_syscall\n\t" "srl %o5, 0, %o5\n\t"
121 #endif /* AFS_SPARC64_LINUX20_ENV */
123 #ifdef AFS_IA64_LINUX20_ENV
126 afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp)
128 __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" "mov r41 = b0\n\t" /* save rp */
129 "mov out0 = in0\n\t" "mov out1 = in1\n\t" "mov out2 = in2\n\t" "mov out3 = in3\n\t" "mov out4 = in4\n\t" "mov out5 = gp\n\t" /* save gp */
130 ";;\n" ".L1: mov r3 = ip\n\t" ";;\n\t" "addl r15=.fptr_afs_syscall-.L1,r3\n\t" ";;\n\t" "ld8 r15=[r15]\n\t" ";;\n\t" "ld8 r16=[r15],8\n\t" ";;\n\t" "ld8 gp=[r15]\n\t" "mov b6=r16\n\t" "br.call.sptk.many b0 = b6\n\t" ";;\n\t" "mov ar.pfs = r42\n\t" "mov b0 = r41\n\t" "mov gp = r48\n\t" /* restore gp */
131 "br.ret.sptk.many b0\n" ".fptr_afs_syscall:\n\t"
132 "data8 @fptr(afs_syscall)");
136 afs_xsetgroups_stub(int r0, int r1, long r2, long r3, long r4, long gp)
138 __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" "mov r41 = b0\n\t" /* save rp */
139 "mov out0 = in0\n\t" "mov out1 = in1\n\t" "mov out2 = in2\n\t" "mov out3 = in3\n\t" "mov out4 = in4\n\t" "mov out5 = gp\n\t" /* save gp */
140 ";;\n" ".L2: mov r3 = ip\n\t" ";;\n\t" "addl r15=.fptr_afs_xsetgroups - .L2,r3\n\t" ";;\n\t" "ld8 r15=[r15]\n\t" ";;\n\t" "ld8 r16=[r15],8\n\t" ";;\n\t" "ld8 gp=[r15]\n\t" "mov b6=r16\n\t" "br.call.sptk.many b0 = b6\n\t" ";;\n\t" "mov ar.pfs = r42\n\t" "mov b0 = r41\n\t" "mov gp = r48\n\t" /* restore gp */
141 "br.ret.sptk.many b0\n" ".fptr_afs_xsetgroups:\n\t"
142 "data8 @fptr(afs_xsetgroups)");
150 #endif /* AFS_IA64_LINUX20_ENV */
152 #ifdef AFS_LINUX24_ENV
153 asmlinkage int (*sys_setgroups32p) (int gidsetsize,
154 __kernel_gid32_t * grouplist);
155 #endif /* AFS_LINUX24_ENV */
157 #ifdef AFS_SPARC64_LINUX20_ENV
158 #define POINTER2SYSCALL (unsigned int)(unsigned long)
159 #define SYSCALL2POINTER (void *)(long)
161 #define POINTER2SYSCALL (void *)
162 #define SYSCALL2POINTER (void *)
165 #ifdef AFS_PPC64_LINUX20_ENV
166 extern void *set_afs_syscall(void*);
167 extern void *set_afs_xsetgroups_syscall(void*);
168 extern void *set_afs_xsetgroups_syscall32(void*);
171 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
179 #if defined(AFS_IA64_LINUX20_ENV)
180 unsigned long kernel_gp = 0;
181 static struct fptr sys_settimeofday, sys_setgroups;
183 extern int afs_syscall();
184 extern long afs_xsetgroups();
185 #if defined(__NR_setgroups32)
186 extern int afs_xsetgroups32();
187 #endif /* __NR_setgroups32 */
188 #if defined(AFS_SPARC64_LINUX20_ENV) || defined (AFS_AMD64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV)
189 extern int afs32_xsetgroups();
190 #if (defined(__NR_setgroups32) && defined(AFS_SPARC64_LINUX20_ENV))
191 extern int afs32_xsetgroups32();
193 #if (defined(__NR_ia32_setgroups32) && defined(AFS_AMD64_LINUX20_ENV))
194 extern int afs32_xsetgroups32();
196 #endif /* AFS_SPARC64_LINUX20_ENV || AFS_AMD64_LINUX20_ENV */
198 #if !defined(EXPORTED_SYS_CALL_TABLE) || (defined(AFS_AMD64_LINUX20_ENV) && !defined(EXPORTED_IA32_SYS_CALL_TABLE))
200 unsigned long offset=0;
201 unsigned long datalen=0;
203 unsigned long token=0;
205 unsigned long mod_start=0;
206 unsigned long mod_end=0;
208 unsigned long sec_start=0;
209 unsigned long sec_end=0;
211 unsigned long sym_start=0;
212 unsigned long sym_end=0;
213 #endif /* EXPORTED_SYS_CALL_TABLE */
215 RWLOCK_INIT(&afs_xosi, "afs_xosi");
217 /* obtain PAGE_OFFSET value */
218 afs_linux_page_offset = get_page_offset();
220 #ifndef AFS_S390_LINUX22_ENV
221 if (afs_linux_page_offset == 0) {
222 /* couldn't obtain page offset so can't continue */
223 printf("afs: Unable to obtain PAGE_OFFSET. Exiting..");
227 #ifndef EXPORTED_SYS_CALL_TABLE
230 #ifdef EXPORTED_KALLSYMS_SYMBOL
236 kallsyms_symbol_to_address("sys_call_table", &token, &mod_name,
237 &mod_start, &mod_end, &sec_name,
238 &sec_start, &sec_end, &sym_name,
239 &sym_start, &sym_end);
240 if (ret && !strcmp(mod_name, "kernel"))
243 if (ret && sym_start) {
244 sys_call_table = sym_start;
247 #ifdef EXPORTED_KALLSYMS_ADDRESS
249 kallsyms_address_to_symbol((unsigned long)&init_mm, &mod_name,
250 &mod_start, &mod_end, &sec_name,
251 &sec_start, &sec_end, &sym_name,
252 &sym_start, &sym_end);
253 ptr = (unsigned long *)sec_start;
254 datalen = (sec_end - sec_start) / sizeof(unsigned long);
256 #if defined(AFS_IA64_LINUX20_ENV)
257 ptr = (unsigned long *)(&sys_close - 0x180000);
258 datalen = 0x180000 / sizeof(ptr);
260 #if defined(AFS_AMD64_LINUX20_ENV)
261 ptr = (unsigned long *)&init_mm;
262 datalen = 0x360000 / sizeof(ptr);
264 ptr = (unsigned long *)&init_mm;
269 for (offset = 0; offset < datalen; ptr++, offset++) {
270 #if defined(AFS_IA64_LINUX20_ENV)
271 unsigned long close_ip =
272 (unsigned long)((struct fptr *)&sys_close)->ip;
273 unsigned long chdir_ip =
274 (unsigned long)((struct fptr *)&sys_chdir)->ip;
275 unsigned long write_ip =
276 (unsigned long)((struct fptr *)&sys_write)->ip;
277 if (ptr[0] == close_ip && ptr[__NR_chdir - __NR_close] == chdir_ip
278 && ptr[__NR_write - __NR_close] == write_ip) {
279 sys_call_table = (void *)&(ptr[-1 * (__NR_close - 1024)]);
283 #if defined(EXPORTED_SYS_WAIT4) && defined(EXPORTED_SYS_CLOSE)
284 if (ptr[0] == (unsigned long)&sys_close
285 && ptr[__NR_wait4 - __NR_close] == (unsigned long)&sys_wait4) {
286 sys_call_table = ptr - __NR_close;
290 #if defined(EXPORTED_SYS_CHDIR) && defined(EXPORTED_SYS_CLOSE)
291 if (ptr[0] == (unsigned long)&sys_close
292 && ptr[__NR_chdir - __NR_close] == (unsigned long)&sys_chdir) {
293 sys_call_table = ptr - __NR_close;
297 if (ptr[0] == (unsigned long)&sys_exit
298 && ptr[__NR_open - __NR_exit] == (unsigned long)&sys_open) {
299 sys_call_table = ptr - __NR_exit;
306 #ifdef EXPORTED_KALLSYMS_ADDRESS
308 kallsyms_address_to_symbol((unsigned long)sys_call_table, &mod_name,
309 &mod_start, &mod_end, &sec_name,
310 &sec_start, &sec_end, &sym_name,
311 &sym_start, &sym_end);
312 if (ret && strcmp(sym_name, "sys_call_table"))
316 if (!sys_call_table) {
317 printf("Failed to find address of sys_call_table\n");
320 printf("Found sys_call_table at %x\n", sys_call_table);
321 # ifdef AFS_SPARC64_LINUX20_ENV
322 error cant support this yet.
324 #endif /* EXPORTED_SYS_CALL_TABLE */
325 #ifdef AFS_AMD64_LINUX20_ENV
326 #ifndef EXPORTED_IA32_SYS_CALL_TABLE
327 ia32_sys_call_table = 0;
328 #ifdef EXPORTED_KALLSYMS_SYMBOL
334 kallsyms_symbol_to_address("ia32_sys_call_table", &token,
335 &mod_name, &mod_start, &mod_end,
336 &sec_name, &sec_start, &sec_end,
337 &sym_name, &sym_start, &sym_end);
338 if (ret && !strcmp(mod_name, "kernel"))
341 if (ret && sym_start) {
342 ia32_sys_call_table = sym_start;
344 #else /* EXPORTED_KALLSYMS_SYMBOL */
345 #ifdef EXPORTED_KALLSYMS_ADDRESS
347 kallsyms_address_to_symbol((unsigned long)&interruptible_sleep_on,
348 &mod_name, &mod_start, &mod_end, &sec_name,
349 &sec_start, &sec_end, &sym_name,
350 &sym_start, &sym_end);
351 ptr = (unsigned long *)sec_start;
352 datalen = (sec_end - sec_start) / sizeof(unsigned long);
353 #else /* EXPORTED_KALLSYMS_ADDRESS */
354 #if defined(AFS_AMD64_LINUX20_ENV)
355 ptr = (unsigned long *)&interruptible_sleep_on;
356 datalen = 0x180000 / sizeof(ptr);
357 #else /* AFS_AMD64_LINUX20_ENV */
358 ptr = (unsigned long *)&interruptible_sleep_on;
360 #endif /* AFS_AMD64_LINUX20_ENV */
361 #endif /* EXPORTED_KALLSYMS_ADDRESS */
362 for (offset = 0; offset < datalen; ptr++, offset++) {
363 if (ptr[0] == (unsigned long)&sys_exit
364 && ptr[__NR_ia32_open - __NR_ia32_exit] ==
365 (unsigned long)&sys_open) {
366 ia32_sys_call_table = ptr - __NR_ia32_exit;
370 #ifdef EXPORTED_KALLSYMS_ADDRESS
372 kallsyms_address_to_symbol((unsigned long)ia32_sys_call_table,
373 &mod_name, &mod_start, &mod_end, &sec_name,
374 &sec_start, &sec_end, &sym_name,
375 &sym_start, &sym_end);
376 if (ret && strcmp(sym_name, "ia32_sys_call_table"))
377 ia32_sys_call_table = 0;
378 #endif /* EXPORTED_KALLSYMS_ADDRESS */
379 #endif /* EXPORTED_KALLSYMS_SYMBOL */
380 if (!ia32_sys_call_table) {
381 printf("Warning: Failed to find address of ia32_sys_call_table\n");
383 printf("Found ia32_sys_call_table at %x\n", ia32_sys_call_table);
386 printf("Found ia32_sys_call_table at %x\n", ia32_sys_call_table);
387 #endif /* IA32_SYS_CALL_TABLE */
390 /* Initialize pointers to kernel syscalls. */
391 #if defined(AFS_IA64_LINUX20_ENV)
392 kernel_gp = ((struct fptr *)printk)->gp;
394 sys_settimeofdayp = (void *)&sys_settimeofday;
396 ((struct fptr *)sys_settimeofdayp)->ip =
397 SYSCALL2POINTER sys_call_table[__NR_settimeofday - 1024];
398 ((struct fptr *)sys_settimeofdayp)->gp = kernel_gp;
400 #else /* !AFS_IA64_LINUX20_ENV */
401 sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday];
402 #endif /* AFS_IA64_LINUX20_ENV */
404 /* setup AFS entry point. */
406 #if defined(AFS_IA64_LINUX20_ENV)
407 SYSCALL2POINTER sys_call_table[__NR_afs_syscall - 1024]
409 SYSCALL2POINTER sys_call_table[__NR_afs_syscall]
412 printf("AFS syscall entry point already in use!\n");
415 #if defined(AFS_IA64_LINUX20_ENV)
416 afs_ni_syscall = sys_call_table[__NR_afs_syscall - 1024];
417 sys_call_table[__NR_afs_syscall - 1024] =
418 POINTER2SYSCALL((struct fptr *)afs_syscall_stub)->ip;
419 #else /* AFS_IA64_LINUX20_ENV */
420 afs_ni_syscall = sys_call_table[__NR_afs_syscall];
421 sys_call_table[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall;
422 # ifdef AFS_SPARC64_LINUX20_ENV
423 afs_ni_syscall32 = sys_call_table32[__NR_afs_syscall];
424 sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32;
426 #endif /* AFS_IA64_LINUX20_ENV */
427 #ifdef AFS_AMD64_LINUX20_ENV
428 if (ia32_sys_call_table) {
429 ia32_ni_syscall = ia32_sys_call_table[__NR_ia32_afs_syscall];
430 ia32_sys_call_table[__NR_ia32_afs_syscall] =
431 POINTER2SYSCALL afs_syscall;
433 #endif /* AFS_S390_LINUX22_ENV */
436 register_filesystem(&afs_file_system);
438 /* Intercept setgroups calls */
439 #if defined(AFS_IA64_LINUX20_ENV)
440 sys_setgroupsp = (void *)&sys_setgroups;
442 ((struct fptr *)sys_setgroupsp)->ip =
443 SYSCALL2POINTER sys_call_table[__NR_setgroups - 1024];
444 ((struct fptr *)sys_setgroupsp)->gp = kernel_gp;
446 sys_call_table[__NR_setgroups - 1024] =
447 POINTER2SYSCALL((struct fptr *)afs_xsetgroups_stub)->ip;
448 #else /* AFS_IA64_LINUX20_ENV */
449 sys_setgroupsp = SYSCALL2POINTER sys_call_table[__NR_setgroups];
450 sys_call_table[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups;
451 #ifdef AFS_SPARC64_LINUX20_ENV
452 sys32_setgroupsp = SYSCALL2POINTER sys_call_table32[__NR_setgroups];
453 sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs32_xsetgroups;
454 #endif /* AFS_SPARC64_LINUX20_ENV */
455 #if defined(__NR_setgroups32)
456 sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
457 sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
458 #ifdef AFS_SPARC64_LINUX20_ENV
459 sys32_setgroups32p = SYSCALL2POINTER sys_call_table32[__NR_setgroups32];
460 sys_call_table32[__NR_setgroups32] = POINTER2SYSCALL afs32_xsetgroups32;
461 #endif /* AFS_SPARC64_LINUX20_ENV */
462 #endif /* __NR_setgroups32 */
463 #ifdef AFS_AMD64_LINUX20_ENV
464 if (ia32_sys_call_table) {
466 SYSCALL2POINTER ia32_sys_call_table[__NR_ia32_setgroups];
467 ia32_sys_call_table[__NR_ia32_setgroups] =
468 POINTER2SYSCALL afs32_xsetgroups;
469 #if defined(__NR_ia32_setgroups32)
471 SYSCALL2POINTER ia32_sys_call_table[__NR_ia32_setgroups32];
472 ia32_sys_call_table[__NR_ia32_setgroups32] =
473 POINTER2SYSCALL afs32_xsetgroups32;
474 #endif /* __NR_ia32_setgroups32 */
476 #endif /* AFS_AMD64_LINUX20_ENV */
477 #endif /* AFS_IA64_LINUX20_ENV */
479 #ifdef AFS_PPC64_LINUX20_ENV
480 afs_ni_syscall = set_afs_syscall(afs_syscall);
481 sys_setgroupsp = set_afs_xsetgroups_syscall(afs_xsetgroups);
482 sys32_setgroupsp = set_afs_xsetgroups_syscall32(afs32_xsetgroups);
490 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
498 struct task_struct *t;
502 #if defined(AFS_IA64_LINUX20_ENV)
503 sys_call_table[__NR_setgroups - 1024] =
504 POINTER2SYSCALL((struct fptr *)sys_setgroupsp)->ip;
505 sys_call_table[__NR_afs_syscall - 1024] = afs_ni_syscall;
506 #else /* AFS_IA64_LINUX20_ENV */
507 sys_call_table[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp;
508 sys_call_table[__NR_afs_syscall] = afs_ni_syscall;
509 # ifdef AFS_SPARC64_LINUX20_ENV
510 sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys32_setgroupsp;
511 sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
513 # if defined(__NR_setgroups32)
514 sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
515 # ifdef AFS_SPARC64_LINUX20_ENV
516 sys_call_table32[__NR_setgroups32] = POINTER2SYSCALL sys32_setgroups32p;
519 #endif /* AFS_IA64_LINUX20_ENV */
520 #ifdef AFS_AMD64_LINUX20_ENV
521 if (ia32_sys_call_table) {
522 ia32_sys_call_table[__NR_ia32_setgroups] =
523 POINTER2SYSCALL sys32_setgroupsp;
524 ia32_sys_call_table[__NR_ia32_afs_syscall] =
525 POINTER2SYSCALL ia32_ni_syscall;
526 # if defined(__NR_setgroups32)
527 ia32_sys_call_table[__NR_ia32_setgroups32] =
528 POINTER2SYSCALL sys32_setgroups32p;
532 #ifdef AFS_PPC64_LINUX20_ENV
533 set_afs_syscall(afs_ni_syscall);
534 set_afs_xsetgroups_syscall(sys_setgroupsp);
535 set_afs_xsetgroups_syscall32(sys32_setgroupsp);
537 unregister_filesystem(&afs_file_system);
539 osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */
540 osi_linux_free_afs_memory();
545 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
546 module_init(afs_init);
547 module_exit(afs_cleanup);
552 get_page_offset(void)
554 #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PARISC_LINUX24_ENV) || defined(AFS_AMD64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV)
557 struct task_struct *p, *q;
559 /* search backward thru the circular list */
560 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
561 read_lock(&tasklist_lock);
563 /* search backward thru the circular list */
564 #ifdef DEFINED_PREV_TASK
565 for (q = current; p = q; q = prev_task(p)) {
567 for (p = current; p; p = p->prev_task) {
570 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
571 read_unlock(&tasklist_lock);
573 return p->addr_limit.seg;
577 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
578 read_unlock(&tasklist_lock);