.


:




:

































 

 

 

 


Windows, UNIX




, Windows (Win32 Win64), , UNIX/Linux[36] ANSI , .

( , ). ( , ), Windows.

:

().

Windows.

UNIX. .

, .

.

Microsoft Visual C++ , UNIX. , _open , UNIX- open. UNIX , . , UNICODE. , _wopen.

, Windows UNIX, , . , / .

, , , - Windows.

, Windows . , CreateProcess fork; exec.

, errno.

UNIX- , , , " /" Windows- AllocConsole. " ", GetTempFileName. . , UNIX ( sigaddset ) "Windows" " SEH, VEH", , . UNIX, Windows , "Windows" , , , 6.

, , , , . , , .

710 UNIX POSIX (Pthreads), UNIX. , UNIX , , , .

, , , . , . , UNIX Windows , , , .

. , , . . .

2 3:

Windows UNIX
/ AllocConsole / -  
/ FreeConsole / -  
/ ReadConsole read getc, scanf, gets  
/ SetConsoleMode ioctl -  
/ WriteConsole write putc, printf, puts  
CreateDirectory mkdir* -
FindClose closedir* -
FindFirstFile opendir*, readdir* - ,
FindNextFile readdir* - ,
GetCurrentDirectory getcwd* -  
GetFullPathName - -  
GetSystemDirectory -  
RemoveDirectory rmdir, unlink* remove  
SearchPath opendir, readdir -
SetCurrentDirectory chdir *, fchdir -
FormatMessage strerror perror  
GetLastError errno errno
SetLastError errno errno
LockFile fcntl(cmd=F_GETLK,) -  
LockFileEx fcntl(cmd=F_GETLK,) -  
UnlockFile fcntl(cmd=F_GETLK,) -  
UnlockFileEx fcntl(cmd=F_GETLK,) -  
CloseHandle ( ) close* fclose CloseHandle
CopyFile open; read; write; close fopen; fread; fwrite; fclose
CreateFile open*, creat* fopen /
DeleteFile unlink* remove
FlushFileBuffers fsynch fflush
GetFileAttributes stat*, fstat*, lstat -  
GetFileInformationByHandle stat*, fstat*, lstat -
GetFileSize stat*, fstat*, lstat ftell, fseek
GetFileTime stat*, fstat*, lstat -  
GetFileType stat*, fstat*, lstat -
GetStdHandle 0, 1 2 stdin, stdout, stderr  
GetTempFileName tmpnam
GetTempFileName, CreateFile tmpfile
GetTempPath /temp path -
MoveFile, MoveFileEx rename
CreateHardLink link, unlink* - Windows
- symlink -
- readlink -
; ReadFile 0 ; read 0 feof
; ReadFile readv ; freads
; WriteFile writev ; fwrites
ReadFile read fread
SetEndOfFile chsize* -  
SetFileAttributes fcntl -  
SetFilePointer lseek fseek
SetFilePointer ( 0) lseek(0) rewind  
SetFileTime utime* -  
SetStdHandle close, dup*, dup2* fcntl freopen dup2 fcntl
WriteFile write fwrite
GetDiskFreeSpace - -  
GetSystemInfo getrusage -  
GetVersion uname -  
GetVolumeInformation - -  
GlobalMemoryStatus getrlimit -  
sysconf, pathconf, fpathconf -  
GetSystemTime time, gmtime  
. ls ( 3.2) asctime  
CompareFileTime difftime ""
FileTimeToLocalFileTime, FileTimeToSystemTime localtime  
FileTimeToSystemTime gmtime  
GetLocalTime time, localtime  
. touch ( 3.3) strftime  
SetLocalTime - -  
SetSystemTime - -  
difftime  
SystemTimeToFileTime mktime  

4:

Windows UNIX
SEH __try__except
SEH __try__finally
SEH AbnormalTermination
SEH GetExceptionCode
SEH RaiseException signal, raise
__finally atexit
TerminateProcess kill raise
signal
SEH, VEH sigemptyset -
SEH, VEH sigfillset -
SEH, VEH sigaddset -
SEH, VEH sigdelset -
SEH, VEH sigismember -
SEH, VEH sigprocmask -
SEH, VEH sigpending -
SEH, VEH sigaction -
SEH, VEH sigsetjmp -
SEH, VEH siglongjmp -
SEH, VEH sigsuspendf -
SEH, VEH psignal -
SEH, VEH abort

. UNIX .

5: , DLL

Windows UNIX
CreateFileMapping shmget -
MapViewOfFile mmap, shmat -
MapViewOfFileEx mmap, shmat -
OpenFileMapping shmget -
UnmapViewOfFile munmap, shmdt, shmctl -
GetProcessHeap - -
GetSystemInfo - -
HeapAlloc sbrk, brk malloc, calloc
HeapCreate - -
HeapDestroy - -
HeapFree free
HeapReAlloc realloc
HeapSize - -
CloseHandle ( ) shmctl -
CreateFileMapping, OpenFileMapping shmget -
MapViewOfFile shmat -
UnmapViewOfFile shmdt -
DLL LoadLibrary dlopen -
DLL FreeLibrary dlclose -
DLL GetProcAddress dlsyn -
DLL DllMain pthread_once -

6:

Windows UNIX
CreateProcess fork(); execl()*, system() - 6
ExitProcess _exit exit  
GetCommandLine argv[] argv[]  
GetCurrentProcess getpid* -  
GetCurrentProcessId getpid* -  
GetEnvironmentStrings - getenv  
GetEnvironmentVariable - getenv  
GetExitCodeProcess wait, waitpid -  
GetProcessTimes times, wait3, wait4 -  
GetProcessWorkingSetSize wait3, wait4 -  
- execl*,execv*,execle*,execve*,execlp*,execvp* - Windows
- fork, vfork - Windows
- getppid - "/" Windows
- getgid, getegid - Windows
- getpgrp -  
- setpgid -  
- setsid -  
- tcgetpgrp -  
- tcsetpgrp -  
OpenProcess - -  
SetEnvironmentVariable putenv - putenv
TerminateProcess kill -  
: WaitForMultipleObjects ( ) waitpid -  
: WaitForSingleObject ( ) wait, waitpid -  
KillTimer alarm(0) -  
SetTimer alarm -  
Sleep sleep -  
Sleep poll select -  

7:

Windows UNIX/Pthreads
CreateRemoteThread -  
TLS TlsAlloc pthread_key_alloc  
TLS TlsFree pthread_key_delete  
TLS TlsGetValue pthread_getspecific  
TLS TlsSetValue pthread_setspecific  
CreateThread, _beginthreadex pthread_create  
ExitThread, _endthreadex pthread_exit  
GetCurrentThread pthread_self  
GetCurrentThreadId -  
GetExitCodeThread pthread_yield  
ResumeThread -  
SuspendThread -  
TerminateThread pthread_cancel pthread_cancel
WaitForSingleObject ( ) pthread_join  
GetPriorityClass pthread_attr_getschedpolicy, getpriority  
GetThreadPriority pthread_attr_getschedparam  
SetPriorityClass pthread_attr_setschedpolicy, setpriority, nice  
SetThreadPriority pthread_attr_setschedparam  

. UNIX, Pthreads , UNIX.

8-10:

Windows UNIX/Pthreads
: DeleteCriticalSection .
: EnterCriticalSection .
: InitializeCriticalSection  
: LeaveCriticalSection  
: CloseHandle ( ) pthread_cond_destroy  
: CreateEvent pthread_cond_init  
: PulseEvent pthread_cond_signal
: ResetEvent -  
: SetEvent pthread_cond_broadcast
: WaitForSingleObject ( ) pthread_cond_wait  
: WaitForSingleObject ( ) pthread_timed_wait  
: CloseHandle ( ) pthread_mutex_destroy  
: CreateMutex pthread_mutex_init  
: ReleaseMutex pthread_mutex_unlock  
: WaitForSingleObject( ) pthread_mutex_lock  
: CreateSemaphore semget  
: - semctl Windows
: OpenSemaphore semget  
: ReleaseSemaphore semop (+)  
: WaitForSingleObject ( ) semop (-) Windows

11:

Windows UNIX
IPC CallNamedPipe - - CreateFile, WriteFile, ReadFile, CloseHandle
IPC CloseHandle (pipe handle) close, msgctl pclose  
IPC ConnectNamedPipe - -  
IPC CreateMailslot - -  
IPC CreateNamedPipe mkfifo, msgget -  
IPC CreatePipe pipe popen He . [40]
IPC DuplicateHandle dup, dup2, or fcntl - CONIN$, CONOUT$
IPC GetNamedPipeHandleState stat, fstat, lstat64 -  
IPC GetNamedPipeInfo stat, fstat, lstat -  
IPC ImpersonateNamedPipeClient - -  
IPC PeekNamedPipe - -  
IPC ReadFile ( ) read (fifo), msgsnd -  
IPC RevertToSelf - -  
IPC SetNamedPipeHandleState - -  
IPC TransactNamedPipe - - WriteFile; ReadFile
IPC WriteFile ( ) write (fifo), msgrcv -  
GetComputerName uname -  
SetComputerName - -  
SetNamedPipeIdentity -  

14: /

Windows UNIX
/ GetOverlappedResult - -  
/ ReadFileEx - - /
/ SleepEx - -
/ WaitForMultipleObjects ( ) poll, select -  
/ WaitForMultipleObjectsEx - -
/ WriteFileEx - - /
/ WaitForSingleObjectEx waitpid -

15: Windows

Windows UNIX
AddAccessAllowedAce chmod, fchmod
AddAccessDeniedAce chmod, fchmod
AddAuditAce -
CreatePrivateObjectSecurity -
DeleteAce chmod, fchmod
DestroyPrivateObjectSecurity -
GetAce stat*, fstat*, lstat
GetAclInformation stat*, fstat*, lstat
GetFileSecurity stat*, fstat*, lstat
GetPrivateObjectSecurity -
GetSecurityDescriptorDacl stat*, fstat*, lstat
GetUserName getlogin
InitializeAcl -
InitializeSecurityDescriptor umask
LookupAccountName getpwnam, getgrnam
LookupAccountSid getpwuid, getuid, geteuid
- getpwend, setpwent, endpwent
- getgrent, setgrent, endgrent
- setuid, seteuid, setreuid
- setgid, setegid, setregid
OpenProcessToken getgroups, setgroups, initgroups
SetFileSecurity chmod*, fchmod
SetPrivateObjectSecurity -
SetSecurityDescriptorDacl umask
SetSecurityDescriptorGroup chown, fchown, lchown
SetSecurityDescriptorOwner chown, fchown, lchown
SetSecurityDescriptorSacl -





:


: 2015-09-20; !; : 419 |


:

:

, .
==> ...

1531 - | 1303 -


© 2015-2024 lektsii.org - -

: 0.017 .