From 4e75d7f504b61ef031d14e4283fc5842cf126357 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Dec 2016 23:10:19 +0100 Subject: Export getentropy and getrandom calls getentropy per OpenBSD http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2 getrandom per Linux http://man7.org/linux/man-pages/man2/getrandom.2.html Note that GRND_NONBLOCK is not handled --- winsup/cygwin/include/cygwin/version.h | 7 ++++--- winsup/cygwin/include/sys/random.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 winsup/cygwin/include/sys/random.h (limited to 'winsup/cygwin/include') diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 6ba602efb..0da3d370a 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -10,8 +10,8 @@ details. */ the Cygwin shared library". This version is used to track important changes to the DLL and is mainly informative in nature. */ -#define CYGWIN_VERSION_DLL_MAJOR 2006 -#define CYGWIN_VERSION_DLL_MINOR 1 +#define CYGWIN_VERSION_DLL_MAJOR 2007 +#define CYGWIN_VERSION_DLL_MINOR 0 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are incompatible. */ @@ -470,12 +470,13 @@ details. */ 303: Export pthread_getname_np, pthread_setname_np. 304: Export strerror_l, strptime_l, wcsftime_l. 305: [f]pathconf flag _PC_CASE_INSENSITIVE added. + 306: Export getentropy, getrandom. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 305 +#define CYGWIN_VERSION_API_MINOR 306 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/include/sys/random.h b/winsup/cygwin/include/sys/random.h new file mode 100644 index 000000000..5422718a5 --- /dev/null +++ b/winsup/cygwin/include/sys/random.h @@ -0,0 +1,29 @@ +/* sys/random.h header file for Cygwin. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ + +#ifndef _SYS_RANDOM_H +#define _SYS_RANDOM_H + +#include <_ansi.h> +#include + +/* getrandom flags */ +#define GRND_NONBLOCK 1 +#define GRND_RANDOM 2 + +#ifdef __cplusplus +extern "C" { +#endif + +ssize_t getrandom (void *__ptr, size_t __len, unsigned int __flags); +int getentropy (void *__ptr, size_t __len); + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_RANDOM_H */ -- cgit v1.2.3