 |
|
 |
|
Next: [News] PacketFence 1.8.4 i Released
|
| Author |
Message |
External

Since: Jul 21, 2009 Posts: 1
|
(Msg. 1) Posted: Tue Jul 21, 2009 11:11 pm
Post subject: About ioctl call Archived from groups: comp>os>linux>development>system (more info?)
|
|
|
I have posted this recently on lkml, but I've got no good answer. I'm
hoping you can explain this to me.
I was studying ioctl recently and I found out that, in order to change
the IP of a certain interface, you have to create a dummy socket with
socket(2) and use the returned file descriptor in the ioctl call. That
seems strange to me because the IP is not changed only for that
particular descriptor, but globally. Why is that configuration handled
by ioctl? Maybe via /proc/sys?
I know that there's a long time (even before linux) that things were
this way. But why was things done like this in the first place? Do you
consider it reasonable? Why? |
|
| Back to top |
|
 |  |
External

Since: Mar 08, 2009 Posts: 12
|
(Msg. 2) Posted: Tue Jul 21, 2009 11:11 pm
Post subject: Re: About ioctl call [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
> I was studying ioctl recently and I found out that, in order to change
> the IP of a certain interface, you have to create a dummy socket with
> socket(2) and use the returned file descriptor in the ioctl call. That
> seems strange to me because the IP is not changed only for that
> particular descriptor, but globally. Why is that configuration handled
> by ioctl? Maybe via /proc/sys?
Because ioctl had an available schema (prototype for function arguments)
that was easy to use to communicate the required information between
user space and the kernel: an integer (usually a file descriptor),
a verb (command, request, etc.), and a pointer to a variable-sized struct
that can be either input or output or both. Use an interface that already
exists, instead of inventing an argument list that is totally new.
ioctl traditionally has been used as a "catch all" for interfaces
that are experimental, less rigorously defined, change often, difficult
to get correct on the first try, etc.
-- |
|
| Back to top |
|
 |  |
External

Since: Apr 25, 2007 Posts: 134
|
(Msg. 3) Posted: Sat Jul 25, 2009 1:47 am
Post subject: Re: About ioctl call [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Jul 21, 7:11 pm, Rafael Cunha de Almeida <n....DeleteThis@example.org> wrote:
> I have posted this recently on lkml, but I've got no good answer. I'm
> hoping you can explain this to me.
> I was studying ioctl recently and I found out that, in order to change
> the IP of a certain interface, you have to create a dummy socket with
> socket(2) and use the returned file descriptor in the ioctl call. That
> seems strange to me because the IP is not changed only for that
> particular descriptor, but globally. Why is that configuration handled
> by ioctl? Maybe via /proc/sys?
This type of configuration predates the /proc filesystem.
> I know that there's a long time (even before linux) that things were
> this way. But why was things done like this in the first place? Do you
> consider it reasonable? Why?
It's completely reasonable. If you call up Microsoft and ask them to
change your billing address, would you expect them to change your
billing address just for the telephone support office that you called?
The socket provides the communication link, the command you send over
it determines what you change.
DS |
|
| Back to top |
|
 |  |
| Related Topics: | RFC3971 - Does anyone know if RFC3971 support is being developed for Linux? It does not seem to be implemented in the mainline..
Size 8 bit, 16 bit, 32 bit and 64 bit systems. - I need to find out what is the size of following data structures in 8 bit, 16 bit, 32 bit, and 64 bit systems. struct....
Size 8 bit, 16 bit, 32 bit and 64 bit systems. - I need to find out what is the size of following data structures in 8 bit, 16 bit, 32 bit, and 64 bit systems. struct....
Access shared memory from kernel module - Hi All, I wanted to know if shared memory created in user space can be accessed from a loadable kernel module. Have no...
Controlling UART transmission of bytes - I'm programming an ARM's UART that comes with a library implementing the standard unix termios interface. Regarding..
Question about a strange behavior of copy_to_user() in ioc.. - Hi, I need some help here to understand copy_to_user(). I encountered a strange copy_to_user() behavior when working o... |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|