Github user zcorrea commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1664#discussion_r205920958
--- Diff: core/sqf/monitor/linux/process.cxx ---
@@ -4775,46 +4818,85 @@ void CProcessContainer::Bcast (struct message_def
*msg)
char *CProcessContainer::BuildOurName( int nid, int pid, char *name )
{
- int i;
- int rem;
- int cnt[4];
-
const char method_name[] = "CProcessContainer::BuildOurName";
TRACE_ENTRY;
- // Convert Pid into base 35 acsii
- cnt[0] = pid / 42875;
- rem = pid - ( cnt[0] * 42875 );
- cnt[1] = rem / 1225;
- rem -= ( cnt[1] * 1225 );
- cnt[2] = rem / 35;
- rem -= ( cnt[2] * 35 );
- cnt[3] = rem;
+ int i;
+ int rem;
+ int cnt[6];
+
+ if (!processNameFormatLong_)
+ {
+ // Convert Pid into base 35 acsii
+ cnt[0] = pid / 42875; // (35 * 35 * 35)
+ rem = pid - ( cnt[0] * 42875 );
+ cnt[1] = rem / 1225; // (35 * 35)
+ rem -= ( cnt[1] * 1225 );
+ cnt[2] = rem / 35;
+ rem -= ( cnt[2] * 35 );
+ cnt[3] = rem;
+
+ // Process name format long: '$Zxxpppp' xx = nid, pppp = pid
- // Convert Nid into base 16 acsii
- sprintf(name,"$Z%2.2X",nid);
- for(i=3; i>=0; i--)
- {
- if( cnt[i] < 10 )
- {
- name[i+4] = '0'+cnt[i];
- }
- else
+ // Convert Nid into base 16 acsii
+ sprintf(name,"$Z%2.2X",nid);
+
+ // Convert Pid into base 36 ascii
+ for(i=3; i>=0; i--)
{
- cnt[i] -= 10;
- // we are skipping cap 'o' because it looks like zero.
- if( cnt[i] >= 14 )
+ if( cnt[i] < 10 )
{
- name[i+4] = 'P'+(cnt[i]-14);
+ name[i+4] = '0'+cnt[i];
}
else
{
- name[i+4] = 'A'+cnt[i];
+ cnt[i] -= 10;
+ // we are skipping cap 'o' because it looks like zero.
+ if( cnt[i] >= 14 )
+ {
+ name[i+4] = 'P'+(cnt[i]-14);
+ }
+ else
+ {
+ name[i+4] = 'A'+cnt[i];
+ }
}
}
+ name[8] = '\0';
+ }
+ else
+ {
+ // We are skipping 'A', 'I', 'O', and 'U' to distinguish between
zero
+ // and one digits, and for political correctness in generated names
--- End diff --
I could not think of any of the more mundane four-letter words. Can you?
This is what we used in the NonStop OSS file system.
---