Skip to content

Commit ad28e02

Browse files
cfd-36Linus Torvalds
authored andcommitted
[PATCH] uml: change sigjmp_buf to jmp_buf
Clean up the jmpbuf code. Since softints, we no longer use sig_setjmp, so the UML_SIGSETJMP wrapper now has a misleading name. Also, I forgot to change the buffers from sigjmp_buf to jmp_buf. Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 4127272 commit ad28e02

6 files changed

Lines changed: 27 additions & 27 deletions

File tree

‎arch/um/include/longjmp.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#include <setjmp.h>
55
#include "os.h"
66

7-
#define UML_SIGLONGJMP(buf, val) do { \
7+
#define UML_LONGJMP(buf, val) do { \
88
longjmp(*buf, val); \
99
} while(0)
1010

11-
#define UML_SIGSETJMP(buf, enable) ({ \
11+
#define UML_SETJMP(buf, enable) ({ \
1212
int n; \
1313
enable = get_signals(); \
1414
n = setjmp(*buf); \

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ void init_new_thread_signals(int altstack)
266266

267267
int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
268268
{
269-
sigjmp_buf buf;
269+
jmp_buf buf;
270270
int n, enable;
271271

272272
*jmp_ptr = &buf;
273-
n = UML_SIGSETJMP(&buf, enable);
273+
n = UML_SETJMP(&buf, enable);
274274
if(n != 0)
275275
return(n);
276276
(*fn)(arg);

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
434434
void (*handler)(int))
435435
{
436436
unsigned long flags;
437-
sigjmp_buf switch_buf, fork_buf;
437+
jmp_buf switch_buf, fork_buf;
438438
int enable;
439439

440440
*switch_buf_ptr = &switch_buf;
@@ -450,7 +450,7 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
450450
*/
451451
flags = get_signals();
452452
block_signals();
453-
if(UML_SIGSETJMP(&fork_buf, enable) == 0)
453+
if(UML_SETJMP(&fork_buf, enable) == 0)
454454
new_thread_proc(stack, handler);
455455

456456
remove_sigstack();
@@ -466,43 +466,43 @@ void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
466466

467467
void thread_wait(void *sw, void *fb)
468468
{
469-
sigjmp_buf buf, **switch_buf = sw, *fork_buf;
469+
jmp_buf buf, **switch_buf = sw, *fork_buf;
470470
int enable;
471471

472472
*switch_buf = &buf;
473473
fork_buf = fb;
474-
if(UML_SIGSETJMP(&buf, enable) == 0)
474+
if(UML_SETJMP(&buf, enable) == 0)
475475
siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK);
476476
}
477477

478478
void switch_threads(void *me, void *next)
479479
{
480-
sigjmp_buf my_buf, **me_ptr = me, *next_buf = next;
480+
jmp_buf my_buf, **me_ptr = me, *next_buf = next;
481481
int enable;
482482

483483
*me_ptr = &my_buf;
484-
if(UML_SIGSETJMP(&my_buf, enable) == 0)
485-
UML_SIGLONGJMP(next_buf, 1);
484+
if(UML_SETJMP(&my_buf, enable) == 0)
485+
UML_LONGJMP(next_buf, 1);
486486
}
487487

488-
static sigjmp_buf initial_jmpbuf;
488+
static jmp_buf initial_jmpbuf;
489489

490490
/* XXX Make these percpu */
491491
static void (*cb_proc)(void *arg);
492492
static void *cb_arg;
493-
static sigjmp_buf *cb_back;
493+
static jmp_buf *cb_back;
494494

495495
int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
496496
{
497-
sigjmp_buf **switch_buf = switch_buf_ptr;
497+
jmp_buf **switch_buf = switch_buf_ptr;
498498
int n, enable;
499499

500500
set_handler(SIGWINCH, (__sighandler_t) sig_handler,
501501
SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM,
502502
SIGVTALRM, -1);
503503

504504
*fork_buf_ptr = &initial_jmpbuf;
505-
n = UML_SIGSETJMP(&initial_jmpbuf, enable);
505+
n = UML_SETJMP(&initial_jmpbuf, enable);
506506
switch(n){
507507
case INIT_JMP_NEW_THREAD:
508508
new_thread_proc((void *) stack, new_thread_handler);
@@ -512,7 +512,7 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
512512
break;
513513
case INIT_JMP_CALLBACK:
514514
(*cb_proc)(cb_arg);
515-
UML_SIGLONGJMP(cb_back, 1);
515+
UML_LONGJMP(cb_back, 1);
516516
break;
517517
case INIT_JMP_HALT:
518518
kmalloc_ok = 0;
@@ -523,21 +523,21 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
523523
default:
524524
panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
525525
}
526-
UML_SIGLONGJMP(*switch_buf, 1);
526+
UML_LONGJMP(*switch_buf, 1);
527527
}
528528

529529
void initial_thread_cb_skas(void (*proc)(void *), void *arg)
530530
{
531-
sigjmp_buf here;
531+
jmp_buf here;
532532
int enable;
533533

534534
cb_proc = proc;
535535
cb_arg = arg;
536536
cb_back = &here;
537537

538538
block_signals();
539-
if(UML_SIGSETJMP(&here, enable) == 0)
540-
UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK);
539+
if(UML_SETJMP(&here, enable) == 0)
540+
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK);
541541
unblock_signals();
542542

543543
cb_proc = NULL;
@@ -548,13 +548,13 @@ void initial_thread_cb_skas(void (*proc)(void *), void *arg)
548548
void halt_skas(void)
549549
{
550550
block_signals();
551-
UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_HALT);
551+
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT);
552552
}
553553

554554
void reboot_skas(void)
555555
{
556556
block_signals();
557-
UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT);
557+
UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT);
558558
}
559559

560560
void switch_mm_skas(struct mm_id *mm_idp)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void os_fill_handlinfo(struct kern_handlers h)
3535

3636
void do_longjmp(void *b, int val)
3737
{
38-
sigjmp_buf *buf = b;
38+
jmp_buf *buf = b;
3939

40-
UML_SIGLONGJMP(buf, val);
40+
UML_LONGJMP(buf, val);
4141
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ unsigned long __do_user_copy(void *to, const void *from, int n,
1616
unsigned long *faddrp = (unsigned long *) fault_addr, ret;
1717
int enable;
1818

19-
sigjmp_buf jbuf;
19+
jmp_buf jbuf;
2020
*fault_catcher = &jbuf;
21-
if(UML_SIGSETJMP(&jbuf, enable) == 0){
21+
if(UML_SETJMP(&jbuf, enable) == 0){
2222
(*op)(to, from, n);
2323
ret = 0;
2424
*faulted_out = 0;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void setup_hostinfo(void)
104104
int setjmp_wrapper(void (*proc)(void *, void *), ...)
105105
{
106106
va_list args;
107-
sigjmp_buf buf;
107+
jmp_buf buf;
108108
int n;
109109

110110
n = sigsetjmp(buf, 1);

0 commit comments

Comments
 (0)