Lines Matching full:cn
69 static int expand_corename(struct core_name *cn, int size) in expand_corename() argument
71 char *corename = krealloc(cn->corename, size, GFP_KERNEL); in expand_corename()
79 cn->size = ksize(corename); in expand_corename()
80 cn->corename = corename; in expand_corename()
84 static __printf(2, 0) int cn_vprintf(struct core_name *cn, const char *fmt, in cn_vprintf() argument
91 free = cn->size - cn->used; in cn_vprintf()
94 need = vsnprintf(cn->corename + cn->used, free, fmt, arg_copy); in cn_vprintf()
98 cn->used += need; in cn_vprintf()
102 if (!expand_corename(cn, cn->size + need - free + 1)) in cn_vprintf()
108 static __printf(2, 3) int cn_printf(struct core_name *cn, const char *fmt, ...) in cn_printf() argument
114 ret = cn_vprintf(cn, fmt, arg); in cn_printf()
121 int cn_esc_printf(struct core_name *cn, const char *fmt, ...) in cn_esc_printf() argument
123 int cur = cn->used; in cn_esc_printf()
128 ret = cn_vprintf(cn, fmt, arg); in cn_esc_printf()
136 if ((cn->used - cur == 1 && cn->corename[cur] == '.') || in cn_esc_printf()
137 (cn->used - cur == 2 && cn->corename[cur] == '.' in cn_esc_printf()
138 && cn->corename[cur+1] == '.')) in cn_esc_printf()
139 cn->corename[cur] = '!'; in cn_esc_printf()
147 if (cn->used == cur) in cn_esc_printf()
148 ret = cn_printf(cn, "!"); in cn_esc_printf()
151 for (; cur < cn->used; ++cur) { in cn_esc_printf()
152 if (cn->corename[cur] == '/') in cn_esc_printf()
153 cn->corename[cur] = '!'; in cn_esc_printf()
158 static int cn_print_exe_file(struct core_name *cn, bool name_only) in cn_print_exe_file() argument
166 return cn_esc_printf(cn, "%s (path unknown)", current->comm); in cn_print_exe_file()
185 ret = cn_esc_printf(cn, "%s", path); in cn_print_exe_file()
198 static int format_corename(struct core_name *cn, struct coredump_params *cprm, in format_corename() argument
208 cn->used = 0; in format_corename()
209 cn->corename = NULL; in format_corename()
210 if (expand_corename(cn, core_name_size)) in format_corename()
212 cn->corename[0] = '\0'; in format_corename()
234 if (cn->used != 0) in format_corename()
240 err = cn_printf(cn, "%c", '\0'); in format_corename()
243 (*argv)[(*argc)++] = cn->used; in format_corename()
247 err = cn_printf(cn, "%c", *pat_ptr++); in format_corename()
255 err = cn_printf(cn, "%c", '%'); in format_corename()
260 err = cn_printf(cn, "%d", in format_corename()
265 err = cn_printf(cn, "%d", in format_corename()
269 err = cn_printf(cn, "%d", in format_corename()
273 err = cn_printf(cn, "%d", in format_corename()
278 err = cn_printf(cn, "%u", in format_corename()
284 err = cn_printf(cn, "%u", in format_corename()
289 err = cn_printf(cn, "%d", in format_corename()
294 err = cn_printf(cn, "%d", in format_corename()
302 err = cn_printf(cn, "%lld", time); in format_corename()
308 err = cn_esc_printf(cn, "%s", in format_corename()
314 err = cn_esc_printf(cn, "%s", current->comm); in format_corename()
318 err = cn_print_exe_file(cn, true); in format_corename()
321 err = cn_print_exe_file(cn, false); in format_corename()
325 err = cn_printf(cn, "%lu", in format_corename()
345 err = cn_printf(cn, ".%d", task_tgid_vnr(current)); in format_corename()
513 struct core_name cn; in do_coredump() local
568 ispipe = format_corename(&cn, &cprm, &argv, &argc); in do_coredump()
622 helper_argv[argi] = cn.corename + argv[argi]; in do_coredump()
636 cn.corename); in do_coredump()
648 if (need_suid_safe && cn.corename[0] != '/') { in do_coredump()
666 do_unlinkat(AT_FDCWD, getname_kernel(cn.corename)); in do_coredump()
692 cprm.file = file_open_root(&root, cn.corename, in do_coredump()
696 cprm.file = filp_open(cn.corename, open_flags, 0600); in do_coredump()
722 cn.corename); in do_coredump()
727 cn.corename); in do_coredump()
748 pr_info("Core dump to |%s disabled\n", cn.corename); in do_coredump()
779 kfree(cn.corename); in do_coredump()