1 /* Copyright (C) 2010 Red Hat, Inc.
3 This program is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 3 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #if defined(GLOBALS_IMPL)
19 #define GLOBAL(type,name,value) type name = value
21 #define GLOBAL(type,name,value) extern type name
24 GLOBAL(int, verbose
, 0);
25 GLOBAL(const char *, master_host
, NULL
);
26 GLOBAL(unsigned short, master_port
, MY_PORT
);
27 GLOBAL(const char *, db_host
, "localhost");
28 GLOBAL(unsigned short, db_port
, 0);
29 GLOBAL(const char *, me
, "here");
31 #define DPRINTF(fmt,args...) do { \
33 printf("%d " fmt,getpid(),##args); \
39 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
40 # define __attribute__(x) /* empty */
44 #ifndef ATTRIBUTE_UNUSED
45 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
48 #ifndef ATTRIBUTE_NORETURN
49 # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
53 * Common parts of autostart
55 * Directories are relative so they are based off local_path.
56 * Notice that we continue to use the underscore convention even though
57 * buckets are inside the AUTO_DIR_FS and do not conflict. Visual help:
58 * you can see what to delete right away.
60 * We want our own Mongo instance for autostart. Mongo does not have
61 * a feature "listen on port 0 and tell us what you got" (like Hail),
62 * so we define a port and hope it's not in use...
64 #define AUTO_HOST "localhost"
65 #define AUTO_DIR_FS "_fs"
66 #define AUTO_DIR_DB "_db"
67 #define AUTO_BIN_MONGOD "/usr/bin/mongod"
68 #define AUTO_MONGOD_LOG "_mongod.log"
69 #define AUTO_MONGOD_PORT 27018
71 int auto_start (int dbport
);