Sponsored Content
Top Forums Programming Changing fname in /proc filesystem Post 302096743 by wilbur on Friday 17th of November 2006 04:01:26 PM
Old 11-17-2006
Quote:
Originally Posted by jim mcnamara
1. You can't rename them because they are creations of the kernel.

2. I just tried this - you can create a symlink to the file with ln -s to a directory in /proc, and it works correctly.

??
3. Your first program could read the /proc/whatever/file into a local file then give that file name to prog2
I'm not sure I understand your answers. I think we might be talking past each other so let me see if I can be a little more specific in what I'm doing.

prog2 is just a standard Xwindows application that knows nothing about what I'm trying to do. prog1 is a "wrapper" around it that I wrote. prog2 has been moved out of it's standard location and put somewhere else in the file system. prog1 has taken it's place. It's job is to check the user id and the command line being passed to prog2 to see if it is allowed, and if it is then execute prog2 with that command line. However, I don't want "prog2" showing up in a "ps" listing, so before executing the execv command I change argv[0] to "prog1". So if you just run "ps" prog2 never shows up since the default for ps is to show only the command line, not the actual file name. But if you pass "-o fname" (or use "sdtprocess") then the actual filename shows up, which is bad because the command line says "prog1" and the actual filename says "prog2".

I'm using Solaris 8 if that makes a difference. I've looked at the /proc directory and it's all pid values for directories and each directory has a standard layout. The only place I've found the filenames I'm looking for is in the file "psinfo", which makes sense since there is a "psinfo" structure in the "procfs.h" header with an "fname" field. So I assumed the way to change the value of fname for "prog2" was to find it's pid (no problem there), read in the psinfo file, change the fname field and write it back out. Assuming this can be done, which I suspected could not be, and your comments in 1) above reinforces that.

In your other comments you mention creating a smylink between a directory in /proc and something else (prog2?) or copying a file from the /proc directory and giving that name to prog2. I don't know what you are saying here. Could you explain this further?

Thank you for your reply.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

about /proc

hi, we all know /proc is about the information of active process, I have just read an artical which said you can use /proc/cpuinfo, /proc/net./proc/meminfo etc. to know about some hardware information .But I want to know how to use with command line? (1 Reply)
Discussion started by: fuqiang1976
1 Replies

2. Filesystems, Disks and Memory

Changing Filesystem size.

Hi there, can i change the size of filesystem afterwards. i want give some more space to my /export/home and want take some space from /opt. is it possible in solaris ? Any help will be appriciated. Abid (2 Replies)
Discussion started by: abidmalik
2 Replies

3. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies

4. UNIX for Dummies Questions & Answers

_/proc/stat vs /proc/uptime

Hi, I am trying to calculate the CPU Usage by getting the difference between the idle time reported by /proc/stat at 2 different intervals. Now the 4th entry in the first line of /proc/stat will give me the 'idle time'. But I also came across /proc/uptime that gives me 2 entries : 1st one as the... (0 Replies)
Discussion started by: coderd
0 Replies

5. Solaris

Solaris 10 /proc making filesystem full

Hi all, I have a solaris 10 box on which /proc is a part of / The problem is that my / partition is getting full mainly due to /proc getting a lot of files. My question is : Can I delete files/directories in /proc directory. If not what could be the other way round to clean up /proc so... (18 Replies)
Discussion started by: run_time_error
18 Replies

6. Solaris

Filesystem - error when extend the filesystem

Hi all, currently , my root filesystem already reach 90 ++% I already add more cylinder in the root partition as below Part Tag Flag Cylinders Size Blocks 0 root wm 67 - 5086 38.46GB (5020/0/0) 80646300 1 swap wu 1 - ... (11 Replies)
Discussion started by: SmartAntz
11 Replies

7. Linux

Tripwire Nightware on Linux (proc filesystem)

Hello, I am having a nightmare with Tripwire on Linux..... I cannot get it to ignore the /proc filesystem, which I want to completely ignore for now Has anyone here successfully configured Tripwire on Linux and completed ignored the /proc filesystem ? If so, please reply and tell me how... (0 Replies)
Discussion started by: Neo
0 Replies

8. UNIX for Dummies Questions & Answers

hwo to find shared filesystem and local filesystem in AIX

