I_STR cannot pass large buffers .. this is a limitation in the streams
architecture.  To pass large data, you have to use M_COPYIN, or
M_COPYOUT, which is a major pain (unless you can pass via read/write
with M_DATA).

In general, unless you're constrained to STREAMS by other factors, you
may be better off considering a different approach. 

        - Garrett

On Wed, 2011-05-04 at 13:34 -0700, raghu wrote:
> Hi,
> 
> I was trying to gather large info from my driver  thru I_STR ioctl. But it 
> seems it is failing in some cases with large bufs like 12K, stack shown 
> below. Please correct me If I need to do anything more in user app or driver:
> User App::::::::::
> #define BUF_SIZE2 12*1024
> char buf2[BUF_SIZE];
>        fd = open(string, O_RDWR));
>         stri.ic_cmd = 3;
>         stri.ic_timout = 0;
>         bzero(buf2, BUF_SIZE2);
>         stri.ic_len = BUF_SIZE2;
>         stri.ic_dp = (char *)buf2;
>         if (ioctl(fd, I_STR, &stri) 
> 
> 
> Driver IOCTL :::::::::::::::::::
> 
> iocp = (struct iocblk *)(uintptr_t)mp->b_rptr;
> cmd = iocp->ioc_cmd;
> 
> 
> If (cmd == MINE) {
>                 ptr = (void *) mp->b_cont->b_rptr;
>                 (void) bcopy(driver->ptr, ptr, 12*1024);
> mp->b_cont->b_wptr = mp->b_cont->b_rptr + 12*1024;
>                 miocack(q, mp, 12*1024, 0);
>                 return;
> }
> 
> 
> Stack:
> strdoioctl+0x7a7()
> strioctl+0x15cc()
> spec_ioctl+0x67()
> fop_ioctl+0x25()
> ioctl+0xac()
> sys_syscall+0x17b()
> 
> Regards
> Raghu


_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to