Is it possible to make system calls on iOS?

2019-05-31 13:55发布

Is it possible to make a system call, such as executing ls -la, and use the result in your app?

2条回答
祖国的老花朵
2楼-- · 2019-05-31 14:43

Usually when someone says system call they mean calling into the kernel through one of the defined entry points. While its technically possible on iPhone, you are always better of going through the libSystem shims because the call interface is probably not stable (it isn't on Mac OS X for instance). I doubt Apple would like it if you did that, but I suspect no one as really thought about it much and they are unlikely to notice.

I don't think that is what you mean though. I think you want to use ISO/IEC 9899:1990 (C90) C libraray function "system". The answer to that is no, you can't.

查看更多
一夜七次
3楼-- · 2019-05-31 14:44

Sadly syscall.h under iOS is a private api. While you can use it in private applications Apple will not allow you to use the syscall() API for App Store submissions unfortunately.

查看更多
登录 后发表回答