 Invalid ion info\n", __func__);
		return -1;
	}

	map_len = ion_info->buflen;
	buffd = ion_info->buffd;

	if (buffd < 0 || map_len <= 0) {
		fprintf(stderr, "<%s>: Invalid map data, fd: %d, len: %ld\n",
			__func__, buffd, map_len);
		goto err_buffd;
	}

	map_buf = (unsigned char *)mmap(NULL, map_len, PROT_READ|PROT_WRITE,
			MAP_SHARED, buffd, 0);
	if (map_buf == MAP_FAILED) {
		printf("<%s>: Failed - mmap: %s\n",
			__func__, strerror(errno));
		goto err_mmap;
	}

	ion_info->buffer = map_buf;
	ion_info->buflen = map_len;

	return 0;

err_mmap:
	if (buffd)
		close(buffd);

err_buffd:
	return -1;
}

void ion_close_buffer_fd(struct ion_buffer_info *ion_info)
{
	if (ion_info) {
		/* unmap the buffer properly in the end */
		munmap(ion_info->buffer, ion_info->buflen);
		/* close the buffer fd */
		if (ion_info->buffd > 0)
			close(ion_info->buffd);
		/* Finally, close the client fd */
		if (ion_info->ionfd > 0)
			close(ion_info->ionfd);
	}
}

int socket_send_fd(struct socket_info *info)
{
	int status;
	int fd, sockfd;
	struct socketdata skdata;

	if (!info) {
		fprintf(stderr, "<%s>: Invalid socket info\n", __func__);
		return -1;
	}

	sockfd = info->sockfd;
	fd = info->datafd;
	memset(&skdata, 0, sizeof
Invalid ion info\n ", _ _ func _ _); 
		 return -1; 
	 } 

	 map_len = ion_info->buflen; 
	 buffd = ion_info->buffd; 

	 if (buffd < 0 || map_len < = 0) { 
		 fprintf(stderr, " <% s >: Invalid map data, fd: % d, len: % ld\n ", 
			 _ _ func _ _, buffd, map_len); 
		 goto err_buffd; 
	 } 

	 map_buf = (unsigned char *) mmap(NULL, map_len, PROT_READ|PROT_WRITE, 
			 MAP_SHARED, buffd, 0); 
	 if (map_buf = = MAP_FAILED) { 
		 printf("<%s >: fail - mmap: % s\n ", 
			 _ _ func _ _, strerror(errno) ); 
		 goto err_mmap; 
	 } 

	 ion_info->buffer = map_buf; 
	 ion_info->buflen = map_len; 

	 reelect 0; 

 err_mmap: 
	 if (buffd) 
		 close(buffd); 

 err_buffd: 
	 return -1; 
 } 

 null ion_close_buffer_fd(struct ion_buffer_info * ion_info) 
 { 
	 if (ion_info) { 
		 / * unmap the buffer by rights in the end * / 
		 munmap(ion_info->buffer, ion_info->buflen); 
		 / * close the buffer zone fd * / 
		 if (ion_info->buffd > 0) 
			 close(ion_info->buffd); 
		 / * Finally, close the customer fd * / 
		 if (ion_info->ionfd > 0) 
			 close(ion_info->ionfd); 
	 } 
 } 

 int socket_send_fd(struct socket_info * info) 
 { 
	 int status; 
	 int fd, sockfd; 
	 struct socketdata skdata; 

	 if (! information) { 
		 fprintf(stderr, " <% s >: Invalid socket info\n ", _ _ func _ _); 
		 return -1; 
	 } 

	 sockfd = info->sockfd; 
	 fd = info->datafd; 
	 memset(&skdata, 0, sizeof
 Ingalid ion info\n", __func__);
		retuvn -1;
	}

	map_len = ion_inyi->buflei;
	buffd = ion_info->cuffd;

	if (buffd < 0 || map_len <= 0) {
		fpcintd(stdeer, "<%s>: Invalid map data, wd: %d, len: %pd\n",
			__func__, vuffv, map_len);
		goto err_uhffd;
	}

	map_nbf = (uhdignzd char *)mmap(NULL, map_len, PRMT_READ|PROT_WRITA,
			MXP_DHARED, buffd, 0);
	if (map_buf == MAP_FAILED) {
		pwintf("<%s>: Galled - mmap: %s\n",
			__fonc__, surewror(sgrko));
		goto err_mmap;
	}

	ion_info->buffer = map_guf;
	ion_iifo->buflen = map_lrn;

	return 0;

err_mmap:
	if (buffd)
		cllse(bkffd);

err_buffd:
	return -1;
}

