Professional Web Applications Themes

process address in ps -le - Sun Solaris

I am trying to get process address using ps -le but all the ADDR fields are marked as "?". $ uname -a SunOS bigserve 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-Enterprise $ ps -le F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 19 T 0 0 0 0 0 SY ? 0 ? 0:01 sched 8 S 0 1 0 0 41 20 ? 102 ? ? 0:00 init 19 S 0 2 0 0 0 SY ? 0 ? ? 0:00 pageout 19 S 0 3 0 0 0 SY ? 0 ? ? 0:59 ...

  1. #1

    Default process address in ps -le

    I am trying to get process address using ps -le but
    all the ADDR fields are marked as "?".

    $ uname -a
    SunOS bigserve 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-Enterprise

    $ ps -le
    F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
    19 T 0 0 0 0 0 SY ? 0 ? 0:01
    sched
    8 S 0 1 0 0 41 20 ? 102 ? ? 0:00
    init
    19 S 0 2 0 0 0 SY ? 0 ? ? 0:00
    pageout
    19 S 0 3 0 0 0 SY ? 0 ? ? 0:59
    fsflush

    pls let me know if I can fix this or if there is any other
    way of finding process address

    Thanks
    chandra

    user@domain.invalid Guest

  2. #2

    Default Re: process address in ps -le

    invalid wrote:

    [cut]
     

    Can't remember if any command gives it to you,
    but ::ps in mdb -k will. Not sure why you'd
    need it for anything?

    Gavin

    Gavin Guest

  3. #3

    Default Re: process address in ps -le

    invalid wrote: 
     
     

    The format for -le is fixed, and includes length limits on various
    columns. The size for ADDR is appropriate for a 32-bit address, but not
    adequate for all 64-bit addresses.

    Use a custom format that includes the fields you want and all should be
    well..

    $ ps -l -p $$
    F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
    8 S 0 21857 21855 1 51 20 ? 308 ? pts/1 0:00 bash
    $ ps -o uid,pid,addr -p $$
    UID PID ADDR
    0 21857 30000f9b570
    $

    --
    Darren Dunham com
    Unix System Administrator Taos - The SysAdmin Company
    Got some Dr Pepper? San Francisco, CA bay area
    < This line left intentionally blank to confuse you. >
    Darren Guest

  4. #4

    Default Re: process address in ps -le

    Thanks both Darren and Gavid for your suggestions.. So
    finally I could get the process address. The motivation behind
    this was to use mdb to access to see the virtual memory page addresses
    and their corressponding physical addresses.

    Now I have a new problem...

    I have an a.out running, which has following elf segments..

    ELF Header
    ei_magic: { 0x7f, E, L, F }
    ei_class: ELFCLASS32 ei_data: ELFDATA2MSB
    e_machine: EM_SPARC e_version: EV_CURRENT
    e_type: ET_EXEC
    e_flags: 0
    e_entry: 0x10530 e_ehsize: 52 e_shstrndx: 21
    e_shoff: 0x11f4 e_shentsize: 40 e_shnum: 23
    e_phoff: 0x34 e_phentsize: 32 e_phnum: 5

    Program Header[0]:
    p_vaddr: 0x10034 p_flags: [ PF_X PF_R ]
    p_paddr: 0 p_type: [ PT_PHDR ]
    p_filesz: 0xa0 p_memsz: 0xa0
    p_offset: 0x34 p_align: 0

    Program Header[1]:
    p_vaddr: 0 p_flags: [ PF_R ]
    p_paddr: 0 p_type: [ PT_INTERP ]
    p_filesz: 0x11 p_memsz: 0
    p_offset: 0xd4 p_align: 0

    Program Header[2]:
    p_vaddr: 0x10000 p_flags: [ PF_X PF_R ]
    p_paddr: 0 p_type: [ PT_LOAD ]
    p_filesz: 0x6a4 p_memsz: 0x6a4
    p_offset: 0 p_align: 0x10000

    Program Header[3]:
    p_vaddr: 0x206a4 p_flags: [ PF_X PF_W PF_R ]
    p_paddr: 0 p_type: [ PT_LOAD ]
    p_filesz: 0x15c p_memsz: 0x164
    p_offset: 0x6a4 p_align: 0x10000

    Program Header[4]:
    p_vaddr: 0x20718 p_flags: [ PF_X PF_W PF_R ]
    p_paddr: 0 p_type: [ PT_DYNAMIC ]
    p_filesz: 0xb8 p_memsz: 0
    p_offset: 0x718 p_align: 0

    Using mdb, I am trying to find what the physical address of the first
    page of the text segment is and how it relates to the virtual address
    0x10000. But looks like 0x10000 is not really the virtual address.
    (The main motive behind all this is to find suitable virtual addresses
    for the segments using -Mmapfile option, so that the segments are more
    E-cache friendly. I understand E$ is physically mapped and I cannot
    directly influence its behavior by changing virtual addresses but I
    wanna know if its possible to indirectly change E$ behavior by changing
    virtual addresses.. sorry if this explanation is too confusing.)

    Anyways, this is what I do in mdb
    amiga:/tmp> ps -l -p 22029
    F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
    8 S 1014 22029 21910 0 41 20 72f56ef0 113 72f57120 pts/1 0:00
    a.out
    # mdb -k
    Loading modules: [ unix krtld genunix ip nfs ipc ptm logindmux ] 
    0x72f56ef0:
    0x72f56ef0: exec as lockp
    72b78350 70cd7880 7061f140
    0x72f56efc: crlock
    0x72f56efc: owner/waiters
    0
    0x72f56f04: cred swapcnt stat
    705c84e0 0 2
    0x72f56f0d: wcode pidflag wdata
    0 0 0
     
    SEG BASE SIZE DATA OPS
    72d0a660 10000 2000 72d08a50 segvn_ops
    72d05720 20000 2000 72d08bd0 segvn_ops
    72d0bfc0 ff280000 a8000 71a86de0 segvn_ops
    71c0ccc0 ff338000 8000 72b5faa0 segvn_ops
    72d04ca0 ff370000 4000 71a860c0 segvn_ops
    72d04d80 ff390000 2000 73b38390 segvn_ops
    72d04ea0 ff3a0000 2000 71a86ba0 segvn_ops
    72d04b80 ff3b0000 22000 72d08e10 segvn_ops
    71a94760 ff3e2000 2000 72d03020 segvn_ops
    72d0b6c0 ffbee000 2000 71a861b0 segvn_ops 
    0x72d08a50: lock
    0x72d08a50: wwwh
    0
    0x72d08a54: pageprot prot maxprot
    0 015 017
    0x72d08a57: type offset vp
    02 0 72b78350
    0x72d08a64: anon_index amp vpage
    0 0 0
    0x72d08a70: cred swresv advice
    705c84e0 0 0
    0x72d08a79: pageadvice

    0x72b78358: flag refcnt vfsmnt
    1000 3 0
    0x72b78364: op vfsp stream
    tmp_vnodeops 700ad3e0 0
    0x72b78370: pages type rdev
    13353e80 1 ffffffff
    0x72b7837c: data filocks shrlocks
    72b78340 0 0 
    0x13353e80: vnode hash vpnext
    72b78350 12f9ed00 13353e80
    0x13353e8c: vpprev next prev
    13353e80 13353e80 13353e80
    0x13353e98: offset selock lckcnt
    0 0 0
    0x13353ea6: cowcnt cv io_cv
    0 0 0
    0x13353eac: iolock_state fsdata state
    0 0 0 
    virtual 13353e80 mapped to physical 5be25e80


    I would like to know how the base virtual address for text segment
    0x10000 is related to the page virtual address 5be25e80.

    Thanks a bunch!
    chandra


    Darren Dunham wrote:
     


    >
    > The format for -le is fixed, and includes length limits on various
    > columns. The size for ADDR is appropriate for a 32-bit address, but not
    > adequate for all 64-bit addresses.
    >
    > Use a custom format that includes the fields you want and all should be
    > well..
    >
    > $ ps -l -p $$
    > F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
    > 8 S 0 21857 21855 1 51 20 ? 308 ? pts/1 0:00 bash
    > $ ps -o uid,pid,addr -p $$
    > UID PID ADDR
    > 0 21857 30000f9b570
    > $
    >
    >[/ref]

    Chandra Guest

  5. #5

    Default Re: process address in ps -le

    Chandra Garud wrote: 

    [cut]
     

    The kernel allocators do a pretty good job here. You can construct pathalogical
    cases and you can be unlucky, but mostly they spread stuff around the ecache
    well. The choice of which physical page to back a given VA is not
    really influenced by the VA itself. Pages are handed out in such a way
    as to spread physical page "colours" (colors :-) for a given process
    and so for all processes.
     
    > 0x72f56ef0:
    > 0x72f56ef0: exec as lockp
    > 72b78350 70cd7880 7061f140
    > 0x72f56efc: crlock
    > 0x72f56efc: owner/waiters
    > 0
    > 0x72f56f04: cred swapcnt stat
    > 705c84e0 0 2
    > 0x72f56f0d: wcode pidflag wdata
    > 0 0 0

    > SEG BASE SIZE DATA OPS
    > 72d0a660 10000 2000 72d08a50 segvn_ops
    > 72d05720 20000 2000 72d08bd0 segvn_ops
    > 72d0bfc0 ff280000 a8000 71a86de0 segvn_ops
    > 71c0ccc0 ff338000 8000 72b5faa0 segvn_ops
    > 72d04ca0 ff370000 4000 71a860c0 segvn_ops
    > 72d04d80 ff390000 2000 73b38390 segvn_ops
    > 72d04ea0 ff3a0000 2000 71a86ba0 segvn_ops
    > 72d04b80 ff3b0000 22000 72d08e10 segvn_ops
    > 71a94760 ff3e2000 2000 72d03020 segvn_ops
    > 72d0b6c0 ffbee000 2000 71a861b0 segvn_ops 
    > 0x72d08a50: lock
    > 0x72d08a50: wwwh
    > 0
    > 0x72d08a54: pageprot prot maxprot
    > 0 015 017
    > 0x72d08a57: type offset vp
    > 02 0 72b78350
    > 0x72d08a64: anon_index amp vpage
    > 0 0 0
    > 0x72d08a70: cred swresv advice
    > 705c84e0 0 0
    > 0x72d08a79: pageadvice
    > 0 
    > 0x72b78358: flag refcnt vfsmnt
    > 1000 3 0
    > 0x72b78364: op vfsp stream
    > tmp_vnodeops 700ad3e0 0
    > 0x72b78370: pages type rdev
    > 13353e80 1 ffffffff
    > 0x72b7837c: data filocks shrlocks
    > 72b78340 0 0 
    > 0x13353e80: vnode hash vpnext
    > 72b78350 12f9ed00 13353e80
    > 0x13353e8c: vpprev next prev
    > 13353e80 13353e80 13353e80
    > 0x13353e98: offset selock lckcnt
    > 0 0 0
    > 0x13353ea6: cowcnt cv io_cv
    > 0 0 0
    > 0x13353eac: iolock_state fsdata state
    > 0 0 0 
    > virtual 13353e80 mapped to physical 5be25e80[/ref]

    You're going wrong here.13353e80 is the vpprev which is a kernel
    vnode pointer and you're not interested in where it lives in
    physical memory.

    It's much simpler than you're trying above. The mappings of
    a process are identified by virtual address and address space for
    that process (a lot goes on below that but it's not important here).
    From your earlier $<proc we have the address space pointer: 70cd7880
    To see the physical address that VA 0x10000 in address space 70cd7880
    maps to (if any) use 0x10000::vtop -a 0x70cd7880
     

    It's not, as above. You can tell this easily as the VA and PA
    don't have the same page offset. 0x10000 is 8K page aligned,
    5be25e80 is not. Virtual to physical mappings are done at a
    page level and offset within the virtual/physical page is the same.

    Gavin
     
    >> 
    >> 
    >>
    >> The format for -le is fixed, and includes length limits on various
    >> columns. The size for ADDR is appropriate for a 32-bit address, but not
    >> adequate for all 64-bit addresses.
    >>
    >> Use a custom format that includes the fields you want and all should be
    >> well..
    >>
    >> $ ps -l -p $$
    >> F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY
    >> TIME CMD
    >> 8 S 0 21857 21855 1 51 20 ? 308 ? pts/1
    >> 0:00 bash
    >> $ ps -o uid,pid,addr -p $$
    >> UID PID ADDR
    >> 0 21857 30000f9b570
    >> $
    >>
    >>[/ref]
    >[/ref]

    Gavin Guest

Similar Threads

  1. Replies: 0
    Last Post: October 18th, 09:18 PM
  2. Replies: 6
    Last Post: July 11th, 10:38 PM
  3. Replies: 1
    Last Post: February 3rd, 09:30 AM
  4. Find out the process address space
    By For-NG in forum UNIX Programming
    Replies: 13
    Last Post: December 1st, 02:34 AM
  5. copy billing address to delivery address fields
    By khinester in forum Microsoft Access
    Replies: 4
    Last Post: August 4th, 09:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139