Conversation
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
(.circleci yaml CI failure) Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
jmarantz
left a comment
There was a problem hiding this comment.
nice. lgtm with one nit.
test/common/api/os_sys_calls_test.cc
Outdated
| @@ -1,9 +1,65 @@ | |||
| #include <fcntl.h> | |||
There was a problem hiding this comment.
do you need this? Aren't we working entirely with the OSSysCalls abstraction?
There was a problem hiding this comment.
Yeah, it won't build on Windows without it because O_CREAT and O_READWR aren't defined without that header.
There was a problem hiding this comment.
that makes sense. The completist in me makes me want to contemplate having an enum layer in OSSysCalls, but I don't want to burden you with that one here and maybe it's overkill; not sure.
In the meantime can you just add a line-comment like // needed for O_CREAT and O_READRW or similar to this include-line?
There was a problem hiding this comment.
Done. (And I agree - also a real cleanup would do something with unifying this and Alyssa's file abstraction, which has an enum mapping but only for some of the options and in a way that precludes reusing it here. Probably the right solution would be to add all the file operation functionality to the file abstraction, and migrate AsyncFileManager to using that abstraction - that way the Windows side could use HANDLE objects and the functions that work with them, which would mean supporting pwrite and pread style operations would become possible like it currently is not - Windows doesn't have thread-safe read-at-position functions that work on file descriptors.)
|
format issues also /wait |
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
|
/retest |
|
Retrying Azure Pipelines: |
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
| const int rc = ::closesocket(fd); | ||
| return {rc, rc != -1 ? 0 : ::WSAGetLastError()}; | ||
| int rc = ::closesocket(fd); | ||
| const int socket_err = ::WSAGetLastError(); |
There was a problem hiding this comment.
this doesn't appear to be called out in the release note. is it tested in the new test?
There was a problem hiding this comment.
Discussed in Slack; in existing code close is only called where closesocket behavior is fine. My hope is to later change this back and make it explicitly closesocket (for all platforms), and remove everything I've done here after implementing [fstat, pread, pwrite, tmpfiles] in Envoy::Filesystem::File and migrating AsyncFileManager to using that. But getting it in here allows me to make progress elsewhere while that chain of changes is in flight.
| namespace Envoy { | ||
|
|
||
| // Test happy path for `open`, `pwrite`, `pread`, `fstat`, `close`, `stat` and `unlink`. | ||
| TEST(OsSyscallsTest, OpenPwritePreadFstatCloseStatUnlink) { |
There was a problem hiding this comment.
ugh I really want to break these out but you can't really fully test read without write/open, ditto fstat. so yeah can leave as is but if fully testing close requires tweaking anything let's at least add line breaks between the different sections. if close is tested we can merge as-is
There was a problem hiding this comment.
Close is [kind of] tested, in that this new test tests the new path, and existing tests implicitly cover the old path. But it turns out Windows doesn't like to unlink a file that was created without explicit windows-specific permissions flags, so that shot the auto-merge. :(
Mostly just to trigger CI to retry Signed-off-by: Raven Black <ravenblack@dropbox.com>
Signed-off-by: Raven Black <ravenblack@dropbox.com>
Head branch was pushed to by a user without write access
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
|
Retrying Azure Pipelines: |
Commit Message: Add fstat to OsSysCalls
Additional Description: Just another os call wrapper. This functionality will be useful in file system cache implementation.
Risk Level: Very low, not changing any production code paths.
Testing: Added a unit test covering the new function and several others.
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: Identical implementation for Posix and Windows.