patch-2.4.0-test8 linux/include/linux/sched.h
Next file: linux/include/linux/signal.h
Previous file: linux/include/linux/pci_ids.h
Back to the patch index
Back to the overall index
- Lines: 168
- Date:
Fri Sep 8 12:52:42 2000
- Orig file:
v2.4.0-test7/linux/include/linux/sched.h
- Orig date:
Wed Aug 23 18:36:39 2000
diff -u --recursive --new-file v2.4.0-test7/linux/include/linux/sched.h linux/include/linux/sched.h
@@ -33,11 +33,14 @@
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
-#define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */
+#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
#define CLONE_PID 0x00001000 /* set if pid shared */
#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
+#define CLONE_THREAD 0x00010000 /* Same thread group? */
+
+#define CLONE_SIGNAL (CLONE_SIGHAND | CLONE_THREAD)
/*
* These are the constant used to fake the fixed-point load-average
@@ -311,6 +314,7 @@
pid_t pgrp;
pid_t tty_old_pgrp;
pid_t session;
+ pid_t tgid;
/* boolean value for session group leader */
int leader;
/*
@@ -319,6 +323,7 @@
* p->p_pptr->pid)
*/
struct task_struct *p_opptr, *p_pptr, *p_cptr, *p_ysptr, *p_osptr;
+ struct list_head thread_group;
/* PID hash table linkage. */
struct task_struct *pidhash_next;
@@ -363,8 +368,10 @@
/* signal handlers */
spinlock_t sigmask_lock; /* Protects signal and blocked */
struct signal_struct *sig;
- sigset_t signal, blocked;
- struct signal_queue *sigqueue, **sigqueue_tail;
+
+ sigset_t blocked;
+ struct sigpending pending;
+
unsigned long sas_ss_sp;
size_t sas_ss_size;
int (*notifier)(void *priv);
@@ -435,6 +442,7 @@
prev_task: &tsk, \
p_opptr: &tsk, \
p_pptr: &tsk, \
+ thread_group: LIST_HEAD_INIT(tsk.thread_group), \
wait_chldexit: __WAIT_QUEUE_HEAD_INITIALIZER(tsk.wait_chldexit),\
real_timer: { \
function: it_real_fn \
@@ -451,10 +459,8 @@
files: &init_files, \
sigmask_lock: SPIN_LOCK_UNLOCKED, \
sig: &init_signals, \
- signal: {{0}}, \
+ pending: { NULL, &tsk.pending.head, {{0}}}, \
blocked: {{0}}, \
- sigqueue: NULL, \
- sigqueue_tail: &tsk.sigqueue, \
alloc_lock: SPIN_LOCK_UNLOCKED \
}
@@ -556,8 +562,8 @@
extern int kill_pg_info(int, struct siginfo *, pid_t);
extern int kill_sl_info(int, struct siginfo *, pid_t);
extern int kill_proc_info(int, struct siginfo *, pid_t);
-extern int kill_something_info(int, struct siginfo *, int);
extern void notify_parent(struct task_struct *, int);
+extern void do_notify_parent(struct task_struct *, int);
extern void force_sig(int, struct task_struct *);
extern int send_sig(int, struct task_struct *, int);
extern int kill_pg(pid_t, int, int);
@@ -571,11 +577,11 @@
return (p->sigpending != 0);
}
-/* Reevaluate whether the task has signals pending delivery.
- This is required every time the blocked sigset_t changes.
- All callers should have t->sigmask_lock. */
-
-static inline void recalc_sigpending(struct task_struct *t)
+/*
+ * Re-calculate pending state from the set of locally pending
+ * signals, globally pending signals, and blocked signals.
+ */
+static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
{
unsigned long ready;
long i;
@@ -583,23 +589,31 @@
switch (_NSIG_WORDS) {
default:
for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
- ready |= t->signal.sig[i] &~ t->blocked.sig[i];
+ ready |= signal->sig[i] &~ blocked->sig[i];
break;
- case 4: ready = t->signal.sig[3] &~ t->blocked.sig[3];
- ready |= t->signal.sig[2] &~ t->blocked.sig[2];
- ready |= t->signal.sig[1] &~ t->blocked.sig[1];
- ready |= t->signal.sig[0] &~ t->blocked.sig[0];
+ case 4: ready = signal->sig[3] &~ blocked->sig[3];
+ ready |= signal->sig[2] &~ blocked->sig[2];
+ ready |= signal->sig[1] &~ blocked->sig[1];
+ ready |= signal->sig[0] &~ blocked->sig[0];
break;
- case 2: ready = t->signal.sig[1] &~ t->blocked.sig[1];
- ready |= t->signal.sig[0] &~ t->blocked.sig[0];
+ case 2: ready = signal->sig[1] &~ blocked->sig[1];
+ ready |= signal->sig[0] &~ blocked->sig[0];
break;
- case 1: ready = t->signal.sig[0] &~ t->blocked.sig[0];
+ case 1: ready = signal->sig[0] &~ blocked->sig[0];
}
+ return ready != 0;
+}
+
+/* Reevaluate whether the task has signals pending delivery.
+ This is required every time the blocked sigset_t changes.
+ All callers should have t->sigmask_lock. */
- t->sigpending = (ready != 0);
+static inline void recalc_sigpending(struct task_struct *t)
+{
+ t->sigpending = has_pending_signals(&t->pending.signal, &t->blocked);
}
/* True if we are on the alternate signal stack. */
@@ -704,7 +718,7 @@
extern int expand_fdset(struct files_struct *, int nr);
extern void free_fdset(fd_set *, int);
-extern int copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *);
+extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *);
extern void flush_thread(void);
extern void exit_thread(void);
@@ -715,7 +729,7 @@
extern void daemonize(void);
extern int do_execve(char *, char **, char **, struct pt_regs *);
-extern int do_fork(unsigned long, unsigned long, struct pt_regs *);
+extern int do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long);
extern void FASTCALL(add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait));
@@ -798,6 +812,8 @@
#define for_each_task(p) \
for (p = &init_task ; (p = p->next_task) != &init_task ; )
+#define next_thread(p) \
+ list_entry((p)->thread_group.next, struct task_struct, thread_group)
static inline void del_from_runqueue(struct task_struct * p)
{
@@ -818,6 +834,7 @@
nr_threads--;
unhash_pid(p);
REMOVE_LINKS(p);
+ list_del(&p->thread_group);
write_unlock_irq(&tasklist_lock);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)