Skip to content

Commit

Permalink
Compilation for epoll system
Browse files Browse the repository at this point in the history
Former-commit-id: bee20b5
  • Loading branch information
kjessup committed Apr 20, 2016
1 parent abedaea commit f241368
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 88 deletions.
4 changes: 0 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ let package = Package(
targets: [
Target(name: "PerfectLib", dependencies: [
.Target(name: "OpenSSL"),
.Target(name: "ICU"),
.Target(name: "cURL"),
.Target(name: "LinuxBridge")]),
Target(name: "OpenSSL"),
Target(name: "ICU"),
Target(name: "cURL"),
Target(name: "LinuxBridge")
],
Expand All @@ -41,10 +39,8 @@ let package = Package(
targets: [
Target(name: "PerfectLib", dependencies: [
.Target(name: "OpenSSL"),
.Target(name: "ICU"),
.Target(name: "cURL")]),
Target(name: "OpenSSL"),
Target(name: "ICU"),
Target(name: "cURL"),
Target(name: "PerfectLibTests", dependencies: [.Target(name: "PerfectLib")])
],
Expand Down
3 changes: 0 additions & 3 deletions Sources/ICU/icu.c

This file was deleted.

4 changes: 0 additions & 4 deletions Sources/ICU/include/module.modulemap

This file was deleted.

66 changes: 0 additions & 66 deletions Sources/ICU/include/p_icu.h

This file was deleted.

18 changes: 8 additions & 10 deletions Sources/PerfectLib/NetEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class NetEvent {

enum Filter {
case None, Error(Int32), Read, Write, Timer

#if os(Linux)
var epollEvent: UInt3 {
var epollEvent: UInt32 {
switch self {
case .Read:
return EPOLLIN.rawValue
Expand Down Expand Up @@ -124,7 +124,7 @@ class NetEvent {
let q = Threading.getQueue("NetEvent", type: .Serial)
q.dispatch {
while true {

#if os(Linux)
let nev = Int(epoll_wait(self.kq, self.evlist, Int32(self.numEvents), -1))
#else
Expand All @@ -142,16 +142,14 @@ class NetEvent {
#if os(Linux)
let sock = SocketType(evt.data.fd)
var filter = Filter.None
if (evt.events & EPOLLERR) != 0 {
if (evt.events & EPOLLERR.rawValue) != 0 {
var errData = Int32(0)
if error {
var errLen = socklen_t(sizeof(Int32))
getsockopt(sock, SOL_SOCKET, SO_ERROR, &errData, &errLen)
}
var errLen = socklen_t(sizeof(Int32))
getsockopt(sock, SOL_SOCKET, SO_ERROR, &errData, &errLen)
filter = .Error(errData)
} else if (evt.events & EPOLLIN) != 0 {
} else if (evt.events & EPOLLIN.rawValue) != 0 {
filter = .Read
} else if (evt.events & EPOLLOUT) != 0 {
} else if (evt.events & EPOLLOUT.rawValue) != 0 {
filter = .Write
}
#else
Expand Down
5 changes: 4 additions & 1 deletion Sources/PerfectLib/Utilities-Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
//===----------------------------------------------------------------------===//
//

#if os(Linux)
import SwiftGlibc
#endif

extension UnicodeScalar {

/// Returns true if the UnicodeScalar is a white space character
Expand Down Expand Up @@ -44,4 +48,3 @@ extension UnicodeScalar {
}
}
}

0 comments on commit f241368

Please sign in to comment.