| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssh/src/openbsd-compat/port-linux.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | static int oom_adj_save = | - | ||||||||||||
| 7 | (-0x7fffffff - 1) | - | ||||||||||||
| 8 | ; | - | ||||||||||||
| 9 | static char *oom_adj_path = | - | ||||||||||||
| 10 | ((void *)0) | - | ||||||||||||
| 11 | ; | - | ||||||||||||
| 12 | struct { | - | ||||||||||||
| 13 | char *path; | - | ||||||||||||
| 14 | int value; | - | ||||||||||||
| 15 | } oom_adjust[] = { | - | ||||||||||||
| 16 | {"/proc/self/oom_score_adj", -1000}, | - | ||||||||||||
| 17 | {"/proc/self/oom_adj", -17}, | - | ||||||||||||
| 18 | { | - | ||||||||||||
| 19 | ((void *)0) | - | ||||||||||||
| 20 | , 0}, | - | ||||||||||||
| 21 | }; | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | void | - | ||||||||||||
| 28 | oom_adjust_setup(void) | - | ||||||||||||
| 29 | { | - | ||||||||||||
| 30 | int i, value; | - | ||||||||||||
| 31 | FILE *fp; | - | ||||||||||||
| 32 | - | |||||||||||||
| 33 | debug3("%s", __func__); | - | ||||||||||||
| 34 | for (i = 0; oom_adjust[i].path !=
| 0 | ||||||||||||
| 35 | ((void *)0)
| 0 | ||||||||||||
| 36 | ; i++) { | - | ||||||||||||
| 37 | oom_adj_path = oom_adjust[i].path; | - | ||||||||||||
| 38 | value = oom_adjust[i].value; | - | ||||||||||||
| 39 | if ((
| 0 | ||||||||||||
| 40 | ((void *)0)
| 0 | ||||||||||||
| 41 | ) { | - | ||||||||||||
| 42 | if (fscanf(fp, "%d", &oom_adj_save) != 1
| 0 | ||||||||||||
| 43 | verbose("error reading %s: %s", oom_adj_path, never executed: verbose("error reading %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 44 | strerror( never executed: verbose("error reading %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 45 | (*__errno_location ()) never executed: verbose("error reading %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 46 | )); never executed: verbose("error reading %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 47 | else { | - | ||||||||||||
| 48 | rewind(fp); | - | ||||||||||||
| 49 | if (fprintf(fp, "%d\n", value) <= 0
| 0 | ||||||||||||
| 50 | verbose("error writing %s: %s", never executed: verbose("error writing %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 51 | oom_adj_path, strerror( never executed: verbose("error writing %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 52 | (*__errno_location ()) never executed: verbose("error writing %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 53 | )); never executed: verbose("error writing %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 54 | else | - | ||||||||||||
| 55 | debug("Set %s from %d to %d", never executed: debug("Set %s from %d to %d", oom_adj_path, oom_adj_save, value); | 0 | ||||||||||||
| 56 | oom_adj_path, oom_adj_save, value); never executed: debug("Set %s from %d to %d", oom_adj_path, oom_adj_save, value); | 0 | ||||||||||||
| 57 | } | - | ||||||||||||
| 58 | fclose(fp); | - | ||||||||||||
| 59 | return; never executed: return; | 0 | ||||||||||||
| 60 | } | - | ||||||||||||
| 61 | } never executed: end of block | 0 | ||||||||||||
| 62 | oom_adj_path = | - | ||||||||||||
| 63 | ((void *)0) | - | ||||||||||||
| 64 | ; | - | ||||||||||||
| 65 | } never executed: end of block | 0 | ||||||||||||
| 66 | - | |||||||||||||
| 67 | - | |||||||||||||
| 68 | void | - | ||||||||||||
| 69 | oom_adjust_restore(void) | - | ||||||||||||
| 70 | { | - | ||||||||||||
| 71 | FILE *fp; | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | debug3("%s", __func__); | - | ||||||||||||
| 74 | if (oom_adj_save ==
| 0 | ||||||||||||
| 75 | (-0x7fffffff - 1)
| 0 | ||||||||||||
| 76 | || oom_adj_path ==
| 0 | ||||||||||||
| 77 | ((void *)0)
| 0 | ||||||||||||
| 78 | || | - | ||||||||||||
| 79 | (
| 0 | ||||||||||||
| 80 | ((void *)0)
| 0 | ||||||||||||
| 81 | ) | - | ||||||||||||
| 82 | return; never executed: return; | 0 | ||||||||||||
| 83 | - | |||||||||||||
| 84 | if (fprintf(fp, "%d\n", oom_adj_save) <= 0
| 0 | ||||||||||||
| 85 | verbose("error writing %s: %s", oom_adj_path, strerror( never executed: verbose("error writing %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 86 | (*__errno_location ()) never executed: verbose("error writing %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 87 | )); never executed: verbose("error writing %s: %s", oom_adj_path, strerror( (*__errno_location ()) )); | 0 | ||||||||||||
| 88 | else | - | ||||||||||||
| 89 | debug("Set %s to %d", oom_adj_path, oom_adj_save); never executed: debug("Set %s to %d", oom_adj_path, oom_adj_save); | 0 | ||||||||||||
| 90 | - | |||||||||||||
| 91 | fclose(fp); | - | ||||||||||||
| 92 | return; never executed: return; | 0 | ||||||||||||
| 93 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |