mtd/include/linux/mtd compatmac.h,1.58,1.59
David Woodhouse
dwmw2 at infradead.org
Thu Oct 9 09:42:44 EDT 2003
Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv10402/include/linux/mtd
Modified Files:
compatmac.h
Log Message:
Convert to allow_signal() and disallow_signal()
Index: compatmac.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/compatmac.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- compatmac.h 3 Oct 2003 23:00:58 -0000 1.58
+++ compatmac.h 9 Oct 2003 13:42:41 -0000 1.59
@@ -54,10 +54,22 @@
#endif /* < 2.4.20 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
+
#include <linux/sched.h>
+
+#ifdef __rh_config_h__
+#define sigmask_lock sighand->siglock
+#define sig sighand
+#endif
+
static inline void __daemonize_modvers(void)
{
daemonize();
+
+ spin_lock_irq(¤t->sigmask_lock);
+ sigfillset(¤t->blocked);
+ recalc_sigpending();
+ spin_unlock_irq(¤t->sigmask_lock);
}
#undef daemonize
#define daemonize(fmt, ...) do { \
@@ -65,15 +77,95 @@
__daemonize_modvers(); \
} while(0)
-static inline int __dequeue_signal25(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
+static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
+{
+ unsigned long flags;
+ unsigned long ret;
+
+ spin_lock_irqsave(¤t->sigmask_lock, flags);
+ ret = dequeue_signal(mask, info);
+ spin_unlock_irqrestore(¤t->sigmask_lock, flags);
+
+ return ret;
+}
+
+static inline int allow_signal(int sig)
+{
+ if (sig < 1 || sig > _NSIG)
+ return -EINVAL;
+
+ spin_lock_irq(¤t->sigmask_lock);
+ sigdelset(¤t->blocked, sig);
+ recalc_sigpending();
+ /* Make sure the kernel neither eats it now converts to SIGKILL */
+ current->sig->action[sig-1].sa.sa_handler = (void *)2;
+ spin_unlock_irq(¤t->sigmask_lock);
+ return 0;
+}
+static inline int disallow_signal(int sig)
+{
+ if (sig < 1 || sig > _NSIG)
+ return -EINVAL;
+
+ spin_lock_irq(¤t->sigmask_lock);
+ sigaddset(¤t->blocked, sig);
+ recalc_sigpending();
+
+ current->sig->action[sig-1].sa.sa_handler = SIG_DFL;
+ spin_unlock_irq(¤t->sigmask_lock);
+ return 0;
+}
+
+#undef sighand
+#undef sigmask_lock
+
+#else /* for 2.6... */
+static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
{
- return dequeue_signal(mask, info);
+ unsigned long flags;
+ unsigned long ret;
+
+ spin_lock_irqsave(¤t->sighand->siglock, flags);
+ ret = dequeue_signal(tsk, mask, info);
+ spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+
+ return ret;
+}
+
+
+static inline int allow_signal_fixed(int sig)
+{
+ if (sig < 1 || sig > _NSIG)
+ return -EINVAL;
+
+ spin_lock_irq(¤t->sighand->siglock);
+ sigdelset(¤t->blocked, sig);
+ recalc_sigpending();
+ /* Make sure the kernel neither eats it now converts to SIGKILL */
+ current->sig->action[sig-1].sa.sa_handler = 2;
+ spin_unlock_irq(¤t->sighand->siglock);
+ return 0;
}
-#undef dequeue_signal
-#define dequeue_signal __dequeue_signal25
+
+static inline int disallow_signal(int sig)
+{
+ if (sig < 1 || sig > _NSIG)
+ return -EINVAL;
+
+ spin_lock_irq(¤t->sighand->siglock);
+ sigaddset(¤t->blocked, sig);
+ recalc_sigpending();
+
+ current->sig->action[sig-1].sa.sa_handler = SIG_DFL;
+ spin_unlock_irq(¤t->sighand->siglock);
+ return 0;
+
+}
+
#endif
/* Module bits */
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
#define try_module_get(m) try_inc_mod_count(m)
More information about the linux-mtd-cvs
mailing list