From: Ben Gras Date: Sat, 26 Jul 2014 11:53:51 +0000 (+0200) Subject: custom message for SHMGET X-Git-Tag: v3.3.0~121 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/static/doc/zpipe.c?a=commitdiff_plain;h=8627d33a4259208626fd1186a466d56acd425bac;p=minix.git custom message for SHMGET --- diff --git a/include/minix/com.h b/include/minix/com.h index dca4f0c8c..942b131e2 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -827,10 +827,6 @@ /* Shared Memory */ #define IPC_SHMGET (IPC_BASE+1) -# define SHMGET_KEY m2_l1 -# define SHMGET_SIZE m2_l2 -# define SHMGET_FLAG m2_i1 -# define SHMGET_RETID m2_i2 #define IPC_SHMAT (IPC_BASE+2) # define SHMAT_ID m2_i1 # define SHMAT_ADDR m2_l1 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index c65982e9c..19aeb8bec 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -5,6 +5,7 @@ #include #include #include +#include /*==========================================================================* * Types relating to messages. * @@ -1764,6 +1765,15 @@ typedef struct { } mess_lsys_vm_watch_exit; _ASSERT_MSG_SIZE(mess_lsys_vm_watch_exit); +typedef struct { + key_t key; + size_t size; + int flag; + int retid; + uint8_t padding[40]; +} mess_lc_ipc_shmget; +_ASSERT_MSG_SIZE(mess_lc_ipc_shmget); + typedef struct { endpoint_t m_source; /* who sent the message */ int m_type; /* what kind of message is it */ @@ -1990,6 +2000,7 @@ typedef struct { mess_lsys_vm_info m_lsys_vm_info; mess_lsys_vm_update m_lsys_vm_update; mess_lsys_vm_watch_exit m_lsys_vm_watch_exit; + mess_lc_ipc_shmget m_lc_ipc_shmget; mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; diff --git a/lib/libc/sys-minix/shmget.c b/lib/libc/sys-minix/shmget.c index ca83cd3f2..5cb373daf 100644 --- a/lib/libc/sys-minix/shmget.c +++ b/lib/libc/sys-minix/shmget.c @@ -30,12 +30,12 @@ int shmget(key_t key, size_t size, int shmflg) } memset(&m, 0, sizeof(m)); - m.SHMGET_KEY = key; - m.SHMGET_SIZE = size; - m.SHMGET_FLAG = shmflg; + m.m_lc_ipc_shmget.key = key; + m.m_lc_ipc_shmget.size = size; + m.m_lc_ipc_shmget.flag = shmflg; r = _syscall(ipc_pt, IPC_SHMGET, &m); if (r != OK) return r; - return m.SHMGET_RETID; + return m.m_lc_ipc_shmget.retid; } diff --git a/servers/ipc/shm.c b/servers/ipc/shm.c index 32696530d..d213301a1 100644 --- a/servers/ipc/shm.c +++ b/servers/ipc/shm.c @@ -42,9 +42,9 @@ int do_shmget(message *m) int flag; int id; - key = m->SHMGET_KEY; - old_size = size = m->SHMGET_SIZE; - flag = m->SHMGET_FLAG; + key = m->m_lc_ipc_shmget.key; + old_size = size = m->m_lc_ipc_shmget.size; + flag = m->m_lc_ipc_shmget.flag; if ((shm = shm_find_key(key))) { if (!check_perm(&shm->shmid_ds.shm_perm, who_e, flag)) @@ -97,7 +97,7 @@ int do_shmget(message *m) shm_list_nr++; } - m->SHMGET_RETID = id; + m->m_lc_ipc_shmget.retid = id; return OK; }