Commit graph

378 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
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 7c48de6cc4 Resolve more warnings
Change-Id: Ibc1b7f7cd45ad7295285e59c6ce55888266fece8
2015-09-23 12:04:58 +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 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 5d259c7f93 libc: enable setproctitle(3)
Change-Id: I31bbc5d960c60f7347424ce3d8f4bce89b396339
2014-10-03 10:01:03 +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
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 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
Ben Gras c727357664 custom types for RS_INIT, RS_UPDATE, and others 2014-07-28 17:06:23 +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 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
Ben Gras 8627d33a42 custom message for SHMGET 2014-07-28 17:06:19 +02:00
Ben Gras 01a50f57d8 custom message type for VM_GETREF 2014-07-28 17:06:17 +02:00
Ben Gras 28b5360df7 custom message type for VM_GETPHYS 2014-07-28 17:06:17 +02:00
Ben Gras 324fc1f604 custom message type for VM_SHM_UNMAP 2014-07-28 17:06:17 +02:00
Ben Gras e3a0e6c3c3 custom message type for VM_REMAP, VM_REMAP_RO 2014-07-28 17:06:16 +02:00
Lionel Sambuc 4684ddb6aa LLVM Minix changes
- import libcxx
 - reduce targets to the one when compiled as a tools

Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
2014-07-28 17:05:59 +02:00
David van Moolenbroek 69cba46141 libc: make ttyname(3) use devname(3)
There was an off-by-one in the old MINIX-specific implementation,
which caused ttyname(3) to fail at random. Since we now have a working
devname(3), there is no need for MINIX-specific code anymore here.

Change-Id: I27d8b6c4f66c84f383156ed494b740d071af02a7
2014-07-28 17:05:53 +02:00
Lionel Sambuc 948a5389f9 Message type for SVRCTL
Change-Id: Ibdb9edb9878e06cf2a641ffc3975f878a6e41dfb
2014-07-28 17:05:45 +02:00
Lionel Sambuc 6c313721d3 Message type for {PM,VFS,VM}_GETRUSAGE
Change-Id: I793d2e9fa8eb0562a46ccbd81aae3dbb517671cc
2014-07-28 17:05:44 +02:00
Lionel Sambuc b90d99dab3 Message type for PM_{KILL,SIGACTION}
Change-Id: I7fac9a894e319671e12bfa7430984ca1cf24da33
2014-07-28 17:05:42 +02:00
Lionel Sambuc 9a4c1520cf Message type for PM_SIG{RETURN,SUSPEND,PROCMASK}
Change-Id: Id20352db47892eb6b870ea64ba52b3b1a293cbaa
2014-07-28 17:05:42 +02:00
Lionel Sambuc 6495d409d6 Message type for PM_EXIT
Change-Id: Ie78768d95358a701268129587074a48493cf5bbc
2014-07-28 17:05:42 +02:00
Lionel Sambuc 048d0f0d62 Message type for PM_EXEC
Change-Id: I6738716ba835d6196519056bb77afa8ec99f122a
2014-07-28 17:05:38 +02:00
Lionel Sambuc e1986cd160 Message type for PM_MCONTEXT
Change-Id: I4ab9fc23ce8d78e03582580feba5ba96541f0f7e
2014-07-28 17:05:37 +02:00
Lionel Sambuc ca31c1caae Message type for PM_GETSID
Change-Id: Ife3f9f6a7b6190baca6f379f7d3c36388baf6904
2014-07-28 17:05:37 +02:00
Lionel Sambuc f63d2f0eaf Message type for PM_GETPID
Change-Id: Ib3ff13ad9c9e30bde08d4cacb6905955ace73924
2014-07-28 17:05:37 +02:00
Lionel Sambuc cc852e7783 Message type for PM_SET{,E}GID
Change-Id: I489d9290553b28361344e0cfd59c31e7e672c22c
2014-07-28 17:05:37 +02:00
Lionel Sambuc a6c5528e96 Message type for PM_SET{,E}UID
Change-Id: I5421646713e74562400e705b4a0f8b99f1325d64
2014-07-28 17:05:37 +02:00
Lionel Sambuc b9939b3ed8 Message type for PM_GETGID
Change-Id: If3f788b0ad5a7389a62ecec3da78d6d71090f9a8
2014-07-28 17:05:37 +02:00
Lionel Sambuc ba70f58845 Message type for PM_GETUID
Change-Id: I9a04f5a8b0e9099e0df543bcf76b2610a8803b9a
2014-07-28 17:05:36 +02:00
Lionel Sambuc 70a744da37 Message type for PM_REBOOT
Change-Id: I8de1b0de1a4c79f60a7df4720943ed9d0a19725c
2014-07-28 17:05:36 +02:00
Lionel Sambuc c3629bba0b Message type for PM_GROUPS
Change-Id: I9e3b784143dd0294a8aad27e3cc588e5b57dabfc
2014-07-28 17:05:36 +02:00
Lionel Sambuc 865f761364 Message type for PM_{S,G}ET_PRIORITY
Change-Id: I3cf77f786751ca7e5a8cd13b8716b228d0fbf7fe
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