118c2aff7Sartem /***************************************************************************
218c2aff7Sartem  *
318c2aff7Sartem  * sysevent.c : Solaris sysevents
418c2aff7Sartem  *
5112cd14aSqz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
618c2aff7Sartem  * Use is subject to license terms.
718c2aff7Sartem  *
818c2aff7Sartem  * Licensed under the Academic Free License version 2.1
918c2aff7Sartem  *
1018c2aff7Sartem  **************************************************************************/
1118c2aff7Sartem 
1200687e57Sartem #ifdef HAVE_CONFIG_H
13a9da3307Snp #include <config.h>
1400687e57Sartem #endif
1500687e57Sartem 
1618c2aff7Sartem #include <stdio.h>
1718c2aff7Sartem #include <unistd.h>
1818c2aff7Sartem #include <stdlib.h>
1918c2aff7Sartem #include <string.h>
2018c2aff7Sartem #include <errno.h>
2118c2aff7Sartem #include <fcntl.h>
2218c2aff7Sartem #include <sys/dkio.h>
2318c2aff7Sartem #include <sys/stat.h>
2418c2aff7Sartem #include <libdevinfo.h>
2518c2aff7Sartem #include <libsysevent.h>
2618c2aff7Sartem #include <sys/sysevent/dev.h>
27d2ec54f7Sphitran #include <sys/sysevent/pwrctl.h>
28a9da3307Snp #include <sys/sysevent/dr.h>
2918c2aff7Sartem #include <glib.h>
30a9da3307Snp #include <config_admin.h>
31a9da3307Snp #include <kstat.h>
3218c2aff7Sartem 
3318c2aff7Sartem #include "../osspec.h"
3418c2aff7Sartem #include "../logger.h"
3518c2aff7Sartem #include "../hald.h"
3618c2aff7Sartem #include "../hald_dbus.h"
3718c2aff7Sartem #include "../device_info.h"
3818c2aff7Sartem #include "../util.h"
3918c2aff7Sartem #include "osspec_solaris.h"
4018c2aff7Sartem #include "hotplug.h"
4118c2aff7Sartem #include "devinfo.h"
4218c2aff7Sartem #include "devinfo_storage.h"
437b840e52Sphitran #include "devinfo_acpi.h"
44112cd14aSqz #include "devinfo_usb.h"
4518c2aff7Sartem #include "sysevent.h"
46a9da3307Snp #include "devinfo_misc.h"
47a9da3307Snp #include "devinfo_cpu.h"
4818c2aff7Sartem 
4918c2aff7Sartem #ifndef ESC_LOFI
50112cd14aSqz #define	ESC_LOFI "lofi"
5118c2aff7Sartem #endif
5218c2aff7Sartem 
5318c2aff7Sartem static void	sysevent_dev_handler(sysevent_t *);
5418c2aff7Sartem static gboolean sysevent_iochannel_data(GIOChannel *, GIOCondition, gpointer);
5518c2aff7Sartem static void	sysevent_dev_add(gchar *, gchar *);
5618c2aff7Sartem static void	sysevent_dev_remove(gchar *, gchar *);
5718c2aff7Sartem static void	sysevent_dev_branch(gchar *);
5818c2aff7Sartem static void	sysevent_lofi_add(gchar *, gchar *);
5918c2aff7Sartem static void	sysevent_lofi_remove(gchar *, gchar *);
60112cd14aSqz static void	sysevent_devfs_add(gchar *);
61d2ec54f7Sphitran static void	sysevent_pwrctl(gchar *, gchar *, gchar *, gchar *, gchar *,
62d2ec54f7Sphitran 		    gchar *, uint_t);
63a9da3307Snp static void	sysevent_process_dr(gchar *, gchar *);
64