Commit a7df4a00 authored by Paul Mackerras's avatar Paul Mackerras Committed by Paul Mackerras

Merge au1.ibm.com:/home/paulus/kernel/linux-2.5

into au1.ibm.com:/home/paulus/kernel/for-linus-ppc
parents e30b4514 c9581bb6
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
LDFLAGS := -m elf_i386 LDFLAGS := -m elf_i386
OBJCOPYFLAGS := -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -T arch/i386/vmlinux.lds -e stext LDFLAGS_vmlinux := -T arch/i386/vmlinux.lds.s -e stext
CFLAGS += -pipe CFLAGS += -pipe
...@@ -104,7 +104,7 @@ endif ...@@ -104,7 +104,7 @@ endif
MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot MAKEBOOT = +$(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/i386/vmlinux.lds vmlinux: arch/i386/vmlinux.lds.s
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \ .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper clean archclean archmrproper
......
...@@ -60,7 +60,6 @@ int __init sensors_init(void); ...@@ -60,7 +60,6 @@ int __init sensors_init(void);
static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX]; static struct ctl_table_header *i2c_entries[SENSORS_ENTRY_MAX];
static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX]; static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX];
static unsigned short i2c_inodes[SENSORS_ENTRY_MAX];
static ctl_table sysctl_table[] = { static ctl_table sysctl_table[] = {
{CTL_DEV, "dev", NULL, 0, 0555}, {CTL_DEV, "dev", NULL, 0, 0555},
...@@ -189,8 +188,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix, ...@@ -189,8 +188,6 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return id; return id;
} }
#endif /* DEBUG */ #endif /* DEBUG */
i2c_inodes[id - 256] =
new_header->ctl_table->child->child->de->low_ino;
new_header->ctl_table->child->child->de->owner = controlling_mod; new_header->ctl_table->child->child->de->owner = controlling_mod;
return id; return id;
...@@ -213,49 +210,6 @@ void i2c_deregister_entry(int id) ...@@ -213,49 +210,6 @@ void i2c_deregister_entry(int id)
} }
} }
/* Monitor access for /proc/sys/dev/sensors; make unloading i2c-proc.o
impossible if some process still uses it or some file in it */
void i2c_fill_inode(struct inode *inode, int fill)
{
if (fill)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
}
/* Monitor access for /proc/sys/dev/sensors/ directories; make unloading
the corresponding module impossible if some process still uses it or
some file in it */
void i2c_dir_fill_inode(struct inode *inode, int fill)
{
int i;
struct i2c_client *client;
#ifdef DEBUG
if (!inode) {
printk(KERN_ERR "i2c-proc.o: Warning: inode NULL in fill_inode()\n");
return;
}
#endif /* def DEBUG */
for (i = 0; i < SENSORS_ENTRY_MAX; i++)
if (i2c_clients[i]
&& (i2c_inodes[i] == inode->i_ino)) break;
#ifdef DEBUG
if (i == SENSORS_ENTRY_MAX) {
printk
(KERN_ERR "i2c-proc.o: Warning: inode (%ld) not found in fill_inode()\n",
inode->i_ino);
return;
}
#endif /* def DEBUG */
client = i2c_clients[i];
if (fill)
client->driver->inc_use(client);
else
client->driver->dec_use(client);
}
int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp, int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
void *buffer, size_t * lenp) void *buffer, size_t * lenp)
{ {
......
...@@ -1817,7 +1817,7 @@ static int idefloppy_ioctl (ide_drive_t *drive, struct inode *inode, struct file ...@@ -1817,7 +1817,7 @@ static int idefloppy_ioctl (ide_drive_t *drive, struct inode *inode, struct file
return (idefloppy_get_format_progress(drive, inode, file, return (idefloppy_get_format_progress(drive, inode, file,
(int *)arg)); (int *)arg));
} }
return -EIO; return -EINVAL;
} }
/* /*
......
...@@ -3347,7 +3347,7 @@ static ide_startstop_t default_error (ide_drive_t *drive, const char *msg, byte ...@@ -3347,7 +3347,7 @@ static ide_startstop_t default_error (ide_drive_t *drive, const char *msg, byte
static int default_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, static int default_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return -EIO; return -EINVAL;
} }
static int default_open (struct inode *inode, struct file *filp, ide_drive_t *drive) static int default_open (struct inode *inode, struct file *filp, ide_drive_t *drive)
......
...@@ -368,7 +368,7 @@ struct inode { ...@@ -368,7 +368,7 @@ struct inode {
atomic_t i_count; atomic_t i_count;
dev_t i_dev; dev_t i_dev;
umode_t i_mode; umode_t i_mode;
nlink_t i_nlink; unsigned int i_nlink;
uid_t i_uid; uid_t i_uid;
gid_t i_gid; gid_t i_gid;
kdev_t i_rdev; kdev_t i_rdev;
......
...@@ -455,7 +455,7 @@ extern struct task_struct init_task; ...@@ -455,7 +455,7 @@ extern struct task_struct init_task;
extern struct mm_struct init_mm; extern struct mm_struct init_mm;
/* PID hashing. (shouldnt this be dynamic?) */ /* PID hashing. (shouldnt this be dynamic?) */
#define PIDHASH_SZ (4096 >> 2) #define PIDHASH_SZ 8192
extern struct task_struct *pidhash[PIDHASH_SZ]; extern struct task_struct *pidhash[PIDHASH_SZ];
#define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1)) #define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1))
......
...@@ -127,6 +127,7 @@ enum ...@@ -127,6 +127,7 @@ enum
KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
KERN_TAINTED=53, /* int: various kernel tainted flags */ KERN_TAINTED=53, /* int: various kernel tainted flags */
KERN_CADPID=54, /* int: PID of the process to notify on CAD */ KERN_CADPID=54, /* int: PID of the process to notify on CAD */
KERN_PIDMAX=55, /* int: PID # limit */
}; };
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
/* /*
* This controls the maximum pid allocated to a process * This controls the maximum pid allocated to a process
*/ */
#define PID_MASK 0x3fffffff #define DEFAULT_PID_MAX 0x8000
#define PID_MAX (PID_MASK+1)
#endif #endif
...@@ -66,7 +66,8 @@ static void release_task(struct task_struct * p) ...@@ -66,7 +66,8 @@ static void release_task(struct task_struct * p)
atomic_dec(&p->user->processes); atomic_dec(&p->user->processes);
security_ops->task_free_security(p); security_ops->task_free_security(p);
free_uid(p->user); free_uid(p->user);
BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children)); BUG_ON(p->ptrace || !list_empty(&p->ptrace_list) ||
!list_empty(&p->ptrace_children));
unhash_process(p); unhash_process(p);
release_thread(p); release_thread(p);
...@@ -718,8 +719,14 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc ...@@ -718,8 +719,14 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc
ptrace_unlink(p); ptrace_unlink(p);
do_notify_parent(p, SIGCHLD); do_notify_parent(p, SIGCHLD);
write_unlock_irq(&tasklist_lock); write_unlock_irq(&tasklist_lock);
} else } else {
if (p->ptrace) {
write_lock_irq(&tasklist_lock);
ptrace_unlink(p);
write_unlock_irq(&tasklist_lock);
}
release_task(p); release_task(p);
}
goto end_wait4; goto end_wait4;
default: default:
continue; continue;
......
...@@ -46,6 +46,14 @@ int nr_threads; ...@@ -46,6 +46,14 @@ int nr_threads;
int max_threads; int max_threads;
unsigned long total_forks; /* Handle normal Linux uptimes. */ unsigned long total_forks; /* Handle normal Linux uptimes. */
/*
* Protects next_safe, last_pid and pid_max:
*/
spinlock_t lastpid_lock = SPIN_LOCK_UNLOCKED;
static int next_safe = DEFAULT_PID_MAX;
int pid_max = DEFAULT_PID_MAX;
int last_pid; int last_pid;
struct task_struct *pidhash[PIDHASH_SZ]; struct task_struct *pidhash[PIDHASH_SZ];
...@@ -151,11 +159,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) ...@@ -151,11 +159,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
return tsk; return tsk;
} }
spinlock_t lastpid_lock = SPIN_LOCK_UNLOCKED;
static int get_pid(unsigned long flags) static int get_pid(unsigned long flags)
{ {
static int next_safe = PID_MAX;
struct task_struct *p; struct task_struct *p;
int pid; int pid;
...@@ -163,34 +168,35 @@ static int get_pid(unsigned long flags) ...@@ -163,34 +168,35 @@ static int get_pid(unsigned long flags)
return 0; return 0;
spin_lock(&lastpid_lock); spin_lock(&lastpid_lock);
if((++last_pid) & ~PID_MASK) { if (++last_pid > pid_max) {
last_pid = 300; /* Skip daemons etc. */ last_pid = 300; /* Skip daemons etc. */
goto inside; goto inside;
} }
if(last_pid >= next_safe) {
if (last_pid >= next_safe) {
inside: inside:
next_safe = PID_MAX; next_safe = pid_max;
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
repeat: repeat:
for_each_task(p) { for_each_task(p) {
if(p->pid == last_pid || if (p->pid == last_pid ||
p->pgrp == last_pid || p->pgrp == last_pid ||
p->tgid == last_pid || p->tgid == last_pid ||
p->session == last_pid) { p->session == last_pid) {
if(++last_pid >= next_safe) { if (++last_pid >= next_safe) {
if(last_pid & ~PID_MASK) if (last_pid >= pid_max)
last_pid = 300; last_pid = 300;
next_safe = PID_MAX; next_safe = pid_max;
} }
goto repeat; goto repeat;
} }
if(p->pid > last_pid && next_safe > p->pid) if (p->pid > last_pid && next_safe > p->pid)
next_safe = p->pid; next_safe = p->pid;
if(p->pgrp > last_pid && next_safe > p->pgrp) if (p->pgrp > last_pid && next_safe > p->pgrp)
next_safe = p->pgrp; next_safe = p->pgrp;
if(p->tgid > last_pid && next_safe > p->tgid) if (p->tgid > last_pid && next_safe > p->tgid)
next_safe = p->tgid; next_safe = p->tgid;
if(p->session > last_pid && next_safe > p->session) if (p->session > last_pid && next_safe > p->session)
next_safe = p->session; next_safe = p->session;
} }
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
......
...@@ -29,7 +29,7 @@ void __ptrace_link(task_t *child, task_t *new_parent) ...@@ -29,7 +29,7 @@ void __ptrace_link(task_t *child, task_t *new_parent)
if (!list_empty(&child->ptrace_list)) if (!list_empty(&child->ptrace_list))
BUG(); BUG();
if (child->parent == new_parent) if (child->parent == new_parent)
BUG(); return;
list_add(&child->ptrace_list, &child->parent->ptrace_children); list_add(&child->ptrace_list, &child->parent->ptrace_children);
REMOVE_LINKS(child); REMOVE_LINKS(child);
child->parent = new_parent; child->parent = new_parent;
......
...@@ -51,6 +51,7 @@ extern int max_queued_signals; ...@@ -51,6 +51,7 @@ extern int max_queued_signals;
extern int sysrq_enabled; extern int sysrq_enabled;
extern int core_uses_pid; extern int core_uses_pid;
extern int cad_pid; extern int cad_pid;
extern int pid_max;
/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
static int maxolduid = 65535; static int maxolduid = 65535;
...@@ -255,6 +256,8 @@ static ctl_table kern_table[] = { ...@@ -255,6 +256,8 @@ static ctl_table kern_table[] = {
{KERN_S390_USER_DEBUG_LOGGING,"userprocess_debug", {KERN_S390_USER_DEBUG_LOGGING,"userprocess_debug",
&sysctl_userprocess_debug,sizeof(int),0644,NULL,&proc_dointvec}, &sysctl_userprocess_debug,sizeof(int),0644,NULL,&proc_dointvec},
#endif #endif
{KERN_PIDMAX, "pid_max", &pid_max, sizeof (int),
0600, NULL, &proc_dointvec},
{0} {0}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment