1N/A * Copyright (c) 2000-2005 Sendmail, Inc. and its suppliers. 1N/A * All rights reserved. 1N/A * Copyright (c) 1990, 1993 1N/A * The Regents of the University of California. All rights reserved. 1N/A * This code is derived from software contributed to Berkeley by 1N/A * By using this file, you agree to the terms and conditions set 1N/A * forth in the LICENSE file which can be found at the top level of 1N/A * the sendmail distribution. 1N/A#
pragma ident "%Z%%M% %I% %E% SMI" 1N/A** These maintain the `known seek offset' for seek optimization. 1N/A** SM_STDOPEN -- open a file with stdio behavior 1N/A** Not associated with the system's stdio in libc. 1N/A** fp -- file pointer to be associated with the open 1N/A** info -- pathname of the file to be opened 1N/A** flags -- indicates type of access methods 1N/A** Failure: -1 and set errno 1N/A** Success: 0 or greater (fd of file from open(2)). 1N/A#
endif /* O_BINARY */ 1N/A return -
1;
/* errno set by open() */ 1N/A** SM_STDREAD -- read from the file 1N/A** fp -- file pointer to read from 1N/A** buf -- location to place read data 1N/A** n -- number of bytes to read 1N/A** Failure: -1 and sets errno 1N/A** Success: number of bytes read 1N/A** Updates internal offset into file. 1N/A /* if the read succeeded, update the current offset */ 1N/A** SM_STDWRITE -- write to the file 1N/A** fp -- file pointer ro write to 1N/A** buf -- location of data to be written 1N/A** n - number of bytes to write 1N/A** Failure: -1 and sets errno 1N/A** Success: number of bytes written 1N/A** SM_STDSEEK -- set the file offset position 1N/A** fp -- file pointer to position 1N/A** offset -- how far to position from "base" (set by 'whence') 1N/A** whence -- indicates where the "base" of the 'offset' to start 1N/A** Failure: -1 and sets errno 1N/A** Success: the current offset 1N/A** Updates the internal value of the offset. 1N/A** SM_STDCLOSE -- close the file 1N/A** fp -- the file pointer to close 1N/A** Failure: -1 and sets errno 1N/A** SM_STDSETMODE -- set the access mode for the file 1N/A** Called by sm_stdsetinfo(). 1N/A** fp -- file pointer 1N/A** mode -- new mode to set the file access to 1N/A** Success: 0 (zero); 1N/A** Failure: -1 and sets errno 1N/A** SM_STDGETMODE -- for getinfo determine open mode 1N/A** Called by sm_stdgetinfo(). 1N/A** fp -- the file mode being determined 1N/A** mode -- internal mode to map to external value 1N/A** Failure: -1 and sets errno 1N/A** Success: external mode value 1N/A** fp -- file to set info for 1N/A** what -- type of info to set 1N/A** valp -- location of data used for setting 1N/A** Failure: -1 and sets errno 1N/A** SM_GETINFO -- get information about the open file 1N/A** fp -- file to get info for 1N/A** what -- type of info to get 1N/A** valp -- location to place found info 1N/A** Success: may or may not place info in 'valp' depending 1N/A** on 'what' value, and returns values >=0. Return 1N/A** value may be the obtained info 1N/A** Failure: -1 and sets errno 1N/A** SM_STDFDOPEN -- open file by primitive 'fd' rather than pathname 1N/A** I/O function to handle fdopen() stdio equivalence. The rest of 1N/A** the functions are the same as the sm_stdopen() above. 1N/A** fp -- the file pointer to be associated with the open 1N/A** name -- the primitive file descriptor for association 1N/A** flags -- indicates type of access methods 1N/A** Success: primitive file descriptor value 1N/A** Failure: -1 and sets errno 1N/A#
endif /* O_BINARY */ 1N/A /* Make sure the mode the user wants is a subset of the actual mode. */ 1N/A** SM_IO_FOPEN -- open a file 1N/A** Same interface and semantics as the open() system call, 1N/A** except that it returns SM_FILE_T* instead of a file descriptor. 1N/A** pathname -- path of file to open 1N/A** flags -- flags controlling the open 1N/A** ... -- option "mode" for opening the file 1N/A** Raises an exception on heap exhaustion. 1N/A** Returns NULL and sets errno if open() fails. 1N/A** Returns an SM_FILE_T pointer on success. 1N/A#
else /* SM_VA_STD */ 1N/A#
endif /* SM_VA_STD */