Skip to content

Commit cd522ff

Browse files
[wasm] Port NSError.swift for WASI
1 parent c890a55 commit cd522ff

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Sources/Foundation/NSError.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ extension POSIXError {
10381038
/// Bad address.
10391039
public static var EFAULT: POSIXError.Code { return .EFAULT }
10401040

1041-
#if !os(Windows)
1041+
#if !os(Windows) && !os(WASI)
10421042
/// Block device required.
10431043
public static var ENOTBLK: POSIXError.Code { return .ENOTBLK }
10441044
#endif
@@ -1141,18 +1141,22 @@ extension POSIXError {
11411141
/// Protocol not supported.
11421142
public static var EPROTONOSUPPORT: POSIXError.Code { return .EPROTONOSUPPORT }
11431143

1144+
#if !os(WASI)
11441145
/// Socket type not supported.
11451146
public static var ESOCKTNOSUPPORT: POSIXError.Code { return .ESOCKTNOSUPPORT }
11461147
#endif
1148+
#endif
11471149

11481150
#if canImport(Darwin)
11491151
/// Operation not supported.
11501152
public static var ENOTSUP: POSIXError.Code { return .ENOTSUP }
11511153
#endif
11521154

11531155
#if !os(Windows)
1156+
#if !os(WASI)
11541157
/// Protocol family not supported.
11551158
public static var EPFNOSUPPORT: POSIXError.Code { return .EPFNOSUPPORT }
1159+
#endif
11561160

11571161
/// Address family not supported by protocol family.
11581162
public static var EAFNOSUPPORT: POSIXError.Code { return .EAFNOSUPPORT }
@@ -1191,11 +1195,13 @@ extension POSIXError {
11911195
/// Socket is not connected.
11921196
public static var ENOTCONN: POSIXError.Code { return .ENOTCONN }
11931197

1198+
#if !os(WASI)
11941199
/// Can't send after socket shutdown.
11951200
public static var ESHUTDOWN: POSIXError.Code { return .ESHUTDOWN }
11961201

11971202
/// Too many references: can't splice.
11981203
public static var ETOOMANYREFS: POSIXError.Code { return .ETOOMANYREFS }
1204+
#endif
11991205

12001206
/// Operation timed out.
12011207
public static var ETIMEDOUT: POSIXError.Code { return .ETIMEDOUT }
@@ -1211,8 +1217,10 @@ extension POSIXError {
12111217
public static var ENAMETOOLONG: POSIXError.Code { return .ENAMETOOLONG }
12121218

12131219
#if !os(Windows)
1220+
#if !os(WASI)
12141221
/// Host is down.
12151222
public static var EHOSTDOWN: POSIXError.Code { return .EHOSTDOWN }
1223+
#endif
12161224

12171225
/// No route to host.
12181226
public static var EHOSTUNREACH: POSIXError.Code { return .EHOSTUNREACH }
@@ -1229,16 +1237,18 @@ extension POSIXError {
12291237
#endif
12301238

12311239
#if !os(Windows)
1240+
#if !os(WASI)
12321241
/// Too many users.
12331242
public static var EUSERS: POSIXError.Code { return .EUSERS }
1243+
#endif
12341244

12351245
/// Disk quota exceeded.
12361246
public static var EDQUOT: POSIXError.Code { return .EDQUOT }
12371247
#endif
12381248

12391249
/// Network File System
12401250

1241-
#if !os(Windows)
1251+
#if !os(Windows) && !os(WASI)
12421252
/// Stale NFS file handle.
12431253
public static var ESTALE: POSIXError.Code { return .ESTALE }
12441254

@@ -1346,23 +1356,27 @@ extension POSIXError {
13461356
/// Reserved.
13471357
public static var EMULTIHOP: POSIXError.Code { return .EMULTIHOP }
13481358

1359+
#if !os(WASI)
13491360
/// No message available on STREAM.
13501361
public static var ENODATA: POSIXError.Code { return .ENODATA }
1362+
#endif
13511363

13521364
/// Reserved.
13531365
public static var ENOLINK: POSIXError.Code { return .ENOLINK }
13541366

1367+
#if !os(WASI)
13551368
/// No STREAM resources.
13561369
public static var ENOSR: POSIXError.Code { return .ENOSR }
13571370

13581371
/// Not a STREAM.
13591372
public static var ENOSTR: POSIXError.Code { return .ENOSTR }
13601373
#endif
1374+
#endif
13611375

13621376
/// Protocol error.
13631377
public static var EPROTO: POSIXError.Code { return .EPROTO }
13641378

1365-
#if !os(OpenBSD)
1379+
#if !os(OpenBSD) && !os(WASI)
13661380
/// STREAM ioctl timeout.
13671381
public static var ETIME: POSIXError.Code { return .ETIME }
13681382
#endif

0 commit comments

Comments
 (0)