Function for pid

Hello, does anyone know which API or function can be used to get the pid of a process if the process name is known?

If you check under /proc you will see a bunch of numbers, these are the pids of every running process. Now you can open these files and via devctl command get info abou them, including their name. Get the source to pidin and check how it`s done.