27 vtFatal("vtMemAlloc: out of memory");
28 setmalloctag(p, getcallerpc(&size));
35 void *p = vtMemAlloc(size);
37 setmalloctag(p, getcallerpc(&size));
42 vtMemRealloc(void *p, int size)
45 return vtMemAlloc(size);
48 vtFatal("vtRealloc: out of memory");
49 setrealloctag(p, getcallerpc(&size));
64 if(n >= IdealAlignment)
65 align = IdealAlignment;
72 pad = (align - (uintptr)buf) & (align-1);
74 buf = vtMemAllocZ(ChunkSize);
75 setmalloctag(buf, getcallerpc(&n));
77 pad = (align - (uintptr)buf) & (align-1);
81 assert(n + pad <= nbuf);
92 vtThreadSetName(char *name)
97 sprint(buf, "/proc/%d/args", getpid());
98 if((fd = open(buf, OWRITE)) >= 0){
99 write(fd, name, strlen(name));
105 vtFdRead(int fd, uchar *buf, int n)
107 n = read(fd, buf, n);
113 vtSetError("unexpected EOF");
120 vtFdWrite(int fd, uchar *buf, int n)
124 nn = write(fd, buf, n);
130 vtSetError("truncated write");
145 return vtSetError("%r");