142
142
** quota quota information (sizes in KB)
145
static char ident[] = "@(#) sgi/$RCSfile$ $Revision: 2628 $";
145
static char ident[] = "@(#) sgi/$RCSfile$ $Revision: 3151 $";
147
147
#define SGI_ZOMBIE_WRONG 1
148
148
#define COMPLEX_MEM_CALC 0
358
359
* decoded value of time in seconds in the unsigned long integer.
361
static int getlong(pres, ret)
363
getlong(resource *pres, unsigned long *ret)
366
366
if (pres->rs_value.at_type != ATR_TYPE_LONG)
701
700
error(char *string, int value)
706
704
assert(string != NULL);
707
705
assert(*string != '\0');
708
assert(value > PBSE_); /* minimum PBS error number */
709
assert(value <= PBSE_NOSYNCMSTR); /* maximum PBS error number */
710
assert(pbs_err_to_txt[i].err_no != 0);
714
if (pbs_err_to_txt[i].err_no == value)
717
while (pbs_err_to_txt[++i].err_no != 0);
719
assert(pbs_err_to_txt[i].err_txt != NULL);
721
message = *pbs_err_to_txt[i].err_txt;
707
message = pbse_to_txt(value);
723
709
assert(message != NULL);
725
710
assert(*message != '\0');
727
712
(void)fprintf(stderr, msg_momsetlim, string, message);
752
737
* existing limits. Cannot alter those set by setrlimit (kernel)
753
738
* because we are the wrong process.
755
int mom_set_limits(pjob, set_mode)
757
int set_mode; /* SET_LIMIT_SET or SET_LIMIT_ALTER */
743
int set_mode /* SET_LIMIT_SET or SET_LIMIT_ALTER */
759
746
char *id = "mom_set_limits";
808
795
else if (strcmp(pname, "cput") == 0) /* check */
810
/* cpu time - check, if less than pcput use it */
811
retval = getlong(pres, &value);
797
if (igncput == FALSE)
799
/* cpu time - check, if less than pcput use it */
800
retval = getlong(pres, &value);
813
if (retval != PBSE_NONE)
814
return (error(pname, retval));
802
if (retval != PBSE_NONE)
803
return (error(pname, retval));
816
806
else if (strcmp(pname, "pcput") == 0)
818
/* process cpu time - set */
819
retval = getlong(pres, &value);
821
if (retval != PBSE_NONE)
822
return (error(pname, retval));
824
res64lim.rlim_cur = res64lim.rlim_max =
825
(unsigned long)((double)value / cputfactor);
827
if (setrlimit64(RLIMIT_CPU, &res64lim) < 0)
828
return (error("RLIMIT_CPU", PBSE_SYSTEM));
808
if (igncput == FALSE)
810
/* process cpu time - set */
811
retval = getlong(pres, &value);
813
if (retval != PBSE_NONE)
814
return (error(pname, retval));
816
res64lim.rlim_cur = res64lim.rlim_max =
817
(unsigned long)((double)value / cputfactor);
819
if (setrlimit64(RLIMIT_CPU, &res64lim) < 0)
820
return (error("RLIMIT_CPU", PBSE_SYSTEM));
830
823
else if (strcmp(pname, "file") == 0) /* set */
845
838
else if (strcmp(pname, "vmem") == 0) /* check */
847
retval = getsize(pres, &sizeval);
849
if (retval != PBSE_NONE)
850
return (error(pname, retval));
852
if ((mem_limit == 0) || (sizeval < mem_limit))
840
if (ignvmem == FALSE)
842
retval = getsize(pres, &sizeval);
844
if (retval != PBSE_NONE)
845
return (error(pname, retval));
847
if ((mem_limit == 0) || (sizeval < mem_limit))
855
851
else if (strcmp(pname, "pvmem") == 0) /* set */
857
retval = getsize(pres, &sizeval);
859
if (retval != PBSE_NONE)
860
return (error(pname, retval));
862
if ((mem_limit == 0) || (sizeval < mem_limit))
853
if (ignvmem == FALSE)
855
retval = getsize(pres, &sizeval);
857
if (retval != PBSE_NONE)
858
return (error(pname, retval));
860
if ((mem_limit == 0) || (sizeval < mem_limit))
865
864
else if (strcmp(pname, "mem") == 0) /* ignore */
868
867
else if (strcmp(pname, "pmem") == 0) /* set */
870
if (set_mode == SET_LIMIT_SET)
872
retval = getsize(pres, &sizeval);
874
if (retval != PBSE_NONE)
875
return (error(pname, retval));
877
res64lim.rlim_cur = res64lim.rlim_max = sizeval;
879
if (setrlimit64(RLIMIT_RSS, &res64lim) < 0)
880
return (error("RLIMIT_RSS", PBSE_SYSTEM));
871
if (set_mode == SET_LIMIT_SET)
873
retval = getsize(pres, &sizeval);
875
if (retval != PBSE_NONE)
876
return (error(pname, retval));
878
res64lim.rlim_cur = res64lim.rlim_max = sizeval;
880
if (setrlimit64(RLIMIT_RSS, &res64lim) < 0)
881
return (error("RLIMIT_RSS", PBSE_SYSTEM));
883
885
else if (strcmp(pname, "walltime") == 0) /* Check */
1236
1238
#endif /* SGI_ZOMBIE_WRONG */
1239
else if (strcmp(pname, "cput") == 0)
1241
else if ((igncput == FALSE) && (strcmp(pname, "cput") == 0))
1241
1243
retval = getlong(pres, &value);
1254
else if (strcmp(pname, "pcput") == 0)
1256
else if ((igncput == FALSE) && (strcmp(pname, "pcput") == 0))
1256
1258
retval = getlong(pres, &value);
1460
1460
* Kill a task session.
1461
1461
* Call with the task pointer and a signal number.
1463
int kill_task(ptask, sig, pg)
1464
kill_task(task *ptask, int sig, int pg)
1468
1466
char *id = "kill_task";
1568
1565
* If abort is true, kill it too.
1571
int mach_checkpoint(ptask, file, abort)
1569
mach_checkpoint(task *ptask, char *file, int abort)
1576
1571
#if MOM_CHECKPOINT == 1