Commit graph

378 commits

Author SHA1 Message Date
Ben Gras 5cecdfcb3e <machine/mcontext.h>
Change-Id: I2ad64018f3f402e7ccc5c4dc037dd0a3fe56a929
2014-03-03 20:47:03 +01:00
Ben Gras 17587738d3 align <sys/ucontext.h> <sys/uio.h> <sys/un.h>
Change-Id: I70adf01fddf931a3a6931083adaa4bbe647ea6a3
2014-03-03 20:47:03 +01:00
Ben Gras 01624e6f86 <sys/socket.h>, <netinet/{in,tcp,udp,udp_var}.h>
. add sa_len to sockaddr, sin_len to sockaddr_in
	. rename SCM_CREDENTIALS to SCM_CREDS
	. retire PF_FILE (same as PF_UNIX)

Change-Id: Id3ec63fe2556fc7ceb48de8ad4e80736df3ddfc7
2014-03-03 20:47:03 +01:00
Ben Gras dda632a24f drop the minix_ prefixes for mmap and munmap
also cleanup of various minix-specific changes, cleanup of
mmap-related testing.

Change-Id: I289a4fc50cf8a13df4a6082038d860853a4bd024
2014-03-03 20:47:03 +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 afc1f71188 include/paths.h: merged
Change-Id: I5e2aa0bc99a596f82ef4224f22623bcb83cb98b5
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 b33edbfe7a Removing VFS_UTIMENS_* field macros.
Change-Id: I3be1acfbb77b6e229d784d8dbc3ceec1b26abf90
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 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 364953ad40 <sys/stat.h>
current version of <sys/stat.h> from netbsd repo is older than the minix
one; will be corrected on next netbsd re-import.

Change-Id: Ifc696581ef476cfecd9695a9f6e74b844131e584
2014-03-02 12:28:33 +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 9a2e578a5c Remove sys/stdlib.h
This file was copied over to allow for the compilation of some
of the arch/i386 code, due to a bug in lib/libc/compat/Makefile.inc.

This patch fixes the situation, and removes the now useless header, as
well as remove a patch in lib/libc/stdlib/putenv.c

Change-Id: Ic5e4c4bb967f58f6e874c091788e1dd5ecaebe5e
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 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 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 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 3e8346a8e8 UDS: support for nonblocking sockets
This patch includes several other fixes, which are now tested in the
test56 test set.

Change-Id: I9535d5a6c072abf966252838522c5f65b353c6c2
2014-03-01 09:04:57 +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 b443e9244d Retire EBADIOCTL in favor of ENOTTY
Change-Id: I6bd0e301d21ab7f2336e350e7e6e15d238c2c93d
2014-03-01 09:04:51 +01:00
David van Moolenbroek 6331e8f845 Retire the synchronous character driver protocol
- change all sync char drivers into async drivers;
- retire support for the sync protocol in libchardev;
- remove async dev style, as this is now the default;
- remove dev_status from VFS;
- clean up now-unused protocol messages.

Change-Id: I6aacff712292f6b29f2ccd51bc1e7d7003723e87
2014-02-18 11:25:02 +01:00
Lionel Sambuc cfd3379bb1 Removing CSU patches
* Removed startup code patches in lib/csu regarding kernel to userland
   ABI.

 * Aligned stack layout on NetBSD stack layout.

 * Generate valid stack pointers instead of offsets by taking into account
   _minix_kerninfo->kinfo->user_sp.

 * Refactored stack generation, by moving part of execve in two
   functions {minix_stack_params(), minix_stack_fill()} and using them
   in execve(), rs and vm.

 * Changed load offset of rtld (ld.so) to:
      execi.args.stack_high - execi.args.stack_size - 0xa00000
   which is 10MB below the main executable stack.

Change-Id: I839daf3de43321cded44105634102d419cb36cec
2014-02-18 11:25:02 +01:00
David van Moolenbroek 24ed4e38de Remove support for obsolete 3.2.1 ABI
Change-Id: I76b4960bda41f55d9c42f8c99c5beae3424ca851
2014-02-18 11:25:02 +01:00
David van Moolenbroek 430c2113c7 Enable getmntinfo(3)
Change-Id: Ida9b0660471bb9fde3cdca6c9b9fd9e94341e02f
2014-02-18 11:25:02 +01:00
David van Moolenbroek 8143b9bf1d Implement support for [f]statvfs1(2)
The [f]statvfs(3) calls now use [f]statvfs1(2).

Change-Id: I949c177fc14abf976e45165c342f897f4ec988ee
2014-02-18 11:25:02 +01:00
David van Moolenbroek 266239fe64 Implement support for getvfsstat(2)
Change-Id: I99b697919d411c57105de561105beefc7d1d309a
2014-02-18 11:25:02 +01:00
David van Moolenbroek 7113bcb896 Redo mount(2)/umount(2) ABI
- pass in file system type through mount(2), and return this type in
  statvfs structures as generated by [f]statvfs(2);
- align mount flags field with NetBSD's, splitting out service flags
  which are not to be passed to VFS;
- remove limitation of mount ABI to 16-byte labels, so that labels
  can be made larger in the future;
- introduce new m11 message union type for mount(2) as side effect.

Change-Id: I88b7710e297e00a5e4582ada5243d3d5c2801fd9
2014-02-18 11:25:01 +01:00
David van Moolenbroek f10229eafb VFS/FS: remove fstatfs(2) and REQ_FSTATFS
The fstatfs(3) call now uses fstatvfs(2).

Change-Id: I3fa5d31f078457b4d80418c23060bb2c148cb460
2014-02-18 11:25:01 +01:00
Lionel Sambuc f84d21b043 almost aligned ioctl prototype
Change-Id: I7f3eaa99d2a9767f71e8387cea5c7f56dcb28f99
2014-02-18 11:25:01 +01:00
Lionel Sambuc 55dcce66c6 struct uucred
Change-Id: Ia97cb6c38bb566be30d568a252ae7b76142a21dd
2014-02-18 11:25:01 +01:00
Thomas Veerman c1a31d53d9 stat.h: remove some big_ types
Change-Id: I84017db3d54edfb823cc52e02d0b07fccb003988
2014-02-18 11:25:01 +01:00
Jan Wieck 6a60dd0a19 Add UDP support to getsockname(2) and getpeername(2).
Change-Id: Ic035b961fb21a6fae75d3af87d714008ecedb874
2013-10-26 15:26:08 -04:00
Thomas Cort 1e69cb63f4 Importing usr.bin/nl
* Add _SC_LINE_MAX to unistd.h (value of 15 from NetBSD).
 * Add _SC_LINE_MAX case to sysconf(3) in libc.
 * usr.bin/nl itself required no Minix specific changes.

Change-Id: I10f056ccdf4f212beb1272f735f41303e5036c05
2013-10-14 18:06:05 -04:00
Ben Gras 6e5a113837 a bit more -Werror compatability
for clang, fix warnings in drivers/, lib/, servers/, sys/, common/.
by turning off fatal warnings (takes effect if the default is on),
fixing warnings or reducing the warning level.

Change-Id: Ia1b4bc877c879ba783158081b59aa6ebb021a50f
2013-08-20 11:37:40 +02:00
Antoine Leca 3a0aa55040 libc: make MINIX assembly code position-independent
While here, simplify ucontext.S

	. makes libc link without the messy DT_TEXTREL warning.

Change-Id: I4656d9068eab5ed2fa1e391242883d5dd9d93644
2013-08-09 11:09:51 +02:00
Thomas Cort 550fdfb443 i2c: initial bus drivers for am335x and dm37xx
Change-Id: I478704fbf30dbf6d3382bcbfb11e75b512c032a1
2013-07-15 11:11:13 -04:00
Thomas Veerman 2a8a99cc6a libc: revert inadvertent removal of O_CLOEXEC #ifndefs
Change-Id: I15005181388280363f7aee546bd2ecc0cd5b37e6
2013-07-12 18:39:12 +02:00
Xiaoguang Sun 64f10ee644 Implement getrusage
Implement getrusage.
These fields of struct rusage are not supported and always set to zero at this time
long ru_nswap;           /* swaps */
long ru_inblock;         /* block input operations */
long ru_oublock;         /* block output operations */
long ru_msgsnd;          /* messages sent */
long ru_msgrcv;          /* messages received */
long ru_nvcsw;           /* voluntary context switches */
long ru_nivcsw;          /* involuntary context switches */

test75.c is the unit test for this new function

Change-Id: I3f1eb69de1fce90d087d76773b09021fc6106539
2013-07-01 23:00:47 +02:00
Ben Gras cdf2f55a90 kernel, arm ucontext: ARM DBG=-g run fixes
kernel:
	. modules can be as big as the space (8MB) between them
	  instead of 4MB; memory is slightly bigger with DBG=-g

arm ucontext:
	. r4 is clobbered by the restore function, as it's
	  used as a scratch register, causing problems for the
	  DBG=-g build
	. r1-r3 are safe for scratch registers, as they are
	  caller-save, so use r3 instead; and don't bother
	  restoring r1-r3, but preserve r4

vfs:
	. improve TLL pointer sanity check a bit

Change-Id: I0e3cfc367fdc14477e40d04b5e044f288ca4cc7d
2013-06-24 16:57:30 +02:00
Ben Gras 456359aa72 retire 64-bit conversion functions
Change-Id: Ib6b81403f877c363a286c654e0524fa1cb781b80
2013-06-24 16:50:57 +02:00
Anton Kuijsten 2e3046757a LLVM bitcode for almost the whole source tree
Change-Id: Ibc6f89de112e0649c3a3bfe49c2baa2ed0746212
2013-06-18 10:49:53 +02:00
Ben Gras d1b3ab953e a few DBG=-g build fixes, both arches
- setlogin() not available
	- softfloat needed in -lminc for arm
	- libminc: we have to set LIBCDIR for the included files,
	  so use that instead of LIBCSRCDIR

Change-Id: I7f92621ebbca9ce08dc377b3fa61dee089071757
2013-06-16 15:27:41 +02:00
Ben Gras 9178749e13 libc syslog, syslogd, logger, uds fixes
changes necessary for libc syslog() using a unix domain socket.

	. libc syslog: don't use send() connect() for unix
	  datagram sockets, minix wants write() and ioctl()
	. syslogd: listen on _PATH_LOG unix domain socket
	. logger: warnings fixes
	. pfs: make uds dgram socket type nonblocking so
	  syslog() doesn't block
	. vfs: add sanity check for empty fd in unpause()

