X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Fshare.h;h=19644f120c0b194b79224088da9f69389986c9fc;hb=7c2caf2b9750e82bf14e6ff39e517afef593c2fe;hp=1f2195ee4b1311cfb6218c0331bfecf25f33d641;hpb=2dae156b134735a52d29f544e4c9e12d03baa283;p=lttng-ust.git diff --git a/include/share.h b/include/share.h index 1f2195ee..19644f12 100644 --- a/include/share.h +++ b/include/share.h @@ -1,64 +1,22 @@ -#ifndef UST_SHARE_H -#define UST_SHARE_H - -/* write() */ -#include - -/* send() */ -#include -#include - -#include - -/* This write is patient because it restarts if it was incomplete. +#ifndef _LTTNG_SHARE_H +#define _LTTNG_SHARE_H + +/* + * 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; - } - } - - return bufc-(const char *)buf; -} - -static __inline__ ssize_t patient_send(int fd, const void *buf, size_t count, int flags) -{ - const char *bufc = (const char *) buf; - int result; - - for(;;) { - result = send(fd, bufc, count, flags); - 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 */