Linux2009. 6. 8. 17:27
/proc에는 신기한 넘들이 많다
아무튼 하드 정보라고 함은 하드 제조사라던가, 모델명인데

이것은
/proc/ide/hd?/model 에 존재 한다. sata는 어디 붙는지 모름 -ㅁ-

$ tree /proc/ide
.
|-- drivers
|-- hda -> ide0/hda
|-- hdb -> ide0/hdb
`-- ide0
    |-- channel
    |-- hda
    |   |-- cache
    |   |-- capacity
    |   |-- driver
    |   |-- geometry
    |   |-- identify
    |   |-- media
    |   |-- model
    |   |-- settings
    |   |-- smart_thresholds
    |   `-- smart_values
    |-- hdb
    |   |-- capacity
    |   |-- driver
    |   |-- identify
    |   |-- media
    |   |-- model
    |   `-- settings
    |-- mate
    `-- model

내가 쓰는 시스템에서는
HL-DT-STCD-RW/DVD DRIVE GCC-4244N
FUJITSU MHV2080AT PL
ST3120025ACE
ST3802110ACE
이런것들이 나오는데, 나오는 정보를 봐서는 CD롬 역시 IDE 방식으로 연결되면 나오는 것 같다.


usb로 연결된 하드의 경우에는 usb 장치로 인식되며
$ tree /proc/scsi
 .
