On 16.09.2020 18:08, Tom Tromey wrote: >>>>>> "Kamil" == Kamil Rytarowski writes: > > While switching the target wait flags to be a flag enum type, I found a > small problem in the new NetBSD gdbserver work. > > Kamil> +/* Implement a safe wrapper around waitpid(). */ > Kamil> + > Kamil> +static pid_t > Kamil> +netbsd_waitpid (ptid_t ptid, struct target_waitstatus *ourstatus, int options) > > Here options is either 0 or: > > #define TARGET_WNOHANG 1 > > Kamil> +{ > Kamil> + int status; > Kamil> + > Kamil> + pid_t pid = gdb::handle_eintr (::waitpid, ptid.pid (), &status, options); > > ... but it is passed directly to ::waitpid. This is fine for now if the > system WNOHANG happens to be 1. However, I think it would be better not > to rely on this. For one thing, there's no guarantee that the value of > TARGET_WNOHANG will never change. > > Kamil> + pid_t pid = netbsd_waitpid (ptid, ourstatus, target_options); > > Here's a spot making the call; this shows that the target option is > being passed untranslated. > I see. It happens that WNOHANG is equal to TARGET_WNOHANG on NetBSD and it went unnoticed. > thanks, > Tom >