The NetBSD Project

CVS log for src/sys/kern/subr_exec_fd.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.11.6.1 / (download) - annotate - [select for diffs], Sun Aug 1 22:42:38 2021 UTC (22 months ago) by thorpej
Branch: thorpej-i2c-spi-conf
Changes since 1.11: +7 -7 lines
Diff to previous 1.11 (colored) next main 1.12 (colored)

Sync with HEAD.

Revision 1.12 / (download) - annotate - [select for diffs], Tue Jun 29 22:40:53 2021 UTC (23 months ago) by dholland
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-futex2-base, thorpej-futex2, thorpej-cfargs2-base, thorpej-cfargs2, netbsd-10-base, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Changes since 1.11: +7 -7 lines
Diff to previous 1.11 (colored)

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.)

Revision 1.11 / (download) - annotate - [select for diffs], Sat May 23 23:42:43 2020 UTC (3 years ago) by ad
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-futex, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Branch point for: thorpej-i2c-spi-conf
Changes since 1.10: +4 -4 lines
Diff to previous 1.10 (colored)

Move proc_lock into the data segment.  It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.

Revision 1.7.20.2 / (download) - annotate - [select for diffs], Wed Apr 8 14:08:52 2020 UTC (3 years, 1 month ago) by martin
Branch: phil-wifi
Changes since 1.7.20.1: +8 -6 lines
Diff to previous 1.7.20.1 (colored) to branchpoint 1.7 (colored) next main 1.8 (colored)

Merge changes from current as of 20200406

Revision 1.8.6.1 / (download) - annotate - [select for diffs], Sat Feb 29 20:21:03 2020 UTC (3 years, 3 months ago) by ad
Branch: ad-namecache
Changes since 1.8: +8 -6 lines
Diff to previous 1.8 (colored) next main 1.9 (colored)

Sync with head.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Feb 1 02:23:23 2020 UTC (3 years, 4 months ago) by riastradh
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh, ad-namecache-base3
Changes since 1.9: +5 -4 lines
Diff to previous 1.9 (colored)

Load struct fdfile::ff_file with atomic_load_consume.

Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper.  And a little clearer without a long comment.)

Revision 1.9 / (download) - annotate - [select for diffs], Sat Feb 1 02:23:04 2020 UTC (3 years, 4 months ago) by riastradh
Branch: MAIN
Changes since 1.8: +5 -4 lines
Diff to previous 1.8 (colored)

Load struct filedesc::fd_dt with atomic_load_consume.

Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:

- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
  => This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
  => atomic_load_consume serves the same purpose now.
  => Was needed only on alpha anyway.

Revision 1.7.20.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:09:03 2019 UTC (3 years, 11 months ago) by christos
Branch: phil-wifi
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

Sync with HEAD

Revision 1.8 / (download) - annotate - [select for diffs], Mon Apr 8 13:05:23 2019 UTC (4 years, 1 month ago) by maya
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, isaki-audio2-base, isaki-audio2, ad-namecache-base2, ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

Update comment to match existing function name.

Revision 1.6.12.1 / (download) - annotate - [select for diffs], Sun Dec 3 11:38:45 2017 UTC (5 years, 6 months ago) by jdolecek
Branch: tls-maxphys
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored) next main 1.7 (colored)

update from HEAD

Revision 1.7 / (download) - annotate - [select for diffs], Fri Sep 5 09:20:59 2014 UTC (8 years, 8 months ago) by matt
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, nick-nhusb-base-20170204, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, nick-nhusb, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: phil-wifi
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored)

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.

Revision 1.5.2.1 / (download) - annotate - [select for diffs], Thu Jun 23 14:20:20 2011 UTC (11 years, 11 months ago) by cherry
Branch: cherry-xenmp
Changes since 1.5: +31 -2 lines
Diff to previous 1.5 (colored) next main 1.6 (colored)

Catchup with rmind-uvmplock merge.

Revision 1.2.4.3 / (download) - annotate - [select for diffs], Sun Jun 12 00:24:29 2011 UTC (11 years, 11 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.2.4.2: +29 -0 lines
Diff to previous 1.2.4.2 (colored) to branchpoint 1.2 (colored) next main 1.3 (colored)

sync with head

Revision 1.4.2.1 / (download) - annotate - [select for diffs], Mon Jun 6 09:09:34 2011 UTC (12 years ago) by jruoho
Branch: jruoho-x86intr
Changes since 1.4: +5 -37 lines
Diff to previous 1.4 (colored) next main 1.5 (colored)

Sync with HEAD.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jun 1 21:25:01 2011 UTC (12 years ago) by alnsn
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-uvmplock-nbase, rmind-uvmplock-base, rmind-smpnet-nbase, rmind-smpnet-base, rmind-smpnet, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, khorben-n900, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base2, jmcneill-usbmp-base10, jmcneill-usbmp-base, jmcneill-usbmp, jmcneill-audiomp3-base, jmcneill-audiomp3, agc-symver-base, agc-symver
Branch point for: tls-maxphys
Changes since 1.5: +31 -2 lines
Diff to previous 1.5 (colored)

kern/42030 - tracking of file descriptors by ktrace/kdump

Revision 1.2.4.2 / (download) - annotate - [select for diffs], Sat Mar 5 20:55:18 2011 UTC (12 years, 3 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.2.4.1: +10 -64 lines
Diff to previous 1.2.4.1 (colored) to branchpoint 1.2 (colored)

sync with head

Revision 1.4.4.1 / (download) - annotate - [select for diffs], Thu Feb 17 12:00:44 2011 UTC (12 years, 3 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.4: +2 -63 lines
Diff to previous 1.4 (colored) next main 1.5 (colored)

Sync with HEAD

Revision 1.5 / (download) - annotate - [select for diffs], Tue Feb 15 15:54:28 2011 UTC (12 years, 3 months ago) by pooka
Branch: MAIN
CVS Tags: cherry-xenmp-base, bouyer-quota2-nbase, bouyer-quota2-base
Branch point for: cherry-xenmp
Changes since 1.4: +2 -63 lines
Diff to previous 1.4 (colored)

Support FD_CLOEXEC in rump kernels.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Nov 19 06:44:43 2010 UTC (12 years, 6 months ago) by dholland
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: jruoho-x86intr, bouyer-quota2
Changes since 1.3: +10 -3 lines
Diff to previous 1.3 (colored)

Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.

Revision 1.2.2.1 / (download) - annotate - [select for diffs], Tue Aug 17 06:47:30 2010 UTC (12 years, 9 months ago) by uebayasi
Branch: uebayasi-xip
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored) next main 1.3 (colored)

Sync with HEAD.

Revision 1.1.12.4 / (download) - annotate - [select for diffs], Wed Aug 11 22:54:41 2010 UTC (12 years, 9 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.1.12.3: +3 -3 lines
Diff to previous 1.1.12.3 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

sync with head.

Revision 1.2.4.1 / (download) - annotate - [select for diffs], Sat Jul 3 01:19:54 2010 UTC (12 years, 11 months ago) by rmind
Branch: rmind-uvmplock
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

sync with head

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 24 13:03:11 2010 UTC (12 years, 11 months ago) by hannken
Branch: MAIN
CVS Tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

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.

Revision 1.1.10.1 / (download) - annotate - [select for diffs], Thu Jul 23 23:32:35 2009 UTC (13 years, 10 months ago) by jym
Branch: jym-xensuspend
Changes since 1.1: +9 -5 lines
Diff to previous 1.1 (colored) next main 1.2 (colored)

Sync with HEAD.

Revision 1.1.12.3 / (download) - annotate - [select for diffs], Sat Jun 20 07:20:31 2009 UTC (13 years, 11 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.1.12.2: +9 -5 lines
Diff to previous 1.1.12.2 (colored) to branchpoint 1.1 (colored)

sync with head

Revision 1.2 / (download) - annotate - [select for diffs], Sun May 24 21:41:26 2009 UTC (14 years ago) by ad
Branch: MAIN
CVS Tags: yamt-nfs-mp-base9, yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, uebayasi-xip-base1, uebayasi-xip-base, matt-premerge-20091211, jymxensuspend-base, jym-xensuspend-nbase
Branch point for: uebayasi-xip, rmind-uvmplock
Changes since 1.1: +9 -5 lines
Diff to previous 1.1 (colored)

More changes to improve kern_descrip.c.

- Avoid atomics in more places.
- Remove the per-descriptor mutex, and just use filedesc_t::fd_lock.
  It was only being used to synchronize close, and in any case we needed
  to take fd_lock to free the descriptor slot.
- Optimize certain paths for the <NDFDFILE case.
- Sprinkle more comments and assertions.
- Cache more stuff in filedesc_t.
- Fix numerous minor bugs spotted along the way.
- Restructure how the open files array is maintained, for clarity and so
  that we can eliminate the membar_consumer() call in fd_getfile().  This is
  mostly syntactic sugar; the main functional change is that fd_nfiles now
  lives alongside the open file array.

Some measurements with libmicro:

- simple file syscalls are like close() are between 1 to 10% faster.
- some nice improvements, e.g. poll(1000) which is ~50% faster.

Revision 1.1.12.2 / (download) - annotate - [select for diffs], Mon May 4 08:13:48 2009 UTC (14 years, 1 month ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.1.12.1: +158 -0 lines
Diff to previous 1.1.12.1 (colored) to branchpoint 1.1 (colored)

sync with head.

Revision 1.1.8.2 / (download) - annotate - [select for diffs], Mon Jan 19 13:19:39 2009 UTC (14 years, 4 months ago) by skrll
Branch: nick-hppapmap
Changes since 1.1.8.1: +158 -0 lines
Diff to previous 1.1.8.1 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

Sync with HEAD.

Revision 1.1.6.2 / (download) - annotate - [select for diffs], Sat Jan 17 13:29:19 2009 UTC (14 years, 4 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.1.6.1: +158 -0 lines
Diff to previous 1.1.6.1 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

Sync with HEAD.

Revision 1.1.4.2 / (download) - annotate - [select for diffs], Sat Dec 13 01:15:08 2008 UTC (14 years, 5 months ago) by haad
Branch: haad-dm
Changes since 1.1.4.1: +158 -0 lines
Diff to previous 1.1.4.1 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

Update haad-dm branch to haad-dm-base2.

Revision 1.1.12.1, Tue Nov 18 13:01:41 2008 UTC (14 years, 6 months ago) by yamt
Branch: yamt-nfs-mp
Changes since 1.1: +0 -158 lines
FILE REMOVED

file subr_exec_fd.c was added on branch yamt-nfs-mp on 2009-05-04 08:13:48 +0000

Revision 1.1.8.1, Tue Nov 18 13:01:41 2008 UTC (14 years, 6 months ago) by skrll
Branch: nick-hppapmap
Changes since 1.1: +0 -158 lines
FILE REMOVED

file subr_exec_fd.c was added on branch nick-hppapmap on 2009-01-19 13:19:39 +0000

Revision 1.1.6.1, Tue Nov 18 13:01:41 2008 UTC (14 years, 6 months ago) by mjf
Branch: mjf-devfs2
Changes since 1.1: +0 -158 lines
FILE REMOVED

file subr_exec_fd.c was added on branch mjf-devfs2 on 2009-01-17 13:29:19 +0000

Revision 1.1.4.1, Tue Nov 18 13:01:41 2008 UTC (14 years, 6 months ago) by haad
Branch: haad-dm
Changes since 1.1: +0 -158 lines
FILE REMOVED

file subr_exec_fd.c was added on branch haad-dm on 2008-12-13 01:15:08 +0000

Revision 1.1 / (download) - annotate - [select for diffs], Tue Nov 18 13:01:41 2008 UTC (14 years, 6 months ago) by pooka
Branch: MAIN
CVS Tags: yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base2, nick-hppapmap-base, mjf-devfs2-base, jym-xensuspend-base, haad-nbase2, haad-dm-base2, haad-dm-base, ad-audiomp2-base, ad-audiomp2
Branch point for: yamt-nfs-mp, nick-hppapmap, mjf-devfs2, jym-xensuspend, haad-dm

Move fd_closeexec() and fd_checkstd() from kern_descrip to their
own file, subr_exec_fd.c (they're used only by exec).

After this change, the kernel source modules are in a partitioned
enough state to allow building a system without vfs at all.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>