MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / hello_producer

Function hello_producer

tests/c_api/sample_plugin.cpp:25–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23/* ---- producer callbacks ------------------------------------------------ */
24
25static int hello_producer(lmpfs_handle_t /*eng*/, lmpfs_plugin_buffer_t* out) {
26 const char msg[] = "Hello from a MemNixFS plugin!\n"
27 "Loaded from sample_plugin.dll, served at\n"
28 "/plugins/sample_plugin/hello.txt.\n";
29 out->length = sizeof(msg) - 1;
30 out->data = std::malloc(out->length);
31 if (!out->data) return -1;
32 std::memcpy(out->data, msg, out->length);
33 out->free_fn = nullptr; /* default to free() */
34 return 0;
35}
36
37static int pid_count_producer(lmpfs_handle_t eng, lmpfs_plugin_buffer_t* out) {
38 int n = lmpfs_process_count(eng);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected