Move renderd.conf processing code into new file (#391)

So that it can be easily re-used by other targets.
This commit is contained in:
Hummeltech
2024-02-18 11:07:19 -07:00
committed by GitHub
parent fdaa5a5750
commit 1c9f8b6fb5
14 changed files with 645 additions and 455 deletions

View File

@ -26,45 +26,49 @@ extern "C" {
int daemon(int nochdir, int noclose);
#endif
#include <limits.h> /* for PATH_MAX */
#include "gen_tile.h"
#include "protocol.h"
#include <limits.h>
#define INILINE_MAX 256
#define MAX_SLAVES 5
typedef struct {
const char *iphostname;
const char *mapnik_font_dir;
const char *mapnik_plugins_dir;
const char *pid_filename;
const char *socketname;
const char *stats_filename;
const char *tile_dir;
char *iphostname;
char *mapnik_font_dir;
char *mapnik_plugins_dir;
char *pid_filename;
char *socketname;
char *stats_filename;
char *tile_dir;
int ipport;
int mapnik_font_dir_recurse;
int num_threads;
} renderd_config;
typedef struct {
char xmlname[XMLCONFIG_MAX];
char xmlfile[PATH_MAX];
char xmluri[PATH_MAX];
char host[PATH_MAX];
char htcpip[PATH_MAX];
char tile_dir[PATH_MAX];
char output_format[INILINE_MAX];
char parameterization[PATH_MAX];
int tile_px_size;
char *attribution;
char *cors;
char *description;
char *host;
char *htcpip;
char *output_format;
char *parameterization;
char *server_alias;
char *tile_dir;
char *xmlfile;
char *xmlname;
char *xmluri;
double scale_factor;
int min_zoom;
int aspect_x;
int aspect_y;
int max_zoom;
int min_zoom;
int num_threads;
int tile_px_size;
} xmlconfigitem;
extern struct request_queue * render_request_queue;
extern struct request_queue *render_request_queue;
void statsRenderFinish(int z, long time);
void request_exit(void);

39
includes/renderd_config.h Normal file
View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2007 - 2024 by mod_tile contributors (see AUTHORS file)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; If not, see http://www.gnu.org/licenses/.
*/
#ifndef RENDERD_CONFIG_H
#define RENDERD_CONFIG_H
#include "render_config.h"
#include "renderd.h"
#ifdef __cplusplus
extern "C" {
#endif
extern int num_slave_threads;
extern renderd_config config;
extern renderd_config config_slaves[MAX_SLAVES];
extern xmlconfigitem maps[XMLCONFIGS_MAX];
int min_max_int_opt(const char *opt_arg, const char *opt_type_name, int minimum, int maximum);
void process_config_file(const char *config_file_name, int active_slave, int log_level);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -18,6 +18,14 @@
#ifndef SYS_UTILS_H
#define SYS_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
double get_load_avg(void);
#ifdef __cplusplus
}
#endif
#endif