Bug 180719

Summary: [libc] [patch] Compatibility enhancement - sigsend() (function) and sigsendset() (system call)
Product: Base System Reporter: jau
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 9.2-BETA1   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

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.
Comment 5 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:39:34 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>