Author: brooks
Date: Mon Feb  5 18:48:00 2018
New Revision: 328896
URL: https://svnweb.freebsd.org/changeset/base/328896

Log:
  Fix and enable SysV IPC tests.
  
  Don't declare some types that FreeBSD incorrectly declares.
  
  Fix an incorrect call to open() (missing mode).
  
  ANSIfy prototypes.
  
  Enable SysV message queue, semaphore, and shared memory tests.
  
  With exception of the workaround for union semun, these fixes have been
  committed to NetBSD.
  
  Reviewed by:  asomers
  Approved by:  CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:        https://reviews.freebsd.org/D13471

Modified:
  head/contrib/netbsd-tests/kernel/t_sysv.c
  head/tests/sys/kern/Makefile

Modified: head/contrib/netbsd-tests/kernel/t_sysv.c
==============================================================================
--- head/contrib/netbsd-tests/kernel/t_sysv.c   Mon Feb  5 18:45:21 2018        
(r328895)
+++ head/contrib/netbsd-tests/kernel/t_sysv.c   Mon Feb  5 18:48:00 2018        
(r328896)
@@ -72,7 +72,7 @@ void  sharer(void);
 
 #define        MESSAGE_TEXT_LEN        256
 
-struct mymsg {
+struct testmsg {
        long    mtype;
        char    mtext[MESSAGE_TEXT_LEN];
 };
@@ -94,11 +94,13 @@ key_t       msgkey, semkey, shmkey;
 
 int    maxloop = 1;
 
+#ifndef __FreeBSD__
 union semun {
        int     val;            /* value for SETVAL */
        struct  semid_ds *buf;  /* buffer for IPC_{STAT,SET} */
        u_short *array;         /* array for GETALL & SETALL */
 };
+#endif
 
 
 /* Writes an integer to a file.  To be used from the body of the test
@@ -174,7 +176,7 @@ key_t get_ftok(int id)
 
        /* Create the file, since ftok() requires it to exist! */
 
-       fd = open(token_key, O_RDWR | O_CREAT | O_EXCL);
+       fd = open(token_key, O_RDWR | O_CREAT | O_EXCL, 0600);
        if (fd == -1) {
                rmdir(tmpdir);
                atf_tc_fail("open() of temp file failed: %d", errno);
@@ -202,7 +204,7 @@ ATF_TC_BODY(msg, tc)
 {
        struct sigaction sa;
        struct msqid_ds m_ds;
-       struct mymsg m;
+       struct testmsg m;
        sigset_t sigmask;
        int sender_msqid;
        int loop;
@@ -347,9 +349,7 @@ ATF_TC_CLEANUP(msg, tc)
 }
 
 void
-print_msqid_ds(mp, mode)
-       struct msqid_ds *mp;
-       mode_t mode;
+print_msqid_ds(struct msqid_ds *mp, mode_t mode)
 {
        uid_t uid = geteuid();
        gid_t gid = getegid();
@@ -381,9 +381,9 @@ print_msqid_ds(mp, mode)
 }
 
 void
-receiver()
+receiver(void)
 {
-       struct mymsg m;
+       struct testmsg m;
        int msqid, loop;
 
        if ((msqid = msgget(msgkey, 0)) == -1)
@@ -588,9 +588,7 @@ ATF_TC_CLEANUP(sem, tc)
 }
 
 void
-print_semid_ds(sp, mode)
-       struct semid_ds *sp;
-       mode_t mode;
+print_semid_ds(struct semid_ds *sp, mode_t mode)
 {
        uid_t uid = geteuid();
        gid_t gid = getegid();
@@ -620,7 +618,7 @@ print_semid_ds(sp, mode)
 }
 
 void
-waiter()
+waiter(void)
 {
        struct sembuf s;
        int semid;
@@ -789,9 +787,7 @@ ATF_TC_CLEANUP(shm, tc)
 }
 
 void
-print_shmid_ds(sp, mode)
-       struct shmid_ds *sp;
-       mode_t mode;
+print_shmid_ds(struct shmid_ds *sp, mode_t mode)
 {
        uid_t uid = geteuid();
        gid_t gid = getegid();
@@ -823,7 +819,7 @@ print_shmid_ds(sp, mode)
 }
 
 void
-sharer()
+sharer(void)
 {
        int shmid;
        void *shm_buf;

Modified: head/tests/sys/kern/Makefile
==============================================================================
--- head/tests/sys/kern/Makefile        Mon Feb  5 18:45:21 2018        
(r328895)
+++ head/tests/sys/kern/Makefile        Mon Feb  5 18:48:00 2018        
(r328896)
@@ -26,6 +26,7 @@ LIBADD.unix_seqpacket_test+=          pthread
 
 NETBSD_ATF_TESTS_C+=   lockf_test
 NETBSD_ATF_TESTS_C+=   mqueue_test
+NETBSD_ATF_TESTS_C+=   sysv_test
 
 CFLAGS.mqueue_test+=   -I${SRCTOP}/tests
 LIBADD.mqueue_test+=   rt
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to