Hi, I wanted to find out that in my database server which filesystems are shared storage and which filesystems are local. Like when I use df -k, it shows "filesystem" and "mounted on" but I want to know which one is shared and which one is local. Please tell me the commands which I can run... (2 Replies)
Discussion started by: kamranjalal
2 Replies

9. Solaris

Solaris Filesystem vs. Windows FileSystem

Hi guys! Could you tell me what's the difference of filesystem of Solaris to filesystem of Windows? I need to compare both. I have read some over the net but it's so much technical. Could you explain it in a more simpler term? I am new to Solaris. Hope you help me guys. Thanks! (4 Replies)
Discussion started by: arah
4 Replies

10. AIX

Mount Filesystem in AIX Unable to read /etc/filesystem

Dear all, We are facing prolem when we are going to mount AIX filesystem, the system returned the following error 0506-307The AFopen call failed : A file or directory in the path name does not exist. But when we ls filesystems in the /etc/ directory it show -rw-r--r-- 0 root ... (2 Replies)
Discussion started by: m_raheelahmed
2 Replies
SICK(1p)						User Contributed Perl Documentation						  SICK(1p)

NAME
sick - Compiler for CLC-INTERCAL SYNOPSIS
sick [options] files... DESCRIPTION
sick is the main development environment for CLC-INTERCAL. If files are specified, these will be compiled using the options in effect at the point where they appear on the command line, and they are compiled to objects (if they are not already object). After all the options have been processed, the program enters interactive mode, unless otherwise specified. The program will be compiled using a compiler selected using command line options; if nothing is selected, the compiler depends on the file suffix: CLC-INTERCAL program source These files must have suffix .i or .clci. These will be prefixed, by default, with the compiler object sick.io. CLC-INTERCAL compiler source These files must have suffix .iacc. These will be prefixed, by default, with the compiler object iacc.io and produce a compiler object (which can be executed as a program, but will do nothing - it's only useful as a preload before compiling from source). C-INTERCAL program source These have suffix .ci and will be prefixed with the compiler object ick.io. CLC-INTERCAL assembler source These have suffix .iasm and will be prefixed with the compiler object asm.io. Traditional INTERCAL program source These will have suffix .1972 and will be prefixed with the compiler object 1972.io Compiler extensions Suffixes .i, .ci, .clci and .iasm can contain a list of letters and numbers between the spot (.) and the rest of the suffix; these select compiler extensions to be added. Base Numbers between 2 and 7 change the default base by loading compiler objects 2.io to 7.io. Bitwise Divide Letter d in the suffix adds the compiler object bitwise-divide.io, which changes the normal unary divide operation to use bit- wise, rather than arithmetic, shifts. It can be used with sick or iasm but not with ick. COME FROM gerund Letter g in the suffix adds the compiler object come-from-gerund.io, which enables the COME FROM gerund statements; since ick does not parse such statements, this letter can only be used with sick or iasm. Computed labels Letter l in the suffix adds the compiler object computed-labels.io, which adds grammar rules to parse computed statement labels; this can be used only with sick. NEXT Letter n in the suffix adds the compiler object next.io, which enables the NEXT statement in sick; since ick enables this by default, this letter can only be used with sick. INTERcal NETworking Letter r in the suffix adds the compiler object internet.io, which adds syntax for the STEAL, SMUGGLE and CASE statements; it can be used with ick or sick. System call Letter s in the suffix adds the compiler object syscall.io, which hides a "PLEASE NEXT FROM(666)" in a dark corner of your operating system. Threaded program Letter t in the suffix selects threaded mode by loading compiler object thick.io. This also changes the default compiler to ick if the suffix is .i: to use sick one would use .tclci. Wimp mode Letter w in the suffix adds the compiler object wimp.io, which causes the program to start in wimp mode when it is executed. An equivalent result can be obtained by passing the --wimp option to the executable program. The actual list of suffixes recognised can be changed by editing the file system,sickrc or .sickrc. See the option --rcfile for a discus- sion on how and where sick finds these files, and sickrc for a description of the file format. If a preload file is specified on the command line, the defaults derived from the suffix are not used. It is also possible to use default preloads from a different file suffix by explicitely saying -suffix=S - in this case, the compiler acts as if the file had name name.S In addition, compiler objects are always recognised, with whatever suffix. These bypass the first compiler pass and jump directly to the runtime (just-too-late) compiler. However, if the optimiser has been selected when these objects were compiled, and there are no postpro- cessor statements, the just-too-late compiler will be automatically replaced by a more traditional "compile-time" compiler. If this is con- fusing, wait until you see the rest. If a file is specified without suffix, and there is a compiler object in the include path with the same name and suffix .io, the suffix is automatically added, whether you wanted it or now. As soon as each program is written into sick, a pre-compiler will produce an internal compiler object. If sick enters interactive mode, these objects will be available in memory for single-stepping, running, or just ignoring completely and getting on with the real work. If sick loads all the required programs and objects successfully, but does not enter interactive mode, any program source is read back out to disk in object format, using the same file name with the suffix replaced by .io if no output file is specified. If a backend is speci- fied in the command line before a program is loaded, sick will produce an executable via that backend instead of an object. The compiler accepts several options, some of which are documented here. Options and files can be mixed in any order, each file is loaded and compiled using whatever options precedes it on the command line. For example: sick --verbose --optimise prog1.i --quiet prog2.i --batch will tell you everything about compiling prog1.i but not about prog2.i. Both programs will be optimised. On the other hand: sick --optimise prog1.i --nooptimise prog2.i --batch will optimise prog1.i but not prog2.i. All options can be "undone" (sometimes it's even clear how) except --include which applies to all objects loaded after it, and --rcfile which applies to all objects, even the ones loaded before it (just to be different). User Interface Options -X / --graphic Enters X-based graphical user interface. Requires Perl-GTK. This is the default if Perl-GTK is installed, the environment variable $DISPLAY is set and the opening of the X display succeeds. -c / --curses Enters full screen, curses-based interface. This is the default if the X based interface cannot be started, the environment variable $TERM is set and the terminal name is known. --line Enters the line-mode user interface. This is the default if the X based and the curses based interfaces do not work. --batch Avoids entering interactive mode. This is the default if the standard input and output are not connected to a terminal and the X based interface cannot be started. -itype / --interface=type Selects the user interface type. Currently, only X, Curses, Line and None are defined, but more can be installed as compiler plug-ins. If the interface selected is None, sick will work in batch mode. In addition, an empty string will reinstate the default behaviour. Source Character Set Options -a / --ascii Assumes that program source is in ASCII. -b / --baudot Assumes that program source is in Baudot. -e / --ebcdic Assumes that program source is in EBCDIC. -h / --hollerith Assumes that program source is in Hollerith. -g / --guess Does not make assumptions about the source character set. If the character set cannot be guessed, will produce an error. This is the default. --charset=name Assumes that program source is in the given character sets. Valid values are currently ASCII, Baudot, EBCDIC, Hollerith; an empty name is equivalent to specifying option --guess). Code Generation Options -O / --optimise Invokes the optimiser. This is a letter o, not a zero. This will cause the extra object optimise.io to be prefixed after the last com- piler and before the real program. The program is then executed: when the optimiser takes control, it will force compilation of the rest of the program (thereby executing the compiler at compile-time, instead of runtime as it normally does), and the resulting object is checkpointed, so the next time it will automatically skip the initialisation and compilation stages. In addition, the "optimise" register is set, instructing the compiler to invoke the optimiser when it runs. If you specify -O and -poptimise (see below), you are asking for trouble, so don't do that. --nooptimise Disables automatic preloading and execution of optimise.io. -oname / --output=name Selects a name for the output file. Some character sequences are recognised inside name: %p will be replaced by the source program's basename; %s will be replaced by the appropriate suffix for the selected backend, %o will provide the original file name specified on the command line, without suffix (this can differ from %s because %s can be prefixed with a directory from the search path) and %% will produce a single %. The default is %p.%s, which produces the object name described at the beginning of this document. A suffix is not automatically added if the output name does not contain %s; this might be useful in ocnjunction with the Perl backend to produce a file without a suffix, for example: sick --output=%p --backend=Perl sourcefile.i will compile sourcefile.i and produce perl script sourcefile. If the output file is specified as an empty string, the code generation step will never be done. -nname / --name=name Sets the program's name, if the code generator requires it (currently, no backends use a name, but some of the planned ones will). The default is %o. The same %-escapes as defined for the output file name are defined. -lname / --backend=name Selects a different compiler back end. The default is Object, which produces a compiler object (suffix .io). The distribution also includes a Perl backend, which produces an executable Perl program (suffix .pl). In addition, the pseudo backend Run will run the pro- gram instead of writing any object. In this case, the output file name is ignored. Note that the program will only run if the compiler is in batch mode. Other back ends can be provided as compiler plug ins. The distribution also contains a ListObject backend, which does not produce executables but object listings. A future version might allow to "compile" the output of the ListObject back end, but this is currently impossible because not all the internal state of the object is provided, only the part which is likely to be useful to a human reader. --bug=number Selects a different probability for the compiler bug. The compiler bug is implemented by initialising the compiler's state with the required probability: when a statement is compiled (usually at runtime), a "BUG" instruction is emitted with the required probability. The default is 1%. --ubug=number Selects a probability for the unexplainable compiler bug. This is the compiler bug which occurs when the probability of a (explainable) compiler bug is zero. Only wimps would use this option. The default is 0.01%. -pname / --preload=name Selects a compiler object to prefix to the program. If this option is specified, the compiler won't automatically prefix objects as suggested by the suffix. The program 'oo, ick' included in previous version of CLC-INTERCAL used option -p to select a parser. Since the main use of preloads is to select an alternative (runtime) compiler, it is felt that it is appropriate to keep the same letter for this option. The file name specified does not include the suffix .io, which is always added. The file must be a compiler object, not source code. The special object optimise should always loaded via -O. Using -poptimise will not necessarily put the object in the correct place, and will not instruct the precompiler to do whatever magic it needs to do to bootstrap the optimiser. To completely disable preloading (this is only done when compiling the optimiser, which is used to compile itself) use an empty string. --nopreload Resets the default behaviour of selecting preloads based on suffixes. --suffix=suffix Specifies a suffix to use when selecting preloads. If this option is not specified, the suffix is taken from the file name to be com- piled. -Ipath / --include=path Adds a directory before the standard search path for compiler objects and source code. If a file is accessible from the current direc- tory, it is never searched in any include path. If this option is repeated, the given paths will be searched in the order given, followed by the standard paths. Misc Options -rname / --rcfile=name Executes commands from file name before entering interactive mode. This option can be repeated, to execute more than one file. If it is not specified, the standard library, the current directory, and the current user's home directory are searched for files with name system.sickrc or .sickrc, which are then executed. The order for this search is: specified library (--include), system library, home directory, current directory. This is different from the search order used when looking for objects or source code. If a directory con- tains both .sickrc and system.sickrc, the system.sickrc is executed first, followed by .sickrc. Also note that if the current directory or the home directory appear in the search path and contain one of these files, they will be executed twice. If filenames are explicitely specified, they must be fully qualified: the search path is not used to find them. --nouserrc Prevents loading a user rcfile (.sickrc); also limits loading of system.sickrc to the first one found. This option is normally only used during installation, to prevent interference from previous versions of CLC-INTERCAL. -v / --verbose Tells everything it's doing (on Standard Error). --stdverb=file Sends verbose output to file. --trace Enables tracing; if compiling from source, the compiler is also traced; to trace a program, compile it to an object and then run it with --trace. --stdtrace=file Enables tracing and selects an output file for the trace information. --notrace Disables tracing; preloading trace.io has priority over this option. -q / --quiet Stop talking to Standard Error. --times Prints a summary of the time take for each major action. This setting is independent of --verbose. --notimes Does not print execution times: this is the default. --rclist Prints the names of all rcfiles found. It prevents starting interactive mode. For example, the following command (which should work with any Unix shell) opens all the system and user sickrc files in your favourite editor: sh -c '"${EDITOR:-vi}" "`sick --rclist`"' This can be useful to update the defaults. BUGS
There are more options than ls(1). This is construed to be a feature. SEE ALSO
The INTERCAL on-line documentation, by entering sick's interactive mode and finding the "help" menu (X), key (Curses) or command (Line). perl v5.8.8 2008-03-29 SICK(1p)
All times are GMT -4. The time now is 09:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy