This wasn't used anywhere, and POSIX 2024 says it lives in <signal.h>.
MFC after: 1 week
Differential D50345
libproc: Remove SIG2STR_MAX. des on Wed, May 14, 10:09 AM. Authored by
Details
This wasn't used anywhere, and POSIX 2024 says it lives in <signal.h>. MFC after: 1 week
Diff Detail
Event TimelineComment Actions Hmm, my grep found a few uses in cddl tools for dtrace: cddl/contrib/opensolaris/cmd/dtrace/dtrace.c: char name[SIG2STR_MAX]; cddl/contrib/opensolaris/cmd/plockstat/plockstat.c: char name[SIG2STR_MAX]; lib/libproc/libproc.h:#define SIG2STR_MAX 8 Should it be moved to include/signal.h instead? Comment Actions The dtrace use is under #ifdef illumos but that should probably be fixed to always be enabled as proc_signame() exists in libproc. The plockstat use is enabled on both FreeBSD and illumos (and is also for a call to proc_signame()). Comment Actions There's a separate effort to add STR2SIG_MAX and the functions it was intended for to libc. This unused definition is in the way of that effort. Comment Actions Note that proc_signame() actually calls strsignal() and 8 bytes is far too short for the strings it returns, so that use is incorrect. Comment Actions (alternatively, proc_signame() is wrong to use strsignal(), but since libproc is completely undocumented, which is a bug in and of itself, I have no idea what it's actually intended to do.) Comment Actions libproc is a Solaris interface, so I think it's documented there. proc_signame() is functionally equivalent to strsignal() AFAIK. I'm surprised though that this diff compiles given the use in plockstat? Presumably the commit that adds SIG2STR_MAX to <signal.h> can just remove it from here as part of that commit which will keep the tree building? Comment Actions I didn't try to build it as it didn't look like the macro was used anywhere. Passing an eight-byte buffer to proc_signame() will not produce the expected result. The strings it returns are localized human-readable descriptions of the signals, like “Illegal instruction” or “Floating-point exception”. SIG2STR_MAX is intended for use with sig2str() which returns the name of the signal without the SIG prefix, like “ILL” or “FPE”. Comment Actions It seems libproc's proc_signame() is just buggy in FreeBSD. illumos calls str2sig(): https://github.com/illumos/illumos-gate/blob/1b1703a43cdfe482965d40a4baae758d05844ac2/usr/src/lib/libproc/common/proc_names.c#L106 I'd rather not add an unnecessary diff to the upstream dtrace sources if we don't have to. I'm fine with keeping the existing truncation we have for now if you just move SIG2STR_MAX to <signal.h>. I assume you are adding str2sig() and once it exists some enterprising soul can fix proc_signame() to use that instead of strsignal() if desired? |