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

posix updates #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

thehesiod
Copy link

@thehesiod thehesiod commented Sep 24, 2016

  • 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
Copy link
Author

@thehesiod thehesiod left a 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);
Copy link
Author

@thehesiod thehesiod Sep 24, 2016

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;
Copy link
Author

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;
}
Copy link
Author

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);
Copy link
Author

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;
Copy link
Author

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;
}

Copy link
Author

@thehesiod thehesiod Sep 24, 2016

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

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.

1 participant