osdep: NetBSD pthread_setname_np()

From: bugmen0t on github

Fixes #1207.
lua: don't let temporary values take the place of arguments

Because Lua is so terrible, it's easy to confuse temporary values pushed
to the Lua stack with arguments if the arguments are checked after that.

Add a hack that should fix this.