New installation mechanism, updated to minix 1.5
This commit is contained in:
		
							parent
							
								
									fc1615334c
								
							
						
					
					
						commit
						8818aec10e
					
				
					 122 changed files with 1717 additions and 59 deletions
				
			
		|  | @ -1,4 +1,5 @@ | |||
| #include <lib.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC void _exit(status) | ||||
| int status; | ||||
|  |  | |||
|  | @ -1,7 +1,3 @@ | |||
| LIST | ||||
| Makefile | ||||
| compmodule | ||||
| head_em.s | ||||
| lib.h | ||||
| libsys_s.a | ||||
| end.s | ||||
| libmon_s.a | ||||
|  |  | |||
|  | @ -1,57 +1,123 @@ | |||
| libsys_s.a | ||||
| stty.c | ||||
| gtty.c | ||||
| access.c | ||||
| alarm.c | ||||
| brk.c | ||||
| call.c | ||||
| chdir.c | ||||
| chmod.c | ||||
| chown.c | ||||
| chroot.c | ||||
| close.c | ||||
| creat.c | ||||
| dup.c | ||||
| dup2.c | ||||
| exec.c | ||||
| exit.c | ||||
| libmon_s.a | ||||
| access.s | ||||
| alarm.s | ||||
| brk.s | ||||
| chdir.s | ||||
| chmod.s | ||||
| chown.s | ||||
| chroot.s | ||||
| close.s | ||||
| creat.s | ||||
| dup.s | ||||
| dup2.s | ||||
| exec.s | ||||
| execn.s | ||||
| execnl.s | ||||
| fcntl.s | ||||
| fork.s | ||||
| fstat.s | ||||
| getcwd.s | ||||
| getegid.s | ||||
| geteuid.s | ||||
| getgid.s | ||||
| getpid.s | ||||
| getppid.s | ||||
| getuid.s | ||||
| gtty.s | ||||
| ioctl.s | ||||
| kill.s | ||||
| link.s | ||||
| lseek.s | ||||
| mkdir.s | ||||
| mkfifo.s | ||||
| mknod.s | ||||
| mknod4.s | ||||
| mktemp.s | ||||
| mount.s | ||||
| open.s | ||||
| pause.s | ||||
| pipe.s | ||||
| ptrace.s | ||||
| read.s | ||||
| rename.s | ||||
| rmdir.s | ||||
| setgid.s | ||||
| setuid.s | ||||
| signal.s | ||||
| stat.s | ||||
| stime.s | ||||
| stty.s | ||||
| sync.s | ||||
| time.s | ||||
| times.s | ||||
| umask.s | ||||
| umount.s | ||||
| unlink.s | ||||
| utime.s | ||||
| wait.s | ||||
| write.s | ||||
| _exit.c | ||||
| cleanup.c | ||||
| fork.c | ||||
| fstat.c | ||||
| getegid.c | ||||
| geteuid.c | ||||
| getgid.c | ||||
| getpid.c | ||||
| getuid.c | ||||
| ioctl.c | ||||
| kill.c | ||||
| link.c | ||||
| lseek.c | ||||
| _access.c | ||||
| _alarm.c | ||||
| _brk.c | ||||
| call.c | ||||
| _chdir.c | ||||
| _chmod.c | ||||
| _chown.c | ||||
| _chroot.c | ||||
| _close.c | ||||
| _creat.c | ||||
| _dup.c | ||||
| _dup2.c | ||||
| _exec.c | ||||
| _execn.c | ||||
| _execnl.c | ||||
| _fcntl.c | ||||
| _fork.c | ||||
| fpathconf.c | ||||
| _fstat.c | ||||
| _getcwd.c | ||||
| _getegid.c | ||||
| _geteuid.c | ||||
| _getgid.c | ||||
| _getpid.c | ||||
| _getppid.c | ||||
| _getuid.c | ||||
| _gtty.c | ||||
| _ioctl.c | ||||
| _kill.c | ||||
| _link.c | ||||
| _lseek.c | ||||
| message.c | ||||
| mknod.c | ||||
| mktemp.c | ||||
| mount.c | ||||
| open.c | ||||
| pause.c | ||||
| pipe.c | ||||
| read.c | ||||
| setgid.c | ||||
| setuid.c | ||||
| signal.c | ||||
| stat.c | ||||
| stderr.c | ||||
| stime.c | ||||
| sync.c | ||||
| _mkdir.c | ||||
| _mkfifo.c | ||||
| _mknod.c | ||||
| _mknod4.c | ||||
| _mktemp.c | ||||
| _mount.c | ||||
| _open.c | ||||
| pathconf.c | ||||
| _pause.c | ||||
| _pipe.c | ||||
| _ptrace.c | ||||
| _read.c | ||||
| _rename.c | ||||
| _rmdir.c | ||||
| _setgid.c | ||||
| _setuid.c | ||||
| _signal.c | ||||
| _stat.c | ||||
| _stime.c | ||||
| _stty.c | ||||
| _sync.c | ||||
| syslib.c | ||||
| time.c | ||||
| times.c | ||||
| umask.c | ||||
| umount.c | ||||
| unlink.c | ||||
| utime.c | ||||
| wait.c | ||||
| write.c | ||||
| stbrksz.s | ||||
| stsndrec.s | ||||
| stcatch.s | ||||
| _time.c | ||||
| _times.c | ||||
| _umask.c | ||||
| _umount.c | ||||
| _unlink.c | ||||
| _utime.c | ||||
| _wait.c | ||||
| _write.c | ||||
| vectab.c | ||||
| errno.c | ||||
|  |  | |||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_access.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_access.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define access	_access | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int access(name, mode) | ||||
| char *name; | ||||
| int mode; | ||||
| { | ||||
|   return(_callm3(FS, ACCESS, mode, name)); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_alarm.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_alarm.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #define alarm	_alarm | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC unsigned int alarm(sec) | ||||
| unsigned int sec; | ||||
| { | ||||
|   return(_callm1(MM, ALARM, (int) sec, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										33
									
								
								mach/minixST/libsys/_brk.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								mach/minixST/libsys/_brk.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | |||
| #include <lib.h> | ||||
| #define brk	_brk | ||||
| #define sbrk	_sbrk | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| extern char *_brksize; | ||||
| 
 | ||||
| PUBLIC char *brk(addr) | ||||
| char *addr; | ||||
| { | ||||
|   if (_callm1(MM, BRK, 0, 0, 0, addr, NIL_PTR, NIL_PTR) == 0) { | ||||
| 	_brksize = _M.m2_p1; | ||||
| 	return(NIL_PTR); | ||||
|   } else { | ||||
| 	return((char *) -1); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| PUBLIC char *sbrk(incr) | ||||
| int incr; | ||||
| { | ||||
|   char *newsize, *oldsize; | ||||
| 
 | ||||
|   oldsize = _brksize; | ||||
|   newsize = _brksize + incr; | ||||
|   if (incr > 0 && newsize < oldsize || incr < 0 && newsize > oldsize) | ||||
| 	return((char *) -1); | ||||
|   if (_brk(newsize) == 0) | ||||
| 	return(oldsize); | ||||
|   else | ||||
| 	return((char *) -1); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_chdir.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_chdir.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #define chdir	_chdir | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int chdir(name) | ||||
| char *name; | ||||
| { | ||||
|   return(_callm3(FS, CHDIR, 0, name)); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_chmod.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_chmod.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define chmod	_chmod | ||||
| #include <sys/stat.h> | ||||
| 
 | ||||
| PUBLIC int chmod(name, mode) | ||||
| _CONST char *name; | ||||
| mode_t mode; | ||||
| { | ||||
|   return(_callm3(FS, CHMOD, mode, name)); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_chown.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_chown.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define chown	_chown | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int chown(name, owner, grp) | ||||
| char *name; | ||||
| int owner, grp; | ||||
| { | ||||
|   return(_callm1(FS, CHOWN, _len(name), owner, grp, name, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_chroot.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_chroot.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #define chroot	_chroot | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int chroot(name) | ||||
| _CONST char *name; | ||||
| { | ||||
|   return(_callm3(FS, CHROOT, 0, name)); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_close.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_close.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #define close	_close | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int close(fd) | ||||
| int fd; | ||||
| { | ||||
|   return(_callm1(FS, CLOSE, fd, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_creat.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_creat.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define creat	_creat | ||||
| #include <fcntl.h> | ||||
| 
 | ||||
| PUBLIC int creat(name, mode) | ||||
| _CONST char *name; | ||||
| mode_t mode; | ||||
| { | ||||
|   return(_callm3(FS, CREAT, mode, name)); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_dup.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_dup.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define dup	_dup | ||||
| #include <unistd.h> | ||||
| #include <fcntl.h> | ||||
| 
 | ||||
| PUBLIC int dup(fd) | ||||
| int fd; | ||||
| { | ||||
|   return(fcntl(fd, F_DUPFD, 0)); | ||||
| } | ||||
							
								
								
									
										30
									
								
								mach/minixST/libsys/_dup2.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								mach/minixST/libsys/_dup2.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| #include <lib.h> | ||||
| #define dup2     _dup2 | ||||
| #include <unistd.h> | ||||
| #include <fcntl.h> | ||||
| #include <limits.h> | ||||
| #include <errno.h> | ||||
| 
 | ||||
| PUBLIC int dup2(fd, fd2) | ||||
| int fd, fd2; | ||||
| { | ||||
| /* The behavior of dup2 is defined by POSIX in 6.2.1.2 as almost, but not
 | ||||
|  * quite the same as fcntl. | ||||
|  */ | ||||
| 
 | ||||
|   if (fd2 < 0 || fd2 > OPEN_MAX) { | ||||
| 	errno = EBADF; | ||||
| 	return(-1); | ||||
|   } | ||||
| 
 | ||||
|   /* Check to see if fildes is valid. */ | ||||
|   if (fcntl(fd, F_GETFL) < 0) { | ||||
| 	/* fd is not valid. */ | ||||
| 	return(-1); | ||||
|   } else { | ||||
| 	/* fd is valid. */ | ||||
| 	if (fd == fd2) return(fd2); | ||||
| 	close(fd2); | ||||
| 	return(fcntl(fd, F_DUPFD, fd2)); | ||||
|   } | ||||
| } | ||||
							
								
								
									
										169
									
								
								mach/minixST/libsys/_exec.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										169
									
								
								mach/minixST/libsys/_exec.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,169 @@ | |||
| #include <lib.h> | ||||
| #include <string.h> | ||||
| #define execl	_execl | ||||
| #define execle	_execle | ||||
| #define execv	_execv | ||||
| #define execve	_execve | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| extern char **environ;		/* environment pointer */ | ||||
| 
 | ||||
| #define	PTRSIZE	(sizeof(char *)) | ||||
| _PROTOTYPE( char *_sbrk, (int _incr)					); | ||||
| 
 | ||||
| #if _ANSI | ||||
| #include	<stdarg.h> | ||||
| 
 | ||||
| PUBLIC int execl(char *name, ...) | ||||
| { | ||||
| 	int retval; | ||||
| 	va_list ap; | ||||
| 
 | ||||
| 	va_start(ap, name); | ||||
| 	retval = execve(name, (char **)ap, environ); | ||||
| 	va_end(ap); | ||||
| 	return retval; | ||||
| } | ||||
| #else | ||||
| PUBLIC int execl(name, arg0) | ||||
| char *name; | ||||
| char *arg0; | ||||
| { | ||||
|   return(execve(name, &arg0, environ)); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| #if _ANSI | ||||
| PUBLIC int execle(char *name, ...) | ||||
| { | ||||
| 	int retval; | ||||
| 	va_list ap; | ||||
| 	char *p; | ||||
| 
 | ||||
| 	va_start(ap, name); | ||||
| 	do { | ||||
| 	    p = va_arg(ap, char *); | ||||
| 	} while(p); | ||||
| 	p = (char *)va_arg(ap, char **); | ||||
| 	va_end(ap); | ||||
| 	va_start(ap, name); | ||||
| 	retval = execve(name, (char **)ap, (char **) p); | ||||
| 	va_end(ap); | ||||
| 	return retval; | ||||
| } | ||||
| #else | ||||
| PUBLIC int execle(name, argv) | ||||
| char *name, *argv; | ||||
| { | ||||
|   char **p; | ||||
|   p = (char **) &argv; | ||||
|   while (*p++)			/* null statement */ | ||||
| 	; | ||||
|   return(execve(name, &argv, (char **) *p)); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| PUBLIC int execv(name, argv) | ||||
| char *name, *argv[]; | ||||
| { | ||||
| 
 | ||||
|   return(execve(name, argv, environ)); | ||||
| } | ||||
| 
 | ||||
| PUBLIC int execve(path, argv, envp) | ||||
| char *path;			/* pointer to name of file to be executed */ | ||||
| char *argv[];			/* pointer to argument array */ | ||||
| char *envp[];			/* pointer to environment */ | ||||
| { | ||||
|   register char **argtop; | ||||
|   register char **envtop; | ||||
| 
 | ||||
| 	/* Count the argument pointers and environment pointers. */ | ||||
|   for (argtop = argv; *argtop != (char *) NULL; ) argtop++; | ||||
|   for (envtop = envp; *envtop != (char *) NULL; ) envtop++; | ||||
|   return(__execve(path, argv, envp, (int)(argtop - argv), (int)(envtop - envp))); | ||||
| } | ||||
| 
 | ||||
| PUBLIC int __execve(path, argv, envp, nargs, nenvps) | ||||
| char *path;			/* pointer to name of file to be executed */ | ||||
| char *argv[];			/* pointer to argument array */ | ||||
| char *envp[];			/* pointer to environment */ | ||||
| int nargs;			/* number of args */ | ||||
| int nenvps;			/* number of environment strings */ | ||||
| { | ||||
| /* This is split off from execve to be called from execvp, so execvp does not
 | ||||
|  * have to allocate up to ARG_MAX bytes just to prepend "sh" to the arg array. | ||||
|  */ | ||||
| 
 | ||||
|   char *hp, **ap, *p; | ||||
|   int i, stackbytes, npointers, overflow, temp; | ||||
|   char *stack; | ||||
|   /* Decide how big a stack is needed. Be paranoid about overflow. */ | ||||
| #if ARG_MAX > INT_MAX | ||||
| #error /* overflow checks and sbrk depend on sizes being ints */ | ||||
| #endif | ||||
|   overflow = FALSE; | ||||
|   npointers = 1 + nargs + 1 + nenvps + 1;	/* 1's for argc and NULLs */ | ||||
|   stackbytes = 0;	/* changed because _len is used now */ | ||||
|   if (nargs < 0 || nenvps < 0 || nargs+nenvps < 0 || npointers < 0) | ||||
| 	overflow = TRUE; | ||||
|   for (i = PTRSIZE; i != 0; i--) { | ||||
| 	temp = stackbytes + npointers; | ||||
| 	if (temp < stackbytes) overflow = TRUE; | ||||
| 	stackbytes = temp; | ||||
|   } | ||||
|   for (i = 0, ap = argv; i < nargs; i++) { | ||||
| 	temp = stackbytes + _len(*ap++); | ||||
| 	if (temp < stackbytes) overflow = TRUE; | ||||
| 	stackbytes = temp; | ||||
|   } | ||||
|   for (i = 0, ap = envp; i < nenvps; i++) { | ||||
| 	temp = stackbytes + _len(*ap++); | ||||
| 	if (temp < stackbytes) overflow = TRUE; | ||||
| 	stackbytes = temp; | ||||
|   } | ||||
|   temp = stackbytes + PTRSIZE - 1; | ||||
|   if (temp < stackbytes) overflow = TRUE; | ||||
|   stackbytes = (temp / PTRSIZE) * PTRSIZE; | ||||
| 
 | ||||
|   /* Check for overflow before committing sbrk. */ | ||||
|   if (overflow || stackbytes > ARG_MAX) { | ||||
| 	errno = E2BIG; | ||||
| 	return(-1); | ||||
|   } | ||||
| 
 | ||||
|   /* Allocate the stack. */ | ||||
|   stack = _sbrk(stackbytes); | ||||
|   if (stack == (char *) -1) { | ||||
| 	errno = E2BIG; | ||||
| 	return(-1); | ||||
|   } | ||||
| 
 | ||||
|   /* Prepare the stack vector and argc. */ | ||||
|   ap = (char **) stack; | ||||
|   hp = &stack[npointers * PTRSIZE]; | ||||
|   *ap++ = (char *) nargs; | ||||
| 
 | ||||
|   /* Prepare the argument pointers and strings. */ | ||||
|   for (i = 0; i < nargs; i++) { | ||||
| 	*ap++ = (char *) (hp - stack); | ||||
| 	p = *argv++; | ||||
| 	while ((*hp++ = *p++) != 0) | ||||
| 		; | ||||
|   } | ||||
|   *ap++ = (char *) NULL; | ||||
| 
 | ||||
|   /* Prepare the environment pointers and strings. */ | ||||
|   for (i = 0; i < nenvps; i++) { | ||||
| 	*ap++ = (char *) (hp - stack); | ||||
| 	p = *envp++; | ||||
| 	while ((*hp++ = *p++) != 0) | ||||
| 		; | ||||
|   } | ||||
|   *ap++ = (char *) NULL; | ||||
| 
 | ||||
|   /* Do the real work. */ | ||||
|   temp = _callm1(MM, EXEC, _len(path), stackbytes, 0, path, stack, NIL_PTR); | ||||
|   _sbrk(-stackbytes); | ||||
|   return(temp); | ||||
| } | ||||
							
								
								
									
										16
									
								
								mach/minixST/libsys/_execn.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								mach/minixST/libsys/_execn.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| #include <lib.h> | ||||
| 
 | ||||
| #define	PTRSIZE	sizeof(char *) | ||||
| _PROTOTYPE( int _execn, (char * name)); | ||||
| 
 | ||||
| PUBLIC int _execn(name) | ||||
| char *name;			/* pointer to file to be exec'd */ | ||||
| { | ||||
| /* Special version used when there are no args and no environment.  This call
 | ||||
|  * is principally used by INIT, to avoid having to allocate ARG_MAX. | ||||
|  */ | ||||
| 
 | ||||
|   PRIVATE char stack[3 * PTRSIZE]; | ||||
| 
 | ||||
|   return(_callm1(MM, EXEC, _len(name), sizeof(stack), 0, name, stack, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										76
									
								
								mach/minixST/libsys/_execnl.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								mach/minixST/libsys/_execnl.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,76 @@ | |||
| /*
 | ||||
|  * This file contains two functions that can be used to perform | ||||
|  * an EXEC call without the need for a "big" stack of MAX_ARG | ||||
|  * bytes.  It is primarily used by the INIT module of the system. | ||||
|  */ | ||||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| #define MAXSTK	256		/* maximum EXEC stack size */ | ||||
| #define	PTRSIZE	sizeof(char *) | ||||
| 
 | ||||
| _PROTOTYPE(int _execn,(char *name)); | ||||
| _PROTOTYPE(int _execnl,(char *name, char *arg0)); | ||||
| PRIVATE _PROTOTYPE(int _nexec,(char *name, char *argv[])); | ||||
| 
 | ||||
| PUBLIC int _execn(name) | ||||
| char *name;			/* pointer to file to be exec'd */ | ||||
| { | ||||
| /* This funcion uses no arguments at all. */ | ||||
|   PRIVATE char stack[3 * PTRSIZE]; | ||||
| 
 | ||||
|   return(_callm1(MM, EXEC, _len(name), sizeof(stack), 0, name, stack, NIL_PTR)); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| PUBLIC int _execnl(name, arg0) | ||||
| char *name; | ||||
| char *arg0; | ||||
| { | ||||
|   /* This function resembles execl(2). */ | ||||
| 
 | ||||
|   return(_nexec(name, &arg0)); | ||||
| } | ||||
| 
 | ||||
| PRIVATE int _nexec(name, argv) | ||||
| char *name;			/* pointer to name of file to be executed */ | ||||
| char *argv[];			/* pointer to argument array */ | ||||
| { | ||||
|   char stack[MAXSTK]; | ||||
|   char **argorg, *hp, **ap, *p; | ||||
|   int i, nargs, stackbytes, offset; | ||||
| 
 | ||||
|   /* Count the argument pointers. */ | ||||
|   nargs = 0; | ||||
|   argorg = argv; | ||||
|   while (*argorg++ != NIL_PTR) nargs++; | ||||
| 
 | ||||
|   /* Prepare to set up the initial stack. */ | ||||
|   hp = &stack[(nargs + 3) * PTRSIZE]; | ||||
|   if (hp + nargs >= &stack[MAXSTK]) { | ||||
| 	errno = E2BIG; | ||||
| 	return(-1); | ||||
|   } | ||||
|   ap = (char **) stack; | ||||
|   *ap++ = (char *) nargs; | ||||
| 
 | ||||
|   /* Prepare the argument pointers and strings. */ | ||||
|   for (i = 0; i < nargs; i++) { | ||||
| 	offset = hp - stack; | ||||
| 	*ap++ = (char *) offset; | ||||
| 	p = *argv++; | ||||
| 	while (*p) { | ||||
| 		*hp++ = *p++; | ||||
| 		if (hp >= &stack[MAXSTK]) { | ||||
| 			errno = E2BIG; | ||||
| 			return(-1); | ||||
| 		} | ||||
| 	} | ||||
| 	*hp++ = (char) 0; | ||||
|   } | ||||
|   *ap++ = NIL_PTR; | ||||
| 
 | ||||
|   stackbytes = (((int) (hp - stack) + PTRSIZE - 1) / PTRSIZE) * PTRSIZE; | ||||
|   return(_callm1(MM, EXEC, _len(name), stackbytes, 0, name, stack, NIL_PTR)); | ||||
| } | ||||
|  | @ -1,4 +1,5 @@ | |||
| #include <lib.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC void _exit(status) | ||||
| int status; | ||||
|  |  | |||
							
								
								
									
										43
									
								
								mach/minixST/libsys/_fcntl.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								mach/minixST/libsys/_fcntl.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,43 @@ | |||
| #include <lib.h> | ||||
| #define fcntl _fcntl | ||||
| #include <fcntl.h> | ||||
| #include <stdarg.h> | ||||
| 
 | ||||
| #if _ANSI | ||||
| PUBLIC int fcntl(int fd, int cmd, ...) | ||||
| #else | ||||
| PUBLIC int fcntl(fd, cmd) | ||||
| int fd; | ||||
| int cmd; | ||||
| #endif | ||||
| { | ||||
|   va_list argp; | ||||
|   int int3;			/* third integer parameter for callm1 */ | ||||
|   char *ptr1;			/* first pointer parameter for callm1 */ | ||||
| 
 | ||||
|   va_start(argp, cmd); | ||||
| 
 | ||||
|   /* Set up for the sensible case where there is no variable parameter.  This
 | ||||
|    * covers F_GETFD, F_GETFL and invalid commands. | ||||
|    */ | ||||
|   int3 = 0; | ||||
|   ptr1 = NIL_PTR; | ||||
| 
 | ||||
|   /* Adjust for the stupid cases. */ | ||||
|   switch(cmd) { | ||||
|      case F_DUPFD: | ||||
|      case F_SETFD: | ||||
|      case F_SETFL: | ||||
| 	int3 = va_arg(argp, int); | ||||
| 	break; | ||||
|      case F_GETLK: | ||||
|      case F_SETLK: | ||||
|      case F_SETLKW: | ||||
| 	ptr1 = (char *) va_arg(argp, struct flock *); | ||||
| 	break; | ||||
|   } | ||||
| 
 | ||||
|   /* Clean up and make the system call. */   | ||||
|   va_end(argp);	 | ||||
|   return(_callm1(FS, FCNTL, fd, cmd, int3, ptr1, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										8
									
								
								mach/minixST/libsys/_fork.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/minixST/libsys/_fork.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #include <lib.h> | ||||
| #define fork	_fork | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int fork() | ||||
| { | ||||
|   return(_callm1(MM, FORK, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_fstat.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_fstat.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define fstat	_fstat | ||||
| #include <sys/stat.h> | ||||
| 
 | ||||
| PUBLIC int fstat(fd, buffer) | ||||
| int fd; | ||||
| struct stat *buffer; | ||||
| { | ||||
|   return(_callm1(FS, FSTAT, fd, 0, 0, (char *)buffer, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										121
									
								
								mach/minixST/libsys/_getcwd.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								mach/minixST/libsys/_getcwd.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,121 @@ | |||
| /*  getcwd - get current working directory	Author: Terrence W. Holm */ | ||||
| 
 | ||||
| /* Directly derived from Adri Koppes' pwd(1).
 | ||||
|  * Modified by Andy Tanenbaum for POSIX (29 Oct. 1989) | ||||
|  */ | ||||
| 
 | ||||
| #include <lib.h> | ||||
| #include <sys/stat.h> | ||||
| #include <fcntl.h> | ||||
| #include <sys/dir.h> | ||||
| #define getcwd	_getcwd | ||||
| #include <unistd.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| #define  DIRECT_SIZE  (sizeof (struct direct)) | ||||
| 
 | ||||
| PRIVATE _PROTOTYPE(void,  go_back(char *path) ); | ||||
| 
 | ||||
| char *getcwd(buffer, size) | ||||
| char *buffer; | ||||
| int size; | ||||
| /* Get current working directory. */ | ||||
| { | ||||
|   int same_device, found, fd; | ||||
|   char *r, path[PATH_MAX + 1], temp_name[NAME_MAX + 1]; | ||||
|   struct stat current, parent, dir_entry; | ||||
|   struct direct d; | ||||
| 
 | ||||
|   if (buffer == (char *)NULL || size <= 0) { | ||||
| 	errno = EINVAL; | ||||
| 	return((char *)NULL); | ||||
|   } | ||||
|   path[0] = '\0'; | ||||
| 
 | ||||
|   /* Get the inode for the current directory  */ | ||||
|   if (stat(".", ¤t) == -1) return((char *)NULL); | ||||
|   if ((current.st_mode & S_IFMT) != S_IFDIR) return((char *)NULL); | ||||
| 
 | ||||
|   /* Run backwards up the directory tree, grabbing dir names on the way. */ | ||||
|   while (1) { | ||||
| 	same_device = 0; | ||||
| 	found = 0; | ||||
| 
 | ||||
| 	/* Get the inode for the parent directory  */ | ||||
| 	if (chdir("..") == -1) return((char *)NULL); | ||||
| 	if (stat(".", &parent) == -1) return((char *)NULL); | ||||
| 	if ((parent.st_mode & S_IFMT) != S_IFDIR) return((char *)NULL); | ||||
| 	if (current.st_dev == parent.st_dev) same_device = 1; | ||||
| 
 | ||||
| 	/* At the root, "." is the same as ".."  */ | ||||
| 	if (same_device && current.st_ino == parent.st_ino) break; | ||||
| 
 | ||||
| 	/* Search the parent directory for the current entry  */ | ||||
| 	if ((fd = open(".", O_RDONLY)) == -1) return((char *)NULL); | ||||
| 	while (!found && read(fd, (char *)&d, DIRECT_SIZE) == DIRECT_SIZE) { | ||||
| 		if (d.d_ino == 0L) continue;	/* empty slot */ | ||||
| 		if (same_device) { | ||||
| 			if (current.st_ino == d.d_ino) found = 1; | ||||
| 		} else { | ||||
| 			temp_name[0] = '\0'; | ||||
| 			strncat(temp_name, d.d_name, NAME_MAX); | ||||
| 			if (stat(temp_name, &dir_entry) == -1) { | ||||
| 				close(fd); | ||||
| 				go_back(path); | ||||
| 				return((char *)NULL); | ||||
| 			} | ||||
| 			if (current.st_dev == dir_entry.st_dev && | ||||
| 			    current.st_ino == dir_entry.st_ino) | ||||
| 				found = 1; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	close(fd); | ||||
| 	if (!found) { | ||||
| 		go_back(path); | ||||
| 		return((char *)NULL); | ||||
| 	} | ||||
| 	if (strlen(path) + NAME_MAX + 1 > PATH_MAX) { | ||||
| 		errno = ERANGE; | ||||
| 		go_back(path); | ||||
| 		return((char *)NULL); | ||||
| 	} | ||||
| 	strcat(path, "/"); | ||||
| 	strncat(path, d.d_name, NAME_MAX); | ||||
| 	current.st_dev = parent.st_dev; | ||||
| 	current.st_ino = parent.st_ino; | ||||
|   } | ||||
| 
 | ||||
|   /* Copy the reversed path name into <buffer>  */ | ||||
|   if (strlen(path) + 1 > size) { | ||||
| 	errno = ERANGE; | ||||
| 	go_back(path); | ||||
| 	return((char *)NULL); | ||||
|   } | ||||
|   if (strlen(path) == 0) { | ||||
| 	strcpy(buffer, "/"); | ||||
| 	return(buffer); | ||||
|   } | ||||
|   *buffer = '\0'; | ||||
|   while ((r = strrchr(path, '/')) != (char *)NULL) { | ||||
| 	strcat(buffer, r); | ||||
| 	*r = '\0'; | ||||
|   } | ||||
|   return(chdir(buffer) ? (char *)NULL : buffer); | ||||
| } | ||||
| 
 | ||||
| PRIVATE void go_back(path) | ||||
| char *path; | ||||
| { | ||||
| /* If getcwd() gets in trouble and can't complete normally, reverse the
 | ||||
|  * path built so far and change there so we end up in the directory that | ||||
|  * we started in. | ||||
|  */ | ||||
| 
 | ||||
|   char *r; | ||||
| 
 | ||||
|   while ((r = strrchr(path, '/')) != (char *)NULL) { | ||||
| 	chdir(r+1); | ||||
| 	*r = '\0'; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										12
									
								
								mach/minixST/libsys/_getegid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								mach/minixST/libsys/_getegid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define getegid	_getegid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC gid_t getegid() | ||||
| { | ||||
|   int k; | ||||
|   k = _callm1(MM, GETGID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); | ||||
|   if (k < 0) return((gid_t) k); | ||||
|   return((gid_t) _M.m2_i1); | ||||
| } | ||||
							
								
								
									
										12
									
								
								mach/minixST/libsys/_geteuid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								mach/minixST/libsys/_geteuid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define geteuid	_geteuid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC uid_t geteuid() | ||||
| { | ||||
|   int k; | ||||
|   k = _callm1(MM, GETUID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); | ||||
|   if (k < 0) return((uid_t) k); | ||||
|   return((uid_t) _M.m2_i1); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_getgid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_getgid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define getgid	_getgid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC gid_t getgid() | ||||
| { | ||||
|   return((gid_t)_callm1(MM, GETGID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										8
									
								
								mach/minixST/libsys/_getpid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/minixST/libsys/_getpid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #include <lib.h> | ||||
| #define getpid	_getpid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int getpid() | ||||
| { | ||||
|   return(_callm1(MM, GETPID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										12
									
								
								mach/minixST/libsys/_getppid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								mach/minixST/libsys/_getppid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| #include <lib.h> | ||||
| #define getppid	_getppid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int getppid() | ||||
| { | ||||
|   int p; | ||||
| 
 | ||||
|   p = _callm1(MM, GETPID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); | ||||
|   if (p < 0) return(p); | ||||
|   return(_M.m2_i1); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_getuid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_getuid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define getuid	_getuid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC uid_t getuid() | ||||
| { | ||||
|   return((uid_t)_callm1(MM, GETUID, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_gtty.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_gtty.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define gtty	_gtty | ||||
| #define ioctl	_ioctl | ||||
| #include <sgtty.h> | ||||
| 
 | ||||
| PUBLIC int gtty(fd, argp) | ||||
| int fd; | ||||
| struct sgttyb *argp; | ||||
| { | ||||
|   return(ioctl(fd, TIOCGETP, argp)); | ||||
| } | ||||
							
								
								
									
										77
									
								
								mach/minixST/libsys/_ioctl.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								mach/minixST/libsys/_ioctl.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,77 @@ | |||
| #include <lib.h> | ||||
| #include <minix/com.h> | ||||
| #define ioctl	_ioctl | ||||
| #include <sgtty.h> | ||||
| 
 | ||||
| PUBLIC int ioctl(fd, request, argp) | ||||
| int fd; | ||||
| int request; | ||||
| struct sgttyb *argp; | ||||
| { | ||||
|   int n; | ||||
|   long erase, kill, intr, quit, xon, xoff, eof, brk, speed; | ||||
|   struct tchars *argt; | ||||
| 
 | ||||
|   _M.TTY_REQUEST = request; | ||||
|   _M.TTY_LINE = fd; | ||||
| 
 | ||||
|   switch(request) { | ||||
|      case TIOCSETP: | ||||
| 	erase = argp->sg_erase & BYTE; | ||||
| 	kill = argp->sg_kill & BYTE; | ||||
| 	speed = ((argp->sg_ospeed & BYTE) << 8) | (argp->sg_ispeed & BYTE); | ||||
| 	_M.TTY_SPEK = (speed << 16) | (erase << 8) | kill; | ||||
| 	_M.TTY_FLAGS = argp->sg_flags; | ||||
| 	n = _callx(FS, IOCTL); | ||||
|   	return(n); | ||||
|   | ||||
|      case TIOCSETC: | ||||
| 	argt = (struct tchars * /* kludge */) argp; | ||||
|   	intr = argt->t_intrc & BYTE; | ||||
|   	quit = argt->t_quitc & BYTE; | ||||
|   	xon  = argt->t_startc & BYTE; | ||||
|   	xoff = argt->t_stopc & BYTE; | ||||
|   	eof  = argt->t_eofc & BYTE; | ||||
|   	brk  = argt->t_brkc & BYTE;		/* not used at the moment */ | ||||
|   	_M.TTY_SPEK = (intr<<24) | (quit<<16) | (xon<<8) | (xoff<<0); | ||||
|   	_M.TTY_FLAGS = (eof<<8) | (brk<<0); | ||||
|   	n = _callx(FS, IOCTL); | ||||
|   	return(n); | ||||
|   	 | ||||
|      case TIOCGETP: | ||||
|   	n = _callx(FS, IOCTL); | ||||
| 	argp->sg_erase = (_M.TTY_SPEK >> 8) & BYTE; | ||||
| 	argp->sg_kill  = (_M.TTY_SPEK >> 0) & BYTE; | ||||
|   	argp->sg_flags = _M.TTY_FLAGS & 0xFFFFL; | ||||
| 	speed = (_M.TTY_SPEK >> 16) & 0xFFFFL; | ||||
| 	argp->sg_ispeed = speed & BYTE; | ||||
| 	argp->sg_ospeed = (speed >> 8) & BYTE; | ||||
|   	return(n); | ||||
| 
 | ||||
|      case TIOCGETC: | ||||
|   	n = _callx(FS, IOCTL); | ||||
| 	argt = (struct tchars *) argp; | ||||
|   	argt->t_intrc  = (_M.TTY_SPEK >> 24) & BYTE; | ||||
|   	argt->t_quitc  = (_M.TTY_SPEK >> 16) & BYTE; | ||||
|   	argt->t_startc = (_M.TTY_SPEK >>  8) & BYTE; | ||||
|   	argt->t_stopc  = (_M.TTY_SPEK >>  0) & BYTE; | ||||
|   	argt->t_eofc   = (_M.TTY_FLAGS >> 8) & BYTE; | ||||
|   	argt->t_brkc   = (_M.TTY_FLAGS >> 8) & BYTE; | ||||
|   	return(n); | ||||
| 
 | ||||
| /* This is silly, do we want to add 1001 cases and _M.TTY_XYZ's here?
 | ||||
|  * We should just pop argp into the message for low-level interpretation. | ||||
|  */ | ||||
| 
 | ||||
|      case TIOCFLUSH: | ||||
| 	_M.TTY_FLAGS = (int /* kludge */) argp; | ||||
| 	return _callx(FS, IOCTL); | ||||
| 
 | ||||
| /* decided to pop argp in the ADDRESS field. Left TIOCFLUSH a special case
 | ||||
|  * since it affects other platforms and old software too. FM | ||||
|  */ | ||||
|      default: | ||||
| 	_M.ADDRESS = (char *)argp; | ||||
| 	return _callx(FS, IOCTL); | ||||
|   } | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_kill.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_kill.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define kill	_kill | ||||
| #include <signal.h> | ||||
| 
 | ||||
| PUBLIC int kill(proc, sig) | ||||
| int proc;			/* which process is to be sent the signal */ | ||||
| int sig;			/* signal number */ | ||||
| { | ||||
|   return(_callm1(MM, KILL, proc, sig, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_link.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_link.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define link	_link | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int link(name, name2) | ||||
| _CONST char *name, *name2; | ||||
| { | ||||
|   return(_callm1(FS, LINK, _len(name), _len(name2), 0, | ||||
| 	 (char *) name, (char *) name2,	/* perhaps callm1 preserves these */ | ||||
| 	 NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										18
									
								
								mach/minixST/libsys/_lseek.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								mach/minixST/libsys/_lseek.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define lseek	_lseek | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC off_t lseek(fd, offset, whence) | ||||
| int fd; | ||||
| off_t offset; | ||||
| int whence; | ||||
| { | ||||
|   int k; | ||||
|   _M.m2_i1 = fd; | ||||
|   _M.m2_l1 = offset; | ||||
|   _M.m2_i2 = whence; | ||||
|   k = _callx(FS, LSEEK); | ||||
|   if (k != 0) return((off_t) k);	/* _send() itself failed */ | ||||
|   return((off_t)_M.m2_l1); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_mkdir.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_mkdir.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define mkdir	_mkdir | ||||
| #include <sys/stat.h> | ||||
| 
 | ||||
| PUBLIC int mkdir(name, mode) | ||||
| _CONST char *name; | ||||
| int mode; | ||||
| { | ||||
|   return(_callm1(FS, MKDIR, _len(name), mode, 0, (char *)name, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										13
									
								
								mach/minixST/libsys/_mkfifo.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								mach/minixST/libsys/_mkfifo.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define mkfifo	_mkfifo | ||||
| #include <sys/stat.h> | ||||
| 
 | ||||
| PUBLIC int mkfifo(name, mode) | ||||
| _CONST char *name; | ||||
| int mode; | ||||
| { | ||||
|   mode = (mode & 0777) | S_IFIFO; | ||||
|   return(_callm1(FS, MKNOD, _len(name), (int)mode, 0, | ||||
| 	 (char *)name, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_mknod.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_mknod.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define mknod	_mknod | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int mknod(name, mode, addr) | ||||
| _CONST char *name; | ||||
| int mode, addr; | ||||
| { | ||||
|   return(_callm1(FS, MKNOD, _len(name), mode, addr, | ||||
| 					(char *) name, (char *) 0, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										12
									
								
								mach/minixST/libsys/_mknod4.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								mach/minixST/libsys/_mknod4.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| #include <lib.h> | ||||
| #define mknod4	_mknod4 | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int mknod4(name, mode, addr, size) | ||||
| _CONST char *name; | ||||
| int mode, addr; | ||||
| unsigned int size; | ||||
| { | ||||
|   return(_callm1(FS, MKNOD, _len(name), mode, addr,  | ||||
| 				       (char *) name, (char *) size, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										31
									
								
								mach/minixST/libsys/_mktemp.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								mach/minixST/libsys/_mktemp.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | |||
| #include <lib.h> | ||||
| /* mktemp - make a name for a temporary file */ | ||||
| #include <sys/types.h> | ||||
| #define mktemp _mktemp | ||||
| #define getpid _getpid | ||||
| #define access _access | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC char *mktemp(char *template) | ||||
| { | ||||
|   register int pid, k; | ||||
|   register char *p; | ||||
| 
 | ||||
|   pid = getpid();		/* get process id as semi-unique number */ | ||||
|   p = template; | ||||
|   while (*p) p++;		/* find end of string */ | ||||
| 
 | ||||
|   /* Replace XXXXXX at end of template with pid. */ | ||||
|   while (*--p == 'X') { | ||||
| 	*p = '0' + (pid % 10); | ||||
| 	pid /= 10; | ||||
|   } | ||||
|   p++; | ||||
|   for (k = 'a'; k <= 'z'; k++) { | ||||
| 	*p = k; | ||||
| 	if (access(template, 0) < 0) { | ||||
| 		return template; | ||||
| 	} | ||||
|   } | ||||
|   return("/"); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_mount.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_mount.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define mount	_mount | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int mount(special, name, rwflag) | ||||
| char *name, *special; | ||||
| int rwflag; | ||||
| { | ||||
|   return(_callm1(FS, MOUNT, _len(special), _len(name), rwflag, special, name, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										34
									
								
								mach/minixST/libsys/_open.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								mach/minixST/libsys/_open.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define open	_open | ||||
| #include <fcntl.h> | ||||
| 
 | ||||
| #if _ANSI | ||||
| #include <stdarg.h> | ||||
| 
 | ||||
| PUBLIC int open(const char *name, int flags, ...) | ||||
| { | ||||
| 	int i; | ||||
| 	va_list ap; | ||||
| 
 | ||||
| 	if (flags & O_CREAT) { | ||||
| 		va_start(ap, flags); | ||||
| 		i = va_arg(ap, int); | ||||
| 		i = _callm1(FS, OPEN, _len(name), flags, i, | ||||
| 			    (char *)name, NIL_PTR, NIL_PTR); | ||||
| 		va_end(ap); | ||||
| 		return i; | ||||
| 	} | ||||
| 	return _callm3(FS, OPEN, flags, name); | ||||
| } | ||||
| #else | ||||
| PUBLIC int open(name, flags, mode) | ||||
| _CONST char *name; | ||||
| int flags, mode; | ||||
| { | ||||
|   if (flags & O_CREAT) | ||||
| 	return _callm1(FS, OPEN, _len(name), flags, mode, | ||||
| 		      (char *)name, NIL_PTR, NIL_PTR); | ||||
|   return(_callm3(FS, OPEN, flags, name)); | ||||
| } | ||||
| #endif | ||||
							
								
								
									
										8
									
								
								mach/minixST/libsys/_pause.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/minixST/libsys/_pause.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #include <lib.h> | ||||
| #define pause	_pause | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int pause() | ||||
| { | ||||
|   return(_callm1(MM, PAUSE, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										16
									
								
								mach/minixST/libsys/_pipe.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								mach/minixST/libsys/_pipe.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| #include <lib.h> | ||||
| #define pipe	_pipe | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int pipe(fild) | ||||
| int fild[2]; | ||||
| { | ||||
|   int k; | ||||
|   k = _callm1(FS, PIPE, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); | ||||
|   if (k >= 0) { | ||||
| 	fild[0] = _M.m1_i1; | ||||
| 	fild[1] = _M.m1_i2; | ||||
| 	return(0); | ||||
|   } else | ||||
| 	return(k); | ||||
| } | ||||
							
								
								
									
										19
									
								
								mach/minixST/libsys/_ptrace.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								mach/minixST/libsys/_ptrace.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| #include <lib.h> | ||||
| #define ptrace _ptrace | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC long ptrace(req, pid, addr, data) | ||||
| int req, pid; | ||||
| long addr, data; | ||||
| { | ||||
|   _M.m2_i1 = pid; | ||||
|   _M.m2_i2 = req; | ||||
|   _M.m2_l1 = addr; | ||||
|   _M.m2_l2 = data; | ||||
|   if (_callx(MM, PTRACE) == -1) return(-1L); | ||||
|   if (_M.m2_l2 == -1) { | ||||
| 	errno = 0; | ||||
| 	return(-1L); | ||||
|   } | ||||
|   return(_M.m2_l2); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_read.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_read.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define read	_read | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int read(fd, buffer, nbytes) | ||||
| int fd; | ||||
| char *buffer; | ||||
| unsigned nbytes; | ||||
| { | ||||
|   return(_callm1(FS, READ, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_rename.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_rename.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define rename	_rename | ||||
| #include <stdio.h> | ||||
| 
 | ||||
| PUBLIC int rename(name, name2) | ||||
| _CONST char *name, *name2; | ||||
| { | ||||
|   return(_callm1(FS, RENAME, _len(name), _len(name2), 0, | ||||
| 	 (char *) name, (char *) name2,	/* perhaps callm1 preserves these */ | ||||
| 	 NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_rmdir.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_rmdir.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #define rmdir	_rmdir | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int rmdir(name) | ||||
| _CONST char *name; | ||||
| { | ||||
|   return(_callm3(FS, RMDIR, 0, name)); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_setgid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_setgid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define setgid	_setgid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int setgid(grp) | ||||
| gid_t grp; | ||||
| { | ||||
|   return(_callm1(MM, SETGID, (int)grp, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_setuid.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_setuid.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define setuid	_setuid | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int setuid(usr) | ||||
| int usr; | ||||
| { | ||||
|   return(_callm1(MM, SETUID, (int)usr, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										41
									
								
								mach/minixST/libsys/_signal.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								mach/minixST/libsys/_signal.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| #include <lib.h> | ||||
| #define signal	_signal | ||||
| #include <signal.h> | ||||
| 
 | ||||
| extern _PROTOTYPE(void (*_vectab[_NSIG]), (int));	/* array of funcs to catch signals */ | ||||
| 
 | ||||
| /* The definition of signal really should be
 | ||||
|  *  PUBLIC void (*signal(signr, func))() | ||||
|  * but some compilers refuse to accept this, even though it is correct. | ||||
|  * The only thing to do if you are stuck with such a defective compiler is | ||||
|  * change it to | ||||
|  *  PUBLIC void *signal(signr, func) | ||||
|  * and change ../h/signal.h accordingly. | ||||
|  */ | ||||
| 
 | ||||
| PUBLIC void (*signal(signr, func))() | ||||
| int signr;			/* which signal is being set */ | ||||
| _PROTOTYPE( void (*func), (int));	/* pointer to function that catches signal */ | ||||
| { | ||||
|   int r; | ||||
|   _PROTOTYPE( void (*old), (int)); | ||||
| 
 | ||||
|   old = _vectab[signr - 1]; | ||||
|   _M.m6_i1 = signr; | ||||
|   if (func == SIG_IGN || func == SIG_DFL) | ||||
| 	/* Keep old signal catcher until it is completely de-installed */ | ||||
| 	_M.m6_f1 = func; | ||||
|   else { | ||||
| 	/* Use new signal catcher immediately (old one may not exist) */ | ||||
| 	_vectab[signr - 1] = func; | ||||
| 	_M.m6_f1 = _begsig; | ||||
|   } | ||||
|   r = _callx(MM, SIGNAL); | ||||
|   if (r < 0) { | ||||
| 	_vectab[signr - 1] = old;/* undo any pre-installation */ | ||||
| 	return((void (*) ()) r); | ||||
|   } | ||||
|   _vectab[signr - 1] = func;	/* redo any pre-installation */ | ||||
|   if (r == 1) return(SIG_IGN); | ||||
|   return(old); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_stat.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_stat.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define stat	_stat | ||||
| #include <sys/stat.h> | ||||
| 
 | ||||
| PUBLIC int stat(name, buffer) | ||||
| _CONST char *name; | ||||
| struct stat *buffer; | ||||
| { | ||||
|   return(_callm1(FS, STAT, _len(name), 0, 0, | ||||
|   		(char *)name, (char *)buffer, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_stime.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_stime.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #define stime _stime | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int stime(top) | ||||
| long *top; | ||||
| { | ||||
|   _M.m2_l1 = *top; | ||||
|   return(_callx(FS, STIME)); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_stty.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_stty.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define stty	_stty | ||||
| #define ioctl	_ioctl | ||||
| #include <sgtty.h> | ||||
| 
 | ||||
| PUBLIC int stty(fd, argp) | ||||
| int fd; | ||||
| struct sgttyb *argp; | ||||
| { | ||||
|   return ioctl(fd, TIOCSETP, argp); | ||||
| } | ||||
							
								
								
									
										8
									
								
								mach/minixST/libsys/_sync.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/minixST/libsys/_sync.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| #include <lib.h> | ||||
| #define sync	_sync | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int sync() | ||||
| { | ||||
|   return(_callm1(FS, SYNC, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										18
									
								
								mach/minixST/libsys/_time.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								mach/minixST/libsys/_time.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| #include <lib.h> | ||||
| #define time	_time | ||||
| #include <time.h> | ||||
| 
 | ||||
| PUBLIC long time(tp) | ||||
| long *tp; | ||||
| { | ||||
|   int k; | ||||
|   long l; | ||||
|   k = _callm1(FS, TIME, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); | ||||
|   if (_M.m_type < 0 || k != 0) { | ||||
| 	errno = -_M.m_type; | ||||
| 	return(-1L); | ||||
|   } | ||||
|   l = _M.m2_l1; | ||||
|   if (tp != (long *) 0) *tp = l; | ||||
|   return(l); | ||||
| } | ||||
							
								
								
									
										17
									
								
								mach/minixST/libsys/_times.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								mach/minixST/libsys/_times.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #include <time.h> | ||||
| #define times	_times | ||||
| #include <sys/times.h> | ||||
| 
 | ||||
| PUBLIC clock_t times(buf) | ||||
| struct tms *buf; | ||||
| { | ||||
|   clock_t k; | ||||
|   k = (clock_t)_callm1(FS, TIMES, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); | ||||
|   buf->tms_utime = _M.m4_l1; | ||||
|   buf->tms_stime = _M.m4_l2; | ||||
|   buf->tms_cutime = _M.m4_l3; | ||||
|   buf->tms_cstime = _M.m4_l4; | ||||
|   return(k); | ||||
| } | ||||
							
								
								
									
										10
									
								
								mach/minixST/libsys/_umask.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								mach/minixST/libsys/_umask.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define umask	_umask | ||||
| #include <sys/stat.h> | ||||
| 
 | ||||
| PUBLIC mode_t umask(complmode) | ||||
| int complmode; | ||||
| { | ||||
|   return((mode_t)_callm1(FS, UMASK, (int)complmode, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_umount.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_umount.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #define umount	_umount | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int umount(name) | ||||
| _CONST char *name; | ||||
| { | ||||
|   return(_callm3(FS, UMOUNT, 0, name)); | ||||
| } | ||||
							
								
								
									
										9
									
								
								mach/minixST/libsys/_unlink.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								mach/minixST/libsys/_unlink.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | |||
| #include <lib.h> | ||||
| #define unlink	_unlink | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int unlink(name) | ||||
| _CONST char *name; | ||||
| { | ||||
|   return(_callm3(FS, UNLINK, 0, name)); | ||||
| } | ||||
							
								
								
									
										28
									
								
								mach/minixST/libsys/_utime.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								mach/minixST/libsys/_utime.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| /* _utime(2) for POSIX		Authors: Terrence W. Holm & Edwin L. Froese */ | ||||
| 
 | ||||
| #include <lib.h> | ||||
| #include <stddef.h> | ||||
| #define time	_time | ||||
| #include <time.h> | ||||
| #define utime	_utime | ||||
| #include <utime.h> | ||||
| 
 | ||||
| PUBLIC int utime(name, timp) | ||||
| char *name; | ||||
| struct utimbuf *timp; | ||||
| { | ||||
|   long current_time; | ||||
| 
 | ||||
|   if (timp == (struct utimbuf *)NULL) { | ||||
| 	current_time = time((long *)NULL); | ||||
| 	_M.m2_l1 = current_time; | ||||
| 	_M.m2_l2 = current_time; | ||||
|   } else { | ||||
| 	_M.m2_l1 = timp->actime; | ||||
| 	_M.m2_l2 = timp->modtime; | ||||
|   } | ||||
| 
 | ||||
|   _M.m2_i1 = _len(name); | ||||
|   _M.m2_p1 = name; | ||||
|   return _callx(FS, UTIME); | ||||
| } | ||||
							
								
								
									
										12
									
								
								mach/minixST/libsys/_wait.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								mach/minixST/libsys/_wait.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| #include <lib.h> | ||||
| #define wait	_wait | ||||
| #include <sys/wait.h> | ||||
| 
 | ||||
| PUBLIC int wait(status) | ||||
| int *status; | ||||
| { | ||||
|   int k; | ||||
|   k = _callm1(MM, WAIT, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); | ||||
|   if (k >= 0 && status != 0) *status = _M.m2_i1; | ||||
|   return(k); | ||||
| } | ||||
							
								
								
									
										11
									
								
								mach/minixST/libsys/_write.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								mach/minixST/libsys/_write.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| #include <lib.h> | ||||
| #define write	_write | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC int write(fd, buffer, nbytes) | ||||
| int fd; | ||||
| char *buffer; | ||||
| unsigned nbytes; | ||||
| { | ||||
|   return(_callm1(FS, WRITE, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR)); | ||||
| } | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/access.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/access.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _access
 | ||||
| _access: | ||||
| 	jmp __access | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/alarm.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/alarm.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _alarm
 | ||||
| _alarm: | ||||
| 	jmp __alarm | ||||
							
								
								
									
										8
									
								
								mach/minixST/libsys/brk.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/minixST/libsys/brk.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _brk
 | ||||
| .define _sbrk
 | ||||
| _brk: | ||||
| 	jmp __brk | ||||
| _sbrk: | ||||
| 	jmp __sbrk | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/chdir.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/chdir.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _chdir
 | ||||
| _chdir: | ||||
| 	jmp __chdir | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/chmod.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/chmod.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _chmod
 | ||||
| _chmod: | ||||
| 	jmp __chmod | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/chown.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/chown.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _chown
 | ||||
| _chown: | ||||
| 	jmp __chown | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/chroot.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/chroot.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _chroot
 | ||||
| _chroot: | ||||
| 	jmp __chroot | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/close.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/close.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _close
 | ||||
| _close: | ||||
| 	jmp __close | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/creat.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/creat.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _creat
 | ||||
| _creat: | ||||
| 	jmp __creat | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/dup.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/dup.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _dup
 | ||||
| _dup: | ||||
| 	jmp __dup | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/dup2.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/dup2.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _dup2
 | ||||
| _dup2: | ||||
| 	jmp __dup2 | ||||
							
								
								
									
										4
									
								
								mach/minixST/libsys/errno.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								mach/minixST/libsys/errno.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| #include <lib.h> | ||||
| /* errno.c - declare variable errno             Author: F. Meulenbroeks */ | ||||
| 
 | ||||
| int errno = 0; | ||||
							
								
								
									
										14
									
								
								mach/minixST/libsys/exec.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								mach/minixST/libsys/exec.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _execl
 | ||||
| .define _execle
 | ||||
| .define _execv
 | ||||
| .define _execve
 | ||||
| _execl: | ||||
| 	jmp __execl | ||||
| _execle: | ||||
| 	jmp __execle | ||||
| _execv: | ||||
| 	jmp __execv | ||||
| _execve: | ||||
| 	jmp __execve | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/execn.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/execn.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _execn
 | ||||
| _execn: | ||||
| 	jmp __execn | ||||
							
								
								
									
										8
									
								
								mach/minixST/libsys/execnl.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								mach/minixST/libsys/execnl.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _execn
 | ||||
| .define _execnl
 | ||||
| _execn: | ||||
| 	jmp __execn | ||||
| _execnl: | ||||
| 	jmp __execnl | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/fcntl.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/fcntl.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _fcntl
 | ||||
| _fcntl: | ||||
| 	jmp __fcntl | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/fork.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/fork.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _fork
 | ||||
| _fork: | ||||
| 	jmp __fork | ||||
							
								
								
									
										60
									
								
								mach/minixST/libsys/fpathconf.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								mach/minixST/libsys/fpathconf.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,60 @@ | |||
| /* POSIX fpathconf (Sec. 5.7.1) 		Author: Andy Tanenbaum */ | ||||
| 
 | ||||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define fstat	_fstat | ||||
| #include <sys/stat.h> | ||||
| #include <errno.h> | ||||
| #include <limits.h> | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC long fpathconf(fd, name) | ||||
| int fd;				/* file descriptor being interrogated */ | ||||
| int name;			/* property being inspected */ | ||||
| { | ||||
| /* POSIX allows some of the values in <limits.h> to be increased at
 | ||||
|  * run time.  The pathconf and fpathconf functions allow these values | ||||
|  * to be checked at run time.  MINIX does not use this facility. | ||||
|  * The run-time limits are those given in <limits.h>. | ||||
|  */ | ||||
| 
 | ||||
|   struct stat stbuf; | ||||
| 
 | ||||
|   switch(name) { | ||||
| 	case _PC_LINK_MAX: | ||||
| 		/* Fstat the file.  If that fails, return -1. */ | ||||
| 		if (fstat(fd, &stbuf) != 0) return(-1L); | ||||
| 		if (S_ISDIR(stbuf.st_mode)) | ||||
| 			return(1L);	/* no links to directories */ | ||||
| 		else | ||||
| 			return( (long) LINK_MAX); | ||||
| 
 | ||||
| 	case _PC_MAX_CANON: | ||||
| 		return( (long) MAX_CANON); | ||||
| 
 | ||||
| 	case _PC_MAX_INPUT: | ||||
| 		return( (long) MAX_INPUT); | ||||
| 
 | ||||
| 	case _PC_NAME_MAX: | ||||
| 		return( (long) NAME_MAX); | ||||
| 
 | ||||
| 	case _PC_PATH_MAX: | ||||
| 		return( (long) PATH_MAX); | ||||
| 
 | ||||
| 	case _PC_PIPE_BUF: | ||||
| 		return( (long) PIPE_BUF); | ||||
| 
 | ||||
| 	case _PC_CHOWN_RESTRICTED: | ||||
| 		return( (long) 1);	/* MINIX defines CHOWN_RESTRICTED */ | ||||
| 
 | ||||
| 	case _PC_NO_TRUNC:		/* MINIX does not define NO_TRUNC */ | ||||
| 		return( (long) 0); | ||||
| 
 | ||||
| 	case _PC_VDISABLE:		/* MINIX defines VDISABLE */ | ||||
| 		return( (long) _POSIX_VDISABLE); | ||||
| 
 | ||||
| 	default: | ||||
| 		errno = EINVAL; | ||||
| 		return(-1L); | ||||
|   } | ||||
| } | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/fstat.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/fstat.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _fstat
 | ||||
| _fstat: | ||||
| 	jmp __fstat | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/getcwd.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/getcwd.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _getcwd
 | ||||
| _getcwd: | ||||
| 	jmp __getcwd | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/getegid.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/getegid.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _getegid
 | ||||
| _getegid: | ||||
| 	jmp __getegid | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/geteuid.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/geteuid.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _geteuid
 | ||||
| _geteuid: | ||||
| 	jmp __geteuid | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/getgid.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/getgid.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _getgid
 | ||||
| _getgid: | ||||
| 	jmp __getgid | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/getpid.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/getpid.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _getpid
 | ||||
| _getpid: | ||||
| 	jmp __getpid | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/getppid.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/getppid.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _getppid
 | ||||
| _getppid: | ||||
| 	jmp __getppid | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/getuid.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/getuid.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _getuid
 | ||||
| _getuid: | ||||
| 	jmp __getuid | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/gtty.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/gtty.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _gtty
 | ||||
| _gtty: | ||||
| 	jmp __gtty | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/ioctl.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/ioctl.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _ioctl
 | ||||
| _ioctl: | ||||
| 	jmp __ioctl | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/kill.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/kill.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _kill
 | ||||
| _kill: | ||||
| 	jmp __kill | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/link.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/link.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _link
 | ||||
| _link: | ||||
| 	jmp __link | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/lseek.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/lseek.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _lseek
 | ||||
| _lseek: | ||||
| 	jmp __lseek | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/mkdir.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/mkdir.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _mkdir
 | ||||
| _mkdir: | ||||
| 	jmp __mkdir | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/mkfifo.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/mkfifo.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _mkfifo
 | ||||
| _mkfifo: | ||||
| 	jmp __mkfifo | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/mknod.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/mknod.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _mknod
 | ||||
| _mknod: | ||||
| 	jmp __mknod | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/mknod4.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/mknod4.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _mknod4
 | ||||
| _mknod4: | ||||
| 	jmp __mknod4 | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/mktemp.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/mktemp.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _mktemp
 | ||||
| _mktemp: | ||||
| 	jmp __mktemp | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/mount.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/mount.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _mount
 | ||||
| _mount: | ||||
| 	jmp __mount | ||||
							
								
								
									
										5
									
								
								mach/minixST/libsys/open.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/minixST/libsys/open.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .sect .text; .sect .rom; .sect .data; .sect .bss
 | ||||
| .sect .text | ||||
| .define _open
 | ||||
| _open: | ||||
| 	jmp __open | ||||
							
								
								
									
										28
									
								
								mach/minixST/libsys/pathconf.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								mach/minixST/libsys/pathconf.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| /* POSIX pathconf (Sec. 5.7.1) 		Author: Andy Tanenbaum */ | ||||
| 
 | ||||
| #include <lib.h> | ||||
| #include <sys/types.h> | ||||
| #define open	_open | ||||
| #include <fcntl.h> | ||||
| #include <errno.h> | ||||
| #define close	_close | ||||
| #include <unistd.h> | ||||
| 
 | ||||
| PUBLIC long pathconf(path, name) | ||||
| char *path;			/* name of file being interrogated */ | ||||
| int name;			/* property being inspected */ | ||||
| { | ||||
| /* POSIX allows some of the values in <limits.h> to be increased at
 | ||||
|  * run time.  The pathconf and fpathconf functions allow these values | ||||
|  * to be checked at run time.  MINIX does not use this facility. | ||||
|  * The run-time limits are those given in <limits.h>. | ||||
|  */ | ||||
| 
 | ||||
|   int fd; | ||||
|   long val; | ||||
| 
 | ||||
|   if ( (fd = open(path, O_RDONLY)) < 0) return(-1L); | ||||
|   val = fpathconf(fd, name); | ||||
|   close(fd); | ||||
|   return(val); | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		
		Reference in a new issue