#ifndef _COMPAT_SYS_MSG_H_
#define _COMPAT_SYS_MSG_H_
#include <compat/sys/ipc.h>
struct msqid_ds14 {
struct ipc_perm14 msg_perm;
struct __msg *msg_first;
struct __msg *msg_last;
u_long msg_cbytes;
u_long msg_qnum;
u_long msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
int32_t msg_stime;
long msg_pad1;
int32_t msg_rtime;
long msg_pad2;
int32_t msg_ctime;
long msg_pad3;
long msg_pad4[4];
};
struct msqid_ds13 {
struct ipc_perm msg_perm;
msgqnum_t msg_qnum;
msglen_t msg_qbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
int32_t msg_stime;
int32_t msg_rtime;
int32_t msg_ctime;
struct __msg *_msg_first;
struct __msg *_msg_last;
msglen_t _msg_cbytes;
};
struct msgid_ds_sysctl50 {
struct ipc_perm_sysctl msg_perm;
uint64_t msg_qnum;
uint64_t msg_qbytes;
uint64_t _msg_cbytes;
pid_t msg_lspid;
pid_t msg_lrpid;
int32_t msg_stime;
int32_t msg_rtime;
int32_t msg_ctime;
int32_t pad;
};
struct msg_sysctl_info50 {
struct msginfo msginfo;
struct msgid_ds_sysctl50 msgids[1];
};
__BEGIN_DECLS
static __inline void __msqid_ds14_to_native(const struct msqid_ds14 *, struct msqid_ds *);
static __inline void __native_to_msqid_ds14(const struct msqid_ds *, struct msqid_ds14 *);
static __inline void __msqid_ds13_to_native(const struct msqid_ds13 *, struct msqid_ds *);
static __inline void __native_to_msqid_ds13(const struct msqid_ds *, struct msqid_ds13 *);
static __inline void
__msqid_ds13_to_native(const struct msqid_ds13 *omsqbuf, struct msqid_ds *msqbuf)
{
memset(msqbuf, 0, sizeof *msqbuf);
msqbuf->msg_perm = omsqbuf->msg_perm;
#define CVT(x) msqbuf->x = omsqbuf->x
CVT(msg_qnum);
CVT(msg_qbytes);
CVT(msg_lspid);
CVT(msg_lrpid);
CVT(msg_stime);
CVT(msg_rtime);
CVT(msg_ctime);
#undef CVT
}
static __inline void
__native_to_msqid_ds13(const struct msqid_ds *msqbuf, struct msqid_ds13 *omsqbuf)
{
memset(omsqbuf, 0, sizeof(*omsqbuf));
omsqbuf->msg_perm = msqbuf->msg_perm;
#define CVT(x) omsqbuf->x = msqbuf->x
#define CVTI(x) omsqbuf->x = (int)msqbuf->x
CVT(msg_qnum);
CVT(msg_qbytes);
CVT(msg_lspid);
CVT(msg_lrpid);
CVTI(msg_stime);
CVTI(msg_rtime);
CVTI(msg_ctime);
#undef CVT
#undef CVTI
omsqbuf->_msg_cbytes = msqbuf->_msg_cbytes;
}
static __inline void
__msqid_ds14_to_native(const struct msqid_ds14 *omsqbuf, struct msqid_ds *msqbuf)
{
memset(msqbuf, 0, sizeof *msqbuf);
__ipc_perm14_to_native(&omsqbuf->msg_perm, &msqbuf->msg_perm);
#define CVT(x) msqbuf->x = omsqbuf->x
CVT(msg_qnum);
CVT(msg_qbytes);
CVT(msg_lspid);
CVT(msg_lrpid);
CVT(msg_stime);
CVT(msg_rtime);
CVT(msg_ctime);
#undef CVT
}
static __inline void
__native_to_msqid_ds14(const struct msqid_ds *msqbuf, struct msqid_ds14 *omsqbuf)
{
memset(omsqbuf, 0, sizeof *omsqbuf);
__native_to_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
#define CVT(x) omsqbuf->x = msqbuf->x
#define CVTI(x) omsqbuf->x = (int)msqbuf->x
CVT(msg_qnum);
CVT(msg_qbytes);
CVT(msg_lspid);
CVT(msg_lrpid);
CVTI(msg_stime);
CVTI(msg_rtime);
CVTI(msg_ctime);
#undef CVT
#undef CVTI
}
int __msgctl13(int, int, struct msqid_ds13 *);
int __msgctl14(int, int, struct msqid_ds14 *);
int __msgctl50(int, int, struct msqid_ds *);
__END_DECLS
#endif