GUSI 2.1.9 update

This commit is contained in:
chombier 2001-10-06 09:50:37 +00:00
parent f6280ec569
commit 7891913935
27 changed files with 276 additions and 69 deletions

Binary file not shown.

Binary file not shown.

View File

@ -4,10 +4,10 @@
// % Author : Matthias Neeracher
// % Language : C++
// %
// % $Log$
// % Revision 1.1.1.1 2001/03/03 21:50:11 chombier
// % Initial import
// %
// % $Log$
// % Revision 1.8 2001/07/23 06:31:37 neeri
// % Use PBXGetVolInfoSync to get correct block size for stat() (MacPerl Bug #424874)
// %
// % Revision 1.7 2001/01/17 08:45:49 neeri
// % Make open calls synchronous
// %
@ -100,6 +100,12 @@ OSErr GUSIFSHGetVolParms(GUSIIOPBWrapper<HParamBlockRec> * pb);
OSErr GUSIFSCreate(const FSSpec * spec);
// <Declarations of C++ [[GUSIFSWrappers]]>=
OSErr GUSIFSCatMove(const FSSpec * spec, long dest);
// Getting the correct allocation block size can be sort of tricky. [[PBHGetVInfoAsync]] returns
// a value tweaked to allow free space calculations on large volumes, so we have to walk the
// fcb queue to get a legitimate value.
//
// <Declarations of C++ [[GUSIFSWrappers]]>=
OSErr GUSIFSXGetVolInfo(GUSIIOPBWrapper<XVolumeParam> * pb);
#endif
#endif /* GUSI_SOURCE */

View File

@ -4,13 +4,19 @@
// % Author : Matthias Neeracher
// % Language : C++
// %
// % $Log$
// % Revision 1.1.1.1 2001/03/07 09:50:44 chombier
// % First Imported.
// %
// % Revision 1.1.1.1 2001/03/03 21:50:11 chombier
// % Initial import
// %
// % $Log$
// % Revision 1.19 2001/04/16 01:50:02 neeri
// % Fix GUSIFSpGetCatInfo (MacPerl bug #232702); Fix parsing of absolute paths with embedded aliases.
// %
// % Revision 1.18 2001/04/01 07:40:15 neeri
// % Fix :::paths (MacPerl Bug #409940)
// %
// % Revision 1.17 2001/03/20 02:34:22 neeri
// % Commented out false friends
// %
// % Revision 1.16 2001/03/09 09:20:53 neeri
// % Fixed major bugs in relative path generation
// %
// % Revision 1.15 2001/01/17 08:46:45 neeri
// % Get rid of excess directory seperators when name is empty
// %
@ -125,8 +131,8 @@ OSErr GUSIFSpResolve(FSSpec * spec);
/* Touch folder containing the object */
OSErr GUSIFSpTouchFolder(const FSSpec * spec);
/* Get catalog information */
OSErr GUSIFSpGetCatInfo(const FSSpec * spec, CInfoPBRec * info);
/* Get catalog information (after resolving leaf aliases) */
OSErr GUSIFSpGetCatInfo(FSSpec * spec, CInfoPBRec * info);
__END_DECLS
#ifdef GUSI_SOURCE

View File

@ -4,7 +4,10 @@
// % Author : Matthias Neeracher
// % Language : C++
// %
// % $Log$
// % $Log$
// % Revision 1.2 2001/03/28 14:04:32 chombier
// % GUSI 2.1.6b2 update
// %
// % Revision 1.21 2001/03/20 08:12:55 neeri
// % Further select repairs
// %
@ -99,6 +102,26 @@
#undef TCP_NODELAY
#undef TCP_MAXSEG
#if UNIVERSAL_INTERFACES_VERSION >= 0x0340
#undef IP_OPTIONS
#undef IP_TOS
#undef IP_TTL
#undef IP_REUSEADDR
#undef IP_DONTROUTE
#undef IP_BROADCAST
#undef IP_HDRINCL
#undef IP_RCVOPTS
#undef IP_RCVDSTADDR
#undef IP_MULTICAST_IF
#undef IP_MULTICAST_TTL
#undef IP_MULTICAST_LOOP
#undef IP_ADD_MEMBERSHIP
#undef IP_DROP_MEMBERSHIP
#undef IP_RCVIFADDR
#undef SIGURG
#endif
#include <OpenTransport.h>
#include <OpenTptInternet.h>

