- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to get umask of an existing process
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
05-18-2009 05:07 AM
05-18-2009 05:07 AM
How to get umask of an existing process
Thanks.
- Tags:
- umask
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2009 05:21 AM
05-18-2009 05:21 AM
Re: How to get umask of an existing process
You could use 'umask' to set a new value (perhaps the same as the current one) while returning the old value. See: 'umask(2)'.
If this is a shell, simply use 'umask' without arguments to display the current value.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2009 07:20 AM
05-18-2009 07:20 AM
Re: How to get umask of an existing process
I meant: for any process in the system (other than my shell and this_process).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2009 09:57 AM
05-18-2009 09:57 AM
Re: How to get umask of an existing process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2009 10:26 AM
05-18-2009 10:26 AM
Re: How to get umask of an existing process
Any particular process you are interested in?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2009 02:02 PM
05-18-2009 02:02 PM
Re: How to get umask of an existing process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2009 03:20 AM
05-19-2009 03:20 AM
Re: How to get umask of an existing process
Glance doesn't seem to help either.
I also tried generating a dump with gdb but no luck.
>>>> Any particular process you are interested in?
Yes. The Oracle listener process when using the UTL_FILE package.
According to several Metalink notes (463312.1, 197201.1, 74268.1), the listener just follows the umask value inherited from its parent.
I've traced the system calls made by the listener and it's true:
- it just creates the file with 0666 mask
11:04:22 [oracleBDSC (][16868]{3779834} <-0.000000> open("/u6/sic2/TEMP/JMR12.txt",
O_WRONLY|O_CREAT|O_TRUNC, 0666) [entry]
- it doesnt' explicitly call chmod() or umask() to change permissions
- it just calls umask() to retrieve its value and set it back:
11:04:10 [oracleBDSC (][16868]{3779834} <-0.000000> umask(0777) [entry]
11:04:10 [oracleBDSC (][16868]{3779834} <0.000018> umask(0777) = 022
11:04:10 [oracleBDSC (][16868]{3779834} <-0.000000> umask(022) [entry]
11:04:10 [oracleBDSC (][16868]{3779834} <0.000013> umask(022) = 0777
From the trace we know the file is created 666 - 022 = 644, which is right for us, because other users have to read the file.
The problem is, under some circumstances we are not able to reproduce, the files are created 600 so, if the open(, 0666) mask doesn't change, we assume the listener is running with umask 066 (or 067, 076, 077).
As there are several ways to start a listener:
- directly calling lsnrctl start from an oracle10's ksh shell (thus applying the umask 022 in its .profile)
- through Oracle Enterprise Manager Grid Control (thus appying the umask the OEM agent is running with, 037 in our case)
- in an HP-UX startup script /sbin/init.d... (thus applying the umask 022 in /sbin/rc)
- ...
our plan is:
- to wait till the problem reproduces and tusc again the listener process to get its umask value in that moment
- to file a SR with Oracle.
Any suggestions would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2009 08:42 AM
05-19-2009 08:42 AM
Re: How to get umask of an existing process
I've never seen umask.
>in an HP-UX startup script /sbin/init.d... (thus applying the umask 022 in /sbin/rc)
You may want to change Oracle's rc script to set umask to the way it wants it?
Do you know how that failing listener process was started?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2009 08:53 AM
05-19-2009 08:53 AM
Re: How to get umask of an existing process
>>>> You may want to change Oracle's rc script to set umask to the way it wants it?
Sorry, I havenâ t made myself very clear: we do have a startup script that starts the listener at OS startup. I meant that, as any other startup script that doesn't set umask explicitly, it inherits de umask setting at /sbin/rc, according to what I've read at the ITRC forums.
>>>> Do you know how that failing listener process was started?
You hit the bull's eye: that's the correct question to ask.
As I mentioned, there are several ways we can start the listener and, unless we are missing something, we know all of them and what the umask value should be in each case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2009 09:31 AM
05-19-2009 09:31 AM
Re: How to get umask of an existing process
Yes but if you can't trust it, set it the way you want. Or at least log it.
>we know all of them and what the umask value should be in each case.
Can you use ps(1) to figure out which is the current bad case?
UNIX95=EXTENDED_PS ps -Hef
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2009 09:38 AM
05-19-2009 09:38 AM
Re: How to get umask of an existing process
Good point.
We have to schedule a programmed halt to install some patches and we'll check that case.
>>>> Can you use ps(1) to figure out which is the current bad case?
I don't get your point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2009 10:00 AM
05-19-2009 10:00 AM
Re: How to get umask of an existing process
>I don't get your point.
By looking at your process tree, can you figure out how it started? Or is it a demon, so the PPID is 1, init?
You can also add -x to get longer command lines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2011 06:27 AM
03-22-2011 06:27 AM
Re: How to get umask of an existing process
Script for 11.11, 11.23 AND 11.31 attached.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2014 02:57 PM
04-17-2014 02:57 PM