network programming - Why are there ioctl calls in socket.c? -


trying understand why there ioctl calls in socket.c ? can see modified kernel using, has ioctl calls load in required modules when calls made.

i wondering why these calls ended in socket.c ? isn't socket kind of not-a-device , ioctls used device.

talking 2.6.32.0 heavily modified kernel here.

ioctl suffers historic name. while developed perform i/o controls on devices, has generic enough construct may used arbitrary service requests kernel in context of file descriptor. file descriptor opaque value (just int) provided kernel can associated anything.

now if treat file descriptor , think of things files, *nix constructs do, open/read/write/close isn't enough. if want label file (rename)? if want wait file become available (ioctl)? if want terminate if file closes (termios)? "meta" operations don't make sense in core read/write context lumped under ioctls; fctls; etc. unless used deserve own system call (e.g. flock(2) functionality in bsd4.2)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -