[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4A147078.6020208@tremplin-utc.net>
Date: Wed, 20 May 2009 23:04:56 +0200
From: Éric Piel <eric.piel@...mplin-utc.net>
To: Christian Thaeter <ct@...apo.org>
CC: linux-kernel@...r.kernel.org, Pavel Machek <pavel@....cz>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] hpfall.c improvements, thoughts
Op 25-03-09 22:27, Christian Thaeter schreef:
> Some conversation I had with Pavel,
>
> imo the example code should be at least barely useable as in not causing
> harm like I sketched in (1.). Maybe someone else picks that up and
> improves it later on. Patch at the end, quite sketchy and imature as it
> doesn't check for errors, but certainly better than before.
>
Hello Christian,
Would you mind resending the patch with a changelog, so that Andrew can
merge it?
Thanks,
Eric
>
> Signed-off-by: Christian Thaeter <ct@...apo.org>
Acked-by: Éric Piel <eric.piel@...mplin-utc.net>
> ---
>
> diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c
> index bbea1cc..f3cde67 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)
> {
> @@ -63,6 +65,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) {
> @@ -70,7 +73,12 @@ int main(int argc, char* argv[])
> return EXIT_FAILURE;
> }
>
> - signal(SIGALRM, ignore_me);
> + daemon(0,0);
> + param.sched_priority = sched_get_priority_max(SCHED_FIFO);
> + sched_setscheduler(0, SCHED_FIFO, ¶m);
> + mlockall(MCL_CURRENT|MCL_FUTURE);
> +
> + signal(SIGALRM, ignore_me);
>
> for (;;) {
> unsigned char count;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists