1 /* ckrm.h - Class-based Kernel Resource Management (CKRM)
3 * Copyright (C) Hubertus Franke, IBM Corp. 2003,2004
4 * (C) Shailabh Nagar, IBM Corp. 2003
5 * (C) Chandra Seetharaman, IBM Corp. 2003
8 * Provides a base header file including macros and basic data structures.
10 * Latest version, more details at http://ckrm.sf.net
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
24 * Made modifications to suit the new RBCE module.
26 * Added callbacks_active and surrounding logic. Added task paramter
27 * for all CE callbacks.
29 * New Event callback structure
37 // Data structure and function to get the list of registered
38 // resource controllers.
40 // #include <linux/sched.h>
42 /* CKRM defines a set of events at particular points in the kernel
43 * at which callbacks registered by various class types are called
47 /* we distinguish various events types
49 * (a) CKRM_LATCHABLE_EVENTS
50 * events can be latched for event callbacks by classtypes
52 * (b) CKRM_NONLATACHBLE_EVENTS
53 * events can not be latched but can be used to call classification
55 * (c) event that are used for notification purposes
56 * range: [ CKRM_EVENT_CANNOT_CLASSIFY .. )
61 CKRM_LATCHABLE_EVENTS,
63 CKRM_EVENT_NEWTASK = CKRM_LATCHABLE_EVENTS,
72 CKRM_EVENT_LISTEN_START,
73 CKRM_EVENT_LISTEN_STOP,
78 CKRM_NONLATCHABLE_EVENTS,
80 CKRM_EVENT_RECLASSIFY = CKRM_NONLATCHABLE_EVENTS,
83 CKRM_NOTCLASSIFY_EVENTS,
85 CKRM_EVENT_MANUAL = CKRM_NOTCLASSIFY_EVENTS,
94 extern void ckrm_invoke_event_cb_chain(enum ckrm_event ev, void *arg);
96 typedef void (*ckrm_event_cb) (void *arg);
100 struct ckrm_hook_cb *next;
103 #define CKRM_DEF_CB(EV,fct) \
104 static inline void ckrm_cb_##fct(void) \
106 ckrm_invoke_event_cb_chain(CKRM_EVENT_##EV,NULL); \
109 #define CKRM_DEF_CB_ARG(EV,fct,argtp) \
110 static inline void ckrm_cb_##fct(argtp arg) \
112 ckrm_invoke_event_cb_chain(CKRM_EVENT_##EV,(void*)arg); \
115 #else // !CONFIG_CKRM
117 #define CKRM_DEF_CB(EV,fct) \
118 static inline void ckrm_cb_##fct(void) { }
120 #define CKRM_DEF_CB_ARG(EV,fct,argtp) \
121 static inline void ckrm_cb_##fct(argtp arg) { }
123 #endif // CONFIG_CKRM
125 /*-----------------------------------------------------------------
126 * define the CKRM event functions
128 *-----------------------------------------------------------------*/
135 CKRM_DEF_CB_ARG(FORK, fork, struct task_struct *);
136 CKRM_DEF_CB_ARG(EXEC, exec, const char *);
137 CKRM_DEF_CB(UID, uid);
138 CKRM_DEF_CB(GID, gid);
139 CKRM_DEF_CB(APPTAG, apptag);
140 CKRM_DEF_CB(LOGIN, login);
141 CKRM_DEF_CB_ARG(USERADD, useradd, struct user_struct *);
142 CKRM_DEF_CB_ARG(USERDEL, userdel, struct user_struct *);
143 CKRM_DEF_CB_ARG(LISTEN_START, listen_start, struct sock *);
144 CKRM_DEF_CB_ARG(LISTEN_STOP, listen_stop, struct sock *);
146 // some other functions required
148 extern void ckrm_init(void);
149 void ckrm_cb_newtask(struct task_struct *);
150 void ckrm_cb_exit(struct task_struct *);
152 #define ckrm_init(x) do { } while (0)
153 #define ckrm_cb_newtask(x) do { } while (0)
154 #define ckrm_cb_exit(x) do { } while (0)
157 extern int get_exe_path_name(struct task_struct *, char *, int);
161 #endif // _LINUX_CKRM_H