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); } }
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 */ }