configuration.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <errno.h>
  22. #include <unistd.h>
  23. #define INCREMENT_SIZE 1000
  24. #define MAX_SIZE 10
  25. struct confentry {
  26. const char *key;
  27. const char *value;
  28. };
  29. struct configuration {
  30. int size;
  31. struct confentry **confdetails;
  32. };
  33. FILE *LOGFILE;
  34. #ifdef HADOOP_CONF_DIR
  35. #define CONF_FILE_PATTERN "%s/taskcontroller.cfg"
  36. #else
  37. #define CONF_FILE_PATTERN "%s/conf/taskcontroller.cfg"
  38. #endif
  39. extern struct configuration config;
  40. //configuration file contents
  41. #ifndef HADOOP_CONF_DIR
  42. extern char *hadoop_conf_dir;
  43. #endif
  44. //method exposed to get the configurations
  45. const char * get_value(const char* key);
  46. //method to free allocated configuration
  47. void free_configurations();
  48. //function to return array of values pointing to the key. Values are
  49. //comma seperated strings.
  50. const char ** get_values(const char* key);