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

- In __obtain_daemon_message() the test to verify if the bsdsocket.library API

would support the server API functionality checked the wrong feature. Fixed.

- Switched over the fd->fd_DefaultFile references to fd->fd_Socket where
  sockets are used rather than file handles.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15169 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2006-11-16 10:41:15 +00:00
parent 75b0a762ef
commit 77279e3224
20 changed files with 50 additions and 44 deletions

View File

@ -1,3 +1,9 @@
- In __obtain_daemon_message() the test to verify if the bsdsocket.library API
would support the server API functionality checked the wrong feature. Fixed.
- Switched over the fd->fd_DefaultFile references to fd->fd_Socket where
sockets are used rather than file handles.
- Added functions which modify the callback function and the userdata pointer
stored in a low level unbuffered file/socket data structure. These function
perform the proper locking and are thus safe to use in a thread-safe environment.

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_accept.c,v 1.16 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_accept.c,v 1.17 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -95,7 +95,7 @@ accept(int sockfd,struct sockaddr *cliaddr,socklen_t *addrlen)
goto out;
/* Remember the socket number for later. */
socket_fd = (LONG)fd->fd_DefaultFile;
socket_fd = fd->fd_Socket;
/* Now let go of the stdio lock, so that the only locking performed
will be done inside the accept() call. */

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_bind.c,v 1.7 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_bind.c,v 1.8 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ bind(int sockfd,const struct sockaddr *name,socklen_t namelen)
goto out;
PROFILE_OFF();
result = __bind((LONG)fd->fd_DefaultFile,(struct sockaddr *)name,namelen);
result = __bind(fd->fd_Socket,(struct sockaddr *)name,namelen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_connect.c,v 1.8 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_connect.c,v 1.9 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ connect(int sockfd,const struct sockaddr *name,socklen_t namelen)
goto out;
PROFILE_OFF();
result = __connect((LONG)fd->fd_DefaultFile,(struct sockaddr *)name,namelen);
result = __connect(fd->fd_Socket,(struct sockaddr *)name,namelen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_getpeername.c,v 1.7 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_getpeername.c,v 1.8 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ getpeername(int sockfd,struct sockaddr *name,socklen_t *namelen)
goto out;
PROFILE_OFF();
result = __getpeername((LONG)fd->fd_DefaultFile,name,(LONG *)namelen);
result = __getpeername(fd->fd_Socket,name,(LONG *)namelen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_getsockname.c,v 1.7 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_getsockname.c,v 1.8 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ getsockname(int sockfd,struct sockaddr *name,socklen_t *namelen)
goto out;
PROFILE_OFF();
result = __getsockname((LONG)fd->fd_DefaultFile,name,(LONG *)namelen);
result = __getsockname(fd->fd_Socket,name,(LONG *)namelen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_getsockopt.c,v 1.7 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_getsockopt.c,v 1.8 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -86,7 +86,7 @@ getsockopt(int sockfd,int level,int optname,void *optval,socklen_t *optlen)
goto out;
PROFILE_OFF();
result = __getsockopt((LONG)fd->fd_DefaultFile,level,optname,optval,(LONG *)optlen);
result = __getsockopt(fd->fd_Socket,level,optname,optval,(LONG *)optlen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_hook_entry.c,v 1.16 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_hook_entry.c,v 1.17 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -79,7 +79,7 @@ __socket_hook_entry(
PROFILE_OFF();
result = __recv((LONG)fd->fd_DefaultFile,fam->fam_Data,fam->fam_Size,0);
result = __recv(fd->fd_Socket,fam->fam_Data,fam->fam_Size,0);
if(result < 0)
fam->fam_Error = __get_errno();
@ -99,7 +99,7 @@ __socket_hook_entry(
PROFILE_OFF();
result = __send((LONG)fd->fd_DefaultFile,fam->fam_Data,fam->fam_Size,0);
result = __send(fd->fd_Socket,fam->fam_Data,fam->fam_Size,0);
if(result < 0)
fam->fam_Error = __get_errno();
@ -126,7 +126,7 @@ __socket_hook_entry(
{
PROFILE_OFF();
result = __CloseSocket((LONG)fd->fd_DefaultFile);
result = __CloseSocket(fd->fd_Socket);
PROFILE_ON();
}
@ -163,7 +163,7 @@ __socket_hook_entry(
param = (int)(fam->fam_Arg == 0);
result = __IoctlSocket(fd->fd_DefaultFile,FIONBIO,&param);
result = __IoctlSocket(fd->fd_Socket,FIONBIO,&param);
if(result < 0)
fam->fam_Error = __get_errno();
@ -175,7 +175,7 @@ __socket_hook_entry(
param = (int)(fam->fam_Arg != 0);
result = __IoctlSocket(fd->fd_DefaultFile,FIOASYNC,&param);
result = __IoctlSocket(fd->fd_Socket,FIOASYNC,&param);
if(result < 0)
fam->fam_Error = __get_errno();

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_ioctl.c,v 1.13 2006-09-25 15:38:21 obarthel Exp $
* $Id: socket_ioctl.c,v 1.14 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ ioctl(int sockfd,int request, ... /* char *arg */)
SHOWPOINTER(param);
PROFILE_OFF();
result = __IoctlSocket((LONG)fd->fd_DefaultFile,request,param);
result = __IoctlSocket(fd->fd_Socket,request,param);
PROFILE_ON();
if(result == 0)

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_listen.c,v 1.5 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_listen.c,v 1.6 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -64,7 +64,7 @@ listen(int sockfd,int backlog)
goto out;
PROFILE_OFF();
result = __listen((LONG)fd->fd_DefaultFile,backlog);
result = __listen(fd->fd_Socket,backlog);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_obtain_daemon.c,v 1.4 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_obtain_daemon.c,v 1.5 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -93,7 +93,7 @@ __obtain_daemon_message(VOID)
struct TagItem tags[2];
/* Check if it is safe to call the IsServerProcess() function. */
tags[0].ti_Tag = SBTM_GETREF(SBTC_BREAKMASK);
tags[0].ti_Tag = SBTM_GETREF(SBTC_HAVE_SERVER_API);
tags[0].ti_Data = (ULONG)&have_server_api;
tags[1].ti_Tag = TAG_END;

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_recv.c,v 1.6 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_recv.c,v 1.7 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -86,7 +86,7 @@ recv(int sockfd,void *buff,size_t nbytes,int flags)
goto out;
PROFILE_OFF();
result = __recv((LONG)fd->fd_DefaultFile,buff,(LONG)nbytes,flags);
result = __recv(fd->fd_Socket,buff,(LONG)nbytes,flags);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_recvfrom.c,v 1.8 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_recvfrom.c,v 1.9 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -87,7 +87,7 @@ recvfrom(int sockfd,void *buff,size_t len,int flags,struct sockaddr *from,sockle
goto out;
PROFILE_OFF();
result = __recvfrom((LONG)fd->fd_DefaultFile,buff,len,flags,from,(LONG *)fromlen);
result = __recvfrom(fd->fd_Socket,buff,len,flags,from,(LONG *)fromlen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_recvmsg.c,v 1.6 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_recvmsg.c,v 1.7 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ recvmsg(int sockfd,struct msghdr *msg,int flags)
goto out;
PROFILE_OFF();
result = __recvmsg((LONG)fd->fd_DefaultFile,msg,flags);
result = __recvmsg(fd->fd_Socket,msg,flags);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_select_signal.c,v 1.3 2006-06-22 09:02:44 obarthel Exp $
* $Id: socket_select_signal.c,v 1.4 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -288,7 +288,7 @@ map_descriptor_sets(
/* Is this a socket descriptor? */
if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET))
{
int socket_fd = (int)fd->fd_DefaultFile;
int socket_fd = fd->fd_Socket;
D(("corresponds to socket #%ld",socket_fd));
@ -415,7 +415,7 @@ remap_descriptor_sets(
for(output_fd = 0 ; output_fd < num_output_fds ; output_fd++)
{
fd = get_file_descriptor(output_fd);
if(fd != NULL && FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET) && (int)fd->fd_DefaultFile == socket_fd)
if(fd != NULL && FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET) && fd->fd_Socket == socket_fd)
{
assert( output_fd < num_output_fds );
assert( FLAG_IS_SET(__fd[output_fd]->fd_Flags,FDF_IS_SOCKET) );
@ -480,7 +480,7 @@ get_num_descriptors_used(int num_fds,int * num_socket_used_ptr,int * num_file_us
{
if(FLAG_IS_SET(fd->fd_Flags,FDF_IS_SOCKET))
{
int which_socket_fd = (int)fd->fd_DefaultFile;
int which_socket_fd = fd->fd_Socket;
if(num_socket_used < which_socket_fd+1)
num_socket_used = which_socket_fd+1;

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_send.c,v 1.8 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_send.c,v 1.9 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -86,7 +86,7 @@ send(int sockfd,const void *buff,size_t nbytes,int flags)
goto out;
PROFILE_OFF();
result = __send((LONG)fd->fd_DefaultFile,(void *)buff,(LONG)nbytes,flags);
result = __send(fd->fd_Socket,(void *)buff,(LONG)nbytes,flags);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_sendmsg.c,v 1.7 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_sendmsg.c,v 1.8 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -84,7 +84,7 @@ sendmsg(int sockfd,const struct msghdr *msg,int flags)
goto out;
PROFILE_OFF();
result = __sendmsg((LONG)fd->fd_DefaultFile,(struct msghdr *)msg,flags);
result = __sendmsg(fd->fd_Socket,(struct msghdr *)msg,flags);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_sendto.c,v 1.10 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_sendto.c,v 1.11 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -87,7 +87,7 @@ sendto(int sockfd,const void *buff,size_t len,int flags,const struct sockaddr *t
goto out;
PROFILE_OFF();
result = __sendto((LONG)fd->fd_DefaultFile,(void *)buff,len,flags,(struct sockaddr *)to,tolen);
result = __sendto(fd->fd_Socket,(void *)buff,len,flags,(struct sockaddr *)to,tolen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_setsockopt.c,v 1.9 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_setsockopt.c,v 1.10 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -86,7 +86,7 @@ setsockopt(int sockfd,int level,int optname,const void *optval,socklen_t optlen)
goto out;
PROFILE_OFF();
result = __setsockopt((LONG)fd->fd_DefaultFile,level,optname,(void *)optval,optlen);
result = __setsockopt(fd->fd_Socket,level,optname,(void *)optval,optlen);
PROFILE_ON();
out:

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_shutdown.c,v 1.5 2006-01-08 12:04:24 obarthel Exp $
* $Id: socket_shutdown.c,v 1.6 2006-11-16 10:41:15 obarthel Exp $
*
* :ts=4
*
@ -64,7 +64,7 @@ shutdown(int sockfd, int how)
goto out;
PROFILE_OFF();
result = __shutdown((LONG)fd->fd_DefaultFile,how);
result = __shutdown(fd->fd_Socket,how);
PROFILE_ON();
out: