Admin관리자   |    Posting포스트   |    LogOut로그아웃
:+:하늘을닮은호수:+: | Trac | 블로그   |    위치로그   |    태그로그   |    방명록


:+:하늘을 닮은 호수:+:
http://sunsson.iptime.org
Category
전체 (944)
[Standard] (58)
[OS] (116)
[Develope] (74)
[IT Trend] (347)
[Music] (93)
[삶의 질] (255)
Tag List
trac   3GPP   IPTV   svn   2MB   c99   PSS   RTP   VoIP   H.263   네 멋대로 해라   양동근   이나영   손예진   memory_leak   팔봉산   FLV   ffmpeg   cdn   grep   이명박   aio   beryl   awk   iLBC   강태우   gnuplot   avc   AutoConf   끝이아니길  
«   2008/08   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
posix proactor library test
Date : 2008/07/01 18:15

++++++++++++++++++++++++++
* Source File
++++++++++++++++++++++++++

posix proactor library를 테스트할 수 있는 코드.

#include <stdio.h>
#include <string.h>     //strerror()
#include <sys/types.h> //getpid()
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>

#include "../posix_proactor.h"
#include "test_posix_proactor.h"

//#include "mp4file_reader_file.h" //by sunsson for parsing hintmdat


#define BLKSIZE 11

void *hndlr_ftn(void* data)
{
    printf("media's handler function\n");
    return 0;
}
int main(void)
{
    int fd0, fd1, size;
    volatile char buf0[11];
    volatile char buf1[11];
   
    ///posix proactor initiate       
    if(posix_proactor_init(3) != 0)     //paramete : max_aio_operation!!
        fprintf(stderr,"[Error]posix proactor init\n");

    if((fd0 = open("0.txt", O_RDONLY)) == -1){
        fprintf(stderr, "[Error]Could not open %s: %s\n", "0.txt", strerror(errno));
        return(-1);
    }
    if((fd1 = open("1.txt", O_RDONLY)) == -1){
        fprintf(stderr, "[Error]Could not open %s: %s\n", "1.txt", strerror(errno));
        return(-1);
    }

    size = BLKSIZE - 1;
    if(si_read_req(fd0, size, 0, buf0, (void *)NULL, (void *)hndlr_ftn, 0,  READ) < 0)
        printf("issue_aio_calls error\n");

    if(si_read_req(fd1, size, 0, buf1, (void *)NULL, (void *)hndlr_ftn, 0,  READ) < 0)
        printf("issue_aio_calls error\n");
 
    while(1)
        ;
}

++++++++++++++++++++++++++
* Makefile
++++++++++++++++++++++++++

.SUFFIXES: .c .o

CC= gcc
CFLAGS= -Wall -c -g
AR= ar
export CC AR CFLAGS

LIB_INC= -L..
LIBS= -lsys_i
LFLAGS= -lrt

OBJS= test_posix_proactor.o
SRCS= $(OBJS : .o = .c)
INCLUDE= -I../

#SUBDIRS= general MP4F MP4W

TARGET= test_posix_proactor

all: $(TARGET)

$(TARGET): $(OBJS)
    $(CC) -o $(TARGET) $(OBJS) $(LIB_INC) $(LIBS) $(LFLAGS)

clean:
    $(RM) -rf *.o *.a

new:
    $(MAKE) clean
    $(MAKE)
   
subdirs :
    @for i in $(SUBDIRS) ; do ( cd $$i && $(MAKE) ) ; done

.c.o:
    $(CC) $(INCLUDE) $(CFLAGS) $<

ctags:
    ctags -R .

++++++++++++++++++++++++++
* Input Data
++++++++++++++++++++++++++


0.txt와 1.txt에서 차례대로 10개의 문자를 읽어들인다.

0.txt
0000000000

1.txt
1111111111

++++++++++++++++++++++++++
* Result Data
++++++++++++++++++++++++++

issue_aio_calls
aiocblist_free_index found : 1
aio_call excuted..
ret_val from execute_aio_calls : 0
issue_aio_calls
aiocblist_free_index found : 2
aio_call excuted..
ret_val from execute_aio_calls : 0


rtsig_handler
handle_event called
[Info] aiocb_index : 2
get_result_status
nbytes : 10
0000000000
application_specific_code
media's handler function
get_result_status
nbytes : 10
1111111111
application_specific_code
media's handler function
handle_event end

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2008/07/01 18:15 2008/07/01 18:15

블로그코리아에 블UP하기
Top
트랙백 주소 : 이 글에는 트랙백을 보낼 수 없습니다
[로그인][오픈아이디란?]
    
◀ 이전 페이지  |  1 |  ... 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |  ... 944 |  다음 페이지 ▶
Creative Commons License
블로그 내에 모든 저작물은 크리에이티브 커먼즈코리아 저작자표시 - 비영리 - 변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
website stats 믹시 블로그코리아에 블UP하기

Google

블로그 검색
최근 덧글
펼치기
최근 트랙백
펼치기
Today :
136
Yesterday :
198
Total :
62474
Powered by :
Textcube
ver :
1.6.3 : Tenuto
skin by :