configuration.h.in 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. //would be defined by the autoconfiguration tool
  26. #undef HADOOP_CONF_DIR
  27. struct confentry {
  28. const char *key;
  29. const char *value;
  30. };
  31. struct configuration {
  32. int size;
  33. struct confentry **confdetails;
  34. };
  35. FILE *LOGFILE;
  36. #ifdef HADOOP_CONF_DIR
  37. #define CONF_FILE_PATTERN "%s/taskcontroller.cfg"
  38. #else
  39. #define CONF_FILE_PATTERN "%s/conf/taskcontroller.cfg"
  40. #endif
  41. struct configuration config;
  42. //configuration file contents
  43. #ifndef HADOOP_CONF_DIR
  44. extern char *hadoop_conf_dir;
  45. #endif
  46. //method exposed to get the configurations
  47. const char * get_value(char* key);
  48. //method to free allocated configuration
  49. void free_configurations();