OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 ** File: ptio.c | 7 ** File: ptio.c |
8 ** Descritpion: Implemenation of I/O methods for pthreads | 8 ** Descritpion: Implemenation of I/O methods for pthreads |
9 */ | 9 */ |
10 | 10 |
(...skipping 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3393 PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); | 3393 PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); |
3394 return fd; | 3394 return fd; |
3395 } /* PR_AllocFileDesc */ | 3395 } /* PR_AllocFileDesc */ |
3396 | 3396 |
3397 #if !defined(_PR_INET6) || defined(_PR_INET6_PROBE) | 3397 #if !defined(_PR_INET6) || defined(_PR_INET6_PROBE) |
3398 PR_EXTERN(PRStatus) _pr_push_ipv6toipv4_layer(PRFileDesc *fd); | 3398 PR_EXTERN(PRStatus) _pr_push_ipv6toipv4_layer(PRFileDesc *fd); |
3399 #if defined(_PR_INET6_PROBE) | 3399 #if defined(_PR_INET6_PROBE) |
3400 extern PRBool _pr_ipv6_is_present(void); | 3400 extern PRBool _pr_ipv6_is_present(void); |
3401 PR_IMPLEMENT(PRBool) _pr_test_ipv6_socket() | 3401 PR_IMPLEMENT(PRBool) _pr_test_ipv6_socket() |
3402 { | 3402 { |
| 3403 int osfd; |
| 3404 |
3403 #if defined(DARWIN) | 3405 #if defined(DARWIN) |
3404 /* | 3406 /* |
3405 * Disable IPv6 if Darwin version is less than 7.0.0 (OS X 10.3). IPv6 on | 3407 * Disable IPv6 if Darwin version is less than 7.0.0 (OS X 10.3). IPv6 on |
3406 * lesser versions is not ready for general use (see bug 222031). | 3408 * lesser versions is not ready for general use (see bug 222031). |
3407 */ | 3409 */ |
3408 { | 3410 { |
3409 struct utsname u; | 3411 struct utsname u; |
3410 if (uname(&u) != 0 || atoi(u.release) < 7) | 3412 if (uname(&u) != 0 || atoi(u.release) < 7) |
3411 return PR_FALSE; | 3413 return PR_FALSE; |
3412 } | 3414 } |
3413 #endif | 3415 #endif |
3414 | 3416 |
3415 #if defined(LINUX) | |
3416 /* If /proc/net/if_inet6 exists, the Linux kernel supports IPv6. */ | |
3417 int rv = access("/proc/net/if_inet6", F_OK); | |
3418 return (rv == 0); | |
3419 #else | |
3420 /* | 3417 /* |
3421 * HP-UX only: HP-UX IPv6 Porting Guide (dated February 2001) | 3418 * HP-UX only: HP-UX IPv6 Porting Guide (dated February 2001) |
3422 * suggests that we call open("/dev/ip6", O_RDWR) to determine | 3419 * suggests that we call open("/dev/ip6", O_RDWR) to determine |
3423 * whether IPv6 APIs and the IPv6 stack are on the system. | 3420 * whether IPv6 APIs and the IPv6 stack are on the system. |
3424 * Our portable test below seems to work fine, so I am using it. | 3421 * Our portable test below seems to work fine, so I am using it. |
3425 */ | 3422 */ |
3426 PRInt32 osfd = socket(AF_INET6, SOCK_STREAM, 0); | 3423 osfd = socket(AF_INET6, SOCK_STREAM, 0); |
3427 if (osfd != -1) { | 3424 if (osfd != -1) { |
3428 close(osfd); | 3425 close(osfd); |
3429 return PR_TRUE; | 3426 return PR_TRUE; |
3430 } | 3427 } |
3431 return PR_FALSE; | 3428 return PR_FALSE; |
3432 #endif | |
3433 } | 3429 } |
3434 #endif /* _PR_INET6_PROBE */ | 3430 #endif /* _PR_INET6_PROBE */ |
3435 #endif | 3431 #endif |
3436 | 3432 |
3437 PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto) | 3433 PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto) |
3438 { | 3434 { |
3439 PRIntn osfd; | 3435 PRIntn osfd; |
3440 PRDescType ftype; | 3436 PRDescType ftype; |
3441 PRFileDesc *fd = NULL; | 3437 PRFileDesc *fd = NULL; |
3442 #if defined(_PR_INET6_PROBE) || !defined(_PR_INET6) | 3438 #if defined(_PR_INET6_PROBE) || !defined(_PR_INET6) |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5005 | 5001 |
5006 PR_IMPLEMENT(PRStatus) PR_GetFileInfo64UTF16(const PRUnichar *fn, PRFileInfo64 *
info) | 5002 PR_IMPLEMENT(PRStatus) PR_GetFileInfo64UTF16(const PRUnichar *fn, PRFileInfo64 *
info) |
5007 { | 5003 { |
5008 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); | 5004 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
5009 return PR_FAILURE; | 5005 return PR_FAILURE; |
5010 } | 5006 } |
5011 /* ================ UTF16 Interfaces ================================ */ | 5007 /* ================ UTF16 Interfaces ================================ */ |
5012 #endif /* MOZ_UNICODE */ | 5008 #endif /* MOZ_UNICODE */ |
5013 | 5009 |
5014 /* ptio.c */ | 5010 /* ptio.c */ |
OLD | NEW |