Change-Id: Ied136c6fe0cc288f5a53478f1eebccc1ab1f39fb
2013-06-12 07:04:52 +00:00
Ben Gras 4f3b015903 fix some warnings
Change-Id: I1f3fa582d8e3ddb3c981784dddb13e740102f4f3
2013-05-31 20:57:39 +00:00
Ben Gras 33a7ac7557 vfs: mmap support
. libc: add vfs_mmap, a way for vfs to initiate mmap()s.
	  This is a good special case to have as vfs is a slightly
	  different client from regular user processes. It doesn't do it
	  for itself, and has the dev & inode info already so the callback
	  to VFS for the lookup isn't necessary. So it has different info
	  to have to give to VM.
	. libc: also add minix_mmap64() that accepts a 64-bit offset, even
	  though our off_t is still 32 bit now.
	. On exec() time, try to mmap() in the executable if available.
	  (It is not yet available in this commit.)
	. To support mmap(), add do_vm_call that allows VM to lookup
	  (to ino+dev), do i/o from and close FD's on behalf of other
	  processes.

Change-Id: I831551e45a6781c74313c450eb9c967a68505932
2013-05-31 15:42:00 +00:00
Ben Gras 9e88c40e40 VM: 64-bit mmap()
Some (backwards-compatible) changes in mmap() call message fields
that allow for a 64-bit offset. minix_mmap() takes an off_t and
minix_mmap64() takes a u64_t. Some mmap() work in VM goes into a
separate function, using the new fields, so that that can be re-used
when files are to be mapped (future commit).

Change-Id: Ifb77a90b593dd3c33cf81b396068e4da1ec5fb1c
2013-04-24 10:18:15 +00:00
Xiaoguang Sun 20e6c9329f Change function prototype to use endpoint_t instead of int 2013-04-23 17:15:15 +02:00
Antoine Leca 9131e98a7d utimens(2) system call
Variant of utime(2) with struct timespec (with ns precision)
instead of time_t values; also allows for tv_nsec members
the values UTIME_NOW (force update to current time) or
UTIME_OMIT (allow to set either atim or mtim independently.)

Provides a superset of utimes(2), futimes(2), lutimes(2),
and futimens(2).
Provides the same subset of utimensat(2) as does NetBSD 6.
Also import utimens() and lutimeNS() from NetBSD-current.
2013-04-12 18:55:39 +00:00
Thomas Cort 15b3d77268 libc: add adjtime() system call.
Implement the adjtime() system call and add a test for it to test69.
Additionally, install the adjtime.2 and clock_*.2 man pages.
2013-04-04 15:04:54 +02:00
Thomas Cort 516fec97d9 libc: add clock_settime() system call.
This also adds the sys_settime() kernel call which allows for the adjusting
of the clock named realtime in the kernel. The existing sys_stime()
function is still needed for a separate job (setting the boottime). The
boottime is set in the readclock driver. The sys_settime() interface is
meant to be flexible and will support both clock_settime() and adjtime()
when adjtime() is implemented later.

settimeofday() was adjusted to use the clock_settime() interface.

