From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6885 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: getrandom syscall Date: Wed, 28 Jan 2015 10:02:12 +0100 Message-ID: <20150128090212.GE32318@port70.net> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1422435747 28730 80.91.229.3 (28 Jan 2015 09:02:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2015 09:02:27 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6898-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 28 10:02:27 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YGOW1-0004oH-FS for gllmg-musl@m.gmane.org; Wed, 28 Jan 2015 10:02:25 +0100 Original-Received: (qmail 31940 invoked by uid 550); 28 Jan 2015 09:02:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 31920 invoked from network); 28 Jan 2015 09:02:23 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:6885 Archived-At: * Daniel Cegie??ka [2015-01-27 23:12:46 +0100]: > #include > #include > #include "syscall.h" > #ifdef SYS_getrandom > int getrandom(void *buf, size_t len) > { > int ret, pre_errno = errno; > > if (len > 256) { > errno = EIO; > return -1; > } > do { > ret = syscall(SYS_getrandom, buf, len, 0); > } while (ret == -1 && errno == EINTR); > if (ret != len) > return -1; > errno = pre_errno; > return 0; > } #endif eg sh does not have the syscall (linux is not consistent with syscalls for whatever reason)