master-instance.c revision dd645357a6b851a3a9527d16e2bced731e46dcaa
/* Copyright (c) 2013-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "path-util.h"
#include "array.h"
#include "istream.h"
#include "ostream.h"
#include "file-dotlock.h"
#include "str.h"
#include "strescape.h"
#include "master-instance.h"
#include <unistd.h>
#include <fcntl.h>
struct master_instance_list {
const char *path;
bool locked:1;
bool config_paths_changed:1;
};
struct master_instance_list_iter {
struct master_instance_list *list;
unsigned int idx;
};
static const struct dotlock_settings dotlock_set = {
.timeout = 2,
.stale_timeout = 60
};
{
struct master_instance_list *list;
return list;
}
{
}
static void
struct master_instance *inst)
{
/* update instance's config path if it has changed */
return;
}
}
}
static int
const char *line)
{
struct master_instance *inst;
const char *const *args;
/* <last used> <name> <base dir> [<config path>] */
return -1;
return -1;
return 0;
}
{
const char *line;
if (fd == -1) {
return 0;
return -1;
}
} T_END;
if (input->stream_errno != 0) {
ret = -1;
}
return ret;
}
static int
{
const struct master_instance *inst;
int ret = 0;
str_truncate(str, 0);
}
if (o_stream_nfinish(output) < 0) {
ret = -1;
}
return ret;
}
{
int fd;
if (fd == -1) {
return -1;
}
if (master_instance_list_refresh(list) < 0) {
return -1;
}
return fd;
}
{
int ret;
T_BEGIN {
} T_END;
if (ret < 0) {
return -1;
}
return -1;
}
return file_dotlock_replace(dotlock, 0);
}
static struct master_instance *
const char *base_dir)
{
struct master_instance *inst;
return inst;
}
return NULL;
}
const char *base_dir)
{
struct master_instance *inst;
int fd;
return -1;
}
}
{
const struct master_instance *orig_inst;
struct master_instance *inst;
int fd;
return -1;
/* name already used */
return 0;
}
}
}
const char *base_dir)
{
const struct master_instance *instances;
unsigned int i, count;
int fd;
return -1;
for (i = 0; i < count; i++) {
break;
}
}
if (i == count) {
return 0;
}
}
static int
{
int fd;
if (master_instance_list_refresh(list) < 0)
return -1;
/* write new config paths */
return -1;
return -1;
}
return 0;
}
const struct master_instance *
const char *name)
{
const struct master_instance *inst;
return inst;
}
return NULL;
}
struct master_instance_list_iter *
{
struct master_instance_list_iter *iter;
return iter;
}
const struct master_instance *
{
return NULL;
}
{
}