本文整理汇总了C++中i_fatal函数的典型用法代码示例。如果您正苦于以下问题:C++ i_fatal函数的具体用法?C++ i_fatal怎么用?C++ i_fatal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了i_fatal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: io_loop_handler_run
void io_loop_handler_run(struct ioloop *ioloop)
{
struct ioloop_handler_context *ctx = ioloop->handler_context;
struct kevent *events;
const struct kevent *event;
struct timeval tv;
struct timespec ts;
struct io_file *io;
unsigned int events_count;
int ret, i;
/* get the time left for next timeout task */
io_loop_get_wait_time(ioloop, &tv);
ts.tv_sec = tv.tv_sec;
ts.tv_nsec = tv.tv_usec * 1000;
/* wait for events */
events = array_get_modifiable(&ctx->events, &events_count);
ret = kevent (ctx->kq, NULL, 0, events, events_count, &ts);
if (ret < 0 && errno != EINTR)
i_fatal("kevent(): %m");
/* reference all IOs */
for (i = 0; i < ret; i++) {
io = (void *)events[i].udata;
i_assert(io->refcount > 0);
io->refcount++;
}
/* execute timeout handlers */
io_loop_handle_timeouts(ioloop);
for (i = 0; i < ret; i++) {
/* io_loop_handle_add() may cause events array reallocation,
so we have use array_idx() */
event = array_idx(&ctx->events, i);
io = (void *)event->udata;
/* callback is NULL if io_remove() was already called */
if (io->io.callback != NULL)
io_loop_call_io(&io->io);
i_assert(io->refcount > 0);
if (--io->refcount == 0)
i_free(io);
}
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:47,代码来源:ioloop-kqueue.c
示例2: dump_size
static uoff_t
dump_size(struct istream *input, const char *name, const char *value)
{
uoff_t size;
if (strcmp(value, "0") == 0)
size = 0;
else {
size = hex2dec((const void *)value, strlen(value));
if (size == 0) {
i_fatal("Invalid %s at %"PRIuUOFF_T": %s",
name, input->v_offset, value);
}
}
printf("%s = %"PRIuUOFF_T"\n", name, size);
return size;
}
开发者ID:zatsepin,项目名称:core,代码行数:17,代码来源:doveadm-dump-dbox.c
示例3: ssl_params_rebuild
static void ssl_params_rebuild(struct ssl_params *param)
{
switch (fork()) {
case -1:
i_fatal("fork() failed: %m");
case 0:
/* child - close listener fds so a long-running ssl-params
doesn't cause Dovecot restart to fail */
ssl_params_close_listeners();
ssl_params_if_unchanged(param->path, param->last_mtime,
param->set.ssl_dh_parameters_length);
exit(0);
default:
/* parent */
break;
}
}
开发者ID:bsmr-dovecot,项目名称:core,代码行数:17,代码来源:ssl-params.c
示例4: cmd_dump_log
static void cmd_dump_log(int argc ATTR_UNUSED, char *argv[])
{
uint64_t modseq;
int fd, ret;
fd = open(argv[1], O_RDONLY);
if (fd < 0)
i_fatal("open(%s) failed: %m", argv[1]);
dump_hdr(fd, &modseq);
do {
T_BEGIN {
ret = dump_record(fd, &modseq);
} T_END;
} while (ret > 0);
i_close_fd(&fd);
}
开发者ID:Raffprta,项目名称:core,代码行数:17,代码来源:doveadm-dump-log.c
示例5: o_stream_create_fd
struct ostream *sieve_tool_open_output_stream(const char *filename)
{
struct ostream *outstream;
int fd;
if ( strcmp(filename, "-") == 0 )
outstream = o_stream_create_fd(1, 0, FALSE);
else {
if ( (fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0 ) {
i_fatal("failed to open file for writing: %m");
}
outstream = o_stream_create_fd_autoclose(&fd, 0);
}
return outstream;
}
开发者ID:aclindsa,项目名称:pigeonhole,代码行数:17,代码来源:sieve-tool.c
示例6: bsdauth_preinit
static struct passdb_module *
bsdauth_preinit(pool_t pool, const char *args)
{
struct passdb_module *module;
module = p_new(pool, struct passdb_module, 1);
module->default_pass_scheme = "PLAIN"; /* same reason as PAM */
module->blocking = TRUE;
if (strcmp(args, "blocking=no") == 0)
module->blocking = FALSE;
else if (strncmp(args, "cache_key=", 10) == 0)
module->cache_key = auth_cache_parse_key(pool, args + 10);
else if (*args != '\0')
i_fatal("passdb bsdauth: Unknown setting: %s", args);
return module;
}
开发者ID:damoxc,项目名称:dovecot,代码行数:17,代码来源:passdb-bsdauth.c
示例7: acl_backend_init
struct acl_backend *
acl_backend_init(const char *data, struct mailbox_list *list,
const char *acl_username, const char *const *groups,
bool owner)
{
struct mail_user *user = mailbox_list_get_user(list);
struct acl_backend *backend;
unsigned int i, group_count;
if (user->mail_debug) {
i_debug("acl: initializing backend with data: %s", data);
i_debug("acl: acl username = %s", acl_username);
i_debug("acl: owner = %d", owner ? 1 : 0);
}
group_count = str_array_length(groups);
if (strncmp(data, "vfile:", 6) == 0)
data += 6;
else if (strcmp(data, "vfile") == 0)
data = "";
else
i_fatal("Unknown ACL backend: %s", t_strcut(data, ':'));
backend = acl_backend_vfile.alloc();
backend->debug = user->mail_debug;
backend->v = acl_backend_vfile;
backend->list = list;
backend->username = p_strdup(backend->pool, acl_username);
backend->owner = owner;
backend->globals_only =
mail_user_plugin_getenv_bool(user, "acl_globals_only");
if (group_count > 0) {
backend->group_count = group_count;
backend->groups =
p_new(backend->pool, const char *, group_count);
for (i = 0; i < group_count; i++) {
backend->groups[i] = p_strdup(backend->pool, groups[i]);
if (user->mail_debug)
i_debug("acl: group added: %s", groups[i]);
}
i_qsort(backend->groups, group_count, sizeof(const char *),
i_strcmp_p);
}
开发者ID:bdraco,项目名称:core,代码行数:45,代码来源:acl-backend.c
示例8: test_server_read_fd
static void
test_server_read_fd(struct istream *input, int wanted_fd, unsigned int idx)
{
struct stat st1, st2;
const unsigned char *data;
size_t size;
int recv_fd;
test_assert_idx(i_stream_read_data(input, &data, &size, 0) == 1, idx);
i_stream_skip(input, 1);
test_assert_idx((recv_fd = i_stream_unix_get_read_fd(input)) != -1, idx);
if (recv_fd != -1) {
if (fstat(recv_fd, &st1) < 0 || fstat(wanted_fd, &st2) < 0)
i_fatal("fstat() failed: %m");
test_assert_idx(st1.st_ino == st2.st_ino, idx);
i_close_fd(&recv_fd);
}
}
开发者ID:Raffprta,项目名称:core,代码行数:18,代码来源:test-istream-unix.c
示例9: sieve_tool_open_output_stream
void sieve_tool_dump_binary_to
(struct sieve_binary *sbin, const char *filename, bool hexdump)
{
struct ostream *dumpstream;
if ( filename == NULL ) return;
dumpstream = sieve_tool_open_output_stream(filename);
if ( dumpstream != NULL ) {
if ( hexdump )
(void) sieve_hexdump(sbin, dumpstream);
else
(void) sieve_dump(sbin, dumpstream, FALSE);
o_stream_destroy(&dumpstream);
} else {
i_fatal("Failed to create stream for sieve code dump.");
}
}
开发者ID:aclindsa,项目名称:pigeonhole,代码行数:18,代码来源:sieve-tool.c
示例10: i_assert
struct sql_db *sql_init(const char *db_driver, const char *connect_string)
{
const struct sql_db *driver;
struct sql_db *db;
i_assert(connect_string != NULL);
driver = sql_driver_lookup(db_driver);
if (driver == NULL)
i_fatal("Unknown database driver '%s'", db_driver);
if ((driver->flags & SQL_DB_FLAG_POOLED) == 0)
db = driver->v.init(connect_string);
else
db = driver_sqlpool_init(connect_string, driver);
i_array_init(&db->module_contexts, 5);
return db;
}
开发者ID:Distrotech,项目名称:dovecot,代码行数:18,代码来源:sql-api.c
示例11: hostpid_init
void hostpid_init(void)
{
static char hostname[256], pid[MAX_INT_STRLEN];
if (gethostname(hostname, sizeof(hostname)-1) == -1)
i_strocpy(hostname, "unknown", sizeof(hostname));
hostname[sizeof(hostname)-1] = '\0';
my_hostname = hostname;
if (strchr(hostname, '/') != NULL)
i_fatal("Invalid system hostname: %s", hostname);
/* allow calling hostpid_init() multiple times to reset hostname */
i_free_and_null(my_domain);
i_strocpy(pid, dec2str(getpid()), sizeof(pid));
my_pid = pid;
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:18,代码来源:hostpid.c
示例12: cmd_dump_fts_expunge_log
static void cmd_dump_fts_expunge_log(int argc ATTR_UNUSED, char *argv[])
{
buffer_t *buf;
int fd, ret;
fd = open(argv[1], O_RDONLY);
if (fd < 0)
i_fatal("open(%s) failed: %m", argv[1]);
buf = buffer_create_dynamic(default_pool, 1024);
do {
T_BEGIN {
ret = dump_record(fd, buf);
} T_END;
} while (ret > 0);
buffer_free(&buf);
i_close_fd(&fd);
}
开发者ID:Raffprta,项目名称:core,代码行数:18,代码来源:doveadm-dump-fts-expunge-log.c
示例13: doveadm_print_formatted_print
static void doveadm_print_formatted_print(const char *value)
{
if (ctx.format == NULL) {
i_fatal("formatted formatter cannot be used without a format.");
}
const char *error;
struct var_expand_table *entry = array_idx_modifiable(&ctx.headers, ctx.idx++);
entry->value = value;
if (ctx.idx >= array_count(&ctx.headers)) {
if (var_expand(ctx.buf, ctx.format, array_idx(&ctx.headers,0), &error) <= 0) {
i_error("Failed to expand print format '%s': %s",
ctx.format, error);
}
doveadm_print_formatted_flush();
ctx.idx = 0;
}
}
开发者ID:bdraco,项目名称:core,代码行数:19,代码来源:doveadm-print-formatted.c
示例14: askpass_str
static void askpass_str(const char *prompt, buffer_t *pass)
{
struct termios old_tio, tio;
bool tty, restore_tio = FALSE;
char ch;
int fd;
tty = isatty(STDIN_FILENO);
if (tty) {
fputs(prompt, stderr);
fflush(stderr);
fd = open("/dev/tty", O_RDONLY);
if (fd < 0)
i_fatal("open(/dev/tty) failed: %m");
/* turn off echo */
if (tcgetattr(fd, &old_tio) == 0) {
restore_tio = TRUE;
tio = old_tio;
tio.c_lflag &= ~(ECHO | ECHONL);
(void)tcsetattr(fd, TCSAFLUSH, &tio);
}
} else {
/* read it from stdin without showing a prompt */
fd = STDIN_FILENO;
}
/* read the password */
while (read(fd, &ch, 1) > 0) {
if (ch == '\n' || ch == '\r')
break;
buffer_append_c(pass, ch);
}
if (tty) {
if (restore_tio)
(void)tcsetattr(fd, TCSAFLUSH, &old_tio);
fputs("\n", stderr); fflush(stderr);
i_close_fd(&fd);
}
}
开发者ID:Raffprta,项目名称:core,代码行数:43,代码来源:askpass.c
示例15: fs_sis_init
static struct fs *
fs_sis_init(const char *args, const struct fs_settings *set)
{
struct sis_fs *fs;
const char *p;
fs = i_new(struct sis_fs, 1);
fs->fs = fs_class_sis;
if (*args == '\0')
i_fatal("fs-sis: Parent filesystem not given as parameter");
p = strchr(args, ':');
if (p == NULL)
fs->super = fs_init(args, "", set);
else
fs->super = fs_init(t_strdup_until(args, p), p+1, set);
return &fs->fs;
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:19,代码来源:fs-sis.c
示例16: test_istream_unix_client
static void test_istream_unix_client(int fd)
{
/* 1) */
write_one(fd);
read_one(fd);
/* 2) */
if (fd_send(fd, send_fd, "1", 1) < 0)
i_fatal("fd_send() failed: %m");
read_one(fd);
/* 3) */
write_one(fd);
read_one(fd);
/* 4) */
if (fd_send(fd, send_fd2, "1", 1) < 0)
i_fatal("fd_send() failed: %m");
read_one(fd);
/* 5) */
write_one(fd);
read_one(fd);
/* 6) */
if (fd_send(fd, send_fd, "1", 1) < 0)
i_fatal("fd_send() failed: %m");
read_one(fd);
/* 7-8) */
if (fd_send(fd, send_fd, "1", 1) < 0)
i_fatal("fd_send() failed: %m");
if (fd_send(fd, send_fd2, "1", 1) < 0)
i_fatal("fd_send() failed: %m");
read_one(fd);
/* 9-10) */
if (fd_send(fd, send_fd, "1", 1) < 0)
i_fatal("fd_send() failed: %m");
if (fd_send(fd, send_fd2, "1", 1) < 0)
i_fatal("fd_send() failed: %m");
read_one(fd);
i_close_fd(&fd);
}
开发者ID:Raffprta,项目名称:core,代码行数:45,代码来源:test-istream-unix.c
示例17: stats_top_round
static bool stats_top_round(struct top_context *ctx)
{
#define TOP_CMD "EXPORT\tsession\tconnected\n"
const char *const *args;
pool_t tmp_pool;
if (write_full(ctx->fd, TOP_CMD, strlen(TOP_CMD)) < 0)
i_fatal("write(%s) failed: %m", ctx->path);
/* read header */
if (ctx->headers != NULL) {
args = read_next_line(ctx->input);
if (args == NULL)
i_fatal("read(%s) unexpectedly disconnected", ctx->path);
if (*args == NULL)
return TRUE;
if (str_array_length(args) != ctx->headers_count)
i_fatal("headers changed");
} else {
ctx->headers = p_read_next_line(default_pool, ctx->input);
if (ctx->headers == NULL)
i_fatal("read(%s) unexpectedly disconnected", ctx->path);
if (*ctx->headers == NULL) {
i_free_and_null(ctx->headers);
return FALSE;
}
ctx->headers_count = str_array_length((void *)ctx->headers);
if (!stats_header_find(ctx, "last_update", &ctx->last_update_idx))
i_fatal("last_update header missing");
if (!stats_header_find(ctx, "user", &ctx->user_idx))
i_fatal("user header missing");
stats_top_get_sorting(ctx);
}
array_clear(&ctx->lines);
p_clear(ctx->prev_pool);
tmp_pool = ctx->prev_pool;
ctx->prev_pool = ctx->cur_pool;
ctx->cur_pool = tmp_pool;
ctx->flip = !ctx->flip;
stats_read(ctx);
stats_drop_stale(ctx);
sort_ctx = ctx;
array_sort(&ctx->lines, *ctx->lines_sort);
sort_ctx = NULL;
return TRUE;
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:49,代码来源:doveadm-stats.c
示例18: test_fs_async
void test_fs_async(const char *test_name, enum fs_properties properties,
const char *driver, const char *args)
{
struct fs_settings fs_set;
struct fs *fs;
struct test_fs *test_fs;
const char *error;
i_zero(&fs_set);
if (fs_init(driver, args, &fs_set, &fs, &error) < 0)
i_fatal("fs_init() failed: %s", error);
test_fs = test_fs_get(fs);
test_fs->properties = properties;
test_fs_async_write(test_name, fs);
test_fs_async_copy(test_name, fs);
fs_deinit(&fs);
}
开发者ID:bdraco,项目名称:core,代码行数:20,代码来源:fs-test-async.c
示例19: io_loop_handle_add
void io_loop_handle_add(struct io_file *io)
{
struct ioloop_handler_context *ctx = io->io.ioloop->handler_context;
enum io_condition condition = io->io.condition;
int fd = io->fd;
i_assert(fd >= 0);
if (fd >= FD_SETSIZE)
i_fatal("fd %d too large for select()", fd);
if ((condition & (IO_READ | IO_ERROR)) != 0)
FD_SET(fd, &ctx->read_fds);
if ((condition & IO_WRITE) != 0)
FD_SET(fd, &ctx->write_fds);
FD_SET(fd, &ctx->except_fds);
if (io->fd > ctx->highest_fd)
ctx->highest_fd = io->fd;
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:20,代码来源:ioloop-select.c
示例20: env_clean
void env_clean(void)
{
#ifdef HAVE_CLEARENV
if (clearenv() < 0)
i_fatal("clearenv() failed");
#else
char ***environ_p = env_get_environ_p();
/* Try to clear the environment.
a) environ = NULL crashes on OS X.
b) *environ = NULL doesn't work on FreeBSD 7.0.
c) environ = emptyenv doesn't work on Haiku OS
d) environ = calloc() should work everywhere
*/
*environ_p = calloc(1, sizeof(**environ_p));
#endif
if (env_pool != NULL)
p_clear(env_pool);
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:20,代码来源:env-util.c
注:本文中的i_fatal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论