From 875b1bbd0e0c8332bf4224738192334a499e1f7a Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 1 Nov 2014 18:25:21 -0500 Subject: [PATCH] More GNO and ORCA/C compatibility fixes. Everything in the shell directory now compiles. --- include/libbb.h | 6 +++++- include/platform.h | 2 +- shell/hush.c | 12 ++++++++++-- shell/random.c | 4 ++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index 1ab843669..0f1bd1e21 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1580,7 +1580,11 @@ struct globals; * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */ extern struct globals *const ptr_to_globals; /* At least gcc 3.4.6 on mipsel system needs optimization barrier */ -#define barrier() __asm__ __volatile__("":::"memory") +#ifndef __ORCAC__ +# define barrier() __asm__ __volatile__("":::"memory") +#else +# define barrier() +#endif #define SET_PTR_TO_GLOBALS(x) do { \ (*(struct globals**)&ptr_to_globals) = (void*)(x); \ barrier(); \ diff --git a/include/platform.h b/include/platform.h index 50ac0ffdb..fe6af4e5b 100644 --- a/include/platform.h +++ b/include/platform.h @@ -202,7 +202,7 @@ typedef unsigned smalluint; #endif /* Define bb_setpgrp */ -#if defined(__digital__) && defined(__unix__) +#if defined(__digital__) && defined(__unix__) || defined(__GNO__) /* use legacy setpgrp(pid_t, pid_t) for now. move to platform.c */ # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0) #else diff --git a/shell/hush.c b/shell/hush.c index e1f9ccda8..b44f7f45d 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -6117,7 +6117,7 @@ static void xforked_grandchild(void *args_struct) { /* squirrel != NULL means we squirrel away copies of stdin, stdout, * and stderr if they are redirected. */ -static int setup_redirects(struct command *prog, int squirrel[]) +static int setup_redirects(struct command *prog, int *squirrel) { int openfd, mode; struct redir_struct *redir; @@ -6756,7 +6756,11 @@ static void delete_finished_bg_job(struct pipe *pi) static int checkjobs(struct pipe *fg_pipe) { int attributes; +#ifndef __GNO__ int status; +#else + union wait status; +#endif #if ENABLE_HUSH_JOB struct pipe *pi; #endif @@ -7854,7 +7858,7 @@ int hush_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int hush_main(int argc, char **argv) { enum { - OPT_login = (1 << 0), + OPT_login = (1 << 0) }; unsigned flags; int opt; @@ -9122,7 +9126,11 @@ static int FAST_FUNC builtin_unset(char **argv) static int FAST_FUNC builtin_wait(char **argv) { int ret = EXIT_SUCCESS; +#ifndef __GNO__ int status; +#else + union wait status; +#endif argv = skip_dash_dash(argv); if (argv[0] == NULL) { diff --git a/shell/random.c b/shell/random.c index 4170de643..2db734e5b 100644 --- a/shell/random.c +++ b/shell/random.c @@ -37,7 +37,7 @@ next_random(random_t *rnd) /* Galois LFSR parameter: * Taps at 32 31 29 1: */ - enum { MASK = 0x8000000b }; + const uint32_t MASK = 0x8000000b; /* Another example - taps at 32 31 30 10: */ /* enum { MASK = 0x00400007 }; */ @@ -48,7 +48,7 @@ next_random(random_t *rnd) enum { a = 2, b = 7, - c = 3, + c = 3 }; uint32_t t;