summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgordon%netscape.com <devnull@localhost>1999-06-30 21:28:05 +0000
committergordon%netscape.com <devnull@localhost>1999-06-30 21:28:05 +0000
commit55f2a60a7ea7eacdeaa0e3048159e6e12c44b309 (patch)
tree3cb7300bf35bb1c085527a2aa3695db792a890a9
parent6980b932fff848f642fc386016fa3fc74df9e564 (diff)
downloadnspr-hg-55f2a60a7ea7eacdeaa0e3048159e6e12c44b309.tar.gz
Changes to build for TARGET_CARBON.
-rw-r--r--pr/src/md/mac/macio.c2
-rw-r--r--pr/src/md/mac/macsockotpt.c44
-rw-r--r--pr/src/md/mac/mdmac.c15
3 files changed, 49 insertions, 12 deletions
diff --git a/pr/src/md/mac/macio.c b/pr/src/md/mac/macio.c
index 5f931521..c5ae92c9 100644
--- a/pr/src/md/mac/macio.c
+++ b/pr/src/md/mac/macio.c
@@ -227,7 +227,7 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
a 32 byte Ptr in the heap, so only do this once
*/
if (!sCompletionUPP)
- sCompletionUPP = NewIOCompletionProc((ProcPtr)&AsyncIOCompletion);
+ sCompletionUPP = NewIOCompletionProc((IOCompletionProcPtr)&AsyncIOCompletion);
/* grab the thread so we know which one to post to at completion */
pbAsync.thread = me;
diff --git a/pr/src/md/mac/macsockotpt.c b/pr/src/md/mac/macsockotpt.c
index 6a354512..205c58f7 100644
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -52,6 +52,27 @@ static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PR
extern void WaitOnThisThread(PRThread *thread, PRIntervalTime timeout);
extern void DoneWaitingOnThisThread(PRThread *thread);
+#ifdef TARGET_CARBON
+OTClientContextPtr clientContext = NULL;
+
+OTNotifyUPP DNSNotifierRoutineUPP;
+OTNotifyUPP notifierRoutineUPP;
+
+#define DNS_NOTIFIER_ROUTINE DNSNotifierRoutineUPP
+#define NOTIFIER_ROUTINE notifierRoutineUPP
+#define INIT_OPEN_TRANSPORT() InitOpenTransport(clientContext, kInitOTForExtensionMask)
+#define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServices(config, flags, err, clientContext)
+#define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpoint(config, flags, info, err, clientContext)
+
+#else
+
+#define DNS_NOTIFIER_ROUTINE DNSNotifierRoutine
+#define NOTIFIER_ROUTINE NotifierRoutine
+#define INIT_OPEN_TRANSPORT() InitOpenTransport()
+#define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServices(config, flags, err)
+#define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpoint(config, flags, info, err)
+#endif /* TARGET_CARBON */
+
void _MD_InitNetAccess()
{
@@ -60,7 +81,7 @@ void _MD_InitNetAccess()
PRBool hasOTTCPIP = PR_FALSE;
PRBool hasOT = PR_FALSE;
long gestaltResult;
-
+
err = Gestalt(gestaltOpenTpt, &gestaltResult);
if (err == noErr)
if (gestaltResult & GESTALT_OPEN_TPT_PRESENT)
@@ -72,21 +93,30 @@ void _MD_InitNetAccess()
PR_ASSERT(hasOTTCPIP == PR_TRUE);
- errOT = InitOpenTransport();
+#ifdef TARGET_CARBON
+ DNSNotifierRoutineUPP = NewOTNotifyUPP(DNSNotifierRoutine);
+ notifierRoutineUPP = NewOTNotifyUPP(NotifierRoutine);
+
+ errOT = OTAllocClientContext((UInt32)0, &clientContext);
PR_ASSERT(err == kOTNoError);
-
+#endif
+
+
+ errOT = INIT_OPEN_TRANSPORT();
+ PR_ASSERT(err == kOTNoError);
+
dnsContext.lock = PR_NewLock();
PR_ASSERT(dnsContext.lock != NULL);
dnsContext.thread = _PR_MD_CURRENT_THREAD();
dnsContext.cookie = NULL;
- dnsContext.serviceRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &errOT);
+ dnsContext.serviceRef = OT_OPEN_INTERNET_SERVICES(kDefaultInternetServicesPath, NULL, &errOT);
if (errOT != kOTNoError) return; /* no network -- oh well */
PR_ASSERT((dnsContext.serviceRef != NULL) && (errOT == kOTNoError));
/* Install notify function for DNR Address To String completion */
- errOT = OTInstallNotifier(dnsContext.serviceRef, DNSNotifierRoutine, &dnsContext);
+ errOT = OTInstallNotifier(dnsContext.serviceRef, DNS_NOTIFIER_ROUTINE, &dnsContext);
PR_ASSERT(errOT == kOTNoError);
/* Put us into async mode */
@@ -364,7 +394,7 @@ static OSErr CreateSocket(int type, EndpointRef *endpoint)
case SOCK_DGRAM: configName = kUDPName; break;
}
config = OTCreateConfiguration(configName);
- ep = OTOpenEndpoint(config, 0, NULL, &err);
+ ep = OT_OPEN_ENDPOINT(config, 0, NULL, &err);
if (err != kOTNoError)
goto ErrorExit;
@@ -1523,7 +1553,7 @@ void _MD_makenonblock(PRFileDesc *fd)
OSStatus err;
// Install the PRFileDesc as the contextPtr for the Notifier function associated with this Endpoint.
- err = OTInstallNotifier(endpointRef, NotifierRoutine, fd);
+ err = OTInstallNotifier(endpointRef, NOTIFIER_ROUTINE, fd);
PR_ASSERT(err == kOTNoError);
// Now that we have a NotifierRoutine installed, we can make the endpoint asynchronous
diff --git a/pr/src/md/mac/mdmac.c b/pr/src/md/mac/mdmac.c
index 5dd07662..678b082c 100644
--- a/pr/src/md/mac/mdmac.c
+++ b/pr/src/md/mac/mdmac.c
@@ -107,7 +107,7 @@ static void InstallStackSpacePatch(void)
Ptr interfaceLibAddr;
CFragSymbolClass symClass;
UniversalProcPtr (*getOSTrapAddressProc)(UInt16);
- void (*setOSTrapAddressProc)(UniversalProcPtr, UInt16);
+ void (*setOSTrapAddressProc)(StackSpacePatchUPP, UInt16);
UniversalProcPtr (*newRoutineDescriptorProc)(ProcPtr,ProcInfoType,ISAType);
@@ -341,13 +341,20 @@ void PR_InitMemory(void) {
// done then we will randomly crash at later times when the
// task is called after the app heap is gone.
-extern TMTask gTimeManagerTaskElem;
+#if TARGET_CARBON
+extern OTClientContextPtr clientContext;
+#define CLOSE_OPEN_TRANSPORT() CloseOpenTransport(clientContext)
+
+#else
+
+#define CLOSE_OPEN_TRANSPORT() CloseOpenTransport()
+#endif /* TARGET_CARBON */
void CleanupTermProc(void)
{
- _MD_StopInterrupts();
+ _MD_StopInterrupts(); // deactive Time Manager task
- CloseOpenTransport();
+ CLOSE_OPEN_TRANSPORT();
__terminate();
}