1 /***********************************************************************/
5 /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
7 /* Copyright 1996 Institut National de Recherche en Informatique et */
8 /* en Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU Library General Public License, with */
10 /* the special exception on linking described in file ../../LICENSE. */
12 /***********************************************************************/
17 #include "unixsupport.h"
20 #ifdef HAS_GETPRIORITY
22 #include <sys/types.h>
24 #include <sys/resource.h>
26 CAMLprim value
unix_nice(value incr
)
30 prio
= getpriority(PRIO_PROCESS
, 0);
31 if (prio
== -1 && errno
!= 0)
32 uerror("nice", Nothing
);
33 prio
+= Int_val(incr
);
34 if (setpriority(PRIO_PROCESS
, 0, prio
) == -1)
35 uerror("nice", Nothing
);
41 CAMLprim value
unix_nice(value incr
)
45 ret
= nice(Int_val(incr
));
46 if (ret
== -1 && errno
!= 0) uerror("nice", Nothing
);