Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
e80398c1
Commit
e80398c1
authored
22 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
No logic changes, minor code clean-up.
parent
9af3899f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/common/log.c
+28
-17
28 additions, 17 deletions
src/common/log.c
src/common/log.h
+2
-1
2 additions, 1 deletion
src/common/log.h
src/common/slurm_protocol_api.c
+5
-1
5 additions, 1 deletion
src/common/slurm_protocol_api.c
with
35 additions
and
19 deletions
src/common/log.c
+
28
−
17
View file @
e80398c1
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
*/
*/
#if HAVE_CONFIG_H
#if HAVE_CONFIG_H
# include
<
config.h
>
# include
"
config.h
"
#endif
#endif
#include
<stdio.h>
#include
<stdio.h>
...
@@ -59,18 +59,22 @@
...
@@ -59,18 +59,22 @@
#include
<stdarg.h>
#include
<stdarg.h>
#include
<errno.h>
#include
<errno.h>
#include
<syslog.h>
#include
<syslog.h>
#include
<pthread.h>
#ifdef WITH_PTHREADS
# include <pthread.h>
#endif
/* WITH_PTHREADS */
#if HAVE_STDLIB_H
#if HAVE_STDLIB_H
# include <stdlib.h>
/* for abort() */
# include <stdlib.h>
/* for abort() */
#endif
#endif
#include
<
src/common/
macros
.h
>
#include
"
src/common/
log
.h
"
#include
<
src/common/
log
.h
>
#include
"
src/common/
macros
.h
"
#include
<
src/common/
xmalloc
.h
>
#include
"
src/common/
safeopen
.h
"
#include
<
src/common/xassert.h
>
#include
"
src/common/xassert.h
"
#include
<
src/common/x
string
.h
>
#include
"
src/common/x
malloc
.h
"
#include
<
src/common/
safeopen
.h
>
#include
"
src/common/
xstring
.h
"
#ifndef LINEBUFSIZE
#ifndef LINEBUFSIZE
# define LINEBUFSIZE 256
# define LINEBUFSIZE 256
...
@@ -142,8 +146,9 @@ _log_init(char *prog, log_options_t opt, log_facility_t fac, char *logfile )
...
@@ -142,8 +146,9 @@ _log_init(char *prog, log_options_t opt, log_facility_t fac, char *logfile )
char
*
errmsg
=
NULL
;
char
*
errmsg
=
NULL
;
pthread_mutex_unlock
(
&
log_lock
);
pthread_mutex_unlock
(
&
log_lock
);
xslurm_strerrorcat
(
errmsg
);
xslurm_strerrorcat
(
errmsg
);
fprintf
(
stderr
,
"%s: log_init(): Unable to open logfile"
fprintf
(
stderr
,
"`%s': %s
\n
"
,
prog
,
logfile
,
errmsg
);
"%s: log_init(): Unable to open logfile"
"`%s': %s
\n
"
,
prog
,
logfile
,
errmsg
);
xfree
(
errmsg
);
xfree
(
errmsg
);
rc
=
errno
;
rc
=
errno
;
goto
out
;
goto
out
;
...
@@ -226,7 +231,8 @@ static char *vxstrfmt(const char *fmt, va_list ap)
...
@@ -226,7 +231,8 @@ static char *vxstrfmt(const char *fmt, va_list ap)
while
(
*
fmt
!=
'\0'
)
{
while
(
*
fmt
!=
'\0'
)
{
if
((
p
=
(
char
*
)
strchr
(
fmt
,
'%'
))
==
NULL
)
{
/* no more format chars */
if
((
p
=
(
char
*
)
strchr
(
fmt
,
'%'
))
==
NULL
)
{
/* no more format chars */
xstrcat
(
buf
,
fmt
);
xstrcat
(
buf
,
fmt
);
break
;
break
;
...
@@ -253,7 +259,7 @@ static char *vxstrfmt(const char *fmt, va_list ap)
...
@@ -253,7 +259,7 @@ static char *vxstrfmt(const char *fmt, va_list ap)
xslurm_strerrorcat
(
buf
);
xslurm_strerrorcat
(
buf
);
break
;
break
;
case
't'
:
/* "%t" => locally
preferred
date/time*/
case
't'
:
/* "%t" => locally date/time*/
xstrftimecat
(
buf
,
"%x %X"
);
xstrftimecat
(
buf
,
"%x %X"
);
break
;
break
;
case
'T'
:
/* "%T" => "dd Mon yyyy hh:mm:ss off" */
case
'T'
:
/* "%T" => "dd Mon yyyy hh:mm:ss off" */
...
@@ -510,7 +516,8 @@ struct fatal_cleanup {
...
@@ -510,7 +516,8 @@ struct fatal_cleanup {
static
pthread_mutex_t
fatal_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
fatal_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
struct
fatal_cleanup
*
fatal_cleanups
=
NULL
;
static
struct
fatal_cleanup
*
fatal_cleanups
=
NULL
;
/* Registers a cleanup function to be called by fatal() for this thread before exiting. */
/* Registers a cleanup function to be called by fatal() for this thread
** before exiting. */
void
void
fatal_add_cleanup
(
void
(
*
proc
)
(
void
*
),
void
*
context
)
fatal_add_cleanup
(
void
(
*
proc
)
(
void
*
),
void
*
context
)
{
{
...
@@ -526,7 +533,8 @@ fatal_add_cleanup(void (*proc) (void *), void *context)
...
@@ -526,7 +533,8 @@ fatal_add_cleanup(void (*proc) (void *), void *context)
pthread_mutex_unlock
(
&
fatal_lock
);
pthread_mutex_unlock
(
&
fatal_lock
);
}
}
/* Registers a cleanup function to be called by fatal() for all threads of the job. */
/* Registers a cleanup function to be called by fatal() for all threads
** of the job. */
void
void
fatal_add_cleanup_job
(
void
(
*
proc
)
(
void
*
),
void
*
context
)
fatal_add_cleanup_job
(
void
(
*
proc
)
(
void
*
),
void
*
context
)
{
{
...
@@ -566,7 +574,8 @@ fatal_remove_cleanup(void (*proc) (void *context), void *context)
...
@@ -566,7 +574,8 @@ fatal_remove_cleanup(void (*proc) (void *context), void *context)
(
u_long
)
proc
,
(
u_long
)
context
);
(
u_long
)
proc
,
(
u_long
)
context
);
}
}
/* Removes a cleanup frunction to be called at fatal() for all threads of the job. */
/* Removes a cleanup frunction to be called at fatal() for all threads of
** the job. */
void
void
fatal_remove_cleanup_job
(
void
(
*
proc
)
(
void
*
context
),
void
*
context
)
fatal_remove_cleanup_job
(
void
(
*
proc
)
(
void
*
context
),
void
*
context
)
{
{
...
@@ -585,11 +594,13 @@ fatal_remove_cleanup_job(void (*proc) (void *context), void *context)
...
@@ -585,11 +594,13 @@ fatal_remove_cleanup_job(void (*proc) (void *context), void *context)
}
}
}
}
pthread_mutex_unlock
(
&
fatal_lock
);
pthread_mutex_unlock
(
&
fatal_lock
);
fatal
(
"fatal_remove_cleanup_job: no such cleanup function: 0x%lx 0x%lx"
,
fatal
(
"fatal_remove_cleanup_job: no such cleanup function: 0x%lx 0x%lx"
,
(
u_long
)
proc
,
(
u_long
)
context
);
(
u_long
)
proc
,
(
u_long
)
context
);
}
}
/* Execute cleanup functions, first thread-specific then those for the whole job */
/* Execute cleanup functions, first thread-specific then those for the
** whole job */
void
void
fatal_cleanup
(
void
)
fatal_cleanup
(
void
)
{
{
...
...
This diff is collapsed.
Click to expand it.
src/common/log.h
+
2
−
1
View file @
e80398c1
...
@@ -47,7 +47,8 @@
...
@@ -47,7 +47,8 @@
#include
<syslog.h>
#include
<syslog.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<src/common/macros.h>
#include
"src/common/macros.h"
/* supported syslog facilities and levels */
/* supported syslog facilities and levels */
typedef
enum
{
typedef
enum
{
...
...
This diff is collapsed.
Click to expand it.
src/common/slurm_protocol_api.c
+
5
−
1
View file @
e80398c1
...
@@ -29,8 +29,12 @@
...
@@ -29,8 +29,12 @@
#endif
#endif
/* GLOBAL INCLUDES */
/* GLOBAL INCLUDES */
#ifdef WITH_PTHREADS
# include <pthread.h>
#endif
/* WITH_PTHREADS */
#include
<errno.h>
#include
<errno.h>
#include
<pthread.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment