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

- The internal 'struct fd' file descriptor table entry data structure

now has a user data field entry.

- Rearranged the contents of the 'struct fd' file descriptor table entry
  data structure in preparation for making it public. Also added a version
  field so that user code can handle changes to it gracefully. The default
  file is no longer a BCPL pointer to a file handle by default, but
  both a BPTR and a socket identifier, wrapped into a union.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15160 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2006-10-10 13:39:26 +00:00
parent 6809a5dd5b
commit 350ffdb790
6 changed files with 58 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_remove_fd_alias.c,v 1.4 2006-01-08 12:04:25 obarthel Exp $
* $Id: stdio_remove_fd_alias.c,v 1.5 2006-10-10 13:39:26 obarthel Exp $
*
* :ts=4
*
@ -54,36 +54,36 @@ __remove_fd_alias(struct fd * fd)
/* Remove this alias from the list. */
for(list_fd = fd->fd_Original ;
list_fd != NULL ;
list_fd = list_fd->fd_NextLink)
list_fd = list_fd->fd_NextAlias)
{
if(list_fd->fd_NextLink == fd)
if(list_fd->fd_NextAlias == fd)
{
list_fd->fd_NextLink = fd->fd_NextLink;
list_fd->fd_NextAlias = fd->fd_NextAlias;
break;
}
}
}
else if (fd->fd_NextLink != NULL) /* this one has aliases attached; it is the 'original' resource */
else if (fd->fd_NextAlias != NULL) /* this one has aliases attached; it is the 'original' resource */
{
struct fd * first_alias;
struct fd * next_alias;
struct fd * list_fd;
/* The first link now becomes the original resource */
first_alias = fd->fd_NextLink;
next_alias = first_alias->fd_NextLink;
first_alias = fd->fd_NextAlias;
next_alias = first_alias->fd_NextAlias;
/* Structure copy... */
(*first_alias) = (*fd);
/* Fix up the linkage. */
first_alias->fd_NextLink = next_alias;
first_alias->fd_NextAlias = next_alias;
first_alias->fd_Original = NULL;
/* The resources are migrated to the first link. */
for(list_fd = next_alias ;
list_fd != NULL ;
list_fd = list_fd->fd_NextLink)
list_fd = list_fd->fd_NextAlias)
{
list_fd->fd_Original = first_alias;
}