Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tclUnixPort.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /* | |
2 * tclUnixPort.h -- | |
3 * | |
4 * This header file handles porting issues that occur because of | |
5 * differences between systems. It reads in UNIX-related header files and | |
6 * sets up UNIX-related macros for Tcl's UNIX core. It should be the only | |
7 * file that contains #ifdefs to handle different flavors of UNIX. This | |
8 * file sets up the union of all UNIX-related things needed by any of the | |
9 * Tcl core files. This file depends on configuration #defines such as | |
10 * NO_DIRENT_H that are set up by the "configure" script. | |
11 * | |
12 * Much of the material in this file was originally contributed by Karl | |
13 * Lehenbauer, Mark Diekhans and Peter da Silva. | |
14 * | |
15 * Copyright (c) 1991-1994 The Regents of the University of California. | |
16 * Copyright (c) 1994-1997 Sun Microsystems, Inc. | |
17 * | |
18 * See the file "license.terms" for information on usage and redistribution of | |
19 * this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
20 */ | |
21 | |
22 #ifndef _TCLUNIXPORT | |
23 #define _TCLUNIXPORT | |
24 | |
25 /* | |
26 *--------------------------------------------------------------------------- | |
27 * The following sets of #includes and #ifdefs are required to get Tcl to | |
28 * compile under the various flavors of unix. | |
29 *--------------------------------------------------------------------------- | |
30 */ | |
31 | |
32 #include <errno.h> | |
33 #include <fcntl.h> | |
34 #ifdef HAVE_NET_ERRNO_H | |
35 # include <net/errno.h> | |
36 #endif | |
37 #include <pwd.h> | |
38 #include <signal.h> | |
39 #ifdef HAVE_SYS_PARAM_H | |
40 # include <sys/param.h> | |
41 #endif | |
42 #include <sys/types.h> | |
43 #ifdef USE_DIRENT2_H | |
44 # include "../compat/dirent2.h" | |
45 #else | |
46 #ifdef NO_DIRENT_H | |
47 # include "../compat/dirent.h" | |
48 #else | |
49 # include <dirent.h> | |
50 #endif | |
51 #endif | |
52 | |
53 /* | |
54 *--------------------------------------------------------------------------- | |
55 * Parameterize for 64-bit filesystem support. | |
56 *--------------------------------------------------------------------------- | |
57 */ | |
58 | |
59 #ifdef HAVE_STRUCT_DIRENT64 | |
60 typedef struct dirent64 Tcl_DirEntry; | |
61 # define TclOSreaddir readdir64 | |
62 #else | |
63 typedef struct dirent Tcl_DirEntry; | |
64 # define TclOSreaddir readdir | |
65 #endif | |
66 #ifdef HAVE_DIR64 | |
67 typedef DIR64 TclDIR; | |
68 # define TclOSopendir opendir64 | |
69 # define TclOSrewinddir rewinddir64 | |
70 # define TclOSclosedir closedir64 | |
71 #else | |
72 typedef DIR TclDIR; | |
73 # define TclOSopendir opendir | |
74 # define TclOSrewinddir rewinddir | |
75 # define TclOSclosedir closedir | |
76 #endif | |
77 | |
78 #ifdef HAVE_TYPE_OFF64_T | |
79 typedef off64_t Tcl_SeekOffset; | |
80 # define TclOSseek lseek64 | |
81 # define TclOSopen open64 | |
82 #else | |
83 typedef off_t Tcl_SeekOffset; | |
84 # define TclOSseek lseek | |
85 # define TclOSopen open | |
86 #endif | |
87 | |
88 #ifdef __CYGWIN__ | |
89 #ifdef __cplusplus | |
90 extern "C" { | |
91 #endif | |
92 /* Make some symbols available without including <windows.h> */ | |
93 # define DWORD unsigned int | |
94 # define CP_UTF8 65001 | |
95 # define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 | |
96 # define HANDLE void * | |
97 # define HINSTANCE void * | |
98 # define SOCKET unsigned int | |
99 # define WSAEWOULDBLOCK 10035 | |
100 typedef unsigned short WCHAR; | |
101 #ifdef __clang__ | |
102 #pragma clang diagnostic push | |
103 #pragma clang diagnostic ignored "-Wignored-attributes" | |
104 #endif | |
105 __declspec(dllimport) extern __stdcall int GetModuleHandleExW(unsigned int, const void *, void *); | |
106 __declspec(dllimport) extern __stdcall int GetModuleFileNameW(void *, const void *, int); | |
107 __declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, const void *, int, | |
108 char *, int, const char *, void *); | |
109 __declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, const char *, int, | |
110 WCHAR *, int); | |
111 __declspec(dllimport) extern __stdcall void OutputDebugStringW(const WCHAR *); | |
112 __declspec(dllimport) extern __stdcall int IsDebuggerPresent(void); | |
113 __declspec(dllimport) extern __stdcall int GetLastError(void); | |
114 __declspec(dllimport) extern __stdcall int GetFileAttributesW(const WCHAR *); | |
115 __declspec(dllimport) extern __stdcall int SetFileAttributesW(const WCHAR *, int); | |
116 __declspec(dllimport) extern int cygwin_conv_path(int, const void *, void *, int); | |
117 #ifdef __clang__ | |
118 #pragma clang diagnostic pop | |
119 #endif | |
120 # define timezone _timezone | |
121 extern int TclOSstat(const char *name, void *statBuf); | |
122 extern int TclOSlstat(const char *name, void *statBuf); | |
123 #ifdef __cplusplus | |
124 } | |
125 #endif | |
126 #elif defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__) | |
127 # define TclOSstat(name, buf) stat64(name, (struct stat64 *)buf) | |
128 # define TclOSlstat(name,buf) lstat64(name, (struct stat64 *)buf) | |
129 #else | |
130 # define TclOSstat(name, buf) stat(name, (struct stat *)buf) | |
131 # define TclOSlstat(name, buf) lstat(name, (struct stat *)buf) | |
132 #endif | |
133 | |
134 /* | |
135 *--------------------------------------------------------------------------- | |
136 * Miscellaneous includes that might be missing. | |
137 *--------------------------------------------------------------------------- | |
138 */ | |
139 | |
140 #include <sys/file.h> | |
141 #ifdef HAVE_SYS_SELECT_H | |
142 # include <sys/select.h> | |
143 #endif | |
144 #include <sys/stat.h> | |
145 #ifdef TIME_WITH_SYS_TIME | |
146 # include <sys/time.h> | |
147 # include <time.h> | |
148 #else | |
149 #ifdef HAVE_SYS_TIME_H | |
150 # include <sys/time.h> | |
151 #else | |
152 # include <time.h> | |
153 #endif | |
154 #endif | |
155 #ifndef NO_SYS_WAIT_H | |
156 # include <sys/wait.h> | |
157 #endif | |
158 #ifdef HAVE_INTTYPES_H | |
159 # include <inttypes.h> | |
160 #endif | |
161 #include <limits.h> | |
162 #ifdef HAVE_STDINT_H | |
163 # include <stdint.h> | |
164 #endif | |
165 #ifdef HAVE_UNISTD_H | |
166 # include <unistd.h> | |
167 #else | |
168 # include "../compat/unistd.h" | |
169 #endif | |
170 | |
171 extern int TclUnixSetBlockingMode(int fd, int mode); | |
172 | |
173 #include <utime.h> | |
174 | |
175 /* | |
176 *--------------------------------------------------------------------------- | |
177 * Socket support stuff: This likely needs more work to parameterize for each | |
178 * system. | |
179 *--------------------------------------------------------------------------- | |
180 */ | |
181 | |
182 #include <sys/socket.h> /* struct sockaddr, SOCK_STREAM, ... */ | |
183 #ifndef NO_UNAME | |
184 # include <sys/utsname.h> /* uname system call. */ | |
185 #endif | |
186 #include <netinet/in.h> /* struct in_addr, struct sockaddr_in */ | |
187 #include <arpa/inet.h> /* inet_ntoa() */ | |
188 #include <netdb.h> /* getaddrinfo() */ | |
189 #ifdef NEED_FAKE_RFC2553 | |
190 # include "../compat/fake-rfc2553.h" | |
191 #endif | |
192 | |
193 /* | |
194 *--------------------------------------------------------------------------- | |
195 * Some platforms (e.g. SunOS) don't define FLT_MAX and FLT_MIN, so we look | |
196 * for an alternative definition. If no other alternative is available we use | |
197 * a reasonable guess. | |
198 *--------------------------------------------------------------------------- | |
199 */ | |
200 | |
201 #ifndef NO_FLOAT_H | |
202 # include <float.h> | |
203 #else | |
204 #ifndef NO_VALUES_H | |
205 # include <values.h> | |
206 #endif | |
207 #endif | |
208 | |
209 #ifndef FLT_MAX | |
210 # ifdef MAXFLOAT | |
211 # define FLT_MAX MAXFLOAT | |
212 # else | |
213 # define FLT_MAX 3.402823466E+38F | |
214 # endif | |
215 #endif | |
216 #ifndef FLT_MIN | |
217 # ifdef MINFLOAT | |
218 # define FLT_MIN MINFLOAT | |
219 # else | |
220 # define FLT_MIN 1.175494351E-38F | |
221 # endif | |
222 #endif | |
223 | |
224 /* | |
225 *--------------------------------------------------------------------------- | |
226 * NeXT doesn't define O_NONBLOCK, so #define it here if necessary. | |
227 *--------------------------------------------------------------------------- | |
228 */ | |
229 | |
230 #ifndef O_NONBLOCK | |
231 # define O_NONBLOCK 0x80 | |
232 #endif | |
233 | |
234 /* | |
235 *--------------------------------------------------------------------------- | |
236 * The type of the status returned by wait varies from UNIX system to UNIX | |
237 * system. The macro below defines it: | |
238 *--------------------------------------------------------------------------- | |
239 */ | |
240 | |
241 #ifdef _AIX | |
242 # define WAIT_STATUS_TYPE pid_t | |
243 #else | |
244 #ifndef NO_UNION_WAIT | |
245 # define WAIT_STATUS_TYPE union wait | |
246 #else | |
247 # define WAIT_STATUS_TYPE int | |
248 #endif | |
249 #endif | |
250 | |
251 /* | |
252 *--------------------------------------------------------------------------- | |
253 * Supply definitions for macros to query wait status, if not already defined | |
254 * in header files above. | |
255 *--------------------------------------------------------------------------- | |
256 */ | |
257 | |
258 #ifndef WIFEXITED | |
259 # define WIFEXITED(stat) (((*((int *) &(stat))) & 0xFF) == 0) | |
260 #endif | |
261 | |
262 #ifndef WEXITSTATUS | |
263 # define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xFF) | |
264 #endif | |
265 | |
266 #ifndef WIFSIGNALED | |
267 # define WIFSIGNALED(stat) \ | |
268 (((*((int *) &(stat)))) && ((*((int *) &(stat))) \ | |
269 == ((*((int *) &(stat))) & 0x00FF))) | |
270 #endif | |
271 | |
272 #ifndef WTERMSIG | |
273 # define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7F) | |
274 #endif | |
275 | |
276 #ifndef WIFSTOPPED | |
277 # define WIFSTOPPED(stat) (((*((int *) &(stat))) & 0xFF) == 0177) | |
278 #endif | |
279 | |
280 #ifndef WSTOPSIG | |
281 # define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xFF) | |
282 #endif | |
283 | |
284 /* | |
285 *--------------------------------------------------------------------------- | |
286 * Define constants for waitpid() system call if they aren't defined by a | |
287 * system header file. | |
288 *--------------------------------------------------------------------------- | |
289 */ | |
290 | |
291 #ifndef WNOHANG | |
292 # define WNOHANG 1 | |
293 #endif | |
294 #ifndef WUNTRACED | |
295 # define WUNTRACED 2 | |
296 #endif | |
297 | |
298 /* | |
299 *--------------------------------------------------------------------------- | |
300 * Supply macros for seek offsets, if they're not already provided by an | |
301 * include file. | |
302 *--------------------------------------------------------------------------- | |
303 */ | |
304 | |
305 #ifndef SEEK_SET | |
306 # define SEEK_SET 0 | |
307 #endif | |
308 #ifndef SEEK_CUR | |
309 # define SEEK_CUR 1 | |
310 #endif | |
311 #ifndef SEEK_END | |
312 # define SEEK_END 2 | |
313 #endif | |
314 | |
315 /* | |
316 *--------------------------------------------------------------------------- | |
317 * The stuff below is needed by the "time" command. If this system has no | |
318 * gettimeofday call, then must use times() instead. | |
319 *--------------------------------------------------------------------------- | |
320 */ | |
321 | |
322 #ifdef NO_GETTOD | |
323 # include <sys/times.h> | |
324 #else | |
325 # ifdef HAVE_BSDGETTIMEOFDAY | |
326 # define gettimeofday BSDgettimeofday | |
327 # endif | |
328 #endif | |
329 | |
330 #ifdef GETTOD_NOT_DECLARED | |
331 extern int gettimeofday(struct timeval *tp, | |
332 struct timezone *tzp); | |
333 #endif | |
334 | |
335 /* | |
336 *--------------------------------------------------------------------------- | |
337 * Define access mode constants if they aren't already defined. | |
338 *--------------------------------------------------------------------------- | |
339 */ | |
340 | |
341 #ifndef F_OK | |
342 # define F_OK 00 | |
343 #endif | |
344 #ifndef X_OK | |
345 # define X_OK 01 | |
346 #endif | |
347 #ifndef W_OK | |
348 # define W_OK 02 | |
349 #endif | |
350 #ifndef R_OK | |
351 # define R_OK 04 | |
352 #endif | |
353 | |
354 /* | |
355 *--------------------------------------------------------------------------- | |
356 * Define FD_CLOEEXEC (the close-on-exec flag bit) if it isn't already | |
357 * defined. | |
358 *--------------------------------------------------------------------------- | |
359 */ | |
360 | |
361 #ifndef FD_CLOEXEC | |
362 # define FD_CLOEXEC 1 | |
363 #endif | |
364 | |
365 /* | |
366 *--------------------------------------------------------------------------- | |
367 * On systems without symbolic links (i.e. S_IFLNK isn't defined) define | |
368 * "lstat" to use "stat" instead. | |
369 *--------------------------------------------------------------------------- | |
370 */ | |
371 | |
372 #ifndef S_IFLNK | |
373 # undef TclOSlstat | |
374 # define lstat stat | |
375 # define lstat64 stat64 | |
376 # define TclOSlstat TclOSstat | |
377 #endif | |
378 | |
379 /* | |
380 *--------------------------------------------------------------------------- | |
381 * Define macros to query file type bits, if they're not already defined. | |
382 *--------------------------------------------------------------------------- | |
383 */ | |
384 | |
385 #ifndef S_ISREG | |
386 # ifdef S_IFREG | |
387 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | |
388 # else | |
389 # define S_ISREG(m) 0 | |
390 # endif | |
391 #endif /* !S_ISREG */ | |
392 #ifndef S_ISDIR | |
393 # ifdef S_IFDIR | |
394 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | |
395 # else | |
396 # define S_ISDIR(m) 0 | |
397 # endif | |
398 #endif /* !S_ISDIR */ | |
399 #ifndef S_ISCHR | |
400 # ifdef S_IFCHR | |
401 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | |
402 # else | |
403 # define S_ISCHR(m) 0 | |
404 # endif | |
405 #endif /* !S_ISCHR */ | |
406 | |
407 #ifndef S_ISBLK | |
408 # ifdef S_IFBLK | |
409 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | |
410 # else | |
411 # define S_ISBLK(m) 0 | |
412 # endif | |
413 #endif /* !S_ISBLK */ | |
414 | |
415 #ifndef S_ISFIFO | |
416 # ifdef S_IFIFO | |
417 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | |
418 # else | |
419 # define S_ISFIFO(m) 0 | |
420 # endif | |
421 #endif /* !S_ISFIFO */ | |
422 | |
423 #ifndef S_ISLNK | |
424 # ifdef S_IFLNK | |
425 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | |
426 # else | |
427 # define S_ISLNK(m) 0 | |
428 # endif | |
429 #endif /* !S_ISLNK */ | |
430 | |
431 #ifndef S_ISSOCK | |
432 # ifdef S_IFSOCK | |
433 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | |
434 # else | |
435 # define S_ISSOCK(m) 0 | |
436 # endif | |
437 #endif /* !S_ISSOCK */ | |
438 | |
439 /* | |
440 *--------------------------------------------------------------------------- | |
441 * Make sure that MAXPATHLEN and MAXNAMLEN are defined. | |
442 *--------------------------------------------------------------------------- | |
443 */ | |
444 | |
445 #ifndef MAXPATHLEN | |
446 # ifdef PATH_MAX | |
447 # define MAXPATHLEN PATH_MAX | |
448 # else | |
449 # define MAXPATHLEN 2048 | |
450 # endif | |
451 #endif | |
452 | |
453 #ifndef MAXNAMLEN | |
454 # ifdef NAME_MAX | |
455 # define MAXNAMLEN NAME_MAX | |
456 # else | |
457 # define MAXNAMLEN 255 | |
458 # endif | |
459 #endif | |
460 | |
461 /* | |
462 *--------------------------------------------------------------------------- | |
463 * The following macro defines the type of the mask arguments to select: | |
464 *--------------------------------------------------------------------------- | |
465 */ | |
466 | |
467 #ifndef NO_FD_SET | |
468 # define SELECT_MASK fd_set | |
469 #else /* NO_FD_SET */ | |
470 # ifndef _AIX | |
471 typedef long fd_mask; | |
472 # endif /* !AIX */ | |
473 # if defined(_IBMR2) | |
474 # define SELECT_MASK void | |
475 # else /* !defined(_IBMR2) */ | |
476 # define SELECT_MASK int | |
477 # endif /* defined(_IBMR2) */ | |
478 #endif /* !NO_FD_SET */ | |
479 | |
480 /* | |
481 *--------------------------------------------------------------------------- | |
482 * Define "NBBY" (number of bits per byte) if it's not already defined. | |
483 *--------------------------------------------------------------------------- | |
484 */ | |
485 | |
486 #ifndef NBBY | |
487 # define NBBY 8 | |
488 #endif | |
489 | |
490 /* | |
491 *--------------------------------------------------------------------------- | |
492 * The following macro defines the number of fd_masks in an fd_set: | |
493 *--------------------------------------------------------------------------- | |
494 */ | |
495 | |
496 #ifndef FD_SETSIZE | |
497 # ifdef OPEN_MAX | |
498 # define FD_SETSIZE OPEN_MAX | |
499 # else | |
500 # define FD_SETSIZE 256 | |
501 # endif | |
502 #endif /* FD_SETSIZE */ | |
503 | |
504 #ifndef howmany | |
505 # define howmany(x, y) (((x)+((y)-1))/(y)) | |
506 #endif /* !defined(howmany) */ | |
507 | |
508 #ifndef NFDBITS | |
509 # define NFDBITS NBBY*sizeof(fd_mask) | |
510 #endif /* NFDBITS */ | |
511 | |
512 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS) | |
513 | |
514 /* | |
515 *--------------------------------------------------------------------------- | |
516 * Not all systems declare the errno variable in errno.h. so this file does it | |
517 * explicitly. The list of system error messages also isn't generally declared | |
518 * in a header file anywhere. | |
519 *--------------------------------------------------------------------------- | |
520 */ | |
521 | |
522 #ifdef NO_ERRNO | |
523 extern int errno; | |
524 #endif /* NO_ERRNO */ | |
525 | |
526 /* | |
527 *--------------------------------------------------------------------------- | |
528 * Not all systems declare all the errors that Tcl uses! Provide some | |
529 * work-arounds... | |
530 *--------------------------------------------------------------------------- | |
531 */ | |
532 | |
533 #ifndef EOVERFLOW | |
534 # ifdef EFBIG | |
535 # define EOVERFLOW EFBIG | |
536 # else /* !EFBIG */ | |
537 # define EOVERFLOW EINVAL | |
538 # endif /* EFBIG */ | |
539 #endif /* EOVERFLOW */ | |
540 | |
541 /* | |
542 *--------------------------------------------------------------------------- | |
543 * Variables provided by the C library: | |
544 *--------------------------------------------------------------------------- | |
545 */ | |
546 | |
547 #if defined(__APPLE__) && defined(__DYNAMIC__) | |
548 # include <crt_externs.h> | |
549 # define environ (*_NSGetEnviron()) | |
550 # define USE_PUTENV 1 | |
551 #else | |
552 # if defined(_sgi) || defined(__sgi) | |
553 # define environ _environ | |
554 # endif | |
555 extern char ** environ; | |
556 #endif | |
557 | |
558 /* | |
559 *--------------------------------------------------------------------------- | |
560 * Darwin specifc configure overrides. | |
561 *--------------------------------------------------------------------------- | |
562 */ | |
563 | |
564 #ifdef __APPLE__ | |
565 | |
566 /* | |
567 *--------------------------------------------------------------------------- | |
568 * Support for fat compiles: configure runs only once for multiple architectures | |
569 *--------------------------------------------------------------------------- | |
570 */ | |
571 | |
572 # if defined(__LP64__) && defined (NO_COREFOUNDATION_64) | |
573 # undef HAVE_COREFOUNDATION | |
574 # endif /* __LP64__ && NO_COREFOUNDATION_64 */ | |
575 # include <sys/cdefs.h> | |
576 # ifdef __DARWIN_UNIX03 | |
577 # if __DARWIN_UNIX03 | |
578 # undef HAVE_PUTENV_THAT_COPIES | |
579 # else | |
580 # define HAVE_PUTENV_THAT_COPIES 1 | |
581 # endif | |
582 # endif /* __DARWIN_UNIX03 */ | |
583 | |
584 /* | |
585 *--------------------------------------------------------------------------- | |
586 * Include AvailabilityMacros.h here (when available) to ensure any symbolic | |
587 * MAC_OS_X_VERSION_* constants passed on the command line are translated. | |
588 *--------------------------------------------------------------------------- | |
589 */ | |
590 | |
591 # ifdef HAVE_AVAILABILITYMACROS_H | |
592 # include <AvailabilityMacros.h> | |
593 # endif | |
594 | |
595 /* | |
596 *--------------------------------------------------------------------------- | |
597 * Support for weak import. | |
598 *--------------------------------------------------------------------------- | |
599 */ | |
600 | |
601 # ifdef HAVE_WEAK_IMPORT | |
602 # if !defined(HAVE_AVAILABILITYMACROS_H) || !defined(MAC_OS_X_VERSION_MIN_REQUIRED) | |
603 # undef HAVE_WEAK_IMPORT | |
604 # else | |
605 # ifndef WEAK_IMPORT_ATTRIBUTE | |
606 # define WEAK_IMPORT_ATTRIBUTE __attribute__((weak_import)) | |
607 # endif | |
608 # endif | |
609 # endif /* HAVE_WEAK_IMPORT */ | |
610 | |
611 /* | |
612 *--------------------------------------------------------------------------- | |
613 * Support for MAC_OS_X_VERSION_MAX_ALLOWED define from AvailabilityMacros.h: | |
614 * only use API available in the indicated OS version or earlier. | |
615 *--------------------------------------------------------------------------- | |
616 */ | |
617 | |
618 # ifdef MAC_OS_X_VERSION_MAX_ALLOWED | |
619 # if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 && defined(__LP64__) | |
620 # undef HAVE_COREFOUNDATION | |
621 # endif | |
622 # if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 | |
623 # undef HAVE_OSSPINLOCKLOCK | |
624 # undef HAVE_PTHREAD_ATFORK | |
625 # undef HAVE_COPYFILE | |
626 # endif | |
627 # if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 | |
628 # ifdef TCL_THREADS | |
629 /* prior to 10.3, realpath is not threadsafe, c.f. bug 711232 */ | |
630 # define NO_REALPATH 1 | |
631 # endif | |
632 # undef HAVE_LANGINFO | |
633 # endif | |
634 # endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ | |
635 # if defined(HAVE_COREFOUNDATION) && defined(__LP64__) && \ | |
636 defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050 | |
637 # warning "Weak import of 64-bit CoreFoundation is not supported, will not run on Mac OS X < 10.5." | |
638 # endif | |
639 | |
640 /* | |
641 *--------------------------------------------------------------------------- | |
642 * At present, using vfork() instead of fork() causes execve() to fail | |
643 * intermittently on Darwin x86_64. rdar://4685553 | |
644 *--------------------------------------------------------------------------- | |
645 */ | |
646 | |
647 # if defined(__x86_64__) && !defined(FIXED_RDAR_4685553) | |
648 # undef USE_VFORK | |
649 # endif /* __x86_64__ */ | |
650 /* Workaround problems with vfork() when building with llvm-gcc-4.2 */ | |
651 # if defined (__llvm__) && \ | |
652 (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 2 || \ | |
653 (__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ > 0)))) | |
654 # undef USE_VFORK | |
655 # endif /* __llvm__ */ | |
656 #endif /* __APPLE__ */ | |
657 | |
658 /* | |
659 *--------------------------------------------------------------------------- | |
660 * The following macros and declarations represent the interface between | |
661 * generic and unix-specific parts of Tcl. Some of the macros may override | |
662 * functions declared in tclInt.h. | |
663 *--------------------------------------------------------------------------- | |
664 */ | |
665 | |
666 /* | |
667 * The default platform eol translation on Unix is TCL_TRANSLATE_LF. | |
668 */ | |
669 | |
670 #ifdef DJGPP | |
671 #define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_CRLF | |
672 typedef int socklen_t; | |
673 #else | |
674 #define TCL_PLATFORM_TRANSLATION TCL_TRANSLATE_LF | |
675 #endif | |
676 | |
677 /* | |
678 *--------------------------------------------------------------------------- | |
679 * The following macros have trivial definitions, allowing generic code to | |
680 * address platform-specific issues. | |
681 *--------------------------------------------------------------------------- | |
682 */ | |
683 | |
684 #define TclpReleaseFile(file) /* Nothing. */ | |
685 | |
686 /* | |
687 *--------------------------------------------------------------------------- | |
688 * The following defines wrap the system memory allocation routines. | |
689 *--------------------------------------------------------------------------- | |
690 */ | |
691 | |
692 #define TclpSysAlloc(size, isBin) malloc((size_t)(size)) | |
693 #define TclpSysFree(ptr) free((char *)(ptr)) | |
694 #define TclpSysRealloc(ptr, size) realloc((char *)(ptr), (size_t)(size)) | |
695 | |
696 /* | |
697 *--------------------------------------------------------------------------- | |
698 * The following macros and declaration wrap the C runtime library functions. | |
699 *--------------------------------------------------------------------------- | |
700 */ | |
701 | |
702 #define TclpExit exit | |
703 | |
704 #ifdef TCL_THREADS | |
705 # include <pthread.h> | |
706 #endif /* TCL_THREADS */ | |
707 | |
708 /* FIXME - Hyper-enormous platform assumption! */ | |
709 #ifndef AF_INET6 | |
710 # define AF_INET6 10 | |
711 #endif | |
712 | |
713 /* | |
714 *--------------------------------------------------------------------------- | |
715 * Set of MT-safe implementations of some known-to-be-MT-unsafe library calls. | |
716 * Instead of returning pointers to the static storage, those return pointers | |
717 * to the TSD data. | |
718 *--------------------------------------------------------------------------- | |
719 */ | |
720 | |
721 #include <pwd.h> | |
722 #include <grp.h> | |
723 | |
724 extern struct passwd * TclpGetPwNam(const char *name); | |
725 extern struct group * TclpGetGrNam(const char *name); | |
726 extern struct passwd * TclpGetPwUid(uid_t uid); | |
727 extern struct group * TclpGetGrGid(gid_t gid); | |
728 extern struct hostent * TclpGetHostByName(const char *name); | |
729 extern struct hostent * TclpGetHostByAddr(const char *addr, | |
730 int length, int type); | |
731 extern void *TclpMakeTcpClientChannelMode( | |
732 void *tcpSocket, int mode); | |
733 | |
734 #endif /* _TCLUNIXPORT */ | |
735 | |
736 /* | |
737 * Local Variables: | |
738 * mode: c | |
739 * c-basic-offset: 4 | |
740 * fill-column: 78 | |
741 * End: | |
742 */ |