blob: f8234421edc2216758c132435b38b9741d041651 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
__attribute__((constructor))
void constr() {
printf("kaas: constructor!\n");
}
__attribute__((destructor))
void destr() {
printf("kaas: destructor!\n");
}
int worker_init(int version) {
printf("kaas: initialised with version %d\n", version);
return 0;
}
int worker_run_job(size_t size, void *input_, size_t *outsize, void **outputp) {
const char *input = input_;
char *output = malloc(size);
for (size_t i = 0; i < size; i++) output[i] = toupper(input[i]);
*outsize = size;
*outputp = output;
return 0;
}
void worker_free_outdata(size_t size, void *data) {
(void)size;
free(data);
}
|