Some Commands ......answers...questions

(1) Any alternative to pstack ?
Yes,one such tool available in solaris(after 7+) ,adb .
This is actually kerner debugging tool .
# adb [binaryfile] [core]
core file = core -- program ``binaryfile'' on -->-- platform SUNW,Ultra-250
SIGSEGV: Segmentation Fault
$c
.
.
.
.
^D
#
Note that the command to get the backtrace is $c - dollar sign followed by c.

U can get some more advanced concepts abt/mdb core analysys at Solaris Modular Debugger Guide
http://docsun.cites.uiuc.edu/sun_docs/C/solaris_9/SUNWdev/MODDEBUG/toc.html
Complete usage of this tool can be found at mdb and adb on a Live System http://www.princeton.edu/~unix/Solaris/troubleshoot/adb.html

(2)How do I eliminate carriage returns ( ^M) in my files?

Use ' dos2unix filename' commnd an get Unix(Solaris) version file.


Or u can ago for manual try,

If you transfer text files from a DOS machine to a UNIX machine, you might see a ^M before the end of each line. This character corresponds to a carriage return. In DOS a newline is represented by the character sequence \r\n, where \r is the carriage return and \n newline. In UNIX a newline is represented by \n. When text files created on a DOS system are viewed on UNIX, the \r is displayed as ^M.You can strip these carriage returns out by using the tr command as follows:
tr -d '\015' <> newfile

Here file is the name of the file that contains the carriage returns, and newfile is the name you want to give the file after the carriage returns have been deleted. Here you are using the octal representation \015 for carriage return, because the escape sequence \r will not be correctly interpreted by all versions of tr.

(3) i want to find the files which are modified after certain date/days
use the command
find . -ctime -11 -print|grep .cc which will give the files which are modified last 11 days and filenames which are terminated with .cc extension.
And Detailed description about Selecting files using their age can find under softpanorama at (http://www.softpanorama.org/Tools/Find/find_mini_tutorial.shtml#Selecting_files_using_their_age)

(4)How do we find out what port is being used by what application ?
lsof -i | grep -i listen :should get what we are looking for. we may also grep for a pid or port number too if we are looking for something specific.
lsof -i | grep -i listen |grep portnumber

And General theory about Port number existence/availability...........
There are 3 types of ports available ,and are Well-known ports, the Registered Ports, and the Dynamic and/or Private Ports.
The Well Known Ports are those from 0 through 1023.Well Known ports SHOULD NOT be used without IANA registration.

The Registered Ports are those from 1024 through 49151 and these ports SHOULD NOT be used without IANA registration.

The Dynamic and/or Private Ports are those from 49152 through 65535 .

(Detailed usage of port numbers listed at iana[internet assigned numbers authority] website.
http://www.iana.org/assignments/port-numbers)


Common port numbers for a Solaris server.
Service PortNumber TCP/UDP
echo 7 tcp/udp
ftp-data 20 tcp
ftp 21 tcp
telnet 23 tcp
smtp 25 tcp
time 37 tcp/udp
name 42 udp
tftp 69 udp
pop3 110 tcp
nntp 119 tcp
ntp 123 tcp/udp
nfsd 2049 tcp/udp
lockd 4045 tcp/udp

(5)the maximum length of a command which is stored in the process control block structure
on solaris


In Solaris, I believe the length of argument list that the kernel stores is 80 characters. (PRARGSZ is defined as 80 in /usr/include/sys/procfs.h.) I believe that 80 characters includes the null terminator for the string.

..., when a command is executed (i.e. when exec() is called), a truncated version of the argument list is copied into kernel data structures. It's probably limited to 80 characters to make it easier to manage and to avoid wasting space.

(6) How to make a specified process (or executable) use only one CPU. It does not have to be a *specific* CPU, I just want to make sure it will never run on more than one CPU.

Yes pbind command let u to do so.
    pbind -b processor_id pid [/lwpid]...
    pbind [-q] [pid [/lwpid]]...
    pbind -Q [processor_id]...
    pbind -u pid [/lwpid]...
    pbind -U [processor_id]...

-b processor_id Binds all or a subset of the LWPs of the specified processes to the processor processor_id. Specify processor_id as the processor ID of the processor to be controlled or queried. processor_id must be present and on-line. Use the psrinfo command to determine whether or not processor_id is present and on-line.
-q Displays the bindings of the specified processes or of all processes. If a process is composed of multiple LWPs which have different bindings and the LWPs are not explicitly specified, the bindings of only one of the bound LWPs will be displayed. The bindings of a subset of LWPs can be displayed by appending “/lwpids” to the process IDs. Multiple LWPs may be selected using “-” and “,” delimiters. See EXAMPLES.
-Q Displays the LWPs bound to the specified list of processors, or all LWPs with processor bindings. For processes composed of multiple LWPs, the bindings of individual LWPs will be displayed.
-u Removes the bindings of all or a subset of the LWPs of the specified processes, allowing them to be executed on any on-line processor.
-U Removes the bindings of all LWPs bound to the specified list of processors, or to any processor if no argument is specifie





No comments :

Post a Comment