Commit Graph

7 Commits

Author SHA1 Message Date
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
manu 652fe89179 - add locks to structures used by the /dev/usema driver and the
usync_cntl() system calls.

- when usync_cntl is used and the process is aborted (eg: by kill -9)
libc does not call usync_cntl() to unblock things. We have to cleanup
data allocated in the kernel. This is now done through the emulation
specific exit hook

- IRIX initialize some data in the system part of the PRDA: the pid and
a prid (PRDA ID?). We initialize both to pid.

- Move back struct irix_share_group from irix_exec.h to irix_prctl.h, it
is more revelant here.

- fix a few typos
2002-08-25 19:03:12 +00:00
manu 2ce44de983 typo 2002-08-02 22:52:50 +00:00
manu 0d78304995 Improved support for polling semaphores: when a polling semaphore is unblocked,
poll will return true until the semaphore is blocked again, but before the
semaphore is blocked, poll returns false.

We do this by maintaining another queue of "released" processes in
struct irix_usema_rec. Unblocking causes the waiting process record to be
moved to the released queue, and poll check for the process in this released
queue.
2002-05-30 05:16:10 +00:00
manu e8f2e051a3 - When requested a semamphore count, the userlands expects the kernel to
return the number of processes waiting on the semaphore. We now maintiain
a count of waiting processes.
- Blocked processes are unblocked "first in, first out". We now have a
queue of waiting processes on a asemaphores, so that we can wakeup the
first blocked process.

Problems:
- We now have a lot of dynamic memory allocation, it may be a bit slow.
- Nothing is SMP safe for now. We need to add locks.
- On close, we forget about a semaphore, which is incorrect. One process
  can close its fd attached on a semaphore, but other processes  would carry
  on using it. Since any process can join a shared arena, this is not an
  easy thing to solve.
- A lot of usema/usync functionnalities are still to be discovered.
2002-05-26 21:37:12 +00:00
manu 23f31f2a3a First implementation of IRIX /dev/usemaclone functionnalities. This
successfully emulates a few test program that use poll semaphores,
including the attach-to-file-descriptor-and-select feature.

There are a few issues:
1) at least one ioctl need to set retval. We handle this in irix_sys_ioctl()
by replacing the data argument by a pointer to a strucutre in the stackgap
that carries the real data and retval. The underlying ioctl methods can
therefore retreive both data and retval.

2) usemaclone is a cloning device: each time it is open, it creates a new
context, and ioctl operation on each open file descriptor will lead to
different behavior. This functionnality is available in NetBSD through the
devvp branch. This first implementation does not use devvp yet, but this
should be done later. Currently, we create a new vnode, and we provide our
own vnode operations. Some operation are applied to the cloned vnode, others
are applied to the original vnode. The v_data field is used to hold a
reference to the original vnode so that we can work on it.

3) at least the setattr vnode operation needs some customisation: IRIX
libc relies on the fact that fchmod on /dev/usema will return 0 in case
of failure.
2002-05-22 05:14:00 +00:00
manu ee5b3b3977 Added a void IRIX /dev/usema and /dev/usemaclone pseudodevice driver.
IRIX uses this for implementing atomics operation on semaphores

This will be filled later.
2002-04-23 05:51:14 +00:00