diff --git a/include/minix/callnr.h b/include/minix/callnr.h index e8bd7a8d6..51c9103c9 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -103,10 +103,6 @@ /* Field names for the setsid(2) call. */ #define PM_GETSID_PID m1_i1 /* pid_t */ -/* Field names for the setgroups(2)/setgroups(2) calls. */ -#define PM_GROUPS_NUM m1_i1 /* int */ -#define PM_GROUPS_PTR m1_p1 /* gid_t * */ - /* Field names for the getmcontext(2)/setmcontext(2) calls. */ #define PM_MCONTEXT_CTX m1_p1 /* mcontext_t * */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 421380efb..77c854a6d 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -145,6 +145,14 @@ typedef struct { } mess_sigcalls; _ASSERT_MSG_SIZE(mess_sigcalls); +typedef struct { + int num; + vir_bytes ptr; /* gid_t * */ + + uint8_t padding[48]; +} mess_lc_pm_groups; +_ASSERT_MSG_SIZE(mess_lc_pm_groups); + typedef struct { int which; vir_bytes value; /* const struct itimerval * */ @@ -1000,6 +1008,7 @@ typedef struct { mess_fs_vfs_readsuper m_fs_vfs_readsuper; mess_fs_vfs_readwrite m_fs_vfs_readwrite; + mess_lc_pm_groups m_lc_pm_groups; mess_lc_pm_itimer m_lc_pm_itimer; mess_lc_pm_priority m_lc_pm_priority; mess_lc_pm_ptrace m_lc_pm_ptrace; diff --git a/lib/libc/sys-minix/getgroups.c b/lib/libc/sys-minix/getgroups.c index edda7e08e..e1c6f5e81 100644 --- a/lib/libc/sys-minix/getgroups.c +++ b/lib/libc/sys-minix/getgroups.c @@ -14,8 +14,8 @@ int getgroups(int ngroups, gid_t *arr) message m; memset(&m, 0, sizeof(m)); - m.PM_GROUPS_NUM = ngroups; - m.PM_GROUPS_PTR = (char *) arr; + m.m_lc_pm_groups.num = ngroups; + m.m_lc_pm_groups.ptr = (vir_bytes)arr; return(_syscall(PM_PROC_NR, PM_GETGROUPS, &m)); } diff --git a/lib/libc/sys-minix/setgroups.c b/lib/libc/sys-minix/setgroups.c index c5aab68c4..ed5ac47d0 100644 --- a/lib/libc/sys-minix/setgroups.c +++ b/lib/libc/sys-minix/setgroups.c @@ -10,8 +10,8 @@ int setgroups(int ngroups, const gid_t *gidset) message m; memset(&m, 0, sizeof(m)); - m.PM_GROUPS_PTR = (char *) __UNCONST(gidset); - m.PM_GROUPS_NUM = ngroups; + m.m_lc_pm_groups.ptr = (vir_bytes)gidset; + m.m_lc_pm_groups.num = ngroups; return(_syscall(PM_PROC_NR, PM_SETGROUPS, &m)); } diff --git a/servers/pm/getset.c b/servers/pm/getset.c index 347213ebc..b6a21e0fc 100644 --- a/servers/pm/getset.c +++ b/servers/pm/getset.c @@ -26,7 +26,7 @@ int do_get() switch(call_nr) { case PM_GETGROUPS: - ngroups = m_in.PM_GROUPS_NUM; + ngroups = m_in.m_lc_pm_groups.num; if (ngroups > NGROUPS_MAX || ngroups < 0) return(EINVAL); @@ -40,8 +40,7 @@ int do_get() return(EINVAL); r = sys_datacopy(SELF, (vir_bytes) rmp->mp_sgroups, who_e, - (vir_bytes) m_in.PM_GROUPS_PTR, - ngroups * sizeof(gid_t)); + m_in.m_lc_pm_groups.ptr, ngroups * sizeof(gid_t)); if (r != OK) return(r); @@ -140,15 +139,15 @@ int do_set() if (rmp->mp_effuid != SUPER_USER) return(EPERM); - ngroups = m_in.PM_GROUPS_NUM; + ngroups = m_in.m_lc_pm_groups.num; if (ngroups > NGROUPS_MAX || ngroups < 0) return(EINVAL); - if (ngroups > 0 && m_in.PM_GROUPS_PTR == NULL) + if (ngroups > 0 && m_in.m_lc_pm_groups.ptr == 0) return(EFAULT); - r = sys_datacopy(who_e, (vir_bytes) m_in.PM_GROUPS_PTR, SELF, + r = sys_datacopy(who_e, m_in.m_lc_pm_groups.ptr, SELF, (vir_bytes) rmp->mp_sgroups, ngroups * sizeof(gid_t)); if (r != OK)