Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
4a8f9ad9
Commit
4a8f9ad9
authored
17 years ago
by
fgilham
Browse files
Options
Downloads
Patches
Plain Diff
Delete unnecessary socket.c file.
parent
12f97115
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lisp/socket.c
+0
-148
0 additions, 148 deletions
lisp/socket.c
with
0 additions
and
148 deletions
lisp/socket.c
deleted
100644 → 0
+
0
−
148
View file @
12f97115
/*
$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Attic/socket.c,v 1.6 2005/09/15 18:26:52 rtoy Exp $
This code was written as part of the CMU Common Lisp project at
Carnegie Mellon University, and has been placed in the public domain.
*/
/* Copyright Massachusetts Institute of Technology 1988 */
/*
* THIS IS AN OS DEPENDENT FILE! It should work on 4.2BSD derived
* systems. VMS and System V should plan to have their own version.
*
* This code was cribbed from lib/X/XConnDis.c.
* Compile using
* % cc -c socket.c -DUNIXCONN
*/
#include
<stdio.h>
#include
<stdlib.h>
#include
<X11/Xos.h>
#include
<X11/Xproto.h>
#include
<errno.h>
#include
<netinet/in.h>
#include
<sys/ioctl.h>
#include
<netdb.h>
#include
<sys/socket.h>
#include
<arpa/inet.h>
#ifndef hpux
#include
<netinet/tcp.h>
#endif
#include
"os.h"
#ifdef UNIXCONN
#include
<sys/un.h>
#ifndef X_UNIX_PATH
#ifdef hpux
#define X_UNIX_PATH "/usr/spool/sockets/X11/"
#define OLD_UNIX_PATH "/tmp/.X11-unix/X"
#else
/* hpux */
#define X_UNIX_PATH "/tmp/.X11-unix/X"
#endif
/* hpux */
#endif
/* X_UNIX_PATH */
#endif
/* UNIXCONN */
/*
* Attempts to connect to server, given host and display. Returns file
* descriptor (network socket) or 0 if connection fails.
*/
int
connect_to_server
(
char
*
host
,
int
display
)
{
struct
sockaddr_in
inaddr
;
/* INET socket address. */
struct
sockaddr
*
addr
;
/* address to connect to */
struct
hostent
*
host_ptr
;
int
addrlen
;
/* length of address */
#ifdef UNIXCONN
struct
sockaddr_un
unaddr
;
/* UNIX socket address. */
#endif
int
fd
;
/* Network socket */
{
#ifdef UNIXCONN
if
((
host
[
0
]
==
'\0'
)
||
(
strcmp
(
"unix"
,
host
)
==
0
))
{
/* Connect locally using Unix domain. */
unaddr
.
sun_family
=
AF_UNIX
;
(
void
)
strcpy
(
unaddr
.
sun_path
,
X_UNIX_PATH
);
sprintf
(
&
unaddr
.
sun_path
[
strlen
(
unaddr
.
sun_path
)],
"%d"
,
display
);
addr
=
(
struct
sockaddr
*
)
&
unaddr
;
addrlen
=
strlen
(
unaddr
.
sun_path
)
+
2
;
/*
* Open the network connection.
*/
if
((
fd
=
socket
((
int
)
addr
->
sa_family
,
SOCK_STREAM
,
0
))
<
0
)
{
#ifdef hpux
/* this is disgusting */
/* cribbed from X11R4 xlib source */
if
(
errno
==
ENOENT
)
{
/* No such file or directory */
sprintf
(
unaddr
.
sun_path
,
"%s%d"
,
OLD_UNIX_PATH
,
display
);
addrlen
=
strlen
(
unaddr
.
sun_path
)
+
2
;
if
((
fd
=
socket
((
int
)
addr
->
sa_family
,
SOCK_STREAM
,
0
))
<
0
)
return
(
-
1
);
/* errno set by most recent system call. */
}
else
#endif
/* hpux */
return
(
-
1
);
/* errno set by system call. */
}
}
else
#endif
/* UNIXCONN */
{
/* Get the statistics on the specified host. */
if
((
inaddr
.
sin_addr
.
s_addr
=
inet_addr
(
host
))
==
-
1
)
{
if
((
host_ptr
=
gethostbyname
(
host
))
==
NULL
)
{
/* No such host! */
errno
=
EINVAL
;
return
(
-
1
);
}
/* Check the address type for an internet host. */
if
(
host_ptr
->
h_addrtype
!=
AF_INET
)
{
/* Not an Internet host! */
errno
=
EPROTOTYPE
;
return
(
-
1
);
}
/* Set up the socket data. */
inaddr
.
sin_family
=
host_ptr
->
h_addrtype
;
memcpy
((
char
*
)
&
inaddr
.
sin_addr
,
(
char
*
)
host_ptr
->
h_addr
,
sizeof
(
inaddr
.
sin_addr
));
}
else
{
inaddr
.
sin_family
=
AF_INET
;
}
addr
=
(
struct
sockaddr
*
)
&
inaddr
;
addrlen
=
sizeof
(
struct
sockaddr_in
);
inaddr
.
sin_port
=
display
+
X_TCP_PORT
;
inaddr
.
sin_port
=
htons
(
inaddr
.
sin_port
);
/*
* Open the network connection.
*/
if
((
fd
=
socket
((
int
)
addr
->
sa_family
,
SOCK_STREAM
,
0
))
<
0
)
{
return
(
-
1
);
/* errno set by system call. */
}
/* make sure to turn off TCP coalescence */
#ifdef TCP_NODELAY
{
int
mi
=
1
;
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
&
mi
,
sizeof
(
int
));
}
#endif
}
/*
* Changed 9/89 to retry connection if system call was interrupted. This
* is necessary for multiprocessing implementations that use timers,
* since the timer results in a SIGALRM. -- jdi
*/
while
(
connect
(
fd
,
addr
,
addrlen
)
==
-
1
)
{
if
(
errno
!=
EINTR
)
{
(
void
)
close
(
fd
);
return
(
-
1
);
/* errno set by system call. */
}
}
}
/*
* Return the id if the connection succeeded.
*/
return
(
fd
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment