/lxc/src/include/ |
H A D | getline.c | 42 size_t len; local 44 buf = fgetln(fp, &len); 50 if (*outbuf == NULL || *outsize < len + 1) { 51 void *tmp = realloc(*outbuf, len + 1); 55 *outsize = len + 1; 57 memcpy(*outbuf, buf, len); 58 (*outbuf)[len] = '\0'; 59 return (len);
|
/lxc/src/tests/ |
H A D | getkeys.c | 35 int len, ret; local 46 len = c->get_keys(c, NULL, NULL, 0); 47 if (len < 0) { 48 fprintf(stderr, "%d: failed to get length of all keys (%d)\n", __LINE__, len); 52 ret = c->get_keys(c, NULL, v3, len+1); 53 if (ret != len) {
|
H A D | get_item.c | 113 int len; local 114 len = c->get_config_item(c, "lxc.utsname", NULL, 0); // query the size of the string 115 if (len < 0) { 116 fprintf(stderr, "%d: get_config_item(lxc.utsname) returned %d\n", __LINE__, len); 119 printf("lxc.utsname returned %d\n", len); 122 alloced = malloc(len+1); 124 fprintf(stderr, "%d: failed to allocate %d bytes for utsname\n", __LINE__, len); 129 ret = c->get_config_item(c, "lxc.utsname", alloced, len+1); 134 if (strcmp(alloced, HNAME) != 0 || ret != len) { 135 fprintf(stderr, "lxc.utsname returned wrong value: %d %s not %d %s\n", ret, alloced, len, HNAM [all...] |
H A D | startone.c | 104 int len; local 132 len = c->get_cgroup_item(c, "cpuset.cpus", buf, 200); 133 if (len >= 0) { 180 len = c->get_cgroup_item(c, "cpuset.cpus", buf, 0); 181 if (len <= 0) { 182 fprintf(stderr, "%d: not able to get length of cpuset.cpus (ret %d)\n", __LINE__, len); 186 len = c->get_cgroup_item(c, "cpuset.cpus", buf, 200); 187 if (len <= 0 || strncmp(buf, "0", 1)) { 188 fprintf(stderr, "%d: not able to get cpuset.cpus (len %d buf %s)\n", __LINE__, len, bu [all...] |
/lxc/src/lxc/ |
H A D | parse.c | 43 size_t len = 0; local 51 while (getline(&line, &len, f) != -1) { 67 int lxc_char_left_gc(const char *buffer, size_t len) argument 70 for (i = 0; i < len; i++) { 79 int lxc_char_right_gc(const char *buffer, size_t len) argument 82 for (i = len - 1; i >= 0; i--) { 96 size_t len = strlen(line); local 98 for (i = 0; i < len; i++)
|
H A D | genl.c | 42 int len, ret; local 76 len = reply->nlmsghdr.nlmsg_len; 86 len -= NLMSG_LENGTH(GENL_HDRLEN); 87 if (len < 0) 143 size_t len = NLMSG_LENGTH(GENL_HDRLEN) + size; local 144 return (struct genlmsg *)nlmsg_alloc(len);
|
H A D | af_unix.c | 40 size_t len; local 58 len = strlen(&path[1]); 60 if (len >= sizeof(addr.sun_path)) { 68 if (bind(fd, (struct sockaddr *)&addr, offsetof(struct sockaddr_un, sun_path) + len + 1)) { 102 size_t len; local 113 len = strlen(&path[1]); 115 if (len >= sizeof(addr.sun_path)) { 123 if (connect(fd, (struct sockaddr *)&addr, offsetof(struct sockaddr_un, sun_path) + len + 1)) {
|
H A D | state.c | 61 size_t len; local 63 len = sizeof(strstate)/sizeof(strstate[0]); 64 for (i = 0; i < len; i++)
|
H A D | initutils.c | 72 int len = strlen(p); local 75 if (len < 1) 77 if (p[len-1] == '\n') { 78 p[len-1] = '\0'; 79 len--; 81 retbuf = malloc(len+1);
|
H A D | monitor.c | 166 size_t len; local 178 len = strlen(lxcpath) + 18; 179 path = alloca(len); 180 ret = snprintf(path, len, "lxc/%s/monitor-sock", lxcpath); 181 if (ret < 0 || (size_t)ret >= len) { 191 len = sizeof(addr->sun_path) - 1; 193 ret = snprintf(addr->sun_path, len, "@lxc/%016" PRIx64 "/%s", hash, lxcpath); 211 size_t len; local 224 len = strlen(&addr.sun_path[1]); 225 DEBUG("opening monitor socket %s with len [all...] |
H A D | lxclock.c | 101 int len; local 112 len = strlen("/lxc/lock/") + strlen(n) + strlen(p) + 3; 116 len += strlen(rundir); 118 if ((dest = malloc(len)) == NULL) { 123 ret = snprintf(dest, len, "%s/lxc/lock/%s", rundir, p); 124 if (ret < 0 || ret >= len) { 136 ret = snprintf(dest, len, "%s/lxc/lock/%s/.%s", rundir, p, n); 138 if (ret < 0 || ret >= len) {
|
H A D | nl.c | 52 const void *data, size_t len) 55 size_t rtalen = RTA_LENGTH(len); 64 memcpy(RTA_DATA(rta), data, len); local 113 size_t len = NLMSG_HDRLEN + NLMSG_ALIGN(size); local 119 nlmsg->nlmsghdr = (struct nlmsghdr *)malloc(len); 123 memset(nlmsg->nlmsghdr, 0, len); 124 nlmsg->cap = len; 133 extern void *nlmsg_reserve(struct nlmsg *nlmsg, size_t len) argument 137 size_t tlen = NLMSG_ALIGN(len); 145 if (tlen > len) 51 nla_put(struct nlmsg *nlmsg, int attr, const void *data, size_t len) argument [all...] |
H A D | commands.c | 77 static int fill_sock_name(char *path, int len, const char *lxcname, argument 91 ret = snprintf(path, len, "lxc/%s/command", hashed_sock_name); 92 if (ret < 0 || ret >= len) { 107 ret = snprintf(path, len, "%s/%s/command", lxcpath, name); 112 if (ret < len) 115 /* ret >= len; lxcpath or name is too long. hash both */ 124 ret = snprintf(path, len, "lxc/%016" PRIx64 "/command", hash); 125 if (ret < 0 || ret >= len) { 285 size_t len; local 295 len 986 int len; local [all...] |
/lxc/src/lxc/bdev/ |
H A D | lxcdir.c | 42 int len, ret; local 52 len = strlen(lxcpath) + strlen(cname) + strlen("rootfs") + 3; 53 new->src = malloc(len); 56 ret = snprintf(new->src, len, "%s/%s/rootfs", lxcpath, cname); 57 if (ret < 0 || ret >= len)
|
H A D | lxcloop.c | 52 int len, ret; local 63 len = strlen(lxcpath) + strlen(cname) + strlen("rootdev") + 3; 64 srcdev = alloca(len); 65 ret = snprintf(srcdev, len, "%s/%s/rootdev", lxcpath, cname); 66 if (ret < 0 || ret >= len) 69 new->src = malloc(len + 5); 72 ret = snprintf(new->src, len + 5, "loop:%s", srcdev); 73 if (ret < 0 || ret >= len + 5) 76 new->dest = malloc(len); 79 ret = snprintf(new->dest, len, " 110 int ret, len; local [all...] |
H A D | lxcrbd.c | 51 int ret, len; local 66 len = strlen(rbdpool) + strlen(rbdname) + 11; 67 bdev->src = malloc(len); 71 ret = snprintf(bdev->src, len, "/dev/rbd/%s/%s", rbdpool, rbdname); 72 if (ret < 0 || ret >= len)
|
H A D | lxcaufs.c | 66 int ret, len, lastslashidx; local 92 len = strlen(delta) + strlen(orig->src) + 12; 93 new->src = malloc(len); 98 ret = snprintf(new->src, len, "aufs:%s:%s", orig->src, delta); 100 if (ret < 0 || ret >= len) 108 int len, ret; local 145 len = strlen(nsrc) + strlen(ndelta) + 12; 146 new->src = malloc(len); 152 ret = snprintf(new->src, len, "aufs:%s:%s", nsrc, ndelta); 155 if (ret < 0 || ret >= len) 178 int ret, len = strlen(dest), newlen; local 239 int len; local 366 size_t len = 0; local [all...] |
H A D | lxclvm.c | 67 int ret, pid, len; local 99 len = strlen(pathdup) + strlen(thinpool) + 2; 100 tp = alloca(len); 102 ret = snprintf(tp, len, "%s/%s", pathdup, thinpool); 103 if (ret < 0 || ret >= len) 185 int ret, len, status, start=0; local 189 len = strlen(lvscmd) + strlen(path) - 1; 190 cmd = alloca(len); 192 ret = snprintf(cmd, len, lvscmd, path); 193 if (ret < 0 || ret >= len) 284 int len, ret; local 380 int ret, len; local [all...] |
H A D | lxczfs.c | 208 int len, ret; local 218 len = strlen(lxcpath) + strlen(cname) + strlen("rootfs") + 3; 219 new->src = malloc(len); 223 ret = snprintf(new->src, len, "%s/%s/rootfs", lxcpath, cname); 224 if (ret < 0 || ret >= len)
|
H A D | lxcbtrfs.c | 61 size_t len; local 86 len = strlen(args.name) + name_len + 2; 87 retpath = malloc(len); 95 len = name_len + 1; 96 retpath = malloc(len); 369 int len, ret; local 375 len = strlen(lxcpath) + strlen(cname) + strlen("rootfs") + 3; 376 new->src = malloc(len); 379 ret = snprintf(new->src, len, "%s/%s/rootfs", lxcpath, cname); 380 if (ret < 0 || ret >= len) 558 size_t len; local [all...] |
/lxc/src/lxc/tools/ |
H A D | lxc_monitor.c | 93 int len, rc_main, rc_snp, i; local 130 len = strlen(my_args.name) + 3; 131 regexp = malloc(len + 3); 136 rc_snp = snprintf(regexp, len, "^%s$", my_args.name); 137 if (rc_snp < 0 || rc_snp >= len) {
|
H A D | lxc_unshare.c | 50 static int sethostname(const char * name, size_t len) argument 53 return syscall(__NR_sethostname, name, len);
|
H A D | lxc_autostart.c | 265 int len = 0; local 269 len = c->get_config_item(c, key, NULL, 0); 270 if (len < 0) 273 value = (char*) malloc(sizeof(char)*len + 1); 277 if (c->get_config_item(c, key, value, len + 1) != len) { 294 int len = 0; local 298 len = c->get_config_item(c, key, NULL, 0); 299 if (len < 0) 302 value = (char*) malloc(sizeof(char)*len [all...] |
H A D | lxc_info.c | 365 int len = c->get_config_item(c, key[i], NULL, 0); local 367 if (len > 0) { 368 char *val = (char*) malloc(sizeof(char)*len + 1); 370 if (c->get_config_item(c, key[i], val, len + 1) != len) { 379 } else if (len == 0) {
|
/lxc/src/lxc/cgroups/ |
H A D | cgroup.c | 193 int lxc_cgroup_get(const char *filename, char *value, size_t len, const char *name, const char *lxcpath) argument 196 return ops->get(filename, value, len, name, lxcpath);
|