summaryrefslogtreecommitdiffstats
path: root/daemon/truncate.c
Commit message (Collapse)AuthorAgeFilesLines
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.
* Update FSF address.Matthew Booth2011-11-081-1/+1
|
* daemon: Don't use ../src path to include generator_protocol.hRichard W.M. Jones2010-11-031-1/+1
| | | | | This file is already hard-linked into the current directory, so the relative path is not required.
* New API calls: truncate, truncate_size, mkdir_mode, utimens, lchown.Richard Jones2009-11-021-0/+65
truncate, truncate_size: Used to truncate files to a particular size, or to zero bytes. mkdir_mode: Like mkdir but allows you to also specify the initial permissions for the new directory. utimens: Set timestamp on a file with nanosecond accuracy. lchown: Corresponding to lchown(2) syscall (we already have chown). The implementation is complicated by the fact that we had to add an Int64 parameter type to the generator.