summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_generic.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* pledge_ioctl_check() will do the killing if neccessary; if it returns,deraadt2015-10-111-2/+2
| | | | | that is an errno to pass up to the calling system call instead. test case is "who < /dev/null", via ttyname().
* another stray )deraadt2015-10-091-2/+2
|
* shortcircuit TIOCGETA to directly return ENOTTY for non-ttys. It couldderaadt2015-10-091-2/+3
| | | | | be called against a non-tty fd, so as to test "is this a tty". Discovered by sthen and rob pierce at the same time.
* Rename tame() to pledge(). This fairly interface has evolved to be morederaadt2015-10-091-4/+4
| | | | | | strict than anticipated. It allows a programmer to pledge/promise/covenant that their program will operate within an easily defined subset of the Unix environment, or it pays the price.
* Convert _TM_ flags to TAME_ flags, collapsing the entire mappingderaadt2015-09-111-2/+2
| | | | | | layer because the strings select the right options. Mechanical conversion. ok guenther
* Only include <sys/tame.h> in the .c files that need itguenther2015-09-111-1/+2
| | | | ok deraadt@ miod@
* Move to tame(int flags, char *paths[]) API/ABI.deraadt2015-08-221-2/+1
| | | | | | | | | | | | The pathlist is a whitelist of dirs and files; anything else returns ENOENT. Recommendation is to use a narrowly defined list. Also add TAME_FATTR, which permits explicit change operations against "struct stat" fields. Some other TAME_ flags are refined slightly. Not cranking libc now, since nothing commited in base uses this and the timing is uncomfortable for others. Discussed with many; thanks for a few bug fixes from semarie, doug, guenther. ok guenther
* Add ktracing of structs iovec, msghdr, and cmsghdr for {,p}{read,write}v(),guenther2015-07-281-1/+9
| | | | | | | sendmsg(), and recvmsg(). For cmsghdr, the len, level, and type are always shown, and for SOL_SOCKET,SCM_RIGHTS the fd numbers being passed are shown. ok millert@ deraadt@
* tame(2) is a subsystem which restricts programs into a "reduced featurederaadt2015-07-191-4/+10
| | | | | | operating model". This is the kernel component; various changes should proceed in-tree for a while before userland programs start using it. ok miod, discussions and help from many
* Set POLLHUP even if no valid events were specified as per POSIX.millert2015-05-101-3/+5
| | | | | | | | Since we use the poll backend for select(2), care must be taken not to set the fd's bit in writefds in this case. A kernel-only flag, POLLNOHUP, is used by selscan() to tell the poll backend not to return POLLHUP on EOF. This is currently only used by fifo_poll(). The fifofs regress now passes. OK guenther@
* Indroduce fd_getfile_mode() and use it were fd_getfile() is directlympi2015-04-301-19/+6
| | | | | | | followed by a mode check. This will simplify the ref/unref dance as soon as fd_getfile() will increment fp's reference counter. Idea from and ok guenther@, ok millert@
* Remove useless extern definitions of nselcoll and selwait.millert2015-02-121-2/+1
| | | | OK guenther@
* convert bcopy to memcpy. ok millerttedu2014-12-101-3/+3
|
* pass size argument to free()deraadt2014-11-031-8/+8
| | | | ok doug tedu
* use mallocarray to get the array of pollfd structs.dlg2014-10-131-5/+9
| | | | tweaks and ok millert@ deraadt@
* trim some caststedu2014-07-131-2/+2
|
* use mallocarray where arguments are multipled. ok deraadttedu2014-07-131-2/+2
|
* Refactor out dosigsuspend() functionmatthew2014-07-121-11/+5
| | | | Discussed with guenther and kettenis
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-8/+8
| | | | after discussions with beck deraadt kettenis.
* Repair compilability after the recent uvmexp changes, especially formiod2014-07-081-1/+3
| | | | not compile-time-known page size platforms.
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-3/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-2/+2
| | | | | | | | | struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
* bzero -> memsettedu2014-01-211-3/+3
|
* Correct the handling of I/O of >=2^32 bytes and the ktracing there ofguenther2013-09-141-4/+3
| | | | | | by using size_t/ssize_t instead of int/u_int to handle I/O lengths in uiomove(), vn_fsizechk(), and ktrgenio(). Eliminate the always-zero 'error' argument to ktrgenio() at the same time.
* Snapshots for all archs have been built, so remove the T32 codeguenther2013-09-141-140/+1
|
* Switch time_t, ino_t, clock_t, and struct kevent's ident and dataguenther2013-08-131-1/+140
| | | | | | | | | | | | | | | | | | | | members to 64bit types. Assign new syscall numbers for (almost all) the syscalls that involve the affected types, including anything with time_t, timeval, itimerval, timespec, rusage, dirent, stat, or kevent arguments. Add a d_off member to struct dirent and replace getdirentries() with getdents(), thus immensely simplifying and accelerating telldir/seekdir. Build perl with -DBIG_TIME. Bump the major on every single base library: the compat bits included here are only good enough to make the transition; the T32 compat option will be burned as soon as we've reached the new world are are happy with the snapshots for all architectures. DANGER: ABI incompatibility. Updating to this kernel requires extra work or you won't be able to login: install a snapshot instead. Much assistance in fixing userland issues from deraadt@ and tedu@ and build assistance from todd@ and otto@
* always implement stub utrace syscall, but keep the body #ifdef KTRACEtedu2013-06-011-1/+21
| | | | ok guenther matthew
* select(-1, ...) should fail with EINVAL.guenther2013-05-191-3/+5
| | | | ok matthew@
* Extend P_SIGSUSPEND handling in userret() to properly restore thematthew2013-04-291-62/+172
| | | | | | | | | | | | | | | sigmask even if there are no pending signals under the temporary sigmask. Refactor existing select() and poll() system calls to introduce the pselect() and ppoll() system calls. Add rthread wrappers for pselect() and ppoll(). While there, update cancellation point comments to reflect recent fdatasync() addition. Minor bumps for libc and librthread due to new symbols. ok guenther, millert, deraadt, jmc
* Print the fd_set used by select in kdump.claudio2012-07-091-1/+15
| | | | OK guenther@ and deraadt@
* Compare the size of the static fd_mask against the number of bytes neededclaudio2012-07-091-2/+2
| | | | | not against the number bit / number of fds in the select set. ok guenther@
* Add struct proc * argument to FRELE() and FILE_SET_MATURE() inguenther2012-04-221-6/+6
| | | | | | anticipation of further changes to closef(). No binary change. ok krw@ miod@ deraadt@
* Add tracing and dumping of "pointer to struct" syscall arguments forguenther2012-03-191-1/+5
| | | | | | structs timespec, timeval, sigaction, and rlimit. ok otto@ jsing@
* Hold struct filedesc's fd_lock when writing to the fd_ofiles, fd_ofileflags,guenther2012-02-151-4/+7
| | | | | | | | or fd_{lo,hi}maps members, or when doing a read for a write. Fixes hangs when an rthreaded processes sleeps while copying the fd table for fork() and catches another thread with the lock. ok jsing@ tedu@
* 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@