One side note discovered during testing: uptime(1) (part of the last(1)),
uses wtmp to determine boottime (not Minix's times(2)). This leads `uptime`
to report odd results when you set the time to a time prior to boottime.
This isn't a new bug introduced by my changes. It's been there for a while.
2013-04-04 15:04:54 +02:00
Thomas Cort e67fc5771d libc: add clock_getres()/clock_gettime() system calls.
In order to make it more clear that ticks should be used for timers
and realtime should be used for timestamps / displaying the date/time,
getuptime() was renamed to getticks() and getuptime2() was renamed to
getuptime().

Servers, drivers, libraries, tests, etc that use getuptime()/getuptime2()
have been updated. In instances where a realtime was calculated, the
calculation was changed to use realtime.

System calls clock_getres() and clock_gettime() were added to PM/libc.
2013-04-04 15:04:53 +02:00
David van Moolenbroek 3be9c7c33b Rename "struct partition" to "struct part_geom"
Change-Id: Ifaf9795ba70f5b933599b2a6ec9415e6bd13200c
2013-03-20 16:14:21 +00:00
Lionel Sambuc b9674650f1 Fix signal handling for services on abort/exit
Change-Id: I970a25ae0dd52f0d928fda376296e7b39e3e17eb
2013-03-07 13:11:31 +01:00
Thomas Veerman 49ad4e8888 Spring cleanup
Remove old versions of system calls and system calls that don't have
a libc api interface anymore (dup, dup2, creat).

VFS still contains support for old system call numbers for the new stat
system calls (i.e., 65, 66, 67) to keep supporting old binaries built for
MINIX 3.2.1 (prior to the release).

Change-Id: I721779b58a50c7eeae20669de24658d55d69b25b
2013-03-06 09:56:08 +00:00
Thomas Veerman 39fad09a94 libc: drop Minix popen and use NetBSD's
Change-Id: I56f253d855671a6e1c8d53c7383107565164ab8d
2013-02-28 10:08:54 +00:00
Thomas Veerman 473547c777 VFS: implement pipe2
Change-Id: Iedc8042dd73a903456b25ba665d12577f5589ca2
2013-02-28 10:08:53 +00:00
Thomas Veerman fa78dc389f socket: implement SOCK_CLOEXEC and SOCK_NONBLOCK
Change-Id: I3fa36fa999c82a192d402cb4d913bd397e106e53
2013-02-28 10:08:53 +00:00
Thomas Veerman fd610ba1b0 VFS: add ability to open files O_CLOEXEC
.adjust libc to make use of it (undo __minix diff)

Change-Id: I90a1aa219fcd1b12b6bc60e72176f326eac8184a
2013-02-28 10:08:53 +00:00
Lionel Sambuc f640210005 Removing obsolete _NBSD_LIBC define
Change-Id: Ia6ce84ccdf36cf6f64540b990baaa7d85c53533d
2013-02-26 09:44:24 +00:00
Lionel Sambuc 813d4c6a36 Removing obsolete _MINIX_SOURCE define
Change-Id: I924d5af294cd5daf17c73f71803f060cea3c3d8b
2013-02-26 09:44:21 +00:00
Lionel Sambuc 8e4736f2df Removing obsolete _MINIX define
Change-Id: Id33ac7e973d1c0e249b690fe44a597474fac6076
2013-02-26 09:44:20 +00:00
Ben Gras 7a07b58aa8 test66: float smoke test, floating point fixes (arm)
Change-Id: Idd209ab6f341fbfb6b2dca77290ff440695bc2c1
2013-02-20 12:29:37 +00:00
Ben Gras 95513e73da opendir change: refinement
Change-Id: I90cc6929c9e7678da8e200688dcd40441efe030f
2013-02-08 23:09:21 +00:00
Ben Gras 4505b4a30a add opendir alias
Change-Id: Ib121e763bac7bea44a2f2533c454ff7d9361dc8d
2013-02-08 21:40:57 +00:00
Ben Gras 57bab02d57 kernel, libc: signals fixes
. kernel: signal handler args for ARM
	. kernel: sanity check return address (LSB indicates thumb mode)
	. libc: properly retrieve signal mask for ARM

together fix test37 on ARM.

Change-Id: I4e00f754c50104ed85c7fdf8ec5ad54568f20a81
2013-02-04 12:03:46 +01:00
Ben Gras e3e5cf6d34 arm: make signal handlers work
A few kernel and calling convention adjustments to make sigsend and
sigreturn work for arm.

	. provide a arch_proc_setcontext for earm in kernel
	. set LR in context of signal handler to provide a proper
	  return address (to __sigreturn)
	. change __sigreturn to retrieve the sigcontext pointer
	  from the sigframe struct and pass it to _sigreturn() in r0

Change-Id: Icd135a70595382c79d11d8dd9876f6a6f1df41f8
2013-01-30 04:10:12 +00:00
Ben Gras b6d285faba libc: add stat aliases
. add non-internal aliases for stat, lstat, fstat

Change-Id: I87e025b2bf073ff56a5742fc1dcf5badb2b7b321
2013-01-29 20:11:16 +00:00
Ben Gras 08cb986d3f vm: fix kernel-requested mappings for arm
. make vm tell kernel virtual locations of mappings
	. makes _minix_kerninfo feature work
	. fix for mappings being larger than what 1 pde can address
	  (e.g. devices memory requested on arm)
	. still requires a special case for devices memory for the
	  kernel, which has to switch to virtual addressing

Change-Id: I2e94090aa432346fa4da0edeba72f0b7406c2ad7
2013-01-29 17:57:04 +00:00
Thomas Veerman fe45ee7ed0 ARM: disable __minix_init for now
On ARM we can't yet globally map pages into every process. So now that
we correctly receive the pointer to the globally mapped kern_info
struct, we have to ignore it on ARM because attempting to dereference
the pointer yields a segfault.
2013-01-25 17:07:02 +00:00
Thomas Veerman e52ecfbf5d ARM: correctly store kernel_info_struct pointer 2013-01-25 17:07:02 +00:00
Ben Gras 8ebdbed79c getifaddrs: add un-namespaced alias
. needed for security/heimdal, needed for git

Change-Id: I8638945dffd0abffd487c47281ad7616da1b70db
2013-01-24 21:57:15 +00:00
Lionel Sambuc 96836647f8 Fixing cross build i386 on minix 2013-01-23 21:03:38 +01:00
Nicholas Heath 1bbba6353d Fixed bug in getrlimit as core dumps are supported now. 2013-01-17 14:06:35 +00:00
Lionel Sambuc b1c4ba4ab6 ARM updates
Due to the ABI we are using we have to use the earm architecture
moniker for the build system to behave correctly. This involves
then some headers to move around.

There is also a few related Makefile updates as well as minor
source code corrections.
2013-01-17 10:03:58 +01:00
Lionel Sambuc 0ac803292e Fix warnings trivial warnings.
Fix warnings about:
 . Unused variables
 . format mismatch in printf/scanf format string and arguments
 . Missing parenthesis around assignment as truth values
 . Clang warnings anout unknown GCC pragma
2013-01-14 11:44:31 +01:00
Lionel Sambuc f14fb60209 Libraries updates and cleanup
* Updating common/lib
 * Updating lib/csu
 * Updating lib/libc
 * Updating libexec/ld.elf_so
 * Corrected test on __minix in featuretest to actually follow the
   meaning of the comment.
 * Cleaned up _REENTRANT-related defintions.
 * Disabled -D_REENTRANT for libfetch
 * Removing some unneeded __NBSD_LIBC defines and tests

Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
2013-01-14 11:36:26 +01:00
Lionel Sambuc f6aac1c3b5 Moving all NetBSD headers back where they belong.
Moving include/sys NetBSD headers to /sys/sys
Moving include/arch/*/ NetBSD headers to /sys/arch/*/include

Change-Id: Ia1a45d4e83ab806c84093ec2b61bdbea9bed65a0
2013-01-14 11:36:25 +01:00
Ben Gras 017ce5a503 libc, libutil: remove compat hacks 2013-01-08 15:47:37 +00:00
Ben Gras 29edcad310 vm: replace phys avl by array
. make vm be able to use malloc() by overriding brk()
   and minix_mmap() functions
 . phys regions can then be malloc()ed and free()d instead
   of being in an avl tree, which is slightly faster
 . 'offset' field in phys_region can go too (offset is implied
   by position in array) but leads to bigger code changes
2012-12-26 16:14:41 +00:00
Lionel Sambuc 100babf0e0 Removing last reference to NETBSDINCLUDES
Also removing minix-config.inc and placing its content in
Makefile.inc, as the file is modified anyway. Simplifies diff.

Change-Id: I6262fdb790a5455b59e07acdccdc221fd5dd41f8
2012-12-07 13:58:06 +01:00
Lionel Sambuc 9903b9fb96 Fixing wrong dependency from libc on libsys. 2012-11-26 13:53:02 +01:00
Erik van der Kouwe 57c748b968 Remove ability to pass commands to bootloader 2012-11-22 19:16:17 +01:00
Tomas Hruby 10f30159a9 struct minix_ipcvecs - pretty-print
- the _ptr suffix is not needed anymore :-)
2012-11-15 16:52:00 +01:00
Lionel Sambuc cd554e7284 Hack for unresolved symbol read_tsc_64 2012-11-15 16:07:30 +01:00
Lionel Sambuc d19d7d58aa Toolchain upgrade and portability improvements.
upgrade to NetBSD CVS release from 2012/10/17 12:00:00 UTC

