OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
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 #include "primpl.h" | 6 #include "primpl.h" |
7 #if defined(_PR_POLL_AVAILABLE) | 7 #if defined(_PR_POLL_AVAILABLE) |
8 #include <poll.h> | 8 #include <poll.h> |
9 #endif | 9 #endif |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return; | 521 return; |
522 } | 522 } |
523 PR_SetError(prError, err); | 523 PR_SetError(prError, err); |
524 } | 524 } |
525 | 525 |
526 void _MD_unix_map_connect_error(int err) | 526 void _MD_unix_map_connect_error(int err) |
527 { | 527 { |
528 PRErrorCode prError; | 528 PRErrorCode prError; |
529 | 529 |
530 switch (err) { | 530 switch (err) { |
531 case EACCES: | |
532 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; | |
533 break; | |
534 #if defined(UNIXWARE) | 531 #if defined(UNIXWARE) |
535 /* | 532 /* |
536 * On some platforms, if we connect to a port on the local host | 533 * On some platforms, if we connect to a port on the local host |
537 * (the loopback address) that no process is listening on, we get | 534 * (the loopback address) that no process is listening on, we get |
538 * EIO instead of ECONNREFUSED. | 535 * EIO instead of ECONNREFUSED. |
539 */ | 536 */ |
540 case EIO: | 537 case EIO: |
541 prError = PR_CONNECT_REFUSED_ERROR; | 538 prError = PR_CONNECT_REFUSED_ERROR; |
542 break; | 539 break; |
543 #endif | 540 #endif |
544 case ELOOP: | |
545 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; | |
546 break; | |
547 case ENOENT: | |
548 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; | |
549 break; | |
550 case ENXIO: | 541 case ENXIO: |
551 prError = PR_IO_ERROR; | 542 prError = PR_IO_ERROR; |
552 break; | 543 break; |
553 default: | 544 default: |
554 _MD_unix_map_default_error(err); | 545 _MD_unix_map_default_error(err); |
555 return; | 546 return; |
556 } | 547 } |
557 PR_SetError(prError, err); | 548 PR_SetError(prError, err); |
558 } | 549 } |
559 | 550 |
560 void _MD_unix_map_bind_error(int err) | 551 void _MD_unix_map_bind_error(int err) |
561 { | 552 { |
562 PRErrorCode prError; | 553 PRErrorCode prError; |
563 | 554 |
564 switch (err) { | 555 switch (err) { |
565 case EINVAL: | 556 case EINVAL: |
566 prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR; | 557 prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR; |
567 break; | 558 break; |
568 /* | |
569 * UNIX domain sockets are not supported in NSPR | |
570 */ | |
571 case EIO: | |
572 case EISDIR: | |
573 case ELOOP: | |
574 case ENOENT: | |
575 case ENOTDIR: | |
576 case EROFS: | |
577 prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; | |
578 break; | |
579 default: | 559 default: |
580 _MD_unix_map_default_error(err); | 560 _MD_unix_map_default_error(err); |
581 return; | 561 return; |
582 } | 562 } |
583 PR_SetError(prError, err); | 563 PR_SetError(prError, err); |
584 } | 564 } |
585 | 565 |
586 void _MD_unix_map_listen_error(int err) | 566 void _MD_unix_map_listen_error(int err) |
587 { | 567 { |
588 _MD_unix_map_default_error(err); | 568 _MD_unix_map_default_error(err); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 PR_SetError(prError, err); | 820 PR_SetError(prError, err); |
841 } | 821 } |
842 #endif /* SOLARIS */ | 822 #endif /* SOLARIS */ |
843 | 823 |
844 #ifdef LINUX | 824 #ifdef LINUX |
845 void _MD_linux_map_sendfile_error(int err) | 825 void _MD_linux_map_sendfile_error(int err) |
846 { | 826 { |
847 _MD_unix_map_default_error(err) ; | 827 _MD_unix_map_default_error(err) ; |
848 } | 828 } |
849 #endif /* LINUX */ | 829 #endif /* LINUX */ |
OLD | NEW |