Commit Graph

740 Commits

Author SHA1 Message Date
Lennart Poettering c999977392 main: newer kernels return EINVAL if we invoke reboot() in a container lacking perms, deal with it 2012-09-17 19:05:33 +02:00
Lennart Poettering 7ceba24134 manager: fix the build 2012-09-13 19:29:46 +02:00
Lennart Poettering 915b375388 manager: extend performance measurement interface to include firmware/loader times
This only adds the fields to the D-Bus interfaces but doesn't fill them
in with anything useful yet. Gummiboot exposes the necessary bits of
information to use however and as soon as I get my fingers on a proper
UEFI laptop I'll hook up the remaining bits.

Since we want to stabilize the D-Bus interface soon and include it in
the stability promise we should get the last fixes in, hence this change
now.
2012-09-13 18:54:32 +02:00
Lennart Poettering 81270860a5 journal: suppress structured messages if they'd go to the console 2012-09-03 18:59:04 -07:00
Lennart Poettering 877d54e9b0 journal: generate structured journal messages for a number of events 2012-09-03 18:59:04 -07:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Lennart Poettering 31f92a7df4 manager: use a private notify sockets in containers to avoid problems with shared abstract socket namespaces 2012-07-19 02:17:50 +02:00
Lennart Poettering 6b78f9b435 unit: don't serialize job state, only unit state across switch-root 2012-07-18 01:46:52 +02:00
Lennart Poettering b7def68494 util: rename join() to strjoin()
This is to match strappend() and the other string related functions.
2012-07-13 13:41:01 +02:00
Lennart Poettering 5f73969991 unit-name: remove unit_name_is_valid_no_type() and move unit_name_is_valid() to unit-name.h 2012-07-10 17:07:32 +02:00
Lennart Poettering 26a1efdf61 core: mention if we are run from an initial RAM disk 2012-07-02 11:38:32 +02:00
Lennart Poettering 29252e9e5b manager: turn notify socket into abstract namespace socket again
sd_notify() should work for daemons that chroot() as part of their
initilization, hence it's a good idea to use an abstract namespace
socket which is not affected by chroot.
2012-07-02 10:43:57 +02:00
Lennart Poettering 33c5fae939 manager: serialize/deserialize job counters across reexec/reload 2012-06-29 19:47:38 +02:00
Lennart Poettering af6da548aa core: make systemd.confirm_spawn=1 actually work
This adds a timeout if the TTY cannot be acquired and makes sure we
always output the question to the console, never to the TTY of the
respective service.
2012-06-26 12:21:43 +02:00
Kay Sievers d2e54fae5c mkdir: append _label to all mkdir() calls that explicitly set the selinux context 2012-05-31 12:40:20 +02:00
Lennart Poettering 07719a21b6 manager: rework generator logic
Previously generated units were always placed at the end of the search
path. With this change there will be three unit dirs instead of one, to
place generated entries at the beginning, in the middle and at the end
of the search path:

beginning: for units that need to override all configuration, regardless
of user or vendor. Example use: system-update-generator uses this to
temporarily redirect default.target.

middle: for units that need to override vendor configuration, but not
vendor configuration. Example use: /etc/fstab should override vendor
supplied configuration (think /tmp), but should not override native user
configuration.

end: does not override anything but is available as well. Possible usage
might be to convert D-Bus bus service files to native units but allowing
vendor supplied native units to win.
2012-05-23 03:43:29 +02:00
Frederic Crozat c93ff2e913 main: allow system wide limits for services 2012-05-21 21:13:27 +02:00
Harald Hoyer f38ed06060 manager: only serialize the timestamps for the initramfs if in_initrd() 2012-05-21 18:49:31 +02:00
Michal Schmidt 80fbf05e75 dbus-unit: always load the unit before handling a message for it
We need to be able to show the properties even of inactive units.
systemctl loads the unit before getting its properties, but this is racy
as the garbage collector may kick in right after the loading.

Fix it by always loading the unit before handling a message for it.

https://bugzilla.redhat.com/show_bug.cgi?id=814966#c6
2012-05-21 12:54:34 +02:00
Lennart Poettering 664f88a7e6 manager: introduce SwitchRoot bus call for initrd/main transition 2012-05-09 01:24:50 +02:00
Kay Sievers 9eb977db5b util: split-out path-util.[ch] 2012-05-08 02:33:10 +02:00
Michal Schmidt e0209d83e7 core: add NOP jobs, job type collapsing
Two of our current job types are special:
JOB_TRY_RESTART, JOB_RELOAD_OR_START.

They differ from other job types by being sensitive to the unit active state.
They perform some action when the unit is active and some other action
otherwise. This raises a question: when exactly should the unit state be
checked to make the decision?

Currently the unit state is checked when the job becomes runnable. It's more
sensible to check the state immediately when the job is added by the user.
When the user types "systemctl try-restart foo.service", he really intends
to restart the service if it's running right now. If it isn't running right
now, the restart is pointless.

Consider the example (from Bugzilla[1]):

sleep.service takes some time to start.
hello.service has After=sleep.service.
Both services get started. Two jobs will appear:
 hello.service/start  waiting
 sleep.service/start  running
Then someone runs "systemctl try-restart hello.service".

Currently the try-restart operation will block and wait for
sleep.service/start to complete.

The correct result is to complete the try-restart operation immediately
with success, because hello.service is not running. The two original
jobs must not be disturbed by this.

To fix this we introduce two new concepts:
- a new job type: JOB_NOP
  A JOB_NOP job does not do anything to the unit. It does not pull in any
  dependencies. It is always immediately runnable. When installed to a unit,
  it sits in a special slot (u->nop_job) where it never conflicts with
  the installed job (u->job) of a different type. It never merges with jobs
  of other types, but it can merge into an already installed JOB_NOP job.

- "collapsing" of job types
  When a job of one of the two special types is added, the state of the unit
  is checked immediately and the job type changes:
  JOB_TRY_RESTART     -> JOB_RESTART or JOB_NOP
  JOB_RELOAD_OR_START -> JOB_RELOAD or JOB_START
  Should a job type JOB_RELOAD_OR_START appear later during job merging, it
  collapses immediately afterwards.
  Collapsing actually makes some things simpler, because there are now fewer
  job types that are allowed in the transaction.

[1] Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=753586
2012-04-25 18:38:27 +02:00
Lennart Poettering f2b6878955 service: introduce Type=idle and use it for gettys
Type=idle is much like Type=simple, however between the fork() and the
exec() in the child we wait until PID 1 informs us that no jobs are
left.

This is mostly a cosmetic fix to make gettys appear only after all boot
output is finished and complete.

Note that this does not impact the normal job logic as we do not delay
the completion of any jobs. We just delay the invocation of the actual
binary, and only for services that otherwise would be of Type=simple.
2012-04-24 14:42:24 +02:00
Michal Schmidt 5273510e9f transaction: cancel jobs non-recursively on isolate
Recursive cancellation of jobs would trigger OnFailure actions of
dependent jobs. This is not desirable when isolating.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=798328
2012-04-23 08:13:02 +02:00
Michal Schmidt b94fbd3078 transaction: maintain anchor_job
Track which job is the anchor in the transaction.
2012-04-20 17:12:28 +02:00
Michal Schmidt 75778e21df manager: split transaction.[ch]
manager.c takes care of the main loop, unit management, signal handling, ...
transaction.c computes transactions.

After split:
manager.c:     65 KB
transaction.c: 40 KB
2012-04-20 17:12:27 +02:00
Michal Schmidt 7527cb5275 manager: Transaction as an object
This makes it obvious that transactions are short-lived. They are created in
manager_add_job() and destroyed after the application of jobs.
It also prepares for a split of the transaction code to a new source.
2012-04-20 17:12:27 +02:00
Michal Schmidt 97e7d748d1 job: job_uninstall()
Split the uninstallation of the job from job_free() into a separate function.
Adjust the callers.

job_free() now only works on unlinked and uninstalled jobs. This enforces clear
thinking about job lifetimes.
2012-04-20 17:12:27 +02:00
Michal Schmidt 121b3b3180 manager: simplify transaction_abort()
This is equivalent.
2012-04-20 17:12:27 +02:00
Michal Schmidt 02a3bcc6b4 job: allow job_free() only on already unlinked jobs
job_free() is IMO too helpful when it unlinks the job from the transaction.
The callers should ensure the job is already unlinked before freeing.
The added assertions check if anyone gets it wrong.
2012-04-20 17:12:27 +02:00
Michal Schmidt 153bda8f03 manager: fix comment 2012-04-20 17:12:27 +02:00
Lennart Poettering b59e246565 logind: remove redundant entries from logind's default controller lists too 2012-04-16 19:15:00 +02:00
Lennart Poettering 9156e799a2 manager: remove unavailable/redundant entries from default controllers list 2012-04-16 18:59:07 +02:00
Lennart Poettering c757a65b6a watchdog: make watchdog dbus properties writable 2012-04-13 21:37:59 +02:00
Lennart Poettering 44785992c3 audit: ignore if we get EPERM
if auditing access is not available, then don't complain about it, in
order to play nice with systems lacking CAP_SYS_AUDIT
2012-04-13 18:52:53 +02:00
Lennart Poettering a41b539efc manager: support systems lacking /dev/tty0 2012-04-13 18:52:52 +02:00
Lennart Poettering 7ea07dcdda fix a couple of things found with the llvm static analyzer 2012-04-13 13:58:50 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Kay Sievers b30e2f4c18 move libsystemd_core.la sources into core/ 2012-04-11 16:03:51 +02:00
Renamed from src/manager.c (Browse further)