summaryrefslogtreecommitdiffstats
path: root/sbin/hastd
Commit message (Collapse)AuthorAgeFilesLines
* Include process PID in log messages.pjd2010-08-311-0/+3
| | | | | Submitted by: Mikolaj Golub <to.my.trociny@gmail.com> MFC after: 2 weeks
* Correct error message.pjd2010-08-311-1/+1
| | | | | Submitted by: Mikolaj Golub <to.my.trociny@gmail.com> MFC after: 2 weeks
* Forgot to add event.c and event.h in r212038.pjd2010-08-312-0/+208
| | | | | | Pointed out by: pluknet <pluknet@gmail.com> MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Mask only those signals that we want to handle.pjd2010-08-311-1/+4
| | | | | | Suggested by: jilles MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Because it is very hard to make fork(2) from threaded process safe (we arepjd2010-08-305-34/+74
| | | | | | | | | | | | | | limited to async-signal safe functions in the child process), move all hooks execution to the main (non-threaded) process. Do it by maintaining connection (socketpair) between child and parent and sending events from the child to parent, so it can execute the hook. This is step in right direction for others reasons too. For example there is one less problem to drop privs in worker processes. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* We only want to know if descriptors are ready for reading.pjd2010-08-301-7/+4
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* When someone gives NULL as data, assume this is because he want to declarepjd2010-08-301-0/+8
| | | | | | | connection side only. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Use pjdlog_exit() before fork().pjd2010-08-301-2/+2
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Constify arguments we can constify.pjd2010-08-304-23/+25
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Execute hook when connection between the nodes is established or lost.pjd2010-08-303-10/+41
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Execute hook when split-brain is detected.pjd2010-08-303-0/+10
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Use sigtimedwait(2) for signals handling in primary process.pjd2010-08-301-81/+40
| | | | | | | | | This fixes various races and eliminates use of pthread* API in signal handler. Pointed out by: kib With help from: jilles MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* - Move functionality responsible for checking one connection to separatepjd2010-08-291-52/+75
| | | | | | | | function to make code more readable. - Be sure not to reconnect too often in case of signal delivery, etc. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Disconnect after logging errors.pjd2010-08-291-1/+1
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* - Call hook on role change.pjd2010-08-292-1/+26
| | | | | | | - Document new event. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Allow to run hooks from the main hastd process.pjd2010-08-293-3/+22
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* - Add hook_fini() which should be called after fork() from the main hastdpjd2010-08-292-22/+62
| | | | | | | | | process, once it start to use hooks. - Add hook_check_one() in case the caller expects different child processes and once it can recognize it, it will pass pid and status to hook_check_one(). MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Implement mtx_destroy() and rw_destroy().pjd2010-08-291-0/+16
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* When SIGTERM or SIGINT is received, terminate worker processes.pjd2010-08-271-0/+30
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* When logging to stdout/stderr, flush after each log.pjd2010-08-271-0/+1
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Correct when we log interrupted synchronization.pjd2010-08-271-6/+4
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Check if no signals were delivered just before going to sleep.pjd2010-08-271-1/+3
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Add hooks execution.pjd2010-08-271-0/+6
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Document new 'exec' parameter.pjd2010-08-271-1/+39
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Allow to execute specified program on various HAST events.pjd2010-08-276-4/+68
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* - Run hooks in background - don't block waiting for them to finish.pjd2010-08-272-20/+228
| | | | | | | | - Keep all hooks we're running in a global list, so we can report when they finish and also report when they are running for too long. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* When logging to stdout/stderr don't close those descriptors after fork().pjd2010-08-271-2/+15
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Reduce indent where possible.pjd2010-08-271-30/+30
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Implement keepalive mechanism inside HAST protocol so we can detect secondarypjd2010-08-273-16/+66
| | | | | | | | | node failures quickly for HAST resources that are rarely modified. Remove XXX from a comment now that the guard thread never sleeps infinitely. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* - Remove redundant and incorrect 'old' word from debug message.pjd2010-08-271-2/+4
| | | | | | | - Log disconnects as warnings. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Don't increase number synchronized bytes in case of an error.pjd2010-08-271-3/+2
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Log that synchronization was interrupted in a proper place.pjd2010-08-271-5/+8
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* We have sync_start() function to start synchronization, introduce sync_stop()pjd2010-08-271-7/+12
| | | | | | | function to stop it. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Add QUEUE_INSERT() and QUEUE_TAKE() macros that simplify the code a bit.pjd2010-08-271-54/+35
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Add mtx_owned() implementation.pjd2010-08-271-0/+8
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* Make comment more readable.pjd2010-08-271-2/+2
| | | | | MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
* For some setups sending data in 128kB chunks makes communication very slow. Nopjd2010-08-181-2/+1
| | | | | | | idea why. 32kB on the other hand seems to work properly everywhere. Reported by: Thomas Steen Rasmussen <thomas@gibfest.dk> MFC after: 3 weeks
* The 'size' variable is there to limit how many bytes we want to copy frompjd2010-08-161-2/+1
| | | | | | | 'addr'. It is very likely that size of 'addr' is larger than 'size', so checking strlcpy() return value is bogus. MFC after: 3 weeks
* Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki whilejoel2010-08-161-1/+1
| | | | | | translating these manual pages. Minor corrections by me. Submitted by: Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
* Document 'none' value for remote.pjd2010-08-051-1/+6
| | | | | Reviewed by: dougb MFC after: 1 month
* Implement configuration reload on SIGHUP. This includes:pjd2010-08-053-12/+322
| | | | | | | | | | | - Load added resources. - Stop and forget removed resources. - Update modified resources in least intrusive way, ie. don't touch /dev/hast/<name> unless path to local component or provider name were modified. Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com MFC after: 1 month
* Prepare configuration parsing code to be called multiple times:pjd2010-08-053-58/+111
| | | | | | | | | | - Don't exit on errors if not requested. - Don't keep configuration in global variable, but allocate memory for configuration. - Call yyrestart() before yyparse() so that on error in configuration file we will start from the begining next time and not from the place we left of. MFC after: 1 month
* Make control_set_role() more public. We will need it soon.pjd2010-08-052-10/+20
| | | | MFC after: 1 month
* Allow to use 'none' keywork as remote address in case second cluster nodepjd2010-08-051-2/+12
| | | | | | is not setup yet. MFC after: 1 month
* Reset signal handlers after fork().pjd2010-08-052-0/+6
| | | | MFC after: 1 month
* - Use pjdlog_exitx() to log errors and exit instead of errx().pjd2010-08-052-5/+7
| | | | | | - Use 'unable to' (instead of 'cannot') consistently. MFC after: 1 month
* Assert that various buffers we are large enough.pjd2010-08-052-10/+13
| | | | MFC after: 1 month
* Problem with assertion is that it logs on stderr. Add two macros:pjd2010-08-052-0/+33
| | | | | | | | | PJDLOG_ASSERT() and PJDLOG_VERIFY() that will check the given condition and log the problem where appropriate. The difference between those two is that PJDLOG_VERIFY() always work and PJDLOG_ASSERT() can be turned off by defining NDEBUG. MFC after: 1 month
* Keep $FreeBSD$ in __FBSDID() only for C files.pjd2010-08-051-2/+0
| | | | MFC after: 1 month
* Mark two more places that we won't reach.pjd2010-08-051-0/+2
| | | | MFC after: 1 month
OpenPOWER on IntegriCloud