diff --git a/src/slurmctld/agent.c b/src/slurmctld/agent.c index e0e0f113854f8970316502fe0fd77b0642bdb4cb..31357951c624fce63993788b03dddd2ee207be4a 100644 --- a/src/slurmctld/agent.c +++ b/src/slurmctld/agent.c @@ -127,9 +127,9 @@ agent (void *args) agent_info_ptr = xmalloc (sizeof (agent_info_t)); thread_ptr = xmalloc (agent_arg_ptr->addr_count * sizeof (thd_t)); if (pthread_mutex_init (&agent_info_ptr->thread_mutex, NULL)) - fatal ("agent: pthread_mutex_init errno %d", errno); + fatal ("agent: pthread_mutex_init error %m"); if (pthread_cond_init (&agent_info_ptr->thread_cond, NULL)) - fatal ("agent: pthread_cond_init errno %d", errno); + fatal ("agent: pthread_cond_init error %m"); agent_info_ptr->thread_count = agent_arg_ptr->addr_count; agent_info_ptr->threads_active = 0; agent_info_ptr->thread_struct = thread_ptr; @@ -141,18 +141,18 @@ agent (void *args) /* start the watchdog thread */ if (pthread_attr_init (&attr_wdog)) - fatal ("agent: pthread_attr_init errno %d", errno); + fatal ("agent: pthread_attr_init error %m"); if (pthread_attr_setdetachstate (&attr_wdog, PTHREAD_CREATE_DETACHED)) - error ("agent: pthread_attr_setdetachstate errno %d", errno); + error ("agent: pthread_attr_setdetachstate error %m"); #ifdef PTHREAD_SCOPE_SYSTEM if (pthread_attr_setscope (&attr_wdog, PTHREAD_SCOPE_SYSTEM)) - error ("agent: pthread_attr_setscope errno %d", errno); + error ("agent: pthread_attr_setscope error %m"); #endif if (pthread_create (&thread_wdog, &attr_wdog, wdog, (void *)agent_info_ptr)) { - error ("agent: pthread_create errno %d", errno); + error ("agent: pthread_create error %m"); sleep (1); /* sleep and try once more */ if (pthread_create (&thread_wdog, &attr_wdog, wdog, args)) - fatal ("agent: pthread_create errno %d", errno); + fatal ("agent: pthread_create error %m"); } /* start all the other threads (at most AGENT_THREAD_COUNT active at once) */ @@ -185,7 +185,7 @@ agent (void *args) pthread_mutex_unlock (&agent_info_ptr->thread_mutex); if (rc) { - error ("pthread_create errno %d\n", errno); + error ("pthread_create error %m"); /* execute task within this thread */ thread_per_node_rpc ((void *) task_specific_ptr); } @@ -301,14 +301,12 @@ thread_per_node_rpc (void *args) pthread_mutex_unlock (task_ptr->thread_mutex); /* accept SIGALRM */ - if (sigemptyset (&set)) - error ("sigemptyset errno %d", errno); - if (sigaddset (&set, SIGALRM)) - error ("sigaddset errno %d on SIGALRM", errno); + sigemptyset (&set); + sigaddset (&set, SIGALRM); /* init message connection for message communication with slurmd */ if ( ( sockfd = slurm_open_msg_conn (& thread_ptr->slurm_addr) ) == SLURM_SOCKET_ERROR ) { - error ("thread_per_node_rpc/slurm_open_msg_conn errno %d", errno); + error ("thread_per_node_rpc/slurm_open_msg_conn error %m"); goto cleanup; } @@ -316,19 +314,19 @@ thread_per_node_rpc (void *args) request_msg . msg_type = task_ptr->msg_type ; request_msg . data = task_ptr->msg_args ; if ( ( rc = slurm_send_node_msg ( sockfd , & request_msg ) ) == SLURM_SOCKET_ERROR ) { - error ("thread_per_node_rpc/slurm_send_node_msg errno %d", errno); + error ("thread_per_node_rpc/slurm_send_node_msg error %m"); goto cleanup; } /* receive message */ if ( ( msg_size = slurm_receive_msg ( sockfd , & response_msg ) ) == SLURM_SOCKET_ERROR ) { - error ("thread_per_node_rpc/slurm_receive_msg errno %d", errno); + error ("thread_per_node_rpc/slurm_receive_msg error %m"); goto cleanup; } /* shutdown message connection */ if ( ( rc = slurm_shutdown_msg_conn ( sockfd ) ) == SLURM_SOCKET_ERROR ) { - error ("thread_per_node_rpc/slurm_shutdown_msg_conn errno %d", errno); + error ("thread_per_node_rpc/slurm_shutdown_msg_conn error %m"); goto cleanup; } if ( msg_size ) { diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 1cb547a767fcce1c3a3b7ae886e63bc51752aa60..84e75a0988415cf0577ca11066cc7854479bdd00 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -333,13 +333,13 @@ dump_all_job_state ( void ) lock_state_files (); log_fd = creat (new_file, 0600); if (log_fd == 0) { - error ("Create error %d on file %s, can't save state", errno, new_file); + error ("Can't save state, create file %s error %m", new_file); error_code = errno; } else { buf_len = buffer_allocated - buf_len; if (write (log_fd, buffer, buf_len) != buf_len) { - error ("Write error %d on file %s, can't save state", errno, new_file); + error ("Can't save state, write file %s error %m", new_file); error_code = errno; } close (log_fd); @@ -573,7 +573,7 @@ load_job_state ( void ) buffer_size += buffer_used; close (state_fd); if (buffer_used < 0) - error ("Read error %d on %s", errno, state_file); + error ("Error reading file %s: %m", state_file); } xfree (state_file); unlock_state_files (); @@ -1314,7 +1314,7 @@ copy_job_desc_to_file ( job_desc_msg_t * job_desc , uint32_t job_id ) xstrcat (dir_name, job_dir); if (stat (dir_name, &sbuf) == -1) { /* create job specific directory as needed */ if (mkdir2 (dir_name, 0700)) - error ("mkdir2 errno=%d on %s", errno, dir_name); + error ("mkdir2 on %s error %m", dir_name); } /* Create environment file, and write data to it */ @@ -1395,7 +1395,7 @@ write_data_array_to_file ( char * file_name, char ** data, uint16_t size ) fd = creat (file_name, 0600); if (fd < 0) { - error ("create file %s errno %d", file_name, errno); + error ("Error creating file %s, %m", file_name); return ESLURM_WRITING_TO_FILE; } @@ -1405,7 +1405,7 @@ write_data_array_to_file ( char * file_name, char ** data, uint16_t size ) while (nwrite > 0) { pos = write (fd, &data[i][pos], nwrite); if (pos < 0) { - error ("write file %s errno %d", file_name, errno); + error ("Error writing file %s, %m", file_name); return ESLURM_WRITING_TO_FILE; } nwrite -= pos; @@ -1429,7 +1429,7 @@ write_data_to_file ( char * file_name, char * data ) fd = creat (file_name, 0600); if (fd < 0) { - error ("create file %s errno %d", file_name, errno); + error ("Error creating file %s, %m", file_name); return ESLURM_WRITING_TO_FILE; } @@ -1438,7 +1438,7 @@ write_data_to_file ( char * file_name, char * data ) while (nwrite > 0) { pos = write (fd, &data[pos], nwrite); if (pos < 0) { - error ("write file %s errno %d", file_name, errno); + error ("Error writing file %s, %m", file_name); return ESLURM_WRITING_TO_FILE; } nwrite -= pos; diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c index b3ccf3005622115ba64c8cf53e8b7bfded34aafb..fcc254a18133f98e14b2a55418feaa8661f091ef 100644 --- a/src/slurmctld/job_scheduler.c +++ b/src/slurmctld/job_scheduler.c @@ -141,8 +141,8 @@ schedule (void) job_cnt++; } else { - info ("schedule: job_id %u non-runnable, errno %d", - job_ptr->job_id, errno); + info ("schedule: job_id %u non-runnable, error %m", + job_ptr->job_id); last_job_update = time (NULL); job_ptr->job_state = JOB_FAILED; job_ptr->start_time = job_ptr->end_time = time(NULL); diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c index 1fec6a0c76ff0bb4a631450035fb62450aaaedaa..367d7c2a7af901ce95ca26367bcf19e510e16619 100644 --- a/src/slurmctld/node_mgr.c +++ b/src/slurmctld/node_mgr.c @@ -572,13 +572,13 @@ dump_all_node_state ( void ) lock_state_files (); log_fd = creat (new_file, 0600); if (log_fd == 0) { - error ("Create error %d on file %s, can't save state", errno, new_file); + error ("Can't save state, error creating file %s %m", new_file); error_code = errno; } else { buf_len = buffer_allocated - buf_len; if (write (log_fd, buffer, buf_len) != buf_len) { - error ("Write error %d on file %s, can't save state", errno, new_file); + error ("Can't save state, error writing file %s %m", new_file); error_code = errno; } close (log_fd); @@ -659,7 +659,7 @@ load_node_state ( void ) buffer_size += buffer_used; close (state_fd); if (buffer_used < 0) - error ("Read error %d on %s", errno, state_file); + error ("Read error on %s, %m", state_file); } xfree (state_file); unlock_state_files (); @@ -916,7 +916,7 @@ node_name2bitmap (char *node_names, bitstr_t **bitmap) } if ( (host_list = hostlist_create (node_names)) == NULL) { - error ("hostlist_create errno %d on %s", errno, node_names); + error ("hostlist_create on %s error:", node_names); return EINVAL; } @@ -1164,7 +1164,7 @@ update_node ( update_node_msg_t * update_node_msg ) state_val = update_node_msg -> node_state ; if ( (host_list = hostlist_create (update_node_msg -> node_names)) == NULL) { - error ("hostlist_create errno %d on %s", errno, update_node_msg -> node_names); + error ("hostlist_create error on %s: %m", update_node_msg -> node_names); return ESLURM_INVALID_NODE_NAME; } diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c index 0407737575e92d824ffd9e355ecb7a33e7664546..9792902ddb752a9eed33d0e2c4a8316645c0a390 100644 --- a/src/slurmctld/partition_mgr.c +++ b/src/slurmctld/partition_mgr.c @@ -200,7 +200,7 @@ build_part_bitmap (struct part_record *part_record_point) if ( (host_list = hostlist_create (part_record_point->nodes)) == NULL) { if (old_bitmap) bit_free (old_bitmap); - error ("hostlist_create errno %d on %s", errno, part_record_point->nodes); + error ("hostlist_create error on %s, %m", part_record_point->nodes); return ESLURM_INVALID_NODE_NAME; } @@ -372,13 +372,13 @@ dump_all_part_state ( void ) lock_state_files (); log_fd = creat (new_file, 0600); if (log_fd == 0) { - error ("Create error %d on file %s, can't save state", errno, new_file); + error ("Can't save state, error creating file %s, %m", new_file); error_code = errno; } else { buf_len = buffer_allocated - buf_len; if (write (log_fd, buffer, buf_len) != buf_len) { - error ("Write error %d on file %s, can't save state", errno, new_file); + error ("Can't save state, error writing file %s, %m", new_file); error_code = errno; } close (log_fd); @@ -472,7 +472,7 @@ load_part_state ( void ) buffer_size += buffer_used; close (state_fd); if (buffer_used < 0) - error ("Read error %d on %s", errno, state_file); + error ("Error reading file %s, %m", state_file); } xfree (state_file); unlock_state_files (); diff --git a/src/slurmctld/read_config.c b/src/slurmctld/read_config.c index 32c4c6abe048f4884a55d10b5726e487d3f346f5..6da6367c1186b3b720c766f61d0bed5edba7dd39 100644 --- a/src/slurmctld/read_config.c +++ b/src/slurmctld/read_config.c @@ -145,7 +145,7 @@ main (int argc, char *argv[]) { cycles = atoi (argv[2]); printf ("let's reinitialize the database %d times.\n", cycles); if (getrusage (RUSAGE_CHILDREN, &begin_usage)) - printf ("ERROR %d from getrusage\n", errno); + printf ("getrusage error %m\n"); else if (begin_usage.ru_maxrss == 0) { printf ("WARNING: getrusage inopeative, run /bin/ps and check for memory leak\n"); sleep (5); @@ -153,13 +153,12 @@ main (int argc, char *argv[]) { for (i = 0; i < cycles; i++) { error_code = read_slurm_conf (0); if (error_code) { - printf ("ERROR %d from read_slurm_conf\n", - error_code); + printf ("read_slurm_conf error %m\n", error_code); exit (error_code); } } if (getrusage (RUSAGE_CHILDREN, &end_usage)) - printf ("error %d from getrusage\n", errno); + printf ("getrusage error %m\n"); i = (int) (end_usage.ru_maxrss - begin_usage.ru_maxrss); if (i > 0) { printf ("ERROR: Change in maximum RSS is %d.\n", i); @@ -290,7 +289,7 @@ build_bitmaps () continue; if ( (host_list = hostlist_create (part_record_point->nodes)) == NULL) { - error ("hostlist_create errno %d on %s", errno, part_record_point->nodes); + error ("hostlist_create error for %s, %m", part_record_point->nodes); continue; } @@ -541,7 +540,7 @@ parse_node_spec (char *in_line) { } if ( (host_list = hostlist_create (node_name)) == NULL) { - error ("hostlist_create errno %d on %s", errno, node_name); + error ("hostlist_create error for %s, %m", node_name); error_code = errno; goto cleanup; } @@ -865,8 +864,8 @@ read_slurm_conf (int recover) { slurm_spec_file = fopen (slurmctld_conf.slurm_conf, "r"); if (slurm_spec_file == NULL) - fatal ("read_slurm_conf error %d opening file %s", - errno, slurmctld_conf.slurm_conf); + fatal ("read_slurm_conf error opening file %s, %m", + slurmctld_conf.slurm_conf); info ("read_slurm_conf: loading configuration from %s", slurmctld_conf.slurm_conf);