Recent

Author Topic: How to set file permission programmatically? I've created a compiler  (Read 938 times)

Mussel

  • Newbie
  • Posts: 1
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


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9536
  • FPC developer.
Re: How to set file permission programmatically? I've created a compiler
« Reply #1 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