QNX 4.22 The Secrets of SIN (PRELIMINARY) The focus of this document is to provide a basic understanding of the different outputs displayed by sin, and the possible values for various fields. It is assumed the reader is familar with the architecture of QNX 4.22. The sin command is a very powerful utility. It is used to grab a snapshot of the current state of a QNX 4 node. The information returned is dependant upon the options and/or commands passed to sin. Following, is the useage message from sin: sin [options]... [command] Options: -g groupname Get information on this groupname only. -h Suppress the printing of headers. -l Keep sin vc requests local. -m Get information on current session (me). -n node Get information from this node. -p pid Get information on this process id only. -P program Get information on this program only. -s sid Get information on this session only. -S {bginpstuU} Sort on this format_str letter. -u username Get information on this username only. -U Display userid for sin files. Commands (you may abbreviate to the first 2 characters): args fds freemem info net rtimers tree dir files gdt irqs proxies sessions users env flags gnames memory registers signals vcs family format {fmt} idt names root times versions Note: {fmt} is any combination of the following characters: a..Arguments F..Flags m..Size R..Root u..Eff. UID/GID b..Blocked g..Group n..Name s..Session ID U..Real UID/GID d..Directory i..Process ID P..Mpass S..Signals e..Environment L..Logname p..Priority t..CPU time f..Family M..Magic r..Registers T..File/Start time The options to sin are pretty much self-explanatory and are basically used to select which process you are interested in. This is useful to restrict the output so that there isn't a lot of unnecessary information to wade through. NOTE: some options "don't make sense" when used with certain commands and are simply ignored. SIN FORMAT CHARACTERS a..Arguments The 'a' format character causes an ARGUMENTS heading and the arguments of each process to be displayed. If you do not have appropriate permissions, a 'Not available.' message will be displayed under the ARGUMENTS heading. If the argument list exceeds 512 characters, sin will truncate the list and display a ' ... ' at the end to signify that truncation occurred. b..Blocked The 'b' format character causes two headings to be displayed. STATE is used to display the current state of each process. The second heading, BLK, gives the PID that the process is blocked on (if any). Possible values of STATE are: READY this process is ready (scheduled) to run DEAD this process is unable to run, but still holds resources eg. zombies and Debugger SEND this process has sent a message to another process which hasn't Receive()'d it yet REPLY this process has sent a message to another process which has Receive()'d it, but not Reply()'d to it RECV this process has called Receive() and is waiting for a message HELD this process was signalled with SIGHOLD and will not become READY until it is signaled with SIGCONT WAIT this process is wait()'ing for a death status of a child or waiting for a timer to expire (eg. sleep()'ing) SIGBL this process has sent a system signal message (because it was signalled while REPLY blocked on a process which has the _PPF_SIGCATCH process flag set) which hasn't been Receive()'d yet. SEM this process is waiting to procure a semaphore d..Directory The 'd' format character causes a CURRENT DIRECTORY heading and each process's $PWD environment variable to be displayed. A 'Not available' message is displayed if you do not have appropriate permissions. e..Environment The 'e' format character causes an ENVIRONMENT heading and each process's environment to be displayed. If you do not have appropriate permissions, a 'Not available.' message will be displayed under the ENVIRONMENT heading. If the environment list exceeds 512 characters, sin will truncate the list and display a ' ... ' at the end to signify that truncation occurred. f..Family The 'f' format character causes a DAD, SON and BRO heading and each process's parent PID, a child PID, and another PID which has the same parent PID, respectively, to be displayed. F..Flags The 'F' format character causes a FLAGS heading and each process's process flags to be displayed. The following flags are currently defined: (see qnx_pflags() for more information) -------------------------------- fSZHTLE mMVXF3 + DSmcsfr FiI ||||||| |||||| | ||||||| ||| ||||||| |||||| | ||||||| ||+-I Immortal ||||||| |||||| | ||||||| |+--i Informed ||||||| |||||| | ||||||| +---F Fixed segments ||||||| |||||| | ||||||+-----r Priority receive ||||||| |||||| | |||||+------f Priority float ||||||| |||||| | ||||+-------s SIGCHLD ignored ||||||| |||||| | |||+--------c Sigcatch ||||||| |||||| | ||+---------m Sig mask all ||||||| |||||| | |+----------S Server ||||||| |||||| | +-----------D Rdos ||||||| |||||| | (READ ONLY FLAGS) ||||||| |||||| | || ||||||| |||||| | \/ ||||||| |||||| +----------------+ Was 32 bit ||||||| |||||+------------------3 32 bit ||||||| ||||+-------------------F Flat model ||||||| |||+--------------------X Execute in place (Xipfsys) ||||||| ||+---------------------V Virtual circuit ||||||| |+----------------------M Proxy ||||||| +-----------------------m Remote Proxy ||||||+-------------------------E Exec'ing (transforming) |||||+--------------------------L Loading ||||+---------------------------T Terminating (or zombie) |||+----------------------------H Held (or to be held) ||+-----------------------------Z No-Zombie |+------------------------------S Session leader +-------------------------------f Forked g..Group The 'g' format character causes a PGRP heading and each process' group id (GID) number to be displayed. i..Process ID The 'i' format character causes a PID heading and each process' id number to be displayed. L..Logname The 'L' format character causes a USER NAME heading and the user that started the process for each process to be displayed. M..Magic The 'M' format character causes a MAGIC heading and the magic data selector and offset of each process to be displayed. Because you should not access the magic data area directly, knowing where it is is not too useful ;-) m..Size The 'm' format character causes a CODE and DATA heading and the size of each processes' code and data memory spaces to be displayed. The method sin uses to calculate these values was changed, and may change again. Currently, sin tries to determine the amount of memory unique to/or really used by each process. Overlayed and mapped (32bit only) memory just gives access to 'other' memory regions, and are not accounted for. Shared DATA is accounted for in the process which owns the segment, not a process which copies the selector. NOTE: A CODE size of 0 indicates that this process is 16 bit and is sharing its CODE with another instance of the same process (eg. ksh). The first instance of this process will have the full CODE size allocated to it. With 32 bit processes, code sharing causes CODE to become: (total code size) / (number of instances). n..Name The 'n' format character causes a PROGRAM heading and the name of each process to be displayed. Sin formats the PROGRAM field to 23 characters. If the name is longer, the node prefix and as much of the basename as possible will be displayed. A '*' indicates that (middle) truncation occurred. eg. //node/dir1/dir2/dir3/name ->> //node/*/dir3/name NOTE: a name of '(zombie)' indicates this process has terminated and its parent hasn't wait()'d for its exit status yet. P..Mpass The 'P' format character causes the MPID MSEL and MFLG headings and the segment arming information of each process to be displayed. These headings directly map into the parameters to the qnx_segment_arm() library routine. eg. qnx_segment_arm( MPID, MSEL, MFLG) p..Priority The 'p' format character causes a PRI heading and the priority and scheduling algorithm of each process to be displayed. The scheduling algorithm is represented by the following 3 characters: r -> round robin f -> fifo o -> other (adaptive) r..Registers The 'r' format character causes each processes Intel registers to be displayed. For 32 bit processes, a second line of output is needed to display the most-significant part of each register. R..Root The 'R' format character causes a ROOT heading and each process' root prefix to be displayed. Usually, this is simply the node id. s..Session ID The 's' format character causes a SID heading and each process' session id to be displayed. S..Signals The 'S' format character causes the following headings to be displayed: SIG IGN: signals which are set to be handled by SIG_IGN SIG MASK: signals which are currently masked (blocked) SIG PEND: signals which are pending SEG:OFF : segment:offset of the signal table NOTE: there are 32 signals. Each signal is represented as a bit within the 4 byte field, with signal 1 being the LSB. eg. signals 1 and 5 would be represented by: (0x)00000011 NOTE: the signal table consists of 2 unsigned's followed by 32 struct _sigaction structures (1 for each signal). t..CPU time The 't' format character causes the following headings to be displayed: START TIME: date/time when this process was started UTIME (user): amount of CPU seconds this process has consumed STIME (system): amount of CPU seconds the system has consumed on behalf of this process (eg. Proc) CUTIME (child user): amount of CPU seconds children of this process have consumed. CSTIME (child system): amount of CPU seconds the system has consumed on behalf of the children of this process. NOTE: Children times are added to CUTIME and CSTIME only after they terminate. T..File/Start The 'T' format character causes a FILE TIME and a START TIME time heading to be displayed. FILE TIME is the time stamp on the process' executable file (ls -l file) and START TIME is the date/time when this process was started. u..Eff. UID/GID The 'u' format character causes an EUID and an EGID heading to be displayed. EUID is the effective user id and EGID is the effective group id of each process. U..Real UID/GID The 'U' format character causes a RUID and a RGID heading to be displayed. RUID is the real user id and RGID is the real group id of each process. SIN COMMANDS none (default) Equivalent to 'sin fo sinpbm' args Equivalent to 'sin fo iLa' dir Equivalent to 'sin fo iLnd' env Equivalent to 'sin fo iLne' family Equivalent to 'sin fo snpbif' fds The 'fds' command is useful for displaying which files and devices a process has open. These are displayed under the process name and PID, 2 per line. The format for each fd is: 'fd number' - 'file path'. If the fd number has an adjacent 'C' the _FD_CLOSE_ON_EXEC flag is set for that fd. Sin determines the file path by using the dev_fdinfo() library routine first. If this call succeeds, the returned device path is used. If the path is not set, the returned device type is used and is displayed inside brackets (eg. [con]). If the call to dev_fdinfo() fails, fsys_fdinfo() is called. If this call succeeds, the returned file path is used. If the fsys_fdinfo() call fails, the PID of the fd's manager is displayed inside parentheses (as a last resort). NOTE: a 'file path' of "unknown" is caused by a failure to establish a vc to a remote manager. NOTE: a 'file path' of "unlinked" indicates the file has been removed (unlinked) but this process still holds it open. NOTE: a 'file path' of "pipe" indicates the file is really an end of a pipeline. NOTE: a 'file path' of something similar to "[@1234567]" indicates the file is really a socket (Socket manager). files The 'files' command displays the following headings: PROGRAM: the process name PID: the process id number FD: the file descriptor number MODE: the open mode flags of the file POSITION: the current position / size of the file FILE: the fullpath of the file The following mode flags are displayed if set: ------ EFDAWR |||||| |||||+-R Read ||||+--W Write |||+---A Append ||+----D Data Sync |+-----F File Sync +------E Exclusive flags Equivalent to 'sin fo sinbF' freemem The 'freemem' command simply prints out each contiguous block of free memory. gdt The 'gdt' command walks down the Global Descriptor Table and displays each entry. This information is very Intel specific and is beyond the scope of this document. gnames The 'gnames' command displays all the registered global names and the node on which they were registered from. This information is returned from a nameloc process running on the network. idt The 'idt' command walks down the Interrupt Descriptor Table and displays each entry. Similar to the 'gdt' command, this information is very Intel specific and is beyond the scope of this document. info The 'info' command displays information about a node's hardware and configuration. The following headings are displayed: NODE: logical node number CPU: type of cpu/fpu MACHINE: type of machine (AT, PS/2, PCI) SPEED: a benchmark result performed at boot up MEMORY: available / total memory TICKSIZE: current ticksize DISPLAY: type of monitor (None, Monochrome, CGA, EGA Color, EGA Mono, PGS, VGA Mono, VGA Color, PS/2 30 Mono, PS/2 30 Color) FLAGS: the following system flags: ---------------- D3P AEE8P ||| ||||| ||| ||||+-P Protected ||| |||+--8 NDP installed ||| ||+---E Emu16 installed ||| |+----E Emu32 installed ||| +-----A APM installed ||+--------------P PCI Bios |+---------------3 32-bit OS +----------------D Memory reserved for Rundos HEAPP: Proc's free heap space HEAPF: Proc's free file descriptor heap space HEAPL: Proc's free LDT/GDT heap space HANDS: maximum number of interrupt handlers NAMES: maximum number of names (local and global) SESSIONS: maximum number of sessions PROCS: maximum number of processes TIMERS: maximum number of timers NODES: number of QNX licenses BOOT: date and origin of boot (a '*' indicates alternate boot) irqs The 'irqs' command displays which interrupts are in use and by which processes. The following headings are displayed: IRQ: the hardware interrupt ( -1 means special 50msec timer ) PID: the process which attached the interrupt handler to the IRQ PROGRAM: the name of the process which attached the interrupt handler to the IRQ CS:IP: the selector:offset of the interrupt handler DS: the data selector used by the interrupt handler memory The 'memory' command displays each process' selectors 2 per line. The format is seletor, address, limit and flags. The following flags are displayed: --------------- LBS3+++GA+PMDCO ||||||||||||||| ||||||||||||||+-O Data read only |||||||||||||+--C Code readable/executable ||||||||||||+---D DMA safe, will not cross 64k segment boundary |||||||||||+----M Process can modify access rights ||||||||||+-----P Huge segment, next segment continues this one |||||||||+------+ Global segment and is owned by this process ||||||||+-------A Align segment on a GET/PUT operation |||||||+--------G Global segment, is in GDT ||||||+---------+ Disable caching if possible |||||+----------+ Allow DMA requests above 16Meg ||||+-----------+ Segment is a link to an existing segment |||+------------3 Segment is code/stack segment in 32 bit mode ||+-------------S Shared, more than one process owns this segment |+--------------B Borrowed, segment was taken from the free list +---------------L Process is loading into this segment NOTE: If both 'Data read only' (O) and 'Code readable/executable' (C) then this is really 'Code execute only'(CO). NOTE: If neither 'Data read only' (-) nor 'Code readable/executable' (-) then this is really 'Data readable/writable'. names The 'names' command displays all names registered on the node, as well as the PID and program name of the process which registered the name. These include not just local names, but also the global names registered on this node. net The 'net' command displays information about each node on the network (that can be reached). The following headings are displayed: NID: logical node id MACHINE: type of machine (AT, PS/2, PCI) CPU: type of cpu FPU: type of fpu SPEED: a benchmark result performed at boot up MEMORY: total memory DISK: the size of /dev/hd0 + /dev/hd1 + /dev/hd6 (?) FLOPPY: the size of /dev/fd0 DISPLAY: type of monitor (None, Monochrome, CGA, EGA Color, EGA Mono, PGS, VGA Mono, VGA Color, PS/2 30 Mono, PS/2 30 Color) FLAGS: system flags (see the 'info' command) SPEED, MEMORY, and DISK values are totaled for the network and are displayed on the last line of output. proxies The 'proxies' command displays the following headings: PROXY: the proxy id (PID of the proxy) PROGRAM: the process name which owns the proxy PRI: the priority of the proxy STATE: the state of the proxy (READY or SEND) COUNT: the pending amount of triggers NOTE: a proxy becomes SEND blocked when the COUNT becomes greater than 0, and the owning process hasn't Receive()'d the proxy message yet. registers Equivalent to 'sin fo ir'. root Equivalent to 'sin fo iLnR'. rtimers The 'rtimers' command displays information about the real-time timers. The following headings are displayed: ID: the timer id PID: the PID of the process which owns the timer PROGRAM: the name of the process which owns the timer ACTION: the 'purpose' of the timer (what it does when expired): sleep: process is blocked until timer expires proxy PID: the proxy PID will be triggered signal SIG: the SIG signal will be raised on the process TRIGGER: the seconds before the timer expires REPEAT: the seconds between each TRIGGER sessions The 'sessions' commands displays information about the current sessions. The following headings are displayed: SID: the session id USERID: the user which owns the session DEVICE: the controlling terminal of the session PID: the PID of the session leader MEMBERS: the number of processes in the session signals Equivalent to 'sin fo sinpS'. times Equivalent to 'sin fo sinpt'. tree The 'tree' command displays a 'family tree' of the processes. Children are shown to the right of their parents. Siblings are shown vertically (all connected to each other and their parent). users Equivalent to 'sin fo signUu'. vcs The 'vcs' command displays information about the virtual circuits (vc) of a node. Each vc has 2 ends, LOCAL and REMOTE. Under the LOCAL heading, the following headings are displayed: VID: the vc id PID: the process which owns the VID LK: the link count (when a PID has multiple open fds to the same remote manager, the vc is shared - instead of a vc for each fd) STATE: state/sub-state of this vc end. Possible values are: READY/1: idle or txing reply REPLY/2: initializing vc REPLY/3: initializing existing vc for sharing REPLY/4: growing on send, blocked on local Proc REPLY/5: growing on send, blocked on Net REPLY/6: sending, blocked on network REPLY/7: growing on reply, blocked on local Proc REPLY/8: growing on reply, blocked on Net REPLY/9: growing on writemsg, blocked on local Proc PROGRAM: the name of the process which owns the VID Under the REMOTE heading, the following headings are displayed: NID: the node id of the remote end of the vc VID: the vc id on the remote node ( NID side ) PID: the process which owns the VID on NID PROGRAM: the name of the process which owns the VID on NID versions The 'versions' command displays the version and date of each server process (process flag _PPF_SERVER set). This information is returned from a system version message sent to each server process. toomuch The 'toomuch' command cannot be abbreviated to the first 2 letters. It is an undocumented command and is equivalent to 'sin ....'