summaryrefslogtreecommitdiff
path: root/src/socket-proxy
Commit message (Collapse)AuthorAge
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-28
| | | | | | | | | | | | | Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
* treewide: more log_*_errno() conversionsMichal Schmidt2014-11-28
|
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* socket-proxyd: Unchecked return value from librarySusant Sahani2014-10-09
| | | | | CID 1237543 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)
* include fcntl.h rather than sys/fcntl.hEmil Renner Berthing2014-09-18
|
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-15
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-03
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* fix warningsThomas Hindoe Paaboel Andersen2014-06-06
| | | | | Prevent use of uninitialized variable and removed a now unused cleanup function for freeaddrinfo
* socket-proxyd: port to asynchronous name resolution using sd-resolveLennart Poettering2014-06-05
|
* util: replace close_pipe() with new safe_close_pair()Lennart Poettering2014-03-24
| | | | | | safe_close_pair() is more like safe_close(), except that it handles pairs of fds, and doesn't make and misleading allusion, as it works similarly well for socketpairs() as for pipe()s...
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-18
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering2014-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
* event: be more conservative when returning errors from event handler callbacksLennart Poettering2013-12-13
| | | | | We really should return errors from event handlers if we have a continous problem and don't know any other solution.
* event: hook up sd-event with the service watchdog logicLennart Poettering2013-12-11
| | | | | | | | | | | | | Adds a new call sd_event_set_watchdog() that can be used to hook up the event loop with the watchdog supervision logic of systemd. If enabled and $WATCHDOG_USEC is set the event loop will ping the invoking systemd daemon right after coming back from epoll_wait() but not more often than $WATCHDOG_USEC/4. The epoll_wait() will sleep no longer than $WATCHDOG_USEC/4*3, to make sure the service manager is called in time. This means that setting WatchdogSec= in a .service file and calling sd_event_set_watchdog() in your daemon is enough to hook it up with the watchdog logic.
* Revert "socket-proxyd: Add --listener option for listener/destination pairs."Lennart Poettering2013-11-27
| | | | | | | | | | | This reverts commit adcf4c81c58511b67644e17fa743d1729d3c9ccf. We have a better solution for the problem of making two processes run in the same namespace, and --listener is not needed hence and should be dropped. Conflicts: man/systemd-socket-proxyd.xml
* socket-proxyd: Add --listener option for listener/destination pairs.David Strauss2013-11-25
|
* event: rename sd_event_get() to sd_event_source_get_event()Lennart Poettering2013-11-22
|
* bus: introduce concept of a "default" event loop per-thread and make use of ↵Lennart Poettering2013-11-12
| | | | | | | | | it everywhere Try to emphasize a bit that there should be a mapping between event loops and threads, hence introduce a logic that there's one "default" event loop for each thread, that can be queried via "sd_event_default()".
* socket-proxy: actually properly keep track of connectionsLennart Poettering2013-11-07
|
* socket-proxyd: no need to redefine sockaddr unionLennart Poettering2013-11-07
|
* event: make sure we keep a reference to all events we dispatch while we do so.Lennart Poettering2013-11-07
|
* socket-proxyd: rework to support multiple sockets and splice()-based ↵Lennart Poettering2013-11-06
| | | | | | | | | zero-copy network IO This also drops --ignore-env, which can't really work anymore if we allow multiple fds. Also adds support for pretty printing of peer identities for debug purposes, and abstract namespace UNIX sockets. Also ensures that we never take more connections than a certain limit.
* socket-proxy: clean-up indentingLennart Poettering2013-11-06
|
* clients: unify how we invoke getopt_long()Lennart Poettering2013-11-06
| | | | | Among other things this makes sure we always expose a --version command and show it in the help texts.
* socket-proxyd: Actually, some of those sizes are unsigned.David Strauss2013-10-31
|
* fix compiler warningsRonny Chevalier2013-10-31
| | | | | | | | multiple warnings like src/socket-proxy/socket-proxyd.c: In function ‘transfer_data_cb’: src/socket-proxy/socket-proxyd.c:237:25: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 6 has type ‘size_t’ [-Wformat=] log_debug("Buffer now has %ld bytes full.", c->buffer_filled_len);
* socket-proxyd: Fix-up from previous change to avoid looping on errors.David Strauss2013-10-21
|
* socket-proxyd: Use ONESHOT to behave properly with multiple accept() processes.David Strauss2013-10-21
|
* socket-proxyd: Remove datagram research TODO. This proxy will not work with ↵David Strauss2013-10-19
| | | | them.
* socket-proxyd: Comment and log text cleanup.David Strauss2013-10-19
| | | | | | * Standardize on "nonblocking" spelling, per Linux man pages. * Clarify that the nonblocking sockets are never in a "blocking" or "unblocked" state, just a "would block" or "ready" state.
* socket-proxyd: initialize variable used in error code pathKay Sievers2013-10-20
|
* socket-proxyd: rename from saproxyLennart Poettering2013-10-18
The thing is a daemon, hence needs a "d" prefix. Also, we tend to not abbreviate names of background components unnecessarily, since they are not primary commands people type. Then, the fact that this thing does socket actviation is mostly in implementationd detail for the proxy. Also, do some minor indenting clean-ups and other code updates.