introduce "struct wait_opts" to simplify do_wait() patches