Forum > Unix

rtl/linux/ostypes.inc

<< < (2/3) > >>

MarkMLl:
Right, so it's applicable to filemodes.

It's probably not applicable to put them in ostypes.inc, but it might be worth considering adding them to the Unix package (i.e. outside the lowest levels of the RTL) if they really are a POSIX thing.

Even there, the simplicity of deriving the composite values and the fact that- strictly speaking- you'd need to account for the "sticky bit" and various setuid/setgid usage makes it of dubious advantage: industry standard usage is to add together the numeric constants as needed at the application level.

MarkMLl

Чебурашка:

--- Quote from: MarkMLl on December 30, 2022, 10:51:21 am ---Right, so it's applicable to filemodes.

It's probably not applicable to put them in ostypes.inc, but it might be worth considering adding them to the Unix package (i.e. outside the lowest levels of the RTL) if they really are a POSIX thing.

Even there, the simplicity of deriving the composite values and the fact that- strictly speaking- you'd need to account for the "sticky bit" and various setuid/setgid usage makes it of dubious advantage: industry standard usage is to add together the numeric constants as needed at the application level.

MarkMLl

--- End quote ---

Okay. I understand the point.

Then why S_IRWXU, S_IRWXG, S_IRWXO are in ostypes.inc? This is a local grepping:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---user_tt@debian:~$ grep -r ostypes.inc /usr/share/fpcsrc/3.2.0//usr/share/fpcsrc/3.2.0/rtl/aix/sysos.inc:{$I ostypes.inc}                        // c-types, unix base types, unix base structures/usr/share/fpcsrc/3.2.0/rtl/aix/unxfunc.inc:{ should probably be defined in ostypes.inc for all OSes }/usr/share/fpcsrc/3.2.0/rtl/aix/Makefile.fpc:  ostypes.inc osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/haiku/baseunix.pp:{$i ostypes.inc}/usr/share/fpcsrc/3.2.0/rtl/haiku/baseunix.pp:// MAP_ANON(YMOUS) is OS dependant but used in the RTL and in ostypes.inc/usr/share/fpcsrc/3.2.0/rtl/haiku/sysos.inc:{$I ostypes.inc}                        // c-types, unix base types, unix base structures/usr/share/fpcsrc/3.2.0/rtl/dragonfly/Makefile.fpc:  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/openbsd/ptypes.inc:    // set in ostypes.inc wordsinsigset   = 4;           // words in sigset_t/usr/share/fpcsrc/3.2.0/rtl/openbsd/Makefile.fpc:  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/inc/exeinfo.pp:{$i ostypes.inc}/usr/share/fpcsrc/3.2.0/rtl/android/Makefile.fpc:  $(LINUXINC)/ostypes.inc $(LINUXINC)/osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/netbsd/Makefile.fpc:  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/solaris/sysos.inc:{$I ostypes.inc}                        // c-types, unix base types, unix base structures/usr/share/fpcsrc/3.2.0/rtl/solaris/unxfunc.inc:{ should probably be defined in ostypes.inc for all OSes }/usr/share/fpcsrc/3.2.0/rtl/solaris/Makefile.fpc:  ostypes.inc osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/unix/baseunix.pp:{$i ostypes.inc}/usr/share/fpcsrc/3.2.0/rtl/unix/baseunix.pp:// MAP_ANON(YMOUS) is OS dependant but used in the RTL and in ostypes.inc/usr/share/fpcsrc/3.2.0/rtl/freebsd/Makefile.fpc:  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/linux/sysos.inc:{$I ostypes.inc}                        // c-types, unix base types, unix base structures/usr/share/fpcsrc/3.2.0/rtl/linux/Makefile.fpc:  ostypes.inc osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/beos/baseunix.pp:{$i ostypes.inc}/usr/share/fpcsrc/3.2.0/rtl/beos/baseunix.pp:// MAP_ANON(YMOUS) is OS dependant but used in the RTL and in ostypes.inc/usr/share/fpcsrc/3.2.0/rtl/beos/ossysc.inc:{$i ostypes.inc}/usr/share/fpcsrc/3.2.0/rtl/beos/sysos.inc:{$I ostypes.inc}                        // c-types, unix base types, unix base structures/usr/share/fpcsrc/3.2.0/rtl/darwin/Makefile.fpc:  $(BSDINC)/ostypes.inc $(BSDINC)/osmacro.inc $(UNIXINC)/gensigset.inc \/usr/share/fpcsrc/3.2.0/rtl/fpmake.pp:          AddInclude('ostypes.inc',AllUnixOSes);/usr/share/fpcsrc/3.2.0/rtl/fpmake.pp:          AddInclude('ostypes.inc');/usr/share/fpcsrc/3.2.0/rtl/bsd/sysos.inc:{$I ostypes.inc}                        // c-types, unix base types, unix base structuresuser_tt@debian:~$ grep -r S_IRWXU /usr/share/fpcsrc/3.2.0//usr/share/fpcsrc/3.2.0/rtl/linux/ostypes.inc:    S_IRWXU =  S_IRUSR or S_IWUSR or S_IXUSR;/usr/share/fpcsrc/3.2.0/rtl/netwlibc/libc.pp:     S_IRWXU = $01C0;/usr/share/fpcsrc/3.2.0/rtl/netwlibc/sysdir.inc:  Res := FpMkdir (pchar(s),S_IRWXU);/usr/share/fpcsrc/3.2.0/rtl/netware/nwserv.pp:   S_IRWXU = 0000700;/usr/share/fpcsrc/3.2.0/rtl/bsd/ostypes.inc:    S_IRWXU =  S_IRUSR or S_IWUSR or S_IXUSR;/usr/share/fpcsrc/3.2.0/packages/libmicrohttpd/examples/demo.pp:      FpMkdir(uc^.language, S_IRWXU);/usr/share/fpcsrc/3.2.0/packages/libmicrohttpd/examples/demo.pp:      FpMkdir(PAnsiChar(fn), S_IRWXU);/usr/share/fpcsrc/3.2.0/packages/libmicrohttpd/examples/demo_https.pp:      FpMkdir(uc^.language, S_IRWXU);/usr/share/fpcsrc/3.2.0/packages/libmicrohttpd/examples/demo_https.pp:      FpMkdir(PAnsiChar(fn), S_IRWXU);/usr/share/fpcsrc/3.2.0/packages/libc/src/sstath.inc:  S_IRWXU = (__S_IREAD or __S_IWRITE) or __S_IEXEC;/usr/share/fpcsrc/3.2.0/packages/libc/src/sstath.inc:  S_IRWXG = S_IRWXU shr 3;/usr/share/fpcsrc/3.2.0/packages/libc/src/sstath.inc:  ACCESSPERMS = (S_IRWXU or S_IRWXG) or S_IRWXO;/usr/share/fpcsrc/3.2.0/packages/libc/src/sstath.inc:  ALLPERMS = ((((S_ISUID or S_ISGID) or S_ISVTX) or S_IRWXU) or S_IRWXG) or S_IRWXO; 

MarkMLl:

--- Quote from: tt on December 30, 2022, 11:19:54 am ---Then why S_IRWXU, S_IRWXG, S_IRWXO are in ostypes.inc? This is a local grepping:

--- End quote ---

Presumably because they're needed for the compiler or the system unit.

MarkMLl

Чебурашка:

--- Quote from: MarkMLl on December 30, 2022, 11:39:43 am ---
--- Quote from: tt on December 30, 2022, 11:19:54 am ---Then why S_IRWXU, S_IRWXG, S_IRWXO are in ostypes.inc? This is a local grepping:

--- End quote ---

Presumably because they're needed for the compiler or the system unit.

MarkMLl

--- End quote ---

Ah ok, I thought compiler did not use rtl units.

MarkMLl:

--- Quote from: tt on December 30, 2022, 11:58:09 am ---Ah ok, I thought compiler did not use rtl units.

--- End quote ---

"It's complicated" :-)

The best thing I can do is give an example from ten years ago where I was trying to reconcile two different attempts to get a MIPS target going:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---# Build a compiler which runs on the host but targets mipsel, note debug options which are needed later: cd /usr/local/src/fpc-trunkexport PP=make "OPT=-O- -g" -C compiler mipselmv compiler/ppcmipsel compiler/ppcXmipsel # Renaming the compiler prevents it from being deleted by make clean etc., consider extending that OPT setting with -dEXTDEBUG. export PP=/usr/local/src/fpc-trunk/fpc/compiler/ppcXmipselmake CPU_TARGET=mipsel OS_TARGET=linux rtlmake CPU_TARGET=mipsel OS_TARGET=linux compiler # Move the newly-generated compiler and the RTL units to the target system, which should now be able to do a full build.  
There's obviously better- and in particular officially-sanctioned- explanations, but that's what I can easily lay hands on right now and I think it illustrates the important points.

There's obviously been "feature creep" over the years, but basically the non-package part of the RTL contains- /should/ /contain/- only the bits that the compiler and internal toolchain need. However in the case of unix (note lower-case name) that contains things like syscall numbers and the structure returned by the stat() syscall, and at that point it's reasonable to have some degree of naming for the file attribute bits but not necessarily all possible combinations.

MarkMLl

https://wiki.freepascal.org/Native_MIPS_Systems

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version