Home | History | Annotate | Download | only in libcontrollers
      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 (at) linux.vnet.ibm.com                        */
     29 /*                                                                            */
     30 /* History:                                                                   */
     31 /* Created-     15/02/2008 -Sudhir Kumar <skumar (at) 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 #include <limits_ltp.h>
     46 
     47 #ifdef PATH_MAX
     48 char fullpath[PATH_MAX];
     49 #else
     50 char fullpath[1024]; /* Guess */
     51 #endif
     52 
     53 int FLAG;
     54 volatile int timer_expired;
     55 
     56 int retval;
     57 
     58 unsigned int num_line;//??
     59 
     60 unsigned int current_shares;
     61 
     62 unsigned int total_shares;
     63 
     64 unsigned int *shares_pointer;//??
     65 
     66 char target[LINE_MAX];
     67 
     68 struct dirent 	*dir_pointer;
     69 
     70 enum{
     71 	GET_SHARES	=1,
     72 	GET_TASKS
     73 };
     74 
     75 static inline void error_function(char *msg1, char *msg2);
     76 
     77 int read_shares_file(char *filepath);
     78 
     79 int read_file(char *filepath, int action, unsigned int *value);
     80 
     81 int scan_shares_files(unsigned int *shares_pointer);
     82 
     83 int write_to_file (char * file, const char* mode, unsigned int value);
     84 
     85 void signal_handler_alarm (int signal );
     86 
     87 void signal_handler_sigusr2 (int signal);
     88