So more directly for the path taken:, with some comments added that are
tied to my question:
// signals might not be blocked here
sigprocmask(SIG_BLOCK, &mask, &omask);
// so signals are blocked
// but the below reneables them during waitin in pselect
// (if they were not blocked before the sigprocmask call).
ret = get_errno(pselect(n, rfds_ptr, wfds_ptr, efds_ptr, ts_ptr,
// signals are again blocked during parts of pselect
// and here after returning.
sigprocmask(SIG_SETMASK, &omask, NULL);
// signals are no longer blocked
Is there a reason for this code structure to be used? If so, what is it?
I've another qeuestion based on what gdb reports and man pages
say. (I extracted material from records of multiple gdb sessions.)
#0 _pselect () at _pselect.S:3
#1 0x00000000601da57f in __thr_pselect (count=12, rfds=0x7ffffffe3650, wfds=0x0, efds=0x0, timo=0x0, mask=0x7ffffffe3600) at /usr/src/lib/libthr/thread/thr_syscalls.c:378
#2 0x000000006004928d in do_freebsd_select (env=0x860edfb18, n=<optimized out>, rfd_addr=140736934698744, wfd_addr=<optimized out>, efd_addr=0, target_tv_addr=0)
#3 do_freebsd_syscall (cpu_env=0x860edfb18, num=93, arg1=12, arg2=140736934698744, arg3=0, arg4=0, arg5=0, arg6=274914043516, arg7=274913946564, arg8=6579811)
#4 0x000000006003903c in target_cpu_loop (env=0x860edfb18) at /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/bsd-user/aarch64/target_arch_cpu.h:100
#5 0x0000000060038e09 in cpu_loop (env=0xc) at /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/bsd-user/main.c:121
#6 0x0000000060039ecb in main (argc=<optimized out>, argv=0x7fffffffd360) at /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/bsd-user/main.c:513
Note the use of __thr_pselect . But I see in gdb's disass:
In threaded applications, pthread_sigmask(3) must be used instead of sigprocmask().
But gdb shows use of 2 threads overall:
(gdb) info threads
Id Target Id Frame
* 1 LWP 100804 of process 89695 _pselect () at _pselect.S:3
2 LWP 101548 of process 89695 _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:37
So is the apparent use of sigprocmask valid in this context?
For reference for where the hang-up happens for:
configure:6844: checking whether // is distinct from /