Deleted Added
full compact
testcdev.c (41681) testcdev.c (48275)
1/* 08 Nov 1998*/
2/*
3 * testmisc.c
4 *
5 * Test program to call the sample loaded kld device driver.
6 *
7 * 05 Jun 93 Rajesh Vaidheeswarran Original
8 *

--- 60 unchanged lines hidden (view full) ---

69 *
70 */
71#include <stdio.h>
72#include <fcntl.h>
73#include <sys/ioccom.h>
74
75#define CDEV_IOCTL1 _IOR('C', 1, u_int)
76#define CDEV_DEVICE "cdev"
1/* 08 Nov 1998*/
2/*
3 * testmisc.c
4 *
5 * Test program to call the sample loaded kld device driver.
6 *
7 * 05 Jun 93 Rajesh Vaidheeswarran Original
8 *

--- 60 unchanged lines hidden (view full) ---

69 *
70 */
71#include <stdio.h>
72#include <fcntl.h>
73#include <sys/ioccom.h>
74
75#define CDEV_IOCTL1 _IOR('C', 1, u_int)
76#define CDEV_DEVICE "cdev"
77
77int
78int
78main()
79main(int argc, char *argv[])
79{
80 int kernel_fd;
81 int one;
82
83 if ((kernel_fd = open("/dev/" CDEV_DEVICE, O_RDONLY)) == -1) {
84 perror("/dev/" CDEV_DEVICE);
85 exit(1);
86 }
87
88 /* Send ioctl */
89 if (ioctl(kernel_fd, CDEV_IOCTL1, &one) == -1) {
90 perror("CDEV_IOCTL1");
91 } else {
92 printf( "Sent ioctl CDEV_IOCTL1 to device /dev/" CDEV_DEVICE "\n");
93 }
94 exit(0);
95}
80{
81 int kernel_fd;
82 int one;
83
84 if ((kernel_fd = open("/dev/" CDEV_DEVICE, O_RDONLY)) == -1) {
85 perror("/dev/" CDEV_DEVICE);
86 exit(1);
87 }
88
89 /* Send ioctl */
90 if (ioctl(kernel_fd, CDEV_IOCTL1, &one) == -1) {
91 perror("CDEV_IOCTL1");
92 } else {
93 printf( "Sent ioctl CDEV_IOCTL1 to device /dev/" CDEV_DEVICE "\n");
94 }
95 exit(0);
96}