Example #1
0
void pse51_clock_init(int muxid)
{
	int err = -XENOMAI_SYSCALL2(__xn_sys_info, muxid, &__pse51_sysinfo);
	if (err) {
		fprintf(stderr, "Xenomai Posix skin init: "
			"sys_info: %s\n", strerror(err));
		exit(EXIT_FAILURE);
	}
}
Example #2
0
static void xeno_init_vdso(void)
{
	xnsysinfo_t sysinfo;
	int err;

	err = XENOMAI_SYSCALL2(__xn_sys_info, 0, &sysinfo);
	if (err < 0) {
		errno = -err;
		perror("Xenomai: sys_info failed");
		exit(EXIT_FAILURE);
	}

	nkvdso = (struct xnvdso *)(xeno_sem_heap[SHARED] + sysinfo.vdso);
}
Example #3
0
static void *map_sem_heap(unsigned int shared)
{
	struct xnheap_desc global_hdesc, *hdesc;
	int ret;

	hdesc = shared ? &global_hdesc : &private_hdesc;
	ret = XENOMAI_SYSCALL2(__xn_sys_heap_info, hdesc, shared);
	if (ret < 0) {
		errno = -ret;
		perror("Xenomai: sys_heap_info");
		return MAP_FAILED;
	}

	return xeno_map_heap(hdesc);
}
Example #4
0
unsigned long long get_used(void)
{
	unsigned long long used = 0;
	struct xnheap_desc hd;
	int i;

	for (i = 0; XENOMAI_SYSCALL2(__xn_sys_heap_info, &hd, i) == 0; i++)
		used += hd.used;

	if (used == 0) {
		rt_fprintf(stderr, "Error: could not get size of used memory\n");
		exit(EXIT_FAILURE);
	}

	return used;
}
Example #5
0
static void *uitron_task_trampoline(void *cookie)
{
	struct uitron_task_iargs *iargs = (struct uitron_task_iargs *)cookie;
	struct sched_param param;
	unsigned long mode_offset;
	void (*entry)(INT);
	int policy;
	long err;
	INT arg;

	/*
	 * Apply sched params here as some libpthread implementations
	 * fail doing this properly via pthread_create.
	 */
	policy = uitron_task_set_posix_priority(iargs->pk_ctsk->itskpri, &param);
	pthread_setschedparam(pthread_self(), policy, &param);

	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
	xeno_sigshadow_install_once();

	err = XENOMAI_SKINCALL4(__uitron_muxid,
				__uitron_cre_tsk,
				iargs->tskid, iargs->pk_ctsk,
				iargs->completionp, &mode_offset);
	if (err)
		goto fail;

	xeno_set_current();
	xeno_set_current_mode(mode_offset);

	/* iargs->pk_ctsk might not be valid anymore, after our parent
	   was released from the completion sync, so do not
	   dereference this pointer. */

	do
		err = XENOMAI_SYSCALL2(__xn_sys_barrier, &entry, &arg);
	while (err == -EINTR);

	if (!err)
		entry(arg);

      fail:

	return (void *)err;
}
Example #6
0
int __cobalt_serial_debug(const char *fmt, ...)
{
	char msg[128];
	va_list ap;
	int n, ret;

	/*
	 * The serial debug output handler disables hw IRQs while
	 * writing to the UART console port, so the message ought to
	 * be reasonably short.
	 */
	va_start(ap, fmt);
	n = vsnprintf(msg, sizeof(msg), fmt, ap);
	ret = XENOMAI_SYSCALL2(sc_nucleus_serialdbg, msg, n);
	va_end(ap);

	return ret;
}
Example #7
0
static __constructor__ void __init_xeno_interface(void)
{
	u_long err, tid;

	__psos_muxid = xeno_bind_skin(PSOS_SKIN_MAGIC, "psos", "xeno_psos");

	err = XENOMAI_SYSCALL2(__xn_sys_info, __psos_muxid, &__psos_sysinfo);

	if (err) {
		fprintf(stderr, "Xenomai pSOS skin init: cannot retrieve sysinfo, status %ld", err);
		exit(EXIT_FAILURE);
	}

	__psos_muxid = __xn_mux_shifted_id(__psos_muxid);

	/* Shadow the main thread. */
	err = t_shadow("MAIN", 0, 0, &tid);

	if (err) {
		fprintf(stderr, "Xenomai pSOS skin init: t_shadow() failed, status %ld", err);
		exit(EXIT_FAILURE);
	}
}
Example #8
0
void __init_xeno_interface(void)
{
	u_long err, tid;

	__psos_muxid = xeno_bind_skin(PSOS_SKIN_MAGIC, "psos", "xeno_psos");

	err = XENOMAI_SYSCALL2(__xn_sys_info, __psos_muxid, &__psos_sysinfo);

	if (err) {
		fprintf(stderr, "Xenomai pSOS skin init: cannot retrieve sysinfo, status %ld", err);
		exit(EXIT_FAILURE);
	}

	__psos_muxid = __xn_mux_shifted_id(__psos_muxid);

	/* Shadow the main thread. mlock the whole memory for the time
	   of the syscall, in order to avoid the SIGXCPU signal. */
	if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
		perror("Xenomai pSOS skin init: mlockall() failed");
		exit(EXIT_FAILURE);
	}

	err = t_shadow("MAIN", 0, 0, &tid);

	if (err) {
		fprintf(stderr, "Xenomai pSOS skin init: t_shadow() failed, status %ld", err);
		exit(EXIT_FAILURE);
	}

#ifndef CONFIG_XENO_PSOS_AUTO_MLOCKALL
	if (munlockall()) {
		perror("Xenomai pSOS skin init: munlockall");
		exit(EXIT_FAILURE);
	}
#endif /* !CONFIG_XENO_PSOS_AUTO_MLOCKALL */
}
Example #9
0
int xntrace_user_stop(unsigned long v)
{
	return XENOMAI_SYSCALL2(__xn_sys_trace, __xntrace_op_user_stop, v);
}
Example #10
0
int xntrace_max_end(unsigned long v)
{
	return XENOMAI_SYSCALL2(__xn_sys_trace, __xntrace_op_max_end, v);
}
Example #11
0
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 */
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/timerfd.h>
#include <asm/xenomai/syscall.h>
#include "internal.h"

COBALT_IMPL(int, timerfd_create, (int clockid, int flags))
{
	int fd;

	fd = XENOMAI_SYSCALL2(sc_cobalt_timerfd_create, clockid, flags);
	if (fd < 0) {
		errno = -fd;
		return -1;
	}
	
	return fd;
}

COBALT_IMPL(int, timerfd_settime, (int fd, int flags,
		const struct itimerspec *new_value,
		struct itimerspec *old_value))
{
	int ret;
	
	ret = -XENOMAI_SYSCALL4(sc_cobalt_timerfd_settime,