posix-w32.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef SCM_POSIX_W32_H
  2. #define SCM_POSIX_W32_H
  3. /* Copyright 2001,2006,2018,2020
  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. #ifdef _WIN32
  18. #ifndef WIN32_LEAN_AND_MEAN
  19. #define WIN32_LEAN_AND_MEAN
  20. #endif
  21. #include <windows.h>
  22. #endif
  23. #include <string.h>
  24. #include "libguile/scm.h"
  25. #define _UTSNAME_LENGTH 65
  26. #define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
  27. #define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH
  28. /* Structure describing the system and machine. */
  29. struct utsname
  30. {
  31. /* Name of the implementation of the operating system. */
  32. char sysname[_UTSNAME_LENGTH];
  33. /* Name of this node on the network. */
  34. char nodename[_UTSNAME_NODENAME_LENGTH];
  35. /* Current release level of this implementation. */
  36. char release[_UTSNAME_LENGTH];
  37. /* Current version level of this release. */
  38. char version[_UTSNAME_LENGTH];
  39. /* Name of the hardware type the system is running on. */
  40. char machine[_UTSNAME_LENGTH];
  41. /* Name of the domain of this node on the network. */
  42. char domainname[_UTSNAME_DOMAIN_LENGTH];
  43. };
  44. #define WNOHANG 1
  45. #define WEXITSTATUS(stat_val) ((stat_val) & 255)
  46. /* MS-Windows programs that crash due to a fatal exception exit with
  47. an exit code whose 2 MSB bits are set. */
  48. #define WIFEXITED(stat_val) (((stat_val) & 0xC0000000) == 0)
  49. #define WIFSIGNALED(stat_val) (((stat_val) & 0xC0000000) == 0xC0000000)
  50. #define WTERMSIG(stat_val) w32_status_to_termsig (stat_val)
  51. /* The funny conditional avoids a compiler warning in status:stop_sig. */
  52. #define WIFSTOPPED(stat_val) ((stat_val) == (stat_val) ? 0 : 0)
  53. #define WSTOPSIG(stat_var) (0)
  54. #define CPU_ZERO(s) memset(s,0,sizeof(*s))
  55. #define CPU_ISSET(b,s) ((*s) & (1U << (b))) != 0
  56. #define CPU_SET(b,s) (*s) |= (1U << (b))
  57. #define CPU_SETSIZE (8*sizeof(DWORD_PTR))
  58. typedef DWORD_PTR cpu_set_t;
  59. #define PRIO_PROCESS 1
  60. #define PRIO_PGRP 2
  61. #define PRIO_USER 3
  62. SCM_INTERNAL int uname (struct utsname * uts);
  63. SCM_INTERNAL int waitpid (intptr_t, int *, int);
  64. SCM_INTERNAL int w32_status_to_termsig (DWORD status);
  65. SCM_INTERNAL pid_t start_child (const char *exec_file, char **argv,
  66. int reading, int c2p[2], int writing, int p2c[2],
  67. int infd, int outfd, int errfd);
  68. SCM_INTERNAL int kill (int pid, int sig);
  69. SCM_INTERNAL int getpriority (int which, int who);
  70. SCM_INTERNAL int setpriority (int which, int who, int nice_val);
  71. SCM_INTERNAL int sched_getaffinity (int pid, size_t mask_size, cpu_set_t *mask);
  72. SCM_INTERNAL int sched_setaffinity (int pid, size_t mask_size, cpu_set_t *mask);
  73. SCM_INTERNAL void *dlopen_w32 (const char *name, int flags);
  74. SCM_INTERNAL void *dlsym_w32 (void *handle, const char *name);
  75. SCM_INTERNAL int dlclose_w32 (void *handle);
  76. SCM_INTERNAL char *dlerror_w32 (void);
  77. #define HAVE_UNAME 1
  78. #define HAVE_WAITPID 1
  79. #define HAVE_START_CHILD 1
  80. #define HAVE_KILL 1
  81. #define HAVE_GETPRIORITY 1
  82. #define HAVE_SETPRIORITY 1
  83. #define HAVE_SCHED_GETAFFINITY 1
  84. #define HAVE_SCHED_SETAFFINITY 1
  85. #define RTLD_NOW 1
  86. #define RTLD_LAZY 2
  87. #define RTLD_GLOBAL 4
  88. #define RTLD_LOCAL 8
  89. #endif /* SCM_POSIX_W32_H */