Пример #1
0
void kqueue_root_dtor(w_root_t *root) {
  struct kqueue_root_state *state = root->watch;

  if (!state) {
    return;
  }

  pthread_mutex_destroy(&state->lock);
  close(state->kq_fd);
  state->kq_fd = -1;
  w_ht_free(state->name_to_fd);
  w_ht_free(state->fd_to_name);

  free(state);
  root->watch = NULL;
}
Пример #2
0
void kqueue_root_dtor(watchman_global_watcher_t watcher, w_root_t *root) {
  struct kqueue_root_state *state = root->watch;
  unused_parameter(watcher);

  if (!state) {
    return;
  }

  pthread_mutex_destroy(&state->lock);
  close(state->kq_fd);
  state->kq_fd = -1;
  w_ht_free(state->name_to_fd);
  w_ht_free(state->fd_to_name);

  free(state);
  root->watch = NULL;
}
Пример #3
0
void derived_client_dtor(struct watchman_client *ptr) {
  struct watchman_user_client *client = (struct watchman_user_client *)ptr;

  /* cancel subscriptions */
  w_ht_free(client->subscriptions);
  client->subscriptions = NULL;

  w_client_vacate_states(client);
}
Пример #4
0
static void delete_subscription(w_ht_val_t val)
{
  struct watchman_client_subscription *sub = w_ht_val_ptr(val);

  w_string_delref(sub->name);
  w_query_delref(sub->query);
  if (sub->drop_or_defer) {
    w_ht_free(sub->drop_or_defer);
  }
  free(sub);
}
Пример #5
0
static void dispose_name(void *data)
{
  struct name_data *name = data;

  if (name->map) {
    w_ht_free(name->map);
  }
  if (name->name) {
    w_string_delref(name->name);
  }
  free(name);
}
Пример #6
0
static void client_delete(w_ht_val_t val)
{
  struct watchman_client *client = (struct watchman_client*)val;

  /* cancel subscriptions */
  w_ht_free(client->subscriptions);

  w_json_buffer_free(&client->reader);
  w_json_buffer_free(&client->writer);
  close(client->ping[0]);
  close(client->ping[1]);
  close(client->fd);
  free(client);
}
Пример #7
0
void inot_root_dtor(watchman_global_watcher_t watcher, w_root_t *root) {
  struct inot_root_state *state = root->watch;
  unused_parameter(watcher);

  if (!state) {
    return;
  }

  pthread_mutex_destroy(&state->lock);

  close(state->infd);
  state->infd = -1;
  if (state->wd_to_name) {
    w_ht_free(state->wd_to_name);
    state->wd_to_name = NULL;
  }
  if (state->move_map) {
    w_ht_free(state->move_map);
    state->move_map = NULL;
  }

  free(state);
  root->watch = NULL;
}
Пример #8
0
void inot_root_dtor(w_root_t *root) {
  struct inot_root_state *state = root->watch;


  if (!state) {
    return;
  }

  pthread_mutex_destroy(&state->lock);

  close(state->infd);
  state->infd = -1;
  if (state->wd_to_name) {
    w_ht_free(state->wd_to_name);
    state->wd_to_name = NULL;
  }
  if (state->move_map) {
    w_ht_free(state->move_map);
    state->move_map = NULL;
  }

  free(state);
  root->watch = NULL;
}
Пример #9
0
static void client_delete(w_ht_val_t val)
{
  struct watchman_client *client = w_ht_val_ptr(val);
  struct watchman_client_response *resp;

  /* cancel subscriptions */
  w_ht_free(client->subscriptions);

  while (client->head) {
    resp = client->head;
    client->head = resp->next;
    json_decref(resp->json);
    free(resp);
  }

  w_json_buffer_free(&client->reader);
  w_json_buffer_free(&client->writer);
  close(client->ping[0]);
  close(client->ping[1]);
  close(client->fd);
  free(client);
}
Пример #10
0
static void client_delete(w_ht_val_t val)
{
  struct watchman_client *client = w_ht_val_ptr(val);
  struct watchman_client_response *resp;

  w_log(W_LOG_DBG, "client_delete %p\n", client);

  /* cancel subscriptions */
  w_ht_free(client->subscriptions);

  while (client->head) {
    resp = client->head;
    client->head = resp->next;
    json_decref(resp->json);
    free(resp);
  }

  w_json_buffer_free(&client->reader);
  w_json_buffer_free(&client->writer);
  w_event_destroy(client->ping);
  w_stm_close(client->stm);
  free(client);
}
Пример #11
0
void w_trigger_command_free(struct watchman_trigger_command *cmd)
{
  if (cmd->triggername) {
    w_string_delref(cmd->triggername);
  }

  if (cmd->command) {
    json_decref(cmd->command);
  }

  if (cmd->definition) {
    json_decref(cmd->definition);
  }

  if (cmd->query) {
    w_query_delref(cmd->query);
  }

  if (cmd->envht) {
    w_ht_free(cmd->envht);
  }

  free(cmd);
}