Print this page
9971 Make getrandom(2) a public interface

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/random.h
          +++ new/usr/src/uts/common/sys/random.h
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  /*
  26      - * Copyright (c) 2015, Joyent, Inc.
       26 + * Copyright (c) 2018, Joyent, Inc.
  27   27   * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  28   28   */
  29   29  
  30   30  #ifndef _SYS_RANDOM_H
  31   31  #define _SYS_RANDOM_H
  32   32  
  33   33  #include <sys/types.h>
  34   34  #include <sys/atomic.h>
  35   35  
  36   36  #ifdef  __cplusplus
↓ open down ↓ 24 lines elided ↑ open up ↑
  61   61  #define BUMP_SWRAND_STATS(x, v) atomic_add_64(&(swrand_stats).x, (v))
  62   62  
  63   63  extern int random_add_entropy(uint8_t *, size_t, uint_t);
  64   64  extern int random_get_bytes(uint8_t *, size_t);
  65   65  extern int random_get_blocking_bytes(uint8_t *, size_t);
  66   66  extern int random_get_pseudo_bytes(uint8_t *, size_t);
  67   67  
  68   68  #endif /* _KERNEL */
  69   69  
  70   70  /*
  71      - * Flags for the getrandom system call. Note, we may want to move these
  72      - * definitions if we expose getrandom(2) into a public system call.
       71 + * Flags for the getrandom(2) system call.
  73   72   */
  74   73  #define GRND_NONBLOCK   0x0001          /* O_NONBLOCK equiv */
  75   74  #define GRND_RANDOM     0x0002          /* Use /dev/random, not /dev/urandom */
  76      -extern int getrandom(void *, size_t, int);
       75 +extern ssize_t getrandom(void *, size_t, unsigned int);
  77   76  
  78   77  #ifdef  __cplusplus
  79   78  }
  80   79  #endif
  81   80  
  82   81  #endif /* _SYS_RANDOM_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX