• 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: Using ctl_enqueuembuf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using ctl_enqueuembuf


  • Subject: Re: Using ctl_enqueuembuf
  • From: Justin Walker <email@hidden>
  • Date: Tue, 19 Apr 2005 21:15:15 -0700


On Apr 19, 2005, at 11:26, Carl Smith wrote:

Ok thinking....

Always a good sign :-}

I am coping the sizeof the structure. Now only because I was looking at
the TCPlogger example, which passed a rather large structure 'struct
TCPLogEntry', in which it had sub structures and in turn had buffers
with log data, that I thought the mbuf code took care of the structure
and everything in it.

Keep in mind that mbufs are kernel structures that describe data buffers. There's no magic in them, and the semantics that you apply to their content is a complete mystery to the support routines that deal with the mbufs. In particular, if you have a buffer pointer pointing off into the great beyond, ctl_enqueuembuf won't be aware of it.


But the total data, would be the sizeof the struct plus the sizeof buf1.

That's what you want to transfer to user mode, but to the kernel code looking at the mbuf, the total data is the size of the structure.


I guess I am not clear on how to get buf1 up to userland using
ctl_enqueuembuf.

Do I need to make two calls to ctl_enqueuembuf, with the struct then the
buf1? Of is there a way to get both buffers into my mbuf?

buf1 points to a malloc'd structure, so you can't treat that as an mbuf. Also, don't forget to free that buffer when you are done with it. See below.


Then if I have to make two calls to ctl_enqueuembuf, in the kernel side,
I am not certain how 'catch' it in user land?

I would take an alternate approach. For a start, review the man page for recv(), and the Wright/Stevens book for background. There may be something in there that strikes a chord with you.


In short, you will have to turn all your data containers into mbufs if you want to use mbuf-handling routines to deal with them.

Regards,

Justin

--
Justin C. Walker, Curmudgeon-at-Large
/~\ The ASCII
\ / Ribbon Campaign
 X  Help Cure HTML Email
/ \

_______________________________________________
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: 
 >RE: Using ctl_enqueuembuf (From: "Carl Smith" <email@hidden>)

  • Prev by Date: RE: Using ctl_enqueuembuf
  • Next by Date: RE: Using ctl_enqueuembuf
  • Previous by thread: RE: Using ctl_enqueuembuf
  • Next by thread: RE: Using ctl_enqueuembuf
  • Index(es):
    • Date
    • Thread