View File

@ -122,7 +122,7 @@ int fcntl __P((int, int, ...));
/* This properly belongs into stdio.h, but that header is outside of
GUSI's control
*/
#if defined(__MWERKS__) && !defined(_SFSTDIO_H)
#if defined(__MWERKS__) && __MWERKS__ < 0x2401 && !defined(_SFSTDIO_H)
FILE * fdopen(int fildes, char *type);
#else
FILE * fdopen(int fildes, const char *type);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -701,7 +701,7 @@ void GUSIStartIO(IOParam * pb)
static IOCompletionUPP sIODone = 0;
if (!sIODone)
sIODone = NewIOCompletionProc(GUSIIODoneEntry);
sIODone = NewIOCompletionProc(reinterpret_cast<IOCompletionProcPtr>(GUSIIODoneEntry));
Context(pb) = nil;
pb->ioCompletion = sIODone;
}

View File

@ -112,7 +112,7 @@ GUSIDescriptorTable * GUSIDescriptorTable::Instance()
GUSISetupDescriptorTable();
if (!sGUSIDescriptorTable)
sGUSIDescriptorTable = new GUSIDescriptorTable();
sGUSIDescriptorTable = new GUSIDescriptorTable();
}
if (sNeedConsoleSetup) {
sNeedConsoleSetup = false;

View File

@ -7,6 +7,9 @@
#include <Devices.h>
#include <Script.h>
#include <StringCompare.h>
#include <Traps.h>
#include <FSM.h>
#include <Gestalt.h>
// <Implementation of [[GUSIFSWrappers]]>=
OSErr GUSIFSGetCatInfo(GUSIIOPBWrapper<GUSICatInfo> * info)
@ -370,3 +373,100 @@ OSErr GUSIFSMoveRename(const FSSpec * spec, const FSSpec * dest)
return err;
}
// [[PBXGetVolInfoSync]] was a late addition to InterfaceLib, so we avoid linking to it
// and instead employ the method demonstrated in MoreFiles, calling the routine via its
// trap or via a dynamic lookup.
//
// <Implementation of [[GUSIFSWrappers]]>=
#if TARGET_API_MAC_CARBON || !TARGET_RT_MAC_CFM
// Carbon builds and 68K builds don't need this glue
#define CallPBXGetVolInfoAsync PBXGetVolInfoAsync
#else // TARGET_API_MAC_CARBON || !TARGET_RT_MAC_CFM
/* This is exactly like the simple mixed mode glue in InterfaceLib in Mac OS 8.5 and 8.6 */
static pascal OSErr PBXGetVolInfoAsyncGlue(XVolumeParamPtr paramBlock)
{
enum
{
uppFSDispatchProcInfo = kRegisterBased
| REGISTER_RESULT_LOCATION(kRegisterD0)
| RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
| REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(long))) /* selector */
| REGISTER_ROUTINE_PARAMETER(2, kRegisterD1, SIZE_CODE(sizeof(long))) /* trap word */
| REGISTER_ROUTINE_PARAMETER(3, kRegisterA0, SIZE_CODE(sizeof(XVolumeParamPtr)))
};
static UniversalProcPtr fsDispatchTrapAddress = NULL;
/* Is this the first time we've been called? */
if ( fsDispatchTrapAddress == NULL )
{
/* Yes - Get the trap address of _FSDispatch */
fsDispatchTrapAddress = NGetTrapAddress(_FSDispatch, OSTrap);
}
return ( CallOSTrapUniversalProc(fsDispatchTrapAddress,
uppFSDispatchProcInfo,
kFSMXGetVolInfo,
_FSDispatch | kAsyncMask,
paramBlock) );
}
/*
** PBXGetVolInfoSync was added to the File Manager in System software 7.5.2.
** However, PBXGetVolInfoSync wasn't added to InterfaceLib until Mac OS 8.5.
** This wrapper calls PBXGetVolInfoSync if it is found in InterfaceLib;
** otherwise, it calls PBXGetVolInfoSyncGlue. This ensures that your program
** is calling the latest implementation of PBXGetVolInfoSync.
*/
static pascal OSErr CallPBXGetVolInfoAsync(XVolumeParamPtr paramBlock)
{
typedef pascal OSErr (*PBXGetVolInfoProcPtr) (XVolumeParamPtr paramBlock);
OSErr result;
CFragConnectionID connID;
static PBXGetVolInfoProcPtr PBXGetVolInfoAsyncPtr = NULL;
//* Is this the first time we've been called? */
if ( PBXGetVolInfoAsyncPtr == NULL )
{
/* Yes - Get our connection ID to InterfaceLib */
result = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kLoadCFrag, &connID, NULL, NULL);
if ( result == noErr )
{
/* See if PBXGetVolInfoSync is in InterfaceLib */
if ( FindSymbol(connID, "\pPBXGetVolInfoAsync", &(Ptr)PBXGetVolInfoAsyncPtr, NULL) != noErr )
{
/* Use glue code if symbol isn't found */
PBXGetVolInfoAsyncPtr = PBXGetVolInfoAsyncGlue;
}
}
}
/* Call PBXGetVolInfoAsync if present; otherwise, call PBXGetVolInfoAsyncGlue */
return ( (*PBXGetVolInfoAsyncPtr)(paramBlock) );
}
#endif // TARGET_API_MAC_CARBON || !TARGET_RT_MAC_CFM
// <Implementation of [[GUSIFSWrappers]]>=
OSErr GUSIFSXGetVolInfo(GUSIIOPBWrapper<XVolumeParam> * pb)
{
#if !TARGET_API_MAC_CARBON
/* See if large volume support is available */
long response;
if (!Gestalt(gestaltFSAttr, &response) && (response & (1L << gestaltFSSupports2TBVols))) {
#endif // !TARGET_API_MAC_CARBON
pb->StartIO();
CallPBXGetVolInfoAsync(&pb->fPB);
return pb->FinishIO();
#if !TARGET_API_MAC_CARBON
} else {
OSErr result = GUSIFSHGetVInfo(reinterpret_cast<GUSIIOPBWrapper<HParamBlockRec> *>(pb));
if (!result)
for (VCB * vcb = (VCB *)(GetVCBQHdr()->qHead); vcb; vcb = (VCB *)(vcb->qLink))
if (vcb->vcbVRefNum == pb->fPB.ioVRefNum) {
pb->fPB.ioVAlBlkSiz = vcb->vcbAlBlkSiz;
return noErr;
}
return result;
}
#endif
}

View File

@ -179,7 +179,8 @@ GUSIFileSpec::GUSIFileSpec(const char * path, bool useAlias)
}
}
// For relative paths, we now skip a leading colon. For absolute paths, we get
// the volume information.
// the volume information. [[fullSpec]] is true for absolute paths, but not for
// relative paths.
//
// <Determine the starting directory of the path>=
if (path[0] == ':') {
@ -196,7 +197,8 @@ GUSIFileSpec::GUSIFileSpec(const char * path, bool useAlias)
if (GetVolume())
return;
path = nextPath + 1;
path = nextPath + 1;
fullSpec = true;
}
fError = noErr;
@ -827,13 +829,16 @@ OSErr GUSIFSpTouchFolder(const FSSpec * desc)
return spec.TouchFolder();
}
OSErr GUSIFSpGetCatInfo(const FSSpec * desc, CInfoPBRec * info)
OSErr GUSIFSpGetCatInfo(FSSpec * desc, CInfoPBRec * info)
{
GUSIFileSpec spec(*desc);
const GUSICatInfo * gci = spec.CatInfo();
if (gci)
*info = gci->Info();
if (gci) {
*info = gci->Info();
*desc = spec;
info->hFileInfo.ioNamePtr = desc->name;
}
return spec.Error();
}

View File

@ -46,6 +46,12 @@ DECL_stdlib(MPW_getenv, "\pgetenv", char *, (const char *env))
#pragma pointers_in_A0
#endif
static bool ConnectToMPWLibrary() { return true; }
#ifdef __MWERKS__
extern int _mpwerrno;
static void UpdateMPWErrno() { errno = _mpwerrno; }
#else
static void UpdateMPWErrno() { }
#endif
#else
#define DECL_stdlib(name, pname, ret, args) ret (*name) args;
// Now we only have to declare the list once, and can reuse it numerous times.
@ -60,6 +66,8 @@ DECL_stdlib(MPW_ioctl, "\pioctl", int, (int d, unsigned int request, long *argp)
DECL_stdlib(MPW_lseek, "\plseek", long, (int fd, long offset, int whence))
DECL_stdlib(MPW_faccess, "\pfaccess", int, (char *fileName, unsigned int cmd, long * arg))
DECL_stdlib(MPW_getenv, "\pgetenv", char *, (const char *env))
int * MPW_errno;
static void UpdateMPWErrno() { errno = *MPW_errno; }
// On PowerPC, we have to connect to the dynamic library (which, in principle,
// can fail).
//
@ -78,6 +86,8 @@ static void DoConnectToMPWLibrary()
)
return;
if (FindSymbol(StdCLib, "\perrno", (Ptr *) &MPW_errno, &symClass))
goto failed;
#undef DECL_stdlib
#define DECL_stdlib(name, pname, ret, args) \
if (FindSymbol(StdCLib, pname, (Ptr *) &name, &symClass)) \
@ -210,39 +220,58 @@ GUSIMPWSocket::GUSIMPWSocket(int fd)
GUSIMPWSocket::~GUSIMPWSocket()
{
MPW_close(fFD);
UpdateMPWErrno();
}
// <Member functions for class [[GUSIMPWSocket]]>=
ssize_t GUSIMPWSocket::read(const GUSIScatterer & buffer)
{
GUSIStdioFlush();
GUSIConfiguration::Instance()->AutoSpin();
return buffer.SetLength(MPW_read(fFD, (char *) buffer.Buffer(), (unsigned)buffer.Length()));
int res = MPW_read(fFD, (char *) buffer.Buffer(), (unsigned)buffer.Length());
if (res < 0)
UpdateMPWErrno();
return buffer.SetLength(res);
}
// <Member functions for class [[GUSIMPWSocket]]>=
ssize_t GUSIMPWSocket::write(const GUSIGatherer & buffer)
{
GUSIConfiguration::Instance()->AutoSpin();
return MPW_write(fFD, (char *) buffer.Buffer(), (unsigned)buffer.Length());
int res = MPW_write(fFD, (char *) buffer.Buffer(), (unsigned)buffer.Length());
if (res < 0)
UpdateMPWErrno();
return res;
}
// <Member functions for class [[GUSIMPWSocket]]>=
off_t GUSIMPWSocket::lseek(off_t offset, int whence)
{
return MPW_lseek(fFD, offset, (long)whence);
off_t res = MPW_lseek(fFD, offset, (long)whence);
if (res < 0)
UpdateMPWErrno();
return res;
}
// <Member functions for class [[GUSIMPWSocket]]>=
int GUSIMPWSocket::fcntl(int cmd, va_list arg)
{
return MPW_fcntl(fFD, cmd, va_arg(arg, int));
int res = MPW_fcntl(fFD, cmd, va_arg(arg, int));
if (res < 0)
UpdateMPWErrno();
return res;
}
// <Member functions for class [[GUSIMPWSocket]]>=
int GUSIMPWSocket::ioctl(unsigned int request, va_list arg)
{
return MPW_ioctl(fFD, request, va_arg(arg, long *));
int res = MPW_ioctl(fFD, request, va_arg(arg, long *));
if (res < 0)
UpdateMPWErrno();
return res;
}
// <Member functions for class [[GUSIMPWSocket]]>=
int GUSIMPWSocket::ftruncate(off_t offset)
{
return MPW_ioctl(fFD, FIOSETEOF, (long *) offset);
int res = MPW_ioctl(fFD, FIOSETEOF, (long *) offset);
if (res < 0)
UpdateMPWErrno();
return res;
}
// <Member functions for class [[GUSIMPWSocket]]>=
int GUSIMPWSocket::fstat(struct stat * buf)
@ -357,10 +386,11 @@ GUSISocket * GUSIMPWDevice::open(GUSIFileToken & file, int flags)
int fd = MPW_open(path, TranslateOpenFlags(flags));
if (fd == -1) {
UpdateMPWErrno();
return static_cast<GUSISocket *>(nil);
} else if (!file.IsDevice() && !StandAlone && MPW_ioctl(fd, FIOINTERACTIVE, nil) == -1) {
MPW_close(fd);
return GUSIMacFileDevice::Instance()->open(file, flags);
return GUSIMacFileDevice::Instance()->open(file, flags & ~(O_CREAT | O_EXCL));
} else
return stdopen(fd, flags);
}
@ -385,8 +415,18 @@ GUSISocket * GUSIMPWDevice::stdopen(int fd, int flags)
&& MPW_ioctl(fd, FIOINTERACTIVE, nil) == -1
&& MPW_ioctl(fd, FIOREFNUM, (long *) &fRef) != -1
) {
MPW_close(fd);
return GUSIMacFileDevice::Instance()->open(fRef, flags);
static short sOutFRef = 0;
static GUSISocket * sOutSocket;
MPW_close(fd);
if (fd == 1) {
sOutFRef = fRef;
return sOutSocket = GUSIMacFileDevice::Instance()->open(fRef, flags);
} else if (fd == 2 && fRef == sOutFRef) {
// Standard output and error redirected to same file
return sOutSocket;
} else
return GUSIMacFileDevice::Instance()->open(fRef, flags);
}
GUSISocket * sock = new GUSIMPWSocket(fd);

