nginx-0.0.1-2003-11-19-00:34:08 import
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 8d0b3ea..b5e4392 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -6,7 +6,8 @@
 
 
 /* STUB */
-void stub_init(ngx_log_t *log);
+void stub_init(ngx_cycle_t *cycle);
+
 
 
 static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log);
@@ -97,10 +98,6 @@
         return 1;
     }
 
-#if 0
-    stub_init(log);
-#endif
-
     ngx_max_module = 0;
     for (i = 0; ngx_modules[i]; i++) {
         ngx_modules[i]->index = ngx_max_module++;
@@ -261,6 +258,18 @@
     cycle->old_cycle = old_cycle;
 
 
+    n = old_cycle ? old_cycle->pathes.nelts : 10;
+    cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *));
+    if (cycle->pathes.elts == NULL) {
+        ngx_destroy_pool(pool);
+        return NULL;
+    }
+    cycle->pathes.nelts = 0;
+    cycle->pathes.size = sizeof(ngx_path_t *);
+    cycle->pathes.nalloc = n;
+    cycle->pathes.pool = pool;
+
+
     n = old_cycle ? old_cycle->open_files.nelts : 20;
     cycle->open_files.elts = ngx_pcalloc(pool, n * sizeof(ngx_open_file_t));
     if (cycle->open_files.elts == NULL) {
@@ -455,6 +464,8 @@
         }
     }
 
+    stub_init(cycle);
+
     if (old_cycle == NULL) {
         return cycle;
     }
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index d460fbe..23f436e 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -87,6 +87,7 @@
     ngx_log_t         *log;
     ngx_array_t        listening;
     ngx_array_t        open_files;
+    ngx_array_t        pathes;
 
     int                connection_n;
     ngx_connection_t  *connections;
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index f5a1c66..ee4c653 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -202,8 +202,14 @@
         return "is duplicate";
     }
 
-    ngx_test_null(path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)), NULL);
+    /* TODO: check duplicate in cf->cycle->pathes */
 
+    ngx_test_null(path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)),
+                  NGX_CONF_ERROR);
+
+    *pp = path;
+
+    ngx_test_null(pp, ngx_push_array(&cf->cycle->pathes), NGX_CONF_ERROR);
     *pp = path;
 
     value = (ngx_str_t *) cf->args->elts;
@@ -225,5 +231,7 @@
         path->level[i++] = 0;
     }
 
+    path->gc_handler = cmd->post;
+
     return NGX_CONF_OK;
 }
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index 33a5250..b1e5fb8 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -5,6 +5,10 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 
+typedef struct ngx_path_s  ngx_path_t;
+
+#include <ngx_garbage_collector.h>
+
 
 struct ngx_file_s {
     ngx_fd_t         fd;
@@ -12,6 +16,7 @@
     ngx_file_info_t  info;
 
     off_t            offset;
+    off_t            sys_offset;
 
     ngx_log_t       *log;
 
@@ -20,11 +25,12 @@
 
 #define NGX_MAX_PATH_LEVEL  3
 
-typedef struct {
-    ngx_str_t  name;
-    int        len;
-    int        level[3];
-} ngx_path_t;
+struct ngx_path_s {
+    ngx_str_t           name;
+    int                 len;
+    int                 level[3];
+    ngx_gc_handler_pt   gc_handler;
+};
 
 
 typedef struct {
diff --git a/src/core/ngx_garbage_collector.c b/src/core/ngx_garbage_collector.c
index 087b0ad..e673acd 100644
--- a/src/core/ngx_garbage_collector.c
+++ b/src/core/ngx_garbage_collector.c
@@ -1,24 +1,11 @@
 
 #include <ngx_config.h>
 #include <ngx_core.h>
+#include <ngx_garbage_collector.h>
 
 
-typedef struct ngx_gc_s  ngx_gc_t;
-
-typedef int (*ngx_gc_handler_pt) (ngx_gc_t *ctx, ngx_str_t *name,
-                                  ngx_dir_t *dir);
-
-
-static int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
-                                              ngx_dir_t *dir);
-
-struct ngx_gc_s {
-    ngx_path_t         *path;
-    u_int               deleted;
-    off_t               freed;
-    ngx_gc_handler_pt   handler;
-    ngx_log_t          *log;
-};
+int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
+                                       ngx_dir_t *dir);
 
 
 static int ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level);
