3 // A tiny program that disable transparent huge pages on arbitrary processes
4 // thpoff echo 1 : will run echo 1 with SET_THP_DISABLE true on the process
10 int main( int argc
, char **argv
) {
12 fprintf(stderr
, "ERROR: expecting at least 1 argument!\n");
15 prctl(PR_SET_THP_DISABLE
, 1, 0, 0, 0);
20 newargv
[argc
-1] = NULL
;
21 for (i
=1; i
<argc
; i
++) {
22 newargv
[i
-1] = argv
[i
];
25 execvp(argv
[1], newargv
);
27 if (errno
== ENOENT
) {
28 fprintf(stderr
, "ERROR: file not found\n");
30 } else if (errno
== EACCES
) {
31 fprintf(stderr
, "ERROR: can not run file\n");
33 } else if (errno
> 0) {
34 fprintf(stderr
, "ERROR: %i errno while attempting to run file\n", errno
);