summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/hwmon/hpfall.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c
index d2f6711b468..a3cfe1a5f96 100644
--- a/Documentation/hwmon/hpfall.c
+++ b/Documentation/hwmon/hpfall.c
@@ -16,6 +16,8 @@
#include <stdint.h>
#include <errno.h>
#include <signal.h>
+#include <sys/mman.h>
+#include <sched.h>
void write_int(char *path, int i)
{
@@ -62,6 +64,7 @@ void ignore_me(void)
int main(int argc, char *argv[])
{
int fd, ret;
+ struct sched_param param;
fd = open("/dev/freefall", O_RDONLY);
if (fd < 0) {
@@ -69,6 +72,11 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+ daemon(0, 0);
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ sched_setscheduler(0, SCHED_FIFO, &param);
+ mlockall(MCL_CURRENT|MCL_FUTURE);
+
signal(SIGALRM, ignore_me);
for (;;) {