HOMECOURSESSTUDENTSDONATIONSVIDEOSEVENTSTUTORIALSLINKSNEWSCONTACT


VIDEOS 》 Linux ioctl() API interface

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

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

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.)

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:


Video Episodes :: Linux Kernel programming

Linux Kernel Programming - Device Drivers ↗
Thursday' 13-Aug-2020
Watch detailed videos and read topics on Linux Kernel Programming - Device Drivers

Linux Operating System - User-space Processes ↗
Thursday' 13-Aug-2020

Linux Kernel FileSystems Subsystem ↗
Thursday' 13-Aug-2020

Linux Kernel - Containers and Namespaces ↗
Thursday' 13-Aug-2020

Linux Kernel Programming ↗
Thursday' 13-Aug-2020

Linux Kernel Architecture ↗
Thursday' 13-Aug-2020

Linux Kernel /proc Interface ↗
Thursday' 13-Aug-2020

Linux Kernel Compilation ↗
Thursday' 13-Aug-2020

Linux ioctl() API interface ↗
Thursday' 13-Aug-2020
Watch detailed videos and read topics on Linux Kernel Programming and Linux ioctl() API interface

Join The Linux Channel :: Facebook Group ↗

Visit The Linux Channel :: on Youtube ↗


💗 Help shape the future: Sponsor/Donate


Recommended Topics:
Featured Video:
Watch on Youtube - [796//0] Linux Kernel skbuff data-structure - part10 - skb_pull() ↗

Adding your own Kernel Modules into Linux Kernel Source | Linux Kernel Programming ↗
Thursday' 13-Aug-2020
Whenever you do custom kernel modules, you can optionally make it a part of existing Linux Kernel source. This does not mean you are submitting your kernel module to the mainline kernel source (i.e kernel.org Linux Kernel Foundation). What I meant is, you can make your kernel module(s) part of Linux Kernel source so that when you compile your kernel you can automatically compile your kernel module(s) too. As well when you create/modify kernel .config configuration file (such as via make menuconfig, etc), you can enable or disable your kernel module(s) too.
To do the same you have to register (and include) your custom Kernel Module's Kconfig and Makefile to the existing Kconfig and Makefile of the Linux Kernel source Here is a detailed multi-episode video of mine which gives the overall idea and the big-picture.

Linux Kernel Programming | with or without Kernel Modules | Device Drivers ↗
Thursday' 13-Aug-2020
When learning Linux Kernel programming, often I notice my students and viewers gets confused and they start with learning writing Linux Kernel modules. And so they develop the common misconception about Kernel Programming in general. They assume writing code in Linux Kernel means writing kernel modules. Which is absolutely not. Kernel modules are an optional choice and are part of Linux Kernel. But besides modules, Linux Kernel has lot of other mainstream code. Hence if anyone wants to be a Kernel Developer, you should be aware that sometimes you add new code via modules, sometimes without them. And if you ask me, I am not much in favor of writing Kernel modules. Instead in my code, I try to integrate and make them a part of Linux Kernel so that they all get initialized during boot time. Here is an extensive Youtube video of mine on Linux Kernel Programming, with and without Kernel Modules.

Roadmap - How to become Linux Kernel Developer - Device Drivers Programmer and a Systems Software Expert ↗
Thursday' 13-Aug-2020
Many viewers and even sometimes my students ask me how I can become a kernel programmer or just device driver developer and so on. So I shot this video (and an add-on video) where I summarized steps and a roadmap to become a full-fledged Linux Kernel Developer.

Weekly News Digest - Week 03 - July 2020 ↗
Thursday' 13-Aug-2020
The Linux Channel :: Weekly News Digest - Week 03 - July 2020
> Linux founder tells Intel to stop inventing 'magic instructions' and 'start fixing real problems'
> QNAP launches its first 2.5GbE network switch - QSW-1105-5T
> Japan's ARM-based Fugaku is the world's fastest supercomputer
> FreeBSD Back To Seeing Progress On 802.11ac WiFi Support, Ath10k Driver
> Sparkfun Launches the ZED-F9R GPS Dead Reckoning Raspberry Pi pHAT for Mobile Robots
> ODROID-N2 Plus SBC Gets Amlogic S922X Rev. C Processor Clocked at up to 2.4 GHz
> Rock Pi E SBC Comes with WiFi, Bluetooth, Two Ethernet Ports, and Optional PoE

Linux Software Development and Tools ↗
Thursday' 13-Aug-2020

Compiling a C Compiler with a C Compilter | Compile gcc with gcc ↗
Thursday' 13-Aug-2020
The fundamental aspect of a programming language compiler is to translate code written from language to other. But most commonly compilers will compile code written in high-level human friendly language such as C, C++, Java, etc. to native CPU architecture specific (machine understandable) binary code which is nothing but sequence of CPU instructions. Hence if we see that way we should able to compile gcc Compiler source code with a gcc Compiler binary.

Programming Language Performance and Overheads ↗
Thursday' 13-Aug-2020
A detailed Youtube video series of various programming language performance and overheads - a big picture

PyDelhi + PyData + ILUG-D + Linux Chix meetup mash @ Sarai on 17-Dec-2016 ↗
Thursday' 13-Aug-2020

C Programming Language Basics - Pointers in C ↗
Thursday' 13-Aug-2020

Software Programming Standards (Coding Standards) ↗
Thursday' 13-Aug-2020


Trending Video:
Watch on Youtube - [769//0] Online Course - Linux CLI Scripting - Episode2 - $cut command ↗

Weekly News Digest - Week 12 - March 2018 ↗
Thursday' 13-Aug-2020
> ReSpeaker Core v2 is a 6-Mic Array Audio Development Kit Powered by Rockchip RK3229 Processor > How to monitor network protocol traffic on your data center Linux servers > Open Source LimeSDR Mini Takes Off in Satellites > Marvell revs up Ethernet to 400Gbps with new ‘Alaska’ chips > Natural Language Processing (NLP) > WAGO PFC200 PLC Runs Embedded Linux, Supports Web and Mobile Visualization



Recommended Video:
Watch on Youtube - [764//0] 0x18c Architecting | Process and Threads | Part 1/2 | The Linux Channel ↗