pw_stream: Fix SocketStream compilation on macOS

SocketStream was using the MSG_NOSIGNAL flag with send to avoid getting
a SIGPIPE when the remote peer drops the connection. This works on Linux
only.

On macOS, you have to set a sockopt on the socket. This commit guards
the Linux-only code to only compile on Linux, and adds the equivalent
macOS code (guarded to only compile on macOS).

Change-Id: I731ebf7deea0ae2fcc043858b498badc1d399516
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/132010
Commit-Queue: Eli Lipsitz <elipsitz@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2 files changed
tree: 69d7a9c4027ffbfd69e5bc884cf41afe810bf735
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. pw_allocator/
  7. pw_analog/
  8. pw_android_toolchain/
  9. pw_arduino_build/
  10. pw_assert/
  11. pw_assert_basic/
  12. pw_assert_log/
  13. pw_assert_tokenized/
  14. pw_assert_zephyr/
  15. pw_async/
  16. pw_async_basic/
  17. pw_base64/
  18. pw_bloat/
  19. pw_blob_store/
  20. pw_bluetooth/
  21. pw_bluetooth_hci/
  22. pw_bluetooth_profiles/
  23. pw_boot/
  24. pw_boot_cortex_m/
  25. pw_build/
  26. pw_build_info/
  27. pw_build_mcuxpresso/
  28. pw_bytes/
  29. pw_checksum/
  30. pw_chrono/
  31. pw_chrono_embos/
  32. pw_chrono_freertos/
  33. pw_chrono_stl/
  34. pw_chrono_threadx/
  35. pw_chrono_zephyr/
  36. pw_cli/
  37. pw_compilation_testing/
  38. pw_console/
  39. pw_containers/
  40. pw_cpu_exception/
  41. pw_cpu_exception_cortex_m/
  42. pw_crypto/
  43. pw_digital_io/
  44. pw_docgen/
  45. pw_doctor/
  46. pw_env_setup/
  47. pw_file/
  48. pw_function/
  49. pw_fuzzer/
  50. pw_hdlc/
  51. pw_hex_dump/
  52. pw_i2c/
  53. pw_i2c_mcuxpresso/
  54. pw_ide/
  55. pw_interrupt/
  56. pw_interrupt_cortex_m/
  57. pw_interrupt_zephyr/
  58. pw_intrusive_ptr/
  59. pw_kvs/
  60. pw_libc/
  61. pw_log/
  62. pw_log_android/
  63. pw_log_basic/
  64. pw_log_null/
  65. pw_log_rpc/
  66. pw_log_string/
  67. pw_log_tokenized/
  68. pw_log_zephyr/
  69. pw_malloc/
  70. pw_malloc_freelist/
  71. pw_metric/
  72. pw_minimal_cpp_stdlib/
  73. pw_module/
  74. pw_multisink/
  75. pw_package/
  76. pw_perf_test/
  77. pw_persistent_ram/
  78. pw_polyfill/
  79. pw_preprocessor/
  80. pw_presubmit/
  81. pw_protobuf/
  82. pw_protobuf_compiler/
  83. pw_random/
  84. pw_result/
  85. pw_ring_buffer/
  86. pw_router/
  87. pw_rpc/
  88. pw_rust/
  89. pw_snapshot/
  90. pw_software_update/
  91. pw_span/
  92. pw_spi/
  93. pw_status/
  94. pw_stm32cube_build/
  95. pw_stream/
  96. pw_string/
  97. pw_symbolizer/
  98. pw_sync/
  99. pw_sync_baremetal/
  100. pw_sync_embos/
  101. pw_sync_freertos/
  102. pw_sync_stl/
  103. pw_sync_threadx/
  104. pw_sync_zephyr/
  105. pw_sys_io/
  106. pw_sys_io_arduino/
  107. pw_sys_io_baremetal_lm3s6965evb/
  108. pw_sys_io_baremetal_stm32f429/
  109. pw_sys_io_emcraft_sf2/
  110. pw_sys_io_mcuxpresso/
  111. pw_sys_io_pico/
  112. pw_sys_io_stdio/
  113. pw_sys_io_stm32cube/
  114. pw_sys_io_zephyr/
  115. pw_system/
  116. pw_target_runner/
  117. pw_thread/
  118. pw_thread_embos/
  119. pw_thread_freertos/
  120. pw_thread_stl/
  121. pw_thread_threadx/
  122. pw_thread_zephyr/
  123. pw_tls_client/
  124. pw_tls_client_boringssl/
  125. pw_tls_client_mbedtls/
  126. pw_tokenizer/
  127. pw_tool/
  128. pw_toolchain/
  129. pw_trace/
  130. pw_trace_tokenized/
  131. pw_transfer/
  132. pw_unit_test/
  133. pw_varint/
  134. pw_watch/
  135. pw_web/
  136. pw_work_queue/
  137. seed/
  138. targets/
  139. third_party/
  140. ts/
  141. zephyr/
  142. .bazelignore
  143. .bazelrc
  144. .black.toml
  145. .clang-format
  146. .clang-tidy
  147. .eslintrc.json
  148. .git-blame-ignore-revs
  149. .gitattributes
  150. .gitignore
  151. .gn
  152. .mypy.ini
  153. .prettierrc.js
  154. .pw_ide.yaml
  155. .pylintrc
  156. activate.bat
  157. Android.bp
  158. AUTHORS
  159. bootstrap.bat
  160. bootstrap.sh
  161. BUILD.bazel
  162. BUILD.gn
  163. BUILDCONFIG.gn
  164. CMakeLists.txt
  165. jest.config.ts
  166. Kconfig.zephyr
  167. LICENSE
  168. modules.gni
  169. OWNERS
  170. package-lock.json
  171. package.json
  172. pigweed.json
  173. PIGWEED_MODULES
  174. PW_PLUGINS
  175. README.md
  176. rollup.config.js
  177. tsconfig.json
  178. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links