Lazarus

Free Pascal => Unix => Topic started by: Mussel on July 28, 2021, 03:20:26 pm

Title: How to set file permission programmatically? I've created a compiler
Post by: Mussel on July 28, 2021, 03:20:26 pm
Hi, I have written a simple back-end compiler for Linux x64 using Pascal which supports two commands only: ReadLine and WriteLine.

Now the issue is after my compiler generating the ELF64 binary program, I do not know how to set the file permission so that it can be allowed to execute.

In the mean time, I have to set each one manually:
Code: [Select]
chmod u=rwx,g=rx,o=rx test
BTW, if anyone is interested, can try this back-end compiler, open-source.
ELF64 binary file format is quite simple if used with only sys_read and sys_write.

https://github.com/khanming/Pipit

Title: Re: How to set file permission programmatically? I've created a compiler
Post by: marcov on July 28, 2021, 03:23:15 pm
If you had searched on chmod in the manuals, you would have found:

https://www.freepascal.org/docs-html/rtl/baseunix/fpchmod.html
TinyPortal © 2005-2018