sys/newlib: Bugfix, add missing syscalls (only stubs)#9090
sys/newlib: Bugfix, add missing syscalls (only stubs)#9090danpetry merged 1 commit intoRIOT-OS:masterfrom
Conversation
| clock_t _times(struct tms *ptms) | ||
| { | ||
| memset(ptms, 0, sizeof(*ptms)); | ||
|
|
There was a problem hiding this comment.
does errno have to be cleared? Spec says, errno indicates error on error...
There was a problem hiding this comment.
@kaspar030 You are right, this is an example from libgloss (part of newlib):
/* _times -- no clock, so return an error. */
clock_t _times (struct tms *buf)
{
errno = EINVAL;
return (-1);
}
I'm fixing it.
|
please squash |
2f0e331 to
f373803
Compare
|
@jcarrano The build failed, because of unused parameters. You can mark them as unused by adding |
f373803 to
ef68f86
Compare
| { | ||
| (void)ptms; | ||
|
|
||
| errno = EINVAL; |
There was a problem hiding this comment.
Shouldn't this also use the errno variable from struct reent?
There was a problem hiding this comment.
I copied it from libgloss, which is part of newlib.
ef68f86 to
171170c
Compare
|
@kaspar030 I changed over to |
171170c to
c04e782
Compare
c04e782 to
a614c10
Compare
Add small stubs for _times_r and _link_r so that code using times() or link() can still compile. The functions are marked as not implemented and return invalid codes.
a614c10 to
cce83b4
Compare
|
@jcarrano any news on this? |
|
@jia200x I addressed @kaspar030 review and squashed. Btw, I'm also working intermittently on what I think is a better fix (#9258 ), but this one should work for now. |
|
@kaspar030 do changes satisfy your concerns? |
danpetry
left a comment
There was a problem hiding this comment.
OK I'm satisfied with the approach here, on the basis that it replicates the approach elsewhere and that that approach is being addressed more comprehensively in #9258. Implementation is also consistent with other functions in the module. Also, the added functions aren't actually used elsewhere meaning, for example, they won't have a memory impact anywhere except in the Lua interpreter. Would be good to address the above PR ASAP to avoid errors if other people try to use the related newlib functions.
Add small stubs for _times and _link_r so that code using times() or link()/rename() can still compile. The functions are marked as not implemented and return invalid codes.
Issues/PRs references
Fixes #9051 .