updated patches. I'll address reorg to "compat.h" a bit later, once it is settled in my head
вс, 5 мая 2024 г. в 12:48, Илья Шипицин <chipits...@gmail.com>: > I will test and send simplified patch, i.e. I'll patch directly clock.c > > if we want to move that macro to compat.h, I'd postpone that for some > investigation > > 1) we will need to include "pthread.h" from compat.h (currently it's not > true) > 2) we will need to make sure compat.h is included everywhere (I do not see > that include in clock.c) > > вс, 5 мая 2024 г. в 12:24, Willy Tarreau <w...@1wt.eu>: > >> On Sun, May 05, 2024 at 11:15:24AM +0200, ???? ??????? wrote: >> > ??, 5 ??? 2024 ?. ? 10:42, Willy Tarreau <w...@1wt.eu>: >> > >> > > On Sun, May 05, 2024 at 09:12:41AM +0200, Miroslav Zagorac wrote: >> > > > On 05. 05. 2024. 08:32, Willy Tarreau wrote: >> > > > > On Sun, May 05, 2024 at 07:49:55AM +0200, ???? ??????? wrote: >> > > > >> ??, 5 ??? 2024 ?. ? 02:05, Miroslav Zagorac <z...@fly-etf.net>: >> > > > >>> I think that this patch is not satisfactory because, for >> example, >> > > Solaris >> > > > >>> 11.4.0.0.1.15.0 (from 2018) has _POSIX_TIMERS and >> > > _POSIX_THREAD_CPUTIME >> > > > >>> defined, but does not have the pthread_getcpuclockid() function; >> > > while >> > > > >>> solaris >> > > > >>> 11.4.42.0.0.111.0 (from 2022) has that function. >> > > > >>> >> > > > >> >> > > > >> I'm trying to build on this vmactions/solaris-vm: Use Solaris in >> > > github >> > > > >> actions <https://github.com/vmactions/solaris-vm> >> > > > >> it does not have pthread_getcpuclockid() >> > > > > >> > > > > I'm wondering what the point of defining _POSIX_THREAD_CPUTIME >> can be >> > > > > then :-/ >> > > > > >> > > > >> > > > The pthread_getcpuclockid() function is declared in the include file >> > > > /usr/include/pthread.h. The only difference between the two >> "versions" >> > > of >> > > > Solaris 11.4 is that the newer version has a declaration and the >> older >> > > one >> > > > does not. >> > > > >> > > > However, _POSIX_THREAD_CPUTIME is defined in the >> /usr/include/unistd.h >> > > file as >> > > > -1 in the UNIX 03 block of options that are not supported in Solaris >> > > 11.4. >> > > > >> > > > /* Unsupported UNIX 03 options */ >> > > > #if defined(_XPG6) >> > > > .. >> > > > #define _POSIX_THREAD_CPUTIME (-1) >> > > > .. >> > > > #endif >> > > > >> > > > >> > > > An explanation of that definition can be found here: >> > > > >> > > > https://docs.oracle.com/cd/E88353_01/html/E37842/unistd-3head.html >> > > > >> > > > "If a symbolic constant is defined with the value -1, the option is >> not >> > > > supported. Headers, data types, and function interfaces required >> only >> > > for the >> > > > option need not be supplied. An application that attempts to use >> anything >> > > > associated only with the option is considered to be requiring an >> > > extension. >> > > (...) >> > > >> > > Ah excellent, that's quite useful! We're already doing that with >> > > _POSIX_TIMERS. So I guess one just needs to try this instead: >> > > >> > > -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && >> > > defined(_POSIX_THREAD_CPUTIME >> > > +#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && >> > > defined(_POSIX_THREAD_CPUTIME && (_POSIX_THREAD_CPUTIME >= 0) >> > > >> > >> > that worked (I added closing bracket after second "defined") >> >> Ah yes indeed. Thanks for the test. Do you want to update you patch maybe, >> since you can test it ? >> >> Thanks, >> Willy >> >
From 3cc9c51ae6b22beeaaee89d1e5f69b99c6874f39 Mon Sep 17 00:00:00 2001 From: Ilia Shipitsin <chipits...@gmail.com> Date: Sun, 5 May 2024 13:41:32 +0200 Subject: [PATCH 3/3] CI: netbsd: limit scheduled workflow to parent repo only it is not very useful for most of forks. --- .github/workflows/netbsd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/netbsd.yml b/.github/workflows/netbsd.yml index ea0345954..6514725e1 100644 --- a/.github/workflows/netbsd.yml +++ b/.github/workflows/netbsd.yml @@ -7,6 +7,7 @@ on: jobs: gcc: runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'haproxy' }} permissions: contents: read steps: -- 2.43.0.windows.1
From 3c6b1a9dadfcefad4d94a1ee3a288a2e36865a52 Mon Sep 17 00:00:00 2001 From: Ilia Shipitsin <chipits...@gmail.com> Date: Sun, 5 May 2024 13:39:33 +0200 Subject: [PATCH 2/3] CI: add Illumos scheduled workflow this is very initial build only implementation. --- .github/workflows/illumos.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/illumos.yml diff --git a/.github/workflows/illumos.yml b/.github/workflows/illumos.yml new file mode 100644 index 000000000..b0b5e4852 --- /dev/null +++ b/.github/workflows/illumos.yml @@ -0,0 +1,24 @@ +name: Illumos + +on: + schedule: + - cron: "0 0 25 * *" + +jobs: + gcc: + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'haproxy' }} + permissions: + contents: read + steps: + - name: "Checkout repository" + uses: actions/checkout@v4 + + - name: "Build on VM" + uses: vmactions/solaris-vm@v1 + with: + prepare: | + pkg install gcc make + run: | + gmake CC=gcc TARGET=solaris USE_OPENSSL=1 USE_PROMEX=1 + -- 2.43.0.windows.1
From 39cf213fa22f0ef0d7254df94fdf6886b240cfef Mon Sep 17 00:00:00 2001 From: Ilia Shipitsin <chipits...@gmail.com> Date: Sun, 5 May 2024 13:09:22 +0200 Subject: [PATCH 1/3] src/clock: improve check for pthread_getcpuclockid() if _POSIX_THREAD_CPUTIME is greater than 0, pthread_getcpuclockid() is implemented Reference: https://docs.oracle.com/cd/E88353_01/html/E37842/unistd-3head.html ML: https://www.mail-archive.com/haproxy@formilux.org/msg44915.html --- src/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clock.c b/src/clock.c index ec2133c8b..7734389a7 100644 --- a/src/clock.c +++ b/src/clock.c @@ -135,7 +135,7 @@ uint64_t now_cpu_time_thread(int thr) /* set the clock source for the local thread */ void clock_set_local_source(void) { -#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME) +#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_THREAD_CPUTIME) && (_POSIX_THREAD_CPUTIME >= 0) #ifdef USE_THREAD pthread_getcpuclockid(pthread_self(), &per_thread_clock_id[tid]); #else -- 2.43.0.windows.1