/lxc/src/lxc/tools/ |
H A D | lxc_info.c | 104 static void str_chomp(char *buf) argument 108 /* remove trailing whitespace from buf */ 109 for(ch = &buf[strlen(buf)-1]; 110 ch >= buf && (*ch == '\t' || *ch == '\n' || *ch == ' '); 115 static void size_humanize(unsigned long long val, char *buf, size_t bufsz) argument 118 snprintf(buf, bufsz, "%u.%2.2u GiB", 123 snprintf(buf, bufsz, "%u.%2.2u MiB", 127 snprintf(buf, bufsz, "%u.%2.2u KiB", 130 snprintf(buf, bufs 155 char buf[256]; local 207 char buf[4096]; local [all...] |
H A D | lxc_destroy.c | 202 char *buf = NULL; local 224 buf = calloc(fbuf.st_size + 1, sizeof(char)); 225 if (!buf) { 231 ret = read(fd, buf, fbuf.st_size); 235 free(buf); 240 while ((lxcpath = strtok_r(!counter ? buf : NULL, "\n", &scratch))) { 253 free(buf); 259 free(buf);
|
H A D | lxc_usernsexec.c | 274 char buf[1]; local 342 buf[0] = '1'; 343 if (write(pipe1[1], buf, 1) < 1) { 347 if (read(pipe2[0], buf, 1) < 1) { 351 if (buf[0] != '1') { 363 if (read(pipe1[0], buf, 1) < 1) { 368 buf[0] = '1'; 374 if (write(pipe2[1], buf, 1) < 0) {
|
H A D | lxc_top.c | 189 static void size_humanize(unsigned long long val, char *buf, size_t bufsz) argument 192 snprintf(buf, bufsz, "%u.%2.2u GB", 197 snprintf(buf, bufsz, "%u.%2.2u MB", 201 snprintf(buf, bufsz, "%u.%2.2u KB", 204 snprintf(buf, bufsz, "%3u.00 ", (int)val); 210 char buf[80]; local 214 len = c->get_cgroup_item(c, item, buf, sizeof(buf)); 220 val = strtoull(buf, NULL, 0); 227 char buf[409 local [all...] |
H A D | lxc_ls.c | 105 static int ls_recv_str(int fd, char **buf); 106 static int ls_send_str(int fd, const char *buf); 1036 static int ls_send_str(int fd, const char *buf) argument 1039 if (buf) 1040 slen = strlen(buf); 1044 if (lxc_write_nointr(fd, buf, slen) != (ssize_t)slen) 1103 static int ls_recv_str(int fd, char **buf) argument 1109 *buf = malloc(sizeof(char) * (slen + 1)); 1110 if (!*buf) 1112 if (lxc_read_nointr(fd, *buf, sle [all...] |
/lxc/src/include/ |
H A D | getline.c | 43 char *buf; local 44 buf = fgetln(fp, &len); 46 if (buf == NULL) 57 memcpy(*outbuf, buf, len);
|
H A D | openpty.c | 40 char buf[PATH_MAX]; local 53 if (ptsname_r(master, buf, sizeof buf)) 56 slave = open(buf, O_RDWR | O_NOCTTY); 69 strcpy(name, buf);
|
H A D | lxcmntent.c | 30 decode_name (char *buf) argument 32 char *rp = buf; 33 char *wp = buf; 70 return buf;
|
/lxc/src/lxc/lsm/ |
H A D | apparmor.c | 88 char *buf = NULL, *newbuf; local 101 free(buf); 105 newbuf = realloc(buf, sz); 107 free(buf); 112 buf = newbuf; 113 memset(buf, 0, sz); 114 ret = fread(buf, 1, sz - 1, f); 118 free(buf); 123 space = strchr(buf, '\n'); 126 space = strchr(buf, ' '); [all...] |
/lxc/src/tests/ |
H A D | startone.c | 103 char buf[201]; local 132 len = c->get_cgroup_item(c, "cpuset.cpus", buf, 200); 138 sprintf(buf, "0"); 139 b = c->set_cgroup_item(c, "cpuset.cpus", buf); 180 len = c->get_cgroup_item(c, "cpuset.cpus", buf, 0); 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, buf); 192 sprintf(buf, "FROZE [all...] |
/lxc/src/lxc/ |
H A D | criu.c | 138 char buf[4096], tty_info[32]; local 312 ret = sprintf(buf, "%s:%s", fullname, path); 315 if (ret < 0 || ret >= sizeof(buf)) { 321 DECLARE_ARG(buf); 336 while (getmntent_r(mnts, &mntent, buf, sizeof(buf))) { 456 ret = snprintf(buf, sizeof(buf), "fd[%d]:%s", opts->console_fd, tty_info); 457 if (ret < 0 || ret >= sizeof(buf)) 461 DECLARE_ARG(buf); 911 char buf[4096]; local 1112 char buf[4096]; local [all...] |
H A D | af_unix.c | 142 char buf[1] = {0}; local 158 iov.iov_base = data ? data : buf; 159 iov.iov_len = data ? size : sizeof(buf); 173 char buf[1] = {0}; local 180 iov.iov_base = data ? data : buf; 181 iov.iov_len = data ? size : sizeof(buf); 216 char buf[1] = {0}; local 230 iov.iov_base = data ? data : buf; 231 iov.iov_len = data ? size : sizeof(buf); 246 char buf[ local [all...] |
H A D | caps.c | 178 char buf[32]; local 182 if ((n = read(fd, buf, 31)) >= 0) { 183 buf[n] = '\0'; 185 result = strtol(buf, &ptr, 10);
|
H A D | lxc_user_nic.c | 556 char *buf, *p, *e, *nic; local 573 buf = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); 574 if (buf == MAP_FAILED) { 579 p = buf; 580 e = buf + len; 606 p = buf; 618 munmap(buf, sb.st_size); 619 if (ftruncate(fd, p - buf)) 625 static int count_entries(char *buf, off_t len, char *me, char *t, char *br) argument 630 e = &buf[le 655 char *buf = NULL; local [all...] |
H A D | utils.h | 182 * (i.e., struct lxc_popen_FILE *file; fgets(buf, sizeof(buf), file->f)) 239 extern ssize_t lxc_write_nointr(int fd, const void* buf, size_t count); 240 extern ssize_t lxc_read_nointr(int fd, void* buf, size_t count); 241 extern ssize_t lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf); 248 extern int lxc_write_to_file(const char *filename, const void* buf, size_t count, bool add_newline); 249 extern int lxc_read_from_file(const char *filename, void* buf, size_t count); 314 uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval);
|
H A D | initutils.c | 143 char buf[1024], *p, *p2; local 170 while (fgets(buf, 1024, fin)) { 171 if (buf[0] == '#') 173 p = strstr(buf, option_name); 179 for (p2 = buf; p2 < p; p2++) {
|
H A D | utils.c | 327 ssize_t lxc_write_nointr(int fd, const void* buf, size_t count) argument 331 ret = write(fd, buf, count); 337 ssize_t lxc_read_nointr(int fd, void* buf, size_t count) argument 341 ret = read(fd, buf, count); 347 ssize_t lxc_read_nointr_expect(int fd, void* buf, size_t count, const void* expected_buf) argument 350 ret = lxc_read_nointr(fd, buf, count); 355 if (expected_buf && memcmp(buf, expected_buf, count) != 0) { 374 char *buf; local 401 if ((buf = malloc(flen+1)) == NULL) { 406 if (fread(buf, 934 lxc_write_to_file(const char *filename, const void* buf, size_t count, bool add_newline) argument 962 lxc_read_from_file(const char *filename, void* buf, size_t count) argument 1076 fnv_64a_buf(void *buf, size_t len, uint64_t hval) argument 1104 char buf[LXC_LINELEN], *p; local 1414 char buf[2048], *tmp; local [all...] |
H A D | nl.c | 135 void *buf; local 142 buf = ((char *)(nlmsg->nlmsghdr)) + nlmsg_len; 146 memset(buf + len, 0, tlen - len); 148 return buf;
|
H A D | console.c | 162 char buf[1024]; local 165 w = r = lxc_read_nointr(fd, buf, sizeof(buf)); 174 w = lxc_write_nointr(console->master, buf, r); 178 w = lxc_write_nointr(console->log_fd, buf, r); 181 w = lxc_write_nointr(console->peer, buf, r); 630 char buf[1024]; local 636 r = lxc_read_nointr(fd, buf, sizeof(buf)); 640 w = lxc_write_nointr(ts->stdoutfd, buf, [all...] |
H A D | lxc_monitord.c | 157 char buf[4]; local 159 rc = read(fd, buf, sizeof(buf)); 160 if (rc > 0 && !strncmp(buf, "quit", 4))
|
H A D | conf.c | 1224 char buf[LXC_LINELEN], *p; local 1269 while (fgets(buf, LXC_LINELEN, f)) { 1270 for (p = buf, i=0; p && i < 4; i++) 2020 char buf[4096]; local 2023 while (getmntent_r(file, &mntent, buf, sizeof(buf))) { 2468 char buf[INET_ADDRSTRLEN]; local 2469 inet_ntop(AF_INET, netdev->ipv4_gateway, buf, sizeof(buf)); 2470 ERROR("tried to set autodetected ipv4 gateway '%s'", buf); 2502 char buf[INET6_ADDRSTRLEN]; local 3261 write_id_mapping(enum idtype idtype, pid_t pid, const char *buf, size_t buf_size) argument 3356 char *buf = NULL; local [all...] |
H A D | confile.c | 2468 char buf[INET_ADDRSTRLEN]; local 2469 inet_ntop(AF_INET, netdev->ipv4_gateway, buf, sizeof(buf)); 2470 strprint(retv, inlen, "%s", buf); 2476 char buf[INET_ADDRSTRLEN]; local 2477 inet_ntop(AF_INET, &i->addr, buf, sizeof(buf)); 2478 strprint(retv, inlen, "%s/%d\n", buf, i->prefix); 2484 char buf[INET6_ADDRSTRLEN]; local 2485 inet_ntop(AF_INET6, netdev->ipv6_gateway, buf, sizeo 2492 char buf[INET6_ADDRSTRLEN]; local [all...] |
/lxc/src/lxc/cgroups/ |
H A D | cgfs.c | 968 char *buf = calloc(strlen(name) + 32, 1); local 969 if (!buf) 971 snprintf(buf, strlen(name) + 32, "%s-%u", name, suffix); 972 current_component = lxc_string_replace("%n", buf, p_eff); 973 free(buf); 1867 char *buf = cgroup_to_absolute_path(mp, path, NULL); local 1868 if (!buf) 1873 if (!dir_exists(buf)) 1877 r = userns_exec_1(conf, rmdir_wrapper, buf); 1879 r = cgroup_rmdir(buf); 1906 char *buf; local 2163 char buf[2]; local 2217 cgroup_read_from_file(const char *fn, char buf[], size_t bufsize) argument [all...] |
H A D | cgmanager.c | 256 char buf[1]; local 257 buf[0] = 'p'; 271 iov.iov_base = buf; 272 iov.iov_len = sizeof(buf); 361 char buf[1]; local 393 if (read(sv[0], &buf, 1) != 1) { 408 if (read(sv[0], &buf, 1) != 1) { 423 ret = read(sv[0], buf, 1); 427 if (ret == 1 && *buf == '1')
|
/lxc/src/lxc/bdev/ |
H A D | lxclvm.c | 132 char devp[MAXPATHLEN], buf[4]; local 155 ret = fread(buf, 1, 4, fout); 157 if (ret != 4 || strncmp(buf, "LVM-", 4) != 0)
|