Subject: linux semctl emulation in netbsd 1.4
To: 'netbsd-bugs@NetBSD.ORG' <netbsd-bugs@NetBSD.ORG>
From: YAMAMOTO, Jiro <jiro@objectlink.co.jp>
List: netbsd-bugs
Date: 05/21/1999 21:35:56
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