• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Writing from the kernel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing from the kernel


  • Subject: Re: Writing from the kernel
  • From: Rick Macklem <email@hidden>
  • Date: Tue, 20 Nov 2007 12:07:57 -0500 (EST)



On Tue, 20 Nov 2007, Quinn wrote:

At 1:30 -0600 20/11/07, Kynan Shook wrote:
So, what is a good way to get the data out of the kernel? I'm looking for fast and simple here - it's only a project, and will only ever be used on my machine, so minimizing the time spent on implementation is the priority.

In that case I would just write it to a file (-:

[good stuff snipped]
OTOH, for a research project you should be able to make it work. You can get the vnode for a path using vnode_lookup. You can open it using vnode_open. And you can write to it using VNOP_WRITE. You don't even have to take a dependency on the kernel; these are all KPIs.

Although I haven't done it in Darwin since 10.3, I find vn_rdwr() pretty
handy for doing this. I find it's easier to open the file in userland and
pass the file descriptor into the kernel than do the open, etc. from
inside the kernel. You can easily get a vnode pointer from the file
desciptor. As Quinn said, xnu-792 (or maybe xnu-1226 now) sources are
the doc. grep on vn_rdwr() in xnu-792.x.y/bsd/kern should give you some
hints.

rick


_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Writing from the kernel (From: Kynan Shook <email@hidden>)
 >Re: Writing from the kernel (From: Quinn <email@hidden>)

  • Prev by Date: Re: Can not copy files >=4GB. Leopard (9B18)
  • Next by Date: MTRRs and PATs
  • Previous by thread: Re: Writing from the kernel
  • Next by thread: Re: Writing from the kernel
  • Index(es):
    • Date
    • Thread