Operating system services as protected libraries