Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. consignl.c
  5. Abstract:
  6. This module contains the handler for signals received from PSXSES.
  7. Author:
  8. Avi Nathan (avin) 17-Jul-1991
  9. Revision History:
  10. Ellen Aycock-Wright (ellena) 15-Sept-1991 Modified for POSIX
  11. --*/
  12. #include "psxsrv.h"
  13. #define NTPSX_ONLY
  14. #include "sesport.h"
  15. #include <windows.h>
  16. #include <wincon.h>
  17. NTSTATUS
  18. PsxCtrlSignalHandler(
  19. IN OUT PVOID RequestMsg
  20. )
  21. {
  22. PPSX_PROCESS Process;
  23. PPSX_SESSION Session;
  24. PPSXSESREQUESTMSG Msg;
  25. PPSX_PROCESS p;
  26. int Signal;
  27. Msg = RequestMsg;
  28. switch (Msg->d.Signal.Type) {
  29. case PSX_SIGINT:
  30. Signal = SIGINT;
  31. break;
  32. case PSX_SIGQUIT:
  33. Signal = SIGQUIT;
  34. break;
  35. case PSX_SIGTSTP:
  36. Signal = SIGTSTP;
  37. break;
  38. case PSX_SIGKILL:
  39. Signal = SIGKILL;
  40. break;
  41. default:
  42. KdPrint(("PSXSS: Unknown signal type.\n"));
  43. Signal = 0;
  44. break;
  45. }
  46. Session = PsxLocateSessionByUniqueId(Msg->UniqueId);
  47. if (NULL == Session) {
  48. KdPrint(("PSXSS: ConSignl: could not locate session\n"));
  49. return STATUS_SUCCESS;
  50. }
  51. //
  52. // Send the signal to every process associated with the session.
  53. //
  54. AcquireProcessStructureLock();
  55. for (p = FirstProcess; p < LastProcess; p++) {
  56. if (p->Flags & P_FREE)
  57. continue;
  58. if (p->PsxSession == Session) {
  59. PsxSignalProcess(p, Signal);
  60. }
  61. }
  62. ReleaseProcessStructureLock();
  63. return STATUS_SUCCESS;
  64. }