Issue
I am working on IBM Bluegene/Q system and I would like to create a folder using Fortran. Since Bluegene does not allow for the usual "call system" I have to resort to their intrinsic function:
CALL mkdir ("/home/luc/testfiles\0", %val(755))
as show here: https://wiki.scinet.utoronto.ca/wiki/images/2/23/Bgqfcompiler.pdf
This creates the folder, but the permissions are all wrong. How do I create a folder with the proper permissions on IBMs Bluegene/Q system? All their documentation is horrific and I could not find a working example.
Solution
mkdir is a POSIX function implemented in the C library. You can find its documentation here: http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html. You can find the values for the mode / permissions argument of mkdir here: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html#tag_13_62. Notice that the values are in octal.
What's relevant in this case is that the value you're providing for the second argument is wrong. You're passing decimal 755, which is octal 1363. The example in the manual passed decimal 448 which is octal 0700. If you want octal 0755, you should pass decimal 493. (Or you can pass %val(o'0755'))
Answered By - Rafik Zurob Answer Checked By - David Goodson (WPSolving Volunteer)