On Tue, 20 Feb 2001, Norbert Roos wrote:
> Jeff Garzik wrote:
>
> > > But the buffers are usually allocated with malloc() by any application
> > > which wants to use my driver.. otherwise my driver would have to offer a
> > > malloc-like function, but I can hardly force the application to use my
> > > own malloc function.
> >
> > If you are writing the driver, sure you can.
>
> ??
>
> The application is doing something like
>
> fd = open("/dev/mydriver");
> buf = malloc();
> fill_buffer_with_data(buf);
> write(fd,buf);
>
> And now i should tell the programmer not to use malloc() but my special
> driver-malloc?
> Or do you mean something different?
fd = open(...);
buf = mmap(fd, ...);
fill_buffer_with_data(buf);
ioctl(fd, ...); /* tell kernel data is there */
There are variations depending on the application, but you get the
picture. A buffer copy is eliminated when mmap is used, too, making
your application faster.
Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Follow-Ups:
- Re: Probs with PCI bus master DMA to user spaceNorbert Roos <n.roos _at_ berlin.de>
- Re: Probs with PCI bus master DMA to user spaceNorbert Roos <n.roos _at_ berlin.de>
- Prev by Date: Re: kernel problems
- Next by Date: Linux 2.2.19pre14
- Prev by thread: Re: Probs with PCI bus master DMA to user space
- Next by thread: Re: Probs with PCI bus master DMA to user space
- Indexes:[Main][Thread]