Make foreman_for_master look like work_for_master

Now foreman_for_master follows the same steps and design of
work_for_master. The idea is to simplify how we handle the
communications to the master.
Simplify work_queue_wait_internal.

foreman_uplink is now polled outside work_queue_wait_internal. This
simplifies work_queue_internal, as we do not need the master_active
flag, and the poll table is also simpler.