View File

@ -224,10 +224,14 @@ int __close_console(__file_handle handle)
return __close_file(handle);
}
// <Implementation of ANSI library specific public GUSI functions>=
#if __MSL__ >= 0x6000
#if __MSL__ >= 0x6000 && __MSL__ < 0x7001
#define fdopen _fdopen
#endif
#if defined(__MWERKS__) && __MWERKS__ < 0x2401 && !defined(_SFSTDIO_H)
FILE * fdopen(int fildes, char *type)
#else
FILE * fdopen(int fildes, const char *type)
#endif
{
FILE *str;

View File

@ -583,17 +583,17 @@ int GUSIMacFileDevice::stat(GUSIFileToken & file, struct stat * buf)
return GUSISetPosixError(ENOENT);
const GUSICatInfo & cb = *file.CatInfo();
GUSIIOPBWrapper<ParamBlockRec> pb;
GUSIIOPBWrapper<XVolumeParam> pb;
Str63 vName;
pb->volumeParam.ioNamePtr = vName;
pb->volumeParam.ioVRefNum = file->vRefNum;
pb->volumeParam.ioVolIndex = 0;
pb->ioNamePtr = vName;
pb->ioVRefNum = file->vRefNum;
pb->ioVolIndex = 0;
if (GUSIFSGetVInfo(&pb))
if (GUSIFSXGetVolInfo(&pb))
return GUSISetPosixError(ENOENT);
buf->st_dev = pb->ioParam.ioVRefNum;
buf->st_dev = pb->ioVRefNum;
buf->st_ino = cb.DirInfo().ioDrDirID;
buf->st_nlink = 1;
buf->st_uid = 0;
@ -602,7 +602,7 @@ int GUSIMacFileDevice::stat(GUSIFileToken & file, struct stat * buf)
buf->st_atime = cb.FileInfo().ioFlMdDat;
buf->st_mtime = cb.FileInfo().ioFlMdDat;
buf->st_ctime = cb.FileInfo().ioFlCrDat;
buf->st_blksize = pb->volumeParam.ioVAlBlkSiz;
buf->st_blksize = pb->ioVAlBlkSiz;
if (!cb.IsFile()) {
// Depending on our preference settings, we employ a faster or a slower method
@ -615,7 +615,7 @@ int GUSIMacFileDevice::stat(GUSIFileToken & file, struct stat * buf)
if (GUSIConfiguration::Instance()->fAccurateStat) {
GUSIFileSpec spec;
spec.SetVRef(pb->ioParam.ioVRefNum);
spec.SetVRef(pb->ioVRefNum);
spec.SetParID(cb.DirInfo().ioDrDirID);
for (int i = 0; i++ < cb.DirInfo().ioDrNmFls;) {
spec = spec[i];
@ -654,7 +654,7 @@ int GUSIMacFileDevice::stat(GUSIFileToken & file, struct stat * buf)
buf->st_size = cb.FileInfo().ioFlLgLen; /* Resource fork is ignored */
}
buf->st_blocks = (buf->st_size + 511) >> 9;
buf->st_blocks = (buf->st_size + buf->st_blksize - 1) / buf->st_blksize;
return 0;
}
@ -771,7 +771,15 @@ int GUSIMacFileDevice::rmdir(GUSIFileToken & file)
// <Member functions for class [[GUSIMacFileDevice]]>=
GUSIDirectory * GUSIMacFileDevice::opendir(GUSIFileToken & file)
{
return new GUSIMacDirectory(++file);
GUSIDirectory * dir = 0;
++file;
if (!file.Error())
dir = new GUSIMacDirectory(file);
else
GUSISetPosixError(ENOTDIR);
return dir;
}
// [[VRef2Icon]] finds the driver icon for a volume.
//
@ -1110,21 +1118,21 @@ GUSIMacFileSocket::GUSIMacFileSocket(short fileRef, bool append, int mode)
fcb->ioRefNum = fFileRef;
fcb->ioFCBIndx = 0;
if (!GUSIFSGetFCBInfo(&fcb)) {
GUSIIOPBWrapper<ParamBlockRec> info;
info->volumeParam.ioNamePtr = name;
info->volumeParam.ioVRefNum = fcb->ioVRefNum;
info->volumeParam.ioVolIndex= 0;
GUSIIOPBWrapper<XVolumeParam> info;
info->ioNamePtr = name;
info->ioVRefNum = fcb->ioVRefNum;
info->ioVolIndex= 0;
if (!GUSIFSGetVInfo(&info))
fBlockSize = info->volumeParam.ioVAlBlkSiz;
if (!GUSIFSXGetVolInfo(&info))
fBlockSize = info->ioVAlBlkSiz;
}
// <Initialize fields of [[GUSIMacFileSocket]]>=
if (!fReadShutdown && !sReadProc)
sReadProc = NewIOCompletionProc(GUSIMFReadDoneEntry);
sReadProc = NewIOCompletionProc(reinterpret_cast<IOCompletionProcPtr>(GUSIMFReadDoneEntry));
if (!fWriteShutdown && !sWriteProc)
sWriteProc = NewIOCompletionProc(GUSIMFWriteDoneEntry);
sWriteProc = NewIOCompletionProc(reinterpret_cast<IOCompletionProcPtr>(GUSIMFWriteDoneEntry));
if (!sWakeupProc)
sWakeupProc = NewIOCompletionProc(GUSIMFWakeupEntry);
sWakeupProc = NewIOCompletionProc(reinterpret_cast<IOCompletionProcPtr>(GUSIMFWakeupEntry));
// The write and read parameter blocks are highly specialized and never really
// change during the existence of a socket.
//

View File

@ -88,8 +88,9 @@ int GUSINetDB::gethostname(char *machname, int buflen)
HSetState(hostString, hsState);
} else {
// <Translate host IP number to host name>=
char * name = inet_ntoa(ipaddr);
sHostName = new char[strlen(name)+1];
hostent * ent = gethostbyaddr((char *) &ipaddr, 0, 0);
char * name = ent ? ent->h_name : inet_ntoa(ipaddr);
sHostName = new char[strlen(name)+1];
strcpy(sHostName, name);
}
}

View File

@ -8,7 +8,9 @@
#include <stdlib.h>
#include <stdio.h>
#if UNIVERSAL_INTERFACES_VERSION < 0x0340
#undef AF_INET
#endif
#undef IP_OPTIONS
#undef IP_TOS
#undef IP_TTL
@ -196,6 +198,12 @@ hostent * GUSIOTNetDB::gethostbyaddr(const void * addrP, size_t len, int)
memset(otHost.fInfo.addrs, 0, kMaxHostAddrs*4);
otHost.fInfo.addrs[0] = addr;
// Apparently, Open Transport likes appaending an extra [['.']] to the domain name.
//
// <Strip extra period from name>=
len = strlen(otHost.fInfo.name);
if (otHost.fInfo.name[len-1] == '.')
otHost.fInfo.name[len-1] = 0;
CopyHost(otHost.fInfo, unixHost);
return &unixHost;

View File

@ -823,7 +823,7 @@ ssize_t GUSIOTStreamSocket::recvfrom(
//
// <Keep [[T_EXDATA]] flag set until we finish reading expedited data>=
if (exp && (otflags & (T_EXPEDITED|T_MORE)) != T_EXPEDITED)
fEvent |= exp;
fEvent |= exp;
return res;
}
// <Member functions for class [[GUSIOTStreamSocket]]>=

View File

