aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
AgeCommit message (Collapse)Author
2012-08-01Drop the block count in the garbage collectorEelco Dolstra
2012-07-26Set permissions on temporary build directories to 0700Eelco Dolstra
Fixes #39.
2012-07-18Use "#pragma once" to prevent repeated header file inclusionEelco Dolstra
2012-06-25When using chroots, use a private PID namespaceEelco Dolstra
In a private PID namespace, processes have PIDs that are separate from the rest of the system. The initial child gets PID 1. Processes in the chroot cannot see processes outside of the chroot. This improves isolation between builds. However, processes on the outside can see processes in the chroot and send signals to them (if they have appropriate rights). Since the builder gets PID 1, it serves as the reaper for zombies in the chroot. This might turn out to be a problem. In that case we'll need to have a small PID 1 process that sits in a loop calling wait().
2012-03-18Drop the externals directoryEelco Dolstra
Nix now requires SQLite and bzip2 to be pre-installed. SQLite is detected using pkg-config. We required DBD::SQLite anyway, so depending on SQLite is not a big problem. The --with-bzip2, --with-openssl and --with-sqlite flags are gone.
2012-03-05Set the close-on-exec flag on file descriptorsEelco Dolstra
2012-02-15On Linux, make the Nix store really read-only by using the immutable bitEelco Dolstra
I was bitten one time too many by Python modifying the Nix store by creating *.pyc files when run as root. On Linux, we can prevent this by setting the immutable bit on files and directories (as in ‘chattr +i’). This isn't supported by all filesystems, so it's not an error if setting the bit fails. The immutable bit is cleared by the garbage collector before deleting a path. The only tricky aspect is in optimiseStore(), since it's forbidden to create hard links to an immutable file. Thus optimiseStore() temporarily clears the immutable bit before creating the link.
2012-02-09Use data() instead of c_str() where appropriateEelco Dolstra
2011-12-22* In the garbage collector, delete invalid paths before deletingEelco Dolstra
unreachable paths. This matters when using --max-freed etc.: unreachable paths could become reachable again, so it's nicer to keep them if there is "real" garbage to be deleted. Also, don't use readDirectory() but read the Nix store and delete invalid paths in parallel. This reduces GC latency on very large Nix stores.
2011-12-16* importPath() -> importPaths(). Because of buffering of the inputEelco Dolstra
stream it's now necessary for the daemon to process the entire sequence of exported paths, rather than letting the client do it.
2011-12-16* Avoid expensive conversions from char arrays to STL strings.Eelco Dolstra
2011-12-16* Make the import operation through the daemon much more efficientEelco Dolstra
(way fewer roundtrips) by allowing the client to send data in bigger chunks. * Some refactoring.
2011-12-16* Clean up exception handling.Eelco Dolstra
2011-12-15* Refactoring: move sink/source buffering into separate classes.Eelco Dolstra
* Buffer the HashSink. This speeds up hashing a bit because it prevents lots of calls to the hash update functions (e.g. nix-hash went from 9.3s to 8.7s of user time on the closure of my /var/run/current-system).
2011-12-15* Buffer reads in FdSource. Together with write buffering, thisEelco Dolstra
significantly cuts down the number of syscalls (e.g., for "nix-store -qR /var/run/current-system" via the daemon, it reduced the number of syscalls in the client from 29134 to 4766 and in the daemon from 44266 to 20666).
2011-12-14* Buffer writes in FdSink. This significantly reduces the number ofEelco Dolstra
system calls / context switches when dumping a NAR and in the worker protocol.
2011-12-02* Move parseHash16or32 into libutil, and use in nix-hash.Eelco Dolstra
2011-02-09* Sync with the trunk.Eelco Dolstra
2011-01-14Remove useless <config.h> inclusion from public header.Ludovic Courtès
2010-12-13* nix-instantiate: return exit status 100 to denote a permanent buildEelco Dolstra
failure. The build hook can use this to distinguish between transient and permanent failures on the remote side.
2010-12-13* createDirs(path): if path already exists, make sure it's aEelco Dolstra
directory. * Provide a C++ wrapper around lstat().
2010-11-16* Store the size of a store path in the database (to be precise, theEelco Dolstra
size of the NAR serialisation of the path, i.e., `nix-store --dump PATH'). This is useful for Hydra.
2010-11-16* Sync with the trunk.Eelco Dolstra
2010-10-04* Make sure that config.h is included before the system headers,Eelco Dolstra
because it defines _FILE_OFFSET_BITS. Without this, on OpenSolaris the system headers define it to be 32, and then the 32-bit stat() ends up being called with a 64-bit "struct stat", or vice versa. This also ensures that we get 64-bit file sizes everywhere. * Remove the redundant call to stat() in parseExprFromFile(). The file cannot be a symlink because that's the exit condition of the loop before.
2010-10-04* Sync with the trunk.Eelco Dolstra
2010-10-04* In printMsg(), ignore failing writes to stderr if we're in anEelco Dolstra
exception handler, otherwise throw an exception. We need to ignore write errors in exception handlers to ensure that cleanup code runs to completion if the other side of stderr has been closed unexpectedly.
2010-08-30* When using the build hook, distinguish between the stderr of theEelco Dolstra
hook script proper, and the stdout/stderr of the builder. Only the latter should be saved in /nix/var/log/nix/drvs. * Allow the verbosity to be set through an option. * Added a flag --quiet to lower the verbosity level.
2010-08-27* Experimental feature: allow a derivation to tell the build hook thatEelco Dolstra
it requires a certain feature on the build machine, e.g. requiredSystemFeatures = [ "kvm" ]; We need this in Hydra to make sure that builds that require KVM support are forwarded to machines that have KVM support. Probably this should also be enforced for local builds.
2010-08-04* Sync with the trunk.Eelco Dolstra
2010-06-24src/libutil/util.cc: include <limit.h> to ensure that PATH_MAX is definedPeter Simons
2010-05-12* Sync with the trunk.Eelco Dolstra
2010-05-07* Sync with the trunk.Eelco Dolstra
2010-05-04* Revert r15436. This was a workaround for a bug in btrfs which seemsEelco Dolstra
to have been fixed now.
2010-04-20* Sync with the trunk.Eelco Dolstra
2010-04-19* Don't use the ATerm library for parsing/printing .drv files.Eelco Dolstra
2010-04-14* Remove more obsolete code.Eelco Dolstra
2010-04-12* Remove some obsolete functions.Eelco Dolstra
2010-03-31Escape `>' signs in the XML output.Ludovic Courtès
* src/libutil/xml-writer.cc (nix::XMLWriter::writeAttrs): Escape `>'.
2010-03-23(no commit message)Eelco Dolstra
2010-03-19* Clean up error messages in killUser().Eelco Dolstra
2010-03-09* In `nix-store --export', abort if the contents of a path hasEelco Dolstra
changed. This prevents corrupt paths from spreading to other machines. Note that checking the hash is cheap because we're hashing anyway (because of the --sign feature).
2010-03-04* Synced with the trunk.Eelco Dolstra
2010-03-02* When using the included sqlite/aterm libraries, build withEelco Dolstra
--enable-shared. * In libutil/libstore/libexpr etc., link against sqlite and aterm. * Some more header file hygiene.
2010-02-24* Don't use fdatasync since it doesn't work on Snow Leopard.Eelco Dolstra
* Don't refer to config.h in util.hh, because config.h is not installed (http://hydra.nixos.org/build/303053).
2010-02-24* Remove the fdatasync check since it's no longer needed.Eelco Dolstra
2010-02-10Don't rely on `PATH_MAX' on GNU.Ludovic Courtès
2010-02-02* Remove most Cygwin-specific code. Cygwin 1.7 implements advisoryEelco Dolstra
POSIX locks, and simulates Unix-style file deletion semantics sufficiently. Note that this means that Nix won't work on Cygwin 1.5 anymore.
2010-02-02* If fdatasync() isn't available, use fsync().Eelco Dolstra
2010-01-29* Added an option "fsync-metadata" to fsync() changes toEelco Dolstra
/nix/var/nix/db. * Removed the function writeStringToFile since it does (almost) the same thing as writeFile.
2009-12-17* Include config.h before the C library headers, because it definesEelco Dolstra
_FILE_OFFSET_BITS=64. Without it, functions like stat() fail on large file sizes. This happened with a Nix store on squashfs: $ nix-store --dump /tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds > /dev/null error: getting attributes of path `/tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds': Value too large for defined data type $ stat /tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds File: `/tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds' Size: 0 Blocks: 36028797018963968 IO Block: 1024 regular empty file (This is a bug in squashfs or mksquashfs, but it shouldn't cause Nix to fail.)