Four Corners Noise

Tom Whitten's Weblog


20060504 Thursday May 04, 2006

 main() for svc.configd

If you haven't read my disclaimer for my Learning SMF blog catetory, please do so.

I am looking at the code in on/usr/src/cmd/svc/configd/configd.c which contains the main() function for svc.configd(1M). I won't go into everything that main does, but here are the highlights.

Undocumented Command Line Options

There are a number command line options that are not documented in the man page. I assume that they are undocumented, because they are primarily for use by SMF developers in testing and debugging the configd code. The options are:

-d door_path
Normally, configd listens on the door at /etc/svc/volatile/repository_door for calls from its clients. This option allows you to specify an alternate door location. It also sets is_main_repository to 0, but I haven't figured out the effect of this yet. Finally, have_npdb is set to 0 to indicate that there are no non-persistent databases.
-n
Don't turn the process into a daemon. That is to say, do not fork and run in the background.
-p
Run in privileged mode. In this mode, configd will only accept connections from its parent process. The use of syslog is turned off (log_to_syslog set to 0), and is_main_repository is set to 0. In addition the global variables, privileged_pid and privileged_psinfo_fd are set. privileged_pid gets the PID of the parent, and privileged_psinfo_fd is a file descriptor for reading the parent's psinfo data in /proc.
-r db_path
Sets the path to the persistent repository database. By default configd uses /etc/svc/repository.db.
-t npdb_path
Sets the path for the non-persistent database repository. Default is /etc/svc/volatile/svc_nonpersist.db.

Other Things that main() Does

This is not an exhaustive list of what main does, but here are the highlights.

  • If not running as root, only users with our effective user ID can access configd.
  • Turn into a daemon unless -d was specified.
  • Initialize the back end database (backend_init).
  • Set up a list pool for threads.
  • Call door_server_create() to tell the door software to use new_thread_needed() to create new threads.
  • Call setup_main_door() to create the door for our clients to use.

Technorati Tags: , ,



( May 09 2006, 09:53:48 AM MDT / May 04 2006, 05:28:55 PM MDT ) Permalink Comments [1]
Trackback: http://blogs.sun.com/4ctom/entry/main_for_svc_configd

 Learning the SMF Code

I am moving off of my work on the Solaris Volume Manager (SVM) to join the Service Management Facility (SMF) team, so I have a lot of new code to learn. In the past when I had to learn a new body of code, I would keep notes in a file that I could refer to as time went on. This time, however, in the spirit of Open Solaris, I'm going to try keeping my notes in a blog. To that end, I've created a new blogging category called Learning SMF.

Make no mistake, my ramblings in this category are not going to be a well thought out authoritative explanation of some aspect of SMF. In the future I hope to generate some of those in a separate blog category, but for now all that you get from me are the ramblings of an SMF rookie digging into the code for the first time. Probably some of the things that I write in this category will turn out to be wrong. For more informed discussions of SMF check out the blogs of the long time members of the team — Jonathan Adams, Stephen Hahn, Dave Powell, and Liane Praza (in alphabetical order).

My first SMF assignment is to add code to svc.configd(1M) to generate security audit events. So in subsequent blogs, I'll be looking at the code in on/usr/src/cmd/svc/configd/configd.c.

Technorati Tags: , ,



( May 04 2006, 12:22:14 PM MDT / May 04 2006, 12:22:14 PM MDT ) Permalink
Trackback: http://blogs.sun.com/4ctom/entry/learning_the_smf_code


« May 2006
SunMonTueWedThuFriSat
 
1
2
3
5
6
7
8
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today


XML







Today's Page Hits: 14