linux_fcntl.h revision 1.6
11.6Schs/* $NetBSD: linux_fcntl.h,v 1.6 2010/09/21 19:26:20 chs Exp $ */
21.1Smanu
31.1Smanu/*-
41.1Smanu * Copyright (c) 1995, 1998, 2001 The NetBSD Foundation, Inc.
51.1Smanu * All rights reserved.
61.1Smanu *
71.1Smanu * This code is derived from software contributed to The NetBSD Foundation
81.1Smanu * by Frank van der Linden, Eric Haszlakiewicz, and Emmanuel Dreyfus.
91.1Smanu *
101.1Smanu * Redistribution and use in source and binary forms, with or without
111.1Smanu * modification, are permitted provided that the following conditions
121.1Smanu * are met:
131.1Smanu * 1. Redistributions of source code must retain the above copyright
141.1Smanu *    notice, this list of conditions and the following disclaimer.
151.1Smanu * 2. Redistributions in binary form must reproduce the above copyright
161.1Smanu *    notice, this list of conditions and the following disclaimer in the
171.1Smanu *    documentation and/or other materials provided with the distribution.
181.1Smanu *
191.1Smanu * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Smanu * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Smanu * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Smanu * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Smanu * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Smanu * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Smanu * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Smanu * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Smanu * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Smanu * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Smanu * POSSIBILITY OF SUCH DAMAGE.
301.1Smanu */
311.1Smanu
321.1Smanu/*
331.1Smanu * Various flag values used in Linux for open(2) and fcntl(2).
341.1Smanu */
351.1Smanu
361.1Smanu#ifndef _MIPS_LINUX_FCNTL_H
371.1Smanu#define _MIPS_LINUX_FCNTL_H
381.1Smanu
391.3Sperry/*
401.1Smanu * read/write mode for open(2) are defined in common/linux_fcntl.h
411.1Smanu */
421.1Smanu
431.3Sperry/*
441.3Sperry * flags used in open(2)
451.3Sperry * From Linux's include/asm-mips/fcntl.h
461.1Smanu */
471.1Smanu#define LINUX_O_CREAT		0x0100
481.3Sperry#define LINUX_O_EXCL		0x0400
491.1Smanu#define LINUX_O_NOCTTY		0x0800
501.1Smanu#define LINUX_O_TRUNC		0x0200
511.1Smanu#define LINUX_O_APPEND		0x0008
521.1Smanu#define LINUX_O_NONBLOCK	0x0080
531.1Smanu#define LINUX_O_NDELAY		LINUX_O_NONBLOCK
541.1Smanu#define LINUX_O_SYNC		0x0010
551.1Smanu#define LINUX_FASYNC		0x1000
561.6Schs#define LINUX_O_DIRECTORY	0x10000
571.1Smanu
581.3Sperry/*
591.3Sperry * fcntl(2) operations
601.3Sperry * From Linux's include/asm-mips/fcntl.h
611.1Smanu */
621.1Smanu#define LINUX_F_DUPFD		0
631.1Smanu#define LINUX_F_GETFD		1
641.1Smanu#define LINUX_F_SETFD		2
651.1Smanu#define LINUX_F_GETFL		3
661.1Smanu#define LINUX_F_SETFL		4
671.1Smanu#define LINUX_F_GETLK		14
681.1Smanu#define LINUX_F_SETLK		6
691.1Smanu#define LINUX_F_SETLKW		7
701.1Smanu#define LINUX_F_SETOWN		24
711.1Smanu#define LINUX_F_GETOWN		23
721.1Smanu
731.1Smanu#define LINUX_F_RDLCK		0
741.1Smanu#define LINUX_F_WRLCK		1
751.1Smanu#define LINUX_F_UNLCK		2
761.1Smanu
771.1Smanu#define LINUX_LOCK_EX		4  /* F_EXLCK in Linux, and comment "or 3 " */
781.1Smanu#define LINUX_LOCK_SH		8  /* F_SHLCK in Linux, and comment "or 4'  */
791.2Smanu
801.3Sperry/*
811.2Smanu * From Linux's include/asm-mips64/fcntl.h
821.2Smanu */
831.2Smanu#define LINUX_F_GETLK64		33
841.2Smanu#define LINUX_F_SETLK64		34
851.2Smanu#define LINUX_F_SETLKW64	35
861.1Smanu
871.1Smanu#endif /* !_MIPS_LINUX_FCNTL_H */
88