@ -908,7 +908,7 @@ int select(int width, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, stru
// save the actual error code and restore it (this is harmless if no error
// occurred).
//
// <Call [[post_select]] for all file descriptors>=
// <Call [[post_select]] for all file descriptors>=
int saveErrno = errno;
for (int s = 0; s < width ; ++s)
if (GUSISocket * sock = GUSIDescriptorTable::LookupSocket(s)) {
@ -920,13 +920,19 @@ int select(int width, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, stru
sock->post_select(r, w, e);
}
errno = saveErrno;
// <Copy internal descriptor sets to parameters>=
// When copying back descriptor sets, we have to be careful not to copy more
// words than covered by [[width]], because Perl depends on that by allocating
// fake [[fd_sets]]. I personally think that is a bad idea, but staying
// compatible doesn't cost too much.
//
// <Copy internal descriptor sets to parameters>=
int nwords = ((width+31) >> 3) & ~3;
if (readfds)
*readfds = readres;
memcpy(readfds, &readres, nwords);
if (writefds)
*writefds = writeres;
memcpy(writefds, &writeres, nwords);
if (exceptfds)
*exceptfds = exceptres;
memcpy(exceptfds, &exceptres, nwords);
return count;
}
@ -1040,7 +1046,7 @@ int ftruncate(int s, off_t offset)
// <Socket function wrappers>=
int truncate(const char * path, off_t offset)
{
int fd = open(path, O_RDONLY);
int fd = open(path, O_RDWR);
if (fd < 0)
return fd;

View File

@ -185,9 +185,9 @@ GUSIPPCSocket::GUSIPPCSocket()
{
// <Initialize fields of [[GUSIPPCSocket]]>=
if (!sSendProc)
sSendProc = NewPPCCompProc(GUSIPPCSendDone);
sSendProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCSendDone));
if (!sRecvProc)
sRecvProc = NewPPCCompProc(GUSIPPCRecvDone);
sRecvProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCRecvDone));
// <Initialize fields of [[GUSIPPCSocket]]>=
fListeners = nil;
fRestartListen = true;
@ -195,10 +195,10 @@ GUSIPPCSocket::GUSIPPCSocket()
fCurListener = 0;
fNextListener = 0;
if (!sListenProc)
sListenProc = NewPPCCompProc(GUSIPPCListenDone);
sListenProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCListenDone));
// <Initialize fields of [[GUSIPPCSocket]]>=
if (!sDoneProc)
sDoneProc = NewPPCCompProc(GUSIPPCDone);
sDoneProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCDone));
}
// <Member functions for class [[GUSIPPCSocket]]>=
int GUSIPPCSocket::bind(void * addr, socklen_t namelen)
@ -390,9 +390,9 @@ GUSIPPCSocket::GUSIPPCSocket(GUSIPPCSocket * orig, Listener & listener)
{
// <Initialize fields of [[GUSIPPCSocket]]>=
if (!sSendProc)
sSendProc = NewPPCCompProc(GUSIPPCSendDone);
sSendProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCSendDone));
if (!sRecvProc)
sRecvProc = NewPPCCompProc(GUSIPPCRecvDone);
sRecvProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCRecvDone));
// <Initialize fields of [[GUSIPPCSocket]]>=
fListeners = nil;
fRestartListen = true;
@ -400,10 +400,10 @@ GUSIPPCSocket::GUSIPPCSocket(GUSIPPCSocket * orig, Listener & listener)
fCurListener = 0;
fNextListener = 0;
if (!sListenProc)
sListenProc = NewPPCCompProc(GUSIPPCListenDone);
sListenProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCListenDone));
// <Initialize fields of [[GUSIPPCSocket]]>=
if (!sDoneProc)
sDoneProc = NewPPCCompProc(GUSIPPCDone);
sDoneProc = NewPPCCompProc(reinterpret_cast<PPCCompProcPtr>(GUSIPPCDone));
fLocation = orig->fLocation;
fPort = orig->fPort;
fPeerLoc = listener.fLocation;

View File

@ -285,7 +285,7 @@ GUSITimer::GUSITimer(bool wakeup, GUSIContext * context)
context = GUSIContext::CreateCurrent();
if (wakeup) {
if (!sTimerProc)
sTimerProc = NewTimerProc(GUSITimerProcEntry);
sTimerProc = NewTimerProc(reinterpret_cast<TimerProcPtr>(GUSITimerProcEntry));
tmAddr = sTimerProc;
} else
tmAddr = 0;