Commit Graph

6848 Commits

Author SHA1 Message Date
Sanchayan Maity 368b5fc155 Initialise the "name" variable properly and compare all 32 bytes
Without this patch, calling sys_mq_open() with same names specified
results in two separate queues being opened and their descriptors
returned instead of the same descriptor being returned for both.

Do the initialisation and comparison properly, so that when the
same name is specified to sys_mq_open multiple times in same
process or different process, the same opened queue descriptor is
returned.
2016-03-23 11:11:30 +05:30
Sanchayan Maity 8501cb7ed8 Allow users to request a asynchronous notification
This patch adds functionality to request an asynchronous notification
if some other process has send a message to it. We currently send a
SIGALRM to avoid any changes to core infrastructure of signal handling.
Ideally we should implement a separate signal for this. Currently there
is an obvious disadvantage of not being able to use SIGALRM with alarm,
if we are using this functionality.
2016-03-22 17:51:09 +05:30
Sanchayan Maity 55d341bc54 Allow users to get and set attributes
Currently we only allow users to get and set number of queues. The
operation is always non blocking. There is no provision for non
blocking operation at the moment.

The queue sizes are set to MAX 256 by default. If a user changes the
attributes and sets the queue size or number of messages in a queue
to less than 256, it is the responsibility of the user to close any
queues which were opened with a descriptor greater than the value
currently set.

For example, by default queue sizes are 256. If 150 queues are opened
and then the user sets the number of queues to 32, all open descriptors
and queues from 32 to 150 must be closed. Note that descriptor number
allocation starts with zero and not one.
2016-03-22 15:57:53 +05:30
Sanchayan Maity d84b3d9248 Miscellaneous cleanup 2016-03-19 17:42:29 +05:30
Sanchayan Maity 0cc443d3c2 Fix message priority implementation
Functional specification mandates returning a message with a higher
timestamp in case two messages have the same priority. Somehow we
missed this in the implementation. This also introduced a bug where
all messages with same priority could cause problems.
2016-03-19 16:54:26 +05:30
Sanchayan Maity fe71ea4bc1 First round of assorted bug fixes
Fixed the following bugs:
1. Message priority was not set at all at two places
2. Limits check was not correct while returning error values
3. We are suppose to allow multiple users operate on the same queue
using a named descriptor. However any one user calling close before
the other would result in closing the queue even when other users
might be using it. Track number of users and close only if number of
users is zero. Yet to do functional tests for this, so this is untested,
but introduce it anyway at this juncture.
2016-03-19 11:49:48 +05:30
Sanchayan Maity d2fb3a4b8a Allow user processes to send messages to kernel
This patch allows user processes to send messages to kernel. Without
this change, trying to do a system call for using message queues like
sys_mq_open will fail with ECALLDENIED error number -210.
2016-03-16 23:30:06 +05:30
Sanchayan Maity 58ce9ca12b Fix return values used in mq_open 2016-03-15 19:51:08 +05:30
Sanchayan Maity df5a0e339c Limit the number of queues to 16 2016-03-15 19:39:03 +05:30
Sanchayan Maity 63062e7e15 Add message queue support for Minix
Implement message queues support for Minix.

Pending tasks:
Blocking or non blocking for send receive?
Sort by priority and time?
Test codes?
Bug fixes?
2016-03-07 17:41:07 +05:30
Sanchayan Maity 6f36b466f3 minix: Prepare for message queue support to Minix kernel
This commit adds preparatory support for forthcoming message
queue implementation to the Minix kernel. The core implementation
will be added with the next commit.
2016-02-29 20:43:07 +05:30
Sanchayan Maity 06b223febe etc: boot.cfg.default: Enable virtio_blk by default
Enable virtio_blk by default. This is required for networking to
work under qemu.
2016-02-27 15:33:54 +05:30
Sanchayan Maity dda907e345 kernel: main: Add name and IIT CWID to immediate startup message for Project 0 2016-01-28 14:24:53 +05:30
Sanchayan Maity 327ec363db etc/motd: Add name and IIT CWID for Project 0 2016-01-15 09:34:49 +05:30
Lionel Sambuc 8933525b85 Fix default partition in clientctl.
The partition numbering has changed with the new image creation
framework.

Change-Id: I0644e5879913bee067bc31376f81bc5407f4c81f
2015-10-28 16:06:52 +01:00
rlfnb 2d51bc645f Add boot menu entry to boot an ALIX SBC.
closes #95

Change-Id: Ifb49cb8e4730d50d2d6a33fcb5e9f08ac790b512
2015-10-28 14:01:13 +01:00
David van Moolenbroek 2e23f1755e libc: fix needless malloc failures
The NetBSD libc malloc implementation performs its own out-of-memory
check, presumably for performance reasons.  The check makes a strong
assumption about the address space layout, which is that memory-
mapped pages are always located above the heap.  However, this
assumption does not necessarily hold on MINIX3, thus resulting in
malloc reporting an out-of-memory condition without the system
actually being out of memory at all.  Evidence suggests that in
particular dynamically linked (i.e., pkgsrc) binaries were affected
by this issue - most notably git.

Change-Id: If542fbace0a1cce12aa9e075d51992cbbbf26e94
2015-10-28 01:13:04 +00:00
Jean-Baptiste Boric 2d6bbeb0b9 Split minix distribution set
The minix set is now divided into minix-base, minix-comp, minix-games,
minix-kernel, minix-man and minix-tests.

This allows massive space savings on the installlation CD because only
the base system used for installation is stored uncompressed. Also, it
makes the system more modular.

Change-Id: Ic8d168b4c3112204013170f07245aef98aaa51e7
2015-10-12 11:25:54 +02:00
Lionel Sambuc 240e6259de Upgrade releasetools/sort_set
- retire the old shell script
 - import perl script

The perl scripts has the following advantages:
 - The sorting should be more stable, even accross different OSes.
 - The sorted output is automatically formatted into columns
 - It is much faster, even on large inputs.

Change-Id: I1068b21fda981b4cf9eeea4af83165ec2968280b
2015-10-10 23:58:31 +02:00
Jean-Baptiste Boric 69eead77ff New image framework generation
The CD now boots directly from the ISO 9660 filesystem instead of using
MBR partitioning with Minix file systems. This saves some space on the
CD and reduces memory requirements by some unknown amount as the root
ramdisk is completely eliminated.

The x86 hard drive image creation is also rewritten in the same
fashion.

The setup is modified to be more NetBSD-like (unpacking sets
tarballs instead of blindly copying the CD contents). Splitting MINIX
into sets is done in another commit due to it being a nightmare to
rebase.

Since MINIX lacks union mounts for now, a bunch of ramdisks are
generated at run-time to make parts of the filesystem writeable for the
CD. This solution isn't ideal, but it's enough for an installation CD.

Change-Id: Icbd9cca4dafebf7b42c345b107a17679a622d5cd
2015-10-10 19:09:35 +02:00
Lionel Sambuc b5400f9ff4 pkg_install: Set default paths as expected on MINIX
Change-Id: I97568cb5c92d14b7175ba0ed0f3efb2009d0c455
2015-10-09 15:49:42 +02:00
Jean-Baptiste Boric 9dfdf6f7ba ramdisk: fix command output to stdout
Change-Id: I58a8cf2cd05b71dbbc1784c7d5770279392e3a8b
2015-10-08 12:11:03 +02:00
Jean-Baptiste Boric 9af3a794f6 Add installboot to host tools
Change-Id: I5594cfdb13362b51f86b9ef76e82c21402c47f8d
2015-10-08 12:10:51 +02:00
Jean-Baptiste Boric 43afffcd77 Add makefs to host tools
Change-Id: I217c0b6f1a78622636d541fa80b93b6d148e3681
2015-10-08 11:58:39 +02:00
Jean-Baptiste Boric a824f5a100 Import pkg_install from NetBSD
Change-Id: I9a3071b94dd2e9bfe2e3b162994e06ae10077b5a
2015-10-07 23:48:43 +02:00
Lionel Sambuc ebfedea0ce Importing crypto libraries
- crypto/external/bsd/heimdal
 - crypto/external/bsd/libsaslc
 - crypto/external/bsd/netpgp
 - crypto/external/bsd/openssl

Change-Id: I91dbf05f33e637edf5b9bb408d5baddd7ba8cf75
2015-10-07 23:37:12 +02:00
Jean-Baptiste Boric b1d068470b isofs: reworked for better performance
isofs now uses an in-memory directory listing built on-the-fly instead
of parsing the ISO 9660 data structures over and over for almost every
request. This yields huge performance improvements.

The directory listing is allocated dynamically, but Minix servers aren't
normally supposed to do that because critical servers would crash if the
system runs out of memory. isofs is quite frugal, won't allocate memory
after having the whole directory tree cached and is not that critical
(its most important job is to serve as a root file system during
installation).

The benefits and elegance of this scheme far outweights this small
problem in practice.

Change-Id: I13d070388c07d274cbee0645cbc50295c447c5b6
2015-10-07 12:40:24 +02:00
Jean-Baptiste Boric 3472022b8b makefs: apply NetBSD PR kern/48852 patch
It's a fix for correcting cd9660 device node creation in makefs. This
fix was commited in NetBSD on May 30, 2014, after the current NetBSD
source code import, hence the cherrypicking.

Change-Id: Id3e05618688bbd6d07780f46f6ada90525556b5a
2015-10-07 12:40:05 +02:00
Jean-Baptiste Boric 9f988b7934 Import makefs from NetBSD
Change-Id: I0ebcc9d0168df9d26cfb0af0fce2bc894ce688af
2015-10-07 12:39:44 +02:00
Jean-Baptiste Boric 22ad44d6a9 libutil: add getmaxpartitions() implementation
Change-Id: I6f1d7838e10bcb079fb5b68ff513c3279fffb4f9
2015-10-07 12:36:36 +02:00
Lionel Sambuc 41a30155b9 Fix gcc -O1 builds for ARM
The builds are failing as GCC somehow thinks ino might be
uninitialized before use.

Change-Id: Id99fd5e46bcbaafd5001752e16c3f77c1d568556
2015-10-04 03:47:57 -07:00
David van Moolenbroek b7f0178aeb Import NetBSD time(1)
Change-Id: I035d21a926aa82434c24a84b914bd58ac064e66a
2015-09-29 18:16:14 +00:00
David van Moolenbroek d1e4d7ce7d Import NetBSD csh(1)
Jobctl warning commented out.  Largely untested.

Change-Id: I4dffe23a2855a374628c820703b51591633aed64
2015-09-29 18:15:52 +00:00
David van Moolenbroek 29346ab043 PM: add support for wait4(2)
This patch adds support for the wait4 system call, and with that the
wait3 call as well.  The implementation is absolutely minimal: only
user and system times of the exited child are returned (with all other
rusage fields left zero), and there is no support for tracers.  Still,
this should cover the main use cases of wait4.

Change-Id: I7a04589a8423a23990ab39aa38e85d535556743a
2015-09-29 18:15:28 +00:00
David van Moolenbroek bc2d75fa05 Rework getrusage(2) infrastructure
- the userland call is now made to PM only, and PM relays the call to
  other servers as appropriate; this is an ABI change that will
  ultimately allow us to add proper support for wait3() and the like;
  for the moment there is backward compatibility;
- the getrusage-specific kernel subcall has been removed, as it
  provided only redundant functionality, and did not provide the means
  to be extended correctly in the future - namely, allowing the kernel
  to return different values depending on whether resource usage of
  the caller (self) or its children was requested;
- VM is now told whether resource usage of the caller (self) or its
  children is requested, and it refrains from filling in wrong values
  for information it does not have;
- VM now uses the correct unit for the ru_maxrss values;
- VFS is cut out of the loop entirely, since it does not provide any
  values at the moment; a comment explains how it should be readded.

Change-Id: I27b0f488437dec3d8e784721c67b03f2f853120f
2015-09-28 14:06:59 +00:00
David van Moolenbroek 0f8e20a12c getrusage(2): zero out ru_nsignals field
The current value was both wrong (counting spawned kernel signals
rather than delivered user signals) and returned for the calling
process even if the request was for the process's children.
For now we are better off not populating this field at all.

