[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-193-
From: |
Giuseppe Scrivano |
Subject: |
[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-193-g02495f9 |
Date: |
Mon, 26 Apr 2010 10:58:27 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".
The branch, master has been updated
via 02495f9e5b945025cd4485ce714a5693611f0e52 (commit)
via 336e1da213ee540a90cd5c3d9badcea8ea9e050a (commit)
from af1d954f8762ad8d998073e623cc8fdbe9ee3549 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 02495f9e5b945025cd4485ce714a5693611f0e52
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Apr 26 11:27:49 2010 +0200
Map an errno to an exception only when the symbol is defined
diff --git a/myserver/src/base/exceptions/checked.cpp
b/myserver/src/base/exceptions/checked.cpp
index f5f0a27..94b7f00 100644
--- a/myserver/src/base/exceptions/checked.cpp
+++ b/myserver/src/base/exceptions/checked.cpp
@@ -19,6 +19,8 @@
*/
#include <include/base/exceptions/checked.h>
+#include <errno.h>
+
namespace checked
{
int accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
@@ -250,441 +252,659 @@ namespace checked
{
switch(errno)
{
+#ifdef E2BIG
case E2BIG:
throw ArgumentListException ();
break;
+#endif
+#ifdef EACCES
case EACCES:
throw PermissionDeniedException ();
break;
+#endif
+#ifdef EADDRINUSE
case EADDRINUSE:
throw AddressException ();
break;
+#endif
+#ifdef EADDRNOTAVAIL
case EADDRNOTAVAIL:
throw AddressException ();
break;
+#endif
+#ifdef EAFNOSUPPORT
case EAFNOSUPPORT:
throw ProtocolException ();
break;
+#endif
+#ifdef EAGAIN
case EAGAIN:
throw InvalidResourceException ();
break;
+#endif
+#ifdef EALREADY
case EALREADY:
throw ProgressException ();
break;
+#endif
+#ifdef EBADE
case EBADE:
throw InvalidExchangeException ();
break;
+#endif
+#ifdef EBADF
case EBADF:
throw BadDescriptorException ();
break;
+#endif
+#ifdef EBADFD
case EBADFD:
throw BadDescriptorException ();
break;
+#endif
+#ifdef EBADMSG
case EBADMSG:
throw MessageException ();
break;
+#endif
+#ifdef EBADR
case EBADR:
throw RequestCodeException ();
break;
+#endif
+#ifdef EBADRQC
case EBADRQC:
throw RequestCodeException ();
break;
+#endif
+#ifdef EBADSLT
case EBADSLT:
throw SlotException ();
break;
+#endif
+#ifdef EBUSY
case EBUSY:
throw BusyResourceException ();
break;
+#endif
+#ifdef ECANCELED
case ECANCELED:
throw CancelException ();
break;
+#endif
+#ifdef ECHILD
case ECHILD:
throw ProcessException ();
break;
+#endif
+#ifdef ECHRNG
case ECHRNG:
throw ChannelOutOfRangeException ();
break;
+#endif
+#ifdef ECOMM
case ECOMM:
throw SendException ();
break;
+#endif
+#ifdef ECONNABORTED
case ECONNABORTED:
throw AbortedConnectionException ();
break;
+#endif
+#ifdef ECONNREFUSED
case ECONNREFUSED:
throw RefusedConnectionException ();
break;
+#endif
+#ifdef ECONNRESET
case ECONNRESET:
throw ResetException ();
break;
+#endif
+#ifdef EDEADLK
case EDEADLK:
throw DeadlockException ();
break;
+#endif
+#ifdef EDESTADDRREQ
case EDESTADDRREQ:
throw AddressException ();
break;
+#endif
+#ifdef EDOM
case EDOM:
throw MathException ();
break;
+#endif
+#ifdef EDQUOT
case EDQUOT:
throw DiskQuotaException ();
break;
+#endif
+#ifdef EEXIST
case EEXIST:
throw FileExistsException ();
break;
+#endif
+#ifdef EFAULT
case EFAULT:
throw FaultException ();
break;
+#endif
+#ifdef EFBIG
case EFBIG:
throw FileTooLargeException ();
break;
+#endif
+#ifdef EHOSTDOWN
case EHOSTDOWN:
throw HostDownException ();
break;
+#endif
+#ifdef EHOSTUNREACH
case EHOSTUNREACH:
throw UnreachHostException ();
break;
+#endif
+#ifdef EIDRM
case EIDRM:
throw IdentifierException ();
break;
+#endif
+#ifdef EILSEQ
case EILSEQ:
throw ByteException ();
break;
+#endif
+#ifdef EINPROGRESS
case EINPROGRESS:
throw ProgressException ();
break;
+#endif
+#ifdef EINTR
case EINTR:
throw FunctionException ();
break;
+#endif
+#ifdef EINVAL
case EINVAL:
throw ArgumentListException ();
break;
+#endif
+#ifdef EIO
case EIO:
throw IOException ();
break;
+#endif
+#ifdef EISCONN
case EISCONN:
throw SocketException ();
break;
+#endif
+#ifdef EISDIR
case EISDIR:
throw DirectoryException ();
break;
+#endif
+#ifdef EISNAM
case EISNAM:
throw NamedFileException ();
break;
+#endif
+#ifdef EKEYEXPIRED
case EKEYEXPIRED:
throw KeyException ();
break;
+#endif
+#ifdef EKEYREJECTED
case EKEYREJECTED:
throw KeyException ();
break;
+#endif
+#ifdef EKEYREVOKED
case EKEYREVOKED:
throw KeyException ();
break;
+#endif
+#ifdef EL2HLT
case EL2HLT:
throw HaltException ();
break;
+#endif
+#ifdef EL2NSYNC
case EL2NSYNC:
throw HaltException ();
break;
+#endif
+#ifdef EL3HLT
case EL3HLT:
throw HaltException ();
break;
+#endif
+#ifdef ELIBACC
case ELIBACC:
throw LibraryException ();
break;
+#endif
+#ifdef ELIBBAD
case ELIBBAD:
throw LibraryException ();
break;
+#endif
+#ifdef ELIBMAX
case ELIBMAX:
throw LibraryException ();
break;
+#endif
+#ifdef ELIBSCN
case ELIBSCN:
throw LibraryException ();
break;
+#endif
+#ifdef ELIBEXEC
case ELIBEXEC:
throw LibraryException ();
break;
+#endif
+#ifdef ELOOP
case ELOOP:
throw LinkException ();
break;
+#endif
+#ifdef EMEDIUMTYPE
case EMEDIUMTYPE:
throw MediaException ();
break;
+#endif
+#ifdef EMFILE
case EMFILE:
throw TooManyFileException ();
break;
+#endif
+#ifdef EMLINK
case EMLINK:
throw LinkException ();
break;
+#endif
+#ifdef EMSGSIZE
case EMSGSIZE:
throw MessageException ();
break;
+#endif
+#ifdef EMULTIHOP
case EMULTIHOP:
throw MultihopException ();
break;
+#endif
+#ifdef ENAMETOOLONG
case ENAMETOOLONG:
throw FileTooLongException ();
break;
+#endif
+#ifdef ENETRESET
case ENETRESET:
throw NetworkException ();
break;
+#endif
+#ifdef ENETUNREACH
case ENETUNREACH:
throw NetworkException ();
break;
+#endif
+#ifdef ENFILE
case ENFILE:
throw FilesystemException ();
break;
+#endif
+#ifdef ENOBUFS
case ENOBUFS:
throw BufferOverflowException ();
break;
+#endif
+#ifdef ENODATA
case ENODATA:
throw StreamException ();
break;
+#endif
+#ifdef ENODEV
case ENODEV:
throw DeviceException ();
break;
+#endif
+#ifdef ENOENT
case ENOENT:
throw FileNotFoundException ();
break;
+#endif
+#ifdef ENOEXEC
case ENOEXEC:
throw ExecFormatException ();
break;
+#endif
+#ifdef ENOKEY
case ENOKEY:
throw KeyException ();
break;
+#endif
+#ifdef ENOLINK
case ENOLINK:
throw LinkException ();
break;
+#endif
+#ifdef ENOMEDIUM
case ENOMEDIUM:
throw MediaException ();
break;
+#endif
+#ifdef ENOMEM
case ENOMEM:
throw MemoryOverflowException ();
break;
+#endif
+#ifdef ENOMSG
case ENOMSG:
throw MessageException ();
break;
+#endif
+#ifdef ENONET
case ENONET:
throw NetworkException ();
break;
+#endif
+#ifdef ENOSPC
case ENOSPC:
throw OverflowException ();
break;
+#endif
+#ifdef ENOSR
case ENOSR:
throw StreamException ();
break;
+#endif
+#ifdef ENOSTR
case ENOSTR:
throw StreamException ();
break;
+#endif
+#ifdef ENOSYS
case ENOSYS:
throw FunctionException ();
break;
+#endif
+#ifdef ENOTBLK
case ENOTBLK:
throw BlockingException ();
break;
+#endif
+#ifdef ENOTCONN
case ENOTCONN:
throw SocketException ();
break;
+#endif
+#ifdef ENOTDIR
case ENOTDIR:
throw DirectoryException ();
break;
+#endif
+#ifdef ENOTEMPTY
case ENOTEMPTY:
throw DirectoryException ();
break;
+#endif
+#ifdef ENOTSOCK
case ENOTSOCK:
throw SocketException ();
break;
+#endif
+#ifdef ENOTTY
case ENOTTY:
throw IOException ();
break;
+#endif
+#ifdef ENOTUNIQ
case ENOTUNIQ:
throw NetworkException ();
break;
+#endif
+#ifdef ENXIO
case ENXIO:
throw DeviceException ();
break;
+#endif
+#ifdef EOVERFLOW
case EOVERFLOW:
throw OverflowException ();
break;
+#endif
+#ifdef EPERM
case EPERM:
throw PermissionDeniedException ();
break;
+#endif
+#ifdef EPFNOSUPPORT
case EPFNOSUPPORT:
throw ProtocolException ();
break;
+#endif
+#ifdef EPIPE
case EPIPE:
throw PipeException ();
break;
+#endif
+#ifdef EPROTO
case EPROTO:
throw ProtocolException ();
break;
+#endif
+#ifdef EPROTONOSUPPORT
case EPROTONOSUPPORT:
throw ProtocolException ();
break;
+#endif
+#ifdef EPROTOTYPE
case EPROTOTYPE:
throw ProtocolException ();
break;
+#endif
+#ifdef ERANGE
case ERANGE:
throw OverflowException ();
break;
+#endif
+#ifdef EREMCHG
case EREMCHG:
throw AddressException ();
break;
+#endif
+#ifdef EREMOTEIO
case EREMOTEIO:
throw IOException ();
break;
+#endif
+#ifdef ERESTART
case ERESTART:
throw FunctionException ();
break;
+#endif
+#ifdef EROFS
case EROFS:
throw FilesystemException ();
break;
+#endif
+#ifdef ESHUTDOWN
case ESHUTDOWN:
throw SendException ();
break;
+#endif
+#ifdef ESPIPE
case ESPIPE:
throw PipeException ();
break;
+#endif
+#ifdef ESOCKTNOSUPPORT
case ESOCKTNOSUPPORT:
throw SocketException ();
break;
+#endif
+#ifdef ESRCH
case ESRCH:
throw ProcessException ();
break;
+#endif
+#ifdef ESTALE
case ESTALE:
throw GenericFileException ();
break;
+#endif
+#ifdef ESTRPIPE
case ESTRPIPE:
throw PipeException ();
break;
+#endif
+#ifdef ETIME
case ETIME:
throw TimerException ();
break;
+#endif
+#ifdef ETIMEDOUT
case ETIMEDOUT:
throw TimerException ();
break;
+#endif
+#ifdef ETXTBSY
case ETXTBSY:
throw BusyResourceException ();
break;
+#endif
+#ifdef EUNATCH
case EUNATCH:
throw ProtocolException ();
break;
+#endif
+#ifdef EUSERS
case EUSERS:
throw UserException ();
break;
+#endif
+#ifdef EXDEV
case EXDEV:
throw LinkException ();
break;
+#endif
+#ifdef EXFULL
case EXFULL:
throw InvalidExchangeException ();
break;
+#endif
default:
throw UnknownException ();
commit 336e1da213ee540a90cd5c3d9badcea8ea9e050a
Author: Giuseppe Scrivano <address@hidden>
Date: Mon Apr 26 11:19:35 2010 +0200
Use standard macro definitions names for include's presence
diff --git a/myserver/SConstruct b/myserver/SConstruct
index 4d7e9e1..75803c6 100644
--- a/myserver/SConstruct
+++ b/myserver/SConstruct
@@ -172,8 +172,8 @@ if not env.GetOption('clean'):
if conf.CheckFunc("localtime_r"):
conf.Define('LOCALTIME_R', 1)
- if conf.CheckFunc("sendfile"):
- conf.Define('SENDFILE', 1)
+ if conf.CheckHeader("sys/sendfile.h"):
+ conf.Define('HAVE_SYS_SENDFILE_H', 1)
if conf.CheckFunc("setgroups"):
conf.Define('SETGROUPS', 1)
@@ -189,12 +189,6 @@ if not env.GetOption('clean'):
if conf.CheckHeader("stdint.h"):
conf.Define('STDINT_H', 1)
- if conf.CheckHeader("argp.h"):
- conf.Define('ARGP', 1)
-
- if conf.CheckHeader("error.h"):
- conf.Define('ERROR_H', 1)
-
if conf.CheckHeader("stdlib.h"):
conf.Define('STDLIB_H', 1)
@@ -220,7 +214,7 @@ if not env.GetOption('clean'):
conf.Define('UNISTD_H', 1)
if conf.CheckHeader("grp.h"):
- conf.Define('GRP', 1)
+ conf.Define('HAVE_GRP_H', 1)
if conf.CheckHeader("dlfcn.h"):
conf.Define('DLFCN_H', 1)
diff --git a/myserver/configure.ac b/myserver/configure.ac
index eb22297..99f58c6 100644
--- a/myserver/configure.ac
+++ b/myserver/configure.ac
@@ -87,14 +87,7 @@ AC_ARG_ENABLE([tests], [--disable-tests Disable the tests
suite],
AC_ARG_ENABLE([gui], [--enable-gui Build and install GUI application],
enable_gui="yes", enable_gui="")
-
-AC_CHECK_HEADER([argp.h], AC_DEFINE(ARGP, 1,
- [Define if GNU argp tools are available]))
-AC_CHECK_HEADER([error.h], AC_DEFINE(ERRORH, 1,
- [Define if the error.h file is present]))
-AC_CHECK_HEADER([grp.h], AC_DEFINE(GRP, 1, [Define if grp.h is available]))
-AC_CHECK_HEADER([sys/sendfile.h], AC_DEFINE(SENDFILE, 1,
- [Define if the sendfile syscall is present]))
+AC_CHECK_HEADERS([execinfo.h grp.h sys/sendfile.h])
gl_INIT
diff --git a/myserver/include/base/exceptions/exceptions.h
b/myserver/include/base/exceptions/exceptions.h
index 65c659b..3cbae58 100644
--- a/myserver/include/base/exceptions/exceptions.h
+++ b/myserver/include/base/exceptions/exceptions.h
@@ -23,7 +23,11 @@
# include <exception>
# include <errno.h>
-# include <execinfo.h>
+
+# ifdef HAVE_EXECINFO_H
+# include <execinfo.h>
+# endif
+
# include <stdlib.h>
# include <string.h>
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index c16cb66..95db601 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -35,7 +35,7 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>.
#include <math.h>
#include <time.h>
-#ifdef SENDFILE
+#ifdef HAVE_SYS_SENDFILE_H
# include <fcntl.h>
# include <stdlib.h>
# include <stdio.h>
@@ -45,7 +45,6 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>.
# include <unistd.h>
#endif
-
#include <string>
#include <sstream>
@@ -376,7 +375,7 @@ int File::read (char* buffer, u_long buffersize, u_long*
nbr)
int File::fastCopyToSocket (Socket *dest, u_long firstByte, MemBuf *buf,
u_long *nbw)
{
*nbw = 0;
-#ifdef SENDFILE
+#ifdef HAVE_SYS_SENDFILE_H
off_t offset = firstByte;
size_t fileSize = getFileSize ();
while (1)
diff --git a/myserver/src/base/process/process.cpp
b/myserver/src/base/process/process.cpp
index e8c992e..94d3d5a 100644
--- a/myserver/src/base/process/process.cpp
+++ b/myserver/src/base/process/process.cpp
@@ -37,7 +37,7 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>.
# include <pwd.h>
# endif
-# ifdef GRP
+# ifdef HAVE_GRP_H
# include <grp.h>
# endif
@@ -359,7 +359,7 @@ gid_t Process::getGid (const char *grp)
return gid;
}
-# ifdef GRP
+# ifdef HAVE_GRP_H
struct group *g = getgrnam (grp);
if (g != NULL)
return g->gr_gid;
diff --git a/myserver/src/base/utility.cpp b/myserver/src/base/utility.cpp
index 45c42b1..35b4f59 100644
--- a/myserver/src/base/utility.cpp
+++ b/myserver/src/base/utility.cpp
@@ -20,14 +20,17 @@ along with this program. If not, see
<http://www.gnu.org/licenses/>.
#include "myserver.h"
#include <include/base/utility.h>
#include <include/base/string/securestr.h>
+
extern "C"
{
#include <chdir-long.h>
}
+
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "nproc.h"
+
#ifndef WIN32
# include <unistd.h>
# include <signal.h>
@@ -35,10 +38,6 @@ extern "C"
# include <sys/wait.h>
# include <sys/time.h>
# include <errno.h>
-
-# ifdef ERRORH
-# include <error.h>
-# endif
#endif
#include <include/base/exceptions/checked.h>
-----------------------------------------------------------------------
Summary of changes:
myserver/SConstruct | 12 +-
myserver/configure.ac | 9 +-
myserver/include/base/exceptions/exceptions.h | 6 +-
myserver/src/base/exceptions/checked.cpp | 220 +++++++++++++++++++++++++
myserver/src/base/file/file.cpp | 5 +-
myserver/src/base/process/process.cpp | 4 +-
myserver/src/base/utility.cpp | 7 +-
7 files changed, 236 insertions(+), 27 deletions(-)
hooks/post-receive
--
GNU MyServer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-193-g02495f9,
Giuseppe Scrivano <=