how to find the pid of a process by name..

is there a function that can find the process’s id by giving its name?

Not exactly. If the application has done a name_attach() you can use name_open, although this actually gets you a CHANNEL id, not a pid.

There may be multiple instances of a program of any given name, how would you know that you have the right one?

You can loop through the entries under /proc.