daemon/common.[ch]: add set_sock_opts() function