Main Page | Directories | File List | Globals

itimers.c File Reference

#include <agnix/agnix.h>
#include <agnix/tasks.h>
#include <agnix/timer.h>
#include <agnix/timers.h>
#include <agnix/math64.h>
#include <agnix/signals.h>
#include <agnix/errno.h>
#include <agnix/console.h>

Include dependency graph for itimers.c:

Go to the source code of this file.

Defines

#define MOD_NAME   "iTIMERS: "

Functions

int timeval_to_jiffies (struct timeval_s *val, u32 *jiffies_buf)
void itimer_expire (void *data)
int do_sys_setitimer (int which, struct itimerval_s *newval, struct itimerval_s *oldval)
int do_sys_getitimer (int which, struct itimerval_s *val)


Define Documentation

#define MOD_NAME   "iTIMERS: "
 

Definition at line 23 of file itimers.c.


Function Documentation

int do_sys_getitimer int  which,
struct itimerval_s *  val
 

Definition at line 74 of file itimers.c.

Referenced by SYS_CALL().

00075 {
00076     return 0;
00077 }

int do_sys_setitimer int  which,
struct itimerval_s *  newval,
struct itimerval_s *  oldval
 

Definition at line 48 of file itimers.c.

References itimer_expire(), register_timer(), and timeval_to_jiffies().

Referenced by SYS_CALL().

00049 {
00050     struct timer_s *timer = &current_task->timer_real;
00051     u32 jiffies_interval[2];
00052     u32 jiffies_value[2];
00053 
00054     timeval_to_jiffies(&newval->it_value, jiffies_value);
00055     timeval_to_jiffies(&newval->it_interval, jiffies_interval);
00056 
00057     if (jiffies_value[1] || jiffies_interval[1])
00058         return -EINVAL;
00059 
00060     current_task->timer_real_expire   = jiffies_value[0];
00061     current_task->timer_real_interval = jiffies_interval[0];
00062     timer->timer_function       = itimer_expire;
00063     timer->timer_data           = (void *)current_task;
00064     timer->timer_expire         = jiffies_value[0];
00065     
00066     if (!current_task->timer_real_interval)
00067         timer->timer_flags      = TIMER_FLAG_ONESHOT;
00068     
00069     register_timer(timer);
00070     
00071     return 0;
00072 }

Here is the call graph for this function:

void itimer_expire void *  data  ) 
 

Definition at line 36 of file itimers.c.

References signal_send().

Referenced by do_sys_setitimer().

00037 {
00038     struct task_s *task = (struct task_s *)data;
00039     struct timer_s *timer = &task->timer_real;
00040 
00041     signal_send(task->t_pid, SIGALRM, (siginfo_t *)1);
00042 
00043     if (task->timer_real_interval) {
00044         timer->timer_expire = task->timer_real_interval;
00045     }
00046 }

Here is the call graph for this function:

int timeval_to_jiffies struct timeval_s *  val,
u32 jiffies_buf
 

Definition at line 25 of file itimers.c.

References add_64_32(), and mul_32_32().

Referenced by do_sys_setitimer().

00026 {
00027     u32 jiffies_usecs;
00028     
00029     mul_32_32(jiffies_buf, (u32)(val->tv_sec), TIMER_HZ);
00030     jiffies_usecs = (u32)(val->tv_usec) / TIMER_HZ;
00031     add_64_32(jiffies_buf, jiffies_buf, jiffies_usecs);
00032 
00033     return 0;
00034 }

Here is the call graph for this function:

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix