Questions tagged [readlink]

38 questions
1
vote
0 answers

Condition on file descriptor

I have a kernel module that intercepts IOCTL system calls. Now as you now the IOCTL signature is like int ioctl(int fd, unsigned long request, ...); Now I want to have a condition on "fd", actually I want to do a special thing in my kernel module…
Cert
  • 99
  • 1
  • 2
  • 9
1
vote
0 answers

How to get executable name from process id in C Linux

I am new to C Linux programming and for exercise I am trying to get executable name from process id. If I provide the process id myself then it works fine, but if process id is being provided dynamically in a while loop then the readlink returns -1.…
niko85
  • 303
  • 2
  • 12
1
vote
1 answer

Readlink not finding C files (MSYS)

A while back I asked a question about this subject and "solved" it by using Cygwin instead with its XWin utility, but I've come back to this issue again since the Xwin utility does not use my GPU and creates a severe bottleneck in simulations as a…
spacemoose
  • 11
  • 5
0
votes
1 answer

Error in middleware-manifest.json (errno: -4094, code: 'UNKNOWN', syscall: 'readlink') in .Next file

My project was running fine when, with a small change in the code, npm run dev stopped working, and the terminal showed the following message: [Error: UNKNOWN: unknown error, readlink…
0
votes
0 answers

why does readlink function cause a segmentation fault instead of moving the path string to a pointer?

when I run the code char* dirPath = (char*) malloc(pathSize); // pathSize is 512 and its pre defined readlink("/proc/self/exe",dirPath,pathSize); //segfault here it segfaults. I've tried increasing the value of pathSize or passing the pathSize…
0
votes
0 answers

How to batch update all symlink pointers to replace "_F-ss" with empty string?

I am trying to replace all text file symlink pointers to replace _F-ss with empty string as below but running into below error, any guidance on how to fix this? find . -name "*.txt" -type l | xargs 'ln -nsf "$(readlink "%p" | sed…
wisecrack
  • 315
  • 2
  • 12
0
votes
0 answers

Retrieve Windows symlink target in cC

I created a couple of symlinks.... The dir command is able to show the target as below Directory of C:\abc 07/03/2020 04:58 AM link.txt [s:\naveen\ow.bat] 07/03/2020 05:01 AM link1.txt [c:\naveen\ow.bat] I am trying to get the…
Naveen
  • 91
  • 1
  • 7
0
votes
2 answers

Difficulty using readlink in bash with mix of variables and string to return absolute paths

I have a config script where users can specify paths as variables in the header section. I want them to be able to use absolute paths, relative paths and variables (because this is actually called from another shell script from where they get the…
llionevans
  • 35
  • 4
0
votes
1 answer

How can I prevent the same file being included twice when using hardlinks?

How can I prevent the same file being included twice? Here is my source code:
Dan Bray
  • 7,242
  • 3
  • 52
  • 70
0
votes
1 answer

What alternatives are there for " readlink -e"

I use a makefile which in order to create a library uses a .pc file which looks like this current_path=`readlink -e .` cat > lib/libmy.pc << EOM prefix=$current_path includedir=\${prefix}/inc libdir=\${prefix}/lib Name: my Description: My…
user10766540
0
votes
1 answer

Why C readlink() has ELOOP as a possible error

Background I read about the Open Group Specification about readlink(), and there is an error called ELOOP, which indicates "A loop exists in symbolic links encountered during resolution of the path argument.", so I assume this function will continue…
David Chen
  • 1,777
  • 2
  • 12
  • 23
0
votes
0 answers

What is the equivalent of function readlink in linux kernel space?

I have some program, that opened a few files. I got the pid of this process. I can get the file name of the file, that has been opened by this process using this command: readlink /proc/3826/fd/10 This gives me the full path to file. How can I do…
bvbvb
  • 1
  • 1
0
votes
2 answers

readlink sets errno to ENOENT

I'm an inexperienced Linux programmer and am trying to learn to use readlink() based on this question and answer. My call to readlink() returns -1 and sets errno to 2 (ENOENT). The code: #include #include #include…
StoneThrow
  • 5,314
  • 4
  • 44
  • 86
0
votes
0 answers

Bashscript which returns link from /proc

I would need a script, which return me the symbolic link of /proc/$pid/cwd. I wrote some code, but it won't work! #!/bin/bash pid=26086 readlink /proc/$pid/cwd I also tried: echo $(readlink /proc/$pid/cwd) The first one returns nothing and the…
chi86
  • 181
  • 1
  • 15
0
votes
1 answer

How to only get the last directory from readlink

I'm doing a project at work were I need to get the version of Java for 100's of servers. I been using readlink, but that gives me full path for the link. I'm trying to figured out a way to only get the last directory using Python. >>> f =…
milo
  • 33
  • 6