--- libaitsched/inc/defs.h 2011/08/05 15:52:00 1.1 +++ libaitsched/inc/defs.h 2012/08/23 02:09:54 1.8.6.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: defs.h,v 1.1 2011/08/05 15:52:00 misho Exp $ +* $Id: defs.h,v 1.8.6.2 2012/08/23 02:09:54 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 +Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,20 +47,52 @@ SUCH DAMAGE. #define __DEFS_H +#ifndef STRSIZ #define STRSIZ 256 -#define KQ_EVENTS 24 -#define MAX_EVENTLO_MISS 48 +#endif +#define KQ_EVENTS 32 +#define MAX_TASK_MISS 12 + #define LOGERR { \ sched_Errno = errno; \ strlcpy(sched_Error, strerror(errno), STRSIZ); \ } +#define sched_timespecclear(tsp) ((tsp)->tv_sec = (tsp)->tv_nsec = 0) +#define sched_timespecinf(tsp) ((tsp)->tv_sec = (tsp)->tv_nsec = -1) +#define sched_timespecisinf(tsp) ((tsp)->tv_sec == -1 && (tsp)->tv_nsec == -1) +#define sched_timespecisset(tsp) (((tsp)->tv_sec && (tsp)->tv_sec != -1) || \ + ((tsp)->tv_nsec && (tsp)->tv_nsec != -1)) +#define sched_timespeccmp(tsp, usp, cmp) \ + (((tsp)->tv_sec == (usp)->tv_sec) ? \ + ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \ + ((tsp)->tv_sec cmp (usp)->tv_sec)) +#define sched_timespecadd(tsp, usp, vsp) \ + do { \ + (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \ + (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \ + if ((vsp)->tv_nsec >= 1000000000L) { \ + (vsp)->tv_sec++; \ + (vsp)->tv_nsec -= 1000000000L; \ + } \ + } while (0) +#define sched_timespecsub(tsp, usp, vsp) \ + do { \ + (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ + (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ + if ((vsp)->tv_nsec < 0) { \ + (vsp)->tv_sec--; \ + (vsp)->tv_nsec += 1000000000L; \ + } \ + } while (0) extern int sched_Errno; extern char sched_Error[]; -inline void sched_SetErr(int eno, char *estr, ...); +inline void sched_SetErr(int, char *, ...); + +void *_sched_threadWrapper(sched_task_t *); #endif