Linux API/linux2020. 9. 28. 16:23

예제 보고 대충 따라서 만들어 봄

stdio.h를 했더니 fopen이랑 추천해주고 있어서 부랴부랴 찾아보니 unistd.h를 쓰라네?

cp.c:18:9: warning: implicit declaration of function ‘read’; did you mean ‘fread’? [-Wimplicit-function-declaration]
   len = read(fd_src, buff, BUFF_LEN);
         ^~~~
         fread
cp.c:20:4: warning: implicit declaration of function ‘write’; did you mean ‘fwrite’? [-Wimplicit-function-declaration]
    write(fd_dst, buff, len);
    ^~~~~
    fwrite
cp.c:25:2: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
  close(fd_src);
  ^~~~~
  pclose

 

예외처리 하나도 없이 인자만 받아서 복사하는 cp 명령의 마이너 버전 코드.

#include <unistd.h>
#include <fcntl.h>

#define BUFF_LEN 4096

int main(int argc, char** argv)
{
        int fd_src = 0;
        int fd_dst = 0;
        int len = 0;
        char buff[BUFF_LEN];

        fd_src = open(argv[1], O_RDONLY);
        fd_dst = open(argv[2], O_CREAT | O_TRUNC | O_RDWR);

        while(1)
        {
                len = read(fd_src, buff, BUFF_LEN);
                if(len > 0)
                        write(fd_dst, buff, len);
                else
                        break;
        }

        close(fd_src);
        close(fd_dst);

}

 

[링크 : https://reakwon.tistory.com/39]

[링크 : https://linux.die.net/man/3/open]

[링크 : https://linux.die.net/man/2/close]

 

 

fstat으로 파일 길이 알아내기

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

#include <sys/types.h>
#include <sys/stat.h>

#define BUFF_LEN 4096

int main(int argc, char** argv)
{
	int fd_src = 0;
	int fd_dst = 0;
	int len = 0;
	char buff[BUFF_LEN];
	struct stat statbuf;

	fd_src = open(argv[1], O_RDONLY);
	fd_dst = open(argv[2], O_CREAT | O_TRUNC | O_RDWR);

	fstat(fd_src, &statbuf);
	printf("filename : [%s], length [%ld]\n", argv[1], statbuf.st_size);

	while(1)
	{
		len = read(fd_src, buff, BUFF_LEN);
		if(len > 0)
			write(fd_dst, buff, len);
		else
			break;
	}

	close(fd_src);
	close(fd_dst);

}

 

[링크 : https://man7.org/linux/man-pages/man2/stat.2.html]

'Linux API > linux' 카테고리의 다른 글

linux open() 과 8진법  (0) 2020.09.28
open with O_CREAT or O_TMPFILE in second argument needs 3 arguments  (0) 2020.09.28
fopen64  (0) 2019.06.24
ubuntu iio rotate key 찾기 또 실패  (0) 2019.05.27
전원버튼 IRQ 발생 관련  (0) 2018.04.23
Posted by 구차니
Programming/c# & winform2020. 9. 28. 11:13

오.. 신기신기..

어떻게 빌드하지?하다가

아무생각 없이 그냥 해당 프로젝트 디렉토리 들어가니 mono develop 아이콘이 똭!

더블 클릭해서 실행하니 mono develop  가 뜨고 빌드 옵션을 Debug에서 Release로 바꾸고

빌드하니

 

띠용.. PE32 executable 이 뜬다.

~/ar/bin/Release$ file *
ar.exe:        PE32 executable (GUI) Intel 80386 Mono/.Net assembly, for MS Windows
ar.exe.config: XML 1.0 document, UTF-8 Unicode (with BOM) text, with CRLF line terminators
ar.pdb:        Microsoft Rosyln C# debugging symbols version 1.0

 

물론 윈도우에서 프로젝트 파일 자체를 그대로 전송해 왔기 때문에

Deub로 가면 아래와 같이 나오는데 pdb는 메시지가 조금 다른데 exe는 리눅스 상에서 인식하는 포맷이 동일하게 나온다.

~/ar/bin/Debug$ file *
ar.exe:        PE32 executable (GUI) Intel 80386 Mono/.Net assembly, for MS Windows
ar.exe.config: XML 1.0 document, UTF-8 Unicode (with BOM) text, with CRLF line terminators
ar.pdb:        MSVC program database ver 7.00, 512*115 bytes

 

그나저나 4.7의 모든 것 이라고 해놓고

WPF, WWF 그리고 제한된 WCF 그리고 제한된 ASP.NET 비동기 stack을 제외한... (야이!!!)

Everything in .NET 4.7 except WPF, WWF, and with limited WCF and limited ASP.NET async stack.

[링크 : https://www.mono-project.com/docs/about-mono/compatibility/]

 

WWF는 처음 듣네? 검색해보니 레슬링이 왜 나오냐 ㅠㅠ

Windows Workflow Foundation

[링크 : https://docs.microsoft.com/ko-kr/dotnet/framework/windows-workflow-foundation/]

 

그냥 무난하게 winform으로 작성한건 그럼 리눅스에서 빌드하고 실행이 가능한데

GUI자체는 노가다 하거나 visual studio community에서 하는수 밖에 없나?

'Programming > c# & winform' 카테고리의 다른 글

winform socket  (0) 2020.09.29
c# conditional attribute  (0) 2020.09.29
c# 오버라이드, 하이드, 쉐도우  (0) 2020.09.23
c# 상속  (0) 2020.09.23
c#은 main()이 아니다 Main()이다 -_-  (0) 2020.09.23
Posted by 구차니

장보고 차 가져다 드리러 가니 차례 패스~ 하는걸로

그런데 무슨 기사가 떳나 아부지가 갑자기 그렇게 결정하실리가!??!?

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

추석 그리고 RTL-SDR  (0) 2020.10.01
추석 전날  (0) 2020.09.30
키즈카페 망한줄 알았는데  (0) 2020.09.26
버블건 수리  (0) 2020.09.13
피곤하다..  (0) 2020.08.30
Posted by 구차니

이번달 말까지로 바리스타 뽑는 공지가 워크넷에 있는거 보면...

망한줄 알았던 키즈카페가 아직 살아있는건가?

아니면 죽었다 재개장 했거나, 주인이 바뀐걸까?

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

추석 전날  (0) 2020.09.30
추석 차례 안지내기로 결정  (2) 2020.09.27
버블건 수리  (0) 2020.09.13
피곤하다..  (0) 2020.08.30
동네에 앰블런스가 옴  (0) 2020.08.29
Posted by 구차니

numatool 이라는걸 알아가게 되네..

NUMA는 복수개의 CPU를 사용할 때 버스를 통해서 메모리를 공유하고

SMP는 개별 CPU에 메모리를 달아 다른 CPU를 통해 메모리를 접근하는 방식으로 보임

(그러고 보니 펜3 시절에 SMP 라고 들은거 같은데 그때랑 지금의 2cpu 는 방식이 다른가?)

 

[링크 : https://12bme.tistory.com/537]

[링크 : https://rockball.tistory.com/entry/Numa의-이해]

[링크 : https://zetastring.tistory.com/85]

'이론 관련 > 컴퓨터 관련' 카테고리의 다른 글

온프레미스  (0) 2020.10.27
NMEA 포맷  (0) 2020.10.26
파일 스토리지, 블록 스토리지, 오브젝트 스토리지  (0) 2020.09.18
lustre file system  (0) 2020.09.18
smmu?  (0) 2020.09.08
Posted by 구차니

DTMF 에서 제정한 RESTfulAPI 표준으로 ipmi 정보를 받아오는 녀석들.

 

[링크 : https://github.com/DMTF/Redfishtool]

[링크 : https://pythonhosted.org/python-redfish/installation.html]

[링크 : http://redfish.dmtf.org/schemas/DSP0266_1.5.0.html]

 

+

[링크 : https://techhub.hpe.com/eginfolib/servers/docs/HPRestfultool/iLo4/data_model_reference.html]

[링크 : https://hewlettpackard.github.io/ilo-rest-api-docs/ilo4/]

'하드웨어 > Server Case & board' 카테고리의 다른 글

DCMI / IPMI, ipmiutil  (0) 2020.11.08
quanta F03 EP 서버 메뉴얼  (0) 2020.11.08
벤더별 ipmi 명칭  (0) 2020.09.24
nmap을 이용하여 ILO 포트 검색하기  (0) 2020.09.18
BMC(Board Management Controller) 제조업체  (0) 2020.09.18
Posted by 구차니
Linux/Ubuntu2020. 9. 24. 19:59

생각 난김에 설치해보는데 ipmi가 없는 일반 노트북에서는 에러가 나는건가..

 

$ sudo apt-get install ipmitool
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
  freeipmi-common libfreeipmi16 libopenipmi0 openipmi
제안하는 패키지:
  freeipmi-tools
다음 새 패키지를 설치할 것입니다:
  freeipmi-common ipmitool libfreeipmi16 libopenipmi0 openipmi
0개 업그레이드, 5개 새로 설치, 0개 제거 및 4개 업그레이드 안 함.
1,985 k바이트 아카이브를 받아야 합니다.
이 작업 후 9,407 k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] 
받기:1 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 freeipmi-common amd64 1.4.11-1.1ubuntu4.1 [174 kB]
받기:2 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libfreeipmi16 amd64 1.4.11-1.1ubuntu4.1 [826 kB]
받기:3 http://kr.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 ipmitool amd64 1.8.18-5ubuntu0.1 [403 kB]
받기:4 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libopenipmi0 amd64 2.0.22-1.1ubuntu2.1 [450 kB]
받기:5 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 openipmi amd64 2.0.22-1.1ubuntu2.1 [132 kB]
내려받기 1,985 k바이트, 소요시간 2초 (862 k바이트/초)
Selecting previously unselected package freeipmi-common.
(데이터베이스 읽는중 ...현재 242443개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../freeipmi-common_1.4.11-1.1ubuntu4.1_amd64.deb ...
Unpacking freeipmi-common (1.4.11-1.1ubuntu4.1) ...
Selecting previously unselected package libfreeipmi16.
Preparing to unpack .../libfreeipmi16_1.4.11-1.1ubuntu4.1_amd64.deb ...
Unpacking libfreeipmi16 (1.4.11-1.1ubuntu4.1) ...
Selecting previously unselected package ipmitool.
Preparing to unpack .../ipmitool_1.8.18-5ubuntu0.1_amd64.deb ...
Unpacking ipmitool (1.8.18-5ubuntu0.1) ...
Selecting previously unselected package libopenipmi0.
Preparing to unpack .../libopenipmi0_2.0.22-1.1ubuntu2.1_amd64.deb ...
Unpacking libopenipmi0 (2.0.22-1.1ubuntu2.1) ...
Selecting previously unselected package openipmi.
Preparing to unpack .../openipmi_2.0.22-1.1ubuntu2.1_amd64.deb ...
Unpacking openipmi (2.0.22-1.1ubuntu2.1) ...
freeipmi-common (1.4.11-1.1ubuntu4.1) 설정하는 중입니다 ...
libfreeipmi16 (1.4.11-1.1ubuntu4.1) 설정하는 중입니다 ...
libopenipmi0 (2.0.22-1.1ubuntu2.1) 설정하는 중입니다 ...
openipmi (2.0.22-1.1ubuntu2.1) 설정하는 중입니다 ...
ipmitool (1.8.18-5ubuntu0.1) 설정하는 중입니다 ...
Job for ipmievd.service failed because the control process exited with error code.
See "systemctl status ipmievd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript ipmievd, action "start" failed.
● ipmievd.service - IPMI event daemon
   Loaded: loaded (/lib/systemd/system/ipmievd.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-09-25 09:58:54 KST; 9ms ago
  Process: 6933 ExecStart=/usr/sbin/ipmievd $IPMIEVD_OPTIONS (code=exited, status=1/FAILURE)

 9월 25 09:58:54 minigram systemd[1]: Starting IPMI event daemon...
 9월 25 09:58:54 minigram ipmievd[6933]: Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
 9월 25 09:58:54 minigram systemd[1]: ipmievd.service: Control process exited, code=exited status=1
 9월 25 09:58:54 minigram systemd[1]: ipmievd.service: Failed with result 'exit-code'.
 9월 25 09:58:54 minigram systemd[1]: Failed to start IPMI event daemon.
Unable to start ipmievd during installation.  Trying to disable.
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...
Processing triggers for systemd (237-3ubuntu10.42) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
ureadahead will be reprofiled on next reboot
Processing triggers for install-info (6.5.0.dfsg.1-2) ...

[링크 : http://hpcadmin.tistory.com/61]

 

+

/dev/impi가 필요 하다고.

[링크 : https://lascrea.tistory.com/57]

 

해도 안올라오는데요 ㅠㅠ

[링크 : https://serverfault.com/questions/480371/ipmitool-cant-find-dev-ipmi0-or-dev-ipmidev-0]

 

Posted by 구차니

순서는 벤더 ABC 순

 

CISCO - CIMC (Cisco Integrated Management Controller)
DELL - iDRAC (Integrated Dell Remote Access)

Fujitsu - iRMC (Integrated Remote Management Controller )
HP - ILO (Integrated Lights-Out)

IBM - IMM (Integrated Management Module)
Intel - RMM (Remote Management Module)

SUN - ILOM (Integrated Lights Out Manager)

Supermicro - iKVM

 

[링크 : http://www.2cpu.co.kr/QnA/396609]

[링크 : http://studyforus.com/tipnknowhow/479025]

 

[링크 : http://www.intel.co.kr/content/www/kr/ko/support/articles/000006174/server-products/server-boards.html]

[링크 : https://www.cisco.com/.../ucs-c-series-integrated-management-controller/index.html]

[링크 : https://www.fujitsu.com/downloads/PRMRGY/b7fh-4981-01en.pdf]

'하드웨어 > Server Case & board' 카테고리의 다른 글

quanta F03 EP 서버 메뉴얼  (0) 2020.11.08
redfish  (0) 2020.09.25
nmap을 이용하여 ILO 포트 검색하기  (0) 2020.09.18
BMC(Board Management Controller) 제조업체  (0) 2020.09.18
jnlp on ubuntu/chrome  (0) 2020.09.17
Posted by 구차니
프로그램 사용/minicom2020. 9. 24. 11:36

dialout 그룹에 포함시키면 된다고 한다.

귀찮아서 /etc/group 을 수정하긴 했는데

명령어로도 가능은 한 듯?

 

그런데 왜 그룹 변경하면 리부팅이 필요할까?

 

[링크 : https://unix.stackexchange.com/questions/14354/read-write-to-a-serial-port-without-root]

[링크 : https://igotit.tistory.com/entry/우분투에서-USB-2-UART-칩-CP2101-권한설정하기-ttyUSB-시리얼포트]

 

+

newgrp 하면 리부팅 안해도 된다네?

그리고 로그아웃 했다 로그인 할 때 적용이 된다고 하니

우분투 데스크탑 유저라면 리부팅이 편할수도 있긴 하겠다..

[링크 : https://serverfault.com/.../is-a-reboot-required-to-refresh-permissions-after-adding-a-user-to-a-new-group]

 

+

$ stat /dev/ttyUSB0
  File: /dev/ttyUSB0
  Size: 0          Blocks: 0          IO Block: 4096   문자 특수 파일
Device: 6h/6d Inode: 658         Links: 1     Device type: bc,0
Access: (0660/crw-rw----)  Uid: (    0/    root)   Gid: (   20/ dialout)
Access: 2023-03-08 10:04:36.356257260 +0900
Modify: 2023-03-08 10:04:36.356257260 +0900
Change: 2023-03-07 17:22:47.356257260 +0900
 Birth: -

$ sudo usermod -a -G dialout $USER

[링크 : https://askubuntu.com/questions/133235/how-do-i-allow-non-root-access-to-ttyusb0]

'프로그램 사용 > minicom' 카테고리의 다른 글

minicom lf에 cr 붙이기  (0) 2023.01.05
minicom 16진수로 보기  (0) 2022.08.25
minicom 로그 저장하기  (0) 2021.09.16
minicom timestamp  (0) 2021.09.16
minicom 폭 늘리기  (0) 2021.01.28
Posted by 구차니
Linux/Ubuntu2020. 9. 23. 16:53

두개 노트북에 자료가 있어서 하나를 매번 지우고 복사하려니 귀찮기도 하고..

양쪽으로 변경되는게 있을 경우 어떻게 해야 하나 고민하다가 생각나서 찾아보는데..

이걸 내가 글쓴적이 한번도 없을리가 없는데 안나오네...

 

아무튼 mtime(modified time)을 기준으로 복사한다고 한데..

       Rsync finds files that need to be transferred  using  a  "quick  check"
       algorithm  (by  default) that looks for files that have changed in size
       or  in  last-modified  time.   Any  changes  in  the  other   preserved
       attributes  (as  requested by options) are made on the destination file
       directly when the quick check indicates that the file’s data  does  not
       need to be updated.

[링크 : https://linux.die.net/man/1/rsync]

 

영 찜찜하면 --checksum 옵션으로 다를 경우 하는게 안전할지도 모르겠다.

 

src, dest 순서로 지정하고 복사하면 되는데 일단 백업해놓고 해봐야겠다..

Access via remote shell:
  Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
  Push: rsync [OPTION...] SRC... [USER@]HOST:DEST

 


기본적으로 rsync는 파일의 크기와 수정 시간(modification)을 비교하는 것으로 파일을 전송할지 말지를 결정한다. 이 방법은 아주 작은 CPU 자원을 소모하지만 실수가 발생할 수 있다. 일반적으로 파일의 내용을 변경하면 크기와 수정시간이 변하지만 항상 그렇다고 단정할 수는 없기 때문이다.
--checksum 옵션을 이용하면 비교 방법을 개선할 수 있다. 이 옵션을 켜면, 파일의 checksum을 비교한다. 크기/시간을 이용한 비교 방법보다 안전하지만 더 느리고 더 많은 자원을 사용한다.

[링크 : https://www.joinc.co.kr/w/Site/Tip/Rsync]

 

rsync 는 파일이 목적지에 존재할 경우 생성 시간과 크기를 비교해서 동일할 경우 건너뜀.

[링크 : https://www.lesstif.com/system-admin/rsync-data-backup-12943658.html]

Posted by 구차니