'ioctl()'에 해당되는 글 2건

  1. 2012.07.27 ioctl()
  2. 2009.11.30 ioctl을 이용한 정보수집
Linux2012. 7. 27. 09:09
뜬금없이 리눅스 드라이버에 열내게 된 구차니군..
아무튼 프레임 버퍼 드라이버의 경우에도 ioctl로 이것저것 받아올수 있는데
즉, ioctl을 통해서 드라이버/커널과 통신을 할 수 있다는 의미이고
이 통신방신을 맞춰주면 드라이버 프로그래밍 별거 있나? 라는 생각이 드는데.. 맞겠...지?

[링크 : http://sunnmoon.egloos.com/1824920]
[링크 : http://www.ibm.com/developerworks/kr/library/l-devctrl-migration/
[링크 : http://device-driver.springnote.com/pages/5288613
 
Posted by 구차니
Linux API/network2009. 11. 30. 17:35
ioctl은

#include <sys/ioctl.h>
int ioctl(int d, int request, ...);

이런 모양인데, int d는 descriptor로 socket을 통해 받아와야 한다.
그리고 request는 /usr/include/bits/ioctls.h 파일에 정의된 내용을 사용하면 된다.


잠시 socket을 소개하자면

#include <sys/socket.h>
int socket(int domain, int type, int protocol);

domain
    Name                Purpose                          Man page
    PF_UNIX, PF_LOCAL   Local communication              unix(7)
    PF_INET             IPv4 Internet protocols          ip(7)
    PF_INET6            IPv6 Internet protocols
    PF_IPX              IPX - Novell protocols
    PF_NETLINK          Kernel user interface device     netlink(7)
    PF_X25              ITU-T X.25 / ISO-8208 protocol   x25(7)
    PF_AX25             Amateur radio AX.25 protocol
    PF_ATMPVC           Access to raw ATM PVCs
    PF_APPLETALK        Appletalk                        ddp(7)
    PF_PACKET           Low level packet interface       packet(7)

type
   SOCK_STREAM
          Provides sequenced, reliable, two-way, connection-based byte streams.  An  out-of-band  data  transmission
          mechanism may be supported.

   SOCK_DGRAM
          Supports datagrams (connectionless, unreliable messages of a fixed maximum length).

   SOCK_SEQPACKET(is not implemented for AF_INET)
          Provides  a  sequenced,  reliable,  two-way connection-based data transmission path for datagrams of fixed
          maximum length; a consumer is required to read an entire packet with each read system call.

   SOCK_RAW
          Provides raw network protocol access.

   SOCK_RDM
          Provides a reliable datagram layer that does not guarantee ordering.

   SOCK_PACKET
          Obsolete and should not be used in new programs; see packet(7).


protocol
    Normally only a single protocol exists to support a particular socket type within a given protocol family, in which case protocol can be specified as 0.

값들을 필요로 한다.

[링크 : http://www.joinc.co.kr/modules/moniwiki/wiki.php/article/network_information#s-2.2]

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

hton(), ntoh()  (0) 2011.09.26
netstat 에서 0.0.0.0의 의미  (2) 2009.12.07
termios 구조체를 이용한 자국반향(echo) 제어  (0) 2009.08.27
canonical / non-canonical  (0) 2009.08.27
struct in_addr  (0) 2009.08.18
Posted by 구차니