Date: Fri, 18 Sep 2015 23:44:37 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 201611] [patch] Add devfs_get_cdevpriv_from_file(9) Message-ID: <bug-201611-8-6RHXbwsxsd@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-201611-8@https.bugs.freebsd.org/bugzilla/> References: <bug-201611-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201611 --- Comment #5 from John Baldwin <jhb@FreeBSD.org> --- Would you be open to creating new fd's to describe the resources themselves instead? That is, if you had a fd directly for the buffer you want to share, you could share the buffer by passing the fd for the buffer rather than having to proxy it via ioctls. It seems that you are already sort-of doing this, but you are overloading fda so you can use an ioctl to "bind" a buffer to it and then send it across. What if instead you had something like: process A: fda_dev = open("/dev/nvidiactl"); params.handleForResource = resource; ioctl(fda_dev, opcode, ¶ms); /* ioctl creates new fd in params.fd for the resource */ SendFdToProcessB(params.fd); close(params.fd); process B: fdb = RecvFdFromProcessA(); mmap(..., fdb); This is assuming you want to pass memory buffers around without copying. Note that if all you want is a new file descriptor type that can be mmap'd and references an existing VM object (such as the OBJT_SG objects the nvidia driver already creates internally) then such a file descriptor is probably fairly simple to write (especially in HEAD with the fo_mmap hook in fileops). shm_open() would serve as a good reference, though we could also help with implementing an API for you to just takes an existing VM object and allocates a new fd for the current process that only permits mmap but nothing else. -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-201611-8-6RHXbwsxsd>