[rtems-libbsd commit] sys/kern: Add VFS support
Chris Johns
chrisj at rtems.org
Tue Feb 8 10:07:38 UTC 2022
On 8/2/22 12:48 am, Sebastian Huber wrote:
> Hello Chris,
>
> sorry, this slipped through may review list.
Thanks for the review.
>
> On 02/09/2021 04:43, Chris Johns wrote:
>> @@ -1232,9 +993,6 @@ osendmsg(struct thread *td, struct osendmsg_args *uap)
>> #endif
>> #endif /* __rtems__ */
>> -#ifdef __rtems__
>> -static
>> -#endif /* __rtems__ */
>> int
>> sys_sendmsg(struct thread *td, struct sendmsg_args *uap)
>> {
>> @@ -1257,35 +1015,7 @@ sys_sendmsg(struct thread *td, struct sendmsg_args *uap)
>> free(iov, M_IOV);
>> return (error);
>> }
>> -#ifdef __rtems__
>> -ssize_t
>> -sendmsg(int socket, const struct msghdr *message, int flags)
>> -{
>> - struct thread *td = rtems_bsd_get_curthread_or_null();
>> - struct sendmsg_args ua = {
>> - .s = socket,
>> - .msg = message,
>> - .flags = flags
>> - };
>> - int error;
>> -
>> - if (td != NULL) {
>> - error = sys_sendmsg(td, &ua);
>> - } else {
>> - error = ENOMEM;
>> - }
>> -
>> - if (error == 0) {
>> - return td->td_retval[0];
>> - } else {
>> - rtems_set_errno_and_return_minus_one(error);
>> - }
>> -}
>> -#endif /* __rtems__ */
>
> Why did you move all these system call implementations for RTEMS into a separate
> file? The sys_sendmsg() was a static function so the compiler was able to
> optimize the use of struct sendmsg_args away and there was no function call
> overhead. In the successful case the return value was determined by
> td->td_retval[0]. I don't think this now the case?
>
> ssize_t
> sendmsg(int socket, const struct msghdr *message, int flags)
> {
> struct thread *td = rtems_bsd_get_curthread_or_null();
> struct sendmsg_args ua;
> int ffd;
> int error;
> if (RTEMS_BSD_SYSCALL_TRACE) {
> printf("bsd: sys: sendmsg: %d\n", socket);
> }
> if (td == NULL) {
> return rtems_bsd_error_to_status_and_errno(ENOMEM);
> }
> ffd = rtems_bsd_libio_iop_hold(socket, NULL);
> if (ffd < 0) {
> return rtems_bsd_error_to_status_and_errno(EBADF);
> }
> ua.s = ffd;
> ua.msg = message;
> ua.flags = flags;
> error = sys_sendmsg(td, &ua);
> rtems_bsd_libio_iop_drop(socket);
> return rtems_bsd_error_to_status_and_errno(error);> }
>
> Unfortunately syscalls01 only tests error conditions and not a good case.
It looks like a bug. I think there should be a check of `error` after the drop
and the call's result returned.
> It seems that the commit is not present in the master branch. This means all the
> work will be lost when we update to a newer FreeBSD baseline.
Yes. It is an out standing task that I need to get funding for.
What are your plans and if you are looking to update, timeline?
Chris
More information about the devel
mailing list