Makefiles updates to imporve portability

Made sure to be consistent in the usage of braces/parenthesis at
least on a per file basis. For variables, it is recommended to
continue to use braces.
2012-11-15 16:07:29 +01:00
Lionel Sambuc 9152e1c5a7 Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
 * tools
 * distribution
 * sets
 * release

The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.

For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.

Regarding new or modifications of Makefiles a few things:
 * Read share/mk/bsd.README
 * If you add a subdirectory, add a Makefile in it, and have it called
   by the parent through the SUBDIR variable.
 * Do not add arbitrary inclusion which crosses to another branch of
   the hierarchy; If you can't do without it, put a comment on why.
   If possible, do not use inclusion at all.
 * Use as much as possible the infrastructure, it is here to make
   life easier, do not fight it.

Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-11-15 16:07:29 +01:00
Lionel Sambuc e415d48872 Libc update to simplify merge.
Bumping libc files for unsupported architectures, to simplify merging.
A bunch of small fixes:
 * in libutil update
 * the macro in endian.h
 * some undefined types due to clear separation from host.
 * Fix a warning for cdbr.c

Some modification which were required for the new build system:
 * inclusion path for const.h in sconst, still hacky
 * Removed default malloc.c which conflicts on some occasions.
2012-11-15 16:07:29 +01:00
Tomas Hruby ee99bb81b9 LIBC - getifaddrs() fix
ifpa must be set to something meaningful every time it returns 0.
2012-10-11 09:43:33 +00:00
Arun Thomas 471a03a362 ARM support for kernel and vm 2012-10-07 21:38:03 -04:00
Ben Gras 2d72cbec41 SYSENTER/SYSCALL support
. add cpufeature detection of both
	. use it for both ipc and kernelcall traps, using a register
	  for call number
	. SYSENTER/SYSCALL does not save any context, therefore userland
	  has to save it
	. to accomodate multiple kernel entry/exit types, the entry
	  type is recorded in the process struct. hitherto all types
	  were interrupt (soft int, exception, hard int); now SYSENTER/SYSCALL
	  is new, with the difference that context is not fully restored
	  from proc struct when running the process again. this can't be
	  done as some information is missing.
	. complication: cases in which the kernel has to fully change
	  process context (i.e. sigreturn). in that case the exit type
	  is changed from SYSENTER/SYSEXIT to soft-int (i.e. iret) and
	  context is fully restored from the proc struct. this does mean
	  the PC and SP must change, as the sysenter/sysexit userland code
	  will otherwise try to restore its own context. this is true in the
	  sigreturn case.
	. override all usage by setting libc_ipc=1
2012-09-24 15:53:43 +02:00
Ben Gras d526f1a0db some coverity fixes. 2012-09-18 15:11:51 +02:00
Ben Gras ed1af3c86c VM: full munmap
complete munmap implementation; single-page references made
a general munmap() implementation possible to write cleanly.

	. memory: let the MIOCRAMSIZE ioctl set the imgrd device
	  size (but only to 0)
	. let the ramdisk command set sizes to 0
	. use this command to set /dev/imgrd to 0 after mounting /usr
	  in /etc/rc, so the boot time ramdisk is freed (about 4MB
	  currently)
2012-09-18 13:17:52 +02:00
Ben Gras d3d8c30c2e libc/libminc malloc reorganization
. rename minix malloc sources to minix-* so Makefile
    references aren't ambiguous
  . throw out malloc source file copies in libminc
  . make libminc use phkmalloc instead of minix malloc (slightly faster)
2012-09-18 13:17:44 +02:00
Arun Thomas fd43d93ce5 ARM support for system libraries 2012-08-28 13:49:27 -04:00
Arun Thomas 9a9d555f56 machine/ipcconst.h for arch-specific constants 2012-08-27 19:46:41 -04:00
Arun Thomas fbd456ee2b libc/mallocdebug: Make arch-generic 2012-08-10 22:45:35 +02:00
Arun Thomas caa798bbe1 brksize: Remove non-ELF code 2012-08-10 22:45:35 +02:00
Arun Thomas 65a87d5bcb Fix prototypes for getdents, read, readlink 2012-08-10 22:09:43 +02:00
Arun Thomas 19ffad7692 Remove ACK EM_WSIZE/EM_PSIZE macro usage 2012-08-06 17:49:22 +02:00
Arun Thomas 6723dcfab7 Replace MACHINE/CHIP macros with compiler macros 2012-08-06 17:49:22 +02:00
Ben Gras b6ea15115c kernel: facility for user-visible memory
. map all objects named usermapped_*.o with globally visible
	  pages; usermapped_glo_*.o with the VM 'global' bit on, i.e.
	  permanently in tlb (very scarce resource!)
	. added kinfo, machine, kmessages and loadinfo for a start
	. modified log, tty to make use of the shared messages struct
2012-07-28 20:57:38 +00:00
Kees Jongenburger 30b5c227e9 Allow to specify the rslabel to use for a file system.
When a file system is mounted some heuristics are used to define
a RS label for that system. This commit allows to specify the
label to use in an optional mount argument using either
mount -o rslabel=fs_myfs or as a mount option in fstab.

This can be used to start services that later also need to be
accessed directly.
2012-07-05 14:52:16 +02:00
Ben Gras c3db1c6939 various symbol referencing fixes
make weak symbol references and namespace renames references
the renamed versions.

function renaming, weak symbol references and libc namespace.h
protection interact in hairy ways and causes weak symbol references
for renamed functions to be unresolved; e.g. vfork should be an
alias for _vfork but _vfork doesn't exist because __vfork14()
exists.

this is a problem for dynamically linked executables as all symbols
have to be resolved, used or not, at link time. it was masked by
clang-compiled base system libraries but is a problem when gcc does
it.
2012-06-28 15:20:53 +02:00
Ben Gras cb1418a5e1 generate offsets for ucontext.S 2012-06-19 15:47:25 +02:00
Thomas Veerman aab6eb7615 Clean up generated files for ash,ramdisk,libutil,libc 2012-06-18 10:54:56 +00:00
Thomas Veerman f09c2e014f Use MACHINE_ARCH instead of ARCH 2012-06-18 10:53:35 +00:00
Thomas Veerman f93afa00e9 Remove MINIXSRCDIR and use NETBSDSRCDIR
NETBSDSRCDIR is used all over the place anyway, and this reduces
our diff with NetBSD a little.
2012-06-18 10:53:35 +00:00
Kees Jongenburger 6b8821515d Move setjmp and strnlen to common/lib.
Move setjmp and strnlen to common/lib to allow libddekit to use them.
2012-06-18 09:20:22 +02:00
Ben Gras ee4016155e vm: add third-party mmap() mode and PROCCTL
these two functions will be used to support all exec() functionality
going into a single library shared by RS and VFS and exec() knowledge
leaving VM.

	. third-party mmap: allow certain processes (VFS, RS) to
	  do mmap() on behalf of another process
	. PROCCTL: used to free and clear a process' address space
2012-06-07 12:43:16 +02:00
Ben Gras 73379f0be5 set major version of shlibs to 0
WARNING: this will break existing dynamically linked binaries if they
exist. If you have any:
	. re-build world statically first if necessary
	. remove libraries from /lib and /usr/lib
	. then build world

This change:
	. avoids possible future dismay when interfacing other
	  systems' binaries; done until they are abi-compatible

Thanks to Antoine Leca for pointing this out.
2012-05-10 16:38:24 +02:00
Ben Gras 755102d67f AT_SUN_EXECNAME support
. vfs: pass execname in aux vectors
	. ld.elf_so: use this to expand $ORIGIN
	. this requires the executable to reserve more
	  space at exec() calling time
2012-04-26 13:32:39 +02:00
Ben Gras 4b999f1962 build shared versions of libraries
building defaults to off until clang is updated.

current clang does not handle -shared, necessary to change the ld
invocation to build shared libraries properly. a new clang should be
installed and MKPIC defaults to no unless the newer clang is detected.

changes:

	. mainly small imports of a Makefile or two and small fixes
	  (turning things back on that were turned off in Makefiles)
	. e.g.: dynamic librefuse now depends on dynamic
	  libpuffs, so libpuffs has to be built dynamically too
	  and a make dependency barrier is needed in lib/Makefile
	. all library objects now have a PIC (for .so) and non-PIC
	  version, so everything is built twice.
	. generate PIC versions of the compat (un-RENAMEd) jump files,
	  include function type annotation in generated assembly
	. build progs with -static by default for now
	. also build ld.elf_so
	. also import NetBSD ldd
2012-04-16 05:21:20 +02:00
Ben Gras 53002f6f6c recognize and execute dynamically linked executables
. generalize libexec slightly to get some more necessary information
	  from ELF files, e.g. the interpreter
	. execute dynamically linked executables when exec()ed by VFS
	. switch to netbsd variant of elf32.h exclusively, solves some
	  conflicting headers
2012-04-16 00:41:42 +00:00
Ben Gras e83f7ba2c9 switch to netbsd csu
. file- and functionality-compatible with previous situation
          (FreeBSD csu) (with a crt1.o -> crt0.o symlink in /usr/lib)
        . harmonizes source with netbsd
        . harmonizes linker invocation (e.g. clang) with netbsd
        . helpful to get some arm code in there for the arm port project
2012-04-12 13:26:24 +02:00
Ben Gras 18f3961189 use __restrict instead of restrict
. doesn't choke gcc without -std=c99
	. also used in prototypes already
2012-03-30 17:37:53 +02:00
Ben Gras 204ae72525 retire _ANSI and <minix/ansi.h> 2012-03-25 21:58:27 +02:00
Ben Gras 23df780120 get rid of _RESTRICT 2012-03-25 21:58:25 +02:00
Ben Gras db242ed39d retire _CONST, _VOLATILE, _SIZET, _ARGS, _VOID 2012-03-25 21:58:20 +02:00
Ben Gras 7336a67dfe retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
Ben Gras 6a73e85ad1 retire _PROTOTYPE
. only good for obsolete K&R support
	. also remove a stray ansi.h and the proto cmd
2012-03-25 16:17:10 +02:00
Ben Gras 39fea0a5b9 install library manpages
. harmonize bsd.lib.mk and bsd.man.mk with netbsd files
	. throw out minix section 3 (library calls) manpages,
	  replaced by netbsd ones that are now installed
2012-02-16 01:48:46 +00:00
Ben Gras 2fe8fb192f Full switch to clang/ELF. Drop ack. Simplify.
There is important information about booting non-ack images in
docs/UPDATING. ack/aout-format images can't be built any more, and
booting clang/ELF-format ones is a little different. Updating to the
new boot monitor is recommended.

Changes in this commit:

	. drop boot monitor -> allowing dropping ack support
	. facility to copy ELF boot files to /boot so that old boot monitor
	  can still boot fairly easily, see UPDATING
	. no more ack-format libraries -> single-case libraries
	. some cleanup of OBJECT_FMT, COMPILER_TYPE, etc cases
	. drop several ack toolchain commands, but not all support
	  commands (e.g. aal is gone but acksize is not yet).
	. a few libc files moved to netbsd libc dir
	. new /bin/date as minix date used code in libc/
	. test compile fix
	. harmonize includes
	. /usr/lib is no longer special: without ack, /usr/lib plays no
	  kind of special bootstrapping role any more and bootstrapping
	  is done exclusively through packages, so releases depend even
	  less on the state of the machine making them now.
	. rename nbsd_lib* to lib*
	. reduce mtree
2012-02-14 14:52:02 +01:00
David van Moolenbroek 2c685f34e0 Cut PM out of the adddma/deldma/getdma call path 2012-01-14 00:27:06 +01:00
David van Moolenbroek 8cb7ba7951 Remove obsolete PROCSTAT/getsigset call. 2012-01-14 00:27:06 +01:00
Ben Gras 4668b84158 vm_remap_ro
- allows shared memory to be mapped in readonly

- ben@minix3.org & tom@minix3.org
2012-01-13 11:30:01 +00:00
Ben Gras 4d4057d8a2 netbsd fsck driver import
. fsck driver parses /etc/fstab and invokes sub-fscks
	. further simplifies fs handling in rc
2011-12-22 23:07:15 +01:00
Thomas Veerman 92b61c816d Fix many more comiler warnings
Most warnings were harmless, some real bugs. Test set should now compile
cleanly with ack, gcc, and clang.
2011-11-28 10:07:55 +00:00
Thomas Veerman b4fb061802 Implement issetugid syscall
Implement issetugid syscall and provide a test. This gets rid of the
scary "Unsecure. Implement me" warning during compilation.
2011-11-28 10:03:43 +00:00
Ben Gras 5c00743626 Switch to NetBSD passwd format
Based on work by Vivek Prakash and Gianluca Guida.

See UPDATING about caveats on currently existing accounts.

	. restores netbsd libc pwcache functions
2011-11-14 14:47:42 +00:00
Thomas Veerman 490e0de548 Import librefuse and libpuffs
Import libpuffs and our port of libpuffs. The port was done as part of
GSoC 2011 FUSE project, done by Evgeniy Ivanov. The librefuse import
did not require any porting efforts. Libpuffs has been modified to
understand our VFS-FS protocol and translate between that and PUFFS. As
an example that it works, fuse-ntfs-3g from pkgsrc can be compiled and
used to mount ntfs partitions:
mount -t ntfs-3g <device> <mountpoint>

FUSE only works with the asynchronous version of VFS. See <docs/UPDATING> on
how to run AVFS.

This patch further includes some changes to mount(1) and mount(2) so it's
possible to use file systems provided by pkgsrc (note: manual modifications
to /etc/system.conf are still needed. There has been made an exception for
fuse-ntfs-3g, so it already as an entry).
2011-11-14 11:53:05 +00:00
Thomas Veerman a209c3ae12 Fix a ton of compiler warnings
This patch fixes most of current reasons to generate compiler warnings.
The changes consist of:
 - adding missing casts
 - hiding or unhiding function declarations
 - including headers where missing
 - add __UNCONST when assigning a const char * to a char *
 - adding missing return statements
 - changing some types from unsigned to signed, as the code seems to want
   signed ints
 - converting old-style function definitions to current style (i.e.,
   void func(param1, param2) short param1, param2; {...} to
   void func (short param1, short param2) {...})
 - making the compiler silent about signed vs unsigned comparisons. We
   have too many of those in the new libc to fix.

A number of bugs in the test set were fixed. These bugs were never
triggered with our old libc. Consequently, these tests are now forced to
link with the new libc or they will generate errors (in particular tests 43
and 55).

Most changes in NetBSD libc are limited to moving aroudn "#ifndef __minix"
or stuff related to Minix-specific things (code in sys-minix or gen/minix).
2011-11-14 10:07:49 +00:00
Thomas Veerman 8a266a478e Increase gid_t and uid_t to 32 bits
Increase gid_t and uid_t to 32 bits and provide backwards compatibility
where needed.
2011-09-05 13:56:14 +00:00
Ben Gras 195190912f malloc build fixes 2011-08-18 22:30:51 +00:00
Ben Gras d477a9ed82 vm/ipc: only report signals when it matters to ipc
. ipc wants to know about processes that get
	  signals, so that it can break blocking ipc operations
	. doing it for every single signal is wasteful
	  and causes the annoying 'no slot for signals' message
	. this fix tells vm on a per-process basis it (ipc)
	  wants to be notified, i.e. only when it does any ipc calls
	. move ipc config to separate config file while we're at it
2011-08-05 20:52:32 +00:00
Ben Gras 02081e4b62 rename mmap() and munmap()
. it's a good extra interface to have but doesn't
	  meet standardised functionality
	. applications (in pkgsrc) find it and expect
	  full functionality the minix mmap doesn't offter
	. on the whole probably better to hide these functions
	  (mmap and friends) until they are grown up; the base system
	  can use the new minix_* names
2011-07-16 13:01:19 +02:00
Evgeniy Ivanov ef0a265086 New stat structure.
* VFS and installed MFSes must be in sync before and after this change *

Use struct stat from NetBSD. It requires adding new STAT, FSTAT and LSTAT
syscalls. Libc modification is both backward and forward compatible.

Also new struct stat uses modern field sizes to avoid ABI
incompatibility, when we update uid_t, gid_t and company.
Exceptions are ino_t and off_t in old libc (though paddings added).
2011-07-12 16:39:55 +02:00
Thomas Cort 66b369c62c opendir(3): on success, don't clobber errno
The opendir(3) function was setting errno to ENOTDIR even
when the directory existed and was opened successfully. This
caused git to falsely detect an error.

This change moves the errno assignment into the failure code
block. It also adds a test to test24 to check for errno
changing when opendir(3) returns success.
2011-06-29 19:58:41 +02:00
Ben Gras e785381d4d introduce option to time assert()s
. remove a few asserts in the kernel and 64bi library
    that are not compatible with the timing code
  . change the TIME_BLOCKS code a little to work in-kernel
2011-06-24 16:00:42 +02:00
Ben Gras e3f68488ee fix many clang warnings in lib/ 2011-06-23 19:25:36 +02:00
Antoine Leca 6d8d7a88b2 libc!setmode.c: Avoid #if inside macro call
#if inside macro call is undefined behaviour under the C standard
(3.8.3 paragraph 10 for C90, 6.8.10 paragraph 11 for C99).
The same effect can be achieved with a slightly more verbose construct,
putting the whole macro call inside the #ifdef/#else/#endif.
2011-06-23 17:54:17 +02:00
Ben Gras c02833ced6 <timers.h> - add feature to time a code block
. also minor compile fixes for it
2011-06-06 09:04:11 +02:00
Dirk Vogt 0908191386 _mount.c: don't check for excutable if MS_EXISTING is set 2011-02-22 17:59:08 +00:00