pipe를 이해하기 전, 일단 gdb를 사용하는 방법을 알아야 했다. pipe가 서로 다른 프로세스를 연결하는 수단이라, gdb 기본 설정으로는 pipe로 어떤 내용을 확인하기 어려웠다. 아래 코드를 디버그 하기로 했다. #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <string.h> #define MAXLINE 100 void client(int, int), server(int, int); void server(int readfd, int writefd){ char buff[MAXLINE];…… pipe 예제. unix network programming 47p 계속 읽기
[카테고리:] 생활코딩
c 더블 포인터 이해하기.
c는 포인터가 혼란스러운데 이해했다고 믿고???? 나중에 다시 생각하려고 남긴다. 다음 코드를 만들었고 실패했다. bufToStruct를 실행할 때 포인터로 넘겼어도 buf를 받으면서 임시 공간에 변수를 만든다. 함수 실행을 끝내면서 그 공간도 날아가 도로묵 된다. #include <stdio.h> #include “module1.h” int main() { struct mysqlStruct oneSqlData; char readbuf[MAX_LEN]; int ret; openfile(readbuf); printf(“버퍼는 %s\n”,readbuf); do{ ret=bufToStruct(readbuf, &oneSqlData); printf(“%p\n”, readbuf); sleep(1);…… c 더블 포인터 이해하기. 계속 읽기
signal, page 342
signal 예제. shell에서 kill -l로 해당 PID에 시그널을 보낼 수 있다. #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <signal.h> /* handler for SIGINT */ static void signal_hanlder (int signo) { /* * Technically, you shouldn’t use printf() in a * signal handler, but it isn’t the end of the * world. I’ll discuss why in…… signal, page 342 계속 읽기
anonymous memory mapping, p308
https://www.miroch.ru/2017/01/17/linux-process-memory-layout/ proc pid maps 여기를 참조 했다. #include <stdio.h> #include <sys/mman.h> int main(int argc, char *argv[]) { char *ptr; int ret; ptr = (char *) mmap((void *) 0x10000, 512 * 1024, PROT_WRITE|PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); printf(“page size is %0x\n”,getpagesize()); printf(“ptr is %p\n”,ptr); sleep(10); /* all done with ‘p’, so give back the 512 KB mapping…… anonymous memory mapping, p308 계속 읽기
경제의 신과 함께 rss 다운로더 v2.
전에 경제의 신과 함께 rss 다운로더를 만들었다. https://now0930.pe.kr/wordpress/?p=3744 경제의 신과 함께 rss 다운로더. 여기에 이어서..이렇게 하면 plex가 idtag를 입력하는데, 파일 이름으로 입력한다. 불행히도 업로드 정보가 정확하지 않아 파일 이름만 보고는 도저히 언제 방송했는지 찾을 수 없다. 이 부분을 정리하기로 했다. ID3를 입력하면 plex가 앨범?을 정보를 업데이트하여 입력한다. pubDate를 입력하면 좋으나, 앨범이 너무 많이 분리된다. 하나…… 경제의 신과 함께 rss 다운로더 v2. 계속 읽기