Commit Graph

1248 Commits

Author SHA1 Message Date
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
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 22ad44d6a9 libutil: add getmaxpartitions() implementation
Change-Id: I6f1d7838e10bcb079fb5b68ff513c3279fffb4f9
2015-10-07 12:36:36 +02: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 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 040ec64444 libfetch: switch to external/bsd version
Change-Id: I7eb6fbf0ae6c008e399fe9bffdfc2b98dfed3432
2015-09-23 12:03:08 +00:00
Cristiano Giuffrida 3f82ac6a4e services: Selectively enable stateful restart.
Change-Id: Ibf6afa3041013ca714e28b673abb1329cd72d2d5
2015-09-17 13:36:01 +00:00
Kaustubh Kelkar 989398b447 Importing bin/domainname utility
Change-Id: Iaf2067296195d2d55b93d00ac593b431572ca4cd
2015-07-28 21:56:19 +00:00
Jean-Baptiste Boric 1facb0487c libc: add posix_spawn family of functions
The implementation is taken from newlib (BSD licensed) and test84 is based
on NetBSD's t_spawn.c

Change-Id: Ia4e9dd5204a0b4ef241a451978057e11fb29e3d6
2015-07-28 14:18:03 +00:00
David van Moolenbroek 0184c63535 libc: fix sysctl(3) error code
All unimplemented sysctl calls would return 2 instead of -1.

Change-Id: Ib486a03dc93969e646e4e11d890dc46855d790c4
2015-07-24 23:12:36 +00:00
Ben Gras b329f2c73b libc: FTS support for dynamic inode numbering
Edited by Lionel Sambuc and David van Moolenbroek.

Change-Id: I29d6383499d8c0524f86f9dcec701aff35ce8a43
2015-06-29 10:58:08 +00:00
David van Moolenbroek da21d85025 Add PTYFS, Unix98 pseudo terminal support
This patch adds support for Unix98 pseudo terminals, that is,
posix_openpt(3), grantpt(3), unlockpt(3), /dev/ptmx, and /dev/pts/.
The latter is implemented with a new pseudo file system, PTYFS.

In effect, this patch adds secure support for unprivileged pseudo
terminal allocation, allowing programs such as tmux(1) to be used by
non-root users as well.  Test77 has been extended with new tests, and
no longer needs to run as root.

The new functionality is optional.  To revert to the old behavior,
remove the "ptyfs" entry from /etc/fstab.

Technical nodes:

o The reason for not implementing the NetBSD /dev/ptm approach is that
  implementing the corresponding ioctl (TIOCPTMGET) would require
  adding a number of extremely hairy exceptions to VFS, including the
  PTY driver having to create new file descriptors for its own device
  nodes.

o PTYFS is required for Unix98 PTYs in order to avoid that the PTY
  driver has to be aware of old-style PTY naming schemes and even has
  to call chmod(2) on a disk-backed file system.  PTY cannot be its
  own PTYFS since a character driver may currently not also be a file
  system.  However, PTYFS may be subsumed into a DEVFS in the future.

o The Unix98 PTY behavior differs somewhat from NetBSD's, in that
  slave nodes are created on ptyfs only upon the first call to
  grantpt(3).  This approach obviates the need to revoke access as
  part of the grantpt(3) call.

o Shutting down PTY may leave slave nodes on PTYFS, but once PTY is
  restarted, these leftover slave nodes will be removed before they
  create a security risk.  Unmounting PTYFS will make existing PTY
  slaves permanently unavailable, and absence of PTYFS will block
  allocation of new Unix98 PTYs until PTYFS is (re)mounted.

Change-Id: I822b43ba32707c8815fd0f7d5bb7a438f51421c1
2015-06-23 17:43:46 +00:00
David van Moolenbroek 22840dea11 libfsdriver: preinitialize stat.st_ino
The stat.st_ino field must always be filled with the inode number
given as part of the fdr_stat request anyway, so libfsdriver can
simply fill in the number and allow the file system not to bother.

Change-Id: Ia7a849d0b23dfc83010df0d48fa26e4225427694
2015-06-23 14:38:04 +00:00
David van Moolenbroek af4345b097 isofs: do not link against libc
This change requires a small patch to libc, in order to avoid that
libminc has to pull in a large chunk of libc just for mktime(3).

Change-Id: I48e598b3716eff626cac461f78a41e32334e6b28
2015-06-07 17:01:45 +00:00
Emmanuel Blot 4f89addcc1 Fix unused variable warnings
Do not define variables that are not used in Minix builds

Change-Id: I11d12e5e1de9fc359b71a7e7534fc8f09fac837d
2015-03-18 07:49:03 +01:00
Ben Gras 5ae1a533c7 ARM: can build with llvm, switch to EABI
. bitcode fixes
	. switch to compiler-rt instead of netbsd libc functions
	  or libgcc for support functions for both x86 and arm
	. minor build fixes
	. allow  build with llvm without crossbuilding llvm itself
	. can now build minix/arm using llvm and eabi - without C++
	  support for now (hence crossbuilding llvm itself is turned off
	  for minix/arm)

Change-Id: If5c44ef766f5b4fc4394d4586ecc289927a0d6eb
2014-12-12 13:04:56 +01:00
David van Moolenbroek 289b04677a libfsdriver: prefill st_dev for stat requests
This obviates the need for several file system implementations to
remember the device on which they are mounted.

Change-Id: Ida8325cf4bcf072e61761cfee34e3f7ed2d750b9
2014-11-14 15:54:16 +00:00
Lionel Sambuc 1230fdc108 external/mit/expat: Import
Change-Id: Ieb49357166b392956df6554a06fcae83c8fd519d
2014-11-10 14:43:28 +01:00
Lionel Sambuc 7eb99bda90 Importing lib/libpci
Change-Id: I21ae1e409286cec27c5e35677de3778a3f505d1e
2014-11-07 16:20:39 +01:00
David van Moolenbroek 5d259c7f93 libc: enable setproctitle(3)
Change-Id: I31bbc5d960c60f7347424ce3d8f4bce89b396339
2014-10-03 10:01:03 +00:00
David van Moolenbroek e985b92992 Import libevent
Change-Id: Ic75f4cac5eb07ffaba8f97d10673d7d7e2b1762d
2014-10-03 10:00:53 +00:00
David van Moolenbroek 1dcfbcd173 Remove support for call profiling
The entire infrastructure relied on an ACK feature, and as such, it
has been broken for years now, with no easy way to repair it.

Change-Id: I783c2a21276967af115a642199f31fef0f14a572
2014-09-30 12:39:03 +00:00
David van Moolenbroek ad80a203db Move clock_time into libsys
Change-Id: Ibc5034617e6f6581de7c4a166ca075b3c357fa82
2014-09-18 12:46:26 +00:00
David van Moolenbroek 81db4f2cff libpuffs: use libfsdriver
Change-Id: I26651578066e1098dc275a9cfbe5710870a13811
2014-09-18 12:46:25 +00:00
David van Moolenbroek 89c9de7d09 Add libfsdriver: a library to drive file systems
This library provides new abstractions for the upper (VFS) side of
file system services, and should be used for all file system service
implementations from now on.  It provides the following functionality:

  - a function call table abstraction, hiding the details of the
    VFS-FS protocol with simple parameters;
  - a (currently limited) number of per-function steps required for
    all file system implementations, such as copying in and out path
    names and result buffers;
  - a default implementation for multicomponent path lookups, such
    that the file system merely has to implement resolution of single
    components at a time;
  - an abstraction for copying data from and to the file system, which
    allows transparent intraprocess copying as required for the lookup
    implementation;
  - a set of functions to simplify getdents implementations.

The message loop provided by the library is currently for use by
single-threaded file system implementations only.  Multithreaded file
system services may use the more low-level message processing
functionality.

Protocol-level optimizations such as including names in protocol
messages may be hidden entirely in this library.  In addition, in the
future, the lookup implementation may be replaced by a single-
component lookup VFS/FS protocol request as part of a VFS name cache
implementation; this, too, can be hidden entirely in this library.

Change-Id: Ib34f0d0e021dfa3426ce8826efcf3eaa94d3ef3e
2014-09-18 12:46:23 +00:00
Lionel Sambuc 31b808b8fa Drop minix-malloc & friends
Known limitations:
 - comment for now testisofs, as iso9660fs is known to be broken.

Benefits:
 - near 3x speed improvement on C++ code compilation, bringing down
   make build to from 44min down to 21min.

 - Allows for X applications to work properly, which should be available
   in near-term future through pkgsrc for 3.3.0.

Change-Id: I8f4179a7ea925ed381642add32cfd8c5822217e4
2014-09-08 17:30:18 +02:00
Ben Gras bad58c9c51 merge libminlib with libc
Change-Id: I79cc4ea90c378a1da3dac16487b53034953827a7
2014-08-28 18:49:19 +02:00
Ben Gras c2808d8b07 remove libcompat_minix as library
. get rid of includes in libcompat_minix:
	  . move configfile.h to minix/include/
	  . all others are unneeded as they point to other files
	. merge the .c files with libc

Change-Id: I5e840c66fb9bc484f377926aa9d66473bbd16259
2014-08-28 18:49:13 +02:00
Lionel Sambuc 433d6423c3 New sources layout
Change-Id: Ic716f336b7071063997cf5b4dae6d50e0b4631e9
2014-07-31 16:00:30 +02:00
Lionel Sambuc 6082b2b4de Message type for COMMON_REQ_GCOV_DATA.
Change-Id: I97d31059990e33411a685d5d8191c728a02e7d0f
2014-07-28 17:06:28 +02:00
Lionel Sambuc 43d985050c Use one message type for all BDEV request.
There are missing field assignements, and/or messsages being re-used
without re-initializations, which allows for fields to be implicitly
forwarded.

This prevents me from creating per request message types, as I can't
spend currently any more time debugging this issue.
2014-07-28 17:06:28 +02:00
Lionel Sambuc 0522c9d0c1 Message type for BDEV_REPLY.
Change-Id: I48ca5a4f77cc9e924e8aee2fe6c32e0da9b42560
2014-07-28 17:06:27 +02:00
Lionel Sambuc 8644f25feb Message type for SYS_PROFBUF.
Change-Id: I10c1e878b0e3ff9bfc52709cc87dace632fa3e4f
2014-07-28 17:06:27 +02:00
Lionel Sambuc 64fb3a184c Message type for SYS_CPROF and PM_CPROF.
Change-Id: I2dc3d9d95c2a2b4c5fdbceae359b0be2bbdf9fb5
2014-07-28 17:06:26 +02:00
Lionel Sambuc 8ad307eeed Message type for SYS_SPROF and PM_SPROF.
Change-Id: I598f88af47737be0172236fa9ad24058b50d3942
2014-07-28 17:06:26 +02:00
Lionel Sambuc 9ea21ea158 Message type for SYS_DIAGCTL.
Change-Id: Icdaa84847f8c75f5af6612dda3326f800166e0d7
2014-07-28 17:06:25 +02:00
Lionel Sambuc 93b1819dac Message type for SIGS_SIGNAL_RECEIVED.
Change-Id: I5c13ff06e0203a98d4087829308d03020f302542
2014-07-28 17:06:25 +02:00
Lionel Sambuc f45c6b86cb Message type for SYS_READBIOS.
Change-Id: Id19f658f5eb5f350e3e19f9ce3f8ae80aea23c51
2014-07-28 17:06:25 +02:00
Ben Gras 5d0e31dbb3 custom message req & reply types for ds 2014-07-28 17:06:24 +02:00
Ben Gras c727357664 custom types for RS_INIT, RS_UPDATE, and others 2014-07-28 17:06:23 +02:00
Ben Gras 9961d3d3e5 custom message types for safecopy calls 2014-07-28 17:06:23 +02:00
Ben Gras c24f718bb4 custom message type for VM_UNMAP_PHYS 2014-07-28 17:06:23 +02:00
Ben Gras 6af75e6660 custom message type for vm_map_phys 2014-07-28 17:06:22 +02:00
Ben Gras 8c2ac80abd custom message type for VM_BRK 2014-07-28 17:06:22 +02:00
Ben Gras 7cb7ac5b42 use custom mmap struct type directly 2014-07-28 17:06:21 +02:00
Ben Gras 3610b3b1a6 custom message type for SYS_DEVIO 2014-07-28 17:06:21 +02:00
Ben Gras fce93dad32 custom message type for SEMOP 2014-07-28 17:06:21 +02:00
Ben Gras c476408dea custom message type for SHMCTL, SEMCTL, SEMGET 2014-07-28 17:06:20 +02:00
Ben Gras e57d31d331 custom messages for SHMAT, SHMDT 2014-07-28 17:06:20 +02:00