[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1058 - in GNUnet/src: include util
From: |
durner |
Subject: |
[GNUnet-SVN] r1058 - in GNUnet/src: include util |
Date: |
Sun, 26 Jun 2005 05:48:47 -0700 (PDT) |
Author: durner
Date: 2005-06-26 05:48:44 -0700 (Sun, 26 Jun 2005)
New Revision: 1058
Modified:
GNUnet/src/include/plibc.h
GNUnet/src/util/daemon.c
Log:
Windows
Modified: GNUnet/src/include/plibc.h
===================================================================
--- GNUnet/src/include/plibc.h 2005-06-26 12:47:13 UTC (rev 1057)
+++ GNUnet/src/include/plibc.h 2005-06-26 12:48:44 UTC (rev 1058)
@@ -67,6 +67,14 @@
#define int64_t long long
#define int32_t long
+#ifndef pid_t
+ #define pid_t int
+#endif
+
+#ifndef WEXITSTATUS
+ #define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
+#endif
+
/* Thanks to the Cygwin project */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
@@ -356,6 +364,7 @@
int _win_vscanf(const char *format, va_list arg_ptr);
int _win_scanf(const char *format, ...);
int _win_fscanf(FILE *stream, const char *format, ...);
+pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
int _win_bind(SOCKET s, const struct sockaddr *name, int namelen);
int _win_connect(SOCKET s,const struct sockaddr *name, int namelen);
int _win_getpeername(SOCKET s, struct sockaddr *name,
@@ -439,6 +448,7 @@
#define VSCANF(f, a) vscanf(f, a)
#define SCANF(f, ...) scanf(f, __VA_ARGS__)
#define FSCANF(s, f, ...) fscanf(s, f, __VA_ARGS__)
+ #define WAITPID(p, s, o) waitpid(p, s, o)
#define ACCEPT(s, a, l) accept(s, a, l)
#define BIND(s, n, l) bind(s, n, l)
#define CONNECT(s, n, l) connect(s, n, l)
@@ -503,6 +513,7 @@
#define VSCANF(f, a) _win_vscanf(f, a)
#define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
#define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
+ #define WAITPID(p, s, o) _win_waitpid(p, s, o)
#define ACCEPT(s, a, l) _win_accept(s, a, l)
#define BIND(s, n, l) _win_bind(s, n, l)
#define CONNECT(s, n, l) _win_connect(s, n, l)
Modified: GNUnet/src/util/daemon.c
===================================================================
--- GNUnet/src/util/daemon.c 2005-06-26 12:47:13 UTC (rev 1057)
+++ GNUnet/src/util/daemon.c 2005-06-26 12:48:44 UTC (rev 1058)
@@ -189,20 +189,38 @@
return launchWithExec(daemonize);
#elif MINGW
char szCall[_MAX_PATH + 1], szWd[_MAX_PATH + 1], szCWd[_MAX_PATH + 1];
- char *args[1];
+ char *args[1], *cp;
+ int pid;
+ int idx = 0;
plibc_conv_to_win_path("/bin/gnunetd.exe", szCall);
plibc_conv_to_win_path("/bin", szWd);
_getcwd(szCWd, _MAX_PATH);
chdir(szWd);
- args[0] = NULL;
- spawnvp(_P_NOWAIT, szCall, (const char *const *) args);
+
+ if (daemonize == NO) {
+ char *cp;
+
+ args[0] = "-d";
+ idx = 1;
+
+ cp = getConfigurationString("GNUNET",
+ "GNUNETD-CONFIG");
+ if (cp) {
+ args[1] = "-c";
+ args[2] = cp;
+ idx=3;
+ }
+ }
+
+ args[idx] = NULL;
+ pid = spawnvp(_P_NOWAIT, szCall, (const char *const *) args);
chdir(szCWd);
- return 0; /* FIXME NILS: return PID if NO == daemonize, also
- pass option -d in that case. And what about
- -c CONFIG? */
+ FREENONNULL(cp);
+
+ return (daemonize == NO) ? pid : 0;
#else
/* any system out there that does not support THIS!? */
system("gnunetd"); /* we may not have nice,
@@ -289,7 +307,7 @@
int status;
p = pid;
- if (p != waitpid(p, &status, 0)) {
+ if (p != WAITPID(p, &status, 0)) {
LOG_STRERROR(LOG_ERROR, "waitpid");
return SYSERR;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1058 - in GNUnet/src: include util,
durner <=