• 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: Where is kinfo_proc defined?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is kinfo_proc defined?


  • Subject: Re: Where is kinfo_proc defined?
  • From: Chris Espinosa <email@hidden>
  • Date: Fri, 28 Mar 2008 19:00:51 -0700


On Mar 28, 2008, at 6:00 PM, Sherm Pendley wrote:
On Fri, Mar 28, 2008 at 8:21 PM, Rick Mann <email@hidden> wrote:

On Mar 28, 2008, at 5:12 PM, Sherm Pendley wrote:
> sys/sysctl.h
>
> Searching in the help turns up nothing. Command-double-click turns
> up nothing.
>
> Use the terminal, Luke! :-)
>
>     find /usr/include -name '*.h' -print0 | xargs -0 grep kinfo_proc

Thanks. I'll keep that around. But really, Xcode should handle this.

You're right - it should.
 
How do I know it's in /usr and not in /System/Library?

You don't. If you knew where it was, you wouldn't have asked. :-)
 
Am I supposed
to check in multiple places each time (which is very often) Xcode
doesn't find something?

If you find (lol) yourself needing to do this often, you could do what any good *nix user would do: write a script. :-)

    #!/bin/sh

    for name in $@ ; do
        find /usr/include -name '*.h' -print0 | xargs -0 grep $name
        find /System/Library -name '*.h' -print0 | xargs -0 grep $name
        find /Library -name '*.h' -print0 | xargs -0 grep $name
    done

Save that as "find-def", then just "find-def kinfo_proc" whenever you need it. Someone with sufficient AppleScript-fu (which I lack, sorry) could probably hook this into Xcode's script menu, so that it finds the currently selected text instead of the command-line arguments.

Yes, it's klunky, and no, you're not "supposed" to have to do this. It's a workaround - klunky goes with the territory.

Which is exactly why we index SDKs and system headers with a source-code-aware Spotlight indexer.  Spotlight finds that symbol in less than a second without a trip to Terminal.  You shouldn't have to do what "any good *NIX user does" when you have a Mac :-)

As to why the Documentation Viewer (and Spotlight, and even Google) doesn't provide a better direct answer, well, kinfo_proc is somewhat obscure, and there aren't actually any C functions that are defined to take a kinfo_proc as an input parameter or return it as a result.  (sysctl takes a void * in the position that you would supply a pointer to a kinfo_proc structure).  The only real documentation that exists for it at all, on any OS, is in the sysctl(3) man page, and that's one mention in source code, barely more than there is in that tech note.

So please file a Radar bug that low-level kernel APIs need better API documentation, and avail yourself of Spotlight to search for things if you don't know where they might be: that's exactly what it's there for.

Chris
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Where is kinfo_proc defined?
      • From: Rick Mann <email@hidden>
References: 
 >Where is kinfo_proc defined? (From: Rick Mann <email@hidden>)
 >Re: Where is kinfo_proc defined? (From: "Sherm Pendley" <email@hidden>)
 >Re: Where is kinfo_proc defined? (From: Rick Mann <email@hidden>)
 >Re: Where is kinfo_proc defined? (From: "Sherm Pendley" <email@hidden>)

  • Prev by Date: Re: Building kext for 10.3.9 and/or 10.4 with Xcode 3 on Leopard
  • Next by Date: Re: Where is kinfo_proc defined?
  • Previous by thread: Re: Where is kinfo_proc defined?
  • Next by thread: Re: Where is kinfo_proc defined?
  • Index(es):
    • Date
    • Thread