12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #include <stddef.h>
- #include <stdlib.h>
- #include <string.h>
- #include <version.h>
- #include "thread_dbP.h"
- LIST_HEAD (__td_agent_list);
- td_err_e
- td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
- {
- psaddr_t versaddr;
- char versbuf[sizeof (VERSION)];
- LOG ("td_ta_new");
-
- if (td_lookup (ps, SYM_nptl_version, &versaddr) != PS_OK)
- return TD_NOLIBTHREAD;
- if (ps_pdread (ps, versaddr, versbuf, sizeof (versbuf)) != PS_OK)
- return TD_ERR;
- if (memcmp (versbuf, VERSION, sizeof VERSION) != 0)
-
- return TD_VERSION;
-
- *ta = (td_thragent_t *) calloc (1, sizeof (td_thragent_t));
- if (*ta == NULL)
- return TD_MALLOC;
-
- (*ta)->ph = ps;
-
- list_add (&(*ta)->list, &__td_agent_list);
- return TD_OK;
- }
|