{"id":121,"date":"2023-09-02T10:46:10","date_gmt":"2023-09-02T02:46:10","guid":{"rendered":"https:\/\/www.jishuge.cn\/?p=121"},"modified":"2023-09-02T10:46:10","modified_gmt":"2023-09-02T02:46:10","slug":"%e5%85%b3%e4%ba%8elinux%e7%bc%96%e7%a8%8b%e4%b8%ad%e7%9a%84execl%e5%8f%82%e6%95%b0%e7%ae%80%e5%8d%95%e8%af%b4%e6%98%8e%e3%80%82","status":"publish","type":"post","link":"https:\/\/blog.jishuge.cn\/?p=121","title":{"rendered":"\u5173\u4e8eLinux\u7f16\u7a0b\u4e2d\u7684execl\u53c2\u6570\u7b80\u5355\u8bf4\u660e\u3002"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    int execl(const char *pathname, const char *arg, ... \/* (char  *) NULL *\/);\n    int execlp(const char *file, const char *arg, ... \/* (char  *) NULL *\/);<\/pre>\n\n\n\n<p>\u4ee5\u4e0a\u662f\u4eceman\u624b\u518c\u4e2d\u590d\u5236\u4e0b\u6765\u7684\u3002\u4ee5\u4e0b\u6211\u4eec\u8fdb\u884c\u5206\u6790\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">execl<\/h3>\n\n\n\n<p>\u6bd4\u5982\u6211\u4eec\u4f7f\u7528execl\u6267\u884cls\u8fdb\u7a0b\uff0c\u90a3\u4e48\u53ef\u4ee5\u5199\u6210\u8fd9\u6837\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">execlp(\"\/bin\/ls\",\"ls\",\"-al\",\"\/temp\",NULL);<\/pre>\n\n\n\n<p>\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c31\u662fls\u547d\u4ee4\u7684\u7edd\u5bf9\u8def\u5f84\uff0c<\/p>\n\n\n\n<p>\u7b2c\u4e8c\u4e2a\u53c2\u6570\u5c31\u662f\u8fdb\u7a0b\u7684\u540d\u79f0\uff0c\u8fd9\u4e2a\u540d\u5b57\u53ef\u4ee5\u586b\u5199\u4e5f\u53ef\u4ee5\u4e0d\u586b\u5199\uff0c\u751a\u81f3\u53ef\u4ee5\u968f\u4fbf\u586b\u5199\uff0c\u4f60\u586b\u5199\u4ec0\u4e48\uff0c\u5230\u65f6\u5019\u5728ps\u4e2d\u5c31\u53ef\u4ee5\u663e\u793a\u8fd9\u4e2a\u8fdb\u7a0b\u7684\u540d\u79f0\uff0c\u6bd4\u5982\u4f60\u586b\u5199\u6210LinuxC123\uff0c\u90a3\u4e48\u5728ps\u4e2d\u53ef\u4ee5\u67e5\u770b\u5230\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bat\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND\njishuge     5794  0.0  0.0   2772  1280 pts\/0    S    10:32   0:00 LinuxC123<\/pre>\n\n\n\n<p>\u5269\u4f59\u7684\u53c2\u6570\u5c31\u662f\u547d\u4ee4\u7684\u9009\u9879\u3002<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4e00\u5b9a\u662fNULL<\/mark><\/strong>\u3002\u6587\u6863\u89c4\u5b9a\u7684\uff1a<\/p>\n\n\n\n<p><em>The const char *arg and subsequent ellipses can be thought of as arg0, arg1, \u2026, argn. To\u2010<br>gether they describe a list of one or more pointers to null-terminated strings that represent<br>the argument list available to the executed program. The first argument, by convention, should<br>point to the filename associated with the file being executed. The list of arguments must be<br>terminated by a null pointer, and, since these are variadic functions, this pointer must be<br>cast (char *) NULL.<\/em><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0a\u662f\u4eceman\u624b\u518c\u4e2d\u590d\u5236\u4e0b\u6765\u7684\u3002\u4ee5\u4e0b\u6211\u4eec\u8fdb\u884c\u5206\u6790\u3002 execl \u6bd4\u5982\u6211\u4eec\u4f7f\u7528execl\u6267\u884cls\u8fdb\u7a0b\uff0c\u90a3\u4e48\u53ef\u4ee5\u5199 &hellip; <a href=\"https:\/\/blog.jishuge.cn\/?p=121\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u5173\u4e8eLinux\u7f16\u7a0b\u4e2d\u7684execl\u53c2\u6570\u7b80\u5355\u8bf4\u660e\u3002<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=121"}],"version-history":[{"count":1,"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":122,"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions\/122"}],"wp:attachment":[{"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jishuge.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}