react-native/packages
Simon Krueger 4dd8d3db57 Use folly::fileops qualified name lookup (#47608)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47608

This is a codemod. It was automatically generated and will be landed once it is approved and tests are passing in sandcastle.
You have been added as a reviewer by Sentinel or Butterfly.

Autodiff project: fileops2
Autodiff partition: xplat.js.react-native-github.packages.react-native.ReactCommon.cxxreact
Autodiff bookmark: ad.fileops2.xplat.js.react-native-github.packages.react-native.ReactCommon.cxxreact

This updates `open`, `close`, `read`, `write`, and `pipe` call sites to use
`folly::fileops` qualified name lookup.

This is the 2nd phase in a 3-phase change to remove folly's global definitions
of the posix functions that conflict with windows CRT.
The 1st phase created namespaces for folly's posix functions. The 2nd phase
updates callsites to use the qualified name of folly's  `open`, `close`,
`read`, `write`, and `pipe`  functions. The 3rd and final phase will remove
folly's globally defined posix functions and have windows CRT define them
again.

**What is the reason for this change?**
Folly's global definitions of posix functions on Windows causes `#include`
order issues if folly is not included first.

For example, when `gtest/gtest.h` is included before folly, gtest includes
`windows.h` and that declares `open`, `read`, and `chdir`, which creates
ambiguous references to folly's `open`, `read`, and `chdir`.

Another example is where posix functions go undeclared when
`folly/portability/windows.h` is included without other portability headers
(e.g., `folly/portability/unistd.h`). `folly/portability/windows.h` includes
`windows.h` in a way that only underscore versions of the posix functions are
available (e.g., `_open`, `_close`).

These issues create friction for windows development.

**Background: What is the purpose of `folly::portability::{fcntl,stdlib,sysstat,unistd}`?**
It is a portability layer to make posix functions available and behave
consistently across platforms. Some posix functions don't exist on windows
(e.g., `sysconf`). Some other posix functions, folly changes to adapt behavior
across platforms. For example, on windows folly defines `open`, `read`,
`write`, and `close` functions to work with sockets. Folly makes these
functions available in the global scope for convenience.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D65855147

fbshipit-source-id: b06863330ca213b9d1bffe0ee85e0fbf1bc8a845
2024-11-20 06:27:34 -08:00
..
assets replace '$TEMPORARY$string<>' with 'string' (#46876) 2024-10-07 19:18:14 -07:00
babel-plugin-codegen RN: Fix lint/sort-imports Errors (#47109) 2024-10-18 04:07:02 -07:00
community-cli-plugin fix/cli start (#47450) 2024-11-06 07:26:30 -08:00
core-cli-utils Bump main to 0.77 2024-09-12 09:23:23 -07:00
debugger-frontend Update debugger-frontend from ff343d8...b61aae3 (#47593) 2024-11-13 11:27:38 -08:00
dev-middleware Remove URL.canParse, fix older Node compatibility 2024-11-19 01:50:49 -08:00
eslint-config-react-native Revert to @babel/eslint-parser in eslint-config (#47333) 2024-11-01 05:31:37 -07:00
eslint-plugin-react-native Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
eslint-plugin-specs Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
gradle-plugin RNGP - Do not attempt to substring to 1024 while logging. (#47509) 2024-11-08 04:57:15 -08:00
helloworld Pass the RCTAppDependencyProvider to the RCTAppDelegate (#47651) 2024-11-18 08:06:13 -08:00
hermes-inspector-msggen Bump main to 0.77 2024-09-12 09:23:23 -07:00
metro-config metro-config: Revert setting hermesParser: true in default Metro config (#47670) 2024-11-19 02:43:03 -08:00
normalize-color Bump main to 0.77 2024-09-12 09:23:23 -07:00
polyfills Implement always available js error handling (#47466) 2024-11-07 11:22:57 -08:00
react-native Use folly::fileops qualified name lookup (#47608) 2024-11-20 06:27:34 -08:00
react-native-babel-preset Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
react-native-babel-transformer Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
react-native-bots fix: mitigate DangerJS transpilation bug (#47192) 2024-10-24 20:07:20 -07:00
react-native-codegen feat: handle negative values in enums (#47452) 2024-11-13 12:20:16 -08:00
react-native-codegen-typescript-test Bump main to 0.77 2024-09-12 09:23:23 -07:00
react-native-info Bump main to 0.77 2024-09-12 09:23:23 -07:00
react-native-popup-menu-android Convert com.facebook.react.ViewManagerOnDemandReactPackage to Kotlin (#47682) 2024-11-20 04:05:26 -08:00
react-native-test-library Let lib maintainer be explicit with componentProvider mapping (#47520) 2024-11-12 07:38:03 -08:00
react-native-test-renderer Refactor Performance and PerformanceObserver internals (#46693) 2024-10-02 03:13:24 -07:00
rn-tester Disable flaky flatList test (#47718) 2024-11-19 09:23:20 -08:00
typescript-config Bump main to 0.77 2024-09-12 09:23:23 -07:00
virtualized-lists RN: Feature Flag to Disable InteractionManager in Batchinator (#47690) 2024-11-18 23:12:15 -08:00