NotesUser Activity Class

The NotesUserActivity Class is a customizable LotusScript library that returns database user activity summary information. The usage statistics for the prior day, week, and month since user activity recording began is provided. The number of documents a user or server has read, added, updated or deleted during each session, with the most recent activity first, is returned.

The class returns information that is available from the Notes user interface via the File/Database/Properties menu item, Information tab, Activity section, User Detail button selection. User activity for the specified database must be enabled for this function to work .

The class was created by Alex Elliott of AGECOM (http://www.agecom.com.au). Unfortunately it was only availabe for Windows.

I tried to write a Linux port, but I only had a partial success. The code runs without any issues on Windows.

It also runs fine on a Domino V11 Beta1 server on Linux ( CentOS). But it constantly crashes on Domino 10.0.1 ( with or without FP ) on RHEL.

The crash occurs, when the code tries to get the UserName from the ActivityEntry.

pActivityEntry = puActivity + lEntry * 28
		
CopyMemory dt.Innards(0), pActivityEntry , LEN_DWORD
CopyMemory dt.Innards(1), pActivityEntry + 4 , LEN_DWORD
CopyMemory reads, pActivityEntry + 8 , LEN_WORD
CopyMemory adds, pActivityEntry + 10 , LEN_WORD
CopyMemory updates, pActivityEntry + 12 , LEN_WORD
CopyMemory deletes, pActivityEntry + 14 , LEN_WORD
CopyMemory nonDataReads, pActivityEntry + 16 , LEN_WORD
CopyMemory nonDataAdds, pActivityEntry + 18 , LEN_WORD
CopyMemory nonDataUpdates, pActivityEntry + 20 , LEN_WORD
CopyMemory nonDataDeletes, pActivityEntry + 22 , LEN_WORD
CopyMemory nameOffset, pActivityEntry + 24 , LEN_DWORD		

Dim spUsername As String * MAXUSERNAME
spUsername = Space(MAXUSERNAME)

CopyMemoryString spUsername, puActivity + nameOffset, MAXUSERNAME - 2

Dim sUserName As String
sUserName = Trim(spUsername)

CopyMemory and CopyMemoryString are declared as

Declare Sub TUX_CopyMemory Lib "libc.so.6" Alias "memcpy" _
(hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)

Declare Sub TUX_CopyMemoryString Lib "libc.so.6" Alias "memcpy" _
(ByVal hpvDest As LMBCS String, ByVal hpvSource As Long, ByVal cbCopy As Long)

I tried using undocumented method “Cmovmem” from libnotes.so but it also crashes on V10 AND V11. I must admit that I do not really know, how to use Cmovmem. I declared it this way:

Declare Sub CopyMemoryString Lib LIB_TUX Alias "Cmovmem"  _
(Byval lpSrc As Long, Byval lpDest As String, Byval lSize As Long)

You can find the code here.

Any help to get it working on V10 for Linux is appreciated.

6 thoughts on “NotesUser Activity Class

  1. This is probably a stretch, but I vaguely remember that RHEL can run on both big-endian (like AIX) and little-endian (like Windows) systems which would not impact normal calls much but would wreak havoc with memory pointers used this way. Any chance the issue is not the Domino 10 but the underlying RHEL system?

  2. cloned the working CentOS VM and installed Domino 10.0.1. -> not even the CopyMemory part works & crash
    cloned the working CentOS VM and installed Domino 9.0.1 -> not even the CopyMemory part works & does not crash, produces weird console output

    warning: Memory read failed for corefile section, 1048576 bytes at 0x7f18f9494000.
    warning: Memory read failed for corefile section, 1048576 bytes at 0x7f18f97a0000.
    warning: Memory read failed for corefile section, 1048576 bytes at 0x7f18f9a8a000.
    warning: Memory read failed for corefile section, 1048576 bytes at 0x7f18f9caa000.
    warning: Memory read failed for corefile section, 1048576 bytes at 0x7f18f9ec2000.
    warning: Memory read failed for corefile section, 1048576 bytes at 0x7f18fa0dc000.
    warning: Memory read failed for corefile section, 1048576 bytes at 0x7f18fd577000.
    [03636:00002-00007F95A348D740] 20.09.2019 15:50:08 Pushing cldbdir.nsf to castor.midpoints.net/local/srv/devpoints cldbdir.nsf
    [03636:00002-00007F95A348D740] 20.09.2019 15:50:08 Replicator updated 1 document(s) in castor.midpoints.net/local/srv/devpoints cldbdir.nsf from cldbdir.nsf
    Saved corefile core.3115
    [03115:00008-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00009-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00010-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00011-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00012-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00013-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00014-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00015-00007F187D1DF700] 20.09.2019 15:50:10 Agent Manager: Agent error: ——————————
    [03115:00007-00007F187E26E700] 20.09.2019 15:50:11 Agent Manager: Agent error: JVMDUMP013I Speicherauszugsereignis “abort”, Detail “” wurde verarbeitet.

  3. I have copy of the database ‘ls2capi-v1-00.nsf’ by Bill Buchan, based on excellent work by Normunds Kalnberzins and Daniel Nashed and Julian Robichaux, and Bill Buchan himself. The expanded title is ‘The LotusScript to C-API Testing Harness’. It offers a platform and bitness (32, 64) independent way of calling the C-API. Could not find a current webpage with it, I’ll ask Bill if that code can be spread. Looks like a good way to make sure C-API call work platform independent.

  4. Just noticed that the Testing Harness was intended as freeware so I sent Ulrich a copy. The set of libraries looks quite nice, posing as glue so the handling of parameters is converted from Lotusscript style (with padding) to C-style (tightly packed).

    It needs testing and work since options like Domino 64-bit on Linux 64 bit did not exist when the original code was developed.

    Handle with care and test in a VM.

  5. Think i found it. OSLockObject returns a pointer. On 64 bit Domino for Linux, that wont fit into a long, since that is only 4 bytes.

    Need to use a Double for that…

  6. Looking into it, its becoming a bit of a mess. For C-API use of Double for 64 bit Pointers, according to (https://www-10.lotus.com/ldd/ddwiki.nsf/dx/C-Callouts_on_non-32-bit_Platforms) you need a special Notes.ini var on the Linux 64 server, LS64BITCCALLOUTPointerSupport=1.
    And you need to do separate 64-bit declare of call using pointers, like the memcpy calls. Which I looked up and a bit of messy history turned up, as it seems memcpy has been once tainted by a misguided soul (see https://www.win.tue.nl/~aeb/linux/misc/gcc-semibug.html and https://bugzilla.redhat.com/show_bug.cgi?id=638477#c129 )

    Another very painful revelation is that 64-bit pointer arithmetic is not possible in standard LotusScript. The line ‘pActivityEntry = puActivity + lEntry * 28’ cannot be used in Linux/64 (or other Domino/64 on 64 bit OSes).

    I think to get this going some creative hoops have the be gotten through.

Comments are closed.