summaryrefslogtreecommitdiffstats
path: root/kernel/exec_domain.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-03 21:46:06 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-03 21:46:06 +0000
commit3e414096429d55fbc8116171bba3487647bbe638 (patch)
tree2b5fcfd9d16fa3a32c829fc2076f6e3785b43374 /kernel/exec_domain.c
parent20b23bfcf36fcb2d16d8b844501072541970637c (diff)
Merge with Linux 2.4.0-test3-pre2.
Diffstat (limited to 'kernel/exec_domain.c')
-rw-r--r--kernel/exec_domain.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 3f3b5fc16..1daf64cc1 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -104,32 +104,37 @@ int unregister_exec_domain(struct exec_domain *it)
void __set_personality(unsigned long personality)
{
- struct exec_domain *it;
+ struct exec_domain *it, *prev;
it = lookup_exec_domain(personality);
- if (it) {
- if (atomic_read(&current->fs->count) != 1) {
- struct fs_struct *new = copy_fs_struct(current->fs);
- struct fs_struct *old;
- if (!new) {
- put_exec_domain(it);
- return;
- }
- task_lock(current);
- old = current->fs;
- current->fs = new;
- task_unlock(current);
- put_fs_struct(old);
- }
- /*
- * At that point we are guaranteed to be the sole owner of
- * current->fs.
- */
+ if (it == current->exec_domain) {
current->personality = personality;
- current->exec_domain = it;
- set_fs_altroot();
- put_exec_domain(current->exec_domain);
+ return;
+ }
+ if (!it)
+ return;
+ if (atomic_read(&current->fs->count) != 1) {
+ struct fs_struct *new = copy_fs_struct(current->fs);
+ struct fs_struct *old;
+ if (!new) {
+ put_exec_domain(it);
+ return;
+ }
+ task_lock(current);
+ old = current->fs;
+ current->fs = new;
+ task_unlock(current);
+ put_fs_struct(old);
}
+ /*
+ * At that point we are guaranteed to be the sole owner of
+ * current->fs.
+ */
+ current->personality = personality;
+ prev = current->exec_domain;
+ current->exec_domain = it;
+ set_fs_altroot();
+ put_exec_domain(prev);
}
asmlinkage long sys_personality(unsigned long personality)