예제 #1
0
/** Return the name of the Libevent backend we're using. */
const char *
tor_libevent_get_method(void)
{
#ifdef HAVE_EVENT2_EVENT_H
  return event_base_get_method(the_event_base);
#elif defined(HAVE_EVENT_GET_METHOD)
  return event_get_method();
#else
  return "<unknown>";
#endif
}
예제 #2
0
int fpm_event_init_main()
{
	event_init();

	zlog(ZLOG_STUFF, ZLOG_NOTICE, "libevent: using %s", event_get_method());

	if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_event_cleanup, 0)) {
		return -1;
	}

	return 0;
}
예제 #3
0
struct tmuxproc *
proc_start(const char *name, struct event_base *base, int forkflag,
    void (*signalcb)(int))
{
	struct tmuxproc	*tp;
	struct utsname	 u;

#ifdef TMATE_SLAVE
	if (forkflag)
		fatal("can't fork");
#else
	if (forkflag) {
		switch (fork()) {
		case -1:
			fatal("fork failed");
		case 0:
			break;
		default:
			return (NULL);
		}
		if (daemon(1, 0) != 0)
			fatal("daemon failed");

		clear_signals(0);
		if (event_reinit(base) != 0)
			fatalx("event_reinit failed");
	}
	log_open(name);
#endif

#ifdef HAVE_SETPROCTITLE
	setproctitle("%s (%s)", name, socket_path);
#endif

	if (uname(&u) < 0)
		memset(&u, 0, sizeof u);

	log_debug("%s started (%ld): socket %s, protocol %d", name,
	    (long)getpid(), socket_path, PROTOCOL_VERSION);
	log_debug("on %s %s %s; libevent %s (%s)", u.sysname, u.release,
	    u.version, event_get_version(), event_get_method());

	tp = xcalloc(1, sizeof *tp);
	tp->name = xstrdup(name);

#ifndef TMATE_SLAVE
	tp->signalcb = signalcb;
	set_signals(proc_signal_cb, tp);
#endif

	return (tp);
}
예제 #4
0
파일: proc.c 프로젝트: SeamusConnor/tmux
struct tmuxproc *
proc_start(const char *name)
{
	struct tmuxproc	*tp;
	struct utsname	 u;

	log_open(name);
	setproctitle("%s (%s)", name, socket_path);

	if (uname(&u) < 0)
		memset(&u, 0, sizeof u);

	log_debug("%s started (%ld): version %s, socket %s, protocol %d", name,
	    (long)getpid(), VERSION, socket_path, PROTOCOL_VERSION);
	log_debug("on %s %s %s; libevent %s (%s)", u.sysname, u.release,
	    u.version, event_get_version(), event_get_method());

	tp = xcalloc(1, sizeof *tp);
	tp->name = xstrdup(name);

	return (tp);
}