Lines Matching defs:table

40 	 * assert that the table replied with the correct ID.
46 table_proc_nextid(struct table *table)
48 struct table_proc_priv *priv = table->t_handle;
53 fatal("table-proc: snprintf");
59 table_proc_send(struct table *table, const char *type, int service,
62 struct table_proc_priv *priv = table->t_handle;
66 fprintf(priv->out, "table|%s|%lld.%06ld|%s|%s",
68 table->t_name, type);
71 table_proc_nextid(table));
76 fprintf(priv->out, "|%s\n", table_proc_nextid(table));
79 fatal("table-proc: fflush");
83 table_proc_recv(struct table *table, const char *type)
85 struct table_proc_priv *priv = table->t_handle;
91 fatal("table-proc: getline");
114 log_warnx("warn: table-proc: failed to parse reply");
115 fatalx("table-proc: exiting");
123 table_proc_open(struct table *table)
133 fd = fork_proc_backend("table", table->t_config, table->t_name, 1);
135 fatalx("table-proc: exiting");
137 log_warnx("warn: table-proc: dup");
138 fatalx("table-proc: exiting");
141 fatalx("table-proc: fdopen");
143 fatalx("table-proc: fdopen");
147 fprintf(priv->out, "config|tablename|%s\n", table->t_name);
150 fatalx("table-proc: fflush");
156 fatalx("table-proc: invalid handshake reply");
163 fatalx("table-proc: unknown service %s", s);
169 fatal("table-proc: getline");
171 fatalx("table-proc: unexpected EOF during handshake");
173 fatalx("table-proc: no services registered");
175 table->t_services = services;
176 table->t_handle = priv;
182 table_proc_update(struct table *table)
186 table_proc_send(table, "update", -1, NULL);
187 r = table_proc_recv(table, "update-result");
194 log_warnx("warn: table-proc: %s update failed: %s",
195 table->t_name, r);
200 log_warnx("warn: table-proc: failed parse reply");
201 fatalx("table-proc: exiting");
205 table_proc_close(struct table *table)
207 struct table_proc_priv *priv = table->t_handle;
210 fatal("table-proc: fclose");
212 fatal("table-proc: fclose");
216 table->t_handle = NULL;
220 table_proc_lookup(struct table *table, enum table_service s, const char *k, char **dst)
230 table_proc_send(table, req, s, k);
231 r = table_proc_recv(table, res);
239 log_warnx("warn: table-proc: %s %s failed: %s",
240 table->t_name, req, r);
249 log_warnx("warn: table-proc: failed to parse reply");
250 fatalx("table-proc: exiting");
255 log_warnx("warn: table-proc: failed to parse reply");
256 fatalx("table-proc: exiting");
260 log_warnx("warn: table-proc: empty response");
261 fatalx("table-proc: exiting");
269 table_proc_fetch(struct table *table, enum table_service s, char **dst)
273 table_proc_send(table, "fetch", s, NULL);
274 r = table_proc_recv(table, "fetch-result");
282 log_warnx("warn: table-proc: %s fetch failed: %s",
283 table->t_name, r);
289 log_warnx("warn: table-proc: failed to parse reply");
290 fatalx("table-proc: exiting");
294 log_warnx("warn: table-proc: empty response");
295 fatalx("table-proc: exiting");