X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ucw%2Ftempfile.c;h=cb0914ac12f42908fc98f8f310263e5e751ca424;hb=564be9c0adf9f5796b60f2727cecc9c7274f86ff;hp=f8b0294b9e85b8c4b19f9d6574d9cd10f5fb7892;hpb=a4fe009d3366b0a3e119713b0ecc7fc0070efdfa;p=libucw.git diff --git a/ucw/tempfile.c b/ucw/tempfile.c index f8b0294b..cb0914ac 100644 --- a/ucw/tempfile.c +++ b/ucw/tempfile.c @@ -8,11 +8,11 @@ * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" -#include "ucw/conf.h" -#include "ucw/threads.h" -#include "ucw/lfs.h" -#include "ucw/fastbuf.h" +#include +#include +#include +#include +#include #include #include @@ -52,7 +52,7 @@ temp_file_name(char *name_buf, int *open_flags) struct timeval tv; if (gettimeofday(&tv, NULL)) die("gettimeofday() failed: %m"); - len = snprintf(name_buf, TEMP_FILE_NAME_LEN, "%s/%s%u", dir, temp_prefix, (uns) tv.tv_usec); + len = snprintf(name_buf, TEMP_FILE_NAME_LEN, "%s/%s%u", dir, temp_prefix, (uint) tv.tv_usec); if (open_flags) *open_flags = O_EXCL; } @@ -61,10 +61,10 @@ temp_file_name(char *name_buf, int *open_flags) struct ucwlib_context *ctx = ucwlib_thread_context(); int cnt = ++ctx->temp_counter; int pid = getpid(); - if (ctx->thread_id == pid) + if (ucwlib_thread_id(ctx) == pid) len = snprintf(name_buf, TEMP_FILE_NAME_LEN, "%s/%s%d-%d", dir, temp_prefix, pid, cnt); else - len = snprintf(name_buf, TEMP_FILE_NAME_LEN, "%s/%s%d-%d-%d", dir, temp_prefix, pid, ctx->thread_id, cnt); + len = snprintf(name_buf, TEMP_FILE_NAME_LEN, "%s/%s%d-%d-%d", dir, temp_prefix, pid, ucwlib_thread_id(ctx), cnt); if (open_flags) *open_flags = 0; } @@ -88,7 +88,7 @@ open_tmp(char *name_buf, int open_flags, int mode) #ifdef TEST -#include "ucw/getopt.h" +#include int main(int argc, char **argv) {