The Linux Channel

Videos :: Linux ioctl() API interface

Written by: Kiran Kankipati - Published: 11-Oct-2017


Watch Video: 251 Linux ioctl( ) API interface - Introduction - Episode 1

* Click the image above to watch this video on Youtube ↗

Refer:
net-tools (ioctl APIs - user-space side):
net-tools sourceforge.net - http://net-tools.sourceforge.net
net-tools sourceforge.net Project - https://sourceforge.net/projects/net-tools
net-tools Linux Foundation Wiki - https://wiki.linuxfoundation.org/networking/net-tools
net-tools Git source - https://sourceforge.net/p/net-tools/code/ci/master/tree
ifconfig.c - https://sourceforge.net/p/net-tools/code/ci/master/tree/ifconfig.c

Watch Video: 252 Linux ioctl( ) API interface - Kernel Examples - Episode 2

* Click the image above to watch this video on Youtube ↗

Refer:
Wiki:
Carrier grade - https://en.wikipedia.org/wiki/Carrier_grade
Carrier Grade Linux - https://en.wikipedia.org/wiki/Carrier_Grade_Linux
High Availability (HA) - https://en.wikipedia.org/wiki/High_availability
Redundancy(engineering) - https://en.wikipedia.org/wiki/Redundancy_(engineering)

Kernel Source (ioctl APIs - kernel-space side):
/net/core/dev_ioctl.c - http://elixir.free-electrons.com/linux/latest/source/net/core/dev_ioctl.c
/net/core/dev.c - http://elixir.free-electrons.com/linux/latest/source/net/core/dev.c
The Linux Channel video series:
Linux Kernel net_device data-structure - http://the-linux-channel.the-toffee-project.org/index.php?page=41-videos-linux-kernel-net-device-data-structure
Linux Kernel Networking Sub-system - http://the-linux-channel.the-toffee-project.org/index.php?page=45-videos-linux-kernel-networking-sub-system
Linux Kernel /proc Interface - http://the-linux-channel.the-toffee-project.org/index.php?page=106-videos-linux-kernel-proc-interface
Linux Kernel sk_buff data-structure - Episode-1 to Episode-10 - http://the-linux-channel.the-toffee-project.org/index.php?page=47-videos-linux-kernel-sk-buff-data-structure
Linux Kernel sk_buff data-structure - Episode-11 to Episode-18 - http://the-linux-channel.the-toffee-project.org/index.php?page=111-videos-linux-kernel-sk-buff-data-structure

Watch Video: 253 Linux ioctl API interface - Sample Code - Kernel Module - User App - Episode 3

* Click the image above to watch this video on Youtube ↗

Download this episode my entire kernel module sample code, make file, clean script HERE.

Refer:
Device Drivers, Part 9: I/O Control in Linux - by Anil Kumar Pugalia <email_at_sarika-pugs_dot_com> - http://opensourceforu.com/2011/08/io-control-in-linux/
The Linux Kernel Module Programming Guide - Chapter 7. Talking To Device Files - http://tldp.org/LDP/lkmpg/2.6/html/x892.html
(NOTE: Sample example source-code mentioned here will not work as it is in newer kernels. It needs porting.)

Watch Video: 254 Linux ioctl() API interface - copy_from_user() and copy_to_user() - Episode 4

* Click the image above to watch this video on Youtube ↗

Refer:
/include/linux/uaccess.h - copy_from_user(), copy_to_user() - http://elixir.free-electrons.com/linux/latest/source/include/linux/uaccess.h
/arch/x86/include/asm/uaccess_32.h - raw_copy_from_user(), raw_copy_to_user() [x86 32-bit] http://elixir.free-electrons.com/linux/latest/source/arch/x86/include/asm/uaccess_32.h
/arch/x86/include/asm/uaccess_64.h - raw_copy_from_user(), raw_copy_to_user() [x86 64-bit] http://elixir.free-electrons.com/linux/latest/source/arch/x86/include/asm/uaccess_64.h
/arch/arm/include/asm/uaccess.h - raw_copy_from_user(), raw_copy_to_user() [arm] http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/asm/uaccess.h
/arch/arm64/include/asm/uaccess.h- raw_copy_from_user(), raw_copy_to_user() [arm 64-bit] http://elixir.free-electrons.com/linux/latest/source/arch/arm64/include/asm/uaccess.h

