UNIX FD passing is supported by Solaris, but additional compile flags are required
Pavel Strashkin
pavel.strashkin at gmail.com
Fri Dec 17 02:25:03 PST 2010
Hello,
I'm trying to compile dbus 1.4.0 under Solaris and it fails with an
error like this: "struct msghdr has no msg_controll member...".
The answer on this question is there:
http://stackoverflow.com/questions/1034587/how-does-xpg4-2-and-other-defines-work-on-solaris
Passing UNIX FD was introduced in X/Open CAE Specification, Issue 4,
Version 2 (XPG4v2) so you need to enable it at compile time.
I've added "-D_XOPEN_SOURCE=500" and everything compiles without any error.
Below the copy/paste from /usr/include/sys/socket.h:
==BEG==
328 #if defined(_XPG4_2) || defined(_KERNEL)
329 void *msg_control; /* ancillary data */
330 socklen_t msg_controllen; /* ancillary data
buffer len */
331 int msg_flags; /* flags on
received message */
332 #else
==END
Below the copy/paste of notes from /usr/include/sys/feature_tests.h
about _XOPEN_SOURCE:
==BEG==
216 /*
217 * Use of _XOPEN_SOURCE
218 *
219 * The following X/Open specifications are supported:
220 *
221 * X/Open Portability Guide, Issue 3 (XPG3)
222 * X/Open CAE Specification, Issue 4 (XPG4)
223 * X/Open CAE Specification, Issue 4, Version 2 (XPG4v2)
224 * X/Open CAE Specification, Issue 5 (XPG5)
225 * Open Group Technical Standard, Issue 6 (XPG6), also referred to as
226 * IEEE Std. 1003.1-2001 and ISO/IEC 9945:2002.
227 *
228 * XPG4v2 is also referred to as UNIX 95 (SUS or SUSv1).
229 * XPG5 is also referred to as UNIX 98 or the Single Unix Specification,
230 * Version 2 (SUSv2)
231 * XPG6 is the result of a merge of the X/Open and POSIX specifications
232 * and as such is also referred to as IEEE Std. 1003.1-2001 in
233 * addition to UNIX 03 and SUSv3.
234 *
235 * When writing a conforming X/Open application, as per the specification
236 * requirements, the appropriate feature test macros must be defined at
237 * compile time. These are as follows. For more info, see standards(5).
238 *
239 * Feature Test Macro Specification
240 * ------------------------------------------------ -------------
241 * _XOPEN_SOURCE XPG3
242 * _XOPEN_SOURCE && _XOPEN_VERSION = 4 XPG4
243 * _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1 XPG4v2
244 * _XOPEN_SOURCE = 500 XPG5
245 * _XOPEN_SOURCE = 600 (or POSIX_C_SOURCE=200112L) XPG6
246 *
247 * In order to simplify the guards within the headers, the following
248 * implementation private test macros have been created. Applications
249 * must NOT use these private test macros as unexpected results will
250 * occur.
251 *
252 * Note that in general, the use of these private macros is cumulative.
253 * For example, the use of _XPG3 with no other restrictions on the X/Open
254 * namespace will make the symbols visible for XPG3 through XPG6
255 * compilation environments. The use of _XPG4_2 with no other X/Open
256 * namespace restrictions indicates that the symbols were introduced in
257 * XPG4v2 and are therefore visible for XPG4v2 through XPG6 compilation
258 * environments, but not for XPG3 or XPG4 compilation environments.
259 *
260 * _XPG3 X/Open Portability Guide, Issue 3 (XPG3)
261 * _XPG4 X/Open CAE Specification, Issue 4 (XPG4)
262 * _XPG4_2 X/Open CAE Specification, Issue 4, Version 2
(XPG4v2/UNIX 95/SUS)
263 * _XPG5 X/Open CAE Specification, Issue 5 (XPG5/UNIX 98/SUSv2)
264 * _XPG6 Open Group Technical Standard, Issue 6 (XPG6/UNIX 03/SUSv3)
265 */
266
267 /* X/Open Portability Guide, Issue 3 */
268 #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 < 500) && \
269 (_XOPEN_VERSION - 0 < 4) && !defined(_XOPEN_SOURCE_EXTENDED)
270 #define _XPG3
271 /* X/Open CAE Specification, Issue 4 */
272 #elif (defined(_XOPEN_SOURCE) && _XOPEN_VERSION - 0 == 4)
273 #define _XPG4
274 #define _XPG3
275 /* X/Open CAE Specification, Issue 4, Version 2 */
276 #elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
277 #define _XPG4_2
278 #define _XPG4
279 #define _XPG3
280 /* X/Open CAE Specification, Issue 5 */
281 #elif (_XOPEN_SOURCE - 0 == 500)
282 #define _XPG5
283 #define _XPG4_2
284 #define _XPG4
285 #define _XPG3
286 #undef _POSIX_C_SOURCE
287 #define _POSIX_C_SOURCE 199506L
288 /* Open Group Technical Standard , Issue 6 */
289 #elif (_XOPEN_SOURCE - 0 == 600) || (_POSIX_C_SOURCE - 0 == 200112L)
290 #define _XPG6
291 #define _XPG5
292 #define _XPG4_2
293 #define _XPG4
294 #define _XPG3
295 #undef _POSIX_C_SOURCE
296 #define _POSIX_C_SOURCE 200112L
297 #undef _XOPEN_SOURCE
298 #define _XOPEN_SOURCE 600
299 #endif
==END==
More information about the dbus
mailing list