These functions can be used to handle the mapping between pid and process name.
The library builds a cache of these mappings, which is used to display the name
of the process, instead of its pid. This information can be retrieved from
tracefs/saved_cmdlines file.
The tep_register_comm() function registers a pid / process name mapping.
If a command with the same pid is already registered, an error is returned.
The pid argument is the process ID, the comm argument is the process name,
tep is the event context. The comm is duplicated internally.
The tep_override_comm() function registers a pid / process name mapping.
If a process with the same pid is already registered, the process name string is
udapted with the new one. The pid argument is the process ID, the comm
argument is the process name, tep is the event context. The comm is
duplicated internally.
The tep_is_pid_registered() function checks if a pid has a process name
mapping registered. The pid argument is the process ID, tep is the event
context.
The tep_data_comm_from_pid() function returns the process name for a given
pid. The pid argument is the process ID, tep is the event context.
The returned string should not be freed, but will be freed when the tep
handler is closed.
The tep_data_pid_from_comm() function returns a pid for a given process name.
The comm argument is the process name, tep is the event context.
The argument next is the cmdline structure to search for the next pid.
As there may be more than one pid for a given process, the result of this call
can be passed back into a recurring call in the next parameter, to search for
the next pid. If next is NULL, it will return the first pid associated with
the comm. The function performs a linear search, so it may be slow.
The tep_cmdline_pid() function returns the pid associated with a given
cmdline. The tep argument is the event context.