As discussed in the video (Episode 4), we cannot use memcpy() to communicate between user-space applications (processes). Since each process has its own virtual memory space. Instead we need to use standard Linux predefined IPC (for example: sockets, message queues, pipes, signals and so on), which in turn built via APIs such as: copy_from_user() and copy_to_user().
copy_from_user() and copy_to_user()
Notice: copy_from_user() and copy_to_user() looks similar to memcpy() in terms of their function arguments.
copy_from_user() and copy_to_user() vs memcpy()
Here is the Kernel source API flow of the copy_from_user() and copy_to_user() APIs. As discussed in the video, eventually it transitions from architecture (or platform) independent code to the platform (or hardware/CPU) dependent code:
copy_from_user() and copy_to_user() Kernel Source API path



Suggested Topics:


Linux Kernel programming :: Video Episodes
 Linux Kernel struct iphdr data-structure ↗
05-Jul-2016


 Linux Kernel struct socket and struct sock data-structure ↗
31-Oct-2017


 Linux Kernel /proc Interface ↗
22-Feb-2017


 Linux Kernel struct ethhdr data-structure ↗
02-Nov-2016


 Linux Kernel struct tcphdr data-structure ↗
05-Jul-2016


 Linux Kernel Network Programming - struct net - struct netns_ipv4 - /proc/sys/net/ipv4 ↗
21-May-2018


 Linux Kernel sk_buff data-structure - Episode-1 to Episode-10 ↗
05-Jul-2016


 Linux Kernel Programming - Device Drivers ↗
30-Mar-2018


 Linux Kernel Architecture - Generic ↗
13-May-2017


 Linux Kernel net_device data-structure ↗
05-Jul-2016


 Linux Kernel struct udphdr data-structure ↗
05-Jul-2016


 Linux Kernel dst_entry data-structure ↗
04-May-2017


 Linux Operating System - User-space Processes ↗
22-Jan-2018


 Linux Kernel sk_buff data-structure - Episode-11 to Episode-18 ↗
26-Mar-2017


 Linux Kernel FileSystems Subsystem ↗
16-Dec-2017


 Linux Kernel - Containers and Namespaces ↗
11-Feb-2018


 Linux Kernel Programming ↗
05-Jul-2016


 Linux Kernel Compilation ↗
05-Jul-2016


 Linux ioctl() API interface ↗
11-Oct-2017


 Linux Kernel TCP Congestion Control Algorithms ↗
20-Nov-2017


 Linux Kernel Networking Sub-system ↗
05-Jul-2016


 Linux Kernel Network Programming ↗
05-Nov-2017


 

Join The Linux Channel :: Facebook Group

* This website is driven by AI.

Join a course:

💎 Linux Kernel and Systems Software: PDF Brochure

💎 Linux and Network Software Developer: PDF Brochure


💗 Help shape the future: Sponsor/Donate


Recommended Topics:
Featured Video:

* Click the image above to watch this video on Youtube ↗


Trending Video:

* Click the image above to watch this video on Youtube ↗

TUTORIALS :: UDP sample socket code for Systems and Network software developers:


Linux Kernel TCP Congestion Control Algorithms:
Linux Kernel Programming - Device Drivers:


Research :: Content Delivery Networks (CDN):
CDN Networks


Recommended Video:

* Click the image above to watch this video on Youtube ↗

The Linux Channel - v8.8 :: Updated: 30-Mar-2018 :: © 2018 :: Author: Kiran Kankipati
Your IP: 54.167.243.214 :: Browser: CCBot/2.0 (https://commoncrawl.org/faq/)