diff -ruN kozos24/main.c kozos25/main.c --- kozos24/main.c Sun Dec 2 21:10:47 2007 +++ kozos25/main.c Sun Dec 2 21:13:43 2007 @@ -1,5 +1,6 @@ #include #include +#include #include "kozos.h" @@ -8,29 +9,27 @@ static int sample_main(int argc, char *argv[]) { int i, count; - char *p; + char buf[128]; + char *p = buf; -#define INTERVAL 7 /* CPU能力に応じて調整してください */ +#define INTERVAL 5 /* CPU能力に応じて調整してください */ while (1) { count = 0; kz_timer(INTERVAL - argc); kz_recv(NULL, NULL); - p = kz_memalloc(128); p[0] = '['; p[1] = '0' + argc; p[2] = ']'; p[3] = '\0'; - kz_send(outlog_id, 0, p); + write(2, buf, 3); for (i = 0; i < 70; i++) { - p = kz_memalloc(128); p[0] = outnum[argc][(count++) % 10]; p[1] = '\0'; - kz_send(outlog_id, 0, p); + write(2, buf, 1); } - p = kz_memalloc(128); p[0] = '\n'; p[1] = '\0'; - kz_send(outlog_id, 0, p); + write(2, buf, 1); } return 0; } @@ -55,8 +54,8 @@ httpd_id = kz_run(httpd_main, "httpd", 9, 0, NULL); sample1_id = kz_run(sample_main, "sample1", 10, 0, NULL); - sample2_id = kz_run(sample_main, "sample2", 11, 1, NULL); - sample3_id = kz_run(sample_main, "sample3", 12, 2, NULL); + sample2_id = kz_run(sample_main, "sample2", 10, 1, NULL); + sample3_id = kz_run(sample_main, "sample3", 10, 2, NULL); return 0; }