예제 #1
0
파일: evidence.c 프로젝트: utrhira/mpik
/* added by Wakamori */
static void opt_logcached(int mode, const char *optstr)
{
#if defined(HAVE_LIBMEMCACHED)
	knh_syslog = memcached_syslog;
	knh_vsyslog = memcached_vsyslog;

	kbytes_t host_port = B(optstr);
	kbytes_t host = knh_bytes_head(host_port, ':');
	kint_t port;
	if (!knh_bytes_parseint(knh_bytes_next(host_port, ':'), &port)) {
		KNH_DIE("konoha: invalid arguments.");
	}
	memc = memcached_create(NULL);
	char tmp = host.buf[host.len];
	host.buf[host.len] = '\0';

	memcached_return rc;
	memcached_server_list_st servers;
	servers = memcached_server_list_append(NULL, host.text, port, &rc);
	if (rc != MEMCACHED_SUCCESS) {
		KNH_DIE("konoha: cannot append a memcached server.");
	}
	host.buf[host.len] = tmp;
	rc = memcached_server_push(memc, servers);
	if (rc != MEMCACHED_SUCCESS) {
		KNH_DIE("konoha: cannot push a memcached server.");
	}
	memcached_server_list_free(servers);
#else
	KNH_DIE("konoha: memcached library is not installed.");
#endif /* defined(HAVE_LIBMEMCACHED) */
}
예제 #2
0
파일: system.c 프로젝트: shidasan/konoha2
const knh_ConverterDPI_t *knh_KonohaSpace_getConverterDPINULL(CTX, kKonohaSpace *ns, kbytes_t path)
{
	kbytes_t bpath = knh_KonohaSpace_getDpiPath(_ctx, ns, knh_bytes_next(path, ':'));
	void *d;
	if(path.text[0] == 'f') {
		d = (void*)knh_DictSet_get(_ctx, ctx->share->rconvDpiDictSet, bpath);
	}
	else {
		d = (void*)knh_DictSet_get(_ctx, ctx->share->convDpiDictSet, bpath);
	}
	return (const knh_ConverterDPI_t*)d;
}
예제 #3
0
파일: actor.c 프로젝트: shinpei/femtoutil
//	char buf[128] = {0};
//	int pid = fork();
//	snprintf(buf, 128, "/usr/local/bin/konoha %s/%s", dir_name, script_name);
//	if (pid == 0) {
//		system(buf);
//		exit(0);
//	}
//}

/* ======================================================================== */
// [KMETHODS]

//## @Hidden Actor Actor.opLINK(String path, NameSpace _);
KMETHOD Actor_opLINK(CTX ctx, knh_sfp_t *sfp _RIX)
{
	knh_bytes_t host_port = knh_bytes_next(S_tobytes(sfp[1].s), ':');
	knh_bytes_t host;
	knh_index_t idx = knh_bytes_index(host_port, ':');
	if (idx == -1) {
		LOGDATA = {sDATA("path", host_port.text)};
		LIB_Failed("Actor.opLINK", "Script!!");
		knh_Object_toNULL(ctx, sfp[0].o);
		RETURN_(sfp[0].o);
	}
	host = new_bytes2(host_port.text, idx);
	knh_int_t port;
	if (!knh_bytes_parseint(knh_bytes_next(host_port, ':'), &port)) {
		LOGDATA = {sDATA("path", host_port.text)};
		LIB_Failed("Actor.opLINK", "Script!!");
		knh_Object_toNULL(ctx, sfp[0].o);
		RETURN_(sfp[0].o);