From f3627cbe9236a062012c836f3b6ee311b43f63f2 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sun, 23 Jul 2000 14:05:01 +0000 Subject: Merge with Linux 2.4.0-test5-pre4. --- kernel/fork.c | 27 +++++++++++++++++++++++++++ kernel/kmod.c | 23 +++++++++++++++++++++++ kernel/ksyms.c | 10 ++++++++-- kernel/sched.c | 14 +++++++------- kernel/sys.c | 9 +++++---- kernel/sysctl.c | 7 +++++++ 6 files changed, 77 insertions(+), 13 deletions(-) (limited to 'kernel') diff --git a/kernel/fork.c b/kernel/fork.c index 0de6a5f78..b27087d7e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -159,6 +159,33 @@ int alloc_uid(struct task_struct *p) return 0; } +void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) +{ + unsigned long flags; + + wq_write_lock_irqsave(&q->lock, flags); + __add_wait_queue(q, wait); + wq_write_unlock_irqrestore(&q->lock, flags); +} + +void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait) +{ + unsigned long flags; + + wq_write_lock_irqsave(&q->lock, flags); + __add_wait_queue_tail(q, wait); + wq_write_unlock_irqrestore(&q->lock, flags); +} + +void remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) +{ + unsigned long flags; + + wq_write_lock_irqsave(&q->lock, flags); + __remove_wait_queue(q, wait); + wq_write_unlock_irqrestore(&q->lock, flags); +} + void __init fork_init(unsigned long mempages) { int i; diff --git a/kernel/kmod.c b/kernel/kmod.c index 2a78a9606..5f9c3b7df 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c @@ -218,3 +218,26 @@ int request_module(const char * module_name) } return 0; } + + +#ifdef CONFIG_HOTPLUG +/* + hotplug path is set via /proc/sys + invoked by hotplug-aware bus drivers, + with exec_usermodehelper and some thread-spawner + + argv [0] = hotplug_path; + argv [1] = "usb", "scsi", "pci", "network", etc; + ... plus optional type-specific parameters + argv [n] = 0; + + envp [*] = HOME, PATH; optional type-specific parameters + + a hotplug bus should invoke this for device add/remove + events. the command is expected to load drivers when + necessary, and may perform additional system setup. +*/ +char hotplug_path[256] = "/sbin/hotplug"; + +#endif + diff --git a/kernel/ksyms.c b/kernel/ksyms.c index 32e548315..eae4ef1b7 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -77,6 +77,9 @@ __attribute__((section("__ksymtab"))) = { #ifdef CONFIG_KMOD EXPORT_SYMBOL(request_module); EXPORT_SYMBOL(exec_usermodehelper); +#ifdef CONFIG_HOTPLUG +EXPORT_SYMBOL(hotplug_path); +#endif #endif #ifdef CONFIG_MODULES @@ -97,7 +100,10 @@ EXPORT_SYMBOL(exit_sighand); /* internal kernel memory management */ EXPORT_SYMBOL(__alloc_pages); EXPORT_SYMBOL(alloc_pages_node); -EXPORT_SYMBOL(__free_pages_ok); +EXPORT_SYMBOL(__get_free_pages); +EXPORT_SYMBOL(get_zeroed_page); +EXPORT_SYMBOL(__free_pages); +EXPORT_SYMBOL(free_pages); #ifndef CONFIG_DISCONTIGMEM EXPORT_SYMBOL(contig_page_data); #endif @@ -134,7 +140,7 @@ EXPORT_SYMBOL(get_super); EXPORT_SYMBOL(get_empty_super); EXPORT_SYMBOL(getname); EXPORT_SYMBOL(names_cachep); -EXPORT_SYMBOL(_fput); +EXPORT_SYMBOL(fput); EXPORT_SYMBOL(igrab); EXPORT_SYMBOL(iunique); EXPORT_SYMBOL(iget4); diff --git a/kernel/sched.c b/kernel/sched.c index 935af0b42..1cfa76d3b 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -54,18 +54,19 @@ extern void mem_use(void); * calculation depends on the value of HZ. */ #if HZ < 200 -#define LOG2_HZ 7 +#define TICK_SCALE(x) ((x) >> 2) #elif HZ < 400 -#define LOG2_HZ 8 +#define TICK_SCALE(x) ((x) >> 1) #elif HZ < 800 -#define LOG2_HZ 9 +#define TICK_SCALE(x) (x) #elif HZ < 1600 -#define LOG2_HZ 10 +#define TICK_SCALE(x) ((x) << 1) #else -#define LOG2_HZ 11 +#define TICK_SCALE(x) ((x) << 2) #endif -#define NICE_TO_TICKS(nice) ((((20)-(nice)) >> (LOG2_HZ-5))+1) +#define NICE_TO_TICKS(nice) (TICK_SCALE(20-(nice))+1) + /* * Init task must be ok at boot for the ix86 as we will check its signals @@ -770,7 +771,6 @@ void __wake_up_sync(wait_queue_head_t *q, unsigned int mode) __wake_up_common(q, mode, 1); } - #define SLEEP_ON_VAR \ unsigned long flags; \ wait_queue_t wait; \ diff --git a/kernel/sys.c b/kernel/sys.c index 86827f285..2e6b84fa7 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -234,8 +234,9 @@ asmlinkage long sys_setpriority(int which, int who, int niceval) /* * Ugh. To avoid negative return values, "getpriority()" will - * not return the normal nice-value, but a value that has been - * offset by 20 (ie it returns 0..39 instead of -20..19) + * not return the normal nice-value, but a negated value that + * has been offset by 20 (ie it returns 40..1 instead of -20..19) + * to stay compatible. */ asmlinkage long sys_getpriority(int which, int who) { @@ -247,11 +248,11 @@ asmlinkage long sys_getpriority(int which, int who) read_lock(&tasklist_lock); for_each_task (p) { - unsigned niceval; + long niceval; if (!proc_sel(p, which, who)) continue; niceval = 20 - p->nice; - if (niceval < (unsigned)retval) + if (niceval > retval) retval = niceval; } read_unlock(&tasklist_lock); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ab62787d1..4290619d0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -53,6 +53,9 @@ static int minolduid; #ifdef CONFIG_KMOD extern char modprobe_path[]; +#ifdef CONFIG_HOTPLUG +extern char hotplug_path[]; +#endif #endif #ifdef CONFIG_CHR_DEV_SG extern int sg_big_buff; @@ -184,6 +187,10 @@ static ctl_table kern_table[] = { #ifdef CONFIG_KMOD {KERN_MODPROBE, "modprobe", &modprobe_path, 256, 0644, NULL, &proc_dostring, &sysctl_string }, +#ifdef CONFIG_HOTPLUG + {KERN_HOTPLUG, "hotplug", &hotplug_path, 256, + 0644, NULL, &proc_dostring, &sysctl_string }, +#endif #endif #ifdef CONFIG_CHR_DEV_SG {KERN_SG_BIG_BUFF, "sg-big-buff", &sg_big_buff, sizeof (int), -- cgit v1.2.3