<commit_before>#include "ipc.h"
#include "tock.h"

int ipc_discover(const char* pkg_name) {
  int len = strlen(pkg_name);
  allow_ro_return_t prev = allow_readonly(IPC_DRIVER_NUM, 0, pkg_name, len);
  syscall_return_t res   = command2(IPC_DRIVER_NUM, 1, 0, 0);
  prev = allow_readonly(IPC_DRIVER_NUM, 0, prev.ptr, prev.size);
  if (res.type != TOCK_SYSCALL_SUCCESS_U32) {
    return tock_error_to_rcode(res.data[0]);
  } else {
    return res.data[0];
  }
}

int ipc_register_svc(subscribe_upcall callback, void *ud) {
  return subscribe(IPC_DRIVER_NUM, 0, callback, ud);
}

int ipc_register_client_cb(int svc_id, subscribe_upcall callback, void *ud) {
  if (svc_id <= 0) {
    return -1;
  }
  return subscribe(IPC_DRIVER_NUM, svc_id, callback, ud);
}

int ipc_notify_svc(int pid) {
  syscall_return_t res = command2(IPC_DRIVER_NUM, 2, pid, 0);
  if (res.type != TOCK_SYSCALL_SUCCESS) {
    return tock_error_to_rcode(res.data[0]);
  } else {
    return TOCK_SUCCESS;
  }
}

int ipc_notify_client(int pid) {
  return command(IPC_DRIVER_NUM, 3, pid, 0);
}

allow_rw_return_t ipc_share(int pid, void* base, int len) {
  return allow_readwrite(IPC_DRIVER_NUM, pid, base, len);
}
<commit_msg>Fix IPC command.<commit_after>#include "ipc.h"
#include "tock.h"

int ipc_discover(const char* pkg_name) {
  int len = strlen(pkg_name);
  allow_ro_return_t prev = allow_readonly(IPC_DRIVER_NUM, 0, pkg_name, len);
  syscall_return_t res   = command2(IPC_DRIVER_NUM, 1, 0, 0);
  prev = allow_readonly(IPC_DRIVER_NUM, 0, prev.ptr, prev.size);
  if (res.type != TOCK_SYSCALL_SUCCESS_U32) {
    return tock_error_to_rcode(res.data[0]);
  } else {
    return res.data[0];
  }
}

int ipc_register_svc(subscribe_upcall callback, void *ud) {
  return subscribe(IPC_DRIVER_NUM, 0, callback, ud);
}

int ipc_register_client_cb(int svc_id, subscribe_upcall callback, void *ud) {
  if (svc_id <= 0) {
    return -1;
  }
  return subscribe(IPC_DRIVER_NUM, svc_id, callback, ud);
}

int ipc_notify_svc(int pid) {
  syscall_return_t res = command2(IPC_DRIVER_NUM, 2, pid, 0);
  if (res.type != TOCK_SYSCALL_SUCCESS) {
    return tock_error_to_rcode(res.data[0]);
  } else {
    return TOCK_SUCCESS;
  }
}

int ipc_notify_client(int pid) {
  return command2(IPC_DRIVER_NUM, 3, pid, 0);
}

allow_rw_return_t ipc_share(int pid, void* base, int len) {
  return allow_readwrite(IPC_DRIVER_NUM, pid, base, len);
}

{'fraction_non_alphanumeric': 0.12216624685138538, 'fraction_numerical': 0.0163727959697733, 'mean_word_length': 4.840686274509804, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '565013', 'n_tokens_mistral': 1039, 'n_tokens_neox': 992, 'n_words': 202}