Commit Graph

96 Commits

Author SHA1 Message Date
yamt 1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
dogcow 372e6ef309 now that we have -Wno-unused-parameter, back out all the tremendously ugly
code to gratuitously access said parameters.
2006-10-17 18:21:29 +00:00
dogcow 2023789a40 More -Wunused fallout. sprinkle __unused when possible; otherwise, use the
do { if (&x) {} } while (/* CONSTCOND */ 0);
construct as suggested by uwe in <20061012224845.GA9449@snark.ptc.spbu.ru>.
2006-10-13 16:53:35 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos be15e5387b use c99 initializers 2006-09-03 06:34:34 +00:00
kardel ac3f10a8d9 make inittimeleft() and gettimeleft() available (for e. g. kern_event.c) 2006-07-14 22:33:27 +00:00
christos a2f707bc1b factor out common code. 2006-07-14 16:02:45 +00:00
christos 199b3952c8 - rename sleepts to sleeptv since it is a timeval.
- don't initialize it needlessly.
- fix the poll code the same way the select code was fixed, so that it
  computes the remaining time to sleep properly.
2006-07-14 15:52:44 +00:00
kardel b36308b48b when adjusting the left over timeout value in selcommon()
do actually subtract the elapsed time instead of adding it.
2006-07-08 16:01:25 +00:00
kardel e472b9091e fix a bug reported by Steven M. Bellovin regarding oversleeping
select(2) timeouts. Introduced via timecounter branch from a
tvtohz() conversion.
The left over timeout was not decremented when re-starting
the sleep in select.
2006-07-08 12:16:09 +00:00
kardel de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
matt 7eddba88c0 Add the code for pselect and pollts. Add selcommon and pollcommon to
<sys/select.h> and <sys/poll.h>.
2005-02-25 19:56:07 +00:00
junyoung a222c81884 Nuke __P(). 2004-03-23 13:22:03 +00:00
chs d2835f509a use "poll" as the wmesg for poll. 2003-10-10 15:24:28 +00:00
jdolecek 7cea8a1389 cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
2003-09-21 19:16:48 +00:00
drochner 3e287f891b Take into account the possibility that the ktrace flags can change
during a read(v)/write(v). If that happeded, we either passed a NULL
pointer or a pointer to something uninitialized as iov to ktrace,
or we got a memory leak. In read/write (w/o -v) we zero-initialize
the iov now to limit damage, in the -v calls the (dynamically allocated)
pointer is checked after the I/O.
2003-09-16 15:55:26 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +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
dsl cb9a14ea0b Report ioctl read and write the correct way around. 2003-05-28 20:02:59 +00:00
dsl 3a7f8f18f1 ktrace ioctl data buffers
Optimise structure layout for 'struct selinfo' to avoid padding on 64bit
systems.  Use an entire variable for the 'collision' flag for efficiency.
2003-05-12 15:17:36 +00:00
jdolecek 0be1da3379 switch to LIST_FOREACH() in selrecord() 2003-03-26 17:50:16 +00:00
jdolecek a834690527 use LIST_FOREACH() in selwakeup() for the process's lwp walk loop 2003-03-22 14:13:06 +00:00
pk 2931081a79 Make updating a file's reference and use count MP-safe. 2003-02-23 14:37:32 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00
jdolecek 2c21ec9d61 Unfortunately, we can't really know if select collision is needed
until after wakeup event, so we can't clear the SI_COLL flag
in selrecord(). Thus, effectively back rev. 1.57 off.

Problem reported in PR kern/17517 by David Laight, program triggering
the problem is in regress/sys/kern/poll/poll3w.c.
2002-11-30 13:46:58 +00:00
jdolecek a45e0497c5 selwakeup(): don't bother with pfind() in SI_COLL case; sel_pid is always zero
in this case, and even if not, the process would be already woken up by the
wakeup() call
change sent as part of kern/17517 by David Laight

XXX perhaps should KASSERT() sel_pid is zero in the SI_COLL case
2002-11-29 19:48:22 +00:00
christos e22906f6d0 si_ -> sel_ to avoid conflicts with siginfo. 2002-11-26 18:44:34 +00:00
scw 0f91ed3dfa Quell uninitialised variable warnings. 2002-11-24 11:37:54 +00:00
thorpej 4d94adc849 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 23:15:21 +00:00
jdolecek 60be0b94a0 selscan(): make flag[] const 2002-08-08 20:40:25 +00:00
jdolecek 225f07a8d4 Make sure file descriptor is properly FILE_UNUSE()d in error case
of writev(2).
Problem found by Alistair G. Crooks.
2002-03-22 18:58:59 +00:00
atatat 31144d9976 Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command".  ERESTART is -1, which can lead to
confusion.  ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4.  No ioctl code should now return -1 anywhere.  The
ioctl() system call is now properly restartable.
2002-03-17 19:40:26 +00:00
christos 88db539589 Make poll(2) ignore negative file descriptors (Bang Jun-Young). 2001-11-14 18:43:58 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
itohy 36a6ce75fe Fix memory leak if
- ktrace enabled for I/O operaion, and
 - readv() causes an error.
2001-10-30 13:37:21 +00:00
atatat 298956dcf1 If no select collision is needed, try our best to avoid it by clearing
the flag.
2001-06-28 05:45:49 +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
lukem c9b9613b3e for FIOGETOWN, only change the sign of *data if fo_ioctl returned without error 2001-05-24 06:52:43 +00:00
lukem 1fa336cced oops; accidentally dropped an initialisation in pollscan() in previous.
called poll() to fail in interesting ways. noted by chs/nathanw
2001-02-27 04:44:51 +00:00
lukem 602451ac6e convert to ANSI KNF 2001-02-26 21:58:30 +00:00
thorpej 7da965dade splsched() is appropriate for select()/poll(). 2000-08-21 06:27:59 +00:00
thorpej a86d1f4891 Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it).  Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
2000-08-20 21:50:06 +00:00
thorpej c80a866888 MALLOC()/FREE() are not to be used for variable sized allocations. 2000-08-02 20:42:03 +00:00
thorpej ccb90e6fe9 When select(2)/poll(2) is awakened by a collision, recalculate the
timeout value for tsleep().  From Artur Grabowski <art@stacken.kth.se>.
2000-07-13 01:32:33 +00:00
sommerfeld 40339b39f9 Reduce use of curproc in several places:
- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

 - Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

 - Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

 - ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

 - move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

 - simplify interface to ktrwrite()
2000-05-27 00:40:29 +00:00
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00