X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Fshare.h;h=19644f120c0b194b79224088da9f69389986c9fc;hb=7c2caf2b9750e82bf14e6ff39e517afef593c2fe;hp=f674f31f590719915398d56d464e7684b7ddaf14;hpb=fbca6b624335eef18c8d86194aeb101a720168f4;p=lttng-ust.git diff --git a/include/share.h b/include/share.h index f674f31f..19644f12 100644 --- a/include/share.h +++ b/include/share.h @@ -1,34 +1,22 @@ -#ifndef UST_SHARE_H -#define UST_SHARE_H +#ifndef _LTTNG_SHARE_H +#define _LTTNG_SHARE_H -#include -#include - -/* This write is patient because it restarts if it was incomplete. +/* + * Copyright (c) 2011 - Mathieu Desnoyers + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ -static inline ssize_t patient_write(int fd, const void *buf, size_t count) -{ - const char *bufc = (const char *) buf; - int result; - - for(;;) { - result = write(fd, bufc, count); - if(result == -1 && errno == EINTR) { - continue; - } - if(result <= 0) { - return result; - } - count -= result; - bufc += result; - - if(count == 0) { - break; - } - } +#include - return bufc-(const char *)buf; -} +ssize_t patient_write(int fd, const void *buf, size_t count); +ssize_t patient_send(int fd, const void *buf, size_t count, int flags); -#endif /* UST_SHARE_H */ +#endif /* _LTTNG_SHARE_H */