Bug 180719 - [libc] [patch] Compatibility enhancement - sigsend() (function) and sigsendset() (system call)
Summary: [libc] [patch] Compatibility enhancement - sigsend() (function) and sigsendse...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.2-BETA1
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-21 14:10 UTC by jau
Modified: 2019-01-28 14:29 UTC (History)
0 users

See Also:


Attachments
file.diff (30.69 KB, patch)
2013-07-21 14:10 UTC, jau
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jau 2013-07-21 14:10:00 UTC
These call interfaces allow sending signals to much more varied groups of
processes than the traditional kill().
They have been present in multiple commercial UNIX variants including at least
SunOS/Solaris, HP-UX, IRIX, and Tru64, but they are not required by any standard.
These call interfaces provide a nice parallel to the extended wait*() family
functions waitid() [standard requirement] and wait6() [freebsd extension].
Supporting them also improves compatibility and portability between several
commercial UNIX flavors and FreeBSD.
On the down side actively using them in ones own code will most likely cause
problems when trying to port such code to systems like Linux and AIX which
apparently do not provide these interfaces.

Solaris manual page for these APIs can be found also in the FreeBSD web manual
pages...
http://www.freebsd.org/cgi/man.cgi?query=sigsendset&apropos=0&sektion=0&manpath=SunOS+5.10&arch=default&format=html

Notice!
The attached patch will move idtype_t definition out of <sys/wait.h> to its own
header file <sys/_idtype.h> to make it easier to include idtype_t definitions
only where it is needed. When the patch has been applied <sys/_idtype.h> and
another new header <sys/procset.h> will be included also right at the end of
<signal.h> to complete the declarations of sigsend() and sigsendset().

Fix: Apply the attached patch.

Remember to run

make sysent

in /usr/src/sys/kern and /usr/src/sys/compat/freebsd32 when the patch
has been applied.



Patch attached with submission follows:
How-To-Repeat: No problem, just improved convenience, compatibility, and portability.
Comment 1 jau 2013-10-11 08:52:41 UTC
It is better to replace the following line in sigsend()

pset.p_op = POP_OR;

with

pset.p_op = POP_AND;

This is more efficient inside the kernel when scanning the process list.

--jau
Comment 2 jau789 2014-01-03 10:18:44 UTC
Now that a bunch of new system calls from cap_rights_limit() to procctl()
have reserved entry numbers from 533 to 544, the code 533 I had originally
used in the sigsend()/sigsendset() patch needs to be changed to 545.

--jau
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:42 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 jau 2019-01-28 14:29:23 UTC
Apparently even Linux supports sigsend() and sigsendset() these days.
Both binary and source code compatibility with Linux will need these
calls sooner or later.