-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1084 lines (700 loc) · 68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.3.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha256-/4UQcSmErDzPCMAiuOiWPVVsNN2s3ZY/NsmXNcj0IFc=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.15.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"Searching...","empty":"We didn't find any results for the search: ${query}","hits_time":"${hits} results found in ${time} ms","hits":"${hits} results found"}}</script><script src="/js/config.js"></script>
<meta property="og:type" content="website">
<meta property="og:title" content="Lez的技术博客">
<meta property="og:url" content="http://example.com/index.html">
<meta property="og:site_name" content="Lez的技术博客">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="Lez">
<meta name="twitter:card" content="summary">
<link rel="canonical" href="http://example.com/">
<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":true,"isPost":false,"lang":"zh-cn","comments":"","permalink":"","path":"index.html","title":""}</script>
<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Lez的技术博客</title>
<noscript>
<link rel="stylesheet" href="/css/noscript.css">
</noscript>
</head>
<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
<div class="headband"></div>
<main class="main">
<div class="column">
<header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
<div class="site-nav-toggle">
<div class="toggle" aria-label="Toggle navigation bar" role="button">
</div>
</div>
<div class="site-meta">
<a href="/" class="brand" rel="start">
<i class="logo-line"></i>
<h1 class="site-title">Lez的技术博客</h1>
<i class="logo-line"></i>
</a>
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger" aria-label="Search" role="button">
</div>
</div>
</div>
</header>
<aside class="sidebar">
<div class="sidebar-inner sidebar-overview-active">
<ul class="sidebar-nav">
<li class="sidebar-nav-toc">
Table of Contents
</li>
<li class="sidebar-nav-overview">
Overview
</li>
</ul>
<div class="sidebar-panel-container">
<!--noindex-->
<div class="post-toc-wrap sidebar-panel">
</div>
<!--/noindex-->
<div class="site-overview-wrap sidebar-panel">
<div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
<p class="site-author-name" itemprop="name">Lez</p>
<div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap animated">
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">28</span>
<span class="site-state-item-name">posts</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<span class="site-state-item-count">5</span>
<span class="site-state-item-name">categories</span>
</div>
</nav>
</div>
</div>
</div>
</div>
</aside>
</div>
<div class="main-inner index posts-expand">
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/06/22/Perforce%E4%BD%BF%E7%94%A8/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/06/22/Perforce%E4%BD%BF%E7%94%A8/" class="post-title-link" itemprop="url">Perforce使用</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-06-22 16:07:12 / Modified: 17:47:22" itemprop="dateCreated datePublished" datetime="2023-06-22T16:07:12+08:00">2023-06-22</time>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a><a target="_blank" rel="noopener" href="https://www.perforce.com/products/helix-core/install-helix-core-server-client#tab-panel-43016">安装</a></h2><p>安装后会自动配好环境变量 p4v是图形化客户端, p4是命令行,wincmd 直接执行p4应该有输出。<br>windows 默认安装位置在这里 C:\Program Files\Perforce<br>p4的命令很多,这里只讲最重要的几项</p>
<h2 id="登录:"><a href="#登录:" class="headerlink" title="登录:"></a>登录:</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line">p4 -u your_user_name login -h remote_address:port <span class="comment"># 登录</span></span><br><span class="line"></span><br><span class="line">p4 client -S //JamCode/main/... //workspacename/... [workspacename] </span><br><span class="line"><span class="string">''</span><span class="string">'</span></span><br><span class="line"><span class="string">映射工作区 -S 指 stream 就是远程分支的路径一般都以//开始 workspace是工作区的名字,这一项可选,但最好赋予一个你能记住的名字,</span></span><br><span class="line"><span class="string">Windows 注意要修改根目录,这个根目录的位置由你自己决定, </span></span><br><span class="line"><span class="string">比如盘符:\子文件夹1\子文件夹2 这个位置可以任意指定</span></span><br><span class="line"><span class="string">也可以映射多个服务器的目录到一个工作区内</span></span><br><span class="line"><span class="string">'</span><span class="string">''</span></span><br><span class="line"><span class="comment">#To map the same server directory to more than one client workspace directory, use the & sign.</span></span><br><span class="line">//depot/... //bruno-client/... </span><br><span class="line">&//depot/and/tools/... //workspacename/and/utility1/... </span><br><span class="line">&//depot/and/tools/... //workspacename/and/utility2/...</span><br><span class="line"></span><br><span class="line">To specify a workspace on Windows that spans multiple drives, use a `Root:` of `null`, and specify the drive letters <span class="keyword">in</span> the workspace view. For instance, the following workspace spec with a `null` root maps `//depot/main/...` to an area of the `C:` drive, and other releases to the `D:` drive:</span><br><span class="line"></span><br><span class="line"><span class="string">''</span><span class="string">' 这个windows下一个工作空间对应多个映射的例子值得看看'</span><span class="string">''</span></span><br><span class="line">Client: eds_win</span><br><span class="line">Owner: edk</span><br><span class="line">Description:</span><br><span class="line"> Ed<span class="string">'s Windows Workspace</span></span><br><span class="line"><span class="string">Root: null</span></span><br><span class="line"><span class="string">Options: nomodtime noclobber</span></span><br><span class="line"><span class="string">SubmitOptions: submitunchanged</span></span><br><span class="line"><span class="string">View:</span></span><br><span class="line"><span class="string"> //depot/main/... "//eds_win/c:/Current Release/..."</span></span><br><span class="line"><span class="string"> //depot/rel1.0/... //eds_win/d:/old/rel1.0/...</span></span><br><span class="line"><span class="string"> //depot/rel2.0/... //eds_win/d:/old/rel2.0/...</span></span><br></pre></td></tr></table></figure>
<h2 id="配置目录内的环境变量"><a href="#配置目录内的环境变量" class="headerlink" title="配置目录内的环境变量"></a>配置目录内的环境变量</h2><p>在你的工作区目录建立一个p4config.txt 比如 我这里使用 G:\Game1<br>这样我在这个文件夹内使用p4 命令时会自动读取这个位置文件内的环境变量,比较方便。而且这个环境变量不是全局的,仅在这个目录生效。</p>
<figure class="highlight txt"><figcaption><span>p4config.txt</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">P4USER=your_user_name</span><br><span class="line">P4HOST=your_computer_name</span><br><span class="line">P4CLIENT=your_workspace_name</span><br></pre></td></tr></table></figure>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">p4 sync <span class="comment">#同步到本地</span></span><br></pre></td></tr></table></figure>
<p>p4和git还是有很大区别的。文件不检出就只能以只读形式打开。签出后即可你的工作区删改。<br><a target="_blank" rel="noopener" href="https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_edit.html">P4命令</a></p>
<h2 id="概念剖析"><a href="#概念剖析" class="headerlink" title="概念剖析"></a>概念剖析</h2><p>下文中的工作空间和客户端是同一含义,故不再做区分。<br>这个是我用super用户在服务端上显示工作空间的输出,用其他用户也能查询这个信息。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[root@lucid-node-2 ~]# p4 clients</span><br><span class="line">Client Crpg_TJ 2022/06/22 root J:\Unreal Projects\Crpg_TJ 'Created by liyi. '</span><br><span class="line">Client Crpg_game_luhao 2022/06/19 root G:\Crpg_demo 'Created by luhao. '</span><br><span class="line">Client DevBranch 2022/06/22 root /Users/lezhou/Perforce/DevBranch 'Created by zhoule. '</span><br><span class="line">Client G:\GameProject\ 2023/06/21 root c:\Users\win10\.cargo\bin 'Created by zuojiaqi. '</span><br><span class="line">Client Nemesis 2023/06/21 root c:\Users\win10\.cargo\bin 'Created by zuojiaqi. '</span><br><span class="line">Client luhao_tvpn_1299 2022/06/24 root D:\Crpg_TJ_demo 'Created by luhao. '</span><br><span class="line">Client luhao_tvpn_2932 2022/06/19 root D:\Crpg_game 'Created by luhao. '</span><br><span class="line">Client luhao_tvpn_950 2022/06/24 root D:\Crpg_TJ_demo 'Created by luhao. '</span><br><span class="line">Client yuanrui_tvpn_275 2023/06/17 root D:\PerForceProject 'Created by yuanrui. '</span><br><span class="line">Client yuanrui_tvpn_3145 2023/06/19 root D:\yuanrui_tvpn_3145 'Created by yuanrui. '</span><br></pre></td></tr></table></figure>
<p>这两组命令的含义是等价的</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">p4 clients/workspaces #列出全部工作空间</span><br><span class="line">p4 client/workspace # 配置我的工作空间</span><br></pre></td></tr></table></figure>
<p>Client后每一项的含义:<br>|名字(工作空间的)| 创建时间 | 根位置(根位置就是本地路径)| 创建者<br>这是在客户端使用p4 client 映射本地工作空间的输出。<br>值得注意的是Root Stream还有StreamView三项</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br></pre></td><td class="code"><pre><span class="line">> p4 client -S //JamCode/main bugfree</span><br><span class="line"></span><br><span class="line"><span class="string">''</span><span class="string">'</span></span><br><span class="line"><span class="string"># A Perforce Client Specification.</span></span><br><span class="line"><span class="string">#</span></span><br><span class="line"><span class="string"># Client: The client name.</span></span><br><span class="line"><span class="string"># Update: The date this specification was last modified.</span></span><br><span class="line"><span class="string"># Access: The date this client was last used in any way.</span></span><br><span class="line"><span class="string"># Owner: The Perforce user name of the user who owns the client</span></span><br><span class="line"><span class="string"># workspace. The default is the user who created the</span></span><br><span class="line"><span class="string"># client workspace.</span></span><br><span class="line"><span class="string"># Host: If set, restricts access to the named host.</span></span><br><span class="line"><span class="string"># Description: A short description of the client (optional).</span></span><br><span class="line"><span class="string"># Root: The base directory of the client workspace.</span></span><br><span class="line"><span class="string"># AltRoots: Up to two alternate client workspace roots.</span></span><br><span class="line"><span class="string"># Options: Client options:</span></span><br><span class="line"><span class="string"># [no]allwrite [no]clobber [no]compress</span></span><br><span class="line"><span class="string"># [un]locked [no]modtime [no]rmdir</span></span><br><span class="line"><span class="string"># SubmitOptions:</span></span><br><span class="line"><span class="string"># submitunchanged/submitunchanged+reopen</span></span><br><span class="line"><span class="string"># revertunchanged/revertunchanged+reopen</span></span><br><span class="line"><span class="string"># leaveunchanged/leaveunchanged+reopen</span></span><br><span class="line"><span class="string"># LineEnd: Text file line endings on client: local/unix/mac/win/share.</span></span><br><span class="line"><span class="string"># Type: Type of client: writeable/readonly/graph/partitioned.</span></span><br><span class="line"><span class="string"># ServerID: If set, restricts access to the named server.</span></span><br><span class="line"><span class="string"># View: Lines to map depot files into the client workspace.</span></span><br><span class="line"><span class="string"># ChangeView: Lines to restrict depot files to specific changelists.</span></span><br><span class="line"><span class="string"># Stream: The stream to which this client'</span>s view will be dedicated.</span><br><span class="line"><span class="comment"># (Files in stream paths can be submitted only by dedicated</span></span><br><span class="line"><span class="comment"># stream clients.) When this optional field is set, the</span></span><br><span class="line"><span class="comment"># View field will be automatically replaced by a stream</span></span><br><span class="line"><span class="comment"># view as the client spec is saved.</span></span><br><span class="line"><span class="comment"># StreamAtChange: A changelist number that sets a back-in-time view of a</span></span><br><span class="line"><span class="comment"># stream ( Stream field is required ).</span></span><br><span class="line"><span class="comment"># Changes cannot be submitted when this field is set.</span></span><br><span class="line"><span class="comment">#</span></span><br><span class="line"><span class="comment"># Use 'p4 help client' to see more about client views and options.</span></span><br><span class="line"><span class="string">''</span><span class="string">'</span></span><br><span class="line"><span class="string">Client: bugfree </span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Update: 2023/06/21 21:09:52</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Access: 2023/06/21 21:09:32</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Owner: zuojiaqi</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Host: Nemesis 主机名也很重要,你在哪个主机上用哪个用户打开的这个工作区是受到限制的</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Description:</span></span><br><span class="line"><span class="string"> Created by zuojiaqi.</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Root: G:\GameProject</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Options: noallwrite noclobber nocompress unlocked nomodtime normdir</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">SubmitOptions: submitunchanged</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">LineEnd: local</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Stream: //JamCode/main</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">View:</span></span><br><span class="line"><span class="string"> //JamCode/main/... //bugfree/...</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br></pre></td></tr></table></figure>
<p><a target="_blank" rel="noopener" href="https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_client.html#p4_client">p4client详细阅读</a></p>
<h2 id="忽略文件"><a href="#忽略文件" class="headerlink" title="忽略文件"></a>忽略文件</h2><p>项目路径下添加.p4ignore.txt去掉中间目录和debug信息。UE4编译时生成的中间文件是不需要用vcs跟踪的。<br><a target="_blank" rel="noopener" href="https://hastebin.com/share/vuyegesisa.markdown">抄来的适合UE的ignorefile</a>可直接打开<br><a target="_blank" rel="noopener" href="https://github.com/sonstraza/Unreal-P4Ignore/blob/main/Perforce%20Ignore%20Guide.pdf">p4ignoreguide</a></p>
<h2 id="凭据"><a href="#凭据" class="headerlink" title="凭据"></a>凭据</h2><p>p4ticket有效时限12小时,这个应该可以在服务器侧更改。同时这个用户管理也可以和LDAP集成。</p>
<h2 id="常用命令"><a href="#常用命令" class="headerlink" title="常用命令"></a>常用命令</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">p4 add/ delete 增加删除</span><br><span class="line">p4 edit filename 编辑文件/ 签出并编辑</span><br><span class="line">p4 shelve -c changelist_number # 对未提交的changelist在服务器端创建一个shelve区,允许其他人对这个shelve的变更引用到他们的工作区</span><br><span class="line">p4 changelist -d "变更描述"</span><br><span class="line">add/edit /delete 都反应在一个changelist中</span><br><span class="line">p4 submit -c changelist_number</span><br><span class="line">p4 revert</span><br></pre></td></tr></table></figure>
<h2 id="UE-引擎如何配置P4为VCS"><a href="#UE-引擎如何配置P4为VCS" class="headerlink" title="UE 引擎如何配置P4为VCS"></a>UE 引擎如何配置P4为VCS</h2><p><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/547763516">补充阅读</a></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/06/21/linux/%E6%A0%91%E8%8E%93%E6%B4%BE%E6%89%93%E9%80%A0%E6%95%B0%E5%AD%97%E6%92%AD%E6%94%BE%E5%99%A8/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/06/21/linux/%E6%A0%91%E8%8E%93%E6%B4%BE%E6%89%93%E9%80%A0%E6%95%B0%E5%AD%97%E6%92%AD%E6%94%BE%E5%99%A8/" class="post-title-link" itemprop="url">树莓派打造数字播放器</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-06-21 18:07:18" itemprop="dateCreated datePublished" datetime="2023-06-21T18:07:18+08:00">2023-06-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2023-06-22 17:04:24" itemprop="dateModified" datetime="2023-06-22T17:04:24+08:00">2023-06-22</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>树莓派上安装特定的Volumio/<a target="_blank" rel="noopener" href="https://moodeaudio.org/">moodeaudio</a><br>/<a target="_blank" rel="noopener" href="https://www.runeaudio.com/documentation/quick-start/rpi-hardware-setup/">RuneAudio</a>/<a target="_blank" rel="noopener" href="https://github.com/rern/rAudio">rAudio</a><br>不同的系统对I2C DAC的支持不同<br>用官方的镜像烧录P Imager<br><a target="_blank" rel="noopener" href="https://www.raspberrypi.com/software/">https://www.raspberrypi.com/software/</a><br>烧录系统镜像到SD卡上<br><a target="_blank" rel="noopener" href="https://volumio.github.io/docs/User_Manual/Quick_Start_Guide">https://volumio.github.io/docs/User_Manual/Quick_Start_Guide</a><br><a target="_blank" rel="noopener" href="https://moodeaudio.org/">https://moodeaudio.org/</a><br>安装spotify插件 (spotify 客户端)<br>moode Raspotify</p>
<p>接外置DAC输出模拟信号接音箱/耳机<br>移动端APP/网页实现远程控制</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/06/21/rust%20language/%E4%BB%8Eterminal%20case%20of%20linux%E5%AD%A6%E5%88%B0%E7%9A%84/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/06/21/rust%20language/%E4%BB%8Eterminal%20case%20of%20linux%E5%AD%A6%E5%88%B0%E7%9A%84/" class="post-title-link" itemprop="url">从terminal case of linux学到的</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-06-21 18:07:12 / Modified: 18:11:36" itemprop="dateCreated datePublished" datetime="2023-06-21T18:07:12+08:00">2023-06-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/rust-language/" itemprop="url" rel="index"><span itemprop="name">rust language</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>伪终端的概念<br>cat /pts/number 也是文件,可以读也可以写</p>
<p>在rust种如果使用std::process:Command来创建子进程执行ls –color=auto会丢失颜色。带着这个疑问找到<br><a target="_blank" rel="noopener" href="https://github.com/coreutils/coreutils">coreutils</a>查看ls.c源码</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">isatty() <span class="comment">// 通过文件描述符来判断输出是否是一个终端,缓存结果</span></span><br><span class="line">ttyname()</span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">ldd ./target/debug/termius</span><br><span class="line">output:</span><br><span class="line">...</span><br><span class="line">...</span><br><span class="line">libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4e15065000)</span><br><span class="line">...</span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">nm -D /lib/x86_64-linux-gnu/libc.so.6 |grep -E 'isatty|ttyname'</span><br><span class="line">output:</span><br><span class="line">00000000001324d0 T __ttyname_r_chk</span><br><span class="line">0000000000112cc0 W isatty</span><br><span class="line">0000000000112580 T ttyname</span><br><span class="line">0000000000112900 W ttyname_r</span><br></pre></td></tr></table></figure>
<figure class="highlight rust"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">extern</span> <span class="string">"C"</span> { <span class="keyword">fn</span> <span class="title function_">isatty</span>(fd: c_int) <span class="punctuation">-></span> c_int;}</span><br><span class="line"><span class="keyword">let</span> <span class="variable">stdout_istty</span> = <span class="keyword">unsafe</span> { <span class="title function_ invoke__">isatty</span>(<span class="number">1</span>) };</span><br></pre></td></tr></table></figure>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">$</span><span class="language-bash">./target/debug/terminus <span class="built_in">tty</span> == <span class="literal">true</span></span></span><br><span class="line"><span class="meta prompt_">$</span><span class="language-bash">./target/debug/terminus | <span class="built_in">cat</span> <span class="built_in">tty</span> == <span class="literal">false</span></span></span><br></pre></td></tr></table></figure>
<p>这里涉及知识可以看APUE管道<br>通过strace观察其实就是执行了ioctl</p>
<p><a target="_blank" rel="noopener" href="https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/ioctls.h">为什么是0x5401</a></p>
<figure class="highlight rust"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> TCGETS: <span class="type">u64</span> = <span class="number">0x5401</span>;</span><br><span class="line"><span class="keyword">const</span> buffer: <span class="type">usize</span> = <span class="number">32</span> * <span class="number">1024</span>;</span><br><span class="line"><span class="keyword">let</span> <span class="keyword">mut </span><span class="variable">mysterious_buffer</span> = <span class="built_in">vec!</span>[<span class="number">0u8</span>; buffer];</span><br><span class="line"><span class="keyword">let</span> <span class="variable">ret</span> = <span class="keyword">unsafe</span> { <span class="title function_ invoke__">ioctl</span>(<span class="number">1</span>, TCGETS, mysterious_buffer)}</span><br><span class="line"></span><br><span class="line"><span class="comment">// 手搓 isatty</span></span><br><span class="line"><span class="keyword">unsafe</span> <span class="keyword">fn</span> <span class="title function_">ioctl</span>(fd: <span class="type">u64</span>, cmd: <span class="type">u64</span>, arg: *<span class="keyword">mut</span> <span class="type">u8</span>) <span class="punctuation">-></span> <span class="type">i64</span> {</span><br><span class="line"><span class="keyword">let</span> <span class="variable">syscal_no</span>:<span class="type">u64</span> =<span class="number">16</span>;</span><br><span class="line"><span class="keyword">let</span> <span class="variable">ret</span>: <span class="type">u64</span>;</span><br><span class="line">asm!(</span><br><span class="line"><span class="string">"syscall"</span>,</span><br><span class="line"><span class="title function_ invoke__">inout</span>(<span class="string">"rax"</span>) syscall_no => ret,</span><br><span class="line"><span class="title function_ invoke__">in</span>(<span class="string">"rdi"</span>) fd,</span><br><span class="line"><span class="title function_ invoke__">in</span>(<span class="string">"rsi"</span>) cmd,</span><br><span class="line"><span class="title function_ invoke__">in</span>(<span class="string">"rdx"</span>) arg,</span><br><span class="line"><span class="title function_ invoke__">lateout</span>(<span class="string">"rcx"</span>) _, <span class="title function_ invoke__">lateout</span>(<span class="string">"r11"</span>) _,</span><br><span class="line"><span class="title function_ invoke__">options</span>(nostack)</span><br><span class="line">);</span><br><span class="line">ret <span class="keyword">as</span> <span class="type">i64</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<p>生成终端</p>
<figure class="highlight rust"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">unsafe</span> { <span class="keyword">let</span> <span class="variable">ret</span> = libc::<span class="title function_ invoke__">openpty</span>(</span><br><span class="line"> &<span class="keyword">mut</span> fd1, </span><br><span class="line"> &<span class="keyword">mut</span> fd2, </span><br><span class="line"> std::ptr::<span class="title function_ invoke__">null_mut</span>(), </span><br><span class="line"> std::ptr::<span class="title function_ invoke__">null</span>(), </span><br><span class="line"> std::ptr::<span class="title function_ invoke__">null</span>()) };</span><br></pre></td></tr></table></figure>
<p>ls 需要是controlling terminal 才可以,fork 会返回两次,一次是主进程,一次是子进程。我们必须在exec之前执行 login_tty才可以。 posix_spawn有一个get_closures</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/06/21/linux/Linux%E5%A4%84%E7%90%86%E9%A1%B5%E9%94%99%E8%AF%AF/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/06/21/linux/Linux%E5%A4%84%E7%90%86%E9%A1%B5%E9%94%99%E8%AF%AF/" class="post-title-link" itemprop="url">处理页错误的细节</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-06-21 18:06:01 / Modified: 18:13:11" itemprop="dateCreated datePublished" datetime="2023-06-21T18:06:01+08:00">2023-06-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>Page fault不是软中断,而是一种硬件中断。下面是一些理由:</p>
<ol>
<li><p>触发机制:Page fault是由CPU硬件自动触发的,而不是通过软件指令主动引发的。当程序尝试访问不在物理内存中的页面时,CPU会检测到这一情况并引发page fault中断。</p>
</li>
<li><p>引发原因:Page fault的引发原因是在虚拟内存管理中发生了页面缺失(page not present)或访问权限违规等情况,而不是由于应用程序需要操作系统服务而显式触发的。</p>
</li>
<li><p>处理过程:Page fault的处理涉及到操作系统内核的底层页面管理机制,包括查找、分配和加载页面等操作。与软中断处理相比,page fault的处理过程更加复杂,并且涉及到操作系统内核的核心功能。</p>
</li>
</ol>
<p>虽然page fault与软中断在某种程度上都涉及中断处理和操作系统的干预,但它们的触发方式、引发原因和处理过程有着显著的区别。因此,page fault通常被认为是一种硬件中断,而不是软中断</p>
<p>Handling page faults in the Linux kernel involves several low-level details. Here’s a more in-depth explanation of the process:</p>
<ol>
<li><p>Interrupt Handling: When a page fault occurs, the processor generates an interrupt, typically an “interrupt 14” or “interrupt 0xE.” This interrupt triggers the execution of the kernel’s page fault handler.</p>
</li>
<li><p>Exception Stacking: The processor pushes the current execution context, including the program counter and other registers, onto the kernel stack. This saves the state of the interrupted program for later resumption.</p>
</li>
<li><p>Page Fault Handler Invocation: The kernel’s page fault handler is invoked, usually through a specific interrupt vector or exception handler. It retrieves the faulting memory address from the processor’s registers.</p>
</li>
<li><p>Virtual Memory Lookup: The page fault handler begins by examining the faulting address to determine the memory access type (read, write, or execute) and the memory protection settings associated with the page.</p>
</li>
<li><p>Page Table Walk: The kernel uses the page directory and page tables to perform a hierarchical lookup of the virtual address. It traverses these data structures to find the corresponding page table entry (PTE) that maps the virtual address to a physical address or identifies the absence of the page.</p>
</li>
<li><p>Page Fault Reason Determination: Based on the page table entry, the handler determines the reason for the page fault. It could be due to a non-present page, a permission violation, a reserved bit violation, a stack growth, or other specific conditions.</p>
</li>
<li><p>Non-Present Page Handling: If the page is not present in physical memory, the kernel proceeds with the necessary steps to bring it in:</p>
<p>a. Allocate Physical Page: The kernel allocates a physical page frame, typically from a pool of free pages.</p>
<p>b. Disk I/O: If the required page is stored on secondary storage (e.g., swap space), the kernel initiates a disk I/O operation to load the page into the newly allocated physical page frame.</p>
<p>c. Page Table Update: Once the page is successfully loaded, the kernel updates the page table entry to reflect the new mapping between the virtual and physical addresses. It marks the page as present, sets the appropriate permissions, and clears any status flags indicating the absence of the page.</p>
</li>
<li><p>Permission Violation Handling: If the page fault was caused by a permission violation, the kernel checks the access rights specified in the page table entry against the requested operation. If the access is invalid, the kernel raises an appropriate exception (e.g., segmentation fault) to signal the error to the program.</p>
</li>
<li><p>Stack Growth: If the page fault occurred due to stack growth, the kernel allocates a new page for the stack and updates the page table entry accordingly. This allows the program’s stack to expand dynamically.</p>
</li>
<li><p>Exception Return: After handling the page fault, the kernel restores the saved execution context from the kernel stack, including the program counter and registers. Control is then returned to the interrupted program, which can resume execution with the page now accessible in physical memory.</p>
</li>
</ol>
<p>The low-level details can vary depending on the specific architecture and configuration of the Linux system, but this general outline illustrates the core steps involved in handling page faults at a low level in the Linux kernel.</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/06/21/rust%20language/Rust%E6%B2%A1%E6%9C%89%E6%8D%95%E8%8E%B7%E7%9A%84%E4%B8%80%E4%BA%9B%E9%94%99%E8%AF%AF/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/06/21/rust%20language/Rust%E6%B2%A1%E6%9C%89%E6%8D%95%E8%8E%B7%E7%9A%84%E4%B8%80%E4%BA%9B%E9%94%99%E8%AF%AF/" class="post-title-link" itemprop="url">Untitled</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-06-21 08:29:01 / Modified: 18:10:31" itemprop="dateCreated datePublished" datetime="2023-06-21T08:29:01+08:00">2023-06-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/rust-language/" itemprop="url" rel="index"><span itemprop="name">rust language</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/06/07/linux/%E6%A3%80%E6%9F%A5%E5%BF%AB%E6%8D%B7%E9%94%AE%E8%A2%AB%E5%93%AA%E4%B8%AA%E8%BF%9B%E7%A8%8B%E6%8D%95%E8%8E%B7%E7%9A%84%E5%B7%A5%E5%85%B7/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/06/07/linux/%E6%A3%80%E6%9F%A5%E5%BF%AB%E6%8D%B7%E9%94%AE%E8%A2%AB%E5%93%AA%E4%B8%AA%E8%BF%9B%E7%A8%8B%E6%8D%95%E8%8E%B7%E7%9A%84%E5%B7%A5%E5%85%B7/" class="post-title-link" itemprop="url">Untitled</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-06-07 11:15:28" itemprop="dateCreated datePublished" datetime="2023-06-07T11:15:28+08:00">2023-06-07</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2023-06-21 18:10:31" itemprop="dateModified" datetime="2023-06-21T18:10:31+08:00">2023-06-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>Windows下部分快捷键是全局生效的,截屏这个功能很多软件都提供,比如QQ就是用热键ctrl+alt+a来触发截屏功能,<br>今天突然发现失效了,怀疑是其他进程(比QQ客户端)先一步获取到了这个热键,于是查询发现spyxx能排查这一过程。之前在查看窗口对象的时候用过,是Visutal Studio安装时自带的工具,亦可单独下载。<br>排查步骤:<br>打开spy++ 监视选项卡-日志消息-消息选项页的窗口选项卡选择系统中所有窗口->然后点消息-> 全部清除要查看的消息,然后选中WM_HOTKEY 确定后按要探查的快捷键比如(ctrl + alt + a)然后到消息窗口中找到对应的那条日志就可以查看具体捕获这个快捷键的进程。也就定位问题原因了。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/05/28/linux/%E4%BB%8E%E7%A1%AC%E6%A0%B8%E8%AF%BB%E6%96%87%E4%BB%B6%E5%AD%A6%E5%88%B0%E7%9A%84/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/05/28/linux/%E4%BB%8E%E7%A1%AC%E6%A0%B8%E8%AF%BB%E6%96%87%E4%BB%B6%E5%AD%A6%E5%88%B0%E7%9A%84/" class="post-title-link" itemprop="url">从硬核读文件学到的</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-05-28 21:05:00" itemprop="dateCreated datePublished" datetime="2023-05-28T21:05:00+08:00">2023-05-28</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2023-06-21 18:10:31" itemprop="dateModified" datetime="2023-06-21T18:10:31+08:00">2023-06-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>无论是C还是JS或是Rust,任何一种编程语言在使用标准库读取文件的时候都需要系统调用,使用strace跟踪不难发现这一点openat/read/write/fstat/statx/close/mmap/munmap<br><a target="_blank" rel="noopener" href="https://j00ru.vexillium.org/syscalls/nt/64/">Windows X86_64系统调用表</a><br>每个进程的虚拟地址空间都是<strong>独立</strong>的,可执行文件在执行时会通过MMU被部分映射到内存的物理页上以降低执行延迟(如果可执行文件过大,不需要把全部可执行文件映射到物理页)<br>物理页和虚拟页的大小都是4Kib apple silicon 除外,它的页大小是16Kib<br>使用ripgrep 来访问/etc/host发现没有使用read系统调用。而是使用了mmap<br>映射文件到内存时,内核会把前4K大小的文件读取到缓冲区并设置页表,让用户进程能够访问。一旦进程读取超过4K大小的内容,就会触发页错误。<br>用汇编直接调用Linux x86_64 syscall来编程也是如此,Strace只跟踪到系统调用级别。<br>我们使用ftrace</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/04/27/rust%20language/%E5%86%85%E5%AD%98%E5%B8%83%E5%B1%80%E5%92%8Crust%E7%9A%84%E7%89%B9%E7%82%B9/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/04/27/rust%20language/%E5%86%85%E5%AD%98%E5%B8%83%E5%B1%80%E5%92%8Crust%E7%9A%84%E7%89%B9%E7%82%B9/" class="post-title-link" itemprop="url">内存布局和rust的特点</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-04-27 08:05:07" itemprop="dateCreated datePublished" datetime="2023-04-27T08:05:07+08:00">2023-04-27</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2023-06-21 18:10:31" itemprop="dateModified" datetime="2023-06-21T18:10:31+08:00">2023-06-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/rust-language/" itemprop="url" rel="index"><span itemprop="name">rust language</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>主线程栈大小是8MB,其他线程的栈大小是2MB</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/04/20/linux/%E6%9A%B4%E9%9C%B2WSL2%E5%88%B0%E5%B1%80%E5%9F%9F%E7%BD%91/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/04/20/linux/%E6%9A%B4%E9%9C%B2WSL2%E5%88%B0%E5%B1%80%E5%9F%9F%E7%BD%91/" class="post-title-link" itemprop="url">暴露WSL2到局域网</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-04-20 17:05:28 / Modified: 17:09:29" itemprop="dateCreated datePublished" datetime="2023-04-20T17:05:28+08:00">2023-04-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>WSL 侧</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">rpm -qa|grep openssh-server # 查询</span><br><span class="line">sudo dnf install openssh-server # 安装</span><br><span class="line"></span><br><span class="line">(Optional): permit root login # 修改配置</span><br><span class="line">vi /etc/ssh_ssh_config</span><br><span class="line">PermitRootLogin yes </span><br><span class="line">Port xxxx</span><br><span class="line">systemctl restart sshd # 重启生效</span><br></pre></td></tr></table></figure>
<p>Windows 侧</p>
<figure class="highlight powershell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">netsh interface portproxy add v4tov4 listenaddress=<span class="number">0.0</span>.<span class="number">0.0</span> listenport=<span class="variable">$proxy_port</span> connectaddress=<span class="variable">$wsl_ip</span> connectport=<span class="variable">$ssh_port</span> <span class="comment">#port forward</span></span><br><span class="line">netsh advfirewall firewall add rule name=”Open Port <span class="number">2222</span> <span class="keyword">for</span> WSL2” <span class="built_in">dir</span>=<span class="keyword">in</span> action=allow protocol=TCP localport=<span class="number">2222</span> <span class="comment"># open firewall for $proxy_port</span></span><br><span class="line">netsh interface portproxy show v4tov4 <span class="comment"># show command</span></span><br></pre></td></tr></table></figure>
<p>添加公钥到WSL</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ssh-copy-id -i pubkey -p port username@machine</span><br><span class="line"># port 是windows的proxy_port</span><br></pre></td></tr></table></figure>
<p>添加ssh别名</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">Host Ailas</span><br><span class="line">Hostname IPADDR</span><br><span class="line">Port port</span><br><span class="line">User login_user</span><br><span class="line">IdentityFile privatekey</span><br><span class="line"># 保存后 ssh alias 即可</span><br></pre></td></tr></table></figure>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2023/04/20/PL/GCC%E5%92%8CLLVM%E7%9A%84%E5%8C%BA%E5%88%AB/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="Lez">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Lez的技术博客">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="undefined | Lez的技术博客">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2023/04/20/PL/GCC%E5%92%8CLLVM%E7%9A%84%E5%8C%BA%E5%88%AB/" class="post-title-link" itemprop="url">GCC和LLVM的区别</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2023-04-20 17:05:26 / Modified: 17:22:38" itemprop="dateCreated datePublished" datetime="2023-04-20T17:05:26+08:00">2023-04-20</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">In</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/PL/" itemprop="url" rel="index"><span itemprop="name">PL</span></a>
</span>
</span>
</div>
</div>
</header>