vfs: check userland buffers before reading them.
[haiku.git] / src / bin / prio.c
blobff6db01392b753139a5eda82ef77ba094ae12b1c
1 /* prio.c - prio command for BeOs, change priority of a given thread
2 * (c) 2001, 2002, François Revol (mmu_man) for OpenBeOS
3 * released under the MIT licence.
5 * ChangeLog:
6 * 04-26-2002 v1.2
7 * fixed a typo on error (Priority changed failed.)
8 * 04-25-2002 v1.1
9 * Initial. Used my renice.c code to rewrite 'prio' BeOS command for OpenBeOS.
11 * prio is a stripped-down version of renice
12 * seems to behave the same way as the original BeOS version. :)
15 #include <OS.h>
16 #include <stdio.h>
17 #include <stdlib.h>
19 int main(int argc, char **argv)
21 thread_id th;
22 int32 prio;
23 status_t ret;
25 if (argc != 3) {
26 puts("Usage: prio pid newpriority");
27 return 1;
30 th = atoi(argv[1]);
31 prio = atoi(argv[2]);
33 // ret > 0 means successful, and is the previous priority
34 ret = set_thread_priority(th, prio);
35 if (ret >= B_OK)
36 return 0;
37 puts("Priority change failed.");
38 return 1;