Move immediate.h, marker.h and tracepoint.h to include/ust/
[ust.git] / share / share.h
1 #ifndef UST_SHARE_H
2 #define UST_SHARE_H
3
4 #include <unistd.h>
5 #include <errno.h>
6
7 /* This write is patient because it restarts if it was incomplete.
8 */
9
10 static inline ssize_t patient_write(int fd, const void *buf, size_t count)
11 {
12 const char *bufc = (const char *) buf;
13 int result;
14
15 for(;;) {
16 result = write(fd, bufc, count);
17 if(result == -1 && errno == EINTR) {
18 continue;
19 }
20 if(result <= 0) {
21 return result;
22 }
23 count -= result;
24 bufc += result;
25
26 if(count == 0) {
27 break;
28 }
29 }
30
31 return bufc-(const char *)buf;
32 }
33
34 #endif /* UST_SHARE_H */
This page took 0.02927 seconds and 4 git commands to generate.