The system_flock function locks the specified file against interference from other processes. Use system_flock if you do not want other processes to use the file you currently have open. Overusing file locking can cause performance degradation and possibly lead to deadlocks.
int system_flock(SYS_FILE fd);
Returns IO_OKAY if the lock succeeded, or IO_ERROR if the lock failed.
SYS_FILE fd is the platform-independent file descriptor.