Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ljluestc
Copy link

@ljluestc ljluestc commented Nov 4, 2025

A standalone utility that:

  • Does not link against libstrace (avoids UI/runtime dependencies)
  • Uses a generated header asinfo_syscalls.h built from src/linux/<arch>/syscallent.h
  • Provides three modes:
    • --to-names NR...: Convert syscall numbers to names
    • --to-numbers NAME...: Convert syscall names to numbers
    • --list: List all syscalls (format: NUMBER NAME)

Build Integration

  • src/Makefile.am:

    • Adds asinfo to bin_PROGRAMS
    • Generates asinfo_syscalls.h from syscallent.h at build time
    • Links asinfo standalone (no libstrace dependency)
    • Adds build rule dependencies
  • Makefile.am:

    • Adds doc/asinfo.1 to man_MANS for installation

Documentation

  • doc/asinfo.1: Manual page describing usage, options, and exit codes

Testing

Four new test cases in tests/:

  • asinfo.test: Basic roundtrip test (name → number → name)
  • asinfo-multi.test: Multiple argument handling
  • asinfo-errors.test: Error case validation (unknown names/numbers)
  • asinfo-list.test: Verification that --list includes expected syscalls

All tests pass successfully.

Packaging

  • debian/strace.install: Installs build/src/asinfo to /usr/bin
  • debian/strace.manpages: Installs build/doc/asinfo.1 to man pages

Usage Examples

# List all syscalls
$ asinfo --list | head -5
0 read
1 write
2 open
3 close
4 stat

# Convert name to number
$ asinfo --to-numbers read
0

# Convert number to name
$ asinfo --to-names 0
read

# Multiple conversions
$ asinfo --to-numbers read write open
0
1
2

$ asinfo --to-names 0 1 2
read
write
open

Technical Details

Syscall Table Generation

The asinfo_syscalls.h header is auto-generated at build time by parsing src/linux/<arch>/syscallent.h:

static const char *asinfo_syscall_names[] = {
    [0] = "read",
    [1] = "write",
    // ... etc
};
static const unsigned int asinfo_syscall_count = ...;

@masatake
Copy link
Contributor

masatake commented Nov 7, 2025

I like this.
This helps me decode /proc/$pid/syscall.

I would like to know the meaning (or the origin) of "a" in "a"sinfo.

You should not add the asinfo binary to the pull request.

@ldv-alt
Copy link
Member

ldv-alt commented Nov 8, 2025

I would like to know the meaning (or the origin) of "a" in "a"sinfo.

asinfo stands for "Advanced System call INFOrmation tool", see https://github.com/strace/strace/tree/EdgarKaziakhmedov/asinfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants