netns_freeifaddrs: 500| 946|{ 501| 946| struct netns_ifaddrs *n; 502| | 503| 4.73k| while (ifp) { ------------------ | Branch (503:9): [True: 3.78k, False: 946] ------------------ 504| 3.78k| n = ifp->ifa_next; 505| 3.78k| free(ifp); 506| 3.78k| ifp = n; 507| 3.78k| } 508| 946|} netns_getifaddrs: 512| 946|{ 513| 946| int r, saved_errno; 514| 946| struct ifaddrs_ctx _ctx; 515| 946| struct ifaddrs_ctx *ctx = &_ctx; 516| | 517| 946| memset(ctx, 0, sizeof *ctx); 518| | 519| 946| r = __rtnl_enumerate(AF_UNSPEC, AF_UNSPEC, netns_id, netnsid_aware, 520| 946| nl_msg_to_ifaddr, ctx); 521| 946| saved_errno = errno; 522| 946| if (r < 0) ------------------ | Branch (522:6): [True: 0, False: 946] ------------------ 523| 0| netns_freeifaddrs(&ctx->first->ifa); 524| 946| else 525| 946| *ifap = &ctx->first->ifa; 526| 946| errno = saved_errno; 527| | 528| 946| return r; 529| 946|} netns_ifaddrs.c:__rtnl_enumerate: 465| 946|{ 466| 946| int fd, r, saved_errno; 467| 946| bool getaddr_netnsid_aware = false, getlink_netnsid_aware = false; 468| | 469| 946| fd = socket(PF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE); 470| 946| if (fd < 0) ------------------ | Branch (470:6): [True: 0, False: 946] ------------------ 471| 0| return -1; 472| | 473| 946| r = setsockopt(fd, SOL_NETLINK, NETLINK_GET_STRICT_CHK, &(int){1}, 474| 946| sizeof(int)); 475| 946| if (r < 0 && netns_id >= 0) { ------------------ | Branch (475:6): [True: 0, False: 946] | Branch (475:15): [True: 0, False: 0] ------------------ 476| 0| close(fd); 477| 0| *netnsid_aware = false; 478| 0| return -1; 479| 0| } 480| | 481| 946| r = __ifaddrs_netlink_recv(fd, 1, RTM_GETLINK, link_af, netns_id, 482| 946| &getlink_netnsid_aware, cb, ctx); 483| 946| if (!r) ------------------ | Branch (483:6): [True: 946, False: 0] ------------------ 484| 946| r = __ifaddrs_netlink_recv(fd, 2, RTM_GETADDR, addr_af, netns_id, 485| 946| &getaddr_netnsid_aware, cb, ctx); 486| | 487| 946| saved_errno = errno; 488| 946| close(fd); 489| 946| errno = saved_errno; 490| | 491| 946| if (getaddr_netnsid_aware && getlink_netnsid_aware) ------------------ | Branch (491:6): [True: 0, False: 946] | Branch (491:31): [True: 0, False: 0] ------------------ 492| 0| *netnsid_aware = true; 493| 946| else 494| 946| *netnsid_aware = false; 495| | 496| 946| return r; 497| 946|} netns_ifaddrs.c:__ifaddrs_netlink_recv: 377| 1.89k|{ 378| 1.89k| int r, property, ret; 379| 1.89k| char *buf; 380| 1.89k| struct nlmsghdr *hdr; 381| 1.89k| struct ifinfomsg *ifi_msg; 382| 1.89k| struct ifaddrmsg *ifa_msg; 383| 1.89k| union { 384| 1.89k| uint8_t buf[8192]; 385| 1.89k| struct { 386| 1.89k| struct nlmsghdr nlh; 387| 1.89k| struct rtgenmsg g; 388| 1.89k| } req; 389| 1.89k| struct nlmsghdr reply; 390| 1.89k| } u; 391| 1.89k| char getlink_buf[__NETLINK_ALIGN(sizeof(struct nlmsghdr)) + 392| 1.89k| __NETLINK_ALIGN(sizeof(struct ifinfomsg)) + 393| 1.89k| __NETLINK_ALIGN(1024)] = {0}; 394| 1.89k| char getaddr_buf[__NETLINK_ALIGN(sizeof(struct nlmsghdr)) + 395| 1.89k| __NETLINK_ALIGN(sizeof(struct ifaddrmsg)) + 396| 1.89k| __NETLINK_ALIGN(1024)] = {0}; 397| | 398| 1.89k|#pragma GCC diagnostic push 399| 1.89k|#pragma GCC diagnostic ignored "-Wcast-align" 400| 1.89k| if (type == RTM_GETLINK) { ------------------ | Branch (400:6): [True: 946, False: 946] ------------------ 401| 946| buf = getlink_buf; 402| 946| hdr = (struct nlmsghdr *)buf; 403| 946| hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*ifi_msg)); 404| | 405| 946| ifi_msg = (struct ifinfomsg *)__NLMSG_DATA(hdr); ------------------ | | 41| 946|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 406| 946| ifi_msg->ifi_family = af; 407| | 408| 946| property = IFLA_TARGET_NETNSID; ------------------ | | 520| 946|#define IFLA_TARGET_NETNSID 46 ------------------ 409| 946| } else if (type == RTM_GETADDR) { ------------------ | Branch (409:13): [True: 946, False: 0] ------------------ 410| 946| buf = getaddr_buf; 411| 946| hdr = (struct nlmsghdr *)buf; 412| 946| hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*ifa_msg)); 413| | 414| 946| ifa_msg = (struct ifaddrmsg *)__NLMSG_DATA(hdr); ------------------ | | 41| 946|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 415| 946| ifa_msg->ifa_family = af; 416| | 417| 946| property = IFA_TARGET_NETNSID; ------------------ | | 524| 946|#define IFA_TARGET_NETNSID 10 ------------------ 418| 946| } else { 419| 0| errno = EINVAL; 420| 0| return -1; 421| 0| } 422| 1.89k|#pragma GCC diagnostic pop 423| | 424| 1.89k| hdr->nlmsg_type = type; 425| 1.89k| hdr->nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST; 426| 1.89k| hdr->nlmsg_pid = 0; 427| 1.89k| hdr->nlmsg_seq = seq; 428| | 429| 1.89k| if (netns_id >= 0) ------------------ | Branch (429:6): [True: 0, False: 1.89k] ------------------ 430| 0| addattr(hdr, 1024, property, &netns_id, sizeof(netns_id)); 431| | 432| 1.89k| r = __ifaddrs_netlink_send(fd, hdr); 433| 1.89k| if (r < 0) ------------------ | Branch (433:6): [True: 0, False: 1.89k] ------------------ 434| 0| return -1; 435| | 436| 3.78k| for (;;) { 437| 3.78k| r = recv(fd, u.buf, sizeof(u.buf), MSG_DONTWAIT); 438| 3.78k| if (r <= 0) ------------------ | Branch (438:7): [True: 0, False: 3.78k] ------------------ 439| 0| return -1; 440| | 441| 3.78k|#pragma GCC diagnostic push 442| 3.78k|#pragma GCC diagnostic ignored "-Wcast-align" 443| 7.56k| for (hdr = &u.reply; __NLMSG_OK(hdr, (void *)&u.buf[r]); ------------------ | | 36| 7.56k| ((size_t)((char *)(end) - (char *)(nlh)) >= sizeof(struct nlmsghdr)) | | ------------------ | | | Branch (36:2): [True: 5.67k, False: 1.89k] | | ------------------ ------------------ 444| 5.67k| hdr = __NLMSG_NEXT(hdr)) { ------------------ | | 39| 3.78k| (struct nlmsghdr *)((char *)(nlh) + __NETLINK_ALIGN((nlh)->nlmsg_len)) | | ------------------ | | | | 33| 3.78k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 445| 5.67k| if (hdr->nlmsg_type == NLMSG_DONE) ------------------ | Branch (445:8): [True: 1.89k, False: 3.78k] ------------------ 446| 1.89k| return 0; 447| | 448| 3.78k| if (hdr->nlmsg_type == NLMSG_ERROR) { ------------------ | Branch (448:8): [True: 0, False: 3.78k] ------------------ 449| 0| errno = EINVAL; 450| 0| return -1; 451| 0| } 452| | 453| 3.78k| ret = cb(ctx, netnsid_aware, hdr); 454| 3.78k| if (ret) ------------------ | Branch (454:8): [True: 0, False: 3.78k] ------------------ 455| 0| return ret; 456| 3.78k| } 457| 3.78k|#pragma GCC diagnostic pop 458| 3.78k| } 459| 1.89k|} netns_ifaddrs.c:__ifaddrs_netlink_send: 346| 1.89k|{ 347| 1.89k| int ret; 348| 1.89k| struct sockaddr_nl nladdr; 349| 1.89k| struct iovec iov = { 350| 1.89k| .iov_base = nlmsghdr, 351| 1.89k| .iov_len = nlmsghdr->nlmsg_len, 352| 1.89k| }; 353| 1.89k| struct msghdr msg = { 354| 1.89k| .msg_name = &nladdr, 355| 1.89k| .msg_namelen = sizeof(nladdr), 356| 1.89k| .msg_iov = &iov, 357| 1.89k| .msg_iovlen = 1, 358| 1.89k| }; 359| | 360| 1.89k| memset(&nladdr, 0, sizeof(nladdr)); 361| 1.89k| nladdr.nl_family = AF_NETLINK; 362| 1.89k| nladdr.nl_pid = 0; 363| 1.89k| nladdr.nl_groups = 0; 364| | 365| 1.89k| ret = sendmsg(fd, &msg, MSG_NOSIGNAL); 366| 1.89k| if (ret < 0) ------------------ | Branch (366:6): [True: 0, False: 1.89k] ------------------ 367| 0| return -1; 368| | 369| 1.89k| return ret; 370| 1.89k|} netns_ifaddrs.c:nl_msg_to_ifaddr: 169| 3.78k|{ 170| 3.78k| struct ifaddrs_storage *ifs, *ifs0; 171| 3.78k| struct rtattr *rta; 172| 3.78k| int stats_len = 0; 173| 3.78k| struct ifinfomsg *ifi = __NLMSG_DATA(h); ------------------ | | 41| 3.78k|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 174| 3.78k| struct ifaddrmsg *ifa = __NLMSG_DATA(h); ------------------ | | 41| 3.78k|#define __NLMSG_DATA(nlh) ((void *)((char *)(nlh) + sizeof(struct nlmsghdr))) ------------------ 175| 3.78k| struct ifaddrs_ctx *ctx = pctx; 176| | 177| 3.78k| if (h->nlmsg_type == RTM_NEWLINK) { ------------------ | Branch (177:6): [True: 1.89k, False: 1.89k] ------------------ 178| 1.89k|#pragma GCC diagnostic push 179| 1.89k|#pragma GCC diagnostic ignored "-Wcast-align" 180| 1.89k| for (rta = __NLMSG_RTA(h, sizeof(*ifi)); __NLMSG_RTAOK(rta, h); ------------------ | | 46| 1.89k| ((void *)((char *)(nlh) + sizeof(struct nlmsghdr) + \ | | 47| 1.89k| __NETLINK_ALIGN(len))) | | ------------------ | | | | 33| 1.89k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 181| 43.5k| rta = __RTA_NEXT(rta)) { ------------------ | | 52| 41.6k| (struct rtattr *)((char *)(rta) + __NETLINK_ALIGN((rta)->rta_len)) | | ------------------ | | | | 33| 41.6k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 182| 43.5k|#if HAVE_STRUCT_RTNL_LINK_STATS64 183| 43.5k| if (rta->rta_type != IFLA_STATS64) ------------------ | | 532| 43.5k|#define IFLA_STATS64 23 ------------------ | Branch (183:8): [True: 41.6k, False: 1.89k] ------------------ 184| |#else 185| | if (rta->rta_type != IFLA_STATS) 186| |#endif 187| 41.6k| continue; 188| | 189| 1.89k| stats_len = __RTA_DATALEN(rta); ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 190| 1.89k| break; 191| 43.5k| } 192| 1.89k|#pragma GCC diagnostic pop 193| 1.89k| } else { 194| 1.89k| for (ifs0 = ctx->hash[ifa->ifa_index % IFADDRS_HASH_SIZE]; ifs0; ------------------ | | 31| 1.89k|#define IFADDRS_HASH_SIZE 64 ------------------ | Branch (194:62): [True: 1.89k, False: 0] ------------------ 195| 1.89k| ifs0 = ifs0->hash_next) 196| 1.89k| if (ifs0->index == ifa->ifa_index) ------------------ | Branch (196:8): [True: 1.89k, False: 0] ------------------ 197| 1.89k| break; 198| 1.89k| if (!ifs0) ------------------ | Branch (198:7): [True: 0, False: 1.89k] ------------------ 199| 0| return 0; 200| 1.89k| } 201| | 202| 3.78k| ifs = calloc(1, sizeof(struct ifaddrs_storage) + stats_len); 203| 3.78k| if (!ifs) { ------------------ | Branch (203:6): [True: 0, False: 3.78k] ------------------ 204| 0| errno = ENOMEM; 205| 0| return -1; 206| 0| } 207| | 208| 3.78k|#pragma GCC diagnostic push 209| 3.78k|#pragma GCC diagnostic ignored "-Wcast-align" 210| 3.78k| if (h->nlmsg_type == RTM_NEWLINK) { ------------------ | Branch (210:6): [True: 1.89k, False: 1.89k] ------------------ 211| 1.89k| ifs->index = ifi->ifi_index; 212| 1.89k| ifs->ifa.ifa_ifindex = ifi->ifi_index; 213| 1.89k| ifs->ifa.ifa_flags = ifi->ifi_flags; 214| | 215| 1.89k| for (rta = __NLMSG_RTA(h, sizeof(*ifi)); __NLMSG_RTAOK(rta, h); ------------------ | | 46| 1.89k| ((void *)((char *)(nlh) + sizeof(struct nlmsghdr) + \ | | 47| 1.89k| __NETLINK_ALIGN(len))) | | ------------------ | | | | 33| 1.89k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 216| 52.0k| rta = __RTA_NEXT(rta)) { ------------------ | | 52| 52.0k| (struct rtattr *)((char *)(rta) + __NETLINK_ALIGN((rta)->rta_len)) | | ------------------ | | | | 33| 52.0k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 217| 52.0k| switch (rta->rta_type) { ------------------ | Branch (217:12): [True: 9.46k, False: 42.5k] ------------------ 218| 1.89k| case IFLA_IFNAME: ------------------ | Branch (218:4): [True: 1.89k, False: 50.1k] ------------------ 219| 1.89k| if (__RTA_DATALEN(rta) < sizeof(ifs->name)) { ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ | Branch (219:9): [True: 1.89k, False: 0] ------------------ 220| 1.89k| memcpy(ifs->name, __RTA_DATA(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 221| 1.89k| __RTA_DATALEN(rta)); ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 222| 1.89k| ifs->ifa.ifa_name = ifs->name; 223| 1.89k| } 224| 1.89k| break; 225| 1.89k| case IFLA_ADDRESS: ------------------ | Branch (225:4): [True: 1.89k, False: 50.1k] ------------------ 226| 1.89k| copy_lladdr(&ifs->ifa.ifa_addr, &ifs->addr, 227| 1.89k| __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 228| 1.89k| ifi->ifi_index, ifi->ifi_type); 229| 1.89k| break; 230| 1.89k| case IFLA_BROADCAST: ------------------ | Branch (230:4): [True: 1.89k, False: 50.1k] ------------------ 231| 1.89k| copy_lladdr(&ifs->ifa.__ifa_broadaddr, &ifs->ifu, ------------------ | | 53| 1.89k|#define __ifa_broadaddr ifa_ifu.ifu_broadaddr ------------------ 232| 1.89k| __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 233| 1.89k| ifi->ifi_index, ifi->ifi_type); 234| 1.89k| break; 235| 0|#if HAVE_STRUCT_RTNL_LINK_STATS64 236| 1.89k| case IFLA_STATS64: ------------------ | | 532| 1.89k|#define IFLA_STATS64 23 ------------------ | Branch (236:4): [True: 1.89k, False: 50.1k] ------------------ 237| 1.89k| ifs->ifa.ifa_stats_type = IFLA_STATS64; ------------------ | | 532| 1.89k|#define IFLA_STATS64 23 ------------------ 238| |#else 239| | case IFLA_STATS: 240| | ifs->ifa.ifa_stats_type = IFLA_STATS; 241| |#endif 242| 1.89k| memcpy(&ifs->ifa.ifa_stats, __RTA_DATA(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 243| 1.89k| __RTA_DATALEN(rta)); ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 244| 1.89k| break; 245| 1.89k| case IFLA_MTU: ------------------ | Branch (245:4): [True: 1.89k, False: 50.1k] ------------------ 246| 1.89k| memcpy(&ifs->ifa.ifa_mtu, __RTA_DATA(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 247| 1.89k| sizeof(int)); 248| 1.89k| break; 249| 0| case IFLA_TARGET_NETNSID: ------------------ | | 520| 0|#define IFLA_TARGET_NETNSID 46 ------------------ | Branch (249:4): [True: 0, False: 52.0k] ------------------ 250| 0| *netnsid_aware = true; 251| 0| break; 252| 52.0k| } 253| 52.0k| } 254| | 255| 1.89k| if (ifs->ifa.ifa_name) { ------------------ | Branch (255:7): [True: 1.89k, False: 0] ------------------ 256| 1.89k| unsigned int bucket = ifs->index % IFADDRS_HASH_SIZE; ------------------ | | 31| 1.89k|#define IFADDRS_HASH_SIZE 64 ------------------ 257| 1.89k| ifs->hash_next = ctx->hash[bucket]; 258| 1.89k| ctx->hash[bucket] = ifs; 259| 1.89k| } 260| 1.89k| } else { 261| 1.89k| ifs->ifa.ifa_name = ifs0->ifa.ifa_name; 262| 1.89k| ifs->ifa.ifa_mtu = ifs0->ifa.ifa_mtu; 263| 1.89k| ifs->ifa.ifa_ifindex = ifs0->ifa.ifa_ifindex; 264| 1.89k| ifs->ifa.ifa_flags = ifs0->ifa.ifa_flags; 265| | 266| 1.89k| for (rta = __NLMSG_RTA(h, sizeof(*ifa)); __NLMSG_RTAOK(rta, h); ------------------ | | 46| 1.89k| ((void *)((char *)(nlh) + sizeof(struct nlmsghdr) + \ | | 47| 1.89k| __NETLINK_ALIGN(len))) | | ------------------ | | | | 33| 1.89k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 267| 10.4k| rta = __RTA_NEXT(rta)) { ------------------ | | 52| 10.4k| (struct rtattr *)((char *)(rta) + __NETLINK_ALIGN((rta)->rta_len)) | | ------------------ | | | | 33| 10.4k|#define __NETLINK_ALIGN(len) (((len) + 3) & ~3) | | ------------------ ------------------ 268| 10.4k| switch (rta->rta_type) { ------------------ | Branch (268:12): [True: 6.62k, False: 3.78k] ------------------ 269| 1.89k| case IFA_ADDRESS: ------------------ | Branch (269:4): [True: 1.89k, False: 8.51k] ------------------ 270| | /* If ifa_addr is already set we, received an 271| | * IFA_LOCAL before so treat this as 272| | * destination address. 273| | */ 274| 1.89k| if (ifs->ifa.ifa_addr) ------------------ | Branch (274:9): [True: 0, False: 1.89k] ------------------ 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.89k| else 281| 1.89k| copy_addr(&ifs->ifa.ifa_addr, 282| 1.89k| ifa->ifa_family, &ifs->addr, 283| 1.89k| __RTA_DATA(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 284| 1.89k| __RTA_DATALEN(rta), ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 285| 1.89k| ifa->ifa_index); 286| 1.89k| break; 287| 946| case IFA_BROADCAST: ------------------ | Branch (287:4): [True: 946, False: 9.46k] ------------------ 288| 946| copy_addr(&ifs->ifa.__ifa_broadaddr, ------------------ | | 53| 946|#define __ifa_broadaddr ifa_ifu.ifu_broadaddr ------------------ 289| 946| ifa->ifa_family, &ifs->ifu, 290| 946| __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 65| 946|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ __RTA_DATA(rta), __RTA_DATALEN(rta), ------------------ | | 49| 946|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 291| 946| ifa->ifa_index); 292| 946| break; 293| 1.89k| case IFA_LOCAL: ------------------ | Branch (293:4): [True: 1.89k, False: 8.51k] ------------------ 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.89k| if (ifs->ifa.ifa_addr) { ------------------ | Branch (298:9): [True: 1.89k, False: 0] ------------------ 299| 1.89k| ifs->ifu = ifs->addr; 300| 1.89k| ifs->ifa.__ifa_dstaddr = &ifs->ifu.sa; ------------------ | | 54| 1.89k|#define __ifa_dstaddr ifa_ifu.ifu_dstaddr ------------------ 301| | 302| 1.89k| memset(&ifs->addr, 0, sizeof(ifs->addr)); 303| 1.89k| } 304| | 305| 1.89k| copy_addr(&ifs->ifa.ifa_addr, ifa->ifa_family, 306| 1.89k| &ifs->addr, __RTA_DATA(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 307| 1.89k| __RTA_DATALEN(rta), ifa->ifa_index); ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 308| 1.89k| break; 309| 1.89k| case IFA_LABEL: ------------------ | Branch (309:4): [True: 1.89k, False: 8.51k] ------------------ 310| 1.89k| if (__RTA_DATALEN(rta) < sizeof(ifs->name)) { ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ | Branch (310:9): [True: 1.89k, False: 0] ------------------ 311| 1.89k| memcpy(ifs->name, __RTA_DATA(rta), ------------------ | | 65| 1.89k|#define __RTA_DATA(rta) ((void *)((char *)(rta) + sizeof(struct rtattr))) ------------------ 312| 1.89k| __RTA_DATALEN(rta)); ------------------ | | 49| 1.89k|#define __RTA_DATALEN(rta) ((rta)->rta_len - sizeof(struct rtattr)) ------------------ 313| 1.89k| ifs->ifa.ifa_name = ifs->name; 314| 1.89k| } 315| 1.89k| break; 316| 0| case IFA_TARGET_NETNSID: ------------------ | | 524| 0|#define IFA_TARGET_NETNSID 10 ------------------ | Branch (316:4): [True: 0, False: 10.4k] ------------------ 317| 0| *netnsid_aware = true; 318| 0| break; 319| 10.4k| } 320| 10.4k| } 321| | 322| 1.89k| if (ifs->ifa.ifa_addr) { ------------------ | Branch (322:7): [True: 1.89k, False: 0] ------------------ 323| 1.89k| gen_netmask(&ifs->ifa.ifa_netmask, ifa->ifa_family, 324| 1.89k| &ifs->netmask, ifa->ifa_prefixlen); 325| 1.89k| ifs->ifa.ifa_prefixlen = ifa->ifa_prefixlen; 326| 1.89k| } 327| 1.89k| } 328| 3.78k|#pragma GCC diagnostic pop 329| | 330| 3.78k| if (ifs->ifa.ifa_name) { ------------------ | Branch (330:6): [True: 3.78k, False: 0] ------------------ 331| 3.78k| if (!ctx->first) ------------------ | Branch (331:7): [True: 946, False: 2.83k] ------------------ 332| 946| ctx->first = ifs; 333| | 334| 3.78k| if (ctx->last) ------------------ | Branch (334:7): [True: 2.83k, False: 946] ------------------ 335| 2.83k| ctx->last->ifa.ifa_next = &ifs->ifa; 336| | 337| 3.78k| ctx->last = ifs; 338| 3.78k| } else { 339| 0| free(ifs); 340| 0| } 341| | 342| 3.78k| return 0; 343| 3.78k|} netns_ifaddrs.c:copy_lladdr: 154| 3.78k|{ 155| 3.78k| if (addrlen > sizeof(sa->ll.sll_addr)) ------------------ | Branch (155:6): [True: 0, False: 3.78k] ------------------ 156| 0| return; 157| | 158| 3.78k| sa->ll.sll_family = AF_PACKET; 159| 3.78k| sa->ll.sll_ifindex = ifindex; 160| 3.78k| sa->ll.sll_hatype = hatype; 161| 3.78k| sa->ll.sll_halen = addrlen; 162| | 163| 3.78k| memcpy(sa->ll.sll_addr, addr, addrlen); 164| | 165| 3.78k| *r = &sa->sa; 166| 3.78k|} netns_ifaddrs.c:copy_addr: 103| 6.62k|{ 104| 6.62k| uint8_t *dst; 105| 6.62k| size_t len; 106| | 107| 6.62k| switch (af) { 108| 6.62k| case AF_INET: ------------------ | Branch (108:2): [True: 6.62k, False: 0] ------------------ 109| 6.62k| dst = (uint8_t *)&sa->v4.sin_addr; 110| 6.62k| len = 4; 111| 6.62k| break; 112| 0| case AF_INET6: ------------------ | Branch (112:2): [True: 0, False: 6.62k] ------------------ 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: 6.62k] ------------------ 120| 0| return; 121| 6.62k| } 122| | 123| 6.62k| if (addrlen < len) ------------------ | Branch (123:6): [True: 0, False: 6.62k] ------------------ 124| 0| return; 125| | 126| 6.62k| sa->sa.sa_family = af; 127| | 128| 6.62k| memcpy(dst, addr, len); 129| | 130| 6.62k| *r = &sa->sa; 131| 6.62k|} netns_ifaddrs.c:gen_netmask: 135| 1.89k|{ 136| 1.89k| uint8_t addr[16] = {0}; 137| 1.89k| int i; 138| | 139| 1.89k| if ((size_t)prefixlen > 8 * sizeof(addr)) ------------------ | Branch (139:6): [True: 0, False: 1.89k] ------------------ 140| 0| prefixlen = 8 * sizeof(addr); 141| | 142| 1.89k| i = prefixlen / 8; 143| | 144| 1.89k| memset(addr, 0xff, i); 145| | 146| 1.89k| if ((size_t)i < sizeof(addr)) ------------------ | Branch (146:6): [True: 1.89k, False: 0] ------------------ 147| 1.89k| addr[i++] = 0xff << (8 - (prefixlen % 8)); 148| | 149| 1.89k| copy_addr(r, af, sa, addr, sizeof(addr), 0); 150| 1.89k|} confile.c:__must_check_overflow: 44| 3.41k|{ 45| 3.41k| return unlikely(overflow); ------------------ | | 40| 3.41k|#define unlikely(x) __builtin_expect(!!(x), 0) ------------------ 46| 3.41k|} string_utils.c:__must_check_overflow: 44| 1.21k|{ 45| 1.21k| return unlikely(overflow); ------------------ | | 40| 1.21k|#define unlikely(x) __builtin_expect(!!(x), 0) ------------------ 46| 1.21k|} parse_mount_attrs: 2003| 1.72k|{ 2004| 1.72k| __do_free char *mntopts_new = NULL, *mntopts_dup = NULL; ------------------ | | 69| 1.72k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.72k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2005| 1.72k| char *end = NULL, *mntopt_cur = NULL; 2006| 1.72k| int ret; 2007| 1.72k| size_t size; 2008| | 2009| 1.72k| if (!opts) ------------------ | Branch (2009:6): [True: 0, False: 1.72k] ------------------ 2010| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2011| | 2012| 1.72k| if (!mntopts) ------------------ | Branch (2012:6): [True: 0, False: 1.72k] ------------------ 2013| 0| return 0; 2014| | 2015| 1.72k| mntopts_dup = strdup(mntopts); 2016| 1.72k| if (!mntopts_dup) ------------------ | Branch (2016:6): [True: 0, False: 1.72k] ------------------ 2017| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2018| | 2019| 1.72k| size = strlen(mntopts_dup) + 1; 2020| 1.72k| mntopts_new = zalloc(size); ------------------ | | 90| 1.72k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2021| 1.72k| if (!mntopts_new) ------------------ | Branch (2021:6): [True: 0, False: 1.72k] ------------------ 2022| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2023| | 2024| 3.55k| lxc_iterate_parts(mntopt_cur, mntopts_dup, ",") { ------------------ | | 187| 1.72k| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 5.28k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 3.55k, False: 1.72k] | | ------------------ | | 189| 3.55k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2025| | /* This is a generic vfs option. */ 2026| 3.55k| ret = parse_vfs_attr(opts, mntopt_cur, size); 2027| 3.55k| if (ret < 0) ------------------ | Branch (2027:7): [True: 0, False: 3.55k] ------------------ 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| 3.55k| if (ret == 0) ------------------ | Branch (2031:7): [True: 2.22k, False: 1.32k] ------------------ 2032| 2.22k| continue; 2033| | 2034| | /* This is a filesystem specific option. */ 2035| 1.32k| if (!end) { ------------------ | Branch (2035:7): [True: 717, False: 612] ------------------ 2036| 717| end = stpcpy(mntopts_new, mntopt_cur); 2037| 717| } else { 2038| 612| end = stpcpy(end, ","); 2039| 612| end = stpcpy(end, mntopt_cur); 2040| 612| } 2041| 1.32k| } 2042| | 2043| 1.72k| if (*mntopts_new) ------------------ | Branch (2043:6): [True: 717, False: 1.01k] ------------------ 2044| 717| opts->data = move_ptr(mntopts_new); ------------------ | | 694| 717| ({ \ | | 695| 717| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 717| (ptr) = NULL; \ | | 697| 717| __internal_ptr__; \ | | 698| 717| }) ------------------ 2045| | 2046| 1.72k| return 0; 2047| 1.72k|} parse_lxc_mount_attrs: 2186| 1.84k|{ 2187| 10.9k| for (size_t i = LXC_MOUNT_CREATE_DIR; i < LXC_MOUNT_MAX; i++) { ------------------ | Branch (2187:40): [True: 9.22k, False: 1.73k] ------------------ 2188| 9.22k| __do_close int fd_userns = -EBADF; ------------------ | | 49| 9.22k|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 9.22k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2189| 9.22k| const char *opt_name = lxc_mount_options_info[i]; 2190| 9.22k| size_t len; 2191| 9.22k| char *idmap_path, *opt, *opt_next; 2192| | 2193| 9.22k| opt = strstr(mnt_opts, opt_name); 2194| 9.22k| if (!opt) ------------------ | Branch (2194:7): [True: 8.51k, False: 712] ------------------ 2195| 8.51k| continue; 2196| | 2197| 712| switch (i) { 2198| 4| case LXC_MOUNT_CREATE_DIR: ------------------ | Branch (2198:3): [True: 4, False: 708] ------------------ 2199| 4| opts->create_dir = 1; 2200| 4| break; 2201| 1| case LXC_MOUNT_CREATE_FILE: ------------------ | Branch (2201:3): [True: 1, False: 711] ------------------ 2202| 1| opts->create_file = 1; 2203| 1| break; 2204| 5| case LXC_MOUNT_OPTIONAL: ------------------ | Branch (2204:3): [True: 5, False: 707] ------------------ 2205| 5| opts->optional = 1; 2206| 5| break; 2207| 8| case LXC_MOUNT_RELATIVE: ------------------ | Branch (2207:3): [True: 8, False: 704] ------------------ 2208| 8| opts->relative = 1; 2209| 8| break; 2210| 694| case LXC_MOUNT_IDMAP: ------------------ | Branch (2210:3): [True: 694, False: 18] ------------------ 2211| 694| opt_next = opt; 2212| 694| opt_next += STRLITERALLEN("idmap="); ------------------ | | 687| 694|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2213| 694| idmap_path = strchrnul(opt_next, ','); 2214| 694| len = idmap_path - opt_next + 1; 2215| | 2216| 694| if (len >= sizeof(opts->userns_path)) ------------------ | Branch (2216:8): [True: 5, False: 689] ------------------ 2217| 5| return syserror_set(-EIO, "Excessive idmap path length for \"idmap=\" LXC specific mount option"); ------------------ | | 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| }) ------------------ 2218| | 2219| 689| strlcpy(opts->userns_path, opt_next, len); 2220| | 2221| 689| if (is_empty_string(opts->userns_path)) ------------------ | Branch (2221:8): [True: 2, False: 687] ------------------ 2222| 2| return syserror_set(-EINVAL, "Missing idmap path for \"idmap=\" LXC specific mount option"); ------------------ | | 568| 2| ({ \ | | 569| 2| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 2| errno = labs(__ret__); \ | | 571| 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] | | | | ------------------ | | ------------------ | | 572| 2| __internal_ret__; \ | | 573| 2| }) ------------------ 2223| | 2224| 687| if (!strequal(opts->userns_path, "container")) { ------------------ | Branch (2224:8): [True: 493, False: 194] ------------------ 2225| 493| fd_userns = open(opts->userns_path, O_RDONLY | O_NOCTTY | O_CLOEXEC); 2226| 493| if (fd_userns < 0) ------------------ | Branch (2226:9): [True: 101, False: 392] ------------------ 2227| 101| return syserror("Failed to open user namespace %s", opts->userns_path); ------------------ | | 562| 101| ({ \ | | 563| 101| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 101| do { \ | | | | 454| 101| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 101| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 101| char *ptr = NULL; \ | | | | | | 317| 101| { \ | | | | | | 318| 101| int __saved_errno = errno; \ | | | | | | 319| 101| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 101| errno = __saved_errno; \ | | | | | | 321| 101| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 101] | | | | | | ------------------ | | | | | | 322| 101| ptr = errno_buf; \ | | | | | | 323| 101| } | | | | ------------------ | | | | 455| 101| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 101|#define ERROR(format, ...) do { \ | | | | | | 373| 101| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 101| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 101| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 101|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 101] | | | | | | ------------------ | | | | ------------------ | | | | 456| 101| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 101] | | | | ------------------ | | ------------------ | | 564| 101| (-labs(errno)); \ | | 565| 101| }) ------------------ 2228| 493| } 2229| | 2230| 586| TRACE("Parse LXC specific mount option %d->\"idmap=%s\"", fd_userns, opts->userns_path); ------------------ | | 347| 586|#define TRACE(format, ...) do { \ | | 348| 586| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 586| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 586| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 586|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 586] | | ------------------ ------------------ 2231| 586| break; 2232| 0| default: ------------------ | Branch (2232:3): [True: 0, False: 712] ------------------ 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| 712| } 2235| | 2236| 604| opt_next = strchr(opt, ','); 2237| 604| if (!opt_next) ------------------ | Branch (2237:7): [True: 409, False: 195] ------------------ 2238| 409| *opt = '\0'; /* no more mntopts, so just chop it here */ 2239| 195| else 2240| 195| memmove(opt, opt_next + 1, strlen(opt_next + 1) + 1); 2241| 604| } 2242| | 2243| 1.73k| return 0; 2244| 1.84k|} parse_cap: 2828| 70|{ 2829| 70| size_t end = sizeof(caps_opt) / sizeof(caps_opt[0]); 2830| 70| int ret; 2831| 70| unsigned int res; 2832| 70| __u32 last_cap; 2833| | 2834| 70| if (strequal(cap_name, "none")) ------------------ | Branch (2834:6): [True: 0, False: 70] ------------------ 2835| 0| return -2; 2836| | 2837| 70|#if HAVE_LIBCAP == 0 2838| 70| WARN("capabilities are disabled or libcap not found"); ------------------ | | 367| 70|#define WARN(format, ...) do { \ | | 368| 70| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 70| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 369| 70| LXC_WARN(&locinfo, format, ##__VA_ARGS__); \ | | 370| 70|} while (0) | | ------------------ | | | Branch (370:10): [Folded, False: 70] | | ------------------ ------------------ 2839| 70|#endif 2840| | 2841| 70| for (size_t i = 0; i < end; i++) { ------------------ | Branch (2841:21): [True: 0, False: 70] ------------------ 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| 70| ret = lxc_safe_uint(cap_name, &res); 2855| 70| if (ret < 0) ------------------ | Branch (2855:6): [True: 70, False: 0] ------------------ 2856| 70| 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| 12.0k|{ 3066| 12.0k| int i; 3067| 12.0k| struct lxc_conf *new; 3068| | 3069| 12.0k| new = zalloc(sizeof(*new)); ------------------ | | 90| 12.0k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 3070| 12.0k| if (!new) ------------------ | Branch (3070:6): [True: 0, False: 12.0k] ------------------ 3071| 0| return NULL; 3072| | 3073| 12.0k| new->loglevel = LXC_LOG_LEVEL_NOTSET; 3074| 12.0k| new->personality = LXC_ARCH_UNCHANGED; ------------------ | | 86| 12.0k|#define LXC_ARCH_UNCHANGED 0xffffffffL ------------------ 3075| 12.0k| new->autodev = 1; 3076| 12.0k| new->console.buffer_size = 0; 3077| 12.0k| new->console.log_path = NULL; 3078| 12.0k| new->console.log_fd = -1; 3079| 12.0k| new->console.log_size = 0; 3080| 12.0k| new->console.path = NULL; 3081| 12.0k| new->console.peer = -1; 3082| 12.0k| new->console.proxy.busy = -1; 3083| 12.0k| new->console.proxy.ptx = -1; 3084| 12.0k| new->console.proxy.pty = -1; 3085| 12.0k| new->console.ptx = -EBADF; 3086| 12.0k| new->console.pty = -EBADF; 3087| 12.0k| new->console.pty_nr = -1; 3088| 12.0k| new->console.name[0] = '\0'; 3089| 12.0k| new->devpts_fd = -EBADF; 3090| 12.0k| memset(&new->console.ringbuf, 0, sizeof(struct lxc_ringbuf)); 3091| 12.0k| new->maincmd_fd = -1; 3092| 12.0k| new->monitor_signal_pdeath = SIGKILL; 3093| 12.0k| new->nbd_idx = -1; 3094| 12.0k| new->rootfs.mount = strdup(default_rootfs_mount); 3095| 12.0k| if (!new->rootfs.mount) { ------------------ | Branch (3095:6): [True: 0, False: 12.0k] ------------------ 3096| 0| free(new); 3097| 0| return NULL; 3098| 0| } 3099| 12.0k| new->rootfs.managed = true; 3100| 12.0k| new->rootfs.dfd_mnt = -EBADF; 3101| 12.0k| new->rootfs.dfd_dev = -EBADF; 3102| 12.0k| new->rootfs.dfd_host = -EBADF; 3103| 12.0k| new->rootfs.fd_path_pin = -EBADF; 3104| 12.0k| new->rootfs.dfd_idmapped = -EBADF; 3105| 12.0k| new->logfd = -1; 3106| 12.0k| INIT_LIST_HEAD(&new->cgroup2); 3107| | /* Block ("allowlist") all devices by default. */ 3108| 12.0k| new->bpf_devices.list_type = LXC_BPF_DEVICE_CGROUP_ALLOWLIST; 3109| 12.0k| INIT_LIST_HEAD(&(new->bpf_devices).devices); 3110| 12.0k| INIT_LIST_HEAD(&new->mount_entries); 3111| 12.0k| INIT_LIST_HEAD(&new->caps.list); 3112| 12.0k| INIT_LIST_HEAD(&new->id_map); 3113| 12.0k| new->root_nsuid_map = NULL; 3114| 12.0k| new->root_nsgid_map = NULL; 3115| 12.0k| INIT_LIST_HEAD(&new->environment); 3116| 12.0k| INIT_LIST_HEAD(&new->environment_runtime); 3117| 12.0k| INIT_LIST_HEAD(&new->environment_hooks); 3118| 12.0k| INIT_LIST_HEAD(&new->limits); 3119| 12.0k| INIT_LIST_HEAD(&new->sysctls); 3120| 12.0k| INIT_LIST_HEAD(&new->procs); 3121| 12.0k| new->hooks_version = 0; 3122| 132k| for (i = 0; i < NUM_LXC_HOOKS; i++) ------------------ | Branch (3122:14): [True: 120k, False: 12.0k] ------------------ 3123| 120k| INIT_LIST_HEAD(&new->hooks[i]); 3124| 12.0k| INIT_LIST_HEAD(&new->groups); 3125| 12.0k| INIT_LIST_HEAD(&new->state_clients); 3126| 12.0k| new->lsm_aa_profile = NULL; 3127| 12.0k| INIT_LIST_HEAD(&new->lsm_aa_raw); 3128| 12.0k| new->lsm_se_context = NULL; 3129| 12.0k| new->lsm_se_keyring_context = NULL; 3130| 12.0k| new->keyring_disable_session = false; 3131| 12.0k| new->transient_procfs_mnt = false; 3132| 12.0k| new->shmount.path_host = NULL; 3133| 12.0k| new->shmount.path_cont = NULL; 3134| 12.0k| new->sched_core = false; 3135| 12.0k| new->sched_core_cookie = INVALID_SCHED_CORE_COOKIE; ------------------ | | 207| 12.0k|#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| 12.0k| new->init_uid = 0; 3140| 12.0k| new->init_gid = 0; 3141| 12.0k| memset(&new->init_groups, 0, sizeof(lxc_groups_t)); 3142| 12.0k| memset(&new->cgroup_meta, 0, sizeof(struct lxc_cgroup)); 3143| 12.0k| memset(&new->ns_share, 0, sizeof(char *) * LXC_NS_MAX); 3144| 12.0k| memset(&new->timens, 0, sizeof(struct timens_offsets)); 3145| 12.0k| seccomp_conf_init(new); 3146| | 3147| 12.0k| INIT_LIST_HEAD(&new->netdevs); 3148| | 3149| 12.0k| return new; 3150| 12.0k|} 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.8k|{ 3988| 12.8k| c->root_nsuid_map = NULL; 3989| | c->root_nsgid_map = NULL; 3990| 12.8k| return lxc_free_idmap(&c->id_map); 3991| 12.8k|} lxc_clear_namespace: 3994| 12.0k|{ 3995| 108k| for (int i = 0; i < LXC_NS_MAX; i++) ------------------ | Branch (3995:18): [True: 96.7k, False: 12.0k] ------------------ 3996| 96.7k| free_disarm(c->ns_share[i]); ------------------ | | 58| 96.7k| ({ \ | | 59| 96.7k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 71, False: 96.6k] | | ------------------ | | 60| 71| free(ptr); \ | | 61| 71| ptr = NULL; \ | | 62| 71| } \ | | 63| 96.7k| }) ------------------ 3997| | 3998| 12.0k| return 0; 3999| 12.0k|} lxc_clear_cgroups: 4002| 12.7k|{ 4003| 12.7k| const char *k = key; 4004| 12.7k| bool all = false; 4005| 12.7k| char *global_token, *namespaced_token; 4006| 12.7k| size_t namespaced_token_len; 4007| 12.7k| struct list_head *list; 4008| 12.7k| struct lxc_cgroup *cgroup, *ncgroup; 4009| | 4010| 12.7k| if (version == CGROUP2_SUPER_MAGIC) { ------------------ | Branch (4010:6): [True: 12.7k, False: 0] ------------------ 4011| 12.7k| global_token = "lxc.cgroup2"; 4012| 12.7k| namespaced_token = "lxc.cgroup2."; 4013| 12.7k| namespaced_token_len = STRLITERALLEN("lxc.cgroup2."); ------------------ | | 687| 12.7k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4014| 12.7k| list = &c->cgroup2; 4015| 12.7k| } else { 4016| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 4017| 0| } 4018| | 4019| 12.7k| if (strequal(key, global_token)) ------------------ | Branch (4019:6): [True: 12.3k, False: 455] ------------------ 4020| 12.3k| all = true; 4021| 455| else if (strnequal(key, namespaced_token, namespaced_token_len)) ------------------ | Branch (4021:11): [True: 446, False: 9] ------------------ 4022| 446| 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.7k| list_for_each_entry_safe(cgroup, ncgroup, list, 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.9k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.9k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.19k, False: 12.7k] | | ------------------ | | 658| 12.7k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.19k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.19k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.19k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.19k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.19k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.19k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.19k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.19k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.19k| do { \ | | | | | | | | | | | | | | | | 286| 1.19k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.19k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.19k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.19k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.19k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4027| 1.19k| if (!all && !strequal(cgroup->subsystem, k)) ------------------ | Branch (4027:7): [True: 793, False: 404] | Branch (4027:15): [True: 599, False: 194] ------------------ 4028| 599| continue; 4029| | 4030| 598| list_del(&cgroup->head); 4031| 598| free(cgroup->subsystem); 4032| 598| free(cgroup->value); 4033| 598| free(cgroup); 4034| 598| } 4035| | 4036| 12.7k| if (all) ------------------ | Branch (4036:6): [True: 12.3k, False: 446] ------------------ 4037| 12.3k| INIT_LIST_HEAD(list); 4038| | 4039| 12.7k| return 0; 4040| 12.7k|} lxc_clear_limits: 4048| 13.1k|{ 4049| 13.1k| const char *k = NULL; 4050| 13.1k| bool all = false; 4051| 13.1k| struct lxc_limit *lim, *nlim; 4052| | 4053| 13.1k| if (strequal(key, "lxc.limit") || strequal(key, "lxc.prlimit")) ------------------ | Branch (4053:6): [True: 0, False: 13.1k] | Branch (4053:36): [True: 12.3k, False: 789] ------------------ 4054| 12.3k| all = true; 4055| 789| else if (strnequal(key, "lxc.limit.", STRLITERALLEN("lxc.limit."))) ------------------ | | 687| 789|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4055:11): [True: 0, False: 789] ------------------ 4056| 0| k = key + STRLITERALLEN("lxc.limit."); ------------------ | | 687| 0|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4057| 789| else if (strnequal(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit."))) ------------------ | | 687| 789|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4057:11): [True: 779, False: 10] ------------------ 4058| 779| k = key + STRLITERALLEN("lxc.prlimit."); ------------------ | | 687| 779|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4059| 10| else 4060| 10| return ret_errno(EINVAL); ------------------ | | 715| 10| ({ \ | | 716| 10| errno = labs(__errno__); \ | | 717| 10| -errno; \ | | 718| 10| }) ------------------ 4061| | 4062| 13.1k| list_for_each_entry_safe(lim, nlim, &c->limits, head) { ------------------ | | 655| 13.1k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 13.1k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 13.1k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.1k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.1k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.1k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.1k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.1k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.1k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.1k| do { \ | | | | | | | | | | | | | | | | 286| 13.1k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.1k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.1k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.1k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.1k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 13.1k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 13.1k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 13.1k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.1k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.1k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.1k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.1k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.1k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.1k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.1k| do { \ | | | | | | | | | | | | | | | | 286| 13.1k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.1k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.1k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.1k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.1k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 14.7k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 14.7k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.60k, False: 13.1k] | | ------------------ | | 658| 13.1k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.60k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.60k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.60k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.60k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.60k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.60k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.60k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.60k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.60k| do { \ | | | | | | | | | | | | | | | | 286| 1.60k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.60k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.60k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.60k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.60k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4063| 1.60k| if (!all && !strequal(lim->resource, k)) ------------------ | Branch (4063:7): [True: 908, False: 697] | Branch (4063:15): [True: 711, False: 197] ------------------ 4064| 711| continue; 4065| | 4066| 894| list_del(&lim->head); 4067| 894| free_disarm(lim->resource); ------------------ | | 58| 894| ({ \ | | 59| 894| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 894, False: 0] | | ------------------ | | 60| 894| free(ptr); \ | | 61| 894| ptr = NULL; \ | | 62| 894| } \ | | 63| 894| }) ------------------ 4068| 894| free(lim); 4069| 894| } 4070| | 4071| 13.1k| if (all) ------------------ | Branch (4071:6): [True: 12.3k, False: 779] ------------------ 4072| 12.3k| INIT_LIST_HEAD(&c->limits); 4073| | 4074| 13.1k| return 0; 4075| 13.1k|} lxc_clear_sysctls: 4078| 13.2k|{ 4079| 13.2k| const char *k = NULL; 4080| 13.2k| bool all = false; 4081| 13.2k| struct lxc_sysctl *sysctl, *nsysctl; 4082| | 4083| 13.2k| if (strequal(key, "lxc.sysctl")) ------------------ | Branch (4083:6): [True: 12.4k, False: 771] ------------------ 4084| 12.4k| all = true; 4085| 771| else if (strnequal(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl."))) ------------------ | | 687| 771|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4085:11): [True: 763, False: 8] ------------------ 4086| 763| k = key + STRLITERALLEN("lxc.sysctl."); ------------------ | | 687| 763|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4087| 8| else 4088| 8| return -1; 4089| | 4090| 13.2k| list_for_each_entry_safe(sysctl, nsysctl, &c->sysctls, head) { ------------------ | | 655| 13.2k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 13.2k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 13.2k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.2k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.2k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.2k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.2k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.2k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.2k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.2k| do { \ | | | | | | | | | | | | | | | | 286| 13.2k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.2k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.2k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.2k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.2k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 13.2k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 13.2k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 13.2k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.2k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.2k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.2k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 13.2k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 13.2k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 13.2k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 13.2k| do { \ | | | | | | | | | | | | | | | | 286| 13.2k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 13.2k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.2k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.2k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.2k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 14.7k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 14.7k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.46k, False: 13.2k] | | ------------------ | | 658| 13.2k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.46k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.46k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.46k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.46k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.46k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.46k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.46k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.46k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.46k| do { \ | | | | | | | | | | | | | | | | 286| 1.46k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.46k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.46k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.46k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.46k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4091| 1.46k| if (!all && !strequal(sysctl->key, k)) ------------------ | Branch (4091:7): [True: 746, False: 714] | Branch (4091:15): [True: 552, False: 194] ------------------ 4092| 552| continue; 4093| | 4094| 908| list_del(&sysctl->head); 4095| 908| free(sysctl->key); 4096| 908| free(sysctl->value); 4097| 908| free(sysctl); 4098| 908| } 4099| | 4100| 13.2k| if (all) ------------------ | Branch (4100:6): [True: 12.4k, False: 763] ------------------ 4101| 12.4k| INIT_LIST_HEAD(&c->sysctls); 4102| | 4103| 13.2k| return 0; 4104| 13.2k|} lxc_clear_procs: 4107| 13.0k|{ 4108| 13.0k| const char *k = NULL; 4109| 13.0k| bool all = false; 4110| 13.0k| struct lxc_proc *proc, *nproc; 4111| | 4112| 13.0k| if (strequal(key, "lxc.proc")) ------------------ | Branch (4112:6): [True: 12.4k, False: 555] ------------------ 4113| 12.4k| all = true; 4114| 555| else if (strnequal(key, "lxc.proc.", STRLITERALLEN("lxc.proc."))) ------------------ | | 687| 555|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4114:11): [True: 548, False: 7] ------------------ 4115| 548| k = key + STRLITERALLEN("lxc.proc."); ------------------ | | 687| 548|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4116| 7| else 4117| 7| return -1; 4118| | 4119| 13.0k| list_for_each_entry_safe(proc, nproc, &c->procs, 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| 15.0k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 15.0k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 2.04k, False: 13.0k] | | ------------------ | | 658| 13.0k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 2.04k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 2.04k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.04k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.04k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.04k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.04k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.04k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.04k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.04k| do { \ | | | | | | | | | | | | | | | | 286| 2.04k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.04k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.04k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.04k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.04k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4120| 2.04k| if (!all && !strequal(proc->filename, k)) ------------------ | Branch (4120:7): [True: 1.63k, False: 410] | Branch (4120:15): [True: 1.44k, False: 194] ------------------ 4121| 1.44k| continue; 4122| | 4123| 604| list_del(&proc->head); 4124| 604| free(proc->filename); 4125| 604| free(proc->value); 4126| 604| free(proc); 4127| 604| } 4128| | 4129| 13.0k| if (all) ------------------ | Branch (4129:6): [True: 12.4k, False: 548] ------------------ 4130| 12.4k| INIT_LIST_HEAD(&c->procs); 4131| | 4132| 13.0k| return 0; 4133| 13.0k|} lxc_clear_groups: 4136| 12.4k|{ 4137| 12.4k| struct string_entry *entry, *nentry; 4138| | 4139| 12.4k| list_for_each_entry_safe(entry, nentry, &c->groups, head) { ------------------ | | 655| 12.4k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.4k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.4k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.4k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.4k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.4k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.4k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.4k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.4k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.4k| do { \ | | | | | | | | | | | | | | | | 286| 12.4k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.4k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.4k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.4k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.4k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.4k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.4k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.4k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.4k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.4k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.4k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.4k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.4k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.4k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.4k| do { \ | | | | | | | | | | | | | | | | 286| 12.4k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.4k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.4k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.4k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.4k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 13.5k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.5k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.09k, False: 12.4k] | | ------------------ | | 658| 12.4k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.09k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.09k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.09k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.09k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.09k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.09k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.09k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.09k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.09k| do { \ | | | | | | | | | | | | | | | | 286| 1.09k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.09k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.09k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.09k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.09k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4140| 1.09k| list_del(&entry->head); 4141| 1.09k| free(entry->val); 4142| 1.09k| free(entry); 4143| 1.09k| } 4144| | 4145| 12.4k| INIT_LIST_HEAD(&c->groups); 4146| 12.4k| return 0; 4147| 12.4k|} lxc_clear_environment: 4150| 12.8k|{ 4151| 12.8k| struct environment_entry *env, *nenv; 4152| | 4153| 12.8k| list_for_each_entry_safe(env, nenv, environment, 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| 13.8k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.8k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.01k, False: 12.8k] | | ------------------ | | 658| 12.8k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.01k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.01k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.01k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.01k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.01k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.01k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.01k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.01k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.01k| do { \ | | | | | | | | | | | | | | | | 286| 1.01k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.01k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.01k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.01k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.01k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4154| 1.01k| list_del(&env->head); 4155| 1.01k| free(env->key); 4156| 1.01k| free(env->val); 4157| 1.01k| free(env); 4158| 1.01k| } 4159| | 4160| 12.8k| INIT_LIST_HEAD(environment); 4161| 12.8k| return 0; 4162| 12.8k|} lxc_clear_mount_entries: 4165| 12.6k|{ 4166| 12.6k| struct string_entry *entry, *nentry; 4167| | 4168| 12.6k| list_for_each_entry_safe(entry, nentry, &c->mount_entries, 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.4k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 13.4k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 785, False: 12.6k] | | ------------------ | | 658| 12.6k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 785| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 785| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 785|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 785| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 785| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 785|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 785| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 785| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 785| do { \ | | | | | | | | | | | | | | | | 286| 785| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 785] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 785| !__same_type(*(ptr), void), \ | | | | | | | | 813| 785| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 785| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4169| 785| list_del(&entry->head); 4170| 785| free(entry->val); 4171| 785| free(entry); 4172| 785| } 4173| | 4174| 12.6k| INIT_LIST_HEAD(&c->mount_entries); 4175| 12.6k| return 0; 4176| 12.6k|} lxc_clear_hooks: 4185| 13.7k|{ 4186| 13.7k| const char *k = NULL; 4187| 13.7k| bool all = false, done = false; 4188| 13.7k| struct string_entry *entry, *nentry; 4189| | 4190| 13.7k| if (strequal(key, "lxc.hook")) ------------------ | Branch (4190:6): [True: 13.0k, False: 638] ------------------ 4191| 13.0k| all = true; 4192| 638| else if (strnequal(key, "lxc.hook.", STRLITERALLEN("lxc.hook."))) ------------------ | | 687| 638|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (4192:11): [True: 638, False: 0] ------------------ 4193| 638| k = key + STRLITERALLEN("lxc.hook."); ------------------ | | 687| 638|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 4194| 0| else 4195| 0| return -1; 4196| | 4197| 151k| for (int i = 0; i < NUM_LXC_HOOKS; i++) { ------------------ | Branch (4197:18): [True: 137k, False: 13.7k] ------------------ 4198| 137k| if (all || strequal(k, lxchook_names[i])) { ------------------ | Branch (4198:7): [True: 130k, False: 6.38k] | Branch (4198:14): [True: 638, False: 5.74k] ------------------ 4199| 131k| list_for_each_entry_safe(entry, nentry, &c->hooks[i], head) { ------------------ | | 655| 131k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 131k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 131k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 131k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 131k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 131k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 131k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 131k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 131k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 131k| do { \ | | | | | | | | | | | | | | | | 286| 131k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 131k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 131k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 131k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 131k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 131k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 131k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 131k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 131k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 131k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 131k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 131k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 131k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 131k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 131k| do { \ | | | | | | | | | | | | | | | | 286| 131k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 131k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 131k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 131k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 131k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 133k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 133k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 2.33k, False: 131k] | | ------------------ | | 658| 131k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 2.33k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 2.33k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.33k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.33k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.33k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.33k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.33k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.33k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.33k| do { \ | | | | | | | | | | | | | | | | 286| 2.33k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.33k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.33k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.33k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.33k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4200| 2.33k| list_del(&entry->head); 4201| 2.33k| free(entry->val); 4202| 2.33k| free(entry); 4203| 2.33k| } 4204| 131k| INIT_LIST_HEAD(&c->hooks[i]); 4205| 131k| done = true; 4206| 131k| } 4207| 137k| } 4208| | 4209| 13.7k| if (!done) ------------------ | Branch (4209:6): [True: 0, False: 13.7k] ------------------ 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.7k| return 0; 4213| 13.7k|} lxc_clear_apparmor_raw: 4216| 12.0k|{ 4217| 12.0k| struct string_entry *entry, *nentry; 4218| | 4219| 12.0k| list_for_each_entry_safe(entry, nentry, &c->lsm_aa_raw, head) { ------------------ | | 655| 12.0k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.0k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.0k| do { \ | | | | | | | | | | | | | | | | 286| 12.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.0k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.0k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.0k| do { \ | | | | | | | | | | | | | | | | 286| 12.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 12.0k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 12.0k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 0, False: 12.0k] | | ------------------ | | 658| 12.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))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 4220| 0| list_del(&entry->head); 4221| 0| free(entry->val); 4222| 0| free(entry); 4223| 0| } 4224| | 4225| 12.0k| INIT_LIST_HEAD(&c->lsm_aa_raw); 4226| 12.0k| return 0; 4227| 12.0k|} lxc_conf_free: 4230| 12.0k|{ 4231| 12.0k| if (!conf) ------------------ | Branch (4231:6): [True: 0, False: 12.0k] ------------------ 4232| 0| return; 4233| | 4234| 12.0k| if (current_config == conf) ------------------ | Branch (4234:6): [True: 0, False: 12.0k] ------------------ 4235| 0| current_config = NULL; 4236| 12.0k| lxc_terminal_conf_free(&conf->console); 4237| 12.0k| free(conf->rootfs.__bdev_type); 4238| 12.0k| free(conf->rootfs.mount); 4239| 12.0k| free(conf->rootfs.path); 4240| 12.0k| put_lxc_rootfs(&conf->rootfs, true); 4241| 12.0k| free(conf->logfile); 4242| 12.0k| if (conf->logfd != -1) ------------------ | Branch (4242:6): [True: 175, False: 11.9k] ------------------ 4243| 175| close(conf->logfd); 4244| 12.0k| free(conf->utsname); 4245| 12.0k| free(conf->ttys.dir); 4246| 12.0k| free(conf->ttys.tty_names); 4247| 12.0k| free(conf->fstab); 4248| 12.0k| free(conf->rcfile); 4249| 12.0k| free(conf->execute_cmd); 4250| 12.0k| free(conf->init_cmd); 4251| 12.0k| free(conf->init_groups.list); 4252| 12.0k| free(conf->init_cwd); 4253| 12.0k| free(conf->unexpanded_config); 4254| 12.0k| free(conf->syslog); 4255| 12.0k| lxc_free_networks(conf); 4256| 12.0k| free(conf->lsm_aa_profile); 4257| 12.0k| free(conf->lsm_aa_profile_computed); 4258| 12.0k| free(conf->lsm_se_context); 4259| 12.0k| free(conf->lsm_se_keyring_context); 4260| 12.0k| lxc_seccomp_free(&conf->seccomp); 4261| 12.0k| lxc_clear_config_caps(conf); 4262| | lxc_clear_cgroups(conf, "lxc.cgroup2", CGROUP2_SUPER_MAGIC); 4263| 12.0k| lxc_clear_cgroups_devices(conf); 4264| 12.0k| lxc_clear_hooks(conf, "lxc.hook"); 4265| 12.0k| lxc_clear_mount_entries(conf); 4266| 12.0k| lxc_clear_idmaps(conf); 4267| 12.0k| lxc_clear_groups(conf); 4268| 12.0k| lxc_clear_environment(&conf->environment); 4269| 12.0k| lxc_clear_limits(conf, "lxc.prlimit"); 4270| 12.0k| lxc_clear_sysctls(conf, "lxc.sysctl"); 4271| 12.0k| lxc_clear_procs(conf, "lxc.proc"); 4272| 12.0k| lxc_clear_apparmor_raw(conf); 4273| 12.0k| lxc_clear_namespace(conf); 4274| 12.0k| free(conf->cgroup_meta.dir); 4275| 12.0k| free(conf->cgroup_meta.monitor_dir); 4276| 12.0k| free(conf->cgroup_meta.monitor_pivot_dir); 4277| 12.0k| free(conf->cgroup_meta.container_dir); 4278| 12.0k| free(conf->cgroup_meta.namespace_dir); 4279| 12.0k| free(conf->cgroup_meta.controllers); 4280| 12.0k| free(conf->cgroup_meta.systemd_scope); 4281| 12.0k| free(conf->shmount.path_host); 4282| 12.0k| free(conf->shmount.path_cont); 4283| 12.0k| free(conf); 4284| 12.0k|} conf.c:parse_vfs_attr: 1943| 3.55k|{ 1944| | /* 1945| | * If opt is found in mount_opt, set or clear flags. 1946| | * Otherwise append it to data. 1947| | */ 1948| 91.8k| for (struct mount_opt *mo = &mount_opt[0]; mo->name != NULL; mo++) { ------------------ | Branch (1948:45): [True: 89.4k, False: 2.37k] ------------------ 1949| 89.4k| if (!strnequal(opt, mo->name, strlen(mo->name))) ------------------ | Branch (1949:7): [True: 88.3k, False: 1.18k] ------------------ 1950| 88.3k| continue; 1951| | 1952| | /* This is a recursive bind-mount. */ 1953| 1.18k| if (strequal(mo->name, "rbind")) { ------------------ | Branch (1953:7): [True: 196, False: 987] ------------------ 1954| 196| opts->bind_recursively = 1; 1955| 196| opts->bind = 1; 1956| 196| opts->mnt_flags |= mo->legacy_flag; /* MS_BIND | MS_REC */ 1957| 196| return 0; 1958| 196| } 1959| | 1960| | /* This is a bind-mount. */ 1961| 987| if (strequal(mo->name, "bind")) { ------------------ | Branch (1961:7): [True: 243, False: 744] ------------------ 1962| 243| opts->bind = 1; 1963| 243| opts->mnt_flags |= mo->legacy_flag; /* MS_BIND */ 1964| 243| return 0; 1965| 243| } 1966| | 1967| 744| if (mo->flag == (__u64)~0) ------------------ | Branch (1967:7): [True: 330, False: 414] ------------------ 1968| 330| return log_info(0, "Ignoring %s mount option", mo->name); ------------------ | | 554| 330| ({ \ | | 555| 330| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 556| 330| INFO(format, ##__VA_ARGS__); \ | | ------------------ | | | | 357| 330|#define INFO(format, ...) do { \ | | | | 358| 330| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 330| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 359| 330| LXC_INFO(&locinfo, format, ##__VA_ARGS__); \ | | | | 360| 330|} while (0) | | | | ------------------ | | | | | Branch (360:10): [Folded, False: 330] | | | | ------------------ | | ------------------ | | 557| 330| __internal_ret__; \ | | 558| 330| }) ------------------ 1969| | 1970| 414| if (mo->clear) { ------------------ | Branch (1970:7): [True: 218, False: 196] ------------------ 1971| 218| opts->attr.attr_clr |= mo->flag; 1972| 218| opts->mnt_flags &= ~mo->legacy_flag; 1973| 218| TRACE("Lowering %s", mo->name); ------------------ | | 347| 218|#define TRACE(format, ...) do { \ | | 348| 218| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 218| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 218| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 218|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 218] | | ------------------ ------------------ 1974| 218| } else { 1975| 196| opts->attr.attr_set |= mo->flag; 1976| 196| opts->mnt_flags |= mo->legacy_flag; 1977| 196| TRACE("Raising %s", mo->name); ------------------ | | 347| 196|#define TRACE(format, ...) do { \ | | 348| 196| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 196| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 196| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 196|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 196] | | ------------------ ------------------ 1978| 196| } 1979| | 1980| 414| return 0; 1981| 744| } 1982| | 1983| 17.8k| for (struct mount_opt *mo = &propagation_opt[0]; mo->name != NULL; mo++) { ------------------ | Branch (1983:51): [True: 16.5k, False: 1.32k] ------------------ 1984| 16.5k| if (!strnequal(opt, mo->name, strlen(mo->name))) ------------------ | Branch (1984:7): [True: 15.5k, False: 1.04k] ------------------ 1985| 15.5k| continue; 1986| | 1987| 1.04k| if (strequal(mo->name, "rslave") || ------------------ | Branch (1987:7): [True: 212, False: 832] ------------------ 1988| 832| strequal(mo->name, "rshared") || ------------------ | Branch (1988:7): [True: 194, False: 638] ------------------ 1989| 638| strequal(mo->name, "runbindable") || ------------------ | Branch (1989:7): [True: 196, False: 442] ------------------ 1990| 442| strequal(mo->name, "rprivate")) ------------------ | Branch (1990:7): [True: 204, False: 238] ------------------ 1991| 806| opts->propagate_recursively = 1; 1992| | 1993| 1.04k| opts->attr.propagation = mo->flag; 1994| 1.04k| opts->prop_flags |= mo->legacy_flag; 1995| 1.04k| return 0; 1996| 16.5k| } 1997| | 1998| | /* opt was skipped */ 1999| 1.32k| return 1; 2000| 2.37k|} conf.c:lxc_free_idmap: 3967| 12.8k|{ 3968| 12.8k| struct id_map *map, *nmap; 3969| | 3970| 12.8k| list_for_each_entry_safe(map, nmap, id_map, 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| 15.0k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 15.0k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 2.20k, False: 12.8k] | | ------------------ | | 658| 12.8k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 2.20k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 2.20k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.20k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.20k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.20k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 2.20k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 2.20k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 2.20k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 2.20k| do { \ | | | | | | | | | | | | | | | | 286| 2.20k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 2.20k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.20k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.20k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.20k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 3971| 2.20k| list_del(&map->head); 3972| 2.20k| free(map); 3973| 2.20k| } 3974| | 3975| 12.8k| INIT_LIST_HEAD(id_map); 3976| 12.8k| return 0; 3977| 12.8k|} conf.c:lxc_clear_cgroups_devices: 4043| 12.0k|{ 4044| 12.0k| lxc_clear_cgroup2_devices(&conf->bpf_devices); 4045| 12.0k|} conf.c:put_lxc_rootfs: 691| 12.0k|{ 692| 12.0k| if (rootfs) { ------------------ | Branch (692:6): [True: 12.0k, False: 0] ------------------ 693| 12.0k| close_prot_errno_disarm(rootfs->dfd_host); ------------------ | | 29| 12.0k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 12.0k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 694| 12.0k| close_prot_errno_disarm(rootfs->dfd_mnt); ------------------ | | 29| 12.0k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 12.0k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 695| 12.0k| close_prot_errno_disarm(rootfs->dfd_dev); ------------------ | | 29| 12.0k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 12.0k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 696| 12.0k| if (unpin) ------------------ | Branch (696:7): [True: 12.0k, False: 0] ------------------ 697| 12.0k| close_prot_errno_disarm(rootfs->fd_path_pin); ------------------ | | 29| 12.0k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 12.0k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 698| 12.0k| close_prot_errno_disarm(rootfs->dfd_idmapped); ------------------ | | 29| 12.0k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 12.0k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 699| 12.0k| put_lxc_mount_options(&rootfs->mnt_opts); 700| 12.0k| storage_put(rootfs->storage); 701| | rootfs->storage = NULL; 702| 12.0k| } 703| 12.0k|} conf.c:put_lxc_mount_options: 677| 12.0k|{ 678| 12.0k| mnt_opts->create_dir = 0; 679| 12.0k| mnt_opts->create_file = 0; 680| 12.0k| mnt_opts->optional = 0; 681| 12.0k| mnt_opts->relative = 0; 682| 12.0k| mnt_opts->userns_path[0] = '\0'; 683| 12.0k| mnt_opts->mnt_flags = 0; 684| 12.0k| mnt_opts->prop_flags = 0; 685| | 686| 12.0k| free_disarm(mnt_opts->data); ------------------ | | 58| 12.0k| ({ \ | | 59| 12.0k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 207, False: 11.8k] | | ------------------ | | 60| 207| free(ptr); \ | | 61| 207| ptr = NULL; \ | | 62| 207| } \ | | 63| 12.0k| }) ------------------ 687| | free_disarm(mnt_opts->raw_options); ------------------ | | 58| 12.0k| ({ \ | | 59| 12.0k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 317, False: 11.7k] | | ------------------ | | 60| 317| free(ptr); \ | | 61| 317| ptr = NULL; \ | | 62| 317| } \ | | 63| 12.0k| }) ------------------ 688| 12.0k|} conf.c:lxc_clear_cgroup2_devices: 706| 12.0k|{ 707| 12.0k| struct device_item *device, *n; 708| | 709| 12.0k| list_for_each_entry_safe(device, n, &bpf_devices->devices, head) ------------------ | | 655| 12.0k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 12.0k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 12.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.0k| do { \ | | | | | | | | | | | | | | | | 286| 12.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 12.0k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 12.0k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 12.0k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 12.0k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 12.0k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 12.0k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 12.0k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 12.0k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 12.0k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 12.0k| do { \ | | | | | | | | | | | | | | | | 286| 12.0k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 12.0k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 12.0k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 12.0k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 12.0k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 12.0k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 12.0k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 0, False: 12.0k] | | ------------------ | | 658| 12.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))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 710| 0| list_del(&device->head); 711| | 712| 12.0k| INIT_LIST_HEAD(&bpf_devices->devices); 713| 12.0k|} confile.c:put_lxc_mount_options: 677| 2.09k|{ 678| 2.09k| mnt_opts->create_dir = 0; 679| 2.09k| mnt_opts->create_file = 0; 680| 2.09k| mnt_opts->optional = 0; 681| 2.09k| mnt_opts->relative = 0; 682| 2.09k| mnt_opts->userns_path[0] = '\0'; 683| 2.09k| mnt_opts->mnt_flags = 0; 684| 2.09k| mnt_opts->prop_flags = 0; 685| | 686| 2.09k| free_disarm(mnt_opts->data); ------------------ | | 58| 2.09k| ({ \ | | 59| 2.09k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 510, False: 1.58k] | | ------------------ | | 60| 510| free(ptr); \ | | 61| 510| ptr = NULL; \ | | 62| 510| } \ | | 63| 2.09k| }) ------------------ 687| | free_disarm(mnt_opts->raw_options); ------------------ | | 58| 2.09k| ({ \ | | 59| 2.09k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 1.41k, False: 680] | | ------------------ | | 60| 1.41k| free(ptr); \ | | 61| 1.41k| ptr = NULL; \ | | 62| 1.41k| } \ | | 63| 2.09k| }) ------------------ 688| 2.09k|} lxc_get_config: 363| 101k|{ 364| 5.37M| for (size_t i = 0; i < ARRAY_SIZE(config_jump_table); i++) { ------------------ | | 728| 5.37M| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 5.37M| typeof(&*(x))), \ | | 730| 5.37M| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (364:21): [True: 5.37M, False: 332] ------------------ 365| 5.37M| struct lxc_config_t *cur = &config_jump_table[i]; 366| | 367| 5.37M| switch (match_config_item(cur, key)) { ------------------ | Branch (367:11): [True: 5.27M, False: 101k] ------------------ 368| 5.27M| case 0: ------------------ | Branch (368:3): [True: 5.27M, False: 101k] ------------------ 369| 5.27M| continue; 370| 0| case -E2BIG: ------------------ | Branch (370:3): [True: 0, False: 5.37M] ------------------ 371| 0| return &unsupported_config_key; 372| 5.37M| } 373| | 374| 101k| return cur; 375| 5.37M| } 376| | 377| 332| return &unsupported_config_key; 378| 101k|} append_unexp_config_line: 2713| 116k|{ 2714| 116k| size_t linelen; 2715| 116k| size_t len = conf->unexpanded_len; 2716| | 2717| 116k| update_hwaddr(line); 2718| | 2719| 116k| linelen = strlen(line); 2720| 131k| while (conf->unexpanded_alloced <= len + linelen + 2) { ------------------ | Branch (2720:9): [True: 15.4k, False: 116k] ------------------ 2721| 15.4k| char *tmp; 2722| | 2723| 15.4k| tmp = realloc(conf->unexpanded_config, conf->unexpanded_alloced + 1024); 2724| 15.4k| if (!tmp) ------------------ | Branch (2724:7): [True: 0, False: 15.4k] ------------------ 2725| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2726| | 2727| 15.4k| if (!conf->unexpanded_config) ------------------ | Branch (2727:7): [True: 12.0k, False: 3.41k] ------------------ 2728| 12.0k| *tmp = '\0'; 2729| | 2730| 15.4k| conf->unexpanded_config = tmp; 2731| 15.4k| conf->unexpanded_alloced += 1024; 2732| 15.4k| } 2733| | 2734| 116k| memcpy(conf->unexpanded_config + conf->unexpanded_len, line, linelen); 2735| 116k| conf->unexpanded_len += linelen; 2736| 116k| if (line[linelen - 1] != '\n') ------------------ | Branch (2736:6): [True: 114k, False: 1.03k] ------------------ 2737| 114k| conf->unexpanded_config[conf->unexpanded_len++] = '\n'; 2738| 116k| conf->unexpanded_config[conf->unexpanded_len] = '\0'; 2739| | 2740| 116k| return 0; 2741| 116k|} lxc_config_read: 3200| 19.5k|{ 3201| 19.5k| struct parse_line_conf plc; 3202| | 3203| 19.5k| if (!conf) ------------------ | Branch (3203:6): [True: 0, False: 19.5k] ------------------ 3204| 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| }) ------------------ 3205| | 3206| 19.5k| plc.conf = conf; 3207| 19.5k| plc.from_include = from_include; 3208| | 3209| | /* Catch only the top level config file name in the structure. */ 3210| 19.5k| if (!conf->rcfile) ------------------ | Branch (3210:6): [True: 12.0k, False: 7.48k] ------------------ 3211| 12.0k| conf->rcfile = strdup(file); 3212| | 3213| 19.5k| return lxc_file_for_each_line_mmap(file, parse_line, &plc); 3214| 19.5k|} lxc_config_parse_arch: 3267| 325|{ 3268| 325| static struct per_name { 3269| 325| char *name; 3270| 325| unsigned long per; 3271| 325| } pername[] = { 3272| 325| { "arm", PER_LINUX32 }, 3273| 325| { "armel", PER_LINUX32 }, 3274| 325| { "armhf", PER_LINUX32 }, 3275| 325| { "armv7l", PER_LINUX32 }, 3276| 325| { "athlon", PER_LINUX32 }, 3277| 325| { "i386", PER_LINUX32 }, 3278| 325| { "i486", PER_LINUX32 }, 3279| 325| { "i586", PER_LINUX32 }, 3280| 325| { "i686", PER_LINUX32 }, 3281| 325| { "linux32", PER_LINUX32 }, 3282| 325| { "mips", PER_LINUX32 }, 3283| 325| { "mipsel", PER_LINUX32 }, 3284| 325| { "ppc", PER_LINUX32 }, 3285| 325| { "powerpc", PER_LINUX32 }, 3286| 325| { "x32", PER_LINUX32 }, 3287| 325| { "x86", PER_LINUX32 }, 3288| 325| { "aarch64", PER_LINUX }, 3289| 325| { "amd64", PER_LINUX }, 3290| 325| { "arm64", PER_LINUX }, 3291| 325| { "linux64", PER_LINUX }, 3292| 325| { "loongarch64", PER_LINUX }, 3293| 325| { "loong64", PER_LINUX }, 3294| 325| { "mips64", PER_LINUX }, 3295| 325| { "mips64el", PER_LINUX }, 3296| 325| { "ppc64", PER_LINUX }, 3297| 325| { "ppc64el", PER_LINUX }, 3298| 325| { "ppc64le", PER_LINUX }, 3299| 325| { "powerpc64", PER_LINUX }, 3300| 325| { "riscv64", PER_LINUX }, 3301| 325| { "s390x", PER_LINUX }, 3302| 325| { "x86_64", PER_LINUX }, 3303| 325| }; 3304| | 3305| 2.97k| for (size_t i = 0; i < ARRAY_SIZE(pername); i++) { ------------------ | | 728| 2.97k| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 2.97k| typeof(&*(x))), \ | | 730| 2.97k| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (3305:21): [True: 2.89k, False: 79] ------------------ 3306| 2.89k| if (!strequal(pername[i].name, arch)) ------------------ | Branch (3306:7): [True: 2.64k, False: 246] ------------------ 3307| 2.64k| continue; 3308| | 3309| 246| *persona = pername[i].per; 3310| 246| return 0; 3311| 2.89k| } 3312| | 3313| 79| return ret_errno(EINVAL); ------------------ | | 715| 79| ({ \ | | 716| 79| errno = labs(__errno__); \ | | 717| 79| -errno; \ | | 718| 79| }) ------------------ 3314| 325|} confile.c:set_config_personality: 1436| 325|{ 1437| 325| int ret; 1438| 325| personality_t personality; 1439| | 1440| 325| ret = lxc_config_parse_arch(value, &personality); 1441| 325| if (ret < 0) ------------------ | Branch (1441:6): [True: 79, False: 246] ------------------ 1442| 79| return syserror("Unsupported personality \"%s\"", value); ------------------ | | 562| 79| ({ \ | | 563| 79| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 79| do { \ | | | | 454| 79| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 79| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 79| char *ptr = NULL; \ | | | | | | 317| 79| { \ | | | | | | 318| 79| int __saved_errno = errno; \ | | | | | | 319| 79| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 79| errno = __saved_errno; \ | | | | | | 321| 79| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 79] | | | | | | ------------------ | | | | | | 322| 79| ptr = errno_buf; \ | | | | | | 323| 79| } | | | | ------------------ | | | | 455| 79| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 79|#define ERROR(format, ...) do { \ | | | | | | 373| 79| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 79| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 79| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 79|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 79] | | | | | | ------------------ | | | | ------------------ | | | | 456| 79| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 79] | | | | ------------------ | | ------------------ | | 564| 79| (-labs(errno)); \ | | 565| 79| }) ------------------ 1443| | 1444| 246| lxc_conf->personality = personality; 1445| 246| return 0; 1446| 325|} confile.c:set_config_apparmor_profile: 1675| 1|{ 1676| |#if HAVE_APPARMOR 1677| | return set_config_string_item(&lxc_conf->lsm_aa_profile, value); 1678| |#else 1679| | 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| }) ------------------ 1680| 1|#endif 1681| 1|} confile.c:set_config_apparmor_allow_incomplete: 1687| 1|{ 1688| |#if HAVE_APPARMOR 1689| | int ret; 1690| | 1691| | if (lxc_config_value_empty(value)) { 1692| | lxc_conf->lsm_aa_allow_incomplete = 0; 1693| | return 0; 1694| | } 1695| | 1696| | ret = lxc_safe_uint(value, &lxc_conf->lsm_aa_allow_incomplete); 1697| | if (ret) 1698| | return ret; 1699| | 1700| | if (lxc_conf->lsm_aa_allow_incomplete > 1) 1701| | return ret_errno(EINVAL); 1702| | 1703| | return 0; 1704| |#else 1705| | 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| }) ------------------ 1706| 1|#endif 1707| 1|} confile.c:set_config_apparmor_allow_nesting: 1713| 1|{ 1714| |#if HAVE_APPARMOR 1715| | int ret; 1716| | 1717| | if (lxc_config_value_empty(value)) 1718| | return clr_config_apparmor_allow_nesting(key, lxc_conf, NULL); 1719| | 1720| | ret = lxc_safe_uint(value, &lxc_conf->lsm_aa_allow_nesting); 1721| | if (ret) 1722| | return ret; 1723| | 1724| | if (lxc_conf->lsm_aa_allow_nesting > 1) 1725| | return ret_errno(EINVAL); 1726| | 1727| | return 0; 1728| |#else 1729| | 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| }) ------------------ 1730| 1|#endif 1731| 1|} confile.c:set_config_apparmor_raw: 1737| 1|{ 1738| |#if HAVE_APPARMOR 1739| | __do_free char *elem = NULL; 1740| | __do_free struct string_entry *entry = NULL; 1741| | 1742| | if (lxc_config_value_empty(value)) 1743| | return lxc_clear_apparmor_raw(lxc_conf); 1744| | 1745| | entry = zalloc(sizeof(struct string_entry)); 1746| | if (!entry) 1747| | return ret_errno(ENOMEM); 1748| | 1749| | elem = strdup(value); 1750| | if (!elem) 1751| | return ret_errno(ENOMEM); 1752| | 1753| | entry->val = move_ptr(elem); 1754| | list_add_tail(&entry->head, &lxc_conf->lsm_aa_raw); 1755| | move_ptr(entry); 1756| | 1757| | return 0; 1758| |#else 1759| | 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| }) ------------------ 1760| 1|#endif 1761| 1|} confile.c:set_config_autodev_tmpfs_size: 1861| 1.69k|{ 1862| 1.69k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1862:6): [True: 194, False: 1.50k] ------------------ 1863| 194| lxc_conf->autodevtmpfssize = 500000; 1864| 194| return 0; 1865| 194| } 1866| | 1867| 1.50k| if (lxc_safe_int(value, &lxc_conf->autodevtmpfssize) < 0) ------------------ | Branch (1867:6): [True: 1.30k, False: 195] ------------------ 1868| 1.30k| lxc_conf->autodevtmpfssize = 500000; 1869| | 1870| 1.50k| return 0; 1871| 1.69k|} confile.c:set_config_autodev: 1841| 451|{ 1842| 451| int ret; 1843| | 1844| 451| if (lxc_config_value_empty(value)) { ------------------ | Branch (1844:6): [True: 194, False: 257] ------------------ 1845| 194| lxc_conf->autodev = 0; 1846| 194| return 0; 1847| 194| } 1848| | 1849| 257| ret = lxc_safe_uint(value, &lxc_conf->autodev); 1850| 257| if (ret) ------------------ | Branch (1850:6): [True: 14, False: 243] ------------------ 1851| 14| return ret_errno(EINVAL); ------------------ | | 715| 14| ({ \ | | 716| 14| errno = labs(__errno__); \ | | 717| 14| -errno; \ | | 718| 14| }) ------------------ 1852| | 1853| 243| if (lxc_conf->autodev > 1) ------------------ | Branch (1853:6): [True: 48, False: 195] ------------------ 1854| 48| return ret_errno(EINVAL); ------------------ | | 715| 48| ({ \ | | 716| 48| errno = labs(__errno__); \ | | 717| 48| -errno; \ | | 718| 48| }) ------------------ 1855| | 1856| 195| return 0; 1857| 243|} confile.c:set_config_cap_drop: 2534| 411|{ 2535| 411| __do_free char *caps = NULL; ------------------ | | 69| 411|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 411| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2536| 411| int ret; 2537| | 2538| 411| if (lxc_config_value_empty(value)) ------------------ | Branch (2538:6): [True: 194, False: 217] ------------------ 2539| 194| return lxc_clear_config_caps(lxc_conf); 2540| | 2541| 217| if (lxc_conf->caps.keep) ------------------ | Branch (2541:6): [True: 1, False: 216] ------------------ 2542| 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| }) ------------------ 2543| | 2544| 216| caps = strdup(value); 2545| 216| if (!caps) ------------------ | Branch (2545:6): [True: 0, False: 216] ------------------ 2546| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2547| | 2548| 216| ret = add_cap_entry(lxc_conf, caps, false); 2549| 216| if (ret < 0) ------------------ | Branch (2549:6): [True: 9, False: 207] ------------------ 2550| 9| return ret; 2551| | 2552| 207| lxc_conf->caps.keep = false; 2553| 207| return 0; 2554| 216|} confile.c:add_cap_entry: 2463| 1.05k|{ 2464| 1.05k| char *token; 2465| | 2466| | /* 2467| | * In case several capability keep is specified in a single line split 2468| | * these caps in a single element for the list. 2469| | */ 2470| 1.05k| lxc_iterate_parts(token, caps, " \t") { ------------------ | | 187| 1.05k| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.48k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 498, False: 985] | | ------------------ | | 189| 1.05k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2471| 498| __do_free struct cap_entry *new_cap = NULL; ------------------ | | 69| 498|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 498| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2472| 498| int ret; 2473| 498| __u32 cap; 2474| | 2475| 498| if (strequal(token, "none")) { ------------------ | Branch (2475:7): [True: 428, False: 70] ------------------ 2476| 428| if (!keep) ------------------ | Branch (2476:8): [True: 1, False: 427] ------------------ 2477| 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| }) ------------------ 2478| | 2479| 427| lxc_clear_config_caps(conf); 2480| 427| continue; 2481| 428| } 2482| | 2483| 70| ret = parse_cap(token, &cap); 2484| 70| if (ret < 0) { ------------------ | Branch (2484:7): [True: 70, False: 0] ------------------ 2485| 70| if (ret != -2) ------------------ | Branch (2485:8): [True: 70, False: 0] ------------------ 2486| 70| return syserror_set(-EINVAL, "Invalid capability specified: %s", token); ------------------ | | 568| 70| ({ \ | | 569| 70| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 70| errno = labs(__ret__); \ | | 571| 70| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 70| do { \ | | | | 454| 70| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 70| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 70| char *ptr = NULL; \ | | | | | | 317| 70| { \ | | | | | | 318| 70| int __saved_errno = errno; \ | | | | | | 319| 70| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 70| errno = __saved_errno; \ | | | | | | 321| 70| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 70] | | | | | | ------------------ | | | | | | 322| 70| ptr = errno_buf; \ | | | | | | 323| 70| } | | | | ------------------ | | | | 455| 70| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 70|#define ERROR(format, ...) do { \ | | | | | | 373| 70| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 70| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 70| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 70|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 70] | | | | | | ------------------ | | | | ------------------ | | | | 456| 70| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 70] | | | | ------------------ | | ------------------ | | 572| 70| __internal_ret__; \ | | 573| 70| }) ------------------ 2487| | 2488| 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] | | ------------------ ------------------ 2489| 0| continue; 2490| 70| } 2491| | 2492| 0| new_cap = zalloc(sizeof(struct cap_entry)); ------------------ | | 90| 0|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2493| 0| if (!new_cap) ------------------ | Branch (2493:7): [True: 0, False: 0] ------------------ 2494| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2495| | 2496| 0| new_cap->cap_name = strdup(token); 2497| 0| if (!new_cap->cap_name) ------------------ | Branch (2497:7): [True: 0, False: 0] ------------------ 2498| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2499| 0| new_cap->cap = cap; 2500| | 2501| 0| list_add_tail(&new_cap->head, &conf->caps.list); 2502| 0| move_ptr(new_cap); ------------------ | | 694| 0| ({ \ | | 695| 0| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 0| (ptr) = NULL; \ | | 697| 0| __internal_ptr__; \ | | 698| 0| }) ------------------ 2503| 0| } 2504| | 2505| 985| return 0; 2506| 1.05k|} confile.c:set_config_cap_keep: 2510| 1.22k|{ 2511| 1.22k| __do_free char *caps = NULL; ------------------ | | 69| 1.22k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.22k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2512| 1.22k| int ret; 2513| | 2514| 1.22k| if (lxc_config_value_empty(value)) ------------------ | Branch (2514:6): [True: 382, False: 840] ------------------ 2515| 382| return lxc_clear_config_caps(lxc_conf); 2516| | 2517| 840| caps = strdup(value); 2518| 840| if (!caps) ------------------ | Branch (2518:6): [True: 0, False: 840] ------------------ 2519| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2520| | 2521| 840| if (!lxc_conf->caps.keep && !list_empty(&lxc_conf->caps.list)) ------------------ | Branch (2521:6): [True: 267, False: 573] | Branch (2521:30): [True: 0, False: 267] ------------------ 2522| 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| }) ------------------ 2523| | 2524| 840| ret = add_cap_entry(lxc_conf, caps, true); 2525| 840| if (ret < 0) ------------------ | Branch (2525:6): [True: 62, False: 778] ------------------ 2526| 62| return ret; 2527| | 2528| 778| lxc_conf->caps.keep = true; 2529| 778| return 0; 2530| 840|} confile.c:set_config_cgroup2_controller: 1976| 1.31k|{ 1977| 1.31k| return __set_config_cgroup_controller(key, value, lxc_conf, 1978| | CGROUP2_SUPER_MAGIC); 1979| 1.31k|} confile.c:__set_config_cgroup_controller: 1932| 1.31k|{ 1933| 1.31k| call_cleaner(free_lxc_cgroup) struct lxc_cgroup *new_cgroup = NULL; ------------------ | | 26| 1.31k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 1934| 1.31k| const char *subkey, *token; 1935| 1.31k| size_t token_len; 1936| | 1937| 1.31k| if (lxc_config_value_empty(value)) ------------------ | Branch (1937:6): [True: 702, False: 608] ------------------ 1938| 702| return lxc_clear_cgroups(lxc_conf, key, version); 1939| | 1940| 608| if (version == CGROUP2_SUPER_MAGIC) { ------------------ | Branch (1940:6): [True: 608, False: 0] ------------------ 1941| 608| token = "lxc.cgroup2."; 1942| 608| token_len = 12; 1943| 608| } else { 1944| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1945| 0| } 1946| | 1947| 608| if (!strnequal(key, token, token_len)) ------------------ | Branch (1947:6): [True: 9, False: 599] ------------------ 1948| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 1949| | 1950| 599| subkey = key + token_len; 1951| 599| if (*subkey == '\0') ------------------ | Branch (1951:6): [True: 1, False: 598] ------------------ 1952| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1953| | 1954| 598| new_cgroup = zalloc(sizeof(*new_cgroup)); ------------------ | | 90| 598|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1955| 598| if (!new_cgroup) ------------------ | Branch (1955:6): [True: 0, False: 598] ------------------ 1956| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1957| | 1958| 598| new_cgroup->subsystem = strdup(subkey); 1959| 598| if (!new_cgroup->subsystem) ------------------ | Branch (1959:6): [True: 0, False: 598] ------------------ 1960| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1961| | 1962| 598| new_cgroup->value = strdup(value); 1963| 598| if (!new_cgroup->value) ------------------ | Branch (1963:6): [True: 0, False: 598] ------------------ 1964| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1965| | 1966| 598| new_cgroup->version = version; 1967| | 1968| 598| list_add_tail(&new_cgroup->head, &lxc_conf->cgroup2); 1969| 598| move_ptr(new_cgroup); ------------------ | | 694| 598| ({ \ | | 695| 598| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 598| (ptr) = NULL; \ | | 697| 598| __internal_ptr__; \ | | 698| 598| }) ------------------ 1970| | 1971| 598| return 0; 1972| 598|} confile.c:set_config_cgroup_monitor_pivot_dir: 2016| 910|{ 2017| 910| if (lxc_config_value_empty(value)) ------------------ | Branch (2017:6): [True: 513, False: 397] ------------------ 2018| 513| return clr_config_cgroup_monitor_pivot_dir(key, lxc_conf, NULL); 2019| | 2020| 397| if (abspath(value)) ------------------ | Branch (2020:6): [True: 1, False: 396] ------------------ 2021| 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| }) ------------------ 2022| | 2023| 396| if (dotdot(value)) ------------------ | Branch (2023:6): [True: 1, False: 395] ------------------ 2024| 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| }) ------------------ 2025| | 2026| 395| return set_config_path_item(&lxc_conf->cgroup_meta.monitor_pivot_dir, value); 2027| 396|} confile.c:clr_config_cgroup_monitor_pivot_dir: 4950| 513|{ 4951| | free_disarm(lxc_conf->cgroup_meta.monitor_pivot_dir); ------------------ | | 58| 513| ({ \ | | 59| 513| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 198, False: 315] | | ------------------ | | 60| 198| free(ptr); \ | | 61| 198| ptr = NULL; \ | | 62| 198| } \ | | 63| 513| }) ------------------ 4952| 513| return 0; 4953| 513|} confile.c:set_config_cgroup_monitor_dir: 2001| 818|{ 2002| 818| if (lxc_config_value_empty(value)) ------------------ | Branch (2002:6): [True: 388, False: 430] ------------------ 2003| 388| return clr_config_cgroup_monitor_dir(key, lxc_conf, NULL); 2004| | 2005| 430| if (abspath(value)) ------------------ | Branch (2005:6): [True: 1, False: 429] ------------------ 2006| 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| }) ------------------ 2007| | 2008| 429| if (dotdot(value)) ------------------ | Branch (2008:6): [True: 1, False: 428] ------------------ 2009| 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| }) ------------------ 2010| | 2011| 428| return set_config_path_item(&lxc_conf->cgroup_meta.monitor_dir, value); 2012| 429|} confile.c:clr_config_cgroup_monitor_dir: 4942| 388|{ 4943| | free_disarm(lxc_conf->cgroup_meta.monitor_dir); ------------------ | | 58| 388| ({ \ | | 59| 388| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 194, False: 194] | | ------------------ | | 60| 194| free(ptr); \ | | 61| 194| ptr = NULL; \ | | 62| 194| } \ | | 63| 388| }) ------------------ 4944| 388| return 0; 4945| 388|} confile.c:set_config_cgroup_container_inner_dir: 2049| 800|{ 2050| 800| if (lxc_config_value_empty(value)) ------------------ | Branch (2050:6): [True: 390, False: 410] ------------------ 2051| 390| return clr_config_cgroup_container_inner_dir(key, lxc_conf, NULL); 2052| | 2053| 410| if (abspath(value)) ------------------ | Branch (2053:6): [True: 1, False: 409] ------------------ 2054| 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| }) ------------------ 2055| | 2056| 409| if (strchr(value, '/') || strequal(value, ".") || strequal(value, "..")) ------------------ | Branch (2056:6): [True: 1, False: 408] | Branch (2056:28): [True: 1, False: 407] | Branch (2056:52): [True: 1, False: 406] ------------------ 2057| 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| }) ------------------ 2058| | 2059| 406| return set_config_string_item(&lxc_conf->cgroup_meta.namespace_dir, value); 2060| 409|} confile.c:clr_config_cgroup_container_inner_dir: 4966| 390|{ 4967| | free_disarm(lxc_conf->cgroup_meta.namespace_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| }) ------------------ 4968| 390| return 0; 4969| 390|} confile.c:set_config_cgroup_container_dir: 2032| 937|{ 2033| 937| if (lxc_config_value_empty(value)) ------------------ | Branch (2033:6): [True: 523, False: 414] ------------------ 2034| 523| return clr_config_cgroup_container_dir(key, lxc_conf, NULL); 2035| | 2036| 414| if (abspath(value)) ------------------ | Branch (2036:6): [True: 1, False: 413] ------------------ 2037| 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| }) ------------------ 2038| | 2039| 413| if (dotdot(value)) ------------------ | Branch (2039:6): [True: 1, False: 412] ------------------ 2040| 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| }) ------------------ 2041| | 2042| 412| return set_config_path_item(&lxc_conf->cgroup_meta.container_dir, value); 2043| 413|} confile.c:clr_config_cgroup_container_dir: 4958| 523|{ 4959| | free_disarm(lxc_conf->cgroup_meta.container_dir); ------------------ | | 58| 523| ({ \ | | 59| 523| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 206, False: 317] | | ------------------ | | 60| 206| free(ptr); \ | | 61| 206| ptr = NULL; \ | | 62| 206| } \ | | 63| 523| }) ------------------ 4960| 523| return 0; 4961| 523|} confile.c:set_config_cgroup_dir: 1983| 798|{ 1984| 798| if (!strequal(key, "lxc.cgroup.dir")) ------------------ | Branch (1984:6): [True: 0, False: 798] ------------------ 1985| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1986| | 1987| 798| if (lxc_config_value_empty(value)) ------------------ | Branch (1987:6): [True: 390, False: 408] ------------------ 1988| 390| return clr_config_cgroup_dir(key, lxc_conf, NULL); 1989| | 1990| 408| if (abspath(value)) ------------------ | Branch (1990:6): [True: 2, False: 406] ------------------ 1991| 2| return syserror_set(-EINVAL, "%s paths may not be absolute", key); ------------------ | | 568| 2| ({ \ | | 569| 2| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 2| errno = labs(__ret__); \ | | 571| 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] | | | | ------------------ | | ------------------ | | 572| 2| __internal_ret__; \ | | 573| 2| }) ------------------ 1992| | 1993| 406| if (dotdot(value)) ------------------ | Branch (1993:6): [True: 1, False: 405] ------------------ 1994| 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| }) ------------------ 1995| | 1996| 405| return set_config_path_item(&lxc_conf->cgroup_meta.dir, value); 1997| 406|} confile.c:clr_config_cgroup_dir: 4929| 390|{ 4930| 390| if (!strequal(key, "lxc.cgroup.dir")) ------------------ | Branch (4930:6): [True: 0, False: 390] ------------------ 4931| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 4932| | 4933| 390| if (lxc_conf->cgroup_meta.dir) ------------------ | Branch (4933:6): [True: 194, False: 196] ------------------ 4934| 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| }) ------------------ 4935| | 4936| 390| return 0; 4937| 390|} confile.c:set_config_cgroup_relative: 2064| 651|{ 2065| 651| unsigned int converted; 2066| 651| int ret; 2067| | 2068| 651| if (lxc_config_value_empty(value)) ------------------ | Branch (2068:6): [True: 194, False: 457] ------------------ 2069| 194| return clr_config_cgroup_relative(key, lxc_conf, NULL); 2070| | 2071| 457| ret = lxc_safe_uint(value, &converted); 2072| 457| if (ret) ------------------ | Branch (2072:6): [True: 2, False: 455] ------------------ 2073| 2| return ret; 2074| | 2075| 455| if (converted == 1) { ------------------ | Branch (2075:6): [True: 194, False: 261] ------------------ 2076| 194| lxc_conf->cgroup_meta.relative = true; 2077| 194| return 0; 2078| 194| } 2079| | 2080| 261| if (converted == 0) { ------------------ | Branch (2080:6): [True: 194, False: 67] ------------------ 2081| 194| lxc_conf->cgroup_meta.relative = false; 2082| 194| return 0; 2083| 194| } 2084| | 2085| 67| return ret_errno(EINVAL); ------------------ | | 715| 67| ({ \ | | 716| 67| errno = labs(__errno__); \ | | 717| 67| -errno; \ | | 718| 67| }) ------------------ 2086| 261|} confile.c:clr_config_cgroup_relative: 4974| 194|{ 4975| | lxc_conf->cgroup_meta.relative = false; 4976| 194| return 0; 4977| 194|} confile.c:set_config_console_buffer_size: 2590| 1.06k|{ 2591| 1.06k| int ret; 2592| 1.06k| long long int size; 2593| 1.06k| uint64_t buffer_size, pgsz; 2594| | 2595| 1.06k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2595:6): [True: 194, False: 874] ------------------ 2596| 194| lxc_conf->console.buffer_size = 0; 2597| 194| return 0; 2598| 194| } 2599| | 2600| | /* If the user specified "auto" the default log size is 2^17 = 128 Kib */ 2601| 874| if (strequal(value, "auto")) { ------------------ | Branch (2601:6): [True: 194, False: 680] ------------------ 2602| 194| lxc_conf->console.buffer_size = 1 << 17; 2603| 194| return 0; 2604| 194| } 2605| | 2606| 680| ret = parse_byte_size_string(value, &size); 2607| 680| if (ret) ------------------ | Branch (2607:6): [True: 29, False: 651] ------------------ 2608| 29| return ret; 2609| | 2610| 651| if (size < 0) ------------------ | Branch (2610:6): [True: 72, False: 579] ------------------ 2611| 72| return ret_errno(EINVAL); ------------------ | | 715| 72| ({ \ | | 716| 72| errno = labs(__errno__); \ | | 717| 72| -errno; \ | | 718| 72| }) ------------------ 2612| | 2613| | /* must be at least a page size */ 2614| 579| pgsz = lxc_getpagesize(); 2615| 579| if ((uint64_t)size < pgsz) { ------------------ | Branch (2615:6): [True: 205, False: 374] ------------------ 2616| 205| NOTICE("Requested ringbuffer size for the console is %lld but must be at least %" PRId64 " bytes. Setting ringbuffer size to %" PRId64 " bytes", ------------------ | | 362| 205|#define NOTICE(format, ...) do { \ | | 363| 205| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 205| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 205| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 205|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 205] | | ------------------ ------------------ 2617| 205| size, pgsz, pgsz); 2618| 205| size = pgsz; 2619| 205| } 2620| | 2621| 579| buffer_size = lxc_find_next_power2((uint64_t)size); 2622| 579| if (buffer_size == 0) ------------------ | Branch (2622:6): [True: 0, False: 579] ------------------ 2623| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2624| | 2625| 579| if (buffer_size != (uint64_t)size) ------------------ | Branch (2625:6): [True: 365, False: 214] ------------------ 2626| 365| NOTICE("Passed size was not a power of 2. Rounding log size to next power of two: %" PRIu64 " bytes", buffer_size); ------------------ | | 362| 365|#define NOTICE(format, ...) do { \ | | 363| 365| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 365| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 365| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 365|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 365] | | ------------------ ------------------ 2627| | 2628| 579| lxc_conf->console.buffer_size = buffer_size; 2629| | 2630| 579| return 0; 2631| 579|} confile.c:set_config_console_logfile: 2584| 194|{ 2585| 194| return set_config_path_item(&lxc_conf->console.log_path, value); 2586| 194|} confile.c:set_config_console_path: 2558| 255|{ 2559| 255| return set_config_path_item(&lxc_conf->console.path, value); 2560| 255|} confile.c:set_config_console_rotate: 2564| 434|{ 2565| 434| int ret; 2566| | 2567| 434| if (lxc_config_value_empty(value)) { ------------------ | Branch (2567:6): [True: 194, False: 240] ------------------ 2568| 194| lxc_conf->console.log_rotate = 0; 2569| 194| return 0; 2570| 194| } 2571| | 2572| 240| ret = lxc_safe_uint(value, &lxc_conf->console.log_rotate); 2573| 240| if (ret) ------------------ | Branch (2573:6): [True: 2, False: 238] ------------------ 2574| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 2575| | 2576| 238| if (lxc_conf->console.log_rotate > 1) ------------------ | Branch (2576:6): [True: 43, False: 195] ------------------ 2577| 43| return log_error_errno(-EINVAL, EINVAL, "The \"lxc.console.rotate\" config key can only be set to 0 or 1"); ------------------ | | 486| 43| ({ \ | | 487| 43| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 43| errno = (__errno__); \ | | 489| 43| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 43| do { \ | | | | 454| 43| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 43| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 43| char *ptr = NULL; \ | | | | | | 317| 43| { \ | | | | | | 318| 43| int __saved_errno = errno; \ | | | | | | 319| 43| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 43| errno = __saved_errno; \ | | | | | | 321| 43| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 43] | | | | | | ------------------ | | | | | | 322| 43| ptr = errno_buf; \ | | | | | | 323| 43| } | | | | ------------------ | | | | 455| 43| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 43|#define ERROR(format, ...) do { \ | | | | | | 373| 43| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 43| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 43| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 43|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 43] | | | | | | ------------------ | | | | ------------------ | | | | 456| 43| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 43] | | | | ------------------ | | ------------------ | | 490| 43| __internal_ret__; \ | | 491| 43| }) ------------------ 2578| | 2579| 195| return 0; 2580| 238|} confile.c:set_config_console_size: 2635| 2.08k|{ 2636| 2.08k| int ret; 2637| 2.08k| long long int size; 2638| 2.08k| uint64_t log_size, pgsz; 2639| | 2640| 2.08k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2640:6): [True: 210, False: 1.87k] ------------------ 2641| 210| lxc_conf->console.log_size = 0; 2642| 210| return 0; 2643| 210| } 2644| | 2645| | /* If the user specified "auto" the default log size is 2^17 = 128 Kib */ 2646| 1.87k| if (strequal(value, "auto")) { ------------------ | Branch (2646:6): [True: 194, False: 1.68k] ------------------ 2647| 194| lxc_conf->console.log_size = 1 << 17; 2648| 194| return 0; 2649| 194| } 2650| | 2651| 1.68k| ret = parse_byte_size_string(value, &size); 2652| 1.68k| if (ret) ------------------ | Branch (2652:6): [True: 163, False: 1.52k] ------------------ 2653| 163| return ret_errno(EINVAL); ------------------ | | 715| 163| ({ \ | | 716| 163| errno = labs(__errno__); \ | | 717| 163| -errno; \ | | 718| 163| }) ------------------ 2654| | 2655| 1.52k| if (size < 0) ------------------ | Branch (2655:6): [True: 124, False: 1.39k] ------------------ 2656| 124| return ret_errno(EINVAL); ------------------ | | 715| 124| ({ \ | | 716| 124| errno = labs(__errno__); \ | | 717| 124| -errno; \ | | 718| 124| }) ------------------ 2657| | 2658| | /* must be at least a page size */ 2659| 1.39k| pgsz = lxc_getpagesize(); 2660| 1.39k| if ((uint64_t)size < pgsz) { ------------------ | Branch (2660:6): [True: 782, False: 616] ------------------ 2661| 782| NOTICE("Requested ringbuffer size for the console is %lld but must be at least %" PRId64 " bytes. Setting ringbuffer size to %" PRId64 " bytes", ------------------ | | 362| 782|#define NOTICE(format, ...) do { \ | | 363| 782| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 782| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 782| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 782|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 782] | | ------------------ ------------------ 2662| 782| size, pgsz, pgsz); 2663| 782| size = pgsz; 2664| 782| } 2665| | 2666| 1.39k| log_size = lxc_find_next_power2((uint64_t)size); 2667| 1.39k| if (log_size == 0) ------------------ | Branch (2667:6): [True: 0, False: 1.39k] ------------------ 2668| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2669| | 2670| 1.39k| if (log_size != (uint64_t)size) ------------------ | Branch (2670:6): [True: 523, False: 875] ------------------ 2671| 523| NOTICE("Passed size was not a power of 2. Rounding log size to next power of two: %" PRIu64 " bytes", log_size); ------------------ | | 362| 523|#define NOTICE(format, ...) do { \ | | 363| 523| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 523| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 364| 523| LXC_NOTICE(&locinfo, format, ##__VA_ARGS__); \ | | 365| 523|} while (0) | | ------------------ | | | Branch (365:10): [Folded, False: 523] | | ------------------ ------------------ 2672| | 2673| 1.39k| lxc_conf->console.log_size = log_size; 2674| | 2675| 1.39k| return 0; 2676| 1.39k|} confile.c:set_config_sched_core: 6747| 649|{ 6748| 649| int ret; 6749| 649| unsigned int nr; 6750| | 6751| 649| if (lxc_config_value_empty(value)) ------------------ | Branch (6751:6): [True: 194, False: 455] ------------------ 6752| 194| return clr_config_sched_core(key, lxc_conf, data); 6753| | 6754| 455| ret = lxc_safe_uint(value, &nr); 6755| 455| if (ret) ------------------ | Branch (6755:6): [True: 2, False: 453] ------------------ 6756| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 6757| | 6758| 453| if (nr != 0 && nr != 1) ------------------ | Branch (6758:6): [True: 259, False: 194] | Branch (6758:17): [True: 65, False: 194] ------------------ 6759| 65| return ret_errno(EINVAL); ------------------ | | 715| 65| ({ \ | | 716| 65| errno = labs(__errno__); \ | | 717| 65| -errno; \ | | 718| 65| }) ------------------ 6760| | 6761| 388| lxc_conf->sched_core = (nr == 1); 6762| 388| return 0; 6763| 453|} confile.c:clr_config_sched_core: 6772| 194|{ 6773| | c->sched_core = false; 6774| 194| return 0; 6775| 194|} confile.c:set_config_environment_runtime: 1636| 194|{ 1637| 194| return set_config_environment_impl(value, &lxc_conf->environment_runtime); 1638| 194|} confile.c:set_config_environment_impl: 1589| 1.76k|{ 1590| 1.76k| __do_free char *dup = NULL, *val = NULL; ------------------ | | 69| 1.76k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.76k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1591| 1.76k| __do_free struct environment_entry *new_env = NULL; ------------------ | | 69| 1.76k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.76k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1592| 1.76k| char *env_val; 1593| | 1594| 1.76k| if (lxc_config_value_empty(value)) ------------------ | Branch (1594:6): [True: 740, False: 1.02k] ------------------ 1595| 740| return lxc_clear_environment(environment); 1596| | 1597| 1.02k| new_env = zalloc(sizeof(struct environment_entry)); ------------------ | | 90| 1.02k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1598| 1.02k| if (!new_env) ------------------ | Branch (1598:6): [True: 0, False: 1.02k] ------------------ 1599| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1600| | 1601| 1.02k| dup = strdup(value); 1602| 1.02k| if (!dup) ------------------ | Branch (1602:6): [True: 0, False: 1.02k] ------------------ 1603| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1604| | 1605| 1.02k| env_val = strchr(dup, '='); 1606| 1.02k| if (!env_val) { ------------------ | Branch (1606:6): [True: 433, False: 590] ------------------ 1607| 433| env_val = getenv(dup); 1608| 590| } else { 1609| 590| *env_val = '\0'; 1610| 590| env_val++; 1611| 590| } 1612| 1.02k| if (!env_val) ------------------ | Branch (1612:6): [True: 5, False: 1.01k] ------------------ 1613| 5| return ret_errno(ENOENT); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 1614| | 1615| 1.01k| val = strdup(env_val); 1616| 1.01k| if (!val) ------------------ | Branch (1616:6): [True: 0, False: 1.01k] ------------------ 1617| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1618| | 1619| 1.01k| new_env->key = move_ptr(dup); ------------------ | | 694| 1.01k| ({ \ | | 695| 1.01k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.01k| (ptr) = NULL; \ | | 697| 1.01k| __internal_ptr__; \ | | 698| 1.01k| }) ------------------ 1620| 1.01k| new_env->val = move_ptr(val); ------------------ | | 694| 1.01k| ({ \ | | 695| 1.01k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.01k| (ptr) = NULL; \ | | 697| 1.01k| __internal_ptr__; \ | | 698| 1.01k| }) ------------------ 1621| | 1622| 1.01k| list_add_tail(&new_env->head, environment); 1623| 1.01k| move_ptr(new_env); ------------------ | | 694| 1.01k| ({ \ | | 695| 1.01k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.01k| (ptr) = NULL; \ | | 697| 1.01k| __internal_ptr__; \ | | 698| 1.01k| }) ------------------ 1624| | 1625| 1.01k| return 0; 1626| 1.01k|} confile.c:set_config_environment_hooks: 1642| 194|{ 1643| 194| return set_config_environment_impl(value, &lxc_conf->environment_hooks); 1644| 194|} confile.c:set_config_environment: 1630| 1.37k|{ 1631| 1.37k| return set_config_environment_impl(value, &lxc_conf->environment); 1632| 1.37k|} confile.c:set_config_ephemeral: 3680| 438|{ 3681| 438| int ret; 3682| | 3683| 438| if (lxc_config_value_empty(value)) { ------------------ | Branch (3683:6): [True: 194, False: 244] ------------------ 3684| 194| lxc_conf->ephemeral = 0; 3685| 194| return 0; 3686| 194| } 3687| | 3688| 244| ret = lxc_safe_uint(value, &lxc_conf->ephemeral); 3689| 244| if (ret < 0) ------------------ | Branch (3689:6): [True: 2, False: 242] ------------------ 3690| 2| return ret; 3691| | 3692| 242| if (lxc_conf->ephemeral > 1) ------------------ | Branch (3692:6): [True: 48, False: 194] ------------------ 3693| 48| return ret_errno(EINVAL); ------------------ | | 715| 48| ({ \ | | 716| 48| errno = labs(__errno__); \ | | 717| 48| -errno; \ | | 718| 48| }) ------------------ 3694| | 3695| 194| return 0; 3696| 242|} confile.c:set_config_execute_cmd: 1258| 194|{ 1259| 194| return set_config_string_item(&lxc_conf->execute_cmd, value); 1260| 194|} confile.c:set_config_group: 1552| 1.25k|{ 1553| 1.25k| __do_free char *groups = NULL; ------------------ | | 69| 1.25k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.25k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1554| 1.25k| char *token; 1555| | 1556| 1.25k| if (lxc_config_value_empty(value)) ------------------ | Branch (1556:6): [True: 406, False: 850] ------------------ 1557| 406| return lxc_clear_groups(lxc_conf); 1558| | 1559| 850| groups = strdup(value); 1560| 850| if (!groups) ------------------ | Branch (1560:6): [True: 0, False: 850] ------------------ 1561| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1562| | 1563| | /* 1564| | * In case several groups are specified in a single line split these 1565| | * groups in a single element for the list. 1566| | */ 1567| 1.09k| lxc_iterate_parts(token, groups, " \t") { ------------------ | | 187| 850| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.94k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 1.09k, False: 850] | | ------------------ | | 189| 1.09k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 1568| 1.09k| __do_free char *val = NULL; ------------------ | | 69| 1.09k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.09k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1569| 1.09k| __do_free struct string_entry *entry = NULL; ------------------ | | 69| 1.09k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.09k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1570| | 1571| 1.09k| entry = zalloc(sizeof(struct string_entry)); ------------------ | | 90| 1.09k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1572| 1.09k| if (!entry) ------------------ | Branch (1572:7): [True: 0, False: 1.09k] ------------------ 1573| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1574| | 1575| 1.09k| val = strdup(token); 1576| 1.09k| if (!val) ------------------ | Branch (1576:7): [True: 0, False: 1.09k] ------------------ 1577| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1578| | 1579| 1.09k| entry->val = move_ptr(val); ------------------ | | 694| 1.09k| ({ \ | | 695| 1.09k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.09k| (ptr) = NULL; \ | | 697| 1.09k| __internal_ptr__; \ | | 698| 1.09k| }) ------------------ 1580| 1.09k| list_add_tail(&entry->head, &lxc_conf->groups); 1581| 1.09k| move_ptr(entry); ------------------ | | 694| 1.09k| ({ \ | | 695| 1.09k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.09k| (ptr) = NULL; \ | | 697| 1.09k| __internal_ptr__; \ | | 698| 1.09k| }) ------------------ 1582| 1.09k| } 1583| | 1584| 850| return 0; 1585| 850|} confile.c:set_config_hooks: 1376| 3.98k|{ 1377| 3.98k| __do_free char *copy = NULL; ------------------ | | 69| 3.98k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 3.98k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1378| | 1379| 3.98k| if (lxc_config_value_empty(value)) ------------------ | Branch (1379:6): [True: 1.64k, False: 2.33k] ------------------ 1380| 1.64k| return lxc_clear_hooks(lxc_conf, key); 1381| | 1382| 2.33k| if (strequal(key + 4, "hook")) ------------------ | Branch (1382:6): [True: 1, False: 2.33k] ------------------ 1383| 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| }) ------------------ 1384| | 1385| 2.33k| copy = strdup(value); 1386| 2.33k| if (!copy) ------------------ | Branch (1386:6): [True: 0, False: 2.33k] ------------------ 1387| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1388| | 1389| 2.33k| if (strequal(key + 9, "pre-start")) ------------------ | Branch (1389:6): [True: 195, False: 2.14k] ------------------ 1390| 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| }) ------------------ 1391| 2.14k| else if (strequal(key + 9, "start-host")) ------------------ | Branch (1391:11): [True: 196, False: 1.94k] ------------------ 1392| 196| return add_hook(lxc_conf, LXCHOOK_START_HOST, move_ptr(copy)); ------------------ | | 694| 196| ({ \ | | 695| 196| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 196| (ptr) = NULL; \ | | 697| 196| __internal_ptr__; \ | | 698| 196| }) ------------------ 1393| 1.94k| else if (strequal(key + 9, "pre-mount")) ------------------ | Branch (1393:11): [True: 195, False: 1.75k] ------------------ 1394| 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| }) ------------------ 1395| 1.75k| else if (strequal(key + 9, "autodev")) ------------------ | Branch (1395:11): [True: 198, False: 1.55k] ------------------ 1396| 198| return add_hook(lxc_conf, LXCHOOK_AUTODEV, move_ptr(copy)); ------------------ | | 694| 198| ({ \ | | 695| 198| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 198| (ptr) = NULL; \ | | 697| 198| __internal_ptr__; \ | | 698| 198| }) ------------------ 1397| 1.55k| else if (strequal(key + 9, "mount")) ------------------ | Branch (1397:11): [True: 230, False: 1.32k] ------------------ 1398| 230| return add_hook(lxc_conf, LXCHOOK_MOUNT, move_ptr(copy)); ------------------ | | 694| 230| ({ \ | | 695| 230| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 230| (ptr) = NULL; \ | | 697| 230| __internal_ptr__; \ | | 698| 230| }) ------------------ 1399| 1.32k| else if (strequal(key + 9, "start")) ------------------ | Branch (1399:11): [True: 272, False: 1.05k] ------------------ 1400| 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| }) ------------------ 1401| 1.05k| else if (strequal(key + 9, "stop")) ------------------ | Branch (1401:11): [True: 387, False: 664] ------------------ 1402| 387| return add_hook(lxc_conf, LXCHOOK_STOP, move_ptr(copy)); ------------------ | | 694| 387| ({ \ | | 695| 387| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 387| (ptr) = NULL; \ | | 697| 387| __internal_ptr__; \ | | 698| 387| }) ------------------ 1403| 664| else if (strequal(key + 9, "post-stop")) ------------------ | Branch (1403:11): [True: 195, False: 469] ------------------ 1404| 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| }) ------------------ 1405| 469| else if (strequal(key + 9, "clone")) ------------------ | Branch (1405:11): [True: 207, False: 262] ------------------ 1406| 207| return add_hook(lxc_conf, LXCHOOK_CLONE, move_ptr(copy)); ------------------ | | 694| 207| ({ \ | | 695| 207| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 207| (ptr) = NULL; \ | | 697| 207| __internal_ptr__; \ | | 698| 207| }) ------------------ 1407| 262| else if (strequal(key + 9, "destroy")) ------------------ | Branch (1407:11): [True: 262, False: 0] ------------------ 1408| 262| return add_hook(lxc_conf, LXCHOOK_DESTROY, move_ptr(copy)); ------------------ | | 694| 262| ({ \ | | 695| 262| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 262| (ptr) = NULL; \ | | 697| 262| __internal_ptr__; \ | | 698| 262| }) ------------------ 1409| | 1410| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1411| 2.33k|} confile.c:add_hook: 1180| 2.33k|{ 1181| 2.33k| __do_free char *val = hook; ------------------ | | 69| 2.33k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.33k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1182| 2.33k| __do_free struct string_entry *entry; ------------------ | | 69| 2.33k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.33k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1183| | 1184| 2.33k| entry = zalloc(sizeof(struct string_entry)); ------------------ | | 90| 2.33k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1185| 2.33k| if (!entry) ------------------ | Branch (1185:6): [True: 0, False: 2.33k] ------------------ 1186| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1187| | 1188| 2.33k| entry->val = move_ptr(val); ------------------ | | 694| 2.33k| ({ \ | | 695| 2.33k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.33k| (ptr) = NULL; \ | | 697| 2.33k| __internal_ptr__; \ | | 698| 2.33k| }) ------------------ 1189| 2.33k| list_add_tail(&entry->head, &lxc_conf->hooks[which]); 1190| 2.33k| move_ptr(entry); ------------------ | | 694| 2.33k| ({ \ | | 695| 2.33k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.33k| (ptr) = NULL; \ | | 697| 2.33k| __internal_ptr__; \ | | 698| 2.33k| }) ------------------ 1191| | 1192| 2.33k| return 0; 1193| 2.33k|} confile.c:set_config_hooks_version: 1415| 655|{ 1416| 655| int ret; 1417| 655| unsigned int tmp; 1418| | 1419| 655| if (lxc_config_value_empty(value)) ------------------ | Branch (1419:6): [True: 205, False: 450] ------------------ 1420| 205| return clr_config_hooks_version(key, lxc_conf, NULL); 1421| | 1422| 450| ret = lxc_safe_uint(value, &tmp); 1423| 450| if (ret < 0) ------------------ | Branch (1423:6): [True: 197, False: 253] ------------------ 1424| 197| return -errno; 1425| | 1426| 253| if (tmp > 1) ------------------ | Branch (1426:6): [True: 59, False: 194] ------------------ 1427| 59| return syserror_set(-EINVAL, "Invalid hook version specified. Currently only 0 (legacy) and 1 are supported"); ------------------ | | 568| 59| ({ \ | | 569| 59| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 59| errno = labs(__ret__); \ | | 571| 59| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 59| do { \ | | | | 454| 59| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 59| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 59| char *ptr = NULL; \ | | | | | | 317| 59| { \ | | | | | | 318| 59| int __saved_errno = errno; \ | | | | | | 319| 59| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 59| errno = __saved_errno; \ | | | | | | 321| 59| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 59] | | | | | | ------------------ | | | | | | 322| 59| ptr = errno_buf; \ | | | | | | 323| 59| } | | | | ------------------ | | | | 455| 59| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 59|#define ERROR(format, ...) do { \ | | | | | | 373| 59| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 59| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 59| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 59|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 59] | | | | | | ------------------ | | | | ------------------ | | | | 456| 59| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 59] | | | | ------------------ | | ------------------ | | 572| 59| __internal_ret__; \ | | 573| 59| }) ------------------ 1428| | 1429| 194| lxc_conf->hooks_version = tmp; 1430| | 1431| 194| return 0; 1432| 253|} confile.c:clr_config_hooks_version: 5062| 205|{ 5063| | /* default to legacy hooks version */ 5064| 205| c->hooks_version = 0; 5065| 205| return 0; 5066| 205|} confile.c:set_config_idmaps: 2271| 3.12k|{ 2272| 3.12k| __do_free struct id_map *idmap = NULL; ------------------ | | 69| 3.12k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 3.12k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2273| 3.12k| unsigned long hostid, nsid, range; 2274| 3.12k| char type; 2275| 3.12k| int ret; 2276| | 2277| 3.12k| if (lxc_config_value_empty(value)) ------------------ | Branch (2277:6): [True: 773, False: 2.35k] ------------------ 2278| 773| return lxc_clear_idmaps(lxc_conf); 2279| | 2280| 2.35k| idmap = zalloc(sizeof(*idmap)); ------------------ | | 90| 2.35k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2281| 2.35k| if (!idmap) ------------------ | Branch (2281:6): [True: 0, False: 2.35k] ------------------ 2282| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2283| | 2284| 2.35k| ret = parse_idmaps(value, &type, &nsid, &hostid, &range); 2285| 2.35k| if (ret < 0) ------------------ | Branch (2285:6): [True: 153, False: 2.20k] ------------------ 2286| 153| return log_error_errno(-EINVAL, EINVAL, "Failed to parse id mappings"); ------------------ | | 486| 153| ({ \ | | 487| 153| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 153| errno = (__errno__); \ | | 489| 153| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 153| do { \ | | | | 454| 153| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 153| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 153| char *ptr = NULL; \ | | | | | | 317| 153| { \ | | | | | | 318| 153| int __saved_errno = errno; \ | | | | | | 319| 153| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 153| errno = __saved_errno; \ | | | | | | 321| 153| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 153] | | | | | | ------------------ | | | | | | 322| 153| ptr = errno_buf; \ | | | | | | 323| 153| } | | | | ------------------ | | | | 455| 153| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 153|#define ERROR(format, ...) do { \ | | | | | | 373| 153| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 153| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 153| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 153|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 153] | | | | | | ------------------ | | | | ------------------ | | | | 456| 153| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 153] | | | | ------------------ | | ------------------ | | 490| 153| __internal_ret__; \ | | 491| 153| }) ------------------ 2287| | 2288| 2.20k| INFO("Read uid map: type %c nsid %lu hostid %lu range %lu", type, nsid, hostid, range); ------------------ | | 357| 2.20k|#define INFO(format, ...) do { \ | | 358| 2.20k| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 2.20k| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 359| 2.20k| LXC_INFO(&locinfo, format, ##__VA_ARGS__); \ | | 360| 2.20k|} while (0) | | ------------------ | | | Branch (360:10): [Folded, False: 2.20k] | | ------------------ ------------------ 2289| 2.20k| if (type == 'u') ------------------ | Branch (2289:6): [True: 1.25k, False: 949] ------------------ 2290| 1.25k| idmap->idtype = ID_TYPE_UID; 2291| 949| else if (type == 'g') ------------------ | Branch (2291:11): [True: 949, False: 0] ------------------ 2292| 949| idmap->idtype = ID_TYPE_GID; 2293| 0| else 2294| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2295| | 2296| 2.20k| idmap->hostid = hostid; 2297| 2.20k| idmap->nsid = nsid; 2298| 2.20k| idmap->range = range; 2299| 2.20k| list_add_tail(&idmap->head, &lxc_conf->id_map); 2300| | 2301| 2.20k| if (!lxc_conf->root_nsuid_map && idmap->idtype == ID_TYPE_UID) ------------------ | Branch (2301:6): [True: 1.69k, False: 502] | Branch (2301:35): [True: 755, False: 944] ------------------ 2302| 755| if (idmap->nsid == 0) ------------------ | Branch (2302:7): [True: 399, False: 356] ------------------ 2303| 399| lxc_conf->root_nsuid_map = idmap; 2304| | 2305| 2.20k| if (!lxc_conf->root_nsgid_map && idmap->idtype == ID_TYPE_GID) ------------------ | Branch (2305:6): [True: 1.76k, False: 433] | Branch (2305:35): [True: 516, False: 1.25k] ------------------ 2306| 516| if (idmap->nsid == 0) ------------------ | Branch (2306:7): [True: 227, False: 289] ------------------ 2307| 227| lxc_conf->root_nsgid_map = idmap; 2308| | 2309| 2.20k| move_ptr(idmap); ------------------ | | 694| 2.20k| ({ \ | | 695| 2.20k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.20k| (ptr) = NULL; \ | | 697| 2.20k| __internal_ptr__; \ | | 698| 2.20k| }) ------------------ 2310| | 2311| 2.20k| return 0; 2312| 2.20k|} confile.c:set_config_includefiles: 2782| 1.40k|{ 2783| 1.40k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2783:6): [True: 194, False: 1.20k] ------------------ 2784| 194| clr_config_includefiles(key, lxc_conf, NULL); 2785| 194| return 0; 2786| 194| } 2787| | 2788| 1.20k| if (value[strlen(value)-1] == '/' || lxc_is_dir(value)) ------------------ | Branch (2788:6): [True: 334, False: 872] | Branch (2788:39): [True: 530, False: 342] ------------------ 2789| 864| return do_includedir(value, lxc_conf); 2790| | 2791| 342| return lxc_config_read(value, lxc_conf, true); 2792| 1.20k|} confile.c:do_includedir: 2744| 864|{ 2745| 864| __do_closedir DIR *dir = NULL; ------------------ | | 55| 864|#define __do_closedir call_cleaner(closedir) | | ------------------ | | | | 26| 864| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2746| 864| struct dirent *direntp; 2747| 864| int len, ret; 2748| | 2749| 864| dir = opendir(dirp); 2750| 864| if (!dir) ------------------ | Branch (2750:6): [True: 198, False: 666] ------------------ 2751| 198| return errno == ENOENT ? 0 : -errno; ------------------ | Branch (2751:10): [True: 198, False: 0] ------------------ 2752| | 2753| 55.8k| while ((direntp = readdir(dir))) { ------------------ | Branch (2753:9): [True: 55.2k, False: 663] ------------------ 2754| 55.2k| const char *fnam; 2755| 55.2k| char path[PATH_MAX]; 2756| | 2757| 55.2k| fnam = direntp->d_name; 2758| 55.2k| if (strequal(fnam, ".")) ------------------ | Branch (2758:7): [True: 666, False: 54.5k] ------------------ 2759| 666| continue; 2760| | 2761| 54.5k| if (strequal(fnam, "..")) ------------------ | Branch (2761:7): [True: 666, False: 53.8k] ------------------ 2762| 666| continue; 2763| | 2764| 53.8k| len = strlen(fnam); 2765| 53.8k| if (len < 6 || !strnequal(fnam + len - 5, ".conf", 5)) ------------------ | Branch (2765:7): [True: 17.1k, False: 36.7k] | Branch (2765:18): [True: 29.6k, False: 7.14k] ------------------ 2766| 46.7k| continue; 2767| | 2768| 7.14k| len = strnprintf(path, sizeof(path), "%s/%s", dirp, fnam); ------------------ | | 155| 7.14k| ({ \ | | 156| 7.14k| int __ret_strnprintf; \ | | 157| 7.14k| __ret_strnprintf = snprintf(buf, buf_size, ##__VA_ARGS__); \ | | 158| 7.14k| if (__ret_strnprintf < 0 || (size_t)__ret_strnprintf >= (size_t)buf_size) \ | | ------------------ | | | Branch (158:7): [True: 0, False: 7.14k] | | | Branch (158:31): [True: 3, False: 7.13k] | | ------------------ | | 159| 7.14k| __ret_strnprintf = ret_errno(EIO); \ | | ------------------ | | | | 715| 3| ({ \ | | | | 716| 3| errno = labs(__errno__); \ | | | | 717| 3| -errno; \ | | | | 718| 3| }) | | ------------------ | | 160| 7.14k| __ret_strnprintf; \ | | 161| 7.14k| }) ------------------ 2769| 7.14k| if (len < 0) ------------------ | Branch (2769:7): [True: 3, False: 7.13k] ------------------ 2770| 3| return ret_errno(EIO); ------------------ | | 715| 3| ({ \ | | 716| 3| errno = labs(__errno__); \ | | 717| 3| -errno; \ | | 718| 3| }) ------------------ 2771| | 2772| 7.13k| ret = lxc_config_read(path, lxc_conf, true); 2773| 7.13k| if (ret < 0) ------------------ | Branch (2773:7): [True: 0, False: 7.13k] ------------------ 2774| 0| return ret; 2775| 7.13k| } 2776| | 2777| 663| return 0; 2778| 666|} confile.c:clr_config_includefiles: 5341| 194|{ 5342| 194| return 0; 5343| 194|} confile.c:set_config_init_cmd: 1264| 194|{ 1265| 194| return set_config_string_item(&lxc_conf->init_cmd, value); 1266| 194|} confile.c:set_config_init_gid: 1300| 793|{ 1301| 793| unsigned int init_gid; 1302| | 1303| 793| if (lxc_config_value_empty(value)) { ------------------ | Branch (1303:6): [True: 194, False: 599] ------------------ 1304| 194| lxc_conf->init_gid = 0; 1305| 194| return 0; 1306| 194| } 1307| | 1308| 599| if (lxc_safe_uint(value, &init_gid) < 0) ------------------ | Branch (1308:6): [True: 405, False: 194] ------------------ 1309| 405| return -errno; 1310| | 1311| 194| lxc_conf->init_gid = init_gid; 1312| | 1313| 194| return 0; 1314| 599|} confile.c:set_config_init_groups: 1318| 809|{ 1319| 809| __do_free char *value_dup = NULL; ------------------ | | 69| 809|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 809| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1320| 809| gid_t *init_groups = NULL; 1321| 809| size_t num_groups = 0; 1322| 809| size_t idx; 1323| 809| char *token; 1324| | 1325| 809| if (lxc_config_value_empty(value)) ------------------ | Branch (1325:6): [True: 389, False: 420] ------------------ 1326| 389| return clr_config_init_groups(key, lxc_conf, NULL); 1327| | 1328| 420| value_dup = strdup(value); 1329| 420| if (!value_dup) ------------------ | Branch (1329:6): [True: 0, False: 420] ------------------ 1330| 0| return -ENOMEM; 1331| | 1332| 420| lxc_iterate_parts(token, value_dup, ",") ------------------ | | 187| 420| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 74.5k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 74.1k, False: 420] | | ------------------ | | 189| 74.1k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 1333| 74.1k| num_groups++; 1334| | 1335| 420| if (num_groups == INT_MAX) ------------------ | Branch (1335:6): [True: 0, False: 420] ------------------ 1336| 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| }) ------------------ 1337| | 1338| | /* This means the string wasn't empty and all we found was garbage. */ 1339| 420| if (num_groups == 0) ------------------ | Branch (1339:6): [True: 1, False: 419] ------------------ 1340| 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| }) ------------------ 1341| | 1342| 419| idx = lxc_conf->init_groups.size; 1343| 419| init_groups = realloc(lxc_conf->init_groups.list, sizeof(gid_t) * (idx + num_groups)); 1344| 419| if (!init_groups) ------------------ | Branch (1344:6): [True: 0, False: 419] ------------------ 1345| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1346| | 1347| | /* 1348| | * Once the realloc() succeeded we need to hand control of the memory 1349| | * back to the config otherwise we risk a double-free when 1350| | * lxc_conf_free() is called. 1351| | */ 1352| 419| lxc_conf->init_groups.list = init_groups; 1353| | 1354| | /* Restore duplicated value so we can call lxc_iterate_parts() again. */ 1355| 419| strcpy(value_dup, value); 1356| | 1357| 1.34k| lxc_iterate_parts(token, value_dup, ",") { ------------------ | | 187| 419| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.74k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 1.34k, False: 403] | | ------------------ | | 189| 1.32k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 1358| 1.34k| int ret; 1359| | 1360| 1.34k| gid_t group; 1361| | 1362| 1.34k| ret = lxc_safe_uint(token, &group); 1363| 1.34k| if (ret) ------------------ | Branch (1363:7): [True: 16, False: 1.32k] ------------------ 1364| 16| return log_error_errno(ret, -ret, "Failed to parse group %s", token); ------------------ | | 486| 16| ({ \ | | 487| 16| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 16| errno = (__errno__); \ | | 489| 16| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 16| do { \ | | | | 454| 16| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 16| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 16| char *ptr = NULL; \ | | | | | | 317| 16| { \ | | | | | | 318| 16| int __saved_errno = errno; \ | | | | | | 319| 16| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 16| errno = __saved_errno; \ | | | | | | 321| 16| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 16] | | | | | | ------------------ | | | | | | 322| 16| ptr = errno_buf; \ | | | | | | 323| 16| } | | | | ------------------ | | | | 455| 16| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 16|#define ERROR(format, ...) do { \ | | | | | | 373| 16| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 16| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 16| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 16|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 16] | | | | | | ------------------ | | | | ------------------ | | | | 456| 16| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 16] | | | | ------------------ | | ------------------ | | 490| 16| __internal_ret__; \ | | 491| 16| }) ------------------ 1365| | 1366| 1.32k| init_groups[idx++] = group; 1367| 1.32k| } 1368| | 1369| 403| lxc_conf->init_groups.size += num_groups; 1370| | 1371| 403| return 0; 1372| 419|} confile.c:clr_config_init_groups: 5301| 389|{ 5302| 389| c->init_groups.size = 0; 5303| | free_disarm(c->init_groups.list); ------------------ | | 58| 389| ({ \ | | 59| 389| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 194, False: 195] | | ------------------ | | 60| 194| free(ptr); \ | | 61| 194| ptr = NULL; \ | | 62| 194| } \ | | 63| 389| }) ------------------ 5304| 389| return 0; 5305| 389|} confile.c:set_config_init_uid: 1276| 928|{ 1277| 928| unsigned int init_uid; 1278| | 1279| 928| if (lxc_config_value_empty(value)) { ------------------ | Branch (1279:6): [True: 321, False: 607] ------------------ 1280| 321| lxc_conf->init_uid = 0; 1281| 321| return 0; 1282| 321| } 1283| | 1284| 607| if (lxc_safe_uint(value, &init_uid) < 0) ------------------ | Branch (1284:6): [True: 409, False: 198] ------------------ 1285| 409| return -errno; 1286| | 1287| 198| lxc_conf->init_uid = init_uid; 1288| | 1289| 198| return 0; 1290| 607|} confile.c:set_config_nonroot_keepcaps: 1294| 460|{ 1295| | return set_config_bool_item(&lxc_conf->nonroot_keepcaps, value, false); 1296| 460|} confile.c:set_config_init_cwd: 1270| 234|{ 1271| 234| return set_config_path_item(&lxc_conf->init_cwd, value); 1272| 234|} confile.c:set_config_keyring_session: 1785| 199|{ 1786| | return set_config_bool_item(&lxc_conf->keyring_disable_session, value, false); 1787| 199|} confile.c:set_config_log_file: 1791| 1.73k|{ 1792| 1.73k| int ret; 1793| | 1794| 1.73k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1794:6): [True: 396, False: 1.33k] ------------------ 1795| 396| free_disarm(c->logfile); ------------------ | | 58| 396| ({ \ | | 59| 396| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 202, False: 194] | | ------------------ | | 60| 202| free(ptr); \ | | 61| 202| ptr = NULL; \ | | 62| 202| } \ | | 63| 396| }) ------------------ 1796| 396| return 0; 1797| 396| } 1798| | 1799| | /* 1800| | * Store these values in the lxc_conf, and then try to set for actual 1801| | * current logging. 1802| | */ 1803| 1.33k| ret = set_config_path_item(&c->logfile, value); 1804| 1.33k| if (ret == 0) ------------------ | Branch (1804:6): [True: 1.32k, False: 6] ------------------ 1805| 1.32k| ret = lxc_log_set_file(&c->logfd, c->logfile); 1806| | 1807| 1.33k| return ret; 1808| 1.73k|} confile.c:set_config_log_level: 1812| 2.75k|{ 1813| 2.75k| int newlevel; 1814| | 1815| 2.75k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1815:6): [True: 194, False: 2.56k] ------------------ 1816| 194| lxc_conf->loglevel = LXC_LOG_LEVEL_NOTSET; 1817| 194| return 0; 1818| 194| } 1819| | 1820| 2.56k| if (value[0] >= '0' && value[0] <= '9') { ------------------ | Branch (1820:6): [True: 2.52k, False: 45] | Branch (1820:25): [True: 277, False: 2.24k] ------------------ 1821| 277| int ret; 1822| | 1823| 277| ret = lxc_safe_int(value, &newlevel); 1824| 277| if (ret) ------------------ | Branch (1824:7): [True: 10, False: 267] ------------------ 1825| 10| return ret_errno(EINVAL); ------------------ | | 715| 10| ({ \ | | 716| 10| errno = labs(__errno__); \ | | 717| 10| -errno; \ | | 718| 10| }) ------------------ 1826| 2.28k| } else { 1827| 2.28k| newlevel = lxc_log_priority_to_int(value); 1828| 2.28k| } 1829| | 1830| | /* 1831| | * Store these values in the lxc_conf, and then try to set for actual 1832| | * current logging. 1833| | */ 1834| 2.55k| lxc_conf->loglevel = newlevel; 1835| | 1836| 2.55k| return lxc_log_set_level(&lxc_conf->loglevel, newlevel); 1837| 2.56k|} confile.c:set_config_log_syslog: 3700| 2.43k|{ 3701| 2.43k| int facility; 3702| | 3703| 2.43k| if (lxc_conf->syslog) ------------------ | Branch (3703:6): [True: 2.01k, False: 416] ------------------ 3704| 2.01k| free_disarm(lxc_conf->syslog); ------------------ | | 58| 2.01k| ({ \ | | 59| 2.01k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 2.01k, False: 0] | | ------------------ | | 60| 2.01k| free(ptr); \ | | 61| 2.01k| ptr = NULL; \ | | 62| 2.01k| } \ | | 63| 2.01k| }) ------------------ 3705| | 3706| 2.43k| if (lxc_config_value_empty(value)) ------------------ | Branch (3706:6): [True: 203, False: 2.22k] ------------------ 3707| 203| return 0; 3708| | 3709| 2.22k| facility = lxc_syslog_priority_to_int(value); 3710| 2.22k| if (facility == -EINVAL) ------------------ | Branch (3710:6): [True: 138, False: 2.08k] ------------------ 3711| 138| return ret_errno(EINVAL); ------------------ | | 715| 138| ({ \ | | 716| 138| errno = labs(__errno__); \ | | 717| 138| -errno; \ | | 718| 138| }) ------------------ 3712| | 3713| 2.08k| lxc_log_syslog(facility); 3714| | 3715| 2.08k| return set_config_string_item(&lxc_conf->syslog, value); 3716| 2.22k|} confile.c:set_config_monitor: 1516| 388|{ 1517| 388| if (lxc_config_value_empty(value)) { ------------------ | Branch (1517:6): [True: 194, False: 194] ------------------ 1518| 194| lxc_conf->monitor_unshare = 0; 1519| 194| return 0; 1520| 194| } 1521| | 1522| 194| if (strequal(key + 12, "unshare")) ------------------ | Branch (1522:6): [True: 194, False: 0] ------------------ 1523| 194| return lxc_safe_uint(value, &lxc_conf->monitor_unshare); 1524| | 1525| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1526| 194|} confile.c:set_config_monitor_signal_pdeath: 1530| 434|{ 1531| 434| if (lxc_config_value_empty(value)) { ------------------ | Branch (1531:6): [True: 194, False: 240] ------------------ 1532| 194| lxc_conf->monitor_signal_pdeath = 0; 1533| 194| return 0; 1534| 194| } 1535| | 1536| 240| if (strequal(key + 12, "signal.pdeath")) { ------------------ | Branch (1536:6): [True: 240, False: 0] ------------------ 1537| 240| int sig_n; 1538| | 1539| 240| sig_n = sig_parse(value); 1540| 240| if (sig_n < 0) ------------------ | Branch (1540:7): [True: 30, False: 210] ------------------ 1541| 30| return ret_errno(EINVAL); ------------------ | | 715| 30| ({ \ | | 716| 30| errno = labs(__errno__); \ | | 717| 30| -errno; \ | | 718| 30| }) ------------------ 1542| | 1543| 210| lxc_conf->monitor_signal_pdeath = sig_n; 1544| 210| return 0; 1545| 240| } 1546| | 1547| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1548| 240|} confile.c:set_config_mount_auto: 2327| 832|{ 2328| 832| __do_free char *autos = NULL; ------------------ | | 69| 832|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 832| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2329| 832| char *token; 2330| 832| int i; 2331| 832| static struct { 2332| 832| const char *token; 2333| 832| int mask; 2334| 832| int flag; 2335| 832| } allowed_auto_mounts[] = { 2336| 832| { "proc", LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED }, 2337| 832| { "proc:mixed", LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_MIXED }, 2338| 832| { "proc:rw", LXC_AUTO_PROC_MASK, LXC_AUTO_PROC_RW }, 2339| 832| { "sys", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_MIXED }, 2340| 832| { "sys:ro", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_RO }, 2341| 832| { "sys:mixed", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_MIXED }, 2342| 832| { "sys:rw", LXC_AUTO_SYS_MASK, LXC_AUTO_SYS_RW }, 2343| 832| { "cgroup2", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RW | LXC_AUTO_CGROUP_FORCE }, 2344| 832| { "cgroup2:ro", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RO | LXC_AUTO_CGROUP_FORCE }, 2345| 832| { "cgroup2:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RW | LXC_AUTO_CGROUP_FORCE }, 2346| 832| { "cgroup2:ro:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP2_RO | LXC_AUTO_CGROUP_FORCE }, 2347| 832| { "cgroup", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_NOSPEC }, 2348| 832| { "cgroup:mixed", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_MIXED }, 2349| 832| { "cgroup:ro", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RO }, 2350| 832| { "cgroup:rw", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RW }, 2351| 832| { "cgroup:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_NOSPEC | LXC_AUTO_CGROUP_FORCE }, 2352| 832| { "cgroup:mixed:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_MIXED | LXC_AUTO_CGROUP_FORCE }, 2353| 832| { "cgroup:ro:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RO | LXC_AUTO_CGROUP_FORCE }, 2354| 832| { "cgroup:rw:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_RW | LXC_AUTO_CGROUP_FORCE }, 2355| 832| { "cgroup-full", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_NOSPEC }, 2356| 832| { "cgroup-full:mixed", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_MIXED }, 2357| 832| { "cgroup-full:ro", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RO }, 2358| 832| { "cgroup-full:rw", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RW }, 2359| 832| { "cgroup-full:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_NOSPEC | LXC_AUTO_CGROUP_FORCE }, 2360| 832| { "cgroup-full:mixed:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_MIXED | LXC_AUTO_CGROUP_FORCE }, 2361| 832| { "cgroup-full:ro:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RO | LXC_AUTO_CGROUP_FORCE }, 2362| 832| { "cgroup-full:rw:force", LXC_AUTO_CGROUP_MASK, LXC_AUTO_CGROUP_FULL_RW | LXC_AUTO_CGROUP_FORCE }, 2363| 832| { "shmounts:", LXC_AUTO_SHMOUNTS_MASK, LXC_AUTO_SHMOUNTS }, 2364| | /* 2365| | * For adding anything that is just a single on/off, but has no 2366| | * options: keep mask and flag identical and just define the 2367| | * enum value as an unused bit so far 2368| | */ 2369| 832| { NULL, 0, 0 } 2370| 832| }; 2371| | 2372| 832| if (lxc_config_value_empty(value)) { ------------------ | Branch (2372:6): [True: 194, False: 638] ------------------ 2373| 194| lxc_conf->auto_mounts = 0; 2374| 194| return 0; 2375| 194| } 2376| | 2377| 638| autos = strdup(value); 2378| 638| if (!autos) ------------------ | Branch (2378:6): [True: 0, False: 638] ------------------ 2379| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2380| | 2381| 1.19k| lxc_iterate_parts(token, autos, " \t") { ------------------ | | 187| 638| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.65k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 1.19k, False: 457] | | ------------------ | | 189| 1.01k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2382| 1.19k| bool is_shmounts = false; 2383| | 2384| 25.1k| for (i = 0; allowed_auto_mounts[i].token; i++) { ------------------ | Branch (2384:15): [True: 25.0k, False: 181] ------------------ 2385| 25.0k| if (strequal(allowed_auto_mounts[i].token, token)) ------------------ | Branch (2385:8): [True: 353, False: 24.6k] ------------------ 2386| 353| break; 2387| | 2388| 24.6k| if (strequal("shmounts:", allowed_auto_mounts[i].token) && ------------------ | Branch (2388:8): [True: 846, False: 23.8k] ------------------ 2389| 846| strnequal("shmounts:", token, STRLITERALLEN("shmounts:"))) { ------------------ | | 687| 846|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2389:8): [True: 665, False: 181] ------------------ 2390| 665| is_shmounts = true; 2391| 665| break; 2392| 665| } 2393| 24.6k| } 2394| | 2395| 1.19k| if (!allowed_auto_mounts[i].token) ------------------ | Branch (2395:7): [True: 181, False: 1.01k] ------------------ 2396| 181| return log_error_errno(-EINVAL, EINVAL, "Invalid filesystem to automount \"%s\"", token); ------------------ | | 486| 181| ({ \ | | 487| 181| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 181| errno = (__errno__); \ | | 489| 181| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 181| do { \ | | | | 454| 181| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 181| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 181| char *ptr = NULL; \ | | | | | | 317| 181| { \ | | | | | | 318| 181| int __saved_errno = errno; \ | | | | | | 319| 181| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 181| errno = __saved_errno; \ | | | | | | 321| 181| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 181] | | | | | | ------------------ | | | | | | 322| 181| ptr = errno_buf; \ | | | | | | 323| 181| } | | | | ------------------ | | | | 455| 181| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 181|#define ERROR(format, ...) do { \ | | | | | | 373| 181| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 181| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 181| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 181|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 181] | | | | | | ------------------ | | | | ------------------ | | | | 456| 181| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 181] | | | | ------------------ | | ------------------ | | 490| 181| __internal_ret__; \ | | 491| 181| }) ------------------ 2397| | 2398| 1.01k| lxc_conf->auto_mounts &= ~allowed_auto_mounts[i].mask; 2399| 1.01k| lxc_conf->auto_mounts |= allowed_auto_mounts[i].flag; 2400| | 2401| 1.01k| if (is_shmounts) { ------------------ | Branch (2401:7): [True: 665, False: 353] ------------------ 2402| 665| __do_free char *container_path = NULL, *host_path = NULL; ------------------ | | 69| 665|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 665| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2403| 665| char *val; 2404| | 2405| 665| val = token + STRLITERALLEN("shmounts:"); ------------------ | | 687| 665|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2406| 665| if (*val == '\0') ------------------ | Branch (2406:8): [True: 0, False: 665] ------------------ 2407| 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| }) ------------------ 2408| | 2409| 665| host_path = strdup(val); 2410| 665| if (!host_path) ------------------ | Branch (2410:8): [True: 0, False: 665] ------------------ 2411| 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| }) ------------------ 2412| | 2413| 665| val = strchr(host_path, ':'); 2414| 665| if (!val || *(val + 1) == '\0') ------------------ | Branch (2414:8): [True: 258, False: 407] | Branch (2414:16): [True: 203, False: 204] ------------------ 2415| 461| val = "/dev/.lxc-mounts"; 2416| 204| else 2417| 204| *val++ = '\0'; 2418| | 2419| 665| container_path = strdup(val); 2420| 665| if(!container_path) ------------------ | Branch (2420:7): [True: 0, False: 665] ------------------ 2421| 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| }) ------------------ 2422| | 2423| 665| free_disarm(lxc_conf->shmount.path_host); ------------------ | | 58| 665| ({ \ | | 59| 665| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 624, False: 41] | | ------------------ | | 60| 624| free(ptr); \ | | 61| 624| ptr = NULL; \ | | 62| 624| } \ | | 63| 665| }) ------------------ 2424| 665| lxc_conf->shmount.path_host = move_ptr(host_path); ------------------ | | 694| 665| ({ \ | | 695| 665| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 665| (ptr) = NULL; \ | | 697| 665| __internal_ptr__; \ | | 698| 665| }) ------------------ 2425| | 2426| 665| free_disarm(lxc_conf->shmount.path_cont); ------------------ | | 58| 665| ({ \ | | 59| 665| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 624, False: 41] | | ------------------ | | 60| 624| free(ptr); \ | | 61| 624| ptr = NULL; \ | | 62| 624| } \ | | 63| 665| }) ------------------ 2427| 665| lxc_conf->shmount.path_cont = move_ptr(container_path); ------------------ | | 694| 665| ({ \ | | 695| 665| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 665| (ptr) = NULL; \ | | 697| 665| __internal_ptr__; \ | | 698| 665| }) ------------------ 2428| 665| } 2429| 1.01k| } 2430| | 2431| 457| return 0; 2432| 638|} confile.c:set_config_mount_fstab: 2316| 267|{ 2317| 267| if (lxc_config_value_empty(value)) { ------------------ | Branch (2317:6): [True: 7, False: 260] ------------------ 2318| 7| clr_config_mount_fstab(key, lxc_conf, NULL); 2319| 7| return ret_errno(EINVAL); ------------------ | | 715| 7| ({ \ | | 716| 7| errno = labs(__errno__); \ | | 717| 7| -errno; \ | | 718| 7| }) ------------------ 2320| 7| } 2321| | 2322| 260| return set_config_path_item(&lxc_conf->fstab, value); 2323| 267|} confile.c:clr_config_mount_fstab: 5013| 7|{ 5014| | free_disarm(c->fstab); ------------------ | | 58| 7| ({ \ | | 59| 7| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 6, False: 1] | | ------------------ | | 60| 6| free(ptr); \ | | 61| 6| ptr = NULL; \ | | 62| 6| } \ | | 63| 7| }) ------------------ 5015| 7| return 0; 5016| 7|} confile.c:set_config_namespace_clone: 2908| 742|{ 2909| 742| __do_free char *ns = NULL; ------------------ | | 69| 742|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 742| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2910| 742| char *token; 2911| 742| int cloneflag = 0; 2912| | 2913| 742| if (lxc_config_value_empty(value)) ------------------ | Branch (2913:6): [True: 321, False: 421] ------------------ 2914| 321| return clr_config_namespace_clone(key, lxc_conf, data); 2915| | 2916| 421| if (lxc_conf->ns_keep != 0) ------------------ | Branch (2916:6): [True: 3, False: 418] ------------------ 2917| 3| return log_error_errno(-EINVAL, EINVAL, "Cannot set both \"lxc.namespace.clone\" and \"lxc.namespace.keep\""); ------------------ | | 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| }) ------------------ 2918| | 2919| 418| ns = strdup(value); 2920| 418| if (!ns) ------------------ | Branch (2920:6): [True: 0, False: 418] ------------------ 2921| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2922| | 2923| 580| lxc_iterate_parts(token, ns, " \t") { ------------------ | | 187| 418| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 980| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 580, False: 400] | | ------------------ | | 189| 562| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2924| 580| token += lxc_char_left_gc(token, strlen(token)); 2925| 580| token[lxc_char_right_gc(token, strlen(token))] = '\0'; 2926| 580| cloneflag = lxc_namespace_2_cloneflag(token); 2927| 580| if (cloneflag < 0) ------------------ | Branch (2927:7): [True: 18, False: 562] ------------------ 2928| 18| return ret_errno(EINVAL); ------------------ | | 715| 18| ({ \ | | 716| 18| errno = labs(__errno__); \ | | 717| 18| -errno; \ | | 718| 18| }) ------------------ 2929| 562| lxc_conf->ns_clone |= cloneflag; 2930| 562| } 2931| | 2932| 400| return 0; 2933| 418|} confile.c:clr_config_namespace_clone: 5347| 321|{ 5348| 321| lxc_conf->ns_clone = 0; 5349| 321| return 0; 5350| 321|} confile.c:set_config_namespace_keep: 2937| 684|{ 2938| 684| __do_free char *ns = NULL; ------------------ | | 69| 684|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 684| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2939| 684| char *token; 2940| 684| int cloneflag = 0; 2941| | 2942| 684| if (lxc_config_value_empty(value)) ------------------ | Branch (2942:6): [True: 219, False: 465] ------------------ 2943| 219| return clr_config_namespace_keep(key, lxc_conf, data); 2944| | 2945| 465| if (lxc_conf->ns_clone != 0) ------------------ | Branch (2945:6): [True: 3, False: 462] ------------------ 2946| 3| return log_error_errno(-EINVAL, EINVAL, "Cannot set both \"lxc.namespace.clone\" and \"lxc.namespace.keep\""); ------------------ | | 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| }) ------------------ 2947| | 2948| 462| ns = strdup(value); 2949| 462| if (!ns) ------------------ | Branch (2949:6): [True: 0, False: 462] ------------------ 2950| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2951| | 2952| 826| lxc_iterate_parts(token, ns, " \t") { ------------------ | | 187| 462| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 1.23k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 826, False: 404] | | ------------------ | | 189| 768| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 2953| 826| token += lxc_char_left_gc(token, strlen(token)); 2954| 826| token[lxc_char_right_gc(token, strlen(token))] = '\0'; 2955| 826| cloneflag = lxc_namespace_2_cloneflag(token); 2956| 826| if (cloneflag < 0) ------------------ | Branch (2956:7): [True: 58, False: 768] ------------------ 2957| 58| return ret_errno(EINVAL); ------------------ | | 715| 58| ({ \ | | 716| 58| errno = labs(__errno__); \ | | 717| 58| -errno; \ | | 718| 58| }) ------------------ 2958| 768| lxc_conf->ns_keep |= cloneflag; 2959| 768| } 2960| | 2961| 404| return 0; 2962| 462|} confile.c:clr_config_namespace_keep: 5354| 219|{ 5355| 219| lxc_conf->ns_keep = 0; 5356| 219| return 0; 5357| 219|} confile.c:set_config_namespace_share: 3044| 555|{ 3045| 555| int ns_idx; 3046| 555| const char *namespace; 3047| | 3048| 555| if (lxc_config_value_empty(value)) ------------------ | Branch (3048:6): [True: 294, False: 261] ------------------ 3049| 294| return clr_config_namespace_share(key, lxc_conf, data); 3050| | 3051| 261| namespace = key + STRLITERALLEN("lxc.namespace.share."); ------------------ | | 687| 261|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 3052| 261| if (is_empty_string(namespace)) ------------------ | Branch (3052:6): [True: 1, False: 260] ------------------ 3053| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 3054| | 3055| 260| ns_idx = lxc_namespace_2_ns_idx(namespace); 3056| 260| if (ns_idx < 0) ------------------ | Branch (3056:6): [True: 1, False: 259] ------------------ 3057| 1| return ns_idx; 3058| | 3059| 259| return set_config_string_item(&lxc_conf->ns_share[ns_idx], value); 3060| 260|} confile.c:clr_config_namespace_share: 5375| 294|{ 5376| 294| int ns_idx; 5377| 294| const char *namespace; 5378| | 5379| 294| namespace = key + STRLITERALLEN("lxc.namespace.share."); ------------------ | | 687| 294|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 5380| 294| if (is_empty_string(namespace)) ------------------ | Branch (5380:6): [True: 4, False: 290] ------------------ 5381| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 5382| | 5383| 290| ns_idx = lxc_namespace_2_ns_idx(namespace); 5384| 290| if (ns_idx < 0) ------------------ | Branch (5384:6): [True: 46, False: 244] ------------------ 5385| 46| return ns_idx; 5386| | 5387| 244| free(lxc_conf->ns_share[ns_idx]); 5388| 244| lxc_conf->ns_share[ns_idx] = NULL; 5389| | 5390| 244| return 0; 5391| 290|} confile.c:set_config_time_offset_boot: 2966| 3.19k|{ 2967| 3.19k| int ret; 2968| 3.19k| char *unit; 2969| 3.19k| int64_t offset = 0; 2970| 3.19k| char buf[STRLITERALLEN("ms") + 1]; 2971| | 2972| 3.19k| if (lxc_config_value_empty(value)) ------------------ | Branch (2972:6): [True: 241, False: 2.95k] ------------------ 2973| 241| return clr_config_time_offset_boot(key, lxc_conf, data); 2974| | 2975| 2.95k| ret = lxc_safe_int64_residual(value, &offset, 10, buf, sizeof(buf)); 2976| 2.95k| if (ret) ------------------ | Branch (2976:6): [True: 30, False: 2.92k] ------------------ 2977| 30| return ret; 2978| | 2979| 2.92k| unit = lxc_trim_whitespace_in_place(buf); 2980| 2.92k| if (strequal(unit, "h")) { ------------------ | Branch (2980:6): [True: 546, False: 2.37k] ------------------ 2981| 546| if (check_mul_overflow(offset, (typeof(offset))3600, &lxc_conf->timens.s_boot)) ------------------ | | 216| 546|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 66, False: 480] | | ------------------ | | 217| 546| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 546|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 546| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 546|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 546| typeof(a) __a = (a); \ | | | | 193| 546| typeof(b) __b = (b); \ | | | | 194| 546| typeof(d) __d = (d); \ | | | | 195| 546| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 546|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 546|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 546|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 546|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 546|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 546| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 546|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 546|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 546|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 546|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 546|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 546|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 546| (void) (&__a == &__b); \ | | | | 198| 546| (void) (&__a == __d); \ | | | | 199| 546| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 546| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 546, False: 0] | | | | | Branch (200:17): [True: 1, False: 545] | | | | | Branch (200:37): [True: 65, False: 480] | | | | ------------------ | | | | 201| 546| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 480] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 546| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 480] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 546|}) | | ------------------ | | 219| 546| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 546|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 546| typeof(a) __a = (a); \ | | | | 122| 546| typeof(b) __b = (b); \ | | | | 123| 546| typeof(d) __d = (d); \ | | | | 124| 546| (void) (&__a == &__b); \ | | | | 125| 546| (void) (&__a == __d); \ | | | | 126| 546| *__d = __a * __b; \ | | | | 127| 546| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 546] | | | | ------------------ | | | | 128| 546| __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| 546| __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: 546] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 546|}) | | ------------------ ------------------ 2982| 66| return ret_errno(EOVERFLOW); ------------------ | | 715| 66| ({ \ | | 716| 66| errno = labs(__errno__); \ | | 717| 66| -errno; \ | | 718| 66| }) ------------------ 2983| 2.37k| } else if (strequal(unit, "m")) { ------------------ | Branch (2983:13): [True: 664, False: 1.71k] ------------------ 2984| 664| if (check_mul_overflow(offset, (typeof(offset))60, &lxc_conf->timens.s_boot)) ------------------ | | 216| 664|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 61, False: 603] | | ------------------ | | 217| 664| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 664|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 664| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 664|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 664| typeof(a) __a = (a); \ | | | | 193| 664| typeof(b) __b = (b); \ | | | | 194| 664| typeof(d) __d = (d); \ | | | | 195| 664| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 664|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 664|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 664|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 664|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 664|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 664| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 664|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 664|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 664|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 664|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 664|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 664|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 664| (void) (&__a == &__b); \ | | | | 198| 664| (void) (&__a == __d); \ | | | | 199| 664| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 664| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 664, False: 0] | | | | | Branch (200:17): [True: 1, False: 663] | | | | | Branch (200:37): [True: 60, False: 603] | | | | ------------------ | | | | 201| 664| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 603] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 664| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 603] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 664|}) | | ------------------ | | 219| 664| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 664|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 664| typeof(a) __a = (a); \ | | | | 122| 664| typeof(b) __b = (b); \ | | | | 123| 664| typeof(d) __d = (d); \ | | | | 124| 664| (void) (&__a == &__b); \ | | | | 125| 664| (void) (&__a == __d); \ | | | | 126| 664| *__d = __a * __b; \ | | | | 127| 664| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 664] | | | | ------------------ | | | | 128| 664| __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| 664| __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: 664] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 664|}) | | ------------------ ------------------ 2985| 61| return ret_errno(EOVERFLOW); ------------------ | | 715| 61| ({ \ | | 716| 61| errno = labs(__errno__); \ | | 717| 61| -errno; \ | | 718| 61| }) ------------------ 2986| 1.71k| } else if (strequal(unit, "s")) { ------------------ | Branch (2986:13): [True: 677, False: 1.03k] ------------------ 2987| 677| lxc_conf->timens.s_boot = offset; 2988| 1.03k| } else if (strequal(unit, "ms")) { ------------------ | Branch (2988:13): [True: 378, False: 657] ------------------ 2989| 378| if (check_mul_overflow(offset, (typeof(offset))1000000, &lxc_conf->timens.ns_boot)) ------------------ | | 216| 378|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 64, False: 314] | | ------------------ | | 217| 378| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 378|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 378| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 378|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 378| typeof(a) __a = (a); \ | | | | 193| 378| typeof(b) __b = (b); \ | | | | 194| 378| typeof(d) __d = (d); \ | | | | 195| 378| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 378|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 378|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 378|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 378|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 378|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 378| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 378|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 378|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 378|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 378|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 378|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 378|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 378| (void) (&__a == &__b); \ | | | | 198| 378| (void) (&__a == __d); \ | | | | 199| 378| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 378| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 378, False: 0] | | | | | Branch (200:17): [True: 1, False: 377] | | | | | Branch (200:37): [True: 63, False: 314] | | | | ------------------ | | | | 201| 378| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 314] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 378| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 314] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 378|}) | | ------------------ | | 219| 378| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 378|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 378| typeof(a) __a = (a); \ | | | | 122| 378| typeof(b) __b = (b); \ | | | | 123| 378| typeof(d) __d = (d); \ | | | | 124| 378| (void) (&__a == &__b); \ | | | | 125| 378| (void) (&__a == __d); \ | | | | 126| 378| *__d = __a * __b; \ | | | | 127| 378| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 378] | | | | ------------------ | | | | 128| 378| __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| 378| __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: 378] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 378|}) | | ------------------ ------------------ 2990| 64| return ret_errno(EOVERFLOW); ------------------ | | 715| 64| ({ \ | | 716| 64| errno = labs(__errno__); \ | | 717| 64| -errno; \ | | 718| 64| }) ------------------ 2991| 657| } else if (strequal(unit, "us")) { ------------------ | Branch (2991:13): [True: 381, False: 276] ------------------ 2992| 381| if (check_mul_overflow(offset, (typeof(offset))1000, &lxc_conf->timens.ns_boot)) ------------------ | | 216| 381|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 65, False: 316] | | ------------------ | | 217| 381| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 381|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 381| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 381|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 381| typeof(a) __a = (a); \ | | | | 193| 381| typeof(b) __b = (b); \ | | | | 194| 381| typeof(d) __d = (d); \ | | | | 195| 381| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 381|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 381|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 381|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 381|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 381|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 381| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 381|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 381|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 381|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 381|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 381|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 381|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 381| (void) (&__a == &__b); \ | | | | 198| 381| (void) (&__a == __d); \ | | | | 199| 381| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 381| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 381, False: 0] | | | | | Branch (200:17): [True: 1, False: 380] | | | | | Branch (200:37): [True: 64, False: 316] | | | | ------------------ | | | | 201| 381| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 316] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 381| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 316] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 381|}) | | ------------------ | | 219| 381| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 381|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 381| typeof(a) __a = (a); \ | | | | 122| 381| typeof(b) __b = (b); \ | | | | 123| 381| typeof(d) __d = (d); \ | | | | 124| 381| (void) (&__a == &__b); \ | | | | 125| 381| (void) (&__a == __d); \ | | | | 126| 381| *__d = __a * __b; \ | | | | 127| 381| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 381] | | | | ------------------ | | | | 128| 381| __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| 381| __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: 381] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 381|}) | | ------------------ ------------------ 2993| 65| return ret_errno(EOVERFLOW); ------------------ | | 715| 65| ({ \ | | 716| 65| errno = labs(__errno__); \ | | 717| 65| -errno; \ | | 718| 65| }) ------------------ 2994| 381| } else if (strequal(unit, "ns")) { ------------------ | Branch (2994:13): [True: 194, False: 82] ------------------ 2995| 194| lxc_conf->timens.ns_boot = offset; 2996| 194| } else { 2997| 82| return ret_errno(EINVAL); ------------------ | | 715| 82| ({ \ | | 716| 82| errno = labs(__errno__); \ | | 717| 82| -errno; \ | | 718| 82| }) ------------------ 2998| 82| } 2999| | 3000| 2.58k| return 0; 3001| 2.92k|} confile.c:clr_config_time_offset_boot: 5360| 241|{ 5361| 241| lxc_conf->timens.s_boot = 0; 5362| 241| lxc_conf->timens.ns_boot = 0; 5363| 241| return 0; 5364| 241|} confile.c:set_config_time_offset_monotonic: 3005| 2.06k|{ 3006| 2.06k| int ret; 3007| 2.06k| char *unit; 3008| 2.06k| int64_t offset = 0; 3009| 2.06k| char buf[STRLITERALLEN("ms") + 1]; 3010| | 3011| 2.06k| if (lxc_config_value_empty(value)) ------------------ | Branch (3011:6): [True: 194, False: 1.86k] ------------------ 3012| 194| return clr_config_time_offset_monotonic(key, lxc_conf, data); 3013| | 3014| 1.86k| ret = lxc_safe_int64_residual(value, &offset, 10, buf, sizeof(buf)); 3015| 1.86k| if (ret) ------------------ | Branch (3015:6): [True: 2, False: 1.86k] ------------------ 3016| 2| return ret; 3017| | 3018| 1.86k| unit = lxc_trim_whitespace_in_place(buf); 3019| 1.86k| if (strequal(unit, "h")) { ------------------ | Branch (3019:6): [True: 359, False: 1.50k] ------------------ 3020| 359| if (check_mul_overflow(offset, (typeof(offset))3600, &lxc_conf->timens.s_monotonic)) ------------------ | | 216| 359|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 65, False: 294] | | ------------------ | | 217| 359| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 359|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 359| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 359|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 359| typeof(a) __a = (a); \ | | | | 193| 359| typeof(b) __b = (b); \ | | | | 194| 359| typeof(d) __d = (d); \ | | | | 195| 359| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 359|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 359|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 359|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 359|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 359|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 359| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 359|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 359|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 359|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 359|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 359|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 359|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 359| (void) (&__a == &__b); \ | | | | 198| 359| (void) (&__a == __d); \ | | | | 199| 359| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 359| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 359, False: 0] | | | | | Branch (200:17): [True: 1, False: 358] | | | | | Branch (200:37): [True: 64, False: 294] | | | | ------------------ | | | | 201| 359| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 294] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 359| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 294] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 359|}) | | ------------------ | | 219| 359| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 359|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 359| typeof(a) __a = (a); \ | | | | 122| 359| typeof(b) __b = (b); \ | | | | 123| 359| typeof(d) __d = (d); \ | | | | 124| 359| (void) (&__a == &__b); \ | | | | 125| 359| (void) (&__a == __d); \ | | | | 126| 359| *__d = __a * __b; \ | | | | 127| 359| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 359] | | | | ------------------ | | | | 128| 359| __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| 359| __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: 359] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 359|}) | | ------------------ ------------------ 3021| 65| return ret_errno(EOVERFLOW); ------------------ | | 715| 65| ({ \ | | 716| 65| errno = labs(__errno__); \ | | 717| 65| -errno; \ | | 718| 65| }) ------------------ 3022| 1.50k| } else if (strequal(unit, "m")) { ------------------ | Branch (3022:13): [True: 389, False: 1.11k] ------------------ 3023| 389| if (check_mul_overflow(offset, (typeof(offset))60, &lxc_conf->timens.s_monotonic)) ------------------ | | 216| 389|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 68, False: 321] | | ------------------ | | 217| 389| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 389|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 389| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 389|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 389| typeof(a) __a = (a); \ | | | | 193| 389| typeof(b) __b = (b); \ | | | | 194| 389| typeof(d) __d = (d); \ | | | | 195| 389| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 389|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 389|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 389|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 389|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 389|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 389| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 389|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 389|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 389|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 389|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 389|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 389|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 389| (void) (&__a == &__b); \ | | | | 198| 389| (void) (&__a == __d); \ | | | | 199| 389| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 389| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 389, False: 0] | | | | | Branch (200:17): [True: 1, False: 388] | | | | | Branch (200:37): [True: 67, False: 321] | | | | ------------------ | | | | 201| 389| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 321] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 389| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 321] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 389|}) | | ------------------ | | 219| 389| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 389|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 389| typeof(a) __a = (a); \ | | | | 122| 389| typeof(b) __b = (b); \ | | | | 123| 389| typeof(d) __d = (d); \ | | | | 124| 389| (void) (&__a == &__b); \ | | | | 125| 389| (void) (&__a == __d); \ | | | | 126| 389| *__d = __a * __b; \ | | | | 127| 389| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 389] | | | | ------------------ | | | | 128| 389| __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| 389| __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: 389] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 389|}) | | ------------------ ------------------ 3024| 68| return ret_errno(EOVERFLOW); ------------------ | | 715| 68| ({ \ | | 716| 68| errno = labs(__errno__); \ | | 717| 68| -errno; \ | | 718| 68| }) ------------------ 3025| 1.11k| } else if (strequal(unit, "s")) { ------------------ | Branch (3025:13): [True: 194, False: 922] ------------------ 3026| 194| lxc_conf->timens.s_monotonic = offset; 3027| 922| } else if (strequal(unit, "ms")) { ------------------ | Branch (3027:13): [True: 382, False: 540] ------------------ 3028| 382| if (check_mul_overflow(offset, (typeof(offset))1000000, &lxc_conf->timens.ns_monotonic)) ------------------ | | 216| 382|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 65, False: 317] | | ------------------ | | 217| 382| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 382|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 382| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 382|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 382| typeof(a) __a = (a); \ | | | | 193| 382| typeof(b) __b = (b); \ | | | | 194| 382| typeof(d) __d = (d); \ | | | | 195| 382| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 382|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 382|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 382|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 382|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 382|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 382| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 382|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 382|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 382|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 382|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 382|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 382|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 382| (void) (&__a == &__b); \ | | | | 198| 382| (void) (&__a == __d); \ | | | | 199| 382| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 382| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 382, False: 0] | | | | | Branch (200:17): [True: 1, False: 381] | | | | | Branch (200:37): [True: 64, False: 317] | | | | ------------------ | | | | 201| 382| (__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| 382| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 317] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 382|}) | | ------------------ | | 219| 382| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 382|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 382| typeof(a) __a = (a); \ | | | | 122| 382| typeof(b) __b = (b); \ | | | | 123| 382| typeof(d) __d = (d); \ | | | | 124| 382| (void) (&__a == &__b); \ | | | | 125| 382| (void) (&__a == __d); \ | | | | 126| 382| *__d = __a * __b; \ | | | | 127| 382| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 382] | | | | ------------------ | | | | 128| 382| __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| 382| __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: 382] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 382|}) | | ------------------ ------------------ 3029| 65| return ret_errno(EOVERFLOW); ------------------ | | 715| 65| ({ \ | | 716| 65| errno = labs(__errno__); \ | | 717| 65| -errno; \ | | 718| 65| }) ------------------ 3030| 540| } else if (strequal(unit, "us")) { ------------------ | Branch (3030:13): [True: 317, False: 223] ------------------ 3031| 317| if (check_mul_overflow(offset, (typeof(offset))1000, &lxc_conf->timens.ns_monotonic)) ------------------ | | 216| 317|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 13, False: 304] | | ------------------ | | 217| 317| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 317|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 317| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 317|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 317| typeof(a) __a = (a); \ | | | | 193| 317| typeof(b) __b = (b); \ | | | | 194| 317| typeof(d) __d = (d); \ | | | | 195| 317| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 317|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 317|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 317|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 317|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 317|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 317| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 317|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 317|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 317|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 317|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 317|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 317|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 317| (void) (&__a == &__b); \ | | | | 198| 317| (void) (&__a == __d); \ | | | | 199| 317| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 317| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 317, False: 0] | | | | | Branch (200:17): [True: 1, False: 316] | | | | | Branch (200:37): [True: 12, False: 304] | | | | ------------------ | | | | 201| 317| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 304] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 317| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 304] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 317|}) | | ------------------ | | 219| 317| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 317|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 317| typeof(a) __a = (a); \ | | | | 122| 317| typeof(b) __b = (b); \ | | | | 123| 317| typeof(d) __d = (d); \ | | | | 124| 317| (void) (&__a == &__b); \ | | | | 125| 317| (void) (&__a == __d); \ | | | | 126| 317| *__d = __a * __b; \ | | | | 127| 317| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 317] | | | | ------------------ | | | | 128| 317| __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| 317| __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: 317] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 317|}) | | ------------------ ------------------ 3032| 13| return ret_errno(EOVERFLOW); ------------------ | | 715| 13| ({ \ | | 716| 13| errno = labs(__errno__); \ | | 717| 13| -errno; \ | | 718| 13| }) ------------------ 3033| 317| } else if (strequal(unit, "ns")) { ------------------ | Branch (3033:13): [True: 194, False: 29] ------------------ 3034| 194| lxc_conf->timens.ns_monotonic = offset; 3035| 194| } else { 3036| 29| return ret_errno(EINVAL); ------------------ | | 715| 29| ({ \ | | 716| 29| errno = labs(__errno__); \ | | 717| 29| -errno; \ | | 718| 29| }) ------------------ 3037| 29| } 3038| | 3039| 1.62k| return 0; 3040| 1.86k|} confile.c:clr_config_time_offset_monotonic: 5367| 194|{ 5368| 194| lxc_conf->timens.s_monotonic = 0; 5369| 194| lxc_conf->timens.ns_monotonic = 0; 5370| 194| return 0; 5371| 194|} confile.c:set_config_jump_table_net: 5462| 34.0k|{ 5463| 34.0k| struct config_net_info info = {}; 5464| 34.0k| int ret; 5465| 34.0k| const char *idxstring; 5466| | 5467| 34.0k| idxstring = key + STRLITERALLEN("lxc.net."); ------------------ | | 687| 34.0k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 5468| 34.0k| if (!isdigit(*idxstring)) ------------------ | Branch (5468:6): [True: 80, False: 33.9k] ------------------ 5469| 80| return ret_errno(EINVAL); ------------------ | | 715| 80| ({ \ | | 716| 80| errno = labs(__errno__); \ | | 717| 80| -errno; \ | | 718| 80| }) ------------------ 5470| | 5471| 33.9k| if (lxc_config_value_empty(value)) ------------------ | Branch (5471:6): [True: 11.2k, False: 22.7k] ------------------ 5472| 11.2k| return clr_config_jump_table_net(key, lxc_conf, data); 5473| | 5474| 22.7k| ret = get_network_config_ops(key, lxc_conf, &info, true); 5475| 22.7k| if (ret) ------------------ | Branch (5475:6): [True: 306, False: 22.4k] ------------------ 5476| 306| return ret; 5477| | 5478| 22.4k| return info.ops->set(info.subkey, value, lxc_conf, info.netdev); 5479| 22.7k|} confile.c:clr_config_jump_table_net: 5483| 11.2k|{ 5484| 11.2k| struct config_net_info info = {}; 5485| 11.2k| int ret; 5486| 11.2k| const char *idxstring; 5487| | 5488| 11.2k| idxstring = key + 8; 5489| 11.2k| if (!isdigit(*idxstring)) ------------------ | Branch (5489:6): [True: 0, False: 11.2k] ------------------ 5490| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5491| | 5492| | /* The left conjunct is pretty self-explanatory. The right conjunct 5493| | * checks whether the two pointers are equal. If they are we know that 5494| | * this is not a key that is namespaced any further and so we are 5495| | * supposed to clear the whole network. 5496| | */ 5497| 11.2k| if (isdigit(*idxstring) && (strrchr(key, '.') == (idxstring - 1))) { ------------------ | Branch (5497:6): [True: 11.2k, False: 0] | Branch (5497:29): [True: 795, False: 10.4k] ------------------ 5498| 795| unsigned int rmnetdevidx; 5499| | 5500| 795| ret = lxc_safe_uint(idxstring, &rmnetdevidx); 5501| 795| if (ret < 0) ------------------ | Branch (5501:7): [True: 69, False: 726] ------------------ 5502| 69| return ret; 5503| | 5504| | /* Remove network from network list. */ 5505| 726| lxc_remove_nic_by_idx(lxc_conf, rmnetdevidx); 5506| 726| return 0; 5507| 795| } 5508| | 5509| 10.4k| ret = get_network_config_ops(key, lxc_conf, &info, false); 5510| 10.4k| if (ret) ------------------ | Branch (5510:6): [True: 73, False: 10.3k] ------------------ 5511| 73| return ret; 5512| | 5513| 10.3k| return info.ops->clr(info.subkey, lxc_conf, info.netdev); 5514| 10.4k|} confile.c:set_config_net: 404| 1.58k|{ 405| 1.58k| if (!lxc_config_value_empty(value)) ------------------ | Branch (405:6): [True: 9, False: 1.57k] ------------------ 406| 9| return syserror_set(-EINVAL, "lxc.net must not have a value"); ------------------ | | 568| 9| ({ \ | | 569| 9| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 9| errno = labs(__ret__); \ | | 571| 9| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 9| do { \ | | | | 454| 9| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 9| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 9| char *ptr = NULL; \ | | | | | | 317| 9| { \ | | | | | | 318| 9| int __saved_errno = errno; \ | | | | | | 319| 9| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 9| errno = __saved_errno; \ | | | | | | 321| 9| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 9] | | | | | | ------------------ | | | | | | 322| 9| ptr = errno_buf; \ | | | | | | 323| 9| } | | | | ------------------ | | | | 455| 9| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 9|#define ERROR(format, ...) do { \ | | | | | | 373| 9| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 9| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 9| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 9|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 9] | | | | | | ------------------ | | | | ------------------ | | | | 456| 9| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 9] | | | | ------------------ | | ------------------ | | 572| 9| __internal_ret__; \ | | 573| 9| }) ------------------ 407| | 408| 1.57k| return clr_config_net(key, lxc_conf, data); 409| 1.58k|} confile.c:clr_config_net: 5070| 1.57k|{ 5071| 1.57k| lxc_free_networks(c); 5072| | 5073| 1.57k| return 0; 5074| 1.57k|} confile.c:set_config_no_new_privs: 3720| 440|{ 3721| 440| int ret; 3722| 440| unsigned int v; 3723| | 3724| 440| if (lxc_config_value_empty(value)) { ------------------ | Branch (3724:6): [True: 194, False: 246] ------------------ 3725| 194| lxc_conf->no_new_privs = false; 3726| 194| return 0; 3727| 194| } 3728| | 3729| 246| ret = lxc_safe_uint(value, &v); 3730| 246| if (ret < 0) ------------------ | Branch (3730:6): [True: 2, False: 244] ------------------ 3731| 2| return ret; 3732| | 3733| 244| if (v > 1) ------------------ | Branch (3733:6): [True: 49, False: 195] ------------------ 3734| 49| return ret_errno(EINVAL); ------------------ | | 715| 49| ({ \ | | 716| 49| errno = labs(__errno__); \ | | 717| 49| -errno; \ | | 718| 49| }) ------------------ 3735| | 3736| 195| lxc_conf->no_new_privs = v ? true : false; ------------------ | Branch (3736:27): [True: 13, False: 182] ------------------ 3737| | 3738| 195| return 0; 3739| 244|} confile.c:set_config_prlimit: 2110| 3.22k|{ 2111| 3.22k| call_cleaner(free_lxc_limit) struct lxc_limit *new_lim = NULL; ------------------ | | 26| 3.22k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 2112| 3.22k| struct rlimit limit; 2113| 3.22k| rlim_t limit_value; 2114| 3.22k| struct lxc_limit *lim; 2115| | 2116| 3.22k| if (lxc_config_value_empty(value)) ------------------ | Branch (2116:6): [True: 1.06k, False: 2.16k] ------------------ 2117| 1.06k| return lxc_clear_limits(lxc_conf, key); 2118| | 2119| 2.16k| if (!strnequal(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit."))) ------------------ | | 687| 2.16k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2119:6): [True: 9, False: 2.15k] ------------------ 2120| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 2121| | 2122| 2.15k| key += STRLITERALLEN("lxc.prlimit."); ------------------ | | 687| 2.15k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2123| | 2124| | /* soft limit comes first in the value */ 2125| 2.15k| if (!parse_limit_value(&value, &limit_value)) ------------------ | Branch (2125:6): [True: 1, False: 2.15k] ------------------ 2126| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2127| | 2128| 2.15k| limit.rlim_cur = limit_value; 2129| | 2130| | /* skip spaces and a colon */ 2131| 2.15k| while (isspace(*value)) ------------------ | Branch (2131:9): [True: 960, False: 2.15k] ------------------ 2132| 960| ++value; 2133| | 2134| 2.15k| if (*value == ':') ------------------ | Branch (2134:6): [True: 1.03k, False: 1.11k] ------------------ 2135| 1.03k| ++value; 2136| 1.11k| else if (*value) /* any other character is an error here */ ------------------ | Branch (2136:11): [True: 86, False: 1.02k] ------------------ 2137| 86| return ret_errno(EINVAL); ------------------ | | 715| 86| ({ \ | | 716| 86| errno = labs(__errno__); \ | | 717| 86| -errno; \ | | 718| 86| }) ------------------ 2138| | 2139| 2.06k| while (isspace(*value)) ------------------ | Branch (2139:9): [True: 194, False: 2.06k] ------------------ 2140| 194| ++value; 2141| | 2142| | /* optional hard limit */ 2143| 2.06k| if (*value) { ------------------ | Branch (2143:6): [True: 486, False: 1.57k] ------------------ 2144| 486| if (!parse_limit_value(&value, &limit_value)) ------------------ | Branch (2144:7): [True: 1, False: 485] ------------------ 2145| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2146| | 2147| 485| limit.rlim_max = limit_value; 2148| | 2149| | /* check for trailing garbage */ 2150| 485| while (isspace(*value)) ------------------ | Branch (2150:10): [True: 194, False: 485] ------------------ 2151| 194| ++value; 2152| | 2153| 485| if (*value) ------------------ | Branch (2153:7): [True: 86, False: 399] ------------------ 2154| 86| return ret_errno(EINVAL); ------------------ | | 715| 86| ({ \ | | 716| 86| errno = labs(__errno__); \ | | 717| 86| -errno; \ | | 718| 86| }) ------------------ 2155| 1.57k| } else { 2156| | /* a single value sets both hard and soft limit */ 2157| 1.57k| limit.rlim_max = limit.rlim_cur; 2158| 1.57k| } 2159| | 2160| | /* find existing list element */ 2161| 2.15k| list_for_each_entry(lim, &lxc_conf->limits, head) { ------------------ | | 568| 2.06k| for (pos = list_first_entry(head, typeof(*pos), member); \ | | ------------------ | | | | 462| 2.06k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 2.06k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 2.06k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 2.06k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 2.06k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.97k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.97k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.97k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.97k| do { \ | | | | | | | | | | | | | | | | 286| 1.97k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.97k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 2.06k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 2.06k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 2.06k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 569| 3.04k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 3.04k| (&pos->member == (head)) | | ------------------ | | | Branch (569:7): [True: 2.15k, False: 894] | | ------------------ | | 570| 1.97k| pos = list_next_entry(pos, member)) | | ------------------ | | | | 495| 1.06k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.06k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.06k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.06k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.06k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.06k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.06k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.06k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.06k| do { \ | | | | | | | | | | | | | | | | 286| 1.06k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.06k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.06k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.06k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.06k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 2162| 2.15k| if (!strequal(key, lim->resource)) ------------------ | Branch (2162:7): [True: 1.06k, False: 1.08k] ------------------ 2163| 1.06k| continue; 2164| | 2165| 1.08k| lim->limit = limit; 2166| 1.08k| return 0; 2167| 2.15k| } 2168| | 2169| 894| new_lim = zalloc(sizeof(*new_lim)); ------------------ | | 90| 894|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2170| 894| if (!new_lim) ------------------ | Branch (2170:6): [True: 0, False: 894] ------------------ 2171| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2172| | 2173| 894| new_lim->resource = strdup(key); 2174| 894| if (!new_lim->resource) ------------------ | Branch (2174:6): [True: 0, False: 894] ------------------ 2175| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2176| | 2177| 894| new_lim->limit = limit; 2178| 894| list_add_tail(&new_lim->head, &lxc_conf->limits); 2179| 894| move_ptr(new_lim); ------------------ | | 694| 894| ({ \ | | 695| 894| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 894| (ptr) = NULL; \ | | 697| 894| __internal_ptr__; \ | | 698| 894| }) ------------------ 2180| | 2181| 894| return 0; 2182| 894|} confile.c:parse_limit_value: 2089| 2.63k|{ 2090| 2.63k| char *endptr = NULL; 2091| | 2092| 2.63k| if (strnequal(*value, "unlimited", STRLITERALLEN("unlimited"))) { ------------------ | | 687| 2.63k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2092:6): [True: 388, False: 2.24k] ------------------ 2093| 388| *res = RLIM_INFINITY; 2094| 388| *value += STRLITERALLEN("unlimited"); ------------------ | | 687| 388|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2095| 388| return true; 2096| 388| } 2097| | 2098| 2.63k| errno = 0; 2099| 2.24k| *res = strtoull(*value, &endptr, 10); 2100| 2.24k| if (errno || !endptr) ------------------ | Branch (2100:6): [True: 2, False: 2.24k] | Branch (2100:15): [True: 0, False: 2.24k] ------------------ 2101| 2| return false; 2102| | 2103| 2.24k| *value = endptr; 2104| | 2105| | return true; 2106| 2.24k|} confile.c:set_config_pty_max: 1450| 392|{ 1451| 392| int ret; 1452| 392| unsigned int max = 0; 1453| | 1454| 392| if (lxc_config_value_empty(value)) { ------------------ | Branch (1454:6): [True: 194, False: 198] ------------------ 1455| 194| lxc_conf->pty_max = 0; 1456| 194| return 0; 1457| 194| } 1458| | 1459| 198| ret = lxc_safe_uint(value, &max); 1460| 198| if (ret < 0) ------------------ | Branch (1460:6): [True: 4, False: 194] ------------------ 1461| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 1462| | 1463| 194| lxc_conf->pty_max = max; 1464| | 1465| 194| return 0; 1466| 198|} confile.c:set_config_rootfs_managed: 2835| 323|{ 2836| | return set_config_bool_item(&lxc_conf->rootfs.managed, value, true); 2837| 323|} confile.c:set_config_rootfs_mount: 2841| 195|{ 2842| 195| return set_config_path_item(&lxc_conf->rootfs.mount, value); 2843| 195|} confile.c:set_config_rootfs_options: 2847| 2.09k|{ 2848| 2.09k| __do_free char *dup = NULL, *raw_options = NULL; ------------------ | | 69| 2.09k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.09k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2849| 2.09k| struct lxc_rootfs *rootfs = &lxc_conf->rootfs; 2850| 2.09k| struct lxc_mount_options *mnt_opts = &rootfs->mnt_opts; 2851| 2.09k| int ret; 2852| | 2853| 2.09k| clr_config_rootfs_options(key, lxc_conf, data); 2854| 2.09k| if (lxc_config_value_empty(value)) ------------------ | Branch (2854:6): [True: 245, False: 1.84k] ------------------ 2855| 245| return 0; 2856| | 2857| 1.84k| ret = set_config_string_item(&raw_options, value); 2858| 1.84k| if (ret < 0) ------------------ | Branch (2858:6): [True: 0, False: 1.84k] ------------------ 2859| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2860| | 2861| 1.84k| dup = strdup(value); 2862| 1.84k| if (!dup) ------------------ | Branch (2862:6): [True: 0, False: 1.84k] ------------------ 2863| 0| return -ENOMEM; 2864| | 2865| 1.84k| ret = parse_lxc_mount_attrs(mnt_opts, dup); 2866| 1.84k| if (ret < 0) ------------------ | Branch (2866:6): [True: 108, False: 1.73k] ------------------ 2867| 108| return ret; 2868| | 2869| | /* Make sure we're only valid LXC specific mount options. */ 2870| 1.73k| if (mnt_opts->create_dir || mnt_opts->create_file || ------------------ | Branch (2870:6): [True: 3, False: 1.73k] | Branch (2870:30): [True: 1, False: 1.73k] ------------------ 2871| 1.73k| mnt_opts->optional || mnt_opts->relative) ------------------ | Branch (2871:6): [True: 3, False: 1.73k] | Branch (2871:28): [True: 3, False: 1.72k] ------------------ 2872| 10| return syserror_set(-EINVAL, "Invalid LXC specific mount option for rootfs mount"); ------------------ | | 568| 10| ({ \ | | 569| 10| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 10| errno = labs(__ret__); \ | | 571| 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] | | | | ------------------ | | ------------------ | | 572| 10| __internal_ret__; \ | | 573| 10| }) ------------------ 2873| | 2874| 1.72k| ret = parse_mount_attrs(mnt_opts, dup); 2875| 1.72k| if (ret < 0) ------------------ | Branch (2875:6): [True: 0, False: 1.72k] ------------------ 2876| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2877| | 2878| 1.72k| rootfs->mnt_opts.raw_options = move_ptr(raw_options); ------------------ | | 694| 1.72k| ({ \ | | 695| 1.72k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.72k| (ptr) = NULL; \ | | 697| 1.72k| __internal_ptr__; \ | | 698| 1.72k| }) ------------------ 2879| 1.72k| return 0; 2880| 1.72k|} confile.c:clr_config_rootfs_options: 5041| 2.09k|{ 5042| 2.09k| put_lxc_mount_options(&c->rootfs.mnt_opts); 5043| | 5044| 2.09k| return 0; 5045| 2.09k|} confile.c:set_config_rootfs_path: 2796| 1.53k|{ 2797| 1.53k| __do_free char *dup = NULL; ------------------ | | 69| 1.53k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.53k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2798| 1.53k| int ret; 2799| 1.53k| char *tmp; 2800| 1.53k| const char *container_path; 2801| | 2802| 1.53k| if (lxc_config_value_empty(value)) { ------------------ | Branch (2802:6): [True: 320, False: 1.21k] ------------------ 2803| 320| free(lxc_conf->rootfs.path); 2804| 320| lxc_conf->rootfs.path = NULL; 2805| 320| return 0; 2806| 320| } 2807| | 2808| 1.21k| dup = strdup(value); 2809| 1.21k| if (!dup) ------------------ | Branch (2809:6): [True: 0, False: 1.21k] ------------------ 2810| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2811| | 2812| | /* Split : into and 2813| | * . Set "rootfs.__bdev_type" to and 2814| | * "rootfs.path" to . 2815| | */ 2816| 1.21k| tmp = strchr(dup, ':'); 2817| 1.21k| if (tmp) { ------------------ | Branch (2817:6): [True: 999, False: 212] ------------------ 2818| 999| *tmp = '\0'; 2819| | 2820| 999| ret = set_config_path_item(&lxc_conf->rootfs.__bdev_type, dup); 2821| 999| if (ret < 0) ------------------ | Branch (2821:7): [True: 1, False: 998] ------------------ 2822| 1| return ret_errno(ENOMEM); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2823| | 2824| 998| tmp++; 2825| 998| container_path = tmp; 2826| 998| } else { 2827| 212| container_path = value; 2828| 212| } 2829| | 2830| 1.21k| return set_config_path_item(&lxc_conf->rootfs.path, container_path); 2831| 1.21k|} confile.c:set_config_seccomp_allow_nesting: 1197| 1|{ 1198| |#if HAVE_SECCOMP 1199| | if (lxc_config_value_empty(value)) 1200| | return clr_config_seccomp_allow_nesting(key, lxc_conf, NULL); 1201| | 1202| | if (lxc_safe_uint(value, &lxc_conf->seccomp.allow_nesting) < 0) 1203| | return -errno; 1204| | 1205| | if (lxc_conf->seccomp.allow_nesting > 1) 1206| | return ret_errno(EINVAL); 1207| | 1208| | return 0; 1209| |#else 1210| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1211| 1|#endif 1212| 1|} confile.c:set_config_seccomp_notify_cookie: 1216| 1|{ 1217| |#if HAVE_DECL_SECCOMP_NOTIFY_FD 1218| | return set_config_string_item(&lxc_conf->seccomp.notifier.cookie, value); 1219| |#else 1220| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1221| 1|#endif 1222| 1|} confile.c:set_config_seccomp_notify_proxy: 1226| 1|{ 1227| |#if HAVE_DECL_SECCOMP_NOTIFY_FD 1228| | const char *offset; 1229| | 1230| | if (lxc_config_value_empty(value)) 1231| | return clr_config_seccomp_notify_proxy(key, lxc_conf, NULL); 1232| | 1233| | if (!strnequal(value, "unix:", 5)) 1234| | return ret_errno(EINVAL); 1235| | 1236| | offset = value + 5; 1237| | if (lxc_unix_sockaddr(&lxc_conf->seccomp.notifier.proxy_addr, offset) < 0) 1238| | return -errno; 1239| | 1240| | return 0; 1241| |#else 1242| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1243| 1|#endif 1244| 1|} confile.c:set_config_seccomp_profile: 1248| 1|{ 1249| |#if HAVE_SECCOMP 1250| | return set_config_path_item(&lxc_conf->seccomp.seccomp, value); 1251| |#else 1252| | return ret_errno(ENOSYS); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1253| 1|#endif 1254| 1|} confile.c:set_config_selinux_context_keyring: 1775| 1|{ 1776| |#if HAVE_SELINUX 1777| | return set_config_string_item(&lxc_conf->lsm_se_keyring_context, value); 1778| |#else 1779| | 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| }) ------------------ 1780| 1|#endif 1781| 1|} confile.c:set_config_selinux_context: 1765| 1|{ 1766| |#if HAVE_SELINUX 1767| | return set_config_string_item(&lxc_conf->lsm_se_context, value); 1768| |#else 1769| | 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| }) ------------------ 1770| 1|#endif 1771| 1|} confile.c:set_config_signal_halt: 1875| 502|{ 1876| 502| int sig_n; 1877| | 1878| 502| if (lxc_config_value_empty(value)) { ------------------ | Branch (1878:6): [True: 195, False: 307] ------------------ 1879| 195| lxc_conf->haltsignal = 0; 1880| 195| return 0; 1881| 195| } 1882| | 1883| 307| sig_n = sig_parse(value); 1884| 307| if (sig_n < 0) ------------------ | Branch (1884:6): [True: 94, False: 213] ------------------ 1885| 94| return ret_errno(EINVAL); ------------------ | | 715| 94| ({ \ | | 716| 94| errno = labs(__errno__); \ | | 717| 94| -errno; \ | | 718| 94| }) ------------------ 1886| | 1887| 213| lxc_conf->haltsignal = sig_n; 1888| | 1889| 213| return 0; 1890| 307|} confile.c:set_config_signal_reboot: 1894| 612|{ 1895| 612| int sig_n; 1896| | 1897| 612| if (lxc_config_value_empty(value)) { ------------------ | Branch (1897:6): [True: 203, False: 409] ------------------ 1898| 203| lxc_conf->rebootsignal = 0; 1899| 203| return 0; 1900| 203| } 1901| | 1902| 409| sig_n = sig_parse(value); 1903| 409| if (sig_n < 0) ------------------ | Branch (1903:6): [True: 26, False: 383] ------------------ 1904| 26| return ret_errno(EINVAL); ------------------ | | 715| 26| ({ \ | | 716| 26| errno = labs(__errno__); \ | | 717| 26| -errno; \ | | 718| 26| }) ------------------ 1905| | 1906| 383| lxc_conf->rebootsignal = sig_n; 1907| | 1908| 383| return 0; 1909| 409|} confile.c:set_config_signal_stop: 1913| 1.08k|{ 1914| 1.08k| int sig_n; 1915| | 1916| 1.08k| if (lxc_config_value_empty(value)) { ------------------ | Branch (1916:6): [True: 194, False: 886] ------------------ 1917| 194| lxc_conf->stopsignal = 0; 1918| 194| return 0; 1919| 194| } 1920| | 1921| 886| sig_n = sig_parse(value); 1922| 886| if (sig_n < 0) ------------------ | Branch (1922:6): [True: 187, False: 699] ------------------ 1923| 187| return ret_errno(EINVAL); ------------------ | | 715| 187| ({ \ | | 716| 187| errno = labs(__errno__); \ | | 717| 187| -errno; \ | | 718| 187| }) ------------------ 1924| | 1925| 699| lxc_conf->stopsignal = sig_n; 1926| | 1927| 699| return 0; 1928| 886|} confile.c:set_config_start: 1475| 1.37k|{ 1476| 1.37k| int ret; 1477| 1.37k| bool is_empty; 1478| | 1479| 1.37k| is_empty = lxc_config_value_empty(value); 1480| | 1481| 1.37k| if (*(key + 10) == 'a') { /* lxc.start.auto */ ------------------ | Branch (1481:6): [True: 446, False: 933] ------------------ 1482| 446| if (is_empty) { ------------------ | Branch (1482:7): [True: 194, False: 252] ------------------ 1483| 194| lxc_conf->start_auto = 0; 1484| 194| return 0; 1485| 194| } 1486| | 1487| 252| ret = lxc_safe_uint(value, &lxc_conf->start_auto); 1488| 252| if (ret) ------------------ | Branch (1488:7): [True: 2, False: 250] ------------------ 1489| 2| return ret; 1490| | 1491| 250| if (lxc_conf->start_auto > 1) ------------------ | Branch (1491:7): [True: 55, False: 195] ------------------ 1492| 55| return ret_errno(EINVAL); ------------------ | | 715| 55| ({ \ | | 716| 55| errno = labs(__errno__); \ | | 717| 55| -errno; \ | | 718| 55| }) ------------------ 1493| | 1494| 195| return 0; 1495| 933| } else if (*(key + 10) == 'd') { /* lxc.start.delay */ ------------------ | Branch (1495:13): [True: 438, False: 495] ------------------ 1496| 438| if (is_empty) { ------------------ | Branch (1496:7): [True: 243, False: 195] ------------------ 1497| 243| lxc_conf->start_delay = 0; 1498| 243| return 0; 1499| 243| } 1500| | 1501| 195| return lxc_safe_uint(value, &lxc_conf->start_delay); 1502| 495| } else if (*(key + 10) == 'o') { /* lxc.start.order */ ------------------ | Branch (1502:13): [True: 495, False: 0] ------------------ 1503| 495| if (is_empty) { ------------------ | Branch (1503:7): [True: 194, False: 301] ------------------ 1504| 194| lxc_conf->start_order = 0; 1505| 194| return 0; 1506| 194| } 1507| | 1508| 301| return lxc_safe_int(value, &lxc_conf->start_order); 1509| 495| } 1510| | 1511| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1512| 1.37k|} confile.c:set_config_tty_dir: 1668| 214|{ 1669| 214| return set_config_string_item_max(&lxc_conf->ttys.dir, value, 1670| | NAME_MAX + 1); 1671| 214|} confile.c:set_config_tty_max: 1648| 395|{ 1649| 395| int ret; 1650| 395| unsigned int nbtty = 0; 1651| | 1652| 395| if (lxc_config_value_empty(value)) { ------------------ | Branch (1652:6): [True: 194, False: 201] ------------------ 1653| 194| lxc_conf->ttys.max = 0; 1654| 194| return 0; 1655| 194| } 1656| | 1657| 201| ret = lxc_safe_uint(value, &nbtty); 1658| 201| if (ret < 0) ------------------ | Branch (1658:6): [True: 7, False: 194] ------------------ 1659| 7| return ret; 1660| | 1661| 194| lxc_conf->ttys.max = nbtty; 1662| | 1663| 194| return 0; 1664| 201|} confile.c:set_config_uts_name: 2884| 934|{ 2885| 934| __do_free struct utsname *utsname = NULL; ------------------ | | 69| 934|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 934| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2886| | 2887| 934| if (lxc_config_value_empty(value)) { ------------------ | Branch (2887:6): [True: 516, False: 418] ------------------ 2888| 516| clr_config_uts_name(key, lxc_conf, NULL); 2889| 516| return 0; 2890| 516| } 2891| | 2892| 418| utsname = zalloc(sizeof(*utsname)); ------------------ | | 90| 418|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2893| 418| if (!utsname) ------------------ | Branch (2893:6): [True: 0, False: 418] ------------------ 2894| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2895| | 2896| 418| if (strlen(value) >= sizeof(utsname->nodename)) ------------------ | Branch (2896:6): [True: 10, False: 408] ------------------ 2897| 10| return ret_errno(EINVAL); ------------------ | | 715| 10| ({ \ | | 716| 10| errno = labs(__errno__); \ | | 717| 10| -errno; \ | | 718| 10| }) ------------------ 2898| | 2899| 408| (void)strlcpy(utsname->nodename, value, sizeof(utsname->nodename)); 2900| 408| free(lxc_conf->utsname); 2901| 408| lxc_conf->utsname = move_ptr(utsname); ------------------ | | 694| 408| ({ \ | | 695| 408| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 408| (ptr) = NULL; \ | | 697| 408| __internal_ptr__; \ | | 698| 408| }) ------------------ 2902| | 2903| 408| return 0; 2904| 418|} confile.c:clr_config_uts_name: 5049| 516|{ 5050| | free_disarm(c->utsname); ------------------ | | 58| 516| ({ \ | | 59| 516| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 199, False: 317] | | ------------------ | | 60| 199| free(ptr); \ | | 61| 199| ptr = NULL; \ | | 62| 199| } \ | | 63| 516| }) ------------------ 5051| 516| return 0; 5052| 516|} confile.c:set_config_sysctl: 2186| 2.28k|{ 2187| 2.28k| call_cleaner(free_lxc_sysctl) struct lxc_sysctl *sysctl_elem = NULL; ------------------ | | 26| 2.28k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 2188| 2.28k| struct lxc_sysctl *sysctl, *nsysctl; 2189| | 2190| 2.28k| if (lxc_config_value_empty(value)) ------------------ | Branch (2190:6): [True: 1.16k, False: 1.12k] ------------------ 2191| 1.16k| return clr_config_sysctl(key, lxc_conf, NULL); 2192| | 2193| 1.12k| if (!strnequal(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl."))) ------------------ | | 687| 1.12k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2193:6): [True: 9, False: 1.11k] ------------------ 2194| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 2195| | 2196| 1.11k| key += STRLITERALLEN("lxc.sysctl."); ------------------ | | 687| 1.11k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2197| 1.11k| if (is_empty_string(key)) ------------------ | Branch (2197:6): [True: 2, False: 1.11k] ------------------ 2198| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 2199| | 2200| | /* find existing list element */ 2201| 1.53k| list_for_each_entry_safe(sysctl, nsysctl, &lxc_conf->sysctls, head) { ------------------ | | 655| 1.11k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 1.11k| list_entry((ptr)->next, type, 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.11k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.11k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.11k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.11k| do { \ | | | | | | | | | | | | | | | | 286| 1.11k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.11k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.11k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.11k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.11k| ((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.11k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.11k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.11k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.11k| do { \ | | | | | | | | | | | | | | | | 286| 1.11k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.11k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 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.43k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 2.43k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.53k, False: 908] | | ------------------ | | 658| 1.32k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 1.32k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.32k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.32k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.32k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.32k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.32k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.32k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.32k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.32k| do { \ | | | | | | | | | | | | | | | | 286| 1.32k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.32k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.32k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.32k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.32k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 2202| 1.53k| __do_free char *replace_value = NULL; ------------------ | | 69| 1.53k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.53k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2203| | 2204| 1.53k| if (!strequal(key, sysctl->key)) ------------------ | Branch (2204:7): [True: 1.32k, False: 205] ------------------ 2205| 1.32k| continue; 2206| | 2207| 205| replace_value = strdup(value); 2208| 205| if (!replace_value) ------------------ | Branch (2208:7): [True: 0, False: 205] ------------------ 2209| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2210| | 2211| 205| free(sysctl->value); 2212| 205| sysctl->value = move_ptr(replace_value); ------------------ | | 694| 205| ({ \ | | 695| 205| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 205| (ptr) = NULL; \ | | 697| 205| __internal_ptr__; \ | | 698| 205| }) ------------------ 2213| | 2214| 205| return 0; 2215| 205| } 2216| | 2217| 908| sysctl_elem = zalloc(sizeof(*sysctl_elem)); ------------------ | | 90| 908|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2218| 908| if (!sysctl_elem) ------------------ | Branch (2218:6): [True: 0, False: 908] ------------------ 2219| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2220| | 2221| 908| sysctl_elem->key = strdup(key); 2222| 908| if (!sysctl_elem->key) ------------------ | Branch (2222:6): [True: 0, False: 908] ------------------ 2223| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2224| | 2225| 908| sysctl_elem->value = strdup(value); 2226| 908| if (!sysctl_elem->value) ------------------ | Branch (2226:6): [True: 0, False: 908] ------------------ 2227| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2228| | 2229| 908| list_add_tail(&sysctl_elem->head, &lxc_conf->sysctls); 2230| 908| move_ptr(sysctl_elem); ------------------ | | 694| 908| ({ \ | | 695| 908| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 908| (ptr) = NULL; \ | | 697| 908| __internal_ptr__; \ | | 698| 908| }) ------------------ 2231| | 2232| 908| return 0; 2233| 908|} confile.c:clr_config_sysctl: 5329| 1.16k|{ 5330| 1.16k| return lxc_clear_sysctls(c, key); 5331| 1.16k|} confile.c:set_config_proc: 2237| 1.57k|{ 2238| 1.57k| call_cleaner(free_lxc_proc) struct lxc_proc *new_proc = NULL; ------------------ | | 26| 1.57k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 2239| 1.57k| const char *subkey; 2240| | 2241| 1.57k| if (lxc_config_value_empty(value)) ------------------ | Branch (2241:6): [True: 957, False: 614] ------------------ 2242| 957| return clr_config_proc(key, lxc_conf, NULL); 2243| | 2244| 614| if (!strnequal(key, "lxc.proc.", STRLITERALLEN("lxc.proc."))) ------------------ | | 687| 614|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (2244:6): [True: 9, False: 605] ------------------ 2245| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 2246| | 2247| 605| subkey = key + STRLITERALLEN("lxc.proc."); ------------------ | | 687| 605|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 2248| 605| if (*subkey == '\0') ------------------ | Branch (2248:6): [True: 1, False: 604] ------------------ 2249| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 2250| | 2251| 604| new_proc = zalloc(sizeof(*new_proc)); ------------------ | | 90| 604|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2252| 604| if (!new_proc) ------------------ | Branch (2252:6): [True: 0, False: 604] ------------------ 2253| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2254| | 2255| 604| new_proc->filename = strdup(subkey); 2256| 604| if (!new_proc->filename) ------------------ | Branch (2256:6): [True: 0, False: 604] ------------------ 2257| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2258| | 2259| 604| new_proc->value = strdup(value); 2260| 604| if (!new_proc->value) ------------------ | Branch (2260:6): [True: 0, False: 604] ------------------ 2261| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2262| | 2263| 604| list_add_tail(&new_proc->head, &lxc_conf->procs); 2264| 604| move_ptr(new_proc); ------------------ | | 694| 604| ({ \ | | 695| 604| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 604| (ptr) = NULL; \ | | 697| 604| __internal_ptr__; \ | | 698| 604| }) ------------------ 2265| | 2266| 604| return 0; 2267| 604|} confile.c:clr_config_proc: 5335| 957|{ 5336| 957| return lxc_clear_procs(c, key); 5337| 957|} confile.c:match_config_item: 348| 5.37M|{ 349| 5.37M| size_t len; 350| | 351| 5.37M| if (entry->strict) ------------------ | Branch (351:6): [True: 5.14M, False: 233k] ------------------ 352| 5.14M| return strequal(entry->name, key); 353| | 354| | /* There should be no subkey longer than this. */ 355| 233k| len = strnlen(entry->name, LXC_SUBKEY_LEN_MAX); ------------------ | | 345| 233k|#define LXC_SUBKEY_LEN_MAX 256 ------------------ 356| 233k| if (len == LXC_SUBKEY_LEN_MAX) ------------------ | | 345| 233k|#define LXC_SUBKEY_LEN_MAX 256 ------------------ | Branch (356:6): [True: 0, False: 233k] ------------------ 357| 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| }) ------------------ 358| | 359| 233k| return strnequal(entry->name, key, len); 360| 233k|} confile.c:set_config_unsupported_key: 165| 332|{ 166| | return syserror_set(-EINVAL, "Unsupported config key \"%s\"", key); ------------------ | | 568| 332| ({ \ | | 569| 332| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 332| errno = labs(__ret__); \ | | 571| 332| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 332| do { \ | | | | 454| 332| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 332| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 332| char *ptr = NULL; \ | | | | | | 317| 332| { \ | | | | | | 318| 332| int __saved_errno = errno; \ | | | | | | 319| 332| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 332| errno = __saved_errno; \ | | | | | | 321| 332| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 332] | | | | | | ------------------ | | | | | | 322| 332| ptr = errno_buf; \ | | | | | | 323| 332| } | | | | ------------------ | | | | 455| 332| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 332|#define ERROR(format, ...) do { \ | | | | | | 373| 332| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 332| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 332| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 332|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 332] | | | | | | ------------------ | | | | ------------------ | | | | 456| 332| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 332] | | | | ------------------ | | ------------------ | | 572| 332| __internal_ret__; \ | | 573| 332| }) ------------------ 167| 332|} confile.c:set_config_mount: 2436| 1.31k|{ 2437| 1.31k| __do_free char *mntelem = NULL; ------------------ | | 69| 1.31k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.31k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2438| 1.31k| __do_free struct string_entry *entry = NULL; ------------------ | | 69| 1.31k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.31k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 2439| | 2440| 1.31k| if (lxc_config_value_empty(value)) ------------------ | Branch (2440:6): [True: 528, False: 785] ------------------ 2441| 528| return lxc_clear_mount_entries(lxc_conf); 2442| | 2443| 785| entry = zalloc(sizeof(struct string_entry)); ------------------ | | 90| 785|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 2444| 785| if (!entry) ------------------ | Branch (2444:6): [True: 0, False: 785] ------------------ 2445| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2446| | 2447| 785| mntelem = strdup(value); 2448| 785| if (!mntelem) ------------------ | Branch (2448:6): [True: 0, False: 785] ------------------ 2449| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 2450| | 2451| 785| entry->val = move_ptr(mntelem); ------------------ | | 694| 785| ({ \ | | 695| 785| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 785| (ptr) = NULL; \ | | 697| 785| __internal_ptr__; \ | | 698| 785| }) ------------------ 2452| 785| list_add_tail(&entry->head, &lxc_conf->mount_entries); 2453| 785| move_ptr(entry); ------------------ | | 694| 785| ({ \ | | 695| 785| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 785| (ptr) = NULL; \ | | 697| 785| __internal_ptr__; \ | | 698| 785| }) ------------------ 2454| | 2455| 785| return 0; 2456| 785|} confile.c:update_hwaddr: 2687| 116k|{ 2688| 116k| char *p; 2689| | 2690| 116k| line += lxc_char_left_gc(line, strlen(line)); 2691| 116k| if (line[0] == '#') ------------------ | Branch (2691:6): [True: 230, False: 115k] ------------------ 2692| 230| return; 2693| | 2694| 115k| if (!lxc_config_net_is_hwaddr(line)) ------------------ | Branch (2694:6): [True: 114k, False: 1.52k] ------------------ 2695| 114k| return; 2696| | 2697| | /* Let config_net_hwaddr raise the error. */ 2698| 1.52k| p = strchr(line, '='); 2699| 1.52k| if (!p) ------------------ | Branch (2699:6): [True: 2, False: 1.52k] ------------------ 2700| 2| return; 2701| 1.52k| p++; 2702| | 2703| 1.52k| while (isblank(*p)) ------------------ | Branch (2703:9): [True: 196, False: 1.52k] ------------------ 2704| 196| p++; 2705| | 2706| 1.52k| if (!*p) ------------------ | Branch (2706:6): [True: 411, False: 1.11k] ------------------ 2707| 411| return; 2708| | 2709| 1.11k| rand_complete_hwaddr(p); 2710| 1.11k|} confile.c:parse_line: 3068| 382k|{ 3069| 382k| __do_free char *linep = NULL; ------------------ | | 69| 382k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 382k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 3070| 382k| char *dot, *key, *line, *value; 3071| 382k| bool empty_line; 3072| 382k| struct lxc_config_t *config; 3073| 382k| int ret; 3074| 382k| char *dup = buffer; 3075| 382k| struct parse_line_conf *plc = data; 3076| | 3077| 382k| if (!plc->conf) ------------------ | Branch (3077:6): [True: 0, False: 382k] ------------------ 3078| 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| }) ------------------ 3079| | 3080| | /* If there are newlines in the config file we should keep them. */ 3081| 382k| empty_line = lxc_is_line_empty(dup); 3082| 382k| if (empty_line) ------------------ | Branch (3082:6): [True: 1.03k, False: 381k] ------------------ 3083| 1.03k| dup = "\n"; 3084| | 3085| | /* We have to dup the buffer otherwise, at the re-exec for reboot we 3086| | * modified the original string on the stack by replacing '=' by '\0' 3087| | * below. 3088| | */ 3089| 382k| linep = line = strdup(dup); 3090| 382k| if (!line) ------------------ | Branch (3090:6): [True: 0, False: 382k] ------------------ 3091| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 3092| | 3093| 382k| if (!plc->from_include) { ------------------ | Branch (3093:6): [True: 116k, False: 266k] ------------------ 3094| 116k| ret = append_unexp_config_line(line, plc->conf); 3095| 116k| if (ret < 0) ------------------ | Branch (3095:7): [True: 0, False: 116k] ------------------ 3096| 0| return ret; 3097| 116k| } 3098| | 3099| 382k| if (empty_line) ------------------ | Branch (3099:6): [True: 1.03k, False: 381k] ------------------ 3100| 1.03k| return 0; 3101| | 3102| 381k| line += lxc_char_left_gc(line, strlen(line)); 3103| | 3104| | /* ignore comments */ 3105| 381k| if (line[0] == '#') ------------------ | Branch (3105:6): [True: 167k, False: 213k] ------------------ 3106| 167k| return 0; 3107| | 3108| | /* martian option - don't add it to the config itself */ 3109| 213k| if (!strnequal(line, "lxc.", 4)) ------------------ | Branch (3109:6): [True: 111k, False: 102k] ------------------ 3110| 111k| return 0; 3111| | 3112| 102k| dot = strchr(line, '='); 3113| 102k| if (!dot) ------------------ | Branch (3113:6): [True: 357, False: 101k] ------------------ 3114| 357| return log_error_errno(-EINVAL, EINVAL, "Invalid configuration line: %s", line); ------------------ | | 486| 357| ({ \ | | 487| 357| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 357| errno = (__errno__); \ | | 489| 357| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 357| do { \ | | | | 454| 357| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 357| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 357| char *ptr = NULL; \ | | | | | | 317| 357| { \ | | | | | | 318| 357| int __saved_errno = errno; \ | | | | | | 319| 357| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 357| errno = __saved_errno; \ | | | | | | 321| 357| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 357] | | | | | | ------------------ | | | | | | 322| 357| ptr = errno_buf; \ | | | | | | 323| 357| } | | | | ------------------ | | | | 455| 357| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 357|#define ERROR(format, ...) do { \ | | | | | | 373| 357| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 357| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 357| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 357|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 357] | | | | | | ------------------ | | | | ------------------ | | | | 456| 357| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 357] | | | | ------------------ | | ------------------ | | 490| 357| __internal_ret__; \ | | 491| 357| }) ------------------ 3115| | 3116| 101k| *dot = '\0'; 3117| 101k| value = dot + 1; 3118| | 3119| 101k| key = line; 3120| 101k| key[lxc_char_right_gc(key, strlen(key))] = '\0'; 3121| | 3122| 101k| value += lxc_char_left_gc(value, strlen(value)); 3123| 101k| value[lxc_char_right_gc(value, strlen(value))] = '\0'; 3124| | 3125| 101k| if (*value == '\'' || *value == '\"') { ------------------ | Branch (3125:6): [True: 2.46k, False: 99.5k] | Branch (3125:24): [True: 711, False: 98.8k] ------------------ 3126| 3.18k| size_t len; 3127| | 3128| 3.18k| len = strlen(value); 3129| 3.18k| if (len > 1 && value[len - 1] == *value) { ------------------ | Branch (3129:7): [True: 2.90k, False: 271] | Branch (3129:18): [True: 2.63k, False: 273] ------------------ 3130| 2.63k| value[len - 1] = '\0'; 3131| 2.63k| value++; 3132| 2.63k| } 3133| 3.18k| } 3134| | 3135| 101k| config = lxc_get_config(key); 3136| | return config->set(key, value, plc->conf, NULL); 3137| 102k|} confile.c:get_network_config_ops: 5408| 33.1k|{ 5409| 33.1k| int ret; 5410| 33.1k| int64_t tmpidx; 5411| 33.1k| unsigned int idx; 5412| 33.1k| const char *idx_start; 5413| | 5414| 33.1k| if (is_empty_string(key)) ------------------ | Branch (5414:6): [True: 0, False: 33.1k] ------------------ 5415| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5416| | 5417| | /* check that this is a sensible network key */ 5418| 33.1k| if (!strnequal("lxc.net.", key, STRLITERALLEN("lxc.net."))) ------------------ | | 687| 33.1k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (5418:6): [True: 0, False: 33.1k] ------------------ 5419| 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| }) ------------------ 5420| | 5421| | /* lxc.net. */ 5422| | /* beginning of index string */ 5423| 33.1k| idx_start = key + STRLITERALLEN("lxc.net."); ------------------ | | 687| 33.1k|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 5424| 33.1k| if (!isdigit(*idx_start)) ------------------ | Branch (5424:6): [True: 0, False: 33.1k] ------------------ 5425| 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| }) ------------------ 5426| | 5427| 33.1k| ret = lxc_safe_int64_residual(idx_start, &tmpidx, 10, info->buf, sizeof(info->buf)); 5428| 33.1k| if (ret) ------------------ | Branch (5428:6): [True: 19, False: 33.1k] ------------------ 5429| 19| return syserror("Failed to parse network index"); ------------------ | | 562| 19| ({ \ | | 563| 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] | | | | ------------------ | | ------------------ | | 564| 19| (-labs(errno)); \ | | 565| 19| }) ------------------ 5430| | 5431| 33.1k| if (tmpidx < 0 || tmpidx >= INT_MAX) ------------------ | Branch (5431:6): [True: 0, False: 33.1k] | Branch (5431:20): [True: 64, False: 33.1k] ------------------ 5432| 64| return syserror_set(-ERANGE, "Number of configured networks would overflow the counter"); ------------------ | | 568| 64| ({ \ | | 569| 64| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 64| errno = labs(__ret__); \ | | 571| 64| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 64| do { \ | | | | 454| 64| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 64| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 64| char *ptr = NULL; \ | | | | | | 317| 64| { \ | | | | | | 318| 64| int __saved_errno = errno; \ | | | | | | 319| 64| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 64| errno = __saved_errno; \ | | | | | | 321| 64| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 64] | | | | | | ------------------ | | | | | | 322| 64| ptr = errno_buf; \ | | | | | | 323| 64| } | | | | ------------------ | | | | 455| 64| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 64|#define ERROR(format, ...) do { \ | | | | | | 373| 64| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 64| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 64| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 64|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 64] | | | | | | ------------------ | | | | ------------------ | | | | 456| 64| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 64] | | | | ------------------ | | ------------------ | | 572| 64| __internal_ret__; \ | | 573| 64| }) ------------------ 5433| 33.1k| idx = (unsigned int)tmpidx; 5434| | 5435| 33.1k| info->netdev = lxc_get_netdev_by_idx(lxc_conf, idx, allocate); 5436| 33.1k| if (!info->netdev) ------------------ | Branch (5436:6): [True: 27, False: 33.0k] ------------------ 5437| 27| return ret_errno(EINVAL); ------------------ | | 715| 27| ({ \ | | 716| 27| errno = labs(__errno__); \ | | 717| 27| -errno; \ | | 718| 27| }) ------------------ 5438| | 5439| | /* Make sure subkey points to the empty string. */ 5440| 33.0k| info->subkey = info->buf; 5441| 33.0k| if (is_empty_string(info->subkey)) ------------------ | Branch (5441:6): [True: 107, False: 32.9k] ------------------ 5442| 107| return ret_errno(ENOENT); ------------------ | | 715| 107| ({ \ | | 716| 107| errno = labs(__errno__); \ | | 717| 107| -errno; \ | | 718| 107| }) ------------------ 5443| | 5444| 32.9k| if (info->subkey[0] != '.') ------------------ | Branch (5444:6): [True: 15, False: 32.9k] ------------------ 5445| 15| return syserror_set(-EINVAL, "Invalid subkey"); ------------------ | | 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| }) ------------------ 5446| 32.9k| info->subkey++; 5447| | 5448| | /* lxc.net.. */ 5449| 32.9k| info->ops = lxc_get_config_net(info->subkey); 5450| 32.9k| if (info->ops == &unsupported_config_net_key) ------------------ | Branch (5450:6): [True: 147, False: 32.8k] ------------------ 5451| 147| return syserror_set(-ENOENT, "Unknown network configuration key \"%s\"", key); ------------------ | | 568| 147| ({ \ | | 569| 147| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 147| errno = labs(__ret__); \ | | 571| 147| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 147| do { \ | | | | 454| 147| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 147| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 147| char *ptr = NULL; \ | | | | | | 317| 147| { \ | | | | | | 318| 147| int __saved_errno = errno; \ | | | | | | 319| 147| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 147| errno = __saved_errno; \ | | | | | | 321| 147| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 147] | | | | | | ------------------ | | | | | | 322| 147| ptr = errno_buf; \ | | | | | | 323| 147| } | | | | ------------------ | | | | 455| 147| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 147|#define ERROR(format, ...) do { \ | | | | | | 373| 147| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 147| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 147| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 147|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 147] | | | | | | ------------------ | | | | ------------------ | | | | 456| 147| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 147] | | | | ------------------ | | ------------------ | | 572| 147| __internal_ret__; \ | | 573| 147| }) ------------------ 5452| | 5453| 32.8k| return 0; 5454| 32.9k|} confile.c:lxc_get_config_net: 389| 32.9k|{ 390| 418k| for (size_t i = 0; i < ARRAY_SIZE(config_jump_table_net); i++) { ------------------ | | 728| 418k| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 418k| typeof(&*(x))), \ | | 730| 418k| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (390:21): [True: 417k, False: 147] ------------------ 391| 417k| struct lxc_config_net_t *cur = &config_jump_table_net[i]; 392| | 393| 417k| if (!match_config_net_item(cur, key)) ------------------ | Branch (393:7): [True: 385k, False: 32.8k] ------------------ 394| 385k| continue; 395| | 396| 32.8k| return cur; 397| 417k| } 398| | 399| 147| return &unsupported_config_net_key; 400| 32.9k|} confile.c:set_config_net_flags: 459| 206|{ 460| 206| struct lxc_netdev *netdev = data; 461| | 462| 206| if (!netdev) ------------------ | Branch (462:6): [True: 0, False: 206] ------------------ 463| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 464| | 465| 206| if (lxc_config_value_empty(value)) ------------------ | Branch (465:6): [True: 0, False: 206] ------------------ 466| 0| return clr_config_net_flags(key, lxc_conf, data); 467| | 468| 206| netdev->flags |= IFF_UP; 469| | 470| 206| return 0; 471| 206|} confile.c:clr_config_net_flags: 5544| 194|{ 5545| 194| struct lxc_netdev *netdev = data; 5546| | 5547| 194| if (!netdev) ------------------ | Branch (5547:6): [True: 0, False: 194] ------------------ 5548| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5549| | 5550| 194| netdev->flags = 0; 5551| | 5552| 194| return 0; 5553| 194|} confile.c:set_config_net_hwaddr: 789| 1.05k|{ 790| 1.05k| __do_free char *new_value = NULL; ------------------ | | 69| 1.05k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.05k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 791| 1.05k| struct lxc_netdev *netdev = data; 792| | 793| 1.05k| if (!netdev) ------------------ | Branch (793:6): [True: 0, False: 1.05k] ------------------ 794| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 795| | 796| 1.05k| clr_config_net_hwaddr(key, lxc_conf, data); 797| 1.05k| if (lxc_config_value_empty(value)) ------------------ | Branch (797:6): [True: 0, False: 1.05k] ------------------ 798| 0| return 0; 799| | 800| 1.05k| new_value = strdup(value); 801| 1.05k| if (!new_value) ------------------ | Branch (801:6): [True: 0, False: 1.05k] ------------------ 802| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 803| | 804| 1.05k| rand_complete_hwaddr(new_value); 805| 1.05k| if (!lxc_config_value_empty(new_value)) ------------------ | Branch (805:6): [True: 1.05k, False: 0] ------------------ 806| 1.05k| netdev->hwaddr = move_ptr(new_value); ------------------ | | 694| 1.05k| ({ \ | | 695| 1.05k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.05k| (ptr) = NULL; \ | | 697| 1.05k| __internal_ptr__; \ | | 698| 1.05k| }) ------------------ 807| | 808| 1.05k| return 0; 809| 1.05k|} confile.c:clr_config_net_hwaddr: 5760| 1.45k|{ 5761| 1.45k| struct lxc_netdev *netdev = data; 5762| | 5763| 1.45k| if (!netdev) ------------------ | Branch (5763:6): [True: 0, False: 1.45k] ------------------ 5764| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5765| | 5766| 1.45k| free_disarm(netdev->hwaddr); ------------------ | | 58| 1.45k| ({ \ | | 59| 1.45k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 785, False: 665] | | ------------------ | | 60| 785| free(ptr); \ | | 61| 785| ptr = NULL; \ | | 62| 785| } \ | | 63| 1.45k| }) ------------------ 5767| | 5768| 1.45k| return 0; 5769| 1.45k|} confile.c:set_config_net_ipv4_address: 850| 2.30k|{ 851| 2.30k| __do_free char *addr = NULL; ------------------ | | 69| 2.30k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.30k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 852| 2.30k| __do_free struct lxc_inetdev *inetdev = NULL; ------------------ | | 69| 2.30k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.30k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 853| 2.30k| int ret; 854| 2.30k| struct lxc_netdev *netdev = data; 855| 2.30k| char *cursor, *slash; 856| 2.30k| char *bcast = NULL, *prefix = NULL; 857| | 858| 2.30k| if (!netdev) ------------------ | Branch (858:6): [True: 0, False: 2.30k] ------------------ 859| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 860| | 861| 2.30k| if (lxc_config_value_empty(value)) ------------------ | Branch (861:6): [True: 0, False: 2.30k] ------------------ 862| 0| return clr_config_net_ipv4_address(key, lxc_conf, data); 863| | 864| 2.30k| inetdev = zalloc(sizeof(*inetdev)); ------------------ | | 90| 2.30k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 865| 2.30k| if (!inetdev) ------------------ | Branch (865:6): [True: 0, False: 2.30k] ------------------ 866| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 867| | 868| 2.30k| addr = strdup(value); 869| 2.30k| if (!addr) ------------------ | Branch (869:6): [True: 0, False: 2.30k] ------------------ 870| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 871| | 872| 2.30k| cursor = strstr(addr, " "); 873| 2.30k| if (cursor) { ------------------ | Branch (873:6): [True: 213, False: 2.09k] ------------------ 874| 213| *cursor = '\0'; 875| 213| bcast = cursor + 1; 876| 213| } 877| | 878| 2.30k| slash = strstr(addr, "/"); 879| 2.30k| if (slash) { ------------------ | Branch (879:6): [True: 443, False: 1.86k] ------------------ 880| 443| *slash = '\0'; 881| 443| prefix = slash + 1; 882| 443| } 883| | 884| 2.30k| ret = inet_pton(AF_INET, addr, &inetdev->addr); 885| 2.30k| if (!ret || ret < 0) ------------------ | Branch (885:6): [True: 16, False: 2.29k] | Branch (885:14): [True: 0, False: 2.29k] ------------------ 886| 16| return log_error_errno(-1, errno, "Invalid ipv4 address \"%s\"", value); ------------------ | | 486| 16| ({ \ | | 487| 16| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 16| errno = (__errno__); \ | | 489| 16| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 16| do { \ | | | | 454| 16| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 16| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 16| char *ptr = NULL; \ | | | | | | 317| 16| { \ | | | | | | 318| 16| int __saved_errno = errno; \ | | | | | | 319| 16| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 16| errno = __saved_errno; \ | | | | | | 321| 16| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 16] | | | | | | ------------------ | | | | | | 322| 16| ptr = errno_buf; \ | | | | | | 323| 16| } | | | | ------------------ | | | | 455| 16| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 16|#define ERROR(format, ...) do { \ | | | | | | 373| 16| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 16| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 16| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 16|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 16] | | | | | | ------------------ | | | | ------------------ | | | | 456| 16| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 16] | | | | ------------------ | | ------------------ | | 490| 16| __internal_ret__; \ | | 491| 16| }) ------------------ 887| | 888| 2.29k| if (bcast) { ------------------ | Branch (888:6): [True: 208, False: 2.08k] ------------------ 889| 208| ret = inet_pton(AF_INET, bcast, &inetdev->bcast); 890| 208| if (!ret || ret < 0) ------------------ | Branch (890:7): [True: 1, False: 207] | Branch (890:15): [True: 0, False: 207] ------------------ 891| 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| }) ------------------ 892| | 893| 208| } 894| | 895| | /* No prefix specified, determine it from the network class. */ 896| 2.29k| ret = 0; 897| 2.29k| if (prefix) ------------------ | Branch (897:6): [True: 438, False: 1.85k] ------------------ 898| 438| ret = lxc_safe_uint(prefix, &inetdev->prefix); 899| 1.85k| else 900| 1.85k| inetdev->prefix = config_ip_prefix(&inetdev->addr); 901| 2.29k| if (ret || inetdev->prefix > 32) ------------------ | Branch (901:6): [True: 6, False: 2.28k] | Branch (901:13): [True: 49, False: 2.23k] ------------------ 902| 55| return ret_errno(EINVAL); ------------------ | | 715| 55| ({ \ | | 716| 55| errno = labs(__errno__); \ | | 717| 55| -errno; \ | | 718| 55| }) ------------------ 903| | 904| | /* If no broadcast address, compute one from the prefix and address. */ 905| 2.23k| if (!bcast) { ------------------ | Branch (905:6): [True: 2.03k, False: 207] ------------------ 906| | /* 0<=inetdev->prefix<=32 */ 907| 2.03k| switch (inetdev->prefix) { 908| 2| case 32: /* single IPv4 network */ ------------------ | Branch (908:3): [True: 2, False: 2.02k] ------------------ 909| 2| ; /* fall thru */ 910| 321| case 31: /* RFC 3021 point to point network */ ------------------ | Branch (910:3): [True: 319, False: 1.71k] ------------------ 911| 321| inetdev->bcast.s_addr = INADDR_ANY; 912| 321| break; 913| | 914| 1.70k| default: ------------------ | Branch (914:3): [True: 1.70k, False: 321] ------------------ 915| 1.70k| inetdev->bcast.s_addr = inetdev->addr.s_addr | htonl(INADDR_BROADCAST >> inetdev->prefix); 916| 1.70k| break; 917| 2.03k| } 918| 2.03k| } 919| | 920| 2.23k| list_add_tail(&inetdev->head, &netdev->ipv4_addresses); 921| 2.23k| move_ptr(inetdev); ------------------ | | 694| 2.23k| ({ \ | | 695| 2.23k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 2.23k| (ptr) = NULL; \ | | 697| 2.23k| __internal_ptr__; \ | | 698| 2.23k| }) ------------------ 922| | 923| 2.23k| return 0; 924| 2.23k|} confile.c:clr_config_net_ipv4_address: 5815| 537|{ 5816| 537| struct lxc_netdev *netdev = data; 5817| 537| struct lxc_inetdev *inetdev, *ninetdev; 5818| | 5819| 537| if (!netdev) ------------------ | Branch (5819:6): [True: 0, False: 537] ------------------ 5820| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5821| | 5822| 537| list_for_each_entry_safe(inetdev, ninetdev, &netdev->ipv4_addresses, head) { ------------------ | | 655| 537| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 537| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 537| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 537|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 537| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 537| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 537|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 537| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 537| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 537| do { \ | | | | | | | | | | | | | | | | 286| 537| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 537] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 537| !__same_type(*(ptr), void), \ | | | | | | | | 813| 537| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 537| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 537| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 537| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 537| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 537|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 537| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 537| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 537|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 537| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 537| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 537| do { \ | | | | | | | | | | | | | | | | 286| 537| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 537] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 537| !__same_type(*(ptr), void), \ | | | | | | | | 813| 537| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 537| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 937| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 937| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 400, False: 537] | | ------------------ | | 658| 537| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 400| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 400| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 400|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 400| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 400| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 400|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 400| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 400| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 400| do { \ | | | | | | | | | | | | | | | | 286| 400| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 400] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 400| !__same_type(*(ptr), void), \ | | | | | | | | 813| 400| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 400| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5823| 400| list_del(&inetdev->head); 5824| 400| free(inetdev); 5825| 400| } 5826| | 5827| 537| return 0; 5828| 537|} confile.c:set_config_net_ipv4_gateway: 928| 1.15k|{ 929| 1.15k| struct lxc_netdev *netdev = data; 930| | 931| 1.15k| if (!netdev) ------------------ | Branch (931:6): [True: 0, False: 1.15k] ------------------ 932| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 933| | 934| 1.15k| clr_config_net_ipv4_gateway(key, lxc_conf, data); 935| 1.15k| if (lxc_config_value_empty(value)) ------------------ | Branch (935:6): [True: 0, False: 1.15k] ------------------ 936| 0| return 0; 937| | 938| 1.15k| if (strequal(value, "auto")) { ------------------ | Branch (938:6): [True: 195, False: 958] ------------------ 939| 195| netdev->ipv4_gateway = NULL; 940| 195| netdev->ipv4_gateway_auto = true; 941| 958| } else if (strequal(value, "dev")) { ------------------ | Branch (941:13): [True: 207, False: 751] ------------------ 942| 207| netdev->ipv4_gateway = NULL; 943| 207| netdev->ipv4_gateway_auto = false; 944| 207| netdev->ipv4_gateway_dev = true; 945| 751| } else { 946| 751| __do_free struct in_addr *gw = NULL; ------------------ | | 69| 751|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 751| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 947| 751| int ret; 948| | 949| 751| gw = zalloc(sizeof(*gw)); ------------------ | | 90| 751|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 950| 751| if (!gw) ------------------ | Branch (950:7): [True: 0, False: 751] ------------------ 951| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 952| | 953| 751| ret = inet_pton(AF_INET, value, gw); 954| 751| if (!ret || ret < 0) ------------------ | Branch (954:7): [True: 67, False: 684] | Branch (954:15): [True: 0, False: 684] ------------------ 955| 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| }) ------------------ 956| | 957| 684| netdev->ipv4_gateway = move_ptr(gw); ------------------ | | 694| 684| ({ \ | | 695| 684| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 684| (ptr) = NULL; \ | | 697| 684| __internal_ptr__; \ | | 698| 684| }) ------------------ 958| 684| netdev->ipv4_gateway_auto = false; 959| 684| } 960| | 961| 1.08k| return 0; 962| 1.15k|} confile.c:clr_config_net_ipv4_gateway: 5802| 1.59k|{ 5803| 1.59k| struct lxc_netdev *netdev = data; 5804| | 5805| 1.59k| if (!netdev) ------------------ | Branch (5805:6): [True: 0, False: 1.59k] ------------------ 5806| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5807| | 5808| 1.59k| free_disarm(netdev->ipv4_gateway); ------------------ | | 58| 1.59k| ({ \ | | 59| 1.59k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 483, False: 1.11k] | | ------------------ | | 60| 483| free(ptr); \ | | 61| 483| ptr = NULL; \ | | 62| 483| } \ | | 63| 1.59k| }) ------------------ 5809| | 5810| 1.59k| return 0; 5811| 1.59k|} confile.c:set_config_net_ipv6_address: 1017| 1.20k|{ 1018| 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)) | | ------------------ ------------------ 1019| 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)) | | ------------------ ------------------ 1020| 1.20k| int ret; 1021| 1.20k| struct lxc_netdev *netdev = data; 1022| 1.20k| char *slash, *netmask; 1023| | 1024| 1.20k| if (!netdev) ------------------ | Branch (1024:6): [True: 0, False: 1.20k] ------------------ 1025| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1026| | 1027| 1.20k| if (lxc_config_value_empty(value)) ------------------ | Branch (1027:6): [True: 0, False: 1.20k] ------------------ 1028| 0| return clr_config_net_ipv6_address(key, lxc_conf, data); 1029| | 1030| 1.20k| inet6dev = zalloc(sizeof(*inet6dev)); ------------------ | | 90| 1.20k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1031| 1.20k| if (!inet6dev) ------------------ | Branch (1031:6): [True: 0, False: 1.20k] ------------------ 1032| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1033| | 1034| 1.20k| valdup = strdup(value); 1035| 1.20k| if (!valdup) ------------------ | Branch (1035:6): [True: 0, False: 1.20k] ------------------ 1036| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1037| | 1038| 1.20k| inet6dev->prefix = 64; 1039| 1.20k| slash = strstr(valdup, "/"); 1040| 1.20k| if (slash) { ------------------ | Branch (1040:6): [True: 204, False: 998] ------------------ 1041| 204| *slash = '\0'; 1042| 204| netmask = slash + 1; 1043| | 1044| 204| ret = lxc_safe_uint(netmask, &inet6dev->prefix); 1045| 204| if (ret < 0) ------------------ | Branch (1045:7): [True: 4, False: 200] ------------------ 1046| 4| return ret; 1047| 204| } 1048| | 1049| 1.19k| ret = inet_pton(AF_INET6, valdup, &inet6dev->addr); 1050| 1.19k| if (!ret || ret < 0) ------------------ | Branch (1050:6): [True: 9, False: 1.18k] | Branch (1050:14): [True: 0, False: 1.18k] ------------------ 1051| 9| return log_error_errno(-EINVAL, EINVAL, "Invalid ipv6 address \"%s\"", valdup); ------------------ | | 486| 9| ({ \ | | 487| 9| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 9| errno = (__errno__); \ | | 489| 9| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 9| do { \ | | | | 454| 9| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 9| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 9| char *ptr = NULL; \ | | | | | | 317| 9| { \ | | | | | | 318| 9| int __saved_errno = errno; \ | | | | | | 319| 9| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 9| errno = __saved_errno; \ | | | | | | 321| 9| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 9] | | | | | | ------------------ | | | | | | 322| 9| ptr = errno_buf; \ | | | | | | 323| 9| } | | | | ------------------ | | | | 455| 9| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 9|#define ERROR(format, ...) do { \ | | | | | | 373| 9| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 9| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 9| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 9|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 9] | | | | | | ------------------ | | | | ------------------ | | | | 456| 9| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 9] | | | | ------------------ | | ------------------ | | 490| 9| __internal_ret__; \ | | 491| 9| }) ------------------ 1052| | 1053| 1.18k| list_add_tail(&inet6dev->head, &netdev->ipv6_addresses); 1054| 1.18k| move_ptr(inet6dev); ------------------ | | 694| 1.18k| ({ \ | | 695| 1.18k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.18k| (ptr) = NULL; \ | | 697| 1.18k| __internal_ptr__; \ | | 698| 1.18k| }) ------------------ 1055| | 1056| 1.18k| return 0; 1057| 1.19k|} confile.c:clr_config_net_ipv6_address: 5865| 582|{ 5866| 582| struct lxc_netdev *netdev = data; 5867| 582| struct lxc_inet6dev *inet6dev, *ninet6dev; 5868| | 5869| 582| if (!netdev) ------------------ | Branch (5869:6): [True: 0, False: 582] ------------------ 5870| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5871| | 5872| 582| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->ipv6_addresses, head) { ------------------ | | 655| 582| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 582| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 582| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 582|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 582| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 582| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 582|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 582| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 582| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 582| do { \ | | | | | | | | | | | | | | | | 286| 582| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 582] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 582| !__same_type(*(ptr), void), \ | | | | | | | | 813| 582| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 582| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 582| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 582| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 582| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 582|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 582| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 582| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 582|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 582| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 582| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 582| do { \ | | | | | | | | | | | | | | | | 286| 582| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 582] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 582| !__same_type(*(ptr), void), \ | | | | | | | | 813| 582| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 582| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 1.00k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 1.00k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 419, False: 582] | | ------------------ | | 658| 582| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 419| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 419| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 419|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 419| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 419| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 419|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 419| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 419| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 419| do { \ | | | | | | | | | | | | | | | | 286| 419| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 419] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 419| !__same_type(*(ptr), void), \ | | | | | | | | 813| 419| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 419| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5873| 419| list_del(&inet6dev->head); 5874| 419| free(inet6dev); 5875| 419| } 5876| | 5877| 582| return 0; 5878| 582|} confile.c:set_config_net_ipv6_gateway: 1061| 1.12k|{ 1062| 1.12k| struct lxc_netdev *netdev = data; 1063| | 1064| 1.12k| if (!netdev) ------------------ | Branch (1064:6): [True: 0, False: 1.12k] ------------------ 1065| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1066| | 1067| 1.12k| clr_config_net_ipv6_gateway(key, lxc_conf, data); 1068| 1.12k| if (lxc_config_value_empty(value)) ------------------ | Branch (1068:6): [True: 0, False: 1.12k] ------------------ 1069| 0| return 0; 1070| | 1071| 1.12k| if (strequal(value, "auto")) { ------------------ | Branch (1071:6): [True: 194, False: 934] ------------------ 1072| 194| netdev->ipv6_gateway = NULL; 1073| 194| netdev->ipv6_gateway_auto = true; 1074| 934| } else if (strequal(value, "dev")) { ------------------ | Branch (1074:13): [True: 194, False: 740] ------------------ 1075| 194| netdev->ipv6_gateway = NULL; 1076| 194| netdev->ipv6_gateway_auto = false; 1077| 194| netdev->ipv6_gateway_dev = true; 1078| 740| } else { 1079| 740| int ret; 1080| 740| __do_free struct in6_addr *gw = NULL; ------------------ | | 69| 740|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 740| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1081| | 1082| 740| gw = zalloc(sizeof(*gw)); ------------------ | | 90| 740|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1083| 740| if (!gw) ------------------ | Branch (1083:7): [True: 0, False: 740] ------------------ 1084| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1085| | 1086| 740| ret = inet_pton(AF_INET6, value, gw); 1087| 740| if (!ret || ret < 0) ------------------ | Branch (1087:7): [True: 70, False: 670] | Branch (1087:15): [True: 0, False: 670] ------------------ 1088| 70| return log_error_errno(-EINVAL, EINVAL, ------------------ | | 486| 70| ({ \ | | 487| 70| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 70| errno = (__errno__); \ | | 489| 70| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 70| do { \ | | | | 454| 70| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 70| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 70| char *ptr = NULL; \ | | | | | | 317| 70| { \ | | | | | | 318| 70| int __saved_errno = errno; \ | | | | | | 319| 70| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 70| errno = __saved_errno; \ | | | | | | 321| 70| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 70] | | | | | | ------------------ | | | | | | 322| 70| ptr = errno_buf; \ | | | | | | 323| 70| } | | | | ------------------ | | | | 455| 70| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 70|#define ERROR(format, ...) do { \ | | | | | | 373| 70| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 70| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 70| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 70|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 70] | | | | | | ------------------ | | | | ------------------ | | | | 456| 70| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 70] | | | | ------------------ | | ------------------ | | 490| 70| __internal_ret__; \ | | 491| 70| }) ------------------ 1089| 740| "Invalid ipv6 gateway address \"%s\"", value); 1090| | 1091| 670| netdev->ipv6_gateway = move_ptr(gw); ------------------ | | 694| 670| ({ \ | | 695| 670| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 670| (ptr) = NULL; \ | | 697| 670| __internal_ptr__; \ | | 698| 670| }) ------------------ 1092| 670| netdev->ipv6_gateway_auto = false; 1093| 670| } 1094| | 1095| 1.05k| return 0; 1096| 1.12k|} confile.c:clr_config_net_ipv6_gateway: 5852| 1.52k|{ 5853| 1.52k| struct lxc_netdev *netdev = data; 5854| | 5855| 1.52k| if (!netdev) ------------------ | Branch (5855:6): [True: 0, False: 1.52k] ------------------ 5856| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5857| | 5858| 1.52k| free_disarm(netdev->ipv6_gateway); ------------------ | | 58| 1.52k| ({ \ | | 59| 1.52k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 453, False: 1.06k] | | ------------------ | | 60| 453| free(ptr); \ | | 61| 453| ptr = NULL; \ | | 62| 453| } \ | | 63| 1.52k| }) ------------------ 5859| | 5860| 1.52k| return 0; 5861| 1.52k|} confile.c:set_config_net_link: 516| 2.64k|{ 517| 2.64k| struct lxc_netdev *netdev = data; 518| 2.64k| int ret = 0; 519| | 520| 2.64k| if (!netdev) ------------------ | Branch (520:6): [True: 0, False: 2.64k] ------------------ 521| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 522| | 523| 2.64k| if (lxc_config_value_empty(value)) ------------------ | Branch (523:6): [True: 0, False: 2.64k] ------------------ 524| 0| return clr_config_net_link(key, lxc_conf, data); 525| | 526| 2.64k| if (value[strlen(value) - 1] == '+' && netdev->type == LXC_NET_PHYS) ------------------ | Branch (526:6): [True: 1.15k, False: 1.49k] | Branch (526:41): [True: 946, False: 206] ------------------ 527| 946| ret = create_matched_ifnames(value, lxc_conf, netdev); 528| 1.70k| else 529| 1.70k| ret = network_ifname(netdev->link, value, sizeof(netdev->link)); 530| | 531| 2.64k| return ret; 532| 2.64k|} confile.c:create_matched_ifnames: 475| 946|{ 476| 946| call_cleaner(netns_freeifaddrs) struct netns_ifaddrs *ifaddr = NULL; ------------------ | | 26| 946| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) ------------------ 477| 946| struct netns_ifaddrs *ifa; 478| 946| int n; 479| 946| int ret = 0; 480| 946| const char *type_key = "lxc.net.type"; 481| 946| const char *link_key = "lxc.net.link"; 482| 946| const char *tmpvalue = "phys"; 483| | 484| 946| if (netns_getifaddrs(&ifaddr, -1, &(bool){false}) < 0) ------------------ | Branch (484:6): [True: 0, False: 946] ------------------ 485| 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| }) ------------------ 486| | 487| 4.73k| for (ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) { ------------------ | Branch (487:28): [True: 3.78k, False: 946] ------------------ 488| 3.78k| if (!ifa->ifa_addr) ------------------ | Branch (488:7): [True: 0, False: 3.78k] ------------------ 489| 0| continue; 490| | 491| 3.78k| if (ifa->ifa_addr->sa_family != AF_PACKET) ------------------ | Branch (491:7): [True: 1.89k, False: 1.89k] ------------------ 492| 1.89k| continue; 493| | 494| 1.89k| if (strnequal(value, ifa->ifa_name, strlen(value) - 1)) { ------------------ | Branch (494:7): [True: 1.44k, False: 445] ------------------ 495| 1.44k| ret = set_config_net_type(type_key, tmpvalue, lxc_conf, 496| 1.44k| netdev); 497| 1.44k| if (!ret) { ------------------ | Branch (497:8): [True: 1.44k, False: 0] ------------------ 498| 1.44k| ret = set_config_net_link( 499| 1.44k| link_key, ifa->ifa_name, lxc_conf, netdev); 500| 1.44k| if (ret) { ------------------ | Branch (500:9): [True: 0, False: 1.44k] ------------------ 501| 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] | | ------------------ ------------------ 502| 0| break; 503| 0| } 504| 1.44k| } else { 505| 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] | | ------------------ ------------------ 506| 0| break; 507| 0| } 508| 1.44k| } 509| 1.89k| } 510| | 511| 946| return ret; 512| 946|} confile.c:clr_config_net_link: 5557| 194|{ 5558| 194| struct lxc_netdev *netdev = data; 5559| | 5560| 194| if (!netdev) ------------------ | Branch (5560:6): [True: 0, False: 194] ------------------ 5561| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5562| | 5563| 194| netdev->link[0] = '\0'; 5564| | 5565| 194| return 0; 5566| 194|} confile.c:set_config_net_l2proxy: 536| 402|{ 537| 402| struct lxc_netdev *netdev = data; 538| 402| unsigned int val = 0; 539| 402| int ret; 540| | 541| 402| if (!netdev) ------------------ | Branch (541:6): [True: 0, False: 402] ------------------ 542| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 543| | 544| 402| if (lxc_config_value_empty(value)) ------------------ | Branch (544:6): [True: 0, False: 402] ------------------ 545| 0| return clr_config_net_l2proxy(key, lxc_conf, data); 546| | 547| 402| ret = lxc_safe_uint(value, &val); 548| 402| if (ret < 0) ------------------ | Branch (548:6): [True: 2, False: 400] ------------------ 549| 2| return ret_errno(ret); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 550| | 551| 400| switch (val) { ------------------ | Branch (551:10): [True: 399, False: 1] ------------------ 552| 203| case 0: ------------------ | Branch (552:2): [True: 203, False: 197] ------------------ 553| 203| netdev->l2proxy = false; 554| 203| return 0; 555| 196| case 1: ------------------ | Branch (555:2): [True: 196, False: 204] ------------------ 556| 196| netdev->l2proxy = true; 557| 196| return 0; 558| 400| } 559| | 560| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 561| 400|} confile.c:clr_config_net_l2proxy: 5570| 194|{ 5571| 194| struct lxc_netdev *netdev = data; 5572| | 5573| 194| if (!netdev) ------------------ | Branch (5573:6): [True: 0, False: 194] ------------------ 5574| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5575| | 5576| 194| netdev->l2proxy = false; 5577| | 5578| 194| return 0; 5579| 194|} confile.c:set_config_net_macvlan_mode: 738| 320|{ 739| 320| struct lxc_netdev *netdev = data; 740| | 741| 320| if (!netdev) ------------------ | Branch (741:6): [True: 0, False: 320] ------------------ 742| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 743| | 744| 320| if (netdev->type != LXC_NET_MACVLAN) ------------------ | Branch (744:6): [True: 4, False: 316] ------------------ 745| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 746| | 747| 316| if (lxc_config_value_empty(value)) ------------------ | Branch (747:6): [True: 0, False: 316] ------------------ 748| 0| return clr_config_net_macvlan_mode(key, lxc_conf, data); 749| | 750| 316| return lxc_macvlan_mode_to_flag(&netdev->priv.macvlan_attr.mode, value); 751| 316|} confile.c:clr_config_net_macvlan_mode: 5583| 391|{ 5584| 391| struct lxc_netdev *netdev = data; 5585| | 5586| 391| if (!netdev) ------------------ | Branch (5586:6): [True: 0, False: 391] ------------------ 5587| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5588| | 5589| 391| if (netdev->type != LXC_NET_MACVLAN) ------------------ | Branch (5589:6): [True: 197, False: 194] ------------------ 5590| 197| return 0; 5591| | 5592| 194| netdev->priv.macvlan_attr.mode = -1; 5593| | 5594| 194| return 0; 5595| 391|} confile.c:set_config_net_ipvlan_mode: 755| 350|{ 756| 350| struct lxc_netdev *netdev = data; 757| | 758| 350| if (!netdev) ------------------ | Branch (758:6): [True: 0, False: 350] ------------------ 759| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 760| | 761| 350| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (761:6): [True: 4, False: 346] ------------------ 762| 4| return syserror_set(-EINVAL, "Invalid ipvlan mode \"%s\", can only be used with ipvlan network", value); ------------------ | | 568| 4| ({ \ | | 569| 4| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 4| errno = labs(__ret__); \ | | 571| 4| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 4| do { \ | | | | 454| 4| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 4| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 4| char *ptr = NULL; \ | | | | | | 317| 4| { \ | | | | | | 318| 4| int __saved_errno = errno; \ | | | | | | 319| 4| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 4| errno = __saved_errno; \ | | | | | | 321| 4| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 4] | | | | | | ------------------ | | | | | | 322| 4| ptr = errno_buf; \ | | | | | | 323| 4| } | | | | ------------------ | | | | 455| 4| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 4|#define ERROR(format, ...) do { \ | | | | | | 373| 4| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 4| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 4| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 4|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 4] | | | | | | ------------------ | | | | ------------------ | | | | 456| 4| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 4] | | | | ------------------ | | ------------------ | | 572| 4| __internal_ret__; \ | | 573| 4| }) ------------------ 763| | 764| 346| if (lxc_config_value_empty(value)) ------------------ | Branch (764:6): [True: 0, False: 346] ------------------ 765| 0| return clr_config_net_ipvlan_mode(key, lxc_conf, data); 766| | 767| 346| return lxc_ipvlan_mode_to_flag(&netdev->priv.ipvlan_attr.mode, value); 768| 346|} confile.c:clr_config_net_ipvlan_mode: 5599| 413|{ 5600| 413| struct lxc_netdev *netdev = data; 5601| | 5602| 413| if (!netdev) ------------------ | Branch (5602:6): [True: 0, False: 413] ------------------ 5603| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5604| | 5605| 413| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (5605:6): [True: 196, False: 217] ------------------ 5606| 196| return 0; 5607| | 5608| 217| netdev->priv.ipvlan_attr.mode = -1; 5609| | 5610| 217| return 0; 5611| 413|} confile.c:set_config_net_ipvlan_isolation: 772| 339|{ 773| 339| struct lxc_netdev *netdev = data; 774| | 775| 339| if (!netdev) ------------------ | Branch (775:6): [True: 0, False: 339] ------------------ 776| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 777| | 778| 339| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (778:6): [True: 2, False: 337] ------------------ 779| 2| return syserror_set(-EINVAL, "Invalid ipvlan isolation \"%s\", can only be used with ipvlan network", value); ------------------ | | 568| 2| ({ \ | | 569| 2| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 570| 2| errno = labs(__ret__); \ | | 571| 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] | | | | ------------------ | | ------------------ | | 572| 2| __internal_ret__; \ | | 573| 2| }) ------------------ 780| | 781| 337| if (lxc_config_value_empty(value)) ------------------ | Branch (781:6): [True: 0, False: 337] ------------------ 782| 0| return clr_config_net_ipvlan_isolation(key, lxc_conf, data); 783| | 784| 337| return lxc_ipvlan_isolation_to_flag(&netdev->priv.ipvlan_attr.isolation, value); 785| 337|} confile.c:clr_config_net_ipvlan_isolation: 5615| 392|{ 5616| 392| struct lxc_netdev *netdev = data; 5617| | 5618| 392| if (!netdev) ------------------ | Branch (5618:6): [True: 0, False: 392] ------------------ 5619| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5620| | 5621| 392| if (netdev->type != LXC_NET_IPVLAN) ------------------ | Branch (5621:6): [True: 198, False: 194] ------------------ 5622| 198| return 0; 5623| | 5624| 194| netdev->priv.ipvlan_attr.isolation = -1; 5625| | 5626| 194| return 0; 5627| 392|} confile.c:set_config_net_mtu: 835| 1.94k|{ 836| 1.94k| struct lxc_netdev *netdev = data; 837| | 838| 1.94k| if (!netdev) ------------------ | Branch (838:6): [True: 0, False: 1.94k] ------------------ 839| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 840| | 841| 1.94k| clr_config_net_mtu(key, lxc_conf, data); 842| 1.94k| if (lxc_config_value_empty(value)) ------------------ | Branch (842:6): [True: 0, False: 1.94k] ------------------ 843| 0| return 0; 844| | 845| 1.94k| return set_config_string_item(&netdev->mtu, value); 846| 1.94k|} confile.c:clr_config_net_mtu: 5773| 2.51k|{ 5774| 2.51k| struct lxc_netdev *netdev = data; 5775| | 5776| 2.51k| if (!netdev) ------------------ | Branch (5776:6): [True: 0, False: 2.51k] ------------------ 5777| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5778| | 5779| 2.51k| free_disarm(netdev->mtu); ------------------ | | 58| 2.51k| ({ \ | | 59| 2.51k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 612, False: 1.90k] | | ------------------ | | 60| 612| free(ptr); \ | | 61| 612| ptr = NULL; \ | | 62| 612| } \ | | 63| 2.51k| }) ------------------ 5780| | 5781| 2.51k| return 0; 5782| 2.51k|} confile.c:set_config_net_name: 565| 823|{ 566| 823| struct lxc_netdev *netdev = data; 567| | 568| 823| if (!netdev) ------------------ | Branch (568:6): [True: 0, False: 823] ------------------ 569| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 570| | 571| 823| if (lxc_config_value_empty(value)) ------------------ | Branch (571:6): [True: 0, False: 823] ------------------ 572| 0| return clr_config_net_name(key, lxc_conf, data); 573| | 574| 823| return network_ifname(netdev->name, value, sizeof(netdev->name)); 575| 823|} confile.c:clr_config_net_name: 5531| 194|{ 5532| 194| struct lxc_netdev *netdev = data; 5533| | 5534| 194| if (!netdev) ------------------ | Branch (5534:6): [True: 0, False: 194] ------------------ 5535| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5536| | 5537| 194| netdev->name[0] = '\0'; 5538| | 5539| 194| return 0; 5540| 194|} confile.c:set_config_net_script_down: 1166| 789|{ 1167| 789| struct lxc_netdev *netdev = data; 1168| | 1169| 789| if (!netdev) ------------------ | Branch (1169:6): [True: 0, False: 789] ------------------ 1170| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1171| | 1172| 789| clr_config_net_script_down(key, lxc_conf, data); 1173| 789| if (lxc_config_value_empty(value)) ------------------ | Branch (1173:6): [True: 0, False: 789] ------------------ 1174| 0| return 0; 1175| | 1176| 789| return set_config_string_item(&netdev->downscript, value); 1177| 789|} confile.c:clr_config_net_script_down: 5747| 1.22k|{ 5748| 1.22k| struct lxc_netdev *netdev = data; 5749| | 5750| 1.22k| if (!netdev) ------------------ | Branch (5750:6): [True: 0, False: 1.22k] ------------------ 5751| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5752| | 5753| 1.22k| free_disarm(netdev->downscript); ------------------ | | 58| 1.22k| ({ \ | | 59| 1.22k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 573, False: 655] | | ------------------ | | 60| 573| free(ptr); \ | | 61| 573| ptr = NULL; \ | | 62| 573| } \ | | 63| 1.22k| }) ------------------ 5754| | 5755| 1.22k| return 0; 5756| 1.22k|} confile.c:set_config_net_script_up: 1151| 668|{ 1152| 668| struct lxc_netdev *netdev = data; 1153| | 1154| 668| if (!netdev) ------------------ | Branch (1154:6): [True: 0, False: 668] ------------------ 1155| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1156| | 1157| 668| clr_config_net_script_up(key, lxc_conf, data); 1158| 668| if (lxc_config_value_empty(value)) ------------------ | Branch (1158:6): [True: 0, False: 668] ------------------ 1159| 0| return 0; 1160| | 1161| 668| return set_config_string_item(&netdev->upscript, value); 1162| 668|} confile.c:clr_config_net_script_up: 5734| 1.19k|{ 5735| 1.19k| struct lxc_netdev *netdev = data; 5736| | 5737| 1.19k| if (!netdev) ------------------ | Branch (5737:6): [True: 0, False: 1.19k] ------------------ 5738| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5739| | 5740| 1.19k| free_disarm(netdev->upscript); ------------------ | | 58| 1.19k| ({ \ | | 59| 1.19k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 452, False: 738] | | ------------------ | | 60| 452| free(ptr); \ | | 61| 452| ptr = NULL; \ | | 62| 452| } \ | | 63| 1.19k| }) ------------------ 5741| | 5742| 1.19k| return 0; 5743| 1.19k|} confile.c:set_config_net_type: 413| 4.92k|{ 414| 4.92k| struct lxc_netdev *netdev = data; 415| | 416| 4.92k| if (!netdev) ------------------ | Branch (416:6): [True: 0, False: 4.92k] ------------------ 417| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 418| | 419| 4.92k| clr_config_net_type(key, lxc_conf, data); 420| 4.92k| if (lxc_config_value_empty(value)) ------------------ | Branch (420:6): [True: 0, False: 4.92k] ------------------ 421| 0| return 0; 422| | 423| 4.92k| if (strequal(value, "veth")) { ------------------ | Branch (423:6): [True: 1.44k, False: 3.48k] ------------------ 424| 1.44k| netdev->type = LXC_NET_VETH; 425| 1.44k| INIT_LIST_HEAD(&netdev->priv.veth_attr.ipv4_routes); 426| 1.44k| INIT_LIST_HEAD(&netdev->priv.veth_attr.ipv6_routes); 427| 1.44k| lxc_list_init(&netdev->priv.veth_attr.vlan_tagged_ids); 428| 1.44k| if (!lxc_veth_flag_to_mode(netdev->priv.veth_attr.mode)) ------------------ | Branch (428:7): [True: 1.44k, False: 0] ------------------ 429| 1.44k| lxc_veth_mode_to_flag(&netdev->priv.veth_attr.mode, "bridge"); 430| 3.48k| } else if (strequal(value, "macvlan")) { ------------------ | Branch (430:13): [True: 599, False: 2.88k] ------------------ 431| 599| netdev->type = LXC_NET_MACVLAN; 432| 599| if (!lxc_macvlan_flag_to_mode(netdev->priv.veth_attr.mode)) ------------------ | Branch (432:7): [True: 599, False: 0] ------------------ 433| 599| lxc_macvlan_mode_to_flag(&netdev->priv.macvlan_attr.mode, "private"); 434| 2.88k| } else if (strequal(value, "ipvlan")) { ------------------ | Branch (434:13): [True: 395, False: 2.48k] ------------------ 435| 395| netdev->type = LXC_NET_IPVLAN; 436| 395| if (!lxc_ipvlan_flag_to_mode(netdev->priv.ipvlan_attr.mode)) ------------------ | Branch (436:7): [True: 0, False: 395] ------------------ 437| 0| lxc_ipvlan_mode_to_flag(&netdev->priv.ipvlan_attr.mode, "l3"); 438| 395| if (!lxc_ipvlan_flag_to_isolation(netdev->priv.ipvlan_attr.isolation)) ------------------ | Branch (438:7): [True: 0, False: 395] ------------------ 439| 0| lxc_ipvlan_isolation_to_flag(&netdev->priv.ipvlan_attr.isolation, "bridge"); 440| 2.48k| } else if (strequal(value, "vlan")) { ------------------ | Branch (440:13): [True: 370, False: 2.11k] ------------------ 441| 370| netdev->type = LXC_NET_VLAN; 442| 2.11k| } else if (strequal(value, "phys")) { ------------------ | Branch (442:13): [True: 1.51k, False: 609] ------------------ 443| 1.51k| netdev->type = LXC_NET_PHYS; 444| 1.51k| } else if (strequal(value, "empty")) { ------------------ | Branch (444:13): [True: 196, False: 413] ------------------ 445| 196| netdev->type = LXC_NET_EMPTY; 446| | /* We don't support custom loopback device names. */ 447| 196| (void)strlcpy(netdev->name, "lo", IFNAMSIZ); 448| 413| } else if (strequal(value, "none")) { ------------------ | Branch (448:13): [True: 211, False: 202] ------------------ 449| 211| netdev->type = LXC_NET_NONE; 450| 211| } else { 451| 202| return log_error(-1, "Invalid network type %s", value); ------------------ | | 494| 202| ({ \ | | 495| 202| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 496| 202| ERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 202|#define ERROR(format, ...) do { \ | | | | 373| 202| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 202| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 202| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 202|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 202] | | | | ------------------ | | ------------------ | | 497| 202| __internal_ret__; \ | | 498| 202| }) ------------------ 452| 202| } 453| | 454| 4.72k| return 0; 455| 4.92k|} confile.c:clr_config_net_type: 5518| 5.14k|{ 5519| 5.14k| struct lxc_netdev *netdev = data; 5520| | 5521| 5.14k| if (!netdev) ------------------ | Branch (5521:6): [True: 0, False: 5.14k] ------------------ 5522| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5523| | 5524| 5.14k| lxc_clear_netdev(netdev); 5525| | 5526| 5.14k| return 0; 5527| 5.14k|} confile.c:set_config_net_vlan_id: 813| 315|{ 814| 315| int ret; 815| 315| struct lxc_netdev *netdev = data; 816| | 817| 315| if (!netdev) ------------------ | Branch (817:6): [True: 0, False: 315] ------------------ 818| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 819| | 820| 315| if (netdev->type != LXC_NET_VLAN) ------------------ | Branch (820:6): [True: 6, False: 309] ------------------ 821| 6| return ret_errno(EINVAL); ------------------ | | 715| 6| ({ \ | | 716| 6| errno = labs(__errno__); \ | | 717| 6| -errno; \ | | 718| 6| }) ------------------ 822| | 823| 309| if (lxc_config_value_empty(value)) ------------------ | Branch (823:6): [True: 0, False: 309] ------------------ 824| 0| return clr_config_net_vlan_id(key, lxc_conf, data); 825| | 826| 309| ret = get_u16(&netdev->priv.vlan_attr.vid, value, 0); 827| 309| if (ret < 0) ------------------ | Branch (827:6): [True: 95, False: 214] ------------------ 828| 95| return ret; 829| | 830| 214| return 0; 831| 309|} confile.c:clr_config_net_vlan_id: 5786| 388|{ 5787| 388| struct lxc_netdev *netdev = data; 5788| | 5789| 388| if (!netdev) ------------------ | Branch (5789:6): [True: 0, False: 388] ------------------ 5790| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5791| | 5792| 388| if (netdev->type != LXC_NET_VLAN) ------------------ | Branch (5792:6): [True: 194, False: 194] ------------------ 5793| 194| return 0; 5794| | 5795| 194| netdev->priv.vlan_attr.vid = 0; 5796| | 5797| 194| return 0; 5798| 388|} confile.c:set_config_net_veth_mode: 580| 240|{ 581| 240| struct lxc_netdev *netdev = data; 582| | 583| 240| if (!netdev) ------------------ | Branch (583:6): [True: 0, False: 240] ------------------ 584| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 585| | 586| 240| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (586:6): [True: 4, False: 236] ------------------ 587| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 588| | 589| 236| if (lxc_config_value_empty(value)) ------------------ | Branch (589:6): [True: 0, False: 236] ------------------ 590| 0| return clr_config_net_veth_mode(key, lxc_conf, data); 591| | 592| 236| if (!netdev) ------------------ | Branch (592:6): [True: 0, False: 236] ------------------ 593| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 594| | 595| 236| return lxc_veth_mode_to_flag(&netdev->priv.veth_attr.mode, value); 596| 236|} confile.c:clr_config_net_veth_mode: 5631| 391|{ 5632| 391| struct lxc_netdev *netdev = data; 5633| | 5634| 391| if (!netdev) ------------------ | Branch (5634:6): [True: 0, False: 391] ------------------ 5635| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5636| | 5637| 391| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5637:6): [True: 197, False: 194] ------------------ 5638| 197| return 0; 5639| | 5640| 194| netdev->priv.veth_attr.mode = -1; 5641| | 5642| 194| return 0; 5643| 391|} confile.c:set_config_net_veth_n_rxqueues: 600| 371|{ 601| 371| int n_rxqueues; 602| 371| struct lxc_netdev *netdev = data; 603| | 604| 371| if (!netdev) ------------------ | Branch (604:6): [True: 0, False: 371] ------------------ 605| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 606| | 607| 371| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (607:6): [True: 5, False: 366] ------------------ 608| 5| return ret_errno(EINVAL); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 609| | 610| 366| if (lxc_config_value_empty(value)) ------------------ | Branch (610:6): [True: 0, False: 366] ------------------ 611| 0| return clr_config_net_veth_n_rxqueues(key, lxc_conf, data); 612| | 613| 366| if (lxc_safe_int(value, &n_rxqueues)) ------------------ | Branch (613:6): [True: 2, False: 364] ------------------ 614| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 615| | 616| 364| if (n_rxqueues <= 0) ------------------ | Branch (616:6): [True: 35, False: 329] ------------------ 617| 35| return ret_errno(EINVAL); ------------------ | | 715| 35| ({ \ | | 716| 35| errno = labs(__errno__); \ | | 717| 35| -errno; \ | | 718| 35| }) ------------------ 618| | 619| 329| netdev->priv.veth_attr.n_rxqueues = n_rxqueues; 620| 329| return 0; 621| 364|} confile.c:clr_config_net_veth_n_rxqueues: 5647| 518|{ 5648| 518| struct lxc_netdev *netdev = data; 5649| | 5650| 518| if (!netdev) ------------------ | Branch (5650:6): [True: 0, False: 518] ------------------ 5651| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5652| | 5653| 518| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5653:6): [True: 196, False: 322] ------------------ 5654| 196| return 0; 5655| | 5656| 322| netdev->priv.veth_attr.n_rxqueues = -1; 5657| | 5658| 322| return 0; 5659| 518|} confile.c:set_config_net_veth_n_txqueues: 625| 252|{ 626| 252| int n_txqueues; 627| 252| struct lxc_netdev *netdev = data; 628| | 629| 252| if (!netdev) ------------------ | Branch (629:6): [True: 0, False: 252] ------------------ 630| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 631| | 632| 252| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (632:6): [True: 3, False: 249] ------------------ 633| 3| return ret_errno(EINVAL); ------------------ | | 715| 3| ({ \ | | 716| 3| errno = labs(__errno__); \ | | 717| 3| -errno; \ | | 718| 3| }) ------------------ 634| | 635| 249| if (lxc_config_value_empty(value)) ------------------ | Branch (635:6): [True: 0, False: 249] ------------------ 636| 0| return clr_config_net_veth_n_txqueues(key, lxc_conf, data); 637| | 638| 249| if (lxc_safe_int(value, &n_txqueues)) ------------------ | Branch (638:6): [True: 2, False: 247] ------------------ 639| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 640| | 641| 247| if (n_txqueues <= 0) ------------------ | Branch (641:6): [True: 37, False: 210] ------------------ 642| 37| return ret_errno(EINVAL); ------------------ | | 715| 37| ({ \ | | 716| 37| errno = labs(__errno__); \ | | 717| 37| -errno; \ | | 718| 37| }) ------------------ 643| | 644| 210| netdev->priv.veth_attr.n_txqueues = n_txqueues; 645| 210| return 0; 646| 247|} confile.c:clr_config_net_veth_n_txqueues: 5663| 390|{ 5664| 390| struct lxc_netdev *netdev = data; 5665| | 5666| 390| if (!netdev) ------------------ | Branch (5666:6): [True: 0, False: 390] ------------------ 5667| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5668| | 5669| 390| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5669:6): [True: 196, False: 194] ------------------ 5670| 196| return 0; 5671| | 5672| 194| netdev->priv.veth_attr.n_txqueues = -1; 5673| | 5674| 194| return 0; 5675| 390|} confile.c:set_config_net_veth_pair: 650| 201|{ 651| 201| struct lxc_netdev *netdev = data; 652| | 653| 201| if (!netdev) ------------------ | Branch (653:6): [True: 0, False: 201] ------------------ 654| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 655| | 656| 201| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (656:6): [True: 4, False: 197] ------------------ 657| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 658| | 659| 197| if (lxc_config_value_empty(value)) ------------------ | Branch (659:6): [True: 0, False: 197] ------------------ 660| 0| return clr_config_net_veth_pair(key, lxc_conf, data); 661| | 662| 197| return network_ifname(netdev->priv.veth_attr.pair, value, 663| 197| sizeof(netdev->priv.veth_attr.pair)); 664| 197|} confile.c:clr_config_net_veth_pair: 5680| 392|{ 5681| 392| struct lxc_netdev *netdev = data; 5682| | 5683| 392| if (!netdev) ------------------ | Branch (5683:6): [True: 0, False: 392] ------------------ 5684| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5685| | 5686| 392| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5686:6): [True: 197, False: 195] ------------------ 5687| 197| return 0; 5688| | 5689| 195| netdev->priv.veth_attr.pair[0] = '\0'; 5690| | 5691| 195| return 0; 5692| 392|} confile.c:set_config_net_veth_ipv4_route: 966| 1.10k|{ 967| 1.10k| __do_free char *valdup = NULL; ------------------ | | 69| 1.10k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.10k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 968| 1.10k| __do_free struct lxc_inetdev *inetdev = NULL; ------------------ | | 69| 1.10k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.10k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 969| 1.10k| int ret; 970| 1.10k| char *netmask, *slash; 971| 1.10k| struct lxc_netdev *netdev = data; 972| | 973| 1.10k| if (!netdev) ------------------ | Branch (973:6): [True: 0, False: 1.10k] ------------------ 974| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 975| | 976| 1.10k| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (976:6): [True: 5, False: 1.10k] ------------------ 977| 5| return syserror_set(-EINVAL, "Invalid ipv4 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| }) ------------------ 978| | 979| 1.10k| if (lxc_config_value_empty(value)) ------------------ | Branch (979:6): [True: 0, False: 1.10k] ------------------ 980| 0| return clr_config_net_veth_ipv4_route(key, lxc_conf, data); 981| | 982| 1.10k| inetdev = zalloc(sizeof(*inetdev)); ------------------ | | 90| 1.10k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 983| 1.10k| if (!inetdev) ------------------ | Branch (983:6): [True: 0, False: 1.10k] ------------------ 984| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 985| | 986| 1.10k| valdup = strdup(value); 987| 1.10k| if (!valdup) ------------------ | Branch (987:6): [True: 0, False: 1.10k] ------------------ 988| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 989| | 990| 1.10k| slash = strchr(valdup, '/'); 991| 1.10k| if (!slash) ------------------ | Branch (991:6): [True: 4, False: 1.09k] ------------------ 992| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 993| | 994| 1.09k| *slash = '\0'; 995| 1.09k| slash++; 996| 1.09k| if (*slash == '\0') ------------------ | Branch (996:6): [True: 1, False: 1.09k] ------------------ 997| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 998| | 999| 1.09k| netmask = slash; 1000| | 1001| 1.09k| ret = lxc_safe_uint(netmask, &inetdev->prefix); 1002| 1.09k| if (ret < 0 || inetdev->prefix > 32) ------------------ | Branch (1002:6): [True: 10, False: 1.08k] | Branch (1002:17): [True: 45, False: 1.04k] ------------------ 1003| 55| return ret_errno(EINVAL); ------------------ | | 715| 55| ({ \ | | 716| 55| errno = labs(__errno__); \ | | 717| 55| -errno; \ | | 718| 55| }) ------------------ 1004| | 1005| 1.04k| ret = inet_pton(AF_INET, valdup, &inetdev->addr); 1006| 1.04k| if (!ret || ret < 0) ------------------ | Branch (1006:6): [True: 4, False: 1.03k] | Branch (1006:14): [True: 0, False: 1.03k] ------------------ 1007| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 1008| | 1009| 1.03k| list_add_tail(&inetdev->head, &netdev->priv.veth_attr.ipv4_routes); 1010| 1.03k| move_ptr(inetdev); ------------------ | | 694| 1.03k| ({ \ | | 695| 1.03k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.03k| (ptr) = NULL; \ | | 697| 1.03k| __internal_ptr__; \ | | 698| 1.03k| }) ------------------ 1011| | 1012| 1.03k| return 0; 1013| 1.04k|} confile.c:clr_config_net_veth_ipv4_route: 5832| 607|{ 5833| 607| struct lxc_netdev *netdev = data; 5834| 607| struct lxc_inetdev *inetdev, *ninetdev; 5835| | 5836| 607| if (!netdev) ------------------ | Branch (5836:6): [True: 0, False: 607] ------------------ 5837| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5838| | 5839| 607| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5839:6): [True: 197, False: 410] ------------------ 5840| 197| return 0; 5841| | 5842| 410| list_for_each_entry_safe(inetdev, ninetdev, &netdev->priv.veth_attr.ipv4_routes, head) { ------------------ | | 655| 410| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 410| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 410| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 410|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 410| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 410| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 410|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 410| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 410| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 410| do { \ | | | | | | | | | | | | | | | | 286| 410| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 410] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 410| !__same_type(*(ptr), void), \ | | | | | | | | 813| 410| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 410| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 607| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 607| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 607| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 607|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 607| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 607| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 410|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 410| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 410| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 410| do { \ | | | | | | | | | | | | | | | | 286| 410| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 410] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 607| !__same_type(*(ptr), void), \ | | | | | | | | 813| 607| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 607| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 811| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 811| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 401, False: 410] | | ------------------ | | 658| 410| 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))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5843| 401| list_del(&inetdev->head); 5844| 401| free(inetdev); 5845| 401| } 5846| | 5847| 410| return 0; 5848| 607|} confile.c:set_config_net_veth_ipv6_route: 1100| 1.09k|{ 1101| 1.09k| __do_free char *valdup = NULL; ------------------ | | 69| 1.09k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.09k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1102| 1.09k| __do_free struct lxc_inet6dev *inet6dev = NULL; ------------------ | | 69| 1.09k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.09k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 1103| 1.09k| int ret; 1104| 1.09k| char *netmask, *slash; 1105| 1.09k| struct lxc_netdev *netdev = data; 1106| | 1107| 1.09k| if (!netdev) ------------------ | Branch (1107:6): [True: 0, False: 1.09k] ------------------ 1108| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1109| | 1110| 1.09k| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (1110:6): [True: 6, False: 1.09k] ------------------ 1111| 6| return syserror_set(-EINVAL, "Invalid ipv6 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| }) ------------------ 1112| | 1113| 1.09k| if (lxc_config_value_empty(value)) ------------------ | Branch (1113:6): [True: 0, False: 1.09k] ------------------ 1114| 0| return clr_config_net_veth_ipv6_route(key, lxc_conf, data); 1115| | 1116| 1.09k| inet6dev = zalloc(sizeof(*inet6dev)); ------------------ | | 90| 1.09k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 1117| 1.09k| if (!inet6dev) ------------------ | Branch (1117:6): [True: 0, False: 1.09k] ------------------ 1118| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1119| | 1120| 1.09k| valdup = strdup(value); 1121| 1.09k| if (!valdup) ------------------ | Branch (1121:6): [True: 0, False: 1.09k] ------------------ 1122| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 1123| | 1124| 1.09k| slash = strchr(valdup, '/'); 1125| 1.09k| if (!slash) ------------------ | Branch (1125:6): [True: 4, False: 1.08k] ------------------ 1126| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 1127| | 1128| 1.08k| *slash = '\0'; 1129| 1.08k| slash++; 1130| 1.08k| if (*slash == '\0') ------------------ | Branch (1130:6): [True: 2, False: 1.08k] ------------------ 1131| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 1132| | 1133| 1.08k| netmask = slash; 1134| | 1135| 1.08k| ret = lxc_safe_uint(netmask, &inet6dev->prefix); 1136| 1.08k| if (ret < 0 || inet6dev->prefix > 128) ------------------ | Branch (1136:6): [True: 5, False: 1.07k] | Branch (1136:17): [True: 41, False: 1.03k] ------------------ 1137| 46| return ret_errno(EINVAL); ------------------ | | 715| 46| ({ \ | | 716| 46| errno = labs(__errno__); \ | | 717| 46| -errno; \ | | 718| 46| }) ------------------ 1138| | 1139| 1.03k| ret = inet_pton(AF_INET6, valdup, &inet6dev->addr); 1140| 1.03k| if (!ret || ret < 0) ------------------ | Branch (1140:6): [True: 7, False: 1.03k] | Branch (1140:14): [True: 0, False: 1.03k] ------------------ 1141| 7| return ret_errno(EINVAL); ------------------ | | 715| 7| ({ \ | | 716| 7| errno = labs(__errno__); \ | | 717| 7| -errno; \ | | 718| 7| }) ------------------ 1142| | 1143| 1.03k| list_add_tail(&inet6dev->head, &netdev->priv.veth_attr.ipv6_routes); 1144| 1.03k| move_ptr(inet6dev); ------------------ | | 694| 1.03k| ({ \ | | 695| 1.03k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.03k| (ptr) = NULL; \ | | 697| 1.03k| __internal_ptr__; \ | | 698| 1.03k| }) ------------------ 1145| | 1146| 1.03k| return 0; 1147| 1.03k|} confile.c:clr_config_net_veth_ipv6_route: 5882| 595|{ 5883| 595| struct lxc_netdev *netdev = data; 5884| 595| struct lxc_inet6dev *inet6dev, *ninet6dev; 5885| | 5886| 595| if (!netdev) ------------------ | Branch (5886:6): [True: 0, False: 595] ------------------ 5887| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5888| | 5889| 595| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5889:6): [True: 194, False: 401] ------------------ 5890| 194| return 0; 5891| | 5892| 401| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->priv.veth_attr.ipv6_routes, head) { ------------------ | | 655| 401| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 401| list_entry((ptr)->next, type, 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))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 595| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 595| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 595| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 595|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 595| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 595| 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| 595| !__same_type(*(ptr), void), \ | | | | | | | | 813| 595| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 595| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 797| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 797| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 396, False: 401] | | ------------------ | | 658| 401| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 396| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 396| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 396|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 396| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 396| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 396|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 396| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 396| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 396| do { \ | | | | | | | | | | | | | | | | 286| 396| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 396] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 396| !__same_type(*(ptr), void), \ | | | | | | | | 813| 396| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 396| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 5893| 396| list_del(&inet6dev->head); 5894| 396| free(inet6dev); 5895| 396| } 5896| | 5897| 401| return 0; 5898| 595|} confile.c:set_config_net_veth_vlan_id: 668| 451|{ 669| 451| int ret; 670| 451| struct lxc_netdev *netdev = data; 671| | 672| 451| if (!netdev) ------------------ | Branch (672:6): [True: 0, False: 451] ------------------ 673| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 674| | 675| 451| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (675:6): [True: 4, False: 447] ------------------ 676| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 677| | 678| 447| if (lxc_config_value_empty(value)) ------------------ | Branch (678:6): [True: 0, False: 447] ------------------ 679| 0| return clr_config_net_veth_vlan_id(key, lxc_conf, data); 680| | 681| 447| if (strequal(value, "none")) { ------------------ | Branch (681:6): [True: 194, False: 253] ------------------ 682| 194| netdev->priv.veth_attr.vlan_id = BRIDGE_VLAN_NONE; ------------------ | | 596| 194|#define BRIDGE_VLAN_NONE -1 /* Bridge VLAN option set to "none". */ ------------------ 683| 253| } else { 684| 253| unsigned short vlan_id; 685| | 686| 253| ret = get_u16(&vlan_id, value, 0); 687| 253| if (ret < 0) ------------------ | Branch (687:7): [True: 29, False: 224] ------------------ 688| 29| return ret_errno(EINVAL); ------------------ | | 715| 29| ({ \ | | 716| 29| errno = labs(__errno__); \ | | 717| 29| -errno; \ | | 718| 29| }) ------------------ 689| | 690| 224| if (vlan_id > BRIDGE_VLAN_ID_MAX) ------------------ | | 600| 224|#define BRIDGE_VLAN_ID_MAX 4094 /* Bridge VLAN MAX VLAN ID. */ ------------------ | Branch (690:7): [True: 10, False: 214] ------------------ 691| 10| return ret_errno(EINVAL); ------------------ | | 715| 10| ({ \ | | 716| 10| errno = labs(__errno__); \ | | 717| 10| -errno; \ | | 718| 10| }) ------------------ 692| | 693| 214| netdev->priv.veth_attr.vlan_id = vlan_id; 694| 214| } 695| | 696| 408| netdev->priv.veth_attr.vlan_id_set = true; 697| 408| return 0; 698| 447|} confile.c:clr_config_net_veth_vlan_id: 5696| 395|{ 5697| 395| struct lxc_netdev *netdev = data; 5698| | 5699| 395| if (!netdev) ------------------ | Branch (5699:6): [True: 0, False: 395] ------------------ 5700| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5701| | 5702| 395| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5702:6): [True: 197, False: 198] ------------------ 5703| 197| return 0; 5704| | 5705| 198| netdev->priv.veth_attr.vlan_id = 0; 5706| 198| netdev->priv.veth_attr.vlan_id_set = false; 5707| | 5708| 198| return 0; 5709| 395|} confile.c:set_config_net_veth_vlan_tagged_id: 703| 1.05k|{ 704| 1.05k| __do_free struct lxc_list *list = NULL; ------------------ | | 69| 1.05k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.05k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 705| 1.05k| int ret; 706| 1.05k| unsigned short vlan_id; 707| 1.05k| struct lxc_netdev *netdev = data; 708| | 709| 1.05k| if (!netdev) ------------------ | Branch (709:6): [True: 0, False: 1.05k] ------------------ 710| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 711| | 712| 1.05k| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (712:6): [True: 5, False: 1.04k] ------------------ 713| 5| return ret_errno(EINVAL); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 714| | 715| 1.04k| if (lxc_config_value_empty(value)) ------------------ | Branch (715:6): [True: 0, False: 1.04k] ------------------ 716| 0| return clr_config_net_veth_vlan_tagged_id(key, lxc_conf, data); 717| | 718| 1.04k| ret = get_u16(&vlan_id, value, 0); 719| 1.04k| if (ret < 0) ------------------ | Branch (719:6): [True: 2, False: 1.04k] ------------------ 720| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 721| | 722| 1.04k| if (vlan_id > BRIDGE_VLAN_ID_MAX) ------------------ | | 600| 1.04k|#define BRIDGE_VLAN_ID_MAX 4094 /* Bridge VLAN MAX VLAN ID. */ ------------------ | Branch (722:6): [True: 4, False: 1.04k] ------------------ 723| 4| return ret_errno(EINVAL); ------------------ | | 715| 4| ({ \ | | 716| 4| errno = labs(__errno__); \ | | 717| 4| -errno; \ | | 718| 4| }) ------------------ 724| | 725| 1.04k| list = lxc_list_new(); 726| 1.04k| if (!list) ------------------ | Branch (726:6): [True: 0, False: 1.04k] ------------------ 727| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 728| | 729| 1.04k| list->elem = UINT_TO_PTR(vlan_id); ------------------ | | 681| 1.04k|#define UINT_TO_PTR(u) ((void *) ((uintptr_t) (u))) ------------------ 730| | 731| 1.04k| lxc_list_add_tail(&netdev->priv.veth_attr.vlan_tagged_ids, move_ptr(list)); ------------------ | | 694| 1.04k| ({ \ | | 695| 1.04k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.04k| (ptr) = NULL; \ | | 697| 1.04k| __internal_ptr__; \ | | 698| 1.04k| }) ------------------ 732| | 733| 1.04k| return 0; 734| 1.04k|} confile.c:clr_config_net_veth_vlan_tagged_id: 5713| 601|{ 5714| 601| struct lxc_netdev *netdev = data; 5715| 601| struct lxc_list *cur, *next; 5716| | 5717| 601| if (!netdev) ------------------ | Branch (5717:6): [True: 0, False: 601] ------------------ 5718| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 5719| | 5720| 601| if (netdev->type != LXC_NET_VETH) ------------------ | Branch (5720:6): [True: 197, False: 404] ------------------ 5721| 197| return 0; 5722| | 5723| 408| lxc_list_for_each_safe(cur, &netdev->priv.veth_attr.vlan_tagged_ids, next) { ------------------ | | 46| 404| for (__iterator = (__list)->next, __next = __iterator->next; \ | | 47| 812| __iterator != __list; __iterator = __next, __next = __next->next) | | ------------------ | | | Branch (47:7): [True: 408, False: 404] | | ------------------ ------------------ 5724| 408| lxc_list_del(cur); 5725| 408| free(cur); 5726| 408| } 5727| | 5728| 404| return 0; 5729| 601|} confile.c:match_config_net_item: 382| 417k|{ 383| 417k| if (entry->strict) ------------------ | Branch (383:6): [True: 417k, False: 0] ------------------ 384| 417k| return strequal(entry->name, key); 385| 0| return strnequal(entry->name, key, strlen(entry->name)); 386| 417k|} parse_idmaps: 34| 2.35k|{ 35| 2.35k| __do_free char *dup = NULL; ------------------ | | 69| 2.35k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 2.35k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 36| 2.35k| int ret = -1; 37| 2.35k| unsigned long tmp_hostid, tmp_nsid, tmp_range; 38| 2.35k| char tmp_type; 39| 2.35k| char *window, *slide; 40| | 41| | /* Duplicate string. */ 42| 2.35k| dup = strdup(idmap); 43| 2.35k| if (!dup) ------------------ | Branch (43:6): [True: 0, False: 2.35k] ------------------ 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.35k| slide = window = dup; 50| | /* skip whitespace */ 51| 2.35k| slide += strspn(slide, " \t\r"); 52| 2.35k| if (slide != window && *slide == '\0') ------------------ | Branch (52:6): [True: 219, False: 2.13k] | Branch (52:25): [True: 9, False: 210] ------------------ 53| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 54| | 55| | /* Validate type. */ 56| 2.34k| if (*slide != 'u' && *slide != 'g') ------------------ | Branch (56:6): [True: 1.04k, False: 1.30k] | Branch (56:23): [True: 38, False: 1.00k] ------------------ 57| 38| return log_error_errno(-EINVAL, EINVAL, "Invalid id mapping type: %c", *slide); ------------------ | | 486| 38| ({ \ | | 487| 38| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 38| errno = (__errno__); \ | | 489| 38| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 38| do { \ | | | | 454| 38| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 38| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 38| char *ptr = NULL; \ | | | | | | 317| 38| { \ | | | | | | 318| 38| int __saved_errno = errno; \ | | | | | | 319| 38| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 38| errno = __saved_errno; \ | | | | | | 321| 38| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 38] | | | | | | ------------------ | | | | | | 322| 38| ptr = errno_buf; \ | | | | | | 323| 38| } | | | | ------------------ | | | | 455| 38| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 38|#define ERROR(format, ...) do { \ | | | | | | 373| 38| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 38| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 38| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 38|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 38] | | | | | | ------------------ | | | | ------------------ | | | | 456| 38| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 38] | | | | ------------------ | | ------------------ | | 490| 38| __internal_ret__; \ | | 491| 38| }) ------------------ 58| | 59| | /* Assign type. */ 60| 2.30k| tmp_type = *slide; 61| | 62| | /* move beyond type */ 63| 2.30k| slide++; 64| | /* align */ 65| 2.30k| window = slide; 66| | /* Validate that only whitespace follows. */ 67| 2.30k| slide += strspn(slide, " \t\r"); 68| | /* There must be whitespace. */ 69| 2.30k| if (slide == window) ------------------ | Branch (69:6): [True: 12, False: 2.29k] ------------------ 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.29k| window = slide; 74| | /* Validate that non-whitespace follows. */ 75| 2.29k| slide += strcspn(slide, " \t\r"); 76| | /* There must be non-whitespace. */ 77| 2.29k| if (slide == window || *slide == '\0') ------------------ | Branch (77:6): [True: 1, False: 2.29k] | Branch (77:25): [True: 25, False: 2.26k] ------------------ 78| 26| return ret_errno(EINVAL); ------------------ | | 715| 26| ({ \ | | 716| 26| errno = labs(__errno__); \ | | 717| 26| -errno; \ | | 718| 26| }) ------------------ 79| | /* Mark end of nsid. */ 80| 2.26k| *slide = '\0'; 81| | 82| | /* Parse nsid. */ 83| 2.26k| ret = lxc_safe_ulong(window, &tmp_nsid); 84| 2.26k| if (ret < 0) ------------------ | Branch (84:6): [True: 30, False: 2.23k] ------------------ 85| 30| return log_error_errno(ret, errno, "Failed to parse nsid: %s", window); ------------------ | | 486| 30| ({ \ | | 487| 30| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 30| errno = (__errno__); \ | | 489| 30| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 30| do { \ | | | | 454| 30| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 30| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 30| char *ptr = NULL; \ | | | | | | 317| 30| { \ | | | | | | 318| 30| int __saved_errno = errno; \ | | | | | | 319| 30| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 30| errno = __saved_errno; \ | | | | | | 321| 30| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 30] | | | | | | ------------------ | | | | | | 322| 30| ptr = errno_buf; \ | | | | | | 323| 30| } | | | | ------------------ | | | | 455| 30| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 30|#define ERROR(format, ...) do { \ | | | | | | 373| 30| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 30| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 30| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 30|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 30] | | | | | | ------------------ | | | | ------------------ | | | | 456| 30| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 30] | | | | ------------------ | | ------------------ | | 490| 30| __internal_ret__; \ | | 491| 30| }) ------------------ 86| | 87| | /* Move beyond \0. */ 88| 2.23k| slide++; 89| | /* Validate that only whitespace follows. */ 90| 2.23k| 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.23k| if (*slide == '\0') ------------------ | Branch (94:6): [True: 1, False: 2.23k] ------------------ 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.23k| window = slide; 99| | /* Validate that non-whitespace follows. */ 100| 2.23k| slide += strcspn(slide, " \t\r"); 101| | /* There must be non-whitespace. */ 102| 2.23k| if (slide == window || *slide == '\0') ------------------ | Branch (102:6): [True: 0, False: 2.23k] | Branch (102:25): [True: 23, False: 2.21k] ------------------ 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.21k| *slide = '\0'; 106| | 107| | /* Parse hostid. */ 108| 2.21k| ret = lxc_safe_ulong(window, &tmp_hostid); 109| 2.21k| if (ret < 0) ------------------ | Branch (109:6): [True: 2, False: 2.21k] ------------------ 110| 2| return log_error_errno(ret, errno, "Failed to parse hostid: %s", window); ------------------ | | 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| }) ------------------ 111| | 112| | /* Move beyond \0. */ 113| 2.21k| slide++; 114| | /* Validate that only whitespace follows. */ 115| 2.21k| 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.21k| if (*slide == '\0') ------------------ | Branch (119:6): [True: 1, False: 2.21k] ------------------ 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.21k| window = slide; 124| | /* Validate that non-whitespace follows. */ 125| 2.21k| slide += strcspn(slide, " \t\r"); 126| | /* There must be non-whitespace. */ 127| 2.21k| if (slide == window) ------------------ | Branch (127:6): [True: 0, False: 2.21k] ------------------ 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.21k| if (*(slide + strspn(slide, " \t\r\n")) != '\0') ------------------ | Branch (133:6): [True: 6, False: 2.20k] ------------------ 134| 6| return ret_errno(EINVAL); ------------------ | | 715| 6| ({ \ | | 716| 6| errno = labs(__errno__); \ | | 717| 6| -errno; \ | | 718| 6| }) ------------------ 135| | 136| | /* Mark end of range. */ 137| 2.20k| *slide = '\0'; 138| | 139| | /* Parse range. */ 140| 2.20k| ret = lxc_safe_ulong(window, &tmp_range); 141| 2.20k| if (ret < 0) ------------------ | Branch (141:6): [True: 5, False: 2.20k] ------------------ 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.20k| *type = tmp_type; 145| 2.20k| *nsid = tmp_nsid; 146| 2.20k| *hostid = tmp_hostid; 147| 2.20k| *range = tmp_range; 148| | 149| | /* Yay, we survived. */ 150| 2.20k| return 0; 151| 2.20k|} lxc_config_value_empty: 154| 141k|{ 155| 141k| if (value && strlen(value) > 0) ------------------ | Branch (155:6): [True: 141k, False: 0] | Branch (155:15): [True: 106k, False: 34.2k] ------------------ 156| 106k| return false; 157| | 158| 34.2k| return true; 159| 141k|} lxc_get_netdev_by_idx: 189| 33.1k|{ 190| 33.1k| struct list_head *netdevs = &conf->netdevs; 191| 33.1k| struct list_head *head = netdevs; 192| 33.1k| struct lxc_netdev *netdev; 193| | 194| | /* lookup network */ 195| 33.1k| if (!list_empty(netdevs)) { ------------------ | Branch (195:6): [True: 29.6k, False: 3.45k] ------------------ 196| 35.3k| list_for_each_entry(netdev, netdevs, head) { ------------------ | | 568| 29.6k| for (pos = list_first_entry(head, typeof(*pos), member); \ | | ------------------ | | | | 462| 29.6k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 29.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 29.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 29.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 29.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 29.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 29.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 29.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 29.6k| do { \ | | | | | | | | | | | | | | | | 286| 29.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 29.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 29.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 29.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 29.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 569| 36.3k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 36.3k| (&pos->member == (head)) | | ------------------ | | | Branch (569:7): [True: 35.3k, False: 1.00k] | | ------------------ | | 570| 29.6k| pos = list_next_entry(pos, member)) | | ------------------ | | | | 495| 6.73k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 6.73k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 6.73k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 6.73k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 6.73k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 6.73k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 6.73k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 6.73k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 6.73k| do { \ | | | | | | | | | | | | | | | | 286| 6.73k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 6.73k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 6.73k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 6.73k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 6.73k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 197| | /* found network device */ 198| 35.3k| if (netdev->idx == idx) ------------------ | Branch (198:8): [True: 27.5k, False: 7.84k] ------------------ 199| 27.5k| return netdev; 200| | 201| 7.84k| if (netdev->idx > idx) { ------------------ | Branch (201:8): [True: 1.10k, False: 6.73k] ------------------ 202| 1.10k| head = &netdev->head; 203| 1.10k| break; 204| 1.10k| } 205| 7.84k| } 206| 29.6k| } 207| | 208| 5.56k| if (allocate) ------------------ | Branch (208:6): [True: 5.53k, False: 27] ------------------ 209| 5.53k| return lxc_network_add(head, idx, true); 210| | 211| 27| return NULL; 212| 5.56k|} lxc_clear_netdev: 393| 10.6k|{ 394| 10.6k| struct lxc_list *cur, *next; 395| 10.6k| struct list_head head; 396| 10.6k| struct lxc_inetdev *inetdev, *ninetdev; 397| 10.6k| struct lxc_inet6dev *inet6dev, *ninet6dev; 398| 10.6k| ssize_t idx; 399| | 400| 10.6k| if (!netdev) ------------------ | Branch (400:6): [True: 0, False: 10.6k] ------------------ 401| 0| return; 402| | 403| 10.6k| idx = netdev->idx; 404| | 405| 10.6k| free_disarm(netdev->upscript); ------------------ | | 58| 10.6k| ({ \ | | 59| 10.6k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 216, False: 10.4k] | | ------------------ | | 60| 216| free(ptr); \ | | 61| 216| ptr = NULL; \ | | 62| 216| } \ | | 63| 10.6k| }) ------------------ 406| 10.6k| free_disarm(netdev->downscript); ------------------ | | 58| 10.6k| ({ \ | | 59| 10.6k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 216, False: 10.4k] | | ------------------ | | 60| 216| free(ptr); \ | | 61| 216| ptr = NULL; \ | | 62| 216| } \ | | 63| 10.6k| }) ------------------ 407| 10.6k| free_disarm(netdev->hwaddr); ------------------ | | 58| 10.6k| ({ \ | | 59| 10.6k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 266, False: 10.4k] | | ------------------ | | 60| 266| free(ptr); \ | | 61| 266| ptr = NULL; \ | | 62| 266| } \ | | 63| 10.6k| }) ------------------ 408| 10.6k| free_disarm(netdev->mtu); ------------------ | | 58| 10.6k| ({ \ | | 59| 10.6k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 1.33k, False: 9.34k] | | ------------------ | | 60| 1.33k| free(ptr); \ | | 61| 1.33k| ptr = NULL; \ | | 62| 1.33k| } \ | | 63| 10.6k| }) ------------------ 409| | 410| 10.6k| free_disarm(netdev->ipv4_gateway); ------------------ | | 58| 10.6k| ({ \ | | 59| 10.6k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 201, False: 10.4k] | | ------------------ | | 60| 201| free(ptr); \ | | 61| 201| ptr = NULL; \ | | 62| 201| } \ | | 63| 10.6k| }) ------------------ 411| 10.6k| list_for_each_entry_safe(inetdev, ninetdev, &netdev->ipv4_addresses, head) { ------------------ | | 655| 10.6k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 10.6k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 10.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 10.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 10.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 10.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 10.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 10.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 10.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 10.6k| do { \ | | | | | | | | | | | | | | | | 286| 10.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 10.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 10.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 10.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 10.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 10.6k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 10.6k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 10.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 10.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 10.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 10.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 10.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 10.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 10.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 10.6k| do { \ | | | | | | | | | | | | | | | | 286| 10.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 10.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 10.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 10.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 10.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 12.5k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 12.5k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 1.83k, False: 10.6k] | | ------------------ | | 658| 10.6k| 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))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 412| 1.83k| list_del(&inetdev->head); 413| 1.83k| free(inetdev); 414| 1.83k| } 415| | 416| 10.6k| free_disarm(netdev->ipv6_gateway); ------------------ | | 58| 10.6k| ({ \ | | 59| 10.6k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 217, False: 10.4k] | | ------------------ | | 60| 217| free(ptr); \ | | 61| 217| ptr = NULL; \ | | 62| 217| } \ | | 63| 10.6k| }) ------------------ 417| 10.6k| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->ipv6_addresses, head) { ------------------ | | 655| 10.6k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 10.6k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 10.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 10.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 10.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 10.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 10.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 10.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 10.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 10.6k| do { \ | | | | | | | | | | | | | | | | 286| 10.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 10.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 10.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 10.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 10.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 10.6k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 10.6k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 10.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 10.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 10.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 10.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 10.6k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 10.6k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 10.6k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 10.6k| do { \ | | | | | | | | | | | | | | | | 286| 10.6k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 10.6k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 10.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 10.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 10.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 11.4k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 11.4k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 770, False: 10.6k] | | ------------------ | | 658| 10.6k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 770| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 770| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 770|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 770| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 770| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 770|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 770| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 770| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 770| do { \ | | | | | | | | | | | | | | | | 286| 770| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 770] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 770| !__same_type(*(ptr), void), \ | | | | | | | | 813| 770| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 770| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 418| 770| list_del(&inet6dev->head); 419| 770| free(inet6dev); 420| 770| } 421| | 422| 10.6k| if (netdev->type == LXC_NET_VETH) { ------------------ | Branch (422:6): [True: 1.44k, False: 9.24k] ------------------ 423| 1.44k| list_for_each_entry_safe(inetdev, ninetdev, &netdev->priv.veth_attr.ipv4_routes, head) { ------------------ | | 655| 1.44k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 1.44k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 1.44k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.44k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.44k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.44k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.44k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.44k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.44k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.44k| do { \ | | | | | | | | | | | | | | | | 286| 1.44k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.44k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.44k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.44k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.44k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 1.44k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 1.44k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.44k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.44k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.44k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.44k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.44k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.44k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.44k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.44k| do { \ | | | | | | | | | | | | | | | | 286| 1.44k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.44k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.44k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.44k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.44k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 2.07k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 2.07k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 635, False: 1.44k] | | ------------------ | | 658| 1.44k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 635| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 635| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 635|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 635| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 635| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 635|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 635| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 635| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 635| do { \ | | | | | | | | | | | | | | | | 286| 635| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 635] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 635| !__same_type(*(ptr), void), \ | | | | | | | | 813| 635| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 635| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 424| 635| list_del(&inetdev->head); 425| 635| free(inetdev); 426| 635| } 427| | 428| 1.44k| list_for_each_entry_safe(inet6dev, ninet6dev, &netdev->priv.veth_attr.ipv6_routes, head) { ------------------ | | 655| 1.44k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 1.44k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 1.44k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.44k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.44k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.44k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.44k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.44k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.44k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.44k| do { \ | | | | | | | | | | | | | | | | 286| 1.44k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.44k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.44k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.44k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.44k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 1.44k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 1.44k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 1.44k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 1.44k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 1.44k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 1.44k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 1.44k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 1.44k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 1.44k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 1.44k| do { \ | | | | | | | | | | | | | | | | 286| 1.44k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 1.44k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 1.44k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 1.44k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 1.44k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 2.07k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 2.07k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 635, False: 1.44k] | | ------------------ | | 658| 1.44k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 635| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 635| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 635|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 635| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 635| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 635|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 635| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 635| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 635| do { \ | | | | | | | | | | | | | | | | 286| 635| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 635] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 635| !__same_type(*(ptr), void), \ | | | | | | | | 813| 635| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 635| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 429| 635| list_del(&inet6dev->head); 430| 635| free(inet6dev); 431| 635| } 432| | 433| 1.44k| lxc_list_for_each_safe(cur, &netdev->priv.veth_attr.vlan_tagged_ids, next) { ------------------ | | 46| 1.44k| for (__iterator = (__list)->next, __next = __iterator->next; \ | | 47| 2.07k| __iterator != __list; __iterator = __next, __next = __next->next) | | ------------------ | | | Branch (47:7): [True: 634, False: 1.44k] | | ------------------ ------------------ 434| 634| lxc_list_del(cur); 435| 634| free(cur); 436| 634| } 437| 9.24k| } else if (netdev->type == LXC_NET_PHYS) { ------------------ | Branch (437:13): [True: 1.51k, False: 7.73k] ------------------ 438| 1.51k| free_string_list(netdev->priv.phys_attr.altnames); 439| 1.51k| netdev->priv.phys_attr.altnames = NULL; 440| 1.51k| } 441| | 442| 10.6k| head = netdev->head; 443| 10.6k| memset(netdev, 0, sizeof(struct lxc_netdev)); 444| 10.6k| netdev->head = head; 445| 10.6k| INIT_LIST_HEAD(&netdev->ipv4_addresses); 446| 10.6k| INIT_LIST_HEAD(&netdev->ipv6_addresses); 447| 10.6k| netdev->type = -1; 448| 10.6k| netdev->idx = idx; 449| 10.6k|} lxc_remove_nic_by_idx: 460| 726|{ 461| 726| struct lxc_netdev *netdev; 462| | 463| 726| if (list_empty(&conf->netdevs)) ------------------ | Branch (463:6): [True: 289, False: 437] ------------------ 464| 289| return false; 465| | 466| 587| list_for_each_entry(netdev, &conf->netdevs, head) { ------------------ | | 568| 726| for (pos = list_first_entry(head, typeof(*pos), member); \ | | ------------------ | | | | 462| 726| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 726| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 726|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 726| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 726| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 437|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 437| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 437| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 437| do { \ | | | | | | | | | | | | | | | | 286| 437| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 437] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 726| !__same_type(*(ptr), void), \ | | | | | | | | 813| 726| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 726| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 569| 826| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 826| (&pos->member == (head)) | | ------------------ | | | Branch (569:7): [True: 587, False: 239] | | ------------------ | | 570| 437| pos = list_next_entry(pos, member)) | | ------------------ | | | | 495| 389| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 389| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 389|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 389| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 389| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 389|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 389| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 389| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 389| do { \ | | | | | | | | | | | | | | | | 286| 389| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 389] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 389| !__same_type(*(ptr), void), \ | | | | | | | | 813| 389| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 389| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 467| 587| if (netdev->idx != idx) ------------------ | Branch (467:7): [True: 389, False: 198] ------------------ 468| 389| continue; 469| | 470| 198| list_del(&netdev->head); 471| 198| lxc_free_netdev(netdev); 472| 198| return true; 473| 587| } 474| | 475| 239| return false; 476| 437|} lxc_free_networks: 479| 13.6k|{ 480| 13.6k| struct lxc_netdev *netdev, *n; 481| | 482| 13.6k| if (list_empty(&conf->netdevs)) ------------------ | Branch (482:6): [True: 10.4k, False: 3.23k] ------------------ 483| 10.4k| return; 484| | 485| 5.33k| list_for_each_entry_safe(netdev, n, &conf->netdevs, head) { ------------------ | | 655| 3.23k| for (pos = list_first_entry(head, typeof(*pos), member), \ | | ------------------ | | | | 462| 3.23k| list_entry((ptr)->next, type, member) | | | | ------------------ | | | | | | 451| 3.23k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 3.23k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 3.23k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 3.23k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 3.23k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 3.23k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 3.23k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 3.23k| do { \ | | | | | | | | | | | | | | | | 286| 3.23k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 3.23k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 3.23k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 3.23k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 3.23k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 656| 13.6k| n = list_next_entry(pos, member); \ | | ------------------ | | | | 495| 13.6k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 13.6k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 13.6k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 13.6k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 13.6k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 3.23k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 3.23k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 3.23k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 3.23k| do { \ | | | | | | | | | | | | | | | | 286| 3.23k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 3.23k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 13.6k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 13.6k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 13.6k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ | | 657| 8.57k| !list_entry_is_head(pos, head, member); \ | | ------------------ | | | | 559| 8.57k| (&pos->member == (head)) | | ------------------ | | | Branch (657:7): [True: 5.33k, False: 3.23k] | | ------------------ | | 658| 5.33k| pos = n, n = list_next_entry(n, member)) | | ------------------ | | | | 495| 5.33k| list_entry((pos)->member.next, typeof(*(pos)), member) | | | | ------------------ | | | | | | 451| 5.33k| container_of(ptr, type, member) | | | | | | ------------------ | | | | | | | | 809| 5.33k|#define container_of(ptr, type, member) ({ \ | | | | | | | | 810| 5.33k| void *__mptr = (void *)(ptr); \ | | | | | | | | 811| 5.33k| BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ | | | | | | | | ------------------ | | | | | | | | | | 310| 5.33k|#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | | | | | | | | | | ------------------ | | | | | | | | | | | | 301| 5.33k| _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | 289| 5.33k| __compiletime_assert(condition, msg, prefix, suffix) | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | 285| 5.33k| do { \ | | | | | | | | | | | | | | | | 286| 5.33k| } while (0) | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | | | | Branch (286:11): [Folded, False: 5.33k] | | | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | | | ------------------ | | | | | | | | | | | | ------------------ | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | | | 812| 5.33k| !__same_type(*(ptr), void), \ | | | | | | | | 813| 5.33k| "pointer type mismatch in container_of()"); \ | | | | | | | | 814| 5.33k| ((type *)(__mptr - offsetof(type, member))); }) | | | | | | ------------------ | | | | ------------------ | | ------------------ ------------------ 486| 5.33k| list_del(&netdev->head); 487| 5.33k| lxc_free_netdev(netdev); 488| 5.33k| } 489| | 490| | /* prevent segfaults */ 491| 3.23k| INIT_LIST_HEAD(&conf->netdevs); 492| 3.23k|} lxc_veth_mode_to_flag: 503| 1.67k|{ 504| 1.96k| for (size_t i = 0; i < sizeof(veth_mode) / sizeof(veth_mode[0]); i++) { ------------------ | Branch (504:21): [True: 1.91k, False: 50] ------------------ 505| 1.91k| if (!strequal(veth_mode[i].name, value)) ------------------ | Branch (505:7): [True: 286, False: 1.62k] ------------------ 506| 286| continue; 507| | 508| 1.62k| *mode = veth_mode[i].mode; 509| 1.62k| return 0; 510| 1.91k| } 511| | 512| 50| return ret_errno(EINVAL); ------------------ | | 715| 50| ({ \ | | 716| 50| errno = labs(__errno__); \ | | 717| 50| -errno; \ | | 718| 50| }) ------------------ 513| 1.67k|} lxc_veth_flag_to_mode: 516| 1.44k|{ 517| 4.32k| for (size_t i = 0; i < sizeof(veth_mode) / sizeof(veth_mode[0]); i++) { ------------------ | Branch (517:21): [True: 2.88k, False: 1.44k] ------------------ 518| 2.88k| if (veth_mode[i].mode != mode) ------------------ | Branch (518:7): [True: 2.88k, False: 0] ------------------ 519| 2.88k| continue; 520| | 521| 0| return veth_mode[i].name; 522| 2.88k| } 523| | 524| 1.44k| return ret_set_errno(NULL, EINVAL); ------------------ | | 708| 1.44k| ({ \ | | 709| 1.44k| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 710| 1.44k| errno = (__errno__); \ | | 711| 1.44k| __internal_ret__; \ | | 712| 1.44k| }) ------------------ 525| 1.44k|} lxc_macvlan_mode_to_flag: 538| 915|{ 539| 1.55k| for (size_t i = 0; i < sizeof(macvlan_mode) / sizeof(macvlan_mode[0]); i++) { ------------------ | Branch (539:21): [True: 1.48k, False: 68] ------------------ 540| 1.48k| if (!strequal(macvlan_mode[i].name, value)) ------------------ | Branch (540:7): [True: 639, False: 847] ------------------ 541| 639| continue; 542| | 543| 847| *mode = macvlan_mode[i].mode; 544| 847| return 0; 545| 1.48k| } 546| | 547| 68| return ret_errno(EINVAL); ------------------ | | 715| 68| ({ \ | | 716| 68| errno = labs(__errno__); \ | | 717| 68| -errno; \ | | 718| 68| }) ------------------ 548| 915|} lxc_macvlan_flag_to_mode: 551| 599|{ 552| 2.99k| for (size_t i = 0; i < sizeof(macvlan_mode) / sizeof(macvlan_mode[0]); i++) { ------------------ | Branch (552:21): [True: 2.39k, False: 599] ------------------ 553| 2.39k| if (macvlan_mode[i].mode != mode) ------------------ | Branch (553:7): [True: 2.39k, False: 0] ------------------ 554| 2.39k| continue; 555| | 556| 0| return macvlan_mode[i].name; 557| 2.39k| } 558| | 559| 599| return ret_set_errno(NULL, EINVAL); ------------------ | | 708| 599| ({ \ | | 709| 599| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 710| 599| errno = (__errno__); \ | | 711| 599| __internal_ret__; \ | | 712| 599| }) ------------------ 560| 599|} lxc_ipvlan_mode_to_flag: 572| 346|{ 573| 996| for (size_t i = 0; i < sizeof(ipvlan_mode) / sizeof(ipvlan_mode[0]); i++) { ------------------ | Branch (573:21): [True: 973, False: 23] ------------------ 574| 973| if (!strequal(ipvlan_mode[i].name, value)) ------------------ | Branch (574:7): [True: 650, False: 323] ------------------ 575| 650| continue; 576| | 577| 323| *mode = ipvlan_mode[i].mode; 578| 323| return 0; 579| 973| } 580| | 581| 23| return ret_errno(EINVAL); ------------------ | | 715| 23| ({ \ | | 716| 23| errno = labs(__errno__); \ | | 717| 23| -errno; \ | | 718| 23| }) ------------------ 582| 346|} lxc_ipvlan_flag_to_mode: 585| 395|{ 586| 1.18k| for (size_t i = 0; i < sizeof(ipvlan_mode) / sizeof(ipvlan_mode[0]); i++) { ------------------ | Branch (586:21): [True: 1.18k, False: 0] ------------------ 587| 1.18k| if (ipvlan_mode[i].mode != mode) ------------------ | Branch (587:7): [True: 790, False: 395] ------------------ 588| 790| continue; 589| | 590| 395| return ipvlan_mode[i].name; 591| 1.18k| } 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| 395|} lxc_ipvlan_isolation_to_flag: 606| 337|{ 607| 1.07k| for (size_t i = 0; i < sizeof(ipvlan_isolation) / sizeof(ipvlan_isolation[0]); i++) { ------------------ | Branch (607:21): [True: 1.00k, False: 64] ------------------ 608| 1.00k| if (!strequal(ipvlan_isolation[i].name, value)) ------------------ | Branch (608:7): [True: 736, False: 273] ------------------ 609| 736| continue; 610| | 611| 273| *flag = ipvlan_isolation[i].flag; 612| 273| return 0; 613| 1.00k| } 614| | 615| 64| return ret_errno(EINVAL); ------------------ | | 715| 64| ({ \ | | 716| 64| errno = labs(__errno__); \ | | 717| 64| -errno; \ | | 718| 64| }) ------------------ 616| 337|} lxc_ipvlan_flag_to_isolation: 619| 395|{ 620| 395| for (size_t i = 0; i < sizeof(ipvlan_isolation) / sizeof(ipvlan_isolation[0]); i++) { ------------------ | Branch (620:21): [True: 395, False: 0] ------------------ 621| 395| if (ipvlan_isolation[i].flag != flag) ------------------ | Branch (621:7): [True: 0, False: 395] ------------------ 622| 0| continue; 623| | 624| 395| return ipvlan_isolation[i].name; 625| 395| } 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| 395|} set_config_string_item: 631| 14.9k|{ 632| 14.9k| char *new_value; 633| | 634| 14.9k| if (lxc_config_value_empty(value)) { ------------------ | Branch (634:6): [True: 1.72k, False: 13.1k] ------------------ 635| 1.72k| free_disarm(*conf_item); ------------------ | | 58| 1.72k| ({ \ | | 59| 1.72k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 289, False: 1.43k] | | ------------------ | | 60| 289| free(ptr); \ | | 61| 289| ptr = NULL; \ | | 62| 289| } \ | | 63| 1.72k| }) ------------------ 636| 1.72k| return 0; 637| 1.72k| } 638| | 639| 13.1k| new_value = strdup(value); 640| 13.1k| if (!new_value) ------------------ | Branch (640:6): [True: 0, False: 13.1k] ------------------ 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| 13.1k| free_move_ptr(*conf_item, new_value); ------------------ | | 93| 13.1k| ({ \ | | 94| 13.1k| free(a); \ | | 95| 13.1k| (a) = move_ptr((b)); \ | | ------------------ | | | | 694| 13.1k| ({ \ | | | | 695| 13.1k| typeof(ptr) __internal_ptr__ = (ptr); \ | | | | 696| 13.1k| (ptr) = NULL; \ | | | | 697| 13.1k| __internal_ptr__; \ | | | | 698| 13.1k| }) | | ------------------ | | 96| 13.1k| }) ------------------ 644| 13.1k| return 0; 645| 13.1k|} set_config_string_item_max: 648| 6.53k|{ 649| 6.53k| if (strlen(value) >= max) ------------------ | Branch (649:6): [True: 18, False: 6.51k] ------------------ 650| 18| return log_error_errno(-ENAMETOOLONG, ENAMETOOLONG, "%s is too long (>= %lu)", value, (unsigned long)max); ------------------ | | 486| 18| ({ \ | | 487| 18| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 18| errno = (__errno__); \ | | 489| 18| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 18| do { \ | | | | 454| 18| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 18| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 18| char *ptr = NULL; \ | | | | | | 317| 18| { \ | | | | | | 318| 18| int __saved_errno = errno; \ | | | | | | 319| 18| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 18| errno = __saved_errno; \ | | | | | | 321| 18| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 18] | | | | | | ------------------ | | | | | | 322| 18| ptr = errno_buf; \ | | | | | | 323| 18| } | | | | ------------------ | | | | 455| 18| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 18|#define ERROR(format, ...) do { \ | | | | | | 373| 18| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 18| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 18| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 18|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 18] | | | | | | ------------------ | | | | ------------------ | | | | 456| 18| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 18] | | | | ------------------ | | ------------------ | | 490| 18| __internal_ret__; \ | | 491| 18| }) ------------------ 651| | 652| 6.51k| return set_config_string_item(conf_item, value); 653| 6.53k|} set_config_path_item: 656| 6.32k|{ 657| 6.32k| __do_free char *valdup = NULL; ------------------ | | 69| 6.32k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 6.32k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 658| | 659| 6.32k| valdup = lxc_path_simplify(value); 660| 6.32k| if (!valdup) ------------------ | Branch (660:6): [True: 0, False: 6.32k] ------------------ 661| 0| return -ENOMEM; 662| | 663| 6.32k| return set_config_string_item_max(conf_item, valdup, PATH_MAX); 664| 6.32k|} set_config_bool_item: 667| 982|{ 668| 982| int ret; 669| 982| unsigned int val = 0; 670| | 671| 982| if (lxc_config_value_empty(value)) { ------------------ | Branch (671:6): [True: 581, False: 401] ------------------ 672| 581| *conf_item = empty_conf_action; 673| 581| return 0; 674| 581| } 675| | 676| 401| ret = lxc_safe_uint(value, &val); 677| 401| if (ret < 0) ------------------ | Branch (677:6): [True: 6, False: 395] ------------------ 678| 6| return ret; 679| | 680| 395| switch (val) { ------------------ | Branch (680:10): [True: 393, False: 2] ------------------ 681| 195| case 0: ------------------ | Branch (681:2): [True: 195, False: 200] ------------------ 682| 195| *conf_item = false; 683| 195| return 0; 684| 198| case 1: ------------------ | Branch (684:2): [True: 198, False: 197] ------------------ 685| 198| *conf_item = true; 686| 198| return 0; 687| 395| } 688| | 689| 2| return ret_errno(EINVAL); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 690| 395|} config_ip_prefix: 693| 1.85k|{ 694| 1.85k| if (IN_CLASSA(addr->s_addr)) ------------------ | Branch (694:6): [True: 935, False: 919] ------------------ 695| 935| return 32 - IN_CLASSA_NSHIFT; 696| | 697| 919| if (IN_CLASSB(addr->s_addr)) ------------------ | Branch (697:6): [True: 234, False: 685] ------------------ 698| 234| return 32 - IN_CLASSB_NSHIFT; 699| | 700| 685| if (IN_CLASSC(addr->s_addr)) ------------------ | Branch (700:6): [True: 464, False: 221] ------------------ 701| 464| return 32 - IN_CLASSC_NSHIFT; 702| | 703| 221| return 0; 704| 685|} network_ifname: 707| 2.72k|{ 708| 2.72k| size_t retlen; 709| | 710| 2.72k| if (!valuep || !value) ------------------ | Branch (710:6): [True: 0, False: 2.72k] | Branch (710:17): [True: 0, False: 2.72k] ------------------ 711| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 712| | 713| 2.72k| retlen = strlcpy(valuep, value, size); 714| 2.72k| if (retlen >= size) ------------------ | Branch (714:6): [True: 423, False: 2.29k] ------------------ 715| 423| ERROR("Network device name \"%s\" is too long (>= %zu)", value, size); ------------------ | | 372| 423|#define ERROR(format, ...) do { \ | | 373| 423| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 423| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 423| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 423|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 423] | | ------------------ ------------------ 716| | 717| 2.72k| return 0; 718| 2.72k|} lxc_config_net_is_hwaddr: 721| 115k|{ 722| 115k| unsigned index; 723| 115k| char tmp[7]; 724| | 725| 115k| if (!strnequal(line, "lxc.net", 7)) ------------------ | Branch (725:6): [True: 79.8k, False: 35.8k] ------------------ 726| 79.8k| return false; 727| | 728| 35.8k| if (strnequal(line, "lxc.net.hwaddr", 14)) ------------------ | Branch (728:6): [True: 74, False: 35.8k] ------------------ 729| 74| return true; 730| | 731| 35.8k| if (strnequal(line, "lxc.network.hwaddr", 18)) ------------------ | Branch (731:6): [True: 2, False: 35.8k] ------------------ 732| 2| return true; 733| | 734| 35.8k| if (sscanf(line, "lxc.net.%u.%6s", &index, tmp) == 2 || ------------------ | Branch (734:6): [True: 33.0k, False: 2.73k] ------------------ 735| 2.73k| sscanf(line, "lxc.network.%u.%6s", &index, tmp) == 2) ------------------ | Branch (735:6): [True: 1, False: 2.73k] ------------------ 736| 33.0k| return strnequal(tmp, "hwaddr", 6); 737| | 738| 2.73k| return false; 739| 35.8k|} rand_complete_hwaddr: 742| 2.16k|{ 743| 2.16k| const char hex[] = "0123456789abcdef"; 744| 2.16k| char *curs = hwaddr; 745| 2.16k|#ifdef HAVE_RAND_R 746| 2.16k| unsigned int seed; 747| | 748| 2.16k| seed = randseed(false); 749| |#else 750| | 751| | (void)randseed(true); 752| |#endif 753| | 754| 25.7k| while (*curs != '\0' && *curs != '\n') { ------------------ | Branch (754:9): [True: 23.5k, False: 2.16k] | Branch (754:26): [True: 23.5k, False: 0] ------------------ 755| 23.5k| if (*curs == 'x' || *curs == 'X') { ------------------ | Branch (755:7): [True: 1.01k, False: 22.5k] | Branch (755:23): [True: 646, False: 21.9k] ------------------ 756| 1.66k| if (curs - hwaddr == 1) { ------------------ | Branch (756:8): [True: 482, False: 1.18k] ------------------ 757| | /* ensure address is unicast */ 758| 482|#ifdef HAVE_RAND_R 759| 482| *curs = hex[rand_r(&seed) & 0x0E]; 760| 1.18k| } else { 761| 1.18k| *curs = hex[rand_r(&seed) & 0x0F]; 762| |#else 763| | *curs = hex[rand() & 0x0E]; 764| | } else { 765| | *curs = hex[rand() & 0x0F]; 766| |#endif 767| 1.18k| } 768| 1.66k| } 769| 23.5k| curs++; 770| 23.5k| } 771| 2.16k|} sig_parse: 1064| 1.84k|{ 1065| 1.84k| if (isdigit(*signame)) ------------------ | Branch (1065:6): [True: 1.00k, False: 837] ------------------ 1066| 1.00k| return sig_num(signame); 1067| | 1068| 837| if (strncasecmp(signame, "sig", STRLITERALLEN("sig")) == 0) { ------------------ | | 687| 837|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1068:6): [True: 795, False: 42] ------------------ 1069| 795| signame += STRLITERALLEN("sig"); ------------------ | | 687| 795|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1070| 795| if (strncasecmp(signame, "rt", STRLITERALLEN("rt")) == 0) ------------------ | | 687| 795|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1070:7): [True: 538, False: 257] ------------------ 1071| 538| return rt_sig_num(signame + STRLITERALLEN("rt")); ------------------ | | 687| 538|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1072| | 1073| 8.05k| for (size_t n = 0; n < ARRAY_SIZE(signames); n++) ------------------ | | 728| 8.05k| (__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \ | | 729| 8.05k| typeof(&*(x))), \ | | 730| 8.05k| sizeof(x) / sizeof((x)[0]), ((void)0))) ------------------ | Branch (1073:22): [True: 8.00k, False: 54] ------------------ 1074| 8.00k| if (strcasecmp(signames[n].name, signame) == 0) ------------------ | Branch (1074:8): [True: 203, False: 7.79k] ------------------ 1075| 203| return signames[n].num; 1076| 257| } 1077| | 1078| 96| return ret_errno(EINVAL); ------------------ | | 715| 96| ({ \ | | 716| 96| errno = labs(__errno__); \ | | 717| 96| -errno; \ | | 718| 96| }) ------------------ 1079| 837|} confile_utils.c:lxc_network_add: 162| 5.53k|{ 163| 5.53k| __do_free struct lxc_netdev *netdev = NULL; ------------------ | | 69| 5.53k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 5.53k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 164| | 165| | /* network does not exist */ 166| 5.53k| netdev = zalloc(sizeof(*netdev)); ------------------ | | 90| 5.53k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 167| 5.53k| if (!netdev) ------------------ | Branch (167:6): [True: 0, False: 5.53k] ------------------ 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.53k| INIT_LIST_HEAD(&netdev->ipv4_addresses); 171| 5.53k| INIT_LIST_HEAD(&netdev->ipv6_addresses); 172| | 173| | /* give network a unique index */ 174| 5.53k| netdev->idx = idx; 175| | 176| 5.53k| if (tail) ------------------ | Branch (176:6): [True: 5.53k, False: 0] ------------------ 177| 5.53k| list_add_tail(&netdev->head, head); 178| 0| else 179| 0| list_add(&netdev->head, head); 180| | 181| | return move_ptr(netdev); ------------------ | | 694| 5.53k| ({ \ | | 695| 5.53k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 5.53k| (ptr) = NULL; \ | | 697| 5.53k| __internal_ptr__; \ | | 698| 5.53k| }) ------------------ 182| 5.53k|} confile_utils.c:lxc_free_netdev: 452| 5.53k|{ 453| 5.53k| if (netdev) { ------------------ | Branch (453:6): [True: 5.53k, False: 0] ------------------ 454| 5.53k| lxc_clear_netdev(netdev); 455| 5.53k| free(netdev); 456| 5.53k| } 457| 5.53k|} confile_utils.c:sig_num: 1019| 1.48k|{ 1020| 1.48k| int ret; 1021| 1.48k| unsigned int signum; 1022| | 1023| 1.48k| ret = lxc_safe_uint(sig, &signum); 1024| 1.48k| if (ret < 0) ------------------ | Branch (1024:6): [True: 5, False: 1.48k] ------------------ 1025| 5| return ret; 1026| | 1027| 1.48k| return signum; 1028| 1.48k|} confile_utils.c:rt_sig_num: 1031| 538|{ 1032| 538| bool rtmax; 1033| 538| int sig_n = 0; 1034| | 1035| 538| if (is_empty_string(signame)) ------------------ | Branch (1035:6): [True: 1, False: 537] ------------------ 1036| 1| return ret_errno(EINVAL); ------------------ | | 715| 1| ({ \ | | 716| 1| errno = labs(__errno__); \ | | 717| 1| -errno; \ | | 718| 1| }) ------------------ 1037| | 1038| 537| if (strncasecmp(signame, "max-", STRLITERALLEN("max-")) == 0) { ------------------ | | 687| 537|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1038:6): [True: 232, False: 305] ------------------ 1039| 232| rtmax = true; 1040| 232| signame += STRLITERALLEN("max-"); ------------------ | | 687| 232|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1041| 305| } else if (strncasecmp(signame, "min+", STRLITERALLEN("min+")) == 0) { ------------------ | | 687| 305|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ | Branch (1041:13): [True: 258, False: 47] ------------------ 1042| 258| rtmax = false; 1043| 258| signame += STRLITERALLEN("min+"); ------------------ | | 687| 258|#define STRLITERALLEN(x) (sizeof(""x"") - 1) ------------------ 1044| 258| } else { 1045| 47| return ret_errno(EINVAL); ------------------ | | 715| 47| ({ \ | | 716| 47| errno = labs(__errno__); \ | | 717| 47| -errno; \ | | 718| 47| }) ------------------ 1046| 47| } 1047| | 1048| 490| if (is_empty_string(signame) || !isdigit(*signame)) ------------------ | Branch (1048:6): [True: 8, False: 482] | Branch (1048:34): [True: 1, False: 481] ------------------ 1049| 9| return ret_errno(EINVAL); ------------------ | | 715| 9| ({ \ | | 716| 9| errno = labs(__errno__); \ | | 717| 9| -errno; \ | | 718| 9| }) ------------------ 1050| | 1051| 481| sig_n = sig_num(signame); 1052| 481| if (sig_n < 0 || sig_n > SIGRTMAX - SIGRTMIN) ------------------ | Branch (1052:6): [True: 27, False: 454] | Branch (1052:19): [True: 50, False: 404] ------------------ 1053| 77| return ret_errno(EINVAL); ------------------ | | 715| 77| ({ \ | | 716| 77| errno = labs(__errno__); \ | | 717| 77| -errno; \ | | 718| 77| }) ------------------ 1054| | 1055| 404| if (rtmax) ------------------ | Branch (1055:6): [True: 197, False: 207] ------------------ 1056| 197| sig_n = SIGRTMAX - sig_n; 1057| 207| else 1058| 207| sig_n = SIGRTMIN + sig_n; 1059| | 1060| 404| return sig_n; 1061| 481|} conf.c:IS_ERR_OR_NULL: 32| 137k|{ 33| 137k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 4.22k|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 141k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 4.22k] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 133k, False: 4.22k] ------------------ 34| 137k|} confile.c:IS_ERR_OR_NULL: 32| 456k|{ 33| 456k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 406k|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 862k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 406k] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 49.8k, False: 406k] ------------------ 34| 456k|} confile_utils.c:IS_ERR_OR_NULL: 32| 80.0k|{ 33| 80.0k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 11.4k|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 91.4k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 11.4k] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 68.6k, False: 11.4k] ------------------ 34| 80.0k|} log.c:IS_ERR_OR_NULL: 32| 8.18k|{ 33| 8.18k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 1.32k|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 9.50k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 1.32k] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 6.85k, False: 1.32k] ------------------ 34| 8.18k|} string_utils.c:IS_ERR_OR_NULL: 32| 6.32k|{ 33| 6.32k| return !ptr || IS_ERR_VALUE((unsigned long)ptr); ------------------ | | 14| 0|#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) | | ------------------ | | | | 40| 6.32k|#define unlikely(x) __builtin_expect(!!(x), 0) | | | | ------------------ | | | | | Branch (40:21): [True: 0, False: 0] | | | | ------------------ | | ------------------ ------------------ | Branch (33:9): [True: 6.32k, False: 0] ------------------ 34| 6.32k|} lxc_write_nointr: 237| 55.5k|{ 238| 55.5k| ssize_t ret; 239| | 240| 55.5k| do { 241| 55.5k| ret = write(fd, buf, count); 242| 55.5k| } while (ret < 0 && errno == EINTR); ------------------ | Branch (242:11): [True: 0, False: 55.5k] | Branch (242:22): [True: 0, False: 0] ------------------ 243| | 244| 55.5k| return ret; 245| 55.5k|} lxc_read_nointr: 270| 43.4k|{ 271| 43.4k| ssize_t ret; 272| | 273| 43.4k| do { 274| 43.4k| ret = read(fd, buf, count); 275| 43.4k| } while (ret < 0 && errno == EINTR); ------------------ | Branch (275:11): [True: 0, False: 43.4k] | Branch (275:22): [True: 0, False: 0] ------------------ 276| | 277| 43.4k| return ret; 278| 43.4k|} lxc_is_dir: 365| 872|{ 366| 872| int ret; 367| 872| struct stat statbuf; 368| | 369| 872| ret = stat(path, &statbuf); 370| 872| if (ret == 0 && S_ISDIR(statbuf.st_mode)) ------------------ | Branch (370:6): [True: 852, False: 20] | Branch (370:18): [True: 530, False: 322] ------------------ 371| 530| return 1; 372| | 373| 342| return 0; 374| 872|} lxc_make_tmpfile: 397| 12.0k|{ 398| 12.0k| __do_close int fd = -EBADF; ------------------ | | 49| 12.0k|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 12.0k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 399| 12.0k| int ret; 400| 12.0k| mode_t msk; 401| | 402| 12.0k| msk = umask(0022); 403| 12.0k| fd = mkstemp(template); 404| 12.0k| umask(msk); 405| 12.0k| if (fd < 0) ------------------ | Branch (405:6): [True: 0, False: 12.0k] ------------------ 406| 0| return -1; 407| | 408| 12.0k| if (lxc_set_cloexec(fd)) ------------------ | Branch (408:6): [True: 0, False: 12.0k] ------------------ 409| 0| return -1; 410| | 411| 12.0k| if (!rm) ------------------ | Branch (411:6): [True: 12.0k, False: 0] ------------------ 412| 12.0k| return move_fd(fd); ------------------ | | 701| 12.0k| ({ \ | | 702| 12.0k| int __internal_fd__ = (fd); \ | | 703| 12.0k| (fd) = -EBADF; \ | | 704| 12.0k| __internal_fd__; \ | | 705| 12.0k| }) ------------------ 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| 19.5k|{ 502| 19.5k| ssize_t total_bytes = 0; 503| | 504| 43.4k| for (;;) { 505| 43.4k| uint8_t buf[PATH_MAX]; 506| 43.4k| uint8_t *p = buf; 507| 43.4k| ssize_t bytes_to_write; 508| 43.4k| ssize_t bytes_read; 509| | 510| 43.4k| bytes_read = lxc_read_nointr(from, buf, sizeof buf); 511| 43.4k| if (bytes_read < 0) ------------------ | Branch (511:7): [True: 0, False: 43.4k] ------------------ 512| 0| return -1; 513| 43.4k| if (bytes_read == 0) ------------------ | Branch (513:7): [True: 19.5k, False: 23.8k] ------------------ 514| 19.5k| break; 515| | 516| 23.8k| bytes_to_write = (size_t)bytes_read; 517| 23.8k| total_bytes += bytes_read; 518| 23.8k| do { 519| 23.8k| ssize_t bytes_written; 520| | 521| 23.8k| bytes_written = lxc_write_nointr(to, p, bytes_to_write); 522| 23.8k| if (bytes_written < 0) ------------------ | Branch (522:8): [True: 0, False: 23.8k] ------------------ 523| 0| return -1; 524| | 525| 23.8k| bytes_to_write -= bytes_written; 526| 23.8k| p += bytes_written; 527| 23.8k| } while (bytes_to_write > 0); ------------------ | Branch (527:12): [True: 0, False: 23.8k] ------------------ 528| 23.8k| } 529| | 530| 19.5k| return total_bytes; 531| 19.5k|} conf.c:INIT_LIST_HEAD: 49| 571k|{ 50| 571k| list->next = list; 51| 571k| list->prev = list; 52| 571k|} conf.c:list_del: 122| 10.4k|{ 123| 10.4k| __list_del_entry(entry); 124| 10.4k| entry->next = LIST_POISON1; ------------------ | | 23| 10.4k|#define LIST_POISON1 ((void *) 0x100) ------------------ 125| 10.4k| entry->prev = LIST_POISON2; ------------------ | | 24| 10.4k|#define LIST_POISON2 ((void *) 0x122) ------------------ 126| 10.4k|} conf.c:__list_del_entry: 111| 10.4k|{ 112| 10.4k| __list_del(entry->prev, entry->next); 113| 10.4k|} conf.c:__list_del: 105| 10.4k|{ 106| 10.4k| next->prev = prev; 107| 10.4k| prev->next = next; 108| 10.4k|} confile.c:list_add_tail: 93| 15.9k|{ 94| 15.9k| __list_add(new, head->prev, head); 95| 15.9k|} confile.c:__list_add: 63| 15.9k|{ 64| 15.9k| next->prev = new; 65| 15.9k| new->next = next; 66| 15.9k| new->prev = prev; 67| 15.9k| prev->next = new; 68| 15.9k|} confile.c:list_empty: 258| 267|{ 259| 267| return head->next == head; 260| 267|} confile.c:list_del: 122| 1.61k|{ 123| 1.61k| __list_del_entry(entry); 124| 1.61k| entry->next = LIST_POISON1; ------------------ | | 23| 1.61k|#define LIST_POISON1 ((void *) 0x100) ------------------ 125| 1.61k| entry->prev = LIST_POISON2; ------------------ | | 24| 1.61k|#define LIST_POISON2 ((void *) 0x122) ------------------ 126| 1.61k|} confile.c:__list_del_entry: 111| 1.61k|{ 112| 1.61k| __list_del(entry->prev, entry->next); 113| 1.61k|} confile.c:__list_del: 105| 1.61k|{ 106| 1.61k| next->prev = prev; 107| 1.61k| prev->next = next; 108| 1.61k|} confile.c:INIT_LIST_HEAD: 49| 2.88k|{ 50| 2.88k| list->next = list; 51| 2.88k| list->prev = list; 52| 2.88k|} confile_utils.c:list_empty: 258| 47.4k|{ 259| 47.4k| return head->next == head; 260| 47.4k|} confile_utils.c:list_add_tail: 93| 5.53k|{ 94| 5.53k| __list_add(new, head->prev, head); 95| 5.53k|} confile_utils.c:__list_add: 63| 5.53k|{ 64| 5.53k| next->prev = new; 65| 5.53k| new->next = next; 66| 5.53k| new->prev = prev; 67| 5.53k| prev->next = new; 68| 5.53k|} confile_utils.c:list_del: 122| 9.41k|{ 123| 9.41k| __list_del_entry(entry); 124| 9.41k| entry->next = LIST_POISON1; ------------------ | | 23| 9.41k|#define LIST_POISON1 ((void *) 0x100) ------------------ 125| 9.41k| entry->prev = LIST_POISON2; ------------------ | | 24| 9.41k|#define LIST_POISON2 ((void *) 0x122) ------------------ 126| 9.41k|} confile_utils.c:__list_del_entry: 111| 9.41k|{ 112| 9.41k| __list_del(entry->prev, entry->next); 113| 9.41k|} confile_utils.c:__list_del: 105| 9.41k|{ 106| 9.41k| next->prev = prev; 107| 9.41k| prev->next = next; 108| 9.41k|} confile_utils.c:INIT_LIST_HEAD: 49| 35.6k|{ 50| 35.6k| list->next = list; 51| 35.6k| list->prev = list; 52| 35.6k|} confile.c:lxc_list_new: 151| 1.04k|{ 152| 1.04k| struct lxc_list *l; 153| | 154| 1.04k| l = zalloc(sizeof(struct lxc_list)); ------------------ | | 90| 1.04k|#define zalloc(__size__) (calloc(1, __size__)) ------------------ 155| 1.04k| if (l) ------------------ | Branch (155:6): [True: 1.04k, False: 0] ------------------ 156| 1.04k| lxc_list_init(l); 157| 1.04k| return l; 158| 1.04k|} confile.c:lxc_list_init: 51| 2.48k|{ 52| | list->elem = NULL; 53| 2.48k| list->next = list->prev = list; 54| 2.48k|} confile.c:lxc_list_add_tail: 115| 1.04k|{ 116| 1.04k| __lxc_list_add(list, head->prev, head); 117| 1.04k|} confile.c:__lxc_list_add: 85| 1.04k|{ 86| 1.04k| next->prev = new; 87| 1.04k| new->next = next; 88| 1.04k| new->prev = prev; 89| 1.04k| prev->next = new; 90| 1.04k|} confile.c:lxc_list_del: 128| 408|{ 129| 408| struct lxc_list *next, *prev; 130| | 131| 408| next = list->next; 132| 408| prev = list->prev; 133| 408| next->prev = prev; 134| 408| prev->next = next; 135| 408|} confile_utils.c:lxc_list_del: 128| 634|{ 129| 634| struct lxc_list *next, *prev; 130| | 131| 634| next = list->next; 132| 634| prev = list->prev; 133| 634| next->prev = prev; 134| 634| prev->next = next; 135| 634|} lxc_log_syslog: 745| 2.08k|{ 746| 2.08k| struct lxc_log_appender *appender; 747| | 748| 2.08k| openlog(log_prefix, LOG_PID, facility); 749| 2.08k| if (!lxc_log_category_lxc.appender) { ------------------ | Branch (749:6): [True: 0, False: 2.08k] ------------------ 750| 0| lxc_log_category_lxc.appender = &log_appender_syslog; 751| 0| return 0; 752| 0| } 753| | 754| 2.08k| appender = lxc_log_category_lxc.appender; 755| | /* Check if syslog was already added, to avoid creating a loop */ 756| 4.17k| while (appender) { ------------------ | Branch (756:9): [True: 4.17k, False: 1] ------------------ 757| | /* not an error: openlog re-opened the connection */ 758| 4.17k| if (appender == &log_appender_syslog) ------------------ | Branch (758:7): [True: 2.08k, False: 2.08k] ------------------ 759| 2.08k| return 0; 760| 2.08k| appender = appender->next; 761| 2.08k| } 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.08k|} lxc_log_set_level: 787| 2.55k|{ 788| 2.55k| if (level < 0 || level >= LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (788:6): [True: 0, False: 2.55k] | Branch (788:19): [True: 412, False: 2.14k] ------------------ 789| 412| return log_error_errno(-EINVAL, EINVAL, "Invalid log priority %d", level); ------------------ | | 486| 412| ({ \ | | 487| 412| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 412| errno = (__errno__); \ | | 489| 412| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 412| do { \ | | | | 454| 412| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 412| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 412| char *ptr = NULL; \ | | | | | | 317| 412| { \ | | | | | | 318| 412| int __saved_errno = errno; \ | | | | | | 319| 412| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 412| errno = __saved_errno; \ | | | | | | 321| 412| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 412] | | | | | | ------------------ | | | | | | 322| 412| ptr = errno_buf; \ | | | | | | 323| 412| } | | | | ------------------ | | | | 455| 412| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 412|#define ERROR(format, ...) do { \ | | | | | | 373| 412| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 412| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 412| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 412|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 412] | | | | | | ------------------ | | | | ------------------ | | | | 456| 412| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 412] | | | | ------------------ | | ------------------ | | 490| 412| __internal_ret__; \ | | 491| 412| }) ------------------ 790| | 791| 2.14k| *dest = level; 792| 2.14k| return 0; 793| 2.55k|} lxc_log_set_file: 826| 1.32k|{ 827| 1.32k| if (*fd >= 0) ------------------ | Branch (827:6): [True: 1.15k, False: 175] ------------------ 828| 1.15k| close_prot_errno_disarm(*fd); ------------------ | | 29| 1.15k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 1.15k, False: 0] | | ------------------ | | 30| 1.15k| int _e_ = errno; \ | | 31| 1.15k| close(fd); \ | | 32| 1.15k| errno = _e_; \ | | 33| 1.15k| fd = -EBADF; \ | | 34| 1.15k| } ------------------ 829| | 830| 1.32k| if (is_empty_string(fname)) ------------------ | Branch (830:6): [True: 0, False: 1.32k] ------------------ 831| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 832| | 833| 1.32k| if (build_dir(fname)) ------------------ | Branch (833:6): [True: 0, False: 1.32k] ------------------ 834| 0| return -errno; 835| | 836| 1.32k| *fd = log_open(fname); 837| 1.32k| if (*fd < 0) ------------------ | Branch (837:6): [True: 146, False: 1.18k] ------------------ 838| 146| return -errno; 839| 1.18k| return 0; 840| 1.32k|} log.c:log_append_logfile: 322| 10.4k|{ 323| 10.4k| int fd_to_use = -EBADF; 324| 10.4k| char buffer[LXC_LOG_BUFFER_SIZE]; 325| 10.4k| char date_time[LXC_LOG_TIME_SIZE]; 326| 10.4k| int n; 327| 10.4k| ssize_t ret; 328| 10.4k| const char *log_container_name; 329| | 330| 10.4k|#ifndef NO_LXC_CONF 331| 10.4k| if (current_config && !lxc_log_use_global_fd) ------------------ | Branch (331:6): [True: 0, False: 10.4k] | Branch (331:24): [True: 0, False: 0] ------------------ 332| 0| fd_to_use = current_config->logfd; 333| 10.4k|#endif 334| | 335| 10.4k| log_container_name = lxc_log_get_container_name(); 336| | 337| 10.4k| if (fd_to_use < 0) ------------------ | Branch (337:6): [True: 10.4k, False: 0] ------------------ 338| 10.4k| fd_to_use = lxc_log_fd; 339| | 340| 10.4k| if (fd_to_use < 0) ------------------ | Branch (340:6): [True: 10.4k, False: 0] ------------------ 341| 10.4k| 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| 10.4k|{ 85| 10.4k|#ifndef NO_LXC_CONF 86| 10.4k| if (current_config && !log_vmname) ------------------ | Branch (86:6): [True: 0, False: 10.4k] | Branch (86:24): [True: 0, False: 0] ------------------ 87| 0| return current_config->name; 88| 10.4k|#endif 89| | 90| 10.4k| return log_vmname; 91| 10.4k|} log.c:log_append_syslog: 139| 6.85k|{ 140| 6.85k| __do_free char *msg = NULL; ------------------ | | 69| 6.85k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 6.85k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 141| 6.85k| const char *log_container_name; 142| | 143| 6.85k| if (!wants_syslog) ------------------ | Branch (143:6): [True: 6.85k, False: 0] ------------------ 144| 6.85k| 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| 1.32k|{ 487| 1.32k| __do_free char *n = NULL; ------------------ | | 69| 1.32k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 1.32k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 488| 1.32k| char *e, *p; 489| | 490| 1.32k| if (is_empty_string(name)) ------------------ | Branch (490:6): [True: 0, False: 1.32k] ------------------ 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| 1.32k| n = strdup(name); 495| 1.32k| if (!n) ------------------ | Branch (495:6): [True: 0, False: 1.32k] ------------------ 496| 0| return ret_errno(ENOMEM); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 497| | 498| 1.32k| e = &n[strlen(n)]; 499| 68.3k| for (p = n + 1; p < e; p++) { ------------------ | Branch (499:18): [True: 67.0k, False: 1.32k] ------------------ 500| 67.0k| int ret; 501| | 502| 67.0k| if (*p != '/') ------------------ | Branch (502:7): [True: 66.2k, False: 761] ------------------ 503| 66.2k| continue; 504| 761| *p = '\0'; 505| | 506| |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION 507| | ret = lxc_unpriv(mkdir(n, 0755)); 508| |#else 509| 761| if (RUN_ON_OSS_FUZZ || is_in_comm("fuzz-lxc-") > 0) ------------------ | | 210| 1.52k|#define RUN_ON_OSS_FUZZ 1 | | ------------------ | | | Branch (210:25): [True: 761, Folded] | | ------------------ ------------------ | Branch (509:26): [True: 0, False: 0] ------------------ 510| 761| ret = errno = EEXIST; 511| 0| else 512| 0| ret = lxc_unpriv(mkdir(n, 0755)); ------------------ | | 98| 0| ({ \ | | 99| 0| __label__ out; \ | | 100| 0| int __ret, __ret2, ___errno = 0; \ | | 101| 0| __ret = lxc_caps_down(); \ | | 102| 0| if (__ret) \ | | ------------------ | | | Branch (102:7): [True: 0, False: 0] | | ------------------ | | 103| 0| goto out; \ | | 104| 0| __ret = __lxc_function; \ | | 105| 0| if (__ret) \ | | ------------------ | | | Branch (105:7): [True: 0, False: 0] | | ------------------ | | 106| 0| ___errno = errno; \ | | 107| 0| __ret2 = lxc_caps_up(); \ | | 108| 0| out: \ | | 109| 0| __ret ? errno = ___errno, __ret : __ret2; \ | | ------------------ | | | Branch (109:3): [True: 0, False: 0] | | ------------------ | | 110| 0| }) ------------------ 513| 761|#endif /*!FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */ 514| 761| *p = '/'; 515| 761| if (ret && errno != EEXIST) ------------------ | Branch (515:7): [True: 761, False: 0] | Branch (515:14): [True: 0, False: 761] ------------------ 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| 761| } 518| | 519| 1.32k| return 0; 520| 1.32k|} log.c:log_open: 523| 1.32k|{ 524| 1.32k| int newfd = -EBADF; 525| 1.32k| __do_close int fd = -EBADF; ------------------ | | 49| 1.32k|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 1.32k| __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| 1.32k| if (!RUN_ON_OSS_FUZZ && is_in_comm("fuzz-lxc-") <= 0) ------------------ | | 210| 2.65k|#define RUN_ON_OSS_FUZZ 1 ------------------ | Branch (530:6): [Folded, False: 1.32k] | Branch (530:26): [True: 0, False: 0] ------------------ 531| 0| fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0640)); ------------------ | | 98| 0| ({ \ | | 99| 0| __label__ out; \ | | 100| 0| int __ret, __ret2, ___errno = 0; \ | | 101| 0| __ret = lxc_caps_down(); \ | | 102| 0| if (__ret) \ | | ------------------ | | | Branch (102:7): [True: 0, False: 0] | | ------------------ | | 103| 0| goto out; \ | | 104| 0| __ret = __lxc_function; \ | | 105| 0| if (__ret) \ | | ------------------ | | | Branch (105:7): [True: 0, False: 0] | | ------------------ | | 106| 0| ___errno = errno; \ | | 107| 0| __ret2 = lxc_caps_up(); \ | | 108| 0| out: \ | | 109| 0| __ret ? errno = ___errno, __ret : __ret2; \ | | ------------------ | | | Branch (109:3): [True: 0, False: 0] | | ------------------ | | 110| 0| }) ------------------ 532| 1.32k|#endif /* !FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */ 533| 1.32k| if (fd < 0) ------------------ | Branch (533:6): [True: 1.32k, False: 0] ------------------ 534| 1.32k| return log_error_errno(-errno, errno, "Failed to open log file \"%s\"", name); ------------------ | | 486| 1.32k| ({ \ | | 487| 1.32k| typeof(__ret__) __internal_ret__ = (__ret__); \ | | 488| 1.32k| errno = (__errno__); \ | | 489| 1.32k| SYSERROR(format, ##__VA_ARGS__); \ | | ------------------ | | | | 453| 1.32k| do { \ | | | | 454| 1.32k| lxc_log_strerror_r; \ | | | | ------------------ | | | | | | 315| 1.32k| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | | | 316| 1.32k| char *ptr = NULL; \ | | | | | | 317| 1.32k| { \ | | | | | | 318| 1.32k| int __saved_errno = errno; \ | | | | | | 319| 1.32k| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | | | 320| 1.32k| errno = __saved_errno; \ | | | | | | 321| 1.32k| if (!ptr) \ | | | | | | ------------------ | | | | | | | Branch (321:9): [True: 0, False: 1.32k] | | | | | | ------------------ | | | | | | 322| 1.32k| ptr = errno_buf; \ | | | | | | 323| 1.32k| } | | | | ------------------ | | | | 455| 1.32k| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | | | ------------------ | | | | | | 372| 1.32k|#define ERROR(format, ...) do { \ | | | | | | 373| 1.32k| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | | | ------------------ | | | | | | | | 54| 1.32k| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | | | ------------------ | | | | | | 374| 1.32k| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | | | 375| 1.32k|} while (0) | | | | | | ------------------ | | | | | | | Branch (375:10): [Folded, False: 1.32k] | | | | | | ------------------ | | | | ------------------ | | | | 456| 1.32k| } while (0) | | | | ------------------ | | | | | Branch (456:11): [Folded, False: 1.32k] | | | | ------------------ | | ------------------ | | 490| 1.32k| __internal_ret__; \ | | 491| 1.32k| }) ------------------ 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.50k|{ 96| 3.01k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 1.50k, False: 1.50k] | Branch (96:55): [True: 1.50k, False: 0] ------------------ 97| 1.50k| category = category->parent; 98| | 99| 1.50k| int cmp_prio = category->priority; 100| 1.50k|#ifndef NO_LXC_CONF 101| 1.50k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 1.50k, False: 0] | Branch (101:32): [True: 0, False: 1.50k] ------------------ 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.50k|#endif 105| | 106| 1.50k| return priority >= cmp_prio; 107| 1.50k|} conf.c:__lxc_log: 232| 108|{ 233| 432| while (category) { ------------------ | Branch (233:9): [True: 324, False: 108] ------------------ 234| 324| __lxc_log_append(category->appender, event); 235| 324| category = category->parent; 236| 324| } 237| 108|} conf.c:__lxc_log_append: 217| 324|{ 218| 324| va_list va; 219| 324| va_list *va_keep = event->vap; 220| | 221| 540| while (appender) { ------------------ | Branch (221:9): [True: 216, False: 324] ------------------ 222| 216| va_copy(va, *va_keep); 223| 216| event->vap = &va; 224| 216| appender->append(appender, event); 225| 216| appender = appender->next; 226| | va_end(va); 227| 216| } 228| 324|} confile.c:lxc_log_priority_is_enabled: 95| 6.04k|{ 96| 12.0k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 6.04k, False: 6.04k] | Branch (96:55): [True: 6.04k, False: 0] ------------------ 97| 6.04k| category = category->parent; 98| | 99| 6.04k| int cmp_prio = category->priority; 100| 6.04k|#ifndef NO_LXC_CONF 101| 6.04k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 6.04k, False: 0] | Branch (101:32): [True: 0, False: 6.04k] ------------------ 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.04k|#endif 105| | 106| 6.04k| return priority >= cmp_prio; 107| 6.04k|} confile.c:__lxc_log: 232| 1.96k|{ 233| 7.86k| while (category) { ------------------ | Branch (233:9): [True: 5.89k, False: 1.96k] ------------------ 234| 5.89k| __lxc_log_append(category->appender, event); 235| 5.89k| category = category->parent; 236| 5.89k| } 237| 1.96k|} confile.c:__lxc_log_append: 217| 5.89k|{ 218| 5.89k| va_list va; 219| 5.89k| va_list *va_keep = event->vap; 220| | 221| 8.85k| while (appender) { ------------------ | Branch (221:9): [True: 2.95k, False: 5.89k] ------------------ 222| 2.95k| va_copy(va, *va_keep); 223| 2.95k| event->vap = &va; 224| 2.95k| appender->append(appender, event); 225| 2.95k| appender = appender->next; 226| | va_end(va); 227| 2.95k| } 228| 5.89k|} confile.c:lxc_log_priority_to_int: 168| 2.28k|{ 169| 2.28k| if (strcasecmp("TRACE", name) == 0) ------------------ | Branch (169:6): [True: 194, False: 2.09k] ------------------ 170| 194| return LXC_LOG_LEVEL_TRACE; 171| 2.09k| if (strcasecmp("DEBUG", name) == 0) ------------------ | Branch (171:6): [True: 194, False: 1.90k] ------------------ 172| 194| return LXC_LOG_LEVEL_DEBUG; 173| 1.90k| if (strcasecmp("INFO", name) == 0) ------------------ | Branch (173:6): [True: 377, False: 1.52k] ------------------ 174| 377| return LXC_LOG_LEVEL_INFO; 175| 1.52k| if (strcasecmp("NOTICE", name) == 0) ------------------ | Branch (175:6): [True: 194, False: 1.32k] ------------------ 176| 194| return LXC_LOG_LEVEL_NOTICE; 177| 1.32k| if (strcasecmp("WARN", name) == 0) ------------------ | Branch (177:6): [True: 194, False: 1.13k] ------------------ 178| 194| return LXC_LOG_LEVEL_WARN; 179| 1.13k| if (strcasecmp("ERROR", name) == 0) ------------------ | Branch (179:6): [True: 194, False: 941] ------------------ 180| 194| return LXC_LOG_LEVEL_ERROR; 181| 941| if (strcasecmp("CRIT", name) == 0) ------------------ | Branch (181:6): [True: 197, False: 744] ------------------ 182| 197| return LXC_LOG_LEVEL_CRIT; 183| 744| if (strcasecmp("ALERT", name) == 0) ------------------ | Branch (183:6): [True: 194, False: 550] ------------------ 184| 194| return LXC_LOG_LEVEL_ALERT; 185| 550| if (strcasecmp("FATAL", name) == 0) ------------------ | Branch (185:6): [True: 194, False: 356] ------------------ 186| 194| return LXC_LOG_LEVEL_FATAL; 187| | 188| 356| return LXC_LOG_LEVEL_NOTSET; 189| 550|} confile.c:lxc_syslog_priority_to_int: 192| 2.22k|{ 193| 2.22k| if (strcasecmp("daemon", name) == 0) ------------------ | Branch (193:6): [True: 194, False: 2.03k] ------------------ 194| 194| return LOG_DAEMON; 195| 2.03k| if (strcasecmp("local0", name) == 0) ------------------ | Branch (195:6): [True: 243, False: 1.79k] ------------------ 196| 243| return LOG_LOCAL0; 197| 1.79k| if (strcasecmp("local1", name) == 0) ------------------ | Branch (197:6): [True: 213, False: 1.57k] ------------------ 198| 213| return LOG_LOCAL1; 199| 1.57k| if (strcasecmp("local2", name) == 0) ------------------ | Branch (199:6): [True: 202, False: 1.37k] ------------------ 200| 202| return LOG_LOCAL2; 201| 1.37k| if (strcasecmp("local3", name) == 0) ------------------ | Branch (201:6): [True: 207, False: 1.16k] ------------------ 202| 207| return LOG_LOCAL3; 203| 1.16k| if (strcasecmp("local4", name) == 0) ------------------ | Branch (203:6): [True: 201, False: 967] ------------------ 204| 201| return LOG_LOCAL4; 205| 967| if (strcasecmp("local5", name) == 0) ------------------ | Branch (205:6): [True: 427, False: 540] ------------------ 206| 427| return LOG_LOCAL5; 207| 540| if (strcasecmp("local6", name) == 0) ------------------ | Branch (207:6): [True: 208, False: 332] ------------------ 208| 208| return LOG_LOCAL6; 209| 332| if (strcasecmp("local7", name) == 0) ------------------ | Branch (209:6): [True: 194, False: 138] ------------------ 210| 194| return LOG_LOCAL7; 211| | 212| 138| return -EINVAL; 213| 332|} confile_utils.c:lxc_log_priority_is_enabled: 95| 516|{ 96| 1.03k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 516, False: 516] | Branch (96:55): [True: 516, False: 0] ------------------ 97| 516| category = category->parent; 98| | 99| 516| int cmp_prio = category->priority; 100| 516|#ifndef NO_LXC_CONF 101| 516| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 516, False: 0] | Branch (101:32): [True: 0, False: 516] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 516|#endif 105| | 106| 516| return priority >= cmp_prio; 107| 516|} confile_utils.c:__lxc_log: 232| 516|{ 233| 2.06k| while (category) { ------------------ | Branch (233:9): [True: 1.54k, False: 516] ------------------ 234| 1.54k| __lxc_log_append(category->appender, event); 235| 1.54k| category = category->parent; 236| 1.54k| } 237| 516|} confile_utils.c:__lxc_log_append: 217| 1.54k|{ 218| 1.54k| va_list va; 219| 1.54k| va_list *va_keep = event->vap; 220| | 221| 2.53k| while (appender) { ------------------ | Branch (221:9): [True: 984, False: 1.54k] ------------------ 222| 984| va_copy(va, *va_keep); 223| 984| event->vap = &va; 224| 984| appender->append(appender, event); 225| 984| appender = appender->next; 226| | va_end(va); 227| 984| } 228| 1.54k|} log.c:lxc_log_priority_is_enabled: 95| 1.74k|{ 96| 3.48k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 1.74k, False: 1.74k] | Branch (96:55): [True: 1.74k, False: 0] ------------------ 97| 1.74k| category = category->parent; 98| | 99| 1.74k| int cmp_prio = category->priority; 100| 1.74k|#ifndef NO_LXC_CONF 101| 1.74k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 1.74k, False: 0] | Branch (101:32): [True: 0, False: 1.74k] ------------------ 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.74k|#endif 105| | 106| 1.74k| return priority >= cmp_prio; 107| 1.74k|} log.c:__lxc_log: 232| 1.74k|{ 233| 6.96k| while (category) { ------------------ | Branch (233:9): [True: 5.22k, False: 1.74k] ------------------ 234| 5.22k| __lxc_log_append(category->appender, event); 235| 5.22k| category = category->parent; 236| 5.22k| } 237| 1.74k|} log.c:__lxc_log_append: 217| 5.22k|{ 218| 5.22k| va_list va; 219| 5.22k| va_list *va_keep = event->vap; 220| | 221| 8.27k| while (appender) { ------------------ | Branch (221:9): [True: 3.05k, False: 5.22k] ------------------ 222| 3.05k| va_copy(va, *va_keep); 223| 3.05k| event->vap = &va; 224| 3.05k| appender->append(appender, event); 225| 3.05k| appender = appender->next; 226| | va_end(va); 227| 3.05k| } 228| 5.22k|} namespace.c:lxc_log_priority_is_enabled: 95| 123|{ 96| 246| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 123, False: 123] | Branch (96:55): [True: 123, False: 0] ------------------ 97| 123| category = category->parent; 98| | 99| 123| int cmp_prio = category->priority; 100| 123|#ifndef NO_LXC_CONF 101| 123| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 123, False: 0] | Branch (101:32): [True: 0, False: 123] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 123|#endif 105| | 106| 123| return priority >= cmp_prio; 107| 123|} namespace.c:__lxc_log: 232| 123|{ 233| 492| while (category) { ------------------ | Branch (233:9): [True: 369, False: 123] ------------------ 234| 369| __lxc_log_append(category->appender, event); 235| 369| category = category->parent; 236| 369| } 237| 123|} namespace.c:__lxc_log_append: 217| 369|{ 218| 369| va_list va; 219| 369| va_list *va_keep = event->vap; 220| | 221| 606| while (appender) { ------------------ | Branch (221:9): [True: 237, False: 369] ------------------ 222| 237| va_copy(va, *va_keep); 223| 237| event->vap = &va; 224| 237| appender->append(appender, event); 225| 237| appender = appender->next; 226| | va_end(va); 227| 237| } 228| 369|} parse.c:lxc_log_priority_is_enabled: 95| 25.5k|{ 96| 51.0k| while (category->priority == LXC_LOG_LEVEL_NOTSET && category->parent) ------------------ | Branch (96:9): [True: 25.5k, False: 25.5k] | Branch (96:55): [True: 25.5k, False: 0] ------------------ 97| 25.5k| category = category->parent; 98| | 99| 25.5k| int cmp_prio = category->priority; 100| 25.5k|#ifndef NO_LXC_CONF 101| 25.5k| if (!lxc_log_use_global_fd && current_config && ------------------ | Branch (101:6): [True: 25.5k, False: 0] | Branch (101:32): [True: 0, False: 25.5k] ------------------ 102| 0| current_config->loglevel != LXC_LOG_LEVEL_NOTSET) ------------------ | Branch (102:6): [True: 0, False: 0] ------------------ 103| 0| cmp_prio = current_config->loglevel; 104| 25.5k|#endif 105| | 106| 25.5k| return priority >= cmp_prio; 107| 25.5k|} parse.c:__lxc_log: 232| 5.96k|{ 233| 23.8k| while (category) { ------------------ | Branch (233:9): [True: 17.9k, False: 5.96k] ------------------ 234| 17.9k| __lxc_log_append(category->appender, event); 235| 17.9k| category = category->parent; 236| 17.9k| } 237| 5.96k|} parse.c:__lxc_log_append: 217| 17.9k|{ 218| 17.9k| va_list va; 219| 17.9k| va_list *va_keep = event->vap; 220| | 221| 27.7k| while (appender) { ------------------ | Branch (221:9): [True: 9.83k, False: 17.9k] ------------------ 222| 9.83k| va_copy(va, *va_keep); 223| 9.83k| event->vap = &va; 224| 9.83k| appender->append(appender, event); 225| 9.83k| appender = appender->next; 226| | va_end(va); 227| 9.83k| } 228| 17.9k|} conf.c:seccomp_conf_init: 144| 12.0k|{ 145| 12.0k|} conf.c:lxc_seccomp_free: 128| 12.0k|{ 129| | free_disarm(seccomp->seccomp); ------------------ | | 58| 12.0k| ({ \ | | 59| 12.0k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 12.0k] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 12.0k| }) ------------------ 130| 12.0k|} conf.c:close_prot_errno_disarm_function: 46| 9.22k|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 9.22k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 392, False: 8.83k] | | ------------------ | | 30| 392| int _e_ = errno; \ | | 31| 392| close(fd); \ | | 32| 392| errno = _e_; \ | | 33| 392| fd = -EBADF; \ | | 34| 392| } ------------------ 48| 9.22k|} conf.c:free_disarm_function: 66| 3.45k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 3.45k| ({ \ | | 59| 3.45k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 2.73k, False: 717] | | ------------------ | | 60| 2.73k| free(ptr); \ | | 61| 2.73k| ptr = NULL; \ | | 62| 2.73k| } \ | | 63| 3.45k| }) ------------------ 68| 3.45k|} confile.c:free_lxc_cgroup_function: 20| 1.31k| { \ 21| 1.31k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 1.31k] ------------------ 22| 1.31k| cleaner(*ptr); \ 23| 1.31k| } confile.c:closedir_function: 20| 864| { \ 21| 864| if (*ptr) \ ------------------ | Branch (21:7): [True: 666, False: 198] ------------------ 22| 864| cleaner(*ptr); \ 23| 864| } confile.c:free_lxc_limit_function: 20| 3.22k| { \ 21| 3.22k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 3.22k] ------------------ 22| 3.22k| cleaner(*ptr); \ 23| 3.22k| } confile.c:free_lxc_sysctl_function: 20| 2.28k| { \ 21| 2.28k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 2.28k] ------------------ 22| 2.28k| cleaner(*ptr); \ 23| 2.28k| } confile.c:free_lxc_proc_function: 20| 1.57k| { \ 21| 1.57k| if (*ptr) \ ------------------ | Branch (21:7): [True: 0, False: 1.57k] ------------------ 22| 1.57k| cleaner(*ptr); \ 23| 1.57k| } confile.c:free_disarm_function: 66| 435k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 435k| ({ \ | | 59| 435k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 396k, False: 39.6k] | | ------------------ | | 60| 396k| free(ptr); \ | | 61| 396k| ptr = NULL; \ | | 62| 396k| } \ | | 63| 435k| }) ------------------ 68| 435k|} confile.c:netns_freeifaddrs_function: 20| 946| { \ 21| 946| if (*ptr) \ ------------------ | Branch (21:7): [True: 946, False: 0] ------------------ 22| 946| cleaner(*ptr); \ 23| 946| } confile_utils.c:free_disarm_function: 66| 14.2k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 14.2k| ({ \ | | 59| 14.2k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 8.67k, False: 5.53k] | | ------------------ | | 60| 8.67k| free(ptr); \ | | 61| 8.67k| ptr = NULL; \ | | 62| 8.67k| } \ | | 63| 14.2k| }) ------------------ 68| 14.2k|} confile_utils.c:free_string_list: 72| 1.51k|{ 73| 1.51k| if (list && !IS_ERR(list)) { ------------------ | Branch (73:6): [True: 0, False: 1.51k] | 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| 1.51k|} file_utils.c:close_prot_errno_disarm_function: 46| 12.0k|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 12.0k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 12.0k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 48| 12.0k|} log.c:free_disarm_function: 66| 8.18k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 8.18k| ({ \ | | 59| 8.18k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 1.32k, False: 6.85k] | | ------------------ | | 60| 1.32k| free(ptr); \ | | 61| 1.32k| ptr = NULL; \ | | 62| 1.32k| } \ | | 63| 8.18k| }) ------------------ 68| 8.18k|} log.c:close_prot_errno_disarm_function: 46| 1.32k|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 1.32k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 0, False: 1.32k] | | ------------------ | | 30| 0| int _e_ = errno; \ | | 31| 0| close(fd); \ | | 32| 0| errno = _e_; \ | | 33| 0| fd = -EBADF; \ | | 34| 0| } ------------------ 48| 1.32k|} parse.c:close_prot_errno_disarm_function: 46| 39.1k|{ 47| | close_prot_errno_disarm(*fd); ------------------ | | 29| 39.1k| if (fd >= 0) { \ | | ------------------ | | | Branch (29:6): [True: 39.1k, False: 20] | | ------------------ | | 30| 39.1k| int _e_ = errno; \ | | 31| 39.1k| close(fd); \ | | 32| 39.1k| errno = _e_; \ | | 33| 39.1k| fd = -EBADF; \ | | 34| 39.1k| } ------------------ 48| 39.1k|} string_utils.c:free_disarm_function: 66| 6.32k|{ 67| | free_disarm(*(void **)ptr); ------------------ | | 58| 6.32k| ({ \ | | 59| 6.32k| if (!IS_ERR_OR_NULL(ptr)) { \ | | ------------------ | | | Branch (59:7): [True: 0, False: 6.32k] | | ------------------ | | 60| 0| free(ptr); \ | | 61| 0| ptr = NULL; \ | | 62| 0| } \ | | 63| 6.32k| }) ------------------ 68| 6.32k|} utils.c:fclose_function: 20| 2.16k| { \ 21| 2.16k| if (*ptr) \ ------------------ | Branch (21:7): [True: 2.16k, False: 0] ------------------ 22| 2.16k| cleaner(*ptr); \ 23| 2.16k| } lxc_namespace_2_cloneflag: 50| 1.40k|{ 51| 1.40k| int i; 52| | 53| 5.87k| for (i = 0; i < LXC_NS_MAX; i++) ------------------ | Branch (53:14): [True: 5.79k, False: 76] ------------------ 54| 5.79k| if (!strcasecmp(ns_info[i].proc_name, namespace)) ------------------ | Branch (54:7): [True: 1.33k, False: 4.46k] ------------------ 55| 1.33k| return ns_info[i].clone_flag; 56| | 57| 76| ERROR("Invalid namespace name \"%s\"", namespace); ------------------ | | 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] | | ------------------ ------------------ 58| | return -EINVAL; 59| 1.40k|} lxc_namespace_2_ns_idx: 62| 550|{ 63| 2.19k| for (int i = 0; i < LXC_NS_MAX; i++) { ------------------ | Branch (63:18): [True: 2.14k, False: 47] ------------------ 64| 2.14k| if (strequal(ns_info[i].proc_name, namespace)) ------------------ | Branch (64:7): [True: 503, False: 1.64k] ------------------ 65| 503| return i; 66| 2.14k| } 67| | 68| 47| ERROR("Invalid namespace name \"%s\"", namespace); ------------------ | | 372| 47|#define ERROR(format, ...) do { \ | | 373| 47| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 47| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 47| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 47|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 47] | | ------------------ ------------------ 69| | return -EINVAL; 70| 550|} lxc_file_for_each_line_mmap: 51| 19.5k|{ 52| 19.5k| __do_close int fd = -EBADF, memfd = -EBADF; ------------------ | | 49| 19.5k|#define __do_close call_cleaner(close_prot_errno_disarm) | | ------------------ | | | | 26| 19.5k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 53| 19.5k| ssize_t ret = -1; 54| 19.5k| char *buf = NULL; 55| 19.5k| struct stat st = {}; 56| 19.5k| ssize_t bytes; 57| 19.5k| char *line; 58| | 59| 19.5k| memfd = memfd_create(".lxc_config_file", MFD_CLOEXEC | MFD_NOEXEC_SEAL); 60| | 61| 19.5k| if (memfd < 0 && errno == EINVAL) { ------------------ | Branch (61:6): [True: 19.5k, False: 0] | Branch (61:19): [True: 19.5k, False: 0] ------------------ 62| 19.5k| TRACE("MFD_NOEXEC_SEAL may unsupported, using MFD_CLOEXEC only"); ------------------ | | 347| 19.5k|#define TRACE(format, ...) do { \ | | 348| 19.5k| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 19.5k| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 349| 19.5k| LXC_TRACE(&locinfo, format, ##__VA_ARGS__); \ | | 350| 19.5k|} while (0) | | ------------------ | | | Branch (350:10): [Folded, False: 19.5k] | | ------------------ ------------------ 63| 19.5k| memfd = memfd_create(".lxc_config_file", MFD_CLOEXEC); 64| 19.5k| } 65| | 66| 19.5k| if (memfd < 0) { ------------------ | Branch (66:6): [True: 0, False: 19.5k] ------------------ 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| 19.5k| fd = open(file, O_RDONLY | O_CLOEXEC); 83| 19.5k| if (fd < 0) { ------------------ | Branch (83:6): [True: 20, False: 19.5k] ------------------ 84| 20| SYSERROR("Failed to open file \"%s\"", file); ------------------ | | 453| 20| do { \ | | 454| 20| lxc_log_strerror_r; \ | | ------------------ | | | | 315| 20| char errno_buf[PATH_MAX / 2] = {"Failed to get errno string"}; \ | | | | 316| 20| char *ptr = NULL; \ | | | | 317| 20| { \ | | | | 318| 20| int __saved_errno = errno; \ | | | | 319| 20| ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \ | | | | 320| 20| errno = __saved_errno; \ | | | | 321| 20| if (!ptr) \ | | | | ------------------ | | | | | Branch (321:9): [True: 0, False: 20] | | | | ------------------ | | | | 322| 20| ptr = errno_buf; \ | | | | 323| 20| } | | ------------------ | | 455| 20| ERROR("%s - " format, ptr, ##__VA_ARGS__); \ | | ------------------ | | | | 372| 20|#define ERROR(format, ...) do { \ | | | | 373| 20| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | | | ------------------ | | | | | | 54| 20| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | | | ------------------ | | | | 374| 20| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | | | 375| 20|} while (0) | | | | ------------------ | | | | | Branch (375:10): [Folded, False: 20] | | | | ------------------ | | ------------------ | | 456| 20| } while (0) | | ------------------ | | | Branch (456:11): [Folded, False: 20] | | ------------------ ------------------ 85| 20| goto on_error; 86| 20| } 87| | 88| 19.5k| ret = fstat(fd, &st); 89| 19.5k| if (ret) { ------------------ | Branch (89:6): [True: 0, False: 19.5k] ------------------ 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| 19.5k| if (st.st_size > INT_MAX) { ------------------ | Branch (94:6): [True: 0, False: 19.5k] ------------------ 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| 19.5k| bytes = __fd_to_fd(fd, memfd); 101| 19.5k| if (bytes < 0) { ------------------ | Branch (101:6): [True: 0, False: 19.5k] ------------------ 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| 19.5k| ret = lxc_write_nointr(memfd, "\0", 1); 107| 19.5k| if (ret < 0) { ------------------ | Branch (107:6): [True: 0, False: 19.5k] ------------------ 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| 19.5k| bytes++; 112| | 113| 19.5k| ret = lseek(memfd, 0, SEEK_SET); 114| 19.5k| if (ret < 0) { ------------------ | Branch (114:6): [True: 0, False: 19.5k] ------------------ 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| 19.5k| ret = -1; 120| 19.5k| buf = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_POPULATE, memfd, 0); 121| 19.5k| if (buf == MAP_FAILED) { ------------------ | Branch (121:6): [True: 0, False: 19.5k] ------------------ 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| 19.5k| ret = 0; 128| 382k| lxc_iterate_parts(line, buf, "\r\n\0") { ------------------ | | 187| 19.5k| for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ | | 188| 396k| (__iterator = __it); \ | | ------------------ | | | Branch (188:7): [True: 382k, False: 13.6k] | | ------------------ | | 189| 376k| __iterator = __it = strtok_r(NULL, __separators, &__p)) ------------------ 129| 382k| ret = callback(line, data); 130| 382k| if (ret) { ------------------ | Branch (130:7): [True: 5.94k, False: 376k] ------------------ 131| | /* Callback rv > 0 means stop here callback rv < 0 means 132| | * error. 133| | */ 134| 5.94k| if (ret < 0) ------------------ | Branch (134:8): [True: 5.94k, False: 0] ------------------ 135| 5.94k| ERROR("Failed to parse config file \"%s\" at line \"%s\"", ------------------ | | 372| 5.94k|#define ERROR(format, ...) do { \ | | 373| 5.94k| struct lxc_log_locinfo locinfo = LXC_LOG_LOCINFO_INIT; \ | | ------------------ | | | | 54| 5.94k| { .file = __FILE__, .func = __func__, .line = __LINE__ } | | ------------------ | | 374| 5.94k| LXC_ERROR(&locinfo, format, ##__VA_ARGS__); \ | | 375| 5.94k|} while (0) | | ------------------ | | | Branch (375:10): [Folded, False: 5.94k] | | ------------------ ------------------ 136| 5.94k| file, line); 137| 5.94k| break; 138| 5.94k| } 139| 382k| } 140| | 141| 19.5k|on_error: 142| 19.5k| if (buf && munmap(buf, bytes)) { ------------------ | Branch (142:6): [True: 19.5k, False: 20] | Branch (142:13): [True: 0, False: 19.5k] ------------------ 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| 19.5k| return ret; 149| 19.5k|} storage_put: 667| 12.0k|{ 668| 12.0k| if (bdev) { ------------------ | Branch (668:6): [True: 0, False: 12.0k] ------------------ 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| 12.0k|} lxc_path_simplify: 191| 6.32k|{ 192| 6.32k| __do_free char *path_new = NULL; ------------------ | | 69| 6.32k|#define __do_free call_cleaner(free_disarm) | | ------------------ | | | | 26| 6.32k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 193| 6.32k| char *f, *t; 194| 6.32k| bool slash = false, ignore_slash = false, absolute; 195| | 196| 6.32k| path_new = strdup(path); 197| 6.32k| if (!path_new) ------------------ | Branch (197:6): [True: 0, False: 6.32k] ------------------ 198| 0| return NULL; 199| | 200| 6.32k| if (is_empty_string(path_new)) ------------------ | Branch (200:6): [True: 1.15k, False: 5.16k] ------------------ 201| 1.15k| return move_ptr(path_new); ------------------ | | 694| 1.15k| ({ \ | | 695| 1.15k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 1.15k| (ptr) = NULL; \ | | 697| 1.15k| __internal_ptr__; \ | | 698| 1.15k| }) ------------------ 202| | 203| 5.16k| absolute = abspath(path_new); 204| | 205| 5.16k| f = path_new; 206| 5.16k| if (*f == '.' && (f[1] == 0 || f[1] == '/')) { ------------------ | Branch (206:6): [True: 966, False: 4.20k] | Branch (206:20): [True: 371, False: 595] | Branch (206:33): [True: 244, False: 351] ------------------ 207| 615| ignore_slash = true; 208| 615| f++; 209| 615| } 210| | 211| 241k| for (t = path_new; *f; f++) { ------------------ | Branch (211:21): [True: 236k, False: 5.16k] ------------------ 212| | 213| 236k| if (*f == '/') { ------------------ | Branch (213:7): [True: 2.42k, False: 233k] ------------------ 214| 2.42k| slash = true; 215| 2.42k| continue; 216| 2.42k| } 217| | 218| 233k| if (slash) { ------------------ | Branch (218:7): [True: 1.86k, False: 231k] ------------------ 219| 1.86k| if (*f == '.' && (f[1] == 0 || f[1] == '/')) ------------------ | Branch (219:8): [True: 816, False: 1.04k] | Branch (219:22): [True: 194, False: 622] | Branch (219:35): [True: 209, False: 413] ------------------ 220| 403| continue; 221| | 222| 1.46k| slash = false; 223| 1.46k| if (ignore_slash) ------------------ | Branch (223:8): [True: 194, False: 1.26k] ------------------ 224| 194| ignore_slash = false; 225| 1.26k| else 226| 1.26k| *(t++) = '/'; 227| 1.46k| } 228| | 229| 233k| *(t++) = *f; 230| 233k| } 231| | 232| 5.16k| if (t == path_new) { ------------------ | Branch (232:6): [True: 893, False: 4.27k] ------------------ 233| 893| if (absolute) ------------------ | Branch (233:7): [True: 472, False: 421] ------------------ 234| 472| *(t++) = '/'; 235| 421| else 236| 421| *(t++) = '.'; 237| 893| } 238| | 239| 5.16k| *t = 0; 240| | return move_ptr(path_new); ------------------ | | 694| 5.16k| ({ \ | | 695| 5.16k| typeof(ptr) __internal_ptr__ = (ptr); \ | | 696| 5.16k| (ptr) = NULL; \ | | 697| 5.16k| __internal_ptr__; \ | | 698| 5.16k| }) ------------------ 241| 6.32k|} 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: 195, False: 11.9k] ------------------ 574| 195| numstr++; 575| | 576| 11.9k| if (*numstr == '-') ------------------ | Branch (576:6): [True: 205, False: 11.7k] ------------------ 577| 205| 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: 557, False: 11.1k] | Branch (584:23): [True: 214, False: 10.9k] ------------------ 585| 771| return -EINVAL; 586| | 587| 10.9k| if (uli > UINT_MAX) ------------------ | Branch (587:6): [True: 273, False: 10.6k] ------------------ 588| 273| return -ERANGE; 589| | 590| 10.6k| *converted = (unsigned int)uli; 591| 10.6k| return 0; 592| 10.9k|} lxc_safe_ulong: 595| 6.69k|{ 596| 6.69k| char *err = NULL; 597| 6.69k| unsigned long int uli; 598| | 599| 6.69k| while (isspace(*numstr)) ------------------ | Branch (599:9): [True: 194, False: 6.69k] ------------------ 600| 194| numstr++; 601| | 602| 6.69k| if (*numstr == '-') ------------------ | Branch (602:6): [True: 3, False: 6.68k] ------------------ 603| 3| return -EINVAL; 604| | 605| 6.69k| errno = 0; 606| 6.68k| uli = strtoul(numstr, &err, 0); 607| 6.68k| if (errno == ERANGE && uli == ULONG_MAX) ------------------ | Branch (607:6): [True: 2, False: 6.68k] | Branch (607:25): [True: 2, False: 0] ------------------ 608| 2| return -ERANGE; 609| | 610| 6.68k| if (err == numstr || *err != '\0') ------------------ | Branch (610:6): [True: 24, False: 6.66k] | Branch (610:23): [True: 8, False: 6.65k] ------------------ 611| 32| return -EINVAL; 612| | 613| 6.65k| *converted = uli; 614| 6.65k| return 0; 615| 6.68k|} lxc_safe_int64_residual: 643| 38.0k|{ 644| 38.0k| char *remaining = NULL; 645| 38.0k| int64_t u; 646| | 647| 38.0k| if (residual && residual_len == 0) ------------------ | Branch (647:6): [True: 38.0k, False: 0] | Branch (647:18): [True: 0, False: 38.0k] ------------------ 648| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 649| | 650| 38.0k| if (!residual && residual_len != 0) ------------------ | Branch (650:6): [True: 0, False: 38.0k] | 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| 38.0k| memset(residual, 0, residual_len); 654| | 655| 38.0k| while (isspace(*numstr)) ------------------ | Branch (655:9): [True: 195, False: 38.0k] ------------------ 656| 195| numstr++; 657| | 658| 38.0k| errno = 0; 659| 38.0k| u = strtoll(numstr, &remaining, base); 660| 38.0k| if (errno == ERANGE && u == INT64_MAX) ------------------ | Branch (660:6): [True: 197, False: 37.8k] | Branch (660:25): [True: 2, False: 195] ------------------ 661| 2| return ret_errno(ERANGE); ------------------ | | 715| 2| ({ \ | | 716| 2| errno = labs(__errno__); \ | | 717| 2| -errno; \ | | 718| 2| }) ------------------ 662| | 663| 37.9k| if (remaining == numstr) ------------------ | Branch (663:6): [True: 10, False: 37.9k] ------------------ 664| 10| return -EINVAL; 665| | 666| 37.9k| if (residual) { ------------------ | Branch (666:6): [True: 37.9k, False: 0] ------------------ 667| 37.9k| size_t len = 0; 668| | 669| 37.9k| if (*remaining == '\0') ------------------ | Branch (669:7): [True: 156, False: 37.8k] ------------------ 670| 156| goto out; 671| | 672| 37.8k| len = strlen(remaining); 673| 37.8k| if (len >= residual_len) ------------------ | Branch (673:7): [True: 39, False: 37.7k] ------------------ 674| 39| return ret_errno(EINVAL); ------------------ | | 715| 39| ({ \ | | 716| 39| errno = labs(__errno__); \ | | 717| 39| -errno; \ | | 718| 39| }) ------------------ 675| | 676| 37.7k| memcpy(residual, remaining, len); 677| 37.7k| } 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.9k|out: 682| 37.9k| *converted = u; 683| 37.9k| return 0; 684| 37.9k|} lxc_safe_int: 687| 2.69k|{ 688| 2.69k| char *err = NULL; 689| 2.69k| signed long int sli; 690| | 691| 2.69k| errno = 0; 692| 2.69k| sli = strtol(numstr, &err, 0); 693| 2.69k| if (errno == ERANGE && (sli == LONG_MAX || sli == LONG_MIN)) ------------------ | Branch (693:6): [True: 389, False: 2.30k] | Branch (693:26): [True: 195, False: 194] | Branch (693:45): [True: 194, False: 0] ------------------ 694| 389| return -ERANGE; 695| | 696| 2.30k| if (errno != 0 && sli == 0) ------------------ | Branch (696:6): [True: 0, False: 2.30k] | Branch (696:20): [True: 0, False: 0] ------------------ 697| 0| return -EINVAL; 698| | 699| 2.30k| if (err == numstr || *err != '\0') ------------------ | Branch (699:6): [True: 274, False: 2.03k] | Branch (699:23): [True: 230, False: 1.80k] ------------------ 700| 504| return -EINVAL; 701| | 702| 1.80k| if (sli > INT_MAX || sli < INT_MIN) ------------------ | Branch (702:6): [True: 244, False: 1.55k] | Branch (702:23): [True: 264, False: 1.29k] ------------------ 703| 508| return -ERANGE; 704| | 705| 1.29k| *converted = (int)sli; 706| 1.29k| return 0; 707| 1.80k|} lxc_safe_long_long: 730| 2.31k|{ 731| 2.31k| char *err = NULL; 732| 2.31k| signed long long int sli; 733| | 734| 2.31k| errno = 0; 735| 2.31k| sli = strtoll(numstr, &err, 0); 736| 2.31k| if (errno == ERANGE && (sli == LLONG_MAX || sli == LLONG_MIN)) ------------------ | Branch (736:6): [True: 2, False: 2.30k] | Branch (736:26): [True: 1, False: 1] | Branch (736:46): [True: 1, False: 0] ------------------ 737| 2| return -ERANGE; 738| | 739| 2.30k| if (errno != 0 && sli == 0) ------------------ | Branch (739:6): [True: 0, False: 2.30k] | Branch (739:20): [True: 0, False: 0] ------------------ 740| 0| return -EINVAL; 741| | 742| 2.30k| if (err == numstr || *err != '\0') ------------------ | Branch (742:6): [True: 32, False: 2.27k] | Branch (742:23): [True: 10, False: 2.26k] ------------------ 743| 42| return -EINVAL; 744| | 745| 2.26k| *converted = sli; 746| 2.26k| return 0; 747| 2.30k|} parse_byte_size_string: 874| 2.36k|{ 875| 2.36k| int ret, suffix_len; 876| 2.36k| long long int conv, mltpl; 877| 2.36k| char *end; 878| 2.36k| char dup[INTTYPE_TO_STRLEN(long long int)] = {0}; 879| 2.36k| char suffix[3] = {0}; 880| 2.36k| size_t len; 881| | 882| 2.36k| if (!s) ------------------ | Branch (882:6): [True: 0, False: 2.36k] ------------------ 883| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 884| | 885| 2.36k| len = strlen(s); 886| 2.36k| if (len == 0 || len > sizeof(dup) - 1) ------------------ | Branch (886:6): [True: 0, False: 2.36k] | Branch (886:18): [True: 24, False: 2.34k] ------------------ 887| 24| return ret_errno(EINVAL); ------------------ | | 715| 24| ({ \ | | 716| 24| errno = labs(__errno__); \ | | 717| 24| -errno; \ | | 718| 24| }) ------------------ 888| | 889| 2.34k| memcpy(dup, s, len); 890| | 891| 2.34k| end = dup + len; 892| 2.34k| if (isdigit(*(end - 1))) ------------------ | Branch (892:6): [True: 608, False: 1.73k] ------------------ 893| 608| suffix_len = 0; 894| 1.73k| else if (isalpha(*(end - 1))) ------------------ | Branch (894:11): [True: 1.71k, False: 20] ------------------ 895| 1.71k| suffix_len = 1; 896| 20| else 897| 20| return ret_errno(EINVAL); ------------------ | | 715| 20| ({ \ | | 716| 20| errno = labs(__errno__); \ | | 717| 20| -errno; \ | | 718| 20| }) ------------------ 898| | 899| 2.32k| if (suffix_len > 0) { ------------------ | Branch (899:6): [True: 1.71k, False: 608] ------------------ 900| 1.71k| if ((end - 1) == dup) ------------------ | Branch (900:7): [True: 5, False: 1.70k] ------------------ 901| 5| return ret_errno(EINVAL); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 902| | 903| 1.70k| if ((end - 2) == dup) { ------------------ | Branch (903:7): [True: 225, False: 1.48k] ------------------ 904| 225| if (isalpha(*(end - 2))) ------------------ | Branch (904:8): [True: 5, False: 220] ------------------ 905| 5| return ret_errno(EINVAL); ------------------ | | 715| 5| ({ \ | | 716| 5| errno = labs(__errno__); \ | | 717| 5| -errno; \ | | 718| 5| }) ------------------ 906| | /* 1B */ 907| 1.48k| } else { 908| 1.48k| if (isalpha(*(end - 2))) /* 12MB */ ------------------ | Branch (908:8): [True: 1.25k, False: 231] ------------------ 909| 1.25k| suffix_len++; 910| | 911| | /* 12B */ 912| 1.48k| } 913| | 914| 1.70k| memcpy(suffix, end - suffix_len, suffix_len); 915| 1.70k| *(suffix + suffix_len) = '\0'; 916| 1.70k| *(end - suffix_len) = '\0'; 917| 1.70k| } 918| | 919| 2.31k| dup[lxc_char_right_gc(dup, strlen(dup))] = '\0'; 920| | 921| 2.31k| ret = lxc_safe_long_long(dup, &conv); 922| 2.31k| if (ret) ------------------ | Branch (922:6): [True: 44, False: 2.26k] ------------------ 923| 44| return ret; 924| | 925| 2.26k| if (suffix_len != 2) { ------------------ | Branch (925:6): [True: 1.02k, False: 1.24k] ------------------ 926| 1.02k| *converted = conv; 927| 1.02k| return 0; 928| 1.02k| } 929| | 930| 1.24k| if (strcasecmp(suffix, "KB") == 0) ------------------ | Branch (930:6): [True: 257, False: 990] ------------------ 931| 257| mltpl = 1024; 932| 990| else if (strcasecmp(suffix, "MB") == 0) ------------------ | Branch (932:11): [True: 265, False: 725] ------------------ 933| 265| mltpl = 1024 * 1024; 934| 725| else if (strcasecmp(suffix, "GB") == 0) ------------------ | Branch (934:11): [True: 696, False: 29] ------------------ 935| 696| mltpl = 1024 * 1024 * 1024; 936| 29| else 937| 29| return ret_errno(EINVAL); ------------------ | | 715| 29| ({ \ | | 716| 29| errno = labs(__errno__); \ | | 717| 29| -errno; \ | | 718| 29| }) ------------------ 938| | 939| 1.21k| if (check_mul_overflow(conv, mltpl, converted)) ------------------ | | 216| 1.21k|#define check_mul_overflow(a, b, d) __must_check_overflow( \ | | ------------------ | | | Branch (216:37): [True: 65, False: 1.15k] | | ------------------ | | 217| 1.21k| __builtin_choose_expr(is_signed_type(typeof(a)), \ | | ------------------ | | | | 48| 1.21k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | ------------------ | | 218| 1.21k| __signed_mul_overflow(a, b, d), \ | | ------------------ | | | | 191| 1.21k|#define __signed_mul_overflow(a, b, d) ({ \ | | | | 192| 1.21k| typeof(a) __a = (a); \ | | | | 193| 1.21k| typeof(b) __b = (b); \ | | | | 194| 1.21k| typeof(d) __d = (d); \ | | | | 195| 1.21k| typeof(a) __tmax = type_max(typeof(a)); \ | | | | ------------------ | | | | | | 50| 1.21k|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | ------------------ | | | | | | | | 49| 1.21k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 1.21k|#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.21k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | ------------------ | | | | | | | | | | 48| 1.21k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 196| 1.21k| typeof(a) __tmin = type_min(typeof(a)); \ | | | | ------------------ | | | | | | 51| 1.21k|#define type_min(T) ((T)((T)-type_max(T)-(T)1)) | | | | | | ------------------ | | | | | | | | 50| 1.21k|#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) | | | | | | | | ------------------ | | | | | | | | | | 49| 1.21k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 1.21k|#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.21k|#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) | | | | | | | | | | ------------------ | | | | | | | | | | | | 48| 1.21k|#define is_signed_type(type) (((type)(-1)) < (type)1) | | | | | | | | | | ------------------ | | | | | | | | ------------------ | | | | | | ------------------ | | | | ------------------ | | | | 197| 1.21k| (void) (&__a == &__b); \ | | | | 198| 1.21k| (void) (&__a == __d); \ | | | | 199| 1.21k| *__d = (__u64)__a * (__u64)__b; \ | | | | 200| 1.21k| (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \ | | | | ------------------ | | | | | Branch (200:3): [True: 1.21k, False: 0] | | | | | Branch (200:17): [True: 64, False: 1.15k] | | | | | Branch (200:37): [True: 1, False: 1.15k] | | | | ------------------ | | | | 201| 1.21k| (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \ | | | | ------------------ | | | | | Branch (201:3): [True: 0, False: 1.15k] | | | | | Branch (201:30): [True: 0, False: 0] | | | | | Branch (201:50): [True: 0, False: 0] | | | | ------------------ | | | | 202| 1.21k| (__b == (typeof(__b))-1 && __a == __tmin); \ | | | | ------------------ | | | | | Branch (202:3): [True: 0, False: 1.15k] | | | | | Branch (202:29): [True: 0, False: 0] | | | | ------------------ | | | | 203| 1.21k|}) | | ------------------ | | 219| 1.21k| __unsigned_mul_overflow(a, b, d))) | | ------------------ | | | | 120| 1.21k|#define __unsigned_mul_overflow(a, b, d) ({ \ | | | | 121| 1.21k| typeof(a) __a = (a); \ | | | | 122| 1.21k| typeof(b) __b = (b); \ | | | | 123| 1.21k| typeof(d) __d = (d); \ | | | | 124| 1.21k| (void) (&__a == &__b); \ | | | | 125| 1.21k| (void) (&__a == __d); \ | | | | 126| 1.21k| *__d = __a * __b; \ | | | | 127| 1.21k| __builtin_constant_p(__b) ? \ | | | | ------------------ | | | | | Branch (127:2): [True: 0, False: 1.21k] | | | | ------------------ | | | | 128| 1.21k| __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.21k| __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.21k] | | | | | Branch (129:15): [True: 0, False: 0] | | | | ------------------ | | | | 130| 1.21k|}) | | ------------------ ------------------ 940| 65| return ret_errno(ERANGE); ------------------ | | 715| 65| ({ \ | | 716| 65| errno = labs(__errno__); \ | | 717| 65| -errno; \ | | 718| 65| }) ------------------ 941| | 942| 1.15k| return 0; 943| 1.21k|} lxc_char_left_gc: 957| 605k|{ 958| 605k| size_t i; 959| | 960| 642k| for (i = 0; i < len; i++) { ------------------ | Branch (960:14): [True: 609k, False: 33.8k] ------------------ 961| 609k| if (buffer[i] == ' ' || ------------------ | Branch (961:7): [True: 11.7k, False: 597k] ------------------ 962| 597k| buffer[i] == '\t') ------------------ | Branch (962:7): [True: 25.2k, False: 572k] ------------------ 963| 36.9k| continue; 964| | 965| 572k| return i; 966| 609k| } 967| | 968| 33.8k| return 0; 969| 605k|} lxc_char_right_gc: 972| 212k|{ 973| 212k| int i; 974| | 975| 215k| for (i = len - 1; i >= 0; i--) { ------------------ | Branch (975:20): [True: 181k, False: 33.8k] ------------------ 976| 181k| if (buffer[i] == ' ' || ------------------ | Branch (976:7): [True: 1.80k, False: 179k] ------------------ 977| 179k| buffer[i] == '\t' || ------------------ | Branch (977:7): [True: 1.04k, False: 178k] ------------------ 978| 178k| buffer[i] == '\n' || ------------------ | Branch (978:7): [True: 0, False: 178k] ------------------ 979| 178k| buffer[i] == '\0') ------------------ | Branch (979:7): [True: 0, False: 178k] ------------------ 980| 2.85k| continue; 981| | 982| 178k| return i + 1; 983| 181k| } 984| | 985| 33.8k| return 0; 986| 212k|} lxc_trim_whitespace_in_place: 989| 4.78k|{ 990| 4.78k| buffer += lxc_char_left_gc(buffer, strlen(buffer)); 991| 4.78k| buffer[lxc_char_right_gc(buffer, strlen(buffer))] = '\0'; 992| 4.78k| return buffer; 993| 4.78k|} lxc_is_line_empty: 996| 382k|{ 997| 382k| size_t len = strlen(line); 998| | 999| 419k| for (size_t i = 0; i < len; i++) ------------------ | Branch (999:21): [True: 418k, False: 1.03k] ------------------ 1000| 418k| if (line[i] != ' ' && line[i] != '\t' && ------------------ | Branch (1000:7): [True: 406k, False: 11.5k] | Branch (1000:25): [True: 382k, False: 24.7k] ------------------ 1001| 382k| line[i] != '\n' && line[i] != '\r' && ------------------ | Branch (1001:7): [True: 382k, False: 0] | Branch (1001:26): [True: 382k, False: 0] ------------------ 1002| 382k| line[i] != '\f' && line[i] != '\0') ------------------ | Branch (1002:7): [True: 381k, False: 273] | Branch (1002:26): [True: 381k, False: 0] ------------------ 1003| 381k| return 0; 1004| 1.03k| return 1; 1005| 382k|} conf.c:is_empty_string: 112| 689|{ 113| 689| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 689] | Branch (113:15): [True: 2, False: 687] ------------------ 114| 689|} conf.c:strequal: 135| 95.4k|{ 136| 95.4k| return strcmp(str, eq) == 0; 137| 95.4k|} conf.c:strnequal: 130| 110k|{ 131| 110k| return strncmp(str, eq, len) == 0; 132| 110k|} confile.c:strequal: 135| 5.78M|{ 136| 5.78M| return strcmp(str, eq) == 0; 137| 5.78M|} confile.c:abspath: 145| 2.05k|{ 146| 2.05k| return *str == '/'; 147| 2.05k|} confile.c:dotdot: 140| 1.64k|{ 141| 1.64k| return !!strstr(str, ".."); 142| 1.64k|} confile.c:is_empty_string: 112| 67.9k|{ 113| 67.9k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 67.9k] | Branch (113:15): [True: 114, False: 67.8k] ------------------ 114| 67.9k|} confile.c:strnequal: 130| 526k|{ 131| 526k| return strncmp(str, eq, len) == 0; 132| 526k|} confile_utils.c:strequal: 135| 5.38k|{ 136| 5.38k| return strcmp(str, eq) == 0; 137| 5.38k|} confile_utils.c:strnequal: 130| 220k|{ 131| 220k| return strncmp(str, eq, len) == 0; 132| 220k|} confile_utils.c:is_empty_string: 112| 1.02k|{ 113| 1.02k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 1.02k] | Branch (113:15): [True: 9, False: 1.01k] ------------------ 114| 1.02k|} log.c:is_empty_string: 112| 2.65k|{ 113| 2.65k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 2.65k] | Branch (113:15): [True: 0, False: 2.65k] ------------------ 114| 2.65k|} namespace.c:strequal: 135| 2.14k|{ 136| 2.14k| return strcmp(str, eq) == 0; 137| 2.14k|} string_utils.c:is_empty_string: 112| 6.32k|{ 113| 6.32k| return !s || strcmp(s, "") == 0; ------------------ | Branch (113:9): [True: 0, False: 6.32k] | Branch (113:15): [True: 1.15k, False: 5.16k] ------------------ 114| 6.32k|} string_utils.c:abspath: 145| 5.16k|{ 146| 5.16k| return *str == '/'; 147| 5.16k|} lxc_terminal_conf_free: 1398| 12.0k|{ 1399| 12.0k| free(terminal->log_path); 1400| 12.0k| free(terminal->path); 1401| 12.0k| if (terminal->buffer_size > 0 && terminal->ringbuf.addr) ------------------ | Branch (1401:6): [True: 182, False: 11.9k] | Branch (1401:35): [True: 0, False: 182] ------------------ 1402| 0| lxc_ringbuf_release(&terminal->ringbuf); 1403| 12.0k| lxc_terminal_signal_fini(terminal); 1404| 12.0k|} terminal.c:lxc_terminal_signal_fini: 164| 12.0k|{ 165| 12.0k| struct lxc_terminal_state *state = terminal->tty_state; 166| | 167| 12.0k| if (!terminal->tty_state) ------------------ | Branch (167:6): [True: 12.0k, False: 0] ------------------ 168| 12.0k| 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.61k|{ 203| 1.61k| unsigned long res; 204| 1.61k| char *ptr; 205| | 206| 1.61k| if (!arg || !*arg) ------------------ | Branch (206:6): [True: 0, False: 1.61k] | Branch (206:14): [True: 0, False: 1.61k] ------------------ 207| 0| return ret_errno(EINVAL); ------------------ | | 715| 0| ({ \ | | 716| 0| errno = labs(__errno__); \ | | 717| 0| -errno; \ | | 718| 0| }) ------------------ 208| | 209| 1.61k| errno = 0; 210| 1.61k| res = strtoul(arg, &ptr, base); 211| 1.61k| if (!ptr || ptr == arg || *ptr || res > 0xFFFF || errno != 0) ------------------ | Branch (211:6): [True: 0, False: 1.61k] | Branch (211:14): [True: 34, False: 1.57k] | Branch (211:28): [True: 8, False: 1.56k] | Branch (211:36): [True: 84, False: 1.48k] | Branch (211:52): [True: 0, False: 1.48k] ------------------ 212| 126| return ret_errno(ERANGE); ------------------ | | 715| 126| ({ \ | | 716| 126| errno = labs(__errno__); \ | | 717| 126| -errno; \ | | 718| 126| }) ------------------ 213| | 214| 1.48k| *val = res; 215| | 216| 1.48k| return 0; 217| 1.61k|} randseed: 736| 2.16k|{ 737| 2.16k| __do_fclose FILE *f = NULL; ------------------ | | 52| 2.16k|#define __do_fclose call_cleaner(fclose) | | ------------------ | | | | 26| 2.16k| __attribute__((__cleanup__(cleaner##_function))) __attribute__((unused)) | | ------------------ ------------------ 738| | /* 739| | * srand pre-seed function based on /dev/urandom 740| | */ 741| 2.16k| unsigned int seed = time(NULL) + getpid(); 742| | 743| 2.16k| f = fopen("/dev/urandom", "re"); 744| 2.16k| if (f) { ------------------ | Branch (744:6): [True: 2.16k, False: 0] ------------------ 745| 2.16k| int ret = fread(&seed, sizeof(seed), 1, f); 746| 2.16k| if (ret != 1) ------------------ | Branch (746:7): [True: 0, False: 2.16k] ------------------ 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| 2.16k| } 749| | 750| 2.16k| if (srand_it) ------------------ | Branch (750:6): [True: 0, False: 2.16k] ------------------ 751| 0| srand(seed); 752| | 753| 2.16k| return seed; 754| 2.16k|} lxc_find_next_power2: 1776| 1.97k|{ 1777| | /* 0 is not valid input. We return 0 to the caller since 0 is not a 1778| | * valid power of two. 1779| | */ 1780| 1.97k| if (n == 0) ------------------ | Branch (1780:6): [True: 0, False: 1.97k] ------------------ 1781| 0| return 0; 1782| | 1783| 1.97k| if (!(n & (n - 1))) ------------------ | Branch (1783:6): [True: 1.08k, False: 888] ------------------ 1784| 1.08k| return n; 1785| | 1786| 7.88k| while (n & (n - 1)) ------------------ | Branch (1786:9): [True: 6.99k, False: 888] ------------------ 1787| 6.99k| n = n & (n - 1); 1788| | 1789| 888| n = n << 1; 1790| 888| return n; 1791| 1.97k|} confile.c:lxc_getpagesize: 204| 1.97k|{ 205| 1.97k| int64_t pgsz; 206| | 207| 1.97k| pgsz = sysconf(_SC_PAGESIZE); 208| 1.97k| if (pgsz <= 0) ------------------ | Branch (208:6): [True: 0, False: 1.97k] ------------------ 209| 0| pgsz = 1 << 12; 210| | 211| 1.97k| return pgsz; 212| 1.97k|} file_utils.c:lxc_set_cloexec: 33| 12.0k|{ 34| 12.0k| return fcntl(fd, F_SETFD, FD_CLOEXEC); 35| 12.0k|} LLVMFuzzerTestOneInput: 15| 12.0k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 16| 12.0k| int fd = -1; 17| 12.0k| char tmpf[] = "/tmp/fuzz-lxc-config-read-XXXXXX"; 18| 12.0k| 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| 12.0k| if (size > 102400) ------------------ | Branch (24:6): [True: 5, False: 12.0k] ------------------ 25| 5| return 0; 26| | 27| 12.0k| fd = lxc_make_tmpfile(tmpf, false); 28| 12.0k| lxc_test_assert_abort(fd >= 0); ------------------ | | 34| 12.0k|#define lxc_test_assert_abort(expression) lxc_test_assert_stringify(expression, #expression) | | ------------------ | | | | 26| 12.0k| do { \ | | | | 27| 12.0k| if (!(expression)) { \ | | | | ------------------ | | | | | Branch (27:7): [True: 0, False: 12.0k] | | | | ------------------ | | | | 28| 0| fprintf(stderr, "%s: %s: %d: %s\n", __FILE__, \ | | | | 29| | __func__, __LINE__, stringify_expression); \ | | | | 30| 0| abort(); \ | | | | 31| 0| } \ | | | | 32| 12.0k| } while (false) | | ------------------ ------------------ | Branch (28:2): [Folded, False: 12.0k] ------------------ 29| 12.0k| lxc_write_nointr(fd, data, size); 30| 12.0k| close(fd); 31| | 32| 12.0k| conf = lxc_conf_init(); 33| 12.0k| lxc_test_assert_abort(conf); ------------------ | | 34| 12.0k|#define lxc_test_assert_abort(expression) lxc_test_assert_stringify(expression, #expression) | | ------------------ | | | | 26| 12.0k| do { \ | | | | 27| 12.0k| if (!(expression)) { \ | | | | ------------------ | | | | | Branch (27:7): [True: 0, False: 12.0k] | | | | ------------------ | | | | 28| 0| fprintf(stderr, "%s: %s: %d: %s\n", __FILE__, \ | | | | 29| | __func__, __LINE__, stringify_expression); \ | | | | 30| 0| abort(); \ | | | | 31| 0| } \ | | | | 32| 12.0k| } while (false) | | ------------------ ------------------ | Branch (33:2): [Folded, False: 12.0k] ------------------ 34| 12.0k| lxc_config_read(tmpf, conf, false); 35| 12.0k| lxc_conf_free(conf); 36| | 37| 12.0k| (void) unlink(tmpf); 38| 12.0k| return 0; 39| 12.0k|}