Unix & Linux Asked on February 18, 2021
Usually I look this file in Linux using string -a
command to see this file.
Has AIX something like that? I didn’t find anything in /proc/pid_process
I use this file to know what environment variables some process is seeing.
for example, I have an Oracle Database installed on the server. If I’d like to know what environment variable pmon
process is seeing, I can find the process:
[root@oracle-database 1664]# ps aux|grep pmon|grep -v grep
oracle 8897 0.0 0.5 1133456 5312 ? Ss Nov27 0:18 ora_pmon_idbcloud
[root@oracle-database 1664]#
And look the file /proc/process_pid/environ
[root@oracle-database 1664]# strings -a /proc/8897/environ
XDG_SESSION_ID=4689
HOSTNAME=oracle-database
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
USER=oracle
ORACLE_SID=idbcloud
ORACLE_BASE=/u01/app/oracle
MAIL=/var/spool/mail/oracle
PATH=
PWD=/u01
LANG=en_US.UTF-8
HISTCONTROL=ignoredups
SHLVL=1
HOME=/home/oracle
LOGNAME=oracle
LESSOPEN=||/usr/bin/lesspipe.sh %s
ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
NLS_DATE_FORMAT=DD/MM/YYYY HH24:MI:SS
_=/bin/rlwrap
OLDPWD=/u01
ORA_NET2_DESC=9,12
SKGP_SPAWN_DIAG_POST_FORK_TS=1606503159
SKGP_HIDDEN_ARGS=<FATAL/S/PMON/x0/x1/x0/x5AF86E15/8888/8888/x0/x2/x1/x5AF86E38/1606503159/1606503159/196609/0/(nil)>
SKGP_SPAWN_DIAG_PRE_FORK_TS=1606503159
SKGP_SPAWN_DIAG_PRE_EXEC_TS=1606503159
ORACLE_SPAWNED_PROCESS=1
RDMAV_FORK_SAFE=1
RDMAV_HUGEPAGES_SAFE=1
As Thomas said, there is no file in an AIX system, but the ps
command does let you "know what environment variables some process is seeing"
e
Displays the environment as well as the parameters to the command, up to a limit of 80 characters.
ew
Wraps the display from the e flag one extra line.
eww
Wraps the display from the e flag and displays the ENV list until the flag reaches the LINE_MAX value.
ewww
Wraps the display from the e flag and displays the ENV list until the flag reaches the INT_MAX value.
For example:
$ ps ewww 1835516
PID TTY STAT TIME COMMAND
1835516 - A 7:02 /usr/sbin/syncd 60 _=/usr/bin/nohup LANG=C PATH=/usr/sbin:/etc:/usr/bin LC__FASTMSG=true ODMDIR=/etc/objrepos HOME=/ PWD=/ CFGLOG=default NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat LIBPATH=/usr/lib:/lib
Correct answer by Jeff Schaller on February 18, 2021
AIX does not provide the same style of pseudo-filesystem for /proc
as Linux does. Referring to the manual pages:
/proc
file (AIX)the latter documents a pseudo-file dedicated to environment:
/proc/[pid]/environ
This file contains the initial environment that was set when
the currently executing program was started via execve(2).
while the former describes a file containing process information
psinfo
Contains information about the process needed by the ps command. If the process contains more than one thread, a representative thread is used to derive the lwpsinfo information. The file is formatted as astruct psinfo
type and contains the following members:
In particular:
prptr64_t pr_envp; /* address of initial environment vector in user process */
While it is possible to write a script which reads that data structure, you will not do it with just grep
or strings
: that address would be used in accessing the memory image file:
as
Contains the address space image of the process. The as file can be opened for both reading and writing. Thelseek
subroutine is used to position the file at the virtual address of interest. Afterwards, you can view and modify the address space with the read and write subroutines, respectively.
Answered by Thomas Dickey on February 18, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP