Ver Fonte

Fixed #TSB-1234 test

ilucky.si há 1 ano atrás
pai
commit
1813873d69
1 ficheiros alterados com 12 adições e 1 exclusões
  1. 12 1
      ebpftracer/ebpf/l7/l7.c

+ 12 - 1
ebpftracer/ebpf/l7/l7.c

@@ -304,8 +304,19 @@ void perf_event_batch_output(void *ctx,  struct l7_event *e) {
     bpf_printk("IK...perf_event_batch_output...e->payload_size=%d, e_length=%d", e->payload_size, e_length);
     unsigned char *src = (unsigned char *)e;
     unsigned char *dst = e_buff->data + e_buff->len;
-    for (int i = 0; i < e_length; i++) {   //IK:ERROR: IK: BPF stack limit of 512 bytes is exceeded. Please move large on stack variables into BPF per-cpu array map.
+//    for (int i = 0; i < e_length; i++) {   //IK:ERROR: IK: BPF stack limit of 512 bytes is exceeded. Please move large on stack variables into BPF per-cpu array map.
+//        *dst++ = *src++;
+//    }
+    while (remaining_bytes >= 16) {
+        *(unsigned int *)dst = *(unsigned int *)src;
+        dst += 16;
+        src += 16;
+        remaining_bytes -= 16;
+    }
+    // 处理剩余的字节
+    while (remaining_bytes > 0) {
         *dst++ = *src++;
+        remaining_bytes--;
     }
 
 	// IK: 更新e_buff.