Diff for /libaitsched/src/hooks.c between versions 1.13.2.2 and 1.18.4.1

version 1.13.2.2, 2012/08/21 11:45:35 version 1.18.4.1, 2013/08/15 14:53:49
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 110  sched_hook_cancel(void *task, void *arg __unused) Line 110  sched_hook_cancel(void *task, void *arg __unused)
 #ifdef AIO_SUPPORT  #ifdef AIO_SUPPORT
         struct aiocb *acb;          struct aiocb *acb;
 #ifdef EVFILT_LIO  #ifdef EVFILT_LIO
           register int i = 0;
         struct aiocb **acbs;          struct aiocb **acbs;
         register int i;  
 #endif  /* EVFILT_LIO */  #endif  /* EVFILT_LIO */
 #endif  /* AIO_SUPPORT */  #endif  /* AIO_SUPPORT */
   
Line 162  sched_hook_cancel(void *task, void *arg __unused) Line 162  sched_hook_cancel(void *task, void *arg __unused)
 #else  #else
                         EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_DELETE, 0, 0, (void*) TASK_VAL(t));                          EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_DELETE, 0, 0, (void*) TASK_VAL(t));
 #endif  #endif
                           /* restore signal */
                           signal(TASK_VAL(t), SIG_DFL);
                         break;                          break;
 #ifdef AIO_SUPPORT  #ifdef AIO_SUPPORT
                 case taskAIO:                  case taskAIO:
Line 219  sched_hook_cancel(void *task, void *arg __unused) Line 221  sched_hook_cancel(void *task, void *arg __unused)
         return NULL;          return NULL;
 }  }
   
   #ifdef HAVE_LIBPTHREAD
 /*  /*
    * sched_hook_thread() - Default THREAD hook
    *
    * @task = current task
    * @arg = pthread attributes
    * return: <0 errors and 0 ok
    */
   void *
   sched_hook_thread(void *task, void *arg)
   {
           sched_task_t *t = task;
           pthread_t tid;
           sigset_t s, o;
   
           if (!t || !TASK_ROOT(t))
                   return (void*) -1;
   
           sigfillset(&s);
           pthread_sigmask(SIG_BLOCK, &s, &o);
           if ((errno = pthread_create(&tid, (pthread_attr_t*) arg, 
                                   (void *(*)(void*)) _sched_threadWrapper, t))) {
                   LOGERR;
                   pthread_sigmask(SIG_SETMASK, &o, NULL);
                   return (void*) -1;
           } else
                   TASK_VAL(t) = (u_long) tid;
   
           if (!TASK_ISLOCKED(t))
                   TASK_LOCK(t);
   
           pthread_sigmask(SIG_SETMASK, &o, NULL);
           return NULL;
   }
   #endif
   
   /*
  * sched_hook_read() - Default READ hook   * sched_hook_read() - Default READ hook
  *   *
  * @task = current task   * @task = current task
Line 303  sched_hook_alarm(void *task, void *arg __unused) Line 341  sched_hook_alarm(void *task, void *arg __unused)
                 return (void*) -1;                  return (void*) -1;
   
 #ifdef __NetBSD__  #ifdef __NetBSD__
        EV_SET(&chg[0], (uintptr_t) TASK_DATA(t), EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0,         EV_SET(&chg[0], (uintptr_t) TASK_DATA(t), EVFILT_TIMER, EV_ADD | EV_CLEAR, 0, 
                         t->task_val.ts.tv_sec * 1000 + t->task_val.ts.tv_nsec / 1000000,                           t->task_val.ts.tv_sec * 1000 + t->task_val.ts.tv_nsec / 1000000, 
                         (intptr_t) TASK_DATA(t));                          (intptr_t) TASK_DATA(t));
 #else  #else
        EV_SET(&chg[0], (uintptr_t) TASK_DATA(t), EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0,         EV_SET(&chg[0], (uintptr_t) TASK_DATA(t), EVFILT_TIMER, EV_ADD | EV_CLEAR, 0, 
                         t->task_val.ts.tv_sec * 1000 + t->task_val.ts.tv_nsec / 1000000,                           t->task_val.ts.tv_sec * 1000 + t->task_val.ts.tv_nsec / 1000000, 
                         (void*) TASK_DATA(t));                          (void*) TASK_DATA(t));
 #endif  #endif
Line 411  sched_hook_signal(void *task, void *arg __unused) Line 449  sched_hook_signal(void *task, void *arg __unused)
         if (!t || !TASK_ROOT(t))          if (!t || !TASK_ROOT(t))
                 return (void*) -1;                  return (void*) -1;
   
           /* ignore signal */
           signal(TASK_VAL(t), SIG_IGN);
   
 #ifdef __NetBSD__  #ifdef __NetBSD__
        EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_ADD, 0, 0, (intptr_t) TASK_VAL(t));        EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_ADD | EV_CLEAR, 0, 0, (intptr_t) TASK_VAL(t));
 #else  #else
        EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_ADD, 0, 0, (void*) TASK_VAL(t));        EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_ADD | EV_CLEAR, 0, 0, (void*) TASK_VAL(t));
 #endif  #endif
         if (kevent(TASK_ROOT(t)->root_kq, chg, 1, NULL, 0, &timeout) == -1) {          if (kevent(TASK_ROOT(t)->root_kq, chg, 1, NULL, 0, &timeout) == -1) {
                 if (TASK_ROOT(t)->root_hooks.hook_exec.exception)                  if (TASK_ROOT(t)->root_hooks.hook_exec.exception)

Removed from v.1.13.2.2  
changed lines
  Added in v.1.18.4.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>