s/master/main/

Test: treehugger
Change-Id: I2c975b2f5f92f23c7357b6f7e785578504298cc6
diff --git a/README.md b/README.md
index aafbcff..9a44934 100644
--- a/README.md
+++ b/README.md
@@ -288,14 +288,14 @@
 
 Note that if you're actually just trying to expose device-specific headers to
 build your device drivers, you shouldn't modify bionic. Instead use
-`TARGET_DEVICE_KERNEL_HEADERS` and friends described in [config.mk](https://android.googlesource.com/platform/build/+/master/core/config.mk#186).
+`TARGET_DEVICE_KERNEL_HEADERS` and friends described in [config.mk](https://android.googlesource.com/platform/build/+/main/core/config.mk#186).
 
 
 ## Updating tzdata
 
 This is handled by the libcore team, because they own icu, and that needs to be
 updated in sync with bionic). See
-[system/timezone/README.android](https://android.googlesource.com/platform/system/timezone/+/master/README.android).
+[system/timezone/README.android](https://android.googlesource.com/platform/system/timezone/+/main/README.android).
 
 
 ## Verifying changes
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md
index ab3b247..ef5d34d 100644
--- a/android-changes-for-ndk-developers.md
+++ b/android-changes-for-ndk-developers.md
@@ -7,7 +7,7 @@
 behavior changes.
 
 See also the
-[unwinder documentation](https://android.googlesource.com/platform/system/unwinding/+/refs/heads/master/libunwindstack/AndroidVersions.md)
+[unwinder documentation](https://android.googlesource.com/platform/system/unwinding/+/refs/heads/main/libunwindstack/AndroidVersions.md)
 for details about changes in stack unwinding (crash dumps) between
 different releases.
 
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 1fd17a1..3819b1a 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -185,4 +185,4 @@
 benchmarks appear to be using the script. For more information:
  * run `get_build_var BOARD_PERFSETUP_SCRIPT`
  * run `m perf-setup` to install the script into `${OUT}/data/local/tmp/perf-setup.sh`
- * see: https://android.googlesource.com/platform/platform_testing/+/refs/heads/master/scripts/perf-setup/
+ * see: https://android.googlesource.com/platform/platform_testing/+/refs/heads/main/scripts/perf-setup/
diff --git a/docs/fdsan.md b/docs/fdsan.md
index 6630299..f5d1ab5 100644
--- a/docs/fdsan.md
+++ b/docs/fdsan.md
@@ -46,7 +46,7 @@
 
 fdsan attempts to detect and/or prevent file descriptor mismanagement by enforcing file descriptor ownership. Like how most memory allocations can have their ownership handled by types such as `std::unique_ptr`, almost all file descriptors can be associated with a unique owner which is responsible for their closure. fdsan provides functions to associate a file descriptor with an owner; if someone tries to close a file descriptor that they don't own, depending on configuration, either a warning is emitted, or the process aborts.
 
-The way this is implemented is by providing functions to set a 64-bit closure tag on a file descriptor. The tag consists of an 8-bit type byte that identifies the type of the owner (`enum android_fdan_owner_type` in [`<android/fdsan.h>`](https://android.googlesource.com/platform/bionic/+/master/libc/include/android/fdsan.h)), and a 56-bit value. The value should ideally be something that uniquely identifies the object (object address for native objects and `System.identityHashCode` for Java objects), but in cases where it's hard to derive an identifier for the "owner" that should close a file descriptor, even using the same value for all file descriptors in the module can be useful, since it'll catch other code that closes your file descriptors.
+The way this is implemented is by providing functions to set a 64-bit closure tag on a file descriptor. The tag consists of an 8-bit type byte that identifies the type of the owner (`enum android_fdan_owner_type` in [`<android/fdsan.h>`](https://android.googlesource.com/platform/bionic/+/main/libc/include/android/fdsan.h)), and a 56-bit value. The value should ideally be something that uniquely identifies the object (object address for native objects and `System.identityHashCode` for Java objects), but in cases where it's hard to derive an identifier for the "owner" that should close a file descriptor, even using the same value for all file descriptors in the module can be useful, since it'll catch other code that closes your file descriptors.
 
 If a file descriptor that's been marked with a tag is closed with an incorrect tag, or without a tag, we know something has gone wrong, and can generate diagnostics or abort.
 
@@ -62,7 +62,7 @@
  - fatal (`ANDROID_FDSAN_ERROR_LEVEL_FATAL`)
    - Abort upon detecting an error.
 
-In Android Q, fdsan has a global default of warn-once. fdsan can be made more or less strict at runtime via the `android_fdsan_set_error_level` function in [`<android/fdsan.h>`](https://android.googlesource.com/platform/bionic/+/master/libc/include/android/fdsan.h).
+In Android Q, fdsan has a global default of warn-once. fdsan can be made more or less strict at runtime via the `android_fdsan_set_error_level` function in [`<android/fdsan.h>`](https://android.googlesource.com/platform/bionic/+/main/libc/include/android/fdsan.h).
 
 The likelihood of fdsan catching a file descriptor error is proportional to the percentage of file descriptors in your process that are tagged with an owner.
 
diff --git a/docs/fdtrack.md b/docs/fdtrack.md
index 7cf6e1f..07c69b3 100644
--- a/docs/fdtrack.md
+++ b/docs/fdtrack.md
@@ -9,7 +9,7 @@
 hook to perform and store backtraces for file descriptor creation.
 
 ### bionic hooks
-bionic provides a header in the `bionic_libc_platform_headers` header_lib at <[bionic/fdtrack.h](https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/platform/bionic/fdtrack.h)>.
+bionic provides a header in the `bionic_libc_platform_headers` header_lib at <[bionic/fdtrack.h](https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/platform/bionic/fdtrack.h)>.
 Register a callback with `android_fdtrack_compare_exchange_hook` to receive
 callbacks upon file descriptor creation and destruction. This function can be
 called at any point in order to start capturing events, but be sure to properly
@@ -18,7 +18,7 @@
 not to call callbacks when this is the case).
 
 ### libfdtrack
-[libfdtrack](https://android.googlesource.com/platform/bionic/+/refs/heads/master/libfdtrack)
+[libfdtrack](https://android.googlesource.com/platform/bionic/+/refs/heads/main/libfdtrack)
 implements a library that uses libunwindstack to unwind and store fd creation backtraces.
 
 
diff --git a/docs/native_allocator.md b/docs/native_allocator.md
index 9fc9a31..13d9738 100644
--- a/docs/native_allocator.md
+++ b/docs/native_allocator.md
@@ -323,8 +323,8 @@
 time. The trace data does not include timestamps,
 so it is not possible to create a completely accurate replay.
 
-To generate these traces, see the [Malloc Debug documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md),
-the option [record\_allocs](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md#record_allocs_total_entries).
+To generate these traces, see the [Malloc Debug documentation](https://android.googlesource.com/platform/bionic/+/main/libc/malloc_debug/README.md),
+the option [record\_allocs](https://android.googlesource.com/platform/bionic/+/main/libc/malloc_debug/README.md#record_allocs_total_entries).
 
 To run these benchmarks, first copy the trace files to the target using
 these commands:
diff --git a/docs/status.md b/docs/status.md
index 3b4933b..a9afe55 100644
--- a/docs/status.md
+++ b/docs/status.md
@@ -11,7 +11,7 @@
 ### POSIX
 
 You can see the current status with respect to POSIX in the form of tests:
-https://android.googlesource.com/platform/bionic/+/master/tests/headers/posix/
+https://android.googlesource.com/platform/bionic/+/main/tests/headers/posix/
 
 Some POSIX functionality is not supported by the Linux kernel, and
 is guarded with tests for `__linux__`. Other functionality is not
@@ -53,7 +53,7 @@
 
 ### libc
 
-Current libc symbols: https://android.googlesource.com/platform/bionic/+/master/libc/libc.map.txt
+Current libc symbols: https://android.googlesource.com/platform/bionic/+/main/libc/libc.map.txt
 
 New libc functions in V (API level 35):
   * `tcgetwinsize`, `tcsetwinsize` (POSIX Issue 8 additions).
@@ -299,7 +299,7 @@
 
 ### libm
 
-Current libm symbols: https://android.googlesource.com/platform/bionic/+/master/libm/libm.map.txt
+Current libm symbols: https://android.googlesource.com/platform/bionic/+/main/libm/libm.map.txt
 
 0 remaining missing C11/POSIX libm functions.
 
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index 6602e5d..77ec653 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -40,7 +40,7 @@
  * @brief Functions and constants for dealing with multiple API levels.
  *
  * See
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ * https://android.googlesource.com/platform/bionic/+/main/docs/defines.md.
  */
 
 #include <sys/cdefs.h>
@@ -50,7 +50,7 @@
 /**
  * Magic version number for an Android OS build which has not yet turned
  * into an official release, for comparison against `__ANDROID_API__`. See
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ * https://android.googlesource.com/platform/bionic/+/main/docs/defines.md.
  */
 #define __ANDROID_API_FUTURE__ 10000
 
@@ -91,7 +91,7 @@
  *
  * See android_get_device_api_level(),
  * android_get_application_target_sdk_version() and
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ * https://android.googlesource.com/platform/bionic/+/main/docs/defines.md.
  */
 #define __ANDROID_API__ __ANDROID_API_FUTURE__
 #endif
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index 6f992d9..d22b85c 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -361,7 +361,7 @@
  *
  * Available since API level 28.
  *
- * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
+ * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/main/libc/malloc_hooks/README.md)
  */
 extern void* _Nonnull (*volatile _Nonnull __malloc_hook)(size_t __byte_count, const void* _Nonnull __caller) __INTRODUCED_IN(28);
 
@@ -372,7 +372,7 @@
  *
  * Available since API level 28.
  *
- * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
+ * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/main/libc/malloc_hooks/README.md)
  */
 extern void* _Nonnull (*volatile _Nonnull __realloc_hook)(void* _Nullable __ptr, size_t __byte_count, const void* _Nonnull __caller) __INTRODUCED_IN(28);
 
@@ -383,7 +383,7 @@
  *
  * Available since API level 28.
  *
- * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
+ * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/main/libc/malloc_hooks/README.md)
  */
 extern void (*volatile _Nonnull __free_hook)(void* _Nullable __ptr, const void* _Nonnull __caller) __INTRODUCED_IN(28);
 
@@ -394,7 +394,7 @@
  *
  * Available since API level 28.
  *
- * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/master/libc/malloc_hooks/README.md)
+ * See also: [extra documentation](https://android.googlesource.com/platform/bionic/+/main/libc/malloc_hooks/README.md)
  */
 extern void* _Nonnull (*volatile _Nonnull __memalign_hook)(size_t __alignment, size_t __byte_count, const void* _Nonnull __caller) __INTRODUCED_IN(28);
 
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 2fc5b21..312b356 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -203,7 +203,7 @@
 int fseek(FILE* _Nonnull __fp, long __offset, int __whence);
 long ftell(FILE* _Nonnull __fp);
 
-/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
+/* See https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md */
 #if defined(__USE_FILE_OFFSET64)
 int fgetpos(FILE* _Nonnull __fp, fpos_t* _Nonnull __pos) __RENAME(fgetpos64) __INTRODUCED_IN(24);
 int fsetpos(FILE* _Nonnull __fp, const fpos_t* _Nonnull __pos) __RENAME(fsetpos64) __INTRODUCED_IN(24);
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 4154e62..a8fb624 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -38,7 +38,7 @@
 
 /**
  * `__BIONIC__` is always defined if you're building with bionic. See
- * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
+ * https://android.googlesource.com/platform/bionic/+/main/docs/defines.md.
  */
 #define __BIONIC__ 1
 
@@ -187,7 +187,7 @@
 
 /*
  * _FILE_OFFSET_BITS 64 support.
- * See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
+ * See https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
  */
 #if !defined(__LP64__) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
 #  define __USE_FILE_OFFSET64 1
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index f32ae61..823c9ba 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -58,7 +58,7 @@
 /**
  * mmap64() is a variant of mmap() that takes a 64-bit offset even on LP32.
  *
- * See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
+ * See https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
  */
 void* _Nonnull mmap64(void* _Nullable __addr, size_t __size, int __prot, int __flags, int __fd, off64_t __offset);
 
diff --git a/libc/include/sys/sendfile.h b/libc/include/sys/sendfile.h
index a72091d..26522a6 100644
--- a/libc/include/sys/sendfile.h
+++ b/libc/include/sys/sendfile.h
@@ -38,7 +38,7 @@
 
 __BEGIN_DECLS
 
-/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
+/* See https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md */
 #if defined(__USE_FILE_OFFSET64)
 ssize_t sendfile(int __out_fd, int __in_fd, off_t* _Nullable __offset, size_t __count) __RENAME(sendfile64);
 #else
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index f07c8fd..4622a4e 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -96,7 +96,7 @@
 typedef __time_t time_t;
 
 /* This historical accident means that we had a 32-bit off_t on 32-bit architectures. */
-/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
+/* See https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md */
 #if defined(__USE_FILE_OFFSET64) || defined(__LP64__)
 typedef int64_t off_t;
 typedef off_t loff_t;
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index dcad630..c8cceb2 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -265,7 +265,7 @@
 int fsync(int __fd);
 int fdatasync(int __fd);
 
-/* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
+/* See https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md */
 #if defined(__USE_FILE_OFFSET64)
 int truncate(const char* _Nonnull __path, off_t __length) __RENAME(truncate64);
 off_t lseek(int __fd, off_t __offset, int __whence) __RENAME(lseek64);
diff --git a/libc/malloc_debug/Config.cpp b/libc/malloc_debug/Config.cpp
index be577bc..77d2f02 100644
--- a/libc/malloc_debug/Config.cpp
+++ b/libc/malloc_debug/Config.cpp
@@ -409,7 +409,8 @@
 
 void Config::LogUsage() const {
   error_log("For malloc debug option descriptions go to:");
-  error_log("  https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md");
+  error_log(
+      "  https://android.googlesource.com/platform/bionic/+/main/libc/malloc_debug/README.md");
 }
 
 bool Config::GetOption(const char** options_str, std::string* option, std::string* value) {
diff --git a/libc/malloc_debug/README.md b/libc/malloc_debug/README.md
index fddc4a3..37fafa7 100644
--- a/libc/malloc_debug/README.md
+++ b/libc/malloc_debug/README.md
@@ -170,7 +170,7 @@
 overrides this option, and should not be used at the same time.
 
 This option can also be used in combination with other tools such
-as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/master/README.md)
+as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/main/README.md)
 to only get backtraces for sizes of allocations listed as being leaked.
 
 ### backtrace\_max\_size=ALLOCATION\_SIZE\_BYTES
@@ -183,7 +183,7 @@
 overrides this option, and should not be used at the same time.
 
 This option can also be used in combination with other tools such
-as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/master/README.md)
+as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/main/README.md)
 to only get backtraces for sizes of allocations listed as being leaked.
 
 ### backtrace\_size=ALLOCATION\_SIZE\_BYTES
@@ -192,7 +192,7 @@
 This option overrides the backtrace\_min\_size and the backtrace\_max\_size.
 
 This option can also be used in combination with other tools such
-as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/master/README.md)
+as [libmemunreachable](https://android.googlesource.com/platform/system/memory/libmemunreachable/+/main/README.md)
 to only get backtraces for sizes of allocations listed as being leaked.
 
 ### backtrace\_full
diff --git a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
index bc7af6d..a911e76 100644
--- a/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_config_tests.cpp
@@ -40,8 +40,9 @@
 };
 
 std::string usage_string(
-  "6 malloc_debug For malloc debug option descriptions go to:\n"
-  "6 malloc_debug   https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md\n");
+    "6 malloc_debug For malloc debug option descriptions go to:\n"
+    "6 malloc_debug   "
+    "https://android.googlesource.com/platform/bionic/+/main/libc/malloc_debug/README.md\n");
 
 TEST_F(MallocDebugConfigTest, unknown_option) {
 
diff --git a/linker/linker.h b/linker/linker.h
index a803424..f5bb0ec 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -72,7 +72,7 @@
 };
 
 static constexpr const char* kBionicChangesUrl =
-    "https://android.googlesource.com/platform/bionic/+/master/"
+    "https://android.googlesource.com/platform/bionic/+/main/"
     "android-changes-for-ndk-developers.md";
 
 soinfo* get_libdl_info(const soinfo& linker_si);