#include "lock.h" #include "paths.h" #include "util.h" #include #include lock_st lock(char *lock_path) { if (exists(lock_path)) return ALREADY_LOCKED; if (creat(lock_path, 0600) == -1) return LOCK_ERROR; return LOCK_SUCCESS; } void unlock(char *lock_path) { unlink(lock_path); }