|-- device_info
|-- scsi
|-- sg
|   |-- allow_dio
|   |-- debug
|   |-- def_reserved_size
|   |-- device_hdr
|   |-- device_strs
|   |-- devices
|   `-- version
`-- usb-storage
    |-- 2
    `-- 3

$ more 2 3
::::::::::::::
2
::::::::::::::
   Host scsi2: usb-storage
       Vendor: AXXEN
      Product: SKYMIRROR
Serial Number: 2008021900000000591896EB
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks:
::::::::::::::
3
::::::::::::::
   Host scsi3: usb-storage
       Vendor: NSI
      Product: ST3250310AS
Serial Number: 0010101650000000W
     Protocol: Transparent SCSI
    Transport: Bulk
       Quirks:

이런식으로 USB에서 인식이 된다.

'Linux' 카테고리의 다른 글

dhcp 작동중인지 확인하는 방법  (0) 2009.06.09
ip 관련 정보 얻어내기  (2) 2009.06.09
하드웨어 정보 받아오기  (0) 2009.06.08
리눅스에서 hex edit 하기  (0) 2009.05.28
ghex - gnome hex editor  (0) 2009.05.28
Posted by 구차니
Linux2009. 6. 8. 16:57
dmidecode라는 녀석이 있는데..
문제는 BIOS가 있어야 사용이 가능하다.
다르게 말하자면 BIOS가 없는 임베디드에서는 사용불가.. OTL

# ./dmidecode
# dmidecode 2.10
# No SMBIOS nor DMI entry point found, sorry.

[링크 : http://www.nongnu.org/dmidecode/]

'Linux' 카테고리의 다른 글

ip 관련 정보 얻어내기  (2) 2009.06.09
하드디스크 정보 얻어내기(model명)  (0) 2009.06.08
리눅스에서 hex edit 하기  (0) 2009.05.28
ghex - gnome hex editor  (0) 2009.05.28
for문의 효과 - 코드사이즈 줄이기(리눅스)  (0) 2009.05.27
Posted by 구차니
회사일2009. 6. 8. 11:07
Image Type:   SuperH Linux Kernel Image (gzip compressed)

혹시.. 이게 SH?!

[링크 : http://america.renesas.com/fmwk.jsp?cnt=sh4_features.htm&fp=/products/mpumcu/superh_family/sh7750_series/child_folder/&title=About+SH-4]
Posted by 구차니
IT 개발자 필수 4컷 만화?!


웬지 마구마구 공감중!!!!!!!


[링크 : http://www.thisisgame.com/board/view.php?id=226626&category=106&subcategory=2]
Posted by 구차니
개소리 왈왈2009. 6. 7. 20:17
인간이 사용할 수 있는 자원중에 가장 소중한 자원은
시간일텐데..


주중동안의 마음을 한번에 깨버리고
주말내내 시간을 허비한건...


잘한건 아닐지도 모르지만...
그래도 나름 아무것도 안하고 잘쉬었다~ 라고 할 정도라면..
잘 쓴걸려나?



이래저래 자기 위안...
Posted by 구차니
개소리 왈왈/영화2009. 6. 6. 19:03

104분 상영시간이 짧은 시간이긴 하지만(요즘에는 2시간 넘는게 많으니 -ㅁ-)
시간가는줄도 모르고 배꼽잡고 웃다가 나왔다.

아쉬운 건, 영화광들을 위한 다른 영화 패러디와
조금은 뜬금없는 최초의 여류 비행사와의 러브라인에
전편의 코믹했던 공룡뼈다구의 활약이 적었다는 것이다.

그 외에는 몸개그로 도배되어 오락영화로서는 손색이 없다.

'개소리 왈왈 > 영화' 카테고리의 다른 글

영화 - 해운대 (2009)  (6) 2009.07.25
기대하지 않았던 대박 - 킹콩을 들다  (4) 2009.07.05
Terminator Salvation - 터미네이터4 (2009)  (6) 2009.05.23
칫솔물고!  (0) 2009.04.27
곰팅이!  (0) 2009.04.26
Posted by 구차니
Linux API/network2009. 6. 5. 19:33
$ more /proc/net/route
Iface   Destination     Gateway         Flags   RefCnt  Use     Metric  Mask            MTU     Window  IRTT
eth0    000AA8C0        00000000        0001    0       0       0       00FFFFFF        0       0       0
eth0    0000FEA9        00000000        0001    0       0       0       0000FFFF        0       0       0
eth0    00000000        010AA8C0        0003    0       0       0       00000000        0       0       0

$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.10.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         192.168.10.1    0.0.0.0         UG        0 0          0 eth0


0x010AA8C0 이 gateway인데 숫자가 뒤집혀 있다.
0x01. 0x0A. 0xA8. 0xC0
1.      10.     168.   192
Posted by 구차니
Linux API/network2009. 6. 5. 18:01

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

네트워크 장치 갯수 얻기 (get amount of eth?)  (0) 2009.06.18
gateway 정보  (0) 2009.06.05
network 관련 include 할 파일 목록  (0) 2009.06.05
offsetof() - stddef.h  (0) 2009.06.05
SIOCGIF가 모야?  (0) 2009.06.05
Posted by 구차니
Linux API/network2009. 6. 5. 17:55
#include <net/if.h>
struct ifreq

#include <netinet/in.h>
struct sockaddr_in

#include <sys/socket.h>
struct sockaddr

#include <netpacket/packet.h>
struct packet_mreq

#include <net/route.h>
struct rtentry

#include <netdb.h>
struct hostent
struct addrinfo


sockaddr의 경우 원본은 bits/socket.h에 있으나
sys/socket.h 에서 include 함으로 굳이 bits/socket.h를 include 할 필요는 없다.

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

gateway 정보  (0) 2009.06.05
linux에서 ip/mac address 받아오기 관련 링크  (0) 2009.06.05
offsetof() - stddef.h  (0) 2009.06.05
SIOCGIF가 모야?  (0) 2009.06.05
C언어로 MAC 어드레스 받아오기 (Linux)  (1) 2009.06.04
Posted by 구차니
Linux API/network2009. 6. 5. 16:03
ifconfig.c를 들여다 보고 있자니 신기한 녀석들이 나타나시었다.

struct arg1opt {
    const char *name;
    unsigned short selector;
    unsigned short ifr_offset;
};

#define ifreq_offsetof(x)  offsetof(struct ifreq, x)

static const struct arg1opt Arg1Opt[] = {
    {"SIOCSIFMETRIC",  SIOCSIFMETRIC,  ifreq_offsetof(ifr_metric)},
    {"SIOCSIFMTU",     SIOCSIFMTU,     ifreq_offsetof(ifr_mtu)},
    {"SIOCSIFTXQLEN",  SIOCSIFTXQLEN,  ifreq_offsetof(ifr_qlen)},
    {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)},
    {"SIOCSIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask)},
    {"SIOCSIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr)},
#ifdef BB_FEATURE_IFCONFIG_HW
    {"SIOCSIFHWADDR",  SIOCSIFHWADDR,  ifreq_offsetof(ifr_hwaddr)},
#endif
    {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)},
#ifdef SIOCSKEEPALIVE
    {"SIOCSKEEPALIVE", SIOCSKEEPALIVE, ifreq_offsetof(ifr_data)},
#endif
#ifdef SIOCSOUTFILL
    {"SIOCSOUTFILL",   SIOCSOUTFILL,   ifreq_offsetof(ifr_data)},
#endif
#ifdef BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
    {"SIOCSIFMAP",     SIOCSIFMAP,     ifreq_offsetof(ifr_map.mem_start)},
    {"SIOCSIFMAP",     SIOCSIFMAP,     ifreq_offsetof(ifr_map.base_addr)},
    {"SIOCSIFMAP",     SIOCSIFMAP,     ifreq_offsetof(ifr_map.irq)},
#endif
    /* Last entry if for unmatched (possibly hostname) arg. */
    {"SIOCSIFADDR",    SIOCSIFADDR,    ifreq_offsetof(ifr_addr)},
};

$ man offsetof
#include <stddef.h>
size_t offsetof(type, member);

머. 매크로로 해도 될텐데 왜 굳이 함수형으로 했을까는 조금 의문이지만,
간단하게 표현하자면 . 연산자를 붙여주는 역활을 한다.

       #include <stddef.h>
       #include <stdio.h>
       #include <stdlib.h>

       int main()
       {
           struct s {
               int i;
               char c;
               double d;
               char a[];
           };

           /* Output is compiler dependent */

           printf("offsets: i=%ld; c=%ld; d=%ld a=%ld\n",
                   (long) offsetof(struct s, i),    // s.i ?
                   (long) offsetof(struct s, c),    // s.c ?
                   (long) offsetof(struct s, d),    // s.d ?
                   (long) offsetof(struct s, a));    // s.a ?
           printf("sizeof(struct s)=%ld\n", (long) sizeof(struct s));

           exit(EXIT_SUCCESS);
       }


생각을 해보니..

$ vi /usr/inclue/net/if.h
152 # define ifr_name       ifr_ifrn.ifrn_name      /* interface name       */
153 # define ifr_hwaddr     ifr_ifru.ifru_hwaddr    /* MAC address          */
154 # define ifr_addr       ifr_ifru.ifru_addr      /* address              */
155 # define ifr_dstaddr    ifr_ifru.ifru_dstaddr   /* other end of p-p lnk */
156 # define ifr_broadaddr  ifr_ifru.ifru_broadaddr /* broadcast address    */
157 # define ifr_netmask    ifr_ifru.ifru_netmask   /* interface net mask   */
158 # define ifr_flags      ifr_ifru.ifru_flags     /* flags                */
159 # define ifr_metric     ifr_ifru.ifru_ivalue    /* metric               */
160 # define ifr_mtu        ifr_ifru.ifru_mtu       /* mtu                  */
161 # define ifr_map        ifr_ifru.ifru_map       /* device map           */
162 # define ifr_slave      ifr_ifru.ifru_slave     /* slave device         */
163 # define ifr_data       ifr_ifru.ifru_data      /* for use by interface */
164 # define ifr_ifindex    ifr_ifru.ifru_ivalue    /* interface index      */
165 # define ifr_bandwidth  ifr_ifru.ifru_ivalue    /* link bandwidth       */
166 # define ifr_qlen       ifr_ifru.ifru_ivalue    /* queue length         */
167 # define ifr_newname    ifr_ifru.ifru_newname   /* New name             */

이런식으로도 매크로 정의가 되어 있는데, 여러가지 방법으로 사용하는 이유가 있을까 라는 생각도 든다.

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

gateway 정보  (0) 2009.06.05
linux에서 ip/mac address 받아오기 관련 링크  (0) 2009.06.05
network 관련 include 할 파일 목록  (0) 2009.06.05
SIOCGIF가 모야?  (0) 2009.06.05
C언어로 MAC 어드레스 받아오기 (Linux)  (1) 2009.06.04
Posted by 구차니