1/* prio.c - prio command for BeOs, change priority of a given thread
2 * (c) 2001, 2002, Fran��ois Revol (mmu_man) for Haiku
3 * released under the MIT licence.
4 *
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 Haiku.
10 *
11 * prio is a stripped-down version of renice
12 * seems to behave the same way as the original BeOS version. :)
13 */
14
15#include <OS.h>
16#include <stdio.h>
17#include <stdlib.h>
18
19int main(int argc, char **argv)
20{
21	thread_id th;
22	int32 prio;
23	status_t ret;
24
25	if (argc != 3) {
26		puts("Usage: prio pid newpriority");
27		return 1;
28	}
29
30	th = atoi(argv[1]);
31	prio = atoi(argv[2]);
32
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;
39}
40
41