size_t scheduler_data_size, void * init_args,
size_t init_args_size)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
int fosa_thread_attr_set_appscheduled(fosa_thread_attr_t *attr,
bool appscheduled)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
int fosa_thread_attr_get_appscheduled(const fosa_thread_attr_t *attr,
bool *appscheduled)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
const void *param,
size_t paramsize)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
int fosa_thread_attr_get_appsched_params(const fosa_thread_attr_t *attr,
void *param, size_t *paramsize)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
**/
int fosa_ads_set_appscheduled(fosa_thread_id_t thread, bool appscheduled)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
**/
int fosa_ads_get_appscheduled(fosa_thread_id_t thread, bool *appscheduled)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
int fosa_ads_set_appsched_params(fosa_thread_id_t thread,
const void *param, size_t paramsize)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
int fosa_ads_get_appsched_params(fosa_thread_id_t thread,
void *param, size_t *paramsize)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
int fosa_adsactions_add_reject(fosa_ads_actions_t *sched_actions,
fosa_thread_id_t thread)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
fosa_thread_id_t thread,
fosa_ads_urgency_t urgency)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
int fosa_adsactions_add_suspend(fosa_ads_actions_t *sched_actions,
fosa_thread_id_t thread)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
fosa_clock_id_t clock_id,
const fosa_abs_time_t *at_time)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
fosa_clock_id_t clock_id,
const fosa_abs_time_t *at_time)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
**/
int fosa_ads_set_handled_signal_set(fosa_signal_t set[], int size)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
**/
int fosa_signal_queue_scheduler(fosa_signal_t signal, fosa_signal_info_t info)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
/**
int fosa_ads_invoke_withdata(const void *msg, size_t msg_size,
void *reply, size_t *reply_size)
{
- return -EINVAL;
+ return FOSA_EINVAL;
}
* notify it to the system console and then terminate the FRSH
* implementation and dependant applications
**/
-int fosa_rel_timer_arm (fosa_timer_id_t timerid, const fosa_rel_time_t *value)
+int fosa_rel_timer_arm(fosa_timer_id_t timerid, const fosa_rel_time_t *value)
{
struct itimerspec when;
struct itimerspec when;
/* non-periodic one shot timer */
- when.it_value= fosa_abs_time_to_timespec(*value);
- when.it_interval=zero_time;
+ when.it_value = fosa_abs_time_to_timespec(*value);
+ when.it_interval = zero_time;
return timer_settime(timerid, TIMER_ABSTIME, &when, NULL);
}
int ret;
struct itimerspec time;
- if (remaining_time == NULL)
+ if (!remaining_time)
return FOSA_EINVAL;
ret = timer_gettime(timerid, &time);
int ret;
struct itimerspec time;
- if (remaining_time == NULL)
+ if (!remaining_time)
return FOSA_EINVAL;
ret = timer_gettime(timerid, &time);
* Thread attributes
*************************/
+static inline int __fosa_check_thread(const fosa_thread_id_t *tid)
+{
+ if (tid->linux_pid == tid->linux_tid)
+ return 0;
+
+ return 1;
+}
+
/**
* fosa_thread_attr_init()
*
**/
int fosa_thread_attr_init(fosa_thread_attr_t *attr)
{
- fosa_thread_id_t self;
-
- /* only POSIX threads have attributes */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
-
return pthread_attr_init(attr);
}
**/
int fosa_thread_attr_destroy(fosa_thread_attr_t *attr)
{
- fosa_thread_id_t self;
-
- /* only POSIX threads can have attributes */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
-
return pthread_attr_destroy(attr);
}
int fosa_thread_attr_set_stacksize(fosa_thread_attr_t *attr,
size_t stacksize)
{
- fosa_thread_id_t self;
-
- /* only POSIX threads can set the size of the stack */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
-
return pthread_attr_setstacksize(attr, stacksize);
}
int fosa_thread_attr_get_stacksize(const fosa_thread_attr_t *attr,
size_t *stacksize)
{
- fosa_thread_id_t self;
-
- /* only POSIX threads can set the size of the stack */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
-
return pthread_attr_getstacksize(attr, stacksize);
}
{
int i, error = 0;
bool found = false;
- fosa_thread_id_t self;
-
- /* only POSIX threads can have specific data */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
if ((error = pthread_mutex_lock(&key_lock)) != 0)
return error;
int fosa_key_destroy(int key)
{
int error;
- fosa_thread_id_t self;
-
- /* only POSIX threads can have specific data */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
if ((error = pthread_mutex_lock(&key_lock)) != 0)
return error;
fosa_thread_id_t tid,
const void * value)
{
- fosa_thread_id_t self;
-
/* only POSIX threads can have specific data */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
+ if (!__fosa_check_thread(&tid))
return EINVAL;
return pthread_setspecific(key_list[key], value);
fosa_thread_id_t tid,
void ** value)
{
- fosa_thread_id_t self;
-
/* only POSIX threads can have specific data */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
+ if (!__fosa_check_thread(&tid))
return EINVAL;
if ((value = pthread_getspecific(key_list[key])) != NULL)
int fosa_thread_attr_set_prio(fosa_thread_attr_t *attr, int prio)
{
int error;
- fosa_thread_id_t self;
struct sched_param param;
- /* normal UNIX processes have no attributes */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
-
param.sched_priority = prio;
if ((error = pthread_attr_setschedpolicy(attr, SCHED_RR)) == 0)
return error;
int fosa_thread_attr_get_prio(const fosa_thread_attr_t *attr, int *prio)
{
int error;
- fosa_thread_id_t self;
struct sched_param param;
- /* normal UNIX processes have no attributes */
- self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
- return EINVAL;
-
if ((error = pthread_attr_getschedparam(attr, ¶m)) == 0)
*prio = param.sched_priority;
{
struct sched_param param;
- param.sched_priority=prio;
-
+ param.sched_priority = prio;
return sched_setscheduler(0, SCHED_RR, ¶m);
}
int fosa_thread_get_prio(fosa_thread_id_t tid, int *prio)
{
struct sched_param param;
- int error;
+ int ret;
- error = sched_getparam(0, ¶m);
+ ret = sched_getparam(0, ¶m);
*prio = param.sched_priority;
- return error;
+ return ret;
}
/*******************************************************************
}
self = fosa_thread_self();
- if (self.linux_pid == self.linux_tid)
+ if (__fosa_check_thread(&self))
return pthread_sigmask(SIG_BLOCK, &sigset, NULL);
else
return sigprocmask(SIG_BLOCK, &sigset, NULL);