Will be used by OSTree to lock the sysroot against concurrent manipulation. Taken from current systemd git master, tweaked to GLibify.