#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include "wrappi.h"
#include "internal.h"
if (w == NULL)
return NULL;
+ w->serial = random ();
+
return w;
}
void
wrap_close (wrap_h *w)
{
+ if (w->pid)
+ waitpid (w->pid, NULL, 0);
+
+ if (w->rfp != NULL)
+ fclose (w->rfp);
+
+ if (w->wfp != NULL)
+ fclose (w->wfp);
+
+ free (w->hostname);
+ free (w->wrappid_path);
free (w);
}
set_error_buf (w, msg, errnum, func);
}
+
+/* Note the gperf perfect hash in lib/internal-procs-lookup.gperf */
+int
+wrap_int_lookup_proc_entry (const char *name)
+{
+ const struct proc_entry *v =
+ wrap_int_gperf_lookup_proc_entry (name, strlen (name));
+ if (v)
+ return v->proc_nr;
+ else
+ return -1;
+}