%PDF- %PDF-
Direktori : /backups/router/usr/local/lib/perl5/site_perl/mach/5.36/sys/ |
Current File : //backups/router/usr/local/lib/perl5/site_perl/mach/5.36/sys/buf_ring.ph |
require '_h2ph_pre.ph'; no warnings qw(redefine misc); unless(defined(&_SYS_BUF_RING_H_)) { eval 'sub _SYS_BUF_RING_H_ () {1;}' unless defined(&_SYS_BUF_RING_H_); require 'sys/param.ph'; require 'sys/kassert.ph'; require 'machine/atomic.ph'; require 'machine/cpu.ph'; if(defined(&DEBUG_BUFRING) && defined(&_KERNEL)) { require 'sys/lock.ph'; require 'sys/mutex.ph'; } if(defined(&DEBUG_BUFRING) && defined(&_KERNEL)) { } if(defined(&DEBUG_BUFRING)) { } if(defined(&DEBUG_BUFRING)) { } if(defined(&DEBUG_BUFRING)) { } if(defined(&DEBUG_BUFRING)) { if(defined(&_KERNEL)) { } } if(defined(&DEBUG_BUFRING)) { } if(defined(&DEBUG_BUFRING)) { } if(defined(&DEBUG_BUFRING) && defined(&_KERNEL)) { } # some #ifdef were dropped here -- fill in the blanks eval 'sub buf_ring_peek_clear_sc { my($br) = @_; eval q({ &uint32_t &cons_head, &prod_tail, &mask; &void * &ret; &mask = ($br->{br_cons_mask}); &prod_tail = &atomic_load_acq_32( ($br->{br_prod_tail})); &cons_head = ($br->{br_cons_head}); &if ( &cons_head == &prod_tail) ( &NULL); &ret = ($br->{br_ring[cons_head & mask]}); ( &ret); }); }' unless defined(&buf_ring_peek_clear_sc); eval 'sub buf_ring_full { my($br) = @_; eval q({ ( ($br->{br_prod_head}) == ($br->{br_cons_tail}) + ($br->{br_cons_size}) - 1); }); }' unless defined(&buf_ring_full); eval 'sub buf_ring_empty { my($br) = @_; eval q({ ( ($br->{br_cons_head}) == ($br->{br_prod_tail})); }); }' unless defined(&buf_ring_empty); eval 'sub buf_ring_count { my($br) = @_; eval q({ (( ($br->{br_prod_size}) + ($br->{br_prod_tail}) - ($br->{br_cons_tail})) & ($br->{br_prod_mask})); }); }' unless defined(&buf_ring_count); if(defined(&_KERNEL)) { } else { require 'stdlib.ph'; eval 'sub buf_ring_alloc { my($count) = @_; eval q({ \'struct buf_ring\' * &br; &KASSERT( &powerof2($count), (\\"buf ring must be size power of 2\\")); &br = &calloc(1, $sizeof{\'struct buf_ring\'} + $count * $sizeof{ &void }); &if ( &br == &NULL) ( &NULL); ($br->{br_prod_size}) = ($br->{br_cons_size}) = $count; ($br->{br_prod_mask}) = ($br->{br_cons_mask}) = $count - 1; ($br->{br_prod_head}) = ($br->{br_cons_head}) = 0; ($br->{br_prod_tail}) = ($br->{br_cons_tail}) = 0; ( &br); }); }' unless defined(&buf_ring_alloc); eval 'sub buf_ring_free { my($br) = @_; eval q({ &free($br); }); }' unless defined(&buf_ring_free); } } 1;