By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1902
Collapse All | Expand All

(-)tdebase-orig/cmake/modules/FindSystemd.cmake (+39 lines)
Line 0 Link Here
1
# Finds systemd and its libraries
2
# Not a huge module but sufficient for now
3
# Uses the same semantics as pkg_check_modules, i.e. ${LIB}{_FOUND,_INCLUDE_DIR,_LIBRARIES}
4
# where ${LIB} can be one of the following:
5
#     LIBSYSTEMD_JOURNAL, SYSTEMD, LIBSYSTEMD_DAEMON, LIBSYSTEMD_LOGIN, LIBSYSTEMD_ID128
6
#
7
# Copyright: Red Hat, Inc. 2013
8
# Author: Martin Briza <mbriza@redhat.com>
9
#
10
# Distributed under the BSD license. See COPYING-CMAKE-SCRIPTS for details.
11
12
#defining any of these disables systemd support
13
if (NOT LIBSYSTEMD_JOURNAL_FOUND AND
14
    NOT SYSTEMD_FOUND AND
15
    NOT LIBSYSTEMD_DAEMON_FOUND AND
16
    NOT LIBSYSTEMD_LOGIN_FOUND AND
17
    NOT LIBSYSTEMD_ID128_FOUND)
18
find_package(PkgConfig)
19
if (PKG_CONFIG_FOUND)
20
    pkg_check_modules(LIBSYSTEMD_JOURNAL QUIET "libsystemd-journal")
21
    pkg_check_modules(SYSTEMD QUIET "systemd")
22
    pkg_check_modules(LIBSYSTEMD_DAEMON QUIET "libsystemd-daemon")
23
    pkg_check_modules(LIBSYSTEMD_LOGIN QUIET "libsystemd-login")
24
    pkg_check_modules(LIBSYSTEMD_ID128 QUIET "libsystemd-id128")
25
endif (PKG_CONFIG_FOUND)
26
27
if (SYSTEMD_FOUND)
28
    message(STATUS "Found systemd")
29
endif(SYSTEMD_FOUND)
30
31
mark_as_advanced(LIBSYSTEMD_JOURNAL_FOUND       SYSTEMD_FOUND       LIBSYSTEMD_DAEMON_FOUND       LIBSYSTEMD_LOGIN_FOUND       LIBSYSTEMD_ID128_FOUND)
32
mark_as_advanced(LIBSYSTEMD_JOURNAL_INCLUDE_DIR SYSTEMD_INCLUDE_DIR LIBSYSTEMD_DAEMON_INCLUDE_DIR LIBSYSTEMD_LOGIN_INCLUDE_DIR LIBSYSTEMD_ID128_INCLUDE_DIR)
33
mark_as_advanced(LIBSYSTEMD_JOURNAL_LIBRARIES   SYSTEMD_LIBRARIES   LIBSYSTEMD_DAEMON_LIBRARIES   LIBSYSTEMD_LOGIN_LIBRARIES   LIBSYSTEMD_ID128_LIBRARIES)
34
35
endif (NOT LIBSYSTEMD_JOURNAL_FOUND AND
36
       NOT SYSTEMD_FOUND AND
37
       NOT LIBSYSTEMD_DAEMON_FOUND AND
38
       NOT LIBSYSTEMD_LOGIN_FOUND AND
39
       NOT LIBSYSTEMD_ID128_FOUND)
(-)tdebase-orig/CMakeLists.txt (+14 lines)
Lines 298-303 Link Here
298
  set( KICKOFF_DIST_CONFIG_SHORTCUT2 "/usr/share/applications/rpmdrake.desktop" )
298
  set( KICKOFF_DIST_CONFIG_SHORTCUT2 "/usr/share/applications/rpmdrake.desktop" )
299
endif()
299
endif()
300
300
301
##### check if systemd is installed #############
302
find_package(Systemd)
303
if(SYSTEMD_FOUND)
304
  add_definitions(-DWITH_SYSTEMD)
305
  message( STATUS "*****  Systemd preprocessor flag WITH_SYSTEMD set  *****" )
306
else()
307
  message( STATUS "*****  Systemd preprocessor flag WITH_SYSTEMD -- NOT set  *****" )
308
endif()
309
# set_package_properties(Systemd PROPERTIES DESCRIPTION "Init and service manager for Linux"
310
#   URL "http://www.freedesktop.org/wiki/Software/systemd"
311
#   TYPE OPTIONAL
312
#   PURPOSE "Provides automatic multi-seat, session and power management features"
313
#   )
314
301
##### write configure files #####################
315
##### write configure files #####################
302
316
303
configure_file( config.h.cmake config.h @ONLY )
317
configure_file( config.h.cmake config.h @ONLY )
(-)tdebase-orig/ConfigureChecks.cmake (-1 lines)
Lines 279-285 Link Here
279
279
280
endif( )
280
endif( )
281
281
282
283
# dbus-tqt (ksmserver, kicker, tdeioslaves(media))
282
# dbus-tqt (ksmserver, kicker, tdeioslaves(media))
284
if( WITH_HAL AND (BUILD_KSMSERVER OR BUILD_KICKER OR BUILD_TDEIOSLAVES) )
283
if( WITH_HAL AND (BUILD_KSMSERVER OR BUILD_KICKER OR BUILD_TDEIOSLAVES) )
285
284
(-)tdebase-orig/tdm/backend/client.c (+8 lines)
Lines 1313-1318 Link Here
1313
#endif
1313
#endif
1314
	userEnviron = inheritEnv( env, envvars );
1314
	userEnviron = inheritEnv( env, envvars );
1315
	env = systemEnv( p->pw_name );
1315
	env = systemEnv( p->pw_name );
1316
#ifdef WITH_SYSTEMD
1317
	if (td->systemdSeat) {
1318
	    char *envbuf;
1319
	    ASPrintf(&envbuf, "XDG_SEAT=%s", td->systemdSeat);
1320
	    pam_putenv(pamh, envbuf);
1321
	    env = setEnv(env, "XDG_SEAT", td->systemdSeat);
1322
	}
1323
#endif
1316
	systemEnviron = setEnv( env, "HOME", p->pw_dir );
1324
	systemEnviron = setEnv( env, "HOME", p->pw_dir );
1317
	Debug( "user environment:\n%[|''>'\n's"
1325
	Debug( "user environment:\n%[|''>'\n's"
1318
	       "system environment:\n%[|''>'\n's"
1326
	       "system environment:\n%[|''>'\n's"
(-)tdebase-orig/tdm/backend/CMakeLists.txt (+7 lines)
Lines 11-20 Link Here
11
11
12
# FIXME this is far from complete!!!
12
# FIXME this is far from complete!!!
13
13
14
## systemd libraries
15
if(LIBSYSTEMD_LOGIN_FOUND AND LIBSYSTEMD_DAEMON_FOUND)
16
    add_definitions( -DWITH_SYSTEMD=1 )
17
    set(TDM_SYSTEMD_LIBRARIES ${LIBSYSTEMD_DAEMON_LIBRARIES} ${LIBSYSTEMD_LOGIN_LIBRARIES} )
18
endif(LIBSYSTEMD_LOGIN_FOUND AND LIBSYSTEMD_DAEMON_FOUND)
19
14
include_directories(
20
include_directories(
15
  ${CMAKE_CURRENT_BINARY_DIR}
21
  ${CMAKE_CURRENT_BINARY_DIR}
16
  ${CMAKE_BINARY_DIR}
22
  ${CMAKE_BINARY_DIR}
17
  ${DBUS_INCLUDE_DIRS}
23
  ${DBUS_INCLUDE_DIRS}
24
  ${TDM_SYSTEMD_LIBRARIES}
18
)
25
)
19
26
20
link_directories(
27
link_directories(
(-)tdebase-orig/tdm/backend/dm.c (+178 lines)
Lines 51-56 Link Here
51
# include <sys/vt.h>
51
# include <sys/vt.h>
52
#endif
52
#endif
53
53
54
#ifdef WITH_SYSTEMD
55
# include <systemd/sd-login.h>
56
# include <systemd/sd-daemon.h>
57
58
#define SYSTEMD_FAILURE_LIMIT 25
59
60
static int systemdMonitorInit(void);
61
static void systemdMonitorDeinit();
62
static int systemdStartDisplay(char *);
63
static void systemdCheckAdded(char **);
64
static void systemdCheckRemoved(char **);
65
static void systemdHandleChange();
66
67
sd_login_monitor *systemdMonitor = NULL;
68
int systemdMonitorFd = -1;
69
#endif
70
54
static void SigHandler( int n );
71
static void SigHandler( int n );
55
static int ScanConfigs( int force );
72
static int ScanConfigs( int force );
56
static void StartDisplays( void );
73
static void StartDisplays( void );
Lines 277-284 Link Here
277
#ifdef XDMCP
294
#ifdef XDMCP
278
	UpdateListenSockets();
295
	UpdateListenSockets();
279
#endif
296
#endif
297
298
#ifdef WITH_SYSTEMD
299
	if (systemdMonitorInit())
300
	    systemdHandleChange();
301
#endif
302
280
	openCtrl( 0 );
303
	openCtrl( 0 );
281
	MainLoop();
304
	MainLoop();
305
#ifdef WITH_SYSTEMD
306
	systemdMonitorDeinit();
307
#endif
282
	closeCtrl( 0 );
308
	closeCtrl( 0 );
283
	if (sdRec.how) {
309
	if (sdRec.how) {
284
		commitBootOption();
310
		commitBootOption();
Lines 1189-1194 Link Here
1189
				}
1215
				}
1190
				continue;
1216
				continue;
1191
			}
1217
			}
1218
#ifdef WITH_SYSTEMD
1219
			if (systemdMonitorFd >= 0 && FD_ISSET(systemdMonitorFd, &reads)) {
1220
			    systemdHandleChange();
1221
			    sd_login_monitor_flush(systemdMonitor);
1222
			    continue;
1223
			}
1224
#endif
1192
#ifdef XDMCP
1225
#ifdef XDMCP
1193
			if (ProcessListenSockets( &reads ))
1226
			if (ProcessListenSockets( &reads ))
1194
				continue;
1227
				continue;
Lines 1213-1218 Link Here
1213
	}
1246
	}
