use uuid_generate on unix-like systems for S_unique_id

original commit: 2fd3db68230d094a0d396348a8140a4d3693b120
This commit is contained in:
Bob Burger 2018-09-18 16:42:51 -04:00
parent 59c055d91f
commit 75a70547f8
14 changed files with 45 additions and 57 deletions

View File

@ -11,8 +11,10 @@ matrix:
env: TARGET_MACHINE=ta6osx env: TARGET_MACHINE=ta6osx
- os: linux - os: linux
env: TARGET_MACHINE=i3le env: TARGET_MACHINE=i3le
sudo: required
- os: linux - os: linux
env: TARGET_MACHINE=ti3le env: TARGET_MACHINE=ti3le
sudo: required
- os: linux - os: linux
env: TARGET_MACHINE=a6le env: TARGET_MACHINE=a6le
- os: linux - os: linux

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
case $TARGET_MACHINE in
*i3le) sudo apt-get -yq --no-install-suggests --no-install-recommends install uuid-dev:i386 ;;
*)
esac
./configure -m=$TARGET_MACHINE ./configure -m=$TARGET_MACHINE
exitcode=$? exitcode=$?
if [ $exitcode -ne 0 ] ; then if [ $exitcode -ne 0 ] ; then

View File

@ -42,6 +42,7 @@ Prerequisites:
* gcc * gcc
* Header files and libraries for ncurses * Header files and libraries for ncurses
* Header files and libraries for X windows * Header files and libraries for X windows
* Header files and libraries for uuid
Uninstalling on Unix-like systems is as simple as running: Uninstalling on Unix-like systems is as simple as running:

2
LOG
View File

