- definisce un array set -A Week Sat Sun Mon Tue Wed Thu Fri - ritorna un elemento dell'array echo ${Week[3]} .. Tue id=3 ; echo ${Week[id]} .. Tue - stampa tutti gli elemti di un array echo ${Week[@]} .. Sat Sun Mon Tue Wed Thu Fri - scandisce un array for day in ${Week[@]} do echo $day done - ritorna il numero di elementi in un array nelem=${#Week[@]} ; echo $nelem .. 7
Tuesday, July 19, 2011
ARRAY
REGULAR EXPRESSION
- ritorna la prima lettera dopo il segno - all'inizio di una stringa VAR="-ciao" RESULT=`expr "$VAR" : "-\(.\)"` echo $RESULT .. -c - toglie il '-' iniziale VAR="-ciao" VAR=`expr "$VAR" : "-*\(.*\)"` echo $VAR .. ciao - ritorna la lunghezza di una stringa VAR="ciao" echo `expr length $SHELL` .. 4 - ritorna l'indice di dove incontra una substringa echo `expr index abcdef de` .. 4 - ritorna 6 caratteri a partire dall'11 expr substr "Goodnight Ladies" 11 6 .. Ladies
EXAMPLES
- Explode a command for use parameters counter set `who -r` ; [ "$8" != "0" ] && exit - declare a variable for only uppercase/lovercase chars typeset -u VAR ; VAR="lower" ; echo $VAR -> LOWER typeset -l VAR ; VAR="UPPER" ; echo $VAR -> upper - exec - eval - esegue il comando dato come argomento - let - esegue le operazioni matematiche che passate come argomento let "x = x * 5" ((x = x * 5)) .. altra forma di let
COPROCESS
La ksh permette di lanciare uno o piu' comandi come processi in background. Questi processi sono chiamati coprocesses e sono utilizzati per comunicare con un programma. Un coprocess si crea mettendo l'operatore |& (pipe, ampersand) dopo un commando. Entrambi stdin e stdout del commando sono piped verso il tuo script. Un coprocess deve incontrare le seguenti restrizioni: · Includi un new-line alla fine di ogni messaggio · Manda ogni messaggio di output allo standard output · Pulisce il suo stdout dopo ogni messaggio L' esempio dimostra come l'input e' passato verso e ritornato da un coprocess: echo "Initial process" ./FileB.sh |& read -p a b c d echo "Read from coprocess: $a $b $c $d" print -p "Passed to the coprocess" read -p a b c d echo "Passed back from coprocess: $a $b $c $d" FileB.sh echo "The coprocess is running" read a b c d echo $a $b $c $d L'output risultante e' il seguente: Initial process Read from coprocess: The coprocess is running Passed back from coprocess: Passed to the coprocess Il comando 'print -p' ti permette discrivere verso il coprocess. Per leggere dal coprocess, lancia il comando 'read -p'.
OTHER FUNCTIONALITIES
cmd1 || cmd2 exec cmd2 if cmd1 fail cmd1 && cmd2 exec cmd2 if cmd1 is OK V1=${V2:=V3} Set V1 with the value of V2 if this is set else set the variable V1 with value of V3 (V3 could be a number). sh replacement: if [ $V2 ] ; then V1=$V2 else V1=$V3 Example: DisplaySize=${LINES:24} ; Command=${Command:"cat"} ${V1:?word} if V1 set & V1!=null ret $V1 else print word and exit : ${V1:?"variable V1 not set on null"} ${V1:=word} if V1 !set | V1==null set V1=$word ${V1:-word} if V1 set & V1!=null ret $V1 else ret word ${V1:+word} if V1 set & V1!=null ret word else ret nothing ${V1##patt} ${V1#patt} if patt are found at the begin of V1 return V1 whitout the patt else return V1 V1="lspwd" ; ${V1#"ls"} # exec pwd ${V1%%patt} ${V1%patt} if patt are found at the end of V1 return V1 whitout the patt else return V1 V1="lspwd" ; ${V1%"pwd"} # exec ls
REDIRECTIONS
0 stdin 1 stdout 2 stderr <&- close stdin >&- close stdout <>filename open filename for read-write 2>&1 open 2 for write and dup as 1 Examples: cmd 2>/dev/null cmd >/dev/null 2>&1 exec 1<&- # close descriptor 1 exec 2<&- # close descriptor 2 exec 1< /dev/null # open descriptor 1 exec 2< /dev/null # open descriptor 2
POSITIONAL PARAMETER
program, function or shell $0 argument 1 through 9 $1 .. $9 nth argument ${n} number of positional parameters $# every positional parameter $@, $* decimal value returned by last executed cmd $? pid of shell $$ pid of last backgrounded command $!
Format of flow control functions
"if-then" if _expr_ then _cmd(s)_ elif _expr_ _cmd(s)_ else _cmd(s)_ fi "case" case _word_ in _pattern1_) _cmd(s)_ _pattern2_) _cmd(s)_ *) break ;; esac "while" while _expr_ do _cmd(s)_ done "for" for _variable_ in _list_ _cmd(s)_ done "until" until _expr_ do _cmd(s)_ done
Test Objects (Files, Directories, etc.)
test "true" if: ksh ----------------------------------- object exist -a readable -r writable -w executable -x non-zero length -s zero length directory -d plain file -f symbolic link -h named pipe -p block special file -b character special file -c soft link -L socket -S owned by me -O owned by my group not "sticky" bit set -k set-group-ID bit set -g set-user-id bit set -u opened on a terminal not
Matching Patterns
pattern: example: matches: not matched: ------------------------------------------------------------------ * boo* boot,boo,booth ? boo? boot booth [...] [aeiou]* ark bark [!...] boo[!st] boor boot *(cc|cc) boo*(ze|r) boo,boor,booze,boozer boot +(cc|cc) boo+(ze|r) boor,booze,boozer boo ?(cc|cc) boo?(ze|r) boo,boor,booze boozer @(cc|cc) boo@(ze|r) booze,booth boo !(cc|cc) boo!(ze|r) booth,boo,boot booze,boor {c,c,c} a{b,c,d}e abe,ace,ade axe
Conditional Statements
format "true" if: --------------------------------------------------- (( _num1_ == _num2_ )) numbers equal (( _num1_ != _num2_ )) numbers not equal (( _num1_ < _num2_ )) num1 < num2 (( _num1_ > _num2_ )) num1 > num2 (( _num1_ <= _num2_ )) num1 <= num2 (( _num1_ >= _num2_ )) num1 >= num2 [[ _str1_ == _str2_ ]] strings equal [[ _str1_ != _str2_ ]] strings not equal [[ _str1_ < _str2_ ]] str1 precedes str2 [[ _str1_ > _str2_ ]] str1 follow str2 [[ _str1_ = _pattern_ ]] str1 = pattern [[ _str1_ != _pattern_ ]] str1 != pattern [[ -z _str_ ]] str is null [[ -n _str_ ]] str is not null [ x=y -o k=j ] or in expression [ x=y -a k=j ] and in expression
${node##+(:alnum:?)} explanation
${...} | parameter expansion |
${parameter##pattern} | If pattern matches the beginning of the value of parameter name, the matched text is deleted from the result of sub- stitution. A single # results in the shortest match, two # results in the longest match. |
+(pattern) | matches any string of characters that matches one or more occurances of the specified pattern. |
:alnum: | same as [a-zA-Z0-9] |
JGUI node icons
Started node
- LOGICAL_NODE:C72:C7:SS7
Icon is red (inactive) - LOGICAL_NODE_STATUS:C72:a
Icon is orange (loading) - LOGICAL_NODE_STATUS:C72:a
Icon is green (active)
Stopped node
Before FR598
- LOGICAL_NODE:C72:C7:SS7
Icon is red (inactive) - LOGICAL_NODE_STATUS:C72:i
Icon stays red (inactive) - LOGICAL_NODE_STATUS:C72:a
Icon is orange (loading)
After FR598
- LOGICAL_NODE:C72:C7:SS7
Icon is red (inactive) - LOGICAL_NODE_STATUS:C72:i
Icon stays red (inactive) - LOGICAL_NODE_STATUS:C72:a
Icon is green (active)
telnet localhost sw_gui not working on suse
gallinar@liasse> telnet localhost sw_gui
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying ::1...
telnet: connect to address ::1: Connection refused
root@liasse> chkconfig --list
should show
xinetd based services:
...
sw_gui: on
If not, then /etc/xinet.d/sw_gui is missing.
root@liasse> cat /etc/xinetd.d/sw_gui
### Signalware Java GUI Server.
service sw_gui
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
groups = yes
server = /export/home/omni_9S6/bin/start_jguiserver
server_args = start_jguiserver
log_on_failure += USERID
}
Once created, re-start xinetd:
root@liasse> /etc/init.d/xinetd restart
JAVA decompiler: jreversepro
find com -name *.class | while read x; do java=$(echo $x | cut -d. -f1); /u/gallinar/downloaded/jreversepro/jreversepro-1.4.1/bin/jrevpro -dc $x > $java.java; done
Override Del key action in JTable
/**
* This method aims at capturing the DELETE key stroke so as to remove
* the corresponding selected row in the table.
*/
private void doDelAction() {
final KeyStroke delStroke = KeyStroke.getKeyStroke("DELETE");
Action newDelAction =
new AbstractAction("") {
public void actionPerformed(ActionEvent e) {
final int selectedRow =
JguiEditList.this.table.getSelectedRow();
// If a row is selected.
if ((-1 != selectedRow) &&
(JguiEditList.this.table.getRowCount() - 1 !=
selectedRow)) {
JguiEditList.this.model.removeRow(selectedRow);
JguiEditList.this.table.setRowSelectionInterval(
selectedRow, selectedRow);
}
}
};
this.table.getInputMap(JComponent.WHEN_FOCUSED).put(delStroke,
"EmptyRowAction");
this.table.getActionMap().put("EmptyRowAction", newDelAction);
}
Recording events
Recording events in a suitable format will be supported in a later version of this product, once the replay side has stabilised. In the meantime, you can get event information in an undocumented way.
The Java home directory has a subdirectory lib containing a file awt.properties. If you add the line
AWT.EventQueueClass=jnewmarch.replay.TracedEventQueue
to this, then all events that enter the event queue will be printed to standard output.
Debugging java application
Add
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
on the java command line, and attach to address 800 with a debugger like JDebugTool
Print Input Stream line by line
BufferedReader in =
new BufferedReader(new InputStreamReader(is));
String line = null;
while((line = in.readLine()) != null) {
System.out.println(line);
}
Install Instiki service
cygrunsrv -I Instiki -p "/usr/bin/ruby" -a "/usr/share/instiki/instiki" -c /usr/share/instiki/" -u gallinar -w gallinar698
Start instiki on cygwin
cd /usr/share/instiki
export PATH=./lib/native/i386-cygwin:$PATH
instiki -b localhost -p 2501
Install Instiki on cygwin
Get sqlite sources.
Compile it as said in README.
To generate the shared library explicitly, we need to do:
make sqlite3.dll
Then, install the library:
mkdir /path/to/instiki/lib/native/i386-cygwin
cp sqlite3.dll /path/to/instiki/lib/native/i386-cygwin/
Update /path/to/instiki/vendor/sqlite3-ruby/sqlite3/driver/dl/api.rb to add:
when /i386-cygwin/
"sqlite3.dll"
where the sqlite library is dynamically loaded.
Leave swsetup after install
6 -override
F11
8 (or 9 depending on version)
n
Signalware packages in the US
Target a machine (rlogin walter), then goto that machine and cd like:
cd /net/nebo/export/homea/package/K269.02/ecn9V4M_drop2
Know the Linux version installed
cat /etc/issue
or
lsb_release -a
No more /u/release on thales
Goto basin (does not accept login), e.g.:
cd /net/basin/release/signalware/9.02SP4
See version of Solaris package
[root@julienas] 0 > pkgparam -d . OMNI-A3ME VERSION
SUS-9.02SP5EECNN.OMNIA3ME.ECN9Z5N
Disable ECN check when installing
...
Then, if I try a pkgadd with the new A3ME on top of 9S5K + 9Z5N, I get:
INSTALL ERROR: This core OMNI-A3ME Signalware packages requires Service Pack 5 ECN Base package S5N or later installed in this instance.
Solution: in /etc/swinstall/dat/swadmin:
ECNCHECK=DISABLED
Install 9S60 drop20 after drop 18 on Solaris
- Uninstall last ECN via swetup
- pkgrm S60UTIL-9
- rm /opt/UPDATE/APPLY-S60UTIL.9
- cd /u/integration/solaris/Sol9/ECN9S60_drop20/tools
- pkgadd -d .
- cd ..
- ./swsetup
Including CSS for IE
<style type="text/css">
@import url(scrolling_table.css);
</style>
<!--[if IE]>
<style type="text/css">
@import url(scrolling_table.ie.css);
</style>
<![endif]-->
FTP script example
ftp -inv raki <<FINLE
user gallinar gallinar
prompt
type binary
lcd /tmp/jg
cd /u/gallinar
hash
get jguiserver
bye
FINLE
chmod a+x jguiserver
SNMP FAQ
Q. Why using a named pipe?
A. Because the healthcheck socket port has to be known by both the SNMP agent and WATCH, and this way this is transparent for the user (otherwise configureSnmp would have needed to be updated to ask (still) another port to the user, which was not a good solution).
Q. Why a double (named pipe / socket) mechanism to exchange information with the agent?
A. The named pipe / socket pair has been used because a full duplex named pipe (which would have seemed a simple solution) is not possible due to blocking issues in java.
Q. Does it perturb the SNMP agent classical queries?
A. Tests have shown that the additional 1 ms. timeout per query in the agent is not perceptible by the user.
Q. Why does the SNMP agent re-transmit the healthcheck socket port every (WATCH health cycle – 1) requests?
A. If WATCH ever crashes, and the SNMP agent would never re-transmit the port, the health check of the SNMP agent would never be able again.
(WATCH health cycle – 1) is used because it allows re-establishing the connection just below the health cycle allowance of WATCH.
Q. If WATCH cannot read (for any reason) from the named pipe every time the SNMP agent writes into it, what about the information stored in the pipe (garbage)?
A. When WATCH reads from the named pipe, it reads all the information available from it. It the SNMP agent has written multiple times, then this information won’t be usable, correct. But next time the SNMP agent will write into it, the port information will be clean.
A few points about SNMP monitoring
Two levels:
1) SWCTRL is now health checked like any other process: part of the SW-WATCH-HEALTH-CHECK condition.
2) The SNMP agent itself is checked by WATCH: SW-SNMP condition.
Concerning the SNMP agent, the nominal behavior is the following.
WATCH side:
1) Sends an empty datagram to the SNMP agent to wake it up
3) Reads healthcheck socket port from named pipe /tmp/swagent.watch.SHM (timeout of 1ms.)
4) Sends datagram on healthcheck socket
7) Reads response on healthcheck socket from SNMP agent (timeout of 1ms.)
SNMP side:
2) If first time or (WATCH health cycle – 1 reached), open healthcheck socket and send connection port to named pipe /tmp/swagent.watch.SHM
5) Reads datagram received on healthcheck socket (timeout of 1 ms.)
6) Sends back datagram on healthcheck socket
About WATCH health check
- Processes mentioned in omni_health.SHM but not configured are not taken into account for the SW-WATCH-HEALTH-CHECK condition (e.g. IPMG if IUP not configured).
- If a health checked process crashes, WATCH will not complain: no event (feature / bug?). However, the SW-WATCH-HEALTH-CHECK condition will then be raised.
About resmon
- resmon is not started if the FR425 node is enabled.
- The way resources are monitored is different on Solaris and Linux: files m_sunos5.c / m_linux.c.
- resmon has no shared memory.
- To enable traces in resmon, use non-public parameter RESMON_TRACE (e.g. RESMON_TRACE=0xff) in omni_conf_info file. Traces are put into $OMNI_HOME/Logs/Event…
To compute available memory on Linux, resmon extracts information from /proc/meminfo:
memory in use = 100 – 100 * available / total
available = free + shared + buffers + cached
total = used + free
solaris resmon
Salut Laurent,
Je viens de me rappeler avoir envoyé ce mail a Jacques il y a quelque temps pour des détails sur resmon sous Solaris.
Je joins le fichier exemple (solaris_resmon.c) qui se compile facilement avec:
gcc -o solaris_resmon solaris_resmon.c -lkstat
Le concentre de l’algo de resmon sous Solaris y est.
NB: Je tiens a rappeler que l’algo ne sort pas de mon cerveau (malade) mais du code source de top ;)
- La memoire totale disponible se voit par exemple avec:
prtconf | grep Memory
- La memoire disponible à l’ instant t peut se voir par exemple avec:
vmstat 1 10
sous la colonne “free” a partir de la 2eme ligne.
jerome
Hello Jacques, The resmon conditions are here to detect over-utilization of the computer resources. So, if the concerned resource is below the specified (or default) threshold, the resmon condition as shown by DISPLAY-PLATFORM-STATUS is set to TRUE, and as soon as the threshold has been reached, the resmon condition becomes FALSE, which results in the CE becoming "not fully operational": this is what the PM event shows. When memory is reported to exceed 80% utilization like in the customer case, in no way this means that new calls would be rejected by SW. This only means that the machine memory is heavily used. Now to check the calculation, this is unfortunately a bit more complicated under Solaris than under Linux. Under Linux, the information is read from /proc/meminfo. Under Solaris, the information is read from the kernel via the native kstat library. Globally the formula for the memory is : memory in use = 100 - 100 * available / total To have an idea of how the amount of available memory and total memory are computed on Solaris, please have a look at the attached sample file which is an extract from the original resmon.c. You can compile it under Solaris 10, and it will show you these two values for your machine. Now, to turn this off, as explained in the resmon man-page, the operator can specify RESMON_MEMORY_THRESHOLD=0 in his omni_conf_info file. Hope this helps. Rgds, jerome
New / updated events
Siemens vient de rencontrer un probleme suite à l’ajout d’un nouvel event: la section “Affected Deliverables” du CR était incomplète.
Voici donc un petit rappel de ce qu’il faut mettre dans cette section en cas d’ajout ou de modification d’un event pour que l’integration n’oublie rien lors du “packaging”.
- Dans tous les cas:
conf/omni.cat.english
locale/english/omni.cat
man/all_events.tar.gz
- Si la severite d’un event a ete modifiee:
severityLevel/severity_files.tar.gz
- Si un nouvel NLS set a ete defini (nouveaux fichiers Clearcase /vob/signalware/Master/nlslib/nls_xxx.xml et /vob/nls/xxx_ids.xml):
include/nlsset.h
severityLevel/severity_files.tar.gz
Install a new M3UA event
cd nlslib
swmake
grep M3UA /vob/signalware/Master/cust_inc/nlsset.h => 69
cp sev.69 $OMNI_HOME/severityLevel
$OMNI_HOME/bin/convsev
Install catalog
cd $OMNI_HOME/conf
cp /vob/signalware/Master/nlslib/omni.cat.english .
gencat $OMNI_HOME/locale/english/omni.cat omni.cat.english
Solaris cannot capture packets sent to itself
(1) on Suse8 and on Windows, there is an ‘any’ interface available, which captures all packets on all interfaces.
Linux has it, Windows doesn’t. The Linux networking stack lets you have a PF_PACKET socket that’s not bound to a network interface, and that receives packets from all interfaces. Win Pcap doesn’t support that; it might be that NDIS doesn’t let you capture packets without connecting to a particular interface.
(2) On Solaris (eri and qfe) this interface seems to be not available.
DLPI, as used on various OSes including Solaris, doesn’t support that either, so there’s no “any” device.
(3) I’m using a lot of subinterfaces on the box (qfe0:1 … 18). What I’ve experienced in addition is, that I can not see packets sent from one subinterface to an other (e.g. qfe0:2 > qfe0:6), which I have to use for testing purposes.
Packets sent from a machine to itself are, as far as I know, on Solaris, not supplied to DLPI, and are therefore uncapturable by libpcap.
Monday, July 18, 2011
vocabulary
compelling | convaincant |
shenanigans | manigances |
to endorse | approuver |
idiosyncrasy | particularite |
to toss | lancer, s’agiter |
nipple | mamelon |
garbled | confus |
bloated | gonfle,boursoufle |
to rig | truquer |
outright | carrement |
humpback | bossu |
to stymie | coincer |
eyelash | cil |
to cater for | satifaire, repondre a, pourvoir a |
to bounce | rebondir |
the gist of | l’essentiel de |
slick | habile,chic |
stringent | rigoureux, strict |
throughput | debit |
preclude | exclure |
snappy | vivant, plein d’entrain |
sluggish | lent, mou |
to loiter | trainer (syn, hang about) |
seamless | coherent, homogene |
accordance | conformite (a qqch) |
sloppy | neglige, bacle |
to streamline | restructurer |
to intertwine | (s’)entrelacer |
tight | serre |
to tumble | degringoler |
to come with | s’accompagner de |
to soar | monter en fleche |
to cave in | flancher, ceder |
sleek | luisant, lisse, brillant |
conceivable | envisageable |
overhaul | (of system, of car) revision, remaniement |
outlook | perspective / point de vue, conception / vue |
heir | heritier |
diaper | couche |
laggard | trainard |
daunting | intimidant |
to shoplift | voler a l’etalage |
to pursue | poursuivre, se consacrer |
a spade | une beche, pique (cartes) |
to dole out | distribuer |
peculiar | etrange |
incentive | motivation |
gross | grossier (e.g. gross omission) |
to withstand | (vt) resister a |
entrenched | implante |
dismissive | dedaigneux |
to be dismissive of | ne faire aucun cas de qq’1, qch |
to cave in | s’effondrer, s’ecrouler |
propeller | helice |
leverage | effet de levier, influence |
to hang up on you | raccrocher au nez |
to chitchat | papoter |
aisle | couloir, allee (centrale) |
shallow | superficiel |
shallow breathing | respiration courte |
to pour down | pleuvoir averse |
(the) bottom line | resultat net, l’essentiel |
a pond | une mare |
convoluted | alambique |
rod | barre |
flimsy | leger |
hunch | intuition, pressentiment |
to be tied up | etre occupe, pris |
burrow | terrier |
wasp | guepe |
woe is me | pauvre de moi |
to throw off foreign domination | s’affranchir de la domination etrangere |
gprof enabling
- Add the ”-pg” option to every .o compilation + to the exe also.
- Link with static versions of libraries that need being profiled.
Example given:
cd /vob/signalware/Master/scos
swmake gprof
cd /vob/signalware/Master/test/tcap/c7
rm /vob/signalware/Master/library/libscos.so
clearmake -V "PROT_FLAGS=-DC7_Q" gprof
Then running c7icptrans should produce a gmon.out.
To extract the information from gmon.out, use gprof:
gprof /export/home/omni_9S5/bin/test/c7icptrans gmon.out > gprof.txt
Trace system calls from libFt in is41tst32
truss -u libFt:: /export/home/omni/bin/is41tst32 -debug -alone -node A71 -prot A7 -lpc 1-85-2 -rpc 1-85-2 -lssn -rssn 6 -ninvoke 200 0xffff
Example use
# mdb -k
Loading modules: [ unix krtld genunix ip usba logindmux ptm cpc ipc random nfs ]
> ::queue -v -m c7m3uart
0000030026cc1d30
> 0000030026cc1d30::q2stream
30026c5c940
> 30026c5c940::stream
+-----------------------+-----------------------+
| 0x30026cc8478 | 0x30026cc8388 |
| mom | mom |
| | |
| cnt = 0t0 | cnt = 0t0 |
| flg = 0x00004022 | flg = 0x00044032 |
+-----------------------+-----------------------+
| ^
v |
+-----------------------+-----------------------+
| 0x30026cc13e0 | 0x30026cc12f0 |
| c7tcap | c7tcap |
| | |
| cnt = 0t0 | cnt = 0t0 |
| flg = 0x00004022 | flg = 0x00004032 |
+-----------------------+-----------------------+
| ^
v |
+-----------------------+-----------------------+
| 0x30026cc0c30 | 0x30026cc0b40 |
| c7sccp | c7sccp |
| | |
| cnt = 0t0 | cnt = 0t0 |
| flg = 0x00004022 | flg = 0x00004032 |
+-----------------------+-----------------------+
| ^
v |
+-----------------------+-----------------------+
| 0x30026cc1e20 | 0x30026cc1d30 |
| c7m3uart | c7m3uart |
| | |
| cnt = 0t0 | cnt = 0t0 |
| flg = 0x00004022 | flg = 0x00004032 |
+-----------------------+-----------------------+
| ^
v |
+-----------------------+-----------------------+
| 0x30026cc81e8 | 0x30026cc80f8 |
| lom_ | lom_ |
| | |
| cnt = 0t0 | cnt = 0t0 |
| flg = 0x00244022 | flg = 0x00204032 |
+-----------------------+-----------------------+
>
watchmalloc how to (sangria)
Very slow!
cd /usr/lib/secure/64
suidwrap ln -s /usr/lib/64/watchmalloc.so.1
export LD_PRELOAD_64=/usr/lib/secure/64/watchmalloc.so.1
export MALLOC_DEBUG=WATCH,RW
libumem how to (sangria)
Requires Solaris 9 update 3, and above.
cd /usr/lib/secure/64
suidwrap ln -s /usr/lib/64/libumem.so.1
Then,
export LD_PRELOAD_64=/usr/lib/secure/64/libumem.so.1
export UMEM_DEBUG=default
export UMEM_LOGGING=transaction
go.omni
gcore `pid guiserver`
If core “core.15604” is dumped, then
mdb core.15604
Memory leaks / Memory corruption
- Generalities: Alternate Methods of Debugging
- libumem: libumem
- or, libumem: libumem
PM sig_segv
$ gdb
(gdb) file /vob/signalware/Master/pm/pm |
Reading symbols from /vob/signalware/Master/pm/pm...done.
(gdb) attach 26427
Attaching to program `/vob/signalware/Master/pm/pm', process 26427
Reading symbols from /usr/lib/sparcv9/omni/libdgms.so...done.
Loaded symbols for /usr/lib/sparcv9/omni/libdgms.so
...
sol-thread active.
Retry #1:
Retry #2:
Retry #3:
Retry #4:
[New LWP 1 ]
[New Thread 1 (LWP 1)]
Symbols already loaded for /usr/lib/sparcv9/omni/libdgms.so
...
[Switching to Thread 1 (LWP 1)]
0xffffffff7d7a677c in _poll () from /usr/lib/64/libc.so.1
(gdb) handle SIGSEGV stop print
Signal Stop Print Pass to program Description
SIGSEGV Yes Yes Yes Segmentation fault
(gdb) cont
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0xffffffff7d73d28c in strlen () from /usr/lib/64/libc.so.1
(gdb) bt
#0 0xffffffff7d73d28c in strlen () from /usr/lib/64/libc.so.1
#1 0xffffffff7d790308 in _doprnt () from /usr/lib/64/libc.so.1
#2 0xffffffff7d792538 in vsprintf () from /usr/lib/64/libc.so.1
#3 0xffffffff7e71b624 in FtFormatInternationalMsg (catd=0x10075fa50, set_number=45, message_number=109,
defaultString=0xffffffff7c321a0f "M DENY\n %s\n %s\n",
destMsgBuf=0x100186380 "M DENY\n +------+\n| INFO | Acquiring lock on addDelNode.lock.6981\n+------+\n/export/home/omni/bin/DFcat addDelNode.lock.6981 2>&1\n/export/home/omni/bin/DFconvert /tmp/addDelNode.lock.6981\n\n+------+\n|"..., sizeDestMsgBuf=4096)
at ../lib_util.c:1740
#4 0x0000000100010a14 in DoCreateNode (pcmd=0x100624a10) at pm.c:5333
#5 0x0000000100034980 in yyparse () at parse.y:1026
#6 0x000000010003acf4 in parseMML () at nlex.l:1024
#7 0x0000000100037620 in process_mml_cmd () at parse.y:2399
#8 0x000000010000a760 in main (argc=7672264, argv=0x100624e18) at pm.c:1555
(gdb) quit
Ignore SIGUSR2 signals
This command will prevent your program from stopping whenever it receives a SIGUSR2 but will print it anyway.
(gdb) handle SIGUSR2 nostop noprint
This is useful in JGUI Server to prevent gdb from being stopped by SIG_CPT.
Ignore SIGALRM in single-stepping
To ignore SIGALRM signals while single-stepping, but treat them normally during normal execution, you could define:
define hook-stop
handle SIGALRM nopass
end
define hook-run
handle SIGALRM pass
end
define hook-continue
handle SIGLARM pass
end
NB: recorded in ~gallinar/.gdbinit, which is read automatically by gdb if gallinar or which can be sourced (within gdb) if root.
Installing gdb
Excerpt:
CC="gcc -m64" ./configure --prefix=/u/engineering/locals/solaris10/softs/proglang/gdb-6.6
make
make install
Compilation errors:
rm -f gdb
gcc -g -O2 \
-o gdb gdb.o libgdb.a \
../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a ./../intl/libintl.a ../libiberty/libiberty.a -ldl -lncurses -lsocket -lnsl -lm ../libiberty/libiberty.a
Undefined first referenced
symbol in file
initscr32 libgdb.a(tui.o)
w32addch libgdb.a(tui-io.o)
w32attron libgdb.a(tui-wingeneral.o)
w32attroff libgdb.a(tui-wingeneral.o)
acs32map libgdb.a(tui-win.o)
ld: fatal: Symbol referencing errors. No output written to gdb
To solve it:
cd /usr/ccs/lib
ln -s /usr/ccs/lib/libcurses.so libncurses.so
valgrind: failed to start tool memcheck for platform amd64-linux: No such file or directory
valgrind was not able to find memcheck.
Solution: Put in VALGRIND_LIB the parent directory of amd64-linux directory.
E.g.:
export VALGRIND_LIB=/u/gallinar/downloaded/valgrind-3.2.3/.in_place
Example run
/u/engineering/locals/linux/bin/valgrind --leak-check=yes --show-reachable=yes --num-callers=16 --quiet $OMNI_HOME/bin/MonControl -filetype pcap -enable C7_L3MTP 2>&1 | tee MonControl.log
General information
Extreme programming and agile methods recommend that the development process include continuous integration and unit testing. A pragmatic way to support these practices is to set up an automated system to build and test the latest version of your source code every time it changes. This article guides you through the practical issues involved in setting up your own Linux-based build server for Java projects.
The world's largest development and download repository of Open Source code and applications
Learn how to integrate Web Logic Workshop applications within Cruise Control, an open source tool framework that supports continuous integration in the build process.
Cruise Control build scripts
E.g.
/u/engineering/cruisecontrol_data/projects/ulcm_adc_k2664/build.sh
Instance Number 1, installed in /export/home/omni, has not completed configureNodes
xemacs /etc/swinstall/db/1/instance_state
Change variant without running configurePlatform
DFedit portConf.$SHM
DFedit portConf.GENERIC
Know whether a logical node is started / stopped
SYSlogicalNodeList_t actv_node_list;
memset(&actv_node_list, 0, sizeof(SYSlogicalNodeList_t));
if (RETURNerror != SYSgetNodeNames(&actv_node_list, TRUE))
{
for (int j = 0; j < actv_node_list.count; j++)
{
if (!strcmp(actv_node_list.node[j].name, logicalNode))
{
/* Node is started. */
...
break;
}
}
}
Managers by type of logical node
Error message “command not valid on this logical node” is issued by NM (see nmhandlers.c) after SYSgetNodeConfInfo()
, which reads the list of managers from nodeStart.myNode.$SHM
Based on api_main.c.
C71 ( C7) MTP3 SCCP TUP* IUP* ISUP* TCAP
C7MSG ( C7M3UASG) M3UA SG MTP3 SCCP* TUP* IUP* ISUP* TCAP*
C7MAS ( C7M3UA) M3UA AS SCCP TUP* IUP* ISUP* TCAP
C7SSG ( C7SUASG) MTP3 SUA SG SCCP TUP* IUP* ISUP* TCAP
C7SAS ( C7SUA) SUA AS TCAP
C7MSSG (C7M3UASUASG) M3UA SG MTP3 SUA SG SCCP TUP* IUP* ISUP* TCAP
C7MSAS ( C7M3UASUA) M3UA AS SUA AS TUP* IUP* ISUP* TCAP
Notes:- This manager* is optional
- SCCP manager => TCAP manager
- TUP and IUP are antinomic
- Hybrid stack options, TUP, IUP, ISUP options are proposed only if packages installed (see options.GENERIC)
Non-applicable parameters
Q: To the file $OMNI_HOME/conf/omni_conf_info on both CEs I have to add
MOPC_GR=YES
MOPC is only supported for protocols A7,C7, AC7, CA7, and CH7. Does this entry harm for other protocols like M3UA?
A: Prior to SP4 the presence of this parameter in the omni_conf_info file when running M3UA would have resulted in a “non-provisioned” error in the diag file. From SP4 onwards you will no longer see the error.
configureNodes: Please run configurePlatform
- Ensure /etc/swinstall/db/1/instance_state has all its statuses set to xxx_COMPLETE
- Ensure $OMNI_HOME/conf/configurePLatform.Conf is older than $OMNI_HOME/conf/ce.conf.GENERIC
Monta Vista queues
Hong Ye was having problems with DFdaemon on his MV boxes in a M3UA configuration.
( M3UAmgr passes 10meg files across the CEs using DF… )
Eric noticed on Hong Ye’s
Monta Vista boxes that ”/sbin/ifconfig -a” cmd shows that the “txqueuelen”
parameter of each “ethx” interfaces was set to 100 whereas it is set to 1000 on other Linux machines.
Small values for txqueuelen are OK for slow device but not for Ethernet links (see ifconfig man page).
Using ifconfig cmd, Eric set txqueuelen=1000 on all “ethx” interfaces of Wilson and Roosevelt.
Everything is OK now.
It looks like txqueuelen=100 is the default for Monta Vista machines.
txqueuelen=1000 should be set by default on ALL Linux machines.
SS7 SLK stay failed
DFcat multiconf.cnf
and check that we have:
CLK_SOURCE TDMA:S,TDMB:M
and not
CLK_SOURCE TDMA:S,TDMB:N
CREATE-M2PA-PORT error: Invalid local
C71:lili:698 > CREATE-M2PA-PORT:NAME=PORT2,LOCAL="lino",REMOTE="xenon",SCTP_PORT=1118,SCTP_SERVER_PORT=3672,TYPE=SERVER;
M DENY
IDNV
PORT_DAEMON: Invalid local
Then, in /etc/hosts, replace
127.0.0.1 localhost.localdomain localhost lino
with
127.0.0.1 localhost.localdomain localhost
and
C71:lili:698 > CREATE-M2PA-PORT:NAME=PORT2,LOCAL="lino",REMOTE="xenon",SCTP_PORT=1118,SCTP_SERVER_PORT=3672,TYPE=SERVER;
M COMPLETED
25-Jun-2009 23:02:08 spurs.MOM Error 00010 00005 Queuing not allowed O:spurs.DR Q:0×83f0000 T:0×301b, suppressed 0
This occured while stopping, then re-starting the STBY CE. Following this, the STBY CE was dying.
Hello Hong,
eth3 interfaces on both knicks and spurs are not configured correctly.
We can see that IP packets were dropped on eth3:
knicks
eth3 Link encap:Ethernet HWaddr 00:0E:0C:EC:AC:89
inet addr:10.2.89.4 Bcast:10.2.89.255 Mask:255.255.255.0
inet6 addr: fe80::20e:cff:feec:ac89/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1719575 errors:0 dropped:2086 overruns:0 frame:0
TX packets:1156494 errors:365 dropped:0 overruns:0 carrier:365
collisions:31041 txqueuelen:100
RX bytes:1246952841 (1.1 GiB) TX bytes:474268341 (452.2 MiB)
Base address:0x4000 Memory:bc520000-bc540000
spurs
eth3 Link encap:Ethernet HWaddr 00:0E:0C:EC:AD:99
inet addr:10.2.89.3 Bcast:10.2.89.255 Mask:255.255.255.0
inet6 addr: fe80::20e:cff:feec:ad99/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1155753 errors:0 dropped:68 overruns:0 frame:0
TX packets:1721684 errors:19 dropped:0 overruns:0 carrier:19
collisions:31041 txqueuelen:100
RX bytes:474054722 (452.0 MiB) TX bytes:1250025688 (1.1 GiB)
Base address:0x4000 Memory:bc520000-bc540000
I ran ifconfig eth3 txqueuelen 1000 on both.
But the main issue here is that eth3 is 100 Mbps Half Duplex where eth4 is 1000 Mbps Full Duplex:
> grep "Half Duplex" /var/log/messages
Jul 6 14:18:54 spurs kernel: e1000: eth3: e1000_watchdog_task: NIC Link is Up 100 Mbps Half Duplex
Jul 6 14:34:44 knicks kernel: e1000: eth3: e1000_watchdog_task: NIC Link is Up 100 Mbps Half Duplex
This must be fixed.
Eric.
cronjob examples
#min(0-59)|hour(0-23)|day(1-31)|mon(1-12)|wday(0-6)|command
0 0 * * * rsh redbull /u/gallinar/bin/scripts/swlab -force >/dev/null
0 21 * * * /ccase/cm/swdel/bin/swdel.runall
0 22 * * * /ccase/cm/swdel/bin/kindexer.runall
#0 6 * * * rsh redbull "/u/gallinar/bin/scripts/t/ECN.pl"
0 7 * * * /ccase/cm/swdel/src/script/update_ccase_cm_swdel_dirs
cronjob.gallinar.sc-zamp
#min(0-59)|hour(0-23)|day(1-31)|mon(1-12)|wday(0-6)|command
0 3 * * * /opt/webstack/mysql/bin/mysql -u enguser -D mrbs -e 'select room_name, area_name from mrbs_room as host, mrbs_area
as area where host.area_id=area.id ' --xml > /u/engineering/perl_tools/cgi-bin/intranet/lab.hosts
0 2 * * 1-5 /u/engineering/perl_tools/cgi-bin/intranet/ECNs3.pl > /u/apache/UEintranet/Documents/ECNs/ecns.txt 2>/u/engineering
/perl_tools/cgi-bin/intranet/ecns.log
30 2 * * 1- /u/engineering/perl_tools/cgi-bin/intranet/ecn2drop.pl 2>/u/engineering/perl_tools/cgi-bin/intranet/drops.log
0,5,10,15,20,25,30,35,40,45,50,55 * * * 1-5 /u/gallinar/bin/scripts/nd_cr.pl
# 0,5,10,15,20,25,30,35,40,45,50,55 * * * 1-5 LD_LIBRARY_PATH=/u/engineering/locals/solaris8/lib /u/gallinar/tmp/perltrial/sacha.pl
Wednesday, July 6, 2011
How to compile on odin
Create a view:
crtool -rel sw9
Compile:
cd
cc_mkmf
make
Open LDAP compilation (litchi)
First, install the sasl lib (not gsasl).
Second, configure options for Open LDAP:
LD_LIBRARY_PATH="/usr/local/lib/sasl2:/usr/local/BerkeleyDB.4.4/lib" LDFLAGS="-L/usr/local/lib/sasl2 -L/usr/local/BerkeleyDB.4.4/lib" CPPFLAGS="-I/usr/local/include/sasl -I/usr/local/BerkeleyDB.4.4/include " ./configure --enable-bdb --enable-ldbm --enable-ldap --enable-meta --enable-crypt --with-cyrus-sasl
Then, compile
make depend
make
Linux: Replace a dynamic library for a test
- Re-compile the exe using the .so while removing the -rpath dir option.
- export LD_LIBARY_PATH
- Check with ldd on the exe that your library is taken into account.
Compile libapi.so sample
/u/engineering/locals/solaris9/softs/proglang/gcc-3.2/bin/gcc -m64 -fPIC -DULTICOM_IN_HOUSE_COMPILE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DULTICOM_IN_HOUSE_COMPILE -I/vob/common/src -I/vob/signalware/../common/src -I. -I.. -I/vob/common/3rdparty/licensemanager/include -I/vob/signalware//Master/Ft/inc -I/vob/signalware//Master/Ft/inc -I/vob/signalware//Master/cust_inc -I/vob/signalware//Master/cust_inc -I/vob/signalware//Master/priv_inc -I/vob/signalware//Master/priv_inc -I/usr/X/include -g -Wall -std=gnu99 -O -I/vob/common/src -c ~/tmp/cpptrial/api_main.c -o api_main.o
/u/engineering/locals/solaris9/softs/proglang/gcc-3.2/bin/gcc -R /usr/lib/sparcv9/omni -L/vob/signalware/Master/library -L/vob/signalware/Master/library -m64 -R/usr/lib/sparcv9/omni -o api_main api_main.o -L/vob/common/lib/ -lulcmtoolsc -lapi -ldf -lFt -lsocket -lnsl -lgen -lpthread -ldgms -lrt
pm.c:7355: warning: int format, different type arg (arg 8)
This warning in 9V4 (but not in 9S50) is due to the fact that in Ft Proto.h, we have:
#ifdef GNUC
int FtFormatInternationalMsg (nl_catd catd, int set_number,
int message_number, _TCHAR defaultString,
_TCHAR destMsgBuf, int sizeDestMsgBuf, ...)
attribute((format(printf, 4, 7)));
Explanation:
attribute format
This attribute allows assigning printf-like or scanf-like characteristics to the declared function, and this enables the compiler to check the format string against the parameters provided throughout the code. This is exceptionally helpful in tracking down hard-to-find bugs.
There are two flavors:
- attribute((format(printf,m,n)))
- attribute((format(scanf,m,n)))
but in practice we use the first one much more often.
The (m) is the number of the “format string” parameter, and (n) is the number of the first variadic parameter. To see some examples:
/* like printf() but to standard error only */
extern void eprintf(const char *format, ...)
__attribute__((format(printf, 1, 2))); /* 1=format 2=params */
/* printf only if debugging is at the desired level */
extern void dprintf(int dlevel, const char *format, ...)
__attribute__((format(printf, 2, 3))); /* 2=format 3=params */
With the functions so declared, the compiler will examine the argument lists
$ cat test.c
1 extern void eprintf(const char *format, ...)
2 __attribute__((format(printf, 1, 2)));
3
4 void foo()
5 {
6 eprintf("s=%s\n", 5); /* error on this line */
7
8 eprintf("n=%d,%d,%d\n", 1, 2); /* error on this line */
9 }
$ cc -Wall -c test.c
test.c: In function `foo':
test.c:6: warning: format argument is not a pointer (arg 2)
test.c:8: warning: too few arguments for format
Note that the “standard” library functions – printf and the like – are already understood by the compiler by default.
Basic Signalware compilation
Compiles what is in ”/ccase/cm/crtool/var/swmake_filters/basic.filter”
swmake -Xfilter=basic
k2632 native sctp compilation
To compile /vob/signalware/Master/sctp/native, you first need to specify you use native SCTP via configurePlarform, then swcommission.
Typical error:
snmp_bindx undefined symbol
libexpat / libcrypto compilation
E.g. libcrypto compilation
> cd /vob/common/3rtparty/openssl
> swmake
Creating /vob/common/3rdparty/openssl/Makefile from /vob/common/3rdparty/openssl/Imakefile
current vob=/vob/common
imake default opts=-DPROD_sun -DUSE64BITS -DUSEGCC -DPROD_sol10 -DUSEGNUSYNTAX -DWINKIN_COMPILE -DREMOTE_SITE -DWINKIN_COMPILE
/vob/common/3rdparty/openssl (Imakefile)
reset imake add opts=-D_CURRENTVOB=/vob/common -I/vob/common/config
"./Imakefile", line 1: Can't find include file omni.cf
"./Imakefile", line 2: Can't find include file c++.cf
imake: Exit code 2. Stop.
Interupted: 256 at /vob/common/src/perl/Ulcm/Nmkmf.pm line 265.
clearmake: Error: Syntax error in file "Makefile", line 28, column 0
syntax error
To fix this shit, proceed as follows:
> nmkmf "-I/vob/signalware/Master/config"
> swmake
Compile JMML utests
> cd jmml/utests
> /vob/common/3rdparty/jakarta-ant/jakarta-ant-1.5.4/bin/ant -DCOMMON_CMROOT=/vob/common