由买买提看人间百态

topics

全部话题 - 话题: ioctl
1 (共1页)
t*******y
发帖数: 1289
1
找找 device driver 3 看看,不难,主要还是实际工作中遇到不同的问题学习。
如果你只是为了解决当前问题,ioctl可以照猫画虎。一般driver都有这个code,参考
一下很简单。你只要在ioctl的table里加入自己的string,然后加入自己的function。
在ioctl的function里面call 你的function。
不同的设备有些区别。不过很简单的。一般的ioctl就是switch case。
m**d
发帖数: 21441
2
QBASIC - Statements
命令:
BEEP, BLOAD, BSAVE, CALL, CHAIN, CHDIR, CIRCLE, CLEAR, CLOSE, CLS, COLOR,
COM, COMMON, CONST, DATA, DATE$, DECLARE, DEF, DEFDBL, DEFINT, DEFLNG,
DEFSNG, DEFSTR, DIM, DO, DRAW, END, ENVIRON, ERASE, ERROR, EXIT, FIELD,
FILES, FOR, FUNCTION, GET, GOSUB, GOTO, IF, INPUT, IOCTL, KEY, KILL, LET,
LINE, LINE INPUT, LOCATE, LOCK, LPRINT, LSET, MID$, MKDIR, NAME, ON, OPEN,
OPTION, OUT, PAINT, PALETTE, PCOPY, PEN, PLAY, POKE, PRESET, PRINT, PSET,
PUT, RANDOMIZE, READ, REDIM, REM, ... 阅读全帖
s****n
发帖数: 786
3
struct ifreq ifreq;
int sock;
if((sock=socket(AF_INET,SOCK_STREAM,0))<0)
{
perror("socket");
return -1;
}
strcpy(ifreq.ifr_name,"eth1"); //change your interface here
if(ioctl(sock,SIOCGIFHWADDR,&ifreq)<0) //get your network address here
{
perror("ioctl");
return -1;
}
t*******y
发帖数: 1289
4
想法:
加入一个ioctl 到 driver 中去读取并返回结果。
往driver中发ioctl。
S*A
发帖数: 7142
5
If you do ioctl, pass an invalid user space pointer.
That will cause access validation fail.
In that case it will return the full size n. All buffer is bad
and the "to" buffer has memset to 0.
The kernel should not panic a user space program because
they send wrong pointers. The kernel should return error
in the ioctl. It is bad that user space panic on sending kernel
wrong pointer.

to
x****k
发帖数: 2932
6
这个回答靠谱,
重复调用同一ioctl,然后用总时间除以循环次数,对比只调用一次ioctl的时间,后者
会更耗时一些,sandy bridge的xeon上花2~3us算常见的。

kernel
k**w
发帖数: 376
7
来自主题: JobHunting版 - unix 面试题,求答案
>>fork,exec ipc,how many types of ipc
after fork, does new process get file handles and locks
>>what's are spin lock? are they better than mutex?
how many spinlocks work on smp and up architecure?
>>what will happen /can u have printf/printk inside an interrupt handler?
>>what's the difference between wake_up() and wake_up_interruptible() apis
in the linux kernel
when should sude which one, how it should be decided?
>>what's the difference between sleeep_on() and interruptible_sleep_on()
>>what ... 阅读全帖

发帖数: 1
8
来自主题: JobHunting版 - Re: 来个网络驱动移植的问题
街霸ken哥谢谢你的刷题广告不过这个贴子并不需要你
在某开发板做port
3.10Linux 内核跑全正常。可以进busybox,可以ping
3.2.16 Linux 内核可以进busybox.ping报错
ifconfig eth0 正常可以看到IP地址 . RX可以看到packets 在增长,TX始终为0。
插拔网线可以看到消息link up full duplex/ link down
打udhcpc 报:SIOCGIFINDEX :No such file or directory
route add default gw 192.168.4.1 报route :SIOCADDRT: Inappropriate ioctl for
device
打ping报 ping :sendto : No such file or directory.
目前没方向不知道问题是在网络驱动这块还是内核其它模块导致。ethernet驱动感觉已
经起来。有没有高人给下trouble shoot的建议不需要很详细给个大方向即可。是文件
系统/地址映射/设备文件大概哪个大模块有问题谢谢
k*****u
发帖数: 1688
9
多谢 再问一下
fdisk的结果是
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old
table: Device or resource busy
是不是fdisk没有成功?
D*********s
发帖数: 555
10
来自主题: Linux版 - Kernel ioctl call
需要在kernel里面call ata_scsi_ioctl拿一些硬盘参数,
哪位大虾干过,函数原型是这样的
ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
第一个和地三个参数应该怎么传呢?
n******t
发帖数: 4406
11
来自主题: Linux版 - Linux Desktop 还是太保守了
我才注意到他居然说win32api本身是wrapper了,
原来其实ioctl也是wrapper.
x****u
发帖数: 44466
12
来自主题: Linux版 - Linux Desktop 还是太保守了
类比不当。
Win32api是动态链接库,ioctl作为系统调用,应该和windows native api类比。
Win32api是类似glibc一样的层,我不明白微软为什么不直接提供一个c库作为api。
f**c
发帖数: 791
13
来自主题: Linux版 - fc11 的pcspkr 问题
请见附件
另外 beep 命令只在root下work, 普通用户说
ioctl: Operation not permitted
大虾帮帮忙!感激涕零。。
y***d
发帖数: 2330
14
strace ifconfig
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
ioctl(4, SIOCGIFCONF, {80, {{"lo", {AF_INET, inet_addr("127.0.0.1")}}, {"
eth0", {AF_INET, inet_addr("xxx.xxx.xxx.xxx")}}}}) = 0

it
N****w
发帖数: 21578
15
matlab 还有这种 ioctl 操作?不是要硬件狗吧
/dev/pts/4 是啥?串口吗?

arg
n******t
发帖数: 4406
16
It sounds like you you need to implement some IOCTL message in your driver..
And have you checked /sys/class/net/ethx/carrier? ..
w*s
发帖数: 7227
17
For normal spi devices, they call "spi_register_master".
atmel_spi.c
I have a ssc module in the Arm chip, want to use it to emulate spi device.
Plan to implement transfer() method as other spi device drivers.
If i register it using spi_register_master in probe(),
can i send spi IOCTLs from spidev.c to it ?
I know i need to fill in stuff in this ssc driver,
but hopefully all high level spi related stuff stays the same. Basically
emulates ssc as spi.
Any suggestions ?
t*******y
发帖数: 1289
18
大哥,能说 清楚点吗?
ethtool 不就是一个ioctl吗?
“然后通过udev给用户空间“ 啥意思 ?
我比较手潮。
s****u
发帖数: 375
19
谢谢,我网上搜到的处理方法就是这么做。
对linux kernel不熟,请问有没有相关tutorial 或 book chapter让我学习学习这么用
ioctl。
d*2
发帖数: 2053
20
dd if=/dev/zero of=/tmp/lp1 bs=512 count=2000000
losetup /dev/loop1 /tmp/lp1
create a partition using fdisk
fdisk /dev/loop1
error at the end:
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid
argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
# fdisk -l /dev/loop1
Disk /dev/loop1: 1024 MB, 1024000000 bytes
255 heads, 63 sectors/track... 阅读全帖
B********s
发帖数: 3610
21
来自主题: Programming版 - How to get local hostname under linux?
Code is as below. after I got the actural local ip information (credit to
ansel), I got a correct hostname but it was truncated at the first period.
For example, it gives "abc" instead of "abc.cs.mit.edu"
How can I get the full hostname then? Please pay attention to "my code" part.
Thanks.
fd = socket(AF_INET, SOCK_DGRAM, 0);
memset(&ifr, 0, sizeof(ifr));
memcpy(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name));
ioctl(fd, SIOCGIFADDR, &ifr);
sin_ptr = (struct sockaddr_in *) &ifr.ifr_addr;
myself = sin
s******e
发帖数: 431
22
For simple app->driver communication, use IOCTL. For bulky driver->app
communication, use shared memory. There is an article about sharing memory
between driver and app from osronline.
http://www.osronline.com/article.cfm?id=39
D*****r
发帖数: 6791
23
来自主题: Programming版 - 有没有什么网络函数能够
网络函数是什么意思?
是说system call么?我帮你google了一下,好像可以用ioctl
http://cplus.kompf.de/artikel/macaddr.html#second

3.
w*s
发帖数: 7227
24
【 以下文字转载自 Linux 讨论区 】
发信人: wds (净洗前尘,从头再来), 信区: Linux
标 题: Can i register a ssc driver (a serial interface device) to be a spi driver ?
发信站: BBS 未名空间站 (Mon Mar 5 10:13:04 2012, 美东)
For normal spi devices, they call "spi_register_master".
atmel_spi.c
I have a ssc module in the Arm chip, want to use it to emulate spi device.
Plan to implement transfer() method as other spi device drivers.
If i register it using spi_register_master in probe(),
can i send spi IOCTLs from spidev.c to it ?
I know i ... 阅读全帖
i**p
发帖数: 902
25
来自主题: Programming版 - Micro-SD card 驱动程序 (转载)
这是一个root了的Android手机.
3 parts of dmesg here, insmod, remove sd card, insert sd card:
--------------------------------------
insmod mysdio.ko (sd card is in, trace is from my printk. no probe trace
though I add prink to my_sdio_probe)
<7>[ 263.716249] (pid:728, cmd:insmod) my_sdio_driver.drv.name:CRYPTRmicro_
sdio
<7>[ 263.716316] (pid:728, cmd:insmod) my_sdio_driver.drv.bus:0x8049be80
<7>[ 263.716373] (pid:728, cmd:insmod) my_sdio_driver.drv.bus->name:sdio
<7>[ 263.716429] (pid:728, cmd:insm... 阅读全帖
w***x
发帖数: 105
26
关于syscall的消耗,我以前曾经测试过,写一个noop的ioctl,然后从user进入kernel
再返回,没记错的话,Linux下时间大概是小于2 microseconds。
g****t
发帖数: 31659
27
来自主题: Programming版 - Ryan DL的心声...
后来他自己删了的。
I hate almost all software. It's unnecessary and complicated at almost every
layer. At best I can congratulate someone for quickly and simply solving a
problem on top of the shit that they are given. The only software that I
like is one that I can easily understand and solves my problems. The amount
of complexity I'm willing to tolerate is proportional to the size of the
problem being solved.
In the past year I think I have finally come to understand the ideals of
Unix: file descriptor... 阅读全帖
u***************r
发帖数: 11227
28
来自主题: Security版 - unidentified_title
发信人: hellotree(树先生), 信区: Security
标题: 电脑蓝屏了怎么办?
发信站: BBS未名空间站(Wed Sep 20 10:23:28 2017,GMT)
Win7操作系统有酷炫的界面和丰富的功能,受到很多朋友的喜爱,成为大家生活工作的
好伙伴。但是因为硬件和软件的各种原因Win7系统也会偶尔遇到蓝屏,由数字和字母组
成的蓝屏代码分别代表不同的含义,下面为大家介绍一些Windows 7蓝屏的处理方法以
及部分Windows7系统蓝屏代码和含义
​Windows 7蓝屏产生的原因很多,但大多数往往集中在不兼容的硬件和驱动程序
有问题的软件、病毒等。遇到蓝屏错误时,可以尝试选用下面的方法。 重启系统
如果只是某个程序或驱动程序偶尔出现错误,重启系统后部分问题会消除。 检查硬

检查新硬件是否插牢,这个被许多人忽视的问题往往会引发许多莫名其妙的故障。如果
确认没有问题,将其拔下,然后换个插槽试试,并安装最新的驱动程序。同时还应对照
微软网站的硬件兼容类别检查一下硬件是否与操作系统兼容。
检查是否做了CPU超频,超频操作进行了超载运算,造成其内... 阅读全帖
h******r
发帖数: 148
29
俺把俺的sgi octane2 换到另外一个LAN. 也是以太网。
结果能ping到LAN里的机器,ping不到外边。
下边有俺详细的步骤,ip, 和域名和所有信息都是真的。
求知道sgi的大侠救俺一命吧。回到版上或到俺信箱
都行。
# network start 的输出是:
configuring ef0 as mech5.tsuniv.edu
Network daemons: portmap.
Mounting cache file system:
Internet daemons: inetd timedunknown host timelords
ifconfig ec0 的输出是:
ifconfig:ioctl (SIOCGIFFLAGS):no such interface
详细过程如下:
====================================
The network problems occurred after I move my SGI
Octane2 from
one campus to another.
The workstation was c
n**w
发帖数: 33
30
Hi,
I am trying to back up a Sun Solaris 8 system to tape using a script.
The script finished backing up for directory / and /var successfully
but failed for directory /usr. The error messages I got are:
snapshot error: usage: ufsdump [......] filesystem
fssnap: ioctl: error 2: No such file or directory
Anyone knows what could be the possible reason for this problem?
Thanks a lot!
k**w
发帖数: 376
31
来自主题: Unix版 - unix 面试题,求答案 (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: klyw (mm), 信区: JobHunting
标 题: unix 面试题,求答案
发信站: BBS 未名空间站 (Thu Nov 24 23:28:35 2011, 美东)
>>fork,exec ipc,how many types of ipc
after fork, does new process get file handles and locks
>>what's are spin lock? are they better than mutex?
how many spinlocks work on smp and up architecure?
>>what will happen /can u have printf/printk inside an interrupt handler?
>>what's the difference between wake_up() and wake_up_interruptible() apis
in the linux kernel
when should... 阅读全帖
1 (共1页)