HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: programme/script to openfiles
Operating System - HP-UX
1830899
Members
3096
Online
110017
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 05:38 AM
06-21-2004 05:38 AM
Hello
I'm trying to open a specific number of files to try and hit my limit with the below piece of code
#include
#include
#include
#include
int main(int argc, char *argv[])
{
if ( argc != 2 ) {
printf("Usage : %s\n", argv[0]);
exit(1);
}
printf("\nOur pid is %d\n\n", getpid());
int i, fd;
int j = atoi(argv[1]);
for (i = 0; i <= j; i++) {
if ( fd = ( open("/var/tmp/james/open_file", O_RDONLY | O_CREAT, 0600)) < 0 ) {
perror("open");
exit(2);
}
}
printf("Finished %d opens for process %d......\n", i - 1, getpid());
sleep(100);
exit(0);
}
My c knowledge is 0, when I try to compile with
cc openf.c
I get the below
(Bundled) cc: "openf.c", line 18: error 1000: Unexpected symbol: "int".
(Bundled) cc: "openf.c", line 6: error 1705: Function prototypes are an ANSI feature.
Can anyone help or have a perl/c/shell programme to do a similar thing
I'm going home for the day but would be grateful if supplied for the morning
thanks in advance
Steve
I'm trying to open a specific number of files to try and hit my limit with the below piece of code
#include
#include
#include
#include
int main(int argc, char *argv[])
{
if ( argc != 2 ) {
printf("Usage : %s
exit(1);
}
printf("\nOur pid is %d\n\n", getpid());
int i, fd;
int j = atoi(argv[1]);
for (i = 0; i <= j; i++) {
if ( fd = ( open("/var/tmp/james/open_file", O_RDONLY | O_CREAT, 0600)) < 0 ) {
perror("open");
exit(2);
}
}
printf("Finished %d opens for process %d......\n", i - 1, getpid());
sleep(100);
exit(0);
}
My c knowledge is 0, when I try to compile with
cc openf.c
I get the below
(Bundled) cc: "openf.c", line 18: error 1000: Unexpected symbol: "int".
(Bundled) cc: "openf.c", line 6: error 1705: Function prototypes are an ANSI feature.
Can anyone help or have a perl/c/shell programme to do a similar thing
I'm going home for the day but would be grateful if supplied for the morning
thanks in advance
Steve
take your time and think things through
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2004 05:43 AM
06-21-2004 05:43 AM
Solution
Your problem is that the Bundled C compiler only speaks K&R and knows nothing about ANSI C syntax.
Your functions, including main() must use K & R C, e.g:
int main(int argc, char *argv[])
must be instead:
int main(argc,argv)
int argc;
char *argv[];
{
}
Your functions, including main() must use K & R C, e.g:
int main(int argc, char *argv[])
must be instead:
int main(argc,argv)
int argc;
char *argv[];
{
}
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP