SYSCALL_TIMES = 84,
SYSCALL_FUTEX = 85,
SYSCALL_SIGALTSTACK = 86,
+ SYSCALL_FLOCK = 87,
};
#endif
return;
}
+ if (syscall_no == SYSCALL_FLOCK) {
+ int fd = (int)regs->ebx;
+ if (!current_process || fd < 0 || fd >= PROCESS_MAX_FILES || !current_process->files[fd]) {
+ regs->eax = (uint32_t)-EBADF;
+ } else {
+ regs->eax = 0; /* advisory lock — no-op stub */
+ }
+ return;
+ }
+
if (syscall_no == SYSCALL_SIGALTSTACK ||
syscall_no == SYSCALL_TIMES || syscall_no == SYSCALL_FUTEX) {
posix_ext_syscall_dispatch(regs, syscall_no);
SYS_TIMES = 84,
SYS_FUTEX = 85,
SYS_SIGALTSTACK = 86,
+ SYS_FLOCK = 87,
};
/* Raw syscall wrappers — up to 5 args via INT 0x80 */
int truncate(const char* path, int length);
int ftruncate(int fd, int length);
unsigned int alarm(unsigned int seconds);
+#define LOCK_SH 1
+#define LOCK_EX 2
+#define LOCK_UN 8
+#define LOCK_NB 4
+int flock(int fd, int operation);
void* brk(void* addr);
void _exit(int status) __attribute__((noreturn));
return (unsigned int)_syscall1(SYS_ALARM, (int)seconds);
}
+int flock(int fd, int operation) {
+ return __syscall_ret(_syscall2(SYS_FLOCK, fd, operation));
+}
+
void* brk(void* addr) {
return (void*)_syscall1(SYS_BRK, (int)addr);
}