Skip to content

Commit 61b63c5

Browse files
cfd-36Linus Torvalds
authored andcommitted
uml: eliminate SIGALRM
Now that ITIMER_REAL is no longer used, there is no need for any use of SIGALRM whatsoever. This patch removes all mention of it. In addition, real_alarm_handler took a signal argument which is now always SIGVTALRM. So, that is gone. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5f73461 commit 61b63c5

7 files changed

Lines changed: 17 additions & 35 deletions

File tree

‎arch/um/os-Linux/irq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,6 @@ void init_irq_signals(int on_sigstack)
146146
flags = on_sigstack ? SA_ONSTACK : 0;
147147

148148
set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART,
149-
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
149+
SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
150150
signal(SIGWINCH, SIG_IGN);
151151
}

‎arch/um/os-Linux/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int __init main(int argc, char **argv, char **envp)
161161
* some time) and cause a segfault.
162162
*/
163163

164-
/* stop timers and set SIG*ALRM to be ignored */
164+
/* stop timers and set SIGVTALRM to be ignored */
165165
disable_timer();
166166

167167
/* disable SIGIO for the fds and set SIGIO to be ignored */

‎arch/um/os-Linux/process.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,15 @@ int __init can_drop_memory(void)
238238
void init_new_thread_signals(void)
239239
{
240240
set_handler(SIGSEGV, (__sighandler_t) sig_handler, SA_ONSTACK,
241-
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
241+
SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
242242
set_handler(SIGTRAP, (__sighandler_t) sig_handler, SA_ONSTACK,
243-
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
243+
SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
244244
set_handler(SIGFPE, (__sighandler_t) sig_handler, SA_ONSTACK,
245-
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
245+
SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
246246
set_handler(SIGILL, (__sighandler_t) sig_handler, SA_ONSTACK,
247-
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
247+
SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
248248
set_handler(SIGBUS, (__sighandler_t) sig_handler, SA_ONSTACK,
249-
SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
249+
SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
250250
signal(SIGHUP, SIG_IGN);
251251

252252
init_irq_signals(1);

‎arch/um/os-Linux/signal.c‎

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include "user.h"
1616

1717
/*
18-
* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled
19-
* together under SIGVTALRM_BIT. SIGPROF is excluded because we want to
18+
* These are the asynchronous signals. SIGPROF is excluded because we want to
2019
* be able to profile all of UML, not just the non-critical sections. If
2120
* profiling is not thread-safe, then that is not my problem. We can disable
2221
* profiling when SMP is enabled in that case.
@@ -27,9 +26,6 @@
2726
#define SIGVTALRM_BIT 1
2827
#define SIGVTALRM_MASK (1 << SIGVTALRM_BIT)
2928

30-
#define SIGALRM_BIT 2
31-
#define SIGALRM_MASK (1 << SIGALRM_BIT)
32-
3329
/*
3430
* These are used by both the signal handlers and
3531
* block/unblock_signals. I don't want modifications cached in a
@@ -55,15 +51,15 @@ void sig_handler(int sig, struct sigcontext *sc)
5551
set_signals(enabled);
5652
}
5753

58-
static void real_alarm_handler(int sig, struct sigcontext *sc)
54+
static void real_alarm_handler(struct sigcontext *sc)
5955
{
6056
struct uml_pt_regs regs;
6157

6258
if (sc != NULL)
6359
copy_sc(&regs, sc);
6460
regs.is_user = 0;
6561
unblock_signals();
66-
timer_handler(sig, &regs);
62+
timer_handler(SIGVTALRM, &regs);
6763
}
6864

6965
void alarm_handler(int sig, struct sigcontext *sc)
@@ -72,27 +68,20 @@ void alarm_handler(int sig, struct sigcontext *sc)
7268

7369
enabled = signals_enabled;
7470
if (!signals_enabled) {
75-
if (sig == SIGVTALRM)
76-
pending |= SIGVTALRM_MASK;
77-
else pending |= SIGALRM_MASK;
78-
71+
pending |= SIGVTALRM_MASK;
7972
return;
8073
}
8174

8275
block_signals();
8376

84-
real_alarm_handler(sig, sc);
77+
real_alarm_handler(sc);
8578
set_signals(enabled);
8679
}
8780

8881
void timer_init(void)
8982
{
9083
set_handler(SIGVTALRM, (__sighandler_t) alarm_handler,
91-
SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
92-
SIGALRM, -1);
93-
set_handler(SIGALRM, (__sighandler_t) alarm_handler,
94-
SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
95-
SIGALRM, -1);
84+
SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, -1);
9685
}
9786

9887
void set_sigstack(void *sig_stack, int size)
@@ -267,11 +256,8 @@ void unblock_signals(void)
267256
if (save_pending & SIGIO_MASK)
268257
sig_handler_common_skas(SIGIO, NULL);
269258

270-
if (save_pending & SIGALRM_MASK)
271-
real_alarm_handler(SIGALRM, NULL);
272-
273259
if (save_pending & SIGVTALRM_MASK)
274-
real_alarm_handler(SIGVTALRM, NULL);
260+
real_alarm_handler(NULL);
275261
}
276262
}
277263

‎arch/um/os-Linux/skas/process.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ static int userspace_tramp(void *stack)
222222
sigemptyset(&sa.sa_mask);
223223
sigaddset(&sa.sa_mask, SIGIO);
224224
sigaddset(&sa.sa_mask, SIGWINCH);
225-
sigaddset(&sa.sa_mask, SIGALRM);
226225
sigaddset(&sa.sa_mask, SIGVTALRM);
227226
sigaddset(&sa.sa_mask, SIGUSR1);
228227
sa.sa_flags = SA_ONSTACK;
@@ -539,8 +538,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
539538
int n;
540539

541540
set_handler(SIGWINCH, (__sighandler_t) sig_handler,
542-
SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM,
543-
SIGVTALRM, -1);
541+
SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGVTALRM, -1);
544542

545543
/*
546544
* Can't use UML_SETJMP or UML_LONGJMP here because they save

‎arch/um/os-Linux/skas/trap.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ void sig_handler_common_skas(int sig, void *sc_ptr)
5858

5959
handler = sig_info[sig];
6060

61-
/* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */
62-
if (sig != SIGIO && sig != SIGWINCH &&
63-
sig != SIGVTALRM && sig != SIGALRM)
61+
/* unblock SIGVTALRM, SIGIO if sig isn't IRQ signal */
62+
if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGVTALRM))
6463
unblock_signals();
6564

6665
handler(sig, r);

‎arch/um/os-Linux/trap.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ void os_fill_handlinfo(struct kern_handlers h)
2020
sig_info[SIGSEGV] = h.page_fault;
2121
sig_info[SIGIO] = h.sigio_handler;
2222
sig_info[SIGVTALRM] = h.timer_handler;
23-
sig_info[SIGALRM] = h.timer_handler;
2423
}

0 commit comments

Comments
 (0)