1214
}
1247
}
1215
1248
1249
#ifdef WITH_SYSTEMD
1250
static int
1251
systemdMonitorInit(void)
1252
{
1253
    if (sd_booted() <= 0) {
1254
        logError("Didn't boot with systemd, automatic multiseat won't be enabled\n");
1255
        return False;
1256
    }
1257
1258
    int check = sd_login_monitor_new("seat", &systemdMonitor);
1259
    if (check < 0) {
1260
        logError("Can't get systemd monitor: %d, automatic multiseat won't be enabled\n", check);
1261
        return False;
1262
    }
1263
1264
    systemdMonitorFd = sd_login_monitor_get_fd(systemdMonitor);
1265
    if (systemdMonitorFd < 0) {
1266
        logError("Can't retrieve file descriptor from the systemd monitor: %d, automatic multiseat won't be enabled\n", systemdMonitorFd);
1267
        sd_login_monitor_unref(systemdMonitor);
1268
        systemdMonitorFd = -1;
1269
        return False;
1270
    }
1271
1272
    registerInput(systemdMonitorFd);
1273
    return True;
1274
}
1275
1276
static void
1277
systemdMonitorDeinit(void)
1278
{
1279
    if (systemdMonitor) {
1280
        sd_login_monitor_unref(systemdMonitor);
1281
    }
1282
    systemdMonitorFd = -1;
1283
}
1284
1285
static int
1286
systemdStartDisplay(char *seat)
1287
{
1288
    struct display *link = NULL;
1289
    for (link = displays; link; link = link-> next) {
1290
        if (link->status == reserve)
1291
            break;
1292
    }
1293
    if (!link) {
1294
        logError("There's not enough reserve displays for all your seats/sessions");
1295
        return False;
1296
    }
1297
    if (!strDup((&link->systemdSeat), seat)) {
1298
        return False;
1299
    }
1300
#ifdef HAVE_VTS
1301
    link->serverVT = 0;
1302
#endif
1303
    link->status = notRunning;
1304
    link->stillThere = True;
1305
    link->authorize = True;
1306
    link->displayType = dLocal | dPermanent;
1307
    link->reqSrvVT = -1;
1308
    link->serverPid = -1;
1309
    return True;
1310
}
1311
1312
static void
1313
systemdCheckAdded(char **seat_names)
1314
{
1315
    char **iter_name;
1316
    struct display *link;
1317
    for (iter_name = seat_names; *iter_name; iter_name++) {
1318
        if (strcmp(*iter_name, "seat0") == 0)
1319
            continue; /* ignore the main seat */
1320
        int can_graphical = sd_seat_can_graphical(*iter_name);
1321
        for (link = displays; link; link = link->next) {
1322
            if (!link->systemdSeat)
1323
                continue;
1324
            /* see if the can_graphical property didn't change */
1325
            if (0 == strcmp(*iter_name, link->systemdSeat)) {
1326
                if (!can_graphical) {
1327
                    free(link->systemdSeat);
1328
                    link->systemdSeat = NULL;
1329
                    rStopDisplay(link, DS_RESERVE);
1330
                }
1331
                break;
1332
            }
1333
        }
1334
        /* the display wasn't found */
1335
        if (!link) {
1336
            if (can_graphical) {
1337
                /* if starting the display failed, skip this round until the next change */
1338
                if (!systemdStartDisplay(*iter_name))
1339
                    break;
1340
            }
1341
        }
1342
    }
1343
}
1344
1345
static void
1346
systemdCheckRemoved(char **seat_names)
1347
{
1348
    char **iter_name;
1349
    struct display *link;
1350
    for (link = displays; link; link = link->next) {
1351
        for (iter_name = seat_names; *iter_name; iter_name++) {
1352
            if (strcmp(*iter_name, "seat0") == 0)
1353
                continue; /* ignore the main seat */
1354
            if (link->systemdSeat && strcmp(*iter_name, link->systemdSeat) == 0)
1355
                break;
1356
        }
1357
        if (!(*iter_name) && link->systemdSeat) { /* was not found, stop this one */
1358
            free(link->systemdSeat);
1359
            link->systemdSeat = NULL;
1360
            rStopDisplay(link, DS_RESERVE);
1361
        }
1362
    }
1363
}
1364
1365
static void
1366
systemdHandleChange(void)
1367
{
1368
    static int failures = 0;
1369
    char **seat_names;
1370
    char **iter_name;
1371
    int check;
1372
    if ((check = sd_get_seats(&seat_names)) < 0) {
1373
        logError("Can't obtain systemd seats, error %d\n", -check);
1374
        failures++;
1375
        if (failures >= SYSTEMD_FAILURE_LIMIT) {
1376
            logError("%u failed calls to sd_get_seats, disabling systemd multi-seat support\n", SYSTEMD_FAILURE_LIMIT);
1377
            systemdMonitorDeinit();
1378
        }
1379
        return;
1380
    }
1381
1382
    if (!check)
1383
        return;
1384
1385
    systemdCheckAdded(seat_names);
1386
    systemdCheckRemoved(seat_names);
1387
1388
    for (iter_name = seat_names; *iter_name; iter_name++)
1389
        free(*iter_name);
1390
    free(seat_names);
1391
}
1392
#endif
1393
1216
static void
1394
static void
1217
CheckDisplayStatus( struct display *d )
1395
CheckDisplayStatus( struct display *d )
1218
{
1396
{
(-)tdebase-orig/tdm/backend/dm.h (+3 lines)
Lines 283-288 Link Here
283
	Xauth **authorizations;     /* authorization data */
283
	Xauth **authorizations;     /* authorization data */
284
	int authNum;                /* number of authorizations */
284
	int authNum;                /* number of authorizations */
285
	char *authFile;             /* file to store authorization in */
285
	char *authFile;             /* file to store authorization in */
286
#ifdef WITH_SYSTEMD
287
	char *systemdSeat;
288
#endif
286
};
289
};
287
290
288
typedef struct {
291
typedef struct {
(-)tdebase-orig/tdm/backend/server.c (+19 lines)
Lines 66-71 Link Here
66
	                        sprintf( vtstr, "vt%d", d->serverVT ) )))
