Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/cloudabi/cloudabi_file.c
Show All 20 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * 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 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | |||||
#include <sys/fcntl.h> | |||||
#include <sys/syscallsubr.h> | |||||
#include <compat/cloudabi/cloudabi_proto.h> | #include <compat/cloudabi/cloudabi_proto.h> | ||||
#include <compat/cloudabi/cloudabi_syscalldefs.h> | |||||
int | int | ||||
cloudabi_sys_file_advise(struct thread *td, | cloudabi_sys_file_advise(struct thread *td, | ||||
struct cloudabi_sys_file_advise_args *uap) | struct cloudabi_sys_file_advise_args *uap) | ||||
{ | { | ||||
int advice; | |||||
switch (uap->advice) { | /* Not implemented. */ | ||||
case CLOUDABI_ADVICE_DONTNEED: | return (ENOSYS); | ||||
advice = POSIX_FADV_DONTNEED; | |||||
break; | |||||
case CLOUDABI_ADVICE_NOREUSE: | |||||
advice = POSIX_FADV_NOREUSE; | |||||
break; | |||||
case CLOUDABI_ADVICE_NORMAL: | |||||
advice = POSIX_FADV_NORMAL; | |||||
break; | |||||
case CLOUDABI_ADVICE_RANDOM: | |||||
advice = POSIX_FADV_RANDOM; | |||||
break; | |||||
case CLOUDABI_ADVICE_SEQUENTIAL: | |||||
advice = POSIX_FADV_SEQUENTIAL; | |||||
break; | |||||
case CLOUDABI_ADVICE_WILLNEED: | |||||
advice = POSIX_FADV_WILLNEED; | |||||
break; | |||||
default: | |||||
return (EINVAL); | |||||
} | } | ||||
return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, advice)); | |||||
} | |||||
int | int | ||||
cloudabi_sys_file_allocate(struct thread *td, | cloudabi_sys_file_allocate(struct thread *td, | ||||
struct cloudabi_sys_file_allocate_args *uap) | struct cloudabi_sys_file_allocate_args *uap) | ||||
{ | { | ||||
return (kern_posix_fallocate(td, uap->fd, uap->offset, uap->len)); | /* Not implemented. */ | ||||
return (ENOSYS); | |||||
} | } | ||||
int | int | ||||
cloudabi_sys_file_create(struct thread *td, | cloudabi_sys_file_create(struct thread *td, | ||||
struct cloudabi_sys_file_create_args *uap) | struct cloudabi_sys_file_create_args *uap) | ||||
{ | { | ||||
/* Not implemented. */ | /* Not implemented. */ | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |