From: Ben Gras Date: Sat, 26 Jul 2014 11:53:54 +0000 (+0200) Subject: custom message type for SEMOP X-Git-Tag: v3.3.0~118 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/CHANGES?a=commitdiff_plain;h=fce93dad32ee5448beb62ad7584afa2e55e7ec4f;p=minix.git custom message type for SEMOP --- diff --git a/include/minix/com.h b/include/minix/com.h index d571f2a3c..8ca65762e 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -835,9 +835,6 @@ #define IPC_SEMGET (IPC_BASE+5) #define IPC_SEMCTL (IPC_BASE+6) #define IPC_SEMOP (IPC_BASE+7) -# define SEMOP_ID m2_i1 -# define SEMOP_OPS m2_l1 -# define SEMOP_SIZE m2_i2 /*===========================================================================* * Messages for Scheduling * diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 328eab4ca..af25c7777 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -1817,6 +1817,14 @@ typedef struct { } mess_lc_ipc_semctl; _ASSERT_MSG_SIZE(mess_lc_ipc_semctl); +typedef struct { + int id; + void *ops; + unsigned int size; + uint8_t padding[42]; +} mess_lc_ipc_semop; +_ASSERT_MSG_SIZE(mess_lc_ipc_semop); + typedef struct { endpoint_t m_source; /* who sent the message */ int m_type; /* what kind of message is it */ @@ -2049,6 +2057,7 @@ typedef struct { mess_lc_ipc_shmctl m_lc_ipc_shmctl; mess_lc_ipc_semget m_lc_ipc_semget; mess_lc_ipc_semctl m_lc_ipc_semctl; + mess_lc_ipc_semop m_lc_ipc_semop; mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; diff --git a/lib/libc/sys-minix/sem.c b/lib/libc/sys-minix/sem.c index 37d3b3e66..7d78e22aa 100644 --- a/lib/libc/sys-minix/sem.c +++ b/lib/libc/sys-minix/sem.c @@ -90,9 +90,9 @@ int semop(int semid, struct sembuf *sops, size_t nsops) } memset(&m, 0, sizeof(m)); - m.SEMOP_ID = semid; - m.SEMOP_OPS = (long) sops; - m.SEMOP_SIZE = nsops; + m.m_lc_ipc_semop.id = semid; + m.m_lc_ipc_semop.ops = sops; + m.m_lc_ipc_semop.size = nsops; return _syscall(ipc_pt, IPC_SEMOP, &m); } diff --git a/servers/ipc/sem.c b/servers/ipc/sem.c index 1b37894ed..aab65678e 100644 --- a/servers/ipc/sem.c +++ b/servers/ipc/sem.c @@ -445,8 +445,8 @@ int do_semop(message *m) struct sem_struct *sem; int no_reply = 0; - id = m->SEMOP_ID; - nsops = (unsigned int) m->SEMOP_SIZE; + id = m->m_lc_ipc_semop.id; + nsops = m->m_lc_ipc_semop.size; r = EINVAL; if (!(sem = sem_find_id(id))) @@ -469,7 +469,7 @@ int do_semop(message *m) sops = malloc(sizeof(struct sembuf) * nsops); if (!sops) goto out_free; - r = sys_datacopy(who_e, (vir_bytes) m->SEMOP_OPS, + r = sys_datacopy(who_e, (vir_bytes) m->m_lc_ipc_semop.ops, SELF, (vir_bytes) sops, sizeof(struct sembuf) * nsops); if (r != OK) {