|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
|
|
import Foundation
|
|
import Foundation
|
|
|
|
|
|
|
|
-#if os(iOS) || os(Linux)
|
|
|
|
|
|
|
+#if os(iOS) || os(tvOS) || os (Linux)
|
|
|
struct sf_hdtr { }
|
|
struct sf_hdtr { }
|
|
|
|
|
|
|
|
private func sendfileImpl(_ source: UnsafeMutablePointer<FILE>, _ target: Int32, _: off_t, _: UnsafeMutablePointer<off_t>, _: UnsafeMutablePointer<sf_hdtr>, _: Int32) -> Int32 {
|
|
private func sendfileImpl(_ source: UnsafeMutablePointer<FILE>, _ target: Int32, _: off_t, _: UnsafeMutablePointer<off_t>, _: UnsafeMutablePointer<sf_hdtr>, _: Int32) -> Int32 {
|
|
@@ -35,7 +35,7 @@ extension Socket {
|
|
|
var offset: off_t = 0
|
|
var offset: off_t = 0
|
|
|
var sf: sf_hdtr = sf_hdtr()
|
|
var sf: sf_hdtr = sf_hdtr()
|
|
|
|
|
|
|
|
- #if os(iOS) || os(Linux)
|
|
|
|
|
|
|
+ #if os(iOS) || os(tvOS) || os (Linux)
|
|
|
let result = sendfileImpl(file.pointer, self.socketFileDescriptor, 0, &offset, &sf, 0)
|
|
let result = sendfileImpl(file.pointer, self.socketFileDescriptor, 0, &offset, &sf, 0)
|
|
|
#else
|
|
#else
|
|
|
let result = sendfile(fileno(file.pointer), self.socketFileDescriptor, 0, &offset, &sf, 0)
|
|
let result = sendfile(fileno(file.pointer), self.socketFileDescriptor, 0, &offset, &sf, 0)
|