1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The network startup code no longer checks for the presence of a possible

daemon startup message by default. You now have to enable this feature
  by declaring a global variable called "__check_daemon_startup" which is
  described in <dos.h>.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15050 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-10-20 06:50:32 +00:00
parent b6de3e4c48
commit 63c08cfe0e
7 changed files with 84 additions and 16 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.71 2005-10-17 13:54:25 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.72 2005-10-20 06:50:32 obarthel Exp $
#
# :ts=8
#
@ -728,6 +728,7 @@ NET_LIB = \
net.lib_rev.o \
socket_accept.o \
socket_bind.o \
socket_check_daemon.o \
socket_connect.o \
socket_gethostbyaddr.o \
socket_gethostbyname.o \

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.80 2005-10-17 13:54:25 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.81 2005-10-20 06:50:32 obarthel Exp $
#
# :ts=8
#
@ -699,6 +699,7 @@ NET_LIB = \
net.lib_rev.o \
socket_accept.o \
socket_bind.o \
socket_check_daemon.o \
socket_connect.o \
socket_gethostbyaddr.o \
socket_gethostbyname.o \

View File

@ -27,6 +27,11 @@
"__bool_true_false_are_defined" rather than "__bool_true_and_false_are_defined".
Thanks go to Peter Bengtsson for finding and fixing it.
- The network startup code no longer checks for the presence of a possible
daemon startup message by default. You now have to enable this feature
by declaring a global variable called "__check_daemon_startup" which is
described in <dos.h>.
c.lib 1.196 (11.10.2005)

View File

@ -1,5 +1,5 @@
/*
* $Id: dos.h,v 1.12 2005-10-17 13:54:25 obarthel Exp $
* $Id: dos.h,v 1.13 2005-10-20 06:50:32 obarthel Exp $
*
* :ts=4
*
@ -148,9 +148,24 @@ extern int __get_default_file(int file_descriptor,long * file_ptr);
/****************************************************************************/
/*
* If your program is intended to be launched by the Internet superserver
* (inetd) to run as a daemon, receiving and sending data through a network
* connection set up for it, declare the following variable in your program
* and set it to TRUE. This will make the program's network startup code
* link the stdin/stdout/stderr streams with the daemon socket passed to it.
* Whether or not your program is running as a daemon can be tested by
* checking the global __is_daemon variable described below.
*/
extern BOOL __check_daemon_startup;
/****************************************************************************/
/*
* This will be set to TRUE if the current program was launched from
* the internet superserver ('inetd') or an equivalent facility.
* the internet superserver ('inetd') or an equivalent facility. Note
* that you need to have set __check_daemon_startup to TRUE before
* you can rely upon __is_daemon to be initialized correctly.
*/
extern BOOL __is_daemon;

View File

@ -1,5 +1,5 @@
#
# $Id: smakefile,v 1.53 2005-10-17 13:54:25 obarthel Exp $
# $Id: smakefile,v 1.54 2005-10-20 06:50:32 obarthel Exp $
#
# :ts=8
#
@ -317,6 +317,7 @@ SOCKET_OBJ = \
socket_accept.o \
socket_bind.o \
socket_connect.o \
socket_check_daemon.o \
socket_gethostbyaddr.o \
socket_gethostbyname.o \
socket_gethostid.o \

View File

@ -0,0 +1,48 @@
/*
* $Id: socket_check_daemon.c,v 1.1 2005-10-20 06:50:32 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(SOCKET_SUPPORT)
/****************************************************************************/
#ifndef _SOCKET_HEADERS_H
#include "socket_headers.h"
#endif /* _SOCKET_HEADERS_H */
/****************************************************************************/
BOOL __check_daemon_startup;
/****************************************************************************/
#endif /* SOCKET_SUPPORT */

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_init_exit.c,v 1.21 2005-10-17 13:54:25 obarthel Exp $
* $Id: socket_init_exit.c,v 1.22 2005-10-20 06:50:32 obarthel Exp $
*
* :ts=4
*
@ -174,7 +174,8 @@ SOCKET_DESTRUCTOR(socket_exit)
PROFILE_ON();
}
/* Careful: if this function is ever invoked, it must make sure that
/*
* Careful: if this function is ever invoked, it must make sure that
* the socket file descriptors are invalidated. If that
* does not happen, the stdio cleanup function will
* crash (with bells on).
@ -213,8 +214,7 @@ SOCKET_CONSTRUCTOR(socket_init)
PROFILE_OFF();
/* bsdsocket.library V3 is sufficient for all the tasks we
* may have to perform.
*/
may have to perform. */
__SocketBase = OpenLibrary("bsdsocket.library",3);
#if defined(__amigaos4__)
@ -316,15 +316,13 @@ SOCKET_CONSTRUCTOR(socket_init)
#endif /* __THREAD_SAFE */
/* Check if this program was launched as a server by the Internet
* superserver.
*/
if(Cli() != NULL && NOT __detach)
superserver. */
if(Cli() != NULL && NOT __detach && __check_daemon_startup)
{
struct DaemonMessage * dm;
/* The socket the superserver may have launched this program
* with is attached to the exit data entry of the process.
*/
with is attached to the exit data entry of the process. */
#if defined(__amigaos4__)
{
dm = (struct DaemonMessage *)GetExitData();
@ -348,8 +346,7 @@ SOCKET_CONSTRUCTOR(socket_init)
SHOWMSG("we have a daemon message; this is a server");
/* Try to grab that socket and attach is to the three
* standard I/O streams.
*/
standard I/O streams. */
PROFILE_OFF();
daemon_socket = __ObtainSocket(dm->dm_ID,dm->dm_Family,dm->dm_Type,0);