-
Notifications
You must be signed in to change notification settings - Fork 115
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
Preliminary native windows support, part 2: standard library and libgerbil #1291
base: master
Are you sure you want to change the base?
Conversation
👷 Deploy request for elastic-ritchie-8f47f9 pending review.Visit the deploys page to approve it
|
@fare first pass again? |
General notes
|
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.
LGTM modulo a few minor changes.
Apologies for the delay
@@ -40,6 +40,13 @@ | |||
|
|||
(begin-ffi (_pipe make_pipe_ptr pipe_ptr_ref) | |||
(c-declare "#include <unistd.h>") | |||
(c-declare " |
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.
Shouldn't we be returning -1 for failure?
#define LOCK_NB 3 | ||
int flock(int fd, int op) { | ||
return 0; | ||
} |
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.
Return -1 for error
src/std/os/fdio.ss
Outdated
(c-declare " | ||
#ifdef _WINDOWS | ||
int fsync(int fd) { | ||
return 0; |
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.
Return -1 for error
src/std/os/fcntl.ss
Outdated
(c-declare " | ||
#ifdef _WINDOWS | ||
int fcntl (int __fd, int __cmd, ...) { | ||
return 0; |
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.
Return -1 for error
src/std/os/_socket.scm
Outdated
@@ -565,6 +582,9 @@ int ffi_socket_sendmsg (int fd, ___SCMOBJ name, ___SCMOBJ io, ___SCMOBJ ctl, int | |||
msg.msg_flags = 0; | |||
|
|||
return sendmsg (fd, &msg, flags); | |||
#else | |||
return 0; |
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.
Return -1 for error
src/std/os/signal.ss
Outdated
(c-declare " | ||
#ifdef _WINDOWS | ||
int kill(int pid, int signo) { | ||
return 0; |
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.
Return -1 for error
OK for the name, I guess. Beware about the return values, though. I left comments on the patch at ef77b8c |
I've corrected the return values (including a few you didn't mention) in the latest commit. Did you find anything missing? |
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.
Almost there.
src/std/build-spec.ss
Outdated
(gxc: "os/fcntl" ,@(include-gambit-sharp)) | ||
(gxc: "os/flock" ,@(include-gambit-sharp)) | ||
(gxc: "os/pipe" ,@(include-gambit-sharp)) | ||
(gxc: "os/fd" ,@(include-gambit-sharp)) |
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.
Don't introduce spurious whitespace
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.
Oops. I was trying to make it prettier and easier to compare them. I'll remove it
@@ -624,6 +645,9 @@ int ffi_socket_recvmsg (int fd, ___SCMOBJ name, int *rname, ___SCMOBJ io, ___SCM | |||
*rflags = msg.msg_flags; | |||
|
|||
return r; | |||
#else | |||
return -1; |
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.
Maybe we should also errno = EINVAL;
or ERROR_NOT_SUPPORTED
whenever we return -1;
like that so that the error message will be appropriate (unless there's a better E code under Windows)—if it's ERROR_NOT_SUPPORTED
we need it defined on the Scheme side, too.
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.
I'm not a systems programmer (I mostly work on algorithms, graphics, gamedev etc) so finding the "right thing to do" is difficult for me... But since I'll summarize current supported/unsupported things in the upcoming PR (documents and scripts), can we leave these problems for the future?
Much more changes this time :)