Rename PROC_PDEATHSIG_SET -> PROC_PDEATHSIG_CTL and PROC_PDEATHSIG_GET

-> PROC_PDEATHSIG_STATUS for consistency with other procctl(2)
operations names.

Requested by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
This commit is contained in:
Konstantin Belousov 2018-04-20 15:19:27 +00:00
parent f87beb93e8
commit 1302eea7bb
7 changed files with 33 additions and 33 deletions

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 18, 2018
.Dd April 20, 2018
.Dt PROCCTL 2
.Os
.Sh NAME
@ -391,7 +391,7 @@ otherwise.
See the note about sysctl
.Dv kern.trap_enotcap
above, which gives independent global control of signal delivery.
.It Dv PROC_PDEATHSIG_SET
.It Dv PROC_PDEATHSIG_CTL
Request the delivery of a signal when the parent of the calling
process exits.
.Fa idtype
@ -408,7 +408,7 @@ must point to a value of type
indicating the signal
that should be delivered to the caller.
Use zero to cancel a previously requested signal delivery.
.It Dv PROC_PDEATHSIG_GET
.It Dv PROC_PDEATHSIG_STATUS
Query the current signal number that will be delivered when the parent
of the calling process exits.
.Fa idtype
@ -520,9 +520,9 @@ or
request is invalid.
.It Bq Er EINVAL
The
.Dv PROC_PDEATHSIG_SET
.Dv PROC_PDEATHSIG_CTL
or
.Dv PROC_PDEATHSIG_GET
.Dv PROC_PDEATHSIG_STATUS
request referenced an unsupported
.Fa id ,
.Fa idtype
@ -547,7 +547,7 @@ The reaper facility is based on a similar feature of Linux and
DragonflyBSD, and first appeared in
.Fx 10.2 .
The
.Dv PROC_PDEATHSIG_SET
.Dv PROC_PDEATHSIG_CTL
facility is based on the prctl(PR_SET_PDEATHSIG, ...) feature of Linux,
and first appeared in
.Fx 12.0 .

View File

@ -3378,13 +3378,13 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap)
case PROC_TRAPCAP_STATUS:
data = &flags;
break;
case PROC_PDEATHSIG_SET:
case PROC_PDEATHSIG_CTL:
error = copyin(uap->data, &signum, sizeof(signum));
if (error != 0)
return (error);
data = &signum;
break;
case PROC_PDEATHSIG_GET:
case PROC_PDEATHSIG_STATUS:
data = &signum;
break;
default:
@ -3407,7 +3407,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap)
if (error == 0)
error = copyout(&flags, uap->data, sizeof(flags));
break;
case PROC_PDEATHSIG_GET:
case PROC_PDEATHSIG_STATUS:
if (error == 0)
error = copyout(&signum, uap->data, sizeof(signum));
break;

View File

@ -522,7 +522,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
credential_changing |= will_transition;
#endif
/* Don't inherit PROC_PDEATHSIG_SET value if setuid/setgid. */
/* Don't inherit PROC_PDEATHSIG_CTL value if setuid/setgid. */
if (credential_changing)
imgp->proc->p_pdeathsig = 0;

View File

@ -467,13 +467,13 @@ sys_procctl(struct thread *td, struct procctl_args *uap)
case PROC_TRAPCAP_STATUS:
data = &flags;
break;
case PROC_PDEATHSIG_SET:
case PROC_PDEATHSIG_CTL:
error = copyin(uap->data, &signum, sizeof(signum));
if (error != 0)
return (error);
data = &signum;
break;
case PROC_PDEATHSIG_GET:
case PROC_PDEATHSIG_STATUS:
data = &signum;
break;
default:
@ -495,7 +495,7 @@ sys_procctl(struct thread *td, struct procctl_args *uap)
if (error == 0)
error = copyout(&flags, uap->data, sizeof(flags));
break;
case PROC_PDEATHSIG_GET:
case PROC_PDEATHSIG_STATUS:
if (error == 0)
error = copyout(&signum, uap->data, sizeof(signum));
break;
@ -551,14 +551,14 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data)
case PROC_REAP_KILL:
case PROC_TRACE_STATUS:
case PROC_TRAPCAP_STATUS:
case PROC_PDEATHSIG_SET:
case PROC_PDEATHSIG_GET:
case PROC_PDEATHSIG_CTL:
case PROC_PDEATHSIG_STATUS:
if (idtype != P_PID)
return (EINVAL);
}
switch (com) {
case PROC_PDEATHSIG_SET:
case PROC_PDEATHSIG_CTL:
signum = *(int *)data;
p = td->td_proc;
if ((id != 0 && id != p->p_pid) ||
@ -568,7 +568,7 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t id, int com, void *data)
p->p_pdeathsig = signum;
PROC_UNLOCK(p);
return (0);
case PROC_PDEATHSIG_GET:
case PROC_PDEATHSIG_STATUS:
p = td->td_proc;
if (id != 0 && id != p->p_pid)
return (EINVAL);

View File

@ -51,8 +51,8 @@
#define PROC_TRACE_STATUS 8 /* query tracing status */
#define PROC_TRAPCAP_CTL 9 /* trap capability errors */
#define PROC_TRAPCAP_STATUS 10 /* query trap capability status */
#define PROC_PDEATHSIG_SET 11 /* set parent death signal */
#define PROC_PDEATHSIG_GET 12 /* get parent death signal */
#define PROC_PDEATHSIG_CTL 11 /* set parent death signal */
#define PROC_PDEATHSIG_STATUS 12 /* get parent death signal */
/* Operations for PROC_SPROTECT (passed in integer arg). */
#define PPROT_OP(x) ((x) & 0xf)

View File

@ -53,42 +53,42 @@ ATF_TC_BODY(arg_validation, tc)
/* bad signal */
signum = 8888;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_SET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
ATF_CHECK_EQ(-1, rc);
ATF_CHECK_EQ(EINVAL, errno);
/* bad id type */
signum = SIGINFO;
rc = procctl(8888, 0, PROC_PDEATHSIG_SET, &signum);
rc = procctl(8888, 0, PROC_PDEATHSIG_CTL, &signum);
ATF_CHECK_EQ(-1, rc);
ATF_CHECK_EQ(EINVAL, errno);
/* bad id (pid that doesn't match mine or zero) */
signum = SIGINFO;
rc = procctl(P_PID, (((getpid() + 1) % 10) + 100),
PROC_PDEATHSIG_SET, &signum);
PROC_PDEATHSIG_CTL, &signum);
ATF_CHECK_EQ(-1, rc);
ATF_CHECK_EQ(EINVAL, errno);
/* null pointer */
signum = SIGINFO;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_SET, NULL);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, NULL);
ATF_CHECK_EQ(-1, rc);
ATF_CHECK_EQ(EFAULT, errno);
/* good (pid == 0) */
signum = SIGINFO;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_SET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
ATF_CHECK_EQ(0, rc);
/* good (pid == my pid) */
signum = SIGINFO;
rc = procctl(P_PID, getpid(), PROC_PDEATHSIG_SET, &signum);
rc = procctl(P_PID, getpid(), PROC_PDEATHSIG_CTL, &signum);
ATF_CHECK_EQ(0, rc);
/* check that we can read the signal number back */
signum = 0xdeadbeef;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_GET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_STATUS, &signum);
ATF_CHECK_EQ(0, rc);
ATF_CHECK_EQ(SIGINFO, signum);
}
@ -102,14 +102,14 @@ ATF_TC_BODY(fork_no_inherit, tc)
/* request a signal on parent death in the parent */
signum = SIGINFO;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_SET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
rc = fork();
ATF_REQUIRE(rc != -1);
if (rc == 0) {
/* check that we didn't inherit the setting */
signum = 0xdeadbeef;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_GET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_STATUS, &signum);
assert(rc == 0);
assert(signum == 0);
_exit(0);
@ -138,7 +138,7 @@ ATF_TC_BODY(exec_inherit, tc)
/* request a signal on parent death and register a handler */
signum = SIGINFO;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_SET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
assert(rc == 0);
/* execute helper program: it asserts that it has the setting */
@ -186,7 +186,7 @@ ATF_TC_BODY(signal_delivered, tc)
signal(signum, dummy_signal_handler);
/* request a signal on death of our parent B */
rc = procctl(P_PID, 0, PROC_PDEATHSIG_SET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
assert(rc == 0);
/* tell B that we're ready for it to exit now */
@ -263,7 +263,7 @@ ATF_TC_BODY(signal_delivered_ptrace, tc)
signal(signum, dummy_signal_handler);
/* request a signal on parent death and register a handler */
rc = procctl(P_PID, 0, PROC_PDEATHSIG_SET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &signum);
assert(rc == 0);
/* tell D we are ready for it to attach */

View File

@ -38,11 +38,11 @@ int main(int argc, char **argv)
/*
* This program is executed by the pdeathsig test
* to check if the PROC_PDEATHSIG_SET setting was
* to check if the PROC_PDEATHSIG_CTL setting was
* inherited.
*/
signum = 0xdeadbeef;
rc = procctl(P_PID, 0, PROC_PDEATHSIG_GET, &signum);
rc = procctl(P_PID, 0, PROC_PDEATHSIG_STATUS, &signum);
assert(rc == 0);
assert(signum == SIGINFO);