lib/tsocket: add tdgram_bsd_existing_socket() helper function