Stephen M. Cameron | 480b811 | 2012-02-24 08:17:31 +0100 | [diff] [blame] | 1 | #include <locale.h> |
| 2 | |
| 3 | #include "endian_check.h" |
| 4 | #include "smalloc.h" |
| 5 | #include "fio.h" |
| 6 | |
| 7 | |
| 8 | unsigned long page_mask; |
| 9 | unsigned long page_size; |
| 10 | |
| 11 | int initialize_fio(char *envp[]) |
| 12 | { |
| 13 | long ps; |
| 14 | |
| 15 | if (endian_check()) { |
| 16 | log_err("fio: endianness settings appear wrong.\n"); |
| 17 | log_err("fio: please report this to fio@vger.kernel.org\n"); |
| 18 | return 1; |
| 19 | } |
| 20 | |
| 21 | arch_init(envp); |
| 22 | |
| 23 | sinit(); |
| 24 | |
| 25 | /* |
| 26 | * We need locale for number printing, if it isn't set then just |
| 27 | * go with the US format. |
| 28 | */ |
| 29 | if (!getenv("LC_NUMERIC")) |
| 30 | setlocale(LC_NUMERIC, "en_US"); |
| 31 | |
| 32 | ps = sysconf(_SC_PAGESIZE); |
| 33 | if (ps < 0) { |
| 34 | log_err("Failed to get page size\n"); |
| 35 | return 1; |
| 36 | } |
| 37 | |
| 38 | page_size = ps; |
| 39 | page_mask = ps - 1; |
| 40 | |
| 41 | fio_keywords_init(); |
| 42 | return 0; |
| 43 | } |