Update to consolekit2-1.2.2.
This commit is contained in:
parent
b28ae0646e
commit
3c319a2616
@ -1,11 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.81 2020/12/04 15:00:39 robert Exp $
|
||||
# $OpenBSD: Makefile,v 1.82 2020/12/20 09:20:22 ajacoutot Exp $
|
||||
|
||||
COMMENT= framework for defining and tracking users, sessions & seats
|
||||
|
||||
PKGNAME= ${DISTNAME:L}
|
||||
REVISION= 14
|
||||
|
||||
GH_TAGNAME= 1.2.1
|
||||
GH_TAGNAME= 1.2.2
|
||||
GH_ACCOUNT= ConsoleKit2
|
||||
GH_PROJECT= ConsoleKit2
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (ConsoleKit2-1.2.1.tar.gz) = O4AzmzAbPqV5G8WAl5YPbOYkVzAVL2+GCdUzOb0TDw8=
|
||||
SIZE (ConsoleKit2-1.2.1.tar.gz) = 254523
|
||||
SHA256 (ConsoleKit2-1.2.2.tar.gz) = EE/Z9BwtVyrWL0Ay3kbEw4TDUiYCsK2VPPVXWcbGTB0=
|
||||
SIZE (ConsoleKit2-1.2.2.tar.gz) = 254783
|
||||
|
@ -1,61 +0,0 @@
|
||||
$OpenBSD: patch-src_ck-inhibit-manager_c,v 1.4 2020/12/04 16:01:00 ajacoutot Exp $
|
||||
|
||||
From 5d9925bae370cc1edc260909a55b44f6550294f1 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Nagy <robert@openbsd.org>
|
||||
Date: Sun, 29 Nov 2020 12:15:20 +0100
|
||||
Subject: [PATCH] change the inhibitor lock handling to use the named_pipe_path as a reference
|
||||
|
||||
From e8960c0fb789e1ddefe5b4cbfcde4861f7fa3169 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Nagy <robert@openbsd.org>
|
||||
Date: Fri, 4 Dec 2020 15:21:14 +0100
|
||||
Subject: [PATCH] only disconnect the signal handler after the lock is removed
|
||||
|
||||
Index: src/ck-inhibit-manager.c
|
||||
--- src/ck-inhibit-manager.c.orig
|
||||
+++ src/ck-inhibit-manager.c
|
||||
@@ -152,7 +152,7 @@ cb_changed_event (CkInhibit *inhibit,
|
||||
|
||||
/* When an inhibitor loses it lockes, remove the inhibitor from
|
||||
* the list */
|
||||
- ck_inhibit_manager_remove_lock (manager, ck_inhibit_get_who (inhibit));
|
||||
+ ck_inhibit_manager_remove_lock (manager, ck_inhibit_get_named_pipe_path (inhibit));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,8 +235,7 @@ ck_inhibit_manager_create_lock (CkInhibitManager *mana
|
||||
/**
|
||||
* ck_inhibit_manager_remove_lock:
|
||||
* @manager: The @CkInhibitManager object
|
||||
- * @who: A human-readable, descriptive string of who has taken
|
||||
- * the lock. Example: "Xfburn"
|
||||
+ * @named_pipe_path: The unique named pipe path to lock on.
|
||||
*
|
||||
* Finds the inhibit lock @who and removes it.
|
||||
*
|
||||
@@ -244,7 +243,7 @@ ck_inhibit_manager_create_lock (CkInhibitManager *mana
|
||||
**/
|
||||
gboolean
|
||||
ck_inhibit_manager_remove_lock (CkInhibitManager *manager,
|
||||
- const gchar *who)
|
||||
+ const gchar *named_pipe_path)
|
||||
{
|
||||
CkInhibitManagerPrivate *priv;
|
||||
GList *l;
|
||||
@@ -256,15 +255,15 @@ ck_inhibit_manager_remove_lock (CkInhibitManager *mana
|
||||
priv = CK_INHIBIT_MANAGER_GET_PRIVATE (manager);
|
||||
|
||||
for (l = g_list_first (priv->inhibit_list); l != NULL; l = l->next) {
|
||||
- if (l->data && g_strcmp0 (ck_inhibit_get_who (l->data), who) == 0) {
|
||||
+ if (l->data && g_strcmp0 (ck_inhibit_get_named_pipe_path (l->data), named_pipe_path) == 0) {
|
||||
CkInhibit *inhibit = l->data;
|
||||
|
||||
/* Found it! Remove it from the list and unref the object */
|
||||
priv->inhibit_list = g_list_remove (priv->inhibit_list, inhibit);
|
||||
+ ck_inhibit_remove_lock (inhibit);
|
||||
g_signal_handlers_disconnect_by_func (inhibit,
|
||||
G_CALLBACK (cb_changed_event),
|
||||
manager);
|
||||
- ck_inhibit_remove_lock (inhibit);
|
||||
g_object_unref (inhibit);
|
||||
return TRUE;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
$OpenBSD: patch-src_ck-inhibit-manager_h,v 1.2 2020/11/29 11:33:30 ajacoutot Exp $
|
||||
|
||||
From 5d9925bae370cc1edc260909a55b44f6550294f1 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Nagy <robert@openbsd.org>
|
||||
Date: Sun, 29 Nov 2020 12:15:20 +0100
|
||||
Subject: [PATCH] change the inhibitor lock handling to use the named_pipe_path as a reference
|
||||
|
||||
Index: src/ck-inhibit-manager.h
|
||||
--- src/ck-inhibit-manager.h.orig
|
||||
+++ src/ck-inhibit-manager.h
|
||||
@@ -63,7 +63,7 @@ gint ck_inhibit_manager_create_lock
|
||||
pid_t pid);
|
||||
|
||||
gboolean ck_inhibit_manager_remove_lock (CkInhibitManager *manager,
|
||||
- const gchar *who);
|
||||
+ const gchar *named_pipe_path);
|
||||
|
||||
gboolean ck_inhibit_manager_is_shutdown_delayed (CkInhibitManager *manager);
|
||||
gboolean ck_inhibit_manager_is_suspend_delayed (CkInhibitManager *manager);
|
@ -1,32 +0,0 @@
|
||||
$OpenBSD: patch-src_ck-inhibit_c,v 1.3 2020/11/29 11:33:30 ajacoutot Exp $
|
||||
|
||||
From 5d9925bae370cc1edc260909a55b44f6550294f1 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Nagy <robert@openbsd.org>
|
||||
Date: Sun, 29 Nov 2020 12:15:20 +0100
|
||||
Subject: [PATCH] change the inhibitor lock handling to use the named_pipe_path as a reference
|
||||
|
||||
Index: src/ck-inhibit.c
|
||||
--- src/ck-inhibit.c.orig
|
||||
+++ src/ck-inhibit.c
|
||||
@@ -750,6 +750,21 @@ ck_inhibit_get_mode (CkInhibit *inhibit)
|
||||
}
|
||||
|
||||
/**
|
||||
+ * ck_inhibit_get_named_pipe:
|
||||
+ * @inhibit: The @CkInhibit object
|
||||
+ *
|
||||
+ * Return value: the inhibit mode, either "delay" or "block" (or NULL on failure).
|
||||
+ **/
|
||||
+const gchar*
|
||||
+ck_inhibit_get_named_pipe_path (CkInhibit *inhibit)
|
||||
+{
|
||||
+ g_return_val_if_fail (CK_IS_INHIBIT (inhibit), NULL);
|
||||
+
|
||||
+ return inhibit->priv->named_pipe_path;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/**
|
||||
* ck_inhibit_get_uid:
|
||||
* @inhibit: The @CkInhibit object
|
||||
*
|
@ -1,18 +0,0 @@
|
||||
$OpenBSD: patch-src_ck-inhibit_h,v 1.2 2020/11/29 11:33:30 ajacoutot Exp $
|
||||
|
||||
From 5d9925bae370cc1edc260909a55b44f6550294f1 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Nagy <robert@openbsd.org>
|
||||
Date: Sun, 29 Nov 2020 12:15:20 +0100
|
||||
Subject: [PATCH] change the inhibitor lock handling to use the named_pipe_path as a reference
|
||||
|
||||
Index: src/ck-inhibit.h
|
||||
--- src/ck-inhibit.h.orig
|
||||
+++ src/ck-inhibit.h
|
||||
@@ -101,6 +101,7 @@ const gchar *ck_inhibit_get_what
|
||||
const gchar *ck_inhibit_get_who (CkInhibit *inhibit);
|
||||
const gchar *ck_inhibit_get_why (CkInhibit *inhibit);
|
||||
const gchar *ck_inhibit_get_mode (CkInhibit *inhibit);
|
||||
+const gchar *ck_inhibit_get_named_pipe_path (CkInhibit *inhibit);
|
||||
CkInhibitMode ck_inhibit_get_inhibit_mode (CkInhibit *inhibit);
|
||||
uid_t ck_inhibit_get_uid (CkInhibit *inhibit);
|
||||
pid_t ck_inhibit_get_pid (CkInhibit *inhibit);
|
@ -1,160 +0,0 @@
|
||||
$OpenBSD: patch-src_ck-sysdeps-openbsd_c,v 1.29 2020/11/29 11:33:30 ajacoutot Exp $
|
||||
|
||||
From c9b3329afcbc7961cb95bf6ab093eff1065f6283 Mon Sep 17 00:00:00 2001
|
||||
From: Antoine Jacoutot <ajacoutot@openbsd.org>
|
||||
Date: Sun, 22 Nov 2020 11:02:18 +0100
|
||||
Subject: [PATCH 3/3] OpenBSD: merge enhancements from ports
|
||||
|
||||
Index: src/ck-sysdeps-openbsd.c
|
||||
--- src/ck-sysdeps-openbsd.c.orig
|
||||
+++ src/ck-sysdeps-openbsd.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
-#include <sys/user.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
@@ -102,7 +101,6 @@ struct _CkProcessStat
|
||||
int exit_signal; /* stat might not be SIGCHLD */
|
||||
int processor; /* stat current (or most recent?) CPU */
|
||||
uintptr_t penv; /* stat address of initial environment vector */
|
||||
- char tty_text[11]; /* stat device name */
|
||||
|
||||
};
|
||||
|
||||
@@ -127,7 +125,11 @@ ck_process_stat_get_tty (CkProcessStat *stat)
|
||||
{
|
||||
g_return_val_if_fail (stat != NULL, NULL);
|
||||
|
||||
- return g_strdup (stat->tty_text);
|
||||
+ if (stat->tty == NODEV){
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return g_strdup_printf ("/dev/%s", devname (stat->tty, S_IFCHR));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -186,27 +188,8 @@ stat2proc (pid_t pid,
|
||||
P->flags = p.p_psflags;
|
||||
P->tpgid = p.p_tpgid;
|
||||
P->processor = p.p_cpuid;
|
||||
+ P->tty = p.p_tdev;
|
||||
|
||||
- /* we like it Linux-encoded :-) */
|
||||
- tty_maj = major (p.p_tdev);
|
||||
- tty_min = minor (p.p_tdev);
|
||||
- P->tty = DEV_ENCODE (tty_maj,tty_min);
|
||||
-
|
||||
- snprintf (P->tty_text, sizeof P->tty_text, "%3d,%-3d", tty_maj, tty_min);
|
||||
-
|
||||
- if (p.p_tdev != NODEV && (ttname = devname (p.p_tdev, S_IFCHR)) != NULL) {
|
||||
- memcpy (P->tty_text, ttname, sizeof (P->tty_text));
|
||||
- }
|
||||
-
|
||||
- if (p.p_tdev == NODEV) {
|
||||
- /* XXX how do we associate X with its tty? */
|
||||
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
|
||||
- memcpy (P->tty_text, "/dev/ttyC4", sizeof (P->tty_text));
|
||||
-#else
|
||||
- memcpy (P->tty_text, "/dev/ttyC0", sizeof (P->tty_text));
|
||||
-#endif
|
||||
- }
|
||||
-
|
||||
if (P->pid != pid) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -369,19 +352,23 @@ ck_get_max_num_consoles (guint *num)
|
||||
max_consoles++;
|
||||
}
|
||||
|
||||
- /* Increment one more so that all consoles are properly counted
|
||||
- * this is arguable a bug in vt_add_watches().
|
||||
- */
|
||||
- max_consoles++;
|
||||
-
|
||||
ret = TRUE;
|
||||
|
||||
endttyent ();
|
||||
|
||||
+ /*
|
||||
+ * Increment 2 more:
|
||||
+ * - ttyC4 is marked as off (X11)
|
||||
+ * - vt_add_watches() for loop misses the last console
|
||||
+ * ("< max_consoles"; instead of "<=")
|
||||
+ */
|
||||
+ max_consoles++;
|
||||
+ max_consoles++;
|
||||
+
|
||||
done:
|
||||
- if (num != NULL) {
|
||||
+ if (num != NULL) {
|
||||
*num = max_consoles;
|
||||
- }
|
||||
+ }
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -397,8 +384,7 @@ ck_get_console_device_for_num (guint num)
|
||||
{
|
||||
char *device;
|
||||
|
||||
-/* VT are only available on i386, amd64 and macppc */
|
||||
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
|
||||
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__)
|
||||
/* The device number is always one less than the VT number. */
|
||||
num--;
|
||||
#endif
|
||||
@@ -423,8 +409,7 @@ ck_get_console_num_from_device (const char *device,
|
||||
}
|
||||
|
||||
if (sscanf (device, "/dev/ttyC%u", &n) == 1) {
|
||||
-/* VT are only available on i386, amd64 and macppc */
|
||||
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
|
||||
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__)
|
||||
/* The VT number is always one more than the device number. */
|
||||
n++;
|
||||
#endif
|
||||
@@ -451,8 +436,7 @@ ck_get_active_console_num (int console_fd,
|
||||
active = 0;
|
||||
ret = FALSE;
|
||||
|
||||
-/* VT are only available on i386, amd64 and macppc */
|
||||
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__)
|
||||
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__)
|
||||
res = ioctl (console_fd, VT_GETACTIVE, &active);
|
||||
if (res == ERROR) {
|
||||
perror ("ioctl VT_GETACTIVE");
|
||||
@@ -477,13 +461,28 @@ ck_get_active_console_num (int console_fd,
|
||||
gboolean
|
||||
ck_system_can_suspend (void)
|
||||
{
|
||||
- return TRUE;
|
||||
+/* needs acpi(4) */
|
||||
+#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__)
|
||||
+ struct stat st;
|
||||
+
|
||||
+ if (stat("/var/run/apmdev", &st) < 0) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (!S_ISSOCK(st.st_mode)) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+#else
|
||||
+ return FALSE;
|
||||
+#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
ck_system_can_hibernate (void)
|
||||
{
|
||||
- return TRUE;
|
||||
+ return ck_system_can_suspend();
|
||||
}
|
||||
|
||||
gboolean
|
@ -1,35 +0,0 @@
|
||||
$OpenBSD: patch-src_ck-sysdeps-unix_c,v 1.16 2020/11/29 11:33:31 ajacoutot Exp $
|
||||
|
||||
From c9b3329afcbc7961cb95bf6ab093eff1065f6283 Mon Sep 17 00:00:00 2001
|
||||
From: Antoine Jacoutot <ajacoutot@openbsd.org>
|
||||
Date: Sun, 22 Nov 2020 11:02:18 +0100
|
||||
Subject: [PATCH 3/3] OpenBSD: merge enhancements from ports
|
||||
|
||||
Index: src/ck-sysdeps-unix.c
|
||||
--- src/ck-sysdeps-unix.c.orig
|
||||
+++ src/ck-sysdeps-unix.c
|
||||
@@ -259,9 +259,15 @@ ck_open_a_console (char *fnam)
|
||||
again:
|
||||
#endif /* __linux__ */
|
||||
|
||||
+/* OpenBSD only allows change-setting ioctls when FWRITE is set on the fd */
|
||||
+#ifdef __OpenBSD__
|
||||
+ fd = open (fnam, O_WRONLY | O_NOCTTY);
|
||||
+#else
|
||||
fd = open (fnam, O_RDONLY | O_NOCTTY);
|
||||
if (fd < 0 && errno == EACCES)
|
||||
fd = open (fnam, O_WRONLY | O_NOCTTY);
|
||||
+#endif
|
||||
+
|
||||
#ifdef __linux__
|
||||
if (fd < 0 && errno == EIO) {
|
||||
/* Linux can return EIO if the tty is currently closing,
|
||||
@@ -316,7 +322,7 @@ ck_get_a_console_fd (void)
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
- fd = ck_open_a_console ("/dev/ttyC0");
|
||||
+ fd = ck_open_a_console ("/dev/ttyCcfg");
|
||||
if (fd >= 0) {
|
||||
goto done;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user