Commit Graph
8 Commits
Author SHA1 Message Date
Johannes Weiss 215620d7a6 syscall wrapper: don't do an allocation for every failed syscall 2017-12-07 15:37:12 +00:00
Norman Maurer 5475ba069a Add docs for IO and Selectable and also rename error parameter name to errorCode to ensure we not capture errno by mistake.
Motivation:

Explain here the context, and why you're making that change.
What is the problem you're trying to solve.

Modifications:

Describe the modifications you've done.

Result:

After your change, what will change.
2017-12-05 15:44:50 +01:00
Norman Maurer 68a475b37a Rename IOError.errno to IOError.errnoCode as errno is always in scope 2017-11-17 15:45:12 +01:00
Norman Maurer 854aea060e Not creating IOError for EWOULDBLOCK
Motivation:

Creating an IOError is not "cheap" as we use String formatting to do so. In cases of EWOULDBLOCK we will never use the IOError at the end so we should not even create one.

Modifications:

Handle EWOUDLBOCK without creating and IOError

Result:

Less overhead when a syscall will fail because it would block
2017-11-17 13:06:29 +01:00
Norman Maurer f6d9bcc701 Make check for blacklisted errno an assert
Motivation:

Checking for blacklisted errno values should be an assert and not a precondition as this would signal a bug in our code itself and not something bad the user was doing. Also this will make the code smaller when compiling in release mode.

Modifications:

Change the blacklist check to be an assert.

Result:

Only check for blacklisted errno when asserts are enabled.
2017-11-17 08:20:50 +01:00
Johannes Weiß 936e812b32 make system call wrapper fast & test it 2017-11-16 15:42:03 +00:00
Norman Maurer e67fc995cf Remove external depencies
Motivation:

We had a few external dependencies that were mainly used to include header files.

Modifications:

Add extra modules that will be used to export these headers.

Result:

Less external dependencies.
2017-11-16 15:20:13 +01:00
Norman Maurer ba35fcb5a5 Move all syscalls that also need to handle errno in an extra file and ensure we not get any problems with invalid errno handling
* Move all syscalls that also need to handle errno in an extra file and ensure we not get any problems with invalid errno handling

Motivation:

Because it is possible ARC cause an syscall and so set the errno value we need to ensure no ARC can ever happen before we were able to read the errno value that was caused by an syscall we made.

Modifications:

Move all syscalls to an extra file (System.swift) and ensure all exposed methods are marked with `@inline(never)` and not capture any classes. This ensures no ARC can ever happen.

Result:

Be able to safely read errno if needed.

* Comments
2017-11-16 16:41:19 +01:00