Welcome to The Fiwix Project
A UNIX-like kernel for the i386 architecture
1 /* 2 * fiwix/kernel/syscalls/flock.c 3 * 4 * Copyright 2018, Jordi Sanfeliu. All rights reserved. 5 * Distributed under the terms of the Fiwix License. 6 */ 7 8 #include <fiwix/fs.h> 9 #include <fiwix/process.h> 10 #include <fiwix/locks.h> 11 #include <fiwix/errno.h> 12 13 #ifdef __DEBUG__ 14 #include <fiwix/stdio.h> 15 #endif /*__DEBUG__ */ 16 17 int sys_flock(int ufd, int op) 18 { 19 struct inode *i; 20 21 #ifdef __DEBUG__ 22 printk("(pid %d) sys_flock(%d, %d)\n", current->pid, ufd, op); 23 #endif /*__DEBUG__ */ 24 25 CHECK_UFD(ufd); 26 i = fd_table[current->fd[ufd]].inode; 27 return flock_inode(i, op); 28 }