[patch-2.3.43-pre8] saving 222 bytes of kernel code.

From: Tigran Aivazian (tigran@sco.COM)
Date: Thu Feb 10 2000 - 04:05:54 EST


Hi Linus,

After studying the replies I received on the first iteration of my
vhangup(2) optimization patch I produced another version:

   http://www.ocston.org/~tigran/patches/vhangup-2.3.43-p8.patch

It saves 222 bytes of kernel code and produces smaller and faster
sys_vhangup() function. There is no need to handle the case of no ctty
specially because the low-level routine does that already and the call
overhead is worth it because processes without ctty are rarer than those
with.

(apologies for forgetting about #include <linux/smp_lock.h> in a couple of
places yesterday - I noticed you corrected this yourself)

Regards,
------
Tigran A. Aivazian | http://www.sco.com
Escalations Research Group | tel: +44-(0)1923-813796
Santa Cruz Operation Ltd | http://www.ocston.org/~tigran

PS. Think about it - with a bunch (4096) of hackers removing 222 bytes of
code a day - we will reduce (static) kernel size to 0 in 2 days :)

--- open.c.0 Thu Feb 10 06:27:05 2000
+++ open.c Thu Feb 10 06:34:05 2000
@@ -898,16 +898,9 @@
  */
 asmlinkage long sys_vhangup(void)
 {
- int ret = -EPERM;
-
- if (!capable(CAP_SYS_TTY_CONFIG))
- goto out;
- /* If there is a controlling tty, hang it up */
- lock_kernel();
- if (current->tty)
+ if (capable(CAP_SYS_TTY_CONFIG)) {
                 tty_vhangup(current->tty);
- unlock_kernel();
- ret = 0;
-out:
- return ret;
+ return 0;
+ }
+ return -EPERM;
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:17 EST