示例#1
0
void	Flip_token_body( char *buf, token_header *token_ptr )
{
/*
 * This routine can not be called twice for the same buffer because
 * of ring_rtr_ptr->num_seq.
 */
	ring_rtr	*ring_rtr_ptr;
	int32		*req_seq;
	char		*rtr;
	int		ptr;
	int		i;

	if( token_ptr->rtr_len <= 0 ) return;

	rtr = buf;
	ptr = 0;
	while( ptr < token_ptr->rtr_len )
	{
	    ring_rtr_ptr = (ring_rtr *)&rtr[ptr];

	    ring_rtr_ptr->memb_id.proc_id = Flip_int32( ring_rtr_ptr->memb_id.proc_id );
	    ring_rtr_ptr->memb_id.time    = Flip_int32( ring_rtr_ptr->memb_id.time );
	    ring_rtr_ptr->proc_id	  = Flip_int32( ring_rtr_ptr->proc_id );
	    ring_rtr_ptr->seg_index	  = Flip_int16( ring_rtr_ptr->seg_index );
	    ring_rtr_ptr->num_seq	  = Flip_int16( ring_rtr_ptr->num_seq );

	    ptr += sizeof(ring_rtr);
	    for( i=0; i < ring_rtr_ptr->num_seq; i++ )
	    {
		req_seq = (int32 *)&rtr[ptr];
		*req_seq = Flip_int32( *req_seq );
		ptr += sizeof(int32);
	    }	
	}
}
示例#2
0
//-------------------------------------------------------------------
void avr_write_binfile(bblklist_t* blist, char* outFileName, file_desc_t* fdesc, uint32_t startaddr)
{
  FILE *outbinFile;
  basicblk_t* cblk;
  int i;
  avr_instr_t instr;
  uint8_t* buff;

  /*
  inbinFile = fopen(inFileName, "r");
  if (NULL == inbinFile){
    fprintf(stderr, "Error opening file %s\n", inFileName);
    exit(EXIT_FAILURE);
  }  
  */
  if (fdesc->type != BIN_FILE) return;
  
  outbinFile = fopen(outFileName, "w");
  if (NULL == outbinFile){
    fprintf(stderr, "Error opening file %s\n", outFileName);
    exit(EXIT_FAILURE);
  }  
  
  if ((buff = malloc(sizeof(uint8_t)*startaddr)) == NULL){
    fprintf(stderr, "Out of memory.\n");
    exit(EXIT_FAILURE);
  }

  obj_file_seek(fdesc, 0, SEEK_SET);
  if (obj_file_read(fdesc, buff, sizeof(uint8_t), startaddr) == 0){
    fprintf(stderr, "avr_write_binfile: Premature end of input file.\n");
    exit(EXIT_FAILURE);
  }

  // Patch the SOS module header
  sos_patch_mod_header(blist, buff);

  if (fwrite(buff, sizeof(uint8_t), startaddr, outbinFile) == 0){
      fprintf(stderr, "avr_write_binfile: Premature end of output file.\n");
      exit(EXIT_FAILURE);
  }

  for (cblk = blist->blk_st; cblk != NULL; cblk = (basicblk_t*)cblk->link.next){
    for (i = 0; i < (int)(cblk->newsize/sizeof(avr_instr_t)); i++){
      instr.rawVal = cblk->newinstr[i].rawVal;
#ifdef BBIG_ENDIAN
      instr.rawVal = Flip_int16(instr.rawVal);
#endif
      if (fwrite(&instr, sizeof(avr_instr_t),1, outbinFile) != 1){
	fprintf(stderr, "avr_write_binfile: Error during file write.\n");
	exit(EXIT_FAILURE);
      }
    }    
  }  
  fclose(outbinFile);
  return;
}
示例#3
0
void	FC_handle_message( sys_scatter *scat )
{

	int16		*cur_fc_buf;
	packet_header	*pack_ptr;
	proc		dummy_proc;
	int		my_index;
	int16		temp_window,temp_personal_window;
        configuration   *Cn;

        Cn = Conf_ref();

	pack_ptr = (packet_header *)scat->elements[0].buf;
        if ( ! Conf_get_dangerous_monitor_state() ) {
                Alarm( FLOW_CONTROL, "FC_handle_message: Request to change flow control from (%d.%d.%d.%d) denied. Monitor in safe mode\n", IP1(pack_ptr->proc_id), IP2(pack_ptr->proc_id), IP3(pack_ptr->proc_id), IP4(pack_ptr->proc_id) );
                return;
        }

	if( ! ( pack_ptr->memb_id.proc_id == 15051963 && Conf_id_in_conf( Cn, pack_ptr->proc_id ) != -1 ) )
	{
		Alarm( FLOW_CONTROL, 
			"FC_handle_message: Illegal monitor request\n");
		return;
	}
	cur_fc_buf = (int16 *)scat->elements[1].buf;

	my_index = Conf_proc_by_id( Conf_my().id, &dummy_proc );

	if( Same_endian( pack_ptr->type ) ) {
		temp_window = cur_fc_buf[Conf_num_procs( Cn )];
		temp_personal_window = cur_fc_buf[my_index];
	}else{
		temp_window = Flip_int16( cur_fc_buf[Conf_num_procs( Cn )] );
		temp_personal_window = Flip_int16( cur_fc_buf[my_index] );
	}
	if( temp_window != -1 ) Window = temp_window;
	if( temp_personal_window != -1 ) Personal_window = temp_personal_window;
	GlobalStatus.window = Window;
	GlobalStatus.personal_window = Personal_window;
	Alarm( FLOW_CONTROL, 
		"FC_handle_message: Got monitor mess, Window %d Personal %d\n", 
			Window, Personal_window );
}
示例#4
0
文件: basicblock.c 项目: nesl/sos-2x
//--------------------------------------------------------------
static void find_block_boundaries(file_desc_t* fdesc, bblklist_t* blist, uint32_t startaddr)
{
    avr_instr_t instr;
    uint32_t currAddr;
    succ_t succ;

    // Set the file pointer to the start of first instruction
    obj_file_seek(fdesc, startaddr, SEEK_SET);

    // Insert the first boundary
    insert_blkbnd(blist, startaddr);
#if defined(DBGMODE) && defined(DBG_FIND_BLK_BND)
    printf("\n");
#endif

    currAddr = startaddr;
    succ.branchflag = 0;
    succ.fallflag = 0;

    // Start reading the instructions - First pass through the file
    while (obj_file_read(fdesc, &instr, sizeof(avr_instr_t), 1) != 0) {
#ifdef BBIG_ENDIAN
        instr.rawVal = Flip_int16(instr.rawVal);
#endif

#if defined(DBGMODE) && defined(DBG_FIND_BLK_BND)
        printf("0x%5x: %4x ", currAddr, instr.rawVal);
        decode_avr_instr_word(&instr);
#endif

        find_succ(fdesc, currAddr, &instr, &succ);

        if (succ.branchflag == 1) {
            insert_blkbnd(blist, succ.branchaddr);
        }
        if (succ.fallflag == 1) {
            insert_blkbnd(blist, succ.falladdr);
        }
        currAddr += 2;
#if defined(DBGMODE) && defined(DBG_FIND_BLK_BND)
        printf("\n");
#endif

    }
    // Insert a dummy boundary at the last address
    insert_blkbnd(blist, currAddr);
    // Basic Block with StartAddress
    blist->blk_st = find_block(blist, startaddr);
    return;
}
示例#5
0
文件: basicblock.c 项目: nesl/sos-2x
//--------------------------------------------------------------
static void fill_basic_block(file_desc_t* fdesc, basicblk_t* currblk, basicblk_t* nextblk, uint32_t currAddr)
{
    if (nextblk != NULL)
        currblk->size = nextblk->addr - currblk->addr;

    if (currblk->size > 0) {
        avr_instr_t instr;
        int i, numinstr;

        // Set the file pointer and read
        obj_file_seek(fdesc, currblk->addr, SEEK_SET);


        // Assert currblk->instr is NULL
        if (currblk->instr != NULL) {
            fprintf(stderr, "Memory corruption. Current Block Start Address: 0x%x\n", (int)currblk->addr);
            exit(EXIT_FAILURE);
        }
        // Allocate memory for currblk->instr
        if ((currblk->instr = malloc(currblk->size * sizeof(uint8_t))) == NULL) {
            fprintf(stderr, "fill_basic_block: malloc out of memory\n");
            exit(EXIT_FAILURE);
        }

        numinstr = (int)(currblk->size/sizeof(avr_instr_t));
        for (i = 0; i < numinstr; i++) {
            if (obj_file_read(fdesc, &instr, sizeof(avr_instr_t), 1) == 0) {
                fprintf(stderr, "fill_basic_block: Error reading from file.\n");
                exit(EXIT_FAILURE);
            }
#ifdef BBIG_ENDIAN
            currblk->instr[i].rawVal = Flip_int16(instr.rawVal);
#endif
        }
        // Allocate memory for addrmap
        if ((currblk->addrmap = malloc(numinstr * sizeof(uint32_t))) == NULL) {
            fprintf(stderr,"fill_basic_block: Malloc out of memory for address map.\n");
            exit(EXIT_FAILURE);
        }
    }

    // Set the file pointer back to the current address
    obj_file_seek(fdesc, currAddr, SEEK_SET);

    return;
}
示例#6
0
文件: basicblock.c 项目: nesl/sos-2x
//--------------------------------------------------------------
static uint8_t find_next_instr_size(file_desc_t* fdesc)
{
    avr_instr_t instr;

    if (obj_file_read(fdesc, &instr, sizeof(avr_instr_t), 1) == 0) {
        fprintf(stderr, "Error in find_next_instr_size\n");
        exit(EXIT_FAILURE);
    }
    obj_file_seek(fdesc, -sizeof(avr_instr_t), SEEK_CUR);
#ifdef BBIG_ENDIAN
    instr.rawVal = Flip_int16(instr.rawVal);
#endif
    // Check if it is a two word instruction
    if ((match_optype10(&instr) == 0) || (match_optype19(&instr) == 0)) {
        return 2;
    }

    return 1;
}
示例#7
0
//-------------------------------------------------------------------
static void avr_create_new_text_data(Elf_Data* edata, Elf_Data* nedata, 
				     file_desc_t* fdesc, bblklist_t* blist, uint32_t startaddr)
{
  basicblk_t* cblk;
  int i;
  avr_instr_t instr;
  avr_instr_t* wrptr;
    
  nedata->d_type = edata->d_type;
  nedata->d_align = edata->d_align;
  nedata->d_size = startaddr;

  for (cblk = blist->blk_st; cblk != NULL; cblk = (basicblk_t*)cblk->link.next)
    nedata->d_size += cblk->newsize;
  nedata->d_buf = (uint8_t*)malloc(nedata->d_size);

  obj_file_seek(fdesc, 0, SEEK_SET);
  if (obj_file_read(fdesc, nedata->d_buf, sizeof(uint8_t), startaddr) == 0){
    fprintf(stderr, "avr_write_binfile: Premature end of input file.\n");
    exit(EXIT_FAILURE);
  }
  wrptr = (avr_instr_t*)((uint8_t*)((uint8_t*)nedata->d_buf + startaddr));
 
  for (cblk = blist->blk_st; cblk != NULL; cblk = (basicblk_t*)cblk->link.next){
    for (i = 0; i < (int)(cblk->newsize/sizeof(avr_instr_t)); i++){
      instr.rawVal = cblk->newinstr[i].rawVal;
#ifdef BBIG_ENDIAN
      instr.rawVal = Flip_int16(instr.rawVal);
#endif
      if (((uint8_t*)wrptr - (uint8_t*)(nedata->d_buf) + sizeof(avr_instr_t)) <= nedata->d_size){
	wrptr->rawVal = instr.rawVal;
	wrptr++;
      }
      else
	fprintf(stderr, "avr_create_new_text_data: Buffer overflow while writing sandbox .text section.\n");
    }    
  }  
  return;
}
示例#8
0
static	void	Report_message(mailbox fd, int dummy, void *dummy_p)
{
	proc	p;
	proc	leader_p;
	int	ret;
	int	ret1,ret2;
static	int32	last_mes;
static	int32	last_aru;
static	int32	last_sec;

	last_mes = GlobalStatus.message_delivered;
	last_aru = GlobalStatus.aru;
	last_sec = GlobalStatus.sec;

	ret = DL_recv( fd, &Report_scat );
	if( ret <= 0 ) {
            Alarm( DEBUG, "Report_messsage: DL_recv failed with ret %d, errno %d\n", ret, sock_errno);
            return;
        }

	if( !Same_endian( Report_pack.type ) )
	{
		GlobalStatus.sec		= Flip_int32( GlobalStatus.sec );
		GlobalStatus.state		= Flip_int32( GlobalStatus.state );
		GlobalStatus.gstate		= Flip_int32( GlobalStatus.gstate );
		GlobalStatus.packet_sent	= Flip_int32( GlobalStatus.packet_sent );
		GlobalStatus.packet_recv	= Flip_int32( GlobalStatus.packet_recv );
		GlobalStatus.packet_delivered   = Flip_int32( GlobalStatus.packet_delivered );
		GlobalStatus.retrans		= Flip_int32( GlobalStatus.retrans );
		GlobalStatus.u_retrans	        = Flip_int32( GlobalStatus.u_retrans );
		GlobalStatus.s_retrans	        = Flip_int32( GlobalStatus.s_retrans );
		GlobalStatus.b_retrans	        = Flip_int32( GlobalStatus.b_retrans );
		GlobalStatus.aru		= Flip_int32( GlobalStatus.aru );
		GlobalStatus.my_aru		= Flip_int32( GlobalStatus.my_aru );
		GlobalStatus.highest_seq	= Flip_int32( GlobalStatus.highest_seq );
		GlobalStatus.token_hurry	= Flip_int32( GlobalStatus.token_hurry );
		GlobalStatus.token_rounds	= Flip_int32( GlobalStatus.token_rounds );
		GlobalStatus.my_id		= Flip_int32( GlobalStatus.my_id );
		GlobalStatus.leader_id	        = Flip_int32( GlobalStatus.leader_id );
		GlobalStatus.message_delivered  = Flip_int32( GlobalStatus.message_delivered );
		GlobalStatus.membership_changes = Flip_int16( GlobalStatus.membership_changes);
		GlobalStatus.num_procs	        = Flip_int16( GlobalStatus.num_procs );
		GlobalStatus.num_segments	= Flip_int16( GlobalStatus.num_segments );
		GlobalStatus.window		= Flip_int16( GlobalStatus.window );
		GlobalStatus.personal_window	= Flip_int16( GlobalStatus.personal_window );
		GlobalStatus.accelerated_ring	= Flip_int16( GlobalStatus.accelerated_ring );
		GlobalStatus.accelerated_window	= Flip_int16( GlobalStatus.accelerated_window );
		GlobalStatus.num_sessions	= Flip_int16( GlobalStatus.num_sessions );
		GlobalStatus.num_groups	        = Flip_int16( GlobalStatus.num_groups );
		GlobalStatus.major_version		= Flip_int16( GlobalStatus.major_version );
		GlobalStatus.minor_version		= Flip_int16( GlobalStatus.minor_version );
		GlobalStatus.patch_version		= Flip_int16( GlobalStatus.patch_version );
	}
	printf("\n============================\n");
	ret1 = Conf_proc_by_id( GlobalStatus.my_id, &p );
	ret2 = Conf_proc_by_id( GlobalStatus.leader_id, &leader_p );
	if( ret1 < 0 )
	{
		printf("Report_message: Skiping illegal status \n");
		printf("==================================\n");
		return;
	}
	printf("Status at %s V%2d.%02d.%2d (state %d, gstate %d) after %d seconds :\n",p.name, 
               GlobalStatus.major_version,GlobalStatus.minor_version,GlobalStatus.patch_version, 
               GlobalStatus.state, GlobalStatus.gstate, GlobalStatus.sec);
	if( ret2 < 0 )
	     printf("Membership  :  %d  procs in %d segments, leader is %d, ",
			GlobalStatus.num_procs,GlobalStatus.num_segments,GlobalStatus.leader_id);
	else printf("Membership  :  %d  procs in %d segments, leader is %s, ",
		GlobalStatus.num_procs,GlobalStatus.num_segments,leader_p.name);
        if (GlobalStatus.accelerated_ring == 0)
            printf("regular protocol\n");
        else
            printf("accelerated protocol\n");

	printf("rounds   : %7d\ttok_hurry : %7d\tmemb change: %7d\n",GlobalStatus.token_rounds,GlobalStatus.token_hurry,GlobalStatus.membership_changes);
	printf("sent pack: %7d\trecv pack : %7d\tretrans    : %7d\n",GlobalStatus.packet_sent,GlobalStatus.packet_recv,GlobalStatus.retrans);
	printf("u retrans: %7d\ts retrans : %7d\tb retrans  : %7d\n",GlobalStatus.u_retrans,GlobalStatus.s_retrans,GlobalStatus.b_retrans);
	printf("My_aru   : %7d\tAru       : %7d\tHighest seq: %7d\n",GlobalStatus.my_aru,GlobalStatus.aru, GlobalStatus.highest_seq);
	printf("Sessions : %7d\tGroups    : %7d\tWindow     : %7d\n",GlobalStatus.num_sessions,GlobalStatus.num_groups,GlobalStatus.window);
	printf("Deliver M: %7d\tDeliver Pk: %7d\tP/A Window : %7d/%d\n",GlobalStatus.message_delivered,GlobalStatus.packet_delivered,GlobalStatus.personal_window,GlobalStatus.accelerated_window);
	printf("Delta Mes: %7d\tDelta Pk  : %7d\tDelta sec  : %7d\n",GlobalStatus.message_delivered - last_mes,GlobalStatus.aru - last_aru,GlobalStatus.sec - last_sec);
	printf("==================================\n");

	printf("\n");
	printf("Monitor> ");
	fflush(stdout);

}
示例#9
0
文件: basicblock.c 项目: nesl/sos-2x
//--------------------------------------------------------------
static void link_basic_blocks(file_desc_t* fdesc, bblklist_t* blist, uint32_t startaddr)
{
    avr_instr_t instr;
    uint32_t currAddr;
    succ_t succ;
    basicblk_t *currblk, *nextblk;

    // Set the file pointer to the start of first instruction
    obj_file_seek(fdesc, startaddr, SEEK_SET);

    currAddr = startaddr;
    currblk = find_block(blist, startaddr);
    nextblk = (basicblk_t*)(currblk->link.next);
    succ.branchflag = 0;
    succ.fallflag = 0;

    // Start reading the instructions - Second pass through the file
    while (obj_file_read(fdesc, &instr, sizeof(avr_instr_t), 1) != 0) {
#ifdef BBIG_ENDIAN
        instr.rawVal = Flip_int16(instr.rawVal);
#endif
        DEBUG("Addr: 0x%x\n", currAddr);


        find_succ(fdesc, currAddr, &instr, &succ);
        currAddr += 2;

        if ((succ.branchflag == 1) || (succ.fallflag == 1)) {
            // We have a successor
            currblk->flag = succ.flag;
            if (succ.branchflag == 1) {
                if ((currblk->branch = find_block(blist, succ.branchaddr)) == NULL) {
                    fprintf(stderr, "link_basic_blocks: branch is NULL. Blist is not formed correctly.\n");
                    exit(EXIT_FAILURE);
                }
            }
            else
                currblk->branch = NULL;
            if (succ.fallflag == 1) {
                if ((currblk->fall = find_block(blist, succ.falladdr)) == NULL) {
                    fprintf(stderr, "link_basic_blocks: succ is NULL. Blist is not formed correctly.\n");
                    exit(EXIT_FAILURE);
                }
            }
            else
                currblk->fall = NULL;
            fill_basic_block(fdesc, currblk, nextblk, currAddr);
            currblk = nextblk;
            nextblk = (basicblk_t*)(currblk->link.next);
            continue;
        }

        if (nextblk->addr == currAddr) {
            // We crossed a block boundary
            currblk->flag = 0;
            currblk->fall = nextblk;
            currblk->branch = NULL;
            fill_basic_block(fdesc, currblk, nextblk, currAddr);
            currblk = nextblk;
            nextblk = (basicblk_t*)(currblk->link.next);
            continue;
        }
    }
    return;
}
示例#10
0
int	DL_recvfrom( channel chan, sys_scatter *scat, int *src_address, unsigned short *src_port )
{
#ifndef ARCH_SCATTER_NONE
static	struct	msghdr	msg;
#else	/* ARCH_SCATTER_NONE */
static	char		pseudo_scat[MAX_PACKET_SIZE];
	int		bytes_to_copy;
	int		total_len;
	int		start;
	int		i;
#endif	/* ARCH_SCATTER_NONE */
        struct  sockaddr_in     source_address;
        int             sip;
        unsigned short  sport;
        socklen_t       sa_len;
	int		ret;

        /* check the scat is small enough to be a sys_scatter */
        assert(scat->num_elements <= ARCH_SCATTER_SIZE);

#ifndef ARCH_SCATTER_NONE
	msg.msg_name 	= (caddr_t) &source_address;
	msg.msg_namelen = sizeof(source_address);
	msg.msg_iov	= (struct iovec *)scat->elements;
	msg.msg_iovlen	= scat->num_elements;
#endif	/* ARCH_SCATTER_NONE */

#ifdef ARCH_SCATTER_CONTROL
	msg.msg_control = (caddr_t) 0;
	msg.msg_controllen = 0;
#endif /* ARCH_SCATTER_CONTROL */
#ifdef ARCH_SCATTER_ACCRIGHTS
	msg.msg_accrights = (caddr_t) 0;
	msg.msg_accrightslen = 0;
#endif /* ARCH_SCATTER_ACCRIGHTS */

#ifndef ARCH_SCATTER_NONE
	ret = recvmsg( chan, &msg, 0 ); 
        sa_len = msg.msg_namelen;
#else	/* ARCH_SCATTER_NONE */
        
	total_len = 0;                             /*This is for TCP, to not receive*/
	for(i=0; i<scat->num_elements; i++)     /*more than one packet.          */
	   total_len += scat->elements[i].len;
        
        if(total_len>MAX_PACKET_SIZE)
           total_len = MAX_PACKET_SIZE;

        sa_len = sizeof(source_address);
	ret = recvfrom( chan, pseudo_scat, total_len, 0, &source_address, &sa_len);
	
	for( i=0, total_len = ret, start =0; total_len > 0; i++)
	{
		bytes_to_copy = scat->elements[i].len;
		if( bytes_to_copy > total_len ) bytes_to_copy = total_len;
		memcpy( scat->elements[i].buf, &pseudo_scat[start], 
                        bytes_to_copy );
		total_len-= scat->elements[i].len;
		start    += scat->elements[i].len;
	}
#endif	/* ARCH_SCATTER_NONE */
	if (ret < 0)
	{
		Alarm( DATA_LINK, "DL_recv: error %d receiving on channel %d\n", ret, chan );
		return( -1 );
	} 
#ifdef ARCH_SCATTER_CONTROL
        else if (ret == 0)
        {
                char    *sptr;
                unsigned short port;
                Alarm( DATA_LINK, "DL_recv: received zero length packet on channel %d flags 0x%x msg_len %d\n", chan, msg.msg_flags, msg.msg_namelen);
                if (msg.msg_namelen >= sizeof(struct sockaddr_in) ) {
                    sptr = (char *) inet_ntoa(source_address.sin_addr);
                    port = Flip_int16(source_address.sin_port);
                    Alarm( DATA_LINK, "\tfrom %s with family %d port %d\n", sptr, source_address.sin_family, port );
                }
#ifdef  MSG_BCAST
                if ( msg.msg_flags & MSG_BCAST )
                {
                        Alarm( DATA_LINK, "\t(BROADCAST)");
                }
#endif
#ifdef  MSG_MCAST
                if ( msg.msg_flags & MSG_MCAST )
                {
                        Alarm( DATA_LINK, "\t(MULTICAST)");
                }
#endif
#ifdef  MSG_TRUNC
                if ( msg.msg_flags & MSG_TRUNC )
                {
                        Alarm( DATA_LINK, "\t(Data TRUNCATED)");
                }
#endif
#ifdef  MSG_CTRUNC
                if ( msg.msg_flags & MSG_CTRUNC )
                {
                        Alarm( DATA_LINK, "\t(Control TRUNCATED)");
                }
#endif
                Alarm( DATA_LINK, "\n");
        }
#endif
        /* Report the source address and port if requested by caller */
        if (sa_len >= sizeof(struct sockaddr_in) ) {
            memcpy(&sip, &source_address.sin_addr, sizeof(int32) );
            sip =  Flip_int32(sip);
            if (src_address != NULL)
                *src_address = sip;
            sport = Flip_int16(source_address.sin_port);
            if (src_port != NULL)
                *src_port = sport;
            Alarm( DATA_LINK, "\tfrom (" IPF ") with family %d port %d\n", IP(sip), source_address.sin_family, sport );
        }
	Alarm( DATA_LINK, "DL_recv: received %d bytes on channel %d\n",
			ret, chan );

	return(ret);
}