Skip to content

[stdlib] Enable sendfile on GLibc #4402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

paulofaria
Copy link
Contributor

@paulofaria paulofaria commented Aug 19, 2016

What's in this pull request?

Make sendfile work on Linux Toolchains so all the web frameworks and servers can take advantage of it. Apple Platforms packages already have it (Darwin.POSIX.sys.socket.sendfile).

@glock45 😉


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

A smoke test on macOS does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library only for macOS. Simulator standard libraries and
    device standard libraries are not built.
  3. lldb is not built.
  4. The test and validation-test targets are run only for macOS. The optimized
    version of these tests are not run.

A smoke test on Linux does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library incrementally.
  3. lldb is built incrementally.
  4. The swift test and validation-test targets are run. The optimized version of these
    tests are not run.
  5. lldb is tested.

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

@gribozavr
Copy link
Contributor

Could you add a simple test to validation-test/stdlib/Glibc.swift that verifies that the symbol is available and usable (not necessarily an execution test)?

@paulofaria
Copy link
Contributor Author

paulofaria commented Aug 19, 2016

@gribozavr is this test good enough?

GlibcTestSuite.test("sendfile") {
  expectEqual(type(of: sendfile), ((Int32, Int32, off_t, size_t) -> ssize_t).self)
}

@tkremenek
Copy link
Member

@swift-ci smoke test

@gribozavr
Copy link
Contributor

Could you change it to this?

GlibcTestSuite.test("sendfile") {
  // Check that `sendfile` is available.  Don't actually call it, because doing that is non-trivial.
  var sendfile_ = sendfile
  expectEqual(((Int32, Int32, off_t, size_t) -> ssize_t).self, &sendfile_)
}

@paulofaria
Copy link
Contributor Author

@gribozavr done!

@CodaFi
Copy link
Contributor

CodaFi commented Aug 21, 2016

Please squash this down into one commit.

@paulofaria
Copy link
Contributor Author

@CodaFi I merged master into this branch, so it's incorporating all the intermediate changes. Can't squash merge from GitHub be used?

@CodaFi
Copy link
Contributor

CodaFi commented Aug 21, 2016

I don't have privileges to squash-merge, and it's better if you rebase and squash yourself because you can provide a more detailed message on the commit if you want.

@CodaFi
Copy link
Contributor

CodaFi commented Aug 21, 2016

So that takes care of your half, but can you also squash the Merge commit? It's just noise at this point.

@paulofaria
Copy link
Contributor Author

@CodaFi Sure I can do that, but then all the file changes in the merge commit are incorporated. I'll do it then you'll see.

@paulofaria
Copy link
Contributor Author

@CodaFi done

@CodaFi
Copy link
Contributor

CodaFi commented Aug 22, 2016

git remote add upstream https://github.com/apple/swift.git
git pull --rebase upstream master
git push --force

@CodaFi
Copy link
Contributor

CodaFi commented Aug 22, 2016

If that fails I have just pulled your branch and have a clean patch that I can apply to master for you.

@CodaFi
Copy link
Contributor

CodaFi commented Aug 22, 2016

Bellissimo!

@swift-ci please smoke test macOS platform.

@paulofaria
Copy link
Contributor Author

@CodaFi 😒 forgot I could rebase haha. brainfart.

@paulofaria
Copy link
Contributor Author

@CodaFi yeah this is for Glibc.

@CodaFi
Copy link
Contributor

CodaFi commented Aug 22, 2016

Your changes already passed CI on linux, and I've verified that they work on a Linux box with GlibC locally post-patch. This CI run is to pass the merge requirements.

😉

@paulofaria
Copy link
Contributor Author

@CodaFi Awesome! Thanks a lot man! (:

GlibcTestSuite.test("sendfile") {
// Check that `sendfile` is available. Don't actually call it, because doing that is non-trivial.
var sendfile_ = sendfile
expectEqual(((Int32, Int32, off_t, size_t) -> ssize_t).self, &sendfile_)
Copy link
Contributor

@CodaFi CodaFi Aug 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was running the wrong test suite. This should be

expectEqual(((Int32, Int32, UnsafeMutablePointer<off_t>!, ssize_t) -> ssize_t).self, type(of: sendfile))

@CodaFi CodaFi mentioned this pull request Aug 22, 2016
@CodaFi
Copy link
Contributor

CodaFi commented Aug 22, 2016

Superseded by the merge of #4446. Thank you @paulofaria!

@CodaFi CodaFi closed this Aug 22, 2016
kateinoigakukun added a commit that referenced this pull request Aug 31, 2022
[pull] swiftwasm from main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants