The attached patch should address this issue. The patch is essentially this
commit af73e397da01a4f70c01387f284e87262e42e7a3 Author: Dave Love <d.l...@liverpool.ac.uk> Date: Thu Apr 21 12:44:36 2011 +0000 Introduce lUlong64 to fix wrong vmem reporting on 64-bit GNU/Linux (from Univa) from http://arc.liv.ac.uk/repos/git/sge combined with a minor change for backporting to 6.2u5-7.1 --- a/gridengine_add64bit_support.patch 2013-06-05 14:24:17.415377163 +0200 +++ b/gridengine_add64bit_support.patch 2013-06-05 15:15:59.137610718 +0200 @@ -366,7 +366,7 @@ + if (pos < 0) { + /* someone has called lGetPosUlong64() */ + /* makro with an invalid nm */ -+ CRITICAL((SGE_EVENT, SFNMAX, MSG_CULL_GETPOSULONG64_GOTINVALIDPOSITION )); ++ CRITICAL((SGE_EVENT, MSG_CULL_GETPOSULONG64_GOTINVALIDPOSITION )); + DEXIT; + abort(); + } I've tested the patch using this procedure: On wheezy machine, I downloaded the source package of gridengine 6.2u5-7.1 apt-get -b source gridengine Then applied the attached patch to the extracted source, and rebuild the package in the following way: dpkg-buildpackage -rfakeroot -uc -b and it builds cleanly and can be installed.
diff --git a/source/common/basis_types.h b/source/common/basis_types.h index aa4fb28..12d21f3 100644 --- a/source/common/basis_types.h +++ b/source/common/basis_types.h @@ -30,6 +30,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <sys/types.h> @@ -122,17 +123,29 @@ extern "C" { # define u_long32 u_long #endif +#if defined(TARGET_64BIT) +# define u_long64 u_long +#elif defined(WIN32NATIVE) +# define u_long64 unsigned long long +#elif defined(FREEBSD) || defined(NETBSD) +# define u_long64 uint64_t +#else +# define u_long64 unsigned long long +#endif + #define U_LONG32_MAX 4294967295UL #define LONG32_MAX 2147483647 /* set sge_u32 and sge_x32 for 64 or 32 bit machines */ /* sge_uu32 for strictly unsigned, not nice, but did I use %d for an unsigned? */ #if defined(TARGET_64BIT) || defined(FREEBSD) || defined(NETBSD) +# define sge_u64 "%ld" # define sge_u32 "%d" # define sge_uu32 "%u" # define sge_x32 "%x" # define sge_fu32 "d" #else +# define sge_u64 "%lld" # define sge_u32 "%ld" # define sge_uu32 "%lu" # define sge_x32 "%lx" diff --git a/source/daemons/common/procfs.c b/source/daemons/common/procfs.c index f78513a..6882ca5 100644 --- a/source/daemons/common/procfs.c +++ b/source/daemons/common/procfs.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #if !defined(COMPILE_DC) @@ -554,7 +555,7 @@ time_t last_time lSetPosUlong(pr, pos_utime, utime); lSetPosUlong(pr, pos_stime, stime); - lSetPosUlong(pr, pos_vsize, vsize); + lSetPosUlong64(pr, pos_vsize, vsize); close(fd); } @@ -770,7 +771,7 @@ time_t last_time proc_elem->proc.pd_stime = ((double)lGetPosUlong(pr, pos_stime)) / sysconf(_SC_CLK_TCK); /* could retrieve uid/gid using stat() on stat file */ - proc_elem->vmem = lGetPosUlong(pr, pos_vsize); + proc_elem->vmem = lGetPosUlong64(pr, pos_vsize); /* * I/O accounting diff --git a/source/libs/cull/cull_db.c b/source/libs/cull/cull_db.c index f848902..4bbd6b2 100644 --- a/source/libs/cull/cull_db.c +++ b/source/libs/cull/cull_db.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> #include <stdlib.h> @@ -383,6 +384,9 @@ lList *lJoin(const char *name, int nm0, const lList *lp0, case lUlongT: needed = (ep0->cont[lp0_pos].ul == ep1->cont[lp1_pos].ul); break; + case lUlong64T: + needed = (ep0->cont[lp0_pos].ul64 == ep1->cont[lp1_pos].ul64); + break; case lStringT: needed = !strcmp(ep0->cont[lp0_pos].str, ep1->cont[lp1_pos].str); break; diff --git a/source/libs/cull/cull_dump_scan.c b/source/libs/cull/cull_dump_scan.c index 95472bb..2df8af7 100644 --- a/source/libs/cull/cull_dump_scan.c +++ b/source/libs/cull/cull_dump_scan.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> #include <stdlib.h> @@ -63,6 +64,7 @@ static int fGetKet(FILE *fp); static int fGetDescr(FILE *fp, lDescr *dp); static int fGetInt(FILE *fp, lInt *value); static int fGetUlong(FILE *fp, lUlong *value); +static int fGetUlong64(FILE *fp, lUlong64 *value); static int fGetString(FILE *fp, lString *value); static int fGetHost(FILE *fp, lHost *value); static int fGetFloat(FILE *fp, lFloat *value); @@ -310,6 +312,10 @@ int lDumpElemFp(FILE *fp, const lListElem *ep, int indent) ret = fprintf(fp, "%s/* %-20.20s */ " sge_u32 "\n", space, lNm2Str(ep->descr[i].nm), lGetPosUlong(ep, i)); break; + case lUlong64T: + ret = fprintf(fp, "%s/* %-20.20s */ " sge_u64 "\n", + space, lNm2Str(ep->descr[i].nm), lGetPosUlong64(ep, i)); + break; case lStringT: str = lGetPosString(ep, i); /* quote " inside str */ @@ -608,6 +614,9 @@ lListElem *lUndumpElemFp(FILE *fp, const lDescr *dp) case lUlongT: ret = fGetUlong(fp, &(ep->cont[i].ul)); break; + case lUlong64T: + ret = fGetUlong64(fp, &(ep->cont[i].ul64)); + break; case lStringT: ret = fGetString(fp, &str); if (ret == 0) { @@ -1108,6 +1117,34 @@ static int fGetUlong(FILE *fp, lUlong *up) return 0; } +static int fGetUlong64(FILE *fp, lUlong64 *up) +{ + char s[READ_LINE_LENGHT + 1]; + + DENTER(CULL_LAYER, "fGetUlong64"); + + if (!fp) { + LERROR(LEFILENULL); + DEXIT; + return -1; + } + + if (fGetLine(fp, s, READ_LINE_LENGHT)) { + LERROR(LEFGETLINE); + DEXIT; + return -1; + } + + if (sscanf(s, sge_u64, up) != 1) { + LERROR(LESSCANF); + DEXIT; + return -1; + } + + DEXIT; + return 0; +} + static int fGetString(FILE *fp, lString *tp) { int i, j; diff --git a/source/libs/cull/cull_hash.c b/source/libs/cull/cull_hash.c index b435f1e..d5d2d67 100644 --- a/source/libs/cull/cull_hash.c +++ b/source/libs/cull/cull_hash.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> @@ -198,6 +199,10 @@ cull_htable cull_hash_create(const lDescr *descr, int size) ht = sge_htable_create(size, dup_func_u_long32, hash_func_u_long32, hash_compare_u_long32); break; + case lUlong64T: + ht = sge_htable_create(size, dup_func_u_long64, + hash_func_u_long64, hash_compare_u_long64); + break; default: unknownType("cull_create_hash"); ht = NULL; @@ -804,6 +809,10 @@ void *cull_hash_key(const lListElem *ep, int pos, char *host_key) key = (void *)&(ep->cont[pos].ul); break; + case lUlong64T: + key = (void *)&(ep->cont[pos].ul64); + break; + case lStringT: key = ep->cont[pos].str; break; diff --git a/source/libs/cull/cull_list.c b/source/libs/cull/cull_list.c index 94f95cc..c0afcd5 100644 --- a/source/libs/cull/cull_list.c +++ b/source/libs/cull/cull_list.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> @@ -371,6 +372,9 @@ lCopySwitchPack(const lListElem *sep, lListElem *dep, int src_idx, int dst_idx, case lUlongT: dep->cont[dst_idx].ul = sep->cont[src_idx].ul; break; + case lUlong64T: + dep->cont[dst_idx].ul64 = sep->cont[src_idx].ul64; + break; case lStringT: if (!sep->cont[src_idx].str) dep->cont[dst_idx].str = NULL; @@ -717,6 +721,9 @@ static void lWriteElem_(const lListElem *ep, dstring *buffer, int nesting_level) case lUlongT: sge_dstring_sprintf_append(buffer, "%s%-20.20s (Ulong) %c = " sge_u32"\n", space, name, changed ? '*' : ' ', lGetPosUlong(ep, i)); break; + case lUlong64T: + sge_dstring_sprintf_append(buffer, "%s%-20.20s (Ulong64) %c = " sge_u64"\n", space, name, changed ? '*' : ' ', lGetPosUlong64(ep, i)); + break; case lStringT: str = lGetPosString(ep, i); sge_dstring_sprintf_append(buffer, "%s%-20.20s (String) %c = %s\n", space, name, changed ? '*' : ' ', str ? str : "(null)"); @@ -1129,6 +1136,7 @@ void lFreeElem(lListElem **ep1) case lIntT: case lUlongT: + case lUlong64T: case lFloatT: case lDoubleT: case lLongT: diff --git a/source/libs/cull/cull_list.h b/source/libs/cull/cull_list.h index f9eaba0..fa075a6 100644 --- a/source/libs/cull/cull_list.h +++ b/source/libs/cull/cull_list.h @@ -33,6 +33,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> @@ -62,6 +63,7 @@ typedef struct _WhereArg WhereArg, *WhereArgList; typedef float lFloat; typedef double lDouble; typedef u_long32 lUlong; +typedef u_long64 lUlong64; typedef long lLong; typedef char lChar; typedef char lBool; @@ -77,6 +79,7 @@ enum _enum_lMultiType { lFloatT, lDoubleT, lUlongT, + lUlong64T, lLongT, lCharT, lBoolT, @@ -135,6 +138,7 @@ enum _enum_lMultiType { #define SGE_CHAR(name,flags) { name, lCharT | flags, NULL }, #define SGE_LONG(name,flags) { name, lLongT | flags, NULL }, #define SGE_ULONG(name,flags) { name, lUlongT | flags, NULL }, +#define SGE_ULONG64(name,flags) { name, lUlong64T | flags, NULL }, #define SGE_BOOL(name,flags) { name, lBoolT | flags, NULL }, #define SGE_LIST(name,type,flags) { name, lListT | flags, NULL }, #define SGE_MAP(name,type,flags) { name, lListT | flags, NULL }, @@ -153,6 +157,7 @@ enum _enum_lMultiType { #define SGE_CHAR_D(name,flags,def) { name, lCharT | flags, NULL }, #define SGE_LONG_D(name,flags,def) { name, lLongT | flags, NULL }, #define SGE_ULONG_D(name,flags,def) { name, lUlongT | flags, NULL }, +#define SGE_ULONG64_D(name,flags,def) { name, lUlong64T | flags, NULL }, #define SGE_BOOL_D(name,flags,def) { name, lBoolT | flags, NULL }, #define SGE_LIST_D(name,type,flags,def) { name, lListT | flags, NULL }, #define SGE_MAP_D(name,type,flags,defkey,keyvalue,jgdi_keyname,jgdi_valuename) { name, lListT | flags, NULL}, @@ -191,6 +196,7 @@ enum _enum_lMultiType { #define SGE_CHAR(name,flags) #define SGE_LONG(name,flags) #define SGE_ULONG(name,flags) +#define SGE_ULONG64(name,flags) #define SGE_BOOL(name,flags) #define SGE_LIST(name,type,flags) __SUBTYPE_MAPPING__ name type #define SGE_MAP(name,type,flags) __SUBTYPE_MAPPING__ name type @@ -205,6 +211,7 @@ enum _enum_lMultiType { #define SGE_DOUBLE_D(name,flags,def) #define SGE_CHAR_D(name,flags,def) #define SGE_LONG_D(name,flags,def) +#define SGE_LONG64_D(name,flags,def) #define SGE_ULONG_D(name,flags,def) #define SGE_BOOL_D(name,flags,def) #define SGE_LIST_D(name,type,flags,def) @@ -233,6 +240,7 @@ enum _enum_lMultiType { #define SGE_CHAR(name,flags) #define SGE_LONG(name,flags) #define SGE_ULONG(name,flags) +#define SGE_ULONG64(name,flags) #define SGE_BOOL(name,flags) #define SGE_LIST(name,type,flags) #define SGE_MAP(name,type,flags) @@ -248,6 +256,7 @@ enum _enum_lMultiType { #define SGE_CHAR_D(name,flags,def) #define SGE_LONG_D(name,flags,def) #define SGE_ULONG_D(name,flags,def) +#define SGE_ULONG64_D(name,flags,def) #define SGE_BOOL_D(name,flags,def) #define SGE_LIST_D(name,type,flags,def) #define SGE_MAP_D(name,type,flags,defkey,keyvalue,jgdi_keyname,jgdi_valuename) diff --git a/source/libs/cull/cull_multitype.c b/source/libs/cull/cull_multitype.c index e9583b9..a26eb6a 100644 --- a/source/libs/cull/cull_multitype.c +++ b/source/libs/cull/cull_multitype.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdarg.h> #include <stdio.h> @@ -65,6 +66,7 @@ const char *multitypes[] = "lFloatT", "lDoubleT", "lUlongT", + "lUlong64T", "lLongT", "lCharT", "lBoolT", @@ -795,6 +797,75 @@ lUlong lGetUlong(const lListElem *ep, int name) return (lUlong) ep->cont[pos].ul; } +/****** cull/multitype/lGetPosUlong64() ************************************** +* NAME +* lGetPosUlong64() -- Returns the ulong64 value at position pos +* +* SYNOPSIS +* lUlong64 lGetPosUlong64(const lListElem *ep, int pos) +* +* FUNCTION +* Returns the ulong64 value at position pos +* +* INPUTS +* const lListElem *ep - element +* int pos - pos value +* +* RESULT +* lUlong64 - ulong64 +******************************************************************************/ +lUlong64 lGetPosUlong64(const lListElem *ep, int pos) +{ + DENTER(CULL_BASIS_LAYER, "lGetPosUlong64"); + + if (pos < 0) { + /* someone has called lGetPosUlong64() */ + /* makro with an invalid nm */ + CRITICAL((SGE_EVENT, MSG_CULL_GETPOSULONG64_GOTINVALIDPOSITION )); + DEXIT; + abort(); + } + + if (mt_get_type(ep->descr[pos].mt) != lUlong64T) + incompatibleType("lGetPosUlong64"); + DEXIT; + return (lUlong64) ep->cont[pos].ul64; +} + +/****** cull/multitype/lGetUlong64() ****************************************** +* NAME +* lGetUlong64() -- Return 'u_long64' value for specified fieldname +* +* SYNOPSIS +* lUlong64 lGetUlong64(const lListElem *ep, int name) +* +* FUNCTION +* Return the content of the field specified by fieldname 'name' of +* list element 'ep'. The type of the field 'name' has to be of +* type 'u_long64'. +* +* INPUTS +* const lListElem *ep - Pointer to list element +* int name - field name +* +* RESULT +* lUlong64 - u_long64 value +******************************************************************************/ +lUlong64 lGetUlong64(const lListElem *ep, int name) +{ + int pos; + DENTER(CULL_BASIS_LAYER, "lGetUlong64"); + + pos = lGetPosViaElem(ep, name, SGE_DO_ABORT); + + if (mt_get_type(ep->descr[pos].mt) != lUlong64T) + incompatibleType2(MSG_CULL_GETULONG64_WRONGTYPEFORFIELDXY_SS, + lNm2Str(name), multitypes[mt_get_type(ep->descr[pos].mt)]); + + DEXIT; + return (lUlong64) ep->cont[pos].ul64; +} + /****** cull/multitype/lGetPosString() **************************************** * NAME * lGetPosString() -- Returns the string ptr value at position pos @@ -1800,6 +1871,209 @@ int lAddUlong(lListElem *ep, int name, lUlong offset) return 0; } +/****** cull/multitype/lSetUlong64() ****************************************** +* NAME +* lSetUlong64() -- Set ulong value at the given field name id +* +* SYNOPSIS +* int lSetUlong64(lListElem *ep, int name, lUlong64 value) +* +* FUNCTION +* Set ulong64 value at the given field name id +* +* INPUTS +* lListElem *ep - element +* int name - field name id +* lUlong64 value - new value +* +* RESULT +* int - error state +* 0 - OK +* -1 - Error +******************************************************************************/ +int lSetUlong64(lListElem *ep, int name, lUlong64 value) +{ + int pos; + + DENTER(CULL_BASIS_LAYER, "lSetUlong64"); + + if (!ep) { + LERROR(LEELEMNULL); + DEXIT; + return -1; + } + + pos = lGetPosViaElem(ep, name, SGE_NO_ABORT); + if (pos < 0) { + DPRINTF(("!!!!!!!!!! lSetUlong64(): %s not found in element !!!!!!!!!!\n", + lNm2Str(name))); + DEXIT; + return -1; + } + + if (mt_get_type(ep->descr[pos].mt) != lUlong64T) { + incompatibleType2(MSG_CULL_SETULONG64_WRONGTYPEFORFIELDXY_SS , lNm2Str(name), multitypes[mt_get_type(ep->descr[pos].mt)]); + DEXIT; + return -1; + } + + if(value != ep->cont[pos].ul64) { + /* remove old hash entry */ + if(ep->descr[pos].ht != NULL) { + cull_hash_remove(ep, pos); + } + + ep->cont[pos].ul64 = value; + + /* create entry in hash table */ + if(ep->descr[pos].ht != NULL) { + cull_hash_insert(ep, (void *)&(ep->cont[pos].ul64), ep->descr[pos].ht, + mt_is_unique(ep->descr[pos].mt)); + } + + /* remember that field changed */ + sge_bitfield_set(&(ep->changed), pos); + } + + DEXIT; + return 0; +} + +/****** cull_multitype/lAddUlong64() ******************************************* +* NAME +* lAddUlong64() -- Adds a lUlong64 offset to the lUlong64 field +* +* SYNOPSIS +* int lAddUlong64(lListElem *ep, int name, lUlong64 offset) +* +* FUNCTION +* The 'offset' is added to the lUlong64 field 'name' of +* the CULL element 'ep'. +* +* INPUTS +* lListElem *ep - element +* int name - field name id +* lUlong64 offset - the offset +* +* RESULT +* int - +* +* EXAMPLE +* int - error state +* 0 - OK +* -1 - Error +*******************************************************************************/ +int lAddUlong64(lListElem *ep, int name, lUlong64 offset) +{ + int pos; + + DENTER(CULL_BASIS_LAYER, "lAddUlong64"); + + if (!ep) { + LERROR(LEELEMNULL); + DEXIT; + return -1; + } + + pos = lGetPosViaElem(ep, name, SGE_NO_ABORT); + if (pos < 0) { + DPRINTF(("!!!!!!!!!! lSetUlong64(): %s not found in element !!!!!!!!!!\n", + lNm2Str(name))); + DEXIT; + return -1; + } + + if (mt_get_type(ep->descr[pos].mt) != lUlong64T) { + incompatibleType2(MSG_CULL_SETULONG64_WRONGTYPEFORFIELDXY_SS , lNm2Str(name), multitypes[mt_get_type(ep->descr[pos].mt)]); + DEXIT; + return -1; + } + + if (offset != 0) { + /* remove old hash entry */ + if(ep->descr[pos].ht != NULL) { + cull_hash_remove(ep, pos); + } + + ep->cont[pos].ul64 += offset; + + /* create entry in hash table */ + if(ep->descr[pos].ht != NULL) { + cull_hash_insert(ep, (void *)&(ep->cont[pos].ul64), ep->descr[pos].ht, + mt_is_unique(ep->descr[pos].mt)); + } + + /* remember that field changed */ + sge_bitfield_set(&(ep->changed), pos); + } + + DEXIT; + return 0; +} + +/****** cull/multitype/lSetPosUlong64() *************************************** +* NAME +* lSetPosUlong64() -- Get ulong64 at a certain position +* +* SYNOPSIS +* int lSetPosUlong64(lListElem *ep, int pos, lUlong64 value) +* +* FUNCTION +* Get ulong64 at a certain position +* +* INPUTS +* lListElem *ep - element +* int pos - position +* lUlong64 value - new value +* +* RESULT +* int - error state +* 0 - OK +* -1 - Error +*******************************************************************************/ +int lSetPosUlong64(lListElem *ep, int pos, lUlong64 value) +{ + DENTER(CULL_BASIS_LAYER, "lSetPosUlong64"); + if (!ep) { + LERROR(LEELEMNULL); + DEXIT; + return -1; + } + + if (pos < 0) { + LERROR(LENEGPOS); + DEXIT; + return -1; + } + + if (mt_get_type(ep->descr[pos].mt) != lUlong64T) { + incompatibleType("lSetPosUlong64"); + DEXIT; + return -1; + } + + if(value != ep->cont[pos].ul64) { + /* remove old hash entry */ + if(ep->descr[pos].ht != NULL) { + cull_hash_remove(ep, pos); + } + + ep->cont[pos].ul64 = value; + + /* create entry in hash table */ + if(ep->descr[pos].ht != NULL) { + cull_hash_insert(ep, (void *)&(ep->cont[pos].ul64), ep->descr[pos].ht, + mt_is_unique(ep->descr[pos].mt)); + } + + /* remember that field changed */ + sge_bitfield_set(&(ep->changed), pos); + } + + DEXIT; + return 0; +} + /****** cull/multitype/lSetPosString() *************************************** * NAME * lSetPosString() -- Sets the string at a certain position @@ -3343,6 +3617,15 @@ int bitmaskcmp(lUlong bm0, lUlong bm1) } /* ------------------------------------------------------------ + compares two ulong64 values u0 and u1 + return values like strcmp + */ +int ulong64cmp(lUlong64 u0, lUlong64 u1) +{ + return u0 == u1 ? 0 : (u0 < u1 ? -1 : 1); +} + +/* ------------------------------------------------------------ compares two lFloat values f0 and f1 return values like strcmp */ @@ -4500,6 +4783,430 @@ lListElem *lGetElemUlongNext(const lList *lp, int nm, lUlong val, return NULL; } +/****** cull/multitype/lAddSubUlong64() *************************************** +* NAME +* lAddSubUlong64() -- adds ulong64 to the ulong64 sublist of element ep +* +* SYNOPSIS +* lListElem* lAddSubUlong64(lListElem* ep, int nm, lUlong64 val, +* int snm, const lDescr* dp) +* +* FUNCTION +* This function adds a new element into the sublist snm of the +* element ep. The field nm of the added element will get the +* initial value val. +* +* INPUTS +* lListElem* ep - element +* int nm - field which will get value val +* lUlong64 val - initial value for nm +* int snm - sublist within ep where the element +* will be added +* const lDescr* dp - Type of the new element (e.g. JB_Type) +* +* RESULT +* NULL in case of error +* or the pointer to the new element +******************************************************************************/ +lListElem *lAddSubUlong64(lListElem *ep, int nm, lUlong64 val, int snm, + const lDescr *dp) +{ + lListElem *ret; + int sublist_pos; + + DENTER(CULL_LAYER, "lAddSubUlong64"); + + if (!ep) { + DPRINTF(("error: NULL ptr passed to lAddSubUlong64\n")); + DEXIT; + return NULL; + } + + if (!(ep->descr)) { + DPRINTF(("NULL descriptor in element not allowed !!!")); + DEXIT; + abort(); + } + + /* run time type checking */ + if ((sublist_pos = lGetPosViaElem(ep, snm, SGE_NO_ABORT)) < 0) { + CRITICAL((SGE_EVENT, MSG_CULL_ADDSUBULONG64ERRORXRUNTIMETYPE_S , lNm2Str(snm))); + DEXIT; + return NULL; + } + + ret = lAddElemUlong64(&(ep->cont[sublist_pos].glp), nm, val, dp); + + /* remember that field changed */ + if (ret != NULL) { + sge_bitfield_set(&(ep->changed), sublist_pos); + } + + DEXIT; + return ret; +} + +/****** cull/multitype/lAddElemUlong64() ************************************** +* NAME +* lAddElemUlong64() -- adds a ulong64 to the ulong64 list +* +* SYNOPSIS +* lListElem* lAddElemUlong64(lList** lpp, int nm, lUlong64 val, +* const lDescr* dp) +* +* FUNCTION +* Adds an new element to a list lpp where one field nm within +* the new element gets an initial value val +* +* INPUTS +* lList** lpp - list +* int nm - field in the new element which will get +* value val +* lUlong64 val - initial value for nm +* const lDescr* dp - type of the list (e.g. JB_Type) +* +* RESULT +* NULL on error +* or pointer to the added element +******************************************************************************/ +lListElem *lAddElemUlong64(lList **lpp, int nm, lUlong64 val, const lDescr *dp) +{ + lListElem *sep; + int pos; + + DENTER(CULL_LAYER, "lAddElemUlong64"); + + if (!lpp || !dp) { + DPRINTF(("error: NULL ptr passed to lAddElemUlong64\n")); + DEXIT; + return NULL; + } + + /* get position of nm in sdp */ + pos = lGetPosInDescr(dp, nm); + + /* run time type checking */ + if (pos < 0) { + CRITICAL((SGE_EVENT, MSG_CULL_ADDELEMULONG64ERRORXRUNTIMETYPE_S, + lNm2Str(nm))); + DEXIT; + return NULL; + } + + if (!*lpp) { + /* ensure existence of a val list in ep */ + *lpp = lCreateList("ulong64_sublist", dp); + } + + /* add new host val element to sublist */ + sep = lCreateElem(dp); + lSetPosUlong64(sep, pos, val); + lAppendElem(*lpp, sep); + + DEXIT; + return sep; +} + +/****** cull/multitype/lDelSubUlong64() *************************************** +* NAME +* lDelSubUlong64() -- removes an element from a sublist +* +* SYNOPSIS +* int lDelSubUlong64(lListElem* ep, int nm, lUlong64 val, int snm) +* +* FUNCTION +* This function removes an element specified by a ulong field nm +* and the ulong64 val supposed to be in the sublist snm of the +* element ep +* +* INPUTS +* lListElem* ep - element +* int nm - field id +* lUlong64 val - value +* int snm - field id of the sublist in ep +* +* RESULT +* 1 element was found and removed +* 0 in case of an error +******************************************************************************/ +int lDelSubUlong64(lListElem *ep, int nm, lUlong64 val, int snm) +{ + int ret, sublist_pos; + + DENTER(CULL_LAYER, "lDelSubUlong64"); + + /* get position of sublist in ep */ + sublist_pos = lGetPosViaElem(ep, snm, SGE_DO_ABORT); + + ret = lDelElemUlong64(&(ep->cont[sublist_pos].glp), nm, val); + + /* remember that field changed */ + if (ret == 1) { + sge_bitfield_set(&(ep->changed), sublist_pos); + } + + DEXIT; + return ret; +} + +/****** cull/multitype/lDelElemUlong64() ************************************** +* NAME +* lDelElemUlong64() -- removes elem specified by a ulong64 field nm +* +* SYNOPSIS +* int lDelElemUlong64(lList** lpp, int nm, lUlong64 val) +* +* FUNCTION +* This function removes an element specified by a ulong64 field nm +* with the value val from the list referenced by lpp. +* +* INPUTS +* lList** lpp - reference to a list +* int nm - field id +* lUlong64 val - value if nm +* +* RESULT +* 1 element was found and removed +* 0 an error occured +******************************************************************************/ +int lDelElemUlong64(lList **lpp, int nm, lUlong64 val) +{ + lListElem *ep; + + DENTER(CULL_LAYER, "lDelElemUlong64"); + + if (!lpp || !val) { + DPRINTF(("error: NULL ptr passed to lDelElemUlong64\n")); + DEXIT; + return 0; + } + + /* empty list ? */ + if (!*lpp) { + DEXIT; + return 1; + } + + /* seek element */ + ep = lGetElemUlong64(*lpp, nm, val); + if (ep) { + lRemoveElem(*lpp, &ep); + if (lGetNumberOfElem(*lpp) == 0) { + lFreeList(lpp); + } + } + + DEXIT; + return 1; +} + +/****** cull/multitype/lGetSubUlong64() ***************************************** +* NAME +* lGetSubUlong64() -- Element specified by a ulong64 field nm +* +* SYNOPSIS +* lListElem* lGetSubUlong64(const lListElem* ep, int nm, +* lUlong64 val, int snm) +* +* FUNCTION +* returns an element specified by a ulong64 field nm an the ulong64 +* value val from the sublist snm of the element ep +* +* INPUTS +* const lListElem* ep - element pointer +* int nm - field id which is part of a sublist +* element of ep +* lUlong64 val - unsigned long value +* int snm - field id of a list which is part of ep +* +* RESULT +* NULL if element was not found or in case of an error +* otherwise pointer to the element +******************************************************************************/ +lListElem *lGetSubUlong64(const lListElem *ep, int nm, lUlong64 val, int snm) +{ + int sublist_pos; + lListElem *ret; + + DENTER(CULL_LAYER, "lGetSubUlong64"); + + /* get position of sublist in ep */ + sublist_pos = lGetPosViaElem(ep, snm, SGE_DO_ABORT); + + ret = lGetElemUlong64(ep->cont[sublist_pos].glp, nm, val); + + DEXIT; + return ret; +} + +/****** cull/multitype/lGetElemUlong64() ************************************** +* NAME +* lGetElemUlong64() -- returns element specified by a ulong64 field nm +* +* SYNOPSIS +* lListElem* lGetElemUlong64(const lList* lp, int nm, lUlong64 val) +* +* FUNCTION +* returns an element specified by a ulong64 field nm an an ulong64 +* value val from list lp +* +* INPUTS +* const lList* lp - list pointer +* int nm - field id +* lUlong64 val - unsigned long value +* +* RESULT +* NULL if element was not found or an error occured +* otherwise pointer to element +******************************************************************************/ +lListElem *lGetElemUlong64(const lList *lp, int nm, lUlong64 val) +{ + const void *iterator = NULL; + return lGetElemUlong64First(lp, nm, val, &iterator); +} + +/****** cull/multitype/lGetElemUlong64First() ********************************* +* NAME +* lGetElemUlong64First() -- Find first ulong64 within a list +* +* SYNOPSIS +* lListElem* lGetElemUlong64First(const lList *lp, +* int nm, +* lUlong64 val, +* const void **iterator) +* +* FUNCTION +* Return the first element of list 'lp' where the attribute +* with field name id 'nm' is equivalent with 'val'. Context +* information will be stored in 'iterator'. 'iterator' might +* be used in lGetElemUlong64Next() to get the next element. +* +* INPUTS +* const lList *lp - list +* int nm - ulong64 field name id +* lUlong64 val - ulong64 value +* const void **iterator - iterator +* +* RESULT +* lListElem* - element or NULL +******************************************************************************/ +lListElem *lGetElemUlong64First(const lList *lp, int nm, lUlong64 val, + const void **iterator) +{ + lListElem *ep = NULL; + int pos; + + DENTER(CULL_LAYER, "lGetElemUlong64First"); + + /* empty list ? */ + if (!lp) { + DEXIT; + return NULL; + } + + /* get position of nm in sdp */ + pos = lGetPosInDescr(lGetListDescr(lp), nm); + + /* run time type checking */ + if (pos < 0) { + CRITICAL((SGE_EVENT, MSG_CULL_GETELEMULONG64ERRORXRUNTIMETYPE_S, lNm2Str(nm))); + DEXIT; + return NULL; + } + + *iterator = NULL; + + if(lp->descr[pos].ht != NULL) { + /* hash access */ + ep = cull_hash_first(lp->descr[pos].ht, &val, + mt_is_unique(lp->descr[pos].mt), iterator); + DEXIT; + return ep; + } else { + /* seek for element */ + for_each(ep, lp) { + lUlong64 s = lGetPosUlong64(ep, pos); + if (s == val) { + *iterator = ep; + DEXIT; + return ep; + } + } + } + + DEXIT; + return NULL; +} + +/****** cull/multitype/lGetElemUlong64Next() ********************************** +* NAME +* lGetElemUlong64Next() -- Find next ulong64 element within a list +* +* SYNOPSIS +* lListElem* lGetElemUlong64Next(const lList *lp, +* int nm, +* lUlong64 val, +* const void **iterator) +* +* FUNCTION +* This function might be used after a call to lGetElemUlong64First(). +* It expects 'iterator' to contain context information which +* makes it possible to find the next element within list 'lp' +* where the attribute with field name id 'nm' is equivalent with +* 'val'. +* +* INPUTS +* const lList *lp - list +* int nm - ulong64 field name id +* lUlong64 val - value +* const void **iterator - iterator +* +* RESULT +* lListElem* - next element or NULL +******************************************************************************/ +lListElem *lGetElemUlong64Next(const lList *lp, int nm, lUlong64 val, + const void **iterator) +{ + lListElem *ep; + int pos; + + DENTER(CULL_LAYER, "lGetElemUlong64Next"); + + if(*iterator == NULL) { + return NULL; + } + + /* get position of nm in sdp */ + pos = lGetPosInDescr(lGetListDescr(lp), nm); + + /* run time type checking */ + if (pos < 0) { + CRITICAL((SGE_EVENT, MSG_CULL_GETELEMULONG64ERRORXRUNTIMETYPE_S, lNm2Str(nm))); + DEXIT; + return NULL; + } + + if(lp->descr[pos].ht != NULL) { + /* hash access */ + ep = cull_hash_next(lp->descr[pos].ht, iterator); + DEXIT; + return ep; + } else { + /* seek for element */ + for (ep = ((lListElem *)*iterator)->next; ep; ep = ep->next) { + lUlong64 s = lGetPosUlong64(ep, pos); + if (s == val) { + *iterator = ep; + DEXIT; + return ep; + } + } + } + + *iterator = NULL; + DEXIT; + return NULL; +} /****** cull/multitype/lDelSubCaseStr() *************************************** * NAME * lDelSubCaseStr() -- removes elem specified by a string field nm diff --git a/source/libs/cull/cull_multitype.h b/source/libs/cull/cull_multitype.h index a48c18e..d0ca65c 100644 --- a/source/libs/cull/cull_multitype.h +++ b/source/libs/cull/cull_multitype.h @@ -30,6 +30,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> @@ -75,6 +76,7 @@ int lSwapList(lListElem *to, int to_nm, lListElem *from, int from_nm); lInt lGetPosInt(const lListElem *ep, int id); lUlong lGetPosUlong(const lListElem *ep, int id); +lUlong64 lGetPosUlong64(const lListElem *ep, int id); const char *lGetPosString(const lListElem *ep, int id); const char *lGetPosHost(const lListElem *ep, int id); lList *lGetPosList(const lListElem *ep, int id); @@ -88,6 +90,7 @@ lRef lGetPosRef(const lListElem *ep, int id); int lSetPosInt(lListElem *ep, int pos, int value); int lSetPosUlong(lListElem *ep, int pos, lUlong value); +int lSetPosUlong64(lListElem *ep, int pos, lUlong64 value); int lSetPosString(lListElem *ep, int pos, const char *value); int lSetPosHost(lListElem *ep, int pos, const char *value); @@ -102,6 +105,7 @@ int lSetPosRef(lListElem *ep, int pos, lRef value); lInt lGetInt(const lListElem *ep, int name); lUlong lGetUlong(const lListElem *ep, int name); +lUlong64 lGetUlong64(const lListElem *ep, int name); const char *lGetString(const lListElem *ep, int name); const char *lGetHost(const lListElem *ep, int name); lList *lGetList(const lListElem *ep, int name); @@ -116,6 +120,7 @@ lRef lGetRef(const lListElem *ep, int name); int lSetInt(lListElem *ep, int name, int value); int lSetUlong(lListElem *ep, int name, lUlong value); +int lSetUlong64(lListElem *ep, int name, lUlong64 value); int lSetString(lListElem *ep, int name, const char *value); int lSetHost(lListElem *ep, int name, const char *value); int lSetList(lListElem *ep, int name, lList *value); @@ -129,10 +134,12 @@ int lSetRef(lListElem *ep, int name, lRef value); int lAddDouble(lListElem *ep, int name, lDouble offset); int lAddUlong(lListElem *ep, int name, lUlong offset); +int lAddUlong64(lListElem *ep, int name, lUlong64 offset); int intcmp(lInt i0, lInt i1); int ulongcmp(lUlong u0, lUlong u1); int bitmaskcmp(lUlong bm0, lUlong bm1); +int ulong64cmp(lUlong64 u0, lUlong64 u1); int floatcmp(lFloat u0, lFloat u1); int doublecmp(lDouble u0, lDouble u1); int charcmp(lChar u0, lChar u1); @@ -195,6 +202,25 @@ lListElem *lGetSubUlong(const lListElem *ep, int nm, lUlong val, int snm); /* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + functions for lists with a ulong64 as key + +*/ +lListElem* lAddElemUlong64(lList **lpp, int nm, lUlong64 val, const lDescr *dp); +int lDelElemUlong64(lList **lpp, int nm, lUlong64 val); +lListElem *lGetElemUlong64(const lList *lp, int nm, lUlong64 val); +lListElem *lGetElemUlong64First(const lList *lp, int nm, lUlong64 val, const void **iterator); +lListElem *lGetElemUlong64Next(const lList *lp, int nm, lUlong64 val, const void **iterator); + +/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + + functions for sublists with a ulong64 as key + +*/ +lListElem* lAddSubUlong64(lListElem *ep, int nm, lUlong64 val, int snm, const lDescr *dp); +int lDelSubUlong64(lListElem *ep, int nm, lUlong64 val, int snm); +lListElem *lGetSubUlong64(const lListElem *ep, int nm, lUlong64 val, int snm); +/* - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - + functions for lists with a case insensitive char * as key */ diff --git a/source/libs/cull/cull_multitypeP.h b/source/libs/cull/cull_multitypeP.h index 9d64ed1..713ae71 100644 --- a/source/libs/cull/cull_multitypeP.h +++ b/source/libs/cull/cull_multitypeP.h @@ -30,6 +30,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include "cull/cull_list.h" @@ -39,6 +40,7 @@ union _lMultiType { lFloat fl; lDouble db; lUlong ul; + lUlong64 ul64; lLong l; lChar c; lBool b; diff --git a/source/libs/cull/cull_pack.c b/source/libs/cull/cull_pack.c index de3affc..25f593f 100644 --- a/source/libs/cull/cull_pack.c +++ b/source/libs/cull/cull_pack.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> #include <stdlib.h> @@ -110,6 +111,11 @@ int flags dst->ul = i; break; + case lUlong64T: + ret = unpackint(pb, &i); + dst->ul64 = i; + break; + case lStringT: ret = unpackstr(pb, &(dst->str)); break; @@ -179,6 +185,10 @@ cull_pack_switch(sge_pack_buffer *pb, const lMultiType *src, lEnumeration *what, ret = packint(pb, src->ul); break; + case lUlong64T: + ret = packint(pb, src->ul64); + break; + case lStringT: ret = packstr(pb, src->str); break; diff --git a/source/libs/cull/cull_parse.c b/source/libs/cull/cull_parse.c index 61ecc76..f71001f 100644 --- a/source/libs/cull/cull_parse.c +++ b/source/libs/cull/cull_parse.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> #include <string.h> @@ -102,6 +103,7 @@ cull_parse_state *state "%d", /* INT */ "%s", /* STRING */ "%u", /* ULONG */ + "%lu", /* ULONG64 */ "%l", /* SUBLIST */ "%f", /* FLOAT */ "%g", /* DOUBLE */ diff --git a/source/libs/cull/cull_parse.h b/source/libs/cull/cull_parse.h index da3ecae..65d591b 100644 --- a/source/libs/cull/cull_parse.h +++ b/source/libs/cull/cull_parse.h @@ -30,6 +30,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ @@ -63,6 +64,7 @@ enum { INT, STRING, ULONG, + ULONG64, SUBLIST, FLOAT, DOUBLE, diff --git a/source/libs/cull/cull_sort.c b/source/libs/cull/cull_sort.c index 0798f09..07aad7a 100644 --- a/source/libs/cull/cull_sort.c +++ b/source/libs/cull/cull_sort.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> #include <stdlib.h> @@ -159,6 +160,9 @@ const lSortOrder *sp case lUlongT: result = ulongcmp(lGetPosUlong(ep0, sp[i].pos), lGetPosUlong(ep1, sp[i].pos)); break; + case lUlong64T: + result = ulong64cmp(lGetPosUlong64(ep0, sp[i].pos), lGetPosUlong64(ep1, sp[i].pos)); + break; case lFloatT: result = floatcmp(lGetPosFloat(ep0, sp[i].pos), lGetPosFloat(ep1, sp[i].pos)); break; diff --git a/source/libs/cull/cull_where.c b/source/libs/cull/cull_where.c index c9f8199..118f256 100644 --- a/source/libs/cull/cull_where.c +++ b/source/libs/cull/cull_where.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include <stdio.h> @@ -273,6 +274,13 @@ static void lWriteWhereTo_(const lCondition *cp, int depth, FILE *fp) fprintf(fp, "%s "sge_u32"\n", out, cp->operand.cmp.val.ul); } break; + case lUlong64T: + if (!fp) { + DPRINTF(("%s "sge_u64"\n", out, cp->operand.cmp.val.ul64)); + } else { + fprintf(fp, "%s "sge_u64"\n", out, cp->operand.cmp.val.ul64); + } + break; case lStringT: if (!fp) { DPRINTF(("%s \"%s\"\n", out, cp->operand.cmp.val.str)); @@ -705,6 +713,12 @@ static lCondition *read_val(lDescr *dp, cull_parse_state *state, va_list *app) cp->operand.cmp.val.ul = va_arg(*app, lUlong); break; + case ULONG64: + if (mt_get_type(cp->operand.cmp.mt) != lUlong64T) + incompatibleType(MSG_CULL_WHERE_SHOULDBEULONG64T); + cp->operand.cmp.val.ul64 = va_arg(*app, lUlong64); + break; + case FLOAT: if (mt_get_type(cp->operand.cmp.mt) != lFloatT) incompatibleType(MSG_CULL_WHERE_SHOULDBEFLOATT); @@ -998,6 +1012,13 @@ static lCondition *_read_val(lDescr *dp, cull_parse_state *state, WhereArgList * cp->operand.cmp.val.ul = (*wapp)++->value.ul; break; + case ULONG64: + if (mt_get_type(cp->operand.cmp.mt) != lUlong64T) + incompatibleType(MSG_CULL_WHERE_SHOULDBEULONG64T); +/* DPRINTF(("(*wapp)->value.ul64 = %ul\n", (*wapp)->value.ul64)); */ + cp->operand.cmp.val.ul64 = (*wapp)++->value.ul64; + break; + case FLOAT: if (mt_get_type(cp->operand.cmp.mt) != lFloatT) incompatibleType(MSG_CULL_WHERE_SHOULDBEFLOATT); @@ -1053,7 +1074,8 @@ static lCondition *_read_val(lDescr *dp, cull_parse_state *state, WhereArgList * "p=" as operator is not allowed with other types than lStringT "h=" as operator is not allowed with other types than lStringT */ - if ((cp->op == BITMASK && mt_get_type(cp->operand.cmp.mt) != lUlongT ) || + if ((cp->op == BITMASK && mt_get_type(cp->operand.cmp.mt) != lUlongT ) || + ( cp->op == BITMASK && mt_get_type(cp->operand.cmp.mt) != lUlong64T ) || ( (cp->op == STRCASECMP && mt_get_type(cp->operand.cmp.mt) != lStringT) && (cp->op == STRCASECMP && mt_get_type(cp->operand.cmp.mt) != lHostT) ) || ( (cp->op == HOSTNAMECMP && mt_get_type(cp->operand.cmp.mt) != lStringT) && (cp->op == HOSTNAMECMP && mt_get_type(cp->operand.cmp.mt) != lHostT) ) || ( (cp->op == PATTERNCMP && mt_get_type(cp->operand.cmp.mt) != lStringT) && (cp->op == PATTERNCMP && mt_get_type(cp->operand.cmp.mt) != lHostT) )) @@ -1215,6 +1237,10 @@ int lCompare(const lListElem *ep, const lCondition *cp) result = ulongcmp(lGetPosUlong(ep, cp->operand.cmp.pos), cp->operand.cmp.val.ul); break; + case lUlong64T: + result = ulong64cmp(lGetPosUlong64(ep, cp->operand.cmp.pos), + cp->operand.cmp.val.ul64); + break; case lListT: result = (lFindFirst(lGetPosList(ep, cp->operand.cmp.pos), cp->operand.cmp.val.cp) != NULL); @@ -1431,6 +1457,9 @@ lCondition *lCopyWhere(const lCondition *cp) case lUlongT: new->operand.cmp.val.ul = cp->operand.cmp.val.ul; break; + case lUlong64T: + new->operand.cmp.val.ul64 = cp->operand.cmp.val.ul64; + break; case lStringT: new->operand.cmp.val.str = strdup(cp->operand.cmp.val.str); break; diff --git a/source/libs/cull/msg_cull.h b/source/libs/cull/msg_cull.h index 86f284b..f9b0572 100644 --- a/source/libs/cull/msg_cull.h +++ b/source/libs/cull/msg_cull.h @@ -30,6 +30,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include "basis_types.h" @@ -199,5 +200,15 @@ #define MSG_CULL_XNOTFOUNDINELEMENT_S _MESSAGE(41068, _("!!!!!!!!!! "SFN" not found in element !!!!!!!!!!")) #define MSG_CULL_POINTER_NULLELEMENTFORX_S _MESSAGE(41069, _("!!!!!!!!!! got NULL element for "SFN" !!!!!!!!!!")) +/* +** Messages for lUlong64 +*/ #endif /* __MSG_CULL_H */ - +#define MSG_CULL_GETULONG64_WRONGTYPEFORFIELDXY_SS _MESSAGE(41170, _("lGetUlong64: wrong type for field "SFN" ("SFN")")) +#define MSG_CULL_SETULONG64_WRONGTYPEFORFIELDXY_SS _MESSAGE(41171, _("lSetUlong64: wrong type for field "SFN" ("SFN")")) +#define MSG_CULL_ADDSUBULONG64ERRORXRUNTIMETYPE_S _MESSAGE(41172, _("error: lAddSubUlong64("SFN"): run time type error")) +#define MSG_CULL_ADDELEMULONG64ERRORXRUNTIMETYPE_S _MESSAGE(41173, _("error: lAddElemUlong64("SFN"): run time type error")) +#define MSG_CULL_DELELEMULONG64ERRORXRUNTIMETYPE_S _MESSAGE(41174, _("error: lDelElemUlong64("SFN"): run time type error")) +#define MSG_CULL_GETELEMULONG64ERRORXRUNTIMETYPE_S _MESSAGE(41175, _("error: lGetElemUlong64("SFN"): run time type error")) +#define MSG_CULL_GETPOSULONG64_GOTINVALIDPOSITION _MESSAGE(41176, _("!!!!!!!!!! lGetPosUlong64() got an invalid pos !!!!!!!!!!!!")) +#define MSG_CULL_WHERE_SHOULDBEULONG64T _MESSAGE(41177, _("lWhere (should be a lUlong64T)")) diff --git a/source/libs/sgeobj/sge_procL.h b/source/libs/sgeobj/sge_procL.h index b72a7d2..a75469b 100644 --- a/source/libs/sgeobj/sge_procL.h +++ b/source/libs/sgeobj/sge_procL.h @@ -30,6 +30,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ #include "cull/cull.h" @@ -50,7 +51,7 @@ extern "C" { * Number of jiffies that this process has been scheduled in user mode. * SGE_ULONG (PRO_stime) * Number of jiffies that this process has been scheduled in kernel mode. -* SGE_ULONG (PRO_vsize) +* SGE_ULONG64 (PRO_vsize) * Virtual memory size in bytes. * SGE_LIST (PRO_groups) * GR_Type list with all groups associated with this process. @@ -76,7 +77,7 @@ LISTDEF( PRO_Type ) SGE_ULONG ( PRO_pid, CULL_PRIMARY_KEY | CULL_HASH | CULL_UNIQUE ) SGE_ULONG ( PRO_utime, CULL_DEFAULT ) SGE_ULONG ( PRO_stime, CULL_DEFAULT ) - SGE_ULONG ( PRO_vsize, CULL_DEFAULT ) + SGE_ULONG64 ( PRO_vsize, CULL_DEFAULT ) SGE_LIST ( PRO_groups, GR_Type, CULL_DEFAULT ) SGE_BOOL ( PRO_rel, CULL_DEFAULT ) SGE_BOOL ( PRO_run, CULL_DEFAULT ) diff --git a/source/libs/uti/sge_htable.c b/source/libs/uti/sge_htable.c index 28b7040..7e8aa33 100644 --- a/source/libs/uti/sge_htable.c +++ b/source/libs/uti/sge_htable.c @@ -28,6 +28,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ /* * Based on David Flanagan's Xmt libary's Hash.c @@ -536,6 +537,18 @@ const void *dup_func_u_long32(const void *key) return dup_key; } +const void *dup_func_u_long64(const void *key) +{ + u_long64 *dup_key = NULL; + u_long64 *cast = (u_long64 *)key; + + if((dup_key = (u_long64 *)malloc(sizeof(u_long64))) != NULL) { + *dup_key = *cast; + } + + return dup_key; +} + const void *dup_func_long(const void *key) { long *dup_key = NULL; @@ -597,6 +610,12 @@ int hash_func_u_long32(const void *key) return (int)*cast; } +int hash_func_u_long64(const void *key) +{ + u_long64 *cast = (u_long64 *)key; + return (int)*cast; +} + int hash_func_long(const void *key) { long *cast = (long*)key; @@ -663,6 +682,13 @@ int hash_compare_u_long32(const void *a, const void *b) return *cast_a - *cast_b; } +int hash_compare_u_long64(const void *a, const void *b) +{ + u_long64 *cast_a = (u_long64 *)a; + u_long64 *cast_b = (u_long64 *)b; + return *cast_a - *cast_b; +} + int hash_compare_long(const void *a, const void *b) { long *cast_a = (long*)a; diff --git a/source/libs/uti/sge_htable.h b/source/libs/uti/sge_htable.h index 678646f..de6a65c 100644 --- a/source/libs/uti/sge_htable.h +++ b/source/libs/uti/sge_htable.h @@ -30,6 +30,7 @@ * All Rights Reserved. * ************************************************************************/ +/* Portions of this code are Copyright (c) 2011 Univa Corporation. */ /*___INFO__MARK_END__*/ /* * Based on the code of David Flanagan's Xmt library @@ -56,17 +57,20 @@ void sge_htable_for_each(htable ht, sge_htable_for_each_proc proc); const char *sge_htable_statistics(htable ht, dstring *buffer); const void *dup_func_u_long32(const void *key); +const void *dup_func_u_long64(const void *key); const void *dup_func_string(const void *key); const void *dup_func_long(const void *key); const void *dup_func_pointer(const void *key); int hash_func_u_long32(const void *key); +int hash_func_u_long64(const void *key); int hash_func_string(const void *key); int hash_func_long(const void *key); int hash_func_pointer(const void *key); int hash_compare_u_long32(const void *a, const void *b); +int hash_compare_u_long64(const void *a, const void *b); int hash_compare_string(const void *a, const void *b); int hash_compare_long(const void *a, const void *b); int hash_compare_pointer(const void *a, const void *b);