atlas-probe: update to version 2.4.1
Removed patches: 001-fix-stime-glibc-remove.patch - it is included in upstream 003-Fix-compilation-with-gcc11.patch - no longer necessary Updated patches: 002-Avoid-problems-with-64-bit-time_t.patch Refreshed patches: 004-Comment-out-librt-testing.patch Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit is contained in:
parent
ec767eb499
commit
cf65ca2db0
5 changed files with 13 additions and 279 deletions
|
@ -8,12 +8,12 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=atlas-probe
|
||||
PKG_VERSION:=2.2.1
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=2.4.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=ripe-atlas-probe-busybox-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/RIPE-NCC/ripe-atlas-probe-busybox/archive/v$(PKG_VERSION)
|
||||
PKG_HASH:=c5a3aca026cd1a3b93a77b159b36cd7a1098eb6d90e9ae4a69872cd7a419a87b
|
||||
PKG_HASH:=e684bf617cdc502c20f97028726a93a4a0d21ad9f618b50eb07f999f1604ae65
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/ripe-atlas-probe-busybox-$(PKG_VERSION)
|
||||
|
||||
|
|
|
@ -1,178 +0,0 @@
|
|||
From 402150eed057fc9fa52c8471ae645e23913a2805 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Homburg <phomburg@ripe.net>
|
||||
Date: Tue, 23 Jun 2020 12:25:08 -0400
|
||||
Subject: [PATCH] replace stime with clock_settime
|
||||
|
||||
---
|
||||
coreutils/date.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/coreutils/date.c
|
||||
+++ b/coreutils/date.c
|
||||
@@ -246,6 +246,9 @@ int date_main(int argc UNUSED_PARAM, cha
|
||||
if (*argv)
|
||||
bb_show_usage();
|
||||
|
||||
+ /* Clear ts.tv_nsec, in case we need to set the time later */
|
||||
+ ts.tv_nsec= 0;
|
||||
+
|
||||
/* Now we have parsed all the information except the date format
|
||||
* which depends on whether the clock is being set or read */
|
||||
|
||||
@@ -310,7 +313,7 @@ int date_main(int argc UNUSED_PARAM, cha
|
||||
}
|
||||
|
||||
/* if setting time, set it */
|
||||
- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
|
||||
+ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
|
||||
bb_perror_msg("can't set date");
|
||||
}
|
||||
}
|
||||
--- a/util-linux/rdate.c
|
||||
+++ b/util-linux/rdate.c
|
||||
@@ -65,27 +65,27 @@ static time_t askremotedate(const char *
|
||||
int rdate_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||
int rdate_main(int argc UNUSED_PARAM, char **argv)
|
||||
{
|
||||
- time_t remote_time;
|
||||
+ struct timespec remote_time;
|
||||
unsigned flags;
|
||||
|
||||
opt_complementary = "-1";
|
||||
flags = getopt32(argv, "sp");
|
||||
|
||||
- remote_time = askremotedate(argv[optind]);
|
||||
+ remote_time.tv_sec = askremotedate(argv[optind]);
|
||||
|
||||
if (!(flags & 2)) { /* no -p (-s may be present) */
|
||||
time_t current_time;
|
||||
|
||||
time(¤t_time);
|
||||
- if (current_time == remote_time)
|
||||
+ if (current_time == remote_time.tv_sec)
|
||||
bb_error_msg("current time matches remote time");
|
||||
else
|
||||
- if (stime(&remote_time) < 0)
|
||||
+ if (clock_settime(CLOCK_REALTIME,&remote_time) < 0)
|
||||
bb_perror_msg_and_die("can't set time of day");
|
||||
}
|
||||
|
||||
if (flags != 1) /* not lone -s */
|
||||
- printf("%s", ctime(&remote_time));
|
||||
+ printf("%s", ctime(&remote_time.tv_sec));
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
--- a/networking/httpget.c
|
||||
+++ b/networking/httpget.c
|
||||
@@ -947,8 +947,9 @@ static int eat_headers(FILE *tcp_file, i
|
||||
if (time_tolerance && strncmp(line, "Date: ", 6) == 0)
|
||||
{
|
||||
/* Try to set time from server */
|
||||
- time_t now, tim, tolerance;
|
||||
+ time_t now, tolerance;
|
||||
struct tm tm;
|
||||
+ struct timespec tim;
|
||||
|
||||
tolerance= strtoul(time_tolerance, &cp, 10);
|
||||
if (cp[0] != '\0')
|
||||
@@ -966,16 +967,16 @@ static int eat_headers(FILE *tcp_file, i
|
||||
line+6);
|
||||
}
|
||||
}
|
||||
- tim= timegm(&tm);
|
||||
+ tim.tv_sec= timegm(&tm);
|
||||
now= time(NULL);
|
||||
- if (now < tim-tolerance || now > tim+tolerance)
|
||||
+ if (now < tim.tv_sec-tolerance || now > tim.tv_sec+tolerance)
|
||||
{
|
||||
if (debug)
|
||||
{ fprintf(stderr,
|
||||
"setting time, time difference is %d\n",
|
||||
- (int)(tim-now));
|
||||
+ (int)(tim.tv_sec-now));
|
||||
}
|
||||
- stime(&tim);
|
||||
+ clock_settime(CLOCK_REALTIME,&tim);
|
||||
}
|
||||
}
|
||||
|
||||
--- a/networking/httppost.c
|
||||
+++ b/networking/httppost.c
|
||||
@@ -92,13 +92,14 @@ int httppost_main(int argc, char *argv[]
|
||||
char *time_tolerance, *rebased_fn= NULL;
|
||||
char *fn_new, *fn;
|
||||
FILE *tcp_file, *out_file, *fh;
|
||||
- time_t server_time, tolerance;
|
||||
+ time_t tolerance;
|
||||
+ struct timespec server_time;
|
||||
struct stat sbF, sbH, sbS;
|
||||
off_t cLength, dir_length, maxpostsize;
|
||||
struct sigaction sa;
|
||||
|
||||
- post_dir= NULL;
|
||||
- post_file= NULL;
|
||||
+ post_dir= NULL;
|
||||
+ post_file= NULL;
|
||||
post_footer=NULL;
|
||||
post_header=NULL;
|
||||
atlas_id= NULL;
|
||||
@@ -470,12 +471,12 @@ int httppost_main(int argc, char *argv[]
|
||||
if (!check_result(tcp_file))
|
||||
goto err;
|
||||
fprintf(stderr, "httppost: getting reply headers \n");
|
||||
- server_time= 0;
|
||||
+ server_time.tv_sec = 0;
|
||||
content_length= -1;
|
||||
- if (!eat_headers(tcp_file, &chunked, &content_length, &server_time))
|
||||
+ if (!eat_headers(tcp_file, &chunked, &content_length, &server_time.tv_sec))
|
||||
goto err;
|
||||
|
||||
- if (tolerance && server_time > 0)
|
||||
+ if (tolerance && server_time.tv_sec > 0)
|
||||
{
|
||||
/* Try to set time from server */
|
||||
int need_set_time;
|
||||
@@ -486,35 +487,35 @@ int httppost_main(int argc, char *argv[]
|
||||
rtt= now.tv_sec-start_time.tv_sec;
|
||||
rtt += (now.tv_usec-start_time.tv_usec)/1e6;
|
||||
if (rtt < 0) rtt= 0;
|
||||
- need_set_time= (now.tv_sec < server_time-tolerance-rtt ||
|
||||
- now.tv_sec > server_time+tolerance+rtt);
|
||||
+ need_set_time= (now.tv_sec < server_time.tv_sec-tolerance-rtt ||
|
||||
+ now.tv_sec > server_time.tv_sec+tolerance+rtt);
|
||||
if (need_set_time && getenv("HTTPPOST_ALLOW_STIME"))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"setting time, time difference is %ld\n",
|
||||
- (long)server_time-now.tv_sec);
|
||||
- stime(&server_time);
|
||||
+ (long)server_time.tv_sec-now.tv_sec);
|
||||
+ clock_settime(CLOCK_REALTIME,&server_time);
|
||||
if (atlas_id)
|
||||
{
|
||||
printf(
|
||||
"RESULT %s ongoing %ld httppost setting time, local %ld, remote %ld\n",
|
||||
atlas_id, (long)time(NULL),
|
||||
(long)now.tv_sec,
|
||||
- (long)server_time);
|
||||
+ (long)server_time.tv_sec);
|
||||
}
|
||||
}
|
||||
else if (need_set_time)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"not setting time, time difference is %ld\n",
|
||||
- (long)server_time-now.tv_sec);
|
||||
+ (long)server_time.tv_sec-now.tv_sec);
|
||||
if (atlas_id)
|
||||
{
|
||||
printf(
|
||||
"RESULT %s ongoing %ld httppost not in sync, local %ld, remote %ld\n",
|
||||
atlas_id, (long)time(NULL),
|
||||
(long)now.tv_sec,
|
||||
- (long)server_time);
|
||||
+ (long)server_time.tv_sec);
|
||||
}
|
||||
}
|
||||
else if (rtt <= 1)
|
|
@ -1,7 +1,7 @@
|
|||
From b83524b19ca6e5e58dded77fad37f17a177766ff Mon Sep 17 00:00:00 2001
|
||||
From 46da4c4e090e0412cee0777f1e8b219964781da7 Mon Sep 17 00:00:00 2001
|
||||
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
||||
Date: Fri, 8 Oct 2021 14:39:52 -0300
|
||||
Subject: [PATCH 1/2] Avoid problems with 64-bit time_t
|
||||
Subject: [PATCH] Avoid problems with 64-bit time_t
|
||||
|
||||
The clock_gettime() calls are being handled by calling
|
||||
syscall(__NR_clock_gettime, ...), which is not portable between systems
|
||||
|
@ -12,6 +12,11 @@ So, use the standard function, and add a test to see if we can compile
|
|||
a test without the library, including it otherwise.
|
||||
|
||||
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
||||
---
|
||||
Makefile.flags | 6 ++++++
|
||||
coreutils/date.c | 6 ++----
|
||||
libbb/time.c | 2 +-
|
||||
3 files changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/Makefile.flags
|
||||
+++ b/Makefile.flags
|
||||
|
@ -20,7 +25,7 @@ Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
|||
endif
|
||||
|
||||
+# glibc versions before 2.17 need to link with -rt to use clock_gettime
|
||||
+RT_NEEDED := $(shell echo -e '#include <time.h>\nint main(void){struct timespec tp; return clock_gettime(CLOCK_MONOTONIC, &tp);}' >rttest.c; $(CC) $(CFLAGS) -o /dev/null rttest.c >/dev/null 2>&1 || echo "y"; rm rttest.c)
|
||||
+RT_NEEDED := $(shell echo 'int main(void){struct timespec tp; return clock_gettime(CLOCK_MONOTONIC, &tp);}' >rttest.c; $(CC) $(CFLAGS) -include time.h -o /dev/null rttest.c >/dev/null 2>&1 || echo "y"; rm rttest.c)
|
||||
+ifeq ($(RT_NEEDED),y)
|
||||
+LDLIBS += rt
|
||||
+endif
|
||||
|
@ -61,14 +66,3 @@ Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
|||
bb_error_msg_and_die("clock_gettime(MONOTONIC) failed");
|
||||
}
|
||||
unsigned long long FAST_FUNC monotonic_ns(void)
|
||||
--- a/runit/runsv.c
|
||||
+++ b/runit/runsv.c
|
||||
@@ -55,7 +55,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAG
|
||||
* typically requiring -lrt. We just skip all this mess */
|
||||
static void gettimeofday_ns(struct timespec *ts)
|
||||
{
|
||||
- syscall(__NR_clock_gettime, CLOCK_REALTIME, ts);
|
||||
+ clock_gettime(CLOCK_REALTIME, ts);
|
||||
}
|
||||
#else
|
||||
static void gettimeofday_ns(struct timespec *ts)
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
From b6b3cdc16eaa50b40623f1589ea51dd43ebb456d Mon Sep 17 00:00:00 2001
|
||||
From: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
||||
Date: Fri, 8 Oct 2021 14:47:08 -0300
|
||||
Subject: [PATCH 2/2] Fix compilation with gcc11
|
||||
|
||||
Currently, libbb.h counts on __THROW and __inline being defined. They
|
||||
are internal macros used by glibc not meant to be publicly used. This
|
||||
causes trouble, at least with a combination of gcc11 and musl, where
|
||||
nether have them defined.
|
||||
|
||||
Use definitions from <sys/cdefs.h> in gcc 8.4.0 if they're missing.
|
||||
|
||||
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
||||
|
||||
--- a/include/libbb.h
|
||||
+++ b/include/libbb.h
|
||||
@@ -120,6 +120,65 @@
|
||||
#ifdef DMALLOC
|
||||
# include <dmalloc.h>
|
||||
#endif
|
||||
+
|
||||
+/* Compatibility with musl & gcc 11. Taken from <sys/cdefs.h> in gcc 8.4.0 */
|
||||
+#ifndef __THROW
|
||||
+#ifdef __GNUC__
|
||||
+
|
||||
+/* All functions, except those with callbacks or those that
|
||||
+ synchronize memory, are leaf functions. */
|
||||
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
|
||||
+# define __LEAF , __leaf__
|
||||
+# define __LEAF_ATTR __attribute__ ((__leaf__))
|
||||
+# else
|
||||
+# define __LEAF
|
||||
+# define __LEAF_ATTR
|
||||
+# endif
|
||||
+
|
||||
+/* GCC can always grok prototypes. For C++ programs we add throw()
|
||||
+ to help it optimize the function calls. But this works only with
|
||||
+ gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
|
||||
+ as non-throwing using a function attribute since programs can use
|
||||
+ the -fexceptions options for C code as well. */
|
||||
+# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
|
||||
+# define __THROW __attribute__ ((__nothrow__ __LEAF))
|
||||
+# define __THROWNL __attribute__ ((__nothrow__))
|
||||
+# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
|
||||
+# else
|
||||
+# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||
+# define __THROW throw ()
|
||||
+# define __THROWNL throw ()
|
||||
+# define __NTH(fct) __LEAF_ATTR fct throw ()
|
||||
+# else
|
||||
+# define __THROW
|
||||
+# define __THROWNL
|
||||
+# define __NTH(fct) fct
|
||||
+# endif
|
||||
+# endif
|
||||
+
|
||||
+#else /* Not GCC. */
|
||||
+
|
||||
+# define __inline /* No inline functions. */
|
||||
+
|
||||
+# define __THROW
|
||||
+# define __THROWNL
|
||||
+# define __NTH(fct) fct
|
||||
+
|
||||
+#endif /* GCC. */
|
||||
+#endif /* __THROW */
|
||||
+
|
||||
+#ifndef __nonnull
|
||||
+/* The nonull function attribute allows to mark pointer parameters which
|
||||
+ must not be NULL. */
|
||||
+#if __GNUC_PREREQ (3,3)
|
||||
+# define __nonnull(params) __attribute__ ((__nonnull__ params))
|
||||
+#else
|
||||
+# define __nonnull(params)
|
||||
+#endif
|
||||
+#endif /* __nonnull */
|
||||
+
|
||||
+/* End of compatibility with musl & gcc 11. */
|
||||
+
|
||||
/* Just in case libc doesn't define some of these... */
|
||||
#ifndef _PATH_PASSWD
|
||||
#define _PATH_PASSWD "/etc/passwd"
|
|
@ -19,11 +19,11 @@ Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
|
|||
endif
|
||||
|
||||
# glibc versions before 2.17 need to link with -rt to use clock_gettime
|
||||
-RT_NEEDED := $(shell echo -e '#include <time.h>\nint main(void){struct timespec tp; return clock_gettime(CLOCK_MONOTONIC, &tp);}' >rttest.c; $(CC) $(CFLAGS) -o /dev/null rttest.c >/dev/null 2>&1 || echo "y"; rm rttest.c)
|
||||
-RT_NEEDED := $(shell echo 'int main(void){struct timespec tp; return clock_gettime(CLOCK_MONOTONIC, &tp);}' >rttest.c; $(CC) $(CFLAGS) -include time.h -o /dev/null rttest.c >/dev/null 2>&1 || echo "y"; rm rttest.c)
|
||||
-ifeq ($(RT_NEEDED),y)
|
||||
-LDLIBS += rt
|
||||
-endif
|
||||
+#RT_NEEDED := $(shell echo -e '#include <time.h>\nint main(void){struct timespec tp; return clock_gettime(CLOCK_MONOTONIC, &tp);}' >rttest.c; $(CC) $(CFLAGS) -o /dev/null rttest.c >/dev/null 2>&1 || echo "y"; rm rttest.c)
|
||||
+#RT_NEEDED := $(shell echo 'int main(void){struct timespec tp; return clock_gettime(CLOCK_MONOTONIC, &tp);}' >rttest.c; $(CC) $(CFLAGS) -include time.h -o /dev/null rttest.c >/dev/null 2>&1 || echo "y"; rm rttest.c)
|
||||
+#ifeq ($(RT_NEEDED),y)
|
||||
+#LDLIBS += rt
|
||||
+#endif
|
||||
|
|
Loading…
Reference in a new issue