posix-w32.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef SCM_POSIX_W32_H
  2. #define SCM_POSIX_W32_H
  3. /* Copyright 2001,2006,2018
  4. Free Software Foundation, Inc.
  5. This file is part of Guile.
  6. Guile is free software: you can redistribute it and/or modify it
  7. under the terms of the GNU Lesser General Public License as published
  8. by the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Guile is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  13. License for more details.
  14. You should have received a copy of the GNU Lesser General Public
  15. License along with Guile. If not, see
  16. <https://www.gnu.org/licenses/>. */
  17. #include <string.h>
  18. #define _UTSNAME_LENGTH 65
  19. #define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
  20. #define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH
  21. /* Structure describing the system and machine. */
  22. struct utsname
  23. {
  24. /* Name of the implementation of the operating system. */
  25. char sysname[_UTSNAME_LENGTH];
  26. /* Name of this node on the network. */
  27. char nodename[_UTSNAME_NODENAME_LENGTH];
  28. /* Current release level of this implementation. */
  29. char release[_UTSNAME_LENGTH];
  30. /* Current version level of this release. */
  31. char version[_UTSNAME_LENGTH];
  32. /* Name of the hardware type the system is running on. */
  33. char machine[_UTSNAME_LENGTH];
  34. /* Name of the domain of this node on the network. */
  35. char domainname[_UTSNAME_DOMAIN_LENGTH];
  36. };
  37. #define WNOHANG 1
  38. #define WEXITSTATUS(stat_val) ((stat_val) & 255)
  39. /* MS-Windows programs that crash due to a fatal exception exit with
  40. an exit code whose 2 MSB bits are set. */
  41. #define WIFEXITED(stat_val) (((stat_val) & 0xC0000000) == 0)
  42. #define WIFSIGNALED(stat_val) (((stat_val) & 0xC0000000) == 0xC0000000)
  43. #define WTERMSIG(stat_val) w32_status_to_termsig (stat_val)
  44. /* The funny conditional avoids a compiler warning in status:stop_sig. */
  45. #define WIFSTOPPED(stat_val) ((stat_val) == (stat_val) ? 0 : 0)
  46. #define WSTOPSIG(stat_var) (0)
  47. #define CPU_ZERO(s) memset(s,0,sizeof(*s))
  48. #define CPU_ISSET(b,s) ((*s) & (1U << (b))) != 0
  49. #define CPU_SET(b,s) (*s) |= (1U << (b))
  50. #define CPU_SETSIZE (8*sizeof(DWORD_PTR))
  51. typedef DWORD_PTR cpu_set_t;
  52. #define PRIO_PROCESS 1
  53. #define PRIO_PGRP 2
  54. #define PRIO_USER 3
  55. SCM_INTERNAL int uname (struct utsname * uts);
  56. SCM_INTERNAL int waitpid (intptr_t, int *, int);
  57. SCM_INTERNAL int w32_status_to_termsig (DWORD status);
  58. SCM_INTERNAL int start_child (const char *exec_file, char **argv,
  59. int reading, int c2p[2], int writing, int p2c[2],
  60. int infd, int outfd, int errfd);
  61. SCM_INTERNAL int kill (int pid, int sig);
  62. SCM_INTERNAL int getpriority (int which, int who);
  63. SCM_INTERNAL int setpriority (int which, int who, int nice_val);
  64. SCM_INTERNAL int sched_getaffinity (int pid, size_t mask_size, cpu_set_t *mask);
  65. SCM_INTERNAL int sched_setaffinity (int pid, size_t mask_size, cpu_set_t *mask);
  66. #define HAVE_UNAME 1
  67. #define HAVE_WAITPID 1
  68. #define HAVE_START_CHILD 1
  69. #define HAVE_KILL 1
  70. #define HAVE_GETPRIORITY 1
  71. #define HAVE_SETPRIORITY 1
  72. #define HAVE_SCHED_GETAFFINITY 1
  73. #define HAVE_SCHED_SETAFFINITY 1
  74. #endif /* SCM_POSIX_W32_H */