2 * Sherlock Library -- Temporary Fastbufs
4 * (c) 2002 Martin Mares <mj@ucw.cz>
9 #include "lib/fastbuf.h"
12 #include <sys/fcntl.h>
14 static byte *temp_template = "/tmp/temp%d.%d";
16 static struct cfitem temp_config[] = {
17 { "Tempfiles", CT_SECTION, NULL },
18 { "Template", CT_STRING, &temp_template },
19 { NULL, CT_STOP, NULL }
22 static void CONSTRUCTOR temp_init_config(void)
24 cf_register(temp_config);
28 bopen_tmp(uns bufsize)
32 static uns temp_counter;
34 sprintf(buf, temp_template, (int) getpid(), temp_counter++);
35 f = bopen(buf, O_RDWR | O_CREAT | O_EXCL, bufsize);