제목이랑은 조금 심하게 다르지만..

busybox-1.10.1/networking/ping.c 의 소스를 보면
enum {
    DEFDATALEN = 56,
    MAXIPLEN = 60,
    MAXICMPLEN = 76,
    MAXPACKET = 65468,
    MAX_DUP_CHK = (8 * 128),
    MAXWAIT = 10,
    PINGINTERVAL = 1, /* 1 second */
};

라는 부분에 timeout 10초와 핑간격 1초가 정의되어 있다.
어짜피 alarm() 함수가 integer 만 받아서 소수점은 무리이므로
ping -c 를 이용하여 빠르게 핑 테스트는 힘들듯 하다.

다른 방법으로 접근을 하자면,
ping -c 1 ... ; ping -c 1 ...
이런식의 명령행으로 할 경우 1초 간격없이 빠르게 핑을 연속으로 보낼 수 있다.
Posted by 구차니
프로그램 사용2009. 8. 3. 19:18
머.. libjpeg가 그랬듯이 libpng도 별 건 없다.

$ more INSTALL
Installing libpng version 1.2.38 - July 16, 2009

On Unix/Linux and similar systems, you can simply type
    ./configure [--prefix=/path]
    make check
    make install
and ignore the rest of this document.

$ ./configure --host=sh4-linux
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for sh4-linux-strip... sh4-linux-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for sh4-linux-gcc... sh4-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether sh4-linux-gcc accepts -g... yes
checking for sh4-linux-gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of sh4-linux-gcc... gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... sh4-unknown-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by sh4-linux-gcc... /opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld
checking if the linker (/opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld) is GNU ld... yes
checking how to run the C preprocessor... sh4-linux-gcc -E
checking for sh4-linux-sed... /bin/sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for BSD- or MS-compatible name lister (nm)... /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-nm -B
checking the name lister (/opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-nm -B) interface... BSD nm
checking the maximum length of command line arguments... 98304
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld option to reload object files... -r
checking for sh4-linux-objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for sh4-linux-ar... sh4-linux-ar
checking for sh4-linux-strip... (cached) sh4-linux-strip
checking for sh4-linux-ranlib... sh4-linux-ranlib
checking command to parse /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-nm -B output from sh4-linux-gcc object... ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if sh4-linux-gcc supports -fno-rtti -fno-exceptions... no
checking for sh4-linux-gcc option to produce PIC... -fPIC -DPIC
checking if sh4-linux-gcc PIC flag -fPIC -DPIC works... yes
checking if sh4-linux-gcc static flag -static works... yes
checking if sh4-linux-gcc supports -c -o file.o... yes
checking if sh4-linux-gcc supports -c -o file.o... (cached) yes
checking whether the sh4-linux-gcc linker (/opt/STM/STLinux-2.2/devkit/sh4/sh4-linux/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ANSI C header files... (cached) yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for working strtod... no
checking for pow... no
checking for pow in -lm... yes
checking for memset... yes
checking for pow... (cached) no
checking for pow in -lm... (cached) yes
checking for zlibVersion in -lz... yes
checking if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE... yes
checking if libraries can be versioned... yes
checking for symbol prefix...
configure: pkgconfig directory is ${libdir}/pkgconfig
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpng.pc
config.status: creating libpng-config
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

물론 크로스 컴파일이므로
make check는 "cannot execute binary file" 메시지를 출력하면서 중단된다.
Posted by 구차니
sed '/s/replace old/replace new/'
스트림이니까, 파이프로 연결해도 당연히(?!) 된다.

[링크 : http://www.grymoire.com/Unix/Sed.html]
Posted by 구차니
awk의 가장 유용한 사용방법은
awk '{print $1}' 가 아닐까 생각이 된다.
일단 1번부터 시작하여 n 번째의 문자열을 출력해주며
문자열은 공백으로 구분한다.

예를 들어
/proc/cmdline의 경우
$ cat /proc/cmdline
ro root=/dev/VolGroup00/LogVol00 rhgb quiet

인데 awk를 사용할 경우
$ cat /proc/cmdline | awk '{print $1}'
ro
$ cat /proc/cmdline | awk '{print $2}'
root=/dev/VolGroup00/LogVol00
$ cat /proc/cmdline | awk '{print $3}'
rhgb
$ cat /proc/cmdline | awk '{print $4}'
quiet
$ cat /proc/cmdline | awk '{print $5}'

이런식으로 구분을 하여 옵션별로 떼어낼 수 있다.


$ cat /proc/cmdline | awk '{print NF}'
4
NF는 내부 변수로 컬럼의 갯수를 알려준다.


[링크 : http://www.grymoire.com/Unix/]
Posted by 구차니
프로그램 사용/busybox2009. 7. 30. 17:24

#!/bin/sh

/bin/run-parts --arg=$1 /etc/udhcpc.d

[링크 : http://www.doit.org/udhcpc/udhcpc.script]

#!/bin/sh
# /etc/init.d/udhcpc: start or stop udhcpc client

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/sbin/udhcpc

test -x $DAEMON || exit 0

case "$1" in
  start)
    echo -n "Starting DHCP client: udhcpc"
    start-stop-daemon --start --quiet --exec $DAEMON \
      -- --script=/etc/udhcpc.script || echo -n " already running"
    echo "."
  ;;

  restart)
    /etc/init.d/udhcpc stop
    /etc/init.d/udhcpc start
  ;;

  reload)
  ;;

  force-reload)
  ;;

  stop)
    echo -n "Stopping DHCP client: udhcpc"
    start-stop-daemon --stop --quiet --exec $DAEMON || echo -n " not running"
    echo "."
  ;;

  renew)
    start-stop-daemon --signal USR1 --stop --quiet --exec $DAEMON || echo -n " not running"
  ;;

  release)
    start-stop-daemon --signal USR2 --stop --quiet --exec $DAEMON || echo -n " not running"
  ;;

  *)
    echo "Usage: /etc/init.d/udhcpc {start|stop|restart|reload|force-reload}"
    exit 1
    ;;
esac

exit 0

[링크 : http://www.doit.org/udhcpc/udhcpc]

[링크 : http://www.doit.org/udhcpc/]
Posted by 구차니
프로그램 사용/busybox2009. 7. 30. 13:16
menu 'Build Options'

config CONFIG_STATIC
    bool "Build BusyBox as a static binary (no shared libs)"
    default n
    help
      If you want to build a static BusyBox binary, which does not
      use or require any shared libraries, then enable this option.
      This can cause BusyBox to be considerably larger, so you should
      leave this option false unless you have a good reason (i.e.
      your target platform does not support shared libraries, or
      you are building an initrd which doesn't need anything but
      BusyBox, etc).

      Most people will leave this set to 'N'.

[링크 : http://stablebox.googlecode.com/svn/trunk/Config.in]

비지박스를 컴파일 하면, 용량이 생각보다 크다.
이 경우에는 위의 옵션을 꺼주면 컴팩트해진다.

1.10.4 기준으로 1.6M에서 600K 정도로 용량이 줄어드는데,
확신할 수는 없지만, 이 옵션을 사용했기 때문에 DNS resolv를 하지 못하는 것 같다.
busybox에서 ping이나 telnet 이 resolv 실패가 뜨면

libresolv.so
libdns.so

를 복사 해주면 되는데, 이 옵션의 영향이 아닐까 생각이된다.
Posted by 구차니
프로그램 사용/busybox2009. 7. 29. 15:13
$ ls /bin/udhcpc*
lrwxrwxrwx 1 root     root 7 Jul 29 14:49 udhcpc -> busybox
lrwxrwxrwx 1 root     root 7 Jul 29 14:49 udhcpd -> busybox

요즘 busybox는 udhcp 라는 dhcp 서버/클라이언트가 내장되어있다.
물론 기본값으로 busybox에 포함되긴 하지만, 확인 후 사용해야 한다.

아무튼, 옵션은 설정되어 있었음에도 불구하고
심볼릭 링크와, 스크립트가 생성되어 있지 않았다.


/sbin/udhcpc - udhcp Client
/sbin/udhcpd - udhcp Daemon
/usr/share/udhcpc/default.script - 기본 dhcp 스크립트




Posted by 구차니
sftp는 ssh를 이용한 ftp이다.
별다르게 설정하지 않았다면, 기본값으로 ssh를 통해 sftp로 전송이 가능하다.

SYNOPSIS
     sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]
          [-o ssh_option] [-P sftp_server_path] [-R num_requests] [-S program]
          [-s subsystem | sftp_server] host
     sftp [[user@]host[:file [file]]]
     sftp [[user@]host[:dir[/]]]
     sftp -b batchfile [user@]host

사용방법은 위와 같은데 간단하게 예를 들자면,

# sftp root@192.168.10.10:/home.tar home.tar
Connecting to 192.168.10.10...
root@192.168.10.10's password:
Fetching /home.tar to home.tar
/home.tar                                       8% 1811MB   6.3MB/s   49:58 ETA

처럼 사용하면 된다. 머랄까.. 저 형식은 cvs나 svn 포맷같기도 하고..
Posted by 구차니
프로그램 사용/busybox2009. 7. 23. 14:45
busy 박스의 문제라기 보다는 라이브러리의 문제인 듯 하다.

ld-linux.so.2
libc.so.6
libdl.so.2
libnss_dns.so.2
libnss_files.so.2
libpthread.so.0
libresolv.so.2

이번 경우에는 libresolv.so 가 없어서 dns resolv가 되지 않았었다.

[링크 : http://kelp.or.kr/korweblog/stories.php?story=05/04/03/4168817]
Posted by 구차니
프로그램 사용/VNC2009. 7. 22. 14:42
서버설정은 크게 6단계로 나뉜다.

1. rpm이나 소스로 vnc를 설치한다.(자세한 내용은 생략)
2. /etc/sysconfig/vncserver의 내용을 수정한다.
# The VNCSERVERS variable is a list of display:user pairs.
 #
 # Uncomment the lines below to start a VNC server on display :2
 # as my 'myusername' (adjust this to your own).  You will also
 # need to set a VNC password; run 'man vncpasswd' to see how
 # to do that.
 #
 # DO NOT RUN THIS SERVICE if your local area network is
 # untrusted!  For a secure way of using VNC, see
 # <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.
 
 # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
 
 # Use "-nohttpd" to prevent web-based VNC clients connecting.
 
 # Use "-localhost" to prevent remote VNC clients connecting except when
 # doing so through a secure tunnel.  See the "-via" option in the
 # `man vncviewer' manual page.
 
 # VNCSERVERS="2:myusername"
 # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"

FC6에서는 localhost:0.0 은 gdm에서 사용하고 있으므로, 1번 이후로 설정을 해준다.
예를들어 testuser 라는 아이디로 1번 디스플레이 1024x768 해상도로 접속을 하도록 하려면 아래와 같이 추가를 해준다.
VNCSERVERS="1:testuser"
VNCSERVERARGS[1]="-geometry 1024x768 -nohttpd"

3. vncpasswd로 사용자 비밀번호를 설정한다. 물론 확인을 위해 두번 입력 해야 한다.
   이 부분을 하지 않고 vncserver를 구동시키면, 아무런 에러 없이 FAILED 만 출력된다.
$ vncpasswd
Password:
Verify:

4. 기본으로 설정되는 윈도우 매니저는 twm으로, gdm에 익숙해진 일반유저로서는 교체해주는 것이 좋다.
   위의 설정에 해준 아이디의 홈디렉토리에서 .vnc/ 디렉토리에 xstartup이라는 스크립트를 교체 해준다.
   xstatup 파일은 /etc/X11/xinit/xinitrc을 xstartup으로 이름 바꾸어 복사해주면 된다.


# more xstartup
#!/bin/sh
# Copyright (C) 1999 - 2005 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
#       Mike A. Harris <mharris@redhat.com>

# Mandatorily source xinitrc-common, which is common code shared between the
# Xsession and xinitrc scripts which has been factored out to avoid duplication
. /etc/X11/xinit/xinitrc-common

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.
if [ -f $HOME/.Xclients ]; then
    exec $SSH_AGENT $DBUS_LAUNCH $HOME/.Xclients || \
    exec $SSH_AGENT $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
    exec $SSH_AGENT $DBUS_LAUNCH /etc/X11/xinit/Xclients || \
    exec $SSH_AGENT /etc/X11/xinit/Xclients
else
    # Failsafe settings.  Although we should never get here
    # (we provide fallbacks in Xclients as well) it can't hurt.
    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
    [ -x /usr/bin/xclock ] && /usr/bin/xclock -geometry 100x100-5+5 &
    [ -x /usr/bin/xterm ] && xterm -geometry 80x50-50+150 &
    [ -x /usr/bin/twm ] && /usr/bin/twm
fi

5. 방화벽을 해제하거나, 포트를 풀어준다.(자세한 내용은 생략)
    포트는 5900번이 기본으로 디스플레이 포트를 더해준다.
    예를들어 3번 display 번호를 사용하면 5900 + 3 = 5903 번의 포트를 열어주어야 한다.

6. vnc 서버를 구동한다.(자세한 내용은 생략)
    service vncserver start
    service vncserver restart

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

tsclient에 VNC 추가하기  (0) 2011.12.31
UVNC - Ultra VNC  (2) 2010.11.26
우분투 9.10 원격설정하기(vino server on Ubuntu 9.10)  (0) 2009.12.30
tightVNC 서버사용기  (0) 2009.04.02
tightVNC / realVNC  (0) 2009.03.13
Posted by 구차니