mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-09-29 21:49:07 +00:00
Conky for mac os master (#532)
* Documentation fixes for macOS This commit fixes documentation of a macOS specific variable (sip_status) as promised in #480. Also, fix some identation problems in darwin.cc * Amend #18 by polling less often! This will help lower CPU usage, too!
This commit is contained in:
parent
bf10130cae
commit
10621e61b1
@ -3780,30 +3780,37 @@
|
|||||||
</term>
|
</term>
|
||||||
<listitem>Prints info regarding System Integrity Protection (SIP) on macOS.
|
<listitem>Prints info regarding System Integrity Protection (SIP) on macOS.
|
||||||
|
|
||||||
Specifically, prints SIP status (enabled / disabled) if no switch is
|
If no switch is provided, prints SIP status (enabled / disabled), else,
|
||||||
provided OR status of specific SIP feature if a switch is provided.
|
status of the specific SIP feature corresponding to the switch provided.
|
||||||
Below are the allowed switches: (each switch is a char)
|
|
||||||
SWITCH-----------------------RESULT-------------------------------
|
Below are shown the available switches:
|
||||||
0 allows apple-internal? YES/NO
|
|
||||||
1 allows untrusted-kexts? YES/NO
|
SWITCH--------------------------RESULT--------------------------STATUS
|
||||||
2 allows task-for-pid? YES/NO
|
0 apple internal YES/NO
|
||||||
3 allows unrestricted-fs? YES/NO
|
1 forbid untrusted kexts YES/NO
|
||||||
4 allows kernel-debugger? YES/NO
|
2 forbid task-for-pid YES/NO
|
||||||
5 allows unrestricted-dtrace? YES/NO
|
3 restrict filesystem YES/NO
|
||||||
6 allows unrestricted-nvram? YES/NO
|
4 forbid kernel-debugger YES/NO
|
||||||
7 allows device-configuration? YES/NO
|
5 restrict dtrace YES/NO
|
||||||
8 allows any-recovery-os? YES/NO
|
6 restrict nvram YES/NO
|
||||||
9 allows user-approved-kexts? YES/NO
|
7 forbid device-configuration YES/NO
|
||||||
a uses unsupported configuration?
|
8 forbid any-recovery-os YES/NO
|
||||||
If yes, prints "unsupported configuration, beware!"
|
9 forbid user-approved-kexts YES/NO
|
||||||
|
a uses unsupported configuration? (*)
|
||||||
|
|
||||||
|
(*): If yes, prints "unsupported configuration, beware!"
|
||||||
Else, prints "configuration is ok".
|
Else, prints "configuration is ok".
|
||||||
------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
EXAMPLE:
|
|
||||||
|
USAGE:
|
||||||
conky -t '${sip_status}' # print SIP status
|
conky -t '${sip_status}' # print SIP status
|
||||||
conky -t '${sip_status 0}' # print allows apple-internal? Yes or No?
|
conky -t '${sip_status 0}' # print allows apple-internal? Yes or No?
|
||||||
|
|
||||||
NOTES: exists only for macOS version of conky and works on any macOS
|
NOTES:
|
||||||
version (even the ones prior El Capitan where SIP was first introduced).
|
* Available for all macOS versions (even the ones prior El Capitan
|
||||||
|
where SIP was first introduced)
|
||||||
|
* If run on versions prior El Capitan SIP is unavailable, so all
|
||||||
|
you will get is "unsupported"
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -766,6 +766,7 @@ int update_running_threads() {
|
|||||||
|
|
||||||
int update_total_processes() {
|
int update_total_processes() {
|
||||||
helper_update_threads_processes();
|
helper_update_threads_processes();
|
||||||
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WARNING: You may stumble upon this implementation:
|
* WARNING: You may stumble upon this implementation:
|
||||||
@ -1057,7 +1058,6 @@ static void calc_cpu_usage_for_proc(struct process *proc, uint64_t total) {
|
|||||||
*/
|
*/
|
||||||
static void calc_cpu_total(struct process *proc, uint64_t *total) {
|
static void calc_cpu_total(struct process *proc, uint64_t *total) {
|
||||||
uint64_t current_total = 0; /* of current iteration */
|
uint64_t current_total = 0; /* of current iteration */
|
||||||
// uint64_t total = 0; /* delta */
|
|
||||||
struct cpusample sample {};
|
struct cpusample sample {};
|
||||||
|
|
||||||
get_cpu_sample(&sample);
|
get_cpu_sample(&sample);
|
||||||
@ -1161,7 +1161,7 @@ static void get_top_info_for_kinfo_proc(struct kinfo_proc *p) {
|
|||||||
/*
|
/*
|
||||||
* wait until done
|
* wait until done
|
||||||
*/
|
*/
|
||||||
while (!(calc_cpu_total_finished && calc_proc_total_finished)) { ; }
|
while (!(calc_cpu_total_finished && calc_proc_total_finished)) { usleep(500); }
|
||||||
|
|
||||||
/* calc the amount(%) of CPU the process used */
|
/* calc the amount(%) of CPU the process used */
|
||||||
calc_cpu_usage_for_proc(proc, t);
|
calc_cpu_usage_for_proc(proc, t);
|
||||||
@ -1278,23 +1278,22 @@ int get_sip_status() {
|
|||||||
* Variables that can be passed to $sip_status command
|
* Variables that can be passed to $sip_status command
|
||||||
*
|
*
|
||||||
* nothing --> print enabled / disabled
|
* nothing --> print enabled / disabled
|
||||||
* 0 --> allow_apple_internal
|
* 0 --> apple internal
|
||||||
* 1 --> allow_untrusted_kexts
|
* 1 --> forbid untrusted kexts
|
||||||
* 2 --> allow_task_for_pid
|
* 2 --> forbid task-for-pid
|
||||||
* 3 --> allow_unrestricted_fs
|
* 3 --> restrict filesystem
|
||||||
* 4 --> allow_kernel_debugger
|
* 4 --> forbid kernel-debugger
|
||||||
* 5 --> allow_unrestricted_dtrace
|
* 5 --> restrict dtrace
|
||||||
* 6 --> allow_unrestricted_nvram
|
* 6 --> restrict nvram
|
||||||
* 7 --> allow_device_configuration
|
* 7 --> forbid device-configuration
|
||||||
* 8 --> allow_any_recovery_os
|
* 8 --> forbid any-recovery-os
|
||||||
* 9 --> allow_user_approved_kexts
|
* 9 --> forbid user-approved-kexts
|
||||||
* a --> check if unsupported configuration ---> this is not an apple SIP
|
* a --> check if unsupported configuration ---> this is not an apple SIP
|
||||||
* flag. This is for us.
|
* flag. This is for us.
|
||||||
*
|
*
|
||||||
* The print function is designed to show 'YES' if a specific protection
|
* The print function is designed to show 'YES' if a specific protection
|
||||||
* measure is ENABLED. For example, if SIP is configured to disallow untrusted
|
* measure is ENABLED. For example, if SIP is configured to disallow untrusted
|
||||||
* kexts, then our function will print 'YES'. Thus, it doesnt print 'YES' in the
|
* kexts, then our function will print 'YES'.
|
||||||
* case SIP allows untrusted kexts.
|
|
||||||
*
|
*
|
||||||
* For this reason, your conkyrc should say for example: Untrusted Kexts
|
* For this reason, your conkyrc should say for example: Untrusted Kexts
|
||||||
* Protection: ${sip_status 1} You should not write: "Allow Untrusted Kexts",
|
* Protection: ${sip_status 1} You should not write: "Allow Untrusted Kexts",
|
||||||
|
Loading…
Reference in New Issue
Block a user