Add check for the nice(3) system call.

It may be not implemented on some plaforms, though it's usually present.

Required to compile on Haiku as of 2008 October.
This commit is contained in:
ahoka 2008-10-26 21:51:27 +00:00
parent 8230c9d8ae
commit 776cc76ccb
4 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.361 2008/10/25 12:58:41 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.362 2008/10/26 21:51:25 ahoka Exp $'
#-
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
@ -1037,6 +1037,11 @@ ac_test mkstemp <<-'EOF'
int main(void) { char tmpl[] = "X"; return (mkstemp(tmpl)); }
EOF
ac_test nice <<-'EOF'
#include <unistd.h>
int main(void) { return (nice(4)); }
EOF
ac_test setlocale_ctype '' 'setlocale(LC_CTYPE, "")' <<-'EOF'
#include <locale.h>
#include <stddef.h>

4
jobs.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.37 2008/10/13 23:06:03 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.38 2008/10/26 21:51:26 ahoka Exp $");
/* Order important! */
#define PRUNNING 0
@ -402,8 +402,10 @@ exchild(struct op *t, int flags, /* used if XPCLOSE or XCCLOSE */ int close_fd)
setsig(&sigtraps[tt_sigs[i]], SIG_DFL,
SS_RESTORE_DFL|SS_FORCE);
}
#if HAVE_NICE
if (Flag(FBGNICE) && (flags & XBGND))
(void)nice(4);
#endif
if ((flags & XBGND) && !Flag(FMONITOR)) {
setsig(&sigtraps[SIGINT], SIG_IGN,
SS_RESTORE_IGN|SS_FORCE);

4
misc.c
View File

@ -6,7 +6,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.86 2008/10/13 23:06:03 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.87 2008/10/26 21:51:26 ahoka Exp $");
#undef USE_CHVT
#if defined(TIOCSCTTY) && !defined(MKSH_SMALL)
@ -113,7 +113,9 @@ const struct shoption options[] = {
{ "arc4random", 0, OF_ANY },
#endif
{ "braceexpand", 0, OF_ANY }, /* non-standard */
#if HAVE_NICE
{ "bgnice", 0, OF_ANY },
#endif
{ NULL, 'c', OF_CMDLINE },
{ "emacs", 0, OF_ANY },
{ "errexit", 'e', OF_ANY },

4
sh.h
View File

@ -100,7 +100,7 @@
#define __SCCSID(x) __IDSTRING(sccsid,x)
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.246 2008/10/26 20:59:40 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.247 2008/10/26 21:51:27 ahoka Exp $");
#endif
#define MKSH_VERSION "R36 2008/10/26"
@ -434,7 +434,9 @@ enum sh_flag {
FARC4RANDOM, /* use 0:rand(3) 1:arc4random(3) 2:switch on write */
#endif
FBRACEEXPAND, /* enable {} globbing */
#if HAVE_NICE
FBGNICE, /* bgnice */
#endif
FCOMMAND, /* -c: (invocation) execute specified command */
FEMACS, /* emacs command editing */
FERREXIT, /* -e: quit on error */