arch/i386/kernel/signal.c and __unused

Jan Rychter (jwr@icm.edu.pl)
19 Jan 1998 17:05:04 +0100


Is there any particular reason that the parameter to sys_sigreturn be
called __unused if it is quite obviously *used* later on in the
function? This is confusing.

This is from 2.0.33:

/*
* This sets regs->esp even though we don't actually use sigstacks yet..
*/
asmlinkage int sys_sigreturn(unsigned long __unused)
{
#define COPY(x) regs->x = context.x
#define COPY_SEG(x) \
if ( (context.x & 0xfffc) /* not a NULL selectors */ \
&& (context.x & 0x4) != 0x4 /* not a LDT selector */ \
&& (context.x & 3) != 3 /* not a RPL3 GDT selector */ \
) goto badframe; COPY(x);
#define COPY_SEG_STRICT(x) \
if (!(context.x & 0xfffc) || (context.x & 3) != 3) goto badframe; COPY(x);
struct sigcontext_struct context;
struct pt_regs * regs;

regs = (struct pt_regs *) &__unused;
if (verify_area(VERIFY_READ, (void *) regs->esp, sizeof(context)))
goto badframe;
memcpy_fromfs(&context,(void *) regs->esp, sizeof(context));
current->blocked = context.oldmask & _BLOCKABLE;
COPY_SEG(ds);
COPY_SEG(es);
COPY_SEG(fs);
COPY_SEG(gs);
COPY_SEG_STRICT(ss);
COPY_SEG_STRICT(cs);
COPY(eip);
COPY(ecx); COPY(edx);
COPY(ebx);
COPY(esp); COPY(ebp);
COPY(edi); COPY(esi);
regs->eflags &= ~0x40DD5;
regs->eflags |= context.eflags & 0x40DD5;
regs->orig_eax = -1; /* disable syscall checks */
if (context.fpstate) {
struct _fpstate * buf = context.fpstate;
if (verify_area(VERIFY_READ, buf, sizeof(*buf)))
goto badframe;
restore_i387(buf);
}
return context.eax;
badframe:
printk("Bad frame in sys_sigreturn, esp=%08lx\n", regs->esp);
do_exit(SIGSEGV);
}

--J.