Welcome to The Fiwix Project
A UNIX-like kernel for the i386 architecture
1 /* 2 * fiwix/kernel/syscalls/setitimer.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/time.h> 10 11 #ifdef __DEBUG__ 12 #include <fiwix/stdio.h> 13 #include <fiwix/process.h> 14 #endif /*__DEBUG__ */ 15 16 int sys_setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value) 17 { 18 int errno; 19 20 #ifdef __DEBUG__ 21 printk("(pid %d) sys_setitimer(%d, 0x%08x, 0x%08x) -> \n", current->pid, which, (unsigned int)new_value, (unsigned int)old_value); 22 #endif /*__DEBUG__ */ 23 24 if((unsigned int)old_value) { 25 if((errno = check_user_area(VERIFY_WRITE, old_value, sizeof(struct itimerval)))) { 26 return errno; 27 } 28 } 29 30 return setitimer(which, new_value, old_value); 31 }