qres_lib.c File Reference

#include <linux/aquosa/qres_config.h>
#include "qres_lib.h"
#include <linux/aquosa/qos_types.h>
#include <linux/aquosa/qos_debug.h>
#include <linux/aquosa/qres_gw.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>

Go to the source code of this file.

Defines

#define IOCTL_OP_CREATE_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_CREATE_SERVER, qres_iparams_t)
 All of these must have qres_iparams_t as argument, otherwise qres_gw_ks() complaints about wrong size.
#define IOCTL_OP_DESTROY_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_DESTROY_SERVER, qres_sid_t)
#define IOCTL_OP_ATTACH_TO_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_ATTACH_TO_SERVER, qres_attach_iparams_t)
#define IOCTL_OP_DETACH_FROM_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_DETACH_FROM_SERVER, qres_attach_iparams_t)
#define IOCTL_OP_SET_PARAMS   _IOR (QRES_MAJOR_NUM, QRES_OP_SET_PARAMS, qres_iparams_t)
#define IOCTL_OP_GET_PARAMS   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_PARAMS, qres_iparams_t)
#define IOCTL_OP_GET_SERVER_ID   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_SERVER_ID, qres_attach_iparams_t)
#define IOCTL_OP_GET_EXEC_TIME   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_EXEC_TIME, qres_time_iparams_t)
#define IOCTL_OP_GET_CURR_BUDGET   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_CURR_BUDGET, qres_time_iparams_t)
#define IOCTL_OP_GET_NEXT_BUDGET   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_NEXT_BUDGET, qres_time_iparams_t)
#define IOCTL_OP_GET_APPR_BUDGET   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_APPR_BUDGET, qres_time_iparams_t)
#define IOCTL_OP_GET_DEADLINE   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_DEADLINE, qres_timespec_iparams_t)
#define IOCTL_OP_SET_WEIGHT   _IOR (QRES_MAJOR_NUM, QRES_OP_SET_WEIGHT, qres_weight_iparams_t)
#define IOCTL_OP_GET_WEIGHT   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_WEIGHT, qres_weight_iparams_t)
#define QRES_DEV_PATHNAME   QOS_DEV_PATH "/" QRES_DEV_NAME

Functions

static qos_rv check_open ()
qos_rv qres_get_sid (pid_t pid, tid_t tid, qres_sid_t *p_sid)
 Get a thread server id, or QOS_E_NOT_FOUND if it is not attached to any server.
qos_rv qres_create_server (qres_params_t *p_params, qres_sid_t *p_sid)
 : in the following functions, if pid == 0 -> apply to itself
qos_rv qres_destroy_server (qres_sid_t sid)
 Detach all processes from a server and destroy it.
qos_rv qres_attach_thread (qres_sid_t sid, pid_t pid, tid_t tid)
 Attach a task to an already existing server.
qos_rv qres_detach_thread (qres_sid_t sid, pid_t pid, tid_t tid)
 Detach from the QoS Server and possibly destroy it.
qos_rv qres_init ()
 Initializes the QoS RES library.
qos_rv qres_cleanup ()
 Cleanup resources associated to the QoS RES Library.
qos_rv qres_module_exists ()
 Detect module in /proc/modules.
qos_rv qres_get_exec_time (qres_sid_t sid, qres_time_t *p_exec_time, qres_atime_t *p_abs_time)
 Retrieve time info relative to the current server.
qos_rv qres_get_curr_budget (qres_sid_t sid, qres_time_t *p_curr_budget)
 Retrieve remaining budget for the current server instance.
qos_rv qres_get_next_budget (qres_sid_t sid, qres_time_t *p_next_budget)
 Retrieve the budget that is likely to be used for the very next server instance.
qos_rv qres_get_appr_budget (qres_sid_t sid, qres_time_t *p_appr_budget)
 Retrieve the budget that has been approved for the subsequent server instances.
qos_rv qres_set_params (qres_sid_t sid, qres_params_t *p_params)
 Change QoS scheduling parameters.
qos_rv qres_get_params (qres_sid_t sid, qres_params_t *qres_p)
 Retrieve QoS scheduling parameters.
qos_rv qres_set_bandwidth (qres_sid_t sid, qos_bw_t bw)
 Change bandwidth.
qos_rv qres_get_bandwidth (qres_sid_t sid, float *bw)
 Get the bandwidth of the server with the supplied ID.
