int lttngh_UnregisterProvider()

in src/LttngHelpers.c [531:558]


int lttngh_UnregisterProvider(
    lttngh_registration* pRegistration
#if lttngh_UST_VER < 213
    ,
    lttngh_ust_probe_desc* pProbeDesc,
    struct lttng_ust_tracepoint* const* pTracepointStart
#endif // lttngh_UST_VER
    )
{
    int err = 0;
    int volatile* const pIsRegistered = lttngh_REGISTRATION_STATE(*pRegistration);

    // Calling Unregister on an unregistered lib is a safe no-op as long as it
    // doesn't race with a Register (which is a bug in the caller).
    if (__atomic_exchange_n(pIsRegistered, 0, __ATOMIC_RELAXED) != 0)
    {

#if lttngh_UST_VER >= 213
        err = lttngh_ust_tracepoint_module_unregister(pRegistration->tracepoint_start);
        lttng_ust_probe_unregister(pRegistration->registered_probe);
#else // lttngh_UST_VER
        err = lttngh_ust_tracepoint_module_unregister(pTracepointStart);
        lttng_probe_unregister(pProbeDesc);
#endif // lttngh_UST_VER
    }

    return err;
}