2011-05-24 01:55:06 +04:00
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
# ifndef foologindhfoo
# define foologindhfoo
/***
This file is part of systemd .
Copyright 2011 Lennart Poettering
systemd is free software ; you can redistribute it and / or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
systemd is distributed in the hope that it will be useful , but
WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
General Public License for more details .
You should have received a copy of the GNU General Public License
along with systemd ; If not , see < http : //www.gnu.org/licenses/>.
* * */
# include <stdbool.h>
# include <inttypes.h>
# include <dbus/dbus.h>
# include <libudev.h>
# include "util.h"
# include "list.h"
# include "hashmap.h"
# include "cgroup-util.h"
/* TODO:
*
* recreate VTs when disallocated
* spawn user systemd
2011-06-17 02:15:02 +04:00
* direct client API
2011-06-24 22:41:56 +04:00
* subscribe to fd HUP
2011-06-24 21:42:45 +04:00
* D - Bus method : AttachDevice ( seat , device ) ;
* D - Bus method : PermitLinger ( user , bool b ) ;
2011-05-24 06:20:35 +04:00
*
2011-05-24 01:55:06 +04:00
* non - local X11 server
* reboot / shutdown halt management
*/
typedef struct Manager Manager ;
2011-05-24 02:19:22 +04:00
# include "logind-device.h"
# include "logind-seat.h"
# include "logind-session.h"
# include "logind-user.h"
2011-05-24 01:55:06 +04:00
struct Manager {
DBusConnection * bus ;
Hashmap * devices ;
Hashmap * seats ;
Hashmap * sessions ;
Hashmap * users ;
2011-05-25 02:55:58 +04:00
LIST_HEAD ( Seat , seat_gc_queue ) ;
LIST_HEAD ( Session , session_gc_queue ) ;
LIST_HEAD ( User , user_gc_queue ) ;
2011-05-24 01:55:06 +04:00
struct udev * udev ;
struct udev_monitor * udev_monitor ;
int udev_fd ;
int console_active_fd ;
int bus_fd ;
int epoll_fd ;
2011-05-26 04:21:16 +04:00
unsigned n_autovts ;
2011-05-24 01:55:06 +04:00
Seat * vtconsole ;
char * cgroup_path ;
2011-06-24 20:50:50 +04:00
char * * controllers ;
2011-05-24 01:55:06 +04:00
2011-05-26 04:21:16 +04:00
char * * kill_only_users , * * kill_exclude_users ;
2011-05-24 01:55:06 +04:00
bool kill_user_processes ;
2011-06-24 20:50:50 +04:00
unsigned long session_counter ;
2011-06-24 22:41:56 +04:00
Hashmap * cgroups ;
2011-05-24 01:55:06 +04:00
} ;
Manager * manager_new ( void ) ;
void manager_free ( Manager * m ) ;
2011-05-25 02:55:58 +04:00
2011-05-24 01:55:06 +04:00
int manager_add_device ( Manager * m , const char * sysfs , Device * * _device ) ;
int manager_add_seat ( Manager * m , const char * id , Seat * * _seat ) ;
int manager_add_session ( Manager * m , User * u , const char * id , Session * * _session ) ;
int manager_add_user ( Manager * m , uid_t uid , gid_t gid , const char * name , User * * _user ) ;
int manager_add_user_by_name ( Manager * m , const char * name , User * * _user ) ;
int manager_add_user_by_uid ( Manager * m , uid_t uid , User * * _user ) ;
2011-05-25 02:55:58 +04:00
2011-05-24 01:55:06 +04:00
int manager_process_device ( Manager * m , struct udev_device * d ) ;
int manager_dispatch_udev ( Manager * m ) ;
int manager_dispatch_console ( Manager * m ) ;
2011-05-25 02:55:58 +04:00
2011-05-24 01:55:06 +04:00
int manager_enumerate_devices ( Manager * m ) ;
int manager_enumerate_seats ( Manager * m ) ;
int manager_enumerate_sessions ( Manager * m ) ;
int manager_enumerate_users ( Manager * m ) ;
2011-05-25 02:55:58 +04:00
2011-05-24 01:55:06 +04:00
int manager_startup ( Manager * m ) ;
int manager_run ( Manager * m ) ;
int manager_spawn_autovt ( Manager * m , int vtnr ) ;
2011-06-24 22:41:56 +04:00
void manager_cgroup_notify_empty ( Manager * m , const char * cgroup ) ;
2011-05-25 02:55:58 +04:00
void manager_gc ( Manager * m ) ;
2011-06-17 17:59:18 +04:00
int manager_get_idle_hint ( Manager * m , dual_timestamp * t ) ;
2011-05-24 01:55:06 +04:00
bool x11_display_is_local ( const char * display ) ;
2011-05-26 04:21:16 +04:00
extern const DBusObjectPathVTable bus_manager_vtable ;
2011-06-24 22:41:56 +04:00
DBusHandlerResult bus_message_filter ( DBusConnection * c , DBusMessage * message , void * userdata ) ;
2011-06-21 23:46:13 +04:00
int manager_send_changed ( Manager * manager , const char * properties ) ;
2011-05-24 01:55:06 +04:00
# endif