summaryrefslogtreecommitdiffstats
path: root/libdaemon/dfork.c
Commit message (Collapse)AuthorAgeFilesLines
* LICENSE: change license to MITHEADmasterBrandon Philips2012-09-031-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the spirit of 70df7aaa lets change the license again, this time to MIT! Context: On 23:15 Tue 10 Apr 2012, Lennart Poettering wrote: > On Mon, 09.04.12 14:51, Brandon Philips (brandon@ifup.org) wrote: > > I am working on a daemon and it would be great to use libdaemon. > > However, the project is Apache licensed and I have no idea how they > > interact. Is it at all possible to dual license LGPL/BSD or LGPL/Apache? > > > > https://github.com/racker/virgo > > heya. I am not such a big fan of the BSD licenses myself, but I guess in > this case it is OK. Yea :-/ > The only major other contributor seems to be Diego Pettenò who should be > OK with such a change. I'll ask him. Great, thank you. > Would you be OK with MIT as well? Yes, the MIT license works too.
* dfork: set errno properly in some error conditionsLennart Poettering2009-10-181-1/+3
|
* dfork: clean up forking logicAndorz Nilsson2009-10-181-17/+21
| | | | | | | | | | | | | Call setsid() once only to make sure we get a process that is not a session leader or process group leader, and hence cannot acquire a controlling terminal. It looks like setpgid() (or setpgrp()) is used only when setsid() is not available. It looks like the call to ioctl() is necessary only for 4.3BSD. (Patch modified by Lennart Poettering)
* dfork: close all fds >=3, including 3 itselfLennart Poettering2009-10-171-1/+1
|
* dfork: daemon_retval_done() might close socket already closed in ↵Stefan2009-10-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | daemon_close_allv() No Avahi daemon is running. If I start it at command-line with etc/init.d/avahi-daemon start or simply with avahi-daemon -D then the avahi-daemon eats all CPU-time. Stracing the process shows, that it loops endlessly in gettimeofday({1231956423, 692711}, NULL) = 0 gettimeofday({1231956423, 692735}, NULL) = 0 poll([{fd=5, events=POLLIN}, {fd=15, events=POLLIN}, \ {fd=14, events=POLLIN}, {fd=13, events=POLLIN}, \ {fd=12, events=POLLIN}, {fd=11, events=POLLIN}, \ {fd=10, events=POLLIN}, {fd=8, events=POLLIN}], 8, 62150) = 1 \ ([{fd=5, revents=POLLNVAL}]) The fd=5 is a BADFD. I found out that the fd was closed by daemon_retval_send() from libdaemon. (But: I think avahi-daemon should handle the POLLERR nevertheless.) Looking in libdaemon I found, that the library had already closed the fd=5 in daemon_close_all(), and closed it "again" as _daemon_retval_pipe[0] in daemon_retval_send() -> daemon_retval_done(), but in the meantime, this is an fd from the application, not from the library. I think, after closing _daemon_retval_pipe[0] in daemon_close_allv() the fd must be marked as closed. I have attached a patch. For me it works fine.
* dfork: honour _SC_OPEN_MAXLennart Poettering2009-10-171-7/+6
|
* Conditionally declare variables if their use is conditional.Diego 'Flameeyes' Pettenò2008-10-011-1/+3
| | | | | Reduces warnings about unused variables by not declaring them if they are under an #ifdef conditional.
* Fix building on OpenSolaris (without _NSIG definition).Diego 'Flameeyes' Pettenò2008-10-011-1/+9
| | | | | | | On OpenSolaris, the _NSIG macro is not defined, but NSIG is; as it's not possible to use NSIG under glibc (it would miss the SIGRT* series), define a SIGNAL_UPPER_BOUND depending on the system (and error out if the system lacks both NSIG and _NSIG).
* fix a few thinkos in handling of exception listsLennart Poettering2008-07-281-12/+28
|
* create retval pipes once onlyLennart Poettering2008-07-281-2/+8
|
* save and restore errno where necessaryLennart Poettering2008-07-281-0/+7
|
* add more error checkingLennart Poettering2008-07-281-1/+9
|
* reorder a few things, so that logging works properly very early alreadyLennart Poettering2008-07-281-14/+15
|
* add a bit more error checkingLennart Poettering2008-07-281-3/+10
|
* update licenses/file headersLennart Poettering2008-07-281-20/+19
|
* add API to block/reset signalsLennart Poettering2008-04-251-57/+245
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@139 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* Fix brown paper bag bug with handling the first argument passed to ↵Lennart Poettering2007-07-101-6/+10
| | | | | | daemon_close_all(). Patch supplied by Sjoerd Simons git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@127 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* Reenable linux-specifc daemon_close_all() codeLennart Poettering2007-06-111-1/+1
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@118 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* Make sure that we always return a sensible errnoLennart Poettering2007-06-111-5/+14
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@117 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* add daemon_logv()Lennart Poettering2007-06-111-12/+130
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@116 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* * Change license to LGPLLennart Poettering2005-11-181-9/+10
| | | | | | | | * Update README * make use of autoconf macro AM_GNU_SOURCE git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@101 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* use _exit() instead of exit() to terminate if forking failsLennart Poettering2005-11-011-2/+2
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@100 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* remove superfluous \nLennart Poettering2005-11-011-1/+1
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@99 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* Remove some compiler warningsLennart Poettering2005-10-301-3/+3
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@95 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* fixes needed for windows and solarisSebastien Estienne2005-10-281-2/+2
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@94 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* * add a "const" to daemon_log_identLennart Poettering2005-09-101-1/+1
| | | | | | | | | | * fix log message in dfork.c * in dexec.c: call waitpid() in a loop and ignore EINTR * add a "const" to daemon_log_ident * minor doc update git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@90 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* Merge MacOSX compat patch from Sebastien EstienneLennart Poettering2005-07-011-1/+1
| | | | git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@86 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
* rename src/ to libdaemon/Lennart Poettering2004-12-181-0/+340
git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@71 153bfa13-eec0-0310-be40-b0cb6a0e1b4b