site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Jun 15, 2006, at 6:12 AM, Andrew Gallatin wrote: Hi I am quite new to the Mac world...I am trying to write(using xcode on tiger) a simple character driver(openbsd.org example) and am facing few problems... During compile, struct uio is not recognized and I get a dereferencing pointer to incomplete type error...can somebody help...maybe I am not including the correct libraries... <....> MacOSX does not allow access to core kernel structures like uio on the theory that Apple may want to change them some day, and does not want to break binary drivers when the structure changes. <http://en.wikipedia.org/wiki/Accessor> Look in the second section, or seqrch in the page for "accessor". See also: amt = MIN(uio->uio_resid, (echomsg->len - uio->uio_offset > 0) ? For example, in the above code you want to use uio_resid(uio) and uio_offset(uio). Correct. -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... sugumaran narayanan writes: More than a theory; I've personally made kernel changes in this area for 64 bit support in the Tiger release that would break code that was using promiscuous knowledge of the structure contents, instead of using an accessor/mutator. The idea is to replace data interfaces with accessor/mutator functions to insulate the underlying implementation from necessary data structure changes. This is actually a fundamental Computer Science concept for object oriented programming. There's a good Wikipedia article on it at: This is generally called the "KPI". And it was announced as Apple's technical direction in this area at WWDC about 4 years ago, and first widely deployed as part of Tiger. <http://developer.apple.com/documentation/Darwin/Conceptual/KEXTConcept/KEXTC...
For a better explanation of the high level rationale behind introducing KPI. All of the accessor/mutator functions applicable to uio structures are fairly well documented in <sys/uio.h> itself. Most other KPI is documented in the header files that define the structures or types that the KPI operates against. If you are in doubt about something, you can look at the internal implementation details by downloading the Darwin sources for the kernel (xnu) from <http://www.opendarwin.org/
, and looking for the appropriate accessor/mutator functions to use there, or in our published driver sources, or by using the text search field at <http://developer.apple.com>. This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert