#
all test clean:
+ $(MAKE) -C ./lib $@
# $(MAKE) -C ./msgctl $@
# $(MAKE) -C ./msgget $@
# $(MAKE) -C ./msgrcv $@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
-SRCS = libipc.c
+SRCS = libipc.c rmobj.c parse_opts.c tst_res.c tst_sig.c tst_tmpdir.c
OBJS = $(SRCS:.c=.o)
LIBIPC = ../libipc.a
-CFLAGS += -I../../../../../include -Wall
+CFLAGS += -I../../../../../include -Wall -D_NETBSD_SOURCE=1
all: $(LIBIPC)
#include "ipcsem.h"
#include <pwd.h>
-#include <sys/timeb.h>
+#include <sys/time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
char curdira[PATH_MAX];
size_t size = sizeof(curdira);
key_t ipc_key;
- struct timeb time_info;
+ struct timeval tv;
if (NULL == (curdir = getcwd(curdira, size))) {
tst_brkm(TBROK, cleanup, "Can't get current directory "
* project identifier is a "random character" produced by
* generating a random number between 0 and 25 and then adding
* that to the ascii value of 'a'. The "seed" for the random
- * number is the millisecond value that is set in the timeb
- * structure after calling ftime().
+ * number is the microsecond value that is set in the timeval
+ * structure after calling gettimeofday().
*/
- (void)ftime(&time_info);
- srandom((unsigned int)time_info.millitm);
+ (void) gettimeofday(&tv, NULL);
+ srandom((unsigned int)tv.tv_usec);
if ((ipc_key = ftok(curdir, ascii_a + random()%26)) == -1) {
tst_brkm(TBROK, cleanup, "Can't get msgkey from ftok()");
for(i = 0; std_options[i].optstr; ++i) {
if (std_options[i].help)
- printf(std_options[i].help);
+ fputs(std_options[i].help, stdout);
}
}
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07
all: $(PROG)
-$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
-
-rmobj.o: ../lib/rmobj.c
- $(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
-
-tst_sig.o: ../lib/tst_sig.c
- $(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
-
-tst_tmpdir.o: ../lib/tst_tmpdir.c
- $(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
-
-parse_opts.o: ../lib/parse_opts.c
- $(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
-
-libipc.o: ../lib/libipc.c
- $(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)
TEST(semctl(sem_id_1, 0, IPC_STAT, un_arg));
if (TEST_RETURN != -1) {
-printf("result: %d\n", TEST_RETURN);
tst_resm(TFAIL, "call succeeded when error expected");
continue;
}
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = semget01 semget02 semget03 semget05 semget06
all: $(PROG)
-$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
-
-rmobj.o: ../lib/rmobj.c
- $(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
-
-tst_sig.o: ../lib/tst_sig.c
- $(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
-
-tst_tmpdir.o: ../lib/tst_tmpdir.c
- $(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
-
-parse_opts.o: ../lib/parse_opts.c
- $(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
-
-libipc.o: ../lib/libipc.c
- $(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)
int main(int ac, char **av)
{
- int lc,getmaxid; /* loop counter */
+ int lc,getmaxid=0; /* loop counter */
char *msg; /* message returned from parse_opts */
FILE *fp;
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = semop01 semop02 semop03 semop04 semop05
all: $(PROG)
-$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
-
-rmobj.o: ../lib/rmobj.c
- $(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
-
-tst_sig.o: ../lib/tst_sig.c
- $(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
-
-tst_tmpdir.o: ../lib/tst_tmpdir.c
- $(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
-
-parse_opts.o: ../lib/parse_opts.c
- $(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
-
-libipc.o: ../lib/libipc.c
- $(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmat01 shmat02 shmat03
all: $(PROG)
-$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
-
-rmobj.o: ../lib/rmobj.c
- $(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
-
-tst_sig.o: ../lib/tst_sig.c
- $(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
-
-tst_tmpdir.o: ../lib/tst_tmpdir.c
- $(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
-
-parse_opts.o: ../lib/parse_opts.c
- $(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
-
-libipc.o: ../lib/libipc.c
- $(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)
addr = shmat(*(TC[i].shmid), (void *)(TC[i].addr),
TC[i].flags);
TEST_ERRNO = errno;
-
+
if (addr == (void *)-1) {
tst_brkm(TFAIL, cleanup, "%s call failed - "
"errno = %d : %s", TCID, TEST_ERRNO,
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmctl01 shmctl02 shmctl03 shmctl04
all: $(PROG)
-$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
-
-rmobj.o: ../lib/rmobj.c
- $(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
-
-tst_sig.o: ../lib/tst_sig.c
- $(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
-
-tst_tmpdir.o: ../lib/tst_tmpdir.c
- $(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
-
-parse_opts.o: ../lib/parse_opts.c
- $(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
-
-libipc.o: ../lib/libipc.c
- $(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmdt01 shmdt02
all: $(PROG)
-$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
-
-rmobj.o: ../lib/rmobj.c
- $(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
-
-tst_sig.o: ../lib/tst_sig.c
- $(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
-
-tst_tmpdir.o: ../lib/tst_tmpdir.c
- $(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
-
-parse_opts.o: ../lib/parse_opts.c
- $(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
-
-libipc.o: ../lib/libipc.c
- $(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmget01 shmget02 shmget04 shmget05
all: $(PROG)
-$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
-
-rmobj.o: ../lib/rmobj.c
- $(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
-
-tst_sig.o: ../lib/tst_sig.c
- $(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
-
-tst_tmpdir.o: ../lib/tst_tmpdir.c
- $(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
-
-parse_opts.o: ../lib/parse_opts.c
- $(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
-
-libipc.o: ../lib/libipc.c
- $(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)
# Makefile for the tests
CC = exec cc
-CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
+CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmt02 shmt03 shmt04 shmt05 shmt06 \
shmt07 shmt08 shmt10 shmt01
all: $(PROG)
-$(PROG): tst_res.o
- $(CC) $(CFLAGS) -o $@ $@.c tst_res.o
-
-tst_res.o: ../lib/tst_res.c
- $(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
+$(PROG): ../libipc.a
+ $(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
test:
sh testshm.sh
/* are we doing with ia64 or arm_arch_4t arch */
-#if defined (__ia64__) || defined (__ARM_ARCH_4T__)
+#if defined (__ia64__) || defined (__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *)NULL, 0);
#else
cp = (char *) shmat(shmid, (void *)0x80000, 0);
/* are we doing with ia64 or arm_arch_4t arch */
-#if defined (__ia64__) || defined (__ARM_ARCH_4T__)
+#if defined (__ia64__) || defined (__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *)NULL, 0);
#else
cp = (char *) shmat(shmid, (void *)0x80000, 0);
key_t key;
-sigset_t sigset;
+sigset_t mysigset;
#define ADDR1 (void *)0x40000000
#define ADDR (void *)0x80000
signal(SIGUSR1, SIG_DFL);
- sigemptyset(&sigset);
- sigaddset(&sigset,SIGUSR1);
- sigprocmask(SIG_BLOCK,&sigset,NULL);
+ sigemptyset(&mysigset);
+ sigaddset(&mysigset,SIGUSR1);
+ sigprocmask(SIG_BLOCK,&mysigset,NULL);
pid = fork();
switch (pid) {
else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR1, 0);
-#elif defined(__ARM_ARCH_4T__)
+#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);
chld_pid ;
char *cp;
-sigemptyset(&sigset);
-sigsuspend(&sigset);
+sigemptyset(&mysigset);
+sigsuspend(&mysigset);
chld_pid = getpid() ;
/*--------------------------------------------------------*/
{
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR1, 0);
-#elif defined(__ARM_ARCH_4T__)
+#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);
} else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR_IA, 0);
-#elif defined(__ARM_ARCH_4T__)
+#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *)NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);
/**************/
key_t key;
-sigset_t sigset;
+sigset_t mysigset;
int child(void);
int rm_shm(int);
signal(SIGUSR1, SIG_DFL);
- sigemptyset(&sigset);
- sigaddset(&sigset,SIGUSR1);
- sigprocmask(SIG_BLOCK,&sigset,NULL);
+ sigemptyset(&mysigset);
+ sigaddset(&mysigset,SIGUSR1);
+ sigprocmask(SIG_BLOCK,&mysigset,NULL);
pid = fork();
switch (pid) {
else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR_IA, 0);
-#elif defined(__ARM_ARCH_4T__)
+#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void*) NULL, 0);
#elif defined(__mips__)
cp = (char *) shmat(shmid, ADDR_MIPS, 0);
chld_pid ;
char *cp;
- sigemptyset(&sigset);
- sigsuspend(&sigset);
+ sigemptyset(&mysigset);
+ sigsuspend(&mysigset);
chld_pid = getpid() ;
if ((shmid = shmget(key, SIZE, 0)) < 0) {
else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR1_IA, 0);
-#elif defined(__ARM_ARCH_4T__)
+#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *) NULL, 0);
#elif defined(__mips__)
cp = (char *) shmat(shmid, ADDR1_MIPS, 0);
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR_IA, 0);
-#elif defined(__ARM_ARCH_4T__)
+#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *) NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);