Implementing fcntl syscall