kern_sig.c (c79126f2e4b31976a54d1c30961d8c7b0f740a3c) | kern_sig.c (6026dcd7ca888f3433f4df34ede69a77c1eb7701) |
---|---|
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 --- 3239 unchanged lines hidden (view full) --- 3248 if (new_val < 0) 3249 new_val = 0; 3250 num_cores = new_val; 3251 return (0); 3252} 3253SYSCTL_PROC(_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLFLAG_RW, 3254 0, sizeof(int), sysctl_debug_num_cores_check, "I", ""); 3255 | 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 --- 3239 unchanged lines hidden (view full) --- 3248 if (new_val < 0) 3249 new_val = 0; 3250 num_cores = new_val; 3251 return (0); 3252} 3253SYSCTL_PROC(_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLFLAG_RW, 3254 0, sizeof(int), sysctl_debug_num_cores_check, "I", ""); 3255 |
3256#define GZ_SUFFIX ".gz" | 3256#define GZIP_SUFFIX ".gz" 3257#define ZSTD_SUFFIX ".zst" |
3257 3258int compress_user_cores = 0; 3259 3260static int 3261sysctl_compress_user_cores(SYSCTL_HANDLER_ARGS) 3262{ 3263 int error, val; 3264 3265 val = compress_user_cores; 3266 error = sysctl_handle_int(oidp, &val, 0, req); 3267 if (error != 0 || req->newptr == NULL) 3268 return (error); 3269 if (val != 0 && !compressor_avail(val)) 3270 return (EINVAL); 3271 compress_user_cores = val; 3272 return (error); 3273} 3274SYSCTL_PROC(_kern, OID_AUTO, compress_user_cores, CTLTYPE_INT | CTLFLAG_RWTUN, 3275 0, sizeof(int), sysctl_compress_user_cores, "I", | 3258 3259int compress_user_cores = 0; 3260 3261static int 3262sysctl_compress_user_cores(SYSCTL_HANDLER_ARGS) 3263{ 3264 int error, val; 3265 3266 val = compress_user_cores; 3267 error = sysctl_handle_int(oidp, &val, 0, req); 3268 if (error != 0 || req->newptr == NULL) 3269 return (error); 3270 if (val != 0 && !compressor_avail(val)) 3271 return (EINVAL); 3272 compress_user_cores = val; 3273 return (error); 3274} 3275SYSCTL_PROC(_kern, OID_AUTO, compress_user_cores, CTLTYPE_INT | CTLFLAG_RWTUN, 3276 0, sizeof(int), sysctl_compress_user_cores, "I", |
3276 "Enable compression of user corefiles (" __XSTRING(COMPRESS_GZIP) " = gzip)"); | 3277 "Enable compression of user corefiles (" 3278 __XSTRING(COMPRESS_GZIP) " = gzip, " 3279 __XSTRING(COMPRESS_ZSTD) " = zstd)"); |
3277 3278int compress_user_cores_level = 6; 3279SYSCTL_INT(_kern, OID_AUTO, compress_user_cores_level, CTLFLAG_RWTUN, 3280 &compress_user_cores_level, 0, 3281 "Corefile compression level"); 3282 3283/* 3284 * Protect the access to corefilename[] by allproc_lock. --- 87 unchanged lines hidden (view full) --- 3372 default: 3373 sbuf_putc(&sb, format[i]); 3374 break; 3375 } 3376 } 3377 sx_sunlock(&corefilename_lock); 3378 free(hostname, M_TEMP); 3379 if (compress == COMPRESS_GZIP) | 3280 3281int compress_user_cores_level = 6; 3282SYSCTL_INT(_kern, OID_AUTO, compress_user_cores_level, CTLFLAG_RWTUN, 3283 &compress_user_cores_level, 0, 3284 "Corefile compression level"); 3285 3286/* 3287 * Protect the access to corefilename[] by allproc_lock. --- 87 unchanged lines hidden (view full) --- 3375 default: 3376 sbuf_putc(&sb, format[i]); 3377 break; 3378 } 3379 } 3380 sx_sunlock(&corefilename_lock); 3381 free(hostname, M_TEMP); 3382 if (compress == COMPRESS_GZIP) |
3380 sbuf_printf(&sb, GZ_SUFFIX); | 3383 sbuf_printf(&sb, GZIP_SUFFIX); 3384 else if (compress == COMPRESS_ZSTD) 3385 sbuf_printf(&sb, ZSTD_SUFFIX); |
3381 if (sbuf_error(&sb) != 0) { 3382 log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " 3383 "long\n", (long)pid, comm, (u_long)uid); 3384 sbuf_delete(&sb); 3385 free(name, M_TEMP); 3386 return (ENOMEM); 3387 } 3388 sbuf_finish(&sb); --- 361 unchanged lines hidden --- | 3386 if (sbuf_error(&sb) != 0) { 3387 log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too " 3388 "long\n", (long)pid, comm, (u_long)uid); 3389 sbuf_delete(&sb); 3390 free(name, M_TEMP); 3391 return (ENOMEM); 3392 } 3393 sbuf_finish(&sb); --- 361 unchanged lines hidden --- |