History log of /src/sys/kern/tty_ptm.c |
Revision | | Date | Author | Comments |
1.47 |
| 05-Aug-2025 |
gutteridge | tty_ptm.c: support setting O_CLOFORK here as well
|
1.46 |
| 09-Apr-2023 |
riastradh | branches: 1.46.8; kern: KASSERT(A && B) -> KASSERT(A); KASSERT(B)
|
1.45 |
| 29-Sep-2022 |
christos | Add fd_set_exclose(). It is probably better to do this automatically in fd_affix()...
|
1.44 |
| 24-Sep-2022 |
christos | Propagate the open flags to the master pty (Anthony Mallet)
|
1.43 |
| 29-Jun-2021 |
dholland | Add containment for the cloning devices hack in vn_open.
Cloning devices (and also things like /dev/stderr) work by allocating a struct file, stuffing it in the file table (which is a layer violation), stuffing the file descriptor number for it in a magic field of struct lwp (which is gross), and then "failing" with one of two magic errnos, EDUPFD or EMOVEFD.
Before this commit, all callers of vn_open in the kernel (there are quite a few) were expected to check for these errors and handle the situation. Needless to say, none of them except for open() itself did, resulting in internal negative errnos being returned to userspace.
This hack is fairly deeply rooted and cannot be eliminated all at once. This commit adds logic to handle the magic errnos inside vn_open; now on success vn_open returns either a vnode or an integer file descriptor, along with a flag that says whether the underlying code requested EDUPFD or EMOVEFD. Callers not prepared to cope with file descriptors can pass NULL for the extra return values, in which case if a file descriptor would be produced vn_open fails with EOPNOTSUPP.
Since I'm rearranging vn_open's signature anyway, stop exposing struct nameidata. Instead, take three arguments: an optional vnode to use as the starting point (like openat()), the path, and additional namei flags to use, restricted to NOCHROOT and TRYEMULROOT. (Other namei behavior, e.g. NOFOLLOW, can be requested via the open flags.)
This change requires a kernel bump. Ride the one an hour ago. (That was supposed to be coordinated; did not intend to let an hour slip by. My fault.)
|
1.42 |
| 23-May-2020 |
ad | branches: 1.42.6; PR kern/55237: Panic: vrelel: bad ref count (9.99.54)
Adjust v_writecount with v_interlock held.
|
1.41 |
| 30-Nov-2019 |
ad | VOP_UNLOCK + vrele -> vput
|
1.40 |
| 01-Mar-2019 |
pgoyette | Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly discussed on irc.
NFCI intended.
Ride the earlier kernel bump - it;s getting crowded.
|
1.39 |
| 29-Jan-2019 |
pgoyette | Normalize all the compat hooks' names to the form
<subsystem>_<function>_<version>_hook
NFCI
XXX Note that although this introduces a change in the kernel-to- XXX module interface, we are NOT bumping the kernel version number. XXX We will bump the version number once the interface stabilizes.
|
1.38 |
| 27-Jan-2019 |
pgoyette | Merge the [pgoyette-compat] branch
|
1.37 |
| 24-Aug-2015 |
pooka | branches: 1.37.2; 1.37.8; 1.37.16; 1.37.18; to garnish, dust with _KERNEL_OPT
|
1.36 |
| 20-Aug-2015 |
christos | include ioconf.h instead of locally declaring the prototype of the attach function
|
1.35 |
| 15-Oct-2014 |
christos | branches: 1.35.2; From Ilia Zykov: - correct some incorrect comments - add XXX warning - increase security by activating when get the slave - make pty_vn_open() private to tty_ptm.c
|
1.34 |
| 05-Sep-2014 |
matt | Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get a correctly typed pointer.
|
1.33 |
| 25-Jul-2014 |
dholland | Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
|
1.32 |
| 04-Apr-2014 |
christos | branches: 1.32.2; Kernel portion of the multiple ptyfs mount support. Protocol changed between kernel and module, so bump. (Ilya Zykov)
|
1.31 |
| 27-Mar-2014 |
christos | From Ilya Zykov: - ifdef out some code that is only used for NO_DEV_PTM - pass the mountpoint instead of the ptm structure to the implementation dependent (ptyfs or bsdpty) functions. - add a function to return the correct ptyfs mountpoint for the current lwp
|
1.30 |
| 19-Mar-2014 |
christos | fix leak on error from pty_fill_ptmget (Ilya Zykov)
|
1.29 |
| 16-Mar-2014 |
dholland | Change (mostly mechanically) every cdevsw/bdevsw I can find to use designated initializers.
I have not built every extant kernel so I have probably broken at least one build; however I've also found and fixed some wrong cdevsw/bdevsw entries so even if so I think we come out ahead.
|
1.28 |
| 19-Oct-2012 |
apb | branches: 1.28.2; Add COMPAT_60 versions of the TIOCPTMGET and TIOCPTSNAME ioctls.
|
1.27 |
| 24-Jun-2010 |
hannken | branches: 1.27.8; 1.27.18; Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.
Welcome to 5.99.32.
Discussed on tech-kern.
|
1.26 |
| 22-Jan-2009 |
yamt | branches: 1.26.4; 1.26.6; malloc -> kmem_alloc
|
1.25 |
| 28-Apr-2008 |
martin | branches: 1.25.8; Remove clause 3 and 4 from TNF licenses
|
1.24 |
| 21-Mar-2008 |
ad | branches: 1.24.2; 1.24.4; Catch up with descriptor handling changes. See kern_descrip.c revision 1.173 for details.
|
1.23 |
| 24-Jan-2008 |
ad | branches: 1.23.6; specfs changes for PR kern/37717 (raidclose() is no longer called on shutdown). There are still problems with device access and a PR will be filed.
- Kill checkalias(). Allow multiple vnodes to reference a single device.
- Don't play dangerous tricks with block vnodes to ensure that only one vnode can describe a block device. Instead, prohibit concurrent opens of block devices. As a bonus remove the unreliable code that prevents multiple file system mounts on the same device. It's no longer needed.
- Track opens by vnode and by device. Issue cdev_close() when the last open goes away, instead of abusing vnode::v_usecount to tell if the device is open.
|
1.22 |
| 02-Jan-2008 |
ad | Merge vmlocking2 to head.
|
1.21 |
| 26-Nov-2007 |
pooka | branches: 1.21.2; 1.21.6; Remove the "struct lwp *" argument from all VFS and VOP interfaces. The general trend is to remove it from all kernel interfaces and this is a start. In case the calling lwp is desired, curlwp should be used.
quick consensus on tech-kern
|
1.20 |
| 10-Oct-2007 |
ad | branches: 1.20.4; Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking. - simple_lock -> kmutex in a few places. - Fix some simple locking problems.
|
1.19 |
| 26-Mar-2007 |
hubertf | branches: 1.19.8; 1.19.10; 1.19.12; Remove duplicate #include's From: Slava Semushin <php-coder@altlinux.ru>
|
1.18 |
| 12-Mar-2007 |
ad | branches: 1.18.2; Use mutexes/condvars.
|
1.17 |
| 04-Mar-2007 |
christos | branches: 1.17.2; 1.17.4; Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
|
1.16 |
| 27-Dec-2006 |
alc | branches: 1.16.2; CID-4197,4198: ensure that `fp' is not NULL before calling FILE_UNUSE()
ok christos@
|
1.15 |
| 01-Nov-2006 |
yamt | remove some __unused from function parameters.
|
1.14 |
| 12-Oct-2006 |
christos | - sprinkle __unused on function decls. - fix a couple of unused bugs - no more -Wno-unused for i386
|
1.13 |
| 08-Oct-2006 |
christos | Don't re-use dev in ptmopen, because we need to check the minor again for linux. Add some more debugging.
|
1.12 |
| 22-Sep-2006 |
christos | PR/32682: Hauke Fath: netbsd-3 ptyfs intermittent failure with Matlab
For the benefit of linux emulation create a new minor device '2' which is a ptmx with linux semantics. Linux changes the permissions of the slave pty upon creation, not when grantpt(3) is called. The glibc linux grantpt(3) checks that the pty is on ptyfs, and if it is, it does nothing. To make use of this fix:
mknod /emul/linux/dev/ptmx c 165 2 chmod 666 /emul/linux/dev/ptmx
This is a lot simpler than copying a bunch of code and creating a ptmx device just for the benefit of linux emulation.
|
1.11 |
| 23-Jul-2006 |
ad | branches: 1.11.4; 1.11.6; Use the LWP cached credentials where sane.
|
1.10 |
| 17-Jul-2006 |
ad | Just use proc0.p_cred where root credentials are needed, instead of allocating a new kauth_cred_t.
|
1.9 |
| 14-May-2006 |
elad | integrate kauth.
|
1.8 |
| 13-Apr-2006 |
christos | Strip the chrooted portion of the path from the reported pty path. Reported and tested by Lasse Kliemann. Thanks!
|
1.7 |
| 11-Dec-2005 |
christos | branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12; merge ktrace-lwp.
|
1.6 |
| 09-Dec-2005 |
he | Move a misplaced #endif, so that NO_DEV_PTM builds don't get a duplicate definition of ptm_cdevsw.
|
1.5 |
| 08-Dec-2005 |
thorpej | Sprinkle static.
|
1.4 |
| 30-Nov-2004 |
christos | branches: 1.4.12; 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
|
1.3 |
| 24-Nov-2004 |
christos | Limit the hard-coding of things to tty_bsdpty.c.
|
1.2 |
| 13-Nov-2004 |
christos | branches: 1.2.2; In TIOCPTSNAME return the minor number of the device in the fd portion of the structures. It is more useful than -1 and cheap to do. Linux pty emulation uses it.
|
1.1 |
| 10-Nov-2004 |
christos | Split the ptm driver out of tty_pty.c into its own file. From that split the code that `knows' about /dev/[pt]tyXX names (the BSD ptys) into a separate file. Make an interface to be used by the tty creating provider. The code to enable old PTY searching via ptm is enabled via COMPAT_BSDPTY, and it is turned on by default on all kernels that have compatibility options enabled.
|
1.2.2.5 |
| 11-Dec-2005 |
christos | Sync with head.
|
1.2.2.4 |
| 18-Dec-2004 |
skrll | Sync with HEAD.
|
1.2.2.3 |
| 29-Nov-2004 |
skrll | Sync with HEAD.
|
1.2.2.2 |
| 14-Nov-2004 |
skrll | Sync with HEAD.
|
1.2.2.1 |
| 13-Nov-2004 |
skrll | file tty_ptm.c was added on branch ktrace-lwp on 2004-11-14 08:15:57 +0000
|
1.4.12.8 |
| 24-Mar-2008 |
yamt | sync with head.
|
1.4.12.7 |
| 04-Feb-2008 |
yamt | sync with head.
|
1.4.12.6 |
| 21-Jan-2008 |
yamt | sync with head
|
1.4.12.5 |
| 07-Dec-2007 |
yamt | sync with head
|
1.4.12.4 |
| 27-Oct-2007 |
yamt | sync with head.
|
1.4.12.3 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.4.12.2 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.4.12.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.7.12.1 |
| 24-May-2006 |
tron | Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
|
1.7.10.3 |
| 06-May-2006 |
christos | - Move kauth_cred_t declaration to <sys/types.h> - Cleanup struct ucred; forward declarations that are unused. - Don't include <sys/kauth.h> in any header, but include it in the c files that need it.
Approved by core.
|
1.7.10.2 |
| 19-Apr-2006 |
elad | sync with head.
|
1.7.10.1 |
| 08-Mar-2006 |
elad | Adapt to kernel authorization KPI.
|
1.7.8.2 |
| 11-Aug-2006 |
yamt | sync with head
|
1.7.8.1 |
| 24-May-2006 |
yamt | sync with head.
|
1.7.6.2 |
| 01-Jun-2006 |
kardel | Sync with head.
|
1.7.6.1 |
| 22-Apr-2006 |
simonb | Sync with head.
|
1.7.4.1 |
| 09-Sep-2006 |
rpaulo | sync with head
|
1.11.6.2 |
| 10-Dec-2006 |
yamt | sync with head.
|
1.11.6.1 |
| 22-Oct-2006 |
yamt | sync with head
|
1.11.4.2 |
| 12-Jan-2007 |
ad | Sync with head.
|
1.11.4.1 |
| 18-Nov-2006 |
ad | Sync with head.
|
1.16.2.3 |
| 15-Apr-2007 |
yamt | sync with head.
|
1.16.2.2 |
| 24-Mar-2007 |
yamt | sync with head.
|
1.16.2.1 |
| 12-Mar-2007 |
rmind | Sync with HEAD.
|
1.17.4.1 |
| 11-Jul-2007 |
mjf | Sync with head.
|
1.17.2.3 |
| 17-Jun-2007 |
ad | - Increase the number of thread priorities from 128 to 256. How the space is set up is to be revisited. - Implement soft interrupts as kernel threads. A generic implementation is provided, with hooks for fast-path MD code that can run the interrupt threads over the top of other threads executing in the kernel. - Split vnode::v_flag into three fields, depending on how the flag is locked (by the interlock, by the vnode lock, by the file system). - Miscellaneous locking fixes and improvements.
|
1.17.2.2 |
| 10-Apr-2007 |
ad | Sync with head.
|
1.17.2.1 |
| 13-Mar-2007 |
ad | Sync with head.
|
1.18.2.1 |
| 29-Mar-2007 |
reinoud | Pullup to -current
|
1.19.12.1 |
| 14-Oct-2007 |
yamt | sync with head.
|
1.19.10.3 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.19.10.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.19.10.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.19.8.2 |
| 27-Nov-2007 |
joerg | Sync with HEAD. amd64 Xen support needs testing.
|
1.19.8.1 |
| 26-Oct-2007 |
joerg | Sync with HEAD.
Follow the merge of pmap.c on i386 and amd64 and move pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup code to restore CR4 before jumping back into kernel space as the large page option might cover that.
|
1.20.4.2 |
| 18-Feb-2008 |
mjf | Sync with HEAD.
|
1.20.4.1 |
| 08-Dec-2007 |
mjf | Sync with HEAD.
|
1.21.6.1 |
| 02-Jan-2008 |
bouyer | Sync with HEAD
|
1.21.2.1 |
| 04-Dec-2007 |
ad | Pull the vmlocking changes into a new branch.
|
1.23.6.3 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.23.6.2 |
| 01-May-2008 |
mjf | Create /dev/ptm{,x} dynamically.
|
1.23.6.1 |
| 03-Apr-2008 |
mjf | Sync with HEAD.
|
1.24.4.3 |
| 11-Aug-2010 |
yamt | sync with head.
|
1.24.4.2 |
| 04-May-2009 |
yamt | sync with head.
|
1.24.4.1 |
| 16-May-2008 |
yamt | sync with head.
|
1.24.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.25.8.1 |
| 03-Mar-2009 |
skrll | Sync with HEAD.
|
1.26.6.1 |
| 03-Jul-2010 |
rmind | sync with head
|
1.26.4.1 |
| 17-Aug-2010 |
uebayasi | Sync with HEAD.
|
1.27.18.3 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.27.18.2 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.27.18.1 |
| 20-Nov-2012 |
tls | Resync to 2012-11-19 00:00:00 UTC
|
1.27.8.2 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.27.8.1 |
| 30-Oct-2012 |
yamt | sync with head
|
1.28.2.1 |
| 18-May-2014 |
rmind | sync with head
|
1.32.2.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.35.2.1 |
| 22-Sep-2015 |
skrll | Sync with HEAD
|
1.37.18.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.37.18.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.37.16.6 |
| 22-Jan-2019 |
pgoyette | Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line rather than defining an intermediate hook##call function. Almost all of the hooks are called only once, and although we lose the ability of doing things like
if (MODULE_HOOK_CALL(...) == 0) ...
we simplify things quite a bit. With this change, we no longer need to have both declaration and definition macros, and the definition no longer needs to have both prototype argument list and a "real" argument list.
FWIW, the above if now needs to written as
int ret;
MODULE_HOOK_CALL(..., ret); if (ret == 0) ...
with appropriate use of braces {}.
|
1.37.16.5 |
| 18-Jan-2019 |
pgoyette | Don't restrict hooks to having only int or void types. Pass the hook's type to the various macros, as needed.
Allows us to reduce diffs to original in at least one or two places (we no longer have to provide an additional parameter to the hook routine for returning a non-int return value).
|
1.37.16.4 |
| 14-Jan-2019 |
pgoyette | Create a variant of the HOOK macros that handles hook routines of type void, and use them where appropriate.
|
1.37.16.3 |
| 13-Jan-2019 |
pgoyette | Remove the HOOK2 versions of the MODULE_HOOK macros. There were only a few uses, and using them led to some lack of clarity in the code. Instead, we now use two separate hooks, with names that make it clear(er) what we're doing.
This also positions us to start unraveling some of the rtsock_50 mess, which will need (at least) five hooks.
|
1.37.16.2 |
| 15-Oct-2018 |
pgoyette | Convert another hook to the MP-sfe mechanism.
XXX still have three more to convert: openat_10, sysvipc50_sysctl and XXX compat70_unp_addsockcred
|
1.37.16.1 |
| 04-Sep-2018 |
pgoyette | Separate COMPAT_BSDPTY stuff from tty COMPAT_60 stuff. Enables building of COMPAT_60 module whether or not COMPAT_BSDPTY is defined in the kernel.
|
1.37.8.2 |
| 29-Apr-2017 |
pgoyette | Remove more unnecessary #include for sys/localcount.h
|
1.37.8.1 |
| 27-Apr-2017 |
pgoyette | Restore all work from the former pgoyette-localcount branch (which is now abandoned doe to cvs merge botch).
The branch now builds, and installs via anita. There are still some problems (cgd is non-functional and all atf tests time-out) but they will get resolved soon.
|
1.37.2.3 |
| 26-Jul-2016 |
pgoyette | Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT. This better describes what we're doing, and why.
|
1.37.2.2 |
| 19-Jul-2016 |
pgoyette | Instead of repeatedly typing the conditional initialization of the .d_localcount members in the various {b,c}devsw, define an initializer macro and use it. This also removes the need for defining new symbols for each 'struct localcount'.
As suggested by riastradh@
|
1.37.2.1 |
| 18-Jul-2016 |
pgoyette | Rump drivers are always installed via devsw_attach() so we need to always allocate a 'struct localcount' for these drivers whenever they are built as modules.
|
1.42.6.1 |
| 01-Aug-2021 |
thorpej | Sync with HEAD.
|
1.46.8.1 |
| 08-Aug-2025 |
martin | Pull up following revision(s) (requested by gutteridge in ticket #8):
tests/lib/libc/ttyio/t_ptm.c: revision 1.3 lib/libc/stdlib/posix_openpt.3: revision 1.11 sys/kern/tty_ptm.c: revision 1.47
tty_ptm.c: support setting O_CLOFORK here as well
t_ptm.c: now also validate O_CLOFORK can be set
posix_openpt.3: note O_CLOFORK is also now supported
|