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