sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.
show more ...
Commit the 64-bit inode project.Extend the ino_t, dev_t, nlink_t types to 64-bit ints. Modifystruct dirent layout to add d_off, increase the size of d_filenoto 64-bits, increase the size of d_na
Commit the 64-bit inode project.Extend the ino_t, dev_t, nlink_t types to 64-bit ints. Modifystruct dirent layout to add d_off, increase the size of d_filenoto 64-bits, increase the size of d_namlen to 16-bits, and changethe required alignment. Increase struct statfs f_mntfromname[] andf_mntonname[] array length MNAMELEN to 1024.ABI breakage is mitigated by providing compatibility using versionedsymbols, ingenious use of the existing padding in structures, andby employing other tricks. Unfortunately, not everything can befixed, especially outside the base system. For instance, third-partyAPIs which pass struct stat around are broken in backward andforward incompatible ways.Kinfo sysctl MIBs ABI is changed in backward-compatible way, butthere is no general mechanism to handle other sysctl MIBS whichreturn structures where the layout has changed. It was consideredthat the breakage is either in the management interfaces, where weusually allow ABI slip, or is not important.Struct xvnode changed layout, no compat shims are provided.For struct xtty, dev_t tty device member was reduced to uint32_t.It was decided that keeping ABI compat in this case is more usefulthan reporting 64-bit dev_t, for the sake of pstat.Update note: strictly follow the instructions in UPDATING. Buildand install the new kernel with COMPAT_FREEBSD11 option enabled,then reboot, and only then install new world.Credits: The 64-bit inode project, also known as ino64, started lifemany years ago as a project by Gleb Kurtsou (gleb). Kirk McKusick(mckusick) then picked up and updated the patch, and acted as aflag-waver. Feedback, suggestions, and discussions were carriedby Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles),and Rick Macklem (rmacklem). Kris Moore (kris) performed an initialports investigation followed by an exp-run by Antoine Brodin (antoine).Essential and all-embracing testing was done by Peter Holm (pho).The heavy lifting of coordinating all these efforts and bringing theproject to completion were done by Konstantin Belousov (kib).Sponsored by: The FreeBSD Foundation (emaste, kib)Differential revision: https://reviews.freebsd.org/D10439
Second-to-last commit implementing Capsicum capabilities in the FreeBSDkernel for FreeBSD 9.0:Add a new capability mask argument to fget(9) and friends, allowing systemcall code to declare what c
Second-to-last commit implementing Capsicum capabilities in the FreeBSDkernel for FreeBSD 9.0:Add a new capability mask argument to fget(9) and friends, allowing systemcall code to declare what capabilities are required when an integer filedescriptor is converted into an in-kernel struct file *. With optionsCAPABILITIES compiled into the kernel, this enforces capabilityprotection; without, this change is effectively a no-op.Some cases require special handling, such as mmap(2), which must preserveinformation about the maximum rights at the time of mapping in the memorymap so that they can later be enforced in mprotect(2) -- this is done bynarrowing the rights in the existing max_protection field used for similarpurposes with file permissions.In namei(9), we assert that the code is not reached from within capabilitymode, as we're not yet ready to enforce namespace capabilities there.This will follow in a later commit.Update two capability names: CAP_EVENT and CAP_KEVENT becomeCAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what theyrepresent.Approved by: re (bz)Submitted by: jonathanSponsored by: Google Inc
Fix whitespace inconsistencies in the TTY layer and its drivers owned by me.
Add ttydisc_rint_simple().I noticed several drivers in our tree don't actually care about parityand framing, such as pts(4), snp(4) (and my partially finished consoledriver). Instead of duplicati
Add ttydisc_rint_simple().I noticed several drivers in our tree don't actually care about parityand framing, such as pts(4), snp(4) (and my partially finished consoledriver). Instead of duplicating a lot of code, I think we'd better add autility function for those drivers to quickly process a buffer of input.Also change pts(4) and snp(4) to use this function.
Keep this line shorter than 80 columns.
Add macros around the sx operations in snp(4).As an experiment, I changed snp(4) to use a mutex instead of an sx lock.We can't enable this right now, because Syscons still picks up Giant.It's nic
Add macros around the sx operations in snp(4).As an experiment, I changed snp(4) to use a mutex instead of an sx lock.We can't enable this right now, because Syscons still picks up Giant.It's nice to already have the framework there.
Slightly improve the design of the TTY buffer.The TTY buffers used the standard <sys/queue.h> lists. Unfortunatelythey have a big shortcoming. If you want to have a double linked list,but no tail
Slightly improve the design of the TTY buffer.The TTY buffers used the standard <sys/queue.h> lists. Unfortunatelythey have a big shortcoming. If you want to have a double linked list,but no tail pointer, it's still not possible to obtain the previouselement in the list. Inside the buffers we don't need them. This is whyI switched to custom linked list macros. The macros will also keep trackof the amount of items in the list. Because it doesn't use a sentinel,we can just initialize the queues with zero.In its simplest form (the output queue), we will only keep tworeferences to blocks in the queue, namely the head of the list and thelast block in use. All free blocks are stored behind the last block inuse.I noticed there was a very subtle bug in the previous code: in a veryuncommon corner case, it would uma_zfree() a block in the queue beforecalling memcpy() to extract the data from the block.
Change ttyhook_register() second argument from thread to process pointer.Thread was not really needed there, while previous ng_tty implementationthat used thread pointer had locking issues (using s
Change ttyhook_register() second argument from thread to process pointer.Thread was not really needed there, while previous ng_tty implementationthat used thread pointer had locking issues (using sx while holding mutex).
Reintroduce the snp(4) driver.Because the TTY hooks interface was not finished when I imported theMPSAFE TTY layer, I had to disconnect the snp(4) driver. This snp(4)implementation has been sitti
Reintroduce the snp(4) driver.Because the TTY hooks interface was not finished when I imported theMPSAFE TTY layer, I had to disconnect the snp(4) driver. This snp(4)implementation has been sitting in my P4 branch for some time now.Unfortunately it still doesn't use the same error handling as snp(4)(returning codes through FIONREAD), but it should already be usable.I'm committing this to SVN, hoping someone else could polish off itsrough edges. It's always better than having a broken driver sitting inthe tree.
Even though snp(4) in SVN is still broken, remove the unneeded D_NEEDMINOR.kib@ and I have decided we will MFC the bpf(4)/snp(4) fixes after we'vereleased 7.1. Make sure the code in HEAD doesn't r
Even though snp(4) in SVN is still broken, remove the unneeded D_NEEDMINOR.kib@ and I have decided we will MFC the bpf(4)/snp(4) fixes after we'vereleased 7.1. Make sure the code in HEAD doesn't refer to a flag wedon't need anyway.snp(4) in the MPSAFE TTY P4 branch already works, but still needs somepolishing before it can be integrated to SVN.
Convert the snp(4) driver to use cdevpriv.Now we have a single /dev/snp device node, which can be opened bywatch(8) multiple times. Even though snp(4) will be dead as of nextweek, it's nice havin
Convert the snp(4) driver to use cdevpriv.Now we have a single /dev/snp device node, which can be opened bywatch(8) multiple times. Even though snp(4) will be dead as of nextweek, it's nice having this in SVN, because:- We may want to MFC it to RELENG_7.- By the time we fix snp(4) again, it's already there, existing watch(8) binaries should already work.Just like bpf(4), I'm adding a symlink from snp0 to snp to remain binarycompatible.
Don't enforce unique device minor number policy anymore.Except for the case where we use the cloner library (clone_create() andfriends), there is no reason to enforce a unique device minor number
Don't enforce unique device minor number policy anymore.Except for the case where we use the cloner library (clone_create() andfriends), there is no reason to enforce a unique device minor numberpolicy. There are various drivers in the source tree that allocate unrpools and such to provide minor numbers, without using them themselves.Because we still need to support unique device minor numbers for thecloner library, introduce a new flag called D_NEEDMINOR. All cdevsw'sthat are used in combination with the cloner library should be markedwith this flag to make the cloning work.This means drivers can now freely use si_drv0 to store their own flagsand state, making it effectively the same as si_drv1 and si_drv2. Westill keep the minor() and dev2unit() routines around to make drivershappy.The NTFS code also used the minor number in its hash table. We shouldnot do this anymore. If the si_drv0 field would be changed, it would nolonger end up in the same list.Approved by: philip (mentor)
Move the check for the snp device being already attached after thefget() call, that is sleeping point, and possibly dropping Giant.The snp_target == NULL implies the snp_tty == NULL. Remove the co
Move the check for the snp device being already attached after thefget() call, that is sleeping point, and possibly dropping Giant.The snp_target == NULL implies the snp_tty == NULL. Remove the codethat is put under snp_target == NULL and snp_tty != NULL clause.In snpclose(), do the snp_detach() before scheduling the snp devicedestruction. Otherwise, after the return from snpclose(), the snpdevice is already removed from the snp_list, but tty is still insnooped state. Any attempt to do i/o on such tty cause panic becausettytosnp() returns NULL.Tested by: Peter HolmMFC after: 1 week
Do not allow the SNPSTTY ioctl for the snoop device that has a ttyattached. Otherwise, the snp->snp_tty would be overwritten, while thetty line discipline still set to the snpdisc. Then snplwrite()
Do not allow the SNPSTTY ioctl for the snoop device that has a ttyattached. Otherwise, the snp->snp_tty would be overwritten, while thetty line discipline still set to the snpdisc. Then snplwrite() causespanic because ttytosnp() cannot find the snp.MFC after: 1 week
Adopt snp to the destroy_dev_sched() KPI after reverting of destroy_dev()to not call destroy_dev_sched().Tested by: Peter HolmApproved by: re (kensmith)
Use make_dev_credf(MAKEDEV_REF) instead of make_dev() from snp clone handler.Drain clone events and cdev destruction from the module unload handler.Debugging help and testing by: Peter HolmApprov
Use make_dev_credf(MAKEDEV_REF) instead of make_dev() from snp clone handler.Drain clone events and cdev destruction from the module unload handler.Debugging help and testing by: Peter HolmApproved by: re (kensmith)
Switch to ANSI function declarations.
Restore the ability to detach from a tty via SIOCSTTY and documentrecent changes in a manpage.Reviewed by: cognet
Slightly change the API for the SNPSTTY ioctl so that the userland nowprovides a file descriptor instead of a dev_t.Discussed with: phkMFC after: 3 days
Merge the dev_clone and dev_clone_cred event handlers into a singleevent handler, dev_clone, which accepts a credential argument.Implementors of the event can ignore it if they're not interested,a
Merge the dev_clone and dev_clone_cred event handlers into a singleevent handler, dev_clone, which accepts a credential argument.Implementors of the event can ignore it if they're not interested,and most do. This avoids having multiple event handler types andfall-back/precedence logic in devfs.This changes the kernel API for /dev cloning, and may affect thirdparty packages containg cloning kernel modules.Requested by: phkMFC after: 3 days
Explicitly hold a reference to the cdev we have just cloned. Thiscloses the race where the cdev was reclaimed before it ever made itback to devfs lookup.
Disable two users of findcdev. They do the wrong thing now and willneed to be fixed. In both cases the API should be reengineered to dosomething (more) sensible.
Start each of the license/copyright comments with /*-, minor shuffle of lines
Include fcntl.h not vnode.h.Include uio.h instead of relying on vnode.h to do so.Check O_NONBLOCK not IO_NDELAY.
12345