시스템 마다 다르지만, 내가 사용하는 시스템에서는 위와 같이 나왔다.
system-config- 는 이름대로 환경설정 혹은 root 권한을 필요로 하는 각종 시스템 설정에 대한 프로그램(GUI) 이고
아래의 항목들에 대한 프로그램들이 system-config- 로 시작하는 것들이다.
* Red Hat 엔터프라이즈 리눅스 4에 포함된 버전 glibc는 데이터 손상을 최대할 빨리 검색하여 방지할 수 있도록 내부 정상 감시 기능을 추가로 수행합니다. 데이터 손상이 감지되면 다음과 같은 메시지가 표준 오류로 나타날 것입니다 (만일 표준 오류(stderr)이 열려있지 않은 경우에는 syslog으로 기록됩니다):
*** glibc detected *** double free or corruption: 0x0937d008 ***
이 오류 메시지를 생성하는 프로그램은 디폴트로 제거(kill)됩니다; MALLOC_CHECK_ 환경 변수를 이용하여 오류 메시지 생성 여부를 선택하실 수 있습니다. 다음과 같은 설정이 가능합니다:
o 0 ? 오류 메시지를 생성하지 않고, 프로그램을 제거하지 않음 o 1 ? 오류 메시지를 생성하지만, 프로그램을 제거하지 않음 o 2 ? 오류 메시지를 생성하지는 않지만, 프로그램은 제거함 o 3 ? 오류 메시지를 생성하고 프로그램을 제거함
알림
만일 MALLOC_CHECK_ 변수를 0이 아닌 다른 값으로 설정할 경우,
glibc는 기본 설정 보다 광범위한 검사를 수행하므로결국 시스템 성능에 영향을 미칠 수 있습니다.
만일 제삼자 ISV의 프로그램로 인해 이러한 데이터 손상 검사가 수행되고 오류 메시지가 나타난다면,
심각한 문제일 수 있으니 어플리케이션의 제조업체에 보고하시기 바랍니다.
위의 소스는 넌블러킹 모드로 하나의 문자를 받는 예제이다.
테스트 방법은
PC 1. 하이퍼터미널로 연결
PC 2. minicom 으로 연결
PC 2. 터미널에서 특정 포트 출력 (echo test string > /dev/ttyS0)
PC 2. 터미널에서 위의 프로그램 실행
sdfasfsadfsadfasfasfasfasfsadf
CTRL-A Z for help |115200 8N1 | NOR | Minicom 2.3 | VT102 | Online 00:15
ret[8] buf[this is ]
ret[10] buf[test strin]
ret[2] buf[g st strin]
테스트 1.
두개의 PC를 시리얼로 연결해 놓은 상태(canonical mode?)에서 다른 터미널에서
echo test string > /dev/ttyS0
명령을 수행하여 출력 :: 시리얼을 연채로 똑같은 포트를 또 열어서 출력 가능 함
(둘다 canonical mode로 추측됨)
테스트 2.
non-canonical mode로 터미널에서 키를 입력 받는 위의 소스코드를 실행하여,
원격지에서 하이퍼터미널로 키 입력을 받는지 테스트 함.
두개만 있을때에는 이상없이 작동
테스트 3.
테스트 2 상황에서 minicom을 실행시킴
ret[-1] buf[▒]
이런식으로 에러가 발생하고 키를 입력 받을 수 없음.
테스트 4.
위의 상황에서 minicom 종료 함.
이상없이 메시지 받을 수 있음.
테스트 5.
반대로 minicom을 구동한 상황에서 소스코드를 실행시킴
메시지를 받을 수 없음 (minicom 쪽이 우선적으로 메시지 받을 수 있음)
테스트 6.
한 바이트씩 받지 않고 10바이트씩 받는 테스트,
하이퍼터미널에 10글자 정도의 문장을 복사하여 한번에 붙여 넣었는데 10글자를 한번에 받지 못하고
이상하게 받아 들이게 됨. non-blocking 에서는 되도록이면 한 문자씩 버퍼에 받아야 할 듯 함.
결론: canonical 입력은 non-canonical 보다 우선적으로 받을 수 있는 것으로 보임.
캐노니컬 / 넌캐노니컬과는 상관없이 블러킹 / 넌-블러킹 연관이고 블러킹이 넌-블러킹 보다 우선적으로 보내고/받을 수 있는 것으로 보임.
> - 파일에 저장(새로파일 생성) < - 파일에서 불러옴 | - 파이프라인, 결과를 이어줌
>> - 파일에 저장(기존파일에 이어서 붙임) 이정도이고, 잘 사용되지는 않지만 유용한 것으로는
2> - 에러만 파일에 저장
정도가 있다.
>는 stdout 만 리다이렉션해서 화면으로는 에러가 출력되고
2>는 stderr 만 리다이렉션해서 화면으로는 정상 메시지가 출력된다.
둘다 리다이렉션해서 파일로 저장하고 싶다면
2>&1
이렇게 하면 된다.
예를 들어 컴파일시 모든 메시지를 저장하고 싶다면
$ make install 1> err.log 2>&1
라고 하면 된다.
> word
The standard output (file descriptor 1) is sent to the file word which is created if it does not already exist.
>> word
The standard output is sent to file word. If the file exists then output is appended (by seeking to the end); otherwise the file is created.
< word
The standard input (file descriptor 0) is taken from the file word.
<< word
The standard input is taken from the lines of shell input that follow up to but not including a line consisting only of word. If word is quoted then no interpretation of the document occurs. If word is not quoted then parameter and command substitution occur and \ is used to quote the characters \ $ ` and the first character of word. In the latter case \newline is ignored (c.f. quoted strings).
>& digit
The file descriptor digit is duplicated using the system call dup (2) and the result is used as the standard output.
<& digit
The standard input is duplicated from file descriptor digit.
<&-
The standard input is closed.
>&-
The standard output is closed.
<&Digit Duplicates standard input from the file descriptor specified by the Digit parameter
>& Digit Duplicates standard output in the file descriptor specified by the Digit parameter
<&- Closes standard input
>&- Closes standard output
<&p Moves input from the co-process to standard input
>&p Moves output to the co-process to standard output
커널소스를 분석해 보진 않아서 정확하게 어떻게 여는지는 모르겠지만,
아마 tty 특성상 canonical mode로 여는것으로 보인다.
/dev/console is a symbolic link to /dev/tty0,
and the kernel regards /dev/tty0 as a synonym for the current VT.
XFree86 1.3 changes the owner of /dev/tty0, but does not reset this
after finishing. Thus, loadkeys or dumpkeys might fail because
someone else owns /dev/tty0;
in such a case you might run X first.
Note that you cannot change keyboard mappings when not at the console
-u Use the unified output format.
-r When comparing directories, recursively compareany subdirectories found.
-N
--new-file
In directory comparison, if a file is found in only one directory, treat it as present but empty in the
other directory.
일반적으로 GNU 프로젝트의 패치로 사용하는 옵션이라고 한다.
-u는 unified 포맷 출력
-r은 디렉토리 비교
-N은 새 파일이 있을시 없는쪽은 비어있는 파일로 간주하고 비교함
간단하게 전부 내용이 추가된걸로 표시된다. 이러한 옵션 없이 diff하면 아래와 같이 빈 파일이 출력된다.
Only in linux-2.6.17.14_stm22_0039_STFAE: .config2
DESCRIPTION
In the simplest case, diff compares the contents of the two files from-file and to-file. A file name of - stands
for text read from the standard input. As a special case, diff - - compares a copy of standard input to itself.
If from-file is a directory and to-file is not, diff compares the file in from-file whose file name is that of
to-file, and vice versa. The non-directory file must not be -.
If both from-file and to-file are directories, diff compares corresponding files in both directories, in alpha-
betical order; this comparison is not recursive unless the -r or --recursive option is given. diff never com-
pares the actual contents of a directory as if it were a file. The file that is fully specified may not be stan-
dard input, because standard input is nameless and the notion of ‘‘file with the same name’’ does not apply.
diff options begin with -, so normally from-file and to-file may not begin with -. However, -- as an argument by
itself treats the remaining arguments as file names even if they begin with -.
Options
Below is a summary of all of the options that GNU diff accepts. Most options have two equivalent names, one of
which is a single letter preceded by -, and the other of which is a long name preceded by --. Multiple single
letter options (unless they take an argument) can be combined into a single command line word: -ac is equivalent
to -a -c. Long named options can be abbreviated to any unique prefix of their name. Brackets ([ and ]) indicate
that an option takes an optional argument.
-lines Show lines (an integer) lines of context. This option does not specify an output format by itself; it has
no effect unless it is combined with -c or -u. This option is obsolete. For proper operation, patch typ-
ically needs at least two lines of context.
-a Treat all files as text and compare them line-by-line, even if they do not seem to be text.
-b Ignore changes in amount of white space.
-B Ignore changes that just insert or delete blank lines.
--brief
Report only whether the files differ, not the details of the differences.
-c Use the context output format.
-C lines
--context[=lines]
Use the context output format, showing lines (an integer) lines of context, or three if lines is not
given. For proper operation, patch typically needs at least two lines of context.
--changed-group-format=format
Use format to output a line group containing differing lines from both files in if-then-else format.
-d Change the algorithm to perhaps find a smaller set of changes. This makes diff slower (sometimes much
slower).
-D name
Make merged if-then-else format output, conditional on the preprocessor macro name.
-e
--ed Make output that is a valid ed script.
--exclude=pattern
When comparing directories, ignore files and subdirectories whose basenames match pattern.
--exclude-from=file
When comparing directories, ignore files and subdirectories whose basenames match any pattern contained in
file.
--expand-tabs
Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
-f Make output that looks vaguely like an ed script but has changes in the order they appear in the file.
-F regexp
In context and unified format, for each hunk of differences, show some of the last preceding line that
matches regexp.
--forward-ed
Make output that looks vaguely like an ed script but has changes in the order they appear in the file.
-h This option currently has no effect; it is present for Unix compatibility.
-H Use heuristics to speed handling of large files that have numerous scattered small changes.
--horizon-lines=lines
Do not discard the last lines lines of the common prefix and the first lines lines of the common suffix.
-i Ignore changes in case; consider upper- and lower-case letters equivalent.
-I regexp
Ignore changes that just insert or delete lines that match regexp.
--ifdef=name
Make merged if-then-else format output, conditional on the preprocessor macro name.
--ignore-all-space
Ignore white space when comparing lines.
--ignore-blank-lines
Ignore changes that just insert or delete blank lines.
--ignore-case
Ignore changes in case; consider upper- and lower-case to be the same.
--ignore-matching-lines=regexp
Ignore changes that just insert or delete lines that match regexp.
--ignore-space-change
Ignore changes in amount of white space.
--initial-tab
Output a tab rather than a space before the text of a line in normal or context format. This causes the
alignment of tabs in the line to look normal.
-l Pass the output through pr to paginate it.
-L label
--label=label
Use label instead of the file name in the context format and unified format headers.
--left-column
Print only the left column of two common lines in side by side format.
--line-format=format
Use format to output all input lines in in-then-else format.
--minimal
Change the algorithm to perhaps find a smaller set of changes. This makes diff slower (sometimes much
slower).
-n Output RCS-format diffs; like -f except that each command specifies the number of lines affected.
-N --new-file In directory comparison, if a file is found in only one directory, treat it as present but empty in the other directory.
--new-group-format=format
Use format to output a group of lines taken from just the second file in if-then-else format.
--new-line-format=format
Use format to output a line taken from just the second file in if-then-else format.
--old-group-format=format
Use format to output a group of lines taken from just the first file in if-then-else format.
--old-line-format=format
Use format to output a line taken from just the first file in if-then-else format.
-p Show which C function each change is in.
-P When comparing directories, if a file appears only in the second directory of the two, treat it as present
but empty in the other.
--paginate
Pass the output through pr to paginate it.
-q Report only whether the files differ, not the details of the differences.
-r When comparing directories, recursively compare any subdirectories found.
--rcs Output RCS-format diffs; like -f except that each command specifies the number of lines affected.
--recursive
When comparing directories, recursively compare any subdirectories found.
--report-identical-files
-s Report when two files are the same.
-S file
When comparing directories, start with the file file. This is used for resuming an aborted comparison.
--from-file=file
Compare file to all operands. file can be a directory.
--to-file=file
Compare all operands to file. file can be a directory.
--sdiff-merge-assist
Print extra information to help sdiff. sdiff uses this option when it runs diff. This option is not
intended for users to use directly.
--show-c-function
Show which C function each change is in.
--show-function-line=regexp
In context and unified format, for each hunk of differences, show some of the last preceding line that
matches regexp.
--side-by-side
Use the side by side output format.
--speed-large-files
Use heuristics to speed handling of large files that have numerous scattered small changes.
--starting-file=file
When comparing directories, start with the file file. This is used for resuming an aborted comparison.
--suppress-common-lines
Do not print common lines in side by side format.
-t Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
-T Output a tab rather than a space before the text of a line in normal or context format. This causes the
alignment of tabs in the line to look normal.
--text Treat all files as text and compare them line-by-line, even if they do not appear to be text.
-u Use the unified output format.
--unchanged-group-format=format
Use format to output a group of common lines taken from both files in if-then-else format.
--unchanged-line-format=format
--suppress-common-lines
Do not print common lines in side by side format.
-t Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
-T Output a tab rather than a space before the text of a line in normal or context format. This causes the
alignment of tabs in the line to look normal.
--text Treat all files as text and compare them line-by-line, even if they do not appear to be text.
-u Use the unified output format.
--unchanged-group-format=format
Use format to output a group of common lines taken from both files in if-then-else format.
--unchanged-line-format=format
Use format to output a line common to both files in if-then-else format.
--unidirectional-new-file
When comparing directories, if a file appears only in the second directory of the two, treat it as present
but empty in the other.
-U lines
--unified[=lines]
Use the unified output format, showing lines (an integer) lines of context, or three if lines is not
given. For proper operation, patch typically needs at least two lines of context.
-v
--version
Output the version number of diff.
-w Ignore white space when comparing lines.
-W columns
--width=columns
Use an output width of columns in side by side format.
-x pattern
When comparing directories, ignore files and subdirectories whose basenames match pattern.
-X file
When comparing directories, ignore files and subdirectories whose basenames match any pattern contained in
file.
-y Use the side by side output format.
SEE ALSO
cmp(1), comm(1), diff3(1), ed(1), patch(1), pr(1), sdiff(1).
DIAGNOSTICS
An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble.