1061 if (EVSENDP(ctp, CT_PR_EV_FORK)) {
1062 nvlist_t *nvl;
1063
1064 VERIFY(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP) == 0);
1065 VERIFY(nvlist_add_uint32(nvl, CTPE_PID, cp->p_pid) == 0);
1066 VERIFY(nvlist_add_uint32(nvl, CTPE_PPID, pp->p_pid) == 0);
1067
1068 event = kmem_zalloc(sizeof (ct_kevent_t), KM_SLEEP);
1069 event->cte_flags = EVINFOP(ctp, CT_PR_EV_FORK) ? CTE_INFO : 0;
1070 event->cte_type = CT_PR_EV_FORK;
1071 (void) cte_publish_all(ct, event, nvl, NULL);
1072 }
1073
1074 /*
1075 * Because the CT_PR_KEEP_EXEC flag is meant to be used by applications
1076 * which are not contract aware, we can assume that these applications
1077 * will never explicitly abandon the child's new contract. Thus, we
1078 * abandon it now.
1079 */
1080 if (ctp->conp_params & CT_PR_KEEP_EXEC) {
1081 contract_abandon(ct, pp, 1);
1082 }
1083
1084 return (ctp);
1085 }
1086
1087 /*
1088 * contract_process_core
1089 *
1090 * Called on core file generation attempts. Generates a core event, if
1091 * requested, containing the names of the process, global, and
1092 * system-global ("zone") core files. If dumping core is in the fatal
1093 * event set, calls contract_process_kill().
1094 */
1095 void
1096 contract_process_core(cont_process_t *ctp, proc_t *p, int sig,
1097 const char *process, const char *global, const char *zone)
1098 {
1099 contract_t *ct = &ctp->conp_contract;
1100
1101 if (EVSENDP(ctp, CT_PR_EV_CORE)) {
|
1061 if (EVSENDP(ctp, CT_PR_EV_FORK)) {
1062 nvlist_t *nvl;
1063
1064 VERIFY(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP) == 0);
1065 VERIFY(nvlist_add_uint32(nvl, CTPE_PID, cp->p_pid) == 0);
1066 VERIFY(nvlist_add_uint32(nvl, CTPE_PPID, pp->p_pid) == 0);
1067
1068 event = kmem_zalloc(sizeof (ct_kevent_t), KM_SLEEP);
1069 event->cte_flags = EVINFOP(ctp, CT_PR_EV_FORK) ? CTE_INFO : 0;
1070 event->cte_type = CT_PR_EV_FORK;
1071 (void) cte_publish_all(ct, event, nvl, NULL);
1072 }
1073
1074 /*
1075 * Because the CT_PR_KEEP_EXEC flag is meant to be used by applications
1076 * which are not contract aware, we can assume that these applications
1077 * will never explicitly abandon the child's new contract. Thus, we
1078 * abandon it now.
1079 */
1080 if (ctp->conp_params & CT_PR_KEEP_EXEC) {
1081 (void) contract_abandon(ct, pp, 1);
1082 }
1083
1084 return (ctp);
1085 }
1086
1087 /*
1088 * contract_process_core
1089 *
1090 * Called on core file generation attempts. Generates a core event, if
1091 * requested, containing the names of the process, global, and
1092 * system-global ("zone") core files. If dumping core is in the fatal
1093 * event set, calls contract_process_kill().
1094 */
1095 void
1096 contract_process_core(cont_process_t *ctp, proc_t *p, int sig,
1097 const char *process, const char *global, const char *zone)
1098 {
1099 contract_t *ct = &ctp->conp_contract;
1100
1101 if (EVSENDP(ctp, CT_PR_EV_CORE)) {
|