#define _XOPEN_SOURCE 600 #include "config.h" #include #include #include #include #include // for strcasecmp #include #include #include #include #include #include "archive.hh" #include "util.hh" namespace nix { static string archiveVersion1 = "nix-archive-1"; static string caseHackSuffix = "~nix~case~hack~"; PathFilter defaultPathFilter; static void dumpContents(const Path & path, size_t size, Sink & sink) { writeString("contents", sink); writeLongLong(size, sink); AutoCloseFD fd = open(path.c_str(), O_RDONLY); if (fd == -1) throw SysError(format("opening file `%1%'") % path); unsigned char buf[65536]; size_t left = size; while (left > 0) { size_t n = left > sizeof(buf) ? sizeof(buf) : left; readFull(fd, buf, n); left -= n; sink(buf, n); } writePadding(size, sink); } static void dump(const Path & path, Sink & sink, PathFilter & filter) { struct sta
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Enge <andreas@enge.fr>2024-09-06 18:39:38 +0200
committerAndreas Enge <andreas@enge.fr>2024-09-06 18:41:34 +0200
commit904631033ef8c5af94d3c2ec5e2762fdddf74c28 (patch)
treea07ea71a1b7c34f2298146fcb4f4030fd7917d95 /nix/libstore/.gitignore
parent997eabecc02fff9d75c8f8bdf07a94e547dd8d5a (diff)
downloadguix-904631033ef8c5af94d3c2ec5e2762fdddf74c28.tar.gz
guix-904631033ef8c5af94d3c2ec5e2762fdddf74c28.zip
Add file to core-packages team.
* etc/teams.scm (core-packages): Add multiprecision.scm, which contains inputs for gcc. Change-Id: I36bf34450942c55529a471838fcfca29ceb9ae45
Diffstat (limited to 'nix/libstore/.gitignore')
0 files changed, 0 insertions, 0 deletions
ink & sink, Source & source) { string version; try { version = readString(source); } catch (SerialisationError & e) { /* This generally means the integer at the start couldn't be decoded. Ignore and throw the exception below. */ } if (version != archiveVersion1) throw badArchive("input doesn't look like a normalized archive"); parse(sink, source, ""); } struct RestoreSink : ParseSink { Path dstPath; AutoCloseFD fd; void createDirectory(const Path & path) { Path p = dstPath + path; if (mkdir(p.c_str(), 0777) == -1) throw SysError(format("creating directory `%1%'") % p); }; void createRegularFile(const Path & path) { Path p = dstPath + path; fd.close(); fd = open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0666); if (fd == -1) throw SysError(format("creating file `%1%'") % p); } void isExecutable() { struct stat st; if (fstat(fd, &st) == -1) throw SysError("fstat"); if (fchmod(fd, st.st_mode | (S_IXUSR | S_IXGRP | S_IXOTH)) == -1) throw SysError("fchmod"); } void preallocateContents(unsigned long long len) { #if HAVE_POSIX_FALLOCATE if (len) { errno = posix_fallocate(fd, 0, len); /* Note that EINVAL may indicate that the underlying filesystem doesn't support preallocation (e.g. on OpenSolaris). Since preallocation is just an optimisation, ignore it. */ if (errno && errno != EINVAL) throw SysError(format("preallocating file of %1% bytes") % len); } #endif } void receiveContents(unsigned char * data, unsigned int len) { writeFull(fd, data, len); } void createSymlink(const Path & path, const string & target) { Path p = dstPath + path; nix::createSymlink(target, p); } }; void restorePath(const Path & path, Source & source) { RestoreSink sink; sink.dstPath = path; parseDump(sink, source); } }