custom message for SHMGET
This commit is contained in:
parent
0881781e60
commit
8627d33a42
4 changed files with 19 additions and 12 deletions
|
@ -827,10 +827,6 @@
|
||||||
|
|
||||||
/* Shared Memory */
|
/* Shared Memory */
|
||||||
#define IPC_SHMGET (IPC_BASE+1)
|
#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 IPC_SHMAT (IPC_BASE+2)
|
||||||
# define SHMAT_ID m2_i1
|
# define SHMAT_ID m2_i1
|
||||||
# define SHMAT_ADDR m2_l1
|
# define SHMAT_ADDR m2_l1
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
#include <minix/const.h>
|
#include <minix/const.h>
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
/*==========================================================================*
|
/*==========================================================================*
|
||||||
* Types relating to messages. *
|
* Types relating to messages. *
|
||||||
|
@ -1764,6 +1765,15 @@ typedef struct {
|
||||||
} mess_lsys_vm_watch_exit;
|
} mess_lsys_vm_watch_exit;
|
||||||
_ASSERT_MSG_SIZE(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 {
|
typedef struct {
|
||||||
endpoint_t m_source; /* who sent the message */
|
endpoint_t m_source; /* who sent the message */
|
||||||
int m_type; /* what kind of message is it */
|
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_info m_lsys_vm_info;
|
||||||
mess_lsys_vm_update m_lsys_vm_update;
|
mess_lsys_vm_update m_lsys_vm_update;
|
||||||
mess_lsys_vm_watch_exit m_lsys_vm_watch_exit;
|
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_cancel m_vfs_lchardriver_cancel;
|
||||||
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
|
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
|
||||||
|
|
|
@ -30,12 +30,12 @@ int shmget(key_t key, size_t size, int shmflg)
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.SHMGET_KEY = key;
|
m.m_lc_ipc_shmget.key = key;
|
||||||
m.SHMGET_SIZE = size;
|
m.m_lc_ipc_shmget.size = size;
|
||||||
m.SHMGET_FLAG = shmflg;
|
m.m_lc_ipc_shmget.flag = shmflg;
|
||||||
|
|
||||||
r = _syscall(ipc_pt, IPC_SHMGET, &m);
|
r = _syscall(ipc_pt, IPC_SHMGET, &m);
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
return r;
|
return r;
|
||||||
return m.SHMGET_RETID;
|
return m.m_lc_ipc_shmget.retid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,9 @@ int do_shmget(message *m)
|
||||||
int flag;
|
int flag;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
key = m->SHMGET_KEY;
|
key = m->m_lc_ipc_shmget.key;
|
||||||
old_size = size = m->SHMGET_SIZE;
|
old_size = size = m->m_lc_ipc_shmget.size;
|
||||||
flag = m->SHMGET_FLAG;
|
flag = m->m_lc_ipc_shmget.flag;
|
||||||
|
|
||||||
if ((shm = shm_find_key(key))) {
|
if ((shm = shm_find_key(key))) {
|
||||||
if (!check_perm(&shm->shmid_ds.shm_perm, who_e, flag))
|
if (!check_perm(&shm->shmid_ds.shm_perm, who_e, flag))
|
||||||
|
@ -97,7 +97,7 @@ int do_shmget(message *m)
|
||||||
shm_list_nr++;
|
shm_list_nr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->SHMGET_RETID = id;
|
m->m_lc_ipc_shmget.retid = id;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue