summaryrefslogtreecommitdiff
path: root/src/shared/util.h
AgeCommit message (Collapse)Author
2013-03-20bus: implement demarshallerLennart Poettering
2013-03-20util: add hexmem() and strextend() callsLennart Poettering
2013-03-20Make PrivateTmp dirs also inaccessible from the outsideZbigniew Jędrzejewski-Szmek
Currently, PrivateTmp=yes means that the service cannot see the /tmp shared by rest of the system and is isolated from other services using PrivateTmp, but users can access and modify /tmp as seen by the service. Move the private /tmp and /var/tmp directories into a 0077-mode directory. This way unpriviledged users on the system cannot see (or modify) /tmp as seen by the service.
2013-03-18journal,shared: add _cleanup_journal_close_Zbigniew Jędrzejewski-Szmek
2013-03-15core: reuse the same /tmp, /var/tmp and inaccessible dirMichal Sekletar
All Execs within the service, will get mounted the same /tmp and /var/tmp directories, if service is configured with PrivateTmp=yes. Temporary directories are cleaned up by service itself in addition to systemd-tmpfiles. Directory which is mounted as inaccessible is created at runtime in /run/systemd.
2013-03-13util, manager: and mempset() and use itMichal Schmidt
Just like mempcpy() is almost identical to memcpy() except the useful return value, so is the relation of mempset() to memset().
2013-03-08shared: inline trivial auto-cleanup functionsMichal Schmidt
2013-03-02job: print the "OK" status messages in normal greenMichal Schmidt
The "OK" status messages should not draw attention to themselves. It's better if they're not printed in bright/bold. Leave that to errors and warnings. Use a plain inconspicuous enterprisey green.
2013-02-28core/manager: print status messages about running jobsMichal Schmidt
Sometimes the boot gets stuck until a timeout hits. The usual timeouts are on the order of minutes, so users may lose patience. Print animated status messages telling the names of units with running jobs to make it easy to see what systemd is waiting for. The animation looks cooler with a shorter interval, but 1 s is OK and should not be too hard on slow serial console users.
2013-02-28util: split resolving of /dev/console into a new functionMichal Schmidt
2013-02-28util, core: add support for ephemeral status linesMichal Schmidt
Ephemeral status lines do not end with a newline and they expect to be overwritten by the next printed status line.
2013-02-14bootchart: use conf-parser & CamelCase names in .confThomas Hindoe Paaboel Andersen
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-13efi: efi_get_boot_options() should already sort the entries, the random ↵Lennart Poettering
order in the efivars fs is probably not useful This also introduces a new FOREACH_DIRENT macro and makes use of it.
2013-02-13util: introduce strcaseeq/strncaseeqThomas Hindoe Paaboel Andersen
2013-02-11binfmt,tmpfiles,modules-load,sysctl: rework the various early-boot services ↵Lennart Poettering
that work on .d/ directories This unifies much of the logic behind them: - All four will now ofllow the rule that the earlier file and earlier assignment in the .d/ directories wins. Before, sysctl was the only outlier, where the later setting always won. - All four now support getopt() and --help on the command line. - All four can now handle specification of configuration file names on the command line to apply. The tools will automatically find them, and apply them. Previously only tmpfiles could do that. This is useful for %post scripts in RPMs and suchlike. - This fixes various error path issues in conf_files_list()
2013-02-11util: introduce FOREACH_LINE for iterating through filesLennart Poettering
2013-02-11env: considerably beef up environment cleaning logicLennart Poettering
Now, actually check if the environment variable names and values used are valid, before accepting them. With this in place are at some places more rigid than POSIX, and less rigid at others. For example, this code allows lower-case environment variables (which POSIX suggests not to use), but it will not allow non-UTF8 variable values. All in all this should be a good middle ground of what to allow and what not to allow as environment variables. (This also splits out all environment related calls into env-util.[ch])
2013-01-25Add _cleanup_pclose_ and fix mismatching pipe close opened by popen()Zbigniew Jędrzejewski-Szmek
Based-on-patch-by: Thomas Jarosch <thomas.jarosch@intra2net.com> cppcheck reported: [src/bootchart/svg.c:791]: (error) Mismatching allocation and deallocation: f
2013-01-21util: move is_efiboot() to efivars.cLennart Poettering
2013-01-19cgroup: additional validity checks for cgroup attribute namesLennart Poettering
2013-01-17systemctl add command list-dependenciesLukas Nykryn
systemctl list-dependencies lists all unit's dependecies and recursively expands all subsidiary target units into a tree. Primary purpose for this command is to show all units which are enabled in specified target.
2013-01-15systemctl: when inhibiting shutdown/suspend also check for other login sessionsLennart Poettering
2012-12-31unit: add ConditionACPower=Lennart Poettering
2012-12-23journalctl: strip TABs and ANSI color sequences from log messages when ↵Lennart Poettering
displaying them
2012-12-22nspawn: allow passing socket activation fds through nspawnLennart Poettering
2012-11-23util: split off time related calls from util.[ch] into time-util.[ch]Lennart Poettering
2012-11-22shared: FORMAT_TIMESTAMP_MAX +1Kay Sievers
5 is for weekday+comma+space, but week days in french have 4 digits https://bugs.freedesktop.org/show_bug.cgi?id=57411
2012-11-14util: add strreplace() to replace a substring by another stringLennart Poettering
2012-11-12util: nicer tree drawingsMichal Schmidt
Draw trees more similar to pstree/findmnt/lsblk/...
2012-11-04shared: add is_efiboot()Kay Sievers
2012-11-02util : fallback to plain ASCII drawing if locale is not UTF-8Michal Schmidt
When printing cgroup and sysfs hierarchies, avoid using UTF-8 box drawing characters if the locale is not UTF-8. https://bugzilla.redhat.com/show_bug.cgi?id=871153
2012-11-02util: add is_locale_utf8()Michal Schmidt
journalctl and vconsole-setup both implement utf8 locale detection. Let's have a common function for it. The next patch will add another use.
2012-10-30shared: "max" in the string->number conversion is meant to be inclusiveMichal Schmidt
2012-10-30shared, core: do not always accept numbers in string lookupsMichal Schmidt
The behaviour of the common name##_from_string conversion is surprising. It accepts not only the strings from name##_table but also any number that falls within the range of the table. The order of items in most of our tables is an internal affair. It should not be visible to the user. I know of a case where the surprising numeric conversion leads to a crash. We will allow the direct numeric conversion only for the tables where the mapping of strings to numeric values has an external meaning. This holds for the following lookup tables: - netlink_family, ioprio_class, ip_tos, sched_policy - their numeric values are stable as they are defined by the Linux kernel interface. - log_level, log_facility_unshifted - the well-known syslog interface. We allow the user to use numeric values whose string names systemd does not know. For instance, the user may want to test a new kernel featuring a scheduling policy that did not exist when his systemd version was released. A slightly unpleasant effect of this is that the name##_to_string conversion cannot return pointers to constant strings anymore. The strings have to be allocated on demand and freed by the caller.
2012-10-28logind: support for hybrid sleep (i.e. suspend+hibernate at the same time)Lennart Poettering
2012-10-27util: return the remaining string in startswith()Lennart Poettering
2012-10-26coredumpctl: show timestamps in listLennart Poettering
2012-10-22util: add (x)bsearch_r(), the missing counterpart of qsort_r()Kay Sievers
2012-10-19util: change endswith() to return a pointer to the suffixLennart Poettering
2012-10-19util: unify line caching and column cachingLennart Poettering
2012-10-19util: unify usage of on_tty() in util.cLennart Poettering
2012-10-19util: simplify column caching logicLennart Poettering
2012-10-11journalctl: implement --since= and --until for filtering by timeLennart Poettering
2012-10-03dbus: add some more safety checks before accepting data from bus clientsLennart Poettering
2012-09-24journalctl: reset cached column count on SIGWINCHDave Reisner
This requires a little bit of tip-toeing around to explicitly avoid touching the environment from a sig handler. Instead, simply create a function to reset the var to its "unset" state, allowing the next call to columns() to recalculate and cache the new value.
2012-09-20util: fix overflow checksLennart Poettering
2012-09-20util: overflow hardeningLennart Poettering
2012-09-20util: make sure heap allocators fail when array allocations are out of boundsLennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=858777
2012-09-19util: define union dirent_storage and make use of it everywhereLennart Poettering
Make sure to allocate enough space for readdir_r(). https://bugzilla.redhat.com/show_bug.cgi?id=858754