sim: start unifying portability shims

There are some functions that gnulib does not yet provide fallbacks
for, so start a common file of our own for holding existing stubs.
12 files changed