[Pvfs2-cvs] commit by slang in pvfs2/src/common/misc: pint-util.c
pint-util.h
CVS commit program
cvs at parl.clemson.edu
Fri Apr 4 11:21:54 EST 2008
Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb1:/tmp/cvs-serv7558/src/common/misc
Modified Files:
Tag: pvfs-2-7-branch
pint-util.c pint-util.h
Log Message:
fix for broken migrate collection admin tool since unified config file changes. The migrate collection tool requires the alias to be passed when parsing the config file.
Index: pint-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-util.c,v
diff -p -u -r1.23.2.2 -r1.23.2.3
--- pint-util.c 3 Apr 2008 17:56:19 -0000 1.23.2.2
+++ pint-util.c 4 Apr 2008 16:21:54 -0000 1.23.2.3
@@ -14,9 +14,11 @@
#include <assert.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <unistd.h>
#include "gen-locks.h"
#include "pint-util.h"
+#include "gossip.h"
void PINT_time_mark(PINT_time_marker *out_marker)
{
@@ -334,6 +336,34 @@ PVFS_time PINT_util_mktime_version(PVFS_
PVFS_time PINT_util_mkversion_time(PVFS_time version)
{
return (PVFS_time)(version >> 32);
+}
+
+char *PINT_util_guess_alias(void)
+{
+ char tmp_alias[1024];
+ char *tmpstr;
+ char *alias;
+ int ret;
+
+ /* hmm...failed to find alias as part of the server config filename,
+ * use the hostname to guess
+ */
+ ret = gethostname(tmp_alias, 1024);
+ if(ret != 0)
+ {
+ gossip_err("Failed to get hostname while attempting to guess "
+ "alias. Use -a to specify the alias for this server "
+ "process directly\n");
+ return NULL;
+ }
+ alias = tmp_alias;
+
+ tmpstr = strstr(tmp_alias, ".");
+ if(tmpstr)
+ {
+ *tmpstr = 0;
+ }
+ return strdup(tmp_alias);
}
/*
Index: pint-util.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-util.h,v
diff -p -u -r1.13 -r1.13.2.1
--- pint-util.h 20 Jul 2007 19:37:05 -0000 1.13
+++ pint-util.h 4 Apr 2008 16:21:54 -0000 1.13.2.1
@@ -132,6 +132,8 @@ int PINT_util_digest_sha1(const void *in
int PINT_util_digest_md5(const void *input_message, size_t input_length,
char **output, size_t *output_length);
+char *PINT_util_guess_alias(void);
+
#endif /* __PINT_UTIL_H */
/*
More information about the Pvfs2-cvs
mailing list