aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-10-14 10:12:57 +0200
committerPatrik Nyblom <[email protected]>2010-11-30 16:29:05 +0100
commit63eeba2f6829aac2644eaf212ebef9cdf4b59e8d (patch)
treef5dd68d6626e30fe1e86ac312c60fc23c8120c0f /erts/emulator
parenta3ad23a50ef3dbdb8309bd178014d3285d87a78f (diff)
downloadotp-63eeba2f6829aac2644eaf212ebef9cdf4b59e8d.tar.gz
otp-63eeba2f6829aac2644eaf212ebef9cdf4b59e8d.tar.bz2
otp-63eeba2f6829aac2644eaf212ebef9cdf4b59e8d.zip
Handle binary file names and conversion of unicode strings
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/bif.tab4
-rw-r--r--erts/emulator/beam/erl_unicode.c4
-rw-r--r--erts/emulator/drivers/common/efile_drv.c18
3 files changed, 14 insertions, 12 deletions
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index cf251d9016..3de5e63a63 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -797,8 +797,8 @@ bif erlang:nif_error/2
#
# Helpers for unicode filenames
#
-bif file:internal_name2native/1
-bif file:internal_native2name/1
+bif prim_file:internal_name2native/1
+bif prim_file:internal_native2name/1
bif file:native_name_encoding/0
#
# Obsolete
diff --git a/erts/emulator/beam/erl_unicode.c b/erts/emulator/beam/erl_unicode.c
index 3e7a935cef..6d8e9ccd90 100644
--- a/erts/emulator/beam/erl_unicode.c
+++ b/erts/emulator/beam/erl_unicode.c
@@ -2105,7 +2105,7 @@ L_Again: /* Restart with sublist, old listend was pushed on stack */
-BIF_RETTYPE file_internal_name2native_1(BIF_ALIST_1)
+BIF_RETTYPE prim_file_internal_name2native_1(BIF_ALIST_1)
{
int encoding = erts_get_native_filename_encoding();
Sint need;
@@ -2184,7 +2184,7 @@ BIF_RETTYPE file_internal_name2native_1(BIF_ALIST_1)
BIF_RET(bin_term);
}
-BIF_RETTYPE file_internal_native2name_1(BIF_ALIST_1)
+BIF_RETTYPE prim_file_internal_native2name_1(BIF_ALIST_1)
{
Eterm real_bin;
Uint offset;
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index c450f10f48..5aa5f60d0f 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -67,6 +67,8 @@
#define FILE_RESP_LDATA 6
#define FILE_RESP_N2DATA 7
#define FILE_RESP_EOF 8
+#define FILE_RESP_FNAME 9
+#define FILE_RESP_ALL_DATA 10
/* Options */
@@ -1591,7 +1593,7 @@ static void invoke_readdir(void *data)
buf_sz = READDIR_BUFSIZE - 4/* EOB */;
}
- p[4] = FILE_RESP_OK;
+ p[4] = FILE_RESP_FNAME;
buf_sz -= 4 + 1;
str = p + 4 + 1;
ASSERT(buf_sz >= MAXPATHLEN + 1);
@@ -1911,7 +1913,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
if (!d->result_ok)
reply_error(desc, &d->errInfo);
else {
- header[0] = FILE_RESP_OK;
+ header[0] = FILE_RESP_ALL_DATA;
TRACE_C('R');
driver_output_binary(desc->port, header, 1,
d->c.read_file.binp,
@@ -1968,10 +1970,10 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
if (!d->result_ok)
reply_error(desc, &d->errInfo);
else {
- resbuf[0] = FILE_RESP_OK;
+ resbuf[0] = FILE_RESP_FNAME;
length = 1+strlen((char*) resbuf+1);
TRACE_C('R');
- driver_output2(desc->port, resbuf, length, NULL, 0);
+ driver_output2(desc->port, resbuf, 1, resbuf+1, length-1);
}
free_data(data);
break;
@@ -2031,7 +2033,7 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
int sz = get_int32(p);
while (sz) { /* 0 == EOB */
p += 4;
- driver_output2(desc->port, p, sz, NULL, 0);
+ driver_output2(desc->port, p, 1, p+1, sz-1);
p += sz;
sz = get_int32(p);
}
@@ -2210,12 +2212,12 @@ file_output(ErlDrvData e, char* buf, int count)
errInfo.posix_errno = 0;
dir_handle = NULL;
- resbuf[0] = FILE_RESP_OK;
+ resbuf[0] = FILE_RESP_FNAME;
while (efile_readdir(&errInfo, name, &dir_handle,
resbuf+1, RESBUFSIZE)) {
- int length = 1 + strlen(resbuf+1);
- driver_output2(desc->port, resbuf, length, NULL, 0);
+ int length = strlen(resbuf+1);
+ driver_output2(desc->port, resbuf, 1, resbuf+1, length);
}
if (errInfo.posix_errno != 0) {
reply_error(desc, &errInfo);