Please check "The C Interfaces and Implementations" book by David Hanson [1]. Someone has implemented the concept using his library that you can check and use [2]. Another excellent reference is the "The Linux Programming Interface" book by Michael Kerrisk that documents most of the API available under Linux [3]. [1]https://www.amazon.com/dp/0201498413 [2]https://github.com/gon1332/gonlibs [3]https://www.amazon.com/Linux-Programming-Interface-System-Ha... (https://www.amazon.com/Linux-Programming-Interface-System-Handbook/dp/1593272200)
Also recommended in this reply