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 PRInt32 osfd; | |
3404 | |
3405 #if defined(DARWIN) | 3403 #if defined(DARWIN) |
3406 /* | 3404 /* |
3407 * Disable IPv6 if Darwin version is less than 7.0.0 (OS X 10.3). IPv6 on | 3405 * Disable IPv6 if Darwin version is less than 7.0.0 (OS X 10.3). IPv6 on |
3408 * lesser versions is not ready for general use (see bug 222031). | 3406 * lesser versions is not ready for general use (see bug 222031). |
3409 */ | 3407 */ |
3410 { | 3408 { |
3411 struct utsname u; | 3409 struct utsname u; |
3412 if (uname(&u) != 0 || atoi(u.release) < 7) | 3410 if (uname(&u) != 0 || atoi(u.release) < 7) |
3413 return PR_FALSE; | 3411 return PR_FALSE; |
3414 } | 3412 } |
3415 #endif | 3413 #endif |
3416 | 3414 |
| 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 |
3417 /* | 3420 /* |
3418 * HP-UX only: HP-UX IPv6 Porting Guide (dated February 2001) | 3421 * HP-UX only: HP-UX IPv6 Porting Guide (dated February 2001) |
3419 * suggests that we call open("/dev/ip6", O_RDWR) to determine | 3422 * suggests that we call open("/dev/ip6", O_RDWR) to determine |
3420 * whether IPv6 APIs and the IPv6 stack are on the system. | 3423 * whether IPv6 APIs and the IPv6 stack are on the system. |
3421 * Our portable test below seems to work fine, so I am using it. | 3424 * Our portable test below seems to work fine, so I am using it. |
3422 */ | 3425 */ |
3423 osfd = socket(AF_INET6, SOCK_STREAM, 0); | 3426 PRInt32 osfd = socket(AF_INET6, SOCK_STREAM, 0); |
3424 if (osfd != -1) { | 3427 if (osfd != -1) { |
3425 close(osfd); | 3428 close(osfd); |
3426 return PR_TRUE; | 3429 return PR_TRUE; |
3427 } | 3430 } |
3428 return PR_FALSE; | 3431 return PR_FALSE; |
| 3432 #endif |
3429 } | 3433 } |
3430 #endif /* _PR_INET6_PROBE */ | 3434 #endif /* _PR_INET6_PROBE */ |
3431 #endif | 3435 #endif |
3432 | 3436 |
3433 PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto) | 3437 PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto) |
3434 { | 3438 { |
3435 PRIntn osfd; | 3439 PRIntn osfd; |
3436 PRDescType ftype; | 3440 PRDescType ftype; |
3437 PRFileDesc *fd = NULL; | 3441 PRFileDesc *fd = NULL; |
3438 #if defined(_PR_INET6_PROBE) || !defined(_PR_INET6) | 3442 #if defined(_PR_INET6_PROBE) || !defined(_PR_INET6) |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5001 | 5005 |
5002 PR_IMPLEMENT(PRStatus) PR_GetFileInfo64UTF16(const PRUnichar *fn, PRFileInfo64 *
info) | 5006 PR_IMPLEMENT(PRStatus) PR_GetFileInfo64UTF16(const PRUnichar *fn, PRFileInfo64 *
info) |
5003 { | 5007 { |
5004 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); | 5008 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
5005 return PR_FAILURE; | 5009 return PR_FAILURE; |
5006 } | 5010 } |
5007 /* ================ UTF16 Interfaces ================================ */ | 5011 /* ================ UTF16 Interfaces ================================ */ |
5008 #endif /* MOZ_UNICODE */ | 5012 #endif /* MOZ_UNICODE */ |
5009 | 5013 |
5010 /* ptio.c */ | 5014 /* ptio.c */ |
OLD | NEW |