콘텐츠로 바로가기

now0930 일지

이런저런 생각

  • 홈
  • 비공개
  • 강좌
  • 잔여 작업 조회
  • 위치

[태그:] linux

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 계속 읽기

발행일 2020-07-08
카테고리 생활코딩 태그 c, linux, system program

inotify 예제

linux system programming, 283p 리눅스에 파일, 디렉토리를 감시하는 watch가 있다. 특정 경로를 설정하여 감시하여 적절한 이벤트를 작성할 수 있다. #include <sys/inotify.h> #include <stdlib.h> #include <errno.h> #include <stdio.h> #include <unistd.h> #define BUF_LEN 128 //int inotify_init1 (int flags); void main(){ int fd; //file descritor int wd; //watch descriptor const char path[50]=”/home/now0930/test/ttt”; fd = inotify_init1 (0); if (fd…… inotify 예제 계속 읽기

발행일 2020-07-03
카테고리 생활코딩 태그 c, linux, system program

mutex 예제

linux system programming, 238p. 두 시간 삽질했다. thread arg 를 포인터로 주는데 여러 개를 쓰려면 struct로 정의해서 써야 한댄다. 맞는지 틀린지.. #include <pthread.h> #include <stdio.h> #include <unistd.h> //arg를 여러 파라미터로 사용하기 위해, //구조체로 정의 //https://stackoverflow.com/questions/52812004/parameter-passing-multiple-values-using-void-pointer //여기 참조 //공유 자원. int sharedInt=0; //mutex 설정. static pthread_mutex_t the_mutex = PTHREAD_MUTEX_INITIALIZER; struct myStruct { //struct는 initilizer를 지원하지 않음.…… mutex 예제 계속 읽기

발행일 2020-06-29
카테고리 생활코딩 태그 c, linux, system program

thread 예제

linux system programming, 234p https://bitsoul.tistory.com/m/157 여기 참조. #include <pthread.h> #include <stdio.h> #include <unistd.h> void* start_routine(void* arg ){ int pid; int threadID; pid= getpid(); printf(“pid is %d\n”, pid); threadID = pthread_self(); printf(“tid is %lu\n”,threadID); printf(“data is %s\n”,arg); } int main(){ pthread_t thread[2]; const char *message1=”hello one”; const char *message2=”hello two”; const char *message3=”hello main”; int ret,…… thread 예제 계속 읽기

발행일 2020-06-28
카테고리 생활코딩 태그 c, linux, system program

daemon 예제

linux system programming, 174p 예제 실행. #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <linux/fs.h> int main (void) { pid_t pid, sid; int i; int j=0; /* create new process */ pid = fork (); printf(“Pid is %d \n”,pid); if (pid == -1) return -1; else if (pid != 0)…… daemon 예제 계속 읽기

발행일 2020-06-27
카테고리 생활코딩 태그 c, linux, system program

글 페이지 매김

다음 글 페이지 1 … 페이지 9 페이지 10 이전 글
2025 6월
일 월 화 수 목 금 토
1234567
891011121314
15161718192021
22232425262728
2930  
5월    

최신 글

  • 자기 회로 정리 2025-06-22
  • common mode, differential mode 2025-05-11
  • signal conditioner, 신호 처리기 2025-05-10
  • strain gage 2025-05-09
  • 칼만 필터 2025-05-01

카테고리

  • 산업계측제어기술사
  • 삶 자국
    • 책과 영화
    • 투자
  • 생활코딩
    • LEGO
    • ROS
    • tensorflow
  • 전기기사
  • 피아노 악보

메타

  • 로그인
  • 엔트리 피드
  • 댓글 피드
  • WordPress.org

페이지

  • 소개
  • 잔여 작업 조회
    • 작업 추가
    • 작업의 사진 조회
    • 작업 수정 페이지
  • 사진
    • GPS 입력된 사진
    • 사진 조회
  • 위치
    • 하기 휴가 방문지
    • 해외 출장

태그

android bash c docker driver FSM gps java kernel LEGO linux mysql network program opcua open62541 plc programmers python raspberry reinforcementLearning ros state space system program tensorflow transfer function 경제 미국 민수 삼국지 세계사 실기 에너지 역사 유전자 일본 임베디드 리눅스 전기기사 조선 중국 채윤 코딩 테스트 통계 한국사 한국어

팔로우하세요

  • Facebook
now0930 일지
WordPress로 제작.