size_t __wrap_write(int channel, void* data, int size) { short* d = (short*) data; short c = 0; // for some reasons it does not work with chars for (int i=0; i<(size/2); ++i) { c |= d[i]; } c |= (short) ((char*) data)[size-1]; if (c) { __real_write(channel, data, size); } else { __real_write(channel, data, size); } }
ssize_t __wrap_write(int fd, const void *buf, size_t nbyte) { if (fd >= __pse51_rtdm_fd_start) { int ret, oldtype; pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); ret = set_errno(XENOMAI_SKINCALL3(__pse51_rtdm_muxid, __rtdm_write, fd - __pse51_rtdm_fd_start, buf, nbyte)); pthread_setcanceltype(oldtype, NULL); return ret; } else return __real_write(fd, buf, nbyte); }