简体   繁体   English

OSX中XNU内核的系统调用的清单和文档

[英]List of and documentation for system calls for XNU kernel in OSX

I'm trying to figure out how to get a list of and documentation for the system calls available in the XNU kernel in OSX. 我试图弄清楚如何获得OSX的XNU内核中可用的系统调用的列表和文档。 I've googled around quite a bit, but haven't been able to find anything of use. 我已经在Google上搜索了很多,但是没有找到任何有用的东西。 As I understand the calling conventions match BSD, is that correct? 据我了解,调用约定与BSD匹配,对吗?

Thanks 谢谢

The "official" list is at Darwin page at Apple. “官方”列表在Apple的Darwin页面上。 Specifically, see the file syscalls.master in the XNU distribution. 具体来说,请参见XNU发行版中的文件syscalls.master (If something you expect is missing, try a newer XNU version.) (如果您缺少期望的内容,请尝试使用较新的XNU版本。)

The BSD part of the system calls comes from BSD, but there're mach calls which follow quite different conventions. 系统调用的BSD部分来自BSD,但是有些mach调用遵循完全不同的约定。

You'll definitely want to read Amit Singh's OS X kernel book, see the book's website . 您肯定要阅读Amit Singh的OS X内核书,请参阅该书的网站 It's rewritten for 10.4 and mainly for PPC, but still is the greatest detailed info you can get on the kernel. 它是为10.4重写的,主要是针对PPC的,但是仍然是您可以在内核上获得的最详细的信息。

XNU's system calls are, indeed, following the BSD/POSIX model, but are a subset: There are quite a few additional calls proprietary to Apple - for example, stack_snapshot (#365), iopolicy (322), proc_info(336) and others. XNU的系统调用确实遵循BSD / POSIX模型,但它是一个子集:苹果专有的许多其他调用-例如stack_snapshot(#365),iopolicy(322),proc_info(336)等。 Apple keeps those undocumented, but you can find their source in XNU. Apple保留了这些文档,但您可以在XNU中找到它们的来源。 You can call undocumented system calls explicitly (by using the sys call macro and specifying the call # as first argument), but some (eg proc_info) are wrapped by Darwin libraries (eg libproc, which is part of libSystem) 您可以显式地调用未记录的系统调用(通过使用sys call宏,并将call#指定为第一个参数),但是某些文件(例如proc_info)由Darwin库包装(例如libproc,它是libSystem的一部分)

syscalls.master generates the /usr/include/sys/syscall.h file, which will also give you the system call names (but not the prototypes). syscalls.master生成/usr/include/sys/syscall.h文件,该文件还将为您提供系统调用名称(而不是原型)。 Singh's book describes some sys calls, but is vastly outdated, since Tiger had fewer than the 439 (in iOS6: 443) calls XNU has today. Singh的书描述了一些sys调用,但是已经过时了,因为Tiger的调用少于今天XNU的439(在iOS6:443中)调用。 A more recent book can be found in http://www.amazon.com/Mac-OS-iOS-Internals-Apples/dp/1118057651 , and its appendix actually documents all system calls (and Mach Traps), in detail. 可以在http://www.amazon.com/Mac-OS-iOS-Internals-Apples/dp/1118057651中找到一本更新的书,其附录实际上详细记录了所有系统调用(和Mach陷阱)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM