All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mm 6/9] unshare system call : allow unsharing of fs
@ 2005-12-13 13:43 JANAK DESAI
  0 siblings, 0 replies; only message in thread
From: JANAK DESAI @ 2005-12-13 13:43 UTC (permalink / raw)
  To: viro, chrisw, dwmw2, jamie, serue, mingo, linuxram, jmorris, sds, janak
  Cc: akpm, linux-kernel


[PATCH -mm 6/9] unshare system call: allow unsharing of fs

 fork.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
 
 
diff -Naurp 2.6.15-rc5-mm2+patch/kernel/fork.c 2.6.15-rc5-mm2+patch6/kernel/fork.c
--- 2.6.15-rc5-mm2+patch/kernel/fork.c	2005-12-12 19:31:48.000000000 +0000
+++ 2.6.15-rc5-mm2+patch6/kernel/fork.c	2005-12-12 21:12:36.000000000 +0000
@@ -1378,15 +1378,19 @@ static int unshare_thread(unsigned long 
 }
 
 /*
- * Unsharing of fs info for tasks created with CLONE_FS is not supported yet
+ * Unshare the filesystem structure if it is being shared
  */
 static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp)
 {
-	struct fs_struct *fs = current->fs;
+	struct fs_struct *fs = current->fs, *new_fs;
 
 	if ((unshare_flags & CLONE_FS) &&
-	    (fs && atomic_read(&fs->count) > 1))
-		return -EINVAL;
+	    (fs && atomic_read(&fs->count) > 1)) {
+		new_fs = __copy_fs_struct(current->fs);
+		if (!new_fs)
+			return -ENOMEM;
+		*new_fsp = new_fs;
+	}
 
 	return 0;
 }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-13 13:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 13:43 [PATCH -mm 6/9] unshare system call : allow unsharing of fs JANAK DESAI

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.