src/dbfs/interrupt.c
changeset 42 40a3b13ffc9d
parent 41 6abda2fa4579
child 44 9e76ee9729b6
equal deleted inserted replaced
41:6abda2fa4579 42:40a3b13ffc9d
     1 
     1 
     2 #include "dbfs.h"
     2 #include "dbfs.h"
     3 
     3 
       
     4 void _dbfs_interrupt_reply (evutil_socket_t _unused1, short _unused2, void *req_ptr) {
       
     5     struct fuse_req *req = req_ptr;
       
     6     err_t err;
       
     7     
       
     8     // error the req
       
     9     if ((err = -fuse_reply_err(req, EINTR)))
       
    10         EWARNING(err, "fuse_reply_err");
       
    11 }
       
    12 
     4 void dbfs_interrupt_query (struct fuse_req *req, void *query_ptr) {
    13 void dbfs_interrupt_query (struct fuse_req *req, void *query_ptr) {
       
    14     struct dbfs *ctx = fuse_req_userdata(req);
     5     struct evsql_query *query = query_ptr;
    15     struct evsql_query *query = query_ptr;
       
    16     struct timeval tv;
     6     err_t err;
    17     err_t err;
     7 
    18 
     8     // abort
    19     // abort query
     9     evsql_query_abort(NULL, query);
    20     evsql_query_abort(NULL, query);
    10 
    21     
    11     // error the req
    22     /*
    12     if ((err = -fuse_reply_err(req, EINTR)))
    23      * Due to a locking bug in libfuse (at least 2.7.4), we can't call fuse_reply_err from the interrupt function, so we must
    13         PWARNING("fuse_reply_err", err);
    24      * schedule after this function returns.
       
    25      */
       
    26     tv.tv_sec = 0;
       
    27     tv.tv_usec = 0;
       
    28     if (event_base_once(ctx->ev_base, -1, EV_TIMEOUT, _dbfs_interrupt_reply, req, &tv))
       
    29         PWARNING("event_base_once failed, dropping req reply: %p", req);
    14 }
    30 }
    15 
    31 
    16 void _dbfs_interrupt_ctx (struct fuse_req *req, void *ctx_ptr) {
    32 void _dbfs_interrupt_ctx (struct fuse_req *req, void *ctx_ptr) {
    17     // dereference ctx
    33     // dereference ctx
    18     struct dbfs_interrupt_ctx *ctx = ctx_ptr;
    34     struct dbfs_interrupt_ctx *ctx = ctx_ptr;