HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Different behaviour of stat() in a library
Operating System - HP-UX
1834453
Members
1935
Online
110067
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
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
07-02-2002 11:15 AM
07-02-2002 11:15 AM
Different behaviour of stat() in a library
I have a strange problem with a shared library on 64 bit HP-UX 11.0. The lib uses stat(). When calling the library from a self-written command line tool, the stat() call behaves as expected. However, when calling the same routine in the same library (no recompile) with exactly the same parameters from a different environment, it behaves differently: The call to stat() fails with a return code of -1 when the file is not found (which is correct), but errno remains zero (which, to my understanding, means "no error").
The strange thing is that the library has not been recompiled from one case to another. Also, our code does not exchange any file handles with the library; all file related stuff is completely encapsulated in the library,so I don't think this is related to the various large file support APIS availabe (stat64() vs. stat() etc.).
So calling from a command line tools gives one behavior, and calling from another environment (python, in this case) gives another. How can this be caused without a recompile?!?
My idea was that a different stat() implementation gets executed because python is linked against other runtime libraries than our tool. However, to my knowledge, there is only one actual, executable stat() implementation; the various possibilities of calling stat() are sorted out during *compile* time by the system headers. And accidentally linking 32 bit cannot happen because they are not compatible with 64 bit libs.
Any help on what is going wrong here would be very much appreciated!
Kind regards,
Martin
The strange thing is that the library has not been recompiled from one case to another. Also, our code does not exchange any file handles with the library; all file related stuff is completely encapsulated in the library,so I don't think this is related to the various large file support APIS availabe (stat64() vs. stat() etc.).
So calling from a command line tools gives one behavior, and calling from another environment (python, in this case) gives another. How can this be caused without a recompile?!?
My idea was that a different stat() implementation gets executed because python is linked against other runtime libraries than our tool. However, to my knowledge, there is only one actual, executable stat() implementation; the various possibilities of calling stat() are sorted out during *compile* time by the system headers. And accidentally linking 32 bit cannot happen because they are not compatible with 64 bit libs.
Any help on what is going wrong here would be very much appreciated!
Kind regards,
Martin
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 04:24 AM
07-08-2002 04:24 AM
Re: Different behaviour of stat() in a library
Hi Martin:
Have you checked if errno is set when other system calls fail? It could just be a problem with the way errno is declared. I have been using #include in C, which has the declaration "extern int errno;". How do you do this in Python?
Cheers,
Dave
Have you checked if errno is set when other system calls fail? It could just be a problem with the way errno is declared. I have been using #include
Cheers,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2002 08:40 AM
10-09-2002 08:40 AM
Re: Different behaviour of stat() in a library
I am not quite familiar with Python, but you are probably running in a threaded environment. If this is the case, you need to add -D_REENTRANT when you build your library. Do a search on "errno madness" in google and you will get more information.
Good luck!
Good luck!
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