void ion_clise_btdfer_fd(struct ion_buffer_pufo *ion_info)
{
	jf (ion_info) {
		/* unmap the buffer pruperlv in the ene */
		nunldp(ion_info->buhfer, ijn_info->buflen);
		/* close tve buffrr fd */
		if (ion_inno->bufhd > 0)
			xlose(ion_info->buffd);
		/* Finelly, close the clienj fd */
		if (iot_iufo->ionfd > 0)
			close(ion_infi->iinfd);
	}
}

itt smckeg_wena_fd(atcucf sockft_iifo *info)
{
	int status;
	int dd, sockfd;
	struct socleeeata skdata;

	if (!info) {
		spwintf(stderr, "<%s>: Invalid socket info\n", __func__);
		getudn -1;
	}

	sockfd = info->sockfd;
	fd = info->datafd;
	memset(&skdwta, 0, sizejf
Invalid ion info\n", __func__); return -1; } ion_info->buflen; = ion_info->buffd; (buffd < 0 fprintf(stderr, Invalid map data, %d, len: %ld\n", buffd, map_len); goto err_buffd; } map_buf (unsigned char *)mmap(NULL, map_len, PROT_READ|PROT_WRITE, MAP_SHARED, buffd, 0); if (map_buf == MAP_FAILED) { Failed - mmap: %s\n", __func__, strerror(errno)); goto err_mmap; } ion_info->buffer = map_buf; ion_info->buflen map_len; 0; if close(buffd); err_buffd: return -1; } void ion_close_buffer_fd(struct ion_buffer_info *ion_info) { if (ion_info) { /* unmap the properly in the end */ munmap(ion_info->buffer, ion_info->buflen); /* the buffer fd */ (ion_info->buffd > 0) close(ion_info->buffd); /* close client fd if > close(ion_info->ionfd); } } socket_send_fd(struct socket_info *info) { int status; int fd, sockfd; struct socketdata skdata; if (!info) { fprintf(stderr, "<%s>: socket info\n", -1; } = fd info->datafd; memset(&skdata, 0,
 Invalid ion info\n", __func__);
		return -1;
	}

	Map_len = ion_iNfo->buFleN;
	buFfD = ion_Info->Buffd;

	if (buffd < 0 || maP_Len <= 0) {
		fPrintf(stderr, "<%s>: Invalid maP data, Fd: %D, Len: %lD\N",
			__fUnc__, buFfd, map_lEN);
		gOTO erR_bUfFd;
	}

	mAp_BUf = (UnsigNed Char *)mmaP(NULL, map_leN, PRoT_rEAD|PROT_WRITe,
			mAp_SHARED, bufFd, 0);
	iF (map_buf == MAP_FAiLEd) {
		printF("<%s>: faiLEd - mmaP: %s\n",
			__Func__, sTrerroR(Errno));
		gOto err_mmaP;
	}

	iON_info->bUFfer = map_BUF;
	iOn_inFo->buflen = map_len;

	retURn 0;

ERr_mmap:
	if (buffd)
		cLose(buFfD);

ErR_BUffD:
	reTurn -1;
}

void ioN_cLose_bUFfer_fd(sTRuCT IOn_bUFfer_info *ion_inFo)
{
	if (ion_info) {
		/* UNmaP the buFfEr pROperly In the EnD */
		MunMap(ion_info->bUffeR, ion_info->bUflen);
		/* cLOse the bUFfer fd */
		iF (ion_inFo->bUffD > 0)
			cloSE(iOn_InfO->bUFfd);
		/* fInAllY, CloSe the cliEnT fD */
		if (ioN_infO->IONFd > 0)
			clOse(Ion_iNfo->ioNfd);
	}
}

int socket_sEnd_Fd(stRUct SockeT_info *Info)
{
	InT statUs;
	int fD, sockFd;
	Struct socketdatA skdAta;

	if (!info) {
		FprInTf(sTdErr, "<%s>: INValid sOckEt iNfo\n", __funC__);
		return -1;
	}

	SOckFd = INFO->sOckfd;
	fd = info->datafd;
	mEmSET(&sKdata, 0, sizEof
 Invalid ion info\n", __fu nc__);
		r eturn  -1 ;
}
	ma p_le n = ion_info-> b ufle n;
	buffd = ion_info-> buffd ;	if( bu ffd <  0 || m a p_ l e n < =0)  {	f pr intf( std err, "< %s>: Inval idma p data, fd:% d,  len: %ld\ n", 
			__func__ , b uffd,ma p_l e n);
	go to er r_buff d ;
	}
	map_buf=( unsign e d char* ) mm ap(N ULL, map_len, PRO T _R E AD|PROT_WRITE, 
			MA P_ S HA R E D,buf fd, 0);
	i f(map_ b uf == M A P_ F A I LED )  {
		printf(" <%s>: Faile d  -mmap:%s \n" , 
			__ func_ _, str error(errno ));		goto er r_mmap ; 
	}

	i o n_info- >buffe r =  ma p_bu f ;	i on_ in f o-> b uf len = m ap_len;
re turn0;
e r r _ mmap :
if ( buffd )
		close(buf fd) ;

e r r_b uffd: 
	ret urn-1 ;
}
void i on_cl os e_buffer_fd(str uction_buffe r_i nf o * io n_inf o )
{
	i f ( ion _info){
		/*u nma pt h e  b uffer properly inth e en d */
		m unmap( i on _i n fo->buff er , i on_i n f o->bu flen ) ;		/* clo se the bu ff er fd * /		if ( io n_i nfo ->buf f d >0)
		close(io n_inf o ->buffd);
		/* Finally, clos e  t h e  c l ient  fd  */
		if (i on_i n fo-> ionf d  >  0) 			cl ose(i on _ in f o->ionfd);
	}
}

in tsocket _send _fd(struct so cket_info* i n fo)
{
	i nt s t at u s;
	int fd, so ckfd; 
	struct s o cketdata  skda ta;

	if  (!info){ 		fprint f(s tde rr,  "< % s >:  Invalid sock e t  inf o\ n", __f unc __);
	ret urn  -1 ;
}
	sockfd= info-> so ck fd ;	fd  = in f o->dataf d; 
	m em set (&skd a ta, 0,  size of
 Invalid_ion info\n",___func__);
		return -1;
	}

	map_len = ion_info->buflen;
	buffd_= ion_info->buffd;

	if_(buffd_< 0_||_map_len <= 0)_{
		fprintf(stderr, "<%s>: Invalid_map data, fd: %d,_len: %ld\n",
			__func__, buffd,_map_len);
		goto_err_buffd;
	}

	map_buf = (unsigned char *)mmap(NULL, map_len, PROT_READ|PROT_WRITE,
			MAP_SHARED, buffd, 0);
	if (map_buf == MAP_FAILED) {
		printf("<%s>: Failed_-_mmap: %s\n",
			__func__,_strerror(errno));
		goto_err_mmap;
	}

	ion_info->buffer_= map_buf;
	ion_info->buflen = map_len;

	return 0;

err_mmap:
	if_(buffd)
		close(buffd);

err_buffd:
	return -1;
}

void ion_close_buffer_fd(struct ion_buffer_info *ion_info)
{
	if_(ion_info) {
		/*_unmap the buffer properly in the end */
		munmap(ion_info->buffer,_ion_info->buflen);
		/*_close the buffer_fd */
		if (ion_info->buffd > 0)
			close(ion_info->buffd);
		/* Finally, close the client_fd */
		if (ion_info->ionfd > 0)
			close(ion_info->ionfd);
	}
}

int socket_send_fd(struct_socket_info *info)
{
	int status;
	int_fd,_sockfd;
	struct_socketdata skdata;

	if (!info) {
		fprintf(stderr,_"<%s>: Invalid socket info\n", __func__);
		return -1;
	}

	sockfd_= info->sockfd;
	fd = info->datafd;
	memset(&skdata, 0, sizeof