]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/mainloop.h
Compatibility with GCC < 4.0 is not needed any longer
[libucw.git] / ucw / mainloop.h
index 6e8ffae6d3704bb3114ffb5c70ca7559c51a8e0e..98722e599459c2a4baa327d88b1820e776846f33 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     UCW Library -- Main Loop
  *
- *     (c) 2004--2012 Martin Mares <mj@ucw.cz>
+ *     (c) 2004--2015 Martin Mares <mj@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
  *     of the GNU Lesser General Public License.
@@ -90,6 +90,7 @@ struct main_context {
   struct pollfd *poll_table;
   struct main_file **poll_file_table;
 #endif
+  uint poll_cnt;
   struct main_timer **timer_table;     /* Growing array containing the heap of timers */
   sigset_t want_signals;
   int sig_pipe_send;
@@ -352,9 +353,8 @@ struct main_file {
   int (*write_handler)(struct main_file *fi);
   void *data;                                  /* [*] Data for use by the handlers */
   uint events;
-#ifdef CONFIG_UCW_EPOLL
-  uint last_want_events;
-#else
+  uint want_events;
+#ifndef CONFIG_UCW_EPOLL
   struct pollfd *pollfd;
 #endif
 };
@@ -422,7 +422,7 @@ struct main_block_io {
   struct main_file file;
   byte *rbuf;                                  /* Read/write pointers for use by file_read/write */
   uint rpos, rlen;
-  byte *wbuf;
+  const byte *wbuf;
   uint wpos, wlen;
   void (*read_done)(struct main_block_io *bio);        /* [*] Called when file_read is finished; rpos < rlen if EOF */
   void (*write_done)(struct main_block_io *bio);       /* [*] Called when file_write is finished */
@@ -475,7 +475,7 @@ void block_io_read(struct main_block_io *bio, void *buf, uint len);
  * If you call it with zero @len, it will cancel the previous write, but note
  * that some data may already be written.
  **/
-void block_io_write(struct main_block_io *bio, void *buf, uint len);
+void block_io_write(struct main_block_io *bio, const void *buf, uint len);
 
 /**
  * Sets a timer for a file @bio. If the timer is not overwritten or disabled
@@ -580,7 +580,7 @@ void rec_io_stop_read(struct main_rec_io *rio);
 /** Analogous to @block_io_set_timeout(). **/
 void rec_io_set_timeout(struct main_rec_io *rio, timestamp_t expires_delta);
 
-void rec_io_write(struct main_rec_io *rio, void *data, uint len);
+void rec_io_write(struct main_rec_io *rio, const void *data, uint len);
 
 /**
  * An auxiliary function used for parsing of lines. When called in the @read_handler,