Skip to content
Snippets Groups Projects
Commit 6c4624a2 authored by Morris Jette's avatar Morris Jette
Browse files

Get PATH_MAX from system include file

Get the maximum file pathname size from system include file rather
  than local #define. This was causing failures on kachina test.
parent e86e1f7c
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <limits.h> /* for PATH_MAX */
#include <stdlib.h>
#include "slurm/slurm.h"
......@@ -63,10 +63,8 @@
#define PATH_TO_CPU "/sys/devices/system/cpu/"
#define LINE_LEN 100
#define SYSFS_PATH_MAX 255
#define FREQ_LIST_MAX 32
#define GOV_NAME_LEN 24
#define SPOOL_LEN 128
#define GOV_CONSERVATIVE 0x01
#define GOV_ONDEMAND 0x02
......@@ -128,7 +126,7 @@ static int _fd_lock_retry(int fd)
*/
static int _set_cpu_owner_lock(int cpu_id, uint32_t job_id)
{
char tmp[SPOOL_LEN];
char tmp[PATH_MAX];
int fd, sz;
snprintf(tmp, sizeof(tmp), "%s/cpu", slurmd_spooldir);
......@@ -153,7 +151,7 @@ static int _set_cpu_owner_lock(int cpu_id, uint32_t job_id)
static int _test_cpu_owner_lock(int cpu_id, uint32_t job_id)
{
char tmp[SPOOL_LEN];
char tmp[PATH_MAX];
uint32_t in_job_id;
int fd, sz;
......@@ -203,7 +201,7 @@ static int
_cpu_freq_cpu_avail(int cpuidx)
{
FILE *fp = NULL;
char path[SYSFS_PATH_MAX];
char path[PATH_MAX];
int i, j, k;
uint32_t freq;
bool all_avail = false;
......@@ -247,7 +245,7 @@ _cpu_freq_cpu_avail(int cpuidx)
extern void
cpu_freq_init(slurmd_conf_t *conf)
{
char path[SYSFS_PATH_MAX];
char path[PATH_MAX];
struct stat statbuf;
FILE *fp;
char value[LINE_LEN];
......@@ -630,7 +628,7 @@ static int
_cpu_freq_get_cur_gov(int cpuidx)
{
FILE *fp = NULL;
char path[SYSFS_PATH_MAX], gov_value[LINE_LEN];
char path[PATH_MAX], gov_value[LINE_LEN];
int j;
snprintf(path, sizeof(path),
......@@ -663,7 +661,7 @@ _cpu_freq_get_cur_gov(int cpuidx)
static int
_cpu_freq_set_gov(stepd_step_rec_t *job, int cpuidx, char* gov )
{
char path[SYSFS_PATH_MAX];
char path[PATH_MAX];
FILE *fp;
int fd, rc;
......@@ -692,7 +690,7 @@ static uint32_t
_cpu_freq_get_scaling_freq(int cpuidx, char* option)
{
FILE *fp = NULL;
char path[SYSFS_PATH_MAX];
char path[PATH_MAX];
uint32_t freq;
/* get the value from 'option' */
snprintf(path, sizeof(path), PATH_TO_CPU
......@@ -719,7 +717,7 @@ static int
_cpu_freq_set_scaling_freq(stepd_step_rec_t *job, int cpx, uint32_t freq,
char* option)
{
char path[SYSFS_PATH_MAX];
char path[PATH_MAX];
FILE *fp;
int fd, rc;
uint32_t newfreq;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment