sysctl

Does Apple allow the usage of sysctl.h within iOS applications?

泄露秘密 提交于 2019-12-11 03:13:08
问题 Does Apple allow the usage of sysctl.h within iOS applications? PS: App Scanner, a third party tool that checks code for possible private-API usage seems to think it's okay. Note: There is one more question like this : How can I know if I'm using private frameworks? 回答1: With the usual disclaimer that nobody can tell you what a reviewer will do, I can say for sure that there are apps in the store that use sysctl functions. (Minor point: Simply including a header isn't a problem since symbols

How to get maximum TCP Receive/Send window in MAC OS X?

て烟熏妆下的殇ゞ 提交于 2019-12-06 04:06:11
问题 How to get maximum TCP Receive/Send window in MAC OS X? There are two ctl in Linux. /proc/sys/net/core/rmem_max - Maximum TCP Receive Window (NET_CORE_RMEM_MAX) /proc/sys/net/core/wmem_max - Maximum TCP Send Window (NET_CORE_WMEM_MAX) but i couldn't find how to get these parameters in mac os. Does anybody know? I have found the following ctls in MAC OS X: net.inet.tcp.recvspace, net.inet.tcp.sendspace, kern.ipc.maxsockbuf It seems that recvspace+sendspace can't be greater than maxsockbuf. I

How to get maximum TCP Receive/Send window in MAC OS X?

一曲冷凌霜 提交于 2019-12-04 10:03:29
How to get maximum TCP Receive/Send window in MAC OS X? There are two ctl in Linux. /proc/sys/net/core/rmem_max - Maximum TCP Receive Window (NET_CORE_RMEM_MAX) /proc/sys/net/core/wmem_max - Maximum TCP Send Window (NET_CORE_WMEM_MAX) but i couldn't find how to get these parameters in mac os. Does anybody know? I have found the following ctls in MAC OS X: net.inet.tcp.recvspace, net.inet.tcp.sendspace, kern.ipc.maxsockbuf It seems that recvspace+sendspace can't be greater than maxsockbuf. I have read about it here: http://www.macgeekery.com/tips/configuration/mac_os_x_network_tuning_guide

Calling “sysctlbyname(…)” with “hw.machine” flag in iOS9

主宰稳场 提交于 2019-12-03 16:00:14
Following WWDC 2015 session "703 Privacy and Your App", there is changes using sysctl . And now there we will no longer be able to call kern.proc , kern.procargs , kern.procargs2 and see data from any other processes then one's self. It's a quite legit privacy hardening by Apple. Can anyone confirm that calling sysctlbyname(...) with hw.machine to fetch exact device name is allowed in iOS9 and not affected by restriction mentioned above? Yes ,I have tested it Using Xcode7 beta5 in iPhone5(iOS9 beta5 installed,not simulator). +(NSString *) getDeviceModel { size_t size; sysctlbyname("hw.machine"

Why is sysctl producing E_INVAL on Mac OS X?

痴心易碎 提交于 2019-12-02 10:07:46
Below is a pared-down (error/null checks omitted) snippet of C/Obj-C code that uses sysctl to get the argv of a particular process with PID 50. ... int getProcessArgs[3] = { CTL_KERN, KERN_PROCARGS, 50 }; sysctl(getProcessArgs, 3, NULL, &length, NULL, 0); char* processArgs = malloc(length * sizeof(char)); sysctl(getProcessArgs, 3, processArgs, &length, NULL, 0); ... The first call to sysctl (to determine the size of the argv string array) succeeds. The returned length is ~1600, larger than I would expect, but I suppose not unreasonable. Malloc succeeds. The second call to sysctl returns -1,

Can I use `sysctl` to retrieve a process list with the user?

风格不统一 提交于 2019-11-30 13:21:41
问题 I am in need of a way to retrieve all running processes for all users on a Mac (using Cocoa). I found an implementation to retrieve the process using sysctl, but I also need the running user. This is a snipping of what I've got to get the process list, but is there a way to modify it to include the user as well? int err; kinfo_proc * result; bool done; static const int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 }; size_t length; // a valid pointer procList holder should be passed assert

Monitoring network usage excluding local traffic

时光毁灭记忆、已成空白 提交于 2019-11-30 05:11:09
I am working on an app that monitors network usage. However I noticed many ways to do this does not allow exclusion of local traffic (say, Time Machine). I am looking for a way to exclude local traffic, and only monitors usage that goes directly to/from the internet. Update : Thank you for your replies, now I know how to find if the traffic is local, but I still don't know how I can calculate total in/out bytes (sorry if I didn't elaborate earlier). I have no way of knowing how many bytes are sent/received locally (or to the internet) in a certain period of time, or since the OS starts. This

Monitoring network usage excluding local traffic

百般思念 提交于 2019-11-29 02:56:10
问题 I am working on an app that monitors network usage. However I noticed many ways to do this does not allow exclusion of local traffic (say, Time Machine). I am looking for a way to exclude local traffic, and only monitors usage that goes directly to/from the internet. Update : Thank you for your replies, now I know how to find if the traffic is local, but I still don't know how I can calculate total in/out bytes (sorry if I didn't elaborate earlier). I have no way of knowing how many bytes are

Detect which app is currently running on iOS using sysctl

时光总嘲笑我的痴心妄想 提交于 2019-11-28 05:32:07
I have currently implemented a simple activity monitor to watch all running processes on iOS. To retrieve a list of all running processes, I do this: size_t size; struct kinfo_proc *procs = NULL; int status; NSMutableArray *killedProcesses = [[NSMutableArray alloc] init]; int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 }; status = sysctl(mib, 4, NULL, &size, NULL, 0); procs = malloc(size); status = sysctl(mib, 4, procs, &size, NULL, 0); // now, we have a nice list of processes And if I want more information about a specific process, I'll do: struct kinfo_proc *proc; int mib[5] = { CTL

Refresh net.core.somaxcomm (or any sysctl property) for docker containers

大憨熊 提交于 2019-11-28 05:02:34
I am trying to change net.core.somaxconn for docker container to be able to have larger queue of requests for my web application. On OS, outside docker, I first modify the property successfully: $ cat /proc/sys/net/core/somaxconn 128 $ sudo sysctl -w net.core.somaxconn=1024 net.core.somaxconn = 1024 $ cat /proc/sys/net/core/somaxconn 1024 But then I don't know how to propagate that change into docker. I've tried: Also editing /etc/sysctl.conf (in hope of docker reading that file on container launch) Restarting containers sudo docker stop and sudo docker run again Restarting the whole docker