style(platform): normalize syscall error strings
- commit
- d088b642bd766ba41572d09a042c1fe8f9b38770
- author
- brice · · 2026-07-16 18:22 UTC
- parent
- 898d276
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +6 -6
M internal/platform/process.go +5 -5
| @@ -34,17 +34,17 @@ func selectProcessGroupPID(recs []processRecord, pgid int, shellPid int) (int, b | |||
| 34 | 34 | func parseKernProcArgs2(data []byte) ([]string, error) { | |
| 35 | 35 | const argcSize = 4 | |
| 36 | 36 | if len(data) < argcSize { | |
| 37 | - | return nil, fmt.Errorf("KERN_PROCARGS2: truncated argc") | |
| 37 | + | return nil, fmt.Errorf("kern_procargs2: truncated argc") | |
| 38 | 38 | } | |
| 39 | 39 | argc := int(int32(binary.LittleEndian.Uint32(data[:argcSize]))) | |
| 40 | 40 | if argc <= 0 { | |
| 41 | - | return nil, fmt.Errorf("KERN_PROCARGS2: invalid argc %d", argc) | |
| 41 | + | return nil, fmt.Errorf("kern_procargs2: invalid argc %d", argc) | |
| 42 | 42 | } | |
| 43 | 43 | ||
| 44 | 44 | rest := data[argcSize:] | |
| 45 | 45 | execEnd := bytes.IndexByte(rest, 0) | |
| 46 | 46 | if execEnd < 0 { | |
| 47 | - | return nil, fmt.Errorf("KERN_PROCARGS2: unterminated executable path") | |
| 47 | + | return nil, fmt.Errorf("kern_procargs2: unterminated executable path") | |
| 48 | 48 | } | |
| 49 | 49 | rest = rest[execEnd+1:] | |
| 50 | 50 | for len(rest) > 0 && rest[0] == 0 { | |
| @@ -53,14 +53,14 @@ func parseKernProcArgs2(data []byte) ([]string, error) { | |||
| 53 | 53 | // Each argument must contain at least its terminating NUL byte. Check this | |
| 54 | 54 | // before allocating from the kernel-provided argc. | |
| 55 | 55 | if argc > len(rest) { | |
| 56 | - | return nil, fmt.Errorf("KERN_PROCARGS2: argc %d exceeds remaining data", argc) | |
| 56 | + | return nil, fmt.Errorf("kern_procargs2: argc %d exceeds remaining data", argc) | |
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | 59 | argv := make([]string, 0, argc) | |
| 60 | 60 | for len(argv) < argc { | |
| 61 | 61 | end := bytes.IndexByte(rest, 0) | |
| 62 | 62 | if end < 0 { | |
| 63 | - | return nil, fmt.Errorf("KERN_PROCARGS2: truncated argv") | |
| 63 | + | return nil, fmt.Errorf("kern_procargs2: truncated argv") | |
| 64 | 64 | } | |
| 65 | 65 | argv = append(argv, string(rest[:end])) | |
| 66 | 66 | rest = rest[end+1:] | |
| @@ -34,17 +34,17 @@ func selectProcessGroupPID(recs []processRecord, pgid int, shellPid int) (int, b | |||||
| 34 | func parseKernProcArgs2(data []byte) ([]string, error) { | 34 | func parseKernProcArgs2(data []byte) ([]string, error) { | ||
| 35 | const argcSize = 4 | 35 | const argcSize = 4 | ||
| 36 | if len(data) < argcSize { | 36 | if len(data) < argcSize { | ||
| 37 | - | return nil, fmt.Errorf("KERN_PROCARGS2: truncated argc") | 37 | + | return nil, fmt.Errorf("kern_procargs2: truncated argc") |
| 38 | } | 38 | } | ||
| 39 | argc := int(int32(binary.LittleEndian.Uint32(data[:argcSize]))) | 39 | argc := int(int32(binary.LittleEndian.Uint32(data[:argcSize]))) | ||
| 40 | if argc <= 0 { | 40 | if argc <= 0 { | ||
| 41 | - | return nil, fmt.Errorf("KERN_PROCARGS2: invalid argc %d", argc) | 41 | + | return nil, fmt.Errorf("kern_procargs2: invalid argc %d", argc) |
| 42 | } | 42 | } | ||
| 43 | 43 | ||||
| 44 | rest := data[argcSize:] | 44 | rest := data[argcSize:] | ||
| 45 | execEnd := bytes.IndexByte(rest, 0) | 45 | execEnd := bytes.IndexByte(rest, 0) | ||
| 46 | if execEnd < 0 { | 46 | if execEnd < 0 { | ||
| 47 | - | return nil, fmt.Errorf("KERN_PROCARGS2: unterminated executable path") | 47 | + | return nil, fmt.Errorf("kern_procargs2: unterminated executable path") |
| 48 | } | 48 | } | ||
| 49 | rest = rest[execEnd+1:] | 49 | rest = rest[execEnd+1:] | ||
| 50 | for len(rest) > 0 && rest[0] == 0 { | 50 | for len(rest) > 0 && rest[0] == 0 { | ||
| @@ -53,14 +53,14 @@ func parseKernProcArgs2(data []byte) ([]string, error) { | |||||
| 53 | // Each argument must contain at least its terminating NUL byte. Check this | 53 | // Each argument must contain at least its terminating NUL byte. Check this | ||
| 54 | // before allocating from the kernel-provided argc. | 54 | // before allocating from the kernel-provided argc. | ||
| 55 | if argc > len(rest) { | 55 | if argc > len(rest) { | ||
| 56 | - | return nil, fmt.Errorf("KERN_PROCARGS2: argc %d exceeds remaining data", argc) | 56 | + | return nil, fmt.Errorf("kern_procargs2: argc %d exceeds remaining data", argc) |
| 57 | } | 57 | } | ||
| 58 | 58 | ||||
| 59 | argv := make([]string, 0, argc) | 59 | argv := make([]string, 0, argc) | ||
| 60 | for len(argv) < argc { | 60 | for len(argv) < argc { | ||
| 61 | end := bytes.IndexByte(rest, 0) | 61 | end := bytes.IndexByte(rest, 0) | ||
| 62 | if end < 0 { | 62 | if end < 0 { | ||
| 63 | - | return nil, fmt.Errorf("KERN_PROCARGS2: truncated argv") | 63 | + | return nil, fmt.Errorf("kern_procargs2: truncated argv") |
| 64 | } | 64 | } | ||
| 65 | argv = append(argv, string(rest[:end])) | 65 | argv = append(argv, string(rest[:end])) | ||
| 66 | rest = rest[end+1:] | 66 | rest = rest[end+1:] | ||
M internal/platform/process_darwin_arm64.go +1 -1
| @@ -150,7 +150,7 @@ func readDarwinProcessRecords() ([]processRecord, error) { | |||
| 150 | 150 | return nil, err | |
| 151 | 151 | } | |
| 152 | 152 | if len(data)%darwinKinfoProcSize != 0 { | |
| 153 | - | return nil, fmt.Errorf("KERN_PROC_ALL returned %d bytes, not a multiple of %d", len(data), darwinKinfoProcSize) | |
| 153 | + | return nil, fmt.Errorf("kern_proc_all returned %d bytes, not a multiple of %d", len(data), darwinKinfoProcSize) | |
| 154 | 154 | } | |
| 155 | 155 | recs := make([]processRecord, 0, len(data)/darwinKinfoProcSize) | |
| 156 | 156 | for len(data) > 0 { | |
| @@ -150,7 +150,7 @@ func readDarwinProcessRecords() ([]processRecord, error) { | |||||
| 150 | return nil, err | 150 | return nil, err | ||
| 151 | } | 151 | } | ||
| 152 | if len(data)%darwinKinfoProcSize != 0 { | 152 | if len(data)%darwinKinfoProcSize != 0 { | ||
| 153 | - | return nil, fmt.Errorf("KERN_PROC_ALL returned %d bytes, not a multiple of %d", len(data), darwinKinfoProcSize) | 153 | + | return nil, fmt.Errorf("kern_proc_all returned %d bytes, not a multiple of %d", len(data), darwinKinfoProcSize) |
| 154 | } | 154 | } | ||
| 155 | recs := make([]processRecord, 0, len(data)/darwinKinfoProcSize) | 155 | recs := make([]processRecord, 0, len(data)/darwinKinfoProcSize) | ||
| 156 | for len(data) > 0 { | 156 | for len(data) > 0 { | ||