kern_sig.c (7f49ce7a0b5f0d501d233308d73ccb1bf191a68b) | kern_sig.c (9d3ecb7e625f92880c5c885b8114f3452dcabed9) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 915 unchanged lines hidden (view full) --- 924osigreturn(struct thread *td, struct osigreturn_args *uap) 925{ 926 927 return (nosys(td, (struct nosys_args *)uap)); 928} 929#endif 930#endif /* COMPAT_43 */ 931 | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 915 unchanged lines hidden (view full) --- 924osigreturn(struct thread *td, struct osigreturn_args *uap) 925{ 926 927 return (nosys(td, (struct nosys_args *)uap)); 928} 929#endif 930#endif /* COMPAT_43 */ 931 |
932/* Would this signal be fatal to the current process, if it were caught ? */ 933bool 934sig_isfatal(struct proc *p, int sig) 935{ 936 intptr_t act; 937 int prop; 938 939 mtx_assert(&p->p_sigacts->ps_mtx, MA_OWNED); 940 act = (intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)]; 941 if ((intptr_t)SIG_DFL == act) { 942 prop = sigprop(sig); 943 return (0 != (prop & (SIGPROP_KILL | SIGPROP_CORE))); 944 } else { 945 return (false); 946 } 947} 948 | |
949/* 950 * Initialize signal state for process 0; 951 * set to ignore signals that are ignored by default. 952 */ 953void 954siginit(struct proc *p) 955{ 956 int i; --- 2488 unchanged lines hidden (view full) --- 3445 * %P process id (pid) 3446 * %U user id (uid) 3447 * For example, "%N.core" is the default; they can be disabled completely 3448 * by using "/dev/null", or all core files can be stored in "/cores/%U/%N-%P". 3449 * This is controlled by the sysctl variable kern.corefile (see above). 3450 */ 3451static int 3452corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td, | 932/* 933 * Initialize signal state for process 0; 934 * set to ignore signals that are ignored by default. 935 */ 936void 937siginit(struct proc *p) 938{ 939 int i; --- 2488 unchanged lines hidden (view full) --- 3428 * %P process id (pid) 3429 * %U user id (uid) 3430 * For example, "%N.core" is the default; they can be disabled completely 3431 * by using "/dev/null", or all core files can be stored in "/cores/%U/%N-%P". 3432 * This is controlled by the sysctl variable kern.corefile (see above). 3433 */ 3434static int 3435corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td, |
3453 int compress, struct vnode **vpp, char **namep) | 3436 int compress, int signum, struct vnode **vpp, char **namep) |
3454{ 3455 struct sbuf sb; 3456 struct nameidata nd; 3457 const char *format; 3458 char *hostname, *name; 3459 int cmode, error, flags, i, indexpos, indexlen, oflags, ncores; 3460 3461 hostname = NULL; --- 32 unchanged lines hidden (view full) --- 3494 indexlen = sbuf_len(&sb) - indexpos; 3495 break; 3496 case 'N': /* process name */ 3497 sbuf_printf(&sb, "%s", comm); 3498 break; 3499 case 'P': /* process id */ 3500 sbuf_printf(&sb, "%u", pid); 3501 break; | 3437{ 3438 struct sbuf sb; 3439 struct nameidata nd; 3440 const char *format; 3441 char *hostname, *name; 3442 int cmode, error, flags, i, indexpos, indexlen, oflags, ncores; 3443 3444 hostname = NULL; --- 32 unchanged lines hidden (view full) --- 3477 indexlen = sbuf_len(&sb) - indexpos; 3478 break; 3479 case 'N': /* process name */ 3480 sbuf_printf(&sb, "%s", comm); 3481 break; 3482 case 'P': /* process id */ 3483 sbuf_printf(&sb, "%u", pid); 3484 break; |
3485 case 'S': /* signal number */ 3486 sbuf_printf(&sb, "%i", signum); 3487 break; |
|
3502 case 'U': /* user id */ 3503 sbuf_printf(&sb, "%u", uid); 3504 break; 3505 default: 3506 log(LOG_ERR, 3507 "Unknown format character %c in " 3508 "corename `%s'\n", format[i], format); 3509 break; --- 101 unchanged lines hidden (view full) --- 3611 limit = (off_t)lim_cur(td, RLIMIT_CORE); 3612 if (limit == 0 || racct_get_available(p, RACCT_CORE) == 0) { 3613 PROC_UNLOCK(p); 3614 return (EFBIG); 3615 } 3616 PROC_UNLOCK(p); 3617 3618 error = corefile_open(p->p_comm, cred->cr_uid, p->p_pid, td, | 3488 case 'U': /* user id */ 3489 sbuf_printf(&sb, "%u", uid); 3490 break; 3491 default: 3492 log(LOG_ERR, 3493 "Unknown format character %c in " 3494 "corename `%s'\n", format[i], format); 3495 break; --- 101 unchanged lines hidden (view full) --- 3597 limit = (off_t)lim_cur(td, RLIMIT_CORE); 3598 if (limit == 0 || racct_get_available(p, RACCT_CORE) == 0) { 3599 PROC_UNLOCK(p); 3600 return (EFBIG); 3601 } 3602 PROC_UNLOCK(p); 3603 3604 error = corefile_open(p->p_comm, cred->cr_uid, p->p_pid, td, |
3619 compress_user_cores, &vp, &name); | 3605 compress_user_cores, p->p_sig, &vp, &name); |
3620 if (error != 0) 3621 return (error); 3622 3623 /* 3624 * Don't dump to non-regular files or files with links. 3625 * Do not dump into system files. Effective user must own the corefile. 3626 */ 3627 if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 || --- 245 unchanged lines hidden --- | 3606 if (error != 0) 3607 return (error); 3608 3609 /* 3610 * Don't dump to non-regular files or files with links. 3611 * Do not dump into system files. Effective user must own the corefile. 3612 */ 3613 if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 || --- 245 unchanged lines hidden --- |