/* G L O B A L V A R I A B L E S */
/***********************************/
-int frsh_initialized = 0; /* framework initialization flag */
-//#ifdef FRSH_CONFIG_ENABLE_SERVICE_TH_SAFETY_CHECK
-pid_t frsh_service_th_pid; /* service thread pid cache */
-//#endif
+//int frsh_initialized = 0; /* framework initialization flag */
/****************************************/
/* CORE API IMPLEMENTATION */
/* check if the name service is available and ty to start it if not */
/* (try to) initialize the AQuoSA Framework */
if (qres_init() != QOS_OK || qsup_init() != QOS_OK)
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR);
+ FRSH_ERR_RET(FRSH_ERR_INTERNAL_ERROR);
/* install the cleanup function of th AQuoSA framework as an exit
* handler function (quite futile but, for now, it's sufficent) */
if (atexit(frsh_qres_cleanup_wrapper))
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR);
+ FRSH_ERR_RET(FRSH_ERR_INTERNAL_ERROR);
return FRSH_NO_ERROR;
}
* 'frsh_thread_create_and_bind()' call
*/
typedef struct {
- frsh_thread_id_t parent_thread_id;
- frsh_thread_id_t *thread_id;
- //pthread_t *pthread_pthread_id;
- //pid_t *pthread_linux_pid;
- //tid_t *pthread_linux_tid;
- frsh_vres_id_t vres;
frsh_thread_code_t pthread_code;
void *pthread_arg;
+ sem_t *stopper;
} wrapper_pthread_arg_t;
-/* forward declaration of the wrapper function */
-static void *wrapper_pthread_create(void *warg);
-
-/*
- * API call for 'frsh_thread_create_and_bind()', as said prepares the
- * wrapper code argument data structure, create the new thread and wait
- * its acknowledgment before stepping over
- *
- * possible return values:
- * FRSH_NO_ERROR
- * FRSH_ERR_NOT_INITIALIZED
- * FRSH_ERR_BAD_ARGUMENT (NULL thread or thread_code)
- * whatever 'fosa_thread_create()' returns
- * FRSH_ERR_INTERNAL_ERROR (something wrong in signal handling)
- */
-int frsh_thread_create_and_bind(const frsh_vres_id_t vres,
- frsh_thread_id_t *thread,
- frsh_thread_attr_t *attr,
- frsh_thread_code_t thread_code,
- void *arg)
-{
- wrapper_pthread_arg_t wp;
- int thread_status;
- //sigset_t thread_wait_mask;
- frsh_signal_t wait_signal;
- frsh_signal_info_t wait_signal_info;
- struct timespec wait_signal_timeout;
-
- /* check for framework initialization and arguments */
- if (!frsh_initialized)
- PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
- "can't proceed before initializing FRSH with 'frsh_init()'!");
- if ((thread == NULL) || (thread_code == NULL))
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't create a thread with NULL thread_core or return it in a NULL thread");
- /*
- * setup the wrapper code and args for the new
- * created thread to fill in
- *
- * Remember:
- * frsh_thread_id_t => struct {
- * pthread_t pthread_id;
- * pid_t linux_pid;
- * tid_t linux_tid;
- * };
- */
- wp.parent_thread_id = fosa_thread_self();
- wp.thread_id = thread; /* directly fill the user provided thread descriptor pointer */
- //wp.pthread_pthread_id = &(thread->pthread_id);
- //wp.pthread_linux_pid = &(thread->linux_pid);
- //wp.pthread_linux_tid = &(thread->linux_tid);
- wp.vres = vres;
- wp.pthread_code = thread_code;
- wp.pthread_arg = arg;
- /* create the wrapper thread */
- thread_status = fosa_thread_create(NULL, attr, wrapper_pthread_create,(void*) &wp);
- if (thread_status != 0)
- PERROR_AND_RETURN(thread_status,
- "can't create the new thread");
- /* prepare a suited signal mask and wait for the new
- * thread to acknowledge us it has filled the pointers with the descriptor*/
- //pthread_sigmask(0, NULL, &thread_wait_mask);
- //sigdelset(&thread_wait_mask, FRSH_SCHEDULER_SIGNAL);
- wait_signal = FRSH_SCHEDULER_SIGNAL;
- fosa_set_accepted_signals(&wait_signal, 1);
- wait_signal_timeout.tv_sec = 0;
- wait_signal_timeout.tv_nsec = 500000000; /* half a second timeout!! */
- //if (sigsuspend(&thread_wait_mask) != -1)
- if (fosa_signal_timedwait(&wait_signal, 1, NULL, &wait_signal_info, &wait_signal_timeout) < 0)
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR,
- "can't synchronize with the new created thread");
- if (wait_signal_info.sival_int != FRSH_NO_ERROR)
- PERROR_AND_RETURN(wait_signal_info.sival_int,
- "can't create and bind the new thread");
- /* restore the signal mask to its original */
- //sigaddset(&thread_wait_mask, FRSH_SCHEDULER_SIGNAL);
- //pthread_sigmask(FRSH_SCHEDULER_SIGNAL, &thread_wait_mask, NULL);
-
- return FRSH_NO_ERROR;
-}
-
-/*
- * API call for 'frsh_thread_create_in_background()', as said creates a
- * background contract and negotiate it (we know they're always accepted
- * but we need to get the service thread account fo the new vres), then
- * create the new thread, exactly as seen in 'frsh_thread_create_and_bind()'
- * and wait for its acknowledgment
- *
- * possible return values:
- * FRSH_NO_ERROR
- * FRSH_ERR_NOT_INITIALIZED
- * FRSH_ERR_BAD_ARGUMENT (NULL thread_id, thread_code, contract_label or vres_id)
- * FRSH_ERR_TOO_MANY_VRES(*)
- * FRSH_ERR_CONTRACT_ID_ALREADY_EXISTS(*)
- * FRSH_ERR_CONTRACT_REJECTED(*)
- * whatever 'fosa_thread_create()' returns
- * FRSH_ERR_INTERNAL_ERROR(*) (something wrong with AQuoSA or with the service thread internal data structures)
- * FRSH_ERR_INTERNAL_ERROR (something wrong in signal handling)
- */
-int frsh_thread_create_in_background(frsh_thread_code_t thread_code,
- const void *thread_arg,
- const frsh_contract_label_t contract_label,
- frsh_thread_attr_t *attr,
- frsh_thread_id_t *thread_id,
- frsh_vres_id_t *vres_id)
-{
- frsh_contract_t contract;
- frsh_in_msg_t contract_msg;
- frsh_out_msg_t vres_msg;
-
- wrapper_pthread_arg_t wp;
- int thread_status;
- //sigset_t thread_wait_mask;
- frsh_signal_t wait_signal;
- frsh_signal_info_t wait_signal_info;
- frsh_rel_time_t wait_signal_timeout;
-
- /* check for framework initialization and arguments */
- if (!frsh_initialized)
- PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
- "can't proceed before initializing FRSH with 'frsh_init()'!");
- if ((thread_code == NULL) || (thread_id == NULL))
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't create a thread with NULL thread_code or return it in a NULL thread_id");
- if (contract_label == NULL)
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't give the contract a NULL contract_label");
- if (vres_id == NULL)
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't negotiate for a NULL vres_id");
-
- /* initialize a contract core parameters
- * exactly as if we've called 'frsh_contract_init()' */
- /* Core contract attributes setup */
- contract.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- contract.resource_type = FRSH_RT_PROCESSOR;
- /* contract.contract_label not modified/initialized */
- contract.budget_min = FOSA_USEC_TO_REL_TIME(0);
- contract.period_max = FOSA_USEC_TO_REL_TIME(0);
- contract.workload = FRSH_WT_INDETERMINATE;
- contract.contract_type = FRSH_CT_REGULAR;
- contract.d_equals_t = true;
- contract.deadline = FOSA_USEC_TO_REL_TIME(0);
- contract.budget_overrun_signal = FRSH_NULL_SIGNAL;
- contract.budget_overrun_siginfo.sival_int = 0;
- contract.deadline_miss_signal = FRSH_NULL_SIGNAL;
- contract.deadline_miss_siginfo.sival_int = 0;
- /* setup id parameters of the contract
- * as if we've called 'frsh_contract_set_resource_and_label()' */
- contract.resource_type = FRSH_RT_PROCESSOR;
- contract.resource_id = FRSH_RESOURCE_ID_DEFAULT;
- strncpy(contract.contract_label, contract_label, FRSH_CONTRACT_LABEL_MAXLENGTH);
- /* setup basic contract parameters
- * (in order to specify it's a background contract!)
- * as if we've called 'frsh_contract_set_basic_params()' */
- contract.workload = FRSH_WT_INDETERMINATE;
- contract.contract_type = FRSH_CT_BACKGROUND;
- /* setup additional timing parameters for the contract
- * as if we've called 'frsh_contract_set_timing_reqs()' */
- contract.d_equals_t = true;
- /* ask the service thread for the contract negotiation
- * (as if we've called 'frsh_contract_negotiate()') */
- /* prepare the message */
- contract_msg.type = FRSH_MT_NEGOTIATE_CONTRACT;
- contract_msg.val.negotiate_contract.contract = contract;
- /* contact the service thread for contract negotiation */
- if (frsh_service_th_ask_for(frsh_service_th_pid, &contract_msg, &vres_msg) != FRSH_SERVICE_TH_NO_ERROR)
- PERROR_AND_RETURN(FRSH_ERR_INVALID_SCHEDULER_REPLY,
- "can't receive correct answer from the service thread");
- if (vres_msg.error != FRSH_NO_ERROR)
- /* possible return values are listed in the description
- * of the function upward (the one marked with '(*)') */
- PERROR_AND_RETURN(vres_msg.error,
- "can't negotiate the new background contract");
- *vres_id = vres_msg.val.negotiate_contract.vres_id;
- /* create a new thread with the described wrapper
- * as thread code in order to handle the binding to the
- * just created background vres (and to signal us when it's done!)*/
- wp.parent_thread_id = fosa_thread_self();
- wp.thread_id = thread_id; /* directly fill the user provided thread descriptor pointer */
- //wp.pthread_pthread_id = &(thread_id->pthread_id);
- //wp.pthread_linux_pid = &(thread_id->linux_pid);
- //wp.pthread_linux_tid = &(thread_id->linux_tid);
- wp.vres = *vres_id;
- wp.pthread_code = thread_code;
- wp.pthread_arg = (void*) thread_arg;
- /* create the wrapper thread */
- thread_status = fosa_thread_create(NULL, attr, wrapper_pthread_create,(void*) &wp);
- if (thread_status != 0)
- PERROR_AND_RETURN(thread_status,
- "can't create the new background thread");
- /* prepare a suited signal mask and wait for the new
- * thread to acknowledge us it has filled the pointers with the descriptor*/
- //pthread_sigmask(0, NULL, &thread_wait_mask);
- //sigdelset(&thread_wait_mask, FRSH_SCHEDULER_SIGNAL);
- wait_signal = FRSH_SCHEDULER_SIGNAL;
- fosa_set_accepted_signals(&wait_signal, 1);
- /* half a second timeout!! */
- wait_signal_timeout = FOSA_USEC_TO_REL_TIME(500000);
- //if (sigsuspend(&thread_wait_mask) != -1)
- if (fosa_signal_timedwait(&wait_signal, 1, NULL, &wait_signal_info, &wait_signal_timeout) < 0)
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR,
- "can't synchronize with the new created background thread");
- if (wait_signal_info.sival_int != FRSH_NO_ERROR)
- PERROR_AND_RETURN(wait_signal_info.sival_int,
- "can't create and bind the new background thread");
- /* restore the signal mask to its original */
- //sigaddset(&thread_wait_mask, FRSH_SCHEDULER_SIGNAL);
- //pthread_sigmask(FRSH_SCHEDULER_SIGNAL, &thread_wait_mask, NULL);
-
- return FRSH_NO_ERROR;
-}
-
/*
* code for the described wrapper, it only asks the service thread the
* binding of itself to the vres and the directly run the user provided
* FRSH_ERR_NOT_CONTRACTED_VRES(*)
* whatever the user provided code 'pthread_code' returns
*/
-static void* wrapper_pthread_create(void *warg)
+static void* wrapper_pthread(void *arg)
{
- frsh_in_msg_t bind_msg;
- frsh_out_msg_t vres_msg;
- frsh_signal_info_t frsh_status_siginfo;
-
- /* fill both local and on the calling thread descriptor */
- wrapper_pthread_arg_t pth = *((wrapper_pthread_arg_t*) warg);
- *(pth.thread_id) = fosa_thread_self();
- //*(pth.pthread_pthread_id) = this_thread.pthread_id;
- //*(pth.pthread_linux_pid) = this_thread.linux_pid;
- //*(pth.pthread_linux_tid) = this_thread.linux_tid;
- /* prepare the message */
- bind_msg.type = FRSH_MT_BIND_THREAD;
- bind_msg.val.bind_thread.thread_id = *(pth.thread_id);
- bind_msg.val.bind_thread.vres_id = pth.vres;
- if (frsh_service_th_ask_for(frsh_service_th_pid, &bind_msg,&vres_msg) != FRSH_SERVICE_TH_NO_ERROR) {
- PERROR_FRESCOR(FRSH_ERR_INVALID_SCHEDULER_REPLY,
- "can't receive correct answer from the service thread");
- pthread_exit((void*) FRSH_ERR_INVALID_SCHEDULER_REPLY); // move to fosa_???
- }
- if (vres_msg.error != FRSH_NO_ERROR) {
- PERROR_FRESCOR(vres_msg.error, "can't bind to the vres");
- pthread_exit((void*) vres_msg.error); // move to fosa_???
- }
- /* signal our 'creator' we've filled the pointers
- * it needs and we've (at least tried to) bound ourself */
- frsh_status_siginfo.sival_int = vres_msg.error;
- if (fosa_signal_queue(FRSH_SCHEDULER_SIGNAL, frsh_status_siginfo, pth.parent_thread_id) < 0) {
- PERROR_FRESCOR(FRSH_ERR_INTERNAL_ERROR,
- "can't acknowledge the new thread creation");
- pthread_exit((void*) FRSH_ERR_INTERNAL_ERROR); // move to fosa_???
- }
-
+ int rv;
+
+ wrapper_pthread_arg_t pth = *((wrapper_pthread_arg_t*) arg);
+ sem_wait(pth.stopper);
+ /* (pth.thread_id) = fosa_thread_self(); */
return pth.pthread_code(pth.pthread_arg);
}
*/
int frsh_thread_bind(const frsh_vres_id_t vres, const frsh_thread_id_t thread)
{
- frsh_in_msg_t bind_msg;
- frsh_out_msg_t vres_msg;
- /* check for framework initialization and arguments */
- if (!frsh_initialized)
- PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
- "can't proceed before initializing FRSH with 'frsh_init()'!");
- /* prepare the message */
- bind_msg.type = FRSH_MT_BIND_THREAD;
- bind_msg.val.bind_thread.thread_id = thread;
- bind_msg.val.bind_thread.vres_id = vres;
- /* contact the service thread for bind the thread */
- if (frsh_service_th_ask_for(frsh_service_th_pid,&bind_msg,&vres_msg) != FRSH_SERVICE_TH_NO_ERROR)
- PERROR_AND_RETURN(FRSH_ERR_INVALID_SCHEDULER_REPLY,
- "can't receive correct answer from the service thread");
- if (vres_msg.error != FRSH_NO_ERROR)
- /* possible return values are listed in the description
- * of the function upward (the one marked with '(*)') */
- PERROR_AND_RETURN(vres_msg.error,
- "can't bind the thread");
-
- return FRSH_NO_ERROR;
+ /* should call cpu scheduler op - bind*/
+ return FRSH_ERR_NOT_IMPLEMENTED;
}
/*
*/
int frsh_thread_unbind(const frsh_thread_id_t thread)
{
- frsh_in_msg_t unbind_msg;
- frsh_out_msg_t reply_msg;
+ /* should call cpu scheduler operation - unbind */
+ return FRSH_ERR_NOT_IMPLEMENTED;
+}
+
+/*
+ * API call for 'frsh_thread_create_and_bind()', as said prepares the
+ * wrapper code argument data structure, create the new thread and wait
+ * its acknowledgment before stepping over
+ *
+ * possible return values:
+ * FRSH_NO_ERROR
+ * FRSH_ERR_NOT_INITIALIZED
+ * FRSH_ERR_BAD_ARGUMENT (NULL thread or thread_code)
+ * whatever 'fosa_thread_create()' returns
+ * FRSH_ERR_INTERNAL_ERROR (something wrong in signal handling)
+ */
+int frsh_thread_create_and_bind(const frsh_vres_id_t vres,
+ frsh_thread_id_t *thread,
+ frsh_thread_attr_t *attr,
+ frsh_thread_code_t thread_code,
+ void *arg)
+{
+ wrapper_pthread_arg_t wp;
+ int rv;
+ sem_t stopper;
+ sem_init(&stopper, 0, 0);
+
/* check for framework initialization and arguments */
- if (!frsh_initialized)
+ /*if (!frsh_initialized)
PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
- "can't proceed before initializing FRSH with 'frsh_init()'!");
- /* prepare the message */
- unbind_msg.type = FRSH_MT_UNBIND_THREAD;
- unbind_msg.val.unbind_thread.thread_id = thread;
- /* contact the service thread for unbind the thread */
- if (frsh_service_th_ask_for(frsh_service_th_pid, &unbind_msg, &reply_msg) != FRSH_SERVICE_TH_NO_ERROR)
- PERROR_AND_RETURN(FRSH_ERR_INVALID_SCHEDULER_REPLY,
- "can't receive correct answer from the service thread");
- if (reply_msg.error != FRSH_NO_ERROR)
- /* possible return values are listed in the description
- * of the function upward (the one marked with '(*)') */
- PERROR_AND_RETURN(reply_msg.error,
- "can't unbind the thread");
+ "can't proceed before initializing FRSH with 'frsh_init()'!");
+ if ((thread == NULL) || (thread_code == NULL))
+ PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
+ "can't create a thread with NULL thread_core or return it in a NULL thread");
+ */
+
+ wp.thread_code = thread_code;
+ wp.thread_arg = arg;
+ wp.stopper = &stopper;
+
+ /* create the wrapper thread */
+ rv = fosa_thread_create(thread, attr, wrapper_pthread, (void*)&wp);
+
+ if (rv != 0)
+ FRSH_ERR_RET(rv);
+
+ rv = frsh_thread_bind();
+ if ( rv != FRSH_NO_ERROR) {
+ FRSH_ERR_RET(FRSH_ERR_INVALID_SCHEDULER_REPLY);
+ }
+
+ sem_post(&stopper);
return FRSH_NO_ERROR;
}
+/*
+ * API call for 'frsh_thread_create_in_background()', as said creates a
+ * background contract and negotiate it (we know they're always accepted
+ * but we need to get the service thread account fo the new vres), then
+ * create the new thread, exactly as seen in 'frsh_thread_create_and_bind()'
+ * and wait for its acknowledgment
+ *
+ * possible return values:
+ * FRSH_NO_ERROR
+ * FRSH_ERR_NOT_INITIALIZED
+ * FRSH_ERR_BAD_ARGUMENT (NULL thread_id, thread_code, contract_label or vres_id)
+ * FRSH_ERR_TOO_MANY_VRES(*)
+ * FRSH_ERR_CONTRACT_ID_ALREADY_EXISTS(*)
+ * FRSH_ERR_CONTRACT_REJECTED(*)
+ * whatever 'fosa_thread_create()' returns
+ * FRSH_ERR_INTERNAL_ERROR(*) (something wrong with AQuoSA or with the service thread internal data structures)
+ * FRSH_ERR_INTERNAL_ERROR (something wrong in signal handling)
+ */
+int frsh_thread_create_in_background(frsh_thread_code_t thread_code,
+ const void *thread_arg,
+ const frsh_contract_label_t contract_label,
+ frsh_thread_attr_t *attr,
+ frsh_thread_id_t *thread_id,
+ frsh_vres_id_t *vres_id)
+{
+ return FRSH_ERR_NOT_IMPLEMENTED;
+}
+
/*
* frsh_thread_get_vres_id(), get the id vres of a vres bound to a thread
*
int frsh_thread_get_vres_id(const frsh_thread_id_t thread,
frsh_vres_id_t *vres_id)
{
- frsh_in_msg_t thread_msg;
- frsh_out_msg_t vres_msg;
-
- /* check for framework initialization and arguments */
- if (!frsh_initialized)
- PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
- "can't proceed before initializing FRSH with 'frsh_init()'!");
- if (vres_id == NULL)
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't return the id in a NULL vres_id");
- /* prepare the message */
- thread_msg.type = FRSH_MT_GET_THREAD_VRES_ID;
- thread_msg.val.get_thread_vres_id.thread_id = thread;
- /* contact the service thread for the vres id */
- if (frsh_service_th_ask_for(frsh_service_th_pid, &thread_msg, &vres_msg) != FRSH_SERVICE_TH_NO_ERROR)
- PERROR_AND_RETURN(FRSH_ERR_INVALID_SCHEDULER_REPLY,
- "can't receive correct answer from the service thread");
- if (vres_msg.error != FRSH_NO_ERROR)
- /* possible return values are listed in the description
- * of the function upward (the one marked with '(*)') */
- PERROR_AND_RETURN(vres_msg.error,
- "can't get the vres id");
- /* store the vres id only now so, if something
- * goes wrong, the vres_id pointer is returned untouched */
- *vres_id = vres_msg.val.get_thread_vres_id.vres_id;
-
- return FRSH_NO_ERROR;
+ return FRSH_ERR_NOT_IMPLEMENTED;
}
/*
* FRSH_ERR_INTERNAL_ERROR(*) (something wrong with AQuoSA or with the service thread internal data structures)
* FRSH_ERR_INVALID_SCHEDULER_REPLY (error in communication with the service thread)
*/
-//int frsh_thread_self(frsh_thread_id_t *thread_self, frsh_vres_id_t *vres_self)
-//{
-// frsh_in_msg_t thread_msg;
-// frsh_out_msg_t vres_msg;
-//
-// /* check for framework initialization and arguments */
-// if (!frsh_initialized)
-// PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
-// "can't proceed before initializing FRSH with 'frsh_init()'!");
-// if (thread_self == NULL)
-// PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
-// "can't put self thread id in a NULL thread_self");
-// /* get the thread id of ourself */
-// *thread_self = fosa_thread_self();
-// /* get, if requested, even the vres id of ourself */
-// if (vres_self != NULL) {
-// /* prepare the message */
-// thread_msg.type = FRSH_MT_GET_THREAD_VRES_ID;
-// thread_msg.val.get_thread_vres_id.thread_id = *thread_self;
-// /* contact the service thread for the vres id */
-// if (frsh_service_th_ask_for(frsh_service_th_pid, &thread_msg, &vres_msg) != FRSH_SERVICE_TH_NO_ERROR)
-// PERROR_AND_RETURN(FRSH_ERR_INVALID_SCHEDULER_REPLY,
-// "can't receive correct answer from the service thread");
-// if (vres_msg.error != FRSH_NO_ERROR)
-// /* possible return values are listed in the description
-// * of the function upward (the one marked with '(*)') */
-// PERROR_AND_RETURN(vres_msg.error,
-// "can't get the vres id of the calling thread");
-// /* vres_self pointer untouched if not all gone well */
-// *vres_self = vres_msg.val.get_thread_vres_id.vres_id;
-// }
-//
-// return FRSH_NO_ERROR;
-//}
+int frsh_thread_self(frsh_thread_id_t *thread_self, frsh_vres_id_t *vres_self)
+{
+ return FRSH_ERR_NOT_IMPLEMENTED;
+}
const struct timespec *period,
bool *accepted)
{
- frsh_in_msg_t params_msg;
- frsh_out_msg_t ack_msg;
-
-#ifdef DEBUG
- strncpy(FUNCNAME, "frsh_service_thread_set_data", 29);
-#endif
-
- /* check for framework initialization and arguments */
- if (!frsh_initialized)
- PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
- "can't proceed before initializing FRSH with 'frsh_init()'!");
- if (budget == NULL || period == NULL)
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't setup a NULL budget or period");
- if (frsh_rel_time_smaller(*period, *budget))
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't setup a budget greather than the period");
- /* prepare the message */
- params_msg.type = FRSH_MT_SET_SERVICE_THREAD_DATA;
- params_msg.val.set_service_thread_data.budget = *budget;
- params_msg.val.set_service_thread_data.period = *period;
- /* contact the service thread for the usage retrieval */
- if (frsh_service_th_ask_for(frsh_service_th_pid, ¶ms_msg, &ack_msg) != FRSH_SERVICE_TH_NO_ERROR)
- PERROR_AND_RETURN(FRSH_ERR_INVALID_SCHEDULER_REPLY,
- "can't receive correct answer from the service thread");
- if (ack_msg.error != FRSH_NO_ERROR)
- PERROR_AND_RETURN(ack_msg.error,
- "can't setup service thread budget and period");
- *accepted = ack_msg.val.set_service_thread_data.accepted;
-
- return FRSH_NO_ERROR;
+ return FRSH_ERR_NOT_IMPLEMENTED;
}
/*
*/
int frsh_service_thread_get_data(frsh_rel_time_t *budget, frsh_rel_time_t *period)
{
- frsh_in_msg_t request_msg;
- frsh_out_msg_t params_msg;
-#ifdef DEBUG
- strncpy(FUNCNAME, "frsh_service_thread_get_data", 29);
-#endif
-
- /* check for framework initialization and arguments */
- if (!frsh_initialized)
- PERROR_AND_RETURN(FRSH_ERR_NOT_INITIALIZED,
- "can't proceed before initializing FRSH with 'frsh_init()'!");
- if (budget == NULL || period == NULL)
- PERROR_AND_RETURN(FRSH_ERR_BAD_ARGUMENT,
- "can't return results in a NULL budget or period");
- /* prepare the message */
- request_msg.type = FRSH_MT_GET_SERVICE_THREAD_DATA;
- /* contact the service thread for the usage retrieval */
- if (frsh_service_th_ask_for(frsh_service_th_pid, &request_msg, ¶ms_msg) != FRSH_SERVICE_TH_NO_ERROR)
- PERROR_AND_RETURN(FRSH_ERR_INVALID_SCHEDULER_REPLY,
- "can't receive correct answer from the service thread");
- if (params_msg.error != FRSH_NO_ERROR)
- PERROR_AND_RETURN(params_msg.error,
- "can't obtain current service thread budget and period");
- /* budget and period pointers untouched if something has gone wrong */
- *budget = params_msg.val.get_budget_and_period.budget;
- *period = params_msg.val.get_budget_and_period.period;
-
- return FRSH_NO_ERROR;
+ return FRSH_ERR_NOT_IMPLEMENTED;
}