OpenBSD: remove pthread hack #4197

Closed
michaelrsweet opened this Issue Sep 30, 2012 · 5 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Sep 30, 2012

Version: -feature
CUPS.org User: ajacoutot

Hi.

OpenBSD now has kernel threads, so the workaround for the userland libpthread is not needed anymore.
Several build and runtime tests were successful.
Thank you.

Collaborator

michaelrsweet commented Oct 1, 2012

CUPS.org User: mike

Not sure how to detect this at configure-time. Ideas?

Collaborator

michaelrsweet commented Oct 1, 2012

CUPS.org User: ajacoutot

Hi Mike.

I don't think a configure check will be very straightforward (checking 'uname -r').
However this patch works.

Collaborator

michaelrsweet commented Oct 1, 2012

CUPS.org User: mike

Fixed in Subversion repository.

Slightly different patch attached since we already have a test for <sys/param.h> and I wanted to update the comment accordingly.

Collaborator

michaelrsweet commented Oct 1, 2012

"patch-scheduler_main_c":

--- scheduler/main.c.orig Mon Apr 23 21:19:19 2012
+++ scheduler/main.c Mon Oct 1 13:33:44 2012
@@ -46,6 +46,10 @@
#include <syslog.h>
#include <grp.h>

+#ifdef OpenBSD
+#include <sys/param.h>
+#endif
+
#ifdef HAVE_LAUNCH_H

include <launch.h>

include <libgen.h>

@@ -365,7 +369,7 @@ main(int argc, /* I - Number of command-line args
}
}

-#ifdef OpenBSD
+#if (defined(OpenBSD) && OpenBSD < 201211)
/*
* Call _thread_sys_closefrom() so the child process doesn't reset the
* parent's file descriptors to be blocking. This is a workaround for a

Collaborator

michaelrsweet commented Oct 1, 2012

"str4197.patch":

Index: scheduler/main.c

--- scheduler/main.c (revision 10632)
+++ scheduler/main.c (working copy)
@@ -65,11 +65,16 @@
#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)

include <malloc.h>

#endif /* HAVE_MALLOC_H && HAVE_MALLINFO _/
+
#ifdef HAVE_NOTIFY_H

include <notify.h>

#endif /_ HAVE_NOTIFY_H */

+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif /* HAVE_SYS_PARAM_H */

/*

  • Local functions...
    */
    @@ -361,15 +366,15 @@
    }
    }

-#ifdef OpenBSD
+#if defined(OpenBSD) && OpenBSD < 201211
/*
* Call _thread_sys_closefrom() so the child process doesn't reset the
* parent's file descriptors to be blocking. This is a workaround for a

  • * limitation of userland libpthread on OpenBSD.

    • limitation of userland libpthread on older versions of OpenBSD.
      */

      _thread_sys_closefrom(0);
      -#endif /* OpenBSD /
      +#endif /
      OpenBSD && OpenBSD < 201211 */

    /*

    • Since CoreFoundation and DBUS both create fork-unsafe data on execution of

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment