Commit graph

111 commits

Author SHA1 Message Date
Lennart Poettering 9586cdfab6 socket: if we fail to create an instantiated service for a socket, don't put the socket in failure mode
An incoming connection that is immediately terminated might result in
getpeername() or a similar call failing. Hence it is quite possible that
while we are setting up an instantiated service for a socket we might
get an error and we shouldn't take this as hint to take the listening
socket down.

https://bugs.freedesktop.org/show_bug.cgi?id=45297
https://bugzilla.novell.com/show_bug.cgi?id=741590
2012-03-14 03:01:27 +01:00
Lennart Poettering 54ecda32c6 socket: add option for SO_PASSEC
https://bugzilla.redhat.com/show_bug.cgi?id=798760

(Note that this work is not complete yet, as the kernel seems to send us
useless data with SCM_SECURITY enabled)
2012-03-13 00:00:27 +01:00
Lennart Poettering 6bda96a023 socket: rename 'broken' failure result to 'failed-permanent' on order not to introduce new terminology 2012-03-06 01:29:29 +01:00
Michal Schmidt c2f3480897 socket: fail the socket if the service keeps dying on start
If the service reaches the start limit, mark the sockets that activate
it as failed (with the result code 'service-broken').
This way the sockets won't act as tarpits for clients connecting to
them.
2012-03-05 22:47:54 +01:00
Lennart Poettering 81a5c6d03e automount: convert failure boolean to enum 2012-02-03 05:06:04 +01:00
Lennart Poettering cfc4eb4cba socket: replace failure boolean by enum 2012-02-03 05:06:03 +01:00
Michal Schmidt ede3deb425 socket: typo in dump output 2012-02-01 00:00:34 +01:00
Lennart Poettering 7d9eaa8461 socket: if SO_RCVBUFFORCE fails, fall back to SO_RCVBUF, to have at least a little effect 2012-01-27 18:58:02 +01:00
Michal Schmidt 1a710b430b socket: don't fail the socket on ENOTCONN
Albert Strasheim reported a socket unit with Accept=yes was failing
sometimes.
getpeername() returns ENOTCONN if the connection was killed by TCP RST.
The socket unit must not fail when it happens.

Reproducer available at:
https://bugzilla.redhat.com/show_bug.cgi?id=783344
2012-01-20 23:57:54 +01:00
Michal Schmidt 595ed347a8 unit: use safe downcasts, remove pointless casts
Always use the macros for downcasting.
Remove a few obviously pointless casts.
2012-01-16 13:34:42 +01:00
Michal Schmidt 1124fe6f01 unit: use the UNIT() macro consistently
The UNIT() macro upcasts from specific unit types to the base Unit.
Use it everywhere, rather than accessing the 'meta' member directly.
2012-01-16 13:34:42 +01:00
Michal Schmidt ac155bb885 unit: remove union Unit
Now that objects of all unit types are allocated the exact amount of
memory they need, the Unit union has lost its purpose. Remove it.

"Unit" is a more natural name for the base unit class than "Meta", so
rename Meta to Unit.

Access to members of the base class gets simplified.
2012-01-16 13:34:42 +01:00
Michal Schmidt 7d17cfbc46 unit: reduce heap usage for unit objects
The storage of the unit objects on the heap is currently not very
efficient. For every unit object we allocate a chunk of memory as large
as the biggest unit type, although there are significant differences in
the units' real requirements.
pahole shows the following sizes of structs:
488  Target
496  Snapshot
512  Device
528  Path
560  Timer
576  Automount
1080 Socket
1160 Swap
1168 Service
1280 Mount

Usually there aren't many targets or snapshots in the system, but Device
is one of the most common unit types and for every one we waste
1280 - 512 = 768 bytes.

Fix it by allocating only the right amount for the given unit type.
On my machine (x86_64, with 39 LVM volumes) this decreases systemd's
USS (unique set size) by more than 300 KB.
2012-01-16 13:34:42 +01:00
Lennart Poettering 57020a3abf unit: properly update references to units which are merged
When we merge units that some kind of object points to, those pointers
might become invalidated, and needs to be updated. Introduce a UnitRef
struct which links up all the unit references, to ensure corrected
references.

At the same time, drop configured_sockets in the Service object, and
replace it by proper UNIT_TRIGGERS resp. UNIT_TRIGGERED_BY dependencies,
which allow us to simplify a lot of code.
2012-01-06 23:08:54 +01:00
Lennart Poettering 4cfc6dbe52 socket: only add dependency on kmsg socket to socket units which have any kind of exec program specified 2012-01-03 21:08:57 +01:00
Lennart Poettering 271b032a05 socket: rename the PassCred= option to PassCredentials=, since we don't want to needlessly abbreviate options unless they are very well established 2011-12-31 01:07:49 +01:00
Michal Schmidt d68af58657 socket: add option for SO_PASSCRED
Add an option to enable SO_PASSCRED for unix sockets.
2011-11-30 09:52:34 +01:00
Lennart Poettering de3756ab99 llvm-analyze: fix some bugs found by llvm-analyze 2011-09-23 16:28:27 +02:00
Lennart Poettering 8ea913b2ea coverity: fix a couple of bugs found by coverity 2011-09-23 01:45:34 +02:00
Lennart Poettering ab1f063390 exec: optionally apply cgroup attributes to the cgroups we create 2011-08-20 00:22:02 +02:00
Lennart Poettering f975e971ac load-fragment: speed up parsing by using a perfect hash table with configuration settings built by gperf 2011-08-01 00:43:05 +02:00
Lennart Poettering 189583d7e4 label: generalize label_get_socket_label_from_exe() a bit 2011-07-28 23:39:29 +02:00
Lennart Poettering a17204af0e unit: use ESRCH as error when we don't find anybody to kill 2011-07-13 19:59:28 +02:00
Lennart Poettering 3611581ebd service: properly handle who argument on D-Bus kill calls 2011-07-12 04:05:33 +02:00
Lennart Poettering ab5c3e3ff1 english: s/_per_/_by_/ 2011-06-21 19:29:44 +02:00
Kay Sievers b8cef44e40 socket: always use SO_{RCV,SND}BUFFORCE to allow larger values 2011-05-20 18:43:05 +02:00
Lennart Poettering ec6370a22d socket: expose SO_BROADCAST 2011-05-19 18:10:19 +02:00
Lennart Poettering 6b6d2deecc socket: expose IP_TRANSPARENT 2011-05-19 13:22:31 +02:00
Lennart Poettering 6ea832a207 exec: hangup/reset/deallocate VTs in gettys
Explicitly disconnect all clients from a VT when a getty starts/finishes
(requires TIOCVHANGUP, available in 2.6.29).

Explicitly deallocate getty VTs in order to flush scrollback buffer.

Explicitly reset terminals to a defined state before spawning getty.
2011-05-18 01:07:36 +02:00
Lennart Poettering 9131f660ee socket: use 666 socket mode by default since neither fifos, nor sockets, nor mqueues need to be executable 2011-05-17 19:37:23 +02:00
Lennart Poettering 916abb21d0 socket: add POSIX mqueue support 2011-05-17 19:37:03 +02:00
Lennart Poettering 641e01dcdc socket: improve warning message when we get POLLHUP 2011-04-26 21:39:14 +02:00
Lennart Poettering b0a3f2bc09 socket: support ListeSpecial= sockets 2011-04-20 05:02:23 +02:00
Lennart Poettering ec8b119434 socket: log more information about invalid poll events 2011-04-20 01:48:45 +02:00
Lennart Poettering 94bc27318a socket: reuse existing FIFOs 2011-04-16 03:42:37 +02:00
Lennart Poettering a7444edaf7 socket: try creating a socket under our own identity if we have no perms to consult the selinux database 2011-04-12 20:27:05 +02:00
Lennart Poettering 4ac9236fa1 socket: be a bit more verbose when refusing to start a socket unit 2011-04-10 03:27:19 +02:00
Lennart Poettering 7a22745ac3 socket: support netlink sockets 2011-04-10 03:27:00 +02:00
Lennart Poettering da19d5c19f src: our lord is coverity 2011-03-31 15:35:40 +02:00
Lennart Poettering cd25cce98f exec: drop process group kill mode since it has little use and confuses the user 2011-03-29 23:31:38 +02:00
Lennart Poettering f6a6225e41 def: centralize definition of default timeout in one place 2011-03-17 04:02:35 +01:00
Lennart Poettering 973bcd30bf socket: use 777 as default mode for sockets 2011-03-14 15:37:09 +01:00
Lennart Poettering 430c18ed7f kill: always send SIGCONT after SIGTERM
When we kill a process to terminate it make sure to send SIGCONT to
ensure it is unpaused and processes the signal.
2011-03-03 23:55:30 +01:00
Harald Hoyer 35b8ca3aaf Spelling Corrections
Just some lame spelling corrections with no functionality.
2011-02-28 22:47:38 +01:00
Lennart Poettering 0a494f1ff3 exec: introduce global defaults for the standard output of services 2011-02-15 11:52:29 +01:00
Lennart Poettering 7b4bf06ba7 socket: refuse socket activation for SysV services
Make sure that when a .socket unit is installed without its matching
.service we don't end up activating a legacy SysV/LSB service with the
same name. SysV/LSB style services do not support passing sockets and we
don't want to extend SysV/LSB to ensure we don't break compatibility
with other systems.
2011-02-15 00:40:17 +01:00
Lennart Poettering 5d909e3ec3 automount: use unit_pending_inactive() where appropriate 2011-01-26 02:55:35 +01:00
Lennart Poettering cae18e2172 socket: don't crash if the .service unit for a .socket unit is not found 2011-01-21 02:49:12 +01:00
Lennart Poettering 9a57c62944 systemctl: highlight failed processes in systemctl status 2011-01-20 18:22:03 +01:00
Lennart Poettering e2f3b44cfc service: when reloading a service fails don't fail the entire service but just the reload job 2011-01-20 13:17:22 +01:00