DESCRIPTION

The interfaces tnfctl_indirect_open() and tnfctl_check_libs() are used to control probes in another process where the libtnfctl(3TNF) client has already opened proc(4) on the target process. An example of this is when the client is a debugger. Since these clients already use /proc on the target, libtnfctl(3TNF) cannot use /proc directly. Therefore, these clients must
provide callback functions that can be used to inspect and to update the target process. The target process must load libtnfprobe.so.1 (defined in <tnf/tnfctl.h>
as macro TNFCTL_LIBTNFPROBE).

The first argument prochandle is a pointer to an opaque structure that is used in the callback functions that inspect and update the target process. This structure should
encapsulate the state that the caller needs to use /proc on the target process (the /proc file descriptor). The second argument, config,
is a pointer to

The first field p_read is the address of a function that can read size bytes at address addr in the target image into the
buffer buf. The function should return 0 upon success.. The second field p_write is the address of a function that can write size bytes at address addr in the target image from the buffer buf. The function should return 0 upon success. The third
field p_getpid is the address of a function that should return the process id of the target process (prochandle). The fourth field p_obj_iter is the address of a function that iterates over all load objects and the executable by calling the callback function func with client_data.
If func returns 0, p_obj_iter should continue processing link objects. If func returns any other value, p_obj_iter should stop calling the callback function and return that value. p_obj_iter should return 0 if it iterates over all load objects.

If a failure is returned by any of the functions in config, the error is propagated back as PREX_ERR_INTERNAL by the libtnfctl interface that called it.

objfd should be the file descriptor of the load object or executable. If it is -1, then objname should be an absolute pathname to the load object or executable. If objfd is not closed by libtnfctl, it should be closed by the load object
iterator function. text_base and data_base are the addresses where the text and data segments of the load object are mapped in the target process.

Whenever the target process opens or closes a dynamic object, the set of available probes may change. See dlopen(3C) and dlclose(3C). In indirect mode, call tnfctl_check_libs() when such events occur to make libtnfctl aware of any changes. In other modes this is unnecessary but harmless. It is also harmless to call tnfctl_check_libs() when no such events have occurred.

SEE ALSO

NOTES

tnfctl_indirect_open() should only be called after the dynamic linker has mapped in all the libraries (rtld sync point) and called only after the process is stopped. Indirect process
probe control assumes the target process is stopped whenever any libtnfctl interface is used on it. For example, when used for indirect process probe control, tnfctl_probe_enable(3TNF) and tnfctl_probe_trace(3TNF) should be called only for a process that is stopped.