How does Sendmail know how it was invoked?

Dan Nelson dnelson at allantgroup.com
Sat Aug 4 11:23:09 PDT 2007


In the last episode (Aug 04), RW said:
> mailwrapper checks to see how it was invoked and then looks up the
> appropriate command in mailer.conf.  All of the entries in
> mailer.conf point to /usr/libexec/sendmail/sendmail, so how does that
> binary know what it's supposed to do.

The kernel passes the executable name to the running process along with
the rest of the commandline arguments.  If you run "ls -l /tmp", for
example, the ls binary gets "ls", "-l", and "/tmp" as its arguments. 
See around line 360 of src/contrib/sendmail/src/main.c.

http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/sendmail/src/main.c?annotate=HEAD

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list