netns_freeifaddrs: 500| 686|{ 501| 686| struct netns_ifaddrs *n; 502| | 503| 3.43k| while (ifp) { ------------------ | Branch (503:9): [True: 2.74k, False: 686] ------------------ 504| 2.74k| n = ifp->ifa_next; 505| 2.74k| free(ifp); 506| 2.74k| ifp = n; 507| 2.74k| } 508| 686|} netns_getifaddrs: 512| 686|{ 513| 686| int r, saved_errno; 514| 686| struct ifaddrs_ctx _ctx; 515| 686| struct ifaddrs_ctx *ctx = &_ctx; 516| | 517| 686| memset(ctx, 0, sizeof *ctx); 518| | 519| 686| r = __rtnl_enumerate(AF_UNSPEC, AF_UNSPEC, netns_id, netnsid_aware, 520| 686| nl_msg_to_ifaddr, ctx); 521| 686| saved_errno = errno; 522| 686| if (r < 0) ------------------ | Branch (522:6): [True: 0, False: 686] ------------------ 523| 0| netns_freeifaddrs(&ctx->first->ifa); 524| 686| else 525| 686| *ifap = &ctx->first->ifa; 526| 686| errno = saved_errno; 527| | 528| 686| return r; 529| 686|} netns_ifaddrs.c:__rtnl_enumerate: 465| 686|{ 466| 686| int fd, r, saved_errno; 467| 686| bool getaddr_netnsid_aware = false, getlink_netnsid_aware = false; 468| | 469| 686| fd = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE); 470| 686| if (fd < 0) ------------------ | Branch (470:6): [True: 0, False: 686] ------------------ 471| 0| return -1; 472| | 473| 686| r = setsockopt(fd, SOL_NETLINK, NETLINK_GET_STRICT_CHK, &(int){1}, 474| 686| sizeof(int)); 475| 686| if (r < 0 && netns_id >= 0) { ------------------ | Branch (475:6): [True: 0, False: 686] | Branch (475:15): [True: 0, False: 0] ------------------ 476| 0| close(fd); 477| 0| *netnsid_aware = false; 478| 0| return -1; 479| 0| } 480| | 481| 686| r = __ifaddrs_netlink_recv(fd, 1, RTM_GETLINK, link_af, netns_id, 482| 686| &getlink_netnsid_aware, cb, ctx); 483| 686| if (!r) ------------------ | Branch (483:6): [True: 686, False: 0] ------------------ 484| 686| r = __ifaddrs_netlink_recv(fd, 2, RTM_GETADDR, addr_af, netns_id, 485| 686| &getaddr_netnsid_aware, cb, ctx); 486| | 487| 686| saved_errno = errno; 488| 686| close(fd); 489| 686| errno = saved_errno; 490| | 491| 686| if (getaddr_netnsid_aware && getlink_netnsid_aware) ------------------ | Branch (491:6): [True: 0, False: 686] | Branch (491:31): [True: 0, False: 0] ------------------ 492| 0| *netnsid_aware = true; 493| 686| else 494| 686| *netnsid_aware = false; 495| | 496| 686| return r; 497| 686|} netns_ifaddrs.c:__ifaddrs_netlink_recv: 377| 1.37k|{ 378| 1.37k| int r, property, ret; 379| 1.37k| char *buf; 380| 1.37k| struct nlmsghdr *hdr; 381| 1.37k| struct ifinfomsg *ifi_msg; 382| 1.37k| struct ifaddrmsg *ifa_msg; 383| 1.37k| union { 384| 1.37k| uint8_t buf[8192]; 385| 1.37k| struct { 386| 1.37k| struct nlmsghdr nlh; 387| 1.37k| struct rtgenmsg g; 388| 1.37k| } req; 389| 1.37k| struct nlmsghdr reply; 390| 1.37k| } u; 391| 1.37k| char getlink_buf[__NETLINK_ALIGN(sizeof(struct nlmsghdr)) + 392| 1.37k| __NETLINK_ALIGN(sizeof(struct ifinfomsg)) + 393| 1.37k| __NETLINK_ALIGN(1024)] = {0}; 394| 1.37k| char getaddr_buf[__NETLINK_ALIGN(sizeof(struct nlmsghdr)) + 395| 1.37k| __NETLINK_ALIGN(sizeof(struct ifaddrmsg)) + 396| 1.37k| __NETLINK_ALIGN(1024)] = {0}; 397| | 398| 1.37k|#pragma GCC diagnostic push 399| 1.37k|#pragma GCC diagnostic ignored "-Wcast-align" 400| 1.37k| if (type == RTM_GETLINK) { ------------------ | Branch (400:6): [True: 686, False: 686] ------------------ 401| 686| buf = getlink_buf; 402| 686| hdr = (struct nlmsghdr *)buf; 403| 686| hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*ifi_msg)); 404| | 405| 686| ifi_msg = (struct ifinfomsg *)__NLMSG_DATA(hdr); ------------------ | | 41| 686|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 406| 686| ifi_msg->ifi_family = af; 407| | 408| 686| property = IFLA_TARGET_NETNSID; ------------------ | | 520| 686|#define IFLA_TARGET_NETNSID 46 ------------------ 409| 686| } else if (type == RTM_GETADDR) { ------------------ | Branch (409:13): [True: 686, False: 0] ------------------ 410| 686| buf = getaddr_buf; 411| 686| hdr = (struct nlmsghdr *)buf; 412| 686| hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*ifa_msg)); 413| | 414| 686| ifa_msg = (struct ifaddrmsg *)__NLMSG_DATA(hdr); ------------------ | | 41| 686|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 415| 686| ifa_msg->ifa_family = af; 416| | 417| 686| property = IFA_TARGET_NETNSID; ------------------ | | 524| 686|#define IFA_TARGET_NETNSID 10 ------------------ 418| 686| } else { 419| 0| errno = EINVAL; 420| 0| return -1; 421| 0| } 422| 1.37k|#pragma GCC diagnostic pop 423| | 424| 1.37k| hdr->nlmsg_type = type; 425| 1.37k| hdr->nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST; 426| 1.37k| hdr->nlmsg_pid = 0; 427| 1.37k| hdr->nlmsg_seq = seq; 428| | 429| 1.37k| if (netns_id >= 0) ------------------ | Branch (429:6): [True: 0, False: 1.37k] ------------------ 430| 0| addattr(hdr, 1024, property, &netns_id, sizeof(netns_id)); 431| | 432| 1.37k| r = __ifaddrs_netlink_send(fd, hdr); 433| 1.37k| if (r < 0) ------------------ | Branch (433:6): [True: 0, False: 1.37k] ------------------ 434| 0| return -1; 435| | 436| 2.74k| for (;;) { 437| 2.74k| r = recv(fd, u.buf, sizeof(u.buf), MSG_DONTWAIT); 438| 2.74k| if (r <= 0) ------------------ | Branch (438:7): [True: 0, False: 2.74k] ------------------ 439| 0| return -1; 440| | 441| 2.74k|#pragma GCC diagnostic push 442| 2.74k|#pragma GCC diagnostic ignored "-Wcast-align" 443| 5.48k| for (hdr = &u.reply; __NLMSG_OK(hdr, (void *)&u.buf[r]); ------------------ | | 36| 5.48k| ((size_t)((char *)(end) - (char *)(nlh)) >= sizeof(struct nlmsghdr)) | | ------------------ | | | Branch (36:2): [True: 4.11k, False: 1.37k] | | ------------------ ------------------ 444| 4.11k| hdr = __NLMSG_NEXT(hdr)) { ------------------ | | 39| 2.74k| (struct nlmsghdr *)((char *)(nlh) + __NETLINK_ALIGN((nlh)->nlmsg_len)) | | ------------------ | | | | 33| 2.74k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 445| 4.11k| if (hdr->nlmsg_type == NLMSG_DONE) ------------------ | Branch (445:8): [True: 1.37k, False: 2.74k] ------------------ 446| 1.37k| return 0; 447| | 448| 2.74k| if (hdr->nlmsg_type == NLMSG_ERROR) { ------------------ | Branch (448:8): [True: 0, False: 2.74k] ------------------ 449| 0| errno = EINVAL; 450| 0| return -1; 451| 0| } 452| | 453| 2.74k| ret = cb(ctx, netnsid_aware, hdr); 454| 2.74k| if (ret) ------------------ | Branch (454:8): [True: 0, False: 2.74k] ------------------ 455| 0| return ret; 456| 2.74k| } 457| 2.74k|#pragma GCC diagnostic pop 458| 2.74k| } 459| 1.37k|} netns_ifaddrs.c:__ifaddrs_netlink_send: 346| 1.37k|{ 347| 1.37k| int ret; 348| 1.37k| struct sockaddr_nl nladdr; 349| 1.37k| struct iovec iov = { 350| 1.37k| .iov_base = nlmsghdr, 351| 1.37k| .iov_len = nlmsghdr->nlmsg_len, 352| 1.37k| }; 353| 1.37k| struct msghdr msg = { 354| 1.37k| .msg_name = &nladdr, 355| 1.37k| .msg_namelen = sizeof(nladdr), 356| 1.37k| .msg_iov = &iov, 357| 1.37k| .msg_iovlen = 1, 358| 1.37k| }; 359| | 360| 1.37k| memset(&nladdr, 0, sizeof(nladdr)); 361| 1.37k| nladdr.nl_family = AF_NETLINK; 362| 1.37k| nladdr.nl_pid = 0; 363| 1.37k| nladdr.nl_groups = 0; 364| | 365| 1.37k| ret = sendmsg(fd, &msg, MSG_NOSIGNAL); 366| 1.37k| if (ret < 0) ------------------ | Branch (366:6): [True: 0, False: 1.37k] ------------------ 367| 0| return -1; 368| | 369| 1.37k| return ret; 370| 1.37k|} netns_ifaddrs.c:nl_msg_to_ifaddr: 169| 2.74k|{ 170| 2.74k| struct ifaddrs_storage *ifs, *ifs0; 171| 2.74k| struct rtattr *rta; 172| 2.74k| int stats_len = 0; 173| 2.74k| struct ifinfomsg *ifi = __NLMSG_DATA(h); ------------------ | | 41| 2.74k|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 174| 2.74k| struct ifaddrmsg *ifa = __NLMSG_DATA(h); ------------------ | | 41| 2.74k|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 175| 2.74k| struct ifaddrs_ctx *ctx = pctx; 176| | 177| 2.74k| if (h->nlmsg_type == RTM_NEWLINK) { ------------------ | Branch (177:6): [True: 1.37k, False: 1.37k] ------------------ 178| 1.37k|#pragma GCC diagnostic push 179| 1.37k|#pragma GCC diagnostic ignored "-Wcast-align" 180| 1.37k| for (rta = __NLMSG_RTA(h, sizeof(*ifi)); __NLMSG_RTAOK(rta, h); ------------------ | | 46| 1.37k| ((void *)((char *)(nlh) + sizeof(struct nlmsghdr) + \ | | 47| 1.37k| __NETLINK_ALIGN(len))) | | ------------------ | | | | 33| 1.37k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 181| 31.5k| rta = __RTA_NEXT(rta)) { ------------------ | | 52| 30.1k| (struct rtattr *)((char *)(rta) + __NETLINK_ALIGN((rta)->rta_len)) | | ------------------ | | | | 33| 30.1k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 182| 31.5k|#if HAVE_STRUCT_RTNL_LINK_STATS64 183| 31.5k| if (rta->rta_type != IFLA_STATS64) ------------------ | | 532| 31.5k|#define IFLA_STATS64 23 ------------------ | Branch (183:8): [True: 30.1k, False: 1.37k] ------------------ 184| |#else 185| | if (rta->rta_type != IFLA_STATS) 186| |#endif 187| 30.1k| continue; 188| | 189| 1.37k| stats_len = __RTA_DATALEN(rta); ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 190| 1.37k| break; 191| 31.5k| } 192| 1.37k|#pragma GCC diagnostic pop 193| 1.37k| } else { 194| 1.37k| for (ifs0 = ctx->hash[ifa->ifa_index % IFADDRS_HASH_SIZE]; ifs0; ------------------ | | 31| 1.37k|#define IFADDRS_HASH_SIZE 64 ------------------ | Branch (194:62): [True: 1.37k, False: 0] ------------------ 195| 1.37k| ifs0 = ifs0->hash_next) 196| 1.37k| if (ifs0->index == ifa->ifa_index) ------------------ | Branch (196:8): [True: 1.37k, False: 0] ------------------ 197| 1.37k| break; 198| 1.37k| if (!ifs0) ------------------ | Branch (198:7): [True: 0, False: 1.37k] ------------------ 199| 0| return 0; 200| 1.37k| } 201| | 202| 2.74k| ifs = calloc(1, sizeof(struct ifaddrs_storage) + stats_len); 203| 2.74k| if (!ifs) { ------------------ | Branch (203:6): [True: 0, False: 2.74k] ------------------ 204| 0| errno = ENOMEM; 205| 0| return -1; 206| 0| } 207| | 208| 2.74k|#pragma GCC diagnostic push 209| 2.74k|#pragma GCC diagnostic ignored "-Wcast-align" 210| 2.74k| if (h->nlmsg_type == RTM_NEWLINK) { ------------------ | Branch (210:6): [True: 1.37k, False: 1.37k] ------------------ 211| 1.37k| ifs->index = ifi->ifi_index; 212| 1.37k| ifs->ifa.ifa_ifindex = ifi->ifi_index; 213| 1.37k| ifs->ifa.ifa_flags = ifi->ifi_flags; 214| | 215| 1.37k| for (rta = __NLMSG_RTA(h, sizeof(*ifi)); __NLMSG_RTAOK(rta, h); ------------------ | | 46| 1.37k| ((void *)((char *)(nlh) + sizeof(struct nlmsghdr) + \ | | 47| 1.37k| __NETLINK_ALIGN(len))) | | ------------------ | | | | 33| 1.37k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 216| 37.7k| rta = __RTA_NEXT(rta)) { ------------------ | | 52| 37.7k| (struct rtattr *)((char *)(rta) + __NETLINK_ALIGN((rta)->rta_len)) | | ------------------ | | | | 33| 37.7k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 217| 37.7k| switch (rta->rta_type) { ------------------ | Branch (217:12): [True: 6.86k, False: 30.8k] ------------------ 218| 1.37k| case IFLA_IFNAME: ------------------ | Branch (218:4): [True: 1.37k, False: 36.3k] ------------------ 219| 1.37k| if (__RTA_DATALEN(rta) < sizeof(ifs->name)) { ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ | Branch (219:9): [True: 1.37k, False: 0] ------------------ 220| 1.37k| memcpy(ifs->name, __RTA_DATA(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 221| 1.37k| __RTA_DATALEN(rta)); ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 222| 1.37k| ifs->ifa.ifa_name = ifs->name; 223| 1.37k| } 224| 1.37k| break; 225| 1.37k| case IFLA_ADDRESS: ------------------ | Branch (225:4): [True: 1.37k, False: 36.3k] ------------------ 226| 1.37k| copy_lladdr(&ifs->ifa.ifa_addr, &ifs->addr, 227| 1.37k| __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 228| 1.37k| ifi->ifi_index, ifi->ifi_type); 229| 1.37k| break; 230| 1.37k| case IFLA_BROADCAST: ------------------ | Branch (230:4): [True: 1.37k, False: 36.3k] ------------------ 231| 1.37k| copy_lladdr(&ifs->ifa.__ifa_broadaddr, &ifs->ifu, ------------------ | | 53| 1.37k|#define __ifa_broadaddr ifa_ifu.ifu_broadaddr ------------------ 232| 1.37k| __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 233| 1.37k| ifi->ifi_index, ifi->ifi_type); 234| 1.37k| break; 235| 0|#if HAVE_STRUCT_RTNL_LINK_STATS64 236| 1.37k| case IFLA_STATS64: ------------------ | | 532| 1.37k|#define IFLA_STATS64 23 ------------------ | Branch (236:4): [True: 1.37k, False: 36.3k] ------------------ 237| 1.37k| ifs->ifa.ifa_stats_type = IFLA_STATS64; ------------------ | | 532| 1.37k|#define IFLA_STATS64 23 ------------------ 238| |#else 239| | case IFLA_STATS: 240| | ifs->ifa.ifa_stats_type = IFLA_STATS; 241| |#endif 242| 1.37k| memcpy(&ifs->ifa.ifa_stats, __RTA_DATA(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 243| 1.37k| __RTA_DATALEN(rta)); ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 244| 1.37k| break; 245| 1.37k| case IFLA_MTU: ------------------ | Branch (245:4): [True: 1.37k, False: 36.3k] ------------------ 246| 1.37k| memcpy(&ifs->ifa.ifa_mtu, __RTA_DATA(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 247| 1.37k| sizeof(int)); 248| 1.37k| break; 249| 0| case IFLA_TARGET_NETNSID: ------------------ | | 520| 0|#define IFLA_TARGET_NETNSID 46 ------------------ | Branch (249:4): [True: 0, False: 37.7k] ------------------ 250| 0| *netnsid_aware = true; 251| 0| break; 252| 37.7k| } 253| 37.7k| } 254| | 255| 1.37k| if (ifs->ifa.ifa_name) { ------------------ | Branch (255:7): [True: 1.37k, False: 0] ------------------ 256| 1.37k| unsigned int bucket = ifs->index % IFADDRS_HASH_SIZE; ------------------ | | 31| 1.37k|#define IFADDRS_HASH_SIZE 64 ------------------ 257| 1.37k| ifs->hash_next = ctx->hash[bucket]; 258| 1.37k| ctx->hash[bucket] = ifs; 259| 1.37k| } 260| 1.37k| } else { 261| 1.37k| ifs->ifa.ifa_name = ifs0->ifa.ifa_name; 262| 1.37k| ifs->ifa.ifa_mtu = ifs0->ifa.ifa_mtu; 263| 1.37k| ifs->ifa.ifa_ifindex = ifs0->ifa.ifa_ifindex; 264| 1.37k| ifs->ifa.ifa_flags = ifs0->ifa.ifa_flags; 265| | 266| 1.37k| for (rta = __NLMSG_RTA(h, sizeof(*ifa)); __NLMSG_RTAOK(rta, h); ------------------ | | 46| 1.37k| ((void *)((char *)(nlh) + sizeof(struct nlmsghdr) + \ | | 47| 1.37k| __NETLINK_ALIGN(len))) | | ------------------ | | | | 33| 1.37k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 267| 7.54k| rta = __RTA_NEXT(rta)) { ------------------ | | 52| 7.54k| (struct rtattr *)((char *)(rta) + __NETLINK_ALIGN((rta)->rta_len)) | | ------------------ | | | | 33| 7.54k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 268| 7.54k| switch (rta->rta_type) { ------------------ | Branch (268:12): [True: 4.80k, False: 2.74k] ------------------ 269| 1.37k| case IFA_ADDRESS: ------------------ | Branch (269:4): [True: 1.37k, False: 6.17k] ------------------ 270| | /* If ifa_addr is already set we, received an 271| | * IFA_LOCAL before so treat this as 272| | * destination address. 273| | */ 274| 1.37k| if (ifs->ifa.ifa_addr) ------------------ | Branch (274:9): [True: 0, False: 1.37k] ------------------ 275| 0| copy_addr(&ifs->ifa.__ifa_dstaddr, ------------------ | | 54| 0|#define __ifa_dstaddr ifa_ifu.ifu_dstaddr ------------------ 276| 0| ifa->ifa_family, &ifs->ifu, 277| 0| __RTA_DATA(rta), ------------------ | | 65| 0|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 278| 0| __RTA_DATALEN(rta), ------------------ | | 49| 0|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 279| 0| ifa->ifa_index); 280| 1.37k| else 281| 1.37k| copy_addr(&ifs->ifa.ifa_addr, 282| 1.37k| ifa->ifa_family, &ifs->addr, 283| 1.37k| __RTA_DATA(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 284| 1.37k| __RTA_DATALEN(rta), ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 285| 1.37k| ifa->ifa_index); 286| 1.37k| break; 287| 686| case IFA_BROADCAST: ------------------ | Branch (287:4): [True: 686, False: 6.86k] ------------------ 288| 686| copy_addr(&ifs->ifa.__ifa_broadaddr, ------------------ | | 53| 686|#define __ifa_broadaddr ifa_ifu.ifu_broadaddr ------------------ 289| 686| ifa->ifa_family, &ifs->ifu, 290| 686| __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 65| 686|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 49| 686|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 291| 686| ifa->ifa_index); 292| 686| break; 293| 1.37k| case IFA_LOCAL: ------------------ | Branch (293:4): [True: 1.37k, False: 6.17k] ------------------ 294| | /* If ifa_addr is set and we get IFA_LOCAL, 295| | * assume we have a point-to-point network. 296| | * Move address to correct field. 297| | */ 298| 1.37k| if (ifs->ifa.ifa_addr) { ------------------ | Branch (298:9): [True: 1.37k, False: 0] ------------------ 299| 1.37k| ifs->ifu = ifs->addr; 300| 1.37k| ifs->ifa.__ifa_dstaddr = &ifs->ifu.sa; ------------------ | | 54| 1.37k|#define __ifa_dstaddr ifa_ifu.ifu_dstaddr ------------------ 301| | 302| 1.37k| memset(&ifs->addr, 0, sizeof(ifs->addr)); 303| 1.37k| } 304| | 305| 1.37k| copy_addr(&ifs->ifa.ifa_addr, ifa->ifa_family, 306| 1.37k| &ifs->addr, __RTA_DATA(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 307| 1.37k| __RTA_DATALEN(rta), ifa->ifa_index); ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 308| 1.37k| break; 309| 1.37k| case IFA_LABEL: ------------------ | Branch (309:4): [True: 1.37k, False: 6.17k] ------------------ 310| 1.37k| if (__RTA_DATALEN(rta) < sizeof(ifs->name)) { ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ | Branch (310:9): [True: 1.37k, False: 0] ------------------ 311| 1.37k| memcpy(ifs->name, __RTA_DATA(rta), ------------------ | | 65| 1.37k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 312| 1.37k| __RTA_DATALEN(rta)); ------------------ | | 49| 1.37k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 313| 1.37k| ifs->ifa.ifa_name = ifs->name; 314| 1.37k| } 315| 1.37k| break; 316| 0| case IFA_TARGET_NETNSID: ------------------ | | 524| 0|#define IFA_TARGET_NETNSID 10 ------------------ | Branch (316:4): [True: 0, False: 7.54k] ------------------ 317| 0| *netnsid_aware = true; 318| 0| break; 319| 7.54k| } 320| 7.54k| } 321| | 322| 1.37k| if (ifs->ifa.ifa_addr) { ------------------ | Branch (322:7): [True: 1.37k, False: 0] ------------------ 323| 1.37k| gen_netmask(&ifs->ifa.ifa_netmask, ifa->ifa_family, 324| 1.37k| &ifs->netmask, ifa->ifa_prefixlen); 325| 1.37k| ifs->ifa.ifa_prefixlen = ifa->ifa_prefixlen; 326| 1.37k| } 327| 1.37k| } 328| 2.74k|#pragma GCC diagnostic pop 329| | 330| 2.74k| if (ifs->ifa.ifa_name) { ------------------ | Branch (330:6): [True: 2.74k, False: 0] ------------------ 331| 2.74k| if (!ctx->first) ------------------ | Branch (331:7): [True: 686, False: 2.05k] ------------------ 332| 686| ctx->first = ifs; 333| | 334| 2.74k| if (ctx->last) ------------------ | Branch (334:7): [True: 2.05k, False: 686] ------------------ 335| 2.05k| ctx->last->ifa.ifa_next = &ifs->ifa; 336| | 337| 2.74k| ctx->last = ifs; 338| 2.74k| } else { 339| 0| free(ifs); 340| 0| } 341| | 342| 2.74k| return 0; 343| 2.74k|} netns_ifaddrs.c:copy_lladdr: 154| 2.74k|{ 155| 2.74k| if (addrlen > sizeof(sa->ll.sll_addr)) ------------------ | Branch (155:6): [True: 0, False: 2.74k] ------------------ 156| 0| return; 157| | 158| 2.74k| sa->ll.sll_family = AF_PACKET; 159| 2.74k| sa->ll.sll_ifindex = ifindex; 160| 2.74k| sa->ll.sll_hatype = hatype; 161| 2.74k| sa->ll.sll_halen = addrlen; 162| | 163| 2.74k| memcpy(sa->ll.sll_addr, addr, addrlen); 164| | 165| 2.74k| *r = &sa->sa; 166| 2.74k|} netns_ifaddrs.c:copy_addr: 103| 4.80k|{ 104| 4.80k| uint8_t *dst; 105| 4.80k| size_t len; 106| | 107| 4.80k| switch (af) { 108| 4.80k| case AF_INET: ------------------ | Branch (108:2): [True: 4.80k, False: 0] ------------------ 109| 4.80k| dst = (uint8_t *)&sa->v4.sin_addr; 110| 4.80k| len = 4; 111| 4.80k| break; 112| 0| case AF_INET6: ------------------ | Branch (112:2): [True: 0, False: 4.80k] ------------------ 113| 0| dst = (uint8_t *)&sa->v6.sin6_addr; 114| 0| len = 16; 115| 0| if (__IN6_IS_ADDR_LINKLOCAL(addr) || ------------------ | | 60| 0| ((((uint8_t *)(a))[0]) == 0xfe && (((uint8_t *)(a))[1] & 0xc0) == 0x80) | | ------------------ | | | Branch (60:3): [True: 0, False: 0] | | | Branch (60:36): [True: 0, False: 0] | | ------------------ ------------------ 116| 0| __IN6_IS_ADDR_MC_LINKLOCAL(addr)) ------------------ | | 63| 0| (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *)(a))[1] & 0xf) == 0x2)) | | ------------------ | | | Branch (63:31): [True: 0, False: 0] | | ------------------ ------------------ | Branch (116:7): [True: 0, False: 0] ------------------ 117| 0| sa->v6.sin6_scope_id = ifindex; 118| 0| break; 119| 0| default: ------------------ | Branch (119:2): [True: 0, False: 4.80k] ------------------ 120| 0| return; 121| 4.80k| } 122| | 123| 4.80k| if (addrlen < len) ------------------ | Branch (123:6): [True: 0, False: 4.80k] ------------------ 124| 0| return; 125| | 126| 4.80k| sa->sa.sa_family = af; 127| | 128| 4.80k| memcpy(dst, addr, len); 129| | 130| 4.80k| *r = &sa->sa; 131| 4.80k|} netns_ifaddrs.c:gen_netmask: 135| 1.37k|{ 136| 1.37k| uint8_t addr[16] = {0}; 137| 1.37k| int i; 138| | 139| 1.37k| if ((size_t)prefixlen > 8 * sizeof(addr)) ------------------ | Branch (139:6): [True: 0, False: 1.37k] ------------------ 140| 0| prefixlen = 8 * sizeof(addr); 141| | 142| 1.37k| i = prefixlen / 8; 143| | 144| 1.37k| memset(addr, 0xff, i); 145| | 146| 1.37k| if ((size_t)i < sizeof(addr)) ------------------ | Branch (146:6): [True: 1.37k, False: 0] ------------------ 147| 1.37k| addr[i++] = 0xff << (8 - (prefixlen % 8)); 148| | 149| 1.37k| copy_addr(r, af, sa, addr, sizeof(addr), 0); 150| 1.37k|} strlcpy: 11| 3.42k|{ 12| 3.42k| size_t ret = strlen(src); 13| | 14| 3.42k| if (size) { ------------------ | Branch (14:6): [True: 3.42k, False: 0] ------------------ 15| 3.42k| size_t len = (ret >= size) ? size - 1 : ret; ------------------ | Branch (15:16): [True: 503, False: 2.91k] ------------------ 16| 3.42k| memcpy(dest, src, len); 17| 3.42k| dest[len] = '\0'; 18| 3.42k| } 19| | 20| 3.42k| return ret; 21| 3.42k|} confile.c:__must_check_overflow: 44| 3.32k|{ 45| 3.32k| return unlikely(overflow); ------------------ | | 40| 3.32k|#define unlikely(x) __builtin_expect(!!(x), 0) ------------------ 46| 3.32k|} string_utils.c:__must_check_overflow: 44| 1.42k|{ 45| 1.42k| return unlikely(overflow); ------------------ | | 40| 1.42k|#define unlikely(x) __builtin_expect(!!(x), 0) ------------------ 46| 1.42k|} parse_mount_attrs: 2003| 1.83k|{ 2004| 1.83k| __do_free char *mntopts_new = NULL, *mntopts_dup = NULL; ------------------ | | 69| 1.83k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.83k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2005| 1.83k| char *end = NULL, *mntopt_cur = NULL; 2006| 1.83k| int ret; 2007| 1.83k| size_t size; 2008| | 2009| 1.83k| if (!opts) ------------------ | Branch (2009:6): [True: 0, False: 1.83k] ------------------ 2010| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2011| | 2012| 1.83k| if (!mntopts) ------------------ | Branch (2012:6): [True: 0, False: 1.83k] ------------------ 2013| 0| return 0; 2014| | 2015| 1.83k| mntopts_dup = strdup(mntopts); 2016| 1.83k| if (!mntopts_dup) ------------------ | Branch (2016:6): [True: 0, False: 1.83k] ------------------ 2017| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2018| | 2019| 1.83k| size = strlen(mntopts_dup) + 1; 2020| 1.83k| mntopts_new = zalloc(size); ------------------ | | 90| 1.83k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2021| 1.83k| if (!mntopts_new) ------------------ | Branch (2021:6): [True: 0, False: 1.83k] ------------------ 2022| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2023| | 2024| 16.4k| lxc_iterate_parts(mntopt_cur, mntopts_dup, ",") { ------------------ | | 187| 1.83k| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 18.2k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 16.4k, False: 1.83k] | | ------------------ | | 189| 16.4k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2025| | /* This is a generic vfs option. */ 2026| 16.4k| ret = parse_vfs_attr(opts, mntopt_cur, size); 2027| 16.4k| if (ret < 0) ------------------ | Branch (2027:7): [True: 0, False: 16.4k] ------------------ 2028| 0| return syserror("Failed to parse mount attributes: \"%s\"", mntopt_cur); ------------------ | | 562| 0| ({ \ | | 563| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 564| 0| (-labs(errno)); \ | | 565| 0| }) ------------------ 2029| | 2030| | /* (mntopt_cur) was processed in parse_vfs_attr() */ 2031| 16.4k| if (ret == 0) ------------------ | Branch (2031:7): [True: 7.11k, False: 9.32k] ------------------ 2032| 7.11k| continue; 2033| | 2034| | /* This is a filesystem specific option. */ 2035| 9.32k| if (!end) { ------------------ | Branch (2035:7): [True: 776, False: 8.55k] ------------------ 2036| 776| end = stpcpy(mntopts_new, mntopt_cur); 2037| 8.55k| } else { 2038| 8.55k| end = stpcpy(end, ","); 2039| 8.55k| end = stpcpy(end, mntopt_cur); 2040| 8.55k| } 2041| 9.32k| } 2042| | 2043| 1.83k| if (*mntopts_new) ------------------ | Branch (2043:6): [True: 776, False: 1.05k] ------------------ 2044| 776| opts->data = move_ptr(mntopts_new); ------------------ | | 694| 776| ({ \ | | 695| 776| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 776| (ptr) = NULL; \ | | 697| 776| __internal_ptr__; \ | | 698| 776| }) ------------------ 2045| | 2046| 1.83k| return 0; 2047| 1.83k|} parse_lxc_mount_attrs: 2186| 1.95k|{ 2187| 11.6k| for (size_t i = LXC_MOUNT_CREATE_DIR; i < LXC_MOUNT_MAX; i++) { ------------------ | Branch (2187:40): [True: 9.79k, False: 1.84k] ------------------ 2188| 9.79k| __do_close int fd_userns = -EBADF; ------------------ | | 49| 9.79k|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 9.79k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2189| 9.79k| const char *opt_name = lxc_mount_options_info[i]; 2190| 9.79k| size_t len; 2191| 9.79k| char *idmap_path, *opt, *opt_next; 2192| | 2193| 9.79k| opt = strstr(mnt_opts, opt_name); 2194| 9.79k| if (!opt) ------------------ | Branch (2194:7): [True: 9.06k, False: 732] ------------------ 2195| 9.06k| continue; 2196| | 2197| 732| switch (i) { 2198| 7| case LXC_MOUNT_CREATE_DIR: ------------------ | Branch (2198:3): [True: 7, False: 725] ------------------ 2199| 7| opts->create_dir = 1; 2200| 7| break; 2201| 3| case LXC_MOUNT_CREATE_FILE: ------------------ | Branch (2201:3): [True: 3, False: 729] ------------------ 2202| 3| opts->create_file = 1; 2203| 3| break; 2204| 5| case LXC_MOUNT_OPTIONAL: ------------------ | Branch (2204:3): [True: 5, False: 727] ------------------ 2205| 5| opts->optional = 1; 2206| 5| break; 2207| 8| case LXC_MOUNT_RELATIVE: ------------------ | Branch (2207:3): [True: 8, False: 724] ------------------ 2208| 8| opts->relative = 1; 2209| 8| break; 2210| 709| case LXC_MOUNT_IDMAP: ------------------ | Branch (2210:3): [True: 709, False: 23] ------------------ 2211| 709| opt_next = opt; 2212| 709| opt_next += STRLITERALLEN("idmap="); ------------------ | | 687| 709|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2213| 709| idmap_path = strchrnul(opt_next, ','); 2214| 709| len = idmap_path - opt_next + 1; 2215| | 2216| 709| if (len >= sizeof(opts->userns_path)) ------------------ | Branch (2216:8): [True: 3, False: 706] ------------------ 2217| 3| return syserror_set(-EIO, "Excessive idmap path length for \"idmap=\" LXC specific mount option"); ------------------ | | 568| 3| ({ \ | | 569| 3| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 3| errno = labs(__ret__); \ | | 571| 3| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 3| do { \ | | | | 454| 3| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 3| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 3| char *ptr = NULL; \ | | | | | | 317| 3| { \ | | | | | | 318| 3| int __saved_errno = errno; \ | | | | | | 319| 3| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 3| errno = __saved_errno; \ | | | | | | 321| 3| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 3] | | | | | | ------------------ | | | | | | 322| 3| ptr = errno_buf; \ | | | | | | 323| 3| } | | | | ------------------ | | | | 455| 3| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 3|#define ERROR(format, ...) do { \ | | | | | | 373| 3| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 3| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 3| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 3|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 3] | | | | | | ------------------ | | | | ------------------ | | | | 456| 3| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 3] | | | | ------------------ | | ------------------ | | 572| 3| __internal_ret__; \ | | 573| 3| }) ------------------ 2218| | 2219| 706| strlcpy(opts->userns_path, opt_next, len); 2220| | 2221| 706| if (is_empty_string(opts->userns_path)) ------------------ | Branch (2221:8): [True: 15, False: 691] ------------------ 2222| 15| return syserror_set(-EINVAL, "Missing idmap path for \"idmap=\" LXC specific mount option"); ------------------ | | 568| 15| ({ \ | | 569| 15| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 15| errno = labs(__ret__); \ | | 571| 15| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 15| do { \ | | | | 454| 15| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 15| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 15| char *ptr = NULL; \ | | | | | | 317| 15| { \ | | | | | | 318| 15| int __saved_errno = errno; \ | | | | | | 319| 15| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 15| errno = __saved_errno; \ | | | | | | 321| 15| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 15] | | | | | | ------------------ | | | | | | 322| 15| ptr = errno_buf; \ | | | | | | 323| 15| } | | | | ------------------ | | | | 455| 15| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 15|#define ERROR(format, ...) do { \ | | | | | | 373| 15| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 15| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 15| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 15|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 15] | | | | | | ------------------ | | | | ------------------ | | | | 456| 15| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 15] | | | | ------------------ | | ------------------ | | 572| 15| __internal_ret__; \ | | 573| 15| }) ------------------ 2223| | 2224| 691| if (!strequal(opts->userns_path, "container")) { ------------------ | Branch (2224:8): [True: 497, False: 194] ------------------ 2225| 497| fd_userns = open(opts->userns_path, O_RDONLY | O_NOCTTY | O_CLOEXEC); 2226| 497| if (fd_userns < 0) ------------------ | Branch (2226:9): [True: 100, False: 397] ------------------ 2227| 100| return syserror("Failed to open user namespace %s", opts->userns_path); ------------------ | | 562| 100| ({ \ | | 563| 100| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 100| do { \ | | | | 454| 100| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 100| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 100| char *ptr = NULL; \ | | | | | | 317| 100| { \ | | | | | | 318| 100| int __saved_errno = errno; \ | | | | | | 319| 100| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 100| errno = __saved_errno; \ | | | | | | 321| 100| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 100] | | | | | | ------------------ | | | | | | 322| 100| ptr = errno_buf; \ | | | | | | 323| 100| } | | | | ------------------ | | | | 455| 100| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 100|#define ERROR(format, ...) do { \ | | | | | | 373| 100| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 100| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 100| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 100|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 100] | | | | | | ------------------ | | | | ------------------ | | | | 456| 100| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 100] | | | | ------------------ | | ------------------ | | 564| 100| (-labs(errno)); \ | | 565| 100| }) ------------------ 2228| 497| } 2229| | 2230| 591| TRACE("Parse LXC specific mount option %d->\"idmap=%s\"", fd_userns, opts->userns_path); ------------------ | | 347| 591|#define TRACE(format, ...) do { \ | | 348| 591| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 591| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 591| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 591|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 591] | | ------------------ ------------------ 2231| 591| break; 2232| 0| default: ------------------ | Branch (2232:3): [True: 0, False: 732] ------------------ 2233| 0| return syserror_set(-EINVAL, "Unknown LXC specific mount option"); ------------------ | | 568| 0| ({ \ | | 569| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 0| errno = labs(__ret__); \ | | 571| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 572| 0| __internal_ret__; \ | | 573| 0| }) ------------------ 2234| 732| } 2235| | 2236| 614| opt_next = strchr(opt, ','); 2237| 614| if (!opt_next) ------------------ | Branch (2237:7): [True: 405, False: 209] ------------------ 2238| 405| *opt = '\0'; /* no more mntopts, so just chop it here */ 2239| 209| else 2240| 209| memmove(opt, opt_next + 1, strlen(opt_next + 1) + 1); 2241| 614| } 2242| | 2243| 1.84k| return 0; 2244| 1.95k|} parse_cap: 2828| 66|{ 2829| 66| size_t end = sizeof(caps_opt) / sizeof(caps_opt[0]); 2830| 66| int ret; 2831| 66| unsigned int res; 2832| 66| __u32 last_cap; 2833| | 2834| 66| if (strequal(cap_name, "none")) ------------------ | Branch (2834:6): [True: 0, False: 66] ------------------ 2835| 0| return -2; 2836| | 2837| 66|#if HAVE_LIBCAP == 0 2838| 66| WARN("capabilities are disabled or libcap not found"); ------------------ | | 367| 66|#define WARN(format, ...) do { \ | | 368| 66| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 66| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 369| 66| LXC_WARN(&locinfo, format, ##__VA_ARGS__); \ | | 370| 66|} while (0) | | ------------------ | | | Branch (370:10): [Folded, False: 66] | | ------------------ ------------------ 2839| 66|#endif 2840| | 2841| 66| for (size_t i = 0; i < end; i++) { ------------------ | Branch (2841:21): [True: 0, False: 66] ------------------ 2842| 0| if (!strequal(cap_name, caps_opt[i].name)) ------------------ | Branch (2842:7): [True: 0, False: 0] ------------------ 2843| 0| continue; 2844| | 2845| 0| *cap = caps_opt[i].value; 2846| 0| return 0; 2847| 0| } 2848| | 2849| | /* 2850| | * Try to see if it's numeric, so the user may specify 2851| | * capabilities that the running kernel knows about but we 2852| | * don't. 2853| | */ 2854| 66| ret = lxc_safe_uint(cap_name, &res); 2855| 66| if (ret < 0) ------------------ | Branch (2855:6): [True: 66, False: 0] ------------------ 2856| 66| return -1; 2857| | 2858| 0| ret = lxc_caps_last_cap(&last_cap); 2859| 0| if (ret) ------------------ | Branch (2859:6): [True: 0, False: 0] ------------------ 2860| 0| return -1; 2861| | 2862| 0| if ((__u32)res > last_cap) ------------------ | Branch (2862:6): [True: 0, False: 0] ------------------ 2863| 0| return -1; 2864| | 2865| 0| *cap = (__u32)res; 2866| 0| return 0; 2867| 0|} lxc_conf_init: 3065| 11.8k|{ 3066| 11.8k| int i; 3067| 11.8k| struct lxc_conf *new; 3068| | 3069| 11.8k| new = zalloc(sizeof(*new)); ------------------ | | 90| 11.8k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 3070| 11.8k| if (!new) ------------------ | Branch (3070:6): [True: 0, False: 11.8k] ------------------ 3071| 0| return NULL; 3072| | 3073| 11.8k| new->loglevel = LXC_LOG_LEVEL_NOTSET; 3074| 11.8k| new->personality = LXC_ARCH_UNCHANGED; ------------------ | | 86| 11.8k|#define LXC_ARCH_UNCHANGED 0xffffffffL ------------------ 3075| 11.8k| new->autodev = 1; 3076| 11.8k| new->console.buffer_size = 0; 3077| 11.8k| new->console.log_path = NULL; 3078| 11.8k| new->console.log_fd = -1; 3079| 11.8k| new->console.log_size = 0; 3080| 11.8k| new->console.path = NULL; 3081| 11.8k| new->console.peer = -1; 3082| 11.8k| new->console.proxy.busy = -1; 3083| 11.8k| new->console.proxy.ptx = -1; 3084| 11.8k| new->console.proxy.pty = -1; 3085| 11.8k| new->console.ptx = -EBADF; 3086| 11.8k| new->console.pty = -EBADF; 3087| 11.8k| new->console.pty_nr = -1; 3088| 11.8k| new->console.name[0] = '\0'; 3089| 11.8k| new->devpts_fd = -EBADF; 3090| 11.8k| memset(&new->console.ringbuf, 0, sizeof(struct lxc_ringbuf)); 3091| 11.8k| new->maincmd_fd = -1; 3092| 11.8k| new->monitor_signal_pdeath = SIGKILL; 3093| 11.8k| new->nbd_idx = -1; 3094| 11.8k| new->rootfs.mount = strdup(default_rootfs_mount); 3095| 11.8k| if (!new->rootfs.mount) { ------------------ | Branch (3095:6): [True: 0, False: 11.8k] ------------------ 3096| 0| free(new); 3097| 0| return NULL; 3098| 0| } 3099| 11.8k| new->rootfs.managed = true; 3100| 11.8k| new->rootfs.dfd_mnt = -EBADF; 3101| 11.8k| new->rootfs.dfd_dev = -EBADF; 3102| 11.8k| new->rootfs.dfd_host = -EBADF; 3103| 11.8k| new->rootfs.fd_path_pin = -EBADF; 3104| 11.8k| new->rootfs.dfd_idmapped = -EBADF; 3105| 11.8k| new->logfd = -1; 3106| 11.8k| INIT_LIST_HEAD(&new->cgroup2); 3107| | /* Block ("allowlist") all devices by default. */ 3108| 11.8k| new->bpf_devices.list_type = LXC_BPF_DEVICE_CGROUP_ALLOWLIST; 3109| 11.8k| INIT_LIST_HEAD(&(new->bpf_devices).devices); 3110| 11.8k| INIT_LIST_HEAD(&new->mount_entries); 3111| 11.8k| INIT_LIST_HEAD(&new->caps.list); 3112| 11.8k| INIT_LIST_HEAD(&new->id_map); 3113| 11.8k| new->root_nsuid_map = NULL; 3114| 11.8k| new->root_nsgid_map = NULL; 3115| 11.8k| INIT_LIST_HEAD(&new->environment); 3116| 11.8k| INIT_LIST_HEAD(&new->environment_runtime); 3117| 11.8k| INIT_LIST_HEAD(&new->environment_hooks); 3118| 11.8k| INIT_LIST_HEAD(&new->limits); 3119| 11.8k| INIT_LIST_HEAD(&new->sysctls); 3120| 11.8k| INIT_LIST_HEAD(&new->procs); 3121| 11.8k| new->hooks_version = 0; 3122| 130k| for (i = 0; i < NUM_LXC_HOOKS; i++) ------------------ | Branch (3122:14): [True: 118k, False: 11.8k] ------------------ 3123| 118k| INIT_LIST_HEAD(&new->hooks[i]); 3124| 11.8k| INIT_LIST_HEAD(&new->groups); 3125| 11.8k| INIT_LIST_HEAD(&new->state_clients); 3126| 11.8k| new->lsm_aa_profile = NULL; 3127| 11.8k| INIT_LIST_HEAD(&new->lsm_aa_raw); 3128| 11.8k| new->lsm_se_context = NULL; 3129| 11.8k| new->lsm_se_keyring_context = NULL; 3130| 11.8k| new->keyring_disable_session = false; 3131| 11.8k| new->transient_procfs_mnt = false; 3132| 11.8k| new->shmount.path_host = NULL; 3133| 11.8k| new->shmount.path_cont = NULL; 3134| 11.8k| new->sched_core = false; 3135| 11.8k| new->sched_core_cookie = INVALID_SCHED_CORE_COOKIE; ------------------ | | 207| 11.8k|#define INVALID_SCHED_CORE_COOKIE ((__u64)-1) ------------------ 3136| | 3137| | /* if running in a new user namespace, init and COMMAND 3138| | * default to running as UID/GID 0 when using lxc-execute */ 3139| 11.8k| new->init_uid = 0; 3140| 11.8k| new->init_gid = 0; 3141| 11.8k| memset(&new->init_groups, 0, sizeof(lxc_groups_t)); 3142| 11.8k| memset(&new->cgroup_meta, 0, sizeof(struct lxc_cgroup)); 3143| 11.8k| memset(&new->ns_share, 0, sizeof(char *) * LXC_NS_MAX); 3144| 11.8k| memset(&new->timens, 0, sizeof(struct timens_offsets)); 3145| 11.8k| seccomp_conf_init(new); 3146| | 3147| 11.8k| INIT_LIST_HEAD(&new->netdevs); 3148| | 3149| 11.8k| return new; 3150| 11.8k|} lxc_clear_config_caps: 3952| 13.0k|{ 3953| 13.0k| struct cap_entry *cap, *ncap; 3954| | 3955| 13.0k| list_for_each_entry_safe(cap, ncap, &c->caps.list, head) { ------------------ | | 655| 13.0k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 13.0k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 13.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.0k| do { \ | | | | | | | | | | | | | | | | 286| 13.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 13.0k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 13.0k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 13.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.0k| do { \ | | | | | | | | | | | | | | | | 286| 13.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 13.0k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.0k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 0, False: 13.0k] | | ------------------ | | 658| 13.0k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 0| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 0| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 0|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 0| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 0| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 0|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 0| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 0| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 0| do { \ | | | | | | | | | | | | | | | | 286| 0| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 0] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 0| !__same_type(*(ptr), void), \ | | | | | | | | 813| 0| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 0| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 3956| 0| list_del(&cap->head); 3957| 0| free(cap->cap_name); 3958| 0| free(cap); 3959| 0| } 3960| | 3961| | c->caps.keep = false; 3962| 13.0k| INIT_LIST_HEAD(&c->caps.list); 3963| 13.0k| return 0; 3964| 13.0k|} lxc_clear_idmaps: 3987| 12.6k|{ 3988| 12.6k| c->root_nsuid_map = NULL; 3989| | c->root_nsgid_map = NULL; 3990| 12.6k| return lxc_free_idmap(&c->id_map); 3991| 12.6k|} lxc_clear_namespace: 3994| 11.8k|{ 3995| 106k| for (int i = 0; i < LXC_NS_MAX; i++) ------------------ | Branch (3995:18): [True: 94.6k, False: 11.8k] ------------------ 3996| 94.6k| free_disarm(c->ns_share[i]); ------------------ | | 58| 94.6k| ({ \ | | 59| 94.6k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 45, False: 94.6k] | | ------------------ | | 60| 45| free(ptr); \ | | 61| 45| ptr = NULL; \ | | 62| 45| } \ | | 63| 94.6k| }) ------------------ 3997| | 3998| 11.8k| return 0; 3999| 11.8k|} lxc_clear_cgroups: 4002| 12.6k|{ 4003| 12.6k| const char *k = key; 4004| 12.6k| bool all = false; 4005| 12.6k| char *global_token, *namespaced_token; 4006| 12.6k| size_t namespaced_token_len; 4007| 12.6k| struct list_head *list; 4008| 12.6k| struct lxc_cgroup *cgroup, *ncgroup; 4009| | 4010| 12.6k| if (version == CGROUP2_SUPER_MAGIC) { ------------------ | Branch (4010:6): [True: 12.6k, False: 0] ------------------ 4011| 12.6k| global_token = "lxc.cgroup2"; 4012| 12.6k| namespaced_token = "lxc.cgroup2."; 4013| 12.6k| namespaced_token_len = STRLITERALLEN("lxc.cgroup2."); ------------------ | | 687| 12.6k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4014| 12.6k| list = &c->cgroup2; 4015| 12.6k| } else { 4016| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 4017| 0| } 4018| | 4019| 12.6k| if (strequal(key, global_token)) ------------------ | Branch (4019:6): [True: 12.0k, False: 576] ------------------ 4020| 12.0k| all = true; 4021| 576| else if (strnequal(key, namespaced_token, namespaced_token_len)) ------------------ | Branch (4021:11): [True: 567, False: 9] ------------------ 4022| 567| k += namespaced_token_len; 4023| 9| else 4024| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 4025| | 4026| 12.6k| list_for_each_entry_safe(cgroup, ncgroup, list, head) { ------------------ | | 655| 12.6k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.6k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.6k| do { \ | | | | | | | | | | | | | | | | 286| 12.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.6k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.6k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.6k| do { \ | | | | | | | | | | | | | | | | 286| 12.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 13.7k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.7k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.12k, False: 12.6k] | | ------------------ | | 658| 12.6k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.12k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.12k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.12k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.12k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.12k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.12k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.12k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.12k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.12k| do { \ | | | | | | | | | | | | | | | | 286| 1.12k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.12k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.12k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.12k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.12k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4027| 1.12k| if (!all && !strequal(cgroup->subsystem, k)) ------------------ | Branch (4027:7): [True: 748, False: 381] | Branch (4027:15): [True: 554, False: 194] ------------------ 4028| 554| continue; 4029| | 4030| 575| list_del(&cgroup->head); 4031| 575| free(cgroup->subsystem); 4032| 575| free(cgroup->value); 4033| 575| free(cgroup); 4034| 575| } 4035| | 4036| 12.6k| if (all) ------------------ | Branch (4036:6): [True: 12.0k, False: 567] ------------------ 4037| 12.0k| INIT_LIST_HEAD(list); 4038| | 4039| 12.6k| return 0; 4040| 12.6k|} lxc_clear_limits: 4048| 12.8k|{ 4049| 12.8k| const char *k = NULL; 4050| 12.8k| bool all = false; 4051| 12.8k| struct lxc_limit *lim, *nlim; 4052| | 4053| 12.8k| if (strequal(key, "lxc.limit") || strequal(key, "lxc.prlimit")) ------------------ | Branch (4053:6): [True: 0, False: 12.8k] | Branch (4053:36): [True: 12.0k, False: 781] ------------------ 4054| 12.0k| all = true; 4055| 781| else if (strnequal(key, "lxc.limit.", STRLITERALLEN("lxc.limit."))) ------------------ | | 687| 781|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4055:11): [True: 0, False: 781] ------------------ 4056| 0| k = key + STRLITERALLEN("lxc.limit."); ------------------ | | 687| 0|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4057| 781| else if (strnequal(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit."))) ------------------ | | 687| 781|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4057:11): [True: 773, False: 8] ------------------ 4058| 773| k = key + STRLITERALLEN("lxc.prlimit."); ------------------ | | 687| 773|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4059| 8| else 4060| 8| return ret_errno(EINVAL); ------------------ | | 715| 8| ({ \ | | 716| 8| errno = labs(__errno__); \ | | 717| 8| -errno; \ | | 718| 8| }) ------------------ 4061| | 4062| 12.8k| list_for_each_entry_safe(lim, nlim, &c->limits, head) { ------------------ | | 655| 12.8k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.8k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.8k| do { \ | | | | | | | | | | | | | | | | 286| 12.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.8k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.8k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.8k| do { \ | | | | | | | | | | | | | | | | 286| 12.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 14.6k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 14.6k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.78k, False: 12.8k] | | ------------------ | | 658| 12.8k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.78k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.78k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.78k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.78k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.78k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.78k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.78k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.78k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.78k| do { \ | | | | | | | | | | | | | | | | 286| 1.78k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.78k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.78k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.78k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.78k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4063| 1.78k| if (!all && !strequal(lim->resource, k)) ------------------ | Branch (4063:7): [True: 1.03k, False: 753] | Branch (4063:15): [True: 835, False: 195] ------------------ 4064| 835| continue; 4065| | 4066| 948| list_del(&lim->head); 4067| 948| free_disarm(lim->resource); ------------------ | | 58| 948| ({ \ | | 59| 948| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 948, False: 0] | | ------------------ | | 60| 948| free(ptr); \ | | 61| 948| ptr = NULL; \ | | 62| 948| } \ | | 63| 948| }) ------------------ 4068| 948| free(lim); 4069| 948| } 4070| | 4071| 12.8k| if (all) ------------------ | Branch (4071:6): [True: 12.0k, False: 773] ------------------ 4072| 12.0k| INIT_LIST_HEAD(&c->limits); 4073| | 4074| 12.8k| return 0; 4075| 12.8k|} lxc_clear_sysctls: 4078| 13.0k|{ 4079| 13.0k| const char *k = NULL; 4080| 13.0k| bool all = false; 4081| 13.0k| struct lxc_sysctl *sysctl, *nsysctl; 4082| | 4083| 13.0k| if (strequal(key, "lxc.sysctl")) ------------------ | Branch (4083:6): [True: 12.2k, False: 864] ------------------ 4084| 12.2k| all = true; 4085| 864| else if (strnequal(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl."))) ------------------ | | 687| 864|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4085:11): [True: 856, False: 8] ------------------ 4086| 856| k = key + STRLITERALLEN("lxc.sysctl."); ------------------ | | 687| 856|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4087| 8| else 4088| 8| return -1; 4089| | 4090| 13.0k| list_for_each_entry_safe(sysctl, nsysctl, &c->sysctls, head) { ------------------ | | 655| 13.0k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 13.0k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 13.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.0k| do { \ | | | | | | | | | | | | | | | | 286| 13.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 13.0k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 13.0k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 13.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.0k| do { \ | | | | | | | | | | | | | | | | 286| 13.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 14.9k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 14.9k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.83k, False: 13.0k] | | ------------------ | | 658| 13.0k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.83k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.83k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.83k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.83k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.83k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.83k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.83k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.83k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.83k| do { \ | | | | | | | | | | | | | | | | 286| 1.83k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.83k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.83k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.83k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.83k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4091| 1.83k| if (!all && !strequal(sysctl->key, k)) ------------------ | Branch (4091:7): [True: 1.14k, False: 683] | Branch (4091:15): [True: 954, False: 195] ------------------ 4092| 954| continue; 4093| | 4094| 878| list_del(&sysctl->head); 4095| 878| free(sysctl->key); 4096| 878| free(sysctl->value); 4097| 878| free(sysctl); 4098| 878| } 4099| | 4100| 13.0k| if (all) ------------------ | Branch (4100:6): [True: 12.2k, False: 856] ------------------ 4101| 12.2k| INIT_LIST_HEAD(&c->sysctls); 4102| | 4103| 13.0k| return 0; 4104| 13.0k|} lxc_clear_procs: 4107| 12.8k|{ 4108| 12.8k| const char *k = NULL; 4109| 12.8k| bool all = false; 4110| 12.8k| struct lxc_proc *proc, *nproc; 4111| | 4112| 12.8k| if (strequal(key, "lxc.proc")) ------------------ | Branch (4112:6): [True: 12.1k, False: 714] ------------------ 4113| 12.1k| all = true; 4114| 714| else if (strnequal(key, "lxc.proc.", STRLITERALLEN("lxc.proc."))) ------------------ | | 687| 714|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4114:11): [True: 705, False: 9] ------------------ 4115| 705| k = key + STRLITERALLEN("lxc.proc."); ------------------ | | 687| 705|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4116| 9| else 4117| 9| return -1; 4118| | 4119| 12.8k| list_for_each_entry_safe(proc, nproc, &c->procs, head) { ------------------ | | 655| 12.8k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.8k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.8k| do { \ | | | | | | | | | | | | | | | | 286| 12.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.8k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.8k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.8k| do { \ | | | | | | | | | | | | | | | | 286| 12.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 14.3k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 14.3k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.57k, False: 12.8k] | | ------------------ | | 658| 12.8k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.57k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.57k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.57k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.57k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.57k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.57k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.57k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.57k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.57k| do { \ | | | | | | | | | | | | | | | | 286| 1.57k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.57k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.57k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.57k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.57k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4120| 1.57k| if (!all && !strequal(proc->filename, k)) ------------------ | Branch (4120:7): [True: 1.05k, False: 525] | Branch (4120:15): [True: 840, False: 210] ------------------ 4121| 840| continue; 4122| | 4123| 735| list_del(&proc->head); 4124| 735| free(proc->filename); 4125| 735| free(proc->value); 4126| 735| free(proc); 4127| 735| } 4128| | 4129| 12.8k| if (all) ------------------ | Branch (4129:6): [True: 12.1k, False: 705] ------------------ 4130| 12.1k| INIT_LIST_HEAD(&c->procs); 4131| | 4132| 12.8k| return 0; 4133| 12.8k|} lxc_clear_groups: 4136| 12.2k|{ 4137| 12.2k| struct string_entry *entry, *nentry; 4138| | 4139| 12.2k| list_for_each_entry_safe(entry, nentry, &c->groups, head) { ------------------ | | 655| 12.2k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.2k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.2k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.2k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.2k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.2k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.2k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.2k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.2k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.2k| do { \ | | | | | | | | | | | | | | | | 286| 12.2k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.2k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.2k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.2k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.2k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.2k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.2k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.2k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.2k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.2k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.2k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.2k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.2k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.2k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.2k| do { \ | | | | | | | | | | | | | | | | 286| 12.2k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.2k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.2k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.2k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.2k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 13.3k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.3k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.12k, False: 12.2k] | | ------------------ | | 658| 12.2k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.12k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.12k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.12k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.12k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.12k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.12k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.12k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.12k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.12k| do { \ | | | | | | | | | | | | | | | | 286| 1.12k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.12k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.12k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.12k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.12k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4140| 1.12k| list_del(&entry->head); 4141| 1.12k| free(entry->val); 4142| 1.12k| free(entry); 4143| 1.12k| } 4144| | 4145| 12.2k| INIT_LIST_HEAD(&c->groups); 4146| 12.2k| return 0; 4147| 12.2k|} lxc_clear_environment: 4150| 12.7k|{ 4151| 12.7k| struct environment_entry *env, *nenv; 4152| | 4153| 12.7k| list_for_each_entry_safe(env, nenv, environment, head) { ------------------ | | 655| 12.7k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.7k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.7k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.7k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.7k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.7k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.7k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.7k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.7k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.7k| do { \ | | | | | | | | | | | | | | | | 286| 12.7k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.7k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.7k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.7k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.7k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.7k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.7k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.7k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.7k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.7k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.7k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.7k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.7k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.7k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.7k| do { \ | | | | | | | | | | | | | | | | 286| 12.7k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.7k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.7k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.7k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.7k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 13.7k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.7k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.02k, False: 12.7k] | | ------------------ | | 658| 12.7k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.02k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.02k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.02k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.02k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.02k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.02k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.02k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.02k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.02k| do { \ | | | | | | | | | | | | | | | | 286| 1.02k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.02k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.02k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.02k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.02k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4154| 1.02k| list_del(&env->head); 4155| 1.02k| free(env->key); 4156| 1.02k| free(env->val); 4157| 1.02k| free(env); 4158| 1.02k| } 4159| | 4160| 12.7k| INIT_LIST_HEAD(environment); 4161| 12.7k| return 0; 4162| 12.7k|} lxc_clear_mount_entries: 4165| 12.2k|{ 4166| 12.2k| struct string_entry *entry, *nentry; 4167| | 4168| 12.2k| list_for_each_entry_safe(entry, nentry, &c->mount_entries, head) { ------------------ | | 655| 12.2k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.2k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.2k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.2k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.2k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.2k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.2k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.2k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.2k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.2k| do { \ | | | | | | | | | | | | | | | | 286| 12.2k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.2k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.2k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.2k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.2k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.2k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.2k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.2k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.2k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.2k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.2k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.2k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.2k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.2k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.2k| do { \ | | | | | | | | | | | | | | | | 286| 12.2k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.2k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.2k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.2k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.2k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 13.0k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.0k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 811, False: 12.2k] | | ------------------ | | 658| 12.2k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 811| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 811| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 811|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 811| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 811| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 811|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 811| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 811| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 811| do { \ | | | | | | | | | | | | | | | | 286| 811| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 811] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 811| !__same_type(*(ptr), void), \ | | | | | | | | 813| 811| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 811| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4169| 811| list_del(&entry->head); 4170| 811| free(entry->val); 4171| 811| free(entry); 4172| 811| } 4173| | 4174| 12.2k| INIT_LIST_HEAD(&c->mount_entries); 4175| 12.2k| return 0; 4176| 12.2k|} lxc_clear_hooks: 4185| 13.4k|{ 4186| 13.4k| const char *k = NULL; 4187| 13.4k| bool all = false, done = false; 4188| 13.4k| struct string_entry *entry, *nentry; 4189| | 4190| 13.4k| if (strequal(key, "lxc.hook")) ------------------ | Branch (4190:6): [True: 12.8k, False: 621] ------------------ 4191| 12.8k| all = true; 4192| 621| else if (strnequal(key, "lxc.hook.", STRLITERALLEN("lxc.hook."))) ------------------ | | 687| 621|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4192:11): [True: 621, False: 0] ------------------ 4193| 621| k = key + STRLITERALLEN("lxc.hook."); ------------------ | | 687| 621|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4194| 0| else 4195| 0| return -1; 4196| | 4197| 147k| for (int i = 0; i < NUM_LXC_HOOKS; i++) { ------------------ | Branch (4197:18): [True: 134k, False: 13.4k] ------------------ 4198| 134k| if (all || strequal(k, lxchook_names[i])) { ------------------ | Branch (4198:7): [True: 128k, False: 6.21k] | Branch (4198:14): [True: 621, False: 5.58k] ------------------ 4199| 128k| list_for_each_entry_safe(entry, nentry, &c->hooks[i], head) { ------------------ | | 655| 128k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 128k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 128k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 128k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 128k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 128k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 128k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 128k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 128k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 128k| do { \ | | | | | | | | | | | | | | | | 286| 128k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 128k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 128k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 128k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 128k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 128k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 128k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 128k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 128k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 128k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 128k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 128k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 128k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 128k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 128k| do { \ | | | | | | | | | | | | | | | | 286| 128k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 128k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 128k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 128k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 128k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 131k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 131k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 2.34k, False: 128k] | | ------------------ | | 658| 128k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 2.34k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 2.34k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.34k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.34k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.34k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.34k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.34k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.34k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.34k| do { \ | | | | | | | | | | | | | | | | 286| 2.34k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.34k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.34k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.34k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.34k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4200| 2.34k| list_del(&entry->head); 4201| 2.34k| free(entry->val); 4202| 2.34k| free(entry); 4203| 2.34k| } 4204| 128k| INIT_LIST_HEAD(&c->hooks[i]); 4205| 128k| done = true; 4206| 128k| } 4207| 134k| } 4208| | 4209| 13.4k| if (!done) ------------------ | Branch (4209:6): [True: 0, False: 13.4k] ------------------ 4210| 0| return log_error(-1, "Invalid hook key: %s", key); ------------------ | | 494| 0| ({ \ | | 495| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 496| 0| ERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 497| 0| __internal_ret__; \ | | 498| 0| }) ------------------ 4211| | 4212| 13.4k| return 0; 4213| 13.4k|} lxc_clear_apparmor_raw: 4216| 11.8k|{ 4217| 11.8k| struct string_entry *entry, *nentry; 4218| | 4219| 11.8k| list_for_each_entry_safe(entry, nentry, &c->lsm_aa_raw, head) { ------------------ | | 655| 11.8k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 11.8k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 11.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 11.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 11.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 11.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 11.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 11.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 11.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 11.8k| do { \ | | | | | | | | | | | | | | | | 286| 11.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 11.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 11.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 11.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 11.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 11.8k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 11.8k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 11.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 11.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 11.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 11.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 11.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 11.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 11.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 11.8k| do { \ | | | | | | | | | | | | | | | | 286| 11.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 11.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 11.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 11.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 11.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 11.8k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 11.8k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 0, False: 11.8k] | | ------------------ | | 658| 11.8k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 0| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 0| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 0|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 0| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 0| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 0|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 0| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 0| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 0| do { \ | | | | | | | | | | | | | | | | 286| 0| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 0] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 0| !__same_type(*(ptr), void), \ | | | | | | | | 813| 0| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 0| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4220| 0| list_del(&entry->head); 4221| 0| free(entry->val); 4222| 0| free(entry); 4223| 0| } 4224| | 4225| 11.8k| INIT_LIST_HEAD(&c->lsm_aa_raw); 4226| 11.8k| return 0; 4227| 11.8k|} lxc_conf_free: 4230| 11.8k|{ 4231| 11.8k| if (!conf) ------------------ | Branch (4231:6): [True: 0, False: 11.8k] ------------------ 4232| 0| return; 4233| | 4234| 11.8k| if (current_config == conf) ------------------ | Branch (4234:6): [True: 0, False: 11.8k] ------------------ 4235| 0| current_config = NULL; 4236| 11.8k| lxc_terminal_conf_free(&conf->console); 4237| 11.8k| free(conf->rootfs.__bdev_type); 4238| 11.8k| free(conf->rootfs.mount); 4239| 11.8k| free(conf->rootfs.path); 4240| 11.8k| put_lxc_rootfs(&conf->rootfs, true); 4241| 11.8k| free(conf->logfile); 4242| 11.8k| if (conf->logfd != -1) ------------------ | Branch (4242:6): [True: 180, False: 11.6k] ------------------ 4243| 180| close(conf->logfd); 4244| 11.8k| free(conf->utsname); 4245| 11.8k| free(conf->ttys.dir); 4246| 11.8k| free(conf->ttys.tty_names); 4247| 11.8k| free(conf->fstab); 4248| 11.8k| free(conf->rcfile); 4249| 11.8k| free(conf->execute_cmd); 4250| 11.8k| free(conf->init_cmd); 4251| 11.8k| free(conf->init_groups.list); 4252| 11.8k| free(conf->init_cwd); 4253| 11.8k| free(conf->unexpanded_config); 4254| 11.8k| free(conf->syslog); 4255| 11.8k| lxc_free_networks(conf); 4256| 11.8k| free(conf->lsm_aa_profile); 4257| 11.8k| free(conf->lsm_aa_profile_computed); 4258| 11.8k| free(conf->lsm_se_context); 4259| 11.8k| free(conf->lsm_se_keyring_context); 4260| 11.8k| lxc_seccomp_free(&conf->seccomp); 4261| 11.8k| lxc_clear_config_caps(conf); 4262| | lxc_clear_cgroups(conf, "lxc.cgroup2", CGROUP2_SUPER_MAGIC); 4263| 11.8k| lxc_clear_cgroups_devices(conf); 4264| 11.8k| lxc_clear_hooks(conf, "lxc.hook"); 4265| 11.8k| lxc_clear_mount_entries(conf); 4266| 11.8k| lxc_clear_idmaps(conf); 4267| 11.8k| lxc_clear_groups(conf); 4268| 11.8k| lxc_clear_environment(&conf->environment); 4269| 11.8k| lxc_clear_limits(conf, "lxc.prlimit"); 4270| 11.8k| lxc_clear_sysctls(conf, "lxc.sysctl"); 4271| 11.8k| lxc_clear_procs(conf, "lxc.proc"); 4272| 11.8k| lxc_clear_apparmor_raw(conf); 4273| 11.8k| lxc_clear_namespace(conf); 4274| 11.8k| free(conf->cgroup_meta.dir); 4275| 11.8k| free(conf->cgroup_meta.monitor_dir); 4276| 11.8k| free(conf->cgroup_meta.monitor_pivot_dir); 4277| 11.8k| free(conf->cgroup_meta.container_dir); 4278| 11.8k| free(conf->cgroup_meta.namespace_dir); 4279| 11.8k| free(conf->cgroup_meta.controllers); 4280| 11.8k| free(conf->cgroup_meta.systemd_scope); 4281| 11.8k| free(conf->shmount.path_host); 4282| 11.8k| free(conf->shmount.path_cont); 4283| 11.8k| free(conf); 4284| 11.8k|} conf.c:parse_vfs_attr: 1943| 16.4k|{ 1944| | /* 1945| | * If opt is found in mount_opt, set or clear flags. 1946| | * Otherwise append it to data. 1947| | */ 1948| 458k| for (struct mount_opt *mo = &mount_opt[0]; mo->name != NULL; mo++) { ------------------ | Branch (1948:45): [True: 444k, False: 14.6k] ------------------ 1949| 444k| if (!strnequal(opt, mo->name, strlen(mo->name))) ------------------ | Branch (1949:7): [True: 442k, False: 1.78k] ------------------ 1950| 442k| continue; 1951| | 1952| | /* This is a recursive bind-mount. */ 1953| 1.78k| if (strequal(mo->name, "rbind")) { ------------------ | Branch (1953:7): [True: 646, False: 1.13k] ------------------ 1954| 646| opts->bind_recursively = 1; 1955| 646| opts->bind = 1; 1956| 646| opts->mnt_flags |= mo->legacy_flag; /* MS_BIND | MS_REC */ 1957| 646| return 0; 1958| 646| } 1959| | 1960| | /* This is a bind-mount. */ 1961| 1.13k| if (strequal(mo->name, "bind")) { ------------------ | Branch (1961:7): [True: 267, False: 869] ------------------ 1962| 267| opts->bind = 1; 1963| 267| opts->mnt_flags |= mo->legacy_flag; /* MS_BIND */ 1964| 267| return 0; 1965| 267| } 1966| | 1967| 869| if (mo->flag == (__u64)~0) ------------------ | Branch (1967:7): [True: 227, False: 642] ------------------ 1968| 227| return log_info(0, "Ignoring %s mount option", mo->name); ------------------ | | 554| 227| ({ \ | | 555| 227| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 556| 227| INFO(format, ##__VA_ARGS__); \ | | ------------------ | | | | 357| 227|#define INFO(format, ...) do { \ | | | | 358| 227| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 227| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 359| 227| LXC_INFO(&locinfo, format, ##__VA_ARGS__); \ | | | | 360| 227|} while (0) | | | | ------------------ | | | | | Branch (360:10): [Folded, False: 227] | | | | ------------------ | | ------------------ | | 557| 227| __internal_ret__; \ | | 558| 227| }) ------------------ 1969| | 1970| 642| if (mo->clear) { ------------------ | Branch (1970:7): [True: 445, False: 197] ------------------ 1971| 445| opts->attr.attr_clr |= mo->flag; 1972| 445| opts->mnt_flags &= ~mo->legacy_flag; 1973| 445| TRACE("Lowering %s", mo->name); ------------------ | | 347| 445|#define TRACE(format, ...) do { \ | | 348| 445| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 445| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 445| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 445|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 445] | | ------------------ ------------------ 1974| 445| } else { 1975| 197| opts->attr.attr_set |= mo->flag; 1976| 197| opts->mnt_flags |= mo->legacy_flag; 1977| 197| TRACE("Raising %s", mo->name); ------------------ | | 347| 197|#define TRACE(format, ...) do { \ | | 348| 197| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 197| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 197| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 197|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 197] | | ------------------ ------------------ 1978| 197| } 1979| | 1980| 642| return 0; 1981| 869| } 1982| | 1983| 117k| for (struct mount_opt *mo = &propagation_opt[0]; mo->name != NULL; mo++) { ------------------ | Branch (1983:51): [True: 107k, False: 9.32k] ------------------ 1984| 107k| if (!strnequal(opt, mo->name, strlen(mo->name))) ------------------ | Branch (1984:7): [True: 102k, False: 5.33k] ------------------ 1985| 102k| continue; 1986| | 1987| 5.33k| if (strequal(mo->name, "rslave") || ------------------ | Branch (1987:7): [True: 1.08k, False: 4.24k] ------------------ 1988| 4.24k| strequal(mo->name, "rshared") || ------------------ | Branch (1988:7): [True: 212, False: 4.03k] ------------------ 1989| 4.03k| strequal(mo->name, "runbindable") || ------------------ | Branch (1989:7): [True: 2.36k, False: 1.67k] ------------------ 1990| 1.67k| strequal(mo->name, "rprivate")) ------------------ | Branch (1990:7): [True: 593, False: 1.07k] ------------------ 1991| 4.25k| opts->propagate_recursively = 1; 1992| | 1993| 5.33k| opts->attr.propagation = mo->flag; 1994| 5.33k| opts->prop_flags |= mo->legacy_flag; 1995| 5.33k| return 0; 1996| 107k| } 1997| | 1998| | /* opt was skipped */ 1999| 9.32k| return 1; 2000| 14.6k|} conf.c:lxc_free_idmap: 3967| 12.6k|{ 3968| 12.6k| struct id_map *map, *nmap; 3969| | 3970| 12.6k| list_for_each_entry_safe(map, nmap, id_map, head) { ------------------ | | 655| 12.6k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.6k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.6k| do { \ | | | | | | | | | | | | | | | | 286| 12.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.6k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.6k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.6k| do { \ | | | | | | | | | | | | | | | | 286| 12.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 14.8k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 14.8k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 2.23k, False: 12.6k] | | ------------------ | | 658| 12.6k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 2.23k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 2.23k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.23k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.23k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.23k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.23k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.23k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.23k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.23k| do { \ | | | | | | | | | | | | | | | | 286| 2.23k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.23k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.23k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.23k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.23k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 3971| 2.23k| list_del(&map->head); 3972| 2.23k| free(map); 3973| 2.23k| } 3974| | 3975| 12.6k| INIT_LIST_HEAD(id_map); 3976| 12.6k| return 0; 3977| 12.6k|} conf.c:lxc_clear_cgroups_devices: 4043| 11.8k|{ 4044| 11.8k| lxc_clear_cgroup2_devices(&conf->bpf_devices); 4045| 11.8k|} conf.c:put_lxc_rootfs: 687| 11.8k|{ 688| 11.8k| if (rootfs) { ------------------ | Branch (688:6): [True: 11.8k, False: 0] ------------------ 689| 11.8k| close_prot_errno_disarm(rootfs->dfd_host); ------------------ | | 29| 11.8k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 11.8k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 690| 11.8k| close_prot_errno_disarm(rootfs->dfd_mnt); ------------------ | | 29| 11.8k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 11.8k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 691| 11.8k| close_prot_errno_disarm(rootfs->dfd_dev); ------------------ | | 29| 11.8k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 11.8k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 692| 11.8k| if (unpin) ------------------ | Branch (692:7): [True: 11.8k, False: 0] ------------------ 693| 11.8k| close_prot_errno_disarm(rootfs->fd_path_pin); ------------------ | | 29| 11.8k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 11.8k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 694| 11.8k| close_prot_errno_disarm(rootfs->dfd_idmapped); ------------------ | | 29| 11.8k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 11.8k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 695| 11.8k| put_lxc_mount_options(&rootfs->mnt_opts); 696| 11.8k| storage_put(rootfs->storage); 697| | rootfs->storage = NULL; 698| 11.8k| } 699| 11.8k|} conf.c:put_lxc_mount_options: 673| 11.8k|{ 674| 11.8k| mnt_opts->create_dir = 0; 675| 11.8k| mnt_opts->create_file = 0; 676| 11.8k| mnt_opts->optional = 0; 677| 11.8k| mnt_opts->relative = 0; 678| 11.8k| mnt_opts->userns_path[0] = '\0'; 679| 11.8k| mnt_opts->mnt_flags = 0; 680| 11.8k| mnt_opts->prop_flags = 0; 681| | 682| 11.8k| free_disarm(mnt_opts->data); ------------------ | | 58| 11.8k| ({ \ | | 59| 11.8k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 242, False: 11.5k] | | ------------------ | | 60| 242| free(ptr); \ | | 61| 242| ptr = NULL; \ | | 62| 242| } \ | | 63| 11.8k| }) ------------------ 683| | free_disarm(mnt_opts->raw_options); ------------------ | | 58| 11.8k| ({ \ | | 59| 11.8k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 355, False: 11.4k] | | ------------------ | | 60| 355| free(ptr); \ | | 61| 355| ptr = NULL; \ | | 62| 355| } \ | | 63| 11.8k| }) ------------------ 684| 11.8k|} conf.c:lxc_clear_cgroup2_devices: 702| 11.8k|{ 703| 11.8k| struct device_item *device, *n; 704| | 705| 11.8k| list_for_each_entry_safe(device, n, &bpf_devices->devices, head) ------------------ | | 655| 11.8k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 11.8k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 11.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 11.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 11.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 11.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 11.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 11.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 11.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 11.8k| do { \ | | | | | | | | | | | | | | | | 286| 11.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 11.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 11.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 11.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 11.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 11.8k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 11.8k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 11.8k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 11.8k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 11.8k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 11.8k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 11.8k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 11.8k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 11.8k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 11.8k| do { \ | | | | | | | | | | | | | | | | 286| 11.8k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 11.8k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 11.8k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 11.8k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 11.8k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 11.8k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 11.8k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 0, False: 11.8k] | | ------------------ | | 658| 11.8k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 0| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 0| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 0|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 0| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 0| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 0|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 0| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 0| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 0| do { \ | | | | | | | | | | | | | | | | 286| 0| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 0] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 0| !__same_type(*(ptr), void), \ | | | | | | | | 813| 0| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 0| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 706| 0| list_del(&device->head); 707| | 708| 11.8k| INIT_LIST_HEAD(&bpf_devices->devices); 709| 11.8k|} confile.c:put_lxc_mount_options: 673| 2.16k|{ 674| 2.16k| mnt_opts->create_dir = 0; 675| 2.16k| mnt_opts->create_file = 0; 676| 2.16k| mnt_opts->optional = 0; 677| 2.16k| mnt_opts->relative = 0; 678| 2.16k| mnt_opts->userns_path[0] = '\0'; 679| 2.16k| mnt_opts->mnt_flags = 0; 680| 2.16k| mnt_opts->prop_flags = 0; 681| | 682| 2.16k| free_disarm(mnt_opts->data); ------------------ | | 58| 2.16k| ({ \ | | 59| 2.16k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 534, False: 1.63k] | | ------------------ | | 60| 534| free(ptr); \ | | 61| 534| ptr = NULL; \ | | 62| 534| } \ | | 63| 2.16k| }) ------------------ 683| | free_disarm(mnt_opts->raw_options); ------------------ | | 58| 2.16k| ({ \ | | 59| 2.16k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 1.47k, False: 693] | | ------------------ | | 60| 1.47k| free(ptr); \ | | 61| 1.47k| ptr = NULL; \ | | 62| 1.47k| } \ | | 63| 2.16k| }) ------------------ 684| 2.16k|} lxc_get_config: 361| 101k|{ 362| 5.27M| for (size_t i = 0; i < ARRAY_SIZE(config_jump_table); i++) { ------------------ | | 728| 5.27M| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 5.27M| typeof(&*(x))), \ | | 730| 5.27M| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (362:21): [True: 5.27M, False: 389] ------------------ 363| 5.27M| struct lxc_config_t *cur = &config_jump_table[i]; 364| | 365| 5.27M| switch (match_config_item(cur, key)) { ------------------ | Branch (365:11): [True: 5.17M, False: 101k] ------------------ 366| 5.17M| case 0: ------------------ | Branch (366:3): [True: 5.17M, False: 101k] ------------------ 367| 5.17M| continue; 368| 0| case -E2BIG: ------------------ | Branch (368:3): [True: 0, False: 5.27M] ------------------ 369| 0| return &unsupported_config_key; 370| 5.27M| } 371| | 372| 101k| return cur; 373| 5.27M| } 374| | 375| 389| return &unsupported_config_key; 376| 101k|} append_unexp_config_line: 2705| 122k|{ 2706| 122k| size_t linelen; 2707| 122k| size_t len = conf->unexpanded_len; 2708| | 2709| 122k| update_hwaddr(line); 2710| | 2711| 122k| linelen = strlen(line); 2712| 138k| while (conf->unexpanded_alloced <= len + linelen + 2) { ------------------ | Branch (2712:9): [True: 15.8k, False: 122k] ------------------ 2713| 15.8k| char *tmp; 2714| | 2715| 15.8k| tmp = realloc(conf->unexpanded_config, conf->unexpanded_alloced + 1024); 2716| 15.8k| if (!tmp) ------------------ | Branch (2716:7): [True: 0, False: 15.8k] ------------------ 2717| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2718| | 2719| 15.8k| if (!conf->unexpanded_config) ------------------ | Branch (2719:7): [True: 11.8k, False: 4.02k] ------------------ 2720| 11.8k| *tmp = '\0'; 2721| | 2722| 15.8k| conf->unexpanded_config = tmp; 2723| 15.8k| conf->unexpanded_alloced += 1024; 2724| 15.8k| } 2725| | 2726| 122k| memcpy(conf->unexpanded_config + conf->unexpanded_len, line, linelen); 2727| 122k| conf->unexpanded_len += linelen; 2728| 122k| if (line[linelen - 1] != '\n') ------------------ | Branch (2728:6): [True: 122k, False: 248] ------------------ 2729| 122k| conf->unexpanded_config[conf->unexpanded_len++] = '\n'; 2730| 122k| conf->unexpanded_config[conf->unexpanded_len] = '\0'; 2731| | 2732| 122k| return 0; 2733| 122k|} lxc_config_read: 3192| 25.1k|{ 3193| 25.1k| struct parse_line_conf plc; 3194| | 3195| 25.1k| if (!conf) ------------------ | Branch (3195:6): [True: 0, False: 25.1k] ------------------ 3196| 0| return syserror_set(-EINVAL, "Missing config"); ------------------ | | 568| 0| ({ \ | | 569| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 0| errno = labs(__ret__); \ | | 571| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 572| 0| __internal_ret__; \ | | 573| 0| }) ------------------ 3197| | 3198| 25.1k| plc.conf = conf; 3199| 25.1k| plc.from_include = from_include; 3200| | 3201| | /* Catch only the top level config file name in the structure. */ 3202| 25.1k| if (!conf->rcfile) ------------------ | Branch (3202:6): [True: 11.8k, False: 13.3k] ------------------ 3203| 11.8k| conf->rcfile = strdup(file); 3204| | 3205| 25.1k| return lxc_file_for_each_line_mmap(file, parse_line, &plc); 3206| 25.1k|} lxc_config_parse_arch: 3259| 322|{ 3260| 322| static struct per_name { 3261| 322| char *name; 3262| 322| unsigned long per; 3263| 322| } pername[] = { 3264| 322| { "arm", PER_LINUX32 }, 3265| 322| { "armel", PER_LINUX32 }, 3266| 322| { "armhf", PER_LINUX32 }, 3267| 322| { "armv7l", PER_LINUX32 }, 3268| 322| { "athlon", PER_LINUX32 }, 3269| 322| { "i386", PER_LINUX32 }, 3270| 322| { "i486", PER_LINUX32 }, 3271| 322| { "i586", PER_LINUX32 }, 3272| 322| { "i686", PER_LINUX32 }, 3273| 322| { "linux32", PER_LINUX32 }, 3274| 322| { "mips", PER_LINUX32 }, 3275| 322| { "mipsel", PER_LINUX32 }, 3276| 322| { "ppc", PER_LINUX32 }, 3277| 322| { "powerpc", PER_LINUX32 }, 3278| 322| { "x32", PER_LINUX32 }, 3279| 322| { "x86", PER_LINUX32 }, 3280| 322| { "aarch64", PER_LINUX }, 3281| 322| { "amd64", PER_LINUX }, 3282| 322| { "arm64", PER_LINUX }, 3283| 322| { "linux64", PER_LINUX }, 3284| 322| { "loongarch64", PER_LINUX }, 3285| 322| { "loong64", PER_LINUX }, 3286| 322| { "mips64", PER_LINUX }, 3287| 322| { "mips64el", PER_LINUX }, 3288| 322| { "ppc64", PER_LINUX }, 3289| 322| { "ppc64el", PER_LINUX }, 3290| 322| { "ppc64le", PER_LINUX }, 3291| 322| { "powerpc64", PER_LINUX }, 3292| 322| { "riscv64", PER_LINUX }, 3293| 322| { "s390x", PER_LINUX }, 3294| 322| { "x86_64", PER_LINUX }, 3295| 322| }; 3296| | 3297| 2.91k| for (size_t i = 0; i < ARRAY_SIZE(pername); i++) { ------------------ | | 728| 2.91k| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 2.91k| typeof(&*(x))), \ | | 730| 2.91k| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (3297:21): [True: 2.84k, False: 76] ------------------ 3298| 2.84k| if (!strequal(pername[i].name, arch)) ------------------ | Branch (3298:7): [True: 2.59k, False: 246] ------------------ 3299| 2.59k| continue; 3300| | 3301| 246| *persona = pername[i].per; 3302| 246| return 0; 3303| 2.84k| } 3304| | 3305| 76| return ret_errno(EINVAL); ------------------ | | 715| 76| ({ \ | | 716| 76| errno = labs(__errno__); \ | | 717| 76| -errno; \ | | 718| 76| }) ------------------ 3306| 322|} confile.c:set_config_personality: 1428| 322|{ 1429| 322| int ret; 1430| 322| personality_t personality; 1431| | 1432| 322| ret = lxc_config_parse_arch(value, &personality); 1433| 322| if (ret < 0) ------------------ | Branch (1433:6): [True: 76, False: 246] ------------------ 1434| 76| return syserror("Unsupported personality \"%s\"", value); ------------------ | | 562| 76| ({ \ | | 563| 76| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 76| do { \ | | | | 454| 76| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 76| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 76| char *ptr = NULL; \ | | | | | | 317| 76| { \ | | | | | | 318| 76| int __saved_errno = errno; \ | | | | | | 319| 76| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 76| errno = __saved_errno; \ | | | | | | 321| 76| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 76] | | | | | | ------------------ | | | | | | 322| 76| ptr = errno_buf; \ | | | | | | 323| 76| } | | | | ------------------ | | | | 455| 76| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 76|#define ERROR(format, ...) do { \ | | | | | | 373| 76| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 76| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 76| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 76|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 76] | | | | | | ------------------ | | | | ------------------ | | | | 456| 76| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 76] | | | | ------------------ | | ------------------ | | 564| 76| (-labs(errno)); \ | | 565| 76| }) ------------------ 1435| | 1436| 246| lxc_conf->personality = personality; 1437| 246| return 0; 1438| 322|} confile.c:set_config_apparmor_profile: 1667| 1|{ 1668| |#if HAVE_APPARMOR 1669| | return set_config_string_item(&lxc_conf->lsm_aa_profile, value); 1670| |#else 1671| | return syserror_set(-EINVAL, "Built without AppArmor support"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1672| 1|#endif 1673| 1|} confile.c:set_config_apparmor_allow_incomplete: 1679| 1|{ 1680| |#if HAVE_APPARMOR 1681| | int ret; 1682| | 1683| | if (lxc_config_value_empty(value)) { 1684| | lxc_conf->lsm_aa_allow_incomplete = 0; 1685| | return 0; 1686| | } 1687| | 1688| | ret = lxc_safe_uint(value, &lxc_conf->lsm_aa_allow_incomplete); 1689| | if (ret) 1690| | return ret; 1691| | 1692| | if (lxc_conf->lsm_aa_allow_incomplete > 1) 1693| | return ret_errno(EINVAL); 1694| | 1695| | return 0; 1696| |#else 1697| | return syserror_set(-EINVAL, "Built without AppArmor support"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1698| 1|#endif 1699| 1|} confile.c:set_config_apparmor_allow_nesting: 1705| 1|{ 1706| |#if HAVE_APPARMOR 1707| | int ret; 1708| | 1709| | if (lxc_config_value_empty(value)) 1710| | return clr_config_apparmor_allow_nesting(key, lxc_conf, NULL); 1711| | 1712| | ret = lxc_safe_uint(value, &lxc_conf->lsm_aa_allow_nesting); 1713| | if (ret) 1714| | return ret; 1715| | 1716| | if (lxc_conf->lsm_aa_allow_nesting > 1) 1717| | return ret_errno(EINVAL); 1718| | 1719| | return 0; 1720| |#else 1721| | return syserror_set(-EINVAL, "Built without AppArmor support"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1722| 1|#endif 1723| 1|} confile.c:set_config_apparmor_raw: 1729| 1|{ 1730| |#if HAVE_APPARMOR 1731| | __do_free char *elem = NULL; 1732| | __do_free struct string_entry *entry = NULL; 1733| | 1734| | if (lxc_config_value_empty(value)) 1735| | return lxc_clear_apparmor_raw(lxc_conf); 1736| | 1737| | entry = zalloc(sizeof(struct string_entry)); 1738| | if (!entry) 1739| | return ret_errno(ENOMEM); 1740| | 1741| | elem = strdup(value); 1742| | if (!elem) 1743| | return ret_errno(ENOMEM); 1744| | 1745| | entry->val = move_ptr(elem); 1746| | list_add_tail(&entry->head, &lxc_conf->lsm_aa_raw); 1747| | move_ptr(entry); 1748| | 1749| | return 0; 1750| |#else 1751| | return syserror_set(-EINVAL, "Built without AppArmor support"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1752| 1|#endif 1753| 1|} confile.c:set_config_autodev_tmpfs_size: 1853| 1.62k|{ 1854| 1.62k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1854:6): [True: 202, False: 1.42k] ------------------ 1855| 202| lxc_conf->autodevtmpfssize = 500000; 1856| 202| return 0; 1857| 202| } 1858| | 1859| 1.42k| if (lxc_safe_int(value, &lxc_conf->autodevtmpfssize) < 0) ------------------ | Branch (1859:6): [True: 1.19k, False: 229] ------------------ 1860| 1.19k| lxc_conf->autodevtmpfssize = 500000; 1861| | 1862| 1.42k| return 0; 1863| 1.62k|} confile.c:set_config_autodev: 1833| 434|{ 1834| 434| int ret; 1835| | 1836| 434| if (lxc_config_value_empty(value)) { ------------------ | Branch (1836:6): [True: 194, False: 240] ------------------ 1837| 194| lxc_conf->autodev = 0; 1838| 194| return 0; 1839| 194| } 1840| | 1841| 240| ret = lxc_safe_uint(value, &lxc_conf->autodev); 1842| 240| if (ret) ------------------ | Branch (1842:6): [True: 7, False: 233] ------------------ 1843| 7| return ret_errno(EINVAL); ------------------ | | 715| 7| ({ \ | | 716| 7| errno = labs(__errno__); \ | | 717| 7| -errno; \ | | 718| 7| }) ------------------ 1844| | 1845| 233| if (lxc_conf->autodev > 1) ------------------ | Branch (1845:6): [True: 37, False: 196] ------------------ 1846| 37| return ret_errno(EINVAL); ------------------ | | 715| 37| ({ \ | | 716| 37| errno = labs(__errno__); \ | | 717| 37| -errno; \ | | 718| 37| }) ------------------ 1847| | 1848| 196| return 0; 1849| 233|} confile.c:set_config_cap_drop: 2526| 405|{ 2527| 405| __do_free char *caps = NULL; ------------------ | | 69| 405|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 405| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2528| 405| int ret; 2529| | 2530| 405| if (lxc_config_value_empty(value)) ------------------ | Branch (2530:6): [True: 194, False: 211] ------------------ 2531| 194| return lxc_clear_config_caps(lxc_conf); 2532| | 2533| 211| if (lxc_conf->caps.keep) ------------------ | Branch (2533:6): [True: 1, False: 210] ------------------ 2534| 1| return syserror_set(-EINVAL, "Keeping and dropping capabilities are mutually exclusive"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2535| | 2536| 210| caps = strdup(value); 2537| 210| if (!caps) ------------------ | Branch (2537:6): [True: 0, False: 210] ------------------ 2538| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2539| | 2540| 210| ret = add_cap_entry(lxc_conf, caps, false); 2541| 210| if (ret < 0) ------------------ | Branch (2541:6): [True: 13, False: 197] ------------------ 2542| 13| return ret; 2543| | 2544| 197| lxc_conf->caps.keep = false; 2545| 197| return 0; 2546| 210|} confile.c:add_cap_entry: 2455| 913|{ 2456| 913| char *token; 2457| | 2458| | /* 2459| | * In case several capability keep is specified in a single line split 2460| | * these caps in a single element for the list. 2461| | */ 2462| 913| lxc_iterate_parts(token, caps, " \t") { ------------------ | | 187| 913| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.36k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 519, False: 846] | | ------------------ | | 189| 913| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2463| 519| __do_free struct cap_entry *new_cap = NULL; ------------------ | | 69| 519|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 519| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2464| 519| int ret; 2465| 519| __u32 cap; 2466| | 2467| 519| if (strequal(token, "none")) { ------------------ | Branch (2467:7): [True: 453, False: 66] ------------------ 2468| 453| if (!keep) ------------------ | Branch (2468:8): [True: 1, False: 452] ------------------ 2469| 1| return syserror_set(-EINVAL, "The \"none\" keyword is only valid when keeping caps"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2470| | 2471| 452| lxc_clear_config_caps(conf); 2472| 452| continue; 2473| 453| } 2474| | 2475| 66| ret = parse_cap(token, &cap); 2476| 66| if (ret < 0) { ------------------ | Branch (2476:7): [True: 66, False: 0] ------------------ 2477| 66| if (ret != -2) ------------------ | Branch (2477:8): [True: 66, False: 0] ------------------ 2478| 66| return syserror_set(-EINVAL, "Invalid capability specified: %s", token); ------------------ | | 568| 66| ({ \ | | 569| 66| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 66| errno = labs(__ret__); \ | | 571| 66| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 66| do { \ | | | | 454| 66| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 66| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 66| char *ptr = NULL; \ | | | | | | 317| 66| { \ | | | | | | 318| 66| int __saved_errno = errno; \ | | | | | | 319| 66| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 66| errno = __saved_errno; \ | | | | | | 321| 66| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 66] | | | | | | ------------------ | | | | | | 322| 66| ptr = errno_buf; \ | | | | | | 323| 66| } | | | | ------------------ | | | | 455| 66| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 66|#define ERROR(format, ...) do { \ | | | | | | 373| 66| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 66| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 66| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 66|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 66] | | | | | | ------------------ | | | | ------------------ | | | | 456| 66| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 66] | | | | ------------------ | | ------------------ | | 572| 66| __internal_ret__; \ | | 573| 66| }) ------------------ 2479| | 2480| 0| INFO("Ignoring unknown capability \"%s\"", token); ------------------ | | 357| 0|#define INFO(format, ...) do { \ | | 358| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 359| 0| LXC_INFO(&locinfo, format, ##__VA_ARGS__); \ | | 360| 0|} while (0) | | ------------------ | | | Branch (360:10): [Folded, False: 0] | | ------------------ ------------------ 2481| 0| continue; 2482| 66| } 2483| | 2484| 0| new_cap = zalloc(sizeof(struct cap_entry)); ------------------ | | 90| 0|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2485| 0| if (!new_cap) ------------------ | Branch (2485:7): [True: 0, False: 0] ------------------ 2486| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2487| | 2488| 0| new_cap->cap_name = strdup(token); 2489| 0| if (!new_cap->cap_name) ------------------ | Branch (2489:7): [True: 0, False: 0] ------------------ 2490| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2491| 0| new_cap->cap = cap; 2492| | 2493| 0| list_add_tail(&new_cap->head, &conf->caps.list); 2494| 0| move_ptr(new_cap); ------------------ | | 694| 0| ({ \ | | 695| 0| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 0| (ptr) = NULL; \ | | 697| 0| __internal_ptr__; \ | | 698| 0| }) ------------------ 2495| 0| } 2496| | 2497| 846| return 0; 2498| 913|} confile.c:set_config_cap_keep: 2502| 1.25k|{ 2503| 1.25k| __do_free char *caps = NULL; ------------------ | | 69| 1.25k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.25k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2504| 1.25k| int ret; 2505| | 2506| 1.25k| if (lxc_config_value_empty(value)) ------------------ | Branch (2506:6): [True: 554, False: 703] ------------------ 2507| 554| return lxc_clear_config_caps(lxc_conf); 2508| | 2509| 703| caps = strdup(value); 2510| 703| if (!caps) ------------------ | Branch (2510:6): [True: 0, False: 703] ------------------ 2511| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2512| | 2513| 703| if (!lxc_conf->caps.keep && !list_empty(&lxc_conf->caps.list)) ------------------ | Branch (2513:6): [True: 263, False: 440] | Branch (2513:30): [True: 0, False: 263] ------------------ 2514| 0| return syserror_set(-EINVAL, "Keeping and dropping capabilities are mutually exclusive"); ------------------ | | 568| 0| ({ \ | | 569| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 0| errno = labs(__ret__); \ | | 571| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 572| 0| __internal_ret__; \ | | 573| 0| }) ------------------ 2515| | 2516| 703| ret = add_cap_entry(lxc_conf, caps, true); 2517| 703| if (ret < 0) ------------------ | Branch (2517:6): [True: 54, False: 649] ------------------ 2518| 54| return ret; 2519| | 2520| 649| lxc_conf->caps.keep = true; 2521| 649| return 0; 2522| 703|} confile.c:set_config_cgroup2_controller: 1968| 1.39k|{ 1969| 1.39k| return __set_config_cgroup_controller(key, value, lxc_conf, 1970| | CGROUP2_SUPER_MAGIC); 1971| 1.39k|} confile.c:__set_config_cgroup_controller: 1924| 1.39k|{ 1925| 1.39k| call_cleaner(free_lxc_cgroup) struct lxc_cgroup *new_cgroup = NULL; ------------------ | | 26| 1.39k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 1926| 1.39k| const char *subkey, *token; 1927| 1.39k| size_t token_len; 1928| | 1929| 1.39k| if (lxc_config_value_empty(value)) ------------------ | Branch (1929:6): [True: 807, False: 584] ------------------ 1930| 807| return lxc_clear_cgroups(lxc_conf, key, version); 1931| | 1932| 584| if (version == CGROUP2_SUPER_MAGIC) { ------------------ | Branch (1932:6): [True: 584, False: 0] ------------------ 1933| 584| token = "lxc.cgroup2."; 1934| 584| token_len = 12; 1935| 584| } else { 1936| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1937| 0| } 1938| | 1939| 584| if (!strnequal(key, token, token_len)) ------------------ | Branch (1939:6): [True: 8, False: 576] ------------------ 1940| 8| return ret_errno(EINVAL); ------------------ | | 715| 8| ({ \ | | 716| 8| errno = labs(__errno__); \ | | 717| 8| -errno; \ | | 718| 8| }) ------------------ 1941| | 1942| 576| subkey = key + token_len; 1943| 576| if (*subkey == '\0') ------------------ | Branch (1943:6): [True: 1, False: 575] ------------------ 1944| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1945| | 1946| 575| new_cgroup = zalloc(sizeof(*new_cgroup)); ------------------ | | 90| 575|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1947| 575| if (!new_cgroup) ------------------ | Branch (1947:6): [True: 0, False: 575] ------------------ 1948| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1949| | 1950| 575| new_cgroup->subsystem = strdup(subkey); 1951| 575| if (!new_cgroup->subsystem) ------------------ | Branch (1951:6): [True: 0, False: 575] ------------------ 1952| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1953| | 1954| 575| new_cgroup->value = strdup(value); 1955| 575| if (!new_cgroup->value) ------------------ | Branch (1955:6): [True: 0, False: 575] ------------------ 1956| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1957| | 1958| 575| new_cgroup->version = version; 1959| | 1960| 575| list_add_tail(&new_cgroup->head, &lxc_conf->cgroup2); 1961| 575| move_ptr(new_cgroup); ------------------ | | 694| 575| ({ \ | | 695| 575| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 575| (ptr) = NULL; \ | | 697| 575| __internal_ptr__; \ | | 698| 575| }) ------------------ 1962| | 1963| 575| return 0; 1964| 575|} confile.c:set_config_cgroup_monitor_pivot_dir: 2008| 1.07k|{ 2009| 1.07k| if (lxc_config_value_empty(value)) ------------------ | Branch (2009:6): [True: 535, False: 535] ------------------ 2010| 535| return clr_config_cgroup_monitor_pivot_dir(key, lxc_conf, NULL); 2011| | 2012| 535| if (abspath(value)) ------------------ | Branch (2012:6): [True: 1, False: 534] ------------------ 2013| 1| return syserror_set(-EINVAL, "%s paths may not be absolute", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2014| | 2015| 534| if (dotdot(value)) ------------------ | Branch (2015:6): [True: 1, False: 533] ------------------ 2016| 1| return syserror_set(-EINVAL, "%s paths may not walk upwards via \"../\"", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2017| | 2018| 533| return set_config_path_item(&lxc_conf->cgroup_meta.monitor_pivot_dir, value); 2019| 534|} confile.c:clr_config_cgroup_monitor_pivot_dir: 4936| 535|{ 4937| | free_disarm(lxc_conf->cgroup_meta.monitor_pivot_dir); ------------------ | | 58| 535| ({ \ | | 59| 535| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 213, False: 322] | | ------------------ | | 60| 213| free(ptr); \ | | 61| 213| ptr = NULL; \ | | 62| 213| } \ | | 63| 535| }) ------------------ 4938| 535| return 0; 4939| 535|} confile.c:set_config_cgroup_monitor_dir: 1993| 783|{ 1994| 783| if (lxc_config_value_empty(value)) ------------------ | Branch (1994:6): [True: 390, False: 393] ------------------ 1995| 390| return clr_config_cgroup_monitor_dir(key, lxc_conf, NULL); 1996| | 1997| 393| if (abspath(value)) ------------------ | Branch (1997:6): [True: 1, False: 392] ------------------ 1998| 1| return syserror_set(-EINVAL, "%s paths may not be absolute", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1999| | 2000| 392| if (dotdot(value)) ------------------ | Branch (2000:6): [True: 1, False: 391] ------------------ 2001| 1| return syserror_set(-EINVAL, "%s paths may not walk upwards via \"../\"", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2002| | 2003| 391| return set_config_path_item(&lxc_conf->cgroup_meta.monitor_dir, value); 2004| 392|} confile.c:clr_config_cgroup_monitor_dir: 4928| 390|{ 4929| | free_disarm(lxc_conf->cgroup_meta.monitor_dir); ------------------ | | 58| 390| ({ \ | | 59| 390| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 194, False: 196] | | ------------------ | | 60| 194| free(ptr); \ | | 61| 194| ptr = NULL; \ | | 62| 194| } \ | | 63| 390| }) ------------------ 4930| 390| return 0; 4931| 390|} confile.c:set_config_cgroup_container_inner_dir: 2041| 799|{ 2042| 799| if (lxc_config_value_empty(value)) ------------------ | Branch (2042:6): [True: 394, False: 405] ------------------ 2043| 394| return clr_config_cgroup_container_inner_dir(key, lxc_conf, NULL); 2044| | 2045| 405| if (abspath(value)) ------------------ | Branch (2045:6): [True: 1, False: 404] ------------------ 2046| 1| return syserror_set(-EINVAL, "%s paths may not be absolute", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2047| | 2048| 404| if (strchr(value, '/') || strequal(value, ".") || strequal(value, "..")) ------------------ | Branch (2048:6): [True: 1, False: 403] | Branch (2048:28): [True: 1, False: 402] | Branch (2048:52): [True: 1, False: 401] ------------------ 2049| 3| return log_error_errno(-EINVAL, EINVAL, "lxc.cgroup.dir.container.inner must be a single directory name"); ------------------ | | 486| 3| ({ \ | | 487| 3| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 3| errno = (__errno__); \ | | 489| 3| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 3| do { \ | | | | 454| 3| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 3| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 3| char *ptr = NULL; \ | | | | | | 317| 3| { \ | | | | | | 318| 3| int __saved_errno = errno; \ | | | | | | 319| 3| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 3| errno = __saved_errno; \ | | | | | | 321| 3| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 3] | | | | | | ------------------ | | | | | | 322| 3| ptr = errno_buf; \ | | | | | | 323| 3| } | | | | ------------------ | | | | 455| 3| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 3|#define ERROR(format, ...) do { \ | | | | | | 373| 3| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 3| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 3| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 3|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 3] | | | | | | ------------------ | | | | ------------------ | | | | 456| 3| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 3] | | | | ------------------ | | ------------------ | | 490| 3| __internal_ret__; \ | | 491| 3| }) ------------------ 2050| | 2051| 401| return set_config_string_item(&lxc_conf->cgroup_meta.namespace_dir, value); 2052| 404|} confile.c:clr_config_cgroup_container_inner_dir: 4952| 394|{ 4953| | free_disarm(lxc_conf->cgroup_meta.namespace_dir); ------------------ | | 58| 394| ({ \ | | 59| 394| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 194, False: 200] | | ------------------ | | 60| 194| free(ptr); \ | | 61| 194| ptr = NULL; \ | | 62| 194| } \ | | 63| 394| }) ------------------ 4954| 394| return 0; 4955| 394|} confile.c:set_config_cgroup_container_dir: 2024| 949|{ 2025| 949| if (lxc_config_value_empty(value)) ------------------ | Branch (2025:6): [True: 520, False: 429] ------------------ 2026| 520| return clr_config_cgroup_container_dir(key, lxc_conf, NULL); 2027| | 2028| 429| if (abspath(value)) ------------------ | Branch (2028:6): [True: 1, False: 428] ------------------ 2029| 1| return syserror_set(-EINVAL, "%s paths may not be absolute", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2030| | 2031| 428| if (dotdot(value)) ------------------ | Branch (2031:6): [True: 1, False: 427] ------------------ 2032| 1| return syserror_set(-EINVAL, "%s paths may not walk upwards via \"../\"", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 2033| | 2034| 427| return set_config_path_item(&lxc_conf->cgroup_meta.container_dir, value); 2035| 428|} confile.c:clr_config_cgroup_container_dir: 4944| 520|{ 4945| | free_disarm(lxc_conf->cgroup_meta.container_dir); ------------------ | | 58| 520| ({ \ | | 59| 520| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 197, False: 323] | | ------------------ | | 60| 197| free(ptr); \ | | 61| 197| ptr = NULL; \ | | 62| 197| } \ | | 63| 520| }) ------------------ 4946| 520| return 0; 4947| 520|} confile.c:set_config_cgroup_dir: 1975| 808|{ 1976| 808| if (!strequal(key, "lxc.cgroup.dir")) ------------------ | Branch (1976:6): [True: 0, False: 808] ------------------ 1977| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1978| | 1979| 808| if (lxc_config_value_empty(value)) ------------------ | Branch (1979:6): [True: 393, False: 415] ------------------ 1980| 393| return clr_config_cgroup_dir(key, lxc_conf, NULL); 1981| | 1982| 415| if (abspath(value)) ------------------ | Branch (1982:6): [True: 1, False: 414] ------------------ 1983| 1| return syserror_set(-EINVAL, "%s paths may not be absolute", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1984| | 1985| 414| if (dotdot(value)) ------------------ | Branch (1985:6): [True: 1, False: 413] ------------------ 1986| 1| return syserror_set(-EINVAL, "%s paths may not walk upwards via \"../\"", key); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1987| | 1988| 413| return set_config_path_item(&lxc_conf->cgroup_meta.dir, value); 1989| 414|} confile.c:clr_config_cgroup_dir: 4915| 393|{ 4916| 393| if (!strequal(key, "lxc.cgroup.dir")) ------------------ | Branch (4916:6): [True: 0, False: 393] ------------------ 4917| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 4918| | 4919| 393| if (lxc_conf->cgroup_meta.dir) ------------------ | Branch (4919:6): [True: 194, False: 199] ------------------ 4920| 194| free_disarm(lxc_conf->cgroup_meta.dir); ------------------ | | 58| 194| ({ \ | | 59| 194| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 194, False: 0] | | ------------------ | | 60| 194| free(ptr); \ | | 61| 194| ptr = NULL; \ | | 62| 194| } \ | | 63| 194| }) ------------------ 4921| | 4922| 393| return 0; 4923| 393|} confile.c:set_config_cgroup_relative: 2056| 653|{ 2057| 653| unsigned int converted; 2058| 653| int ret; 2059| | 2060| 653| if (lxc_config_value_empty(value)) ------------------ | Branch (2060:6): [True: 194, False: 459] ------------------ 2061| 194| return clr_config_cgroup_relative(key, lxc_conf, NULL); 2062| | 2063| 459| ret = lxc_safe_uint(value, &converted); 2064| 459| if (ret) ------------------ | Branch (2064:6): [True: 2, False: 457] ------------------ 2065| 2| return ret; 2066| | 2067| 457| if (converted == 1) { ------------------ | Branch (2067:6): [True: 194, False: 263] ------------------ 2068| 194| lxc_conf->cgroup_meta.relative = true; 2069| 194| return 0; 2070| 194| } 2071| | 2072| 263| if (converted == 0) { ------------------ | Branch (2072:6): [True: 194, False: 69] ------------------ 2073| 194| lxc_conf->cgroup_meta.relative = false; 2074| 194| return 0; 2075| 194| } 2076| | 2077| 69| return ret_errno(EINVAL); ------------------ | | 715| 69| ({ \ | | 716| 69| errno = labs(__errno__); \ | | 717| 69| -errno; \ | | 718| 69| }) ------------------ 2078| 263|} confile.c:clr_config_cgroup_relative: 4960| 194|{ 4961| | lxc_conf->cgroup_meta.relative = false; 4962| 194| return 0; 4963| 194|} confile.c:set_config_console_buffer_size: 2582| 1.34k|{ 2583| 1.34k| int ret; 2584| 1.34k| long long int size; 2585| 1.34k| uint64_t buffer_size, pgsz; 2586| | 2587| 1.34k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2587:6): [True: 224, False: 1.12k] ------------------ 2588| 224| lxc_conf->console.buffer_size = 0; 2589| 224| return 0; 2590| 224| } 2591| | 2592| | /* If the user specified "auto" the default log size is 2^17 = 128 Kib */ 2593| 1.12k| if (strequal(value, "auto")) { ------------------ | Branch (2593:6): [True: 205, False: 915] ------------------ 2594| 205| lxc_conf->console.buffer_size = 1 << 17; 2595| 205| return 0; 2596| 205| } 2597| | 2598| 915| ret = parse_byte_size_string(value, &size); 2599| 915| if (ret) ------------------ | Branch (2599:6): [True: 38, False: 877] ------------------ 2600| 38| return ret; 2601| | 2602| 877| if (size < 0) ------------------ | Branch (2602:6): [True: 79, False: 798] ------------------ 2603| 79| return ret_errno(EINVAL); ------------------ | | 715| 79| ({ \ | | 716| 79| errno = labs(__errno__); \ | | 717| 79| -errno; \ | | 718| 79| }) ------------------ 2604| | 2605| | /* must be at least a page size */ 2606| 798| pgsz = lxc_getpagesize(); 2607| 798| if ((uint64_t)size < pgsz) { ------------------ | Branch (2607:6): [True: 212, False: 586] ------------------ 2608| 212| NOTICE("Requested ringbuffer size for the console is %lld but must be at least %" PRId64 " bytes. Setting ringbuffer size to %" PRId64 " bytes", ------------------ | | 362| 212|#define NOTICE(format, ...) do { \ | | 363| 212| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 212| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 212| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 212|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 212] | | ------------------ ------------------ 2609| 212| size, pgsz, pgsz); 2610| 212| size = pgsz; 2611| 212| } 2612| | 2613| 798| buffer_size = lxc_find_next_power2((uint64_t)size); 2614| 798| if (buffer_size == 0) ------------------ | Branch (2614:6): [True: 0, False: 798] ------------------ 2615| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2616| | 2617| 798| if (buffer_size != (uint64_t)size) ------------------ | Branch (2617:6): [True: 330, False: 468] ------------------ 2618| 330| NOTICE("Passed size was not a power of 2. Rounding log size to next power of two: %" PRIu64 " bytes", buffer_size); ------------------ | | 362| 330|#define NOTICE(format, ...) do { \ | | 363| 330| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 330| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 330| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 330|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 330] | | ------------------ ------------------ 2619| | 2620| 798| lxc_conf->console.buffer_size = buffer_size; 2621| | 2622| 798| return 0; 2623| 798|} confile.c:set_config_console_logfile: 2576| 194|{ 2577| 194| return set_config_path_item(&lxc_conf->console.log_path, value); 2578| 194|} confile.c:set_config_console_path: 2550| 323|{ 2551| 323| return set_config_path_item(&lxc_conf->console.path, value); 2552| 323|} confile.c:set_config_console_rotate: 2556| 452|{ 2557| 452| int ret; 2558| | 2559| 452| if (lxc_config_value_empty(value)) { ------------------ | Branch (2559:6): [True: 199, False: 253] ------------------ 2560| 199| lxc_conf->console.log_rotate = 0; 2561| 199| return 0; 2562| 199| } 2563| | 2564| 253| ret = lxc_safe_uint(value, &lxc_conf->console.log_rotate); 2565| 253| if (ret) ------------------ | Branch (2565:6): [True: 2, False: 251] ------------------ 2566| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 2567| | 2568| 251| if (lxc_conf->console.log_rotate > 1) ------------------ | Branch (2568:6): [True: 55, False: 196] ------------------ 2569| 55| return log_error_errno(-EINVAL, EINVAL, "The \"lxc.console.rotate\" config key can only be set to 0 or 1"); ------------------ | | 486| 55| ({ \ | | 487| 55| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 55| errno = (__errno__); \ | | 489| 55| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 55| do { \ | | | | 454| 55| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 55| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 55| char *ptr = NULL; \ | | | | | | 317| 55| { \ | | | | | | 318| 55| int __saved_errno = errno; \ | | | | | | 319| 55| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 55| errno = __saved_errno; \ | | | | | | 321| 55| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 55] | | | | | | ------------------ | | | | | | 322| 55| ptr = errno_buf; \ | | | | | | 323| 55| } | | | | ------------------ | | | | 455| 55| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 55|#define ERROR(format, ...) do { \ | | | | | | 373| 55| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 55| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 55| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 55|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 55] | | | | | | ------------------ | | | | ------------------ | | | | 456| 55| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 55] | | | | ------------------ | | ------------------ | | 490| 55| __internal_ret__; \ | | 491| 55| }) ------------------ 2570| | 2571| 196| return 0; 2572| 251|} confile.c:set_config_console_size: 2627| 2.01k|{ 2628| 2.01k| int ret; 2629| 2.01k| long long int size; 2630| 2.01k| uint64_t log_size, pgsz; 2631| | 2632| 2.01k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2632:6): [True: 194, False: 1.82k] ------------------ 2633| 194| lxc_conf->console.log_size = 0; 2634| 194| return 0; 2635| 194| } 2636| | 2637| | /* If the user specified "auto" the default log size is 2^17 = 128 Kib */ 2638| 1.82k| if (strequal(value, "auto")) { ------------------ | Branch (2638:6): [True: 194, False: 1.62k] ------------------ 2639| 194| lxc_conf->console.log_size = 1 << 17; 2640| 194| return 0; 2641| 194| } 2642| | 2643| 1.62k| ret = parse_byte_size_string(value, &size); 2644| 1.62k| if (ret) ------------------ | Branch (2644:6): [True: 150, False: 1.47k] ------------------ 2645| 150| return ret_errno(EINVAL); ------------------ | | 715| 150| ({ \ | | 716| 150| errno = labs(__errno__); \ | | 717| 150| -errno; \ | | 718| 150| }) ------------------ 2646| | 2647| 1.47k| if (size < 0) ------------------ | Branch (2647:6): [True: 136, False: 1.34k] ------------------ 2648| 136| return ret_errno(EINVAL); ------------------ | | 715| 136| ({ \ | | 716| 136| errno = labs(__errno__); \ | | 717| 136| -errno; \ | | 718| 136| }) ------------------ 2649| | 2650| | /* must be at least a page size */ 2651| 1.34k| pgsz = lxc_getpagesize(); 2652| 1.34k| if ((uint64_t)size < pgsz) { ------------------ | Branch (2652:6): [True: 715, False: 625] ------------------ 2653| 715| NOTICE("Requested ringbuffer size for the console is %lld but must be at least %" PRId64 " bytes. Setting ringbuffer size to %" PRId64 " bytes", ------------------ | | 362| 715|#define NOTICE(format, ...) do { \ | | 363| 715| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 715| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 715| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 715|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 715] | | ------------------ ------------------ 2654| 715| size, pgsz, pgsz); 2655| 715| size = pgsz; 2656| 715| } 2657| | 2658| 1.34k| log_size = lxc_find_next_power2((uint64_t)size); 2659| 1.34k| if (log_size == 0) ------------------ | Branch (2659:6): [True: 0, False: 1.34k] ------------------ 2660| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2661| | 2662| 1.34k| if (log_size != (uint64_t)size) ------------------ | Branch (2662:6): [True: 578, False: 762] ------------------ 2663| 578| NOTICE("Passed size was not a power of 2. Rounding log size to next power of two: %" PRIu64 " bytes", log_size); ------------------ | | 362| 578|#define NOTICE(format, ...) do { \ | | 363| 578| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 578| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 578| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 578|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 578] | | ------------------ ------------------ 2664| | 2665| 1.34k| lxc_conf->console.log_size = log_size; 2666| | 2667| 1.34k| return 0; 2668| 1.34k|} confile.c:set_config_sched_core: 6726| 655|{ 6727| 655| int ret; 6728| 655| unsigned int nr; 6729| | 6730| 655| if (lxc_config_value_empty(value)) ------------------ | Branch (6730:6): [True: 194, False: 461] ------------------ 6731| 194| return clr_config_sched_core(key, lxc_conf, data); 6732| | 6733| 461| ret = lxc_safe_uint(value, &nr); 6734| 461| if (ret) ------------------ | Branch (6734:6): [True: 2, False: 459] ------------------ 6735| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 6736| | 6737| 459| if (nr != 0 && nr != 1) ------------------ | Branch (6737:6): [True: 265, False: 194] | Branch (6737:17): [True: 66, False: 199] ------------------ 6738| 66| return ret_errno(EINVAL); ------------------ | | 715| 66| ({ \ | | 716| 66| errno = labs(__errno__); \ | | 717| 66| -errno; \ | | 718| 66| }) ------------------ 6739| | 6740| 393| lxc_conf->sched_core = (nr == 1); 6741| 393| return 0; 6742| 459|} confile.c:clr_config_sched_core: 6751| 194|{ 6752| | c->sched_core = false; 6753| 194| return 0; 6754| 194|} confile.c:set_config_environment_runtime: 1628| 194|{ 1629| 194| return set_config_environment_impl(value, &lxc_conf->environment_runtime); 1630| 194|} confile.c:set_config_environment_impl: 1581| 1.94k|{ 1582| 1.94k| __do_free char *dup = NULL, *val = NULL; ------------------ | | 69| 1.94k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.94k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1583| 1.94k| __do_free struct environment_entry *new_env = NULL; ------------------ | | 69| 1.94k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.94k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1584| 1.94k| char *env_val; 1585| | 1586| 1.94k| if (lxc_config_value_empty(value)) ------------------ | Branch (1586:6): [True: 908, False: 1.03k] ------------------ 1587| 908| return lxc_clear_environment(environment); 1588| | 1589| 1.03k| new_env = zalloc(sizeof(struct environment_entry)); ------------------ | | 90| 1.03k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1590| 1.03k| if (!new_env) ------------------ | Branch (1590:6): [True: 0, False: 1.03k] ------------------ 1591| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1592| | 1593| 1.03k| dup = strdup(value); 1594| 1.03k| if (!dup) ------------------ | Branch (1594:6): [True: 0, False: 1.03k] ------------------ 1595| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1596| | 1597| 1.03k| env_val = strchr(dup, '='); 1598| 1.03k| if (!env_val) { ------------------ | Branch (1598:6): [True: 608, False: 425] ------------------ 1599| 608| env_val = getenv(dup); 1600| 608| } else { 1601| 425| *env_val = '\0'; 1602| 425| env_val++; 1603| 425| } 1604| 1.03k| if (!env_val) ------------------ | Branch (1604:6): [True: 6, False: 1.02k] ------------------ 1605| 6| return ret_errno(ENOENT); ------------------ | | 715| 6| ({ \ | | 716| 6| errno = labs(__errno__); \ | | 717| 6| -errno; \ | | 718| 6| }) ------------------ 1606| | 1607| 1.02k| val = strdup(env_val); 1608| 1.02k| if (!val) ------------------ | Branch (1608:6): [True: 0, False: 1.02k] ------------------ 1609| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1610| | 1611| 1.02k| new_env->key = move_ptr(dup); ------------------ | | 694| 1.02k| ({ \ | | 695| 1.02k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.02k| (ptr) = NULL; \ | | 697| 1.02k| __internal_ptr__; \ | | 698| 1.02k| }) ------------------ 1612| 1.02k| new_env->val = move_ptr(val); ------------------ | | 694| 1.02k| ({ \ | | 695| 1.02k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.02k| (ptr) = NULL; \ | | 697| 1.02k| __internal_ptr__; \ | | 698| 1.02k| }) ------------------ 1613| | 1614| 1.02k| list_add_tail(&new_env->head, environment); 1615| 1.02k| move_ptr(new_env); ------------------ | | 694| 1.02k| ({ \ | | 695| 1.02k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.02k| (ptr) = NULL; \ | | 697| 1.02k| __internal_ptr__; \ | | 698| 1.02k| }) ------------------ 1616| | 1617| 1.02k| return 0; 1618| 1.02k|} confile.c:set_config_environment_hooks: 1634| 194|{ 1635| 194| return set_config_environment_impl(value, &lxc_conf->environment_hooks); 1636| 194|} confile.c:set_config_environment: 1622| 1.55k|{ 1623| 1.55k| return set_config_environment_impl(value, &lxc_conf->environment); 1624| 1.55k|} confile.c:set_config_ephemeral: 3672| 438|{ 3673| 438| int ret; 3674| | 3675| 438| if (lxc_config_value_empty(value)) { ------------------ | Branch (3675:6): [True: 194, False: 244] ------------------ 3676| 194| lxc_conf->ephemeral = 0; 3677| 194| return 0; 3678| 194| } 3679| | 3680| 244| ret = lxc_safe_uint(value, &lxc_conf->ephemeral); 3681| 244| if (ret < 0) ------------------ | Branch (3681:6): [True: 2, False: 242] ------------------ 3682| 2| return ret; 3683| | 3684| 242| if (lxc_conf->ephemeral > 1) ------------------ | Branch (3684:6): [True: 48, False: 194] ------------------ 3685| 48| return ret_errno(EINVAL); ------------------ | | 715| 48| ({ \ | | 716| 48| errno = labs(__errno__); \ | | 717| 48| -errno; \ | | 718| 48| }) ------------------ 3686| | 3687| 194| return 0; 3688| 242|} confile.c:set_config_execute_cmd: 1256| 194|{ 1257| 194| return set_config_string_item(&lxc_conf->execute_cmd, value); 1258| 194|} confile.c:set_config_group: 1544| 1.26k|{ 1545| 1.26k| __do_free char *groups = NULL; ------------------ | | 69| 1.26k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.26k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1546| 1.26k| char *token; 1547| | 1548| 1.26k| if (lxc_config_value_empty(value)) ------------------ | Branch (1548:6): [True: 400, False: 865] ------------------ 1549| 400| return lxc_clear_groups(lxc_conf); 1550| | 1551| 865| groups = strdup(value); 1552| 865| if (!groups) ------------------ | Branch (1552:6): [True: 0, False: 865] ------------------ 1553| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1554| | 1555| | /* 1556| | * In case several groups are specified in a single line split these 1557| | * groups in a single element for the list. 1558| | */ 1559| 1.12k| lxc_iterate_parts(token, groups, " \t") { ------------------ | | 187| 865| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.99k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 1.12k, False: 865] | | ------------------ | | 189| 1.12k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 1560| 1.12k| __do_free char *val = NULL; ------------------ | | 69| 1.12k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.12k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1561| 1.12k| __do_free struct string_entry *entry = NULL; ------------------ | | 69| 1.12k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.12k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1562| | 1563| 1.12k| entry = zalloc(sizeof(struct string_entry)); ------------------ | | 90| 1.12k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1564| 1.12k| if (!entry) ------------------ | Branch (1564:7): [True: 0, False: 1.12k] ------------------ 1565| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1566| | 1567| 1.12k| val = strdup(token); 1568| 1.12k| if (!val) ------------------ | Branch (1568:7): [True: 0, False: 1.12k] ------------------ 1569| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1570| | 1571| 1.12k| entry->val = move_ptr(val); ------------------ | | 694| 1.12k| ({ \ | | 695| 1.12k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.12k| (ptr) = NULL; \ | | 697| 1.12k| __internal_ptr__; \ | | 698| 1.12k| }) ------------------ 1572| 1.12k| list_add_tail(&entry->head, &lxc_conf->groups); 1573| 1.12k| move_ptr(entry); ------------------ | | 694| 1.12k| ({ \ | | 695| 1.12k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.12k| (ptr) = NULL; \ | | 697| 1.12k| __internal_ptr__; \ | | 698| 1.12k| }) ------------------ 1574| 1.12k| } 1575| | 1576| 865| return 0; 1577| 865|} confile.c:set_config_hooks: 1368| 3.94k|{ 1369| 3.94k| __do_free char *copy = NULL; ------------------ | | 69| 3.94k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 3.94k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1370| | 1371| 3.94k| if (lxc_config_value_empty(value)) ------------------ | Branch (1371:6): [True: 1.59k, False: 2.35k] ------------------ 1372| 1.59k| return lxc_clear_hooks(lxc_conf, key); 1373| | 1374| 2.35k| if (strequal(key + 4, "hook")) ------------------ | Branch (1374:6): [True: 1, False: 2.34k] ------------------ 1375| 1| return log_error_errno(-EINVAL, EINVAL, "lxc.hook must not have a value"); ------------------ | | 486| 1| ({ \ | | 487| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 1| errno = (__errno__); \ | | 489| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 490| 1| __internal_ret__; \ | | 491| 1| }) ------------------ 1376| | 1377| 2.34k| copy = strdup(value); 1378| 2.34k| if (!copy) ------------------ | Branch (1378:6): [True: 0, False: 2.34k] ------------------ 1379| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1380| | 1381| 2.34k| if (strequal(key + 9, "pre-start")) ------------------ | Branch (1381:6): [True: 195, False: 2.15k] ------------------ 1382| 195| return add_hook(lxc_conf, LXCHOOK_PRESTART, move_ptr(copy)); ------------------ | | 694| 195| ({ \ | | 695| 195| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 195| (ptr) = NULL; \ | | 697| 195| __internal_ptr__; \ | | 698| 195| }) ------------------ 1383| 2.15k| else if (strequal(key + 9, "start-host")) ------------------ | Branch (1383:11): [True: 194, False: 1.96k] ------------------ 1384| 194| return add_hook(lxc_conf, LXCHOOK_START_HOST, move_ptr(copy)); ------------------ | | 694| 194| ({ \ | | 695| 194| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 194| (ptr) = NULL; \ | | 697| 194| __internal_ptr__; \ | | 698| 194| }) ------------------ 1385| 1.96k| else if (strequal(key + 9, "pre-mount")) ------------------ | Branch (1385:11): [True: 195, False: 1.76k] ------------------ 1386| 195| return add_hook(lxc_conf, LXCHOOK_PREMOUNT, move_ptr(copy)); ------------------ | | 694| 195| ({ \ | | 695| 195| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 195| (ptr) = NULL; \ | | 697| 195| __internal_ptr__; \ | | 698| 195| }) ------------------ 1387| 1.76k| else if (strequal(key + 9, "autodev")) ------------------ | Branch (1387:11): [True: 202, False: 1.56k] ------------------ 1388| 202| return add_hook(lxc_conf, LXCHOOK_AUTODEV, move_ptr(copy)); ------------------ | | 694| 202| ({ \ | | 695| 202| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 202| (ptr) = NULL; \ | | 697| 202| __internal_ptr__; \ | | 698| 202| }) ------------------ 1389| 1.56k| else if (strequal(key + 9, "mount")) ------------------ | Branch (1389:11): [True: 243, False: 1.32k] ------------------ 1390| 243| return add_hook(lxc_conf, LXCHOOK_MOUNT, move_ptr(copy)); ------------------ | | 694| 243| ({ \ | | 695| 243| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 243| (ptr) = NULL; \ | | 697| 243| __internal_ptr__; \ | | 698| 243| }) ------------------ 1391| 1.32k| else if (strequal(key + 9, "start")) ------------------ | Branch (1391:11): [True: 272, False: 1.04k] ------------------ 1392| 272| return add_hook(lxc_conf, LXCHOOK_START, move_ptr(copy)); ------------------ | | 694| 272| ({ \ | | 695| 272| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 272| (ptr) = NULL; \ | | 697| 272| __internal_ptr__; \ | | 698| 272| }) ------------------ 1393| 1.04k| else if (strequal(key + 9, "stop")) ------------------ | Branch (1393:11): [True: 388, False: 660] ------------------ 1394| 388| return add_hook(lxc_conf, LXCHOOK_STOP, move_ptr(copy)); ------------------ | | 694| 388| ({ \ | | 695| 388| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 388| (ptr) = NULL; \ | | 697| 388| __internal_ptr__; \ | | 698| 388| }) ------------------ 1395| 660| else if (strequal(key + 9, "post-stop")) ------------------ | Branch (1395:11): [True: 195, False: 465] ------------------ 1396| 195| return add_hook(lxc_conf, LXCHOOK_POSTSTOP, move_ptr(copy)); ------------------ | | 694| 195| ({ \ | | 695| 195| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 195| (ptr) = NULL; \ | | 697| 195| __internal_ptr__; \ | | 698| 195| }) ------------------ 1397| 465| else if (strequal(key + 9, "clone")) ------------------ | Branch (1397:11): [True: 206, False: 259] ------------------ 1398| 206| return add_hook(lxc_conf, LXCHOOK_CLONE, move_ptr(copy)); ------------------ | | 694| 206| ({ \ | | 695| 206| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 206| (ptr) = NULL; \ | | 697| 206| __internal_ptr__; \ | | 698| 206| }) ------------------ 1399| 259| else if (strequal(key + 9, "destroy")) ------------------ | Branch (1399:11): [True: 259, False: 0] ------------------ 1400| 259| return add_hook(lxc_conf, LXCHOOK_DESTROY, move_ptr(copy)); ------------------ | | 694| 259| ({ \ | | 695| 259| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 259| (ptr) = NULL; \ | | 697| 259| __internal_ptr__; \ | | 698| 259| }) ------------------ 1401| | 1402| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1403| 2.34k|} confile.c:add_hook: 1178| 2.34k|{ 1179| 2.34k| __do_free char *val = hook; ------------------ | | 69| 2.34k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.34k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1180| 2.34k| __do_free struct string_entry *entry; ------------------ | | 69| 2.34k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.34k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1181| | 1182| 2.34k| entry = zalloc(sizeof(struct string_entry)); ------------------ | | 90| 2.34k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1183| 2.34k| if (!entry) ------------------ | Branch (1183:6): [True: 0, False: 2.34k] ------------------ 1184| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1185| | 1186| 2.34k| entry->val = move_ptr(val); ------------------ | | 694| 2.34k| ({ \ | | 695| 2.34k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.34k| (ptr) = NULL; \ | | 697| 2.34k| __internal_ptr__; \ | | 698| 2.34k| }) ------------------ 1187| 2.34k| list_add_tail(&entry->head, &lxc_conf->hooks[which]); 1188| 2.34k| move_ptr(entry); ------------------ | | 694| 2.34k| ({ \ | | 695| 2.34k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.34k| (ptr) = NULL; \ | | 697| 2.34k| __internal_ptr__; \ | | 698| 2.34k| }) ------------------ 1189| | 1190| 2.34k| return 0; 1191| 2.34k|} confile.c:set_config_hooks_version: 1407| 637|{ 1408| 637| int ret; 1409| 637| unsigned int tmp; 1410| | 1411| 637| if (lxc_config_value_empty(value)) ------------------ | Branch (1411:6): [True: 194, False: 443] ------------------ 1412| 194| return clr_config_hooks_version(key, lxc_conf, NULL); 1413| | 1414| 443| ret = lxc_safe_uint(value, &tmp); 1415| 443| if (ret < 0) ------------------ | Branch (1415:6): [True: 198, False: 245] ------------------ 1416| 198| return -errno; 1417| | 1418| 245| if (tmp > 1) ------------------ | Branch (1418:6): [True: 50, False: 195] ------------------ 1419| 50| return syserror_set(-EINVAL, "Invalid hook version specified. Currently only 0 (legacy) and 1 are supported"); ------------------ | | 568| 50| ({ \ | | 569| 50| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 50| errno = labs(__ret__); \ | | 571| 50| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 50| do { \ | | | | 454| 50| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 50| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 50| char *ptr = NULL; \ | | | | | | 317| 50| { \ | | | | | | 318| 50| int __saved_errno = errno; \ | | | | | | 319| 50| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 50| errno = __saved_errno; \ | | | | | | 321| 50| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 50] | | | | | | ------------------ | | | | | | 322| 50| ptr = errno_buf; \ | | | | | | 323| 50| } | | | | ------------------ | | | | 455| 50| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 50|#define ERROR(format, ...) do { \ | | | | | | 373| 50| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 50| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 50| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 50|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 50] | | | | | | ------------------ | | | | ------------------ | | | | 456| 50| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 50] | | | | ------------------ | | ------------------ | | 572| 50| __internal_ret__; \ | | 573| 50| }) ------------------ 1420| | 1421| 195| lxc_conf->hooks_version = tmp; 1422| | 1423| 195| return 0; 1424| 245|} confile.c:clr_config_hooks_version: 5048| 194|{ 5049| | /* default to legacy hooks version */ 5050| 194| c->hooks_version = 0; 5051| 194| return 0; 5052| 194|} confile.c:set_config_idmaps: 2263| 3.17k|{ 2264| 3.17k| __do_free struct id_map *idmap = NULL; ------------------ | | 69| 3.17k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 3.17k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2265| 3.17k| unsigned long hostid, nsid, range; 2266| 3.17k| char type; 2267| 3.17k| int ret; 2268| | 2269| 3.17k| if (lxc_config_value_empty(value)) ------------------ | Branch (2269:6): [True: 793, False: 2.38k] ------------------ 2270| 793| return lxc_clear_idmaps(lxc_conf); 2271| | 2272| 2.38k| idmap = zalloc(sizeof(*idmap)); ------------------ | | 90| 2.38k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2273| 2.38k| if (!idmap) ------------------ | Branch (2273:6): [True: 0, False: 2.38k] ------------------ 2274| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2275| | 2276| 2.38k| ret = parse_idmaps(value, &type, &nsid, &hostid, &range); 2277| 2.38k| if (ret < 0) ------------------ | Branch (2277:6): [True: 155, False: 2.23k] ------------------ 2278| 155| return log_error_errno(-EINVAL, EINVAL, "Failed to parse id mappings"); ------------------ | | 486| 155| ({ \ | | 487| 155| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 155| errno = (__errno__); \ | | 489| 155| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 155| do { \ | | | | 454| 155| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 155| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 155| char *ptr = NULL; \ | | | | | | 317| 155| { \ | | | | | | 318| 155| int __saved_errno = errno; \ | | | | | | 319| 155| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 155| errno = __saved_errno; \ | | | | | | 321| 155| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 155] | | | | | | ------------------ | | | | | | 322| 155| ptr = errno_buf; \ | | | | | | 323| 155| } | | | | ------------------ | | | | 455| 155| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 155|#define ERROR(format, ...) do { \ | | | | | | 373| 155| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 155| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 155| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 155|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 155] | | | | | | ------------------ | | | | ------------------ | | | | 456| 155| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 155] | | | | ------------------ | | ------------------ | | 490| 155| __internal_ret__; \ | | 491| 155| }) ------------------ 2279| | 2280| 2.23k| INFO("Read uid map: type %c nsid %lu hostid %lu range %lu", type, nsid, hostid, range); ------------------ | | 357| 2.23k|#define INFO(format, ...) do { \ | | 358| 2.23k| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 2.23k| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 359| 2.23k| LXC_INFO(&locinfo, format, ##__VA_ARGS__); \ | | 360| 2.23k|} while (0) | | ------------------ | | | Branch (360:10): [Folded, False: 2.23k] | | ------------------ ------------------ 2281| 2.23k| if (type == 'u') ------------------ | Branch (2281:6): [True: 909, False: 1.32k] ------------------ 2282| 909| idmap->idtype = ID_TYPE_UID; 2283| 1.32k| else if (type == 'g') ------------------ | Branch (2283:11): [True: 1.32k, False: 0] ------------------ 2284| 1.32k| idmap->idtype = ID_TYPE_GID; 2285| 0| else 2286| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2287| | 2288| 2.23k| idmap->hostid = hostid; 2289| 2.23k| idmap->nsid = nsid; 2290| 2.23k| idmap->range = range; 2291| 2.23k| list_add_tail(&idmap->head, &lxc_conf->id_map); 2292| | 2293| 2.23k| if (!lxc_conf->root_nsuid_map && idmap->idtype == ID_TYPE_UID) ------------------ | Branch (2293:6): [True: 2.02k, False: 206] | Branch (2293:35): [True: 880, False: 1.14k] ------------------ 2294| 880| if (idmap->nsid == 0) ------------------ | Branch (2294:7): [True: 342, False: 538] ------------------ 2295| 342| lxc_conf->root_nsuid_map = idmap; 2296| | 2297| 2.23k| if (!lxc_conf->root_nsgid_map && idmap->idtype == ID_TYPE_GID) ------------------ | Branch (2297:6): [True: 1.64k, False: 585] | Branch (2297:35): [True: 739, False: 906] ------------------ 2298| 739| if (idmap->nsid == 0) ------------------ | Branch (2298:7): [True: 279, False: 460] ------------------ 2299| 279| lxc_conf->root_nsgid_map = idmap; 2300| | 2301| 2.23k| move_ptr(idmap); ------------------ | | 694| 2.23k| ({ \ | | 695| 2.23k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.23k| (ptr) = NULL; \ | | 697| 2.23k| __internal_ptr__; \ | | 698| 2.23k| }) ------------------ 2302| | 2303| 2.23k| return 0; 2304| 2.23k|} confile.c:set_config_includefiles: 2774| 1.79k|{ 2775| 1.79k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2775:6): [True: 194, False: 1.60k] ------------------ 2776| 194| clr_config_includefiles(key, lxc_conf, NULL); 2777| 194| return 0; 2778| 194| } 2779| | 2780| 1.60k| if (value[strlen(value)-1] == '/' || lxc_is_dir(value)) ------------------ | Branch (2780:6): [True: 229, False: 1.37k] | Branch (2780:39): [True: 1.10k, False: 271] ------------------ 2781| 1.33k| return do_includedir(value, lxc_conf); 2782| | 2783| 271| return lxc_config_read(value, lxc_conf, true); 2784| 1.60k|} confile.c:do_includedir: 2736| 1.33k|{ 2737| 1.33k| __do_closedir DIR *dir = NULL; ------------------ | | 55| 1.33k|#define __do_closedir call_cleaner(closedir) | | ------------------ | | | | 26| 1.33k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2738| 1.33k| struct dirent *direntp; 2739| 1.33k| int len, ret; 2740| | 2741| 1.33k| dir = opendir(dirp); 2742| 1.33k| if (!dir) ------------------ | Branch (2742:6): [True: 196, False: 1.13k] ------------------ 2743| 196| return errno == ENOENT ? 0 : -errno; ------------------ | Branch (2743:10): [True: 196, False: 0] ------------------ 2744| | 2745| 92.7k| while ((direntp = readdir(dir))) { ------------------ | Branch (2745:9): [True: 91.6k, False: 1.13k] ------------------ 2746| 91.6k| const char *fnam; 2747| 91.6k| char path[PATH_MAX]; 2748| | 2749| 91.6k| fnam = direntp->d_name; 2750| 91.6k| if (strequal(fnam, ".")) ------------------ | Branch (2750:7): [True: 1.13k, False: 90.5k] ------------------ 2751| 1.13k| continue; 2752| | 2753| 90.5k| if (strequal(fnam, "..")) ------------------ | Branch (2753:7): [True: 1.13k, False: 89.3k] ------------------ 2754| 1.13k| continue; 2755| | 2756| 89.3k| len = strlen(fnam); 2757| 89.3k| if (len < 6 || !strnequal(fnam + len - 5, ".conf", 5)) ------------------ | Branch (2757:7): [True: 28.8k, False: 60.5k] | Branch (2757:18): [True: 47.4k, False: 13.0k] ------------------ 2758| 76.3k| continue; 2759| | 2760| 13.0k| len = strnprintf(path, sizeof(path), "%s/%s", dirp, fnam); ------------------ | | 155| 13.0k| ({ \ | | 156| 13.0k| int __ret_strnprintf; \ | | 157| 13.0k| __ret_strnprintf = snprintf(buf, buf_size, ##__VA_ARGS__); \ | | 158| 13.0k| if (__ret_strnprintf < 0 || (size_t)__ret_strnprintf >= (size_t)buf_size) \ | | ------------------ | | | Branch (158:7): [True: 0, False: 13.0k] | | | Branch (158:31): [True: 2, False: 13.0k] | | ------------------ | | 159| 13.0k| __ret_strnprintf = ret_errno(EIO); \ | | ------------------ | | | | 715| 2| ({ \ | | | | 716| 2| errno = labs(__errno__); \ | | | | 717| 2| -errno; \ | | | | 718| 2| }) | | ------------------ | | 160| 13.0k| __ret_strnprintf; \ | | 161| 13.0k| }) ------------------ 2761| 13.0k| if (len < 0) ------------------ | Branch (2761:7): [True: 2, False: 13.0k] ------------------ 2762| 2| return ret_errno(EIO); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 2763| | 2764| 13.0k| ret = lxc_config_read(path, lxc_conf, true); 2765| 13.0k| if (ret < 0) ------------------ | Branch (2765:7): [True: 0, False: 13.0k] ------------------ 2766| 0| return ret; 2767| 13.0k| } 2768| | 2769| 1.13k| return 0; 2770| 1.13k|} confile.c:clr_config_includefiles: 5320| 194|{ 5321| 194| return 0; 5322| 194|} confile.c:set_config_init_cmd: 1262| 194|{ 1263| 194| return set_config_string_item(&lxc_conf->init_cmd, value); 1264| 194|} confile.c:set_config_init_gid: 1292| 785|{ 1293| 785| unsigned int init_gid; 1294| | 1295| 785| if (lxc_config_value_empty(value)) { ------------------ | Branch (1295:6): [True: 194, False: 591] ------------------ 1296| 194| lxc_conf->init_gid = 0; 1297| 194| return 0; 1298| 194| } 1299| | 1300| 591| if (lxc_safe_uint(value, &init_gid) < 0) ------------------ | Branch (1300:6): [True: 397, False: 194] ------------------ 1301| 397| return -errno; 1302| | 1303| 194| lxc_conf->init_gid = init_gid; 1304| | 1305| 194| return 0; 1306| 591|} confile.c:set_config_init_groups: 1310| 846|{ 1311| 846| __do_free char *value_dup = NULL; ------------------ | | 69| 846|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 846| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1312| 846| gid_t *init_groups = NULL; 1313| 846| size_t num_groups = 0; 1314| 846| size_t idx; 1315| 846| char *token; 1316| | 1317| 846| if (lxc_config_value_empty(value)) ------------------ | Branch (1317:6): [True: 420, False: 426] ------------------ 1318| 420| return clr_config_init_groups(key, lxc_conf, NULL); 1319| | 1320| 426| value_dup = strdup(value); 1321| 426| if (!value_dup) ------------------ | Branch (1321:6): [True: 0, False: 426] ------------------ 1322| 0| return -ENOMEM; 1323| | 1324| 426| lxc_iterate_parts(token, value_dup, ",") ------------------ | | 187| 426| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 66.6k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 66.2k, False: 426] | | ------------------ | | 189| 66.2k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 1325| 66.2k| num_groups++; 1326| | 1327| 426| if (num_groups == INT_MAX) ------------------ | Branch (1327:6): [True: 0, False: 426] ------------------ 1328| 0| return log_error_errno(-ERANGE, ERANGE, "Excessive number of supplementary groups specified"); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 1329| | 1330| | /* This means the string wasn't empty and all we found was garbage. */ 1331| 426| if (num_groups == 0) ------------------ | Branch (1331:6): [True: 1, False: 425] ------------------ 1332| 1| return log_error_errno(-EINVAL, EINVAL, "No valid groups specified %s", value); ------------------ | | 486| 1| ({ \ | | 487| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 1| errno = (__errno__); \ | | 489| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 490| 1| __internal_ret__; \ | | 491| 1| }) ------------------ 1333| | 1334| 425| idx = lxc_conf->init_groups.size; 1335| 425| init_groups = realloc(lxc_conf->init_groups.list, sizeof(gid_t) * (idx + num_groups)); 1336| 425| if (!init_groups) ------------------ | Branch (1336:6): [True: 0, False: 425] ------------------ 1337| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1338| | 1339| | /* 1340| | * Once the realloc() succeeded we need to hand control of the memory 1341| | * back to the config otherwise we risk a double-free when 1342| | * lxc_conf_free() is called. 1343| | */ 1344| 425| lxc_conf->init_groups.list = init_groups; 1345| | 1346| | /* Restore duplicated value so we can call lxc_iterate_parts() again. */ 1347| 425| strcpy(value_dup, value); 1348| | 1349| 1.12k| lxc_iterate_parts(token, value_dup, ",") { ------------------ | | 187| 425| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.52k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 1.12k, False: 402] | | ------------------ | | 189| 1.10k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 1350| 1.12k| int ret; 1351| | 1352| 1.12k| gid_t group; 1353| | 1354| 1.12k| ret = lxc_safe_uint(token, &group); 1355| 1.12k| if (ret) ------------------ | Branch (1355:7): [True: 23, False: 1.10k] ------------------ 1356| 23| return log_error_errno(ret, -ret, "Failed to parse group %s", token); ------------------ | | 486| 23| ({ \ | | 487| 23| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 23| errno = (__errno__); \ | | 489| 23| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 23| do { \ | | | | 454| 23| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 23| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 23| char *ptr = NULL; \ | | | | | | 317| 23| { \ | | | | | | 318| 23| int __saved_errno = errno; \ | | | | | | 319| 23| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 23| errno = __saved_errno; \ | | | | | | 321| 23| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 23] | | | | | | ------------------ | | | | | | 322| 23| ptr = errno_buf; \ | | | | | | 323| 23| } | | | | ------------------ | | | | 455| 23| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 23|#define ERROR(format, ...) do { \ | | | | | | 373| 23| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 23| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 23| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 23|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 23] | | | | | | ------------------ | | | | ------------------ | | | | 456| 23| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 23] | | | | ------------------ | | ------------------ | | 490| 23| __internal_ret__; \ | | 491| 23| }) ------------------ 1357| | 1358| 1.10k| init_groups[idx++] = group; 1359| 1.10k| } 1360| | 1361| 402| lxc_conf->init_groups.size += num_groups; 1362| | 1363| 402| return 0; 1364| 425|} confile.c:clr_config_init_groups: 5280| 420|{ 5281| 420| c->init_groups.size = 0; 5282| | free_disarm(c->init_groups.list); ------------------ | | 58| 420| ({ \ | | 59| 420| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 197, False: 223] | | ------------------ | | 60| 197| free(ptr); \ | | 61| 197| ptr = NULL; \ | | 62| 197| } \ | | 63| 420| }) ------------------ 5283| 420| return 0; 5284| 420|} confile.c:set_config_init_uid: 1274| 795|{ 1275| 795| unsigned int init_uid; 1276| | 1277| 795| if (lxc_config_value_empty(value)) { ------------------ | Branch (1277:6): [True: 194, False: 601] ------------------ 1278| 194| lxc_conf->init_uid = 0; 1279| 194| return 0; 1280| 194| } 1281| | 1282| 601| if (lxc_safe_uint(value, &init_uid) < 0) ------------------ | Branch (1282:6): [True: 407, False: 194] ------------------ 1283| 407| return -errno; 1284| | 1285| 194| lxc_conf->init_uid = init_uid; 1286| | 1287| 194| return 0; 1288| 601|} confile.c:set_config_init_cwd: 1268| 197|{ 1269| 197| return set_config_path_item(&lxc_conf->init_cwd, value); 1270| 197|} confile.c:set_config_keyring_session: 1777| 438|{ 1778| | return set_config_bool_item(&lxc_conf->keyring_disable_session, value, false); 1779| 438|} confile.c:set_config_log_file: 1783| 1.26k|{ 1784| 1.26k| int ret; 1785| | 1786| 1.26k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1786:6): [True: 384, False: 882] ------------------ 1787| 384| free_disarm(c->logfile); ------------------ | | 58| 384| ({ \ | | 59| 384| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 185, False: 199] | | ------------------ | | 60| 185| free(ptr); \ | | 61| 185| ptr = NULL; \ | | 62| 185| } \ | | 63| 384| }) ------------------ 1788| 384| return 0; 1789| 384| } 1790| | 1791| | /* 1792| | * Store these values in the lxc_conf, and then try to set for actual 1793| | * current logging. 1794| | */ 1795| 882| ret = set_config_path_item(&c->logfile, value); 1796| 882| if (ret == 0) ------------------ | Branch (1796:6): [True: 877, False: 5] ------------------ 1797| 877| ret = lxc_log_set_file(&c->logfd, c->logfile); 1798| | 1799| 882| return ret; 1800| 1.26k|} confile.c:set_config_log_level: 1804| 2.78k|{ 1805| 2.78k| int newlevel; 1806| | 1807| 2.78k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1807:6): [True: 364, False: 2.42k] ------------------ 1808| 364| lxc_conf->loglevel = LXC_LOG_LEVEL_NOTSET; 1809| 364| return 0; 1810| 364| } 1811| | 1812| 2.42k| if (value[0] >= '0' && value[0] <= '9') { ------------------ | Branch (1812:6): [True: 2.36k, False: 54] | Branch (1812:25): [True: 263, False: 2.10k] ------------------ 1813| 263| int ret; 1814| | 1815| 263| ret = lxc_safe_int(value, &newlevel); 1816| 263| if (ret) ------------------ | Branch (1816:7): [True: 3, False: 260] ------------------ 1817| 3| return ret_errno(EINVAL); ------------------ | | 715| 3| ({ \ | | 716| 3| errno = labs(__errno__); \ | | 717| 3| -errno; \ | | 718| 3| }) ------------------ 1818| 2.15k| } else { 1819| 2.15k| newlevel = lxc_log_priority_to_int(value); 1820| 2.15k| } 1821| | 1822| | /* 1823| | * Store these values in the lxc_conf, and then try to set for actual 1824| | * current logging. 1825| | */ 1826| 2.41k| lxc_conf->loglevel = newlevel; 1827| | 1828| 2.41k| return lxc_log_set_level(&lxc_conf->loglevel, newlevel); 1829| 2.42k|} confile.c:set_config_log_syslog: 3692| 2.49k|{ 3693| 2.49k| int facility; 3694| | 3695| 2.49k| if (lxc_conf->syslog) ------------------ | Branch (3695:6): [True: 2.07k, False: 419] ------------------ 3696| 2.07k| free_disarm(lxc_conf->syslog); ------------------ | | 58| 2.07k| ({ \ | | 59| 2.07k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 2.07k, False: 0] | | ------------------ | | 60| 2.07k| free(ptr); \ | | 61| 2.07k| ptr = NULL; \ | | 62| 2.07k| } \ | | 63| 2.07k| }) ------------------ 3697| | 3698| 2.49k| if (lxc_config_value_empty(value)) ------------------ | Branch (3698:6): [True: 213, False: 2.28k] ------------------ 3699| 213| return 0; 3700| | 3701| 2.28k| facility = lxc_syslog_priority_to_int(value); 3702| 2.28k| if (facility == -EINVAL) ------------------ | Branch (3702:6): [True: 127, False: 2.15k] ------------------ 3703| 127| return ret_errno(EINVAL); ------------------ | | 715| 127| ({ \ | | 716| 127| errno = labs(__errno__); \ | | 717| 127| -errno; \ | | 718| 127| }) ------------------ 3704| | 3705| 2.15k| lxc_log_syslog(facility); 3706| | 3707| 2.15k| return set_config_string_item(&lxc_conf->syslog, value); 3708| 2.28k|} confile.c:set_config_monitor: 1508| 388|{ 1509| 388| if (lxc_config_value_empty(value)) { ------------------ | Branch (1509:6): [True: 194, False: 194] ------------------ 1510| 194| lxc_conf->monitor_unshare = 0; 1511| 194| return 0; 1512| 194| } 1513| | 1514| 194| if (strequal(key + 12, "unshare")) ------------------ | Branch (1514:6): [True: 194, False: 0] ------------------ 1515| 194| return lxc_safe_uint(value, &lxc_conf->monitor_unshare); 1516| | 1517| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1518| 194|} confile.c:set_config_monitor_signal_pdeath: 1522| 436|{ 1523| 436| if (lxc_config_value_empty(value)) { ------------------ | Branch (1523:6): [True: 194, False: 242] ------------------ 1524| 194| lxc_conf->monitor_signal_pdeath = 0; 1525| 194| return 0; 1526| 194| } 1527| | 1528| 242| if (strequal(key + 12, "signal.pdeath")) { ------------------ | Branch (1528:6): [True: 242, False: 0] ------------------ 1529| 242| int sig_n; 1530| | 1531| 242| sig_n = sig_parse(value); 1532| 242| if (sig_n < 0) ------------------ | Branch (1532:7): [True: 24, False: 218] ------------------ 1533| 24| return ret_errno(EINVAL); ------------------ | | 715| 24| ({ \ | | 716| 24| errno = labs(__errno__); \ | | 717| 24| -errno; \ | | 718| 24| }) ------------------ 1534| | 1535| 218| lxc_conf->monitor_signal_pdeath = sig_n; 1536| 218| return 0; 1537| 242| } 1538| | 1539| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1540| 242|} confile.c:set_config_mount_auto: 2319| 825|{ 2320| 825| __do_free char *autos = NULL; ------------------ | | 69| 825|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 825| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2321| 825| char *token; 2322| 825| int i; 2323| 825| static struct { 2324| 825| const char *token; 2325| 825| int mask; 2326| 825| int flag; 2327| 825| } allowed_auto_mounts[] = { 2328| 825| { "proc", LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED }, 2329| 825| { "proc:mixed", LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED }, 2330| 825| { "proc:rw", LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_RW }, 2331| 825| { "sys", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_MIXED }, 2332| 825| { "sys:ro", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_RO }, 2333| 825| { "sys:mixed", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_MIXED }, 2334| 825| { "sys:rw", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_RW }, 2335| 825| { "cgroup2", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RW | LXC_AUTO_CGROUP_FORCE }, 2336| 825| { "cgroup2:ro", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RO | LXC_AUTO_CGROUP_FORCE }, 2337| 825| { "cgroup2:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RW | LXC_AUTO_CGROUP_FORCE }, 2338| 825| { "cgroup2:ro:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RO | LXC_AUTO_CGROUP_FORCE }, 2339| 825| { "cgroup", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_NOSPEC }, 2340| 825| { "cgroup:mixed", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_MIXED }, 2341| 825| { "cgroup:ro", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RO }, 2342| 825| { "cgroup:rw", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RW }, 2343| 825| { "cgroup:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_NOSPEC | LXC_AUTO_CGROUP_FORCE }, 2344| 825| { "cgroup:mixed:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_MIXED | LXC_AUTO_CGROUP_FORCE }, 2345| 825| { "cgroup:ro:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RO | LXC_AUTO_CGROUP_FORCE }, 2346| 825| { "cgroup:rw:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RW | LXC_AUTO_CGROUP_FORCE }, 2347| 825| { "cgroup-full", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_NOSPEC }, 2348| 825| { "cgroup-full:mixed", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_MIXED }, 2349| 825| { "cgroup-full:ro", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RO }, 2350| 825| { "cgroup-full:rw", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RW }, 2351| 825| { "cgroup-full:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_NOSPEC | LXC_AUTO_CGROUP_FORCE }, 2352| 825| { "cgroup-full:mixed:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_MIXED | LXC_AUTO_CGROUP_FORCE }, 2353| 825| { "cgroup-full:ro:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RO | LXC_AUTO_CGROUP_FORCE }, 2354| 825| { "cgroup-full:rw:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RW | LXC_AUTO_CGROUP_FORCE }, 2355| 825| { "shmounts:", LXC_AUTO_SHMOUNTS_MASK, LXC_AUTO_SHMOUNTS }, 2356| | /* 2357| | * For adding anything that is just a single on/off, but has no 2358| | * options: keep mask and flag identical and just define the 2359| | * enum value as an unused bit so far 2360| | */ 2361| 825| { NULL, 0, 0 } 2362| 825| }; 2363| | 2364| 825| if (lxc_config_value_empty(value)) { ------------------ | Branch (2364:6): [True: 195, False: 630] ------------------ 2365| 195| lxc_conf->auto_mounts = 0; 2366| 195| return 0; 2367| 195| } 2368| | 2369| 630| autos = strdup(value); 2370| 630| if (!autos) ------------------ | Branch (2370:6): [True: 0, False: 630] ------------------ 2371| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2372| | 2373| 1.90k| lxc_iterate_parts(token, autos, " \t") { ------------------ | | 187| 630| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 2.35k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 1.90k, False: 451] | | ------------------ | | 189| 1.72k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2374| 1.90k| bool is_shmounts = false; 2375| | 2376| 33.4k| for (i = 0; allowed_auto_mounts[i].token; i++) { ------------------ | Branch (2376:15): [True: 33.2k, False: 179] ------------------ 2377| 33.2k| if (strequal(allowed_auto_mounts[i].token, token)) ------------------ | Branch (2377:8): [True: 830, False: 32.3k] ------------------ 2378| 830| break; 2379| | 2380| 32.3k| if (strequal("shmounts:", allowed_auto_mounts[i].token) && ------------------ | Branch (2380:8): [True: 1.07k, False: 31.3k] ------------------ 2381| 1.07k| strnequal("shmounts:", token, STRLITERALLEN("shmounts:"))) { ------------------ | | 687| 1.07k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2381:8): [True: 898, False: 179] ------------------ 2382| 898| is_shmounts = true; 2383| 898| break; 2384| 898| } 2385| 32.3k| } 2386| | 2387| 1.90k| if (!allowed_auto_mounts[i].token) ------------------ | Branch (2387:7): [True: 179, False: 1.72k] ------------------ 2388| 179| return log_error_errno(-EINVAL, EINVAL, "Invalid filesystem to automount \"%s\"", token); ------------------ | | 486| 179| ({ \ | | 487| 179| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 179| errno = (__errno__); \ | | 489| 179| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 179| do { \ | | | | 454| 179| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 179| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 179| char *ptr = NULL; \ | | | | | | 317| 179| { \ | | | | | | 318| 179| int __saved_errno = errno; \ | | | | | | 319| 179| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 179| errno = __saved_errno; \ | | | | | | 321| 179| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 179] | | | | | | ------------------ | | | | | | 322| 179| ptr = errno_buf; \ | | | | | | 323| 179| } | | | | ------------------ | | | | 455| 179| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 179|#define ERROR(format, ...) do { \ | | | | | | 373| 179| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 179| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 179| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 179|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 179] | | | | | | ------------------ | | | | ------------------ | | | | 456| 179| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 179] | | | | ------------------ | | ------------------ | | 490| 179| __internal_ret__; \ | | 491| 179| }) ------------------ 2389| | 2390| 1.72k| lxc_conf->auto_mounts &= ~allowed_auto_mounts[i].mask; 2391| 1.72k| lxc_conf->auto_mounts |= allowed_auto_mounts[i].flag; 2392| | 2393| 1.72k| if (is_shmounts) { ------------------ | Branch (2393:7): [True: 898, False: 830] ------------------ 2394| 898| __do_free char *container_path = NULL, *host_path = NULL; ------------------ | | 69| 898|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 898| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2395| 898| char *val; 2396| | 2397| 898| val = token + STRLITERALLEN("shmounts:"); ------------------ | | 687| 898|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2398| 898| if (*val == '\0') ------------------ | Branch (2398:8): [True: 0, False: 898] ------------------ 2399| 0| return log_error_errno(-EINVAL, EINVAL, "Failed to copy shmounts host path"); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 2400| | 2401| 898| host_path = strdup(val); 2402| 898| if (!host_path) ------------------ | Branch (2402:8): [True: 0, False: 898] ------------------ 2403| 0| return log_error_errno(-EINVAL, EINVAL, "Failed to copy shmounts host path"); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 2404| | 2405| 898| val = strchr(host_path, ':'); 2406| 898| if (!val || *(val + 1) == '\0') ------------------ | Branch (2406:8): [True: 254, False: 644] | Branch (2406:16): [True: 310, False: 334] ------------------ 2407| 564| val = "/dev/.lxc-mounts"; 2408| 334| else 2409| 334| *val++ = '\0'; 2410| | 2411| 898| container_path = strdup(val); 2412| 898| if(!container_path) ------------------ | Branch (2412:7): [True: 0, False: 898] ------------------ 2413| 0| return log_error_errno(-EINVAL, EINVAL, "Failed to copy shmounts container path"); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 2414| | 2415| 898| free_disarm(lxc_conf->shmount.path_host); ------------------ | | 58| 898| ({ \ | | 59| 898| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 858, False: 40] | | ------------------ | | 60| 858| free(ptr); \ | | 61| 858| ptr = NULL; \ | | 62| 858| } \ | | 63| 898| }) ------------------ 2416| 898| lxc_conf->shmount.path_host = move_ptr(host_path); ------------------ | | 694| 898| ({ \ | | 695| 898| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 898| (ptr) = NULL; \ | | 697| 898| __internal_ptr__; \ | | 698| 898| }) ------------------ 2417| | 2418| 898| free_disarm(lxc_conf->shmount.path_cont); ------------------ | | 58| 898| ({ \ | | 59| 898| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 858, False: 40] | | ------------------ | | 60| 858| free(ptr); \ | | 61| 858| ptr = NULL; \ | | 62| 858| } \ | | 63| 898| }) ------------------ 2419| 898| lxc_conf->shmount.path_cont = move_ptr(container_path); ------------------ | | 694| 898| ({ \ | | 695| 898| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 898| (ptr) = NULL; \ | | 697| 898| __internal_ptr__; \ | | 698| 898| }) ------------------ 2420| 898| } 2421| 1.72k| } 2422| | 2423| 451| return 0; 2424| 630|} confile.c:set_config_mount_fstab: 2308| 228|{ 2309| 228| if (lxc_config_value_empty(value)) { ------------------ | Branch (2309:6): [True: 6, False: 222] ------------------ 2310| 6| clr_config_mount_fstab(key, lxc_conf, NULL); 2311| 6| return ret_errno(EINVAL); ------------------ | | 715| 6| ({ \ | | 716| 6| errno = labs(__errno__); \ | | 717| 6| -errno; \ | | 718| 6| }) ------------------ 2312| 6| } 2313| | 2314| 222| return set_config_path_item(&lxc_conf->fstab, value); 2315| 228|} confile.c:clr_config_mount_fstab: 4999| 6|{ 5000| | free_disarm(c->fstab); ------------------ | | 58| 6| ({ \ | | 59| 6| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 5, False: 1] | | ------------------ | | 60| 5| free(ptr); \ | | 61| 5| ptr = NULL; \ | | 62| 5| } \ | | 63| 6| }) ------------------ 5001| 6| return 0; 5002| 6|} confile.c:set_config_namespace_clone: 2900| 619|{ 2901| 619| __do_free char *ns = NULL; ------------------ | | 69| 619|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 619| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2902| 619| char *token; 2903| 619| int cloneflag = 0; 2904| | 2905| 619| if (lxc_config_value_empty(value)) ------------------ | Branch (2905:6): [True: 204, False: 415] ------------------ 2906| 204| return clr_config_namespace_clone(key, lxc_conf, data); 2907| | 2908| 415| if (lxc_conf->ns_keep != 0) ------------------ | Branch (2908:6): [True: 1, False: 414] ------------------ 2909| 1| return log_error_errno(-EINVAL, EINVAL, "Cannot set both \"lxc.namespace.clone\" and \"lxc.namespace.keep\""); ------------------ | | 486| 1| ({ \ | | 487| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 1| errno = (__errno__); \ | | 489| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 490| 1| __internal_ret__; \ | | 491| 1| }) ------------------ 2910| | 2911| 414| ns = strdup(value); 2912| 414| if (!ns) ------------------ | Branch (2912:6): [True: 0, False: 414] ------------------ 2913| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2914| | 2915| 594| lxc_iterate_parts(token, ns, " \t") { ------------------ | | 187| 414| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 991| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 594, False: 397] | | ------------------ | | 189| 577| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2916| 594| token += lxc_char_left_gc(token, strlen(token)); 2917| 594| token[lxc_char_right_gc(token, strlen(token))] = '\0'; 2918| 594| cloneflag = lxc_namespace_2_cloneflag(token); 2919| 594| if (cloneflag < 0) ------------------ | Branch (2919:7): [True: 17, False: 577] ------------------ 2920| 17| return ret_errno(EINVAL); ------------------ | | 715| 17| ({ \ | | 716| 17| errno = labs(__errno__); \ | | 717| 17| -errno; \ | | 718| 17| }) ------------------ 2921| 577| lxc_conf->ns_clone |= cloneflag; 2922| 577| } 2923| | 2924| 397| return 0; 2925| 414|} confile.c:clr_config_namespace_clone: 5326| 204|{ 5327| 204| lxc_conf->ns_clone = 0; 5328| 204| return 0; 5329| 204|} confile.c:set_config_namespace_keep: 2929| 664|{ 2930| 664| __do_free char *ns = NULL; ------------------ | | 69| 664|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 664| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2931| 664| char *token; 2932| 664| int cloneflag = 0; 2933| | 2934| 664| if (lxc_config_value_empty(value)) ------------------ | Branch (2934:6): [True: 194, False: 470] ------------------ 2935| 194| return clr_config_namespace_keep(key, lxc_conf, data); 2936| | 2937| 470| if (lxc_conf->ns_clone != 0) ------------------ | Branch (2937:6): [True: 2, False: 468] ------------------ 2938| 2| return log_error_errno(-EINVAL, EINVAL, "Cannot set both \"lxc.namespace.clone\" and \"lxc.namespace.keep\""); ------------------ | | 486| 2| ({ \ | | 487| 2| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 2| errno = (__errno__); \ | | 489| 2| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 2| do { \ | | | | 454| 2| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 2| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 2| char *ptr = NULL; \ | | | | | | 317| 2| { \ | | | | | | 318| 2| int __saved_errno = errno; \ | | | | | | 319| 2| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 2| errno = __saved_errno; \ | | | | | | 321| 2| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 2] | | | | | | ------------------ | | | | | | 322| 2| ptr = errno_buf; \ | | | | | | 323| 2| } | | | | ------------------ | | | | 455| 2| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 2|#define ERROR(format, ...) do { \ | | | | | | 373| 2| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 2| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 2| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 2|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 2] | | | | | | ------------------ | | | | ------------------ | | | | 456| 2| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 2] | | | | ------------------ | | ------------------ | | 490| 2| __internal_ret__; \ | | 491| 2| }) ------------------ 2939| | 2940| 468| ns = strdup(value); 2941| 468| if (!ns) ------------------ | Branch (2941:6): [True: 0, False: 468] ------------------ 2942| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2943| | 2944| 594| lxc_iterate_parts(token, ns, " \t") { ------------------ | | 187| 468| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 994| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 594, False: 400] | | ------------------ | | 189| 526| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2945| 594| token += lxc_char_left_gc(token, strlen(token)); 2946| 594| token[lxc_char_right_gc(token, strlen(token))] = '\0'; 2947| 594| cloneflag = lxc_namespace_2_cloneflag(token); 2948| 594| if (cloneflag < 0) ------------------ | Branch (2948:7): [True: 68, False: 526] ------------------ 2949| 68| return ret_errno(EINVAL); ------------------ | | 715| 68| ({ \ | | 716| 68| errno = labs(__errno__); \ | | 717| 68| -errno; \ | | 718| 68| }) ------------------ 2950| 526| lxc_conf->ns_keep |= cloneflag; 2951| 526| } 2952| | 2953| 400| return 0; 2954| 468|} confile.c:clr_config_namespace_keep: 5333| 194|{ 5334| 194| lxc_conf->ns_keep = 0; 5335| 194| return 0; 5336| 194|} confile.c:set_config_namespace_share: 3036| 638|{ 3037| 638| int ns_idx; 3038| 638| const char *namespace; 3039| | 3040| 638| if (lxc_config_value_empty(value)) ------------------ | Branch (3040:6): [True: 394, False: 244] ------------------ 3041| 394| return clr_config_namespace_share(key, lxc_conf, data); 3042| | 3043| 244| namespace = key + STRLITERALLEN("lxc.namespace.share."); ------------------ | | 687| 244|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 3044| 244| if (is_empty_string(namespace)) ------------------ | Branch (3044:6): [True: 1, False: 243] ------------------ 3045| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 3046| | 3047| 243| ns_idx = lxc_namespace_2_ns_idx(namespace); 3048| 243| if (ns_idx < 0) ------------------ | Branch (3048:6): [True: 4, False: 239] ------------------ 3049| 4| return ns_idx; 3050| | 3051| 239| return set_config_string_item(&lxc_conf->ns_share[ns_idx], value); 3052| 243|} confile.c:clr_config_namespace_share: 5354| 394|{ 5355| 394| int ns_idx; 5356| 394| const char *namespace; 5357| | 5358| 394| namespace = key + STRLITERALLEN("lxc.namespace.share."); ------------------ | | 687| 394|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 5359| 394| if (is_empty_string(namespace)) ------------------ | Branch (5359:6): [True: 4, False: 390] ------------------ 5360| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 5361| | 5362| 390| ns_idx = lxc_namespace_2_ns_idx(namespace); 5363| 390| if (ns_idx < 0) ------------------ | Branch (5363:6): [True: 48, False: 342] ------------------ 5364| 48| return ns_idx; 5365| | 5366| 342| free(lxc_conf->ns_share[ns_idx]); 5367| 342| lxc_conf->ns_share[ns_idx] = NULL; 5368| | 5369| 342| return 0; 5370| 390|} confile.c:set_config_time_offset_boot: 2958| 2.96k|{ 2959| 2.96k| int ret; 2960| 2.96k| char *unit; 2961| 2.96k| int64_t offset = 0; 2962| 2.96k| char buf[STRLITERALLEN("ms") + 1]; 2963| | 2964| 2.96k| if (lxc_config_value_empty(value)) ------------------ | Branch (2964:6): [True: 195, False: 2.76k] ------------------ 2965| 195| return clr_config_time_offset_boot(key, lxc_conf, data); 2966| | 2967| 2.76k| ret = lxc_safe_int64_residual(value, &offset, 10, buf, sizeof(buf)); 2968| 2.76k| if (ret) ------------------ | Branch (2968:6): [True: 26, False: 2.74k] ------------------ 2969| 26| return ret; 2970| | 2971| 2.74k| unit = lxc_trim_whitespace_in_place(buf); 2972| 2.74k| if (strequal(unit, "h")) { ------------------ | Branch (2972:6): [True: 669, False: 2.07k] ------------------ 2973| 669| if (check_mul_overflow(offset, (typeof(offset))3600, &lxc_conf->timens.s_boot)) ------------------ | | 216| 669|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 59, False: 610] | | ------------------ | | 217| 669| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 669|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 669| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 669|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 669| typeof(a) __a = (a); \ | | | | 193| 669| typeof(b) __b = (b); \ | | | | 194| 669| typeof(d) __d = (d); \ | | | | 195| 669| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 669|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 669|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 669|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 669|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 669|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 669| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 669|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 669|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 669|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 669|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 669|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 669|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 669| (void) (&__a == &__b); \ | | | | 198| 669| (void) (&__a == __d); \ | | | | 199| 669| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 669| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 669, False: 0] | | | | | Branch (200:17): [True: 2, False: 667] | | | | | Branch (200:37): [True: 57, False: 610] | | | | ------------------ | | | | 201| 669| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 610] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 669| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 610] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 669|}) | | ------------------ | | 219| 669| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 669|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 669| typeof(a) __a = (a); \ | | | | 122| 669| typeof(b) __b = (b); \ | | | | 123| 669| typeof(d) __d = (d); \ | | | | 124| 669| (void) (&__a == &__b); \ | | | | 125| 669| (void) (&__a == __d); \ | | | | 126| 669| *__d = __a * __b; \ | | | | 127| 669| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 669] | | | | ------------------ | | | | 128| 669| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 669| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 669] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 669|}) | | ------------------ ------------------ 2974| 59| return ret_errno(EOVERFLOW); ------------------ | | 715| 59| ({ \ | | 716| 59| errno = labs(__errno__); \ | | 717| 59| -errno; \ | | 718| 59| }) ------------------ 2975| 2.07k| } else if (strequal(unit, "m")) { ------------------ | Branch (2975:13): [True: 460, False: 1.61k] ------------------ 2976| 460| if (check_mul_overflow(offset, (typeof(offset))60, &lxc_conf->timens.s_boot)) ------------------ | | 216| 460|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 67, False: 393] | | ------------------ | | 217| 460| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 460|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 460| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 460|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 460| typeof(a) __a = (a); \ | | | | 193| 460| typeof(b) __b = (b); \ | | | | 194| 460| typeof(d) __d = (d); \ | | | | 195| 460| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 460|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 460|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 460|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 460|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 460|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 460| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 460|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 460|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 460|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 460|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 460|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 460|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 460| (void) (&__a == &__b); \ | | | | 198| 460| (void) (&__a == __d); \ | | | | 199| 460| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 460| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 460, False: 0] | | | | | Branch (200:17): [True: 1, False: 459] | | | | | Branch (200:37): [True: 66, False: 393] | | | | ------------------ | | | | 201| 460| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 393] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 460| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 393] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 460|}) | | ------------------ | | 219| 460| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 460|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 460| typeof(a) __a = (a); \ | | | | 122| 460| typeof(b) __b = (b); \ | | | | 123| 460| typeof(d) __d = (d); \ | | | | 124| 460| (void) (&__a == &__b); \ | | | | 125| 460| (void) (&__a == __d); \ | | | | 126| 460| *__d = __a * __b; \ | | | | 127| 460| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 460] | | | | ------------------ | | | | 128| 460| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 460| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 460] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 460|}) | | ------------------ ------------------ 2977| 67| return ret_errno(EOVERFLOW); ------------------ | | 715| 67| ({ \ | | 716| 67| errno = labs(__errno__); \ | | 717| 67| -errno; \ | | 718| 67| }) ------------------ 2978| 1.61k| } else if (strequal(unit, "s")) { ------------------ | Branch (2978:13): [True: 543, False: 1.06k] ------------------ 2979| 543| lxc_conf->timens.s_boot = offset; 2980| 1.06k| } else if (strequal(unit, "ms")) { ------------------ | Branch (2980:13): [True: 418, False: 650] ------------------ 2981| 418| if (check_mul_overflow(offset, (typeof(offset))1000000, &lxc_conf->timens.ns_boot)) ------------------ | | 216| 418|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 25, False: 393] | | ------------------ | | 217| 418| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 418|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 418| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 418|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 418| typeof(a) __a = (a); \ | | | | 193| 418| typeof(b) __b = (b); \ | | | | 194| 418| typeof(d) __d = (d); \ | | | | 195| 418| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 418|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 418|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 418|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 418|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 418|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 418| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 418|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 418|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 418|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 418|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 418|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 418|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 418| (void) (&__a == &__b); \ | | | | 198| 418| (void) (&__a == __d); \ | | | | 199| 418| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 418| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 418, False: 0] | | | | | Branch (200:17): [True: 1, False: 417] | | | | | Branch (200:37): [True: 24, False: 393] | | | | ------------------ | | | | 201| 418| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 393] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 418| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 393] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 418|}) | | ------------------ | | 219| 418| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 418|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 418| typeof(a) __a = (a); \ | | | | 122| 418| typeof(b) __b = (b); \ | | | | 123| 418| typeof(d) __d = (d); \ | | | | 124| 418| (void) (&__a == &__b); \ | | | | 125| 418| (void) (&__a == __d); \ | | | | 126| 418| *__d = __a * __b; \ | | | | 127| 418| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 418] | | | | ------------------ | | | | 128| 418| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 418| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 418] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 418|}) | | ------------------ ------------------ 2982| 25| return ret_errno(EOVERFLOW); ------------------ | | 715| 25| ({ \ | | 716| 25| errno = labs(__errno__); \ | | 717| 25| -errno; \ | | 718| 25| }) ------------------ 2983| 650| } else if (strequal(unit, "us")) { ------------------ | Branch (2983:13): [True: 377, False: 273] ------------------ 2984| 377| if (check_mul_overflow(offset, (typeof(offset))1000, &lxc_conf->timens.ns_boot)) ------------------ | | 216| 377|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 58, False: 319] | | ------------------ | | 217| 377| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 377|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 377| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 377|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 377| typeof(a) __a = (a); \ | | | | 193| 377| typeof(b) __b = (b); \ | | | | 194| 377| typeof(d) __d = (d); \ | | | | 195| 377| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 377|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 377|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 377|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 377|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 377|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 377| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 377|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 377|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 377|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 377|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 377|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 377|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 377| (void) (&__a == &__b); \ | | | | 198| 377| (void) (&__a == __d); \ | | | | 199| 377| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 377| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 377, False: 0] | | | | | Branch (200:17): [True: 1, False: 376] | | | | | Branch (200:37): [True: 57, False: 319] | | | | ------------------ | | | | 201| 377| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 319] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 377| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 319] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 377|}) | | ------------------ | | 219| 377| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 377|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 377| typeof(a) __a = (a); \ | | | | 122| 377| typeof(b) __b = (b); \ | | | | 123| 377| typeof(d) __d = (d); \ | | | | 124| 377| (void) (&__a == &__b); \ | | | | 125| 377| (void) (&__a == __d); \ | | | | 126| 377| *__d = __a * __b; \ | | | | 127| 377| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 377] | | | | ------------------ | | | | 128| 377| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 377| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 377] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 377|}) | | ------------------ ------------------ 2985| 58| return ret_errno(EOVERFLOW); ------------------ | | 715| 58| ({ \ | | 716| 58| errno = labs(__errno__); \ | | 717| 58| -errno; \ | | 718| 58| }) ------------------ 2986| 377| } else if (strequal(unit, "ns")) { ------------------ | Branch (2986:13): [True: 194, False: 79] ------------------ 2987| 194| lxc_conf->timens.ns_boot = offset; 2988| 194| } else { 2989| 79| return ret_errno(EINVAL); ------------------ | | 715| 79| ({ \ | | 716| 79| errno = labs(__errno__); \ | | 717| 79| -errno; \ | | 718| 79| }) ------------------ 2990| 79| } 2991| | 2992| 2.45k| return 0; 2993| 2.74k|} confile.c:clr_config_time_offset_boot: 5339| 195|{ 5340| 195| lxc_conf->timens.s_boot = 0; 5341| 195| lxc_conf->timens.ns_boot = 0; 5342| 195| return 0; 5343| 195|} confile.c:set_config_time_offset_monotonic: 2997| 2.06k|{ 2998| 2.06k| int ret; 2999| 2.06k| char *unit; 3000| 2.06k| int64_t offset = 0; 3001| 2.06k| char buf[STRLITERALLEN("ms") + 1]; 3002| | 3003| 2.06k| if (lxc_config_value_empty(value)) ------------------ | Branch (3003:6): [True: 194, False: 1.87k] ------------------ 3004| 194| return clr_config_time_offset_monotonic(key, lxc_conf, data); 3005| | 3006| 1.87k| ret = lxc_safe_int64_residual(value, &offset, 10, buf, sizeof(buf)); 3007| 1.87k| if (ret) ------------------ | Branch (3007:6): [True: 2, False: 1.86k] ------------------ 3008| 2| return ret; 3009| | 3010| 1.86k| unit = lxc_trim_whitespace_in_place(buf); 3011| 1.86k| if (strequal(unit, "h")) { ------------------ | Branch (3011:6): [True: 383, False: 1.48k] ------------------ 3012| 383| if (check_mul_overflow(offset, (typeof(offset))3600, &lxc_conf->timens.s_monotonic)) ------------------ | | 216| 383|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 66, False: 317] | | ------------------ | | 217| 383| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 383|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 383| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 383|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 383| typeof(a) __a = (a); \ | | | | 193| 383| typeof(b) __b = (b); \ | | | | 194| 383| typeof(d) __d = (d); \ | | | | 195| 383| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 383|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 383|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 383|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 383|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 383|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 383| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 383|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 383|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 383|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 383|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 383|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 383|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 383| (void) (&__a == &__b); \ | | | | 198| 383| (void) (&__a == __d); \ | | | | 199| 383| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 383| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 383, False: 0] | | | | | Branch (200:17): [True: 2, False: 381] | | | | | Branch (200:37): [True: 64, False: 317] | | | | ------------------ | | | | 201| 383| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 317] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 383| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 317] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 383|}) | | ------------------ | | 219| 383| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 383|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 383| typeof(a) __a = (a); \ | | | | 122| 383| typeof(b) __b = (b); \ | | | | 123| 383| typeof(d) __d = (d); \ | | | | 124| 383| (void) (&__a == &__b); \ | | | | 125| 383| (void) (&__a == __d); \ | | | | 126| 383| *__d = __a * __b; \ | | | | 127| 383| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 383] | | | | ------------------ | | | | 128| 383| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 383| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 383] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 383|}) | | ------------------ ------------------ 3013| 66| return ret_errno(EOVERFLOW); ------------------ | | 715| 66| ({ \ | | 716| 66| errno = labs(__errno__); \ | | 717| 66| -errno; \ | | 718| 66| }) ------------------ 3014| 1.48k| } else if (strequal(unit, "m")) { ------------------ | Branch (3014:13): [True: 385, False: 1.10k] ------------------ 3015| 385| if (check_mul_overflow(offset, (typeof(offset))60, &lxc_conf->timens.s_monotonic)) ------------------ | | 216| 385|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 58, False: 327] | | ------------------ | | 217| 385| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 385|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 385| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 385|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 385| typeof(a) __a = (a); \ | | | | 193| 385| typeof(b) __b = (b); \ | | | | 194| 385| typeof(d) __d = (d); \ | | | | 195| 385| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 385|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 385|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 385|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 385|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 385|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 385| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 385|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 385|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 385|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 385|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 385|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 385|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 385| (void) (&__a == &__b); \ | | | | 198| 385| (void) (&__a == __d); \ | | | | 199| 385| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 385| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 385, False: 0] | | | | | Branch (200:17): [True: 2, False: 383] | | | | | Branch (200:37): [True: 56, False: 327] | | | | ------------------ | | | | 201| 385| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 327] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 385| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 327] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 385|}) | | ------------------ | | 219| 385| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 385|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 385| typeof(a) __a = (a); \ | | | | 122| 385| typeof(b) __b = (b); \ | | | | 123| 385| typeof(d) __d = (d); \ | | | | 124| 385| (void) (&__a == &__b); \ | | | | 125| 385| (void) (&__a == __d); \ | | | | 126| 385| *__d = __a * __b; \ | | | | 127| 385| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 385] | | | | ------------------ | | | | 128| 385| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 385| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 385] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 385|}) | | ------------------ ------------------ 3016| 58| return ret_errno(EOVERFLOW); ------------------ | | 715| 58| ({ \ | | 716| 58| errno = labs(__errno__); \ | | 717| 58| -errno; \ | | 718| 58| }) ------------------ 3017| 1.10k| } else if (strequal(unit, "s")) { ------------------ | Branch (3017:13): [True: 244, False: 856] ------------------ 3018| 244| lxc_conf->timens.s_monotonic = offset; 3019| 856| } else if (strequal(unit, "ms")) { ------------------ | Branch (3019:13): [True: 307, False: 549] ------------------ 3020| 307| if (check_mul_overflow(offset, (typeof(offset))1000000, &lxc_conf->timens.ns_monotonic)) ------------------ | | 216| 307|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 56, False: 251] | | ------------------ | | 217| 307| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 307|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 307| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 307|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 307| typeof(a) __a = (a); \ | | | | 193| 307| typeof(b) __b = (b); \ | | | | 194| 307| typeof(d) __d = (d); \ | | | | 195| 307| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 307|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 307|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 307|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 307|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 307|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 307| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 307|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 307|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 307|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 307|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 307|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 307|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 307| (void) (&__a == &__b); \ | | | | 198| 307| (void) (&__a == __d); \ | | | | 199| 307| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 307| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 307, False: 0] | | | | | Branch (200:17): [True: 1, False: 306] | | | | | Branch (200:37): [True: 55, False: 251] | | | | ------------------ | | | | 201| 307| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 251] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 307| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 251] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 307|}) | | ------------------ | | 219| 307| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 307|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 307| typeof(a) __a = (a); \ | | | | 122| 307| typeof(b) __b = (b); \ | | | | 123| 307| typeof(d) __d = (d); \ | | | | 124| 307| (void) (&__a == &__b); \ | | | | 125| 307| (void) (&__a == __d); \ | | | | 126| 307| *__d = __a * __b; \ | | | | 127| 307| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 307] | | | | ------------------ | | | | 128| 307| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 307| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 307] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 307|}) | | ------------------ ------------------ 3021| 56| return ret_errno(EOVERFLOW); ------------------ | | 715| 56| ({ \ | | 716| 56| errno = labs(__errno__); \ | | 717| 56| -errno; \ | | 718| 56| }) ------------------ 3022| 549| } else if (strequal(unit, "us")) { ------------------ | Branch (3022:13): [True: 329, False: 220] ------------------ 3023| 329| if (check_mul_overflow(offset, (typeof(offset))1000, &lxc_conf->timens.ns_monotonic)) ------------------ | | 216| 329|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 37, False: 292] | | ------------------ | | 217| 329| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 329|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 329| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 329|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 329| typeof(a) __a = (a); \ | | | | 193| 329| typeof(b) __b = (b); \ | | | | 194| 329| typeof(d) __d = (d); \ | | | | 195| 329| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 329|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 329|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 329|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 329|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 329|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 329| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 329|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 329|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 329|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 329|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 329|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 329|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 329| (void) (&__a == &__b); \ | | | | 198| 329| (void) (&__a == __d); \ | | | | 199| 329| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 329| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 329, False: 0] | | | | | Branch (200:17): [True: 1, False: 328] | | | | | Branch (200:37): [True: 36, False: 292] | | | | ------------------ | | | | 201| 329| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 292] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 329| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 292] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 329|}) | | ------------------ | | 219| 329| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 329|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 329| typeof(a) __a = (a); \ | | | | 122| 329| typeof(b) __b = (b); \ | | | | 123| 329| typeof(d) __d = (d); \ | | | | 124| 329| (void) (&__a == &__b); \ | | | | 125| 329| (void) (&__a == __d); \ | | | | 126| 329| *__d = __a * __b; \ | | | | 127| 329| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 329] | | | | ------------------ | | | | 128| 329| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 329| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 329] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 329|}) | | ------------------ ------------------ 3024| 37| return ret_errno(EOVERFLOW); ------------------ | | 715| 37| ({ \ | | 716| 37| errno = labs(__errno__); \ | | 717| 37| -errno; \ | | 718| 37| }) ------------------ 3025| 329| } else if (strequal(unit, "ns")) { ------------------ | Branch (3025:13): [True: 194, False: 26] ------------------ 3026| 194| lxc_conf->timens.ns_monotonic = offset; 3027| 194| } else { 3028| 26| return ret_errno(EINVAL); ------------------ | | 715| 26| ({ \ | | 716| 26| errno = labs(__errno__); \ | | 717| 26| -errno; \ | | 718| 26| }) ------------------ 3029| 26| } 3030| | 3031| 1.62k| return 0; 3032| 1.86k|} confile.c:clr_config_time_offset_monotonic: 5346| 194|{ 5347| 194| lxc_conf->timens.s_monotonic = 0; 5348| 194| lxc_conf->timens.ns_monotonic = 0; 5349| 194| return 0; 5350| 194|} confile.c:set_config_jump_table_net: 5441| 33.7k|{ 5442| 33.7k| struct config_net_info info = {}; 5443| 33.7k| int ret; 5444| 33.7k| const char *idxstring; 5445| | 5446| 33.7k| idxstring = key + STRLITERALLEN("lxc.net."); ------------------ | | 687| 33.7k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 5447| 33.7k| if (!isdigit(*idxstring)) ------------------ | Branch (5447:6): [True: 80, False: 33.6k] ------------------ 5448| 80| return ret_errno(EINVAL); ------------------ | | 715| 80| ({ \ | | 716| 80| errno = labs(__errno__); \ | | 717| 80| -errno; \ | | 718| 80| }) ------------------ 5449| | 5450| 33.6k| if (lxc_config_value_empty(value)) ------------------ | Branch (5450:6): [True: 11.8k, False: 21.7k] ------------------ 5451| 11.8k| return clr_config_jump_table_net(key, lxc_conf, data); 5452| | 5453| 21.7k| ret = get_network_config_ops(key, lxc_conf, &info, true); 5454| 21.7k| if (ret) ------------------ | Branch (5454:6): [True: 341, False: 21.4k] ------------------ 5455| 341| return ret; 5456| | 5457| 21.4k| return info.ops->set(info.subkey, value, lxc_conf, info.netdev); 5458| 21.7k|} confile.c:clr_config_jump_table_net: 5462| 11.8k|{ 5463| 11.8k| struct config_net_info info = {}; 5464| 11.8k| int ret; 5465| 11.8k| const char *idxstring; 5466| | 5467| 11.8k| idxstring = key + 8; 5468| 11.8k| if (!isdigit(*idxstring)) ------------------ | Branch (5468:6): [True: 0, False: 11.8k] ------------------ 5469| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5470| | 5471| | /* The left conjunct is pretty self-explanatory. The right conjunct 5472| | * checks whether the two pointers are equal. If they are we know that 5473| | * this is not a key that is namespaced any further and so we are 5474| | * supposed to clear the whole network. 5475| | */ 5476| 11.8k| if (isdigit(*idxstring) && (strrchr(key, '.') == (idxstring - 1))) { ------------------ | Branch (5476:6): [True: 11.8k, False: 0] | Branch (5476:29): [True: 1.01k, False: 10.8k] ------------------ 5477| 1.01k| unsigned int rmnetdevidx; 5478| | 5479| 1.01k| ret = lxc_safe_uint(idxstring, &rmnetdevidx); 5480| 1.01k| if (ret < 0) ------------------ | Branch (5480:7): [True: 68, False: 946] ------------------ 5481| 68| return ret; 5482| | 5483| | /* Remove network from network list. */ 5484| 946| lxc_remove_nic_by_idx(lxc_conf, rmnetdevidx); 5485| 946| return 0; 5486| 1.01k| } 5487| | 5488| 10.8k| ret = get_network_config_ops(key, lxc_conf, &info, false); 5489| 10.8k| if (ret) ------------------ | Branch (5489:6): [True: 52, False: 10.7k] ------------------ 5490| 52| return ret; 5491| | 5492| 10.7k| return info.ops->clr(info.subkey, lxc_conf, info.netdev); 5493| 10.8k|} confile.c:set_config_net: 402| 1.55k|{ 403| 1.55k| if (!lxc_config_value_empty(value)) ------------------ | Branch (403:6): [True: 12, False: 1.54k] ------------------ 404| 12| return syserror_set(-EINVAL, "lxc.net must not have a value"); ------------------ | | 568| 12| ({ \ | | 569| 12| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 12| errno = labs(__ret__); \ | | 571| 12| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 12| do { \ | | | | 454| 12| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 12| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 12| char *ptr = NULL; \ | | | | | | 317| 12| { \ | | | | | | 318| 12| int __saved_errno = errno; \ | | | | | | 319| 12| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 12| errno = __saved_errno; \ | | | | | | 321| 12| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 12] | | | | | | ------------------ | | | | | | 322| 12| ptr = errno_buf; \ | | | | | | 323| 12| } | | | | ------------------ | | | | 455| 12| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 12|#define ERROR(format, ...) do { \ | | | | | | 373| 12| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 12| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 12| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 12|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 12] | | | | | | ------------------ | | | | ------------------ | | | | 456| 12| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 12] | | | | ------------------ | | ------------------ | | 572| 12| __internal_ret__; \ | | 573| 12| }) ------------------ 405| | 406| 1.54k| return clr_config_net(key, lxc_conf, data); 407| 1.55k|} confile.c:clr_config_net: 5056| 1.54k|{ 5057| 1.54k| lxc_free_networks(c); 5058| | 5059| 1.54k| return 0; 5060| 1.54k|} confile.c:set_config_no_new_privs: 3712| 449|{ 3713| 449| int ret; 3714| 449| unsigned int v; 3715| | 3716| 449| if (lxc_config_value_empty(value)) { ------------------ | Branch (3716:6): [True: 194, False: 255] ------------------ 3717| 194| lxc_conf->no_new_privs = false; 3718| 194| return 0; 3719| 194| } 3720| | 3721| 255| ret = lxc_safe_uint(value, &v); 3722| 255| if (ret < 0) ------------------ | Branch (3722:6): [True: 2, False: 253] ------------------ 3723| 2| return ret; 3724| | 3725| 253| if (v > 1) ------------------ | Branch (3725:6): [True: 58, False: 195] ------------------ 3726| 58| return ret_errno(EINVAL); ------------------ | | 715| 58| ({ \ | | 716| 58| errno = labs(__errno__); \ | | 717| 58| -errno; \ | | 718| 58| }) ------------------ 3727| | 3728| 195| lxc_conf->no_new_privs = v ? true : false; ------------------ | Branch (3728:27): [True: 5, False: 190] ------------------ 3729| | 3730| 195| return 0; 3731| 253|} confile.c:set_config_prlimit: 2102| 3.38k|{ 2103| 3.38k| call_cleaner(free_lxc_limit) struct lxc_limit *new_lim = NULL; ------------------ | | 26| 3.38k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 2104| 3.38k| struct rlimit limit; 2105| 3.38k| rlim_t limit_value; 2106| 3.38k| struct lxc_limit *lim; 2107| | 2108| 3.38k| if (lxc_config_value_empty(value)) ------------------ | Branch (2108:6): [True: 1.04k, False: 2.33k] ------------------ 2109| 1.04k| return lxc_clear_limits(lxc_conf, key); 2110| | 2111| 2.33k| if (!strnequal(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit."))) ------------------ | | 687| 2.33k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2111:6): [True: 9, False: 2.32k] ------------------ 2112| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 2113| | 2114| 2.32k| key += STRLITERALLEN("lxc.prlimit."); ------------------ | | 687| 2.32k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2115| | 2116| | /* soft limit comes first in the value */ 2117| 2.32k| if (!parse_limit_value(&value, &limit_value)) ------------------ | Branch (2117:6): [True: 1, False: 2.32k] ------------------ 2118| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2119| | 2120| 2.32k| limit.rlim_cur = limit_value; 2121| | 2122| | /* skip spaces and a colon */ 2123| 2.32k| while (isspace(*value)) ------------------ | Branch (2123:9): [True: 1.10k, False: 2.32k] ------------------ 2124| 1.10k| ++value; 2125| | 2126| 2.32k| if (*value == ':') ------------------ | Branch (2126:6): [True: 965, False: 1.36k] ------------------ 2127| 965| ++value; 2128| 1.36k| else if (*value) /* any other character is an error here */ ------------------ | Branch (2128:11): [True: 94, False: 1.26k] ------------------ 2129| 94| return ret_errno(EINVAL); ------------------ | | 715| 94| ({ \ | | 716| 94| errno = labs(__errno__); \ | | 717| 94| -errno; \ | | 718| 94| }) ------------------ 2130| | 2131| 2.23k| while (isspace(*value)) ------------------ | Branch (2131:9): [True: 337, False: 2.23k] ------------------ 2132| 337| ++value; 2133| | 2134| | /* optional hard limit */ 2135| 2.23k| if (*value) { ------------------ | Branch (2135:6): [True: 490, False: 1.74k] ------------------ 2136| 490| if (!parse_limit_value(&value, &limit_value)) ------------------ | Branch (2136:7): [True: 1, False: 489] ------------------ 2137| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2138| | 2139| 489| limit.rlim_max = limit_value; 2140| | 2141| | /* check for trailing garbage */ 2142| 489| while (isspace(*value)) ------------------ | Branch (2142:10): [True: 195, False: 489] ------------------ 2143| 195| ++value; 2144| | 2145| 489| if (*value) ------------------ | Branch (2145:7): [True: 87, False: 402] ------------------ 2146| 87| return ret_errno(EINVAL); ------------------ | | 715| 87| ({ \ | | 716| 87| errno = labs(__errno__); \ | | 717| 87| -errno; \ | | 718| 87| }) ------------------ 2147| 1.74k| } else { 2148| | /* a single value sets both hard and soft limit */ 2149| 1.74k| limit.rlim_max = limit.rlim_cur; 2150| 1.74k| } 2151| | 2152| | /* find existing list element */ 2153| 2.95k| list_for_each_entry(lim, &lxc_conf->limits, head) { ------------------ | | 568| 2.23k| for (pos = list_first_entry(head, typeof(*pos), member); \ | | ------------------ | | | | 462| 2.23k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 2.23k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.23k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.23k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.23k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.14k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.14k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.14k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.14k| do { \ | | | | | | | | | | | | | | | | 286| 2.14k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.14k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.23k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.23k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.23k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 569| 3.90k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 3.90k| (&pos->member == (head)) | | ------------------ | | | Branch (569:7): [True: 2.95k, False: 948] | | ------------------ | | 570| 2.14k| pos = list_next_entry(pos, member)) | | ------------------ | | | | 495| 1.76k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.76k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.76k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.76k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.76k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.76k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.76k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.76k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.76k| do { \ | | | | | | | | | | | | | | | | 286| 1.76k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.76k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.76k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.76k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.76k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 2154| 2.95k| if (!strequal(key, lim->resource)) ------------------ | Branch (2154:7): [True: 1.76k, False: 1.19k] ------------------ 2155| 1.76k| continue; 2156| | 2157| 1.19k| lim->limit = limit; 2158| 1.19k| return 0; 2159| 2.95k| } 2160| | 2161| 948| new_lim = zalloc(sizeof(*new_lim)); ------------------ | | 90| 948|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2162| 948| if (!new_lim) ------------------ | Branch (2162:6): [True: 0, False: 948] ------------------ 2163| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2164| | 2165| 948| new_lim->resource = strdup(key); 2166| 948| if (!new_lim->resource) ------------------ | Branch (2166:6): [True: 0, False: 948] ------------------ 2167| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2168| | 2169| 948| new_lim->limit = limit; 2170| 948| list_add_tail(&new_lim->head, &lxc_conf->limits); 2171| 948| move_ptr(new_lim); ------------------ | | 694| 948| ({ \ | | 695| 948| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 948| (ptr) = NULL; \ | | 697| 948| __internal_ptr__; \ | | 698| 948| }) ------------------ 2172| | 2173| 948| return 0; 2174| 948|} confile.c:parse_limit_value: 2081| 2.81k|{ 2082| 2.81k| char *endptr = NULL; 2083| | 2084| 2.81k| if (strnequal(*value, "unlimited", STRLITERALLEN("unlimited"))) { ------------------ | | 687| 2.81k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2084:6): [True: 389, False: 2.42k] ------------------ 2085| 389| *res = RLIM_INFINITY; 2086| 389| *value += STRLITERALLEN("unlimited"); ------------------ | | 687| 389|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2087| 389| return true; 2088| 389| } 2089| | 2090| 2.81k| errno = 0; 2091| 2.42k| *res = strtoull(*value, &endptr, 10); 2092| 2.42k| if (errno || !endptr) ------------------ | Branch (2092:6): [True: 2, False: 2.42k] | Branch (2092:15): [True: 0, False: 2.42k] ------------------ 2093| 2| return false; 2094| | 2095| 2.42k| *value = endptr; 2096| | 2097| | return true; 2098| 2.42k|} confile.c:set_config_pty_max: 1442| 530|{ 1443| 530| int ret; 1444| 530| unsigned int max = 0; 1445| | 1446| 530| if (lxc_config_value_empty(value)) { ------------------ | Branch (1446:6): [True: 207, False: 323] ------------------ 1447| 207| lxc_conf->pty_max = 0; 1448| 207| return 0; 1449| 207| } 1450| | 1451| 323| ret = lxc_safe_uint(value, &max); 1452| 323| if (ret < 0) ------------------ | Branch (1452:6): [True: 6, False: 317] ------------------ 1453| 6| return ret_errno(EINVAL); ------------------ | | 715| 6| ({ \ | | 716| 6| errno = labs(__errno__); \ | | 717| 6| -errno; \ | | 718| 6| }) ------------------ 1454| | 1455| 317| lxc_conf->pty_max = max; 1456| | 1457| 317| return 0; 1458| 323|} confile.c:set_config_rootfs_managed: 2827| 270|{ 2828| | return set_config_bool_item(&lxc_conf->rootfs.managed, value, true); 2829| 270|} confile.c:set_config_rootfs_mount: 2833| 194|{ 2834| 194| return set_config_path_item(&lxc_conf->rootfs.mount, value); 2835| 194|} confile.c:set_config_rootfs_options: 2839| 2.16k|{ 2840| 2.16k| __do_free char *dup = NULL, *raw_options = NULL; ------------------ | | 69| 2.16k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.16k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2841| 2.16k| struct lxc_rootfs *rootfs = &lxc_conf->rootfs; 2842| 2.16k| struct lxc_mount_options *mnt_opts = &rootfs->mnt_opts; 2843| 2.16k| int ret; 2844| | 2845| 2.16k| clr_config_rootfs_options(key, lxc_conf, data); 2846| 2.16k| if (lxc_config_value_empty(value)) ------------------ | Branch (2846:6): [True: 209, False: 1.95k] ------------------ 2847| 209| return 0; 2848| | 2849| 1.95k| ret = set_config_string_item(&raw_options, value); 2850| 1.95k| if (ret < 0) ------------------ | Branch (2850:6): [True: 0, False: 1.95k] ------------------ 2851| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2852| | 2853| 1.95k| dup = strdup(value); 2854| 1.95k| if (!dup) ------------------ | Branch (2854:6): [True: 0, False: 1.95k] ------------------ 2855| 0| return -ENOMEM; 2856| | 2857| 1.95k| ret = parse_lxc_mount_attrs(mnt_opts, dup); 2858| 1.95k| if (ret < 0) ------------------ | Branch (2858:6): [True: 118, False: 1.84k] ------------------ 2859| 118| return ret; 2860| | 2861| | /* Make sure we're only valid LXC specific mount options. */ 2862| 1.84k| if (mnt_opts->create_dir || mnt_opts->create_file || ------------------ | Branch (2862:6): [True: 4, False: 1.83k] | Branch (2862:30): [True: 2, False: 1.83k] ------------------ 2863| 1.83k| mnt_opts->optional || mnt_opts->relative) ------------------ | Branch (2863:6): [True: 2, False: 1.83k] | Branch (2863:28): [True: 3, False: 1.83k] ------------------ 2864| 11| return syserror_set(-EINVAL, "Invalid LXC specific mount option for rootfs mount"); ------------------ | | 568| 11| ({ \ | | 569| 11| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 11| errno = labs(__ret__); \ | | 571| 11| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 11| do { \ | | | | 454| 11| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 11| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 11| char *ptr = NULL; \ | | | | | | 317| 11| { \ | | | | | | 318| 11| int __saved_errno = errno; \ | | | | | | 319| 11| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 11| errno = __saved_errno; \ | | | | | | 321| 11| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 11] | | | | | | ------------------ | | | | | | 322| 11| ptr = errno_buf; \ | | | | | | 323| 11| } | | | | ------------------ | | | | 455| 11| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 11|#define ERROR(format, ...) do { \ | | | | | | 373| 11| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 11| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 11| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 11|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 11] | | | | | | ------------------ | | | | ------------------ | | | | 456| 11| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 11] | | | | ------------------ | | ------------------ | | 572| 11| __internal_ret__; \ | | 573| 11| }) ------------------ 2865| | 2866| 1.83k| ret = parse_mount_attrs(mnt_opts, dup); 2867| 1.83k| if (ret < 0) ------------------ | Branch (2867:6): [True: 0, False: 1.83k] ------------------ 2868| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2869| | 2870| 1.83k| rootfs->mnt_opts.raw_options = move_ptr(raw_options); ------------------ | | 694| 1.83k| ({ \ | | 695| 1.83k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.83k| (ptr) = NULL; \ | | 697| 1.83k| __internal_ptr__; \ | | 698| 1.83k| }) ------------------ 2871| 1.83k| return 0; 2872| 1.83k|} confile.c:clr_config_rootfs_options: 5027| 2.16k|{ 5028| 2.16k| put_lxc_mount_options(&c->rootfs.mnt_opts); 5029| | 5030| 2.16k| return 0; 5031| 2.16k|} confile.c:set_config_rootfs_path: 2788| 1.46k|{ 2789| 1.46k| __do_free char *dup = NULL; ------------------ | | 69| 1.46k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.46k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2790| 1.46k| int ret; 2791| 1.46k| char *tmp; 2792| 1.46k| const char *container_path; 2793| | 2794| 1.46k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2794:6): [True: 194, False: 1.26k] ------------------ 2795| 194| free(lxc_conf->rootfs.path); 2796| 194| lxc_conf->rootfs.path = NULL; 2797| 194| return 0; 2798| 194| } 2799| | 2800| 1.26k| dup = strdup(value); 2801| 1.26k| if (!dup) ------------------ | Branch (2801:6): [True: 0, False: 1.26k] ------------------ 2802| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2803| | 2804| | /* Split : into and 2805| | * . Set "rootfs.__bdev_type" to and 2806| | * "rootfs.path" to . 2807| | */ 2808| 1.26k| tmp = strchr(dup, ':'); 2809| 1.26k| if (tmp) { ------------------ | Branch (2809:6): [True: 1.05k, False: 210] ------------------ 2810| 1.05k| *tmp = '\0'; 2811| | 2812| 1.05k| ret = set_config_path_item(&lxc_conf->rootfs.__bdev_type, dup); 2813| 1.05k| if (ret < 0) ------------------ | Branch (2813:7): [True: 1, False: 1.05k] ------------------ 2814| 1| return ret_errno(ENOMEM); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2815| | 2816| 1.05k| tmp++; 2817| 1.05k| container_path = tmp; 2818| 1.05k| } else { 2819| 210| container_path = value; 2820| 210| } 2821| | 2822| 1.26k| return set_config_path_item(&lxc_conf->rootfs.path, container_path); 2823| 1.26k|} confile.c:set_config_seccomp_allow_nesting: 1195| 1|{ 1196| |#if HAVE_SECCOMP 1197| | if (lxc_config_value_empty(value)) 1198| | return clr_config_seccomp_allow_nesting(key, lxc_conf, NULL); 1199| | 1200| | if (lxc_safe_uint(value, &lxc_conf->seccomp.allow_nesting) < 0) 1201| | return -errno; 1202| | 1203| | if (lxc_conf->seccomp.allow_nesting > 1) 1204| | return ret_errno(EINVAL); 1205| | 1206| | return 0; 1207| |#else 1208| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1209| 1|#endif 1210| 1|} confile.c:set_config_seccomp_notify_cookie: 1214| 1|{ 1215| |#if HAVE_DECL_SECCOMP_NOTIFY_FD 1216| | return set_config_string_item(&lxc_conf->seccomp.notifier.cookie, value); 1217| |#else 1218| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1219| 1|#endif 1220| 1|} confile.c:set_config_seccomp_notify_proxy: 1224| 1|{ 1225| |#if HAVE_DECL_SECCOMP_NOTIFY_FD 1226| | const char *offset; 1227| | 1228| | if (lxc_config_value_empty(value)) 1229| | return clr_config_seccomp_notify_proxy(key, lxc_conf, NULL); 1230| | 1231| | if (!strnequal(value, "unix:", 5)) 1232| | return ret_errno(EINVAL); 1233| | 1234| | offset = value + 5; 1235| | if (lxc_unix_sockaddr(&lxc_conf->seccomp.notifier.proxy_addr, offset) < 0) 1236| | return -errno; 1237| | 1238| | return 0; 1239| |#else 1240| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1241| 1|#endif 1242| 1|} confile.c:set_config_seccomp_profile: 1246| 1|{ 1247| |#if HAVE_SECCOMP 1248| | return set_config_path_item(&lxc_conf->seccomp.seccomp, value); 1249| |#else 1250| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1251| 1|#endif 1252| 1|} confile.c:set_config_selinux_context_keyring: 1767| 1|{ 1768| |#if HAVE_SELINUX 1769| | return set_config_string_item(&lxc_conf->lsm_se_keyring_context, value); 1770| |#else 1771| | return syserror_set(-EINVAL, "Built without SELinux support"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1772| 1|#endif 1773| 1|} confile.c:set_config_selinux_context: 1757| 1|{ 1758| |#if HAVE_SELINUX 1759| | return set_config_string_item(&lxc_conf->lsm_se_context, value); 1760| |#else 1761| | return syserror_set(-EINVAL, "Built without SELinux support"); ------------------ | | 568| 1| ({ \ | | 569| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 1| errno = labs(__ret__); \ | | 571| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 572| 1| __internal_ret__; \ | | 573| 1| }) ------------------ 1762| 1|#endif 1763| 1|} confile.c:set_config_signal_halt: 1867| 465|{ 1868| 465| int sig_n; 1869| | 1870| 465| if (lxc_config_value_empty(value)) { ------------------ | Branch (1870:6): [True: 194, False: 271] ------------------ 1871| 194| lxc_conf->haltsignal = 0; 1872| 194| return 0; 1873| 194| } 1874| | 1875| 271| sig_n = sig_parse(value); 1876| 271| if (sig_n < 0) ------------------ | Branch (1876:6): [True: 43, False: 228] ------------------ 1877| 43| return ret_errno(EINVAL); ------------------ | | 715| 43| ({ \ | | 716| 43| errno = labs(__errno__); \ | | 717| 43| -errno; \ | | 718| 43| }) ------------------ 1878| | 1879| 228| lxc_conf->haltsignal = sig_n; 1880| | 1881| 228| return 0; 1882| 271|} confile.c:set_config_signal_reboot: 1886| 417|{ 1887| 417| int sig_n; 1888| | 1889| 417| if (lxc_config_value_empty(value)) { ------------------ | Branch (1889:6): [True: 194, False: 223] ------------------ 1890| 194| lxc_conf->rebootsignal = 0; 1891| 194| return 0; 1892| 194| } 1893| | 1894| 223| sig_n = sig_parse(value); 1895| 223| if (sig_n < 0) ------------------ | Branch (1895:6): [True: 22, False: 201] ------------------ 1896| 22| return ret_errno(EINVAL); ------------------ | | 715| 22| ({ \ | | 716| 22| errno = labs(__errno__); \ | | 717| 22| -errno; \ | | 718| 22| }) ------------------ 1897| | 1898| 201| lxc_conf->rebootsignal = sig_n; 1899| | 1900| 201| return 0; 1901| 223|} confile.c:set_config_signal_stop: 1905| 1.28k|{ 1906| 1.28k| int sig_n; 1907| | 1908| 1.28k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1908:6): [True: 225, False: 1.05k] ------------------ 1909| 225| lxc_conf->stopsignal = 0; 1910| 225| return 0; 1911| 225| } 1912| | 1913| 1.05k| sig_n = sig_parse(value); 1914| 1.05k| if (sig_n < 0) ------------------ | Branch (1914:6): [True: 274, False: 782] ------------------ 1915| 274| return ret_errno(EINVAL); ------------------ | | 715| 274| ({ \ | | 716| 274| errno = labs(__errno__); \ | | 717| 274| -errno; \ | | 718| 274| }) ------------------ 1916| | 1917| 782| lxc_conf->stopsignal = sig_n; 1918| | 1919| 782| return 0; 1920| 1.05k|} confile.c:set_config_start: 1467| 1.30k|{ 1468| 1.30k| int ret; 1469| 1.30k| bool is_empty; 1470| | 1471| 1.30k| is_empty = lxc_config_value_empty(value); 1472| | 1473| 1.30k| if (*(key + 10) == 'a') { /* lxc.start.auto */ ------------------ | Branch (1473:6): [True: 449, False: 852] ------------------ 1474| 449| if (is_empty) { ------------------ | Branch (1474:7): [True: 195, False: 254] ------------------ 1475| 195| lxc_conf->start_auto = 0; 1476| 195| return 0; 1477| 195| } 1478| | 1479| 254| ret = lxc_safe_uint(value, &lxc_conf->start_auto); 1480| 254| if (ret) ------------------ | Branch (1480:7): [True: 1, False: 253] ------------------ 1481| 1| return ret; 1482| | 1483| 253| if (lxc_conf->start_auto > 1) ------------------ | Branch (1483:7): [True: 58, False: 195] ------------------ 1484| 58| return ret_errno(EINVAL); ------------------ | | 715| 58| ({ \ | | 716| 58| errno = labs(__errno__); \ | | 717| 58| -errno; \ | | 718| 58| }) ------------------ 1485| | 1486| 195| return 0; 1487| 852| } else if (*(key + 10) == 'd') { /* lxc.start.delay */ ------------------ | Branch (1487:13): [True: 389, False: 463] ------------------ 1488| 389| if (is_empty) { ------------------ | Branch (1488:7): [True: 195, False: 194] ------------------ 1489| 195| lxc_conf->start_delay = 0; 1490| 195| return 0; 1491| 195| } 1492| | 1493| 194| return lxc_safe_uint(value, &lxc_conf->start_delay); 1494| 463| } else if (*(key + 10) == 'o') { /* lxc.start.order */ ------------------ | Branch (1494:13): [True: 463, False: 0] ------------------ 1495| 463| if (is_empty) { ------------------ | Branch (1495:7): [True: 194, False: 269] ------------------ 1496| 194| lxc_conf->start_order = 0; 1497| 194| return 0; 1498| 194| } 1499| | 1500| 269| return lxc_safe_int(value, &lxc_conf->start_order); 1501| 463| } 1502| | 1503| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1504| 1.30k|} confile.c:set_config_tty_dir: 1660| 222|{ 1661| 222| return set_config_string_item_max(&lxc_conf->ttys.dir, value, 1662| | NAME_MAX + 1); 1663| 222|} confile.c:set_config_tty_max: 1640| 401|{ 1641| 401| int ret; 1642| 401| unsigned int nbtty = 0; 1643| | 1644| 401| if (lxc_config_value_empty(value)) { ------------------ | Branch (1644:6): [True: 194, False: 207] ------------------ 1645| 194| lxc_conf->ttys.max = 0; 1646| 194| return 0; 1647| 194| } 1648| | 1649| 207| ret = lxc_safe_uint(value, &nbtty); 1650| 207| if (ret < 0) ------------------ | Branch (1650:6): [True: 13, False: 194] ------------------ 1651| 13| return ret; 1652| | 1653| 194| lxc_conf->ttys.max = nbtty; 1654| | 1655| 194| return 0; 1656| 207|} confile.c:set_config_uts_name: 2876| 807|{ 2877| 807| __do_free struct utsname *utsname = NULL; ------------------ | | 69| 807|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 807| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2878| | 2879| 807| if (lxc_config_value_empty(value)) { ------------------ | Branch (2879:6): [True: 395, False: 412] ------------------ 2880| 395| clr_config_uts_name(key, lxc_conf, NULL); 2881| 395| return 0; 2882| 395| } 2883| | 2884| 412| utsname = zalloc(sizeof(*utsname)); ------------------ | | 90| 412|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2885| 412| if (!utsname) ------------------ | Branch (2885:6): [True: 0, False: 412] ------------------ 2886| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2887| | 2888| 412| if (strlen(value) >= sizeof(utsname->nodename)) ------------------ | Branch (2888:6): [True: 7, False: 405] ------------------ 2889| 7| return ret_errno(EINVAL); ------------------ | | 715| 7| ({ \ | | 716| 7| errno = labs(__errno__); \ | | 717| 7| -errno; \ | | 718| 7| }) ------------------ 2890| | 2891| 405| (void)strlcpy(utsname->nodename, value, sizeof(utsname->nodename)); 2892| 405| free(lxc_conf->utsname); 2893| 405| lxc_conf->utsname = move_ptr(utsname); ------------------ | | 694| 405| ({ \ | | 695| 405| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 405| (ptr) = NULL; \ | | 697| 405| __internal_ptr__; \ | | 698| 405| }) ------------------ 2894| | 2895| 405| return 0; 2896| 412|} confile.c:clr_config_uts_name: 5035| 395|{ 5036| | free_disarm(c->utsname); ------------------ | | 58| 395| ({ \ | | 59| 395| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 195, False: 200] | | ------------------ | | 60| 195| free(ptr); \ | | 61| 195| ptr = NULL; \ | | 62| 195| } \ | | 63| 395| }) ------------------ 5037| 395| return 0; 5038| 395|} confile.c:set_config_sysctl: 2178| 2.37k|{ 2179| 2.37k| call_cleaner(free_lxc_sysctl) struct lxc_sysctl *sysctl_elem = NULL; ------------------ | | 26| 2.37k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 2180| 2.37k| struct lxc_sysctl *sysctl, *nsysctl; 2181| | 2182| 2.37k| if (lxc_config_value_empty(value)) ------------------ | Branch (2182:6): [True: 1.25k, False: 1.12k] ------------------ 2183| 1.25k| return clr_config_sysctl(key, lxc_conf, NULL); 2184| | 2185| 1.12k| if (!strnequal(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl."))) ------------------ | | 687| 1.12k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2185:6): [True: 9, False: 1.11k] ------------------ 2186| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 2187| | 2188| 1.11k| key += STRLITERALLEN("lxc.sysctl."); ------------------ | | 687| 1.11k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2189| 1.11k| if (is_empty_string(key)) ------------------ | Branch (2189:6): [True: 2, False: 1.10k] ------------------ 2190| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 2191| | 2192| | /* find existing list element */ 2193| 1.91k| list_for_each_entry_safe(sysctl, nsysctl, &lxc_conf->sysctls, head) { ------------------ | | 655| 1.10k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 1.10k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 1.10k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.10k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.10k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.10k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.10k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.10k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.10k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.10k| do { \ | | | | | | | | | | | | | | | | 286| 1.10k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.10k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.10k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.10k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.10k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 1.11k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 1.11k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.11k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.11k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.11k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.11k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.10k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.10k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.10k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.10k| do { \ | | | | | | | | | | | | | | | | 286| 1.10k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.10k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.11k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.11k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.11k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 2.78k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 2.78k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.91k, False: 878] | | ------------------ | | 658| 1.68k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.68k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.68k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.68k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.68k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.68k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.68k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.68k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.68k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.68k| do { \ | | | | | | | | | | | | | | | | 286| 1.68k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.68k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.68k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.68k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.68k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 2194| 1.91k| __do_free char *replace_value = NULL; ------------------ | | 69| 1.91k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.91k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2195| | 2196| 1.91k| if (!strequal(key, sysctl->key)) ------------------ | Branch (2196:7): [True: 1.68k, False: 231] ------------------ 2197| 1.68k| continue; 2198| | 2199| 231| replace_value = strdup(value); 2200| 231| if (!replace_value) ------------------ | Branch (2200:7): [True: 0, False: 231] ------------------ 2201| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2202| | 2203| 231| free(sysctl->value); 2204| 231| sysctl->value = move_ptr(replace_value); ------------------ | | 694| 231| ({ \ | | 695| 231| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 231| (ptr) = NULL; \ | | 697| 231| __internal_ptr__; \ | | 698| 231| }) ------------------ 2205| | 2206| 231| return 0; 2207| 231| } 2208| | 2209| 878| sysctl_elem = zalloc(sizeof(*sysctl_elem)); ------------------ | | 90| 878|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2210| 878| if (!sysctl_elem) ------------------ | Branch (2210:6): [True: 0, False: 878] ------------------ 2211| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2212| | 2213| 878| sysctl_elem->key = strdup(key); 2214| 878| if (!sysctl_elem->key) ------------------ | Branch (2214:6): [True: 0, False: 878] ------------------ 2215| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2216| | 2217| 878| sysctl_elem->value = strdup(value); 2218| 878| if (!sysctl_elem->value) ------------------ | Branch (2218:6): [True: 0, False: 878] ------------------ 2219| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2220| | 2221| 878| list_add_tail(&sysctl_elem->head, &lxc_conf->sysctls); 2222| 878| move_ptr(sysctl_elem); ------------------ | | 694| 878| ({ \ | | 695| 878| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 878| (ptr) = NULL; \ | | 697| 878| __internal_ptr__; \ | | 698| 878| }) ------------------ 2223| | 2224| 878| return 0; 2225| 878|} confile.c:clr_config_sysctl: 5308| 1.25k|{ 5309| 1.25k| return lxc_clear_sysctls(c, key); 5310| 1.25k|} confile.c:set_config_proc: 2229| 1.73k|{ 2230| 1.73k| call_cleaner(free_lxc_proc) struct lxc_proc *new_proc = NULL; ------------------ | | 26| 1.73k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 2231| 1.73k| const char *subkey; 2232| | 2233| 1.73k| if (lxc_config_value_empty(value)) ------------------ | Branch (2233:6): [True: 990, False: 746] ------------------ 2234| 990| return clr_config_proc(key, lxc_conf, NULL); 2235| | 2236| 746| if (!strnequal(key, "lxc.proc.", STRLITERALLEN("lxc.proc."))) ------------------ | | 687| 746|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2236:6): [True: 10, False: 736] ------------------ 2237| 10| return ret_errno(EINVAL); ------------------ | | 715| 10| ({ \ | | 716| 10| errno = labs(__errno__); \ | | 717| 10| -errno; \ | | 718| 10| }) ------------------ 2238| | 2239| 736| subkey = key + STRLITERALLEN("lxc.proc."); ------------------ | | 687| 736|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2240| 736| if (*subkey == '\0') ------------------ | Branch (2240:6): [True: 1, False: 735] ------------------ 2241| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2242| | 2243| 735| new_proc = zalloc(sizeof(*new_proc)); ------------------ | | 90| 735|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2244| 735| if (!new_proc) ------------------ | Branch (2244:6): [True: 0, False: 735] ------------------ 2245| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2246| | 2247| 735| new_proc->filename = strdup(subkey); 2248| 735| if (!new_proc->filename) ------------------ | Branch (2248:6): [True: 0, False: 735] ------------------ 2249| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2250| | 2251| 735| new_proc->value = strdup(value); 2252| 735| if (!new_proc->value) ------------------ | Branch (2252:6): [True: 0, False: 735] ------------------ 2253| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2254| | 2255| 735| list_add_tail(&new_proc->head, &lxc_conf->procs); 2256| 735| move_ptr(new_proc); ------------------ | | 694| 735| ({ \ | | 695| 735| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 735| (ptr) = NULL; \ | | 697| 735| __internal_ptr__; \ | | 698| 735| }) ------------------ 2257| | 2258| 735| return 0; 2259| 735|} confile.c:clr_config_proc: 5314| 990|{ 5315| 990| return lxc_clear_procs(c, key); 5316| 990|} confile.c:match_config_item: 346| 5.27M|{ 347| 5.27M| size_t len; 348| | 349| 5.27M| if (entry->strict) ------------------ | Branch (349:6): [True: 5.04M, False: 233k] ------------------ 350| 5.04M| return strequal(entry->name, key); 351| | 352| | /* There should be no subkey longer than this. */ 353| 233k| len = strnlen(entry->name, LXC_SUBKEY_LEN_MAX); ------------------ | | 343| 233k|#define LXC_SUBKEY_LEN_MAX 256 ------------------ 354| 233k| if (len == LXC_SUBKEY_LEN_MAX) ------------------ | | 343| 233k|#define LXC_SUBKEY_LEN_MAX 256 ------------------ | Branch (354:6): [True: 0, False: 233k] ------------------ 355| 0| return error_ret(-E2BIG, "Excessive subkey length"); ------------------ | | 583| 0| ({ \ | | 584| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 585| 0| ERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 586| 0| __internal_ret__; \ | | 587| 0| }) ------------------ 356| | 357| 233k| return strnequal(entry->name, key, len); 358| 233k|} confile.c:set_config_unsupported_key: 164| 389|{ 165| | return syserror_set(-EINVAL, "Unsupported config key \"%s\"", key); ------------------ | | 568| 389| ({ \ | | 569| 389| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 389| errno = labs(__ret__); \ | | 571| 389| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 389| do { \ | | | | 454| 389| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 389| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 389| char *ptr = NULL; \ | | | | | | 317| 389| { \ | | | | | | 318| 389| int __saved_errno = errno; \ | | | | | | 319| 389| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 389| errno = __saved_errno; \ | | | | | | 321| 389| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 389] | | | | | | ------------------ | | | | | | 322| 389| ptr = errno_buf; \ | | | | | | 323| 389| } | | | | ------------------ | | | | 455| 389| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 389|#define ERROR(format, ...) do { \ | | | | | | 373| 389| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 389| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 389| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 389|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 389] | | | | | | ------------------ | | | | ------------------ | | | | 456| 389| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 389] | | | | ------------------ | | ------------------ | | 572| 389| __internal_ret__; \ | | 573| 389| }) ------------------ 166| 389|} confile.c:set_config_mount: 2428| 1.21k|{ 2429| 1.21k| __do_free char *mntelem = NULL; ------------------ | | 69| 1.21k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.21k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2430| 1.21k| __do_free struct string_entry *entry = NULL; ------------------ | | 69| 1.21k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.21k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2431| | 2432| 1.21k| if (lxc_config_value_empty(value)) ------------------ | Branch (2432:6): [True: 403, False: 811] ------------------ 2433| 403| return lxc_clear_mount_entries(lxc_conf); 2434| | 2435| 811| entry = zalloc(sizeof(struct string_entry)); ------------------ | | 90| 811|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2436| 811| if (!entry) ------------------ | Branch (2436:6): [True: 0, False: 811] ------------------ 2437| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2438| | 2439| 811| mntelem = strdup(value); 2440| 811| if (!mntelem) ------------------ | Branch (2440:6): [True: 0, False: 811] ------------------ 2441| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2442| | 2443| 811| entry->val = move_ptr(mntelem); ------------------ | | 694| 811| ({ \ | | 695| 811| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 811| (ptr) = NULL; \ | | 697| 811| __internal_ptr__; \ | | 698| 811| }) ------------------ 2444| 811| list_add_tail(&entry->head, &lxc_conf->mount_entries); 2445| 811| move_ptr(entry); ------------------ | | 694| 811| ({ \ | | 695| 811| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 811| (ptr) = NULL; \ | | 697| 811| __internal_ptr__; \ | | 698| 811| }) ------------------ 2446| | 2447| 811| return 0; 2448| 811|} confile.c:update_hwaddr: 2679| 122k|{ 2680| 122k| char *p; 2681| | 2682| 122k| line += lxc_char_left_gc(line, strlen(line)); 2683| 122k| if (line[0] == '#') ------------------ | Branch (2683:6): [True: 394, False: 122k] ------------------ 2684| 394| return; 2685| | 2686| 122k| if (!lxc_config_net_is_hwaddr(line)) ------------------ | Branch (2686:6): [True: 120k, False: 1.42k] ------------------ 2687| 120k| return; 2688| | 2689| | /* Let config_net_hwaddr raise the error. */ 2690| 1.42k| p = strchr(line, '='); 2691| 1.42k| if (!p) ------------------ | Branch (2691:6): [True: 3, False: 1.42k] ------------------ 2692| 3| return; 2693| 1.42k| p++; 2694| | 2695| 1.42k| while (isblank(*p)) ------------------ | Branch (2695:9): [True: 196, False: 1.42k] ------------------ 2696| 196| p++; 2697| | 2698| 1.42k| if (!*p) ------------------ | Branch (2698:6): [True: 419, False: 1.00k] ------------------ 2699| 419| return; 2700| | 2701| 1.00k| rand_complete_hwaddr(p); 2702| 1.00k|} confile.c:parse_line: 3060| 612k|{ 3061| 612k| __do_free char *linep = NULL; ------------------ | | 69| 612k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 612k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 3062| 612k| char *dot, *key, *line, *value; 3063| 612k| bool empty_line; 3064| 612k| struct lxc_config_t *config; 3065| 612k| int ret; 3066| 612k| char *dup = buffer; 3067| 612k| struct parse_line_conf *plc = data; 3068| | 3069| 612k| if (!plc->conf) ------------------ | Branch (3069:6): [True: 0, False: 612k] ------------------ 3070| 0| return syserror_set(-EINVAL, "Missing config"); ------------------ | | 568| 0| ({ \ | | 569| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 0| errno = labs(__ret__); \ | | 571| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 572| 0| __internal_ret__; \ | | 573| 0| }) ------------------ 3071| | 3072| | /* If there are newlines in the config file we should keep them. */ 3073| 612k| empty_line = lxc_is_line_empty(dup); 3074| 612k| if (empty_line) ------------------ | Branch (3074:6): [True: 248, False: 612k] ------------------ 3075| 248| dup = "\n"; 3076| | 3077| | /* We have to dup the buffer otherwise, at the re-exec for reboot we 3078| | * modified the original string on the stack by replacing '=' by '\0' 3079| | * below. 3080| | */ 3081| 612k| linep = line = strdup(dup); 3082| 612k| if (!line) ------------------ | Branch (3082:6): [True: 0, False: 612k] ------------------ 3083| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 3084| | 3085| 612k| if (!plc->from_include) { ------------------ | Branch (3085:6): [True: 122k, False: 489k] ------------------ 3086| 122k| ret = append_unexp_config_line(line, plc->conf); 3087| 122k| if (ret < 0) ------------------ | Branch (3087:7): [True: 0, False: 122k] ------------------ 3088| 0| return ret; 3089| 122k| } 3090| | 3091| 612k| if (empty_line) ------------------ | Branch (3091:6): [True: 248, False: 612k] ------------------ 3092| 248| return 0; 3093| | 3094| 612k| line += lxc_char_left_gc(line, strlen(line)); 3095| | 3096| | /* ignore comments */ 3097| 612k| if (line[0] == '#') ------------------ | Branch (3097:6): [True: 255k, False: 356k] ------------------ 3098| 255k| return 0; 3099| | 3100| | /* martian option - don't add it to the config itself */ 3101| 356k| if (!strnequal(line, "lxc.", 4)) ------------------ | Branch (3101:6): [True: 254k, False: 102k] ------------------ 3102| 254k| return 0; 3103| | 3104| 102k| dot = strchr(line, '='); 3105| 102k| if (!dot) ------------------ | Branch (3105:6): [True: 407, False: 101k] ------------------ 3106| 407| return log_error_errno(-EINVAL, EINVAL, "Invalid configuration line: %s", line); ------------------ | | 486| 407| ({ \ | | 487| 407| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 407| errno = (__errno__); \ | | 489| 407| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 407| do { \ | | | | 454| 407| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 407| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 407| char *ptr = NULL; \ | | | | | | 317| 407| { \ | | | | | | 318| 407| int __saved_errno = errno; \ | | | | | | 319| 407| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 407| errno = __saved_errno; \ | | | | | | 321| 407| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 407] | | | | | | ------------------ | | | | | | 322| 407| ptr = errno_buf; \ | | | | | | 323| 407| } | | | | ------------------ | | | | 455| 407| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 407|#define ERROR(format, ...) do { \ | | | | | | 373| 407| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 407| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 407| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 407|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 407] | | | | | | ------------------ | | | | ------------------ | | | | 456| 407| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 407] | | | | ------------------ | | ------------------ | | 490| 407| __internal_ret__; \ | | 491| 407| }) ------------------ 3107| | 3108| 101k| *dot = '\0'; 3109| 101k| value = dot + 1; 3110| | 3111| 101k| key = line; 3112| 101k| key[lxc_char_right_gc(key, strlen(key))] = '\0'; 3113| | 3114| 101k| value += lxc_char_left_gc(value, strlen(value)); 3115| 101k| value[lxc_char_right_gc(value, strlen(value))] = '\0'; 3116| | 3117| 101k| if (*value == '\'' || *value == '\"') { ------------------ | Branch (3117:6): [True: 2.63k, False: 99.1k] | Branch (3117:24): [True: 558, False: 98.6k] ------------------ 3118| 3.19k| size_t len; 3119| | 3120| 3.19k| len = strlen(value); 3121| 3.19k| if (len > 1 && value[len - 1] == *value) { ------------------ | Branch (3121:7): [True: 2.77k, False: 423] | Branch (3121:18): [True: 2.50k, False: 269] ------------------ 3122| 2.50k| value[len - 1] = '\0'; 3123| 2.50k| value++; 3124| 2.50k| } 3125| 3.19k| } 3126| | 3127| 101k| config = lxc_get_config(key); 3128| | return config->set(key, value, plc->conf, NULL); 3129| 102k|} confile.c:get_network_config_ops: 5387| 32.6k|{ 5388| 32.6k| int ret; 5389| 32.6k| int64_t tmpidx; 5390| 32.6k| unsigned int idx; 5391| 32.6k| const char *idx_start; 5392| | 5393| 32.6k| if (is_empty_string(key)) ------------------ | Branch (5393:6): [True: 0, False: 32.6k] ------------------ 5394| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5395| | 5396| | /* check that this is a sensible network key */ 5397| 32.6k| if (!strnequal("lxc.net.", key, STRLITERALLEN("lxc.net."))) ------------------ | | 687| 32.6k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (5397:6): [True: 0, False: 32.6k] ------------------ 5398| 0| return syserror_set(-EINVAL, "Invalid network configuration key \"%s\"", key); ------------------ | | 568| 0| ({ \ | | 569| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 0| errno = labs(__ret__); \ | | 571| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 572| 0| __internal_ret__; \ | | 573| 0| }) ------------------ 5399| | 5400| | /* lxc.net. */ 5401| | /* beginning of index string */ 5402| 32.6k| idx_start = key + STRLITERALLEN("lxc.net."); ------------------ | | 687| 32.6k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 5403| 32.6k| if (!isdigit(*idx_start)) ------------------ | Branch (5403:6): [True: 0, False: 32.6k] ------------------ 5404| 0| return syserror_set(-EINVAL, "Failed to detect digit in string \"%s\"", key + 8); ------------------ | | 568| 0| ({ \ | | 569| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 0| errno = labs(__ret__); \ | | 571| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 572| 0| __internal_ret__; \ | | 573| 0| }) ------------------ 5405| | 5406| 32.6k| ret = lxc_safe_int64_residual(idx_start, &tmpidx, 10, info->buf, sizeof(info->buf)); 5407| 32.6k| if (ret) ------------------ | Branch (5407:6): [True: 14, False: 32.6k] ------------------ 5408| 14| return syserror("Failed to parse network index"); ------------------ | | 562| 14| ({ \ | | 563| 14| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 14| do { \ | | | | 454| 14| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 14| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 14| char *ptr = NULL; \ | | | | | | 317| 14| { \ | | | | | | 318| 14| int __saved_errno = errno; \ | | | | | | 319| 14| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 14| errno = __saved_errno; \ | | | | | | 321| 14| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 14] | | | | | | ------------------ | | | | | | 322| 14| ptr = errno_buf; \ | | | | | | 323| 14| } | | | | ------------------ | | | | 455| 14| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 14|#define ERROR(format, ...) do { \ | | | | | | 373| 14| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 14| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 14| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 14|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 14] | | | | | | ------------------ | | | | ------------------ | | | | 456| 14| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 14] | | | | ------------------ | | ------------------ | | 564| 14| (-labs(errno)); \ | | 565| 14| }) ------------------ 5409| | 5410| 32.6k| if (tmpidx < 0 || tmpidx >= INT_MAX) ------------------ | Branch (5410:6): [True: 0, False: 32.6k] | Branch (5410:20): [True: 63, False: 32.5k] ------------------ 5411| 63| return syserror_set(-ERANGE, "Number of configured networks would overflow the counter"); ------------------ | | 568| 63| ({ \ | | 569| 63| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 63| errno = labs(__ret__); \ | | 571| 63| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 63| do { \ | | | | 454| 63| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 63| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 63| char *ptr = NULL; \ | | | | | | 317| 63| { \ | | | | | | 318| 63| int __saved_errno = errno; \ | | | | | | 319| 63| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 63| errno = __saved_errno; \ | | | | | | 321| 63| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 63] | | | | | | ------------------ | | | | | | 322| 63| ptr = errno_buf; \ | | | | | | 323| 63| } | | | | ------------------ | | | | 455| 63| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 63|#define ERROR(format, ...) do { \ | | | | | | 373| 63| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 63| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 63| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 63|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 63] | | | | | | ------------------ | | | | ------------------ | | | | 456| 63| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 63] | | | | ------------------ | | ------------------ | | 572| 63| __internal_ret__; \ | | 573| 63| }) ------------------ 5412| 32.5k| idx = (unsigned int)tmpidx; 5413| | 5414| 32.5k| info->netdev = lxc_get_netdev_by_idx(lxc_conf, idx, allocate); 5415| 32.5k| if (!info->netdev) ------------------ | Branch (5415:6): [True: 13, False: 32.5k] ------------------ 5416| 13| return ret_errno(EINVAL); ------------------ | | 715| 13| ({ \ | | 716| 13| errno = labs(__errno__); \ | | 717| 13| -errno; \ | | 718| 13| }) ------------------ 5417| | 5418| | /* Make sure subkey points to the empty string. */ 5419| 32.5k| info->subkey = info->buf; 5420| 32.5k| if (is_empty_string(info->subkey)) ------------------ | Branch (5420:6): [True: 121, False: 32.4k] ------------------ 5421| 121| return ret_errno(ENOENT); ------------------ | | 715| 121| ({ \ | | 716| 121| errno = labs(__errno__); \ | | 717| 121| -errno; \ | | 718| 121| }) ------------------ 5422| | 5423| 32.4k| if (info->subkey[0] != '.') ------------------ | Branch (5423:6): [True: 19, False: 32.3k] ------------------ 5424| 19| return syserror_set(-EINVAL, "Invalid subkey"); ------------------ | | 568| 19| ({ \ | | 569| 19| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 19| errno = labs(__ret__); \ | | 571| 19| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 19| do { \ | | | | 454| 19| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 19| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 19| char *ptr = NULL; \ | | | | | | 317| 19| { \ | | | | | | 318| 19| int __saved_errno = errno; \ | | | | | | 319| 19| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 19| errno = __saved_errno; \ | | | | | | 321| 19| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 19] | | | | | | ------------------ | | | | | | 322| 19| ptr = errno_buf; \ | | | | | | 323| 19| } | | | | ------------------ | | | | 455| 19| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 19|#define ERROR(format, ...) do { \ | | | | | | 373| 19| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 19| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 19| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 19|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 19] | | | | | | ------------------ | | | | ------------------ | | | | 456| 19| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 19] | | | | ------------------ | | ------------------ | | 572| 19| __internal_ret__; \ | | 573| 19| }) ------------------ 5425| 32.3k| info->subkey++; 5426| | 5427| | /* lxc.net.. */ 5428| 32.3k| info->ops = lxc_get_config_net(info->subkey); 5429| 32.3k| if (info->ops == &unsupported_config_net_key) ------------------ | Branch (5429:6): [True: 163, False: 32.2k] ------------------ 5430| 163| return syserror_set(-ENOENT, "Unknown network configuration key \"%s\"", key); ------------------ | | 568| 163| ({ \ | | 569| 163| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 163| errno = labs(__ret__); \ | | 571| 163| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 163| do { \ | | | | 454| 163| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 163| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 163| char *ptr = NULL; \ | | | | | | 317| 163| { \ | | | | | | 318| 163| int __saved_errno = errno; \ | | | | | | 319| 163| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 163| errno = __saved_errno; \ | | | | | | 321| 163| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 163] | | | | | | ------------------ | | | | | | 322| 163| ptr = errno_buf; \ | | | | | | 323| 163| } | | | | ------------------ | | | | 455| 163| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 163|#define ERROR(format, ...) do { \ | | | | | | 373| 163| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 163| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 163| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 163|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 163] | | | | | | ------------------ | | | | ------------------ | | | | 456| 163| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 163] | | | | ------------------ | | ------------------ | | 572| 163| __internal_ret__; \ | | 573| 163| }) ------------------ 5431| | 5432| 32.2k| return 0; 5433| 32.3k|} confile.c:lxc_get_config_net: 387| 32.3k|{ 388| 412k| for (size_t i = 0; i < ARRAY_SIZE(config_jump_table_net); i++) { ------------------ | | 728| 412k| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 412k| typeof(&*(x))), \ | | 730| 412k| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (388:21): [True: 411k, False: 163] ------------------ 389| 411k| struct lxc_config_net_t *cur = &config_jump_table_net[i]; 390| | 391| 411k| if (!match_config_net_item(cur, key)) ------------------ | Branch (391:7): [True: 379k, False: 32.2k] ------------------ 392| 379k| continue; 393| | 394| 32.2k| return cur; 395| 411k| } 396| | 397| 163| return &unsupported_config_net_key; 398| 32.3k|} confile.c:set_config_net_flags: 457| 205|{ 458| 205| struct lxc_netdev *netdev = data; 459| | 460| 205| if (!netdev) ------------------ | Branch (460:6): [True: 0, False: 205] ------------------ 461| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 462| | 463| 205| if (lxc_config_value_empty(value)) ------------------ | Branch (463:6): [True: 0, False: 205] ------------------ 464| 0| return clr_config_net_flags(key, lxc_conf, data); 465| | 466| 205| netdev->flags |= IFF_UP; 467| | 468| 205| return 0; 469| 205|} confile.c:clr_config_net_flags: 5523| 194|{ 5524| 194| struct lxc_netdev *netdev = data; 5525| | 5526| 194| if (!netdev) ------------------ | Branch (5526:6): [True: 0, False: 194] ------------------ 5527| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5528| | 5529| 194| netdev->flags = 0; 5530| | 5531| 194| return 0; 5532| 194|} confile.c:set_config_net_hwaddr: 787| 940|{ 788| 940| __do_free char *new_value = NULL; ------------------ | | 69| 940|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 940| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 789| 940| struct lxc_netdev *netdev = data; 790| | 791| 940| if (!netdev) ------------------ | Branch (791:6): [True: 0, False: 940] ------------------ 792| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 793| | 794| 940| clr_config_net_hwaddr(key, lxc_conf, data); 795| 940| if (lxc_config_value_empty(value)) ------------------ | Branch (795:6): [True: 0, False: 940] ------------------ 796| 0| return 0; 797| | 798| 940| new_value = strdup(value); 799| 940| if (!new_value) ------------------ | Branch (799:6): [True: 0, False: 940] ------------------ 800| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 801| | 802| 940| rand_complete_hwaddr(new_value); 803| 940| if (!lxc_config_value_empty(new_value)) ------------------ | Branch (803:6): [True: 940, False: 0] ------------------ 804| 940| netdev->hwaddr = move_ptr(new_value); ------------------ | | 694| 940| ({ \ | | 695| 940| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 940| (ptr) = NULL; \ | | 697| 940| __internal_ptr__; \ | | 698| 940| }) ------------------ 805| | 806| 940| return 0; 807| 940|} confile.c:clr_config_net_hwaddr: 5739| 1.34k|{ 5740| 1.34k| struct lxc_netdev *netdev = data; 5741| | 5742| 1.34k| if (!netdev) ------------------ | Branch (5742:6): [True: 0, False: 1.34k] ------------------ 5743| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5744| | 5745| 1.34k| free_disarm(netdev->hwaddr); ------------------ | | 58| 1.34k| ({ \ | | 59| 1.34k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 684, False: 665] | | ------------------ | | 60| 684| free(ptr); \ | | 61| 684| ptr = NULL; \ | | 62| 684| } \ | | 63| 1.34k| }) ------------------ 5746| | 5747| 1.34k| return 0; 5748| 1.34k|} confile.c:set_config_net_ipv4_address: 848| 2.12k|{ 849| 2.12k| __do_free char *addr = NULL; ------------------ | | 69| 2.12k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.12k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 850| 2.12k| __do_free struct lxc_inetdev *inetdev = NULL; ------------------ | | 69| 2.12k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.12k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 851| 2.12k| int ret; 852| 2.12k| struct lxc_netdev *netdev = data; 853| 2.12k| char *cursor, *slash; 854| 2.12k| char *bcast = NULL, *prefix = NULL; 855| | 856| 2.12k| if (!netdev) ------------------ | Branch (856:6): [True: 0, False: 2.12k] ------------------ 857| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 858| | 859| 2.12k| if (lxc_config_value_empty(value)) ------------------ | Branch (859:6): [True: 0, False: 2.12k] ------------------ 860| 0| return clr_config_net_ipv4_address(key, lxc_conf, data); 861| | 862| 2.12k| inetdev = zalloc(sizeof(*inetdev)); ------------------ | | 90| 2.12k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 863| 2.12k| if (!inetdev) ------------------ | Branch (863:6): [True: 0, False: 2.12k] ------------------ 864| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 865| | 866| 2.12k| addr = strdup(value); 867| 2.12k| if (!addr) ------------------ | Branch (867:6): [True: 0, False: 2.12k] ------------------ 868| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 869| | 870| 2.12k| cursor = strstr(addr, " "); 871| 2.12k| if (cursor) { ------------------ | Branch (871:6): [True: 205, False: 1.91k] ------------------ 872| 205| *cursor = '\0'; 873| 205| bcast = cursor + 1; 874| 205| } 875| | 876| 2.12k| slash = strstr(addr, "/"); 877| 2.12k| if (slash) { ------------------ | Branch (877:6): [True: 256, False: 1.86k] ------------------ 878| 256| *slash = '\0'; 879| 256| prefix = slash + 1; 880| 256| } 881| | 882| 2.12k| ret = inet_pton(AF_INET, addr, &inetdev->addr); 883| 2.12k| if (!ret || ret < 0) ------------------ | Branch (883:6): [True: 10, False: 2.11k] | Branch (883:14): [True: 0, False: 2.11k] ------------------ 884| 10| return log_error_errno(-1, errno, "Invalid ipv4 address \"%s\"", value); ------------------ | | 486| 10| ({ \ | | 487| 10| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 10| errno = (__errno__); \ | | 489| 10| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 10| do { \ | | | | 454| 10| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 10| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 10| char *ptr = NULL; \ | | | | | | 317| 10| { \ | | | | | | 318| 10| int __saved_errno = errno; \ | | | | | | 319| 10| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 10| errno = __saved_errno; \ | | | | | | 321| 10| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 10] | | | | | | ------------------ | | | | | | 322| 10| ptr = errno_buf; \ | | | | | | 323| 10| } | | | | ------------------ | | | | 455| 10| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 10|#define ERROR(format, ...) do { \ | | | | | | 373| 10| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 10| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 10| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 10|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 10] | | | | | | ------------------ | | | | ------------------ | | | | 456| 10| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 10] | | | | ------------------ | | ------------------ | | 490| 10| __internal_ret__; \ | | 491| 10| }) ------------------ 885| | 886| 2.11k| if (bcast) { ------------------ | Branch (886:6): [True: 201, False: 1.91k] ------------------ 887| 201| ret = inet_pton(AF_INET, bcast, &inetdev->bcast); 888| 201| if (!ret || ret < 0) ------------------ | Branch (888:7): [True: 1, False: 200] | Branch (888:15): [True: 0, False: 200] ------------------ 889| 1| return log_error_errno(-1, errno, "Invalid ipv4 broadcast address \"%s\"", value); ------------------ | | 486| 1| ({ \ | | 487| 1| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 1| errno = (__errno__); \ | | 489| 1| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1| do { \ | | | | 454| 1| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1| char *ptr = NULL; \ | | | | | | 317| 1| { \ | | | | | | 318| 1| int __saved_errno = errno; \ | | | | | | 319| 1| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1| errno = __saved_errno; \ | | | | | | 321| 1| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1] | | | | | | ------------------ | | | | | | 322| 1| ptr = errno_buf; \ | | | | | | 323| 1| } | | | | ------------------ | | | | 455| 1| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1|#define ERROR(format, ...) do { \ | | | | | | 373| 1| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1] | | | | ------------------ | | ------------------ | | 490| 1| __internal_ret__; \ | | 491| 1| }) ------------------ 890| | 891| 201| } 892| | 893| | /* No prefix specified, determine it from the network class. */ 894| 2.11k| ret = 0; 895| 2.11k| if (prefix) ------------------ | Branch (895:6): [True: 254, False: 1.85k] ------------------ 896| 254| ret = lxc_safe_uint(prefix, &inetdev->prefix); 897| 1.85k| else 898| 1.85k| inetdev->prefix = config_ip_prefix(&inetdev->addr); 899| 2.11k| if (ret || inetdev->prefix > 32) ------------------ | Branch (899:6): [True: 4, False: 2.10k] | Branch (899:13): [True: 45, False: 2.06k] ------------------ 900| 49| return ret_errno(EINVAL); ------------------ | | 715| 49| ({ \ | | 716| 49| errno = labs(__errno__); \ | | 717| 49| -errno; \ | | 718| 49| }) ------------------ 901| | 902| | /* If no broadcast address, compute one from the prefix and address. */ 903| 2.06k| if (!bcast) { ------------------ | Branch (903:6): [True: 1.86k, False: 200] ------------------ 904| | /* 0<=inetdev->prefix<=32 */ 905| 1.86k| switch (inetdev->prefix) { 906| 2| case 32: /* single IPv4 network */ ------------------ | Branch (906:3): [True: 2, False: 1.86k] ------------------ 907| 2| ; /* fall thru */ 908| 196| case 31: /* RFC 3021 point to point network */ ------------------ | Branch (908:3): [True: 194, False: 1.67k] ------------------ 909| 196| inetdev->bcast.s_addr = INADDR_ANY; 910| 196| break; 911| | 912| 1.66k| default: ------------------ | Branch (912:3): [True: 1.66k, False: 196] ------------------ 913| 1.66k| inetdev->bcast.s_addr = inetdev->addr.s_addr | htonl(INADDR_BROADCAST >> inetdev->prefix); 914| 1.66k| break; 915| 1.86k| } 916| 1.86k| } 917| | 918| 2.06k| list_add_tail(&inetdev->head, &netdev->ipv4_addresses); 919| 2.06k| move_ptr(inetdev); ------------------ | | 694| 2.06k| ({ \ | | 695| 2.06k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.06k| (ptr) = NULL; \ | | 697| 2.06k| __internal_ptr__; \ | | 698| 2.06k| }) ------------------ 920| | 921| 2.06k| return 0; 922| 2.06k|} confile.c:clr_config_net_ipv4_address: 5794| 619|{ 5795| 619| struct lxc_netdev *netdev = data; 5796| 619| struct lxc_inetdev *inetdev, *ninetdev; 5797| | 5798| 619| if (!netdev) ------------------ | Branch (5798:6): [True: 0, False: 619] ------------------ 5799| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5800| | 5801| 619| list_for_each_entry_safe(inetdev, ninetdev, &netdev->ipv4_addresses, head) { ------------------ | | 655| 619| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 619| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 619| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 619|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 619| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 619| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 619|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 619| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 619| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 619| do { \ | | | | | | | | | | | | | | | | 286| 619| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 619] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 619| !__same_type(*(ptr), void), \ | | | | | | | | 813| 619| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 619| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 619| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 619| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 619| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 619|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 619| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 619| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 619|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 619| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 619| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 619| do { \ | | | | | | | | | | | | | | | | 286| 619| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 619] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 619| !__same_type(*(ptr), void), \ | | | | | | | | 813| 619| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 619| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 1.06k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 1.06k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 445, False: 619] | | ------------------ | | 658| 619| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 445| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 445| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 445|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 445| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 445| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 445|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 445| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 445| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 445| do { \ | | | | | | | | | | | | | | | | 286| 445| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 445] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 445| !__same_type(*(ptr), void), \ | | | | | | | | 813| 445| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 445| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5802| 445| list_del(&inetdev->head); 5803| 445| free(inetdev); 5804| 445| } 5805| | 5806| 619| return 0; 5807| 619|} confile.c:set_config_net_ipv4_gateway: 926| 1.21k|{ 927| 1.21k| struct lxc_netdev *netdev = data; 928| | 929| 1.21k| if (!netdev) ------------------ | Branch (929:6): [True: 0, False: 1.21k] ------------------ 930| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 931| | 932| 1.21k| clr_config_net_ipv4_gateway(key, lxc_conf, data); 933| 1.21k| if (lxc_config_value_empty(value)) ------------------ | Branch (933:6): [True: 0, False: 1.21k] ------------------ 934| 0| return 0; 935| | 936| 1.21k| if (strequal(value, "auto")) { ------------------ | Branch (936:6): [True: 194, False: 1.01k] ------------------ 937| 194| netdev->ipv4_gateway = NULL; 938| 194| netdev->ipv4_gateway_auto = true; 939| 1.01k| } else if (strequal(value, "dev")) { ------------------ | Branch (939:13): [True: 197, False: 819] ------------------ 940| 197| netdev->ipv4_gateway = NULL; 941| 197| netdev->ipv4_gateway_auto = false; 942| 197| netdev->ipv4_gateway_dev = true; 943| 819| } else { 944| 819| __do_free struct in_addr *gw = NULL; ------------------ | | 69| 819|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 819| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 945| 819| int ret; 946| | 947| 819| gw = zalloc(sizeof(*gw)); ------------------ | | 90| 819|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 948| 819| if (!gw) ------------------ | Branch (948:7): [True: 0, False: 819] ------------------ 949| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 950| | 951| 819| ret = inet_pton(AF_INET, value, gw); 952| 819| if (!ret || ret < 0) ------------------ | Branch (952:7): [True: 67, False: 752] | Branch (952:15): [True: 0, False: 752] ------------------ 953| 67| return log_error_errno(-1, errno, "Invalid ipv4 gateway address \"%s\"", value); ------------------ | | 486| 67| ({ \ | | 487| 67| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 67| errno = (__errno__); \ | | 489| 67| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 67| do { \ | | | | 454| 67| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 67| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 67| char *ptr = NULL; \ | | | | | | 317| 67| { \ | | | | | | 318| 67| int __saved_errno = errno; \ | | | | | | 319| 67| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 67| errno = __saved_errno; \ | | | | | | 321| 67| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 67] | | | | | | ------------------ | | | | | | 322| 67| ptr = errno_buf; \ | | | | | | 323| 67| } | | | | ------------------ | | | | 455| 67| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 67|#define ERROR(format, ...) do { \ | | | | | | 373| 67| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 67| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 67| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 67|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 67] | | | | | | ------------------ | | | | ------------------ | | | | 456| 67| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 67] | | | | ------------------ | | ------------------ | | 490| 67| __internal_ret__; \ | | 491| 67| }) ------------------ 954| | 955| 752| netdev->ipv4_gateway = move_ptr(gw); ------------------ | | 694| 752| ({ \ | | 695| 752| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 752| (ptr) = NULL; \ | | 697| 752| __internal_ptr__; \ | | 698| 752| }) ------------------ 956| 752| netdev->ipv4_gateway_auto = false; 957| 752| } 958| | 959| 1.14k| return 0; 960| 1.21k|} confile.c:clr_config_net_ipv4_gateway: 5781| 1.59k|{ 5782| 1.59k| struct lxc_netdev *netdev = data; 5783| | 5784| 1.59k| if (!netdev) ------------------ | Branch (5784:6): [True: 0, False: 1.59k] ------------------ 5785| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5786| | 5787| 1.59k| free_disarm(netdev->ipv4_gateway); ------------------ | | 58| 1.59k| ({ \ | | 59| 1.59k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 555, False: 1.04k] | | ------------------ | | 60| 555| free(ptr); \ | | 61| 555| ptr = NULL; \ | | 62| 555| } \ | | 63| 1.59k| }) ------------------ 5788| | 5789| 1.59k| return 0; 5790| 1.59k|} confile.c:set_config_net_ipv6_address: 1015| 1.20k|{ 1016| 1.20k| __do_free char *valdup = NULL; ------------------ | | 69| 1.20k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.20k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1017| 1.20k| __do_free struct lxc_inet6dev *inet6dev = NULL; ------------------ | | 69| 1.20k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.20k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1018| 1.20k| int ret; 1019| 1.20k| struct lxc_netdev *netdev = data; 1020| 1.20k| char *slash, *netmask; 1021| | 1022| 1.20k| if (!netdev) ------------------ | Branch (1022:6): [True: 0, False: 1.20k] ------------------ 1023| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1024| | 1025| 1.20k| if (lxc_config_value_empty(value)) ------------------ | Branch (1025:6): [True: 0, False: 1.20k] ------------------ 1026| 0| return clr_config_net_ipv6_address(key, lxc_conf, data); 1027| | 1028| 1.20k| inet6dev = zalloc(sizeof(*inet6dev)); ------------------ | | 90| 1.20k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1029| 1.20k| if (!inet6dev) ------------------ | Branch (1029:6): [True: 0, False: 1.20k] ------------------ 1030| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1031| | 1032| 1.20k| valdup = strdup(value); 1033| 1.20k| if (!valdup) ------------------ | Branch (1033:6): [True: 0, False: 1.20k] ------------------ 1034| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1035| | 1036| 1.20k| inet6dev->prefix = 64; 1037| 1.20k| slash = strstr(valdup, "/"); 1038| 1.20k| if (slash) { ------------------ | Branch (1038:6): [True: 240, False: 964] ------------------ 1039| 240| *slash = '\0'; 1040| 240| netmask = slash + 1; 1041| | 1042| 240| ret = lxc_safe_uint(netmask, &inet6dev->prefix); 1043| 240| if (ret < 0) ------------------ | Branch (1043:7): [True: 4, False: 236] ------------------ 1044| 4| return ret; 1045| 240| } 1046| | 1047| 1.20k| ret = inet_pton(AF_INET6, valdup, &inet6dev->addr); 1048| 1.20k| if (!ret || ret < 0) ------------------ | Branch (1048:6): [True: 8, False: 1.19k] | Branch (1048:14): [True: 0, False: 1.19k] ------------------ 1049| 8| return log_error_errno(-EINVAL, EINVAL, "Invalid ipv6 address \"%s\"", valdup); ------------------ | | 486| 8| ({ \ | | 487| 8| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 8| errno = (__errno__); \ | | 489| 8| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 8| do { \ | | | | 454| 8| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 8| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 8| char *ptr = NULL; \ | | | | | | 317| 8| { \ | | | | | | 318| 8| int __saved_errno = errno; \ | | | | | | 319| 8| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 8| errno = __saved_errno; \ | | | | | | 321| 8| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 8] | | | | | | ------------------ | | | | | | 322| 8| ptr = errno_buf; \ | | | | | | 323| 8| } | | | | ------------------ | | | | 455| 8| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 8|#define ERROR(format, ...) do { \ | | | | | | 373| 8| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 8| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 8| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 8|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 8] | | | | | | ------------------ | | | | ------------------ | | | | 456| 8| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 8] | | | | ------------------ | | ------------------ | | 490| 8| __internal_ret__; \ | | 491| 8| }) ------------------ 1050| | 1051| 1.19k| list_add_tail(&inet6dev->head, &netdev->ipv6_addresses); 1052| 1.19k| move_ptr(inet6dev); ------------------ | | 694| 1.19k| ({ \ | | 695| 1.19k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.19k| (ptr) = NULL; \ | | 697| 1.19k| __internal_ptr__; \ | | 698| 1.19k| }) ------------------ 1053| | 1054| 1.19k| return 0; 1055| 1.20k|} confile.c:clr_config_net_ipv6_address: 5844| 611|{ 5845| 611| struct lxc_netdev *netdev = data; 5846| 611| struct lxc_inet6dev *inet6dev, *ninet6dev; 5847| | 5848| 611| if (!netdev) ------------------ | Branch (5848:6): [True: 0, False: 611] ------------------ 5849| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5850| | 5851| 611| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->ipv6_addresses, head) { ------------------ | | 655| 611| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 611| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 611| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 611|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 611| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 611| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 611|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 611| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 611| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 611| do { \ | | | | | | | | | | | | | | | | 286| 611| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 611] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 611| !__same_type(*(ptr), void), \ | | | | | | | | 813| 611| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 611| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 611| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 611| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 611| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 611|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 611| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 611| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 611|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 611| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 611| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 611| do { \ | | | | | | | | | | | | | | | | 286| 611| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 611] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 611| !__same_type(*(ptr), void), \ | | | | | | | | 813| 611| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 611| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 1.17k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 1.17k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 559, False: 611] | | ------------------ | | 658| 611| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 559| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 559| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 559|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 559| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 559| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 559|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 559| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 559| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 559| do { \ | | | | | | | | | | | | | | | | 286| 559| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 559] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 559| !__same_type(*(ptr), void), \ | | | | | | | | 813| 559| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 559| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5852| 559| list_del(&inet6dev->head); 5853| 559| free(inet6dev); 5854| 559| } 5855| | 5856| 611| return 0; 5857| 611|} confile.c:set_config_net_ipv6_gateway: 1059| 1.27k|{ 1060| 1.27k| struct lxc_netdev *netdev = data; 1061| | 1062| 1.27k| if (!netdev) ------------------ | Branch (1062:6): [True: 0, False: 1.27k] ------------------ 1063| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1064| | 1065| 1.27k| clr_config_net_ipv6_gateway(key, lxc_conf, data); 1066| 1.27k| if (lxc_config_value_empty(value)) ------------------ | Branch (1066:6): [True: 0, False: 1.27k] ------------------ 1067| 0| return 0; 1068| | 1069| 1.27k| if (strequal(value, "auto")) { ------------------ | Branch (1069:6): [True: 194, False: 1.07k] ------------------ 1070| 194| netdev->ipv6_gateway = NULL; 1071| 194| netdev->ipv6_gateway_auto = true; 1072| 1.07k| } else if (strequal(value, "dev")) { ------------------ | Branch (1072:13): [True: 194, False: 884] ------------------ 1073| 194| netdev->ipv6_gateway = NULL; 1074| 194| netdev->ipv6_gateway_auto = false; 1075| 194| netdev->ipv6_gateway_dev = true; 1076| 884| } else { 1077| 884| int ret; 1078| 884| __do_free struct in6_addr *gw = NULL; ------------------ | | 69| 884|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 884| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1079| | 1080| 884| gw = zalloc(sizeof(*gw)); ------------------ | | 90| 884|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1081| 884| if (!gw) ------------------ | Branch (1081:7): [True: 0, False: 884] ------------------ 1082| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1083| | 1084| 884| ret = inet_pton(AF_INET6, value, gw); 1085| 884| if (!ret || ret < 0) ------------------ | Branch (1085:7): [True: 61, False: 823] | Branch (1085:15): [True: 0, False: 823] ------------------ 1086| 61| return log_error_errno(-EINVAL, EINVAL, ------------------ | | 486| 61| ({ \ | | 487| 61| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 61| errno = (__errno__); \ | | 489| 61| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 61| do { \ | | | | 454| 61| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 61| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 61| char *ptr = NULL; \ | | | | | | 317| 61| { \ | | | | | | 318| 61| int __saved_errno = errno; \ | | | | | | 319| 61| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 61| errno = __saved_errno; \ | | | | | | 321| 61| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 61] | | | | | | ------------------ | | | | | | 322| 61| ptr = errno_buf; \ | | | | | | 323| 61| } | | | | ------------------ | | | | 455| 61| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 61|#define ERROR(format, ...) do { \ | | | | | | 373| 61| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 61| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 61| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 61|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 61] | | | | | | ------------------ | | | | ------------------ | | | | 456| 61| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 61] | | | | ------------------ | | ------------------ | | 490| 61| __internal_ret__; \ | | 491| 61| }) ------------------ 1087| 884| "Invalid ipv6 gateway address \"%s\"", value); 1088| | 1089| 823| netdev->ipv6_gateway = move_ptr(gw); ------------------ | | 694| 823| ({ \ | | 695| 823| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 823| (ptr) = NULL; \ | | 697| 823| __internal_ptr__; \ | | 698| 823| }) ------------------ 1090| 823| netdev->ipv6_gateway_auto = false; 1091| 823| } 1092| | 1093| 1.21k| return 0; 1094| 1.27k|} confile.c:clr_config_net_ipv6_gateway: 5831| 1.68k|{ 5832| 1.68k| struct lxc_netdev *netdev = data; 5833| | 5834| 1.68k| if (!netdev) ------------------ | Branch (5834:6): [True: 0, False: 1.68k] ------------------ 5835| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5836| | 5837| 1.68k| free_disarm(netdev->ipv6_gateway); ------------------ | | 58| 1.68k| ({ \ | | 59| 1.68k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 602, False: 1.08k] | | ------------------ | | 60| 602| free(ptr); \ | | 61| 602| ptr = NULL; \ | | 62| 602| } \ | | 63| 1.68k| }) ------------------ 5838| | 5839| 1.68k| return 0; 5840| 1.68k|} confile.c:set_config_net_link: 514| 1.92k|{ 515| 1.92k| struct lxc_netdev *netdev = data; 516| 1.92k| int ret = 0; 517| | 518| 1.92k| if (!netdev) ------------------ | Branch (518:6): [True: 0, False: 1.92k] ------------------ 519| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 520| | 521| 1.92k| if (lxc_config_value_empty(value)) ------------------ | Branch (521:6): [True: 0, False: 1.92k] ------------------ 522| 0| return clr_config_net_link(key, lxc_conf, data); 523| | 524| 1.92k| if (value[strlen(value) - 1] == '+' && netdev->type == LXC_NET_PHYS) ------------------ | Branch (524:6): [True: 917, False: 1.00k] | Branch (524:41): [True: 686, False: 231] ------------------ 525| 686| ret = create_matched_ifnames(value, lxc_conf, netdev); 526| 1.23k| else 527| 1.23k| ret = network_ifname(netdev->link, value, sizeof(netdev->link)); 528| | 529| 1.92k| return ret; 530| 1.92k|} confile.c:create_matched_ifnames: 473| 686|{ 474| 686| call_cleaner(netns_freeifaddrs) struct netns_ifaddrs *ifaddr = NULL; ------------------ | | 26| 686| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 475| 686| struct netns_ifaddrs *ifa; 476| 686| int n; 477| 686| int ret = 0; 478| 686| const char *type_key = "lxc.net.type"; 479| 686| const char *link_key = "lxc.net.link"; 480| 686| const char *tmpvalue = "phys"; 481| | 482| 686| if (netns_getifaddrs(&ifaddr, -1, &(bool){false}) < 0) ------------------ | Branch (482:6): [True: 0, False: 686] ------------------ 483| 0| return log_error_errno(-1, errno, "Failed to get network interfaces"); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 484| | 485| 3.43k| for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) { ------------------ | Branch (485:28): [True: 2.74k, False: 686] ------------------ 486| 2.74k| if (!ifa->ifa_addr) ------------------ | Branch (486:7): [True: 0, False: 2.74k] ------------------ 487| 0| continue; 488| | 489| 2.74k| if (ifa->ifa_addr->sa_family != AF_PACKET) ------------------ | Branch (489:7): [True: 1.37k, False: 1.37k] ------------------ 490| 1.37k| continue; 491| | 492| 1.37k| if (strnequal(value, ifa->ifa_name, strlen(value) - 1)) { ------------------ | Branch (492:7): [True: 935, False: 437] ------------------ 493| 935| ret = set_config_net_type(type_key, tmpvalue, lxc_conf, 494| 935| netdev); 495| 935| if (!ret) { ------------------ | Branch (495:8): [True: 935, False: 0] ------------------ 496| 935| ret = set_config_net_link( 497| 935| link_key, ifa->ifa_name, lxc_conf, netdev); 498| 935| if (ret) { ------------------ | Branch (498:9): [True: 0, False: 935] ------------------ 499| 0| ERROR("Failed to create matched ifnames"); ------------------ | | 372| 0|#define ERROR(format, ...) do { \ | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 0|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 0] | | ------------------ ------------------ 500| 0| break; 501| 0| } 502| 935| } else { 503| 0| ERROR("Failed to create matched ifnames"); ------------------ | | 372| 0|#define ERROR(format, ...) do { \ | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 0|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 0] | | ------------------ ------------------ 504| 0| break; 505| 0| } 506| 935| } 507| 1.37k| } 508| | 509| 686| return ret; 510| 686|} confile.c:clr_config_net_link: 5536| 196|{ 5537| 196| struct lxc_netdev *netdev = data; 5538| | 5539| 196| if (!netdev) ------------------ | Branch (5539:6): [True: 0, False: 196] ------------------ 5540| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5541| | 5542| 196| netdev->link[0] = '\0'; 5543| | 5544| 196| return 0; 5545| 196|} confile.c:set_config_net_l2proxy: 534| 435|{ 535| 435| struct lxc_netdev *netdev = data; 536| 435| unsigned int val = 0; 537| 435| int ret; 538| | 539| 435| if (!netdev) ------------------ | Branch (539:6): [True: 0, False: 435] ------------------ 540| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 541| | 542| 435| if (lxc_config_value_empty(value)) ------------------ | Branch (542:6): [True: 0, False: 435] ------------------ 543| 0| return clr_config_net_l2proxy(key, lxc_conf, data); 544| | 545| 435| ret = lxc_safe_uint(value, &val); 546| 435| if (ret < 0) ------------------ | Branch (546:6): [True: 2, False: 433] ------------------ 547| 2| return ret_errno(ret); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 548| | 549| 433| switch (val) { ------------------ | Branch (549:10): [True: 432, False: 1] ------------------ 550| 206| case 0: ------------------ | Branch (550:2): [True: 206, False: 227] ------------------ 551| 206| netdev->l2proxy = false; 552| 206| return 0; 553| 226| case 1: ------------------ | Branch (553:2): [True: 226, False: 207] ------------------ 554| 226| netdev->l2proxy = true; 555| 226| return 0; 556| 433| } 557| | 558| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 559| 433|} confile.c:clr_config_net_l2proxy: 5549| 194|{ 5550| 194| struct lxc_netdev *netdev = data; 5551| | 5552| 194| if (!netdev) ------------------ | Branch (5552:6): [True: 0, False: 194] ------------------ 5553| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5554| | 5555| 194| netdev->l2proxy = false; 5556| | 5557| 194| return 0; 5558| 194|} confile.c:set_config_net_macvlan_mode: 736| 307|{ 737| 307| struct lxc_netdev *netdev = data; 738| | 739| 307| if (!netdev) ------------------ | Branch (739:6): [True: 0, False: 307] ------------------ 740| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 741| | 742| 307| if (netdev->type != LXC_NET_MACVLAN) ------------------ | Branch (742:6): [True: 4, False: 303] ------------------ 743| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 744| | 745| 303| if (lxc_config_value_empty(value)) ------------------ | Branch (745:6): [True: 0, False: 303] ------------------ 746| 0| return clr_config_net_macvlan_mode(key, lxc_conf, data); 747| | 748| 303| return lxc_macvlan_mode_to_flag(&netdev->priv.macvlan_attr.mode, value); 749| 303|} confile.c:clr_config_net_macvlan_mode: 5562| 391|{ 5563| 391| struct lxc_netdev *netdev = data; 5564| | 5565| 391| if (!netdev) ------------------ | Branch (5565:6): [True: 0, False: 391] ------------------ 5566| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5567| | 5568| 391| if (netdev->type != LXC_NET_MACVLAN) ------------------ | Branch (5568:6): [True: 197, False: 194] ------------------ 5569| 197| return 0; 5570| | 5571| 194| netdev->priv.macvlan_attr.mode = -1; 5572| | 5573| 194| return 0; 5574| 391|} confile.c:set_config_net_ipvlan_mode: 753| 326|{ 754| 326| struct lxc_netdev *netdev = data; 755| | 756| 326| if (!netdev) ------------------ | Branch (756:6): [True: 0, False: 326] ------------------ 757| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 758| | 759| 326| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (759:6): [True: 5, False: 321] ------------------ 760| 5| return syserror_set(-EINVAL, "Invalid ipvlan mode \"%s\", can only be used with ipvlan network", value); ------------------ | | 568| 5| ({ \ | | 569| 5| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 5| errno = labs(__ret__); \ | | 571| 5| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 5| do { \ | | | | 454| 5| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 5| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 5| char *ptr = NULL; \ | | | | | | 317| 5| { \ | | | | | | 318| 5| int __saved_errno = errno; \ | | | | | | 319| 5| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 5| errno = __saved_errno; \ | | | | | | 321| 5| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 5] | | | | | | ------------------ | | | | | | 322| 5| ptr = errno_buf; \ | | | | | | 323| 5| } | | | | ------------------ | | | | 455| 5| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 5|#define ERROR(format, ...) do { \ | | | | | | 373| 5| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 5| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 5| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 5|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 5] | | | | | | ------------------ | | | | ------------------ | | | | 456| 5| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 5] | | | | ------------------ | | ------------------ | | 572| 5| __internal_ret__; \ | | 573| 5| }) ------------------ 761| | 762| 321| if (lxc_config_value_empty(value)) ------------------ | Branch (762:6): [True: 0, False: 321] ------------------ 763| 0| return clr_config_net_ipvlan_mode(key, lxc_conf, data); 764| | 765| 321| return lxc_ipvlan_mode_to_flag(&netdev->priv.ipvlan_attr.mode, value); 766| 321|} confile.c:clr_config_net_ipvlan_mode: 5578| 413|{ 5579| 413| struct lxc_netdev *netdev = data; 5580| | 5581| 413| if (!netdev) ------------------ | Branch (5581:6): [True: 0, False: 413] ------------------ 5582| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5583| | 5584| 413| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (5584:6): [True: 195, False: 218] ------------------ 5585| 195| return 0; 5586| | 5587| 218| netdev->priv.ipvlan_attr.mode = -1; 5588| | 5589| 218| return 0; 5590| 413|} confile.c:set_config_net_ipvlan_isolation: 770| 325|{ 771| 325| struct lxc_netdev *netdev = data; 772| | 773| 325| if (!netdev) ------------------ | Branch (773:6): [True: 0, False: 325] ------------------ 774| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 775| | 776| 325| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (776:6): [True: 5, False: 320] ------------------ 777| 5| return syserror_set(-EINVAL, "Invalid ipvlan isolation \"%s\", can only be used with ipvlan network", value); ------------------ | | 568| 5| ({ \ | | 569| 5| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 5| errno = labs(__ret__); \ | | 571| 5| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 5| do { \ | | | | 454| 5| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 5| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 5| char *ptr = NULL; \ | | | | | | 317| 5| { \ | | | | | | 318| 5| int __saved_errno = errno; \ | | | | | | 319| 5| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 5| errno = __saved_errno; \ | | | | | | 321| 5| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 5] | | | | | | ------------------ | | | | | | 322| 5| ptr = errno_buf; \ | | | | | | 323| 5| } | | | | ------------------ | | | | 455| 5| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 5|#define ERROR(format, ...) do { \ | | | | | | 373| 5| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 5| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 5| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 5|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 5] | | | | | | ------------------ | | | | ------------------ | | | | 456| 5| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 5] | | | | ------------------ | | ------------------ | | 572| 5| __internal_ret__; \ | | 573| 5| }) ------------------ 778| | 779| 320| if (lxc_config_value_empty(value)) ------------------ | Branch (779:6): [True: 0, False: 320] ------------------ 780| 0| return clr_config_net_ipvlan_isolation(key, lxc_conf, data); 781| | 782| 320| return lxc_ipvlan_isolation_to_flag(&netdev->priv.ipvlan_attr.isolation, value); 783| 320|} confile.c:clr_config_net_ipvlan_isolation: 5594| 390|{ 5595| 390| struct lxc_netdev *netdev = data; 5596| | 5597| 390| if (!netdev) ------------------ | Branch (5597:6): [True: 0, False: 390] ------------------ 5598| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5599| | 5600| 390| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (5600:6): [True: 196, False: 194] ------------------ 5601| 196| return 0; 5602| | 5603| 194| netdev->priv.ipvlan_attr.isolation = -1; 5604| | 5605| 194| return 0; 5606| 390|} confile.c:set_config_net_mtu: 833| 1.70k|{ 834| 1.70k| struct lxc_netdev *netdev = data; 835| | 836| 1.70k| if (!netdev) ------------------ | Branch (836:6): [True: 0, False: 1.70k] ------------------ 837| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 838| | 839| 1.70k| clr_config_net_mtu(key, lxc_conf, data); 840| 1.70k| if (lxc_config_value_empty(value)) ------------------ | Branch (840:6): [True: 0, False: 1.70k] ------------------ 841| 0| return 0; 842| | 843| 1.70k| return set_config_string_item(&netdev->mtu, value); 844| 1.70k|} confile.c:clr_config_net_mtu: 5752| 2.37k|{ 5753| 2.37k| struct lxc_netdev *netdev = data; 5754| | 5755| 2.37k| if (!netdev) ------------------ | Branch (5755:6): [True: 0, False: 2.37k] ------------------ 5756| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5757| | 5758| 2.37k| free_disarm(netdev->mtu); ------------------ | | 58| 2.37k| ({ \ | | 59| 2.37k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 610, False: 1.76k] | | ------------------ | | 60| 610| free(ptr); \ | | 61| 610| ptr = NULL; \ | | 62| 610| } \ | | 63| 2.37k| }) ------------------ 5759| | 5760| 2.37k| return 0; 5761| 2.37k|} confile.c:set_config_net_name: 563| 880|{ 564| 880| struct lxc_netdev *netdev = data; 565| | 566| 880| if (!netdev) ------------------ | Branch (566:6): [True: 0, False: 880] ------------------ 567| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 568| | 569| 880| if (lxc_config_value_empty(value)) ------------------ | Branch (569:6): [True: 0, False: 880] ------------------ 570| 0| return clr_config_net_name(key, lxc_conf, data); 571| | 572| 880| return network_ifname(netdev->name, value, sizeof(netdev->name)); 573| 880|} confile.c:clr_config_net_name: 5510| 195|{ 5511| 195| struct lxc_netdev *netdev = data; 5512| | 5513| 195| if (!netdev) ------------------ | Branch (5513:6): [True: 0, False: 195] ------------------ 5514| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5515| | 5516| 195| netdev->name[0] = '\0'; 5517| | 5518| 195| return 0; 5519| 195|} confile.c:set_config_net_script_down: 1164| 808|{ 1165| 808| struct lxc_netdev *netdev = data; 1166| | 1167| 808| if (!netdev) ------------------ | Branch (1167:6): [True: 0, False: 808] ------------------ 1168| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1169| | 1170| 808| clr_config_net_script_down(key, lxc_conf, data); 1171| 808| if (lxc_config_value_empty(value)) ------------------ | Branch (1171:6): [True: 0, False: 808] ------------------ 1172| 0| return 0; 1173| | 1174| 808| return set_config_string_item(&netdev->downscript, value); 1175| 808|} confile.c:clr_config_net_script_down: 5726| 1.35k|{ 5727| 1.35k| struct lxc_netdev *netdev = data; 5728| | 5729| 1.35k| if (!netdev) ------------------ | Branch (5729:6): [True: 0, False: 1.35k] ------------------ 5730| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5731| | 5732| 1.35k| free_disarm(netdev->downscript); ------------------ | | 58| 1.35k| ({ \ | | 59| 1.35k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 590, False: 763] | | ------------------ | | 60| 590| free(ptr); \ | | 61| 590| ptr = NULL; \ | | 62| 590| } \ | | 63| 1.35k| }) ------------------ 5733| | 5734| 1.35k| return 0; 5735| 1.35k|} confile.c:set_config_net_script_up: 1149| 705|{ 1150| 705| struct lxc_netdev *netdev = data; 1151| | 1152| 705| if (!netdev) ------------------ | Branch (1152:6): [True: 0, False: 705] ------------------ 1153| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1154| | 1155| 705| clr_config_net_script_up(key, lxc_conf, data); 1156| 705| if (lxc_config_value_empty(value)) ------------------ | Branch (1156:6): [True: 0, False: 705] ------------------ 1157| 0| return 0; 1158| | 1159| 705| return set_config_string_item(&netdev->upscript, value); 1160| 705|} confile.c:clr_config_net_script_up: 5713| 1.32k|{ 5714| 1.32k| struct lxc_netdev *netdev = data; 5715| | 5716| 1.32k| if (!netdev) ------------------ | Branch (5716:6): [True: 0, False: 1.32k] ------------------ 5717| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5718| | 5719| 1.32k| free_disarm(netdev->upscript); ------------------ | | 58| 1.32k| ({ \ | | 59| 1.32k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 481, False: 840] | | ------------------ | | 60| 481| free(ptr); \ | | 61| 481| ptr = NULL; \ | | 62| 481| } \ | | 63| 1.32k| }) ------------------ 5720| | 5721| 1.32k| return 0; 5722| 1.32k|} confile.c:set_config_net_type: 411| 4.13k|{ 412| 4.13k| struct lxc_netdev *netdev = data; 413| | 414| 4.13k| if (!netdev) ------------------ | Branch (414:6): [True: 0, False: 4.13k] ------------------ 415| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 416| | 417| 4.13k| clr_config_net_type(key, lxc_conf, data); 418| 4.13k| if (lxc_config_value_empty(value)) ------------------ | Branch (418:6): [True: 0, False: 4.13k] ------------------ 419| 0| return 0; 420| | 421| 4.13k| if (strequal(value, "veth")) { ------------------ | Branch (421:6): [True: 1.29k, False: 2.84k] ------------------ 422| 1.29k| netdev->type = LXC_NET_VETH; 423| 1.29k| INIT_LIST_HEAD(&netdev->priv.veth_attr.ipv4_routes); 424| 1.29k| INIT_LIST_HEAD(&netdev->priv.veth_attr.ipv6_routes); 425| 1.29k| lxc_list_init(&netdev->priv.veth_attr.vlan_tagged_ids); 426| 1.29k| if (!lxc_veth_flag_to_mode(netdev->priv.veth_attr.mode)) ------------------ | Branch (426:7): [True: 1.29k, False: 0] ------------------ 427| 1.29k| lxc_veth_mode_to_flag(&netdev->priv.veth_attr.mode, "bridge"); 428| 2.84k| } else if (strequal(value, "macvlan")) { ------------------ | Branch (428:13): [True: 604, False: 2.23k] ------------------ 429| 604| netdev->type = LXC_NET_MACVLAN; 430| 604| if (!lxc_macvlan_flag_to_mode(netdev->priv.veth_attr.mode)) ------------------ | Branch (430:7): [True: 604, False: 0] ------------------ 431| 604| lxc_macvlan_mode_to_flag(&netdev->priv.macvlan_attr.mode, "private"); 432| 2.23k| } else if (strequal(value, "ipvlan")) { ------------------ | Branch (432:13): [True: 386, False: 1.85k] ------------------ 433| 386| netdev->type = LXC_NET_IPVLAN; 434| 386| if (!lxc_ipvlan_flag_to_mode(netdev->priv.ipvlan_attr.mode)) ------------------ | Branch (434:7): [True: 0, False: 386] ------------------ 435| 0| lxc_ipvlan_mode_to_flag(&netdev->priv.ipvlan_attr.mode, "l3"); 436| 386| if (!lxc_ipvlan_flag_to_isolation(netdev->priv.ipvlan_attr.isolation)) ------------------ | Branch (436:7): [True: 0, False: 386] ------------------ 437| 0| lxc_ipvlan_isolation_to_flag(&netdev->priv.ipvlan_attr.isolation, "bridge"); 438| 1.85k| } else if (strequal(value, "vlan")) { ------------------ | Branch (438:13): [True: 282, False: 1.56k] ------------------ 439| 282| netdev->type = LXC_NET_VLAN; 440| 1.56k| } else if (strequal(value, "phys")) { ------------------ | Branch (440:13): [True: 997, False: 571] ------------------ 441| 997| netdev->type = LXC_NET_PHYS; 442| 997| } else if (strequal(value, "empty")) { ------------------ | Branch (442:13): [True: 194, False: 377] ------------------ 443| 194| netdev->type = LXC_NET_EMPTY; 444| | /* We don't support custom loopback device names. */ 445| 194| (void)strlcpy(netdev->name, "lo", IFNAMSIZ); 446| 377| } else if (strequal(value, "none")) { ------------------ | Branch (446:13): [True: 207, False: 170] ------------------ 447| 207| netdev->type = LXC_NET_NONE; 448| 207| } else { 449| 170| return log_error(-1, "Invalid network type %s", value); ------------------ | | 494| 170| ({ \ | | 495| 170| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 496| 170| ERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 170|#define ERROR(format, ...) do { \ | | | | 373| 170| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 170| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 170| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 170|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 170] | | | | ------------------ | | ------------------ | | 497| 170| __internal_ret__; \ | | 498| 170| }) ------------------ 450| 170| } 451| | 452| 3.96k| return 0; 453| 4.13k|} confile.c:clr_config_net_type: 5497| 4.35k|{ 5498| 4.35k| struct lxc_netdev *netdev = data; 5499| | 5500| 4.35k| if (!netdev) ------------------ | Branch (5500:6): [True: 0, False: 4.35k] ------------------ 5501| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5502| | 5503| 4.35k| lxc_clear_netdev(netdev); 5504| | 5505| 4.35k| return 0; 5506| 4.35k|} confile.c:set_config_net_vlan_id: 811| 213|{ 812| 213| int ret; 813| 213| struct lxc_netdev *netdev = data; 814| | 815| 213| if (!netdev) ------------------ | Branch (815:6): [True: 0, False: 213] ------------------ 816| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 817| | 818| 213| if (netdev->type != LXC_NET_VLAN) ------------------ | Branch (818:6): [True: 4, False: 209] ------------------ 819| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 820| | 821| 209| if (lxc_config_value_empty(value)) ------------------ | Branch (821:6): [True: 0, False: 209] ------------------ 822| 0| return clr_config_net_vlan_id(key, lxc_conf, data); 823| | 824| 209| ret = get_u16(&netdev->priv.vlan_attr.vid, value, 0); 825| 209| if (ret < 0) ------------------ | Branch (825:6): [True: 13, False: 196] ------------------ 826| 13| return ret; 827| | 828| 196| return 0; 829| 209|} confile.c:clr_config_net_vlan_id: 5765| 389|{ 5766| 389| struct lxc_netdev *netdev = data; 5767| | 5768| 389| if (!netdev) ------------------ | Branch (5768:6): [True: 0, False: 389] ------------------ 5769| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5770| | 5771| 389| if (netdev->type != LXC_NET_VLAN) ------------------ | Branch (5771:6): [True: 194, False: 195] ------------------ 5772| 194| return 0; 5773| | 5774| 195| netdev->priv.vlan_attr.vid = 0; 5775| | 5776| 195| return 0; 5777| 389|} confile.c:set_config_net_veth_mode: 578| 239|{ 579| 239| struct lxc_netdev *netdev = data; 580| | 581| 239| if (!netdev) ------------------ | Branch (581:6): [True: 0, False: 239] ------------------ 582| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 583| | 584| 239| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (584:6): [True: 3, False: 236] ------------------ 585| 3| return ret_errno(EINVAL); ------------------ | | 715| 3| ({ \ | | 716| 3| errno = labs(__errno__); \ | | 717| 3| -errno; \ | | 718| 3| }) ------------------ 586| | 587| 236| if (lxc_config_value_empty(value)) ------------------ | Branch (587:6): [True: 0, False: 236] ------------------ 588| 0| return clr_config_net_veth_mode(key, lxc_conf, data); 589| | 590| 236| if (!netdev) ------------------ | Branch (590:6): [True: 0, False: 236] ------------------ 591| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 592| | 593| 236| return lxc_veth_mode_to_flag(&netdev->priv.veth_attr.mode, value); 594| 236|} confile.c:clr_config_net_veth_mode: 5610| 390|{ 5611| 390| struct lxc_netdev *netdev = data; 5612| | 5613| 390| if (!netdev) ------------------ | Branch (5613:6): [True: 0, False: 390] ------------------ 5614| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5615| | 5616| 390| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5616:6): [True: 196, False: 194] ------------------ 5617| 196| return 0; 5618| | 5619| 194| netdev->priv.veth_attr.mode = -1; 5620| | 5621| 194| return 0; 5622| 390|} confile.c:set_config_net_veth_n_rxqueues: 598| 201|{ 599| 201| int n_rxqueues; 600| 201| struct lxc_netdev *netdev = data; 601| | 602| 201| if (!netdev) ------------------ | Branch (602:6): [True: 0, False: 201] ------------------ 603| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 604| | 605| 201| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (605:6): [True: 4, False: 197] ------------------ 606| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 607| | 608| 197| if (lxc_config_value_empty(value)) ------------------ | Branch (608:6): [True: 0, False: 197] ------------------ 609| 0| return clr_config_net_veth_n_rxqueues(key, lxc_conf, data); 610| | 611| 197| if (lxc_safe_int(value, &n_rxqueues)) ------------------ | Branch (611:6): [True: 2, False: 195] ------------------ 612| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 613| | 614| 195| if (n_rxqueues <= 0) ------------------ | Branch (614:6): [True: 1, False: 194] ------------------ 615| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 616| | 617| 194| netdev->priv.veth_attr.n_rxqueues = n_rxqueues; 618| 194| return 0; 619| 195|} confile.c:clr_config_net_veth_n_rxqueues: 5626| 390|{ 5627| 390| struct lxc_netdev *netdev = data; 5628| | 5629| 390| if (!netdev) ------------------ | Branch (5629:6): [True: 0, False: 390] ------------------ 5630| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5631| | 5632| 390| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5632:6): [True: 196, False: 194] ------------------ 5633| 196| return 0; 5634| | 5635| 194| netdev->priv.veth_attr.n_rxqueues = -1; 5636| | 5637| 194| return 0; 5638| 390|} confile.c:set_config_net_veth_n_txqueues: 623| 253|{ 624| 253| int n_txqueues; 625| 253| struct lxc_netdev *netdev = data; 626| | 627| 253| if (!netdev) ------------------ | Branch (627:6): [True: 0, False: 253] ------------------ 628| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 629| | 630| 253| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (630:6): [True: 4, False: 249] ------------------ 631| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 632| | 633| 249| if (lxc_config_value_empty(value)) ------------------ | Branch (633:6): [True: 0, False: 249] ------------------ 634| 0| return clr_config_net_veth_n_txqueues(key, lxc_conf, data); 635| | 636| 249| if (lxc_safe_int(value, &n_txqueues)) ------------------ | Branch (636:6): [True: 2, False: 247] ------------------ 637| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 638| | 639| 247| if (n_txqueues <= 0) ------------------ | Branch (639:6): [True: 37, False: 210] ------------------ 640| 37| return ret_errno(EINVAL); ------------------ | | 715| 37| ({ \ | | 716| 37| errno = labs(__errno__); \ | | 717| 37| -errno; \ | | 718| 37| }) ------------------ 641| | 642| 210| netdev->priv.veth_attr.n_txqueues = n_txqueues; 643| 210| return 0; 644| 247|} confile.c:clr_config_net_veth_n_txqueues: 5642| 454|{ 5643| 454| struct lxc_netdev *netdev = data; 5644| | 5645| 454| if (!netdev) ------------------ | Branch (5645:6): [True: 0, False: 454] ------------------ 5646| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5647| | 5648| 454| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5648:6): [True: 194, False: 260] ------------------ 5649| 194| return 0; 5650| | 5651| 260| netdev->priv.veth_attr.n_txqueues = -1; 5652| | 5653| 260| return 0; 5654| 454|} confile.c:set_config_net_veth_pair: 648| 201|{ 649| 201| struct lxc_netdev *netdev = data; 650| | 651| 201| if (!netdev) ------------------ | Branch (651:6): [True: 0, False: 201] ------------------ 652| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 653| | 654| 201| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (654:6): [True: 5, False: 196] ------------------ 655| 5| return ret_errno(EINVAL); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 656| | 657| 196| if (lxc_config_value_empty(value)) ------------------ | Branch (657:6): [True: 0, False: 196] ------------------ 658| 0| return clr_config_net_veth_pair(key, lxc_conf, data); 659| | 660| 196| return network_ifname(netdev->priv.veth_attr.pair, value, 661| 196| sizeof(netdev->priv.veth_attr.pair)); 662| 196|} confile.c:clr_config_net_veth_pair: 5659| 391|{ 5660| 391| struct lxc_netdev *netdev = data; 5661| | 5662| 391| if (!netdev) ------------------ | Branch (5662:6): [True: 0, False: 391] ------------------ 5663| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5664| | 5665| 391| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5665:6): [True: 197, False: 194] ------------------ 5666| 197| return 0; 5667| | 5668| 194| netdev->priv.veth_attr.pair[0] = '\0'; 5669| | 5670| 194| return 0; 5671| 391|} confile.c:set_config_net_veth_ipv4_route: 964| 1.08k|{ 965| 1.08k| __do_free char *valdup = NULL; ------------------ | | 69| 1.08k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.08k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 966| 1.08k| __do_free struct lxc_inetdev *inetdev = NULL; ------------------ | | 69| 1.08k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.08k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 967| 1.08k| int ret; 968| 1.08k| char *netmask, *slash; 969| 1.08k| struct lxc_netdev *netdev = data; 970| | 971| 1.08k| if (!netdev) ------------------ | Branch (971:6): [True: 0, False: 1.08k] ------------------ 972| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 973| | 974| 1.08k| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (974:6): [True: 6, False: 1.08k] ------------------ 975| 6| return syserror_set(-EINVAL, "Invalid ipv4 route \"%s\", can only be used with veth network", value); ------------------ | | 568| 6| ({ \ | | 569| 6| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 6| errno = labs(__ret__); \ | | 571| 6| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 6| do { \ | | | | 454| 6| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 6| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 6| char *ptr = NULL; \ | | | | | | 317| 6| { \ | | | | | | 318| 6| int __saved_errno = errno; \ | | | | | | 319| 6| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 6| errno = __saved_errno; \ | | | | | | 321| 6| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 6] | | | | | | ------------------ | | | | | | 322| 6| ptr = errno_buf; \ | | | | | | 323| 6| } | | | | ------------------ | | | | 455| 6| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 6|#define ERROR(format, ...) do { \ | | | | | | 373| 6| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 6| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 6| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 6|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 6] | | | | | | ------------------ | | | | ------------------ | | | | 456| 6| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 6] | | | | ------------------ | | ------------------ | | 572| 6| __internal_ret__; \ | | 573| 6| }) ------------------ 976| | 977| 1.08k| if (lxc_config_value_empty(value)) ------------------ | Branch (977:6): [True: 0, False: 1.08k] ------------------ 978| 0| return clr_config_net_veth_ipv4_route(key, lxc_conf, data); 979| | 980| 1.08k| inetdev = zalloc(sizeof(*inetdev)); ------------------ | | 90| 1.08k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 981| 1.08k| if (!inetdev) ------------------ | Branch (981:6): [True: 0, False: 1.08k] ------------------ 982| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 983| | 984| 1.08k| valdup = strdup(value); 985| 1.08k| if (!valdup) ------------------ | Branch (985:6): [True: 0, False: 1.08k] ------------------ 986| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 987| | 988| 1.08k| slash = strchr(valdup, '/'); 989| 1.08k| if (!slash) ------------------ | Branch (989:6): [True: 2, False: 1.07k] ------------------ 990| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 991| | 992| 1.07k| *slash = '\0'; 993| 1.07k| slash++; 994| 1.07k| if (*slash == '\0') ------------------ | Branch (994:6): [True: 1, False: 1.07k] ------------------ 995| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 996| | 997| 1.07k| netmask = slash; 998| | 999| 1.07k| ret = lxc_safe_uint(netmask, &inetdev->prefix); 1000| 1.07k| if (ret < 0 || inetdev->prefix > 32) ------------------ | Branch (1000:6): [True: 6, False: 1.07k] | Branch (1000:17): [True: 33, False: 1.03k] ------------------ 1001| 39| return ret_errno(EINVAL); ------------------ | | 715| 39| ({ \ | | 716| 39| errno = labs(__errno__); \ | | 717| 39| -errno; \ | | 718| 39| }) ------------------ 1002| | 1003| 1.03k| ret = inet_pton(AF_INET, valdup, &inetdev->addr); 1004| 1.03k| if (!ret || ret < 0) ------------------ | Branch (1004:6): [True: 9, False: 1.02k] | Branch (1004:14): [True: 0, False: 1.02k] ------------------ 1005| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 1006| | 1007| 1.02k| list_add_tail(&inetdev->head, &netdev->priv.veth_attr.ipv4_routes); 1008| 1.02k| move_ptr(inetdev); ------------------ | | 694| 1.02k| ({ \ | | 695| 1.02k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.02k| (ptr) = NULL; \ | | 697| 1.02k| __internal_ptr__; \ | | 698| 1.02k| }) ------------------ 1009| | 1010| 1.02k| return 0; 1011| 1.03k|} confile.c:clr_config_net_veth_ipv4_route: 5811| 602|{ 5812| 602| struct lxc_netdev *netdev = data; 5813| 602| struct lxc_inetdev *inetdev, *ninetdev; 5814| | 5815| 602| if (!netdev) ------------------ | Branch (5815:6): [True: 0, False: 602] ------------------ 5816| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5817| | 5818| 602| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5818:6): [True: 197, False: 405] ------------------ 5819| 197| return 0; 5820| | 5821| 405| list_for_each_entry_safe(inetdev, ninetdev, &netdev->priv.veth_attr.ipv4_routes, head) { ------------------ | | 655| 405| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 405| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 405| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 405|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 405| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 405| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 405|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 405| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 405| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 405| do { \ | | | | | | | | | | | | | | | | 286| 405| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 405] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 405| !__same_type(*(ptr), void), \ | | | | | | | | 813| 405| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 405| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 602| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 602| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 602| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 602|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 602| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 602| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 405|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 405| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 405| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 405| do { \ | | | | | | | | | | | | | | | | 286| 405| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 405] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 602| !__same_type(*(ptr), void), \ | | | | | | | | 813| 602| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 602| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 806| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 806| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 401, False: 405] | | ------------------ | | 658| 405| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 401| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 401| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 401|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 401| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 401| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 401|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 401| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 401| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 401| do { \ | | | | | | | | | | | | | | | | 286| 401| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 401] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 401| !__same_type(*(ptr), void), \ | | | | | | | | 813| 401| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 401| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5822| 401| list_del(&inetdev->head); 5823| 401| free(inetdev); 5824| 401| } 5825| | 5826| 405| return 0; 5827| 602|} confile.c:set_config_net_veth_ipv6_route: 1098| 1.11k|{ 1099| 1.11k| __do_free char *valdup = NULL; ------------------ | | 69| 1.11k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.11k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1100| 1.11k| __do_free struct lxc_inet6dev *inet6dev = NULL; ------------------ | | 69| 1.11k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.11k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1101| 1.11k| int ret; 1102| 1.11k| char *netmask, *slash; 1103| 1.11k| struct lxc_netdev *netdev = data; 1104| | 1105| 1.11k| if (!netdev) ------------------ | Branch (1105:6): [True: 0, False: 1.11k] ------------------ 1106| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1107| | 1108| 1.11k| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (1108:6): [True: 5, False: 1.10k] ------------------ 1109| 5| return syserror_set(-EINVAL, "Invalid ipv6 route \"%s\", can only be used with veth network", value); ------------------ | | 568| 5| ({ \ | | 569| 5| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 5| errno = labs(__ret__); \ | | 571| 5| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 5| do { \ | | | | 454| 5| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 5| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 5| char *ptr = NULL; \ | | | | | | 317| 5| { \ | | | | | | 318| 5| int __saved_errno = errno; \ | | | | | | 319| 5| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 5| errno = __saved_errno; \ | | | | | | 321| 5| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 5] | | | | | | ------------------ | | | | | | 322| 5| ptr = errno_buf; \ | | | | | | 323| 5| } | | | | ------------------ | | | | 455| 5| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 5|#define ERROR(format, ...) do { \ | | | | | | 373| 5| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 5| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 5| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 5|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 5] | | | | | | ------------------ | | | | ------------------ | | | | 456| 5| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 5] | | | | ------------------ | | ------------------ | | 572| 5| __internal_ret__; \ | | 573| 5| }) ------------------ 1110| | 1111| 1.10k| if (lxc_config_value_empty(value)) ------------------ | Branch (1111:6): [True: 0, False: 1.10k] ------------------ 1112| 0| return clr_config_net_veth_ipv6_route(key, lxc_conf, data); 1113| | 1114| 1.10k| inet6dev = zalloc(sizeof(*inet6dev)); ------------------ | | 90| 1.10k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1115| 1.10k| if (!inet6dev) ------------------ | Branch (1115:6): [True: 0, False: 1.10k] ------------------ 1116| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1117| | 1118| 1.10k| valdup = strdup(value); 1119| 1.10k| if (!valdup) ------------------ | Branch (1119:6): [True: 0, False: 1.10k] ------------------ 1120| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1121| | 1122| 1.10k| slash = strchr(valdup, '/'); 1123| 1.10k| if (!slash) ------------------ | Branch (1123:6): [True: 4, False: 1.10k] ------------------ 1124| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 1125| | 1126| 1.10k| *slash = '\0'; 1127| 1.10k| slash++; 1128| 1.10k| if (*slash == '\0') ------------------ | Branch (1128:6): [True: 2, False: 1.10k] ------------------ 1129| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 1130| | 1131| 1.10k| netmask = slash; 1132| | 1133| 1.10k| ret = lxc_safe_uint(netmask, &inet6dev->prefix); 1134| 1.10k| if (ret < 0 || inet6dev->prefix > 128) ------------------ | Branch (1134:6): [True: 2, False: 1.10k] | Branch (1134:17): [True: 39, False: 1.06k] ------------------ 1135| 41| return ret_errno(EINVAL); ------------------ | | 715| 41| ({ \ | | 716| 41| errno = labs(__errno__); \ | | 717| 41| -errno; \ | | 718| 41| }) ------------------ 1136| | 1137| 1.06k| ret = inet_pton(AF_INET6, valdup, &inet6dev->addr); 1138| 1.06k| if (!ret || ret < 0) ------------------ | Branch (1138:6): [True: 4, False: 1.05k] | Branch (1138:14): [True: 0, False: 1.05k] ------------------ 1139| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 1140| | 1141| 1.05k| list_add_tail(&inet6dev->head, &netdev->priv.veth_attr.ipv6_routes); 1142| 1.05k| move_ptr(inet6dev); ------------------ | | 694| 1.05k| ({ \ | | 695| 1.05k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.05k| (ptr) = NULL; \ | | 697| 1.05k| __internal_ptr__; \ | | 698| 1.05k| }) ------------------ 1143| | 1144| 1.05k| return 0; 1145| 1.06k|} confile.c:clr_config_net_veth_ipv6_route: 5861| 605|{ 5862| 605| struct lxc_netdev *netdev = data; 5863| 605| struct lxc_inet6dev *inet6dev, *ninet6dev; 5864| | 5865| 605| if (!netdev) ------------------ | Branch (5865:6): [True: 0, False: 605] ------------------ 5866| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5867| | 5868| 605| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5868:6): [True: 197, False: 408] ------------------ 5869| 197| return 0; 5870| | 5871| 413| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->priv.veth_attr.ipv6_routes, head) { ------------------ | | 655| 408| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 408| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 408| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 408|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 408| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 408| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 408|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 408| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 408| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 408| do { \ | | | | | | | | | | | | | | | | 286| 408| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 408] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 408| !__same_type(*(ptr), void), \ | | | | | | | | 813| 408| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 408| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 605| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 605| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 605| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 605|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 605| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 605| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 408|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 408| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 408| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 408| do { \ | | | | | | | | | | | | | | | | 286| 408| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 408] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 605| !__same_type(*(ptr), void), \ | | | | | | | | 813| 605| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 605| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 821| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 821| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 413, False: 408] | | ------------------ | | 658| 413| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 413| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 413| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 413|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 413| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 413| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 413|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 413| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 413| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 413| do { \ | | | | | | | | | | | | | | | | 286| 413| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 413] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 413| !__same_type(*(ptr), void), \ | | | | | | | | 813| 413| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 413| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5872| 413| list_del(&inet6dev->head); 5873| 413| free(inet6dev); 5874| 413| } 5875| | 5876| 408| return 0; 5877| 605|} confile.c:set_config_net_veth_vlan_id: 666| 418|{ 667| 418| int ret; 668| 418| struct lxc_netdev *netdev = data; 669| | 670| 418| if (!netdev) ------------------ | Branch (670:6): [True: 0, False: 418] ------------------ 671| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 672| | 673| 418| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (673:6): [True: 4, False: 414] ------------------ 674| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 675| | 676| 414| if (lxc_config_value_empty(value)) ------------------ | Branch (676:6): [True: 0, False: 414] ------------------ 677| 0| return clr_config_net_veth_vlan_id(key, lxc_conf, data); 678| | 679| 414| if (strequal(value, "none")) { ------------------ | Branch (679:6): [True: 194, False: 220] ------------------ 680| 194| netdev->priv.veth_attr.vlan_id = BRIDGE_VLAN_NONE; ------------------ | | 596| 194|#define BRIDGE_VLAN_NONE -1 /* Bridge VLAN option set to "none". */ ------------------ 681| 220| } else { 682| 220| unsigned short vlan_id; 683| | 684| 220| ret = get_u16(&vlan_id, value, 0); 685| 220| if (ret < 0) ------------------ | Branch (685:7): [True: 2, False: 218] ------------------ 686| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 687| | 688| 218| if (vlan_id > BRIDGE_VLAN_ID_MAX) ------------------ | | 600| 218|#define BRIDGE_VLAN_ID_MAX 4094 /* Bridge VLAN MAX VLAN ID. */ ------------------ | Branch (688:7): [True: 5, False: 213] ------------------ 689| 5| return ret_errno(EINVAL); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 690| | 691| 213| netdev->priv.veth_attr.vlan_id = vlan_id; 692| 213| } 693| | 694| 407| netdev->priv.veth_attr.vlan_id_set = true; 695| 407| return 0; 696| 414|} confile.c:clr_config_net_veth_vlan_id: 5675| 392|{ 5676| 392| struct lxc_netdev *netdev = data; 5677| | 5678| 392| if (!netdev) ------------------ | Branch (5678:6): [True: 0, False: 392] ------------------ 5679| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5680| | 5681| 392| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5681:6): [True: 194, False: 198] ------------------ 5682| 194| return 0; 5683| | 5684| 198| netdev->priv.veth_attr.vlan_id = 0; 5685| 198| netdev->priv.veth_attr.vlan_id_set = false; 5686| | 5687| 198| return 0; 5688| 392|} confile.c:set_config_net_veth_vlan_tagged_id: 701| 1.08k|{ 702| 1.08k| __do_free struct lxc_list *list = NULL; ------------------ | | 69| 1.08k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.08k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 703| 1.08k| int ret; 704| 1.08k| unsigned short vlan_id; 705| 1.08k| struct lxc_netdev *netdev = data; 706| | 707| 1.08k| if (!netdev) ------------------ | Branch (707:6): [True: 0, False: 1.08k] ------------------ 708| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 709| | 710| 1.08k| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (710:6): [True: 5, False: 1.07k] ------------------ 711| 5| return ret_errno(EINVAL); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 712| | 713| 1.07k| if (lxc_config_value_empty(value)) ------------------ | Branch (713:6): [True: 0, False: 1.07k] ------------------ 714| 0| return clr_config_net_veth_vlan_tagged_id(key, lxc_conf, data); 715| | 716| 1.07k| ret = get_u16(&vlan_id, value, 0); 717| 1.07k| if (ret < 0) ------------------ | Branch (717:6): [True: 2, False: 1.07k] ------------------ 718| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 719| | 720| 1.07k| if (vlan_id > BRIDGE_VLAN_ID_MAX) ------------------ | | 600| 1.07k|#define BRIDGE_VLAN_ID_MAX 4094 /* Bridge VLAN MAX VLAN ID. */ ------------------ | Branch (720:6): [True: 4, False: 1.07k] ------------------ 721| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 722| | 723| 1.07k| list = lxc_list_new(); 724| 1.07k| if (!list) ------------------ | Branch (724:6): [True: 0, False: 1.07k] ------------------ 725| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 726| | 727| 1.07k| list->elem = UINT_TO_PTR(vlan_id); ------------------ | | 681| 1.07k|#define UINT_TO_PTR(u) ((void *) ((uintptr_t) (u))) ------------------ 728| | 729| 1.07k| lxc_list_add_tail(&netdev->priv.veth_attr.vlan_tagged_ids, move_ptr(list)); ------------------ | | 694| 1.07k| ({ \ | | 695| 1.07k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.07k| (ptr) = NULL; \ | | 697| 1.07k| __internal_ptr__; \ | | 698| 1.07k| }) ------------------ 730| | 731| 1.07k| return 0; 732| 1.07k|} confile.c:clr_config_net_veth_vlan_tagged_id: 5692| 707|{ 5693| 707| struct lxc_netdev *netdev = data; 5694| 707| struct lxc_list *cur, *next; 5695| | 5696| 707| if (!netdev) ------------------ | Branch (5696:6): [True: 0, False: 707] ------------------ 5697| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5698| | 5699| 707| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5699:6): [True: 197, False: 510] ------------------ 5700| 197| return 0; 5701| | 5702| 510| lxc_list_for_each_safe(cur, &netdev->priv.veth_attr.vlan_tagged_ids, next) { ------------------ | | 46| 510| for (__iterator = (__list)->next, __next = __iterator->next; \ | | 47| 1.01k| __iterator != __list; __iterator = __next, __next = __next->next) | | ------------------ | | | Branch (47:7): [True: 504, False: 510] | | ------------------ ------------------ 5703| 504| lxc_list_del(cur); 5704| 504| free(cur); 5705| 504| } 5706| | 5707| 510| return 0; 5708| 707|} confile.c:match_config_net_item: 380| 411k|{ 381| 411k| if (entry->strict) ------------------ | Branch (381:6): [True: 411k, False: 0] ------------------ 382| 411k| return strequal(entry->name, key); 383| 0| return strnequal(entry->name, key, strlen(entry->name)); 384| 411k|} parse_idmaps: 34| 2.38k|{ 35| 2.38k| __do_free char *dup = NULL; ------------------ | | 69| 2.38k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.38k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 36| 2.38k| int ret = -1; 37| 2.38k| unsigned long tmp_hostid, tmp_nsid, tmp_range; 38| 2.38k| char tmp_type; 39| 2.38k| char *window, *slide; 40| | 41| | /* Duplicate string. */ 42| 2.38k| dup = strdup(idmap); 43| 2.38k| if (!dup) ------------------ | Branch (43:6): [True: 0, False: 2.38k] ------------------ 44| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 45| | 46| | /* A prototypical idmap entry would be: "u 1000 1000000 65536" */ 47| | 48| | /* align */ 49| 2.38k| slide = window = dup; 50| | /* skip whitespace */ 51| 2.38k| slide += strspn(slide, " \t\r"); 52| 2.38k| if (slide != window && *slide == '\0') ------------------ | Branch (52:6): [True: 232, False: 2.15k] | Branch (52:25): [True: 7, False: 225] ------------------ 53| 7| return ret_errno(EINVAL); ------------------ | | 715| 7| ({ \ | | 716| 7| errno = labs(__errno__); \ | | 717| 7| -errno; \ | | 718| 7| }) ------------------ 54| | 55| | /* Validate type. */ 56| 2.37k| if (*slide != 'u' && *slide != 'g') ------------------ | Branch (56:6): [True: 1.42k, False: 958] | Branch (56:23): [True: 41, False: 1.37k] ------------------ 57| 41| return log_error_errno(-EINVAL, EINVAL, "Invalid id mapping type: %c", *slide); ------------------ | | 486| 41| ({ \ | | 487| 41| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 41| errno = (__errno__); \ | | 489| 41| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 41| do { \ | | | | 454| 41| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 41| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 41| char *ptr = NULL; \ | | | | | | 317| 41| { \ | | | | | | 318| 41| int __saved_errno = errno; \ | | | | | | 319| 41| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 41| errno = __saved_errno; \ | | | | | | 321| 41| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 41] | | | | | | ------------------ | | | | | | 322| 41| ptr = errno_buf; \ | | | | | | 323| 41| } | | | | ------------------ | | | | 455| 41| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 41|#define ERROR(format, ...) do { \ | | | | | | 373| 41| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 41| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 41| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 41|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 41] | | | | | | ------------------ | | | | ------------------ | | | | 456| 41| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 41] | | | | ------------------ | | ------------------ | | 490| 41| __internal_ret__; \ | | 491| 41| }) ------------------ 58| | 59| | /* Assign type. */ 60| 2.33k| tmp_type = *slide; 61| | 62| | /* move beyond type */ 63| 2.33k| slide++; 64| | /* align */ 65| 2.33k| window = slide; 66| | /* Validate that only whitespace follows. */ 67| 2.33k| slide += strspn(slide, " \t\r"); 68| | /* There must be whitespace. */ 69| 2.33k| if (slide == window) ------------------ | Branch (69:6): [True: 12, False: 2.32k] ------------------ 70| 12| return ret_errno(EINVAL); ------------------ | | 715| 12| ({ \ | | 716| 12| errno = labs(__errno__); \ | | 717| 12| -errno; \ | | 718| 12| }) ------------------ 71| | 72| | /* Mark beginning of nsid. */ 73| 2.32k| window = slide; 74| | /* Validate that non-whitespace follows. */ 75| 2.32k| slide += strcspn(slide, " \t\r"); 76| | /* There must be non-whitespace. */ 77| 2.32k| if (slide == window || *slide == '\0') ------------------ | Branch (77:6): [True: 3, False: 2.32k] | Branch (77:25): [True: 16, False: 2.30k] ------------------ 78| 19| return ret_errno(EINVAL); ------------------ | | 715| 19| ({ \ | | 716| 19| errno = labs(__errno__); \ | | 717| 19| -errno; \ | | 718| 19| }) ------------------ 79| | /* Mark end of nsid. */ 80| 2.30k| *slide = '\0'; 81| | 82| | /* Parse nsid. */ 83| 2.30k| ret = lxc_safe_ulong(window, &tmp_nsid); 84| 2.30k| if (ret < 0) ------------------ | Branch (84:6): [True: 31, False: 2.27k] ------------------ 85| 31| return log_error_errno(ret, errno, "Failed to parse nsid: %s", window); ------------------ | | 486| 31| ({ \ | | 487| 31| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 31| errno = (__errno__); \ | | 489| 31| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 31| do { \ | | | | 454| 31| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 31| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 31| char *ptr = NULL; \ | | | | | | 317| 31| { \ | | | | | | 318| 31| int __saved_errno = errno; \ | | | | | | 319| 31| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 31| errno = __saved_errno; \ | | | | | | 321| 31| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 31] | | | | | | ------------------ | | | | | | 322| 31| ptr = errno_buf; \ | | | | | | 323| 31| } | | | | ------------------ | | | | 455| 31| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 31|#define ERROR(format, ...) do { \ | | | | | | 373| 31| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 31| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 31| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 31|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 31] | | | | | | ------------------ | | | | ------------------ | | | | 456| 31| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 31] | | | | ------------------ | | ------------------ | | 490| 31| __internal_ret__; \ | | 491| 31| }) ------------------ 86| | 87| | /* Move beyond \0. */ 88| 2.27k| slide++; 89| | /* Validate that only whitespace follows. */ 90| 2.27k| slide += strspn(slide, " \t\r"); 91| | /* If there was only one whitespace then we whiped it with our \0 above. 92| | * So only ensure that we're not at the end of the string. 93| | */ 94| 2.27k| if (*slide == '\0') ------------------ | Branch (94:6): [True: 1, False: 2.27k] ------------------ 95| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 96| | 97| | /* Mark beginning of hostid. */ 98| 2.27k| window = slide; 99| | /* Validate that non-whitespace follows. */ 100| 2.27k| slide += strcspn(slide, " \t\r"); 101| | /* There must be non-whitespace. */ 102| 2.27k| if (slide == window || *slide == '\0') ------------------ | Branch (102:6): [True: 0, False: 2.27k] | Branch (102:25): [True: 23, False: 2.25k] ------------------ 103| 23| return ret_errno(EINVAL); ------------------ | | 715| 23| ({ \ | | 716| 23| errno = labs(__errno__); \ | | 717| 23| -errno; \ | | 718| 23| }) ------------------ 104| | /* Mark end of nsid. */ 105| 2.25k| *slide = '\0'; 106| | 107| | /* Parse hostid. */ 108| 2.25k| ret = lxc_safe_ulong(window, &tmp_hostid); 109| 2.25k| if (ret < 0) ------------------ | Branch (109:6): [True: 8, False: 2.24k] ------------------ 110| 8| return log_error_errno(ret, errno, "Failed to parse hostid: %s", window); ------------------ | | 486| 8| ({ \ | | 487| 8| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 8| errno = (__errno__); \ | | 489| 8| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 8| do { \ | | | | 454| 8| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 8| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 8| char *ptr = NULL; \ | | | | | | 317| 8| { \ | | | | | | 318| 8| int __saved_errno = errno; \ | | | | | | 319| 8| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 8| errno = __saved_errno; \ | | | | | | 321| 8| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 8] | | | | | | ------------------ | | | | | | 322| 8| ptr = errno_buf; \ | | | | | | 323| 8| } | | | | ------------------ | | | | 455| 8| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 8|#define ERROR(format, ...) do { \ | | | | | | 373| 8| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 8| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 8| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 8|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 8] | | | | | | ------------------ | | | | ------------------ | | | | 456| 8| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 8] | | | | ------------------ | | ------------------ | | 490| 8| __internal_ret__; \ | | 491| 8| }) ------------------ 111| | 112| | /* Move beyond \0. */ 113| 2.24k| slide++; 114| | /* Validate that only whitespace follows. */ 115| 2.24k| slide += strspn(slide, " \t\r"); 116| | /* If there was only one whitespace then we whiped it with our \0 above. 117| | * So only ensure that we're not at the end of the string. 118| | */ 119| 2.24k| if (*slide == '\0') ------------------ | Branch (119:6): [True: 1, False: 2.24k] ------------------ 120| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 121| | 122| | /* Mark beginning of range. */ 123| 2.24k| window = slide; 124| | /* Validate that non-whitespace follows. */ 125| 2.24k| slide += strcspn(slide, " \t\r"); 126| | /* There must be non-whitespace. */ 127| 2.24k| if (slide == window) ------------------ | Branch (127:6): [True: 0, False: 2.24k] ------------------ 128| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 129| | 130| | /* The range is the last valid entry we expect. So make sure that there 131| | * is no trailing garbage and if there is, error out. 132| | */ 133| 2.24k| if (*(slide + strspn(slide, " \t\r\n")) != '\0') ------------------ | Branch (133:6): [True: 7, False: 2.23k] ------------------ 134| 7| return ret_errno(EINVAL); ------------------ | | 715| 7| ({ \ | | 716| 7| errno = labs(__errno__); \ | | 717| 7| -errno; \ | | 718| 7| }) ------------------ 135| | 136| | /* Mark end of range. */ 137| 2.23k| *slide = '\0'; 138| | 139| | /* Parse range. */ 140| 2.23k| ret = lxc_safe_ulong(window, &tmp_range); 141| 2.23k| if (ret < 0) ------------------ | Branch (141:6): [True: 5, False: 2.23k] ------------------ 142| 5| return log_error_errno(ret, errno, "Failed to parse id mapping range: %s", window); ------------------ | | 486| 5| ({ \ | | 487| 5| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 5| errno = (__errno__); \ | | 489| 5| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 5| do { \ | | | | 454| 5| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 5| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 5| char *ptr = NULL; \ | | | | | | 317| 5| { \ | | | | | | 318| 5| int __saved_errno = errno; \ | | | | | | 319| 5| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 5| errno = __saved_errno; \ | | | | | | 321| 5| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 5] | | | | | | ------------------ | | | | | | 322| 5| ptr = errno_buf; \ | | | | | | 323| 5| } | | | | ------------------ | | | | 455| 5| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 5|#define ERROR(format, ...) do { \ | | | | | | 373| 5| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 5| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 5| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 5|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 5] | | | | | | ------------------ | | | | ------------------ | | | | 456| 5| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 5] | | | | ------------------ | | ------------------ | | 490| 5| __internal_ret__; \ | | 491| 5| }) ------------------ 143| | 144| 2.23k| *type = tmp_type; 145| 2.23k| *nsid = tmp_nsid; 146| 2.23k| *hostid = tmp_hostid; 147| 2.23k| *range = tmp_range; 148| | 149| | /* Yay, we survived. */ 150| 2.23k| return 0; 151| 2.23k|} lxc_config_value_empty: 154| 138k|{ 155| 138k| if (value && strlen(value) > 0) ------------------ | Branch (155:6): [True: 138k, False: 0] | Branch (155:15): [True: 103k, False: 34.5k] ------------------ 156| 103k| return false; 157| | 158| 34.5k| return true; 159| 138k|} lxc_get_netdev_by_idx: 189| 32.5k|{ 190| 32.5k| struct list_head *netdevs = &conf->netdevs; 191| 32.5k| struct list_head *head = netdevs; 192| 32.5k| struct lxc_netdev *netdev; 193| | 194| | /* lookup network */ 195| 32.5k| if (!list_empty(netdevs)) { ------------------ | Branch (195:6): [True: 29.2k, False: 3.29k] ------------------ 196| 33.3k| list_for_each_entry(netdev, netdevs, head) { ------------------ | | 568| 29.2k| for (pos = list_first_entry(head, typeof(*pos), member); \ | | ------------------ | | | | 462| 29.2k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 29.2k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 29.2k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 29.2k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 29.2k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 29.2k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 29.2k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 29.2k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 29.2k| do { \ | | | | | | | | | | | | | | | | 286| 29.2k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 29.2k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 29.2k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 29.2k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 29.2k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 569| 34.1k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 34.1k| (&pos->member == (head)) | | ------------------ | | | Branch (569:7): [True: 33.3k, False: 736] | | ------------------ | | 570| 29.2k| pos = list_next_entry(pos, member)) | | ------------------ | | | | 495| 4.88k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 4.88k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 4.88k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 4.88k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 4.88k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 4.88k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 4.88k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 4.88k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 4.88k| do { \ | | | | | | | | | | | | | | | | 286| 4.88k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 4.88k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 4.88k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 4.88k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 4.88k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 197| | /* found network device */ 198| 33.3k| if (netdev->idx == idx) ------------------ | Branch (198:8): [True: 27.3k, False: 6.08k] ------------------ 199| 27.3k| return netdev; 200| | 201| 6.08k| if (netdev->idx > idx) { ------------------ | Branch (201:8): [True: 1.20k, False: 4.88k] ------------------ 202| 1.20k| head = &netdev->head; 203| 1.20k| break; 204| 1.20k| } 205| 6.08k| } 206| 29.2k| } 207| | 208| 5.23k| if (allocate) ------------------ | Branch (208:6): [True: 5.21k, False: 13] ------------------ 209| 5.21k| return lxc_network_add(head, idx, true); 210| | 211| 13| return NULL; 212| 5.23k|} lxc_clear_netdev: 393| 9.57k|{ 394| 9.57k| struct lxc_list *cur, *next; 395| 9.57k| struct list_head head; 396| 9.57k| struct lxc_inetdev *inetdev, *ninetdev; 397| 9.57k| struct lxc_inet6dev *inet6dev, *ninet6dev; 398| 9.57k| ssize_t idx; 399| | 400| 9.57k| if (!netdev) ------------------ | Branch (400:6): [True: 0, False: 9.57k] ------------------ 401| 0| return; 402| | 403| 9.57k| idx = netdev->idx; 404| | 405| 9.57k| free_disarm(netdev->upscript); ------------------ | | 58| 9.57k| ({ \ | | 59| 9.57k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 224, False: 9.35k] | | ------------------ | | 60| 224| free(ptr); \ | | 61| 224| ptr = NULL; \ | | 62| 224| } \ | | 63| 9.57k| }) ------------------ 406| 9.57k| free_disarm(netdev->downscript); ------------------ | | 58| 9.57k| ({ \ | | 59| 9.57k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 218, False: 9.35k] | | ------------------ | | 60| 218| free(ptr); \ | | 61| 218| ptr = NULL; \ | | 62| 218| } \ | | 63| 9.57k| }) ------------------ 407| 9.57k| free_disarm(netdev->hwaddr); ------------------ | | 58| 9.57k| ({ \ | | 59| 9.57k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 256, False: 9.31k] | | ------------------ | | 60| 256| free(ptr); \ | | 61| 256| ptr = NULL; \ | | 62| 256| } \ | | 63| 9.57k| }) ------------------ 408| 9.57k| free_disarm(netdev->mtu); ------------------ | | 58| 9.57k| ({ \ | | 59| 9.57k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 1.09k, False: 8.48k] | | ------------------ | | 60| 1.09k| free(ptr); \ | | 61| 1.09k| ptr = NULL; \ | | 62| 1.09k| } \ | | 63| 9.57k| }) ------------------ 409| | 410| 9.57k| free_disarm(netdev->ipv4_gateway); ------------------ | | 58| 9.57k| ({ \ | | 59| 9.57k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 197, False: 9.37k] | | ------------------ | | 60| 197| free(ptr); \ | | 61| 197| ptr = NULL; \ | | 62| 197| } \ | | 63| 9.57k| }) ------------------ 411| 9.57k| list_for_each_entry_safe(inetdev, ninetdev, &netdev->ipv4_addresses, head) { ------------------ | | 655| 9.57k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 9.57k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 9.57k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 9.57k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 9.57k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 9.57k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 9.57k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 9.57k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 9.57k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 9.57k| do { \ | | | | | | | | | | | | | | | | 286| 9.57k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 9.57k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 9.57k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 9.57k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 9.57k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 9.57k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 9.57k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 9.57k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 9.57k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 9.57k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 9.57k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 9.57k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 9.57k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 9.57k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 9.57k| do { \ | | | | | | | | | | | | | | | | 286| 9.57k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 9.57k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 9.57k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 9.57k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 9.57k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 11.1k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 11.1k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.61k, False: 9.57k] | | ------------------ | | 658| 9.57k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.61k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.61k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.61k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.61k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.61k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.61k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.61k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.61k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.61k| do { \ | | | | | | | | | | | | | | | | 286| 1.61k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.61k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.61k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.61k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.61k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 412| 1.61k| list_del(&inetdev->head); 413| 1.61k| free(inetdev); 414| 1.61k| } 415| | 416| 9.57k| free_disarm(netdev->ipv6_gateway); ------------------ | | 58| 9.57k| ({ \ | | 59| 9.57k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 221, False: 9.35k] | | ------------------ | | 60| 221| free(ptr); \ | | 61| 221| ptr = NULL; \ | | 62| 221| } \ | | 63| 9.57k| }) ------------------ 417| 9.57k| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->ipv6_addresses, head) { ------------------ | | 655| 9.57k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 9.57k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 9.57k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 9.57k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 9.57k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 9.57k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 9.57k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 9.57k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 9.57k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 9.57k| do { \ | | | | | | | | | | | | | | | | 286| 9.57k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 9.57k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 9.57k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 9.57k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 9.57k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 9.57k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 9.57k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 9.57k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 9.57k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 9.57k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 9.57k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 9.57k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 9.57k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 9.57k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 9.57k| do { \ | | | | | | | | | | | | | | | | 286| 9.57k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 9.57k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 9.57k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 9.57k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 9.57k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 10.2k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 10.2k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 633, False: 9.57k] | | ------------------ | | 658| 9.57k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 633| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 633| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 633|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 633| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 633| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 633|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 633| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 633| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 633| do { \ | | | | | | | | | | | | | | | | 286| 633| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 633] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 633| !__same_type(*(ptr), void), \ | | | | | | | | 813| 633| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 633| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 418| 633| list_del(&inet6dev->head); 419| 633| free(inet6dev); 420| 633| } 421| | 422| 9.57k| if (netdev->type == LXC_NET_VETH) { ------------------ | Branch (422:6): [True: 1.29k, False: 8.27k] ------------------ 423| 1.29k| list_for_each_entry_safe(inetdev, ninetdev, &netdev->priv.veth_attr.ipv4_routes, head) { ------------------ | | 655| 1.29k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 1.29k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 1.29k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.29k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.29k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.29k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.29k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.29k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.29k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.29k| do { \ | | | | | | | | | | | | | | | | 286| 1.29k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.29k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.29k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.29k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.29k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 1.29k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 1.29k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.29k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.29k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.29k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.29k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.29k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.29k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.29k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.29k| do { \ | | | | | | | | | | | | | | | | 286| 1.29k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.29k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.29k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.29k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.29k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 1.92k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 1.92k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 628, False: 1.29k] | | ------------------ | | 658| 1.29k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 628| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 628| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 628|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 628| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 628| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 628|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 628| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 628| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 628| do { \ | | | | | | | | | | | | | | | | 286| 628| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 628] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 628| !__same_type(*(ptr), void), \ | | | | | | | | 813| 628| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 628| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 424| 628| list_del(&inetdev->head); 425| 628| free(inetdev); 426| 628| } 427| | 428| 1.29k| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->priv.veth_attr.ipv6_routes, head) { ------------------ | | 655| 1.29k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 1.29k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 1.29k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.29k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.29k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.29k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.29k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.29k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.29k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.29k| do { \ | | | | | | | | | | | | | | | | 286| 1.29k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.29k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.29k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.29k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.29k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 1.29k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 1.29k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.29k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.29k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.29k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.29k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.29k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.29k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.29k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.29k| do { \ | | | | | | | | | | | | | | | | 286| 1.29k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.29k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.29k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.29k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.29k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 1.94k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 1.94k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 644, False: 1.29k] | | ------------------ | | 658| 1.29k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 644| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 644| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 644|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 644| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 644| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 644|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 644| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 644| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 644| do { \ | | | | | | | | | | | | | | | | 286| 644| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 644] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 644| !__same_type(*(ptr), void), \ | | | | | | | | 813| 644| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 644| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 429| 644| list_del(&inet6dev->head); 430| 644| free(inet6dev); 431| 644| } 432| | 433| 1.29k| lxc_list_for_each_safe(cur, &netdev->priv.veth_attr.vlan_tagged_ids, next) { ------------------ | | 46| 1.29k| for (__iterator = (__list)->next, __next = __iterator->next; \ | | 47| 1.86k| __iterator != __list; __iterator = __next, __next = __next->next) | | ------------------ | | | Branch (47:7): [True: 567, False: 1.29k] | | ------------------ ------------------ 434| 567| lxc_list_del(cur); 435| 567| free(cur); 436| 567| } 437| 8.27k| } else if (netdev->type == LXC_NET_PHYS) { ------------------ | Branch (437:13): [True: 997, False: 7.28k] ------------------ 438| 997| free_string_list(netdev->priv.phys_attr.altnames); 439| 997| netdev->priv.phys_attr.altnames = NULL; 440| 997| } 441| | 442| 9.57k| head = netdev->head; 443| 9.57k| memset(netdev, 0, sizeof(struct lxc_netdev)); 444| 9.57k| netdev->head = head; 445| 9.57k| INIT_LIST_HEAD(&netdev->ipv4_addresses); 446| 9.57k| INIT_LIST_HEAD(&netdev->ipv6_addresses); 447| 9.57k| netdev->type = -1; 448| 9.57k| netdev->idx = idx; 449| 9.57k|} lxc_remove_nic_by_idx: 460| 946|{ 461| 946| struct lxc_netdev *netdev; 462| | 463| 946| if (list_empty(&conf->netdevs)) ------------------ | Branch (463:6): [True: 278, False: 668] ------------------ 464| 278| return false; 465| | 466| 846| list_for_each_entry(netdev, &conf->netdevs, head) { ------------------ | | 568| 946| for (pos = list_first_entry(head, typeof(*pos), member); \ | | ------------------ | | | | 462| 946| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 946| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 946|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 946| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 946| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 668|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 668| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 668| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 668| do { \ | | | | | | | | | | | | | | | | 286| 668| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 668] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 946| !__same_type(*(ptr), void), \ | | | | | | | | 813| 946| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 946| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 569| 1.08k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 1.08k| (&pos->member == (head)) | | ------------------ | | | Branch (569:7): [True: 846, False: 242] | | ------------------ | | 570| 668| pos = list_next_entry(pos, member)) | | ------------------ | | | | 495| 420| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 420| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 420|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 420| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 420| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 420|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 420| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 420| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 420| do { \ | | | | | | | | | | | | | | | | 286| 420| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 420] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 420| !__same_type(*(ptr), void), \ | | | | | | | | 813| 420| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 420| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 467| 846| if (netdev->idx != idx) ------------------ | Branch (467:7): [True: 420, False: 426] ------------------ 468| 420| continue; 469| | 470| 426| list_del(&netdev->head); 471| 426| lxc_free_netdev(netdev); 472| 426| return true; 473| 846| } 474| | 475| 242| return false; 476| 668|} lxc_free_networks: 479| 13.3k|{ 480| 13.3k| struct lxc_netdev *netdev, *n; 481| | 482| 13.3k| if (list_empty(&conf->netdevs)) ------------------ | Branch (482:6): [True: 10.4k, False: 2.90k] ------------------ 483| 10.4k| return; 484| | 485| 4.79k| list_for_each_entry_safe(netdev, n, &conf->netdevs, head) { ------------------ | | 655| 2.90k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 2.90k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 2.90k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.90k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.90k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.90k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.90k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.90k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.90k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.90k| do { \ | | | | | | | | | | | | | | | | 286| 2.90k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.90k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.90k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.90k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.90k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 13.3k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 13.3k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 13.3k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.3k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.3k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.3k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.90k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.90k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.90k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.90k| do { \ | | | | | | | | | | | | | | | | 286| 2.90k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.90k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.3k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.3k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.3k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 7.69k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 7.69k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 4.79k, False: 2.90k] | | ------------------ | | 658| 4.79k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 4.79k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 4.79k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 4.79k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 4.79k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 4.79k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 4.79k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 4.79k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 4.79k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 4.79k| do { \ | | | | | | | | | | | | | | | | 286| 4.79k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 4.79k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 4.79k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 4.79k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 4.79k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 486| 4.79k| list_del(&netdev->head); 487| 4.79k| lxc_free_netdev(netdev); 488| 4.79k| } 489| | 490| | /* prevent segfaults */ 491| 2.90k| INIT_LIST_HEAD(&conf->netdevs); 492| 2.90k|} lxc_veth_mode_to_flag: 503| 1.53k|{ 504| 1.81k| for (size_t i = 0; i < sizeof(veth_mode) / sizeof(veth_mode[0]); i++) { ------------------ | Branch (504:21): [True: 1.76k, False: 50] ------------------ 505| 1.76k| if (!strequal(veth_mode[i].name, value)) ------------------ | Branch (505:7): [True: 286, False: 1.48k] ------------------ 506| 286| continue; 507| | 508| 1.48k| *mode = veth_mode[i].mode; 509| 1.48k| return 0; 510| 1.76k| } 511| | 512| 50| return ret_errno(EINVAL); ------------------ | | 715| 50| ({ \ | | 716| 50| errno = labs(__errno__); \ | | 717| 50| -errno; \ | | 718| 50| }) ------------------ 513| 1.53k|} lxc_veth_flag_to_mode: 516| 1.29k|{ 517| 3.88k| for (size_t i = 0; i < sizeof(veth_mode) / sizeof(veth_mode[0]); i++) { ------------------ | Branch (517:21): [True: 2.59k, False: 1.29k] ------------------ 518| 2.59k| if (veth_mode[i].mode != mode) ------------------ | Branch (518:7): [True: 2.59k, False: 0] ------------------ 519| 2.59k| continue; 520| | 521| 0| return veth_mode[i].name; 522| 2.59k| } 523| | 524| 1.29k| return ret_set_errno(NULL, EINVAL); ------------------ | | 708| 1.29k| ({ \ | | 709| 1.29k| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 710| 1.29k| errno = (__errno__); \ | | 711| 1.29k| __internal_ret__; \ | | 712| 1.29k| }) ------------------ 525| 1.29k|} lxc_macvlan_mode_to_flag: 538| 907|{ 539| 1.49k| for (size_t i = 0; i < sizeof(macvlan_mode) / sizeof(macvlan_mode[0]); i++) { ------------------ | Branch (539:21): [True: 1.44k, False: 56] ------------------ 540| 1.44k| if (!strequal(macvlan_mode[i].name, value)) ------------------ | Branch (540:7): [True: 590, False: 851] ------------------ 541| 590| continue; 542| | 543| 851| *mode = macvlan_mode[i].mode; 544| 851| return 0; 545| 1.44k| } 546| | 547| 56| return ret_errno(EINVAL); ------------------ | | 715| 56| ({ \ | | 716| 56| errno = labs(__errno__); \ | | 717| 56| -errno; \ | | 718| 56| }) ------------------ 548| 907|} lxc_macvlan_flag_to_mode: 551| 604|{ 552| 3.02k| for (size_t i = 0; i < sizeof(macvlan_mode) / sizeof(macvlan_mode[0]); i++) { ------------------ | Branch (552:21): [True: 2.41k, False: 604] ------------------ 553| 2.41k| if (macvlan_mode[i].mode != mode) ------------------ | Branch (553:7): [True: 2.41k, False: 0] ------------------ 554| 2.41k| continue; 555| | 556| 0| return macvlan_mode[i].name; 557| 2.41k| } 558| | 559| 604| return ret_set_errno(NULL, EINVAL); ------------------ | | 708| 604| ({ \ | | 709| 604| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 710| 604| errno = (__errno__); \ | | 711| 604| __internal_ret__; \ | | 712| 604| }) ------------------ 560| 604|} lxc_ipvlan_mode_to_flag: 572| 321|{ 573| 945| for (size_t i = 0; i < sizeof(ipvlan_mode) / sizeof(ipvlan_mode[0]); i++) { ------------------ | Branch (573:21): [True: 917, False: 28] ------------------ 574| 917| if (!strequal(ipvlan_mode[i].name, value)) ------------------ | Branch (574:7): [True: 624, False: 293] ------------------ 575| 624| continue; 576| | 577| 293| *mode = ipvlan_mode[i].mode; 578| 293| return 0; 579| 917| } 580| | 581| 28| return ret_errno(EINVAL); ------------------ | | 715| 28| ({ \ | | 716| 28| errno = labs(__errno__); \ | | 717| 28| -errno; \ | | 718| 28| }) ------------------ 582| 321|} lxc_ipvlan_flag_to_mode: 585| 386|{ 586| 1.15k| for (size_t i = 0; i < sizeof(ipvlan_mode) / sizeof(ipvlan_mode[0]); i++) { ------------------ | Branch (586:21): [True: 1.15k, False: 0] ------------------ 587| 1.15k| if (ipvlan_mode[i].mode != mode) ------------------ | Branch (587:7): [True: 772, False: 386] ------------------ 588| 772| continue; 589| | 590| 386| return ipvlan_mode[i].name; 591| 1.15k| } 592| | 593| 0| return ret_set_errno(NULL, EINVAL); ------------------ | | 708| 0| ({ \ | | 709| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 710| 0| errno = (__errno__); \ | | 711| 0| __internal_ret__; \ | | 712| 0| }) ------------------ 594| 386|} lxc_ipvlan_isolation_to_flag: 606| 320|{ 607| 1.01k| for (size_t i = 0; i < sizeof(ipvlan_isolation) / sizeof(ipvlan_isolation[0]); i++) { ------------------ | Branch (607:21): [True: 958, False: 54] ------------------ 608| 958| if (!strequal(ipvlan_isolation[i].name, value)) ------------------ | Branch (608:7): [True: 692, False: 266] ------------------ 609| 692| continue; 610| | 611| 266| *flag = ipvlan_isolation[i].flag; 612| 266| return 0; 613| 958| } 614| | 615| 54| return ret_errno(EINVAL); ------------------ | | 715| 54| ({ \ | | 716| 54| errno = labs(__errno__); \ | | 717| 54| -errno; \ | | 718| 54| }) ------------------ 616| 320|} lxc_ipvlan_flag_to_isolation: 619| 386|{ 620| 386| for (size_t i = 0; i < sizeof(ipvlan_isolation) / sizeof(ipvlan_isolation[0]); i++) { ------------------ | Branch (620:21): [True: 386, False: 0] ------------------ 621| 386| if (ipvlan_isolation[i].flag != flag) ------------------ | Branch (621:7): [True: 0, False: 386] ------------------ 622| 0| continue; 623| | 624| 386| return ipvlan_isolation[i].name; 625| 386| } 626| | 627| 0| return ret_set_errno(NULL, EINVAL); ------------------ | | 708| 0| ({ \ | | 709| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 710| 0| errno = (__errno__); \ | | 711| 0| __internal_ret__; \ | | 712| 0| }) ------------------ 628| 386|} set_config_string_item: 631| 14.6k|{ 632| 14.6k| char *new_value; 633| | 634| 14.6k| if (lxc_config_value_empty(value)) { ------------------ | Branch (634:6): [True: 1.68k, False: 12.9k] ------------------ 635| 1.68k| free_disarm(*conf_item); ------------------ | | 58| 1.68k| ({ \ | | 59| 1.68k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 475, False: 1.21k] | | ------------------ | | 60| 475| free(ptr); \ | | 61| 475| ptr = NULL; \ | | 62| 475| } \ | | 63| 1.68k| }) ------------------ 636| 1.68k| return 0; 637| 1.68k| } 638| | 639| 12.9k| new_value = strdup(value); 640| 12.9k| if (!new_value) ------------------ | Branch (640:6): [True: 0, False: 12.9k] ------------------ 641| 0| return log_error_errno(-ENOMEM, ENOMEM, "Failed to duplicate string \"%s\"", value); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 642| | 643| 12.9k| free_move_ptr(*conf_item, new_value); ------------------ | | 93| 12.9k| ({ \ | | 94| 12.9k| free(a); \ | | 95| 12.9k| (a) = move_ptr((b)); \ | | ------------------ | | | | 694| 12.9k| ({ \ | | | | 695| 12.9k| typeof(ptr) __internal_ptr__ = (ptr); \ | | | | 696| 12.9k| (ptr) = NULL; \ | | | | 697| 12.9k| __internal_ptr__; \ | | | | 698| 12.9k| }) | | ------------------ | | 96| 12.9k| }) ------------------ 644| 12.9k| return 0; 645| 12.9k|} set_config_string_item_max: 648| 6.32k|{ 649| 6.32k| if (strlen(value) >= max) ------------------ | Branch (649:6): [True: 25, False: 6.29k] ------------------ 650| 25| return log_error_errno(-ENAMETOOLONG, ENAMETOOLONG, "%s is too long (>= %lu)", value, (unsigned long)max); ------------------ | | 486| 25| ({ \ | | 487| 25| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 25| errno = (__errno__); \ | | 489| 25| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 25| do { \ | | | | 454| 25| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 25| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 25| char *ptr = NULL; \ | | | | | | 317| 25| { \ | | | | | | 318| 25| int __saved_errno = errno; \ | | | | | | 319| 25| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 25| errno = __saved_errno; \ | | | | | | 321| 25| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 25] | | | | | | ------------------ | | | | | | 322| 25| ptr = errno_buf; \ | | | | | | 323| 25| } | | | | ------------------ | | | | 455| 25| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 25|#define ERROR(format, ...) do { \ | | | | | | 373| 25| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 25| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 25| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 25|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 25] | | | | | | ------------------ | | | | ------------------ | | | | 456| 25| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 25] | | | | ------------------ | | ------------------ | | 490| 25| __internal_ret__; \ | | 491| 25| }) ------------------ 651| | 652| 6.29k| return set_config_string_item(conf_item, value); 653| 6.32k|} set_config_path_item: 656| 6.10k|{ 657| 6.10k| __do_free char *valdup = NULL; ------------------ | | 69| 6.10k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 6.10k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 658| | 659| 6.10k| valdup = lxc_path_simplify(value); 660| 6.10k| if (!valdup) ------------------ | Branch (660:6): [True: 0, False: 6.10k] ------------------ 661| 0| return -ENOMEM; 662| | 663| 6.10k| return set_config_string_item_max(conf_item, valdup, PATH_MAX); 664| 6.10k|} set_config_bool_item: 667| 708|{ 668| 708| int ret; 669| 708| unsigned int val = 0; 670| | 671| 708| if (lxc_config_value_empty(value)) { ------------------ | Branch (671:6): [True: 204, False: 504] ------------------ 672| 204| *conf_item = empty_conf_action; 673| 204| return 0; 674| 204| } 675| | 676| 504| ret = lxc_safe_uint(value, &val); 677| 504| if (ret < 0) ------------------ | Branch (677:6): [True: 7, False: 497] ------------------ 678| 7| return ret; 679| | 680| 497| switch (val) { ------------------ | Branch (680:10): [True: 496, False: 1] ------------------ 681| 300| case 0: ------------------ | Branch (681:2): [True: 300, False: 197] ------------------ 682| 300| *conf_item = false; 683| 300| return 0; 684| 196| case 1: ------------------ | Branch (684:2): [True: 196, False: 301] ------------------ 685| 196| *conf_item = true; 686| 196| return 0; 687| 497| } 688| | 689| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 690| 497|} config_ip_prefix: 693| 1.85k|{ 694| 1.85k| if (IN_CLASSA(addr->s_addr)) ------------------ | Branch (694:6): [True: 1.07k, False: 785] ------------------ 695| 1.07k| return 32 - IN_CLASSA_NSHIFT; 696| | 697| 785| if (IN_CLASSB(addr->s_addr)) ------------------ | Branch (697:6): [True: 236, False: 549] ------------------ 698| 236| return 32 - IN_CLASSB_NSHIFT; 699| | 700| 549| if (IN_CLASSC(addr->s_addr)) ------------------ | Branch (700:6): [True: 325, False: 224] ------------------ 701| 325| return 32 - IN_CLASSC_NSHIFT; 702| | 703| 224| return 0; 704| 549|} network_ifname: 707| 2.31k|{ 708| 2.31k| size_t retlen; 709| | 710| 2.31k| if (!valuep || !value) ------------------ | Branch (710:6): [True: 0, False: 2.31k] | Branch (710:17): [True: 0, False: 2.31k] ------------------ 711| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 712| | 713| 2.31k| retlen = strlcpy(valuep, value, size); 714| 2.31k| if (retlen >= size) ------------------ | Branch (714:6): [True: 290, False: 2.02k] ------------------ 715| 290| ERROR("Network device name \"%s\" is too long (>= %zu)", value, size); ------------------ | | 372| 290|#define ERROR(format, ...) do { \ | | 373| 290| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 290| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 290| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 290|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 290] | | ------------------ ------------------ 716| | 717| 2.31k| return 0; 718| 2.31k|} lxc_config_net_is_hwaddr: 721| 122k|{ 722| 122k| unsigned index; 723| 122k| char tmp[7]; 724| | 725| 122k| if (!strnequal(line, "lxc.net", 7)) ------------------ | Branch (725:6): [True: 86.7k, False: 35.5k] ------------------ 726| 86.7k| return false; 727| | 728| 35.5k| if (strnequal(line, "lxc.net.hwaddr", 14)) ------------------ | Branch (728:6): [True: 75, False: 35.4k] ------------------ 729| 75| return true; 730| | 731| 35.4k| if (strnequal(line, "lxc.network.hwaddr", 18)) ------------------ | Branch (731:6): [True: 1, False: 35.4k] ------------------ 732| 1| return true; 733| | 734| 35.4k| if (sscanf(line, "lxc.net.%u.%6s", &index, tmp) == 2 || ------------------ | Branch (734:6): [True: 32.4k, False: 2.95k] ------------------ 735| 2.95k| sscanf(line, "lxc.network.%u.%6s", &index, tmp) == 2) ------------------ | Branch (735:6): [True: 1, False: 2.95k] ------------------ 736| 32.4k| return strnequal(tmp, "hwaddr", 6); 737| | 738| 2.95k| return false; 739| 35.4k|} rand_complete_hwaddr: 742| 1.94k|{ 743| 1.94k| const char hex[] = "0123456789abcdef"; 744| 1.94k| char *curs = hwaddr; 745| 1.94k|#ifdef HAVE_RAND_R 746| 1.94k| unsigned int seed; 747| | 748| 1.94k| seed = randseed(false); 749| |#else 750| | 751| | (void)randseed(true); 752| |#endif 753| | 754| 269k| while (*curs != '\0' && *curs != '\n') { ------------------ | Branch (754:9): [True: 267k, False: 1.94k] | Branch (754:26): [True: 267k, False: 0] ------------------ 755| 267k| if (*curs == 'x' || *curs == 'X') { ------------------ | Branch (755:7): [True: 83.8k, False: 183k] | Branch (755:23): [True: 2.90k, False: 180k] ------------------ 756| 86.7k| if (curs - hwaddr == 1) { ------------------ | Branch (756:8): [True: 229, False: 86.5k] ------------------ 757| | /* ensure address is unicast */ 758| 229|#ifdef HAVE_RAND_R 759| 229| *curs = hex[rand_r(&seed) & 0x0E]; 760| 86.5k| } else { 761| 86.5k| *curs = hex[rand_r(&seed) & 0x0F]; 762| |#else 763| | *curs = hex[rand() & 0x0E]; 764| | } else { 765| | *curs = hex[rand() & 0x0F]; 766| |#endif 767| 86.5k| } 768| 86.7k| } 769| 267k| curs++; 770| 267k| } 771| 1.94k|} sig_parse: 1064| 1.79k|{ 1065| 1.79k| if (isdigit(*signame)) ------------------ | Branch (1065:6): [True: 924, False: 868] ------------------ 1066| 924| return sig_num(signame); 1067| | 1068| 868| if (strncasecmp(signame, "sig", STRLITERALLEN("sig")) == 0) { ------------------ | | 687| 868|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1068:6): [True: 825, False: 43] ------------------ 1069| 825| signame += STRLITERALLEN("sig"); ------------------ | | 687| 825|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1070| 825| if (strncasecmp(signame, "rt", STRLITERALLEN("rt")) == 0) ------------------ | | 687| 825|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1070:7): [True: 553, False: 272] ------------------ 1071| 553| return rt_sig_num(signame + STRLITERALLEN("rt")); ------------------ | | 687| 553|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1072| | 1073| 8.56k| for (size_t n = 0; n < ARRAY_SIZE(signames); n++) ------------------ | | 728| 8.56k| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 8.56k| typeof(&*(x))), \ | | 730| 8.56k| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (1073:22): [True: 8.49k, False: 68] ------------------ 1074| 8.49k| if (strcasecmp(signames[n].name, signame) == 0) ------------------ | Branch (1074:8): [True: 204, False: 8.29k] ------------------ 1075| 204| return signames[n].num; 1076| 272| } 1077| | 1078| 111| return ret_errno(EINVAL); ------------------ | | 715| 111| ({ \ | | 716| 111| errno = labs(__errno__); \ | | 717| 111| -errno; \ | | 718| 111| }) ------------------ 1079| 868|} confile_utils.c:lxc_network_add: 162| 5.21k|{ 163| 5.21k| __do_free struct lxc_netdev *netdev = NULL; ------------------ | | 69| 5.21k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 5.21k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 164| | 165| | /* network does not exist */ 166| 5.21k| netdev = zalloc(sizeof(*netdev)); ------------------ | | 90| 5.21k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 167| 5.21k| if (!netdev) ------------------ | Branch (167:6): [True: 0, False: 5.21k] ------------------ 168| 0| return ret_set_errno(NULL, ENOMEM); ------------------ | | 708| 0| ({ \ | | 709| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 710| 0| errno = (__errno__); \ | | 711| 0| __internal_ret__; \ | | 712| 0| }) ------------------ 169| | 170| 5.21k| INIT_LIST_HEAD(&netdev->ipv4_addresses); 171| 5.21k| INIT_LIST_HEAD(&netdev->ipv6_addresses); 172| | 173| | /* give network a unique index */ 174| 5.21k| netdev->idx = idx; 175| | 176| 5.21k| if (tail) ------------------ | Branch (176:6): [True: 5.21k, False: 0] ------------------ 177| 5.21k| list_add_tail(&netdev->head, head); 178| 0| else 179| 0| list_add(&netdev->head, head); 180| | 181| | return move_ptr(netdev); ------------------ | | 694| 5.21k| ({ \ | | 695| 5.21k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 5.21k| (ptr) = NULL; \ | | 697| 5.21k| __internal_ptr__; \ | | 698| 5.21k| }) ------------------ 182| 5.21k|} confile_utils.c:lxc_free_netdev: 452| 5.21k|{ 453| 5.21k| if (netdev) { ------------------ | Branch (453:6): [True: 5.21k, False: 0] ------------------ 454| 5.21k| lxc_clear_netdev(netdev); 455| 5.21k| free(netdev); 456| 5.21k| } 457| 5.21k|} confile_utils.c:sig_num: 1019| 1.40k|{ 1020| 1.40k| int ret; 1021| 1.40k| unsigned int signum; 1022| | 1023| 1.40k| ret = lxc_safe_uint(sig, &signum); 1024| 1.40k| if (ret < 0) ------------------ | Branch (1024:6): [True: 6, False: 1.39k] ------------------ 1025| 6| return ret; 1026| | 1027| 1.39k| return signum; 1028| 1.40k|} confile_utils.c:rt_sig_num: 1031| 553|{ 1032| 553| bool rtmax; 1033| 553| int sig_n = 0; 1034| | 1035| 553| if (is_empty_string(signame)) ------------------ | Branch (1035:6): [True: 1, False: 552] ------------------ 1036| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1037| | 1038| 552| if (strncasecmp(signame, "max-", STRLITERALLEN("max-")) == 0) { ------------------ | | 687| 552|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1038:6): [True: 236, False: 316] ------------------ 1039| 236| rtmax = true; 1040| 236| signame += STRLITERALLEN("max-"); ------------------ | | 687| 236|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1041| 316| } else if (strncasecmp(signame, "min+", STRLITERALLEN("min+")) == 0) { ------------------ | | 687| 316|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1041:13): [True: 249, False: 67] ------------------ 1042| 249| rtmax = false; 1043| 249| signame += STRLITERALLEN("min+"); ------------------ | | 687| 249|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1044| 249| } else { 1045| 67| return ret_errno(EINVAL); ------------------ | | 715| 67| ({ \ | | 716| 67| errno = labs(__errno__); \ | | 717| 67| -errno; \ | | 718| 67| }) ------------------ 1046| 67| } 1047| | 1048| 485| if (is_empty_string(signame) || !isdigit(*signame)) ------------------ | Branch (1048:6): [True: 7, False: 478] | Branch (1048:34): [True: 1, False: 477] ------------------ 1049| 8| return ret_errno(EINVAL); ------------------ | | 715| 8| ({ \ | | 716| 8| errno = labs(__errno__); \ | | 717| 8| -errno; \ | | 718| 8| }) ------------------ 1050| | 1051| 477| sig_n = sig_num(signame); 1052| 477| if (sig_n < 0 || sig_n > SIGRTMAX - SIGRTMIN) ------------------ | Branch (1052:6): [True: 27, False: 450] | Branch (1052:19): [True: 51, False: 399] ------------------ 1053| 78| return ret_errno(EINVAL); ------------------ | | 715| 78| ({ \ | | 716| 78| errno = labs(__errno__); \ | | 717| 78| -errno; \ | | 718| 78| }) ------------------ 1054| | 1055| 399| if (rtmax) ------------------ | Branch (1055:6): [True: 200, False: 199] ------------------ 1056| 200| sig_n = SIGRTMAX - sig_n; 1057| 199| else 1058| 199| sig_n = SIGRTMIN + sig_n; 1059| | 1060| 399| return sig_n; 1061| 477|} conf.c:IS_ERR_OR_NULL: 32| 134k|{ 33| 134k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 4.47k|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 139k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 4.47k] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 130k, False: 4.47k] ------------------ 34| 134k|} confile.c:IS_ERR_OR_NULL: 32| 687k|{ 33| 687k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 636k|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 1.32M|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 636k] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 50.9k, False: 636k] ------------------ 34| 687k|} confile_utils.c:IS_ERR_OR_NULL: 32| 72.8k|{ 33| 72.8k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 11.1k|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 84.0k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 11.1k] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 61.6k, False: 11.1k] ------------------ 34| 72.8k|} log.c:IS_ERR_OR_NULL: 32| 7.07k|{ 33| 7.07k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 877|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 7.94k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 877] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 6.19k, False: 877] ------------------ 34| 7.07k|} string_utils.c:IS_ERR_OR_NULL: 32| 6.10k|{ 33| 6.10k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 0|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 6.10k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 0] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 6.10k, False: 0] ------------------ 34| 6.10k|} lxc_write_nointr: 237| 67.9k|{ 238| 67.9k| ssize_t ret; 239| | 240| 67.9k| do { 241| 67.9k| ret = write(fd, buf, count); 242| 67.9k| } while (ret < 0 && errno == EINTR); ------------------ | Branch (242:11): [True: 0, False: 67.9k] | Branch (242:22): [True: 0, False: 0] ------------------ 243| | 244| 67.9k| return ret; 245| 67.9k|} lxc_read_nointr: 270| 56.0k|{ 271| 56.0k| ssize_t ret; 272| | 273| 56.0k| do { 274| 56.0k| ret = read(fd, buf, count); 275| 56.0k| } while (ret < 0 && errno == EINTR); ------------------ | Branch (275:11): [True: 0, False: 56.0k] | Branch (275:22): [True: 0, False: 0] ------------------ 276| | 277| 56.0k| return ret; 278| 56.0k|} lxc_is_dir: 365| 1.37k|{ 366| 1.37k| int ret; 367| 1.37k| struct stat statbuf; 368| | 369| 1.37k| ret = stat(path, &statbuf); 370| 1.37k| if (ret == 0 && S_ISDIR(statbuf.st_mode)) ------------------ | Branch (370:6): [True: 1.35k, False: 22] | Branch (370:18): [True: 1.10k, False: 249] ------------------ 371| 1.10k| return 1; 372| | 373| 271| return 0; 374| 1.37k|} lxc_make_tmpfile: 397| 11.8k|{ 398| 11.8k| __do_close int fd = -EBADF; ------------------ | | 49| 11.8k|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 11.8k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 399| 11.8k| int ret; 400| 11.8k| mode_t msk; 401| | 402| 11.8k| msk = umask(0022); 403| 11.8k| fd = mkstemp(template); 404| 11.8k| umask(msk); 405| 11.8k| if (fd < 0) ------------------ | Branch (405:6): [True: 0, False: 11.8k] ------------------ 406| 0| return -1; 407| | 408| 11.8k| if (lxc_set_cloexec(fd)) ------------------ | Branch (408:6): [True: 0, False: 11.8k] ------------------ 409| 0| return -1; 410| | 411| 11.8k| if (!rm) ------------------ | Branch (411:6): [True: 11.8k, False: 0] ------------------ 412| 11.8k| return move_fd(fd); ------------------ | | 701| 11.8k| ({ \ | | 702| 11.8k| int __internal_fd__ = (fd); \ | | 703| 11.8k| (fd) = -EBADF; \ | | 704| 11.8k| __internal_fd__; \ | | 705| 11.8k| }) ------------------ 413| | 414| 0| ret = unlink(template); 415| 0| if (ret < 0) ------------------ | Branch (415:6): [True: 0, False: 0] ------------------ 416| 0| return -1; 417| | 418| 0| return move_fd(fd); ------------------ | | 701| 0| ({ \ | | 702| 0| int __internal_fd__ = (fd); \ | | 703| 0| (fd) = -EBADF; \ | | 704| 0| __internal_fd__; \ | | 705| 0| }) ------------------ 419| 0|} __fd_to_fd: 501| 25.1k|{ 502| 25.1k| ssize_t total_bytes = 0; 503| | 504| 56.0k| for (;;) { 505| 56.0k| uint8_t buf[PATH_MAX]; 506| 56.0k| uint8_t *p = buf; 507| 56.0k| ssize_t bytes_to_write; 508| 56.0k| ssize_t bytes_read; 509| | 510| 56.0k| bytes_read = lxc_read_nointr(from, buf, sizeof buf); 511| 56.0k| if (bytes_read < 0) ------------------ | Branch (511:7): [True: 0, False: 56.0k] ------------------ 512| 0| return -1; 513| 56.0k| if (bytes_read == 0) ------------------ | Branch (513:7): [True: 25.1k, False: 30.9k] ------------------ 514| 25.1k| break; 515| | 516| 30.9k| bytes_to_write = (size_t)bytes_read; 517| 30.9k| total_bytes += bytes_read; 518| 30.9k| do { 519| 30.9k| ssize_t bytes_written; 520| | 521| 30.9k| bytes_written = lxc_write_nointr(to, p, bytes_to_write); 522| 30.9k| if (bytes_written < 0) ------------------ | Branch (522:8): [True: 0, False: 30.9k] ------------------ 523| 0| return -1; 524| | 525| 30.9k| bytes_to_write -= bytes_written; 526| 30.9k| p += bytes_written; 527| 30.9k| } while (bytes_to_write > 0); ------------------ | Branch (527:12): [True: 0, False: 30.9k] ------------------ 528| 30.9k| } 529| | 530| 25.1k| return total_bytes; 531| 25.1k|} conf.c:INIT_LIST_HEAD: 49| 559k|{ 50| 559k| list->next = list; 51| 559k| list->prev = list; 52| 559k|} conf.c:list_del: 122| 10.6k|{ 123| 10.6k| __list_del_entry(entry); 124| 10.6k| entry->next = LIST_POISON1; ------------------ | | 23| 10.6k|#define LIST_POISON1 ((void *) 0x100) ------------------ 125| 10.6k| entry->prev = LIST_POISON2; ------------------ | | 24| 10.6k|#define LIST_POISON2 ((void *) 0x122) ------------------ 126| 10.6k|} conf.c:__list_del_entry: 111| 10.6k|{ 112| 10.6k| __list_del(entry->prev, entry->next); 113| 10.6k|} conf.c:__list_del: 105| 10.6k|{ 106| 10.6k| next->prev = prev; 107| 10.6k| prev->next = next; 108| 10.6k|} confile.c:list_add_tail: 93| 16.0k|{ 94| 16.0k| __list_add(new, head->prev, head); 95| 16.0k|} confile.c:__list_add: 63| 16.0k|{ 64| 16.0k| next->prev = new; 65| 16.0k| new->next = next; 66| 16.0k| new->prev = prev; 67| 16.0k| prev->next = new; 68| 16.0k|} confile.c:list_empty: 258| 263|{ 259| 263| return head->next == head; 260| 263|} confile.c:list_del: 122| 1.81k|{ 123| 1.81k| __list_del_entry(entry); 124| 1.81k| entry->next = LIST_POISON1; ------------------ | | 23| 1.81k|#define LIST_POISON1 ((void *) 0x100) ------------------ 125| 1.81k| entry->prev = LIST_POISON2; ------------------ | | 24| 1.81k|#define LIST_POISON2 ((void *) 0x122) ------------------ 126| 1.81k|} confile.c:__list_del_entry: 111| 1.81k|{ 112| 1.81k| __list_del(entry->prev, entry->next); 113| 1.81k|} confile.c:__list_del: 105| 1.81k|{ 106| 1.81k| next->prev = prev; 107| 1.81k| prev->next = next; 108| 1.81k|} confile.c:INIT_LIST_HEAD: 49| 2.59k|{ 50| 2.59k| list->next = list; 51| 2.59k| list->prev = list; 52| 2.59k|} confile_utils.c:list_empty: 258| 46.8k|{ 259| 46.8k| return head->next == head; 260| 46.8k|} confile_utils.c:list_add_tail: 93| 5.21k|{ 94| 5.21k| __list_add(new, head->prev, head); 95| 5.21k|} confile_utils.c:__list_add: 63| 5.21k|{ 64| 5.21k| next->prev = new; 65| 5.21k| new->next = next; 66| 5.21k| new->prev = prev; 67| 5.21k| prev->next = new; 68| 5.21k|} confile_utils.c:list_del: 122| 8.74k|{ 123| 8.74k| __list_del_entry(entry); 124| 8.74k| entry->next = LIST_POISON1; ------------------ | | 23| 8.74k|#define LIST_POISON1 ((void *) 0x100) ------------------ 125| 8.74k| entry->prev = LIST_POISON2; ------------------ | | 24| 8.74k|#define LIST_POISON2 ((void *) 0x122) ------------------ 126| 8.74k|} confile_utils.c:__list_del_entry: 111| 8.74k|{ 112| 8.74k| __list_del(entry->prev, entry->next); 113| 8.74k|} confile_utils.c:__list_del: 105| 8.74k|{ 106| 8.74k| next->prev = prev; 107| 8.74k| prev->next = next; 108| 8.74k|} confile_utils.c:INIT_LIST_HEAD: 49| 32.4k|{ 50| 32.4k| list->next = list; 51| 32.4k| list->prev = list; 52| 32.4k|} confile.c:lxc_list_new: 151| 1.07k|{ 152| 1.07k| struct lxc_list *l; 153| | 154| 1.07k| l = zalloc(sizeof(struct lxc_list)); ------------------ | | 90| 1.07k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 155| 1.07k| if (l) ------------------ | Branch (155:6): [True: 1.07k, False: 0] ------------------ 156| 1.07k| lxc_list_init(l); 157| 1.07k| return l; 158| 1.07k|} confile.c:lxc_list_init: 51| 2.36k|{ 52| | list->elem = NULL; 53| 2.36k| list->next = list->prev = list; 54| 2.36k|} confile.c:lxc_list_add_tail: 115| 1.07k|{ 116| 1.07k| __lxc_list_add(list, head->prev, head); 117| 1.07k|} confile.c:__lxc_list_add: 85| 1.07k|{ 86| 1.07k| next->prev = new; 87| 1.07k| new->next = next; 88| 1.07k| new->prev = prev; 89| 1.07k| prev->next = new; 90| 1.07k|} confile.c:lxc_list_del: 128| 504|{ 129| 504| struct lxc_list *next, *prev; 130| | 131| 504| next = list->next; 132| 504| prev = list->prev; 133| 504| next->prev = prev; 134| 504| prev->next = next; 135| 504|} confile_utils.c:lxc_list_del: 128| 567|{ 129| 567| struct lxc_list *next, *prev; 130| | 131| 567| next = list->next; 132| 567| prev = list->prev; 133| 567| next->prev = prev; 134| 567| prev->next = next; 135| 567|} lxc_log_syslog: 745| 2.15k|{ 746| 2.15k| struct lxc_log_appender *appender; 747| | 748| 2.15k| openlog(log_prefix, LOG_PID, facility); 749| 2.15k| if (!lxc_log_category_lxc.appender) { ------------------ | Branch (749:6): [True: 0, False: 2.15k] ------------------ 750| 0| lxc_log_category_lxc.appender = &log_appender_syslog; 751| 0| return 0; 752| 0| } 753| | 754| 2.15k| appender = lxc_log_category_lxc.appender; 755| | /* Check if syslog was already added, to avoid creating a loop */ 756| 4.30k| while (appender) { ------------------ | Branch (756:9): [True: 4.30k, False: 1] ------------------ 757| | /* not an error: openlog re-opened the connection */ 758| 4.30k| if (appender == &log_appender_syslog) ------------------ | Branch (758:7): [True: 2.15k, False: 2.15k] ------------------ 759| 2.15k| return 0; 760| 2.15k| appender = appender->next; 761| 2.15k| } 762| | 763| 1| appender = lxc_log_category_lxc.appender; 764| 1| while (appender->next != NULL) ------------------ | Branch (764:9): [True: 0, False: 1] ------------------ 765| 0| appender = appender->next; 766| 1| appender->next = &log_appender_syslog; 767| | 768| 1| return 0; 769| 2.15k|} lxc_log_set_level: 787| 2.41k|{ 788| 2.41k| if (level < 0 || level >= LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (788:6): [True: 0, False: 2.41k] | Branch (788:19): [True: 424, False: 1.99k] ------------------ 789| 424| return log_error_errno(-EINVAL, EINVAL, "Invalid log priority %d", level); ------------------ | | 486| 424| ({ \ | | 487| 424| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 424| errno = (__errno__); \ | | 489| 424| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 424| do { \ | | | | 454| 424| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 424| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 424| char *ptr = NULL; \ | | | | | | 317| 424| { \ | | | | | | 318| 424| int __saved_errno = errno; \ | | | | | | 319| 424| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 424| errno = __saved_errno; \ | | | | | | 321| 424| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 424] | | | | | | ------------------ | | | | | | 322| 424| ptr = errno_buf; \ | | | | | | 323| 424| } | | | | ------------------ | | | | 455| 424| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 424|#define ERROR(format, ...) do { \ | | | | | | 373| 424| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 424| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 424| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 424|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 424] | | | | | | ------------------ | | | | ------------------ | | | | 456| 424| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 424] | | | | ------------------ | | ------------------ | | 490| 424| __internal_ret__; \ | | 491| 424| }) ------------------ 790| | 791| 1.99k| *dest = level; 792| 1.99k| return 0; 793| 2.41k|} lxc_log_set_file: 826| 877|{ 827| 877| if (*fd >= 0) ------------------ | Branch (827:6): [True: 697, False: 180] ------------------ 828| 697| close_prot_errno_disarm(*fd); ------------------ | | 29| 697| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 697, False: 0] | | ------------------ | | 30| 697| int _e_ = errno; \ | | 31| 697| close(fd); \ | | 32| 697| errno = _e_; \ | | 33| 697| fd = -EBADF; \ | | 34| 697| } ------------------ 829| | 830| 877| if (is_empty_string(fname)) ------------------ | Branch (830:6): [True: 0, False: 877] ------------------ 831| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 832| | 833| 877| if (build_dir(fname)) ------------------ | Branch (833:6): [True: 0, False: 877] ------------------ 834| 0| return -errno; 835| | 836| 877| *fd = log_open(fname); 837| 877| if (*fd < 0) ------------------ | Branch (837:6): [True: 158, False: 719] ------------------ 838| 158| return -errno; 839| 719| return 0; 840| 877|} log.c:log_append_logfile: 322| 9.86k|{ 323| 9.86k| int fd_to_use = -EBADF; 324| 9.86k| char buffer[LXC_LOG_BUFFER_SIZE]; 325| 9.86k| char date_time[LXC_LOG_TIME_SIZE]; 326| 9.86k| int n; 327| 9.86k| ssize_t ret; 328| 9.86k| const char *log_container_name; 329| | 330| 9.86k|#ifndef NO_LXC_CONF 331| 9.86k| if (current_config && !lxc_log_use_global_fd) ------------------ | Branch (331:6): [True: 0, False: 9.86k] | Branch (331:24): [True: 0, False: 0] ------------------ 332| 0| fd_to_use = current_config->logfd; 333| 9.86k|#endif 334| | 335| 9.86k| log_container_name = lxc_log_get_container_name(); 336| | 337| 9.86k| if (fd_to_use < 0) ------------------ | Branch (337:6): [True: 9.86k, False: 0] ------------------ 338| 9.86k| fd_to_use = lxc_log_fd; 339| | 340| 9.86k| if (fd_to_use < 0) ------------------ | Branch (340:6): [True: 9.86k, False: 0] ------------------ 341| 9.86k| return 0; 342| | 343| 0| ret = lxc_unix_epoch_to_utc(date_time, LXC_LOG_TIME_SIZE, &event->timestamp); ------------------ | | 42| 0|#define LXC_LOG_TIME_SIZE ((INTTYPE_TO_STRLEN(uint64_t)) * 2) | | ------------------ | | | | 292| 0| (2 + (sizeof(type) <= 1 \ | | | | ------------------ | | | | | Branch (292:8): [Folded, False: 0] | | | | ------------------ | | | | 293| 0| ? 3 \ | | | | 294| 0| : sizeof(type) <= 2 \ | | | | ------------------ | | | | | Branch (294:7): [Folded, False: 0] | | | | ------------------ | | | | 295| 0| ? 5 \ | | | | 296| 0| : sizeof(type) <= 4 \ | | | | ------------------ | | | | | Branch (296:6): [Folded, False: 0] | | | | ------------------ | | | | 297| 0| ? 10 \ | | | | 298| 0| : sizeof(type) <= 8 \ | | | | ------------------ | | | | | Branch (298:12): [True: 0, Folded] | | | | ------------------ | | | | 299| 0| ? 20 \ | | | | 300| 0| : sizeof(int[-2 * (sizeof(type) > 8)]))) | | ------------------ ------------------ 344| 0| if (ret) ------------------ | Branch (344:6): [True: 0, False: 0] ------------------ 345| 0| return ret; 346| | 347| | /* 348| | * We allow truncation here which is why we use snprintf() directly 349| | * instead of strnprintf(). 350| | */ 351| 0| n = snprintf(buffer, sizeof(buffer), 352| 0| "%s%s%s %s %-8s %s - %s:%s:%d - ", 353| 0| log_prefix, 354| 0| log_container_name ? " " : "", ------------------ | Branch (354:8): [True: 0, False: 0] ------------------ 355| 0| log_container_name ? log_container_name : "", ------------------ | Branch (355:8): [True: 0, False: 0] ------------------ 356| 0| date_time, 357| 0| lxc_log_priority_to_string(event->priority), 358| 0| event->category, 359| 0| event->locinfo->file, event->locinfo->func, 360| 0| event->locinfo->line); 361| 0| if (n < 0) ------------------ | Branch (361:6): [True: 0, False: 0] ------------------ 362| 0| return ret_errno(EIO); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 363| | 364| 0| if ((size_t)n < STRARRAYLEN(buffer)) { ------------------ | | 688| 0|#define STRARRAYLEN(x) (sizeof(x) - 1) ------------------ | Branch (364:6): [True: 0, False: 0] ------------------ 365| 0|#pragma GCC diagnostic push 366| 0|#pragma GCC diagnostic ignored "-Wformat-nonliteral" 367| 0| ret = vsnprintf(buffer + n, sizeof(buffer) - n, event->fmt, *event->vap); 368| 0|#pragma GCC diagnostic pop 369| 0| if (ret < 0) ------------------ | Branch (369:7): [True: 0, False: 0] ------------------ 370| 0| return 0; 371| | 372| 0| n += ret; 373| 0| } 374| | 375| 0| if ((size_t)n >= sizeof(buffer)) ------------------ | Branch (375:6): [True: 0, False: 0] ------------------ 376| 0| n = STRARRAYLEN(buffer); ------------------ | | 688| 0|#define STRARRAYLEN(x) (sizeof(x) - 1) ------------------ 377| | 378| 0| buffer[n] = '\n'; 379| | 380| 0| return lxc_write_nointr(fd_to_use, buffer, n + 1); 381| 0|} log.c:lxc_log_get_container_name: 84| 9.86k|{ 85| 9.86k|#ifndef NO_LXC_CONF 86| 9.86k| if (current_config && !log_vmname) ------------------ | Branch (86:6): [True: 0, False: 9.86k] | Branch (86:24): [True: 0, False: 0] ------------------ 87| 0| return current_config->name; 88| 9.86k|#endif 89| | 90| 9.86k| return log_vmname; 91| 9.86k|} log.c:log_append_syslog: 139| 6.19k|{ 140| 6.19k| __do_free char *msg = NULL; ------------------ | | 69| 6.19k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 6.19k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 141| 6.19k| const char *log_container_name; 142| | 143| 6.19k| if (!wants_syslog) ------------------ | Branch (143:6): [True: 6.19k, False: 0] ------------------ 144| 6.19k| return 0; 145| | 146| 0| log_container_name = lxc_log_get_container_name(); 147| | 148| 0| msg = lxc_log_get_va_msg(event); 149| 0| if (!msg) ------------------ | Branch (149:6): [True: 0, False: 0] ------------------ 150| 0| return 0; 151| | 152| 0| syslog(lxc_log_priority_to_syslog(event->priority), 153| 0| "%s%s %s - %s:%s:%d - %s" , 154| 0| log_container_name ? log_container_name : "", ------------------ | Branch (154:9): [True: 0, False: 0] ------------------ 155| 0| log_container_name ? ":" : "", ------------------ | Branch (155:9): [True: 0, False: 0] ------------------ 156| 0| event->category, 157| 0| event->locinfo->file, event->locinfo->func, 158| 0| event->locinfo->line, 159| 0| msg); 160| | 161| 0| return 0; 162| 0|} log.c:build_dir: 486| 877|{ 487| 877| __do_free char *n = NULL; ------------------ | | 69| 877|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 877| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 488| 877| char *e, *p; 489| | 490| 877| if (is_empty_string(name)) ------------------ | Branch (490:6): [True: 0, False: 877] ------------------ 491| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 492| | 493| | /* Make copy of the string since we'll be modifying it. */ 494| 877| n = strdup(name); 495| 877| if (!n) ------------------ | Branch (495:6): [True: 0, False: 877] ------------------ 496| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 497| | 498| 877| e = &n[strlen(n)]; 499| 58.1k| for (p = n + 1; p < e; p++) { ------------------ | Branch (499:18): [True: 57.2k, False: 877] ------------------ 500| 57.2k| int ret; 501| | 502| 57.2k| if (*p != '/') ------------------ | Branch (502:7): [True: 56.2k, False: 1.00k] ------------------ 503| 56.2k| continue; 504| 1.00k| *p = '\0'; 505| | 506| |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION 507| | ret = lxc_unpriv(mkdir(n, 0755)); 508| |#else 509| 1.00k| if (RUN_ON_OSS_FUZZ || is_in_comm("fuzz-lxc-") > 0) ------------------ | | 210| 2.01k|#define RUN_ON_OSS_FUZZ 1 | | ------------------ | | | Branch (210:25): [True: 1.00k, Folded] | | ------------------ ------------------ | Branch (509:26): [True: 0, False: 0] ------------------ 510| 1.00k| ret = errno = EEXIST; 511| 0| else 512| 0| ret = lxc_unpriv(mkdir(n, 0755)); ------------------ | | 85| 0| ({ \ | | 86| 0| __label__ out; \ | | 87| 0| int __ret, __ret2, ___errno = 0; \ | | 88| 0| __ret = lxc_caps_down(); \ | | 89| 0| if (__ret) \ | | ------------------ | | | Branch (89:7): [True: 0, False: 0] | | ------------------ | | 90| 0| goto out; \ | | 91| 0| __ret = __lxc_function; \ | | 92| 0| if (__ret) \ | | ------------------ | | | Branch (92:7): [True: 0, False: 0] | | ------------------ | | 93| 0| ___errno = errno; \ | | 94| 0| __ret2 = lxc_caps_up(); \ | | 95| 0| out: \ | | 96| 0| __ret ? errno = ___errno, __ret : __ret2; \ | | ------------------ | | | Branch (96:3): [True: 0, False: 0] | | ------------------ | | 97| 0| }) ------------------ 513| 1.00k|#endif /*!FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */ 514| 1.00k| *p = '/'; 515| 1.00k| if (ret && errno != EEXIST) ------------------ | Branch (515:7): [True: 1.00k, False: 0] | Branch (515:14): [True: 0, False: 1.00k] ------------------ 516| 0| return log_error_errno(-errno, errno, "Failed to create directory \"%s\"", n); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 517| 1.00k| } 518| | 519| 877| return 0; 520| 877|} log.c:log_open: 523| 877|{ 524| 877| int newfd = -EBADF; 525| 877| __do_close int fd = -EBADF; ------------------ | | 49| 877|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 877| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 526| | 527| |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION 528| | fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0640)); 529| |#else 530| 877| if (!RUN_ON_OSS_FUZZ && is_in_comm("fuzz-lxc-") <= 0) ------------------ | | 210| 1.75k|#define RUN_ON_OSS_FUZZ 1 ------------------ | Branch (530:6): [Folded, False: 877] | Branch (530:26): [True: 0, False: 0] ------------------ 531| 0| fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0640)); ------------------ | | 85| 0| ({ \ | | 86| 0| __label__ out; \ | | 87| 0| int __ret, __ret2, ___errno = 0; \ | | 88| 0| __ret = lxc_caps_down(); \ | | 89| 0| if (__ret) \ | | ------------------ | | | Branch (89:7): [True: 0, False: 0] | | ------------------ | | 90| 0| goto out; \ | | 91| 0| __ret = __lxc_function; \ | | 92| 0| if (__ret) \ | | ------------------ | | | Branch (92:7): [True: 0, False: 0] | | ------------------ | | 93| 0| ___errno = errno; \ | | 94| 0| __ret2 = lxc_caps_up(); \ | | 95| 0| out: \ | | 96| 0| __ret ? errno = ___errno, __ret : __ret2; \ | | ------------------ | | | Branch (96:3): [True: 0, False: 0] | | ------------------ | | 97| 0| }) ------------------ 532| 877|#endif /* !FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */ 533| 877| if (fd < 0) ------------------ | Branch (533:6): [True: 877, False: 0] ------------------ 534| 877| return log_error_errno(-errno, errno, "Failed to open log file \"%s\"", name); ------------------ | | 486| 877| ({ \ | | 487| 877| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 877| errno = (__errno__); \ | | 489| 877| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 877| do { \ | | | | 454| 877| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 877| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 877| char *ptr = NULL; \ | | | | | | 317| 877| { \ | | | | | | 318| 877| int __saved_errno = errno; \ | | | | | | 319| 877| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 877| errno = __saved_errno; \ | | | | | | 321| 877| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 877] | | | | | | ------------------ | | | | | | 322| 877| ptr = errno_buf; \ | | | | | | 323| 877| } | | | | ------------------ | | | | 455| 877| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 877|#define ERROR(format, ...) do { \ | | | | | | 373| 877| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 877| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 877| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 877|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 877] | | | | | | ------------------ | | | | ------------------ | | | | 456| 877| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 877] | | | | ------------------ | | ------------------ | | 490| 877| __internal_ret__; \ | | 491| 877| }) ------------------ 535| | 536| 0| if (fd > 2) ------------------ | Branch (536:6): [True: 0, False: 0] ------------------ 537| 0| return move_fd(fd); ------------------ | | 701| 0| ({ \ | | 702| 0| int __internal_fd__ = (fd); \ | | 703| 0| (fd) = -EBADF; \ | | 704| 0| __internal_fd__; \ | | 705| 0| }) ------------------ 538| | 539| 0| newfd = fcntl(fd, F_DUPFD_CLOEXEC, STDERR_FILENO); 540| 0| if (newfd < 0) ------------------ | Branch (540:6): [True: 0, False: 0] ------------------ 541| 0| return log_error_errno(-errno, errno, "Failed to dup log fd %d", fd); ------------------ | | 486| 0| ({ \ | | 487| 0| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 0| errno = (__errno__); \ | | 489| 0| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 0| do { \ | | | | 454| 0| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 0| char *ptr = NULL; \ | | | | | | 317| 0| { \ | | | | | | 318| 0| int __saved_errno = errno; \ | | | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 0| errno = __saved_errno; \ | | | | | | 321| 0| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 0] | | | | | | ------------------ | | | | | | 322| 0| ptr = errno_buf; \ | | | | | | 323| 0| } | | | | ------------------ | | | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 0|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 0] | | | | | | ------------------ | | | | ------------------ | | | | 456| 0| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 490| 0| __internal_ret__; \ | | 491| 0| }) ------------------ 542| 0| return newfd; 543| 0|} conf.c:lxc_log_priority_is_enabled: 95| 1.64k|{ 96| 3.28k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 1.64k, False: 1.64k] | Branch (96:55): [True: 1.64k, False: 0] ------------------ 97| 1.64k| category = category->parent; 98| | 99| 1.64k| int cmp_prio = category->priority; 100| 1.64k|#ifndef NO_LXC_CONF 101| 1.64k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 1.64k, False: 0] | Branch (101:32): [True: 0, False: 1.64k] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 1.64k|#endif 105| | 106| 1.64k| return priority >= cmp_prio; 107| 1.64k|} conf.c:__lxc_log: 232| 118|{ 233| 472| while (category) { ------------------ | Branch (233:9): [True: 354, False: 118] ------------------ 234| 354| __lxc_log_append(category->appender, event); 235| 354| category = category->parent; 236| 354| } 237| 118|} conf.c:__lxc_log_append: 217| 354|{ 218| 354| va_list va; 219| 354| va_list *va_keep = event->vap; 220| | 221| 590| while (appender) { ------------------ | Branch (221:9): [True: 236, False: 354] ------------------ 222| 236| va_copy(va, *va_keep); 223| 236| event->vap = &va; 224| 236| appender->append(appender, event); 225| 236| appender = appender->next; 226| | va_end(va); 227| 236| } 228| 354|} confile.c:lxc_log_priority_is_enabled: 95| 6.11k|{ 96| 12.2k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 6.11k, False: 6.11k] | Branch (96:55): [True: 6.11k, False: 0] ------------------ 97| 6.11k| category = category->parent; 98| | 99| 6.11k| int cmp_prio = category->priority; 100| 6.11k|#ifndef NO_LXC_CONF 101| 6.11k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 6.11k, False: 0] | Branch (101:32): [True: 0, False: 6.11k] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 6.11k|#endif 105| | 106| 6.11k| return priority >= cmp_prio; 107| 6.11k|} confile.c:__lxc_log: 232| 2.04k|{ 233| 8.18k| while (category) { ------------------ | Branch (233:9): [True: 6.13k, False: 2.04k] ------------------ 234| 6.13k| __lxc_log_append(category->appender, event); 235| 6.13k| category = category->parent; 236| 6.13k| } 237| 2.04k|} confile.c:__lxc_log_append: 217| 6.13k|{ 218| 6.13k| va_list va; 219| 6.13k| va_list *va_keep = event->vap; 220| | 221| 9.21k| while (appender) { ------------------ | Branch (221:9): [True: 3.07k, False: 6.13k] ------------------ 222| 3.07k| va_copy(va, *va_keep); 223| 3.07k| event->vap = &va; 224| 3.07k| appender->append(appender, event); 225| 3.07k| appender = appender->next; 226| | va_end(va); 227| 3.07k| } 228| 6.13k|} confile.c:lxc_log_priority_to_int: 168| 2.15k|{ 169| 2.15k| if (strcasecmp("TRACE", name) == 0) ------------------ | Branch (169:6): [True: 194, False: 1.96k] ------------------ 170| 194| return LXC_LOG_LEVEL_TRACE; 171| 1.96k| if (strcasecmp("DEBUG", name) == 0) ------------------ | Branch (171:6): [True: 194, False: 1.76k] ------------------ 172| 194| return LXC_LOG_LEVEL_DEBUG; 173| 1.76k| if (strcasecmp("INFO", name) == 0) ------------------ | Branch (173:6): [True: 238, False: 1.53k] ------------------ 174| 238| return LXC_LOG_LEVEL_INFO; 175| 1.53k| if (strcasecmp("NOTICE", name) == 0) ------------------ | Branch (175:6): [True: 196, False: 1.33k] ------------------ 176| 196| return LXC_LOG_LEVEL_NOTICE; 177| 1.33k| if (strcasecmp("WARN", name) == 0) ------------------ | Branch (177:6): [True: 194, False: 1.14k] ------------------ 178| 194| return LXC_LOG_LEVEL_WARN; 179| 1.14k| if (strcasecmp("ERROR", name) == 0) ------------------ | Branch (179:6): [True: 196, False: 945] ------------------ 180| 196| return LXC_LOG_LEVEL_ERROR; 181| 945| if (strcasecmp("CRIT", name) == 0) ------------------ | Branch (181:6): [True: 194, False: 751] ------------------ 182| 194| return LXC_LOG_LEVEL_CRIT; 183| 751| if (strcasecmp("ALERT", name) == 0) ------------------ | Branch (183:6): [True: 194, False: 557] ------------------ 184| 194| return LXC_LOG_LEVEL_ALERT; 185| 557| if (strcasecmp("FATAL", name) == 0) ------------------ | Branch (185:6): [True: 194, False: 363] ------------------ 186| 194| return LXC_LOG_LEVEL_FATAL; 187| | 188| 363| return LXC_LOG_LEVEL_NOTSET; 189| 557|} confile.c:lxc_syslog_priority_to_int: 192| 2.28k|{ 193| 2.28k| if (strcasecmp("daemon", name) == 0) ------------------ | Branch (193:6): [True: 326, False: 1.95k] ------------------ 194| 326| return LOG_DAEMON; 195| 1.95k| if (strcasecmp("local0", name) == 0) ------------------ | Branch (195:6): [True: 237, False: 1.71k] ------------------ 196| 237| return LOG_LOCAL0; 197| 1.71k| if (strcasecmp("local1", name) == 0) ------------------ | Branch (197:6): [True: 224, False: 1.49k] ------------------ 198| 224| return LOG_LOCAL1; 199| 1.49k| if (strcasecmp("local2", name) == 0) ------------------ | Branch (199:6): [True: 323, False: 1.17k] ------------------ 200| 323| return LOG_LOCAL2; 201| 1.17k| if (strcasecmp("local3", name) == 0) ------------------ | Branch (201:6): [True: 212, False: 958] ------------------ 202| 212| return LOG_LOCAL3; 203| 958| if (strcasecmp("local4", name) == 0) ------------------ | Branch (203:6): [True: 213, False: 745] ------------------ 204| 213| return LOG_LOCAL4; 205| 745| if (strcasecmp("local5", name) == 0) ------------------ | Branch (205:6): [True: 199, False: 546] ------------------ 206| 199| return LOG_LOCAL5; 207| 546| if (strcasecmp("local6", name) == 0) ------------------ | Branch (207:6): [True: 224, False: 322] ------------------ 208| 224| return LOG_LOCAL6; 209| 322| if (strcasecmp("local7", name) == 0) ------------------ | Branch (209:6): [True: 195, False: 127] ------------------ 210| 195| return LOG_LOCAL7; 211| | 212| 127| return -EINVAL; 213| 322|} confile_utils.c:lxc_log_priority_is_enabled: 95| 400|{ 96| 800| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 400, False: 400] | Branch (96:55): [True: 400, False: 0] ------------------ 97| 400| category = category->parent; 98| | 99| 400| int cmp_prio = category->priority; 100| 400|#ifndef NO_LXC_CONF 101| 400| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 400, False: 0] | Branch (101:32): [True: 0, False: 400] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 400|#endif 105| | 106| 400| return priority >= cmp_prio; 107| 400|} confile_utils.c:__lxc_log: 232| 400|{ 233| 1.60k| while (category) { ------------------ | Branch (233:9): [True: 1.20k, False: 400] ------------------ 234| 1.20k| __lxc_log_append(category->appender, event); 235| 1.20k| category = category->parent; 236| 1.20k| } 237| 400|} confile_utils.c:__lxc_log_append: 217| 1.20k|{ 218| 1.20k| va_list va; 219| 1.20k| va_list *va_keep = event->vap; 220| | 221| 1.95k| while (appender) { ------------------ | Branch (221:9): [True: 753, False: 1.20k] ------------------ 222| 753| va_copy(va, *va_keep); 223| 753| event->vap = &va; 224| 753| appender->append(appender, event); 225| 753| appender = appender->next; 226| | va_end(va); 227| 753| } 228| 1.20k|} log.c:lxc_log_priority_is_enabled: 95| 1.30k|{ 96| 2.60k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 1.30k, False: 1.30k] | Branch (96:55): [True: 1.30k, False: 0] ------------------ 97| 1.30k| category = category->parent; 98| | 99| 1.30k| int cmp_prio = category->priority; 100| 1.30k|#ifndef NO_LXC_CONF 101| 1.30k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 1.30k, False: 0] | Branch (101:32): [True: 0, False: 1.30k] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 1.30k|#endif 105| | 106| 1.30k| return priority >= cmp_prio; 107| 1.30k|} log.c:__lxc_log: 232| 1.30k|{ 233| 5.20k| while (category) { ------------------ | Branch (233:9): [True: 3.90k, False: 1.30k] ------------------ 234| 3.90k| __lxc_log_append(category->appender, event); 235| 3.90k| category = category->parent; 236| 3.90k| } 237| 1.30k|} log.c:__lxc_log_append: 217| 3.90k|{ 218| 3.90k| va_list va; 219| 3.90k| va_list *va_keep = event->vap; 220| | 221| 6.05k| while (appender) { ------------------ | Branch (221:9): [True: 2.14k, False: 3.90k] ------------------ 222| 2.14k| va_copy(va, *va_keep); 223| 2.14k| event->vap = &va; 224| 2.14k| appender->append(appender, event); 225| 2.14k| appender = appender->next; 226| | va_end(va); 227| 2.14k| } 228| 3.90k|} namespace.c:lxc_log_priority_is_enabled: 95| 137|{ 96| 274| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 137, False: 137] | Branch (96:55): [True: 137, False: 0] ------------------ 97| 137| category = category->parent; 98| | 99| 137| int cmp_prio = category->priority; 100| 137|#ifndef NO_LXC_CONF 101| 137| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 137, False: 0] | Branch (101:32): [True: 0, False: 137] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 137|#endif 105| | 106| 137| return priority >= cmp_prio; 107| 137|} namespace.c:__lxc_log: 232| 137|{ 233| 548| while (category) { ------------------ | Branch (233:9): [True: 411, False: 137] ------------------ 234| 411| __lxc_log_append(category->appender, event); 235| 411| category = category->parent; 236| 411| } 237| 137|} namespace.c:__lxc_log_append: 217| 411|{ 218| 411| va_list va; 219| 411| va_list *va_keep = event->vap; 220| | 221| 677| while (appender) { ------------------ | Branch (221:9): [True: 266, False: 411] ------------------ 222| 266| va_copy(va, *va_keep); 223| 266| event->vap = &va; 224| 266| appender->append(appender, event); 225| 266| appender = appender->next; 226| | va_end(va); 227| 266| } 228| 411|} parse.c:lxc_log_priority_is_enabled: 95| 31.0k|{ 96| 62.0k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 31.0k, False: 31.0k] | Branch (96:55): [True: 31.0k, False: 0] ------------------ 97| 31.0k| category = category->parent; 98| | 99| 31.0k| int cmp_prio = category->priority; 100| 31.0k|#ifndef NO_LXC_CONF 101| 31.0k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 31.0k, False: 0] | Branch (101:32): [True: 0, False: 31.0k] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 31.0k|#endif 105| | 106| 31.0k| return priority >= cmp_prio; 107| 31.0k|} parse.c:__lxc_log: 232| 5.86k|{ 233| 23.4k| while (category) { ------------------ | Branch (233:9): [True: 17.5k, False: 5.86k] ------------------ 234| 17.5k| __lxc_log_append(category->appender, event); 235| 17.5k| category = category->parent; 236| 17.5k| } 237| 5.86k|} parse.c:__lxc_log_append: 217| 17.5k|{ 218| 17.5k| va_list va; 219| 17.5k| va_list *va_keep = event->vap; 220| | 221| 27.1k| while (appender) { ------------------ | Branch (221:9): [True: 9.58k, False: 17.5k] ------------------ 222| 9.58k| va_copy(va, *va_keep); 223| 9.58k| event->vap = &va; 224| 9.58k| appender->append(appender, event); 225| 9.58k| appender = appender->next; 226| | va_end(va); 227| 9.58k| } 228| 17.5k|} conf.c:seccomp_conf_init: 144| 11.8k|{ 145| 11.8k|} conf.c:lxc_seccomp_free: 128| 11.8k|{ 129| | free_disarm(seccomp->seccomp); ------------------ | | 58| 11.8k| ({ \ | | 59| 11.8k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 11.8k] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 11.8k| }) ------------------ 130| 11.8k|} conf.c:close_prot_errno_disarm_function: 46| 9.79k|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 9.79k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 397, False: 9.39k] | | ------------------ | | 30| 397| int _e_ = errno; \ | | 31| 397| close(fd); \ | | 32| 397| errno = _e_; \ | | 33| 397| fd = -EBADF; \ | | 34| 397| } ------------------ 48| 9.79k|} conf.c:free_disarm_function: 66| 3.66k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 3.66k| ({ \ | | 59| 3.66k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 2.88k, False: 776] | | ------------------ | | 60| 2.88k| free(ptr); \ | | 61| 2.88k| ptr = NULL; \ | | 62| 2.88k| } \ | | 63| 3.66k| }) ------------------ 68| 3.66k|} confile.c:free_lxc_cgroup_function: 20| 1.39k| { \ 21| 1.39k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 1.39k] ------------------ 22| 1.39k| cleaner(*ptr); \ 23| 1.39k| } confile.c:closedir_function: 20| 1.33k| { \ 21| 1.33k| if (*ptr) \ ------------------ | Branch (21:7): [True: 1.13k, False: 196] ------------------ 22| 1.33k| cleaner(*ptr); \ 23| 1.33k| } confile.c:free_lxc_limit_function: 20| 3.38k| { \ 21| 3.38k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 3.38k] ------------------ 22| 3.38k| cleaner(*ptr); \ 23| 3.38k| } confile.c:free_lxc_sysctl_function: 20| 2.37k| { \ 21| 2.37k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 2.37k] ------------------ 22| 2.37k| cleaner(*ptr); \ 23| 2.37k| } confile.c:free_lxc_proc_function: 20| 1.73k| { \ 21| 1.73k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 1.73k] ------------------ 22| 1.73k| cleaner(*ptr); \ 23| 1.73k| } confile.c:free_disarm_function: 66| 666k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 666k| ({ \ | | 59| 666k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 625k, False: 40.7k] | | ------------------ | | 60| 625k| free(ptr); \ | | 61| 625k| ptr = NULL; \ | | 62| 625k| } \ | | 63| 666k| }) ------------------ 68| 666k|} confile.c:netns_freeifaddrs_function: 20| 686| { \ 21| 686| if (*ptr) \ ------------------ | Branch (21:7): [True: 686, False: 0] ------------------ 22| 686| cleaner(*ptr); \ 23| 686| } confile_utils.c:free_disarm_function: 66| 13.7k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 13.7k| ({ \ | | 59| 13.7k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 8.48k, False: 5.21k] | | ------------------ | | 60| 8.48k| free(ptr); \ | | 61| 8.48k| ptr = NULL; \ | | 62| 8.48k| } \ | | 63| 13.7k| }) ------------------ 68| 13.7k|} confile_utils.c:free_string_list: 72| 997|{ 73| 997| if (list && !IS_ERR(list)) { ------------------ | Branch (73:6): [True: 0, False: 997] | Branch (73:14): [True: 0, False: 0] ------------------ 74| 0| for (int i = 0; list[i]; i++) ------------------ | Branch (74:19): [True: 0, False: 0] ------------------ 75| 0| free(list[i]); 76| | free_disarm(list); ------------------ | | 58| 0| ({ \ | | 59| 0| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 0] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 0| }) ------------------ 77| 0| } 78| 997|} file_utils.c:close_prot_errno_disarm_function: 46| 11.8k|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 11.8k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 11.8k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 48| 11.8k|} log.c:free_disarm_function: 66| 7.07k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 7.07k| ({ \ | | 59| 7.07k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 877, False: 6.19k] | | ------------------ | | 60| 877| free(ptr); \ | | 61| 877| ptr = NULL; \ | | 62| 877| } \ | | 63| 7.07k| }) ------------------ 68| 7.07k|} log.c:close_prot_errno_disarm_function: 46| 877|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 877| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 877] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 48| 877|} parse.c:close_prot_errno_disarm_function: 46| 50.2k|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 50.2k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 50.2k, False: 22] | | ------------------ | | 30| 50.2k| int _e_ = errno; \ | | 31| 50.2k| close(fd); \ | | 32| 50.2k| errno = _e_; \ | | 33| 50.2k| fd = -EBADF; \ | | 34| 50.2k| } ------------------ 48| 50.2k|} string_utils.c:free_disarm_function: 66| 6.10k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 6.10k| ({ \ | | 59| 6.10k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 6.10k] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 6.10k| }) ------------------ 68| 6.10k|} utils.c:fclose_function: 20| 1.94k| { \ 21| 1.94k| if (*ptr) \ ------------------ | Branch (21:7): [True: 1.94k, False: 0] ------------------ 22| 1.94k| cleaner(*ptr); \ 23| 1.94k| } lxc_namespace_2_cloneflag: 50| 1.18k|{ 51| 1.18k| int i; 52| | 53| 6.08k| for (i = 0; i < LXC_NS_MAX; i++) ------------------ | Branch (53:14): [True: 5.99k, False: 85] ------------------ 54| 5.99k| if (!strcasecmp(ns_info[i].proc_name, namespace)) ------------------ | Branch (54:7): [True: 1.10k, False: 4.89k] ------------------ 55| 1.10k| return ns_info[i].clone_flag; 56| | 57| 85| ERROR("Invalid namespace name \"%s\"", namespace); ------------------ | | 372| 85|#define ERROR(format, ...) do { \ | | 373| 85| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 85| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 85| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 85|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 85] | | ------------------ ------------------ 58| | return -EINVAL; 59| 1.18k|} lxc_namespace_2_ns_idx: 62| 633|{ 63| 2.31k| for (int i = 0; i < LXC_NS_MAX; i++) { ------------------ | Branch (63:18): [True: 2.26k, False: 52] ------------------ 64| 2.26k| if (strequal(ns_info[i].proc_name, namespace)) ------------------ | Branch (64:7): [True: 581, False: 1.68k] ------------------ 65| 581| return i; 66| 2.26k| } 67| | 68| 52| ERROR("Invalid namespace name \"%s\"", namespace); ------------------ | | 372| 52|#define ERROR(format, ...) do { \ | | 373| 52| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 52| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 52| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 52|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 52] | | ------------------ ------------------ 69| | return -EINVAL; 70| 633|} lxc_file_for_each_line_mmap: 51| 25.1k|{ 52| 25.1k| __do_close int fd = -EBADF, memfd = -EBADF; ------------------ | | 49| 25.1k|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 25.1k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 53| 25.1k| ssize_t ret = -1; 54| 25.1k| char *buf = NULL; 55| 25.1k| struct stat st = {}; 56| 25.1k| ssize_t bytes; 57| 25.1k| char *line; 58| | 59| 25.1k| memfd = memfd_create(".lxc_config_file", MFD_CLOEXEC | MFD_NOEXEC_SEAL); ------------------ | | 405| 25.1k|#define MFD_NOEXEC_SEAL 0x0008U ------------------ 60| | 61| 25.1k| if (memfd < 0 && errno == EINVAL) { ------------------ | Branch (61:6): [True: 25.1k, False: 0] | Branch (61:19): [True: 25.1k, False: 0] ------------------ 62| 25.1k| TRACE("MFD_NOEXEC_SEAL may unsupported, using MFD_CLOEXEC only"); ------------------ | | 347| 25.1k|#define TRACE(format, ...) do { \ | | 348| 25.1k| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 25.1k| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 25.1k| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 25.1k|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 25.1k] | | ------------------ ------------------ 63| 25.1k| memfd = memfd_create(".lxc_config_file", MFD_CLOEXEC); 64| 25.1k| } 65| | 66| 25.1k| if (memfd < 0) { ------------------ | Branch (66:6): [True: 0, False: 25.1k] ------------------ 67| 0| char template[] = P_tmpdir "/.lxc_config_file_XXXXXX"; 68| | 69| 0| if (errno != ENOSYS) { ------------------ | Branch (69:7): [True: 0, False: 0] ------------------ 70| 0| SYSERROR("Failed to create memory file"); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 71| 0| goto on_error; 72| 0| } 73| | 74| 0| TRACE("Failed to create in-memory file. Falling back to temporary file"); ------------------ | | 347| 0|#define TRACE(format, ...) do { \ | | 348| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 0| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 0|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 0] | | ------------------ ------------------ 75| 0| memfd = lxc_make_tmpfile(template, true); 76| 0| if (memfd < 0) { ------------------ | Branch (76:7): [True: 0, False: 0] ------------------ 77| 0| SYSERROR("Failed to create temporary file \"%s\"", template); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 78| 0| goto on_error; 79| 0| } 80| 0| } 81| | 82| 25.1k| fd = open(file, O_RDONLY | O_CLOEXEC); 83| 25.1k| if (fd < 0) { ------------------ | Branch (83:6): [True: 22, False: 25.1k] ------------------ 84| 22| SYSERROR("Failed to open file \"%s\"", file); ------------------ | | 453| 22| do { \ | | 454| 22| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 22| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 22| char *ptr = NULL; \ | | | | 317| 22| { \ | | | | 318| 22| int __saved_errno = errno; \ | | | | 319| 22| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 22| errno = __saved_errno; \ | | | | 321| 22| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 22] | | | | ------------------ | | | | 322| 22| ptr = errno_buf; \ | | | | 323| 22| } | | ------------------ | | 455| 22| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 22|#define ERROR(format, ...) do { \ | | | | 373| 22| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 22| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 22| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 22|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 22] | | | | ------------------ | | ------------------ | | 456| 22| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 22] | | ------------------ ------------------ 85| 22| goto on_error; 86| 22| } 87| | 88| 25.1k| ret = fstat(fd, &st); 89| 25.1k| if (ret) { ------------------ | Branch (89:6): [True: 0, False: 25.1k] ------------------ 90| 0| SYSERROR("Failed to stat file \"%s\"", file); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 91| 0| goto on_error; 92| 0| } 93| | 94| 25.1k| if (st.st_size > INT_MAX) { ------------------ | Branch (94:6): [True: 0, False: 25.1k] ------------------ 95| 0| SYSERROR("Excessively large config file \"%s\"", file); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 96| 0| goto on_error; 97| 0| } 98| | 99| | 100| 25.1k| bytes = __fd_to_fd(fd, memfd); 101| 25.1k| if (bytes < 0) { ------------------ | Branch (101:6): [True: 0, False: 25.1k] ------------------ 102| 0| SYSERROR("Failed to copy config file \"%s\"", file); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 103| 0| goto on_error; 104| 0| } 105| | 106| 25.1k| ret = lxc_write_nointr(memfd, "\0", 1); 107| 25.1k| if (ret < 0) { ------------------ | Branch (107:6): [True: 0, False: 25.1k] ------------------ 108| 0| SYSERROR("Failed to append zero byte"); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 109| 0| goto on_error; 110| 0| } 111| 25.1k| bytes++; 112| | 113| 25.1k| ret = lseek(memfd, 0, SEEK_SET); 114| 25.1k| if (ret < 0) { ------------------ | Branch (114:6): [True: 0, False: 25.1k] ------------------ 115| 0| SYSERROR("Failed to lseek"); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 116| 0| goto on_error; 117| 0| } 118| | 119| 25.1k| ret = -1; 120| 25.1k| buf = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_POPULATE, memfd, 0); 121| 25.1k| if (buf == MAP_FAILED) { ------------------ | Branch (121:6): [True: 0, False: 25.1k] ------------------ 122| 0| buf = NULL; 123| 0| SYSERROR("Failed to mmap"); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 124| 0| goto on_error; 125| 0| } 126| | 127| 25.1k| ret = 0; 128| 612k| lxc_iterate_parts(line, buf, "\r\n\0") { ------------------ | | 187| 25.1k| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 631k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 612k, False: 19.2k] | | ------------------ | | 189| 606k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 129| 612k| ret = callback(line, data); 130| 612k| if (ret) { ------------------ | Branch (130:7): [True: 5.84k, False: 606k] ------------------ 131| | /* Callback rv > 0 means stop here callback rv < 0 means 132| | * error. 133| | */ 134| 5.84k| if (ret < 0) ------------------ | Branch (134:8): [True: 5.84k, False: 0] ------------------ 135| 5.84k| ERROR("Failed to parse config file \"%s\" at line \"%s\"", ------------------ | | 372| 5.84k|#define ERROR(format, ...) do { \ | | 373| 5.84k| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 5.84k| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 5.84k| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 5.84k|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 5.84k] | | ------------------ ------------------ 136| 5.84k| file, line); 137| 5.84k| break; 138| 5.84k| } 139| 612k| } 140| | 141| 25.1k|on_error: 142| 25.1k| if (buf && munmap(buf, bytes)) { ------------------ | Branch (142:6): [True: 25.1k, False: 22] | Branch (142:13): [True: 0, False: 25.1k] ------------------ 143| 0| SYSERROR("Failed to unmap"); ------------------ | | 453| 0| do { \ | | 454| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 455| 0| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 0|#define ERROR(format, ...) do { \ | | | | 373| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 0| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 0|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 456| 0| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 0] | | ------------------ ------------------ 144| 0| if (ret == 0) ------------------ | Branch (144:7): [True: 0, False: 0] ------------------ 145| 0| ret = -1; 146| 0| } 147| | 148| 25.1k| return ret; 149| 25.1k|} storage_put: 667| 11.8k|{ 668| 11.8k| if (bdev) { ------------------ | Branch (668:6): [True: 0, False: 11.8k] ------------------ 669| 0| free_disarm(bdev->mntopts); ------------------ | | 58| 0| ({ \ | | 59| 0| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 0] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 0| }) ------------------ 670| 0| free_disarm(bdev->src); ------------------ | | 58| 0| ({ \ | | 59| 0| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 0] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 0| }) ------------------ 671| 0| free_disarm(bdev->dest); ------------------ | | 58| 0| ({ \ | | 59| 0| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 0] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 0| }) ------------------ 672| | free_disarm(bdev); ------------------ | | 58| 0| ({ \ | | 59| 0| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 0] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 0| }) ------------------ 673| 0| } 674| 11.8k|} lxc_path_simplify: 191| 6.10k|{ 192| 6.10k| __do_free char *path_new = NULL; ------------------ | | 69| 6.10k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 6.10k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 193| 6.10k| char *f, *t; 194| 6.10k| bool slash = false, ignore_slash = false, absolute; 195| | 196| 6.10k| path_new = strdup(path); 197| 6.10k| if (!path_new) ------------------ | Branch (197:6): [True: 0, False: 6.10k] ------------------ 198| 0| return NULL; 199| | 200| 6.10k| if (is_empty_string(path_new)) ------------------ | Branch (200:6): [True: 1.10k, False: 4.99k] ------------------ 201| 1.10k| return move_ptr(path_new); ------------------ | | 694| 1.10k| ({ \ | | 695| 1.10k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.10k| (ptr) = NULL; \ | | 697| 1.10k| __internal_ptr__; \ | | 698| 1.10k| }) ------------------ 202| | 203| 4.99k| absolute = abspath(path_new); 204| | 205| 4.99k| f = path_new; 206| 4.99k| if (*f == '.' && (f[1] == 0 || f[1] == '/')) { ------------------ | Branch (206:6): [True: 1.41k, False: 3.57k] | Branch (206:20): [True: 550, False: 865] | Branch (206:33): [True: 389, False: 476] ------------------ 207| 939| ignore_slash = true; 208| 939| f++; 209| 939| } 210| | 211| 284k| for (t = path_new; *f; f++) { ------------------ | Branch (211:21): [True: 279k, False: 4.99k] ------------------ 212| | 213| 279k| if (*f == '/') { ------------------ | Branch (213:7): [True: 4.31k, False: 275k] ------------------ 214| 4.31k| slash = true; 215| 4.31k| continue; 216| 4.31k| } 217| | 218| 275k| if (slash) { ------------------ | Branch (218:7): [True: 3.50k, False: 271k] ------------------ 219| 3.50k| if (*f == '.' && (f[1] == 0 || f[1] == '/')) ------------------ | Branch (219:8): [True: 1.17k, False: 2.32k] | Branch (219:22): [True: 431, False: 748] | Branch (219:35): [True: 206, False: 542] ------------------ 220| 637| continue; 221| | 222| 2.86k| slash = false; 223| 2.86k| if (ignore_slash) ------------------ | Branch (223:8): [True: 194, False: 2.66k] ------------------ 224| 194| ignore_slash = false; 225| 2.66k| else 226| 2.66k| *(t++) = '/'; 227| 2.86k| } 228| | 229| 274k| *(t++) = *f; 230| 274k| } 231| | 232| 4.99k| if (t == path_new) { ------------------ | Branch (232:6): [True: 1.55k, False: 3.43k] ------------------ 233| 1.55k| if (absolute) ------------------ | Branch (233:7): [True: 813, False: 745] ------------------ 234| 813| *(t++) = '/'; 235| 745| else 236| 745| *(t++) = '.'; 237| 1.55k| } 238| | 239| 4.99k| *t = 0; 240| | return move_ptr(path_new); ------------------ | | 694| 4.99k| ({ \ | | 695| 4.99k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 4.99k| (ptr) = NULL; \ | | 697| 4.99k| __internal_ptr__; \ | | 698| 4.99k| }) ------------------ 241| 6.10k|} lxc_safe_uint: 569| 11.9k|{ 570| 11.9k| char *err = NULL; 571| 11.9k| unsigned long int uli; 572| | 573| 11.9k| while (isspace(*numstr)) ------------------ | Branch (573:9): [True: 273, False: 11.9k] ------------------ 574| 273| numstr++; 575| | 576| 11.9k| if (*numstr == '-') ------------------ | Branch (576:6): [True: 186, False: 11.7k] ------------------ 577| 186| return -EINVAL; 578| | 579| 11.9k| errno = 0; 580| 11.7k| uli = strtoul(numstr, &err, 0); 581| 11.7k| if (errno == ERANGE && uli == ULONG_MAX) ------------------ | Branch (581:6): [True: 1, False: 11.7k] | Branch (581:25): [True: 1, False: 0] ------------------ 582| 1| return -ERANGE; 583| | 584| 11.7k| if (err == numstr || *err != '\0') ------------------ | Branch (584:6): [True: 554, False: 11.1k] | Branch (584:23): [True: 225, False: 10.9k] ------------------ 585| 779| return -EINVAL; 586| | 587| 10.9k| if (uli > UINT_MAX) ------------------ | Branch (587:6): [True: 271, False: 10.7k] ------------------ 588| 271| return -ERANGE; 589| | 590| 10.7k| *converted = (unsigned int)uli; 591| 10.7k| return 0; 592| 10.9k|} lxc_safe_ulong: 595| 6.79k|{ 596| 6.79k| char *err = NULL; 597| 6.79k| unsigned long int uli; 598| | 599| 6.79k| while (isspace(*numstr)) ------------------ | Branch (599:9): [True: 196, False: 6.79k] ------------------ 600| 196| numstr++; 601| | 602| 6.79k| if (*numstr == '-') ------------------ | Branch (602:6): [True: 2, False: 6.79k] ------------------ 603| 2| return -EINVAL; 604| | 605| 6.79k| errno = 0; 606| 6.79k| uli = strtoul(numstr, &err, 0); 607| 6.79k| if (errno == ERANGE && uli == ULONG_MAX) ------------------ | Branch (607:6): [True: 2, False: 6.78k] | Branch (607:25): [True: 2, False: 0] ------------------ 608| 2| return -ERANGE; 609| | 610| 6.78k| if (err == numstr || *err != '\0') ------------------ | Branch (610:6): [True: 27, False: 6.76k] | Branch (610:23): [True: 13, False: 6.74k] ------------------ 611| 40| return -EINVAL; 612| | 613| 6.74k| *converted = uli; 614| 6.74k| return 0; 615| 6.78k|} lxc_safe_int64_residual: 643| 37.2k|{ 644| 37.2k| char *remaining = NULL; 645| 37.2k| int64_t u; 646| | 647| 37.2k| if (residual && residual_len == 0) ------------------ | Branch (647:6): [True: 37.2k, False: 0] | Branch (647:18): [True: 0, False: 37.2k] ------------------ 648| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 649| | 650| 37.2k| if (!residual && residual_len != 0) ------------------ | Branch (650:6): [True: 0, False: 37.2k] | Branch (650:19): [True: 0, False: 0] ------------------ 651| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 652| | 653| 37.2k| memset(residual, 0, residual_len); 654| | 655| 37.2k| while (isspace(*numstr)) ------------------ | Branch (655:9): [True: 265, False: 37.2k] ------------------ 656| 265| numstr++; 657| | 658| 37.2k| errno = 0; 659| 37.2k| u = strtoll(numstr, &remaining, base); 660| 37.2k| if (errno == ERANGE && u == INT64_MAX) ------------------ | Branch (660:6): [True: 311, False: 36.9k] | Branch (660:25): [True: 2, False: 309] ------------------ 661| 2| return ret_errno(ERANGE); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 662| | 663| 37.2k| if (remaining == numstr) ------------------ | Branch (663:6): [True: 10, False: 37.2k] ------------------ 664| 10| return -EINVAL; 665| | 666| 37.2k| if (residual) { ------------------ | Branch (666:6): [True: 37.2k, False: 0] ------------------ 667| 37.2k| size_t len = 0; 668| | 669| 37.2k| if (*remaining == '\0') ------------------ | Branch (669:7): [True: 178, False: 37.0k] ------------------ 670| 178| goto out; 671| | 672| 37.0k| len = strlen(remaining); 673| 37.0k| if (len >= residual_len) ------------------ | Branch (673:7): [True: 30, False: 37.0k] ------------------ 674| 30| return ret_errno(EINVAL); ------------------ | | 715| 30| ({ \ | | 716| 30| errno = labs(__errno__); \ | | 717| 30| -errno; \ | | 718| 30| }) ------------------ 675| | 676| 37.0k| memcpy(residual, remaining, len); 677| 37.0k| } else if (*remaining != '\0') { ------------------ | Branch (677:13): [True: 0, False: 0] ------------------ 678| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 679| 0| } 680| | 681| 37.2k|out: 682| 37.2k| *converted = u; 683| 37.2k| return 0; 684| 37.2k|} lxc_safe_int: 687| 2.39k|{ 688| 2.39k| char *err = NULL; 689| 2.39k| signed long int sli; 690| | 691| 2.39k| errno = 0; 692| 2.39k| sli = strtol(numstr, &err, 0); 693| 2.39k| if (errno == ERANGE && (sli == LONG_MAX || sli == LONG_MIN)) ------------------ | Branch (693:6): [True: 388, False: 2.01k] | Branch (693:26): [True: 194, False: 194] | Branch (693:45): [True: 194, False: 0] ------------------ 694| 388| return -ERANGE; 695| | 696| 2.01k| if (errno != 0 && sli == 0) ------------------ | Branch (696:6): [True: 0, False: 2.01k] | Branch (696:20): [True: 0, False: 0] ------------------ 697| 0| return -EINVAL; 698| | 699| 2.01k| if (err == numstr || *err != '\0') ------------------ | Branch (699:6): [True: 222, False: 1.78k] | Branch (699:23): [True: 208, False: 1.58k] ------------------ 700| 430| return -EINVAL; 701| | 702| 1.58k| if (sli > INT_MAX || sli < INT_MIN) ------------------ | Branch (702:6): [True: 197, False: 1.38k] | Branch (702:23): [True: 234, False: 1.15k] ------------------ 703| 431| return -ERANGE; 704| | 705| 1.15k| *converted = (int)sli; 706| 1.15k| return 0; 707| 1.58k|} lxc_safe_long_long: 730| 2.49k|{ 731| 2.49k| char *err = NULL; 732| 2.49k| signed long long int sli; 733| | 734| 2.49k| errno = 0; 735| 2.49k| sli = strtoll(numstr, &err, 0); 736| 2.49k| if (errno == ERANGE && (sli == LLONG_MAX || sli == LLONG_MIN)) ------------------ | Branch (736:6): [True: 2, False: 2.49k] | Branch (736:26): [True: 1, False: 1] | Branch (736:46): [True: 1, False: 0] ------------------ 737| 2| return -ERANGE; 738| | 739| 2.49k| if (errno != 0 && sli == 0) ------------------ | Branch (739:6): [True: 0, False: 2.49k] | Branch (739:20): [True: 0, False: 0] ------------------ 740| 0| return -EINVAL; 741| | 742| 2.49k| if (err == numstr || *err != '\0') ------------------ | Branch (742:6): [True: 38, False: 2.45k] | Branch (742:23): [True: 9, False: 2.44k] ------------------ 743| 47| return -EINVAL; 744| | 745| 2.44k| *converted = sli; 746| 2.44k| return 0; 747| 2.49k|} parse_byte_size_string: 874| 2.54k|{ 875| 2.54k| int ret, suffix_len; 876| 2.54k| long long int conv, mltpl; 877| 2.54k| char *end; 878| 2.54k| char dup[INTTYPE_TO_STRLEN(long long int)] = {0}; 879| 2.54k| char suffix[3] = {0}; 880| 2.54k| size_t len; 881| | 882| 2.54k| if (!s) ------------------ | Branch (882:6): [True: 0, False: 2.54k] ------------------ 883| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 884| | 885| 2.54k| len = strlen(s); 886| 2.54k| if (len == 0 || len > sizeof(dup) - 1) ------------------ | Branch (886:6): [True: 0, False: 2.54k] | Branch (886:18): [True: 11, False: 2.53k] ------------------ 887| 11| return ret_errno(EINVAL); ------------------ | | 715| 11| ({ \ | | 716| 11| errno = labs(__errno__); \ | | 717| 11| -errno; \ | | 718| 11| }) ------------------ 888| | 889| 2.53k| memcpy(dup, s, len); 890| | 891| 2.53k| end = dup + len; 892| 2.53k| if (isdigit(*(end - 1))) ------------------ | Branch (892:6): [True: 546, False: 1.98k] ------------------ 893| 546| suffix_len = 0; 894| 1.98k| else if (isalpha(*(end - 1))) ------------------ | Branch (894:11): [True: 1.96k, False: 24] ------------------ 895| 1.96k| suffix_len = 1; 896| 24| else 897| 24| return ret_errno(EINVAL); ------------------ | | 715| 24| ({ \ | | 716| 24| errno = labs(__errno__); \ | | 717| 24| -errno; \ | | 718| 24| }) ------------------ 898| | 899| 2.50k| if (suffix_len > 0) { ------------------ | Branch (899:6): [True: 1.96k, False: 546] ------------------ 900| 1.96k| if ((end - 1) == dup) ------------------ | Branch (900:7): [True: 4, False: 1.95k] ------------------ 901| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 902| | 903| 1.95k| if ((end - 2) == dup) { ------------------ | Branch (903:7): [True: 224, False: 1.73k] ------------------ 904| 224| if (isalpha(*(end - 2))) ------------------ | Branch (904:8): [True: 7, False: 217] ------------------ 905| 7| return ret_errno(EINVAL); ------------------ | | 715| 7| ({ \ | | 716| 7| errno = labs(__errno__); \ | | 717| 7| -errno; \ | | 718| 7| }) ------------------ 906| | /* 1B */ 907| 1.73k| } else { 908| 1.73k| if (isalpha(*(end - 2))) /* 12MB */ ------------------ | Branch (908:8): [True: 1.45k, False: 278] ------------------ 909| 1.45k| suffix_len++; 910| | 911| | /* 12B */ 912| 1.73k| } 913| | 914| 1.94k| memcpy(suffix, end - suffix_len, suffix_len); 915| 1.94k| *(suffix + suffix_len) = '\0'; 916| 1.94k| *(end - suffix_len) = '\0'; 917| 1.94k| } 918| | 919| 2.49k| dup[lxc_char_right_gc(dup, strlen(dup))] = '\0'; 920| | 921| 2.49k| ret = lxc_safe_long_long(dup, &conv); 922| 2.49k| if (ret) ------------------ | Branch (922:6): [True: 49, False: 2.44k] ------------------ 923| 49| return ret; 924| | 925| 2.44k| if (suffix_len != 2) { ------------------ | Branch (925:6): [True: 998, False: 1.44k] ------------------ 926| 998| *converted = conv; 927| 998| return 0; 928| 998| } 929| | 930| 1.44k| if (strcasecmp(suffix, "KB") == 0) ------------------ | Branch (930:6): [True: 266, False: 1.18k] ------------------ 931| 266| mltpl = 1024; 932| 1.18k| else if (strcasecmp(suffix, "MB") == 0) ------------------ | Branch (932:11): [True: 422, False: 760] ------------------ 933| 422| mltpl = 1024 * 1024; 934| 760| else if (strcasecmp(suffix, "GB") == 0) ------------------ | Branch (934:11): [True: 734, False: 26] ------------------ 935| 734| mltpl = 1024 * 1024 * 1024; 936| 26| else 937| 26| return ret_errno(EINVAL); ------------------ | | 715| 26| ({ \ | | 716| 26| errno = labs(__errno__); \ | | 717| 26| -errno; \ | | 718| 26| }) ------------------ 938| | 939| 1.42k| if (check_mul_overflow(conv, mltpl, converted)) ------------------ | | 216| 1.42k|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 67, False: 1.35k] | | ------------------ | | 217| 1.42k| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 1.42k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 1.42k| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 1.42k|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 1.42k| typeof(a) __a = (a); \ | | | | 193| 1.42k| typeof(b) __b = (b); \ | | | | 194| 1.42k| typeof(d) __d = (d); \ | | | | 195| 1.42k| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 1.42k|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 1.42k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 1.42k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 1.42k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 1.42k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 1.42k| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 1.42k|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 1.42k|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 1.42k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 1.42k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 1.42k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 1.42k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 1.42k| (void) (&__a == &__b); \ | | | | 198| 1.42k| (void) (&__a == __d); \ | | | | 199| 1.42k| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 1.42k| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 1.42k, False: 0] | | | | | Branch (200:17): [True: 66, False: 1.35k] | | | | | Branch (200:37): [True: 1, False: 1.35k] | | | | ------------------ | | | | 201| 1.42k| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 1.35k] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 1.42k| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 1.35k] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 1.42k|}) | | ------------------ | | 219| 1.42k| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 1.42k|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 1.42k| typeof(a) __a = (a); \ | | | | 122| 1.42k| typeof(b) __b = (b); \ | | | | 123| 1.42k| typeof(d) __d = (d); \ | | | | 124| 1.42k| (void) (&__a == &__b); \ | | | | 125| 1.42k| (void) (&__a == __d); \ | | | | 126| 1.42k| *__d = __a * __b; \ | | | | 127| 1.42k| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 1.42k] | | | | ------------------ | | | | 128| 1.42k| __b > 0 && __a > type_max(typeof(__a)) / __b : \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (128:4): [True: 0, False: 0] | | | | | Branch (128:15): [True: 0, False: 0] | | | | ------------------ | | | | 129| 1.42k| __a > 0 && __b > type_max(typeof(__b)) / __a; \ | | | | ------------------ | | | | | | 50| 0|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 0|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 0|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | | Branch (129:4): [True: 0, False: 1.42k] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 1.42k|}) | | ------------------ ------------------ 940| 67| return ret_errno(ERANGE); ------------------ | | 715| 67| ({ \ | | 716| 67| errno = labs(__errno__); \ | | 717| 67| -errno; \ | | 718| 67| }) ------------------ 941| | 942| 1.35k| return 0; 943| 1.42k|} lxc_char_left_gc: 957| 842k|{ 958| 842k| size_t i; 959| | 960| 911k| for (i = 0; i < len; i++) { ------------------ | Branch (960:14): [True: 877k, False: 34.2k] ------------------ 961| 877k| if (buffer[i] == ' ' || ------------------ | Branch (961:7): [True: 16.5k, False: 860k] ------------------ 962| 860k| buffer[i] == '\t') ------------------ | Branch (962:7): [True: 52.3k, False: 808k] ------------------ 963| 68.9k| continue; 964| | 965| 808k| return i; 966| 877k| } 967| | 968| 34.2k| return 0; 969| 842k|} lxc_char_right_gc: 972| 211k|{ 973| 211k| int i; 974| | 975| 215k| for (i = len - 1; i >= 0; i--) { ------------------ | Branch (975:20): [True: 181k, False: 34.2k] ------------------ 976| 181k| if (buffer[i] == ' ' || ------------------ | Branch (976:7): [True: 2.47k, False: 178k] ------------------ 977| 178k| buffer[i] == '\t' || ------------------ | Branch (977:7): [True: 923, False: 177k] ------------------ 978| 177k| buffer[i] == '\n' || ------------------ | Branch (978:7): [True: 0, False: 177k] ------------------ 979| 177k| buffer[i] == '\0') ------------------ | Branch (979:7): [True: 0, False: 177k] ------------------ 980| 3.40k| continue; 981| | 982| 177k| return i + 1; 983| 181k| } 984| | 985| 34.2k| return 0; 986| 211k|} lxc_trim_whitespace_in_place: 989| 4.60k|{ 990| 4.60k| buffer += lxc_char_left_gc(buffer, strlen(buffer)); 991| 4.60k| buffer[lxc_char_right_gc(buffer, strlen(buffer))] = '\0'; 992| 4.60k| return buffer; 993| 4.60k|} lxc_is_line_empty: 996| 612k|{ 997| 612k| size_t len = strlen(line); 998| | 999| 678k| for (size_t i = 0; i < len; i++) ------------------ | Branch (999:21): [True: 677k, False: 248] ------------------ 1000| 677k| if (line[i] != ' ' && line[i] != '\t' && ------------------ | Branch (1000:7): [True: 662k, False: 14.9k] | Branch (1000:25): [True: 612k, False: 50.3k] ------------------ 1001| 612k| line[i] != '\n' && line[i] != '\r' && ------------------ | Branch (1001:7): [True: 612k, False: 0] | Branch (1001:26): [True: 612k, False: 0] ------------------ 1002| 612k| line[i] != '\f' && line[i] != '\0') ------------------ | Branch (1002:7): [True: 612k, False: 268] | Branch (1002:26): [True: 612k, False: 0] ------------------ 1003| 612k| return 0; 1004| 248| return 1; 1005| 612k|} conf.c:is_empty_string: 112| 706|{ 113| 706| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 706] | Branch (113:15): [True: 15, False: 691] ------------------ 114| 706|} conf.c:strequal: 135| 106k|{ 136| 106k| return strcmp(str, eq) == 0; 137| 106k|} conf.c:strnequal: 130| 556k|{ 131| 556k| return strncmp(str, eq, len) == 0; 132| 556k|} confile.c:strequal: 135| 5.76M|{ 136| 5.76M| return strcmp(str, eq) == 0; 137| 5.76M|} confile.c:abspath: 145| 2.17k|{ 146| 2.17k| return *str == '/'; 147| 2.17k|} confile.c:dotdot: 140| 1.76k|{ 141| 1.76k| return !!strstr(str, ".."); 142| 1.76k|} confile.c:is_empty_string: 112| 66.8k|{ 113| 66.8k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 66.8k] | Branch (113:15): [True: 128, False: 66.7k] ------------------ 114| 66.8k|} confile.c:strnequal: 130| 693k|{ 131| 693k| return strncmp(str, eq, len) == 0; 132| 693k|} confile_utils.c:strequal: 135| 5.08k|{ 136| 5.08k| return strcmp(str, eq) == 0; 137| 5.08k|} confile_utils.c:strnequal: 130| 225k|{ 131| 225k| return strncmp(str, eq, len) == 0; 132| 225k|} confile_utils.c:is_empty_string: 112| 1.03k|{ 113| 1.03k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 1.03k] | Branch (113:15): [True: 8, False: 1.03k] ------------------ 114| 1.03k|} log.c:is_empty_string: 112| 1.75k|{ 113| 1.75k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 1.75k] | Branch (113:15): [True: 0, False: 1.75k] ------------------ 114| 1.75k|} namespace.c:strequal: 135| 2.26k|{ 136| 2.26k| return strcmp(str, eq) == 0; 137| 2.26k|} string_utils.c:is_empty_string: 112| 6.10k|{ 113| 6.10k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 6.10k] | Branch (113:15): [True: 1.10k, False: 4.99k] ------------------ 114| 6.10k|} string_utils.c:abspath: 145| 4.99k|{ 146| 4.99k| return *str == '/'; 147| 4.99k|} lxc_terminal_conf_free: 1398| 11.8k|{ 1399| 11.8k| free(terminal->log_path); 1400| 11.8k| free(terminal->path); 1401| 11.8k| if (terminal->buffer_size > 0 && terminal->ringbuf.addr) ------------------ | Branch (1401:6): [True: 178, False: 11.6k] | Branch (1401:35): [True: 0, False: 178] ------------------ 1402| 0| lxc_ringbuf_release(&terminal->ringbuf); 1403| 11.8k| lxc_terminal_signal_fini(terminal); 1404| 11.8k|} terminal.c:lxc_terminal_signal_fini: 164| 11.8k|{ 165| 11.8k| struct lxc_terminal_state *state = terminal->tty_state; 166| | 167| 11.8k| if (!terminal->tty_state) ------------------ | Branch (167:6): [True: 11.8k, False: 0] ------------------ 168| 11.8k| return; 169| | 170| 0| state = terminal->tty_state; 171| 0| if (state->sigfd >= 0) { ------------------ | Branch (171:6): [True: 0, False: 0] ------------------ 172| 0| close(state->sigfd); 173| | 174| 0| if (pthread_sigmask(SIG_SETMASK, &state->oldmask, NULL) < 0) ------------------ | Branch (174:7): [True: 0, False: 0] ------------------ 175| 0| SYSWARN("Failed to restore signal mask"); ------------------ | | 442| 0| do { \ | | 443| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 444| 0| WARN("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 367| 0|#define WARN(format, ...) do { \ | | | | 368| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 369| 0| LXC_WARN(&locinfo, format, ##__VA_ARGS__); \ | | | | 370| 0|} while (0) | | | | ------------------ | | | | | Branch (370:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 445| 0| } while (0) | | ------------------ | | | Branch (445:11): [Folded, False: 0] | | ------------------ ------------------ 176| 0| } 177| | 178| 0| free(terminal->tty_state); 179| | terminal->tty_state = NULL; 180| 0|} get_u16: 202| 1.50k|{ 203| 1.50k| unsigned long res; 204| 1.50k| char *ptr; 205| | 206| 1.50k| if (!arg || !*arg) ------------------ | Branch (206:6): [True: 0, False: 1.50k] | Branch (206:14): [True: 0, False: 1.50k] ------------------ 207| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 208| | 209| 1.50k| errno = 0; 210| 1.50k| res = strtoul(arg, &ptr, base); 211| 1.50k| if (!ptr || ptr == arg || *ptr || res > 0xFFFF || errno != 0) ------------------ | Branch (211:6): [True: 0, False: 1.50k] | Branch (211:14): [True: 7, False: 1.49k] | Branch (211:28): [True: 9, False: 1.49k] | Branch (211:36): [True: 1, False: 1.48k] | Branch (211:52): [True: 0, False: 1.48k] ------------------ 212| 17| return ret_errno(ERANGE); ------------------ | | 715| 17| ({ \ | | 716| 17| errno = labs(__errno__); \ | | 717| 17| -errno; \ | | 718| 17| }) ------------------ 213| | 214| 1.48k| *val = res; 215| | 216| 1.48k| return 0; 217| 1.50k|} randseed: 736| 1.94k|{ 737| 1.94k| __do_fclose FILE *f = NULL; ------------------ | | 52| 1.94k|#define __do_fclose call_cleaner(fclose) | | ------------------ | | | | 26| 1.94k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 738| | /* 739| | * srand pre-seed function based on /dev/urandom 740| | */ 741| 1.94k| unsigned int seed = time(NULL) + getpid(); 742| | 743| 1.94k| f = fopen("/dev/urandom", "re"); 744| 1.94k| if (f) { ------------------ | Branch (744:6): [True: 1.94k, False: 0] ------------------ 745| 1.94k| int ret = fread(&seed, sizeof(seed), 1, f); 746| 1.94k| if (ret != 1) ------------------ | Branch (746:7): [True: 0, False: 1.94k] ------------------ 747| 0| SYSDEBUG("Unable to fread /dev/urandom, fallback to time+pid rand seed"); ------------------ | | 408| 0| do { \ | | 409| 0| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 0| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 0| char *ptr = NULL; \ | | | | 317| 0| { \ | | | | 318| 0| int __saved_errno = errno; \ | | | | 319| 0| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 0| errno = __saved_errno; \ | | | | 321| 0| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 0] | | | | ------------------ | | | | 322| 0| ptr = errno_buf; \ | | | | 323| 0| } | | ------------------ | | 410| 0| DEBUG("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 352| 0|#define DEBUG(format, ...) do { \ | | | | 353| 0| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 0| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 354| 0| LXC_DEBUG(&locinfo, format, ##__VA_ARGS__); \ | | | | 355| 0|} while (0) | | | | ------------------ | | | | | Branch (355:10): [Folded, False: 0] | | | | ------------------ | | ------------------ | | 411| 0| } while (0) | | ------------------ | | | Branch (411:11): [Folded, False: 0] | | ------------------ ------------------ 748| 1.94k| } 749| | 750| 1.94k| if (srand_it) ------------------ | Branch (750:6): [True: 0, False: 1.94k] ------------------ 751| 0| srand(seed); 752| | 753| 1.94k| return seed; 754| 1.94k|} lxc_find_next_power2: 1776| 2.13k|{ 1777| | /* 0 is not valid input. We return 0 to the caller since 0 is not a 1778| | * valid power of two. 1779| | */ 1780| 2.13k| if (n == 0) ------------------ | Branch (1780:6): [True: 0, False: 2.13k] ------------------ 1781| 0| return 0; 1782| | 1783| 2.13k| if (!(n & (n - 1))) ------------------ | Branch (1783:6): [True: 1.23k, False: 908] ------------------ 1784| 1.23k| return n; 1785| | 1786| 12.9k| while (n & (n - 1)) ------------------ | Branch (1786:9): [True: 12.0k, False: 908] ------------------ 1787| 12.0k| n = n & (n - 1); 1788| | 1789| 908| n = n << 1; 1790| 908| return n; 1791| 2.13k|} confile.c:lxc_getpagesize: 204| 2.13k|{ 205| 2.13k| int64_t pgsz; 206| | 207| 2.13k| pgsz = sysconf(_SC_PAGESIZE); 208| 2.13k| if (pgsz <= 0) ------------------ | Branch (208:6): [True: 0, False: 2.13k] ------------------ 209| 0| pgsz = 1 << 12; 210| | 211| 2.13k| return pgsz; 212| 2.13k|} file_utils.c:lxc_set_cloexec: 33| 11.8k|{ 34| 11.8k| return fcntl(fd, F_SETFD, FD_CLOEXEC); 35| 11.8k|} LLVMFuzzerTestOneInput: 15| 11.8k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 16| 11.8k| int fd = -1; 17| 11.8k| char tmpf[] = "/tmp/fuzz-lxc-config-read-XXXXXX"; 18| 11.8k| struct lxc_conf *conf = NULL; 19| | 20| | /* 21| | * 100Kb should probably be enough to trigger all the issues 22| | * we're interested in without any timeouts 23| | */ 24| 11.8k| if (size > 102400) ------------------ | Branch (24:6): [True: 4, False: 11.8k] ------------------ 25| 4| return 0; 26| | 27| 11.8k| fd = lxc_make_tmpfile(tmpf, false); 28| 11.8k| lxc_test_assert_abort(fd >= 0); ------------------ | | 34| 11.8k|#define lxc_test_assert_abort(expression) lxc_test_assert_stringify(expression, #expression) | | ------------------ | | | | 26| 11.8k| do { \ | | | | 27| 11.8k| if (!(expression)) { \ | | | | ------------------ | | | | | Branch (27:7): [True: 0, False: 11.8k] | | | | ------------------ | | | | 28| 0| fprintf(stderr, "%s: %s: %d: %s\n", __FILE__, \ | | | | 29| | __func__, __LINE__, stringify_expression); \ | | | | 30| 0| abort(); \ | | | | 31| 0| } \ | | | | 32| 11.8k| } while (false) | | ------------------ ------------------ | Branch (28:2): [Folded, False: 11.8k] ------------------ 29| 11.8k| lxc_write_nointr(fd, data, size); 30| 11.8k| close(fd); 31| | 32| 11.8k| conf = lxc_conf_init(); 33| 11.8k| lxc_test_assert_abort(conf); ------------------ | | 34| 11.8k|#define lxc_test_assert_abort(expression) lxc_test_assert_stringify(expression, #expression) | | ------------------ | | | | 26| 11.8k| do { \ | | | | 27| 11.8k| if (!(expression)) { \ | | | | ------------------ | | | | | Branch (27:7): [True: 0, False: 11.8k] | | | | ------------------ | | | | 28| 0| fprintf(stderr, "%s: %s: %d: %s\n", __FILE__, \ | | | | 29| | __func__, __LINE__, stringify_expression); \ | | | | 30| 0| abort(); \ | | | | 31| 0| } \ | | | | 32| 11.8k| } while (false) | | ------------------ ------------------ | Branch (33:2): [Folded, False: 11.8k] ------------------ 34| 11.8k| lxc_config_read(tmpf, conf, false); 35| 11.8k| lxc_conf_free(conf); 36| | 37| 11.8k| (void) unlink(tmpf); 38| 11.8k| return 0; 39| 11.8k|}