Commit 14f8ea85 authored by Niels Möller's avatar Niels Möller
Browse files

close_callbacks now get a reason as argument.

Rev: src/io.h:1.11
parent 3dd6e4e7
......@@ -40,7 +40,7 @@ struct io_fd
struct io_fd *next;
int fd;
int please_close;
int close_now;
/* Reading */
struct read_handler *handler;
......@@ -48,11 +48,11 @@ struct io_fd
/* Writing */
struct write_buffer *buffer;
struct callback *close_callback;
int close_reason;
struct close_callback *close_callback;
/* A closed function with a file descriptor as argument */
struct fd_callback
struct lsh_object header;
......@@ -62,6 +62,20 @@ struct fd_callback
#define FD_CALLBACK(c, fd) ((c)->f(&(c), (fd)))
/* Close callbacks are called with a reason as argument. */
#define CLOSE_EOF 0
struct close_callback
struct lsh_object header;
int (*f)(struct close_callback *closure, int reason);
#define CLOSE_CALLBACK(c, r) ((c)->f((c), (r)))
struct listen_fd
struct lsh_object header;
......@@ -127,6 +141,6 @@ struct abstract_write *io_read_write(struct io_backend *b,
int fd,
struct read_handler *read_callback,
UINT32 block_size,
struct callback *close_callback);
struct close_callback *close_callback);
#endif /* LSH_IO_H_INCLUDED */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment