117049c45SAxel Dörfler /* prio.c - prio command for BeOs, change priority of a given thread 2*2ca13760SColdfirex * (c) 2001, 2002, François Revol (mmu_man) for Haiku 317049c45SAxel Dörfler * released under the MIT licence. 417049c45SAxel Dörfler * 517049c45SAxel Dörfler * ChangeLog: 617049c45SAxel Dörfler * 04-26-2002 v1.2 717049c45SAxel Dörfler * fixed a typo on error (Priority changed failed.) 817049c45SAxel Dörfler * 04-25-2002 v1.1 9*2ca13760SColdfirex * Initial. Used my renice.c code to rewrite 'prio' BeOS command for Haiku. 1017049c45SAxel Dörfler * 1117049c45SAxel Dörfler * prio is a stripped-down version of renice 1217049c45SAxel Dörfler * seems to behave the same way as the original BeOS version. :) 1317049c45SAxel Dörfler */ 1417049c45SAxel Dörfler 1517049c45SAxel Dörfler #include <OS.h> 1617049c45SAxel Dörfler #include <stdio.h> 1717049c45SAxel Dörfler #include <stdlib.h> 1817049c45SAxel Dörfler main(int argc,char ** argv)1917049c45SAxel Dörflerint main(int argc, char **argv) 2017049c45SAxel Dörfler { 2117049c45SAxel Dörfler thread_id th; 2217049c45SAxel Dörfler int32 prio; 2317049c45SAxel Dörfler status_t ret; 2417049c45SAxel Dörfler 2517049c45SAxel Dörfler if (argc != 3) { 2617049c45SAxel Dörfler puts("Usage: prio pid newpriority"); 2717049c45SAxel Dörfler return 1; 2817049c45SAxel Dörfler } 2917049c45SAxel Dörfler 3017049c45SAxel Dörfler th = atoi(argv[1]); 3117049c45SAxel Dörfler prio = atoi(argv[2]); 3217049c45SAxel Dörfler 3317049c45SAxel Dörfler // ret > 0 means successful, and is the previous priority 3417049c45SAxel Dörfler ret = set_thread_priority(th, prio); 3517049c45SAxel Dörfler if (ret >= B_OK) 3617049c45SAxel Dörfler return 0; 3717049c45SAxel Dörfler puts("Priority change failed."); 3817049c45SAxel Dörfler return 1; 3917049c45SAxel Dörfler } 4017049c45SAxel Dörfler 41