Add sys.h for cross-platform.
Add segment/log new/add/free operations.