Whamcloud - gitweb
b=19808 2.6.29-fc11 patchless client support
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-prim.c
index 9019b3f..be9822d 100644 (file)
@@ -40,6 +40,7 @@
 #endif
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/fs_struct.h>
 #include <linux/sched.h>
 
 #include <libcfs/libcfs.h>
@@ -212,7 +213,7 @@ EXPORT_SYMBOL(cfs_timer_deadline);
 void cfs_enter_debugger(void)
 {
 #if defined(CONFIG_KGDB)
-        BREAKPOINT();
+//        BREAKPOINT();
 #elif defined(__arch_um__)
         asm("int $3");
 #else
@@ -224,14 +225,7 @@ void cfs_daemonize(char *str) {
         unsigned long flags;
 
         lock_kernel();
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,63))
         daemonize(str);
-#else
-        daemonize();
-        exit_files(current);
-        reparent_to_init();
-        snprintf (current->comm, sizeof (current->comm), "%s", str);
-#endif
         SIGNAL_MASK_LOCK(current, flags);
         sigfillset(&current->blocked);
         RECALC_SIGPENDING;
@@ -240,19 +234,24 @@ void cfs_daemonize(char *str) {
 }
 
 int cfs_daemonize_ctxt(char *str) {
-        struct task_struct *tsk = current;
-        struct fs_struct *fs = NULL;
 
         cfs_daemonize(str);
+#ifndef HAVE_UNSHARE_FS_STRUCT
+        {
+        struct task_struct *tsk = current;
+        struct fs_struct *fs = NULL;
         fs = copy_fs_struct(tsk->fs);
         if (fs == NULL)
                 return -ENOMEM;
         exit_fs(tsk);
         tsk->fs = fs;
+        }
+#else
+        unshare_fs_struct();
+#endif
         return 0;
 }
 
-
 sigset_t
 cfs_get_blockedsigs(void)
 {
@@ -335,6 +334,7 @@ libcfs_arch_cleanup(void)
 
 EXPORT_SYMBOL(libcfs_arch_init);
 EXPORT_SYMBOL(libcfs_arch_cleanup);
+EXPORT_SYMBOL(cfs_enter_debugger);
 EXPORT_SYMBOL(cfs_daemonize);
 EXPORT_SYMBOL(cfs_daemonize_ctxt);
 EXPORT_SYMBOL(cfs_block_allsigs);