Rename rand_bool() to RAND_BOOL() to match other macros
PATCH 11/12 Rename rand_bool() to RAND_BOOL() to match other macros
From: Tyson Smith <[email protected]>
--- child.c | 2 +- children/read-all-files.c | 2 +- fault-read.c | 2 +- fault-write.c | 20 ++-- fd-epoll.c | 2 +- fd-files.c | 2 +- fd-sockets.c | 2 +- fd-testfiles.c | 2 +- generate-args.c | 4 +- include/random.h | 2 +- interesting-numbers.c | 2 +- ioctls/autofs.c | 2 +- ioctls/dm.c | 2 +- maps.c | 2 +- net/bpf.c | 2 +- net/proto-appletalk.c | 2 +- net/proto-caif.c | 2 +- net/proto-decnet.c | 2 +- net/proto-ipv4.c | 2 +- net/proto-ipv6.c | 4 +- net/proto-ipx.c | 2 +- net/proto-irda.c | 2 +- net/proto-llc.c | 2 +- net/proto-netlink.c | 2 +- net/proto-nfc.c | 4 +- net/proto-phonet.c | 2 +- net/proto-x25.c | 2 +- random-pathname.c | 4 +- random.c | 2 +- seed.c | 2 +- syscalls/fcntl.c | 12 +-- syscalls/ioctl.c | 2 +- syscalls/mlockall.c | 2 +- syscalls/mmap.c | 2 +- syscalls/mremap.c | 2 +- syscalls/msync.c | 2 +- syscalls/perf_event_open.c | 230 ++++++++++++++++++++++---------------------- syscalls/remap_file_pages.c | 6 +- syscalls/send.c | 2 +- syscalls/setsockopt.c | 4 +- syscalls/sigaction.c | 4 +- syscalls/splice.c | 4 +- syscalls/write.c | 2 +- 43 files changed, 180 insertions(+), 180 deletions(-)
child.c +1 -1
@@ -222,7 +222,7 @@ void init_child(struct childdata *child, int childno)set_make_it_fail (); -if (rand_bool ()) +if (RAND_BOOL ())use_fpu ();mask_signals_child ();
children/read-all-files.c +1 -1
@@ -52,7 +52,7 @@ int child_read_all_files(void)// if (ret != -1) // output(0, "%s:%s\n", filename, buffer); -if (rand_bool ()) +if (RAND_BOOL ())sleep (1 );free (buffer);
fault-read.c +1 -1
@@ -43,7 +43,7 @@ static void read_every_other_page(struct map *map) nr =nr_pages (map); - first =rand_bool (); + first =RAND_BOOL ();for (i = first; i < nr; i+=2 )memcpy (buf, p + (i * page_size), page_size);
fault-write.c +10 -10
@@ -31,7 +31,7 @@ static void fabricate_onepage_struct(char *page)if (i > page_size)return ; -if (rand_bool ()) +if (RAND_BOOL ()) val =rand64 ();else val = (unsigned long )get_address ();
@@ -76,7 +76,7 @@ static void generate_random_page(char *page)case 4 :for (i =0 ; i < page_size; ) - page[i++] = (unsigned char )rand_bool (); + page[i++] = (unsigned char )RAND_BOOL ();return ;/* return a page that looks kinda like a struct */
@@ -87,7 +87,7 @@ static void generate_random_page(char *page)case 6 :for (i =0 ; i < page_size; i +=2 ) { page[i] ='%' ; -switch (rand_bool ()) { +switch (RAND_BOOL ()) {case 0 : page[i +1 ] ='d' ;break ;case 1 : page[i +1 ] ='s' ;
@@ -104,11 +104,11 @@ static void generate_random_page(char *page)case 0 :switch (rand () %3 ) {case 0 : p =sprintf (page,"%s%lu" , -rand_bool () ?"-" :"" , +RAND_BOOL () ?"-" :"" , (unsigned long )rand64 ());break ;case 1 : p =sprintf (page,"%s%ld" , -rand_bool () ?"-" :"" , +RAND_BOOL () ?"-" :"" , (unsigned long )rand64 ());break ;case 2 : p =sprintf (page,"%lx" , (unsigned long )rand64 ());
@@ -119,11 +119,11 @@ static void generate_random_page(char *page)case 1 :switch (rand () %3 ) {case 0 : p =sprintf (page,"%s%u" , -rand_bool () ?"-" :"" , +RAND_BOOL () ?"-" :"" , (unsigned int )rand32 ());break ;case 1 : p =sprintf (page,"%s%d" , -rand_bool () ?"-" :"" , +RAND_BOOL () ?"-" :"" , (int )rand32 ());break ;case 2 : p =sprintf (page,"%x" , (int )rand32 ());
@@ -134,11 +134,11 @@ static void generate_random_page(char *page)case 2 :switch (rand () %3 ) {case 0 : p =sprintf (page,"%s%u" , -rand_bool () ?"-" :"" , +RAND_BOOL () ?"-" :"" , (unsigned char )rand ());break ;case 1 : p =sprintf (page,"%s%d" , -rand_bool () ?"-" :"" , +RAND_BOOL () ?"-" :"" , (char )rand ());break ;case 2 : p =sprintf (page,"%x" , (char )rand ());
@@ -179,7 +179,7 @@ static void dirty_every_other_page(struct map *map) nr =nr_pages (map); - first =rand_bool (); + first =RAND_BOOL ();for (i = first; i < nr; i+=2 ) p[i * page_size] =rand ();
fd-epoll.c +1 -1
@@ -25,7 +25,7 @@ static int open_epoll_fds(void)while (i <MAX_EPOLL_FDS ) { -if (rand_bool ()) +if (RAND_BOOL ()) fd =epoll_create (1 );else fd =epoll_create1 (EPOLL_CLOEXEC );
fd-files.c +1 -1
@@ -312,7 +312,7 @@ retry:/* OR in some random flags. */ retry_flags: -if (rand_bool ()) { +if (RAND_BOOL ()) { randflags =get_o_flags (); fd =open (filename, flags | randflags |O_NONBLOCK ); }else {
fd-sockets.c +1 -1
@@ -80,7 +80,7 @@ static int open_socket(unsigned int domain, unsigned int type, unsigned int prot nr_sockets++;/* Sometimes, listen on created sockets. */ -if (rand_bool ()) { +if (RAND_BOOL ()) {int ret;/* fake a sockaddr. */
fd-testfiles.c +1 -1
@@ -25,7 +25,7 @@ static int open_testfile(char *filename)/* file might be around from an earlier run, nuke it. */ (void )unlink (filename); -if (rand_bool ()) { +if (RAND_BOOL ()) { fd =open_with_fopen (filename,O_RDWR );if (fd !=-1 )output (2 ,"fd[%d] = fopen(\"%s\", O_RDWR)\n" , fd, filename);
generate-args.c +2 -2
@@ -37,7 +37,7 @@ static unsigned long handle_arg_address(struct syscallrecord *rec, unsigned intif (argnum ==1 )return (unsigned long )get_address (); -if (rand_bool ()) +if (RAND_BOOL ())return (unsigned long )get_address ();/* Half the time, we look to see if earlier args were also ARG_ADDRESS,
@@ -304,7 +304,7 @@ static unsigned long fill_arg(struct syscallrecord *rec, unsigned int argnum)switch (argtype) {case ARG_UNDEFINED : -if (rand_bool ()) +if (RAND_BOOL ())return (unsigned long )rand64 ();return (unsigned long )get_writable_address (page_size);
include/random.h +1 -1
@@ -13,7 +13,7 @@#error "Unexpected RAND_MAX value. Please add support."#endif -#define rand_bool () (rand() & 1) +#define RAND_BOOL () (rand() & 1)#define RAND_BYTE () (rand() & 0xff)extern unsigned int seed;
interesting-numbers.c +1 -1
@@ -95,7 +95,7 @@ unsigned long get_interesting_value(void) low = (rand () &0xf ) ? low :plus_minus_two (low);// 1 in 16 call plus_minus_two #if __WORDSIZE !=32 -if (rand_bool ()) {// FIXME: This should likely be less aggressive than 50/50 +if (RAND_BOOL ()) {// FIXME: This should likely be less aggressive than 50/50 switch (rand () %11 ) {case 0 :return 0x0000000100000000UL | low;case 1 :return 0x7fffffff00000000UL | low;
ioctls/autofs.c +1 -1
@@ -291,7 +291,7 @@ static void autofs_sanitise(const struct ioctl_group *grp, struct syscallrecord arg->ioctlfd =get_random_fd (); arg->fail.token =rand (); arg->fail.status =rand (); -if (rand_bool ()) { +if (RAND_BOOL ()) { arg->size +=5 ; arg->path[0 ] ='/' ; arg->path[1 ] =rand ();
ioctls/dm.c +1 -1
@@ -46,7 +46,7 @@ static void dm_sanitise(const struct ioctl_group *grp, struct syscallrecord *rec dm->version[2 ] =DM_VERSION_PATCHLEVEL ;/* clear one of these strings to pass some kernel validation */ -if (rand_bool ()) +if (RAND_BOOL ()) dm->name[0 ] =0 ;else dm->uuid[0 ] =0 ;
maps.c +1 -1
@@ -120,7 +120,7 @@ struct map * common_set_mmap_ptr_len(void)*/ void dirty_mapping (struct map *map) { -bool rw =rand_bool (); +bool rw =RAND_BOOL ();if (rw == TRUE) {/* Check mapping is writable, or we'll segv.
net/bpf.c +1 -1
@@ -606,7 +606,7 @@ static uint16_t gen_bpf_code_more_crazy(bool last_instr)* increase the chance to be accepted and that we * actually run the generated fuzz filter code. */ -if (rand_bool ()) +if (RAND_BOOL ()) ret =BPF_RET ; }
net/proto-appletalk.c +1 -1
@@ -28,7 +28,7 @@ void atalk_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)void atalk_rand_socket (struct socket_triplet *st) { -if (rand_bool ()) { +if (RAND_BOOL ()) { st->type =SOCK_DGRAM ; st->protocol =0 ;return ;
net/proto-caif.c +1 -1
@@ -39,7 +39,7 @@ void caif_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)void caif_rand_socket (struct socket_triplet *st) { st->protocol =rand () % _CAIFPROTO_MAX; -if (rand_bool ()) +if (RAND_BOOL ()) st->type =SOCK_SEQPACKET ;else st->type =SOCK_STREAM ;
net/proto-decnet.c +1 -1
@@ -31,7 +31,7 @@ void decnet_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)void decnet_rand_socket (struct socket_triplet *st) { -if (rand_bool ()) { +if (RAND_BOOL ()) { st->type =SOCK_SEQPACKET ; st->protocol =DNPROTO_NSP ; }else {
net/proto-ipv4.c +1 -1
@@ -193,7 +193,7 @@ void ip_setsockopt(struct sockopt *so)case IP_MULTICAST_ALL :case IP_MULTICAST_LOOP :case IP_RECVORIGDSTADDR : -if (rand_bool ()) +if (RAND_BOOL ()) so->optlen =sizeof (int );else so->optlen =sizeof (char );
net/proto-ipv6.c +2 -2
@@ -64,14 +64,14 @@ void inet6_rand_socket(struct socket_triplet *st)break ;case 1 : st->type =SOCK_DGRAM ;// UDP -if (rand_bool ()) +if (RAND_BOOL ()) st->protocol =0 ;else st->protocol =IPPROTO_UDP ;break ;case 2 : st->type =SOCK_SEQPACKET ;// SCTP -if (rand_bool ()) +if (RAND_BOOL ()) st->protocol =0 ;else st->protocol =IPPROTO_SCTP ;
net/proto-ipx.c +1 -1
@@ -21,7 +21,7 @@ void ipx_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)for (i =0 ; i <6 ; i++) ipx->sipx_node[i] =rand (); ipx->sipx_type =rand (); - ipx->sipx_zero =rand_bool (); + ipx->sipx_zero =RAND_BOOL (); *addr = (struct sockaddr *) ipx; *addrlen =sizeof (struct sockaddr_ipx ); }
net/proto-irda.c +1 -1
@@ -40,7 +40,7 @@ void irda_rand_socket(struct socket_triplet *st)break ;case 2 : st->type =SOCK_DGRAM ; -if (rand_bool ()) +if (RAND_BOOL ()) st->protocol =IRDAPROTO_ULTRA ;else st->protocol =IRDAPROTO_UNITDATA ;
net/proto-llc.c +1 -1
@@ -34,7 +34,7 @@ void llc_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)void llc_rand_socket (struct socket_triplet *st) { st->protocol =rand () %PROTO_MAX ; -if (rand_bool ()) +if (RAND_BOOL ()) st->type =SOCK_STREAM ;else st->type =SOCK_DGRAM ;
net/proto-netlink.c +1 -1
@@ -39,7 +39,7 @@ void netlink_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)void netlink_rand_socket (struct socket_triplet *st) { -if (rand_bool ()) +if (RAND_BOOL ()) st->type =SOCK_RAW ;else st->type =SOCK_DGRAM ;
net/proto-nfc.c +2 -2
@@ -26,9 +26,9 @@ void nfc_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)void nfc_rand_socket (struct socket_triplet *st) { -if (rand_bool ()) { +if (RAND_BOOL ()) { st->protocol =NFC_SOCKPROTO_LLCP ; -if (rand_bool ()) +if (RAND_BOOL ()) st->type =SOCK_DGRAM ;else st->type =SOCK_STREAM ;
net/proto-phonet.c +1 -1
@@ -26,7 +26,7 @@ void phonet_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)void phonet_rand_socket (struct socket_triplet *st) { st->protocol =0 ; -if (rand_bool ()) +if (RAND_BOOL ()) st->type =SOCK_DGRAM ;else st->type =SOCK_SEQPACKET ;
net/proto-x25.c +1 -1
@@ -35,7 +35,7 @@ void x25_setsockopt(struct sockopt *so) so->level =SOL_X25 ; optval = (unsigned int *) so->optval; - *optval =rand_bool (); + *optval =RAND_BOOL (); so->optlen =sizeof (int ); }
random-pathname.c +2 -2
@@ -27,7 +27,7 @@ const char * generate_pathname(void) len =strlen (pathname); -if (rand_bool ()) +if (RAND_BOOL ()) (void )strncpy (newpath, pathname, len);else {if (len <MAX_PATH_LEN -2 ) {
@@ -39,7 +39,7 @@ const char * generate_pathname(void) }/* 50/50 chance of making it look like a dir */ -if (rand_bool ()) { +if (RAND_BOOL ()) {if (len <=MAX_PATH_LEN -2 ) { newpath[len] ='/' ; newpath[len +1 ] =0 ;
random.c +1 -1
@@ -162,7 +162,7 @@ u64 rand64(void) {unsigned long r =0 ; -if (rand_bool ()) { +if (RAND_BOOL ()) {/* 32-bit ranges. */ r =rand32 ();
seed.c +1 -1
@@ -44,7 +44,7 @@ unsigned int new_seed(void)if ((fd =open ("/dev/urandom" ,O_RDONLY )) <0 ||read (fd, &r,sizeof (r)) !=sizeof (r)) { r =rand (); -if (!(rand_bool ())) { +if (!(RAND_BOOL ())) {gettimeofday (&t,NULL ); r |= t.tv_usec; }
syscalls/fcntl.c +6 -6
@@ -100,17 +100,17 @@ static void sanitise_fcntl(struct syscallrecord *rec)case F_NOTIFY : rec->a3 =0L ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 |=DN_ACCESS ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 |=DN_MODIFY ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 |=DN_CREATE ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 |=DN_DELETE ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 |=DN_RENAME ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 |=DN_ATTRIB ;break ;
syscalls/ioctl.c +1 -1
@@ -28,7 +28,7 @@ static void ioctl_mangle_cmd(struct syscallrecord *rec)static void ioctl_mangle_arg (struct syscallrecord *rec) {/* the argument could mean anything, because ioctl sucks like that. */ -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 =rand32 ();else rec->a3 = (unsigned long )get_non_null_address ();
syscalls/mlockall.c +1 -1
@@ -16,7 +16,7 @@ static void sanitise_mlockall(struct syscallrecord *rec)if (rec->a1 !=0 )return ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a1 =MCL_CURRENT ;else rec->a1 =MCL_FUTURE ;
syscalls/mmap.c +1 -1
@@ -99,7 +99,7 @@ static void post_mmap(struct syscallrecord *rec) this_child->num_mappings++;/* Sometimes dirty the mapping. */ -if (rand_bool ()) +if (RAND_BOOL ())dirty_mapping (new); }
syscalls/mremap.c +1 -1
@@ -58,7 +58,7 @@ static void post_mremap(struct syscallrecord *rec) map->ptr = ptr;/* Sometimes dirty the mapping first. */ -if (rand_bool ()) +if (RAND_BOOL ())dirty_mapping (map); }
syscalls/msync.c +1 -1
@@ -16,7 +16,7 @@ static void sanitise_msync(struct syscallrecord *rec) { (void )common_set_mmap_ptr_len (); -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 |=MS_INVALIDATE ; }
syscalls/perf_event_open.c +115 -115
342 lines not on this page · raw message
syscalls/remap_file_pages.c +3 -3
@@ -21,14 +21,14 @@ static void sanitise_remap_file_pages(struct syscallrecord *rec) map =common_set_mmap_ptr_len (); -if (rand_bool ()) { +if (RAND_BOOL ()) { start =rand () % map->size; start &=PAGE_MASK ; rec->a1 += start; }/* We just want to remap a part of the mapping. */ -if (rand_bool ()) +if (RAND_BOOL ()) size = page_size;else { size =rand () % map->size;
@@ -45,7 +45,7 @@ static void sanitise_remap_file_pages(struct syscallrecord *rec) rec->a3 =0 ;/* Pick a random pgoff. */ -if (rand_bool ()) +if (RAND_BOOL ()) offset =rand () & (size / page_size);else offset =0 ;
syscalls/send.c +1 -1
@@ -19,7 +19,7 @@ static void sanitise_send(struct syscallrecord *rec)unsigned int size;void *ptr; -if (rand_bool ()) +if (RAND_BOOL ()) size =1 ;else size =rand () % page_size;
syscalls/setsockopt.c +2 -2
@@ -88,7 +88,7 @@ void do_setsockopt(struct sockopt *so) so->optval = (unsigned long )zmalloc (page_size);// pick a size for optlen. At the minimum, we want an int (overridden below) -if (rand_bool ()) +if (RAND_BOOL ()) so->optlen =sizeof (int );else so->optlen =rand () %256 ;
@@ -110,7 +110,7 @@ void do_setsockopt(struct sockopt *so)/* optval should be nonzero to enable a boolean option, or zero if the option is to be disabled. * Let's disable it half the time. */ -if (rand_bool ()) { +if (RAND_BOOL ()) {free ((void *) so->optval); so->optval =0 ; }
syscalls/sigaction.c +2 -2
@@ -14,10 +14,10 @@static void sanitise_rt_sigaction (struct syscallrecord *rec) { -if (rand_bool ()) +if (RAND_BOOL ()) rec->a2 =0 ; -if (rand_bool ()) +if (RAND_BOOL ()) rec->a3 =0 ; rec->a4 =sizeof (sigset_t);
syscalls/splice.c +2 -2
@@ -17,12 +17,12 @@ static void sanitise_splice(struct syscallrecord *rec)if (ONE_IN (3 ))return ; -if (rand_bool ()) { +if (RAND_BOOL ()) { rec->a1 = shm->pipe_fds[rand () %MAX_PIPE_FDS ]; rec->a2 =0 ; } -if (rand_bool ()) { +if (RAND_BOOL ()) { rec->a3 = shm->pipe_fds[rand () %MAX_PIPE_FDS ]; rec->a4 =0 ; }
syscalls/write.c +1 -1
@@ -16,7 +16,7 @@ static void sanitise_write(struct syscallrecord *rec)unsigned int size;void *ptr; -if (rand_bool ()) +if (RAND_BOOL ()) size =1 ;else size =rand () % page_size;
Signature · 1 line
1.9.1