summaryrefslogtreecommitdiff
path: root/src/nm-session-monitor.c
Commit message (Collapse)AuthorAgeFilesLines
* session-monitor: don't use GIOChannel to watch plain file descriptorThomas Haller2020-01-131-9/+13
|
* all: unify format of our Copyright source code commentsThomas Haller2019-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```bash readarray -d '' FILES < <( git ls-files -z \ ':(exclude)po' \ ':(exclude)shared/c-rbtree' \ ':(exclude)shared/c-list' \ ':(exclude)shared/c-siphash' \ ':(exclude)shared/c-stdaux' \ ':(exclude)shared/n-acd' \ ':(exclude)shared/n-dhcp4' \ ':(exclude)src/systemd/src' \ ':(exclude)shared/systemd/src' \ ':(exclude)m4' \ ':(exclude)COPYING*' ) sed \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \ -e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \ -e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \ -i \ "${FILES[@]}" echo ">>> untouched Copyright lines" git grep Copyright "${FILES[@]}" echo ">>> Copyright lines with unusual extra" git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved sed \ -e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \ -i \ "${FILES[@]}" ``` https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
* all: manually drop code comments with file descriptionThomas Haller2019-10-011-1/+2
|
* all: SPDX header conversionLubomir Rintel2019-09-101-15/+2
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* all: drop emacs file variables from source filesThomas Haller2019-06-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | We no longer add these. If you use Emacs, configure it yourself. Also, due to our "smart-tab" usage the editor anyway does a subpar job handling our tabs. However, on the upside every user can choose whatever tab-width he/she prefers. If "smart-tabs" are used properly (like we do), every tab-width will work. No manual changes, just ran commands: F=($(git grep -l -e '-\*-')) sed '1 { /\/\* *-\*- *[mM]ode.*\*\/$/d }' -i "${F[@]}" sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}" Check remaining lines with: git grep -e '-\*-' The ultimate purpose of this is to cleanup our files and eventually use SPDX license identifiers. For that, first get rid of the boilerplate lines.
* session-monitor: use "/run/ConsoleKit/database" instead of ↵Thomas Haller2019-05-171-1/+1
| | | | | | | | "/var/run/ConsoleKit/database" There should be no difference in pratice. But we should not mention "/var/run" as /var might not be mounted in early boot or rescue environment. Of course, in those cases ConsoleKit is not running either. But still...
* all: replace strerror() calls with nm_strerror_native()Thomas Haller2019-02-121-1/+1
|
* all: cache errno in local variable before using itThomas Haller2019-02-121-1/+3
|
* all: drop unnecessary includes of <errno.h> and <string.h>Thomas Haller2019-02-121-2/+0
| | | | | "nm-macros-interal.h" already includes <errno.h> and <string.h>. No need to include it everywhere else too.
* all: avoid g_memdup()Thomas Haller2018-09-071-1/+1
| | | | | | | By using nm_memdup(). Except in shared/nm-utils/nm-compat.c, which may not include "shared/nm-utils/nm-shared-utils.h".
* build: cleanup build defines for session-trackingThomas Haller2018-08-271-16/+18
| | | | | | | | | | | | | - always define the SESSION_TRACKING_* defines to replace "#ifdef" with "#if". - drop defining the consolekit database path CKDB_PATH in config.h. The path was not customizable via configure/meson. - fix meson build to enable consolekit support for session tracking without also enabling logind/elogind session tracking. logind/elogind is mutually exclusive, but consolekit session tracking goes together just fine.
* session-monitor: avoid an assertion failure if there's no session monitorLubomir Rintel2018-05-091-1/+1
| | | | | | The constructor can bail out early, not setting monitor->sd.watch: (NetworkManager:373): GLib-CRITICAL **: 20:35:58.601: g_source_remove: assertion 'tag > 0' failed
* session-monitor: fix a -Wcast-function-type warningLubomir Rintel2018-03-191-1/+4
| | | | See-Also: ee916a1e9ec3f06f8c88dc3d95058a6bd1561c7d
* all: use nm_direct_hash() instead of g_direct_hash()Thomas Haller2017-11-161-1/+1
| | | | | | We also do this for libnm, where it causes visible changes in behavior. But if somebody would rely on the hashing implementation for hash tables, it would be seriously flawed.
* all: don't use g_direct_equal() for hash table equality functionThomas Haller2017-11-161-1/+1
| | | | | | | | | | GHashTable optimizes a NULL equality function to use direct pointer comparison. That saves the overhead of calling g_direct_equal(). This is also documented behavior for g_hash_table_new(). While at it, also don't pass g_direct_hash() but use the default of %NULL. The behavior is the same, but consistently don't use g_direct_hash().
* core: introduce NM_HASH_INIT() to initialize hash seedThomas Haller2017-10-131-3/+3
| | | | | | | | | | Introduce a NM_HASH_INIT() function. It makes the places where we initialize a hash with a certain seed visually clear. Also, move them from "shared/nm-utils/nm-shared-utils.h" to "shared/nm-utils/nm-macros-internal.h". We might want to have NM_HASH_INIT() non-inline (hence, define it in the source file).
* session: make systemd-logind and elogind conflicting build optionsth/elogind-bgo779167Thomas Haller2017-02-241-15/+10
|
* session: add elogind supportSven Eden2017-02-241-0/+17
| | | | | https://bugzilla.gnome.org/show_bug.cgi?id=779167 https://bugs.gentoo.org/show_bug.cgi?id=607352
* core: introduce default logging macrosBeniamino Galvani2016-10-141-10/+2
|
* session-monitor: fix parsing of ConsoleKit databaseBeniamino Galvani2016-10-131-1/+1
| | | | | | | | | | The section name is "Session", not "CkSession". Restore the correct value, changed by commit 0de60b300ed6 ("session: merge nm-session-monitor-* modules"). Fixes: 0de60b300ed6cc0fc94c742396112b1274989371 https://bugzilla.gnome.org/show_bug.cgi?id=772640
* session-monitor: use logging macrosBeniamino Galvani2016-10-131-7/+19
| | | | | Use logging macros and also, print the session tracking method during startup for debugging purposes.
* core: refactor private data in "src"Thomas Haller2016-10-041-33/+22
| | | | | | | | | | | | | | | | - use _NM_GET_PRIVATE() and _NM_GET_PRIVATE_PTR() everywhere. - reorder statements, to have GObject related functions (init, dispose, constructed) at the bottom of each file and in a consistent order w.r.t. each other. - unify whitespaces in signal and properties declarations. - use NM_GOBJECT_PROPERTIES_DEFINE() and _notify() - drop unused signal slots in class structures - drop unused header files for device factories
* all: modify line separator comments to be 80 chars wideThomas Haller2016-10-031-5/+5
| | | | sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
* session-monitor: remove wrapper functions to connect/disconnect signalThomas Haller2016-05-121-39/+0
| | | | | | | | We don't add such wrappers anywhere else, and I think they are not desired style. Also, keep the signal-id in a "gulong session_changed_id", instead of guint.
* session-monitor/trivial: rename local functions for unique prefixThomas Haller2016-03-111-8/+8
| | | | | | | Don't use a "sd_" prefix for our local functions because then it's not immediately clear which functions are ours and which are from systemd-logind. Just rename them to have a "st_sd_*" prefix ("st" like "session tracking").
* all: cleanup includes and let "nm-default.h" include "config.h"Thomas Haller2016-02-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All internal source files (except "examples", which are not internal) should include "config.h" first. As also all internal source files should include "nm-default.h", let "config.h" be included by "nm-default.h" and include "nm-default.h" as first in every source file. We already wanted to include "nm-default.h" before other headers because it might contains some fixes (like "nm-glib.h" compatibility) that is required first. - After including "nm-default.h", we optinally allow for including the corresponding header file for the source file at hand. The idea is to ensure that each header file is self contained. - Don't include "config.h" or "nm-default.h" in any header file (except "nm-sd-adapt.h"). Public headers anyway must not include these headers, and internal headers are never included after "nm-default.h", as of the first previous point. - Include all internal headers with quotes instead of angle brackets. In practice it doesn't matter, because in our public headers we must include other headers with angle brackets. As we use our public headers also to compile our interal source files, effectively the result must be the same. Still do it for consistency. - Except for <config.h> itself. Include it with angle brackets as suggested by https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
* session-monitor: explicitly use singleton instanceThomas Haller2015-08-131-12/+20
| | | | | | | | Some functions from nm-session-monitor.c have an implicit access to nm_session_monitor_get(). This is non-obvious behavior. Instead require the explicit session-monitor instance to be provided -- where needed.
* all: make use of new header file "nm-default.h"Thomas Haller2015-08-051-2/+1
|
* all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship2015-07-241-2/+1
| | | | | | | | | | | | | | | | Rather than randomly including one or more of <glib.h>, <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to nm-glib.h, include <gio/gio.h> from there, and then change all .c files in NM to include "nm-glib.h" rather than including the glib headers directly. (Public headers files still have to include the real glib headers, since nm-glib.h isn't installed...) Also, remove glib includes from header files that are already including a base object header file (which must itself already include the glib headers).
* core: move NM_DEFINE_SINGLETON macros to src/NetworkManagerUtils.hThomas Haller2015-07-241-0/+1
| | | | | NM_DEFINE_SINGLETON is used only by core and makes use of nm-logging. It does not belong to "include/nm-macros-internal.h". Move it to "src/".
* core: fix session-monitor build with --with-session-tracking=noneDan Williams2015-02-051-0/+2
|
* core: declare nm_session_monitor_get() using NM_DEFINE_SINGLETON_GETTER()Thomas Haller2015-01-121-9/+2
|
* build: fix compilation with GLib 2.32Jiří Klimeš2015-01-061-0/+1
| | | | for g_clear_pointer()
* session: merge nm-session-monitor-* modulesPavel Šimerda2015-01-051-5/+333
| | | | | | | | | | | | | | Merged all session tracking modules into one source file and simplified it substantially. Now systemd-logind and ConsoleKit support can be built in at the same time and both are detected at runtime. This is useful on source based as well as binary distributions. Original patch written by Fabio Erculiani <lxnay@sabayon.org>, modified by Pavel Šimerda <psimerda@redhat.com> and Thomas Haller <thaller@redhat.com>. https://bugzilla.gnome.org/show_bug.cgi?id=686997 Acked-By: Thomas Haller <thaller@redhat.com>
* session: switch code to nm_session_monitor_{,dis}connect()Pavel Šimerda2015-01-051-0/+30
| | | | Acked-By: Thomas Haller <thaller@redhat.com>
* session: switch code to nm_session_monitor_session_exists()Pavel Šimerda2015-01-051-0/+22
| | | | Acked-By: Thomas Haller <thaller@redhat.com>
* session: merge nm-session-utils into nm-session-managerPavel Šimerda2015-01-051-0/+67
| | | | Acked-By: Thomas Haller <thaller@redhat.com>
* build: easier selection of session trackingDan Williams2012-02-011-537/+0
| | | | | Using --with-session-tracking=xxx you can select the backend you want from among CK, systemd, or none.
* core: combine common session management utility codeDan Williams2012-02-011-104/+5
| | | | And reformat the systemd session manager for NM code style.
* core: silence error if ConsoleKit database isn't found the first time (rh ↵Dan Williams2011-05-251-3/+13
| | | | | | #695617) Ignore the first error if the CK database isn't there yet.
* core: don't keep re-reading the ConsoleKit databaseDan Williams2011-04-141-2/+3
| | | | | Due to a stupid error the cache wasn't actually getting used and way more than one SessionMonitor was getting created.
* core: aggregate ConsoleKit sesson data (bgo #647454)Dan Williams2011-04-111-2/+25
| | | | | | | | | | | Jan Schmidt noticed that things didn't work as expected with multiple sessions of the same user, since when inserting the new session the old one was forgotten. Thus bad things happened if you were local in the old session but not in the new one since only the new one would be considered. Instead, make the actual data stored the aggregate of all sessions for that user.
* Revert "core: aggregate ConsoleKit sesson data (rh #647454)"Dan Williams2011-04-111-25/+2
| | | | | | | This reverts commit 328068c7fe405b6601d46fc011ed67e6de84e3d0. The bug tag in the commit message is wrong, it should be bgo and not rh.
* core: aggregate ConsoleKit sesson data (rh #647454)Dan Williams2011-04-111-2/+25
| | | | | | | | | | | Jan Schmidt noticed that things didn't work as expected with multiple sessions of the same user, since when inserting the new session the old one was forgotten. Thus bad things happened if you were local in the old session but not in the new one since only the new one would be considered. Instead, make the actual data stored the aggregate of all sessions for that user.
* trivial: fix some possible uninitialized variable usage in error casesDan Williams2011-01-251-1/+1
|
* logging: LOGD_SYS_SET -> LOGD_SETTINGSDan Williams2010-12-101-2/+2
|
* core: fix session monitor initializationDan Williams2010-10-271-13/+15
| | | | Braindead error handling on my part.
* settings: clean up connection visibility and session change handlingDan Williams2010-10-261-1/+1
|
* core: allow ConsoleKit usage to be disabledDan Williams2010-10-261-0/+72
|
* core: use new session monitor in system connection classDan Williams2010-10-261-0/+7
|