[rtems-libbsd commit] sys/kern: Add VFS support

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 7 13:48:24 UTC 2022


Hello Chris,

sorry, this slipped through may review list.

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 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.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list