{"id":807215,"url":"http://patchwork.ozlabs.org/api/patches/807215/?format=json","web_url":"http://patchwork.ozlabs.org/project/glibc/patch/CALoOobMeBycaWz2E7_YYQFeg38936j3xde5k3+zk1sgrLy+J0Q@mail.gmail.com/","project":{"id":41,"url":"http://patchwork.ozlabs.org/api/projects/41/?format=json","name":"GNU C Library","link_name":"glibc","list_id":"libc-alpha.sourceware.org","list_email":"libc-alpha@sourceware.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<CALoOobMeBycaWz2E7_YYQFeg38936j3xde5k3+zk1sgrLy+J0Q@mail.gmail.com>","list_archive_url":null,"date":"2017-08-29T18:11:54","name":"Extend tst-{atexit,at_quick_exit,cxa_atexit,onexit} to verify minimum number of supported handlers","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"fa0907140b4c31bb5444346f4d7e4dba44e7e950","submitter":{"id":6128,"url":"http://patchwork.ozlabs.org/api/people/6128/?format=json","name":"Paul Pluzhnikov","email":"ppluzhnikov@google.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/glibc/patch/CALoOobMeBycaWz2E7_YYQFeg38936j3xde5k3+zk1sgrLy+J0Q@mail.gmail.com/mbox/","series":[{"id":428,"url":"http://patchwork.ozlabs.org/api/series/428/?format=json","web_url":"http://patchwork.ozlabs.org/project/glibc/list/?series=428","date":"2017-08-29T18:11:54","name":"Extend tst-{atexit,at_quick_exit,cxa_atexit,onexit} to verify minimum number of supported handlers","version":1,"mbox":"http://patchwork.ozlabs.org/series/428/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807215/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807215/checks/","tags":{},"related":[],"headers":{"Return-Path":"<libc-alpha-return-83840-incoming=patchwork.ozlabs.org@sourceware.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list libc-alpha@sourceware.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-83840-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"tEUEM5KS\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhcDt5qs8z9sD9\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 04:12:46 +1000 (AEST)","(qmail 44774 invoked by alias); 29 Aug 2017 18:12:38 -0000","(qmail 44073 invoked by uid 89); 29 Aug 2017 18:12:37 -0000"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:mime-version:from:date:message-id:subject:to\n\t:content-type; q=dns; s=default; b=DfSrEUPGAPBVOSLGFSEL5qe5eAqnl\n\tyx9l0dIj+2SiiY4DjsTwf0S7Q/UCp/P1w2yCPwmKsKSW40fqoyMYFFCc8yHQaqiW\n\tBiTqtYSwnuSYx+zz7uSm/SjCIWvzMzLAhnO3WaBw8y7ym5dZt7BqUkrLvA1HwL2N\n\trLVDWcmYCCis3o=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:mime-version:from:date:message-id:subject:to\n\t:content-type; s=default; bh=EaFqDXL7S700dFYXH3DpkJfRGMU=; b=tEU\n\tEM5KS0pYbqJh73WPlLkpPuffaTuU/Oq1sgA+r4R/YYjrQgSrbKhOzC/xRnem35Nu\n\tltHxN38nSAhlKeWoqYySgHtAJBkkq+QxtA3DEMQuaEXBE3P4de7VrGvrjVqlJTMV\n\tsYisjSj/gNtBVwZEGnDGytL2+nyK14V85EvUq8mA=","Mailing-List":"contact libc-alpha-help@sourceware.org; run by ezmlm","Precedence":"bulk","List-Id":"<libc-alpha.sourceware.org>","List-Unsubscribe":"<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>","List-Subscribe":"<mailto:libc-alpha-subscribe@sourceware.org>","List-Archive":"<http://sourceware.org/ml/libc-alpha/>","List-Post":"<mailto:libc-alpha@sourceware.org>","List-Help":"<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>","Sender":"libc-alpha-owner@sourceware.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-24.3 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-vk0-f43.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:from:date:message-id:subject:to;\n\tbh=Jjfl8jVdiLhSuMYbaPqi5pHNOlptOWDoYtgVdXn1en4=;\n\tb=ueJ5zf7O5N7dQN/WvI/l1Ga7t4Zec6DYKp56OWMAm+EAPSfaZk4fKQ0b9CvcNyqtf2\n\tAIOYCuUrrdavFUu1yMGV0ZWGEv+Ff6OHxFucMR8QBEjrM86mKeCXp1QhexsQhXIv2pz3\n\t4U/gNFi7NpHQZhUuqBniFl2BURP6P4k2X1qm79Zhn1+T/EIj3JhtfmDCwHczQurnJdA2\n\tjLKPyNV1MLZph5+ZoHpkcP8XC6mtL8yn7oxqxnQv72OPQTo2833cR7wmYOCdfBzgqkM+\n\tMgIiap37J4H7jxKeCRtO/nEzKWCk353ZmFEIEL2++QFJLD//kk9zK6a8dJtvM0pIlJoC\n\tnjsg==","X-Gm-Message-State":"AHYfb5gyce77jYnCKKtzHWwSefrGcB8GVJU4yuU32wi5JK0jEv7KilfC\n\tV2NVz8PkgSUrHcX9aqRxYnAvbxGssYFrRb5xGA==","X-Google-Smtp-Source":"ADKCNb5KLPYRXADJJcj6SeZpEc4/A3gJPr7BmF1bkWWTRu5NrTg52lseLLLxmAZZzmr2xJfCR1olvKEqyjlnD9gBwF4=","X-Received":"by 10.31.49.200 with SMTP id x191mr649813vkx.127.1504030345315; \n\tTue, 29 Aug 2017 11:12:25 -0700 (PDT)","MIME-Version":"1.0","From":"Paul Pluzhnikov <ppluzhnikov@google.com>","Date":"Tue, 29 Aug 2017 11:11:54 -0700","Message-ID":"<CALoOobMeBycaWz2E7_YYQFeg38936j3xde5k3+zk1sgrLy+J0Q@mail.gmail.com>","Subject":"[PATCH] Extend tst-{atexit, at_quick_exit, cxa_atexit,\n\tonexit} to verify minimum number of supported handlers","To":"GLIBC Devel <libc-alpha@sourceware.org>","Content-Type":"multipart/mixed; boundary=\"001a1143e92877882d0557e85a6e\""},"content":"Greetings,\n\nThis patch implements the other TODO in stdlib/tst-atexit-common.c\n\n2017-08-29  Paul Pluzhnikov  <ppluzhnikov@google.com>\n\n        * stdlib/tst-atexit-common.c (do_test): Test support for at least\n        32 atexit handlers.","diff":"diff --git a/stdlib/tst-atexit-common.c b/stdlib/tst-atexit-common.c\nindex 99b00bf3aa..d6dcf08cdd 100644\n--- a/stdlib/tst-atexit-common.c\n+++ b/stdlib/tst-atexit-common.c\n@@ -23,7 +23,13 @@\n #include <unistd.h>\n #include <sys/wait.h>\n \n-#define MAX_ATEXIT 20  /* Large enough for current set of invocations.  */\n+/* http://pubs.opengroup.org/onlinepubs/000095399/functions/atexit.html\n+   requires that we support at least 32 atexit handlers.\n+\n+   The number we actually support is limited by memory. Here we simply\n+   check that we support at least the minimum required.  */\n+#define MAX_ATEXIT 32\n+\n static char crumbs[MAX_ATEXIT];\n static int next_slot = 0;\n \n@@ -66,7 +72,7 @@ static void\n fn_final (void)\n {\n   /* Arbitrary sequence matching current registrations.  */\n-  const char expected[] = \"3021121130211\";\n+  const char expected[] = \"00000000000000000000000003021121130211\";\n \n   if (strcmp (crumbs, expected) == 0)\n     _exit_with_flush (0);\n@@ -76,25 +82,26 @@ fn_final (void)\n   _exit_with_flush (1);\n }\n \n-/* This is currently just a basic test to verify that exit handlers execute\n-   in LIFO order, even when the handlers register additional new handlers.\n-\n-   TODO: Additional tests that we should do:\n-   1. POSIX says we need to support at least ATEXIT_MAX\n-   2. ...  */\n-\n static int\n do_test (void)\n {\n+  int slots_remaining = MAX_ATEXIT;\n+\n   /* Register this first so it can verify expected order of the rest.  */\n-  ATEXIT (fn_final);\n+  ATEXIT (fn_final); --slots_remaining;\n \n-  ATEXIT (fn1);\n-  ATEXIT (fn3);\n-  ATEXIT (fn1);\n-  ATEXIT (fn2);\n-  ATEXIT (fn1);\n-  ATEXIT (fn3);\n+  ATEXIT (fn1); --slots_remaining;\n+  ATEXIT (fn3); --slots_remaining;\n+  ATEXIT (fn1); --slots_remaining;\n+  ATEXIT (fn2); --slots_remaining;\n+  ATEXIT (fn1); --slots_remaining;\n+  ATEXIT (fn3); --slots_remaining;\n+\n+  /* Fill the rest of available slots with fn0.  */\n+  while (slots_remaining > 0)\n+    {\n+      ATEXIT (fn0); --slots_remaining;\n+    }\n \n   /* Verify that handlers registered above are inherited across fork.  */\n   const pid_t child = fork ();\n","prefixes":[]}