[PATCH -mm 3/10] unshare system call: allow unsharing of filesystem info
If filesystem structure is being shared, allocate a new one and
copy information from the current, shared, structure.
Changes since -v4 of this patch submitted on 12/13/05:
- none
Signed-off-by: Janak Desai <[email protected]>
---
fork.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff -Naurp 2.6.15-mm3+unsh-base/kernel/fork.c 2.6.15-mm3+unsh-fs/kernel/fork.c
--- 2.6.15-mm3+unsh-base/kernel/fork.c 2006-01-11 22:46:49.000000000 +0000
+++ 2.6.15-mm3+unsh-fs/kernel/fork.c 2006-01-12 00:26:46.000000000 +0000
@@ -1371,15 +1371,18 @@ 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;
if ((unshare_flags & CLONE_FS) &&
- (fs && atomic_read(&fs->count) > 1))
- return -EINVAL;
+ (fs && atomic_read(&fs->count) > 1)) {
+ *new_fsp = __copy_fs_struct(current->fs);
+ if (!*new_fsp)
+ return -ENOMEM;
+ }
return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]