Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/mozglue/linker/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 950 B image not shown  

Quelle  Mappable.cpp   Sprache: C

 
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */


#include <fcntl.h>
#include <sys/stat.h>

#include "Mappable.h"

Mappable* Mappable::Create(const char* path) {
  int fd = open(path, O_RDONLY);
  if (fd != -1) return new Mappable(fd);
  return nullptr;
}

MemoryRange Mappable::mmap(const void* addr, size_t length, int prot, int flags,
                           off_t offset) {
  MOZ_ASSERT(fd && *fd != -1);
  MOZ_ASSERT(!(flags & MAP_SHARED));
  flags |= MAP_PRIVATE;

  return MemoryRange::mmap(const_cast<void*>(addr), length, prot, flags, *fd,
                           offset);
}

void Mappable::finalize() {
  /* Close file ; equivalent to close(fd.forget()) */
  fd.emplace(-1);
}

size_t Mappable::GetLength() const {
  struct stat st;
  return fstat(*fd, &st) ? 0 : st.st_size;
}

Messung V0.5
C=96 H=96 G=95

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.