Change-Id: I6c660be266b5746b7c3db57ae88fa7f872961ee2
2015-09-28 14:06:58 +00:00
David van Moolenbroek cd27b2627a getrusage(2): zero out ru_i[xds]rss fields
The current values were both inaccurate (especially for dynamically
linked executables) and using the wrong unit (bytes, instead of
kilobytes times ticks-of-execution).  For now we are better off not
populating these fields at all.

Change-Id: I195a8fa8db909e64a833eec25f59c9ee0b89bdc5
2015-09-28 14:06:58 +00:00
David van Moolenbroek 0f5c95a00b PM: make child time accumulation POSIX compliant
POSIX states that times() and getrusage() should only return child
user and system times of terminated children for which wait*() has
returned their PIDs.

Change-Id: I38e19ad71543a3b91e944bef8e4e1bd903de51bf
2015-09-28 14:06:57 +00:00
David van Moolenbroek b80da2a01d commands: move manpages into command directories
Change-Id: Icf8a2d26629a1822725022c9ee21c587d3c4c3b4
2015-09-28 14:06:06 +00:00
Lionel Sambuc 81b1f87117 Fix noassert builds
Change-Id: I5626950ffa29afe7a0fb9e9144839b311824da92
2015-09-25 15:47:43 -07:00
David van Moolenbroek ba736c7968 libpuffs: clean up, unbreak
- move MINIX3-specific files into minix/lib/libpuffs;
- resynchronize the remaining files with NetBSD code;
- remove a few unnecessary changes;
- put remaining MINIX3-specific changes in __minix blocks;
- sort out the source files being linked at all.

The result is that libpuffs now successfully links against FUSE
file system programs again.  It can successfully mount, perform
some of the most basic operations, and unmount the file system.

Change-Id: Ieac220f7ad8c4d1fa293abda81967e8045be0bb4
2015-09-23 12:05:03 +00:00
David van Moolenbroek 7c48de6cc4 Resolve more warnings
Change-Id: Ibc1b7f7cd45ad7295285e59c6ce55888266fece8
2015-09-23 12:04:58 +00:00
David van Moolenbroek 9488aa4c04 Import NetBSD flock(1)
Also fix the MINIX3 libc flock(3) implementation.

Change-Id: Ia80280029968786d7f029940ec02e942057701bd
2015-09-23 12:03:13 +00:00
David van Moolenbroek 875abb8724 swifi: various improvements
- no longer inject fewer faults than instructed;
- no longer apply a limit on the number of injected faults;
- refactory to allow for random faults (type 99);
- also allow for stop faults (type 50);
- massive dead code cleanup;
- move outdated test cruft into tests/ subdirectory; it is kept only
  as an example of how to use swifi.

Change-Id: I8a3cb71902dfaadb7bf785723b917307db83d0d5
2015-09-23 12:03:12 +00:00
David van Moolenbroek 32b187558b Deprivilege some network commands
At the very least, these can be used to test for the existence of
files not normally accessible by unprivileged users.

Change-Id: I054cf6d033a1604bbbc871db37103a67067abe84
2015-09-23 12:03:12 +00:00
David van Moolenbroek d0055759dd commands: resolve compiler warnings
Change-Id: I95f0d0c48f998d4d950a0800eedd5fbbf2e50423
2015-09-23 12:03:11 +00:00
David van Moolenbroek fd962fdd93 Retire decomp16(1)
Change-Id: I455aac47b3efa4ffa5cc8305c6760f92e1e8642a
2015-09-23 12:03:11 +00:00
David van Moolenbroek c0d9ad695c Retire ci(1), co(1), svclog(1)
Change-Id: I1bd1d92b9aacd4dfc4843c423862ae540fe2b557
2015-09-23 12:03:10 +00:00
David van Moolenbroek 33513d60e9 fbdctl(8): move to proper location
- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: I1206b52e8804a68a3a80f6d7f63916e7fcdc9e3f
2015-09-23 12:03:10 +00:00
David van Moolenbroek c175cce5e6 diskctl(8): move to proper location
- move from minix/commands to minix/usr.sbin;
- install into /usr/sbin instead of /usr/bin;
- move manual page into source directory;
- resolve compilation warning;
- convert to KNF.

Change-Id: Iccb4a8b27ae220254bae19e9198478b40706f542
2015-09-23 12:03:09 +00:00