Bug 9157 - 64 bit problem in xserver/os/utils.c on Mac OS X 10.4.8
Summary: 64 bit problem in xserver/os/utils.c on Mac OS X 10.4.8
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: 7.1 (2006.05)
Hardware: PowerPC Mac OS X (All)
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-25 12:40 UTC by Peter Dyballa
Modified: 2007-03-11 14:54 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Peter Dyballa 2006-11-25 12:40:59 UTC
While making the X server I get:

	In file included from /usr/include/signal.h:63,
	                 from /usr/include/sys/select.h:146,
	                 from /usr/include/unistd.h:483,
	                 from /usr/X11R7/include/X11/Xos.h:168,
	                 from utils.c:81:
	/usr/include/sys/signal.h:145: error: parse error before 'mcontext64_t'
	/usr/include/sys/signal.h:177: error: parse error before 'ucontext64_t'

_POSIX_C_SOURCE and _ANSI_SOURCE are both not defined.

/usr/include/sys/signal.h on Mac OS X 10.4.8 has:

  134   #ifndef _ANSI_SOURCE
  135   #include <sys/_types.h>
  136   
  137   #ifndef _MCONTEXT_T
  138   #define _MCONTEXT_T
  139   typedef __darwin_mcontext_t             mcontext_t;
  140   #endif
  141   
  142   #ifndef _POSIX_C_SOURCE
  143   #ifndef _MCONTEXT64_T
  144   #define _MCONTEXT64_T
  145   typedef __darwin_mcontext64_t           mcontext64_t;
  146   #endif
  147   #endif /* _POSIX_C_SOURCE */
...
  169   #ifndef _UCONTEXT_T
  170   #define _UCONTEXT_T
  171   typedef __darwin_ucontext_t             ucontext_t;
  172   #endif
  173   
  174   #ifndef _POSIX_C_SOURCE
  175   #ifndef _UCONTEXT64_T
  176   #define _UCONTEXT64_T
  177   typedef __darwin_ucontext64_t           ucontext64_t;
  178   #endif
  179   #endif /* _POSIX_C_SOURCE */
...
  412   #endif  /* !_ANSI_SOURCE */

/usr/include/sys/_types.h defines:

   29   /* Forward references */
   30   #ifndef _POSIX_C_SOURCE
   31   struct mcontext;
   32   struct mcontext64;
   33   #else /* _POSIX_C_SOURCE */
   34   struct __darwin_mcontext;
   35   #endif /* _POSIX_C_SOURCE */
...
  106   #ifndef _POSIX_C_SOURCE
  107   typedef struct mcontext *__darwin_mcontext_t;   /* [???] machine context */
  108   typedef struct mcontext64 *__darwin_mcontext64_t; /* [???] machine context */
  109   #else /* _POSIX_C_SOURCE */
  110   typedef struct __darwin_mcontext *__darwin_mcontext_t; /* [???] machine context */
  111   #endif /* _POSIX_C_SOURCE */
...
  157   /* user context */
  158   #ifndef _POSIX_C_SOURCE
  159   struct ucontext
  160   #else /* _POSIX_C_SOURCE */
  161   struct __darwin_ucontext
  162   #endif /* _POSIX_C_SOURCE */
  163   {
  164           int             uc_onstack;
  165           __darwin_sigset_t       uc_sigmask;     /* signal mask used by this context */
  166           __darwin_stack_t        uc_stack;       /* stack used by this context */
  167   #ifndef _POSIX_C_SOURCE
  168           struct ucontext *uc_link;               /* pointer to resuming context */
  169   #else /* _POSIX_C_SOURCE */
  170           struct __darwin_ucontext *uc_link;      /* pointer to resuming context */
  171   #endif /* _POSIX_C_SOURCE */
  172           __darwin_size_t uc_mcsize;              /* size of the machine context passed in */
  173           __darwin_mcontext_t     uc_mcontext;    /* pointer to machine specific context */
  174   };
  175   #ifndef _POSIX_C_SOURCE
  176   typedef struct ucontext __darwin_ucontext_t;    /* [???] user context */
  177   #else /* _POSIX_C_SOURCE */
  178   typedef struct __darwin_ucontext __darwin_ucontext_t; /* [???] user context */
  179   #endif /* _POSIX_C_SOURCE */
  180   
  181   #ifndef _POSIX_C_SOURCE
  182   struct ucontext64 {
  183           int             uc_onstack;
  184           __darwin_sigset_t       uc_sigmask;     /* signal mask used by this context */
  185           __darwin_stack_t        uc_stack;       /* stack used by this context */
  186           struct ucontext64 *uc_link;             /* pointer to resuming context */
  187           __darwin_size_t uc_mcsize;              /* size of the machine context passed in */
  188           __darwin_mcontext64_t uc_mcontext64;    /* pointer to machine specific context */
  189   };
  190   typedef struct ucontext64 __darwin_ucontext64_t; /* [???] user context */
  191   #endif /* _POSIX_C_SOURCE */

