patch-2.4.0-test3 linux/kernel/exec_domain.c
Next file: linux/kernel/exit.c
Previous file: linux/kernel/acct.c
Back to the patch index
Back to the overall index
- Lines: 60
- Date:
Mon Jun 26 11:36:43 2000
- Orig file:
v2.4.0-test2/linux/kernel/exec_domain.c
- Orig date:
Tue May 23 15:31:37 2000
diff -u --recursive --new-file v2.4.0-test2/linux/kernel/exec_domain.c linux/kernel/exec_domain.c
@@ -104,32 +104,37 @@
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(¤t->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(¤t->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)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)