Skip to content
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

util: fix dup2() usage for Linux and Darwin #600

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

bmeneg
Copy link
Collaborator

@bmeneg bmeneg commented Feb 23, 2021

And we have yet another OS-specific issue to solve.
This time is a diff between Linux and Darwin (MacOS):

  • Linux ARM64 lacks DUP2() syscall, so we need to use DUP3(), however...
  • Darwin lacks DUP3(), so we need to create a specific file for it.

Down side of that is: great part of _unix.go file must be replicated in _darwin.go one.
For the sake of getting a new release out of the door, I'm literally copying+pasting the code, but it should (I HOPE) have a better way to handle this "partial" incompatibility.

EDIT: dup3() is available from userspace in Linux ARM64 glibc, but we don't have access to it from Go lib and we can't rely every system uses glibc.

We must create a new Darwin specific file to handle the lack of DUP2()
in Linux ARM64 systems and also the lack of DUP3() in Darwin. In other
words: Linux ARM64 must use DUP3() while Darwin must use DUP2().

Other BSDs have DUP3(), allowing us to use the same Linux file for them.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
@codecov
Copy link

codecov bot commented Feb 23, 2021

Codecov Report

Merging #600 (b6724cf) into master (090ff30) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #600   +/-   ##
=======================================
  Coverage   57.54%   57.54%           
=======================================
  Files          68       68           
  Lines        4350     4350           
=======================================
  Hits         2503     2503           
  Misses       1605     1605           
  Partials      242      242           
Impacted Files Coverage Δ
cmd/util_unix.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 090ff30...b6724cf. Read the comment docs.

@bmeneg bmeneg merged commit bc7d5a4 into zaquestion:master Feb 23, 2021
@bmeneg bmeneg deleted the plat-util branch February 24, 2021 18:00
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.

2 participants