svn commit: r227074 - in user/attilio/vmcontention: contrib/top
lib/libc/sys share/mk sys/compat/freebsd32 sys/fs/devfs
sys/kern sys/sys sys/vm
Attilio Rao
attilio at FreeBSD.org
Fri Nov 4 06:57:00 UTC 2011
Author: attilio
Date: Fri Nov 4 06:56:59 2011
New Revision: 227074
URL: http://svn.freebsd.org/changeset/base/227074
Log:
MFC
Added:
user/attilio/vmcontention/lib/libc/sys/posix_fadvise.2
- copied unchanged from r227073, head/lib/libc/sys/posix_fadvise.2
Modified:
user/attilio/vmcontention/lib/libc/sys/Makefile.inc
user/attilio/vmcontention/lib/libc/sys/Symbol.map
user/attilio/vmcontention/lib/libc/sys/madvise.2
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_misc.c
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_proto.h
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscall.h
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscalls.c
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_sysent.c
user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_systrace_args.c
user/attilio/vmcontention/sys/compat/freebsd32/syscalls.master
user/attilio/vmcontention/sys/fs/devfs/devfs_vnops.c
user/attilio/vmcontention/sys/kern/init_sysent.c
user/attilio/vmcontention/sys/kern/kern_descrip.c
user/attilio/vmcontention/sys/kern/syscalls.c
user/attilio/vmcontention/sys/kern/syscalls.master
user/attilio/vmcontention/sys/kern/systrace_args.c
user/attilio/vmcontention/sys/kern/vfs_default.c
user/attilio/vmcontention/sys/kern/vfs_subr.c
user/attilio/vmcontention/sys/kern/vfs_syscalls.c
user/attilio/vmcontention/sys/kern/vfs_vnops.c
user/attilio/vmcontention/sys/kern/vnode_if.src
user/attilio/vmcontention/sys/sys/fcntl.h
user/attilio/vmcontention/sys/sys/file.h
user/attilio/vmcontention/sys/sys/param.h
user/attilio/vmcontention/sys/sys/syscall.h
user/attilio/vmcontention/sys/sys/syscall.mk
user/attilio/vmcontention/sys/sys/sysproto.h
user/attilio/vmcontention/sys/sys/vnode.h
user/attilio/vmcontention/sys/vm/vm_contig.c
user/attilio/vmcontention/sys/vm/vm_object.c
user/attilio/vmcontention/sys/vm/vm_object.h
Directory Properties:
user/attilio/vmcontention/ (props changed)
user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed)
user/attilio/vmcontention/contrib/bind9/ (props changed)
user/attilio/vmcontention/contrib/binutils/ (props changed)
user/attilio/vmcontention/contrib/bzip2/ (props changed)
user/attilio/vmcontention/contrib/com_err/ (props changed)
user/attilio/vmcontention/contrib/compiler-rt/ (props changed)
user/attilio/vmcontention/contrib/dialog/ (props changed)
user/attilio/vmcontention/contrib/ee/ (props changed)
user/attilio/vmcontention/contrib/expat/ (props changed)
user/attilio/vmcontention/contrib/file/ (props changed)
user/attilio/vmcontention/contrib/gcc/ (props changed)
user/attilio/vmcontention/contrib/gdb/ (props changed)
user/attilio/vmcontention/contrib/gdtoa/ (props changed)
user/attilio/vmcontention/contrib/gnu-sort/ (props changed)
user/attilio/vmcontention/contrib/groff/ (props changed)
user/attilio/vmcontention/contrib/less/ (props changed)
user/attilio/vmcontention/contrib/libpcap/ (props changed)
user/attilio/vmcontention/contrib/libstdc++/ (props changed)
user/attilio/vmcontention/contrib/llvm/ (props changed)
user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed)
user/attilio/vmcontention/contrib/ncurses/ (props changed)
user/attilio/vmcontention/contrib/netcat/ (props changed)
user/attilio/vmcontention/contrib/ntp/ (props changed)
user/attilio/vmcontention/contrib/one-true-awk/ (props changed)
user/attilio/vmcontention/contrib/openbsm/ (props changed)
user/attilio/vmcontention/contrib/openpam/ (props changed)
user/attilio/vmcontention/contrib/openresolv/ (props changed)
user/attilio/vmcontention/contrib/pf/ (props changed)
user/attilio/vmcontention/contrib/sendmail/ (props changed)
user/attilio/vmcontention/contrib/tcpdump/ (props changed)
user/attilio/vmcontention/contrib/tcsh/ (props changed)
user/attilio/vmcontention/contrib/tnftp/ (props changed)
user/attilio/vmcontention/contrib/top/ (props changed)
user/attilio/vmcontention/contrib/top/install-sh (props changed)
user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed)
user/attilio/vmcontention/contrib/tzcode/zic/ (props changed)
user/attilio/vmcontention/contrib/tzdata/ (props changed)
user/attilio/vmcontention/contrib/wpa/ (props changed)
user/attilio/vmcontention/contrib/xz/ (props changed)
user/attilio/vmcontention/crypto/heimdal/ (props changed)
user/attilio/vmcontention/crypto/openssh/ (props changed)
user/attilio/vmcontention/crypto/openssl/ (props changed)
user/attilio/vmcontention/gnu/lib/ (props changed)
user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed)
user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed)
user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed)
user/attilio/vmcontention/lib/libc/ (props changed)
user/attilio/vmcontention/lib/libc/stdtime/ (props changed)
user/attilio/vmcontention/lib/libutil/ (props changed)
user/attilio/vmcontention/lib/libz/ (props changed)
user/attilio/vmcontention/sbin/ (props changed)
user/attilio/vmcontention/sbin/ipfw/ (props changed)
user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed)
user/attilio/vmcontention/share/zoneinfo/ (props changed)
user/attilio/vmcontention/sys/ (props changed)
user/attilio/vmcontention/sys/amd64/include/xen/ (props changed)
user/attilio/vmcontention/sys/boot/ (props changed)
user/attilio/vmcontention/sys/boot/i386/efi/ (props changed)
user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed)
user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed)
user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed)
user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed)
user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed)
user/attilio/vmcontention/sys/conf/ (props changed)
user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed)
user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed)
user/attilio/vmcontention/sys/contrib/pf/ (props changed)
user/attilio/vmcontention/sys/contrib/x86emu/ (props changed)
user/attilio/vmcontention/usr.bin/calendar/ (props changed)
user/attilio/vmcontention/usr.bin/csup/ (props changed)
user/attilio/vmcontention/usr.bin/procstat/ (props changed)
user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed)
user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed)
user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed)
user/attilio/vmcontention/usr.sbin/rtsold/ (props changed)
user/attilio/vmcontention/usr.sbin/zic/ (props changed)
Modified: user/attilio/vmcontention/lib/libc/sys/Makefile.inc
==============================================================================
--- user/attilio/vmcontention/lib/libc/sys/Makefile.inc Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/lib/libc/sys/Makefile.inc Fri Nov 4 06:56:59 2011 (r227074)
@@ -96,7 +96,8 @@ MAN+= abort2.2 accept.2 access.2 acct.2
mq_setattr.2 \
msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \
msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \
- pathconf.2 pdfork.2 pipe.2 poll.2 posix_fallocate.2 posix_openpt.2 profil.2 \
+ pathconf.2 pdfork.2 pipe.2 poll.2 posix_fadvise.2 posix_fallocate.2 \
+ posix_openpt.2 profil.2 \
pselect.2 ptrace.2 quotactl.2 \
read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \
rtprio.2
Modified: user/attilio/vmcontention/lib/libc/sys/Symbol.map
==============================================================================
--- user/attilio/vmcontention/lib/libc/sys/Symbol.map Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/lib/libc/sys/Symbol.map Fri Nov 4 06:56:59 2011 (r227074)
@@ -378,6 +378,10 @@ FBSD_1.2 {
setloginclass;
};
+FBSD_1.3 {
+ posix_fadvise;
+};
+
FBSDprivate_1.0 {
___acl_aclcheck_fd;
__sys___acl_aclcheck_fd;
Modified: user/attilio/vmcontention/lib/libc/sys/madvise.2
==============================================================================
--- user/attilio/vmcontention/lib/libc/sys/madvise.2 Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/lib/libc/sys/madvise.2 Fri Nov 4 06:56:59 2011 (r227074)
@@ -169,7 +169,8 @@ was specified and the process does not h
.Xr mincore 2 ,
.Xr mprotect 2 ,
.Xr msync 2 ,
-.Xr munmap 2
+.Xr munmap 2 ,
+.Xr posix_fadvise 2
.Sh STANDARDS
The
.Fn posix_madvise
Copied: user/attilio/vmcontention/lib/libc/sys/posix_fadvise.2 (from r227073, head/lib/libc/sys/posix_fadvise.2)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/attilio/vmcontention/lib/libc/sys/posix_fadvise.2 Fri Nov 4 06:56:59 2011 (r227074, copy of r227073, head/lib/libc/sys/posix_fadvise.2)
@@ -0,0 +1,139 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd October 26, 2011
+.Dt POSIX_FADVISE 2
+.Os
+.Sh NAME
+.Nm posix_fadvise
+.Nd give advice about use of file data
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In fcntl.h
+.Ft int
+.Fn posix_fadvise "int fd" "off_t offset" "off_t len" "int advice"
+.Sh DESCRIPTION
+The
+.Fn posix_fadvise
+system call
+allows a process to describe to the system its data access behavior for an
+open file descriptor
+.Fa fd .
+The advice covers the data starting at offset
+.Fa offset
+and continuing for
+.Fa len
+bytes.
+If
+.Fa len
+is zero,
+all data from
+.Fa offset
+to the end of the file is covered.
+.Pp
+The behavior is specified by the
+.Fa advice
+parameter and may be one of:
+.Bl -tag -width POSIX_FADV_SEQUENTIAL
+.It Dv POSIX_FADV_NORMAL
+Tells the system to revert to the default data access behavior.
+.It Dv POSIX_FADV_RANDOM
+Is a hint that file data will be accessed randomly,
+and prefetching is likely not advantageous.
+.It Dv POSIX_FADV_SEQUENTIAL
+Tells the system that file data will be accessed sequentially.
+This currently does nothing as the default behavior uses heuristics to
+detect sequential behavior.
+.It Dv POSIX_FADV_WILLNEED
+Tells the system that the specified data will be accessed in the near future.
+The system may initiate an asychronous read of the data if it is not already
+present in memory.
+.It Dv POSIX_FADV_DONTNEED
+Tells the system that the specified data will not be accessed in the near
+future.
+The system may decrease the in-memory priority of clean data within the
+specified range and future access to this data may require a read operation.
+.It Dv POSIX_FADV_NOREUSE
+Tells the system that the specified data will only be accessed once and
+then not reused.
+Accesses to data within the specified range are treated as if the file
+descriptor has the
+.Dv O_DIRECT
+flag enabled.
+.El
+.Pp
+.Sh RETURN VALUES
+.Rv -std posix_fadvise
+.Sh ERRORS
+The
+.Fn posix_fadvise
+system call will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid file descriptor.
+.It Bq Er EINVAL
+The
+.Fa advice
+argument is not valid.
+.It Bq Er EINVAL
+The
+.Fa offset
+or
+.Fa len
+arguments are negative,
+or
+.Fa offset
++
+.Fa len
+is greater than the maximum file size.
+.It Bq Er ENODEV
+The
+.Fa fd
+argument does not refer to a regular file.
+.It Bq Er ESPIPE
+The
+.Fa fd
+argument is associated with a pipe or FIFO.
+.El
+.Sh SEE ALSO
+.Xr madvise 2
+.Sh STANDARDS
+The
+.Fn posix_fadvise
+interface conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Fn posix_fadvise
+system call first appeared in
+.Fx 10.0 .
Modified: user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_misc.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_misc.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -2835,3 +2835,16 @@ freebsd32_posix_fallocate(struct thread
ap.len = PAIR32TO64(off_t, uap->len);
return (sys_posix_fallocate(td, &ap));
}
+
+int
+freebsd32_posix_fadvise(struct thread *td,
+ struct freebsd32_posix_fadvise_args *uap)
+{
+ struct posix_fadvise_args ap;
+
+ ap.fd = uap->fd;
+ ap.offset = PAIR32TO64(off_t, uap->offset);
+ ap.len = PAIR32TO64(off_t, uap->len);
+ ap.advice = uap->advice;
+ return (sys_posix_fadvise(td, &ap));
+}
Modified: user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_proto.h
==============================================================================
--- user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_proto.h Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_proto.h Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
#ifndef _FREEBSD32_SYSPROTO_H_
@@ -580,6 +580,14 @@ struct freebsd32_posix_fallocate_args {
char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)];
char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)];
};
+struct freebsd32_posix_fadvise_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)];
+ char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)];
+ char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)];
+ char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)];
+ char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
+};
#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
#define PAD64_REQUIRED
#endif
@@ -690,6 +698,7 @@ int freebsd32_msgctl(struct thread *, st
int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *);
int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *);
int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *);
+int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *);
#ifdef COMPAT_43
@@ -1065,6 +1074,7 @@ int freebsd7_freebsd32_shmctl(struct thr
#define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL
#define FREEBSD32_SYS_AUE_freebsd32_pselect AUE_SELECT
#define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL
#undef PAD_
#undef PADL_
Modified: user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscall.h
==============================================================================
--- user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscall.h Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscall.h Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
#define FREEBSD32_SYS_syscall 0
@@ -424,4 +424,5 @@
#define FREEBSD32_SYS_rctl_add_rule 528
#define FREEBSD32_SYS_rctl_remove_rule 529
#define FREEBSD32_SYS_freebsd32_posix_fallocate 530
+#define FREEBSD32_SYS_freebsd32_posix_fadvise 531
#define FREEBSD32_SYS_MAXSYSCALL 532
Modified: user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscalls.c
==============================================================================
--- user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscalls.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_syscalls.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
const char *freebsd32_syscallnames[] = {
@@ -554,5 +554,5 @@ const char *freebsd32_syscallnames[] = {
"rctl_add_rule", /* 528 = rctl_add_rule */
"rctl_remove_rule", /* 529 = rctl_remove_rule */
"freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */
- "#531", /* 531 = posix_fadvise */
+ "freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */
};
Modified: user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_sysent.c
==============================================================================
--- user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_sysent.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_sysent.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
#include "opt_compat.h"
@@ -591,5 +591,5 @@ struct sysent freebsd32_sysent[] = {
{ AS(rctl_add_rule_args), (sy_call_t *)sys_rctl_add_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 528 = rctl_add_rule */
{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */
{ AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = freebsd32_posix_fallocate */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 531 = posix_fadvise */
+ { AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = freebsd32_posix_fadvise */
};
Modified: user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_systrace_args.c
==============================================================================
--- user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -3034,6 +3034,18 @@ systrace_args(int sysnum, void *params,
*n_args = 5;
break;
}
+ /* freebsd32_posix_fadvise */
+ case 531: {
+ struct freebsd32_posix_fadvise_args *p = params;
+ iarg[0] = p->fd; /* int */
+ uarg[1] = p->offset1; /* uint32_t */
+ uarg[2] = p->offset2; /* uint32_t */
+ uarg[3] = p->len1; /* uint32_t */
+ uarg[4] = p->len2; /* uint32_t */
+ iarg[5] = p->advice; /* int */
+ *n_args = 6;
+ break;
+ }
default:
*n_args = 0;
break;
@@ -8093,6 +8105,31 @@ systrace_setargdesc(int sysnum, int ndx,
break;
};
break;
+ /* freebsd32_posix_fadvise */
+ case 531:
+ switch(ndx) {
+ case 0:
+ p = "int";
+ break;
+ case 1:
+ p = "uint32_t";
+ break;
+ case 2:
+ p = "uint32_t";
+ break;
+ case 3:
+ p = "uint32_t";
+ break;
+ case 4:
+ p = "uint32_t";
+ break;
+ case 5:
+ p = "int";
+ break;
+ default:
+ break;
+ };
+ break;
default:
break;
};
Modified: user/attilio/vmcontention/sys/compat/freebsd32/syscalls.master
==============================================================================
--- user/attilio/vmcontention/sys/compat/freebsd32/syscalls.master Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/compat/freebsd32/syscalls.master Fri Nov 4 06:56:59 2011 (r227074)
@@ -991,4 +991,7 @@
530 AUE_NULL STD { int freebsd32_posix_fallocate(int fd,\
uint32_t offset1, uint32_t offset2,\
uint32_t len1, uint32_t len2); }
-531 AUE_NULL UNIMPL posix_fadvise
+531 AUE_NULL STD { int freebsd32_posix_fadvise(int fd, \
+ uint32_t offset1, uint32_t offset2,\
+ uint32_t len1, uint32_t len2, \
+ int advice); }
Modified: user/attilio/vmcontention/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- user/attilio/vmcontention/sys/fs/devfs/devfs_vnops.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/fs/devfs/devfs_vnops.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -604,6 +604,13 @@ devfs_close_f(struct file *fp, struct th
td->td_fpop = fp;
error = vnops.fo_close(fp, td);
td->td_fpop = fpop;
+
+ /*
+ * The f_cdevpriv cannot be assigned non-NULL value while we
+ * are destroying the file.
+ */
+ if (fp->f_cdevpriv != NULL)
+ devfs_fpdrop(fp);
return (error);
}
Modified: user/attilio/vmcontention/sys/kern/init_sysent.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/init_sysent.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/init_sysent.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
#include "opt_compat.h"
@@ -565,5 +565,5 @@ struct sysent sysent[] = {
{ AS(rctl_add_rule_args), (sy_call_t *)sys_rctl_add_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 528 = rctl_add_rule */
{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */
{ AS(posix_fallocate_args), (sy_call_t *)sys_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = posix_fallocate */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 531 = posix_fadvise */
+ { AS(posix_fadvise_args), (sy_call_t *)sys_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = posix_fadvise */
};
Modified: user/attilio/vmcontention/sys/kern/kern_descrip.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/kern_descrip.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/kern_descrip.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -2575,12 +2575,6 @@ _fdrop(struct file *fp, struct thread *t
panic("fdrop: count %d", fp->f_count);
if (fp->f_ops != &badfileops)
error = fo_close(fp, td);
- /*
- * The f_cdevpriv cannot be assigned non-NULL value while we
- * are destroying the file.
- */
- if (fp->f_cdevpriv != NULL)
- devfs_fpdrop(fp);
atomic_subtract_int(&openfiles, 1);
crfree(fp->f_cred);
uma_zfree(file_zone, fp);
Modified: user/attilio/vmcontention/sys/kern/syscalls.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/syscalls.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/syscalls.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
const char *syscallnames[] = {
@@ -538,5 +538,5 @@ const char *syscallnames[] = {
"rctl_add_rule", /* 528 = rctl_add_rule */
"rctl_remove_rule", /* 529 = rctl_remove_rule */
"posix_fallocate", /* 530 = posix_fallocate */
- "#531", /* 531 = posix_fadvise */
+ "posix_fadvise", /* 531 = posix_fadvise */
};
Modified: user/attilio/vmcontention/sys/kern/syscalls.master
==============================================================================
--- user/attilio/vmcontention/sys/kern/syscalls.master Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/syscalls.master Fri Nov 4 06:56:59 2011 (r227074)
@@ -947,6 +947,7 @@
size_t outbuflen); }
530 AUE_NULL STD { int posix_fallocate(int fd, \
off_t offset, off_t len); }
-531 AUE_NULL UNIMPL posix_fadvise
+531 AUE_NULL STD { int posix_fadvise(int fd, off_t offset, \
+ off_t len, int advice); }
; Please copy any additions and changes to the following compatability tables:
; sys/compat/freebsd32/syscalls.master
Modified: user/attilio/vmcontention/sys/kern/systrace_args.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/systrace_args.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/systrace_args.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -3234,6 +3234,16 @@ systrace_args(int sysnum, void *params,
*n_args = 3;
break;
}
+ /* posix_fadvise */
+ case 531: {
+ struct posix_fadvise_args *p = params;
+ iarg[0] = p->fd; /* int */
+ iarg[1] = p->offset; /* off_t */
+ iarg[2] = p->len; /* off_t */
+ iarg[3] = p->advice; /* int */
+ *n_args = 4;
+ break;
+ }
default:
*n_args = 0;
break;
@@ -8603,6 +8613,25 @@ systrace_setargdesc(int sysnum, int ndx,
break;
};
break;
+ /* posix_fadvise */
+ case 531:
+ switch(ndx) {
+ case 0:
+ p = "int";
+ break;
+ case 1:
+ p = "off_t";
+ break;
+ case 2:
+ p = "off_t";
+ break;
+ case 3:
+ p = "int";
+ break;
+ default:
+ break;
+ };
+ break;
default:
break;
};
Modified: user/attilio/vmcontention/sys/kern/vfs_default.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/vfs_default.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/vfs_default.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -96,6 +96,7 @@ struct vop_vector default_vnodeops = {
.vop_access = vop_stdaccess,
.vop_accessx = vop_stdaccessx,
+ .vop_advise = vop_stdadvise,
.vop_advlock = vop_stdadvlock,
.vop_advlockasync = vop_stdadvlockasync,
.vop_advlockpurge = vop_stdadvlockpurge,
@@ -984,6 +985,58 @@ vop_stdallocate(struct vop_allocate_args
return (error);
}
+int
+vop_stdadvise(struct vop_advise_args *ap)
+{
+ struct vnode *vp;
+ off_t start, end;
+ int error, vfslocked;
+
+ vp = ap->a_vp;
+ switch (ap->a_advice) {
+ case POSIX_FADV_WILLNEED:
+ /*
+ * Do nothing for now. Filesystems should provide a
+ * custom method which starts an asynchronous read of
+ * the requested region.
+ */
+ error = 0;
+ break;
+ case POSIX_FADV_DONTNEED:
+ /*
+ * Flush any open FS buffers and then remove pages
+ * from the backing VM object. Using vinvalbuf() here
+ * is a bit heavy-handed as it flushes all buffers for
+ * the given vnode, not just the buffers covering the
+ * requested range.
+ */
+ error = 0;
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ if (vp->v_iflag & VI_DOOMED) {
+ VOP_UNLOCK(vp, 0);
+ VFS_UNLOCK_GIANT(vfslocked);
+ break;
+ }
+ vinvalbuf(vp, V_CLEANONLY, 0, 0);
+ if (vp->v_object != NULL) {
+ start = trunc_page(ap->a_start);
+ end = round_page(ap->a_end);
+ VM_OBJECT_LOCK(vp->v_object);
+ vm_object_page_cache(vp->v_object, OFF_TO_IDX(start),
+ OFF_TO_IDX(end));
+ VM_OBJECT_UNLOCK(vp->v_object);
+ }
+ VOP_UNLOCK(vp, 0);
+ VFS_UNLOCK_GIANT(vfslocked);
+ break;
+ default:
+ error = EINVAL;
+ break;
+ }
+ return (error);
+}
+
/*
* vfs default ops
* used to fill the vfs function table to get reasonable default return values.
Modified: user/attilio/vmcontention/sys/kern/vfs_subr.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/vfs_subr.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/vfs_subr.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -1191,7 +1191,7 @@ bufobj_invalbuf(struct bufobj *bo, int f
do {
error = flushbuflist(&bo->bo_clean,
flags, bo, slpflag, slptimeo);
- if (error == 0)
+ if (error == 0 && !(flags & V_CLEANONLY))
error = flushbuflist(&bo->bo_dirty,
flags, bo, slpflag, slptimeo);
if (error != 0 && error != EAGAIN) {
@@ -1220,7 +1220,8 @@ bufobj_invalbuf(struct bufobj *bo, int f
/*
* Destroy the copy in the VM cache, too.
*/
- if (bo->bo_object != NULL && (flags & (V_ALT | V_NORMAL)) == 0) {
+ if (bo->bo_object != NULL &&
+ (flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0) {
VM_OBJECT_LOCK(bo->bo_object);
vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ?
OBJPR_CLEANONLY : 0);
@@ -1229,7 +1230,7 @@ bufobj_invalbuf(struct bufobj *bo, int f
#ifdef INVARIANTS
BO_LOCK(bo);
- if ((flags & (V_ALT | V_NORMAL)) == 0 &&
+ if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0 &&
(bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0))
panic("vinvalbuf: flush failed");
BO_UNLOCK(bo);
Modified: user/attilio/vmcontention/sys/kern/vfs_syscalls.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/vfs_syscalls.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/vfs_syscalls.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <vm/uma.h>
+static MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information");
+
SDT_PROVIDER_DEFINE(vfs);
SDT_PROBE_DEFINE(vfs, , stat, mode, mode);
SDT_PROBE_ARGTYPE(vfs, , stat, mode, 0, "char *");
@@ -4845,3 +4847,135 @@ sys_posix_fallocate(struct thread *td, s
return (kern_posix_fallocate(td, uap->fd, uap->offset, uap->len));
}
+
+/*
+ * Unlike madvise(2), we do not make a best effort to remember every
+ * possible caching hint. Instead, we remember the last setting with
+ * the exception that we will allow POSIX_FADV_NORMAL to adjust the
+ * region of any current setting.
+ */
+int
+sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap)
+{
+ struct fadvise_info *fa, *new;
+ struct file *fp;
+ struct vnode *vp;
+ off_t end;
+ int error;
+
+ if (uap->offset < 0 || uap->len < 0 ||
+ uap->offset > OFF_MAX - uap->len)
+ return (EINVAL);
+ switch (uap->advice) {
+ case POSIX_FADV_SEQUENTIAL:
+ case POSIX_FADV_RANDOM:
+ case POSIX_FADV_NOREUSE:
+ new = malloc(sizeof(*fa), M_FADVISE, M_WAITOK);
+ break;
+ case POSIX_FADV_NORMAL:
+ case POSIX_FADV_WILLNEED:
+ case POSIX_FADV_DONTNEED:
+ new = NULL;
+ break;
+ default:
+ return (EINVAL);
+ }
+ /* XXX: CAP_POSIX_FADVISE? */
+ error = fget(td, uap->fd, 0, &fp);
+ if (error != 0)
+ goto out;
+
+ switch (fp->f_type) {
+ case DTYPE_VNODE:
+ break;
+ case DTYPE_PIPE:
+ case DTYPE_FIFO:
+ error = ESPIPE;
+ goto out;
+ default:
+ error = ENODEV;
+ goto out;
+ }
+ vp = fp->f_vnode;
+ if (vp->v_type != VREG) {
+ error = ENODEV;
+ goto out;
+ }
+ if (uap->len == 0)
+ end = OFF_MAX;
+ else
+ end = uap->offset + uap->len - 1;
+ switch (uap->advice) {
+ case POSIX_FADV_SEQUENTIAL:
+ case POSIX_FADV_RANDOM:
+ case POSIX_FADV_NOREUSE:
+ /*
+ * Try to merge any existing non-standard region with
+ * this new region if possible, otherwise create a new
+ * non-standard region for this request.
+ */
+ mtx_pool_lock(mtxpool_sleep, fp);
+ fa = fp->f_advice;
+ if (fa != NULL && fa->fa_advice == uap->advice &&
+ ((fa->fa_start <= end && fa->fa_end >= uap->offset) ||
+ (end != OFF_MAX && fa->fa_start == end + 1) ||
+ (fa->fa_end != OFF_MAX && fa->fa_end + 1 == uap->offset))) {
+ if (uap->offset < fa->fa_start)
+ fa->fa_start = uap->offset;
+ if (end > fa->fa_end)
+ fa->fa_end = end;
+ } else {
+ new->fa_advice = uap->advice;
+ new->fa_start = uap->offset;
+ new->fa_end = end;
+ fp->f_advice = new;
+ new = fa;
+ }
+ mtx_pool_unlock(mtxpool_sleep, fp);
+ break;
+ case POSIX_FADV_NORMAL:
+ /*
+ * If a the "normal" region overlaps with an existing
+ * non-standard region, trim or remove the
+ * non-standard region.
+ */
+ mtx_pool_lock(mtxpool_sleep, fp);
+ fa = fp->f_advice;
+ if (fa != NULL) {
+ if (uap->offset <= fa->fa_start &&
+ end >= fa->fa_end) {
+ new = fa;
+ fp->f_advice = NULL;
+ } else if (uap->offset <= fa->fa_start &&
+ end >= fa->fa_start)
+ fa->fa_start = end + 1;
+ else if (uap->offset <= fa->fa_end &&
+ end >= fa->fa_end)
+ fa->fa_end = uap->offset - 1;
+ else if (uap->offset >= fa->fa_start &&
+ end <= fa->fa_end) {
+ /*
+ * If the "normal" region is a middle
+ * portion of the existing
+ * non-standard region, just remove
+ * the whole thing rather than picking
+ * one side or the other to
+ * preserve.
+ */
+ new = fa;
+ fp->f_advice = NULL;
+ }
+ }
+ mtx_pool_unlock(mtxpool_sleep, fp);
+ break;
+ case POSIX_FADV_WILLNEED:
+ case POSIX_FADV_DONTNEED:
+ error = VOP_ADVISE(vp, uap->offset, end, uap->advice);
+ break;
+ }
+out:
+ if (fp != NULL)
+ fdrop(fp, td);
+ free(new, M_FADVISE);
+ return (error);
+}
Modified: user/attilio/vmcontention/sys/kern/vfs_vnops.c
==============================================================================
--- user/attilio/vmcontention/sys/kern/vfs_vnops.c Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/vfs_vnops.c Fri Nov 4 06:56:59 2011 (r227074)
@@ -518,7 +518,7 @@ vn_read(fp, uio, active_cred, flags, td)
struct vnode *vp;
int error, ioflag;
struct mtx *mtxp;
- int vfslocked;
+ int advice, vfslocked;
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
uio->uio_td, td));
@@ -529,27 +529,48 @@ vn_read(fp, uio, active_cred, flags, td)
ioflag |= IO_NDELAY;
if (fp->f_flag & O_DIRECT)
ioflag |= IO_DIRECT;
+ advice = POSIX_FADV_NORMAL;
vfslocked = VFS_LOCK_GIANT(vp->v_mount);
/*
* According to McKusick the vn lock was protecting f_offset here.
* It is now protected by the FOFFSET_LOCKED flag.
*/
- if ((flags & FOF_OFFSET) == 0) {
+ if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) {
mtxp = mtx_pool_find(mtxpool_sleep, fp);
mtx_lock(mtxp);
- while(fp->f_vnread_flags & FOFFSET_LOCKED) {
- fp->f_vnread_flags |= FOFFSET_LOCK_WAITING;
- msleep(&fp->f_vnread_flags, mtxp, PUSER -1,
- "vnread offlock", 0);
+ if ((flags & FOF_OFFSET) == 0) {
+ while (fp->f_vnread_flags & FOFFSET_LOCKED) {
+ fp->f_vnread_flags |= FOFFSET_LOCK_WAITING;
+ msleep(&fp->f_vnread_flags, mtxp, PUSER -1,
+ "vnread offlock", 0);
+ }
+ fp->f_vnread_flags |= FOFFSET_LOCKED;
+ uio->uio_offset = fp->f_offset;
}
- fp->f_vnread_flags |= FOFFSET_LOCKED;
+ if (fp->f_advice != NULL &&
+ uio->uio_offset >= fp->f_advice->fa_start &&
+ uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end)
+ advice = fp->f_advice->fa_advice;
mtx_unlock(mtxp);
- vn_lock(vp, LK_SHARED | LK_RETRY);
- uio->uio_offset = fp->f_offset;
- } else
- vn_lock(vp, LK_SHARED | LK_RETRY);
+ }
+ vn_lock(vp, LK_SHARED | LK_RETRY);
- ioflag |= sequential_heuristic(uio, fp);
+ switch (advice) {
+ case POSIX_FADV_NORMAL:
+ case POSIX_FADV_SEQUENTIAL:
+ ioflag |= sequential_heuristic(uio, fp);
+ break;
+ case POSIX_FADV_RANDOM:
+ /* Disable read-ahead for random I/O. */
+ break;
+ case POSIX_FADV_NOREUSE:
+ /*
+ * Request the underlying FS to discard the buffers
+ * and pages after the I/O is complete.
+ */
+ ioflag |= IO_DIRECT;
+ break;
+ }
#ifdef MAC
error = mac_vnode_check_read(active_cred, fp->f_cred, vp);
@@ -584,7 +605,8 @@ vn_write(fp, uio, active_cred, flags, td
struct vnode *vp;
struct mount *mp;
int error, ioflag, lock_flags;
- int vfslocked;
+ struct mtx *mtxp;
+ int advice, vfslocked;
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
uio->uio_td, td));
@@ -618,7 +640,33 @@ vn_write(fp, uio, active_cred, flags, td
vn_lock(vp, lock_flags | LK_RETRY);
if ((flags & FOF_OFFSET) == 0)
uio->uio_offset = fp->f_offset;
- ioflag |= sequential_heuristic(uio, fp);
+ advice = POSIX_FADV_NORMAL;
+ if (fp->f_advice != NULL) {
+ mtxp = mtx_pool_find(mtxpool_sleep, fp);
+ mtx_lock(mtxp);
+ if (fp->f_advice != NULL &&
+ uio->uio_offset >= fp->f_advice->fa_start &&
+ uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end)
+ advice = fp->f_advice->fa_advice;
+ mtx_unlock(mtxp);
+ }
+ switch (advice) {
+ case POSIX_FADV_NORMAL:
+ case POSIX_FADV_SEQUENTIAL:
+ ioflag |= sequential_heuristic(uio, fp);
+ break;
+ case POSIX_FADV_RANDOM:
+ /* XXX: Is this correct? */
+ break;
+ case POSIX_FADV_NOREUSE:
+ /*
+ * Request the underlying FS to discard the buffers
+ * and pages after the I/O is complete.
+ */
+ ioflag |= IO_DIRECT;
+ break;
+ }
+
#ifdef MAC
error = mac_vnode_check_write(active_cred, fp->f_cred, vp);
if (error == 0)
Modified: user/attilio/vmcontention/sys/kern/vnode_if.src
==============================================================================
--- user/attilio/vmcontention/sys/kern/vnode_if.src Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/kern/vnode_if.src Fri Nov 4 06:56:59 2011 (r227074)
@@ -628,3 +628,12 @@ vop_allocate {
INOUT off_t *offset;
INOUT off_t *len;
};
+
+%% advise vp U U U
+
+vop_advise {
+ IN struct vnode *vp;
+ IN off_t start;
+ IN off_t end;
+ IN int advice;
+};
Modified: user/attilio/vmcontention/sys/sys/fcntl.h
==============================================================================
--- user/attilio/vmcontention/sys/sys/fcntl.h Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/sys/fcntl.h Fri Nov 4 06:56:59 2011 (r227074)
@@ -277,9 +277,17 @@ struct oflock {
#define LOCK_UN 0x08 /* unlock file */
#endif
+#if __POSIX_VISIBLE >= 200112
/*
- * XXX missing posix_fadvise() and POSIX_FADV_* macros.
+ * Advice to posix_fadvise
*/
+#define POSIX_FADV_NORMAL 0 /* no special treatment */
+#define POSIX_FADV_RANDOM 1 /* expect random page references */
+#define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */
+#define POSIX_FADV_WILLNEED 3 /* will need these pages */
+#define POSIX_FADV_DONTNEED 4 /* dont need these pages */
+#define POSIX_FADV_NOREUSE 5 /* access data only once */
+#endif
#ifndef _KERNEL
__BEGIN_DECLS
@@ -293,6 +301,7 @@ int flock(int, int);
int openat(int, const char *, int, ...);
#endif
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
+int posix_fadvise(int, off_t, off_t, int);
int posix_fallocate(int, off_t, off_t);
#endif
__END_DECLS
Modified: user/attilio/vmcontention/sys/sys/file.h
==============================================================================
--- user/attilio/vmcontention/sys/sys/file.h Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/sys/file.h Fri Nov 4 06:56:59 2011 (r227074)
@@ -122,6 +122,12 @@ struct fileops {
* none not locked
*/
+struct fadvise_info {
+ int fa_advice; /* (f) FADV_* type. */
+ off_t fa_start; /* (f) Region start. */
+ off_t fa_end; /* (f) Region end. */
+};
+
struct file {
void *f_data; /* file descriptor specific data */
struct fileops *f_ops; /* File operations */
@@ -136,7 +142,11 @@ struct file {
*/
int f_seqcount; /* Count of sequential accesses. */
off_t f_nextoff; /* next expected read/write offset. */
- struct cdev_privdata *f_cdevpriv; /* (d) Private data for the cdev. */
+ union {
+ struct cdev_privdata *fvn_cdevpriv;
+ /* (d) Private data for the cdev. */
+ struct fadvise_info *fvn_advice;
+ } f_vnun;
/*
* DFLAG_SEEKABLE specific fields
*/
@@ -147,6 +157,9 @@ struct file {
void *f_label; /* Place-holder for MAC label. */
};
+#define f_cdevpriv f_vnun.fvn_cdevpriv
+#define f_advice f_vnun.fvn_advice
+
#define FOFFSET_LOCKED 0x1
#define FOFFSET_LOCK_WAITING 0x2
Modified: user/attilio/vmcontention/sys/sys/param.h
==============================================================================
--- user/attilio/vmcontention/sys/sys/param.h Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/sys/param.h Fri Nov 4 06:56:59 2011 (r227074)
@@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1000000 /* Master, propagated to newvers */
+#define __FreeBSD_version 1000001 /* Master, propagated to newvers */
#ifdef _KERNEL
#define P_OSREL_SIGWAIT 700000
Modified: user/attilio/vmcontention/sys/sys/syscall.h
==============================================================================
--- user/attilio/vmcontention/sys/sys/syscall.h Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/sys/syscall.h Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
#define SYS_syscall 0
@@ -446,4 +446,5 @@
#define SYS_rctl_add_rule 528
#define SYS_rctl_remove_rule 529
#define SYS_posix_fallocate 530
+#define SYS_posix_fadvise 531
#define SYS_MAXSYSCALL 532
Modified: user/attilio/vmcontention/sys/sys/syscall.mk
==============================================================================
--- user/attilio/vmcontention/sys/sys/syscall.mk Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/sys/syscall.mk Fri Nov 4 06:56:59 2011 (r227074)
@@ -1,7 +1,7 @@
# FreeBSD system call names.
# DO NOT EDIT-- this file is automatically generated.
# $FreeBSD$
-# created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan
+# created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb
MIASM = \
syscall.o \
exit.o \
@@ -394,4 +394,5 @@ MIASM = \
rctl_get_limits.o \
rctl_add_rule.o \
rctl_remove_rule.o \
- posix_fallocate.o
+ posix_fallocate.o \
+ posix_fadvise.o
Modified: user/attilio/vmcontention/sys/sys/sysproto.h
==============================================================================
--- user/attilio/vmcontention/sys/sys/sysproto.h Fri Nov 4 06:14:18 2011 (r227073)
+++ user/attilio/vmcontention/sys/sys/sysproto.h Fri Nov 4 06:56:59 2011 (r227074)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb
*/
#ifndef _SYS_SYSPROTO_H_
@@ -1733,6 +1733,12 @@ struct posix_fallocate_args {
char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)];
};
+struct posix_fadvise_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+ char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)];
+ char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
+};
int nosys(struct thread *, struct nosys_args *);
void sys_sys_exit(struct thread *, struct sys_exit_args *);
int sys_fork(struct thread *, struct fork_args *);
@@ -2109,6 +2115,7 @@ int sys_rctl_get_limits(struct thread *,
int sys_rctl_add_rule(struct thread *, struct rctl_add_rule_args *);
int sys_rctl_remove_rule(struct thread *, struct rctl_remove_rule_args *);
int sys_posix_fallocate(struct thread *, struct posix_fallocate_args *);
+int sys_posix_fadvise(struct thread *, struct posix_fadvise_args *);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list