System programming in my own words can possibly be described as programming mechanisms to interact with various aspects of a system. It could be a shell script, a daemon, user space to kernel space interaction mechanisms, interaction between processes, file system management, memory management etc. System programming in Linux is in itself a very vast […]
The Netlink Socket Structures – Part 2
The Part 1 of ths Netlink socket structures discussion can be found in the below link. The Netlink Socket Structures – Part 1 The netlink message is sent using a netlink message. The format of the netlink message is shown below Fig Courtesy: https://people.redhat.com/nhorman/papers/netlink.pdf The nlmsghdr is the netlink message header and is given below […]
The Netlink Socket Structures – Part 1
The Socket Address structure for Netlink sockets is provided below (linux/netlink.h). struct sockaddr_nl { sa_family_t nl_family; unsigned short nl_pad; __u32 nl_pid; __u32 nl_groups;}; The socket structure uses the AF_NETLINK socket family. The nl_pad bytes are zero filled pad-bytes. The nl_pid is the unicast […]
The Netlink Socket
The Netlink socket mechanism might be better placed in the socket programming section. However, the Netlink mechanism being a socket mechanism which is used to converse with the kernel, placing it here. The Netlink Socket is a mechanism to retrieve and send data between user space and kernel space. The Netlink socket has its own […]
Select vs Poll API
The below table lists the characteristics of Select and poll API One of the problem statements that both of these APIs suffer from is that the time taken to process File descriptors increases as the number of file descriptors to monitor also increases. This is because, the Linux kernel has to loop through all the […]
The Poll API code example
The Poll API is similar to the select api in its operation. To understand more about the poll API – refer the link provided below. The Poll System Call The current code example uses the poll API to accept incoming socket connections. The Sample code is based on unix sockets but would work as well […]
The Poll System call
The Poll System call performs a similar operation as the select system call. To understand the select system call, an interested reader can visit the below link. The Select System call The poll API differs with select API in the manner in which the file descriptors to be monitored are specified to the Poll API. […]
Select System Call API Code Example
To understand the Select System Call API, kindly look at the article given below. Select System Call The current code example provides a reader an example usage of the select system call. The Unix Socket is used as the socket mechanism, however, Internet sockets also will work the same. The code is provided below. The […]
The select system call
The select system call is used in multiplexed I/O. The select system call blocks on a set of File descriptors (FD) until one of the FDs is ready for read/write. The select system call is provided below FIG Courtesy : The Linux Programming Interface – Michael Kerrisk The parameters of the API are explained below. […]
Select and Poll API
The Select and Poll API provide a means to perform multiplexed I/O on sockets from an application. In Linux, all opened sockets are file descriptors. If a particular application wishes to read from or write into multiple file descriptors, the program has to wait on the different file descriptors to know when data can be […]