mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
bsd-user: Add host_to_target_msqid_ds for msgctl(2)
Add host_to_target_msqid_ds() to convert host struct msqid_ds to target format for msgctl(2) IPC_STAT operations. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Brooks Davis <brooks@one-eyed-alien.net> Signed-off-by: Sean Bruno <sbruno@FreeBSD.org> Signed-off-by: Mikael Urankar <mikael.urankar@gmail.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Warner Losh <imp@bsdimp.com>
This commit is contained in:
@@ -163,3 +163,30 @@ abi_long target_to_host_msqid_ds(struct msqid_ds *host_md,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
abi_long host_to_target_msqid_ds(abi_ulong target_addr,
|
||||
struct msqid_ds *host_md)
|
||||
{
|
||||
struct target_msqid_ds *target_md;
|
||||
|
||||
if (!lock_user_struct(VERIFY_WRITE, target_md, target_addr, 0)) {
|
||||
return -TARGET_EFAULT;
|
||||
}
|
||||
|
||||
memset(target_md, 0, sizeof(struct target_msqid_ds));
|
||||
host_to_target_ipc_perm__locked(&target_md->msg_perm,
|
||||
&host_md->msg_perm);
|
||||
|
||||
/* msg_first and msg_last are not used by IPC_SET/IPC_STAT in kernel. */
|
||||
__put_user(target_md->msg_cbytes, &host_md->msg_cbytes);
|
||||
__put_user(target_md->msg_qnum, &host_md->msg_qnum);
|
||||
__put_user(target_md->msg_qbytes, &host_md->msg_qbytes);
|
||||
__put_user(target_md->msg_lspid, &host_md->msg_lspid);
|
||||
__put_user(target_md->msg_lrpid, &host_md->msg_lrpid);
|
||||
__put_user(target_md->msg_stime, &host_md->msg_stime);
|
||||
__put_user(target_md->msg_rtime, &host_md->msg_rtime);
|
||||
__put_user(target_md->msg_ctime, &host_md->msg_ctime);
|
||||
unlock_user_struct(target_md, target_addr, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user