xref: /aosp_15_r20/external/ltp/testcases/kernel/controllers/libcontrollers/libcontrollers.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker /******************************************************************************/
2*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
3*49cdfc7eSAndroid Build Coastguard Worker /* Copyright (c) International Business Machines  Corp., 2007                 */
4*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
5*49cdfc7eSAndroid Build Coastguard Worker /* This program is free software;  you can redistribute it and/or modify      */
6*49cdfc7eSAndroid Build Coastguard Worker /* it under the terms of the GNU General Public License as published by       */
7*49cdfc7eSAndroid Build Coastguard Worker /* the Free Software Foundation; either version 2 of the License, or          */
8*49cdfc7eSAndroid Build Coastguard Worker /* (at your option) any later version.                                        */
9*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
10*49cdfc7eSAndroid Build Coastguard Worker /* This program is distributed in the hope that it will be useful,            */
11*49cdfc7eSAndroid Build Coastguard Worker /* but WITHOUT ANY WARRANTY;  without even the implied warranty of            */
12*49cdfc7eSAndroid Build Coastguard Worker /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See                  */
13*49cdfc7eSAndroid Build Coastguard Worker /* the GNU General Public License for more details.                           */
14*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
15*49cdfc7eSAndroid Build Coastguard Worker /* You should have received a copy of the GNU General Public License          */
16*49cdfc7eSAndroid Build Coastguard Worker /* along with this program;  if not, write to the Free Software               */
17*49cdfc7eSAndroid Build Coastguard Worker /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    */
18*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
19*49cdfc7eSAndroid Build Coastguard Worker /******************************************************************************/
20*49cdfc7eSAndroid Build Coastguard Worker 
21*49cdfc7eSAndroid Build Coastguard Worker /******************************************************************************/
22*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
23*49cdfc7eSAndroid Build Coastguard Worker /* File:        libcontrollers.h                                              */
24*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
25*49cdfc7eSAndroid Build Coastguard Worker /* Description: This file contains the declarations for the functions and     */
26*49cdfc7eSAndroid Build Coastguard Worker /*              variables used by the library and the test files.             */
27*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
28*49cdfc7eSAndroid Build Coastguard Worker /* Author:      Sudhir Kumar [email protected]                        */
29*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
30*49cdfc7eSAndroid Build Coastguard Worker /* History:                                                                   */
31*49cdfc7eSAndroid Build Coastguard Worker /* Created-     15/02/2008 -Sudhir Kumar <[email protected]>          */
32*49cdfc7eSAndroid Build Coastguard Worker /*                                                                            */
33*49cdfc7eSAndroid Build Coastguard Worker /******************************************************************************/
34*49cdfc7eSAndroid Build Coastguard Worker 
35*49cdfc7eSAndroid Build Coastguard Worker /* Standard Include Files */
36*49cdfc7eSAndroid Build Coastguard Worker #include <dirent.h>
37*49cdfc7eSAndroid Build Coastguard Worker #include <limits.h>
38*49cdfc7eSAndroid Build Coastguard Worker #include <stdio.h>
39*49cdfc7eSAndroid Build Coastguard Worker #include <stdlib.h>
40*49cdfc7eSAndroid Build Coastguard Worker #include <string.h>
41*49cdfc7eSAndroid Build Coastguard Worker #include <sys/stat.h>
42*49cdfc7eSAndroid Build Coastguard Worker #include <sys/types.h>
43*49cdfc7eSAndroid Build Coastguard Worker #include <unistd.h>
44*49cdfc7eSAndroid Build Coastguard Worker 
45*49cdfc7eSAndroid Build Coastguard Worker extern char fullpath[PATH_MAX];
46*49cdfc7eSAndroid Build Coastguard Worker extern int FLAG;
47*49cdfc7eSAndroid Build Coastguard Worker extern volatile int timer_expired;
48*49cdfc7eSAndroid Build Coastguard Worker extern int retval;
49*49cdfc7eSAndroid Build Coastguard Worker extern unsigned int current_shares;
50*49cdfc7eSAndroid Build Coastguard Worker extern unsigned int total_shares;
51*49cdfc7eSAndroid Build Coastguard Worker extern unsigned int *shares_pointer;
52*49cdfc7eSAndroid Build Coastguard Worker extern struct dirent *dir_pointer;
53*49cdfc7eSAndroid Build Coastguard Worker 
54*49cdfc7eSAndroid Build Coastguard Worker enum{
55*49cdfc7eSAndroid Build Coastguard Worker 	GET_SHARES	=1,
56*49cdfc7eSAndroid Build Coastguard Worker 	GET_TASKS
57*49cdfc7eSAndroid Build Coastguard Worker };
58*49cdfc7eSAndroid Build Coastguard Worker 
59*49cdfc7eSAndroid Build Coastguard Worker static inline void error_function(char *msg1, char *msg2);
60*49cdfc7eSAndroid Build Coastguard Worker 
61*49cdfc7eSAndroid Build Coastguard Worker int read_shares_file(char *filepath);
62*49cdfc7eSAndroid Build Coastguard Worker 
63*49cdfc7eSAndroid Build Coastguard Worker int read_file(char *filepath, int action, unsigned int *value);
64*49cdfc7eSAndroid Build Coastguard Worker 
65*49cdfc7eSAndroid Build Coastguard Worker int scan_shares_files(unsigned int *shares_pointer);
66*49cdfc7eSAndroid Build Coastguard Worker 
67*49cdfc7eSAndroid Build Coastguard Worker int write_to_file (char * file, const char* mode, unsigned int value);
68*49cdfc7eSAndroid Build Coastguard Worker 
69*49cdfc7eSAndroid Build Coastguard Worker void signal_handler_alarm (int signal );
70*49cdfc7eSAndroid Build Coastguard Worker 
71*49cdfc7eSAndroid Build Coastguard Worker void signal_handler_sigusr2 (int signal);
72