[torquedev] [PATCH] Fixed missing cast for rlim_t on i386/gcc-4.1

Adrian Knoth adi at drcomp.erfurt.thur.de
Wed Apr 2 12:51:59 MDT 2008


[notice: this message has been accidently postponed for several months,
but as far as I know, the issue is still present in the current
release/trunk]


Hi!

Torque-2.2.0 fails to build with gcc-4.1 on i386 when
-D_FILE_OFFSET_BITS=64 is set:

gcc -DHAVE_CONFIG_H -I. -I. -I../../../src/include
-I../../../src/include -DPBS_MOM -DDEMUX=\"/usr/sbin/pbs_demux\"
-D_FILE_OFFSET_BITS=64 -W -Wall -Wno-unused-parameter -Wno-long-long
-pedantic -Werror -D_LARGEFILE64_SOURCE -c mom_mach.c
cc1: warnings being treated as errors
mom_mach.c: In function 'mom_set_limits':
mom_mach.c:1159: warning: format '%ld' expects type 'long int', but
argument 3 has type 'rlim_t'
mom_mach.c:1201: warning: format '%ld' expects type 'long int', but
argument 3 has type 'rlim_t'
mom_mach.c:1217: warning: format '%ld' expects type 'long int', but
argument 3 has type 'rlim_t'
mom_mach.c:1302: warning: format '%ld' expects type 'long int', but
argument 3 has type 'rlim_t'
mom_mach.c:1312: warning: format '%ld' expects type 'long int', but
argument 3 has type 'rlim_t'
make[4]: *** [mom_mach.o] Error 1


The attached patch correts this problem.

-- 
mail: adi at thur.de  	http://adi.thur.de	PGP/GPG: key via keyserver

Spione suchen sich meist ein lauschiges Plätzchen!
-------------- next part --------------
--- torque-2.2.0/src/resmom/linux/mom_mach.c	2007-10-18 19:52:19.000000000 +0200
+++ torque-2.2.0-new/src/resmom/linux/mom_mach.c	2007-11-01 15:44:46.000000000 +0100
@@ -1155,7 +1155,7 @@
         if (LOGLEVEL >= 2)
           {
           sprintf(log_buffer,"setting cpu time limit to %ld for job %s",
-            reslim.rlim_cur,
+            (long int) reslim.rlim_cur,
             pjob->ji_qs.ji_jobid);
 
           log_record(PBSEVENT_SYSTEM,0,id,log_buffer);
@@ -1197,7 +1197,7 @@
           if (LOGLEVEL >= 0)
             {
             sprintf(log_buffer,"cannot set file limit to %ld for job %s (value too large)",
-              reslim.rlim_cur,
+              (long int) reslim.rlim_cur,
               pjob->ji_qs.ji_jobid);
 
             log_err(0,id,log_buffer);
@@ -1213,7 +1213,7 @@
         if (setrlimit(RLIMIT_FSIZE,&reslim) < 0)
           {
           sprintf(log_buffer,"cannot set file limit to %ld for job %s (setrlimit failed - check default user limits)",
-            reslim.rlim_max,
+            (long int) reslim.rlim_max,
             pjob->ji_qs.ji_jobid);
 
           log_err(errno,id,log_buffer);
@@ -1297,7 +1297,7 @@
         if (setrlimit(RLIMIT_DATA,&reslim) < 0)
           {
          sprintf(log_buffer,"cannot set data limit to %ld for job %s (setrlimit failed w/errno=%d - check default user limits)",
-            reslim.rlim_max,
+            (long int) reslim.rlim_max,
             pjob->ji_qs.ji_jobid,
             errno);
 
@@ -1307,7 +1307,7 @@
         if (setrlimit(RLIMIT_RSS,&reslim) < 0)
           {
          sprintf(log_buffer,"cannot set RSS limit to %ld for job %s (setrlimit failed w/errno=%d - check default user limits)",
-            reslim.rlim_max,
+            (long int) reslim.rlim_max,
             pjob->ji_qs.ji_jobid,
             errno);
 


More information about the torquedev mailing list