}
+verify(sizeof(pid_t) <= sizeof(unsigned int));
int virPidFileAcquirePath(const char *path,
pid_t pid)
{
int fd = -1;
char pidstr[INT_BUFSIZE_BOUND(pid)];
- verify(sizeof(pid_t) <= sizeof(unsigned int));
if (path[0] == '\0')
return 0;
#include "memory.h"
#include "command.h"
#include "virfile.h"
+#include "virpidfile.h"
#ifdef WIN32
static int test4(const void *unused ATTRIBUTE_UNUSED)
{
virCommandPtr cmd = virCommandNew(abs_builddir "/commandhelper");
- char *pidfile = virFilePid(abs_builddir, "commandhelper");
+ char *pidfile = virPidFileBuildPath(abs_builddir, "commandhelper");
pid_t pid;
int ret = -1;
goto cleanup;
}
- if (virFileReadPid(abs_builddir, "commandhelper", &pid) < 0) {
+ if (virPidFileRead(abs_builddir, "commandhelper", &pid) < 0) {
printf("cannot read pidfile\n");
goto cleanup;
}
static int test18(const void *unused ATTRIBUTE_UNUSED)
{
virCommandPtr cmd = virCommandNewArgList("sleep", "100", NULL);
- char *pidfile = virFilePid(abs_builddir, "commandhelper");
+ char *pidfile = virPidFileBuildPath(abs_builddir, "commandhelper");
pid_t pid;
int ret = -1;
}
alarm(0);
- if (virFileReadPid(abs_builddir, "commandhelper", &pid) < 0) {
+ if (virPidFileRead(abs_builddir, "commandhelper", &pid) < 0) {
printf("cannot read pidfile\n");
goto cleanup;
}