mirror of
https://github.com/Interlisp/maiko.git
synced 2026-03-17 15:24:44 +00:00
Compare commits
22 Commits
maiko-2110
...
maiko-2202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a974a2a7 | ||
|
|
8ea2c76110 | ||
|
|
3e7c71c0c0 | ||
|
|
f2a3715930 | ||
|
|
f15d8eca09 | ||
|
|
008ce703e7 | ||
|
|
fa08a08648 | ||
|
|
bb0b011f90 | ||
|
|
6bccbfbcf3 | ||
|
|
e3af3b03b9 | ||
|
|
880747f2dc | ||
|
|
c7fd28a438 | ||
|
|
e1efc860c4 | ||
|
|
26fe840edf | ||
|
|
212a0fa9c6 | ||
|
|
65bbcb7d9d | ||
|
|
987cf4c7c6 | ||
|
|
c46fcce307 | ||
|
|
de5ea2110f | ||
|
|
6c241f1eaa | ||
|
|
19688bc314 | ||
|
|
c39b751f42 |
84
.github/workflows/buildDocker.yml
vendored
84
.github/workflows/buildDocker.yml
vendored
@@ -1,84 +0,0 @@
|
||||
# based on https://blog.oddbit.com/post/2020-09-25-building-multi-architecture-im/
|
||||
---
|
||||
# Interlisp workflow to build a Docker Image that supports multiple architectures
|
||||
name: 'Build Maiko Docker image'
|
||||
|
||||
# Run this workflow on push to master
|
||||
# Other branches can be added it needed.
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
# Jobs that are run as part of this workflow.
|
||||
jobs:
|
||||
# Job to build the docker image
|
||||
# see: https://github.com/docker/build-push-action
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checkout the branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Setup some environment variables
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
# Name of the Docker Image.
|
||||
DOCKER_IMAGE=interlisp/${GITHUB_REPOSITORY#*/}
|
||||
VERSION=latest
|
||||
SHORTREF=${GITHUB_SHA::8}
|
||||
## Do we want to use tags and or versions
|
||||
# If this is git tag, use the tag name as a docker tag
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
fi
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
|
||||
# If the VERSION looks like a version number, assume that
|
||||
# this is the most recent version of the image and also
|
||||
# tag it 'latest'.
|
||||
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
|
||||
fi
|
||||
# Set output parameters.
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||
echo ::set-output name=build_time::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
# Setup the Docker Machine Emulation environment.
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@master
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
# Setup the Docker Buildx funtion
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@master
|
||||
|
||||
# Login into DockerHub - required to store the created image
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
# Start the Docker Build using the Dockerfile in the repository we
|
||||
# checked out.
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
build-args: BUILD_DATE=${{ steps.prep.outputs.build_time }}
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
# Platforms - Sepecify the platforms to include in the build
|
||||
# linux/amd64 -- Standard x86_64
|
||||
# linux/arm64 -- Apple M1
|
||||
# linux/arm/v7 -- Raspberry pi
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
# Push the result to DockerHub
|
||||
push: true
|
||||
# tags to assign to the Docker image
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
414
.github/workflows/buildReleaseInclDocker.yml
vendored
Normal file
414
.github/workflows/buildReleaseInclDocker.yml
vendored
Normal file
@@ -0,0 +1,414 @@
|
||||
#*******************************************************************************
|
||||
# buidReleaseInclDocker.yml
|
||||
#
|
||||
# Workflow to build a Maiko release that is pushed to github as well as
|
||||
# Docker images incorporating the release, which are pushed to Docker Hub.
|
||||
# For linux: release assets are built/pushed for X86_64, aarch64 and arm7vl and
|
||||
# a multiplatform Docker image is pushed.
|
||||
# For macOS: release assets are built/pushed for X86_64. (No aarch64 as yet.)
|
||||
# For Windows: not supported
|
||||
#
|
||||
# Note release pushed to github also includes source code assets in tar and zip formats.
|
||||
#
|
||||
# 2022-01-16 by Frank Halasz based on earlier workflow called buildDocker.yml
|
||||
#
|
||||
# Copyright 2022 by Interlisp.org
|
||||
#
|
||||
#
|
||||
# ******************************************************************************
|
||||
|
||||
name: 'Build/Push Release & Docker Image'
|
||||
|
||||
env:
|
||||
workflow: 'buildReleaseInclDocker.yml'
|
||||
|
||||
# Run this workflow on ...
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force:
|
||||
description: "Force build even if build already successfully completed for this commit"
|
||||
type: choice
|
||||
options:
|
||||
- 'false'
|
||||
- 'true'
|
||||
|
||||
workflow_call:
|
||||
secrets:
|
||||
DOCKER_USERNAME:
|
||||
required: true
|
||||
DOCKER_PASSWORD:
|
||||
required: true
|
||||
outputs:
|
||||
successful:
|
||||
description: "'True' if maiko build completed successully"
|
||||
value: ${{ jobs.complete.outputs.build_successful }}
|
||||
inputs:
|
||||
force:
|
||||
description: "Force build even if build already successfully completed for this commit"
|
||||
required: false
|
||||
type: string
|
||||
default: 'false'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
# 3 separate jobs here that can run in parallel
|
||||
#
|
||||
# 1. Linux: Build/push a multiplatform Linux Docker image and use results to
|
||||
# build/push Linux release assets.
|
||||
#
|
||||
# 2. MacOs_x86_64: Build maiko for MacOS on X86_64 then create and push release assets.
|
||||
#
|
||||
# 3. Sources: create/push sources assets for this release.
|
||||
#
|
||||
|
||||
jobs:
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Regularize the inputs so they can be referenced the same way whether they are
|
||||
# the result of a workflow_dispatch or a workflow_call
|
||||
|
||||
inputs:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
force: ${{ steps.force.outputs.force }}
|
||||
steps:
|
||||
- id: force
|
||||
run: >
|
||||
if [ '${{ toJSON(inputs) }}' = 'null' ];
|
||||
then echo ::set-output name=force::'${{ github.event.inputs.force }}'; echo "workflow_dispatch";
|
||||
else echo ::set-output name=force::'${{ inputs.force }}'; echo "workflow_call";
|
||||
fi
|
||||
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Use sentry-action to determine if this release has already been built
|
||||
# based on the latest commit to the repo
|
||||
|
||||
sentry:
|
||||
needs: inputs
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_not_built: ${{ steps.check.outputs.release_not_built }}
|
||||
|
||||
steps:
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
|
||||
|
||||
# Check if build already run for this commit
|
||||
- name: Build already completed?
|
||||
id: check
|
||||
continue-on-error: true
|
||||
uses: ./../actions/check-sentry-action
|
||||
with:
|
||||
tag: "release_docker"
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Linux: build and push multi-platform docker image for Linux
|
||||
# Use docker images to create and push release assets to github
|
||||
|
||||
linux:
|
||||
|
||||
needs: [inputs, sentry]
|
||||
if: |
|
||||
needs.sentry.outputs.release_not_built == 'true'
|
||||
|| needs.inputs.outputs.force == 'true'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
|
||||
|
||||
# Checkout the branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Setup release tag
|
||||
- name: Setup Release Tag
|
||||
id: tag
|
||||
uses: ./../actions/release-tag-action
|
||||
|
||||
# Setup docker environment variables
|
||||
- name: Setup Docker Environment Variables
|
||||
id: docker_env
|
||||
run: |
|
||||
DOCKER_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "DOCKER_OWNER=${DOCKER_OWNER}" >> ${GITHUB_ENV}
|
||||
DOCKER_IMAGE=${DOCKER_OWNER}/${{ steps.tag.outputs.repo_name }}
|
||||
DOCKER_TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${RELEASE_TAG#*-}"
|
||||
echo ::set-output name=build_time::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
echo ::set-output name=docker_tags::${DOCKER_TAGS}
|
||||
|
||||
# Setup the Docker Machine Emulation environment.
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@master
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
|
||||
# Setup the Docker Buildx funtion
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@master
|
||||
|
||||
# Login into DockerHub - required to store the created image
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
# Do the Docker Build using the Dockerfile in the repository we
|
||||
# checked out. Push the result to Docker Hub.
|
||||
#
|
||||
# NOTE: THE ACTUAL MAIKO BUILD (FOR LINUX) HAPPENS HERE - I.E., IN THE
|
||||
# DOCKER BUILD CALL. BUILD COMMANDS ARE SPECIFIED IN THE
|
||||
# Dockerfile, NOT HERE IN THE WORKFLOW.
|
||||
#
|
||||
- name: Build Docker Image for Push to Docker Hub
|
||||
if: ${{ true }}
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
build-args: |
|
||||
BUILD_DATE=${{ steps.docker_env.outputs.build_time }}
|
||||
RELEASE_TAG=${{ steps.tag.outputs.release_tag }}
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
# Push the result to DockerHub
|
||||
push: true
|
||||
tags: ${{ steps.docker_env.outputs.docker_tags }}
|
||||
|
||||
# Redo the Docker Build (hopefully mostly using the cache from the previous build).
|
||||
# But save the results in a directory under /tmp to be used for creating release tars.
|
||||
- name: Rebuild Docker Image For Saving Locally
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
build-args: |
|
||||
BUILD_DATE=${{ steps.docker_env.outputs.build_time }}
|
||||
RELEASE_TAG=${{ steps.tag.outputs.release_tag }}
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
# Put the results out to the local file system
|
||||
outputs: type=local,dest=/tmp/docker_images
|
||||
tags: ${{ steps.docker_env.outputs.docker_tags }}
|
||||
|
||||
# Use docker results to create releases for github.
|
||||
# Docker results are in /tmp/docker_images. One subdir for each platform.
|
||||
- name: Make release tars for each platform
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.tag.outputs.release_tag }}
|
||||
run: |
|
||||
mkdir -p /tmp/release_tars
|
||||
for OSARCH in "linux.x86_64:linux_amd64" "linux.aarch64:linux_arm64" "linux.armv7l:linux_arm_v7" ; \
|
||||
do \
|
||||
pushd /tmp/docker_images/${OSARCH##*:}/usr/local/interlisp >/dev/null ; \
|
||||
/usr/bin/tar -c -z \
|
||||
-f /tmp/release_tars/${RELEASE_TAG}-${OSARCH%%:*}.tgz \
|
||||
maiko/bin/osversion \
|
||||
maiko/bin/machinetype \
|
||||
maiko/bin/config.guess \
|
||||
maiko/bin/config.sub \
|
||||
maiko/${OSARCH%%:*}/lde* \
|
||||
; \
|
||||
popd >/dev/null ; \
|
||||
done
|
||||
|
||||
# Push Release to github
|
||||
- name: Push the release
|
||||
uses: ncipollo/release-action@v1.8.10
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts:
|
||||
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.x86_64.tgz,
|
||||
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.aarch64.tgz,
|
||||
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.armv7l.tgz
|
||||
tag: ${{ steps.tag.outputs.release_tag }}
|
||||
draft: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
# MacOS: build for MacOS (X86_64) and use results to
|
||||
# create and push release assets to github
|
||||
macos_x86_64:
|
||||
|
||||
needs: [inputs, sentry]
|
||||
if: |
|
||||
needs.sentry.outputs.release_not_built == 'true'
|
||||
|| needs.inputs.outputs.force == 'true'
|
||||
|
||||
runs-on: macos-10.15
|
||||
|
||||
steps:
|
||||
|
||||
# Checkout the branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
|
||||
|
||||
# Setup release tag
|
||||
- name: Setup Release Tag
|
||||
id: tag
|
||||
uses: ./../actions/release-tag-action
|
||||
|
||||
# Install X11 dependencies
|
||||
- name: Install X11 dependencies on MacOS
|
||||
if: ${{ runner.os == 'macOS'}}
|
||||
run: brew install --cask xquartz
|
||||
|
||||
# Build maiko
|
||||
- name: Build
|
||||
working-directory: ./bin
|
||||
run: |
|
||||
./makeright x
|
||||
./makeright init
|
||||
|
||||
# Create release tar for github.
|
||||
- name: Make release tar(s)
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.tag.outputs.release_tag }}
|
||||
run: |
|
||||
mkdir -p /tmp/release_tars
|
||||
pushd ${GITHUB_WORKSPACE}/../ >/dev/null
|
||||
tar -c -z \
|
||||
-f /tmp/release_tars/${RELEASE_TAG}-darwin.x86_64.tgz \
|
||||
maiko/bin/osversion \
|
||||
maiko/bin/machinetype \
|
||||
maiko/bin/config.guess \
|
||||
maiko/bin/config.sub \
|
||||
maiko/darwin.x86_64/lde*
|
||||
popd >/dev/null
|
||||
|
||||
# Push Release
|
||||
- name: Push the release
|
||||
uses: ncipollo/release-action@v1.8.10
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts:
|
||||
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz
|
||||
tag: ${{ steps.tag.outputs.release_tag }}
|
||||
draft: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Sources: create and push release assets containing sources to github
|
||||
sources:
|
||||
|
||||
needs: [inputs, sentry]
|
||||
if: |
|
||||
needs.sentry.outputs.release_not_built == 'true'
|
||||
|| needs.inputs.outputs.force == 'true'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
# Checkout the branch
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
|
||||
|
||||
# Setup release tag
|
||||
- name: Setup Release Tag
|
||||
id: tag
|
||||
uses: ./../actions/release-tag-action
|
||||
|
||||
# Create source tars for the release
|
||||
- name: Make source tars
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.tag.outputs.release_tag }}
|
||||
run: |
|
||||
mkdir -p /tmp/release_tars
|
||||
pushd ${GITHUB_WORKSPACE}/../ >/dev/null
|
||||
mv maiko ${RELEASE_TAG}
|
||||
/usr/bin/tar -c -z -f /tmp/release_tars/${RELEASE_TAG}-source.tgz --exclude=.git ${RELEASE_TAG}
|
||||
/usr/bin/find ${RELEASE_TAG} -name .git -prune -o -print |\
|
||||
/usr/bin/zip -@ /tmp/release_tars/${RELEASE_TAG}-source.zip
|
||||
mv ${RELEASE_TAG} maiko
|
||||
popd >/dev/null
|
||||
|
||||
# Push Release
|
||||
- name: Push the release
|
||||
uses: ncipollo/release-action@v1.8.10
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts:
|
||||
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-source.tgz,
|
||||
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-source.zip
|
||||
tag: ${{ steps.tag.outputs.release_tag }}
|
||||
draft: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Use set-sentry-action to determine set the sentry that says this release has
|
||||
# been successfully built
|
||||
|
||||
complete:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
build_successful: ${{ steps.output.outputs.build_successful }}
|
||||
|
||||
needs: [inputs, sentry, linux, macos_x86_64, sources]
|
||||
|
||||
steps:
|
||||
# Checkout the actions for this repo owner
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/.github
|
||||
path: ./Actions_${{ github.sha }}
|
||||
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
|
||||
|
||||
# Set sentry
|
||||
- name: Is build for this commit already completed?
|
||||
id: set
|
||||
uses: ./../actions/set-sentry-action
|
||||
with:
|
||||
tag: "release_docker"
|
||||
|
||||
- name: Output
|
||||
id: output
|
||||
run: |
|
||||
echo ::set-output name=build_successful::'true'
|
||||
|
||||
######################################################################################
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,6 +6,8 @@
|
||||
.DS_Store
|
||||
# build directories
|
||||
build/**
|
||||
*.m68k-x/**
|
||||
*.m68k/**
|
||||
*.386-x/**
|
||||
*.386/**
|
||||
*.ppc-x/**
|
||||
|
||||
@@ -18,7 +18,7 @@ ENDIF()
|
||||
|
||||
find_program(
|
||||
CLANG_TIDY_EXE
|
||||
NAMES "clang-tidy" "clang-tidy12" "clang-tidy11" "clang-tidy10"
|
||||
NAMES "clang-tidy" "clang-tidy13" "clang-tidy12" "clang-tidy11" "clang-tidy10"
|
||||
DOC "Path to clang-tidy executable"
|
||||
)
|
||||
|
||||
@@ -390,7 +390,7 @@ SET(MAIKO_HDRS
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(gen-vdate
|
||||
COMMAND mkvdate > vdate.c
|
||||
COMMAND ../bin/mkvdate > vdate.c
|
||||
BYPRODUCTS vdate.c
|
||||
)
|
||||
|
||||
@@ -422,10 +422,6 @@ IF(MAIKO_DISPLAY_X11)
|
||||
TARGET_LINK_LIBRARIES(ldex ${MAIKO_LIBRARIES} ${MAIKO_DISPLAY_X11_LIBRARIES})
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(mkvdate src/mkvdate.c)
|
||||
TARGET_COMPILE_DEFINITIONS(mkvdate PUBLIC ${MAIKO_DEFINITIONS})
|
||||
TARGET_INCLUDE_DIRECTORIES(mkvdate PUBLIC inc)
|
||||
|
||||
ADD_EXECUTABLE(setsout src/setsout.c src/byteswap.c)
|
||||
TARGET_COMPILE_DEFINITIONS(setsout PUBLIC ${MAIKO_DEFINITIONS})
|
||||
TARGET_INCLUDE_DIRECTORIES(setsout PUBLIC inc)
|
||||
|
||||
63
Dockerfile
63
Dockerfile
@@ -1,18 +1,55 @@
|
||||
#*******************************************************************************
|
||||
#
|
||||
# Dockerfile to build Maiko (Stage 1) and create a Docker image and push it
|
||||
# to DockerHub (stage 2).
|
||||
#
|
||||
# Copyright 2022 by Interlisp.org
|
||||
#
|
||||
# ******************************************************************************
|
||||
|
||||
#
|
||||
# Build Maiko Stage
|
||||
#
|
||||
FROM ubuntu:focal AS builder
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
USER root:root
|
||||
# Install build tools
|
||||
RUN apt-get update && apt-get install -y make clang libx11-dev gcc x11vnc xvfb
|
||||
# Copy over / clean maiko repo
|
||||
COPY . /app/maiko
|
||||
RUN rm -rf /app/maiko/linux*
|
||||
# Build maiko
|
||||
WORKDIR /app/maiko/bin
|
||||
RUN ./makeright x
|
||||
RUN if [ "$(./osversion)" = "linux" ] && [ "$(./machinetype)" = "x86_64" ]; then ./makeright init; fi
|
||||
# Prep for Install Stage
|
||||
RUN mv ../$(./osversion).$(./machinetype) ../TRANSFER
|
||||
#
|
||||
# Install Maiko Stage
|
||||
#
|
||||
FROM ubuntu:focal
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DATE="not_available"
|
||||
ARG RELEASE_TAG="not_available"
|
||||
LABEL name="Maiko"
|
||||
LABEL description="Virtual machine for Interlisp Medley"
|
||||
LABEL url="https://github.com/Interlisp/maiko"
|
||||
LABEL build-time=$BUILD_DATE
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN apt-get update && apt-get install -y make clang libx11-dev gcc x11vnc xvfb
|
||||
|
||||
COPY --chown=nonroot:nonroot . /app/maiko
|
||||
RUN rm -rf /app/maiko/linux*
|
||||
|
||||
WORKDIR /app/maiko/bin
|
||||
RUN ./makeright x
|
||||
|
||||
RUN rm -rf /app/maiko/inc /app/maiko/include /app/maiko/src
|
||||
LABEL release_tag=$RELEASE_TAG
|
||||
ENV MAIKO_RELEASE=$RELEASE_TAG
|
||||
ENV MAIKO_BUILD_DATE=$BUILD_DATE
|
||||
ARG BUILD_LOCATION=/app/maiko
|
||||
ARG INSTALL_LOCATION=/usr/local/interlisp/maiko
|
||||
#
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
USER root:root
|
||||
# Copy release files into /usr/local/directories
|
||||
COPY --from=builder ${BUILD_LOCATION}/bin/osversion ${INSTALL_LOCATION}/bin/
|
||||
COPY --from=builder ${BUILD_LOCATION}/bin/machinetype ${INSTALL_LOCATION}/bin/
|
||||
COPY --from=builder ${BUILD_LOCATION}/bin/config.guess ${INSTALL_LOCATION}/bin/
|
||||
COPY --from=builder ${BUILD_LOCATION}/bin/config.sub ${INSTALL_LOCATION}/bin/
|
||||
COPY --from=builder ${BUILD_LOCATION}/TRANSFER/lde* ${INSTALL_LOCATION}/TRANSFER/
|
||||
RUN cd ${INSTALL_LOCATION} && mv TRANSFER "$(cd bin && ./osversion).$(cd bin/ && ./machinetype)"
|
||||
# Some niceties
|
||||
USER root
|
||||
WORKDIR /root
|
||||
ENTRYPOINT /bin/bash
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
os=${LDEARCH:-`./config.guess`}
|
||||
# o/s switch block
|
||||
case "$os" in
|
||||
m68k-*) echo m68k ;;
|
||||
sparc-*) echo sparc ;;
|
||||
alpha-*) echo alpha ;;
|
||||
i*86-*-*) echo 386 ;;
|
||||
|
||||
@@ -160,9 +160,6 @@ $(OSARCHDIR)$(LDENAME): $(LIBFILES) $(EXTFILES) $(OBJECTDIR)vdate.o
|
||||
$(OSARCHDIR)ldeether: $(OBJECTDIR)ldeether.o $(DLPIFILES)
|
||||
$(CC) $(OBJECTDIR)ldeether.o $(DLPIFILES) $(LDEETHERLDFLAGS) -o $(OSARCHDIR)ldeether
|
||||
|
||||
$(OSARCHDIR)mkvdate: $(OBJECTDIR)mkvdate.o $(REQUIRED-INCS)
|
||||
$(CC) $(OBJECTDIR)mkvdate.o $(LDFLAGS) -o $(OSARCHDIR)mkvdate
|
||||
|
||||
$(OSARCHDIR)tstsout: $(OBJECTDIR)tstsout.o $(BYTESWAPFILES) $(REQUIRED-INCS)
|
||||
$(CC) $(OBJECTDIR)tstsout.o $(BYTESWAPFILES) $(LDFLAGS) -lc -lm -o $(OSARCHDIR)tstsout
|
||||
|
||||
@@ -171,9 +168,9 @@ $(OSARCHDIR)setsout: $(OBJECTDIR)setsout.o $(REQUIRED-INCS)
|
||||
|
||||
#### Component files ######################################################
|
||||
|
||||
$(OBJECTDIR)vdate.o: $(LIBFILES) $(EXTFILES) $(OSARCHDIR)mkvdate
|
||||
$(OBJECTDIR)vdate.o: $(LIBFILES) $(EXTFILES) mkvdate
|
||||
$(RM) $(OBJECTDIR)vdate.c
|
||||
$(OSARCHDIR)mkvdate > $(OBJECTDIR)vdate.c
|
||||
$(BINDIR)mkvdate > $(OBJECTDIR)vdate.c
|
||||
$(CC) $(RFLAGS) $(OBJECTDIR)vdate.c -o $(OBJECTDIR)vdate.o
|
||||
|
||||
$(OBJECTDIR)tstsout.o: $(SRCDIR)tstsout.c $(REQUIRED-INCS) \
|
||||
@@ -197,9 +194,6 @@ $(OBJECTDIR)ldeboot.o: $(SRCDIR)ldeboot.c $(REQUIRED-INCS) \
|
||||
$(OBJECTDIR)ldeether.o: $(SRCDIR)ldeether.c $(REQUIRED-INCS)
|
||||
$(CC) $(RFLAGS) $(SRCDIR)ldeether.c -o $(OBJECTDIR)ldeether.o
|
||||
|
||||
$(OBJECTDIR)mkvdate.o: $(SRCDIR)mkvdate.c $(REQUIRED-INCS)
|
||||
$(CC) $(RFLAGS) $(SRCDIR)mkvdate.c -o $(OBJECTDIR)mkvdate.o
|
||||
|
||||
$(OBJECTDIR)main.o: $(SRCDIR)main.c $(REQUIRED-INCS) \
|
||||
$(INCDIR)lispemul.h $(INCDIR)dbprint.h \
|
||||
$(INCDIR)emlglob.h $(INCDIR)address.h $(INCDIR)adr68k.h $(INCDIR)stack.h \
|
||||
|
||||
5
bin/mkvdate
Executable file
5
bin/mkvdate
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
cat <<EOF
|
||||
#include <time.h>
|
||||
time_t MDate = $(date +%s);
|
||||
EOF
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
os=`./config.guess`
|
||||
os=${LDEARCH:-`./config.guess`}
|
||||
case "$os" in
|
||||
m68k-*-amigaos) echo amigaos ;;
|
||||
sparc-sun-sunos*) echo sunos4 ;;
|
||||
sparc-sun-solaris1*) echo sunos4 ;;
|
||||
*-*-solaris2*) echo sunos5 ;;
|
||||
|
||||
@@ -3,6 +3,4 @@
|
||||
void stab(void);
|
||||
void warn(const char *s);
|
||||
int error(const char *s);
|
||||
int stackcheck(void);
|
||||
void stackoverflow(void);
|
||||
#endif
|
||||
|
||||
@@ -59,6 +59,13 @@
|
||||
# define MAIKO_OS_DETECTED 1
|
||||
#endif
|
||||
|
||||
#ifdef amigaos3
|
||||
# define MAIKO_OS_AMIGAOS3 1
|
||||
# define MAIKO_OS_NAME "AmigaOS 3"
|
||||
# define MAIKO_OS_UNIX_LIKE 1
|
||||
# define MAIKO_OS_DETECTED 1
|
||||
#endif
|
||||
|
||||
/* __SVR4: Defined by clang, gcc, and Sun Studio.
|
||||
* __SVR4__ was only defined by Sun Studio. */
|
||||
#if defined(__sun) && defined(__SVR4)
|
||||
@@ -137,6 +144,13 @@
|
||||
# define MAIKO_ARCH_DETECTED 1
|
||||
#endif
|
||||
|
||||
#ifdef __mc68000
|
||||
# define MAIKO_ARCH_M68000 1
|
||||
# define MAIKO_ARCH_NAME "Motorola68K"
|
||||
# define MAIKO_ARCH_WORD_BITS 32
|
||||
# define MAIKO_ARCH_DETECTED 1
|
||||
#endif
|
||||
|
||||
/* Modern GNU C, Clang, Sun Studio provide __BYTE_ORDER__
|
||||
* Older GNU C (ca. 4.0.1) provides __BIG_ENDIAN__/__LITTLE_ENDIAN__
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#ifndef MAINDEFS_H
|
||||
#define MAINDEFS_H 1
|
||||
int makepathname(char *src, char *dst);
|
||||
void start_lisp(void);
|
||||
void print_info_lines(void);
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,5 @@ DLword compute_hash(const char *char_base, DLword offset, DLword length);
|
||||
DLword compute_lisp_hash(const char *char_base, DLword offset, DLword length, DLword fatp);
|
||||
LispPTR compare_chars(register const char *char1, register const char *char2, register DLword length);
|
||||
LispPTR compare_lisp_chars(register const char *char1, register const char *char2, register DLword length, DLword fat1, DLword fat2);
|
||||
LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int non_numericp);
|
||||
LispPTR parse_number(const char *char_base, short int length);
|
||||
LispPTR make_atom(const char *char_base, DLword offset, DLword length);
|
||||
#endif
|
||||
|
||||
@@ -61,8 +61,8 @@ extern int TIMEOUT_TIME;
|
||||
/************************************************************************/
|
||||
|
||||
#define INTRSAFE(exp) \
|
||||
do {} while ((int)(exp) == -1 && errno == EINTR)
|
||||
do {errno = 0; } while ((exp) == -1 && errno == EINTR)
|
||||
|
||||
#define INTRSAFE0(exp) \
|
||||
do {} while ((int)(exp) == 0 && errno == EINTR)
|
||||
do {errno = 0; } while ((exp) == NULL && errno == EINTR)
|
||||
#endif /* TIMEOUT_H */
|
||||
|
||||
18
inc/tosfns.h
18
inc/tosfns.h
@@ -513,7 +513,8 @@
|
||||
#ifndef BIGATOMS
|
||||
#define EVAL \
|
||||
do { \
|
||||
LispPTR scratch, work, lookuped; \
|
||||
LispPTR work, lookuped; \
|
||||
DLword scratch[2]; \
|
||||
switch (TOPOFSTACK & SEGMASK) { \
|
||||
case S_POSITIVE: \
|
||||
case S_NEGATIVE: \
|
||||
@@ -521,8 +522,8 @@
|
||||
case ATOM_OFFSET: \
|
||||
if ((TOPOFSTACK == NIL_PTR) || (TOPOFSTACK == ATOM_T)) \
|
||||
goto Hack_Label; \
|
||||
nnewframe(CURRENTFX, &scratch, TOPOFSTACK & 0xffff); \
|
||||
work = POINTERMASK & swapx(scratch); \
|
||||
nnewframe(CURRENTFX, scratch, TOPOFSTACK & 0xffff); \
|
||||
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
|
||||
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
|
||||
if (lookuped == NOBIND_PTR) \
|
||||
goto op_ufn; \
|
||||
@@ -552,7 +553,8 @@
|
||||
#else
|
||||
#define EVAL \
|
||||
do { \
|
||||
LispPTR scratch, work, lookuped; \
|
||||
LispPTR work, lookuped; \
|
||||
DLword scratch[2]; \
|
||||
switch (TOPOFSTACK & SEGMASK) { \
|
||||
case S_POSITIVE: \
|
||||
case S_NEGATIVE: \
|
||||
@@ -560,8 +562,8 @@
|
||||
case ATOM_OFFSET: \
|
||||
if ((TOPOFSTACK == NIL_PTR) || (TOPOFSTACK == ATOM_T)) \
|
||||
goto Hack_Label; \
|
||||
nnewframe(CURRENTFX, &scratch, TOPOFSTACK & 0xffff); \
|
||||
work = POINTERMASK & swapx(scratch); \
|
||||
nnewframe(CURRENTFX, scratch, TOPOFSTACK & 0xffff); \
|
||||
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
|
||||
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
|
||||
if (lookuped == NOBIND_PTR) \
|
||||
goto op_ufn; \
|
||||
@@ -584,8 +586,8 @@
|
||||
fn_apply = 0; \
|
||||
goto op_fn_common; \
|
||||
case TYPE_NEWATOM: \
|
||||
nnewframe(CURRENTFX, &scratch, TOPOFSTACK); \
|
||||
work = POINTERMASK & swapx(scratch); \
|
||||
nnewframe(CURRENTFX, scratch, TOPOFSTACK); \
|
||||
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
|
||||
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
|
||||
if (lookuped == NOBIND_PTR) \
|
||||
goto op_ufn; \
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "maiko/platform.h"
|
||||
|
||||
/************************************************************************/
|
||||
@@ -187,8 +188,8 @@ error Must specify RELEASE to build Medley.
|
||||
|
||||
/* Set up defaults */
|
||||
#define UNALIGNED_FETCH_OK
|
||||
#define UNSIGNED unsigned long
|
||||
#define INT long
|
||||
typedef uintptr_t UNSIGNED;
|
||||
typedef intptr_t INT;
|
||||
|
||||
|
||||
|
||||
@@ -237,9 +238,9 @@ typedef unsigned char u_char;
|
||||
typedef unsigned long u_int;
|
||||
typedef unsigned short u_short;
|
||||
#undef UNALIGNED_FETCH_OK
|
||||
#define USHORT unsigned
|
||||
typedef unsigned USHORT;
|
||||
#else
|
||||
#define USHORT unsigned short
|
||||
typedef unsigned short USHORT;
|
||||
#endif /* DOS */
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
@@ -6,5 +6,5 @@ void lisp_Xexit(DspInterface dsp);
|
||||
void Xevent_before_raid(DspInterface dsp);
|
||||
void Xevent_after_raid(DspInterface dsp);
|
||||
void Open_Display(DspInterface dsp);
|
||||
DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint);
|
||||
DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int height_hint, int depth_hint);
|
||||
#endif
|
||||
|
||||
36
src/common.c
36
src/common.c
@@ -141,39 +141,3 @@ uraidloop:
|
||||
|
||||
void warn(const char *s)
|
||||
{ printf("\nWARN: %s \n", s); }
|
||||
|
||||
/*****************************************************************
|
||||
stackcheck
|
||||
|
||||
common sub-routine.
|
||||
|
||||
Not Implemented.
|
||||
|
||||
1.check Stack overflow.
|
||||
(check CurrentStackPTR)
|
||||
2.if overflow, return T (not 0).
|
||||
Otherwise, return F (0).
|
||||
******************************************************************/
|
||||
int stackcheck() {
|
||||
#ifdef TRACE2
|
||||
printf("TRACE:stackcheck()\n");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
stackoverflow
|
||||
|
||||
common sub-routine.
|
||||
|
||||
Not Implemented.
|
||||
|
||||
1.error handling of stack overflow.
|
||||
******************************************************************/
|
||||
|
||||
void stackoverflow() {
|
||||
#ifdef TRACE2
|
||||
printf("TRACE:stackoverflow()\n");
|
||||
#endif
|
||||
printf("stackoverflow \n");
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
|
||||
nextp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
|
||||
nextp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
|
||||
nextp->prop->protect = (unsigned)sbuf.st_mode;
|
||||
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
|
||||
TIMEOUT0(pwd = getpwuid(sbuf.st_uid));
|
||||
if (pwd == (struct passwd *)NULL) {
|
||||
nextp->prop->au_len = 0;
|
||||
} else {
|
||||
@@ -1080,7 +1080,7 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
|
||||
char namebuf[MAXPATHLEN];
|
||||
|
||||
errno = 0;
|
||||
TIMEOUT(dirp = opendir(dir));
|
||||
TIMEOUT0(dirp = opendir(dir));
|
||||
if (dirp == NULL) {
|
||||
*Lisp_errno = errno;
|
||||
return (-1);
|
||||
@@ -1263,7 +1263,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
|
||||
char namebuf[MAXPATHLEN];
|
||||
|
||||
errno = 0;
|
||||
TIMEOUT(dirp = opendir(dir));
|
||||
TIMEOUT0(dirp = opendir(dir));
|
||||
if (dirp == NULL) {
|
||||
*Lisp_errno = errno;
|
||||
return (-1);
|
||||
|
||||
24
src/draw.c
24
src/draw.c
@@ -17,10 +17,10 @@
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#include "lispemul.h"
|
||||
#include "lspglob.h"
|
||||
#include "lispmap.h"
|
||||
@@ -268,21 +268,21 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
|
||||
#endif /* COLOR */
|
||||
|
||||
{
|
||||
DLword *start_addr, *temp_s, *temp_e;
|
||||
|
||||
DLword *start_addr;
|
||||
start_addr = (DLword *)Addr68k_from_LADDR(ptr);
|
||||
|
||||
if (((int)(temp_s = (DLword *)(start_addr - DisplayRegion68k)) >= 0) &&
|
||||
(start_addr < DisplayRegion68k_end_addr) &&
|
||||
((int)(temp_e = (DLword *)(dataptr - DisplayRegion68k)) >= 0) &&
|
||||
((DLword *)dataptr < DisplayRegion68k_end_addr)) {
|
||||
if (in_display_segment(start_addr) && in_display_segment(dataptr)) {
|
||||
int start_x, start_y, end_x, end_y, w, h;
|
||||
ptrdiff_t temp_s, temp_e;
|
||||
|
||||
start_y = (int)temp_s / DisplayRasterWidth;
|
||||
start_x = ((int)temp_s % DisplayRasterWidth) * BITSPER_DLWORD;
|
||||
temp_s = start_addr - DisplayRegion68k;
|
||||
temp_e = dataptr - DisplayRegion68k;
|
||||
|
||||
end_y = (int)temp_e / DisplayRasterWidth;
|
||||
end_x = ((int)temp_e % DisplayRasterWidth) * BITSPER_DLWORD + (BITSPER_DLWORD - 1);
|
||||
start_y = temp_s / DisplayRasterWidth;
|
||||
start_x = (temp_s % DisplayRasterWidth) * BITSPER_DLWORD;
|
||||
|
||||
end_y = temp_e / DisplayRasterWidth;
|
||||
end_x = (temp_e % DisplayRasterWidth) * BITSPER_DLWORD + (BITSPER_DLWORD - 1);
|
||||
|
||||
w = abs(start_x - end_x) + 1;
|
||||
h = abs(start_y - end_y) + 1;
|
||||
@@ -290,10 +290,8 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
|
||||
if (start_x > end_x) start_x = end_x;
|
||||
if (start_y > end_y) start_y = end_y;
|
||||
|
||||
|
||||
#if defined(XWINDOW) || defined(BYTESWAP)
|
||||
flush_display_region(start_x, start_y, w, h);
|
||||
|
||||
#endif /* XWINDOW */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1702,7 +1702,7 @@ LispPTR COM_getfileinfo(register LispPTR *args)
|
||||
case AUTHOR: {
|
||||
size_t rval;
|
||||
#ifndef DOS
|
||||
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
|
||||
TIMEOUT0(pwd = getpwuid(sbuf.st_uid));
|
||||
if (pwd == (struct passwd *)NULL) {
|
||||
/*
|
||||
* Returns Lisp 0. Lisp code handles this case as author
|
||||
@@ -1748,7 +1748,7 @@ LispPTR COM_getfileinfo(register LispPTR *args)
|
||||
bufp = (unsigned *)(Addr68k_from_LADDR(laddr));
|
||||
*bufp = sbuf.st_mode;
|
||||
#ifndef DOS
|
||||
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
|
||||
TIMEOUT0(pwd = getpwuid(sbuf.st_uid));
|
||||
if (pwd == (struct passwd *)NULL) { return (GetSmallp(0)); }
|
||||
laddr = cdr(car(cdr(cdr(cdr(cdr(args[2]))))));
|
||||
STRING_BASE(laddr, base);
|
||||
|
||||
@@ -27,9 +27,6 @@ DspInterface currentdsp = &curdsp;
|
||||
#ifdef XWINDOW
|
||||
extern int LispDisplayRequestedWidth;
|
||||
extern int LispDisplayRequestedHeight;
|
||||
|
||||
extern DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint,
|
||||
int depth_hint);
|
||||
#endif /* XWINDOW */
|
||||
|
||||
#ifdef DOS
|
||||
|
||||
@@ -478,7 +478,7 @@ int *ether_debug() {
|
||||
#ifdef MAIKO_ENABLE_ETHERNET
|
||||
estat[0] = 0;
|
||||
if (ether_fd < 0) return (NIL);
|
||||
printf("fd %d bsize %d buf %X icb %X in %d out %d\n ", ether_fd, ether_bsize, (int)ether_buf,
|
||||
printf("fd %d bsize %d buf %p icb %X in %d out %d\n ", ether_fd, ether_bsize, ether_buf,
|
||||
IOPage->dlethernet[3], ether_in, ether_out);
|
||||
#endif /* MAIKO_ENABLE_ETHERNET */
|
||||
|
||||
@@ -742,7 +742,7 @@ static int check_filter(u_char *buffer)
|
||||
static void init_uid() {
|
||||
int rid;
|
||||
rid = getuid();
|
||||
seteuid(rid);
|
||||
setuid(rid);
|
||||
}
|
||||
#endif /* MAIKO_ENABLE_ETHERNET */
|
||||
|
||||
@@ -830,7 +830,7 @@ void init_ether() {
|
||||
/* JDS 991228 remove perror("Can't open network; XNS unavailable.\n"); */
|
||||
ether_fd = -1;
|
||||
}
|
||||
seteuid(getuid());
|
||||
setuid(getuid());
|
||||
}
|
||||
#elif defined(USE_NIT)
|
||||
#ifndef OS4
|
||||
@@ -952,7 +952,7 @@ void init_ether() {
|
||||
perror("Can't open network; XNS unavailable.\n");
|
||||
ether_fd = -1;
|
||||
}
|
||||
seteuid(getuid());
|
||||
setuid(getuid());
|
||||
}
|
||||
|
||||
#endif /* OS4 */
|
||||
|
||||
@@ -112,7 +112,7 @@ LispPTR aref1(LispPTR array, int index) {
|
||||
if (index >= actarray->totalsize) {
|
||||
printf("Invalid index in GC's AREF1: 0x%x\n", index);
|
||||
printf(" Array size limit: 0x%x\n", actarray->totalsize);
|
||||
printf(" Array ptr: 0x%lx\n", (UNSIGNED)array);
|
||||
printf(" Array ptr: 0x%x\n", array);
|
||||
printf(" Array 68K ptr: %p\n", actarray);
|
||||
printf("base: 0x%x\n", actarray->base);
|
||||
printf("offset: 0x%x\n", actarray->offset);
|
||||
|
||||
@@ -139,8 +139,7 @@ void init_ifpage(int sysout_size) {
|
||||
|
||||
#ifdef BIGVM
|
||||
/* For BIGVM system, save the value in \LASTVMEMFILEPAGE for lisp's use */
|
||||
if ((LispPTR)LASTVMEMFILEPAGE_word != 0xFFFFFFFF)
|
||||
*LASTVMEMFILEPAGE_word = InterfacePage->dllastvmempage;
|
||||
*LASTVMEMFILEPAGE_word = InterfacePage->dllastvmempage;
|
||||
#endif /* BIGVM */
|
||||
|
||||
/* unfortunately, Lisp only looks at a 16 bit serial number */
|
||||
|
||||
@@ -214,7 +214,7 @@ int main(int argc, char *argv[]) {
|
||||
ether_fd = -1;
|
||||
/* exit(); */
|
||||
}
|
||||
seteuid(getuid());
|
||||
setuid(getuid());
|
||||
}
|
||||
|
||||
/* OK, right here do other stuff like scan args */
|
||||
|
||||
106
src/main.c
106
src/main.c
@@ -236,10 +236,6 @@ int display_max = 65536 * 16 * 2;
|
||||
/* diagnostic flag for sysout dumping */
|
||||
extern int maxpages;
|
||||
|
||||
/** For call makepathname inside main() **/
|
||||
extern int *Lisp_errno;
|
||||
extern int Dummy_errno; /* If errno cell is not provided by Lisp, dummy_errno is used. */
|
||||
|
||||
char sysout_name[MAXPATHLEN]; /* Set by read_Xoption, in the X version. */
|
||||
int sysout_size = 0; /* ditto */
|
||||
|
||||
@@ -336,9 +332,6 @@ int main(int argc, char *argv[])
|
||||
Barf and print the command line if tha fails
|
||||
*/
|
||||
|
||||
/* For call makepathname */
|
||||
Lisp_errno = &Dummy_errno;
|
||||
|
||||
i = 1;
|
||||
|
||||
if (argv[i] && ((strcmp(argv[i], "-info") == 0) || (strcmp(argv[i], "-INFO") == 0))) {
|
||||
@@ -358,13 +351,18 @@ int main(int argc, char *argv[])
|
||||
strncpy(sysout_name, envname, MAXPATHLEN);
|
||||
} else if ((envname = getenv("LDESOURCESYSOUT")) != NULL)
|
||||
strncpy(sysout_name, envname, MAXPATHLEN);
|
||||
else {
|
||||
#ifdef DOS
|
||||
else if (!makepathname("lisp.vm", sysout_name)
|
||||
strncpy(sysout_name, "lisp.vm", MAXPATHLEN);
|
||||
#else
|
||||
else if (!makepathname("~/lisp.virtualmem", sysout_name)
|
||||
if ((envname = getenv("HOME")) != NULL) {
|
||||
strncpy(sysout_name, envname, MAXPATHLEN);
|
||||
strncat(sysout_name, "/lisp.virtualmem", MAXPATHLEN - 17);
|
||||
}
|
||||
#endif /* DOS */
|
||||
|| access(sysout_name, R_OK)) {
|
||||
fprintf(stderr, "Couldn't find a sysout to run;\n");
|
||||
}
|
||||
if (access(sysout_name, R_OK)) {
|
||||
perror("Couldn't find a sysout to run");
|
||||
fprintf(stderr, "%s", helpstring);
|
||||
exit(1);
|
||||
}
|
||||
@@ -486,9 +484,9 @@ int main(int argc, char *argv[])
|
||||
probemouse(); /* See if the mouse is connected. */
|
||||
#else
|
||||
if (getuid() != geteuid()) {
|
||||
fprintf(stderr, "Effective user is not real user. Setting euid to uid.\n");
|
||||
if (seteuid(getuid()) == -1) {
|
||||
fprintf(stderr, "Unable to reset effective user id to real user id\n");
|
||||
fprintf(stderr, "Effective user is not real user. Resetting uid\n");
|
||||
if (setuid(getuid()) == -1) {
|
||||
fprintf(stderr, "Unable to reset user id to real user id\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@@ -614,86 +612,6 @@ void start_lisp() {
|
||||
dispatch();
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* m a k e p a t h n a m e */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
int makepathname(char *src, char *dst)
|
||||
{
|
||||
register char *base, *cp;
|
||||
register struct passwd *pwd;
|
||||
char name[MAXPATHLEN];
|
||||
|
||||
base = src;
|
||||
switch (*base) {
|
||||
case '.':
|
||||
if (getcwd(dst, MAXPATHLEN) == 0)
|
||||
{ /* set working directory */
|
||||
*Lisp_errno = errno;
|
||||
return (0);
|
||||
}
|
||||
switch (*(base + 1)) {
|
||||
case '.':
|
||||
if (*(base + 2) == '/') { /* Now, base == "../xxxx" */
|
||||
cp = (char *)strrchr(dst, '/');
|
||||
if (cp == 0) return (0);
|
||||
*cp = '\0';
|
||||
strcat(dst, base + 2);
|
||||
return (1);
|
||||
} else
|
||||
return (0);
|
||||
case '/':
|
||||
/* Now, base == "./xxx" */
|
||||
strcat(dst, base + 1);
|
||||
return (1);
|
||||
default: return (0);
|
||||
}
|
||||
case '~':
|
||||
ERRSETJMP(0);
|
||||
if (*(base + 1) == '/') {
|
||||
/* path is "~/foo" */
|
||||
#ifdef DOS
|
||||
pwd = 0;
|
||||
#else
|
||||
TIMEOUT(pwd = getpwuid(getuid()));
|
||||
#endif /* DOS */
|
||||
if (pwd == NULL) {
|
||||
*Lisp_errno = errno;
|
||||
return (0);
|
||||
}
|
||||
#ifndef DOS
|
||||
sprintf(dst, "%s%s", pwd->pw_dir, base + 1);
|
||||
#endif
|
||||
return (1);
|
||||
} else {
|
||||
/* path is "~foo/" */
|
||||
if ((cp = (char *)strchr(base + 1, '/')) == 0)
|
||||
return (0);
|
||||
else {
|
||||
size_t len = cp - base - 1;
|
||||
strncpy(name, base + 1, len);
|
||||
name[len] = '\0';
|
||||
#ifndef DOS
|
||||
TIMEOUT(pwd = getpwnam(name));
|
||||
#endif /* DOS */
|
||||
if (pwd == NULL) {
|
||||
*Lisp_errno = errno;
|
||||
return (0);
|
||||
}
|
||||
#ifndef DOS
|
||||
sprintf(dst, "%s%s", pwd->pw_dir, cp);
|
||||
#endif /* DOS */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
default: strcpy(dst, src); return (1);
|
||||
}
|
||||
}
|
||||
|
||||
void print_info_lines() {
|
||||
#if (RELEASE == 200)
|
||||
printf("Emulator for Medley release 2.0\n");
|
||||
|
||||
120
src/mkatom.c
120
src/mkatom.c
@@ -27,7 +27,6 @@
|
||||
compute_hash
|
||||
create_symbol
|
||||
compare_chars
|
||||
parse_number
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
@@ -248,10 +247,11 @@ LispPTR compare_lisp_chars(register const char *char1, register const char *char
|
||||
/*
|
||||
Func name : make_atom
|
||||
|
||||
If the atom already existed then return
|
||||
else create new atom . Returns the Atom's index.
|
||||
Look up the atom index of an existing atom, or return 0xFFFFFFFF
|
||||
|
||||
This function does not handle FAT pname's.
|
||||
This function is a subset of \MKATOM (in LLBASIC), but only handles
|
||||
thin text atom names (no numbers, no 2-byte pnames).
|
||||
It MUST return the same atom index number as \MKATOM
|
||||
|
||||
Date : January 29, 1987
|
||||
Edited by : Takeshi Shimizu
|
||||
@@ -264,8 +264,7 @@ LispPTR compare_lisp_chars(register const char *char1, register const char *char
|
||||
*/
|
||||
/**********************************************************************/
|
||||
|
||||
LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int non_numericp)
|
||||
/* if it is NIL then these chars are treated as NUMBER */
|
||||
LispPTR make_atom(const char *char_base, DLword offset, DLword length)
|
||||
{
|
||||
extern DLword *AtomHT;
|
||||
extern DLword *Pnamespace;
|
||||
@@ -281,41 +280,34 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
|
||||
unsigned short first_char;
|
||||
|
||||
#ifdef TRACE2
|
||||
printf("TRACE: make_atom( %s , offset= %d, len= %d, non_numericp = %d)\n", char_base, offset,
|
||||
length, non_numericp);
|
||||
printf("TRACE: make_atom( %s , offset= %d, len= %d)\n", char_base, offset, length);
|
||||
#endif
|
||||
|
||||
first_char = (*(char_base + offset)) & 0xff;
|
||||
if (length != 0) {
|
||||
if (length == 1) /* one char. atoms */
|
||||
{
|
||||
if (first_char > 57) /* greater than '9 */
|
||||
return ((LispPTR)(ATOMoffset + (first_char - 10)));
|
||||
else if (first_char > 47) /* between '0 to '9 */
|
||||
return ((LispPTR)(S_POSITIVE + (first_char - 48)));
|
||||
/* fixed S_... mar-27-87 take */
|
||||
else /* other one char. atoms */
|
||||
return ((LispPTR)(ATOMoffset + first_char));
|
||||
} /* if(length==1.. end */
|
||||
else if ((non_numericp == NIL) && (first_char <= '9'))
|
||||
/* more than 10 arithmetic aon + - mixed atom process */
|
||||
{
|
||||
if ((hash_entry = parse_number(char_base + offset, length)) != 0)
|
||||
return ((LispPTR)hash_entry); /* if NIL that means THE ATOM is +- mixed litatom */
|
||||
/* 15 may 87 take */
|
||||
}
|
||||
|
||||
hash = compute_hash(char_base, offset, length);
|
||||
|
||||
} /* if(lengt.. end */
|
||||
else {
|
||||
switch (length) {
|
||||
case 0:
|
||||
/* the zero-length atom has hashcode 0 */
|
||||
hash = 0;
|
||||
first_char = 255;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* One-character atoms live in well known places, no need to hash */
|
||||
if (first_char > '9')
|
||||
return ((LispPTR)(ATOMoffset + (first_char - 10)));
|
||||
if (first_char >= '0' ) /* 0..9 */
|
||||
return ((LispPTR)(S_POSITIVE + (first_char - '0')));
|
||||
/* other one character atoms */
|
||||
return ((LispPTR)(ATOMoffset + first_char));
|
||||
|
||||
default:
|
||||
hash = compute_hash(char_base, offset, length);
|
||||
break;
|
||||
}
|
||||
|
||||
/* This point corresponds with LP in Lisp source */
|
||||
|
||||
/* following for loop never exits until it finds new hash entry or same atom */
|
||||
/* following for loop does not exit until it finds new hash entry or same atom */
|
||||
for (reprobe = Atom_reprobe(hash, first_char); (hash_entry = GETWORD(AtomHT + hash)) != 0;
|
||||
hash = ((hash + reprobe) & 0xffff)) {
|
||||
atom_index = hash_entry - 1;
|
||||
@@ -326,7 +318,7 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
|
||||
if ((length == GETBYTE(pname_base)) &&
|
||||
(compare_chars(++pname_base, char_base + offset, length) == T)) {
|
||||
DBPRINT(("FOUND the atom. \n"));
|
||||
return (atom_index); /* find already existed atom */
|
||||
return (atom_index); /* found existing atom */
|
||||
}
|
||||
DBPRINT(("HASH doesn't hit. reprobe!\n"));
|
||||
|
||||
@@ -337,65 +329,3 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
|
||||
return (0xffffffff);
|
||||
/** Don't create newatom now **/
|
||||
} /* make_atom end */
|
||||
|
||||
/*********************************************************************/
|
||||
/*
|
||||
Func name : parse_number
|
||||
|
||||
Desc : It can treat -65534 to 65535 integer
|
||||
Returns SMALLP PTR
|
||||
Date : 1,May 1987 Take
|
||||
15 May 87 take
|
||||
*/
|
||||
/*********************************************************************/
|
||||
|
||||
/* Assume this func. should be called with C string in "char_base" */
|
||||
LispPTR parse_number(const char *char_base, short int length) {
|
||||
register LispPTR sign_mask;
|
||||
register LispPTR val;
|
||||
register int radix;
|
||||
register int *cell68k;
|
||||
|
||||
#ifdef TRACE2
|
||||
printf("TRACE: parse_number()\n");
|
||||
#endif
|
||||
|
||||
/* Check for Radix 8(Q) postfixed ?? */
|
||||
if ((*(char_base + (length - 1))) == 'Q') {
|
||||
radix = 8;
|
||||
length--;
|
||||
} else
|
||||
radix = 10;
|
||||
|
||||
/* Check for Sign */
|
||||
sign_mask = S_POSITIVE;
|
||||
|
||||
if ((*(char_base) == '+') || (*(char_base) == '-')) {
|
||||
sign_mask = ((*char_base++) == '+') ? S_POSITIVE : S_NEGATIVE;
|
||||
length--;
|
||||
}
|
||||
|
||||
for (val = 0; length > 0; length--) {
|
||||
if ((((*char_base)) < '0') || ('9' < ((*char_base)))) return (NIL);
|
||||
val = radix * val + (*char_base++) - '0';
|
||||
}
|
||||
|
||||
if (val > 0xffffffff) error("parse_number : Overflow ...exceeded range of FIXP");
|
||||
|
||||
if ((sign_mask == S_POSITIVE) && (val > 0xffff)) {
|
||||
cell68k = (int *)createcell68k(TYPE_FIXP);
|
||||
*cell68k = val;
|
||||
return (LADDR_from_68k(cell68k));
|
||||
} else if ((sign_mask == S_NEGATIVE) && (val > 0xffff)) {
|
||||
cell68k = (int *)createcell68k(TYPE_FIXP);
|
||||
*cell68k = ~val + 1;
|
||||
return (LADDR_from_68k(cell68k));
|
||||
}
|
||||
|
||||
else if (sign_mask == S_NEGATIVE)
|
||||
return (sign_mask | (~((DLword)val) + 1));
|
||||
else {
|
||||
return (sign_mask | val);
|
||||
}
|
||||
}
|
||||
/* end parse_number */
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "conspagedefs.h"
|
||||
#include "gcfinaldefs.h"
|
||||
#include "gchtfinddefs.h"
|
||||
#include "mkatomdefs.h"
|
||||
#include "testtooldefs.h"
|
||||
|
||||
#define MINARRAYBLOCKSIZE 4
|
||||
#define GUARDVMEMFULL 500
|
||||
@@ -374,7 +374,7 @@ LispPTR newpage(LispPTR base) {
|
||||
} else if (InterfacePage->key == IFPVALID_KEY) {
|
||||
*VMEM_FULL_STATE_word = ATOM_T;
|
||||
} else
|
||||
*VMEM_FULL_STATE_word = make_atom("DIRTY", 0, 5, 0);
|
||||
*VMEM_FULL_STATE_word = MAKEATOM("DIRTY");
|
||||
}
|
||||
|
||||
return (base);
|
||||
|
||||
12
src/subr.c
12
src/subr.c
@@ -484,18 +484,28 @@ void OP_subrcall(int subr_no, int argnum) {
|
||||
|
||||
case sb_GET_NATIVE_ADDR_FROM_LISP_PTR:
|
||||
POP_SUBR_ARGS;
|
||||
/* XXX: this WILL NOT WORK if Lisp memory is allocated outside the low 4GB */
|
||||
/* not supported since native addresses can't be represented as
|
||||
a Lisp FIXP
|
||||
ARITH_SWITCH(Addr68k_from_LADDR(args[0]), TopOfStack);
|
||||
*/
|
||||
TopOfStack = NIL_PTR;
|
||||
break;
|
||||
|
||||
case sb_GET_LISP_PTR_FROM_NATIVE_ADDR:
|
||||
POP_SUBR_ARGS;
|
||||
/* not supported since native addresses can't be represented as
|
||||
a Lisp FIXP
|
||||
|
||||
{
|
||||
register UNSIGNED iarg;
|
||||
N_GETNUMBER(args[0], iarg, ret_nil);
|
||||
ARITH_SWITCH(LADDR_from_68k(iarg), TopOfStack);
|
||||
break;
|
||||
};
|
||||
|
||||
*/
|
||||
TopOfStack = NIL_PTR;
|
||||
break;
|
||||
case sb_DSK_GETFILENAME:
|
||||
POP_SUBR_ARGS;
|
||||
TopOfStack = DSK_getfilename(args);
|
||||
|
||||
@@ -424,7 +424,7 @@ void dump_fnobj(LispPTR index)
|
||||
/************************************************************************/
|
||||
|
||||
/* Opcode names, by opcode */
|
||||
static const char *opcode_table[256] = {
|
||||
const char *opcode_table[256] = {
|
||||
"-X-",
|
||||
"CAR",
|
||||
"CDR",
|
||||
@@ -1018,7 +1018,7 @@ FX *get_nextFX(FX *fx) {
|
||||
} /* get_nextFX end */
|
||||
|
||||
LispPTR MAKEATOM(char *string) {
|
||||
return (make_atom(string, 0, strlen(string), 0));
|
||||
return (make_atom(string, 0, strlen(string)));
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
@@ -1032,7 +1032,7 @@ LispPTR MAKEATOM(char *string) {
|
||||
|
||||
LispPTR *MakeAtom68k(char *string) {
|
||||
LispPTR index;
|
||||
index = make_atom(string, 0, strlen(string), 0);
|
||||
index = make_atom(string, 0, strlen(string));
|
||||
if (index == 0xffffffff) {
|
||||
error("MakeAtom68k: no such atom found");
|
||||
}
|
||||
|
||||
@@ -566,7 +566,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
|
||||
case '~':
|
||||
if (*(cp + 1) == '>' || *(cp + 1) == '\0') {
|
||||
/* "~>" or "~" means the user's home directory. */
|
||||
TIMEOUT(pwd = getpwuid(getuid()));
|
||||
TIMEOUT0(pwd = getpwuid(getuid()));
|
||||
if (pwd == NULL) return (0);
|
||||
|
||||
strcpy(dst, pwd->pw_dir);
|
||||
@@ -590,7 +590,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
|
||||
*/
|
||||
for (++cp, np = name; *cp != '\0' && *cp != '>';) *np++ = *cp++;
|
||||
*np = '\0';
|
||||
TIMEOUT(pwd = getpwnam(name));
|
||||
TIMEOUT0(pwd = getpwnam(name));
|
||||
if (pwd == NULL) return (0);
|
||||
|
||||
strcpy(dst, pwd->pw_dir);
|
||||
|
||||
117
src/unixcomm.c
117
src/unixcomm.c
@@ -89,7 +89,6 @@ enum UJTYPE {
|
||||
/* These are indexed by WRITE socket# */
|
||||
struct unixjob {
|
||||
char *pathname; /* used by Lisp direct socket access subr */
|
||||
int readsock; /* Socket to READ from for this job. */
|
||||
int PID; /* process ID associated with this slot */
|
||||
int status; /* status returned by subprocess (not shell) */
|
||||
enum UJTYPE type;
|
||||
@@ -284,7 +283,6 @@ int FindUnixPipes(void) {
|
||||
cleareduj.status = -1;
|
||||
cleareduj.pathname = NULL;
|
||||
cleareduj.PID = 0;
|
||||
cleareduj.readsock = 0;
|
||||
cleareduj.type = UJUNUSED;
|
||||
for (int i = 0; i < NPROCS; i++) UJ[i] = cleareduj;
|
||||
|
||||
@@ -374,7 +372,7 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
|
||||
/* Get command */
|
||||
N_GETNUMBER(args[0], command, bad);
|
||||
DBPRINT(("\nUnix_handlecomm: trying %d\n", command));
|
||||
DBPRINT(("\nUnix_handlecomm: command %d\n", command));
|
||||
|
||||
switch (command) {
|
||||
case 0: /* Fork pipe process */
|
||||
@@ -435,9 +433,9 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
UJ[PipeFD].type = UJPROCESS;
|
||||
UJ[PipeFD].status = -1;
|
||||
UJ[PipeFD].PID = (d[1] << 8) | d[2] | (d[4] << 16) | (d[5] << 24);
|
||||
UJ[PipeFD].readsock = 0;
|
||||
close(sockFD);
|
||||
unlink(PipeName);
|
||||
DBPRINT(("New process: slot/PipeFD %d PID %d\n", PipeFD, UJ[PipeFD].PID));
|
||||
return (GetSmallp(PipeFD));
|
||||
} else {
|
||||
DBPRINT(("Fork request failed."));
|
||||
@@ -482,17 +480,11 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
N_GETNUMBER(args[1], slot, bad); /* Get job # */
|
||||
|
||||
if (!valid_slot(slot)) return (NIL); /* No fd open; punt the read */
|
||||
|
||||
if (UJ[slot].readsock)
|
||||
sock = UJ[slot].readsock;
|
||||
else
|
||||
sock = slot;
|
||||
|
||||
switch (UJ[slot].type) {
|
||||
case UJPROCESS:
|
||||
case UJSHELL:
|
||||
case UJSOSTREAM:
|
||||
TIMEOUT(dest = read(sock, buf, 1));
|
||||
TIMEOUT(dest = read(slot, buf, 1));
|
||||
if (dest > 0) return (GetSmallp(buf[0]));
|
||||
/* Something's amiss; check our process status */
|
||||
wait_for_comm_processes();
|
||||
@@ -523,66 +515,46 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
|
||||
N_GETNUMBER(args[1], slot, bad);
|
||||
|
||||
DBPRINT(("Killing process in slot %d.\n", slot));
|
||||
|
||||
if (valid_slot(slot)) switch (UJ[slot].type) {
|
||||
case UJSHELL:
|
||||
case UJPROCESS:
|
||||
/* First check to see it hasn't already died */
|
||||
if (UJ[slot].status == -1) {
|
||||
/* Kill the job */
|
||||
kill(UJ[slot].PID, SIGKILL);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
/* Waiting for the process to exit is possibly risky.
|
||||
Sending SIGKILL is always supposed to kill
|
||||
a process, but on very rare occurrences this doesn't
|
||||
happen because of a Unix kernel bug, usually a user-
|
||||
written device driver which hasn't been fully
|
||||
debugged. So we time it out just be safe. */
|
||||
if (UJ[slot].status != -1) break;
|
||||
wait_for_comm_processes();
|
||||
usleep(10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
else
|
||||
return (ATOM_T);
|
||||
|
||||
DBPRINT(("Terminating process in slot %d.\n", slot));
|
||||
if (!valid_slot(slot)) return (ATOM_T);
|
||||
/* in all cases we need to close() the file descriptor */
|
||||
close(slot);
|
||||
switch (UJ[slot].type) {
|
||||
case UJUNUSED:
|
||||
break;
|
||||
|
||||
case UJSHELL:
|
||||
DBPRINT(("Kill 3 closing shell desc %d.\n", slot));
|
||||
close(slot);
|
||||
break;
|
||||
|
||||
case UJPROCESS:
|
||||
DBPRINT(("Kill 3 closing process desc %d.\n", slot));
|
||||
close(slot);
|
||||
if (UJ[slot].readsock) close(UJ[slot].readsock);
|
||||
break;
|
||||
|
||||
case UJSOSTREAM:
|
||||
DBPRINT(("Kill 3 closing stream socket desc %d.\n", slot));
|
||||
close(slot);
|
||||
break;
|
||||
|
||||
case UJSOCKET:
|
||||
DBPRINT(("Kill 3 closing raw socket desc %d.\n", slot));
|
||||
close(slot);
|
||||
case UJSHELL:
|
||||
case UJPROCESS:
|
||||
/* wait for up to 0.1s for it to exit on its own after the close() */
|
||||
for (int i = 0; i < 10; i++) {
|
||||
wait_for_comm_processes();
|
||||
if (UJ[slot].status != -1) break;
|
||||
usleep(10000);
|
||||
}
|
||||
/* check again before we terminate it */
|
||||
if (UJ[slot].status != -1) break;
|
||||
kill(UJ[slot].PID, SIGKILL);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
/* Waiting for the process to exit is possibly risky.
|
||||
Sending SIGKILL is always supposed to kill
|
||||
a process, but on very rare occurrences this doesn't
|
||||
happen because of a Unix kernel bug, usually a user-
|
||||
written device driver which hasn't been fully
|
||||
debugged. So we time it out just be safe. */
|
||||
wait_for_comm_processes();
|
||||
usleep(10000);
|
||||
if (UJ[slot].status != -1) break;
|
||||
}
|
||||
break;
|
||||
case UJSOCKET:
|
||||
if (UJ[slot].pathname) {
|
||||
DBPRINT(("Unlinking %s\n", UJ[slot].pathname));
|
||||
if (UJ[slot].pathname) {
|
||||
if (unlink(UJ[slot].pathname) < 0) perror("Kill 3 unlink");
|
||||
free(UJ[slot].pathname);
|
||||
UJ[slot].pathname = NULL;
|
||||
}
|
||||
break;
|
||||
if (unlink(UJ[slot].pathname) < 0) perror("Kill 3 unlink");
|
||||
free(UJ[slot].pathname);
|
||||
UJ[slot].pathname = NULL;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
UJ[slot].type = UJUNUSED;
|
||||
UJ[slot].readsock = UJ[slot].PID = 0;
|
||||
UJ[slot].PID = 0;
|
||||
UJ[slot].pathname = NULL;
|
||||
|
||||
/* If status available, return it, otherwise T */
|
||||
@@ -674,8 +646,6 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
case UJPROCESS:
|
||||
DBPRINT(("Kill 5 closing process desc %d.\n", dest));
|
||||
close(dest);
|
||||
if (UJ[dest].readsock) close(UJ[dest].readsock);
|
||||
UJ[dest].readsock = 0;
|
||||
break;
|
||||
|
||||
case UJSOCKET:
|
||||
@@ -696,7 +666,7 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
}
|
||||
|
||||
UJ[dest].type = UJUNUSED;
|
||||
UJ[dest].readsock = UJ[dest].PID = 0;
|
||||
UJ[dest].PID = 0;
|
||||
return (ATOM_T);
|
||||
/* break; */
|
||||
|
||||
@@ -729,18 +699,13 @@ LispPTR Unix_handlecomm(LispPTR *args) {
|
||||
N_GETNUMBER(args[1], slot, bad); /* Get job # */
|
||||
if (!valid_slot(slot)) return (NIL); /* No fd open; punt the read */
|
||||
|
||||
if (UJ[slot].readsock)
|
||||
sock = UJ[slot].readsock;
|
||||
else
|
||||
sock = slot;
|
||||
|
||||
bufp = (Addr68k_from_LADDR(args[2])); /* User buffer */
|
||||
DBPRINT(("Read buffer slot %d, type is %d\n", slot, UJ[slot].type));
|
||||
|
||||
switch (UJ[slot].type) {
|
||||
case UJSHELL:
|
||||
case UJPROCESS:
|
||||
case UJSOSTREAM: dest = read(sock, bufp, 512);
|
||||
case UJSOSTREAM: dest = read(slot, bufp, 512);
|
||||
#ifdef BYTESWAP
|
||||
word_swap_page(bufp, 128);
|
||||
#endif /* BYTESWAP */
|
||||
|
||||
@@ -286,7 +286,7 @@ LispPTR parse_atomstring(char *string)
|
||||
namelen = cnt - 1;
|
||||
|
||||
if ((packagelen == 0) || (strncmp(packageptr, "IL", packagelen) == 0)) { /* default IL: */
|
||||
aindex = make_atom(nameptr, 0, namelen, T);
|
||||
aindex = make_atom(nameptr, 0, namelen);
|
||||
if (aindex == 0xffffffff) {
|
||||
printf("trying IL:\n");
|
||||
aindex = get_package_atom(nameptr, namelen, "INTERLISP", 9, 0);
|
||||
|
||||
@@ -222,7 +222,7 @@ void Open_Display(DspInterface dsp)
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
|
||||
DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint,
|
||||
DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int height_hint,
|
||||
int depth_hint)
|
||||
{
|
||||
Screen *Xscreen;
|
||||
|
||||
Reference in New Issue
Block a user