Skip to content

Commit 004a83f

Browse files
committed
Use libdill instead of libevent
1 parent ce3b8e6 commit 004a83f

File tree

11 files changed

+375
-890
lines changed

11 files changed

+375
-890
lines changed

CMakeLists.txt

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,38 @@ else()
7777
else()
7878
set (LD_LIBDIR "lib")
7979
endif()
80-
MESSAGE("LD_LIBDIR guessed to ${LD_LIBDIR}")
8180
endif()
8281

8382

8483
find_package(PkgConfig)
8584
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gthread-2.0 gmodule-2.0)
86-
pkg_check_modules(LIBEVENT REQUIRED libevent)
85+
pkg_check_modules(DILL REQUIRED libdill)
8786

88-
### explicit plugin directory for alerting modules ###
89-
90-
set(GRIDINIT_PLUGINS_DIRECTORY "${LD_LIBDIR}/gridinit")
91-
if(GRIDINIT_PLUGINS)
92-
set(GRIDINIT_PLUGINS_DIRECTORY "${GRIDINIT_PLUGINS}")
93-
endif(GRIDINIT_PLUGINS)
9487

9588
set(CMAKE_LIBRARY_PATH "")
9689
set(CMAKE_INCLUDE_PATH "")
97-
include_directories(AFTER ${GLIB2_INCLUDE_DIRS})
90+
include_directories(AFTER
91+
${DILL_INCLUDE_DIRS}
92+
${GLIB2_INCLUDE_DIRS})
9893

9994
add_definitions(-DLOG_DOMAIN="gridinit")
100-
add_definitions(-DGRIDINIT_DOMAIN="gridinit")
101-
102-
add_subdirectory(./main)
10395

96+
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/main)
97+
98+
add_executable(gridinit
99+
main/gridinit.c
100+
main/children.c
101+
main/limits.c
102+
main/uid.c
103+
main/utils.c)
104+
target_link_libraries(gridinit
105+
${GLIB2_LIBRARIES} ${DILL_STATIC_LIBRARIES})
106+
107+
add_executable(gridinit_cmd
108+
main/gridinit_cmd.c
109+
main/format_output.c
110+
main/utils.c)
111+
target_link_libraries(gridinit_cmd ${GLIB2_LIBRARIES})
112+
113+
install(TARGETS gridinit gridinit_cmd
114+
RUNTIME DESTINATION bin)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Gridinit is a tool used to manage non-daemon processes.
77
### Dependencies
88

99
* cmake, make, gcc
10-
* libevent, libevent-devel
10+
* libdill
1111
* glib, glib-devel
1212

1313
### Compile-time configuration

main/CMakeLists.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.

main/children.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ struct child_s {
130130

131131
static struct child_s SRV_BEACON = {};
132132

133-
static supervisor_postfork_f *supervisor_cb_postfork = NULL;
134-
static void *supervisor_cb_postfork_udata = NULL;
135133

136134
static struct child_s *
137135
supervisor_get_child(const gchar *key)
@@ -413,8 +411,6 @@ _child_start(struct child_s *sd, void *udata, supervisor_cb_f cb)
413411
case 0: /* child */
414412
setsid();
415413
sd->pid = getpid();
416-
if (supervisor_cb_postfork != NULL)
417-
supervisor_cb_postfork(supervisor_cb_postfork_udata);
418414
reset_sighandler();
419415

420416
/* change the rights before changing the working directory */
@@ -1174,10 +1170,3 @@ supervisor_children_set_delay_sigkill(const char *key, time_t delay)
11741170
return 0;
11751171
}
11761172

1177-
void
1178-
supervisor_set_callback_postfork(supervisor_postfork_f *cb, void *udata)
1179-
{
1180-
supervisor_cb_postfork_udata = udata;
1181-
supervisor_cb_postfork = cb;
1182-
}
1183-

main/cnx.c

Lines changed: 0 additions & 71 deletions
This file was deleted.

main/common.c

Lines changed: 0 additions & 40 deletions
This file was deleted.

main/gridinit-utils.h

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3939
# define GRID_LOGLVL_WARN (2 << G_LOG_LEVEL_USER_SHIFT)
4040
# define GRID_LOGLVL_ERROR (1 << G_LOG_LEVEL_USER_SHIFT)
4141

42-
# define FATAL(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
43-
# define ALERT(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
44-
# define CRIT(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
45-
# define ERROR(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
46-
# define WARN(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_WARN, Format, ##__VA_ARGS__)
47-
# define NOTICE(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_NOTICE, Format, ##__VA_ARGS__)
48-
# define INFO(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_INFO, Format, ##__VA_ARGS__)
49-
# define DEBUG(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_DEBUG, Format, ##__VA_ARGS__)
50-
# define TRACE(Format,...) g_log(GRIDINIT_DOMAIN, GRID_LOGLVL_TRACE, Format, ##__VA_ARGS__)
51-
52-
GError* g_error_printf(const char *dom, int code, const char *fmt, ...);
42+
# define FATAL(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
43+
# define ALERT(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
44+
# define CRIT(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
45+
# define ERROR(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_ERROR, Format, ##__VA_ARGS__)
46+
# define WARN(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_WARN, Format, ##__VA_ARGS__)
47+
# define NOTICE(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_NOTICE, Format, ##__VA_ARGS__)
48+
# define INFO(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_INFO, Format, ##__VA_ARGS__)
49+
# define DEBUG(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_DEBUG, Format, ##__VA_ARGS__)
50+
# define TRACE(Format,...) g_log(LOG_DOMAIN, GRID_LOGLVL_TRACE, Format, ##__VA_ARGS__)
5351

5452
extern time_t supervisor_default_delay_KILL;
5553

54+
extern GQuark gq_log;
55+
5656
/* Children monitoring ----------------------------------------------------- */
5757

5858
enum supervisor_limit_e {
@@ -86,16 +86,11 @@ struct child_info_s {
8686
gboolean started;
8787
};
8888

89-
typedef void (supervisor_postfork_f) (void *udata);
90-
9189
typedef void (supervisor_cb_f) (void *udata, struct child_info_s *ci);
9290

9391

9492
void supervisor_children_init(void);
9593

96-
/* Sets an optional function that will be used just after the fork */
97-
void supervisor_set_callback_postfork(supervisor_postfork_f *cb, void *udata);
98-
9994
void supervisor_children_fini(void);
10095

10196
guint supervisor_children_cleanall(void);

0 commit comments

Comments
 (0)