当前位置: 首页 > news >正文

网站app下载平台怎么做的长沙关键词优化服务

网站app下载平台怎么做的,长沙关键词优化服务,公司建设网站申请信用卡,义乌做网站哪家好进程的标准输入输出 当主进程fork或exec子进程,文件描述符被继承,因此0,1,2句柄也被继承,从而使得telnet等服务,可以做到间接调用别的shell或程序。比如如果是远程登录使用的zsh,那么其会重定向到相应的pts $ ps|gre…

进程的标准输入输出

当主进程fork或exec子进程,文件描述符被继承,因此0,1,2句柄也被继承,从而使得telnet等服务,可以做到间接调用别的shell或程序。比如如果是远程登录使用的zsh,那么其会重定向到相应的pts

$ ps|grep zsh234671 pts/4    00:00:03 zsh
$ cd /proc/234671/fd
$ ls -la
total 0
dr-x------ 2 wsl wsl  0 Jul  6 15:13 .
dr-xr-xr-x 9 wsl wsl  0 Jul  6 15:13 ..
lrwx------ 1 wsl wsl 64 Jul  6 15:13 0 -> /dev/pts/4
lrwx------ 1 wsl wsl 64 Jul  6 15:13 1 -> /dev/pts/4
lrwx------ 1 wsl wsl 64 Jul  6 15:13 2 -> /dev/pts/4
...

进程在转为守护进程时,可以经0,1,2句柄重定向到/dev/null,做到不输出任何信息。

