Revision: 14329 Author: adrian.chadd Date: Mon Oct 19 00:14:01 2009 Log: Begin fleshing out the driving API.
http://code.google.com/p/lusca-cache/source/detail?r=14329 Modified: /branches/LUSCA_HEAD/libloghelper/loghelper.c ======================================= --- /branches/LUSCA_HEAD/libloghelper/loghelper.c Sun Oct 18 10:06:06 2009 +++ /branches/LUSCA_HEAD/libloghelper/loghelper.c Mon Oct 19 00:14:01 2009 @@ -0,0 +1,59 @@ +#include "include/config.h" + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "include/util.h" + +#include "libcore/kb.h" +#include "libcore/dlink.h" +#include "libcore/varargs.h" +#include "libcore/tools.h" + +#include "libsqdebug/debug.h" + +#include "libhelper/ipc.h" + +#include "loghelper.h" +#include "loghelper_commands.h" + +/* + * Create a loghelper instance. + * + * This creates the instance state, forks off the logfile helper and sets everything up to begin + * accepting queued data. + */ +loghelper_instance_t * +loghelper_create(const char *path, const char *progname, const char *args[]) +{ + loghelper_instance_t * lh; + + lh = xcalloc(1, sizeof(*lh)); + + lh->pid = ipcCreate(IPC_STREAM, path, args, progname, 0, &lh->rfd, &lh->wfd, NULL); + if (lh->pid < 0) { + debug(87, 1) ("loghelper_create: %s: couldn't create program: %s\n", path, xstrerror()); + safe_free(lh); + return NULL; + } + return lh; +} + +/* + * Close down a loghelper instance. + * + * This queues a close and quit message, then marks the loghelper as "going away." + * + * The loghelper is not freed here - it will wait for some response (or error) from + * the loghelper process before finalising the current state. + * + * Any pending messages will be flushed and sent out before the close is queued. + * + * The "lh" pointer should be viewed as invalid after this call. + */ +void +loghelper_close(loghelper_instance_t *lh) +{ + +} --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "lusca-commit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/lusca-commit?hl=en -~----------~----~----~----~------~----~------~--~---
