|
|
1 #include <stropts.h> 2 #include <xti.h> 3 #include <sys/nb/nb_ioctl.h>4 #define ASTAT_BUFSIZE 4096 5 #define SSTAT_BUFSIZE 4096
6 extern print_astatus(struct strioctl *); 7 extern print_sstatus(struct strioctl *);
8 demo_ioctl_user_function(int fd, char *name) 9 { 10 struct strioctl cmdbuf; 11 union { 12 struct astat adapter_status; 13 char name[NB_NAMELEN]; 14 } astat_buf; 15 struct sstat session_status;
16 cmdbuf.ic_cmd = NBIOCTL_ASTAT; 17 cmdbuf.ic_timout = 0; 18 cmdbuf.ic_dp = (char *)&astat_buf; 19 cmdbuf.ic_len = ASTAT_BUFSIZE;
20 memcpy(&astat_buf.name[0], name, NB_NAMELEN);
21 if (ioctl(fd, I_STR, &cmdbuf) < 0) { 22 perror("Error getting Adapter Status"); 23 exit(1); 24 } 25 print_astatus(&cmdbuf);
26 cmdbuf.ic_cmd = NBIOCTL_SSTAT; 27 cmdbuf.ic_timout = 0; 28 cmdbuf.ic_dp = (char *)&session_status; 29 cmdbuf.ic_len = SSTAT_BUFSIZE;
30 if (ioctl(fd, I_STR, &cmdbuf) < 0) { 31 perror("Error getting session status"); 32 exit(2); 33 } 34 print_sstatus(&cmdbuf); 35 }