-
Notifications
You must be signed in to change notification settings - Fork 5
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
posix updates #1
base: master
Are you sure you want to change the base?
Conversation
thehesiod
commented
Sep 24, 2016
•
edited
Loading
edited
- fixes open/close etc functions
- fixes COND_TIMED_WAIT error value
- makes printfs debug only
- fixes headers for POSIX
- does more error checking on windows methods
- fixes param issues on posix
- does string length checking for temp paths
- adds mq_sendtimed
- correctly marks threaded notifications as not supported
- fixes open/close etc functions - fixes COND_TIMED_WAIT error value - makes printfs debug only - fixes headers for POSIX - does more error checking on windows methods - fixes param issues on posix - does string length checking for temp paths - adds mq_sendtimed
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.
Comments based on my changes
int COND_SIGNAL(struct mq_hdr* hdr) | ||
{ | ||
SetEvent(hdr->mqh_wait); | ||
return 0; | ||
BOOL result = SetEvent(hdr->mqh_wait); |
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.
SetEvent success is non-zero, however pthread_cond_signal is 0 on success, it should match pthread_cond_signal. Of Interested is that the return value is currently not checked
return ETIMEDOUT; | ||
} | ||
|
||
return EINVAL; |
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.
this method needed to return an error value similar to pthread_cond_timedwait
strcpy(pathBuffer, temp); | ||
strcat(pathBuffer, pathPart); | ||
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.
This now does error checking on the string length
/* open and specify O_EXCL and user-execute */ | ||
oflag &= ~3; // strip off RDONLY, WRONLY or RDWR bits | ||
fd = _open(pathBuffer, oflag | O_EXCL | O_RDWR, mode | S_IXUSR); | ||
fd = open(pathBuffer, oflag | O_EXCL | O_RDWR, mode | S_IXUSR); |
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.
need to keep the names posix compatible
} | ||
|
||
if(n != 0) { | ||
errno = n; |
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.
callers expect the errno to be set
@@ -477,33 +559,36 @@ ssize_t mq_timedreceive(mqd_t mqd, char *ptr, | |||
errno = EMSGSIZE; | |||
goto err; | |||
} | |||
|
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 the MUTEX_LOCK above also be timed? If so the same should be done in the timed send