Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\coredump.c Create Date:2022-07-28 20:30:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:rmat_corename will inspect the pattern parameter, and output a* name into corename, which must have space for at least* CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.

Proto:static int format_corename(struct core_name *cn, struct coredump_params *cprm, size_t **argv, int *argc)

Type:int

Parameter:

TypeParameterName
struct core_name *cn
struct coredump_params *cprm
size_t **argv
int *argc
194  cred = current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.()
195  pat_ptr = core_pattern
196  ispipe = pat_ptr == '|'
197  bool was_space = false
198  pid_in_pattern = 0
199  err = 0
201  used = 0
202  corename = NULL
203  If The maximal length of core_pattern is also specified in sysctl.c Then Return -ENOMEM
205  corename[0] = '\0'
207  If ispipe Then
208  argvs = size of core_pattern / 2
209  argv = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
210  If Not argv Then Return -ENOMEM
212  ) = 0
213  ++pat_ptr
218  When pat_ptr cycle
223  If ispipe Then
225  was_space = true
226  pat_ptr++
227  Continue
228  Else if was_space Then
229  was_space = false
230  err = cn_printf(cn, "%c", '\0')
231  If err Then Return err
233  ) = used
236  If pat_ptr != '%' Then
237  err = cn_printf(cn, "%c", * pat_ptr++)
238  Else
241  Case * == 0
242  Go to out
244  Case * == '%'
245  err = cn_printf(cn, "%c", '%')
246  Break
248  Case * == 'p'
249  pid_in_pattern = 1
252  Break
254  Case * == 'P'
257  Break
258  Case * == 'i'
261  Break
262  Case * == 'I'
265  Break
267  Case * == 'u'
273  Case * == 'g'
278  Case * == 'd'
283  Case * == 's'
284  err = cn_printf(cn, "%d", si_signo)
286  Break
288  Case * == 't'
296  Case * == 'h'
298  err = cn_esc_printf(cn, "%s", nodename)
301  Break
303  Case * == 'e'
304  err = cn_esc_printf(cn, "%s", comm)
305  Break
306  Case * == 'E'
308  Break
310  Case * == 'c'
311  err = cn_printf(cn, "%lu", rlimit(RLIMIT_CORE))
313  Break
314  Default
315  Break
317  ++pat_ptr
320  If err Then Return err
324  out :
330  If Not ispipe && Not pid_in_pattern && core_uses_pid Then
331  err = cn_printf(cn, ".%d", task_tgid_vnr(current process))
332  If err Then Return err
335  Return ispipe
Caller
NameDescribe
do_coredump