<commit_before>/*
 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <unistd.h>

#include "native_client/src/untrusted/nacl/nacl_irt.h"
#include "native_client/src/untrusted/nacl/nacl_thread.h"
#include "native_client/src/untrusted/nacl/tls.h"

/*
 * This initialization happens early in startup with or without libpthread.
 * It must make it safe for vanilla newlib code to run.
 */
void __pthread_initialize_minimal(size_t tdb_size) {
  /* Adapt size for sbrk. */
  /* TODO(robertm): this is somewhat arbitrary - re-examine). */
  size_t combined_size = (__nacl_tls_combined_size(tdb_size) + 15) & ~15;

  /*
   * Use sbrk not malloc here since the library is not initialized yet.
   */
  void *combined_area = sbrk(combined_size);

  /*
   * Fill in that memory with its initializer data.
   */
  void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size);
<commit_msg>Cleanup: Remove unnecessary rounding when allocating initial thread block<commit_after>/*
 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include <unistd.h>

#include "native_client/src/untrusted/nacl/nacl_irt.h"
#include "native_client/src/untrusted/nacl/nacl_thread.h"
#include "native_client/src/untrusted/nacl/tls.h"

/*
 * This initialization happens early in startup with or without libpthread.
 * It must make it safe for vanilla newlib code to run.
 */
void __pthread_initialize_minimal(size_t tdb_size) {
  size_t combined_size = __nacl_tls_combined_size(tdb_size);

  /*
   * Use sbrk not malloc here since the library is not initialized yet.
   */
  void *combined_area = sbrk(combined_size);

  /*
   * Fill in that memory with its initializer data.
   */
  void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size);

{'fraction_non_alphanumeric': 0.09379727685325265, 'fraction_numerical': 0.006051437216338881, 'mean_word_length': 4.061224489795919, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4035348', 'n_tokens_mistral': 675, 'n_tokens_neox': 651, 'n_words': 204}