Skip to content

Commit

Permalink
Archival checkin of partially building minix68k plat. I don't think
Browse files Browse the repository at this point in the history
porting the old minixST code is going to work here, and it needs a whole
new set of headers.
  • Loading branch information
davidgiven committed Jan 9, 2025
1 parent 23cd6e3 commit 11cdf8b
Show file tree
Hide file tree
Showing 34 changed files with 331 additions and 236 deletions.
1 change: 1 addition & 0 deletions lang/cem/libcc.ansi/core/misc/raise.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>

#if ACKCONF_WANT_EMULATED_RAISE

Expand Down
4 changes: 4 additions & 0 deletions lang/cem/libcc.ansi/headers/ack/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#define ACKCONF_WANT_STANDARD_SIGNALS 1
#endif

#ifndef ACKCONF_WANT_SYS_ERRNO_H
#define ACKCONF_WANT_SYS_ERRNO_H 0
#endif

#ifndef ACKCONF_WANT_TERMIOS
/* Don't compile termios-using functions unless the plat explicitly asks for it. */
#define ACKCONF_WANT_TERMIOS 0
Expand Down
6 changes: 6 additions & 0 deletions lang/cem/libcc.ansi/headers/errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#ifndef _ERRNO_H
#define _ERRNO_H

#if ACKCONF_WANT_SYS_ERRNO_H
#include <sys/errno.h>
#else

/* These values are defined by the ANSI standard. */

#define EDOM 33
Expand Down Expand Up @@ -51,3 +55,5 @@
extern int errno;

#endif

#endif
4 changes: 2 additions & 2 deletions lang/cem/libcc.ansi/sys/misc/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ alfun(int sig)
longjmp(setjmpbuf, 1);
} /* used with sleep() below */

