⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unix_err.c

📁 支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509v3证书等安全协议或标准的开发库编译用到NSPR
💻 C
📖 第 1 页 / 共 2 页
字号:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- *//* * This file essentially replicates NSPR's source for the functions that * map system-specific error codes to NSPR error codes.  We would use  * NSPR's functions, instead of duplicating them, but they're private. * As long as SSL's server session cache code must do platform native I/O * to accomplish its job, and NSPR's error mapping functions remain private, * this code will continue to need to be replicated. *  * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ *  * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. *  * The Original Code is the Netscape security libraries. *  * The Initial Developer of the Original Code is Netscape * Communications Corporation.  Portions created by Netscape are  * Copyright (C) 1994-2000 Netscape Communications Corporation.  All * Rights Reserved. *  * Contributor(s): *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable  * instead of those above.  If you wish to allow use of your  * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL.  If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. * * $Id: unix_err.c,v 1.2 2000/09/18 19:53:59 nelsonb%netscape.com Exp $ */#if 0#include "primpl.h"#else#define _PR_POLL_AVAILABLE 1#include "prerror.h"#endif#if defined(_PR_POLL_AVAILABLE)#include <poll.h>#endif#include <errno.h>/* forward declarations. */void nss_MD_unix_map_default_error(int err);void nss_MD_unix_map_opendir_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_closedir_error(int err){    PRErrorCode prError;    switch (err) {    case EINVAL:	prError = PR_BAD_DESCRIPTOR_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_readdir_error(int err){    PRErrorCode prError;    switch (err) {    case ENOENT:	prError = PR_NO_MORE_FILES_ERROR; break;#ifdef EOVERFLOW    case EOVERFLOW:	prError = PR_IO_ERROR; break;#endif    case EINVAL:	prError = PR_IO_ERROR; break;    case ENXIO:		prError = PR_IO_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_unlink_error(int err){    PRErrorCode prError;    switch (err) {    case EPERM:		prError = PR_IS_DIRECTORY_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_stat_error(int err){    PRErrorCode prError;    switch (err) {    case ETIMEDOUT:	prError = PR_REMOTE_FILE_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_fstat_error(int err){    PRErrorCode prError;    switch (err) {    case ETIMEDOUT:	prError = PR_REMOTE_FILE_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_rename_error(int err){    PRErrorCode prError;    switch (err) {    case EEXIST:	prError = PR_DIRECTORY_NOT_EMPTY_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_access_error(int err){    PRErrorCode prError;    switch (err) {    case ETIMEDOUT:	prError = PR_REMOTE_FILE_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_mkdir_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_rmdir_error(int err){    PRErrorCode prError;    switch (err) {    case EEXIST:	prError = PR_DIRECTORY_NOT_EMPTY_ERROR; break;    case EINVAL:	prError = PR_DIRECTORY_NOT_EMPTY_ERROR; break;    case ETIMEDOUT:	prError = PR_REMOTE_FILE_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_read_error(int err){    PRErrorCode prError;    switch (err) {    case EINVAL:	prError = PR_INVALID_METHOD_ERROR; break;    case ENXIO:		prError = PR_INVALID_ARGUMENT_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_write_error(int err){    PRErrorCode prError;    switch (err) {    case EINVAL:	prError = PR_INVALID_METHOD_ERROR; break;    case ENXIO:		prError = PR_INVALID_METHOD_ERROR; break;    case ETIMEDOUT:	prError = PR_REMOTE_FILE_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_lseek_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_fsync_error(int err){    PRErrorCode prError;    switch (err) {    case ETIMEDOUT:	prError = PR_REMOTE_FILE_ERROR; break;    case EINVAL:	prError = PR_INVALID_METHOD_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_close_error(int err){    PRErrorCode prError;    switch (err) {    case ETIMEDOUT:	prError = PR_REMOTE_FILE_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_socket_error(int err){    PRErrorCode prError;    switch (err) {    case ENOMEM:	prError = PR_INSUFFICIENT_RESOURCES_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_socketavailable_error(int err){    PR_SetError(PR_BAD_DESCRIPTOR_ERROR, err);}void nss_MD_unix_map_recv_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_recvfrom_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_send_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_sendto_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_writev_error(int err){    nss_MD_unix_map_default_error(err);}void nss_MD_unix_map_accept_error(int err){    PRErrorCode prError;    switch (err) {    case ENODEV:	prError = PR_NOT_TCP_SOCKET_ERROR; break;    default:		nss_MD_unix_map_default_error(err); return;    }    PR_SetError(prError, err);}void nss_MD_unix_map_connect_error(int err){    PRErrorCode prError;    switch (err) {    case EACCES:	prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break;#if defined(UNIXWARE) || defined(SNI) || defined(NEC)    /*     * On some platforms, if we connect to a port on the local host      * (the loopback address) that no process is listening on, we get      * EIO instead of ECONNREFUSED.     */    case EIO:		prError = PR_CONNECT_REFUSED_ERROR; break;#endif    case ELOOP:		prError = PR_ADDRESS_NOT_SUPPORTED_ERROR; break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -