mailing list of musl libc
 help / color / mirror / code / Atom feed
* getrandom syscall
@ 2015-01-27 22:12 Daniel Cegiełka
  2015-01-28  9:02 ` Szabolcs Nagy
  2015-01-28 14:54 ` Rich Felker
  0 siblings, 2 replies; 25+ messages in thread
From: Daniel Cegiełka @ 2015-01-27 22:12 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 21 bytes --]

best regards,
Daniel

[-- Attachment #2: getrandom.c --]
[-- Type: text/x-csrc, Size: 333 bytes --]

#include <stddef.h>
#include <errno.h>
#include "syscall.h"

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;
}

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-02-09 20:37 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 22:12 getrandom syscall Daniel Cegiełka
2015-01-28  9:02 ` Szabolcs Nagy
2015-01-28  9:10   ` Daniel Cegiełka
2015-01-28 12:26     ` Szabolcs Nagy
2015-01-28 12:42       ` Daniel Cegiełka
2015-01-28 14:49         ` Rich Felker
2015-01-28 14:54 ` Rich Felker
2015-01-28 15:41   ` Szabolcs Nagy
2015-01-28 15:50     ` Daniel Cegiełka
2015-01-28 16:03       ` Szabolcs Nagy
2015-01-28 16:12         ` Daniel Cegiełka
2015-01-28 16:21           ` Rich Felker
2015-01-28 17:02             ` Daniel Cegiełka
2015-01-28 17:09               ` Daniel Cegiełka
2015-01-28 17:43                 ` Brent Cook
2015-01-28 18:12                   ` Daniel Cegiełka
2015-01-28 19:17                   ` Rich Felker
2015-01-28 19:33                     ` Daniel Cegiełka
2015-01-28 20:20                     ` Brent Cook
2015-01-28 22:02                       ` Rich Felker
2015-01-28 22:59                         ` Josiah Worcester
2015-02-09 20:37                         ` Andy Lutomirski
2015-01-28 16:25         ` Daniel Cegiełka
2015-01-28 16:01     ` Daniel Cegiełka
2015-01-28 15:41   ` Daniel Cegiełka

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).