summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_generic.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Document a non-obvious reason why something can't overflow.guenther2011-11-061-3/+5
| | | | Discussed with deraadt@
* Since we have an ioctl that uses a struct with an off_t member as itskettenis2010-12-191-2/+2
| | | | | | | | argument, we need to make sure this buffer has 64-bit alignment, even on 32-bit architectures. Fixes the alignment trap triggered by vnconfig(8) on sparc for kernels compiled with gcc4. ok miod@
* delete some rogue spaces and tabs. no binary change.marco2010-08-181-8/+8
|
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-4/+4
| | | | | | | | | so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
* Devices which don't have read or write functionality should not returnderaadt2010-07-081-2/+8
| | | | | | | enodev to poll, because this returns an errno of 19 in revents. Oops. Use seltrue where needed, and use a new selfalse function for those which don't know if the next op will be non-blocking Mostly discussed with guenther and miod
* In sys_ioctl(), change the type of stkbuf to u_long to make sure it iskettenis2010-04-111-3/+3
| | | | | | | | properly aligned. Otherwise we lose on strict alignment architectures if the compiler happens to give it a smaller alignment. Fixes another gcc4 problem on sparc64. ok miod@
* Every selwakeup() should have a matching KNOTE() (even if kqueue isn'tnicm2009-11-091-1/+2
| | | | | | | | | | supported it doesn't do any harm), so put the KNOTE() in selwakeup() itself and remove it from any occurences where both are used, except one for kqueue itself and one in sys_pipe.c (where the selwakeup is under a PIPE_SEL flag). Based on a diff from tedu. ok deraadt
* must calculate iovlen or ktrace panics the machine; diff from blambertderaadt2009-06-081-5/+7
| | | | | and it is pretty critical so commiting it now. Any more fallout from the code 'simplication'?
* Put readv/writev changes back in, as they no longer hang ckuethe's ntpd.blambert2009-06-041-158/+61
| | | | | | Special thanks to ckuethe's ntpd for noticing the problem. ok deraadt@
* Revert readv/writev changes, as they trigger an apparent file descriptorblambert2009-06-031-81/+183
| | | | | | deadlock for ckuethe@ "if you have to revert, you have to revert" deraadt@
* set needfree to NULL in sys_writev() so stack garbagethib2009-06-021-2/+2
| | | | | | does not cause us to call free if we never malloced. crash found by & OK marco@
* it is better when ramdisks compilederaadt2009-06-021-3/+3
|
* dofile{read,write} are essentially identical to their iovec equivalents,blambert2009-06-021-183/+81
| | | | | | | dofile{read,write}v, so remove the former and rework it so that everything uses the latter "nice" deraadt@ "reads ok" oga@ spastic 'OMG Ponies!!!!' weingart@
* Only copy out the revents field, not the whole pollfd structure. Thiskurt2009-03-241-3/+23
| | | | | | | allows threaded programs to concurrently update the events field while a thread is blocked in poll(2). okay deraadt@ millert@
* Move the functionality of psignal() to a new function ptsignal()guenther2008-12-161-3/+3
| | | | | | | | | | | | | that takes an additional argument "type" that indicates whether the signal is for the process, just a particular thread, or propagated to a thread because it's not caught or blocked. psignal() becomes a wrapper that does the first of those. So that sys_kill() can tell apart signals for the process and signals for the process's original thread, the tid of the original thread is defined as its pid + THREAD_PID_OFFSET. ok tedu@ art@ andreas@ kurt@ "better early than late" deraadt@
* Use M_ZERO in a few more places to shave bytes from the kernel.art2007-09-071-3/+2
| | | | eyeballed and ok dlg@
* Back out the tracking of procs in struct selinfo. There's one seriousart2007-07-251-36/+20
| | | | | | | bug in the code, but as soon as I try to fix it, it seems to trigger some other bugs. Instead of trying to figure out what's going on while everyone suffers, it's better to back out and figure out the bugs outside the tree.
* Kill the horrible hack of storing the pid in struct selinfo.art2007-03-241-20/+36
| | | | | | | | Instead, keep the proc pointer in it and put the selinfo on a list in struct proc in selrecord. Then clean up the list when leaving sys_select and sys_poll. miod@ ok, testing by many, including Bobs spamd boxes.
* Since p_flag is often manipulated in interrupts and without biglockart2007-03-151-8/+8
| | | | | | | | | | | | it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int. Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way. kettenis@ ok
* Repair FIOGETOWN operation; from Alexandre Ratchov.miod2006-04-151-7/+7
|
* do per file io accounting and show that in fstat as well; pedro@ marco@ okmickey2006-03-261-3/+14
|
* copyout() the pollfds if poll() gets interrupted. This resets the reventsclaudio2006-03-151-2/+4
| | | | | bitmask and makes poll() behave like documented in the man page. OK deraadt@
* ansi/deregister. No binary change.jsg2005-12-131-77/+24
|
* sys_select() used to use 6 local fd_set's in case the width was <= thederaadt2005-08-011-22/+16
| | | | | | | size of an fd_set (ie. 256 bits), to avoid the malloc. that is a lot of local storage. change the cross-over point to 32-bits, which is more fair. if you select with large widths, you pay the price. tested by dlg, read by millert and pascoe, run on all machines
* This moves access to wall and uptime variables in MI code,tholo2004-06-241-23/+30
| | | | | | | | | | | | | | encapsulating all such access into wall-defined functions that makes sure locking is done as needed. It also cleans up some uses of wall time vs. uptime some places, but there is sure to be more of these needed as well, particularily in MD code. Also, many current calls to microtime() should probably be changed to getmicrotime(), or to the {,get}microuptime() versions. ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others "Oh, that is not your problem!" from miod@
* debranch SMP, have funniklas2004-06-131-3/+4
|
* Add an nfds_t type as per POSIX and also add pollfd_t like Solaris has.millert2003-12-101-11/+11
|
* Replace select backends with poll backends. selscan() and pollscan()millert2003-09-231-40/+31
| | | | | | | now call the poll backend. With this change we implement greater poll(2) functionality instead of emulating it via the select backend. Adapted from NetBSD and including some changes from FreeBSD. Tested by many, deraadt@ OK
* match syscallargs comments with realityhenning2003-09-011-2/+2
| | | | | from Patrick Latifi <patrick.l@hermes.usherb.ca> ok jason@ tedu@
* remove caddr_t casts. it's just silly to cast something when the functiontedu2003-07-211-15/+14
| | | | takes a void *. convert uiomove to take a void * as well. ok deraadt@
* fix nfds type; tedu marc okderaadt2003-06-231-2/+7
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Missing FRELE() call on writev(2) error condition; art@ ok.aaron2002-08-121-3/+5
|
* SCARG cleanup; okay millert@provos2002-08-111-21/+16
|
* First round of __P removal in sysmillert2002-03-141-4/+4
|
* On sparc, PAGE_SIZE and friends might not be a compile-time constant.miod2002-03-131-1/+3
| | | | | | | | | | Instead of using a homegrown set of variables in this case, rely on uvmexp fields once uvm has been initialized. This requires a few #include <uvm/uvm_extern.h> here and there in the kernel as well. Idea from art@, changes by me.
* More FREF/FRELE on relevant places. Now, only sys_mmap and a bunch of ioctl functions in sys/compat are left.art2002-02-131-10/+15
|
* Require a FREFd file in dofilewrite{,v}.art2002-02-081-3/+9
|
* require a FREFd fp in dofilereadv. Fix some comments.art2002-02-081-3/+6
|
* - Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't haveart2002-02-081-12/+3
| | | | | | | | | | | | | | the same semantics as NetBSD anyway, so it's good to avoid name collissions. - Always fdremove before freeing the file, not the other way around. - falloc FREFs the file. - have FILE_SET_MATURE FRELE the file (It feels like a good ortogonality to falloc FREFing the file). - Use closef as much as possible instead of ffree in error paths of falloc:ing functions. closef is much more careful with the fd and can deal with the fd being forcibly closed by dup2. Also try to avoid manually calling *fo_close when closef can do that for us (this makes some error paths mroe complicated (sys_socketpair and sys_pipe), but others become simpler (sys_open)).
* Add counting of temporary references to a struct file (as opposed to referencesart2002-02-051-4/+4
| | | | | | | | | | | | | | | from fd tables and other long-lived objects). This is to avoid races between using a file descriptor and having another process (with shared fd table) close it. We use a separate refence count so that error values from close(2) will be correctly returned to the caller of close(2). The macros for those reference counts are FILE_USE(fp) and FILE_UNUSE(fp). Make sure that the cases where closef can be called "incorrectly" (most notably dup2(2)) are handled. Right now only callers of closef (and {,p}read) use FILE_{,UN}USE correctly, more fixes incoming soon.
* Be more consistent about using fd_getfile where it matters.art2002-02-021-13/+4
|
* in poll, if fd is < 0, clear revents; bjy@mogua.orgderaadt2001-11-141-1/+4
|
* - every new fd created by falloc() is marked as larval and should not be usedart2001-10-261-39/+14
| | | | | | | any anyone. Every caller of falloc matures the fd when it's usable. - Since every lookup in the fd table must now check this flag and all of them do the same thing, move all the necessary checks into a function - fd_getfile.
* No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)ho2001-05-161-6/+2
|
* Change the ktrace interface functions from taking the trace vnode to taking theart2000-11-101-5/+5
| | | | traced proc. The vnode is in the proc and all functions need the proc.
* replace MALLOC/FREE w/ malloc/free for non-constant-sized memory allocations; art@ okmickey2000-09-271-11/+9
|
* Isn't code sharing great?art2000-07-071-11/+10
| | | | poll had the same timeout problem as select.
* When select is awakened by a select collission, we need to recalculateart2000-07-071-13/+9
| | | | the timeout.
* p{read,write}{,v} from csapuntz, partial NetBSD origin I thinkderaadt2000-04-201-89/+231
|