66
	                        sprintf( vtstr, "vt%d", d->serverVT ) )))
67
		exit( 47 );
67
		exit( 47 );
68
#endif
68
#endif
69
#ifdef WITH_SYSTEMD
70
	if (d->systemdSeat) {
71
	    if (!(argv = parseArgs(argv, "-seat")))
72
		exit(47);
73
	    if (!(argv = parseArgs(argv, d->systemdSeat)))
74
		exit(47);
75
	    if (!(argv = parseArgs(argv, "-layout")))
76
		exit(47);
77
	    if (!(argv = parseArgs(argv, d->systemdSeat)))
78
		exit(47);
79
	}
80
	else {
81
	    if (!(argv = parseArgs(argv, "-seat")))
82
		exit(47);
83
	    if (!(argv = parseArgs(argv, "seat0")))
84
		exit(47);
85
	}
86
#endif
87
69
	return argv;
88
	return argv;
70
}
89
}
71
90
(-)tdebase-orig/tdm/backend/session.c (+4 lines)
Lines 438-443 Link Here
438
438
439
	grttalk.pipe = &grtproc.pipe;
439
	grttalk.pipe = &grtproc.pipe;
440
	env = systemEnv( (char *)0 );
440
	env = systemEnv( (char *)0 );
441
#ifdef WITH_SYSTEMD
442
	if (td->systemdSeat)
443
	    env = setEnv(env, "XDG_SEAT", td->systemdSeat);
444
#endif
441
	if (GOpen( &grtproc, (char **)0, "_greet", env, name, &td->gpipe ))
445
	if (GOpen( &grtproc, (char **)0, "_greet", env, name, &td->gpipe ))
442
		SessionExit( EX_UNMANAGE_DPY );
446
		SessionExit( EX_UNMANAGE_DPY );
443
	freeStrArr( env );
447
	freeStrArr( env );

Return to bug 1902