Commit graph

1166 commits

Author SHA1 Message Date
Lionel Sambuc 865f761364 Message type for PM_{S,G}ET_PRIORITY
Change-Id: I3cf77f786751ca7e5a8cd13b8716b228d0fbf7fe
2014-07-28 17:05:36 +02:00
Lionel Sambuc 594521214a Message type for PM_SRV_FORK
Change-Id: I0e112da380805d40901a4041fd82da6e842e1f9b
2014-07-28 17:05:36 +02:00
Lionel Sambuc 7fb63c6182 Message type for PM_EXEC_RESTART
Change-Id: I0b7abd7b20a56a7982bccd0f677c1cf9d6bf7d3b
2014-07-28 17:05:36 +02:00
Lionel Sambuc aeedd5c718 Message type for PM_EXEC_NEW
Change-Id: Idff5dc394d8daf4cb0c40d65cfdf2d54c2f9acaa
2014-07-28 17:05:36 +02:00
Lionel Sambuc a297e52a32 Message type for PM_SYSUNAME
Change-Id: I58bd2987393ea56e1886fbce70b4b2c26af4ef2b
2014-07-28 17:05:35 +02:00
Lionel Sambuc 345b3b5114 Message type for PM_PTRACE
Change-Id: I19bbd5faa5c7511cda0239109b2ac55869c47b96
2014-07-28 17:05:35 +02:00
Lionel Sambuc a5ed845b20 Message type for PM_ITIMER
Change-Id: I191ba9630028d9822f6a2fd4d7d3f461eb4d1493
2014-07-28 17:05:35 +02:00
Lionel Sambuc 1ae60bd2e8 Message type for PM_ time-related calls
- Message type for PM_CLOCK_SETTIME, PM_CLOCK_GETTIME,
   PM_CLOCK_GETRES, PM_GETTIMEOFDAY, PM_SETTIME.

 - Small adaptation, message only transfert sub-second time in
   nanoseconds, instead of both nano- and micro-seconds. Conversion
   is done in userland, as required.

Change-Id: Ie4a6e0c457cc12626e85d2102c086a95311cf3e7
2014-07-28 17:05:35 +02:00
Lionel Sambuc ee2f1ee4cd Message type for PM_WAITPID
Change-Id: Ic2637a30418b9c780504f21a93ee80cef09ee1f2
2014-07-28 17:05:35 +02:00
Lionel Sambuc de7aa3340b Message type for PM_GETEPINFO
Change-Id: I275f5c50d433fa400c5eddbc85dd3df8eb5dcb90
2014-07-28 17:05:35 +02:00
Lionel Sambuc a1c31f335c Message type for PM_GETPROCNR
Change-Id: I4fcd682f78255afc1fdc0160fb6f1a3d2fe05d2e
2014-07-28 17:05:34 +02:00
Lionel Sambuc 7031438f58 Message type and related cleanup
- Intorduce and use a message type for VFS_GETDENTS, VFS_READ,
   VFS_WRITE.

 - Some cleanup to related functions where vir_bytes are replaced (and
   casted to/from, in parameter definition and local variables as well.

   This allow to see more clearly which function receives unsafe
   (pointer) values, or at least values which are not supposed to be
   valid in the address space of VFS. The current patch does so only
   for the minimal amount of functions which are concerned with the
   introduction of the new message type.

Change-Id: I0cdca97409c4016d02fae067b48bf55d37572c5c
2014-07-28 17:05:34 +02:00
Lionel Sambuc 2101b4ebc0 Message type for VFS_CLOSE
Change-Id: Iebe5f06b0dc95cdca61d95ab875d4fa1171f4f4c
2014-07-28 17:05:34 +02:00
Lionel Sambuc 6c61cd5665 Message type for VFS_FCHMOD
Change-Id: I933e5b5a214aa9e7ddb6546b459ef40688e8ca04
2014-07-28 17:05:34 +02:00
Lionel Sambuc 4635162db2 Message type for VFS_FCHDIR
Change-Id: Ie7de90d37a39e89f35438a5b01a9e878a06194b2
2014-07-28 17:05:34 +02:00
Lionel Sambuc 698d2bd2a1 Message type for VFS_{,F}CHOWN
Change-Id: Ieb8cef45bfab1e35ad8854038c72b59a4d7bbaad
2014-07-28 17:05:34 +02:00
Lionel Sambuc c869546226 Message type for VFS_CREAT
Change-Id: Ica111f1b2005a6ff42dc3bb59ac3158a2e12678c
2014-07-28 17:05:33 +02:00
Lionel Sambuc cef3ce969a Message type for path related calls.
- Updated system calls VFS_ACCESS, VFS_CHDIR, VFS_CHMOD, VFS_CHROOT,
                        VFS_MKDIR, VFS_OPEN, VFS_RMDIR, VSF_UNLINK

 - Removed M3_STRING and M3_LONG_STRING, which are tied to a specific
   "generic" message, and replaced where needed with M_PATH_STRING_MAX,
   which is tied to the mess_lc_vfs_path message.

Change-Id: If287c74f5ece937b9431e5d95b5b58a3c83ebff1
2014-07-28 17:05:33 +02:00
Lionel Sambuc 96b3577b2c Message type for VFS_MKNOD
Change-Id: Ief8c6664d79c320a70543c10b758b784fdfa7cfd
2014-07-28 17:05:33 +02:00
Lionel Sambuc 6d903b914c Message type for VFS_FCNTL
Change-Id: I079f3d7902cf5501fbc594a5610acd370abea095
2014-07-28 17:05:33 +02:00
Lionel Sambuc bb2b07940c Message type for VFS_FSTAT
Change-Id: Ibdedcac120fc4bf78e28291d9c97fe02df1928db
2014-07-28 17:05:33 +02:00
Lionel Sambuc cd0fd5e725 Message type for VFS_{,L}STAT
Change-Id: I61db8484c14f0371214a0495774dc0b1d97f2099
2014-07-28 17:05:33 +02:00
Lionel Sambuc c5b1fc6f0d Message type for VFS_READLINK
Change-Id: I5da187cd22147448daa5a82568f0bd8bdcc2906f
2014-07-28 17:05:32 +02:00
Lionel Sambuc 1db8ecf0e4 Message type for VFS_{LINK,SYMLINK,RENAME}
Change-Id: If4569bac4584e053b7c4816fe47338327175fd44
2014-07-28 17:05:32 +02:00
Lionel Sambuc 74b01e0c2c Message type for VFS_UMASK
Change-Id: Iaf8f83593adbbf50b82feecbe8fad004da2add72
2014-07-28 17:05:32 +02:00
Lionel Sambuc 3bae8fe45a Message type for VFS_PIPE2
Change-Id: I01c599cf035d8f103220baae54fefbc80d12fbd2
2014-07-28 17:05:32 +02:00
Lionel Sambuc befa020a9e Message type for VFS_TRUNCATE
Change-Id: I6f51c979c8986660883221d3acfa07d1c1b25dff
2014-07-28 17:05:32 +02:00
Lionel Sambuc 268d670a85 Message type for VFS_LSEEK
Change-Id: I592284078572e4abf2b181d3b4e8281c9baf8a7b
2014-07-28 17:05:32 +02:00
Lionel Sambuc 9ceebd7a4b Message type for VFS_FSYNC
Change-Id: Iae9d27dbf40bc5567de6c5960f5cbe174be00dbd
2014-07-28 17:05:31 +02:00
Lionel Sambuc feb9b541da Message type for VFS_MAPDRIVER
Change-Id: I979a8769b72cd06efbedf0c6735ac3cd0c4dd2e3
2014-07-28 17:05:31 +02:00
Lionel Sambuc 6fb0c605fd Message type for VFS_COPYFD
Change-Id: I7aff1b9551d3a60b2191de1bac3b695ea06b73ce
2014-07-28 17:05:31 +02:00
Lionel Sambuc 8830643ac3 Message type for VFS_CHECKPERMS
Change-Id: Ie97bb7362d108ebba268c719a6614fc2fe1392cf
2014-07-28 17:05:31 +02:00
Lionel Sambuc a57fc8f683 Message type for VFS_IOCTL
Change-Id: Ibea0fd2f443c1332bf1c9d138840d838bfc81d81
2014-07-28 17:05:31 +02:00
Lionel Sambuc a16ccbaaf8 Message type for VFS_UMOUNT
Change-Id: Ia3b8e818b45a31178215cad77fa0fa3e5325f18a
2014-07-28 17:05:31 +02:00
Lionel Sambuc ecc9010c4b Message type for VFS_MOUNT
Change-Id: I4114f5a1aa4f9efe49a12996722499b695c17230
2014-07-28 17:05:30 +02:00
Lionel Sambuc ad7e3e56c8 Message type for VFS_{,F}STATVFS1
Change-Id: Iaf71cdddb48f64d84773029da2c0666f5462f198
2014-07-28 17:05:30 +02:00
Lionel Sambuc ccdf11c7cf Message type for VFS_GETVFSSTAT
Change-Id: I27f1f6dc37832ee4adb9854c7306ce6153e31567
2014-07-28 17:05:30 +02:00
Lionel Sambuc 7332005370 Message type for VFS_SELECT
Change-Id: Ifd6cb7082dd528f1698a0ca070de447aad85ba60
2014-07-28 17:05:30 +02:00
Lionel Sambuc 58b67186c2 Some cleanup in IPC headers and documentation.
- Cleanup of unused macros for VFS - FS protocols
 - Update servers/vfs/README to reflect the new requests names.
 - Alphabetically re-order the message union, as well as minor
   formatting, for readability.

Change-Id: Ief7c38489e93bcf5f795dccbf3a8e10b44b95af4
2014-07-28 17:05:30 +02:00
Lionel Sambuc b6aa3714a1 Remove protocol version of {mode,ino,uid,gid}_t
Now that we have enough room in the message, remove these types.

Change-Id: Ib734c6f0209b259a14a1189b3886b9c8474e1b9a
2014-07-28 17:05:29 +02:00
Lionel Sambuc 56350a991b Message types for VFS read, write & peek
All of these requests share the same message type as at least one server
manages those requests in the same handler, just by checking the actual
type of the request, and then acting upon it.

Change-Id: I17337b4c67ae209523574c22ccc108cf5f1e65e9
2014-07-28 17:05:29 +02:00
Lionel Sambuc 27baf1f58a Message types for VFS bread, bwrite & bpeek
These two request are handled by the same function in some FSes, which
prevents us from using two different kinds of messages.

Change-Id: Ib2fc80bdd56ef67db6b4c51cf8963353a761aab1
2014-07-28 17:05:29 +02:00
Lionel Sambuc a65bf37e3b Message types for VFS chown
Change-Id: I1dc50772fd28b0c698d85922ad0ad3b41dde006c
2014-07-28 17:05:29 +02:00
Lionel Sambuc fd32afa654 Message types for VFS statvfs
Change-Id: If84f53577510399aa1238cfcd0b8aa1fb13c2490
2014-07-28 17:05:29 +02:00
Lionel Sambuc ea84447ccd Message types for VFS chmod
Change-Id: I76e5df4c0a386682e863e640182c59e4ab7e30be
2014-07-28 17:05:29 +02:00
Lionel Sambuc f90ed467fc Message types for VFS mknod
Change-Id: I41772ffe0efc520b3cd204857c33c8c76d81a5a8
2014-07-28 17:05:28 +02:00
Lionel Sambuc 2dc27154ad Message types for VFS mkdir
Change-Id: I05ea5b5e14e28afdfab6edcabc1dc761389f2638
2014-07-28 17:05:28 +02:00
Lionel Sambuc 169e0314ea Message types for VFS unlink & rmdir
These two request are handled by the same function in some FSes, which
prevents us from using two different kinds of messages.

Change-Id: Iede3a0251d8d84ca7f121c56f30f42b045b0c737
2014-07-28 17:05:28 +02:00
Lionel Sambuc df7e2766c5 Message types for VFS stat
Change-Id: I1d40ae7c3c32a4f7b80c82bc2fa8b157b20a6837
2014-07-28 17:05:28 +02:00
Lionel Sambuc 88f2d881a1 Message types for VFS inhibread
Change-Id: I4ce20a4566033593e4784fd278d7ff7fda16dd9d
2014-07-28 17:05:28 +02:00
Lionel Sambuc 6a94be7e63 Message types for VFS putnode
Change-Id: I0802ccaaaa6ee1b4eb96d62b08f9795c790ce39b
2014-07-28 17:05:28 +02:00
Lionel Sambuc afcde4d208 Message types for VFS link
Change-Id: Ibe03e7c9fded7f3764ecbe3e35b92df3662e54a4
2014-07-28 17:05:27 +02:00
Lionel Sambuc 111969b623 Message types for VFS rdlink
Change-Id: Ic077e99fb140a3a1de849f7f761fdfd90961f5d8
2014-07-28 17:05:27 +02:00
Lionel Sambuc 591227dc38 Message types for VFS getdents
Change-Id: I7474d7547f1fd52f4da54754ccfe984ba1a2baa8
2014-07-28 17:05:27 +02:00
Lionel Sambuc 5fb3a3e7d3 Message types for VFS new_driver
Change-Id: If1b6ee2c5beb43e72a69c27dbc32b72525831962
2014-07-28 17:05:27 +02:00
Lionel Sambuc 0d1db99965 Message types for VFS slink
Change-Id: I13975474b924817553101c28591b4c04e8679173
2014-07-28 17:05:27 +02:00
Lionel Sambuc cadcb6d061 Message types for VFS utime
Change-Id: If7e5faa13a824528fd8ca02bd6982e04d48032e9
2014-07-28 17:05:26 +02:00
Lionel Sambuc 135346dfc3 Message types for VFS ftrunc
Change-Id: I593a4d91b1d974f632f6cb4eb23aabee5b65df7b
2014-07-28 17:05:26 +02:00
Lionel Sambuc a725c62a66 Message types for VFS rename
Change-Id: I48a4098c16519e9c104b287d7bdf95ed6a2a7323
2014-07-28 17:05:26 +02:00
Lionel Sambuc 5d682d17ee Message types for VFS flush
Change-Id: Ida7cbff4402bf876603a2153e2784699d93c03ea
2014-07-28 17:05:26 +02:00
Lionel Sambuc 16a3f23203 Message types for VFS mountpoint
Change-Id: I61c5729628b9b9262cc11415591b1b0f25ad04a8
2014-07-28 17:05:26 +02:00
Lionel Sambuc 83cd8ba616 Message types for VFS newnode
Change-Id: I5c0790fc1104182ab08bcae699c60a364833c360
2014-07-28 17:05:26 +02:00
Lionel Sambuc 3f567bdb11 Message types for VFS create
Change-Id: Ibeba338337eb16814b5b25f7135da958e8316a99
2014-07-28 17:05:25 +02:00
Lionel Sambuc 02dc6498da Message types for VFS lookup
Change-Id: Ic4d2a616ebc986c4b405b6b9ee0bd7c3b59e81d2
2014-07-28 17:05:25 +02:00
Lionel Sambuc 398af818df Message types for VFS readsuper
Change-Id: I7aea85d9842459ea454420bb1687d9b8eb597914
2014-07-28 17:05:25 +02:00
Lionel Sambuc 20211dd1b0 Remove unused generic message m6
Change-Id: Ie99dca9b75325b3c4890718f8ac7aa49a8973798
2014-07-28 17:05:25 +02:00
Lionel Sambuc 97bbdc69df Introduce message types mess_u{8,16,32,64}
Those messages offer a simple array of the given type. This should allow
for fast and simple prototyping.

When a protocol is fixed, then proper message types should be defined.

Change-Id: I4e98eeb0493924f3015862a51d14d894315e2bc2
2014-07-28 17:05:25 +02:00
Morgawr 91c835edc2 added sethostname syscall with proper error checks
Change-Id: I4b4e0a7c4035e19d5843b86ee1f714096adcecd2
2014-07-28 17:05:24 +02:00
Lionel Sambuc afe5cecd7f Stub for setpgid
This implements a near noop setpgid, unless the use is one equivalent
to setsid, in which case it will behave as such.

Also activates setpgrp, which is implemented in terms of setpgid.

Change-Id: I84411cb1957351aa1d3985623cd9e69bdf6f8d4c
2014-07-28 17:05:24 +02:00
Lionel Sambuc 18f97ad415 Workaround missing lchmod/lchown
Change-Id: I231a0010722619d389b763af35ff55f84ca9cb76
2014-07-28 17:05:20 +02:00
Ben Gras 3f38115c7b _MINIX_SYSTEM - fixes for in-minix crossbuild
. define _MINIX_SYSTEM for all system code from minix.service.mk
	. hide some system-level declarations and definitions
	  behind _MINIX_SYSTEM to cleanly fix host tool build problems on
	  Minix (such as: NONE being defined and paddr_t being used but not
	  declared)
	. the similar definition _SYSTEM is unsuitable as it changes the
	  values of errno definitions

Change-Id: I407de79e2575115243a074b16e79546a279cfa3e
2014-07-28 17:05:14 +02:00
Ben Gras 565f13088f make vfs & filesystems use failable copying
Change the kernel to add features to vircopy and safecopies so that
transparent copy fixing won't happen to avoid deadlocks, and such copies
fail with EFAULT.

Transparently making copying work from filesystems (as normally done by
the kernel & VM when copying fails because of missing/readonly memory)
is problematic as it can happen that, for file-mapped ranges, that that
same filesystem that is blocked on the copy request is needed to satisfy
the memory range, leading to deadlock. Dito for VFS itself, if done with
a blocking call.

This change makes the copying done from a filesystem fail in such cases
with EFAULT by VFS adding the CPF_TRY flag to the grants. If a FS call
fails with EFAULT, VFS will then request the range to be made available
to VM after the FS is unblocked, allowing it to be used to satisfy the
range if need be in another VFS thread.

Similarly, for datacopies that VFS itself does, it uses the failable
vircopy variant and callers use a wrapper that talk to VM if necessary
to get the copy to work.

	. kernel: add CPF_TRY flag to safecopies
	. kernel: only request writable ranges to VM for the
	  target buffer when copying fails
	. do copying in VFS TRY-first
	. some fixes in VM to build SANITYCHECK mode
	. add regression test for the cases where
	  - a FS system call needs memory mapped in a process that the
	    FS itself must map.
	  - such a range covers more than one file-mapped region.
	. add 'try' mode to vircopy, physcopy
	. add flags field to copy kernel call messages
	. if CP_FLAG_TRY is set, do not transparently try
	  to fix memory ranges
	. for use by VFS when accessing user buffers to avoid
	  deadlock
	. remove some obsolete backwards compatability assignments
        . VFS: let thread scheduling work for VM requests too
          Allows VFS to make calls to VM while suspending and resuming
          the currently running thread. Does currently not work for the
          main thread.
        . VM: add fix memory range call for use by VFS

Change-Id: I295794269cea51a3163519a9cfe5901301d90b32
2014-07-28 17:05:14 +02:00
David van Moolenbroek e7974541d0 Rearrange endpoint number layout
The constants ANY, NONE, and SELF are now a function of the way the
endpoint number is split between a generation number and a process
slot number, rather than the other way around.  This allows for the
use of bit masking and shifting instead of the previous (and more
expensive) multiplication and division.

Change-Id: Id890eea74435444128c75eb0c89816b948f43c0b
2014-07-28 17:05:12 +02:00
David van Moolenbroek 760f3d62d7 PTY: split off from TTY
Requires recreation of /dev/tty[pq]*, /dev/pty[pq]* device nodes.

Change-Id: I0e5a28d82faa934497fd3b97d619e506bcb5f439
2014-07-28 17:05:12 +02:00
Ben Gras 273c51a7d1 64-bit CDEV_POS
Change-Id: Iecdadf3dd92cc14525961976f51a9eb16a996d62
2014-07-28 17:05:11 +02:00
Ben Gras 3f3e78ef59 64-bit REQ_TRC_START, REQ_TRC_END
Change-Id: I567804209695b5ec0d83a453d93e36cbf8900f1a
2014-07-28 17:05:11 +02:00
Ben Gras e6daf20a69 64-bit VFS_LSEEK_OFF
Change-Id: Ic0b6d65cbde1033462b909436efa92464094f1ec
2014-07-28 17:05:11 +02:00
Ben Gras ed9076ccb4 64-bit VFS_VMCALL_OFFSET
Change-Id: I29725365a199f850420cd0e4e3902cf70dffe9ad
2014-07-28 17:05:10 +02:00
Ben Gras 188a5fde1f 64-bit VFS_TRUNCATE_OFF
Change-Id: I4bd5cc57ddda2525b0bec6f044f35196a2c21f2e
2014-07-28 17:05:10 +02:00
Ben Gras 4694fcc1d5 64-bit RES_FILE_SIZE
Change-Id: Ia17b4b4722f87fb35142948b62d4a8392ded5f73
2014-07-28 17:05:10 +02:00
Ben Gras fdd85c4d08 64-bit RES_SEEK_POS
Change-Id: Id13f06417f2f600db167bec7b33bc825742cae79
2014-07-28 17:05:10 +02:00
Ben Gras 978082bb0d 64-bit REQ_SEEK_POS
Change-Id: I2e51a188b171af0f0a02349e4eccbe78e7cc2e0c
2014-07-28 17:05:10 +02:00
Ben Gras 3c7f4e462e 64-bit bdev position
Change-Id: I149693624610e04af0c5e4437b5efa484a33467d
2014-07-28 17:05:10 +02:00
Lionel Sambuc d3d33afe9f Experimental pthread compatibility library
This patch adds pthread compatibility by using libmthread.

To use this with a program using pthreads, you have to replace
  #include <pthread>
with
  #define _MTHREADIFY_PTHREADS
  #include <minix/mthreads>

This also changes the initialization function to be a constructor, which
is implicitly called before the call to main. This allows for
conformance with pthreads, while not paying a high price by checking on
each mthread_* call whether the library has been initialized or not.

As mthread_init is now a constructor, it also has been set as static, and
relevent calls removed from programs using it.

Change-Id: I2aa375db557958d2bee9a70d285aabb990c88f00
2014-07-28 17:05:08 +02:00
Lionel Sambuc 84d9c625bf Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
2014-07-28 17:05:06 +02:00
Ben Gras 7597f4a8fc <machine/signal.h>
. use netbsd sigframe, sigcontext struct
	. netbsd sigframe *contains* sigcontext; use that directly
	  in kernel sigsend
	. drop two fields from minix x86 stackframe.h (process context)
	  that were unused, retadr and st

use in-sigframe sigcontext

Change-Id: Ib59d699596dc3a78163dee59f19730482fdddf11
2014-03-03 20:47:07 +01:00
Ben Gras aae07bc777 <sys/ioccom.h>, <sys/ioctl.h>
. use <sys/ioccom.h> to make ioctls
	. use netbsd <sys/ioctl.h>, include minix ioctls
	. convert to varargs ioctl() like netbsd

Change-Id: Id5165780df48172b28bf0003603516d30d7c1abb
2014-03-03 20:47:06 +01:00
Ben Gras be9fe09e97 x86 multiboot.h
Change-Id: I245564a98fb9e2572b88f8feb7411ad6800a543c
2014-03-03 20:47:05 +01:00
Ben Gras 6cf86998df <net/if_ether.h>
Change-Id: I7425aae72ab43e3fcec8373f7c589273d36f7fcb
2014-03-03 20:47:04 +01:00
Lionel Sambuc b0cab62bd2 include/sched.h: merged
Change-Id: Icb38da694db516279a1f45579a593e5369d064bb
2014-03-03 20:47:03 +01:00
Lionel Sambuc 9fb2800ffc reduced diff in include/signal.h
Change-Id: I8df2199e6ac5a429f61079ca8c01fe58bd44ff36
2014-03-03 20:47:03 +01:00
Lionel Sambuc 3053b27247 include/limits.h: merged
Replacing SYMLOOP_MAX, SYMLINK_MAX, by _POSIX_SYMLOOP_MAX,
_POSIX_SYMLINK_MAX respectively.

Change-Id: I020c20b0dbf6d44e777879d786a20811f23d1561
2014-03-03 20:47:03 +01:00
Lionel Sambuc 57476292b0 include/time.h: merged
- Defining CLOCKS_PER_SEC = 100, instead of 60.
   This define is here for legacy reasons, use sysconf(_SC_CLK_TCK) to
   retrieve the actual number of clock tick per second of the system in
   new code.

 - Moving stime prototype to minix/sysutil.h

Change-Id: I76a73cd53ac2361845f2917f62af4125adfc615d
2014-03-03 20:47:02 +01:00
Lionel Sambuc c7d758c7f2 adding include/spawn.h, removing include/sa.h
Change-Id: Ieff4f5e51f98ef5105307e6b8c6ba1dd6f3c844a
2014-03-03 20:47:02 +01:00
Lionel Sambuc d3b0a89bab include/unistd.h: merged
Also removing lseek64, pread64, pwrite64.

Those functions have lost their "raison d'être", when off_t switched to
64bits.

Change-Id: I5aea35f01d6d10e3d6578a70323da7be5eca315a
2014-03-03 20:47:02 +01:00
Lionel Sambuc 3160cdd5b1 include/a.out.h: merged
Change-Id: I1216faaab1f283e1253155fda9e0fe5b821f09f6
2014-03-03 20:47:02 +01:00
Lionel Sambuc 479fea75f0 include/netdb.h: merged
Change-Id: I899e6ac611b671a78d6abd83a73eed484aa49595
2014-03-03 20:47:01 +01:00
Lionel Sambuc afc1f71188 include/paths.h: merged
Change-Id: I5e2aa0bc99a596f82ef4224f22623bcb83cb98b5
2014-03-03 20:47:01 +01:00
Lionel Sambuc a6e7b85835 align include/paths: MAILDIR
Change-Id: Ieb50549f8f27af957f67fcb0757690db88fecc8b
2014-03-03 20:47:01 +01:00
Lionel Sambuc 78a74622be include/login_cap.h: merged
Change-Id: Ic1e5189a89a1dae2a06b182a4af6a65a75c7e2ce
2014-03-03 20:47:01 +01:00
Lionel Sambuc 42d7eda0cc include/stdlib.h: merged
Change-Id: I26b032566d1d7a816df56254c5f9e6dc82626a70
2014-03-03 20:47:01 +01:00
Lionel Sambuc 9335f8073e include/stdio.h: merged
Change-Id: I7d5869ce25dfe9f2944ceef86464829d08830d24
2014-03-03 20:47:01 +01:00
Lionel Sambuc e9e08def23 remove special handling of rename()
Change-Id: I69694e155250dc5f527dacbaf3f0ecbdc4873989
2014-03-03 20:47:01 +01:00
Lionel Sambuc fe1223849e include/arpa/nameser_compat.h: merged
Removing compatibility macros, and updating the two tools still using
them.

Change-Id: I636f045d76a8f92440ebe1503f52f7e5d704a316
2014-03-03 20:47:00 +01:00
Lionel Sambuc b33edbfe7a Removing VFS_UTIMENS_* field macros.
Change-Id: I3be1acfbb77b6e229d784d8dbc3ceec1b26abf90
2014-03-03 20:47:00 +01:00
Lionel Sambuc 94c9376df5 Removing SYS_SIG_* field macros.
Change-Id: Ib4f1b48268d4539ae6d4502ad647ecb73ea87f79
2014-03-03 20:47:00 +01:00
Lionel Sambuc 301f5f87f0 Renamed m_vm_vfs to m_vm_vfs_mmap.
Stay coherent with the naming scheme of the messages.

Change-Id: Icc0e13a88ec29263502166c0e6eec81cdb974663
2014-03-03 20:47:00 +01:00
Lionel Sambuc e69e14895d Removing NOTIFY_* field macros.
Change-Id: Idc8604dac9630ee2343476b906b45a115a89994e
2014-03-03 20:47:00 +01:00
Lionel Sambuc 175d3e7eae Changing the message union to anonymous.
This allows us to write things like this:
  message m;
  m.m_notify.interrupts = new_value;

or
  message *mp;
  mp->m_notify.interrupts = new_value;

The shorthands macro have been adapted for the new scheme, and will be
kept as long as we have generic messages being used.

Change-Id: Icfd02b5f126892b1d5d2cebe8c8fb02b180000f7
2014-03-03 20:46:47 +01:00
Lionel Sambuc 4a0199d66d PM_TIME_SEC into 64bit
Change-Id: I609ee8cac7aae8af2c0c0381710433a5df0caebd
2014-03-03 20:45:28 +01:00
Lionel Sambuc 55d9e9954b Extending time_t to 64bits.
Change-Id: Ia96b8bfba19cb8179a0237a7d2122d415c24d73f
2014-03-03 20:45:28 +01:00
Ben Gras 88be7bd333 Use netbsd <sys/mman.h>
Change-Id: I80e9cffc80140383a6faf692248573c64d282b4a
2014-03-03 20:37:27 +01:00
Ben Gras 3b4bc508ac <sys/unistd.h>, <time.h>
Change-Id: If0d0cd9115dec33d27e8e5644c0020021d8816b8
2014-03-02 12:28:32 +01:00
Gerard 78da142dab Replaced common u64.h functions with operators.
Change-Id: I71b7b4879209eeff89ce5748d67102afebf871dc
2014-03-02 12:28:32 +01:00
Lionel Sambuc 37598dccf1 Aligning dev_t to 64bits.
Change-Id: I630f72f8530dd4aaf05c35ca23683ae12c9f8328
2014-03-02 12:28:32 +01:00
Lionel Sambuc a00e322bea libc/sys-minix/mount.c: fix overflow
Fix a bug where a filesystem label could overflow the reserved buffer.
This was already possible with 32 bits values, but is more proeminent
with dev_t being 64 bits.

Change-Id: Idc04ed355d1dd92b7a8ce4699de832661a5c4ccd
2014-03-02 12:28:32 +01:00
Lionel Sambuc 5ae60510dc Add a compile-time check for IPC messages size
This patch adds compile-time check for each message type to ensure the
size is within the IPC assumptions.

This will allow messages specific to a protocol to use from now on the
proper types for each fields, while preventing from any unsuspected
side effect when updating type definitions.

Change-Id: Iad64f81a6b6726321fbc492ac37ceeaaa57aa6cd
2014-03-02 12:28:31 +01:00
Ben Gras 8ccb12bb5a use netbsd <sys/signal.h> and sigset_t
. create signals-related struct message type to store sigset_t
	  directly
	. create notify-specific message types, so the generic NOTIFY_ARG
	  doesn't exist anymore
	. various related test expansions, improvements, fixes
	. add a few error-checks to sigismember() calls
	. rename kernel call specific signals fields to SYS_*

Change-Id: I53c18999b5eaf0cfa0cb25f5330bee9e7ad2b478
2014-03-02 12:28:31 +01:00
Ben Gras 25719b5d92 bigger message
Change-Id: Ie770140c55799bdc3bb8f0ad6994d59938155a1a
2014-03-02 12:28:31 +01:00
Ben Gras 7120f34ec1 drop <minix/termios.h>, use clean <sys/termios.h>
. also implement some netbsd-style tty ioctls
	. also implement SIGINFO
	. also import netbsd stty
	. rename keymap minix CMIN (for ctrl+minus on numeric keypad)
	  to CNMIN; to keep unchanged control character default CMIN in
	  new <sys/ttydefaults.h>
	. convert CS[5678] logic in rs232 driver to explicit setting of LC
	  bits

Change-Id: I9b7d2963fe9aec00fb6e7535ef565b3191fc1c1d
2014-03-02 12:28:20 +01:00
Ben Gras a06e2ab395 big <utmp.h>-inspired netbsd switch
import/switch of:
init, getty, reboot, halt, shutdown, wall, last

changes:
	. change reboot() call to netbsd prototype and args
	. allows pristine <utmp.h>
	. use clean <sys/reboot.h> instead of <minix/reboot.h>
	. implement TIOCSCTTY for use by getty so getty can get
	  controlling terminal from init's child(ren)
	. allow NULL envp for exec

Change-Id: I5ca02cb4230857140c08794bbfeba7df982c58a3
2014-03-01 09:05:02 +01:00
Lionel Sambuc c3fc9df84a Adding ipc_ prefix to ipc primitives
* Also change _orig to _intr for clarity
 * Cleaned up {IPC,KER}VEC
 * Renamed _minix_kernel_info_struct to get_minix_kerninfo
 * Merged _senda.S into _ipc.S
 * Moved into separate files get_minix_kerninfo and _do_kernel_call
 * Adapted do_kernel_call to follow same _ convention as ipc functions
 * Drop patches in libc/net/send.c and libc/include/namespace.h

Change-Id: If4ea21ecb65435170d7d87de6c826328e84c18d0
2014-03-01 09:05:01 +01:00
David van Moolenbroek 24ec0d73b5 Clean up interface to PM and VFS
- introduce new call numbers, names, and field aliases;
- initialize request messages to zero for all ABI calls;
- format callnr.h in the same way as com.h;
- redo call tables in both servers;
- remove param.h namespace pollution in the servers;
- make brk(2) go to VM directly, rather than through PM;
- remove obsolete BRK, UTIME, and WAIT calls;
- clean up path copying routine in VFS;
- move remaining system calls from libminlib to libc;
- correct some errno-related mistakes in libc routines.

Change-Id: I2d8ec5d061cd7e0b30c51ffd77aa72ebf84e2565
2014-03-01 09:05:01 +01:00
David van Moolenbroek d8106f7f1d Rename VFS_BASE to FS_BASE
The recipients of these requests are file systems, not VFS.

Change-Id: I49211cfe4289df25b0c07171c7f8c321fc3731d6
2014-03-01 09:05:00 +01:00
David van Moolenbroek 87c599da2d PM/VFS protocol: prefix with VFS_PM_
These calls are sent to VFS, and thus should be prefixed with VFS_.
Clean up the protocol and PM's main function a bit.

Since the protocol is substantially big and different from normal VFS
requests, this protocol retains its own numbering range for now.

Change-Id: Ia62104b5c5c929ed787144816d2e4cc70bed3b0b
2014-03-01 09:05:00 +01:00
David van Moolenbroek 44d3230e40 For common calls, give servers unique call numbers
The getsysinfo(2), getrusage(2), and svrctl(2) calls used the same
call number to different services. Since we want to give each service
its own call number ranges, this is no longer tenable. This patch
introduces per-service call numbers for these calls.

Note that the remainder of the COMMON_ range is left intact, as these
the remaining requests in it are processed by SEF and thus server-
agnostic. The range should really be prefixed with SEF_ now.

Change-Id: I80d728bbeb98227359c525494c433965b40fefc3
2014-03-01 09:05:00 +01:00
David van Moolenbroek 80bd109cd3 libsys: various updates
- move system calls for use by services from libminlib into libsys;
- move srv_fork(2) and srv_kill(2) from RS and into libsys;
- replace getprocnr(2) with sef_self(3);
- rename previous getnprocnr(2) to getprocnr(2);
- clean up getepinfo(2);
- change all libsys calls that used _syscall to use _taskcall, so as
  to avoid going through errno to pass errors; this is already how
  most calls work anyway, and many of the calls previously using
  _syscall were already assumed to return the actual error;
- initialize request messages to zero, for future compatibility
  (note that this does not include PCI calls, which are in need of a
  much bigger overhaul, nor kernel calls);
- clean up more of dead DS code as a side effect.

Change-Id: I8788f54c68598fcf58e23486e270c2d749780ebb
2014-03-01 09:05:00 +01:00
David van Moolenbroek 4d4e70daaa PM: remove obsolete ALARM, PAUSE, TIMES calls
NetBSD libc implements these as wrappers around setitimer(2),
sigsuspend(2), and getrusage(2), respectively.

Change-Id: I0c5e725b3e1316bddd3a3ff7ef65d57d30afd10d
2014-03-01 09:04:59 +01:00
Ben Gras 6c8f7fc3ba netbsd dirent.h, import sys/sys *.h, mfs cleanup
. add all sys/sys headers not already present to help compiling
	. take netbsd dirent.h and struct dirent; main result is
	  introducing d_type and d_namlen that have to be set by getdents()
	  in all FS code implementing it
	. d_off is gone
	. alignment of the struct has become 8 bytes instead of 4
	. remove _MAX_BLOCK_SIZE, _MIN_BLOCK_SIZE, _STATIC_BLOCK_SIZE
	. libminlib: cleanup unused yet duplicate code
	. mfs: throw out the long-broken v1, v2 support
	. new test for dirent contents filled by getdents()

Change-Id: I1459755c7ba5e5d1c9396d3a587ce6e63ddc283e
2014-03-01 09:04:59 +01:00
David van Moolenbroek 664b726cd3 VFS: further cleanup of device code
- all TTY-related exceptions have now been merged into the regular
  code paths, allowing non-TTY drivers to expose TTY-like devices;
- as part of this, CTTY_MAJOR is now fully managed by VFS instead of
  being an ugly stepchild of the TTY driver;
- device styles have become completely obsolete, support for them has
  been removed throughout the system; same for device flags, which had
  already become useless a while ago;
- device map open/close and I/O function pointers have lost their use,
  thus finally making the VFS device code actually readable;
- the device-unrelated pm_setsid has been moved to misc.c;
- some other small cleanup-related changes.

Change-Id: If90b10d1818e98a12139da3e94a15d250c9933da
2014-03-01 09:04:58 +01:00
David van Moolenbroek e5cc85fdc4 Extend dupfrom(2) into copyfd(2)
This single function allows copying file descriptors from and to
processes, and closing a previously copied remote file descriptor.
This function replaces the five FD-related UDS backcalls. While it
limits the total number of in-flight file descriptors to OPEN_MAX,
this change greatly improves crash recovery support of UDS, since all
in-flight file descriptors will be closed instead of keeping them
open indefinitely (causing VFS to crash on system shutdown). With the
new copyfd call, UDS becomes simpler, and the concept of filps is no
longer exposed outside of VFS.

This patch also moves the checkperms(2) stub into libminlib, thus
fully abstracting away message details of VFS communication from UDS.

Change-Id: Idd32ad390a566143c8ef66955e5ae2c221cff966
2014-03-01 09:04:58 +01:00
David van Moolenbroek b003ed0929 UDS: split off from PFS
Change-Id: I769cbd64aa6e5e85a797caf0f8bbb4c20e145263
2014-03-01 09:04:57 +01:00
David van Moolenbroek 6d466f941b at_wini: PCI-only now; one controller per instance
- remove non-PCI support, since all supported platforms with at_wini
  devices also have PCI support by now;
- correspondingly, stop using information from the BIOS altogether;
- limit each driver instance to one controller, to be in line with
  the general MINIX3 one-instance-per-controller driver model; this
  limits the number of disks per at_wini instance to four;
- go through the controllers by the order of their occurrence in the
  PCI table, thus removing the exception for compatibility devices;
- let the second at_wini instance shut down silently if there is only
  one IDE controller;
- clean up some extra code we don't need anymore, and resolve some
  WARNS=5 level warnings.

Overall, these changes should simplify automatic loading of the right
disk drivers at boot time in the future.

Change-Id: Ia64d08cfbeb9916abd68c9c2941baeb87d02a806
2014-03-01 09:04:57 +01:00
David van Moolenbroek 89332ecdf1 system.conf: subsystem VID/DID matching support
- change "vid/did" to "vid:did", old form still supported for now;
- allow "vid:did/subvid:subdid" specification in system.conf, in
  which case a device will be visible to a driver if the subsystem
  VID/DID also match.

Change-Id: I7aef54da1b0bc81e24b5d98f1a28416f38f8b266
2014-03-01 09:04:57 +01:00
David van Moolenbroek 6b3f4dc157 Input infrastructure, INPUT server, PCKBD driver
This commit separates the low-level keyboard driver from TTY, putting
it in a separate driver (PCKBD). The commit also separates management
of raw input devices from TTY, and puts it in a separate server
(INPUT). All keyboard and mouse input from hardware is sent by drivers
to the INPUT server, which either sends it to a process that has
opened a raw input device, or otherwise forwards it to TTY for
standard processing.

Design by Dirk Vogt. Prototype by Uli Kastlunger.

Additional changes made to the prototype:

- the event communication is now based on USB HID codes; all input
  drivers have to use USB codes to describe events;
- all TTY keymaps have been converted to USB format, with the effect
  that a single keymap covers all keys; there is no (static) escaped
  keymap anymore;
- further keymap tweaks now allow remapping of literally all keys;
- input device renumbering and protocol rewrite;
- INPUT server rewrite, with added support for cancel and select;
- PCKBD reimplementation, including PC/AT-to-USB translation;
- support for manipulating keyboard LEDs has been added;
- keyboard and mouse multiplexer devices have been added to INPUT,
  primarily so that an X server need only open two devices;
- a new "libinputdriver" library abstracts away protocol details from
  input drivers, and should be used by all future input drivers;
- both INPUT and PCKBD can be restarted;
- TTY is now scheduled by KERNEL, so that it won't be punished for
  running a lot; without this, simply running "yes" on the console
  kills the system;
- the KIOCBELL IOCTL has been moved to /dev/console;
- support for the SCANCODES termios setting has been removed;
- obsolete keymap compression has been removed;
- the obsolete Olivetti M24 keymap has been removed.

Change-Id: I3a672fb8c4fd566734e4b46d3994b4b7fc96d578
2014-03-01 09:04:55 +01:00
Thomas Cort f5dbfe789e uname: normalize release and version
Most systems provide the full version number in the
'release' field and the kernel version in 'version'.
Minix used to split the full version number between
release and version which caused problems for pkgsrc
and other applications. This patch brings Minix's
uname in line with other systems such as NetBSD.
It also brings the getty banner in line with NetBSD.

Old Minix uname:
	sysname->Minix
	nodename->10.0.2.15
	release->3
	version->2.1
	machine->i686

New Minix uname:
	sysname->Minix
	nodename->10.0.2.15
	release->3.2.1
	version->Minix 3.2.1 (GENERIC)
	machine->i686

Change-Id: I966633dfdcf2f9485966bb0d0d042afc45bbeb7d
2014-03-01 09:04:55 +01:00
David van Moolenbroek 36ac0dbcf8 Take LOG out of the boot image
Change-Id: Id2629776b53aae46629b04a42c15cbbacac9b949
2014-03-01 09:04:55 +01:00
David van Moolenbroek 8fea5ab8bd Kernel: make SIGKMESS target process list dynamic
The set of processes to which a SIGKMESS signal is sent whenever new
diagnostics messages are added to the kernel's message buffer, is now
no longer hardcoded. Instead, processes can (un)register themselves
to receive such notifications, by means of sys_diagctl().

Change-Id: I9d6ac006a5d9bbfad2757587a068fc1ec3cc083e
2014-03-01 09:04:54 +01:00
David van Moolenbroek de975579a4 Rename SYSCTL kernel call to DIAGCTL
Change-Id: I1b17373f01808d887dcbeab493838946fbef4ef6
2014-03-01 09:04:54 +01:00
Lionel Sambuc 9fab85c2de Replacing timer_t by netbsd's timer_t
* Renamed struct timer to struct minix_timer
 * Renamed timer_t to minix_timer_t
 * Ensured all the code uses the minix_timer_t typedef
 * Removed ifdef around _BSD_TIMER_T
 * Removed include/timers.h and merged it into include/minix/timers.h
 * Resolved prototype conflict by renaming kernel's (re)set_timer
   to (re)set_kernel_timer.

Change-Id: I56f0f30dfed96e1a0575d92492294cf9a06468a5
2014-03-01 09:04:54 +01:00
David van Moolenbroek 0cea0924a6 Import NetBSD vndconfig(8)
The tool has been changed heavily to match our VND driver model.

NetBSD is in the process of renaming it from vnconfig(8) to
vndconfig(8). To keep things in sync, we have to play along.

Change-Id: Ie86df184f03ab00573ea76b43c9caa0412e8321d
2014-03-01 09:04:54 +01:00
David van Moolenbroek 6989311826 Add VND driver, providing loopback devices
Change-Id: I40fa695e28c67477a75383e6f1550e451afcab41
2014-03-01 09:04:54 +01:00
David van Moolenbroek dba2d1f8b4 VFS: add dupfrom(2) call
This call copies a file descriptor from a remote process into the
calling process. The call is for the VND driver only, and in the
future, ACLs will prevent any other process from using this call.

Change-Id: Ib16fdd1f1a12cb38a70d7e441dad91bc86898f6d
2014-03-01 09:04:54 +01:00
David van Moolenbroek d266a94fea Enable devname(3)
There is no support for a device name database yet, so this call is
expected to be fairly slow.

Change-Id: I73aa5f267e2b6921b7d3bbdcc4beac463931132c
2014-03-01 09:04:53 +01:00
David van Moolenbroek 1760f1c717 Straighten ioctl.h
- include all ioctl subheaders, properly listing all letters;
- change FBD's ioctl calls to use 'B' instead of 'F', in
  preparation of the VND driver.

Change-Id: Ia718979568cc057f47cf505a89238d5b3b6695d4
2014-03-01 09:04:53 +01:00
David van Moolenbroek b48542d914 VM: readd support for forgetting cached FS blocks
Not all services involved in block I/O go through VM to access the
blocks they need.  As a result, the blocks in VM may become stale,
possibly causing corruption when the stale copy is restored by a
service that does go through VM later on.  This patch restores support
for forgetting cached blocks that belong to a particular device, and
makes the relevant file systems use this functionality 1) when
requested by VFS through REQ_FLUSH, and 2) upon unmount.

Change-Id: I0758c5ed8fe4b5ba81d432595d2113175776aff8
2014-03-01 09:04:53 +01:00
David van Moolenbroek 665198b4c2 Rewrite character driver protocol
As a side effect, remove the clone style, as the normal device style
supports device cloning now.

Change-Id: Ie82d1ef0385514a04a8faa139129a617895780b5
2014-03-01 09:04:52 +01:00
David van Moolenbroek 87337273e4 Remove support for reopening character devices
Previously, VFS would reopen a character device after a driver crash
if the associated file descriptor was opened with the O_REOPEN flag.
This patch removes support for this feature. The code was complex,
full of uncovered corner cases, and hard to test. Moreover, it did not
actually hide the crash from user applications: they would get an
error code to indicate that something went wrong, and have to decide
based on the nature of the underlying device how to continue.

- remove support for O_REOPEN, and make playwave(1) reopen its device;
- remove support for the DEV_REOPEN protocol message;
- remove all code in VFS related to reopening character devices;
- no longer change VFS filp reference count and FD bitmap upon filp
  invalidation; instead, make get_filp* fail all calls on invalidated
  FDs except when obtained with the locktype VNODE_OPCL which is used
  by close_fd only;
- remove the VFS fproc file descriptor bitmap entirely, returning to
  the situation that a FD is in use if its slot points to a filp; use
  FILP_CLOSED as single means of marking a filp as invalidated.

Change-Id: I34f6bc69a036b3a8fc667c1f80435ff3af56558f
2014-03-01 09:04:52 +01:00
David van Moolenbroek f6915d3dee Make PFS backcalls regular VFS calls
- prefix them with VFS_ as they are going to VFS;
- give these calls normal call numbers;
- give them their own set of message field aliases;
- also make do_mapdriver a regular call.

Change-Id: I2140439f288b06d699a1f65438bd8306509b259e
2014-03-01 09:04:52 +01:00
David van Moolenbroek 3d697930dd TTY: use libchardriver; clean up
- writing to a PTY master side blocks if there is not already a
  blocked reader on the slave side, and select now reflects this;
- internally, TTY now uses a test based on "caller != NONE" rather
  than "grant != GRANT_INVALID" to identify whether a call is
  currently ongoing;
- "offset" fields have been removed as they equal the corresponding
  "cum" fields;
- improved variable typing and function naming here and there;
- various other small fixes.

Change-Id: I6b51452888942e864b4e034e8c8490576184a23e
2014-03-01 09:04:52 +01:00