Commit Graph

38 Commits

Author SHA1 Message Date
christos be3704c73f pass the flag to fdclone. 2005-02-12 23:14:03 +00:00
christos 31c81b28f5 Cloning cleanup:
1. make fileops const
2. add 2 new negative errno's to `officially' support the cloning hack:
    - EDUPFD (used to overload ENODEV)
    - EMOVEFD (used to overload ENXIO)
3. Created an fdclone() function to encapsulate the operations needed for
   EMOVEFD, and made all cloners use it.
4. Centralize the local noop/badop fileops functions to:
   fnullop_fcntl, fnullop_poll, fnullop_kqfilter, fbadop_stat
2004-11-30 04:25:43 +00:00
jonathan 230fb9b8ab Eliminate several uses of `curproc' from the socket-layer code and from NFS.
Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded  by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize.   Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.
2004-05-22 22:52:13 +00:00
jdolecek a034152027 move dupfd from struct proc to struct lwp - it's per-LWP, not per-process; we
use curlwp where the lwp is not directly available, i.e. in device open
routines

briefly discussed on tech-kern
2003-09-13 08:32:10 +00:00
jdolecek 69150f5b25 ptyname[] must not be static, the contents are modified later in the routine 2003-09-13 08:15:25 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
thorpej 9b46ebe0bd Merge the nathanw_sa branch. 2003-01-18 08:44:26 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
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
christos 381e6a7764 make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
2002-03-16 20:43:48 +00:00
lukem dab6ef8b56 add RCSIDs (including regeneration of files as appropriate) 2001-11-13 02:07:52 +00:00
thorpej 80cc38a1af Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads.  What we do is stick descriptors in the table, but
mark them as "larval".  This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again.  When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
2001-06-14 20:32:41 +00:00
jdolecek bb8ceadfcc Adapt to struct fileops, soo_stat() changes.
Pointed out by Bernd Ernesti in private mail.
2001-04-07 17:37:09 +00:00
eeh fb46d1eed4 Export bits needed by COMPAT_SVR4_32. 2001-02-11 01:16:42 +00:00
ad decb1dcfcf const tty{numbers,letters}, and remove PCVT hack. 2000-09-11 15:12:40 +00:00
thorpej dabbfde70a Implement fdremove() which is used in place of all the code that
did the "fdp->fd_ofiles[fd] = 0" assignment; fdremove() make sure
the fd_freefiles hints stay in sync.

From OpenBSD.
2000-03-23 05:16:12 +00:00
christos d205cc9cd4 oops, forgot to include new files. 1999-09-07 18:20:18 +00:00
wrstuden 3bf14d81e9 Add support for fcntl(2) to generate VOP_FCNTL calls. Any fcntl
call with F_FSCTL set and F_SETFL calls generate calls to a new
fileop fo_fcntl. Add genfs_fcntl() and soo_fcntl() which return 0
for F_SETFL and EOPNOTSUPP otherwise. Have all leaf filesystems
use genfs_fcntl().

Reviewed by: thorpej
Tested by: wrstuden
1999-08-03 20:19:16 +00:00
thorpej e3669c3393 Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
1999-05-05 20:01:01 +00:00
tv 724f072dde Nuke my copyrights and/or assign them to TNF where appropriate. 1999-04-06 02:55:24 +00:00
drochner 52c16cf83a get "opt_compat_svr4.h" out of <sys/conf.h> 1998-12-18 16:55:39 +00:00
christos 8fb507a3b7 Assign copyright to TNF. 1998-09-05 14:50:25 +00:00
christos 667541561d Try to implement I_GETSIG to make netscape work again (untested) 1998-08-27 07:04:31 +00:00
lukem 786b86d71b use AF_LOCAL instead of AF_UNIX 1998-07-18 05:04:35 +00:00
christos 6a9178e444 From Todd Vierling:
- Fix memcntl()
- Fixed stat and mknod syscalls to properly disassemble and reassemble
  dev_t values to/from emulation dev_t's
- Added pty (ptmx) subsystem at svr4net minor number 10 -- /dev/ptmx
- Implemented fork1() as fork() (should change if and when threads get
  added to the system)
- fixed spellings in disclaimer in svr4_net.c; it looks like someone went
  and did a s/nd/st/g on the whole file... yuck
- changed ptmx device to also halt on ENXIO (for pty files that exist with
  no kernel pty to back them)
- fixed SVR4 setpgrp() to be a near equivalent to BSD setsid() (old
  emulation didn't create a new session)
1997-11-16 22:50:55 +00:00
mycroft 2bc736661a Implement poll(2). 1996-09-07 12:40:22 +00:00
christos f8dddb3afe add: I_FDINSERT, _I_BIND_RSVD, _I_RELE_RSVD, SI_SHUTDOWN
this fixes programs that use listen(2) and accept(2), and
makes unix domain sockets work both in tcp and udp.
1996-08-30 23:06:24 +00:00
christos dd1fe33d2e - Always check if the file descriptor we are using is a socket.
- Make sure we get an so_internal state allocated, even if we
  did not open the socket ourselves.
1996-06-05 19:07:37 +00:00
christos 4a0b33e910 Handle different address families, and in particular AF_UNIX. 1996-04-11 12:52:41 +00:00
christos c5cd2c8f26 Remove dependence on svr4_conf.h and the file itself. 1996-03-30 22:40:55 +00:00
christos 79344ff371 - add svr4_conf.h
- add window size ioctls
1996-03-14 19:29:11 +00:00
christos 065bada41f so_pcb -> so_internal 1996-02-04 02:01:07 +00:00
christos a4e2f7532a - Added msgsys, shmsys and semsys... MITSHM needs shmsys, so X applications
that used that would fail.
- Propagated all the fixes from the fully prototyped kernel.
1995-10-14 20:24:14 +00:00
mycroft c06da32c6e Make sure to ream out the file descriptor table slot when aborting. 1994-12-14 20:20:26 +00:00
mycroft 797dcd3e8f Use the same method as portal fs for creating a file descriptor. 1994-12-14 20:08:30 +00:00
christos 2859b1c634 Rework streams emulation so that it does not rely on non portable hacks.
We keep streams state in so->so_ptcb; this field is unused in all the kernel.
Fix poll(2) timeout computation; add hrtsys and waitsys syscalls.
1994-11-18 02:53:37 +00:00
christos 0d5c2ddb90 new files 1994-11-14 06:13:11 +00:00