From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13173 Path: news.gmane.org!.POSTED!not-for-mail From: Balazs Kezes Newsgroups: gmane.linux.lib.musl.general Subject: qsort_r or qsort_s in musl Date: Mon, 3 Sep 2018 21:57:05 +0100 Message-ID: <20180903205705.GA7639@localhost> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1536013813 31532 195.159.176.226 (3 Sep 2018 22:30:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Sep 2018 22:30:13 +0000 (UTC) User-Agent: Mutt/1.9.2 (2017-12-15) To: musl@lists.openwall.com Original-X-From: musl-return-13189-gllmg-musl=m.gmane.org@lists.openwall.com Tue Sep 04 00:30:08 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fwxMG-000863-8J for gllmg-musl@m.gmane.org; Tue, 04 Sep 2018 00:30:08 +0200 Original-Received: (qmail 24524 invoked by uid 550); 3 Sep 2018 22:32:15 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13430 invoked from network); 3 Sep 2018 20:54:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=o2Ehb+Q+kh0nql6J5OoCAj18SRt7FIZQl4Kf1j5QMiY=; b=bf01I/6eSpW8HT3RdVf5i5Zy/vPAmRnGpkHeUkD+T03ZMSbwBv2DxVjU1iJtiHH5Ne E95Kc56CHude45N/fl31DOvkZIPdX+FRKyPMp5MKyqhd8wWZJGtI/aQ979qb4lUCKjeE 2TIeXRqDtn4jOLq9+Du9ZoF9ahSA/aMayl61mzZ7I/FtX2kQDh9+hip3M7FcsSZ86YmS v/L2+jV2ibPGqtZwWNBgyHQFdpSuJ4txtx6J1h0oIr76C6IHOTEIgkPI+1EbjaG1nOwZ JWOQpTMT51KS4G6ngb94pmUaTdK4LSsqyKQGrH8NNh4hKNDxFpH8cWir+Mapb1F6jgiE I6rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=o2Ehb+Q+kh0nql6J5OoCAj18SRt7FIZQl4Kf1j5QMiY=; b=PgJ5/qLorBLczievY0GlVeFmbrZ+nfWpykBl4edA1AB1WjEQ5CoxtYMV7B4ln48q88 UI2QRnIC+mb5RV93isaURGGXTJDpJzB450IHnNS+zAYXDVl025ILLImu0lZlgnmXMgT5 fyNA4zXtPwouPIwVFU5+bc9C7W4iHrj5ib2Ruh0N4IQXcjD368jzbbMhe9k0o5ZKrOx7 fPGLLTo1ECoVtSoBbrZMulxZdHonhXUHIMZFM/X89P7p8r+nl218PqRMsoGC7j35OVoE QWQXXHx7k8Bj5yXdv4S7LtKQX/uE5kRBTh3FKvBLXlvyKs9OufLhf4LH48UJpOrGq3t4 pBhg== X-Gm-Message-State: APzg51ALnXP73KbX3fv/hy5Ha2V6xQ5RyjmjBYraKrLsAQoQEUG2c/6o Ws+OniVImb9kRLhCYnB6Va04lbOr X-Google-Smtp-Source: ANB0Vdb9ipOcBClfyCf80HzKjgGcZ4NMXAVAlcdariYJ0v200RKiC4qnLO8Djpv9zOtj+uZoDpioPQ== X-Received: by 2002:a50:95a8:: with SMTP id w37-v6mr1818348eda.33.1536008087435; Mon, 03 Sep 2018 13:54:47 -0700 (PDT) Content-Disposition: inline Xref: news.gmane.org gmane.linux.lib.musl.general:13173 Archived-At: Hi! I can find a lot of discussions on the web around qsort_r and the pain that musl lacks it but I can't find any official word on this from musl devs. If there is one, could src/stdlib/qsort.c contain a pointer to it? Are there any plans having one of them in musl? I'd prefer qsort_r since that would provide greater compatibility with glibc. I even found patches for it: https://gist.github.com/izabera/e68927258ad2d29a1586bad276fabcab https://github.com/esmil/musl/commit/194f9cf93da8ae62491b7386edf481ea8565ae4e qsort_r differs between bsd/osx and glibc though: https://sourceware.org/ml/libc-alpha/2008-12/msg00003.html The argument for qsort_s is that it is in the C11 standard as an optional feature and has similar interface as glibc's qsort_r. To avoid choosing sides it could be even qsort_musl for all I care. I could then use preprocessor to choose the right version. I know there are many workarounds: global variables, thread local variables, copy pasting and changing qsort from musl in my own source tree, using glibc. None of them feel right. Any thoughts? Please CC me on the replies. Thank you, Balazs