Fork me on GitHub

root/kernel/syscalls/time.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sys_time

   1 /*
   2  * fiwix/kernel/syscalls/time.c
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #include <fiwix/types.h>
   9 #include <fiwix/kernel.h>
  10 #include <fiwix/fs.h>
  11 
  12 #ifdef __DEBUG__
  13 #include <fiwix/stdio.h>
  14 #include <fiwix/process.h>
  15 #endif /*__DEBUG__ */
  16 
  17 int sys_time(__time_t *tloc)
  18 {
  19         int errno;
  20 
  21 #ifdef __DEBUG__
  22         printk("(pid %d) sys_time() -> ", current->pid);
  23 #endif /*__DEBUG__ */
  24 
  25         if(tloc) {
  26                 if((errno = check_user_area(VERIFY_WRITE, tloc, sizeof(__time_t)))) {
  27                         return errno;
  28                 }
  29                 *tloc = CURRENT_TIME;
  30         }
  31 
  32 #ifdef __DEBUG__
  33         printk("%d\n", CURRENT_TIME);
  34 #endif /*__DEBUG__ */
  35 
  36         return CURRENT_TIME;
  37 }

/* [previous][next][first][last][top][bottom][index][help] */