1 .\"
   2 .\" This file and its contents are supplied under the terms of the
   3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
   4 .\" You may only use this file in accordance with the terms of version
   5 .\" 1.0 of the CDDL.
   6 .\"
   7 .\" A full copy of the text of the CDDL should have accompanied this
   8 .\" source.  A copy of the CDDL is also available via the Internet at
   9 .\" http://www.illumos.org/license/CDDL.
  10 .\"
  11 .\"
  12 .\" Copyright 2015 Joyent, Inc.
  13 .\"
  14 .Dd May 11, 2016
  15 .Dt POBJNAME 3PROC
  16 .Os
  17 .Sh NAME
  18 .Nm Pobjname ,
  19 .Nm Pobjname_resolved
  20 .Nd turn a virtual address into its mapped object
  21 .Sh LIBRARY
  22 .Lb libproc
  23 .Sh SYNOPSIS
  24 .In libproc.h
  25 .Ft "char *"
  26 .Fo Pobjname
  27 .Fa "struct ps_prochandle *P"
  28 .Fa "uintptr_t addr"
  29 .Fa "char *buffer"
  30 .Fa "size_t bufsize"
  31 .Fc
  32 .Ft char *
  33 .Fo Pobjname_resolved
  34 .Fa "struct ps_prochandle *P"
  35 .Fa "uintptr_t addr"
  36 .Fa "char *buffer"
  37 .Fa "size_t bufsize"
  38 .Fc
  39 .Sh DESCRIPTION
  40 The
  41 .Fn Pobjname
  42 and
  43 .Fn Pobjname_resolved
  44 functions attempt to determine the underlying mapped object that
  45 contains the virtual address
  46 .Fa addr
  47 in the process handle
  48 .Fa P .
  49 .Pp
  50 A program consists of multiple memory mappings.
  51 Some are provided by the system, such as the stack and the heap.
  52 While others are created through explicit calls to
  53 .Xr mmap 2
  54 or brought in by the run-time link-editor due to dependencies
  55 specified in binaries and libraries.
  56 .Pp
  57 If
  58 .Fa addr
  59 is contained in a mapping, then up to
  60 .Fa bufsize
  61 characters, including the null terminator,
  62 of the name of the corresponding object will be written into
  63 .Fa buffer .
  64 The
  65 .Fn Pobjname_resolved
  66 function attempts to resolve the object to a full file system path.
  67 If the full file-system path cannot be determined, then it will fall back
  68 to the name that the run-time link-editor has for that mapping, which is
  69 the behavior of
  70 .Fn Pobjname .
  71 .Sh RETURN VALUES
  72 Upon successful completion, the
  73 .Fn Pobjname
  74 and
  75 .Fn Pobjname_resolved
  76 functions return
  77 .Fa buffer .
  78 Otherwise,
  79 .Dv NULL
  80 is returned to indicate the object name could not be found.
  81 .Sh INTERFACE STABILITY
  82 .Sy Uncommitted
  83 .Sh MT-LEVEL
  84 See
  85 .Sy LOCKING
  86 in
  87 .Xr libproc 3LIB .
  88 .Sh SEE ALSO
  89 .Xr mmap 2 ,
  90 .Xr libproc 3LIB ,
  91 .Xr Pobject_iter 3PROC ,
  92 .Xr proc 4