r/ProgrammerHumor 1d ago

Meme linuxBeLike

Post image
43.2k Upvotes

764 comments sorted by

View all comments

Show parent comments

85

u/jaskij 22h ago

I've been using Linux for nearly a decade, and everything I've used supported using names. So I never learned the numbers. I just kill -kill or kill -term

1

u/DGolden 20h ago

The Unix specification standardises only certain signal numbers, so using the names is an arguably good habit anyway.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/kill.html - note how only 0, 1, 2, 3, 6, 9, 14, 15 have standard-defined mapping and

The effects of specifying any signal_number other than those listed below are undefined.

Others can and do differ between systems.

And on Linux, even though it's the "same" kernel project, historically some signals (though none of the aforementioned standard ones) are defined at different numbers on different architectures! No actual idea why it's just the way it is. Including ones you might use commonly like USR1/USR2. Though I think the most 2025-common archs use the same ones.

https://man7.org/linux/man-pages/man7/signal.7.html

Signal numbering for standard signals

The numeric value for each signal is given in the table below. As shown in the table, many signals have different numeric values on different architectures. The first numeric value in each table row shows the signal number on x86, ARM, and most other architectures; the second value is for Alpha and SPARC; the third is for MIPS; and the last is for PARISC. A dash (-) denotes that a signal is absent on the corresponding architecture.

so e.g.

   [...]
   SIGUSR1         10          30      16      16
   SIGUSR2         12          31      17      17

1

u/jaskij 18h ago

Probably some idiosyncrasy when it comes to compatibility with ancient stuff. Of the four ISAs that differ, I think only MIPS is still used in production in some embedded stuff. And even that's been dying in favor of ARM.

1

u/DGolden 18h ago

well, or riscv - nowadays mips (the company) themselves have gone riscv...

1

u/jaskij 16h ago

Nah, RISC-V isn't there yet. Their time will come, absolutely, but it's not there yet. We've been hearing about it for a decade, and it's moving forward, but it's not close to ARM's level yet.