#include <config.h>
-#include "socktools.h"
+#include "support/socktools.h"
+#include "support/filename.h"
+
+#if !defined (HAVE_FCNTL)
+// We provide stubs because we don't (yet?) support the native OS API.
+
+namespace lyx {
+namespace support {
+namespace socktools {
+
+int listen(std::string const &, int)
+{
+ return -1;
+}
+
+
+int accept(int)
+{
+ return -1;
+}
+
+} // namespace socktools
+} // namespace support
+} // namespace lyx
+
+#else // defined (HAVE_FCNTL)
+
+#include "support/lyxlib.h"
+
#include "debug.h"
-#include "lyxlib.h"
#include <sys/socket.h>
#include <sys/un.h>
#include <fcntl.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <cerrno>
using std::endl;
+using std::string;
+
+#ifndef CXX_GLOBAL_CSTD
using std::strerror;
+#endif
-using std::string;
+// This MACRO eppears to be defined only on Linux.
+#if !defined(SUN_LEN)
+#define SUN_LEN(su) \
+ (sizeof (*(su)) - sizeof ((su)->sun_path) + strlen((su)->sun_path))
+#endif
namespace lyx {
lyxerr << "lyx: Could not bind address '" << name
<< "' to socket descriptor: " << strerror(errno) << endl;
::close(fd);
- lyx::support::unlink(name);
+ unlink(FileName(name));
return -1;
}
lyxerr << "lyx: Could not put socket in 'listen' state: "
<< strerror(errno) << endl;
::close(fd);
- lyx::support::unlink(name);
+ unlink(FileName(name));
return -1;
}
} // namespace socktools
} // namespace support
} // namespace lyx
+
+#endif // defined (HAVE_FCNTL)