Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
58fa90be
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
58fa90be
编写于
3月 21, 2022
作者:
A
Alexander Köplinger
提交者:
GitHub
3月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[mono] Remove w32error code (#66846)
The remaining usages can be removed.
上级
6ac764b3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
12 addition
and
243 deletion
+12
-243
src/mono/mono/metadata/CMakeLists.txt
src/mono/mono/metadata/CMakeLists.txt
+2
-5
src/mono/mono/metadata/image.c
src/mono/mono/metadata/image.c
+1
-2
src/mono/mono/metadata/threads.c
src/mono/mono/metadata/threads.c
+8
-5
src/mono/mono/metadata/w32error-unix.c
src/mono/mono/metadata/w32error-unix.c
+0
-94
src/mono/mono/metadata/w32error-win32.c
src/mono/mono/metadata/w32error-win32.c
+0
-25
src/mono/mono/metadata/w32error.h
src/mono/mono/metadata/w32error.h
+0
-97
src/mono/mono/metadata/w32event-unix.c
src/mono/mono/metadata/w32event-unix.c
+1
-15
未找到文件。
src/mono/mono/metadata/CMakeLists.txt
浏览文件 @
58fa90be
...
...
@@ -32,12 +32,10 @@ else()
endif
()
set
(
metadata_win32_sources
w32event-win32.c
w32error-win32.c
)
w32event-win32.c
)
set
(
metadata_unix_sources
w32event-unix.c
w32error-unix.c
)
w32event-unix.c
)
if
(
HOST_WIN32
)
set
(
metadata_platform_sources
${
metadata_win32_sources
}
)
...
...
@@ -155,7 +153,6 @@ set(metadata_common_sources
w32event.h
w32handle.h
w32handle.c
w32error.h
reflection.c
dynamic-image.c
sre.c
...
...
src/mono/mono/metadata/image.c
浏览文件 @
58fa90be
...
...
@@ -51,7 +51,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <mono/metadata/w32error.h>
#define INVALID_ADDRESS 0xffffffff
...
...
@@ -1809,7 +1808,7 @@ mono_image_open_a_lot_parameterized (MonoLoadedImages *li, MonoAssemblyLoadConte
fname_utf16
=
g_utf8_to_utf16
(
absfname
,
-
1
,
NULL
,
NULL
,
NULL
);
module_handle
=
MonoLoadImage
(
fname_utf16
);
if
(
status
&&
module_handle
==
NULL
)
last_error
=
mono_w32error_get_last
();
last_error
=
GetLastError
();
/* mono_image_open_from_module_handle is called by _CorDllMain. */
image
=
(
MonoImage
*
)
g_hash_table_lookup
(
loaded_images
,
absfname
);
...
...
src/mono/mono/metadata/threads.c
浏览文件 @
58fa90be
...
...
@@ -53,7 +53,6 @@
#include <mono/metadata/reflection-internals.h>
#include <mono/metadata/abi-details.h>
#include <mono/metadata/w32error.h>
#include <mono/utils/w32api.h>
#include <mono/utils/mono-os-wait.h>
#include <mono/metadata/exception-internals.h>
...
...
@@ -1270,7 +1269,7 @@ start_wrapper (gpointer data)
}
static
void
throw_thread_start_exception
(
guint32
error_code
,
MonoError
*
error
)
throw_thread_start_exception
(
const
char
*
msg
,
MonoError
*
error
)
{
ERROR_DECL
(
method_error
);
...
...
@@ -1282,9 +1281,7 @@ throw_thread_start_exception (guint32 error_code, MonoError *error)
MONO_STATIC_POINTER_INIT_END
(
MonoMethod
,
throw_method
)
g_assert
(
throw_method
);
char
*
msg
=
g_strdup_printf
(
"0x%x"
,
error_code
);
MonoException
*
ex
=
mono_get_exception_execution_engine
(
msg
);
g_free
(
msg
);
gpointer
args
[
1
];
args
[
0
]
=
ex
;
...
...
@@ -1365,7 +1362,13 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoThreadStart
mono_g_hash_table_remove
(
threads_starting_up
,
thread
);
mono_threads_unlock
();
throw_thread_start_exception
(
mono_w32error_get_last
(),
error
);
#if HOST_WIN32
char
*
err_msg
=
g_strdup_printf
(
"0x%x"
,
GetLastError
());
throw_thread_start_exception
(
err_msg
,
error
);
g_free
(
err_msg
);
#else
throw_thread_start_exception
(
"mono_thread_platform_create_thread() failed"
,
error
);
#endif
/* ref is not going to be decremented in start_wrapper_internal */
mono_atomic_dec_i32
(
&
start_info
->
ref
);
...
...
src/mono/mono/metadata/w32error-unix.c
已删除
100644 → 0
浏览文件 @
6ac764b3
/**
* \file
*/
#include "w32error.h"
#include "utils/mono-lazy-init.h"
static
mono_lazy_init_t
error_key_once
=
MONO_LAZY_INIT_STATUS_NOT_INITIALIZED
;
static
pthread_key_t
error_key
;
static
void
error_key_init
(
void
)
{
gint
ret
;
ret
=
pthread_key_create
(
&
error_key
,
NULL
);
g_assert
(
ret
==
0
);
}
guint32
mono_w32error_get_last
(
void
)
{
mono_lazy_initialize
(
&
error_key_once
,
error_key_init
);
return
GPOINTER_TO_UINT
(
pthread_getspecific
(
error_key
));
}
void
mono_w32error_set_last
(
guint32
error
)
{
gint
ret
;
mono_lazy_initialize
(
&
error_key_once
,
error_key_init
);
ret
=
pthread_setspecific
(
error_key
,
GUINT_TO_POINTER
(
error
));
g_assert
(
ret
==
0
);
}
guint32
mono_w32error_unix_to_win32
(
guint32
error
)
{
/* mapping ideas borrowed from wine. they may need some work */
switch
(
error
)
{
case
EACCES
:
case
EPERM
:
case
EROFS
:
return
ERROR_ACCESS_DENIED
;
case
EAGAIN
:
return
ERROR_SHARING_VIOLATION
;
case
EBUSY
:
return
ERROR_LOCK_VIOLATION
;
case
EEXIST
:
return
ERROR_FILE_EXISTS
;
case
EINVAL
:
case
ESPIPE
:
return
ERROR_SEEK
;
case
EISDIR
:
return
ERROR_CANNOT_MAKE
;
case
ENFILE
:
case
EMFILE
:
return
ERROR_TOO_MANY_OPEN_FILES
;
case
ENOENT
:
case
ENOTDIR
:
return
ERROR_FILE_NOT_FOUND
;
case
ENOSPC
:
return
ERROR_HANDLE_DISK_FULL
;
#if !defined(_AIX) || (defined(_AIX) && defined(_LINUX_SOURCE_COMPAT))
case
ENOTEMPTY
:
return
ERROR_DIR_NOT_EMPTY
;
#endif
case
ENOEXEC
:
return
ERROR_BAD_FORMAT
;
case
ENAMETOOLONG
:
return
ERROR_FILENAME_EXCED_RANGE
;
#ifdef EINPROGRESS
case
EINPROGRESS
:
return
ERROR_IO_PENDING
;
#endif
case
ENOSYS
:
return
ERROR_NOT_SUPPORTED
;
case
EBADF
:
return
ERROR_INVALID_HANDLE
;
case
EIO
:
return
ERROR_INVALID_HANDLE
;
#ifdef ERESTART
case
ERESTART
:
#endif
case
EINTR
:
return
ERROR_IO_PENDING
;
/* best match I could find */
case
EPIPE
:
return
ERROR_WRITE_FAULT
;
case
ELOOP
:
return
ERROR_CANT_RESOLVE_FILENAME
;
#ifdef ENODEV
case
ENODEV
:
return
ERROR_DEV_NOT_EXIST
;
#endif
#ifdef ENXIO
case
ENXIO
:
return
ERROR_DEV_NOT_EXIST
;
#endif
#ifdef ENOTCONN
case
ENOTCONN
:
return
ERROR_DEV_NOT_EXIST
;
#endif
#ifdef EHOSTDOWN
case
EHOSTDOWN
:
return
ERROR_DEV_NOT_EXIST
;
#endif
#ifdef ENEEDAUTH
case
ENEEDAUTH
:
return
ERROR_ACCESS_DENIED
;
#endif
default:
g_warning
(
"%s: unknown error (%d)
\"
%s
\"
"
,
__FILE__
,
error
,
g_strerror
(
error
));
return
ERROR_NOT_SUPPORTED
;
}
}
src/mono/mono/metadata/w32error-win32.c
已删除
100644 → 0
浏览文件 @
6ac764b3
/**
* \file
*/
#include <windows.h>
#include "w32error.h"
guint32
mono_w32error_get_last
(
void
)
{
return
GetLastError
();
}
void
mono_w32error_set_last
(
guint32
error
)
{
SetLastError
(
error
);
}
guint32
mono_w32error_unix_to_win32
(
guint32
error
)
{
g_assert_not_reached
();
}
src/mono/mono/metadata/w32error.h
已删除
100644 → 0
浏览文件 @
6ac764b3
/**
* \file
*/
#ifndef _MONO_METADATA_W32ERROR_H_
#define _MONO_METADATA_W32ERROR_H_
#include <config.h>
#include <glib.h>
#if !defined(HOST_WIN32)
#define ERROR_SUCCESS 0
#define ERROR_FILE_NOT_FOUND 2
#define ERROR_PATH_NOT_FOUND 3
#define ERROR_TOO_MANY_OPEN_FILES 4
#define ERROR_ACCESS_DENIED 5
#define ERROR_INVALID_HANDLE 6
#define ERROR_NOT_ENOUGH_MEMORY 8
#define ERROR_BAD_FORMAT 11
#define ERROR_INVALID_ACCESS 12
#define ERROR_INVALID_DATA 13
#define ERROR_OUTOFMEMORY 14
#define ERROR_NOT_SAME_DEVICE 17
#define ERROR_NO_MORE_FILES 18
#define ERROR_BAD_LENGTH 24
#define ERROR_SEEK 25
#define ERROR_WRITE_FAULT 29
#define ERROR_GEN_FAILURE 31
#define ERROR_SHARING_VIOLATION 32
#define ERROR_LOCK_VIOLATION 33
#define ERROR_HANDLE_DISK_FULL 39
#define ERROR_NOT_SUPPORTED 50
#define ERROR_DEV_NOT_EXIST 55
#define ERROR_FILE_EXISTS 80
#define ERROR_CANNOT_MAKE 82
#define ERROR_INVALID_PARAMETER 87
#define ERROR_INVALID_NAME 123
#define ERROR_PROC_NOT_FOUND 127
#define ERROR_DIR_NOT_EMPTY 145
#define ERROR_ALREADY_EXISTS 183
#define ERROR_BAD_EXE_FORMAT 193
#define ERROR_FILENAME_EXCED_RANGE 206
#define ERROR_DIRECTORY 267
#define ERROR_IO_PENDING 997
#define ERROR_CANT_RESOLVE_FILENAME 1921
#define ERROR_ENCRYPTION_FAILED 6000
#define WSA_INVALID_PARAMETER ERROR_INVALID_PARAMETER
#define WSA_INVALID_HANDLE ERROR_INVALID_HANDLE
#define WSAEINTR 10004
#define WSAEBADF 10009
#define WSAEACCES 10013
#define WSAEFAULT 10014
#define WSAEINVAL 10022
#define WSAEMFILE 10024
#define WSAEWOULDBLOCK 10035
#define WSAEINPROGRESS 10036
#define WSAEALREADY 10037
#define WSAENOTSOCK 10038
#define WSAEDESTADDRREQ 10039
#define WSAEMSGSIZE 10040
#define WSAEPROTOTYPE 10041
#define WSAENOPROTOOPT 10042
#define WSAEPROTONOSUPPORT 10043
#define WSAESOCKTNOSUPPORT 10044
#define WSAEOPNOTSUPP 10045
#define WSAEAFNOSUPPORT 10047
#define WSAEADDRINUSE 10048
#define WSAEADDRNOTAVAIL 10049
#define WSAENETDOWN 10050
#define WSAENETUNREACH 10051
#define WSAECONNRESET 10054
#define WSAENOBUFS 10055
#define WSAEISCONN 10056
#define WSAENOTCONN 10057
#define WSAESHUTDOWN 10058
#define WSAETIMEDOUT 10060
#define WSAECONNREFUSED 10061
#define WSAELOOP 10062
#define WSAENAMETOOLONG 10063
#define WSAEHOSTDOWN 10064
#define WSAEHOSTUNREACH 10065
#define WSASYSCALLFAILURE 10107
#define WSAENXIO 100001
#endif
guint32
mono_w32error_get_last
(
void
);
void
mono_w32error_set_last
(
guint32
error
);
guint32
mono_w32error_unix_to_win32
(
guint32
error
);
#endif
/* _MONO_METADATA_W32ERROR_H_ */
src/mono/mono/metadata/w32event-unix.c
浏览文件 @
58fa90be
...
...
@@ -10,7 +10,6 @@
#include "w32event.h"
#include "w32error.h"
#include "mono/utils/mono-error-internals.h"
#include "mono/utils/mono-logger-internals.h"
#include "mono/metadata/handle.h"
...
...
@@ -108,17 +107,7 @@ mono_w32event_init (void)
gpointer
mono_w32event_create
(
gboolean
manual
,
gboolean
initial
)
{
/* Need to blow away any old errors here, because code tests
* for ERROR_ALREADY_EXISTS on success (!) to see if an event
* was freshly created */
mono_w32error_set_last
(
ERROR_SUCCESS
);
gpointer
handle
=
event_create
(
manual
,
initial
);
gint32
win32error
=
mono_w32error_get_last
();
g_assert
((
win32error
!=
ERROR_SUCCESS
)
==
!
handle
);
return
handle
;
return
event_create
(
manual
,
initial
);
}
...
...
@@ -140,7 +129,6 @@ static gpointer event_handle_create (MonoW32HandleEvent *event_handle, MonoW32Ty
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
g_warning
(
"%s: error creating %s handle"
,
__func__
,
mono_w32handle_get_typename
(
type
));
mono_w32error_set_last
(
ERROR_GEN_FAILURE
);
return
NULL
;
}
...
...
@@ -181,13 +169,11 @@ mono_w32event_set (gpointer handle)
if
(
!
mono_w32handle_lookup_and_ref
(
handle
,
&
handle_data
))
{
g_warning
(
"%s: unkown handle %p"
,
__func__
,
handle
);
mono_w32error_set_last
(
ERROR_INVALID_HANDLE
);
return
;
}
if
(
handle_data
->
type
!=
MONO_W32TYPE_EVENT
)
{
g_warning
(
"%s: unkown event handle %p"
,
__func__
,
handle
);
mono_w32error_set_last
(
ERROR_INVALID_HANDLE
);
mono_w32handle_unref
(
handle_data
);
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录