kernel - CAM cleanup 1/N - Remove ancient scsi pccard drivers ncv, nsp, stg
[dragonfly.git] / test / sysmsg / sysmsg1.c
blobb7bfd91ec3da12638fe79e2f7d8300c01200ca89
1 /*
2 * sysmsg1.c
3 *
4 * $DragonFly: src/test/sysmsg/sysmsg1.c,v 1.3 2004/09/02 11:21:12 eirikn Exp $
5 */
7 #include <time.h>
9 #include "syscall.h"
11 __attribute__((weak))
13 int
14 write_test(int fd, void * buf, size_t nbyte)
16 struct write_args writemsg;
17 int error;
19 INITMSGSYSCALL(write, 0);
20 writemsg.fd = fd;
21 writemsg.buf = buf;
22 writemsg.nbyte = nbyte;
23 DOMSGSYSCALL(write);
24 printf("write: error: %d\n", error);
25 printf("write: ms_error: %d\n", writemsg.usrmsg.umsg.ms_error);
26 printf("write: ms_result: %d\n", writemsg.usrmsg.umsg.u.ms_result);
27 FINISHMSGSYSCALL(write, error);
30 int
31 nanosleep_test(const struct timespec * rqtp, struct timespec * rmtp)
33 struct nanosleep_args nanosleepmsg;
34 int error;
36 INITMSGSYSCALL(nanosleep, 0);
37 nanosleepmsg.rqtp = rqtp;
38 nanosleepmsg.rmtp = rmtp;
39 DOMSGSYSCALL(nanosleep);
40 printf("nanosleep: error: %d\n", error);
41 printf("nanosleep: ms_error: %d\n", nanosleepmsg.usrmsg.umsg.ms_error);
42 printf("nanosleep: ms_result: %d\n", nanosleepmsg.usrmsg.umsg.u.ms_result);
43 FINISHMSGSYSCALL(nanosleep, error);
46 int
47 main(void)
49 struct timespec ts, ts2;
50 int error;
52 printf("synchronous sendsys() test: write 'hello!' and 1.5 second nanosleep\n");
53 error = write_test(1, "hello!\n", 7);
54 if (error == -1)
55 err(1, "write");
56 ts.tv_sec = 1;
57 ts.tv_nsec = 500 * 1000000;
58 error = nanosleep_test(&ts, &ts2);
59 if (error == -1)
60 err(1, "nanosleep");