Lines Matching full:it

68  * One data file might be shared by linking it several times.
125 writequeuef(struct qitem *it) in writequeuef() argument
130 queuefd = open_locked(it->queuefn, O_CREAT|O_EXCL|O_RDWR, 0660); in writequeuef()
135 it->queuef = fdopen(queuefd, "w+"); in writequeuef()
136 if (it->queuef == NULL) in writequeuef()
139 error = fprintf(it->queuef, in writequeuef()
143 it->queueid, in writequeuef()
144 it->sender, in writequeuef()
145 it->addr); in writequeuef()
150 if (fflush(it->queuef) != 0 || fsync(fileno(it->queuef)) != 0) in writequeuef()
164 struct qitem *it = NULL; in readqueuef() local
215 it = LIST_FIRST(&itmqueue.queue); in readqueuef()
216 it->sender = sender; sender = NULL; in readqueuef()
217 it->queueid = queueid; queueid = NULL; in readqueuef()
218 it->queuefn = queuefn; queuefn = NULL; in readqueuef()
219 LIST_INSERT_HEAD(&queue->queue, it, next); in readqueuef()
231 return (it); in readqueuef()
238 struct qitem *it; in linkspool() local
246 LIST_FOREACH(it, &queue->queue, next) { in linkspool()
247 if (asprintf(&it->queueid, "%s.%"PRIxPTR, queue->id, (uintptr_t)it) <= 0) in linkspool()
249 if (asprintf(&it->queuefn, "%s/Q%s", config.spooldir, it->queueid) <= 0) in linkspool()
251 if (asprintf(&it->mailfn, "%s/M%s", config.spooldir, it->queueid) <= 0) in linkspool()
255 if (stat(it->queuefn, &st) == 0 || stat(it->mailfn, &st) == 0) in linkspool()
258 if (writequeuef(it) != 0) in linkspool()
261 if (link(queue->tmpf, it->mailfn) != 0) in linkspool()
265 LIST_FOREACH(it, &queue->queue, next) { in linkspool()
267 it->addr, it->queueid); in linkspool()
274 LIST_FOREACH(it, &queue->queue, next) { in linkspool()
275 unlink(it->mailfn); in linkspool()
276 unlink(it->queuefn); in linkspool()
285 struct qitem *it; in load_queue() local
313 * Move on if it turns out to be something else than a file. in load_queue()
325 it = readqueuef(queue, queuefn); in load_queue()
326 if (it == NULL) in load_queue()
329 it->mailfn = mailfn; in load_queue()
347 delqueue(struct qitem *it) in delqueue() argument
349 unlink(it->mailfn); in delqueue()
350 unlink(it->queuefn); in delqueue()
351 if (it->queuef != NULL) in delqueue()
352 fclose(it->queuef); in delqueue()
353 if (it->mailf != NULL) in delqueue()
354 fclose(it->mailf); in delqueue()
355 free(it); in delqueue()
359 acquirespool(struct qitem *it) in acquirespool() argument
363 if (it->queuef == NULL) { in acquirespool()
364 queuefd = open_locked(it->queuefn, O_RDWR|O_NONBLOCK); in acquirespool()
367 it->queuef = fdopen(queuefd, "r+"); in acquirespool()
368 if (it->queuef == NULL) in acquirespool()
372 if (it->mailf == NULL) { in acquirespool()
373 it->mailf = fopen(it->mailfn, "r"); in acquirespool()
374 if (it->mailf == NULL) in acquirespool()
390 struct qitem *it; in dropspool() local
392 LIST_FOREACH(it, &queue->queue, next) { in dropspool()
393 if (it == keep) in dropspool()
396 if (it->queuef != NULL) in dropspool()
397 fclose(it->queuef); in dropspool()
398 if (it->mailf != NULL) in dropspool()
399 fclose(it->mailf); in dropspool()