diff options
author | David N. Welton <davidw@efn.org> | 1998-12-11 20:21:49 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:25 -0800 |
commit | a47af30d2f0e96afcd1f14b1984575c359faa3d6 (patch) | |
tree | 2ed08ce2d757f917de7c3c7c04fd7e309f454c83 /socket.c | |
parent | f64b2806c1d66a1341bb8b1491f384169ab1d65f (diff) | |
parent | db04688faa20f3576257c0fe41752ec435beab9a (diff) | |
download | scm-a47af30d2f0e96afcd1f14b1984575c359faa3d6.tar.gz scm-a47af30d2f0e96afcd1f14b1984575c359faa3d6.zip |
Import Debian changes 5c3-5debian/5c3-5
scm (5c3-5) frozen unstable; urgency=low
* debian/rules chmod +x's bld.scm. Fixes #30521.
scm (5c3-4) frozen unstable; urgency=low
* Made bld.scm executable. Fixes #29578.
scm (5c3-3) frozen unstable; urgency=low
* -nw
* Fixes #16762.
* Fixes #18163.
* Fixes #18164.
* Fixes #23743.
* Fixes #24098.
* Fixes #24099.
* Fixes #24547.
scm (5c3-2) frozen unstable; urgency=low
* Re-uploading for slink freeze.
scm (5c3-1) unstable; urgency=low
* New upstream version.
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -46,6 +46,12 @@ */ #include "scm.h" + +#ifdef macintosh +#define SOCKETDEFS +#include "macsocket.h" +#endif + #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> @@ -242,8 +248,9 @@ SCM l_servinfo(args) proto = CAR(proto); ASSERT(NIMP(proto) && STRINGP(proto), args, ARG2, s_servinfo); DEFER_INTS; - if (NIMP(name) && STRINGP(name)) + if (NIMP(name) && STRINGP(name)) { SYSCALL(entry = getservbyname(CHARS(name), CHARS(proto));); + } else { ASSERT(INUMP(proto), proto, ARG1, s_servinfo); SYSCALL(entry = getservbyport(INUM(proto), CHARS(proto));); @@ -310,7 +317,11 @@ SCM l_socket(fam, proto) i_setbuf0(port); ALLOW_INTS; if (AF_INET==tp) { +#ifdef macintosh + sd = setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *)&j, sizeof(j)); +#else sd = setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &j, sizeof(j)); +#endif ASSERT(!sd, port, "could not set socket option", s_socket); } return port; @@ -469,11 +480,15 @@ SCM l_accept(sockpt) NEWCELL(newpt); ASSERT(NIMP(sockpt) && OPINPORTP(sockpt), sockpt, ARG1, s_accept); sadlen=sizeof(sad); - DEFER_INTS; SYSCALL(newsd = accept(fileno(STREAM(sockpt)), &sad, &sadlen);); - if (-1==newsd) + if (-1==newsd) { +#ifndef macintosh if (EWOULDBLOCK != errno) return BOOL_F; - else wta(sockpt, "couldn't", s_accept); + else +#endif + wta(sockpt, "couldn't", s_accept); + } + DEFER_INTS; SYSCALL(newfd = fdopen(newsd, "r+");); if (!newfd) { close(newsd); @@ -511,7 +526,7 @@ int sknm_print(exp, port, writing) sizet sknm_free(p) CELLPTR p; { - must_free(CHARS((SCM)p)); + must_free(CHARS((SCM)p), sizeof(struct sockaddr)); return sizeof(struct sockaddr); } long tc16_sknm; @@ -558,12 +573,11 @@ SCM maksknm(sad) { SCM sknm; struct sockaddr *msknm; - NEWCELL(sknm); DEFER_INTS; - msknm = (struct sockaddr *)must_malloc(0L+sizeof(struct sockaddr), "sknm"); + sknm = must_malloc_cell(0L+sizeof(struct sockaddr), "sknm"); + msknm = (struct sockaddr *)CDR(sknm); *msknm = *sad; CAR(sknm) = tc16_sknm; - SETCDR(sknm, msknm); ALLOW_INTS; return sknm; } |