Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shane Snyder
darshan
Commits
e81a9cae
Commit
e81a9cae
authored
Jan 25, 2016
by
Shane Snyder
Browse files
autconf/runtime changes for configuring mmap code
parent
bb25083b
Changes
5
Hide whitespace changes
Inline
Side-by-side
darshan-runtime/configure
View file @
e81a9cae
...
...
@@ -684,15 +684,16 @@ ac_subst_files=''
ac_user_opts
=
'
enable_option_checking
with_zlib
enable_cuserid
enable_ld_preload
enable_cuserid
enable_group_readable_logs
enable_bgq_mod
enable_mmap_logs
with_mem_align
with_log_path_by_env
with_log_hints
with_log_path
with_jobid_env
enable_bgq_mod
with_mod_mem
'
ac_precious_vars
=
'build_alias
...
...
@@ -1313,10 +1314,12 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-cuserid Disables attempted use of cuserid() at run time
--disable-ld-preload Disables support for LD_PRELOAD library
--enable-group-readable-logs Set log files to be group readable
--disable-cuserid Disables attempted use of cuserid() at run time
--enable-group-readable-logs
Set log files to be group readable
--disable-bgq-mod Disables compilation and use of BG/Q module (for BG/Q systems)
--enable-mmmap-logs Enables ability to mmap I/O data to log file
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
...
...
@@ -1325,13 +1328,16 @@ Optional Packages:
/usr/local or /usr if not found in /usr/local
--without-zlib to disable zlib usage completely
--with-mem-align=<num> Memory alignment in bytes
--with-log-path-by-env=<env var list> Comma separated list of environment variables to check for log path location before --with-log-path path
--with-log-hints=<hint1=x;hint2=y> Semicolon-separated list of MPI-IO hints for log file write
--with-log-path-by-env=<env var list>
Comma separated list of environment variables to check for
log path location before --with-log-path path
--with-log-hints=<hint1=x;hint2=y>
Semicolon-separated list of MPI-IO hints for log file write
--with-log-path=<path> Location to store log files at run time
--with-jobid-env=<name> Name of environment variable that stores the jobid
(specify "NONE" if no appropriate environment variable
is available:
Darshan will use rank 0's pid instead)
--with-mod-mem=<num> Maximum amount of memory (in MiB) for each Darshan module
(specify "NONE" if no appropriate environment variable
is available:
Darshan will use rank 0's pid instead)
--with-mod-mem=<num>
Maximum amount of memory (in MiB) for each Darshan module
Some influential environment variables:
CC C compiler command
...
...
@@ -3528,21 +3534,21 @@ fi
# Check whether --enable-cuserid was given.
if
test
"
${
enable_cuserid
+set
}
"
=
set
;
then
:
enableval
=
$enable_cuserid
;
if
test
"x
$enableval
"
=
"xno"
;
then
$as_echo
"#define DARSHAN_DISABLE_CUSERID 1"
>>
confdefs.h
,
# Check whether --enable-ld-preload was given.
if
test
"
${
enable_ld_preload
+set
}
"
=
set
;
then
:
enableval
=
$enable_ld_preload
;
if
test
"x
$enableval
"
=
"xno"
;
then
DISABLE_LDPRELOAD
=
"1"
fi
fi
# Check whether --enable-ld-preload was given.
if
test
"
${
enable_ld_preload
+set
}
"
=
set
;
then
:
enableval
=
$enable_ld_preload
;
if
test
"x
$enableval
"
=
"xno"
;
then
DISABLE_LDPRELOAD
=
"1"
# Check whether --enable-cuserid was given.
if
test
"
${
enable_cuserid
+set
}
"
=
set
;
then
:
enableval
=
$enable_cuserid
;
if
test
"x
$enableval
"
=
"xno"
;
then
$as_echo
"#define __DARSHAN_DISABLE_CUSERID 1"
>>
confdefs.h
fi
fi
...
...
@@ -3559,6 +3565,26 @@ fi
fi
# Check whether --enable-bgq_mod was given.
if
test
"
${
enable_bgq_mod
+set
}
"
=
set
;
then
:
enableval
=
$enable_bgq_mod
;
else
enable_bgq_mod
=
check
fi
# Check whether --enable-mmap-logs was given.
if
test
"
${
enable_mmap_logs
+set
}
"
=
set
;
then
:
enableval
=
$enable_mmap_logs
;
if
test
"x
$enableval
"
=
"xyes"
;
then
$as_echo
"#define __DARSHAN_ENABLE_MMAP_LOGS 1"
>>
confdefs.h
fi
fi
# Check whether --with-mem-align was given.
if
test
"
${
with_mem_align
+set
}
"
=
set
;
then
:
...
...
@@ -3648,6 +3674,54 @@ _ACEOF
fi
# Check whether --with-mod-mem was given.
if
test
"
${
with_mod_mem
+set
}
"
=
set
;
then
:
withval
=
$with_mod_mem
;
if
test
x
$withval
=
xyes
;
then
as_fn_error
$?
"--with-mod-mem must be given a number"
"
$LINENO
"
5
else
cat
>>
confdefs.h
<<
_ACEOF
#define __DARSHAN_MOD_MEM_MAX
${
withval
}
_ACEOF
fi
fi
if
test
x
$enable_bgq_mod
!=
xno
;
then
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for BG/Q environment"
>
&5
$as_echo_n
"checking for BG/Q environment... "
>
&6
;
}
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
#ifndef __bgq__
#error __bgq__ not set
#endif
int
main ()
{
;
return 0;
}
_ACEOF
if
ac_fn_c_try_compile
"
$LINENO
"
;
then
:
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: yes"
>
&5
$as_echo
"yes"
>
&6
;
}
DARSHAN_USE_BGQ
=
1
else
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
$as_echo
"no"
>
&6
;
}
if
test
"x
$enable_bgq_mod
"
=
xyes
;
then
:
as_fn_error
$?
"BG/Q module enabled in non-BG/Q environment"
"
$LINENO
"
5
fi
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
fi
if
test
x
$GOT_ALIGNMENT
!=
x1
;
then
as_fn_error
$?
"must provide --with-mem-align=<num> argument to configure."
"
$LINENO
"
5
fi
...
...
@@ -4239,63 +4313,6 @@ $as_echo "no" >&6; }
MPICH_LIB_OLD
=
0
fi
# check to see whether the bgq instrumentation module should be built
# Check whether --enable-bgq_mod was given.
if
test
"
${
enable_bgq_mod
+set
}
"
=
set
;
then
:
enableval
=
$enable_bgq_mod
;
else
enable_bgq_mod
=
check
fi
if
test
x
$enable_bgq_mod
!=
xno
;
then
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for BG/Q environment"
>
&5
$as_echo_n
"checking for BG/Q environment... "
>
&6
;
}
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
#ifndef __bgq__
#error __bgq__ not set
#endif
int
main ()
{
;
return 0;
}
_ACEOF
if
ac_fn_c_try_compile
"
$LINENO
"
;
then
:
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: yes"
>
&5
$as_echo
"yes"
>
&6
;
}
DARSHAN_USE_BGQ
=
1
else
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
$as_echo
"no"
>
&6
;
}
if
test
"x
$enable_bgq_mod
"
=
xyes
;
then
:
as_fn_error
$?
"BG/Q module enabled in non-BG/Q environment"
"
$LINENO
"
5
fi
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
fi
# Check whether --with-mod-mem was given.
if
test
"
${
with_mod_mem
+set
}
"
=
set
;
then
:
withval
=
$with_mod_mem
;
if
test
x
$withval
=
xyes
;
then
as_fn_error
$?
"--with-mod-mem must be given a number"
"
$LINENO
"
5
else
cat
>>
confdefs.h
<<
_ACEOF
#define __DARSHAN_MOD_MEM_MAX
${
withval
}
_ACEOF
fi
fi
DARSHAN_VERSION
=
"3.0.0-pre3"
...
...
@@ -4305,7 +4322,6 @@ DARSHAN_VERSION="3.0.0-pre3"
ac_config_files
=
"
$ac_config_files
Makefile darshan-mk-log-dirs.pl darshan-gen-cc.pl darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-base-ld-opts darshan-config share/craype-1.x/darshan-module share/craype-2.x/darshan-module lib/pkgconfig/darshan-runtime.pc share/mpi-profile/darshan-cc.conf share/mpi-profile/darshan-cxx.conf share/mpi-profile/darshan-f.conf share/mpi-profile/darshan-bg-cc.conf share/mpi-profile/darshan-bg-cxx.conf share/mpi-profile/darshan-bg-f.conf"
cat
>
confcache
<<
\
_ACEOF
...
...
darshan-runtime/configure.in
View file @
e81a9cae
...
...
@@ -24,27 +24,42 @@ AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)],
dnl runtime libraries require zlib
CHECK_ZLIB
AC_ARG_ENABLE(
cuseri
d,
[ --disable-
cuserid
Disables
attempted use of cuserid() at run time
],
AC_ARG_ENABLE(
ld-preloa
d,
[ --disable-
ld-preload
Disables
support for LD_PRELOAD library
],
[if test "x$enableval" = "xno" ; then
AC_DEFINE(DARSHAN_DISABLE_CUSERID, 1, Define if cuserid() should be disabled),
DISABLE_LDPRELOAD="1"
fi]
,)
AC_ARG_ENABLE(
ld-preloa
d,
[ --disable-
ld-preload
Disables
support for LD_PRELOAD library
],
AC_ARG_ENABLE(
cuseri
d,
[ --disable-
cuserid
Disables
attempted use of cuserid() at run time
],
[if test "x$enableval" = "xno" ; then
DISABLE_LDPRELOAD="1"
AC_DEFINE(__DARSHAN_DISABLE_CUSERID, 1, Define if cuserid() should be disabled)
fi]
,)
AC_ARG_ENABLE(group-readable-logs,
[ --enable-group-readable-logs Set log files to be group readable],
[ --enable-group-readable-logs
Set log files to be group readable],
[if test "x$enableval" = "xyes" ; then
AC_DEFINE(__DARSHAN_GROUP_READABLE_LOGS, 1, Define if Darshan should set log files to be group readable)
fi]
,)
AC_ARG_ENABLE(
[bgq_mod],
[ --disable-bgq-mod Disables compilation and use of BG/Q module (for BG/Q systems)],
[],
[enable_bgq_mod=check]
)
AC_ARG_ENABLE(mmap-logs,
[ --enable-mmmap-logs Enables ability to mmap I/O data to log file],
[if test "x$enableval" = "xyes" ; then
AC_DEFINE(__DARSHAN_ENABLE_MMAP_LOGS, 1, Define if Darshan should mmap data structures to log file)
fi]
,)
AC_ARG_WITH(mem-align,
[ --with-mem-align=<num> Memory alignment in bytes],
if test x$withval = xyes; then
...
...
@@ -56,7 +71,9 @@ AC_ARG_WITH(mem-align,
)
AC_ARG_WITH(log-path-by-env,
[ --with-log-path-by-env=<env var list> Comma separated list of environment variables to check for log path location before --with-log-path path],
[ --with-log-path-by-env=<env var list>
Comma separated list of environment variables to check for
log path location before --with-log-path path],
if test x$withval = xyes; then
AC_MSG_ERROR(--with-log-path-by-env must be given at least one variable name)
else
...
...
@@ -67,7 +84,8 @@ AC_ARG_WITH(log-path-by-env,
)
AC_ARG_WITH(log-hints,
[ --with-log-hints=<hint1=x;hint2=y> Semicolon-separated list of MPI-IO hints for log file write],
[ --with-log-hints=<hint1=x;hint2=y>
Semicolon-separated list of MPI-IO hints for log file write],
if test x$withval = xyes; then
AC_MSG_ERROR(--with-log-hints must be given an argument)
else
...
...
@@ -90,8 +108,8 @@ AC_ARG_WITH(log-path,
AC_ARG_WITH(jobid-env,
[ --with-jobid-env=<name> Name of environment variable that stores the jobid
(specify "NONE" if no appropriate environment variable
is available:
Darshan will use rank 0's pid instead)],
(specify "NONE" if no appropriate environment variable
is available:
Darshan will use rank 0's pid instead)],
if test x$withval = xyes; then
AC_MSG_ERROR(--with-jobid-env must be given a name)
else
...
...
@@ -101,6 +119,30 @@ AC_ARG_WITH(jobid-env,
fi
)
AC_ARG_WITH(mod-mem,
[ --with-mod-mem=<num> Maximum amount of memory (in MiB) for each Darshan module],
if test x$withval = xyes; then
AC_MSG_ERROR(--with-mod-mem must be given a number)
else
AC_DEFINE_UNQUOTED(__DARSHAN_MOD_MEM_MAX, ${withval}, Maximum memory (in MiB) for each Darshan module)
fi
)
if test x$enable_bgq_mod != xno; then
AC_MSG_CHECKING(for BG/Q environment)
AC_TRY_COMPILE([
#ifndef __bgq__
#error __bgq__ not set
#endif
], [],
AC_MSG_RESULT(yes)
DARSHAN_USE_BGQ=1,
AC_MSG_RESULT(no)
AS_IF([test "x$enable_bgq_mod" = xyes],
AC_MSG_ERROR(BG/Q module enabled in non-BG/Q environment),
[]))
fi
if test x$GOT_ALIGNMENT != x1; then
AC_MSG_ERROR(must provide --with-mem-align=<num> argument to configure.)
fi
...
...
@@ -278,39 +320,7 @@ AS_IF([$CC -show foo.c -o foo |grep lmpich >& /dev/null],
AC_MSG_RESULT(no)
MPICH_LIB_OLD=0)
# check to see whether the bgq instrumentation module should be built
AC_ARG_ENABLE(
[bgq_mod],
[ --disable-bgq-mod Disables compilation and use of BG/Q module (for BG/Q systems)],
[],
[enable_bgq_mod=check]
)
if test x$enable_bgq_mod != xno; then
AC_MSG_CHECKING(for BG/Q environment)
AC_TRY_COMPILE([
#ifndef __bgq__
#error __bgq__ not set
#endif
], [],
AC_MSG_RESULT(yes)
DARSHAN_USE_BGQ=1,
AC_MSG_RESULT(no)
AS_IF([test "x$enable_bgq_mod" = xyes],
AC_MSG_ERROR(BG/Q module enabled in non-BG/Q environment),
[]))
fi
AC_ARG_WITH(mod-mem,
[ --with-mod-mem=<num> Maximum amount of memory (in MiB) for each Darshan module],
if test x$withval = xyes; then
AC_MSG_ERROR(--with-mod-mem must be given a number)
else
AC_DEFINE_UNQUOTED(__DARSHAN_MOD_MEM_MAX, ${withval}, Maximum memory (in MiB) for each Darshan module)
fi
)
DARSHAN_VERSION="AC_PACKAGE_VERSION"
AC_SUBST(darshan_lib_path)
AC_SUBST(darshan_share_path)
AC_SUBST(LDFLAGS)
...
...
darshan-runtime/darshan-core.h
View file @
e81a9cae
...
...
@@ -30,6 +30,9 @@
/* Environment variable to override memory per module */
#define DARSHAN_MOD_MEM_OVERRIDE "DARSHAN_MODMEM"
/* Environment variable to override default mmap log path */
#define DARSHAN_MMAP_LOG_PATH_OVERRIDE "DARSHAN_MMAP_LOGPATH"
/* Maximum amount of memory per instrumentation module in MiB */
#ifdef __DARSHAN_MOD_MEM_MAX
#define DARSHAN_MOD_MEM_MAX (__DARSHAN_MOD_MEM_MAX * 1024 * 1024)
...
...
@@ -37,6 +40,9 @@
#define DARSHAN_MOD_MEM_MAX (2 * 1024 * 1024)
/* 2 MiB default */
#endif
/* default path for storing mmap log files is '/tmp' */
#define DARSHAN_DEF_MMAP_LOG_PATH "/tmp"
#define DARSHAN_RECORD_BUF_SIZE (1024 * 100)
/* store 1024 records, each of at most 100 bytes */
/* Default runtime compression buffer size */
...
...
darshan-runtime/darshan-runtime-config.h.in
View file @
e81a9cae
...
...
@@ -3,9 +3,6 @@
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define if cuserid() should be disabled */
#undef DARSHAN_DISABLE_CUSERID
/* Define if struct aiocb64 type is defined */
#undef HAVE_AIOCB64
...
...
@@ -87,6 +84,12 @@
# endif
#endif
/* Define if cuserid() should be disabled */
#undef __DARSHAN_DISABLE_CUSERID
/* Define if Darshan should mmap data structures to log file */
#undef __DARSHAN_ENABLE_MMAP_LOGS
/* Define if Darshan should set log files to be group readable */
#undef __DARSHAN_GROUP_READABLE_LOGS
...
...
darshan-runtime/lib/darshan-core.c
View file @
e81a9cae
...
...
@@ -98,6 +98,8 @@ static void darshan_add_record_hashref(
darshan_record_id
id
,
struct
darshan_core_record_ref
**
ref
);
static
void
darshan_block_size_from_path
(
const
char
*
path
,
int
*
block_size
);
static
void
darshan_get_user_name
(
char
*
user
);
static
void
darshan_get_logfile_name
(
char
*
logfile_name
,
int
jobid
,
struct
tm
*
start_tm
);
static
void
darshan_get_shared_records
(
...
...
@@ -127,6 +129,7 @@ void darshan_core_initialize(int argc, char **argv)
int
mmap_fd
;
int
mmap_size
;
int
sys_page_size
;
char
cuser
[
L_cuserid
]
=
{
0
};
char
*
envstr
;
char
*
jobid_str
;
int
jobid
;
...
...
@@ -197,6 +200,7 @@ void darshan_core_initialize(int argc, char **argv)
memset
(
init_core
,
0
,
sizeof
(
*
init_core
));
init_core
->
wtime_offset
=
DARSHAN_MPI_CALL
(
PMPI_Wtime
)();
#ifdef __DARSHAN_ENABLE_MMAP_LOGS
sys_page_size
=
sysconf
(
_SC_PAGESIZE
);
assert
(
sys_page_size
>
0
);
...
...
@@ -205,11 +209,21 @@ void darshan_core_initialize(int argc, char **argv)
if
(
mmap_size
%
sys_page_size
)
mmap_size
=
((
mmap_size
/
sys_page_size
)
+
1
)
*
sys_page_size
;
char
*
mmap_log_dir
;
envstr
=
getenv
(
DARSHAN_MMAP_LOG_PATH_OVERRIDE
);
if
(
envstr
)
mmap_log_dir
=
envstr
;
else
mmap_log_dir
=
DARSHAN_DEF_MMAP_LOG_PATH
;
darshan_get_user_name
(
cuser
);
/* construct a unique temporary log file name for this process
* to write mmap log data to
*/
snprintf
(
init_core
->
mmap_log_name
,
PATH_MAX
,
"/tmp/darshan_job%d.%d"
,
jobid
,
my_rank
);
snprintf
(
init_core
->
mmap_log_name
,
PATH_MAX
,
"/%s/%s_%s_id%d_mmap-log-%d.darshan"
,
mmap_log_dir
,
cuser
,
__progname
,
jobid
,
my_rank
);
/* create the temporary mmapped darshan log */
mmap_fd
=
open
(
init_core
->
mmap_log_name
,
O_CREAT
|
O_RDWR
|
O_EXCL
,
0644
);
...
...
@@ -282,6 +296,9 @@ void darshan_core_initialize(int argc, char **argv)
/* collect information about command line and mounted file systems */
darshan_get_exe_and_mounts
(
init_core
,
argc
,
argv
);
#else
#error "Error: non-mmap code path not ready."
#endif
/* bootstrap any modules with static initialization routines */
i
=
0
;
...
...
@@ -360,8 +377,9 @@ void darshan_core_shutdown()
/* XXX just copy mmap files somewhere else to avoid corruption */
DARSHAN_MPI_CALL
(
PMPI_Barrier
)(
MPI_COMM_WORLD
);
if
(
my_rank
==
0
)
system
(
"cp /tmp/darshan* ~/Desktop"
);
char
cp_cmd
[
500
]
=
{
0
};
sprintf
(
cp_cmd
,
"cp %s ~/Desktop"
,
final_core
->
mmap_log_name
);
system
(
cp_cmd
);
DARSHAN_MPI_CALL
(
PMPI_Barrier
)(
MPI_COMM_WORLD
);
memcpy
(
&
out_job
,
final_core
->
log_job_p
,
sizeof
(
struct
darshan_job
));
...
...
@@ -1003,66 +1021,59 @@ static void darshan_get_exe_and_mounts(struct darshan_core_runtime *core,
return
;
}
static
void
darshan_add_record_hashref
(
struct
darshan_core_runtime
*
core
,
char
*
name
,
darshan_record_id
id
,
struct
darshan_core_record_ref
**
ref
)
static
void
darshan_block_size_from_path
(
const
char
*
path
,
int
*
block_size
)
{
int
record_size
=
sizeof
(
darshan_record_id
)
+
strlen
(
name
)
+
1
;
if
((
record_size
+
core
->
log_hdr_p
->
rec_map
.
len
)
>
DARSHAN_RECORD_BUF_SIZE
)
return
;
int
i
;
*
block_size
=
-
1
;
*
ref
=
malloc
(
sizeof
(
**
ref
));
if
(
*
ref
)
for
(
i
=
0
;
i
<
mnt_data_count
;
i
++
)
{
memset
(
*
ref
,
0
,
sizeof
(
**
ref
));
#if 0
if(!mmap)
{
ref->rec.name = malloc(strlen(name) + 1);
}
else
#endif
if
(
!
(
strncmp
(
mnt_data_array
[
i
].
path
,
path
,
strlen
(
mnt_data_array
[
i
].
path
))))
{
/* store the rec id and full file path in record hash buffer */
void
*
tmp_p
=
(
char
*
)
core
->
log_rec_p
+
core
->
log_hdr_p
->
rec_map
.
len
;
*
(
darshan_record_id
*
)
tmp_p
=
id
;
/* set the name pointer for this record to point to the
* appropriate location in the record hash buffer
*/
tmp_p
=
(
char
*
)
tmp_p
+
sizeof
(
darshan_record_id
);
(
*
ref
)
->
name
=
(
char
*
)
tmp_p
;
*
block_size
=
mnt_data_array
[
i
].
block_size
;
return
;
}
/* set record ref fields */
(
*
ref
)
->
id
=
id
;
if
((
*
ref
)
->
name
)
strcpy
((
*
ref
)
->
name
,
name
);
/* TODO: look at HASH_ADD_KEYPTR, use same strategy (big contig pool) for non-mmap darshan */
HASH_ADD
(
hlink
,
core
->
rec_hash
,
id
,
sizeof
(
darshan_record_id
),
(
*
ref
));
core
->
rec_hash_cnt
++
;
core
->
log_hdr_p
->
rec_map
.
len
+=
record_size
;
}
return
;
}
static
void
darshan_
block_size_from_path
(
const
char
*
path
,
int
*
block_size
)
static
void
darshan_
get_user_name
(
char
*
cuser
)
{
int
i
;
*
block_size
=
-
1
;
char
*
logname_string
;
for
(
i
=
0
;
i
<
mnt_data_count
;
i
++
)
/* get the username for this job. In order we will try each of the
* following until one of them succeeds:
*
* - cuserid()
* - getenv("LOGNAME")
* - snprintf(..., geteuid());
*
* Note that we do not use getpwuid() because it generally will not
* work in statically compiled binaries.
*/
#ifndef __DARSHAN_DISABLE_CUSERID
cuserid
(
cuser
);
#endif
/* if cuserid() didn't work, then check the environment */
if
(
strcmp
(
cuser
,
""
)
==
0
)
{
if
(
!
(
strncmp
(
mnt_data_array
[
i
].
path
,
path
,
strlen
(
mnt_data_array
[
i
].
path
))))
logname_string
=
getenv
(
"LOGNAME"
);
if
(
logname_string
)
{
*
block_size
=
mnt_data_array
[
i
].
block_size
;
return
;
strncpy
(
cuser
,
logname_string
,
(
L_cuserid
-
1
));
}
}
/* if cuserid() and environment both fail, then fall back to uid */
if
(
strcmp
(
cuser
,
""
)
==
0
)
{
uid_t
uid
=
geteuid
();
snprintf
(
cuser
,
L_cuserid
,
"%u"
,
uid
);
}
return
;
}
...
...
@@ -1071,7 +1082,6 @@ static void darshan_get_logfile_name(char* logfile_name, int jobid, struct tm* s
{
char
*
user_logfile_name
;
char
*
logpath
;
char
*
logname_string
;
char
*
logpath_override
=
NULL
;
#ifdef __DARSHAN_LOG_ENV
char
env_check
[
256
];
...
...
@@ -1110,37 +1120,7 @@ static void darshan_get_logfile_name(char* logfile_name, int jobid, struct tm* s
#endif
}
/* get the username for this job. In order we will try each of the
* following until one of them succeeds:
*
* - cuserid()
* - getenv("LOGNAME")
* - snprintf(..., geteuid());
*
* Note that we do not use getpwuid() because it generally will not
* work in statically compiled binaries.
*/
#ifndef DARSHAN_DISABLE_CUSERID
cuserid
(
cuser
);
#endif
/* if cuserid() didn't work, then check the environment */
if
(
strcmp
(
cuser
,
""
)
==
0
)
{
logname_string
=
getenv
(
"LOGNAME"
);