From ffe49a49343ccbf68733a0c032d10d62f6c37913 Mon Sep 17 00:00:00 2001 From: Tim Wickberg <tim@schedmd.com> Date: Fri, 26 Feb 2016 15:59:25 -0500 Subject: [PATCH] Use __func__ rather than __FUNCTION__ throughout. No functional change. --- src/common/gres.c | 2 +- src/common/slurm_protocol_defs.h | 2 +- src/plugins/mpi/pmix/pmixp_debug.h | 11 ++-- src/plugins/mpi/pmix/tests/test_common.h | 4 +- src/plugins/select/cray/select_cray.c | 6 +-- src/plugins/switch/cray/switch_cray.h | 10 ++-- src/plugins/switch/nrt/nrt.c | 16 +++--- src/plugins/task/cray/task_cray.c | 6 +-- src/slurmctld/controller.c | 4 +- src/slurmd/common/xcgroup.c | 68 ++++++++++++------------ 10 files changed, 63 insertions(+), 66 deletions(-) diff --git a/src/common/gres.c b/src/common/gres.c index e480ba183ea..3755aca9085 100644 --- a/src/common/gres.c +++ b/src/common/gres.c @@ -1767,7 +1767,7 @@ extern int gres_gresid_to_gresname(uint32_t gres_id, char* gres_name, /* Should not reach this as if there are GRES id's then there * must have been a gres_conf_list. */ - info("%s--The gres_conf_list is NULL!!!\n", __FUNCTION__); + info("%s--The gres_conf_list is NULL!!!\n", __func__); snprintf(gres_name, gres_name_len, "%u", gres_id); return rc; } diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h index 175dee451eb..62e0d9057c9 100644 --- a/src/common/slurm_protocol_defs.h +++ b/src/common/slurm_protocol_defs.h @@ -151,7 +151,7 @@ #define THIS_FILE ((strrchr(__FILE__, '/') ?: __FILE__ - 1) + 1) #define INFO_LINE(fmt, ...) \ - info("%s (%s:%d) "fmt, __FUNCTION__, THIS_FILE, __LINE__, ##__VA_ARGS__); + info("%s (%s:%d) "fmt, __func__, THIS_FILE, __LINE__, ##__VA_ARGS__); #define YEAR_MINUTES 365 * 24 * 60 diff --git a/src/plugins/mpi/pmix/pmixp_debug.h b/src/plugins/mpi/pmix/pmixp_debug.h index 8a37fc9880e..a3d2b4918bb 100644 --- a/src/plugins/mpi/pmix/pmixp_debug.h +++ b/src/plugins/mpi/pmix/pmixp_debug.h @@ -50,8 +50,7 @@ } \ debug("%s [%d] %s:%d [%s] mpi/pmix: " format "", \ pmixp_info_hostname(), pmixp_info_nodeid(), \ - file_base, __LINE__, __FUNCTION__, \ - ## args); \ + file_base, __LINE__, __func__, ## args); \ } #define PMIXP_ERROR_STD(format, args...) { \ @@ -62,7 +61,7 @@ } \ error("%s [%d] %s:%d [%s] mpi/pmix: ERROR: " format ": %s (%d)", \ pmixp_info_hostname(), pmixp_info_nodeid(), \ - file_base, __LINE__, __FUNCTION__, \ + file_base, __LINE__, __func__, \ ## args, strerror(errno), errno); \ } @@ -74,14 +73,14 @@ } \ error("%s [%d] %s:%d [%s] mpi/pmix: ERROR: " format, \ pmixp_info_hostname(), pmixp_info_nodeid(), \ - file_base, __LINE__, __FUNCTION__, ## args); \ + file_base, __LINE__, __func__, ## args); \ } #define PMIXP_ABORT(format, args...) { \ PMIXP_ERROR(format, ##args); \ error("%s [%d] %s:%d [%s] mpi/pmix: ERROR: " format, \ pmixp_info_hostname(), pmixp_info_nodeid(), \ - file_base, __LINE__, __FUNCTION__, ## args); \ + file_base, __LINE__, __func__, ## args); \ slurm_kill_job_step(pmixp_info_jobid(), \ pmixp_info_stepid(), SIGKILL); \ } @@ -94,7 +93,7 @@ } \ error("%s [%d] %s:%d [%s] mpi/pmix: ERROR: " format ": %s (%d)", \ pmixp_info_hostname(), pmixp_info_nodeid(), \ - file_base, __LINE__, __FUNCTION__, \ + file_base, __LINE__, __func__, \ ## args, strerror(err), err); \ } diff --git a/src/plugins/mpi/pmix/tests/test_common.h b/src/plugins/mpi/pmix/tests/test_common.h index 381091ebd3c..5644df82fd6 100644 --- a/src/plugins/mpi/pmix/tests/test_common.h +++ b/src/plugins/mpi/pmix/tests/test_common.h @@ -28,13 +28,13 @@ extern int pmix_test_verbose; #define STRIPPED_FILE_NAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) #define TEST_OUTPUT(x) { \ - fprintf(stderr,"%s:%s: %s\n",STRIPPED_FILE_NAME, __FUNCTION__, \ + fprintf(stderr,"%s:%s: %s\n",STRIPPED_FILE_NAME, __func__, \ pmix_test_output_prepare x); \ fflush(stderr); \ } #define TEST_ERROR(x) { \ - fprintf(stderr,"ERROR [%s:%d:%s]: %s\n", STRIPPED_FILE_NAME, __LINE__, __FUNCTION__, \ + fprintf(stderr,"ERROR [%s:%d:%s]: %s\n", STRIPPED_FILE_NAME, __LINE__, __func__, \ pmix_test_output_prepare x); \ fflush(stderr); \ } diff --git a/src/plugins/select/cray/select_cray.c b/src/plugins/select/cray/select_cray.c index 2b7cd75b6e4..e2a38169b3d 100644 --- a/src/plugins/select/cray/select_cray.c +++ b/src/plugins/select/cray/select_cray.c @@ -1652,13 +1652,13 @@ extern int select_p_node_init(struct node_record *node_ptr, int node_cnt) error("(%s: %d: %s) Could not get system " "topology info: %s", THIS_FILE, __LINE__, - __FUNCTION__, err_msg); + __func__, err_msg); free(err_msg); } else { error("(%s: %d: %s) Could not get system " "topology info: No error " "message present.", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); } return SLURM_ERROR; } @@ -1687,7 +1687,7 @@ extern int select_p_node_init(struct node_record *node_ptr, int node_cnt) "0123456789"))) { error("(%s: %d: %s) Error: Node was not " "recognizable: %s", - THIS_FILE, __LINE__, __FUNCTION__, + THIS_FILE, __LINE__, __func__, node_rec->name); slurm_mutex_unlock(&blade_mutex); return SLURM_ERROR; diff --git a/src/plugins/switch/cray/switch_cray.h b/src/plugins/switch/cray/switch_cray.h index 2007f57ddea..0a629da0594 100644 --- a/src/plugins/switch/cray/switch_cray.h +++ b/src/plugins/switch/cray/switch_cray.h @@ -175,15 +175,15 @@ extern int release_cookies(slurm_cray_jobinfo_t *job); /********************************************************** * Macros **********************************************************/ -#define ALPSC_CN_DEBUG(f) alpsc_debug(THIS_FILE, __LINE__, __FUNCTION__, \ +#define ALPSC_CN_DEBUG(f) alpsc_debug(THIS_FILE, __LINE__, __func__, \ rc, 1, f, &err_msg); -#define ALPSC_SN_DEBUG(f) alpsc_debug(THIS_FILE, __LINE__, __FUNCTION__, \ +#define ALPSC_SN_DEBUG(f) alpsc_debug(THIS_FILE, __LINE__, __func__, \ rc, 0, f, &err_msg); #define CRAY_ERR(fmt, ...) error("(%s: %d: %s) "fmt, THIS_FILE, __LINE__, \ - __FUNCTION__, ##__VA_ARGS__); + __func__, ##__VA_ARGS__); #define CRAY_DEBUG(fmt, ...) debug2("(%s: %d: %s) "fmt, THIS_FILE, __LINE__, \ - __FUNCTION__, ##__VA_ARGS__); + __func__, ##__VA_ARGS__); #define CRAY_INFO(fmt, ...) info("(%s: %d: %s) "fmt, THIS_FILE, __LINE__, \ - __FUNCTION__, ##__VA_ARGS__); + __func__, ##__VA_ARGS__); #endif /* SWITCH_CRAY_H */ diff --git a/src/plugins/switch/nrt/nrt.c b/src/plugins/switch/nrt/nrt.c index 2078da2ef27..4bb98796280 100644 --- a/src/plugins/switch/nrt/nrt.c +++ b/src/plugins/switch/nrt/nrt.c @@ -617,7 +617,7 @@ _job_step_window_state(slurm_nrt_jobinfo_t *jp, hostlist_t hl, if ((jp == NULL) || (jp->magic == NRT_NULL_MAGIC)) { debug2("(%s: %d: %s) job->switch_job was NULL", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return SLURM_ERROR; } @@ -1799,7 +1799,7 @@ _print_jobinfo(slurm_nrt_jobinfo_t *j) if ((j == NULL) || (j->magic == NRT_NULL_MAGIC)) { debug2("(%s: %d: %s) job->switch_job was NULL", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return; } @@ -2841,7 +2841,7 @@ nrt_job_step_complete(slurm_nrt_jobinfo_t *jp, hostlist_t hl) xassert(!hostlist_is_empty(hl)); if ((jp == NULL) || (jp->magic == NRT_NULL_MAGIC)) { debug2("(%s: %d: %s) job->switch_job was NULL", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return SLURM_ERROR; } @@ -3015,7 +3015,7 @@ nrt_build_jobinfo(slurm_nrt_jobinfo_t *jp, hostlist_t hl, if ((jp == NULL) || (jp->magic == NRT_NULL_MAGIC)) { debug2("(%s: %d: %s) job->switch_job was NULL", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return SLURM_ERROR; } @@ -3488,7 +3488,7 @@ nrt_unpack_jobinfo(slurm_nrt_jobinfo_t *j, Buf buf, if (j->magic == NRT_NULL_MAGIC) { debug2("(%s: %d: %s) Nothing to unpack.", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return SLURM_SUCCESS; } @@ -3575,7 +3575,7 @@ nrt_get_jobinfo(slurm_nrt_jobinfo_t *jp, int key, void *data) if ((jp == NULL) || (jp->magic == NRT_NULL_MAGIC)) { debug2("(%s: %d: %s) job->switch_job was NULL", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return SLURM_SUCCESS; } @@ -3770,7 +3770,7 @@ nrt_load_table(slurm_nrt_jobinfo_t *jp, int uid, int pid, char *job_name) if ((jp == NULL) || (jp->magic == NRT_NULL_MAGIC)) { debug2("(%s: %d: %s) job->switch_job was NULL", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return SLURM_ERROR; } @@ -3945,7 +3945,7 @@ nrt_unload_table(slurm_nrt_jobinfo_t *jp) { if ((jp == NULL) || (jp->magic == NRT_NULL_MAGIC)) { debug2("(%s: %d: %s) job->switch_job was NULL", - THIS_FILE, __LINE__, __FUNCTION__); + THIS_FILE, __LINE__, __func__); return SLURM_ERROR; } diff --git a/src/plugins/task/cray/task_cray.c b/src/plugins/task/cray/task_cray.c index 31474cf2985..2d1f596e37e 100644 --- a/src/plugins/task/cray/task_cray.c +++ b/src/plugins/task/cray/task_cray.c @@ -150,10 +150,10 @@ static int track_status = 1; // File containing the number of currently running Slurm steps #define NUM_STEPS_FILE TASK_CRAY_RUN_DIR"/slurm_num_steps" -#define _ALPSC_DEBUG(f) _alpsc_debug(THIS_FILE, __LINE__, __FUNCTION__, \ +#define _ALPSC_DEBUG(f) _alpsc_debug(THIS_FILE, __LINE__, __func__, \ rc, 1, f, err_msg); #define CRAY_ERR(fmt, ...) error("(%s: %d: %s) "fmt, THIS_FILE, __LINE__, \ - __FUNCTION__, ##__VA_ARGS__); + __func__, ##__VA_ARGS__); #endif /* @@ -754,7 +754,7 @@ static int _get_numa_nodes(char *path, int *cnt, int32_t **numa_array) { if (*(bm->maskp) & ((long unsigned) 1 << i)) { if (debug_flags & DEBUG_FLAG_TASK) { info("(%s: %d: %s) NUMA Node %d is present", - THIS_FILE, __LINE__, __FUNCTION__, i); + THIS_FILE, __LINE__, __func__, i); } (*numa_array)[index++] = i; } diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c index 53058e61a75..7536b9fab44 100644 --- a/src/slurmctld/controller.c +++ b/src/slurmctld/controller.c @@ -2571,13 +2571,13 @@ static void _verify_clustername(void) debug("creating clustername file: %s", filename); if (!(fp = fopen(filename, "w"))) { fatal("%s: failed to create file %s", - __FUNCTION__, filename); + __func__, filename); exit(1); } if (fputs(slurmctld_conf.cluster_name, fp) < 0) { fatal("%s: failed to write to file %s", - __FUNCTION__, filename); + __func__, filename); exit(1); } fclose(fp); diff --git a/src/slurmd/common/xcgroup.c b/src/slurmd/common/xcgroup.c index 55cf92f2fd7..ba164a02441 100644 --- a/src/slurmd/common/xcgroup.c +++ b/src/slurmd/common/xcgroup.c @@ -411,13 +411,13 @@ int xcgroup_lock(xcgroup_t* cg) if ((cg->fd = open(cg->path, O_RDONLY)) < 0) { debug2("%s: error from open of cgroup '%s' : %m", - __FUNCTION__, cg->path); + __func__, cg->path); return fstatus; } if (flock(cg->fd, LOCK_EX) < 0) { debug2("%s: error locking cgroup '%s' : %m", - __FUNCTION__, cg->path); + __func__, cg->path); close(cg->fd); } else fstatus = XCGROUP_SUCCESS; @@ -431,7 +431,7 @@ int xcgroup_unlock(xcgroup_t* cg) if (flock(cg->fd, LOCK_UN) < 0) { debug2("%s: error unlocking cgroup '%s' : %m", - __FUNCTION__, cg->path); + __func__, cg->path); } else fstatus = XCGROUP_SUCCESS; @@ -478,7 +478,7 @@ int xcgroup_instantiate(xcgroup_t* cg) /* change cgroup ownership as requested */ if (chown(file_path, uid, gid)) { debug2("%s: unable to chown %d:%d cgroup '%s' : %m", - __FUNCTION__, uid, gid, file_path); + __func__, uid, gid, file_path); return fstatus; } @@ -511,7 +511,7 @@ int xcgroup_load(xcgroup_ns_t* cgns, xcgroup_t* cg, char* uri) if (stat((const char*)file_path, &buf)) { debug2("%s: unable to get cgroup '%s' entry '%s' properties" - ": %m", __FUNCTION__, cgns->mnt_point, file_path); + ": %m", __func__, cgns->mnt_point, file_path); return fstatus; } @@ -535,7 +535,7 @@ int xcgroup_delete(xcgroup_t* cg) * exist, do not propagate error back to caller. */ if (cg && cg->path && (rmdir(cg->path) < 0) && (errno != ENOENT)) { - debug2("%s: rmdir(%s): %m", __FUNCTION__, cg->path); + debug2("%s: rmdir(%s): %m", __func__, cg->path); return XCGROUP_ERROR; } return XCGROUP_SUCCESS; @@ -573,8 +573,7 @@ int xcgroup_add_pids(xcgroup_t* cg, pid_t* pids, int npids) fstatus = _file_write_uint32s(path, (uint32_t*)pids, npids); if (fstatus != XCGROUP_SUCCESS) - debug2("%s: unable to add pids to '%s'", - __FUNCTION__, cg->path); + debug2("%s: unable to add pids to '%s'", __func__, cg->path); xfree(path); return fstatus; @@ -594,8 +593,7 @@ int xcgroup_get_pids(xcgroup_t* cg, pid_t **pids, int *npids) fstatus = _file_read_uint32s(path, (uint32_t**)pids, npids); if (fstatus != XCGROUP_SUCCESS) - debug2("%s: unable to get pids of '%s'", - __FUNCTION__, cg->path); + debug2("%s: unable to get pids of '%s'", __func__, cg->path); xfree(path); return fstatus; @@ -636,14 +634,14 @@ int xcgroup_set_params(xcgroup_t* cg, char* parameters) strlen(value)); if (fstatus != XCGROUP_SUCCESS) debug2("%s: unable to set parameter '%s' to " - "'%s' for '%s'", __FUNCTION__, p, value, + "'%s' for '%s'", __func__, p, value, cpath); else debug3("%s: parameter '%s' set to '%s' for '%s'", - __FUNCTION__, p, value, cpath); + __func__, p, value, cpath); } else debug2("%s: bad parameters format for entry '%s'", - __FUNCTION__, p); + __func__, p); next_loop: p = next; } @@ -667,10 +665,10 @@ int xcgroup_set_param(xcgroup_t* cg, char* param, char* content) fstatus = _file_write_content(file_path, content, strlen(content)); if (fstatus != XCGROUP_SUCCESS) debug2("%s: unable to set parameter '%s' to '%s' for '%s'", - __FUNCTION__, param, content, cpath); + __func__, param, content, cpath); else debug3("%s: parameter '%s' set to '%s' for '%s'", - __FUNCTION__, param, content, cpath); + __func__, param, content, cpath); return fstatus; } @@ -688,7 +686,7 @@ int xcgroup_get_param(xcgroup_t* cg, char* param, char **content, size_t *csize) fstatus = _file_read_content(file_path, content, csize); if (fstatus != XCGROUP_SUCCESS) debug2("%s: unable to get parameter '%s' for '%s'", - __FUNCTION__, param, cpath); + __func__, param, cpath); } return fstatus; } @@ -708,10 +706,10 @@ int xcgroup_set_uint32_param(xcgroup_t* cg, char* param, uint32_t value) fstatus = _file_write_uint32s(file_path, &value, 1); if (fstatus != XCGROUP_SUCCESS) debug2("%s: unable to set parameter '%s' to '%u' for '%s'", - __FUNCTION__, param, value, cpath); + __func__, param, value, cpath); else debug3("%s: parameter '%s' set to '%u' for '%s'", - __FUNCTION__, param, value, cpath); + __func__, param, value, cpath); return fstatus; } @@ -731,10 +729,10 @@ int xcgroup_get_uint32_param(xcgroup_t* cg, char* param, uint32_t* value) fstatus = _file_read_uint32s(file_path, &values, &vnb); if (fstatus != XCGROUP_SUCCESS) { debug2("%s: unable to get parameter '%s' for '%s'", - __FUNCTION__, param, cpath); + __func__, param, cpath); } else if (vnb < 1) { debug2("%s: empty parameter '%s' for '%s'", - __FUNCTION__, param, cpath); + __func__, param, cpath); } else { *value = values[0]; xfree(values); @@ -759,10 +757,10 @@ int xcgroup_set_uint64_param(xcgroup_t* cg, char* param, uint64_t value) fstatus = _file_write_uint64s(file_path, &value, 1); if (fstatus != XCGROUP_SUCCESS) debug2("%s: unable to set parameter '%s' to '%"PRIu64"' for " - "'%s'", __FUNCTION__, param, value, cpath); + "'%s'", __func__, param, value, cpath); else debug3("%s: parameter '%s' set to '%"PRIu64"' for '%s'", - __FUNCTION__, param, value, cpath); + __func__, param, value, cpath); return fstatus; } @@ -783,10 +781,10 @@ int xcgroup_get_uint64_param(xcgroup_t* cg, char* param, uint64_t* value) fstatus = _file_read_uint64s(file_path, &values, &vnb); if (fstatus != XCGROUP_SUCCESS) { debug2("%s: unable to get parameter '%s' for '%s'", - __FUNCTION__, param, cpath); + __func__, param, cpath); } else if (vnb < 1) { debug2("%s: empty parameter '%s' for '%s'", - __FUNCTION__, param, cpath); + __func__, param, cpath); } else { *value = values[0]; xfree(values); @@ -809,13 +807,13 @@ static int cgroup_move_process_by_task (xcgroup_t *cg, pid_t pid) dir = opendir(path); if (!dir) { - error("%s: opendir(%s): %m", __FUNCTION__, path); + error("%s: opendir(%s): %m", __func__, path); return XCGROUP_ERROR; } while ((entry = readdir(dir))) { if (entry->d_name[0] != '.') - xcgroup_set_param (cg, "tasks", entry->d_name); + xcgroup_set_param(cg, "tasks", entry->d_name); } closedir(dir); return XCGROUP_SUCCESS; @@ -885,7 +883,7 @@ int _file_write_uint64s(char* file_path, uint64_t* values, int nb) fd = open(file_path, O_WRONLY, 0700); if (fd < 0) { debug2("%s: unable to open '%s' for writing : %m", - __FUNCTION__, file_path); + __func__, file_path); return XCGROUP_ERROR; } @@ -909,7 +907,7 @@ int _file_write_uint64s(char* file_path, uint64_t* values, int nb) while (rc < 0 && errno == EINTR); if (rc < 1) { debug2("%s: unable to add value '%s' to file '%s' : %m", - __FUNCTION__, tstr, file_path); + __func__, tstr, file_path); if (errno != ESRCH) fstatus = XCGROUP_ERROR; } @@ -942,7 +940,7 @@ int _file_read_uint64s(char* file_path, uint64_t** pvalues, int* pnb) fd = open(file_path, O_RDONLY, 0700); if (fd < 0) { debug2("%s: unable to open '%s' for reading : %m", - __FUNCTION__, file_path); + __func__, file_path); return XCGROUP_ERROR; } @@ -1007,7 +1005,7 @@ int _file_write_uint32s(char* file_path, uint32_t* values, int nb) fd = open(file_path, O_WRONLY, 0700); if (fd < 0) { debug2("%s: unable to open '%s' for writing : %m", - __FUNCTION__, file_path); + __func__, file_path); return XCGROUP_ERROR; } @@ -1031,7 +1029,7 @@ int _file_write_uint32s(char* file_path, uint32_t* values, int nb) while (rc < 0 && errno == EINTR); if (rc < 1) { debug2("%s: unable to add value '%s' to file '%s' : %m", - __FUNCTION__, tstr, file_path); + __func__, tstr, file_path); if (errno != ESRCH) fstatus = XCGROUP_ERROR; } @@ -1064,7 +1062,7 @@ int _file_read_uint32s(char* file_path, uint32_t** pvalues, int* pnb) fd = open(file_path, O_RDONLY, 0700); if (fd < 0) { debug2("%s: unable to open '%s' for reading : %m", - __FUNCTION__, file_path); + __func__, file_path); return XCGROUP_ERROR; } @@ -1125,7 +1123,7 @@ int _file_write_content(char* file_path, char* content, size_t csize) fd = open(file_path, O_WRONLY, 0700); if (fd < 0) { debug2("%s: unable to open '%s' for writing : %m", - __FUNCTION__, file_path); + __func__, file_path); return XCGROUP_ERROR; } @@ -1137,7 +1135,7 @@ int _file_write_content(char* file_path, char* content, size_t csize) /* check read size */ if (rc < csize) { debug2("%s: unable to write %lu bytes to file '%s' : %m", - __FUNCTION__, (long unsigned int) csize, file_path); + __func__, (long unsigned int) csize, file_path); fstatus = XCGROUP_ERROR; } else fstatus = XCGROUP_SUCCESS; @@ -1167,7 +1165,7 @@ int _file_read_content(char* file_path, char** content, size_t *csize) fd = open(file_path, O_RDONLY, 0700); if (fd < 0) { debug2("%s: unable to open '%s' for reading : %m", - __FUNCTION__, file_path); + __func__, file_path); return fstatus; } -- GitLab