]> mj.ucw.cz Git - libucw.git/commitdiff
Added file_close_all().
authorMartin Mares <mj@ucw.cz>
Fri, 1 Apr 2005 15:20:45 +0000 (15:20 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 1 Apr 2005 15:20:45 +0000 (15:20 +0000)
lib/mainloop.c
lib/mainloop.h

index c218a97276905eac35b781b1d08fdc636a14be72..c1dad101f4be22f91f3a77bbcf215be86ade62a8 100644 (file)
@@ -216,6 +216,13 @@ file_set_timeout(struct main_file *fi, timestamp_t expires)
   timer_add(&fi->timer, expires);
 }
 
+void
+file_close_all(void)
+{
+  CLIST_FOR_EACH(struct main_file *, f, main_file_list)
+    close(f->fd);
+}
+
 void
 hook_add(struct main_hook *ho)
 {
index 146c4ca71563e013a00ba189fe921107e482aef2..434f639b4add70fa4a99732f98a4b279849727ec 100644 (file)
@@ -60,6 +60,7 @@ void file_del(struct main_file *fi);
 void file_read(struct main_file *fi, void *buf, uns len);
 void file_write(struct main_file *fi, void *buf, uns len);
 void file_set_timeout(struct main_file *fi, timestamp_t expires);
+void file_close_all(void);                     /* Close all known main_file's; frequently used before fork() */
 
 /* Hooks to be called in each iteration of the main loop */