Add IPC,SHM,MSG for Freebsd

              INFO for the patch:
FREEBSD [https://github.com/freebsd/freebsd]

        /sys/sys/_types.h
typedef    long        __key_t;

        /sys/sys/types.h
typedef    __key_t        key_t;

        /sys/sys/ipc.h

struct ipc_perm {
    uid_t        cuid;
    gid_t        cgid;
    uid_t        uid;
    gid_t        gid;
    mode_t        mode;
    unsigned short    seq;
    key_t        key;
};

key_t    ftok(const char *, int);

        /sys/sys/msg.h

typedef    unsigned long    msglen_t;
typedef    unsigned long    msgqnum_t;

struct msqid_ds {
	struct	ipc_perm msg_perm;
	struct	msg *msg_first;
	struct	msg *msg_last;
	msglen_t msg_cbytes;
	msgqnum_t msg_qnum;
	msglen_t msg_qbytes;
	pid_t	msg_lspid;
	pid_t	msg_lrpid;
	time_t	msg_stime;
	time_t	msg_rtime;
	time_t	msg_ctime;
};

struct msg {
	struct	msg *msg_next;
	long	msg_type;
	u_short	msg_ts;
	short	msg_spot;
	struct	label *label;
};

struct msginfo {
    int    msgmax,
        msgmni,
        msgmnb,
        msgtql,
        msgssz,
        msgseg;
};

int msgctl(int, int, struct msqid_ds *);
int msgget(key_t, int);
ssize_t msgrcv(int, void *, size_t, long, int);
int msgsnd(int, const void *, size_t, int);

        /sys/sys/shm.h

typedef unsigned int shmatt_t;

struct shmid_ds {
    struct ipc_perm shm_perm;
    size_t          shm_segsz;
    pid_t           shm_lpid;
    pid_t           shm_cpid;
    shmatt_t        shm_nattch;
    time_t          shm_atime;
    time_t          shm_dtime;
    time_t          shm_ctime;
};

void *shmat(int, const void *, int);
int shmget(key_t, size_t, int);
int shmctl(int, int, struct shmid_ds *);
int shmdt(const void *);

	/sys/security/mac/mac_internal.h
struct label {
	int		l_flags;
	intptr_t	l_perpolicy[MAC_MAX_SLOTS];
};

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update build.rs

Update mod.rs

Update mod.rs

Update build.rs

Update mod.rs

Update build.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update mod.rs

Update build.rs

Update build.rs

Update mod.rs

Update mod.rs
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 4ebba50..ab3bf8c 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -201,6 +201,9 @@
         cfg.header("sched.h");
         cfg.header("ufs/ufs/quota.h");
         cfg.header("sys/jail.h");
+        cfg.header("sys/ipc.h");
+        cfg.header("sys/msg.h");
+        cfg.header("sys/shm.h");
     }
 
     if netbsd {
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index aecf228..acf75b9 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -11,6 +11,10 @@
 pub type fsfilcnt_t = ::uint64_t;
 pub type idtype_t = ::c_uint;
 
+pub type key_t = ::c_long;
+pub type msglen_t = ::c_ulong;
+pub type msgqnum_t = ::c_ulong;
+
 s! {
     pub struct utmpx {
         pub ut_type: ::c_short,
@@ -88,6 +92,41 @@
     pub struct _sem {
         data: [u32; 4],
     }
+
+    pub struct ipc_perm {
+        pub cuid: ::uid_t,
+        pub cgid: ::gid_t,
+        pub uid: ::uid_t,
+        pub gid: ::gid_t,
+        pub mode: ::mode_t,
+        pub seq: ::c_ushort,
+        pub key: ::key_t,
+    }
+
+    pub struct msqid_ds {
+        pub msg_perm: ::ipc_perm,
+        __unused1: *mut ::c_void,
+        __unused2: *mut ::c_void,
+        pub msg_cbytes: ::msglen_t,
+        pub msg_qnum: ::msgqnum_t,
+        pub msg_qbytes: ::msglen_t,
+        pub msg_lspid: ::pid_t,
+        pub msg_lrpid: ::pid_t,
+        pub msg_stime: ::time_t,
+        pub msg_rtime: ::time_t,
+        pub msg_ctime: ::time_t,
+    }
+
+    pub struct shmid_ds {
+        pub shm_perm: ::ipc_perm,
+        pub shm_segsz: ::size_t,
+        pub shm_lpid: ::pid_t,
+        pub shm_cpid: ::pid_t,
+        pub shm_nattch: ::c_int,
+        pub shm_atime: ::time_t,
+        pub shm_dtime: ::time_t,
+        pub shm_ctime: ::time_t,
+    }
 }
 
 pub const SIGEV_THREAD_ID: ::c_int = 4;
@@ -384,6 +423,28 @@
 pub const NET_RT_IFMALIST: ::c_int = 4;
 pub const NET_RT_IFLISTL: ::c_int = 5;
 
+// System V IPC
+pub const IPC_PRIVATE: ::key_t = 0;
+pub const IPC_CREAT: ::c_int = 0o1000;
+pub const IPC_EXCL: ::c_int = 0o2000;
+pub const IPC_NOWAIT: ::c_int = 0o4000;
+pub const IPC_RMID: ::c_int = 0;
+pub const IPC_SET: ::c_int = 1;
+pub const IPC_STAT: ::c_int = 2;
+pub const IPC_INFO: ::c_int = 3;
+pub const IPC_R : ::c_int = 0o400;
+pub const IPC_W : ::c_int = 0o200;
+pub const IPC_M : ::c_int = 0o10000;
+pub const MSG_NOERROR: ::c_int = 0o10000;
+pub const SHM_RDONLY: ::c_int = 0o10000;
+pub const SHM_RND: ::c_int = 0o20000;
+pub const SHM_R: ::c_int = 0o400;
+pub const SHM_W: ::c_int = 0o200;
+pub const SHM_LOCK: ::c_int = 11;
+pub const SHM_UNLOCK: ::c_int = 12;
+pub const SHM_STAT: ::c_int = 13;
+pub const SHM_INFO: ::c_int = 14;
+
 // The *_MAXID constants never should've been used outside of the
 // FreeBSD base system.  And with the exception of CTL_P1003_1B_MAXID,
 // they were all removed in svn r262489.  They remain here for backwards
@@ -478,6 +539,21 @@
     pub fn freelocale(loc: ::locale_t) -> ::c_int;
     pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t,
                   options: ::c_int) -> ::c_int;
+
+    pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
+    pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
+    pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void,
+        shmflg: ::c_int) -> *mut ::c_void;
+    pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
+    pub fn shmctl(shmid: ::c_int, cmd: ::c_int,
+        buf: *mut ::shmid_ds) -> ::c_int;
+    pub fn msgctl(msqid: ::c_int, cmd: ::c_int,
+        buf: *mut ::msqid_ds) -> ::c_int;
+    pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
+    pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
+        msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
+    pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
+        msgflg: ::c_int) -> ::c_int;
 }
 
 cfg_if! {