如何从文件描述符执行程序? [英] How to execute a program from file descriptor?

查看:55
本文介绍了如何从文件描述符执行程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只知道描述符时需要执行一个文件.也可能没有该文件的链接,因此以某种方式找出名称不是一种选择.所有execve(),execvp()等函数均采用文件名. dlopen()也有一个名字.

I need to execute a file when I only know the descriptor. It is also possible that there are no links to the file so finding out the name somehow is not an option. All the execve(), execvp(), etc functions take a file name. dlopen() also takes a name.

好的解决方案(例如读取文件和调用某些函数指针)是可以的.

Ugly solutions (like reading the file and calling some function pointer) are OK.

推荐答案

使用 fexecve .

PS:读取文件并调用一些函数指针肯定不是 . :)

PS: reading the file and calling some function pointer is definitely not OK. :)

这篇关于如何从文件描述符执行程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