Bug 9027 - Xos_r and configure check for re-entrant functions
Summary: Xos_r and configure check for re-entrant functions
Status: RESOLVED INVALID
Alias: None
Product: xorg
Classification: Unclassified
Component: Build/Modular (show other bugs)
Version: unspecified
Hardware: x86 (IA32) NetBSD
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard: 2011BRB_Reviewed
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-14 08:31 UTC by Jeremy C. Reed
Modified: 2018-06-12 19:10 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
to generate Xos_r.h from Xos_r.h.in (1.25 KB, patch)
2006-12-09 06:12 UTC, Jeremy C. Reed
no flags Details | Splinter Review
patch for Xos_r.h.in -- move from Xos_r.h first (2.26 KB, patch)
2006-12-09 06:13 UTC, Jeremy C. Reed
no flags Details | Splinter Review

Description Jeremy C. Reed 2006-11-14 08:31:43 UTC
I can commit this if okayed. I emailed about it to xorg list on Nov. 3 but no
feedback.

The following patches for Xos_r.h.in and xproto's configure.ac are from 
DragonFly developer Joerg Sonnenberger available via the NetBSD Pkgsrc 
collection under pkgsrc/x11/xproto/patches/.

The pkgsrc commit message said: "Add patches to handle reentrancy in 
X11/Xos_r.h better by detecting via autoconf whether the interfaces are 
actually present."

These check for: readdir_r, getgrgid_r, getpwuid_r, gethostbyname_r, 
strtok_r, gmtime_r, ttyname_r.

Note this gets rid of the XUSE_MTSAFE_*API settings to use autoconf 
instead.

Any comments on this?


--- configure.ac.orig	2006-11-02 08:17:10.000000000 +0000
+++ configure.ac
@@ -4,6 +4,7 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2])
 
 AC_CONFIG_HEADER([do-not-use-config.h])
 AC_CONFIG_HEADER([Xfuncproto.h])
+AC_CONFIG_HEADER([Xos_r.h])
 
 AC_CANONICAL_HOST
 
@@ -170,6 +171,15 @@ if test "x$WIDEPROTO" = xno; then
 	AC_DEFINE(NARROWPROTO, [], [Narrow prototypes])
 fi
 
+# Handle Xos_r.h
+AC_CHECK_FUNC(readdir_r, [AC_DEFINE(_XOS_R_H_MTSAFE_DIRENTAPI,[],[Assume has
readdir_r and friends from dirent.h])],)
+AC_CHECK_FUNC(getgrgid_r, [AC_DEFINE(_XOS_R_H_MTSAFE_GRPAPI,[],[Assume has
getgrgid_r and friends from grp.h])],)
+AC_CHECK_FUNC(getpwuid_r, [AC_DEFINE(_XOS_R_H_MTSAFE_PWDAPI,[],[Assume has
getpwuid_r and friends from pwd.h])],)
+AC_CHECK_FUNC(gethostbyname_r, [AC_DEFINE(_XOS_R_H_MTSAFE_NETBDAPI,[],[Assume
has gethostbyname_r and friends from netdb.h])],)
+AC_CHECK_FUNC(strtok_r, [AC_DEFINE(_XOS_R_H_MTSAFE_STRINGAPI,[],[Assume has
strtok_r from string.h])],)
+AC_CHECK_FUNC(gmtime_r, [AC_DEFINE(_XOS_R_H_MTSAFE_TIMEAPI,[],[Assume has
gmtime_r and friends from time.h])],)
+AC_CHECK_FUNC(ttyname_r, [AC_DEFINE(_XOS_R_H_MTSAFE_UNISTDAPI,[],[Assume has
ttyname_r and friends from unistd.h])],)
+
 XORG_RELEASE_VERSION
 
 AC_OUTPUT([Makefile

--- Xos_r.h.in.orig	2006-11-02 08:15:48.000000000 +0000
+++ Xos_r.h.in
@@ -188,6 +188,13 @@ extern void XtProcessUnlock(
 #  endif
 # endif
 
+#undef _XOS_R_H_MTSAFE_DIRENTAPI
+#undef _XOS_R_H_MTSAFE_NETDBAPI
+#undef _XOS_R_H_MTSAFE_PWDAPI
+#undef _XOS_R_H_MTSAFE_UNISTDAPI
+#undef _XOS_R_H_MTSAFE_STRINGAPI
+#undef _XOS_R_H_MTSAFE_TIMEAPI
+#undef _XOS_R_H_MTSAFE_GRPAPI
 #endif /* !defined WIN32 */
 
 /*
@@ -226,7 +233,7 @@ extern void XtProcessUnlock(
 
 #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H)
 # include <pwd.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI)
+# if defined(_XOS_MTSAFE_PWAPI)
 #  define XOS_USE_MTSAFE_PWDAPI 1
 # endif
 #endif
@@ -410,7 +417,7 @@ typedef int _Xgetpwret;
 #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \
     && !defined(WIN32)
 # include <netdb.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI)
+# if defined(_XOS_R_H_MTSAFE_NETDBAPI)
 #  define XOS_USE_MTSAFE_NETDBAPI 1
 # endif
 #endif
@@ -573,7 +580,7 @@ typedef int _Xgetservbynameparams; /* du
 #   define dirent direct
 #  endif
 # endif
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI)
+# if defined(_XOS_R_H_MTSAFE_DIRENTAPI)
 #  define XOS_USE_MTSAFE_DIRENTAPI 1
 # endif
 #endif
@@ -691,7 +698,7 @@ extern int _Preaddir_r(DIR *, struct dir
 
 #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H)
 /* <unistd.h> already included by <X11/Xos.h> */
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI)
+# if defined(_XOS_R_H__MTSAFE_UNISTDAPI)
 #  define XOS_USE_MTSAFE_UNISTDAPI 1
 # endif
 #endif
@@ -831,7 +838,7 @@ typedef struct {
 
 #if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H)
 /* <string.h> has already been included by <X11/Xos.h> */
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI)
+# if defined(_XOS_R_H_MTSAFE_STRINGAPI)
 #  define XOS_USE_MTSAFE_STRINGAPI 1
 # endif
 #endif
@@ -883,7 +890,7 @@ typedef char * _Xstrtokparams;
 
 #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H)
 # include <time.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI)
+# if defined(_XOS_R_H_MTSAFE_TIMEAPI)
 #  define XOS_USE_MTSAFE_TIMEAPI 1
 # endif
 #endif
@@ -1046,7 +1053,7 @@ typedef struct tm _Xltimeparams;
 
 #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H)
 # include <grp.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI)
+# if defined(_XOS_R_H_MTSAFE_GRPAPI)
 #  define XOS_USE_MTSAFE_GRPAPI 1
 # endif
 #endif
Comment 1 Jeremy C. Reed 2006-12-09 06:12:33 UTC
Created attachment 8030 [details] [review]
to generate Xos_r.h from Xos_r.h.in
Comment 2 Jeremy C. Reed 2006-12-09 06:13:50 UTC
Created attachment 8031 [details] [review]
patch for Xos_r.h.in -- move from Xos_r.h first

Move your Xos_r.h to Xos_r.h.in
and then use this patch and the other patch for configure.ac.
Comment 3 Daniel Stone 2007-02-27 01:34:40 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 4 Jeremy Huddleston Sequoia 2011-10-09 03:25:44 UTC
Is this still relevant?
Comment 5 Adam Jackson 2018-06-12 19:10:39 UTC
Mass closure: This bug has been untouched for more than six years, and is not
obviously still valid. Please reopen this bug or file a new report if you continue to experience issues with current releases.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.