fdopen.c (71579) | fdopen.c (82807) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 19 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * |
36 * $FreeBSD: head/lib/libc/stdio/fdopen.c 71579 2001-01-24 13:01:12Z deischen $ | 36 * $FreeBSD: head/lib/libc/stdio/fdopen.c 82807 2001-09-02 19:10:10Z ache $ |
37 */ 38 39#if defined(LIBC_SCCS) && !defined(lint) 40static char sccsid[] = "@(#)fdopen.c 8.1 (Berkeley) 6/4/93"; 41#endif /* LIBC_SCCS and not lint */ 42 43#include "namespace.h" 44#include <sys/types.h> --- 28 unchanged lines hidden (view full) --- 73 return (NULL); 74 } 75 76 if ((fp = __sfp()) == NULL) 77 return (NULL); 78 fp->_flags = flags; 79 /* 80 * If opened for appending, but underlying descriptor does not have | 37 */ 38 39#if defined(LIBC_SCCS) && !defined(lint) 40static char sccsid[] = "@(#)fdopen.c 8.1 (Berkeley) 6/4/93"; 41#endif /* LIBC_SCCS and not lint */ 42 43#include "namespace.h" 44#include <sys/types.h> --- 28 unchanged lines hidden (view full) --- 73 return (NULL); 74 } 75 76 if ((fp = __sfp()) == NULL) 77 return (NULL); 78 fp->_flags = flags; 79 /* 80 * If opened for appending, but underlying descriptor does not have |
81 * O_APPEND bit set, assert __SAPP so that __swrite() will lseek to 82 * end before each write. | 81 * O_APPEND bit set, assert __SAPP so that __swrite() caller 82 * will _sseek() to the end before write. |
83 */ 84 if ((oflags & O_APPEND) && !(fdflags & O_APPEND)) 85 fp->_flags |= __SAPP; 86 fp->_file = fd; 87 fp->_cookie = fp; 88 fp->_read = __sread; 89 fp->_write = __swrite; 90 fp->_seek = __sseek; 91 fp->_close = __sclose; 92 return (fp); 93} | 83 */ 84 if ((oflags & O_APPEND) && !(fdflags & O_APPEND)) 85 fp->_flags |= __SAPP; 86 fp->_file = fd; 87 fp->_cookie = fp; 88 fp->_read = __sread; 89 fp->_write = __swrite; 90 fp->_seek = __sseek; 91 fp->_close = __sclose; 92 return (fp); 93} |