Sponsored Content
Top Forums Programming Is there a system call other than 'open' for opening very large files? Post 302344313 by achenle on Saturday 15th of August 2009 09:06:57 PM
Old 08-15-2009
Try this:

Code:
open( filename, O_RDONLY | O_LARGEFILE );

You also probably need to add these macro definitions to your compiles:

Code:
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

Or you can just compile everything as a 64-bit binary if you're running on a 64-bit OS. If you go that route it's usually a lot simpler. But you have to actually read specifications, because among other common problematic coding practices I've seen far too many times, pointers aren't integers when you compile 64-bit apps.

(Well, pointers are never, ever ints, but because most 32-bit memory models happen to make both pointers and ints 32 bits, it works most of the time. For 32-bit apps, anyway. An "int" is an "int", a pointer is a pointer, and a size_t is a size_t.)
 

10 More Discussions You Might Find Interesting

1. AIX

Why is my file system cache so large

Hi I have a filesystem cache which is around 20G in size and I'm a bit perplexed as to what is in it. I'm running Sybase on the machine with the db on raw volumes and a tempdb on a ramdisk. My understanding is that raw volumes are not cached and I assumed that the ramdisk is not either. Am... (1 Reply)
Discussion started by: mgibbons
1 Replies

2. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

3. Web Development

Content Management System for uploading large files

Hi everybody, I am currently trying to develop a simple content management system where I have an internal website for my users to upload large files onto the server. The site is password protected and my users won't be trying to hack into the system so security is a non-factor (as least for... (3 Replies)
Discussion started by: z1dane
3 Replies

4. UNIX for Advanced & Expert Users

System Call Wrapper of 'open'

When the programmer use 'open' function, the process is like below. "open -> system call wrapper of open in Glibc -> syscall_open in kernel" I found the wrapper of open, but there is no implementation like 'int $80'. int __open (file, oflag) const char *file; int oflag; { ... (3 Replies)
Discussion started by: yuno96
3 Replies

5. Shell Programming and Scripting

Assistance pls - pipe error: Too many open files in system

When I run a bash script in the customer system, it throws the warning and script exits Exec '/root/sample.sh' @ hostname-- OK (warn) /root/sample.sh: pipe error: Too many open files in system /root/sample.sh: n + : syntax error: operand expected (error token is " ") Exec... (5 Replies)
Discussion started by: vidhyamirra
5 Replies

6. SCO

Need advice: Copying large CSV report files off SCO system

I have a SCO Unix server from 1999 running SCO 5.0.5 and some ancient accounting software called Real World A report writer program on the system is used to generate CSV files from accounting that we write with DOSCOPY commands to 3.5" floppies In the next 60 days we will be decommissioning... (11 Replies)
Discussion started by: magnetman
11 Replies

7. UNIX for Advanced & Expert Users

resize2fs open: Is a directory while opening /home

Can anyone explain this error to me? I am trying to use resize2fs to resize an ext4 partition. I did unmount the partition and I don't have any files opened or anything like that. Here is the full output. # resize2fs -p /home 3G resize2fs 1.41.12 (17-May-2010) open: Is a directory while... (1 Reply)
Discussion started by: cokedude
1 Replies

8. Programming

open() system call in c++????

Hi friends, I am trying to use the open system call in c++ language. Please have a look at my code. vi Open.cpp 1 #include <stdio.h> 2 #include <iostream> 3 4 #define BUFSIZE 1 5 6 using namespace std; 7 8 int main() 9 { 10 ... (5 Replies)
Discussion started by: gabam
5 Replies

9. Shell Programming and Scripting

How to open large datafie in awk?

I just tried awk '{print}' all.plo awk: cannot open all.plo (Value too large for defined data type)awk '{print $8"-"$7"-"$6,$9,$4,$5,$12,$15}' all.plo awk: cannot open all.plo (Value too large for defined data type) datafile size is 4.8GB any other provision ? only cat works FS is... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies

10. Solaris

Getting read only propmt when opening /etc/system file

root@atrcx146:/# vi /etc/system "/var/tmp/Exv9a4Rb" Read-only file system Please let me know the reason (1 Reply)
Discussion started by: Marty11
1 Replies
Ns_ConnReturnOpen(3aolserver)				   AOLserver Library Procedures 			     Ns_ConnReturnOpen(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ConnReturnOpenChannel, Ns_ConnReturnOpenFd, Ns_ConnReturnFdEx, Ns_ConnReturnOpenFile - Routines to send open file content SYNOPSIS
#include "ns.h" int int Ns_ConnReturnOpenChannel(conn, status, type, chan, len) int Ns_ConnReturnOpenFd(conn, status, type, fd, len) int Ns_ConnReturnOpenFdex(conn, status, type, fd, off, len) int Ns_ConnReturnOpenFile(conn, status, type, fp, len) ARGUMENTS
Tcl_Channel chan (in) Pointer to Tcl_Channel open for read. Ns_Conn conn (in) Pointer to open connection. FILE *fp (in) Pointer to stdio FILE open for read. off_t off (in) Seek offset. int fd (int) File descriptor open for read. int status (in) HTTP status code. char *type (in) Pointer to mimetype string. _________________________________________________________________ DESCRIPTION
These routines are used to generate complete responses, including headers, status codes, content types, and the content copied from the given open file. They all return a status code which is NS_OK if the response was sent or NS_ERROR if an underlying call to sent the con- tent failed. The response will include the given HTTP status code, a content-type header with the given type, and a content-length header with the length specified by len. No character output encoding or gzip compression is performed on the content. For Ns_ConnReturnOpenFdEx, copying begins at the offset specified by the off argument Otherwise, these routines copy from the current read offset in the underlying open file. No attempt is made to serialize access to the underlying object so independent open file objects and/or mutex locking is necessary if the same file is being sent simultaneously to multiple clients. NOTES
Windows Support The Ns_ConnReturnOpenFdEx routine is not currently supported on Windows. When called on Windows, it will always return NS_ERROR. Truncated Result The server will construct a content-length header based on the given len argument. However, the server will send the content with an underlying call to a cooresponding Ns_ConnSend function, e.g., Ns_ConnSendFd for Ns_ConnReturnOpenFd. These functions will send the requested content or all remaining content in the open file if less bytes are avilable without reporting an error due to the trun- cated response. As the headers will have already been flushed before sending the content in this case, the content-length header will not be consistent with the actual bytes sent. If it is not possible to ensure the remaining bytes will be equal or greater to the requested bytes to send, it is possible to specify -1 for len to supress the content-length header entirely. Most browsers will accept this resonse and simply calculate the length from the bytes receieved up until the socket is closed. Performance Consideration As mentioned, these routines use underlying Ns_ConnSendFd style routines to copy and send the content from open files. This is not the approach used by the builtin file-serving code (aka the "fastpath"). The fastpath operates with filenames, not open file objects, and maintains a cached of pre-read or memory mapped regions to accelerate the common case of rapidly sending reasonably sized content to multiple, simultaneous clients. The Ns_ConnReturnFile routine utilizes the underlying fastpath and thus could be a faster means to send static files than directly opening files and calling these API's. SEE ALSO
Ns_ConnReturnFile(3), Ns_ConnFlush(3), Ns_ConnSendFd(3), Ns_ConnReturnData(3) KEYWORDS
connnection, response, file AOLserver 4.0 Ns_ConnReturnOpen(3aolserver)
All times are GMT -4. The time now is 11:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy