我有一个软件归档解决方案,它需要客户端的Windows共享,但我想在Linux主机上通过samba实际存储文件.
这种依赖性要求我有一个Windows前端到我的Linux文件存档.
当我将客户端上的Linux Samba共享映射为驱动器时,我无法"共享"它以供服务器查看.
我也试过制作快捷方式,但没有共享选项
有没有办法创建一个可以共享的Windows文件夹,并且能够将文件写入Samba网络共享?
我是64位架构的新手.你能告诉我64位linux机器中文件映射支持的MAX文件大小吗?我想通过文件映射打开超过20GB的文件,是否可用?
我写了一个示例代码.但是当我在GBSIZE偏移量中获得指针的值时,它会导致总线错误:
unsigned char* pCur = pBegin + GBSIZE;
//pBegin is the pointer returned by mmap
printf("%c",*pCur);
Run Code Online (Sandbox Code Playgroud)
BTW,printf("%c",*pBegin );工作正常.和我的地址大小:38位物理,48位虚拟
这是完整的代码:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
//#define FILEPATH "smallfile"
#define FILEPATH "bigfile"
#define GBSIZE (1024L*1024L*1024L)
#define TBSIZE (1024L*GBSIZE)
#define NUMSIZE (20L * GBSIZE)
//#define NUMSIZE (10)
#define FILESIZE (NUMINTS * sizeof(int))
int main(int argc, char *argv[])
{
int i;
int fd;
unsigned char *pBegin;
fd = open(FILEPATH, O_RDONLY); …Run Code Online (Sandbox Code Playgroud) 更新2:解决了.见下文.
我正在将一个大的txt文件从旧的基于DOS的库程序转换为更有用的格式.我刚开始使用Perl并设法将这样的脚本放在一起:
BEGIN {undef $/; };
open $in, '<', "orig.txt" or die "Can't read old file: $!";
open $out, '>', "mod.txt" or die "Can't write new file: $!";
while( <$in> )
{
$C=s/foo/bar/gm;
print "$C matches replaced.\n"
etc...
print $out $_;
}
close $out;
Run Code Online (Sandbox Code Playgroud)
这是相当快的,但经过一段时间后,我总是得到一个"Out of Memory" - 由于缺少RAM/Swap-Space而导致的错误(我在Win XP上使用2GB的Ram和1.5GB的Swap-File).在看了一下如何处理大文件后,File::Map在我看来这是一个避免这个问题的好方法.但是,我在实施它时遇到了麻烦.这就是我现在所拥有的:
#!perl -w
use strict;
use warnings;
use File::Map qw(map_file);
my $out = 'output.txt';
map_file my $map, 'input.txt', '<';
$map =~ s/foo/bar/gm;
print $out $map;
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误: Modification of a …