qos_rv qres_get_deadline (qres_sid_t sid, struct timespec *p_deadline)
 Retrieve current scheduling deadline.
qos_rv qres_set_weight (qres_sid_t sid, unsigned int weight)
 Set scheduling weight (i.e., used by shrub).
qos_rv qres_get_weight (qres_sid_t sid, unsigned int *p_weight)
 Retrieve scheduling weight (i.e., used by shrub).
qos_rv qres_get_servers (qres_sid_t *sids, size_t *n)
 Retrieve the existing servers.

Variables

int qres_fd = -1
 File descriptor of the QoS Res Device.
qres_params_t server_params
 Server period set with create_server or set_params.

Define Documentation

#define IOCTL_OP_ATTACH_TO_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_ATTACH_TO_SERVER, qres_attach_iparams_t)

Definition at line 21 of file qres_lib.c.

Referenced by qres_attach_thread().

#define IOCTL_OP_CREATE_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_CREATE_SERVER, qres_iparams_t)

All of these must have qres_iparams_t as argument, otherwise qres_gw_ks() complaints about wrong size.

Definition at line 19 of file qres_lib.c.

Referenced by qres_create_server().

#define IOCTL_OP_DESTROY_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_DESTROY_SERVER, qres_sid_t)

Definition at line 20 of file qres_lib.c.

Referenced by qres_destroy_server().

#define IOCTL_OP_DETACH_FROM_SERVER   _IOR (QRES_MAJOR_NUM, QRES_OP_DETACH_FROM_SERVER, qres_attach_iparams_t)

Definition at line 22 of file qres_lib.c.

Referenced by qres_detach_thread().

#define IOCTL_OP_GET_APPR_BUDGET   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_APPR_BUDGET, qres_time_iparams_t)

Definition at line 29 of file qres_lib.c.

Referenced by qres_get_appr_budget().

#define IOCTL_OP_GET_CURR_BUDGET   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_CURR_BUDGET, qres_time_iparams_t)

Definition at line 27 of file qres_lib.c.

Referenced by qres_get_curr_budget().

#define IOCTL_OP_GET_DEADLINE   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_DEADLINE, qres_timespec_iparams_t)

Definition at line 30 of file qres_lib.c.

Referenced by qres_get_deadline().

#define IOCTL_OP_GET_EXEC_TIME   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_EXEC_TIME, qres_time_iparams_t)

Definition at line 26 of file qres_lib.c.

Referenced by qres_get_exec_time().

#define IOCTL_OP_GET_NEXT_BUDGET   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_NEXT_BUDGET, qres_time_iparams_t)

Definition at line 28 of file qres_lib.c.

Referenced by qres_get_next_budget().

#define IOCTL_OP_GET_PARAMS   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_PARAMS, qres_iparams_t)

Definition at line 24 of file qres_lib.c.

Referenced by qres_get_bandwidth(), and qres_get_params().

#define IOCTL_OP_GET_SERVER_ID   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_SERVER_ID, qres_attach_iparams_t)

Definition at line 25 of file qres_lib.c.

Referenced by qres_get_sid().

#define IOCTL_OP_GET_WEIGHT   _IOWR(QRES_MAJOR_NUM, QRES_OP_GET_WEIGHT, qres_weight_iparams_t)

Definition at line 32 of file qres_lib.c.

Referenced by qres_get_weight().

#define IOCTL_OP_SET_PARAMS   _IOR (QRES_MAJOR_NUM, QRES_OP_SET_PARAMS, qres_iparams_t)

Definition at line 23 of file qres_lib.c.

Referenced by qres_set_bandwidth(), and qres_set_params().

#define IOCTL_OP_SET_WEIGHT   _IOR (QRES_MAJOR_NUM, QRES_OP_SET_WEIGHT, qres_weight_iparams_t)

Definition at line 31 of file qres_lib.c.

Referenced by qres_set_weight().

#define QRES_DEV_PATHNAME   QOS_DEV_PATH "/" QRES_DEV_NAME

Definition at line 138 of file qres_lib.c.

Referenced by qres_init().


Function Documentation

static qos_rv check_open (  )  [inline, static]

Variable Documentation

int qres_fd = -1
Initial value:
 {
  .Q = 0,
  .Q_min = 0,
  .P = 0,
  .flags = 0,
  .timeout = 0
}

Server period set with create_server or set_params.

Definition at line 38 of file qres_lib.c.

Generated on Mon Aug 2 22:39:17 2010 for qosres by  doxygen 1.6.3