-
Notifications
You must be signed in to change notification settings - Fork 68
Compile on Windows #65
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
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // +build linux darwin | ||
|
|
||
| package continuity | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "syscall" | ||
| ) | ||
|
|
||
| // getUidGidFromFileInfo extracts the user and group IDs from a fileinfo. | ||
| // This is Unix-specific functionality. | ||
| func getUidGidFromFileInfo(fi os.FileInfo) (uint32, uint32, error) { | ||
| // TODO(stevvooe): This need to be resolved for the container's root, | ||
| // where here we are really getting the host OS's value. We need to allow | ||
| // this be passed in and fixed up to make these uid/gid mappings portable. | ||
| // Either this can be part of the driver or we can achieve it through some | ||
| // other mechanism. | ||
| sys, ok := fi.Sys().(*syscall.Stat_t) | ||
| if !ok { | ||
| // TODO(stevvooe): This may not be a hard error for all platforms. We | ||
| // may want to move this to the driver. | ||
| return 0, 0, fmt.Errorf("unable to resolve syscall.Stat_t from (os.FileInfo).Sys(): %#v", fi) | ||
| } | ||
| return sys.Uid, sys.Gid, nil | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package continuity | ||
|
|
||
| import "os" | ||
|
|
||
| // getUidGidFromFileInfo extracts the user and group IDs from a fileinfo. | ||
| // This is Unix-specific functionality. | ||
| func getUidGidFromFileInfo(fi os.FileInfo) (uint32, uint32, error) { | ||
| return 0, 0, nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package continuity | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| ) | ||
|
|
||
| var ( | ||
| errdeviceInfoNotImplemented = fmt.Errorf("deviceInfo not implemented on Windows") | ||
| errLchmodNotImplemented = fmt.Errorf("Lchmod not implemented on Windows") | ||
| errMknodNotImplemented = fmt.Errorf("Mknod not implemented on Windows") | ||
| errMkfifoNotImplemented = fmt.Errorf("Mkfifo not implemented on Windows") | ||
| ) | ||
|
|
||
| func deviceInfo(fi os.FileInfo) (maj uint64, min uint64, err error) { | ||
| return 0, 0, errdeviceInfoNotImplemented | ||
| } | ||
|
|
||
| // Lchmod changes the mode of an file not following symlinks. | ||
| func (d *driver) Lchmod(path string, mode os.FileMode) (err error) { | ||
| return errLchmodNotImplemented | ||
| } | ||
|
|
||
| func (d *driver) Mknod(path string, mode os.FileMode, major, minor int) error { | ||
| return errMknodNotImplemented | ||
| } | ||
|
|
||
| func (d *driver) Mkfifo(path string, mode os.FileMode) error { | ||
| return errMkfifoNotImplemented | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| // +build linux darwin | ||
|
|
||
| package continuity | ||
|
|
||
| import ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| // +build linux darwin | ||
|
|
||
| package continuity | ||
|
|
||
| import ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| package continuity | ||
|
|
||
| import "os" | ||
|
|
||
| // NOTE(stevvooe): Obviously, this is not yet implemented. However, the | ||
| // makings of an implementation are available in src/os/types_windows.go. More | ||
| // investigation needs to be done to figure out exactly how to do this. | ||
|
|
||
| // hardlinkKey provides a tuple-key for managing hardlinks. This is system- | ||
| // specific. | ||
| type hardlinkKey struct { | ||
| } | ||
|
|
||
| // newHardlinkKey returns a hardlink key for the provided file info. If the | ||
| // resource does not represent a possible hardlink, errNotAHardLink will be | ||
| // returned. | ||
| func newHardlinkKey(fi os.FileInfo) (hardlinkKey, error) { | ||
| return hardlinkKey{}, errNotHardLinkImplemented | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there still not an owner and group in msft? We made these strings specifically to be compatible here. Seems odd removing it. How will this data be recovered when used with continuity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UID/GID are very Unix specific. Windows uses ACES in ACLS (https://msdn.microsoft.com/en-us/library/windows/desktop/aa374872(v=vs.85).aspx). Certainly as a longer-term plan, this needs to be considered. However, I wish to re-iterate this is just to get this component to compile on Windows, not to functionally prove it. It allows forward progress on containerd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not foresee putting
ACEsin uid/gid? If not, can we revert these fields to integers?On other systems, I have seen these as strings since they can be used for the ACE identifier, but I may be missing something here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The easiest way to encode an ACL is in SDDL which is essentially a string. See https://msdn.microsoft.com/en-us/library/windows/desktop/aa379567(v=vs.85).aspx. You can see an example of SDDL in the docker code base such as https://github.com/moby/moby/blob/master/pkg/system/filesys_windows.go#L99-L120.
Calling them a
uid or gidis really not appropriate on Windows.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhowardmsft Sounds like we'll need another field...