so in the end only

	struct __darwin_mcontext;
	typedef struct __darwin_mcontext *__darwin_mcontext_t;

and

	struct __darwin_ucontext
	{
	 int uc_onstack;
	 __darwin_sigset_t uc_sigmask;
	 __darwin_stack_t uc_stack;
	 struct __darwin_ucontext *uc_link;
	 __darwin_size_t uc_mcsize;
	 __darwin_mcontext_t uc_mcontext;
	};
	typedef struct __darwin_ucontext __darwin_ucontext_t;

are defined. Puting -D_POSIX_C_SOURCE into CPPFLAGS leads to another error, in xserver/os/xdmcp.c: 

	In file included from xdmcp.c:43:
	osdep.h:251: warning: parameter names (without types) in function declaration
	xdmcp.c: In function 'XdmcpWakeupHandler':
	xdmcp.c:715: error: 'fd_mask' undeclared (first use in this function)
	xdmcp.c:715: error: (Each undeclared identifier is reported only once
	xdmcp.c:715: error: for each function it appears in.)

Puting -D_ANSI_SOURCE into CPPFLAGS leads to a different error in xserver/os/utils.c: 

	utils.c: In function 'OsSignal':
	utils.c:300: error: storage size of 'act' isn't known
	utils.c:300: error: storage size of 'oact' isn't known
	utils.c:302: warning: implicit declaration of function 'sigemptyset'
	utils.c:302: warning: nested extern declaration of 'sigemptyset'
	utils.c:304: warning: implicit declaration of function 'sigaddset'
	utils.c:304: warning: nested extern declaration of 'sigaddset'
	utils.c:307: warning: implicit declaration of function 'sigaction'
	utils.c:307: warning: nested extern declaration of 'sigaction'
	utils.c:300: warning: unused variable 'oact'
	utils.c:300: warning: unused variable 'act'
	utils.c:310: warning: control reaches end of non-void function
	utils.c: At top level:
	utils.c:351: error: 'PATH_MAX' undeclared here (not in a function)
	utils.c: In function 'LockServer':
	utils.c:470: warning: implicit declaration of function 'kill'
	utils.c:470: warning: nested extern declaration of 'kill'
	utils.c:363: warning: unused variable 'tmp'
	utils.c: In function 'SmartScheduleInit':
	utils.c:1598: error: storage size of 'act' isn't known
	utils.c:1603: error: invalid application of 'sizeof' to incomplete type 'struct sigaction' 
	utils.c:1598: warning: unused variable 'act'
	utils.c: In function 'Popen':
	utils.c:1800: warning: implicit declaration of function 'fdopen'
	utils.c:1800: warning: nested extern declaration of 'fdopen'
	utils.c:1800: warning: assignment makes pointer from integer without a cast
	utils.c:1803: warning: assignment makes pointer from integer without a cast
	utils.c: In function 'Fopen':
	utils.c:1877: warning: assignment makes pointer from integer without a cast
	utils.c:1880: warning: assignment makes pointer from integer without a cast

Actually it's the undefined struct sigaction at lines #300 and #1598, #1603 (from /usr/include/sys/
signal.h), the missing definition of PATH_MAX on line #351 (from  /usr/include/sys/syslimits.h) or kill() 
on line #470 (from /usr/include/signal.h) or fdopen on line #1800/1803/1877/1880 (from /usr/
include/stdio.h).

 I'm not sure whether this is a bug that Apple introduced – I had to re-install Mac OS X 10.4.8 because of 
a damage of the HFS+ file system, and installed Xcode 2.4.1. Before it was Xcode 2.4 ...
Comment 1 Daniel Stone 2007-02-27 01:34:49 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 Peter Dyballa 2007-03-11 14:54:38 UTC
Solved.


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.