@ -1007,3 +1007,5 @@
Makefile.in, Makefile-workarea.in, Mf-install.in Makefile.in, Makefile-workarea.in, Mf-install.in
- add PDB files for Windows - add PDB files for Windows
c/*nt, wininstall/*nt.wxs c/*nt, wininstall/*nt.wxs
- use uuid_generate on unix-like systems for S_unique_id
BUILDING, c/Mf-*le, stats.c, objects.stex, release_notes.stex

View File

@ -16,7 +16,7 @@
m = a6le m = a6le
Cpu = X86_64 Cpu = X86_64
mdclib = -lm -ldl -lncurses -lrt mdclib = -lm -ldl -lncurses -lrt -luuid
C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c

View File

@ -16,7 +16,7 @@
m = arm32le m = arm32le
Cpu = ARMV6 Cpu = ARMV6
mdclib = -lm -ldl -lncurses -lrt mdclib = -lm -ldl -lncurses -lrt -luuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS}
o = o o = o
mdsrc = arm32le.c mdsrc = arm32le.c

View File

@ -16,7 +16,7 @@
m = i3le m = i3le
Cpu = I386 Cpu = I386
mdclib = -lm -ldl -lncurses -lrt mdclib = -lm -ldl -lncurses -lrt -luuid
C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -fno-stack-protector ${CFLAGS} C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -fno-stack-protector ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c

View File

@ -16,7 +16,7 @@
m = ppc32le m = ppc32le
Cpu = PPC32 Cpu = PPC32
mdclib = -lm -ldl -lncurses -lrt mdclib = -lm -ldl -lncurses -lrt -luuid
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS} C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS}
o = o o = o
mdsrc = ppc32.c mdsrc = ppc32.c

View File

@ -16,7 +16,7 @@
m = ta6le m = ta6le
Cpu = X86_64 Cpu = X86_64
mdclib = -lm -ldl -lncurses -lpthread -lrt mdclib = -lm -ldl -lncurses -lpthread -lrt -luuid
C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c

View File

@ -16,7 +16,7 @@
m = ti3le m = ti3le
Cpu = I386 Cpu = I386
mdclib = -lm -ldl -lncurses -lpthread -lrt mdclib = -lm -ldl -lncurses -lpthread -lrt -luuid
C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} C = ${CC} ${CPPFLAGS} -m32 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o o = o
mdsrc = i3le.c mdsrc = i3le.c

View File

@ -16,7 +16,7 @@
m = tppc32le m = tppc32le
Cpu = PPC32 Cpu = PPC32
mdclib = -lm -ldl -lncurses -lpthread -lrt mdclib = -lm -ldl -lncurses -lpthread -lrt -luuid
C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS} C = ${CC} ${CPPFLAGS} -m32 -Wpointer-arith -Wextra -Werror -Wno-implicit-fallthrough -O2 -D_REENTRANT -pthread ${CFLAGS}
o = o o = o
mdsrc = ppc32le.c mdsrc = ppc32le.c

View File

@ -53,57 +53,33 @@ static long adjust_time_zone(ptr dtvec, struct tm *tmxp, ptr given_tzoff);
#include <rpc.h> #include <rpc.h>
ptr S_unique_id() { ptr S_unique_id() {
union {UUID uuid; INT foo[4];} u; union {UUID uuid; U32 foo[4];} u;
u.foo[0] = 0; u.foo[0] = 0;
u.foo[1] = 0; u.foo[1] = 0;
u.foo[2] = 0; u.foo[2] = 0;
u.foo[3] = 0; u.foo[3] = 0;
UuidCreate(&u.uuid); UuidCreate(&u.uuid);
return S_add(S_ash(Sunsigned(u.foo[0]), Sinteger(8*3*sizeof(INT))), return S_add(S_ash(Sunsigned32(u.foo[0]), Sinteger(8*3*sizeof(U32))),
S_add(S_ash(Sunsigned(u.foo[1]), Sinteger(8*2*sizeof(INT))), S_add(S_ash(Sunsigned32(u.foo[1]), Sinteger(8*2*sizeof(U32))),
S_add(S_ash(Sunsigned(u.foo[2]), Sinteger(8*sizeof(INT))), S_add(S_ash(Sunsigned32(u.foo[2]), Sinteger(8*sizeof(U32))),
Sunsigned(u.foo[3])))); Sunsigned32(u.foo[3]))));
} }
#else /* WIN32 */ #else /* WIN32 */
#include <sys/param.h> #include <uuid/uuid.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
static INT gethostip(void) {
char hostname[MAXHOSTNAMELEN+1];
struct hostent *h;
char **p;
struct in_addr in;
if (gethostname(hostname, MAXHOSTNAMELEN)) return 0;
if ((h = gethostbyname(hostname)) == NULL) return 0;
p = h->h_addr_list;
if (*p == NULL) return 0;
memcpy(&in.s_addr, *p, sizeof (in.s_addr));
return in.s_addr;
}
ptr S_unique_id() { ptr S_unique_id() {
struct timeval tp; union {uuid_t uuid; U32 foo[4];} u;
time_t sec; u.foo[0] = 0;
pid_t pid; u.foo[1] = 0;
INT ip; u.foo[2] = 0;
u.foo[3] = 0;
(void) gettimeofday(&tp,NULL); uuid_generate(u.uuid);
return S_add(S_ash(Sunsigned32(u.foo[0]), Sinteger(8*3*sizeof(U32))),
pid = getpid(); S_add(S_ash(Sunsigned32(u.foo[1]), Sinteger(8*2*sizeof(U32))),
ip = gethostip(); S_add(S_ash(Sunsigned32(u.foo[2]), Sinteger(8*sizeof(U32))),
sec = tp.tv_sec; Sunsigned32(u.foo[3]))));
return S_add(S_ash(Sunsigned(pid), Sinteger(8*(sizeof(sec)+sizeof(ip)))),
S_add(S_ash(Sunsigned(ip), Sinteger(8*(sizeof(sec)))),
Sunsigned(sec)));
} }
#endif /* WIN32 */ #endif /* WIN32 */

View File

@ -1418,10 +1418,8 @@ The pretty name of a gensym is returned by the procedure
In both the first and second forms, the unique name is an In both the first and second forms, the unique name is an
automatically generated globally unique name. automatically generated globally unique name.
Globally unique names are constructed (lazily---see below) Globally unique names are constructed (lazily---see below) from the
from some combination of a unique machine identifier (such as the combination of a universally unique identifier and an internal
network address), the current process identifier (PID), and the
time at which the Scheme session began, along with an internal
counter. counter.
In the third form of gensym, the unique name of the new gensym is In the third form of gensym, the unique name of the new gensym is
\var{unique-name}, which must be a string. \var{unique-name}, which must be a string.

View File

@ -1592,6 +1592,12 @@ in fasl files does not generally make sense.
%----------------------------------------------------------------------------- %-----------------------------------------------------------------------------
\section{Bug Fixes}\label{section:bugfixes} \section{Bug Fixes}\label{section:bugfixes}
\subsection{Globally unique names on non-Windows systems no longer contain the IP address (9.5.1)}
The globally unique names of gensyms no longer contain the IP address
on non-Windows systems. Windows systems already used a universally
unique identifier.
\subsection{Invalid memory reference from \protect\scheme{fxvector} calls (9.5)} \subsection{Invalid memory reference from \protect\scheme{fxvector} calls (9.5)}
A compiler bug that could result in an invalid memory reference or A compiler bug that could result in an invalid memory reference or