Re: Truss output - semget analysis



"db2udbgirl" <db2udbgirl@xxxxxxxxx> writes:

Guys,

I'm trying to determine if the application is issuing semget() calls
and fails. Hence I issued the command
truss -d -o truss.log db2 "connect to dbname"

Inside the truss.log file, the following lines are listed
0.1427 access("/IBMdb2/home/db2rtcl/sqllib/profile.env", 0) Err#2
ENOENT
0.1430 open("/IBMdb2/home/db2rtcl/sqllib/profile.env", O_RDONLY) Err#2
ENOENT
0.1432 lstat("/IBMdb2/home/db2rtcl/sqllib/.ftok", 0xFFBEEF34) Err#2
ENOENT
0.1434 semget(-2, 1, 0) = 3473440
0.1436 semop(3473440, 0xFE3A5CE8, 1) = 0
0.1437 shmget(-2, 0, 0) = 1204957224
0.1438 shmat(1204957224, 0, SHM_RND) = 0xFD400000
0.1441 semop(3473440, 0xFE3A5CEE, 1) = 0


But I dont know whether semget has succeeded or failed. Your help is
greatly appreciated.

Apparently it succeeded. man semget:

Upon successful completion, a non-negative integer representing a
semaphore identifier is returned. Otherwise, -1 is returned and
errno is set to indicate the error.

The return value is the semaphore identifier 3473440, which
subsequently is used in two semop call. Especially, it is not -1,
which would indicate an error.

Regards, Bruno.
.