void sleep(int n)
unsigned int sleep(int n)
{
/* sleep(n) pauses for 'n' seconds by scheduling an alarm interrupt. */
unsigned oldalarm = 0;
Expand All @@ -30,7 +30,7 @@ void sleep(int n)
{
signal(SIGALRM, oldsig);
alarm(oldalarm);
return;
return 0;
}
oldalarm = alarm(5000); /* Who cares how long, as long
* as it is long enough
Expand Down
57 changes: 0 additions & 57 deletions lib/minix/include/string.h

This file was deleted.

96 changes: 0 additions & 96 deletions lib/minix/include/sys/errno.h

This file was deleted.

File renamed without changes.
39 changes: 39 additions & 0 deletions plat/minix/include/build.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include("plat/build.lua")

headermap = {}
packagemap = {}

local function addheader(h)
headermap[h] = "plat/minix/include/"..h
packagemap["$(PLATIND)/minix/include/"..h] = "plat/minix/include/"..h
end

addheader("unistd.h")
addheader("ansi.h")
addheader("minix/callnr.h")
addheader("minix/const.h")
addheader("minix/config.h")
addheader("minix/type.h")
addheader("minix/com.h")
addheader("utime.h")
addheader("sgtty.h")
addheader("sys/types.h")
addheader("sys/errno.h")
addheader("sys/times.h")
addheader("sys/stat.h")
addheader("sys/wait.h")
addheader("signal.h")
addheader("limits.h")
addheader("fcntl.h")
addheader("time.h")
addheader("lib.h")

acklibrary {
name = "headers",
hdrs = headermap
}

installable {
name = "pkg",
map = packagemap
}
2 changes: 2 additions & 0 deletions lib/minix/include/fcntl.h → plat/minix/include/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef _FCNTL_H
#define _FCNTL_H

#include <sys/types.h>

/* These values are used for cmd in fcntl(). POSIX Table 6-1. */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions lib/minix/include/signal.h → plat/minix/include/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef _SIGNAL_H
#define _SIGNAL_H

#include <sys/types.h>

/* Here are types that are closely associated with signal handling. */
typedef int sig_atomic_t;

Expand Down Expand Up @@ -97,6 +99,7 @@ struct sigaction {

/* Function Prototypes. */
_PROTOTYPE( int raise, (int _sig) );
_PROTOTYPE( int kill, (pid_t _pid, int _sig) );

#ifdef _POSIX_SOURCE
_PROTOTYPE( int kill, (pid_t _pid, int _sig) );
Expand Down
4 changes: 2 additions & 2 deletions lib/minix/include/errno.h → plat/minix/include/sys/errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* file is included in an ordinary user program, EPERM has the value ( 1).
*/

#ifndef _ERRNO_H /* check if <errno.h> is already included */
#define _ERRNO_H /* it is not included; note that fact */
#ifndef _SYS_ERRNO_H /* check if <errno.h> is already included */
#define _SYS_ERRNO_H /* it is not included; note that fact */

/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
#ifdef _SYSTEM
Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 1 addition & 10 deletions lib/minix/include/sys/types.h → plat/minix/include/sys/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@
#ifndef _TYPES_H
#define _TYPES_H

/* The type size_t holds the result of the size_of operator. This type is
* 'unsigned int', in order to be compatible with the old library (f.i. the
* argument of malloc was an unsigned int, and is now a size_t). This means
* that a 70K array can not be allocated.
*/
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif
#include <stdint.h>

#ifndef _TIME_T
#define _TIME_T
Expand All @@ -41,7 +33,6 @@ typedef char gid_t; /* group id */
typedef unsigned short ino_t; /* i-node number */
typedef short mode_t; /* mode number within an i-node */
typedef char nlink_t; /* number-of-links field within an i-node */
typedef long off_t; /* offsets within a file */
typedef int pid_t; /* type for pids (must be signed) */
typedef short uid_t; /* user id */
typedef long zone_t; /* holds a zone number */
Expand Down
File renamed without changes.
10 changes: 3 additions & 7 deletions lib/minix/include/time.h → plat/minix/include/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
#ifndef _TIME_H
#define _TIME_H

#include <sys/types.h>
#include <stddef.h>

#define CLOCKS_PER_SEC 60 /* MINIX always uses 60 Hz, even in Europe */
#ifdef _POSIX_SOURCE
#define CLK_TCK CLOCKS_PER_SEC
#endif

#define NULL ((void *)0)

#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif

#ifndef _TIME_T
#define _TIME_T
typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
Expand Down
10 changes: 5 additions & 5 deletions lib/minix/include/unistd.h → plat/minix/include/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#ifndef _UNISTD_H
#define _UNISTD_H

#include <stddef.h>
#include <sys/types.h>

extern char** environ;

/* Values used by access(). POSIX Table 2-6. */
#define F_OK 0 /* test if file exists */
#define X_OK 1 /* test if file is executable */
Expand All @@ -22,9 +27,6 @@
#define STDOUT_FILENO 1 /* file descriptor for stdout */
#define STDERR_FILENO 2 /* file descriptor for stderr */

/* NULL must be defined in <unistd.h> according to POSIX Sec. 2.8.1. */
#define NULL ((void *)0)

/* The following relate to configurable system variables. POSIX Table 4-2. */
#define _SC_ARG_MAX 1
#define _SC_CHILD_MAX 2
Expand Down Expand Up @@ -112,7 +114,6 @@ _PROTOTYPE( char *ttyname, (int _fd) );
_PROTOTYPE( int unlink, (const char *_path) );
_PROTOTYPE( int write, (int _fd, char *_buf, unsigned int _n) );

#ifdef _MINIX
_PROTOTYPE( char *brk, (char *_addr) );
_PROTOTYPE( int mknod, (const char *_name, int _mode, int _addr) );
_PROTOTYPE( int mknod4, (const char *_name, int _mode, int _addr,
Expand All @@ -125,6 +126,5 @@ _PROTOTYPE( long ptrace, (int _req, int _pid, long _addr, long _data) );
_PROTOTYPE( int stime, (long *top) );
_PROTOTYPE( int sync, (void) );
_PROTOTYPE( int umount, (const char *_name) );
#endif

#endif /* _UNISTD_H */
File renamed without changes.
6 changes: 0 additions & 6 deletions plat/minix68k/Action

This file was deleted.

Loading

0 comments on commit 11cdf8b

Please sign in to comment.