hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/net/bpfilter/main.c
....@@ -6,11 +6,11 @@
66 #include <sys/socket.h>
77 #include <fcntl.h>
88 #include <unistd.h>
9
-#include "include/uapi/linux/bpf.h"
9
+#include "../../include/uapi/linux/bpf.h"
1010 #include <asm/unistd.h>
1111 #include "msgfmt.h"
1212
13
-int debug_fd;
13
+FILE *debug_f;
1414
1515 static int handle_get_cmd(struct mbox_request *cmd)
1616 {
....@@ -37,7 +37,7 @@
3737
3838 n = read(0, &req, sizeof(req));
3939 if (n != sizeof(req)) {
40
- dprintf(debug_fd, "invalid request %d\n", n);
40
+ fprintf(debug_f, "invalid request %d\n", n);
4141 return;
4242 }
4343
....@@ -47,7 +47,7 @@
4747
4848 n = write(1, &reply, sizeof(reply));
4949 if (n != sizeof(reply)) {
50
- dprintf(debug_fd, "reply failed %d\n", n);
50
+ fprintf(debug_f, "reply failed %d\n", n);
5151 return;
5252 }
5353 }
....@@ -55,9 +55,10 @@
5555
5656 int main(void)
5757 {
58
- debug_fd = open("/dev/console", 00000002);
59
- dprintf(debug_fd, "Started bpfilter\n");
58
+ debug_f = fopen("/dev/kmsg", "w");
59
+ setvbuf(debug_f, 0, _IOLBF, 0);
60
+ fprintf(debug_f, "<5>Started bpfilter\n");
6061 loop();
61
- close(debug_fd);
62
+ fclose(debug_f);
6263 return 0;
6364 }