fintanr's weblog

Archives

« November 2009
MonTueWedThuFriSatSun
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
      
Today

the links




Twitter Updates

    follow me on Twitter
















    20050627 Monday June 27, 2005

    mdb ::eval
    I added this as a comment to Erics MDB Puzzle last Friday. A question appeared in the comments asking what exactly ::eval did. The question posed was "Print out the current working directory of every process with an effective user id of 0.". And the the solution given by Eric was

    > ::walk proc p | ::print proc_t p_cred->cr_uid | ::grep .==0 | ::eval <p=K | ::print proc_t p_user.u_cdir->v_path
    
    Now the actual question was what does the ::eval dcmd do. To use the full defination from the mdb docs evaluates and then runs the command that you give it, so in the case of the examples the eval segment is pulling out a pointer (the K tells it to get a uintptr_t) to the proc structure that you are interested in which you then just print out the values from.

    As an example, if you just run the command sequence above as far as the eval you get something like

    > ::walk proc p | ::print proc_t p_cred->cr_uid | ::grep .==0 | ::eval <p=K
                    fffffffffbc20a80
                    ffffffff8111f8f8
                    ffffffff81120520
                    ffffffff81121148
                    ffffffff84444c88
                    ffffffff835074b8
    >
    Which are your pointers back to the relevant proc_t structures.
    Technorati Tag(s) :

    (2005-06-27 03:19:53.0) Permalink Comments [1]

    Trackback URL: http://blogs.sun.com/fintanr/entry/mdb_eval
    Comments:

    it is great

    Posted by 217.229.54.89 on October 21, 2008 at 09:14 PM IST #

    Post a Comment:

    Name:
    E-Mail:
    URL:

    Your Comment:

    HTML Syntax: NOT allowed