Alexandre Julliard | 598412e | 2001-01-17 20:22:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Wine library reentrant errno support |
| 3 | * |
| 4 | * Copyright 1998 Alexandre Julliard |
| 5 | */ |
| 6 | |
| 7 | /* Get pointers to the static errno and h_errno variables used by Xlib. This |
| 8 | must be done before including <errno.h> makes the variables invisible. */ |
| 9 | static int *default_errno_location(void) |
| 10 | { |
| 11 | extern int errno; |
| 12 | return &errno; |
| 13 | } |
| 14 | |
| 15 | static int *default_h_errno_location(void) |
| 16 | { |
| 17 | extern int h_errno; |
| 18 | return &h_errno; |
| 19 | } |
| 20 | |
| 21 | int* (*wine_errno_location)(void) = default_errno_location; |
| 22 | int* (*wine_h_errno_location)(void) = default_h_errno_location; |
| 23 | |
| 24 | #include "config.h" |
| 25 | |
| 26 | /*********************************************************************** |
| 27 | * __errno_location/__error/___errno |
| 28 | * |
| 29 | * Get the per-thread errno location. |
| 30 | */ |
| 31 | #ifdef ERRNO_LOCATION |
| 32 | int *ERRNO_LOCATION(void) |
| 33 | { |
| 34 | return wine_errno_location(); |
| 35 | } |
| 36 | #endif /* ERRNO_LOCATION */ |
| 37 | |
| 38 | /*********************************************************************** |
| 39 | * __h_errno_location |
| 40 | * |
| 41 | * Get the per-thread h_errno location. |
| 42 | */ |
| 43 | int *__h_errno_location(void) |
| 44 | { |
| 45 | return wine_h_errno_location(); |
| 46 | } |