Subject: kern/7621: linux semctl emulation in netbsd 1.4
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jiro@objectlink.co.jp>
List: netbsd-bugs
Date: 05/21/1999 20:22:47
>Number:         7621
>Category:       kern
>Synopsis:       linux semctl emulation in netbsd 1.4
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 21 20:05:00 1999
>Last-Modified:
>Originator:     YAMAMOTO Jiro
>Organization:
ObjectLink, Inc.
>Release:        1.4 i386
>Environment:

>Description:
The commond SETALL and GETALL for linux semctrl are missing in linux_sys_ipc.c. And I think that the command SETVAL does not work because the member val of the union semun is not passed on to the function sys___semctl. Here is my quick workaround. This fix seems to work fine for now, but if someone knows the better one, please let me know. I need a stable code for it in order to run GemStone for linux under netbsd.

/sys/compat/linux/common/linux_ipc.c

        case LINUX_SETVAL:
                SCARG(&nua, cmd) = SETVAL;
                sg = stackgap_init(p->p_emul);
                bup = stackgap_alloc(&sg, sizeof(union semun));
                bup->val = SCARG(uap, arg).l_val;
                SCARG(&nua, arg) = bup;
                break;
        case LINUX_GETALL:
                SCARG(&nua, cmd) = GETALL;
                sg = stackgap_init(p->p_emul);
                bup = stackgap_alloc(&sg, sizeof(union semun));
                bup->array = SCARG(uap, arg).l_array;
                SCARG(&nua, arg) = bup;
                break;
        case LINUX_SETALL:
                SCARG(&nua, cmd) = SETALL;
                sg = stackgap_init(p->p_emul);
                bup = stackgap_alloc(&sg, sizeof(union semun));
                bup->array = SCARG(uap, arg).l_array;
                SCARG(&nua, arg) = bup;
                break;

Regards,
Jiro
>How-To-Repeat:


>Fix:
see the full description above.
>Audit-Trail:
>Unformatted: