| 2844 | } |
| 2845 | |
| 2846 | static void readOOMScoreAdj(void) { |
| 2847 | #ifdef HAVE_PROC_OOM_SCORE_ADJ |
| 2848 | char buf[64]; |
| 2849 | int fd = open("/proc/self/oom_score_adj", O_RDONLY); |
| 2850 | |
| 2851 | if (fd < 0) return; |
| 2852 | if (read(fd, buf, sizeof(buf)) > 0) |
| 2853 | server.oom_score_adj_base = atoi(buf); |
| 2854 | close(fd); |
| 2855 | #endif |
| 2856 | } |
| 2857 | |
| 2858 | /* This function will configure the current process's oom_score_adj according |
| 2859 | * to user specified configuration. This is currently implemented on Linux |