mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
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
This commit is contained in:
parent
e9a7bae553
commit
5e1e3ea237
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328896
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user