From 9541666b8d97f107335dd7e3cb93b4d2cfbf19c9 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Wed, 9 Apr 2014 21:22:48 +0200
Subject: [PATCH] login: add 'mir' to the list of session types

Add Mir to the list of session types. This is implemented for LightDM
in lp:~robert-ancell/lightdm/xdg-session-desktop [1].

[1] https://code.launchpad.net/~robert-ancell/lightdm/xdg-session-desktop/+merge/214108

(david: adjusted commit-header and fixed whitespace issues)
---
 man/pam_systemd.xml          |    5 +++--
 man/sd_session_is_active.xml |    6 +++---
 src/login/logind-session.c   |    1 +
 src/login/logind-session.h   |    1 +
 src/systemd/sd-login.h       |    2 +-
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git man/pam_systemd.xml man/pam_systemd.xml
index 3022cdb..f973899 100644
--- man/pam_systemd.xml
+++ man/pam_systemd.xml
@@ -145,8 +145,9 @@
                                 variable takes precedence. One of
                                 <literal>unspecified</literal>,
                                 <literal>tty</literal>,
-                                <literal>x11</literal> or
-                                <literal>wayland</literal>. See
+                                <literal>x11</literal>,
+                                <literal>wayland</literal> or
+                                <literal>mir</literal>. See
                                 <citerefentry><refentrytitle>sd_session_get_type</refentrytitle><manvolnum>3</manvolnum></citerefentry>
                                 for details about the session type.</para></listitem>
                         </varlistentry>
diff --git man/sd_session_is_active.xml man/sd_session_is_active.xml
index ddb2bee..31a6119 100644
--- man/sd_session_is_active.xml
+++ man/sd_session_is_active.xml
@@ -201,9 +201,9 @@
                 be used to determine the type of the session
                 identified by the specified session identifier. The
                 returned string is one of <literal>x11</literal>,
-                <literal>wayland</literal>, <literal>tty</literal> or
-                <literal>unspecified</literal> and needs to be freed
-                with the libc
+                <literal>wayland</literal>, <literal>tty</literal>,
+                <literal>mir</literal> or <literal>unspecified</literal> and
+                needs to be freed with the libc
                 <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
                 call after use.</para>
 
--- src/login/logind-session.c
+++ src/login/logind-session.c	2014-05-20 12:49:07.150236121 +0000
@@ -1124,6 +1124,7 @@ static const char* const session_type_ta
         [SESSION_TTY] = "tty",
         [SESSION_X11] = "x11",
         [SESSION_WAYLAND] = "wayland",
+        [SESSION_MIR] = "mir",
         [SESSION_UNSPECIFIED] = "unspecified",
 };
 
diff --git src/login/logind-session.h src/login/logind-session.h
index c9af5eb..7ecc9f0 100644
--- src/login/logind-session.h
+++ src/login/logind-session.h
@@ -55,6 +55,7 @@ typedef enum SessionType {
         SESSION_TTY,
         SESSION_X11,
         SESSION_WAYLAND,
+        SESSION_MIR,
         _SESSION_TYPE_MAX,
         _SESSION_TYPE_INVALID = -1
 } SessionType;
diff --git src/systemd/sd-login.h src/systemd/sd-login.h
index a4ca231..776733a 100644
--- src/systemd/sd-login.h
+++ src/systemd/sd-login.h
@@ -138,7 +138,7 @@ int sd_session_get_seat(const char *session, char **seat);
 /* Determine the (PAM) service name this session was registered by. */
 int sd_session_get_service(const char *session, char **service);
 
-/* Determine the type of this session, i.e. one of "tty", "x11" or "unspecified". */
+/* Determine the type of this session, i.e. one of "tty", "x11", "wayland", "mir" or "unspecified". */
 int sd_session_get_type(const char *session, char **type);
 
 /* Determine the class of this session, i.e. one of "user", "greeter" or "lock-screen". */
-- 
1.7.9.2

