td_ta_event_addr.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Get event address.
  2. Copyright (C) 1999, 2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include "thread_dbP.h"
  17. td_err_e
  18. td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr)
  19. {
  20. td_err_e res = TD_NOEVENT;
  21. int idx = -1;
  22. LOG ("td_ta_event_addr");
  23. /* Test whether the TA parameter is ok. */
  24. if (! ta_ok (ta))
  25. return TD_BADTA;
  26. switch (event)
  27. {
  28. case TD_CREATE:
  29. idx = LINUXTHREADS_CREATE_EVENT;
  30. break;
  31. case TD_DEATH:
  32. idx = LINUXTHREADS_DEATH_EVENT;
  33. break;
  34. case TD_REAP:
  35. idx = LINUXTHREADS_REAP_EVENT;
  36. break;
  37. default:
  38. /* Event cannot be handled. */
  39. break;
  40. }
  41. /* Now get the address. */
  42. if (idx != -1)
  43. {
  44. psaddr_t taddr;
  45. if (td_lookup (ta->ph, idx, &taddr) == PS_OK)
  46. {
  47. /* Success, we got the address. */
  48. addr->type = NOTIFY_BPT;
  49. addr->u.bptaddr = taddr;
  50. res = TD_OK;
  51. }
  52. else
  53. res = TD_ERR;
  54. }
  55. return res;
  56. }