nsjail: fix *-musl

This commit is contained in:
Jürgen Buchmüller 2017-01-04 17:34:07 +01:00
parent 2853809f4a
commit b2034e4a5b
3 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#if !defined(MUSL_COMPAT_H)
#define MUSL_COMPAT_H
# define TEMP_FAILURE_RETRY(expression) \
(__extension__ \
({ long int __result; \
do __result = (long int) (expression); \
while (__result == -1L && errno == EINTR); \
__result; }))
#endif /* !defined(MUSL_COMPAT_H) */

View file

@ -0,0 +1,54 @@
--- common.h 2016-09-10 03:20:32.000000000 +0200
+++ common.h 2017-01-04 17:24:12.807104061 +0100
@@ -100,13 +100,13 @@
bool verbose;
bool keep_env;
bool keep_caps;
- __rlim64_t rl_as;
- __rlim64_t rl_core;
- __rlim64_t rl_cpu;
- __rlim64_t rl_fsize;
- __rlim64_t rl_nofile;
- __rlim64_t rl_nproc;
- __rlim64_t rl_stack;
+ rlim64_t rl_as;
+ rlim64_t rl_core;
+ rlim64_t rl_cpu;
+ rlim64_t rl_fsize;
+ rlim64_t rl_nofile;
+ rlim64_t rl_nproc;
+ rlim64_t rl_stack;
unsigned long personality;
bool clone_newnet;
bool clone_newuser;
--- cmdline.h 2016-09-10 03:20:32.000000000 +0200
+++ cmdline.h 2017-01-04 17:25:32.479110539 +0100
@@ -27,7 +27,7 @@
#include "common.h"
-__rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul);
+rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul);
void cmdlineLogParams(struct nsjconf_t *nsjconf);
bool cmdlineParse(int argc, char *argv[], struct nsjconf_t *nsjconf);
--- cmdline.c 2016-09-10 03:20:32.000000000 +0200
+++ cmdline.c 2017-01-04 17:26:19.346114418 +0100
@@ -137,7 +137,7 @@
return true;
}
-__rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul)
+rlim64_t cmdlineParseRLimit(int res, const char *optarg, unsigned long mul)
{
struct rlimit64 cur;
if (prlimit64(0, res, NULL, &cur) == -1) {
@@ -153,7 +153,7 @@
LOG_F("RLIMIT %d needs a numeric or 'max'/'def' value ('%s' provided)", res,
optarg);
}
- __rlim64_t val = strtoull(optarg, NULL, 0) * mul;
+ rlim64_t val = strtoull(optarg, NULL, 0) * mul;
if (val == ULLONG_MAX && errno != 0) {
PLOG_F("strtoul('%s', 0)", optarg);
}

View file

@ -10,7 +10,14 @@ homepage="https://github.com/google/$pkgname"
distfiles="$homepage/archive/$version.tar.gz"
checksum="9f262d56a189cf26f5c66b2c022364df979da92042f64c04300fdbb88aaba8ab"
CFLAGS="-Wno-error=format"
do_build() {
case "$XBPS_TARGET_MACHINE" in
*-musl) cp ${FILESDIR}/musl-compat.h .
sed -i common.h -e '/#include <sys\/types.h>/a #include "musl-compat.h"'
;;
esac
make CC=$CC
}