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