summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/c/generated/tracepoints.c146
-rw-r--r--internal/c/generated/tracepoints.raku50
-rw-r--r--internal/generated/types/types.go132
3 files changed, 175 insertions, 153 deletions
diff --git a/internal/c/generated/tracepoints.c b/internal/c/generated/tracepoints.c
index 21b38d7..89c473a 100644
--- a/internal/c/generated/tracepoints.c
+++ b/internal/c/generated/tracepoints.c
@@ -1,71 +1,71 @@
// Code generated - don't change manually!
-#define SYS_EXIT_CACHESTAT 520
-#define SYS_ENTER_CACHESTAT 521
-#define SYS_EXIT_CLOSE_RANGE 692
-#define SYS_ENTER_CLOSE_RANGE 693
-#define SYS_EXIT_CLOSE 694
-#define SYS_ENTER_CLOSE 695
-#define SYS_EXIT_FCHOWN 704
-#define SYS_ENTER_FCHOWN 705
-#define SYS_EXIT_FCHMOD 718
-#define SYS_ENTER_FCHMOD 719
-#define SYS_EXIT_FCHDIR 722
-#define SYS_ENTER_FCHDIR 723
-#define SYS_EXIT_FTRUNCATE 734
-#define SYS_ENTER_FTRUNCATE 735
-#define SYS_EXIT_COPY_FILE_RANGE 738
-#define SYS_ENTER_COPY_FILE_RANGE 739
-#define SYS_EXIT_PWRITE64 754
-#define SYS_ENTER_PWRITE64 755
-#define SYS_EXIT_PREAD64 756
-#define SYS_ENTER_PREAD64 757
-#define SYS_EXIT_WRITE 758
-#define SYS_ENTER_WRITE 759
-#define SYS_EXIT_READ 760
-#define SYS_ENTER_READ 761
-#define SYS_EXIT_LSEEK 762
-#define SYS_ENTER_LSEEK 763
-#define SYS_EXIT_NEWFSTAT 770
-#define SYS_ENTER_NEWFSTAT 771
-#define SYS_EXIT_RENAME 786
-#define SYS_ENTER_RENAME 787
-#define SYS_EXIT_RENAMEAT 788
-#define SYS_ENTER_RENAMEAT 789
-#define SYS_EXIT_RENAMEAT2 790
-#define SYS_ENTER_RENAMEAT2 791
-#define SYS_EXIT_LINK 792
-#define SYS_ENTER_LINK 793
-#define SYS_EXIT_LINKAT 794
-#define SYS_ENTER_LINKAT 795
-#define SYS_EXIT_SYMLINK 796
-#define SYS_ENTER_SYMLINK 797
-#define SYS_EXIT_SYMLINKAT 798
-#define SYS_ENTER_SYMLINKAT 799
-#define SYS_EXIT_FCNTL 814
-#define SYS_ENTER_FCNTL 815
-#define SYS_EXIT_IOCTL 816
-#define SYS_ENTER_IOCTL 817
-#define SYS_EXIT_GETDENTS64 818
-#define SYS_ENTER_GETDENTS64 819
-#define SYS_EXIT_GETDENTS 820
-#define SYS_ENTER_GETDENTS 821
-#define SYS_EXIT_SYNC_FILE_RANGE 914
-#define SYS_ENTER_SYNC_FILE_RANGE 915
-#define SYS_EXIT_FDATASYNC 916
-#define SYS_ENTER_FDATASYNC 917
-#define SYS_EXIT_FSYNC 918
-#define SYS_ENTER_FSYNC 919
-#define SYS_EXIT_FSTATFS 936
-#define SYS_ENTER_FSTATFS 937
-#define SYS_EXIT_FLOCK 1012
-#define SYS_ENTER_FLOCK 1013
-#define SYS_EXIT_QUOTACTL_FD 1043
-#define SYS_ENTER_QUOTACTL_FD 1044
-#define SYS_EXIT_IO_URING_REGISTER 1366
-#define SYS_ENTER_IO_URING_REGISTER 1367
-#define SYS_EXIT_IO_URING_ENTER 1370
-#define SYS_ENTER_IO_URING_ENTER 1371
+#define SYS_EXIT_CACHESTAT 527
+#define SYS_ENTER_CACHESTAT 528
+#define SYS_EXIT_CLOSE_RANGE 700
+#define SYS_ENTER_CLOSE_RANGE 701
+#define SYS_EXIT_CLOSE 702
+#define SYS_ENTER_CLOSE 703
+#define SYS_EXIT_FCHOWN 712
+#define SYS_ENTER_FCHOWN 713
+#define SYS_EXIT_FCHMOD 726
+#define SYS_ENTER_FCHMOD 727
+#define SYS_EXIT_FCHDIR 730
+#define SYS_ENTER_FCHDIR 731
+#define SYS_EXIT_FTRUNCATE 742
+#define SYS_ENTER_FTRUNCATE 743
+#define SYS_EXIT_COPY_FILE_RANGE 746
+#define SYS_ENTER_COPY_FILE_RANGE 747
+#define SYS_EXIT_PWRITE64 762
+#define SYS_ENTER_PWRITE64 763
+#define SYS_EXIT_PREAD64 764
+#define SYS_ENTER_PREAD64 765
+#define SYS_EXIT_WRITE 766
+#define SYS_ENTER_WRITE 767
+#define SYS_EXIT_READ 768
+#define SYS_ENTER_READ 769
+#define SYS_EXIT_LSEEK 770
+#define SYS_ENTER_LSEEK 771
+#define SYS_EXIT_NEWFSTAT 778
+#define SYS_ENTER_NEWFSTAT 779
+#define SYS_EXIT_RENAME 794
+#define SYS_ENTER_RENAME 795
+#define SYS_EXIT_RENAMEAT 796
+#define SYS_ENTER_RENAMEAT 797
+#define SYS_EXIT_RENAMEAT2 798
+#define SYS_ENTER_RENAMEAT2 799
+#define SYS_EXIT_LINK 800
+#define SYS_ENTER_LINK 801
+#define SYS_EXIT_LINKAT 802
+#define SYS_ENTER_LINKAT 803
+#define SYS_EXIT_SYMLINK 804
+#define SYS_ENTER_SYMLINK 805
+#define SYS_EXIT_SYMLINKAT 806
+#define SYS_ENTER_SYMLINKAT 807
+#define SYS_EXIT_FCNTL 822
+#define SYS_ENTER_FCNTL 823
+#define SYS_EXIT_IOCTL 824
+#define SYS_ENTER_IOCTL 825
+#define SYS_EXIT_GETDENTS64 826
+#define SYS_ENTER_GETDENTS64 827
+#define SYS_EXIT_GETDENTS 828
+#define SYS_ENTER_GETDENTS 829
+#define SYS_EXIT_SYNC_FILE_RANGE 922
+#define SYS_ENTER_SYNC_FILE_RANGE 923
+#define SYS_EXIT_FDATASYNC 924
+#define SYS_ENTER_FDATASYNC 925
+#define SYS_EXIT_FSYNC 926
+#define SYS_ENTER_FSYNC 927
+#define SYS_EXIT_FSTATFS 944
+#define SYS_ENTER_FSTATFS 945
+#define SYS_EXIT_FLOCK 1020
+#define SYS_ENTER_FLOCK 1021
+#define SYS_EXIT_QUOTACTL_FD 1051
+#define SYS_ENTER_QUOTACTL_FD 1052
+#define SYS_EXIT_IO_URING_REGISTER 1377
+#define SYS_ENTER_IO_URING_REGISTER 1378
+#define SYS_EXIT_IO_URING_ENTER 1381
+#define SYS_ENTER_IO_URING_ENTER 1382
SEC("tracepoint/syscalls/sys_exit_cachestat")
int handle_sys_exit_cachestat(struct trace_event_raw_sys_exit *ctx) {
@@ -736,8 +736,8 @@ int handle_sys_enter_renameat(struct trace_event_raw_sys_enter *ctx) {
ev->tid = tid;
ev->time = bpf_ktime_get_ns() / 1000;
__builtin_memset(&(ev->oldname), 0, sizeof(ev->oldname) + sizeof(ev->newname));
- bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[0]);
- bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[1]);
+ bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[1]);
+ bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[3]);
bpf_ringbuf_submit(ev, 0);
return 0;
@@ -780,8 +780,8 @@ int handle_sys_enter_renameat2(struct trace_event_raw_sys_enter *ctx) {
ev->tid = tid;
ev->time = bpf_ktime_get_ns() / 1000;
__builtin_memset(&(ev->oldname), 0, sizeof(ev->oldname) + sizeof(ev->newname));
- bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[0]);
- bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[1]);
+ bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[1]);
+ bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[3]);
bpf_ringbuf_submit(ev, 0);
return 0;
@@ -868,8 +868,8 @@ int handle_sys_enter_linkat(struct trace_event_raw_sys_enter *ctx) {
ev->tid = tid;
ev->time = bpf_ktime_get_ns() / 1000;
__builtin_memset(&(ev->oldname), 0, sizeof(ev->oldname) + sizeof(ev->newname));
- bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[0]);
- bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[1]);
+ bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[1]);
+ bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[3]);
bpf_ringbuf_submit(ev, 0);
return 0;
@@ -957,7 +957,7 @@ int handle_sys_enter_symlinkat(struct trace_event_raw_sys_enter *ctx) {
ev->time = bpf_ktime_get_ns() / 1000;
__builtin_memset(&(ev->oldname), 0, sizeof(ev->oldname) + sizeof(ev->newname));
bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[0]);
- bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[1]);
+ bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[2]);
bpf_ringbuf_submit(ev, 0);
return 0;
diff --git a/internal/c/generated/tracepoints.raku b/internal/c/generated/tracepoints.raku
index cc78fbb..ad95559 100644
--- a/internal/c/generated/tracepoints.raku
+++ b/internal/c/generated/tracepoints.raku
@@ -4,8 +4,8 @@ use v6.d;
#use Grammar::Debugger;
grammar SysTraceFormat {
- rule TOP { <wholeformatsection>* }
- rule wholeformatsection { <name> <id> <format> <print-fmt> }
+ rule TOP { <whole-format-section>* }
+ rule whole-format-section { <name> <id> <format> <print-fmt> }
rule name { 'name:' <identifier> }
rule id { 'ID:' <number> }
rule format { 'format:' <field>* }
@@ -33,9 +33,16 @@ class Field {
}
class Format {
+ # Fields not accessible from raw tracepoints.
+ has Field @!internal-fields;
+ # Fields accessible from raw tracepoints.
+ has Field @!external-fields;
+ # Track internal/external field sections.
+ has Bool $!is-external = False;
+
has Str $.name is rw;
has Int $.id is rw;
- has Field @.fields is rw;
+
# file descriptor passed to syscalls.
has Bool $.has-fd is rw = False;
# Has tracepoint has got oldname and name
@@ -43,19 +50,32 @@ class Format {
# Syscall returns with a long value (e.g. bytes read/written)
has Bool $.has-long-ret is rw = False;
- method push(Field $field) {
- push @!fields: $field;
- if ($field.name eq 'fd' && $field.type eq 'unsigned int') {
+ method push(Field \field) {
+ # External fields start from this field name.
+ $!is-external = True if field.name eq '__syscall_nr';
+
+ if $!is-external {
+ push @!external-fields: field;
+ } else {
+ push @!internal-fields: field;
+ return;
+ }
+
+ if (field.name eq 'fd' && field.type eq 'unsigned int') {
$!has-fd = True;
- } elsif ($field.name eq 'newname' && $field.type eq 'const char *') {
+ } elsif (field.name eq 'newname' && field.type eq 'const char *') {
$!has-name = True;
- } elsif ($field.name eq 'ret' && $field.type eq 'long') {
+ } elsif (field.name eq 'ret' && field.type eq 'long') {
$.has-long-ret = True;
}
}
+ method !field-number(Str \field-name) {
+ @!external-fields.first(*.name eq field-name, :k) - 1;
+ }
+
method generate-constant returns Str {
- "#define {$!name.uc} {$!id}"
+ "#define {$!name.uc} {$!id}";
}
method generate-probe returns Str {
@@ -69,10 +89,12 @@ class Format {
my \extra-data = do if $!has-fd { 'ev->fd = (__s32)ctx->args[0];' }
elsif $!has-long-ret { 'ev->ret = ctx->ret;' }
elsif $!has-name {
- q:to/END/.trim-trailing;
- __builtin_memset(&(ev->oldname), 0, sizeof(ev->oldname) + sizeof(ev->newname));
- bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[0]);
- bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[1]);
+ my Int \oldname-index = self!field-number('oldname');
+ my Int \newname-index = self!field-number('newname');
+ qq:to/END/.trim-trailing;
+ __builtin_memset(\&(ev->oldname), 0, sizeof(ev->oldname) + sizeof(ev->newname));
+ bpf_probe_read_user_str(ev->oldname, sizeof(ev->oldname), (void*)ctx->args[{oldname-index}]);
+ bpf_probe_read_user_str(ev->newname, sizeof(ev->newname), (void*)ctx->args[{newname-index}]);
END
}
else { '' };
@@ -108,7 +130,7 @@ class SysTraceFormatActions {
method TOP($/) { make @!formats }
- method wholeformatsection($/) {
+ method whole-format-section($/) {
push @!formats: $!current-format;
$!current-format = Format.new;
}
diff --git a/internal/generated/types/types.go b/internal/generated/types/types.go
index 4abcadc..8925056 100644
--- a/internal/generated/types/types.go
+++ b/internal/generated/types/types.go
@@ -569,72 +569,72 @@ func (n *NameEvent) Recycle() {
poolOfNameEvents.Put(n)
}
-const SYS_EXIT_CACHESTAT TraceId = 520
-const SYS_ENTER_CACHESTAT TraceId = 521
-const SYS_EXIT_CLOSE_RANGE TraceId = 692
-const SYS_ENTER_CLOSE_RANGE TraceId = 693
-const SYS_EXIT_CLOSE TraceId = 694
-const SYS_ENTER_CLOSE TraceId = 695
-const SYS_EXIT_FCHOWN TraceId = 704
-const SYS_ENTER_FCHOWN TraceId = 705
-const SYS_EXIT_FCHMOD TraceId = 718
-const SYS_ENTER_FCHMOD TraceId = 719
-const SYS_EXIT_FCHDIR TraceId = 722
-const SYS_ENTER_FCHDIR TraceId = 723
-const SYS_EXIT_FTRUNCATE TraceId = 734
-const SYS_ENTER_FTRUNCATE TraceId = 735
-const SYS_EXIT_COPY_FILE_RANGE TraceId = 738
-const SYS_ENTER_COPY_FILE_RANGE TraceId = 739
-const SYS_EXIT_PWRITE64 TraceId = 754
-const SYS_ENTER_PWRITE64 TraceId = 755
-const SYS_EXIT_PREAD64 TraceId = 756
-const SYS_ENTER_PREAD64 TraceId = 757
-const SYS_EXIT_WRITE TraceId = 758
-const SYS_ENTER_WRITE TraceId = 759
-const SYS_EXIT_READ TraceId = 760
-const SYS_ENTER_READ TraceId = 761
-const SYS_EXIT_LSEEK TraceId = 762
-const SYS_ENTER_LSEEK TraceId = 763
-const SYS_EXIT_NEWFSTAT TraceId = 770
-const SYS_ENTER_NEWFSTAT TraceId = 771
-const SYS_EXIT_RENAME TraceId = 786
-const SYS_ENTER_RENAME TraceId = 787
-const SYS_EXIT_RENAMEAT TraceId = 788
-const SYS_ENTER_RENAMEAT TraceId = 789
-const SYS_EXIT_RENAMEAT2 TraceId = 790
-const SYS_ENTER_RENAMEAT2 TraceId = 791
-const SYS_EXIT_LINK TraceId = 792
-const SYS_ENTER_LINK TraceId = 793
-const SYS_EXIT_LINKAT TraceId = 794
-const SYS_ENTER_LINKAT TraceId = 795
-const SYS_EXIT_SYMLINK TraceId = 796
-const SYS_ENTER_SYMLINK TraceId = 797
-const SYS_EXIT_SYMLINKAT TraceId = 798
-const SYS_ENTER_SYMLINKAT TraceId = 799
-const SYS_EXIT_FCNTL TraceId = 814
-const SYS_ENTER_FCNTL TraceId = 815
-const SYS_EXIT_IOCTL TraceId = 816
-const SYS_ENTER_IOCTL TraceId = 817
-const SYS_EXIT_GETDENTS64 TraceId = 818
-const SYS_ENTER_GETDENTS64 TraceId = 819
-const SYS_EXIT_GETDENTS TraceId = 820
-const SYS_ENTER_GETDENTS TraceId = 821
-const SYS_EXIT_SYNC_FILE_RANGE TraceId = 914
-const SYS_ENTER_SYNC_FILE_RANGE TraceId = 915
-const SYS_EXIT_FDATASYNC TraceId = 916
-const SYS_ENTER_FDATASYNC TraceId = 917
-const SYS_EXIT_FSYNC TraceId = 918
-const SYS_ENTER_FSYNC TraceId = 919
-const SYS_EXIT_FSTATFS TraceId = 936
-const SYS_ENTER_FSTATFS TraceId = 937
-const SYS_EXIT_FLOCK TraceId = 1012
-const SYS_ENTER_FLOCK TraceId = 1013
-const SYS_EXIT_QUOTACTL_FD TraceId = 1043
-const SYS_ENTER_QUOTACTL_FD TraceId = 1044
-const SYS_EXIT_IO_URING_REGISTER TraceId = 1366
-const SYS_ENTER_IO_URING_REGISTER TraceId = 1367
-const SYS_EXIT_IO_URING_ENTER TraceId = 1370
-const SYS_ENTER_IO_URING_ENTER TraceId = 1371
+const SYS_EXIT_CACHESTAT TraceId = 527
+const SYS_ENTER_CACHESTAT TraceId = 528
+const SYS_EXIT_CLOSE_RANGE TraceId = 700
+const SYS_ENTER_CLOSE_RANGE TraceId = 701
+const SYS_EXIT_CLOSE TraceId = 702
+const SYS_ENTER_CLOSE TraceId = 703
+const SYS_EXIT_FCHOWN TraceId = 712
+const SYS_ENTER_FCHOWN TraceId = 713
+const SYS_EXIT_FCHMOD TraceId = 726
+const SYS_ENTER_FCHMOD TraceId = 727
+const SYS_EXIT_FCHDIR TraceId = 730
+const SYS_ENTER_FCHDIR TraceId = 731
+const SYS_EXIT_FTRUNCATE TraceId = 742
+const SYS_ENTER_FTRUNCATE TraceId = 743
+const SYS_EXIT_COPY_FILE_RANGE TraceId = 746
+const SYS_ENTER_COPY_FILE_RANGE TraceId = 747
+const SYS_EXIT_PWRITE64 TraceId = 762
+const SYS_ENTER_PWRITE64 TraceId = 763
+const SYS_EXIT_PREAD64 TraceId = 764
+const SYS_ENTER_PREAD64 TraceId = 765
+const SYS_EXIT_WRITE TraceId = 766
+const SYS_ENTER_WRITE TraceId = 767
+const SYS_EXIT_READ TraceId = 768
+const SYS_ENTER_READ TraceId = 769
+const SYS_EXIT_LSEEK TraceId = 770
+const SYS_ENTER_LSEEK TraceId = 771
+const SYS_EXIT_NEWFSTAT TraceId = 778
+const SYS_ENTER_NEWFSTAT TraceId = 779
+const SYS_EXIT_RENAME TraceId = 794
+const SYS_ENTER_RENAME TraceId = 795
+const SYS_EXIT_RENAMEAT TraceId = 796
+const SYS_ENTER_RENAMEAT TraceId = 797
+const SYS_EXIT_RENAMEAT2 TraceId = 798
+const SYS_ENTER_RENAMEAT2 TraceId = 799
+const SYS_EXIT_LINK TraceId = 800
+const SYS_ENTER_LINK TraceId = 801
+const SYS_EXIT_LINKAT TraceId = 802
+const SYS_ENTER_LINKAT TraceId = 803
+const SYS_EXIT_SYMLINK TraceId = 804
+const SYS_ENTER_SYMLINK TraceId = 805
+const SYS_EXIT_SYMLINKAT TraceId = 806
+const SYS_ENTER_SYMLINKAT TraceId = 807
+const SYS_EXIT_FCNTL TraceId = 822
+const SYS_ENTER_FCNTL TraceId = 823
+const SYS_EXIT_IOCTL TraceId = 824
+const SYS_ENTER_IOCTL TraceId = 825
+const SYS_EXIT_GETDENTS64 TraceId = 826
+const SYS_ENTER_GETDENTS64 TraceId = 827
+const SYS_EXIT_GETDENTS TraceId = 828
+const SYS_ENTER_GETDENTS TraceId = 829
+const SYS_EXIT_SYNC_FILE_RANGE TraceId = 922
+const SYS_ENTER_SYNC_FILE_RANGE TraceId = 923
+const SYS_EXIT_FDATASYNC TraceId = 924
+const SYS_ENTER_FDATASYNC TraceId = 925
+const SYS_EXIT_FSYNC TraceId = 926
+const SYS_ENTER_FSYNC TraceId = 927
+const SYS_EXIT_FSTATFS TraceId = 944
+const SYS_ENTER_FSTATFS TraceId = 945
+const SYS_EXIT_FLOCK TraceId = 1020
+const SYS_ENTER_FLOCK TraceId = 1021
+const SYS_EXIT_QUOTACTL_FD TraceId = 1051
+const SYS_ENTER_QUOTACTL_FD TraceId = 1052
+const SYS_EXIT_IO_URING_REGISTER TraceId = 1377
+const SYS_ENTER_IO_URING_REGISTER TraceId = 1378
+const SYS_EXIT_IO_URING_ENTER TraceId = 1381
+const SYS_ENTER_IO_URING_ENTER TraceId = 1382
const SYS_EXIT_OPEN TraceId = 1
const SYS_ENTER_OPEN TraceId = 2
const SYS_EXIT_OPENAT TraceId = 3