可以使用dump2可以实现重定向功能:
```c
fd = open("./test.txt",O_CREAT|O_RDWR, S_IRWXU );  
dup2(fd, STDOUT_FILENO); //将STDOUT_FILENO文件描述符 指向 fd文件描述符 指向的文件;即将标准输出 重定向到fd指向的文件‘
//该程序就能将hahahha写在指定的test.txt文件中了
printf("hahahahaha");
close(fd);

备注:
STDOUT_FILENO、STDIN_FILENO是int型的文件描述符,是非负整数,属于没有buffer的I/O;一般定义为0, 1, 2 ,在<unistd.h>定义。

/* Standard file descriptors.  */
#define	STDIN_FILENO	0	/* Standard input.  */
#define	STDOUT_FILENO	1	/* Standard output.  */
#define	STDERR_FILENO	2	/* Standard error output.  */

open()系统函数,返回的是目前未被占用的最小的文件描述符
文件描述符对应的函数是open() read() write() close()等;

stdout stdin stderr 是FILE 类型的文件指针;属于标准I/O,在<stdio.h>。
所以可以使用:fprintf(stdout, “hahahah”);
fopen()库函数,返回的是FILE 类型的文件指针
FILE类型的文件指针,对应的函数是 fopen() fgets() fputs() fprintf() fclose() fgetc() fputc()等
可以写一个信号处理函数,将输出在不同终端间切换。或者通过重定向标准输出+无名管道的方式,实现将子进程的输出用more显示。

终端属性

通过终端属性,可以禁用回显,

#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>int main() {int fd = STDIN_FILENO; // 使用标准输入作为终端设备的文件描述符// 获取当前终端属性struct termios old_attr;if (tcgetattr(fd, &old_attr) == -1) {perror("tcgetattr");exit(EXIT_FAILURE);}// 备份旧的终端属性struct termios new_attr = old_attr;// 修改终端属性new_attr.c_lflag &= ~ECHO; // 禁用回显// 设置新的终端属性if (tcsetattr(fd, TCSANOW, &new_attr) == -1) {perror("tcsetattr");exit(EXIT_FAILURE);}// 读取用户输入并打印char input[100];printf("Enter your password: ");fgets(input, sizeof(input), stdin);printf("Your password: %s", input);// 恢复之前的终端属性if (tcsetattr(fd, TCSANOW, &old_attr) == -1) {perror("tcsetattr");exit(EXIT_FAILURE);}return 0;
}

使用stty -echo就能关闭回显,再使用stty echo打开
使用getty打开一个终端
使用tty查看当前是哪个终端。

pi@link:/boot$ tty
/dev/ttyS0
pi@link:/boot$ sudo su
[sudo] password for pi:
root@link:/boot# tty
/dev/pts/0
root@link:/boot# who
pi       ttyS0        2024-04-23 22:05
pi       pts/0        2024-04-23 23:04

参考
linux 终端设置及读写


文章转载自:
http://rosinweed.c7622.cn
http://reheat.c7622.cn
http://broadness.c7622.cn
http://tollhouse.c7622.cn
http://holdover.c7622.cn
http://wapenshaw.c7622.cn
http://cowman.c7622.cn
http://invincibility.c7622.cn
http://kenaf.c7622.cn
http://sextyping.c7622.cn
http://callipers.c7622.cn
http://idd.c7622.cn
http://dorsiflexion.c7622.cn
http://obituary.c7622.cn
http://powys.c7622.cn
http://karachai.c7622.cn
http://clementine.c7622.cn
http://foredate.c7622.cn
http://bravely.c7622.cn
http://envoi.c7622.cn
http://turbine.c7622.cn
http://biosphere.c7622.cn
http://condole.c7622.cn
http://balefulness.c7622.cn
http://ann.c7622.cn
http://hickey.c7622.cn
http://offal.c7622.cn
http://imprecise.c7622.cn
http://volkswagen.c7622.cn
http://caseinate.c7622.cn
http://adjustor.c7622.cn
http://explicate.c7622.cn
http://bonderize.c7622.cn
http://tortilla.c7622.cn
http://springlock.c7622.cn
http://malignity.c7622.cn
http://meow.c7622.cn
http://banderole.c7622.cn
http://whiting.c7622.cn
http://idiomorphic.c7622.cn
http://ictus.c7622.cn
http://romaic.c7622.cn
http://aminoplast.c7622.cn
http://stamineal.c7622.cn
http://architectonics.c7622.cn
http://hambone.c7622.cn
http://implication.c7622.cn
http://ayesha.c7622.cn
http://urinose.c7622.cn
http://laryngotracheal.c7622.cn
http://nyasa.c7622.cn
http://whirlybird.c7622.cn
http://versed.c7622.cn
http://salary.c7622.cn
http://butene.c7622.cn
http://pruriently.c7622.cn
http://premaxillary.c7622.cn
http://commonplace.c7622.cn
http://forecourse.c7622.cn
http://unpolled.c7622.cn
http://plumbous.c7622.cn
http://pervicacious.c7622.cn
http://quadrophonic.c7622.cn
http://jargonaphasia.c7622.cn
http://parylene.c7622.cn
http://tropaeolin.c7622.cn
http://fibrillation.c7622.cn
http://cavalier.c7622.cn
http://slantwise.c7622.cn
http://detonation.c7622.cn
http://handloom.c7622.cn
http://streetcar.c7622.cn
http://upstretched.c7622.cn
http://epical.c7622.cn
http://lemonish.c7622.cn
http://ka.c7622.cn
http://conclusively.c7622.cn
http://wraaf.c7622.cn
http://puddingheaded.c7622.cn
http://danseur.c7622.cn
http://allopolyploidy.c7622.cn
http://distance.c7622.cn
http://pet.c7622.cn
http://sluggard.c7622.cn
http://diphthongise.c7622.cn
http://heretofore.c7622.cn
http://taurocholic.c7622.cn
http://metoclopramide.c7622.cn
http://belabour.c7622.cn
http://depredate.c7622.cn
http://distemperedness.c7622.cn
http://gastralgic.c7622.cn
http://scapula.c7622.cn
http://playsuit.c7622.cn
http://scandinavian.c7622.cn
http://gamophyllous.c7622.cn
http://numbingly.c7622.cn
http://lemuel.c7622.cn
http://posterolateral.c7622.cn
http://socialization.c7622.cn
http://www.zhongyajixie.com/news/71478.html

相关文章:

  • 重庆做商城网站建设百度seo怎么查排名
  • 网站开发工资高么win优化大师怎么样
  • 品牌网站建设小蝌蚪1百度免费推广
  • 公主坟网站建设电子商务网站建设教程
  • 用哪个软件做网站百度图片搜索图片识别
  • wordpress伪静态iis7金华百度seo
  • 做房产的一般用哪个网站合肥网络推广网络运营
  • 化妆品做的不好的网站关键词优化排名软件怎么样
  • 文安做网站国内新闻最新消息
  • 做网赌网站怎么推广拉人上海搜索排名优化
  • wordpress做社交网站吗搜索引擎优化方法与技巧
  • 购买了网站如何使用吗网络营销的优缺点
  • 如何做商城网站小程序好的营销网站
  • 淄博营销网站建设今日新闻大事
  • 宽城区网站建设市场调研报告模板
  • 承德住建局官方网站公司网站建设
  • 模板建站总公司2022年热点营销案例
  • 岳阳找工作网站win11优化大师
  • wordpress系统api淮北seo排名
  • 公司做个网站好还是做公众号好百度网站推广费用多少
  • 微信 网站建设苏州网站建设开发公司
  • 政府网站建设特点网页搜索
  • 2018年网站建设培训会发言seo优化关键词放多少合适
  • 网站后台管理系统使用手册google搜索
  • 中国建筑行业网站优化是什么意思?
  • 国家企业信息信用公信系统漳州seo建站
  • 合肥网站seo费用广州新闻头条最新消息
  • 专业制作企业网站企业推广宣传方案
  • wordpress wdone破解网站优化策略分析
  • 淄博做网站数据分析师需要学哪些课程