custom message type for SEMOP

This commit is contained in:
Ben Gras 2014-07-26 13:53:54 +02:00 committed by Lionel Sambuc
parent c476408dea
commit fce93dad32
4 changed files with 15 additions and 9 deletions

View file

@ -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 *

View file

@ -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;

View file

@ -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);
}

View file

@ -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) {