From: faggioli Date: Tue, 27 Jan 2009 15:17:44 +0000 (+0000) Subject: Final update to phase II API. X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/fosa.git/commitdiff_plain/2b1888e9e9cf93447b9f156e12c9c2685a428789 Final update to phase II API. git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@1496 35b4ef3e-fd22-0410-ab77-dab3279adceb --- diff --git a/src_aquosa/Makefile b/src_aquosa/Makefile index 0e4f352..8115b60 100644 --- a/src_aquosa/Makefile +++ b/src_aquosa/Makefile @@ -12,10 +12,10 @@ # Here we define FRSHPATH, IPATH, OBJOPT, LPATH, EXTRALIBS, CFLAGS, LDFLAGS -PLATFORM = AQuoSA - include ../../frsh/frsh_rules.mk +PLATFORM=AQuoSA + # Add AQuoSA needed stuff for the code to compile successfully # this should be parametric !! @@ -40,11 +40,11 @@ OBJOPT += -fPIC STATIC_NAME = libfosa_qres.a SHARED_NAME = libfosa_qres.so -SRC = fosa_clocks_and_timers.c fosa_threads_and_signals.c fosa_mutexes_and_condvars.c fosa_time.c +SRC = fosa_clocks_and_timers.c fosa_long_jump.c fosa_threads_and_signals.c fosa_mutexes_and_condvars.c fosa_time.c fosa_platform_values.c fosa_app_def_sched.c fosa_group_clocks.c PUBLIC_H_FOSA = fosa_app_def_sched.h fosa.h fosa_opaque_types.h fosa_clocks_and_timers.h \ fosa_configuration_parameters.h fosa_mutexes_and_condvars.h fosa_threads_and_signals.h \ - fosa_types.h + fosa_types.h fosa_group_clocks.h PUBLIC_H_FRSH_FOSA = diff --git a/src_aquosa/fosa_app_def_sched.c b/src_aquosa/fosa_app_def_sched.c new file mode 100644 index 0000000..ec22b9a --- /dev/null +++ b/src_aquosa/fosa_app_def_sched.c @@ -0,0 +1,630 @@ +// ----------------------------------------------------------------------- +// Copyright (C) 2006 - 2008 FRESCOR consortium partners: +// +// Universidad de Cantabria, SPAIN +// University of York, UK +// Scuola Superiore Sant'Anna, ITALY +// Kaiserslautern University, GERMANY +// Univ. Politécnica Valencia, SPAIN +// Czech Technical University in Prague, CZECH REPUBLIC +// ENEA SWEDEN +// Thales Communication S.A. FRANCE +// Visual Tools S.A. SPAIN +// Rapita Systems Ltd UK +// Evidence ITALY +// +// See http://www.frescor.org for a link to partners' websites +// +// FRESCOR project (FP6/2005/IST/5-034026) is funded +// in part by the European Union Sixth Framework Programme +// The European Union is not liable of any use that may be +// made of this code. +// +// +// based on previous work (FSF) done in the FIRST project +// +// Copyright (C) 2005 Mälardalen University, SWEDEN +// Scuola Superiore S.Anna, ITALY +// Universidad de Cantabria, SPAIN +// University of York, UK +// +// FSF API web pages: http://marte.unican.es/fsf/docs +// http://shark.sssup.it/contrib/first/docs/ +// +// This file is part of FOSA (Frsh Operating System Adaption) +// +// FOSA is free software; you can redistribute it and/or modify it +// under terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any +// later version. FOSA is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. You should have received a +// copy of the GNU General Public License along with FOSA; see file +// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, +// Cambridge, MA 02139, USA. +// +// As a special exception, including FOSA header files in a file, +// instantiating FOSA generics or templates, or linking other files +// with FOSA objects to produce an executable application, does not +// by itself cause the resulting executable application to be covered +// by the GNU General Public License. This exception does not +// however invalidate any other reasons why the executable file might be +// covered by the GNU Public License. +// ----------------------------------------------------------------------- +//fosa_app_def_sched.h +//============================================== +// ******** ****** ******** ********** +// **///// /** ** **////// /** /** +// ** /** ** /** /** /** +// ******* /** ** /********* /********** +// **//// /** ** ////////** /**//////** +// ** /** ** /** /** /** +// ** /** ** ******** /** /** +// // /******/ //////// // // +// +// FOSA(Frescor Operating System Adaptation layer) +//================================================ +#include "fosa.h" + + +/*************************************************************** + * Application-defined scheduling not implemented in POSIX/Linux + **************************************************************/ + +/** + * fosa_ads_scheduler_create() + * + * Create the application defined scheduler + * + * The application defined scheduler is created with the primitive + * operations specified in the object pointed to by scheduler_ops. + * + * The clock used to read the time immediately before the invocation + * of each primitive operation, to be reported to the scheduler via + * the current_time parameter of each primitive operation is the + * FOSA_CLOCK_REALTIME clock. + * + * The scheduler_data_size parameter is used to request that a memory + * area of this size must be created and reserved for the scheduler to + * store its state. A pointer to this area is passed to the scheduler + * operations in the sched_data parameter. + * + * Parameter init_arg points to an area that contains configuration + * information for the scheduler. The function creates a memory area + * of init_arg_size bytes and copies into it the area pointed by + * arg. A pointer to this new created area will be passed to the + * primitive operation init() in its arg parameter. + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of scheduler_ops was invalid + * EAGAIN: The system lacks enough resources to create the scheduler + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + * + * The fosa_ads_scheduler_create function must be called before any + * other function in this header file + **/ +int fosa_ads_scheduler_create(const fosa_ads_scheduler_ops_t * scheduler_ops, + size_t scheduler_data_size, void * init_args, + size_t init_args_size) +{ + return -EINVAL; +} + +/** + * fosa_thread_attr_set_appscheduled() + * + * Set the appscheduled attribute of a thread attributes object + * + * This function is used to set the appscheduled attribute in the + * object pointed to by attr. This attribute controls the kind of + * scheduling used for threads created with it. If true, the thread is + * scheduled by the application scheduler. If not, it is scheduled by + * the system under a fixed priority scheduler + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of attr is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_thread_attr_set_appscheduled(fosa_thread_attr_t *attr, + bool appscheduled) +{ + return -EINVAL; +} + +/** + * fosa_thread_attr_get_appscheduled() + * + * Get the appscheduled attribute of a thread attributes object + * + * This function is used to get the appscheduled attribute in the + * object pointed to by attr. This attribute controls the kind of + * scheduling used for threads created with it. If true, the thread is + * scheduled by the application scheduler. If not, it is scheduled by + * the system under a fixed priority scheduler. + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of attr is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_thread_attr_get_appscheduled(const fosa_thread_attr_t *attr, + bool *appscheduled) +{ + return -EINVAL; +} + +/** + * fosa_thread_attr_set_appsched_params() + * + * Set the appsched_param attribute of a thread attributes object + * + * This function is used to set the appsched_param attribute in the + * object pointed to by attr. For those threads with appscheduled set + * to true, this attribute represents the application-specific + * scheduling parameters. If successful, the function shall set the + * size of the appsched_param attribute to the value specified by + * paramsize, and shall copy the scheduling parameters occupying + * paramsize bytes and pointed to by param into that attribute + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of attr is invalid, or paramsize is less than + * zero or larger than FOSA_ADS_SCHEDPARAM_MAX + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_thread_attr_set_appsched_params(fosa_thread_attr_t *attr, + const void *param, + size_t paramsize) +{ + return -EINVAL; +} + +/** + * fosa_thread_attr_get_appsched_params() + * + * Get the appsched_param attribute of a thread attributes object + * + * This function is used to get the appsched_param attribute from the + * object pointed to by attr. For those threads with appscheduled set + * to true, this attribute represents the application-specific + * scheduling parameters. If successful, the function shall set the + * value pointed to by paramsize to the size of the appsched_param + * attribute, and shall copy the scheduling parameters occupying + * paramsize bytes into the variable pointed to by param. This + * variable should be capable of storing a number of bytes equal to + * paramsize. + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of attr is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_thread_attr_get_appsched_params(const fosa_thread_attr_t *attr, + void *param, size_t *paramsize) +{ + return -EINVAL; +} + +/** + * fosa_ads_set_appscheduled() + * + * Dynamically set the appscheduled attribute of a thread + * + * This function is used to dynamically set the appscheduled attribute + * of the thread identified by thread. This attribute controls the + * kind of scheduling used for threads created with it. If true, the + * thread is scheduled by the application scheduler. If not, it is + * scheduled by the system under a fixed priority scheduler. + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of thread is invalid + * + * EREJECT: the attachment of the thread to the frsh schehduler + * was rejected by the frsh scheduler possibly because of + * incorrect attributes, or because the requested minimum + * capacity cannot be guaranteed + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_ads_set_appscheduled(fosa_thread_id_t thread, bool appscheduled) +{ + return -EINVAL; +} + +/** + * fosa_ads_getappscheduled() + * + * Dynamically get the appscheduled attribute of a thread + * + * This function is used to dynamically get the appscheduled attribute + * of the thread identified by thread. This attribute controls the + * kind of scheduling used for threads created with it. If true, the + * thread is scheduled by the application scheduler. If not, it is + * scheduled by the system under a fixed priority scheduler + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of thread is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_ads_get_appscheduled(fosa_thread_id_t thread, bool *appscheduled) +{ + return -EINVAL; +} + + +/** + * fosa_ads_setappschedparam() + * + * Dynamically set the appsched_param attribute of a thread + * + * This function is used to dynamically set the appsched_param + * attribute of the thread identified by thread. For those threads + * with appscheduled set to true, this attribute represents the + * application-specific scheduling parameters. If successful, the + * function shall set the size of the appsched_param attribute to the + * value specified by paramsize, and shall copy the scheduling + * parameters occupying paramsize bytes and pointed to by param into + * that attribute + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of thread is invalid, or paramsize is less than + * zero or larger than FOSA_ADS_SCHEDPARAM_MAX + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_ads_set_appsched_params(fosa_thread_id_t thread, + const void *param, size_t paramsize) +{ + return -EINVAL; +} + +/** + * fosa_ads_get_appsched_params() + * + * Dynamically get the appsched_param attribute of a thread + * + * This function is used to dynamically get the appsched_param + * attribute of the thread identified by thread. For those threads + * with appscheduled set to true, this attribute represents the + * application-specific scheduling parameters. If successful, the + * function shall set the variable pointed to by paramsize to the size + * of the appsched_param attribute, and shall copy the scheduling + * parameters occupying paramsize bytes into the variable pointed to + * by param. This variable should be capable of storing a number of + * bytes equal to paramsize. + * + * Returns 0 if successful; otherwise it returns an error code: + * EINVAL: The value of thread is invalid, or paramsize is less than + * zero or larger than FOSA_ADS_SCHEDPARAM_MAX + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications. + **/ +int fosa_ads_get_appsched_params(fosa_thread_id_t thread, + void *param, size_t *paramsize) +{ + return -EINVAL; +} + + +/********************************* + * ADS actions + * + * A scheduling actions object is used to specify a series of actions + * to be performed by the system at the end of a scheduler primitive + * operation. The order of the actions added to the object shall be + * preserved. + * + *********************************/ + +/** + * fosa_adsactions_add_reject() + * + * Add a reject-thread action + * + * This function adds a thread-reject action to the object referenced + * by sched_actions, that will serve to notify that the thread + * identified by thread has not been accepted by the scheduler to be + * scheduled by it, possibly because the thread contained invalid + * application scheduling attributes, or because there are not enough + * resources for the new thread. At the end of the new_thread() + * scheduler primitive operation, the parent of the rejected thread + * waiting on a fosa_thread_create() or the rejected thread itself + * waiting on a fosa_ads_set_appscheduled() function shall complete the + * function with an error code of EREJECT. If no reject-thread action + * is added during the new_thread() scheduler primitive operation, the + * thread is accepted to be scheduled by the scheduler and the + * associated fosa_thread_create() or the fosa_ads_set_appscheduled() + * function shall be completed without error. For the function to + * succeed, it has to be called from the new_thread() primitive + * operation and for the thread that is requesting attachment to the + * scheduler. + * + * Returns 0 if successful; otherwise it returns an error code: + * ENOMEM: There is insufficient memory to add this action + * FOSA_EPOLICY: The thread specified by thread is not the one requesting + * attachment to the scheduler, or the function is not being + * called from the new_thread primitive operation + * EINVAL: The value specified by sched_actions is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_adsactions_add_reject(fosa_ads_actions_t *sched_actions, + fosa_thread_id_t thread) +{ + return -EINVAL; +} + +/** + * fosa_adsactions_add_activate() + * + * Add a thread-activate action + * + * This function adds a thread-activate action to the object + * referenced by sched_actions. In case the thread had been previously + * suspended via posix_appsched_actions_addsuspend(), it will be + * activated at the end of the primitive operation. + * + * In those implementations that do not support urgency scheduling, + * the urgencu value is ignored. These implementations cannot support + * the frsh hierarchical scheduling module. + * + * In those implementations supporting urgency-scheduling, the action + * will cause the change of the urgency of the thread to the value + * specified in the urgency argument. Besides, if the thread was + * already active at the time the thread-activate action is executed, + * the change or urgency will imply a reordering of the thread in its + * priority queue, so that for threads of the same priority, those + * with more urgency will be scheduled before those of less urgency. + * + * Returns 0 if successful; otherwise it returns an error code: + * ENOMEM: There is insufficient memory to add this action + * FOSA_EPOLICY: The thread specified by thread has its appscheduled + * attribute set to false, + * EINVAL: The value specified by sched_actions is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_adsactions_add_activate(fosa_ads_actions_t *sched_actions, + fosa_thread_id_t thread, + fosa_ads_urgency_t urgency) +{ + return -EINVAL; +} + +/** + * fosa_adsactions_add_suspend() + * + * Add a thread-suspend action + * + * This function adds a thread-suspend action to the object referenced + * by sched_actions, that will cause the thread identified by thread + * to be suspended waiting for a thread-activate action at the end of + * the scheduler operation. If the thread was already waiting for a + * thread-activate action the thread-suspend action has no effect. It + * is an error trying to suspend a thread that is blocked by the + * operating system. + * + * Returns 0 if successful; otherwise it returns an error code: + * ENOMEM: There is insufficient memory to add this action + * FOSA_EPOLICY: The thread specified by thread has its appscheduled + * attribute set to false, + * EINVAL: The value specified by sched_actions is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_adsactions_add_suspend(fosa_ads_actions_t *sched_actions, + fosa_thread_id_t thread) +{ + return -EINVAL; +} + +/** + * fosa_adsactions_add_timeout() + * + * Add a timeout action + * + * This function adds a timeout action to the object referenced by + * sched_actions, that will cause the timeout() scheduler operation to + * be invoked if no other scheduler operation is invoked before + * timeout expires. The timeout shall expire when the clock specified by + * clock_id reaches the absolute time specified by the at_time + * argument. + * + * Returns 0 if successful; otherwise it returns an error code: + * ENOMEM: There is insufficient memory to add this action + * EINVAL: The value specified by sched_actions is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_adsactions_add_timeout(fosa_ads_actions_t *sched_actions, + fosa_clock_id_t clock_id, + const fosa_abs_time_t *at_time) +{ + return -EINVAL; +} + +/** + * fosa_adsactions_add_thread_notification() + * + * Add a timed-thread-notification action + * + * This function adds a thread-notification action associated with the + * thread specified in the thread argument that will cause the + * notification_for_thread() scheduler operation to be invoked at the + * time specified by at_time. This operation shall be invoked when the + * clock specified by clock_id reaches the absolute time specified by + * the at_time argument. In particular, a cpu-time clock may be used + * for parameter clock_id.Only one thread-notification can be active + * for each thread and clock. Calling the function shall remove the + * former thread-notification, if any, that had been programmed for + * the same thread and clock. A value of NULL for parameter at_time is + * used to cancel a previous thread-notification, if any, for the + * thread specified by thread and the clock specified by clock_id. + * + * Returns 0 if successful; otherwise it returns an error code: + * ENOMEM: There is insufficient memory to add this action + * FOSA_EPOLICY: The thread specified by thread has its appscheduled + * attribute set to false, + * EINVAL: The value specified by sched_actions is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_adsactions_add_thread_notification(fosa_ads_actions_t *sched_actions, + fosa_thread_id_t thread, + fosa_clock_id_t clock_id, + const fosa_abs_time_t *at_time) +{ + return -EINVAL; +} + + +/** + * fosa_ads_set_handled_signal_set() + * + * Specifiy the set of signals that will be handled by the application + * scheduler + * + * This function is used to dynamically set the set of signals that + * are handled by the application scheduler. When a signal included + * in this set is generated, the signal() primitive operation of the + * application scheduler shall be executed. When a signal in tis set + * is generated, it shall always imply the execution of the signal() + * primitive operation, regardless of whether that signal could be + * accepted by some other thread. Once the signal() primitive + * operation is executed the signal is consumed, so no signal handlers + * shall be executed and no threads using a sigwait operation shall + * return for that particular signal instance. For this function to + * succeed, it has to be called from a primitive operation of a + * scheduler. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EPOLICY: The function has not been called from a scheduler + * primitive operation + * EINVAL: The value specified by set is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_ads_set_handled_signal_set(fosa_signal_t set[], int size) +{ + return -EINVAL; +} + + +/** + * fosa_signal_queue_scheduler() + * + * Queue a signal destinated to the scheduler + * + * This is a special case of fosa_signal_queue() in which the + * destinator is the scheduler itself. It is needed by the service + * thread to notify the results to the scheduler. + * + * The problem with this case is that, depending on the implementation, + * this call would be translated to a true signal or to a scheduler + * notification message. + * + * Besides for the scheduler we don't have always a destinator + * thread_id needed in fosa_signal_queue for OSE. + * + * So the fosa implementation will solve this issue internally. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: the signal specified by signal is not + * between FOSA_SIGNAL_MIN and FOSA_SIGNAL_MAX + * + * FOSA_EAGAIN: no resources are available to queue the signal; the + * maximum number of queued signals has been reached, or a + * systemwide resource limit has been exceeded + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_signal_queue_scheduler(fosa_signal_t signal, fosa_signal_info_t info) +{ + return -EINVAL; +} + +/** + * fosa_ads_invoke_withdata() + * + * Explicitly invoke the scheduler, with data + * + * This function can be used by any thread in the process to invoke + * the ads scheduler or to share data with it. + * + * If successful, the function shall cause the execution of the + * primitive operation explicit_call_with_data() of the ads scheduler + * with its thread parameter equal to the thread ID of the calling + * thread, and its msg_size parameter equal to msg_size. In addition, + * if msg_size is larger than zero, the function shall make available + * to the scheduler a memory area whose contents are identical to the + * memory area pointed to by msg in the msg parameter of the + * explicit_call_with_data() primitive operation (note that copying + * the information is not needed). + * + * The function shall not return until the system has finished + * execution of the explicit_call_with_data() primitive operation. If + * the reply argument is non NULL, the memory area pointed to by the + * reply parameter of explicit_call_with_data() primitive operation is + * copied into the memory area pointed to by reply, and its size is + * copied into the variable pointed to by reply_size. The size of the + * reply information is limited to the value FOSA_ADS_SCHEDINFO_MAX. + * + * The function shall fail if the size specified by msg_size is larger + * than FOSA_ADS_SCHEDINFO_MAX. The function shall fail if primitive + * operation explicit_call_with_data() is set to NULL for the ads + * scheduler. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EPOLICY: The function been called from inside a scheduler + * primitive operation + * EINVAL: The value of msg_size is less than zero or larger than + * FOSA_ADS_SCHEDINFO_MAX + * FOSA_EMASKED: The operation cannot be executed because the primitive + * operation explicit_call_with_data() is set to NULL + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_ads_invoke_withdata(const void *msg, size_t msg_size, + void *reply, size_t *reply_size) +{ + return -EINVAL; +} + diff --git a/src_aquosa/fosa_clocks_and_timers.c b/src_aquosa/fosa_clocks_and_timers.c index 756d0a8..9dae54c 100644 --- a/src_aquosa/fosa_clocks_and_timers.c +++ b/src_aquosa/fosa_clocks_and_timers.c @@ -61,6 +61,9 @@ #include "fosa_time.h" #include "fosa_clocks_and_timers.h" +static const struct timespec zero_time={0,0}; + + /************************* * Timing: Clocks *************************/ @@ -81,15 +84,13 @@ int fosa_clock_get_time(fosa_clock_id_t clockid, fosa_abs_time_t *current_time) { - int error; + int ret; struct timespec current_time_tspec; - if ((error = clock_gettime(clockid, ¤t_time_tspec)) != 0) - return error; - + ret = clock_gettime(clockid, ¤t_time_tspec); *current_time = fosa_timespec_to_abs_time(current_time_tspec); - return 0; + return ret; } /** @@ -108,11 +109,11 @@ int fosa_thread_get_cputime_clock(fosa_thread_id_t tid, { if (tid.linux_pid == tid.linux_tid) { /* standard UNIX process */ - *clockid = FOSA_CLOCK_REALTIME; - return 0; - } else + return clock_getcpuclockid(tid.linux_pid, clockid); + } else { /* POSIX thread */ return pthread_getcpuclockid(tid.pthread_id, clockid); + } } /************************* @@ -156,7 +157,6 @@ int fosa_timer_create(fosa_clock_id_t clockid, event.sigev_notify = SIGEV_SIGNAL; event.sigev_signo = signal; - //event.sigev_value.sival_int = info.sival_int; event.sigev_value = *((union sigval*) &info); return timer_create(clockid, &event, timerid); @@ -171,9 +171,6 @@ int fosa_timer_create(fosa_clock_id_t clockid, * except that the signal generated when the timer expires is sent to * the thread specified by receiver * - * In this implementation, since in POSIX we can not specify a receiver, - * always returns ENOSYS. - * * You have to use the "simple" fosa_timer_create. **/ int fosa_timer_create_with_receiver(fosa_clock_id_t clockid, @@ -182,9 +179,15 @@ int fosa_timer_create(fosa_clock_id_t clockid, fosa_timer_id_t *timerid, fosa_thread_id_t receiver) { - /* in POSIX the receiver thread cannot be specified!! */ - //return fosa_timer_create(clockid, signal, info, timerid); - return ENOSYS; + struct sigevent event; + + event.sigev_notify = SIGEV_SIGNAL; + event.sigev_signo = signal; + event.sigev_value = *((union sigval*) &info); + event.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL; + event._sigev_un._tid = receiver.linux_tid; + + return timer_create(clockid, &event, timerid); } /** @@ -203,21 +206,18 @@ int fosa_timer_delete(fosa_timer_id_t timerid) } /** - * fosa_timer_arm() + * fosa_rel_timer_arm() * - * Arm a timer + * Arm a timer with a relative time interval * * The timer specified by timer is armed and starts counting time. * - * If abstime is true, the value pointed to by value is the absolute - * time at which the timer will expire. If value specifies a time instant - * in the past, the timer expires immediately. - * - * If abstime is false, the value pointed to by value is the relative interval - * that must elapse for the timer to expire. + * The value pointed to by value is the relative interval that must + * elapse for the timer to expire. Negative values cause the timer to + * expire immediately. * - * In both cases, absolute or relative, the time is measured with the clock - * associated with the timer when it was created. + * The time is measured with the clock associated with the timer when + * it was created. * * If the timer was already armed, the previous time or interval is discarded * and the timer is rearmed with the new value. @@ -225,23 +225,59 @@ int fosa_timer_delete(fosa_timer_id_t timerid) * When the timer expires, it is disarmed. * * Returns 0 if successful; otherwise it returns an error code: - * EINVAL: the value of timerid or value is invalid + * FOSA_EINVAL: the value of timerid or value is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications **/ -int fosa_timer_arm (fosa_timer_id_t timerid, - bool abstime, - const fosa_abs_time_t *value) +int fosa_rel_timer_arm (fosa_timer_id_t timerid, const fosa_rel_time_t *value) { struct itimerspec when; - /* non-periodic one shot timer configuration */ + /* non-periodic one shot timer */ when.it_value = fosa_abs_time_to_timespec(*value); - when.it_interval.tv_sec = 0; - when.it_interval.tv_nsec = 0; + when.it_interval = zero_time; - return timer_settime(timerid, - (abstime ? TIMER_ABSTIME : 0), - &when, - NULL); + return timer_settime(timerid, 0, &when, NULL); +} + + +/** + * fosa_abs_timer_arm() + * + * Arm a timer that will expire in an absolute time instant. + * + * The timer specified by timer is armed and starts counting time. + * + * The value pointed to by value is the absolute time at which the + * timer will expire. If value specifies a time instant in the past, + * the timer expires immediately. + * + * The time is measured with the clock associated with the timer when + * it was created. + * + * If the timer was already armed, the previous time or interval is discarded + * and the timer is rearmed with the new value. + * + * When the timer expires, it is disarmed. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: the value of timerid or value is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_abs_timer_arm(fosa_timer_id_t timerid, const fosa_abs_time_t *value) +{ + struct itimerspec when; + + /* non-periodic one shot timer */ + when.it_value= fosa_abs_time_to_timespec(*value); + when.it_interval=zero_time; + + return timer_settime(timerid, TIMER_ABSTIME, &when, NULL); } /** @@ -261,18 +297,16 @@ int fosa_timer_arm (fosa_timer_id_t timerid, int fosa_timer_get_remaining_time(fosa_timer_id_t timerid, fosa_rel_time_t *remaining_time) { - int error; + int ret; struct itimerspec time; - if (remaining_time != NULL) { - if ((error = timer_gettime(timerid, &time)) == -1) - return error; + if (remaining_time == NULL) + return FOSA_EINVAL; - *remaining_time = fosa_timespec_to_rel_time(time.it_value); - } else - return EINVAL; + ret = timer_gettime(timerid, &time); + *remaining_time = fosa_timespec_to_rel_time(time.it_value); - return 0; + return ret; } /** @@ -294,19 +328,20 @@ int fosa_timer_get_remaining_time(fosa_timer_id_t timerid, int fosa_timer_disarm(fosa_timer_id_t timerid, struct timespec *remaining_time) { - int error; + int ret; struct itimerspec time; - if (remaining_time != NULL) { - if ((error = timer_gettime(timerid, &time)) == -1) - return error; - - *remaining_time = fosa_timespec_to_rel_time(time.it_value); - } + if (remaining_time == NULL) + return FOSA_EINVAL; - time.it_value.tv_sec = 0; - time.it_value.tv_nsec = 0; + ret = timer_gettime(timerid, &time); + *remaining_time = fosa_timespec_to_rel_time(time.it_value); + if (ret < 0) + return ret; + time.it_value = zero_time; + time.it_interval = zero_time; + return timer_settime(timerid, 0, &time, NULL); } diff --git a/src_aquosa/fosa_group_clocks.c b/src_aquosa/fosa_group_clocks.c new file mode 100644 index 0000000..6b96063 --- /dev/null +++ b/src_aquosa/fosa_group_clocks.c @@ -0,0 +1,189 @@ +// ----------------------------------------------------------------------- +// Copyright (C) 2006 - 2008 FRESCOR consortium partners: +// +// Universidad de Cantabria, SPAIN +// University of York, UK +// Scuola Superiore Sant'Anna, ITALY +// Kaiserslautern University, GERMANY +// Univ. Politécnica Valencia, SPAIN +// Czech Technical University in Prague, CZECH REPUBLIC +// ENEA SWEDEN +// Thales Communication S.A. FRANCE +// Visual Tools S.A. SPAIN +// Rapita Systems Ltd UK +// Evidence ITALY +// +// See http://www.frescor.org for a link to partners' websites +// +// FRESCOR project (FP6/2005/IST/5-034026) is funded +// in part by the European Union Sixth Framework Programme +// The European Union is not liable of any use that may be +// made of this code. +// +// +// based on previous work (FSF) done in the FIRST project +// +// Copyright (C) 2005 Mälardalen University, SWEDEN +// Scuola Superiore S.Anna, ITALY +// Universidad de Cantabria, SPAIN +// University of York, UK +// +// FSF API web pages: http://marte.unican.es/fsf/docs +// http://shark.sssup.it/contrib/first/docs/ +// +// This file is part of FOSA (Frsh Operating System Adaption) +// +// FOSA is free software; you can redistribute it and/or modify it +// under terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any +// later version. FOSA is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. You should have received a +// copy of the GNU General Public License along with FOSA; see file +// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, +// Cambridge, MA 02139, USA. +// +// As a special exception, including FOSA header files in a file, +// instantiating FOSA generics or templates, or linking other files +// with FOSA objects to produce an executable application, does not +// by itself cause the resulting executable application to be covered +// by the GNU General Public License. This exception does not +// however invalidate any other reasons why the executable file might be +// covered by the GNU Public License. +// ----------------------------------------------------------------------- +//fosa_group_clocks.c +//============================================== +// ******** ****** ******** ********** +// **///// /** ** **////// /** /** +// ** /** ** /** /** /** +// ******* /** ** /********* /********** +// **//// /** ** ////////** /**//////** +// ** /** ** /** /** /** +// ** /** ** ******** /** /** +// // /******/ //////// // // +// +// FOSA(Frescor Operating System Adaptation layer) +//================================================ + + +#include "fosa_group_clocks.h" + +/** + * fosa_thread_set_create() + * + * Create an empty thread set and return an identifier + * + * This function stores in the variable pointed to by set the + * identifier of a thread set that is created by the function. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EAGAIN: no resources are currently available to create the + * thread set + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_thread_set_create(fosa_thread_set_id_t *set) +{ + return -EINVAL; +} + + +/** + * fosa_thread_set_destroy() + * + * Destroy a thread set + * + * This function destroys the thread set identified by set. The + * threads that were in the set are detached from the set. It is + * an error to use the identifier after this call. The effects of + * using a CPU-time clock associated with the destroyed thread are + * undefined. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: set is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_thread_set_destroy(fosa_thread_set_id_t set) +{ + return -EINVAL; +} + + +/** + * fosa_thread_set_add() + * + * Add a thread to a thread set + * + * This function adds the thread identified with thread_id to the + * thread set identified by set. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: set is invalid + * FOSA_ENOTSUP: thread already a member of some other set + * FOSA_EAGAIN: no resources available to add the new thread + * FOSA_ESRCH: thread_id doesn't identify a valid thread + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_thread_set_add(fosa_thread_set_id_t set, fosa_thread_id_t thread_id) +{ + return -EINVAL; +} + + +/** + * fosa_thread_set_del() + * + * Delete a thread from a thread set + * + * This function deletes the thread identified with thread_id from + * the thread set identified by set. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: set is invalid + * FOSA_EINVAL: thread is not a member of the set + * FOSA_ESRCH: thread_id doesn't identify a valid thread + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ + +int fosa_thread_set_del(fosa_thread_set_id_t set, fosa_thread_id_t thread_id) +{ + return -EINVAL; +} + + +/** + * fosa_get_groupcpu_clock() + * + * Get the identifier of a cpu-time clock associated to a thread + * set + * + * This function stores in the variable pointed to by clockid the + * identifier of a cpu-time clock for the thread set specified + * by set. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: the set is invalid + * FOSA_EINVAL: clock_id is a null pointer + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + **/ +int fosa_get_groupcpu_clock(const fosa_thread_set_id_t set, + fosa_clock_id_t *clock_id) +{ + return -EINVAL; +} + diff --git a/src_aquosa/fosa_long_jump.c b/src_aquosa/fosa_long_jump.c new file mode 100644 index 0000000..829e2c7 --- /dev/null +++ b/src_aquosa/fosa_long_jump.c @@ -0,0 +1,204 @@ +// ----------------------------------------------------------------------- +// Copyright (C) 2006 - 2008 FRESCOR consortium partners: +// +// Universidad de Cantabria, SPAIN +// University of York, UK +// Scuola Superiore Sant'Anna, ITALY +// Kaiserslautern University, GERMANY +// Univ. Politécnica Valencia, SPAIN +// Czech Technical University in Prague, CZECH REPUBLIC +// ENEA SWEDEN +// Thales Communication S.A. FRANCE +// Visual Tools S.A. SPAIN +// Rapita Systems Ltd UK +// Evidence ITALY +// +// See http://www.frescor.org for a link to partners' websites +// +// FRESCOR project (FP6/2005/IST/5-034026) is funded +// in part by the European Union Sixth Framework Programme +// The European Union is not liable of any use that may be +// made of this code. +// +// +// based on previous work (FSF) done in the FIRST project +// +// Copyright (C) 2005 Mälardalen University, SWEDEN +// Scuola Superiore S.Anna, ITALY +// Universidad de Cantabria, SPAIN +// University of York, UK +// +// FSF API web pages: http://marte.unican.es/fsf/docs +// http://shark.sssup.it/contrib/first/docs/ +// +// This file is part of FOSA (Frsh Operating System Adaption) +// +// FOSA is free software; you can redistribute it and/or modify it +// under terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any +// later version. FOSA is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. You should have received a +// copy of the GNU General Public License along with FOSA; see file +// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, +// Cambridge, MA 02139, USA. +// +// As a special exception, including FOSA header files in a file, +// instantiating FOSA generics or templates, or linking other files +// with FOSA objects to produce an executable application, does not +// by itself cause the resulting executable application to be covered +// by the GNU General Public License. This exception does not +// however invalidate any other reasons why the executable file might be +// covered by the GNU Public License. +// ----------------------------------------------------------------------- +//fosa_long_jump.c +//============================================== +// ******** ****** ******** ********** +// **///// /** ** **////// /** /** +// ** /** ** /** /** /** +// ******* /** ** /********* /********** +// **//// /** ** ////////** /**//////** +// ** /** ** /** /** /** +// ** /** ** ******** /** /** +// // /******/ //////// // // +// +// FOSA(Frescor Operating System Adaptation layer) +//================================================ + + +#include "fosa.h" + +/** + * fosa_long_jump_save_context + * + * Save the context of the current thread for a future long jump + * + * This function stores in context the information required to modify + * the stack of the calling thread so that a later long jump may be + * executed in the future to restore this context + * + * This function stores in 'context' the registers and the stack + * frame of the calling thread. This information can be used by + * 'restorecontext' to change the stack of the task so that when it + * is scheduled again it returns to the end of this function + * + * Depending on the underlying implementation, the first invocation + * of this function for a given thread may also install a signal + * handler or a signal handler thread that is capable of executing + * the actions required to restore the context of a thread from the + * appropriate context. For instance, in POSIX it is necesaray that + * the context is restored from the same thread being restored, + * usually from a signal handler of that thread. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: the value of context is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + */ +int fosa_long_jump_save_context(fosa_long_jump_context_t *context) +{ + if (context == NULL) + return FOSA_EINVAL; + + sigsetjmp(*context, 1); + + return 0; +} + +/** + * fosa_long_jump_was_performed + * + * Check whether the current thread suffered a long jump or not + * + * This function should be invoked after fosa_long_jump_save_context + * to determine whether the current thread is executing normally, or + * has suffered a long jump to the point where the context was + * saved. If invoked after a direct invocation to + * fosa_long_jump_save_context, the function shall return 0. If + * invoked after returning from fosa_long_jump_save_context due to a + * call to fosa_long_jump_restore_context, the function shall return + * 1. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: the value of context is invalid + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + */ +int fosa_long_jump_was_performed(const fosa_long_jump_context_t *context, + int *jumped) +{ + return ENOSYS; +} + +/** + * Body of the long-jump handler thread + **/ +void __long_jump_handler(int n, siginfo_t *info, void *c) +{ + fosa_long_jump_context_t *context = (fosa_long_jump_context_t*)info->si_ptr; + + siglongjmp(*context, 1); +} + +/** + * fosa_long_jump_install_handler + * + * Install a long jump handler for the calling thread + * + * This function shall install a handler that is capable of causing a + * long jump operation that restores the context of a thread to a + * previously saved value. If the handler has already been installed + * for this thread the previously installed handler will be used and + * the call shall succeed. + * + * The long-jump handler is waiting for a signal to notify that a + * thread context should be restored. This signal must carry attached + * to it a pointer to the variable where the thread context was + * saved. The thread referenced in that context will have its + * internal context restored to the point where it was saved. For + * this restore operation to work properly, the program frame where + * the thread saved its context must still be valid. + * + * Depending on the implementation a given thread may also install a signal + * handler or a signal handler thread that is capable of executing + * the actions required to restore the context of a thread from the + * appropriate context. For instance, in POSIX it is necesaray that + * the context is restored from the same thread being restored, + * usually from a signal handler of that thread. + * + * The function shall store in the variable pointed to by signal the + * identifier of the signal that must be used to notify the request + * for a long jump to be executed. In the variable pointed to by + * handler, it shall store the thread id to which the signal must be + * sent. The signal must be sent with its attached information set to + * a pointer to the variable of type fosa_long_jump_context_t where + * the context of the thread to be restored was saved. + * + * Returns 0 if successful; otherwise it returns an error code: + * FOSA_EINVAL: the value of context is invalid + * FOSA_ENOMEM: there are no resources to satisfy the call at this time + * + * Alternatively, in case of error the implementation is allowed to + * notify it to the system console and then terminate the FRSH + * implementation and dependant applications + */ +int fosa_long_jump_install_handler(fosa_signal_t *signal, + fosa_thread_id_t *handler) +{ + struct sigaction sa_long_jump; + + sa_long_jump.sa_handler = NULL; + sa_long_jump.sa_sigaction = __long_jump_handler; + sigemptyset(&sa_long_jump.sa_mask); + sa_long_jump.sa_flags = SA_SIGINFO; + + handler = NULL; + + return sigaction(*signal, &sa_long_jump, NULL); +} + diff --git a/src_aquosa/fosa_platform_values.c b/src_aquosa/fosa_platform_values.c new file mode 100644 index 0000000..da350d1 --- /dev/null +++ b/src_aquosa/fosa_platform_values.c @@ -0,0 +1,89 @@ +// ----------------------------------------------------------------------- +// Copyright (C) 2006 - 2008 FRESCOR consortium partners: +// +// Universidad de Cantabria, SPAIN +// University of York, UK +// Scuola Superiore Sant'Anna, ITALY +// Kaiserslautern University, GERMANY +// Univ. Politécnica Valencia, SPAIN +// Czech Technical University in Prague, CZECH REPUBLIC +// ENEA SWEDEN +// Thales Communication S.A. FRANCE +// Visual Tools S.A. SPAIN +// Rapita Systems Ltd UK +// Evidence ITALY +// +// See http://www.frescor.org for a link to partners' websites +// +// FRESCOR project (FP6/2005/IST/5-034026) is funded +// in part by the European Union Sixth Framework Programme +// The European Union is not liable of any use that may be +// made of this code. +// +// +// based on previous work (FSF) done in the FIRST project +// +// Copyright (C) 2005 Mälardalen University, SWEDEN +// Scuola Superiore S.Anna, ITALY +// Universidad de Cantabria, SPAIN +// University of York, UK +// +// FSF API web pages: http://marte.unican.es/fsf/docs +// http://shark.sssup.it/contrib/first/docs/ +// +// This file is part of FOSA (Frsh Operating System Adaption) +// +// FOSA is free software; you can redistribute it and/or modify it +// under terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any +// later version. FOSA is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. You should have received a +// copy of the GNU General Public License along with FOSA; see file +// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, +// Cambridge, MA 02139, USA. +// +// As a special exception, including FOSA header files in a file, +// instantiating FOSA generics or templates, or linking other files +// with FOSA objects to produce an executable application, does not +// by itself cause the resulting executable application to be covered +// by the GNU General Public License. This exception does not +// however invalidate any other reasons why the executable file might be +// covered by the GNU Public License. +// ----------------------------------------------------------------------- +// +//============================================== +// ******** ****** ******** ********** +// **///// /** ** **////// /** /** +// ** /** ** /** /** /** +// ******* /** ** /********* /********** +// **//// /** ** ////////** /**//////** +// ** /** ** /** /** /** +// ** /** ** ******** /** /** +// // /******/ //////// // // +// +// FOSA(Frescor Operating System Adaptation layer) +//================================================ +#include "fosa_platform_values.h" + +/** + * fosa_get_cpu_resource_id() + * + * Obtain the cpu resource id of the current node by making use of any + * mechanism that allows to distinguish between nodes (ie MAC addresses, + * configuration parameters, etc..) + */ + +#if 1 +#include +#define DEBUG(x,args...) printf("%s: " x, __func__ , ##args) +#else +#define DEBUG(x,args...) +#endif + +int fosa_get_cpu_resource_id(fosa_resource_id_t *cpu_id) +{ + return -ENOSYS; +} + diff --git a/src_aquosa/fosa_threads_and_signals.c b/src_aquosa/fosa_threads_and_signals.c index 8b62f29..7cb0378 100644 --- a/src_aquosa/fosa_threads_and_signals.c +++ b/src_aquosa/fosa_threads_and_signals.c @@ -171,7 +171,7 @@ int fosa_thread_attr_init(fosa_thread_attr_t *attr) * pointed to by attr, and deallocate any system resources allocated for it * * Returns 0 - */ + **/ int fosa_thread_attr_destroy(fosa_thread_attr_t *attr) { fosa_thread_id_t self; @@ -198,7 +198,7 @@ int fosa_thread_attr_destroy(fosa_thread_attr_t *attr) * return 0 if successful, or the following error code: * FOSA_EINVAL: the specified stacksize value is not supported in * this implementation - */ + **/ int fosa_thread_attr_set_stacksize(fosa_thread_attr_t *attr, size_t stacksize) { @@ -221,7 +221,7 @@ int fosa_thread_attr_set_stacksize(fosa_thread_attr_t *attr, * minimum stack size stored in the thread attributes object attr. * * return 0 - */ + **/ int fosa_thread_attr_get_stacksize(const fosa_thread_attr_t *attr, size_t *stacksize) { @@ -528,19 +528,10 @@ int fosa_thread_attr_get_prio(const fosa_thread_attr_t *attr, int *prio) int fosa_thread_set_prio(fosa_thread_id_t tid, int prio) { struct sched_param param; - int error; param.sched_priority=prio; - if (tid.linux_pid == tid.linux_tid) - error = sched_setscheduler(tid.linux_pid, - SCHED_RR, - ¶m); - else - error = pthread_setschedparam(tid.pthread_id, - SCHED_RR, - ¶m); - return error; + return sched_setscheduler(0, SCHED_RR, ¶m); } /** @@ -553,18 +544,12 @@ int fosa_thread_set_prio(fosa_thread_id_t tid, int prio) * * Returns 0 **/ -int fosa_thread_get_prio (fosa_thread_id_t tid, int *prio) +int fosa_thread_get_prio(fosa_thread_id_t tid, int *prio) { struct sched_param param; - int policy, error; - - if (tid.linux_pid == tid.linux_tid) - error = sched_getparam(tid.linux_pid, ¶m); - else - error = pthread_getschedparam(tid.pthread_id, - &policy, - ¶m); + int error; + error = sched_getparam(0, ¶m); *prio = param.sched_priority; return error; @@ -747,3 +732,4 @@ int fosa_signal_timedwait(fosa_signal_t set[], int size, return 0; } +