@@ -64,27 +51,20 @@
 #endif
 
 
-void stub_init(ngx_log_t *log)
+void stub_init(ngx_cycle_t *cycle)
 {
-    ngx_gc_t    *ctx;
-    ngx_path_t   path;
+    int           i;
+    ngx_gc_t      ctx;
+    ngx_path_t  **path;
 
-    if (!(ctx = ngx_alloc(sizeof(ngx_gc_t), log))) {
-        return;
+    path = cycle->pathes.elts;
+    for (i = 0; i < cycle->pathes.nelts; i++) {
+        ctx.path = path[i];
+        ctx.log = cycle->log;
+        ctx.handler = path[i]->gc_handler;
+
+        ngx_collect_garbage(&ctx, &path[i]->name, 0);
     }
-
-    path.name.len = 4;
-    path.name.data = "temp";
-    path.len = 5;
-    path.level[0] = 1;
-    path.level[1] = 2;
-    path.level[2] = 0;
-
-    ctx->path = &path;
-    ctx->log = log;
-    ctx->handler = ngx_garbage_collector_temp_handler;
-
-    ngx_collect_garbage(ctx, &path.name, 0);
 }
 
 
@@ -254,8 +234,8 @@
 }
 
 
-static int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
-                                              ngx_dir_t *dir)
+int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
+                                       ngx_dir_t *dir)
 {
     /*
      * we use mtime only and do not use atime because:
@@ -279,5 +259,6 @@
 
     ctx->deleted++;
     ctx->freed += ngx_de_size(dir);
+
     return NGX_OK;
 }
diff --git a/src/core/ngx_garbage_collector.h b/src/core/ngx_garbage_collector.h
new file mode 100644
index 0000000..1164484
--- /dev/null
+++ b/src/core/ngx_garbage_collector.h
@@ -0,0 +1,24 @@
+#ifndef _NGX_GARBAGE_COLLECTOR_H_INCLUDED_
+#define _NGX_GARBAGE_COLLECTOR_H_INCLUDED_
+
+
+typedef struct ngx_gc_s  ngx_gc_t;
+
+typedef int (*ngx_gc_handler_pt) (ngx_gc_t *ctx, ngx_str_t *name,
+                                  ngx_dir_t *dir);
+
+
+struct ngx_gc_s {
+    ngx_path_t         *path;
+    u_int               deleted;
+    off_t               freed;
+    ngx_gc_handler_pt   handler;
+    ngx_log_t          *log;
+};
+
+
+int ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name, 
+                                       ngx_dir_t *dir);
+
+
+#endif /* _NGX_GARBAGE_COLLECTOR_H_INCLUDED_ */
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index e215243..e741ebd 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -41,12 +41,6 @@
 }
 
 
-time_t ngx_time()
-{
-    return ngx_cached_time;
-}
-
-
 void ngx_time_update()
 {
     ngx_tm_t  tm;
diff --git a/src/core/ngx_times.h b/src/core/ngx_times.h
index eb618cd..212fc8b 100644
--- a/src/core/ngx_times.h
+++ b/src/core/ngx_times.h
@@ -7,11 +7,12 @@
 
 
 void ngx_init_time();
-time_t ngx_time();
 void ngx_time_update();
 size_t ngx_http_time(char *buf, time_t t);
 void ngx_gmtime(time_t t, ngx_tm_t *tp);
 
+#define ngx_time()   ngx_cached_time
+
 
 extern time_t     ngx_cached_time;
 extern ngx_str_t  ngx_cached_err_log_time;